@evelan/jexity-widget 0.28.1 → 0.30.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 (72) hide show
  1. package/README.md +7 -0
  2. package/dist/index.mjs +4637 -3353
  3. package/dist/index.mjs.map +1 -1
  4. package/dist/loader.js +6 -6
  5. package/dist/loader.js.map +1 -1
  6. package/dist/react.mjs +5050 -3715
  7. package/dist/react.mjs.map +1 -1
  8. package/dist/types/entries/esm.d.ts +6 -0
  9. package/dist/types/entries/esm.d.ts.map +1 -1
  10. package/dist/types/entries/react.d.ts +10 -0
  11. package/dist/types/entries/react.d.ts.map +1 -1
  12. package/dist/types/features/chat/components/ChatScreen.d.ts.map +1 -1
  13. package/dist/types/features/chat/components/EscalationFormScreen.d.ts.map +1 -1
  14. package/dist/types/features/chat/components/FormMessage.d.ts.map +1 -1
  15. package/dist/types/features/chat/components/MessageList.d.ts.map +1 -1
  16. package/dist/types/features/chat/components/SourcesRow.d.ts +4 -3
  17. package/dist/types/features/chat/components/SourcesRow.d.ts.map +1 -1
  18. package/dist/types/features/chat/composer/components/SessionErrorNotice.d.ts.map +1 -1
  19. package/dist/types/features/chat/composer/hooks/useAttachmentUpload.d.ts.map +1 -1
  20. package/dist/types/features/chat/composer/hooks/useSendMessage.d.ts.map +1 -1
  21. package/dist/types/features/chat/hooks/useConversation.d.ts.map +1 -1
  22. package/dist/types/features/chat/hooks/useConvexSession.d.ts.map +1 -1
  23. package/dist/types/features/chat/hooks/useEscalation.d.ts +8 -10
  24. package/dist/types/features/chat/hooks/useEscalation.d.ts.map +1 -1
  25. package/dist/types/features/chat/hooks/useSignedInContact.d.ts +12 -0
  26. package/dist/types/features/chat/hooks/useSignedInContact.d.ts.map +1 -0
  27. package/dist/types/features/chat/lib/chatOfAnotherUser.d.ts +14 -0
  28. package/dist/types/features/chat/lib/chatOfAnotherUser.d.ts.map +1 -0
  29. package/dist/types/features/chat/state/session-error.d.ts +5 -1
  30. package/dist/types/features/chat/state/session-error.d.ts.map +1 -1
  31. package/dist/types/features/home/components/ChatList.d.ts +18 -0
  32. package/dist/types/features/home/components/ChatList.d.ts.map +1 -0
  33. package/dist/types/features/home/components/DeleteChatsSheet.d.ts +20 -0
  34. package/dist/types/features/home/components/DeleteChatsSheet.d.ts.map +1 -0
  35. package/dist/types/features/home/components/HomeScreen.d.ts +7 -1
  36. package/dist/types/features/home/components/HomeScreen.d.ts.map +1 -1
  37. package/dist/types/i18n/index.d.ts +6 -0
  38. package/dist/types/i18n/index.d.ts.map +1 -1
  39. package/dist/types/i18n/locales/de-formal.d.ts +293 -0
  40. package/dist/types/i18n/locales/de-formal.d.ts.map +1 -0
  41. package/dist/types/i18n/locales/de.d.ts +30 -1
  42. package/dist/types/i18n/locales/de.d.ts.map +1 -1
  43. package/dist/types/i18n/locales/en.d.ts +62 -1
  44. package/dist/types/i18n/locales/en.d.ts.map +1 -1
  45. package/dist/types/lib/refreshBootstrap.d.ts +1 -1
  46. package/dist/types/lib/refreshBootstrap.d.ts.map +1 -1
  47. package/dist/types/lib/userToken.d.ts +49 -0
  48. package/dist/types/lib/userToken.d.ts.map +1 -0
  49. package/dist/types/lib/widget-config.d.ts +19 -1
  50. package/dist/types/lib/widget-config.d.ts.map +1 -1
  51. package/dist/types/lib/widgetBootstrap.d.ts +19 -2
  52. package/dist/types/lib/widgetBootstrap.d.ts.map +1 -1
  53. package/dist/types/module/screens/ScreenRouter.d.ts +5 -1
  54. package/dist/types/module/screens/ScreenRouter.d.ts.map +1 -1
  55. package/dist/types/module/screens/screens.state.d.ts +5 -1
  56. package/dist/types/module/screens/screens.state.d.ts.map +1 -1
  57. package/dist/types/module/shell/WidgetShell.d.ts.map +1 -1
  58. package/dist/types/module/shell/hooks/useBootstrap.d.ts +3 -1
  59. package/dist/types/module/shell/hooks/useBootstrap.d.ts.map +1 -1
  60. package/dist/types/module/shell/mount.d.ts.map +1 -1
  61. package/dist/types/module/shell/shell.state.d.ts +18 -1
  62. package/dist/types/module/shell/shell.state.d.ts.map +1 -1
  63. package/dist/types/module/shell/widget-instance.d.ts.map +1 -1
  64. package/dist/types/module/visitor/idle-lock.d.ts +6 -0
  65. package/dist/types/module/visitor/idle-lock.d.ts.map +1 -1
  66. package/dist/types/module/visitor/visitor.state.d.ts +17 -0
  67. package/dist/types/module/visitor/visitor.state.d.ts.map +1 -1
  68. package/dist/types/types.d.ts +25 -0
  69. package/dist/types/types.d.ts.map +1 -1
  70. package/dist/widget.js +38 -38
  71. package/dist/widget.js.map +1 -1
  72. package/package.json +3 -3
package/dist/widget.js CHANGED
@@ -1,47 +1,47 @@
1
- (function(){"use strict";var En,L,Vo,Ho,At,Wo,Qo,Go,ui,pr,In,Ko,di,hi,fi,Yo,mr={},gr=[],Nc=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Pn=Array.isArray;function at(t,e){for(var n in e)t[n]=e[n];return t}function pi(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function Ge(t,e,n){var r,i,o,a={};for(o in e)o=="key"?r=e[o]:o=="ref"?i=e[o]:a[o]=e[o];if(arguments.length>2&&(a.children=arguments.length>3?En.call(arguments,2):n),typeof t=="function"&&t.defaultProps!=null)for(o in t.defaultProps)a[o]===void 0&&(a[o]=t.defaultProps[o]);return Mn(t,a,r,i,null)}function Mn(t,e,n,r,i){var o={type:t,props:e,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++Vo,__i:-1,__u:0};return i==null&&L.vnode!=null&&L.vnode(o),o}function Lc(){return{current:null}}function ee(t){return t.children}function et(t,e){this.props=t,this.context=e}function rn(t,e){if(e==null)return t.__?rn(t.__,t.__i+1):null;for(var n;e<t.__k.length;e++)if((n=t.__k[e])!=null&&n.__e!=null)return n.__e;return typeof t.type=="function"?rn(t):null}function Oc(t){if(t.__P&&t.__d){var e=t.__v,n=e.__e,r=[],i=[],o=at({},e);o.__v=e.__v+1,L.vnode&&L.vnode(o),gi(t.__P,o,e,t.__n,t.__P.namespaceURI,32&e.__u?[n]:null,r,n??rn(e),!!(32&e.__u),i),o.__v=e.__v,o.__.__k[o.__i]=o,na(r,o,i),e.__e=e.__=null,o.__e!=n&&Jo(o)}}function Jo(t){if((t=t.__)!=null&&t.__c!=null)return t.__e=t.__c.base=null,t.__k.some(function(e){if(e!=null&&e.__e!=null)return t.__e=t.__c.base=e.__e}),Jo(t)}function mi(t){(!t.__d&&(t.__d=!0)&&At.push(t)&&!xr.__r++||Wo!=L.debounceRendering)&&((Wo=L.debounceRendering)||Qo)(xr)}function xr(){try{for(var t,e=1;At.length;)At.length>e&&At.sort(Go),t=At.shift(),e=At.length,Oc(t)}finally{At.length=xr.__r=0}}function Xo(t,e,n,r,i,o,a,l,c,u,d){var m,h,p,x,w,b,v,k=r&&r.__k||gr,A=e.length;for(c=$c(n,e,k,c,A),m=0;m<A;m++)(p=n.__k[m])!=null&&(h=p.__i!=-1&&k[p.__i]||mr,p.__i=m,b=gi(t,p,h,i,o,a,l,c,u,d),x=p.__e,p.ref&&h.ref!=p.ref&&(h.ref&&bi(h.ref,null,p),d.push(p.ref,p.__c||x,p)),w==null&&x!=null&&(w=x),(v=!!(4&p.__u))||h.__k===p.__k?(c=Zo(p,c,t,v),v&&h.__e&&(h.__e=null)):typeof p.type=="function"&&b!==void 0?c=b:x&&(c=x.nextSibling),p.__u&=-7);return n.__e=w,c}function $c(t,e,n,r,i){var o,a,l,c,u,d=n.length,m=d,h=0;for(t.__k=new Array(i),o=0;o<i;o++)(a=e[o])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=t.__k[o]=Mn(null,a,null,null,null):Pn(a)?a=t.__k[o]=Mn(ee,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=t.__k[o]=Mn(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):t.__k[o]=a,c=o+h,a.__=t,a.__b=t.__b+1,l=null,(u=a.__i=Dc(a,n,c,m))!=-1&&(m--,(l=n[u])&&(l.__u|=2)),l==null||l.__v==null?(u==-1&&(i>d?h--:i<d&&h++),typeof a.type!="function"&&(a.__u|=4)):u!=c&&(u==c-1?h--:u==c+1?h++:(u>c?h--:h++,a.__u|=4))):t.__k[o]=null;if(m)for(o=0;o<d;o++)(l=n[o])!=null&&(2&l.__u)==0&&(l.__e==r&&(r=rn(l)),ia(l,l));return r}function Zo(t,e,n,r){var i,o;if(typeof t.type=="function"){for(i=t.__k,o=0;i&&o<i.length;o++)i[o]&&(i[o].__=t,e=Zo(i[o],e,n,r));return e}t.__e!=e&&(r&&(e&&t.type&&!e.parentNode&&(e=rn(t)),n.insertBefore(t.__e,e||null)),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function st(t,e){return e=e||[],t==null||typeof t=="boolean"||(Pn(t)?t.some(function(n){st(n,e)}):e.push(t)),e}function Dc(t,e,n,r){var i,o,a,l=t.key,c=t.type,u=e[n],d=u!=null&&(2&u.__u)==0;if(u===null&&l==null||d&&l==u.key&&c==u.type)return n;if(r>(d?1:0)){for(i=n-1,o=n+1;i>=0||o<e.length;)if((u=e[a=i>=0?i--:o++])!=null&&(2&u.__u)==0&&l==u.key&&c==u.type)return a}return-1}function ea(t,e,n){e[0]=="-"?t.setProperty(e,n??""):t[e]=n==null?"":typeof n!="number"||Nc.test(e)?n:n+"px"}function br(t,e,n,r,i){var o,a;e:if(e=="style")if(typeof n=="string")t.style.cssText=n;else{if(typeof r=="string"&&(t.style.cssText=r=""),r)for(e in r)n&&e in n||ea(t.style,e,"");if(n)for(e in n)r&&n[e]==r[e]||ea(t.style,e,n[e])}else if(e[0]=="o"&&e[1]=="n")o=e!=(e=e.replace(Ko,"$1")),a=e.toLowerCase(),e=a in t||e=="onFocusOut"||e=="onFocusIn"?a.slice(2):e.slice(2),t.l||(t.l={}),t.l[e+o]=n,n?r?n[In]=r[In]:(n[In]=di,t.addEventListener(e,o?fi:hi,o)):t.removeEventListener(e,o?fi:hi,o);else{if(i=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in t)try{t[e]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&e[4]!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&n==1?"":n))}}function ta(t){return function(e){if(this.l){var n=this.l[e.type+t];if(e[pr]==null)e[pr]=di++;else if(e[pr]<n[In])return;return n(L.event?L.event(e):e)}}}function gi(t,e,n,r,i,o,a,l,c,u){var d,m,h,p,x,w,b,v,k,A,N,P,T,$,R,se,V=e.type;if(e.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[l=e.__e=n.__e]),(d=L.__b)&&d(e);e:if(typeof V=="function"){m=a.length;try{if(k=e.props,A=V.prototype&&V.prototype.render,N=(d=V.contextType)&&r[d.__c],P=d?N?N.props.value:d.__:r,n.__c?v=(h=e.__c=n.__c).__=h.__E:(A?e.__c=h=new V(k,P):(e.__c=h=new et(k,P),h.constructor=V,h.render=zc),N&&N.sub(h),h.state||(h.state={}),h.__n=r,p=h.__d=!0,h.__h=[],h._sb=[]),A&&h.__s==null&&(h.__s=h.state),A&&V.getDerivedStateFromProps!=null&&(h.__s==h.state&&(h.__s=at({},h.__s)),at(h.__s,V.getDerivedStateFromProps(k,h.__s))),x=h.props,w=h.state,h.__v=e,p)A&&V.getDerivedStateFromProps==null&&h.componentWillMount!=null&&h.componentWillMount(),A&&h.componentDidMount!=null&&h.__h.push(h.componentDidMount);else{if(A&&V.getDerivedStateFromProps==null&&k!==x&&h.componentWillReceiveProps!=null&&h.componentWillReceiveProps(k,P),e.__v==n.__v||!h.__e&&h.shouldComponentUpdate!=null&&h.shouldComponentUpdate(k,h.__s,P)===!1){e.__v!=n.__v&&(h.props=k,h.state=h.__s,h.__d=!1),e.__e=n.__e,e.__k=n.__k,e.__k.some(function(y){y&&(y.__=e)}),gr.push.apply(h.__h,h._sb),h._sb=[],h.__h.length&&a.push(h);break e}h.componentWillUpdate!=null&&h.componentWillUpdate(k,h.__s,P),A&&h.componentDidUpdate!=null&&h.__h.push(function(){h.componentDidUpdate(x,w,b)})}if(h.context=P,h.props=k,h.__P=t,h.__e=!1,T=L.__r,$=0,A)h.state=h.__s,h.__d=!1,T&&T(e),d=h.render(h.props,h.state,h.context),gr.push.apply(h.__h,h._sb),h._sb=[];else do h.__d=!1,T&&T(e),d=h.render(h.props,h.state,h.context),h.state=h.__s;while(h.__d&&++$<25);h.state=h.__s,h.getChildContext!=null&&(r=at(at({},r),h.getChildContext())),A&&!p&&h.getSnapshotBeforeUpdate!=null&&(b=h.getSnapshotBeforeUpdate(x,w)),R=d!=null&&d.type===ee&&d.key==null?ra(d.props.children):d,l=Xo(t,Pn(R)?R:[R],e,n,r,i,o,a,l,c,u),h.base=e.__e,e.__u&=-161,h.__h.length&&a.push(h),v&&(h.__E=h.__=null)}catch(y){if(a.length=m,e.__v=null,c||o!=null)if(y.then){for(e.__u|=c?160:128;l&&l.nodeType==8&&l.nextSibling;)l=l.nextSibling;o!=null&&(o[o.indexOf(l)]=null),e.__e=l}else{if(o!=null)for(se=o.length;se--;)pi(o[se]);xi(e)}else e.__e=n.__e,!e.__k&&n.__k&&(e.__k=n.__k),y.then||xi(e);L.__e(y,e,n)}}else o==null&&e.__v==n.__v?(e.__k=n.__k,e.__e=n.__e):l=e.__e=qc(n.__e,e,n,r,i,o,a,c,u);return(d=L.diffed)&&d(e),128&e.__u?void 0:l}function xi(t){t&&(t.__c&&(t.__c.__e=!0),t.__k&&t.__k.some(xi))}function na(t,e,n){for(var r=0;r<n.length;r++)bi(n[r],n[++r],n[++r]);L.__c&&L.__c(e,t),t.some(function(i){try{t=i.__h,i.__h=[],t.some(function(o){o.call(i)})}catch(o){L.__e(o,i.__v)}})}function ra(t){return typeof t!="object"||t==null||t.__b>0?t:Pn(t)?t.map(ra):t.constructor!==void 0?null:at({},t)}function qc(t,e,n,r,i,o,a,l,c){var u,d,m,h,p,x,w,b=n.props||mr,v=e.props,k=e.type;if(k=="svg"?i="http://www.w3.org/2000/svg":k=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),o!=null){for(u=0;u<o.length;u++)if((p=o[u])&&"setAttribute"in p==!!k&&(k?p.localName==k:p.nodeType==3)){t=p,o[u]=null;break}}if(t==null){if(k==null)return document.createTextNode(v);t=document.createElementNS(i,k,v.is&&v),l&&(L.__m&&L.__m(e,o),l=!1),o=null}if(k==null)b===v||l&&t.data==v||(t.data=v);else{if(o=k=="textarea"&&v.defaultValue!=null?null:o&&En.call(t.childNodes),!l&&o!=null)for(b={},u=0;u<t.attributes.length;u++)b[(p=t.attributes[u]).name]=p.value;for(u in b)p=b[u],u=="dangerouslySetInnerHTML"?m=p:u=="children"||u in v||u=="value"&&"defaultValue"in v||u=="checked"&&"defaultChecked"in v||br(t,u,null,p,i);for(u in v)p=v[u],u=="children"?h=p:u=="dangerouslySetInnerHTML"?d=p:u=="value"?x=p:u=="checked"?w=p:l&&typeof p!="function"||b[u]===p||br(t,u,p,b[u],i);if(d)l||m&&(d.__html==m.__html||d.__html==t.innerHTML)||(t.innerHTML=d.__html),e.__k=[];else if(m&&(t.innerHTML=""),Xo(e.type=="template"?t.content:t,Pn(h)?h:[h],e,n,r,k=="foreignObject"?"http://www.w3.org/1999/xhtml":i,o,a,o?o[0]:n.__k&&rn(n,0),l,c),o!=null)for(u=o.length;u--;)pi(o[u]);l&&k!="textarea"||(u="value",k=="progress"&&x==null?t.removeAttribute("value"):x!=null&&(x!==t[u]||k=="progress"&&!x||k=="option"&&x!=b[u])&&br(t,u,x,b[u],i),u="checked",w!=null&&w!=t[u]&&br(t,u,w,b[u],i))}return t}function bi(t,e,n){try{if(typeof t=="function"){var r=typeof t.__u=="function";r&&t.__u(),r&&e==null||(t.__u=t(e))}else t.current=e}catch(i){L.__e(i,n)}}function ia(t,e,n){var r,i;if(L.unmount&&L.unmount(t),(r=t.ref)&&(r.current&&r.current!=t.__e||bi(r,null,e)),(r=t.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(o){L.__e(o,e)}r.base=r.__P=r.__n=null}if(r=t.__k)for(i=0;i<r.length;i++)r[i]&&ia(r[i],e,n||typeof t.type!="function");n||pi(t.__e),t.__c=t.__=t.__e=void 0}function zc(t,e,n){return this.constructor(t,n)}function Ut(t,e,n){var r,i,o,a;e==document&&(e=document.documentElement),L.__&&L.__(t,e),i=(r=typeof n=="function")?null:n&&n.__k||e.__k,o=[],a=[],gi(e,t=(!r&&n||e).__k=Ge(ee,null,[t]),i||mr,mr,e.namespaceURI,!r&&n?[n]:i?null:e.firstChild?En.call(e.childNodes):null,o,!r&&n?n:i?i.__e:e.firstChild,r,a),na(o,t,a),t.props.children=null}function oa(t,e){Ut(t,e,oa)}function Fc(t,e,n){var r,i,o,a,l=at({},t.props);for(o in t.type&&t.type.defaultProps&&(a=t.type.defaultProps),e)o=="key"?r=e[o]:o=="ref"?i=e[o]:l[o]=e[o]===void 0&&a!=null?a[o]:e[o];return arguments.length>2&&(l.children=arguments.length>3?En.call(arguments,2):n),Mn(t.type,l,r||t.key,i||t.ref,null)}function Uc(t){function e(n){var r,i;return this.getChildContext||(r=new Set,(i={})[e.__c]=this,this.getChildContext=function(){return i},this.componentWillUnmount=function(){r=null},this.shouldComponentUpdate=function(o){this.props.value!=o.value&&r.forEach(function(a){a.__e=!0,mi(a)})},this.sub=function(o){r.add(o);var a=o.componentWillUnmount;o.componentWillUnmount=function(){r&&r.delete(o),a&&a.call(o)}}),n.children}return e.__c="__cC"+Yo++,e.__=t,e.Provider=e.__l=(e.Consumer=function(n,r){return n.children(r)}).contextType=e,e}En=gr.slice,L={__e:function(t,e,n,r){for(var i,o,a;e=e.__;)if((i=e.__c)&&!i.__)try{if((o=i.constructor)&&o.getDerivedStateFromError!=null&&(i.setState(o.getDerivedStateFromError(t)),a=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(t,r||{}),a=i.__d),a)return i.__E=i}catch(l){t=l}throw t}},Vo=0,Ho=function(t){return t!=null&&t.constructor===void 0},et.prototype.setState=function(t,e){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=at({},this.state),typeof t=="function"&&(t=t(at({},n),this.props)),t&&at(n,t),t!=null&&this.__v&&(e&&this._sb.push(e),mi(this))},et.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),mi(this))},et.prototype.render=ee,At=[],Qo=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Go=function(t,e){return t.__v.__b-e.__v.__b},xr.__r=0,ui=Math.random().toString(8),pr="__d"+ui,In="__a"+ui,Ko=/(PointerCapture)$|Capture$/i,di=0,hi=ta(!1),fi=ta(!0),Yo=0;var Bc=0;function s(t,e,n,r,i,o){e||(e={});var a,l,c=e;if("ref"in c)for(l in c={},e)l=="ref"?a=e[l]:c[l]=e[l];var u={type:t,props:c,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Bc,__i:-1,__u:0,__source:i,__self:o};if(typeof t=="function"&&(a=t.defaultProps))for(l in a)c[l]===void 0&&(c[l]=a[l]);return L.vnode&&L.vnode(u),u}var Rt,re,vi,aa,on=0,sa=[],ce=L,la=ce.__b,ca=ce.__r,ua=ce.diffed,da=ce.__c,ha=ce.unmount,fa=ce.__;function an(t,e){ce.__h&&ce.__h(re,t,on||e),on=0;var n=re.__H||(re.__H={__:[],__h:[]});return t>=n.__.length&&n.__.push({}),n.__[t]}function O(t){return on=1,Be(ya,t)}function Be(t,e,n){var r=an(Rt++,2);if(r.t=t,!r.__c&&(r.__=[n?n(e):ya(void 0,e),function(l){var c=r.__N?r.__N[0]:r.__[0],u=r.t(c,l);c!==u&&(r.__N=[u,r.__[1]],r.__c.setState({}))}],r.__c=re,!re.__f)){var i=function(l,c,u){if(!r.__c.__H)return!0;var d=!1,m=r.__c.props!==l;if(r.__c.__H.__.some(function(p){if(p.__N){d=!0;var x=p.__[0];p.__=p.__N,p.__N=void 0,x!==p.__[0]&&(m=!0)}}),o){var h=o.call(this,l,c,u);return d?h||m:h}return!d||m};re.__f=!0;var o=re.shouldComponentUpdate,a=re.componentWillUpdate;re.componentWillUpdate=function(l,c,u){if(this.__e){var d=o;o=void 0,i(l,c,u),o=d}a&&a.call(this,l,c,u)},re.shouldComponentUpdate=i}return r.__N||r.__}function M(t,e){var n=an(Rt++,3);!ce.__s&&wi(n.__H,e)&&(n.__=t,n.u=e,re.__H.__h.push(n))}function sn(t,e){var n=an(Rt++,4);!ce.__s&&wi(n.__H,e)&&(n.__=t,n.u=e,re.__h.push(n))}function ie(t){return on=5,we(function(){return{current:t}},[])}function pa(t,e,n){on=6,sn(function(){if(typeof t=="function"){var r=t(e());return function(){t(null),r&&typeof r=="function"&&r()}}if(t)return t.current=e(),function(){return t.current=null}},n==null?n:n.concat(t))}function we(t,e){var n=an(Rt++,7);return wi(n.__H,e)&&(n.__=t(),n.__H=e,n.__h=t),n.__}function Z(t,e){return on=8,we(function(){return t},e)}function Nn(t){var e=re.context[t.__c],n=an(Rt++,9);return n.c=t,e?(n.__==null&&(n.__=!0,e.sub(re)),e.props.value):t.__}function ma(t,e){ce.useDebugValue&&ce.useDebugValue(e?e(t):t)}function ga(){var t=an(Rt++,11);if(!t.__){for(var e=re.__v;e!==null&&!e.__m&&e.__!==null;)e=e.__;var n=e.__m||(e.__m=[0,0]);t.__="P"+n[0]+"-"+n[1]++}return t.__}function xa(){for(var t;t=sa.shift();){var e=t.__H;if(t.__P&&e)try{e.__h.some(yi),e.__h.some(va),e.__h=[]}catch(n){e.__h=[],ce.__e(n,t.__v)}}}ce.__b=function(t){re=null,la&&la(t)},ce.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),fa&&fa(t,e)},ce.__r=function(t){ca&&ca(t),Rt=0;var e=(re=t.__c).__H;e&&(vi===re?(e.__h=[],re.__h=[],e.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(e.__h.length&&xa(),Rt=0)),vi=re},ce.diffed=function(t){ua&&ua(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(sa.push(e)!==1&&aa===ce.requestAnimationFrame||((aa=ce.requestAnimationFrame)||Vc)(xa)),e.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),vi=re=null},ce.__c=function(t,e){e.some(function(n){try{n.__h.some(yi),n.__h=n.__h.filter(function(r){return!r.__||va(r)})}catch(r){e.some(function(i){i.__h&&(i.__h=[])}),e=[],ce.__e(r,n.__v)}}),da&&da(t,e)},ce.unmount=function(t){ha&&ha(t);var e,n=t.__c;n&&n.__H&&(n.__H.__.some(function(r){try{yi(r)}catch(i){e=i}}),n.__H=void 0,e&&ce.__e(e,n.__v))};var ba=typeof requestAnimationFrame=="function";function Vc(t){var e,n=function(){clearTimeout(r),ba&&cancelAnimationFrame(e),setTimeout(t)},r=setTimeout(n,35);ba&&(e=requestAnimationFrame(n))}function yi(t){var e=re,n=t.__c;typeof n=="function"&&(t.__c=void 0,n()),re=e}function va(t){var e=re;t.__c=t.__(),re=e}function wi(t,e){return!t||t.length!==e.length||e.some(function(n,r){return n!==t[r]})}function ya(t,e){return typeof e=="function"?e(t):e}function wa(t,e){for(var n in e)t[n]=e[n];return t}function ki(t,e){for(var n in t)if(n!=="__source"&&!(n in e))return!0;for(var r in e)if(r!=="__source"&&t[r]!==e[r])return!0;return!1}function ka(t,e){var n=e(),r=O({t:{__:n,u:e}}),i=r[0].t,o=r[1];return sn(function(){i.__=n,i.u=e,_i(i)&&o({t:i})},[t,n,e]),M(function(){return _i(i)&&o({t:i}),t(function(){_i(i)&&o({t:i})})},[t]),n}function _i(t){try{return!((e=t.__)===(n=t.u())&&(e!==0||1/e==1/n)||e!=e&&n!=n)}catch{return!0}var e,n}function _a(t){t()}function ja(t){return t}function Sa(){return[!1,_a]}var Ta=sn;function ji(t,e){this.props=t,this.context=e}function Hc(t,e){function n(i){var o=this.props.ref;return o!=i.ref&&o&&(typeof o=="function"?o(null):o.current=null),e?!e(this.props,i)||o!=i.ref:ki(this.props,i)}function r(i){return this.shouldComponentUpdate=n,Ge(t,i)}return r.displayName="Memo("+(t.displayName||t.name)+")",r.__f=r.prototype.isReactComponent=!0,r.type=t,r}(ji.prototype=new et).isPureReactComponent=!0,ji.prototype.shouldComponentUpdate=function(t,e){return ki(this.props,t)||ki(this.state,e)};var Ca=L.__b;L.__b=function(t){t.type&&t.type.__f&&t.ref&&(t.props.ref=t.ref,t.ref=null),Ca&&Ca(t)};var Wc=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function Qc(t){function e(n){var r=wa({},n);return delete r.ref,t(r,n.ref||null)}return e.$$typeof=Wc,e.render=t,e.prototype.isReactComponent=e.__f=!0,e.displayName="ForwardRef("+(t.displayName||t.name)+")",e}var Aa=function(t,e){return t==null?null:st(st(t).map(e))},Gc={map:Aa,forEach:Aa,count:function(t){return t?st(t).length:0},only:function(t){var e=st(t);if(e.length!==1)throw"Children.only";return e[0]},toArray:st},Kc=L.__e;L.__e=function(t,e,n,r){if(t.then){for(var i,o=e;o=o.__;)if((i=o.__c)&&i.__c)return e.__e==null&&(e.__e=n.__e,e.__k=n.__k),i.__c(t,e)}Kc(t,e,n,r)};var Ra=L.unmount;function Ea(t,e,n){return t&&(t.__c&&t.__c.__H&&(t.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),t.__c.__H=null),(t=wa({},t)).__c!=null&&(t.__c.__P===n&&(t.__c.__P=e),t.__c.__e=!0,t.__c=null),t.__k=t.__k&&t.__k.map(function(r){return Ea(r,e,n)})),t}function Ia(t,e,n){return t&&n&&(t.__v=null,t.__k=t.__k&&t.__k.map(function(r){return Ia(r,e,n)}),t.__c&&t.__c.__P===e&&(t.__e&&n.appendChild(t.__e),t.__c.__e=!0,t.__c.__P=n)),t}function vr(){this.__u=0,this.o=null,this.__b=null}function Pa(t){var e=t.__&&t.__.__c;return e&&e.__a&&e.__a(t)}function Yc(t){var e,n,r,i=null;function o(a){if(e||(e=t()).then(function(l){l&&(i=l.default||l),r=!0},function(l){n=l,r=!0}),n)throw n;if(!r)throw e;return i?Ge(i,a):null}return o.displayName="Lazy",o.__f=!0,o}function Ln(){this.i=null,this.l=null}L.unmount=function(t){var e=t.__c;e&&(e.__z=!0),e&&e.__R&&e.__R(),e&&32&t.__u&&(t.type=null),Ra&&Ra(t)},(vr.prototype=new et).__c=function(t,e){var n=e.__c,r=this;r.o==null&&(r.o=[]),r.o.push(n);var i=Pa(r.__v),o=!1,a=function(){o||r.__z||(o=!0,n.__R=null,i?i(c):c())};n.__R=a;var l=n.__P;n.__P=null;var c=function(){if(!--r.__u){if(r.state.__a){var u=r.state.__a;r.__v.__k[0]=Ia(u,u.__c.__P,u.__c.__O)}var d;for(r.setState({__a:r.__b=null});d=r.o.pop();)d.__P=l,d.forceUpdate()}};r.__u++||32&e.__u||r.setState({__a:r.__b=r.__v.__k[0]}),t.then(a,a)},vr.prototype.componentWillUnmount=function(){this.o=[]},vr.prototype.render=function(t,e){var n=this.__v;if(!n.__m){for(var r=n;r.__;)r=r.__;r=r.__m||(r.__m=[0,0]),n.__m=[r[1]++,0]}if(this.__b){if(n.__k){var i=document.createElement("div"),o=n.__k[0].__c;n.__k[0]=Ea(this.__b,i,o.__O=o.__P)}this.__b=null}var a=e.__a&&Ge(ee,null,t.fallback);return a&&(a.__u&=-33),[Ge(ee,null,e.__a?null:t.children),a]};var Ma=function(t,e,n){if(++n[1]===n[0]&&t.l.delete(e),t.props.revealOrder&&(t.props.revealOrder[0]!=="t"||!t.l.size))for(n=t.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;t.i=n=n[2]}};function Jc(t){return this.getChildContext=function(){return t.context},t.children}function Xc(t){var e=this,n=t.v;if(e.componentWillUnmount=function(){Ut(null,e.h),e.h=null,e.v=null},e.v&&e.v!==n&&e.componentWillUnmount(),!e.h){for(var r=e.__v;r!==null&&!r.__m&&r.__!==null;)r=r.__;e.v=n,e.h={nodeType:1,parentNode:n,childNodes:[],__k:{__m:r.__m},contains:function(){return!0},namespaceURI:n.namespaceURI,insertBefore:function(i,o){this.childNodes.push(i),e.v.insertBefore(i,o)},removeChild:function(i){this.childNodes.splice(this.childNodes.indexOf(i)>>>1,1),e.v.removeChild(i)}}}Ut(Ge(Jc,{context:e.context},t.__v),e.h)}function Zc(t,e){var n=Ge(Xc,{__v:t,v:e});return n.containerInfo=e,n}(Ln.prototype=new et).__a=function(t){var e=this,n=Pa(e.__v),r=e.l.get(t);return r[0]++,function(i){var o=function(){e.props.revealOrder?(r.push(i),Ma(e,t,r)):i()};n?n(o):o()}},Ln.prototype.render=function(t){this.i=null,this.l=new Map;var e=st(t.children);t.revealOrder&&t.revealOrder[0]==="b"&&e.reverse();for(var n=e.length;n--;)this.l.set(e[n],this.i=[1,0,this.i]);return t.children},Ln.prototype.componentDidUpdate=Ln.prototype.componentDidMount=function(){var t=this;this.l.forEach(function(e,n){Ma(t,n,e)})};var Na=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,eu=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,tu=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,nu=/[A-Z0-9]/g,ru=typeof document<"u",iu=function(t){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(t)};function ou(t,e,n){return e.__k==null&&(e.textContent=""),Ut(t,e),typeof n=="function"&&n(),t?t.__c:null}function au(t,e,n){return oa(t,e),typeof n=="function"&&n(),t?t.__c:null}et.prototype.isReactComponent=!0,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(t){Object.defineProperty(et.prototype,t,{configurable:!0,get:function(){return this["UNSAFE_"+t]},set:function(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})});var La=L.event;L.event=function(t){return La&&(t=La(t)),t.persist=function(){},t.isPropagationStopped=function(){return this.cancelBubble},t.isDefaultPrevented=function(){return this.defaultPrevented},t.nativeEvent=t};var Si,su={configurable:!0,get:function(){return this.class}},Oa=L.vnode;L.vnode=function(t){typeof t.type=="string"&&(function(e){var n=e.props,r=e.type,i={},o=r.indexOf("-")==-1;for(var a in n){var l=n[a];if(!(a==="value"&&"defaultValue"in n&&l==null||ru&&a==="children"&&r==="noscript"||a==="class"||a==="className")){var c=a.toLowerCase();a==="defaultValue"&&"value"in n&&n.value==null?a="value":a==="download"&&l===!0?l="":c==="translate"&&l==="no"?l=!1:c[0]==="o"&&c[1]==="n"?c==="ondoubleclick"?a="ondblclick":c!=="onchange"||r!=="input"&&r!=="textarea"||iu(n.type)?c==="onfocus"?a="onfocusin":c==="onblur"?a="onfocusout":tu.test(a)&&(a=c):c=a="oninput":o&&eu.test(a)?a=a.replace(nu,"-$&").toLowerCase():l===null&&(l=void 0),c==="oninput"&&i[a=c]&&(a="oninputCapture"),i[a]=l}}r=="select"&&(i.multiple&&Array.isArray(i.value)&&(i.value=st(n.children).forEach(function(u){u.props.selected=i.value.indexOf(u.props.value)!=-1})),i.defaultValue!=null&&(i.value=st(n.children).forEach(function(u){u.props.selected=i.multiple?i.defaultValue.indexOf(u.props.value)!=-1:i.defaultValue==u.props.value}))),n.class&&!n.className?(i.class=n.class,Object.defineProperty(i,"className",su)):n.className&&(i.class=i.className=n.className),e.props=i})(t),t.$$typeof=Na,Oa&&Oa(t)};var $a=L.__r;L.__r=function(t){$a&&$a(t),Si=t.__c};var Da=L.diffed;L.diffed=function(t){Da&&Da(t);var e=t.props,n=t.__e;n!=null&&t.type==="textarea"&&"value"in e&&e.value!==n.value&&(n.value=e.value==null?"":e.value),Si=null};var lu={ReactCurrentDispatcher:{current:{readContext:function(t){return Si.__n[t.__c].props.value},useCallback:Z,useContext:Nn,useDebugValue:ma,useDeferredValue:ja,useEffect:M,useId:ga,useImperativeHandle:pa,useInsertionEffect:Ta,useLayoutEffect:sn,useMemo:we,useReducer:Be,useRef:ie,useState:O,useSyncExternalStore:ka,useTransition:Sa}}};function cu(t){return Ge.bind(null,t)}function yr(t){return!!t&&t.$$typeof===Na}function uu(t){return yr(t)&&t.type===ee}function du(t){return!!t&&typeof t.displayName=="string"&&t.displayName.indexOf("Memo(")==0}function hu(t){return yr(t)?Fc.apply(null,arguments):t}function fu(t){return!!t.__k&&(Ut(null,t),!0)}function pu(t){return t&&(t.base||t.nodeType===1&&t)||null}for(var mu=function(t,e){return t(e)},gu=function(t,e){var n=L.debounceRendering;L.debounceRendering=function(i){return i()};var r=t(e);return L.debounceRendering=n,r},xu=yr,Ti={useState:O,useId:ga,useReducer:Be,useEffect:M,useLayoutEffect:sn,useInsertionEffect:Ta,useTransition:Sa,useDeferredValue:ja,useSyncExternalStore:ka,startTransition:_a,useRef:ie,useImperativeHandle:pa,useMemo:we,useCallback:Z,useContext:Nn,useDebugValue:ma,version:"18.3.1",Children:Gc,render:ou,hydrate:au,unmountComponentAtNode:fu,createPortal:Zc,createElement:Ge,createContext:Uc,createFactory:cu,cloneElement:hu,createRef:Lc,Fragment:ee,isValidElement:yr,isElement:xu,isFragment:uu,isMemo:du,findDOMNode:pu,Component:et,PureComponent:ji,memo:Hc,forwardRef:Qc,flushSync:gu,unstable_batchedUpdates:mu,StrictMode:ee,Suspense:vr,SuspenseList:Ln,lazy:Yc,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:lu},lt=[],Ke=[],bu=Uint8Array,Ci="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ln=0,vu=Ci.length;ln<vu;++ln)lt[ln]=Ci[ln],Ke[Ci.charCodeAt(ln)]=ln;Ke[45]=62,Ke[95]=63;function yu(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");n===-1&&(n=e);var r=n===e?0:4-n%4;return[n,r]}function wu(t,e,n){return(e+n)*3/4-n}function On(t){var e,n=yu(t),r=n[0],i=n[1],o=new bu(wu(t,r,i)),a=0,l=i>0?r-4:r,c;for(c=0;c<l;c+=4)e=Ke[t.charCodeAt(c)]<<18|Ke[t.charCodeAt(c+1)]<<12|Ke[t.charCodeAt(c+2)]<<6|Ke[t.charCodeAt(c+3)],o[a++]=e>>16&255,o[a++]=e>>8&255,o[a++]=e&255;return i===2&&(e=Ke[t.charCodeAt(c)]<<2|Ke[t.charCodeAt(c+1)]>>4,o[a++]=e&255),i===1&&(e=Ke[t.charCodeAt(c)]<<10|Ke[t.charCodeAt(c+1)]<<4|Ke[t.charCodeAt(c+2)]>>2,o[a++]=e>>8&255,o[a++]=e&255),o}function ku(t){return lt[t>>18&63]+lt[t>>12&63]+lt[t>>6&63]+lt[t&63]}function _u(t,e,n){for(var r,i=[],o=e;o<n;o+=3)r=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(t[o+2]&255),i.push(ku(r));return i.join("")}function $n(t){for(var e,n=t.length,r=n%3,i=[],o=16383,a=0,l=n-r;a<l;a+=o)i.push(_u(t,a,a+o>l?l:a+o));return r===1?(e=t[n-1],i.push(lt[e>>2]+lt[e<<4&63]+"==")):r===2&&(e=(t[n-2]<<8)+t[n-1],i.push(lt[e>>10]+lt[e>>4&63]+lt[e<<2&63]+"=")),i.join("")}function vt(t){if(t===void 0)return{};if(!qa(t))throw new Error(`The arguments to a Convex function must be an object. Received: ${t}`);return t}function ju(t){if(typeof t>"u")throw new Error("Client created with undefined deployment address. If you used an environment variable, check that it's set.");if(typeof t!="string")throw new Error(`Invalid deployment address: found ${t}".`);if(!(t.startsWith("http:")||t.startsWith("https:")))throw new Error(`Invalid deployment address: Must start with "https://" or "http://". Found "${t}".`);try{new URL(t)}catch{throw new Error(`Invalid deployment address: "${t}" is not a valid URL. If you believe this URL is correct, use the \`skipConvexDeploymentUrlCheck\` option to bypass this.`)}if(t.endsWith(".convex.site"))throw new Error(`Invalid deployment address: "${t}" ends with .convex.site, which is used for HTTP Actions. Convex deployment URLs typically end with .convex.cloud? If you believe this URL is correct, use the \`skipConvexDeploymentUrlCheck\` option to bypass this.`)}function qa(t){const e=typeof t=="object",n=Object.getPrototypeOf(t),r=n===null||n===Object.prototype||n?.constructor?.name==="Object";return e&&r}const za=!0,cn=BigInt("-9223372036854775808"),Ai=BigInt("9223372036854775807"),Ri=BigInt("0"),Su=BigInt("8"),Tu=BigInt("256"),Ei="This commit timestamp is unresolved: its value is assigned when the mutation commits. Read the document after the mutation completes to get its value.";class Fa{[Symbol.toPrimitive](e){if(e==="string")return this.toString();throw new Error(Ei)}valueOf(){throw new Error(Ei)}toJSON(){throw new Error(Ei)}toString(){return"[unresolved commit timestamp]"}}const Cu=new Fa;function Ua(t){return Number.isNaN(t)||!Number.isFinite(t)||Object.is(t,-0)}function Au(t){t<Ri&&(t-=cn+cn);let e=t.toString(16);e.length%2===1&&(e="0"+e);const n=new Uint8Array(new ArrayBuffer(8));let r=0;for(const i of e.match(/.{2}/g).reverse())n.set([parseInt(i,16)],r++),t>>=Su;return $n(n)}function Ru(t){const e=On(t);if(e.byteLength!==8)throw new Error(`Received ${e.byteLength} bytes, expected 8 for $integer`);let n=Ri,r=Ri;for(const i of e)n+=BigInt(i)*Tu**r,r++;return n>Ai&&(n+=cn+cn),n}function Eu(t){if(t<cn||Ai<t)throw new Error(`BigInt ${t} does not fit into a 64-bit signed integer.`);const e=new ArrayBuffer(8);return new DataView(e).setBigInt64(0,t,!0),$n(new Uint8Array(e))}function Iu(t){const e=On(t);if(e.byteLength!==8)throw new Error(`Received ${e.byteLength} bytes, expected 8 for $integer`);return new DataView(e.buffer).getBigInt64(0,!0)}const Pu=DataView.prototype.setBigInt64?Eu:Au,Mu=DataView.prototype.getBigInt64?Iu:Ru,Ba=1024;function Va(t){if(t.length>Ba)throw new Error(`Field name ${t} exceeds maximum field name length ${Ba}.`);if(t.startsWith("$"))throw new Error(`Field name ${t} starts with a '$', which is reserved.`);for(let e=0;e<t.length;e+=1){const n=t.charCodeAt(e);if(n<32||n>=127)throw new Error(`Field name ${t} has invalid character '${t[e]}': Field names can only contain non-control ASCII characters`)}}function un(t){if(t===null||typeof t=="boolean"||typeof t=="number"||typeof t=="string")return t;if(Array.isArray(t))return t.map(r=>un(r));if(typeof t!="object")throw new Error(`Unexpected type of ${t}`);const e=Object.entries(t);if(e.length===1){const r=e[0][0];if(r==="$bytes"){if(typeof t.$bytes!="string")throw new Error(`Malformed $bytes field on ${t}`);return On(t.$bytes).buffer}if(r==="$integer"){if(typeof t.$integer!="string")throw new Error(`Malformed $integer field on ${t}`);return Mu(t.$integer)}if(r==="$float"){if(typeof t.$float!="string")throw new Error(`Malformed $float field on ${t}`);const i=On(t.$float);if(i.byteLength!==8)throw new Error(`Received ${i.byteLength} bytes, expected 8 for $float`);const a=new DataView(i.buffer).getFloat64(0,za);if(!Ua(a))throw new Error(`Float ${a} should be encoded as a number`);return a}if(r==="$commitTs"){if(t.$commitTs!==null)throw new Error(`Malformed $commitTs field on ${t}`);return Cu}if(r==="$set")throw new Error("Received a Set which is no longer supported as a Convex type.");if(r==="$map")throw new Error("Received a Map which is no longer supported as a Convex type.")}const n={};for(const[r,i]of Object.entries(t))Va(r),n[r]=un(i);return n}const Ha=16384;function Dn(t){const e=JSON.stringify(t,(n,r)=>r===void 0?"undefined":typeof r=="bigint"?`${r.toString()}n`:r);if(e.length>Ha){const n="[...truncated]";let r=Ha-n.length;const i=e.codePointAt(r-1);return i!==void 0&&i>65535&&(r-=1),e.substring(0,r)+n}return e}function Ii(t,e,n,r){if(t===void 0){const a=n&&` (present at path ${n} in original object ${Dn(e)})`;throw new Error(`undefined is not a valid Convex value${a}. To learn about Convex's supported types, see https://docs.convex.dev/using/types.`)}if(t===null)return t;if(typeof t=="bigint"){if(t<cn||Ai<t)throw new Error(`BigInt ${t} does not fit into a 64-bit signed integer.`);return{$integer:Pu(t)}}if(typeof t=="number")if(Ua(t)){const a=new ArrayBuffer(8);return new DataView(a).setFloat64(0,t,za),{$float:$n(new Uint8Array(a))}}else return t;if(typeof t=="boolean"||typeof t=="string")return t;if(t instanceof ArrayBuffer)return{$bytes:$n(new Uint8Array(t))};if(t instanceof Fa)return{$commitTs:null};if(Array.isArray(t))return t.map((a,l)=>Ii(a,e,n+`[${l}]`));if(t instanceof Set)throw new Error(Pi(n,"Set",[...t],e));if(t instanceof Map)throw new Error(Pi(n,"Map",[...t],e));if(!qa(t)){const a=t?.constructor?.name,l=a?`${a} `:"";throw new Error(Pi(n,l,t,e))}const i={},o=Object.entries(t);o.sort(([a,l],[c,u])=>a===c?0:a<c?-1:1);for(const[a,l]of o)l!==void 0&&(Va(a),i[a]=Ii(l,e,n+`.${a}`));return i}function Pi(t,e,n,r){return t?`${e}${Dn(n)} is not a supported Convex type (present at path ${t} in original object ${Dn(r)}). To learn about Convex's supported types, see https://docs.convex.dev/using/types.`:`${e}${Dn(n)} is not a supported Convex type.`}function ct(t){return Ii(t,t,"")}var Nu=Object.defineProperty,Lu=(t,e,n)=>e in t?Nu(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Mi=(t,e,n)=>Lu(t,typeof e!="symbol"?e+"":e,n),Wa,Qa;const Ou=Symbol.for("ConvexError");class wr extends(Qa=Error,Wa=Ou,Qa){constructor(e){super(typeof e=="string"?e:Dn(e)),Mi(this,"name","ConvexError"),Mi(this,"data"),Mi(this,Wa,!0),this.data=e}}const Ga=()=>Array.from({length:4},()=>0);Ga(),Ga();const Ka="1.46.0";var $u=Object.defineProperty,Du=(t,e,n)=>e in t?$u(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Ya=(t,e,n)=>Du(t,typeof e!="symbol"?e+"":e,n);const qu="color:rgb(0, 145, 255)";function Ja(t){switch(t){case"query":return"Q";case"mutation":return"M";case"action":return"A";case"any":return"?"}}class Xa{constructor(e){Ya(this,"_onLogLineFuncs"),Ya(this,"_verbose"),this._onLogLineFuncs={},this._verbose=e.verbose}addLogLineListener(e){let n=Math.random().toString(36).substring(2,15);for(let r=0;r<10&&this._onLogLineFuncs[n]!==void 0;r++)n=Math.random().toString(36).substring(2,15);return this._onLogLineFuncs[n]=e,()=>{delete this._onLogLineFuncs[n]}}logVerbose(...e){if(this._verbose)for(const n of Object.values(this._onLogLineFuncs))n("debug",`${new Date().toISOString()}`,...e)}log(...e){for(const n of Object.values(this._onLogLineFuncs))n("info",...e)}warn(...e){for(const n of Object.values(this._onLogLineFuncs))n("warn",...e)}error(...e){for(const n of Object.values(this._onLogLineFuncs))n("error",...e)}}function Za(t){const e=new Xa(t);return e.addLogLineListener((n,...r)=>{switch(n){case"debug":console.debug(...r);break;case"info":console.log(...r);break;case"warn":console.warn(...r);break;case"error":console.error(...r);break;default:console.log(...r)}}),e}function es(t){return new Xa(t)}function kr(t,e,n,r,i){const o=Ja(n);if(typeof i=="object"&&(i=`ConvexError ${JSON.stringify(i.errorData,null,2)}`),e==="info"){const a=i.match(/^\[.*?\] /);if(a===null){t.error(`[CONVEX ${o}(${r})] Could not parse console.log`);return}const l=i.slice(1,a[0].length-2),c=i.slice(a[0].length);t.log(`%c[CONVEX ${o}(${r})] [${l}]`,qu,c)}else t.error(`[CONVEX ${o}(${r})] ${i}`)}function zu(t,e){const n=`[CONVEX FATAL ERROR] ${e}`;return t.error(n),new Error(n)}function dn(t,e,n){return`[CONVEX ${Ja(t)}(${e})] ${n.errorMessage}
2
- Called by client`}function Ni(t,e){return e.data=t.errorData,e}function Bt(t){const e=t.split(":");let n,r;return e.length===1?(n=e[0],r="default"):(n=e.slice(0,e.length-1).join(":"),r=e[e.length-1]),n.endsWith(".js")&&(n=n.slice(0,-3)),`${n}:${r}`}function Vt(t,e){return JSON.stringify({udfPath:Bt(t),args:ct(e)})}function ts(t,e,n){const{initialNumItems:r,id:i}=n;return JSON.stringify({type:"paginated",udfPath:Bt(t),args:ct(e),options:ct({initialNumItems:r,id:i})})}var Fu=Object.defineProperty,Uu=(t,e,n)=>e in t?Fu(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ut=(t,e,n)=>Uu(t,typeof e!="symbol"?e+"":e,n);class Bu{constructor(){ut(this,"nextQueryId"),ut(this,"querySetVersion"),ut(this,"querySet"),ut(this,"queryIdToToken"),ut(this,"identityVersion"),ut(this,"auth"),ut(this,"outstandingQueriesOlderThanRestart"),ut(this,"outstandingAuthOlderThanRestart"),ut(this,"paused"),ut(this,"pendingQuerySetModifications"),this.nextQueryId=0,this.querySetVersion=0,this.identityVersion=0,this.querySet=new Map,this.queryIdToToken=new Map,this.outstandingQueriesOlderThanRestart=new Set,this.outstandingAuthOlderThanRestart=!1,this.paused=!1,this.pendingQuerySetModifications=new Map}hasSyncedPastLastReconnect(){return this.outstandingQueriesOlderThanRestart.size===0&&!this.outstandingAuthOlderThanRestart}markAuthCompletion(){this.outstandingAuthOlderThanRestart=!1}subscribe(e,n,r,i){const o=Bt(e),a=Vt(o,n),l=this.querySet.get(a);if(l!==void 0)return l.numSubscribers+=1,{queryToken:a,modification:null,unsubscribe:()=>this.removeSubscriber(a)};{const c=this.nextQueryId++,u={id:c,canonicalizedUdfPath:o,args:n,numSubscribers:1,journal:r,componentPath:i};this.querySet.set(a,u),this.queryIdToToken.set(c,a);const d=this.querySetVersion,m=this.querySetVersion+1,h={type:"Add",queryId:c,udfPath:o,args:[ct(n)],journal:r,componentPath:i};return this.paused?this.pendingQuerySetModifications.set(c,h):this.querySetVersion=m,{queryToken:a,modification:{type:"ModifyQuerySet",baseVersion:d,newVersion:m,modifications:[h]},unsubscribe:()=>this.removeSubscriber(a)}}}transition(e){for(const n of e.modifications)switch(n.type){case"QueryUpdated":case"QueryFailed":{this.outstandingQueriesOlderThanRestart.delete(n.queryId);const r=n.journal;if(r!==void 0){const i=this.queryIdToToken.get(n.queryId);i!==void 0&&(this.querySet.get(i).journal=r)}break}case"QueryRemoved":{this.outstandingQueriesOlderThanRestart.delete(n.queryId);break}default:throw new Error(`Invalid modification ${n.type}`)}}queryId(e,n){const r=Bt(e),i=Vt(r,n),o=this.querySet.get(i);return o!==void 0?o.id:null}isCurrentOrNewerAuthVersion(e){return e>=this.identityVersion}getAuth(){return this.auth}setAuth(e){this.auth={tokenType:"User",value:e};const n=this.identityVersion;return this.paused||(this.identityVersion=n+1),{type:"Authenticate",baseVersion:n,...this.auth}}setAdminAuth(e,n){const r={tokenType:"Admin",value:e,impersonating:n};this.auth=r;const i=this.identityVersion;return this.paused||(this.identityVersion=i+1),{type:"Authenticate",baseVersion:i,...r}}clearAuth(){this.auth=void 0,this.markAuthCompletion();const e=this.identityVersion;return this.paused||(this.identityVersion=e+1),{type:"Authenticate",tokenType:"None",baseVersion:e}}hasAuth(){return!!this.auth}isNewAuth(e){return this.auth?.value!==e}queryPath(e){const n=this.queryIdToToken.get(e);return n?this.querySet.get(n).canonicalizedUdfPath:null}queryArgs(e){const n=this.queryIdToToken.get(e);return n?this.querySet.get(n).args:null}queryToken(e){return this.queryIdToToken.get(e)??null}queryJournal(e){return this.querySet.get(e)?.journal}restart(){this.unpause(),this.outstandingQueriesOlderThanRestart.clear();const e=[];for(const i of this.querySet.values()){const o={type:"Add",queryId:i.id,udfPath:i.canonicalizedUdfPath,args:[ct(i.args)],journal:i.journal,componentPath:i.componentPath};e.push(o),this.outstandingQueriesOlderThanRestart.add(i.id)}this.querySetVersion=1;const n={type:"ModifyQuerySet",baseVersion:0,newVersion:1,modifications:e};if(!this.auth)return this.identityVersion=0,[n,void 0];this.outstandingAuthOlderThanRestart=!0;const r={type:"Authenticate",baseVersion:0,...this.auth};return this.identityVersion=1,[n,r]}pause(){this.paused=!0}resume(){const e=this.pendingQuerySetModifications.size>0?{type:"ModifyQuerySet",baseVersion:this.querySetVersion,newVersion:++this.querySetVersion,modifications:Array.from(this.pendingQuerySetModifications.values())}:void 0,n=this.auth!==void 0?{type:"Authenticate",baseVersion:this.identityVersion++,...this.auth}:void 0;return this.unpause(),[e,n]}unpause(){this.paused=!1,this.pendingQuerySetModifications.clear()}removeSubscriber(e){const n=this.querySet.get(e);if(n.numSubscribers>1)return n.numSubscribers-=1,null;{this.querySet.delete(e),this.queryIdToToken.delete(n.id),this.outstandingQueriesOlderThanRestart.delete(n.id);const r=this.querySetVersion,i=this.querySetVersion+1,o={type:"Remove",queryId:n.id};return this.paused?this.pendingQuerySetModifications.has(n.id)?this.pendingQuerySetModifications.delete(n.id):this.pendingQuerySetModifications.set(n.id,o):this.querySetVersion=i,{type:"ModifyQuerySet",baseVersion:r,newVersion:i,modifications:[o]}}}}var Vu=Object.defineProperty,Hu=(t,e,n)=>e in t?Vu(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,_r=(t,e,n)=>Hu(t,typeof e!="symbol"?e+"":e,n);class Wu{constructor(e,n){this.logger=e,this.markConnectionStateDirty=n,_r(this,"inflightRequests"),_r(this,"requestsOlderThanRestart"),_r(this,"inflightMutationsCount",0),_r(this,"inflightActionsCount",0),this.inflightRequests=new Map,this.requestsOlderThanRestart=new Set}request(e,n){const r=new Promise(i=>{const o=n?"Requested":"NotSent";this.inflightRequests.set(e.requestId,{message:e,status:{status:o,requestedAt:new Date,onResult:i}}),e.type==="Mutation"?this.inflightMutationsCount++:e.type==="Action"&&this.inflightActionsCount++});return this.markConnectionStateDirty(),r}onResponse(e){const n=this.inflightRequests.get(e.requestId);if(n===void 0||n.status.status==="Completed")return null;const r=n.message.type==="Mutation"?"mutation":"action",i=n.message.udfPath;for(const c of e.logLines)kr(this.logger,"info",r,i,c);const o=n.status;let a,l;if(e.success)a={success:!0,logLines:e.logLines,value:un(e.result)},l=()=>o.onResult(a);else{const c=e.result,{errorData:u}=e;kr(this.logger,"error",r,i,c),a={success:!1,errorMessage:c,errorData:u!==void 0?un(u):void 0,logLines:e.logLines},l=()=>o.onResult(a)}return e.type==="ActionResponse"||!e.success?(l(),this.inflightRequests.delete(e.requestId),this.requestsOlderThanRestart.delete(e.requestId),n.message.type==="Action"?this.inflightActionsCount--:n.message.type==="Mutation"&&this.inflightMutationsCount--,this.markConnectionStateDirty(),{requestId:e.requestId,result:a}):(n.status={status:"Completed",result:a,ts:e.ts,onResolve:l},null)}removeCompleted(e){const n=new Map;for(const[r,i]of this.inflightRequests.entries()){const o=i.status;o.status==="Completed"&&o.ts.lessThanOrEqual(e)&&(o.onResolve(),n.set(r,o.result),i.message.type==="Mutation"?this.inflightMutationsCount--:i.message.type==="Action"&&this.inflightActionsCount--,this.inflightRequests.delete(r),this.requestsOlderThanRestart.delete(r))}return n.size>0&&this.markConnectionStateDirty(),n}restart(){this.requestsOlderThanRestart=new Set(this.inflightRequests.keys());const e=[];for(const[n,r]of this.inflightRequests){if(r.status.status==="NotSent"){r.status.status="Requested",e.push(r.message);continue}if(r.message.type==="Mutation")e.push(r.message);else if(r.message.type==="Action"){if(this.inflightRequests.delete(n),this.requestsOlderThanRestart.delete(n),this.inflightActionsCount--,r.status.status==="Completed")throw new Error("Action should never be in 'Completed' state");r.status.onResult({success:!1,errorMessage:"Connection lost while action was in flight",logLines:[]})}}return this.markConnectionStateDirty(),e}resume(){const e=[];for(const[,n]of this.inflightRequests)if(n.status.status==="NotSent"){n.status.status="Requested",e.push(n.message);continue}return e}hasIncompleteRequests(){for(const e of this.inflightRequests.values())if(e.status.status==="Requested")return!0;return!1}hasInflightRequests(){return this.inflightRequests.size>0}hasSyncedPastLastReconnect(){return this.requestsOlderThanRestart.size===0}timeOfOldestInflightRequest(){if(this.inflightRequests.size===0)return null;let e=Date.now();for(const n of this.inflightRequests.values())n.status.status!=="Completed"&&n.status.requestedAt.getTime()<e&&(e=n.status.requestedAt.getTime());return new Date(e)}inflightMutations(){return this.inflightMutationsCount}inflightActions(){return this.inflightActionsCount}}const qn=Symbol.for("functionName"),Qu=Symbol.for("toReferencePath");function Gu(t){return t[Qu]??null}function Ku(t){return t.startsWith("function://")}function Yu(t){let e;if(typeof t=="string")Ku(t)?e={functionHandle:t}:e={name:t};else if(t[qn])e={name:t[qn]};else{const n=Gu(t);if(!n)throw new Error(`${t} is not a functionReference`);e={reference:n}}return e}function Ne(t){const e=Yu(t);if(e.name===void 0)throw e.functionHandle!==void 0?new Error(`Expected function reference like "api.file.func" or "internal.file.func", but received function handle ${e.functionHandle}`):e.reference!==void 0?new Error(`Expected function reference in the current component like "api.file.func" or "internal.file.func", but received reference ${e.reference}`):new Error(`Expected function reference like "api.file.func" or "internal.file.func", but received ${JSON.stringify(e)}`);if(typeof t=="string")return t;const n=t[qn];if(!n)throw new Error(`${t} is not a functionReference`);return n}function Li(t){return{[qn]:t}}function ns(t=[]){const e={get(n,r){if(typeof r=="string"){const i=[...t,r];return ns(i)}else if(r===qn){if(t.length<2){const a=["api",...t].join(".");throw new Error(`API path is expected to be of the form \`api.moduleName.functionName\`. Found: \`${a}\``)}const i=t.slice(0,-1).join("/"),o=t[t.length-1];return o==="default"?i:i+":"+o}else return r===Symbol.toStringTag?"FunctionReference":void 0}};return new Proxy({},e)}ns();var Ju=Object.defineProperty,Xu=(t,e,n)=>e in t?Ju(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,jr=(t,e,n)=>Xu(t,typeof e!="symbol"?e+"":e,n);class zn{constructor(e){jr(this,"queryResults"),jr(this,"modifiedQueries"),this.queryResults=e,this.modifiedQueries=[]}getQuery(e,...n){const r=vt(n[0]),i=Ne(e),o=this.queryResults.get(Vt(i,r));if(o!==void 0)return zn.queryValue(o.result)}getAllQueries(e){const n=[],r=Ne(e);for(const i of this.queryResults.values())i.udfPath===Bt(r)&&n.push({args:i.args,value:zn.queryValue(i.result)});return n}setQuery(e,n,r){const i=vt(n),o=Ne(e),a=Vt(o,i);let l;r===void 0?l=void 0:l={success:!0,value:r,logLines:[]};const c={udfPath:o,args:i,result:l};this.queryResults.set(a,c),this.modifiedQueries.push(a)}static queryValue(e){if(e!==void 0)return e.success?e.value:void 0}}class Zu{constructor(){jr(this,"queryResults"),jr(this,"optimisticUpdates"),this.queryResults=new Map,this.optimisticUpdates=[]}ingestQueryResultsFromServer(e,n){this.optimisticUpdates=this.optimisticUpdates.filter(a=>!n.has(a.mutationId));const r=this.queryResults;this.queryResults=new Map(e);const i=new zn(this.queryResults);for(const a of this.optimisticUpdates)a.update(i);const o=[];for(const[a,l]of this.queryResults){const c=r.get(a);(c===void 0||c.result!==l.result)&&o.push(a)}return o}applyOptimisticUpdate(e,n){this.optimisticUpdates.push({update:e,mutationId:n});const r=new zn(this.queryResults);return e(r),r.modifiedQueries}rawQueryResult(e){const n=this.queryResults.get(e);if(n!==void 0)return n.result}queryResult(e){const n=this.queryResults.get(e);if(n===void 0)return;const r=n.result;if(r!==void 0){if(r.success)return r.value;throw r.errorData!==void 0?Ni(r,new wr(dn("query",n.udfPath,r))):new Error(dn("query",n.udfPath,r))}}hasQueryResult(e){return this.queryResults.get(e)!==void 0}queryLogs(e){return this.queryResults.get(e)?.result?.logLines}}var ed=Object.defineProperty,td=(t,e,n)=>e in t?ed(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Oi=(t,e,n)=>td(t,typeof e!="symbol"?e+"":e,n);class qe{constructor(e,n){Oi(this,"low"),Oi(this,"high"),Oi(this,"__isUnsignedLong__"),this.low=e|0,this.high=n|0,this.__isUnsignedLong__=!0}static isLong(e){return(e&&e.__isUnsignedLong__)===!0}static fromBytesLE(e){return new qe(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24)}toBytesLE(){const e=this.high,n=this.low;return[n&255,n>>>8&255,n>>>16&255,n>>>24,e&255,e>>>8&255,e>>>16&255,e>>>24]}static fromNumber(e){return isNaN(e)||e<0?rs:e>=nd?rd:new qe(e%Fn|0,e/Fn|0)}toString(){return(BigInt(this.high)*BigInt(Fn)+BigInt(this.low)).toString()}equals(e){return qe.isLong(e)||(e=qe.fromValue(e)),this.high>>>31===1&&e.high>>>31===1?!1:this.high===e.high&&this.low===e.low}notEquals(e){return!this.equals(e)}comp(e){return qe.isLong(e)||(e=qe.fromValue(e)),this.equals(e)?0:e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1}lessThanOrEqual(e){return this.comp(e)<=0}static fromValue(e){return typeof e=="number"?qe.fromNumber(e):new qe(e.low,e.high)}}const rs=new qe(0,0),is=65536,Fn=is*is,nd=Fn*Fn,rd=new qe(-1,-1);var id=Object.defineProperty,od=(t,e,n)=>e in t?id(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Sr=(t,e,n)=>od(t,typeof e!="symbol"?e+"":e,n);class os{constructor(e,n){Sr(this,"version"),Sr(this,"remoteQuerySet"),Sr(this,"queryPath"),Sr(this,"logger"),this.version={querySet:0,ts:qe.fromNumber(0),identity:0},this.remoteQuerySet=new Map,this.queryPath=e,this.logger=n}transition(e){const n=e.startVersion;if(this.version.querySet!==n.querySet||this.version.ts.notEquals(n.ts)||this.version.identity!==n.identity)throw new Error(`Invalid start version: ${n.ts.toString()}:${n.querySet}:${n.identity}, transitioning from ${this.version.ts.toString()}:${this.version.querySet}:${this.version.identity}`);for(const r of e.modifications)switch(r.type){case"QueryUpdated":{const i=this.queryPath(r.queryId);if(i)for(const a of r.logLines)kr(this.logger,"info","query",i,a);const o=un(r.value??null);this.remoteQuerySet.set(r.queryId,{success:!0,value:o,logLines:r.logLines});break}case"QueryFailed":{const i=this.queryPath(r.queryId);if(i)for(const a of r.logLines)kr(this.logger,"info","query",i,a);const{errorData:o}=r;this.remoteQuerySet.set(r.queryId,{success:!1,errorMessage:r.errorMessage,errorData:o!==void 0?un(o):void 0,logLines:r.logLines});break}case"QueryRemoved":{this.remoteQuerySet.delete(r.queryId);break}default:throw new Error(`Invalid modification ${r.type}`)}this.version=e.endVersion}remoteQueryResults(){return this.remoteQuerySet}timestamp(){return this.version.ts}}function $i(t){const e=On(t);return qe.fromBytesLE(Array.from(e))}function ad(t){const e=new Uint8Array(t.toBytesLE());return $n(e)}function as(t){switch(t.type){case"FatalError":case"AuthError":case"ActionResponse":case"TransitionChunk":case"Ping":return{...t};case"MutationResponse":return t.success?{...t,ts:$i(t.ts)}:{...t};case"Transition":return{...t,startVersion:{...t.startVersion,ts:$i(t.startVersion.ts)},endVersion:{...t.endVersion,ts:$i(t.endVersion.ts)}}}}function sd(t){switch(t.type){case"Authenticate":case"ModifyQuerySet":case"Mutation":case"Action":case"Event":return{...t};case"Connect":return t.maxObservedTimestamp!==void 0?{...t,maxObservedTimestamp:ad(t.maxObservedTimestamp)}:{...t,maxObservedTimestamp:void 0}}}var ld=Object.defineProperty,cd=(t,e,n)=>e in t?ld(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,xe=(t,e,n)=>cd(t,typeof e!="symbol"?e+"":e,n);const ud=1e3,dd=1001,hd=1005,fd=4040;let Tr;function hn(){return Tr===void 0&&(Tr=Date.now()),typeof performance>"u"||!performance.now?Date.now():Math.round(Tr+performance.now())}function ss(){return`t=${Math.round((hn()-Tr)/100)/10}s`}const ls={InternalServerError:{timeout:1e3},SubscriptionsWorkerFullError:{timeout:3e3},TooManyConcurrentRequests:{timeout:3e3},CommitterFullError:{timeout:3e3},AwsTooManyRequestsException:{timeout:3e3},ExecuteFullError:{timeout:3e3},SystemTimeoutError:{timeout:3e3},ExpiredInQueue:{timeout:3e3},VectorIndexesUnavailable:{timeout:1e3},SearchIndexesUnavailable:{timeout:1e3},TableSummariesUnavailable:{timeout:1e3},VectorIndexTooLarge:{timeout:3e3},SearchIndexTooLarge:{timeout:3e3},TooManyWritesInTimePeriod:{timeout:3e3}};function pd(t){if(t===void 0)return"Unknown";for(const e of Object.keys(ls))if(t.startsWith(e))return e;return"Unknown"}class md{constructor(e,n,r,i,o,a){this.markConnectionStateDirty=o,this.debug=a,xe(this,"socket"),xe(this,"connectionCount"),xe(this,"_hasEverConnected",!1),xe(this,"lastCloseReason"),xe(this,"transitionChunkBuffer",null),xe(this,"defaultInitialBackoff"),xe(this,"maxBackoff"),xe(this,"retries"),xe(this,"serverInactivityThreshold"),xe(this,"reconnectDueToServerInactivityTimeout"),xe(this,"scheduledReconnect",null),xe(this,"networkOnlineHandler",null),xe(this,"pendingNetworkRecoveryInfo",null),xe(this,"uri"),xe(this,"onOpen"),xe(this,"onResume"),xe(this,"onMessage"),xe(this,"webSocketConstructor"),xe(this,"logger"),xe(this,"onServerDisconnectError"),this.webSocketConstructor=r,this.socket={state:"disconnected"},this.connectionCount=0,this.lastCloseReason="InitialConnect",this.defaultInitialBackoff=1e3,this.maxBackoff=16e3,this.retries=0,this.serverInactivityThreshold=6e4,this.reconnectDueToServerInactivityTimeout=null,this.uri=e,this.onOpen=n.onOpen,this.onResume=n.onResume,this.onMessage=n.onMessage,this.onServerDisconnectError=n.onServerDisconnectError,this.logger=i,this.setupNetworkListener(),this.connect()}setSocketState(e){this.socket=e,this._logVerbose(`socket state changed: ${this.socket.state}, paused: ${"paused"in this.socket?this.socket.paused:void 0}`),this.markConnectionStateDirty()}setupNetworkListener(){typeof window>"u"||typeof window.addEventListener!="function"||this.networkOnlineHandler===null&&(this.networkOnlineHandler=()=>{this._logVerbose("network online event detected"),this.tryReconnectImmediately()},window.addEventListener("online",this.networkOnlineHandler),this._logVerbose("network online event listener registered"))}cleanupNetworkListener(){this.networkOnlineHandler&&typeof window<"u"&&typeof window.removeEventListener=="function"&&(window.removeEventListener("online",this.networkOnlineHandler),this.networkOnlineHandler=null,this._logVerbose("network online event listener removed"))}assembleTransition(e){if(e.partNumber<0||e.partNumber>=e.totalParts||e.totalParts===0||this.transitionChunkBuffer&&(this.transitionChunkBuffer.totalParts!==e.totalParts||this.transitionChunkBuffer.transitionId!==e.transitionId))throw this.transitionChunkBuffer=null,new Error("Invalid TransitionChunk");if(this.transitionChunkBuffer===null&&(this.transitionChunkBuffer={chunks:[],totalParts:e.totalParts,transitionId:e.transitionId}),e.partNumber!==this.transitionChunkBuffer.chunks.length){const n=this.transitionChunkBuffer.chunks.length;throw this.transitionChunkBuffer=null,new Error(`TransitionChunk received out of order: expected part ${n}, got ${e.partNumber}`)}if(this.transitionChunkBuffer.chunks.push(e.chunk),this.transitionChunkBuffer.chunks.length===e.totalParts){const n=this.transitionChunkBuffer.chunks.join("");this.transitionChunkBuffer=null;const r=as(JSON.parse(n));if(r.type!=="Transition")throw new Error(`Expected Transition, got ${r.type} after assembling chunks`);return r}return null}connect(){if(this.socket.state==="terminated")return;if(this.socket.state!=="disconnected"&&this.socket.state!=="stopped")throw new Error("Didn't start connection from disconnected state: "+this.socket.state);const e=new this.webSocketConstructor(this.uri);this._logVerbose("constructed WebSocket"),this.setSocketState({state:"connecting",ws:e,paused:"no"}),this.resetServerInactivityTimeout(),e.onopen=()=>{if(this.logger.logVerbose("begin ws.onopen"),this.socket.state!=="connecting")throw new Error("onopen called with socket not in connecting state");if(this.setSocketState({state:"ready",ws:e,paused:this.socket.paused==="yes"?"uninitialized":"no"}),this.resetServerInactivityTimeout(),this.socket.paused==="no"&&(this._hasEverConnected=!0,this.onOpen({connectionCount:this.connectionCount,lastCloseReason:this.lastCloseReason,clientTs:hn()})),this.lastCloseReason!=="InitialConnect"&&(this.lastCloseReason?this.logger.log("WebSocket reconnected at",ss(),"after disconnect due to",this.lastCloseReason):this.logger.log("WebSocket reconnected at",ss())),this.connectionCount+=1,this.lastCloseReason=null,this.pendingNetworkRecoveryInfo!==null){const{timeSavedMs:n}=this.pendingNetworkRecoveryInfo;this.pendingNetworkRecoveryInfo=null,this.sendMessage({type:"Event",eventType:"NetworkRecoveryReconnect",event:{timeSavedMs:n}}),this.logger.log(`Network recovery reconnect saved ~${Math.round(n/1e3)}s of waiting`)}},e.onerror=n=>{this.transitionChunkBuffer=null;const r=n.message;r&&this.logger.log(`WebSocket error message: ${r}`)},e.onmessage=n=>{this.resetServerInactivityTimeout();const r=n.data.length;let i=as(JSON.parse(n.data));if(this._logVerbose(`received ws message with type ${i.type}`),i.type==="Ping")return;if(i.type==="TransitionChunk"){const a=this.assembleTransition(i);if(!a)return;i=a,this._logVerbose(`assembled full ws message of type ${i.type}`)}this.transitionChunkBuffer!==null&&(this.transitionChunkBuffer=null,this.logger.log(`Received unexpected ${i.type} while buffering TransitionChunks`)),i.type==="Transition"&&this.reportLargeTransition({messageLength:r,transition:i}),this.onMessage(i).hasSyncedPastLastReconnect&&(this.retries=0,this.markConnectionStateDirty())},e.onclose=n=>{if(this._logVerbose("begin ws.onclose"),this.transitionChunkBuffer=null,this.lastCloseReason===null&&(this.lastCloseReason=n.reason||`closed with code ${n.code}`),n.code!==ud&&n.code!==dd&&n.code!==hd&&n.code!==fd){let i=`WebSocket closed with code ${n.code}`;n.reason&&(i+=`: ${n.reason}`),this.logger.log(i),this.onServerDisconnectError&&n.reason&&this.onServerDisconnectError(i)}const r=pd(n.reason);this.scheduleReconnect(r)}}socketState(){return this.socket.state}sendMessage(e){const n={type:e.type,...e.type==="Authenticate"&&e.tokenType==="User"?{value:`...${e.value.slice(-7)}`}:{}};if(this.socket.state==="ready"&&this.socket.paused==="no"){const r=sd(e),i=JSON.stringify(r);let o=!1;try{this.socket.ws.send(i),o=!0}catch(a){this.logger.log(`Failed to send message on WebSocket, reconnecting: ${a}`),this.closeAndReconnect("FailedToSendMessage")}return this._logVerbose(`${o?"sent":"failed to send"} message with type ${e.type}: ${JSON.stringify(n)}`),!0}return this._logVerbose(`message not sent (socket state: ${this.socket.state}, paused: ${"paused"in this.socket?this.socket.paused:void 0}): ${JSON.stringify(n)}`),!1}resetServerInactivityTimeout(){this.socket.state!=="terminated"&&(this.reconnectDueToServerInactivityTimeout!==null&&(clearTimeout(this.reconnectDueToServerInactivityTimeout),this.reconnectDueToServerInactivityTimeout=null),this.reconnectDueToServerInactivityTimeout=setTimeout(()=>{this.closeAndReconnect("InactiveServer")},this.serverInactivityThreshold))}scheduleReconnect(e){this.scheduledReconnect&&(clearTimeout(this.scheduledReconnect.timeout),this.scheduledReconnect=null),this.socket={state:"disconnected"};const n=this.nextBackoff(e);this.markConnectionStateDirty(),this.logger.log(`Attempting reconnect in ${Math.round(n)}ms`);const r=hn(),i=setTimeout(()=>{this.scheduledReconnect?.timeout===i&&(this.scheduledReconnect=null,this.connect())},n);this.scheduledReconnect={timeout:i,scheduledAt:r,backoffMs:n}}closeAndReconnect(e){switch(this._logVerbose(`begin closeAndReconnect with reason ${e}`),this.socket.state){case"disconnected":case"terminated":case"stopped":return;case"connecting":case"ready":{this.lastCloseReason=e,this.close(),this.scheduleReconnect("client");return}default:this.socket}}close(){switch(this.transitionChunkBuffer=null,this.socket.state){case"disconnected":case"terminated":case"stopped":return Promise.resolve();case"connecting":{const e=this.socket.ws;return e.onmessage=n=>{this._logVerbose("Ignoring message received after close")},new Promise(n=>{e.onclose=()=>{this._logVerbose("Closed after connecting"),n()},e.onopen=()=>{this._logVerbose("Opened after connecting"),e.close()}})}case"ready":{this._logVerbose("ws.close called");const e=this.socket.ws;e.onmessage=r=>{this._logVerbose("Ignoring message received after close")};const n=new Promise(r=>{e.onclose=()=>{r()}});return e.close(),n}default:return this.socket,Promise.resolve()}}terminate(){switch(this.reconnectDueToServerInactivityTimeout&&clearTimeout(this.reconnectDueToServerInactivityTimeout),this.scheduledReconnect&&(clearTimeout(this.scheduledReconnect.timeout),this.scheduledReconnect=null),this.cleanupNetworkListener(),this.socket.state){case"terminated":case"stopped":case"disconnected":case"connecting":case"ready":{const e=this.close();return this.setSocketState({state:"terminated"}),e}default:throw this.socket,new Error(`Invalid websocket state: ${this.socket.state}`)}}stop(){switch(this.socket.state){case"terminated":return Promise.resolve();case"connecting":case"stopped":case"disconnected":case"ready":{this.cleanupNetworkListener();const e=this.close();return this.socket={state:"stopped"},e}default:return this.socket,Promise.resolve()}}tryRestart(){switch(this.socket.state){case"stopped":break;case"terminated":case"connecting":case"ready":case"disconnected":this.logger.logVerbose("Restart called without stopping first");return;default:this.socket}this.setupNetworkListener(),this.connect()}pause(){switch(this.socket.state){case"disconnected":case"stopped":case"terminated":return;case"connecting":case"ready":{this.socket={...this.socket,paused:"yes"};return}default:{this.socket;return}}}tryReconnectImmediately(){if(this._logVerbose("tryReconnectImmediately called"),this.socket.state!=="disconnected"){this._logVerbose(`tryReconnectImmediately called but socket state is ${this.socket.state}, no action taken`);return}let e=null;if(this.scheduledReconnect){const n=hn()-this.scheduledReconnect.scheduledAt;e=Math.max(0,this.scheduledReconnect.backoffMs-n),this._logVerbose(`would have waited ${Math.round(e)}ms more (backoff was ${Math.round(this.scheduledReconnect.backoffMs)}ms, elapsed ${Math.round(n)}ms)`),clearTimeout(this.scheduledReconnect.timeout),this.scheduledReconnect=null,this._logVerbose("canceled scheduled reconnect")}this.logger.log("Network recovery detected, reconnecting immediately"),this.pendingNetworkRecoveryInfo=e!==null?{timeSavedMs:e}:null,this.connect()}resume(){switch(this.socket.state){case"connecting":this.socket={...this.socket,paused:"no"};return;case"ready":this.socket.paused==="uninitialized"?(this.socket={...this.socket,paused:"no"},this._hasEverConnected=!0,this.onOpen({connectionCount:this.connectionCount,lastCloseReason:this.lastCloseReason,clientTs:hn()})):this.socket.paused==="yes"&&(this.socket={...this.socket,paused:"no"},this.onResume());return;case"terminated":case"stopped":case"disconnected":return;default:this.socket}this.connect()}connectionState(){return{isConnected:this.socket.state==="ready",hasEverConnected:this._hasEverConnected,connectionCount:this.connectionCount,connectionRetries:this.retries}}_logVerbose(e){this.logger.logVerbose(e)}nextBackoff(e){const r=(e==="client"?100:e==="Unknown"?this.defaultInitialBackoff:ls[e].timeout)*Math.pow(2,this.retries);this.retries+=1;const i=Math.min(r,this.maxBackoff),o=i*(Math.random()-.5);return i+o}reportLargeTransition({transition:e,messageLength:n}){if(e.clientClockSkew===void 0||e.serverTs===void 0)return;const r=hn()-e.clientClockSkew-e.serverTs/1e6,i=`${Math.round(r)}ms`,o=`${Math.round(n/1e4)/100}MB`,a=n/(r/1e3),l=`${Math.round(a/1e4)/100}MB per second`;this._logVerbose(`received ${o} transition in ${i} at ${l}`),n>2e7?this.logger.log(`received query results totaling more that 20MB (${o}) which will take a long time to download on slower connections`):r>2e4&&this.logger.log(`received query results totaling ${o} which took more than 20s to arrive (${i})`),this.debug&&this.sendMessage({type:"Event",eventType:"ClientReceivedTransition",event:{transitionTransitTime:r,messageLength:n}})}}function gd(){return xd()}function xd(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}class Un extends Error{}Un.prototype.name="InvalidTokenError";function bd(t){return decodeURIComponent(atob(t).replace(/(.)/g,(e,n)=>{let r=n.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r}))}function vd(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 bd(e)}catch{return atob(e)}}function cs(t,e){if(typeof t!="string")throw new Un("Invalid token specified: must be a string");e||(e={});const n=e.header===!0?0:1,r=t.split(".")[n];if(typeof r!="string")throw new Un(`Invalid token specified: missing part #${n+1}`);let i;try{i=vd(r)}catch(o){throw new Un(`Invalid token specified: invalid base64 for part #${n+1} (${o.message})`)}try{return JSON.parse(i)}catch(o){throw new Un(`Invalid token specified: invalid json for part #${n+1} (${o.message})`)}}var yd=Object.defineProperty,wd=(t,e,n)=>e in t?yd(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ze=(t,e,n)=>wd(t,typeof e!="symbol"?e+"":e,n);const kd=480*60*60*1e3,us=2;class _d{constructor(e,n,r){ze(this,"authState",{state:"noAuth"}),ze(this,"configVersion",0),ze(this,"syncState"),ze(this,"authenticate"),ze(this,"stopSocket"),ze(this,"tryRestartSocket"),ze(this,"pauseSocket"),ze(this,"resumeSocket"),ze(this,"clearAuth"),ze(this,"logger"),ze(this,"refreshTokenLeewaySeconds"),ze(this,"initialAuthTokenReuse"),ze(this,"lastRefreshChange"),ze(this,"tokenConfirmationAttempts",0),this.syncState=e,this.authenticate=n.authenticate,this.stopSocket=n.stopSocket,this.tryRestartSocket=n.tryRestartSocket,this.pauseSocket=n.pauseSocket,this.resumeSocket=n.resumeSocket,this.clearAuth=n.clearAuth,this.logger=r.logger,this.refreshTokenLeewaySeconds=r.refreshTokenLeewaySeconds,this.initialAuthTokenReuse=r.initialAuthTokenReuse,this.lastRefreshChange=!1}notifyRefreshChange(e){this.authState.state!=="noAuth"&&this.authState.state!=="initialRefetch"&&this.authState.config.onRefreshChange&&this.lastRefreshChange!==e&&(this.lastRefreshChange=e,this.authState.config.onRefreshChange(e))}async setConfig(e,n,r){this.resetAuthState(),this._logVerbose("pausing WS for auth token fetch"),this.pauseSocket();const i=await this.fetchTokenAndGuardAgainstRace(e,{forceRefreshToken:!1});if(i.isFromOutdatedConfig)return;const o={fetchToken:e,onAuthChange:n,onRefreshChange:r};i.value?(this.setAuthState({state:"waitingForServerConfirmationOfCachedToken",config:o,hasRetried:!1}),this.authenticate(i.value)):(this.setAuthState({state:"initialRefetch",config:o}),await this.refetchToken()),this._logVerbose("resuming WS after auth token fetch"),this.resumeSocket()}onTransition(e){if(this.syncState.isCurrentOrNewerAuthVersion(e.endVersion.identity)&&!(e.endVersion.identity<=e.startVersion.identity)){if(this._logVerbose(`auth state is ${this.authState.state} when handling transition`),this.syncState.markAuthCompletion(),this.authState.state==="waitingForServerConfirmationOfCachedToken"){this._logVerbose("server confirmed auth token is valid");const n=this.syncState.getAuth()?.value;this.initialAuthTokenReuse&&n?this.scheduleTokenRefetch(n,e.clientClockSkew):this.refetchToken(),this.authState.config.onAuthChange(!0);return}this.authState.state==="waitingForServerConfirmationOfFreshToken"&&(this._logVerbose("server confirmed new auth token is valid"),this.notifyRefreshChange(!1),this.scheduleTokenRefetch(this.authState.token),this.tokenConfirmationAttempts=0,this.authState.hadAuth||this.authState.config.onAuthChange(!0))}}onAuthError(e){if(e.authUpdateAttempted===!1&&(this.authState.state==="waitingForServerConfirmationOfFreshToken"||this.authState.state==="waitingForServerConfirmationOfCachedToken")){this._logVerbose("ignoring non-auth token expired error");return}const{baseVersion:n}=e;if(!this.syncState.isCurrentOrNewerAuthVersion(n+1)){this._logVerbose("ignoring auth error for previous auth attempt");return}this.tryToReauthenticate(e)}async tryToReauthenticate(e){if(this._logVerbose(`attempting to reauthenticate: ${e.error}`),this.authState.state==="noAuth"||this.authState.state==="waitingForServerConfirmationOfFreshToken"&&this.tokenConfirmationAttempts>=us){this.logger.error(`Failed to authenticate: "${e.error}", check your server auth config`),this.syncState.hasAuth()&&this.syncState.clearAuth(),this.authState.state!=="noAuth"&&this.setAndReportAuthFailed(this.authState.config.onAuthChange);return}if(this.authState.state==="waitingForServerConfirmationOfFreshToken"&&(this.tokenConfirmationAttempts++,this._logVerbose(`retrying reauthentication, ${us-this.tokenConfirmationAttempts} attempts remaining`)),this.notifyRefreshChange(!0),await this.stopSocket(),this.authState.state==="noAuth")return;const n=await this.fetchTokenAndGuardAgainstRace(this.authState.config.fetchToken,{forceRefreshToken:!0});n.isFromOutdatedConfig||(n.value&&this.syncState.isNewAuth(n.value)?(this.authenticate(n.value),this.setAuthState({state:"waitingForServerConfirmationOfFreshToken",config:this.authState.config,token:n.value,hadAuth:this.authState.state==="notRefetching"||this.authState.state==="waitingForScheduledRefetch"})):(this._logVerbose("reauthentication failed, could not fetch a new token"),this.syncState.hasAuth()&&this.syncState.clearAuth(),this.setAndReportAuthFailed(this.authState.config.onAuthChange)),this.tryRestartSocket())}async refetchToken(){if(this.authState.state==="noAuth")return;this._logVerbose("refetching auth token");const e=await this.fetchTokenAndGuardAgainstRace(this.authState.config.fetchToken,{forceRefreshToken:!0});e.isFromOutdatedConfig||(e.value?this.syncState.isNewAuth(e.value)?(this.setAuthState({state:"waitingForServerConfirmationOfFreshToken",hadAuth:this.syncState.hasAuth(),token:e.value,config:this.authState.config}),this.authenticate(e.value)):this.setAuthState({state:"notRefetching",config:this.authState.config}):(this._logVerbose("refetching token failed"),this.syncState.hasAuth()&&this.clearAuth(),this.setAndReportAuthFailed(this.authState.config.onAuthChange)),this._logVerbose("restarting WS after auth token fetch (if currently stopped)"),this.tryRestartSocket())}scheduleTokenRefetch(e,n){if(this.authState.state==="noAuth")return;const r=this.decodeToken(e);if(!r){this.logger.error("Auth token is not a valid JWT, cannot refetch the token");return}const{iat:i,exp:o}=r;if(!i||!o){this.logger.error("Auth token does not have required fields, cannot refetch the token");return}const a=o-i;if(a<=2){this.logger.error("Auth token does not live long enough, cannot refetch the token");return}let l;if(n!==void 0){const d=(Date.now()-n)/1e3;l=o-d,l<=0&&(l=0)}else l=a;let c=Math.min(kd,(l-this.refreshTokenLeewaySeconds)*1e3);c<=0&&(this.logger.warn(`Refetching auth token immediately, configured leeway ${this.refreshTokenLeewaySeconds}s is larger than the token's lifetime ${l}s`),c=0);const u=setTimeout(()=>{this._logVerbose("running scheduled token refetch"),this.refetchToken()},c);this.setAuthState({state:"waitingForScheduledRefetch",refetchTokenTimeoutId:u,config:this.authState.config}),this._logVerbose(`scheduled preemptive auth token refetching in ${c}ms`)}async fetchTokenAndGuardAgainstRace(e,n){const r=++this.configVersion;this._logVerbose(`fetching token with config version ${r}`);const i=await e(n);return this.configVersion!==r?(this._logVerbose(`stale config version, expected ${r}, got ${this.configVersion}`),{isFromOutdatedConfig:!0}):{isFromOutdatedConfig:!1,value:i}}stop(){this.resetAuthState(),this.configVersion++,this._logVerbose(`config version bumped to ${this.configVersion}`)}setAndReportAuthFailed(e){e(!1),this.resetAuthState()}resetAuthState(){this.notifyRefreshChange(!1),this.setAuthState({state:"noAuth"})}setAuthState(e){const n=e.state==="waitingForServerConfirmationOfFreshToken"?{hadAuth:e.hadAuth,state:e.state,token:`...${e.token.slice(-7)}`}:{state:e.state};switch(this._logVerbose(`setting auth state to ${JSON.stringify(n)}`),e.state){case"waitingForScheduledRefetch":case"notRefetching":case"noAuth":this.tokenConfirmationAttempts=0;break}this.authState.state==="waitingForScheduledRefetch"&&clearTimeout(this.authState.refetchTokenTimeoutId),this.authState=e}decodeToken(e){try{return cs(e)}catch(n){return this._logVerbose(`Error decoding token: ${n instanceof Error?n.message:"Unknown error"}`),null}}_logVerbose(e){this.logger.logVerbose(`${e} [v${this.configVersion}]`)}}const jd=["convexClientConstructed","convexWebSocketOpen","convexFirstMessageReceived"];function Sd(t,e){const n={sessionId:e};typeof performance>"u"||!performance.mark||performance.mark(t,{detail:n})}function Td(t){let e=t.name.slice(6);return e=e.charAt(0).toLowerCase()+e.slice(1),{name:e,startTime:t.startTime}}function Cd(t){if(typeof performance>"u"||!performance.getEntriesByName)return[];const e=[];for(const n of jd){const r=performance.getEntriesByName(n).filter(i=>i.entryType==="mark").filter(i=>i.detail.sessionId===t);e.push(...r)}return e.map(Td)}var Ad=Object.defineProperty,Rd=(t,e,n)=>e in t?Ad(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,be=(t,e,n)=>Rd(t,typeof e!="symbol"?e+"":e,n);class Ed{constructor(e,n,r){if(be(this,"address"),be(this,"state"),be(this,"requestManager"),be(this,"webSocketManager"),be(this,"authenticationManager"),be(this,"remoteQuerySet"),be(this,"optimisticQueryResults"),be(this,"_transitionHandlerCounter",0),be(this,"_nextRequestId"),be(this,"_onTransitionFns",new Map),be(this,"_sessionId"),be(this,"firstMessageReceived",!1),be(this,"debug"),be(this,"logger"),be(this,"maxObservedTimestamp"),be(this,"connectionStateSubscribers",new Map),be(this,"nextConnectionStateSubscriberId",0),be(this,"_lastPublishedConnectionState"),be(this,"markConnectionStateDirty",()=>{Promise.resolve().then(()=>{const p=this.connectionState();if(JSON.stringify(p)!==JSON.stringify(this._lastPublishedConnectionState)){this._lastPublishedConnectionState=p;for(const x of this.connectionStateSubscribers.values())x(p)}})}),be(this,"mark",p=>{this.debug&&Sd(p,this.sessionId)}),typeof e=="object")throw new Error("Passing a ClientConfig object is no longer supported. Pass the URL of the Convex deployment as a string directly.");r?.skipConvexDeploymentUrlCheck!==!0&&ju(e),r={...r};const i=r.authRefreshTokenLeewaySeconds??10;let o=r.webSocketConstructor;if(!o&&typeof WebSocket>"u")throw new Error("No WebSocket global variable defined! To use Convex in an environment without WebSocket try the HTTP client: https://docs.convex.dev/api/classes/browser.ConvexHttpClient");o=o||WebSocket,this.debug=r.reportDebugInfoToConvex??!1,this.address=e,this.logger=r.logger===!1?es({verbose:r.verbose??!1}):r.logger!==!0&&r.logger?r.logger:Za({verbose:r.verbose??!1});const a=e.search("://");if(a===-1)throw new Error("Provided address was not an absolute URL.");const l=e.substring(a+3),c=e.substring(0,a);let u;if(c==="http")u="ws";else if(c==="https")u="wss";else throw new Error(`Unknown parent protocol ${c}`);const d=`${u}://${l}/api/${Ka}/sync`;this.state=new Bu,this.remoteQuerySet=new os(p=>this.state.queryPath(p),this.logger),this.requestManager=new Wu(this.logger,this.markConnectionStateDirty);const m=()=>{this.webSocketManager.pause(),this.state.pause()};this.authenticationManager=new _d(this.state,{authenticate:p=>{const x=this.state.setAuth(p);return this.webSocketManager.sendMessage(x),x.baseVersion},stopSocket:()=>this.webSocketManager.stop(),tryRestartSocket:()=>this.webSocketManager.tryRestart(),pauseSocket:m,resumeSocket:()=>this.webSocketManager.resume(),clearAuth:()=>{this.clearAuth()}},{logger:this.logger,refreshTokenLeewaySeconds:i,initialAuthTokenReuse:r.initialAuthTokenReuse??!1}),this.optimisticQueryResults=new Zu,this.addOnTransitionHandler(p=>{n(p.queries.map(x=>x.token))}),this._nextRequestId=0,this._sessionId=gd();const{unsavedChangesWarning:h}=r;if(typeof window>"u"||typeof window.addEventListener>"u"){if(h===!0)throw new Error("unsavedChangesWarning requested, but window.addEventListener not found! Remove {unsavedChangesWarning: true} from Convex client options.")}else h!==!1&&window.addEventListener("beforeunload",p=>{if(this.requestManager.hasIncompleteRequests()){p.preventDefault();const x="Are you sure you want to leave? Your changes may not be saved.";return(p||window.event).returnValue=x,x}});this.webSocketManager=new md(d,{onOpen:p=>{this.mark("convexWebSocketOpen"),this.webSocketManager.sendMessage({...p,type:"Connect",sessionId:this._sessionId,maxObservedTimestamp:this.maxObservedTimestamp}),this.remoteQuerySet=new os(b=>this.state.queryPath(b),this.logger);const[x,w]=this.state.restart();w&&this.webSocketManager.sendMessage(w),this.webSocketManager.sendMessage(x);for(const b of this.requestManager.restart())this.webSocketManager.sendMessage(b)},onResume:()=>{const[p,x]=this.state.resume();x&&this.webSocketManager.sendMessage(x),p&&this.webSocketManager.sendMessage(p);for(const w of this.requestManager.resume())this.webSocketManager.sendMessage(w)},onMessage:p=>{switch(this.firstMessageReceived||(this.firstMessageReceived=!0,this.mark("convexFirstMessageReceived"),this.reportMarks()),p.type){case"Transition":{this.observedTimestamp(p.endVersion.ts),this.authenticationManager.onTransition(p),this.remoteQuerySet.transition(p),this.state.transition(p);const x=this.requestManager.removeCompleted(this.remoteQuerySet.timestamp());this.notifyOnQueryResultChanges(x);break}case"MutationResponse":{p.success&&this.observedTimestamp(p.ts);const x=this.requestManager.onResponse(p);x!==null&&this.notifyOnQueryResultChanges(new Map([[x.requestId,x.result]]));break}case"ActionResponse":{this.requestManager.onResponse(p);break}case"AuthError":{this.authenticationManager.onAuthError(p);break}case"FatalError":{const x=zu(this.logger,p.error);throw this.webSocketManager.terminate(),x}}return{hasSyncedPastLastReconnect:this.hasSyncedPastLastReconnect()}},onServerDisconnectError:r.onServerDisconnectError},o,this.logger,this.markConnectionStateDirty,this.debug),this.mark("convexClientConstructed"),r.expectAuth&&m()}hasSyncedPastLastReconnect(){return this.requestManager.hasSyncedPastLastReconnect()&&this.state.hasSyncedPastLastReconnect()}observedTimestamp(e){(this.maxObservedTimestamp===void 0||this.maxObservedTimestamp.lessThanOrEqual(e))&&(this.maxObservedTimestamp=e)}getMaxObservedTimestamp(){return this.maxObservedTimestamp}notifyOnQueryResultChanges(e){const n=this.remoteQuerySet.remoteQueryResults(),r=new Map;for(const[o,a]of n){const l=this.state.queryToken(o);if(l!==null){const c={result:a,udfPath:this.state.queryPath(o),args:this.state.queryArgs(o)};r.set(l,c)}}const i=this.optimisticQueryResults.ingestQueryResultsFromServer(r,new Set(e.keys()));this.handleTransition({queries:i.map(o=>{const a=this.optimisticQueryResults.rawQueryResult(o);return{token:o,modification:{kind:"Updated",result:a}}}),reflectedMutations:Array.from(e).map(([o,a])=>({requestId:o,result:a})),timestamp:this.remoteQuerySet.timestamp()})}handleTransition(e){for(const n of this._onTransitionFns.values())n(e)}addOnTransitionHandler(e){const n=this._transitionHandlerCounter++;return this._onTransitionFns.set(n,e),()=>this._onTransitionFns.delete(n)}getCurrentAuthClaims(){const e=this.state.getAuth();let n={};if(e&&e.tokenType==="User")try{n=e?cs(e.value):{}}catch{n={}}else return;return{token:e.value,decoded:n}}setAuth(e,n,r){this.authenticationManager.setConfig(e,n,r)}hasAuth(){return this.state.hasAuth()}setAdminAuth(e,n){const r=this.state.setAdminAuth(e,n);this.webSocketManager.sendMessage(r)}clearAuth(){const e=this.state.clearAuth();this.webSocketManager.sendMessage(e)}subscribe(e,n,r){const i=vt(n),{modification:o,queryToken:a,unsubscribe:l}=this.state.subscribe(e,i,r?.journal,r?.componentPath);return o!==null&&this.webSocketManager.sendMessage(o),{queryToken:a,unsubscribe:()=>{const c=l();c&&this.webSocketManager.sendMessage(c)}}}localQueryResult(e,n){const r=vt(n),i=Vt(e,r);return this.optimisticQueryResults.queryResult(i)}localQueryResultByToken(e){return this.optimisticQueryResults.queryResult(e)}hasLocalQueryResultByToken(e){return this.optimisticQueryResults.hasQueryResult(e)}localQueryLogs(e,n){const r=vt(n),i=Vt(e,r);return this.optimisticQueryResults.queryLogs(i)}queryJournal(e,n){const r=vt(n),i=Vt(e,r);return this.state.queryJournal(i)}connectionState(){const e=this.webSocketManager.connectionState();return{hasInflightRequests:this.requestManager.hasInflightRequests(),isWebSocketConnected:e.isConnected,hasEverConnected:e.hasEverConnected,connectionCount:e.connectionCount,connectionRetries:e.connectionRetries,timeOfOldestInflightRequest:this.requestManager.timeOfOldestInflightRequest(),inflightMutations:this.requestManager.inflightMutations(),inflightActions:this.requestManager.inflightActions()}}subscribeToConnectionState(e){const n=this.nextConnectionStateSubscriberId++;return this.connectionStateSubscribers.set(n,e),()=>{this.connectionStateSubscribers.delete(n)}}async mutation(e,n,r){const i=await this.mutationInternal(e,n,r);if(!i.success)throw i.errorData!==void 0?Ni(i,new wr(dn("mutation",e,i))):new Error(dn("mutation",e,i));return i.value}async mutationInternal(e,n,r,i){const{mutationPromise:o}=this.enqueueMutation(e,n,r,i);return o}enqueueMutation(e,n,r,i){const o=vt(n);this.tryReportLongDisconnect();const a=this.nextRequestId;if(this._nextRequestId++,r!==void 0){const d=r.optimisticUpdate;if(d!==void 0){const m=x=>{d(x,o)instanceof Promise&&this.logger.warn("Optimistic update handler returned a Promise. Optimistic updates should be synchronous.")},p=this.optimisticQueryResults.applyOptimisticUpdate(m,a).map(x=>{const w=this.localQueryResultByToken(x);return{token:x,modification:{kind:"Updated",result:w===void 0?void 0:{success:!0,value:w,logLines:[]}}}});this.handleTransition({queries:p,reflectedMutations:[],timestamp:this.remoteQuerySet.timestamp()})}}const l={type:"Mutation",requestId:a,udfPath:e,componentPath:i,args:[ct(o)]},c=this.webSocketManager.sendMessage(l),u=this.requestManager.request(l,c);return{requestId:a,mutationPromise:u}}async action(e,n){const r=await this.actionInternal(e,n);if(!r.success)throw r.errorData!==void 0?Ni(r,new wr(dn("action",e,r))):new Error(dn("action",e,r));return r.value}async actionInternal(e,n,r){const i=vt(n),o=this.nextRequestId;this._nextRequestId++,this.tryReportLongDisconnect();const a={type:"Action",requestId:o,udfPath:e,componentPath:r,args:[ct(i)]},l=this.webSocketManager.sendMessage(a);return this.requestManager.request(a,l)}async close(){return this.authenticationManager.stop(),this.webSocketManager.terminate()}get url(){return this.address}get nextRequestId(){return this._nextRequestId}get sessionId(){return this._sessionId}reportMarks(){if(this.debug){const e=Cd(this.sessionId);this.webSocketManager.sendMessage({type:"Event",eventType:"ClientConnect",event:e})}}tryReportLongDisconnect(){if(!this.debug)return;const e=this.connectionState().timeOfOldestInflightRequest;if(e===null||Date.now()-e.getTime()<=60*1e3)return;const n=`${this.address}/api/debug_event`;fetch(n,{method:"POST",headers:{"Content-Type":"application/json","Convex-Client":`npm-${Ka}`},body:JSON.stringify({event:"LongWebsocketDisconnect"})}).then(r=>{r.ok||this.logger.warn("Analytics request failed with response:",r.body)}).catch(r=>{this.logger.warn("Analytics response failed with error:",r)})}}function Di(t){if(typeof t!="object"||t===null||!Array.isArray(t.page)||typeof t.isDone!="boolean"||typeof t.continueCursor!="string")throw new Error(`Not a valid paginated query result: ${t?.toString()}`);return t}var Id=Object.defineProperty,Pd=(t,e,n)=>e in t?Id(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ds=(t,e,n)=>Pd(t,typeof e!="symbol"?e+"":e,n);class Md{constructor(e,n){this.client=e,this.onTransition=n,ds(this,"paginatedQuerySet",new Map),ds(this,"lastTransitionTs"),this.lastTransitionTs=qe.fromNumber(0),this.client.addOnTransitionHandler(r=>this.onBaseTransition(r))}subscribe(e,n,r){const i=Bt(e),o=ts(i,n,r),a=()=>this.removePaginatedQuerySubscriber(o),l=this.paginatedQuerySet.get(o);return l?(l.numSubscribers+=1,{paginatedQueryToken:o,unsubscribe:a}):(this.paginatedQuerySet.set(o,{token:o,canonicalizedUdfPath:i,args:n,numSubscribers:1,options:{initialNumItems:r.initialNumItems},nextPageKey:0,pageKeys:[],pageKeyToQuery:new Map,ongoingSplits:new Map,skip:!1,id:r.id}),this.addPageToPaginatedQuery(o,null,r.initialNumItems),{paginatedQueryToken:o,unsubscribe:a})}localQueryResult(e,n,r){const i=Bt(e),o=ts(i,n,r);return this.localQueryResultByToken(o)}localQueryResultByToken(e){const n=this.paginatedQuerySet.get(e);if(!n)return;const r=this.activePageQueryTokens(n);if(r.length===0)return{results:[],status:"LoadingFirstPage",loadMore:c=>this.loadMoreOfPaginatedQuery(e,c)};let i=[],o=!1,a=!1;for(const c of r){const u=this.client.localQueryResultByToken(c);if(u===void 0){o=!0,a=!1;continue}const d=Di(u);i=i.concat(d.page),a=!!d.isDone}let l;return o?l=i.length===0?"LoadingFirstPage":"LoadingMore":a?l="Exhausted":l="CanLoadMore",{results:i,status:l,loadMore:c=>this.loadMoreOfPaginatedQuery(e,c)}}onBaseTransition(e){const n=e.queries.map(a=>a.token),r=this.queriesContainingTokens(n);let i=[];r.length>0&&(this.processPaginatedQuerySplits(r,a=>this.client.localQueryResultByToken(a)),i=r.map(a=>({token:a,modification:{kind:"Updated",result:this.localQueryResultByToken(a)}})));const o={...e,paginatedQueries:i};this.onTransition(o)}loadMoreOfPaginatedQuery(e,n){this.mustGetPaginatedQuery(e);const r=this.queryTokenForLastPageOfPaginatedQuery(e),i=this.client.localQueryResultByToken(r);if(!i)return!1;const o=Di(i);if(o.isDone)return!1;this.addPageToPaginatedQuery(e,o.continueCursor,n);const a={timestamp:this.lastTransitionTs,reflectedMutations:[],queries:[],paginatedQueries:[{token:e,modification:{kind:"Updated",result:this.localQueryResultByToken(e)}}]};return this.onTransition(a),!0}queriesContainingTokens(e){if(e.length===0)return[];const n=[],r=new Set(e);for(const[i,o]of this.paginatedQuerySet)for(const a of this.allQueryTokens(o))if(r.has(a)){n.push(i);break}return n}processPaginatedQuerySplits(e,n){for(const r of e){const i=this.mustGetPaginatedQuery(r),{ongoingSplits:o,pageKeyToQuery:a,pageKeys:l}=i;for(const[c,[u,d]]of o)n(a.get(u).queryToken)!==void 0&&n(a.get(d).queryToken)!==void 0&&this.completePaginatedQuerySplit(i,c,u,d);for(const c of l){if(o.has(c))continue;const u=a.get(c);if(!u)throw new Error(`No page query for active pageKey ${c}`);const d=n(u.queryToken);if(!d)continue;const m=Di(d);m.splitCursor&&(m.pageStatus==="SplitRecommended"||m.pageStatus==="SplitRequired"||m.page.length>i.options.initialNumItems*2)&&this.splitPaginatedQueryPage(i,c,u.cursor,m.splitCursor,m.continueCursor)}}}splitPaginatedQueryPage(e,n,r,i,o){const a=e.nextPageKey++,l=e.nextPageKey++,c={numItems:e.options.initialNumItems,id:e.id},u=this.client.subscribe(e.canonicalizedUdfPath,{...e.args,paginationOpts:{...c,cursor:r,endCursor:i}});e.pageKeyToQuery.set(a,{...u,cursor:r});const d=this.client.subscribe(e.canonicalizedUdfPath,{...e.args,paginationOpts:{...c,cursor:i,endCursor:o}});e.pageKeyToQuery.set(l,{...d,cursor:i}),e.ongoingSplits.set(n,[a,l])}addPageToPaginatedQuery(e,n,r){const i=this.mustGetPaginatedQuery(e),o=i.nextPageKey++,a={cursor:n,numItems:r,id:i.id},l={...i.args,paginationOpts:a},c=this.client.subscribe(i.canonicalizedUdfPath,l);return i.pageKeys.push(o),i.pageKeyToQuery.set(o,{...c,cursor:n}),c}removePaginatedQuerySubscriber(e){const n=this.paginatedQuerySet.get(e);if(n&&(n.numSubscribers-=1,!(n.numSubscribers>0))){for(const r of n.pageKeyToQuery.values())r.unsubscribe();this.paginatedQuerySet.delete(e)}}completePaginatedQuerySplit(e,n,r,i){const o=e.pageKeyToQuery.get(n);e.pageKeyToQuery.delete(n);const a=e.pageKeys.indexOf(n);e.pageKeys.splice(a,1,r,i),e.ongoingSplits.delete(n),o.unsubscribe()}activePageQueryTokens(e){return e.pageKeys.map(n=>e.pageKeyToQuery.get(n).queryToken)}allQueryTokens(e){return Array.from(e.pageKeyToQuery.values()).map(n=>n.queryToken)}queryTokenForLastPageOfPaginatedQuery(e){const n=this.mustGetPaginatedQuery(e),r=n.pageKeys[n.pageKeys.length-1];if(r===void 0)throw new Error(`No pages for paginated query ${e}`);return n.pageKeyToQuery.get(r).queryToken}mustGetPaginatedQuery(e){const n=this.paginatedQuerySet.get(e);if(!n)throw new Error("paginated query no longer exists for token "+e);return n}}function Nd({getCurrentValue:t,subscribe:e}){const[n,r]=O(()=>({getCurrentValue:t,subscribe:e,value:t()}));let i=n.value;return(n.getCurrentValue!==t||n.subscribe!==e)&&(i=t(),r({getCurrentValue:t,subscribe:e,value:i})),M(()=>{let o=!1;const a=()=>{o||r(c=>{if(c.getCurrentValue!==t||c.subscribe!==e)return c;const u=t();return c.value===u?c:{...c,value:u}})},l=e(a);return a(),()=>{o=!0,l()}},[t,e]),i}var Ld=Object.defineProperty,Od=(t,e,n)=>e in t?Ld(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,yt=(t,e,n)=>Od(t,typeof e!="symbol"?e+"":e,n);const $d=5e3;if(typeof Ti>"u")throw new Error("Required dependency 'react' not found");function hs(t,e,n){function r(i){return Ud(i),e.mutation(t,i,{optimisticUpdate:n})}return r.withOptimisticUpdate=function(o){if(n!==void 0)throw new Error(`Already specified optimistic update for mutation ${Ne(t)}`);return hs(t,e,o)},r}function Dd(t,e){return function(n){return e.action(t,n)}}class qd{constructor(e,n){if(yt(this,"address"),yt(this,"cachedSync"),yt(this,"cachedPaginatedQueryClient"),yt(this,"listeners"),yt(this,"options"),yt(this,"closed",!1),yt(this,"_logger"),yt(this,"adminAuth"),yt(this,"fakeUserIdentity"),e===void 0)throw new Error("No address provided to ConvexReactClient.\nIf trying to deploy to production, make sure to follow all the instructions found at https://docs.convex.dev/production/hosting/\nIf running locally, make sure to run `convex dev` and ensure the .env.local file is populated.");if(typeof e!="string")throw new Error(`ConvexReactClient requires a URL like 'https://happy-otter-123.convex.cloud', received something of type ${typeof e} instead.`);if(!e.includes("://"))throw new Error("Provided address was not an absolute URL.");this.address=e,this.listeners=new Map,this._logger=n?.logger===!1?es({verbose:n?.verbose??!1}):n?.logger!==!0&&n?.logger?n.logger:Za({verbose:n?.verbose??!1}),this.options={...n,logger:this._logger}}get url(){return this.address}get sync(){if(this.closed)throw new Error("ConvexReactClient has already been closed.");return this.cachedSync?this.cachedSync:(this.cachedSync=this.options.baseClient??new Ed(this.address,()=>{},this.options),this.adminAuth&&this.cachedSync.setAdminAuth(this.adminAuth,this.fakeUserIdentity),this.cachedPaginatedQueryClient=new Md(this.cachedSync,e=>this.handleTransition(e)),this.cachedSync)}get paginatedQueryClient(){if(this.sync,this.cachedPaginatedQueryClient)return this.cachedPaginatedQueryClient;throw new Error("Should already be instantiated")}setAuth(e,n,r){if(typeof e=="string")throw new Error("Passing a string to ConvexReactClient.setAuth is no longer supported, please upgrade to passing in an async function to handle reauthentication.");this.sync.setAuth(e,n??(()=>{}),r)}clearAuth(){this.sync.clearAuth()}setAdminAuth(e,n){if(this.adminAuth=e,this.fakeUserIdentity=n,this.closed)throw new Error("ConvexReactClient has already been closed.");this.cachedSync&&this.sync.setAdminAuth(e,n)}watchQuery(e,...n){const[r,i]=n,o=Ne(e);return{onUpdate:a=>{const{queryToken:l,unsubscribe:c}=this.sync.subscribe(o,r,i),u=this.listeners.get(l);return u!==void 0?u.add(a):this.listeners.set(l,new Set([a])),()=>{if(this.closed)return;const d=this.listeners.get(l);d.delete(a),d.size===0&&this.listeners.delete(l),c()}},localQueryResult:()=>{if(this.cachedSync)return this.cachedSync.localQueryResult(o,r)},localQueryLogs:()=>{if(this.cachedSync)return this.cachedSync.localQueryLogs(o,r)},journal:()=>{if(this.cachedSync)return this.cachedSync.queryJournal(o,r)}}}prewarmQuery(e){const n=e.extendSubscriptionFor??$d,i=this.watchQuery(e.query,e.args||{}).onUpdate(()=>{});setTimeout(i,n)}watchPaginatedQuery(e,n,r){const i=Ne(e);return{onUpdate:o=>{const{paginatedQueryToken:a,unsubscribe:l}=this.paginatedQueryClient.subscribe(i,n||{},r),c=this.listeners.get(a);return c!==void 0?c.add(o):this.listeners.set(a,new Set([o])),()=>{if(this.closed)return;const u=this.listeners.get(a);u.delete(o),u.size===0&&this.listeners.delete(a),l()}},localQueryResult:()=>this.paginatedQueryClient.localQueryResult(i,n,r)}}mutation(e,...n){const[r,i]=n,o=Ne(e);return this.sync.mutation(o,r,i)}action(e,...n){const r=Ne(e);return this.sync.action(r,...n)}query(e,...n){const r=this.watchQuery(e,...n),i=r.localQueryResult();return i!==void 0?Promise.resolve(i):new Promise((o,a)=>{const l=r.onUpdate(()=>{l();try{o(r.localQueryResult())}catch(c){a(c)}})})}connectionState(){return this.sync.connectionState()}subscribeToConnectionState(e){return this.sync.subscribeToConnectionState(e)}get logger(){return this._logger}async close(){if(this.closed=!0,this.listeners=new Map,this.cachedPaginatedQueryClient&&(this.cachedPaginatedQueryClient=void 0),this.cachedSync){const e=this.cachedSync;this.cachedSync=void 0,await e.close()}}handleTransition(e){const n=e.queries.map(i=>i.token),r=e.paginatedQueries.map(i=>i.token);this.transition([...n,...r])}transition(e){for(const n of e){const r=this.listeners.get(n);if(r)for(const i of r)i()}}}const Cr=Ti.createContext(void 0);function zd(){return Nn(Cr)}const Fd=({client:t,children:e})=>Ti.createElement(Cr.Provider,{value:t},e);function wt(t,...e){const n=e[0]==="skip",r=e[0]==="skip"?{}:vt(e[0]),i=typeof t=="string"?Li(t):t,o=Ne(i),a=we(()=>n?{}:{query:{query:i,args:r}},[JSON.stringify(ct(r)),o,n]),c=Wd(a).query;if(c instanceof Error)throw c;return c}function kt(t){const e=typeof t=="string"?Li(t):t,n=Nn(Cr);if(n===void 0)throw new Error("Could not find Convex client! `useMutation` must be used in the React component tree under `ConvexProvider`. Did you forget it? See https://docs.convex.dev/quick-start#set-up-convex-in-your-react-app");return we(()=>hs(e,n),[n,Ne(e)])}function Ht(t){const e=Nn(Cr),n=typeof t=="string"?Li(t):t;if(e===void 0)throw new Error("Could not find Convex client! `useAction` must be used in the React component tree under `ConvexProvider`. Did you forget it? See https://docs.convex.dev/quick-start#set-up-convex-in-your-react-app");return we(()=>Dd(n,e),[e,Ne(n)])}function Ud(t){if(typeof t=="object"&&t!==null&&"bubbles"in t&&"persist"in t&&"isDefaultPrevented"in t)throw new Error("Convex function called with SyntheticEvent object. Did you use a Convex function as an event handler directly? Event handlers like onClick receive an event object as their first argument. These SyntheticEvent objects are not valid Convex values. Try wrapping the function like `const handler = () => myMutation();` and using `handler` in the event handler.")}var Bd=Object.defineProperty,Vd=(t,e,n)=>e in t?Bd(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,qi=(t,e,n)=>Vd(t,typeof e!="symbol"?e+"":e,n);class Hd{constructor(e){qi(this,"createWatch"),qi(this,"queries"),qi(this,"listeners"),this.createWatch=e,this.queries={},this.listeners=new Set}setQueries(e){for(const n of Object.keys(e)){const{query:r,args:i,paginationOptions:o}=e[n];if(Ne(r),this.queries[n]===void 0)this.addQuery(n,r,i,o?{paginationOptions:o}:{});else{const a=this.queries[n];(Ne(r)!==Ne(a.query)||JSON.stringify(ct(i))!==JSON.stringify(ct(a.args))||JSON.stringify(o)!==JSON.stringify(a.paginationOptions))&&(this.removeQuery(n),this.addQuery(n,r,i,o?{paginationOptions:o}:{}))}}for(const n of Object.keys(this.queries))e[n]===void 0&&this.removeQuery(n)}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}getLocalResults(e){const n={};for(const r of Object.keys(e)){const{query:i,args:o}=e[r],a=e[r].paginationOptions;Ne(i);const l=this.createWatch(i,o,a?{paginationOptions:a}:{});let c;try{c=l.localQueryResult()}catch(u){if(u instanceof Error)c=u;else throw u}n[r]=c}return n}setCreateWatch(e){this.createWatch=e;for(const n of Object.keys(this.queries)){const{query:r,args:i,watch:o,paginationOptions:a}=this.queries[n],l="journal"in o?o.journal():void 0;this.removeQuery(n),this.addQuery(n,r,i,{...l?{journal:l}:[],...a?{paginationOptions:a}:{}})}}destroy(){for(const e of Object.keys(this.queries))this.removeQuery(e);this.listeners=new Set}addQuery(e,n,r,{paginationOptions:i,journal:o}){if(this.queries[e]!==void 0)throw new Error(`Tried to add a new query with identifier ${e} when it already exists.`);const a=this.createWatch(n,r,{...o?{journal:o}:[],...i?{paginationOptions:i}:{}}),l=a.onUpdate(()=>this.notifyListeners());this.queries[e]={query:n,args:r,watch:a,unsubscribe:l,...i?{paginationOptions:i}:{}}}removeQuery(e){const n=this.queries[e];if(n===void 0)throw new Error(`No query found with identifier ${e}.`);n.unsubscribe(),delete this.queries[e]}notifyListeners(){for(const e of this.listeners)e()}}function Wd(t){const e=zd();if(e===void 0)throw new Error("Could not find Convex client! `useQuery` must be used in the React component tree under `ConvexProvider`. Did you forget it? See https://docs.convex.dev/quick-start#set-up-convex-in-your-react-app");const n=we(()=>(r,i,{journal:o,paginationOptions:a})=>a?e.watchPaginatedQuery(r,i,a):e.watchQuery(r,i,o?{journal:o}:{}),[e]);return Qd(t,n)}function Qd(t,e){const[n]=O(()=>new Hd(e));n.createWatch!==e&&n.setCreateWatch(e),M(()=>()=>n.destroy(),[n]);const r=we(()=>({getCurrentValue:()=>n.getLocalResults(t),subscribe:i=>(n.setQueries(t),n.subscribe(i))}),[n,t]);return Nd(r)}var Gd=Symbol.for("preact-signals");function Ar(){if(_t>1)_t--;else{var t,e=!1;for((function(){var i=Ir;for(Ir=void 0;i!==void 0;)i.S.v===i.v&&(i.S.i=i.i),i=i.o})();Bn!==void 0;){var n=Bn;for(Bn=void 0,Er++;n!==void 0;){var r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&ps(n))try{n.c()}catch(i){e||(t=i,e=!0)}n=r}}if(Er=0,_t--,e)throw t}}function Kd(t){if(_t>0)return t();zi=++Yd,_t++;try{return t()}finally{Ar()}}var ae=void 0;function Rr(t){var e=ae;ae=void 0;try{return t()}finally{ae=e}}var Bn=void 0,_t=0,Er=0,Yd=0,zi=0,Ir=void 0,Pr=0;function fs(t){if(ae!==void 0){var e=t.n;if(e===void 0||e.t!==ae)return e={i:0,S:t,p:ae.s,n:void 0,t:ae,e:void 0,x:void 0,r:e},ae.s!==void 0&&(ae.s.n=e),ae.s=e,t.n=e,32&ae.f&&t.S(e),e;if(e.i===-1)return e.i=0,e.n!==void 0&&(e.n.p=e.p,e.p!==void 0&&(e.p.n=e.n),e.p=ae.s,e.n=void 0,ae.s.n=e,ae.s=e),e}}function Se(t,e){this.v=t,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=e?.watched,this.Z=e?.unwatched,this.name=e?.name}Se.prototype.brand=Gd,Se.prototype.h=function(){return!0},Se.prototype.S=function(t){var e=this,n=this.t;n!==t&&t.e===void 0&&(t.x=n,this.t=t,n!==void 0?n.e=t:Rr(function(){var r;(r=e.W)==null||r.call(e)}))},Se.prototype.U=function(t){var e=this;if(this.t!==void 0){var n=t.e,r=t.x;n!==void 0&&(n.x=r,t.e=void 0),r!==void 0&&(r.e=n,t.x=void 0),t===this.t&&(this.t=r,r===void 0&&Rr(function(){var i;(i=e.Z)==null||i.call(e)}))}},Se.prototype.subscribe=function(t){var e=this;return Vn(function(){var n=e.value;Rr(function(){return t(n)})},{name:"sub"})},Se.prototype.valueOf=function(){return this.value},Se.prototype.toString=function(){return this.value+""},Se.prototype.toJSON=function(){return this.value},Se.prototype.peek=function(){var t=this;return Rr(function(){return t.value})},Object.defineProperty(Se.prototype,"value",{get:function(){var t=fs(this);return t!==void 0&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){if(Er>100)throw new Error("Cycle detected");(function(n){_t!==0&&Er===0&&n.l!==zi&&(n.l=zi,Ir={S:n,v:n.v,i:n.i,o:Ir})})(this),this.v=t,this.i++,Pr++,_t++;try{for(var e=this.t;e!==void 0;e=e.x)e.t.N()}finally{Ar()}}}});function H(t,e){return new Se(t,e)}function ps(t){for(var e=t.s;e!==void 0;e=e.n)if(e.S.i!==e.i||!e.S.h()||e.S.i!==e.i)return!0;return!1}function ms(t){for(var e=t.s;e!==void 0;e=e.n){var n=e.S.n;if(n!==void 0&&(e.r=n),e.S.n=e,e.i=-1,e.n===void 0){t.s=e;break}}}function gs(t){for(var e=t.s,n=void 0;e!==void 0;){var r=e.p;e.i===-1?(e.S.U(e),r!==void 0&&(r.n=e.n),e.n!==void 0&&(e.n.p=r)):n=e,e.S.n=e.r,e.r!==void 0&&(e.r=void 0),e=r}t.s=n}function Wt(t,e){Se.call(this,void 0,e),this.x=t,this.s=void 0,this.g=Pr-1,this.f=4}Wt.prototype=new Se,Wt.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Pr))return!0;if(this.g=Pr,this.f|=1,this.i>0&&!ps(this))return this.f&=-2,!0;var t=ae;try{ms(this),ae=this;var e=this.x();(16&this.f||this.v!==e||this.i===0)&&(this.v=e,this.f&=-17,this.i++)}catch(n){this.v=n,this.f|=16,this.i++}return ae=t,gs(this),this.f&=-2,!0},Wt.prototype.S=function(t){if(this.t===void 0){this.f|=36;for(var e=this.s;e!==void 0;e=e.n)e.S.S(e)}Se.prototype.S.call(this,t)},Wt.prototype.U=function(t){if(this.t!==void 0&&(Se.prototype.U.call(this,t),this.t===void 0)){this.f&=-33;for(var e=this.s;e!==void 0;e=e.n)e.S.U(e)}},Wt.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var t=this.t;t!==void 0;t=t.x)t.t.N()}},Object.defineProperty(Wt.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var t=fs(this);if(this.h(),t!==void 0&&(t.i=this.i),16&this.f)throw this.v;return this.v}});function Fi(t,e){return new Wt(t,e)}function xs(t){var e=t.m;if(t.m=void 0,typeof e=="function"){_t++;var n=ae;ae=void 0;try{e()}catch(r){throw t.f&=-2,t.f|=8,Ui(t),r}finally{ae=n,Ar()}}}function Ui(t){for(var e=t.s;e!==void 0;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,xs(t)}function Jd(t){if(ae!==this)throw new Error("Out-of-order effect");gs(this),ae=t,this.f&=-2,8&this.f&&Ui(this),Ar()}function fn(t,e){this.x=t,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=e?.name}fn.prototype.c=function(){var t=this.S();try{if(8&this.f||this.x===void 0)return;var e=this.x();typeof e=="function"&&(this.m=e)}finally{t()}},fn.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,xs(this),ms(this),_t++;var t=ae;return ae=this,Jd.bind(this,t)},fn.prototype.N=function(){2&this.f||(this.f|=2,this.u=Bn,Bn=this)},fn.prototype.d=function(){this.f|=8,1&this.f||Ui(this)},fn.prototype.dispose=function(){this.d()};function Vn(t,e){var n=new fn(t,e);try{n.c()}catch(i){throw n.d(),i}var r=n.d.bind(n);return r[Symbol.dispose]=r,r}var bs,Mr,Xd=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__,vs=[];Vn(function(){bs=this.N})();function pn(t,e){L[t]=e.bind(null,L[t]||function(){})}function Nr(t){if(Mr){var e=Mr;Mr=void 0,e()}Mr=t&&t.S()}function ys(t){var e=this,n=t.data,r=mn(n);r.value=n;var i=we(function(){for(var l=e,c=e.__v;c=c.__;)if(c.__c){c.__c.__$f|=4;break}var u=Fi(function(){var p=r.value.value;return p===0?0:p===!0?"":p||""}),d=Fi(function(){return!Array.isArray(u.value)&&!Ho(u.value)}),m=Vn(function(){if(this.N=ws,d.value){var p=u.value;l.__v&&l.__v.__e&&l.__v.__e.nodeType===3&&(l.__v.__e.data=p)}}),h=e.__$u.d;return e.__$u.d=function(){m(),h.call(this)},[d,u]},[]),o=i[0],a=i[1];return o.value?a.peek():a.value}ys.displayName="ReactiveTextNode",Object.defineProperties(Se.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:ys},props:{configurable:!0,get:function(){var t=this;return{data:{get value(){return t.value}}}}},__b:{configurable:!0,value:1}}),pn("__b",function(t,e){if(typeof e.type=="string"){var n,r=e.props;for(var i in r)if(i!=="children"){var o=r[i];o instanceof Se&&(n||(e.__np=n={}),n[i]=o,r[i]=o.peek())}}t(e)}),pn("__r",function(t,e){if(t(e),e.type!==ee){Nr();var n,r=e.__c;r&&(r.__$f&=-2,(n=r.__$u)===void 0&&(r.__$u=n=(function(i,o){var a;return Vn(function(){a=this},{name:o}),a.c=i,a})(function(){var i;Xd&&((i=n.y)==null||i.call(n)),r.__$f|=1,r.setState({})},typeof e.type=="function"?e.type.displayName||e.type.name:""))),Nr(n)}}),pn("__e",function(t,e,n,r){Nr(),t(e,n,r)}),pn("diffed",function(t,e){Nr();var n;if(typeof e.type=="string"&&(n=e.__e)){var r=e.__np,i=e.props;if(r){var o=n.U;if(o)for(var a in o){var l=o[a];l!==void 0&&!(a in r)&&(l.d(),o[a]=void 0)}else o={},n.U=o;for(var c in r){var u=o[c],d=r[c];u===void 0?(u=Zd(n,c,d,i),o[c]=u):u.o(d,i)}}}t(e)});function Zd(t,e,n,r){var i=e in t&&t.ownerSVGElement===void 0,o=H(n);return{o:function(a,l){o.value=a,r=l},d:Vn(function(){this.N=ws;var a=o.value.value;r[e]!==a&&(r[e]=a,i?t[e]=a:a!=null&&(a!==!1||e[4]==="-")?t.setAttribute(e,a):t.removeAttribute(e))})}}pn("unmount",function(t,e){if(typeof e.type=="string"){var n=e.__e;if(n){var r=n.U;if(r){n.U=void 0;for(var i in r){var o=r[i];o&&o.d()}}}var a=e.__np;if(a){var l=e.props;for(var c in a)l[c]=a[c]}e.__np=void 0}else{var u=e.__c;if(u){var d=u.__$u;d&&(u.__$u=void 0,d.d())}}t(e)}),pn("__h",function(t,e,n,r){(r<3||r===9)&&(e.__$f|=2),t(e,n,r)}),et.prototype.shouldComponentUpdate=function(t,e){if(this.__R)return!0;var n=this.__$u,r=n&&n.s!==void 0;for(var i in e)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var o=2&this.__$f;if(!(r||o||4&this.__$f)||1&this.__$f)return!0}else if(!(r||4&this.__$f)||3&this.__$f)return!0;for(var a in t)if(a!=="__source"&&t[a]!==this.props[a])return!0;for(var l in this.props)if(!(l in t))return!0;return!1};function mn(t,e){return we(function(){return H(t,e)},[])}var eh=function(t){queueMicrotask(function(){queueMicrotask(t)})};function th(){Kd(function(){for(var t;t=vs.shift();)bs.call(t)})}function ws(){vs.push(this)===1&&(L.requestAnimationFrame||eh)(th)}const ue=H(!1),Lr=H(void 0),Hn="https://jexitychat.de/privacy",Wn=H(Hn),Bi=H("chip"),ks=H(!1),Et=H(void 0),Vi=H([]),Hi=H([]),_s=H(null),Wi=H(!1);BigInt("-9223372036854775808"),BigInt("9223372036854775807"),BigInt("0"),BigInt("8"),BigInt("256");const nh=Symbol.for("functionName"),rh=Symbol.for("toReferencePath");function js(t=[]){const e={get(n,r){if(typeof r=="string"){const i=[...t,r];return js(i)}else if(r===nh){if(t.length<2){const a=["api",...t].join(".");throw new Error(`API path is expected to be of the form \`api.moduleName.functionName\`. Found: \`${a}\``)}const i=t.slice(0,-1).join("/"),o=t[t.length-1];return o==="default"?i:i+":"+o}else return r===Symbol.toStringTag?"FunctionReference":void 0}};return new Proxy({},e)}const ih=js();function Ss(t,e){const n={get(r,i){if(typeof i=="string"){const o=[...e,i];return Ss(t,o)}else if(i===rh){if(e.length<1){const o=[t,...e].join(".");throw new Error(`API path is expected to be of the form \`${t}.childComponent.functionName\`. Found: \`${o}\``)}return"_reference/childComponent/"+e.join("/")}else return}};return new Proxy({},n)}const oh=()=>Ss("components",[]),oe=ih;oh();function Ts(){return wt(oe.maintenance.isFrozen,{})?.frozen??Wi.value}function ah(t){return t.replace(/\.convex\.site\b/,".convex.cloud")}function Qi(t){return t.replace(/\.convex\.cloud\b/,".convex.site")}function Cs(t){return typeof t!="number"||!Number.isFinite(t)?24:Math.min(100,Math.max(0,t))}function sh(t){const e=t?.trim();if(e)try{const n=new URL(e);if(n.protocol==="http:"||n.protocol==="https:")return e}catch{return}}function lh(t,e){const n=t.title??e?.title??"Assistant",r=t.privacyPolicyMode??e?.privacyPolicyMode??"platform",i=ch(t.privacyNoticeStyle??e?.privacyNoticeStyle);return{title:n,botName:t.botName?.trim()||e?.botName?.trim()||n,greeting:t.greeting??e?.welcomeMessage??`Hi! I'm ${n}. How can I help?`,starterQuestions:t.starterQuestions??e?.starterQuestions??[],locale:t.locale??e?.locale,position:t.position??e?.position,colorScheme:t.colorScheme??e?.colorScheme,hideBranding:t.hideBranding??e?.hideBranding??!1,allowVisitorLocale:e?.allowVisitorLocale??!1,visitorAttachmentsEnabled:e?.visitorAttachmentsEnabled??!1,privacyPolicyMode:r,privacyPolicyUrl:r==="custom"?sh(t.privacyPolicyUrl??e?.privacyPolicyUrl):void 0,privacyNoticeStyle:i,sessionTimeoutMs:uh(e?.sessionTimeout),triggerIcon:t.triggerIcon??e?.triggerIcon??"chat",triggerRadius:t.triggerRadius??e?.triggerRadius??"full",triggerLabel:t.triggerLabel??e?.triggerLabel??"Chatte mit uns",triggerOffsetX:Cs(t.triggerOffsetX??e?.triggerOffsetX),triggerOffsetY:Cs(t.triggerOffsetY??e?.triggerOffsetY),mode:t.mode??"floating",proactiveMode:e?.proactiveMode??"off",proactiveDelaySeconds:Math.min(15,Math.max(0,e?.proactiveDelaySeconds??5)),primaryColor:t.primaryColor??e?.primaryColor,accentColor:t.accentColor??e?.accentColor,fontFamily:t.fontFamily??e?.fontFamily,fontSize:t.fontSize??e?.fontSize,borderRadius:t.borderRadius??e?.borderRadius,windowWidth:t.windowWidth??e?.windowWidth,windowHeight:t.windowHeight??e?.windowHeight}}function ch(t){return t==="explicit"||t==="sheet"?"explicit":"chip"}function uh(t){switch(t){case"never":return null;case"1h":return 3600*1e3;case"6h":return 360*60*1e3;case"7d":return 10080*60*1e3;case"24h":return 1440*60*1e3;case void 0:return 3600*1e3}}async function dh({siteUrl:t,orgSlug:e,projSlug:n,signal:r}){const i=new URL(`${t}/widget/config`);i.searchParams.set("orgSlug",e),n&&i.searchParams.set("projSlug",n);const o=await fetch(i.toString(),{signal:r,keepalive:!0});return o.ok?o.json():null}function hh(t,e,n,r){const[i,o]=O(r!==void 0?{config:r,settled:!0}:{config:null,settled:!1});return M(()=>{if(r!==void 0)return;o({config:null,settled:!1});const a=n??"https://festive-mouse-978.eu-west-1.convex.cloud",l=a?Qi(a):void 0;if(!l||!t){o({config:null,settled:!0});return}const c=new AbortController;async function u(d){try{const m=await dh({siteUrl:d,orgSlug:t,projSlug:e,signal:c.signal});c.signal.aborted||o({config:m,settled:!0})}catch(m){if(m instanceof Error&&m.name==="AbortError")return;c.signal.aborted||o({config:null,settled:!0})}}return u(l),()=>{c.abort()}},[t,e,n,r]),i}const As=globalThis.console,X={warn(...t){As.warn(...t)},error(...t){As.error(...t)},debug(...t){}};async function Gi(t,e,n){try{const r=await fetch(`${e}/widget/bootstrap`,{method:"POST",body:JSON.stringify(n?{orgSlug:t,projSlug:n}:{orgSlug:t}),credentials:"omit",keepalive:!0});if(r.ok){const i=await r.json(),o=i.allowedUrls??(i.allowedUrl?[i.allowedUrl]:[]);return{ok:!0,token:i.token,excludePaths:i.excludePaths,allowedUrls:o,widgetLazyLoadMode:i.widgetLazyLoadMode,maintenance:i.maintenance}}return r.status===403?{ok:!1,error:"unauthorized"}:r.status===404?{ok:!1,error:"not_found"}:r.status===429?{ok:!1,error:"rate_limited",retryAfterSec:Number(r.headers.get("Retry-After"))||60}:{ok:!1,error:"network"}}catch{return{ok:!1,error:"network"}}}function fh(t,e){return e.some(n=>n==="/"?t==="/":t===n||t.startsWith(n+"/"))}function Ki(t,e){try{const n=new URL(t),r=new URL(e);if(n.origin!==r.origin)return!1;const i=r.pathname.replace(/\/$/,"");if(!i)return!0;const o=n.pathname.replace(/\/$/,"");return o===i||o.startsWith(i+"/")}catch{return!1}}function ph({orgSlug:t,projSlug:e,preToken:n,convexUrl:r,preAllowedUrls:i,preExcludedPaths:o,preMaintenance:a}){M(()=>{const u=r??"https://festive-mouse-978.eu-west-1.convex.cloud",d=u?Qi(u):void 0;if(!d||!t||(_s.value={orgSlug:t,projSlug:e,siteUrl:d},n))return;let m=!1;return(async()=>{const h=await Gi(t,d,e);if(!m)if(h.ok)Et.value=h.token,Vi.value=h.allowedUrls,Hi.value=h.excludePaths,Wi.value=h.maintenance??!1;else{const p=e?`project '${t}/${e}'`:`org '${t}'`;h.error==="unauthorized"?X.warn(`[JexityChat] Domain not authorized for ${p}. Check the widget's domain rules.`):h.error==="not_found"?X.error(`[JexityChat] No active widget config found for ${p}.`):h.error==="rate_limited"?X.error(`[JexityChat] Bootstrap rate-limited for ${p}. Retry after ${h.retryAfterSec??60}s.`):X.error(`[JexityChat] Bootstrap failed: ${h.error}`)}})(),()=>{m=!0}},[t,e,n,r]);const l=i?.join(`
3
- `)??"",c=o?.join(`
4
- `)??"";M(()=>{n&&(Vi.value=l?l.split(`
5
- `):[],Hi.value=c?c.split(`
6
- `):[],Wi.value=a??!1)},[n,l,c,a])}const Or=new Set;let Rs=!1;function mh(){if(Rs)return;Rs=!0;const t=history.pushState.bind(history),e=history.replaceState.bind(history);history.pushState=function(...n){t(...n),Or.forEach(r=>r())},history.replaceState=function(...n){e(...n),Or.forEach(r=>r())}}function gh(t){return Or.add(t),window.addEventListener("popstate",t),mh(),()=>{Or.delete(t),window.removeEventListener("popstate",t)}}function xh(){const t=mn(window.location.href);M(()=>gh(()=>{t.value=window.location.href}),[t]);const e=Vi.value,n=Hi.value,r=new URL(t.value).pathname,i=fh(r,n);return M(()=>{i?X.warn(`[JexityChat] Widget hidden — current path is in the exclude list: ${r}`):e.length>0&&!e.some(o=>Ki(t.value,o))&&X.warn(`[JexityChat] Widget hidden — current page does not match path rule. Allowed: ${e.join(", ")}`)},[t.value,e,n,i,r]),i?!1:e.length===0?!0:e.some(o=>Ki(t.value,o))}const Yi={title:"Assistant",statusOnline:"Online · Responds in seconds",inputPlaceholder:"Type a message…",aiThinking:"AI is responding…",sendAriaLabel:"Send message",attachFiles:"Attach files",attachmentUploading:"Uploading…",attachmentFailed:"Upload failed",attachmentRejected:"Only images (PNG, JPG, WebP) and PDFs up to 10 MB, 4 per message.",attachmentRateLimited:"Too many files at once. Try again in a few minutes.",attachmentNotAllowed:"Files can’t be sent in this chat right now.",attachmentGone:"A file is no longer available. Remove it and attach it again.",attachmentPrivacy:"Files go to the support team only.",attachmentUnavailable:"File no longer available",attachmentOpen:"Open {name}",attachmentLoadFailed:"Couldn’t load the files.",attachmentRetry:"Try again",voiceStart:"Start voice input",voiceStop:"Stop voice input",voiceListening:"Listening… speak now.",voiceProviderNote:"Your speech is transcribed by your browser’s provider (e.g. Google or Apple).",voiceErrorPermission:"Microphone access is blocked. Allow it in your browser settings.",voiceErrorNoMic:"No microphone found.",voiceErrorNetwork:"Voice input isn’t available in this browser right now. It works in Chrome, Edge and Safari. Please type instead.",voiceErrorLang:"Voice input isn’t available in this language.",removeAttachmentAriaLabel:"Remove {name}",openChatAriaLabel:"Open chat",closeChatAriaLabel:"Close chat",proactiveDismiss:"Dismiss",proactiveOpenAria:"Open chat",errorNetwork:"Network error. Please try again.",errorQuota:"Message limit reached. Please try again later.",errorRateLimited:"Too many messages. Try again in {seconds}s.",errorSessionNoToken:"Could not connect to chat. Check your connection and try again.",errorMaintenance:"Chat is paused for maintenance. Your message was not sent, but it is still in the box, so you can try again shortly.",errorSessionUnauthorized:"This chat is not authorised on this page. Please reload.",localeLabelDe:"DE",localeLabelEn:"EN",resumeConversation:"Resuming conversation…",startingConversation:"Starting conversation…",sessionNotFound:"Your previous session was not found. Starting a new conversation.",startNewConversation:"Start new conversation",chatWith:"Send us a message",homeStatusOnline:"Online",homeStatusOffline:"Offline",haveReferenceNumber:"Have a reference number?",referencePlaceholder:"e.g. JEX-A3B7C2",resume:"Resume",howCanWeHelp:"How can we help?",getInstantHelp:"Get instant help",submitTicket:"Submit a ticket",replyByEmail:"We'll reply by email",ticketSubmitted:"Ticket submitted",yourReferenceNumber:"Your reference number:",sentToEmailHint:"We've sent it to your email. Use this number to follow up.",done:"Done",submittingTicket:"Submitting your ticket…",yourName:"Your name",yourEmail:"Your email",submit:"Submit",back:"Go back",localePickerLabel:"Language",escalationFormTitle:"Leave your details",escalationSubtitle:"Our team will get back to you by email so you don’t have to wait here.",escalationOfflineSubtitle:"Our team is offline right now — leave your email and we’ll get back to you.",escalationNameLabel:"Your name",escalationEmailLabel:"Your email",escalationSubmit:"Send to team",escalationSubmitting:"Sending…",escalationSubmitted:"Request submitted",escalationConsent:"By submitting, you agree to our",escalationPrivacyLinkText:"Privacy Policy",escalationSkip:"Skip, I’ll wait here",escalationPromptTitle:"Talk to our team",escalationPromptSubtitle:"We can notify you by email when our team replies.",escalationPromptSubmit:"Leave details",escalationSubmitFailed:"Failed to submit. Please try again.",sessionNotFoundPrompt:"Session not found. Would you like to start a new conversation?",sessionLocked:"For your privacy, this conversation was closed after a period of inactivity. Enter your reference to resume, or start a new conversation.",sessionResolved:"This conversation has been resolved.",tryAgain:"Try again",goBack:"Go back",somethingWentWrong:"Something went wrong",fabLabel:"Chat with us",chatNoLongerAvailable:"This chat is no longer available.",talkToHuman:"Talk to human",talkToHumanAria:"Talk to a human agent",handoffPending:"Connecting you to a human agent…",handoffFailed:"Could not request a human agent. Try again.",handoffRateLimited:"You requested an agent recently. Please wait before trying again.",handoffAvailable:"An agent is available",handoffOffline:"No agent online — leave your details",handoffMaintenance:"Paused for maintenance. You can reach an agent again shortly.",resumeListLabel:"Continue conversation",resumeListTimestamp:"{minutes}m ago",pickUpWhereLeftOff:"Pick up where you left off",noticeAgentJoined:"{name} has joined the conversation.",noticeHumanRequested:"You requested to speak with a human agent.",noticeHumanRequestedForm:"You requested to speak with a human agent. Please share your contact details below.",noticeEscalationConfirmed:`Thank you {name}! A human agent will be available soon.
1
+ (function(){"use strict";var Dn,F,Sa,Ta,$t,Ca,Aa,Ra,Si,Sr,zn,Ea,Ti,Ci,Ai,Ia,Tr={},Cr=[],Tu=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,qn=Array.isArray;function dt(t,e){for(var n in e)t[n]=e[n];return t}function Ri(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function Ye(t,e,n){var r,i,o,a={};for(o in e)o=="key"?r=e[o]:o=="ref"?i=e[o]:a[o]=e[o];if(arguments.length>2&&(a.children=arguments.length>3?Dn.call(arguments,2):n),typeof t=="function"&&t.defaultProps!=null)for(o in t.defaultProps)a[o]===void 0&&(a[o]=t.defaultProps[o]);return Fn(t,a,r,i,null)}function Fn(t,e,n,r,i){var o={type:t,props:e,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++Sa,__i:-1,__u:0};return i==null&&F.vnode!=null&&F.vnode(o),o}function Cu(){return{current:null}}function ne(t){return t.children}function nt(t,e){this.props=t,this.context=e}function un(t,e){if(e==null)return t.__?un(t.__,t.__i+1):null;for(var n;e<t.__k.length;e++)if((n=t.__k[e])!=null&&n.__e!=null)return n.__e;return typeof t.type=="function"?un(t):null}function Au(t){if(t.__P&&t.__d){var e=t.__v,n=e.__e,r=[],i=[],o=dt({},e);o.__v=e.__v+1,F.vnode&&F.vnode(o),Ii(t.__P,o,e,t.__n,t.__P.namespaceURI,32&e.__u?[n]:null,r,n??un(e),!!(32&e.__u),i),o.__v=e.__v,o.__.__k[o.__i]=o,$a(r,o,i),e.__e=e.__=null,o.__e!=n&&Ma(o)}}function Ma(t){if((t=t.__)!=null&&t.__c!=null)return t.__e=t.__c.base=null,t.__k.some(function(e){if(e!=null&&e.__e!=null)return t.__e=t.__c.base=e.__e}),Ma(t)}function Ei(t){(!t.__d&&(t.__d=!0)&&$t.push(t)&&!Ar.__r++||Ca!=F.debounceRendering)&&((Ca=F.debounceRendering)||Aa)(Ar)}function Ar(){try{for(var t,e=1;$t.length;)$t.length>e&&$t.sort(Ra),t=$t.shift(),e=$t.length,Au(t)}finally{$t.length=Ar.__r=0}}function Pa(t,e,n,r,i,o,a,l,c,u,d){var m,f,p,x,v,k,w,b=r&&r.__k||Cr,I=e.length;for(c=Ru(n,e,b,c,I),m=0;m<I;m++)(p=n.__k[m])!=null&&(f=p.__i!=-1&&b[p.__i]||Tr,p.__i=m,k=Ii(t,p,f,i,o,a,l,c,u,d),x=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&Pi(f.ref,null,p),d.push(p.ref,p.__c||x,p)),v==null&&x!=null&&(v=x),(w=!!(4&p.__u))||f.__k===p.__k?(c=Na(p,c,t,w),w&&f.__e&&(f.__e=null)):typeof p.type=="function"&&k!==void 0?c=k:x&&(c=x.nextSibling),p.__u&=-7);return n.__e=v,c}function Ru(t,e,n,r,i){var o,a,l,c,u,d=n.length,m=d,f=0;for(t.__k=new Array(i),o=0;o<i;o++)(a=e[o])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=t.__k[o]=Fn(null,a,null,null,null):qn(a)?a=t.__k[o]=Fn(ne,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=t.__k[o]=Fn(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):t.__k[o]=a,c=o+f,a.__=t,a.__b=t.__b+1,l=null,(u=a.__i=Eu(a,n,c,m))!=-1&&(m--,(l=n[u])&&(l.__u|=2)),l==null||l.__v==null?(u==-1&&(i>d?f--:i<d&&f++),typeof a.type!="function"&&(a.__u|=4)):u!=c&&(u==c-1?f--:u==c+1?f++:(u>c?f--:f++,a.__u|=4))):t.__k[o]=null;if(m)for(o=0;o<d;o++)(l=n[o])!=null&&(2&l.__u)==0&&(l.__e==r&&(r=un(l)),za(l,l));return r}function Na(t,e,n,r){var i,o;if(typeof t.type=="function"){for(i=t.__k,o=0;i&&o<i.length;o++)i[o]&&(i[o].__=t,e=Na(i[o],e,n,r));return e}t.__e!=e&&(r&&(e&&t.type&&!e.parentNode&&(e=un(t)),n.insertBefore(t.__e,e||null)),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function ht(t,e){return e=e||[],t==null||typeof t=="boolean"||(qn(t)?t.some(function(n){ht(n,e)}):e.push(t)),e}function Eu(t,e,n,r){var i,o,a,l=t.key,c=t.type,u=e[n],d=u!=null&&(2&u.__u)==0;if(u===null&&l==null||d&&l==u.key&&c==u.type)return n;if(r>(d?1:0)){for(i=n-1,o=n+1;i>=0||o<e.length;)if((u=e[a=i>=0?i--:o++])!=null&&(2&u.__u)==0&&l==u.key&&c==u.type)return a}return-1}function Oa(t,e,n){e[0]=="-"?t.setProperty(e,n??""):t[e]=n==null?"":typeof n!="number"||Tu.test(e)?n:n+"px"}function Rr(t,e,n,r,i){var o,a;e:if(e=="style")if(typeof n=="string")t.style.cssText=n;else{if(typeof r=="string"&&(t.style.cssText=r=""),r)for(e in r)n&&e in n||Oa(t.style,e,"");if(n)for(e in n)r&&n[e]==r[e]||Oa(t.style,e,n[e])}else if(e[0]=="o"&&e[1]=="n")o=e!=(e=e.replace(Ea,"$1")),a=e.toLowerCase(),e=a in t||e=="onFocusOut"||e=="onFocusIn"?a.slice(2):e.slice(2),t.l||(t.l={}),t.l[e+o]=n,n?r?n[zn]=r[zn]:(n[zn]=Ti,t.addEventListener(e,o?Ai:Ci,o)):t.removeEventListener(e,o?Ai:Ci,o);else{if(i=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in t)try{t[e]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&e[4]!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&n==1?"":n))}}function La(t){return function(e){if(this.l){var n=this.l[e.type+t];if(e[Sr]==null)e[Sr]=Ti++;else if(e[Sr]<n[zn])return;return n(F.event?F.event(e):e)}}}function Ii(t,e,n,r,i,o,a,l,c,u){var d,m,f,p,x,v,k,w,b,I,C,E,T,M,P,le,B=e.type;if(e.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[l=e.__e=n.__e]),(d=F.__b)&&d(e);e:if(typeof B=="function"){m=a.length;try{if(b=e.props,I=B.prototype&&B.prototype.render,C=(d=B.contextType)&&r[d.__c],E=d?C?C.props.value:d.__:r,n.__c?w=(f=e.__c=n.__c).__=f.__E:(I?e.__c=f=new B(b,E):(e.__c=f=new nt(b,E),f.constructor=B,f.render=Mu),C&&C.sub(f),f.state||(f.state={}),f.__n=r,p=f.__d=!0,f.__h=[],f._sb=[]),I&&f.__s==null&&(f.__s=f.state),I&&B.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=dt({},f.__s)),dt(f.__s,B.getDerivedStateFromProps(b,f.__s))),x=f.props,v=f.state,f.__v=e,p)I&&B.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),I&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(I&&B.getDerivedStateFromProps==null&&b!==x&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(b,E),e.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(b,f.__s,E)===!1){e.__v!=n.__v&&(f.props=b,f.state=f.__s,f.__d=!1),e.__e=n.__e,e.__k=n.__k,e.__k.some(function(D){D&&(D.__=e)}),Cr.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&a.push(f);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(b,f.__s,E),I&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(x,v,k)})}if(f.context=E,f.props=b,f.__P=t,f.__e=!1,T=F.__r,M=0,I)f.state=f.__s,f.__d=!1,T&&T(e),d=f.render(f.props,f.state,f.context),Cr.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,T&&T(e),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++M<25);f.state=f.__s,f.getChildContext!=null&&(r=dt(dt({},r),f.getChildContext())),I&&!p&&f.getSnapshotBeforeUpdate!=null&&(k=f.getSnapshotBeforeUpdate(x,v)),P=d!=null&&d.type===ne&&d.key==null?Da(d.props.children):d,l=Pa(t,qn(P)?P:[P],e,n,r,i,o,a,l,c,u),f.base=e.__e,e.__u&=-161,f.__h.length&&a.push(f),w&&(f.__E=f.__=null)}catch(D){if(a.length=m,e.__v=null,c||o!=null)if(D.then){for(e.__u|=c?160:128;l&&l.nodeType==8&&l.nextSibling;)l=l.nextSibling;o!=null&&(o[o.indexOf(l)]=null),e.__e=l}else{if(o!=null)for(le=o.length;le--;)Ri(o[le]);Mi(e)}else e.__e=n.__e,!e.__k&&n.__k&&(e.__k=n.__k),D.then||Mi(e);F.__e(D,e,n)}}else o==null&&e.__v==n.__v?(e.__k=n.__k,e.__e=n.__e):l=e.__e=Iu(n.__e,e,n,r,i,o,a,c,u);return(d=F.diffed)&&d(e),128&e.__u?void 0:l}function Mi(t){t&&(t.__c&&(t.__c.__e=!0),t.__k&&t.__k.some(Mi))}function $a(t,e,n){for(var r=0;r<n.length;r++)Pi(n[r],n[++r],n[++r]);F.__c&&F.__c(e,t),t.some(function(i){try{t=i.__h,i.__h=[],t.some(function(o){o.call(i)})}catch(o){F.__e(o,i.__v)}})}function Da(t){return typeof t!="object"||t==null||t.__b>0?t:qn(t)?t.map(Da):t.constructor!==void 0?null:dt({},t)}function Iu(t,e,n,r,i,o,a,l,c){var u,d,m,f,p,x,v,k=n.props||Tr,w=e.props,b=e.type;if(b=="svg"?i="http://www.w3.org/2000/svg":b=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),o!=null){for(u=0;u<o.length;u++)if((p=o[u])&&"setAttribute"in p==!!b&&(b?p.localName==b:p.nodeType==3)){t=p,o[u]=null;break}}if(t==null){if(b==null)return document.createTextNode(w);t=document.createElementNS(i,b,w.is&&w),l&&(F.__m&&F.__m(e,o),l=!1),o=null}if(b==null)k===w||l&&t.data==w||(t.data=w);else{if(o=b=="textarea"&&w.defaultValue!=null?null:o&&Dn.call(t.childNodes),!l&&o!=null)for(k={},u=0;u<t.attributes.length;u++)k[(p=t.attributes[u]).name]=p.value;for(u in k)p=k[u],u=="dangerouslySetInnerHTML"?m=p:u=="children"||u in w||u=="value"&&"defaultValue"in w||u=="checked"&&"defaultChecked"in w||Rr(t,u,null,p,i);for(u in w)p=w[u],u=="children"?f=p:u=="dangerouslySetInnerHTML"?d=p:u=="value"?x=p:u=="checked"?v=p:l&&typeof p!="function"||k[u]===p||Rr(t,u,p,k[u],i);if(d)l||m&&(d.__html==m.__html||d.__html==t.innerHTML)||(t.innerHTML=d.__html),e.__k=[];else if(m&&(t.innerHTML=""),Pa(e.type=="template"?t.content:t,qn(f)?f:[f],e,n,r,b=="foreignObject"?"http://www.w3.org/1999/xhtml":i,o,a,o?o[0]:n.__k&&un(n,0),l,c),o!=null)for(u=o.length;u--;)Ri(o[u]);l&&b!="textarea"||(u="value",b=="progress"&&x==null?t.removeAttribute("value"):x!=null&&(x!==t[u]||b=="progress"&&!x||b=="option"&&x!=k[u])&&Rr(t,u,x,k[u],i),u="checked",v!=null&&v!=t[u]&&Rr(t,u,v,k[u],i))}return t}function Pi(t,e,n){try{if(typeof t=="function"){var r=typeof t.__u=="function";r&&t.__u(),r&&e==null||(t.__u=t(e))}else t.current=e}catch(i){F.__e(i,n)}}function za(t,e,n){var r,i;if(F.unmount&&F.unmount(t),(r=t.ref)&&(r.current&&r.current!=t.__e||Pi(r,null,e)),(r=t.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(o){F.__e(o,e)}r.base=r.__P=r.__n=null}if(r=t.__k)for(i=0;i<r.length;i++)r[i]&&za(r[i],e,n||typeof t.type!="function");n||Ri(t.__e),t.__c=t.__=t.__e=void 0}function Mu(t,e,n){return this.constructor(t,n)}function Gt(t,e,n){var r,i,o,a;e==document&&(e=document.documentElement),F.__&&F.__(t,e),i=(r=typeof n=="function")?null:n&&n.__k||e.__k,o=[],a=[],Ii(e,t=(!r&&n||e).__k=Ye(ne,null,[t]),i||Tr,Tr,e.namespaceURI,!r&&n?[n]:i?null:e.firstChild?Dn.call(e.childNodes):null,o,!r&&n?n:i?i.__e:e.firstChild,r,a),$a(o,t,a),t.props.children=null}function qa(t,e){Gt(t,e,qa)}function Pu(t,e,n){var r,i,o,a,l=dt({},t.props);for(o in t.type&&t.type.defaultProps&&(a=t.type.defaultProps),e)o=="key"?r=e[o]:o=="ref"?i=e[o]:l[o]=e[o]===void 0&&a!=null?a[o]:e[o];return arguments.length>2&&(l.children=arguments.length>3?Dn.call(arguments,2):n),Fn(t.type,l,r||t.key,i||t.ref,null)}function Nu(t){function e(n){var r,i;return this.getChildContext||(r=new Set,(i={})[e.__c]=this,this.getChildContext=function(){return i},this.componentWillUnmount=function(){r=null},this.shouldComponentUpdate=function(o){this.props.value!=o.value&&r.forEach(function(a){a.__e=!0,Ei(a)})},this.sub=function(o){r.add(o);var a=o.componentWillUnmount;o.componentWillUnmount=function(){r&&r.delete(o),a&&a.call(o)}}),n.children}return e.__c="__cC"+Ia++,e.__=t,e.Provider=e.__l=(e.Consumer=function(n,r){return n.children(r)}).contextType=e,e}Dn=Cr.slice,F={__e:function(t,e,n,r){for(var i,o,a;e=e.__;)if((i=e.__c)&&!i.__)try{if((o=i.constructor)&&o.getDerivedStateFromError!=null&&(i.setState(o.getDerivedStateFromError(t)),a=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(t,r||{}),a=i.__d),a)return i.__E=i}catch(l){t=l}throw t}},Sa=0,Ta=function(t){return t!=null&&t.constructor===void 0},nt.prototype.setState=function(t,e){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=dt({},this.state),typeof t=="function"&&(t=t(dt({},n),this.props)),t&&dt(n,t),t!=null&&this.__v&&(e&&this._sb.push(e),Ei(this))},nt.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),Ei(this))},nt.prototype.render=ne,$t=[],Aa=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Ra=function(t,e){return t.__v.__b-e.__v.__b},Ar.__r=0,Si=Math.random().toString(8),Sr="__d"+Si,zn="__a"+Si,Ea=/(PointerCapture)$|Capture$/i,Ti=0,Ci=La(!1),Ai=La(!0),Ia=0;var Ou=0;function s(t,e,n,r,i,o){e||(e={});var a,l,c=e;if("ref"in c)for(l in c={},e)l=="ref"?a=e[l]:c[l]=e[l];var u={type:t,props:c,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Ou,__i:-1,__u:0,__source:i,__self:o};if(typeof t=="function"&&(a=t.defaultProps))for(l in a)c[l]===void 0&&(c[l]=a[l]);return F.vnode&&F.vnode(u),u}var Dt,de,Ni,Fa,dn=0,Ba=[],me=F,Ua=me.__b,Va=me.__r,Ha=me.diffed,Wa=me.__c,Qa=me.unmount,Ga=me.__;function hn(t,e){me.__h&&me.__h(de,t,dn||e),dn=0;var n=de.__H||(de.__H={__:[],__h:[]});return t>=n.__.length&&n.__.push({}),n.__[t]}function $(t){return dn=1,We(ts,t)}function We(t,e,n){var r=hn(Dt++,2);if(r.t=t,!r.__c&&(r.__=[n?n(e):ts(void 0,e),function(l){var c=r.__N?r.__N[0]:r.__[0],u=r.t(c,l);c!==u&&(r.__N=[u,r.__[1]],r.__c.setState({}))}],r.__c=de,!de.__f)){var i=function(l,c,u){if(!r.__c.__H)return!0;var d=!1,m=r.__c.props!==l;if(r.__c.__H.__.some(function(p){if(p.__N){d=!0;var x=p.__[0];p.__=p.__N,p.__N=void 0,x!==p.__[0]&&(m=!0)}}),o){var f=o.call(this,l,c,u);return d?f||m:f}return!d||m};de.__f=!0;var o=de.shouldComponentUpdate,a=de.componentWillUpdate;de.componentWillUpdate=function(l,c,u){if(this.__e){var d=o;o=void 0,i(l,c,u),o=d}a&&a.call(this,l,c,u)},de.shouldComponentUpdate=i}return r.__N||r.__}function N(t,e){var n=hn(Dt++,3);!me.__s&&Li(n.__H,e)&&(n.__=t,n.u=e,de.__H.__h.push(n))}function fn(t,e){var n=hn(Dt++,4);!me.__s&&Li(n.__H,e)&&(n.__=t,n.u=e,de.__h.push(n))}function oe(t){return dn=5,_e(function(){return{current:t}},[])}function Ka(t,e,n){dn=6,fn(function(){if(typeof t=="function"){var r=t(e());return function(){t(null),r&&typeof r=="function"&&r()}}if(t)return t.current=e(),function(){return t.current=null}},n==null?n:n.concat(t))}function _e(t,e){var n=hn(Dt++,7);return Li(n.__H,e)&&(n.__=t(),n.__H=e,n.__h=t),n.__}function re(t,e){return dn=8,_e(function(){return t},e)}function Bn(t){var e=de.context[t.__c],n=hn(Dt++,9);return n.c=t,e?(n.__==null&&(n.__=!0,e.sub(de)),e.props.value):t.__}function Ya(t,e){me.useDebugValue&&me.useDebugValue(e?e(t):t)}function Ja(){var t=hn(Dt++,11);if(!t.__){for(var e=de.__v;e!==null&&!e.__m&&e.__!==null;)e=e.__;var n=e.__m||(e.__m=[0,0]);t.__="P"+n[0]+"-"+n[1]++}return t.__}function Xa(){for(var t;t=Ba.shift();){var e=t.__H;if(t.__P&&e)try{e.__h.some(Oi),e.__h.some(es),e.__h=[]}catch(n){e.__h=[],me.__e(n,t.__v)}}}me.__b=function(t){de=null,Ua&&Ua(t)},me.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),Ga&&Ga(t,e)},me.__r=function(t){Va&&Va(t),Dt=0;var e=(de=t.__c).__H;e&&(Ni===de?(e.__h=[],de.__h=[],e.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(e.__h.length&&Xa(),Dt=0)),Ni=de},me.diffed=function(t){Ha&&Ha(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(Ba.push(e)!==1&&Fa===me.requestAnimationFrame||((Fa=me.requestAnimationFrame)||Lu)(Xa)),e.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),Ni=de=null},me.__c=function(t,e){e.some(function(n){try{n.__h.some(Oi),n.__h=n.__h.filter(function(r){return!r.__||es(r)})}catch(r){e.some(function(i){i.__h&&(i.__h=[])}),e=[],me.__e(r,n.__v)}}),Wa&&Wa(t,e)},me.unmount=function(t){Qa&&Qa(t);var e,n=t.__c;n&&n.__H&&(n.__H.__.some(function(r){try{Oi(r)}catch(i){e=i}}),n.__H=void 0,e&&me.__e(e,n.__v))};var Za=typeof requestAnimationFrame=="function";function Lu(t){var e,n=function(){clearTimeout(r),Za&&cancelAnimationFrame(e),setTimeout(t)},r=setTimeout(n,35);Za&&(e=requestAnimationFrame(n))}function Oi(t){var e=de,n=t.__c;typeof n=="function"&&(t.__c=void 0,n()),de=e}function es(t){var e=de;t.__c=t.__(),de=e}function Li(t,e){return!t||t.length!==e.length||e.some(function(n,r){return n!==t[r]})}function ts(t,e){return typeof e=="function"?e(t):e}function ns(t,e){for(var n in e)t[n]=e[n];return t}function $i(t,e){for(var n in t)if(n!=="__source"&&!(n in e))return!0;for(var r in e)if(r!=="__source"&&t[r]!==e[r])return!0;return!1}function rs(t,e){var n=e(),r=$({t:{__:n,u:e}}),i=r[0].t,o=r[1];return fn(function(){i.__=n,i.u=e,Di(i)&&o({t:i})},[t,n,e]),N(function(){return Di(i)&&o({t:i}),t(function(){Di(i)&&o({t:i})})},[t]),n}function Di(t){try{return!((e=t.__)===(n=t.u())&&(e!==0||1/e==1/n)||e!=e&&n!=n)}catch{return!0}var e,n}function is(t){t()}function os(t){return t}function as(){return[!1,is]}var ss=fn;function zi(t,e){this.props=t,this.context=e}function $u(t,e){function n(i){var o=this.props.ref;return o!=i.ref&&o&&(typeof o=="function"?o(null):o.current=null),e?!e(this.props,i)||o!=i.ref:$i(this.props,i)}function r(i){return this.shouldComponentUpdate=n,Ye(t,i)}return r.displayName="Memo("+(t.displayName||t.name)+")",r.__f=r.prototype.isReactComponent=!0,r.type=t,r}(zi.prototype=new nt).isPureReactComponent=!0,zi.prototype.shouldComponentUpdate=function(t,e){return $i(this.props,t)||$i(this.state,e)};var ls=F.__b;F.__b=function(t){t.type&&t.type.__f&&t.ref&&(t.props.ref=t.ref,t.ref=null),ls&&ls(t)};var Du=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function zu(t){function e(n){var r=ns({},n);return delete r.ref,t(r,n.ref||null)}return e.$$typeof=Du,e.render=t,e.prototype.isReactComponent=e.__f=!0,e.displayName="ForwardRef("+(t.displayName||t.name)+")",e}var cs=function(t,e){return t==null?null:ht(ht(t).map(e))},qu={map:cs,forEach:cs,count:function(t){return t?ht(t).length:0},only:function(t){var e=ht(t);if(e.length!==1)throw"Children.only";return e[0]},toArray:ht},Fu=F.__e;F.__e=function(t,e,n,r){if(t.then){for(var i,o=e;o=o.__;)if((i=o.__c)&&i.__c)return e.__e==null&&(e.__e=n.__e,e.__k=n.__k),i.__c(t,e)}Fu(t,e,n,r)};var us=F.unmount;function ds(t,e,n){return t&&(t.__c&&t.__c.__H&&(t.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),t.__c.__H=null),(t=ns({},t)).__c!=null&&(t.__c.__P===n&&(t.__c.__P=e),t.__c.__e=!0,t.__c=null),t.__k=t.__k&&t.__k.map(function(r){return ds(r,e,n)})),t}function hs(t,e,n){return t&&n&&(t.__v=null,t.__k=t.__k&&t.__k.map(function(r){return hs(r,e,n)}),t.__c&&t.__c.__P===e&&(t.__e&&n.appendChild(t.__e),t.__c.__e=!0,t.__c.__P=n)),t}function Er(){this.__u=0,this.o=null,this.__b=null}function fs(t){var e=t.__&&t.__.__c;return e&&e.__a&&e.__a(t)}function Bu(t){var e,n,r,i=null;function o(a){if(e||(e=t()).then(function(l){l&&(i=l.default||l),r=!0},function(l){n=l,r=!0}),n)throw n;if(!r)throw e;return i?Ye(i,a):null}return o.displayName="Lazy",o.__f=!0,o}function Un(){this.i=null,this.l=null}F.unmount=function(t){var e=t.__c;e&&(e.__z=!0),e&&e.__R&&e.__R(),e&&32&t.__u&&(t.type=null),us&&us(t)},(Er.prototype=new nt).__c=function(t,e){var n=e.__c,r=this;r.o==null&&(r.o=[]),r.o.push(n);var i=fs(r.__v),o=!1,a=function(){o||r.__z||(o=!0,n.__R=null,i?i(c):c())};n.__R=a;var l=n.__P;n.__P=null;var c=function(){if(!--r.__u){if(r.state.__a){var u=r.state.__a;r.__v.__k[0]=hs(u,u.__c.__P,u.__c.__O)}var d;for(r.setState({__a:r.__b=null});d=r.o.pop();)d.__P=l,d.forceUpdate()}};r.__u++||32&e.__u||r.setState({__a:r.__b=r.__v.__k[0]}),t.then(a,a)},Er.prototype.componentWillUnmount=function(){this.o=[]},Er.prototype.render=function(t,e){var n=this.__v;if(!n.__m){for(var r=n;r.__;)r=r.__;r=r.__m||(r.__m=[0,0]),n.__m=[r[1]++,0]}if(this.__b){if(n.__k){var i=document.createElement("div"),o=n.__k[0].__c;n.__k[0]=ds(this.__b,i,o.__O=o.__P)}this.__b=null}var a=e.__a&&Ye(ne,null,t.fallback);return a&&(a.__u&=-33),[Ye(ne,null,e.__a?null:t.children),a]};var ps=function(t,e,n){if(++n[1]===n[0]&&t.l.delete(e),t.props.revealOrder&&(t.props.revealOrder[0]!=="t"||!t.l.size))for(n=t.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;t.i=n=n[2]}};function Uu(t){return this.getChildContext=function(){return t.context},t.children}function Vu(t){var e=this,n=t.v;if(e.componentWillUnmount=function(){Gt(null,e.h),e.h=null,e.v=null},e.v&&e.v!==n&&e.componentWillUnmount(),!e.h){for(var r=e.__v;r!==null&&!r.__m&&r.__!==null;)r=r.__;e.v=n,e.h={nodeType:1,parentNode:n,childNodes:[],__k:{__m:r.__m},contains:function(){return!0},namespaceURI:n.namespaceURI,insertBefore:function(i,o){this.childNodes.push(i),e.v.insertBefore(i,o)},removeChild:function(i){this.childNodes.splice(this.childNodes.indexOf(i)>>>1,1),e.v.removeChild(i)}}}Gt(Ye(Uu,{context:e.context},t.__v),e.h)}function Hu(t,e){var n=Ye(Vu,{__v:t,v:e});return n.containerInfo=e,n}(Un.prototype=new nt).__a=function(t){var e=this,n=fs(e.__v),r=e.l.get(t);return r[0]++,function(i){var o=function(){e.props.revealOrder?(r.push(i),ps(e,t,r)):i()};n?n(o):o()}},Un.prototype.render=function(t){this.i=null,this.l=new Map;var e=ht(t.children);t.revealOrder&&t.revealOrder[0]==="b"&&e.reverse();for(var n=e.length;n--;)this.l.set(e[n],this.i=[1,0,this.i]);return t.children},Un.prototype.componentDidUpdate=Un.prototype.componentDidMount=function(){var t=this;this.l.forEach(function(e,n){ps(t,n,e)})};var ms=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,Wu=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Qu=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Gu=/[A-Z0-9]/g,Ku=typeof document<"u",Yu=function(t){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(t)};function Ju(t,e,n){return e.__k==null&&(e.textContent=""),Gt(t,e),typeof n=="function"&&n(),t?t.__c:null}function Xu(t,e,n){return qa(t,e),typeof n=="function"&&n(),t?t.__c:null}nt.prototype.isReactComponent=!0,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(t){Object.defineProperty(nt.prototype,t,{configurable:!0,get:function(){return this["UNSAFE_"+t]},set:function(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})});var gs=F.event;F.event=function(t){return gs&&(t=gs(t)),t.persist=function(){},t.isPropagationStopped=function(){return this.cancelBubble},t.isDefaultPrevented=function(){return this.defaultPrevented},t.nativeEvent=t};var qi,Zu={configurable:!0,get:function(){return this.class}},xs=F.vnode;F.vnode=function(t){typeof t.type=="string"&&(function(e){var n=e.props,r=e.type,i={},o=r.indexOf("-")==-1;for(var a in n){var l=n[a];if(!(a==="value"&&"defaultValue"in n&&l==null||Ku&&a==="children"&&r==="noscript"||a==="class"||a==="className")){var c=a.toLowerCase();a==="defaultValue"&&"value"in n&&n.value==null?a="value":a==="download"&&l===!0?l="":c==="translate"&&l==="no"?l=!1:c[0]==="o"&&c[1]==="n"?c==="ondoubleclick"?a="ondblclick":c!=="onchange"||r!=="input"&&r!=="textarea"||Yu(n.type)?c==="onfocus"?a="onfocusin":c==="onblur"?a="onfocusout":Qu.test(a)&&(a=c):c=a="oninput":o&&Wu.test(a)?a=a.replace(Gu,"-$&").toLowerCase():l===null&&(l=void 0),c==="oninput"&&i[a=c]&&(a="oninputCapture"),i[a]=l}}r=="select"&&(i.multiple&&Array.isArray(i.value)&&(i.value=ht(n.children).forEach(function(u){u.props.selected=i.value.indexOf(u.props.value)!=-1})),i.defaultValue!=null&&(i.value=ht(n.children).forEach(function(u){u.props.selected=i.multiple?i.defaultValue.indexOf(u.props.value)!=-1:i.defaultValue==u.props.value}))),n.class&&!n.className?(i.class=n.class,Object.defineProperty(i,"className",Zu)):n.className&&(i.class=i.className=n.className),e.props=i})(t),t.$$typeof=ms,xs&&xs(t)};var bs=F.__r;F.__r=function(t){bs&&bs(t),qi=t.__c};var vs=F.diffed;F.diffed=function(t){vs&&vs(t);var e=t.props,n=t.__e;n!=null&&t.type==="textarea"&&"value"in e&&e.value!==n.value&&(n.value=e.value==null?"":e.value),qi=null};var ed={ReactCurrentDispatcher:{current:{readContext:function(t){return qi.__n[t.__c].props.value},useCallback:re,useContext:Bn,useDebugValue:Ya,useDeferredValue:os,useEffect:N,useId:Ja,useImperativeHandle:Ka,useInsertionEffect:ss,useLayoutEffect:fn,useMemo:_e,useReducer:We,useRef:oe,useState:$,useSyncExternalStore:rs,useTransition:as}}};function td(t){return Ye.bind(null,t)}function Ir(t){return!!t&&t.$$typeof===ms}function nd(t){return Ir(t)&&t.type===ne}function rd(t){return!!t&&typeof t.displayName=="string"&&t.displayName.indexOf("Memo(")==0}function id(t){return Ir(t)?Pu.apply(null,arguments):t}function od(t){return!!t.__k&&(Gt(null,t),!0)}function ad(t){return t&&(t.base||t.nodeType===1&&t)||null}for(var sd=function(t,e){return t(e)},ld=function(t,e){var n=F.debounceRendering;F.debounceRendering=function(i){return i()};var r=t(e);return F.debounceRendering=n,r},cd=Ir,Fi={useState:$,useId:Ja,useReducer:We,useEffect:N,useLayoutEffect:fn,useInsertionEffect:ss,useTransition:as,useDeferredValue:os,useSyncExternalStore:rs,startTransition:is,useRef:oe,useImperativeHandle:Ka,useMemo:_e,useCallback:re,useContext:Bn,useDebugValue:Ya,version:"18.3.1",Children:qu,render:Ju,hydrate:Xu,unmountComponentAtNode:od,createPortal:Hu,createElement:Ye,createContext:Nu,createFactory:td,cloneElement:id,createRef:Cu,Fragment:ne,isValidElement:Ir,isElement:cd,isFragment:nd,isMemo:rd,findDOMNode:ad,Component:nt,PureComponent:zi,memo:$u,forwardRef:zu,flushSync:ld,unstable_batchedUpdates:sd,StrictMode:ne,Suspense:Er,SuspenseList:Un,lazy:Bu,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:ed},ft=[],Je=[],ud=Uint8Array,Bi="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",pn=0,dd=Bi.length;pn<dd;++pn)ft[pn]=Bi[pn],Je[Bi.charCodeAt(pn)]=pn;Je[45]=62,Je[95]=63;function hd(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");n===-1&&(n=e);var r=n===e?0:4-n%4;return[n,r]}function fd(t,e,n){return(e+n)*3/4-n}function Vn(t){var e,n=hd(t),r=n[0],i=n[1],o=new ud(fd(t,r,i)),a=0,l=i>0?r-4:r,c;for(c=0;c<l;c+=4)e=Je[t.charCodeAt(c)]<<18|Je[t.charCodeAt(c+1)]<<12|Je[t.charCodeAt(c+2)]<<6|Je[t.charCodeAt(c+3)],o[a++]=e>>16&255,o[a++]=e>>8&255,o[a++]=e&255;return i===2&&(e=Je[t.charCodeAt(c)]<<2|Je[t.charCodeAt(c+1)]>>4,o[a++]=e&255),i===1&&(e=Je[t.charCodeAt(c)]<<10|Je[t.charCodeAt(c+1)]<<4|Je[t.charCodeAt(c+2)]>>2,o[a++]=e>>8&255,o[a++]=e&255),o}function pd(t){return ft[t>>18&63]+ft[t>>12&63]+ft[t>>6&63]+ft[t&63]}function md(t,e,n){for(var r,i=[],o=e;o<n;o+=3)r=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(t[o+2]&255),i.push(pd(r));return i.join("")}function Hn(t){for(var e,n=t.length,r=n%3,i=[],o=16383,a=0,l=n-r;a<l;a+=o)i.push(md(t,a,a+o>l?l:a+o));return r===1?(e=t[n-1],i.push(ft[e>>2]+ft[e<<4&63]+"==")):r===2&&(e=(t[n-2]<<8)+t[n-1],i.push(ft[e>>10]+ft[e>>4&63]+ft[e<<2&63]+"=")),i.join("")}function Ct(t){if(t===void 0)return{};if(!ys(t))throw new Error(`The arguments to a Convex function must be an object. Received: ${t}`);return t}function gd(t){if(typeof t>"u")throw new Error("Client created with undefined deployment address. If you used an environment variable, check that it's set.");if(typeof t!="string")throw new Error(`Invalid deployment address: found ${t}".`);if(!(t.startsWith("http:")||t.startsWith("https:")))throw new Error(`Invalid deployment address: Must start with "https://" or "http://". Found "${t}".`);try{new URL(t)}catch{throw new Error(`Invalid deployment address: "${t}" is not a valid URL. If you believe this URL is correct, use the \`skipConvexDeploymentUrlCheck\` option to bypass this.`)}if(t.endsWith(".convex.site"))throw new Error(`Invalid deployment address: "${t}" ends with .convex.site, which is used for HTTP Actions. Convex deployment URLs typically end with .convex.cloud? If you believe this URL is correct, use the \`skipConvexDeploymentUrlCheck\` option to bypass this.`)}function ys(t){const e=typeof t=="object",n=Object.getPrototypeOf(t),r=n===null||n===Object.prototype||n?.constructor?.name==="Object";return e&&r}const ws=!0,mn=BigInt("-9223372036854775808"),Ui=BigInt("9223372036854775807"),Vi=BigInt("0"),xd=BigInt("8"),bd=BigInt("256"),Hi="This commit timestamp is unresolved: its value is assigned when the mutation commits. Read the document after the mutation completes to get its value.";class ks{[Symbol.toPrimitive](e){if(e==="string")return this.toString();throw new Error(Hi)}valueOf(){throw new Error(Hi)}toJSON(){throw new Error(Hi)}toString(){return"[unresolved commit timestamp]"}}const vd=new ks;function _s(t){return Number.isNaN(t)||!Number.isFinite(t)||Object.is(t,-0)}function yd(t){t<Vi&&(t-=mn+mn);let e=t.toString(16);e.length%2===1&&(e="0"+e);const n=new Uint8Array(new ArrayBuffer(8));let r=0;for(const i of e.match(/.{2}/g).reverse())n.set([parseInt(i,16)],r++),t>>=xd;return Hn(n)}function wd(t){const e=Vn(t);if(e.byteLength!==8)throw new Error(`Received ${e.byteLength} bytes, expected 8 for $integer`);let n=Vi,r=Vi;for(const i of e)n+=BigInt(i)*bd**r,r++;return n>Ui&&(n+=mn+mn),n}function kd(t){if(t<mn||Ui<t)throw new Error(`BigInt ${t} does not fit into a 64-bit signed integer.`);const e=new ArrayBuffer(8);return new DataView(e).setBigInt64(0,t,!0),Hn(new Uint8Array(e))}function _d(t){const e=Vn(t);if(e.byteLength!==8)throw new Error(`Received ${e.byteLength} bytes, expected 8 for $integer`);return new DataView(e.buffer).getBigInt64(0,!0)}const jd=DataView.prototype.setBigInt64?kd:yd,Sd=DataView.prototype.getBigInt64?_d:wd,js=1024;function Ss(t){if(t.length>js)throw new Error(`Field name ${t} exceeds maximum field name length ${js}.`);if(t.startsWith("$"))throw new Error(`Field name ${t} starts with a '$', which is reserved.`);for(let e=0;e<t.length;e+=1){const n=t.charCodeAt(e);if(n<32||n>=127)throw new Error(`Field name ${t} has invalid character '${t[e]}': Field names can only contain non-control ASCII characters`)}}function gn(t){if(t===null||typeof t=="boolean"||typeof t=="number"||typeof t=="string")return t;if(Array.isArray(t))return t.map(r=>gn(r));if(typeof t!="object")throw new Error(`Unexpected type of ${t}`);const e=Object.entries(t);if(e.length===1){const r=e[0][0];if(r==="$bytes"){if(typeof t.$bytes!="string")throw new Error(`Malformed $bytes field on ${t}`);return Vn(t.$bytes).buffer}if(r==="$integer"){if(typeof t.$integer!="string")throw new Error(`Malformed $integer field on ${t}`);return Sd(t.$integer)}if(r==="$float"){if(typeof t.$float!="string")throw new Error(`Malformed $float field on ${t}`);const i=Vn(t.$float);if(i.byteLength!==8)throw new Error(`Received ${i.byteLength} bytes, expected 8 for $float`);const a=new DataView(i.buffer).getFloat64(0,ws);if(!_s(a))throw new Error(`Float ${a} should be encoded as a number`);return a}if(r==="$commitTs"){if(t.$commitTs!==null)throw new Error(`Malformed $commitTs field on ${t}`);return vd}if(r==="$set")throw new Error("Received a Set which is no longer supported as a Convex type.");if(r==="$map")throw new Error("Received a Map which is no longer supported as a Convex type.")}const n={};for(const[r,i]of Object.entries(t))Ss(r),n[r]=gn(i);return n}const Ts=16384;function Wn(t){const e=JSON.stringify(t,(n,r)=>r===void 0?"undefined":typeof r=="function"?"[Function]":typeof r=="symbol"?String(r):typeof r=="bigint"?`${r.toString()}n`:r);if(e.length>Ts){const n="[...truncated]";let r=Ts-n.length;const i=e.codePointAt(r-1);return i!==void 0&&i>65535&&(r-=1),e.substring(0,r)+n}return e}function Wi(t,e,n,r){if(t===void 0){const a=n&&` (present at path ${n} in original object ${Wn(e)})`;throw new Error(`undefined is not a valid Convex value${a}. To learn about Convex's supported types, see https://docs.convex.dev/using/types.`)}if(t===null)return t;if(typeof t=="bigint"){if(t<mn||Ui<t)throw new Error(`BigInt ${t} does not fit into a 64-bit signed integer.`);return{$integer:jd(t)}}if(typeof t=="number")if(_s(t)){const a=new ArrayBuffer(8);return new DataView(a).setFloat64(0,t,ws),{$float:Hn(new Uint8Array(a))}}else return t;if(typeof t=="boolean"||typeof t=="string")return t;if(t instanceof ArrayBuffer)return{$bytes:Hn(new Uint8Array(t))};if(t instanceof ks)return{$commitTs:null};if(Array.isArray(t))return t.map((a,l)=>Wi(a,e,n+`[${l}]`));if(t instanceof Set)throw new Error(Qi(n,"Set",[...t],e));if(t instanceof Map)throw new Error(Qi(n,"Map",[...t],e));if(!ys(t)){const a=t?.constructor?.name,l=a?`${a} `:"";throw new Error(Qi(n,l,t,e))}const i={},o=Object.entries(t);o.sort(([a,l],[c,u])=>a===c?0:a<c?-1:1);for(const[a,l]of o)l!==void 0&&(Ss(a),i[a]=Wi(l,e,n+`.${a}`));return i}function Qi(t,e,n,r){return t?`${e}${Wn(n)} is not a supported Convex type (present at path ${t} in original object ${Wn(r)}). To learn about Convex's supported types, see https://docs.convex.dev/using/types.`:`${e}${Wn(n)} is not a supported Convex type.`}function pt(t){return Wi(t,t,"")}var Td=Object.defineProperty,Cd=(t,e,n)=>e in t?Td(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Gi=(t,e,n)=>Cd(t,typeof e!="symbol"?e+"":e,n),Cs,As;const Ad=Symbol.for("ConvexError");class xn extends(As=Error,Cs=Ad,As){constructor(e){super(typeof e=="string"?e:Wn(e)),Gi(this,"name","ConvexError"),Gi(this,"data"),Gi(this,Cs,!0),this.data=e}}const Rs=()=>Array.from({length:4},()=>0);Rs(),Rs();const Es="1.47.0";var Rd=Object.defineProperty,Ed=(t,e,n)=>e in t?Rd(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Is=(t,e,n)=>Ed(t,typeof e!="symbol"?e+"":e,n);const Id="color:rgb(0, 145, 255)";function Ms(t){switch(t){case"query":return"Q";case"mutation":return"M";case"action":return"A";case"any":return"?"}}class Ps{constructor(e){Is(this,"_onLogLineFuncs"),Is(this,"_verbose"),this._onLogLineFuncs={},this._verbose=e.verbose}addLogLineListener(e){let n=Math.random().toString(36).substring(2,15);for(let r=0;r<10&&this._onLogLineFuncs[n]!==void 0;r++)n=Math.random().toString(36).substring(2,15);return this._onLogLineFuncs[n]=e,()=>{delete this._onLogLineFuncs[n]}}logVerbose(...e){if(this._verbose)for(const n of Object.values(this._onLogLineFuncs))n("debug",`${new Date().toISOString()}`,...e)}log(...e){for(const n of Object.values(this._onLogLineFuncs))n("info",...e)}warn(...e){for(const n of Object.values(this._onLogLineFuncs))n("warn",...e)}error(...e){for(const n of Object.values(this._onLogLineFuncs))n("error",...e)}}function Ns(t){const e=new Ps(t);return e.addLogLineListener((n,...r)=>{switch(n){case"debug":console.debug(...r);break;case"info":console.log(...r);break;case"warn":console.warn(...r);break;case"error":console.error(...r);break;default:console.log(...r)}}),e}function Os(t){return new Ps(t)}function Mr(t,e,n,r,i){const o=Ms(n);if(typeof i=="object"&&(i=`ConvexError ${JSON.stringify(i.errorData,null,2)}`),e==="info"){const a=i.match(/^\[.*?\] /);if(a===null){t.error(`[CONVEX ${o}(${r})] Could not parse console.log`);return}const l=i.slice(1,a[0].length-2),c=i.slice(a[0].length);t.log(`%c[CONVEX ${o}(${r})] [${l}]`,Id,c)}else t.error(`[CONVEX ${o}(${r})] ${i}`)}function Md(t,e){const n=`[CONVEX FATAL ERROR] ${e}`;return t.error(n),new Error(n)}function bn(t,e,n){return`[CONVEX ${Ms(t)}(${e})] ${n.errorMessage}
2
+ Called by client`}function Ki(t,e){return e.data=t.errorData,e}function Kt(t){const e=t.split(":");let n,r;return e.length===1?(n=e[0],r="default"):(n=e.slice(0,e.length-1).join(":"),r=e[e.length-1]),n.endsWith(".js")&&(n=n.slice(0,-3)),`${n}:${r}`}function Yt(t,e){return JSON.stringify({udfPath:Kt(t),args:pt(e)})}function Ls(t,e,n){const{initialNumItems:r,id:i}=n;return JSON.stringify({type:"paginated",udfPath:Kt(t),args:pt(e),options:pt({initialNumItems:r,id:i})})}var Pd=Object.defineProperty,Nd=(t,e,n)=>e in t?Pd(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,mt=(t,e,n)=>Nd(t,typeof e!="symbol"?e+"":e,n);class Od{constructor(){mt(this,"nextQueryId"),mt(this,"querySetVersion"),mt(this,"querySet"),mt(this,"queryIdToToken"),mt(this,"identityVersion"),mt(this,"auth"),mt(this,"outstandingQueriesOlderThanRestart"),mt(this,"outstandingAuthOlderThanRestart"),mt(this,"paused"),mt(this,"pendingQuerySetModifications"),this.nextQueryId=0,this.querySetVersion=0,this.identityVersion=0,this.querySet=new Map,this.queryIdToToken=new Map,this.outstandingQueriesOlderThanRestart=new Set,this.outstandingAuthOlderThanRestart=!1,this.paused=!1,this.pendingQuerySetModifications=new Map}hasSyncedPastLastReconnect(){return this.outstandingQueriesOlderThanRestart.size===0&&!this.outstandingAuthOlderThanRestart}markAuthCompletion(){this.outstandingAuthOlderThanRestart=!1}subscribe(e,n,r,i){const o=Kt(e),a=Yt(o,n),l=this.querySet.get(a);if(l!==void 0)return l.numSubscribers+=1,{queryToken:a,modification:null,unsubscribe:()=>this.removeSubscriber(a)};{const c=this.nextQueryId++,u={id:c,canonicalizedUdfPath:o,args:n,numSubscribers:1,journal:r,componentPath:i};this.querySet.set(a,u),this.queryIdToToken.set(c,a);const d=this.querySetVersion,m=this.querySetVersion+1,f={type:"Add",queryId:c,udfPath:o,args:[pt(n)],journal:r,componentPath:i};return this.paused?this.pendingQuerySetModifications.set(c,f):this.querySetVersion=m,{queryToken:a,modification:{type:"ModifyQuerySet",baseVersion:d,newVersion:m,modifications:[f]},unsubscribe:()=>this.removeSubscriber(a)}}}transition(e){for(const n of e.modifications)switch(n.type){case"QueryUpdated":case"QueryFailed":{this.outstandingQueriesOlderThanRestart.delete(n.queryId);const r=n.journal;if(r!==void 0){const i=this.queryIdToToken.get(n.queryId);i!==void 0&&(this.querySet.get(i).journal=r)}break}case"QueryRemoved":{this.outstandingQueriesOlderThanRestart.delete(n.queryId);break}default:throw new Error(`Invalid modification ${n.type}`)}}queryId(e,n){const r=Kt(e),i=Yt(r,n),o=this.querySet.get(i);return o!==void 0?o.id:null}isCurrentOrNewerAuthVersion(e){return e>=this.identityVersion}getAuth(){return this.auth}setAuth(e){this.auth={tokenType:"User",value:e};const n=this.identityVersion;return this.paused||(this.identityVersion=n+1),{type:"Authenticate",baseVersion:n,...this.auth}}setAdminAuth(e,n){const r={tokenType:"Admin",value:e,impersonating:n};this.auth=r;const i=this.identityVersion;return this.paused||(this.identityVersion=i+1),{type:"Authenticate",baseVersion:i,...r}}clearAuth(){this.auth=void 0,this.markAuthCompletion();const e=this.identityVersion;return this.paused||(this.identityVersion=e+1),{type:"Authenticate",tokenType:"None",baseVersion:e}}hasAuth(){return!!this.auth}isNewAuth(e){return this.auth?.value!==e}queryPath(e){const n=this.queryIdToToken.get(e);return n?this.querySet.get(n).canonicalizedUdfPath:null}queryArgs(e){const n=this.queryIdToToken.get(e);return n?this.querySet.get(n).args:null}queryToken(e){return this.queryIdToToken.get(e)??null}queryJournal(e){return this.querySet.get(e)?.journal}restart(){this.unpause(),this.outstandingQueriesOlderThanRestart.clear();const e=[];for(const i of this.querySet.values()){const o={type:"Add",queryId:i.id,udfPath:i.canonicalizedUdfPath,args:[pt(i.args)],journal:i.journal,componentPath:i.componentPath};e.push(o),this.outstandingQueriesOlderThanRestart.add(i.id)}this.querySetVersion=1;const n={type:"ModifyQuerySet",baseVersion:0,newVersion:1,modifications:e};if(!this.auth)return this.identityVersion=0,[n,void 0];this.outstandingAuthOlderThanRestart=!0;const r={type:"Authenticate",baseVersion:0,...this.auth};return this.identityVersion=1,[n,r]}pause(){this.paused=!0}resume(){const e=this.pendingQuerySetModifications.size>0?{type:"ModifyQuerySet",baseVersion:this.querySetVersion,newVersion:++this.querySetVersion,modifications:Array.from(this.pendingQuerySetModifications.values())}:void 0,n=this.auth!==void 0?{type:"Authenticate",baseVersion:this.identityVersion++,...this.auth}:void 0;return this.unpause(),[e,n]}unpause(){this.paused=!1,this.pendingQuerySetModifications.clear()}removeSubscriber(e){const n=this.querySet.get(e);if(n.numSubscribers>1)return n.numSubscribers-=1,null;{this.querySet.delete(e),this.queryIdToToken.delete(n.id),this.outstandingQueriesOlderThanRestart.delete(n.id);const r=this.querySetVersion,i=this.querySetVersion+1,o={type:"Remove",queryId:n.id};return this.paused?this.pendingQuerySetModifications.has(n.id)?this.pendingQuerySetModifications.delete(n.id):this.pendingQuerySetModifications.set(n.id,o):this.querySetVersion=i,{type:"ModifyQuerySet",baseVersion:r,newVersion:i,modifications:[o]}}}}var Ld=Object.defineProperty,$d=(t,e,n)=>e in t?Ld(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Pr=(t,e,n)=>$d(t,typeof e!="symbol"?e+"":e,n);class Dd{constructor(e,n){this.logger=e,this.markConnectionStateDirty=n,Pr(this,"inflightRequests"),Pr(this,"requestsOlderThanRestart"),Pr(this,"inflightMutationsCount",0),Pr(this,"inflightActionsCount",0),this.inflightRequests=new Map,this.requestsOlderThanRestart=new Set}request(e,n){const r=new Promise(i=>{const o=n?"Requested":"NotSent";this.inflightRequests.set(e.requestId,{message:e,status:{status:o,requestedAt:new Date,onResult:i}}),e.type==="Mutation"?this.inflightMutationsCount++:e.type==="Action"&&this.inflightActionsCount++});return this.markConnectionStateDirty(),r}onResponse(e){const n=this.inflightRequests.get(e.requestId);if(n===void 0||n.status.status==="Completed")return null;const r=n.message.type==="Mutation"?"mutation":"action",i=n.message.udfPath;for(const c of e.logLines)Mr(this.logger,"info",r,i,c);const o=n.status;let a,l;if(e.success)a={success:!0,logLines:e.logLines,value:gn(e.result)},l=()=>o.onResult(a);else{const c=e.result,{errorData:u}=e;Mr(this.logger,"error",r,i,c),a={success:!1,errorMessage:c,errorData:u!==void 0?gn(u):void 0,logLines:e.logLines},l=()=>o.onResult(a)}return e.type==="ActionResponse"||!e.success?(l(),this.inflightRequests.delete(e.requestId),this.requestsOlderThanRestart.delete(e.requestId),n.message.type==="Action"?this.inflightActionsCount--:n.message.type==="Mutation"&&this.inflightMutationsCount--,this.markConnectionStateDirty(),{requestId:e.requestId,result:a}):(n.status={status:"Completed",result:a,ts:e.ts,onResolve:l},null)}removeCompleted(e){const n=new Map;for(const[r,i]of this.inflightRequests.entries()){const o=i.status;o.status==="Completed"&&o.ts.lessThanOrEqual(e)&&(o.onResolve(),n.set(r,o.result),i.message.type==="Mutation"?this.inflightMutationsCount--:i.message.type==="Action"&&this.inflightActionsCount--,this.inflightRequests.delete(r),this.requestsOlderThanRestart.delete(r))}return n.size>0&&this.markConnectionStateDirty(),n}restart(){this.requestsOlderThanRestart=new Set(this.inflightRequests.keys());const e=[];for(const[n,r]of this.inflightRequests){if(r.status.status==="NotSent"){r.status.status="Requested",e.push(r.message);continue}if(r.message.type==="Mutation")e.push(r.message);else if(r.message.type==="Action"){if(this.inflightRequests.delete(n),this.requestsOlderThanRestart.delete(n),this.inflightActionsCount--,r.status.status==="Completed")throw new Error("Action should never be in 'Completed' state");r.status.onResult({success:!1,errorMessage:"Connection lost while action was in flight",logLines:[]})}}return this.markConnectionStateDirty(),e}resume(){const e=[];for(const[,n]of this.inflightRequests)if(n.status.status==="NotSent"){n.status.status="Requested",e.push(n.message);continue}return e}hasIncompleteRequests(){for(const e of this.inflightRequests.values())if(e.status.status==="Requested")return!0;return!1}hasInflightRequests(){return this.inflightRequests.size>0}hasSyncedPastLastReconnect(){return this.requestsOlderThanRestart.size===0}timeOfOldestInflightRequest(){if(this.inflightRequests.size===0)return null;let e=Date.now();for(const n of this.inflightRequests.values())n.status.status!=="Completed"&&n.status.requestedAt.getTime()<e&&(e=n.status.requestedAt.getTime());return new Date(e)}inflightMutations(){return this.inflightMutationsCount}inflightActions(){return this.inflightActionsCount}}const Qn=Symbol.for("functionName"),zd=Symbol.for("toReferencePath");function qd(t){return t[zd]??null}function Fd(t){return t.startsWith("function://")}function Bd(t){let e;if(typeof t=="string")Fd(t)?e={functionHandle:t}:e={name:t};else if(t[Qn])e={name:t[Qn]};else{const n=qd(t);if(!n)throw new Error(`${t} is not a functionReference`);e={reference:n}}return e}function Le(t){const e=Bd(t);if(e.name===void 0)throw e.functionHandle!==void 0?new Error(`Expected function reference like "api.file.func" or "internal.file.func", but received function handle ${e.functionHandle}`):e.reference!==void 0?new Error(`Expected function reference in the current component like "api.file.func" or "internal.file.func", but received reference ${e.reference}`):new Error(`Expected function reference like "api.file.func" or "internal.file.func", but received ${JSON.stringify(e)}`);if(typeof t=="string")return t;const n=t[Qn];if(!n)throw new Error(`${t} is not a functionReference`);return n}function Yi(t){return{[Qn]:t}}function $s(t=[]){const e={get(n,r){if(typeof r=="string"){const i=[...t,r];return $s(i)}else if(r===Qn){if(t.length<2){const a=["api",...t].join(".");throw new Error(`API path is expected to be of the form \`api.moduleName.functionName\`. Found: \`${a}\``)}const i=t.slice(0,-1).join("/"),o=t[t.length-1];return o==="default"?i:i+":"+o}else return r===Symbol.toStringTag?"FunctionReference":void 0}};return new Proxy({},e)}$s();var Ud=Object.defineProperty,Vd=(t,e,n)=>e in t?Ud(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Nr=(t,e,n)=>Vd(t,typeof e!="symbol"?e+"":e,n);class Gn{constructor(e){Nr(this,"queryResults"),Nr(this,"modifiedQueries"),this.queryResults=e,this.modifiedQueries=[]}getQuery(e,...n){const r=Ct(n[0]),i=Le(e),o=this.queryResults.get(Yt(i,r));if(o!==void 0)return Gn.queryValue(o.result)}getAllQueries(e){const n=[],r=Le(e);for(const i of this.queryResults.values())i.udfPath===Kt(r)&&n.push({args:i.args,value:Gn.queryValue(i.result)});return n}setQuery(e,n,r){const i=Ct(n),o=Le(e),a=Yt(o,i);let l;r===void 0?l=void 0:l={success:!0,value:r,logLines:[]};const c={udfPath:o,args:i,result:l};this.queryResults.set(a,c),this.modifiedQueries.push(a)}static queryValue(e){if(e!==void 0)return e.success?e.value:void 0}}class Hd{constructor(){Nr(this,"queryResults"),Nr(this,"optimisticUpdates"),this.queryResults=new Map,this.optimisticUpdates=[]}ingestQueryResultsFromServer(e,n){this.optimisticUpdates=this.optimisticUpdates.filter(a=>!n.has(a.mutationId));const r=this.queryResults;this.queryResults=new Map(e);const i=new Gn(this.queryResults);for(const a of this.optimisticUpdates)a.update(i);const o=[];for(const[a,l]of this.queryResults){const c=r.get(a);(c===void 0||c.result!==l.result)&&o.push(a)}return o}applyOptimisticUpdate(e,n){this.optimisticUpdates.push({update:e,mutationId:n});const r=new Gn(this.queryResults);return e(r),r.modifiedQueries}rawQueryResult(e){const n=this.queryResults.get(e);if(n!==void 0)return n.result}queryResult(e){const n=this.queryResults.get(e);if(n===void 0)return;const r=n.result;if(r!==void 0){if(r.success)return r.value;throw r.errorData!==void 0?Ki(r,new xn(bn("query",n.udfPath,r))):new Error(bn("query",n.udfPath,r))}}hasQueryResult(e){return this.queryResults.get(e)!==void 0}queryLogs(e){return this.queryResults.get(e)?.result?.logLines}}var Wd=Object.defineProperty,Qd=(t,e,n)=>e in t?Wd(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Ji=(t,e,n)=>Qd(t,typeof e!="symbol"?e+"":e,n);class De{constructor(e,n){Ji(this,"low"),Ji(this,"high"),Ji(this,"__isUnsignedLong__"),this.low=e|0,this.high=n|0,this.__isUnsignedLong__=!0}static isLong(e){return(e&&e.__isUnsignedLong__)===!0}static fromBytesLE(e){return new De(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24)}toBytesLE(){const e=this.high,n=this.low;return[n&255,n>>>8&255,n>>>16&255,n>>>24,e&255,e>>>8&255,e>>>16&255,e>>>24]}static fromNumber(e){return isNaN(e)||e<0?Ds:e>=Gd?Kd:new De(e%Kn|0,e/Kn|0)}toString(){return(BigInt(this.high)*BigInt(Kn)+BigInt(this.low)).toString()}equals(e){return De.isLong(e)||(e=De.fromValue(e)),this.high>>>31===1&&e.high>>>31===1?!1:this.high===e.high&&this.low===e.low}notEquals(e){return!this.equals(e)}comp(e){return De.isLong(e)||(e=De.fromValue(e)),this.equals(e)?0:e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1}lessThanOrEqual(e){return this.comp(e)<=0}static fromValue(e){return typeof e=="number"?De.fromNumber(e):new De(e.low,e.high)}}const Ds=new De(0,0),zs=65536,Kn=zs*zs,Gd=Kn*Kn,Kd=new De(-1,-1);var Yd=Object.defineProperty,Jd=(t,e,n)=>e in t?Yd(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Or=(t,e,n)=>Jd(t,typeof e!="symbol"?e+"":e,n);class qs{constructor(e,n){Or(this,"version"),Or(this,"remoteQuerySet"),Or(this,"queryPath"),Or(this,"logger"),this.version={querySet:0,ts:De.fromNumber(0),identity:0},this.remoteQuerySet=new Map,this.queryPath=e,this.logger=n}transition(e){const n=e.startVersion;if(this.version.querySet!==n.querySet||this.version.ts.notEquals(n.ts)||this.version.identity!==n.identity)throw new Error(`Invalid start version: ${n.ts.toString()}:${n.querySet}:${n.identity}, transitioning from ${this.version.ts.toString()}:${this.version.querySet}:${this.version.identity}`);for(const r of e.modifications)switch(r.type){case"QueryUpdated":{const i=this.queryPath(r.queryId);if(i)for(const a of r.logLines)Mr(this.logger,"info","query",i,a);const o=gn(r.value??null);this.remoteQuerySet.set(r.queryId,{success:!0,value:o,logLines:r.logLines});break}case"QueryFailed":{const i=this.queryPath(r.queryId);if(i)for(const a of r.logLines)Mr(this.logger,"info","query",i,a);const{errorData:o}=r;this.remoteQuerySet.set(r.queryId,{success:!1,errorMessage:r.errorMessage,errorData:o!==void 0?gn(o):void 0,logLines:r.logLines});break}case"QueryRemoved":{this.remoteQuerySet.delete(r.queryId);break}default:throw new Error(`Invalid modification ${r.type}`)}this.version=e.endVersion}remoteQueryResults(){return this.remoteQuerySet}timestamp(){return this.version.ts}}function Xi(t){const e=Vn(t);return De.fromBytesLE(Array.from(e))}function Xd(t){const e=new Uint8Array(t.toBytesLE());return Hn(e)}function Fs(t){switch(t.type){case"FatalError":case"AuthError":case"ActionResponse":case"TransitionChunk":case"Ping":return{...t};case"MutationResponse":return t.success?{...t,ts:Xi(t.ts)}:{...t};case"Transition":return{...t,startVersion:{...t.startVersion,ts:Xi(t.startVersion.ts)},endVersion:{...t.endVersion,ts:Xi(t.endVersion.ts)}}}}function Zd(t){switch(t.type){case"Authenticate":case"ModifyQuerySet":case"Mutation":case"Action":case"Event":return{...t};case"Connect":return t.maxObservedTimestamp!==void 0?{...t,maxObservedTimestamp:Xd(t.maxObservedTimestamp)}:{...t,maxObservedTimestamp:void 0}}}var eh=Object.defineProperty,th=(t,e,n)=>e in t?eh(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ye=(t,e,n)=>th(t,typeof e!="symbol"?e+"":e,n);const nh=1e3,rh=1001,ih=1005,oh=4040;let Lr;function vn(){return Lr===void 0&&(Lr=Date.now()),typeof performance>"u"||!performance.now?Date.now():Math.round(Lr+performance.now())}function Bs(){return`t=${Math.round((vn()-Lr)/100)/10}s`}const Us={InternalServerError:{timeout:1e3},SubscriptionsWorkerFullError:{timeout:3e3},TooManyConcurrentRequests:{timeout:3e3},CommitterFullError:{timeout:3e3},AwsTooManyRequestsException:{timeout:3e3},ExecuteFullError:{timeout:3e3},SystemTimeoutError:{timeout:3e3},ExpiredInQueue:{timeout:3e3},VectorIndexesUnavailable:{timeout:1e3},SearchIndexesUnavailable:{timeout:1e3},TableSummariesUnavailable:{timeout:1e3},VectorIndexTooLarge:{timeout:3e3},SearchIndexTooLarge:{timeout:3e3},TooManyWritesInTimePeriod:{timeout:3e3}};function ah(t){if(t===void 0)return"Unknown";for(const e of Object.keys(Us))if(t.startsWith(e))return e;return"Unknown"}class sh{constructor(e,n,r,i,o,a){this.markConnectionStateDirty=o,this.debug=a,ye(this,"socket"),ye(this,"connectionCount"),ye(this,"_hasEverConnected",!1),ye(this,"lastCloseReason"),ye(this,"transitionChunkBuffer",null),ye(this,"defaultInitialBackoff"),ye(this,"maxBackoff"),ye(this,"retries"),ye(this,"serverInactivityThreshold"),ye(this,"reconnectDueToServerInactivityTimeout"),ye(this,"scheduledReconnect",null),ye(this,"networkOnlineHandler",null),ye(this,"pendingNetworkRecoveryInfo",null),ye(this,"uri"),ye(this,"onOpen"),ye(this,"onResume"),ye(this,"onMessage"),ye(this,"webSocketConstructor"),ye(this,"logger"),ye(this,"onServerDisconnectError"),this.webSocketConstructor=r,this.socket={state:"disconnected"},this.connectionCount=0,this.lastCloseReason="InitialConnect",this.defaultInitialBackoff=1e3,this.maxBackoff=16e3,this.retries=0,this.serverInactivityThreshold=6e4,this.reconnectDueToServerInactivityTimeout=null,this.uri=e,this.onOpen=n.onOpen,this.onResume=n.onResume,this.onMessage=n.onMessage,this.onServerDisconnectError=n.onServerDisconnectError,this.logger=i,this.setupNetworkListener(),this.connect()}setSocketState(e){this.socket=e,this._logVerbose(`socket state changed: ${this.socket.state}, paused: ${"paused"in this.socket?this.socket.paused:void 0}`),this.markConnectionStateDirty()}setupNetworkListener(){typeof window>"u"||typeof window.addEventListener!="function"||this.networkOnlineHandler===null&&(this.networkOnlineHandler=()=>{this._logVerbose("network online event detected"),this.tryReconnectImmediately()},window.addEventListener("online",this.networkOnlineHandler),this._logVerbose("network online event listener registered"))}cleanupNetworkListener(){this.networkOnlineHandler&&typeof window<"u"&&typeof window.removeEventListener=="function"&&(window.removeEventListener("online",this.networkOnlineHandler),this.networkOnlineHandler=null,this._logVerbose("network online event listener removed"))}assembleTransition(e){if(e.partNumber<0||e.partNumber>=e.totalParts||e.totalParts===0||this.transitionChunkBuffer&&(this.transitionChunkBuffer.totalParts!==e.totalParts||this.transitionChunkBuffer.transitionId!==e.transitionId))throw this.transitionChunkBuffer=null,new Error("Invalid TransitionChunk");if(this.transitionChunkBuffer===null&&(this.transitionChunkBuffer={chunks:[],totalParts:e.totalParts,transitionId:e.transitionId}),e.partNumber!==this.transitionChunkBuffer.chunks.length){const n=this.transitionChunkBuffer.chunks.length;throw this.transitionChunkBuffer=null,new Error(`TransitionChunk received out of order: expected part ${n}, got ${e.partNumber}`)}if(this.transitionChunkBuffer.chunks.push(e.chunk),this.transitionChunkBuffer.chunks.length===e.totalParts){const n=this.transitionChunkBuffer.chunks.join("");this.transitionChunkBuffer=null;const r=Fs(JSON.parse(n));if(r.type!=="Transition")throw new Error(`Expected Transition, got ${r.type} after assembling chunks`);return r}return null}connect(){if(this.socket.state==="terminated")return;if(this.socket.state!=="disconnected"&&this.socket.state!=="stopped")throw new Error("Didn't start connection from disconnected state: "+this.socket.state);const e=new this.webSocketConstructor(this.uri);this._logVerbose("constructed WebSocket"),this.setSocketState({state:"connecting",ws:e,paused:"no"}),this.resetServerInactivityTimeout(),e.onopen=()=>{if(this.logger.logVerbose("begin ws.onopen"),this.socket.state!=="connecting")throw new Error("onopen called with socket not in connecting state");if(this.setSocketState({state:"ready",ws:e,paused:this.socket.paused==="yes"?"uninitialized":"no"}),this.resetServerInactivityTimeout(),this.socket.paused==="no"&&(this._hasEverConnected=!0,this.onOpen({connectionCount:this.connectionCount,lastCloseReason:this.lastCloseReason,clientTs:vn()})),this.lastCloseReason!=="InitialConnect"&&(this.lastCloseReason?this.logger.log("WebSocket reconnected at",Bs(),"after disconnect due to",this.lastCloseReason):this.logger.log("WebSocket reconnected at",Bs())),this.connectionCount+=1,this.lastCloseReason=null,this.pendingNetworkRecoveryInfo!==null){const{timeSavedMs:n}=this.pendingNetworkRecoveryInfo;this.pendingNetworkRecoveryInfo=null,this.sendMessage({type:"Event",eventType:"NetworkRecoveryReconnect",event:{timeSavedMs:n}}),this.logger.log(`Network recovery reconnect saved ~${Math.round(n/1e3)}s of waiting`)}},e.onerror=n=>{this.transitionChunkBuffer=null;const r=n.message;r&&this.logger.log(`WebSocket error message: ${r}`)},e.onmessage=n=>{this.resetServerInactivityTimeout();const r=n.data.length;let i=Fs(JSON.parse(n.data));if(this._logVerbose(`received ws message with type ${i.type}`),i.type==="Ping")return;if(i.type==="TransitionChunk"){const a=this.assembleTransition(i);if(!a)return;i=a,this._logVerbose(`assembled full ws message of type ${i.type}`)}this.transitionChunkBuffer!==null&&(this.transitionChunkBuffer=null,this.logger.log(`Received unexpected ${i.type} while buffering TransitionChunks`)),i.type==="Transition"&&this.reportLargeTransition({messageLength:r,transition:i}),this.onMessage(i).hasSyncedPastLastReconnect&&(this.retries=0,this.markConnectionStateDirty())},e.onclose=n=>{if(this._logVerbose("begin ws.onclose"),this.transitionChunkBuffer=null,this.lastCloseReason===null&&(this.lastCloseReason=n.reason||`closed with code ${n.code}`),n.code!==nh&&n.code!==rh&&n.code!==ih&&n.code!==oh){let i=`WebSocket closed with code ${n.code}`;n.reason&&(i+=`: ${n.reason}`),this.logger.log(i),this.onServerDisconnectError&&n.reason&&this.onServerDisconnectError(i)}const r=ah(n.reason);this.scheduleReconnect(r)}}socketState(){return this.socket.state}sendMessage(e){const n={type:e.type,...e.type==="Authenticate"&&e.tokenType==="User"?{value:`...${e.value.slice(-7)}`}:{}};if(this.socket.state==="ready"&&this.socket.paused==="no"){const r=Zd(e),i=JSON.stringify(r);let o=!1;try{this.socket.ws.send(i),o=!0}catch(a){this.logger.log(`Failed to send message on WebSocket, reconnecting: ${a}`),this.closeAndReconnect("FailedToSendMessage")}return this._logVerbose(`${o?"sent":"failed to send"} message with type ${e.type}: ${JSON.stringify(n)}`),!0}return this._logVerbose(`message not sent (socket state: ${this.socket.state}, paused: ${"paused"in this.socket?this.socket.paused:void 0}): ${JSON.stringify(n)}`),!1}resetServerInactivityTimeout(){this.socket.state!=="terminated"&&(this.reconnectDueToServerInactivityTimeout!==null&&(clearTimeout(this.reconnectDueToServerInactivityTimeout),this.reconnectDueToServerInactivityTimeout=null),this.reconnectDueToServerInactivityTimeout=setTimeout(()=>{this.closeAndReconnect("InactiveServer")},this.serverInactivityThreshold))}scheduleReconnect(e){this.scheduledReconnect&&(clearTimeout(this.scheduledReconnect.timeout),this.scheduledReconnect=null),this.socket={state:"disconnected"};const n=this.nextBackoff(e);this.markConnectionStateDirty(),this.logger.log(`Attempting reconnect in ${Math.round(n)}ms`);const r=vn(),i=setTimeout(()=>{this.scheduledReconnect?.timeout===i&&(this.scheduledReconnect=null,this.connect())},n);this.scheduledReconnect={timeout:i,scheduledAt:r,backoffMs:n}}closeAndReconnect(e){switch(this._logVerbose(`begin closeAndReconnect with reason ${e}`),this.socket.state){case"disconnected":case"terminated":case"stopped":return;case"connecting":case"ready":{this.lastCloseReason=e,this.close(),this.scheduleReconnect("client");return}default:this.socket}}close(){switch(this.transitionChunkBuffer=null,this.socket.state){case"disconnected":case"terminated":case"stopped":return Promise.resolve();case"connecting":{const e=this.socket.ws;return e.onmessage=n=>{this._logVerbose("Ignoring message received after close")},new Promise(n=>{e.onclose=()=>{this._logVerbose("Closed after connecting"),n()},e.onopen=()=>{this._logVerbose("Opened after connecting"),e.close()}})}case"ready":{this._logVerbose("ws.close called");const e=this.socket.ws;e.onmessage=r=>{this._logVerbose("Ignoring message received after close")};const n=new Promise(r=>{e.onclose=()=>{r()}});return e.close(),n}default:return this.socket,Promise.resolve()}}terminate(){switch(this.reconnectDueToServerInactivityTimeout&&clearTimeout(this.reconnectDueToServerInactivityTimeout),this.scheduledReconnect&&(clearTimeout(this.scheduledReconnect.timeout),this.scheduledReconnect=null),this.cleanupNetworkListener(),this.socket.state){case"terminated":case"stopped":case"disconnected":case"connecting":case"ready":{const e=this.close();return this.setSocketState({state:"terminated"}),e}default:throw this.socket,new Error(`Invalid websocket state: ${this.socket.state}`)}}stop(){switch(this.socket.state){case"terminated":return Promise.resolve();case"connecting":case"stopped":case"disconnected":case"ready":{this.cleanupNetworkListener();const e=this.close();return this.socket={state:"stopped"},e}default:return this.socket,Promise.resolve()}}tryRestart(){switch(this.socket.state){case"stopped":break;case"terminated":case"connecting":case"ready":case"disconnected":this.logger.logVerbose("Restart called without stopping first");return;default:this.socket}this.setupNetworkListener(),this.connect()}pause(){switch(this.socket.state){case"disconnected":case"stopped":case"terminated":return;case"connecting":case"ready":{this.socket={...this.socket,paused:"yes"};return}default:{this.socket;return}}}tryReconnectImmediately(){if(this._logVerbose("tryReconnectImmediately called"),this.socket.state!=="disconnected"){this._logVerbose(`tryReconnectImmediately called but socket state is ${this.socket.state}, no action taken`);return}let e=null;if(this.scheduledReconnect){const n=vn()-this.scheduledReconnect.scheduledAt;e=Math.max(0,this.scheduledReconnect.backoffMs-n),this._logVerbose(`would have waited ${Math.round(e)}ms more (backoff was ${Math.round(this.scheduledReconnect.backoffMs)}ms, elapsed ${Math.round(n)}ms)`),clearTimeout(this.scheduledReconnect.timeout),this.scheduledReconnect=null,this._logVerbose("canceled scheduled reconnect")}this.logger.log("Network recovery detected, reconnecting immediately"),this.pendingNetworkRecoveryInfo=e!==null?{timeSavedMs:e}:null,this.connect()}resume(){switch(this.socket.state){case"connecting":this.socket={...this.socket,paused:"no"};return;case"ready":this.socket.paused==="uninitialized"?(this.socket={...this.socket,paused:"no"},this._hasEverConnected=!0,this.onOpen({connectionCount:this.connectionCount,lastCloseReason:this.lastCloseReason,clientTs:vn()})):this.socket.paused==="yes"&&(this.socket={...this.socket,paused:"no"},this.onResume());return;case"terminated":case"stopped":case"disconnected":return;default:this.socket}this.connect()}connectionState(){return{isConnected:this.socket.state==="ready",hasEverConnected:this._hasEverConnected,connectionCount:this.connectionCount,connectionRetries:this.retries}}_logVerbose(e){this.logger.logVerbose(e)}nextBackoff(e){const r=(e==="client"?100:e==="Unknown"?this.defaultInitialBackoff:Us[e].timeout)*Math.pow(2,this.retries);this.retries+=1;const i=Math.min(r,this.maxBackoff),o=i*(Math.random()-.5);return i+o}reportLargeTransition({transition:e,messageLength:n}){if(e.clientClockSkew===void 0||e.serverTs===void 0)return;const r=vn()-e.clientClockSkew-e.serverTs/1e6,i=`${Math.round(r)}ms`,o=`${Math.round(n/1e4)/100}MB`,a=n/(r/1e3),l=`${Math.round(a/1e4)/100}MB per second`;this._logVerbose(`received ${o} transition in ${i} at ${l}`),n>2e7?this.logger.log(`received query results totaling more that 20MB (${o}) which will take a long time to download on slower connections`):r>2e4&&this.logger.log(`received query results totaling ${o} which took more than 20s to arrive (${i})`),this.debug&&this.sendMessage({type:"Event",eventType:"ClientReceivedTransition",event:{transitionTransitTime:r,messageLength:n}})}}function lh(){return ch()}function ch(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}class Yn extends Error{}Yn.prototype.name="InvalidTokenError";function uh(t){return decodeURIComponent(atob(t).replace(/(.)/g,(e,n)=>{let r=n.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r}))}function dh(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 uh(e)}catch{return atob(e)}}function Vs(t,e){if(typeof t!="string")throw new Yn("Invalid token specified: must be a string");e||(e={});const n=e.header===!0?0:1,r=t.split(".")[n];if(typeof r!="string")throw new Yn(`Invalid token specified: missing part #${n+1}`);let i;try{i=dh(r)}catch(o){throw new Yn(`Invalid token specified: invalid base64 for part #${n+1} (${o.message})`)}try{return JSON.parse(i)}catch(o){throw new Yn(`Invalid token specified: invalid json for part #${n+1} (${o.message})`)}}var hh=Object.defineProperty,fh=(t,e,n)=>e in t?hh(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ze=(t,e,n)=>fh(t,typeof e!="symbol"?e+"":e,n);const ph=480*60*60*1e3,Hs=2;class mh{constructor(e,n,r){ze(this,"authState",{state:"noAuth"}),ze(this,"configVersion",0),ze(this,"syncState"),ze(this,"authenticate"),ze(this,"stopSocket"),ze(this,"tryRestartSocket"),ze(this,"pauseSocket"),ze(this,"resumeSocket"),ze(this,"clearAuth"),ze(this,"logger"),ze(this,"refreshTokenLeewaySeconds"),ze(this,"initialAuthTokenReuse"),ze(this,"lastRefreshChange"),ze(this,"tokenConfirmationAttempts",0),this.syncState=e,this.authenticate=n.authenticate,this.stopSocket=n.stopSocket,this.tryRestartSocket=n.tryRestartSocket,this.pauseSocket=n.pauseSocket,this.resumeSocket=n.resumeSocket,this.clearAuth=n.clearAuth,this.logger=r.logger,this.refreshTokenLeewaySeconds=r.refreshTokenLeewaySeconds,this.initialAuthTokenReuse=r.initialAuthTokenReuse,this.lastRefreshChange=!1}notifyRefreshChange(e){this.authState.state!=="noAuth"&&this.authState.state!=="initialRefetch"&&this.authState.config.onRefreshChange&&this.lastRefreshChange!==e&&(this.lastRefreshChange=e,this.authState.config.onRefreshChange(e))}async setConfig(e,n,r){this.resetAuthState(),this._logVerbose("pausing WS for auth token fetch"),this.pauseSocket();const i=await this.fetchTokenAndGuardAgainstRace(e,{forceRefreshToken:!1});if(i.isFromOutdatedConfig)return;const o={fetchToken:e,onAuthChange:n,onRefreshChange:r};i.value?(this.setAuthState({state:"waitingForServerConfirmationOfCachedToken",config:o,hasRetried:!1}),this.authenticate(i.value)):(this.setAuthState({state:"initialRefetch",config:o}),await this.refetchToken()),this._logVerbose("resuming WS after auth token fetch"),this.resumeSocket()}onTransition(e){if(this.syncState.isCurrentOrNewerAuthVersion(e.endVersion.identity)&&!(e.endVersion.identity<=e.startVersion.identity)){if(this._logVerbose(`auth state is ${this.authState.state} when handling transition`),this.syncState.markAuthCompletion(),this.authState.state==="waitingForServerConfirmationOfCachedToken"){this._logVerbose("server confirmed auth token is valid");const n=this.syncState.getAuth()?.value;this.initialAuthTokenReuse&&n?this.scheduleTokenRefetch(n,e.clientClockSkew):this.refetchToken(),this.authState.config.onAuthChange(!0);return}this.authState.state==="waitingForServerConfirmationOfFreshToken"&&(this._logVerbose("server confirmed new auth token is valid"),this.notifyRefreshChange(!1),this.scheduleTokenRefetch(this.authState.token),this.tokenConfirmationAttempts=0,this.authState.hadAuth||this.authState.config.onAuthChange(!0))}}onAuthError(e){if(e.authUpdateAttempted===!1&&(this.authState.state==="waitingForServerConfirmationOfFreshToken"||this.authState.state==="waitingForServerConfirmationOfCachedToken")){this._logVerbose("ignoring non-auth token expired error");return}const{baseVersion:n}=e;if(!this.syncState.isCurrentOrNewerAuthVersion(n+1)){this._logVerbose("ignoring auth error for previous auth attempt");return}this.tryToReauthenticate(e)}async tryToReauthenticate(e){if(this._logVerbose(`attempting to reauthenticate: ${e.error}`),this.authState.state==="noAuth"||this.authState.state==="waitingForServerConfirmationOfFreshToken"&&this.tokenConfirmationAttempts>=Hs){this.logger.error(`Failed to authenticate: "${e.error}", check your server auth config`),this.syncState.hasAuth()&&this.syncState.clearAuth(),this.authState.state!=="noAuth"&&this.setAndReportAuthFailed(this.authState.config.onAuthChange);return}if(this.authState.state==="waitingForServerConfirmationOfFreshToken"&&(this.tokenConfirmationAttempts++,this._logVerbose(`retrying reauthentication, ${Hs-this.tokenConfirmationAttempts} attempts remaining`)),this.notifyRefreshChange(!0),await this.stopSocket(),this.authState.state==="noAuth")return;const n=await this.fetchTokenAndGuardAgainstRace(this.authState.config.fetchToken,{forceRefreshToken:!0});n.isFromOutdatedConfig||(n.value&&this.syncState.isNewAuth(n.value)?(this.authenticate(n.value),this.setAuthState({state:"waitingForServerConfirmationOfFreshToken",config:this.authState.config,token:n.value,hadAuth:this.authState.state==="notRefetching"||this.authState.state==="waitingForScheduledRefetch"})):(this._logVerbose("reauthentication failed, could not fetch a new token"),this.syncState.hasAuth()&&this.syncState.clearAuth(),this.setAndReportAuthFailed(this.authState.config.onAuthChange)),this.tryRestartSocket())}async refetchToken(){if(this.authState.state==="noAuth")return;this._logVerbose("refetching auth token");const e=await this.fetchTokenAndGuardAgainstRace(this.authState.config.fetchToken,{forceRefreshToken:!0});e.isFromOutdatedConfig||(e.value?this.syncState.isNewAuth(e.value)?(this.setAuthState({state:"waitingForServerConfirmationOfFreshToken",hadAuth:this.syncState.hasAuth(),token:e.value,config:this.authState.config}),this.authenticate(e.value)):this.setAuthState({state:"notRefetching",config:this.authState.config}):(this._logVerbose("refetching token failed"),this.syncState.hasAuth()&&this.clearAuth(),this.setAndReportAuthFailed(this.authState.config.onAuthChange)),this._logVerbose("restarting WS after auth token fetch (if currently stopped)"),this.tryRestartSocket())}scheduleTokenRefetch(e,n){if(this.authState.state==="noAuth")return;const r=this.decodeToken(e);if(!r){this.logger.error("Auth token is not a valid JWT, cannot refetch the token");return}const{iat:i,exp:o}=r;if(!i||!o){this.logger.error("Auth token does not have required fields, cannot refetch the token");return}const a=o-i;if(a<=2){this.logger.error("Auth token does not live long enough, cannot refetch the token");return}let l;if(n!==void 0){const d=(Date.now()-n)/1e3;l=o-d,l<=0&&(l=0)}else l=a;let c=Math.min(ph,(l-this.refreshTokenLeewaySeconds)*1e3);c<=0&&(this.logger.warn(`Refetching auth token immediately, configured leeway ${this.refreshTokenLeewaySeconds}s is larger than the token's lifetime ${l}s`),c=0);const u=setTimeout(()=>{this._logVerbose("running scheduled token refetch"),this.refetchToken()},c);this.setAuthState({state:"waitingForScheduledRefetch",refetchTokenTimeoutId:u,config:this.authState.config}),this._logVerbose(`scheduled preemptive auth token refetching in ${c}ms`)}async fetchTokenAndGuardAgainstRace(e,n){const r=++this.configVersion;this._logVerbose(`fetching token with config version ${r}`);const i=await e(n);return this.configVersion!==r?(this._logVerbose(`stale config version, expected ${r}, got ${this.configVersion}`),{isFromOutdatedConfig:!0}):{isFromOutdatedConfig:!1,value:i}}stop(){this.resetAuthState(),this.configVersion++,this._logVerbose(`config version bumped to ${this.configVersion}`)}setAndReportAuthFailed(e){e(!1),this.resetAuthState()}resetAuthState(){this.notifyRefreshChange(!1),this.setAuthState({state:"noAuth"})}setAuthState(e){const n=e.state==="waitingForServerConfirmationOfFreshToken"?{hadAuth:e.hadAuth,state:e.state,token:`...${e.token.slice(-7)}`}:{state:e.state};switch(this._logVerbose(`setting auth state to ${JSON.stringify(n)}`),e.state){case"waitingForScheduledRefetch":case"notRefetching":case"noAuth":this.tokenConfirmationAttempts=0;break}this.authState.state==="waitingForScheduledRefetch"&&clearTimeout(this.authState.refetchTokenTimeoutId),this.authState=e}decodeToken(e){try{return Vs(e)}catch(n){return this._logVerbose(`Error decoding token: ${n instanceof Error?n.message:"Unknown error"}`),null}}_logVerbose(e){this.logger.logVerbose(`${e} [v${this.configVersion}]`)}}const gh=["convexClientConstructed","convexWebSocketOpen","convexFirstMessageReceived"];function xh(t,e){const n={sessionId:e};typeof performance>"u"||!performance.mark||performance.mark(t,{detail:n})}function bh(t){let e=t.name.slice(6);return e=e.charAt(0).toLowerCase()+e.slice(1),{name:e,startTime:t.startTime}}function vh(t){if(typeof performance>"u"||!performance.getEntriesByName)return[];const e=[];for(const n of gh){const r=performance.getEntriesByName(n).filter(i=>i.entryType==="mark").filter(i=>i.detail.sessionId===t);e.push(...r)}return e.map(bh)}var yh=Object.defineProperty,wh=(t,e,n)=>e in t?yh(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,we=(t,e,n)=>wh(t,typeof e!="symbol"?e+"":e,n);class kh{constructor(e,n,r){if(we(this,"address"),we(this,"state"),we(this,"requestManager"),we(this,"webSocketManager"),we(this,"authenticationManager"),we(this,"remoteQuerySet"),we(this,"optimisticQueryResults"),we(this,"_transitionHandlerCounter",0),we(this,"_nextRequestId"),we(this,"_onTransitionFns",new Map),we(this,"_sessionId"),we(this,"firstMessageReceived",!1),we(this,"debug"),we(this,"logger"),we(this,"maxObservedTimestamp"),we(this,"connectionStateSubscribers",new Map),we(this,"nextConnectionStateSubscriberId",0),we(this,"_lastPublishedConnectionState"),we(this,"markConnectionStateDirty",()=>{Promise.resolve().then(()=>{const p=this.connectionState();if(JSON.stringify(p)!==JSON.stringify(this._lastPublishedConnectionState)){this._lastPublishedConnectionState=p;for(const x of this.connectionStateSubscribers.values())x(p)}})}),we(this,"mark",p=>{this.debug&&xh(p,this.sessionId)}),typeof e=="object")throw new Error("Passing a ClientConfig object is no longer supported. Pass the URL of the Convex deployment as a string directly.");r?.skipConvexDeploymentUrlCheck!==!0&&gd(e),r={...r};const i=r.authRefreshTokenLeewaySeconds??10;let o=r.webSocketConstructor;if(!o&&typeof WebSocket>"u")throw new Error("No WebSocket global variable defined! To use Convex in an environment without WebSocket try the HTTP client: https://docs.convex.dev/api/classes/browser.ConvexHttpClient");o=o||WebSocket,this.debug=r.reportDebugInfoToConvex??!1,this.address=e,this.logger=r.logger===!1?Os({verbose:r.verbose??!1}):r.logger!==!0&&r.logger?r.logger:Ns({verbose:r.verbose??!1});const a=e.search("://");if(a===-1)throw new Error("Provided address was not an absolute URL.");const l=e.substring(a+3),c=e.substring(0,a);let u;if(c==="http")u="ws";else if(c==="https")u="wss";else throw new Error(`Unknown parent protocol ${c}`);const d=`${u}://${l}/api/${Es}/sync`;this.state=new Od,this.remoteQuerySet=new qs(p=>this.state.queryPath(p),this.logger),this.requestManager=new Dd(this.logger,this.markConnectionStateDirty);const m=()=>{this.webSocketManager.pause(),this.state.pause()};this.authenticationManager=new mh(this.state,{authenticate:p=>{const x=this.state.setAuth(p);return this.webSocketManager.sendMessage(x),x.baseVersion},stopSocket:()=>this.webSocketManager.stop(),tryRestartSocket:()=>this.webSocketManager.tryRestart(),pauseSocket:m,resumeSocket:()=>this.webSocketManager.resume(),clearAuth:()=>{this.clearAuth()}},{logger:this.logger,refreshTokenLeewaySeconds:i,initialAuthTokenReuse:r.initialAuthTokenReuse??!1}),this.optimisticQueryResults=new Hd,this.addOnTransitionHandler(p=>{n(p.queries.map(x=>x.token))}),this._nextRequestId=0,this._sessionId=lh();const{unsavedChangesWarning:f}=r;if(typeof window>"u"||typeof window.addEventListener>"u"){if(f===!0)throw new Error("unsavedChangesWarning requested, but window.addEventListener not found! Remove {unsavedChangesWarning: true} from Convex client options.")}else f!==!1&&window.addEventListener("beforeunload",p=>{if(this.requestManager.hasIncompleteRequests()){p.preventDefault();const x="Are you sure you want to leave? Your changes may not be saved.";return(p||window.event).returnValue=x,x}});this.webSocketManager=new sh(d,{onOpen:p=>{this.mark("convexWebSocketOpen"),this.webSocketManager.sendMessage({...p,type:"Connect",sessionId:this._sessionId,maxObservedTimestamp:this.maxObservedTimestamp}),this.remoteQuerySet=new qs(k=>this.state.queryPath(k),this.logger);const[x,v]=this.state.restart();v&&this.webSocketManager.sendMessage(v),this.webSocketManager.sendMessage(x);for(const k of this.requestManager.restart())this.webSocketManager.sendMessage(k)},onResume:()=>{const[p,x]=this.state.resume();x&&this.webSocketManager.sendMessage(x),p&&this.webSocketManager.sendMessage(p);for(const v of this.requestManager.resume())this.webSocketManager.sendMessage(v)},onMessage:p=>{switch(this.firstMessageReceived||(this.firstMessageReceived=!0,this.mark("convexFirstMessageReceived"),this.reportMarks()),p.type){case"Transition":{this.observedTimestamp(p.endVersion.ts),this.authenticationManager.onTransition(p),this.remoteQuerySet.transition(p),this.state.transition(p);const x=this.requestManager.removeCompleted(this.remoteQuerySet.timestamp());this.notifyOnQueryResultChanges(x);break}case"MutationResponse":{p.success&&this.observedTimestamp(p.ts);const x=this.requestManager.onResponse(p);x!==null&&this.notifyOnQueryResultChanges(new Map([[x.requestId,x.result]]));break}case"ActionResponse":{this.requestManager.onResponse(p);break}case"AuthError":{this.authenticationManager.onAuthError(p);break}case"FatalError":{const x=Md(this.logger,p.error);throw this.webSocketManager.terminate(),x}}return{hasSyncedPastLastReconnect:this.hasSyncedPastLastReconnect()}},onServerDisconnectError:r.onServerDisconnectError},o,this.logger,this.markConnectionStateDirty,this.debug),this.mark("convexClientConstructed"),r.expectAuth&&m()}hasSyncedPastLastReconnect(){return this.requestManager.hasSyncedPastLastReconnect()&&this.state.hasSyncedPastLastReconnect()}observedTimestamp(e){(this.maxObservedTimestamp===void 0||this.maxObservedTimestamp.lessThanOrEqual(e))&&(this.maxObservedTimestamp=e)}getMaxObservedTimestamp(){return this.maxObservedTimestamp}notifyOnQueryResultChanges(e){const n=this.remoteQuerySet.remoteQueryResults(),r=new Map;for(const[o,a]of n){const l=this.state.queryToken(o);if(l!==null){const c={result:a,udfPath:this.state.queryPath(o),args:this.state.queryArgs(o)};r.set(l,c)}}const i=this.optimisticQueryResults.ingestQueryResultsFromServer(r,new Set(e.keys()));this.handleTransition({queries:i.map(o=>{const a=this.optimisticQueryResults.rawQueryResult(o);return{token:o,modification:{kind:"Updated",result:a}}}),reflectedMutations:Array.from(e).map(([o,a])=>({requestId:o,result:a})),timestamp:this.remoteQuerySet.timestamp()})}handleTransition(e){for(const n of this._onTransitionFns.values())n(e)}addOnTransitionHandler(e){const n=this._transitionHandlerCounter++;return this._onTransitionFns.set(n,e),()=>this._onTransitionFns.delete(n)}getCurrentAuthClaims(){const e=this.state.getAuth();let n={};if(e&&e.tokenType==="User")try{n=e?Vs(e.value):{}}catch{n={}}else return;return{token:e.value,decoded:n}}setAuth(e,n,r){this.authenticationManager.setConfig(e,n,r)}hasAuth(){return this.state.hasAuth()}setAdminAuth(e,n){const r=this.state.setAdminAuth(e,n);this.webSocketManager.sendMessage(r)}clearAuth(){const e=this.state.clearAuth();this.webSocketManager.sendMessage(e)}subscribe(e,n,r){const i=Ct(n),{modification:o,queryToken:a,unsubscribe:l}=this.state.subscribe(e,i,r?.journal,r?.componentPath);return o!==null&&this.webSocketManager.sendMessage(o),{queryToken:a,unsubscribe:()=>{const c=l();c&&this.webSocketManager.sendMessage(c)}}}localQueryResult(e,n){const r=Ct(n),i=Yt(e,r);return this.optimisticQueryResults.queryResult(i)}localQueryResultByToken(e){return this.optimisticQueryResults.queryResult(e)}hasLocalQueryResultByToken(e){return this.optimisticQueryResults.hasQueryResult(e)}localQueryLogs(e,n){const r=Ct(n),i=Yt(e,r);return this.optimisticQueryResults.queryLogs(i)}queryJournal(e,n){const r=Ct(n),i=Yt(e,r);return this.state.queryJournal(i)}connectionState(){const e=this.webSocketManager.connectionState();return{hasInflightRequests:this.requestManager.hasInflightRequests(),isWebSocketConnected:e.isConnected,hasEverConnected:e.hasEverConnected,connectionCount:e.connectionCount,connectionRetries:e.connectionRetries,timeOfOldestInflightRequest:this.requestManager.timeOfOldestInflightRequest(),inflightMutations:this.requestManager.inflightMutations(),inflightActions:this.requestManager.inflightActions()}}subscribeToConnectionState(e){const n=this.nextConnectionStateSubscriberId++;return this.connectionStateSubscribers.set(n,e),()=>{this.connectionStateSubscribers.delete(n)}}async mutation(e,n,r){const i=await this.mutationInternal(e,n,r);if(!i.success)throw i.errorData!==void 0?Ki(i,new xn(bn("mutation",e,i))):new Error(bn("mutation",e,i));return i.value}async mutationInternal(e,n,r,i){const{mutationPromise:o}=this.enqueueMutation(e,n,r,i);return o}enqueueMutation(e,n,r,i){const o=Ct(n);this.tryReportLongDisconnect();const a=this.nextRequestId;if(this._nextRequestId++,r!==void 0){const d=r.optimisticUpdate;if(d!==void 0){const m=x=>{d(x,o)instanceof Promise&&this.logger.warn("Optimistic update handler returned a Promise. Optimistic updates should be synchronous.")},p=this.optimisticQueryResults.applyOptimisticUpdate(m,a).map(x=>{const v=this.localQueryResultByToken(x);return{token:x,modification:{kind:"Updated",result:v===void 0?void 0:{success:!0,value:v,logLines:[]}}}});this.handleTransition({queries:p,reflectedMutations:[],timestamp:this.remoteQuerySet.timestamp()})}}const l={type:"Mutation",requestId:a,udfPath:e,componentPath:i,args:[pt(o)]},c=this.webSocketManager.sendMessage(l),u=this.requestManager.request(l,c);return{requestId:a,mutationPromise:u}}async action(e,n){const r=await this.actionInternal(e,n);if(!r.success)throw r.errorData!==void 0?Ki(r,new xn(bn("action",e,r))):new Error(bn("action",e,r));return r.value}async actionInternal(e,n,r){const i=Ct(n),o=this.nextRequestId;this._nextRequestId++,this.tryReportLongDisconnect();const a={type:"Action",requestId:o,udfPath:e,componentPath:r,args:[pt(i)]},l=this.webSocketManager.sendMessage(a);return this.requestManager.request(a,l)}async close(){return this.authenticationManager.stop(),this.webSocketManager.terminate()}get url(){return this.address}get nextRequestId(){return this._nextRequestId}get sessionId(){return this._sessionId}reportMarks(){if(this.debug){const e=vh(this.sessionId);this.webSocketManager.sendMessage({type:"Event",eventType:"ClientConnect",event:e})}}tryReportLongDisconnect(){if(!this.debug)return;const e=this.connectionState().timeOfOldestInflightRequest;if(e===null||Date.now()-e.getTime()<=60*1e3)return;const n=`${this.address}/api/debug_event`;fetch(n,{method:"POST",headers:{"Content-Type":"application/json","Convex-Client":`npm-${Es}`},body:JSON.stringify({event:"LongWebsocketDisconnect"})}).then(r=>{r.ok||this.logger.warn("Analytics request failed with response:",r.body)}).catch(r=>{this.logger.warn("Analytics response failed with error:",r)})}}function Zi(t){if(typeof t!="object"||t===null||!Array.isArray(t.page)||typeof t.isDone!="boolean"||typeof t.continueCursor!="string")throw new Error(`Not a valid paginated query result: ${t?.toString()}`);return t}var _h=Object.defineProperty,jh=(t,e,n)=>e in t?_h(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Ws=(t,e,n)=>jh(t,typeof e!="symbol"?e+"":e,n);class Sh{constructor(e,n){this.client=e,this.onTransition=n,Ws(this,"paginatedQuerySet",new Map),Ws(this,"lastTransitionTs"),this.lastTransitionTs=De.fromNumber(0),this.client.addOnTransitionHandler(r=>this.onBaseTransition(r))}subscribe(e,n,r){const i=Kt(e),o=Ls(i,n,r),a=()=>this.removePaginatedQuerySubscriber(o),l=this.paginatedQuerySet.get(o);return l?(l.numSubscribers+=1,{paginatedQueryToken:o,unsubscribe:a}):(this.paginatedQuerySet.set(o,{token:o,canonicalizedUdfPath:i,args:n,numSubscribers:1,options:{initialNumItems:r.initialNumItems},nextPageKey:0,pageKeys:[],pageKeyToQuery:new Map,ongoingSplits:new Map,skip:!1,id:r.id}),this.addPageToPaginatedQuery(o,null,r.initialNumItems),{paginatedQueryToken:o,unsubscribe:a})}localQueryResult(e,n,r){const i=Kt(e),o=Ls(i,n,r);return this.localQueryResultByToken(o)}localQueryResultByToken(e){const n=this.paginatedQuerySet.get(e);if(!n)return;const r=this.activePageQueryTokens(n);if(r.length===0)return{results:[],status:"LoadingFirstPage",loadMore:c=>this.loadMoreOfPaginatedQuery(e,c)};let i=[],o=!1,a=!1;for(const c of r){const u=this.client.localQueryResultByToken(c);if(u===void 0){o=!0,a=!1;continue}const d=Zi(u);i=i.concat(d.page),a=!!d.isDone}let l;return o?l=i.length===0?"LoadingFirstPage":"LoadingMore":a?l="Exhausted":l="CanLoadMore",{results:i,status:l,loadMore:c=>this.loadMoreOfPaginatedQuery(e,c)}}onBaseTransition(e){const n=e.queries.map(a=>a.token),r=this.queriesContainingTokens(n);let i=[];r.length>0&&(this.processPaginatedQuerySplits(r,a=>this.client.localQueryResultByToken(a)),i=r.map(a=>({token:a,modification:{kind:"Updated",result:this.localQueryResultByToken(a)}})));const o={...e,paginatedQueries:i};this.onTransition(o)}loadMoreOfPaginatedQuery(e,n){this.mustGetPaginatedQuery(e);const r=this.queryTokenForLastPageOfPaginatedQuery(e),i=this.client.localQueryResultByToken(r);if(!i)return!1;const o=Zi(i);if(o.isDone)return!1;this.addPageToPaginatedQuery(e,o.continueCursor,n);const a={timestamp:this.lastTransitionTs,reflectedMutations:[],queries:[],paginatedQueries:[{token:e,modification:{kind:"Updated",result:this.localQueryResultByToken(e)}}]};return this.onTransition(a),!0}queriesContainingTokens(e){if(e.length===0)return[];const n=[],r=new Set(e);for(const[i,o]of this.paginatedQuerySet)for(const a of this.allQueryTokens(o))if(r.has(a)){n.push(i);break}return n}processPaginatedQuerySplits(e,n){for(const r of e){const i=this.mustGetPaginatedQuery(r),{ongoingSplits:o,pageKeyToQuery:a,pageKeys:l}=i;for(const[c,[u,d]]of o)n(a.get(u).queryToken)!==void 0&&n(a.get(d).queryToken)!==void 0&&this.completePaginatedQuerySplit(i,c,u,d);for(const c of l){if(o.has(c))continue;const u=a.get(c);if(!u)throw new Error(`No page query for active pageKey ${c}`);const d=n(u.queryToken);if(!d)continue;const m=Zi(d);m.splitCursor&&(m.pageStatus==="SplitRecommended"||m.pageStatus==="SplitRequired"||m.page.length>i.options.initialNumItems*2)&&this.splitPaginatedQueryPage(i,c,u.cursor,m.splitCursor,m.continueCursor)}}}splitPaginatedQueryPage(e,n,r,i,o){const a=e.nextPageKey++,l=e.nextPageKey++,c={numItems:e.options.initialNumItems,id:e.id},u=this.client.subscribe(e.canonicalizedUdfPath,{...e.args,paginationOpts:{...c,cursor:r,endCursor:i}});e.pageKeyToQuery.set(a,{...u,cursor:r});const d=this.client.subscribe(e.canonicalizedUdfPath,{...e.args,paginationOpts:{...c,cursor:i,endCursor:o}});e.pageKeyToQuery.set(l,{...d,cursor:i}),e.ongoingSplits.set(n,[a,l])}addPageToPaginatedQuery(e,n,r){const i=this.mustGetPaginatedQuery(e),o=i.nextPageKey++,a={cursor:n,numItems:r,id:i.id},l={...i.args,paginationOpts:a},c=this.client.subscribe(i.canonicalizedUdfPath,l);return i.pageKeys.push(o),i.pageKeyToQuery.set(o,{...c,cursor:n}),c}removePaginatedQuerySubscriber(e){const n=this.paginatedQuerySet.get(e);if(n&&(n.numSubscribers-=1,!(n.numSubscribers>0))){for(const r of n.pageKeyToQuery.values())r.unsubscribe();this.paginatedQuerySet.delete(e)}}completePaginatedQuerySplit(e,n,r,i){const o=e.pageKeyToQuery.get(n);e.pageKeyToQuery.delete(n);const a=e.pageKeys.indexOf(n);e.pageKeys.splice(a,1,r,i),e.ongoingSplits.delete(n),o.unsubscribe()}activePageQueryTokens(e){return e.pageKeys.map(n=>e.pageKeyToQuery.get(n).queryToken)}allQueryTokens(e){return Array.from(e.pageKeyToQuery.values()).map(n=>n.queryToken)}queryTokenForLastPageOfPaginatedQuery(e){const n=this.mustGetPaginatedQuery(e),r=n.pageKeys[n.pageKeys.length-1];if(r===void 0)throw new Error(`No pages for paginated query ${e}`);return n.pageKeyToQuery.get(r).queryToken}mustGetPaginatedQuery(e){const n=this.paginatedQuerySet.get(e);if(!n)throw new Error("paginated query no longer exists for token "+e);return n}}function Th({getCurrentValue:t,subscribe:e}){const[n,r]=$(()=>({getCurrentValue:t,subscribe:e,value:t()}));let i=n.value;return(n.getCurrentValue!==t||n.subscribe!==e)&&(i=t(),r({getCurrentValue:t,subscribe:e,value:i})),N(()=>{let o=!1;const a=()=>{o||r(c=>{if(c.getCurrentValue!==t||c.subscribe!==e)return c;const u=t();return c.value===u?c:{...c,value:u}})},l=e(a);return a(),()=>{o=!0,l()}},[t,e]),i}var Ch=Object.defineProperty,Ah=(t,e,n)=>e in t?Ch(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,At=(t,e,n)=>Ah(t,typeof e!="symbol"?e+"":e,n);const Rh=5e3;if(typeof Fi>"u")throw new Error("Required dependency 'react' not found");function Qs(t,e,n){function r(i){return Nh(i),e.mutation(t,i,{optimisticUpdate:n})}return r.withOptimisticUpdate=function(o){if(n!==void 0)throw new Error(`Already specified optimistic update for mutation ${Le(t)}`);return Qs(t,e,o)},r}function Eh(t,e){return function(n){return e.action(t,n)}}class Ih{constructor(e,n){if(At(this,"address"),At(this,"cachedSync"),At(this,"cachedPaginatedQueryClient"),At(this,"listeners"),At(this,"options"),At(this,"closed",!1),At(this,"_logger"),At(this,"adminAuth"),At(this,"fakeUserIdentity"),e===void 0)throw new Error("No address provided to ConvexReactClient.\nIf trying to deploy to production, make sure to follow all the instructions found at https://docs.convex.dev/production/hosting/\nIf running locally, make sure to run `convex dev` and ensure the .env.local file is populated.");if(typeof e!="string")throw new Error(`ConvexReactClient requires a URL like 'https://happy-otter-123.convex.cloud', received something of type ${typeof e} instead.`);if(!e.includes("://"))throw new Error("Provided address was not an absolute URL.");this.address=e,this.listeners=new Map,this._logger=n?.logger===!1?Os({verbose:n?.verbose??!1}):n?.logger!==!0&&n?.logger?n.logger:Ns({verbose:n?.verbose??!1}),this.options={...n,logger:this._logger}}get url(){return this.address}get sync(){if(this.closed)throw new Error("ConvexReactClient has already been closed.");return this.cachedSync?this.cachedSync:(this.cachedSync=this.options.baseClient??new kh(this.address,()=>{},this.options),this.adminAuth&&this.cachedSync.setAdminAuth(this.adminAuth,this.fakeUserIdentity),this.cachedPaginatedQueryClient=new Sh(this.cachedSync,e=>this.handleTransition(e)),this.cachedSync)}get paginatedQueryClient(){if(this.sync,this.cachedPaginatedQueryClient)return this.cachedPaginatedQueryClient;throw new Error("Should already be instantiated")}setAuth(e,n,r){if(typeof e=="string")throw new Error("Passing a string to ConvexReactClient.setAuth is no longer supported, please upgrade to passing in an async function to handle reauthentication.");this.sync.setAuth(e,n??(()=>{}),r)}clearAuth(){this.sync.clearAuth()}setAdminAuth(e,n){if(this.adminAuth=e,this.fakeUserIdentity=n,this.closed)throw new Error("ConvexReactClient has already been closed.");this.cachedSync&&this.sync.setAdminAuth(e,n)}watchQuery(e,...n){const[r,i]=n,o=Le(e);return{onUpdate:a=>{const{queryToken:l,unsubscribe:c}=this.sync.subscribe(o,r,i),u=this.listeners.get(l);return u!==void 0?u.add(a):this.listeners.set(l,new Set([a])),()=>{if(this.closed)return;const d=this.listeners.get(l);d.delete(a),d.size===0&&this.listeners.delete(l),c()}},localQueryResult:()=>{if(this.cachedSync)return this.cachedSync.localQueryResult(o,r)},localQueryLogs:()=>{if(this.cachedSync)return this.cachedSync.localQueryLogs(o,r)},journal:()=>{if(this.cachedSync)return this.cachedSync.queryJournal(o,r)}}}prewarmQuery(e){const n=e.extendSubscriptionFor??Rh,i=this.watchQuery(e.query,e.args||{}).onUpdate(()=>{});setTimeout(i,n)}watchPaginatedQuery(e,n,r){const i=Le(e);return{onUpdate:o=>{const{paginatedQueryToken:a,unsubscribe:l}=this.paginatedQueryClient.subscribe(i,n||{},r),c=this.listeners.get(a);return c!==void 0?c.add(o):this.listeners.set(a,new Set([o])),()=>{if(this.closed)return;const u=this.listeners.get(a);u.delete(o),u.size===0&&this.listeners.delete(a),l()}},localQueryResult:()=>this.paginatedQueryClient.localQueryResult(i,n,r)}}mutation(e,...n){const[r,i]=n,o=Le(e);return this.sync.mutation(o,r,i)}action(e,...n){const r=Le(e);return this.sync.action(r,...n)}query(e,...n){const r=this.watchQuery(e,...n),i=r.localQueryResult();return i!==void 0?Promise.resolve(i):new Promise((o,a)=>{const l=r.onUpdate(()=>{l();try{o(r.localQueryResult())}catch(c){a(c)}})})}connectionState(){return this.sync.connectionState()}subscribeToConnectionState(e){return this.sync.subscribeToConnectionState(e)}get logger(){return this._logger}async close(){if(this.closed=!0,this.listeners=new Map,this.cachedPaginatedQueryClient&&(this.cachedPaginatedQueryClient=void 0),this.cachedSync){const e=this.cachedSync;this.cachedSync=void 0,await e.close()}}handleTransition(e){const n=e.queries.map(i=>i.token),r=e.paginatedQueries.map(i=>i.token);this.transition([...n,...r])}transition(e){for(const n of e){const r=this.listeners.get(n);if(r)for(const i of r)i()}}}const $r=Fi.createContext(void 0);function Mh(){return Bn($r)}const Ph=({client:t,children:e})=>Fi.createElement($r.Provider,{value:t},e);function gt(t,...e){const n=e[0]==="skip",r=e[0]==="skip"?{}:Ct(e[0]),i=typeof t=="string"?Yi(t):t,o=Le(i),a=_e(()=>n?{}:{query:{query:i,args:r}},[JSON.stringify(pt(r)),o,n]),c=Dh(a).query;if(c instanceof Error)throw c;return c}function xt(t){const e=typeof t=="string"?Yi(t):t,n=Bn($r);if(n===void 0)throw new Error("Could not find Convex client! `useMutation` must be used in the React component tree under `ConvexProvider`. Did you forget it? See https://docs.convex.dev/quick-start#set-up-convex-in-your-react-app");return _e(()=>Qs(e,n),[n,Le(e)])}function Jt(t){const e=Bn($r),n=typeof t=="string"?Yi(t):t;if(e===void 0)throw new Error("Could not find Convex client! `useAction` must be used in the React component tree under `ConvexProvider`. Did you forget it? See https://docs.convex.dev/quick-start#set-up-convex-in-your-react-app");return _e(()=>Eh(n,e),[e,Le(n)])}function Nh(t){if(typeof t=="object"&&t!==null&&"bubbles"in t&&"persist"in t&&"isDefaultPrevented"in t)throw new Error("Convex function called with SyntheticEvent object. Did you use a Convex function as an event handler directly? Event handlers like onClick receive an event object as their first argument. These SyntheticEvent objects are not valid Convex values. Try wrapping the function like `const handler = () => myMutation();` and using `handler` in the event handler.")}var Oh=Object.defineProperty,Lh=(t,e,n)=>e in t?Oh(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,eo=(t,e,n)=>Lh(t,typeof e!="symbol"?e+"":e,n);class $h{constructor(e){eo(this,"createWatch"),eo(this,"queries"),eo(this,"listeners"),this.createWatch=e,this.queries={},this.listeners=new Set}setQueries(e){for(const n of Object.keys(e)){const{query:r,args:i,paginationOptions:o}=e[n];if(Le(r),this.queries[n]===void 0)this.addQuery(n,r,i,o?{paginationOptions:o}:{});else{const a=this.queries[n];(Le(r)!==Le(a.query)||JSON.stringify(pt(i))!==JSON.stringify(pt(a.args))||JSON.stringify(o)!==JSON.stringify(a.paginationOptions))&&(this.removeQuery(n),this.addQuery(n,r,i,o?{paginationOptions:o}:{}))}}for(const n of Object.keys(this.queries))e[n]===void 0&&this.removeQuery(n)}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}getLocalResults(e){const n={};for(const r of Object.keys(e)){const{query:i,args:o}=e[r],a=e[r].paginationOptions;Le(i);const l=this.createWatch(i,o,a?{paginationOptions:a}:{});let c;try{c=l.localQueryResult()}catch(u){if(u instanceof Error)c=u;else throw u}n[r]=c}return n}setCreateWatch(e){this.createWatch=e;for(const n of Object.keys(this.queries)){const{query:r,args:i,watch:o,paginationOptions:a}=this.queries[n],l="journal"in o?o.journal():void 0;this.removeQuery(n),this.addQuery(n,r,i,{...l?{journal:l}:[],...a?{paginationOptions:a}:{}})}}destroy(){for(const e of Object.keys(this.queries))this.removeQuery(e);this.listeners=new Set}addQuery(e,n,r,{paginationOptions:i,journal:o}){if(this.queries[e]!==void 0)throw new Error(`Tried to add a new query with identifier ${e} when it already exists.`);const a=this.createWatch(n,r,{...o?{journal:o}:[],...i?{paginationOptions:i}:{}}),l=a.onUpdate(()=>this.notifyListeners());this.queries[e]={query:n,args:r,watch:a,unsubscribe:l,...i?{paginationOptions:i}:{}}}removeQuery(e){const n=this.queries[e];if(n===void 0)throw new Error(`No query found with identifier ${e}.`);n.unsubscribe(),delete this.queries[e]}notifyListeners(){for(const e of this.listeners)e()}}function Dh(t){const e=Mh();if(e===void 0)throw new Error("Could not find Convex client! `useQuery` must be used in the React component tree under `ConvexProvider`. Did you forget it? See https://docs.convex.dev/quick-start#set-up-convex-in-your-react-app");const n=_e(()=>(r,i,{journal:o,paginationOptions:a})=>a?e.watchPaginatedQuery(r,i,a):e.watchQuery(r,i,o?{journal:o}:{}),[e]);return zh(t,n)}function zh(t,e){const[n]=$(()=>new $h(e));n.createWatch!==e&&n.setCreateWatch(e),N(()=>()=>n.destroy(),[n]);const r=_e(()=>({getCurrentValue:()=>n.getLocalResults(t),subscribe:i=>(n.setQueries(t),n.subscribe(i))}),[n,t]);return Th(r)}var qh=Symbol.for("preact-signals");function Dr(){if(Rt>1)Rt--;else{var t,e=!1;for((function(){var i=Fr;for(Fr=void 0;i!==void 0;)i.S.v===i.v&&(i.S.i=i.i),i=i.o})();Jn!==void 0;){var n=Jn;for(Jn=void 0,qr++;n!==void 0;){var r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&Ks(n))try{n.c()}catch(i){e||(t=i,e=!0)}n=r}}if(qr=0,Rt--,e)throw t}}function Fh(t){if(Rt>0)return t();to=++Bh,Rt++;try{return t()}finally{Dr()}}var he=void 0;function zr(t){var e=he;he=void 0;try{return t()}finally{he=e}}var Jn=void 0,Rt=0,qr=0,Bh=0,to=0,Fr=void 0,Br=0;function Gs(t){if(he!==void 0){var e=t.n;if(e===void 0||e.t!==he)return e={i:0,S:t,p:he.s,n:void 0,t:he,e:void 0,x:void 0,r:e},he.s!==void 0&&(he.s.n=e),he.s=e,t.n=e,32&he.f&&t.S(e),e;if(e.i===-1)return e.i=0,e.n!==void 0&&(e.n.p=e.p,e.p!==void 0&&(e.p.n=e.n),e.p=he.s,e.n=void 0,he.s.n=e,he.s=e),e}}function Ce(t,e){this.v=t,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=e?.watched,this.Z=e?.unwatched,this.name=e?.name}Ce.prototype.brand=qh,Ce.prototype.h=function(){return!0},Ce.prototype.S=function(t){var e=this,n=this.t;n!==t&&t.e===void 0&&(t.x=n,this.t=t,n!==void 0?n.e=t:zr(function(){var r;(r=e.W)==null||r.call(e)}))},Ce.prototype.U=function(t){var e=this;if(this.t!==void 0){var n=t.e,r=t.x;n!==void 0&&(n.x=r,t.e=void 0),r!==void 0&&(r.e=n,t.x=void 0),t===this.t&&(this.t=r,r===void 0&&zr(function(){var i;(i=e.Z)==null||i.call(e)}))}},Ce.prototype.subscribe=function(t){var e=this;return Xn(function(){var n=e.value;zr(function(){return t(n)})},{name:"sub"})},Ce.prototype.valueOf=function(){return this.value},Ce.prototype.toString=function(){return this.value+""},Ce.prototype.toJSON=function(){return this.value},Ce.prototype.peek=function(){var t=this;return zr(function(){return t.value})},Object.defineProperty(Ce.prototype,"value",{get:function(){var t=Gs(this);return t!==void 0&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){if(qr>100)throw new Error("Cycle detected");(function(n){Rt!==0&&qr===0&&n.l!==to&&(n.l=to,Fr={S:n,v:n.v,i:n.i,o:Fr})})(this),this.v=t,this.i++,Br++,Rt++;try{for(var e=this.t;e!==void 0;e=e.x)e.t.N()}finally{Dr()}}}});function V(t,e){return new Ce(t,e)}function Ks(t){for(var e=t.s;e!==void 0;e=e.n)if(e.S.i!==e.i||!e.S.h()||e.S.i!==e.i)return!0;return!1}function Ys(t){for(var e=t.s;e!==void 0;e=e.n){var n=e.S.n;if(n!==void 0&&(e.r=n),e.S.n=e,e.i=-1,e.n===void 0){t.s=e;break}}}function Js(t){for(var e=t.s,n=void 0;e!==void 0;){var r=e.p;e.i===-1?(e.S.U(e),r!==void 0&&(r.n=e.n),e.n!==void 0&&(e.n.p=r)):n=e,e.S.n=e.r,e.r!==void 0&&(e.r=void 0),e=r}t.s=n}function Xt(t,e){Ce.call(this,void 0,e),this.x=t,this.s=void 0,this.g=Br-1,this.f=4}Xt.prototype=new Ce,Xt.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Br))return!0;if(this.g=Br,this.f|=1,this.i>0&&!Ks(this))return this.f&=-2,!0;var t=he;try{Ys(this),he=this;var e=this.x();(16&this.f||this.v!==e||this.i===0)&&(this.v=e,this.f&=-17,this.i++)}catch(n){this.v=n,this.f|=16,this.i++}return he=t,Js(this),this.f&=-2,!0},Xt.prototype.S=function(t){if(this.t===void 0){this.f|=36;for(var e=this.s;e!==void 0;e=e.n)e.S.S(e)}Ce.prototype.S.call(this,t)},Xt.prototype.U=function(t){if(this.t!==void 0&&(Ce.prototype.U.call(this,t),this.t===void 0)){this.f&=-33;for(var e=this.s;e!==void 0;e=e.n)e.S.U(e)}},Xt.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var t=this.t;t!==void 0;t=t.x)t.t.N()}},Object.defineProperty(Xt.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var t=Gs(this);if(this.h(),t!==void 0&&(t.i=this.i),16&this.f)throw this.v;return this.v}});function no(t,e){return new Xt(t,e)}function Xs(t){var e=t.m;if(t.m=void 0,typeof e=="function"){Rt++;var n=he;he=void 0;try{e()}catch(r){throw t.f&=-2,t.f|=8,ro(t),r}finally{he=n,Dr()}}}function ro(t){for(var e=t.s;e!==void 0;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,Xs(t)}function Uh(t){if(he!==this)throw new Error("Out-of-order effect");Js(this),he=t,this.f&=-2,8&this.f&&ro(this),Dr()}function yn(t,e){this.x=t,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=e?.name}yn.prototype.c=function(){var t=this.S();try{if(8&this.f||this.x===void 0)return;var e=this.x();typeof e=="function"&&(this.m=e)}finally{t()}},yn.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Xs(this),Ys(this),Rt++;var t=he;return he=this,Uh.bind(this,t)},yn.prototype.N=function(){2&this.f||(this.f|=2,this.u=Jn,Jn=this)},yn.prototype.d=function(){this.f|=8,1&this.f||ro(this)},yn.prototype.dispose=function(){this.d()};function Xn(t,e){var n=new yn(t,e);try{n.c()}catch(i){throw n.d(),i}var r=n.d.bind(n);return r[Symbol.dispose]=r,r}var Zs,Ur,Vh=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__,el=[];Xn(function(){Zs=this.N})();function wn(t,e){F[t]=e.bind(null,F[t]||function(){})}function Vr(t){if(Ur){var e=Ur;Ur=void 0,e()}Ur=t&&t.S()}function tl(t){var e=this,n=t.data,r=kn(n);r.value=n;var i=_e(function(){for(var l=e,c=e.__v;c=c.__;)if(c.__c){c.__c.__$f|=4;break}var u=no(function(){var p=r.value.value;return p===0?0:p===!0?"":p||""}),d=no(function(){return!Array.isArray(u.value)&&!Ta(u.value)}),m=Xn(function(){if(this.N=nl,d.value){var p=u.value;l.__v&&l.__v.__e&&l.__v.__e.nodeType===3&&(l.__v.__e.data=p)}}),f=e.__$u.d;return e.__$u.d=function(){m(),f.call(this)},[d,u]},[]),o=i[0],a=i[1];return o.value?a.peek():a.value}tl.displayName="ReactiveTextNode",Object.defineProperties(Ce.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:tl},props:{configurable:!0,get:function(){var t=this;return{data:{get value(){return t.value}}}}},__b:{configurable:!0,value:1}}),wn("__b",function(t,e){if(typeof e.type=="string"){var n,r=e.props;for(var i in r)if(i!=="children"){var o=r[i];o instanceof Ce&&(n||(e.__np=n={}),n[i]=o,r[i]=o.peek())}}t(e)}),wn("__r",function(t,e){if(t(e),e.type!==ne){Vr();var n,r=e.__c;r&&(r.__$f&=-2,(n=r.__$u)===void 0&&(r.__$u=n=(function(i,o){var a;return Xn(function(){a=this},{name:o}),a.c=i,a})(function(){var i;Vh&&((i=n.y)==null||i.call(n)),r.__$f|=1,r.setState({})},typeof e.type=="function"?e.type.displayName||e.type.name:""))),Vr(n)}}),wn("__e",function(t,e,n,r){Vr(),t(e,n,r)}),wn("diffed",function(t,e){Vr();var n;if(typeof e.type=="string"&&(n=e.__e)){var r=e.__np,i=e.props;if(r){var o=n.U;if(o)for(var a in o){var l=o[a];l!==void 0&&!(a in r)&&(l.d(),o[a]=void 0)}else o={},n.U=o;for(var c in r){var u=o[c],d=r[c];u===void 0?(u=Hh(n,c,d,i),o[c]=u):u.o(d,i)}}}t(e)});function Hh(t,e,n,r){var i=e in t&&t.ownerSVGElement===void 0,o=V(n);return{o:function(a,l){o.value=a,r=l},d:Xn(function(){this.N=nl;var a=o.value.value;r[e]!==a&&(r[e]=a,i?t[e]=a:a!=null&&(a!==!1||e[4]==="-")?t.setAttribute(e,a):t.removeAttribute(e))})}}wn("unmount",function(t,e){if(typeof e.type=="string"){var n=e.__e;if(n){var r=n.U;if(r){n.U=void 0;for(var i in r){var o=r[i];o&&o.d()}}}var a=e.__np;if(a){var l=e.props;for(var c in a)l[c]=a[c]}e.__np=void 0}else{var u=e.__c;if(u){var d=u.__$u;d&&(u.__$u=void 0,d.d())}}t(e)}),wn("__h",function(t,e,n,r){(r<3||r===9)&&(e.__$f|=2),t(e,n,r)}),nt.prototype.shouldComponentUpdate=function(t,e){if(this.__R)return!0;var n=this.__$u,r=n&&n.s!==void 0;for(var i in e)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var o=2&this.__$f;if(!(r||o||4&this.__$f)||1&this.__$f)return!0}else if(!(r||4&this.__$f)||3&this.__$f)return!0;for(var a in t)if(a!=="__source"&&t[a]!==this.props[a])return!0;for(var l in this.props)if(!(l in t))return!0;return!1};function kn(t,e){return _e(function(){return V(t,e)},[])}var Wh=function(t){queueMicrotask(function(){queueMicrotask(t)})};function Qh(){Fh(function(){for(var t;t=el.shift();)Zs.call(t)})}function nl(){el.push(this)===1&&(F.requestAnimationFrame||Wh)(Qh)}const fe=V(!1),Zn=V(null),Hr=V(void 0),er="https://jexitychat.de/datenschutz",tr=V(er),io=V("chip"),rl=V(!1),rt=V(void 0),Wr=V(null),oo=V([]),ao=V([]),il=V(null),so=V(void 0),lo=V(!1);BigInt("-9223372036854775808"),BigInt("9223372036854775807"),BigInt("0"),BigInt("8"),BigInt("256");const Gh=Symbol.for("functionName"),Kh=Symbol.for("toReferencePath");function ol(t=[]){const e={get(n,r){if(typeof r=="string"){const i=[...t,r];return ol(i)}else if(r===Gh){if(t.length<2){const a=["api",...t].join(".");throw new Error(`API path is expected to be of the form \`api.moduleName.functionName\`. Found: \`${a}\``)}const i=t.slice(0,-1).join("/"),o=t[t.length-1];return o==="default"?i:i+":"+o}else return r===Symbol.toStringTag?"FunctionReference":void 0}};return new Proxy({},e)}const Yh=ol();function al(t,e){const n={get(r,i){if(typeof i=="string"){const o=[...e,i];return al(t,o)}else if(i===Kh){if(e.length<1){const o=[t,...e].join(".");throw new Error(`API path is expected to be of the form \`${t}.childComponent.functionName\`. Found: \`${o}\``)}return"_reference/childComponent/"+e.join("/")}else return}};return new Proxy({},n)}const Jh=()=>al("components",[]),se=Yh;Jh();function sl(){return gt(se.maintenance.isFrozen,{})?.frozen??lo.value}function Xh(t){return t.replace(/\.convex\.site\b/,".convex.cloud")}function co(t){return t.replace(/\.convex\.cloud\b/,".convex.site")}function ll(t){return typeof t!="number"||!Number.isFinite(t)?24:Math.min(100,Math.max(0,t))}function Zh(t){const e=t?.trim();if(e)try{const n=new URL(e);if(n.protocol==="http:"||n.protocol==="https:")return e}catch{return}}const ef="Chatte mit uns";function tf(t){return t===void 0||t===ef?void 0:t}function nf(t,e){const n=t.title??e?.title??"Assistant",r=t.privacyPolicyMode??e?.privacyPolicyMode??"platform",i=rf(t.privacyNoticeStyle??e?.privacyNoticeStyle);return{title:n,botName:t.botName?.trim()||e?.botName?.trim()||n,greeting:t.greeting??e?.welcomeMessage??`Hi! I'm ${n}. How can I help?`,starterQuestions:t.starterQuestions??e?.starterQuestions??[],locale:t.locale??e?.locale,addressForm:t.addressForm??e?.addressForm??"informal",position:t.position??e?.position,colorScheme:t.colorScheme??e?.colorScheme,hideBranding:t.hideBranding??e?.hideBranding??!1,hidePersonButton:t.hidePersonButton??e?.hidePersonButton??!1,visitorChatDeletionOff:t.visitorChatDeletionOff??e?.visitorChatDeletionOff??!1,allowVisitorLocale:e?.allowVisitorLocale??!1,visitorAttachmentsEnabled:e?.visitorAttachmentsEnabled??!1,privacyPolicyMode:r,privacyPolicyUrl:r==="custom"?Zh(t.privacyPolicyUrl??e?.privacyPolicyUrl):void 0,privacyNoticeStyle:i,sessionTimeoutMs:of(e?.sessionTimeout),triggerIcon:t.triggerIcon??e?.triggerIcon??"chat",triggerRadius:t.triggerRadius??e?.triggerRadius??"full",triggerLabel:tf(t.triggerLabel??e?.triggerLabel),triggerOffsetX:ll(t.triggerOffsetX??e?.triggerOffsetX),triggerOffsetY:ll(t.triggerOffsetY??e?.triggerOffsetY),mode:t.mode??"floating",proactiveMode:e?.proactiveMode??"off",proactiveDelaySeconds:Math.min(15,Math.max(0,e?.proactiveDelaySeconds??5)),primaryColor:t.primaryColor??e?.primaryColor,accentColor:t.accentColor??e?.accentColor,fontFamily:t.fontFamily??e?.fontFamily,fontSize:t.fontSize??e?.fontSize,borderRadius:t.borderRadius??e?.borderRadius,windowWidth:t.windowWidth??e?.windowWidth,windowHeight:t.windowHeight??e?.windowHeight}}function rf(t){return t==="explicit"||t==="sheet"?"explicit":"chip"}function of(t){switch(t){case"never":return null;case"1h":return 3600*1e3;case"6h":return 360*60*1e3;case"7d":return 10080*60*1e3;case"24h":return 1440*60*1e3;case void 0:return 3600*1e3}}async function af({siteUrl:t,orgSlug:e,projSlug:n,signal:r}){const i=new URL(`${t}/widget/config`);i.searchParams.set("orgSlug",e),n&&i.searchParams.set("projSlug",n);const o=await fetch(i.toString(),{signal:r,keepalive:!0});return o.ok?o.json():null}function sf(t,e,n,r){const[i,o]=$(r!==void 0?{config:r,settled:!0}:{config:null,settled:!1});return N(()=>{if(r!==void 0)return;o({config:null,settled:!1});const a=n??"https://festive-mouse-978.eu-west-1.convex.cloud",l=a?co(a):void 0;if(!l||!t){o({config:null,settled:!0});return}const c=new AbortController;async function u(d){try{const m=await af({siteUrl:d,orgSlug:t,projSlug:e,signal:c.signal});c.signal.aborted||o({config:m,settled:!0})}catch(m){if(m instanceof Error&&m.name==="AbortError")return;c.signal.aborted||o({config:null,settled:!0})}}return u(l),()=>{c.abort()}},[t,e,n,r]),i}const cl=globalThis.console,J={warn(...t){cl.warn(...t)},error(...t){cl.error(...t)},debug(...t){}};function lf(t){return()=>t.getAttribute("data-user-token")}function nr(t){const e=t?.trim().split(".")[1];if(e)try{const n=JSON.parse(atob(e.replace(/-/g,"+").replace(/_/g,"/"))),r=typeof n=="object"&&n!==null?n.sub:void 0;return typeof r=="string"?r:void 0}catch{return}}function cf(t,e,n){return nr(t.getAttribute("data-user-token"))===e?n:void 0}function uf(t,e){let n=nr(t.getAttribute("data-user-token"));const r=new MutationObserver(()=>{const i=nr(t.getAttribute("data-user-token"));i!==n&&(n=i,e())});return r.observe(t,{attributes:!0,attributeFilter:["data-user-token"]}),()=>{r.disconnect()}}async function df(t){if(t===void 0)return{ok:!0,token:void 0};try{const n=(typeof t=="function"?await t():t)?.trim();return{ok:!0,token:n||void 0}}catch(e){return{ok:!1,detail:`userToken() failed: ${e instanceof Error?e.message:String(e)}`}}}async function uo({orgSlug:t,siteUrl:e,projSlug:n,userToken:r}){const i=await df(r);if(!i.ok)return{ok:!1,error:"signed_in_user",reason:"host_error",detail:i.detail};try{const o=await fetch(`${e}/widget/bootstrap`,{method:"POST",body:JSON.stringify({orgSlug:t,...n?{projSlug:n}:{},...i.token?{userToken:i.token}:{}}),credentials:"omit",keepalive:!0});if(o.ok){const a=await o.json(),l=a.allowedUrls??(a.allowedUrl?[a.allowedUrl]:[]);return{ok:!0,token:a.token,...i.token?{subject:nr(i.token)}:{},excludePaths:a.excludePaths,allowedUrls:l,widgetLazyLoadMode:a.widgetLazyLoadMode,maintenance:a.maintenance}}if(o.status===401){const a=await o.json().catch(()=>({}));return{ok:!1,error:"signed_in_user",reason:a.reason,detail:a.detail}}return o.status===403?{ok:!1,error:"unauthorized"}:o.status===404?{ok:!1,error:"not_found"}:o.status===429?{ok:!1,error:"rate_limited",retryAfterSec:Number(o.headers.get("Retry-After"))||60}:{ok:!1,error:"network"}}catch{return{ok:!1,error:"network"}}}function ho(t){return`[JexityChat] Signed-in user refused (${t.reason??"unknown"}): ${t.detail??"no detail"} The widget did not start. See the sign-in key settings in Widget Studio.`}function hf(t,e){return e.some(n=>n==="/"?t==="/":t===n||t.startsWith(n+"/"))}function fo(t,e){try{const n=new URL(t),r=new URL(e);if(n.origin!==r.origin)return!1;const i=r.pathname.replace(/\/$/,"");if(!i)return!0;const o=n.pathname.replace(/\/$/,"");return o===i||o.startsWith(i+"/")}catch{return!1}}function ff({orgSlug:t,projSlug:e,userToken:n,preToken:r,convexUrl:i,preAllowedUrls:o,preExcludedPaths:a,preMaintenance:l}){N(()=>{so.value=n},[n]),N(()=>{const d=i??"https://festive-mouse-978.eu-west-1.convex.cloud",m=d?co(d):void 0;if(!m||!t||(il.value={orgSlug:t,projSlug:e,siteUrl:m},r))return;let f=!1;return(async()=>{const p=await uo({orgSlug:t,siteUrl:m,projSlug:e,userToken:so.value});if(!f)if(p.ok)rt.value=p.token,Wr.value={sub:p.subject},oo.value=p.allowedUrls,ao.value=p.excludePaths,lo.value=p.maintenance??!1;else{const x=e?`project '${t}/${e}'`:`org '${t}'`;p.error==="unauthorized"?J.warn(`[JexityChat] Domain not authorized for ${x}. Check the widget's domain rules.`):p.error==="not_found"?J.error(`[JexityChat] No active widget config found for ${x}.`):p.error==="rate_limited"?J.error(`[JexityChat] Bootstrap rate-limited for ${x}. Retry after ${p.retryAfterSec??60}s.`):p.error==="signed_in_user"?J.error(ho(p)):J.error(`[JexityChat] Bootstrap failed: ${p.error}`)}})(),()=>{f=!0}},[t,e,r,i]);const c=o?.join(`
3
+ `)??"",u=a?.join(`
4
+ `)??"";N(()=>{r&&(oo.value=c?c.split(`
5
+ `):[],ao.value=u?u.split(`
6
+ `):[],lo.value=l??!1)},[r,c,u,l])}const Qr=new Set;let ul=!1;function pf(){if(ul)return;ul=!0;const t=history.pushState.bind(history),e=history.replaceState.bind(history);history.pushState=function(...n){t(...n),Qr.forEach(r=>r())},history.replaceState=function(...n){e(...n),Qr.forEach(r=>r())}}function mf(t){return Qr.add(t),window.addEventListener("popstate",t),pf(),()=>{Qr.delete(t),window.removeEventListener("popstate",t)}}function gf(){const t=kn(window.location.href);N(()=>mf(()=>{t.value=window.location.href}),[t]);const e=oo.value,n=ao.value,r=new URL(t.value).pathname,i=hf(r,n);return N(()=>{i?J.warn(`[JexityChat] Widget hidden — current path is in the exclude list: ${r}`):e.length>0&&!e.some(o=>fo(t.value,o))&&J.warn(`[JexityChat] Widget hidden — current page does not match path rule. Allowed: ${e.join(", ")}`)},[t.value,e,n,i,r]),i?!1:e.length===0?!0:e.some(o=>fo(t.value,o))}const po={title:"Assistant",statusOnline:"Online · Responds in seconds",inputPlaceholder:"Type a message…",aiThinking:"AI is responding…",sendAriaLabel:"Send message",attachFiles:"Attach files",attachmentUploading:"Uploading…",attachmentFailed:"Upload failed",attachmentRejected:"Only images (PNG, JPG, WebP) and PDFs up to 10 MB, 4 per message.",attachmentRateLimited:"Too many files at once. Try again in a few minutes.",attachmentNotAllowed:"Files can’t be sent in this chat right now.",attachmentGone:"A file is no longer available. Remove it and attach it again.",attachmentPrivacy:"Files go to the support team only.",attachmentUnavailable:"File no longer available",attachmentOpen:"Open {name}",attachmentLoadFailed:"Couldn’t load the files.",attachmentRetry:"Try again",voiceStart:"Start voice input",voiceStop:"Stop voice input",voiceListening:"Listening… speak now.",voiceProviderNote:"Your speech is transcribed by your browser’s provider (e.g. Google or Apple).",voiceErrorPermission:"Microphone access is blocked. Allow it in your browser settings.",voiceErrorNoMic:"No microphone found.",voiceErrorNetwork:"Voice input isn’t available in this browser right now. It works in Chrome, Edge and Safari. Please type instead.",voiceErrorLang:"Voice input isn’t available in this language.",removeAttachmentAriaLabel:"Remove {name}",openChatAriaLabel:"Open chat",closeChatAriaLabel:"Close chat",proactiveDismiss:"Dismiss",proactiveOpenAria:"Open chat",errorNetwork:"Network error. Please try again.",errorQuota:"Message limit reached. Please try again later.",errorRateLimited:"Too many messages. Try again in {seconds}s.",errorSessionNoToken:"Could not connect to chat. Check your connection and try again.",errorMaintenance:"Chat is paused for maintenance. Your message was not sent, but it is still in the box, so you can try again shortly.",errorSessionUnauthorized:"This chat is not authorised on this page. Please reload.",errorSessionSignedOut:"Your sign-in has expired. Reload the page to keep chatting.",errorSessionUnavailable:"The chat is not available right now. Please try again later.",localeLabelDe:"DE",localeLabelEn:"EN",resumeConversation:"Resuming conversation…",startingConversation:"Starting conversation…",sessionNotFound:"Your previous session was not found. Starting a new conversation.",startNewConversation:"Start new conversation",chatWith:"Send us a message",homeStatusOnline:"Online",homeStatusOffline:"Offline",haveReferenceNumber:"Have a reference number?",referencePlaceholder:"e.g. JEX-A3B7C2K9M4QX",resume:"Resume",howCanWeHelp:"How can we help?",getInstantHelp:"Get instant help",submitTicket:"Submit a ticket",replyByEmail:"We'll reply by email",ticketSubmitted:"Ticket submitted",yourReferenceNumber:"Your reference number:",sentToEmailHint:"We've sent it to your email. Use this number to follow up.",done:"Done",submittingTicket:"Submitting your ticket…",yourName:"Your name",yourEmail:"Your email",submit:"Submit",back:"Go back",localePickerLabel:"Language",escalationFormTitle:"Leave your details",escalationSubtitle:"Our team will get back to you by email so you don’t have to wait here.",escalationOfflineSubtitle:"Our team is offline right now — leave your email and we’ll get back to you.",escalationNameLabel:"Your name",escalationEmailLabel:"Your email",escalationSubmit:"Send to team",escalationSubmitting:"Sending…",escalationSubmitted:"Request submitted",escalationFromAccount:"Filled in from your account.",escalationConsent:"By submitting, you agree to our",escalationPrivacyLinkText:"Privacy Policy",escalationSkip:"Skip, I’ll wait here",escalationPromptTitle:"Talk to our team",escalationPromptSubtitle:"We can notify you by email when our team replies.",escalationPromptSubmit:"Leave details",escalationSubmitFailed:"Failed to submit. Please try again.",sessionNotFoundPrompt:"Session not found. Would you like to start a new conversation?",sessionLocked:"For your privacy, this conversation was closed after a period of inactivity. Enter your reference to resume, or start a new conversation.",sessionResolved:"This conversation has been resolved.",tryAgain:"Try again",goBack:"Go back",somethingWentWrong:"Something went wrong",fabLabel:"Chat with us",chatNoLongerAvailable:"This chat is no longer available.",talkToHuman:"Talk to human",talkToHumanAria:"Talk to a human agent",handoffPending:"Connecting you to a human agent…",handoffFailed:"Could not request a human agent. Try again.",handoffRateLimited:"You requested an agent recently. Please wait before trying again.",handoffAvailable:"An agent is available",handoffOffline:"No agent online — leave your details",handoffMaintenance:"Paused for maintenance. You can reach an agent again shortly.",resumeListLabel:"Continue conversation",resumeListTimestamp:"{minutes}m ago",pickUpWhereLeftOff:"Pick up where you left off",chatOptionsAria:"Options for chat {ref}",copyReference:"Copy reference",referenceCopied:"Reference copied",deleteChat:"Delete chat",deleteChats:"Delete chats",selectChats:"Select",selectAll:"Select all",cancel:"Cancel",selectedCount:"{count} of {total} selected",deleteCount:"Delete ({count})",deleteLimitHint:"You can delete up to {max} chats at once.",deleteOneTitle:"Delete this chat?",deleteManyTitle:"Delete {count} chats?",deleteOneBody:"Every message and file in this chat is deleted, for you and for the team. This can’t be undone.",deleteManyBody:"Every message and file in these chats is deleted, for you and for the team. This can’t be undone.",deleteOneReference:"Your reference number stops working, so this chat can’t be opened again on any device.",deleteManyReference:"Their reference numbers stop working.",deleting:"Deleting…",deleteFailedOne:"We couldn’t delete the chat, so nothing was deleted. Try again in a moment.",deleteFailedMany:"We couldn’t delete the chats, so nothing was deleted. Try again in a moment.",deleteMaintenance:"Chat is paused for maintenance. Try again in a few minutes.",deleteTurnedOff:"Deleting chats is turned off here.",chatDeleted:"Chat {ref} deleted",chatsDeleted:"{count} chats deleted",chatKeptOne:"1 chat couldn’t be deleted: it belongs to another signed-in person.",chatsKept:"{count} chats couldn’t be deleted: they belong to another signed-in person.",noticeAgentJoined:"{name} has joined the conversation.",noticeHumanRequested:"You requested to speak with a human agent.",noticeHumanRequestedForm:"You requested to speak with a human agent. Please share your contact details below.",noticeEscalationConfirmed:`Thank you {name}! A human agent will be available soon.
7
7
  We will contact you at {email} when an agent is ready.
8
8
 
9
9
  Your reference: **{ref}**
10
- Use it to resume this conversation from any device.`,noticeMessageReceived:"Your message has been received. A team member will respond shortly.",noticeAgentHandling:"Your conversation is with a human agent who will respond shortly.",noticeAiResumed:"The assistant is back and can answer your questions again.",quoteMessage:"Quote this message",quotedYourMessage:"Your message",cancelReply:"Cancel reply",sourcesCountOne:"{count} source",sourcesCountOther:"{count} sources",privacyNoticePre:"By chatting, you agree to our",privacyPolicyLinkText:"Privacy Policy",privacyChipText:"We respect your privacy - read our policy",privacyExplicitTitle:"Before you send",privacyExplicitBodyPre:"Messages are processed to assist you. By continuing you agree to our",privacyExplicitButton:"Got it, continue",magiclineTrialTitle:"Book a trial session",magiclineLeadTitle:"Request more information",magiclineFirstName:"First name",magiclineLastName:"Last name",magiclineEmail:"Email",magiclinePhone:"Phone",magiclineBirthDate:"Date of birth",magiclineInterest:"What are you interested in? (optional)",magiclineMessage:"Message (optional)",magiclineSlotLabel:"Preferred time",magiclineSlotPlaceholder:"Select a time…",magiclineLoadingSlots:"Loading available times…",magiclineNoSlots:"No trial times are available right now. Please check back later or ask us for help.",magiclineSubmit:"Submit",magiclineSubmitting:"Submitting…",magiclineSubmitted:"Request submitted",magiclineSubmittedDetail:"We’ve received your request and will be in touch shortly.",magiclineTrialSuccessTitle:"Book a trial session",magiclineTrialSuccessDetail:"Done! Your trial session is booked. You'll receive a confirmation email shortly – please check your inbox.",magiclineFailed:"Submission failed",magiclineFailedDetail:"Something went wrong submitting your request. Please try again.",magiclineConsent:"I agree to the processing of my data in accordance with the",magiclinePrivacyLinkText:"Privacy Policy",magiclineRequiredError:"Please fill in all required fields.",magiclineEmailError:"Please enter a valid email address.",magiclineConsentError:"Please accept the privacy policy to continue.",magiclineConfigLoading:"Loading the booking form…",magiclineConfigUnsupported:"Online trial booking is not supported for this studio. Please ask us for help.",magiclineConfigInconsistent:"The booking form is temporarily misconfigured. Please ask us for help.",magiclineConfigUnavailable:"Trial booking is not available right now. Please try again later or ask us for help.",magiclineGender:"Gender",magiclineGenderPlaceholder:"Select gender…",magiclineGenderMale:"Male",magiclineGenderFemale:"Female",magiclineGenderUnisex:"Diverse",magiclineStreet:"Street",magiclineHouseNumber:"House number",magiclineZip:"Postal code",magiclineCity:"City",magiclineCountry:"Country",magiclineCountryPlaceholder:"Select a country…",magiclineNote:"Note (optional)",magiclineOptionalSuffix:" (optional)",magiclineTrainerRequired:"I want a trainer present",magiclineMinAgeError:"You must be at least {age} years old to book a trial.",magiclineSlotRequiredError:"Please select an available time.",magiclineSlotUnavailableNotice:"That time is no longer available. Please pick another time below.",magiclineStepTrainer:"Trainer",magiclineStepSlot:"Choose a time",magiclineStepPersonal:"Your details",magiclineStepAddress:"Your address",magiclineStepConfirm:"Confirm",magiclineStepCounter:"Step {n} of {total}",magiclineWizardBack:"Back",magiclineWizardNext:"Next",magiclineTrainerWith:"Trial session with trainer",magiclineTrainerWithout:"Trial session without trainer",magiclineSummaryTrainer:"Trainer",magiclineSummarySlot:"Time",magiclineSummaryName:"Name",magiclineRetry:"Try again",magiclineSlotsError:"We couldn’t load available times right now. Please try again.",magiclineContractTitle:"Become a member",magiclineStepOffer:"Choose a membership",magiclineStepUpgrades:"Add-ons",magiclineStepPayment:"Payment",magiclineStepReview:"Review",magiclineOffersLoading:"Loading memberships…",magiclineOffersError:"We couldn’t load the memberships right now. Please try again.",magiclineNoOffers:"No memberships are available to sign up for online right now. Please ask us for help.",magiclineTermLength:"{value} {unit}",magiclineFreqPerDay:"per day",magiclineFreqPerWeek:"per week",magiclineFreqPerMonth:"per month",magiclineFreqPerYear:"per year",magiclineFreqEveryDays:"every {n} days",magiclineFreqEveryWeeks:"every {n} weeks",magiclineFreqEveryMonths:"every {n} months",magiclineFreqEveryYears:"every {n} years",magiclineModulePerTerm:"per term",magiclineModuleOneTime:"one-time",magiclineModuleIncluded:"included",magiclineRenewalNone:"No automatic renewal",magiclineRenewalTerm:"Renewal: {n} {unit}",magiclineCancellationPeriod:"Cancellation period",magiclineStarterPackage:"Starter package",magiclineFlatFee:"One-time fee",magiclineIncludedModules:"Included",magiclineDetails:"Details",magiclineRequired:"Required",magiclineUpgradesIntro:"Add optional upgrades to your membership.",magiclineUpgradesNone:"No optional upgrades are available for this membership.",magiclineUpgradeAdd:"Add",magiclineUpgradeAdded:"Added",magiclineUpgradeOneTime:"one-time",magiclineUpgradeConsentError:"Please accept the terms for your selected upgrade to keep it.",magiclineOfferRequiredError:"Please select a membership.",magiclineCountryStatic:"Germany",magiclineAccountHolder:"Account holder",magiclineIban:"IBAN",magiclineIbanInvalidError:"Please enter a valid IBAN.",magiclineSepaConsent:"I authorise the studio to collect payments from my account by SEPA direct debit and instruct my bank to honour these debits.",magiclineReviewLoading:"Calculating your price…",magiclineReviewError:"We couldn’t calculate your price right now. Please try again.",magiclineReviewOffer:"Membership",magiclineReviewPriceSummary:"Price summary",magiclineReviewBasePrice:"Price per month",magiclineReviewOneTimeFees:"One-time fees",magiclineReviewPreUseCharge:"Pre-use charge",magiclineReviewSelectedUpgrades:"Your selected upgrades",magiclineReviewContractVolume:"Total contract volume",magiclineReviewStartsOn:"Starts on",magiclineReviewPayment:"Payment",magiclineReviewTerms:"Terms & conditions",magiclineConfirmPrompt:"Please confirm the following to continue:",magiclineConfirmRequiredError:"Please confirm all required terms before submitting.",magiclineSummaryAddress:"Address",magiclineContractSubmitted:"Your membership is confirmed and the studio will be in touch shortly.",magiclineContractSuccessTitle:"Sign up for membership",magiclineContractSuccessDetail:"Welcome aboard! Your membership is all set. Your confirmation email is on its way.",magiclineCustomerNumber:"Your customer number: {number}",magiclinePriceChangedNotice:"The price has changed. Please review the new price and confirm again.",magiclineOfferUnavailableNotice:"That membership is no longer available. Please choose another one.",magiclineConfirmationRequiredNotice:"Please confirm all required terms before submitting.",magiclineLiveSubmissionDisabled:"Live submission is disabled for this project — please contact the studio.",magiclineDuplicateNotice:"A membership for this offer was already created recently.",magiclineUnknownOutcome:"We couldn’t confirm your signup. The studio will verify it and contact you — please do not submit again.",magiclineFeeStarterPackage:"Starter package",magiclineFeeTrainerFee:"Trainer fee",magiclineVoucherLabel:"Voucher code",magiclineVoucherPlaceholder:"Enter voucher code…",magiclineVoucherApply:"Apply",magiclineVoucherAppliedDiscount:"Discount ({discount})",magiclineVoucherCreditNotice:"Account credit applied — not deducted from contract total.",magiclineVoucherRemarks:"Voucher remarks",magiclineVoucherInvalid:'Voucher "{code}" is not valid. Please check the code and try again.',magiclineVoucherDisabled:"Voucher codes are not available for this membership.",magiclineGesamtpreisBeforeDiscount:"Total contract volume (before voucher discount)",newReplyTitle:"New reply",waitingTitle:"You’re in the queue",waitingSubtitle:"Keep this tab open — we’ll alert you right here the moment someone replies.",waitingLeaveEmail:"Rather get an email? Leave your details"},Es={title:"Assistent",statusOnline:"Online · Antwortet in Sekunden",inputPlaceholder:"Nachricht eingeben…",aiThinking:"KI antwortet…",sendAriaLabel:"Nachricht senden",attachFiles:"Dateien anhängen",attachmentUploading:"Wird hochgeladen…",attachmentFailed:"Hochladen fehlgeschlagen",attachmentRejected:"Nur Bilder (PNG, JPG, WebP) und PDFs bis 10 MB, 4 pro Nachricht.",attachmentRateLimited:"Zu viele Dateien auf einmal. Bitte in ein paar Minuten erneut versuchen.",attachmentNotAllowed:"In diesem Chat können gerade keine Dateien gesendet werden.",attachmentGone:"Eine Datei ist nicht mehr verfügbar. Bitte entfernen und neu anhängen.",attachmentPrivacy:"Dateien sieht nur das Support-Team.",attachmentUnavailable:"Datei nicht mehr verfügbar",attachmentOpen:"{name} öffnen",attachmentLoadFailed:"Die Dateien konnten nicht geladen werden.",attachmentRetry:"Erneut versuchen",voiceStart:"Spracheingabe starten",voiceStop:"Spracheingabe beenden",voiceListening:"Ich höre zu… sprich jetzt.",voiceProviderNote:"Deine Sprache wird vom Anbieter deines Browsers (z. B. Google oder Apple) in Text umgewandelt.",voiceErrorPermission:"Der Mikrofonzugriff ist blockiert. Erlaube ihn in den Browsereinstellungen.",voiceErrorNoMic:"Kein Mikrofon gefunden.",voiceErrorNetwork:"Spracheingabe ist in diesem Browser gerade nicht verfügbar. Sie funktioniert in Chrome, Edge und Safari. Bitte tippe stattdessen.",voiceErrorLang:"Spracheingabe ist in dieser Sprache nicht verfügbar.",removeAttachmentAriaLabel:"{name} entfernen",openChatAriaLabel:"Chat öffnen",closeChatAriaLabel:"Chat schließen",proactiveDismiss:"Schließen",proactiveOpenAria:"Chat öffnen",errorNetwork:"Netzwerkfehler. Bitte versuche es erneut.",errorQuota:"Nachrichtenlimit erreicht. Bitte versuche es später erneut.",errorRateLimited:"Zu viele Nachrichten. Bitte in {seconds} Sek. erneut versuchen.",errorSessionNoToken:"Verbindung zum Chat fehlgeschlagen. Bitte Internet prüfen und erneut versuchen.",errorMaintenance:"Der Chat pausiert wegen Wartungsarbeiten. Deine Nachricht wurde nicht gesendet, sie steht noch im Feld. Bitte versuche es gleich erneut.",errorSessionUnauthorized:"Dieser Chat ist auf dieser Seite nicht autorisiert. Bitte neu laden.",localeLabelDe:"DE",localeLabelEn:"EN",resumeConversation:"Gespräch wird fortgesetzt…",startingConversation:"Konversation wird gestartet…",sessionNotFound:"Ihre vorherige Sitzung wurde nicht gefunden. Ein neues Gespräch wird gestartet.",startNewConversation:"Neues Gespräch beginnen",chatWith:"Schreib uns eine Nachricht",homeStatusOnline:"Online",homeStatusOffline:"Offline",haveReferenceNumber:"Hast du eine Referenznummer?",referencePlaceholder:"z.B. JEX-A3B7C2",resume:"Fortsetzen",howCanWeHelp:"Wie können wir helfen?",getInstantHelp:"Soforthilfe erhalten",submitTicket:"Ticket einreichen",replyByEmail:"Wir antworten per E-Mail",ticketSubmitted:"Ticket eingereicht",yourReferenceNumber:"Deine Referenznummer:",sentToEmailHint:"Wir haben sie an deine E-Mail gesendet. Verwende diese Nummer für Rückfragen.",done:"Fertig",submittingTicket:"Dein Ticket wird übermittelt…",yourName:"Dein Name",yourEmail:"Deine E-Mail",submit:"Absenden",back:"Zurück",localePickerLabel:"Sprache",escalationFormTitle:"Hinterlassen Sie Ihre Daten",escalationSubtitle:"Unser Team meldet sich per E-Mail bei Ihnen — Sie müssen nicht hier warten.",escalationOfflineSubtitle:"Unser Team ist gerade offline — hinterlasse deine E-Mail und wir melden uns bei dir.",escalationNameLabel:"Ihr Name",escalationEmailLabel:"Ihre E-Mail",escalationSubmit:"An Team senden",escalationSubmitting:"Wird gesendet…",escalationSubmitted:"Anfrage gesendet",escalationConsent:"Mit dem Absenden stimmen Sie unserer",escalationPrivacyLinkText:"Datenschutzerklärung",escalationSkip:"Überspringen, ich warte hier",escalationPromptTitle:"Sprechen Sie mit unserem Team",escalationPromptSubtitle:"Wir benachrichtigen Sie per E-Mail, wenn wir antworten.",escalationPromptSubmit:"Daten hinterlassen",escalationSubmitFailed:"Senden fehlgeschlagen. Bitte versuche es erneut.",sessionNotFoundPrompt:"Sitzung nicht gefunden. Möchten Sie ein neues Gespräch beginnen?",sessionLocked:"Aus Datenschutzgründen wurde dieses Gespräch nach einer Inaktivitätszeit geschlossen. Geben Sie Ihre Referenz ein, um fortzufahren, oder beginnen Sie ein neues Gespräch.",sessionResolved:"Diese Unterhaltung wurde abgeschlossen.",tryAgain:"Erneut versuchen",goBack:"Zurück",somethingWentWrong:"Etwas ist schiefgelaufen",fabLabel:"Chatte mit uns",chatNoLongerAvailable:"Dieser Chat ist nicht mehr verfügbar.",talkToHuman:"Mit Mitarbeiter sprechen",talkToHumanAria:"Mit einem menschlichen Mitarbeiter sprechen",handoffPending:"Sie werden mit einem Mitarbeiter verbunden…",handoffFailed:"Anfrage konnte nicht gesendet werden. Erneut versuchen.",handoffRateLimited:"Sie haben kürzlich einen Mitarbeiter angefragt. Bitte warten Sie.",handoffAvailable:"Ein Mitarbeiter ist verfügbar",handoffOffline:"Kein Mitarbeiter online — hinterlasse deine Daten",handoffMaintenance:"Wegen Wartungsarbeiten pausiert. Du kannst gleich wieder einen Mitarbeiter erreichen.",resumeListLabel:"Unterhaltung fortsetzen",resumeListTimestamp:"vor {minutes} Min.",pickUpWhereLeftOff:"Da weitermachen, wo Sie aufgehört haben",noticeAgentJoined:"{name} ist der Unterhaltung beigetreten.",noticeHumanRequested:"Sie haben darum gebeten, mit einem Mitarbeiter zu sprechen.",noticeHumanRequestedForm:"Sie haben darum gebeten, mit einem Mitarbeiter zu sprechen. Bitte teilen Sie unten Ihre Kontaktdaten mit.",noticeEscalationConfirmed:`Vielen Dank, {name}! Ein Mitarbeiter wird in Kürze verfügbar sein.
10
+ Use it to resume this conversation from any device.`,noticeMessageReceived:"Your message has been received. A team member will respond shortly.",noticeAgentHandling:"Your conversation is with a human agent who will respond shortly.",noticeAiResumed:"The assistant is back and can answer your questions again.",quoteMessage:"Quote this message",quotedYourMessage:"Your message",cancelReply:"Cancel reply",sourcesCountOne:"{count} source",sourcesCountOther:"{count} sources",privacyNoticePre:"By chatting, you agree to our",privacyPolicyLinkText:"Privacy Policy",privacyChipText:"We respect your privacy - read our policy",privacyExplicitTitle:"Before you send",privacyExplicitBodyPre:"Messages are processed to assist you. By continuing you agree to our",privacyExplicitButton:"Got it, continue",magiclineTrialTitle:"Book a trial session",magiclineLeadTitle:"Request more information",magiclineFirstName:"First name",magiclineLastName:"Last name",magiclineEmail:"Email",magiclinePhone:"Phone",magiclineBirthDate:"Date of birth",magiclineInterest:"What are you interested in? (optional)",magiclineMessage:"Message (optional)",magiclineSlotLabel:"Preferred time",magiclineSlotPlaceholder:"Select a time…",magiclineLoadingSlots:"Loading available times…",magiclineNoSlots:"No trial times are available right now. Please check back later or ask us for help.",magiclineSubmit:"Submit",magiclineSubmitting:"Submitting…",magiclineSubmitted:"Request submitted",magiclineSubmittedDetail:"We’ve received your request and will be in touch shortly.",magiclineTrialSuccessTitle:"Book a trial session",magiclineTrialSuccessDetail:"Done! Your trial session is booked. You'll receive a confirmation email shortly – please check your inbox.",magiclineFailed:"Submission failed",magiclineFailedDetail:"Something went wrong submitting your request. Please try again.",magiclineConsent:"I agree to the processing of my data in accordance with the",magiclinePrivacyLinkText:"Privacy Policy",magiclineRequiredError:"Please fill in all required fields.",magiclineEmailError:"Please enter a valid email address.",magiclineConsentError:"Please accept the privacy policy to continue.",magiclineConfigLoading:"Loading the booking form…",magiclineConfigUnsupported:"Online trial booking is not supported for this studio. Please ask us for help.",magiclineConfigInconsistent:"The booking form is temporarily misconfigured. Please ask us for help.",magiclineConfigUnavailable:"Trial booking is not available right now. Please try again later or ask us for help.",magiclineGender:"Gender",magiclineGenderPlaceholder:"Select gender…",magiclineGenderMale:"Male",magiclineGenderFemale:"Female",magiclineGenderUnisex:"Diverse",magiclineStreet:"Street",magiclineHouseNumber:"House number",magiclineZip:"Postal code",magiclineCity:"City",magiclineCountry:"Country",magiclineCountryPlaceholder:"Select a country…",magiclineNote:"Note (optional)",magiclineOptionalSuffix:" (optional)",magiclineTrainerRequired:"I want a trainer present",magiclineMinAgeError:"You must be at least {age} years old to book a trial.",magiclineSlotRequiredError:"Please select an available time.",magiclineSlotUnavailableNotice:"That time is no longer available. Please pick another time below.",magiclineStepTrainer:"Trainer",magiclineStepSlot:"Choose a time",magiclineStepPersonal:"Your details",magiclineStepAddress:"Your address",magiclineStepConfirm:"Confirm",magiclineStepCounter:"Step {n} of {total}",magiclineWizardBack:"Back",magiclineWizardNext:"Next",magiclineTrainerWith:"Trial session with trainer",magiclineTrainerWithout:"Trial session without trainer",magiclineSummaryTrainer:"Trainer",magiclineSummarySlot:"Time",magiclineSummaryName:"Name",magiclineRetry:"Try again",magiclineSlotsError:"We couldn’t load available times right now. Please try again.",magiclineContractTitle:"Become a member",magiclineStepOffer:"Choose a membership",magiclineStepUpgrades:"Add-ons",magiclineStepPayment:"Payment",magiclineStepReview:"Review",magiclineOffersLoading:"Loading memberships…",magiclineOffersError:"We couldn’t load the memberships right now. Please try again.",magiclineNoOffers:"No memberships are available to sign up for online right now. Please ask us for help.",magiclineTermLength:"{value} {unit}",magiclineFreqPerDay:"per day",magiclineFreqPerWeek:"per week",magiclineFreqPerMonth:"per month",magiclineFreqPerYear:"per year",magiclineFreqEveryDays:"every {n} days",magiclineFreqEveryWeeks:"every {n} weeks",magiclineFreqEveryMonths:"every {n} months",magiclineFreqEveryYears:"every {n} years",magiclineModulePerTerm:"per term",magiclineModuleOneTime:"one-time",magiclineModuleIncluded:"included",magiclineRenewalNone:"No automatic renewal",magiclineRenewalTerm:"Renewal: {n} {unit}",magiclineCancellationPeriod:"Cancellation period",magiclineStarterPackage:"Starter package",magiclineFlatFee:"One-time fee",magiclineIncludedModules:"Included",magiclineDetails:"Details",magiclineRequired:"Required",magiclineUpgradesIntro:"Add optional upgrades to your membership.",magiclineUpgradesNone:"No optional upgrades are available for this membership.",magiclineUpgradeAdd:"Add",magiclineUpgradeAdded:"Added",magiclineUpgradeOneTime:"one-time",magiclineUpgradeConsentError:"Please accept the terms for your selected upgrade to keep it.",magiclineOfferRequiredError:"Please select a membership.",magiclineCountryStatic:"Germany",magiclineAccountHolder:"Account holder",magiclineIban:"IBAN",magiclineIbanInvalidError:"Please enter a valid IBAN.",magiclineSepaConsent:"I authorise the studio to collect payments from my account by SEPA direct debit and instruct my bank to honour these debits.",magiclineReviewLoading:"Calculating your price…",magiclineReviewError:"We couldn’t calculate your price right now. Please try again.",magiclineReviewOffer:"Membership",magiclineReviewPriceSummary:"Price summary",magiclineReviewBasePrice:"Price per month",magiclineReviewOneTimeFees:"One-time fees",magiclineReviewPreUseCharge:"Pre-use charge",magiclineReviewSelectedUpgrades:"Your selected upgrades",magiclineReviewContractVolume:"Total contract volume",magiclineReviewStartsOn:"Starts on",magiclineReviewPayment:"Payment",magiclineReviewTerms:"Terms & conditions",magiclineConfirmPrompt:"Please confirm the following to continue:",magiclineConfirmRequiredError:"Please confirm all required terms before submitting.",magiclineSummaryAddress:"Address",magiclineContractSubmitted:"Your membership is confirmed and the studio will be in touch shortly.",magiclineContractSuccessTitle:"Sign up for membership",magiclineContractSuccessDetail:"Welcome aboard! Your membership is all set. Your confirmation email is on its way.",magiclineCustomerNumber:"Your customer number: {number}",magiclinePriceChangedNotice:"The price has changed. Please review the new price and confirm again.",magiclineOfferUnavailableNotice:"That membership is no longer available. Please choose another one.",magiclineConfirmationRequiredNotice:"Please confirm all required terms before submitting.",magiclineLiveSubmissionDisabled:"Live submission is disabled for this project — please contact the studio.",magiclineDuplicateNotice:"A membership for this offer was already created recently.",magiclineUnknownOutcome:"We couldn’t confirm your signup. The studio will verify it and contact you — please do not submit again.",magiclineFeeStarterPackage:"Starter package",magiclineFeeTrainerFee:"Trainer fee",magiclineVoucherLabel:"Voucher code",magiclineVoucherPlaceholder:"Enter voucher code…",magiclineVoucherApply:"Apply",magiclineVoucherAppliedDiscount:"Discount ({discount})",magiclineVoucherCreditNotice:"Account credit applied — not deducted from contract total.",magiclineVoucherRemarks:"Voucher remarks",magiclineVoucherInvalid:'Voucher "{code}" is not valid. Please check the code and try again.',magiclineVoucherDisabled:"Voucher codes are not available for this membership.",magiclineGesamtpreisBeforeDiscount:"Total contract volume (before voucher discount)",newReplyTitle:"New reply",waitingTitle:"You’re in the queue",waitingSubtitle:"Keep this tab open — we’ll alert you right here the moment someone replies.",waitingLeaveEmail:"Rather get an email? Leave your details"},mo={title:"Assistent",statusOnline:"Online · Antwortet in Sekunden",inputPlaceholder:"Nachricht eingeben…",aiThinking:"KI antwortet…",sendAriaLabel:"Nachricht senden",attachFiles:"Dateien anhängen",attachmentUploading:"Wird hochgeladen…",attachmentFailed:"Hochladen fehlgeschlagen",attachmentRejected:"Nur Bilder (PNG, JPG, WebP) und PDFs bis 10 MB, 4 pro Nachricht.",attachmentRateLimited:"Zu viele Dateien auf einmal. Bitte in ein paar Minuten erneut versuchen.",attachmentNotAllowed:"In diesem Chat können gerade keine Dateien gesendet werden.",attachmentGone:"Eine Datei ist nicht mehr verfügbar. Bitte entfernen und neu anhängen.",attachmentPrivacy:"Dateien sieht nur das Support-Team.",attachmentUnavailable:"Datei nicht mehr verfügbar",attachmentOpen:"{name} öffnen",attachmentLoadFailed:"Die Dateien konnten nicht geladen werden.",attachmentRetry:"Erneut versuchen",voiceStart:"Spracheingabe starten",voiceStop:"Spracheingabe beenden",voiceListening:"Ich höre zu… sprich jetzt.",voiceProviderNote:"Deine Sprache wird vom Anbieter deines Browsers (z. B. Google oder Apple) in Text umgewandelt.",voiceErrorPermission:"Der Mikrofonzugriff ist blockiert. Erlaube ihn in den Browsereinstellungen.",voiceErrorNoMic:"Kein Mikrofon gefunden.",voiceErrorNetwork:"Spracheingabe ist in diesem Browser gerade nicht verfügbar. Sie funktioniert in Chrome, Edge und Safari. Bitte tippe stattdessen.",voiceErrorLang:"Spracheingabe ist in dieser Sprache nicht verfügbar.",removeAttachmentAriaLabel:"{name} entfernen",openChatAriaLabel:"Chat öffnen",closeChatAriaLabel:"Chat schließen",proactiveDismiss:"Schließen",proactiveOpenAria:"Chat öffnen",errorNetwork:"Netzwerkfehler. Bitte versuche es erneut.",errorQuota:"Nachrichtenlimit erreicht. Bitte versuche es später erneut.",errorRateLimited:"Zu viele Nachrichten. Bitte in {seconds} Sek. erneut versuchen.",errorSessionNoToken:"Verbindung zum Chat fehlgeschlagen. Bitte Internet prüfen und erneut versuchen.",errorMaintenance:"Der Chat pausiert wegen Wartungsarbeiten. Deine Nachricht wurde nicht gesendet, sie steht noch im Feld. Bitte versuche es gleich erneut.",errorSessionUnauthorized:"Dieser Chat ist auf dieser Seite nicht autorisiert. Bitte neu laden.",errorSessionSignedOut:"Deine Anmeldung ist abgelaufen. Lade die Seite neu, um weiterzuchatten.",errorSessionUnavailable:"Der Chat ist gerade nicht verfügbar. Bitte versuche es später noch einmal.",localeLabelDe:"DE",localeLabelEn:"EN",resumeConversation:"Gespräch wird fortgesetzt…",startingConversation:"Konversation wird gestartet…",sessionNotFound:"Ihre vorherige Sitzung wurde nicht gefunden. Ein neues Gespräch wird gestartet.",startNewConversation:"Neues Gespräch beginnen",chatWith:"Schreib uns eine Nachricht",homeStatusOnline:"Online",homeStatusOffline:"Offline",haveReferenceNumber:"Hast du eine Referenznummer?",referencePlaceholder:"z.B. JEX-A3B7C2K9M4QX",resume:"Fortsetzen",howCanWeHelp:"Wie können wir helfen?",getInstantHelp:"Soforthilfe erhalten",submitTicket:"Ticket einreichen",replyByEmail:"Wir antworten per E-Mail",ticketSubmitted:"Ticket eingereicht",yourReferenceNumber:"Deine Referenznummer:",sentToEmailHint:"Wir haben sie an deine E-Mail gesendet. Verwende diese Nummer für Rückfragen.",done:"Fertig",submittingTicket:"Dein Ticket wird übermittelt…",yourName:"Dein Name",yourEmail:"Deine E-Mail",submit:"Absenden",back:"Zurück",localePickerLabel:"Sprache",escalationFormTitle:"Hinterlassen Sie Ihre Daten",escalationSubtitle:"Unser Team meldet sich per E-Mail bei Ihnen — Sie müssen nicht hier warten.",escalationOfflineSubtitle:"Unser Team ist gerade offline — hinterlasse deine E-Mail und wir melden uns bei dir.",escalationNameLabel:"Ihr Name",escalationEmailLabel:"Ihre E-Mail",escalationSubmit:"An Team senden",escalationSubmitting:"Wird gesendet…",escalationSubmitted:"Anfrage gesendet",escalationFromAccount:"Aus Ihrem Konto übernommen.",escalationConsent:"Mit dem Absenden stimmen Sie unserer",escalationPrivacyLinkText:"Datenschutzerklärung",escalationSkip:"Überspringen, ich warte hier",escalationPromptTitle:"Sprechen Sie mit unserem Team",escalationPromptSubtitle:"Wir benachrichtigen Sie per E-Mail, wenn wir antworten.",escalationPromptSubmit:"Daten hinterlassen",escalationSubmitFailed:"Senden fehlgeschlagen. Bitte versuche es erneut.",sessionNotFoundPrompt:"Sitzung nicht gefunden. Möchten Sie ein neues Gespräch beginnen?",sessionLocked:"Aus Datenschutzgründen wurde dieses Gespräch nach einer Inaktivitätszeit geschlossen. Geben Sie Ihre Referenz ein, um fortzufahren, oder beginnen Sie ein neues Gespräch.",sessionResolved:"Diese Unterhaltung wurde abgeschlossen.",tryAgain:"Erneut versuchen",goBack:"Zurück",somethingWentWrong:"Etwas ist schiefgelaufen",fabLabel:"Chatte mit uns",chatNoLongerAvailable:"Dieser Chat ist nicht mehr verfügbar.",talkToHuman:"Mit Mitarbeiter sprechen",talkToHumanAria:"Mit einem menschlichen Mitarbeiter sprechen",handoffPending:"Sie werden mit einem Mitarbeiter verbunden…",handoffFailed:"Anfrage konnte nicht gesendet werden. Erneut versuchen.",handoffRateLimited:"Sie haben kürzlich einen Mitarbeiter angefragt. Bitte warten Sie.",handoffAvailable:"Ein Mitarbeiter ist verfügbar",handoffOffline:"Kein Mitarbeiter online — hinterlasse deine Daten",handoffMaintenance:"Wegen Wartungsarbeiten pausiert. Du kannst gleich wieder einen Mitarbeiter erreichen.",resumeListLabel:"Unterhaltung fortsetzen",resumeListTimestamp:"vor {minutes} Min.",pickUpWhereLeftOff:"Da weitermachen, wo Sie aufgehört haben",chatOptionsAria:"Optionen für Chat {ref}",copyReference:"Referenz kopieren",referenceCopied:"Referenz kopiert",deleteChat:"Chat löschen",deleteChats:"Chats löschen",selectChats:"Auswählen",selectAll:"Alle auswählen",cancel:"Abbrechen",selectedCount:"{count} von {total} ausgewählt",deleteCount:"Löschen ({count})",deleteLimitHint:"Du kannst bis zu {max} Chats auf einmal löschen.",deleteOneTitle:"Diesen Chat löschen?",deleteManyTitle:"{count} Chats löschen?",deleteOneBody:"Alle Nachrichten und Dateien in diesem Chat werden gelöscht, für dich und für das Team. Das lässt sich nicht rückgängig machen.",deleteManyBody:"Alle Nachrichten und Dateien in diesen Chats werden gelöscht, für dich und für das Team. Das lässt sich nicht rückgängig machen.",deleteOneReference:"Deine Referenznummer funktioniert danach nicht mehr, der Chat lässt sich auf keinem Gerät wieder öffnen.",deleteManyReference:"Ihre Referenznummern funktionieren danach nicht mehr.",deleting:"Wird gelöscht…",deleteFailedOne:"Wir konnten den Chat nicht löschen, es wurde nichts gelöscht. Bitte versuche es gleich noch einmal.",deleteFailedMany:"Wir konnten die Chats nicht löschen, es wurde nichts gelöscht. Bitte versuche es gleich noch einmal.",deleteMaintenance:"Der Chat pausiert wegen Wartungsarbeiten. Bitte versuche es in ein paar Minuten erneut.",deleteTurnedOff:"Chats löschen ist hier ausgeschaltet.",chatDeleted:"Chat {ref} gelöscht",chatsDeleted:"{count} Chats gelöscht",chatKeptOne:"1 Chat konnte nicht gelöscht werden: Er gehört einer anderen angemeldeten Person.",chatsKept:"{count} Chats konnten nicht gelöscht werden: Sie gehören einer anderen angemeldeten Person.",noticeAgentJoined:"{name} ist der Unterhaltung beigetreten.",noticeHumanRequested:"Sie haben darum gebeten, mit einem Mitarbeiter zu sprechen.",noticeHumanRequestedForm:"Sie haben darum gebeten, mit einem Mitarbeiter zu sprechen. Bitte teilen Sie unten Ihre Kontaktdaten mit.",noticeEscalationConfirmed:`Vielen Dank, {name}! Ein Mitarbeiter wird in Kürze verfügbar sein.
11
11
  Wir kontaktieren Sie unter {email}, sobald ein Mitarbeiter bereit ist.
12
12
 
13
13
  Ihre Referenz: **{ref}**
14
- Verwenden Sie sie, um diese Unterhaltung auf jedem Gerät fortzusetzen.`,noticeMessageReceived:"Ihre Nachricht ist eingegangen. Ein Mitarbeiter wird in Kürze antworten.",noticeAgentHandling:"Ihre Unterhaltung wird von einem menschlichen Mitarbeiter betreut, der in Kürze antwortet.",noticeAiResumed:"Der Assistent ist wieder da und kann Ihre Fragen beantworten.",quoteMessage:"Diese Nachricht zitieren",quotedYourMessage:"Ihre Nachricht",cancelReply:"Antwort abbrechen",sourcesCountOne:"{count} Quelle",sourcesCountOther:"{count} Quellen",privacyNoticePre:"Mit dem Chatten stimmst du unserer",privacyPolicyLinkText:"Datenschutzerklärung",privacyChipText:"Wir respektieren Ihre Privatsphäre - Richtlinie lesen",privacyExplicitTitle:"Vor dem Senden",privacyExplicitBodyPre:"Nachrichten werden verarbeitet, um Ihnen zu helfen. Durch Fortfahren stimmen Sie unserer",privacyExplicitButton:"Verstanden, fortfahren",magiclineTrialTitle:"Probetraining buchen",magiclineLeadTitle:"Weitere Informationen anfordern",magiclineFirstName:"Vorname",magiclineLastName:"Nachname",magiclineEmail:"E-Mail",magiclinePhone:"Telefon",magiclineBirthDate:"Geburtsdatum",magiclineInterest:"Wofür interessieren Sie sich? (optional)",magiclineMessage:"Nachricht (optional)",magiclineSlotLabel:"Wunschtermin",magiclineSlotPlaceholder:"Termin auswählen…",magiclineLoadingSlots:"Verfügbare Termine werden geladen…",magiclineNoSlots:"Derzeit sind keine Probetermine verfügbar. Bitte versuchen Sie es später erneut oder fragen Sie uns um Hilfe.",magiclineSubmit:"Absenden",magiclineSubmitting:"Wird gesendet…",magiclineSubmitted:"Anfrage gesendet",magiclineSubmittedDetail:"Wir haben Ihre Anfrage erhalten und melden uns in Kürze bei Ihnen.",magiclineTrialSuccessTitle:"Probetraining buchen",magiclineTrialSuccessDetail:"Geschafft! Dein Probetraining ist gebucht. Du bekommst gleich eine Bestätigung per E-Mail – schau bitte in dein Postfach.",magiclineFailed:"Senden fehlgeschlagen",magiclineFailedDetail:"Beim Senden Ihrer Anfrage ist ein Fehler aufgetreten. Bitte versuchen Sie es erneut.",magiclineConsent:"Ich stimme der Verarbeitung meiner Daten gemäß der",magiclinePrivacyLinkText:"Datenschutzerklärung",magiclineRequiredError:"Bitte füllen Sie alle Pflichtfelder aus.",magiclineEmailError:"Bitte geben Sie eine gültige E-Mail-Adresse ein.",magiclineConsentError:"Bitte akzeptieren Sie die Datenschutzerklärung, um fortzufahren.",magiclineConfigLoading:"Buchungsformular wird geladen…",magiclineConfigUnsupported:"Die Online-Buchung eines Probetrainings wird für dieses Studio nicht unterstützt. Bitte fragen Sie uns um Hilfe.",magiclineConfigInconsistent:"Das Buchungsformular ist vorübergehend falsch konfiguriert. Bitte fragen Sie uns um Hilfe.",magiclineConfigUnavailable:"Die Buchung eines Probetrainings ist derzeit nicht verfügbar. Bitte versuchen Sie es später erneut oder fragen Sie uns um Hilfe.",magiclineGender:"Geschlecht",magiclineGenderPlaceholder:"Geschlecht auswählen…",magiclineGenderMale:"Männlich",magiclineGenderFemale:"Weiblich",magiclineGenderUnisex:"Divers",magiclineStreet:"Straße",magiclineHouseNumber:"Hausnummer",magiclineZip:"Postleitzahl",magiclineCity:"Stadt",magiclineCountry:"Land",magiclineCountryPlaceholder:"Land auswählen…",magiclineNote:"Anmerkung (optional)",magiclineOptionalSuffix:" (optional)",magiclineTrainerRequired:"Ich wünsche einen Trainer vor Ort",magiclineMinAgeError:"Sie müssen mindestens {age} Jahre alt sein, um ein Probetraining zu buchen.",magiclineSlotRequiredError:"Bitte wählen Sie einen verfügbaren Termin aus.",magiclineSlotUnavailableNotice:"Dieser Termin ist nicht mehr verfügbar. Bitte wählen Sie unten einen anderen Termin aus.",magiclineStepTrainer:"Trainer",magiclineStepSlot:"Termin wählen",magiclineStepPersonal:"Ihre Daten",magiclineStepAddress:"Ihre Adresse",magiclineStepConfirm:"Bestätigen",magiclineStepCounter:"Schritt {n} von {total}",magiclineWizardBack:"Zurück",magiclineWizardNext:"Weiter",magiclineTrainerWith:"Probetraining mit Trainer",magiclineTrainerWithout:"Probetraining ohne Trainer",magiclineSummaryTrainer:"Trainer",magiclineSummarySlot:"Termin",magiclineSummaryName:"Name",magiclineRetry:"Erneut versuchen",magiclineSlotsError:"Die verfügbaren Termine konnten gerade nicht geladen werden. Bitte versuchen Sie es erneut.",magiclineContractTitle:"Mitglied werden",magiclineStepOffer:"Mitgliedschaft wählen",magiclineStepUpgrades:"Zusatzoptionen",magiclineStepPayment:"Zahlung",magiclineStepReview:"Überprüfen",magiclineOffersLoading:"Mitgliedschaften werden geladen…",magiclineOffersError:"Die Mitgliedschaften konnten gerade nicht geladen werden. Bitte versuchen Sie es erneut.",magiclineNoOffers:"Derzeit sind keine Mitgliedschaften für den Online-Abschluss verfügbar. Bitte fragen Sie uns um Hilfe.",magiclineTermLength:"{value} {unit}",magiclineFreqPerDay:"pro Tag",magiclineFreqPerWeek:"pro Woche",magiclineFreqPerMonth:"pro Monat",magiclineFreqPerYear:"pro Jahr",magiclineFreqEveryDays:"alle {n} Tage",magiclineFreqEveryWeeks:"alle {n} Wochen",magiclineFreqEveryMonths:"alle {n} Monate",magiclineFreqEveryYears:"alle {n} Jahre",magiclineModulePerTerm:"pro Laufzeit",magiclineModuleOneTime:"einmalig",magiclineModuleIncluded:"inklusive",magiclineRenewalNone:"Keine automatische Verlängerung",magiclineRenewalTerm:"Verlängerung: {n} {unit}",magiclineCancellationPeriod:"Kündigungsfrist",magiclineStarterPackage:"Startpaket",magiclineFlatFee:"Einmalige Gebühr",magiclineIncludedModules:"Inklusive",magiclineDetails:"Details",magiclineRequired:"Erforderlich",magiclineUpgradesIntro:"Fügen Sie Ihrer Mitgliedschaft optionale Zusatzoptionen hinzu.",magiclineUpgradesNone:"Für diese Mitgliedschaft sind keine optionalen Zusatzoptionen verfügbar.",magiclineUpgradeAdd:"Hinzufügen",magiclineUpgradeAdded:"Hinzugefügt",magiclineUpgradeOneTime:"einmalig",magiclineUpgradeConsentError:"Bitte akzeptieren Sie die Bedingungen für Ihre gewählte Zusatzoption, um sie beizubehalten.",magiclineOfferRequiredError:"Bitte wählen Sie eine Mitgliedschaft aus.",magiclineCountryStatic:"Deutschland",magiclineAccountHolder:"Kontoinhaber",magiclineIban:"IBAN",magiclineIbanInvalidError:"Bitte geben Sie eine gültige IBAN ein.",magiclineSepaConsent:"Ich ermächtige das Studio, Zahlungen von meinem Konto per SEPA-Lastschrift einzuziehen, und weise mein Kreditinstitut an, diese Lastschriften einzulösen.",magiclineReviewLoading:"Ihr Preis wird berechnet…",magiclineReviewError:"Ihr Preis konnte gerade nicht berechnet werden. Bitte versuchen Sie es erneut.",magiclineReviewOffer:"Mitgliedschaft",magiclineReviewPriceSummary:"Preisübersicht",magiclineReviewBasePrice:"Preis pro Monat",magiclineReviewOneTimeFees:"Einmalige Gebühren",magiclineReviewPreUseCharge:"Vorab-Nutzungsgebühr",magiclineReviewSelectedUpgrades:"Deine gewählten Zusatzoptionen",magiclineReviewContractVolume:"Gesamtes Vertragsvolumen",magiclineReviewStartsOn:"Beginnt am",magiclineReviewPayment:"Zahlung",magiclineReviewTerms:"Vertragsbedingungen",magiclineConfirmPrompt:"Bitte bestätigen Sie zum Fortfahren das Folgende:",magiclineConfirmRequiredError:"Bitte bestätigen Sie alle erforderlichen Bedingungen vor dem Absenden.",magiclineSummaryAddress:"Adresse",magiclineContractSubmitted:"Ihre Mitgliedschaft ist bestätigt. Das Studio meldet sich in Kürze bei Ihnen.",magiclineContractSuccessTitle:"Mitgliedschaft abschließen",magiclineContractSuccessDetail:"Willkommen an Bord! Deine Mitgliedschaft ist abgeschlossen. Die Bestätigung kommt gleich per E-Mail.",magiclineCustomerNumber:"Ihre Kundennummer: {number}",magiclinePriceChangedNotice:"Der Preis hat sich geändert. Bitte prüfen Sie den neuen Preis und bestätigen Sie erneut.",magiclineOfferUnavailableNotice:"Diese Mitgliedschaft ist nicht mehr verfügbar. Bitte wählen Sie eine andere aus.",magiclineConfirmationRequiredNotice:"Bitte bestätigen Sie alle erforderlichen Bedingungen vor dem Absenden.",magiclineLiveSubmissionDisabled:"Die Live-Übermittlung ist für dieses Projekt deaktiviert — bitte wenden Sie sich an das Studio.",magiclineDuplicateNotice:"Für dieses Angebot wurde kürzlich bereits eine Mitgliedschaft erstellt.",magiclineUnknownOutcome:"Wir konnten Ihre Anmeldung nicht bestätigen. Das Studio prüft sie und meldet sich bei Ihnen — bitte senden Sie das Formular nicht erneut ab.",magiclineFeeStarterPackage:"Startpaket",magiclineFeeTrainerFee:"Trainerpauschale",magiclineVoucherLabel:"Gutscheincode",magiclineVoucherPlaceholder:"Gutscheincode eingeben…",magiclineVoucherApply:"Einlösen",magiclineVoucherAppliedDiscount:"Rabatt ({discount})",magiclineVoucherCreditNotice:"Guthaben wird angerechnet — nicht vom Vertragsvolumen abgezogen.",magiclineVoucherRemarks:"Hinweis zum Gutschein",magiclineVoucherInvalid:'Gutscheincode „{code}" ist nicht gültig. Bitte überprüfen Sie den Code und versuchen Sie es erneut.',magiclineVoucherDisabled:"Gutscheincodes sind für diese Mitgliedschaft nicht verfügbar.",magiclineGesamtpreisBeforeDiscount:"Gesamtes Vertragsvolumen (vor Gutscheinrabatt)",newReplyTitle:"Neue Antwort",waitingTitle:"Du bist in der Warteschlange",waitingSubtitle:"Lass diesen Tab offen — wir benachrichtigen dich hier, sobald jemand antwortet.",waitingLeaveEmail:"Lieber per E-Mail? Hinterlasse deine Daten"},Ji=[{value:"de",label:"Deutsch"},{value:"en",label:"English"}],bh="de",Is="jex-locale",Ve=H("de"),vh={en:Yi,de:Es};function I(){return vh[Ve.value]??Yi}function yh(t){Ve.value=t;try{localStorage.setItem(Is,t)}catch{}}function $r(t){if(!t)return null;const e=(t.split("-")[0]??"").toLowerCase();return Ji.some(r=>r.value===e)?e:null}function wh(t,e){if(e)try{const r=$r(localStorage.getItem(Is));if(r)return r}catch{}const n=$r(t);if(n)return n;if(typeof navigator<"u"){const r=$r(navigator.language);if(r)return r}return bh}function kh(t){M(()=>{function e(n){const r=t??window.location.origin;if(n.origin!==r||n.data?.type!=="jexity:config")return;const{locale:i}=n.data.payload,o=$r(i);o&&(Ve.value=o)}return window.addEventListener("message",e),()=>{window.removeEventListener("message",e)}},[t])}const Ps="jex-session-history",Ms=Ps,Ns=1440*60*1e3,Ee=H([]),He=H(null),It=H(void 0),Xi=H(!1),Zi=Fi(()=>Ee.value.length>0),gn=H(null),_h="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",jh=6;function Sh(){let t="";const e=new Uint8Array(1);for(;t.length<jh;){crypto.getRandomValues(e);const n=e[0]??0;n<252&&(t+=_h[n%36])}return"JEX-"+t}function Th(t){if(t===null)return null;if(typeof t=="number"&&Number.isFinite(t)&&t>=0)return t}function Ls(t,e,n){if(n===null)return t;const r=typeof n=="number"?n:Ns;return t.filter(i=>e-i.lastActivityAt<=r)}function Ch(t,e,n,r){return n?Ls(t,e,r):t}function Ah(t){try{const e=sessionStorage.getItem(Ms);if(!e)return It.value=void 0,[];const n=JSON.parse(e);if(n.v!==1||!Array.isArray(n.entries))return It.value=void 0,[];const r=Object.prototype.hasOwnProperty.call(n,"timeoutMs");return It.value=Th(n.timeoutMs),Ch(n.entries,t,r,It.value)}catch{return It.value=void 0,[]}}function Qn(t){try{const e={v:1,entries:t,timeoutMs:It.value};sessionStorage.setItem(Ms,JSON.stringify(e))}catch{}}function Rh(){const t=Date.now(),e=Ah(t);Ee.value=e,Qn(e),He.value=e[e.length-1]?.ref??null,Xi.value=!0}function Eh(t){It.value=t;const e=Date.now(),n=Ls(Ee.value,e,t),r=He.value!==null&&!n.some(i=>i.ref===He.value);return Ee.value=n,r&&(He.value=null),Qn(n),{activeRefPruned:r}}function Os(){const t=Sh(),e=Date.now(),n=[...Ee.value,{ref:t,startedAt:e,lastActivityAt:e}];return Ee.value=n,He.value=t,Qn(n),t}function $s(){He.value=null}function Ds(t){const e=Date.now(),n=Ee.value.map(r=>r.ref===t?{...r,lastActivityAt:e}:r);Ee.value=n,He.value=t,Qn(n)}function eo(t){if(!t)return;const e=Date.now(),n=Ee.value.map(r=>r.ref===t?{...r,lastActivityAt:e}:r);Ee.value=n,Qn(n)}const Fe=H(qs());function qs(){return Zi.value?[{id:"home"}]:[{id:"home"},{id:"chat"}]}function Ih(){Fe.value=qs()}const Ph=H("screen");function jt(t){Fe.value=[...Fe.value,t]}function to(){Fe.value.length>1&&(Fe.value=Fe.value.slice(0,-1))}function no(t){Fe.value=[...Fe.value.slice(0,-1),t]}const Mh=6e4,Gn=H(!1),ro=H(!1),io=new Set;function Nh(t){return io.add(t),()=>{io.delete(t)}}function Lh(){const t=He.value;return t?Ee.value.find(n=>n.ref===t)?.lastActivityAt??null:null}function zs(t){const e=Lh();return e===null?!1:Date.now()-e>t}function oo(){if(!(Gn.value&&Ee.value.length===0)){Ee.value=[],He.value=null;try{sessionStorage.removeItem(Ps)}catch(t){X.warn("[JexityChat] Idle-lock storage clear failed:",t)}for(const t of io)try{t()}catch(e){X.warn("[JexityChat] Lock reset callback threw:",e)}Fe.value=[{id:"home"}],Gn.value=!0}}function Dr(){Gn.value&&(Gn.value=!1)}function Oh(t=Ns){let e=document.visibilityState==="hidden"?Date.now():null;const n=()=>{if(document.visibilityState==="hidden"){e=Date.now();return}(e!==null&&Date.now()-e>t||zs(t))&&oo(),e=null};document.addEventListener("visibilitychange",n);const r=setInterval(()=>{ro.value||zs(t)&&oo()},Mh);return()=>{document.removeEventListener("visibilitychange",n),clearInterval(r),e=null}}function $h(t){const e={},{primaryColor:n,theme:r}=t;if(n&&(e["--jex-primary"]=n,e["--jex-bg-trigger"]=n,e["--jex-bg-header"]=n,e["--jex-bg-msg-user"]=n,e["--jex-bg-send-btn"]=n),t.accentColor&&(e["--jex-accent"]=t.accentColor),r?.bg){const i=r.bg;i.trigger&&(e["--jex-bg-trigger"]=i.trigger),i.header&&(e["--jex-bg-header"]=i.header),i.msgUser&&(e["--jex-bg-msg-user"]=i.msgUser),i.msgBot&&(e["--jex-bg-msg-bot"]=i.msgBot),i.window&&(e["--jex-bg-window"]=i.window),i.sendBtn&&(e["--jex-bg-send-btn"]=i.sendBtn)}if(r?.text){const i=r.text;i.header&&(e["--jex-text-header"]=i.header),i.msgUser&&(e["--jex-text-msg-user"]=i.msgUser),i.msgBot&&(e["--jex-text-msg-bot"]=i.msgBot),i.main&&(e["--jex-text-main"]=i.main),i.muted&&(e["--jex-text-muted"]=i.muted)}if(r?.border){const i=r.border;i.window&&(e["--jex-border-window"]=i.window),i.input&&(e["--jex-border-input"]=i.input)}return t.fontFamily&&(e["--jex-font-family"]=t.fontFamily),t.fontSize&&(e["--jex-font-size"]=`${t.fontSize}px`),t.borderRadius&&(e["--jex-radius"]=t.borderRadius),t.windowWidth&&(e["--jex-window-width"]=`${t.windowWidth}px`),t.windowHeight&&(e["--jex-window-height"]=`${t.windowHeight}px`),typeof t.triggerOffsetX=="number"&&(e["--jex-offset-x"]=`${t.triggerOffsetX}px`),typeof t.triggerOffsetY=="number"&&(e["--jex-offset-y"]=`${t.triggerOffsetY}px`),Object.keys(e).length>0?e:void 0}function qr({size:t=24}){return s("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",children:[s("path",{d:"M12 8V4H8"}),s("rect",{width:"16",height:"12",x:"4",y:"8",rx:"2"}),s("path",{d:"M2 14h2"}),s("path",{d:"M20 14h2"}),s("path",{d:"M15 13v2"}),s("path",{d:"M9 13v2"})]})}function Dh(){const t=I();return Fe.value.length>1?s("button",{class:"jex-header-back",onClick:to,"aria-label":t.back||"Go back",children:s("svg",{width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",children:s("path",{d:"m15 18-6-6 6-6"})})}):s(qr,{size:24})}function qh({title:t}){return s("div",{class:"jex-header-info",children:s("h3",{children:t})})}function Fs({size:t=28}){return s("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",children:[s("path",{d:"M18 6 6 18"}),s("path",{d:"m6 6 12 12"})]})}function zh(){const t=I();return s("button",{class:"jex-header-close",type:"button",onClick:()=>{ue.value=!1},"aria-label":t.closeChatAriaLabel,title:t.closeChatAriaLabel,children:s(Fs,{size:18})})}function Us({code:t}){return s("span",{class:"jex-flag","aria-hidden":"true",children:t==="de"?s("svg",{viewBox:"0 0 5 3",preserveAspectRatio:"none",children:[s("rect",{width:"5",height:"1",fill:"#000"}),s("rect",{width:"5",height:"1",y:"1",fill:"#DD0000"}),s("rect",{width:"5",height:"1",y:"2",fill:"#FFCE00"})]}):s("svg",{viewBox:"0 0 60 30",preserveAspectRatio:"xMidYMid slice",children:[s("clipPath",{id:"jex-flag-gb-diag",children:s("path",{d:"M30,15 h30 v15 z v15 h-30 z h-30 v-15 z v-15 h30 z"})}),s("rect",{width:"60",height:"30",fill:"#012169"}),s("path",{d:"M0,0 L60,30 M60,0 L0,30",stroke:"#fff","stroke-width":"6"}),s("path",{d:"M0,0 L60,30 M60,0 L0,30","clip-path":"url(#jex-flag-gb-diag)",stroke:"#C8102E","stroke-width":"4"}),s("path",{d:"M30,0 v30 M0,15 h60",stroke:"#fff","stroke-width":"10"}),s("path",{d:"M30,0 v30 M0,15 h60",stroke:"#C8102E","stroke-width":"6"})]})})}function Fh(){const t=I(),[e,n]=O(!1),r=ie(null),i=Ve.value,o=Ji.find(a=>a.value===i)?.label??i;return M(()=>{if(!e)return;const a=c=>{r.current&&!c.composedPath().includes(r.current)&&n(!1)},l=c=>{c.key==="Escape"&&n(!1)};return document.addEventListener("pointerdown",a),document.addEventListener("keydown",l),()=>{document.removeEventListener("pointerdown",a),document.removeEventListener("keydown",l)}},[e]),s("div",{class:"jex-locale-picker",ref:r,children:[s("button",{type:"button",class:"jex-header-locale","aria-haspopup":"menu","aria-expanded":e,"aria-label":`${t.localePickerLabel}: ${o}`,title:o,onClick:()=>n(a=>!a),children:s(Us,{code:i})}),e&&s("div",{class:"jex-locale-menu",role:"menu","aria-label":t.localePickerLabel,children:Ji.map(a=>s("button",{type:"button",role:"menuitemradio","aria-checked":a.value===i,lang:a.value,class:`jex-locale-option${a.value===i?" jex-locale-active":""}`,onClick:()=>{yh(a.value),n(!1)},children:[s(Us,{code:a.value}),s("span",{children:a.label})]},a.value))})]})}function Uh({action:t,showClose:e=!0,showLocalePicker:n}){return!t&&!e&&!n?null:s("div",{class:"jex-header-right",children:[n&&s(Fh,{}),t,e&&s(zh,{})]})}function Bs({title:t,rightAction:e,showClose:n=!0,showLocalePicker:r}){return s("header",{class:"jex-chat-header",children:[s(Dh,{}),s(qh,{title:t}),s(Uh,{action:e,showClose:n,showLocalePicker:r})]})}function Bh({size:t=14}){return s("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",children:s("path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"})})}function Vs(){return s("div",{class:"jex-widget-footer",children:s("a",{href:"https://jexitychat.de",target:"_blank",rel:"noopener noreferrer",class:"jex-branding",children:[s(Bh,{size:14}),s("span",{children:["Powered by ",s("strong",{children:"Jexity"})]})]})})}function Hs({size:t=28}){return s("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",children:s("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}function Vh({size:t=24,...e}){return s("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e,children:s("path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z"})})}const Hh={chat:s(Hs,{size:28}),bot:s(qr,{size:28}),sparkles:s(Vh,{size:28})},Wh={none:"0px",sm:"0.5rem",md:"0.75rem",lg:"1.25rem",full:"9999px"};function Qh({radius:t="full",iconOption:e="chat",label:n}){const r=I(),i=n??r.fabLabel,o=i!=="";return s("button",{class:`jex-floating-button${ue.value?"":" jex-fab-pulse"}${!ue.value&&o?" jex-has-label":""}`,style:{borderRadius:Wh[t]??"9999px"},onClick:()=>{ue.value=!ue.value},"aria-label":ue.value?r.closeChatAriaLabel:r.openChatAriaLabel,children:ue.value?s(Fs,{size:28}):s("div",{class:"jex-fab-inner",children:[Hh[e],o&&s("span",{class:"jex-fab-label",children:i})]})})}const zr=H(!1);function Gh(t,e){return e?`jex-proactive-dismissed:${t}:${e}`:`jex-proactive-dismissed:${t}`}function Ws(t){try{return sessionStorage.getItem(t)!==null}catch{return!1}}function Kh(t){try{sessionStorage.setItem(t,"1")}catch{}}function Yh(t){return t.isOpen||t.mode==="off"||t.hasHistory||t.dismissed?"skip":t.mode==="teaser"?"teaser":"open"}function Jh({title:t,message:e,guardKey:n}){const r=I();function i(){zr.value=!1,ue.value=!0}function o(a){a.stopPropagation(),Kh(n),zr.value=!1}return s("div",{class:"jex-proactive-teaser",role:"button",tabIndex:0,"aria-label":r.proactiveOpenAria,onClick:i,onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&i()},children:[s("div",{class:"jex-proactive-avatar",children:s(qr,{size:20})}),s("div",{class:"jex-proactive-body",children:[s("span",{class:"jex-proactive-title",children:t}),s("span",{class:"jex-proactive-message",children:e})]}),s("button",{type:"button",class:"jex-proactive-dismiss","aria-label":r.proactiveDismiss,onClick:o,children:s("svg",{width:14,height:14,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",children:[s("path",{d:"M18 6 6 18"}),s("path",{d:"m6 6 12 12"})]})})]})}const Pt=H(""),Kn=H(0),xn=H(null);function ao(t){xn.value=t,t&&(Kn.value+=1)}const Qs=100;function Gs(t){const e=t.replace(/\s+/g," ").trim();return e.length>Qs?`${e.slice(0,Qs)}…`:e}const Yn=H(null),so=H(Date.now()),Fr=H(!1),lo=H(!1),Jn=H(!1),Ur=H(null);function Br(){return Bi.value==="explicit"&&!lo.value}function Vr(){Br()&&(Jn.value=!0)}function Xh(){lo.value=!0,Jn.value=!1}function Ks(){lo.value=!1,Jn.value=!1,Ur.value=null}const Zh=10*1024*1024,Ys=["pdf","docx","txt","md","csv","png","jpg","jpeg","webp","gif"],Js={pdf:{kind:"document",mimeType:"application/pdf"},docx:{kind:"document",mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"},txt:{kind:"document",mimeType:"text/plain"},md:{kind:"document",mimeType:"text/markdown"},csv:{kind:"document",mimeType:"text/csv"},png:{kind:"image",mimeType:"image/png"},jpg:{kind:"image",mimeType:"image/jpeg"},jpeg:{kind:"image",mimeType:"image/jpeg"},webp:{kind:"image",mimeType:"image/webp"},gif:{kind:"image",mimeType:"image/gif"}};function Xs(t){return[...t.map(e=>`.${e}`),...new Set(t.map(e=>Js[e].mimeType))].join(",")}Xs(Ys),Xs(Ys.filter(t=>Js[t].kind==="document"));const ef=4,tf=["png","jpg","jpeg","webp","pdf"],nf=".png,.jpg,.jpeg,.webp,.pdf,image/png,image/jpeg,image/webp,application/pdf";function rf(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`att-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,11)}`}const Ie=H([]);function of(t){const e=t.lastIndexOf(".");return e<0?"":t.slice(e+1).toLowerCase()}function af(t,e){const n=t.filter(o=>tf.includes(of(o.name))&&o.size>0&&o.size<=Zh),r=Math.max(0,ef-e),i=n.slice(0,r);return{accepted:i,rejected:t.length-i.length}}function sf(t){const e={id:rf(),file:t,previewUrl:t.type.startsWith("image/")?URL.createObjectURL(t):null,status:"uploading",attachmentId:null,errorCode:null};return Ie.value=[...Ie.value,e],e}function bn(t,e){Ie.value=Ie.value.map(n=>n.id===t?{...n,...e}:n)}function Zs(t){const e=Ie.value.find(n=>n.id===t);e?.previewUrl&&URL.revokeObjectURL(e.previewUrl),Ie.value=Ie.value.filter(n=>n.id!==t)}function lf(){for(const t of Ie.value)t.previewUrl&&URL.revokeObjectURL(t.previewUrl);Ie.value=[]}function co(){return Ie.value.flatMap(t=>t.status==="ready"&&t.attachmentId?[t.attachmentId]:[])}function el(){return Ie.value.some(t=>t.status==="uploading")}function tl(t){const e=t?.data;return typeof e?.code=="string"?e.code:null}function cf(t,e){const n=tl(t);if(n===null||!n.startsWith("ATTACHMENT"))return;const r=t.data?.attachmentId,i=n==="ATTACHMENT_NOT_FOUND"&&typeof r=="string"?[r]:e;for(const o of Ie.value)o.attachmentId!==null&&i.includes(o.attachmentId)&&bn(o.id,{status:"failed",errorCode:n})}function nl(t){if(typeof t!="object"||t===null)return!1;const e=t.data;return typeof e!="object"||e===null?!1:e.kind==="maintenance"}const Mt=H(null),Xn=H(null);function rl(){Xn.value=null}function il({sessionId:t,visitorId:e,ensureSession:n}){const r=kt(oe.functions.chat.public.conversations.send);return async function(o){if(Br()){Ur.value=o,Vr();return}if(!Fr.value){Fr.value=!0;try{const a=t&&e?{sessionId:t,visitorId:e}:await n();if(!a)return;const l=xn.value?.id;Pt.value="",xn.value=null;const c=co();try{const u=await r({sessionId:a.sessionId,visitorId:a.visitorId,content:o,...l!==void 0?{replyToId:l}:{},...c.length>0?{attachmentIds:c}:{},...typeof window<"u"?{pagePath:window.location.pathname}:{}});if(u.ok){eo(a.visitorId);for(const d of Ie.value)d.attachmentId!==null&&c.includes(d.attachmentId)&&Zs(d.id)}else u.reason==="rate_limited"&&(Yn.value=Date.now()+u.retryAfterMs)}catch(u){X.error("[jexity] Failed to send message:",u),nl(u)&&(Mt.value="maintenance"),cf(u,c),Pt.value.trim()||(Pt.value=o)}}finally{Fr.value=!1}}}}function uf({sessionId:t,visitorId:e}){const n=kt(oe.conversationAttachments.visitor.reserveUpload),r=Ht(oe.conversationAttachments.visitor.finalizeUpload);async function i(a,l,c,u){try{const d=await n({sessionId:c,visitorId:u,name:l.name,sizeBytes:l.size});if(d.kind==="rejected"){bn(a,{status:"failed",errorCode:d.code});return}const m=await fetch(d.uploadUrl,{method:"PUT",headers:{"Content-Type":d.contentType},body:l});if(!m.ok){X.error("[jexity] File upload failed",{status:m.status}),bn(a,{status:"failed",errorCode:"ATTACHMENT_UPLOAD_INCOMPLETE"});return}const h=await r({sessionId:c,visitorId:u,attachmentId:d.attachmentId});h.kind==="ready"?bn(a,{status:"ready",attachmentId:d.attachmentId}):bn(a,{status:"failed",errorCode:h.code})}catch(d){X.error("[jexity] File upload failed",d),bn(a,{status:"failed",errorCode:tl(d)??"ATTACHMENT_UPLOAD_INCOMPLETE"})}}function o(a){if(!t||!e)return a.length;const{accepted:l,rejected:c}=af(a,Ie.value.filter(u=>u.status!=="failed").length);for(const u of l){const d=sf(u);i(d.id,u,t,e)}return c}return{addFiles:o}}function ol(t,e){switch(t){case"ATTACHMENT_TYPE_UNSUPPORTED":case"ATTACHMENT_TOO_LARGE":case"ATTACHMENT_FILE_EMPTY":case"ATTACHMENT_NAME_INVALID":case"ATTACHMENTS_TOO_MANY":return e.attachmentRejected;case"RATE_LIMITED":return e.attachmentRateLimited;case"ATTACHMENTS_DISABLED":case"ATTACHMENTS_ESCALATION_REQUIRED":return e.attachmentNotAllowed;case"ATTACHMENT_NOT_FOUND":case"ATTACHMENT_UPLOAD_EXPIRED":return e.attachmentGone;default:return e.attachmentFailed}}function df(){const t=Yn.value,e=so.value;M(()=>{if(t===null)return;const i=setInterval(()=>{so.value=Date.now()},1e3),o=setTimeout(()=>{Yn.value=null},Math.max(0,t-Date.now()));return()=>{clearInterval(i),clearTimeout(o)}},[t]);const n=t!==null,r=n?Math.max(0,Math.ceil((t-e)/1e3)):0;return{isActive:n,remainingSeconds:r}}function hf(){const t=I(),{isActive:e,remainingSeconds:n}=df();return e?s("div",{class:"jex-rate-limit-notice",role:"status","aria-live":"polite",children:t.errorRateLimited.replace("{seconds}",String(n))}):null}function ff(t,e){return t??(e?"maintenance":null)}function pf({maintenance:t=!1}={}){const e=I(),n=ff(Mt.value,t);if(n===null)return null;const r=n==="no-token"?e.errorSessionNoToken:n==="unauthorized"?e.errorSessionUnauthorized:n==="network"?e.errorNetwork:n==="maintenance"?e.errorMaintenance:e.somethingWentWrong;return s("div",{class:"jex-session-error-notice",role:"alert","aria-live":"assertive",children:r})}function mf({size:t=18}){return s("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",children:[s("path",{d:"M22 2 11 13"}),s("path",{d:"M22 2 15 22 11 13 2 9l20-7z"})]})}const al=132;function gf({onSend:t,onFiles:e}){const n=ie(null),r=ie(null);M(()=>{const u=n.current;if(!u)return;u.style.height="0";const d=Math.min(u.scrollHeight,al);u.style.height=`${d}px`,u.style.overflowY=u.scrollHeight>al?"auto":"hidden"},[Pt.value]);const i=ie(Kn.value);M(()=>{if(Kn.value===i.current)return;i.current=Kn.value;const u=n.current;u&&(u.focus(),u.setSelectionRange(u.value.length,u.value.length))},[Kn.value]);function o(u){u.key==="Enter"&&!u.shiftKey&&(u.preventDefault(),t())}function a(){r.current?.click()}function l(u){const d=u.currentTarget;d.files&&d.files.length>0&&e(Array.from(d.files)),d.value=""}function c(u){const d=u.target;(d===u.currentTarget||!d.closest("button, textarea, img"))&&n.current?.focus()}return{textareaRef:n,fileInputRef:r,onKeyDown:o,onAttachClick:a,onFilesPicked:l,onCardClick:c}}function xf(t){return!t||t.isSecureContext!==!0?null:t.SpeechRecognition??t.webkitSpeechRecognition??null}function bf(t){return t==="en"?"en-US":"de-DE"}function vf(t){switch(t){case"not-allowed":case"service-not-allowed":return"permission";case"audio-capture":return"no-mic";case"no-speech":return"no-speech";case"language-not-supported":return"lang";case"aborted":return null;default:return"network"}}function yf(t,e){const n=`voice error ${e} (raw: ${t})`;return e!=="network"?n:`${n} — the browser's speech service is unreachable. Brave and some Chromium forks ship without one; Firefox has none. Not an app bug. Works in Chrome/Edge/Safari.`}function wf(t){let e="";for(let n=0;n<t.results.length;n++)e+=t.results[n]?.[0]?.transcript??"";return e}function kf(t,e){const n=e.trim();return n?t===""||/\s$/.test(t)?t+n:`${t} ${n}`:t}const _f=.01,jf=4;function Sf(t){if(t.length===0)return 0;let e=0;for(let r=0;r<t.length;r++){const i=t[r]??0;e+=i*i}const n=Math.sqrt(e/t.length);return n<_f?0:Math.round(Math.min(1,n*jf)*20)/20}const Tf=6e4,Cf=300;function Af(){return window.matchMedia?.("(pointer: coarse)").matches===!0}function Rf({locale:t,getDraft:e,setDraft:n}){const[r]=O(()=>xf(typeof window>"u"?void 0:window)),[i,o]=O(!1),[a,l]=O(null),c=ie(null),u=ie(""),d=ie(""),m=ie(null),h=ie(0),p=ie(!1),x=ie(!1),w=ie(0),b=ie(!1),v=ie(!1);function k(){m.current&&(clearTimeout(m.current),m.current=null);const T=c.current;T&&(T.onresult=null,T.onerror=null,T.onend=null,X.debug("[jexity] voice stop",{ms:Date.now()-w.current})),c.current=null,x.current=!1,o(!1)}function A(){l(null);const T=c.current;if(T){try{T.abort()}catch{}k()}}function N(){if(!r||c.current)return;if(b.current){l("permission");return}if(v.current){l("network");return}l(null);const T=new r;T.lang=bf(t),T.continuous=!Af(),T.interimResults=!0,u.current=e(),d.current=u.current,p.current=!1,T.onresult=$=>{if(e()!==d.current){A();return}const R=kf(u.current,wf($));d.current=R,n(R)},T.onerror=$=>{const R=vf($.error);if(R!==null){if(R==="no-speech"){p.current||(p.current=!0,x.current=!0);return}R==="permission"&&(b.current=!0),R==="network"&&(v.current=!0),l(R),X.warn(`[jexity] ${yf($.error,R)}`)}},T.onend=()=>{if(x.current&&c.current===T){x.current=!1,u.current=d.current;try{T.start();return}catch{}}k()};try{T.start()}catch{l("network");return}c.current=T,w.current=Date.now(),o(!0),m.current=setTimeout(()=>{c.current?.stop()},Tf),X.debug("[jexity] voice start",{lang:T.lang})}function P(){const T=Date.now();if(T-h.current<Cf)return;h.current=T;const $=c.current;if($){x.current=!1,$.stop();return}N()}return M(()=>{if(!r)return;navigator.permissions?.query({name:"microphone"}).then($=>{b.current=$.state==="denied",$.onchange=()=>{b.current=$.state==="denied"}}).catch(()=>{});const T=()=>{document.visibilityState==="hidden"&&A()};return document.addEventListener("visibilitychange",T),()=>{document.removeEventListener("visibilitychange",T),A()}},[]),{supported:r!==null,listening:i,error:a,toggle:P,cancel:A}}function Ef(t){const[e,n]=O(0);return M(()=>{if(!t||typeof window>"u"||window.matchMedia?.("(prefers-reduced-motion: reduce)").matches||window.matchMedia?.("(pointer: coarse)").matches||!navigator.mediaDevices?.getUserMedia)return;let r=!1,i=null,o=null,a=0;return navigator.mediaDevices.getUserMedia({audio:!0}).then(l=>{if(r){l.getTracks().forEach(m=>{m.stop()});return}i=l,o=new AudioContext;const c=o.createAnalyser();c.fftSize=512,o.createMediaStreamSource(l).connect(c);const u=new Float32Array(c.fftSize),d=()=>{c.getFloatTimeDomainData(u);const m=Sf(u);n(h=>h===m?h:m),a=requestAnimationFrame(d)};a=requestAnimationFrame(d)}).catch(()=>{}),()=>{r=!0,cancelAnimationFrame(a),i?.getTracks().forEach(l=>{l.stop()}),o?.close()}},[t]),t?e:0}function If({listening:t,disabled:e,onClick:n}){const r=I(),i=Ef(t);return s("button",{type:"button",class:`jex-attach-btn jex-mic-btn${t?" jex-mic-btn-listening":""}`,"aria-pressed":t,"aria-label":t?r.voiceStop:r.voiceStart,title:r.voiceProviderNote,disabled:e,onClick:n,children:[s("span",{class:"jex-mic-ring","aria-hidden":"true",style:{transform:`scale(${1+i*.6})`,opacity:t?.25+i*.5:0}}),s("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",children:[s("path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z"}),s("path",{d:"M19 10v2a7 7 0 0 1-14 0v-2"}),s("line",{x1:"12",y1:"19",x2:"12",y2:"22"})]})]})}function Pf({isStreaming:t,disabled:e,inputDisabled:n,onSend:r,onFocus:i,canAttach:o,onFiles:a}){const l=I(),c=Pt,u=Ie,m=wt(oe.functions.flags.getAll,{})?.voiceDictationEnabled===!0,h=Rf({locale:Ve.value,getDraft:()=>Pt.value,setDraft:q=>{Pt.value=q}});function p(){h.cancel(),r()}M(()=>{n&&h.cancel()},[n]),M(()=>{m||h.cancel()},[m]);function x(){if(!h.listening&&Br()){Vr();return}h.toggle()}const w=h.error===null||h.error==="no-speech"?null:h.error,b={permission:l.voiceErrorPermission,"no-mic":l.voiceErrorNoMic,network:l.voiceErrorNetwork,lang:l.voiceErrorLang};let v="";w?v=b[w]:h.listening&&(v=`${l.voiceListening} ${l.voiceProviderNote}`);const{textareaRef:k,fileInputRef:A,onKeyDown:N,onAttachClick:P,onFilesPicked:T,onCardClick:$}=gf({onSend:p,onFiles:a});function R(){if(Br()){Vr();return}P()}const se=c.value.trim().length>0,V=u.value.length>0,y=el(),le=co().length>0,C=(se||le)&&!e&&!y,D=u.value.find(q=>q.status==="failed");let me="";return y?me=l.attachmentUploading:D&&(me=ol(D.errorCode,l)),s("div",{class:"jex-composer-card",onClick:$,children:[s("p",{class:`jex-voice-status${w?" jex-voice-status-error":""}`,role:"status","aria-live":"polite",children:v||null}),s("p",{class:`jex-attachment-status${D&&!y?" jex-attachment-status-error":""}`,role:"status","aria-live":"polite",children:me||null}),V&&s("div",{class:"jex-composer-attachments",role:"list",children:u.value.map(q=>s("div",{class:"jex-attachment-chip",role:"listitem","data-status":q.status,title:q.status==="failed"?ol(q.errorCode,l):q.file.name,children:[q.previewUrl?s("img",{src:q.previewUrl,alt:q.file.name,class:"jex-attachment-thumb"}):s("span",{class:"jex-attachment-file",children:[s("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",children:[s("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),s("polyline",{points:"14 2 14 8 20 8"})]}),s("span",{class:"jex-attachment-file-name",children:q.file.name})]}),s("button",{type:"button",class:"jex-attachment-remove","aria-label":l.removeAttachmentAriaLabel.replace("{name}",q.file.name),onClick:()=>{Zs(q.id)},children:s("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",children:[s("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),s("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},q.id))}),V&&s("p",{class:"jex-attachment-note",children:l.attachmentPrivacy}),s("textarea",{ref:k,class:"jex-composer-textarea","aria-label":l.inputPlaceholder,placeholder:t?l.aiThinking:l.inputPlaceholder,value:c.value,rows:1,onInput:q=>{c.value=q.currentTarget.value},onKeyDown:N,onFocus:i,disabled:n}),s("div",{class:"jex-composer-actions",children:[s("div",{class:"jex-composer-actions-left",children:[o&&s(ee,{children:[s("input",{ref:A,class:"jex-visually-hidden",type:"file",accept:nf,multiple:!0,onChange:T,tabIndex:-1,"aria-hidden":"true"}),s("button",{type:"button",class:"jex-attach-btn","aria-label":l.attachFiles,title:l.attachFiles,disabled:n,onClick:R,children:s("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",children:s("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"})})})]}),m&&h.supported&&s(If,{listening:h.listening,disabled:n,onClick:x})]}),s("button",{class:`jex-send-btn${C?" jex-send-btn-active":""}`,type:"button",onClick:p,"aria-label":l.sendAriaLabel,disabled:e||y||!se&&!le,children:s(mf,{size:16})})]})]})}const Mf=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim();const sl=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const Nf=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase());const ll=t=>{const e=Nf(t);return e.charAt(0).toUpperCase()+e.slice(1)};var Lf={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"};const Of=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0;return!1};const $f=({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,children:i,iconNode:o,class:a="",...l})=>Ge("svg",{...Lf,width:String(e),height:e,stroke:t,"stroke-width":r?Number(n)*24/Number(e):n,class:["lucide",a].join(" "),...!i&&!Of(l)&&{"aria-hidden":"true"},...l},[...o.map(([c,u])=>Ge(c,u)),...st(i)]);const Hr=(t,e)=>{const n=({class:r="",className:i="",children:o,...a})=>Ge($f,{...a,iconNode:e,class:Mf(`lucide-${sl(ll(t))}`,`lucide-${sl(t)}`,r,i)},o);return n.displayName=ll(t),n};const uo=Hr("corner-up-left",[["path",{d:"M20 20v-7a4 4 0 0 0-4-4H4",key:"1nkjon"}],["path",{d:"M9 14 4 9l5-5",key:"102s5s"}]]);const Df=Hr("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);const qf=Hr("file-x",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m14.5 12.5-5 5",key:"b62r18"}],["path",{d:"m9.5 12.5 5 5",key:"1rk7el"}]]);const zf=Hr("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function Ff(){const t=I(),e=xn.value;if(!e)return null;const n=e.role==="user"?t.quotedYourMessage:e.authorName;return s("div",{class:"jex-reply-preview",children:[s(uo,{size:13,class:"jex-reply-preview-icon"}),s("span",{class:"jex-reply-preview-text",children:[n&&s("span",{class:"jex-reply-preview-author",children:[n,": "]}),Gs(e.content)]}),s("button",{type:"button",class:"jex-reply-preview-cancel","aria-label":t.cancelReply,title:t.cancelReply,onClick:()=>{ao(null)},children:s(zf,{size:14})})]})}function cl({variant:t,isOpen:e=!1,onAcknowledge:n}){const r=I(),i=Wn.value;return t==="explicit"?e?s("div",{class:"jex-privacy-explicit",role:"dialog","aria-label":r.privacyExplicitTitle,children:[s("div",{class:"jex-privacy-explicit-content",children:[s("div",{class:"jex-privacy-explicit-icon","aria-hidden":"true",children:s("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:s("path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"})})}),s("div",{class:"jex-privacy-explicit-copy",children:[s("div",{class:"jex-privacy-explicit-title",children:r.privacyExplicitTitle}),s("p",{class:"jex-privacy-explicit-body",children:[r.privacyExplicitBodyPre," ",s("a",{href:i,target:"_blank",rel:"noopener noreferrer",class:"jex-privacy-notice-link",children:r.privacyPolicyLinkText}),"."]})]})]}),s("button",{type:"button",class:"jex-privacy-explicit-button",onClick:n,children:r.privacyExplicitButton})]}):null:s("p",{class:"jex-privacy-chip",children:[s("span",{class:"jex-privacy-chip-icon","aria-hidden":"true",children:s("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:s("path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"})})}),s("a",{href:i,target:"_blank",rel:"noopener noreferrer",class:"jex-privacy-chip-link",children:r.privacyChipText})]})}function Uf({sessionId:t,visitorId:e,isLoading:n,isStreaming:r,sessionStatus:i,ensureSession:o,onStartFresh:a,maintenance:l=!1}){const c=I(),u=Pt,d=Bi.value,m=il({sessionId:t,visitorId:e,ensureSession:o}),h=wt(oe.functions.flags.getAll,{}),p=ks.value&&(i==="escalated"||i==="assigned")&&h?.mediaManagementMode==="live"&&!l,{addFiles:x}=uf({sessionId:t,visitorId:e}),[w,b]=O(!1),v=i!==null&&h!==void 0;M(()=>{v&&!p&&Ie.value.length>0&&lf()},[v,p]),M(()=>{if(!w)return;const R=setTimeout(()=>{b(!1)},5e3);return()=>{clearTimeout(R)}},[w]);function k(R){x(R)>0&&b(!0)}const A=Yn.value!==null&&Yn.value>so.value,N=n||r||A||l,P=d==="explicit"&&Jn.value;function T(){Xh();const R=Ur.value;Ur.value=null,R!==null&&m(R)}if(i==="resolved")return s("div",{class:"jex-chat-input-resolved",children:[s("div",{class:"jex-resolved-notice",children:c.sessionResolved}),s("button",{class:"jex-resolved-new-btn",type:"button",onClick:()=>{a()},children:c.startNewConversation})]});async function $(){const R=u.value.trim();!R&&co().length===0||N||el()||await m(R)}return s("div",{class:"jex-chat-input",children:[s(hf,{}),s(pf,{maintenance:l}),d==="chip"&&s(cl,{variant:"chip"}),s(Ff,{}),w&&s("p",{class:"jex-attachment-status jex-attachment-status-error",role:"alert",children:c.attachmentRejected}),s("div",{class:`jex-chat-input-composer-gate${P?" jex-chat-input-composer-gate-open":""}`,children:[s(Pf,{isStreaming:r,disabled:N,inputDisabled:n||r||P||l,onSend:$,onFocus:Vr,canAttach:p,onFiles:k}),d==="explicit"&&s(cl,{variant:"explicit",isOpen:Jn.value,onAcknowledge:T})]})]})}function ho(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Qt=ho();function ul(t){Qt=t}var Gt={exec:()=>null};function vn(t){let e=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=e[r];return i||(i=t(r),e[r]=i),i}}function W(t,e=""){let n=typeof t=="string"?t:t.source,r={replace:(i,o)=>{let a=typeof o=="string"?o:o.source;return a=a.replace(Pe.caret,"$1"),n=n.replace(i,a),r},getRegex:()=>new RegExp(n,e)};return r}var Bf=((t="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+t)}catch{return!1}})(),Pe={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,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ 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,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:vn(t=>new RegExp(`^ {0,${t}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:vn(t=>new RegExp(`^ {0,${t}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:vn(t=>new RegExp(`^ {0,${t}}(?:\`\`\`|~~~)`)),headingBeginRegex:vn(t=>new RegExp(`^ {0,${t}}#`)),htmlBeginRegex:vn(t=>new RegExp(`^ {0,${t}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:vn(t=>new RegExp(`^ {0,${t}}>`))},Vf=/^(?:[ \t]*(?:\n|$))+/,Hf=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Wf=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Zn=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Qf=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,fo=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,dl=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,hl=W(dl).replace(/bull/g,fo).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(),Gf=W(dl).replace(/bull/g,fo).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(),po=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Kf=/^[^\n]+/,mo=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Yf=W(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",mo).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Jf=W(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,fo).getRegex(),Wr="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",go=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Xf=W("^ {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",go).replace("tag",Wr).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),fl=W(po).replace("hr",Zn).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[.)])[ \\t]+[^ \\t\\n]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Wr).getRegex(),Zf=W(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",fl).getRegex(),xo={blockquote:Zf,code:Hf,def:Yf,fences:Wf,heading:Qf,hr:Zn,html:Xf,lheading:hl,list:Jf,newline:Vf,paragraph:fl,table:Gt,text:Kf},pl=W("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Zn).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[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Wr).getRegex(),ep={...xo,lheading:Gf,table:pl,paragraph:W(po).replace("hr",Zn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",pl).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Wr).getRegex()},tp={...xo,html:W(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",go).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:Gt,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:W(po).replace("hr",Zn).replace("heading",` *#{1,6} *[^
15
- ]`).replace("lheading",hl).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},np=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,rp=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ml=/^( {2,}|\\)\n(?!\s*$)/,ip=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,yn=/[\p{P}\p{S}]/u,Qr=/[\s\p{P}\p{S}]/u,bo=/[^\s\p{P}\p{S}]/u,op=W(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Qr).getRegex(),gl=/(?!~)[\p{P}\p{S}]/u,ap=/(?!~)[\s\p{P}\p{S}]/u,sp=/(?:[^\s\p{P}\p{S}]|~)/u,lp=W(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Bf?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),xl=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,cp=W(xl,"u").replace(/punct/g,yn).getRegex(),up=W(xl,"u").replace(/punct/g,gl).getRegex(),bl="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",dp=W(bl,"gu").replace(/notPunctSpace/g,bo).replace(/punctSpace/g,Qr).replace(/punct/g,yn).getRegex(),hp=W(bl,"gu").replace(/notPunctSpace/g,sp).replace(/punctSpace/g,ap).replace(/punct/g,gl).getRegex(),fp=W("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,bo).replace(/punctSpace/g,Qr).replace(/punct/g,yn).getRegex(),pp=W(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,yn).getRegex(),mp="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",gp=W(mp,"gu").replace(/notPunctSpace/g,bo).replace(/punctSpace/g,Qr).replace(/punct/g,yn).getRegex(),xp=W(/\\(punct)/,"gu").replace(/punct/g,yn).getRegex(),bp=W(/^<(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(),vp=W(go).replace("(?:-->|$)","-->").getRegex(),yp=W("^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",vp).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Gr=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,wp=W(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Gr).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),vl=W(/^!?\[(label)\]\[(ref)\]/).replace("label",Gr).replace("ref",mo).getRegex(),yl=W(/^!?\[(ref)\](?:\[\])?/).replace("ref",mo).getRegex(),kp=W("reflink|nolink(?!\\()","g").replace("reflink",vl).replace("nolink",yl).getRegex(),wl=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,vo={_backpedal:Gt,anyPunctuation:xp,autolink:bp,blockSkip:lp,br:ml,code:rp,del:Gt,delLDelim:Gt,delRDelim:Gt,emStrongLDelim:cp,emStrongRDelimAst:dp,emStrongRDelimUnd:fp,escape:np,link:wp,nolink:yl,punctuation:op,reflink:vl,reflinkSearch:kp,tag:yp,text:ip,url:Gt},_p={...vo,link:W(/^!?\[(label)\]\((.*?)\)/).replace("label",Gr).getRegex(),reflink:W(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Gr).getRegex()},yo={...vo,emStrongRDelimAst:hp,emStrongLDelim:up,delLDelim:pp,delRDelim:gp,url:W(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",wl).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:W(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",wl).getRegex()},jp={...yo,br:W(ml).replace("{2,}","*").getRegex(),text:W(yo.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Kr={normal:xo,gfm:ep,pedantic:tp},er={normal:vo,gfm:yo,breaks:jp,pedantic:_p},Sp={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},kl=t=>Sp[t];function dt(t,e){if(e){if(Pe.escapeTest.test(t))return t.replace(Pe.escapeReplace,kl)}else if(Pe.escapeTestNoEncode.test(t))return t.replace(Pe.escapeReplaceNoEncode,kl);return t}function _l(t){try{t=encodeURI(t).replace(Pe.percentDecode,"%")}catch{return null}return t}function jl(t,e){let n=t.replace(Pe.findPipe,(o,a,l)=>{let c=!1,u=a;for(;--u>=0&&l[u]==="\\";)c=!c;return c?"|":" |"}),r=n.split(Pe.splitPipe),i=0;if(r[0].trim()||r.shift(),r.length>0&&!r.at(-1)?.trim()&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;i<r.length;i++)r[i]=r[i].trim().replace(Pe.slashPipe,"|");return r}function Nt(t,e,n){let r=t.length;if(r===0)return"";let i=0;for(;i<r&&t.charAt(r-i-1)===e;)i++;return t.slice(0,r-i)}function Sl(t){let e=t.split(`
14
+ Verwenden Sie sie, um diese Unterhaltung auf jedem Gerät fortzusetzen.`,noticeMessageReceived:"Ihre Nachricht ist eingegangen. Ein Mitarbeiter wird in Kürze antworten.",noticeAgentHandling:"Ihre Unterhaltung wird von einem menschlichen Mitarbeiter betreut, der in Kürze antwortet.",noticeAiResumed:"Der Assistent ist wieder da und kann Ihre Fragen beantworten.",quoteMessage:"Diese Nachricht zitieren",quotedYourMessage:"Ihre Nachricht",cancelReply:"Antwort abbrechen",sourcesCountOne:"{count} Quelle",sourcesCountOther:"{count} Quellen",privacyNoticePre:"Mit dem Chatten stimmst du unserer",privacyPolicyLinkText:"Datenschutzerklärung",privacyChipText:"Wir respektieren Ihre Privatsphäre - Richtlinie lesen",privacyExplicitTitle:"Vor dem Senden",privacyExplicitBodyPre:"Nachrichten werden verarbeitet, um Ihnen zu helfen. Durch Fortfahren stimmen Sie unserer",privacyExplicitButton:"Verstanden, fortfahren",magiclineTrialTitle:"Probetraining buchen",magiclineLeadTitle:"Weitere Informationen anfordern",magiclineFirstName:"Vorname",magiclineLastName:"Nachname",magiclineEmail:"E-Mail",magiclinePhone:"Telefon",magiclineBirthDate:"Geburtsdatum",magiclineInterest:"Wofür interessieren Sie sich? (optional)",magiclineMessage:"Nachricht (optional)",magiclineSlotLabel:"Wunschtermin",magiclineSlotPlaceholder:"Termin auswählen…",magiclineLoadingSlots:"Verfügbare Termine werden geladen…",magiclineNoSlots:"Derzeit sind keine Probetermine verfügbar. Bitte versuchen Sie es später erneut oder fragen Sie uns um Hilfe.",magiclineSubmit:"Absenden",magiclineSubmitting:"Wird gesendet…",magiclineSubmitted:"Anfrage gesendet",magiclineSubmittedDetail:"Wir haben Ihre Anfrage erhalten und melden uns in Kürze bei Ihnen.",magiclineTrialSuccessTitle:"Probetraining buchen",magiclineTrialSuccessDetail:"Geschafft! Dein Probetraining ist gebucht. Du bekommst gleich eine Bestätigung per E-Mail – schau bitte in dein Postfach.",magiclineFailed:"Senden fehlgeschlagen",magiclineFailedDetail:"Beim Senden Ihrer Anfrage ist ein Fehler aufgetreten. Bitte versuchen Sie es erneut.",magiclineConsent:"Ich stimme der Verarbeitung meiner Daten gemäß der",magiclinePrivacyLinkText:"Datenschutzerklärung",magiclineRequiredError:"Bitte füllen Sie alle Pflichtfelder aus.",magiclineEmailError:"Bitte geben Sie eine gültige E-Mail-Adresse ein.",magiclineConsentError:"Bitte akzeptieren Sie die Datenschutzerklärung, um fortzufahren.",magiclineConfigLoading:"Buchungsformular wird geladen…",magiclineConfigUnsupported:"Die Online-Buchung eines Probetrainings wird für dieses Studio nicht unterstützt. Bitte fragen Sie uns um Hilfe.",magiclineConfigInconsistent:"Das Buchungsformular ist vorübergehend falsch konfiguriert. Bitte fragen Sie uns um Hilfe.",magiclineConfigUnavailable:"Die Buchung eines Probetrainings ist derzeit nicht verfügbar. Bitte versuchen Sie es später erneut oder fragen Sie uns um Hilfe.",magiclineGender:"Geschlecht",magiclineGenderPlaceholder:"Geschlecht auswählen…",magiclineGenderMale:"Männlich",magiclineGenderFemale:"Weiblich",magiclineGenderUnisex:"Divers",magiclineStreet:"Straße",magiclineHouseNumber:"Hausnummer",magiclineZip:"Postleitzahl",magiclineCity:"Stadt",magiclineCountry:"Land",magiclineCountryPlaceholder:"Land auswählen…",magiclineNote:"Anmerkung (optional)",magiclineOptionalSuffix:" (optional)",magiclineTrainerRequired:"Ich wünsche einen Trainer vor Ort",magiclineMinAgeError:"Sie müssen mindestens {age} Jahre alt sein, um ein Probetraining zu buchen.",magiclineSlotRequiredError:"Bitte wählen Sie einen verfügbaren Termin aus.",magiclineSlotUnavailableNotice:"Dieser Termin ist nicht mehr verfügbar. Bitte wählen Sie unten einen anderen Termin aus.",magiclineStepTrainer:"Trainer",magiclineStepSlot:"Termin wählen",magiclineStepPersonal:"Ihre Daten",magiclineStepAddress:"Ihre Adresse",magiclineStepConfirm:"Bestätigen",magiclineStepCounter:"Schritt {n} von {total}",magiclineWizardBack:"Zurück",magiclineWizardNext:"Weiter",magiclineTrainerWith:"Probetraining mit Trainer",magiclineTrainerWithout:"Probetraining ohne Trainer",magiclineSummaryTrainer:"Trainer",magiclineSummarySlot:"Termin",magiclineSummaryName:"Name",magiclineRetry:"Erneut versuchen",magiclineSlotsError:"Die verfügbaren Termine konnten gerade nicht geladen werden. Bitte versuchen Sie es erneut.",magiclineContractTitle:"Mitglied werden",magiclineStepOffer:"Mitgliedschaft wählen",magiclineStepUpgrades:"Zusatzoptionen",magiclineStepPayment:"Zahlung",magiclineStepReview:"Überprüfen",magiclineOffersLoading:"Mitgliedschaften werden geladen…",magiclineOffersError:"Die Mitgliedschaften konnten gerade nicht geladen werden. Bitte versuchen Sie es erneut.",magiclineNoOffers:"Derzeit sind keine Mitgliedschaften für den Online-Abschluss verfügbar. Bitte fragen Sie uns um Hilfe.",magiclineTermLength:"{value} {unit}",magiclineFreqPerDay:"pro Tag",magiclineFreqPerWeek:"pro Woche",magiclineFreqPerMonth:"pro Monat",magiclineFreqPerYear:"pro Jahr",magiclineFreqEveryDays:"alle {n} Tage",magiclineFreqEveryWeeks:"alle {n} Wochen",magiclineFreqEveryMonths:"alle {n} Monate",magiclineFreqEveryYears:"alle {n} Jahre",magiclineModulePerTerm:"pro Laufzeit",magiclineModuleOneTime:"einmalig",magiclineModuleIncluded:"inklusive",magiclineRenewalNone:"Keine automatische Verlängerung",magiclineRenewalTerm:"Verlängerung: {n} {unit}",magiclineCancellationPeriod:"Kündigungsfrist",magiclineStarterPackage:"Startpaket",magiclineFlatFee:"Einmalige Gebühr",magiclineIncludedModules:"Inklusive",magiclineDetails:"Details",magiclineRequired:"Erforderlich",magiclineUpgradesIntro:"Fügen Sie Ihrer Mitgliedschaft optionale Zusatzoptionen hinzu.",magiclineUpgradesNone:"Für diese Mitgliedschaft sind keine optionalen Zusatzoptionen verfügbar.",magiclineUpgradeAdd:"Hinzufügen",magiclineUpgradeAdded:"Hinzugefügt",magiclineUpgradeOneTime:"einmalig",magiclineUpgradeConsentError:"Bitte akzeptieren Sie die Bedingungen für Ihre gewählte Zusatzoption, um sie beizubehalten.",magiclineOfferRequiredError:"Bitte wählen Sie eine Mitgliedschaft aus.",magiclineCountryStatic:"Deutschland",magiclineAccountHolder:"Kontoinhaber",magiclineIban:"IBAN",magiclineIbanInvalidError:"Bitte geben Sie eine gültige IBAN ein.",magiclineSepaConsent:"Ich ermächtige das Studio, Zahlungen von meinem Konto per SEPA-Lastschrift einzuziehen, und weise mein Kreditinstitut an, diese Lastschriften einzulösen.",magiclineReviewLoading:"Ihr Preis wird berechnet…",magiclineReviewError:"Ihr Preis konnte gerade nicht berechnet werden. Bitte versuchen Sie es erneut.",magiclineReviewOffer:"Mitgliedschaft",magiclineReviewPriceSummary:"Preisübersicht",magiclineReviewBasePrice:"Preis pro Monat",magiclineReviewOneTimeFees:"Einmalige Gebühren",magiclineReviewPreUseCharge:"Vorab-Nutzungsgebühr",magiclineReviewSelectedUpgrades:"Deine gewählten Zusatzoptionen",magiclineReviewContractVolume:"Gesamtes Vertragsvolumen",magiclineReviewStartsOn:"Beginnt am",magiclineReviewPayment:"Zahlung",magiclineReviewTerms:"Vertragsbedingungen",magiclineConfirmPrompt:"Bitte bestätigen Sie zum Fortfahren das Folgende:",magiclineConfirmRequiredError:"Bitte bestätigen Sie alle erforderlichen Bedingungen vor dem Absenden.",magiclineSummaryAddress:"Adresse",magiclineContractSubmitted:"Ihre Mitgliedschaft ist bestätigt. Das Studio meldet sich in Kürze bei Ihnen.",magiclineContractSuccessTitle:"Mitgliedschaft abschließen",magiclineContractSuccessDetail:"Willkommen an Bord! Deine Mitgliedschaft ist abgeschlossen. Die Bestätigung kommt gleich per E-Mail.",magiclineCustomerNumber:"Ihre Kundennummer: {number}",magiclinePriceChangedNotice:"Der Preis hat sich geändert. Bitte prüfen Sie den neuen Preis und bestätigen Sie erneut.",magiclineOfferUnavailableNotice:"Diese Mitgliedschaft ist nicht mehr verfügbar. Bitte wählen Sie eine andere aus.",magiclineConfirmationRequiredNotice:"Bitte bestätigen Sie alle erforderlichen Bedingungen vor dem Absenden.",magiclineLiveSubmissionDisabled:"Die Live-Übermittlung ist für dieses Projekt deaktiviert — bitte wenden Sie sich an das Studio.",magiclineDuplicateNotice:"Für dieses Angebot wurde kürzlich bereits eine Mitgliedschaft erstellt.",magiclineUnknownOutcome:"Wir konnten Ihre Anmeldung nicht bestätigen. Das Studio prüft sie und meldet sich bei Ihnen — bitte senden Sie das Formular nicht erneut ab.",magiclineFeeStarterPackage:"Startpaket",magiclineFeeTrainerFee:"Trainerpauschale",magiclineVoucherLabel:"Gutscheincode",magiclineVoucherPlaceholder:"Gutscheincode eingeben…",magiclineVoucherApply:"Einlösen",magiclineVoucherAppliedDiscount:"Rabatt ({discount})",magiclineVoucherCreditNotice:"Guthaben wird angerechnet — nicht vom Vertragsvolumen abgezogen.",magiclineVoucherRemarks:"Hinweis zum Gutschein",magiclineVoucherInvalid:'Gutscheincode „{code}" ist nicht gültig. Bitte überprüfen Sie den Code und versuchen Sie es erneut.',magiclineVoucherDisabled:"Gutscheincodes sind für diese Mitgliedschaft nicht verfügbar.",magiclineGesamtpreisBeforeDiscount:"Gesamtes Vertragsvolumen (vor Gutscheinrabatt)",newReplyTitle:"Neue Antwort",waitingTitle:"Du bist in der Warteschlange",waitingSubtitle:"Lass diesen Tab offen — wir benachrichtigen dich hier, sobald jemand antwortet.",waitingLeaveEmail:"Lieber per E-Mail? Hinterlasse deine Daten"},xf={...mo,voiceListening:"Ich höre zu… sprechen Sie jetzt.",voiceProviderNote:"Ihre Sprache wird vom Anbieter Ihres Browsers (z. B. Google oder Apple) in Text umgewandelt.",voiceErrorPermission:"Der Mikrofonzugriff ist blockiert. Erlauben Sie ihn in den Browsereinstellungen.",voiceErrorNetwork:"Spracheingabe ist in diesem Browser gerade nicht verfügbar. Sie funktioniert in Chrome, Edge und Safari. Bitte tippen Sie stattdessen.",errorNetwork:"Netzwerkfehler. Bitte versuchen Sie es erneut.",errorQuota:"Nachrichtenlimit erreicht. Bitte versuchen Sie es später erneut.",errorMaintenance:"Der Chat pausiert wegen Wartungsarbeiten. Ihre Nachricht wurde nicht gesendet, sie steht noch im Feld. Bitte versuchen Sie es gleich erneut.",chatWith:"Schreiben Sie uns eine Nachricht",haveReferenceNumber:"Haben Sie eine Referenznummer?",yourReferenceNumber:"Ihre Referenznummer:",sentToEmailHint:"Wir haben sie an Ihre E-Mail gesendet. Verwenden Sie diese Nummer für Rückfragen.",submittingTicket:"Ihr Ticket wird übermittelt…",yourName:"Ihr Name",yourEmail:"Ihre E-Mail",escalationSubtitle:"Unser Team meldet sich per E-Mail bei Ihnen. Sie müssen nicht hier warten.",escalationOfflineSubtitle:"Unser Team ist gerade offline. Hinterlassen Sie Ihre E-Mail und wir melden uns bei Ihnen.",escalationSubmitFailed:"Senden fehlgeschlagen. Bitte versuchen Sie es erneut.",fabLabel:"Chatten Sie mit uns",handoffOffline:"Kein Mitarbeiter online - hinterlassen Sie Ihre Daten",handoffMaintenance:"Wegen Wartungsarbeiten pausiert. Sie können gleich wieder einen Mitarbeiter erreichen.",privacyNoticePre:"Mit dem Chatten stimmen Sie unserer",magiclineTrialSuccessDetail:"Geschafft! Ihr Probetraining ist gebucht. Sie bekommen gleich eine Bestätigung per E-Mail. Bitte schauen Sie in Ihr Postfach.",magiclineReviewSelectedUpgrades:"Ihre gewählten Zusatzoptionen",magiclineContractSuccessDetail:"Willkommen an Bord! Ihre Mitgliedschaft ist abgeschlossen. Die Bestätigung kommt gleich per E-Mail.",magiclineLiveSubmissionDisabled:"Die Live-Übermittlung ist für dieses Projekt deaktiviert. Bitte wenden Sie sich an das Studio.",magiclineUnknownOutcome:"Wir konnten Ihre Anmeldung nicht bestätigen. Das Studio prüft sie und meldet sich bei Ihnen. Bitte senden Sie das Formular nicht erneut ab.",magiclineVoucherCreditNotice:"Guthaben wird angerechnet, nicht vom Vertragsvolumen abgezogen.",waitingTitle:"Sie sind in der Warteschlange",waitingSubtitle:"Lassen Sie diesen Tab offen. Wir benachrichtigen Sie hier, sobald jemand antwortet.",waitingLeaveEmail:"Lieber per E-Mail? Hinterlassen Sie Ihre Daten",errorSessionSignedOut:"Ihre Anmeldung ist abgelaufen. Laden Sie die Seite neu, um weiterzuchatten.",errorSessionUnavailable:"Der Chat ist gerade nicht verfügbar. Bitte versuchen Sie es später noch einmal.",deleteLimitHint:"Sie können bis zu {max} Chats auf einmal löschen.",deleteOneBody:"Alle Nachrichten und Dateien in diesem Chat werden gelöscht, für Sie und für das Team. Das lässt sich nicht rückgängig machen.",deleteManyBody:"Alle Nachrichten und Dateien in diesen Chats werden gelöscht, für Sie und für das Team. Das lässt sich nicht rückgängig machen.",deleteOneReference:"Ihre Referenznummer funktioniert danach nicht mehr, der Chat lässt sich auf keinem Gerät wieder öffnen.",deleteFailedOne:"Wir konnten den Chat nicht löschen, es wurde nichts gelöscht. Bitte versuchen Sie es gleich noch einmal.",deleteFailedMany:"Wir konnten die Chats nicht löschen, es wurde nichts gelöscht. Bitte versuchen Sie es gleich noch einmal.",deleteMaintenance:"Der Chat pausiert wegen Wartungsarbeiten. Bitte versuchen Sie es in ein paar Minuten erneut."},go=[{value:"de",label:"Deutsch"},{value:"en",label:"English"}],bf="de",dl="jex-locale",Qe=V("de"),vf={en:po,de:mo},hl=V("informal");function yf(t,e){return t==="de"&&e==="formal"?xf:vf[t]??po}function L(){return yf(Qe.value,hl.value)}function wf(t){Qe.value=t;try{localStorage.setItem(dl,t)}catch{}}function Gr(t){if(!t)return null;const e=(t.split("-")[0]??"").toLowerCase();return go.some(r=>r.value===e)?e:null}function kf(t,e){if(e)try{const r=Gr(localStorage.getItem(dl));if(r)return r}catch{}const n=Gr(t);if(n)return n;if(typeof navigator<"u"){const r=Gr(navigator.language);if(r)return r}return bf}function _f(t){N(()=>{function e(n){const r=t??window.location.origin;if(n.origin!==r||n.data?.type!=="jexity:config")return;const{locale:i}=n.data.payload,o=Gr(i);o&&(Qe.value=o)}return window.addEventListener("message",e),()=>{window.removeEventListener("message",e)}},[t])}const fl="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",jf=12,pl="jex-session-history",xo=pl,ml=1440*60*1e3,ge=V([]),Ie=V(null),zt=V(void 0),bo=V(!1),vo=no(()=>ge.value.length>0),_n=V(null);function Sf(){let t="";const e=new Uint8Array(1);for(;t.length<jf;){crypto.getRandomValues(e);const n=e[0]??0;n<252&&(t+=fl[n%fl.length])}return"JEX-"+t}function Tf(t){if(t===null)return null;if(typeof t=="number"&&Number.isFinite(t)&&t>=0)return t}function gl(t,e,n){if(n===null)return t;const r=typeof n=="number"?n:ml;return t.filter(i=>e-i.lastActivityAt<=r)}function Cf(t,e,n,r){return n?gl(t,e,r):t}function Af(t){try{const e=sessionStorage.getItem(xo);if(!e)return zt.value=void 0,[];const n=JSON.parse(e);if(n.v!==1||!Array.isArray(n.entries))return zt.value=void 0,[];const r=Object.prototype.hasOwnProperty.call(n,"timeoutMs");return zt.value=Tf(n.timeoutMs),Cf(n.entries,t,r,zt.value)}catch{return zt.value=void 0,[]}}function Zt(t){try{const e={v:1,entries:t,timeoutMs:zt.value};sessionStorage.setItem(xo,JSON.stringify(e))}catch{}}function Rf(){const t=Date.now(),e=Af(t);ge.value=e,Zt(e),Ie.value=e[e.length-1]?.ref??null,bo.value=!0}function Ef(t){zt.value=t;const e=Date.now(),n=gl(ge.value,e,t),r=Ie.value!==null&&!n.some(i=>i.ref===Ie.value);return ge.value=n,r&&(Ie.value=null),Zt(n),{activeRefPruned:r}}function yo(){const t=Sf(),e=Date.now(),n=[...ge.value,{ref:t,startedAt:e,lastActivityAt:e}];return ge.value=n,Ie.value=t,Zt(n),t}function If(){ge.value=[],Ie.value=null;try{sessionStorage.removeItem(xo)}catch{}}function xl(){Ie.value=null}function bl(t){const e=Date.now(),n=ge.value.map(r=>r.ref===t?{...r,lastActivityAt:e}:r);ge.value=n,Ie.value=t,Zt(n)}function wo(t){if(!t)return;const e=Date.now(),n=ge.value.map(r=>r.ref===t?{...r,lastActivityAt:e}:r);ge.value=n,Zt(n)}const Mf=120;function Pf(t){return[...t.replace(/\s+/g," ").trim()].slice(0,Mf).join("")}function Nf(t,e){const n=Pf(e);if(!n||!ge.value.some(i=>i.ref===t&&i.firstMessage===void 0))return;const r=ge.value.map(i=>i.ref===t?{...i,firstMessage:n}:i);ge.value=r,Zt(r)}function Of(t,e,n){return t.filter(r=>!e.includes(r.ref)||n.includes(r.ref))}function Lf(t,e){const n=Of(ge.value,t,e),r=Ie.value,i=r!==null&&t.includes(r)&&!e.includes(r);return ge.value=n,i&&(Ie.value=null),Zt(n),{currentDeleted:i}}const Ae=V(vl());function vl(){return vo.value?[{id:"home"}]:[{id:"home"},{id:"chat"}]}function $f(){Ae.value[Ae.value.length-1]?.id!=="chat"&&(Ae.value=vl())}const Df=V("screen");function bt(t){Ae.value=[...Ae.value,t]}function ko(){Ae.value.length>1&&(Ae.value=Ae.value.slice(0,-1))}function _o(t){Ae.value=[...Ae.value.slice(0,-1),t]}const zf=6e4,rr=V(!1),jo=V(!1),So=new Set;function qf(t){return So.add(t),()=>{So.delete(t)}}function Ff(){const t=Ie.value;return t?ge.value.find(n=>n.ref===t)?.lastActivityAt??null:null}function yl(t){const e=Ff();return e===null?!1:Date.now()-e>t}function To(){rr.value&&ge.value.length===0||(Kr(),rr.value=!0)}function Kr(){ge.value=[],Ie.value=null;try{sessionStorage.removeItem(pl)}catch(t){J.warn("[JexityChat] Idle-lock storage clear failed:",t)}for(const t of So)try{t()}catch(e){J.warn("[JexityChat] Lock reset callback threw:",e)}Ae.value=[{id:"home"}]}function Yr(){rr.value&&(rr.value=!1)}function Bf(t=ml){let e=document.visibilityState==="hidden"?Date.now():null;const n=()=>{if(document.visibilityState==="hidden"){e=Date.now();return}(e!==null&&Date.now()-e>t||yl(t))&&To(),e=null};document.addEventListener("visibilitychange",n);const r=setInterval(()=>{jo.value||yl(t)&&To()},zf);return()=>{document.removeEventListener("visibilitychange",n),clearInterval(r),e=null}}function Uf(t){const e={},{primaryColor:n,theme:r}=t;if(n&&(e["--jex-primary"]=n,e["--jex-bg-trigger"]=n,e["--jex-bg-header"]=n,e["--jex-bg-msg-user"]=n,e["--jex-bg-send-btn"]=n),t.accentColor&&(e["--jex-accent"]=t.accentColor),r?.bg){const i=r.bg;i.trigger&&(e["--jex-bg-trigger"]=i.trigger),i.header&&(e["--jex-bg-header"]=i.header),i.msgUser&&(e["--jex-bg-msg-user"]=i.msgUser),i.msgBot&&(e["--jex-bg-msg-bot"]=i.msgBot),i.window&&(e["--jex-bg-window"]=i.window),i.sendBtn&&(e["--jex-bg-send-btn"]=i.sendBtn)}if(r?.text){const i=r.text;i.header&&(e["--jex-text-header"]=i.header),i.msgUser&&(e["--jex-text-msg-user"]=i.msgUser),i.msgBot&&(e["--jex-text-msg-bot"]=i.msgBot),i.main&&(e["--jex-text-main"]=i.main),i.muted&&(e["--jex-text-muted"]=i.muted)}if(r?.border){const i=r.border;i.window&&(e["--jex-border-window"]=i.window),i.input&&(e["--jex-border-input"]=i.input)}return t.fontFamily&&(e["--jex-font-family"]=t.fontFamily),t.fontSize&&(e["--jex-font-size"]=`${t.fontSize}px`),t.borderRadius&&(e["--jex-radius"]=t.borderRadius),t.windowWidth&&(e["--jex-window-width"]=`${t.windowWidth}px`),t.windowHeight&&(e["--jex-window-height"]=`${t.windowHeight}px`),typeof t.triggerOffsetX=="number"&&(e["--jex-offset-x"]=`${t.triggerOffsetX}px`),typeof t.triggerOffsetY=="number"&&(e["--jex-offset-y"]=`${t.triggerOffsetY}px`),Object.keys(e).length>0?e:void 0}function Jr({size:t=24}){return s("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",children:[s("path",{d:"M12 8V4H8"}),s("rect",{width:"16",height:"12",x:"4",y:"8",rx:"2"}),s("path",{d:"M2 14h2"}),s("path",{d:"M20 14h2"}),s("path",{d:"M15 13v2"}),s("path",{d:"M9 13v2"})]})}function Vf(){const t=L();return Ae.value.length>1?s("button",{class:"jex-header-back",onClick:ko,"aria-label":t.back||"Go back",children:s("svg",{width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",children:s("path",{d:"m15 18-6-6 6-6"})})}):s(Jr,{size:24})}function Hf({title:t}){return s("div",{class:"jex-header-info",children:s("h3",{children:t})})}function wl({size:t=28}){return s("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",children:[s("path",{d:"M18 6 6 18"}),s("path",{d:"m6 6 12 12"})]})}function Wf(){const t=L();return s("button",{class:"jex-header-close",type:"button",onClick:()=>{fe.value=!1},"aria-label":t.closeChatAriaLabel,title:t.closeChatAriaLabel,children:s(wl,{size:18})})}function kl({code:t}){return s("span",{class:"jex-flag","aria-hidden":"true",children:t==="de"?s("svg",{viewBox:"0 0 5 3",preserveAspectRatio:"none",children:[s("rect",{width:"5",height:"1",fill:"#000"}),s("rect",{width:"5",height:"1",y:"1",fill:"#DD0000"}),s("rect",{width:"5",height:"1",y:"2",fill:"#FFCE00"})]}):s("svg",{viewBox:"0 0 60 30",preserveAspectRatio:"xMidYMid slice",children:[s("clipPath",{id:"jex-flag-gb-diag",children:s("path",{d:"M30,15 h30 v15 z v15 h-30 z h-30 v-15 z v-15 h30 z"})}),s("rect",{width:"60",height:"30",fill:"#012169"}),s("path",{d:"M0,0 L60,30 M60,0 L0,30",stroke:"#fff","stroke-width":"6"}),s("path",{d:"M0,0 L60,30 M60,0 L0,30","clip-path":"url(#jex-flag-gb-diag)",stroke:"#C8102E","stroke-width":"4"}),s("path",{d:"M30,0 v30 M0,15 h60",stroke:"#fff","stroke-width":"10"}),s("path",{d:"M30,0 v30 M0,15 h60",stroke:"#C8102E","stroke-width":"6"})]})})}function Qf(){const t=L(),[e,n]=$(!1),r=oe(null),i=Qe.value,o=go.find(a=>a.value===i)?.label??i;return N(()=>{if(!e)return;const a=c=>{r.current&&!c.composedPath().includes(r.current)&&n(!1)},l=c=>{c.key==="Escape"&&n(!1)};return document.addEventListener("pointerdown",a),document.addEventListener("keydown",l),()=>{document.removeEventListener("pointerdown",a),document.removeEventListener("keydown",l)}},[e]),s("div",{class:"jex-locale-picker",ref:r,children:[s("button",{type:"button",class:"jex-header-locale","aria-haspopup":"menu","aria-expanded":e,"aria-label":`${t.localePickerLabel}: ${o}`,title:o,onClick:()=>n(a=>!a),children:s(kl,{code:i})}),e&&s("div",{class:"jex-locale-menu",role:"menu","aria-label":t.localePickerLabel,children:go.map(a=>s("button",{type:"button",role:"menuitemradio","aria-checked":a.value===i,lang:a.value,class:`jex-locale-option${a.value===i?" jex-locale-active":""}`,onClick:()=>{wf(a.value),n(!1)},children:[s(kl,{code:a.value}),s("span",{children:a.label})]},a.value))})]})}function Gf({action:t,showClose:e=!0,showLocalePicker:n}){return!t&&!e&&!n?null:s("div",{class:"jex-header-right",children:[n&&s(Qf,{}),t,e&&s(Wf,{})]})}function _l({title:t,rightAction:e,showClose:n=!0,showLocalePicker:r}){return s("header",{class:"jex-chat-header",children:[s(Vf,{}),s(Hf,{title:t}),s(Gf,{action:e,showClose:n,showLocalePicker:r})]})}function Kf({size:t=14}){return s("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",children:s("path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"})})}function jl(){return s("div",{class:"jex-widget-footer",children:s("a",{href:"https://jexitychat.de",target:"_blank",rel:"noopener noreferrer",class:"jex-branding",children:[s(Kf,{size:14}),s("span",{children:["Powered by ",s("strong",{children:"Jexity"})]})]})})}function Xr({size:t=28}){return s("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",children:s("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}function Yf({size:t=24,...e}){return s("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e,children:s("path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z"})})}const Jf={chat:s(Xr,{size:28}),bot:s(Jr,{size:28}),sparkles:s(Yf,{size:28})},Xf={none:"0px",sm:"0.5rem",md:"0.75rem",lg:"1.25rem",full:"9999px"};function Zf({radius:t="full",iconOption:e="chat",label:n}){const r=L(),i=n??r.fabLabel,o=i!=="";return s("button",{class:`jex-floating-button${fe.value?"":" jex-fab-pulse"}${!fe.value&&o?" jex-has-label":""}`,style:{borderRadius:Xf[t]??"9999px"},onClick:()=>{fe.value=!fe.value},"aria-label":fe.value?r.closeChatAriaLabel:r.openChatAriaLabel,children:fe.value?s(wl,{size:28}):s("div",{class:"jex-fab-inner",children:[Jf[e],o&&s("span",{class:"jex-fab-label",children:i})]})})}const Zr=V(!1);function ep(t,e){return e?`jex-proactive-dismissed:${t}:${e}`:`jex-proactive-dismissed:${t}`}function Sl(t){try{return sessionStorage.getItem(t)!==null}catch{return!1}}function tp(t){try{sessionStorage.setItem(t,"1")}catch{}}function np(t){return t.isOpen||t.mode==="off"||t.hasHistory||t.dismissed?"skip":t.mode==="teaser"?"teaser":"open"}function rp({title:t,message:e,guardKey:n}){const r=L();function i(){Zr.value=!1,fe.value=!0}function o(a){a.stopPropagation(),tp(n),Zr.value=!1}return s("div",{class:"jex-proactive-teaser",role:"button",tabIndex:0,"aria-label":r.proactiveOpenAria,onClick:i,onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&i()},children:[s("div",{class:"jex-proactive-avatar",children:s(Jr,{size:20})}),s("div",{class:"jex-proactive-body",children:[s("span",{class:"jex-proactive-title",children:t}),s("span",{class:"jex-proactive-message",children:e})]}),s("button",{type:"button",class:"jex-proactive-dismiss","aria-label":r.proactiveDismiss,onClick:o,children:s("svg",{width:14,height:14,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",children:[s("path",{d:"M18 6 6 18"}),s("path",{d:"m6 6 12 12"})]})})]})}const ip=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim();const Tl=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const op=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase());const Cl=t=>{const e=op(t);return e.charAt(0).toUpperCase()+e.slice(1)};var ap={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"};const sp=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0;return!1};const lp=({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,children:i,iconNode:o,class:a="",...l})=>Ye("svg",{...ap,width:String(e),height:e,stroke:t,"stroke-width":r?Number(n)*24/Number(e):n,class:["lucide",a].join(" "),...!i&&!sp(l)&&{"aria-hidden":"true"},...l},[...o.map(([c,u])=>Ye(c,u)),...ht(i)]);const Et=(t,e)=>{const n=({class:r="",className:i="",children:o,...a})=>Ye(lp,{...a,iconNode:e,class:ip(`lucide-${Tl(Cl(t))}`,`lucide-${Tl(t)}`,r,i)},o);return n.displayName=Cl(t),n};const cp=Et("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const up=Et("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);const dp=Et("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);const Co=Et("corner-up-left",[["path",{d:"M20 20v-7a4 4 0 0 0-4-4H4",key:"1nkjon"}],["path",{d:"M9 14 4 9l5-5",key:"102s5s"}]]);const hp=Et("ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);const fp=Et("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);const pp=Et("file-x",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m14.5 12.5-5 5",key:"b62r18"}],["path",{d:"m9.5 12.5 5 5",key:"1rk7el"}]]);const Al=Et("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);const mp=Et("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),It=V(""),ir=V(0),jn=V(null);function Ao(t){jn.value=t,t&&(ir.value+=1)}const Rl=100;function El(t){const e=t.replace(/\s+/g," ").trim();return e.length>Rl?`${e.slice(0,Rl)}…`:e}const or=V(null),Ro=V(Date.now()),ei=V(!1),Eo=V(!1),ar=V(!1),ti=V(null);function ni(){return io.value==="explicit"&&!Eo.value}function ri(){ni()&&(ar.value=!0)}function gp(){Eo.value=!0,ar.value=!1}function Il(){Eo.value=!1,ar.value=!1,ti.value=null}const xp=10*1024*1024,Ml=["pdf","docx","txt","md","csv","png","jpg","jpeg","webp","gif"],Pl={pdf:{kind:"document",mimeType:"application/pdf"},docx:{kind:"document",mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"},txt:{kind:"document",mimeType:"text/plain"},md:{kind:"document",mimeType:"text/markdown"},csv:{kind:"document",mimeType:"text/csv"},png:{kind:"image",mimeType:"image/png"},jpg:{kind:"image",mimeType:"image/jpeg"},jpeg:{kind:"image",mimeType:"image/jpeg"},webp:{kind:"image",mimeType:"image/webp"},gif:{kind:"image",mimeType:"image/gif"}};function Nl(t){return[...t.map(e=>`.${e}`),...new Set(t.map(e=>Pl[e].mimeType))].join(",")}Nl(Ml),Nl(Ml.filter(t=>Pl[t].kind==="document"));const bp=4,vp=["png","jpg","jpeg","webp","pdf"],yp=".png,.jpg,.jpeg,.webp,.pdf,image/png,image/jpeg,image/webp,application/pdf";function wp(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`att-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,11)}`}const Me=V([]);function kp(t){const e=t.lastIndexOf(".");return e<0?"":t.slice(e+1).toLowerCase()}function _p(t,e){const n=t.filter(o=>vp.includes(kp(o.name))&&o.size>0&&o.size<=xp),r=Math.max(0,bp-e),i=n.slice(0,r);return{accepted:i,rejected:t.length-i.length}}function jp(t){const e={id:wp(),file:t,previewUrl:t.type.startsWith("image/")?URL.createObjectURL(t):null,status:"uploading",attachmentId:null,errorCode:null};return Me.value=[...Me.value,e],e}function Sn(t,e){Me.value=Me.value.map(n=>n.id===t?{...n,...e}:n)}function Ol(t){const e=Me.value.find(n=>n.id===t);e?.previewUrl&&URL.revokeObjectURL(e.previewUrl),Me.value=Me.value.filter(n=>n.id!==t)}function Sp(){for(const t of Me.value)t.previewUrl&&URL.revokeObjectURL(t.previewUrl);Me.value=[]}function Io(){return Me.value.flatMap(t=>t.status==="ready"&&t.attachmentId?[t.attachmentId]:[])}function Ll(){return Me.value.some(t=>t.status==="uploading")}function $l(t){const e=t?.data;return typeof e?.code=="string"?e.code:null}function Tp(t,e){const n=$l(t);if(n===null||!n.startsWith("ATTACHMENT"))return;const r=t.data?.attachmentId,i=n==="ATTACHMENT_NOT_FOUND"&&typeof r=="string"?[r]:e;for(const o of Me.value)o.attachmentId!==null&&i.includes(o.attachmentId)&&Sn(o.id,{status:"failed",errorCode:n})}function Dl(t){if(typeof t!="object"||t===null)return!1;const e=t.data;return typeof e!="object"||e===null?!1:e.kind==="maintenance"}const Mt=V(null),sr=V(null);function zl(){sr.value=null}function lr(){const t=rt.value;return t?{bootstrapToken:t}:{}}function Mo(t){return t instanceof xn?t.data?.code==="CONVERSATION_OF_ANOTHER_USER":!1}function Po(){Kr()}function ql({sessionId:t,visitorId:e,ensureSession:n}){const r=xt(se.functions.chat.public.conversations.send);return async function(o){if(ni()){ti.value=o,ri();return}if(!ei.value){ei.value=!0;try{const a=t&&e?{sessionId:t,visitorId:e}:await n();if(!a)return;const l=jn.value?.id;It.value="",jn.value=null;const c=Io();try{const u=await r({sessionId:a.sessionId,visitorId:a.visitorId,content:o,...l!==void 0?{replyToId:l}:{},...c.length>0?{attachmentIds:c}:{},...typeof window<"u"?{pagePath:window.location.pathname}:{},...lr()});if(u.ok){wo(a.visitorId);for(const d of Me.value)d.attachmentId!==null&&c.includes(d.attachmentId)&&Ol(d.id)}else u.reason==="rate_limited"&&(or.value=Date.now()+u.retryAfterMs)}catch(u){if(Mo(u)){Po(),It.value=o;return}J.error("[jexity] Failed to send message:",u),Dl(u)&&(Mt.value="maintenance"),Tp(u,c),It.value.trim()||(It.value=o)}}finally{ei.value=!1}}}}function Cp({sessionId:t,visitorId:e}){const n=xt(se.conversationAttachments.visitor.reserveUpload),r=Jt(se.conversationAttachments.visitor.finalizeUpload);async function i(a,l,c,u){try{const d=await n({sessionId:c,visitorId:u,name:l.name,sizeBytes:l.size,...lr()});if(d.kind==="rejected"){Sn(a,{status:"failed",errorCode:d.code});return}const m=await fetch(d.uploadUrl,{method:"PUT",headers:{"Content-Type":d.contentType},body:l});if(!m.ok){J.error("[jexity] File upload failed",{status:m.status}),Sn(a,{status:"failed",errorCode:"ATTACHMENT_UPLOAD_INCOMPLETE"});return}const f=await r({sessionId:c,visitorId:u,attachmentId:d.attachmentId});f.kind==="ready"?Sn(a,{status:"ready",attachmentId:d.attachmentId}):Sn(a,{status:"failed",errorCode:f.code})}catch(d){if(Mo(d)){Po();return}J.error("[jexity] File upload failed",d),Sn(a,{status:"failed",errorCode:$l(d)??"ATTACHMENT_UPLOAD_INCOMPLETE"})}}function o(a){if(!t||!e)return a.length;const{accepted:l,rejected:c}=_p(a,Me.value.filter(u=>u.status!=="failed").length);for(const u of l){const d=jp(u);i(d.id,u,t,e)}return c}return{addFiles:o}}function Fl(t,e){switch(t){case"ATTACHMENT_TYPE_UNSUPPORTED":case"ATTACHMENT_TOO_LARGE":case"ATTACHMENT_FILE_EMPTY":case"ATTACHMENT_NAME_INVALID":case"ATTACHMENTS_TOO_MANY":return e.attachmentRejected;case"RATE_LIMITED":return e.attachmentRateLimited;case"ATTACHMENTS_DISABLED":case"ATTACHMENTS_ESCALATION_REQUIRED":return e.attachmentNotAllowed;case"ATTACHMENT_NOT_FOUND":case"ATTACHMENT_UPLOAD_EXPIRED":return e.attachmentGone;default:return e.attachmentFailed}}function Ap(){const t=or.value,e=Ro.value;N(()=>{if(t===null)return;const i=setInterval(()=>{Ro.value=Date.now()},1e3),o=setTimeout(()=>{or.value=null},Math.max(0,t-Date.now()));return()=>{clearInterval(i),clearTimeout(o)}},[t]);const n=t!==null,r=n?Math.max(0,Math.ceil((t-e)/1e3)):0;return{isActive:n,remainingSeconds:r}}function Rp(){const t=L(),{isActive:e,remainingSeconds:n}=Ap();return e?s("div",{class:"jex-rate-limit-notice",role:"status","aria-live":"polite",children:t.errorRateLimited.replace("{seconds}",String(n))}):null}function Ep(t,e){return t??(e?"maintenance":null)}function Ip({maintenance:t=!1}={}){const e=L(),n=Ep(Mt.value,t);if(n===null)return null;const r=n==="no-token"?e.errorSessionNoToken:n==="unauthorized"?e.errorSessionUnauthorized:n==="signed-out"?e.errorSessionSignedOut:n==="unavailable"?e.errorSessionUnavailable:n==="network"?e.errorNetwork:n==="maintenance"?e.errorMaintenance:e.somethingWentWrong;return s("div",{class:"jex-session-error-notice",role:"alert","aria-live":"assertive",children:r})}function Mp({size:t=18}){return s("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",children:[s("path",{d:"M22 2 11 13"}),s("path",{d:"M22 2 15 22 11 13 2 9l20-7z"})]})}const Bl=132;function Pp({onSend:t,onFiles:e}){const n=oe(null),r=oe(null);N(()=>{const u=n.current;if(!u)return;u.style.height="0";const d=Math.min(u.scrollHeight,Bl);u.style.height=`${d}px`,u.style.overflowY=u.scrollHeight>Bl?"auto":"hidden"},[It.value]);const i=oe(ir.value);N(()=>{if(ir.value===i.current)return;i.current=ir.value;const u=n.current;u&&(u.focus(),u.setSelectionRange(u.value.length,u.value.length))},[ir.value]);function o(u){u.key==="Enter"&&!u.shiftKey&&(u.preventDefault(),t())}function a(){r.current?.click()}function l(u){const d=u.currentTarget;d.files&&d.files.length>0&&e(Array.from(d.files)),d.value=""}function c(u){const d=u.target;(d===u.currentTarget||!d.closest("button, textarea, img"))&&n.current?.focus()}return{textareaRef:n,fileInputRef:r,onKeyDown:o,onAttachClick:a,onFilesPicked:l,onCardClick:c}}function Np(t){return!t||t.isSecureContext!==!0?null:t.SpeechRecognition??t.webkitSpeechRecognition??null}function Op(t){return t==="en"?"en-US":"de-DE"}function Lp(t){switch(t){case"not-allowed":case"service-not-allowed":return"permission";case"audio-capture":return"no-mic";case"no-speech":return"no-speech";case"language-not-supported":return"lang";case"aborted":return null;default:return"network"}}function $p(t,e){const n=`voice error ${e} (raw: ${t})`;return e!=="network"?n:`${n} — the browser's speech service is unreachable. Brave and some Chromium forks ship without one; Firefox has none. Not an app bug. Works in Chrome/Edge/Safari.`}function Dp(t){let e="";for(let n=0;n<t.results.length;n++)e+=t.results[n]?.[0]?.transcript??"";return e}function zp(t,e){const n=e.trim();return n?t===""||/\s$/.test(t)?t+n:`${t} ${n}`:t}const qp=.01,Fp=4;function Bp(t){if(t.length===0)return 0;let e=0;for(let r=0;r<t.length;r++){const i=t[r]??0;e+=i*i}const n=Math.sqrt(e/t.length);return n<qp?0:Math.round(Math.min(1,n*Fp)*20)/20}const Up=6e4,Vp=300;function Hp(){return window.matchMedia?.("(pointer: coarse)").matches===!0}function Wp({locale:t,getDraft:e,setDraft:n}){const[r]=$(()=>Np(typeof window>"u"?void 0:window)),[i,o]=$(!1),[a,l]=$(null),c=oe(null),u=oe(""),d=oe(""),m=oe(null),f=oe(0),p=oe(!1),x=oe(!1),v=oe(0),k=oe(!1),w=oe(!1);function b(){m.current&&(clearTimeout(m.current),m.current=null);const T=c.current;T&&(T.onresult=null,T.onerror=null,T.onend=null,J.debug("[jexity] voice stop",{ms:Date.now()-v.current})),c.current=null,x.current=!1,o(!1)}function I(){l(null);const T=c.current;if(T){try{T.abort()}catch{}b()}}function C(){if(!r||c.current)return;if(k.current){l("permission");return}if(w.current){l("network");return}l(null);const T=new r;T.lang=Op(t),T.continuous=!Hp(),T.interimResults=!0,u.current=e(),d.current=u.current,p.current=!1,T.onresult=M=>{if(e()!==d.current){I();return}const P=zp(u.current,Dp(M));d.current=P,n(P)},T.onerror=M=>{const P=Lp(M.error);if(P!==null){if(P==="no-speech"){p.current||(p.current=!0,x.current=!0);return}P==="permission"&&(k.current=!0),P==="network"&&(w.current=!0),l(P),J.warn(`[jexity] ${$p(M.error,P)}`)}},T.onend=()=>{if(x.current&&c.current===T){x.current=!1,u.current=d.current;try{T.start();return}catch{}}b()};try{T.start()}catch{l("network");return}c.current=T,v.current=Date.now(),o(!0),m.current=setTimeout(()=>{c.current?.stop()},Up),J.debug("[jexity] voice start",{lang:T.lang})}function E(){const T=Date.now();if(T-f.current<Vp)return;f.current=T;const M=c.current;if(M){x.current=!1,M.stop();return}C()}return N(()=>{if(!r)return;navigator.permissions?.query({name:"microphone"}).then(M=>{k.current=M.state==="denied",M.onchange=()=>{k.current=M.state==="denied"}}).catch(()=>{});const T=()=>{document.visibilityState==="hidden"&&I()};return document.addEventListener("visibilitychange",T),()=>{document.removeEventListener("visibilitychange",T),I()}},[]),{supported:r!==null,listening:i,error:a,toggle:E,cancel:I}}function Qp(t){const[e,n]=$(0);return N(()=>{if(!t||typeof window>"u"||window.matchMedia?.("(prefers-reduced-motion: reduce)").matches||window.matchMedia?.("(pointer: coarse)").matches||!navigator.mediaDevices?.getUserMedia)return;let r=!1,i=null,o=null,a=0;return navigator.mediaDevices.getUserMedia({audio:!0}).then(l=>{if(r){l.getTracks().forEach(m=>{m.stop()});return}i=l,o=new AudioContext;const c=o.createAnalyser();c.fftSize=512,o.createMediaStreamSource(l).connect(c);const u=new Float32Array(c.fftSize),d=()=>{c.getFloatTimeDomainData(u);const m=Bp(u);n(f=>f===m?f:m),a=requestAnimationFrame(d)};a=requestAnimationFrame(d)}).catch(()=>{}),()=>{r=!0,cancelAnimationFrame(a),i?.getTracks().forEach(l=>{l.stop()}),o?.close()}},[t]),t?e:0}function Gp({listening:t,disabled:e,onClick:n}){const r=L(),i=Qp(t);return s("button",{type:"button",class:`jex-attach-btn jex-mic-btn${t?" jex-mic-btn-listening":""}`,"aria-pressed":t,"aria-label":t?r.voiceStop:r.voiceStart,title:r.voiceProviderNote,disabled:e,onClick:n,children:[s("span",{class:"jex-mic-ring","aria-hidden":"true",style:{transform:`scale(${1+i*.6})`,opacity:t?.25+i*.5:0}}),s("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",children:[s("path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z"}),s("path",{d:"M19 10v2a7 7 0 0 1-14 0v-2"}),s("line",{x1:"12",y1:"19",x2:"12",y2:"22"})]})]})}function Kp({isStreaming:t,disabled:e,inputDisabled:n,onSend:r,onFocus:i,canAttach:o,onFiles:a}){const l=L(),c=It,u=Me,m=gt(se.functions.flags.getAll,{})?.voiceDictationEnabled===!0,f=Wp({locale:Qe.value,getDraft:()=>It.value,setDraft:Y=>{It.value=Y}});function p(){f.cancel(),r()}N(()=>{n&&f.cancel()},[n]),N(()=>{m||f.cancel()},[m]);function x(){if(!f.listening&&ni()){ri();return}f.toggle()}const v=f.error===null||f.error==="no-speech"?null:f.error,k={permission:l.voiceErrorPermission,"no-mic":l.voiceErrorNoMic,network:l.voiceErrorNetwork,lang:l.voiceErrorLang};let w="";v?w=k[v]:f.listening&&(w=`${l.voiceListening} ${l.voiceProviderNote}`);const{textareaRef:b,fileInputRef:I,onKeyDown:C,onAttachClick:E,onFilesPicked:T,onCardClick:M}=Pp({onSend:p,onFiles:a});function P(){if(ni()){ri();return}E()}const le=c.value.trim().length>0,B=u.value.length>0,D=Ll(),y=Io().length>0,A=(le||y)&&!e&&!D,z=u.value.find(Y=>Y.status==="failed");let ae="";return D?ae=l.attachmentUploading:z&&(ae=Fl(z.errorCode,l)),s("div",{class:"jex-composer-card",onClick:M,children:[s("p",{class:`jex-voice-status${v?" jex-voice-status-error":""}`,role:"status","aria-live":"polite",children:w||null}),s("p",{class:`jex-attachment-status${z&&!D?" jex-attachment-status-error":""}`,role:"status","aria-live":"polite",children:ae||null}),B&&s("div",{class:"jex-composer-attachments",role:"list",children:u.value.map(Y=>s("div",{class:"jex-attachment-chip",role:"listitem","data-status":Y.status,title:Y.status==="failed"?Fl(Y.errorCode,l):Y.file.name,children:[Y.previewUrl?s("img",{src:Y.previewUrl,alt:Y.file.name,class:"jex-attachment-thumb"}):s("span",{class:"jex-attachment-file",children:[s("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",children:[s("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),s("polyline",{points:"14 2 14 8 20 8"})]}),s("span",{class:"jex-attachment-file-name",children:Y.file.name})]}),s("button",{type:"button",class:"jex-attachment-remove","aria-label":l.removeAttachmentAriaLabel.replace("{name}",Y.file.name),onClick:()=>{Ol(Y.id)},children:s("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",children:[s("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),s("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},Y.id))}),B&&s("p",{class:"jex-attachment-note",children:l.attachmentPrivacy}),s("textarea",{ref:b,class:"jex-composer-textarea","aria-label":l.inputPlaceholder,placeholder:t?l.aiThinking:l.inputPlaceholder,value:c.value,rows:1,onInput:Y=>{c.value=Y.currentTarget.value},onKeyDown:C,onFocus:i,disabled:n}),s("div",{class:"jex-composer-actions",children:[s("div",{class:"jex-composer-actions-left",children:[o&&s(ne,{children:[s("input",{ref:I,class:"jex-visually-hidden",type:"file",accept:yp,multiple:!0,onChange:T,tabIndex:-1,"aria-hidden":"true"}),s("button",{type:"button",class:"jex-attach-btn","aria-label":l.attachFiles,title:l.attachFiles,disabled:n,onClick:P,children:s("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",children:s("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"})})})]}),m&&f.supported&&s(Gp,{listening:f.listening,disabled:n,onClick:x})]}),s("button",{class:`jex-send-btn${A?" jex-send-btn-active":""}`,type:"button",onClick:p,"aria-label":l.sendAriaLabel,disabled:e||D||!le&&!y,children:s(Mp,{size:16})})]})]})}function Yp(){const t=L(),e=jn.value;if(!e)return null;const n=e.role==="user"?t.quotedYourMessage:e.authorName;return s("div",{class:"jex-reply-preview",children:[s(Co,{size:13,class:"jex-reply-preview-icon"}),s("span",{class:"jex-reply-preview-text",children:[n&&s("span",{class:"jex-reply-preview-author",children:[n,": "]}),El(e.content)]}),s("button",{type:"button",class:"jex-reply-preview-cancel","aria-label":t.cancelReply,title:t.cancelReply,onClick:()=>{Ao(null)},children:s(mp,{size:14})})]})}function Ul({variant:t,isOpen:e=!1,onAcknowledge:n}){const r=L(),i=tr.value;return t==="explicit"?e?s("div",{class:"jex-privacy-explicit",role:"dialog","aria-label":r.privacyExplicitTitle,children:[s("div",{class:"jex-privacy-explicit-content",children:[s("div",{class:"jex-privacy-explicit-icon","aria-hidden":"true",children:s("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:s("path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"})})}),s("div",{class:"jex-privacy-explicit-copy",children:[s("div",{class:"jex-privacy-explicit-title",children:r.privacyExplicitTitle}),s("p",{class:"jex-privacy-explicit-body",children:[r.privacyExplicitBodyPre," ",s("a",{href:i,target:"_blank",rel:"noopener noreferrer",class:"jex-privacy-notice-link",children:r.privacyPolicyLinkText}),"."]})]})]}),s("button",{type:"button",class:"jex-privacy-explicit-button",onClick:n,children:r.privacyExplicitButton})]}):null:s("p",{class:"jex-privacy-chip",children:[s("span",{class:"jex-privacy-chip-icon","aria-hidden":"true",children:s("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:s("path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"})})}),s("a",{href:i,target:"_blank",rel:"noopener noreferrer",class:"jex-privacy-chip-link",children:r.privacyChipText})]})}function Jp({sessionId:t,visitorId:e,isLoading:n,isStreaming:r,sessionStatus:i,ensureSession:o,onStartFresh:a,maintenance:l=!1}){const c=L(),u=It,d=io.value,m=ql({sessionId:t,visitorId:e,ensureSession:o}),f=gt(se.functions.flags.getAll,{}),p=rl.value&&(i==="escalated"||i==="assigned")&&f?.mediaManagementMode==="live"&&!l,{addFiles:x}=Cp({sessionId:t,visitorId:e}),[v,k]=$(!1),w=i!==null&&f!==void 0;N(()=>{w&&!p&&Me.value.length>0&&Sp()},[w,p]),N(()=>{if(!v)return;const P=setTimeout(()=>{k(!1)},5e3);return()=>{clearTimeout(P)}},[v]);function b(P){x(P)>0&&k(!0)}const I=or.value!==null&&or.value>Ro.value,C=n||r||I||l,E=d==="explicit"&&ar.value;function T(){gp();const P=ti.value;ti.value=null,P!==null&&m(P)}if(i==="resolved")return s("div",{class:"jex-chat-input-resolved",children:[s("div",{class:"jex-resolved-notice",children:c.sessionResolved}),s("button",{class:"jex-resolved-new-btn",type:"button",onClick:()=>{a()},children:c.startNewConversation})]});async function M(){const P=u.value.trim();!P&&Io().length===0||C||Ll()||await m(P)}return s("div",{class:"jex-chat-input",children:[s(Rp,{}),s(Ip,{maintenance:l}),d==="chip"&&s(Ul,{variant:"chip"}),s(Yp,{}),v&&s("p",{class:"jex-attachment-status jex-attachment-status-error",role:"alert",children:c.attachmentRejected}),s("div",{class:`jex-chat-input-composer-gate${E?" jex-chat-input-composer-gate-open":""}`,children:[s(Kp,{isStreaming:r,disabled:C,inputDisabled:n||r||E||l,onSend:M,onFocus:ri,canAttach:p,onFiles:b}),d==="explicit"&&s(Ul,{variant:"explicit",isOpen:ar.value,onAcknowledge:T})]})]})}function No(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var en=No();function Vl(t){en=t}var tn={exec:()=>null};function Tn(t){let e=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=e[r];return i||(i=t(r),e[r]=i),i}}function Z(t,e=""){let n=typeof t=="string"?t:t.source,r={replace:(i,o)=>{let a=typeof o=="string"?o:o.source;return a=a.replace(Pe.caret,"$1"),n=n.replace(i,a),r},getRegex:()=>new RegExp(n,e)};return r}var Xp=((t="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+t)}catch{return!1}})(),Pe={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,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ 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,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:Tn(t=>new RegExp(`^ {0,${t}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Tn(t=>new RegExp(`^ {0,${t}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:Tn(t=>new RegExp(`^ {0,${t}}(?:\`\`\`|~~~)`)),headingBeginRegex:Tn(t=>new RegExp(`^ {0,${t}}#`)),htmlBeginRegex:Tn(t=>new RegExp(`^ {0,${t}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:Tn(t=>new RegExp(`^ {0,${t}}>`))},Zp=/^(?:[ \t]*(?:\n|$))+/,em=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,tm=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,cr=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,nm=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Oo=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Hl=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Wl=Z(Hl).replace(/bull/g,Oo).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(),rm=Z(Hl).replace(/bull/g,Oo).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(),Lo=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,im=/^[^\n]+/,$o=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,om=Z(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",$o).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),am=Z(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Oo).getRegex(),ii="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",Do=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,sm=Z("^ {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",Do).replace("tag",ii).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ql=Z(Lo).replace("hr",cr).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[.)])[ \\t]+[^ \\t\\n]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ii).getRegex(),lm=Z(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Ql).getRegex(),zo={blockquote:lm,code:em,def:om,fences:tm,heading:nm,hr:cr,html:sm,lheading:Wl,list:am,newline:Zp,paragraph:Ql,table:tn,text:im},Gl=Z("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",cr).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[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ii).getRegex(),cm={...zo,lheading:rm,table:Gl,paragraph:Z(Lo).replace("hr",cr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Gl).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ii).getRegex()},um={...zo,html:Z(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Do).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:tn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Z(Lo).replace("hr",cr).replace("heading",` *#{1,6} *[^
15
+ ]`).replace("lheading",Wl).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},dm=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,hm=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Kl=/^( {2,}|\\)\n(?!\s*$)/,fm=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Cn=/[\p{P}\p{S}]/u,oi=/[\s\p{P}\p{S}]/u,qo=/[^\s\p{P}\p{S}]/u,pm=Z(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,oi).getRegex(),Yl=/(?!~)[\p{P}\p{S}]/u,mm=/(?!~)[\s\p{P}\p{S}]/u,gm=/(?:[^\s\p{P}\p{S}]|~)/u,xm=Z(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Xp?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Jl=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,bm=Z(Jl,"u").replace(/punct/g,Cn).getRegex(),vm=Z(Jl,"u").replace(/punct/g,Yl).getRegex(),Xl="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",ym=Z(Xl,"gu").replace(/notPunctSpace/g,qo).replace(/punctSpace/g,oi).replace(/punct/g,Cn).getRegex(),wm=Z(Xl,"gu").replace(/notPunctSpace/g,gm).replace(/punctSpace/g,mm).replace(/punct/g,Yl).getRegex(),km=Z("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,qo).replace(/punctSpace/g,oi).replace(/punct/g,Cn).getRegex(),_m=Z(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Cn).getRegex(),jm="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Sm=Z(jm,"gu").replace(/notPunctSpace/g,qo).replace(/punctSpace/g,oi).replace(/punct/g,Cn).getRegex(),Tm=Z(/\\(punct)/,"gu").replace(/punct/g,Cn).getRegex(),Cm=Z(/^<(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(),Am=Z(Do).replace("(?:-->|$)","-->").getRegex(),Rm=Z("^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",Am).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),ai=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Em=Z(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",ai).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Zl=Z(/^!?\[(label)\]\[(ref)\]/).replace("label",ai).replace("ref",$o).getRegex(),ec=Z(/^!?\[(ref)\](?:\[\])?/).replace("ref",$o).getRegex(),Im=Z("reflink|nolink(?!\\()","g").replace("reflink",Zl).replace("nolink",ec).getRegex(),tc=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Fo={_backpedal:tn,anyPunctuation:Tm,autolink:Cm,blockSkip:xm,br:Kl,code:hm,del:tn,delLDelim:tn,delRDelim:tn,emStrongLDelim:bm,emStrongRDelimAst:ym,emStrongRDelimUnd:km,escape:dm,link:Em,nolink:ec,punctuation:pm,reflink:Zl,reflinkSearch:Im,tag:Rm,text:fm,url:tn},Mm={...Fo,link:Z(/^!?\[(label)\]\((.*?)\)/).replace("label",ai).getRegex(),reflink:Z(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ai).getRegex()},Bo={...Fo,emStrongRDelimAst:wm,emStrongLDelim:vm,delLDelim:_m,delRDelim:Sm,url:Z(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",tc).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:Z(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",tc).getRegex()},Pm={...Bo,br:Z(Kl).replace("{2,}","*").getRegex(),text:Z(Bo.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},si={normal:zo,gfm:cm,pedantic:um},ur={normal:Fo,gfm:Bo,breaks:Pm,pedantic:Mm},Nm={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},nc=t=>Nm[t];function vt(t,e){if(e){if(Pe.escapeTest.test(t))return t.replace(Pe.escapeReplace,nc)}else if(Pe.escapeTestNoEncode.test(t))return t.replace(Pe.escapeReplaceNoEncode,nc);return t}function rc(t){try{t=encodeURI(t).replace(Pe.percentDecode,"%")}catch{return null}return t}function ic(t,e){let n=t.replace(Pe.findPipe,(o,a,l)=>{let c=!1,u=a;for(;--u>=0&&l[u]==="\\";)c=!c;return c?"|":" |"}),r=n.split(Pe.splitPipe),i=0;if(r[0].trim()||r.shift(),r.length>0&&!r.at(-1)?.trim()&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;i<r.length;i++)r[i]=r[i].trim().replace(Pe.slashPipe,"|");return r}function qt(t,e,n){let r=t.length;if(r===0)return"";let i=0;for(;i<r&&t.charAt(r-i-1)===e;)i++;return t.slice(0,r-i)}function oc(t){let e=t.split(`
16
16
  `),n=e.length-1;for(;n>=0&&Pe.blankLine.test(e[n]);)n--;return e.length-n<=2?t:e.slice(0,n+1).join(`
17
- `)}function Tp(t,e){if(t.indexOf(e[1])===-1)return-1;let n=0;for(let r=0;r<t.length;r++)if(t[r]==="\\")r++;else if(t[r]===e[0])n++;else if(t[r]===e[1]&&(n--,n<0))return r;return n>0?-2:-1}function Cp(t,e=0){let n=e,r="";for(let i of t)if(i===" "){let o=4-n%4;r+=" ".repeat(o),n+=o}else r+=i,n++;return r}function Tl(t,e,n,r,i){let o=e.href,a=e.title||null,l=t[1].replace(i.other.outputLinkReplace,"$1");r.state.inLink=!0;let c={type:t[0].charAt(0)==="!"?"image":"link",raw:n,href:o,title:a,text:l,tokens:r.inlineTokens(l)};return r.state.inLink=!1,c}function Ap(t,e,n){let r=t.match(n.other.indentCodeCompensation);if(r===null)return e;let i=r[1];return e.split(`
17
+ `)}function Om(t,e){if(t.indexOf(e[1])===-1)return-1;let n=0;for(let r=0;r<t.length;r++)if(t[r]==="\\")r++;else if(t[r]===e[0])n++;else if(t[r]===e[1]&&(n--,n<0))return r;return n>0?-2:-1}function Lm(t,e=0){let n=e,r="";for(let i of t)if(i===" "){let o=4-n%4;r+=" ".repeat(o),n+=o}else r+=i,n++;return r}function ac(t,e,n,r,i){let o=e.href,a=e.title||null,l=t[1].replace(i.other.outputLinkReplace,"$1");r.state.inLink=!0;let c={type:t[0].charAt(0)==="!"?"image":"link",raw:n,href:o,title:a,text:l,tokens:r.inlineTokens(l)};return r.state.inLink=!1,c}function $m(t,e,n){let r=t.match(n.other.indentCodeCompensation);if(r===null)return e;let i=r[1];return e.split(`
18
18
  `).map(o=>{let a=o.match(n.other.beginningSpace);if(a===null)return o;let[l]=a;return l.length>=i.length?o.slice(i.length):o}).join(`
19
- `)}var Yr=class{options;rules;lexer;constructor(t){this.options=t||Qt}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 n=this.options.pedantic?e[0]:Sl(e[0]),r=n.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:n,codeBlockStyle:"indented",text:r}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let n=e[0],r=Ap(n,e[3]||"",this.rules);return{type:"code",raw:n,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:r}}}heading(t){let e=this.rules.block.heading.exec(t);if(e){let n=e[2].trim();if(this.rules.other.endingHash.test(n)){let r=Nt(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:Nt(e[0],`
20
- `),depth:e[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(t){let e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:Nt(e[0],`
21
- `)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let n=Nt(e[0],`
19
+ `)}var li=class{options;rules;lexer;constructor(t){this.options=t||en}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 n=this.options.pedantic?e[0]:oc(e[0]),r=n.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:n,codeBlockStyle:"indented",text:r}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let n=e[0],r=$m(n,e[3]||"",this.rules);return{type:"code",raw:n,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:r}}}heading(t){let e=this.rules.block.heading.exec(t);if(e){let n=e[2].trim();if(this.rules.other.endingHash.test(n)){let r=qt(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:qt(e[0],`
20
+ `),depth:e[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(t){let e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:qt(e[0],`
21
+ `)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let n=qt(e[0],`
22
22
  `).split(`
23
23
  `),r="",i="",o=[];for(;n.length>0;){let a=!1,l=[],c;for(c=0;c<n.length;c++)if(this.rules.other.blockquoteStart.test(n[c]))l.push(n[c]),a=!0;else if(!a)l.push(n[c]);else break;n=n.slice(c);let u=l.join(`
24
24
  `),d=u.replace(this.rules.other.blockquoteSetextReplace,`
25
25
  $1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
26
26
  ${u}`:u,i=i?`${i}
27
- ${d}`:d;let m=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(d,o,!0),this.lexer.state.top=m,n.length===0)break;let h=o.at(-1);if(h?.type==="code")break;if(h?.type==="blockquote"){let p=h,x=p.raw+`
27
+ ${d}`:d;let m=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(d,o,!0),this.lexer.state.top=m,n.length===0)break;let f=o.at(-1);if(f?.type==="code")break;if(f?.type==="blockquote"){let p=f,x=p.raw+`
28
28
  `+n.join(`
29
- `),w=this.blockquote(x);o[o.length-1]=w,r=r.substring(0,r.length-p.raw.length)+w.raw,i=i.substring(0,i.length-p.text.length)+w.text;break}else if(h?.type==="list"){let p=h,x=p.raw+`
29
+ `),v=this.blockquote(x);o[o.length-1]=v,r=r.substring(0,r.length-p.raw.length)+v.raw,i=i.substring(0,i.length-p.text.length)+v.text;break}else if(f?.type==="list"){let p=f,x=p.raw+`
30
30
  `+n.join(`
31
- `),w=this.list(x);o[o.length-1]=w,r=r.substring(0,r.length-h.raw.length)+w.raw,i=i.substring(0,i.length-p.raw.length)+w.raw,n=x.substring(o.at(-1).raw.length).split(`
32
- `);continue}}return{type:"blockquote",raw:r,tokens:o,text:i}}}list(t){let e=this.rules.block.list.exec(t);if(e){let n=e[1].trim(),r=n.length>1,i={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");let o=this.rules.other.listItemRegex(n),a=!1;for(;t;){let c=!1,u="",d="";if(!(e=o.exec(t))||this.rules.block.hr.test(t))break;u=e[0],t=t.substring(u.length);let m=Cp(e[2].split(`
33
- `,1)[0],e[1].length),h=t.split(`
34
- `,1)[0],p=!m.trim(),x=0;if(this.options.pedantic?(x=2,d=m.trimStart()):p?x=e[1].length+1:(x=m.search(this.rules.other.nonSpaceChar),x=x>4?1:x,d=m.slice(x),x+=e[1].length),p&&this.rules.other.blankLine.test(h)&&(u+=h+`
35
- `,t=t.substring(h.length+1),c=!0),!c){let w=this.rules.other.nextBulletRegex(x),b=this.rules.other.hrRegex(x),v=this.rules.other.fencesBeginRegex(x),k=this.rules.other.headingBeginRegex(x),A=this.rules.other.htmlBeginRegex(x),N=this.rules.other.blockquoteBeginRegex(x);for(;t;){let P=t.split(`
36
- `,1)[0],T;if(h=P,this.options.pedantic?(h=h.replace(this.rules.other.listReplaceNesting," "),T=h):T=h.replace(this.rules.other.tabCharGlobal," "),v.test(h)||k.test(h)||A.test(h)||N.test(h)||w.test(h)||b.test(h))break;if(T.search(this.rules.other.nonSpaceChar)>=x||!h.trim())d+=`
37
- `+T.slice(x);else{if(p||m.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||v.test(m)||k.test(m)||b.test(m))break;d+=`
38
- `+h}p=!h.trim(),u+=P+`
39
- `,t=t.substring(P.length+1),m=T.slice(x)}}i.loose||(a?i.loose=!0:this.rules.other.doubleBlankLine.test(u)&&(a=!0)),i.items.push({type:"list_item",raw:u,task:!!this.options.gfm&&this.rules.other.listIsTask.test(d),loose:!1,text:d,tokens:[]}),i.raw+=u}let l=i.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let c of i.items){this.lexer.state.top=!1,c.tokens=this.lexer.blockTokens(c.text,[]);let u=c.tokens[0];if(c.task&&(u?.type==="text"||u?.type==="paragraph")){c.text=c.text.replace(this.rules.other.listReplaceTask,""),u.raw=u.raw.replace(this.rules.other.listReplaceTask,""),u.text=u.text.replace(this.rules.other.listReplaceTask,"");for(let m=this.lexer.inlineQueue.length-1;m>=0;m--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[m].src)){this.lexer.inlineQueue[m].src=this.lexer.inlineQueue[m].src.replace(this.rules.other.listReplaceTask,"");break}let d=this.rules.other.listTaskCheckbox.exec(c.raw);if(d){let m={type:"checkbox",raw:d[0]+" ",checked:d[0]!=="[ ]"};c.checked=m.checked,i.loose?c.tokens[0]&&["paragraph","text"].includes(c.tokens[0].type)&&"tokens"in c.tokens[0]&&c.tokens[0].tokens?(c.tokens[0].raw=m.raw+c.tokens[0].raw,c.tokens[0].text=m.raw+c.tokens[0].text,c.tokens[0].tokens.unshift(m)):c.tokens.unshift({type:"paragraph",raw:m.raw,text:m.raw,tokens:[m]}):c.tokens.unshift(m)}}else c.task&&(c.task=!1);if(!i.loose){let d=c.tokens.filter(h=>h.type==="space"),m=d.length>0&&d.some(h=>this.rules.other.anyLine.test(h.raw));i.loose=m}}if(i.loose)for(let c of i.items){c.loose=!0;for(let u of c.tokens)u.type==="text"&&(u.type="paragraph")}return i}}html(t){let e=this.rules.block.html.exec(t);if(e){let n=Sl(e[0]);return{type:"html",block:!0,raw:n,pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:n}}}def(t){let e=this.rules.block.def.exec(t);if(e){let n=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:n,raw:Nt(e[0],`
40
- `),href:r,title:i}}}table(t){let e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let n=jl(e[1]),r=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
41
- `):[],o={type:"table",raw:Nt(e[0],`
42
- `),header:[],align:[],rows:[]};if(n.length===r.length){for(let a of r)this.rules.other.tableAlignRight.test(a)?o.align.push("right"):this.rules.other.tableAlignCenter.test(a)?o.align.push("center"):this.rules.other.tableAlignLeft.test(a)?o.align.push("left"):o.align.push(null);for(let a=0;a<n.length;a++)o.header.push({text:n[a],tokens:this.lexer.inline(n[a]),header:!0,align:o.align[a]});for(let a of i)o.rows.push(jl(a,o.header.length).map((l,c)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:o.align[c]})));return o}}lheading(t){let e=this.rules.block.lheading.exec(t);if(e){let n=e[1].trim();return{type:"heading",raw:Nt(e[0],`
31
+ `),v=this.list(x);o[o.length-1]=v,r=r.substring(0,r.length-f.raw.length)+v.raw,i=i.substring(0,i.length-p.raw.length)+v.raw,n=x.substring(o.at(-1).raw.length).split(`
32
+ `);continue}}return{type:"blockquote",raw:r,tokens:o,text:i}}}list(t){let e=this.rules.block.list.exec(t);if(e){let n=e[1].trim(),r=n.length>1,i={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");let o=this.rules.other.listItemRegex(n),a=!1;for(;t;){let c=!1,u="",d="";if(!(e=o.exec(t))||this.rules.block.hr.test(t))break;u=e[0],t=t.substring(u.length);let m=Lm(e[2].split(`
33
+ `,1)[0],e[1].length),f=t.split(`
34
+ `,1)[0],p=!m.trim(),x=0;if(this.options.pedantic?(x=2,d=m.trimStart()):p?x=e[1].length+1:(x=m.search(this.rules.other.nonSpaceChar),x=x>4?1:x,d=m.slice(x),x+=e[1].length),p&&this.rules.other.blankLine.test(f)&&(u+=f+`
35
+ `,t=t.substring(f.length+1),c=!0),!c){let v=this.rules.other.nextBulletRegex(x),k=this.rules.other.hrRegex(x),w=this.rules.other.fencesBeginRegex(x),b=this.rules.other.headingBeginRegex(x),I=this.rules.other.htmlBeginRegex(x),C=this.rules.other.blockquoteBeginRegex(x);for(;t;){let E=t.split(`
36
+ `,1)[0],T;if(f=E,this.options.pedantic?(f=f.replace(this.rules.other.listReplaceNesting," "),T=f):T=f.replace(this.rules.other.tabCharGlobal," "),w.test(f)||b.test(f)||I.test(f)||C.test(f)||v.test(f)||k.test(f))break;if(T.search(this.rules.other.nonSpaceChar)>=x||!f.trim())d+=`
37
+ `+T.slice(x);else{if(p||m.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||w.test(m)||b.test(m)||k.test(m))break;d+=`
38
+ `+f}p=!f.trim(),u+=E+`
39
+ `,t=t.substring(E.length+1),m=T.slice(x)}}i.loose||(a?i.loose=!0:this.rules.other.doubleBlankLine.test(u)&&(a=!0)),i.items.push({type:"list_item",raw:u,task:!!this.options.gfm&&this.rules.other.listIsTask.test(d),loose:!1,text:d,tokens:[]}),i.raw+=u}let l=i.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let c of i.items){this.lexer.state.top=!1,c.tokens=this.lexer.blockTokens(c.text,[]);let u=c.tokens[0];if(c.task&&(u?.type==="text"||u?.type==="paragraph")){c.text=c.text.replace(this.rules.other.listReplaceTask,""),u.raw=u.raw.replace(this.rules.other.listReplaceTask,""),u.text=u.text.replace(this.rules.other.listReplaceTask,"");for(let m=this.lexer.inlineQueue.length-1;m>=0;m--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[m].src)){this.lexer.inlineQueue[m].src=this.lexer.inlineQueue[m].src.replace(this.rules.other.listReplaceTask,"");break}let d=this.rules.other.listTaskCheckbox.exec(c.raw);if(d){let m={type:"checkbox",raw:d[0]+" ",checked:d[0]!=="[ ]"};c.checked=m.checked,i.loose?c.tokens[0]&&["paragraph","text"].includes(c.tokens[0].type)&&"tokens"in c.tokens[0]&&c.tokens[0].tokens?(c.tokens[0].raw=m.raw+c.tokens[0].raw,c.tokens[0].text=m.raw+c.tokens[0].text,c.tokens[0].tokens.unshift(m)):c.tokens.unshift({type:"paragraph",raw:m.raw,text:m.raw,tokens:[m]}):c.tokens.unshift(m)}}else c.task&&(c.task=!1);if(!i.loose){let d=c.tokens.filter(f=>f.type==="space"),m=d.length>0&&d.some(f=>this.rules.other.anyLine.test(f.raw));i.loose=m}}if(i.loose)for(let c of i.items){c.loose=!0;for(let u of c.tokens)u.type==="text"&&(u.type="paragraph")}return i}}html(t){let e=this.rules.block.html.exec(t);if(e){let n=oc(e[0]);return{type:"html",block:!0,raw:n,pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:n}}}def(t){let e=this.rules.block.def.exec(t);if(e){let n=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:n,raw:qt(e[0],`
40
+ `),href:r,title:i}}}table(t){let e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let n=ic(e[1]),r=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
41
+ `):[],o={type:"table",raw:qt(e[0],`
42
+ `),header:[],align:[],rows:[]};if(n.length===r.length){for(let a of r)this.rules.other.tableAlignRight.test(a)?o.align.push("right"):this.rules.other.tableAlignCenter.test(a)?o.align.push("center"):this.rules.other.tableAlignLeft.test(a)?o.align.push("left"):o.align.push(null);for(let a=0;a<n.length;a++)o.header.push({text:n[a],tokens:this.lexer.inline(n[a]),header:!0,align:o.align[a]});for(let a of i)o.rows.push(ic(a,o.header.length).map((l,c)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:o.align[c]})));return o}}lheading(t){let e=this.rules.block.lheading.exec(t);if(e){let n=e[1].trim();return{type:"heading",raw:qt(e[0],`
43
43
  `),depth:e[2].charAt(0)==="="?1:2,text:n,tokens:this.lexer.inline(n)}}}paragraph(t){let e=this.rules.block.paragraph.exec(t);if(e){let n=e[1].charAt(e[1].length-1)===`
44
- `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:n,tokens:this.lexer.inline(n)}}}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 n=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let o=Nt(n.slice(0,-1),"\\");if((n.length-o.length)%2===0)return}else{let o=Tp(e[2],"()");if(o===-2)return;if(o>-1){let a=(e[0].indexOf("!")===0?5:4)+e[1].length+o;e[2]=e[2].substring(0,o),e[0]=e[0].substring(0,a).trim(),e[3]=""}}let r=e[2],i="";if(this.options.pedantic){let o=this.rules.other.pedanticHrefTitle.exec(r);o&&(r=o[1],i=o[3])}else i=e[3]?e[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),Tl(e,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let n;if((n=this.rules.inline.reflink.exec(t))||(n=this.rules.inline.nolink.exec(t))){let r=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=e[r.toLowerCase()];if(!i){let o=n[0].charAt(0);return{type:"text",raw:o,text:o}}return Tl(n,i,n[0],this.lexer,this.rules)}}emStrong(t,e,n=""){let r=this.rules.inline.emStrongLDelim.exec(t);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let i=[...r[0]].length-1,o,a,l=i,c=0,u=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,e=e.slice(-1*t.length+i);(r=u.exec(e))!==null;){if(o=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!o)continue;if(a=[...o].length,r[3]||r[4]){l+=a;continue}else if((r[5]||r[6])&&i%3&&!((i+a)%3)){c+=a;continue}if(l-=a,l>0)continue;a=Math.min(a,a+l+c);let d=[...r[0]][0].length,m=t.slice(0,i+r.index+d+a);if(Math.min(i,a)%2){let p=m.slice(1,-1);return{type:"em",raw:m,text:p,tokens:this.lexer.inlineTokens(p)}}let h=m.slice(2,-2);return{type:"strong",raw:m,text:h,tokens:this.lexer.inlineTokens(h)}}}}codespan(t){let e=this.rules.inline.code.exec(t);if(e){let n=e[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(n),i=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&i&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:e[0],text:n}}}br(t){let e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t,e,n=""){let r=this.rules.inline.delLDelim.exec(t);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let i=[...r[0]].length-1,o,a,l=i,c=this.rules.inline.delRDelim;for(c.lastIndex=0,e=e.slice(-1*t.length+i);(r=c.exec(e))!==null;){if(o=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!o||(a=[...o].length,a!==i))continue;if(r[3]||r[4]){l+=a;continue}if(l-=a,l>0)continue;a=Math.min(a,a+l);let u=[...r[0]][0].length,d=t.slice(0,i+r.index+u+a),m=d.slice(i,-i);return{type:"del",raw:d,text:m,tokens:this.lexer.inlineTokens(m)}}}}autolink(t){let e=this.rules.inline.autolink.exec(t);if(e){let n,r;return e[2]==="@"?(n=e[1],r="mailto:"+n):(n=e[1],r=n),{type:"link",raw:e[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(t){let e;if(e=this.rules.inline.url.exec(t)){let n,r;if(e[2]==="@")n=e[0],r="mailto:"+n;else{let i;do i=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(i!==e[0]);n=e[0],e[1]==="www."?r="http://"+e[0]:r=e[0]}return{type:"link",raw:e[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(t){let e=this.rules.inline.text.exec(t);if(e){let n=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:n}}}},tt=class Uo{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Qt,this.options.tokenizer=this.options.tokenizer||new Yr,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 n={other:Pe,block:Kr.normal,inline:er.normal};this.options.pedantic?(n.block=Kr.pedantic,n.inline=er.pedantic):this.options.gfm&&(n.block=Kr.gfm,this.options.breaks?n.inline=er.breaks:n.inline=er.gfm),this.tokenizer.rules=n}static get rules(){return{block:Kr,inline:er}}static lex(e,n){return new Uo(n).lex(e)}static lexInline(e,n){return new Uo(n).inlineTokens(e)}lex(e){e=e.replace(Pe.carriageReturn,`
44
+ `?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:n,tokens:this.lexer.inline(n)}}}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 n=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let o=qt(n.slice(0,-1),"\\");if((n.length-o.length)%2===0)return}else{let o=Om(e[2],"()");if(o===-2)return;if(o>-1){let a=(e[0].indexOf("!")===0?5:4)+e[1].length+o;e[2]=e[2].substring(0,o),e[0]=e[0].substring(0,a).trim(),e[3]=""}}let r=e[2],i="";if(this.options.pedantic){let o=this.rules.other.pedanticHrefTitle.exec(r);o&&(r=o[1],i=o[3])}else i=e[3]?e[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),ac(e,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let n;if((n=this.rules.inline.reflink.exec(t))||(n=this.rules.inline.nolink.exec(t))){let r=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=e[r.toLowerCase()];if(!i){let o=n[0].charAt(0);return{type:"text",raw:o,text:o}}return ac(n,i,n[0],this.lexer,this.rules)}}emStrong(t,e,n=""){let r=this.rules.inline.emStrongLDelim.exec(t);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let i=[...r[0]].length-1,o,a,l=i,c=0,u=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,e=e.slice(-1*t.length+i);(r=u.exec(e))!==null;){if(o=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!o)continue;if(a=[...o].length,r[3]||r[4]){l+=a;continue}else if((r[5]||r[6])&&i%3&&!((i+a)%3)){c+=a;continue}if(l-=a,l>0)continue;a=Math.min(a,a+l+c);let d=[...r[0]][0].length,m=t.slice(0,i+r.index+d+a);if(Math.min(i,a)%2){let p=m.slice(1,-1);return{type:"em",raw:m,text:p,tokens:this.lexer.inlineTokens(p)}}let f=m.slice(2,-2);return{type:"strong",raw:m,text:f,tokens:this.lexer.inlineTokens(f)}}}}codespan(t){let e=this.rules.inline.code.exec(t);if(e){let n=e[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(n),i=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&i&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:e[0],text:n}}}br(t){let e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t,e,n=""){let r=this.rules.inline.delLDelim.exec(t);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let i=[...r[0]].length-1,o,a,l=i,c=this.rules.inline.delRDelim;for(c.lastIndex=0,e=e.slice(-1*t.length+i);(r=c.exec(e))!==null;){if(o=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!o||(a=[...o].length,a!==i))continue;if(r[3]||r[4]){l+=a;continue}if(l-=a,l>0)continue;a=Math.min(a,a+l);let u=[...r[0]][0].length,d=t.slice(0,i+r.index+u+a),m=d.slice(i,-i);return{type:"del",raw:d,text:m,tokens:this.lexer.inlineTokens(m)}}}}autolink(t){let e=this.rules.inline.autolink.exec(t);if(e){let n,r;return e[2]==="@"?(n=e[1],r="mailto:"+n):(n=e[1],r=n),{type:"link",raw:e[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(t){let e;if(e=this.rules.inline.url.exec(t)){let n,r;if(e[2]==="@")n=e[0],r="mailto:"+n;else{let i;do i=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(i!==e[0]);n=e[0],e[1]==="www."?r="http://"+e[0]:r=e[0]}return{type:"link",raw:e[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(t){let e=this.rules.inline.text.exec(t);if(e){let n=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:n}}}},it=class _a{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||en,this.options.tokenizer=this.options.tokenizer||new li,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 n={other:Pe,block:si.normal,inline:ur.normal};this.options.pedantic?(n.block=si.pedantic,n.inline=ur.pedantic):this.options.gfm&&(n.block=si.gfm,this.options.breaks?n.inline=ur.breaks:n.inline=ur.gfm),this.tokenizer.rules=n}static get rules(){return{block:si,inline:ur}}static lex(e,n){return new _a(n).lex(e)}static lexInline(e,n){return new _a(n).inlineTokens(e)}lex(e){e=e.replace(Pe.carriageReturn,`
45
45
  `),this.blockTokens(e,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let r=this.inlineQueue[n];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,n=[],r=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(Pe.tabCharGlobal," ").replace(Pe.spaceLine,""));let i=1/0;for(;e;){if(e.length<i)i=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let o;if(this.options.extensions?.block?.some(l=>(o=l.call({lexer:this},e,n))?(e=e.substring(o.raw.length),n.push(o),!0):!1))continue;if(o=this.tokenizer.space(e)){e=e.substring(o.raw.length);let l=n.at(-1);o.raw.length===1&&l!==void 0?l.raw+=`
46
46
  `:n.push(o);continue}if(o=this.tokenizer.code(e)){e=e.substring(o.raw.length);let l=n.at(-1);l?.type==="paragraph"||l?.type==="text"?(l.raw+=(l.raw.endsWith(`
47
47
  `)?"":`
@@ -55,9 +55,9 @@ ${d}`:d;let m=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
55
55
  `+o.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.text):n.push(o),r=a.length!==e.length,e=e.substring(o.raw.length);continue}if(o=this.tokenizer.text(e)){e=e.substring(o.raw.length);let l=n.at(-1);l?.type==="text"?(l.raw+=(l.raw.endsWith(`
56
56
  `)?"":`
57
57
  `)+o.raw,l.text+=`
58
- `+o.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.text):n.push(o);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,n}inline(e,n=[]){return this.inlineQueue.push({src:e,tokens:n}),n}inlineTokens(e,n=[]){this.tokenizer.lexer=this;let r=e,i=null;if(this.tokens.links){let u=Object.keys(this.tokens.links);if(u.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(r))!==null;)u.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(r))!==null;)r=r.slice(0,i.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let o;for(;(i=this.tokenizer.rules.inline.blockSkip.exec(r))!==null;)o=i[2]?i[2].length:0,r=r.slice(0,i.index+o)+"["+"a".repeat(i[0].length-o-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);r=this.options.hooks?.emStrongMask?.call({lexer:this},r)??r;let a=!1,l="",c=1/0;for(;e;){if(e.length<c)c=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}a||(l=""),a=!1;let u;if(this.options.extensions?.inline?.some(m=>(u=m.call({lexer:this},e,n))?(e=e.substring(u.raw.length),n.push(u),!0):!1))continue;if(u=this.tokenizer.escape(e)){e=e.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.tag(e)){e=e.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.link(e)){e=e.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(u.raw.length);let m=n.at(-1);u.type==="text"&&m?.type==="text"?(m.raw+=u.raw,m.text+=u.text):n.push(u);continue}if(u=this.tokenizer.emStrong(e,r,l)){e=e.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.codespan(e)){e=e.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.br(e)){e=e.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.del(e,r,l)){e=e.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.autolink(e)){e=e.substring(u.raw.length),n.push(u);continue}if(!this.state.inLink&&(u=this.tokenizer.url(e))){e=e.substring(u.raw.length),n.push(u);continue}let d=e;if(this.options.extensions?.startInline){let m=1/0,h=e.slice(1),p;this.options.extensions.startInline.forEach(x=>{p=x.call({lexer:this},h),typeof p=="number"&&p>=0&&(m=Math.min(m,p))}),m<1/0&&m>=0&&(d=e.substring(0,m+1))}if(u=this.tokenizer.inlineText(d)){e=e.substring(u.raw.length),u.raw.slice(-1)!=="_"&&(l=u.raw.slice(-1)),a=!0;let m=n.at(-1);m?.type==="text"?(m.raw+=u.raw,m.text+=u.text):n.push(u);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return n}infiniteLoopError(e){let n="Infinite loop on byte: "+e;if(this.options.silent)console.error(n);else throw new Error(n)}},Jr=class{options;parser;constructor(t){this.options=t||Qt}space(t){return""}code({text:t,lang:e,escaped:n}){let r=(e||"").match(Pe.notSpaceStart)?.[0],i=t.replace(Pe.endingNewline,"")+`
59
- `;return r?'<pre><code class="language-'+dt(r)+'">'+(n?i:dt(i,!0))+`</code></pre>
60
- `:"<pre><code>"+(n?i:dt(i,!0))+`</code></pre>
58
+ `+o.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.text):n.push(o);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,n}inline(e,n=[]){return this.inlineQueue.push({src:e,tokens:n}),n}inlineTokens(e,n=[]){this.tokenizer.lexer=this;let r=e,i=null;if(this.tokens.links){let u=Object.keys(this.tokens.links);if(u.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(r))!==null;)u.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(r))!==null;)r=r.slice(0,i.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let o;for(;(i=this.tokenizer.rules.inline.blockSkip.exec(r))!==null;)o=i[2]?i[2].length:0,r=r.slice(0,i.index+o)+"["+"a".repeat(i[0].length-o-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);r=this.options.hooks?.emStrongMask?.call({lexer:this},r)??r;let a=!1,l="",c=1/0;for(;e;){if(e.length<c)c=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}a||(l=""),a=!1;let u;if(this.options.extensions?.inline?.some(m=>(u=m.call({lexer:this},e,n))?(e=e.substring(u.raw.length),n.push(u),!0):!1))continue;if(u=this.tokenizer.escape(e)){e=e.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.tag(e)){e=e.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.link(e)){e=e.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(u.raw.length);let m=n.at(-1);u.type==="text"&&m?.type==="text"?(m.raw+=u.raw,m.text+=u.text):n.push(u);continue}if(u=this.tokenizer.emStrong(e,r,l)){e=e.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.codespan(e)){e=e.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.br(e)){e=e.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.del(e,r,l)){e=e.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.autolink(e)){e=e.substring(u.raw.length),n.push(u);continue}if(!this.state.inLink&&(u=this.tokenizer.url(e))){e=e.substring(u.raw.length),n.push(u);continue}let d=e;if(this.options.extensions?.startInline){let m=1/0,f=e.slice(1),p;this.options.extensions.startInline.forEach(x=>{p=x.call({lexer:this},f),typeof p=="number"&&p>=0&&(m=Math.min(m,p))}),m<1/0&&m>=0&&(d=e.substring(0,m+1))}if(u=this.tokenizer.inlineText(d)){e=e.substring(u.raw.length),u.raw.slice(-1)!=="_"&&(l=u.raw.slice(-1)),a=!0;let m=n.at(-1);m?.type==="text"?(m.raw+=u.raw,m.text+=u.text):n.push(u);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return n}infiniteLoopError(e){let n="Infinite loop on byte: "+e;if(this.options.silent)console.error(n);else throw new Error(n)}},ci=class{options;parser;constructor(t){this.options=t||en}space(t){return""}code({text:t,lang:e,escaped:n}){let r=(e||"").match(Pe.notSpaceStart)?.[0],i=t.replace(Pe.endingNewline,"")+`
59
+ `;return r?'<pre><code class="language-'+vt(r)+'">'+(n?i:vt(i,!0))+`</code></pre>
60
+ `:"<pre><code>"+(n?i:vt(i,!0))+`</code></pre>
61
61
  `}blockquote({tokens:t}){return`<blockquote>
62
62
  ${this.parser.parse(t)}</blockquote>
63
63
  `}html({text:t}){return t}def(t){return""}heading({tokens:t,depth:e}){return`<h${e}>${this.parser.parseInline(t)}</h${e}>
@@ -73,12 +73,12 @@ ${this.parser.parse(t)}</blockquote>
73
73
  `}tablerow({text:t}){return`<tr>
74
74
  ${t}</tr>
75
75
  `}tablecell(t){let e=this.parser.parseInline(t.tokens),n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>
76
- `}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>${dt(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:n}){let r=this.parser.parseInline(n),i=_l(t);if(i===null)return r;t=i;let o='<a href="'+t+'"';return e&&(o+=' title="'+dt(e)+'"'),o+=">"+r+"</a>",o}image({href:t,title:e,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=_l(t);if(i===null)return dt(n);t=i;let o=`<img src="${t}" alt="${dt(n)}"`;return e&&(o+=` title="${dt(e)}"`),o+=">",o}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:dt(t.text)}},wo=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""}checkbox({raw:t}){return t}},nt=class Bo{options;renderer;textRenderer;constructor(e){this.options=e||Qt,this.options.renderer=this.options.renderer||new Jr,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new wo}static parse(e,n){return new Bo(n).parse(e)}static parseInline(e,n){return new Bo(n).parseInline(e)}parse(e){this.renderer.parser=this;let n="";for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let a=i,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)){n+=l||"";continue}}let o=i;switch(o.type){case"space":{n+=this.renderer.space(o);break}case"hr":{n+=this.renderer.hr(o);break}case"heading":{n+=this.renderer.heading(o);break}case"code":{n+=this.renderer.code(o);break}case"table":{n+=this.renderer.table(o);break}case"blockquote":{n+=this.renderer.blockquote(o);break}case"list":{n+=this.renderer.list(o);break}case"checkbox":{n+=this.renderer.checkbox(o);break}case"html":{n+=this.renderer.html(o);break}case"def":{n+=this.renderer.def(o);break}case"paragraph":{n+=this.renderer.paragraph(o);break}case"text":{n+=this.renderer.text(o);break}default:{let a='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return n}parseInline(e,n=this.renderer){this.renderer.parser=this;let r="";for(let i=0;i<e.length;i++){let o=e[i];if(this.options.extensions?.renderers?.[o.type]){let l=this.options.extensions.renderers[o.type].call({parser:this},o);if(l!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){r+=l||"";continue}}let a=o;switch(a.type){case"escape":{r+=n.text(a);break}case"html":{r+=n.html(a);break}case"link":{r+=n.link(a);break}case"image":{r+=n.image(a);break}case"checkbox":{r+=n.checkbox(a);break}case"strong":{r+=n.strong(a);break}case"em":{r+=n.em(a);break}case"codespan":{r+=n.codespan(a);break}case"br":{r+=n.br(a);break}case"del":{r+=n.del(a);break}case"text":{r+=n.text(a);break}default:{let l='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return r}},tr=class{options;block;constructor(t){this.options=t||Qt}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(t=this.block){return t?tt.lex:tt.lexInline}provideParser(t=this.block){return t?nt.parse:nt.parseInline}},Rp=class{defaults=ho();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=nt;Renderer=Jr;TextRenderer=wo;Lexer=tt;Tokenizer=Yr;Hooks=tr;constructor(...t){this.use(...t)}walkTokens(t,e){let n=[];for(let r of t)switch(n=n.concat(e.call(this,r)),r.type){case"table":{let i=r;for(let o of i.header)n=n.concat(this.walkTokens(o.tokens,e));for(let o of i.rows)for(let a of o)n=n.concat(this.walkTokens(a.tokens,e));break}case"list":{let i=r;n=n.concat(this.walkTokens(i.items,e));break}default:{let i=r;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(o=>{let a=i[o].flat(1/0);n=n.concat(this.walkTokens(a,e))}):i.tokens&&(n=n.concat(this.walkTokens(i.tokens,e)))}}return n}use(...t){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(n=>{let r={...n};if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let o=e.renderers[i.name];o?e.renderers[i.name]=function(...a){let l=i.renderer.apply(this,a);return l===!1&&(l=o.apply(this,a)),l}:e.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let o=e[i.level];o?o.unshift(i.tokenizer):e[i.level]=[i.tokenizer],i.start&&(i.level==="block"?e.startBlock?e.startBlock.push(i.start):e.startBlock=[i.start]:i.level==="inline"&&(e.startInline?e.startInline.push(i.start):e.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(e.childTokens[i.name]=i.childTokens)}),r.extensions=e),n.renderer){let i=this.defaults.renderer||new Jr(this.defaults);for(let o in n.renderer){if(!(o in i))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;let a=o,l=n.renderer[a],c=i[a];i[a]=(...u)=>{let d=l.apply(i,u);return d===!1&&(d=c.apply(i,u)),d||""}}r.renderer=i}if(n.tokenizer){let i=this.defaults.tokenizer||new Yr(this.defaults);for(let o in n.tokenizer){if(!(o in i))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;let a=o,l=n.tokenizer[a],c=i[a];i[a]=(...u)=>{let d=l.apply(i,u);return d===!1&&(d=c.apply(i,u)),d}}r.tokenizer=i}if(n.hooks){let i=this.defaults.hooks||new tr;for(let o in n.hooks){if(!(o in i))throw new Error(`hook '${o}' does not exist`);if(["options","block"].includes(o))continue;let a=o,l=n.hooks[a],c=i[a];tr.passThroughHooks.has(o)?i[a]=u=>{if(this.defaults.async&&tr.passThroughHooksRespectAsync.has(o))return(async()=>{let m=await l.call(i,u);return c.call(i,m)})();let d=l.call(i,u);return c.call(i,d)}:i[a]=(...u)=>{if(this.defaults.async)return(async()=>{let m=await l.apply(i,u);return m===!1&&(m=await c.apply(i,u)),m})();let d=l.apply(i,u);return d===!1&&(d=c.apply(i,u)),d}}r.hooks=i}if(n.walkTokens){let i=this.defaults.walkTokens,o=n.walkTokens;r.walkTokens=function(a){let l=[];return l.push(o.call(this,a)),i&&(l=l.concat(i.call(this,a))),l}}this.defaults={...this.defaults,...r}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return tt.lex(t,e??this.defaults)}parser(t,e){return nt.parse(t,e??this.defaults)}parseMarkdown(t){return(e,n)=>{let r={...n},i={...this.defaults,...r},o=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.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(i.hooks&&(i.hooks.options=i,i.hooks.block=t),i.async)return(async()=>{let a=i.hooks?await i.hooks.preprocess(e):e,l=await(i.hooks?await i.hooks.provideLexer(t):t?tt.lex:tt.lexInline)(a,i),c=i.hooks?await i.hooks.processAllTokens(l):l;i.walkTokens&&await Promise.all(this.walkTokens(c,i.walkTokens));let u=await(i.hooks?await i.hooks.provideParser(t):t?nt.parse:nt.parseInline)(c,i);return i.hooks?await i.hooks.postprocess(u):u})().catch(o);try{i.hooks&&(e=i.hooks.preprocess(e));let a=(i.hooks?i.hooks.provideLexer(t):t?tt.lex:tt.lexInline)(e,i);i.hooks&&(a=i.hooks.processAllTokens(a)),i.walkTokens&&this.walkTokens(a,i.walkTokens);let l=(i.hooks?i.hooks.provideParser(t):t?nt.parse:nt.parseInline)(a,i);return i.hooks&&(l=i.hooks.postprocess(l)),l}catch(a){return o(a)}}}onError(t,e){return n=>{if(n.message+=`
77
- Please report this to https://github.com/markedjs/marked.`,t){let r="<p>An error occurred:</p><pre>"+dt(n.message+"",!0)+"</pre>";return e?Promise.resolve(r):r}if(e)return Promise.reject(n);throw n}}},Kt=new Rp;function K(t,e){return Kt.parse(t,e)}K.options=K.setOptions=function(t){return Kt.setOptions(t),K.defaults=Kt.defaults,ul(K.defaults),K},K.getDefaults=ho,K.defaults=Qt,K.use=function(...t){return Kt.use(...t),K.defaults=Kt.defaults,ul(K.defaults),K},K.walkTokens=function(t,e){return Kt.walkTokens(t,e)},K.parseInline=Kt.parseInline,K.Parser=nt,K.parser=nt.parse,K.Renderer=Jr,K.TextRenderer=wo,K.Lexer=tt,K.lexer=tt.lex,K.Tokenizer=Yr,K.Hooks=tr,K.parse=K,K.options,K.setOptions,K.use,K.walkTokens,K.parseInline,nt.parse,tt.lex;function Cl(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Ep(t){if(Array.isArray(t))return t}function Ip(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,o,a,l=[],c=!0,u=!1;try{if(o=(n=n.call(t)).next,e!==0)for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,i=d}finally{try{if(!c&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw i}}return l}}function Pp(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
78
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Mp(t,e){return Ep(t)||Ip(t,e)||Np(t,e)||Pp()}function Np(t,e){if(t){if(typeof t=="string")return Cl(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Cl(t,e):void 0}}const Al=Object.entries,Rl=Object.setPrototypeOf,Lp=Object.isFrozen,Op=Object.getPrototypeOf,$p=Object.getOwnPropertyDescriptor;let Te=Object.freeze,Ce=Object.seal,wn=Object.create,El=typeof Reflect<"u"&&Reflect,ko=El.apply,_o=El.construct;Te||(Te=function(e){return e}),Ce||(Ce=function(e){return e}),ko||(ko=function(e,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),o=2;o<r;o++)i[o-2]=arguments[o];return e.apply(n,i)}),_o||(_o=function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return new e(...r)});const nr=ve(Array.prototype.forEach),Dp=ve(Array.prototype.lastIndexOf),Il=ve(Array.prototype.pop),kn=ve(Array.prototype.push),qp=ve(Array.prototype.splice),Lt=Array.isArray,rr=ve(String.prototype.toLowerCase),jo=ve(String.prototype.toString),Pl=ve(String.prototype.match),ir=ve(String.prototype.replace),Ml=ve(String.prototype.indexOf),zp=ve(String.prototype.trim),Fp=ve(Number.prototype.toString),Up=ve(Boolean.prototype.toString),Nl=typeof BigInt>"u"?null:ve(BigInt.prototype.toString),Ll=typeof Symbol>"u"?null:ve(Symbol.prototype.toString),_e=ve(Object.prototype.hasOwnProperty),or=ve(Object.prototype.toString),Ae=ve(RegExp.prototype.test),Yt=Bp(TypeError);function ve(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return ko(t,e,r)}}function Bp(t){return function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return _o(t,n)}}function Q(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:rr;if(Rl&&Rl(t,null),!Lt(e))return t;let r=e.length;for(;r--;){let i=e[r];if(typeof i=="string"){const o=n(i);o!==i&&(Lp(e)||(e[r]=o),i=o)}t[i]=!0}return t}function Vp(t){for(let e=0;e<t.length;e++)_e(t,e)||(t[e]=null);return t}function Le(t){const e=wn(null);for(const r of Al(t)){var n=Mp(r,2);const i=n[0],o=n[1];_e(t,i)&&(Lt(o)?e[i]=Vp(o):o&&typeof o=="object"&&o.constructor===Object?e[i]=Le(o):e[i]=o)}return e}function Hp(t){switch(typeof t){case"string":return t;case"number":return Fp(t);case"boolean":return Up(t);case"bigint":return Nl?Nl(t):"0";case"symbol":return Ll?Ll(t):"Symbol()";case"undefined":return or(t);case"function":case"object":{if(t===null)return or(t);const e=t,n=ht(e,"toString");if(typeof n=="function"){const r=n(e);return typeof r=="string"?r:or(r)}return or(t)}default:return or(t)}}function ht(t,e){for(;t!==null;){const r=$p(t,e);if(r){if(r.get)return ve(r.get);if(typeof r.value=="function")return ve(r.value)}t=Op(t)}function n(){return null}return n}function Wp(t){try{return Ae(t,""),!0}catch{return!1}}const Ol=Te(["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"]),So=Te(["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"]),To=Te(["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"]),Qp=Te(["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"]),Co=Te(["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"]),Gp=Te(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),$l=Te(["#text"]),Dl=Te(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","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"]),Ao=Te(["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"]),ql=Te(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","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"]),Xr=Te(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Kp=Ce(/{{[\w\W]*|^[\w\W]*}}/g),Yp=Ce(/<%[\w\W]*|^[\w\W]*%>/g),Jp=Ce(/\${[\w\W]*/g),Xp=Ce(/^data-[\-\w.\u00B7-\uFFFF]+$/),Zp=Ce(/^aria-[\-\w]+$/),zl=Ce(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),em=Ce(/^(?:\w+script|data):/i),tm=Ce(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),nm=Ce(/^html$/i),rm=Ce(/^[a-z][.\w]*(-[.\w]+)+$/i),Fl=Ce(/<[/\w!]/g),im=Ce(/<[/\w]/g),om=Ce(/<\/no(script|embed|frames)/i),am=Ce(/\/>/i),ft={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},sm=function(){return typeof window>"u"?null:window},lm=function(e,n){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let r=null;const i="data-tt-policy-suffix";n&&n.hasAttribute(i)&&(r=n.getAttribute(i));const o="dompurify"+(r?"#"+r:"");try{return e.createPolicy(o,{createHTML(a){return a},createScriptURL(a){return a}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},Ul=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Ot=function(e,n,r,i){return _e(e,n)&&Lt(e[n])?Q(i.base?Le(i.base):{},e[n],i.transform):r};function Bl(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:sm();const e=S=>Bl(S);if(e.version="3.4.11",e.removed=[],!t||!t.document||t.document.nodeType!==ft.document||!t.Element)return e.isSupported=!1,e;let n=t.document;const r=n,i=r.currentScript;t.DocumentFragment;const o=t.HTMLTemplateElement,a=t.Node,l=t.Element,c=t.NodeFilter,u=t.NamedNodeMap;u===void 0&&(t.NamedNodeMap||t.MozNamedAttrMap),t.HTMLFormElement;const d=t.DOMParser,m=t.trustedTypes,h=l.prototype,p=ht(h,"cloneNode"),x=ht(h,"remove"),w=ht(h,"nextSibling"),b=ht(h,"childNodes"),v=ht(h,"parentNode"),k=ht(h,"shadowRoot"),A=ht(h,"attributes"),N=a&&a.prototype?ht(a.prototype,"nodeType"):null,P=a&&a.prototype?ht(a.prototype,"nodeName"):null;if(typeof o=="function"){const S=n.createElement("template");S.content&&S.content.ownerDocument&&(n=S.content.ownerDocument)}let T,$="",R,se=!1,V=0;const y=function(){if(V>0)throw Yt('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},le=function(f){y(),V++;try{return T.createHTML(f)}finally{V--}},C=function(f){y(),V++;try{return T.createScriptURL(f)}finally{V--}},D=function(){return se||(R=lm(m,i),se=!0),R},me=n,q=me.implementation,Oe=me.createNodeIterator,mt=me.createDocumentFragment,St=me.getElementsByTagName,Xt=r.importNode;let ne=Ul();e.isSupported=typeof Al=="function"&&typeof v=="function"&&q&&q.createHTMLDocument!==void 0;const We=Kp,qt=Yp,de=Jp,z=Xp,Me=Zp,Zt=em,ke=tm,Je=rm;let Re=zl,te=null;const en=Q({},[...Ol,...So,...To,...Co,...$l]);let _=null;const U=Q({},[...Dl,...Ao,...ql,...Xr]);let G=Object.seal(wn(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}})),he=null,gt=null;const $e=Object.seal(wn(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Qe=!0,_n=!0,ri=!1,ii=!0,xt=!1,tn=!0,Tt=!1,lr=!1,cr=null,ur=null,jn=!1,zt=!1,Sn=!1,Tn=!1,Y=!0,B=!1;const fe="user-content-";let it=!0,ge=!1,Ue={},Xe=null;const dr=Q({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let vc=null;const yc=Q({},["audio","video","img","source","image","track"]);let Mo=null;const wc=Q({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),oi="http://www.w3.org/1998/Math/MathML",ai="http://www.w3.org/2000/svg",bt="http://www.w3.org/1999/xhtml";let Cn=bt,No=!1,Lo=null;const dx=Q({},[oi,ai,bt],jo),kc=Te(["mi","mo","mn","ms","mtext"]);let Oo=Q({},kc);const _c=Te(["annotation-xml"]);let $o=Q({},_c);const hx=Q({},["title","style","font","a","script"]);let hr=null;const fx=["application/xhtml+xml","text/html"],px="text/html";let pe=null,An=null;const mx=n.createElement("form"),jc=function(f){return f instanceof RegExp||f instanceof Function},Do=function(){let f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(An&&An===f)return;(!f||typeof f!="object")&&(f={}),f=Le(f),hr=fx.indexOf(f.PARSER_MEDIA_TYPE)===-1?px:f.PARSER_MEDIA_TYPE,pe=hr==="application/xhtml+xml"?jo:rr,te=Ot(f,"ALLOWED_TAGS",en,{transform:pe}),_=Ot(f,"ALLOWED_ATTR",U,{transform:pe}),Lo=Ot(f,"ALLOWED_NAMESPACES",dx,{transform:jo}),Mo=Ot(f,"ADD_URI_SAFE_ATTR",wc,{transform:pe,base:wc}),vc=Ot(f,"ADD_DATA_URI_TAGS",yc,{transform:pe,base:yc}),Xe=Ot(f,"FORBID_CONTENTS",dr,{transform:pe}),he=Ot(f,"FORBID_TAGS",Le({}),{transform:pe}),gt=Ot(f,"FORBID_ATTR",Le({}),{transform:pe}),Ue=_e(f,"USE_PROFILES")?f.USE_PROFILES&&typeof f.USE_PROFILES=="object"?Le(f.USE_PROFILES):f.USE_PROFILES:!1,Qe=f.ALLOW_ARIA_ATTR!==!1,_n=f.ALLOW_DATA_ATTR!==!1,ri=f.ALLOW_UNKNOWN_PROTOCOLS||!1,ii=f.ALLOW_SELF_CLOSE_IN_ATTR!==!1,xt=f.SAFE_FOR_TEMPLATES||!1,tn=f.SAFE_FOR_XML!==!1,Tt=f.WHOLE_DOCUMENT||!1,zt=f.RETURN_DOM||!1,Sn=f.RETURN_DOM_FRAGMENT||!1,Tn=f.RETURN_TRUSTED_TYPE||!1,jn=f.FORCE_BODY||!1,Y=f.SANITIZE_DOM!==!1,B=f.SANITIZE_NAMED_PROPS||!1,it=f.KEEP_CONTENT!==!1,ge=f.IN_PLACE||!1,Re=Wp(f.ALLOWED_URI_REGEXP)?f.ALLOWED_URI_REGEXP:zl,Cn=typeof f.NAMESPACE=="string"?f.NAMESPACE:bt,Oo=_e(f,"MATHML_TEXT_INTEGRATION_POINTS")&&f.MATHML_TEXT_INTEGRATION_POINTS&&typeof f.MATHML_TEXT_INTEGRATION_POINTS=="object"?Le(f.MATHML_TEXT_INTEGRATION_POINTS):Q({},kc),$o=_e(f,"HTML_INTEGRATION_POINTS")&&f.HTML_INTEGRATION_POINTS&&typeof f.HTML_INTEGRATION_POINTS=="object"?Le(f.HTML_INTEGRATION_POINTS):Q({},_c);const g=_e(f,"CUSTOM_ELEMENT_HANDLING")&&f.CUSTOM_ELEMENT_HANDLING&&typeof f.CUSTOM_ELEMENT_HANDLING=="object"?Le(f.CUSTOM_ELEMENT_HANDLING):wn(null);if(G=wn(null),_e(g,"tagNameCheck")&&jc(g.tagNameCheck)&&(G.tagNameCheck=g.tagNameCheck),_e(g,"attributeNameCheck")&&jc(g.attributeNameCheck)&&(G.attributeNameCheck=g.attributeNameCheck),_e(g,"allowCustomizedBuiltInElements")&&typeof g.allowCustomizedBuiltInElements=="boolean"&&(G.allowCustomizedBuiltInElements=g.allowCustomizedBuiltInElements),Ce(G),xt&&(_n=!1),Sn&&(zt=!0),Ue&&(te=Q({},$l),_=wn(null),Ue.html===!0&&(Q(te,Ol),Q(_,Dl)),Ue.svg===!0&&(Q(te,So),Q(_,Ao),Q(_,Xr)),Ue.svgFilters===!0&&(Q(te,To),Q(_,Ao),Q(_,Xr)),Ue.mathMl===!0&&(Q(te,Co),Q(_,ql),Q(_,Xr))),$e.tagCheck=null,$e.attributeCheck=null,_e(f,"ADD_TAGS")&&(typeof f.ADD_TAGS=="function"?$e.tagCheck=f.ADD_TAGS:Lt(f.ADD_TAGS)&&(te===en&&(te=Le(te)),Q(te,f.ADD_TAGS,pe))),_e(f,"ADD_ATTR")&&(typeof f.ADD_ATTR=="function"?$e.attributeCheck=f.ADD_ATTR:Lt(f.ADD_ATTR)&&(_===U&&(_=Le(_)),Q(_,f.ADD_ATTR,pe))),_e(f,"ADD_URI_SAFE_ATTR")&&Lt(f.ADD_URI_SAFE_ATTR)&&Q(Mo,f.ADD_URI_SAFE_ATTR,pe),_e(f,"FORBID_CONTENTS")&&Lt(f.FORBID_CONTENTS)&&(Xe===dr&&(Xe=Le(Xe)),Q(Xe,f.FORBID_CONTENTS,pe)),_e(f,"ADD_FORBID_CONTENTS")&&Lt(f.ADD_FORBID_CONTENTS)&&(Xe===dr&&(Xe=Le(Xe)),Q(Xe,f.ADD_FORBID_CONTENTS,pe)),it&&(te["#text"]=!0),Tt&&Q(te,["html","head","body"]),te.table&&(Q(te,["tbody"]),delete he.tbody),f.TRUSTED_TYPES_POLICY){if(typeof f.TRUSTED_TYPES_POLICY.createHTML!="function")throw Yt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof f.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Yt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const j=T;T=f.TRUSTED_TYPES_POLICY;try{$=le("")}catch(E){throw T=j,E}}else f.TRUSTED_TYPES_POLICY===null?(T=void 0,$=""):(T===void 0&&(T=D()),T&&typeof $=="string"&&($=le("")));Te&&Te(f),An=f},Sc=Q({},[...So,...To,...Qp]),Tc=Q({},[...Co,...Gp]),gx=function(f,g,j){return g.namespaceURI===bt?f==="svg":g.namespaceURI===oi?f==="svg"&&(j==="annotation-xml"||Oo[j]):!!Sc[f]},xx=function(f,g,j){return g.namespaceURI===bt?f==="math":g.namespaceURI===ai?f==="math"&&$o[j]:!!Tc[f]},bx=function(f,g,j){return g.namespaceURI===ai&&!$o[j]||g.namespaceURI===oi&&!Oo[j]?!1:!Tc[f]&&(hx[f]||!Sc[f])},vx=function(f){let g=v(f);(!g||!g.tagName)&&(g={namespaceURI:Cn,tagName:"template"});const j=rr(f.tagName),E=rr(g.tagName);return Lo[f.namespaceURI]?f.namespaceURI===ai?gx(j,g,E):f.namespaceURI===oi?xx(j,g,E):f.namespaceURI===bt?bx(j,g,E):!!(hr==="application/xhtml+xml"&&Lo[f.namespaceURI]):!1},Ft=function(f){kn(e.removed,{element:f});try{v(f).removeChild(f)}catch{if(x(f),!v(f))throw Yt("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Cc=function(f){const g=b(f);if(g){const E=[];nr(g,F=>{kn(E,F)}),nr(E,F=>{try{x(F)}catch{}})}const j=A(f);if(j)for(let E=j.length-1;E>=0;--E){const F=j[E],J=F&&F.name;if(typeof J=="string")try{f.removeAttribute(J)}catch{}}},nn=function(f,g){try{kn(e.removed,{attribute:g.getAttributeNode(f),from:g})}catch{kn(e.removed,{attribute:null,from:g})}if(g.removeAttribute(f),f==="is")if(zt||Sn)try{Ft(g)}catch{}else try{g.setAttribute(f,"")}catch{}},yx=function(f){const g=A(f);if(g)for(let j=g.length-1;j>=0;--j){const E=g[j],F=E&&E.name;if(!(typeof F!="string"||_[pe(F)]))try{f.removeAttribute(F)}catch{}}},wx=function(f){const g=[f];for(;g.length>0;){const j=g.pop();(N?N(j):j.nodeType)===ft.element&&yx(j);const F=b(j);if(F)for(let J=F.length-1;J>=0;--J)g.push(F[J])}},Ac=function(f){let g=null,j=null;if(jn)f="<remove></remove>"+f;else{const J=Pl(f,/^[\r\n\t ]+/);j=J&&J[0]}hr==="application/xhtml+xml"&&Cn===bt&&(f='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+f+"</body></html>");const E=T?le(f):f;if(Cn===bt)try{g=new d().parseFromString(E,hr)}catch{}if(!g||!g.documentElement){g=q.createDocument(Cn,"template",null);try{g.documentElement.innerHTML=No?$:E}catch{}}const F=g.body||g.documentElement;return f&&j&&F.insertBefore(n.createTextNode(j),F.childNodes[0]||null),Cn===bt?St.call(g,Tt?"html":"body")[0]:Tt?g.documentElement:F},Rc=function(f){return Oe.call(f.ownerDocument||f,f,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},si=function(f){return f=ir(f,We," "),f=ir(f,qt," "),f=ir(f,de," "),f},qo=function(f){var g;f.normalize();const j=Oe.call(f.ownerDocument||f,f,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null);let E=j.nextNode();for(;E;)E.data=si(E.data),E=j.nextNode();const F=(g=f.querySelectorAll)===null||g===void 0?void 0:g.call(f,"template");F&&nr(F,J=>{Rn(J.content)&&qo(J.content)})},li=function(f){const g=P?P(f):null;return typeof g!="string"||pe(g)!=="form"?!1:typeof f.nodeName!="string"||typeof f.textContent!="string"||typeof f.removeChild!="function"||f.attributes!==A(f)||typeof f.removeAttribute!="function"||typeof f.setAttribute!="function"||typeof f.namespaceURI!="string"||typeof f.insertBefore!="function"||typeof f.hasChildNodes!="function"||f.nodeType!==N(f)||f.childNodes!==b(f)},Rn=function(f){if(!N||typeof f!="object"||f===null)return!1;try{return N(f)===ft.documentFragment}catch{return!1}},fr=function(f){if(!N||typeof f!="object"||f===null)return!1;try{return typeof N(f)=="number"}catch{return!1}};function Ct(S,f,g){S.length!==0&&nr(S,j=>{j.call(e,f,g,An)})}const kx=function(f,g){return!!(tn&&f.hasChildNodes()&&!fr(f.firstElementChild)&&Ae(Fl,f.textContent)&&Ae(Fl,f.innerHTML)||tn&&f.namespaceURI===bt&&g==="style"&&fr(f.firstElementChild)||f.nodeType===ft.processingInstruction||tn&&f.nodeType===ft.comment&&Ae(im,f.data))},_x=function(f,g){if(!he[g]&&Pc(g)&&(G.tagNameCheck instanceof RegExp&&Ae(G.tagNameCheck,g)||G.tagNameCheck instanceof Function&&G.tagNameCheck(g)))return!1;if(it&&!Xe[g]){const j=v(f),E=b(f);if(E&&j){const F=E.length;for(let J=F-1;J>=0;--J){const je=ge?E[J]:p(E[J],!0);j.insertBefore(je,w(f))}}}return Ft(f),!0},Ec=function(f){if(Ct(ne.beforeSanitizeElements,f,null),li(f))return Ft(f),!0;const g=pe(P?P(f):f.nodeName);if(Ct(ne.uponSanitizeElement,f,{tagName:g,allowedTags:te}),kx(f,g))return Ft(f),!0;if(he[g]||!($e.tagCheck instanceof Function&&$e.tagCheck(g))&&!te[g])return _x(f,g);if((N?N(f):f.nodeType)===ft.element&&!vx(f)||(g==="noscript"||g==="noembed"||g==="noframes")&&Ae(om,f.innerHTML))return Ft(f),!0;if(xt&&f.nodeType===ft.text){const E=si(f.textContent);f.textContent!==E&&(kn(e.removed,{element:f.cloneNode()}),f.textContent=E)}return Ct(ne.afterSanitizeElements,f,null),!1},Ic=function(f,g,j){if(gt[g]||Y&&(g==="id"||g==="name")&&(j in n||j in mx))return!1;const E=_[g]||$e.attributeCheck instanceof Function&&$e.attributeCheck(g,f);if(!(_n&&Ae(z,g))){if(!(Qe&&Ae(Me,g))){if(E){if(!Mo[g]){if(!Ae(Re,ir(j,ke,""))){if(!((g==="src"||g==="xlink:href"||g==="href")&&f!=="script"&&Ml(j,"data:")===0&&vc[f])){if(!(ri&&!Ae(Zt,ir(j,ke,"")))){if(j)return!1}}}}}else if(!(Pc(f)&&(G.tagNameCheck instanceof RegExp&&Ae(G.tagNameCheck,f)||G.tagNameCheck instanceof Function&&G.tagNameCheck(f))&&(G.attributeNameCheck instanceof RegExp&&Ae(G.attributeNameCheck,g)||G.attributeNameCheck instanceof Function&&G.attributeNameCheck(g,f))||g==="is"&&G.allowCustomizedBuiltInElements&&(G.tagNameCheck instanceof RegExp&&Ae(G.tagNameCheck,j)||G.tagNameCheck instanceof Function&&G.tagNameCheck(j))))return!1}}return!0},jx=Q({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Pc=function(f){return!jx[rr(f)]&&Ae(Je,f)},Sx=function(f,g,j,E){if(T&&typeof m=="object"&&typeof m.getAttributeType=="function"&&!j)switch(m.getAttributeType(f,g)){case"TrustedHTML":return le(E);case"TrustedScriptURL":return C(E)}return E},Tx=function(f,g,j,E){try{j?f.setAttributeNS(j,g,E):f.setAttribute(g,E),li(f)?Ft(f):Il(e.removed)}catch{nn(g,f)}},Mc=function(f){Ct(ne.beforeSanitizeAttributes,f,null);const g=f.attributes;if(!g||li(f))return;const j={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:_,forceKeepAttr:void 0};let E=g.length;const F=pe(f.nodeName);for(;E--;){const J=g[E],je=J.name,ye=J.namespaceURI,Ze=J.value,ot=pe(je),Fo=Ze;let De=je==="value"?Fo:zp(Fo);if(j.attrName=ot,j.attrValue=De,j.keepAttr=!0,j.forceKeepAttr=void 0,Ct(ne.uponSanitizeAttribute,f,j),De=j.attrValue,B&&(ot==="id"||ot==="name")&&Ml(De,fe)!==0&&(nn(je,f),De=fe+De),tn&&Ae(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,De)){nn(je,f);continue}if(ot==="attributename"&&Pl(De,"href")){nn(je,f);continue}if(!j.forceKeepAttr){if(!j.keepAttr){nn(je,f);continue}if(!ii&&Ae(am,De)){nn(je,f);continue}if(xt&&(De=si(De)),!Ic(F,ot,De)){nn(je,f);continue}De=Sx(F,ot,ye,De),De!==Fo&&Tx(f,je,ye,De)}}Ct(ne.afterSanitizeAttributes,f,null)},ci=function(f){let g=null;const j=Rc(f);for(Ct(ne.beforeSanitizeShadowDOM,f,null);g=j.nextNode();)if(Ct(ne.uponSanitizeShadowNode,g,null),Ec(g),Mc(g),Rn(g.content)&&ci(g.content),(N?N(g):g.nodeType)===ft.element){const F=k(g);Rn(F)&&(zo(F),ci(F))}Ct(ne.afterSanitizeShadowDOM,f,null)},zo=function(f){const g=[{node:f,shadow:null}];for(;g.length>0;){const j=g.pop();if(j.shadow){ci(j.shadow);continue}const E=j.node,J=(N?N(E):E.nodeType)===ft.element,je=b(E);if(je)for(let ye=je.length-1;ye>=0;--ye)g.push({node:je[ye],shadow:null});if(J){const ye=P?P(E):null;if(typeof ye=="string"&&pe(ye)==="template"){const Ze=E.content;Rn(Ze)&&g.push({node:Ze,shadow:null})}}if(J){const ye=k(E);Rn(ye)&&g.push({node:null,shadow:ye},{node:ye,shadow:null})}}};return e.sanitize=function(S){let f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},g=null,j=null,E=null,F=null;if(No=!S,No&&(S="<!-->"),typeof S!="string"&&!fr(S)&&(S=Hp(S),typeof S!="string"))throw Yt("dirty is not a string, aborting");if(!e.isSupported)return S;lr?(te=cr,_=ur):Do(f),(ne.uponSanitizeElement.length>0||ne.uponSanitizeAttribute.length>0)&&(te=Le(te)),ne.uponSanitizeAttribute.length>0&&(_=Le(_)),e.removed=[];const J=ge&&typeof S!="string"&&fr(S);if(J){const Ze=P?P(S):S.nodeName;if(typeof Ze=="string"){const ot=pe(Ze);if(!te[ot]||he[ot])throw Yt("root node is forbidden and cannot be sanitized in-place")}if(li(S))throw Yt("root node is clobbered and cannot be sanitized in-place");try{zo(S)}catch(ot){throw Cc(S),ot}}else if(fr(S))g=Ac("<!---->"),j=g.ownerDocument.importNode(S,!0),j.nodeType===ft.element&&j.nodeName==="BODY"||j.nodeName==="HTML"?g=j:g.appendChild(j),zo(j);else{if(!zt&&!xt&&!Tt&&S.indexOf("<")===-1)return T&&Tn?le(S):S;if(g=Ac(S),!g)return zt?null:Tn?$:""}g&&jn&&Ft(g.firstChild);const je=Rc(J?S:g);try{for(;E=je.nextNode();)Ec(E),Mc(E),Rn(E.content)&&ci(E.content)}catch(Ze){throw J&&Cc(S),Ze}if(J)return nr(e.removed,Ze=>{Ze.element&&wx(Ze.element)}),xt&&qo(S),S;if(zt){if(xt&&qo(g),Sn)for(F=mt.call(g.ownerDocument);g.firstChild;)F.appendChild(g.firstChild);else F=g;return(_.shadowroot||_.shadowrootmode)&&(F=Xt.call(r,F,!0)),F}let ye=Tt?g.outerHTML:g.innerHTML;return Tt&&te["!doctype"]&&g.ownerDocument&&g.ownerDocument.doctype&&g.ownerDocument.doctype.name&&Ae(nm,g.ownerDocument.doctype.name)&&(ye="<!DOCTYPE "+g.ownerDocument.doctype.name+`>
79
- `+ye),xt&&(ye=si(ye)),T&&Tn?le(ye):ye},e.setConfig=function(){let S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Do(S),lr=!0,cr=te,ur=_},e.clearConfig=function(){An=null,lr=!1,cr=null,ur=null,T=R,$=""},e.isValidAttribute=function(S,f,g){An||Do({});const j=pe(S),E=pe(f);return Ic(j,E,g)},e.addHook=function(S,f){typeof f=="function"&&_e(ne,S)&&kn(ne[S],f)},e.removeHook=function(S,f){if(_e(ne,S)){if(f!==void 0){const g=Dp(ne[S],f);return g===-1?void 0:qp(ne[S],g,1)[0]}return Il(ne[S])}},e.removeHooks=function(S){_e(ne,S)&&(ne[S]=[])},e.removeAllHooks=function(){ne=Ul()},e}var cm=Bl();function um(t){return t.trim().split(/\n\s*-{3,}\s*\n/).map(e=>{const[n="",...r]=e.trim().split(`
76
+ `}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>${vt(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:n}){let r=this.parser.parseInline(n),i=rc(t);if(i===null)return r;t=i;let o='<a href="'+t+'"';return e&&(o+=' title="'+vt(e)+'"'),o+=">"+r+"</a>",o}image({href:t,title:e,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=rc(t);if(i===null)return vt(n);t=i;let o=`<img src="${t}" alt="${vt(n)}"`;return e&&(o+=` title="${vt(e)}"`),o+=">",o}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:vt(t.text)}},Uo=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""}checkbox({raw:t}){return t}},ot=class ja{options;renderer;textRenderer;constructor(e){this.options=e||en,this.options.renderer=this.options.renderer||new ci,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Uo}static parse(e,n){return new ja(n).parse(e)}static parseInline(e,n){return new ja(n).parseInline(e)}parse(e){this.renderer.parser=this;let n="";for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let a=i,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)){n+=l||"";continue}}let o=i;switch(o.type){case"space":{n+=this.renderer.space(o);break}case"hr":{n+=this.renderer.hr(o);break}case"heading":{n+=this.renderer.heading(o);break}case"code":{n+=this.renderer.code(o);break}case"table":{n+=this.renderer.table(o);break}case"blockquote":{n+=this.renderer.blockquote(o);break}case"list":{n+=this.renderer.list(o);break}case"checkbox":{n+=this.renderer.checkbox(o);break}case"html":{n+=this.renderer.html(o);break}case"def":{n+=this.renderer.def(o);break}case"paragraph":{n+=this.renderer.paragraph(o);break}case"text":{n+=this.renderer.text(o);break}default:{let a='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return n}parseInline(e,n=this.renderer){this.renderer.parser=this;let r="";for(let i=0;i<e.length;i++){let o=e[i];if(this.options.extensions?.renderers?.[o.type]){let l=this.options.extensions.renderers[o.type].call({parser:this},o);if(l!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){r+=l||"";continue}}let a=o;switch(a.type){case"escape":{r+=n.text(a);break}case"html":{r+=n.html(a);break}case"link":{r+=n.link(a);break}case"image":{r+=n.image(a);break}case"checkbox":{r+=n.checkbox(a);break}case"strong":{r+=n.strong(a);break}case"em":{r+=n.em(a);break}case"codespan":{r+=n.codespan(a);break}case"br":{r+=n.br(a);break}case"del":{r+=n.del(a);break}case"text":{r+=n.text(a);break}default:{let l='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return r}},dr=class{options;block;constructor(t){this.options=t||en}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(t=this.block){return t?it.lex:it.lexInline}provideParser(t=this.block){return t?ot.parse:ot.parseInline}},Dm=class{defaults=No();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=ot;Renderer=ci;TextRenderer=Uo;Lexer=it;Tokenizer=li;Hooks=dr;constructor(...t){this.use(...t)}walkTokens(t,e){let n=[];for(let r of t)switch(n=n.concat(e.call(this,r)),r.type){case"table":{let i=r;for(let o of i.header)n=n.concat(this.walkTokens(o.tokens,e));for(let o of i.rows)for(let a of o)n=n.concat(this.walkTokens(a.tokens,e));break}case"list":{let i=r;n=n.concat(this.walkTokens(i.items,e));break}default:{let i=r;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(o=>{let a=i[o].flat(1/0);n=n.concat(this.walkTokens(a,e))}):i.tokens&&(n=n.concat(this.walkTokens(i.tokens,e)))}}return n}use(...t){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(n=>{let r={...n};if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let o=e.renderers[i.name];o?e.renderers[i.name]=function(...a){let l=i.renderer.apply(this,a);return l===!1&&(l=o.apply(this,a)),l}:e.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let o=e[i.level];o?o.unshift(i.tokenizer):e[i.level]=[i.tokenizer],i.start&&(i.level==="block"?e.startBlock?e.startBlock.push(i.start):e.startBlock=[i.start]:i.level==="inline"&&(e.startInline?e.startInline.push(i.start):e.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(e.childTokens[i.name]=i.childTokens)}),r.extensions=e),n.renderer){let i=this.defaults.renderer||new ci(this.defaults);for(let o in n.renderer){if(!(o in i))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;let a=o,l=n.renderer[a],c=i[a];i[a]=(...u)=>{let d=l.apply(i,u);return d===!1&&(d=c.apply(i,u)),d||""}}r.renderer=i}if(n.tokenizer){let i=this.defaults.tokenizer||new li(this.defaults);for(let o in n.tokenizer){if(!(o in i))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;let a=o,l=n.tokenizer[a],c=i[a];i[a]=(...u)=>{let d=l.apply(i,u);return d===!1&&(d=c.apply(i,u)),d}}r.tokenizer=i}if(n.hooks){let i=this.defaults.hooks||new dr;for(let o in n.hooks){if(!(o in i))throw new Error(`hook '${o}' does not exist`);if(["options","block"].includes(o))continue;let a=o,l=n.hooks[a],c=i[a];dr.passThroughHooks.has(o)?i[a]=u=>{if(this.defaults.async&&dr.passThroughHooksRespectAsync.has(o))return(async()=>{let m=await l.call(i,u);return c.call(i,m)})();let d=l.call(i,u);return c.call(i,d)}:i[a]=(...u)=>{if(this.defaults.async)return(async()=>{let m=await l.apply(i,u);return m===!1&&(m=await c.apply(i,u)),m})();let d=l.apply(i,u);return d===!1&&(d=c.apply(i,u)),d}}r.hooks=i}if(n.walkTokens){let i=this.defaults.walkTokens,o=n.walkTokens;r.walkTokens=function(a){let l=[];return l.push(o.call(this,a)),i&&(l=l.concat(i.call(this,a))),l}}this.defaults={...this.defaults,...r}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return it.lex(t,e??this.defaults)}parser(t,e){return ot.parse(t,e??this.defaults)}parseMarkdown(t){return(e,n)=>{let r={...n},i={...this.defaults,...r},o=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.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(i.hooks&&(i.hooks.options=i,i.hooks.block=t),i.async)return(async()=>{let a=i.hooks?await i.hooks.preprocess(e):e,l=await(i.hooks?await i.hooks.provideLexer(t):t?it.lex:it.lexInline)(a,i),c=i.hooks?await i.hooks.processAllTokens(l):l;i.walkTokens&&await Promise.all(this.walkTokens(c,i.walkTokens));let u=await(i.hooks?await i.hooks.provideParser(t):t?ot.parse:ot.parseInline)(c,i);return i.hooks?await i.hooks.postprocess(u):u})().catch(o);try{i.hooks&&(e=i.hooks.preprocess(e));let a=(i.hooks?i.hooks.provideLexer(t):t?it.lex:it.lexInline)(e,i);i.hooks&&(a=i.hooks.processAllTokens(a)),i.walkTokens&&this.walkTokens(a,i.walkTokens);let l=(i.hooks?i.hooks.provideParser(t):t?ot.parse:ot.parseInline)(a,i);return i.hooks&&(l=i.hooks.postprocess(l)),l}catch(a){return o(a)}}}onError(t,e){return n=>{if(n.message+=`
77
+ Please report this to https://github.com/markedjs/marked.`,t){let r="<p>An error occurred:</p><pre>"+vt(n.message+"",!0)+"</pre>";return e?Promise.resolve(r):r}if(e)return Promise.reject(n);throw n}}},nn=new Dm;function ee(t,e){return nn.parse(t,e)}ee.options=ee.setOptions=function(t){return nn.setOptions(t),ee.defaults=nn.defaults,Vl(ee.defaults),ee},ee.getDefaults=No,ee.defaults=en,ee.use=function(...t){return nn.use(...t),ee.defaults=nn.defaults,Vl(ee.defaults),ee},ee.walkTokens=function(t,e){return nn.walkTokens(t,e)},ee.parseInline=nn.parseInline,ee.Parser=ot,ee.parser=ot.parse,ee.Renderer=ci,ee.TextRenderer=Uo,ee.Lexer=it,ee.lexer=it.lex,ee.Tokenizer=li,ee.Hooks=dr,ee.parse=ee,ee.options,ee.setOptions,ee.use,ee.walkTokens,ee.parseInline,ot.parse,it.lex;function sc(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function zm(t){if(Array.isArray(t))return t}function qm(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,o,a,l=[],c=!0,u=!1;try{if(o=(n=n.call(t)).next,e!==0)for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(d){u=!0,i=d}finally{try{if(!c&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw i}}return l}}function Fm(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
78
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Bm(t,e){return zm(t)||qm(t,e)||Um(t,e)||Fm()}function Um(t,e){if(t){if(typeof t=="string")return sc(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?sc(t,e):void 0}}const lc=Object.entries,cc=Object.setPrototypeOf,Vm=Object.isFrozen,uc=Object.getPrototypeOf,dc=Object.getOwnPropertyDescriptor;let Se=Object.freeze,Re=Object.seal,An=Object.create,hc=typeof Reflect<"u"&&Reflect,Vo=hc.apply,Ho=hc.construct;Se||(Se=function(e){return e}),Re||(Re=function(e){return e}),Vo||(Vo=function(e,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),o=2;o<r;o++)i[o-2]=arguments[o];return e.apply(n,i)}),Ho||(Ho=function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return new e(...r)});const Pt=pe(Array.prototype.forEach),Hm=pe(Array.prototype.lastIndexOf),fc=pe(Array.prototype.pop),hr=pe(Array.prototype.push),Wm=pe(Array.prototype.slice),Qm=pe(Array.prototype.splice),Rn=Array.isArray,Wo=bc(Set),Qo=pe(Set.prototype.add),fr=pe(Set.prototype.has),rn=pe(String.prototype.toLowerCase),Go=pe(String.prototype.toString),pc=pe(String.prototype.match),pr=pe(String.prototype.replace),mc=pe(String.prototype.indexOf),Gm=pe(String.prototype.trim),Km=pe(Number.prototype.toString),Ym=pe(Boolean.prototype.toString),gc=typeof BigInt>"u"?null:pe(BigInt.prototype.toString),xc=typeof Symbol>"u"?null:pe(Symbol.prototype.toString),qe=pe(Object.prototype.hasOwnProperty),mr=pe(Object.prototype.toString),Ee=pe(RegExp.prototype.test),Nt=bc(TypeError);function pe(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return Vo(t,e,r)}}function bc(t){return function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return Ho(t,n)}}function te(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:rn;if(cc&&cc(t,null),!Rn(e))return t;let r=e.length;for(;r--;){let i=e[r];if(typeof i=="string"){const o=n(i);o!==i&&(Vm(e)||(e[r]=o),i=o)}t[i]=!0}return t}function Jm(t){for(let e=0;e<t.length;e++)qe(t,e)||(t[e]=null);return t}function Ge(t){const e=An(null);for(const r of lc(t)){var n=Bm(r,2);const i=n[0],o=n[1];qe(t,i)&&(Rn(o)?e[i]=Jm(o):o&&typeof o=="object"&&o.constructor===Object?e[i]=Ge(o):e[i]=o)}return e}function Xm(t){switch(typeof t){case"string":return t;case"number":return Km(t);case"boolean":return Ym(t);case"bigint":return gc?gc(t):"0";case"symbol":return xc?xc(t):"Symbol()";case"undefined":return mr(t);case"function":case"object":{if(t===null)return mr(t);const e=t,n=Xe(e,"toString");if(typeof n=="function"){const r=n(e);return typeof r=="string"?r:mr(r)}return mr(t)}default:return mr(t)}}function Xe(t,e){for(;t!==null;){const r=dc(t,e);if(r){if(r.get)return pe(r.get);if(typeof r.value=="function")return pe(r.value)}t=uc(t)}function n(){return null}return n}function Zm(t,e){for(;t!==null;){const n=dc(t,e);if(n)return n.get?pe(n.get):null;t=uc(t)}return null}function eg(t){try{return Ee(t,""),!0}catch{return!1}}const vc=Se(["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"]),Ko=Se(["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"]),Yo=Se(["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"]),tg=Se(["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"]),Jo=Se(["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"]),ng=Se(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),yc=Se(["#text"]),wc=Se(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","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"]),Xo=Se(["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","dominant-baseline","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","pointer-events","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-orientation","text-rendering","textlength","type","u1","u2","unicode","values","vector-effect","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"]),kc=Se(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","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"]),ui=Se(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),rg=Re(/{{[\w\W]*|^[\w\W]*}}/g),ig=Re(/<%[\w\W]*|^[\w\W]*%>/g),og=Re(/\${[\w\W]*/g),ag=Re(/^data-[\-\w.\u00B7-\uFFFF]+$/),sg=Re(/^aria-[\-\w]+$/),_c=Re(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),lg=Re(/^(?:\w+script|data):/i),cg=Re(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ug=Re(/^html$/i),dg=Re(/^[a-z][.\w]*(-[.\w]+)+$/i),Zo=Re(/<[/\w!]/g),jc=Re(/<[/\w]/g),hg=Re(/<\/no(script|embed|frames)/i),Sc=Re(/\/>/i),ke={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},fg=Se(te({},["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"])),pg=function(){return typeof window>"u"?null:window},mg=function(e,n){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let r=null;const i="data-tt-policy-suffix";n&&n.hasAttribute(i)&&(r=n.getAttribute(i));const o="dompurify"+(r?"#"+r:"");try{return e.createPolicy(o,{createHTML(a){return a},createScriptURL(a){return a}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},Tc=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Ft=function(e,n,r,i){return qe(e,n)&&Rn(e[n])?te(i.base?Ge(i.base):{},e[n],i.transform):r},ea=function(e,n,r){const i=qe(e,n)?e[n]:void 0;return i&&typeof i=="object"?Ge(i):r()};function Cc(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:pg();const e=S=>Cc(S);if(e.version="3.4.17",e.removed=[],!t||!t.document||t.document.nodeType!==ke.document||!t.Element)return e.isSupported=!1,e;let n=t.document;const r=n,i=r.currentScript;t.DocumentFragment;const o=t.HTMLTemplateElement,a=t.Node,l=t.Element,c=t.NodeFilter;t.NamedNodeMap===void 0&&(t.NamedNodeMap||t.MozNamedAttrMap),t.HTMLFormElement;const u=t.DOMParser,d=t.trustedTypes,m=l.prototype,f=Xe(m,"cloneNode"),p=Xe(m,"remove"),x=Xe(m,"removeAttributeNode"),v=Xe(m,"nextSibling"),k=Xe(m,"childNodes"),w=Xe(m,"parentNode"),b=Xe(m,"shadowRoot"),I=Xe(m,"attributes"),C=a&&a.prototype?Xe(a.prototype,"nodeType"):null,E=a&&a.prototype?Xe(a.prototype,"nodeName"):null,T=a&&a.prototype?Xe(a.prototype,"ownerDocument"):null,M=function(h){return C?C(h):h.nodeType},P=function(h){return E?E(h):h.nodeName},le=Zm(m,"namespaceURI"),B=function(h){return le?le(h):h.namespaceURI};if(typeof o=="function"){const S=n.createElement("template");S.content&&S.content.ownerDocument&&(n=S.content.ownerDocument)}let D,y="",A,z=!1,ae=0;const Y=function(){if(ae>0)throw Nt('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},ce=function(h){Y(),ae++;try{return D.createHTML(h)}finally{ae--}},Ne=function(h){Y(),ae++;try{return D.createScriptURL(h)}finally{ae--}},st=function(){return z||(A=mg(d,i),z=!0),A},wt=n,Ot=wt.implementation,Fe=wt.createNodeIterator,Vt=wt.createDocumentFragment,xe=wt.getElementsByTagName,W=r.importNode;let H=Tc();e.isSupported=typeof lc=="function"&&typeof w=="function"&&Ot&&Ot.createHTMLDocument!==void 0;const an=rg,Te=ig,et=og,Oe=ag,Ht=sg,En=lg,R=cg,K=dg;let Be=_c,U=null;const lt=te({},[...vc,...Ko,...Yo,...Jo,...yc]);let ie=null;const Ue=te({},[...wc,...Xo,...kc,...ui]);let Ke=Object.seal(An(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}})),sn=null,mi=null;const kt=Object.seal(An(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let gi=!0,vr=!0,xi=!1,yr=!0,ct=!1,_t=!0,Lt=!1,wr=!1,In=null,X=null,Q=!1,ue=!1,tt=!1,be=!1,jt=!0,bi=!1;const vi="user-content-";let sa=!0,la=!1,ln=null,Mn={},cn=null;const ou=te({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let au=null;const su=te({},["audio","video","img","source","image","track"]);let lu=null;const cu=te({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),yi="http://www.w3.org/1998/Math/MathML",wi="http://www.w3.org/2000/svg",St="http://www.w3.org/1999/xhtml";let Pn=St,ca=!1,ua=null;const wb=te({},[yi,wi,St],Go),uu=Se(["mi","mo","mn","ms","mtext"]);let da=te({},uu);const du=Se(["annotation-xml"]);let ha=te({},du);const kb=te({},["title","style","font","a","script"]);let kr=null;const _b=["application/xhtml+xml","text/html"],jb="text/html";let ve=null,Nn=null;const Sb=n.createElement("form"),hu=function(h){return h instanceof RegExp||h instanceof Function},fa=function(){let h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Nn&&Nn===h)return;(!h||typeof h!="object")&&(h={}),h=Ge(h),kr=_b.indexOf(h.PARSER_MEDIA_TYPE)===-1?jb:h.PARSER_MEDIA_TYPE,ve=kr==="application/xhtml+xml"?Go:rn,U=Ft(h,"ALLOWED_TAGS",lt,{transform:ve}),ie=Ft(h,"ALLOWED_ATTR",Ue,{transform:ve}),ua=Ft(h,"ALLOWED_NAMESPACES",wb,{transform:Go}),lu=Ft(h,"ADD_URI_SAFE_ATTR",cu,{transform:ve,base:cu}),au=Ft(h,"ADD_DATA_URI_TAGS",su,{transform:ve,base:su}),cn=Ft(h,"FORBID_CONTENTS",ou,{transform:ve}),sn=Ft(h,"FORBID_TAGS",Ge({}),{transform:ve}),mi=Ft(h,"FORBID_ATTR",Ge({}),{transform:ve}),Mn=qe(h,"USE_PROFILES")?h.USE_PROFILES&&typeof h.USE_PROFILES=="object"?Ge(h.USE_PROFILES):h.USE_PROFILES:!1,gi=h.ALLOW_ARIA_ATTR!==!1,vr=h.ALLOW_DATA_ATTR!==!1,xi=h.ALLOW_UNKNOWN_PROTOCOLS||!1,yr=h.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ct=h.SAFE_FOR_TEMPLATES||!1,_t=h.SAFE_FOR_XML!==!1,Lt=h.WHOLE_DOCUMENT||!1,ue=h.RETURN_DOM||!1,tt=h.RETURN_DOM_FRAGMENT||!1,be=h.RETURN_TRUSTED_TYPE||!1,Q=h.FORCE_BODY||!1,jt=h.SANITIZE_DOM!==!1,bi=h.SANITIZE_NAMED_PROPS||!1,sa=h.KEEP_CONTENT!==!1,la=h.IN_PLACE||!1,Be=eg(h.ALLOWED_URI_REGEXP)?h.ALLOWED_URI_REGEXP:_c,Pn=typeof h.NAMESPACE=="string"?h.NAMESPACE:St,da=ea(h,"MATHML_TEXT_INTEGRATION_POINTS",()=>te({},uu)),ha=ea(h,"HTML_INTEGRATION_POINTS",()=>te({},du));const g=ea(h,"CUSTOM_ELEMENT_HANDLING",()=>An(null));if(Ke=An(null),qe(g,"tagNameCheck")&&hu(g.tagNameCheck)&&(Ke.tagNameCheck=g.tagNameCheck),qe(g,"attributeNameCheck")&&hu(g.attributeNameCheck)&&(Ke.attributeNameCheck=g.attributeNameCheck),qe(g,"allowCustomizedBuiltInElements")&&typeof g.allowCustomizedBuiltInElements=="boolean"&&(Ke.allowCustomizedBuiltInElements=g.allowCustomizedBuiltInElements),Re(Ke),ct&&(vr=!1),tt&&(ue=!0),Mn&&(U=te({},yc),ie=An(null),Mn.html===!0&&(te(U,vc),te(ie,wc)),Mn.svg===!0&&(te(U,Ko),te(ie,Xo),te(ie,ui)),Mn.svgFilters===!0&&(te(U,Yo),te(ie,Xo),te(ie,ui)),Mn.mathMl===!0&&(te(U,Jo),te(ie,kc),te(ie,ui))),kt.tagCheck=null,kt.attributeCheck=null,qe(h,"ADD_TAGS")&&(typeof h.ADD_TAGS=="function"?kt.tagCheck=h.ADD_TAGS:Rn(h.ADD_TAGS)&&(U===lt&&(U=Ge(U)),te(U,h.ADD_TAGS,ve))),qe(h,"ADD_ATTR")&&(typeof h.ADD_ATTR=="function"?kt.attributeCheck=h.ADD_ATTR:Rn(h.ADD_ATTR)&&(ie===Ue&&(ie=Ge(ie)),te(ie,h.ADD_ATTR,ve))),qe(h,"ADD_FORBID_CONTENTS")&&Rn(h.ADD_FORBID_CONTENTS)&&(cn===ou&&(cn=Ge(cn)),te(cn,h.ADD_FORBID_CONTENTS,ve)),sa&&(U["#text"]=!0),Lt&&te(U,["html","head","body"]),U.table&&(te(U,["tbody"]),delete sn.tbody),h.TRUSTED_TYPES_POLICY){if(typeof h.TRUSTED_TYPES_POLICY.createHTML!="function")throw Nt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof h.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Nt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const _=D;D=h.TRUSTED_TYPES_POLICY;try{y=ce("")}catch(j){throw D=_,j}}else h.TRUSTED_TYPES_POLICY===null?(D=void 0,y=""):(D===void 0&&(D=st()),D&&typeof y=="string"&&(y=ce("")));Se&&Se(h),Nn=h},fu=te({},[...Ko,...Yo,...tg]),pu=te({},[...Jo,...ng]),Tb=function(h,g,_){return g.namespaceURI===St?h==="svg":g.namespaceURI===yi?h==="svg"&&(_==="annotation-xml"||da[_]):!!fu[h]},Cb=function(h,g,_){return g.namespaceURI===St?h==="math":g.namespaceURI===wi?h==="math"&&ha[_]:!!pu[h]},Ab=function(h,g,_){return g.namespaceURI===wi&&!ha[_]||g.namespaceURI===yi&&!da[_]?!1:!pu[h]&&(kb[h]||!fu[h])},Rb=function(h){const g=B(h),_=rn(P(h)),j=w(h);let O,q;return j&&M(j)===ke.element?(O={namespaceURI:B(j)},q=rn(P(j))):(O={namespaceURI:Pn},q="template"),ua[g]?g===wi?Tb(_,O,q):g===yi?Cb(_,O,q):g===St?Ab(_,O,q):!!(kr==="application/xhtml+xml"&&ua[g]):!1},Wt=function(h){hr(e.removed,{element:h});try{w(h).removeChild(h)}catch{if(p(h),!w(h))throw Nt("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},mu=function(h,g,_){try{x(h,g)}catch{try{h.removeAttribute(_)}catch{}}},pa=function(h){ga(h);const g=k(h);g&&Pt(Wm(g),j=>{try{p(j)}catch{}});const _=M(h)===ke.element?I(h):null;if(_)for(let j=_.length-1;j>=0;--j){const O=_[j],q=O&&O.name;typeof q=="string"&&mu(h,O,q)}},On=function(h,g,_){if(!_)try{_=g.getAttributeNode(h)}catch{_=null}hr(e.removed,{attribute:_||null,from:g});try{_?x(g,_):g.removeAttribute(h)}catch{try{g.removeAttribute(h)}catch{}}if(h==="is")if(ue||tt)try{Wt(g)}catch{}else try{g.setAttribute(h,"")}catch{}},gu=function(h){const g=I(h);if(g)for(let _=g.length-1;_>=0;--_){const j=g[_],O=j&&j.name;typeof O!="string"||ie[ve(O)]||mu(h,j,O)}},ma=function(h,g){let _=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const j=[h];for(;j.length>0;){const O=j.pop();if(g(O)===!1)continue;if(_&&M(O)===ke.element){const G=b(O);Qt(G)&&j.push(G)}const q=k(O);if(q)for(let G=q.length-1;G>=0;--G)j.push(q[G])}},ga=function(h){ma(h,g=>{M(g)===ke.element&&gu(g)})},xa=function(h){const g=[];return ma(h,_=>{g.push(_)},!0),g},Eb=function(h,g){const _=Wo();Pt(xa(h),j=>{M(j)===ke.element&&Qo(_,j)}),Pt(g,j=>{M(j)===ke.element&&!fr(_,j)&&gu(j)})},xu=function(h,g){let _=!1;return Pt(e.removed,j=>{j.element&&(_=_||j.element===h,ga(j.element))}),Eb(h,g),_},Ib=8,Mb=function(h,g){const _=ln;let j=null;const O=()=>(j||(j=Wo(),Pt(g,q=>{Qo(j,q)})),j);for(let q=0;;q++){const G=xa(h),je=[h];let Tt=!1;if(Pt(G,$e=>{M($e)===ke.documentFragment?hr(je,$e):!Tt&&!fr(_,$e)&&(Tt=fr(O(),$e))}),!Tt)return;if(q>=Ib)throw Nt("the tree kept changing during in-place sanitization; refusing to return it");Pt(je,($e,Ve)=>{Pb($e,Ve>0,h,O())})}},Pb=function(h,g,_,j){const O=ba(h);let q;for(;q=O.nextNode();)!fr(j,q)||fr(ln,q)||(g&&ut(H.uponSanitizeShadowNode,q,null),ya(q,_),wa(q,_),Qt(q.content)&&jr(q.content))},Nb=function(h){ln&&Qo(ln,h)},bu=function(h,g){return _t?h==="patchsrc"?!0:h==="for"&&g!=="label"&&g!=="output":!1},Ob=function(h){_t&&ma(h,g=>{const _=M(g);if(_===ke.processingInstruction||_===ke.comment&&Ee(jc,g.data)){try{p(g)}catch{}return!1}if(_===ke.element){const j=g,O=ve(P(g));try{j.hasAttribute&&j.hasAttribute("patchsrc")&&j.removeAttribute("patchsrc"),j.hasAttribute&&j.hasAttribute("for")&&bu("for",O)&&j.removeAttribute("for")}catch{}}return!0})},vu=function(h){let g=null,_=null;if(Q)h="<remove></remove>"+h;else{const q=pc(h,/^[\r\n\t ]+/);_=q&&q[0]}kr==="application/xhtml+xml"&&Pn===St&&(h='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+h+"</body></html>");const j=D?ce(h):h;if(Pn===St)try{g=new u().parseFromString(j,kr)}catch{}if(!g||!g.documentElement){g=Ot.createDocument(Pn,"template",null);try{g.documentElement.innerHTML=ca?y:j}catch{}}const O=g.body||g.documentElement;return h&&_&&O.insertBefore(n.createTextNode(_),O.childNodes[0]||null),Pn===St?xe.call(g,Lt?"html":"body")[0]:Lt?g.documentElement:O},ba=function(h){const g=T?T(h):h.ownerDocument;return Fe.call(g||h,h,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},ki=function(h){return h=pr(h,an," "),h=pr(h,Te," "),h=pr(h,et," "),h},va=function(h){var g;yu(h);const _=(g=h.querySelectorAll)===null||g===void 0?void 0:g.call(h,"template");_&&Pt(_,j=>{Qt(j.content)&&va(j.content)})},yu=function(h){h.normalize();const g=T?T(h):h.ownerDocument,_=Fe.call(g||h,h,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null);let j=_.nextNode();for(;j;)j.data=ki(j.data),j=_.nextNode()},_i=function(h){const g=E?E(h):null;return typeof g!="string"||ve(g)!=="form"?!1:typeof h.nodeName!="string"||typeof h.textContent!="string"||typeof h.removeChild!="function"||h.attributes!==I(h)||typeof h.removeAttribute!="function"||typeof h.removeAttributeNode!="function"||typeof h.getAttributeNode!="function"||typeof h.setAttribute!="function"||typeof h.namespaceURI!="string"||typeof h.insertBefore!="function"||typeof h.hasChildNodes!="function"||h.nodeType!==C(h)||h.childNodes!==k(h)},Qt=function(h){if(!C||typeof h!="object"||h===null)return!1;try{return C(h)===ke.documentFragment}catch{return!1}},_r=function(h){if(!C||typeof h!="object"||h===null)return!1;try{return typeof C(h)=="number"}catch{return!1}};function ut(S,h,g){S.length!==0&&Pt(S,_=>{_.call(e,h,g,Nn)})}const Lb=function(h,g){return!!(_t&&h.hasChildNodes()&&!_r(h.firstElementChild)&&Ee(Zo,h.textContent)&&Ee(Zo,h.innerHTML)||_t&&fg[g]&&M(h)===ke.element&&B(h)===St&&(_r(h.firstElementChild)||typeof h.textContent=="string"&&Ee(Zo,h.textContent))||h.nodeType===ke.processingInstruction||_t&&h.nodeType===ke.comment&&Ee(jc,h.data))},ji=function(h,g){if(h instanceof RegExp)return Ee(h,g);if(h instanceof Function){for(var _=arguments.length,j=new Array(_>2?_-2:0),O=2;O<_;O++)j[O-2]=arguments[O];return!!h(g,...j)}return!1},$b=function(h,g,_){if(!sn[g]&&_u(g)&&ji(Ke.tagNameCheck,g))return!1;if(sa&&!cn[g]&&!cn[rn(g)]){const j=w(h),O=k(h);if(O&&j){const q=O.length;for(let G=q-1;G>=0;--G){const je=h===_?f(O[G],!0):O[G];j.insertBefore(je,v(h))}}}return Wt(h),!0},wu=function(h,g,_,j){return h.length===0?g:g===_||g===j?Ge(g):g},Ln=function(h,g){return h===g||w(h)!==null?!1:(la&&ga(h),!0)},ya=function(h,g){if(Nb(h),ut(H.beforeSanitizeElements,h,null),Ln(h,g))return!0;if(_i(h))return Wt(h),!0;const _=ve(P(h));if(U=wu(H.uponSanitizeElement,U,lt,In),ut(H.uponSanitizeElement,h,{tagName:_,allowedTags:U}),Ln(h,g))return!0;if(Lb(h,_))return Wt(h),!0;if(sn[_]||!(kt.tagCheck instanceof Function&&kt.tagCheck(_))&&!U[_]){const j=$b(h,_,g);return j===!1&&(ut(H.afterSanitizeElements,h,null),Ln(h,g))?!0:j}if(M(h)===ke.element&&!Rb(h)||(_==="noscript"||_==="noembed"||_==="noframes")&&Ee(hg,h.innerHTML))return Wt(h),!0;if(ct&&h.nodeType===ke.text){const j=ki(h.textContent);h.textContent!==j&&(hr(e.removed,{element:h.cloneNode()}),h.textContent=j)}return ut(H.afterSanitizeElements,h,null),Ln(h,g)},ku=function(h,g,_){if(mi[g]||bu(g,h)||jt&&(g==="id"||g==="name")&&(_ in n||_ in Sb))return!1;const j=ie[g]||kt.attributeCheck instanceof Function&&kt.attributeCheck(g,h);return vr&&Ee(Oe,g)||gi&&Ee(Ht,g)?!0:j?lu[g]||Ee(Be,pr(_,R,""))||(g==="src"||g==="xlink:href"||g==="href")&&h!=="script"&&mc(_,"data:")===0&&au[h]||xi&&!Ee(En,pr(_,R,""))?!0:!_:_u(h)&&ji(Ke.tagNameCheck,h)&&ji(Ke.attributeNameCheck,g,h)||g==="is"&&Ke.allowCustomizedBuiltInElements&&ji(Ke.tagNameCheck,_)},Db=te({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),_u=function(h){return!Db[rn(h)]&&Ee(K,h)},zb=function(h,g,_,j){if(D&&typeof d=="object"&&typeof d.getAttributeType=="function"&&!_)switch(d.getAttributeType(h,g)){case"TrustedHTML":return ce(j);case"TrustedScriptURL":return Ne(j)}return j},qb=function(h,g,_,j){try{return _?h.setAttributeNS(_,g,j):h.setAttribute(g,j),_i(h)?(Wt(h),!1):!0}catch{return On(g,h),!1}},ju=function(h,g){return _t&&Ee(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,g)?!0:rn(h)==="attributename"&&pc(g,"href")!==null},wa=function(h,g){if(ut(H.beforeSanitizeAttributes,h,null),Ln(h,g))return;const _=h.attributes;if(!_||_i(h))return;ie=wu(H.uponSanitizeAttribute,ie,Ue,X);const j={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ie,forceKeepAttr:void 0};let O=_.length;const q=ve(h.nodeName);for(;O--;){const G=_[O],je=G.name,Tt=G.namespaceURI,$e=G.value,Ve=ve(je),$n=$e;let He=je==="value"?$n:Gm($n),Su=!1;if(j.attrName=Ve,j.attrValue=He,j.keepAttr=!0,j.forceKeepAttr=void 0,ut(H.uponSanitizeAttribute,h,j),He=j.attrValue,bi&&(Ve==="id"||Ve==="name")&&mc(He,vi)!==0&&(On(je,h,G),He=vi+He,Su=!0),ju(je,He)){On(je,h,G);continue}if(!j.forceKeepAttr){if(!j.keepAttr){On(je,h,G);continue}if(!yr&&Ee(Sc,He)){On(je,h,G);continue}if(ct&&(He=ki(He)),!ku(q,Ve,He)){On(je,h,G);continue}He=zb(q,Ve,Tt,He),He!==$n&&qb(h,je,Tt,He)&&Su&&fc(e.removed)}}ut(H.afterSanitizeAttributes,h,null),Ln(h,g)},jr=function(h){let g=null;const _=ba(h);for(ut(H.beforeSanitizeShadowDOM,h,null);g=_.nextNode();)if(ut(H.uponSanitizeShadowNode,g,null),ya(g,h),wa(g,h),Qt(g.content)&&jr(g.content),M(g)===ke.element){const j=b(g);Qt(j)&&(ka(j),jr(j))}ct&&yu(h),ut(H.afterSanitizeShadowDOM,h,null)},ka=function(h){const g=[{node:h,shadow:null}];for(;g.length>0;){const _=g.pop();if(_.shadow){jr(_.shadow);continue}const j=_.node,O=M(j)===ke.element,q=k(j);if(q)for(let G=q.length-1;G>=0;--G)g.push({node:q[G],shadow:null});if(O){const G=E?E(j):null;if(typeof G=="string"&&ve(G)==="template"){const je=j.content;Qt(je)&&g.push({node:je,shadow:null})}}if(O){const G=b(j);Qt(G)&&g.push({node:null,shadow:G},{node:G,shadow:null})}}};return e.sanitize=function(S){let h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},g=null,_=null,j=null,O=null;if(ca=!S,ca&&(S="<!-->"),typeof S!="string"&&!_r(S)&&(S=Xm(S),typeof S!="string"))throw Nt("dirty is not a string, aborting");if(!e.isSupported)return S;wr?(U=In,ie=X):fa(h),(H.uponSanitizeElement.length>0||H.uponSanitizeAttribute.length>0)&&(U=Ge(U)),H.uponSanitizeAttribute.length>0&&(ie=Ge(ie)),e.removed=[];const q=la&&typeof S!="string"&&_r(S);let G=[];const je=ln;if(q){Ob(S);const Ve=P(S);if(typeof Ve=="string"){const $n=ve(Ve);if(!U[$n]||sn[$n])throw pa(S),Nt("root node is forbidden and cannot be sanitized in-place")}if(_i(S))throw pa(S),Nt("root node is clobbered and cannot be sanitized in-place");G=xa(S),ln=Wo()}else if(_r(S))g=vu("<!---->"),_=g.ownerDocument.importNode(S,!0),_.nodeType===ke.element&&_.nodeName==="BODY"||_.nodeName==="HTML"?g=_:g.appendChild(_),ka(g);else{if(!ue&&!ct&&!Lt&&S.indexOf("<")===-1)return D&&be?ce(S):S;if(g=vu(S),!g)return ue?null:be?y:""}g&&Q&&Wt(g.firstChild);const Tt=q?S:g;try{q&&ka(S);const Ve=ba(Tt);for(;j=Ve.nextNode();)ya(j,Tt),wa(j,Tt),Qt(j.content)&&jr(j.content);q&&Mb(S,G)}catch(Ve){throw q&&(pa(S),xu(S,G)),Ve}finally{ln=je}if(q){if(xu(S,G))throw Nt("a node selected for removal could not be safely returned; refusing to sanitize in place");return ct&&va(S),S}if(ue){if(ct&&va(g),tt)for(O=Vt.call(g.ownerDocument);g.firstChild;)O.appendChild(g.firstChild);else O=g;return(ie.shadowroot||ie.shadowrootmode)&&(O=W.call(r,O,!0)),O}let $e=Lt?g.outerHTML:g.innerHTML;return Lt&&U["!doctype"]&&g.ownerDocument&&g.ownerDocument.doctype&&g.ownerDocument.doctype.name&&Ee(ug,g.ownerDocument.doctype.name)&&($e="<!DOCTYPE "+g.ownerDocument.doctype.name+`>
79
+ `+$e),ct&&($e=ki($e)),D&&be?ce($e):$e},e.setConfig=function(){let S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};fa(S),wr=!0,In=U,X=ie},e.clearConfig=function(){Nn=null,wr=!1,In=null,X=null,D=A,y=""},e.isValidAttribute=function(S,h,g){Nn||fa({});const _=ve(S),j=ve(h);return typeof g=="string"&&(ju(h,g)||!yr&&Ee(Sc,g))?!1:ku(_,j,g)},e.addHook=function(S,h){typeof h=="function"&&qe(H,S)&&hr(H[S],h)},e.removeHook=function(S,h){if(qe(H,S)){if(h!==void 0){const g=Hm(H[S],h);return g===-1?void 0:Qm(H[S],g,1)[0]}return fc(H[S])}},e.removeHooks=function(S){qe(H,S)&&(H[S]=[])},e.removeAllHooks=function(){H=Tc()},e}var gg=Cc();function xg(t){return t.trim().split(/\n\s*-{3,}\s*\n/).map(e=>{const[n="",...r]=e.trim().split(`
80
80
  `);return{title:n.replace(/^\*+|\*+$/g,"").trim(),body:r.join(`
81
- `).trim()}}).filter(e=>(e.title!==""||e.body!=="")&&!/^-{3,}$/.test(e.title))}function dm(t){const e=um(t);return e.length===0?"":`<div class="jex-card-grid">${e.map(r=>{const i=r.title?`<div class="jex-card-title">${K.parseInline(r.title)}</div>`:"",o=r.body?K.parse(r.body):"";return`<div class="jex-card">${i}${o}</div>`}).join("")}</div>`}K.setOptions({breaks:!0,gfm:!0});function Zr(t){return t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}K.use({renderer:{code(t){return t.lang==="cards"&&t.raw.trimEnd().endsWith("```")?dm(t.text):!1},image(t){const e=t.href??"",n=`<img src="${Zr(e)}" alt="${Zr(t.text??"")}"`+(t.title?` title="${Zr(t.title)}"`:"")+' loading="lazy" />';return/^https?:\/\//i.test(e)?`<a href="${Zr(e)}" class="jex-md-img-link">${n}</a>`:n}}});const ar=typeof window<"u"?cm:null;ar&&typeof ar.addHook=="function"&&ar.addHook("afterSanitizeAttributes",t=>{t.tagName==="A"&&t.hasAttribute("href")&&(t.setAttribute("target","_blank"),t.setAttribute("rel","noopener noreferrer"))});function hm(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function fm(t){if(!t)return"";if(!ar)return hm(t);const e=K.parse(t),n=typeof e=="string"?e:"";return ar.sanitize(n)}function pm({text:t}){const e=we(()=>fm(t),[t]);return s("div",{class:"jex-md",dangerouslySetInnerHTML:{__html:e}})}function Vl({onQuote:t}){const e=I();return s("button",{type:"button",class:"jex-quote-btn","aria-label":e.quoteMessage,title:e.quoteMessage,onClick:t,children:s(uo,{size:12})})}function mm(t,e,n){return t.role==="user"?n:t.authorName??e??""}function gm({authorLabel:t,content:e,onClick:n}){return s("button",{type:"button",class:"jex-quoted-chip",onClick:n,children:[s(uo,{size:11}),s("span",{class:"jex-quoted-chip-text",children:[t&&s("span",{class:"jex-quoted-chip-author",children:[t,": "]}),Gs(e)]})]})}function Hl({quotes:t,botName:e,yourMessageLabel:n,onQuotedClick:r}){return t.length===0?null:s("div",{class:"jex-quoted-list",children:t.map(i=>s(gm,{authorLabel:mm(i,e,n),content:i.content,onClick:r?o=>{r(i.id,o)}:void 0},i.id))})}function xm(t){const e=t.trim().split(/\s+/).filter(Boolean);return e.length===0?"?":e.map(n=>n[0]).join("").slice(0,2).toUpperCase()}function Jt({text:t,streaming:e,error:n,authorId:r,authorName:i,authorImage:o,botAvatarUrl:a,botName:l,onQuote:c,id:u,quoted:d,onQuotedClick:m}){const h=I(),p=!!r,[x,w]=O(!1),b=Z(()=>w(!0),[]),v=p?i??"":l??"",k=["jex-message bot",n?"jex-message-error":""].filter(Boolean).join(" ");return s("div",{class:"jex-message-row bot",children:[s("div",{class:"jex-message-head",children:[s("div",{class:`jex-avatar ${p?"jex-avatar-agent":"jex-avatar-bot"}`,children:p&&o&&!x?s("img",{src:o,alt:i??"",class:"jex-avatar-img",onError:b}):p?s("span",{class:"jex-avatar-initials",children:xm(i??"")}):a&&!x?s("img",{src:a,alt:"",class:"jex-avatar-img",onError:b}):s(qr,{size:14})}),v&&s("span",{class:"jex-message-author",children:v})]}),s("div",{class:k,id:u,children:[s(Hl,{quotes:d??[],botName:l,yourMessageLabel:h.quotedYourMessage,onQuotedClick:m}),s(pm,{text:t}),e&&s("span",{class:"jex-streaming-cursor"}),c&&s(Vl,{onQuote:c})]})]})}function bm({questions:t,disabled:e,onPick:n}){return t.length===0?null:s("div",{class:"jex-starter-chips",children:t.map(r=>s("button",{type:"button",class:"jex-starter-chip",disabled:e,onClick:()=>{n(r)},children:r},r))})}function vm(t,e){const n=[...new Set(e.flatMap(c=>c.split(/\s+/)).filter(c=>c.length>1))];if(n.length===0)return[t];const r=n.map(c=>c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),i=new RegExp(`@(?:${r.join("|")})\\b`,"gi"),o=[];let a=0,l;for(;(l=i.exec(t))!==null;)l.index>a&&o.push(t.slice(a,l.index)),o.push(s("span",{class:"jex-mention",children:l[0]},l.index)),a=l.index+l[0].length;return a<t.length&&o.push(t.slice(a)),o}function ym({text:t,id:e,onQuote:n,botName:r,quoted:i,onQuotedClick:o,agentNames:a}){const l=I();return s("div",{class:"jex-message user",id:e,children:[s(Hl,{quotes:i??[],botName:r,yourMessageLabel:l.quotedYourMessage,onQuotedClick:o}),vm(t,a??[]),n&&s(Vl,{onQuote:n})]})}function Wl(){return kt(oe.escalations.public.submitEscalation)}function Ql(){const t=kt(oe.escalations.public.markEscalationWaiting);return e=>{Xn.value=e,t({sessionId:e.sessionId,visitorId:e.visitorId}).catch(n=>{X.error("[waiting] markEscalationWaiting failed:",n)})}}function ei(){const t=kt(oe.analytics.formEvents.recordFormClick);return e=>{t(e).catch(n=>{X.warn("[useFormClick] click not recorded:",n)})}}function wm({message:t,sessionId:e,visitorId:n,waitingSetAt:r}){const i=I();return t.formData?s("div",{class:"jex-inline-form-submitted",children:[s("span",{class:"jex-inline-form-check",children:"✓"}),s("div",{children:[s("div",{class:"jex-inline-form-submitted-title",children:i.escalationSubmitted}),s("div",{class:"jex-inline-form-submitted-detail",children:[t.formData.visitorName," · ",t.formData.visitorEmail]})]})]}):s("div",{class:"jex-message-row bot",children:s(km,{messageId:t._id,sessionId:e,visitorId:n,waitingSetAt:r})})}function km({messageId:t,sessionId:e,visitorId:n,waitingSetAt:r}){const i=I(),[o,a]=O(""),[l,c]=O(""),[u,d]=O(!1),m=Wn.value,h=/^https?:\/\//i.test(m)?m:Hn,p=Wl(),x=Ql(),w=ei();async function b(v){if(v.preventDefault(),!u){d(!0);try{await p({sessionId:e,visitorId:n,formMessageId:t,visitorName:o.trim(),visitorEmail:l.trim(),locale:Ve.value})}catch(k){X.error("[FormMessage] Submit failed:",k),d(!1)}}}return s("div",{class:"jex-inline-form",children:[s("div",{class:"jex-inline-form-title",children:i.escalationFormTitle}),s("form",{class:"jex-form",onSubmit:v=>{b(v)},children:[s("input",{class:"jex-form-input",type:"text",placeholder:i.escalationNameLabel,value:o,required:!0,disabled:u,onInput:v=>{a(v.currentTarget.value)}}),s("input",{class:"jex-form-input",type:"email",placeholder:i.escalationEmailLabel,value:l,required:!0,disabled:u,onInput:v=>{c(v.currentTarget.value)}}),s("button",{class:"jex-form-submit",type:"submit",disabled:u,onClick:()=>{w({sessionId:e,visitorId:n,formMessageId:t})},children:u?i.escalationSubmitting:i.escalationSubmit})]}),s("button",{type:"button",class:"jex-escalation-skip",onClick:()=>{x({formMessageId:t,sessionId:e,visitorId:n,waitingSetAt:r})},children:i.escalationSkip}),s("div",{class:"jex-inline-form-consent",children:[i.escalationConsent," ",s("a",{href:h,target:"_blank",rel:"noopener noreferrer",class:"jex-privacy-notice-link",children:i.escalationPrivacyLinkText}),"."]})]})}function _m(){return kt(oe.functions.magicline.public.submitForm)}function jm(){return Ht(oe.functions.magicline.actions.getTrialConfig)}function Sm(){return Ht(oe.functions.magicline.actions.listTrialSlots)}function Tm(){return Ht(oe.functions.magicline.actions.getRateBundles)}function Gl(){return Ht(oe.functions.magicline.actions.getContractPreview)}function Cm(){return Ht(oe.functions.magicline.actions.submitContractCreation)}const Ro={en:Yi,de:Es},Am=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function Kl(t){return Am.test(t.trim())}function Rm(t,e=new Date){const n=t.trim();if(n==="")return null;const r=n.split("-");if(r.length!==3)return null;const i=Number(r[0]),o=Number(r[1]),a=Number(r[2]);if(!Number.isInteger(i)||!Number.isInteger(o)||!Number.isInteger(a)||o<1||o>12||a<1||a>31)return null;let l=e.getFullYear()-i;const c=e.getMonth()+1-o;return(c<0||c===0&&e.getDate()<a)&&(l-=1),l}function Yl(t=new Date){const e=t.getFullYear(),n=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0");return`${e}-${n}-${r}`}function Jl(){const t=Wn.value;return/^https?:\/\//i.test(t)?t:Hn}const Em={DE:22,AT:20,CH:21,GB:22,FR:27,NL:18,BE:16,ES:24,IT:27,PL:28,SE:24,NO:15,DK:18,FI:18,PT:25},Im=15,Pm=34;function Xl(t){return t.replace(/\s+/g,"").toUpperCase()}function Mm(t){const e=Xl(t),n=e.slice(0,2),r=Em[n];if(r!==void 0){if(e.length!==r)return!1}else if(e.length<Im||e.length>Pm)return!1;const i=e.slice(4)+e.slice(0,4);let o="";for(const l of i){const c=l.charCodeAt(0);if(c>=65&&c<=90)o+=String(c-55);else if(c>=48&&c<=57)o+=l;else return!1}let a=0;for(let l=0;l<o.length;l+=9){const c=String(a)+o.slice(l,l+9);a=Number(c)%97}return a===1}function Nm(t){const e=Xl(t);if(e.length<=8)return e;const n=e.slice(0,4),r=e.slice(-4);return(n+"•".repeat(e.length-8)+r).replace(/(.{4})/g,"$1 ").trim()}function rt(t,e,n){const r=n==="de"?"de-DE":"en-GB";try{return new Intl.NumberFormat(r,{style:"currency",currency:e}).format(t)}catch{return`${t.toFixed(2)} ${e}`}}function ti(t,e,n){const r=t!==1,o={DAY:{en:["day","days"],de:["Tag","Tage"]},WEEK:{en:["week","weeks"],de:["Woche","Wochen"]},MONTH:{en:["month","months"],de:["Monat","Monate"]},YEAR:{en:["year","years"],de:["Jahr","Jahre"]}}[e.toUpperCase()];if(!o)return`${t} ${e.toLowerCase()}`;const[a,l]=o[n];return`${t} ${r?l:a}`}function Lm(t,e){const n=t.trim();if(n==="")return"—";const r=e==="de"?"de-DE":"en-GB",i=new Date(n);return Number.isNaN(i.getTime())?t:i.toLocaleDateString(r,{day:"2-digit",month:"long",year:"numeric"})}function Eo(t,e,n){const r=Ro[n],i=e.toUpperCase();if(t===1)return{DAY:r.magiclineFreqPerDay,WEEK:r.magiclineFreqPerWeek,MONTH:r.magiclineFreqPerMonth,YEAR:r.magiclineFreqPerYear}[i]??e.toLowerCase();const a={DAY:r.magiclineFreqEveryDays,WEEK:r.magiclineFreqEveryWeeks,MONTH:r.magiclineFreqEveryMonths,YEAR:r.magiclineFreqEveryYears}[i];return a===void 0?`${t} ${e.toLowerCase()}`:a.replace("{n}",String(t))}function Om(t,e,n,r,i){const o=Ro[i],a=rt(t,e,i);switch(n){case"TERM_BASED":return`${a} ${o.magiclineModulePerTerm}`;case"RECURRING":return`${a} ${Eo(1,r??"MONTH",i)}`;case"NON_RECURRING":return`${a} ${o.magiclineModuleOneTime}`;case"MONTH_DAY":return`${a} ${o.magiclineModuleOneTime}`;case"FREE":return o.magiclineModuleIncluded;default:return a}}function $m(t,e,n,r){return e==="PERCENTAGE"?`-${t}%`:`-${rt(t,n,r)}`}const Dm={startpaket:"magiclineFeeStarterPackage","starter package":"magiclineFeeStarterPackage",trainerpauschale:"magiclineFeeTrainerFee"};function Zl(t,e){const n=t.trim().toLowerCase(),r=Dm[n];return r!==void 0?e[r]:t}function qm(t,e,n){const r=Ro[n];if(t==="NONE")return r.magiclineRenewalNone;if(t==="TERM_EXTENSION"&&e!==null){const i=ti(e.value,e.unit,n);return r.magiclineRenewalTerm.replace("{n} {unit}",i)}return""}const ec=["MALE","FEMALE","UNISEX"],zm=[{code:"DE",label:"Germany / Deutschland"},{code:"AT",label:"Austria / Österreich"},{code:"CH",label:"Switzerland / Schweiz"},{code:"LI",label:"Liechtenstein"},{code:"LU",label:"Luxembourg / Luxemburg"},{code:"NL",label:"Netherlands / Niederlande"},{code:"BE",label:"Belgium / Belgien"},{code:"FR",label:"France / Frankreich"},{code:"IT",label:"Italy / Italien"},{code:"ES",label:"Spain / Spanien"},{code:"PL",label:"Poland / Polen"},{code:"CZ",label:"Czechia / Tschechien"},{code:"DK",label:"Denmark / Dänemark"},{code:"GB",label:"United Kingdom"},{code:"US",label:"United States"}];function Fm(t,e){const n=[];return e&&n.push("trainer"),n.push("slot"),n.push("personal"),(t.address.visible||t.zip.visible)&&n.push("address"),n.push("confirm"),n}const Um={firstName:"",lastName:"",email:"",phone:"",birthDate:"",gender:"",street:"",houseNumber:"",zip:"",city:"",country:"",note:"",slotId:"",consent:!1,trainerRequired:!0};function Bm(t,e){switch(e.type){case"set":return{...t,[e.key]:e.value};case"setTrainer":return{...t,trainerRequired:e.trainerRequired,slotId:""};case"clearSlotIfAbsent":return t.slotId!==""&&!e.available.includes(t.slotId)?{...t,slotId:""}:t;default:return t}}function Vm({sessionId:t,visitorId:e}){const n=jm(),r=Sm(),[i,o]=Be(Bm,Um),[a,l]=Be((v,k)=>k,{phase:"loading"}),[c,u]=Be((v,k)=>k,{phase:"loading"}),[d,m]=Be(v=>v+1,0),h=Z((v,k)=>{o({type:"set",key:v,value:k})},[]),p=Z(v=>{o({type:"setTrainer",trainerRequired:v}),m()},[]),x=Z(()=>{m()},[]);M(()=>{let v=!1;return(async()=>{try{const k=await n({sessionId:t,visitorId:e});if(v)return;k.status==="ok"?l({phase:"ready",config:{plan:k.plan,minimumAge:k.minimumAge,bookingWithoutTrainerAllowed:k.bookingWithoutTrainerAllowed,studioZoneId:k.studioZoneId}}):l({phase:"error",code:k.status,backendMessage:k.message})}catch{v||l({phase:"error",code:"unavailable",backendMessage:""})}})(),()=>{v=!0}},[n,t,e]);const w=a.phase==="ready",{trainerRequired:b}=i;return M(()=>{if(!w)return;let v=!1;return u({phase:"loading"}),(async()=>{try{const k=await r({sessionId:t,visitorId:e,trainerRequired:b});if(v)return;k.status==="ok"?k.slots.length>0?(u({phase:"ready",slots:k.slots}),o({type:"clearSlotIfAbsent",available:k.slots.map(A=>A.startDateTime)})):u({phase:"empty"}):u({phase:"error"})}catch{v||u({phase:"error"})}})(),()=>{v=!0}},[w,r,t,e,b,d]),{fields:i,setField:h,setTrainerRequired:p,configState:a,slotsState:c,refetchSlots:x}}function Hm({formMessageId:t,sessionId:e,visitorId:n,slotUnavailable:r=!1,retryPending:i=!1}){const o=I(),a=_m(),{fields:l,setField:c,setTrainerRequired:u,configState:d,slotsState:m,refetchSlots:h}=Vm({sessionId:e,visitorId:n});return d.phase==="loading"?s("div",{class:"jex-inline-form jex-magicline-form",children:[s("div",{class:"jex-inline-form-title",children:o.magiclineTrialTitle}),s("div",{class:"jex-magicline-slots-hint",children:o.magiclineConfigLoading})]}):d.phase==="error"?s("div",{class:"jex-inline-form jex-magicline-form",children:[s("div",{class:"jex-inline-form-title",children:o.magiclineTrialTitle}),s("div",{class:"jex-magicline-slots-hint",role:"alert",children:Zm(d.code,d.backendMessage,o)})]}):s(Wm,{formMessageId:t,sessionId:e,visitorId:n,slotUnavailable:r,retryPending:i,config:d.config,fields:l,setField:c,setTrainerRequired:u,slotsState:m,refetchSlots:h,submitForm:a})}function Wm({formMessageId:t,sessionId:e,visitorId:n,slotUnavailable:r,retryPending:i,config:o,fields:a,setField:l,setTrainerRequired:c,slotsState:u,refetchSlots:d,submitForm:m}){const h=I(),p=ei(),{plan:x,minimumAge:w,bookingWithoutTrainerAllowed:b,studioZoneId:v}=o,k=we(()=>Fm(x,b),[x,b]),A=r?Math.max(k.indexOf("slot"),0):0,[N,P]=O(A),[T,$]=O({}),[R,se]=O(!1),[V,y]=O(null),le=we(()=>Jl(),[]),C=Math.min(N,k.length-1),D=k[C]??"slot",me=C===k.length-1,q=C===0;function Oe(de){const z={};if(de==="slot")return a.slotId===""&&(z.slotId=h.magiclineSlotRequiredError),z;if(de==="personal"){if(a.firstName.trim()===""&&(z.firstName=h.magiclineRequiredError),a.lastName.trim()===""&&(z.lastName=h.magiclineRequiredError),x.email.visible&&x.email.required&&a.email.trim()===""&&(z.email=h.magiclineRequiredError),a.email.trim()!==""&&!Kl(a.email)&&(z.email=h.magiclineEmailError),x.phone.visible&&x.phone.required&&a.phone.trim()===""&&(z.phone=h.magiclineRequiredError),x.gender.visible&&x.gender.required&&a.gender===""&&(z.gender=h.magiclineRequiredError),x.dateOfBirth.visible&&(x.dateOfBirth.required&&a.birthDate.trim()===""&&(z.birthDate=h.magiclineRequiredError),a.birthDate.trim()!=="")){const Me=Rm(a.birthDate);Me!==null&&Me<0?z.birthDate=h.magiclineRequiredError:w>0&&Me!==null&&Me<w&&(z.birthDate=h.magiclineMinAgeError.replace("{age}",String(w)))}return z}return de==="address"?(x.address.visible&&x.address.required&&(a.street.trim()===""&&(z.street=h.magiclineRequiredError),a.houseNumber.trim()===""&&(z.houseNumber=h.magiclineRequiredError),a.city.trim()===""&&(z.city=h.magiclineRequiredError),a.country===""&&(z.country=h.magiclineRequiredError)),x.zip.visible&&x.zip.required&&a.zip.trim()===""&&(z.zip=h.magiclineRequiredError),z):(de==="confirm"&&(a.consent||(z.consent=h.magiclineConsentError)),z)}function mt(){const de=Oe(D);if(Object.keys(de).length>0){$(de);return}$({}),P(z=>Math.min(z+1,k.length-1))}function St(){$({}),y(null),P(de=>Math.max(de-1,0))}async function Xt(){if(R)return;const de=Oe("confirm");if(Object.keys(de).length>0){$(de);return}$({}),y(null),se(!0);try{const z=eg(x,a);await m({sessionId:e,visitorId:n,formMessageId:t,action:"trialSessionBooking",fields:z})}catch(z){X.error("[TrialSessionBookingForm] Submit failed:",z),y(h.magiclineFailedDetail),se(!1)}}function ne(){p({sessionId:e,visitorId:n,formMessageId:t}),me?Xt():mt()}const We=Xm(D,h),qt=`jex-ml-consent-${t}`;return s("div",{class:"jex-inline-form jex-magicline-form",children:[s("div",{class:"jex-magicline-wizard-header",children:[s("div",{class:"jex-inline-form-title",children:h.magiclineTrialTitle}),s("div",{class:"jex-magicline-wizard-progress",children:[s("span",{class:"jex-magicline-wizard-step-label",children:We}),s("span",{class:"jex-magicline-wizard-counter",children:h.magiclineStepCounter.replace("{n}",String(C+1)).replace("{total}",String(k.length))})]}),s("div",{class:"jex-magicline-wizard-dots","aria-hidden":"true",children:k.map((de,z)=>s("span",{class:z===C?"jex-magicline-wizard-dot jex-magicline-wizard-dot-active":"jex-magicline-wizard-dot"},de))})]}),s("div",{class:"jex-form",role:"group","aria-label":We,children:[D==="trainer"?s(Qm,{formMessageId:t,trainerRequired:a.trainerRequired,disabled:R,onChange:c}):null,D==="slot"?s(Gm,{slotsState:u,slotId:a.slotId,studioZoneId:v,disabled:R,retryPending:i,slotUnavailable:r,error:T.slotId,onSelect:de=>{l("slotId",de)},onRetry:d}):null,D==="personal"?s(Km,{plan:x,fields:a,errors:T,disabled:R,setField:l}):null,D==="address"?s(Ym,{plan:x,fields:a,errors:T,disabled:R,setField:l}):null,D==="confirm"?s(Jm,{consentId:qt,privacyUrl:le,studioZoneId:v,fields:a,disabled:R,consentError:T.consent,setField:l}):null,V!==null?s("div",{class:"jex-magicline-error",role:"alert",children:V}):null,s("div",{class:"jex-magicline-wizard-nav",children:[q?null:s("button",{type:"button",class:"jex-magicline-wizard-back",disabled:R,onClick:St,children:h.magiclineWizardBack}),s("button",{type:"button",class:"jex-form-submit jex-magicline-wizard-next",disabled:R,onClick:ne,children:me?R?h.magiclineSubmitting:h.magiclineSubmit:h.magiclineWizardNext})]})]})]})}function Qm({formMessageId:t,trainerRequired:e,disabled:n,onChange:r}){const i=I(),o=`jex-ml-trainer-${t}`;return s("div",{class:"jex-magicline-radio-group",role:"radiogroup","aria-label":i.magiclineStepTrainer,children:[s("label",{class:e?"jex-magicline-radio-card jex-magicline-radio-card-active":"jex-magicline-radio-card",children:[s("input",{type:"radio",name:o,checked:e,disabled:n,onChange:()=>{r(!0)}}),s("span",{children:i.magiclineTrainerWith})]}),s("label",{class:e?"jex-magicline-radio-card":"jex-magicline-radio-card jex-magicline-radio-card-active",children:[s("input",{type:"radio",name:o,checked:!e,disabled:n,onChange:()=>{r(!1)}}),s("span",{children:i.magiclineTrainerWithout})]})]})}function Gm({slotsState:t,slotId:e,studioZoneId:n,disabled:r,retryPending:i,slotUnavailable:o,error:a,onSelect:l,onRetry:c}){const u=I();return s(ee,{children:[o?s("div",{class:"jex-magicline-error",role:"alert",children:u.magiclineSlotUnavailableNotice}):null,i||t.phase==="loading"?s("div",{class:"jex-magicline-slots-hint","aria-live":"polite",children:u.magiclineLoadingSlots}):t.phase==="ready"?s("select",{class:"jex-form-input jex-magicline-select","aria-label":u.magiclineSlotLabel,value:e,required:!0,disabled:r,"aria-invalid":a!==void 0,onChange:d=>{l(d.currentTarget.value)},children:[s("option",{value:"",disabled:!0,children:u.magiclineSlotPlaceholder}),t.slots.map(d=>s("option",{value:d.startDateTime,children:nc(d.startDateTime,Ve.value,n)},d.startDateTime))]}):t.phase==="error"?s("div",{class:"jex-magicline-slots-error",children:[s("div",{class:"jex-magicline-slots-hint",role:"alert","aria-live":"polite",children:u.magiclineSlotsError}),s("button",{type:"button",class:"jex-magicline-retry",disabled:r,onClick:c,children:u.magiclineRetry})]}):s("div",{class:"jex-magicline-slots-hint",role:"alert","aria-live":"polite",children:u.magiclineNoSlots}),a!==void 0?s("div",{class:"jex-magicline-error",role:"alert",children:a}):null]})}function Km({plan:t,fields:e,errors:n,disabled:r,setField:i}){const o=I(),a=we(()=>Yl(),[]);return s(ee,{children:[s("div",{class:"jex-magicline-row",children:[s($t,{label:o.magiclineFirstName,value:e.firstName,required:!0,disabled:r,error:n.firstName,fieldKey:"firstName",onInput:l=>{i("firstName",l)}}),s($t,{label:o.magiclineLastName,value:e.lastName,required:!0,disabled:r,error:n.lastName,fieldKey:"lastName",onInput:l=>{i("lastName",l)}})]}),t.email.visible?s($t,{label:Ye(o.magiclineEmail,t.email.required,o),type:"email",value:e.email,required:t.email.required,disabled:r,error:n.email,fieldKey:"email",onInput:l=>{i("email",l)}}):null,t.phone.visible?s($t,{label:Ye(o.magiclinePhone,t.phone.required,o),type:"tel",value:e.phone,required:t.phone.required,disabled:r,error:n.phone,fieldKey:"phone",onInput:l=>{i("phone",l)}}):null,t.dateOfBirth.visible?s("label",{class:"jex-magicline-field",children:[s("span",{class:"jex-magicline-field-label",children:Ye(o.magiclineBirthDate,t.dateOfBirth.required,o)}),s("input",{class:"jex-form-input",type:"date","aria-label":Ye(o.magiclineBirthDate,t.dateOfBirth.required,o),value:e.birthDate,max:a,required:t.dateOfBirth.required,disabled:r,"aria-invalid":n.birthDate!==void 0,onInput:l=>{i("birthDate",l.currentTarget.value)}}),n.birthDate!==void 0?s("span",{class:"jex-magicline-error",role:"alert",children:n.birthDate}):null]}):null,t.gender.visible?s(tc,{label:Ye(o.magiclineGender,t.gender.required,o),value:e.gender,required:t.gender.required,disabled:r,placeholder:Ye(o.magiclineGenderPlaceholder,t.gender.required,o),error:n.gender,onChange:l=>{i("gender",l)},options:ec.map(l=>({value:l,label:tg(l,o)}))}):null]})}function Ym({plan:t,fields:e,errors:n,disabled:r,setField:i}){const o=I();return s(ee,{children:[t.address.visible?s(ee,{children:[s("div",{class:"jex-magicline-row",children:[s($t,{label:Ye(o.magiclineStreet,t.address.required,o),value:e.street,required:t.address.required,disabled:r,error:n.street,fieldKey:"street",onInput:a=>{i("street",a)}}),s($t,{label:Ye(o.magiclineHouseNumber,t.address.required,o),value:e.houseNumber,required:t.address.required,disabled:r,error:n.houseNumber,fieldKey:"houseNumber",onInput:a=>{i("houseNumber",a)}})]}),s($t,{label:Ye(o.magiclineCity,t.address.required,o),value:e.city,required:t.address.required,disabled:r,error:n.city,fieldKey:"city",onInput:a=>{i("city",a)}}),s(tc,{label:Ye(o.magiclineCountry,t.address.required,o),value:e.country,required:t.address.required,disabled:r,placeholder:Ye(o.magiclineCountryPlaceholder,t.address.required,o),error:n.country,onChange:a=>{i("country",a)},options:zm.map(a=>({value:a.code,label:a.label}))})]}):null,t.zip.visible?s($t,{label:Ye(o.magiclineZip,t.zip.required,o),value:e.zip,required:t.zip.required,disabled:r,error:n.zip,fieldKey:"zip",onInput:a=>{i("zip",a)}}):null]})}function Jm({consentId:t,privacyUrl:e,studioZoneId:n,fields:r,disabled:i,consentError:o,setField:a}){const l=I(),c=r.slotId!==""?nc(r.slotId,Ve.value,n):"—",u=`${r.firstName} ${r.lastName}`.trim();return s(ee,{children:[s("dl",{class:"jex-magicline-summary",children:[s("div",{class:"jex-magicline-summary-row",children:[s("dt",{children:l.magiclineSummaryTrainer}),s("dd",{children:r.trainerRequired?l.magiclineTrainerWith:l.magiclineTrainerWithout})]}),s("div",{class:"jex-magicline-summary-row",children:[s("dt",{children:l.magiclineSummarySlot}),s("dd",{children:c})]}),s("div",{class:"jex-magicline-summary-row",children:[s("dt",{children:l.magiclineSummaryName}),s("dd",{children:u!==""?u:"—"})]})]}),s("textarea",{class:"jex-form-textarea","aria-label":l.magiclineNote,placeholder:l.magiclineNote,value:r.note,disabled:i,onInput:d=>{a("note",d.currentTarget.value)}}),s("label",{class:"jex-magicline-consent",for:t,children:[s("input",{id:t,type:"checkbox",checked:r.consent,disabled:i,"aria-invalid":o!==void 0,onChange:d=>{a("consent",d.currentTarget.checked)}}),s("span",{children:[l.magiclineConsent," ",s("a",{href:e,target:"_blank",rel:"noopener noreferrer",class:"jex-privacy-notice-link",children:l.magiclinePrivacyLinkText}),"."]})]}),o!==void 0?s("div",{class:"jex-magicline-error",role:"alert",children:o}):null]})}function $t({label:t,value:e,fieldKey:n,type:r="text",required:i=!1,disabled:o,error:a,onInput:l}){const c=a!==void 0?`jex-ml-err-${n}`:void 0;return s("div",{class:"jex-magicline-field",children:[s("input",{class:"jex-form-input",type:r,"aria-label":t,placeholder:t,value:e,required:i,disabled:o,"aria-invalid":a!==void 0,"aria-describedby":c,onInput:u=>{l(u.currentTarget.value)}}),a!==void 0?s("span",{id:c,class:"jex-magicline-error",role:"alert",children:a}):null]})}function tc({label:t,value:e,required:n,disabled:r,placeholder:i,error:o,options:a,onChange:l}){return s("div",{class:"jex-magicline-field",children:[s("select",{class:"jex-form-input jex-magicline-select","aria-label":t,value:e,required:n,disabled:r,"aria-invalid":o!==void 0,onChange:c=>{l(c.currentTarget.value)},children:[s("option",{value:"",disabled:n,children:i}),a.map(c=>s("option",{value:c.value,children:c.label},c.value))]}),o!==void 0?s("span",{class:"jex-magicline-error",role:"alert",children:o}):null]})}function Ye(t,e,n){return e?t:t+n.magiclineOptionalSuffix}function Xm(t,e){switch(t){case"trainer":return e.magiclineStepTrainer;case"slot":return e.magiclineStepSlot;case"personal":return e.magiclineStepPersonal;case"address":return e.magiclineStepAddress;case"confirm":return e.magiclineStepConfirm;default:return""}}function Zm(t,e,n){return e.trim()!==""?e:t==="unsupported"?n.magiclineConfigUnsupported:t==="inconsistent"?n.magiclineConfigInconsistent:n.magiclineConfigUnavailable}function eg(t,e){const n={firstname:e.firstName.trim(),lastname:e.lastName.trim(),slotId:e.slotId,trainerRequired:e.trainerRequired,privacyConsent:e.consent};return t.email.visible&&e.email.trim()!==""&&(n.email=e.email.trim()),t.phone.visible&&e.phone.trim()!==""&&(n.phone=e.phone.trim()),t.dateOfBirth.visible&&e.birthDate.trim()!==""&&(n.dateOfBirth=e.birthDate.trim()),t.gender.visible&&e.gender!==""&&(n.gender=e.gender),t.address.visible&&(e.street.trim()!==""&&(n.street=e.street.trim()),e.houseNumber.trim()!==""&&(n.houseNumber=e.houseNumber.trim()),e.city.trim()!==""&&(n.city=e.city.trim()),e.country!==""&&(n.country=e.country)),t.zip.visible&&e.zip.trim()!==""&&(n.zip=e.zip.trim()),e.note.trim()!==""&&(n.note=e.note.trim()),n}function tg(t,e){return t==="MALE"?e.magiclineGenderMale:t==="FEMALE"?e.magiclineGenderFemale:e.magiclineGenderUnisex}function nc(t,e,n){const r=e==="de"?"de-DE":"en-GB",i=t.match(/\[([^\]]+)\]\s*$/),o=i?i[1]:n??void 0,a=t.replace(/\[[^\]]+\]\s*$/,""),l=new Date(a);if(Number.isNaN(l.getTime()))return t;try{return l.toLocaleString(r,{weekday:"short",day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit",...o?{timeZone:o,timeZoneName:"short"}:{timeZoneName:"short"}})}catch{return l.toLocaleString(r,{weekday:"short",day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit",timeZoneName:"short"})}}function rc(t){const e=ie(t);return sn(()=>{e.current=t}),Z((...n)=>e.current(...n),[])}const ng={termId:null,selectedModuleIds:[],acknowledgedBlocks:{},personal:{firstName:"",lastName:"",email:"",dateOfBirth:"",gender:"",phone:""},address:{street:"",houseNumber:"",zipCode:"",city:""},payment:{accountHolder:"",accountHolderTouched:!1,iban:""},consents:{privacy:!1,sepa:!1}};function rg(t,e){switch(e.type){case"setTermId":return t.termId===e.termId?t:{...t,termId:e.termId,selectedModuleIds:[],acknowledgedBlocks:{}};case"toggleModule":{if(e.selected)return t.selectedModuleIds.includes(e.moduleId)?t:{...t,selectedModuleIds:[...t.selectedModuleIds,e.moduleId]};const n={...t.acknowledgedBlocks};return e.consentAckKey!==void 0&&delete n[e.consentAckKey],{...t,selectedModuleIds:t.selectedModuleIds.filter(r=>r!==e.moduleId),acknowledgedBlocks:n}}case"setBlockAck":return{...t,acknowledgedBlocks:{...t.acknowledgedBlocks,[e.ackKey]:e.value}};case"setPersonal":return{...t,personal:{...t.personal,[e.key]:e.value}};case"setAddress":return{...t,address:{...t.address,[e.key]:e.value}};case"setAccountHolder":return{...t,payment:{...t.payment,accountHolder:e.value,accountHolderTouched:!0}};case"setIban":return{...t,payment:{...t.payment,iban:e.value}};case"setConsent":return{...t,consents:{...t.consents,[e.key]:e.value}};case"clearIban":return{...t,payment:{...t.payment,iban:""}};case"clearTermId":return{...t,termId:null,selectedModuleIds:[],acknowledgedBlocks:{}};case"prefillAccountHolder":return t.payment.accountHolderTouched||t.payment.accountHolder!==""?t:{...t,payment:{...t.payment,accountHolder:e.value}};default:return t}}const ic={draftVoucherCode:"",appliedVoucherCode:null,appliedVoucher:null,voucherStatus:"idle",voucherRequestId:0,voucherUnavailable:!1},ig="voucher:";function og(t){const e={};for(const n of Object.keys(t))n.startsWith(ig)||(e[n]=t[n]);return e}function ag(t,e){switch(e.type){case"SET_VOUCHER_DRAFT":{const n=t.appliedVoucher!==null||t.voucherStatus==="applied";return{...t,draftVoucherCode:e.value,...n?{appliedVoucher:null,appliedVoucherCode:null,voucherStatus:"idle"}:{}}}case"VOUCHER_APPLYING":return{...t,voucherStatus:"applying",voucherRequestId:t.voucherRequestId+1};case"VOUCHER_APPLIED":return e.requestId!==t.voucherRequestId?t:{...t,appliedVoucher:e.voucher,appliedVoucherCode:e.appliedCode,voucherStatus:"applied"};case"VOUCHER_INVALID":return{...t,appliedVoucher:null,appliedVoucherCode:null,voucherStatus:"invalid"};case"VOUCHER_DISABLED":return{...t,appliedVoucher:null,appliedVoucherCode:null,voucherStatus:"disabled",voucherUnavailable:!0};case"CLEAR_VOUCHER":return{...t,appliedVoucher:null,appliedVoucherCode:null,voucherStatus:"idle"};default:return t}}function sg(t,e){switch(e.type){case"dropVoucherAcks":{const n=og(t.acknowledgedBlocks);return Object.keys(n).length===Object.keys(t.acknowledgedBlocks).length?t:{...t,acknowledgedBlocks:n}}case"seedVoucherAcks":{if(e.ackKeys.length===0)return t;const n={...t.acknowledgedBlocks};for(const r of e.ackKeys)r in n||(n[r]=!1);return{...t,acknowledgedBlocks:n}}default:return rg(t,e)}}function lg({sessionId:t,visitorId:e}){const n=Tm(),r=Gl(),[i,o]=Be(sg,ng),[a,l]=Be(ag,ic),[c,u]=Be((_,U)=>U,{phase:"loading"}),d=ie(null),[m,h]=Be((_,U)=>U,{phase:"idle"}),p=Z(_=>{_.phase==="ready"?d.current=_.pricing:(_.phase==="idle"||_.phase==="error")&&(d.current=null),h(_)},[]),[x,w]=Be(_=>_+1,0),[b,v]=Be(_=>_+1,0),k=Z(_=>{o({type:"setTermId",termId:_}),l({type:"CLEAR_VOUCHER"})},[]),A=Z((_,U)=>{o({type:"setPersonal",key:_,value:U})},[]),N=Z((_,U)=>{o({type:"setAddress",key:_,value:U})},[]),P=Z((_,U,G)=>{o({type:"toggleModule",moduleId:_,selected:U,consentAckKey:G}),o({type:"dropVoucherAcks"}),l({type:"CLEAR_VOUCHER"})},[]),T=Z((_,U)=>{o({type:"setBlockAck",ackKey:_,value:U})},[]),$=Z(_=>{o({type:"setAccountHolder",value:_})},[]),R=Z(_=>{o({type:"setIban",value:_})},[]),se=Z((_,U)=>{o({type:"setConsent",key:_,value:U})},[]),V=Z(()=>{o({type:"clearIban"})},[]),y=Z(()=>{o({type:"clearTermId"}),l({type:"CLEAR_VOUCHER"})},[]),le=Z(_=>{l({type:"SET_VOUCHER_DRAFT",value:_}),o({type:"dropVoucherAcks"})},[]),C=ie(ic.voucherRequestId),D=Z(()=>{const _=C.current+1;return C.current=_,l({type:"VOUCHER_APPLYING"}),_},[]),me=Z(_=>{_.requestId===C.current&&(l({type:"VOUCHER_APPLIED",requestId:_.requestId,voucher:_.voucher,appliedCode:_.appliedCode,voucherAckKeys:_.voucherAckKeys}),p({phase:"ready",pricing:_.pricing}),o({type:"seedVoucherAcks",ackKeys:_.voucherAckKeys}))},[p]),q=Z(()=>{l({type:"VOUCHER_INVALID"}),o({type:"dropVoucherAcks"}),v()},[]),Oe=Z(()=>{l({type:"VOUCHER_DISABLED"}),o({type:"dropVoucherAcks"}),v()},[]),mt=Z(()=>{l({type:"CLEAR_VOUCHER"}),o({type:"dropVoucherAcks"}),v()},[]),St=Z(()=>{w()},[]),Xt=Z(()=>{p({phase:"idle"})},[p]),ne=Z(()=>{v()},[]),We=c.phase==="ready"&&i.termId!==null?c.terms.find(_=>_.termId===i.termId)??null:null,{selectedModuleIds:qt,acknowledgedBlocks:de}=i,{appliedVoucher:z}=a,Me=we(()=>{if(We===null)return[];const _=new Set;for(const U of We.textBlocks)U.isConfirmationRequired&&_.add(U.ackKey);for(const U of qt){const G=We.optionalModules.find(he=>he.id===U);G?.consent&&_.add(G.consent.ackKey)}if(z!==null)for(const U of z.textBlocks)_.add(U.ackKey);return[..._]},[We,qt,z]),Zt=we(()=>Me.every(_=>de[_]===!0),[Me,de]),{firstName:ke,lastName:Je}=i.personal,{accountHolder:Re,accountHolderTouched:te}=i.payment;M(()=>{te||Re!==""||ke.trim()!==""&&Je.trim()!==""&&o({type:"prefillAccountHolder",value:`${ke.trim()} ${Je.trim()}`})},[ke,Je,Re,te]),M(()=>{let _=!1;return u({phase:"loading"}),(async()=>{try{const U=await n({sessionId:t,visitorId:e});if(_)return;U.status==="ok"?U.terms.length>0?u({phase:"ready",terms:U.terms,allowVoucherCodes:U.allowVoucherCodes}):u({phase:"empty"}):u({phase:"error"})}catch{_||u({phase:"error"})}})(),()=>{_=!0}},[n,t,e,x]);const en=rc(()=>{const _=We;return _?{sessionId:t,visitorId:e,termId:_.termId,startDate:_.defaultContractStartDate??"",fields:{firstname:i.personal.firstName.trim(),lastname:i.personal.lastName.trim(),email:i.personal.email.trim(),dateOfBirth:i.personal.dateOfBirth.trim(),gender:i.personal.gender,phone:i.personal.phone.trim(),street:i.address.street.trim(),houseNumber:i.address.houseNumber.trim(),zipCode:i.address.zipCode.trim(),city:i.address.city.trim()},selectedModuleIds:_.optionalModules.filter(U=>i.selectedModuleIds.includes(U.id)).map(U=>U.id),privacyConsent:i.consents.privacy,sepaConsent:i.consents.sepa}:null});return M(()=>{if(b===0)return;const _=en();if(!_){p({phase:"error",code:"offer_unavailable"});return}let U=!1;const G=d.current;return p(G!==null?{phase:"reloading",pricing:G}:{phase:"loading"}),(async()=>{try{const he=await r(_);if(U)return;he.status==="ok"?p({phase:"ready",pricing:{basePrice:he.basePrice,preUseCharge:he.preUseCharge,currencyCode:he.currencyCode,flatFees:he.flatFees,modules:he.modules,contractVolume:he.contractVolume,startDate:he.startDate,paymentFrequency:he.paymentFrequency,fingerprint:he.pricingFingerprint}}):p({phase:"error",code:he.status==="voucher_invalid"||he.status==="voucher_disabled"?"unavailable":he.status})}catch{U||p({phase:"error",code:"unavailable"})}})(),()=>{U=!0}},[b,r,t,e,p]),{fields:i,offersState:c,previewState:m,selectedTerm:We,requiredAckKeys:Me,allAcknowledged:Zt,serverAllowVoucherCodes:c.phase==="ready"?c.allowVoucherCodes:!1,voucherStatus:a.voucherStatus,draftVoucherCode:a.draftVoucherCode,appliedVoucherCode:a.appliedVoucherCode,appliedVoucher:a.appliedVoucher,voucherUnavailable:a.voucherUnavailable,setTermId:k,setPersonal:A,setAddress:N,toggleModule:P,setBlockAck:T,setAccountHolder:$,setIban:R,setConsent:se,clearIban:V,clearTermId:y,refetchOffers:St,fetchPreview:ne,resetPreview:Xt,setVoucherDraft:le,beginVoucherApply:D,commitVoucherApplied:me,markVoucherInvalid:q,markVoucherDisabled:Oe,clearVoucher:mt}}function cg(t){return t!==null&&t.optionalModules.length>0?["offer","upgrades","personal","address","payment","review"]:["offer","personal","address","payment","review"]}function ug({formMessageId:t,sessionId:e,visitorId:n,projectId:r,formStatus:i}){const o=I(),a=Ve.value,l=Cm(),c=Gl(),u=lg({sessionId:e,visitorId:n}),{fields:d,offersState:m,previewState:h,selectedTerm:p,requiredAckKeys:x,allAcknowledged:w,serverAllowVoucherCodes:b,voucherStatus:v,draftVoucherCode:k,appliedVoucher:A,appliedVoucherCode:N,voucherUnavailable:P,setTermId:T,setPersonal:$,setAddress:R,toggleModule:se,setBlockAck:V,setAccountHolder:y,setIban:le,setConsent:C,clearIban:D,clearTermId:me,refetchOffers:q,fetchPreview:Oe,resetPreview:mt,setVoucherDraft:St,beginVoucherApply:Xt,commitVoucherApplied:ne,markVoucherInvalid:We,markVoucherDisabled:qt}=u,[de,z]=O(0),[Me,Zt]=O({}),[ke,Je]=O(!1),[Re,te]=O(null),[en,_]=O(null),[U,G]=O(null),he=we(()=>Jl(),[]);if(Re!==null&&Re.status==="succeeded")return s(oc,{customerNumber:Re.customerNumber});if(Re!==null&&Re.status==="failed"&&!Re.retryable){const Y=Re.errorCode==="duplicate_submission"?o.magiclineDuplicateNotice:Re.errorCode==="unknown_outcome"?o.magiclineUnknownOutcome:Re.errorCode==="live_submission_disabled"?o.magiclineLiveSubmissionDisabled:o.magiclineFailedDetail;return s(ac,{message:Y})}if(Re===null&&!ke&&i==="submitted")return s(oc,{customerNumber:null});if(Re===null&&!ke&&i==="failed")return s(ac,{message:o.magiclineFailedDetail});const gt=cg(p),$e=Math.min(de,gt.length-1),Qe=gt[$e]??"offer",_n=$e===gt.length-1,ri=$e===0;function ii(Y){const B={};if(Y==="offer")return d.termId===null&&(B.termId=o.magiclineOfferRequiredError),B;if(Y==="upgrades"){if(p!==null)for(const fe of d.selectedModuleIds){const it=p.optionalModules.find(ge=>ge.id===fe);if(it?.consent&&d.acknowledgedBlocks[it.consent.ackKey]!==!0){B.upgrades=o.magiclineUpgradeConsentError;break}}return B}if(Y==="personal"){const fe=d.personal;return fe.firstName.trim()===""&&(B.firstName=o.magiclineRequiredError),fe.lastName.trim()===""&&(B.lastName=o.magiclineRequiredError),fe.email.trim()===""?B.email=o.magiclineRequiredError:Kl(fe.email)||(B.email=o.magiclineEmailError),fe.dateOfBirth.trim()===""&&(B.dateOfBirth=o.magiclineRequiredError),fe.gender===""&&(B.gender=o.magiclineRequiredError),fe.phone.trim()===""&&(B.phone=o.magiclineRequiredError),B}if(Y==="address"){const fe=d.address;return fe.street.trim()===""&&(B.street=o.magiclineRequiredError),fe.houseNumber.trim()===""&&(B.houseNumber=o.magiclineRequiredError),fe.zipCode.trim()===""&&(B.zipCode=o.magiclineRequiredError),fe.city.trim()===""&&(B.city=o.magiclineRequiredError),B}return Y==="payment"&&(d.payment.accountHolder.trim()===""&&(B.accountHolder=o.magiclineRequiredError),Mm(d.payment.iban)||(B.iban=o.magiclineIbanInvalidError),d.consents.privacy||(B.privacy=o.magiclineConsentError),d.consents.sepa||(B.sepa=o.magiclineConsentError)),B}function xt(){const Y=ii(Qe);if(Object.keys(Y).length>0){Zt(Y);return}Zt({}),_(null);const B=Math.min($e+1,gt.length-1);gt[B]==="review"&&Oe(),z(B)}function tn(){Zt({}),_(null),Qe==="review"&&mt(),z(Y=>Math.max(Y-1,0))}function Tt(){_(null),Oe()}async function lr(){if(!ke&&!(h.phase!=="ready"||p===null)){if(!w){_(o.magiclineConfirmRequiredError);return}Je(!0),_(null);try{const Y=await l({sessionId:e,visitorId:n,projectId:r,formMessageId:t,fields:{firstname:d.personal.firstName.trim(),lastname:d.personal.lastName.trim(),email:d.personal.email.trim(),phone:d.personal.phone.trim(),dateOfBirth:d.personal.dateOfBirth.trim(),gender:d.personal.gender,street:d.address.street.trim(),houseNumber:d.address.houseNumber.trim(),zipCode:d.address.zipCode.trim(),city:d.address.city.trim(),rateBundleTermId:p.termId,privacyConsent:d.consents.privacy,sepaConsent:d.consents.sepa},bankAccount:{accountHolder:d.payment.accountHolder.trim(),iban:d.payment.iban},selectedModuleIds:p.optionalModules.filter(B=>d.selectedModuleIds.includes(B.id)).map(B=>B.id),acknowledgedAckKeys:x,pricingFingerprint:h.pricing.fingerprint,voucherCode:N??void 0});if(Y.status==="succeeded"){te(Y);return}if(Y.errorCode==="price_changed"){_(o.magiclinePriceChangedNotice),Oe(),Je(!1);return}if(Y.errorCode==="offer_unavailable"){me(),q(),mt(),_(o.magiclineOfferUnavailableNotice),z(0),Je(!1);return}if(Y.errorCode==="confirmation_required"){_(o.magiclineConfirmationRequiredNotice),Je(!1);return}if(Y.errorCode==="live_submission_disabled"){te(Y);return}if(!Y.retryable){te(Y);return}D(),_(Y.message!==""?Y.message:o.magiclineFailedDetail),Je(!1)}catch(Y){X.error("[ContractCreationForm] Submit failed:",Y),D(),_(o.magiclineFailedDetail),Je(!1)}}}async function cr(){if(h.phase!=="ready"||p===null||k.trim()==="")return;const Y=k.trim(),B=Xt();G(null);const fe=ge=>{We(),St(""),G(ge)},it=o.magiclineVoucherInvalid.replace("{code}",Y);try{const ge=await c({sessionId:e,visitorId:n,termId:p.termId,startDate:p.defaultContractStartDate??"",fields:{firstname:d.personal.firstName.trim(),lastname:d.personal.lastName.trim(),email:d.personal.email.trim(),dateOfBirth:d.personal.dateOfBirth.trim(),gender:d.personal.gender,phone:d.personal.phone.trim(),street:d.address.street.trim(),houseNumber:d.address.houseNumber.trim(),zipCode:d.address.zipCode.trim(),city:d.address.city.trim()},selectedModuleIds:p.optionalModules.filter(Ue=>d.selectedModuleIds.includes(Ue.id)).map(Ue=>Ue.id),privacyConsent:d.consents.privacy,sepaConsent:d.consents.sepa,voucherCode:k.trim()});if(ge.status==="ok"){const Ue=ge.voucher;if(Ue!==null){const Xe=Ue.textBlocks.map(dr=>dr.ackKey);ne({requestId:B,voucher:Ue,appliedCode:k.trim(),voucherAckKeys:Xe,pricing:{basePrice:ge.basePrice,preUseCharge:ge.preUseCharge,currencyCode:ge.currencyCode,flatFees:ge.flatFees,modules:ge.modules,contractVolume:ge.contractVolume,startDate:ge.startDate,paymentFrequency:ge.paymentFrequency,fingerprint:ge.pricingFingerprint}})}else fe(it)}else ge.status==="voucher_invalid"?fe(it):ge.status==="voucher_disabled"?(qt(),St(""),G(o.magiclineVoucherDisabled)):fe(it)}catch{fe(it)}}function ur(){_n?lr():xt()}const jn=_g(Qe,o),zt=v==="applying"||k.trim()!==""&&k.trim()!==(N??""),Sn=Qe==="review"&&(h.phase!=="ready"||!w||zt),Tn=ke||Sn;return s("div",{class:"jex-inline-form jex-magicline-form",children:[s("div",{class:"jex-magicline-wizard-header",children:[s("div",{class:"jex-inline-form-title",children:o.magiclineContractTitle}),s("div",{class:"jex-magicline-wizard-progress",children:[s("span",{class:"jex-magicline-wizard-step-label",children:jn}),s("span",{class:"jex-magicline-wizard-counter",children:o.magiclineStepCounter.replace("{n}",String($e+1)).replace("{total}",String(gt.length))})]}),s("div",{class:"jex-magicline-wizard-dots","aria-hidden":"true",children:gt.map((Y,B)=>s("span",{class:B===$e?"jex-magicline-wizard-dot jex-magicline-wizard-dot-active":"jex-magicline-wizard-dot"},Y))})]}),s("div",{class:"jex-form",role:"group","aria-label":jn,children:[Qe==="offer"?s(dg,{offersState:m,selectedTermId:d.termId,widgetLocale:a,disabled:ke,error:Me.termId,onSelect:T,onRetry:q}):null,Qe==="upgrades"&&p!==null?s(pg,{modules:p.optionalModules,selectedModuleIds:d.selectedModuleIds,acknowledgedBlocks:d.acknowledgedBlocks,widgetLocale:a,disabled:ke,error:Me.upgrades,onToggle:se,onAck:V}):null,Qe==="personal"?s(gg,{personal:d.personal,errors:Me,disabled:ke,setPersonal:$}):null,Qe==="address"?s(xg,{address:d.address,errors:Me,disabled:ke,setAddress:R}):null,Qe==="payment"?s(bg,{formMessageId:t,fields:d,errors:Me,privacyUrl:he,disabled:ke,setAccountHolder:y,setIban:le,setConsent:C}):null,Qe==="review"?s(vg,{fields:d,term:p,previewState:h,widgetLocale:a,disabled:ke,acknowledgedBlocks:d.acknowledgedBlocks,onToggleAck:V,onRetry:Tt,allowVoucherCodes:b,voucherUnavailable:P,voucherStatus:v,draftVoucherCode:k,appliedVoucher:A,voucherBanner:U,onVoucherDraftChange:St,onApplyVoucher:()=>{cr()}}):null,en!==null?s("div",{class:"jex-magicline-error",role:"alert",children:en}):null,s("div",{class:"jex-magicline-wizard-nav",children:[ri?null:s("button",{type:"button",class:"jex-magicline-wizard-back",disabled:ke,onClick:tn,children:o.magiclineWizardBack}),s("button",{type:"button",class:"jex-form-submit jex-magicline-wizard-next",disabled:Tn,onClick:ur,children:_n?ke?o.magiclineSubmitting:o.magiclineSubmit:o.magiclineWizardNext})]})]})]})}function oc({customerNumber:t}){const e=I();return s("div",{class:"jex-inline-form-submitted",children:[s("span",{class:"jex-inline-form-check",children:"✓"}),s("div",{children:[s("div",{class:"jex-inline-form-submitted-title",children:e.magiclineContractSuccessTitle}),s("div",{class:"jex-inline-form-submitted-detail",children:e.magiclineContractSuccessDetail}),t!==null&&t!==""?s("div",{class:"jex-inline-form-submitted-detail",children:e.magiclineCustomerNumber.replace("{number}",t)}):null]})]})}function ac({message:t}){const e=I();return s("div",{class:"jex-inline-form-submitted jex-magicline-failed",children:[s("span",{class:"jex-inline-form-check jex-magicline-failed-icon",children:"!"}),s("div",{children:[s("div",{class:"jex-inline-form-submitted-title",children:e.magiclineFailed}),s("div",{class:"jex-inline-form-submitted-detail",children:t})]})]})}function dg({offersState:t,selectedTermId:e,widgetLocale:n,disabled:r,error:i,onSelect:o,onRetry:a}){const l=I();if(t.phase==="loading")return s("div",{class:"jex-magicline-slots-hint","aria-live":"polite",children:l.magiclineOffersLoading});if(t.phase==="error")return s("div",{class:"jex-magicline-slots-error",children:[s("div",{class:"jex-magicline-slots-hint",role:"alert","aria-live":"polite",children:l.magiclineOffersError}),s("button",{type:"button",class:"jex-magicline-retry",disabled:r,onClick:a,children:l.magiclineRetry})]});if(t.phase==="empty")return s("div",{class:"jex-magicline-slots-hint",role:"alert","aria-live":"polite",children:l.magiclineNoOffers});const c=kg(t.terms);return s(ee,{children:[s("div",{class:"jex-magicline-radio-group",role:"radiogroup","aria-label":l.magiclineStepOffer,children:c.map(u=>s("div",{class:"jex-magicline-offer-group",children:[s("div",{class:"jex-magicline-offer-bundle-name",children:u.bundleName}),u.bundleDescription!==null?s("div",{class:"jex-magicline-offer-bundle-desc",children:u.bundleDescription}):null,u.terms.map(d=>s(hg,{term:d,checked:e===d.termId,widgetLocale:n,disabled:r,onSelect:o},d.termId)),s(fg,{subDescription:u.bundleSubDescription,footnote:u.footnote})]},u.bundleId))}),i!==void 0?s("div",{class:"jex-magicline-error",role:"alert",children:i}):null]})}function hg({term:t,checked:e,widgetLocale:n,disabled:r,onSelect:i}){const o=I(),a=ti(t.termValue,t.termUnit,n),l=rt(t.price,t.currencyCode,n),c=t.flatFees.find(d=>d.isStarterPackage),u=t.flatFees.filter(d=>!d.isStarterPackage);return s("label",{class:e?"jex-magicline-radio-card jex-magicline-radio-card-active":"jex-magicline-radio-card",children:[s("input",{type:"radio",name:"jex-ml-offer",checked:e,disabled:r,onChange:()=>{i(t.termId)}}),s("span",{class:"jex-magicline-offer-term",children:[s("span",{class:"jex-magicline-offer-term-head",children:[s("span",{class:"jex-magicline-offer-term-length",children:a}),s("span",{class:"jex-magicline-offer-term-price",children:[l," ",Eo(t.paymentFrequency.value,t.paymentFrequency.unit,n)]})]}),t.cancellationPeriod!==null?s("span",{class:"jex-magicline-offer-term-note",children:[o.magiclineCancellationPeriod,":"," ",ti(t.cancellationPeriod.value,t.cancellationPeriod.unit,n)]}):null,c!==void 0?s("span",{class:"jex-magicline-offer-term-note",children:[o.magiclineStarterPackage,":"," ",rt(c.price,t.currencyCode,n)]}):null,u.map(d=>s("span",{class:"jex-magicline-offer-term-note",children:[Zl(d.name,o),": ",rt(d.price,t.currencyCode,n)]},d.name)),t.includedModuleNames.length>0?s("span",{class:"jex-magicline-offer-term-note",children:[o.magiclineIncludedModules,": ",t.includedModuleNames.join(", ")]}):null]})]})}function fg({subDescription:t,footnote:e}){const n=I(),r=wg(t),i=e!==null&&e.trim()!=="";return r.length===0&&!i?null:s("details",{class:"jex-magicline-bundle-details",children:[s("summary",{class:"jex-magicline-bundle-details-summary",children:n.magiclineDetails}),s("div",{class:"jex-magicline-bundle-details-body",children:[r.length>0?s("ul",{class:"jex-magicline-bundle-details-list",children:r.map((o,a)=>s("li",{children:o},`${a}-${o}`))}):null,i?s("p",{class:"jex-magicline-bundle-details-footnote",children:e}):null]})]})}function pg({modules:t,selectedModuleIds:e,acknowledgedBlocks:n,widgetLocale:r,disabled:i,error:o,onToggle:a,onAck:l}){const c=I();return t.length===0?s("div",{class:"jex-magicline-slots-hint",children:c.magiclineUpgradesNone}):s(ee,{children:[s("div",{class:"jex-magicline-slots-hint",children:c.magiclineUpgradesIntro}),s("div",{class:"jex-magicline-upgrade-group",children:t.map(u=>s(mg,{module:u,selected:e.includes(u.id),consentChecked:u.consent!==null&&n[u.consent.ackKey]===!0,widgetLocale:r,disabled:i,onToggle:a,onAck:l},u.id))}),o!==void 0?s("div",{class:"jex-magicline-error",role:"alert",children:o}):null]})}function mg({module:t,selected:e,consentChecked:n,widgetLocale:r,disabled:i,onToggle:o,onAck:a}){const l=I(),c=Om(t.price,t.currencyCode,t.paymentFrequencyType,t.recurringUnit,r),u=qm(t.extensionType,t.termExtension,r),d=t.termLabel!==null&&t.termLabel!==""?t.termLabel:l.magiclineUpgradeOneTime,m=t.consent;return s("div",{class:e?"jex-magicline-upgrade-card jex-magicline-upgrade-card-active":"jex-magicline-upgrade-card",children:[s("label",{class:"jex-magicline-upgrade-head",children:[s("input",{type:"checkbox",checked:e,disabled:i,onChange:h=>{o(t.id,h.currentTarget.checked,m?.ackKey)}}),s("span",{class:"jex-magicline-upgrade-info",children:[s("span",{class:"jex-magicline-upgrade-name",children:t.name}),t.description!==null&&t.description!==""?s("span",{class:"jex-magicline-upgrade-desc",children:t.description}):null,s("span",{class:"jex-magicline-upgrade-price",children:c}),s("span",{class:"jex-magicline-upgrade-desc",children:d}),u!==""?s("span",{class:"jex-magicline-upgrade-desc",children:u}):null]}),s("span",{class:"jex-magicline-upgrade-status",children:e?l.magiclineUpgradeAdded:l.magiclineUpgradeAdd})]}),e&&m!==null?s(Io,{ackKey:m.ackKey,title:m.title,text:m.text,attachmentLabel:m.attachmentLabel,attachmentUrl:m.attachmentUrl,checked:n,disabled:i,onToggle:a,showRequiredPill:!0}):null]})}function gg({personal:t,errors:e,disabled:n,setPersonal:r}){const i=I(),o=we(()=>Yl(),[]);return s(ee,{children:[s("div",{class:"jex-magicline-row",children:[s(pt,{label:i.magiclineFirstName,value:t.firstName,required:!0,disabled:n,error:e.firstName,fieldKey:"firstName",onInput:a=>{r("firstName",a)}}),s(pt,{label:i.magiclineLastName,value:t.lastName,required:!0,disabled:n,error:e.lastName,fieldKey:"lastName",onInput:a=>{r("lastName",a)}})]}),s(pt,{label:i.magiclineEmail,type:"email",value:t.email,required:!0,disabled:n,error:e.email,fieldKey:"email",onInput:a=>{r("email",a)}}),s("label",{class:"jex-magicline-field",children:[s("span",{class:"jex-magicline-field-label",children:i.magiclineBirthDate}),s("input",{class:"jex-form-input",type:"date","aria-label":i.magiclineBirthDate,value:t.dateOfBirth,max:o,required:!0,disabled:n,"aria-invalid":e.dateOfBirth!==void 0,onInput:a=>{r("dateOfBirth",a.currentTarget.value)}}),e.dateOfBirth!==void 0?s("span",{class:"jex-magicline-error",role:"alert",children:e.dateOfBirth}):null]}),s(yg,{label:i.magiclineGender,value:t.gender,required:!0,disabled:n,placeholder:i.magiclineGenderPlaceholder,error:e.gender,onChange:a=>{r("gender",a)},options:ec.map(a=>({value:a,label:jg(a,i)}))}),s(pt,{label:i.magiclinePhone,type:"tel",value:t.phone,required:!0,disabled:n,error:e.phone,fieldKey:"phone",onInput:a=>{r("phone",a)}})]})}function xg({address:t,errors:e,disabled:n,setAddress:r}){const i=I();return s(ee,{children:[s("div",{class:"jex-magicline-row",children:[s(pt,{label:i.magiclineStreet,value:t.street,required:!0,disabled:n,error:e.street,fieldKey:"street",onInput:o=>{r("street",o)}}),s(pt,{label:i.magiclineHouseNumber,value:t.houseNumber,required:!0,disabled:n,error:e.houseNumber,fieldKey:"houseNumber",onInput:o=>{r("houseNumber",o)}})]}),s("div",{class:"jex-magicline-row",children:[s(pt,{label:i.magiclineZip,value:t.zipCode,required:!0,disabled:n,error:e.zipCode,fieldKey:"zipCode",onInput:o=>{r("zipCode",o)}}),s(pt,{label:i.magiclineCity,value:t.city,required:!0,disabled:n,error:e.city,fieldKey:"city",onInput:o=>{r("city",o)}})]}),s("div",{class:"jex-magicline-field",children:[s("span",{class:"jex-magicline-field-label",children:i.magiclineCountry}),s("div",{class:"jex-magicline-static-value",children:i.magiclineCountryStatic})]})]})}function bg({formMessageId:t,fields:e,errors:n,privacyUrl:r,disabled:i,setAccountHolder:o,setIban:a,setConsent:l}){const c=I(),u=`jex-ml-privacy-${t}`,d=`jex-ml-sepa-${t}`;return s(ee,{children:[s(pt,{label:c.magiclineAccountHolder,value:e.payment.accountHolder,required:!0,disabled:i,error:n.accountHolder,fieldKey:"accountHolder",onInput:o}),s(pt,{label:c.magiclineIban,value:e.payment.iban,required:!0,disabled:i,error:n.iban,fieldKey:"iban",onInput:a}),s("label",{class:"jex-magicline-consent",for:u,children:[s("input",{id:u,type:"checkbox",checked:e.consents.privacy,disabled:i,"aria-invalid":n.privacy!==void 0,onChange:m=>{l("privacy",m.currentTarget.checked)}}),s("span",{children:[c.magiclineConsent," ",s("a",{href:r,target:"_blank",rel:"noopener noreferrer",class:"jex-privacy-notice-link",children:c.magiclinePrivacyLinkText}),"."]})]}),s("label",{class:"jex-magicline-consent",for:d,children:[s("input",{id:d,type:"checkbox",checked:e.consents.sepa,disabled:i,"aria-invalid":n.sepa!==void 0,onChange:m=>{l("sepa",m.currentTarget.checked)}}),s("span",{children:c.magiclineSepaConsent})]}),n.privacy!==void 0?s("div",{class:"jex-magicline-error",role:"alert",children:n.privacy}):null,n.sepa!==void 0?s("div",{class:"jex-magicline-error",role:"alert",children:n.sepa}):null]})}function vg({fields:t,term:e,previewState:n,widgetLocale:r,disabled:i,acknowledgedBlocks:o,onToggleAck:a,onRetry:l,allowVoucherCodes:c,voucherUnavailable:u,voucherStatus:d,draftVoucherCode:m,appliedVoucher:h,voucherBanner:p,onVoucherDraftChange:x,onApplyVoucher:w}){const b=I();if(n.phase==="loading"||n.phase==="idle")return s("div",{class:"jex-magicline-slots-hint","aria-live":"polite",children:b.magiclineReviewLoading});if(n.phase==="error")return s("div",{class:"jex-magicline-slots-error",children:[s("div",{class:"jex-magicline-slots-hint",role:"alert","aria-live":"polite",children:n.code==="offer_unavailable"?b.magiclineOfferUnavailableNotice:b.magiclineReviewError}),s("button",{type:"button",class:"jex-magicline-retry",disabled:i,onClick:l,children:b.magiclineRetry})]});const v=n.pricing,k=n.phase==="reloading",A=v.contractVolume,N=`${t.personal.firstName} ${t.personal.lastName}`.trim(),P=t.address,T=[`${P.street} ${P.houseNumber}`.trim(),`${P.zipCode} ${P.city}`.trim(),b.magiclineCountryStatic].filter(C=>C!=="").join(", "),$=e!==null?`${e.bundleName} · ${ti(e.termValue,e.termUnit,r)}`:"—",R=e!==null?e.textBlocks.filter(C=>C.isConfirmationRequired):[],se=e!==null?e.textBlocks.filter(C=>!C.isConfirmationRequired):[],V=e!==null?e.optionalModules.filter(C=>t.selectedModuleIds.includes(C.id)&&C.consent!==null).map(C=>({module:C,consent:C.consent})):[],y=h!==null?h.textBlocks.filter(C=>C.ackKey.startsWith("voucher:")):[],le=c&&!u;return s("div",{class:"jex-magicline-review-wrap",children:[s("div",{class:k?"jex-magicline-review-body jex-magicline-review-body--reloading":"jex-magicline-review-body","aria-busy":k,children:[s("dl",{class:"jex-magicline-summary",children:[s("div",{class:"jex-magicline-summary-row",children:[s("dt",{children:b.magiclineReviewOffer}),s("dd",{children:$})]}),s("div",{class:"jex-magicline-summary-row",children:[s("dt",{children:b.magiclineReviewBasePrice}),s("dd",{children:[h!==null&&h.voucherType==="DISCOUNT"?rt(h.discountedBasePrice,v.currencyCode,r):rt(v.basePrice,v.currencyCode,r)," ",Eo(v.paymentFrequency.value,v.paymentFrequency.unit,r)]})]}),h!==null&&h.voucherType==="DISCOUNT"?s("div",{class:"jex-magicline-summary-row jex-magicline-voucher-discount-row",children:[s("dt",{children:b.magiclineVoucherAppliedDiscount.replace("{discount}",$m(h.discountValue,h.discountType,v.currencyCode,r))}),s("dd",{})]}):null,h!==null&&h.remarks!==null&&h.remarks!==""?s("div",{class:"jex-magicline-summary-row jex-magicline-voucher-remarks-row",children:[s("dt",{children:b.magiclineVoucherRemarks}),s("dd",{children:h.remarks})]}):null,v.flatFees.map((C,D)=>s("div",{class:"jex-magicline-summary-row",children:[s("dt",{children:Zl(C.name,b)}),s("dd",{children:rt(C.price,v.currencyCode,r)})]},`${C.name}-${D}`)),v.preUseCharge>0?s("div",{class:"jex-magicline-summary-row",children:[s("dt",{children:b.magiclineReviewPreUseCharge}),s("dd",{children:rt(v.preUseCharge,v.currencyCode,r)})]}):null]}),v.modules.length>0?s("dl",{class:"jex-magicline-summary jex-magicline-summary-section",children:[s("div",{class:"jex-magicline-summary-heading",children:b.magiclineReviewSelectedUpgrades}),v.modules.map((C,D)=>s("div",{class:"jex-magicline-summary-row",children:[s("dt",{children:C.name}),s("dd",{children:rt(C.amount,C.currencyCode,r)})]},`${C.moduleId}-${D}`))]}):null,A!==null&&A.total!==null?s("dl",{class:"jex-magicline-summary jex-magicline-summary-section jex-magicline-summary-totals",children:s("div",{class:"jex-magicline-summary-row jex-magicline-summary-total-row",children:[s("dt",{children:h!==null&&h.voucherType==="DISCOUNT"?b.magiclineGesamtpreisBeforeDiscount:b.magiclineReviewContractVolume}),s("dd",{children:rt(A.total,v.currencyCode,r)})]})}):null,h!==null&&h.voucherType==="CREDIT"?s("div",{class:"jex-magicline-voucher-credit-notice",role:"note",children:b.magiclineVoucherCreditNotice}):null,s("dl",{class:"jex-magicline-summary jex-magicline-summary-section",children:[s("div",{class:"jex-magicline-summary-row",children:[s("dt",{children:b.magiclineReviewStartsOn}),s("dd",{children:Lm(v.startDate,r)})]}),s("div",{class:"jex-magicline-summary-row",children:[s("dt",{children:b.magiclineSummaryName}),s("dd",{children:N!==""?N:"—"})]}),s("div",{class:"jex-magicline-summary-row",children:[s("dt",{children:b.magiclineSummaryAddress}),s("dd",{children:T})]}),s("div",{class:"jex-magicline-summary-row",children:[s("dt",{children:b.magiclineReviewPayment}),s("dd",{children:Nm(t.payment.iban)})]})]}),le?s("div",{class:"jex-magicline-voucher-section",children:[s("div",{class:"jex-magicline-field jex-magicline-voucher-field",children:[s("input",{class:"jex-form-input",type:"text","aria-label":b.magiclineVoucherLabel,placeholder:b.magiclineVoucherPlaceholder,value:m,disabled:i||d==="applying",onInput:C=>{x(C.currentTarget.value)}}),s("button",{type:"button",class:"jex-magicline-voucher-apply",disabled:i||d==="applying"||m.trim()==="",onClick:w,children:b.magiclineVoucherApply})]}),p!==null?s("div",{class:"jex-magicline-error",role:"alert",children:p}):null]}):null,V.length>0?s("div",{class:"jex-magicline-terms",role:"group","aria-label":b.magiclineReviewSelectedUpgrades,children:[s("div",{class:"jex-magicline-upgrades-recap-title",children:b.magiclineReviewSelectedUpgrades}),V.map(({module:C,consent:D})=>s(sc,{title:D.title!==""?D.title:C.name,text:D.text,attachmentLabel:D.attachmentLabel,attachmentUrl:D.attachmentUrl},D.ackKey))]}):null,R.length>0||se.length>0||y.length>0?s("div",{class:"jex-magicline-terms",role:"group","aria-label":b.magiclineReviewTerms,children:[R.length>0||y.length>0?s("div",{class:"jex-magicline-terms-prompt",children:[b.magiclineConfirmPrompt,s("span",{class:"jex-magicline-required-pill",children:b.magiclineRequired})]}):null,R.map(C=>s(Io,{ackKey:C.ackKey,title:C.title,text:C.text,attachmentLabel:C.attachmentLabel,attachmentUrl:C.attachmentUrl,checked:o[C.ackKey]===!0,disabled:i,onToggle:a},C.ackKey)),y.map(C=>s(Io,{ackKey:C.ackKey,title:C.title,text:C.text,attachmentLabel:C.attachmentLabel,attachmentUrl:C.attachmentUrl,checked:o[C.ackKey]===!0,disabled:i,onToggle:a},C.ackKey)),se.map((C,D)=>s(sc,{title:C.title,text:C.text,attachmentLabel:C.attachmentLabel,attachmentUrl:C.attachmentUrl},`${C.title}-${D}`))]}):null]}),k?s("div",{class:"jex-magicline-review-overlay","aria-hidden":"true",children:s("span",{class:"jex-magicline-review-spinner"})}):null]})}function Io({ackKey:t,title:e,text:n,attachmentLabel:r,attachmentUrl:i,checked:o,disabled:a,onToggle:l,showRequiredPill:c=!1}){const u=I(),d=`jex-ml-ack-${t}`;return s("div",{class:"jex-magicline-consent-region",children:[c?s("span",{class:"jex-magicline-required-pill",children:u.magiclineRequired}):null,s("label",{class:"jex-magicline-consent",for:d,children:[s("input",{id:d,type:"checkbox",checked:o,disabled:a,onChange:m=>{l(t,m.currentTarget.checked)}}),s("span",{class:"jex-magicline-consent-body",children:[e!==""?s("span",{class:"jex-magicline-terms-title",children:e}):null,s("span",{class:"jex-magicline-terms-content",children:[n,i!==null?s(ee,{children:[" ",s("a",{href:i,target:"_blank",rel:"noopener noreferrer",class:"jex-privacy-notice-link",children:r!==null&&r!==""?r:i})]}):null]})]})]})]})}function sc({title:t,text:e,attachmentLabel:n,attachmentUrl:r}){return s("div",{class:"jex-magicline-consent-recap",children:[t!==""?s("span",{class:"jex-magicline-terms-title",children:t}):null,s("span",{class:"jex-magicline-terms-content",children:[e,r!==null?s(ee,{children:[" ",s("a",{href:r,target:"_blank",rel:"noopener noreferrer",class:"jex-privacy-notice-link",children:n!==null&&n!==""?n:r})]}):null]})]})}function pt({label:t,value:e,fieldKey:n,type:r="text",required:i=!1,disabled:o,error:a,onInput:l}){const c=a!==void 0?`jex-ml-err-${n}`:void 0;return s("div",{class:"jex-magicline-field",children:[s("input",{class:"jex-form-input",type:r,"aria-label":t,placeholder:t,value:e,required:i,disabled:o,"aria-invalid":a!==void 0,"aria-describedby":c,onInput:u=>{l(u.currentTarget.value)}}),a!==void 0?s("span",{id:c,class:"jex-magicline-error",role:"alert",children:a}):null]})}function yg({label:t,value:e,required:n,disabled:r,placeholder:i,error:o,options:a,onChange:l}){return s("div",{class:"jex-magicline-field",children:[s("select",{class:"jex-form-input jex-magicline-select","aria-label":t,value:e,required:n,disabled:r,"aria-invalid":o!==void 0,onChange:c=>{l(c.currentTarget.value)},children:[s("option",{value:"",disabled:n,children:i}),a.map(c=>s("option",{value:c.value,children:c.label},c.value))]}),o!==void 0?s("span",{class:"jex-magicline-error",role:"alert",children:o}):null]})}function wg(t){return t===null?[]:t.split(`
82
- `).map(e=>e.replace(/^\s*[-•]\s*/,"").trim()).filter(e=>e!=="")}function kg(t){const e=[],n=new Map;for(const r of t){let i=n.get(r.bundleId);i||(i={bundleId:r.bundleId,bundleName:r.bundleName,bundleDescription:r.bundleDescription,bundleSubDescription:r.bundleSubDescription,footnote:r.footnote,terms:[]},n.set(r.bundleId,i),e.push(i)),i.terms.push(r)}return e}function _g(t,e){switch(t){case"offer":return e.magiclineStepOffer;case"upgrades":return e.magiclineStepUpgrades;case"personal":return e.magiclineStepPersonal;case"address":return e.magiclineStepAddress;case"payment":return e.magiclineStepPayment;case"review":return e.magiclineStepReview;default:return""}}function jg(t,e){return t==="MALE"?e.magiclineGenderMale:t==="FEMALE"?e.magiclineGenderFemale:e.magiclineGenderUnisex}function Sg({message:t,sessionId:e,visitorId:n}){const r=I(),i=t.magiclineForm,o=!!i&&i.status==="open"&&!!i.submissionId,a=wt(oe.functions.magicline.public.getSubmissionStatus,o&&i?.submissionId?{sessionId:e,visitorId:n,submissionId:i.submissionId}:"skip");if(!i)return null;if(i.action==="contractCreation")return t.projectId?s(ug,{formMessageId:t._id,sessionId:e,visitorId:n,projectId:t.projectId,formStatus:i.status}):null;if(i.status==="submitted")return s("div",{class:"jex-inline-form-submitted",children:[s("span",{class:"jex-inline-form-check",children:"✓"}),s("div",{children:[s("div",{class:"jex-inline-form-submitted-title",children:r.magiclineTrialSuccessTitle}),s("div",{class:"jex-inline-form-submitted-detail",children:r.magiclineTrialSuccessDetail})]})]});if(i.status==="failed")return s("div",{class:"jex-inline-form-submitted jex-magicline-failed",children:[s("span",{class:"jex-inline-form-check jex-magicline-failed-icon",children:"!"}),s("div",{children:[s("div",{class:"jex-inline-form-submitted-title",children:r.magiclineFailed}),s("div",{class:"jex-inline-form-submitted-detail",children:r.magiclineFailedDetail})]})]});if(i.action!=="trialSessionBooking")return null;const l=a!=null&&a.errorCode==="slot_unavailable",c=o&&a===void 0;return s(Hm,{formMessageId:t._id,sessionId:e,visitorId:n,slotUnavailable:l,retryPending:c})}const Tg={crawl:"🌐",file:"📄",snippet:"💡",qa:"❓"};function Cg({sources:t}){const e=I(),[n,r]=O(!1);return t.length===0?null:s("div",{class:"jex-sources-row",children:[s("button",{type:"button",class:"jex-sources-toggle",onClick:()=>{r(i=>!i)},"aria-expanded":n,children:[s("span",{class:"jex-sources-icon",children:"📖"}),s("span",{children:(t.length===1?e.sourcesCountOne:e.sourcesCountOther).replace("{count}",String(t.length))}),s("span",{class:`jex-sources-chevron${n?" jex-sources-chevron--open":""}`,children:"▾"})]}),n?s("div",{class:"jex-sources-pills",children:t.map((i,o)=>{const a=i.sourceType==="crawl",l=Ag(i),c=a&&i.url?`${i.title}
83
- ${i.url}`:i.title,u=s(ee,{children:[typeof i.id=="number"?s("span",{class:"jex-source-id",children:i.id}):null,s("span",{class:"jex-source-type",children:Tg[i.sourceType]}),s("span",{class:"jex-source-label",children:l}),s("span",{class:"jex-source-score",children:["· ",i.score.toFixed(2)]})]});return a&&i.url?s("a",{class:"jex-source-pill",href:i.url,target:"_blank",rel:"noopener noreferrer",title:c,children:u},o):s("span",{class:"jex-source-pill",title:c,children:u},o)})}):null]})}function Ag(t){if(t.sourceType==="crawl"&&t.url)try{const e=new URL(t.url);return!e.pathname||e.pathname==="/"?e.hostname:e.pathname}catch{}return t.title}const Rg=840*1e3;function Eg(t){return t<1024*1024?`${Math.max(1,Math.round(t/1024))} KB`:`${(t/1024/1024).toFixed(1)} MB`}function Ig({items:t,sessionId:e,visitorId:n,align:r}){const i=I(),o=Ht(oe.conversationAttachments.visitor.mintUrls),[a,l]=O(()=>new Map),[c,u]=O(()=>new Set),[d,m]=O(0),[h,p]=O(!1),x=t.filter(w=>w.available).map(w=>w._id).join(",");return M(()=>{if(x==="")return;let w=!0;const b=x.split(",");o({sessionId:e,visitorId:n,attachmentIds:b}).then(k=>{w&&(l(new Map(k.map(A=>[A.attachmentId,A.url]))),p(!1))},k=>{X.error("[jexity] Could not load files",k),w&&p(!0)});const v=setTimeout(()=>{m(k=>k+1)},Rg);return()=>{w=!1,clearTimeout(v)}},[x,e,n,o,d]),t.length===0?null:s(ee,{children:[s("div",{class:`jex-msg-files jex-msg-files-${r}`,children:t.map(w=>{if(!w.available)return s("div",{class:"jex-msg-file-card jex-msg-file-unavailable",title:w.name,children:[s(qf,{size:16,"aria-hidden":"true"}),s("span",{class:"jex-msg-file-text",children:[s("span",{class:"jex-msg-file-name",children:w.name}),s("span",{class:"jex-msg-file-meta",children:i.attachmentUnavailable})]})]},w._id);const b=a.get(w._id),v=i.attachmentOpen.replace("{name}",w.name);if(w.kind==="image"&&!c.has(w._id)&&!(h&&!b))return b?s("a",{class:"jex-msg-file-thumb",href:b,target:"_blank",rel:"noopener noreferrer","aria-label":v,children:s("img",{src:b,alt:"",loading:"lazy",onError:()=>{u(A=>new Set(A).add(w._id))}})},w._id):s("span",{class:"jex-msg-file-thumb jex-msg-file-pending","aria-hidden":"true"},w._id);const k=s(ee,{children:[s(Df,{size:16,"aria-hidden":"true"}),s("span",{class:"jex-msg-file-text",children:[s("span",{class:"jex-msg-file-name",children:w.name}),s("span",{class:"jex-msg-file-meta",children:[w.extension.toUpperCase()," · ",Eg(w.sizeBytes)]})]})]});return b?s("a",{class:"jex-msg-file-card",href:b,target:"_blank",rel:"noopener noreferrer","aria-label":v,children:k},w._id):s("span",{class:"jex-msg-file-card","aria-disabled":"true",children:k},w._id)})}),h&&s("p",{class:`jex-msg-files-error jex-msg-files-${r}`,role:"alert",children:[i.attachmentLoadFailed," ",s("button",{type:"button",class:"jex-msg-files-retry",onClick:()=>{p(!1),m(w=>w+1)},children:i.attachmentRetry})]})]})}function Pg(){return s("div",{class:"jex-typing",children:[s("span",{}),s("span",{}),s("span",{})]})}const Mg=/\s?\[\d+\]/g;function ni(t){return t.replace(Mg,"")}function Ng(t){return t?.at(-1)?._creationTime??0}function Lg(t){return{id:t._id,content:ni(t.content),role:t.role,authorName:t.authorName}}function lc(t,e){return(t.replyToIds&&t.replyToIds.length>0?t.replyToIds:t.replyToId?[t.replyToId]:[]).map(r=>e?.find(i=>i._id===r)).filter(r=>r!==void 0).map(Lg)}function cc(t,e){const r=e.getRootNode().getElementById(`jex-msg-${t}`);r&&(r.scrollIntoView({behavior:"smooth",block:"center"}),r.classList.add("jex-msg-highlight"),setTimeout(()=>{r.classList.remove("jex-msg-highlight")},1500))}function Og(t){if(!t)return[];const e=new Set;for(const n of t)n.authorId&&n.authorName&&e.add(n.authorName),n.noticeKind==="agent-joined"&&n.noticeData?.agentName&&e.add(n.noticeData.agentName);return[...e]}const $g=6e4;function Dg({conversations:t,attachments:e,greeting:n,botName:r,starterQuestions:i,onPickStarter:o,sessionNotFound:a,resumeFailed:l,onStartFresh:c,sessionId:u,visitorId:d}){const m=I(),h=ie(null),[p,x]=O(null),[w,b]=O(()=>Date.now()),v=(t??[]).some(y=>y.status==="streaming"&&y.content==="");M(()=>{if(!v)return;const y=setInterval(()=>b(Date.now()),1e4);return()=>clearInterval(y)},[v]);const k=Ng(t),A=Og(t),N=new Map;for(const y of e??[])N.set(y.messageId,[...N.get(y.messageId)??[],y]);const P=Ql(),T=ei(),$=ie(null);M(()=>{if(!d||!t)return;const y=t.at(-1);y&&y.role==="assistant"&&y.status!=="streaming"&&y._id!==$.current&&($.current=y._id,eo(d))},[t,d]);const R=t?.at(-1)?.content;M(()=>{h.current?.scrollIntoView({behavior:"smooth"})},[t?.length,R]);const se=u===null||t!==void 0&&t.length===0,V=i.length>0&&!a&&!l&&se;return s("div",{class:"jex-chat-messages",children:[s(Jt,{text:n,botName:r}),V?s(bm,{questions:i,disabled:Fr.value,onPick:o}):null,a&&l&&c?s("div",{class:"jex-session-prompt",children:[s("div",{class:"jex-session-prompt-text",children:m.sessionNotFoundPrompt}),s("button",{class:"jex-session-prompt-btn",type:"button",onClick:()=>{c()},children:m.startNewConversation})]}):a?s("div",{class:"jex-session-notice",children:m.sessionNotFound}):null,t?.map(y=>{if(y.contentType==="human-notice"){const q=y.noticeKind==="agent-joined"?m.noticeAgentJoined.replace("{name}",y.noticeData?.agentName??""):y.noticeKind==="human-requested"?m.noticeHumanRequested:y.noticeKind==="human-requested-form"?m.noticeHumanRequestedForm:y.noticeKind==="message-received"?m.noticeMessageReceived:y.noticeKind==="agent-handling"?m.noticeAgentHandling:y.noticeKind==="ai-resumed"?m.noticeAiResumed:y.content;return s(Jt,{text:q,botName:r},y._id)}if(y.contentType==="escalation-form"&&u&&d)return Ph.value==="screen"&&!y.formData?p===y._id?null:s("div",{class:"jex-inline-form jex-inline-form-card",children:[s("div",{class:"jex-inline-form-title",children:m.escalationPromptTitle}),s("div",{class:"jex-inline-form-subtitle",children:m.escalationPromptSubtitle}),s("button",{class:"jex-form-submit",type:"button",onClick:()=>{T({formMessageId:y._id,sessionId:u,visitorId:d}),jt({id:"escalation-form",formMessageId:y._id,sessionId:u,visitorId:d,waitingSetAt:k})},children:m.escalationPromptSubmit}),s("button",{class:"jex-escalation-skip",type:"button",onClick:()=>{P({formMessageId:y._id,sessionId:u,visitorId:d,waitingSetAt:k}),x(y._id)},children:m.escalationSkip})]},y._id):s(wm,{message:y,sessionId:u,visitorId:d,waitingSetAt:k},y._id);if(y.contentType==="magicline-form"&&u&&d)return s(Sg,{message:y,sessionId:u,visitorId:d},y._id);if(y.contentType==="escalation-confirm"){const q=y.noticeKind==="escalation-confirmed"?m.noticeEscalationConfirmed.replace("{name}",y.noticeData?.visitorName??"").replace("{email}",y.noticeData?.visitorEmail??"").replace("{ref}",y.noticeData?.visitorId??""):y.content;return s(Jt,{text:q,botName:r},y._id)}const le=N.get(y._id)??[],C=le.length>0&&u&&d?s(Ig,{items:le,sessionId:u,visitorId:d,align:y.role==="user"?"user":"bot"}):null;if(y.role==="user"){const q=lc(y,t);return s(ee,{children:[(y.content!==""||le.length===0)&&s(ym,{id:`jex-msg-${y._id}`,text:y.content,botName:r,onQuote:()=>{ao({id:y._id,content:y.content,role:"user"})},quoted:q,onQuotedClick:(Oe,mt)=>{cc(Oe,mt.currentTarget)},agentNames:A}),C]},y._id)}const D={authorId:y.authorId,authorName:y.authorName,authorImage:y.authorImage};if(y.status==="streaming"&&y.content==="")return w-y._creationTime>$g?s(Jt,{id:`jex-msg-${y._id}`,text:`${m.somethingWentWrong}. ${m.tryAgain}.`,error:!0,botName:r,...D},y._id):s(Pg,{},y._id);if(y.status==="streaming")return s(Jt,{id:`jex-msg-${y._id}`,text:ni(y.content),streaming:!0,botName:r,...D},y._id);if(y.status==="error")return s(Jt,{id:`jex-msg-${y._id}`,text:y.errorMessage??`${m.somethingWentWrong}. ${m.tryAgain}.`,error:!0,botName:r,...D},y._id);const me=lc(y,t);return s("div",{children:[(y.content!==""||le.length===0)&&s(Jt,{id:`jex-msg-${y._id}`,text:ni(y.content),botName:r,onQuote:()=>{ao({id:y._id,content:ni(y.content),role:"assistant",authorName:y.authorName})},quoted:me,onQuotedClick:(q,Oe)=>{cc(q,Oe.currentTarget)},...D}),C,y.sources&&y.sources.length>0?s(Cg,{sources:y.sources}):null]},y._id)}),s("div",{ref:h})]})}function qg(){const t=I();function e(){const n=Xn.peek();n&&(rl(),jt({id:"escalation-form",formMessageId:n.formMessageId,sessionId:n.sessionId,visitorId:n.visitorId,waitingSetAt:n.waitingSetAt}))}return s("div",{class:"jex-waiting-card",role:"status","aria-live":"polite",children:[s("div",{class:"jex-waiting-indicator","aria-hidden":"true",children:[s("span",{class:"jex-waiting-dot"}),s("span",{class:"jex-waiting-ripple"})]}),s("div",{class:"jex-waiting-body",children:[s("div",{class:"jex-waiting-title",children:t.waitingTitle}),s("div",{class:"jex-waiting-subtitle",children:t.waitingSubtitle}),s("button",{class:"jex-waiting-leave-email",type:"button",onClick:e,children:t.waitingLeaveEmail})]})]})}function uc({message:t}){const[e,n]=O(!1);return M(()=>{const r=setTimeout(()=>{n(!0)},80);return()=>{clearTimeout(r)}},[]),e?s("div",{class:"jex-overlay jex-loading",children:[s("div",{class:"jex-loading-spinner","aria-hidden":"true"}),t&&s("p",{class:"jex-loading-message",children:t})]}):null}function zg({sessionId:t,visitorId:e}){const n=wt(oe.functions.chat.public.conversations.listBySession,t&&e?{sessionId:t,visitorId:e}:"skip"),r=wt(oe.functions.chat.public.sessions.getSessionStatus,t&&e?{sessionId:t,visitorId:e}:"skip"),i=wt(oe.conversationAttachments.visitor.list,t&&e?{sessionId:t,visitorId:e}:"skip"),o=t!==null&&n===void 0,a=n?.some(l=>l.status==="streaming")??!1;return{conversations:n,sessionStatus:r??null,isLoading:o,isStreaming:a,attachments:i}}function Fg(t){const e=I(),n=ie(null),r=ie(null),[i,o]=O(!1);M(()=>{try{n.current=document.title}catch{}},[]),M(()=>{if(!t||t.length===0)return;const a=t[t.length-1];if(!a)return;if(r.current===null){r.current=a._id;return}if(a._id===r.current)return;r.current=a._id;const l=a.role!=="user";let c=!1;try{c=document.hidden}catch{}l&&c&&o(!0)},[t]),M(()=>{if(!i)return;let a=null,l=!1;const c=()=>{if(a!==null){try{clearInterval(a)}catch{}a=null}try{n.current!==null&&(document.title=n.current)}catch{}};try{a=setInterval(()=>{try{const u=`💬 ${e.newReplyTitle}`;document.title=l?n.current??"":u,l=!l}catch{c()}},1200)}catch{}return c},[i,e.newReplyTitle]),M(()=>{const a=()=>{try{document.hidden||o(!1)}catch{}};try{document.addEventListener("visibilitychange",a)}catch{}return()=>{try{document.removeEventListener("visibilitychange",a)}catch{}}},[])}function Ug({sessionId:t,visitorId:e}){const n=kt(oe.functions.chat.public.visitorPresence.heartbeat);M(()=>{if(!t||!e)return;let r=null;const i=()=>{n({sessionId:t,visitorId:e}).catch(()=>{})},o=()=>{r===null&&(r=setInterval(i,6e4))},a=()=>{r!==null&&(clearInterval(r),r=null)},l=()=>{document.visibilityState==="visible"?(i(),o()):a()};return l(),document.addEventListener("visibilitychange",l),()=>{document.removeEventListener("visibilitychange",l),a()}},[t,e,n])}function Bg(){return kt(oe.escalations.public.createEscalationRequest)}function dc({sessionId:t,visitorId:e,ensureSession:n,onSkipForm:r}){const i=I(),o=Bg(),[a,l]=O(!1),[c,u]=O(null);async function d(){if(!a){l(!0),u(null);try{const m=t&&e?{sessionId:t,visitorId:e}:await n();if(!m)return;const h=Et.value;if(!h)return;const p=await o({sessionId:m.sessionId,visitorId:m.visitorId,bootstrapToken:h,locale:Ve.value});if(p.skipForm){r?.();return}jt({id:"escalation-form",formMessageId:p.formMessageId,sessionId:m.sessionId,visitorId:m.visitorId,waitingSetAt:p.waitingSetAt})}catch(m){const h=m instanceof Error?m.message:String(m);u(/RATE_LIMITED|Too many/.test(h)?i.handoffRateLimited:i.handoffFailed)}finally{l(!1)}}}return{requestHuman:d,busy:a,error:c}}function Vg({greeting:t,botName:e,starterQuestions:n,sessionId:r,visitorId:i,isLoading:o,sessionNotFound:a,resumeFailed:l,isOrgDeleted:c,ensureSession:u,startFresh:d,maintenance:m}){const h=I(),{conversations:p,sessionStatus:x,isLoading:w,isStreaming:b,attachments:v}=zg({sessionId:r,visitorId:i});Fg(p),Ug({sessionId:r,visitorId:i}),M(()=>{const R=Xn.peek();if(R===null||!p||p.length===0)return;const{waitingSetAt:se}=R;p.some(y=>y._creationTime>se&&(y.noticeKind==="agent-joined"||!!y.authorId))&&rl()},[p]);const k=il({sessionId:r,visitorId:i,ensureSession:u}),A=ie((()=>{const R=gn.peek();return R!==null?R:Zi.peek()&&He.peek()!==null?"resume":"fresh"})()).current,{requestHuman:N,error:P}=dc({sessionId:r,visitorId:i,ensureSession:u}),T=rc(()=>{N()});return M(()=>{A==="escalate"&&T()},[A]),M(()=>{gn.value=null},[]),M(()=>{He.peek()!==null&&u()},[u]),M(()=>{i&&eo(i)},[i]),c?s("div",{class:"jex-chat-messages",children:s("div",{class:"jex-session-notice",children:h.chatNoLongerAvailable})}):A==="resume"&&!Mt.value&&(!r||w)?s(uc,{message:h.resumeConversation}):s(ee,{children:[s(Dg,{conversations:p,attachments:v,greeting:t,botName:e,starterQuestions:n,onPickStarter:R=>{k(R)},sessionNotFound:a,resumeFailed:l,onStartFresh:d,sessionId:r,visitorId:i}),Xn.value!==null&&s(qg,{}),P&&s("div",{class:"jex-session-error-notice",role:"alert",style:{margin:"8px 16px 0"},children:P}),s(Uf,{sessionId:r,visitorId:i,isLoading:o,isStreaming:b,sessionStatus:x,ensureSession:u,onStartFresh:d,maintenance:m})]})}function Hg({formMessageId:t,sessionId:e,visitorId:n,availability:r}){const i=I(),o=Wn.value,a=/^https?:\/\//i.test(o)?o:Hn,[l,c]=O(""),[u,d]=O(""),m=r&&!r.anyOnline?i.escalationOfflineSubtitle:i.escalationSubtitle,h=Wl(),p=ei(),[x,w]=O(!1),[b,v]=O(null);async function k(A){A.preventDefault(),w(!0),v(null);try{await h({sessionId:e,visitorId:n,formMessageId:t,visitorName:l.trim(),visitorEmail:u.trim(),locale:Ve.value}),to()}catch(N){X.error("[EscalationFormScreen] Submit failed:",N),v(i.escalationSubmitFailed)}finally{w(!1)}}return s("div",{class:"jex-form-screen",children:[s("h2",{class:"jex-form-title",children:i.escalationFormTitle}),s("p",{class:"jex-escalation-subtitle",children:m}),b&&s("div",{class:"jex-form-error",role:"alert",children:b}),s("form",{class:"jex-form",onSubmit:A=>{k(A)},children:[s("input",{class:"jex-form-input",type:"text",placeholder:i.escalationNameLabel,value:l,required:!0,onInput:A=>{c(A.currentTarget.value)}}),s("input",{class:"jex-form-input",type:"email",placeholder:i.escalationEmailLabel,value:u,required:!0,onInput:A=>{d(A.currentTarget.value)}}),s("button",{class:"jex-form-submit",type:"submit",disabled:x,onClick:()=>{p({sessionId:e,visitorId:n,formMessageId:t})},children:i.escalationSubmit})]}),s("div",{class:"jex-inline-form-consent",style:{textAlign:"center",margin:"16px 0 8px 0"},children:[i.escalationConsent," ",s("a",{href:a,target:"_blank",rel:"noopener noreferrer",class:"jex-privacy-notice-link",children:i.escalationPrivacyLinkText}),"."]})]})}function Wg(t,e){const n=wt(oe.functions.chat.public.availability.getChatAvailability,t&&e?{orgSlug:t,projSlug:e}:"skip"),r=wt(oe.functions.chat.public.availability.getOrgAvailability,t&&!e?{orgSlug:t}:"skip");return e?n:r}function hc(t){return t?.anyOnline?"online":t?.anyAway?"away":"offline"}function fc({sessionId:t,visitorId:e,ensureSession:n,availability:r}){const i=I(),{requestHuman:o,busy:a,error:l}=dc({sessionId:t,visitorId:e,ensureSession:n}),c=Ts(),u=`jex-presence-dot--${hc(r)}`,d=c?i.handoffMaintenance:r?r.anyOnline?i.handoffAvailable:i.handoffOffline:i.talkToHuman;return s(ee,{children:[s("button",{class:"jex-header-handoff",type:"button",onClick:()=>{o()},disabled:a||c,"aria-label":i.talkToHumanAria,title:d,children:[s("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",children:[s("path",{d:"M3 14v-3a9 9 0 0 1 18 0v3"}),s("path",{d:"M21 14a2 2 0 0 1-2 2h-1a1 1 0 0 1-1-1v-4a1 1 0 0 1 1-1h3z"}),s("path",{d:"M3 14a2 2 0 0 0 2 2h1a1 1 0 0 0 1-1v-4a1 1 0 0 0-1-1H3z"}),s("path",{d:"M21 14v3a4 4 0 0 1-4 4h-3"})]}),r!==void 0&&s("span",{class:`jex-presence-dot ${u}`,"aria-hidden":"true"})]}),l&&s("div",{class:"jex-handoff-error",role:"alert",children:l})]})}async function Qg(){const t=_s.value;if(!t)return X.warn("[JexityChat] Bootstrap refresh skipped — inputs missing"),{ok:!1,reason:"no-inputs"};const e=await Gi(t.orgSlug,t.siteUrl,t.projSlug);if(!e.ok)return X.warn("[JexityChat] Bootstrap refresh failed:",e.error),{ok:!1,reason:e.error};const n=e.token;return Et.value=n,{ok:!0,token:n}}function pc(t){return nl(t)?"maintenance":mc(t)?"unauthorized":t instanceof Error&&/network|fetch|failed to fetch/i.test(t.message)?"network":"unknown"}function mc(t){return t instanceof wr?t.data?.code==="UNAUTHORIZED_ORIGIN":!1}function Gg(t=1e4){return Et.value?Promise.resolve(Et.value):new Promise(e=>{let n=!1;const r=a=>{n||(n=!0,clearTimeout(i),o(),e(a))},i=setTimeout(()=>{r(null)},t),o=Et.subscribe(a=>{a&&r(a)})})}function Kg(t,e){const n=ie(null),r=mn(!1),i=mn(!1),o=mn(!1),a=mn(null),l=kt(oe.functions.chat.public.sessions.createOrResume),c=Z(async p=>{const x=await Gg();if(!x)return X.warn("[JexityChat] No bootstrap token after 10s — session creation blocked."),Mt.value="no-token",null;const w=k=>({orgSlug:t,...e?{projSlug:e}:{},visitorId:p,bootstrapToken:k,locale:Ve.value,...Lr.value?{source:Lr.value}:{},...typeof window<"u"?{pagePath:window.location.pathname}:{}});ro.value=!0;let b;try{try{b=await l(w(x))}catch(k){if(!mc(k))throw k;const A=await Qg();if(!A.ok)return Mt.value=A.reason==="rate_limited"?"network":"unauthorized",null;b=await l(w(A.token))}}finally{ro.value=!1}Mt.value=null,a.value=b.status;const v={sessionId:b.sessionId,visitorId:p};return n.current=v,{session:v,result:b}},[t,e,l,a]),u=Z(async()=>{if(n.current)return n.current;if(o.value)return null;r.value=!0;const p=He.value!==null,x=He.value??Os();try{const w=await c(x);return w?(p&&w.result.isNew&&(i.value=!0,o.value=!0),w.session):null}catch(w){return X.error("[JexityChat] Failed to create session:",w),Mt.value=pc(w),null}finally{r.value=!1}},[c,r,i,o]),d=Z(()=>{n.current=null,i.value=!1,o.value=!1,Ks(),xn.value=null},[i,o]);M(()=>Nh(d),[d]);const m=Z(async()=>{n.current=null,o.value=!1,i.value=!1,Ks(),xn.value=null;const p=Os();r.value=!0;try{return(await c(p))?.session??null}catch(x){return X.error("[JexityChat] Failed to create fresh session:",x),Mt.value=pc(x),null}finally{r.value=!1}},[c,r,i,o]),h=n.current;return{sessionId:h?.sessionId??null,visitorId:h?.visitorId??null,isLoading:r.value,sessionNotFound:i.value,resumeFailed:o.value,sessionStatus:a.value,isOrgDeleted:a.value==="org_deleted",ensureSession:u,startFresh:m,resetSession:d}}function Yg({botName:t,availability:e,onResetSession:n}){const r=I(),[i,o]=O(""),a=e?.anyOnline===!0,l=hc(e);function c(){Dr(),gn.value="escalate",n(),$s(),jt({id:"chat"})}function u(){Dr(),gn.value="fresh",n(),$s(),jt({id:"chat"})}function d(h){Dr(),gn.value="resume",n(),Ds(h),jt({id:"chat"})}function m(h){h.preventDefault();const p=i.trim().toUpperCase();p&&(Dr(),gn.value="resume",n(),Ds(p),jt({id:"chat"}))}return s("div",{class:"jex-home",children:[Gn.value&&s("div",{class:"jex-session-prompt",role:"status",children:s("div",{class:"jex-session-prompt-text",children:r.sessionLocked})}),s("button",{class:"jex-home-hero",type:"button",onClick:c,"aria-label":r.talkToHumanAria,title:e?a?r.handoffAvailable:r.handoffOffline:r.talkToHuman,children:[s("div",{class:"jex-home-avatar",children:[s(Hs,{size:24}),e!==void 0&&s("span",{class:`jex-home-status-dot jex-home-status-dot--${l}`,"aria-hidden":"true"})]}),s("div",{class:"jex-home-hero-text",children:[s("h2",{class:"jex-home-title",children:t}),s("span",{class:"jex-home-status",children:[e===void 0?r.homeStatusOffline:a?r.homeStatusOnline:r.homeStatusOffline," | ",r.talkToHuman]})]})]}),s("div",{class:"jex-home-actions",children:[Ee.value.length>0&&s(ee,{children:[s("span",{class:"jex-home-section-label",children:r.pickUpWhereLeftOff}),s("div",{class:"jex-home-history",children:Ee.value.slice().reverse().map(h=>s("button",{class:"jex-home-resume-card",onClick:()=>{d(h.ref)},children:[s("div",{class:"jex-home-resume-top",children:[s("span",{class:"jex-home-resume-label",children:r.resumeListLabel}),s("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",class:"jex-home-resume-arrow",children:s("path",{d:"M6 3l5 5-5 5",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})})]}),s("span",{class:"jex-home-resume-ref",children:h.ref}),s("span",{class:"jex-home-resume-meta",children:r.resumeListTimestamp.replace("{minutes}",String(Math.max(1,Math.round((Date.now()-h.lastActivityAt)/6e4))))})]},h.ref))})]}),s("button",{class:"jex-home-new-btn",onClick:u,children:Ee.value.length>0?r.startNewConversation:r.chatWith})]}),s("div",{class:"jex-home-lookup-section",children:[s("span",{class:"jex-home-lookup-label",children:r.haveReferenceNumber}),s("form",{class:"jex-home-lookup",onSubmit:m,children:[s("input",{class:"jex-home-lookup-input",type:"text",placeholder:r.referencePlaceholder,value:i,onInput:h=>{o(h.currentTarget.value)}}),s("button",{class:"jex-home-lookup-submit",type:"submit",disabled:!i.trim(),children:r.resume})]})]})]})}function Jg({title:t}){const e=I();return s("div",{class:"jex-selection",children:[s("h2",{class:"jex-selection-title",children:e.howCanWeHelp}),s("div",{class:"jex-selection-options",children:[s("button",{class:"jex-selection-option",onClick:()=>jt({id:"chat"}),children:[s("span",{class:"jex-selection-icon",children:"💬"}),s("span",{class:"jex-selection-label",children:e.chatWith.replace("{title}",t)}),s("span",{class:"jex-selection-sub",children:e.getInstantHelp})]}),s("button",{class:"jex-selection-option",onClick:()=>jt({id:"form"}),children:[s("span",{class:"jex-selection-icon",children:"📝"}),s("span",{class:"jex-selection-label",children:e.submitTicket}),s("span",{class:"jex-selection-sub",children:e.replyByEmail})]})]})]})}function Xg(){const t=I(),[e,n]=O(""),[r,i]=O(""),[o,a]=O("");async function l(c){c.preventDefault(),no({id:"loading",message:t.submittingTicket}),await new Promise(d=>{setTimeout(d,1200)});const u="JEX-"+Math.random().toString(36).slice(2,8).toUpperCase();no({id:"confirmation",ref:u})}return s("div",{class:"jex-form-screen",children:[s("h2",{class:"jex-form-title",children:t.submitTicket}),s("form",{class:"jex-form",onSubmit:c=>{l(c)},children:[s("input",{class:"jex-form-input",type:"text",placeholder:t.yourName,value:e,required:!0,onInput:c=>{n(c.currentTarget.value)}}),s("input",{class:"jex-form-input",type:"email",placeholder:t.yourEmail,value:r,required:!0,onInput:c=>{i(c.currentTarget.value)}}),s("textarea",{class:"jex-form-textarea",placeholder:t.howCanWeHelp,value:o,required:!0,onInput:c=>{a(c.currentTarget.value)}}),s("button",{class:"jex-form-submit",type:"submit",children:t.submit})]})]})}function Zg({ticketRef:t}){const e=I();return s("div",{class:"jex-confirmation",children:[s("div",{class:"jex-confirmation-icon","aria-hidden":"true",children:"✓"}),s("h2",{class:"jex-confirmation-title",children:e.ticketSubmitted}),s("p",{class:"jex-confirmation-body",children:e.yourReferenceNumber}),s("div",{class:"jex-confirmation-ref",children:t}),s("p",{class:"jex-confirmation-hint",children:e.sentToEmailHint}),s("button",{class:"jex-confirmation-done",onClick:()=>{ue.value=!1},children:e.done})]})}function ex({message:t,onRetry:e,onBack:n}){const r=I();return s("div",{class:"jex-overlay jex-error",children:[s("p",{class:"jex-error-message",children:t}),s("div",{class:"jex-error-actions",children:[e&&s("button",{class:"jex-error-retry",onClick:e,children:r.tryAgain}),n&&s("button",{class:"jex-error-back",onClick:n,children:r.goBack})]})]})}function gc({greeting:t,starterQuestions:e,title:n,botName:r,availability:i,sessionId:o,visitorId:a,isLoading:l,sessionNotFound:c,resumeFailed:u,isOrgDeleted:d,ensureSession:m,startFresh:h,resetSession:p,maintenance:x}){const w=Fe.value,b=w[w.length-1],v=[...w].reverse().find(k=>k.id==="confirmation");return s("div",{class:"jex-screen-container",children:[b.id==="home"&&s(Yg,{botName:r,availability:i,onResetSession:p}),b.id==="selection"&&s(Jg,{title:n}),b.id==="form"&&s(Xg,{}),b.id==="escalation-form"&&s(Hg,{formMessageId:b.formMessageId,sessionId:b.sessionId,visitorId:b.visitorId,availability:i,waitingSetAt:b.waitingSetAt}),b.id==="confirmation"&&v&&s(Zg,{ticketRef:v.ref}),b.id==="chat"&&s(Vg,{greeting:t,botName:r,starterQuestions:e,sessionId:o,visitorId:a,isLoading:l,sessionNotFound:c,resumeFailed:u,isOrgDeleted:d,ensureSession:m,startFresh:h,maintenance:x}),b.id==="loading"&&s(uc,{message:b.message}),b.id==="error"&&s(ex,{message:b.message,onRetry:()=>no({id:"loading"}),onBack:to})]})}function tx({options:t}){return ph({orgSlug:t.orgSlug,projSlug:t.projSlug,preToken:t.bootstrapToken,convexUrl:t.convexUrl,preAllowedUrls:t.allowedUrls??[],preExcludedPaths:t.excludePaths,preMaintenance:t.maintenance}),xh()?s(nx,{options:t}):null}function nx({options:t}){const e=Ts(),n=hh(t.orgSlug,t.projSlug,t.convexUrl,t.preloadedConfig);kh(t.parentOrigin),M(()=>(Rh(),Ih(),()=>{Xi.value=!1}),[]);const{sessionId:r,visitorId:i,isLoading:o,sessionNotFound:a,resumeFailed:l,isOrgDeleted:c,ensureSession:u,startFresh:d,resetSession:m}=Kg(t.orgSlug,t.projSlug),h=Wg(t.orgSlug,t.projSlug),p=lh(t,n.config),x=It.value,w=Xi.value,b=n.config!==null||x!==void 0||n.settled,v=n.config!==null?p.sessionTimeoutMs:x!==void 0?x:p.sessionTimeoutMs;M(()=>{Ve.value=wh(p.locale,p.allowVisitorLocale)},[p.locale,p.allowVisitorLocale]),M(()=>{Wn.value=p.privacyPolicyUrl??Hn,Bi.value=p.privacyNoticeStyle,ks.value=p.visitorAttachmentsEnabled},[p.privacyNoticeStyle,p.privacyPolicyUrl,p.visitorAttachmentsEnabled]),M(()=>{if(!ue.value||p.mode==="embedded"||!window.matchMedia("(max-width: 480px), (pointer: coarse) and (max-width: 768px)").matches)return;const me=document.documentElement.style.overflow;return document.documentElement.style.overflow="hidden",()=>{document.documentElement.style.overflow=me}},[ue.value,p.mode]),M(()=>{if(w&&b&&p.mode!=="embedded"&&v!==null)try{return Oh(v)}catch(D){X.warn("[JexityChat] Idle-lock watcher failed to start:",D);return}},[w,p.mode,b,v]),M(()=>{if(!w||!b)return;const{activeRefPruned:D}=Eh(v);D&&oo()},[w,b,v]);const k=p.position==="bottom-left",A=p.colorScheme==="dark"||p.colorScheme==="light"?p.colorScheme:"",N=$h({...t,primaryColor:p.primaryColor,accentColor:p.accentColor,fontFamily:p.fontFamily,fontSize:p.fontSize,borderRadius:p.borderRadius,windowWidth:p.windowWidth,windowHeight:p.windowHeight,triggerOffsetX:p.triggerOffsetX,triggerOffsetY:p.triggerOffsetY}),P=p.mode==="embedded",T=t.trigger==="none",$=t.windowPosition==="middle-center",R=Fe.value,V=R[R.length-1]?.id==="chat",y=n.config!==null||P||!!t.parentOrigin,le=y?N:{...N,visibility:"hidden"},C=Gh(t.orgSlug,t.projSlug);return M(()=>{if(P||T||!y||p.proactiveMode==="off"||Ws(C))return;const D=t.proactiveAlreadyElapsed?0:p.proactiveDelaySeconds*1e3,me=window.setTimeout(()=>{const q=Yh({mode:p.proactiveMode,isOpen:ue.peek(),hasHistory:Zi.peek(),dismissed:Ws(C)});q==="teaser"?zr.value=!0:q==="open"&&(ue.value=!0)},D);return()=>{window.clearTimeout(me)}},[P,T,y,p.proactiveMode,p.proactiveDelaySeconds,C,t.proactiveAlreadyElapsed]),s("div",{class:`jex-widget ${A}`.trim(),style:le,children:P?s("div",{class:"jex-embedded",children:[s(Bs,{title:p.title,rightAction:V?s(fc,{sessionId:r,visitorId:i,ensureSession:u,availability:h}):null,showClose:!P,showLocalePicker:p.allowVisitorLocale}),s(gc,{greeting:p.greeting,starterQuestions:p.starterQuestions,title:p.title,botName:p.botName,orgSlug:t.orgSlug,projSlug:t.projSlug,availability:h,sessionId:r,visitorId:i,isLoading:o,sessionNotFound:a,resumeFailed:l,isOrgDeleted:c,ensureSession:u,startFresh:d,resetSession:m,maintenance:e}),!p.hideBranding&&s(Vs,{})]}):s("div",{class:`jex-container${k?" jex-pos-left":""}`,children:[ue.value&&s("div",{class:`jex-chat-window${$?" jex-win-center":""}`,children:[s(Bs,{title:p.title,rightAction:V?s(fc,{sessionId:r,visitorId:i,ensureSession:u,availability:h}):null,showLocalePicker:p.allowVisitorLocale}),s(gc,{greeting:p.greeting,starterQuestions:p.starterQuestions,title:p.title,botName:p.botName,orgSlug:t.orgSlug,projSlug:t.projSlug,availability:h,sessionId:r,visitorId:i,isLoading:o,sessionNotFound:a,resumeFailed:l,isOrgDeleted:c,ensureSession:u,startFresh:d,resetSession:m,maintenance:e}),!p.hideBranding&&s(Vs,{})]}),zr.value&&!ue.value&&!T&&s(Jh,{title:p.title,message:p.greeting,guardKey:C}),!T&&s(Qh,{iconOption:p.triggerIcon,radius:p.triggerRadius,label:p.triggerLabel})]})})}const rx=`.jex-widget{--jex-primary: #115A62;--jex-primary-hover: var(--jex-accent, color-mix(in srgb, var(--jex-primary) 85%, #000));--jex-radius: .75rem;--jex-font-family: "Inter", system-ui, -apple-system, sans-serif;--jex-font-size: 14px;--jex-window-width: 380px;--jex-window-height: 600px;--jex-shadow: 0 16px 48px -12px rgba(13, 127, 138, .25), 0 4px 16px rgba(0, 0, 0, .08);pointer-events:auto;--jex-bg-trigger: var(--jex-primary);--jex-bg-header: var(--jex-primary);--jex-bg-msg-user: var(--jex-primary);--jex-bg-send-btn: var(--jex-primary);--jex-bg-window: rgba(255, 255, 255, .95);--jex-bg-msg-bot: #f1f5f9;--jex-bg-input: rgba(247, 253, 253, .6);--jex-text-header: #ffffff;--jex-text-msg-user: #ffffff;--jex-text-msg-bot: #0f172a;--jex-text-main: #0f172a;--jex-text-muted: #64748b;--jex-bg-avatar-agent: #d1fae5;--jex-text-avatar-agent: #065f46;--jex-border-window: rgba(226, 232, 240, .8);--jex-border-input: rgba(203, 213, 225, .8);--jex-bg-glass: var(--jex-bg-window);--jex-border-glass: var(--jex-border-window);font-family:var(--jex-font-family);-webkit-font-smoothing:antialiased}.dark .jex-widget,.jex-widget.dark{--jex-primary: #1cb0bf;--jex-primary-hover: var(--jex-accent, color-mix(in srgb, var(--jex-primary) 85%, #000));--jex-bg-window: rgba(10, 15, 26, .95);--jex-bg-msg-bot: #233146;--jex-bg-input: rgba(10, 15, 26, .6);--jex-text-msg-bot: #f8fafc;--jex-text-main: #f8fafc;--jex-text-muted: #94a3b8;--jex-border-window: rgba(30, 41, 59, .8);--jex-border-input: rgba(51, 65, 85, .9);--jex-bg-avatar-agent: #064e3b;--jex-text-avatar-agent: #6ee7b7;--jex-bg-error: #3b1318;--jex-border-error: #5c1d24;--jex-text-error: #fca5a5}@media(prefers-color-scheme:dark){:host:not(.light) .jex-widget:not(.light){--jex-primary: #1cb0bf;--jex-primary-hover: var(--jex-accent, color-mix(in srgb, var(--jex-primary) 85%, #000));--jex-bg-window: rgba(10, 15, 26, .95);--jex-bg-msg-bot: #233146;--jex-bg-input: rgba(10, 15, 26, .6);--jex-text-msg-bot: #f8fafc;--jex-text-main: #f8fafc;--jex-text-muted: #94a3b8;--jex-border-window: rgba(30, 41, 59, .8);--jex-border-input: rgba(51, 65, 85, .9);--jex-bg-error: #3b1318;--jex-border-error: #5c1d24;--jex-text-error: #fca5a5}}.jex-widget *{box-sizing:border-box;margin:0;padding:0}.jex-container{position:fixed;bottom:var(--jex-offset-y, 24px);right:var(--jex-offset-x, 24px);display:flex;flex-direction:column;align-items:flex-end;gap:16px;z-index:9999}.jex-container.jex-pos-left{right:auto;left:var(--jex-offset-x, 24px);align-items:flex-start}:host(.jex-mode-embedded){display:block;width:100%;height:100%}:host(.jex-mode-embedded) .jex-widget{width:100%;height:100%}.jex-embedded{display:flex;flex-direction:column;width:100%;height:100%;background:var(--jex-bg-window);border:1px solid var(--jex-border-window);overflow:hidden}.jex-embedded .jex-screen-container{flex:1;overflow:hidden;display:flex;flex-direction:column}.jex-floating-button{height:56px;min-width:56px;padding:0;background:var(--jex-bg-trigger);color:var(--jex-text-header);border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;box-shadow:var(--jex-shadow);transition:transform .3s cubic-bezier(.175,.885,.32,1.275),background .2s,width .3s ease,border-radius .3s ease}.jex-floating-button.jex-has-label{min-width:110px;padding:0 20px}.jex-fab-inner{display:flex;align-items:center;gap:12px}.jex-fab-label{font-size:15px;font-weight:600;white-space:nowrap}.jex-floating-button:hover{transform:scale(1.1);background:var(--jex-primary-hover)}.jex-floating-button:active{transform:scale(.95)}.jex-fab-pulse{animation:jex-fab-pulse 2.4s ease-out infinite}@keyframes jex-fab-pulse{0%{box-shadow:var(--jex-shadow),0 0 color-mix(in srgb,var(--jex-bg-trigger) 50%,transparent)}70%{box-shadow:var(--jex-shadow),0 0 0 14px color-mix(in srgb,var(--jex-bg-trigger) 0%,transparent)}to{box-shadow:var(--jex-shadow),0 0 color-mix(in srgb,var(--jex-bg-trigger) 0%,transparent)}}@media(prefers-reduced-motion:reduce){.jex-fab-pulse{animation:none}}.jex-proactive-teaser{display:flex;align-items:flex-start;gap:10px;width:280px;max-width:calc(100vw - 48px);padding:12px 14px;align-self:flex-end;background:var(--jex-bg-window);color:var(--jex-text-main);border:1px solid var(--jex-border-window);border-radius:var(--jex-radius);box-shadow:var(--jex-shadow);cursor:pointer;text-align:left;animation:jex-teaser-in .22s ease-out}.jex-proactive-avatar{flex:0 0 auto;display:flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:9999px;background:var(--jex-bg-avatar-agent);color:var(--jex-text-avatar-agent)}.jex-proactive-body{display:flex;flex-direction:column;gap:2px;min-width:0}.jex-proactive-title{font-weight:600;font-size:13px;line-height:1.2}.jex-proactive-message{font-size:13px;line-height:1.35;color:var(--jex-text-muted)}.jex-proactive-dismiss{flex:0 0 auto;display:flex;align-items:center;justify-content:center;width:22px;height:22px;margin:-4px -4px 0 0;padding:0;border:none;background:transparent;color:var(--jex-text-muted);cursor:pointer;border-radius:9999px}.jex-proactive-dismiss:hover{background:var(--jex-bg-msg-bot)}@keyframes jex-teaser-in{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}@media(prefers-reduced-motion:reduce){.jex-proactive-teaser{animation:none}}.jex-chat-window{width:var(--jex-window-width);height:var(--jex-window-height);max-height:calc(100vh - 120px);background:var(--jex-bg-window);backdrop-filter:blur(24px);-webkit-backdrop-filter:blur(24px);border:1px solid var(--jex-border-window);border-radius:calc(var(--jex-radius) * 2);box-shadow:var(--jex-shadow);display:flex;flex-direction:column;overflow:hidden;animation:jexSlideUp .4s cubic-bezier(.16,1,.3,1);transform-origin:bottom right;touch-action:manipulation}@keyframes jexSlideUp{0%{opacity:0;transform:scale(.8) translateY(20px)}to{opacity:1;transform:scale(1) translateY(0)}}.jex-chat-window.jex-win-center{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;max-height:82vh;animation:jexCenterIn .34s cubic-bezier(.16,1,.3,1)}@keyframes jexCenterIn{0%{opacity:0;transform:translate(-50%,-50%) scale(.92)}to{opacity:1;transform:translate(-50%,-50%) scale(1)}}@media(prefers-reduced-motion:reduce){.jex-chat-window.jex-win-center{animation:none}}@media(max-width:480px),(pointer:coarse)and (max-width:768px){.jex-chat-window,.jex-chat-window.jex-win-center{position:fixed;inset:0;width:100vw;height:100vh;height:100dvh;max-height:none;border:none;border-radius:0;transform:none;animation:jexSlideUpMobile .3s cubic-bezier(.16,1,.3,1);transform-origin:bottom center}.jex-container:has(.jex-chat-window) .jex-floating-button{display:none}}@keyframes jexSlideUpMobile{0%{opacity:0;transform:translateY(100%)}to{opacity:1;transform:translateY(0)}}.jex-chat-header{padding:14px 16px;background:var(--jex-bg-header);color:var(--jex-text-header);display:flex;align-items:center;gap:12px;flex-shrink:0}.jex-header-info{display:flex;align-items:center;gap:8px;min-width:0}.jex-header-info h3{font-size:16px;font-weight:600;color:var(--jex-text-header);margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.jex-locale-picker{position:relative;display:flex}.jex-flag{display:inline-flex;width:20px;height:14px;flex-shrink:0;border-radius:3px;overflow:hidden;box-shadow:0 0 0 1px color-mix(in srgb,currentColor 25%,transparent)}.jex-flag svg{width:100%;height:100%}.jex-header-locale{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;background:transparent;border:none;border-radius:999px;padding:0;color:inherit;cursor:pointer;transition:background .15s ease}.jex-header-locale:hover,.jex-header-locale[aria-expanded=true]{background:color-mix(in srgb,currentColor 14%,transparent)}.jex-locale-menu{position:absolute;top:calc(100% + 6px);right:0;z-index:20;display:flex;flex-direction:column;min-width:140px;padding:4px;background:var(--jex-bg-window);color:var(--jex-text-main);border:1px solid var(--jex-border-window);border-radius:10px;box-shadow:0 8px 24px #0f172a29}.jex-locale-option{display:flex;align-items:center;gap:10px;padding:8px 10px;font-size:13px;line-height:1.2;text-align:left;background:transparent;border:none;border-radius:6px;color:inherit;cursor:pointer}.jex-locale-option:hover,.jex-locale-option:focus-visible{background:color-mix(in srgb,currentColor 8%,transparent)}.jex-locale-option.jex-locale-active{font-weight:600}.jex-header-info p{font-size:12px;opacity:.8;color:var(--jex-text-header);margin:0}.jex-header-right{margin-left:auto;display:flex;align-items:center;gap:4px}.jex-header-handoff{position:relative;display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;background:transparent;border:1px solid color-mix(in srgb,currentColor 50%,transparent);border-radius:999px;padding:0;color:inherit;cursor:pointer;transition:background .15s ease,border-color .15s ease}.jex-header-handoff:hover:not(:disabled){background:color-mix(in srgb,currentColor 12%,transparent);border-color:currentColor}.jex-header-handoff:disabled{opacity:.5;cursor:not-allowed}.jex-header-close{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;background:transparent;border:none;border-radius:999px;padding:0;color:inherit;cursor:pointer;transition:background .15s ease}.jex-header-close:hover{background:color-mix(in srgb,currentColor 14%,transparent)}.jex-handoff-error{position:absolute;top:100%;right:8px;background:#fee;color:#b00;padding:4px 8px;font-size:12px;border-radius:4px}.jex-header-back{background:none;border:none;color:var(--jex-text-header);cursor:pointer;padding:4px;display:flex;align-items:center;opacity:.8;transition:opacity .2s;flex-shrink:0}.jex-header-back:hover{opacity:1}.jex-screen-container{flex:1;overflow:hidden;display:flex;flex-direction:column}.jex-home{flex:1;display:flex;flex-direction:column;padding:24px;gap:20px;overflow-y:auto}.jex-home-hero{display:flex;align-items:center;gap:14px;width:100%;padding:0;border:none;background:transparent;font-family:inherit;text-align:left;cursor:pointer;animation:jexFadeIn .4s ease both}.jex-home-hero:disabled{cursor:default;opacity:.7}.jex-home-avatar{position:relative;width:48px;height:48px;border-radius:14px;background:var(--jex-primary);color:var(--jex-text-header);display:flex;align-items:center;justify-content:center;flex-shrink:0;box-shadow:0 4px 12px color-mix(in srgb,var(--jex-primary) 30%,transparent)}.jex-home-status-dot{position:absolute;bottom:-2px;right:-2px;width:14px;height:14px;border-radius:50%;background:var(--jex-dot-color, #9ca3af);border:2.5px solid var(--jex-bg-window);animation:jexPulse 2s ease-in-out infinite}.jex-home-status-dot--online{--jex-dot-color: #10b981}.jex-home-status-dot--away{--jex-dot-color: #fbbf24}.jex-home-status-dot--offline{--jex-dot-color: #9ca3af}@keyframes jexPulse{0%,to{box-shadow:0 0 color-mix(in srgb,var(--jex-dot-color, #9ca3af) 40%,transparent)}50%{box-shadow:0 0 0 6px color-mix(in srgb,var(--jex-dot-color, #9ca3af) 0%,transparent)}}.jex-home-hero-text{display:flex;flex-direction:column;gap:2px;min-width:0}.jex-home-title{font-size:17px;font-weight:700;color:var(--jex-text-main);margin:0;line-height:1.2;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.jex-home-status{font-size:13px;font-weight:500;color:var(--jex-text-muted);letter-spacing:.01em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.jex-home-section-label{font-size:11px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--jex-text-muted)}.jex-home-lookup-section{display:flex;flex-direction:column;gap:8px;margin-top:auto}.jex-home-lookup-label{font-size:12px;font-weight:500;color:var(--jex-text-muted)}.jex-home-greeting{background:var(--jex-bg-msg-bot);border:1px solid var(--jex-border-window);border-radius:4px 16px 16px;padding:16px 18px;font-size:14px;line-height:1.55;color:var(--jex-text-main);animation:jexFadeIn .4s .1s ease both}.jex-home-greeting p{margin:0}@keyframes jexFadeIn{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}.jex-home-actions{display:flex;flex-direction:column;gap:10px;animation:jexFadeIn .4s .2s ease both}.jex-home-start-btn{background:var(--jex-bg-send-btn);color:var(--jex-text-header);border:none;border-radius:12px;padding:14px 20px;font-size:15px;font-weight:600;cursor:pointer;font-family:inherit;transition:background .2s,transform .15s,box-shadow .2s;width:100%;box-shadow:0 2px 8px color-mix(in srgb,var(--jex-primary) 25%,transparent)}.jex-home-start-btn:hover{background:var(--jex-primary-hover);transform:translateY(-1px);box-shadow:0 4px 16px color-mix(in srgb,var(--jex-primary) 35%,transparent)}.jex-home-start-btn:active{transform:translateY(0);box-shadow:0 1px 4px color-mix(in srgb,var(--jex-primary) 20%,transparent)}.jex-home-resume-card{display:flex;flex-direction:column;gap:8px;width:100%;text-align:left;padding:16px 18px;border-radius:14px;border:1.5px solid var(--jex-primary);background:color-mix(in srgb,var(--jex-primary) 6%,var(--jex-bg-window));cursor:pointer;font-family:inherit;transition:background .2s,border-color .2s,transform .15s,box-shadow .2s;box-shadow:0 2px 8px color-mix(in srgb,var(--jex-primary) 12%,transparent)}.jex-home-resume-card:hover{background:color-mix(in srgb,var(--jex-primary) 10%,var(--jex-bg-window));transform:translateY(-1px);box-shadow:0 4px 16px color-mix(in srgb,var(--jex-primary) 20%,transparent)}.jex-home-resume-card:active{transform:translateY(0)}.jex-home-resume-top{display:flex;align-items:center;justify-content:space-between}.jex-home-resume-label{font-size:14px;font-weight:600;color:var(--jex-primary)}.jex-home-resume-arrow{color:var(--jex-primary);opacity:.6;transition:opacity .2s,transform .2s}.jex-home-resume-card:hover .jex-home-resume-arrow{opacity:1;transform:translate(2px)}.jex-home-resume-ref{font-family:ui-monospace,Cascadia Code,Fira Code,monospace;font-size:13px;font-weight:600;letter-spacing:.06em;color:var(--jex-text-muted)}.jex-home-history{display:flex;flex-direction:column;gap:8px}.jex-home-resume-meta{font-size:12px;color:var(--jex-text-muted);margin-top:4px}.jex-home-new-btn{background:transparent;color:var(--jex-text-muted);border:1px solid var(--jex-border-input);border-radius:12px;padding:12px 20px;font-size:14px;font-weight:500;cursor:pointer;font-family:inherit;transition:color .2s,border-color .2s,background .2s;width:100%}.jex-home-new-btn:hover{color:var(--jex-text-main);border-color:var(--jex-text-muted);background:color-mix(in srgb,var(--jex-primary) 3%,transparent)}.jex-session-ref{display:flex;align-items:center;gap:8px;padding:8px 12px;background:var(--jex-bg-msg-bot);border:1px solid var(--jex-border-window);border-radius:8px;font-size:12px}.jex-session-ref-label{color:var(--jex-text-muted);font-weight:500}.jex-session-ref-code{color:var(--jex-primary);font-weight:700;font-family:ui-monospace,Cascadia Code,monospace;letter-spacing:.05em}.jex-chat-messages{flex:1;padding:20px;overflow-y:auto;display:flex;flex-direction:column;gap:12px}.jex-message-row{display:flex;align-items:flex-end;gap:8px;max-width:85%}.jex-message-row.bot{align-self:flex-start;flex-direction:column;align-items:stretch;gap:6px;max-width:92%}.jex-message-head{display:flex;align-items:center;gap:8px;padding-left:2px}.jex-message-head .jex-avatar{margin-bottom:0}.jex-avatar{width:24px;height:24px;border-radius:50%;flex-shrink:0;display:flex;align-items:center;justify-content:center;font-size:12px;margin-bottom:2px}.jex-avatar-bot{background:var(--jex-bg-msg-bot);color:var(--jex-primary)}.jex-avatar-agent{background:var(--jex-bg-avatar-agent)}.jex-avatar-img{width:100%;height:100%;border-radius:50%;object-fit:cover}.jex-avatar-initials{font-size:9px;font-weight:700;color:var(--jex-text-avatar-agent)}.jex-message-author{font-size:13px;font-weight:600;color:var(--jex-text-main);line-height:1.2}.jex-quote-btn{position:absolute;top:-8px;right:-8px;display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;padding:0;border:1px solid var(--jex-border-window);border-radius:50%;background:var(--jex-bg-window);color:var(--jex-text-muted, #6b7280);box-shadow:0 1px 4px #0000001f;cursor:pointer;opacity:0;transform:scale(.9);transition:opacity .12s,transform .12s,background .15s,color .15s}.jex-quote-btn:hover{background:var(--jex-bg-msg-bot);color:var(--jex-primary, #115A62);transform:scale(1)}.jex-quote-btn:focus-visible{opacity:1;transform:scale(1);outline:2px solid var(--jex-primary, #115A62);outline-offset:1px}@media(hover:hover){.jex-message:hover .jex-quote-btn{opacity:1;transform:scale(1)}}@media(hover:none){.jex-quote-btn{opacity:1;transform:scale(1)}}.jex-message.user .jex-mention{font-weight:700;background:#ffffff38;border-radius:4px;padding:0 3px}.jex-quoted-chip{display:flex;align-items:flex-start;gap:4px;width:100%;margin-bottom:6px;padding-bottom:6px;border:none;border-bottom:1px solid var(--jex-border-window);background:transparent;color:inherit;font:inherit;font-size:12px;opacity:.8;text-align:left;cursor:pointer}.jex-quoted-chip:hover{opacity:1}.jex-quoted-chip-text{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.jex-quoted-chip-author{font-weight:600}.jex-quoted-list{display:flex;flex-direction:column}.jex-quoted-list .jex-quoted-chip{margin-bottom:3px;padding-bottom:3px}.jex-quoted-list .jex-quoted-chip:last-child{margin-bottom:6px;padding-bottom:6px}.jex-msg-highlight{outline:2px solid var(--jex-primary, #115A62);outline-offset:2px;transition:outline-color .2s}.jex-reply-preview{display:flex;align-items:center;gap:6px;padding:6px 10px;border-radius:10px;background:var(--jex-bg-msg-bot);border:1px solid var(--jex-border-window);font-size:12px;color:var(--jex-text-muted)}.jex-reply-preview-icon{flex:0 0 auto;color:var(--jex-primary)}.jex-reply-preview-text{min-width:0;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.jex-reply-preview-author{font-weight:600;color:var(--jex-text-main)}.jex-reply-preview-cancel{flex:0 0 auto;display:inline-flex;padding:2px;border:none;border-radius:4px;background:transparent;color:var(--jex-text-muted);cursor:pointer}.jex-reply-preview-cancel:hover{color:var(--jex-text-main);background:#0000000f}.jex-message{position:relative;padding:12px 16px;border-radius:18px;font-size:14px;line-height:1.4}.jex-message.bot{background:var(--jex-bg-msg-bot);border:1px solid var(--jex-border-window);color:var(--jex-text-msg-bot);border-radius:16px}.jex-message.user{align-self:flex-end;max-width:80%;background:var(--jex-bg-msg-user);color:var(--jex-text-msg-user);border-bottom-right-radius:4px}.jex-typing{align-self:flex-start;display:flex;gap:4px;padding:12px 16px}.jex-typing span{width:8px;height:8px;border-radius:50%;background:var(--jex-text-muted);animation:jexTypingDot 1.2s infinite ease-in-out}.jex-typing span:nth-child(2){animation-delay:.2s}.jex-typing span:nth-child(3){animation-delay:.4s}@keyframes jexTypingDot{0%,80%,to{transform:scale(.8);opacity:.4}40%{transform:scale(1);opacity:1}}.jex-md{word-break:break-word;overflow-wrap:anywhere}.jex-md p{margin:0 0 8px}.jex-md p:last-child{margin-bottom:0}.jex-md strong{font-weight:600}.jex-md em{font-style:italic}.jex-md ul,.jex-md ol{margin:0 0 8px;padding-left:20px}.jex-md ul:last-child,.jex-md ol:last-child{margin-bottom:0}.jex-md ul{list-style-type:disc}.jex-md ol{list-style-type:decimal}.jex-md li{margin-bottom:2px}.jex-md li:last-child{margin-bottom:0}.jex-md a{color:var(--jex-primary);text-decoration:underline;text-underline-offset:2px}.jex-md a:hover{opacity:.8}.jex-md img{display:block;width:auto;height:auto;max-width:100%;max-height:260px;margin:4px 0;border-radius:8px;background:#0000000a}.jex-md-img-link{display:inline-block;text-decoration:none;cursor:zoom-in}.jex-md-img-link:hover{opacity:1}.jex-md-img-link:hover img{opacity:.9}.jex-md code{background:#00000014;padding:1px 5px;border-radius:4px;font-size:.9em;font-family:ui-monospace,Cascadia Code,Fira Code,monospace}.jex-md pre{background:#0000000f;border-radius:8px;padding:10px 12px;margin:0 0 8px;overflow-x:auto;font-size:.85em}.jex-md pre:last-child{margin-bottom:0}.jex-md pre code{background:none;padding:0;border-radius:0;font-size:inherit}.jex-md h1,.jex-md h2,.jex-md h3,.jex-md h4{font-weight:600;margin:8px 0 4px}.jex-md h1:first-child,.jex-md h2:first-child,.jex-md h3:first-child,.jex-md h4:first-child{margin-top:0}.jex-md h3{font-size:1em}.jex-md h4{font-size:.95em}.jex-md hr{border:none;border-top:1px solid var(--jex-border-window);margin:8px 0}.jex-md blockquote{border-left:3px solid var(--jex-primary);background:color-mix(in srgb,currentColor 6%,transparent);border-radius:0 8px 8px 0;margin:0 0 8px;padding:6px 12px;color:var(--jex-text-muted)}.jex-md blockquote:last-child{margin-bottom:0}.jex-md table{width:100%;border-collapse:collapse;margin:0 0 8px;font-size:.95em}.jex-md table:last-child{margin-bottom:0}.jex-md th,.jex-md td{text-align:left;padding:6px 10px;border-bottom:1px solid color-mix(in srgb,currentColor 14%,transparent)}.jex-md th{font-weight:600;border-bottom-width:2px}.jex-md tr:last-child td{border-bottom:none}.jex-md tbody tr:nth-child(2n) td{background:color-mix(in srgb,currentColor 5%,transparent)}.jex-md .jex-card-grid{display:flex;flex-direction:column;gap:8px;margin:0 0 8px}.jex-md .jex-card-grid:last-child{margin-bottom:0}.jex-md .jex-card{border:1px solid color-mix(in srgb,currentColor 16%,transparent);background:color-mix(in srgb,currentColor 5%,transparent);border-radius:10px;padding:10px 12px}.jex-md .jex-card-title{font-weight:700;margin-bottom:4px}.jex-md .jex-card>:last-child{margin-bottom:0}.dark .jex-md code,.jex-widget.dark .jex-md code{background:#ffffff1a}.dark .jex-md pre,.jex-widget.dark .jex-md pre{background:#ffffff14}@media(prefers-color-scheme:dark){:host:not(.light) .jex-widget:not(.light) .jex-md code{background:#ffffff1a}:host:not(.light) .jex-widget:not(.light) .jex-md pre{background:#ffffff14}}.jex-streaming-cursor:after{content:"◊";margin-left:2px;animation:jexBlinkCursor .8s ease-in-out infinite}@keyframes jexBlinkCursor{0%,to{opacity:1}50%{opacity:0}}.jex-session-notice{align-self:center;text-align:center;padding:8px 16px;margin:8px 0;font-size:12px;color:var(--jex-text-muted);background:var(--jex-bg-input, #f1f5f9);border-radius:8px;line-height:1.4}.jex-message-error{background:var(--jex-bg-error, #fef2f2)!important;border-color:var(--jex-border-error, #fecaca)!important;color:var(--jex-text-error, #991b1b)!important}.jex-chat-input{padding:12px 16px;border-top:1px solid var(--jex-border-window);display:flex;flex-direction:column;gap:8px;flex-shrink:0}.jex-chat-input-composer-gate{position:relative}.jex-chat-input-composer-gate-open{z-index:2}.jex-chat-input-composer-gate-open .jex-composer-card{pointer-events:none}.jex-composer-card{display:flex;flex-direction:column;gap:6px;padding:10px 12px 8px;background:var(--jex-bg-input);border:1px solid var(--jex-border-input);border-radius:16px;cursor:text;transition:border-color .15s ease,background .15s ease,box-shadow .15s ease}.jex-composer-card:focus-within{border-color:var(--jex-primary);background:var(--jex-bg-window);box-shadow:0 0 0 3px color-mix(in srgb,var(--jex-primary, #115A62) 14%,transparent)}.jex-composer-attachments{display:flex;flex-wrap:wrap;gap:6px;padding:2px 2px 4px}.jex-attachment-chip{position:relative;width:44px;height:44px;border-radius:8px;overflow:hidden;background:var(--jex-bg-msg-bot, #f1f5f9);flex-shrink:0;box-shadow:0 1px 2px #0000000f}.jex-attachment-thumb{width:100%;height:100%;object-fit:cover;display:block;pointer-events:none}.jex-attachment-remove{position:absolute;top:2px;right:2px;width:16px;height:16px;padding:0;border:none;border-radius:50%;background:#0f172ac7;color:#fff;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;opacity:0;transition:opacity .12s ease,transform .12s ease}.jex-attachment-chip:hover .jex-attachment-remove,.jex-attachment-chip:focus-within .jex-attachment-remove{opacity:1}.jex-attachment-remove:before{content:"";position:absolute;inset:-4px}@media(hover:none){.jex-attachment-remove{opacity:1}}.jex-attachment-remove:hover{transform:scale(1.08)}.jex-attachment-chip:has(.jex-attachment-file){width:auto;max-width:160px}.jex-attachment-file{display:flex;align-items:center;gap:6px;height:100%;padding:0 24px 0 10px;font-size:12px;color:var(--jex-text-main, #0f172a)}.jex-attachment-file svg{flex-shrink:0}.jex-attachment-file-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.jex-attachment-chip[data-status=uploading]{opacity:.6}.jex-attachment-chip[data-status=failed]{box-shadow:0 0 0 2px var(--jex-text-error, #991b1b)}.jex-attachment-chip[data-status=failed] .jex-attachment-remove{opacity:1}.jex-attachment-chip{transition:opacity .15s ease,box-shadow .15s ease}.jex-attachment-note{margin:0 2px 4px;font-size:11px;line-height:1.4;color:var(--jex-text-muted, #64748b)}.jex-attachment-status{margin:0 0 6px;font-size:12px;line-height:1.4;color:var(--jex-text-muted, #64748b)}.jex-attachment-status:empty{margin:0}.jex-attachment-status-error{color:var(--jex-text-error, #991b1b)}.jex-msg-files{display:flex;flex-wrap:wrap;gap:6px;margin:4px 0 2px}.jex-msg-files-user{justify-content:flex-end}.jex-msg-files-bot{justify-content:flex-start}.jex-msg-file-thumb{display:block;width:96px;height:96px;border-radius:14px;overflow:hidden;background:var(--jex-bg-msg-bot, #f1f5f9);border:1px solid var(--jex-border-window, rgba(226, 232, 240, .8));transition:opacity .15s ease}.jex-msg-file-thumb:hover{opacity:.9}.jex-msg-file-thumb img{width:100%;height:100%;object-fit:cover;display:block}.jex-msg-file-card{display:flex;align-items:center;gap:8px;max-width:220px;padding:8px 10px;border-radius:12px;background:var(--jex-bg-msg-bot, #f1f5f9);border:1px solid var(--jex-border-window, rgba(226, 232, 240, .8));color:var(--jex-text-main, #0f172a);text-decoration:none;transition:background-color .15s ease,opacity .15s ease}a.jex-msg-file-card:hover{background:var(--jex-border-window, rgba(226, 232, 240, .8))}.jex-msg-file-card svg{flex-shrink:0;color:var(--jex-text-muted, #64748b)}.jex-msg-file-card[aria-disabled=true],.jex-msg-file-pending{opacity:.7}.jex-msg-files-error{display:flex;flex-wrap:wrap;align-items:baseline;gap:4px;margin:0 0 4px;font-size:12px;line-height:1.4;color:var(--jex-text-error, #991b1b)}.jex-msg-files-retry{padding:0;border:none;background:none;font:inherit;font-weight:600;color:var(--jex-primary, #115A62);cursor:pointer;transition:opacity .15s ease}.jex-msg-files-retry:hover,.jex-msg-files-retry:focus-visible{opacity:.75}.jex-msg-file-text{display:flex;flex-direction:column;min-width:0}.jex-msg-file-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:500}.jex-msg-file-meta{font-size:11px;color:var(--jex-text-muted, #64748b)}.jex-msg-file-unavailable{border-style:dashed;background:transparent;color:var(--jex-text-muted, #64748b)}@media(prefers-reduced-motion:reduce){.jex-attachment-chip,.jex-msg-file-thumb,.jex-msg-file-card{transition:none}}.jex-composer-textarea{width:100%;min-height:22px;background:transparent;border:none;outline:none;resize:none;padding:2px 4px;color:var(--jex-text-main);font-family:inherit;font-size:16px;line-height:1.45;overflow-y:hidden}.jex-composer-textarea::placeholder{color:var(--jex-text-muted);opacity:.85}.jex-composer-textarea:disabled{cursor:not-allowed;opacity:.7}.jex-composer-actions{display:flex;align-items:center;justify-content:space-between;gap:8px}.jex-composer-actions-left{display:inline-flex;align-items:center;gap:4px}.jex-attach-btn{width:30px;height:30px;padding:0;border:none;border-radius:50%;background:transparent;color:var(--jex-text-muted);display:inline-flex;align-items:center;justify-content:center;cursor:pointer;transition:background .12s ease,color .12s ease,transform .12s ease}.jex-attach-btn:hover:not(:disabled){background:color-mix(in srgb,var(--jex-text-muted, #64748b) 12%,transparent);color:var(--jex-text-main)}.jex-attach-btn:active:not(:disabled){transform:scale(.92)}.jex-attach-btn:disabled{opacity:.4;cursor:not-allowed}.jex-mic-btn{position:relative}.jex-mic-btn svg{position:relative}.jex-mic-ring{position:absolute;inset:0;border-radius:50%;background:var(--jex-primary);opacity:0;transition:transform 80ms linear,opacity .12s ease;pointer-events:none}.jex-mic-btn-listening{color:var(--jex-primary)}@keyframes jex-mic-pulse{0%,to{opacity:.2}50%{opacity:.45}}@media(prefers-reduced-motion:reduce),(pointer:coarse){.jex-mic-ring{transition:none}.jex-mic-btn-listening .jex-mic-ring{animation:jex-mic-pulse 1.6s ease-in-out infinite}}.jex-voice-status{margin:0 0 6px;font-size:12px;line-height:1.4;color:var(--jex-text-muted, #64748b)}.jex-voice-status:empty{margin:0}.jex-voice-status-error{color:var(--jex-text-error, #991b1b)}.jex-visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.jex-rate-limit-notice{flex:0 0 auto;order:-1;margin-bottom:8px;padding:8px 12px;border-radius:10px;background:var(--jex-bg-msg-bot, #f1f5f9);color:var(--jex-text-muted, #64748b);font-size:12px;line-height:1.4;text-align:center}.jex-session-error-notice{flex:0 0 auto;order:-1;margin-bottom:8px;padding:8px 12px;border-radius:10px;background:var(--jex-bg-error, #fef2f2);border:1px solid var(--jex-border-error, #fecaca);color:var(--jex-text-error, #991b1b);font-size:12px;line-height:1.4;text-align:center}.jex-chat-input input{flex:1;background:var(--jex-bg-input);border:1px solid var(--jex-border-input);border-radius:12px;padding:10px 14px;color:var(--jex-text-main);outline:none;font-family:inherit;font-size:14px}.jex-chat-input input:focus{border-color:var(--jex-primary)}.jex-send-btn{background:color-mix(in srgb,var(--jex-text-muted, #64748b) 18%,transparent);color:var(--jex-text-muted);border:none;border-radius:999px;width:30px;height:30px;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;transition:background .15s ease,color .15s ease,opacity .15s ease,transform .15s ease;flex-shrink:0}.jex-send-btn-active{background:var(--jex-bg-send-btn, var(--jex-primary));color:var(--jex-text-header, #fff)}.jex-send-btn-active:hover:not(:disabled){background:var(--jex-primary-hover)}.jex-send-btn:active:not(:disabled){transform:scale(.9)}.jex-send-btn:disabled{opacity:.45;cursor:default}.jex-widget-footer{display:flex;align-items:center;justify-content:center;padding:8px 16px;border-top:1px solid var(--jex-border-glass);background:#00000005;flex-shrink:0}.jex-widget.dark .jex-widget-footer{background:#ffffff05}@media(prefers-color-scheme:dark){:host:not(.light) .jex-widget:not(.light) .jex-widget-footer{background:#ffffff05}}.jex-branding{display:flex;align-items:center;gap:6px;text-decoration:none;color:var(--jex-text-muted);font-size:11px;font-weight:500;transition:color .2s}.jex-branding:hover{color:var(--jex-text-main)}.jex-branding-icon{color:var(--jex-primary)}.jex-branding span strong{font-weight:700;color:var(--jex-text-main)}.jex-privacy-notice-link,.jex-privacy-chip-link{color:var(--jex-primary);text-decoration:underline;text-underline-offset:2px;text-decoration-color:color-mix(in srgb,var(--jex-primary) 50%,transparent);transition:text-decoration-color .15s}.jex-privacy-notice-link:hover,.jex-privacy-chip-link:hover{text-decoration-color:var(--jex-primary)}.jex-privacy-chip{align-self:center;display:inline-flex;align-items:center;gap:6px;max-width:100%;margin:0;padding:5px 10px;border-radius:999px;background:color-mix(in srgb,var(--jex-primary) 10%,var(--jex-bg-window));color:var(--jex-primary);font-size:10px;font-weight:650;line-height:1.2}.jex-privacy-chip-icon{display:inline-flex;flex-shrink:0}.jex-privacy-chip-link{color:inherit;text-decoration:none}.jex-privacy-explicit{position:absolute;left:0;right:0;bottom:0;z-index:3;display:flex;flex-direction:column;gap:10px;min-height:100%;padding:10px 12px 12px;border:1px solid var(--jex-border-window);border-radius:14px 14px 10px 10px;background:var(--jex-bg-window);box-shadow:0 -12px 36px #0f172a24;pointer-events:auto}.jex-privacy-explicit-content{display:flex;align-items:flex-start;gap:10px}.jex-privacy-explicit-icon{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;border-radius:8px;background:color-mix(in srgb,var(--jex-primary) 10%,var(--jex-bg-window));color:var(--jex-primary);flex-shrink:0}.jex-privacy-explicit-copy{min-width:0;flex:1}.jex-privacy-explicit-title{color:var(--jex-text-main);font-size:12px;font-weight:750;line-height:1.2;margin-bottom:3px}.jex-privacy-explicit-body{margin:0;color:var(--jex-text-muted);font-size:10px;line-height:1.35}.jex-privacy-explicit-button{width:100%;border:none;border-radius:10px;background:var(--jex-bg-send-btn);color:var(--jex-text-header);cursor:pointer;font-family:inherit;font-size:12px;font-weight:750;padding:9px 12px;transition:background .15s ease,transform .12s ease}.jex-privacy-explicit-button:hover{background:var(--jex-primary-hover)}.jex-privacy-explicit-button:active{transform:scale(.98)}.jex-locale-select-wrapper{position:relative;display:flex;align-items:center}.jex-locale-select{appearance:none;-webkit-appearance:none;background:transparent;border:1px solid transparent;padding:4px 20px 4px 6px;border-radius:6px;font-family:inherit;font-size:11px;font-weight:600;color:var(--jex-text-muted);background-color:transparent;cursor:pointer;outline:none;transition:all .2s ease}.jex-locale-select option{background-color:#fff;color:#0f172a}.jex-locale-select:hover,.jex-locale-select:focus-visible{color:var(--jex-text-main);background:#0000000a}.jex-widget.dark .jex-locale-select:hover,.jex-widget.dark .jex-locale-select:focus-visible{background:#ffffff0d}.jex-widget.dark .jex-locale-select option{background-color:#0f172a;color:#f8fafc}@media(prefers-color-scheme:dark){:host:not(.light) .jex-widget:not(.light) .jex-locale-select:hover,:host:not(.light) .jex-widget:not(.light) .jex-locale-select:focus-visible{background:#ffffff0d}:host:not(.light) .jex-widget:not(.light) .jex-locale-select option{background-color:#0f172a;color:#f8fafc}}.jex-locale-select:focus-visible{border-color:var(--jex-primary)}.jex-locale-chevron{position:absolute;right:4px;pointer-events:none;color:var(--jex-text-muted);transition:color .2s ease}.jex-locale-select-wrapper:hover .jex-locale-chevron{color:var(--jex-text-main)}.jex-overlay{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;background:var(--jex-bg-window, #fff);z-index:10;padding:24px;text-align:center}.jex-loading-spinner{width:32px;height:32px;border:3px solid var(--jex-border-input, #e2e8f0);border-top-color:var(--jex-primary, #115A62);border-radius:50%;animation:jex-spin .7s linear infinite}@keyframes jex-spin{to{transform:rotate(360deg)}}.jex-loading-message{font-size:14px;color:var(--jex-text-muted, #64748b)}.jex-error-message{font-size:14px;color:var(--jex-text-main, #334155)}.jex-error-actions{display:flex;gap:8px}.jex-error-retry,.jex-error-back{padding:8px 16px;border-radius:8px;font-size:13px;font-weight:600;cursor:pointer;border:none}.jex-error-retry{background:var(--jex-primary, #115A62);color:#fff}.jex-error-back{background:transparent;color:var(--jex-text-muted, #64748b);border:1px solid var(--jex-border-input, #e2e8f0)}.jex-selection{display:flex;flex-direction:column;gap:12px;padding:24px 16px;height:100%}.jex-selection-title{font-size:16px;font-weight:700;color:var(--jex-text-main, #0f172a);margin:0 0 8px}.jex-selection-options{display:flex;flex-direction:column;gap:10px}.jex-selection-option{display:flex;flex-direction:column;align-items:flex-start;gap:2px;padding:16px;border-radius:12px;border:1px solid var(--jex-border-window, #e2e8f0);background:transparent;cursor:pointer;text-align:left;transition:border-color .15s ease,background .15s ease}.jex-selection-option:hover{border-color:var(--jex-primary, #115A62);background:color-mix(in srgb,var(--jex-primary, #115A62) 5%,transparent)}.jex-selection-icon{font-size:20px}.jex-selection-label{font-size:14px;font-weight:600;color:var(--jex-text-main, #0f172a)}.jex-selection-sub{font-size:12px;color:var(--jex-text-muted, #64748b)}.jex-form-screen{display:flex;flex-direction:column;padding:20px 16px;height:100%;overflow-y:auto}.jex-form-title{font-size:16px;font-weight:700;color:var(--jex-text-main, #0f172a);margin:0 0 16px}.jex-form{display:flex;flex-direction:column;gap:10px}.jex-form-input,.jex-form-textarea{padding:10px 12px;border-radius:8px;border:1px solid var(--jex-border-input, #e2e8f0);font-size:14px;background:transparent;color:var(--jex-text-main, #0f172a);outline:none}@media(pointer:coarse){.jex-form-input,.jex-form-textarea{font-size:16px}}.jex-form-input:focus,.jex-form-textarea:focus{border-color:var(--jex-primary, #115A62)}.jex-form-textarea{min-height:80px;resize:vertical}.jex-form-submit{padding:10px;border-radius:8px;border:none;background:var(--jex-primary, #115A62);color:#fff;font-size:14px;font-weight:600;cursor:pointer;margin-top:4px}.jex-inline-form{display:flex;flex-direction:column;gap:8px;padding:12px;background:var(--jex-bg-msg-bot, #f1f5f9);border:1px solid var(--jex-border-input, #e2e8f0);border-radius:var(--jex-radius, .75rem);width:100%}.jex-inline-form-title{font-weight:600;font-size:15px;color:var(--jex-text-main, #0f172a);margin:0}.jex-inline-form-subtitle{font-size:13px;color:var(--jex-text-muted, #64748b);line-height:1.4;margin:0 0 4px}.jex-inline-form-consent{font-size:11px;color:var(--jex-text-muted, #64748b);line-height:1.3;margin-top:4px;text-align:center}.jex-inline-form .jex-form-submit:disabled{opacity:.7;cursor:not-allowed}.jex-escalation-subtitle{font-size:13px;color:var(--jex-text-muted, #64748b);line-height:1.45;margin:0 0 8px}.jex-escalation-skip{padding:8px 12px;border:none;background:transparent;color:var(--jex-text-muted, #64748b);font-size:13px;cursor:pointer;text-decoration:underline;text-underline-offset:2px;text-align:center}.jex-escalation-skip:hover{color:var(--jex-text-main, #0f172a)}.jex-inline-form-card{position:relative;padding:14px;gap:8px}.jex-inline-form-dismiss{position:absolute;top:10px;right:10px;width:24px;height:24px;border-radius:50%;border:1px solid var(--jex-border-input, #e2e8f0);background:var(--jex-bg-window, #fff);color:var(--jex-text-muted, #64748b);font-size:12px;cursor:pointer;display:flex;align-items:center;justify-content:center;line-height:1}.jex-inline-form-dismiss:hover{background:var(--jex-bg-msg-bot, #f1f5f9);color:var(--jex-text-main, #0f172a)}.jex-inline-form-submitted{display:flex;align-items:center;gap:10px;padding:10px 12px;background:var(--jex-bg-msg-bot, #f1f5f9);border:1px solid var(--jex-border-input, #e2e8f0);border-radius:var(--jex-radius, .75rem);width:100%}.jex-inline-form-check{display:flex;align-items:center;justify-content:center;width:24px;height:24px;border-radius:50%;background:color-mix(in srgb,var(--jex-primary) 15%,transparent);color:var(--jex-primary, #115A62);font-size:14px;font-weight:700;flex-shrink:0}.jex-inline-form-submitted-title{font-weight:600;font-size:var(--jex-font-size, 14px);color:var(--jex-text-main, #0f172a)}.jex-inline-form-submitted-detail{font-size:12px;color:var(--jex-text-muted, #64748b);margin-top:2px}.jex-magicline-row{display:flex;flex-direction:column;gap:8px}.jex-magicline-row>*{min-width:0}.jex-magicline-field{display:flex;flex-direction:column;gap:4px}.jex-magicline-field-label{font-size:12px;font-weight:500;color:var(--jex-text-muted, #64748b)}.jex-magicline-select{width:100%;appearance:none;cursor:pointer;padding-right:32px;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 10px center;background-size:16px 16px}.jex-magicline-slots-hint{font-size:12px;color:var(--jex-text-muted, #64748b);line-height:1.4;padding:2px 0}.jex-magicline-consent{display:flex;align-items:flex-start;gap:8px;font-size:11px;line-height:1.35;color:var(--jex-text-muted, #64748b);margin-top:2px;cursor:pointer}.jex-magicline-consent input[type=checkbox]{flex-shrink:0;margin-top:1px;accent-color:var(--jex-primary, #115A62)}.jex-magicline-error{font-size:12px;color:#dc2626;line-height:1.35}.jex-magicline-failed{border-color:color-mix(in srgb,#dc2626 35%,var(--jex-border-input, #e2e8f0))}.jex-magicline-failed-icon{background:color-mix(in srgb,#dc2626 15%,transparent);color:#dc2626}.jex-magicline-wizard-header{display:flex;flex-direction:column;gap:6px}.jex-magicline-wizard-progress{display:flex;align-items:baseline;justify-content:space-between;gap:8px}.jex-magicline-wizard-step-label{font-size:13px;font-weight:600;color:var(--jex-text-main, #0f172a)}.jex-magicline-wizard-counter{font-size:11px;color:var(--jex-text-muted, #64748b);flex-shrink:0}.jex-magicline-wizard-dots{display:flex;gap:6px}.jex-magicline-wizard-dot{width:7px;height:7px;border-radius:50%;background:color-mix(in srgb,var(--jex-text-muted, #64748b) 35%,transparent)}.jex-magicline-wizard-dot-active{background:var(--jex-primary, #115A62)}.jex-magicline-wizard-nav{display:flex;align-items:center;gap:8px;margin-top:4px}.jex-magicline-wizard-next{flex:1;margin-top:0}.jex-magicline-wizard-back{padding:10px 14px;border-radius:8px;border:1px solid var(--jex-border-input, #e2e8f0);background:transparent;color:var(--jex-text-main, #0f172a);font-size:14px;font-weight:600;cursor:pointer}.jex-magicline-wizard-back:hover{background:var(--jex-bg-window, #fff)}.jex-magicline-wizard-back:disabled,.jex-magicline-wizard-next:disabled{opacity:.7;cursor:not-allowed}.jex-magicline-radio-group{display:flex;flex-direction:column;gap:8px}.jex-magicline-radio-card{display:flex;align-items:center;gap:10px;padding:12px;border-radius:10px;border:1px solid var(--jex-border-input, #e2e8f0);font-size:14px;color:var(--jex-text-main, #0f172a);cursor:pointer}.jex-magicline-radio-card-active{border-color:var(--jex-primary, #115A62);background:color-mix(in srgb,var(--jex-primary, #115A62) 8%,transparent)}.jex-magicline-radio-card input[type=radio]{flex-shrink:0;accent-color:var(--jex-primary, #115A62)}.jex-magicline-slots-error{display:flex;flex-direction:column;gap:6px}.jex-magicline-retry{align-self:flex-start;padding:6px 12px;border-radius:8px;border:1px solid var(--jex-border-input, #e2e8f0);background:transparent;color:var(--jex-text-main, #0f172a);font-size:13px;font-weight:600;cursor:pointer}.jex-magicline-retry:hover{background:var(--jex-bg-window, #fff)}.jex-magicline-retry:disabled{opacity:.7;cursor:not-allowed}.jex-magicline-voucher-section{display:flex;flex-direction:column;gap:6px;margin-top:4px}.jex-magicline-voucher-field{flex-direction:row;align-items:stretch;gap:8px}.jex-magicline-voucher-field .jex-form-input{flex:1;min-width:0}.jex-magicline-voucher-apply{flex:0 0 auto;padding:10px 16px;border-radius:8px;border:none;background:var(--jex-primary, #115A62);color:#fff;font-size:14px;font-weight:600;cursor:pointer;white-space:nowrap}.jex-magicline-voucher-apply:hover{background:var(--jex-primary-hover)}.jex-magicline-voucher-apply:disabled{opacity:.7;cursor:not-allowed}.jex-magicline-review-wrap{position:relative}.jex-magicline-review-body{display:flex;flex-direction:column;gap:10px;transition:opacity .15s ease}.jex-magicline-review-body--reloading{opacity:.5;pointer-events:none}.jex-magicline-review-overlay{position:absolute;inset:0;display:flex;align-items:flex-start;justify-content:center;padding-top:48px}.jex-magicline-review-spinner{width:28px;height:28px;border-radius:50%;border:3px solid color-mix(in srgb,var(--jex-primary, #115A62) 25%,transparent);border-top-color:var(--jex-primary, #115A62);animation:jex-magicline-spin .7s linear infinite}@keyframes jex-magicline-spin{to{transform:rotate(360deg)}}.jex-magicline-voucher-discount-row dt,.jex-magicline-voucher-remarks-row dt{flex-shrink:1;min-width:0}.jex-magicline-voucher-remarks-row dd{min-width:0;overflow-wrap:anywhere;word-break:break-word}.jex-magicline-summary{display:flex;flex-direction:column;gap:6px;margin:0;padding:10px 12px;border-radius:8px;background:var(--jex-bg-window, #fff);border:1px solid var(--jex-border-input, #e2e8f0)}.jex-magicline-summary-row{display:flex;align-items:baseline;justify-content:space-between;gap:12px}.jex-magicline-summary-row dt{font-size:12px;color:var(--jex-text-muted, #64748b);flex-shrink:0}.jex-magicline-summary-row dd{margin:0;font-size:13px;font-weight:500;color:var(--jex-text-main, #0f172a);text-align:right;min-width:0}.jex-magicline-summary-section{margin-top:8px}.jex-magicline-summary-heading{font-size:12px;font-weight:600;color:var(--jex-text-main, #0f172a);margin-bottom:2px}.jex-magicline-summary-totals{background:color-mix(in srgb,var(--jex-primary, #115A62) 6%,transparent);border-color:color-mix(in srgb,var(--jex-primary, #115A62) 25%,transparent)}.jex-magicline-summary-total-row dt,.jex-magicline-summary-total-row dd{font-size:14px;font-weight:700;color:var(--jex-text-main, #0f172a)}.jex-magicline-summary-total-row dt{flex-shrink:1;min-width:0}.jex-magicline-summary-total-row dd{flex-shrink:0;white-space:nowrap;overflow-wrap:normal}.jex-magicline-offer-group{display:flex;flex-direction:column;gap:8px}.jex-magicline-offer-bundle-name{font-size:13px;font-weight:600;color:var(--jex-text-main, #0f172a)}.jex-magicline-offer-bundle-desc{font-size:12px;color:var(--jex-text-muted, #64748b)}.jex-magicline-radio-card .jex-magicline-offer-term{display:flex;flex-direction:column;gap:4px;flex:1}.jex-magicline-offer-term-head{display:flex;align-items:baseline;justify-content:space-between;gap:8px}.jex-magicline-offer-term-length{font-size:14px;font-weight:600;color:var(--jex-text-main, #0f172a)}.jex-magicline-offer-term-price{font-size:13px;font-weight:500;color:var(--jex-primary, #115A62)}.jex-magicline-offer-term-note{font-size:12px;color:var(--jex-text-muted, #64748b)}.jex-magicline-static-value{padding:9px 12px;border-radius:8px;font-size:14px;color:var(--jex-text-main, #0f172a);background:var(--jex-bg-window, #f8fafc);border:1px solid var(--jex-border-input, #e2e8f0)}.jex-magicline-terms{display:flex;flex-direction:column;gap:10px;padding:10px 12px;border-radius:8px;background:var(--jex-bg-window, #fff);border:1px solid var(--jex-border-input, #e2e8f0)}.jex-magicline-upgrades-recap-title,.jex-magicline-terms-title{font-size:12px;font-weight:600;color:var(--jex-text-main, #0f172a);margin-bottom:2px}.jex-magicline-terms-content{font-size:12px;line-height:1.5;color:var(--jex-text-muted, #64748b);white-space:pre-wrap}.jex-magicline-upgrade-group{display:flex;flex-direction:column;gap:8px}.jex-magicline-upgrade-card{display:flex;flex-direction:column;gap:6px;padding:12px;border-radius:10px;border:1px solid var(--jex-border-input, #e2e8f0);font-size:14px;color:var(--jex-text-main, #0f172a);cursor:pointer}.jex-magicline-upgrade-card-active{border-color:var(--jex-primary, #115A62);background:color-mix(in srgb,var(--jex-primary, #115A62) 8%,transparent)}.jex-magicline-upgrade-head{display:flex;align-items:flex-start;justify-content:space-between;gap:8px;cursor:pointer}.jex-magicline-upgrade-info{display:flex;flex-direction:column;gap:2px;flex:1}.jex-magicline-upgrade-name{font-size:14px;font-weight:600;color:var(--jex-text-main, #0f172a)}.jex-magicline-upgrade-desc{font-size:12px;color:var(--jex-text-muted, #64748b)}.jex-magicline-upgrade-price{font-size:13px;font-weight:500;color:var(--jex-primary, #115A62)}.jex-magicline-upgrade-status{flex-shrink:0;font-size:11px;font-weight:600;padding:2px 7px;border-radius:6px;border:1px solid var(--jex-border-input, #e2e8f0);color:var(--jex-text-muted, #64748b);background:transparent;white-space:nowrap}.jex-magicline-upgrade-card-active .jex-magicline-upgrade-status{border-color:var(--jex-primary, #115A62);color:var(--jex-primary, #115A62);background:color-mix(in srgb,var(--jex-primary, #115A62) 12%,transparent)}.jex-magicline-terms-prompt{font-size:13px;font-weight:600;color:var(--jex-text-main, #0f172a);margin-bottom:4px}.jex-magicline-bundle-details{font-size:12px;color:var(--jex-text-muted, #64748b)}.jex-magicline-bundle-details-summary{cursor:pointer;font-size:12px;font-weight:600;color:var(--jex-primary, #115A62);list-style-position:inside}.jex-magicline-bundle-details-summary:hover{text-decoration:underline}.jex-magicline-bundle-details-body{display:flex;flex-direction:column;gap:6px;margin-top:6px}.jex-magicline-bundle-details-list{margin:0;padding-left:18px;display:flex;flex-direction:column;gap:2px;line-height:1.4}.jex-magicline-bundle-details-footnote{margin:0;line-height:1.4}.jex-magicline-consent-region{display:flex;flex-direction:column;gap:4px;margin-top:6px;padding:6px 8px;border-left:3px solid var(--jex-primary, #115A62);border-radius:6px;background:color-mix(in srgb,var(--jex-primary, #115A62) 6%,transparent)}.jex-magicline-required-pill{display:inline-block;margin-left:6px;padding:1px 6px;border-radius:999px;font-size:9px;font-weight:700;letter-spacing:.04em;text-transform:uppercase;color:var(--jex-primary, #115A62);background:color-mix(in srgb,var(--jex-primary, #115A62) 12%,transparent);vertical-align:middle}.jex-magicline-consent-body{display:flex;flex-direction:column;gap:1px}.jex-magicline-consent-recap{display:flex;flex-direction:column;gap:2px}.jex-escalation-confirm{border-left:3px solid var(--jex-primary, #115A62);padding-left:8px}.jex-session-prompt{display:flex;flex-direction:column;align-items:center;gap:8px;padding:12px 16px;margin:8px 0;text-align:center}.jex-session-prompt-text{font-size:13px;color:var(--jex-text-muted, #64748b)}.jex-session-prompt-btn{padding:8px 16px;border-radius:8px;border:1px solid var(--jex-primary, #115A62);background:transparent;color:var(--jex-primary, #115A62);font-size:13px;font-weight:600;cursor:pointer}.jex-session-prompt-btn:hover{background:color-mix(in srgb,var(--jex-primary) 10%,transparent)}.jex-chat-input-resolved{display:flex;flex-direction:column;align-items:center;gap:10px;padding:14px 16px;border-top:1px solid var(--jex-border-input, #e2e8f0);background:var(--jex-bg-msg-bot, #f1f5f9);text-align:center}.jex-resolved-notice{font-size:13px;font-weight:500;color:var(--jex-text-muted, #64748b)}.jex-resolved-new-btn{padding:10px 20px;border-radius:8px;border:none;background:var(--jex-primary, #115A62);color:#fff;font-size:13px;font-weight:600;cursor:pointer;width:100%}.jex-resolved-new-btn:hover{opacity:.9}.jex-confirmation{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;padding:32px 24px;height:100%;text-align:center}.jex-confirmation-icon{width:48px;height:48px;border-radius:50%;background:color-mix(in srgb,var(--jex-primary, #115A62) 15%,transparent);color:var(--jex-primary, #115A62);font-size:22px;display:flex;align-items:center;justify-content:center}.jex-confirmation-title{font-size:18px;font-weight:700;color:var(--jex-text-main, #0f172a);margin:0}.jex-confirmation-body{font-size:13px;color:var(--jex-text-muted, #64748b);margin:0}.jex-confirmation-ref{font-size:20px;font-weight:700;letter-spacing:.05em;color:var(--jex-primary, #115A62);background:color-mix(in srgb,var(--jex-primary, #115A62) 10%,transparent);padding:10px 20px;border-radius:10px}.jex-confirmation-hint{font-size:12px;color:var(--jex-text-muted, #64748b);margin:0}.jex-confirmation-done{margin-top:8px;padding:10px 28px;border-radius:8px;border:none;background:var(--jex-primary, #115A62);color:#fff;font-size:14px;font-weight:600;cursor:pointer}.jex-home-lookup-link{background:none;border:none;font-size:12px;color:var(--jex-text-muted, #64748b);cursor:pointer;text-decoration:underline;padding:0;align-self:center}.jex-home-lookup{display:flex;gap:8px;width:100%;animation:jexFadeIn .4s .1s ease both}.jex-home-lookup-input{flex:1;padding:10px 14px;border-radius:10px;border:1px solid var(--jex-border-input, #e2e8f0);background:var(--jex-bg-input);color:var(--jex-text-main);font-size:14px;font-family:ui-monospace,Cascadia Code,Fira Code,monospace;letter-spacing:.04em;outline:none;transition:border-color .2s}@media(pointer:coarse){.jex-home-lookup-input{font-size:16px}}.jex-home-lookup-input::placeholder{font-family:inherit;letter-spacing:.04em;color:var(--jex-text-muted);opacity:.7}.jex-home-lookup-input:focus{border-color:var(--jex-primary, #115A62)}.jex-home-lookup-submit{padding:10px 16px;border-radius:10px;border:none;background:var(--jex-primary, #115A62);color:#fff;font-size:13px;font-weight:600;cursor:pointer;font-family:inherit;transition:background .2s,opacity .2s;flex-shrink:0}.jex-home-lookup-submit:hover:not(:disabled){background:var(--jex-primary-hover)}.jex-home-lookup-submit:disabled{opacity:.4;cursor:default}.jex-sources-row{margin-top:6px;margin-left:32px;display:flex;flex-direction:column;gap:6px}.jex-sources-toggle{display:inline-flex;align-items:center;gap:4px;padding:2px 8px;background:transparent;border:none;border-radius:6px;cursor:pointer;font-size:11px;color:var(--jex-text-muted, #6b7280);font-family:inherit;align-self:flex-start;transition:background .15s,color .15s}.jex-sources-toggle:hover{background:#0000000a;color:inherit}.jex-sources-icon{font-size:12px;line-height:1}.jex-sources-chevron{display:inline-block;font-size:10px;transition:transform .15s}.jex-sources-chevron--open{transform:rotate(180deg)}.jex-sources-pills{display:flex;flex-wrap:wrap;align-items:center;gap:6px}.jex-source-pill{display:inline-flex;align-items:center;gap:6px;max-width:240px;padding:2px 8px;border-radius:999px;border:1px solid rgba(0,0,0,.1);background:#0000000a;color:var(--jex-text-muted, #6b7280);font-size:11px;text-decoration:none;cursor:pointer;transition:background .15s,color .15s}.jex-source-pill:hover{background:#00000014;color:inherit}.jex-source-id{display:inline-flex;align-items:center;justify-content:center;min-width:16px;height:16px;padding:0 4px;border-radius:4px;background:var(--jex-primary, #115A62);color:#fff;font-size:10px;font-weight:600;line-height:1;flex-shrink:0;font-variant-numeric:tabular-nums}.jex-source-type{font-size:10px;flex-shrink:0}.jex-source-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:500}.jex-source-score{opacity:.6;flex-shrink:0;font-variant-numeric:tabular-nums}.jex-starter-chips{display:flex;flex-wrap:wrap;gap:8px;margin:4px 0}.jex-starter-chip{display:inline-flex;align-items:center;border-radius:999px;padding:7px 13px;background:var(--jex-bg-window);border:1px solid var(--jex-border-input);color:var(--jex-primary);text-align:left;font-size:13.5px;font-weight:500;line-height:1.2;cursor:pointer;transition:background .15s,border-color .15s,opacity .15s}.jex-starter-chip:hover:not(:disabled){background:color-mix(in srgb,var(--jex-primary) 8%,var(--jex-bg-window));border-color:var(--jex-primary)}.jex-starter-chip:disabled{opacity:.5;cursor:default}.jex-presence-dot{position:absolute;top:2px;right:2px;width:8px;height:8px;border-radius:999px;box-shadow:0 0 0 2px var(--jex-bg-header, #115A62)}.jex-presence-dot--online{background:#10b981}.jex-presence-dot--away{background:#fbbf24}.jex-presence-dot--offline{background:#9ca3af}@keyframes jex-ripple-expand{0%{transform:scale(1);opacity:.6}to{transform:scale(2.6);opacity:0}}.jex-waiting-card{display:flex;align-items:flex-start;gap:12px;padding:12px 14px;margin:0 12px 8px;background:var(--jex-bg-msg-bot, #f1f5f9);border:1px solid var(--jex-border-input, #e2e8f0);border-radius:var(--jex-radius, .75rem)}.jex-waiting-indicator{position:relative;flex-shrink:0;width:20px;height:20px;margin-top:2px;display:flex;align-items:center;justify-content:center}.jex-waiting-dot{position:relative;z-index:1;width:8px;height:8px;border-radius:50%;background:var(--jex-primary, #115A62)}.jex-waiting-ripple{position:absolute;inset:0;width:8px;height:8px;margin:auto;border-radius:50%;background:var(--jex-primary, #115A62);animation:jex-ripple-expand 1.6s ease-out infinite}@media(prefers-reduced-motion:reduce){.jex-waiting-ripple{animation:none}}.jex-waiting-body{display:flex;flex-direction:column;gap:4px;min-width:0}.jex-waiting-title{font-weight:600;font-size:14px;color:var(--jex-text-main, #0f172a);line-height:1.3}.jex-waiting-subtitle{font-size:12px;color:var(--jex-text-muted, #64748b);line-height:1.4}.jex-waiting-leave-email{margin-top:6px;padding:0;border:none;background:transparent;color:var(--jex-primary, #115A62);font-size:12px;font-family:inherit;text-decoration:underline;text-underline-offset:2px;cursor:pointer;text-align:left}.jex-waiting-leave-email:hover{opacity:.8}`;function ix(t){const e=document.createElement("style");e.textContent=rx,t.appendChild(e)}const ox=Fd,ax="https://festive-mouse-978.eu-west-1.convex.cloud";let Po=null;function sx(t){const e=t??ax;if(!e)throw new Error("[jexity] No Convex URL — set VITE_CONVEX_URL at build time or data-convex-url on the script tag");return Po||(Po=new qd(ah(e))),Po}function lx(t,e){const n=t.shadowRoot??t.attachShadow({mode:"open"});for(;n.firstChild;)n.removeChild(n.firstChild);ix(n),Lr.value=e.source,Et.value=e.bootstrapToken,Fe.value=[{id:"home"}],e.mode==="embedded"&&(t.classList.add("jex-mode-embedded"),ue.value=!0);const r=document.createElement("div");return e.mode==="embedded"&&(r.style.cssText="width:100%;height:100%"),n.appendChild(r),Ut(s(ox,{client:sx(e.convexUrl),children:s(tx,{options:e})}),r),function(){Ut(null,r),ue.value=!1,Lr.value=void 0,Et.value=void 0,Fe.value=[{id:"home"}]}}function cx(t,e,n){const r=lx(t,e),i=new Set,o=ue.subscribe(l=>{for(const c of i)c(l)});return{shutdown(){o(),i.clear(),r(),n&&n()},open(){ue.value=!0},close(){ue.value=!1},toggle(){ue.value=!ue.value},get isOpen(){return ue.value},subscribe(l){return i.add(l),()=>{i.delete(l)}}}}let sr=null;function ux(t){sr&&sr.shutdown();let e;t.container?e=typeof t.container=="string"?document.querySelector(t.container):t.container:(e=document.createElement("div"),e.id="jexity-chat-widget",document.body.appendChild(e));const n=cx(e,t,()=>{t.container||e.remove(),sr===n&&(sr=null)});return sr=n,n}function Dt(t,e){return t.getAttribute(e)??void 0}function xc(t,e){const n=t.getAttribute(e);if(!n)return;const r=parseInt(n,10);return Number.isNaN(r)?void 0:r}async function bc(){const t=document.currentScript??document.querySelector("script[data-org-slug]")??document.querySelector("script[data-org-id]");if(!t)return;const e=t.getAttribute("data-org-slug")??t.getAttribute("data-org-id")??"default-org",n=t.getAttribute("data-proj-slug")??void 0,r=Dt(t,"data-convex-url")??"https://festive-mouse-978.eu-west-1.convex.cloud"??"",i=Qi(r),o=await Gi(e,i,n);if(!o.ok){const l=window.location.origin,c=n?`project '${e}/${n}'`:`org '${e}'`;o.error==="unauthorized"?X.warn(`[JexityChat] This domain is not authorized for ${c}. Add '${l}' under Allowed Domains in your Jexity dashboard.`):o.error==="not_found"?X.warn(`[JexityChat] No active widget config found for ${c}. Check that the org slug is correct and the widget is enabled.`):o.error==="rate_limited"?X.warn(`[JexityChat] Bootstrap rate-limited for ${c}. Retry after ${o.retryAfterSec??60}s.`):X.warn(`[JexityChat] Bootstrap failed (network error). Check that the Convex deployment is reachable at ${i}.`);return}if(o.allowedUrls.length>0&&!o.allowedUrls.some(l=>Ki(window.location.href,l))){const l=n?`project '${e}/${n}'`:`org '${e}'`;X.warn(`[JexityChat] Widget hidden for ${l} — current page does not match path rule. Allowed: ${o.allowedUrls.join(", ")}`);return}const a={orgSlug:e,projSlug:n,bootstrapToken:o.token,allowedUrls:o.allowedUrls,excludePaths:o.excludePaths,maintenance:o.maintenance,position:Dt(t,"data-position")??void 0,theme:Dt(t,"data-theme")??void 0,greeting:Dt(t,"data-greeting"),title:Dt(t,"data-title"),primaryColor:Dt(t,"data-primary-color"),locale:Dt(t,"data-locale"),convexUrl:Dt(t,"data-convex-url"),triggerOffsetX:xc(t,"data-trigger-offset-x"),triggerOffsetY:xc(t,"data-trigger-offset-y")};window.JexityChat=ux(a)}document.readyState==="complete"?bc():window.addEventListener("load",bc)})();
81
+ `).trim()}}).filter(e=>(e.title!==""||e.body!=="")&&!/^-{3,}$/.test(e.title))}function bg(t){const e=xg(t);return e.length===0?"":`<div class="jex-card-grid">${e.map(r=>{const i=r.title?`<div class="jex-card-title">${ee.parseInline(r.title)}</div>`:"",o=r.body?ee.parse(r.body):"";return`<div class="jex-card">${i}${o}</div>`}).join("")}</div>`}ee.setOptions({breaks:!0,gfm:!0});function di(t){return t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}ee.use({renderer:{code(t){return t.lang==="cards"&&t.raw.trimEnd().endsWith("```")?bg(t.text):!1},image(t){const e=t.href??"",n=`<img src="${di(e)}" alt="${di(t.text??"")}"`+(t.title?` title="${di(t.title)}"`:"")+' loading="lazy" />';return/^https?:\/\//i.test(e)?`<a href="${di(e)}" class="jex-md-img-link">${n}</a>`:n}}});const gr=typeof window<"u"?gg:null;gr&&typeof gr.addHook=="function"&&gr.addHook("afterSanitizeAttributes",t=>{t.tagName==="A"&&t.hasAttribute("href")&&(t.setAttribute("target","_blank"),t.setAttribute("rel","noopener noreferrer"))});function vg(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function yg(t){if(!t)return"";if(!gr)return vg(t);const e=ee.parse(t),n=typeof e=="string"?e:"";return gr.sanitize(n)}function wg({text:t}){const e=_e(()=>yg(t),[t]);return s("div",{class:"jex-md",dangerouslySetInnerHTML:{__html:e}})}function Ac({onQuote:t}){const e=L();return s("button",{type:"button",class:"jex-quote-btn","aria-label":e.quoteMessage,title:e.quoteMessage,onClick:t,children:s(Co,{size:12})})}function kg(t,e,n){return t.role==="user"?n:t.authorName??e??""}function _g({authorLabel:t,content:e,onClick:n}){return s("button",{type:"button",class:"jex-quoted-chip",onClick:n,children:[s(Co,{size:11}),s("span",{class:"jex-quoted-chip-text",children:[t&&s("span",{class:"jex-quoted-chip-author",children:[t,": "]}),El(e)]})]})}function Rc({quotes:t,botName:e,yourMessageLabel:n,onQuotedClick:r}){return t.length===0?null:s("div",{class:"jex-quoted-list",children:t.map(i=>s(_g,{authorLabel:kg(i,e,n),content:i.content,onClick:r?o=>{r(i.id,o)}:void 0},i.id))})}function jg(t){const e=t.trim().split(/\s+/).filter(Boolean);return e.length===0?"?":e.map(n=>n[0]).join("").slice(0,2).toUpperCase()}function on({text:t,streaming:e,error:n,authorId:r,authorName:i,authorImage:o,botAvatarUrl:a,botName:l,onQuote:c,id:u,quoted:d,onQuotedClick:m}){const f=L(),p=!!r,[x,v]=$(!1),k=re(()=>v(!0),[]),w=p?i??"":l??"",b=["jex-message bot",n?"jex-message-error":""].filter(Boolean).join(" ");return s("div",{class:"jex-message-row bot",children:[s("div",{class:"jex-message-head",children:[s("div",{class:`jex-avatar ${p?"jex-avatar-agent":"jex-avatar-bot"}`,children:p&&o&&!x?s("img",{src:o,alt:i??"",class:"jex-avatar-img",onError:k}):p?s("span",{class:"jex-avatar-initials",children:jg(i??"")}):a&&!x?s("img",{src:a,alt:"",class:"jex-avatar-img",onError:k}):s(Jr,{size:14})}),w&&s("span",{class:"jex-message-author",children:w})]}),s("div",{class:b,id:u,children:[s(Rc,{quotes:d??[],botName:l,yourMessageLabel:f.quotedYourMessage,onQuotedClick:m}),s(wg,{text:t}),e&&s("span",{class:"jex-streaming-cursor"}),c&&s(Ac,{onQuote:c})]})]})}function Sg({questions:t,disabled:e,onPick:n}){return t.length===0?null:s("div",{class:"jex-starter-chips",children:t.map(r=>s("button",{type:"button",class:"jex-starter-chip",disabled:e,onClick:()=>{n(r)},children:r},r))})}function Tg(t,e){const n=[...new Set(e.flatMap(c=>c.split(/\s+/)).filter(c=>c.length>1))];if(n.length===0)return[t];const r=n.map(c=>c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),i=new RegExp(`@(?:${r.join("|")})\\b`,"gi"),o=[];let a=0,l;for(;(l=i.exec(t))!==null;)l.index>a&&o.push(t.slice(a,l.index)),o.push(s("span",{class:"jex-mention",children:l[0]},l.index)),a=l.index+l[0].length;return a<t.length&&o.push(t.slice(a)),o}function Cg({text:t,id:e,onQuote:n,botName:r,quoted:i,onQuotedClick:o,agentNames:a}){const l=L();return s("div",{class:"jex-message user",id:e,children:[s(Rc,{quotes:i??[],botName:r,yourMessageLabel:l.quotedYourMessage,onQuotedClick:o}),Tg(t,a??[]),n&&s(Ac,{onQuote:n})]})}function Ec(){const t=xt(se.escalations.public.submitEscalation);return async e=>{try{return await t({...e,...lr()})}catch(n){throw Mo(n)&&Po(),n}}}function Ic(){const t=xt(se.escalations.public.markEscalationWaiting);return e=>{sr.value=e,t({sessionId:e.sessionId,visitorId:e.visitorId}).catch(n=>{J.error("[waiting] markEscalationWaiting failed:",n)})}}function hi(){const t=xt(se.analytics.formEvents.recordFormClick);return e=>{t(e).catch(n=>{J.warn("[useFormClick] click not recorded:",n)})}}function Mc(t,e){return gt(se.escalations.public.getSignedInContact,{sessionId:t,visitorId:e,...lr()})}function Ag({message:t,sessionId:e,visitorId:n,waitingSetAt:r}){const i=L();return t.formData?s("div",{class:"jex-inline-form-submitted",children:[s("span",{class:"jex-inline-form-check",children:"✓"}),s("div",{children:[s("div",{class:"jex-inline-form-submitted-title",children:i.escalationSubmitted}),s("div",{class:"jex-inline-form-submitted-detail",children:[t.formData.visitorName," · ",t.formData.visitorEmail]})]})]}):s("div",{class:"jex-message-row bot",children:s(Rg,{messageId:t._id,sessionId:e,visitorId:n,waitingSetAt:r})})}function Rg({messageId:t,sessionId:e,visitorId:n,waitingSetAt:r}){const i=L(),[o,a]=$(""),[l,c]=$(""),u=Mc(e,n),d=u?.name??o,m=u?.email??l,[f,p]=$(!1),x=tr.value,v=/^https?:\/\//i.test(x)?x:er,k=Ec(),w=Ic(),b=hi();async function I(C){if(C.preventDefault(),!f){p(!0);try{await k({sessionId:e,visitorId:n,formMessageId:t,visitorName:d.trim(),visitorEmail:m.trim(),locale:Qe.value})}catch(E){J.error("[FormMessage] Submit failed:",E),p(!1)}}}return s("div",{class:"jex-inline-form",children:[s("div",{class:"jex-inline-form-title",children:i.escalationFormTitle}),u&&s("div",{class:"jex-inline-form-consent",children:i.escalationFromAccount}),s("form",{class:"jex-form",onSubmit:C=>{I(C)},children:[s("input",{class:"jex-form-input",type:"text",placeholder:i.escalationNameLabel,value:d,required:!0,readOnly:!!u,disabled:f,onInput:C=>{a(C.currentTarget.value)}}),s("input",{class:"jex-form-input",type:"email",placeholder:i.escalationEmailLabel,value:m,required:!0,readOnly:!!u,disabled:f,onInput:C=>{c(C.currentTarget.value)}}),s("button",{class:"jex-form-submit",type:"submit",disabled:f,onClick:()=>{b({sessionId:e,visitorId:n,formMessageId:t})},children:f?i.escalationSubmitting:i.escalationSubmit})]}),s("button",{type:"button",class:"jex-escalation-skip",onClick:()=>{w({formMessageId:t,sessionId:e,visitorId:n,waitingSetAt:r})},children:i.escalationSkip}),s("div",{class:"jex-inline-form-consent",children:[i.escalationConsent," ",s("a",{href:v,target:"_blank",rel:"noopener noreferrer",class:"jex-privacy-notice-link",children:i.escalationPrivacyLinkText}),"."]})]})}function Eg(){return xt(se.functions.magicline.public.submitForm)}function Ig(){return Jt(se.functions.magicline.actions.getTrialConfig)}function Mg(){return Jt(se.functions.magicline.actions.listTrialSlots)}function Pg(){return Jt(se.functions.magicline.actions.getRateBundles)}function Pc(){return Jt(se.functions.magicline.actions.getContractPreview)}function Ng(){return Jt(se.functions.magicline.actions.submitContractCreation)}const ta={en:po,de:mo},Og=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function Nc(t){return Og.test(t.trim())}function Lg(t,e=new Date){const n=t.trim();if(n==="")return null;const r=n.split("-");if(r.length!==3)return null;const i=Number(r[0]),o=Number(r[1]),a=Number(r[2]);if(!Number.isInteger(i)||!Number.isInteger(o)||!Number.isInteger(a)||o<1||o>12||a<1||a>31)return null;let l=e.getFullYear()-i;const c=e.getMonth()+1-o;return(c<0||c===0&&e.getDate()<a)&&(l-=1),l}function Oc(t=new Date){const e=t.getFullYear(),n=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0");return`${e}-${n}-${r}`}function Lc(){const t=tr.value;return/^https?:\/\//i.test(t)?t:er}const $g={DE:22,AT:20,CH:21,GB:22,FR:27,NL:18,BE:16,ES:24,IT:27,PL:28,SE:24,NO:15,DK:18,FI:18,PT:25},Dg=15,zg=34;function $c(t){return t.replace(/\s+/g,"").toUpperCase()}function qg(t){const e=$c(t),n=e.slice(0,2),r=$g[n];if(r!==void 0){if(e.length!==r)return!1}else if(e.length<Dg||e.length>zg)return!1;const i=e.slice(4)+e.slice(0,4);let o="";for(const l of i){const c=l.charCodeAt(0);if(c>=65&&c<=90)o+=String(c-55);else if(c>=48&&c<=57)o+=l;else return!1}let a=0;for(let l=0;l<o.length;l+=9){const c=String(a)+o.slice(l,l+9);a=Number(c)%97}return a===1}function Fg(t){const e=$c(t);if(e.length<=8)return e;const n=e.slice(0,4),r=e.slice(-4);return(n+"•".repeat(e.length-8)+r).replace(/(.{4})/g,"$1 ").trim()}function at(t,e,n){const r=n==="de"?"de-DE":"en-GB";try{return new Intl.NumberFormat(r,{style:"currency",currency:e}).format(t)}catch{return`${t.toFixed(2)} ${e}`}}function fi(t,e,n){const r=t!==1,o={DAY:{en:["day","days"],de:["Tag","Tage"]},WEEK:{en:["week","weeks"],de:["Woche","Wochen"]},MONTH:{en:["month","months"],de:["Monat","Monate"]},YEAR:{en:["year","years"],de:["Jahr","Jahre"]}}[e.toUpperCase()];if(!o)return`${t} ${e.toLowerCase()}`;const[a,l]=o[n];return`${t} ${r?l:a}`}function Bg(t,e){const n=t.trim();if(n==="")return"—";const r=e==="de"?"de-DE":"en-GB",i=new Date(n);return Number.isNaN(i.getTime())?t:i.toLocaleDateString(r,{day:"2-digit",month:"long",year:"numeric"})}function na(t,e,n){const r=ta[n],i=e.toUpperCase();if(t===1)return{DAY:r.magiclineFreqPerDay,WEEK:r.magiclineFreqPerWeek,MONTH:r.magiclineFreqPerMonth,YEAR:r.magiclineFreqPerYear}[i]??e.toLowerCase();const a={DAY:r.magiclineFreqEveryDays,WEEK:r.magiclineFreqEveryWeeks,MONTH:r.magiclineFreqEveryMonths,YEAR:r.magiclineFreqEveryYears}[i];return a===void 0?`${t} ${e.toLowerCase()}`:a.replace("{n}",String(t))}function Ug(t,e,n,r,i){const o=ta[i],a=at(t,e,i);switch(n){case"TERM_BASED":return`${a} ${o.magiclineModulePerTerm}`;case"RECURRING":return`${a} ${na(1,r??"MONTH",i)}`;case"NON_RECURRING":return`${a} ${o.magiclineModuleOneTime}`;case"MONTH_DAY":return`${a} ${o.magiclineModuleOneTime}`;case"FREE":return o.magiclineModuleIncluded;default:return a}}function Vg(t,e,n,r){return e==="PERCENTAGE"?`-${t}%`:`-${at(t,n,r)}`}const Hg={startpaket:"magiclineFeeStarterPackage","starter package":"magiclineFeeStarterPackage",trainerpauschale:"magiclineFeeTrainerFee"};function Dc(t,e){const n=t.trim().toLowerCase(),r=Hg[n];return r!==void 0?e[r]:t}function Wg(t,e,n){const r=ta[n];if(t==="NONE")return r.magiclineRenewalNone;if(t==="TERM_EXTENSION"&&e!==null){const i=fi(e.value,e.unit,n);return r.magiclineRenewalTerm.replace("{n} {unit}",i)}return""}const zc=["MALE","FEMALE","UNISEX"],Qg=[{code:"DE",label:"Germany / Deutschland"},{code:"AT",label:"Austria / Österreich"},{code:"CH",label:"Switzerland / Schweiz"},{code:"LI",label:"Liechtenstein"},{code:"LU",label:"Luxembourg / Luxemburg"},{code:"NL",label:"Netherlands / Niederlande"},{code:"BE",label:"Belgium / Belgien"},{code:"FR",label:"France / Frankreich"},{code:"IT",label:"Italy / Italien"},{code:"ES",label:"Spain / Spanien"},{code:"PL",label:"Poland / Polen"},{code:"CZ",label:"Czechia / Tschechien"},{code:"DK",label:"Denmark / Dänemark"},{code:"GB",label:"United Kingdom"},{code:"US",label:"United States"}];function Gg(t,e){const n=[];return e&&n.push("trainer"),n.push("slot"),n.push("personal"),(t.address.visible||t.zip.visible)&&n.push("address"),n.push("confirm"),n}const Kg={firstName:"",lastName:"",email:"",phone:"",birthDate:"",gender:"",street:"",houseNumber:"",zip:"",city:"",country:"",note:"",slotId:"",consent:!1,trainerRequired:!0};function Yg(t,e){switch(e.type){case"set":return{...t,[e.key]:e.value};case"setTrainer":return{...t,trainerRequired:e.trainerRequired,slotId:""};case"clearSlotIfAbsent":return t.slotId!==""&&!e.available.includes(t.slotId)?{...t,slotId:""}:t;default:return t}}function Jg({sessionId:t,visitorId:e}){const n=Ig(),r=Mg(),[i,o]=We(Yg,Kg),[a,l]=We((w,b)=>b,{phase:"loading"}),[c,u]=We((w,b)=>b,{phase:"loading"}),[d,m]=We(w=>w+1,0),f=re((w,b)=>{o({type:"set",key:w,value:b})},[]),p=re(w=>{o({type:"setTrainer",trainerRequired:w}),m()},[]),x=re(()=>{m()},[]);N(()=>{let w=!1;return(async()=>{try{const b=await n({sessionId:t,visitorId:e});if(w)return;b.status==="ok"?l({phase:"ready",config:{plan:b.plan,minimumAge:b.minimumAge,bookingWithoutTrainerAllowed:b.bookingWithoutTrainerAllowed,studioZoneId:b.studioZoneId}}):l({phase:"error",code:b.status,backendMessage:b.message})}catch{w||l({phase:"error",code:"unavailable",backendMessage:""})}})(),()=>{w=!0}},[n,t,e]);const v=a.phase==="ready",{trainerRequired:k}=i;return N(()=>{if(!v)return;let w=!1;return u({phase:"loading"}),(async()=>{try{const b=await r({sessionId:t,visitorId:e,trainerRequired:k});if(w)return;b.status==="ok"?b.slots.length>0?(u({phase:"ready",slots:b.slots}),o({type:"clearSlotIfAbsent",available:b.slots.map(I=>I.startDateTime)})):u({phase:"empty"}):u({phase:"error"})}catch{w||u({phase:"error"})}})(),()=>{w=!0}},[v,r,t,e,k,d]),{fields:i,setField:f,setTrainerRequired:p,configState:a,slotsState:c,refetchSlots:x}}function Xg({formMessageId:t,sessionId:e,visitorId:n,slotUnavailable:r=!1,retryPending:i=!1}){const o=L(),a=Eg(),{fields:l,setField:c,setTrainerRequired:u,configState:d,slotsState:m,refetchSlots:f}=Jg({sessionId:e,visitorId:n});return d.phase==="loading"?s("div",{class:"jex-inline-form jex-magicline-form",children:[s("div",{class:"jex-inline-form-title",children:o.magiclineTrialTitle}),s("div",{class:"jex-magicline-slots-hint",children:o.magiclineConfigLoading})]}):d.phase==="error"?s("div",{class:"jex-inline-form jex-magicline-form",children:[s("div",{class:"jex-inline-form-title",children:o.magiclineTrialTitle}),s("div",{class:"jex-magicline-slots-hint",role:"alert",children:ax(d.code,d.backendMessage,o)})]}):s(Zg,{formMessageId:t,sessionId:e,visitorId:n,slotUnavailable:r,retryPending:i,config:d.config,fields:l,setField:c,setTrainerRequired:u,slotsState:m,refetchSlots:f,submitForm:a})}function Zg({formMessageId:t,sessionId:e,visitorId:n,slotUnavailable:r,retryPending:i,config:o,fields:a,setField:l,setTrainerRequired:c,slotsState:u,refetchSlots:d,submitForm:m}){const f=L(),p=hi(),{plan:x,minimumAge:v,bookingWithoutTrainerAllowed:k,studioZoneId:w}=o,b=_e(()=>Gg(x,k),[x,k]),I=r?Math.max(b.indexOf("slot"),0):0,[C,E]=$(I),[T,M]=$({}),[P,le]=$(!1),[B,D]=$(null),y=_e(()=>Lc(),[]),A=Math.min(C,b.length-1),z=b[A]??"slot",ae=A===b.length-1,Y=A===0;function ce(xe){const W={};if(xe==="slot")return a.slotId===""&&(W.slotId=f.magiclineSlotRequiredError),W;if(xe==="personal"){if(a.firstName.trim()===""&&(W.firstName=f.magiclineRequiredError),a.lastName.trim()===""&&(W.lastName=f.magiclineRequiredError),x.email.visible&&x.email.required&&a.email.trim()===""&&(W.email=f.magiclineRequiredError),a.email.trim()!==""&&!Nc(a.email)&&(W.email=f.magiclineEmailError),x.phone.visible&&x.phone.required&&a.phone.trim()===""&&(W.phone=f.magiclineRequiredError),x.gender.visible&&x.gender.required&&a.gender===""&&(W.gender=f.magiclineRequiredError),x.dateOfBirth.visible&&(x.dateOfBirth.required&&a.birthDate.trim()===""&&(W.birthDate=f.magiclineRequiredError),a.birthDate.trim()!=="")){const H=Lg(a.birthDate);H!==null&&H<0?W.birthDate=f.magiclineRequiredError:v>0&&H!==null&&H<v&&(W.birthDate=f.magiclineMinAgeError.replace("{age}",String(v)))}return W}return xe==="address"?(x.address.visible&&x.address.required&&(a.street.trim()===""&&(W.street=f.magiclineRequiredError),a.houseNumber.trim()===""&&(W.houseNumber=f.magiclineRequiredError),a.city.trim()===""&&(W.city=f.magiclineRequiredError),a.country===""&&(W.country=f.magiclineRequiredError)),x.zip.visible&&x.zip.required&&a.zip.trim()===""&&(W.zip=f.magiclineRequiredError),W):(xe==="confirm"&&(a.consent||(W.consent=f.magiclineConsentError)),W)}function Ne(){const xe=ce(z);if(Object.keys(xe).length>0){M(xe);return}M({}),E(W=>Math.min(W+1,b.length-1))}function st(){M({}),D(null),E(xe=>Math.max(xe-1,0))}async function wt(){if(P)return;const xe=ce("confirm");if(Object.keys(xe).length>0){M(xe);return}M({}),D(null),le(!0);try{const W=sx(x,a);await m({sessionId:e,visitorId:n,formMessageId:t,action:"trialSessionBooking",fields:W})}catch(W){J.error("[TrialSessionBookingForm] Submit failed:",W),D(f.magiclineFailedDetail),le(!1)}}function Ot(){p({sessionId:e,visitorId:n,formMessageId:t}),ae?wt():Ne()}const Fe=ox(z,f),Vt=`jex-ml-consent-${t}`;return s("div",{class:"jex-inline-form jex-magicline-form",children:[s("div",{class:"jex-magicline-wizard-header",children:[s("div",{class:"jex-inline-form-title",children:f.magiclineTrialTitle}),s("div",{class:"jex-magicline-wizard-progress",children:[s("span",{class:"jex-magicline-wizard-step-label",children:Fe}),s("span",{class:"jex-magicline-wizard-counter",children:f.magiclineStepCounter.replace("{n}",String(A+1)).replace("{total}",String(b.length))})]}),s("div",{class:"jex-magicline-wizard-dots","aria-hidden":"true",children:b.map((xe,W)=>s("span",{class:W===A?"jex-magicline-wizard-dot jex-magicline-wizard-dot-active":"jex-magicline-wizard-dot"},xe))})]}),s("div",{class:"jex-form",role:"group","aria-label":Fe,children:[z==="trainer"?s(ex,{formMessageId:t,trainerRequired:a.trainerRequired,disabled:P,onChange:c}):null,z==="slot"?s(tx,{slotsState:u,slotId:a.slotId,studioZoneId:w,disabled:P,retryPending:i,slotUnavailable:r,error:T.slotId,onSelect:xe=>{l("slotId",xe)},onRetry:d}):null,z==="personal"?s(nx,{plan:x,fields:a,errors:T,disabled:P,setField:l}):null,z==="address"?s(rx,{plan:x,fields:a,errors:T,disabled:P,setField:l}):null,z==="confirm"?s(ix,{consentId:Vt,privacyUrl:y,studioZoneId:w,fields:a,disabled:P,consentError:T.consent,setField:l}):null,B!==null?s("div",{class:"jex-magicline-error",role:"alert",children:B}):null,s("div",{class:"jex-magicline-wizard-nav",children:[Y?null:s("button",{type:"button",class:"jex-magicline-wizard-back",disabled:P,onClick:st,children:f.magiclineWizardBack}),s("button",{type:"button",class:"jex-form-submit jex-magicline-wizard-next",disabled:P,onClick:Ot,children:ae?P?f.magiclineSubmitting:f.magiclineSubmit:f.magiclineWizardNext})]})]})]})}function ex({formMessageId:t,trainerRequired:e,disabled:n,onChange:r}){const i=L(),o=`jex-ml-trainer-${t}`;return s("div",{class:"jex-magicline-radio-group",role:"radiogroup","aria-label":i.magiclineStepTrainer,children:[s("label",{class:e?"jex-magicline-radio-card jex-magicline-radio-card-active":"jex-magicline-radio-card",children:[s("input",{type:"radio",name:o,checked:e,disabled:n,onChange:()=>{r(!0)}}),s("span",{children:i.magiclineTrainerWith})]}),s("label",{class:e?"jex-magicline-radio-card":"jex-magicline-radio-card jex-magicline-radio-card-active",children:[s("input",{type:"radio",name:o,checked:!e,disabled:n,onChange:()=>{r(!1)}}),s("span",{children:i.magiclineTrainerWithout})]})]})}function tx({slotsState:t,slotId:e,studioZoneId:n,disabled:r,retryPending:i,slotUnavailable:o,error:a,onSelect:l,onRetry:c}){const u=L();return s(ne,{children:[o?s("div",{class:"jex-magicline-error",role:"alert",children:u.magiclineSlotUnavailableNotice}):null,i||t.phase==="loading"?s("div",{class:"jex-magicline-slots-hint","aria-live":"polite",children:u.magiclineLoadingSlots}):t.phase==="ready"?s("select",{class:"jex-form-input jex-magicline-select","aria-label":u.magiclineSlotLabel,value:e,required:!0,disabled:r,"aria-invalid":a!==void 0,onChange:d=>{l(d.currentTarget.value)},children:[s("option",{value:"",disabled:!0,children:u.magiclineSlotPlaceholder}),t.slots.map(d=>s("option",{value:d.startDateTime,children:Fc(d.startDateTime,Qe.value,n)},d.startDateTime))]}):t.phase==="error"?s("div",{class:"jex-magicline-slots-error",children:[s("div",{class:"jex-magicline-slots-hint",role:"alert","aria-live":"polite",children:u.magiclineSlotsError}),s("button",{type:"button",class:"jex-magicline-retry",disabled:r,onClick:c,children:u.magiclineRetry})]}):s("div",{class:"jex-magicline-slots-hint",role:"alert","aria-live":"polite",children:u.magiclineNoSlots}),a!==void 0?s("div",{class:"jex-magicline-error",role:"alert",children:a}):null]})}function nx({plan:t,fields:e,errors:n,disabled:r,setField:i}){const o=L(),a=_e(()=>Oc(),[]);return s(ne,{children:[s("div",{class:"jex-magicline-row",children:[s(Bt,{label:o.magiclineFirstName,value:e.firstName,required:!0,disabled:r,error:n.firstName,fieldKey:"firstName",onInput:l=>{i("firstName",l)}}),s(Bt,{label:o.magiclineLastName,value:e.lastName,required:!0,disabled:r,error:n.lastName,fieldKey:"lastName",onInput:l=>{i("lastName",l)}})]}),t.email.visible?s(Bt,{label:Ze(o.magiclineEmail,t.email.required,o),type:"email",value:e.email,required:t.email.required,disabled:r,error:n.email,fieldKey:"email",onInput:l=>{i("email",l)}}):null,t.phone.visible?s(Bt,{label:Ze(o.magiclinePhone,t.phone.required,o),type:"tel",value:e.phone,required:t.phone.required,disabled:r,error:n.phone,fieldKey:"phone",onInput:l=>{i("phone",l)}}):null,t.dateOfBirth.visible?s("label",{class:"jex-magicline-field",children:[s("span",{class:"jex-magicline-field-label",children:Ze(o.magiclineBirthDate,t.dateOfBirth.required,o)}),s("input",{class:"jex-form-input",type:"date","aria-label":Ze(o.magiclineBirthDate,t.dateOfBirth.required,o),value:e.birthDate,max:a,required:t.dateOfBirth.required,disabled:r,"aria-invalid":n.birthDate!==void 0,onInput:l=>{i("birthDate",l.currentTarget.value)}}),n.birthDate!==void 0?s("span",{class:"jex-magicline-error",role:"alert",children:n.birthDate}):null]}):null,t.gender.visible?s(qc,{label:Ze(o.magiclineGender,t.gender.required,o),value:e.gender,required:t.gender.required,disabled:r,placeholder:Ze(o.magiclineGenderPlaceholder,t.gender.required,o),error:n.gender,onChange:l=>{i("gender",l)},options:zc.map(l=>({value:l,label:lx(l,o)}))}):null]})}function rx({plan:t,fields:e,errors:n,disabled:r,setField:i}){const o=L();return s(ne,{children:[t.address.visible?s(ne,{children:[s("div",{class:"jex-magicline-row",children:[s(Bt,{label:Ze(o.magiclineStreet,t.address.required,o),value:e.street,required:t.address.required,disabled:r,error:n.street,fieldKey:"street",onInput:a=>{i("street",a)}}),s(Bt,{label:Ze(o.magiclineHouseNumber,t.address.required,o),value:e.houseNumber,required:t.address.required,disabled:r,error:n.houseNumber,fieldKey:"houseNumber",onInput:a=>{i("houseNumber",a)}})]}),s(Bt,{label:Ze(o.magiclineCity,t.address.required,o),value:e.city,required:t.address.required,disabled:r,error:n.city,fieldKey:"city",onInput:a=>{i("city",a)}}),s(qc,{label:Ze(o.magiclineCountry,t.address.required,o),value:e.country,required:t.address.required,disabled:r,placeholder:Ze(o.magiclineCountryPlaceholder,t.address.required,o),error:n.country,onChange:a=>{i("country",a)},options:Qg.map(a=>({value:a.code,label:a.label}))})]}):null,t.zip.visible?s(Bt,{label:Ze(o.magiclineZip,t.zip.required,o),value:e.zip,required:t.zip.required,disabled:r,error:n.zip,fieldKey:"zip",onInput:a=>{i("zip",a)}}):null]})}function ix({consentId:t,privacyUrl:e,studioZoneId:n,fields:r,disabled:i,consentError:o,setField:a}){const l=L(),c=r.slotId!==""?Fc(r.slotId,Qe.value,n):"—",u=`${r.firstName} ${r.lastName}`.trim();return s(ne,{children:[s("dl",{class:"jex-magicline-summary",children:[s("div",{class:"jex-magicline-summary-row",children:[s("dt",{children:l.magiclineSummaryTrainer}),s("dd",{children:r.trainerRequired?l.magiclineTrainerWith:l.magiclineTrainerWithout})]}),s("div",{class:"jex-magicline-summary-row",children:[s("dt",{children:l.magiclineSummarySlot}),s("dd",{children:c})]}),s("div",{class:"jex-magicline-summary-row",children:[s("dt",{children:l.magiclineSummaryName}),s("dd",{children:u!==""?u:"—"})]})]}),s("textarea",{class:"jex-form-textarea","aria-label":l.magiclineNote,placeholder:l.magiclineNote,value:r.note,disabled:i,onInput:d=>{a("note",d.currentTarget.value)}}),s("label",{class:"jex-magicline-consent",for:t,children:[s("input",{id:t,type:"checkbox",checked:r.consent,disabled:i,"aria-invalid":o!==void 0,onChange:d=>{a("consent",d.currentTarget.checked)}}),s("span",{children:[l.magiclineConsent," ",s("a",{href:e,target:"_blank",rel:"noopener noreferrer",class:"jex-privacy-notice-link",children:l.magiclinePrivacyLinkText}),"."]})]}),o!==void 0?s("div",{class:"jex-magicline-error",role:"alert",children:o}):null]})}function Bt({label:t,value:e,fieldKey:n,type:r="text",required:i=!1,disabled:o,error:a,onInput:l}){const c=a!==void 0?`jex-ml-err-${n}`:void 0;return s("div",{class:"jex-magicline-field",children:[s("input",{class:"jex-form-input",type:r,"aria-label":t,placeholder:t,value:e,required:i,disabled:o,"aria-invalid":a!==void 0,"aria-describedby":c,onInput:u=>{l(u.currentTarget.value)}}),a!==void 0?s("span",{id:c,class:"jex-magicline-error",role:"alert",children:a}):null]})}function qc({label:t,value:e,required:n,disabled:r,placeholder:i,error:o,options:a,onChange:l}){return s("div",{class:"jex-magicline-field",children:[s("select",{class:"jex-form-input jex-magicline-select","aria-label":t,value:e,required:n,disabled:r,"aria-invalid":o!==void 0,onChange:c=>{l(c.currentTarget.value)},children:[s("option",{value:"",disabled:n,children:i}),a.map(c=>s("option",{value:c.value,children:c.label},c.value))]}),o!==void 0?s("span",{class:"jex-magicline-error",role:"alert",children:o}):null]})}function Ze(t,e,n){return e?t:t+n.magiclineOptionalSuffix}function ox(t,e){switch(t){case"trainer":return e.magiclineStepTrainer;case"slot":return e.magiclineStepSlot;case"personal":return e.magiclineStepPersonal;case"address":return e.magiclineStepAddress;case"confirm":return e.magiclineStepConfirm;default:return""}}function ax(t,e,n){return e.trim()!==""?e:t==="unsupported"?n.magiclineConfigUnsupported:t==="inconsistent"?n.magiclineConfigInconsistent:n.magiclineConfigUnavailable}function sx(t,e){const n={firstname:e.firstName.trim(),lastname:e.lastName.trim(),slotId:e.slotId,trainerRequired:e.trainerRequired,privacyConsent:e.consent};return t.email.visible&&e.email.trim()!==""&&(n.email=e.email.trim()),t.phone.visible&&e.phone.trim()!==""&&(n.phone=e.phone.trim()),t.dateOfBirth.visible&&e.birthDate.trim()!==""&&(n.dateOfBirth=e.birthDate.trim()),t.gender.visible&&e.gender!==""&&(n.gender=e.gender),t.address.visible&&(e.street.trim()!==""&&(n.street=e.street.trim()),e.houseNumber.trim()!==""&&(n.houseNumber=e.houseNumber.trim()),e.city.trim()!==""&&(n.city=e.city.trim()),e.country!==""&&(n.country=e.country)),t.zip.visible&&e.zip.trim()!==""&&(n.zip=e.zip.trim()),e.note.trim()!==""&&(n.note=e.note.trim()),n}function lx(t,e){return t==="MALE"?e.magiclineGenderMale:t==="FEMALE"?e.magiclineGenderFemale:e.magiclineGenderUnisex}function Fc(t,e,n){const r=e==="de"?"de-DE":"en-GB",i=t.match(/\[([^\]]+)\]\s*$/),o=i?i[1]:n??void 0,a=t.replace(/\[[^\]]+\]\s*$/,""),l=new Date(a);if(Number.isNaN(l.getTime()))return t;try{return l.toLocaleString(r,{weekday:"short",day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit",...o?{timeZone:o,timeZoneName:"short"}:{timeZoneName:"short"}})}catch{return l.toLocaleString(r,{weekday:"short",day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit",timeZoneName:"short"})}}function ra(t){const e=oe(t);return fn(()=>{e.current=t}),re((...n)=>e.current(...n),[])}const cx={termId:null,selectedModuleIds:[],acknowledgedBlocks:{},personal:{firstName:"",lastName:"",email:"",dateOfBirth:"",gender:"",phone:""},address:{street:"",houseNumber:"",zipCode:"",city:""},payment:{accountHolder:"",accountHolderTouched:!1,iban:""},consents:{privacy:!1,sepa:!1}};function ux(t,e){switch(e.type){case"setTermId":return t.termId===e.termId?t:{...t,termId:e.termId,selectedModuleIds:[],acknowledgedBlocks:{}};case"toggleModule":{if(e.selected)return t.selectedModuleIds.includes(e.moduleId)?t:{...t,selectedModuleIds:[...t.selectedModuleIds,e.moduleId]};const n={...t.acknowledgedBlocks};return e.consentAckKey!==void 0&&delete n[e.consentAckKey],{...t,selectedModuleIds:t.selectedModuleIds.filter(r=>r!==e.moduleId),acknowledgedBlocks:n}}case"setBlockAck":return{...t,acknowledgedBlocks:{...t.acknowledgedBlocks,[e.ackKey]:e.value}};case"setPersonal":return{...t,personal:{...t.personal,[e.key]:e.value}};case"setAddress":return{...t,address:{...t.address,[e.key]:e.value}};case"setAccountHolder":return{...t,payment:{...t.payment,accountHolder:e.value,accountHolderTouched:!0}};case"setIban":return{...t,payment:{...t.payment,iban:e.value}};case"setConsent":return{...t,consents:{...t.consents,[e.key]:e.value}};case"clearIban":return{...t,payment:{...t.payment,iban:""}};case"clearTermId":return{...t,termId:null,selectedModuleIds:[],acknowledgedBlocks:{}};case"prefillAccountHolder":return t.payment.accountHolderTouched||t.payment.accountHolder!==""?t:{...t,payment:{...t.payment,accountHolder:e.value}};default:return t}}const Bc={draftVoucherCode:"",appliedVoucherCode:null,appliedVoucher:null,voucherStatus:"idle",voucherRequestId:0,voucherUnavailable:!1},dx="voucher:";function hx(t){const e={};for(const n of Object.keys(t))n.startsWith(dx)||(e[n]=t[n]);return e}function fx(t,e){switch(e.type){case"SET_VOUCHER_DRAFT":{const n=t.appliedVoucher!==null||t.voucherStatus==="applied";return{...t,draftVoucherCode:e.value,...n?{appliedVoucher:null,appliedVoucherCode:null,voucherStatus:"idle"}:{}}}case"VOUCHER_APPLYING":return{...t,voucherStatus:"applying",voucherRequestId:t.voucherRequestId+1};case"VOUCHER_APPLIED":return e.requestId!==t.voucherRequestId?t:{...t,appliedVoucher:e.voucher,appliedVoucherCode:e.appliedCode,voucherStatus:"applied"};case"VOUCHER_INVALID":return{...t,appliedVoucher:null,appliedVoucherCode:null,voucherStatus:"invalid"};case"VOUCHER_DISABLED":return{...t,appliedVoucher:null,appliedVoucherCode:null,voucherStatus:"disabled",voucherUnavailable:!0};case"CLEAR_VOUCHER":return{...t,appliedVoucher:null,appliedVoucherCode:null,voucherStatus:"idle"};default:return t}}function px(t,e){switch(e.type){case"dropVoucherAcks":{const n=hx(t.acknowledgedBlocks);return Object.keys(n).length===Object.keys(t.acknowledgedBlocks).length?t:{...t,acknowledgedBlocks:n}}case"seedVoucherAcks":{if(e.ackKeys.length===0)return t;const n={...t.acknowledgedBlocks};for(const r of e.ackKeys)r in n||(n[r]=!1);return{...t,acknowledgedBlocks:n}}default:return ux(t,e)}}function mx({sessionId:t,visitorId:e}){const n=Pg(),r=Pc(),[i,o]=We(px,cx),[a,l]=We(fx,Bc),[c,u]=We((R,K)=>K,{phase:"loading"}),d=oe(null),[m,f]=We((R,K)=>K,{phase:"idle"}),p=re(R=>{R.phase==="ready"?d.current=R.pricing:(R.phase==="idle"||R.phase==="error")&&(d.current=null),f(R)},[]),[x,v]=We(R=>R+1,0),[k,w]=We(R=>R+1,0),b=re(R=>{o({type:"setTermId",termId:R}),l({type:"CLEAR_VOUCHER"})},[]),I=re((R,K)=>{o({type:"setPersonal",key:R,value:K})},[]),C=re((R,K)=>{o({type:"setAddress",key:R,value:K})},[]),E=re((R,K,Be)=>{o({type:"toggleModule",moduleId:R,selected:K,consentAckKey:Be}),o({type:"dropVoucherAcks"}),l({type:"CLEAR_VOUCHER"})},[]),T=re((R,K)=>{o({type:"setBlockAck",ackKey:R,value:K})},[]),M=re(R=>{o({type:"setAccountHolder",value:R})},[]),P=re(R=>{o({type:"setIban",value:R})},[]),le=re((R,K)=>{o({type:"setConsent",key:R,value:K})},[]),B=re(()=>{o({type:"clearIban"})},[]),D=re(()=>{o({type:"clearTermId"}),l({type:"CLEAR_VOUCHER"})},[]),y=re(R=>{l({type:"SET_VOUCHER_DRAFT",value:R}),o({type:"dropVoucherAcks"})},[]),A=oe(Bc.voucherRequestId),z=re(()=>{const R=A.current+1;return A.current=R,l({type:"VOUCHER_APPLYING"}),R},[]),ae=re(R=>{R.requestId===A.current&&(l({type:"VOUCHER_APPLIED",requestId:R.requestId,voucher:R.voucher,appliedCode:R.appliedCode,voucherAckKeys:R.voucherAckKeys}),p({phase:"ready",pricing:R.pricing}),o({type:"seedVoucherAcks",ackKeys:R.voucherAckKeys}))},[p]),Y=re(()=>{l({type:"VOUCHER_INVALID"}),o({type:"dropVoucherAcks"}),w()},[]),ce=re(()=>{l({type:"VOUCHER_DISABLED"}),o({type:"dropVoucherAcks"}),w()},[]),Ne=re(()=>{l({type:"CLEAR_VOUCHER"}),o({type:"dropVoucherAcks"}),w()},[]),st=re(()=>{v()},[]),wt=re(()=>{p({phase:"idle"})},[p]),Ot=re(()=>{w()},[]),Fe=c.phase==="ready"&&i.termId!==null?c.terms.find(R=>R.termId===i.termId)??null:null,{selectedModuleIds:Vt,acknowledgedBlocks:xe}=i,{appliedVoucher:W}=a,H=_e(()=>{if(Fe===null)return[];const R=new Set;for(const K of Fe.textBlocks)K.isConfirmationRequired&&R.add(K.ackKey);for(const K of Vt){const Be=Fe.optionalModules.find(U=>U.id===K);Be?.consent&&R.add(Be.consent.ackKey)}if(W!==null)for(const K of W.textBlocks)R.add(K.ackKey);return[...R]},[Fe,Vt,W]),an=_e(()=>H.every(R=>xe[R]===!0),[H,xe]),{firstName:Te,lastName:et}=i.personal,{accountHolder:Oe,accountHolderTouched:Ht}=i.payment;N(()=>{Ht||Oe!==""||Te.trim()!==""&&et.trim()!==""&&o({type:"prefillAccountHolder",value:`${Te.trim()} ${et.trim()}`})},[Te,et,Oe,Ht]),N(()=>{let R=!1;return u({phase:"loading"}),(async()=>{try{const K=await n({sessionId:t,visitorId:e});if(R)return;K.status==="ok"?K.terms.length>0?u({phase:"ready",terms:K.terms,allowVoucherCodes:K.allowVoucherCodes}):u({phase:"empty"}):u({phase:"error"})}catch{R||u({phase:"error"})}})(),()=>{R=!0}},[n,t,e,x]);const En=ra(()=>{const R=Fe;return R?{sessionId:t,visitorId:e,termId:R.termId,startDate:R.defaultContractStartDate??"",fields:{firstname:i.personal.firstName.trim(),lastname:i.personal.lastName.trim(),email:i.personal.email.trim(),dateOfBirth:i.personal.dateOfBirth.trim(),gender:i.personal.gender,phone:i.personal.phone.trim(),street:i.address.street.trim(),houseNumber:i.address.houseNumber.trim(),zipCode:i.address.zipCode.trim(),city:i.address.city.trim()},selectedModuleIds:R.optionalModules.filter(K=>i.selectedModuleIds.includes(K.id)).map(K=>K.id),privacyConsent:i.consents.privacy,sepaConsent:i.consents.sepa}:null});return N(()=>{if(k===0)return;const R=En();if(!R){p({phase:"error",code:"offer_unavailable"});return}let K=!1;const Be=d.current;return p(Be!==null?{phase:"reloading",pricing:Be}:{phase:"loading"}),(async()=>{try{const U=await r(R);if(K)return;U.status==="ok"?p({phase:"ready",pricing:{basePrice:U.basePrice,preUseCharge:U.preUseCharge,currencyCode:U.currencyCode,flatFees:U.flatFees,modules:U.modules,contractVolume:U.contractVolume,startDate:U.startDate,paymentFrequency:U.paymentFrequency,fingerprint:U.pricingFingerprint}}):p({phase:"error",code:U.status==="voucher_invalid"||U.status==="voucher_disabled"?"unavailable":U.status})}catch{K||p({phase:"error",code:"unavailable"})}})(),()=>{K=!0}},[k,r,t,e,p]),{fields:i,offersState:c,previewState:m,selectedTerm:Fe,requiredAckKeys:H,allAcknowledged:an,serverAllowVoucherCodes:c.phase==="ready"?c.allowVoucherCodes:!1,voucherStatus:a.voucherStatus,draftVoucherCode:a.draftVoucherCode,appliedVoucherCode:a.appliedVoucherCode,appliedVoucher:a.appliedVoucher,voucherUnavailable:a.voucherUnavailable,setTermId:b,setPersonal:I,setAddress:C,toggleModule:E,setBlockAck:T,setAccountHolder:M,setIban:P,setConsent:le,clearIban:B,clearTermId:D,refetchOffers:st,fetchPreview:Ot,resetPreview:wt,setVoucherDraft:y,beginVoucherApply:z,commitVoucherApplied:ae,markVoucherInvalid:Y,markVoucherDisabled:ce,clearVoucher:Ne}}function gx(t){return t!==null&&t.optionalModules.length>0?["offer","upgrades","personal","address","payment","review"]:["offer","personal","address","payment","review"]}function xx({formMessageId:t,sessionId:e,visitorId:n,projectId:r,formStatus:i}){const o=L(),a=Qe.value,l=Ng(),c=Pc(),u=mx({sessionId:e,visitorId:n}),{fields:d,offersState:m,previewState:f,selectedTerm:p,requiredAckKeys:x,allAcknowledged:v,serverAllowVoucherCodes:k,voucherStatus:w,draftVoucherCode:b,appliedVoucher:I,appliedVoucherCode:C,voucherUnavailable:E,setTermId:T,setPersonal:M,setAddress:P,toggleModule:le,setBlockAck:B,setAccountHolder:D,setIban:y,setConsent:A,clearIban:z,clearTermId:ae,refetchOffers:Y,fetchPreview:ce,resetPreview:Ne,setVoucherDraft:st,beginVoucherApply:wt,commitVoucherApplied:Ot,markVoucherInvalid:Fe,markVoucherDisabled:Vt}=u,[xe,W]=$(0),[H,an]=$({}),[Te,et]=$(!1),[Oe,Ht]=$(null),[En,R]=$(null),[K,Be]=$(null),U=_e(()=>Lc(),[]);if(Oe!==null&&Oe.status==="succeeded")return s(Uc,{customerNumber:Oe.customerNumber});if(Oe!==null&&Oe.status==="failed"&&!Oe.retryable){const X=Oe.errorCode==="duplicate_submission"?o.magiclineDuplicateNotice:Oe.errorCode==="unknown_outcome"?o.magiclineUnknownOutcome:Oe.errorCode==="live_submission_disabled"?o.magiclineLiveSubmissionDisabled:o.magiclineFailedDetail;return s(Vc,{message:X})}if(Oe===null&&!Te&&i==="submitted")return s(Uc,{customerNumber:null});if(Oe===null&&!Te&&i==="failed")return s(Vc,{message:o.magiclineFailedDetail});const lt=gx(p),ie=Math.min(xe,lt.length-1),Ue=lt[ie]??"offer",Ke=ie===lt.length-1,sn=ie===0;function mi(X){const Q={};if(X==="offer")return d.termId===null&&(Q.termId=o.magiclineOfferRequiredError),Q;if(X==="upgrades"){if(p!==null)for(const ue of d.selectedModuleIds){const tt=p.optionalModules.find(be=>be.id===ue);if(tt?.consent&&d.acknowledgedBlocks[tt.consent.ackKey]!==!0){Q.upgrades=o.magiclineUpgradeConsentError;break}}return Q}if(X==="personal"){const ue=d.personal;return ue.firstName.trim()===""&&(Q.firstName=o.magiclineRequiredError),ue.lastName.trim()===""&&(Q.lastName=o.magiclineRequiredError),ue.email.trim()===""?Q.email=o.magiclineRequiredError:Nc(ue.email)||(Q.email=o.magiclineEmailError),ue.dateOfBirth.trim()===""&&(Q.dateOfBirth=o.magiclineRequiredError),ue.gender===""&&(Q.gender=o.magiclineRequiredError),ue.phone.trim()===""&&(Q.phone=o.magiclineRequiredError),Q}if(X==="address"){const ue=d.address;return ue.street.trim()===""&&(Q.street=o.magiclineRequiredError),ue.houseNumber.trim()===""&&(Q.houseNumber=o.magiclineRequiredError),ue.zipCode.trim()===""&&(Q.zipCode=o.magiclineRequiredError),ue.city.trim()===""&&(Q.city=o.magiclineRequiredError),Q}return X==="payment"&&(d.payment.accountHolder.trim()===""&&(Q.accountHolder=o.magiclineRequiredError),qg(d.payment.iban)||(Q.iban=o.magiclineIbanInvalidError),d.consents.privacy||(Q.privacy=o.magiclineConsentError),d.consents.sepa||(Q.sepa=o.magiclineConsentError)),Q}function kt(){const X=mi(Ue);if(Object.keys(X).length>0){an(X);return}an({}),R(null);const Q=Math.min(ie+1,lt.length-1);lt[Q]==="review"&&ce(),W(Q)}function gi(){an({}),R(null),Ue==="review"&&Ne(),W(X=>Math.max(X-1,0))}function vr(){R(null),ce()}async function xi(){if(!Te&&!(f.phase!=="ready"||p===null)){if(!v){R(o.magiclineConfirmRequiredError);return}et(!0),R(null);try{const X=await l({sessionId:e,visitorId:n,projectId:r,formMessageId:t,fields:{firstname:d.personal.firstName.trim(),lastname:d.personal.lastName.trim(),email:d.personal.email.trim(),phone:d.personal.phone.trim(),dateOfBirth:d.personal.dateOfBirth.trim(),gender:d.personal.gender,street:d.address.street.trim(),houseNumber:d.address.houseNumber.trim(),zipCode:d.address.zipCode.trim(),city:d.address.city.trim(),rateBundleTermId:p.termId,privacyConsent:d.consents.privacy,sepaConsent:d.consents.sepa},bankAccount:{accountHolder:d.payment.accountHolder.trim(),iban:d.payment.iban},selectedModuleIds:p.optionalModules.filter(Q=>d.selectedModuleIds.includes(Q.id)).map(Q=>Q.id),acknowledgedAckKeys:x,pricingFingerprint:f.pricing.fingerprint,voucherCode:C??void 0});if(X.status==="succeeded"){Ht(X);return}if(X.errorCode==="price_changed"){R(o.magiclinePriceChangedNotice),ce(),et(!1);return}if(X.errorCode==="offer_unavailable"){ae(),Y(),Ne(),R(o.magiclineOfferUnavailableNotice),W(0),et(!1);return}if(X.errorCode==="confirmation_required"){R(o.magiclineConfirmationRequiredNotice),et(!1);return}if(X.errorCode==="live_submission_disabled"){Ht(X);return}if(!X.retryable){Ht(X);return}z(),R(X.message!==""?X.message:o.magiclineFailedDetail),et(!1)}catch(X){J.error("[ContractCreationForm] Submit failed:",X),z(),R(o.magiclineFailedDetail),et(!1)}}}async function yr(){if(f.phase!=="ready"||p===null||b.trim()==="")return;const X=b.trim(),Q=wt();Be(null);const ue=be=>{Fe(),st(""),Be(be)},tt=o.magiclineVoucherInvalid.replace("{code}",X);try{const be=await c({sessionId:e,visitorId:n,termId:p.termId,startDate:p.defaultContractStartDate??"",fields:{firstname:d.personal.firstName.trim(),lastname:d.personal.lastName.trim(),email:d.personal.email.trim(),dateOfBirth:d.personal.dateOfBirth.trim(),gender:d.personal.gender,phone:d.personal.phone.trim(),street:d.address.street.trim(),houseNumber:d.address.houseNumber.trim(),zipCode:d.address.zipCode.trim(),city:d.address.city.trim()},selectedModuleIds:p.optionalModules.filter(jt=>d.selectedModuleIds.includes(jt.id)).map(jt=>jt.id),privacyConsent:d.consents.privacy,sepaConsent:d.consents.sepa,voucherCode:b.trim()});if(be.status==="ok"){const jt=be.voucher;if(jt!==null){const bi=jt.textBlocks.map(vi=>vi.ackKey);Ot({requestId:Q,voucher:jt,appliedCode:b.trim(),voucherAckKeys:bi,pricing:{basePrice:be.basePrice,preUseCharge:be.preUseCharge,currencyCode:be.currencyCode,flatFees:be.flatFees,modules:be.modules,contractVolume:be.contractVolume,startDate:be.startDate,paymentFrequency:be.paymentFrequency,fingerprint:be.pricingFingerprint}})}else ue(tt)}else be.status==="voucher_invalid"?ue(tt):be.status==="voucher_disabled"?(Vt(),st(""),Be(o.magiclineVoucherDisabled)):ue(tt)}catch{ue(tt)}}function ct(){Ke?xi():kt()}const _t=Ex(Ue,o),Lt=w==="applying"||b.trim()!==""&&b.trim()!==(C??""),wr=Ue==="review"&&(f.phase!=="ready"||!v||Lt),In=Te||wr;return s("div",{class:"jex-inline-form jex-magicline-form",children:[s("div",{class:"jex-magicline-wizard-header",children:[s("div",{class:"jex-inline-form-title",children:o.magiclineContractTitle}),s("div",{class:"jex-magicline-wizard-progress",children:[s("span",{class:"jex-magicline-wizard-step-label",children:_t}),s("span",{class:"jex-magicline-wizard-counter",children:o.magiclineStepCounter.replace("{n}",String(ie+1)).replace("{total}",String(lt.length))})]}),s("div",{class:"jex-magicline-wizard-dots","aria-hidden":"true",children:lt.map((X,Q)=>s("span",{class:Q===ie?"jex-magicline-wizard-dot jex-magicline-wizard-dot-active":"jex-magicline-wizard-dot"},X))})]}),s("div",{class:"jex-form",role:"group","aria-label":_t,children:[Ue==="offer"?s(bx,{offersState:m,selectedTermId:d.termId,widgetLocale:a,disabled:Te,error:H.termId,onSelect:T,onRetry:Y}):null,Ue==="upgrades"&&p!==null?s(wx,{modules:p.optionalModules,selectedModuleIds:d.selectedModuleIds,acknowledgedBlocks:d.acknowledgedBlocks,widgetLocale:a,disabled:Te,error:H.upgrades,onToggle:le,onAck:B}):null,Ue==="personal"?s(_x,{personal:d.personal,errors:H,disabled:Te,setPersonal:M}):null,Ue==="address"?s(jx,{address:d.address,errors:H,disabled:Te,setAddress:P}):null,Ue==="payment"?s(Sx,{formMessageId:t,fields:d,errors:H,privacyUrl:U,disabled:Te,setAccountHolder:D,setIban:y,setConsent:A}):null,Ue==="review"?s(Tx,{fields:d,term:p,previewState:f,widgetLocale:a,disabled:Te,acknowledgedBlocks:d.acknowledgedBlocks,onToggleAck:B,onRetry:vr,allowVoucherCodes:k,voucherUnavailable:E,voucherStatus:w,draftVoucherCode:b,appliedVoucher:I,voucherBanner:K,onVoucherDraftChange:st,onApplyVoucher:()=>{yr()}}):null,En!==null?s("div",{class:"jex-magicline-error",role:"alert",children:En}):null,s("div",{class:"jex-magicline-wizard-nav",children:[sn?null:s("button",{type:"button",class:"jex-magicline-wizard-back",disabled:Te,onClick:gi,children:o.magiclineWizardBack}),s("button",{type:"button",class:"jex-form-submit jex-magicline-wizard-next",disabled:In,onClick:ct,children:Ke?Te?o.magiclineSubmitting:o.magiclineSubmit:o.magiclineWizardNext})]})]})]})}function Uc({customerNumber:t}){const e=L();return s("div",{class:"jex-inline-form-submitted",children:[s("span",{class:"jex-inline-form-check",children:"✓"}),s("div",{children:[s("div",{class:"jex-inline-form-submitted-title",children:e.magiclineContractSuccessTitle}),s("div",{class:"jex-inline-form-submitted-detail",children:e.magiclineContractSuccessDetail}),t!==null&&t!==""?s("div",{class:"jex-inline-form-submitted-detail",children:e.magiclineCustomerNumber.replace("{number}",t)}):null]})]})}function Vc({message:t}){const e=L();return s("div",{class:"jex-inline-form-submitted jex-magicline-failed",children:[s("span",{class:"jex-inline-form-check jex-magicline-failed-icon",children:"!"}),s("div",{children:[s("div",{class:"jex-inline-form-submitted-title",children:e.magiclineFailed}),s("div",{class:"jex-inline-form-submitted-detail",children:t})]})]})}function bx({offersState:t,selectedTermId:e,widgetLocale:n,disabled:r,error:i,onSelect:o,onRetry:a}){const l=L();if(t.phase==="loading")return s("div",{class:"jex-magicline-slots-hint","aria-live":"polite",children:l.magiclineOffersLoading});if(t.phase==="error")return s("div",{class:"jex-magicline-slots-error",children:[s("div",{class:"jex-magicline-slots-hint",role:"alert","aria-live":"polite",children:l.magiclineOffersError}),s("button",{type:"button",class:"jex-magicline-retry",disabled:r,onClick:a,children:l.magiclineRetry})]});if(t.phase==="empty")return s("div",{class:"jex-magicline-slots-hint",role:"alert","aria-live":"polite",children:l.magiclineNoOffers});const c=Rx(t.terms);return s(ne,{children:[s("div",{class:"jex-magicline-radio-group",role:"radiogroup","aria-label":l.magiclineStepOffer,children:c.map(u=>s("div",{class:"jex-magicline-offer-group",children:[s("div",{class:"jex-magicline-offer-bundle-name",children:u.bundleName}),u.bundleDescription!==null?s("div",{class:"jex-magicline-offer-bundle-desc",children:u.bundleDescription}):null,u.terms.map(d=>s(vx,{term:d,checked:e===d.termId,widgetLocale:n,disabled:r,onSelect:o},d.termId)),s(yx,{subDescription:u.bundleSubDescription,footnote:u.footnote})]},u.bundleId))}),i!==void 0?s("div",{class:"jex-magicline-error",role:"alert",children:i}):null]})}function vx({term:t,checked:e,widgetLocale:n,disabled:r,onSelect:i}){const o=L(),a=fi(t.termValue,t.termUnit,n),l=at(t.price,t.currencyCode,n),c=t.flatFees.find(d=>d.isStarterPackage),u=t.flatFees.filter(d=>!d.isStarterPackage);return s("label",{class:e?"jex-magicline-radio-card jex-magicline-radio-card-active":"jex-magicline-radio-card",children:[s("input",{type:"radio",name:"jex-ml-offer",checked:e,disabled:r,onChange:()=>{i(t.termId)}}),s("span",{class:"jex-magicline-offer-term",children:[s("span",{class:"jex-magicline-offer-term-head",children:[s("span",{class:"jex-magicline-offer-term-length",children:a}),s("span",{class:"jex-magicline-offer-term-price",children:[l," ",na(t.paymentFrequency.value,t.paymentFrequency.unit,n)]})]}),t.cancellationPeriod!==null?s("span",{class:"jex-magicline-offer-term-note",children:[o.magiclineCancellationPeriod,":"," ",fi(t.cancellationPeriod.value,t.cancellationPeriod.unit,n)]}):null,c!==void 0?s("span",{class:"jex-magicline-offer-term-note",children:[o.magiclineStarterPackage,":"," ",at(c.price,t.currencyCode,n)]}):null,u.map(d=>s("span",{class:"jex-magicline-offer-term-note",children:[Dc(d.name,o),": ",at(d.price,t.currencyCode,n)]},d.name)),t.includedModuleNames.length>0?s("span",{class:"jex-magicline-offer-term-note",children:[o.magiclineIncludedModules,": ",t.includedModuleNames.join(", ")]}):null]})]})}function yx({subDescription:t,footnote:e}){const n=L(),r=Ax(t),i=e!==null&&e.trim()!=="";return r.length===0&&!i?null:s("details",{class:"jex-magicline-bundle-details",children:[s("summary",{class:"jex-magicline-bundle-details-summary",children:n.magiclineDetails}),s("div",{class:"jex-magicline-bundle-details-body",children:[r.length>0?s("ul",{class:"jex-magicline-bundle-details-list",children:r.map((o,a)=>s("li",{children:o},`${a}-${o}`))}):null,i?s("p",{class:"jex-magicline-bundle-details-footnote",children:e}):null]})]})}function wx({modules:t,selectedModuleIds:e,acknowledgedBlocks:n,widgetLocale:r,disabled:i,error:o,onToggle:a,onAck:l}){const c=L();return t.length===0?s("div",{class:"jex-magicline-slots-hint",children:c.magiclineUpgradesNone}):s(ne,{children:[s("div",{class:"jex-magicline-slots-hint",children:c.magiclineUpgradesIntro}),s("div",{class:"jex-magicline-upgrade-group",children:t.map(u=>s(kx,{module:u,selected:e.includes(u.id),consentChecked:u.consent!==null&&n[u.consent.ackKey]===!0,widgetLocale:r,disabled:i,onToggle:a,onAck:l},u.id))}),o!==void 0?s("div",{class:"jex-magicline-error",role:"alert",children:o}):null]})}function kx({module:t,selected:e,consentChecked:n,widgetLocale:r,disabled:i,onToggle:o,onAck:a}){const l=L(),c=Ug(t.price,t.currencyCode,t.paymentFrequencyType,t.recurringUnit,r),u=Wg(t.extensionType,t.termExtension,r),d=t.termLabel!==null&&t.termLabel!==""?t.termLabel:l.magiclineUpgradeOneTime,m=t.consent;return s("div",{class:e?"jex-magicline-upgrade-card jex-magicline-upgrade-card-active":"jex-magicline-upgrade-card",children:[s("label",{class:"jex-magicline-upgrade-head",children:[s("input",{type:"checkbox",checked:e,disabled:i,onChange:f=>{o(t.id,f.currentTarget.checked,m?.ackKey)}}),s("span",{class:"jex-magicline-upgrade-info",children:[s("span",{class:"jex-magicline-upgrade-name",children:t.name}),t.description!==null&&t.description!==""?s("span",{class:"jex-magicline-upgrade-desc",children:t.description}):null,s("span",{class:"jex-magicline-upgrade-price",children:c}),s("span",{class:"jex-magicline-upgrade-desc",children:d}),u!==""?s("span",{class:"jex-magicline-upgrade-desc",children:u}):null]}),s("span",{class:"jex-magicline-upgrade-status",children:e?l.magiclineUpgradeAdded:l.magiclineUpgradeAdd})]}),e&&m!==null?s(ia,{ackKey:m.ackKey,title:m.title,text:m.text,attachmentLabel:m.attachmentLabel,attachmentUrl:m.attachmentUrl,checked:n,disabled:i,onToggle:a,showRequiredPill:!0}):null]})}function _x({personal:t,errors:e,disabled:n,setPersonal:r}){const i=L(),o=_e(()=>Oc(),[]);return s(ne,{children:[s("div",{class:"jex-magicline-row",children:[s(yt,{label:i.magiclineFirstName,value:t.firstName,required:!0,disabled:n,error:e.firstName,fieldKey:"firstName",onInput:a=>{r("firstName",a)}}),s(yt,{label:i.magiclineLastName,value:t.lastName,required:!0,disabled:n,error:e.lastName,fieldKey:"lastName",onInput:a=>{r("lastName",a)}})]}),s(yt,{label:i.magiclineEmail,type:"email",value:t.email,required:!0,disabled:n,error:e.email,fieldKey:"email",onInput:a=>{r("email",a)}}),s("label",{class:"jex-magicline-field",children:[s("span",{class:"jex-magicline-field-label",children:i.magiclineBirthDate}),s("input",{class:"jex-form-input",type:"date","aria-label":i.magiclineBirthDate,value:t.dateOfBirth,max:o,required:!0,disabled:n,"aria-invalid":e.dateOfBirth!==void 0,onInput:a=>{r("dateOfBirth",a.currentTarget.value)}}),e.dateOfBirth!==void 0?s("span",{class:"jex-magicline-error",role:"alert",children:e.dateOfBirth}):null]}),s(Cx,{label:i.magiclineGender,value:t.gender,required:!0,disabled:n,placeholder:i.magiclineGenderPlaceholder,error:e.gender,onChange:a=>{r("gender",a)},options:zc.map(a=>({value:a,label:Ix(a,i)}))}),s(yt,{label:i.magiclinePhone,type:"tel",value:t.phone,required:!0,disabled:n,error:e.phone,fieldKey:"phone",onInput:a=>{r("phone",a)}})]})}function jx({address:t,errors:e,disabled:n,setAddress:r}){const i=L();return s(ne,{children:[s("div",{class:"jex-magicline-row",children:[s(yt,{label:i.magiclineStreet,value:t.street,required:!0,disabled:n,error:e.street,fieldKey:"street",onInput:o=>{r("street",o)}}),s(yt,{label:i.magiclineHouseNumber,value:t.houseNumber,required:!0,disabled:n,error:e.houseNumber,fieldKey:"houseNumber",onInput:o=>{r("houseNumber",o)}})]}),s("div",{class:"jex-magicline-row",children:[s(yt,{label:i.magiclineZip,value:t.zipCode,required:!0,disabled:n,error:e.zipCode,fieldKey:"zipCode",onInput:o=>{r("zipCode",o)}}),s(yt,{label:i.magiclineCity,value:t.city,required:!0,disabled:n,error:e.city,fieldKey:"city",onInput:o=>{r("city",o)}})]}),s("div",{class:"jex-magicline-field",children:[s("span",{class:"jex-magicline-field-label",children:i.magiclineCountry}),s("div",{class:"jex-magicline-static-value",children:i.magiclineCountryStatic})]})]})}function Sx({formMessageId:t,fields:e,errors:n,privacyUrl:r,disabled:i,setAccountHolder:o,setIban:a,setConsent:l}){const c=L(),u=`jex-ml-privacy-${t}`,d=`jex-ml-sepa-${t}`;return s(ne,{children:[s(yt,{label:c.magiclineAccountHolder,value:e.payment.accountHolder,required:!0,disabled:i,error:n.accountHolder,fieldKey:"accountHolder",onInput:o}),s(yt,{label:c.magiclineIban,value:e.payment.iban,required:!0,disabled:i,error:n.iban,fieldKey:"iban",onInput:a}),s("label",{class:"jex-magicline-consent",for:u,children:[s("input",{id:u,type:"checkbox",checked:e.consents.privacy,disabled:i,"aria-invalid":n.privacy!==void 0,onChange:m=>{l("privacy",m.currentTarget.checked)}}),s("span",{children:[c.magiclineConsent," ",s("a",{href:r,target:"_blank",rel:"noopener noreferrer",class:"jex-privacy-notice-link",children:c.magiclinePrivacyLinkText}),"."]})]}),s("label",{class:"jex-magicline-consent",for:d,children:[s("input",{id:d,type:"checkbox",checked:e.consents.sepa,disabled:i,"aria-invalid":n.sepa!==void 0,onChange:m=>{l("sepa",m.currentTarget.checked)}}),s("span",{children:c.magiclineSepaConsent})]}),n.privacy!==void 0?s("div",{class:"jex-magicline-error",role:"alert",children:n.privacy}):null,n.sepa!==void 0?s("div",{class:"jex-magicline-error",role:"alert",children:n.sepa}):null]})}function Tx({fields:t,term:e,previewState:n,widgetLocale:r,disabled:i,acknowledgedBlocks:o,onToggleAck:a,onRetry:l,allowVoucherCodes:c,voucherUnavailable:u,voucherStatus:d,draftVoucherCode:m,appliedVoucher:f,voucherBanner:p,onVoucherDraftChange:x,onApplyVoucher:v}){const k=L();if(n.phase==="loading"||n.phase==="idle")return s("div",{class:"jex-magicline-slots-hint","aria-live":"polite",children:k.magiclineReviewLoading});if(n.phase==="error")return s("div",{class:"jex-magicline-slots-error",children:[s("div",{class:"jex-magicline-slots-hint",role:"alert","aria-live":"polite",children:n.code==="offer_unavailable"?k.magiclineOfferUnavailableNotice:k.magiclineReviewError}),s("button",{type:"button",class:"jex-magicline-retry",disabled:i,onClick:l,children:k.magiclineRetry})]});const w=n.pricing,b=n.phase==="reloading",I=w.contractVolume,C=`${t.personal.firstName} ${t.personal.lastName}`.trim(),E=t.address,T=[`${E.street} ${E.houseNumber}`.trim(),`${E.zipCode} ${E.city}`.trim(),k.magiclineCountryStatic].filter(A=>A!=="").join(", "),M=e!==null?`${e.bundleName} · ${fi(e.termValue,e.termUnit,r)}`:"—",P=e!==null?e.textBlocks.filter(A=>A.isConfirmationRequired):[],le=e!==null?e.textBlocks.filter(A=>!A.isConfirmationRequired):[],B=e!==null?e.optionalModules.filter(A=>t.selectedModuleIds.includes(A.id)&&A.consent!==null).map(A=>({module:A,consent:A.consent})):[],D=f!==null?f.textBlocks.filter(A=>A.ackKey.startsWith("voucher:")):[],y=c&&!u;return s("div",{class:"jex-magicline-review-wrap",children:[s("div",{class:b?"jex-magicline-review-body jex-magicline-review-body--reloading":"jex-magicline-review-body","aria-busy":b,children:[s("dl",{class:"jex-magicline-summary",children:[s("div",{class:"jex-magicline-summary-row",children:[s("dt",{children:k.magiclineReviewOffer}),s("dd",{children:M})]}),s("div",{class:"jex-magicline-summary-row",children:[s("dt",{children:k.magiclineReviewBasePrice}),s("dd",{children:[f!==null&&f.voucherType==="DISCOUNT"?at(f.discountedBasePrice,w.currencyCode,r):at(w.basePrice,w.currencyCode,r)," ",na(w.paymentFrequency.value,w.paymentFrequency.unit,r)]})]}),f!==null&&f.voucherType==="DISCOUNT"?s("div",{class:"jex-magicline-summary-row jex-magicline-voucher-discount-row",children:[s("dt",{children:k.magiclineVoucherAppliedDiscount.replace("{discount}",Vg(f.discountValue,f.discountType,w.currencyCode,r))}),s("dd",{})]}):null,f!==null&&f.remarks!==null&&f.remarks!==""?s("div",{class:"jex-magicline-summary-row jex-magicline-voucher-remarks-row",children:[s("dt",{children:k.magiclineVoucherRemarks}),s("dd",{children:f.remarks})]}):null,w.flatFees.map((A,z)=>s("div",{class:"jex-magicline-summary-row",children:[s("dt",{children:Dc(A.name,k)}),s("dd",{children:at(A.price,w.currencyCode,r)})]},`${A.name}-${z}`)),w.preUseCharge>0?s("div",{class:"jex-magicline-summary-row",children:[s("dt",{children:k.magiclineReviewPreUseCharge}),s("dd",{children:at(w.preUseCharge,w.currencyCode,r)})]}):null]}),w.modules.length>0?s("dl",{class:"jex-magicline-summary jex-magicline-summary-section",children:[s("div",{class:"jex-magicline-summary-heading",children:k.magiclineReviewSelectedUpgrades}),w.modules.map((A,z)=>s("div",{class:"jex-magicline-summary-row",children:[s("dt",{children:A.name}),s("dd",{children:at(A.amount,A.currencyCode,r)})]},`${A.moduleId}-${z}`))]}):null,I!==null&&I.total!==null?s("dl",{class:"jex-magicline-summary jex-magicline-summary-section jex-magicline-summary-totals",children:s("div",{class:"jex-magicline-summary-row jex-magicline-summary-total-row",children:[s("dt",{children:f!==null&&f.voucherType==="DISCOUNT"?k.magiclineGesamtpreisBeforeDiscount:k.magiclineReviewContractVolume}),s("dd",{children:at(I.total,w.currencyCode,r)})]})}):null,f!==null&&f.voucherType==="CREDIT"?s("div",{class:"jex-magicline-voucher-credit-notice",role:"note",children:k.magiclineVoucherCreditNotice}):null,s("dl",{class:"jex-magicline-summary jex-magicline-summary-section",children:[s("div",{class:"jex-magicline-summary-row",children:[s("dt",{children:k.magiclineReviewStartsOn}),s("dd",{children:Bg(w.startDate,r)})]}),s("div",{class:"jex-magicline-summary-row",children:[s("dt",{children:k.magiclineSummaryName}),s("dd",{children:C!==""?C:"—"})]}),s("div",{class:"jex-magicline-summary-row",children:[s("dt",{children:k.magiclineSummaryAddress}),s("dd",{children:T})]}),s("div",{class:"jex-magicline-summary-row",children:[s("dt",{children:k.magiclineReviewPayment}),s("dd",{children:Fg(t.payment.iban)})]})]}),y?s("div",{class:"jex-magicline-voucher-section",children:[s("div",{class:"jex-magicline-field jex-magicline-voucher-field",children:[s("input",{class:"jex-form-input",type:"text","aria-label":k.magiclineVoucherLabel,placeholder:k.magiclineVoucherPlaceholder,value:m,disabled:i||d==="applying",onInput:A=>{x(A.currentTarget.value)}}),s("button",{type:"button",class:"jex-magicline-voucher-apply",disabled:i||d==="applying"||m.trim()==="",onClick:v,children:k.magiclineVoucherApply})]}),p!==null?s("div",{class:"jex-magicline-error",role:"alert",children:p}):null]}):null,B.length>0?s("div",{class:"jex-magicline-terms",role:"group","aria-label":k.magiclineReviewSelectedUpgrades,children:[s("div",{class:"jex-magicline-upgrades-recap-title",children:k.magiclineReviewSelectedUpgrades}),B.map(({module:A,consent:z})=>s(Hc,{title:z.title!==""?z.title:A.name,text:z.text,attachmentLabel:z.attachmentLabel,attachmentUrl:z.attachmentUrl},z.ackKey))]}):null,P.length>0||le.length>0||D.length>0?s("div",{class:"jex-magicline-terms",role:"group","aria-label":k.magiclineReviewTerms,children:[P.length>0||D.length>0?s("div",{class:"jex-magicline-terms-prompt",children:[k.magiclineConfirmPrompt,s("span",{class:"jex-magicline-required-pill",children:k.magiclineRequired})]}):null,P.map(A=>s(ia,{ackKey:A.ackKey,title:A.title,text:A.text,attachmentLabel:A.attachmentLabel,attachmentUrl:A.attachmentUrl,checked:o[A.ackKey]===!0,disabled:i,onToggle:a},A.ackKey)),D.map(A=>s(ia,{ackKey:A.ackKey,title:A.title,text:A.text,attachmentLabel:A.attachmentLabel,attachmentUrl:A.attachmentUrl,checked:o[A.ackKey]===!0,disabled:i,onToggle:a},A.ackKey)),le.map((A,z)=>s(Hc,{title:A.title,text:A.text,attachmentLabel:A.attachmentLabel,attachmentUrl:A.attachmentUrl},`${A.title}-${z}`))]}):null]}),b?s("div",{class:"jex-magicline-review-overlay","aria-hidden":"true",children:s("span",{class:"jex-magicline-review-spinner"})}):null]})}function ia({ackKey:t,title:e,text:n,attachmentLabel:r,attachmentUrl:i,checked:o,disabled:a,onToggle:l,showRequiredPill:c=!1}){const u=L(),d=`jex-ml-ack-${t}`;return s("div",{class:"jex-magicline-consent-region",children:[c?s("span",{class:"jex-magicline-required-pill",children:u.magiclineRequired}):null,s("label",{class:"jex-magicline-consent",for:d,children:[s("input",{id:d,type:"checkbox",checked:o,disabled:a,onChange:m=>{l(t,m.currentTarget.checked)}}),s("span",{class:"jex-magicline-consent-body",children:[e!==""?s("span",{class:"jex-magicline-terms-title",children:e}):null,s("span",{class:"jex-magicline-terms-content",children:[n,i!==null?s(ne,{children:[" ",s("a",{href:i,target:"_blank",rel:"noopener noreferrer",class:"jex-privacy-notice-link",children:r!==null&&r!==""?r:i})]}):null]})]})]})]})}function Hc({title:t,text:e,attachmentLabel:n,attachmentUrl:r}){return s("div",{class:"jex-magicline-consent-recap",children:[t!==""?s("span",{class:"jex-magicline-terms-title",children:t}):null,s("span",{class:"jex-magicline-terms-content",children:[e,r!==null?s(ne,{children:[" ",s("a",{href:r,target:"_blank",rel:"noopener noreferrer",class:"jex-privacy-notice-link",children:n!==null&&n!==""?n:r})]}):null]})]})}function yt({label:t,value:e,fieldKey:n,type:r="text",required:i=!1,disabled:o,error:a,onInput:l}){const c=a!==void 0?`jex-ml-err-${n}`:void 0;return s("div",{class:"jex-magicline-field",children:[s("input",{class:"jex-form-input",type:r,"aria-label":t,placeholder:t,value:e,required:i,disabled:o,"aria-invalid":a!==void 0,"aria-describedby":c,onInput:u=>{l(u.currentTarget.value)}}),a!==void 0?s("span",{id:c,class:"jex-magicline-error",role:"alert",children:a}):null]})}function Cx({label:t,value:e,required:n,disabled:r,placeholder:i,error:o,options:a,onChange:l}){return s("div",{class:"jex-magicline-field",children:[s("select",{class:"jex-form-input jex-magicline-select","aria-label":t,value:e,required:n,disabled:r,"aria-invalid":o!==void 0,onChange:c=>{l(c.currentTarget.value)},children:[s("option",{value:"",disabled:n,children:i}),a.map(c=>s("option",{value:c.value,children:c.label},c.value))]}),o!==void 0?s("span",{class:"jex-magicline-error",role:"alert",children:o}):null]})}function Ax(t){return t===null?[]:t.split(`
82
+ `).map(e=>e.replace(/^\s*[-•]\s*/,"").trim()).filter(e=>e!=="")}function Rx(t){const e=[],n=new Map;for(const r of t){let i=n.get(r.bundleId);i||(i={bundleId:r.bundleId,bundleName:r.bundleName,bundleDescription:r.bundleDescription,bundleSubDescription:r.bundleSubDescription,footnote:r.footnote,terms:[]},n.set(r.bundleId,i),e.push(i)),i.terms.push(r)}return e}function Ex(t,e){switch(t){case"offer":return e.magiclineStepOffer;case"upgrades":return e.magiclineStepUpgrades;case"personal":return e.magiclineStepPersonal;case"address":return e.magiclineStepAddress;case"payment":return e.magiclineStepPayment;case"review":return e.magiclineStepReview;default:return""}}function Ix(t,e){return t==="MALE"?e.magiclineGenderMale:t==="FEMALE"?e.magiclineGenderFemale:e.magiclineGenderUnisex}function Mx({message:t,sessionId:e,visitorId:n}){const r=L(),i=t.magiclineForm,o=!!i&&i.status==="open"&&!!i.submissionId,a=gt(se.functions.magicline.public.getSubmissionStatus,o&&i?.submissionId?{sessionId:e,visitorId:n,submissionId:i.submissionId}:"skip");if(!i)return null;if(i.action==="contractCreation")return t.projectId?s(xx,{formMessageId:t._id,sessionId:e,visitorId:n,projectId:t.projectId,formStatus:i.status}):null;if(i.status==="submitted")return s("div",{class:"jex-inline-form-submitted",children:[s("span",{class:"jex-inline-form-check",children:"✓"}),s("div",{children:[s("div",{class:"jex-inline-form-submitted-title",children:r.magiclineTrialSuccessTitle}),s("div",{class:"jex-inline-form-submitted-detail",children:r.magiclineTrialSuccessDetail})]})]});if(i.status==="failed")return s("div",{class:"jex-inline-form-submitted jex-magicline-failed",children:[s("span",{class:"jex-inline-form-check jex-magicline-failed-icon",children:"!"}),s("div",{children:[s("div",{class:"jex-inline-form-submitted-title",children:r.magiclineFailed}),s("div",{class:"jex-inline-form-submitted-detail",children:r.magiclineFailedDetail})]})]});if(i.action!=="trialSessionBooking")return null;const l=a!=null&&a.errorCode==="slot_unavailable",c=o&&a===void 0;return s(Xg,{formMessageId:t._id,sessionId:e,visitorId:n,slotUnavailable:l,retryPending:c})}const Px={crawl:"🌐",file:"📄",snippet:"💡",qa:"❓"};function Nx({sources:t}){const e=L(),[n,r]=$(!1);return t.length===0?null:s("div",{class:"jex-sources-row",children:[s("button",{type:"button",class:"jex-sources-toggle",onClick:()=>{r(i=>!i)},"aria-expanded":n,children:[s("span",{class:"jex-sources-icon",children:"📖"}),s("span",{children:(t.length===1?e.sourcesCountOne:e.sourcesCountOther).replace("{count}",String(t.length))}),s("span",{class:`jex-sources-chevron${n?" jex-sources-chevron--open":""}`,children:"▾"})]}),n?s("div",{class:"jex-sources-pills",children:t.map((i,o)=>{const a=!!i.url,l=Ox(i),c=a?`${i.title}
83
+ ${i.url}`:i.title,u=s(ne,{children:[typeof i.id=="number"?s("span",{class:"jex-source-id",children:i.id}):null,s("span",{class:"jex-source-type",children:Px[i.sourceType]}),s("span",{class:"jex-source-label",children:l}),s("span",{class:"jex-source-score",children:["· ",i.score.toFixed(2)]})]});return a&&i.url?s("a",{class:"jex-source-pill",href:i.url,target:"_blank",rel:"noopener noreferrer",title:c,children:u},o):s("span",{class:"jex-source-pill",title:c,children:u},o)})}):null]})}function Ox(t){if(t.sourceType==="crawl"&&t.url)try{const e=new URL(t.url);return!e.pathname||e.pathname==="/"?e.hostname:e.pathname}catch{}return t.title}const Lx=840*1e3;function $x(t){return t<1024*1024?`${Math.max(1,Math.round(t/1024))} KB`:`${(t/1024/1024).toFixed(1)} MB`}function Dx({items:t,sessionId:e,visitorId:n,align:r}){const i=L(),o=Jt(se.conversationAttachments.visitor.mintUrls),[a,l]=$(()=>new Map),[c,u]=$(()=>new Set),[d,m]=$(0),[f,p]=$(!1),x=t.filter(v=>v.available).map(v=>v._id).join(",");return N(()=>{if(x==="")return;let v=!0;const k=x.split(",");o({sessionId:e,visitorId:n,attachmentIds:k}).then(b=>{v&&(l(new Map(b.map(I=>[I.attachmentId,I.url]))),p(!1))},b=>{J.error("[jexity] Could not load files",b),v&&p(!0)});const w=setTimeout(()=>{m(b=>b+1)},Lx);return()=>{v=!1,clearTimeout(w)}},[x,e,n,o,d]),t.length===0?null:s(ne,{children:[s("div",{class:`jex-msg-files jex-msg-files-${r}`,children:t.map(v=>{if(!v.available)return s("div",{class:"jex-msg-file-card jex-msg-file-unavailable",title:v.name,children:[s(pp,{size:16,"aria-hidden":"true"}),s("span",{class:"jex-msg-file-text",children:[s("span",{class:"jex-msg-file-name",children:v.name}),s("span",{class:"jex-msg-file-meta",children:i.attachmentUnavailable})]})]},v._id);const k=a.get(v._id),w=i.attachmentOpen.replace("{name}",v.name);if(v.kind==="image"&&!c.has(v._id)&&!(f&&!k))return k?s("a",{class:"jex-msg-file-thumb",href:k,target:"_blank",rel:"noopener noreferrer","aria-label":w,children:s("img",{src:k,alt:"",loading:"lazy",onError:()=>{u(I=>new Set(I).add(v._id))}})},v._id):s("span",{class:"jex-msg-file-thumb jex-msg-file-pending","aria-hidden":"true"},v._id);const b=s(ne,{children:[s(fp,{size:16,"aria-hidden":"true"}),s("span",{class:"jex-msg-file-text",children:[s("span",{class:"jex-msg-file-name",children:v.name}),s("span",{class:"jex-msg-file-meta",children:[v.extension.toUpperCase()," · ",$x(v.sizeBytes)]})]})]});return k?s("a",{class:"jex-msg-file-card",href:k,target:"_blank",rel:"noopener noreferrer","aria-label":w,children:b},v._id):s("span",{class:"jex-msg-file-card","aria-disabled":"true",children:b},v._id)})}),f&&s("p",{class:`jex-msg-files-error jex-msg-files-${r}`,role:"alert",children:[i.attachmentLoadFailed," ",s("button",{type:"button",class:"jex-msg-files-retry",onClick:()=>{p(!1),m(v=>v+1)},children:i.attachmentRetry})]})]})}function zx(){return s("div",{class:"jex-typing",children:[s("span",{}),s("span",{}),s("span",{})]})}const qx=/\s?\[\d+\]/g;function pi(t){return t.replace(qx,"")}function Fx(t){return t?.at(-1)?._creationTime??0}function Bx(t){return{id:t._id,content:pi(t.content),role:t.role,authorName:t.authorName}}function Wc(t,e){return(t.replyToIds&&t.replyToIds.length>0?t.replyToIds:t.replyToId?[t.replyToId]:[]).map(r=>e?.find(i=>i._id===r)).filter(r=>r!==void 0).map(Bx)}function Qc(t,e){const r=e.getRootNode().getElementById(`jex-msg-${t}`);r&&(r.scrollIntoView({behavior:"smooth",block:"center"}),r.classList.add("jex-msg-highlight"),setTimeout(()=>{r.classList.remove("jex-msg-highlight")},1500))}function Ux(t){if(!t)return[];const e=new Set;for(const n of t)n.authorId&&n.authorName&&e.add(n.authorName),n.noticeKind==="agent-joined"&&n.noticeData?.agentName&&e.add(n.noticeData.agentName);return[...e]}const Vx=6e4;function Hx({conversations:t,attachments:e,greeting:n,botName:r,starterQuestions:i,onPickStarter:o,sessionNotFound:a,resumeFailed:l,onStartFresh:c,sessionId:u,visitorId:d}){const m=L(),f=oe(null),[p,x]=$(null),[v,k]=$(()=>Date.now()),w=(t??[]).some(y=>y.status==="streaming"&&y.content==="");N(()=>{if(!w)return;const y=setInterval(()=>k(Date.now()),1e4);return()=>clearInterval(y)},[w]);const b=Fx(t),I=Ux(t),C=new Map;for(const y of e??[])C.set(y.messageId,[...C.get(y.messageId)??[],y]);const E=Ic(),T=hi(),M=t?.find(y=>y.role==="user"&&y.content.trim()!=="")?.content;N(()=>{d&&M&&Nf(d,M)},[d,M]);const P=oe(null);N(()=>{if(!d||!t)return;const y=t.at(-1);y&&y.role==="assistant"&&y.status!=="streaming"&&y._id!==P.current&&(P.current=y._id,wo(d))},[t,d]);const le=t?.at(-1)?.content;N(()=>{f.current?.scrollIntoView({behavior:"smooth"})},[t?.length,le]);const B=u===null||t!==void 0&&t.length===0,D=i.length>0&&!a&&!l&&B;return s("div",{class:"jex-chat-messages",children:[s(on,{text:n,botName:r}),D?s(Sg,{questions:i,disabled:ei.value,onPick:o}):null,a&&l&&c?s("div",{class:"jex-session-prompt",children:[s("div",{class:"jex-session-prompt-text",children:m.sessionNotFoundPrompt}),s("button",{class:"jex-session-prompt-btn",type:"button",onClick:()=>{c()},children:m.startNewConversation})]}):a?s("div",{class:"jex-session-notice",children:m.sessionNotFound}):null,t?.map(y=>{if(y.contentType==="human-notice"){const ce=y.noticeKind==="agent-joined"?m.noticeAgentJoined.replace("{name}",y.noticeData?.agentName??""):y.noticeKind==="human-requested"?m.noticeHumanRequested:y.noticeKind==="human-requested-form"?m.noticeHumanRequestedForm:y.noticeKind==="message-received"?m.noticeMessageReceived:y.noticeKind==="agent-handling"?m.noticeAgentHandling:y.noticeKind==="ai-resumed"?m.noticeAiResumed:y.content;return s(on,{text:ce,botName:r},y._id)}if(y.contentType==="escalation-form"&&u&&d)return Df.value==="screen"&&!y.formData?p===y._id?null:s("div",{class:"jex-inline-form jex-inline-form-card",children:[s("div",{class:"jex-inline-form-title",children:m.escalationPromptTitle}),s("div",{class:"jex-inline-form-subtitle",children:m.escalationPromptSubtitle}),s("button",{class:"jex-form-submit",type:"button",onClick:()=>{T({formMessageId:y._id,sessionId:u,visitorId:d}),bt({id:"escalation-form",formMessageId:y._id,sessionId:u,visitorId:d,waitingSetAt:b})},children:m.escalationPromptSubmit}),s("button",{class:"jex-escalation-skip",type:"button",onClick:()=>{E({formMessageId:y._id,sessionId:u,visitorId:d,waitingSetAt:b}),x(y._id)},children:m.escalationSkip})]},y._id):s(Ag,{message:y,sessionId:u,visitorId:d,waitingSetAt:b},y._id);if(y.contentType==="magicline-form"&&u&&d)return s(Mx,{message:y,sessionId:u,visitorId:d},y._id);if(y.contentType==="escalation-confirm"){const ce=y.noticeKind==="escalation-confirmed"?m.noticeEscalationConfirmed.replace("{name}",y.noticeData?.visitorName??"").replace("{email}",y.noticeData?.visitorEmail??"").replace("{ref}",y.noticeData?.visitorId??""):y.content;return s(on,{text:ce,botName:r},y._id)}const A=C.get(y._id)??[],z=A.length>0&&u&&d?s(Dx,{items:A,sessionId:u,visitorId:d,align:y.role==="user"?"user":"bot"}):null;if(y.role==="user"){const ce=Wc(y,t);return s(ne,{children:[(y.content!==""||A.length===0)&&s(Cg,{id:`jex-msg-${y._id}`,text:y.content,botName:r,onQuote:()=>{Ao({id:y._id,content:y.content,role:"user"})},quoted:ce,onQuotedClick:(Ne,st)=>{Qc(Ne,st.currentTarget)},agentNames:I}),z]},y._id)}const ae={authorId:y.authorId,authorName:y.authorName,authorImage:y.authorImage};if(y.status==="streaming"&&y.content==="")return v-y._creationTime>Vx?s(on,{id:`jex-msg-${y._id}`,text:`${m.somethingWentWrong}. ${m.tryAgain}.`,error:!0,botName:r,...ae},y._id):s(zx,{},y._id);if(y.status==="streaming")return s(on,{id:`jex-msg-${y._id}`,text:pi(y.content),streaming:!0,botName:r,...ae},y._id);if(y.status==="error")return s(on,{id:`jex-msg-${y._id}`,text:y.errorMessage??`${m.somethingWentWrong}. ${m.tryAgain}.`,error:!0,botName:r,...ae},y._id);const Y=Wc(y,t);return s("div",{children:[(y.content!==""||A.length===0)&&s(on,{id:`jex-msg-${y._id}`,text:pi(y.content),botName:r,onQuote:()=>{Ao({id:y._id,content:pi(y.content),role:"assistant",authorName:y.authorName})},quoted:Y,onQuotedClick:(ce,Ne)=>{Qc(ce,Ne.currentTarget)},...ae}),z,y.sources&&y.sources.length>0?s(Nx,{sources:y.sources}):null]},y._id)}),s("div",{ref:f})]})}function Wx(){const t=L();function e(){const n=sr.peek();n&&(zl(),bt({id:"escalation-form",formMessageId:n.formMessageId,sessionId:n.sessionId,visitorId:n.visitorId,waitingSetAt:n.waitingSetAt}))}return s("div",{class:"jex-waiting-card",role:"status","aria-live":"polite",children:[s("div",{class:"jex-waiting-indicator","aria-hidden":"true",children:[s("span",{class:"jex-waiting-dot"}),s("span",{class:"jex-waiting-ripple"})]}),s("div",{class:"jex-waiting-body",children:[s("div",{class:"jex-waiting-title",children:t.waitingTitle}),s("div",{class:"jex-waiting-subtitle",children:t.waitingSubtitle}),s("button",{class:"jex-waiting-leave-email",type:"button",onClick:e,children:t.waitingLeaveEmail})]})]})}function Gc({message:t}){const[e,n]=$(!1);return N(()=>{const r=setTimeout(()=>{n(!0)},80);return()=>{clearTimeout(r)}},[]),e?s("div",{class:"jex-overlay jex-loading",children:[s("div",{class:"jex-loading-spinner","aria-hidden":"true"}),t&&s("p",{class:"jex-loading-message",children:t})]}):null}function Qx({sessionId:t,visitorId:e}){const n=t&&e?{sessionId:t,visitorId:e,...lr()}:"skip",r=gt(se.functions.chat.public.conversations.listBySession,n),i=gt(se.functions.chat.public.sessions.getSessionStatus,n),o=gt(se.conversationAttachments.visitor.list,n),a=t!==null&&r===void 0,l=r?.some(c=>c.status==="streaming")??!1;return{conversations:r,sessionStatus:i??null,isLoading:a,isStreaming:l,attachments:o}}function Gx(t){const e=L(),n=oe(null),r=oe(null),[i,o]=$(!1);N(()=>{try{n.current=document.title}catch{}},[]),N(()=>{if(!t||t.length===0)return;const a=t[t.length-1];if(!a)return;if(r.current===null){r.current=a._id;return}if(a._id===r.current)return;r.current=a._id;const l=a.role!=="user";let c=!1;try{c=document.hidden}catch{}l&&c&&o(!0)},[t]),N(()=>{if(!i)return;let a=null,l=!1;const c=()=>{if(a!==null){try{clearInterval(a)}catch{}a=null}try{n.current!==null&&(document.title=n.current)}catch{}};try{a=setInterval(()=>{try{const u=`💬 ${e.newReplyTitle}`;document.title=l?n.current??"":u,l=!l}catch{c()}},1200)}catch{}return c},[i,e.newReplyTitle]),N(()=>{const a=()=>{try{document.hidden||o(!1)}catch{}};try{document.addEventListener("visibilitychange",a)}catch{}return()=>{try{document.removeEventListener("visibilitychange",a)}catch{}}},[])}function Kx({sessionId:t,visitorId:e}){const n=xt(se.functions.chat.public.visitorPresence.heartbeat);N(()=>{if(!t||!e)return;let r=null;const i=()=>{n({sessionId:t,visitorId:e}).catch(()=>{})},o=()=>{r===null&&(r=setInterval(i,6e4))},a=()=>{r!==null&&(clearInterval(r),r=null)},l=()=>{document.visibilityState==="visible"?(i(),o()):a()};return l(),document.addEventListener("visibilitychange",l),()=>{document.removeEventListener("visibilitychange",l),a()}},[t,e,n])}function Yx(){return xt(se.escalations.public.createEscalationRequest)}function Kc({sessionId:t,visitorId:e,ensureSession:n,onSkipForm:r}){const i=L(),o=Yx(),[a,l]=$(!1),[c,u]=$(null);async function d(){if(!a){l(!0),u(null);try{const m=t&&e?{sessionId:t,visitorId:e}:await n();if(!m)return;const f=rt.value;if(!f)return;const p=await o({sessionId:m.sessionId,visitorId:m.visitorId,bootstrapToken:f,locale:Qe.value});if(p.skipForm){r?.();return}bt({id:"escalation-form",formMessageId:p.formMessageId,sessionId:m.sessionId,visitorId:m.visitorId,waitingSetAt:p.waitingSetAt})}catch(m){const f=m instanceof Error?m.message:String(m);u(/RATE_LIMITED|Too many/.test(f)?i.handoffRateLimited:i.handoffFailed)}finally{l(!1)}}}return{requestHuman:d,busy:a,error:c}}function Jx({greeting:t,botName:e,starterQuestions:n,sessionId:r,visitorId:i,isLoading:o,sessionNotFound:a,resumeFailed:l,isOrgDeleted:c,ensureSession:u,startFresh:d,maintenance:m}){const f=L(),{conversations:p,sessionStatus:x,isLoading:v,isStreaming:k,attachments:w}=Qx({sessionId:r,visitorId:i});Gx(p),Kx({sessionId:r,visitorId:i}),N(()=>{const B=sr.peek();if(B===null||!p||p.length===0)return;const{waitingSetAt:D}=B;p.some(A=>A._creationTime>D&&(A.noticeKind==="agent-joined"||!!A.authorId))&&zl()},[p]);const b=ql({sessionId:r,visitorId:i,ensureSession:u}),I=oe((()=>{const B=_n.peek();return B!==null?B:vo.peek()&&Ie.peek()!==null?"resume":"fresh"})()).current,{requestHuman:C,error:E}=Kc({sessionId:r,visitorId:i,ensureSession:u}),T=ra(()=>{C()});N(()=>{I==="escalate"&&T()},[I]),N(()=>{_n.value=null},[]),N(()=>{Ie.peek()!==null&&u()},[u]);const M=I==="resume"&&!Mt.value&&(!r||v),P=Zn.value,le=ra(B=>{b(B)});return N(()=>{!P||M||(Zn.value=null,!m&&!c&&le(P))},[P,M,m,c]),N(()=>{i&&wo(i)},[i]),c?s("div",{class:"jex-chat-messages",children:s("div",{class:"jex-session-notice",children:f.chatNoLongerAvailable})}):M?s(Gc,{message:f.resumeConversation}):s(ne,{children:[s(Hx,{conversations:p,attachments:w,greeting:t,botName:e,starterQuestions:n,onPickStarter:B=>{b(B)},sessionNotFound:a,resumeFailed:l,onStartFresh:d,sessionId:r,visitorId:i}),sr.value!==null&&s(Wx,{}),E&&s("div",{class:"jex-session-error-notice",role:"alert",style:{margin:"8px 16px 0"},children:E}),s(Jp,{sessionId:r,visitorId:i,isLoading:o,isStreaming:k,sessionStatus:x,ensureSession:u,onStartFresh:d,maintenance:m})]})}function Xx({formMessageId:t,sessionId:e,visitorId:n,availability:r}){const i=L(),o=tr.value,a=/^https?:\/\//i.test(o)?o:er,[l,c]=$(""),[u,d]=$(""),m=Mc(e,n),f=m?.name??l,p=m?.email??u,x=r&&!r.anyOnline?i.escalationOfflineSubtitle:i.escalationSubtitle,v=Ec(),k=hi(),[w,b]=$(!1),[I,C]=$(null);async function E(T){T.preventDefault(),b(!0),C(null);try{await v({sessionId:e,visitorId:n,formMessageId:t,visitorName:f.trim(),visitorEmail:p.trim(),locale:Qe.value}),ko()}catch(M){J.error("[EscalationFormScreen] Submit failed:",M),C(i.escalationSubmitFailed)}finally{b(!1)}}return s("div",{class:"jex-form-screen",children:[s("h2",{class:"jex-form-title",children:i.escalationFormTitle}),s("p",{class:"jex-escalation-subtitle",children:x}),m&&s("p",{class:"jex-escalation-subtitle",children:i.escalationFromAccount}),I&&s("div",{class:"jex-form-error",role:"alert",children:I}),s("form",{class:"jex-form",onSubmit:T=>{E(T)},children:[s("input",{class:"jex-form-input",type:"text",placeholder:i.escalationNameLabel,value:f,required:!0,readOnly:!!m,onInput:T=>{c(T.currentTarget.value)}}),s("input",{class:"jex-form-input",type:"email",placeholder:i.escalationEmailLabel,value:p,required:!0,readOnly:!!m,onInput:T=>{d(T.currentTarget.value)}}),s("button",{class:"jex-form-submit",type:"submit",disabled:w,onClick:()=>{k({sessionId:e,visitorId:n,formMessageId:t})},children:i.escalationSubmit})]}),s("div",{class:"jex-inline-form-consent",style:{textAlign:"center",margin:"16px 0 8px 0"},children:[i.escalationConsent," ",s("a",{href:a,target:"_blank",rel:"noopener noreferrer",class:"jex-privacy-notice-link",children:i.escalationPrivacyLinkText}),"."]})]})}function Zx(t,e){const n=gt(se.functions.chat.public.availability.getChatAvailability,t&&e?{orgSlug:t,projSlug:e}:"skip"),r=gt(se.functions.chat.public.availability.getOrgAvailability,t&&!e?{orgSlug:t}:"skip");return e?n:r}function Yc(t){return t?.anyOnline?"online":t?.anyAway?"away":"offline"}function Jc({sessionId:t,visitorId:e,ensureSession:n,availability:r}){const i=L(),{requestHuman:o,busy:a,error:l}=Kc({sessionId:t,visitorId:e,ensureSession:n}),c=sl(),u=`jex-presence-dot--${Yc(r)}`,d=c?i.handoffMaintenance:r?r.anyOnline?i.handoffAvailable:i.handoffOffline:i.talkToHuman;return s(ne,{children:[s("button",{class:"jex-header-handoff",type:"button",onClick:()=>{o()},disabled:a||c,"aria-label":i.talkToHumanAria,title:d,children:[s("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",children:[s("path",{d:"M3 14v-3a9 9 0 0 1 18 0v3"}),s("path",{d:"M21 14a2 2 0 0 1-2 2h-1a1 1 0 0 1-1-1v-4a1 1 0 0 1 1-1h3z"}),s("path",{d:"M3 14a2 2 0 0 0 2 2h1a1 1 0 0 0 1-1v-4a1 1 0 0 0-1-1H3z"}),s("path",{d:"M21 14v3a4 4 0 0 1-4 4h-3"})]}),r!==void 0&&s("span",{class:`jex-presence-dot ${u}`,"aria-hidden":"true"})]}),l&&s("div",{class:"jex-handoff-error",role:"alert",children:l})]})}let Xc=0;async function oa(){const t=++Xc,e=il.value;if(!e)return J.warn("[JexityChat] Bootstrap refresh skipped — inputs missing"),{ok:!1,reason:"no-inputs"};const n=await uo({...e,userToken:so.value});if(t!==Xc)return{ok:!1,reason:"superseded"};if(!n.ok)return J.warn(n.error==="signed_in_user"?ho(n):"[JexityChat] Bootstrap refresh failed:",n.error),{ok:!1,reason:n.error==="signed_in_user"&&n.reason==="not_available"?"sign_in_paused":n.error};const r=n.token;rt.value=r;const i=Wr.peek();return Wr.value={sub:n.subject},i&&i.sub!==n.subject&&Kr(),{ok:!0,token:r}}function Zc(t){return Dl(t)?"maintenance":eu(t)?"unauthorized":t instanceof Error&&/network|fetch|failed to fetch/i.test(t.message)?"network":"unknown"}function eu(t){return t instanceof xn?t.data?.code==="UNAUTHORIZED_ORIGIN":!1}function eb(t){return t==="rate_limited"?"network":t==="signed_in_user"?"signed-out":t==="sign_in_paused"?"unavailable":"unauthorized"}function tb(t=1e4){return rt.value?Promise.resolve(rt.value):new Promise(e=>{let n=!1;const r=a=>{n||(n=!0,clearTimeout(i),o(),e(a))},i=setTimeout(()=>{r(null)},t),o=rt.subscribe(a=>{a&&r(a)})})}function nb(t,e){const n=oe(null),r=kn(!1),i=kn(!1),o=kn(!1),a=kn(null),l=xt(se.functions.chat.public.sessions.createOrResume),c=re(async p=>{let x=p,v=!1;const k=await tb();if(!k)return J.warn("[JexityChat] No bootstrap token after 10s — session creation blocked."),Mt.value="no-token",null;const w=C=>({orgSlug:t,...e?{projSlug:e}:{},visitorId:x,bootstrapToken:C,locale:Qe.value,...Hr.value?{source:Hr.value}:{},...typeof window<"u"?{pagePath:window.location.pathname}:{}});jo.value=!0;let b;try{const C=async E=>{const T=await l(w(E));if(!("kind"in T))return T;If(),x=yo(),v=!0;const M=await l(w(E));if("kind"in M)throw new Error("A new conversation was refused as another user's");return M};try{b=await C(k)}catch(E){if(!eu(E))throw E;const T=await oa();if(!T.ok)return Mt.value=eb(T.reason),null;b=await C(T.token)}}finally{jo.value=!1}Mt.value=null,a.value=b.status;const I={sessionId:b.sessionId,visitorId:x};return n.current=I,{session:I,result:b,startedOver:v}},[t,e,l,a]),u=re(async()=>{if(n.current)return n.current;if(o.value)return null;r.value=!0;const p=Ie.value!==null,x=Ie.value??yo();try{const v=await c(x);return v?(p&&v.result.isNew&&!v.startedOver&&(i.value=!0,o.value=!0),v.session):null}catch(v){return J.error("[JexityChat] Failed to create session:",v),Mt.value=Zc(v),null}finally{r.value=!1}},[c,r,i,o]),d=re(()=>{n.current=null,i.value=!1,o.value=!1,Il(),jn.value=null},[i,o]);N(()=>qf(d),[d]);const m=re(async()=>{n.current=null,o.value=!1,i.value=!1,Il(),jn.value=null;const p=yo();r.value=!0;try{return(await c(p))?.session??null}catch(x){return J.error("[JexityChat] Failed to create fresh session:",x),Mt.value=Zc(x),null}finally{r.value=!1}},[c,r,i,o]),f=n.current;return{sessionId:f?.sessionId??null,visitorId:f?.visitorId??null,isLoading:r.value,sessionNotFound:i.value,resumeFailed:o.value,sessionStatus:a.value,isOrgDeleted:a.value==="org_deleted",ensureSession:u,startFresh:m,resetSession:d}}const xr=20;function rb({entries:t,canDelete:e,maintenance:n,selecting:r,onSelectingChange:i,onOpen:o,onCopy:a,onDelete:l}){const c=L(),[u,d]=$(null),[m,f]=$([]),p=oe(null),x=oe(null);N(()=>{if(u===null)return;p.current?.querySelector('[role="menuitem"]:not(:disabled)')?.focus();const C=T=>{p.current&&!T.composedPath().includes(p.current)&&d(null)},E=T=>{T.key==="Escape"&&(d(null),x.current?.focus())};return document.addEventListener("pointerdown",C),document.addEventListener("keydown",E),()=>{document.removeEventListener("pointerdown",C),document.removeEventListener("keydown",E)}},[u]);function v(){d(null),f([]),i(!0)}function k(C){f(E=>E.includes(C)?E.filter(T=>T!==C):[...E,C])}function w(C){return s("span",{class:"jex-home-row-meta",children:[s("span",{class:"jex-home-row-ref",children:C.ref})," · ",c.resumeListTimestamp.replace("{minutes}",String(Math.max(1,Math.round((Date.now()-C.lastActivityAt)/6e4))))]})}const b=t.filter(C=>m.includes(C.ref)),I=b.length>=Math.min(t.length,xr);return s(ne,{children:[s("div",{class:"jex-home-list-head",children:[r?s("span",{class:"jex-home-select-count",children:c.selectedCount.replace("{count}",String(b.length)).replace("{total}",String(t.length))}):s("span",{class:"jex-home-section-label",children:c.pickUpWhereLeftOff}),e&&s("button",{type:"button",class:"jex-home-list-link",onClick:r?()=>{i(!1)}:v,children:r?c.cancel:c.selectChats})]}),s("ul",{class:"jex-home-list",children:t.map(C=>{const E=s("span",{class:"jex-home-row-title",children:C.firstMessage??c.resumeListLabel});if(r){const M=m.includes(C.ref);return s("li",{class:`jex-home-row${M?" jex-home-row--checked":""}`,children:s("label",{class:"jex-home-row-check",children:[s("input",{type:"checkbox",checked:M,disabled:!M&&b.length>=xr,onChange:()=>{k(C.ref)}}),s("span",{class:"jex-home-row-text",children:[E,w(C)]})]})},C.ref)}const T=u===C.ref;return s("li",{class:"jex-home-row",children:[s("button",{type:"button",class:"jex-home-row-open",onClick:()=>{o(C.ref)},children:[s("span",{class:"jex-home-row-icon","aria-hidden":"true",children:s(Xr,{size:15})}),s("span",{class:"jex-home-row-text",children:[E,w(C)]})]}),s("div",{class:"jex-home-row-more",ref:T?p:void 0,children:[s("button",{type:"button",class:"jex-home-row-menu-btn","aria-haspopup":"menu","aria-expanded":T,"aria-label":c.chatOptionsAria.replace("{ref}",C.ref),onClick:M=>{x.current=M.currentTarget,d(T?null:C.ref)},children:s(hp,{size:18,"aria-hidden":"true"})}),T&&s("div",{class:"jex-home-row-menu",role:"menu","aria-label":c.chatOptionsAria.replace("{ref}",C.ref),children:[s("button",{type:"button",role:"menuitem",class:"jex-home-row-menu-item",onClick:()=>{d(null),x.current?.focus(),a(C.ref)},children:[s(dp,{size:16,"aria-hidden":"true"}),c.copyReference]}),e&&s(ne,{children:[s("button",{type:"button",role:"menuitem",class:"jex-home-row-menu-item jex-home-row-menu-item--danger",disabled:n,"aria-describedby":n?"jex-delete-paused":void 0,onClick:()=>{d(null),l([C.ref],x.current)},children:[s(Al,{size:16,"aria-hidden":"true"}),c.deleteChat]}),n&&s("p",{class:"jex-home-row-menu-hint",id:"jex-delete-paused",children:c.deleteMaintenance})]})]})]})]},C.ref)})}),r&&s(ne,{children:[s("div",{class:"jex-home-select-bar",children:[s("button",{type:"button",class:"jex-home-select-btn",disabled:I,onClick:()=>{f(t.slice(0,xr).map(C=>C.ref))},children:c.selectAll}),s("button",{type:"button",class:"jex-home-select-btn jex-home-select-btn--danger",disabled:b.length===0||n,onClick:C=>{l(b.map(E=>E.ref),C.currentTarget)},children:c.deleteCount.replace("{count}",String(b.length))})]}),n?s("p",{class:"jex-home-select-hint",role:"status",children:c.deleteMaintenance}):t.length>xr?s("p",{class:"jex-home-select-hint",children:c.deleteLimitHint.replace("{max}",String(xr))}):null]})]})}function ib(t){return t instanceof xn&&t.data?.code==="UNAUTHORIZED_ORIGIN"}function ob({entries:t,maintenance:e,onCancel:n,onDone:r}){const i=L(),o=xt(se.visitorChatDeletion.deleteMyChats),[a,l]=$(!1),[c,u]=$(!1),d=oe(null),m=t.length===1,f=t.map(v=>v.ref);N(()=>{d.current?.focus()},[]),N(()=>{if(a)return;const v=k=>{k.key==="Escape"&&n()};return document.addEventListener("keydown",v),()=>{document.removeEventListener("keydown",v)}},[a,n]);async function p(){const v=rt.value;if(!v)throw new Error("No page token yet");try{return await o({bootstrapToken:v,refs:f})}catch(k){if(!ib(k))throw k;const w=await oa();if(!w.ok)throw k;return await o({bootstrapToken:w.token,refs:f})}}async function x(){if(!(a||e)){l(!0),u(!1);try{const v=await p();if(v.ok){r({kind:"done",requested:f,kept:v.kept});return}if(v.reason==="off"){r({kind:"off"});return}u(!0)}catch(v){J.warn("[JexityChat] Deleting chats failed:",v),u(!0)}l(!1)}}return s("div",{class:"jex-sheet-backdrop",onClick:v=>{v.target===v.currentTarget&&!a&&n()},children:s("div",{class:"jex-sheet",role:"dialog","aria-modal":"true","aria-labelledby":"jex-delete-title","aria-describedby":"jex-delete-body",children:[s("span",{class:"jex-sheet-icon","aria-hidden":"true",children:s(Al,{size:18})}),s("h4",{class:"jex-sheet-title",id:"jex-delete-title",children:m?i.deleteOneTitle:i.deleteManyTitle.replace("{count}",String(t.length))}),s("p",{class:"jex-sheet-text",id:"jex-delete-body",children:m?i.deleteOneBody:i.deleteManyBody}),s("ul",{class:"jex-sheet-list",children:t.map(v=>s("li",{class:"jex-sheet-item",children:[s("span",{class:"jex-sheet-item-title",children:v.firstMessage??i.resumeListLabel}),s("span",{class:"jex-sheet-item-ref",children:v.ref})]},v.ref))}),s("p",{class:"jex-sheet-text",children:m?i.deleteOneReference:i.deleteManyReference}),c&&s("p",{class:"jex-sheet-error",role:"alert",children:m?i.deleteFailedOne:i.deleteFailedMany}),e&&s("p",{class:"jex-sheet-hint",role:"status",children:i.deleteMaintenance}),s("div",{class:"jex-sheet-actions",children:[s("button",{ref:d,type:"button",class:"jex-sheet-btn",disabled:a,onClick:n,children:i.cancel}),s("button",{type:"button",class:"jex-sheet-btn jex-sheet-btn--danger",disabled:a||e,"aria-busy":a,onClick:()=>{x()},children:[a&&s("span",{class:"jex-sheet-spinner","aria-hidden":"true"}),a?i.deleting:c?i.tryAgain:m?i.deleteChat:i.deleteChats]})]})]})})}const tu=V(!1);function ab({botName:t,availability:e,hidePersonButton:n,visitorChatDeletionOff:r,maintenance:i,onResetSession:o}){const a=L(),[l,c]=$(""),u=e?.anyOnline===!0,d=Yc(e),m=!r&&!tu.value,[f,p]=$(!1),[x,v]=$(null),[k,w]=$(null),b=oe(null),I=oe(null);N(()=>{if(x!==null||!b.current)return;const y=b.current.isConnected?b.current:I.current;b.current=null,y?.focus()},[x,f]);async function C(y){try{await navigator.clipboard.writeText(y),w({text:a.referenceCopied,warn:!1})}catch{}}function E(y,A){b.current=A,w(null),v(y)}function T(y){if(v(null),p(!1),y.kind==="off"){tu.value=!0,w({text:a.deleteTurnedOff,warn:!0});return}const{requested:A,kept:z}=y;Lf(A,z).currentDeleted&&o();const ae=A.filter(Ne=>!z.includes(Ne)),Y=ae.length,ce=[Y===1?a.chatDeleted.replace("{ref}",ae[0]??""):Y>1?a.chatsDeleted.replace("{count}",String(Y)):null,z.length===1?a.chatKeptOne:z.length>1?a.chatsKept.replace("{count}",String(z.length)):null].filter(Ne=>Ne!==null);w({text:ce.join(". "),warn:z.length>0})}function M(){Yr(),_n.value="escalate",o(),xl(),bt({id:"chat"})}function P(){Yr(),_n.value="fresh",o(),xl(),bt({id:"chat"})}function le(y){Yr(),_n.value="resume",o(),bl(y),bt({id:"chat"})}function B(y){y.preventDefault();const A=l.trim().toUpperCase();A&&(Yr(),_n.value="resume",o(),bl(A),bt({id:"chat"}))}const D=x===null?[]:ge.value.slice().reverse().filter(y=>x.includes(y.ref));return s("div",{class:"jex-home-wrap",children:[s("div",{class:"jex-home",children:[k&&s("p",{class:`jex-home-note${k.warn?" jex-home-note--warn":""}`,role:"status",children:[k.warn?s(up,{size:15,"aria-hidden":"true"}):s(cp,{size:15,"aria-hidden":"true"}),k.text]}),rr.value&&s("div",{class:"jex-session-prompt",role:"status",children:s("div",{class:"jex-session-prompt-text",children:a.sessionLocked})}),n?s("div",{class:"jex-home-hero",children:[s("div",{class:"jex-home-avatar",children:s(Xr,{size:24})}),s("div",{class:"jex-home-hero-text",children:s("h2",{class:"jex-home-title",children:t})})]}):s("button",{class:"jex-home-hero",type:"button",onClick:M,"aria-label":a.talkToHumanAria,title:e?u?a.handoffAvailable:a.handoffOffline:a.talkToHuman,children:[s("div",{class:"jex-home-avatar",children:[s(Xr,{size:24}),e!==void 0&&s("span",{class:`jex-home-status-dot jex-home-status-dot--${d}`,"aria-hidden":"true"})]}),s("div",{class:"jex-home-hero-text",children:[s("h2",{class:"jex-home-title",children:t}),s("span",{class:"jex-home-status",children:[e===void 0?a.homeStatusOffline:u?a.homeStatusOnline:a.homeStatusOffline," | ",a.talkToHuman]})]})]}),s("div",{class:"jex-home-actions",children:[ge.value.length>0&&s(rb,{entries:ge.value.slice().reverse(),canDelete:m,maintenance:i,selecting:f,onSelectingChange:p,onOpen:le,onCopy:y=>{C(y)},onDelete:E}),!f&&s("button",{ref:I,class:"jex-home-new-btn",onClick:P,children:ge.value.length>0?a.startNewConversation:a.chatWith})]}),!f&&s("div",{class:"jex-home-lookup-section",children:[s("span",{class:"jex-home-lookup-label",children:a.haveReferenceNumber}),s("form",{class:"jex-home-lookup",onSubmit:B,children:[s("input",{class:"jex-home-lookup-input",type:"text",placeholder:a.referencePlaceholder,value:l,onInput:y=>{c(y.currentTarget.value)}}),s("button",{class:"jex-home-lookup-submit",type:"submit",disabled:!l.trim(),children:a.resume})]})]})]}),D.length>0&&s(ob,{entries:D,maintenance:i,onCancel:()=>{v(null)},onDone:T})]})}function sb({title:t}){const e=L();return s("div",{class:"jex-selection",children:[s("h2",{class:"jex-selection-title",children:e.howCanWeHelp}),s("div",{class:"jex-selection-options",children:[s("button",{class:"jex-selection-option",onClick:()=>bt({id:"chat"}),children:[s("span",{class:"jex-selection-icon",children:"💬"}),s("span",{class:"jex-selection-label",children:e.chatWith.replace("{title}",t)}),s("span",{class:"jex-selection-sub",children:e.getInstantHelp})]}),s("button",{class:"jex-selection-option",onClick:()=>bt({id:"form"}),children:[s("span",{class:"jex-selection-icon",children:"📝"}),s("span",{class:"jex-selection-label",children:e.submitTicket}),s("span",{class:"jex-selection-sub",children:e.replyByEmail})]})]})]})}function lb(){const t=L(),[e,n]=$(""),[r,i]=$(""),[o,a]=$("");async function l(c){c.preventDefault(),_o({id:"loading",message:t.submittingTicket}),await new Promise(d=>{setTimeout(d,1200)});const u="JEX-"+Math.random().toString(36).slice(2,8).toUpperCase();_o({id:"confirmation",ref:u})}return s("div",{class:"jex-form-screen",children:[s("h2",{class:"jex-form-title",children:t.submitTicket}),s("form",{class:"jex-form",onSubmit:c=>{l(c)},children:[s("input",{class:"jex-form-input",type:"text",placeholder:t.yourName,value:e,required:!0,onInput:c=>{n(c.currentTarget.value)}}),s("input",{class:"jex-form-input",type:"email",placeholder:t.yourEmail,value:r,required:!0,onInput:c=>{i(c.currentTarget.value)}}),s("textarea",{class:"jex-form-textarea",placeholder:t.howCanWeHelp,value:o,required:!0,onInput:c=>{a(c.currentTarget.value)}}),s("button",{class:"jex-form-submit",type:"submit",children:t.submit})]})]})}function cb({ticketRef:t}){const e=L();return s("div",{class:"jex-confirmation",children:[s("div",{class:"jex-confirmation-icon","aria-hidden":"true",children:"✓"}),s("h2",{class:"jex-confirmation-title",children:e.ticketSubmitted}),s("p",{class:"jex-confirmation-body",children:e.yourReferenceNumber}),s("div",{class:"jex-confirmation-ref",children:t}),s("p",{class:"jex-confirmation-hint",children:e.sentToEmailHint}),s("button",{class:"jex-confirmation-done",onClick:()=>{fe.value=!1},children:e.done})]})}function ub({message:t,onRetry:e,onBack:n}){const r=L();return s("div",{class:"jex-overlay jex-error",children:[s("p",{class:"jex-error-message",children:t}),s("div",{class:"jex-error-actions",children:[e&&s("button",{class:"jex-error-retry",onClick:e,children:r.tryAgain}),n&&s("button",{class:"jex-error-back",onClick:n,children:r.goBack})]})]})}function nu({greeting:t,starterQuestions:e,title:n,botName:r,availability:i,hidePersonButton:o,visitorChatDeletionOff:a,sessionId:l,visitorId:c,isLoading:u,sessionNotFound:d,resumeFailed:m,isOrgDeleted:f,ensureSession:p,startFresh:x,resetSession:v,maintenance:k}){const w=Ae.value,b=w[w.length-1],I=[...w].reverse().find(C=>C.id==="confirmation");return s("div",{class:"jex-screen-container",children:[b.id==="home"&&s(ab,{botName:r,availability:i,hidePersonButton:o,visitorChatDeletionOff:a,maintenance:k,onResetSession:v}),b.id==="selection"&&s(sb,{title:n}),b.id==="form"&&s(lb,{}),b.id==="escalation-form"&&s(Xx,{formMessageId:b.formMessageId,sessionId:b.sessionId,visitorId:b.visitorId,availability:i,waitingSetAt:b.waitingSetAt}),b.id==="confirmation"&&I&&s(cb,{ticketRef:I.ref}),b.id==="chat"&&s(Jx,{greeting:t,botName:r,starterQuestions:e,sessionId:l,visitorId:c,isLoading:u,sessionNotFound:d,resumeFailed:m,isOrgDeleted:f,ensureSession:p,startFresh:x,maintenance:k}),b.id==="loading"&&s(Gc,{message:b.message}),b.id==="error"&&s(ub,{message:b.message,onRetry:()=>_o({id:"loading"}),onBack:ko})]})}function db({options:t}){return ff({orgSlug:t.orgSlug,projSlug:t.projSlug,userToken:t.userToken,preToken:t.bootstrapToken,convexUrl:t.convexUrl,preAllowedUrls:t.allowedUrls??[],preExcludedPaths:t.excludePaths,preMaintenance:t.maintenance}),gf()?s(hb,{options:t}):null}function hb({options:t}){const e=sl(),n=sf(t.orgSlug,t.projSlug,t.convexUrl,t.preloadedConfig);_f(t.parentOrigin),N(()=>(Rf(),$f(),()=>{bo.value=!1}),[]);const{sessionId:r,visitorId:i,isLoading:o,sessionNotFound:a,resumeFailed:l,isOrgDeleted:c,ensureSession:u,startFresh:d,resetSession:m}=nb(t.orgSlug,t.projSlug),f=Zx(t.orgSlug,t.projSlug),p=nf(t,n.config),x=zt.value,v=bo.value,k=n.config!==null||x!==void 0||n.settled,w=n.config!==null?p.sessionTimeoutMs:x!==void 0?x:p.sessionTimeoutMs;N(()=>{Qe.value=kf(p.locale,p.allowVisitorLocale),hl.value=p.addressForm},[p.locale,p.allowVisitorLocale,p.addressForm]),N(()=>{tr.value=p.privacyPolicyUrl??er,io.value=p.privacyNoticeStyle,rl.value=p.visitorAttachmentsEnabled},[p.privacyNoticeStyle,p.privacyPolicyUrl,p.visitorAttachmentsEnabled]),N(()=>{if(!fe.value||p.mode==="embedded"||!window.matchMedia("(max-width: 480px), (pointer: coarse) and (max-width: 768px)").matches)return;const ae=document.documentElement.style.overflow;return document.documentElement.style.overflow="hidden",()=>{document.documentElement.style.overflow=ae}},[fe.value,p.mode]),N(()=>{if(v&&k&&p.mode!=="embedded"&&w!==null)try{return Bf(w)}catch(z){J.warn("[JexityChat] Idle-lock watcher failed to start:",z);return}},[v,p.mode,k,w]),N(()=>{if(!v||!k)return;const{activeRefPruned:z}=Ef(w);z&&To()},[v,k,w]);const b=p.position==="bottom-left",I=p.colorScheme==="dark"||p.colorScheme==="light"?p.colorScheme:"",C=Uf({...t,primaryColor:p.primaryColor,accentColor:p.accentColor,fontFamily:p.fontFamily,fontSize:p.fontSize,borderRadius:p.borderRadius,windowWidth:p.windowWidth,windowHeight:p.windowHeight,triggerOffsetX:p.triggerOffsetX,triggerOffsetY:p.triggerOffsetY}),E=p.mode==="embedded",T=t.trigger==="none",M=t.windowPosition==="middle-center",P=Ae.value,B=P[P.length-1]?.id==="chat",D=n.config!==null||E||!!t.parentOrigin,y=D?C:{...C,visibility:"hidden"},A=ep(t.orgSlug,t.projSlug);return N(()=>{if(E||T||!D||p.proactiveMode==="off"||Sl(A))return;const z=t.proactiveAlreadyElapsed?0:p.proactiveDelaySeconds*1e3,ae=window.setTimeout(()=>{const Y=np({mode:p.proactiveMode,isOpen:fe.peek(),hasHistory:vo.peek(),dismissed:Sl(A)});Y==="teaser"?Zr.value=!0:Y==="open"&&(fe.value=!0)},z);return()=>{window.clearTimeout(ae)}},[E,T,D,p.proactiveMode,p.proactiveDelaySeconds,A,t.proactiveAlreadyElapsed]),s("div",{class:`jex-widget ${I}`.trim(),style:y,children:E?s("div",{class:"jex-embedded",children:[s(_l,{title:p.title,rightAction:B&&!p.hidePersonButton?s(Jc,{sessionId:r,visitorId:i,ensureSession:u,availability:f}):null,showClose:t.closeButton===!0,showLocalePicker:p.allowVisitorLocale}),s(nu,{greeting:p.greeting,starterQuestions:p.starterQuestions,title:p.title,botName:p.botName,orgSlug:t.orgSlug,projSlug:t.projSlug,availability:f,hidePersonButton:p.hidePersonButton,visitorChatDeletionOff:p.visitorChatDeletionOff,sessionId:r,visitorId:i,isLoading:o,sessionNotFound:a,resumeFailed:l,isOrgDeleted:c,ensureSession:u,startFresh:d,resetSession:m,maintenance:e}),!p.hideBranding&&s(jl,{})]}):s("div",{class:`jex-container${b?" jex-pos-left":""}`,children:[fe.value&&s("div",{class:`jex-chat-window${M?" jex-win-center":""}`,children:[s(_l,{title:p.title,rightAction:B&&!p.hidePersonButton?s(Jc,{sessionId:r,visitorId:i,ensureSession:u,availability:f}):null,showLocalePicker:p.allowVisitorLocale}),s(nu,{greeting:p.greeting,starterQuestions:p.starterQuestions,title:p.title,botName:p.botName,orgSlug:t.orgSlug,projSlug:t.projSlug,availability:f,hidePersonButton:p.hidePersonButton,visitorChatDeletionOff:p.visitorChatDeletionOff,sessionId:r,visitorId:i,isLoading:o,sessionNotFound:a,resumeFailed:l,isOrgDeleted:c,ensureSession:u,startFresh:d,resetSession:m,maintenance:e}),!p.hideBranding&&s(jl,{})]}),Zr.value&&!fe.value&&!T&&s(rp,{title:p.title,message:p.greeting,guardKey:A}),!T&&s(Zf,{iconOption:p.triggerIcon,radius:p.triggerRadius,label:p.triggerLabel})]})})}const fb=`.jex-widget{--jex-primary: #115A62;--jex-primary-hover: var(--jex-accent, color-mix(in srgb, var(--jex-primary) 85%, #000));--jex-radius: .75rem;--jex-font-family: "Inter", system-ui, -apple-system, sans-serif;--jex-font-size: 14px;--jex-window-width: 380px;--jex-window-height: 600px;--jex-shadow: 0 16px 48px -12px rgba(13, 127, 138, .25), 0 4px 16px rgba(0, 0, 0, .08);pointer-events:auto;--jex-bg-trigger: var(--jex-primary);--jex-bg-header: var(--jex-primary);--jex-bg-msg-user: var(--jex-primary);--jex-bg-send-btn: var(--jex-primary);--jex-bg-window: rgba(255, 255, 255, .95);--jex-bg-sheet: #ffffff;--jex-bg-msg-bot: #f1f5f9;--jex-bg-input: rgba(247, 253, 253, .6);--jex-text-header: #ffffff;--jex-text-msg-user: #ffffff;--jex-text-msg-bot: #0f172a;--jex-text-main: #0f172a;--jex-text-muted: #64748b;--jex-bg-avatar-agent: #d1fae5;--jex-text-avatar-agent: #065f46;--jex-border-window: rgba(226, 232, 240, .8);--jex-border-input: rgba(203, 213, 225, .8);--jex-bg-glass: var(--jex-bg-window);--jex-border-glass: var(--jex-border-window);font-family:var(--jex-font-family);-webkit-font-smoothing:antialiased}.dark .jex-widget,.jex-widget.dark{--jex-primary: #1cb0bf;--jex-primary-hover: var(--jex-accent, color-mix(in srgb, var(--jex-primary) 85%, #000));--jex-bg-window: rgba(10, 15, 26, .95);--jex-bg-sheet: #0a0f1a;--jex-bg-msg-bot: #233146;--jex-bg-input: rgba(10, 15, 26, .6);--jex-text-msg-bot: #f8fafc;--jex-text-main: #f8fafc;--jex-text-muted: #94a3b8;--jex-border-window: rgba(30, 41, 59, .8);--jex-border-input: rgba(51, 65, 85, .9);--jex-bg-avatar-agent: #064e3b;--jex-text-avatar-agent: #6ee7b7;--jex-bg-error: #3b1318;--jex-border-error: #5c1d24;--jex-text-error: #fca5a5}@media(prefers-color-scheme:dark){:host:not(.light) .jex-widget:not(.light){--jex-primary: #1cb0bf;--jex-primary-hover: var(--jex-accent, color-mix(in srgb, var(--jex-primary) 85%, #000));--jex-bg-window: rgba(10, 15, 26, .95);--jex-bg-sheet: #0a0f1a;--jex-bg-msg-bot: #233146;--jex-bg-input: rgba(10, 15, 26, .6);--jex-text-msg-bot: #f8fafc;--jex-text-main: #f8fafc;--jex-text-muted: #94a3b8;--jex-border-window: rgba(30, 41, 59, .8);--jex-border-input: rgba(51, 65, 85, .9);--jex-bg-error: #3b1318;--jex-border-error: #5c1d24;--jex-text-error: #fca5a5}}.jex-widget *{box-sizing:border-box;margin:0;padding:0}.jex-container{position:fixed;bottom:var(--jex-offset-y, 24px);right:var(--jex-offset-x, 24px);display:flex;flex-direction:column;align-items:flex-end;gap:16px;z-index:9999}.jex-container.jex-pos-left{right:auto;left:var(--jex-offset-x, 24px);align-items:flex-start}:host(.jex-mode-embedded){display:block;width:100%;height:100%}:host(.jex-mode-embedded) .jex-widget{width:100%;height:100%}.jex-embedded{display:flex;flex-direction:column;width:100%;height:100%;background:var(--jex-bg-window);border:1px solid var(--jex-border-window);overflow:hidden}.jex-embedded .jex-screen-container{flex:1;overflow:hidden;display:flex;flex-direction:column}.jex-floating-button{height:56px;min-width:56px;padding:0;background:var(--jex-bg-trigger);color:var(--jex-text-header);border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;box-shadow:var(--jex-shadow);transition:transform .3s cubic-bezier(.175,.885,.32,1.275),background .2s,width .3s ease,border-radius .3s ease}.jex-floating-button.jex-has-label{min-width:110px;padding:0 20px}.jex-fab-inner{display:flex;align-items:center;gap:12px}.jex-fab-label{font-size:15px;font-weight:600;white-space:nowrap}.jex-floating-button:hover{transform:scale(1.1);background:var(--jex-primary-hover)}.jex-floating-button:active{transform:scale(.95)}.jex-fab-pulse{animation:jex-fab-pulse 2.4s ease-out infinite}@keyframes jex-fab-pulse{0%{box-shadow:var(--jex-shadow),0 0 color-mix(in srgb,var(--jex-bg-trigger) 50%,transparent)}70%{box-shadow:var(--jex-shadow),0 0 0 14px color-mix(in srgb,var(--jex-bg-trigger) 0%,transparent)}to{box-shadow:var(--jex-shadow),0 0 color-mix(in srgb,var(--jex-bg-trigger) 0%,transparent)}}@media(prefers-reduced-motion:reduce){.jex-fab-pulse{animation:none}}.jex-proactive-teaser{display:flex;align-items:flex-start;gap:10px;width:280px;max-width:calc(100vw - 48px);padding:12px 14px;align-self:flex-end;background:var(--jex-bg-window);color:var(--jex-text-main);border:1px solid var(--jex-border-window);border-radius:var(--jex-radius);box-shadow:var(--jex-shadow);cursor:pointer;text-align:left;animation:jex-teaser-in .22s ease-out}.jex-proactive-avatar{flex:0 0 auto;display:flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:9999px;background:var(--jex-bg-avatar-agent);color:var(--jex-text-avatar-agent)}.jex-proactive-body{display:flex;flex-direction:column;gap:2px;min-width:0}.jex-proactive-title{font-weight:600;font-size:13px;line-height:1.2}.jex-proactive-message{font-size:13px;line-height:1.35;color:var(--jex-text-muted)}.jex-proactive-dismiss{flex:0 0 auto;display:flex;align-items:center;justify-content:center;width:22px;height:22px;margin:-4px -4px 0 0;padding:0;border:none;background:transparent;color:var(--jex-text-muted);cursor:pointer;border-radius:9999px}.jex-proactive-dismiss:hover{background:var(--jex-bg-msg-bot)}@keyframes jex-teaser-in{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}@media(prefers-reduced-motion:reduce){.jex-proactive-teaser{animation:none}}.jex-chat-window{width:var(--jex-window-width);height:var(--jex-window-height);max-height:calc(100vh - 120px);background:var(--jex-bg-window);backdrop-filter:blur(24px);-webkit-backdrop-filter:blur(24px);border:1px solid var(--jex-border-window);border-radius:calc(var(--jex-radius) * 2);box-shadow:var(--jex-shadow);display:flex;flex-direction:column;overflow:hidden;animation:jexSlideUp .4s cubic-bezier(.16,1,.3,1);transform-origin:bottom right;touch-action:manipulation}@keyframes jexSlideUp{0%{opacity:0;transform:scale(.8) translateY(20px)}to{opacity:1;transform:scale(1) translateY(0)}}.jex-chat-window.jex-win-center{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;max-height:82vh;animation:jexCenterIn .34s cubic-bezier(.16,1,.3,1)}@keyframes jexCenterIn{0%{opacity:0;transform:translate(-50%,-50%) scale(.92)}to{opacity:1;transform:translate(-50%,-50%) scale(1)}}@media(prefers-reduced-motion:reduce){.jex-chat-window.jex-win-center{animation:none}}@media(max-width:480px),(pointer:coarse)and (max-width:768px){.jex-chat-window,.jex-chat-window.jex-win-center{position:fixed;inset:0;width:100vw;height:100vh;height:100dvh;max-height:none;border:none;border-radius:0;transform:none;animation:jexSlideUpMobile .3s cubic-bezier(.16,1,.3,1);transform-origin:bottom center}.jex-container:has(.jex-chat-window) .jex-floating-button{display:none}}@keyframes jexSlideUpMobile{0%{opacity:0;transform:translateY(100%)}to{opacity:1;transform:translateY(0)}}.jex-chat-header{padding:14px 16px;background:var(--jex-bg-header);color:var(--jex-text-header);display:flex;align-items:center;gap:12px;flex-shrink:0}.jex-header-info{display:flex;align-items:center;gap:8px;min-width:0}.jex-header-info h3{font-size:16px;font-weight:600;color:var(--jex-text-header);margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.jex-locale-picker{position:relative;display:flex}.jex-flag{display:inline-flex;width:20px;height:14px;flex-shrink:0;border-radius:3px;overflow:hidden;box-shadow:0 0 0 1px color-mix(in srgb,currentColor 25%,transparent)}.jex-flag svg{width:100%;height:100%}.jex-header-locale{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;background:transparent;border:none;border-radius:999px;padding:0;color:inherit;cursor:pointer;transition:background .15s ease}.jex-header-locale:hover,.jex-header-locale[aria-expanded=true]{background:color-mix(in srgb,currentColor 14%,transparent)}.jex-locale-menu{position:absolute;top:calc(100% + 6px);right:0;z-index:20;display:flex;flex-direction:column;min-width:140px;padding:4px;background:var(--jex-bg-window);color:var(--jex-text-main);border:1px solid var(--jex-border-window);border-radius:10px;box-shadow:0 8px 24px #0f172a29}.jex-locale-option{display:flex;align-items:center;gap:10px;padding:8px 10px;font-size:13px;line-height:1.2;text-align:left;background:transparent;border:none;border-radius:6px;color:inherit;cursor:pointer}.jex-locale-option:hover,.jex-locale-option:focus-visible{background:color-mix(in srgb,currentColor 8%,transparent)}.jex-locale-option.jex-locale-active{font-weight:600}.jex-header-info p{font-size:12px;opacity:.8;color:var(--jex-text-header);margin:0}.jex-header-right{margin-left:auto;display:flex;align-items:center;gap:4px}.jex-header-handoff{position:relative;display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;background:transparent;border:1px solid color-mix(in srgb,currentColor 50%,transparent);border-radius:999px;padding:0;color:inherit;cursor:pointer;transition:background .15s ease,border-color .15s ease}.jex-header-handoff:hover:not(:disabled){background:color-mix(in srgb,currentColor 12%,transparent);border-color:currentColor}.jex-header-handoff:disabled{opacity:.5;cursor:not-allowed}.jex-header-close{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;background:transparent;border:none;border-radius:999px;padding:0;color:inherit;cursor:pointer;transition:background .15s ease}.jex-header-close:hover{background:color-mix(in srgb,currentColor 14%,transparent)}.jex-handoff-error{position:absolute;top:100%;right:8px;background:#fee;color:#b00;padding:4px 8px;font-size:12px;border-radius:4px}.jex-header-back{background:none;border:none;color:var(--jex-text-header);cursor:pointer;padding:4px;display:flex;align-items:center;opacity:.8;transition:opacity .2s;flex-shrink:0}.jex-header-back:hover{opacity:1}.jex-screen-container{flex:1;overflow:hidden;display:flex;flex-direction:column}.jex-home{flex:1;display:flex;flex-direction:column;padding:24px;gap:20px;overflow-y:auto}.jex-home-hero{display:flex;align-items:center;gap:14px;width:100%;padding:0;border:none;background:transparent;font-family:inherit;text-align:left;cursor:pointer;animation:jexFadeIn .4s ease both}.jex-home-hero:disabled{cursor:default;opacity:.7}div.jex-home-hero{cursor:default}.jex-home-avatar{position:relative;width:48px;height:48px;border-radius:14px;background:var(--jex-primary);color:var(--jex-text-header);display:flex;align-items:center;justify-content:center;flex-shrink:0;box-shadow:0 4px 12px color-mix(in srgb,var(--jex-primary) 30%,transparent)}.jex-home-status-dot{position:absolute;bottom:-2px;right:-2px;width:14px;height:14px;border-radius:50%;background:var(--jex-dot-color, #9ca3af);border:2.5px solid var(--jex-bg-window);animation:jexPulse 2s ease-in-out infinite}.jex-home-status-dot--online{--jex-dot-color: #10b981}.jex-home-status-dot--away{--jex-dot-color: #fbbf24}.jex-home-status-dot--offline{--jex-dot-color: #9ca3af}@keyframes jexPulse{0%,to{box-shadow:0 0 color-mix(in srgb,var(--jex-dot-color, #9ca3af) 40%,transparent)}50%{box-shadow:0 0 0 6px color-mix(in srgb,var(--jex-dot-color, #9ca3af) 0%,transparent)}}.jex-home-hero-text{display:flex;flex-direction:column;gap:2px;min-width:0}.jex-home-title{font-size:17px;font-weight:700;color:var(--jex-text-main);margin:0;line-height:1.2;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.jex-home-status{font-size:13px;font-weight:500;color:var(--jex-text-muted);letter-spacing:.01em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.jex-home-section-label{font-size:11px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--jex-text-muted)}.jex-home-lookup-section{display:flex;flex-direction:column;gap:8px;margin-top:auto}.jex-home-lookup-label{font-size:12px;font-weight:500;color:var(--jex-text-muted)}.jex-home-greeting{background:var(--jex-bg-msg-bot);border:1px solid var(--jex-border-window);border-radius:4px 16px 16px;padding:16px 18px;font-size:14px;line-height:1.55;color:var(--jex-text-main);animation:jexFadeIn .4s .1s ease both}.jex-home-greeting p{margin:0}@keyframes jexFadeIn{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}.jex-home-actions{display:flex;flex-direction:column;gap:10px;animation:jexFadeIn .4s .2s ease both}.jex-home-start-btn{background:var(--jex-bg-send-btn);color:var(--jex-text-header);border:none;border-radius:12px;padding:14px 20px;font-size:15px;font-weight:600;cursor:pointer;font-family:inherit;transition:background .2s,transform .15s,box-shadow .2s;width:100%;box-shadow:0 2px 8px color-mix(in srgb,var(--jex-primary) 25%,transparent)}.jex-home-start-btn:hover{background:var(--jex-primary-hover);transform:translateY(-1px);box-shadow:0 4px 16px color-mix(in srgb,var(--jex-primary) 35%,transparent)}.jex-home-start-btn:active{transform:translateY(0);box-shadow:0 1px 4px color-mix(in srgb,var(--jex-primary) 20%,transparent)}.jex-home-actions{position:relative;z-index:1}.jex-home-list-head{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:24px}.jex-home-select-count{font-size:13px;font-weight:600;color:var(--jex-text-main)}.jex-home-list-link{border:none;background:none;font-family:inherit;font-size:13px;font-weight:600;color:var(--jex-primary);padding:4px 2px;cursor:pointer}.jex-home-list-link:hover{text-decoration:underline}.jex-home-list{list-style:none;display:flex;flex-direction:column;border:1px solid var(--jex-border-window);border-radius:14px}.jex-home-row{display:flex;align-items:center;min-width:0;border-top:1px solid var(--jex-border-window)}.jex-home-row:first-child{border-top:none;border-radius:13px 13px 0 0}.jex-home-row:last-child{border-radius:0 0 13px 13px}.jex-home-row:only-child{border-radius:13px}.jex-home-row--checked{background:color-mix(in srgb,var(--jex-primary) 6%,transparent)}.jex-home-row-open,.jex-home-row-check{flex:1;min-width:0;display:flex;align-items:center;gap:10px;padding:10px 4px 10px 12px;border:none;background:transparent;border-radius:inherit;text-align:left;font-family:inherit;color:var(--jex-text-main);cursor:pointer}.jex-home-row-check{gap:12px;padding-right:12px}.jex-home-row-open:hover{background:color-mix(in srgb,var(--jex-primary) 5%,transparent)}.jex-home-row-check input{width:18px;height:18px;flex-shrink:0;accent-color:var(--jex-primary);cursor:pointer}.jex-home-row-icon{width:30px;height:30px;flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;border-radius:9px;background:color-mix(in srgb,var(--jex-primary) 12%,transparent);color:var(--jex-primary)}.jex-home-row-text{min-width:0;display:flex;flex-direction:column;gap:3px}.jex-home-row-title{font-size:13.5px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.jex-home-row-meta{font-size:11.5px;color:var(--jex-text-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.jex-home-row-ref{font-family:ui-monospace,Cascadia Code,Fira Code,monospace;letter-spacing:.04em}.jex-home-row-more{position:relative;flex-shrink:0;margin-right:8px}.jex-home-row-menu-btn{width:32px;height:32px;display:inline-flex;align-items:center;justify-content:center;padding:0;border:none;border-radius:8px;background:transparent;color:var(--jex-text-muted);cursor:pointer}.jex-home-row-menu-btn:hover,.jex-home-row-menu-btn[aria-expanded=true]{background:color-mix(in srgb,var(--jex-text-muted) 16%,transparent);color:var(--jex-text-main)}.jex-home-row-menu{position:absolute;top:calc(100% + 4px);right:0;z-index:20;min-width:188px;padding:4px;display:flex;flex-direction:column;background:var(--jex-bg-window);color:var(--jex-text-main);border:1px solid var(--jex-border-window);border-radius:10px;box-shadow:0 8px 24px #0f172a29}.jex-home-row-menu-item{display:flex;align-items:center;gap:10px;width:100%;padding:9px 10px;font-size:13px;font-family:inherit;text-align:left;border:none;border-radius:6px;background:transparent;color:inherit;cursor:pointer}.jex-home-row-menu-item:hover:not(:disabled),.jex-home-row-menu-item:focus-visible{background:color-mix(in srgb,currentColor 8%,transparent)}.jex-home-row-menu-item--danger{color:var(--jex-text-error, #b91c1c)}.jex-home-row-menu-item:disabled{color:var(--jex-text-muted);opacity:.7;cursor:default}.jex-home-row-menu-hint{padding:2px 10px 8px 36px;font-size:12px;line-height:1.4;color:var(--jex-text-muted)}.jex-home-select-bar{display:flex;gap:8px}.jex-home-select-btn{flex:1;height:42px;border-radius:12px;border:1px solid var(--jex-border-input);background:transparent;color:var(--jex-text-main);font-family:inherit;font-size:14px;font-weight:600;cursor:pointer}.jex-home-select-btn:disabled{opacity:.45;cursor:default}.jex-home-select-btn--danger,.jex-sheet-btn.jex-sheet-btn--danger{background:#b91c1c;border-color:#b91c1c;color:#fff}.jex-home-select-hint{font-size:12px;line-height:1.4;color:var(--jex-text-muted)}.jex-home-note{align-self:center;display:flex;align-items:center;gap:6px;max-width:100%;padding:8px 14px;border-radius:999px;font-size:13px;font-weight:600;line-height:1.35;color:var(--jex-text-main);background:color-mix(in srgb,#10b981 14%,var(--jex-bg-window));border:1px solid color-mix(in srgb,#10b981 45%,transparent);animation:jexFadeIn .3s ease both}.jex-home-note svg{flex-shrink:0}.jex-home-note--warn{align-self:stretch;border-radius:12px;color:var(--jex-text-error, #991b1b);background:var(--jex-bg-error, #fef2f2);border-color:var(--jex-border-error, #fecaca)}.jex-home-wrap{position:relative;flex:1;min-height:0;display:flex;flex-direction:column}.jex-sheet-backdrop{position:absolute;inset:0;z-index:30;display:flex;flex-direction:column;justify-content:flex-end;background:#0f172a6b;animation:jexSheetFade .2s ease both}.jex-sheet{display:flex;flex-direction:column;gap:12px;max-height:100%;overflow-y:auto;padding:20px 20px 18px;background:var(--jex-bg-sheet);color:var(--jex-text-main);border-radius:20px 20px 0 0;box-shadow:0 -8px 24px #0f172a1f;animation:jexSheetUp .25s cubic-bezier(.16,1,.3,1) both}@keyframes jexSheetFade{0%{opacity:0}to{opacity:1}}@keyframes jexSheetUp{0%{transform:translateY(24px);opacity:0}to{transform:translateY(0);opacity:1}}.jex-sheet-icon{width:36px;height:36px;display:inline-flex;align-items:center;justify-content:center;border-radius:999px;background:var(--jex-bg-error, #fef2f2);color:var(--jex-text-error, #b91c1c)}.jex-sheet-title{font-size:16px;font-weight:650}.jex-sheet-text{font-size:13.5px;line-height:1.5;color:var(--jex-text-muted)}.jex-sheet-list{list-style:none;max-height:160px;overflow-y:auto;border:1px solid var(--jex-border-window);border-radius:12px}.jex-sheet-item{display:flex;flex-direction:column;gap:2px;padding:8px 12px;border-top:1px solid var(--jex-border-window)}.jex-sheet-item:first-child{border-top:none}.jex-sheet-item-title{font-size:13.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.jex-sheet-item-ref{font-family:ui-monospace,Cascadia Code,Fira Code,monospace;font-size:11.5px;letter-spacing:.04em;color:var(--jex-text-muted)}.jex-sheet-error{padding:10px 12px;font-size:13px;line-height:1.45;border-radius:12px;color:var(--jex-text-error, #991b1b);background:var(--jex-bg-error, #fef2f2);border:1px solid var(--jex-border-error, #fecaca)}.jex-sheet-hint{font-size:12.5px;line-height:1.4;color:var(--jex-text-muted)}.jex-sheet-actions{display:flex;gap:8px;margin-top:2px}.jex-sheet-btn{flex:1;height:42px;display:inline-flex;align-items:center;justify-content:center;gap:8px;border-radius:12px;border:1px solid var(--jex-border-input);background:transparent;color:var(--jex-text-main);font-family:inherit;font-size:14px;font-weight:600;cursor:pointer}.jex-sheet-btn:disabled{opacity:.55;cursor:default}.jex-sheet-spinner{width:14px;height:14px;border:2px solid rgba(255,255,255,.45);border-top-color:#fff;border-radius:50%;animation:jex-spin .7s linear infinite}@media(max-width:480px),(pointer:coarse){.jex-home-row-open,.jex-home-row-check{min-height:56px;padding-top:12px;padding-bottom:12px}.jex-home-row-title{font-size:15px}.jex-home-row-meta{font-size:12.5px}.jex-home-row-more{margin-right:4px}.jex-home-row-menu-btn{width:44px;height:44px}.jex-home-row-menu-item{min-height:44px;font-size:14px}.jex-home-list-link{min-height:44px;padding:0 8px}.jex-home-select-btn,.jex-sheet-btn{height:48px;font-size:15px}.jex-sheet{gap:14px;padding:24px 20px calc(24px + env(safe-area-inset-bottom,0px))}.jex-sheet-title{font-size:18px}.jex-sheet-text{font-size:15px}}@media(prefers-reduced-motion:reduce){.jex-sheet-backdrop,.jex-sheet,.jex-home-note{animation:none}}.jex-home-new-btn{background:transparent;color:var(--jex-text-muted);border:1px solid var(--jex-border-input);border-radius:12px;padding:12px 20px;font-size:14px;font-weight:500;cursor:pointer;font-family:inherit;transition:color .2s,border-color .2s,background .2s;width:100%}.jex-home-new-btn:hover{color:var(--jex-text-main);border-color:var(--jex-text-muted);background:color-mix(in srgb,var(--jex-primary) 3%,transparent)}.jex-session-ref{display:flex;align-items:center;gap:8px;padding:8px 12px;background:var(--jex-bg-msg-bot);border:1px solid var(--jex-border-window);border-radius:8px;font-size:12px}.jex-session-ref-label{color:var(--jex-text-muted);font-weight:500}.jex-session-ref-code{color:var(--jex-primary);font-weight:700;font-family:ui-monospace,Cascadia Code,monospace;letter-spacing:.05em}.jex-chat-messages{flex:1;padding:20px;overflow-y:auto;display:flex;flex-direction:column;gap:12px}.jex-message-row{display:flex;align-items:flex-end;gap:8px;max-width:85%}.jex-message-row.bot{align-self:flex-start;flex-direction:column;align-items:stretch;gap:6px;max-width:92%}.jex-message-head{display:flex;align-items:center;gap:8px;padding-left:2px}.jex-message-head .jex-avatar{margin-bottom:0}.jex-avatar{width:24px;height:24px;border-radius:50%;flex-shrink:0;display:flex;align-items:center;justify-content:center;font-size:12px;margin-bottom:2px}.jex-avatar-bot{background:var(--jex-bg-msg-bot);color:var(--jex-primary)}.jex-avatar-agent{background:var(--jex-bg-avatar-agent)}.jex-avatar-img{width:100%;height:100%;border-radius:50%;object-fit:cover}.jex-avatar-initials{font-size:9px;font-weight:700;color:var(--jex-text-avatar-agent)}.jex-message-author{font-size:13px;font-weight:600;color:var(--jex-text-main);line-height:1.2}.jex-quote-btn{position:absolute;top:-8px;right:-8px;display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;padding:0;border:1px solid var(--jex-border-window);border-radius:50%;background:var(--jex-bg-window);color:var(--jex-text-muted, #6b7280);box-shadow:0 1px 4px #0000001f;cursor:pointer;opacity:0;transform:scale(.9);transition:opacity .12s,transform .12s,background .15s,color .15s}.jex-quote-btn:hover{background:var(--jex-bg-msg-bot);color:var(--jex-primary, #115A62);transform:scale(1)}.jex-quote-btn:focus-visible{opacity:1;transform:scale(1);outline:2px solid var(--jex-primary, #115A62);outline-offset:1px}@media(hover:hover){.jex-message:hover .jex-quote-btn{opacity:1;transform:scale(1)}}@media(hover:none){.jex-quote-btn{opacity:1;transform:scale(1)}}.jex-message.user .jex-mention{font-weight:700;background:#ffffff38;border-radius:4px;padding:0 3px}.jex-quoted-chip{display:flex;align-items:flex-start;gap:4px;width:100%;margin-bottom:6px;padding-bottom:6px;border:none;border-bottom:1px solid var(--jex-border-window);background:transparent;color:inherit;font:inherit;font-size:12px;opacity:.8;text-align:left;cursor:pointer}.jex-quoted-chip:hover{opacity:1}.jex-quoted-chip-text{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.jex-quoted-chip-author{font-weight:600}.jex-quoted-list{display:flex;flex-direction:column}.jex-quoted-list .jex-quoted-chip{margin-bottom:3px;padding-bottom:3px}.jex-quoted-list .jex-quoted-chip:last-child{margin-bottom:6px;padding-bottom:6px}.jex-msg-highlight{outline:2px solid var(--jex-primary, #115A62);outline-offset:2px;transition:outline-color .2s}.jex-reply-preview{display:flex;align-items:center;gap:6px;padding:6px 10px;border-radius:10px;background:var(--jex-bg-msg-bot);border:1px solid var(--jex-border-window);font-size:12px;color:var(--jex-text-muted)}.jex-reply-preview-icon{flex:0 0 auto;color:var(--jex-primary)}.jex-reply-preview-text{min-width:0;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.jex-reply-preview-author{font-weight:600;color:var(--jex-text-main)}.jex-reply-preview-cancel{flex:0 0 auto;display:inline-flex;padding:2px;border:none;border-radius:4px;background:transparent;color:var(--jex-text-muted);cursor:pointer}.jex-reply-preview-cancel:hover{color:var(--jex-text-main);background:#0000000f}.jex-message{position:relative;padding:12px 16px;border-radius:18px;font-size:14px;line-height:1.4}.jex-message.bot{background:var(--jex-bg-msg-bot);border:1px solid var(--jex-border-window);color:var(--jex-text-msg-bot);border-radius:16px}.jex-message.user{align-self:flex-end;max-width:80%;background:var(--jex-bg-msg-user);color:var(--jex-text-msg-user);border-bottom-right-radius:4px}.jex-typing{align-self:flex-start;display:flex;gap:4px;padding:12px 16px}.jex-typing span{width:8px;height:8px;border-radius:50%;background:var(--jex-text-muted);animation:jexTypingDot 1.2s infinite ease-in-out}.jex-typing span:nth-child(2){animation-delay:.2s}.jex-typing span:nth-child(3){animation-delay:.4s}@keyframes jexTypingDot{0%,80%,to{transform:scale(.8);opacity:.4}40%{transform:scale(1);opacity:1}}.jex-md{word-break:break-word;overflow-wrap:anywhere}.jex-md p{margin:0 0 8px}.jex-md p:last-child{margin-bottom:0}.jex-md strong{font-weight:600}.jex-md em{font-style:italic}.jex-md ul,.jex-md ol{margin:0 0 8px;padding-left:20px}.jex-md ul:last-child,.jex-md ol:last-child{margin-bottom:0}.jex-md ul{list-style-type:disc}.jex-md ol{list-style-type:decimal}.jex-md li{margin-bottom:2px}.jex-md li:last-child{margin-bottom:0}.jex-md a{color:var(--jex-primary);text-decoration:underline;text-underline-offset:2px}.jex-md a:hover{opacity:.8}.jex-md img{display:block;width:auto;height:auto;max-width:100%;max-height:260px;margin:4px 0;border-radius:8px;background:#0000000a}.jex-md-img-link{display:inline-block;text-decoration:none;cursor:zoom-in}.jex-md-img-link:hover{opacity:1}.jex-md-img-link:hover img{opacity:.9}.jex-md code{background:#00000014;padding:1px 5px;border-radius:4px;font-size:.9em;font-family:ui-monospace,Cascadia Code,Fira Code,monospace}.jex-md pre{background:#0000000f;border-radius:8px;padding:10px 12px;margin:0 0 8px;overflow-x:auto;font-size:.85em}.jex-md pre:last-child{margin-bottom:0}.jex-md pre code{background:none;padding:0;border-radius:0;font-size:inherit}.jex-md h1,.jex-md h2,.jex-md h3,.jex-md h4{font-weight:600;margin:8px 0 4px}.jex-md h1:first-child,.jex-md h2:first-child,.jex-md h3:first-child,.jex-md h4:first-child{margin-top:0}.jex-md h3{font-size:1em}.jex-md h4{font-size:.95em}.jex-md hr{border:none;border-top:1px solid var(--jex-border-window);margin:8px 0}.jex-md blockquote{border-left:3px solid var(--jex-primary);background:color-mix(in srgb,currentColor 6%,transparent);border-radius:0 8px 8px 0;margin:0 0 8px;padding:6px 12px;color:var(--jex-text-muted)}.jex-md blockquote:last-child{margin-bottom:0}.jex-md table{width:100%;border-collapse:collapse;margin:0 0 8px;font-size:.95em}.jex-md table:last-child{margin-bottom:0}.jex-md th,.jex-md td{text-align:left;padding:6px 10px;border-bottom:1px solid color-mix(in srgb,currentColor 14%,transparent)}.jex-md th{font-weight:600;border-bottom-width:2px}.jex-md tr:last-child td{border-bottom:none}.jex-md tbody tr:nth-child(2n) td{background:color-mix(in srgb,currentColor 5%,transparent)}.jex-md .jex-card-grid{display:flex;flex-direction:column;gap:8px;margin:0 0 8px}.jex-md .jex-card-grid:last-child{margin-bottom:0}.jex-md .jex-card{border:1px solid color-mix(in srgb,currentColor 16%,transparent);background:color-mix(in srgb,currentColor 5%,transparent);border-radius:10px;padding:10px 12px}.jex-md .jex-card-title{font-weight:700;margin-bottom:4px}.jex-md .jex-card>:last-child{margin-bottom:0}.dark .jex-md code,.jex-widget.dark .jex-md code{background:#ffffff1a}.dark .jex-md pre,.jex-widget.dark .jex-md pre{background:#ffffff14}@media(prefers-color-scheme:dark){:host:not(.light) .jex-widget:not(.light) .jex-md code{background:#ffffff1a}:host:not(.light) .jex-widget:not(.light) .jex-md pre{background:#ffffff14}}.jex-streaming-cursor:after{content:"◊";margin-left:2px;animation:jexBlinkCursor .8s ease-in-out infinite}@keyframes jexBlinkCursor{0%,to{opacity:1}50%{opacity:0}}.jex-session-notice{align-self:center;text-align:center;padding:8px 16px;margin:8px 0;font-size:12px;color:var(--jex-text-muted);background:var(--jex-bg-input, #f1f5f9);border-radius:8px;line-height:1.4}.jex-message-error{background:var(--jex-bg-error, #fef2f2)!important;border-color:var(--jex-border-error, #fecaca)!important;color:var(--jex-text-error, #991b1b)!important}.jex-chat-input{padding:12px 16px;border-top:1px solid var(--jex-border-window);display:flex;flex-direction:column;gap:8px;flex-shrink:0}.jex-chat-input-composer-gate{position:relative}.jex-chat-input-composer-gate-open{z-index:2}.jex-chat-input-composer-gate-open .jex-composer-card{pointer-events:none}.jex-composer-card{display:flex;flex-direction:column;gap:6px;padding:10px 12px 8px;background:var(--jex-bg-input);border:1px solid var(--jex-border-input);border-radius:16px;cursor:text;transition:border-color .15s ease,background .15s ease,box-shadow .15s ease}.jex-composer-card:focus-within{border-color:var(--jex-primary);background:var(--jex-bg-window);box-shadow:0 0 0 3px color-mix(in srgb,var(--jex-primary, #115A62) 14%,transparent)}.jex-composer-attachments{display:flex;flex-wrap:wrap;gap:6px;padding:2px 2px 4px}.jex-attachment-chip{position:relative;width:44px;height:44px;border-radius:8px;overflow:hidden;background:var(--jex-bg-msg-bot, #f1f5f9);flex-shrink:0;box-shadow:0 1px 2px #0000000f}.jex-attachment-thumb{width:100%;height:100%;object-fit:cover;display:block;pointer-events:none}.jex-attachment-remove{position:absolute;top:2px;right:2px;width:16px;height:16px;padding:0;border:none;border-radius:50%;background:#0f172ac7;color:#fff;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;opacity:0;transition:opacity .12s ease,transform .12s ease}.jex-attachment-chip:hover .jex-attachment-remove,.jex-attachment-chip:focus-within .jex-attachment-remove{opacity:1}.jex-attachment-remove:before{content:"";position:absolute;inset:-4px}@media(hover:none){.jex-attachment-remove{opacity:1}}.jex-attachment-remove:hover{transform:scale(1.08)}.jex-attachment-chip:has(.jex-attachment-file){width:auto;max-width:160px}.jex-attachment-file{display:flex;align-items:center;gap:6px;height:100%;padding:0 24px 0 10px;font-size:12px;color:var(--jex-text-main, #0f172a)}.jex-attachment-file svg{flex-shrink:0}.jex-attachment-file-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.jex-attachment-chip[data-status=uploading]{opacity:.6}.jex-attachment-chip[data-status=failed]{box-shadow:0 0 0 2px var(--jex-text-error, #991b1b)}.jex-attachment-chip[data-status=failed] .jex-attachment-remove{opacity:1}.jex-attachment-chip{transition:opacity .15s ease,box-shadow .15s ease}.jex-attachment-note{margin:0 2px 4px;font-size:11px;line-height:1.4;color:var(--jex-text-muted, #64748b)}.jex-attachment-status{margin:0 0 6px;font-size:12px;line-height:1.4;color:var(--jex-text-muted, #64748b)}.jex-attachment-status:empty{margin:0}.jex-attachment-status-error{color:var(--jex-text-error, #991b1b)}.jex-msg-files{display:flex;flex-wrap:wrap;gap:6px;margin:4px 0 2px}.jex-msg-files-user{justify-content:flex-end}.jex-msg-files-bot{justify-content:flex-start}.jex-msg-file-thumb{display:block;width:96px;height:96px;border-radius:14px;overflow:hidden;background:var(--jex-bg-msg-bot, #f1f5f9);border:1px solid var(--jex-border-window, rgba(226, 232, 240, .8));transition:opacity .15s ease}.jex-msg-file-thumb:hover{opacity:.9}.jex-msg-file-thumb img{width:100%;height:100%;object-fit:cover;display:block}.jex-msg-file-card{display:flex;align-items:center;gap:8px;max-width:220px;padding:8px 10px;border-radius:12px;background:var(--jex-bg-msg-bot, #f1f5f9);border:1px solid var(--jex-border-window, rgba(226, 232, 240, .8));color:var(--jex-text-main, #0f172a);text-decoration:none;transition:background-color .15s ease,opacity .15s ease}a.jex-msg-file-card:hover{background:var(--jex-border-window, rgba(226, 232, 240, .8))}.jex-msg-file-card svg{flex-shrink:0;color:var(--jex-text-muted, #64748b)}.jex-msg-file-card[aria-disabled=true],.jex-msg-file-pending{opacity:.7}.jex-msg-files-error{display:flex;flex-wrap:wrap;align-items:baseline;gap:4px;margin:0 0 4px;font-size:12px;line-height:1.4;color:var(--jex-text-error, #991b1b)}.jex-msg-files-retry{padding:0;border:none;background:none;font:inherit;font-weight:600;color:var(--jex-primary, #115A62);cursor:pointer;transition:opacity .15s ease}.jex-msg-files-retry:hover,.jex-msg-files-retry:focus-visible{opacity:.75}.jex-msg-file-text{display:flex;flex-direction:column;min-width:0}.jex-msg-file-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:500}.jex-msg-file-meta{font-size:11px;color:var(--jex-text-muted, #64748b)}.jex-msg-file-unavailable{border-style:dashed;background:transparent;color:var(--jex-text-muted, #64748b)}@media(prefers-reduced-motion:reduce){.jex-attachment-chip,.jex-msg-file-thumb,.jex-msg-file-card{transition:none}}.jex-composer-textarea{width:100%;min-height:22px;background:transparent;border:none;outline:none;resize:none;padding:2px 4px;color:var(--jex-text-main);font-family:inherit;font-size:16px;line-height:1.45;overflow-y:hidden}.jex-composer-textarea::placeholder{color:var(--jex-text-muted);opacity:.85}.jex-composer-textarea:disabled{cursor:not-allowed;opacity:.7}.jex-composer-actions{display:flex;align-items:center;justify-content:space-between;gap:8px}.jex-composer-actions-left{display:inline-flex;align-items:center;gap:4px}.jex-attach-btn{width:30px;height:30px;padding:0;border:none;border-radius:50%;background:transparent;color:var(--jex-text-muted);display:inline-flex;align-items:center;justify-content:center;cursor:pointer;transition:background .12s ease,color .12s ease,transform .12s ease}.jex-attach-btn:hover:not(:disabled){background:color-mix(in srgb,var(--jex-text-muted, #64748b) 12%,transparent);color:var(--jex-text-main)}.jex-attach-btn:active:not(:disabled){transform:scale(.92)}.jex-attach-btn:disabled{opacity:.4;cursor:not-allowed}.jex-mic-btn{position:relative}.jex-mic-btn svg{position:relative}.jex-mic-ring{position:absolute;inset:0;border-radius:50%;background:var(--jex-primary);opacity:0;transition:transform 80ms linear,opacity .12s ease;pointer-events:none}.jex-mic-btn-listening{color:var(--jex-primary)}@keyframes jex-mic-pulse{0%,to{opacity:.2}50%{opacity:.45}}@media(prefers-reduced-motion:reduce),(pointer:coarse){.jex-mic-ring{transition:none}.jex-mic-btn-listening .jex-mic-ring{animation:jex-mic-pulse 1.6s ease-in-out infinite}}.jex-voice-status{margin:0 0 6px;font-size:12px;line-height:1.4;color:var(--jex-text-muted, #64748b)}.jex-voice-status:empty{margin:0}.jex-voice-status-error{color:var(--jex-text-error, #991b1b)}.jex-visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.jex-rate-limit-notice{flex:0 0 auto;order:-1;margin-bottom:8px;padding:8px 12px;border-radius:10px;background:var(--jex-bg-msg-bot, #f1f5f9);color:var(--jex-text-muted, #64748b);font-size:12px;line-height:1.4;text-align:center}.jex-session-error-notice{flex:0 0 auto;order:-1;margin-bottom:8px;padding:8px 12px;border-radius:10px;background:var(--jex-bg-error, #fef2f2);border:1px solid var(--jex-border-error, #fecaca);color:var(--jex-text-error, #991b1b);font-size:12px;line-height:1.4;text-align:center}.jex-chat-input input{flex:1;background:var(--jex-bg-input);border:1px solid var(--jex-border-input);border-radius:12px;padding:10px 14px;color:var(--jex-text-main);outline:none;font-family:inherit;font-size:14px}.jex-chat-input input:focus{border-color:var(--jex-primary)}.jex-send-btn{background:color-mix(in srgb,var(--jex-text-muted, #64748b) 18%,transparent);color:var(--jex-text-muted);border:none;border-radius:999px;width:30px;height:30px;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;transition:background .15s ease,color .15s ease,opacity .15s ease,transform .15s ease;flex-shrink:0}.jex-send-btn-active{background:var(--jex-bg-send-btn, var(--jex-primary));color:var(--jex-text-header, #fff)}.jex-send-btn-active:hover:not(:disabled){background:var(--jex-primary-hover)}.jex-send-btn:active:not(:disabled){transform:scale(.9)}.jex-send-btn:disabled{opacity:.45;cursor:default}.jex-widget-footer{display:flex;align-items:center;justify-content:center;padding:8px 16px;border-top:1px solid var(--jex-border-glass);background:#00000005;flex-shrink:0}.jex-widget.dark .jex-widget-footer{background:#ffffff05}@media(prefers-color-scheme:dark){:host:not(.light) .jex-widget:not(.light) .jex-widget-footer{background:#ffffff05}}.jex-branding{display:flex;align-items:center;gap:6px;text-decoration:none;color:var(--jex-text-muted);font-size:11px;font-weight:500;transition:color .2s}.jex-branding:hover{color:var(--jex-text-main)}.jex-branding-icon{color:var(--jex-primary)}.jex-branding span strong{font-weight:700;color:var(--jex-text-main)}.jex-privacy-notice-link,.jex-privacy-chip-link{color:var(--jex-primary);text-decoration:underline;text-underline-offset:2px;text-decoration-color:color-mix(in srgb,var(--jex-primary) 50%,transparent);transition:text-decoration-color .15s}.jex-privacy-notice-link:hover,.jex-privacy-chip-link:hover{text-decoration-color:var(--jex-primary)}.jex-privacy-chip{align-self:center;display:inline-flex;align-items:center;gap:6px;max-width:100%;margin:0;padding:5px 10px;border-radius:999px;background:color-mix(in srgb,var(--jex-primary) 10%,var(--jex-bg-window));color:var(--jex-primary);font-size:10px;font-weight:650;line-height:1.2}.jex-privacy-chip-icon{display:inline-flex;flex-shrink:0}.jex-privacy-chip-link{color:inherit;text-decoration:none}.jex-privacy-explicit{position:absolute;left:0;right:0;bottom:0;z-index:3;display:flex;flex-direction:column;gap:10px;min-height:100%;padding:10px 12px 12px;border:1px solid var(--jex-border-window);border-radius:14px 14px 10px 10px;background:var(--jex-bg-window);box-shadow:0 -12px 36px #0f172a24;pointer-events:auto}.jex-privacy-explicit-content{display:flex;align-items:flex-start;gap:10px}.jex-privacy-explicit-icon{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;border-radius:8px;background:color-mix(in srgb,var(--jex-primary) 10%,var(--jex-bg-window));color:var(--jex-primary);flex-shrink:0}.jex-privacy-explicit-copy{min-width:0;flex:1}.jex-privacy-explicit-title{color:var(--jex-text-main);font-size:12px;font-weight:750;line-height:1.2;margin-bottom:3px}.jex-privacy-explicit-body{margin:0;color:var(--jex-text-muted);font-size:10px;line-height:1.35}.jex-privacy-explicit-button{width:100%;border:none;border-radius:10px;background:var(--jex-bg-send-btn);color:var(--jex-text-header);cursor:pointer;font-family:inherit;font-size:12px;font-weight:750;padding:9px 12px;transition:background .15s ease,transform .12s ease}.jex-privacy-explicit-button:hover{background:var(--jex-primary-hover)}.jex-privacy-explicit-button:active{transform:scale(.98)}.jex-locale-select-wrapper{position:relative;display:flex;align-items:center}.jex-locale-select{appearance:none;-webkit-appearance:none;background:transparent;border:1px solid transparent;padding:4px 20px 4px 6px;border-radius:6px;font-family:inherit;font-size:11px;font-weight:600;color:var(--jex-text-muted);background-color:transparent;cursor:pointer;outline:none;transition:all .2s ease}.jex-locale-select option{background-color:#fff;color:#0f172a}.jex-locale-select:hover,.jex-locale-select:focus-visible{color:var(--jex-text-main);background:#0000000a}.jex-widget.dark .jex-locale-select:hover,.jex-widget.dark .jex-locale-select:focus-visible{background:#ffffff0d}.jex-widget.dark .jex-locale-select option{background-color:#0f172a;color:#f8fafc}@media(prefers-color-scheme:dark){:host:not(.light) .jex-widget:not(.light) .jex-locale-select:hover,:host:not(.light) .jex-widget:not(.light) .jex-locale-select:focus-visible{background:#ffffff0d}:host:not(.light) .jex-widget:not(.light) .jex-locale-select option{background-color:#0f172a;color:#f8fafc}}.jex-locale-select:focus-visible{border-color:var(--jex-primary)}.jex-locale-chevron{position:absolute;right:4px;pointer-events:none;color:var(--jex-text-muted);transition:color .2s ease}.jex-locale-select-wrapper:hover .jex-locale-chevron{color:var(--jex-text-main)}.jex-overlay{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;background:var(--jex-bg-window, #fff);z-index:10;padding:24px;text-align:center}.jex-loading-spinner{width:32px;height:32px;border:3px solid var(--jex-border-input, #e2e8f0);border-top-color:var(--jex-primary, #115A62);border-radius:50%;animation:jex-spin .7s linear infinite}@keyframes jex-spin{to{transform:rotate(360deg)}}.jex-loading-message{font-size:14px;color:var(--jex-text-muted, #64748b)}.jex-error-message{font-size:14px;color:var(--jex-text-main, #334155)}.jex-error-actions{display:flex;gap:8px}.jex-error-retry,.jex-error-back{padding:8px 16px;border-radius:8px;font-size:13px;font-weight:600;cursor:pointer;border:none}.jex-error-retry{background:var(--jex-primary, #115A62);color:#fff}.jex-error-back{background:transparent;color:var(--jex-text-muted, #64748b);border:1px solid var(--jex-border-input, #e2e8f0)}.jex-selection{display:flex;flex-direction:column;gap:12px;padding:24px 16px;height:100%}.jex-selection-title{font-size:16px;font-weight:700;color:var(--jex-text-main, #0f172a);margin:0 0 8px}.jex-selection-options{display:flex;flex-direction:column;gap:10px}.jex-selection-option{display:flex;flex-direction:column;align-items:flex-start;gap:2px;padding:16px;border-radius:12px;border:1px solid var(--jex-border-window, #e2e8f0);background:transparent;cursor:pointer;text-align:left;transition:border-color .15s ease,background .15s ease}.jex-selection-option:hover{border-color:var(--jex-primary, #115A62);background:color-mix(in srgb,var(--jex-primary, #115A62) 5%,transparent)}.jex-selection-icon{font-size:20px}.jex-selection-label{font-size:14px;font-weight:600;color:var(--jex-text-main, #0f172a)}.jex-selection-sub{font-size:12px;color:var(--jex-text-muted, #64748b)}.jex-form-screen{display:flex;flex-direction:column;padding:20px 16px;height:100%;overflow-y:auto}.jex-form-title{font-size:16px;font-weight:700;color:var(--jex-text-main, #0f172a);margin:0 0 16px}.jex-form{display:flex;flex-direction:column;gap:10px}.jex-form-input,.jex-form-textarea{padding:10px 12px;border-radius:8px;border:1px solid var(--jex-border-input, #e2e8f0);font-size:14px;background:transparent;color:var(--jex-text-main, #0f172a);outline:none}@media(pointer:coarse){.jex-form-input,.jex-form-textarea{font-size:16px}}.jex-form-input:focus,.jex-form-textarea:focus{border-color:var(--jex-primary, #115A62)}.jex-form-textarea{min-height:80px;resize:vertical}.jex-form-submit{padding:10px;border-radius:8px;border:none;background:var(--jex-primary, #115A62);color:#fff;font-size:14px;font-weight:600;cursor:pointer;margin-top:4px}.jex-inline-form{display:flex;flex-direction:column;gap:8px;padding:12px;background:var(--jex-bg-msg-bot, #f1f5f9);border:1px solid var(--jex-border-input, #e2e8f0);border-radius:var(--jex-radius, .75rem);width:100%}.jex-inline-form-title{font-weight:600;font-size:15px;color:var(--jex-text-main, #0f172a);margin:0}.jex-inline-form-subtitle{font-size:13px;color:var(--jex-text-muted, #64748b);line-height:1.4;margin:0 0 4px}.jex-inline-form-consent{font-size:11px;color:var(--jex-text-muted, #64748b);line-height:1.3;margin-top:4px;text-align:center}.jex-inline-form .jex-form-submit:disabled{opacity:.7;cursor:not-allowed}.jex-escalation-subtitle{font-size:13px;color:var(--jex-text-muted, #64748b);line-height:1.45;margin:0 0 8px}.jex-escalation-skip{padding:8px 12px;border:none;background:transparent;color:var(--jex-text-muted, #64748b);font-size:13px;cursor:pointer;text-decoration:underline;text-underline-offset:2px;text-align:center}.jex-escalation-skip:hover{color:var(--jex-text-main, #0f172a)}.jex-inline-form-card{position:relative;padding:14px;gap:8px}.jex-inline-form-dismiss{position:absolute;top:10px;right:10px;width:24px;height:24px;border-radius:50%;border:1px solid var(--jex-border-input, #e2e8f0);background:var(--jex-bg-window, #fff);color:var(--jex-text-muted, #64748b);font-size:12px;cursor:pointer;display:flex;align-items:center;justify-content:center;line-height:1}.jex-inline-form-dismiss:hover{background:var(--jex-bg-msg-bot, #f1f5f9);color:var(--jex-text-main, #0f172a)}.jex-inline-form-submitted{display:flex;align-items:center;gap:10px;padding:10px 12px;background:var(--jex-bg-msg-bot, #f1f5f9);border:1px solid var(--jex-border-input, #e2e8f0);border-radius:var(--jex-radius, .75rem);width:100%}.jex-inline-form-check{display:flex;align-items:center;justify-content:center;width:24px;height:24px;border-radius:50%;background:color-mix(in srgb,var(--jex-primary) 15%,transparent);color:var(--jex-primary, #115A62);font-size:14px;font-weight:700;flex-shrink:0}.jex-inline-form-submitted-title{font-weight:600;font-size:var(--jex-font-size, 14px);color:var(--jex-text-main, #0f172a)}.jex-inline-form-submitted-detail{font-size:12px;color:var(--jex-text-muted, #64748b);margin-top:2px}.jex-magicline-row{display:flex;flex-direction:column;gap:8px}.jex-magicline-row>*{min-width:0}.jex-magicline-field{display:flex;flex-direction:column;gap:4px}.jex-magicline-field-label{font-size:12px;font-weight:500;color:var(--jex-text-muted, #64748b)}.jex-magicline-select{width:100%;appearance:none;cursor:pointer;padding-right:32px;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 10px center;background-size:16px 16px}.jex-magicline-slots-hint{font-size:12px;color:var(--jex-text-muted, #64748b);line-height:1.4;padding:2px 0}.jex-magicline-consent{display:flex;align-items:flex-start;gap:8px;font-size:11px;line-height:1.35;color:var(--jex-text-muted, #64748b);margin-top:2px;cursor:pointer}.jex-magicline-consent input[type=checkbox]{flex-shrink:0;margin-top:1px;accent-color:var(--jex-primary, #115A62)}.jex-magicline-error{font-size:12px;color:#dc2626;line-height:1.35}.jex-magicline-failed{border-color:color-mix(in srgb,#dc2626 35%,var(--jex-border-input, #e2e8f0))}.jex-magicline-failed-icon{background:color-mix(in srgb,#dc2626 15%,transparent);color:#dc2626}.jex-magicline-wizard-header{display:flex;flex-direction:column;gap:6px}.jex-magicline-wizard-progress{display:flex;align-items:baseline;justify-content:space-between;gap:8px}.jex-magicline-wizard-step-label{font-size:13px;font-weight:600;color:var(--jex-text-main, #0f172a)}.jex-magicline-wizard-counter{font-size:11px;color:var(--jex-text-muted, #64748b);flex-shrink:0}.jex-magicline-wizard-dots{display:flex;gap:6px}.jex-magicline-wizard-dot{width:7px;height:7px;border-radius:50%;background:color-mix(in srgb,var(--jex-text-muted, #64748b) 35%,transparent)}.jex-magicline-wizard-dot-active{background:var(--jex-primary, #115A62)}.jex-magicline-wizard-nav{display:flex;align-items:center;gap:8px;margin-top:4px}.jex-magicline-wizard-next{flex:1;margin-top:0}.jex-magicline-wizard-back{padding:10px 14px;border-radius:8px;border:1px solid var(--jex-border-input, #e2e8f0);background:transparent;color:var(--jex-text-main, #0f172a);font-size:14px;font-weight:600;cursor:pointer}.jex-magicline-wizard-back:hover{background:var(--jex-bg-window, #fff)}.jex-magicline-wizard-back:disabled,.jex-magicline-wizard-next:disabled{opacity:.7;cursor:not-allowed}.jex-magicline-radio-group{display:flex;flex-direction:column;gap:8px}.jex-magicline-radio-card{display:flex;align-items:center;gap:10px;padding:12px;border-radius:10px;border:1px solid var(--jex-border-input, #e2e8f0);font-size:14px;color:var(--jex-text-main, #0f172a);cursor:pointer}.jex-magicline-radio-card-active{border-color:var(--jex-primary, #115A62);background:color-mix(in srgb,var(--jex-primary, #115A62) 8%,transparent)}.jex-magicline-radio-card input[type=radio]{flex-shrink:0;accent-color:var(--jex-primary, #115A62)}.jex-magicline-slots-error{display:flex;flex-direction:column;gap:6px}.jex-magicline-retry{align-self:flex-start;padding:6px 12px;border-radius:8px;border:1px solid var(--jex-border-input, #e2e8f0);background:transparent;color:var(--jex-text-main, #0f172a);font-size:13px;font-weight:600;cursor:pointer}.jex-magicline-retry:hover{background:var(--jex-bg-window, #fff)}.jex-magicline-retry:disabled{opacity:.7;cursor:not-allowed}.jex-magicline-voucher-section{display:flex;flex-direction:column;gap:6px;margin-top:4px}.jex-magicline-voucher-field{flex-direction:row;align-items:stretch;gap:8px}.jex-magicline-voucher-field .jex-form-input{flex:1;min-width:0}.jex-magicline-voucher-apply{flex:0 0 auto;padding:10px 16px;border-radius:8px;border:none;background:var(--jex-primary, #115A62);color:#fff;font-size:14px;font-weight:600;cursor:pointer;white-space:nowrap}.jex-magicline-voucher-apply:hover{background:var(--jex-primary-hover)}.jex-magicline-voucher-apply:disabled{opacity:.7;cursor:not-allowed}.jex-magicline-review-wrap{position:relative}.jex-magicline-review-body{display:flex;flex-direction:column;gap:10px;transition:opacity .15s ease}.jex-magicline-review-body--reloading{opacity:.5;pointer-events:none}.jex-magicline-review-overlay{position:absolute;inset:0;display:flex;align-items:flex-start;justify-content:center;padding-top:48px}.jex-magicline-review-spinner{width:28px;height:28px;border-radius:50%;border:3px solid color-mix(in srgb,var(--jex-primary, #115A62) 25%,transparent);border-top-color:var(--jex-primary, #115A62);animation:jex-magicline-spin .7s linear infinite}@keyframes jex-magicline-spin{to{transform:rotate(360deg)}}.jex-magicline-voucher-discount-row dt,.jex-magicline-voucher-remarks-row dt{flex-shrink:1;min-width:0}.jex-magicline-voucher-remarks-row dd{min-width:0;overflow-wrap:anywhere;word-break:break-word}.jex-magicline-summary{display:flex;flex-direction:column;gap:6px;margin:0;padding:10px 12px;border-radius:8px;background:var(--jex-bg-window, #fff);border:1px solid var(--jex-border-input, #e2e8f0)}.jex-magicline-summary-row{display:flex;align-items:baseline;justify-content:space-between;gap:12px}.jex-magicline-summary-row dt{font-size:12px;color:var(--jex-text-muted, #64748b);flex-shrink:0}.jex-magicline-summary-row dd{margin:0;font-size:13px;font-weight:500;color:var(--jex-text-main, #0f172a);text-align:right;min-width:0}.jex-magicline-summary-section{margin-top:8px}.jex-magicline-summary-heading{font-size:12px;font-weight:600;color:var(--jex-text-main, #0f172a);margin-bottom:2px}.jex-magicline-summary-totals{background:color-mix(in srgb,var(--jex-primary, #115A62) 6%,transparent);border-color:color-mix(in srgb,var(--jex-primary, #115A62) 25%,transparent)}.jex-magicline-summary-total-row dt,.jex-magicline-summary-total-row dd{font-size:14px;font-weight:700;color:var(--jex-text-main, #0f172a)}.jex-magicline-summary-total-row dt{flex-shrink:1;min-width:0}.jex-magicline-summary-total-row dd{flex-shrink:0;white-space:nowrap;overflow-wrap:normal}.jex-magicline-offer-group{display:flex;flex-direction:column;gap:8px}.jex-magicline-offer-bundle-name{font-size:13px;font-weight:600;color:var(--jex-text-main, #0f172a)}.jex-magicline-offer-bundle-desc{font-size:12px;color:var(--jex-text-muted, #64748b)}.jex-magicline-radio-card .jex-magicline-offer-term{display:flex;flex-direction:column;gap:4px;flex:1}.jex-magicline-offer-term-head{display:flex;align-items:baseline;justify-content:space-between;gap:8px}.jex-magicline-offer-term-length{font-size:14px;font-weight:600;color:var(--jex-text-main, #0f172a)}.jex-magicline-offer-term-price{font-size:13px;font-weight:500;color:var(--jex-primary, #115A62)}.jex-magicline-offer-term-note{font-size:12px;color:var(--jex-text-muted, #64748b)}.jex-magicline-static-value{padding:9px 12px;border-radius:8px;font-size:14px;color:var(--jex-text-main, #0f172a);background:var(--jex-bg-window, #f8fafc);border:1px solid var(--jex-border-input, #e2e8f0)}.jex-magicline-terms{display:flex;flex-direction:column;gap:10px;padding:10px 12px;border-radius:8px;background:var(--jex-bg-window, #fff);border:1px solid var(--jex-border-input, #e2e8f0)}.jex-magicline-upgrades-recap-title,.jex-magicline-terms-title{font-size:12px;font-weight:600;color:var(--jex-text-main, #0f172a);margin-bottom:2px}.jex-magicline-terms-content{font-size:12px;line-height:1.5;color:var(--jex-text-muted, #64748b);white-space:pre-wrap}.jex-magicline-upgrade-group{display:flex;flex-direction:column;gap:8px}.jex-magicline-upgrade-card{display:flex;flex-direction:column;gap:6px;padding:12px;border-radius:10px;border:1px solid var(--jex-border-input, #e2e8f0);font-size:14px;color:var(--jex-text-main, #0f172a);cursor:pointer}.jex-magicline-upgrade-card-active{border-color:var(--jex-primary, #115A62);background:color-mix(in srgb,var(--jex-primary, #115A62) 8%,transparent)}.jex-magicline-upgrade-head{display:flex;align-items:flex-start;justify-content:space-between;gap:8px;cursor:pointer}.jex-magicline-upgrade-info{display:flex;flex-direction:column;gap:2px;flex:1}.jex-magicline-upgrade-name{font-size:14px;font-weight:600;color:var(--jex-text-main, #0f172a)}.jex-magicline-upgrade-desc{font-size:12px;color:var(--jex-text-muted, #64748b)}.jex-magicline-upgrade-price{font-size:13px;font-weight:500;color:var(--jex-primary, #115A62)}.jex-magicline-upgrade-status{flex-shrink:0;font-size:11px;font-weight:600;padding:2px 7px;border-radius:6px;border:1px solid var(--jex-border-input, #e2e8f0);color:var(--jex-text-muted, #64748b);background:transparent;white-space:nowrap}.jex-magicline-upgrade-card-active .jex-magicline-upgrade-status{border-color:var(--jex-primary, #115A62);color:var(--jex-primary, #115A62);background:color-mix(in srgb,var(--jex-primary, #115A62) 12%,transparent)}.jex-magicline-terms-prompt{font-size:13px;font-weight:600;color:var(--jex-text-main, #0f172a);margin-bottom:4px}.jex-magicline-bundle-details{font-size:12px;color:var(--jex-text-muted, #64748b)}.jex-magicline-bundle-details-summary{cursor:pointer;font-size:12px;font-weight:600;color:var(--jex-primary, #115A62);list-style-position:inside}.jex-magicline-bundle-details-summary:hover{text-decoration:underline}.jex-magicline-bundle-details-body{display:flex;flex-direction:column;gap:6px;margin-top:6px}.jex-magicline-bundle-details-list{margin:0;padding-left:18px;display:flex;flex-direction:column;gap:2px;line-height:1.4}.jex-magicline-bundle-details-footnote{margin:0;line-height:1.4}.jex-magicline-consent-region{display:flex;flex-direction:column;gap:4px;margin-top:6px;padding:6px 8px;border-left:3px solid var(--jex-primary, #115A62);border-radius:6px;background:color-mix(in srgb,var(--jex-primary, #115A62) 6%,transparent)}.jex-magicline-required-pill{display:inline-block;margin-left:6px;padding:1px 6px;border-radius:999px;font-size:9px;font-weight:700;letter-spacing:.04em;text-transform:uppercase;color:var(--jex-primary, #115A62);background:color-mix(in srgb,var(--jex-primary, #115A62) 12%,transparent);vertical-align:middle}.jex-magicline-consent-body{display:flex;flex-direction:column;gap:1px}.jex-magicline-consent-recap{display:flex;flex-direction:column;gap:2px}.jex-escalation-confirm{border-left:3px solid var(--jex-primary, #115A62);padding-left:8px}.jex-session-prompt{display:flex;flex-direction:column;align-items:center;gap:8px;padding:12px 16px;margin:8px 0;text-align:center}.jex-session-prompt-text{font-size:13px;color:var(--jex-text-muted, #64748b)}.jex-session-prompt-btn{padding:8px 16px;border-radius:8px;border:1px solid var(--jex-primary, #115A62);background:transparent;color:var(--jex-primary, #115A62);font-size:13px;font-weight:600;cursor:pointer}.jex-session-prompt-btn:hover{background:color-mix(in srgb,var(--jex-primary) 10%,transparent)}.jex-chat-input-resolved{display:flex;flex-direction:column;align-items:center;gap:10px;padding:14px 16px;border-top:1px solid var(--jex-border-input, #e2e8f0);background:var(--jex-bg-msg-bot, #f1f5f9);text-align:center}.jex-resolved-notice{font-size:13px;font-weight:500;color:var(--jex-text-muted, #64748b)}.jex-resolved-new-btn{padding:10px 20px;border-radius:8px;border:none;background:var(--jex-primary, #115A62);color:#fff;font-size:13px;font-weight:600;cursor:pointer;width:100%}.jex-resolved-new-btn:hover{opacity:.9}.jex-confirmation{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;padding:32px 24px;height:100%;text-align:center}.jex-confirmation-icon{width:48px;height:48px;border-radius:50%;background:color-mix(in srgb,var(--jex-primary, #115A62) 15%,transparent);color:var(--jex-primary, #115A62);font-size:22px;display:flex;align-items:center;justify-content:center}.jex-confirmation-title{font-size:18px;font-weight:700;color:var(--jex-text-main, #0f172a);margin:0}.jex-confirmation-body{font-size:13px;color:var(--jex-text-muted, #64748b);margin:0}.jex-confirmation-ref{font-size:20px;font-weight:700;letter-spacing:.05em;color:var(--jex-primary, #115A62);background:color-mix(in srgb,var(--jex-primary, #115A62) 10%,transparent);padding:10px 20px;border-radius:10px}.jex-confirmation-hint{font-size:12px;color:var(--jex-text-muted, #64748b);margin:0}.jex-confirmation-done{margin-top:8px;padding:10px 28px;border-radius:8px;border:none;background:var(--jex-primary, #115A62);color:#fff;font-size:14px;font-weight:600;cursor:pointer}.jex-home-lookup-link{background:none;border:none;font-size:12px;color:var(--jex-text-muted, #64748b);cursor:pointer;text-decoration:underline;padding:0;align-self:center}.jex-home-lookup{display:flex;gap:8px;width:100%;animation:jexFadeIn .4s .1s ease both}.jex-home-lookup-input{flex:1;padding:10px 14px;border-radius:10px;border:1px solid var(--jex-border-input, #e2e8f0);background:var(--jex-bg-input);color:var(--jex-text-main);font-size:14px;font-family:ui-monospace,Cascadia Code,Fira Code,monospace;letter-spacing:.04em;outline:none;transition:border-color .2s}@media(pointer:coarse){.jex-home-lookup-input{font-size:16px}}.jex-home-lookup-input::placeholder{font-family:inherit;letter-spacing:.04em;color:var(--jex-text-muted);opacity:.7}.jex-home-lookup-input:focus{border-color:var(--jex-primary, #115A62)}.jex-home-lookup-submit{padding:10px 16px;border-radius:10px;border:none;background:var(--jex-primary, #115A62);color:#fff;font-size:13px;font-weight:600;cursor:pointer;font-family:inherit;transition:background .2s,opacity .2s;flex-shrink:0}.jex-home-lookup-submit:hover:not(:disabled){background:var(--jex-primary-hover)}.jex-home-lookup-submit:disabled{opacity:.4;cursor:default}.jex-sources-row{margin-top:6px;margin-left:32px;display:flex;flex-direction:column;gap:6px}.jex-sources-toggle{display:inline-flex;align-items:center;gap:4px;padding:2px 8px;background:transparent;border:none;border-radius:6px;cursor:pointer;font-size:11px;color:var(--jex-text-muted, #6b7280);font-family:inherit;align-self:flex-start;transition:background .15s,color .15s}.jex-sources-toggle:hover{background:#0000000a;color:inherit}.jex-sources-icon{font-size:12px;line-height:1}.jex-sources-chevron{display:inline-block;font-size:10px;transition:transform .15s}.jex-sources-chevron--open{transform:rotate(180deg)}.jex-sources-pills{display:flex;flex-wrap:wrap;align-items:center;gap:6px}.jex-source-pill{display:inline-flex;align-items:center;gap:6px;max-width:240px;padding:2px 8px;border-radius:999px;border:1px solid rgba(0,0,0,.1);background:#0000000a;color:var(--jex-text-muted, #6b7280);font-size:11px;text-decoration:none;cursor:pointer;transition:background .15s,color .15s}.jex-source-pill:hover{background:#00000014;color:inherit}.jex-source-id{display:inline-flex;align-items:center;justify-content:center;min-width:16px;height:16px;padding:0 4px;border-radius:4px;background:var(--jex-primary, #115A62);color:#fff;font-size:10px;font-weight:600;line-height:1;flex-shrink:0;font-variant-numeric:tabular-nums}.jex-source-type{font-size:10px;flex-shrink:0}.jex-source-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:500}.jex-source-score{opacity:.6;flex-shrink:0;font-variant-numeric:tabular-nums}.jex-starter-chips{display:flex;flex-wrap:wrap;gap:8px;margin:4px 0}.jex-starter-chip{display:inline-flex;align-items:center;border-radius:999px;padding:7px 13px;background:var(--jex-bg-window);border:1px solid var(--jex-border-input);color:var(--jex-primary);text-align:left;font-size:13.5px;font-weight:500;line-height:1.2;cursor:pointer;transition:background .15s,border-color .15s,opacity .15s}.jex-starter-chip:hover:not(:disabled){background:color-mix(in srgb,var(--jex-primary) 8%,var(--jex-bg-window));border-color:var(--jex-primary)}.jex-starter-chip:disabled{opacity:.5;cursor:default}.jex-presence-dot{position:absolute;top:2px;right:2px;width:8px;height:8px;border-radius:999px;box-shadow:0 0 0 2px var(--jex-bg-header, #115A62)}.jex-presence-dot--online{background:#10b981}.jex-presence-dot--away{background:#fbbf24}.jex-presence-dot--offline{background:#9ca3af}@keyframes jex-ripple-expand{0%{transform:scale(1);opacity:.6}to{transform:scale(2.6);opacity:0}}.jex-waiting-card{display:flex;align-items:flex-start;gap:12px;padding:12px 14px;margin:0 12px 8px;background:var(--jex-bg-msg-bot, #f1f5f9);border:1px solid var(--jex-border-input, #e2e8f0);border-radius:var(--jex-radius, .75rem)}.jex-waiting-indicator{position:relative;flex-shrink:0;width:20px;height:20px;margin-top:2px;display:flex;align-items:center;justify-content:center}.jex-waiting-dot{position:relative;z-index:1;width:8px;height:8px;border-radius:50%;background:var(--jex-primary, #115A62)}.jex-waiting-ripple{position:absolute;inset:0;width:8px;height:8px;margin:auto;border-radius:50%;background:var(--jex-primary, #115A62);animation:jex-ripple-expand 1.6s ease-out infinite}@media(prefers-reduced-motion:reduce){.jex-waiting-ripple{animation:none}}.jex-waiting-body{display:flex;flex-direction:column;gap:4px;min-width:0}.jex-waiting-title{font-weight:600;font-size:14px;color:var(--jex-text-main, #0f172a);line-height:1.3}.jex-waiting-subtitle{font-size:12px;color:var(--jex-text-muted, #64748b);line-height:1.4}.jex-waiting-leave-email{margin-top:6px;padding:0;border:none;background:transparent;color:var(--jex-primary, #115A62);font-size:12px;font-family:inherit;text-decoration:underline;text-underline-offset:2px;cursor:pointer;text-align:left}.jex-waiting-leave-email:hover{opacity:.8}`;function pb(t){const e=document.createElement("style");e.textContent=fb,t.appendChild(e)}const mb=Ph,gb="https://festive-mouse-978.eu-west-1.convex.cloud";let aa=null;function xb(t){const e=t??gb;if(!e)throw new Error("[jexity] No Convex URL — set VITE_CONVEX_URL at build time or data-convex-url on the script tag");return aa||(aa=new Ih(Xh(e))),aa}function bb(t,e){const n=t.shadowRoot??t.attachShadow({mode:"open"});for(;n.firstChild;)n.removeChild(n.firstChild);pb(n),Hr.value=e.source,rt.value=e.bootstrapToken,Ae.value=[{id:"home"}],e.mode==="embedded"&&(t.classList.add("jex-mode-embedded"),fe.value=!0);const r=document.createElement("div");return e.mode==="embedded"&&(r.style.cssText="width:100%;height:100%"),n.appendChild(r),Gt(s(mb,{client:xb(e.convexUrl),children:s(db,{options:e})}),r),function(){Gt(null,r),fe.value=!1,Zn.value=null,Hr.value=void 0,rt.value=void 0,Wr.value=null,Ae.value=[{id:"home"}]}}function vb(t,e,n){const r=bb(t,e),i=new Set,o=fe.subscribe(l=>{for(const c of i)c(l)});return{shutdown(){o(),i.clear(),r(),n&&n()},logout(){Kr(),Zn.value=null,rt.value=void 0,oa().then(l=>{!l.ok&&l.reason==="superseded"||(Mt.value=l.ok?null:l.reason==="signed_in_user"?"signed-out":l.reason==="sign_in_paused"?"unavailable":"unauthorized")})},open(){fe.value=!0},close(){fe.value=!1},toggle(){fe.value=!fe.value},ask(l){const c=l.trim();if(c){Zn.value=c;const u=Ae.peek();u[u.length-1]?.id!=="chat"&&bt({id:"chat"})}fe.value=!0},get isOpen(){return fe.value},subscribe(l){return i.add(l),()=>{i.delete(l)}}}}let br=null;function yb(t){br&&br.shutdown();let e;t.container?e=typeof t.container=="string"?document.querySelector(t.container):t.container:(e=document.createElement("div"),e.id="jexity-chat-widget",document.body.appendChild(e));const n=vb(e,t,()=>{t.container||e.remove(),br===n&&(br=null)});return br=n,n}function Ut(t,e){return t.getAttribute(e)??void 0}function ru(t,e){const n=t.getAttribute(e);if(!n)return;const r=parseInt(n,10);return Number.isNaN(r)?void 0:r}async function iu(){const t=document.currentScript??document.querySelector("script[data-org-slug]")??document.querySelector("script[data-org-id]");if(!t)return;const e=t.getAttribute("data-org-slug")??t.getAttribute("data-org-id")??"default-org",n=t.getAttribute("data-proj-slug")??void 0,r=Ut(t,"data-convex-url")??"https://festive-mouse-978.eu-west-1.convex.cloud"??"",i=co(r),o=lf(t),a=nr(t.getAttribute("data-user-token")),l=await uo({orgSlug:e,siteUrl:i,projSlug:n,userToken:o});if(!l.ok){const d=window.location.origin,m=n?`project '${e}/${n}'`:`org '${e}'`;l.error==="unauthorized"?J.warn(`[JexityChat] This domain is not authorized for ${m}. Add '${d}' under Allowed Domains in your Jexity dashboard.`):l.error==="not_found"?J.warn(`[JexityChat] No active widget config found for ${m}. Check that the org slug is correct and the widget is enabled.`):l.error==="rate_limited"?J.warn(`[JexityChat] Bootstrap rate-limited for ${m}. Retry after ${l.retryAfterSec??60}s.`):l.error==="signed_in_user"?J.warn(ho(l)):J.warn(`[JexityChat] Bootstrap failed (network error). Check that the Convex deployment is reachable at ${i}.`);return}if(l.allowedUrls.length>0&&!l.allowedUrls.some(d=>fo(window.location.href,d))){const d=n?`project '${e}/${n}'`:`org '${e}'`;J.warn(`[JexityChat] Widget hidden for ${d} — current page does not match path rule. Allowed: ${l.allowedUrls.join(", ")}`);return}const c={orgSlug:e,projSlug:n,userToken:o,bootstrapToken:cf(t,a,l.token),allowedUrls:l.allowedUrls,excludePaths:l.excludePaths,maintenance:l.maintenance,position:Ut(t,"data-position")??void 0,theme:Ut(t,"data-theme")??void 0,greeting:Ut(t,"data-greeting"),title:Ut(t,"data-title"),primaryColor:Ut(t,"data-primary-color"),locale:Ut(t,"data-locale"),convexUrl:Ut(t,"data-convex-url"),triggerOffsetX:ru(t,"data-trigger-offset-x"),triggerOffsetY:ru(t,"data-trigger-offset-y")},u=yb(c);window.JexityChat=u,uf(t,()=>{u.logout()})}document.readyState==="complete"?iu():window.addEventListener("load",iu)})();
84
84
  //# sourceMappingURL=widget.js.map