@evelan/jexity-widget 0.26.0 → 0.27.0-canary.63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +2955 -2835
- package/dist/index.mjs.map +1 -1
- package/dist/loader.js +2 -2
- package/dist/loader.js.map +1 -1
- package/dist/react.mjs +2850 -2728
- package/dist/react.mjs.map +1 -1
- package/dist/types/entries/react.d.ts.map +1 -1
- package/dist/types/features/chat/components/ChatScreen.d.ts +3 -1
- package/dist/types/features/chat/components/ChatScreen.d.ts.map +1 -1
- package/dist/types/features/chat/components/MarkdownContent.d.ts.map +1 -1
- package/dist/types/features/chat/components/MessageList.d.ts.map +1 -1
- package/dist/types/features/chat/components/magicline/ContractCreationForm.d.ts.map +1 -1
- package/dist/types/features/chat/components/magicline/magiclineConstants.d.ts +1 -1
- package/dist/types/features/chat/components/magicline/magiclineConstants.d.ts.map +1 -1
- package/dist/types/features/chat/components/magicline/useContractCreationState.d.ts +5 -0
- package/dist/types/features/chat/components/magicline/useContractCreationState.d.ts.map +1 -1
- package/dist/types/features/chat/components/magicline/useTrialBookingState.d.ts.map +1 -1
- package/dist/types/features/chat/composer/components/ChatInput.d.ts +6 -2
- package/dist/types/features/chat/composer/components/ChatInput.d.ts.map +1 -1
- package/dist/types/features/chat/composer/components/SessionErrorNotice.d.ts +15 -1
- package/dist/types/features/chat/composer/components/SessionErrorNotice.d.ts.map +1 -1
- package/dist/types/features/chat/composer/hooks/useComposerInput.d.ts +3 -3
- package/dist/types/features/chat/composer/hooks/useComposerInput.d.ts.map +1 -1
- package/dist/types/features/chat/composer/hooks/useSendMessage.d.ts.map +1 -1
- package/dist/types/features/chat/hooks/useConversation.d.ts +1 -1
- package/dist/types/features/chat/hooks/useConversation.d.ts.map +1 -1
- package/dist/types/features/chat/hooks/useConvexSession.d.ts.map +1 -1
- package/dist/types/features/chat/hooks/useEnterWaiting.d.ts.map +1 -1
- package/dist/types/features/chat/hooks/useEscalation.d.ts +4 -4
- package/dist/types/features/chat/hooks/useHandoff.d.ts +4 -4
- package/dist/types/features/chat/hooks/useMagicline.d.ts +3 -3
- package/dist/types/features/chat/hooks/useMaintenance.d.ts +16 -0
- package/dist/types/features/chat/hooks/useMaintenance.d.ts.map +1 -0
- package/dist/types/features/chat/hooks/useUnreadTitleFlash.d.ts.map +1 -1
- package/dist/types/features/chat/hooks/useVisitorHeartbeat.d.ts.map +1 -1
- package/dist/types/features/chat/state/maintenance-error.d.ts +15 -0
- package/dist/types/features/chat/state/maintenance-error.d.ts.map +1 -0
- package/dist/types/features/chat/state/session-error.d.ts +4 -1
- package/dist/types/features/chat/state/session-error.d.ts.map +1 -1
- package/dist/types/features/home/components/HomeScreen.d.ts.map +1 -1
- package/dist/types/i18n/index.d.ts +1 -1
- package/dist/types/i18n/locales/de.d.ts +238 -237
- package/dist/types/i18n/locales/de.d.ts.map +1 -1
- package/dist/types/i18n/locales/en.d.ts +234 -232
- package/dist/types/i18n/locales/en.d.ts.map +1 -1
- package/dist/types/lib/convex-provider.d.ts +19 -0
- package/dist/types/lib/convex-provider.d.ts.map +1 -0
- package/dist/types/lib/logger.d.ts.map +1 -1
- package/dist/types/lib/widgetBootstrap.d.ts +7 -0
- package/dist/types/lib/widgetBootstrap.d.ts.map +1 -1
- package/dist/types/module/screens/ScreenRouter.d.ts +4 -1
- package/dist/types/module/screens/ScreenRouter.d.ts.map +1 -1
- package/dist/types/module/shell/WidgetShell.d.ts.map +1 -1
- package/dist/types/module/shell/hooks/useBootstrap.d.ts +2 -1
- package/dist/types/module/shell/hooks/useBootstrap.d.ts.map +1 -1
- package/dist/types/module/shell/hooks/usePathGuard.d.ts.map +1 -1
- package/dist/types/module/shell/mount.d.ts.map +1 -1
- package/dist/types/module/shell/shell.state.d.ts +8 -0
- package/dist/types/module/shell/shell.state.d.ts.map +1 -1
- package/dist/types/module/visitor/visitor.state.d.ts +1 -1
- package/dist/types/module/visitor/visitor.state.d.ts.map +1 -1
- package/dist/types/shared/hooks/useEffectEvent.d.ts +24 -0
- package/dist/types/shared/hooks/useEffectEvent.d.ts.map +1 -0
- package/dist/types/types.d.ts +7 -0
- package/dist/types/types.d.ts.map +1 -1
- package/dist/widget.js +36 -32
- package/dist/widget.js.map +1 -1
- package/package.json +3 -3
package/dist/widget.js
CHANGED
|
@@ -1,43 +1,47 @@
|
|
|
1
|
-
(function(){"use strict";var Tn,P,No,Mo,Ct,Oo,Lo,$o,ri,hr,Cn,Do,ii,oi,ai,qo,fr={},pr=[],mc=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,An=Array.isArray;function ot(t,e){for(var n in e)t[n]=e[n];return t}function si(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function Fe(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?Tn.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 Rn(t,a,r,i,null)}function Rn(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??++No,__i:-1,__u:0};return i==null&&P.vnode!=null&&P.vnode(o),o}function gc(){return{current:null}}function Z(t){return t.children}function Je(t,e){this.props=t,this.context=e}function Zt(t,e){if(e==null)return t.__?Zt(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"?Zt(t):null}function xc(t){if(t.__P&&t.__d){var e=t.__v,n=e.__e,r=[],i=[],o=ot({},e);o.__v=e.__v+1,P.vnode&&P.vnode(o),ci(t.__P,o,e,t.__n,t.__P.namespaceURI,32&e.__u?[n]:null,r,n??Zt(e),!!(32&e.__u),i),o.__v=e.__v,o.__.__k[o.__i]=o,Ho(r,o,i),e.__e=e.__=null,o.__e!=n&&zo(o)}}function zo(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}),zo(t)}function li(t){(!t.__d&&(t.__d=!0)&&Ct.push(t)&&!mr.__r++||Oo!=P.debounceRendering)&&((Oo=P.debounceRendering)||Lo)(mr)}function mr(){try{for(var t,e=1;Ct.length;)Ct.length>e&&Ct.sort($o),t=Ct.shift(),e=Ct.length,xc(t)}finally{Ct.length=mr.__r=0}}function Uo(t,e,n,r,i,o,a,l,c,u,f){var m,d,p,x,k,b,v,w=r&&r.__k||pr,R=e.length;for(c=bc(n,e,w,c,R),m=0;m<R;m++)(p=n.__k[m])!=null&&(d=p.__i!=-1&&w[p.__i]||fr,p.__i=m,b=ci(t,p,d,i,o,a,l,c,u,f),x=p.__e,p.ref&&d.ref!=p.ref&&(d.ref&&di(d.ref,null,p),f.push(p.ref,p.__c||x,p)),k==null&&x!=null&&(k=x),(v=!!(4&p.__u))||d.__k===p.__k?(c=Bo(p,c,t,v),v&&d.__e&&(d.__e=null)):typeof p.type=="function"&&b!==void 0?c=b:x&&(c=x.nextSibling),p.__u&=-7);return n.__e=k,c}function bc(t,e,n,r,i){var o,a,l,c,u,f=n.length,m=f,d=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]=Rn(null,a,null,null,null):An(a)?a=t.__k[o]=Rn(Z,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=t.__k[o]=Rn(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):t.__k[o]=a,c=o+d,a.__=t,a.__b=t.__b+1,l=null,(u=a.__i=yc(a,n,c,m))!=-1&&(m--,(l=n[u])&&(l.__u|=2)),l==null||l.__v==null?(u==-1&&(i>f?d--:i<f&&d++),typeof a.type!="function"&&(a.__u|=4)):u!=c&&(u==c-1?d--:u==c+1?d++:(u>c?d--:d++,a.__u|=4))):t.__k[o]=null;if(m)for(o=0;o<f;o++)(l=n[o])!=null&&(2&l.__u)==0&&(l.__e==r&&(r=Zt(l)),Qo(l,l));return r}function Bo(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=Bo(i[o],e,n,r));return e}t.__e!=e&&(r&&(e&&t.type&&!e.parentNode&&(e=Zt(t)),n.insertBefore(t.__e,e||null)),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function at(t,e){return e=e||[],t==null||typeof t=="boolean"||(An(t)?t.some(function(n){at(n,e)}):e.push(t)),e}function yc(t,e,n,r){var i,o,a,l=t.key,c=t.type,u=e[n],f=u!=null&&(2&u.__u)==0;if(u===null&&l==null||f&&l==u.key&&c==u.type)return n;if(r>(f?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 Fo(t,e,n){e[0]=="-"?t.setProperty(e,n??""):t[e]=n==null?"":typeof n!="number"||mc.test(e)?n:n+"px"}function gr(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||Fo(t.style,e,"");if(n)for(e in n)r&&n[e]==r[e]||Fo(t.style,e,n[e])}else if(e[0]=="o"&&e[1]=="n")o=e!=(e=e.replace(Do,"$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[Cn]=r[Cn]:(n[Cn]=ii,t.addEventListener(e,o?ai:oi,o)):t.removeEventListener(e,o?ai:oi,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 Vo(t){return function(e){if(this.l){var n=this.l[e.type+t];if(e[hr]==null)e[hr]=ii++;else if(e[hr]<n[Cn])return;return n(P.event?P.event(e):e)}}}function ci(t,e,n,r,i,o,a,l,c,u){var f,m,d,p,x,k,b,v,w,R,y,E,N,L,Y,ue,W=e.type;if(e.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[l=e.__e=n.__e]),(f=P.__b)&&f(e);e:if(typeof W=="function"){m=a.length;try{if(w=e.props,R=W.prototype&&W.prototype.render,y=(f=W.contextType)&&r[f.__c],E=f?y?y.props.value:f.__:r,n.__c?v=(d=e.__c=n.__c).__=d.__E:(R?e.__c=d=new W(w,E):(e.__c=d=new Je(w,E),d.constructor=W,d.render=wc),y&&y.sub(d),d.state||(d.state={}),d.__n=r,p=d.__d=!0,d.__h=[],d._sb=[]),R&&d.__s==null&&(d.__s=d.state),R&&W.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=ot({},d.__s)),ot(d.__s,W.getDerivedStateFromProps(w,d.__s))),x=d.props,k=d.state,d.__v=e,p)R&&W.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),R&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(R&&W.getDerivedStateFromProps==null&&w!==x&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(w,E),e.__v==n.__v||!d.__e&&d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(w,d.__s,E)===!1){e.__v!=n.__v&&(d.props=w,d.state=d.__s,d.__d=!1),e.__e=n.__e,e.__k=n.__k,e.__k.some(function(de){de&&(de.__=e)}),pr.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&a.push(d);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(w,d.__s,E),R&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(x,k,b)})}if(d.context=E,d.props=w,d.__P=t,d.__e=!1,N=P.__r,L=0,R)d.state=d.__s,d.__d=!1,N&&N(e),f=d.render(d.props,d.state,d.context),pr.push.apply(d.__h,d._sb),d._sb=[];else do d.__d=!1,N&&N(e),f=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++L<25);d.state=d.__s,d.getChildContext!=null&&(r=ot(ot({},r),d.getChildContext())),R&&!p&&d.getSnapshotBeforeUpdate!=null&&(b=d.getSnapshotBeforeUpdate(x,k)),Y=f!=null&&f.type===Z&&f.key==null?Wo(f.props.children):f,l=Uo(t,An(Y)?Y:[Y],e,n,r,i,o,a,l,c,u),d.base=e.__e,e.__u&=-161,d.__h.length&&a.push(d),v&&(d.__E=d.__=null)}catch(de){if(a.length=m,e.__v=null,c||o!=null)if(de.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(ue=o.length;ue--;)si(o[ue]);ui(e)}else e.__e=n.__e,!e.__k&&n.__k&&(e.__k=n.__k),de.then||ui(e);P.__e(de,e,n)}}else o==null&&e.__v==n.__v?(e.__k=n.__k,e.__e=n.__e):l=e.__e=vc(n.__e,e,n,r,i,o,a,c,u);return(f=P.diffed)&&f(e),128&e.__u?void 0:l}function ui(t){t&&(t.__c&&(t.__c.__e=!0),t.__k&&t.__k.some(ui))}function Ho(t,e,n){for(var r=0;r<n.length;r++)di(n[r],n[++r],n[++r]);P.__c&&P.__c(e,t),t.some(function(i){try{t=i.__h,i.__h=[],t.some(function(o){o.call(i)})}catch(o){P.__e(o,i.__v)}})}function Wo(t){return typeof t!="object"||t==null||t.__b>0?t:An(t)?t.map(Wo):t.constructor!==void 0?null:ot({},t)}function vc(t,e,n,r,i,o,a,l,c){var u,f,m,d,p,x,k,b=n.props||fr,v=e.props,w=e.type;if(w=="svg"?i="http://www.w3.org/2000/svg":w=="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==!!w&&(w?p.localName==w:p.nodeType==3)){t=p,o[u]=null;break}}if(t==null){if(w==null)return document.createTextNode(v);t=document.createElementNS(i,w,v.is&&v),l&&(P.__m&&P.__m(e,o),l=!1),o=null}if(w==null)b===v||l&&t.data==v||(t.data=v);else{if(o=w=="textarea"&&v.defaultValue!=null?null:o&&Tn.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||gr(t,u,null,p,i);for(u in v)p=v[u],u=="children"?d=p:u=="dangerouslySetInnerHTML"?f=p:u=="value"?x=p:u=="checked"?k=p:l&&typeof p!="function"||b[u]===p||gr(t,u,p,b[u],i);if(f)l||m&&(f.__html==m.__html||f.__html==t.innerHTML)||(t.innerHTML=f.__html),e.__k=[];else if(m&&(t.innerHTML=""),Uo(e.type=="template"?t.content:t,An(d)?d:[d],e,n,r,w=="foreignObject"?"http://www.w3.org/1999/xhtml":i,o,a,o?o[0]:n.__k&&Zt(n,0),l,c),o!=null)for(u=o.length;u--;)si(o[u]);l&&w!="textarea"||(u="value",w=="progress"&&x==null?t.removeAttribute("value"):x!=null&&(x!==t[u]||w=="progress"&&!x||w=="option"&&x!=b[u])&&gr(t,u,x,b[u],i),u="checked",k!=null&&k!=t[u]&&gr(t,u,k,b[u],i))}return t}function di(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){P.__e(i,n)}}function Qo(t,e,n){var r,i;if(P.unmount&&P.unmount(t),(r=t.ref)&&(r.current&&r.current!=t.__e||di(r,null,e)),(r=t.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(o){P.__e(o,e)}r.base=r.__P=r.__n=null}if(r=t.__k)for(i=0;i<r.length;i++)r[i]&&Qo(r[i],e,n||typeof t.type!="function");n||si(t.__e),t.__c=t.__=t.__e=void 0}function wc(t,e,n){return this.constructor(t,n)}function qt(t,e,n){var r,i,o,a;e==document&&(e=document.documentElement),P.__&&P.__(t,e),i=(r=typeof n=="function")?null:n&&n.__k||e.__k,o=[],a=[],ci(e,t=(!r&&n||e).__k=Fe(Z,null,[t]),i||fr,fr,e.namespaceURI,!r&&n?[n]:i?null:e.firstChild?Tn.call(e.childNodes):null,o,!r&&n?n:i?i.__e:e.firstChild,r,a),Ho(o,t,a),t.props.children=null}function Go(t,e){qt(t,e,Go)}function kc(t,e,n){var r,i,o,a,l=ot({},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?Tn.call(arguments,2):n),Rn(t.type,l,r||t.key,i||t.ref,null)}function _c(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,li(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"+qo++,e.__=t,e.Provider=e.__l=(e.Consumer=function(n,r){return n.children(r)}).contextType=e,e}Tn=pr.slice,P={__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}},No=0,Mo=function(t){return t!=null&&t.constructor===void 0},Je.prototype.setState=function(t,e){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=ot({},this.state),typeof t=="function"&&(t=t(ot({},n),this.props)),t&&ot(n,t),t!=null&&this.__v&&(e&&this._sb.push(e),li(this))},Je.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),li(this))},Je.prototype.render=Z,Ct=[],Lo=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,$o=function(t,e){return t.__v.__b-e.__v.__b},mr.__r=0,ri=Math.random().toString(8),hr="__d"+ri,Cn="__a"+ri,Do=/(PointerCapture)$|Capture$/i,ii=0,oi=Vo(!1),ai=Vo(!0),qo=0;var jc=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:--jc,__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 P.vnode&&P.vnode(u),u}var At,te,hi,Ko,Xt=0,Yo=[],ie=P,Jo=ie.__b,Zo=ie.__r,Xo=ie.diffed,ea=ie.__c,ta=ie.unmount,na=ie.__;function en(t,e){ie.__h&&ie.__h(te,t,Xt||e),Xt=0;var n=te.__H||(te.__H={__:[],__h:[]});return t>=n.__.length&&n.__.push({}),n.__[t]}function q(t){return Xt=1,De(ca,t)}function De(t,e,n){var r=en(At++,2);if(r.t=t,!r.__c&&(r.__=[n?n(e):ca(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=te,!te.__f)){var i=function(l,c,u){if(!r.__c.__H)return!0;var f=!1,m=r.__c.props!==l;if(r.__c.__H.__.some(function(p){if(p.__N){f=!0;var x=p.__[0];p.__=p.__N,p.__N=void 0,x!==p.__[0]&&(m=!0)}}),o){var d=o.call(this,l,c,u);return f?d||m:d}return!f||m};te.__f=!0;var o=te.shouldComponentUpdate,a=te.componentWillUpdate;te.componentWillUpdate=function(l,c,u){if(this.__e){var f=o;o=void 0,i(l,c,u),o=f}a&&a.call(this,l,c,u)},te.shouldComponentUpdate=i}return r.__N||r.__}function M(t,e){var n=en(At++,3);!ie.__s&&pi(n.__H,e)&&(n.__=t,n.u=e,te.__H.__h.push(n))}function En(t,e){var n=en(At++,4);!ie.__s&&pi(n.__H,e)&&(n.__=t,n.u=e,te.__h.push(n))}function qe(t){return Xt=5,fe(function(){return{current:t}},[])}function ra(t,e,n){Xt=6,En(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 fe(t,e){var n=en(At++,7);return pi(n.__H,e)&&(n.__=t(),n.__H=e,n.__h=t),n.__}function G(t,e){return Xt=8,fe(function(){return t},e)}function In(t){var e=te.context[t.__c],n=en(At++,9);return n.c=t,e?(n.__==null&&(n.__=!0,e.sub(te)),e.props.value):t.__}function ia(t,e){ie.useDebugValue&&ie.useDebugValue(e?e(t):t)}function oa(){var t=en(At++,11);if(!t.__){for(var e=te.__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 aa(){for(var t;t=Yo.shift();){var e=t.__H;if(t.__P&&e)try{e.__h.some(fi),e.__h.some(la),e.__h=[]}catch(n){e.__h=[],ie.__e(n,t.__v)}}}ie.__b=function(t){te=null,Jo&&Jo(t)},ie.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),na&&na(t,e)},ie.__r=function(t){Zo&&Zo(t),At=0;var e=(te=t.__c).__H;e&&(hi===te?(e.__h=[],te.__h=[],e.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(e.__h.length&&aa(),At=0)),hi=te},ie.diffed=function(t){Xo&&Xo(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(Yo.push(e)!==1&&Ko===ie.requestAnimationFrame||((Ko=ie.requestAnimationFrame)||Sc)(aa)),e.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),hi=te=null},ie.__c=function(t,e){e.some(function(n){try{n.__h.some(fi),n.__h=n.__h.filter(function(r){return!r.__||la(r)})}catch(r){e.some(function(i){i.__h&&(i.__h=[])}),e=[],ie.__e(r,n.__v)}}),ea&&ea(t,e)},ie.unmount=function(t){ta&&ta(t);var e,n=t.__c;n&&n.__H&&(n.__H.__.some(function(r){try{fi(r)}catch(i){e=i}}),n.__H=void 0,e&&ie.__e(e,n.__v))};var sa=typeof requestAnimationFrame=="function";function Sc(t){var e,n=function(){clearTimeout(r),sa&&cancelAnimationFrame(e),setTimeout(t)},r=setTimeout(n,35);sa&&(e=requestAnimationFrame(n))}function fi(t){var e=te,n=t.__c;typeof n=="function"&&(t.__c=void 0,n()),te=e}function la(t){var e=te;t.__c=t.__(),te=e}function pi(t,e){return!t||t.length!==e.length||e.some(function(n,r){return n!==t[r]})}function ca(t,e){return typeof e=="function"?e(t):e}function ua(t,e){for(var n in e)t[n]=e[n];return t}function mi(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 da(t,e){var n=e(),r=q({t:{__:n,u:e}}),i=r[0].t,o=r[1];return En(function(){i.__=n,i.u=e,gi(i)&&o({t:i})},[t,n,e]),M(function(){return gi(i)&&o({t:i}),t(function(){gi(i)&&o({t:i})})},[t]),n}function gi(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 ha(t){t()}function fa(t){return t}function pa(){return[!1,ha]}var ma=En;function xi(t,e){this.props=t,this.context=e}function Tc(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:mi(this.props,i)}function r(i){return this.shouldComponentUpdate=n,Fe(t,i)}return r.displayName="Memo("+(t.displayName||t.name)+")",r.__f=r.prototype.isReactComponent=!0,r.type=t,r}(xi.prototype=new Je).isPureReactComponent=!0,xi.prototype.shouldComponentUpdate=function(t,e){return mi(this.props,t)||mi(this.state,e)};var ga=P.__b;P.__b=function(t){t.type&&t.type.__f&&t.ref&&(t.props.ref=t.ref,t.ref=null),ga&&ga(t)};var Cc=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function Ac(t){function e(n){var r=ua({},n);return delete r.ref,t(r,n.ref||null)}return e.$$typeof=Cc,e.render=t,e.prototype.isReactComponent=e.__f=!0,e.displayName="ForwardRef("+(t.displayName||t.name)+")",e}var xa=function(t,e){return t==null?null:at(at(t).map(e))},Rc={map:xa,forEach:xa,count:function(t){return t?at(t).length:0},only:function(t){var e=at(t);if(e.length!==1)throw"Children.only";return e[0]},toArray:at},Ec=P.__e;P.__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)}Ec(t,e,n,r)};var ba=P.unmount;function ya(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=ua({},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 ya(r,e,n)})),t}function va(t,e,n){return t&&n&&(t.__v=null,t.__k=t.__k&&t.__k.map(function(r){return va(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 xr(){this.__u=0,this.o=null,this.__b=null}function wa(t){var e=t.__&&t.__.__c;return e&&e.__a&&e.__a(t)}function Ic(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?Fe(i,a):null}return o.displayName="Lazy",o.__f=!0,o}function Pn(){this.i=null,this.l=null}P.unmount=function(t){var e=t.__c;e&&(e.__z=!0),e&&e.__R&&e.__R(),e&&32&t.__u&&(t.type=null),ba&&ba(t)},(xr.prototype=new Je).__c=function(t,e){var n=e.__c,r=this;r.o==null&&(r.o=[]),r.o.push(n);var i=wa(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]=va(u,u.__c.__P,u.__c.__O)}var f;for(r.setState({__a:r.__b=null});f=r.o.pop();)f.__P=l,f.forceUpdate()}};r.__u++||32&e.__u||r.setState({__a:r.__b=r.__v.__k[0]}),t.then(a,a)},xr.prototype.componentWillUnmount=function(){this.o=[]},xr.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]=ya(this.__b,i,o.__O=o.__P)}this.__b=null}var a=e.__a&&Fe(Z,null,t.fallback);return a&&(a.__u&=-33),[Fe(Z,null,e.__a?null:t.children),a]};var ka=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 Pc(t){return this.getChildContext=function(){return t.context},t.children}function Nc(t){var e=this,n=t.v;if(e.componentWillUnmount=function(){qt(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)}}}qt(Fe(Pc,{context:e.context},t.__v),e.h)}function Mc(t,e){var n=Fe(Nc,{__v:t,v:e});return n.containerInfo=e,n}(Pn.prototype=new Je).__a=function(t){var e=this,n=wa(e.__v),r=e.l.get(t);return r[0]++,function(i){var o=function(){e.props.revealOrder?(r.push(i),ka(e,t,r)):i()};n?n(o):o()}},Pn.prototype.render=function(t){this.i=null,this.l=new Map;var e=at(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},Pn.prototype.componentDidUpdate=Pn.prototype.componentDidMount=function(){var t=this;this.l.forEach(function(e,n){ka(t,n,e)})};var _a=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,Oc=/^(?: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]/,Lc=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,$c=/[A-Z0-9]/g,Dc=typeof document<"u",qc=function(t){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(t)};function zc(t,e,n){return e.__k==null&&(e.textContent=""),qt(t,e),typeof n=="function"&&n(),t?t.__c:null}function Uc(t,e,n){return Go(t,e),typeof n=="function"&&n(),t?t.__c:null}Je.prototype.isReactComponent=!0,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(t){Object.defineProperty(Je.prototype,t,{configurable:!0,get:function(){return this["UNSAFE_"+t]},set:function(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})});var ja=P.event;P.event=function(t){return ja&&(t=ja(t)),t.persist=function(){},t.isPropagationStopped=function(){return this.cancelBubble},t.isDefaultPrevented=function(){return this.defaultPrevented},t.nativeEvent=t};var bi,Bc={configurable:!0,get:function(){return this.class}},Sa=P.vnode;P.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||Dc&&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"||qc(n.type)?c==="onfocus"?a="onfocusin":c==="onblur"?a="onfocusout":Lc.test(a)&&(a=c):c=a="oninput":o&&Oc.test(a)?a=a.replace($c,"-$&").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=at(n.children).forEach(function(u){u.props.selected=i.value.indexOf(u.props.value)!=-1})),i.defaultValue!=null&&(i.value=at(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",Bc)):n.className&&(i.class=i.className=n.className),e.props=i})(t),t.$$typeof=_a,Sa&&Sa(t)};var Ta=P.__r;P.__r=function(t){Ta&&Ta(t),bi=t.__c};var Ca=P.diffed;P.diffed=function(t){Ca&&Ca(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),bi=null};var Fc={ReactCurrentDispatcher:{current:{readContext:function(t){return bi.__n[t.__c].props.value},useCallback:G,useContext:In,useDebugValue:ia,useDeferredValue:fa,useEffect:M,useId:oa,useImperativeHandle:ra,useInsertionEffect:ma,useLayoutEffect:En,useMemo:fe,useReducer:De,useRef:qe,useState:q,useSyncExternalStore:da,useTransition:pa}}};function Vc(t){return Fe.bind(null,t)}function br(t){return!!t&&t.$$typeof===_a}function Hc(t){return br(t)&&t.type===Z}function Wc(t){return!!t&&typeof t.displayName=="string"&&t.displayName.indexOf("Memo(")==0}function Qc(t){return br(t)?kc.apply(null,arguments):t}function Gc(t){return!!t.__k&&(qt(null,t),!0)}function Kc(t){return t&&(t.base||t.nodeType===1&&t)||null}for(var Yc=function(t,e){return t(e)},Jc=function(t,e){var n=P.debounceRendering;P.debounceRendering=function(i){return i()};var r=t(e);return P.debounceRendering=n,r},Zc=br,yi={useState:q,useId:oa,useReducer:De,useEffect:M,useLayoutEffect:En,useInsertionEffect:ma,useTransition:pa,useDeferredValue:fa,useSyncExternalStore:da,startTransition:ha,useRef:qe,useImperativeHandle:ra,useMemo:fe,useCallback:G,useContext:In,useDebugValue:ia,version:"18.3.1",Children:Rc,render:zc,hydrate:Uc,unmountComponentAtNode:Gc,createPortal:Mc,createElement:Fe,createContext:_c,createFactory:Vc,cloneElement:Qc,createRef:gc,Fragment:Z,isValidElement:br,isElement:Zc,isFragment:Hc,isMemo:Wc,findDOMNode:Kc,Component:Je,PureComponent:xi,memo:Tc,forwardRef:Ac,flushSync:Jc,unstable_batchedUpdates:Yc,StrictMode:Z,Suspense:xr,SuspenseList:Pn,lazy:Ic,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Fc},st=[],Ve=[],Xc=Uint8Array,vi="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",tn=0,eu=vi.length;tn<eu;++tn)st[tn]=vi[tn],Ve[vi.charCodeAt(tn)]=tn;Ve[45]=62,Ve[95]=63;function tu(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 nu(t,e,n){return(e+n)*3/4-n}function Nn(t){var e,n=tu(t),r=n[0],i=n[1],o=new Xc(nu(t,r,i)),a=0,l=i>0?r-4:r,c;for(c=0;c<l;c+=4)e=Ve[t.charCodeAt(c)]<<18|Ve[t.charCodeAt(c+1)]<<12|Ve[t.charCodeAt(c+2)]<<6|Ve[t.charCodeAt(c+3)],o[a++]=e>>16&255,o[a++]=e>>8&255,o[a++]=e&255;return i===2&&(e=Ve[t.charCodeAt(c)]<<2|Ve[t.charCodeAt(c+1)]>>4,o[a++]=e&255),i===1&&(e=Ve[t.charCodeAt(c)]<<10|Ve[t.charCodeAt(c+1)]<<4|Ve[t.charCodeAt(c+2)]>>2,o[a++]=e>>8&255,o[a++]=e&255),o}function ru(t){return st[t>>18&63]+st[t>>12&63]+st[t>>6&63]+st[t&63]}function iu(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(ru(r));return i.join("")}function Mn(t){for(var e,n=t.length,r=n%3,i=[],o=16383,a=0,l=n-r;a<l;a+=o)i.push(iu(t,a,a+o>l?l:a+o));return r===1?(e=t[n-1],i.push(st[e>>2]+st[e<<4&63]+"==")):r===2&&(e=(t[n-2]<<8)+t[n-1],i.push(st[e>>10]+st[e>>4&63]+st[e<<2&63]+"=")),i.join("")}function bt(t){if(t===void 0)return{};if(!Aa(t))throw new Error(`The arguments to a Convex function must be an object. Received: ${t}`);return t}function ou(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 Aa(t){const e=typeof t=="object",n=Object.getPrototypeOf(t),r=n===null||n===Object.prototype||n?.constructor?.name==="Object";return e&&r}const Ra=!0,nn=BigInt("-9223372036854775808"),wi=BigInt("9223372036854775807"),ki=BigInt("0"),au=BigInt("8"),su=BigInt("256");function Ea(t){return Number.isNaN(t)||!Number.isFinite(t)||Object.is(t,-0)}function lu(t){t<ki&&(t-=nn+nn);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>>=au;return Mn(n)}function cu(t){const e=Nn(t);if(e.byteLength!==8)throw new Error(`Received ${e.byteLength} bytes, expected 8 for $integer`);let n=ki,r=ki;for(const i of e)n+=BigInt(i)*su**r,r++;return n>wi&&(n+=nn+nn),n}function uu(t){if(t<nn||wi<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),Mn(new Uint8Array(e))}function du(t){const e=Nn(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 hu=DataView.prototype.setBigInt64?uu:lu,fu=DataView.prototype.getBigInt64?du:cu,Ia=1024;function Pa(t){if(t.length>Ia)throw new Error(`Field name ${t} exceeds maximum field name length ${Ia}.`);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 rn(t){if(t===null||typeof t=="boolean"||typeof t=="number"||typeof t=="string")return t;if(Array.isArray(t))return t.map(r=>rn(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 Nn(t.$bytes).buffer}if(r==="$integer"){if(typeof t.$integer!="string")throw new Error(`Malformed $integer field on ${t}`);return fu(t.$integer)}if(r==="$float"){if(typeof t.$float!="string")throw new Error(`Malformed $float field on ${t}`);const i=Nn(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,Ra);if(!Ea(a))throw new Error(`Float ${a} should be encoded as a number`);return a}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))Pa(r),n[r]=rn(i);return n}const Na=16384;function On(t){const e=JSON.stringify(t,(n,r)=>r===void 0?"undefined":typeof r=="bigint"?`${r.toString()}n`:r);if(e.length>Na){const n="[...truncated]";let r=Na-n.length;const i=e.codePointAt(r-1);return i!==void 0&&i>65535&&(r-=1),e.substring(0,r)+n}return e}function _i(t,e,n,r){if(t===void 0){const a=n&&` (present at path ${n} in original object ${On(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<nn||wi<t)throw new Error(`BigInt ${t} does not fit into a 64-bit signed integer.`);return{$integer:hu(t)}}if(typeof t=="number")if(Ea(t)){const a=new ArrayBuffer(8);return new DataView(a).setFloat64(0,t,Ra),{$float:Mn(new Uint8Array(a))}}else return t;if(typeof t=="boolean"||typeof t=="string")return t;if(t instanceof ArrayBuffer)return{$bytes:Mn(new Uint8Array(t))};if(Array.isArray(t))return t.map((a,l)=>_i(a,e,n+`[${l}]`));if(t instanceof Set)throw new Error(ji(n,"Set",[...t],e));if(t instanceof Map)throw new Error(ji(n,"Map",[...t],e));if(!Aa(t)){const a=t?.constructor?.name,l=a?`${a} `:"";throw new Error(ji(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&&(Pa(a),i[a]=_i(l,e,n+`.${a}`));return i}function ji(t,e,n,r){return t?`${e}${On(n)} is not a supported Convex type (present at path ${t} in original object ${On(r)}). To learn about Convex's supported types, see https://docs.convex.dev/using/types.`:`${e}${On(n)} is not a supported Convex type.`}function lt(t){return _i(t,t,"")}var pu=Object.defineProperty,mu=(t,e,n)=>e in t?pu(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Si=(t,e,n)=>mu(t,typeof e!="symbol"?e+"":e,n),Ma,Oa;const gu=Symbol.for("ConvexError");class yr extends(Oa=Error,Ma=gu,Oa){constructor(e){super(typeof e=="string"?e:On(e)),Si(this,"name","ConvexError"),Si(this,"data"),Si(this,Ma,!0),this.data=e}}const La=()=>Array.from({length:4},()=>0);La(),La();const $a="1.42.3";var xu=Object.defineProperty,bu=(t,e,n)=>e in t?xu(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Da=(t,e,n)=>bu(t,typeof e!="symbol"?e+"":e,n);const yu="color:rgb(0, 145, 255)";function qa(t){switch(t){case"query":return"Q";case"mutation":return"M";case"action":return"A";case"any":return"?"}}class za{constructor(e){Da(this,"_onLogLineFuncs"),Da(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 Ua(t){const e=new za(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 Ba(t){return new za(t)}function vr(t,e,n,r,i){const o=qa(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}]`,yu,c)}else t.error(`[CONVEX ${o}(${r})] ${i}`)}function vu(t,e){const n=`[CONVEX FATAL ERROR] ${e}`;return t.error(n),new Error(n)}function on(t,e,n){return`[CONVEX ${qa(t)}(${e})] ${n.errorMessage}
|
|
2
|
-
Called by client`}function Ti(t,e){return e.data=t.errorData,e}function zt(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 Ut(t,e){return JSON.stringify({udfPath:zt(t),args:lt(e)})}function Fa(t,e,n){const{initialNumItems:r,id:i}=n;return JSON.stringify({type:"paginated",udfPath:zt(t),args:lt(e),options:lt({initialNumItems:r,id:i})})}var wu=Object.defineProperty,ku=(t,e,n)=>e in t?wu(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ct=(t,e,n)=>ku(t,typeof e!="symbol"?e+"":e,n);class _u{constructor(){ct(this,"nextQueryId"),ct(this,"querySetVersion"),ct(this,"querySet"),ct(this,"queryIdToToken"),ct(this,"identityVersion"),ct(this,"auth"),ct(this,"outstandingQueriesOlderThanRestart"),ct(this,"outstandingAuthOlderThanRestart"),ct(this,"paused"),ct(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=zt(e),a=Ut(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 f=this.querySetVersion,m=this.querySetVersion+1,d={type:"Add",queryId:c,udfPath:o,args:[lt(n)],journal:r,componentPath:i};return this.paused?this.pendingQuerySetModifications.set(c,d):this.querySetVersion=m,{queryToken:a,modification:{type:"ModifyQuerySet",baseVersion:f,newVersion:m,modifications:[d]},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=zt(e),i=Ut(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:[lt(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 ju=Object.defineProperty,Su=(t,e,n)=>e in t?ju(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,wr=(t,e,n)=>Su(t,typeof e!="symbol"?e+"":e,n);class Tu{constructor(e,n){this.logger=e,this.markConnectionStateDirty=n,wr(this,"inflightRequests"),wr(this,"requestsOlderThanRestart"),wr(this,"inflightMutationsCount",0),wr(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)vr(this.logger,"info",r,i,c);const o=n.status;let a,l;if(e.success)a={success:!0,logLines:e.logLines,value:rn(e.result)},l=()=>o.onResult(a);else{const c=e.result,{errorData:u}=e;vr(this.logger,"error",r,i,c),a={success:!1,errorMessage:c,errorData:u!==void 0?rn(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 Ln=Symbol.for("functionName"),Cu=Symbol.for("toReferencePath");function Au(t){return t[Cu]??null}function Ru(t){return t.startsWith("function://")}function Eu(t){let e;if(typeof t=="string")Ru(t)?e={functionHandle:t}:e={name:t};else if(t[Ln])e={name:t[Ln]};else{const n=Au(t);if(!n)throw new Error(`${t} is not a functionReference`);e={reference:n}}return e}function Re(t){const e=Eu(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[Ln];if(!n)throw new Error(`${t} is not a functionReference`);return n}function Ci(t){return{[Ln]:t}}function Va(t=[]){const e={get(n,r){if(typeof r=="string"){const i=[...t,r];return Va(i)}else if(r===Ln){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)}Va();var Iu=Object.defineProperty,Pu=(t,e,n)=>e in t?Iu(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,kr=(t,e,n)=>Pu(t,typeof e!="symbol"?e+"":e,n);class $n{constructor(e){kr(this,"queryResults"),kr(this,"modifiedQueries"),this.queryResults=e,this.modifiedQueries=[]}getQuery(e,...n){const r=bt(n[0]),i=Re(e),o=this.queryResults.get(Ut(i,r));if(o!==void 0)return $n.queryValue(o.result)}getAllQueries(e){const n=[],r=Re(e);for(const i of this.queryResults.values())i.udfPath===zt(r)&&n.push({args:i.args,value:$n.queryValue(i.result)});return n}setQuery(e,n,r){const i=bt(n),o=Re(e),a=Ut(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 Nu{constructor(){kr(this,"queryResults"),kr(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 $n(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 $n(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?Ti(r,new yr(on("query",n.udfPath,r))):new Error(on("query",n.udfPath,r))}}hasQueryResult(e){return this.queryResults.get(e)!==void 0}queryLogs(e){return this.queryResults.get(e)?.result?.logLines}}var Mu=Object.defineProperty,Ou=(t,e,n)=>e in t?Mu(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Ai=(t,e,n)=>Ou(t,typeof e!="symbol"?e+"":e,n);class Ne{constructor(e,n){Ai(this,"low"),Ai(this,"high"),Ai(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 Ne(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?Ha:e>=Lu?$u:new Ne(e%Dn|0,e/Dn|0)}toString(){return(BigInt(this.high)*BigInt(Dn)+BigInt(this.low)).toString()}equals(e){return Ne.isLong(e)||(e=Ne.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 Ne.isLong(e)||(e=Ne.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"?Ne.fromNumber(e):new Ne(e.low,e.high)}}const Ha=new Ne(0,0),Wa=65536,Dn=Wa*Wa,Lu=Dn*Dn,$u=new Ne(-1,-1);var Du=Object.defineProperty,qu=(t,e,n)=>e in t?Du(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,_r=(t,e,n)=>qu(t,typeof e!="symbol"?e+"":e,n);class Qa{constructor(e,n){_r(this,"version"),_r(this,"remoteQuerySet"),_r(this,"queryPath"),_r(this,"logger"),this.version={querySet:0,ts:Ne.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)vr(this.logger,"info","query",i,a);const o=rn(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)vr(this.logger,"info","query",i,a);const{errorData:o}=r;this.remoteQuerySet.set(r.queryId,{success:!1,errorMessage:r.errorMessage,errorData:o!==void 0?rn(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 Ri(t){const e=Nn(t);return Ne.fromBytesLE(Array.from(e))}function zu(t){const e=new Uint8Array(t.toBytesLE());return Mn(e)}function Ga(t){switch(t.type){case"FatalError":case"AuthError":case"ActionResponse":case"TransitionChunk":case"Ping":return{...t};case"MutationResponse":return t.success?{...t,ts:Ri(t.ts)}:{...t};case"Transition":return{...t,startVersion:{...t.startVersion,ts:Ri(t.startVersion.ts)},endVersion:{...t.endVersion,ts:Ri(t.endVersion.ts)}}}}function Uu(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:zu(t.maxObservedTimestamp)}:{...t,maxObservedTimestamp:void 0}}}var Bu=Object.defineProperty,Fu=(t,e,n)=>e in t?Bu(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,pe=(t,e,n)=>Fu(t,typeof e!="symbol"?e+"":e,n);const Vu=1e3,Hu=1001,Wu=1005,Qu=4040;let jr;function an(){return jr===void 0&&(jr=Date.now()),typeof performance>"u"||!performance.now?Date.now():Math.round(jr+performance.now())}function Ka(){return`t=${Math.round((an()-jr)/100)/10}s`}const Ya={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 Gu(t){if(t===void 0)return"Unknown";for(const e of Object.keys(Ya))if(t.startsWith(e))return e;return"Unknown"}class Ku{constructor(e,n,r,i,o,a){this.markConnectionStateDirty=o,this.debug=a,pe(this,"socket"),pe(this,"connectionCount"),pe(this,"_hasEverConnected",!1),pe(this,"lastCloseReason"),pe(this,"transitionChunkBuffer",null),pe(this,"defaultInitialBackoff"),pe(this,"maxBackoff"),pe(this,"retries"),pe(this,"serverInactivityThreshold"),pe(this,"reconnectDueToServerInactivityTimeout"),pe(this,"scheduledReconnect",null),pe(this,"networkOnlineHandler",null),pe(this,"pendingNetworkRecoveryInfo",null),pe(this,"uri"),pe(this,"onOpen"),pe(this,"onResume"),pe(this,"onMessage"),pe(this,"webSocketConstructor"),pe(this,"logger"),pe(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=Ga(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:an()})),this.lastCloseReason!=="InitialConnect"&&(this.lastCloseReason?this.logger.log("WebSocket reconnected at",Ka(),"after disconnect due to",this.lastCloseReason):this.logger.log("WebSocket reconnected at",Ka())),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=Ga(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!==Vu&&n.code!==Hu&&n.code!==Wu&&n.code!==Qu){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=Gu(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=Uu(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=an(),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=an()-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:an()})):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:Ya[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=an()-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 Yu(){return Ju()}function Ju(){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 qn extends Error{}qn.prototype.name="InvalidTokenError";function Zu(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 Xu(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 Zu(e)}catch{return atob(e)}}function Ja(t,e){if(typeof t!="string")throw new qn("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 qn(`Invalid token specified: missing part #${n+1}`);let i;try{i=Xu(r)}catch(o){throw new qn(`Invalid token specified: invalid base64 for part #${n+1} (${o.message})`)}try{return JSON.parse(i)}catch(o){throw new qn(`Invalid token specified: invalid json for part #${n+1} (${o.message})`)}}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,Me=(t,e,n)=>td(t,typeof e!="symbol"?e+"":e,n);const nd=480*60*60*1e3,Za=2;class rd{constructor(e,n,r){Me(this,"authState",{state:"noAuth"}),Me(this,"configVersion",0),Me(this,"syncState"),Me(this,"authenticate"),Me(this,"stopSocket"),Me(this,"tryRestartSocket"),Me(this,"pauseSocket"),Me(this,"resumeSocket"),Me(this,"clearAuth"),Me(this,"logger"),Me(this,"refreshTokenLeewaySeconds"),Me(this,"initialAuthTokenReuse"),Me(this,"lastRefreshChange"),Me(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>=Za){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, ${Za-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 f=(Date.now()-n)/1e3;l=o-f,l<=0&&(l=0)}else l=a;let c=Math.min(nd,(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 Ja(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 id=["convexClientConstructed","convexWebSocketOpen","convexFirstMessageReceived"];function od(t,e){const n={sessionId:e};typeof performance>"u"||!performance.mark||performance.mark(t,{detail:n})}function ad(t){let e=t.name.slice(6);return e=e.charAt(0).toLowerCase()+e.slice(1),{name:e,startTime:t.startTime}}function sd(t){if(typeof performance>"u"||!performance.getEntriesByName)return[];const e=[];for(const n of id){const r=performance.getEntriesByName(n).filter(i=>i.entryType==="mark").filter(i=>i.detail.sessionId===t);e.push(...r)}return e.map(ad)}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,me=(t,e,n)=>cd(t,typeof e!="symbol"?e+"":e,n);class ud{constructor(e,n,r){if(me(this,"address"),me(this,"state"),me(this,"requestManager"),me(this,"webSocketManager"),me(this,"authenticationManager"),me(this,"remoteQuerySet"),me(this,"optimisticQueryResults"),me(this,"_transitionHandlerCounter",0),me(this,"_nextRequestId"),me(this,"_onTransitionFns",new Map),me(this,"_sessionId"),me(this,"firstMessageReceived",!1),me(this,"debug"),me(this,"logger"),me(this,"maxObservedTimestamp"),me(this,"connectionStateSubscribers",new Map),me(this,"nextConnectionStateSubscriberId",0),me(this,"_lastPublishedConnectionState"),me(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)}})}),me(this,"mark",p=>{this.debug&&od(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&&ou(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?Ba({verbose:r.verbose??!1}):r.logger!==!0&&r.logger?r.logger:Ua({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 f=`${u}://${l}/api/${$a}/sync`;this.state=new _u,this.remoteQuerySet=new Qa(p=>this.state.queryPath(p),this.logger),this.requestManager=new Tu(this.logger,this.markConnectionStateDirty);const m=()=>{this.webSocketManager.pause(),this.state.pause()};this.authenticationManager=new rd(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 Nu,this.addOnTransitionHandler(p=>{n(p.queries.map(x=>x.token))}),this._nextRequestId=0,this._sessionId=Yu();const{unsavedChangesWarning:d}=r;if(typeof window>"u"||typeof window.addEventListener>"u"){if(d===!0)throw new Error("unsavedChangesWarning requested, but window.addEventListener not found! Remove {unsavedChangesWarning: true} from Convex client options.")}else d!==!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 Ku(f,{onOpen:p=>{this.mark("convexWebSocketOpen"),this.webSocketManager.sendMessage({...p,type:"Connect",sessionId:this._sessionId,maxObservedTimestamp:this.maxObservedTimestamp}),this.remoteQuerySet=new Qa(b=>this.state.queryPath(b),this.logger);const[x,k]=this.state.restart();k&&this.webSocketManager.sendMessage(k),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 k of this.requestManager.resume())this.webSocketManager.sendMessage(k)},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=vu(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?Ja(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=bt(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=bt(n),i=Ut(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=bt(n),i=Ut(e,r);return this.optimisticQueryResults.queryLogs(i)}queryJournal(e,n){const r=bt(n),i=Ut(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?Ti(i,new yr(on("mutation",e,i))):new Error(on("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=bt(n);this.tryReportLongDisconnect();const a=this.nextRequestId;if(this._nextRequestId++,r!==void 0){const f=r.optimisticUpdate;if(f!==void 0){const m=x=>{f(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 k=this.localQueryResultByToken(x);return{token:x,modification:{kind:"Updated",result:k===void 0?void 0:{success:!0,value:k,logLines:[]}}}});this.handleTransition({queries:p,reflectedMutations:[],timestamp:this.remoteQuerySet.timestamp()})}}const l={type:"Mutation",requestId:a,udfPath:e,componentPath:i,args:[lt(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?Ti(r,new yr(on("action",e,r))):new Error(on("action",e,r));return r.value}async actionInternal(e,n,r){const i=bt(n),o=this.nextRequestId;this._nextRequestId++,this.tryReportLongDisconnect();const a={type:"Action",requestId:o,udfPath:e,componentPath:r,args:[lt(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=sd(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-${$a}`},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 Ei(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 dd=Object.defineProperty,hd=(t,e,n)=>e in t?dd(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Xa=(t,e,n)=>hd(t,typeof e!="symbol"?e+"":e,n);class fd{constructor(e,n){this.client=e,this.onTransition=n,Xa(this,"paginatedQuerySet",new Map),Xa(this,"lastTransitionTs"),this.lastTransitionTs=Ne.fromNumber(0),this.client.addOnTransitionHandler(r=>this.onBaseTransition(r))}subscribe(e,n,r){const i=zt(e),o=Fa(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=zt(e),o=Fa(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 f=Ei(u);i=i.concat(f.page),a=!!f.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=Ei(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,f]]of o)n(a.get(u).queryToken)!==void 0&&n(a.get(f).queryToken)!==void 0&&this.completePaginatedQuerySplit(i,c,u,f);for(const c of l){if(o.has(c))continue;const u=a.get(c).queryToken,f=n(u);if(!f)continue;const m=Ei(f);m.splitCursor&&(m.pageStatus==="SplitRecommended"||m.pageStatus==="SplitRequired"||m.page.length>i.options.initialNumItems*2)&&this.splitPaginatedQueryPage(i,c,m.splitCursor,m.continueCursor)}}}splitPaginatedQueryPage(e,n,r,i){const o=e.nextPageKey++,a=e.nextPageKey++,l={cursor:i,numItems:e.options.initialNumItems,id:e.id},c=this.client.subscribe(e.canonicalizedUdfPath,{...e.args,paginationOpts:{...l,cursor:null,endCursor:r}});e.pageKeyToQuery.set(o,c);const u=this.client.subscribe(e.canonicalizedUdfPath,{...e.args,paginationOpts:{...l,cursor:r,endCursor:i}});e.pageKeyToQuery.set(a,u),e.ongoingSplits.set(n,[o,a])}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),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 pd({getCurrentValue:t,subscribe:e}){const[n,r]=q(()=>({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 md=Object.defineProperty,gd=(t,e,n)=>e in t?md(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,yt=(t,e,n)=>gd(t,typeof e!="symbol"?e+"":e,n);const xd=5e3;if(typeof yi>"u")throw new Error("Required dependency 'react' not found");function es(t,e,n){function r(i){return kd(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 ${Re(t)}`);return es(t,e,o)},r}function bd(t,e){return function(n){return e.action(t,n)}}class yd{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?Ba({verbose:n?.verbose??!1}):n?.logger!==!0&&n?.logger?n.logger:Ua({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 ud(this.address,()=>{},this.options),this.adminAuth&&this.cachedSync.setAdminAuth(this.adminAuth,this.fakeUserIdentity),this.cachedPaginatedQueryClient=new fd(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=Re(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 f=this.listeners.get(l);f.delete(a),f.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??xd,i=this.watchQuery(e.query,e.args||{}).onUpdate(()=>{});setTimeout(i,n)}watchPaginatedQuery(e,n,r){const i=Re(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=Re(e);return this.sync.mutation(o,r,i)}action(e,...n){const r=Re(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 Sr=yi.createContext(void 0);function vd(){return In(Sr)}const wd=({client:t,children:e})=>yi.createElement(Sr.Provider,{value:t},e);function Tr(t,...e){const n=e[0]==="skip",r=e[0]==="skip"?{}:bt(e[0]),i=typeof t=="string"?Ci(t):t,o=Re(i),a=fe(()=>n?{}:{query:{query:i,args:r}},[JSON.stringify(lt(r)),o,n]),c=Td(a).query;if(c instanceof Error)throw c;return c}function Bt(t){const e=typeof t=="string"?Ci(t):t,n=In(Sr);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 fe(()=>es(e,n),[n,Re(e)])}function zn(t){const e=In(Sr),n=typeof t=="string"?Ci(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 fe(()=>bd(n,e),[e,Re(n)])}function kd(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 _d=Object.defineProperty,jd=(t,e,n)=>e in t?_d(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Ii=(t,e,n)=>jd(t,typeof e!="symbol"?e+"":e,n);class Sd{constructor(e){Ii(this,"createWatch"),Ii(this,"queries"),Ii(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(Re(r),this.queries[n]===void 0)this.addQuery(n,r,i,o?{paginationOptions:o}:{});else{const a=this.queries[n];(Re(r)!==Re(a.query)||JSON.stringify(lt(i))!==JSON.stringify(lt(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;Re(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 Td(t){const e=vd();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=fe(()=>(r,i,{journal:o,paginationOptions:a})=>a?e.watchPaginatedQuery(r,i,a):e.watchQuery(r,i,o?{journal:o}:{}),[e]);return Cd(t,n)}function Cd(t,e){const[n]=q(()=>new Sd(e));n.createWatch!==e&&n.setCreateWatch(e),M(()=>()=>n.destroy(),[n]);const r=fe(()=>({getCurrentValue:()=>n.getLocalResults(t),subscribe:i=>(n.setQueries(t),n.subscribe(i))}),[n,t]);return pd(r)}var Ad=Symbol.for("preact-signals");function Cr(){if(vt>1)vt--;else{var t,e=!1;for((function(){var i=Er;for(Er=void 0;i!==void 0;)i.S.v===i.v&&(i.S.i=i.i),i=i.o})();Un!==void 0;){var n=Un;for(Un=void 0,Rr++;n!==void 0;){var r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&ns(n))try{n.c()}catch(i){e||(t=i,e=!0)}n=r}}if(Rr=0,vt--,e)throw t}}function Rd(t){if(vt>0)return t();Pi=++Ed,vt++;try{return t()}finally{Cr()}}var re=void 0;function Ar(t){var e=re;re=void 0;try{return t()}finally{re=e}}var Un=void 0,vt=0,Rr=0,Ed=0,Pi=0,Er=void 0,Ir=0;function ts(t){if(re!==void 0){var e=t.n;if(e===void 0||e.t!==re)return e={i:0,S:t,p:re.s,n:void 0,t:re,e:void 0,x:void 0,r:e},re.s!==void 0&&(re.s.n=e),re.s=e,t.n=e,32&re.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=re.s,e.n=void 0,re.s.n=e,re.s=e),e}}function we(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}we.prototype.brand=Ad,we.prototype.h=function(){return!0},we.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:Ar(function(){var r;(r=e.W)==null||r.call(e)}))},we.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&&Ar(function(){var i;(i=e.Z)==null||i.call(e)}))}},we.prototype.subscribe=function(t){var e=this;return Bn(function(){var n=e.value;Ar(function(){return t(n)})},{name:"sub"})},we.prototype.valueOf=function(){return this.value},we.prototype.toString=function(){return this.value+""},we.prototype.toJSON=function(){return this.value},we.prototype.peek=function(){var t=this;return Ar(function(){return t.value})},Object.defineProperty(we.prototype,"value",{get:function(){var t=ts(this);return t!==void 0&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){if(Rr>100)throw new Error("Cycle detected");(function(n){vt!==0&&Rr===0&&n.l!==Pi&&(n.l=Pi,Er={S:n,v:n.v,i:n.i,o:Er})})(this),this.v=t,this.i++,Ir++,vt++;try{for(var e=this.t;e!==void 0;e=e.x)e.t.N()}finally{Cr()}}}});function B(t,e){return new we(t,e)}function ns(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 rs(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 is(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 Ft(t,e){we.call(this,void 0,e),this.x=t,this.s=void 0,this.g=Ir-1,this.f=4}Ft.prototype=new we,Ft.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Ir))return!0;if(this.g=Ir,this.f|=1,this.i>0&&!ns(this))return this.f&=-2,!0;var t=re;try{rs(this),re=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 re=t,is(this),this.f&=-2,!0},Ft.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)}we.prototype.S.call(this,t)},Ft.prototype.U=function(t){if(this.t!==void 0&&(we.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)}},Ft.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(Ft.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var t=ts(this);if(this.h(),t!==void 0&&(t.i=this.i),16&this.f)throw this.v;return this.v}});function Ni(t,e){return new Ft(t,e)}function os(t){var e=t.m;if(t.m=void 0,typeof e=="function"){vt++;var n=re;re=void 0;try{e()}catch(r){throw t.f&=-2,t.f|=8,Mi(t),r}finally{re=n,Cr()}}}function Mi(t){for(var e=t.s;e!==void 0;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,os(t)}function Id(t){if(re!==this)throw new Error("Out-of-order effect");is(this),re=t,this.f&=-2,8&this.f&&Mi(this),Cr()}function sn(t,e){this.x=t,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=e?.name}sn.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()}},sn.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,os(this),rs(this),vt++;var t=re;return re=this,Id.bind(this,t)},sn.prototype.N=function(){2&this.f||(this.f|=2,this.u=Un,Un=this)},sn.prototype.d=function(){this.f|=8,1&this.f||Mi(this)},sn.prototype.dispose=function(){this.d()};function Bn(t,e){var n=new sn(t,e);try{n.c()}catch(i){throw n.d(),i}var r=n.d.bind(n);return r[Symbol.dispose]=r,r}var as,Pr,Pd=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__,ss=[];Bn(function(){as=this.N})();function ln(t,e){P[t]=e.bind(null,P[t]||function(){})}function Nr(t){if(Pr){var e=Pr;Pr=void 0,e()}Pr=t&&t.S()}function ls(t){var e=this,n=t.data,r=cn(n);r.value=n;var i=fe(function(){for(var l=e,c=e.__v;c=c.__;)if(c.__c){c.__c.__$f|=4;break}var u=Ni(function(){var p=r.value.value;return p===0?0:p===!0?"":p||""}),f=Ni(function(){return!Array.isArray(u.value)&&!Mo(u.value)}),m=Bn(function(){if(this.N=cs,f.value){var p=u.value;l.__v&&l.__v.__e&&l.__v.__e.nodeType===3&&(l.__v.__e.data=p)}}),d=e.__$u.d;return e.__$u.d=function(){m(),d.call(this)},[f,u]},[]),o=i[0],a=i[1];return o.value?a.peek():a.value}ls.displayName="ReactiveTextNode",Object.defineProperties(we.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:ls},props:{configurable:!0,get:function(){var t=this;return{data:{get value(){return t.value}}}}},__b:{configurable:!0,value:1}}),ln("__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 we&&(n||(e.__np=n={}),n[i]=o,r[i]=o.peek())}}t(e)}),ln("__r",function(t,e){if(t(e),e.type!==Z){Nr();var n,r=e.__c;r&&(r.__$f&=-2,(n=r.__$u)===void 0&&(r.__$u=n=(function(i,o){var a;return Bn(function(){a=this},{name:o}),a.c=i,a})(function(){var i;Pd&&((i=n.y)==null||i.call(n)),r.__$f|=1,r.setState({})},typeof e.type=="function"?e.type.displayName||e.type.name:""))),Nr(n)}}),ln("__e",function(t,e,n,r){Nr(),t(e,n,r)}),ln("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],f=r[c];u===void 0?(u=Nd(n,c,f,i),o[c]=u):u.o(f,i)}}}t(e)});function Nd(t,e,n,r){var i=e in t&&t.ownerSVGElement===void 0,o=B(n);return{o:function(a,l){o.value=a,r=l},d:Bn(function(){this.N=cs;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))})}}ln("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 f=u.__$u;f&&(u.__$u=void 0,f.d())}}t(e)}),ln("__h",function(t,e,n,r){(r<3||r===9)&&(e.__$f|=2),t(e,n,r)}),Je.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 cn(t,e){return fe(function(){return B(t,e)},[])}var Md=function(t){queueMicrotask(function(){queueMicrotask(t)})};function Od(){Rd(function(){for(var t;t=ss.shift();)as.call(t)})}function cs(){ss.push(this)===1&&(P.requestAnimationFrame||Md)(Od)}const oe=B(!1),Mr=B(void 0),Fn="https://jexitychat.de/privacy",Vn=B(Fn),Oi=B("chip"),Rt=B(void 0),Li=B([]),$i=B([]),us=B(null);function Ld(t){return t.replace(/\.convex\.site\b/,".convex.cloud")}function Di(t){return t.replace(/\.convex\.cloud\b/,".convex.site")}function ds(t){return typeof t!="number"||!Number.isFinite(t)?24:Math.min(100,Math.max(0,t))}function $d(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 Dd(t,e){const n=t.title??e?.title??"Assistant",r=t.privacyPolicyMode??e?.privacyPolicyMode??"platform",i=qd(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,privacyPolicyMode:r,privacyPolicyUrl:r==="custom"?$d(t.privacyPolicyUrl??e?.privacyPolicyUrl):void 0,privacyNoticeStyle:i,sessionTimeoutMs:zd(e?.sessionTimeout),triggerIcon:t.triggerIcon??e?.triggerIcon??"chat",triggerRadius:t.triggerRadius??e?.triggerRadius??"full",triggerLabel:t.triggerLabel??e?.triggerLabel??"Chatte mit uns",triggerOffsetX:ds(t.triggerOffsetX??e?.triggerOffsetX),triggerOffsetY:ds(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 qd(t){return t==="explicit"||t==="sheet"?"explicit":"chip"}function zd(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 Ud(t,e,n,r){const i=new URL(`${t}/widget/config`);i.searchParams.set("orgSlug",e),r&&i.searchParams.set("projSlug",r);const o=await fetch(i.toString(),{signal:n});return o.ok?o.json():null}function Bd(t,e,n,r){const[i,o]=q(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?Di(a):void 0;if(!l||!t){o({config:null,settled:!0});return}const c=new AbortController;async function u(f){try{const m=await Ud(f,t,c.signal,e);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 hs=globalThis.console,ne={warn(...t){hs.warn(...t)},error(...t){hs.error(...t)},debug(...t){}};async function qi(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"});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}}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 Fd(t,e){return e.some(n=>n==="/"?t==="/":t===n||t.startsWith(n+"/"))}function zi(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 Vd({orgSlug:t,projSlug:e,preToken:n,convexUrl:r,preAllowedUrls:i,preExcludedPaths:o}){M(()=>{const a=r??"https://festive-mouse-978.eu-west-1.convex.cloud",l=a?Di(a):void 0;if(!l||!t)return;if(us.value={orgSlug:t,projSlug:e,siteUrl:l},n){Li.value=i??[],$i.value=o??[];return}let c=!1;return(async()=>{const u=await qi(t,l,e);if(!c)if(u.ok)Rt.value=u.token,Li.value=u.allowedUrls,$i.value=u.excludePaths;else{const f=e?`project '${t}/${e}'`:`org '${t}'`;u.error==="unauthorized"?ne.warn(`[JexityChat] Domain not authorized for ${f}. Check the widget's domain rules.`):u.error==="not_found"?ne.error(`[JexityChat] No active widget config found for ${f}.`):u.error==="rate_limited"?ne.error(`[JexityChat] Bootstrap rate-limited for ${f}. Retry after ${u.retryAfterSec??60}s.`):ne.error(`[JexityChat] Bootstrap failed: ${u.error}`)}})(),()=>{c=!0}},[t,e,n,r])}const Or=new Set;let fs=!1;function Hd(){if(fs)return;fs=!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 Wd(t){return Or.add(t),window.addEventListener("popstate",t),Hd(),()=>{Or.delete(t),window.removeEventListener("popstate",t)}}function Qd(){const t=cn(window.location.href);M(()=>Wd(()=>{t.value=window.location.href}),[]);const e=Li.value,n=$i.value,r=new URL(t.value).pathname,i=Fd(r,n);return M(()=>{i?ne.warn(`[JexityChat] Widget hidden — current path is in the exclude list: ${r}`):e.length>0&&!e.some(o=>zi(t.value,o))&&ne.warn(`[JexityChat] Widget hidden — current page does not match path rule. Allowed: ${e.join(", ")}`)},[t.value,e,n]),i?!1:e.length===0?!0:e.some(o=>zi(t.value,o))}const Ui={title:"Assistant",statusOnline:"Online · Responds in seconds",inputPlaceholder:"Type a message…",aiThinking:"AI is responding…",sendAriaLabel:"Send message",attachImagesAriaLabel:"Attach images",attachComingSoon:"File attachments — coming soon",voiceAriaLabel:"Voice message",voiceComingSoon:"Voice messages — coming soon",removeAttachmentAriaLabel:"Remove attachment",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.",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",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",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 Cn,E,$o,Do,Tt,qo,zo,Uo,ii,fr,An,Bo,oi,ai,si,Fo,pr={},mr=[],wc=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Rn=Array.isArray;function it(t,e){for(var n in e)t[n]=e[n];return t}function li(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function Ve(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?Cn.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 En(t,a,r,i,null)}function En(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??++$o,__i:-1,__u:0};return i==null&&E.vnode!=null&&E.vnode(o),o}function kc(){return{current:null}}function ee(t){return t.children}function Je(t,e){this.props=t,this.context=e}function en(t,e){if(e==null)return t.__?en(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"?en(t):null}function _c(t){if(t.__P&&t.__d){var e=t.__v,n=e.__e,r=[],i=[],o=it({},e);o.__v=e.__v+1,E.vnode&&E.vnode(o),ui(t.__P,o,e,t.__n,t.__P.namespaceURI,32&e.__u?[n]:null,r,n??en(e),!!(32&e.__u),i),o.__v=e.__v,o.__.__k[o.__i]=o,Ko(r,o,i),e.__e=e.__=null,o.__e!=n&&Vo(o)}}function Vo(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}),Vo(t)}function ci(t){(!t.__d&&(t.__d=!0)&&Tt.push(t)&&!gr.__r++||qo!=E.debounceRendering)&&((qo=E.debounceRendering)||zo)(gr)}function gr(){try{for(var t,e=1;Tt.length;)Tt.length>e&&Tt.sort(Uo),t=Tt.shift(),e=Tt.length,_c(t)}finally{Tt.length=gr.__r=0}}function Ho(t,e,n,r,i,o,a,l,c,u,h){var m,d,p,b,S,y,x,k=r&&r.__k||mr,A=e.length;for(c=jc(n,e,k,c,A),m=0;m<A;m++)(p=n.__k[m])!=null&&(d=p.__i!=-1&&k[p.__i]||pr,p.__i=m,y=ui(t,p,d,i,o,a,l,c,u,h),b=p.__e,p.ref&&d.ref!=p.ref&&(d.ref&&hi(d.ref,null,p),h.push(p.ref,p.__c||b,p)),S==null&&b!=null&&(S=b),(x=!!(4&p.__u))||d.__k===p.__k?(c=Wo(p,c,t,x),x&&d.__e&&(d.__e=null)):typeof p.type=="function"&&y!==void 0?c=y:b&&(c=b.nextSibling),p.__u&=-7);return n.__e=S,c}function jc(t,e,n,r,i){var o,a,l,c,u,h=n.length,m=h,d=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]=En(null,a,null,null,null):Rn(a)?a=t.__k[o]=En(ee,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=t.__k[o]=En(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):t.__k[o]=a,c=o+d,a.__=t,a.__b=t.__b+1,l=null,(u=a.__i=Sc(a,n,c,m))!=-1&&(m--,(l=n[u])&&(l.__u|=2)),l==null||l.__v==null?(u==-1&&(i>h?d--:i<h&&d++),typeof a.type!="function"&&(a.__u|=4)):u!=c&&(u==c-1?d--:u==c+1?d++:(u>c?d--:d++,a.__u|=4))):t.__k[o]=null;if(m)for(o=0;o<h;o++)(l=n[o])!=null&&(2&l.__u)==0&&(l.__e==r&&(r=en(l)),Jo(l,l));return r}function Wo(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=Wo(i[o],e,n,r));return e}t.__e!=e&&(r&&(e&&t.type&&!e.parentNode&&(e=en(t)),n.insertBefore(t.__e,e||null)),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function ot(t,e){return e=e||[],t==null||typeof t=="boolean"||(Rn(t)?t.some(function(n){ot(n,e)}):e.push(t)),e}function Sc(t,e,n,r){var i,o,a,l=t.key,c=t.type,u=e[n],h=u!=null&&(2&u.__u)==0;if(u===null&&l==null||h&&l==u.key&&c==u.type)return n;if(r>(h?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 Qo(t,e,n){e[0]=="-"?t.setProperty(e,n??""):t[e]=n==null?"":typeof n!="number"||wc.test(e)?n:n+"px"}function xr(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||Qo(t.style,e,"");if(n)for(e in n)r&&n[e]==r[e]||Qo(t.style,e,n[e])}else if(e[0]=="o"&&e[1]=="n")o=e!=(e=e.replace(Bo,"$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[An]=r[An]:(n[An]=oi,t.addEventListener(e,o?si:ai,o)):t.removeEventListener(e,o?si:ai,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 Go(t){return function(e){if(this.l){var n=this.l[e.type+t];if(e[fr]==null)e[fr]=oi++;else if(e[fr]<n[An])return;return n(E.event?E.event(e):e)}}}function ui(t,e,n,r,i,o,a,l,c,u){var h,m,d,p,b,S,y,x,k,A,N,P,I,L,v,se,D=e.type;if(e.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[l=e.__e=n.__e]),(h=E.__b)&&h(e);e:if(typeof D=="function"){m=a.length;try{if(k=e.props,A=D.prototype&&D.prototype.render,N=(h=D.contextType)&&r[h.__c],P=h?N?N.props.value:h.__:r,n.__c?x=(d=e.__c=n.__c).__=d.__E:(A?e.__c=d=new D(k,P):(e.__c=d=new Je(k,P),d.constructor=D,d.render=Cc),N&&N.sub(d),d.state||(d.state={}),d.__n=r,p=d.__d=!0,d.__h=[],d._sb=[]),A&&d.__s==null&&(d.__s=d.state),A&&D.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=it({},d.__s)),it(d.__s,D.getDerivedStateFromProps(k,d.__s))),b=d.props,S=d.state,d.__v=e,p)A&&D.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),A&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(A&&D.getDerivedStateFromProps==null&&k!==b&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(k,P),e.__v==n.__v||!d.__e&&d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(k,d.__s,P)===!1){e.__v!=n.__v&&(d.props=k,d.state=d.__s,d.__d=!1),e.__e=n.__e,e.__k=n.__k,e.__k.some(function(K){K&&(K.__=e)}),mr.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&a.push(d);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(k,d.__s,P),A&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(b,S,y)})}if(d.context=P,d.props=k,d.__P=t,d.__e=!1,I=E.__r,L=0,A)d.state=d.__s,d.__d=!1,I&&I(e),h=d.render(d.props,d.state,d.context),mr.push.apply(d.__h,d._sb),d._sb=[];else do d.__d=!1,I&&I(e),h=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++L<25);d.state=d.__s,d.getChildContext!=null&&(r=it(it({},r),d.getChildContext())),A&&!p&&d.getSnapshotBeforeUpdate!=null&&(y=d.getSnapshotBeforeUpdate(b,S)),v=h!=null&&h.type===ee&&h.key==null?Yo(h.props.children):h,l=Ho(t,Rn(v)?v:[v],e,n,r,i,o,a,l,c,u),d.base=e.__e,e.__u&=-161,d.__h.length&&a.push(d),x&&(d.__E=d.__=null)}catch(K){if(a.length=m,e.__v=null,c||o!=null)if(K.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--;)li(o[se]);di(e)}else e.__e=n.__e,!e.__k&&n.__k&&(e.__k=n.__k),K.then||di(e);E.__e(K,e,n)}}else o==null&&e.__v==n.__v?(e.__k=n.__k,e.__e=n.__e):l=e.__e=Tc(n.__e,e,n,r,i,o,a,c,u);return(h=E.diffed)&&h(e),128&e.__u?void 0:l}function di(t){t&&(t.__c&&(t.__c.__e=!0),t.__k&&t.__k.some(di))}function Ko(t,e,n){for(var r=0;r<n.length;r++)hi(n[r],n[++r],n[++r]);E.__c&&E.__c(e,t),t.some(function(i){try{t=i.__h,i.__h=[],t.some(function(o){o.call(i)})}catch(o){E.__e(o,i.__v)}})}function Yo(t){return typeof t!="object"||t==null||t.__b>0?t:Rn(t)?t.map(Yo):t.constructor!==void 0?null:it({},t)}function Tc(t,e,n,r,i,o,a,l,c){var u,h,m,d,p,b,S,y=n.props||pr,x=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(x);t=document.createElementNS(i,k,x.is&&x),l&&(E.__m&&E.__m(e,o),l=!1),o=null}if(k==null)y===x||l&&t.data==x||(t.data=x);else{if(o=k=="textarea"&&x.defaultValue!=null?null:o&&Cn.call(t.childNodes),!l&&o!=null)for(y={},u=0;u<t.attributes.length;u++)y[(p=t.attributes[u]).name]=p.value;for(u in y)p=y[u],u=="dangerouslySetInnerHTML"?m=p:u=="children"||u in x||u=="value"&&"defaultValue"in x||u=="checked"&&"defaultChecked"in x||xr(t,u,null,p,i);for(u in x)p=x[u],u=="children"?d=p:u=="dangerouslySetInnerHTML"?h=p:u=="value"?b=p:u=="checked"?S=p:l&&typeof p!="function"||y[u]===p||xr(t,u,p,y[u],i);if(h)l||m&&(h.__html==m.__html||h.__html==t.innerHTML)||(t.innerHTML=h.__html),e.__k=[];else if(m&&(t.innerHTML=""),Ho(e.type=="template"?t.content:t,Rn(d)?d:[d],e,n,r,k=="foreignObject"?"http://www.w3.org/1999/xhtml":i,o,a,o?o[0]:n.__k&&en(n,0),l,c),o!=null)for(u=o.length;u--;)li(o[u]);l&&k!="textarea"||(u="value",k=="progress"&&b==null?t.removeAttribute("value"):b!=null&&(b!==t[u]||k=="progress"&&!b||k=="option"&&b!=y[u])&&xr(t,u,b,y[u],i),u="checked",S!=null&&S!=t[u]&&xr(t,u,S,y[u],i))}return t}function hi(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){E.__e(i,n)}}function Jo(t,e,n){var r,i;if(E.unmount&&E.unmount(t),(r=t.ref)&&(r.current&&r.current!=t.__e||hi(r,null,e)),(r=t.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(o){E.__e(o,e)}r.base=r.__P=r.__n=null}if(r=t.__k)for(i=0;i<r.length;i++)r[i]&&Jo(r[i],e,n||typeof t.type!="function");n||li(t.__e),t.__c=t.__=t.__e=void 0}function Cc(t,e,n){return this.constructor(t,n)}function qt(t,e,n){var r,i,o,a;e==document&&(e=document.documentElement),E.__&&E.__(t,e),i=(r=typeof n=="function")?null:n&&n.__k||e.__k,o=[],a=[],ui(e,t=(!r&&n||e).__k=Ve(ee,null,[t]),i||pr,pr,e.namespaceURI,!r&&n?[n]:i?null:e.firstChild?Cn.call(e.childNodes):null,o,!r&&n?n:i?i.__e:e.firstChild,r,a),Ko(o,t,a),t.props.children=null}function Zo(t,e){qt(t,e,Zo)}function Ac(t,e,n){var r,i,o,a,l=it({},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?Cn.call(arguments,2):n),En(t.type,l,r||t.key,i||t.ref,null)}function Rc(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,ci(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"+Fo++,e.__=t,e.Provider=e.__l=(e.Consumer=function(n,r){return n.children(r)}).contextType=e,e}Cn=mr.slice,E={__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}},$o=0,Do=function(t){return t!=null&&t.constructor===void 0},Je.prototype.setState=function(t,e){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=it({},this.state),typeof t=="function"&&(t=t(it({},n),this.props)),t&&it(n,t),t!=null&&this.__v&&(e&&this._sb.push(e),ci(this))},Je.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),ci(this))},Je.prototype.render=ee,Tt=[],zo=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Uo=function(t,e){return t.__v.__b-e.__v.__b},gr.__r=0,ii=Math.random().toString(8),fr="__d"+ii,An="__a"+ii,Bo=/(PointerCapture)$|Capture$/i,oi=0,ai=Go(!1),si=Go(!0),Fo=0;var Ec=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:--Ec,__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 E.vnode&&E.vnode(u),u}var Ct,te,fi,Xo,tn=0,ea=[],oe=E,ta=oe.__b,na=oe.__r,ra=oe.diffed,ia=oe.__c,oa=oe.unmount,aa=oe.__;function nn(t,e){oe.__h&&oe.__h(te,t,tn||e),tn=0;var n=te.__H||(te.__H={__:[],__h:[]});return t>=n.__.length&&n.__.push({}),n.__[t]}function U(t){return tn=1,Ue(fa,t)}function Ue(t,e,n){var r=nn(Ct++,2);if(r.t=t,!r.__c&&(r.__=[n?n(e):fa(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=te,!te.__f)){var i=function(l,c,u){if(!r.__c.__H)return!0;var h=!1,m=r.__c.props!==l;if(r.__c.__H.__.some(function(p){if(p.__N){h=!0;var b=p.__[0];p.__=p.__N,p.__N=void 0,b!==p.__[0]&&(m=!0)}}),o){var d=o.call(this,l,c,u);return h?d||m:d}return!h||m};te.__f=!0;var o=te.shouldComponentUpdate,a=te.componentWillUpdate;te.componentWillUpdate=function(l,c,u){if(this.__e){var h=o;o=void 0,i(l,c,u),o=h}a&&a.call(this,l,c,u)},te.shouldComponentUpdate=i}return r.__N||r.__}function M(t,e){var n=nn(Ct++,3);!oe.__s&&mi(n.__H,e)&&(n.__=t,n.u=e,te.__H.__h.push(n))}function rn(t,e){var n=nn(Ct++,4);!oe.__s&&mi(n.__H,e)&&(n.__=t,n.u=e,te.__h.push(n))}function Ne(t){return tn=5,xe(function(){return{current:t}},[])}function sa(t,e,n){tn=6,rn(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 xe(t,e){var n=nn(Ct++,7);return mi(n.__H,e)&&(n.__=t(),n.__H=e,n.__h=t),n.__}function Y(t,e){return tn=8,xe(function(){return t},e)}function In(t){var e=te.context[t.__c],n=nn(Ct++,9);return n.c=t,e?(n.__==null&&(n.__=!0,e.sub(te)),e.props.value):t.__}function la(t,e){oe.useDebugValue&&oe.useDebugValue(e?e(t):t)}function ca(){var t=nn(Ct++,11);if(!t.__){for(var e=te.__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 ua(){for(var t;t=ea.shift();){var e=t.__H;if(t.__P&&e)try{e.__h.some(pi),e.__h.some(ha),e.__h=[]}catch(n){e.__h=[],oe.__e(n,t.__v)}}}oe.__b=function(t){te=null,ta&&ta(t)},oe.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),aa&&aa(t,e)},oe.__r=function(t){na&&na(t),Ct=0;var e=(te=t.__c).__H;e&&(fi===te?(e.__h=[],te.__h=[],e.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(e.__h.length&&ua(),Ct=0)),fi=te},oe.diffed=function(t){ra&&ra(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(ea.push(e)!==1&&Xo===oe.requestAnimationFrame||((Xo=oe.requestAnimationFrame)||Ic)(ua)),e.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),fi=te=null},oe.__c=function(t,e){e.some(function(n){try{n.__h.some(pi),n.__h=n.__h.filter(function(r){return!r.__||ha(r)})}catch(r){e.some(function(i){i.__h&&(i.__h=[])}),e=[],oe.__e(r,n.__v)}}),ia&&ia(t,e)},oe.unmount=function(t){oa&&oa(t);var e,n=t.__c;n&&n.__H&&(n.__H.__.some(function(r){try{pi(r)}catch(i){e=i}}),n.__H=void 0,e&&oe.__e(e,n.__v))};var da=typeof requestAnimationFrame=="function";function Ic(t){var e,n=function(){clearTimeout(r),da&&cancelAnimationFrame(e),setTimeout(t)},r=setTimeout(n,35);da&&(e=requestAnimationFrame(n))}function pi(t){var e=te,n=t.__c;typeof n=="function"&&(t.__c=void 0,n()),te=e}function ha(t){var e=te;t.__c=t.__(),te=e}function mi(t,e){return!t||t.length!==e.length||e.some(function(n,r){return n!==t[r]})}function fa(t,e){return typeof e=="function"?e(t):e}function pa(t,e){for(var n in e)t[n]=e[n];return t}function gi(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 ma(t,e){var n=e(),r=U({t:{__:n,u:e}}),i=r[0].t,o=r[1];return rn(function(){i.__=n,i.u=e,xi(i)&&o({t:i})},[t,n,e]),M(function(){return xi(i)&&o({t:i}),t(function(){xi(i)&&o({t:i})})},[t]),n}function xi(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 ga(t){t()}function xa(t){return t}function ba(){return[!1,ga]}var ya=rn;function bi(t,e){this.props=t,this.context=e}function Pc(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:gi(this.props,i)}function r(i){return this.shouldComponentUpdate=n,Ve(t,i)}return r.displayName="Memo("+(t.displayName||t.name)+")",r.__f=r.prototype.isReactComponent=!0,r.type=t,r}(bi.prototype=new Je).isPureReactComponent=!0,bi.prototype.shouldComponentUpdate=function(t,e){return gi(this.props,t)||gi(this.state,e)};var va=E.__b;E.__b=function(t){t.type&&t.type.__f&&t.ref&&(t.props.ref=t.ref,t.ref=null),va&&va(t)};var Nc=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function Mc(t){function e(n){var r=pa({},n);return delete r.ref,t(r,n.ref||null)}return e.$$typeof=Nc,e.render=t,e.prototype.isReactComponent=e.__f=!0,e.displayName="ForwardRef("+(t.displayName||t.name)+")",e}var wa=function(t,e){return t==null?null:ot(ot(t).map(e))},Oc={map:wa,forEach:wa,count:function(t){return t?ot(t).length:0},only:function(t){var e=ot(t);if(e.length!==1)throw"Children.only";return e[0]},toArray:ot},Lc=E.__e;E.__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)}Lc(t,e,n,r)};var ka=E.unmount;function _a(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=pa({},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 _a(r,e,n)})),t}function ja(t,e,n){return t&&n&&(t.__v=null,t.__k=t.__k&&t.__k.map(function(r){return ja(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 br(){this.__u=0,this.o=null,this.__b=null}function Sa(t){var e=t.__&&t.__.__c;return e&&e.__a&&e.__a(t)}function $c(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?Ve(i,a):null}return o.displayName="Lazy",o.__f=!0,o}function Pn(){this.i=null,this.l=null}E.unmount=function(t){var e=t.__c;e&&(e.__z=!0),e&&e.__R&&e.__R(),e&&32&t.__u&&(t.type=null),ka&&ka(t)},(br.prototype=new Je).__c=function(t,e){var n=e.__c,r=this;r.o==null&&(r.o=[]),r.o.push(n);var i=Sa(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]=ja(u,u.__c.__P,u.__c.__O)}var h;for(r.setState({__a:r.__b=null});h=r.o.pop();)h.__P=l,h.forceUpdate()}};r.__u++||32&e.__u||r.setState({__a:r.__b=r.__v.__k[0]}),t.then(a,a)},br.prototype.componentWillUnmount=function(){this.o=[]},br.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]=_a(this.__b,i,o.__O=o.__P)}this.__b=null}var a=e.__a&&Ve(ee,null,t.fallback);return a&&(a.__u&=-33),[Ve(ee,null,e.__a?null:t.children),a]};var Ta=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 Dc(t){return this.getChildContext=function(){return t.context},t.children}function qc(t){var e=this,n=t.v;if(e.componentWillUnmount=function(){qt(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)}}}qt(Ve(Dc,{context:e.context},t.__v),e.h)}function zc(t,e){var n=Ve(qc,{__v:t,v:e});return n.containerInfo=e,n}(Pn.prototype=new Je).__a=function(t){var e=this,n=Sa(e.__v),r=e.l.get(t);return r[0]++,function(i){var o=function(){e.props.revealOrder?(r.push(i),Ta(e,t,r)):i()};n?n(o):o()}},Pn.prototype.render=function(t){this.i=null,this.l=new Map;var e=ot(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},Pn.prototype.componentDidUpdate=Pn.prototype.componentDidMount=function(){var t=this;this.l.forEach(function(e,n){Ta(t,n,e)})};var Ca=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,Uc=/^(?: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]/,Bc=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Fc=/[A-Z0-9]/g,Vc=typeof document<"u",Hc=function(t){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(t)};function Wc(t,e,n){return e.__k==null&&(e.textContent=""),qt(t,e),typeof n=="function"&&n(),t?t.__c:null}function Qc(t,e,n){return Zo(t,e),typeof n=="function"&&n(),t?t.__c:null}Je.prototype.isReactComponent=!0,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(t){Object.defineProperty(Je.prototype,t,{configurable:!0,get:function(){return this["UNSAFE_"+t]},set:function(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})});var Aa=E.event;E.event=function(t){return Aa&&(t=Aa(t)),t.persist=function(){},t.isPropagationStopped=function(){return this.cancelBubble},t.isDefaultPrevented=function(){return this.defaultPrevented},t.nativeEvent=t};var yi,Gc={configurable:!0,get:function(){return this.class}},Ra=E.vnode;E.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||Vc&&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"||Hc(n.type)?c==="onfocus"?a="onfocusin":c==="onblur"?a="onfocusout":Bc.test(a)&&(a=c):c=a="oninput":o&&Uc.test(a)?a=a.replace(Fc,"-$&").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=ot(n.children).forEach(function(u){u.props.selected=i.value.indexOf(u.props.value)!=-1})),i.defaultValue!=null&&(i.value=ot(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",Gc)):n.className&&(i.class=i.className=n.className),e.props=i})(t),t.$$typeof=Ca,Ra&&Ra(t)};var Ea=E.__r;E.__r=function(t){Ea&&Ea(t),yi=t.__c};var Ia=E.diffed;E.diffed=function(t){Ia&&Ia(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),yi=null};var Kc={ReactCurrentDispatcher:{current:{readContext:function(t){return yi.__n[t.__c].props.value},useCallback:Y,useContext:In,useDebugValue:la,useDeferredValue:xa,useEffect:M,useId:ca,useImperativeHandle:sa,useInsertionEffect:ya,useLayoutEffect:rn,useMemo:xe,useReducer:Ue,useRef:Ne,useState:U,useSyncExternalStore:ma,useTransition:ba}}};function Yc(t){return Ve.bind(null,t)}function yr(t){return!!t&&t.$$typeof===Ca}function Jc(t){return yr(t)&&t.type===ee}function Zc(t){return!!t&&typeof t.displayName=="string"&&t.displayName.indexOf("Memo(")==0}function Xc(t){return yr(t)?Ac.apply(null,arguments):t}function eu(t){return!!t.__k&&(qt(null,t),!0)}function tu(t){return t&&(t.base||t.nodeType===1&&t)||null}for(var nu=function(t,e){return t(e)},ru=function(t,e){var n=E.debounceRendering;E.debounceRendering=function(i){return i()};var r=t(e);return E.debounceRendering=n,r},iu=yr,vi={useState:U,useId:ca,useReducer:Ue,useEffect:M,useLayoutEffect:rn,useInsertionEffect:ya,useTransition:ba,useDeferredValue:xa,useSyncExternalStore:ma,startTransition:ga,useRef:Ne,useImperativeHandle:sa,useMemo:xe,useCallback:Y,useContext:In,useDebugValue:la,version:"18.3.1",Children:Oc,render:Wc,hydrate:Qc,unmountComponentAtNode:eu,createPortal:zc,createElement:Ve,createContext:Rc,createFactory:Yc,cloneElement:Xc,createRef:kc,Fragment:ee,isValidElement:yr,isElement:iu,isFragment:Jc,isMemo:Zc,findDOMNode:tu,Component:Je,PureComponent:bi,memo:Pc,forwardRef:Mc,flushSync:ru,unstable_batchedUpdates:nu,StrictMode:ee,Suspense:br,SuspenseList:Pn,lazy:$c,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Kc},at=[],He=[],ou=Uint8Array,wi="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",on=0,au=wi.length;on<au;++on)at[on]=wi[on],He[wi.charCodeAt(on)]=on;He[45]=62,He[95]=63;function su(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 lu(t,e,n){return(e+n)*3/4-n}function Nn(t){var e,n=su(t),r=n[0],i=n[1],o=new ou(lu(t,r,i)),a=0,l=i>0?r-4:r,c;for(c=0;c<l;c+=4)e=He[t.charCodeAt(c)]<<18|He[t.charCodeAt(c+1)]<<12|He[t.charCodeAt(c+2)]<<6|He[t.charCodeAt(c+3)],o[a++]=e>>16&255,o[a++]=e>>8&255,o[a++]=e&255;return i===2&&(e=He[t.charCodeAt(c)]<<2|He[t.charCodeAt(c+1)]>>4,o[a++]=e&255),i===1&&(e=He[t.charCodeAt(c)]<<10|He[t.charCodeAt(c+1)]<<4|He[t.charCodeAt(c+2)]>>2,o[a++]=e>>8&255,o[a++]=e&255),o}function cu(t){return at[t>>18&63]+at[t>>12&63]+at[t>>6&63]+at[t&63]}function uu(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(cu(r));return i.join("")}function Mn(t){for(var e,n=t.length,r=n%3,i=[],o=16383,a=0,l=n-r;a<l;a+=o)i.push(uu(t,a,a+o>l?l:a+o));return r===1?(e=t[n-1],i.push(at[e>>2]+at[e<<4&63]+"==")):r===2&&(e=(t[n-2]<<8)+t[n-1],i.push(at[e>>10]+at[e>>4&63]+at[e<<2&63]+"=")),i.join("")}function bt(t){if(t===void 0)return{};if(!Pa(t))throw new Error(`The arguments to a Convex function must be an object. Received: ${t}`);return t}function du(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 Pa(t){const e=typeof t=="object",n=Object.getPrototypeOf(t),r=n===null||n===Object.prototype||n?.constructor?.name==="Object";return e&&r}const Na=!0,an=BigInt("-9223372036854775808"),ki=BigInt("9223372036854775807"),_i=BigInt("0"),hu=BigInt("8"),fu=BigInt("256"),ji="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 Ma{[Symbol.toPrimitive](e){if(e==="string")return this.toString();throw new Error(ji)}valueOf(){throw new Error(ji)}toJSON(){throw new Error(ji)}toString(){return"[unresolved commit timestamp]"}}const pu=new Ma;function Oa(t){return Number.isNaN(t)||!Number.isFinite(t)||Object.is(t,-0)}function mu(t){t<_i&&(t-=an+an);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>>=hu;return Mn(n)}function gu(t){const e=Nn(t);if(e.byteLength!==8)throw new Error(`Received ${e.byteLength} bytes, expected 8 for $integer`);let n=_i,r=_i;for(const i of e)n+=BigInt(i)*fu**r,r++;return n>ki&&(n+=an+an),n}function xu(t){if(t<an||ki<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),Mn(new Uint8Array(e))}function bu(t){const e=Nn(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 yu=DataView.prototype.setBigInt64?xu:mu,vu=DataView.prototype.getBigInt64?bu:gu,La=1024;function $a(t){if(t.length>La)throw new Error(`Field name ${t} exceeds maximum field name length ${La}.`);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 sn(t){if(t===null||typeof t=="boolean"||typeof t=="number"||typeof t=="string")return t;if(Array.isArray(t))return t.map(r=>sn(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 Nn(t.$bytes).buffer}if(r==="$integer"){if(typeof t.$integer!="string")throw new Error(`Malformed $integer field on ${t}`);return vu(t.$integer)}if(r==="$float"){if(typeof t.$float!="string")throw new Error(`Malformed $float field on ${t}`);const i=Nn(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,Na);if(!Oa(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 pu}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))$a(r),n[r]=sn(i);return n}const Da=16384;function On(t){const e=JSON.stringify(t,(n,r)=>r===void 0?"undefined":typeof r=="bigint"?`${r.toString()}n`:r);if(e.length>Da){const n="[...truncated]";let r=Da-n.length;const i=e.codePointAt(r-1);return i!==void 0&&i>65535&&(r-=1),e.substring(0,r)+n}return e}function Si(t,e,n,r){if(t===void 0){const a=n&&` (present at path ${n} in original object ${On(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<an||ki<t)throw new Error(`BigInt ${t} does not fit into a 64-bit signed integer.`);return{$integer:yu(t)}}if(typeof t=="number")if(Oa(t)){const a=new ArrayBuffer(8);return new DataView(a).setFloat64(0,t,Na),{$float:Mn(new Uint8Array(a))}}else return t;if(typeof t=="boolean"||typeof t=="string")return t;if(t instanceof ArrayBuffer)return{$bytes:Mn(new Uint8Array(t))};if(t instanceof Ma)return{$commitTs:null};if(Array.isArray(t))return t.map((a,l)=>Si(a,e,n+`[${l}]`));if(t instanceof Set)throw new Error(Ti(n,"Set",[...t],e));if(t instanceof Map)throw new Error(Ti(n,"Map",[...t],e));if(!Pa(t)){const a=t?.constructor?.name,l=a?`${a} `:"";throw new Error(Ti(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&&($a(a),i[a]=Si(l,e,n+`.${a}`));return i}function Ti(t,e,n,r){return t?`${e}${On(n)} is not a supported Convex type (present at path ${t} in original object ${On(r)}). To learn about Convex's supported types, see https://docs.convex.dev/using/types.`:`${e}${On(n)} is not a supported Convex type.`}function st(t){return Si(t,t,"")}var wu=Object.defineProperty,ku=(t,e,n)=>e in t?wu(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Ci=(t,e,n)=>ku(t,typeof e!="symbol"?e+"":e,n),qa,za;const _u=Symbol.for("ConvexError");class vr extends(za=Error,qa=_u,za){constructor(e){super(typeof e=="string"?e:On(e)),Ci(this,"name","ConvexError"),Ci(this,"data"),Ci(this,qa,!0),this.data=e}}const Ua=()=>Array.from({length:4},()=>0);Ua(),Ua();const Ba="1.45.0";var ju=Object.defineProperty,Su=(t,e,n)=>e in t?ju(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Fa=(t,e,n)=>Su(t,typeof e!="symbol"?e+"":e,n);const Tu="color:rgb(0, 145, 255)";function Va(t){switch(t){case"query":return"Q";case"mutation":return"M";case"action":return"A";case"any":return"?"}}class Ha{constructor(e){Fa(this,"_onLogLineFuncs"),Fa(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 Wa(t){const e=new Ha(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 Qa(t){return new Ha(t)}function wr(t,e,n,r,i){const o=Va(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}]`,Tu,c)}else t.error(`[CONVEX ${o}(${r})] ${i}`)}function Cu(t,e){const n=`[CONVEX FATAL ERROR] ${e}`;return t.error(n),new Error(n)}function ln(t,e,n){return`[CONVEX ${Va(t)}(${e})] ${n.errorMessage}
|
|
2
|
+
Called by client`}function Ai(t,e){return e.data=t.errorData,e}function zt(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 Ut(t,e){return JSON.stringify({udfPath:zt(t),args:st(e)})}function Ga(t,e,n){const{initialNumItems:r,id:i}=n;return JSON.stringify({type:"paginated",udfPath:zt(t),args:st(e),options:st({initialNumItems:r,id:i})})}var Au=Object.defineProperty,Ru=(t,e,n)=>e in t?Au(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,lt=(t,e,n)=>Ru(t,typeof e!="symbol"?e+"":e,n);class Eu{constructor(){lt(this,"nextQueryId"),lt(this,"querySetVersion"),lt(this,"querySet"),lt(this,"queryIdToToken"),lt(this,"identityVersion"),lt(this,"auth"),lt(this,"outstandingQueriesOlderThanRestart"),lt(this,"outstandingAuthOlderThanRestart"),lt(this,"paused"),lt(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=zt(e),a=Ut(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 h=this.querySetVersion,m=this.querySetVersion+1,d={type:"Add",queryId:c,udfPath:o,args:[st(n)],journal:r,componentPath:i};return this.paused?this.pendingQuerySetModifications.set(c,d):this.querySetVersion=m,{queryToken:a,modification:{type:"ModifyQuerySet",baseVersion:h,newVersion:m,modifications:[d]},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=zt(e),i=Ut(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:[st(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 Iu=Object.defineProperty,Pu=(t,e,n)=>e in t?Iu(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,kr=(t,e,n)=>Pu(t,typeof e!="symbol"?e+"":e,n);class Nu{constructor(e,n){this.logger=e,this.markConnectionStateDirty=n,kr(this,"inflightRequests"),kr(this,"requestsOlderThanRestart"),kr(this,"inflightMutationsCount",0),kr(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)wr(this.logger,"info",r,i,c);const o=n.status;let a,l;if(e.success)a={success:!0,logLines:e.logLines,value:sn(e.result)},l=()=>o.onResult(a);else{const c=e.result,{errorData:u}=e;wr(this.logger,"error",r,i,c),a={success:!1,errorMessage:c,errorData:u!==void 0?sn(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 Ln=Symbol.for("functionName"),Mu=Symbol.for("toReferencePath");function Ou(t){return t[Mu]??null}function Lu(t){return t.startsWith("function://")}function $u(t){let e;if(typeof t=="string")Lu(t)?e={functionHandle:t}:e={name:t};else if(t[Ln])e={name:t[Ln]};else{const n=Ou(t);if(!n)throw new Error(`${t} is not a functionReference`);e={reference:n}}return e}function Re(t){const e=$u(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[Ln];if(!n)throw new Error(`${t} is not a functionReference`);return n}function Ri(t){return{[Ln]:t}}function Ka(t=[]){const e={get(n,r){if(typeof r=="string"){const i=[...t,r];return Ka(i)}else if(r===Ln){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)}Ka();var Du=Object.defineProperty,qu=(t,e,n)=>e in t?Du(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,_r=(t,e,n)=>qu(t,typeof e!="symbol"?e+"":e,n);class $n{constructor(e){_r(this,"queryResults"),_r(this,"modifiedQueries"),this.queryResults=e,this.modifiedQueries=[]}getQuery(e,...n){const r=bt(n[0]),i=Re(e),o=this.queryResults.get(Ut(i,r));if(o!==void 0)return $n.queryValue(o.result)}getAllQueries(e){const n=[],r=Re(e);for(const i of this.queryResults.values())i.udfPath===zt(r)&&n.push({args:i.args,value:$n.queryValue(i.result)});return n}setQuery(e,n,r){const i=bt(n),o=Re(e),a=Ut(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(){_r(this,"queryResults"),_r(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 $n(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 $n(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?Ai(r,new vr(ln("query",n.udfPath,r))):new Error(ln("query",n.udfPath,r))}}hasQueryResult(e){return this.queryResults.get(e)!==void 0}queryLogs(e){return this.queryResults.get(e)?.result?.logLines}}var Uu=Object.defineProperty,Bu=(t,e,n)=>e in t?Uu(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Ei=(t,e,n)=>Bu(t,typeof e!="symbol"?e+"":e,n);class Me{constructor(e,n){Ei(this,"low"),Ei(this,"high"),Ei(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 Me(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?Ya:e>=Fu?Vu:new Me(e%Dn|0,e/Dn|0)}toString(){return(BigInt(this.high)*BigInt(Dn)+BigInt(this.low)).toString()}equals(e){return Me.isLong(e)||(e=Me.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 Me.isLong(e)||(e=Me.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"?Me.fromNumber(e):new Me(e.low,e.high)}}const Ya=new Me(0,0),Ja=65536,Dn=Ja*Ja,Fu=Dn*Dn,Vu=new Me(-1,-1);var Hu=Object.defineProperty,Wu=(t,e,n)=>e in t?Hu(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,jr=(t,e,n)=>Wu(t,typeof e!="symbol"?e+"":e,n);class Za{constructor(e,n){jr(this,"version"),jr(this,"remoteQuerySet"),jr(this,"queryPath"),jr(this,"logger"),this.version={querySet:0,ts:Me.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)wr(this.logger,"info","query",i,a);const o=sn(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)wr(this.logger,"info","query",i,a);const{errorData:o}=r;this.remoteQuerySet.set(r.queryId,{success:!1,errorMessage:r.errorMessage,errorData:o!==void 0?sn(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 Ii(t){const e=Nn(t);return Me.fromBytesLE(Array.from(e))}function Qu(t){const e=new Uint8Array(t.toBytesLE());return Mn(e)}function Xa(t){switch(t.type){case"FatalError":case"AuthError":case"ActionResponse":case"TransitionChunk":case"Ping":return{...t};case"MutationResponse":return t.success?{...t,ts:Ii(t.ts)}:{...t};case"Transition":return{...t,startVersion:{...t.startVersion,ts:Ii(t.startVersion.ts)},endVersion:{...t.endVersion,ts:Ii(t.endVersion.ts)}}}}function Gu(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:Qu(t.maxObservedTimestamp)}:{...t,maxObservedTimestamp:void 0}}}var Ku=Object.defineProperty,Yu=(t,e,n)=>e in t?Ku(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,fe=(t,e,n)=>Yu(t,typeof e!="symbol"?e+"":e,n);const Ju=1e3,Zu=1001,Xu=1005,ed=4040;let Sr;function cn(){return Sr===void 0&&(Sr=Date.now()),typeof performance>"u"||!performance.now?Date.now():Math.round(Sr+performance.now())}function es(){return`t=${Math.round((cn()-Sr)/100)/10}s`}const ts={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 td(t){if(t===void 0)return"Unknown";for(const e of Object.keys(ts))if(t.startsWith(e))return e;return"Unknown"}class nd{constructor(e,n,r,i,o,a){this.markConnectionStateDirty=o,this.debug=a,fe(this,"socket"),fe(this,"connectionCount"),fe(this,"_hasEverConnected",!1),fe(this,"lastCloseReason"),fe(this,"transitionChunkBuffer",null),fe(this,"defaultInitialBackoff"),fe(this,"maxBackoff"),fe(this,"retries"),fe(this,"serverInactivityThreshold"),fe(this,"reconnectDueToServerInactivityTimeout"),fe(this,"scheduledReconnect",null),fe(this,"networkOnlineHandler",null),fe(this,"pendingNetworkRecoveryInfo",null),fe(this,"uri"),fe(this,"onOpen"),fe(this,"onResume"),fe(this,"onMessage"),fe(this,"webSocketConstructor"),fe(this,"logger"),fe(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=Xa(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:cn()})),this.lastCloseReason!=="InitialConnect"&&(this.lastCloseReason?this.logger.log("WebSocket reconnected at",es(),"after disconnect due to",this.lastCloseReason):this.logger.log("WebSocket reconnected at",es())),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=Xa(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!==Ju&&n.code!==Zu&&n.code!==Xu&&n.code!==ed){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=td(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=Gu(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=cn(),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=cn()-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:cn()})):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:ts[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=cn()-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 rd(){return id()}function id(){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 qn extends Error{}qn.prototype.name="InvalidTokenError";function od(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 ad(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 od(e)}catch{return atob(e)}}function ns(t,e){if(typeof t!="string")throw new qn("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 qn(`Invalid token specified: missing part #${n+1}`);let i;try{i=ad(r)}catch(o){throw new qn(`Invalid token specified: invalid base64 for part #${n+1} (${o.message})`)}try{return JSON.parse(i)}catch(o){throw new qn(`Invalid token specified: invalid json for part #${n+1} (${o.message})`)}}var sd=Object.defineProperty,ld=(t,e,n)=>e in t?sd(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Oe=(t,e,n)=>ld(t,typeof e!="symbol"?e+"":e,n);const cd=480*60*60*1e3,rs=2;class ud{constructor(e,n,r){Oe(this,"authState",{state:"noAuth"}),Oe(this,"configVersion",0),Oe(this,"syncState"),Oe(this,"authenticate"),Oe(this,"stopSocket"),Oe(this,"tryRestartSocket"),Oe(this,"pauseSocket"),Oe(this,"resumeSocket"),Oe(this,"clearAuth"),Oe(this,"logger"),Oe(this,"refreshTokenLeewaySeconds"),Oe(this,"initialAuthTokenReuse"),Oe(this,"lastRefreshChange"),Oe(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>=rs){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, ${rs-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 h=(Date.now()-n)/1e3;l=o-h,l<=0&&(l=0)}else l=a;let c=Math.min(cd,(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 ns(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 dd=["convexClientConstructed","convexWebSocketOpen","convexFirstMessageReceived"];function hd(t,e){const n={sessionId:e};typeof performance>"u"||!performance.mark||performance.mark(t,{detail:n})}function fd(t){let e=t.name.slice(6);return e=e.charAt(0).toLowerCase()+e.slice(1),{name:e,startTime:t.startTime}}function pd(t){if(typeof performance>"u"||!performance.getEntriesByName)return[];const e=[];for(const n of dd){const r=performance.getEntriesByName(n).filter(i=>i.entryType==="mark").filter(i=>i.detail.sessionId===t);e.push(...r)}return e.map(fd)}var md=Object.defineProperty,gd=(t,e,n)=>e in t?md(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,pe=(t,e,n)=>gd(t,typeof e!="symbol"?e+"":e,n);class xd{constructor(e,n,r){if(pe(this,"address"),pe(this,"state"),pe(this,"requestManager"),pe(this,"webSocketManager"),pe(this,"authenticationManager"),pe(this,"remoteQuerySet"),pe(this,"optimisticQueryResults"),pe(this,"_transitionHandlerCounter",0),pe(this,"_nextRequestId"),pe(this,"_onTransitionFns",new Map),pe(this,"_sessionId"),pe(this,"firstMessageReceived",!1),pe(this,"debug"),pe(this,"logger"),pe(this,"maxObservedTimestamp"),pe(this,"connectionStateSubscribers",new Map),pe(this,"nextConnectionStateSubscriberId",0),pe(this,"_lastPublishedConnectionState"),pe(this,"markConnectionStateDirty",()=>{Promise.resolve().then(()=>{const p=this.connectionState();if(JSON.stringify(p)!==JSON.stringify(this._lastPublishedConnectionState)){this._lastPublishedConnectionState=p;for(const b of this.connectionStateSubscribers.values())b(p)}})}),pe(this,"mark",p=>{this.debug&&hd(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&&du(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?Qa({verbose:r.verbose??!1}):r.logger!==!0&&r.logger?r.logger:Wa({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 h=`${u}://${l}/api/${Ba}/sync`;this.state=new Eu,this.remoteQuerySet=new Za(p=>this.state.queryPath(p),this.logger),this.requestManager=new Nu(this.logger,this.markConnectionStateDirty);const m=()=>{this.webSocketManager.pause(),this.state.pause()};this.authenticationManager=new ud(this.state,{authenticate:p=>{const b=this.state.setAuth(p);return this.webSocketManager.sendMessage(b),b.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(b=>b.token))}),this._nextRequestId=0,this._sessionId=rd();const{unsavedChangesWarning:d}=r;if(typeof window>"u"||typeof window.addEventListener>"u"){if(d===!0)throw new Error("unsavedChangesWarning requested, but window.addEventListener not found! Remove {unsavedChangesWarning: true} from Convex client options.")}else d!==!1&&window.addEventListener("beforeunload",p=>{if(this.requestManager.hasIncompleteRequests()){p.preventDefault();const b="Are you sure you want to leave? Your changes may not be saved.";return(p||window.event).returnValue=b,b}});this.webSocketManager=new nd(h,{onOpen:p=>{this.mark("convexWebSocketOpen"),this.webSocketManager.sendMessage({...p,type:"Connect",sessionId:this._sessionId,maxObservedTimestamp:this.maxObservedTimestamp}),this.remoteQuerySet=new Za(y=>this.state.queryPath(y),this.logger);const[b,S]=this.state.restart();S&&this.webSocketManager.sendMessage(S),this.webSocketManager.sendMessage(b);for(const y of this.requestManager.restart())this.webSocketManager.sendMessage(y)},onResume:()=>{const[p,b]=this.state.resume();b&&this.webSocketManager.sendMessage(b),p&&this.webSocketManager.sendMessage(p);for(const S of this.requestManager.resume())this.webSocketManager.sendMessage(S)},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 b=this.requestManager.removeCompleted(this.remoteQuerySet.timestamp());this.notifyOnQueryResultChanges(b);break}case"MutationResponse":{p.success&&this.observedTimestamp(p.ts);const b=this.requestManager.onResponse(p);b!==null&&this.notifyOnQueryResultChanges(new Map([[b.requestId,b.result]]));break}case"ActionResponse":{this.requestManager.onResponse(p);break}case"AuthError":{this.authenticationManager.onAuthError(p);break}case"FatalError":{const b=Cu(this.logger,p.error);throw this.webSocketManager.terminate(),b}}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?ns(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=bt(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=bt(n),i=Ut(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=bt(n),i=Ut(e,r);return this.optimisticQueryResults.queryLogs(i)}queryJournal(e,n){const r=bt(n),i=Ut(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?Ai(i,new vr(ln("mutation",e,i))):new Error(ln("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=bt(n);this.tryReportLongDisconnect();const a=this.nextRequestId;if(this._nextRequestId++,r!==void 0){const h=r.optimisticUpdate;if(h!==void 0){const m=b=>{h(b,o)instanceof Promise&&this.logger.warn("Optimistic update handler returned a Promise. Optimistic updates should be synchronous.")},p=this.optimisticQueryResults.applyOptimisticUpdate(m,a).map(b=>{const S=this.localQueryResultByToken(b);return{token:b,modification:{kind:"Updated",result:S===void 0?void 0:{success:!0,value:S,logLines:[]}}}});this.handleTransition({queries:p,reflectedMutations:[],timestamp:this.remoteQuerySet.timestamp()})}}const l={type:"Mutation",requestId:a,udfPath:e,componentPath:i,args:[st(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?Ai(r,new vr(ln("action",e,r))):new Error(ln("action",e,r));return r.value}async actionInternal(e,n,r){const i=bt(n),o=this.nextRequestId;this._nextRequestId++,this.tryReportLongDisconnect();const a={type:"Action",requestId:o,udfPath:e,componentPath:r,args:[st(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=pd(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-${Ba}`},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 Pi(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 bd=Object.defineProperty,yd=(t,e,n)=>e in t?bd(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,is=(t,e,n)=>yd(t,typeof e!="symbol"?e+"":e,n);class vd{constructor(e,n){this.client=e,this.onTransition=n,is(this,"paginatedQuerySet",new Map),is(this,"lastTransitionTs"),this.lastTransitionTs=Me.fromNumber(0),this.client.addOnTransitionHandler(r=>this.onBaseTransition(r))}subscribe(e,n,r){const i=zt(e),o=Ga(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=zt(e),o=Ga(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 h=Pi(u);i=i.concat(h.page),a=!!h.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=Pi(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,h]]of o)n(a.get(u).queryToken)!==void 0&&n(a.get(h).queryToken)!==void 0&&this.completePaginatedQuerySplit(i,c,u,h);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 h=n(u.queryToken);if(!h)continue;const m=Pi(h);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 h=this.client.subscribe(e.canonicalizedUdfPath,{...e.args,paginationOpts:{...c,cursor:i,endCursor:o}});e.pageKeyToQuery.set(l,{...h,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 wd({getCurrentValue:t,subscribe:e}){const[n,r]=U(()=>({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 kd=Object.defineProperty,_d=(t,e,n)=>e in t?kd(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,yt=(t,e,n)=>_d(t,typeof e!="symbol"?e+"":e,n);const jd=5e3;if(typeof vi>"u")throw new Error("Required dependency 'react' not found");function os(t,e,n){function r(i){return Rd(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 ${Re(t)}`);return os(t,e,o)},r}function Sd(t,e){return function(n){return e.action(t,n)}}class Td{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?Qa({verbose:n?.verbose??!1}):n?.logger!==!0&&n?.logger?n.logger:Wa({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 xd(this.address,()=>{},this.options),this.adminAuth&&this.cachedSync.setAdminAuth(this.adminAuth,this.fakeUserIdentity),this.cachedPaginatedQueryClient=new vd(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=Re(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 h=this.listeners.get(l);h.delete(a),h.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??jd,i=this.watchQuery(e.query,e.args||{}).onUpdate(()=>{});setTimeout(i,n)}watchPaginatedQuery(e,n,r){const i=Re(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=Re(e);return this.sync.mutation(o,r,i)}action(e,...n){const r=Re(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 Tr=vi.createContext(void 0);function Cd(){return In(Tr)}const Ad=({client:t,children:e})=>vi.createElement(Tr.Provider,{value:t},e);function zn(t,...e){const n=e[0]==="skip",r=e[0]==="skip"?{}:bt(e[0]),i=typeof t=="string"?Ri(t):t,o=Re(i),a=xe(()=>n?{}:{query:{query:i,args:r}},[JSON.stringify(st(r)),o,n]),c=Nd(a).query;if(c instanceof Error)throw c;return c}function Bt(t){const e=typeof t=="string"?Ri(t):t,n=In(Tr);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 xe(()=>os(e,n),[n,Re(e)])}function Un(t){const e=In(Tr),n=typeof t=="string"?Ri(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 xe(()=>Sd(n,e),[e,Re(n)])}function Rd(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 Ed=Object.defineProperty,Id=(t,e,n)=>e in t?Ed(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Ni=(t,e,n)=>Id(t,typeof e!="symbol"?e+"":e,n);class Pd{constructor(e){Ni(this,"createWatch"),Ni(this,"queries"),Ni(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(Re(r),this.queries[n]===void 0)this.addQuery(n,r,i,o?{paginationOptions:o}:{});else{const a=this.queries[n];(Re(r)!==Re(a.query)||JSON.stringify(st(i))!==JSON.stringify(st(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;Re(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 Nd(t){const e=Cd();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=xe(()=>(r,i,{journal:o,paginationOptions:a})=>a?e.watchPaginatedQuery(r,i,a):e.watchQuery(r,i,o?{journal:o}:{}),[e]);return Md(t,n)}function Md(t,e){const[n]=U(()=>new Pd(e));n.createWatch!==e&&n.setCreateWatch(e),M(()=>()=>n.destroy(),[n]);const r=xe(()=>({getCurrentValue:()=>n.getLocalResults(t),subscribe:i=>(n.setQueries(t),n.subscribe(i))}),[n,t]);return wd(r)}var Od=Symbol.for("preact-signals");function Cr(){if(vt>1)vt--;else{var t,e=!1;for((function(){var i=Er;for(Er=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,Rr++;n!==void 0;){var r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&ss(n))try{n.c()}catch(i){e||(t=i,e=!0)}n=r}}if(Rr=0,vt--,e)throw t}}function Ld(t){if(vt>0)return t();Mi=++$d,vt++;try{return t()}finally{Cr()}}var re=void 0;function Ar(t){var e=re;re=void 0;try{return t()}finally{re=e}}var Bn=void 0,vt=0,Rr=0,$d=0,Mi=0,Er=void 0,Ir=0;function as(t){if(re!==void 0){var e=t.n;if(e===void 0||e.t!==re)return e={i:0,S:t,p:re.s,n:void 0,t:re,e:void 0,x:void 0,r:e},re.s!==void 0&&(re.s.n=e),re.s=e,t.n=e,32&re.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=re.s,e.n=void 0,re.s.n=e,re.s=e),e}}function we(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}we.prototype.brand=Od,we.prototype.h=function(){return!0},we.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:Ar(function(){var r;(r=e.W)==null||r.call(e)}))},we.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&&Ar(function(){var i;(i=e.Z)==null||i.call(e)}))}},we.prototype.subscribe=function(t){var e=this;return Fn(function(){var n=e.value;Ar(function(){return t(n)})},{name:"sub"})},we.prototype.valueOf=function(){return this.value},we.prototype.toString=function(){return this.value+""},we.prototype.toJSON=function(){return this.value},we.prototype.peek=function(){var t=this;return Ar(function(){return t.value})},Object.defineProperty(we.prototype,"value",{get:function(){var t=as(this);return t!==void 0&&(t.i=this.i),this.v},set:function(t){if(t!==this.v){if(Rr>100)throw new Error("Cycle detected");(function(n){vt!==0&&Rr===0&&n.l!==Mi&&(n.l=Mi,Er={S:n,v:n.v,i:n.i,o:Er})})(this),this.v=t,this.i++,Ir++,vt++;try{for(var e=this.t;e!==void 0;e=e.x)e.t.N()}finally{Cr()}}}});function B(t,e){return new we(t,e)}function ss(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 ls(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 cs(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 Ft(t,e){we.call(this,void 0,e),this.x=t,this.s=void 0,this.g=Ir-1,this.f=4}Ft.prototype=new we,Ft.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Ir))return!0;if(this.g=Ir,this.f|=1,this.i>0&&!ss(this))return this.f&=-2,!0;var t=re;try{ls(this),re=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 re=t,cs(this),this.f&=-2,!0},Ft.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)}we.prototype.S.call(this,t)},Ft.prototype.U=function(t){if(this.t!==void 0&&(we.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)}},Ft.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(Ft.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var t=as(this);if(this.h(),t!==void 0&&(t.i=this.i),16&this.f)throw this.v;return this.v}});function Oi(t,e){return new Ft(t,e)}function us(t){var e=t.m;if(t.m=void 0,typeof e=="function"){vt++;var n=re;re=void 0;try{e()}catch(r){throw t.f&=-2,t.f|=8,Li(t),r}finally{re=n,Cr()}}}function Li(t){for(var e=t.s;e!==void 0;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,us(t)}function Dd(t){if(re!==this)throw new Error("Out-of-order effect");cs(this),re=t,this.f&=-2,8&this.f&&Li(this),Cr()}function un(t,e){this.x=t,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=e?.name}un.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()}},un.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,us(this),ls(this),vt++;var t=re;return re=this,Dd.bind(this,t)},un.prototype.N=function(){2&this.f||(this.f|=2,this.u=Bn,Bn=this)},un.prototype.d=function(){this.f|=8,1&this.f||Li(this)},un.prototype.dispose=function(){this.d()};function Fn(t,e){var n=new un(t,e);try{n.c()}catch(i){throw n.d(),i}var r=n.d.bind(n);return r[Symbol.dispose]=r,r}var ds,Pr,qd=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__,hs=[];Fn(function(){ds=this.N})();function dn(t,e){E[t]=e.bind(null,E[t]||function(){})}function Nr(t){if(Pr){var e=Pr;Pr=void 0,e()}Pr=t&&t.S()}function fs(t){var e=this,n=t.data,r=hn(n);r.value=n;var i=xe(function(){for(var l=e,c=e.__v;c=c.__;)if(c.__c){c.__c.__$f|=4;break}var u=Oi(function(){var p=r.value.value;return p===0?0:p===!0?"":p||""}),h=Oi(function(){return!Array.isArray(u.value)&&!Do(u.value)}),m=Fn(function(){if(this.N=ps,h.value){var p=u.value;l.__v&&l.__v.__e&&l.__v.__e.nodeType===3&&(l.__v.__e.data=p)}}),d=e.__$u.d;return e.__$u.d=function(){m(),d.call(this)},[h,u]},[]),o=i[0],a=i[1];return o.value?a.peek():a.value}fs.displayName="ReactiveTextNode",Object.defineProperties(we.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:fs},props:{configurable:!0,get:function(){var t=this;return{data:{get value(){return t.value}}}}},__b:{configurable:!0,value:1}}),dn("__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 we&&(n||(e.__np=n={}),n[i]=o,r[i]=o.peek())}}t(e)}),dn("__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 Fn(function(){a=this},{name:o}),a.c=i,a})(function(){var i;qd&&((i=n.y)==null||i.call(n)),r.__$f|=1,r.setState({})},typeof e.type=="function"?e.type.displayName||e.type.name:""))),Nr(n)}}),dn("__e",function(t,e,n,r){Nr(),t(e,n,r)}),dn("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],h=r[c];u===void 0?(u=zd(n,c,h,i),o[c]=u):u.o(h,i)}}}t(e)});function zd(t,e,n,r){var i=e in t&&t.ownerSVGElement===void 0,o=B(n);return{o:function(a,l){o.value=a,r=l},d:Fn(function(){this.N=ps;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))})}}dn("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 h=u.__$u;h&&(u.__$u=void 0,h.d())}}t(e)}),dn("__h",function(t,e,n,r){(r<3||r===9)&&(e.__$f|=2),t(e,n,r)}),Je.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 hn(t,e){return xe(function(){return B(t,e)},[])}var Ud=function(t){queueMicrotask(function(){queueMicrotask(t)})};function Bd(){Ld(function(){for(var t;t=hs.shift();)ds.call(t)})}function ps(){hs.push(this)===1&&(E.requestAnimationFrame||Ud)(Bd)}const ae=B(!1),Mr=B(void 0),Vn="https://jexitychat.de/privacy",Hn=B(Vn),$i=B("chip"),At=B(void 0),Di=B([]),qi=B([]),ms=B(null),zi=B(!1);BigInt("-9223372036854775808"),BigInt("9223372036854775807"),BigInt("0"),BigInt("8"),BigInt("256");const Fd=Symbol.for("functionName"),Vd=Symbol.for("toReferencePath");function gs(t=[]){const e={get(n,r){if(typeof r=="string"){const i=[...t,r];return gs(i)}else if(r===Fd){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 Hd=gs();function xs(t,e){const n={get(r,i){if(typeof i=="string"){const o=[...e,i];return xs(t,o)}else if(i===Vd){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 Wd=()=>xs("components",[]),ke=Hd;Wd();function Qd(){return zn(ke.maintenance.isFrozen,{})?.frozen??zi.value}function Gd(t){return t.replace(/\.convex\.site\b/,".convex.cloud")}function Ui(t){return t.replace(/\.convex\.cloud\b/,".convex.site")}function bs(t){return typeof t!="number"||!Number.isFinite(t)?24:Math.min(100,Math.max(0,t))}function Kd(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 Yd(t,e){const n=t.title??e?.title??"Assistant",r=t.privacyPolicyMode??e?.privacyPolicyMode??"platform",i=Jd(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,privacyPolicyMode:r,privacyPolicyUrl:r==="custom"?Kd(t.privacyPolicyUrl??e?.privacyPolicyUrl):void 0,privacyNoticeStyle:i,sessionTimeoutMs:Zd(e?.sessionTimeout),triggerIcon:t.triggerIcon??e?.triggerIcon??"chat",triggerRadius:t.triggerRadius??e?.triggerRadius??"full",triggerLabel:t.triggerLabel??e?.triggerLabel??"Chatte mit uns",triggerOffsetX:bs(t.triggerOffsetX??e?.triggerOffsetX),triggerOffsetY:bs(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 Jd(t){return t==="explicit"||t==="sheet"?"explicit":"chip"}function Zd(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 Xd(t,e,n,r){const i=new URL(`${t}/widget/config`);i.searchParams.set("orgSlug",e),r&&i.searchParams.set("projSlug",r);const o=await fetch(i.toString(),{signal:n});return o.ok?o.json():null}function eh(t,e,n,r){const[i,o]=U(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://tame-spider-109.eu-west-1.convex.cloud",l=a?Ui(a):void 0;if(!l||!t){o({config:null,settled:!0});return}const c=new AbortController;async function u(h){try{const m=await Xd(h,t,c.signal,e);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 ys=globalThis.console,ne={warn(...t){ys.warn(...t)},error(...t){ys.error(...t)},debug(...t){}};async function Bi(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"});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 th(t,e){return e.some(n=>n==="/"?t==="/":t===n||t.startsWith(n+"/"))}function Fi(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 nh({orgSlug:t,projSlug:e,preToken:n,convexUrl:r,preAllowedUrls:i,preExcludedPaths:o,preMaintenance:a}){M(()=>{const u=r??"https://tame-spider-109.eu-west-1.convex.cloud",h=u?Ui(u):void 0;if(!h||!t||(ms.value={orgSlug:t,projSlug:e,siteUrl:h},n))return;let m=!1;return(async()=>{const d=await Bi(t,h,e);if(!m)if(d.ok)At.value=d.token,Di.value=d.allowedUrls,qi.value=d.excludePaths,zi.value=d.maintenance??!1;else{const p=e?`project '${t}/${e}'`:`org '${t}'`;d.error==="unauthorized"?ne.warn(`[JexityChat] Domain not authorized for ${p}. Check the widget's domain rules.`):d.error==="not_found"?ne.error(`[JexityChat] No active widget config found for ${p}.`):d.error==="rate_limited"?ne.error(`[JexityChat] Bootstrap rate-limited for ${p}. Retry after ${d.retryAfterSec??60}s.`):ne.error(`[JexityChat] Bootstrap failed: ${d.error}`)}})(),()=>{m=!0}},[t,e,n,r]);const l=i?.join(`
|
|
3
|
+
`)??"",c=o?.join(`
|
|
4
|
+
`)??"";M(()=>{n&&(Di.value=l?l.split(`
|
|
5
|
+
`):[],qi.value=c?c.split(`
|
|
6
|
+
`):[],zi.value=a??!1)},[n,l,c,a])}const Or=new Set;let vs=!1;function rh(){if(vs)return;vs=!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 ih(t){return Or.add(t),window.addEventListener("popstate",t),rh(),()=>{Or.delete(t),window.removeEventListener("popstate",t)}}function oh(){const t=hn(window.location.href);M(()=>ih(()=>{t.value=window.location.href}),[t]);const e=Di.value,n=qi.value,r=new URL(t.value).pathname,i=th(r,n);return M(()=>{i?ne.warn(`[JexityChat] Widget hidden — current path is in the exclude list: ${r}`):e.length>0&&!e.some(o=>Fi(t.value,o))&&ne.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=>Fi(t.value,o))}const Vi={title:"Assistant",statusOnline:"Online · Responds in seconds",inputPlaceholder:"Type a message…",aiThinking:"AI is responding…",sendAriaLabel:"Send message",attachImagesAriaLabel:"Attach images",attachComingSoon:"File attachments — coming soon",voiceAriaLabel:"Voice message",voiceComingSoon:"Voice messages — coming soon",removeAttachmentAriaLabel:"Remove attachment",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",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",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.
|
|
3
7
|
We will contact you at {email} when an agent is ready.
|
|
4
8
|
|
|
5
9
|
Your reference: **{ref}**
|
|
6
|
-
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"},ps={title:"Assistent",statusOnline:"Online · Antwortet in Sekunden",inputPlaceholder:"Nachricht eingeben…",aiThinking:"KI antwortet…",sendAriaLabel:"Nachricht senden",attachImagesAriaLabel:"Bilder anhängen",attachComingSoon:"Dateianhänge — bald verfügbar",voiceAriaLabel:"Sprachnachricht",voiceComingSoon:"Sprachnachrichten — bald verfügbar",removeAttachmentAriaLabel:"Anhang 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.",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",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",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"},ws={title:"Assistent",statusOnline:"Online · Antwortet in Sekunden",inputPlaceholder:"Nachricht eingeben…",aiThinking:"KI antwortet…",sendAriaLabel:"Nachricht senden",attachImagesAriaLabel:"Bilder anhängen",attachComingSoon:"Dateianhänge — bald verfügbar",voiceAriaLabel:"Sprachnachricht",voiceComingSoon:"Sprachnachrichten — bald verfügbar",removeAttachmentAriaLabel:"Anhang 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",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",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.
|
|
7
11
|
Wir kontaktieren Sie unter {email}, sobald ein Mitarbeiter bereit ist.
|
|
8
12
|
|
|
9
13
|
Ihre Referenz: **{ref}**
|
|
10
|
-
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"},Gd=[{value:"de",label:"Deutsch",flag:"🇩🇪"},{value:"en",label:"English",flag:"🇬🇧"}],Kd="de",Yd="jex-locale",ut=B("de"),Jd={en:Ui,de:ps};function I(){return Jd[ut.value]??Ui}function Bi(t){if(!t)return null;const e=(t.split("-")[0]??"").toLowerCase();return Gd.some(r=>r.value===e)?e:null}function ms(t){const e=Bi(t);if(e)return e;try{const n=Bi(localStorage.getItem(Yd));if(n)return n}catch{}if(typeof navigator<"u"){const n=Bi(navigator.language);if(n)return n}return Kd}function Zd(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;i&&(ut.value=ms(i))}return window.addEventListener("message",e),()=>{window.removeEventListener("message",e)}},[t])}const gs="jex-session-history",xs=gs,bs=1440*60*1e3,Te=B([]),ze=B(null),Et=B(void 0),Fi=B(!1),Vi=Ni(()=>Te.value.length>0),un=B(null),Xd="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",eh=6;function th(){let t="";const e=new Uint8Array(1);for(;t.length<eh;)crypto.getRandomValues(e),e[0]<252&&(t+=Xd[e[0]%36]);return"JEX-"+t}function nh(t){if(t===null)return null;if(typeof t=="number"&&Number.isFinite(t)&&t>=0)return t}function ys(t,e,n){if(n===null)return t;const r=typeof n=="number"?n:bs;return t.filter(i=>e-i.lastActivityAt<=r)}function rh(t,e,n,r){return n?ys(t,e,r):t}function ih(t){try{const e=sessionStorage.getItem(xs);if(!e)return Et.value=void 0,[];const n=JSON.parse(e);if(n.v!==1||!Array.isArray(n.entries))return Et.value=void 0,[];const r=Object.prototype.hasOwnProperty.call(n,"timeoutMs");return Et.value=nh(n.timeoutMs),rh(n.entries,t,r,Et.value)}catch{return Et.value=void 0,[]}}function Hn(t){try{const e={v:1,entries:t,timeoutMs:Et.value};sessionStorage.setItem(xs,JSON.stringify(e))}catch{}}function oh(){const t=Date.now(),e=ih(t);Te.value=e,Hn(e),ze.value=e[e.length-1]?.ref??null,Fi.value=!0}function ah(t){Et.value=t;const e=Date.now(),n=ys(Te.value,e,t),r=ze.value!==null&&!n.some(i=>i.ref===ze.value);return Te.value=n,r&&(ze.value=null),Hn(n),{activeRefPruned:r}}function vs(){const t=th(),e=Date.now(),n=[...Te.value,{ref:t,startedAt:e,lastActivityAt:e}];return Te.value=n,ze.value=t,Hn(n),t}function ws(){ze.value=null}function ks(t){const e=Date.now(),n=Te.value.map(r=>r.ref===t?{...r,lastActivityAt:e}:r);Te.value=n,ze.value=t,Hn(n)}function Hi(t){if(!t)return;const e=Date.now(),n=Te.value.map(r=>r.ref===t?{...r,lastActivityAt:e}:r);Te.value=n,Hn(n)}const Oe=B(_s());function _s(){return Vi.value?[{id:"home"}]:[{id:"home"},{id:"chat"}]}function sh(){Oe.value=_s()}const lh=B("screen");function wt(t){Oe.value=[...Oe.value,t]}function Wi(){Oe.value.length>1&&(Oe.value=Oe.value.slice(0,-1))}function Qi(t){Oe.value=[...Oe.value.slice(0,-1),t]}const ch=6e4,Wn=B(!1),Gi=B(!1),Ki=new Set;function uh(t){return Ki.add(t),()=>{Ki.delete(t)}}function dh(){const t=ze.value;return t?Te.value.find(n=>n.ref===t)?.lastActivityAt??null:null}function js(t){const e=dh();return e===null?!1:Date.now()-e>t}function Yi(){if(!(Wn.value&&Te.value.length===0)){Te.value=[],ze.value=null;try{sessionStorage.removeItem(gs)}catch(t){ne.warn("[JexityChat] Idle-lock storage clear failed:",t)}for(const t of Ki)try{t()}catch(e){ne.warn("[JexityChat] Lock reset callback threw:",e)}Oe.value=[{id:"home"}],Wn.value=!0}}function Lr(){Wn.value&&(Wn.value=!1)}function hh(t=bs){let e=document.visibilityState==="hidden"?Date.now():null;const n=()=>{if(document.visibilityState==="hidden"){e=Date.now();return}(e!==null&&Date.now()-e>t||js(t))&&Yi(),e=null};document.addEventListener("visibilitychange",n);const r=setInterval(()=>{Gi.value||js(t)&&Yi()},ch);return()=>{document.removeEventListener("visibilitychange",n),clearInterval(r),e=null}}function fh(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 $r({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 ph(){const t=I();return Oe.value.length>1?s("button",{class:"jex-header-back",onClick:Wi,"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($r,{size:24})}function mh({title:t}){return s("div",{class:"jex-header-info",children:s("h3",{children:t})})}function Ss({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 gh(){const t=I();return s("button",{class:"jex-header-close",type:"button",onClick:()=>{oe.value=!1},"aria-label":t.closeChatAriaLabel,title:t.closeChatAriaLabel,children:s(Ss,{size:18})})}function xh({action:t,showClose:e=!0}){return!t&&!e?null:s("div",{class:"jex-header-right",children:[t,e&&s(gh,{})]})}function Ts({title:t,rightAction:e,showClose:n=!0}){return s("header",{class:"jex-chat-header",children:[s(ph,{}),s(mh,{title:t}),s(xh,{action:e,showClose:n})]})}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 Cs(){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 As({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 yh({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 vh={chat:s(As,{size:28}),bot:s($r,{size:28}),sparkles:s(yh,{size:28})},wh={none:"0px",sm:"0.5rem",md:"0.75rem",lg:"1.25rem",full:"9999px"};function kh({radius:t="full",iconOption:e="chat",label:n}){const r=I(),i=n??r.fabLabel,o=i!=="";return s("button",{class:`jex-floating-button${oe.value?"":" jex-fab-pulse"}${!oe.value&&o?" jex-has-label":""}`,style:{borderRadius:wh[t]??"9999px"},onClick:()=>{oe.value=!oe.value},"aria-label":oe.value?r.closeChatAriaLabel:r.openChatAriaLabel,children:oe.value?s(Ss,{size:28}):s("div",{class:"jex-fab-inner",children:[vh[e],o&&s("span",{class:"jex-fab-label",children:i})]})})}const Dr=B(!1);function _h(t,e){return e?`jex-proactive-dismissed:${t}:${e}`:`jex-proactive-dismissed:${t}`}function Rs(t){try{return sessionStorage.getItem(t)!==null}catch{return!1}}function jh(t){try{sessionStorage.setItem(t,"1")}catch{}}function Sh(t){return t.isOpen||t.mode==="off"||t.hasHistory||t.dismissed?"skip":t.mode==="teaser"?"teaser":"open"}function Th({title:t,message:e,guardKey:n}){const r=I();function i(){Dr.value=!1,oe.value=!0}function o(a){a.stopPropagation(),jh(n),Dr.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($r,{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 dn=B(""),Qn=B(0),hn=B(null);function Ji(t){hn.value=t,t&&(Qn.value+=1)}const Es=100;function Is(t){const e=t.replace(/\s+/g," ").trim();return e.length>Es?`${e.slice(0,Es)}…`:e}const Gn=B(null),Ps=B(Date.now()),qr=B(!1),Zi=B(!1),Kn=B(!1),zr=B(null);function Ns(){return Oi.value==="explicit"&&!Zi.value}function Ms(){Ns()&&(Kn.value=!0)}function Ch(){Zi.value=!0,Kn.value=!1}function Os(){Zi.value=!1,Kn.value=!1,zr.value=null}const kt=B([]),Ah=4,Rh=8*1024*1024;function Eh(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`att-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,11)}`}function Ih(t){const e=Array.from(t).filter(i=>i.type.startsWith("image/")&&i.size<=Rh);if(e.length===0)return;const n=Ah-kt.value.length;if(n<=0)return;const r=e.slice(0,n).map(i=>({id:Eh(),file:i,previewUrl:URL.createObjectURL(i)}));kt.value=[...kt.value,...r]}function Ph(t){const e=kt.value.find(n=>n.id===t);e&&URL.revokeObjectURL(e.previewUrl),kt.value=kt.value.filter(n=>n.id!==t)}function Nh(){for(const t of kt.value)URL.revokeObjectURL(t.previewUrl);kt.value=[]}BigInt("-9223372036854775808"),BigInt("9223372036854775807"),BigInt("0"),BigInt("8"),BigInt("256");const Mh=Symbol.for("functionName"),Oh=Symbol.for("toReferencePath");function Ls(t=[]){const e={get(n,r){if(typeof r=="string"){const i=[...t,r];return Ls(i)}else if(r===Mh){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 Lh=Ls();function $s(t,e){const n={get(r,i){if(typeof i=="string"){const o=[...e,i];return $s(t,o)}else if(i===Oh){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 $h=()=>$s("components",[]),Ce=Lh;$h();function Ds({sessionId:t,visitorId:e,ensureSession:n}){const r=Bt(Ce.functions.chat.public.conversations.send);return async function(o){if(Ns()){zr.value=o,Ms();return}if(!qr.value){qr.value=!0;try{const a=t&&e?{sessionId:t,visitorId:e}:await n();if(!a)return;const l=hn.value?.id;dn.value="",hn.value=null,Nh();try{const c=await r({sessionId:a.sessionId,visitorId:a.visitorId,content:o,...l!==void 0?{replyToId:l}:{},...typeof window<"u"?{pagePath:window.location.pathname}:{}});c.ok?Hi(a.visitorId):c.reason==="rate_limited"&&(Gn.value=Date.now()+c.retryAfterMs)}catch(c){ne.error("[jexity] Failed to send message:",c),dn.value.trim()||(dn.value=o)}}finally{qr.value=!1}}}}function Dh(){const t=Gn.value,e=Ps.value;M(()=>{if(t===null)return;const i=setInterval(()=>{Ps.value=Date.now()},1e3),o=setTimeout(()=>{Gn.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 qh(){const t=I(),{isActive:e,remainingSeconds:n}=Dh();return e?s("div",{class:"jex-rate-limit-notice",role:"status","aria-live":"polite",children:t.errorRateLimited.replace("{seconds}",String(n))}):null}const fn=B(null),Yn=B(null);function qs(){Yn.value=null}function zh(){const t=I(),e=fn.value;if(e===null)return null;const n=e==="no-token"?t.errorSessionNoToken:e==="unauthorized"?t.errorSessionUnauthorized:e==="network"?t.errorNetwork:t.somethingWentWrong;return s("div",{class:"jex-session-error-notice",role:"alert","aria-live":"assertive",children:n})}function Uh({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 zs=132;function Bh({onSend:t}){const e=qe(null),n=qe(null);M(()=>{const c=e.current;if(!c)return;c.style.height="0";const u=Math.min(c.scrollHeight,zs);c.style.height=`${u}px`,c.style.overflowY=c.scrollHeight>zs?"auto":"hidden"},[dn.value]);const r=qe(Qn.value);M(()=>{if(Qn.value===r.current)return;r.current=Qn.value;const c=e.current;c&&(c.focus(),c.setSelectionRange(c.value.length,c.value.length))},[Qn.value]);function i(c){c.key==="Enter"&&!c.shiftKey&&(c.preventDefault(),t())}function o(){n.current?.click()}function a(c){const u=c.currentTarget;u.files&&u.files.length>0&&Ih(u.files),u.value=""}function l(c){const u=c.target;(u===c.currentTarget||!u.closest("button, textarea, img"))&&e.current?.focus()}return{textareaRef:e,fileInputRef:n,onKeyDown:i,onAttachClick:o,onFilesPicked:a,onCardClick:l}}function Fh({isStreaming:t,disabled:e,inputDisabled:n,onSend:r,onFocus:i}){const o=I(),a=dn,l=kt,{textareaRef:c,fileInputRef:u,onKeyDown:f,onAttachClick:m,onFilesPicked:d,onCardClick:p}=Bh({onSend:r}),x=a.value.trim().length>0,k=l.value.length>0,b=(x||k)&&!e;return s("div",{class:"jex-composer-card",onClick:p,children:[k&&s("div",{class:"jex-composer-attachments",role:"list",children:l.value.map(v=>s("div",{class:"jex-attachment-chip",role:"listitem",children:[s("img",{src:v.previewUrl,alt:v.file.name,class:"jex-attachment-thumb"}),s("button",{type:"button",class:"jex-attachment-remove","aria-label":o.removeAttachmentAriaLabel,onClick:()=>{Ph(v.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"})]})})]},v.id))}),s("textarea",{ref:c,class:"jex-composer-textarea","aria-label":o.inputPlaceholder,placeholder:t?o.aiThinking:o.inputPlaceholder,value:a.value,rows:1,onInput:v=>{a.value=v.currentTarget.value},onKeyDown:f,onFocus:i,disabled:n}),s("div",{class:"jex-composer-actions",children:[s("div",{class:"jex-composer-actions-left",children:[s("input",{ref:u,class:"jex-visually-hidden",type:"file",accept:"image/*",multiple:!0,onChange:d,tabIndex:-1,"aria-hidden":"true"}),s("button",{type:"button",class:"jex-attach-btn","aria-label":o.attachComingSoon,title:o.attachComingSoon,disabled:!0,onClick:m,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"})})}),s("button",{type:"button",class:"jex-attach-btn","aria-label":o.voiceComingSoon,title:o.voiceComingSoon,disabled:!0,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:"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"})]})})]}),s("button",{class:`jex-send-btn${b?" jex-send-btn-active":""}`,type:"button",onClick:r,"aria-label":o.sendAriaLabel,disabled:e||!x&&!k,children:s(Uh,{size:16})})]})]})}const Vh=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim();const Us=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const Hh=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase());const Bs=t=>{const e=Hh(t);return e.charAt(0).toUpperCase()+e.slice(1)};var Wh={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 Qh=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0;return!1};const Gh=({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,children:i,iconNode:o,class:a="",...l})=>Fe("svg",{...Wh,width:String(e),height:e,stroke:t,"stroke-width":r?Number(n)*24/Number(e):n,class:["lucide",a].join(" "),...!i&&!Qh(l)&&{"aria-hidden":"true"},...l},[...o.map(([c,u])=>Fe(c,u)),...at(i)]);const Fs=(t,e)=>{const n=({class:r="",className:i="",children:o,...a})=>Fe(Gh,{...a,iconNode:e,class:Vh(`lucide-${Us(Bs(t))}`,`lucide-${Us(t)}`,r,i)},o);return n.displayName=Bs(t),n};const Xi=Fs("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 Kh=Fs("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function Yh(){const t=I(),e=hn.value;if(!e)return null;const n=e.role==="user"?t.quotedYourMessage:e.authorName;return s("div",{class:"jex-reply-preview",children:[s(Xi,{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,": "]}),Is(e.content)]}),s("button",{type:"button",class:"jex-reply-preview-cancel","aria-label":t.cancelReply,title:t.cancelReply,onClick:()=>{Ji(null)},children:s(Kh,{size:14})})]})}function Vs({variant:t,isOpen:e=!1,onAcknowledge:n}){const r=I(),i=Vn.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 Jh({sessionId:t,visitorId:e,isLoading:n,isStreaming:r,sessionStatus:i,ensureSession:o,onStartFresh:a}){const l=I(),c=dn,u=Oi.value,f=Ds({sessionId:t,visitorId:e,ensureSession:o}),m=Gn.value!==null&&Gn.value>Date.now(),d=n||r||m,p=u==="explicit"&&Kn.value;function x(){Ch();const b=zr.value;zr.value=null,b&&f(b)}if(i==="resolved")return s("div",{class:"jex-chat-input-resolved",children:[s("div",{class:"jex-resolved-notice",children:l.sessionResolved}),s("button",{class:"jex-resolved-new-btn",type:"button",onClick:()=>{a()},children:l.startNewConversation})]});async function k(){const b=c.value.trim();!b||d||await f(b)}return s("div",{class:"jex-chat-input",children:[s(qh,{}),s(zh,{}),u==="chip"&&s(Vs,{variant:"chip"}),s(Yh,{}),s("div",{class:`jex-chat-input-composer-gate${p?" jex-chat-input-composer-gate-open":""}`,children:[s(Fh,{isStreaming:r,disabled:d,inputDisabled:n||r||p,onSend:k,onFocus:Ms}),u==="explicit"&&s(Vs,{variant:"explicit",isOpen:Kn.value,onAcknowledge:x})]})]})}function eo(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Vt=eo();function Hs(t){Vt=t}var Ht={exec:()=>null};function pn(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(Ae.caret,"$1"),n=n.replace(i,a),r},getRegex:()=>new RegExp(n,e)};return r}var Zh=((t="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+t)}catch{return!1}})(),Ae={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:pn(t=>new RegExp(`^ {0,${t}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:pn(t=>new RegExp(`^ {0,${t}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:pn(t=>new RegExp(`^ {0,${t}}(?:\`\`\`|~~~)`)),headingBeginRegex:pn(t=>new RegExp(`^ {0,${t}}#`)),htmlBeginRegex:pn(t=>new RegExp(`^ {0,${t}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:pn(t=>new RegExp(`^ {0,${t}}>`))},Xh=/^(?:[ \t]*(?:\n|$))+/,ef=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,tf=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Jn=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,nf=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,to=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Ws=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Qs=z(Ws).replace(/bull/g,to).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(),rf=z(Ws).replace(/bull/g,to).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(),no=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,of=/^[^\n]+/,ro=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,af=z(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",ro).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),sf=z(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,to).getRegex(),Ur="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",io=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,lf=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",io).replace("tag",Ur).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Gs=z(no).replace("hr",Jn).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",Ur).getRegex(),cf=z(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Gs).getRegex(),oo={blockquote:cf,code:ef,def:af,fences:tf,heading:nf,hr:Jn,html:lf,lheading:Qs,list:sf,newline:Xh,paragraph:Gs,table:Ht,text:of},Ks=z("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Jn).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",Ur).getRegex(),uf={...oo,lheading:rf,table:Ks,paragraph:z(no).replace("hr",Jn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Ks).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",Ur).getRegex()},df={...oo,html:z(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",io).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:Ht,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:z(no).replace("hr",Jn).replace("heading",` *#{1,6} *[^
|
|
11
|
-
]`).replace("lheading",
|
|
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"},ah=[{value:"de",label:"Deutsch",flag:"🇩🇪"},{value:"en",label:"English",flag:"🇬🇧"}],sh="de",lh="jex-locale",ct=B("de"),ch={en:Vi,de:ws};function R(){return ch[ct.value]??Vi}function Hi(t){if(!t)return null;const e=(t.split("-")[0]??"").toLowerCase();return ah.some(r=>r.value===e)?e:null}function ks(t){const e=Hi(t);if(e)return e;try{const n=Hi(localStorage.getItem(lh));if(n)return n}catch{}if(typeof navigator<"u"){const n=Hi(navigator.language);if(n)return n}return sh}function uh(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;i&&(ct.value=ks(i))}return window.addEventListener("message",e),()=>{window.removeEventListener("message",e)}},[t])}const _s="jex-session-history",js=_s,Ss=1440*60*1e3,Ce=B([]),Be=B(null),Rt=B(void 0),Wi=B(!1),Qi=Oi(()=>Ce.value.length>0),fn=B(null),dh="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",hh=6;function fh(){let t="";const e=new Uint8Array(1);for(;t.length<hh;){crypto.getRandomValues(e);const n=e[0]??0;n<252&&(t+=dh[n%36])}return"JEX-"+t}function ph(t){if(t===null)return null;if(typeof t=="number"&&Number.isFinite(t)&&t>=0)return t}function Ts(t,e,n){if(n===null)return t;const r=typeof n=="number"?n:Ss;return t.filter(i=>e-i.lastActivityAt<=r)}function mh(t,e,n,r){return n?Ts(t,e,r):t}function gh(t){try{const e=sessionStorage.getItem(js);if(!e)return Rt.value=void 0,[];const n=JSON.parse(e);if(n.v!==1||!Array.isArray(n.entries))return Rt.value=void 0,[];const r=Object.prototype.hasOwnProperty.call(n,"timeoutMs");return Rt.value=ph(n.timeoutMs),mh(n.entries,t,r,Rt.value)}catch{return Rt.value=void 0,[]}}function Wn(t){try{const e={v:1,entries:t,timeoutMs:Rt.value};sessionStorage.setItem(js,JSON.stringify(e))}catch{}}function xh(){const t=Date.now(),e=gh(t);Ce.value=e,Wn(e),Be.value=e[e.length-1]?.ref??null,Wi.value=!0}function bh(t){Rt.value=t;const e=Date.now(),n=Ts(Ce.value,e,t),r=Be.value!==null&&!n.some(i=>i.ref===Be.value);return Ce.value=n,r&&(Be.value=null),Wn(n),{activeRefPruned:r}}function Cs(){const t=fh(),e=Date.now(),n=[...Ce.value,{ref:t,startedAt:e,lastActivityAt:e}];return Ce.value=n,Be.value=t,Wn(n),t}function As(){Be.value=null}function Rs(t){const e=Date.now(),n=Ce.value.map(r=>r.ref===t?{...r,lastActivityAt:e}:r);Ce.value=n,Be.value=t,Wn(n)}function Gi(t){if(!t)return;const e=Date.now(),n=Ce.value.map(r=>r.ref===t?{...r,lastActivityAt:e}:r);Ce.value=n,Wn(n)}const Le=B(Es());function Es(){return Qi.value?[{id:"home"}]:[{id:"home"},{id:"chat"}]}function yh(){Le.value=Es()}const vh=B("screen");function wt(t){Le.value=[...Le.value,t]}function Ki(){Le.value.length>1&&(Le.value=Le.value.slice(0,-1))}function Yi(t){Le.value=[...Le.value.slice(0,-1),t]}const wh=6e4,Qn=B(!1),Ji=B(!1),Zi=new Set;function kh(t){return Zi.add(t),()=>{Zi.delete(t)}}function _h(){const t=Be.value;return t?Ce.value.find(n=>n.ref===t)?.lastActivityAt??null:null}function Is(t){const e=_h();return e===null?!1:Date.now()-e>t}function Xi(){if(!(Qn.value&&Ce.value.length===0)){Ce.value=[],Be.value=null;try{sessionStorage.removeItem(_s)}catch(t){ne.warn("[JexityChat] Idle-lock storage clear failed:",t)}for(const t of Zi)try{t()}catch(e){ne.warn("[JexityChat] Lock reset callback threw:",e)}Le.value=[{id:"home"}],Qn.value=!0}}function Lr(){Qn.value&&(Qn.value=!1)}function jh(t=Ss){let e=document.visibilityState==="hidden"?Date.now():null;const n=()=>{if(document.visibilityState==="hidden"){e=Date.now();return}(e!==null&&Date.now()-e>t||Is(t))&&Xi(),e=null};document.addEventListener("visibilitychange",n);const r=setInterval(()=>{Ji.value||Is(t)&&Xi()},wh);return()=>{document.removeEventListener("visibilitychange",n),clearInterval(r),e=null}}function Sh(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 $r({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 Th(){const t=R();return Le.value.length>1?s("button",{class:"jex-header-back",onClick:Ki,"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($r,{size:24})}function Ch({title:t}){return s("div",{class:"jex-header-info",children:s("h3",{children:t})})}function Ps({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 Ah(){const t=R();return s("button",{class:"jex-header-close",type:"button",onClick:()=>{ae.value=!1},"aria-label":t.closeChatAriaLabel,title:t.closeChatAriaLabel,children:s(Ps,{size:18})})}function Rh({action:t,showClose:e=!0}){return!t&&!e?null:s("div",{class:"jex-header-right",children:[t,e&&s(Ah,{})]})}function Ns({title:t,rightAction:e,showClose:n=!0}){return s("header",{class:"jex-chat-header",children:[s(Th,{}),s(Ch,{title:t}),s(Rh,{action:e,showClose:n})]})}function Eh({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 Ms(){return s("div",{class:"jex-widget-footer",children:s("a",{href:"https://jexitychat.de",target:"_blank",rel:"noopener noreferrer",class:"jex-branding",children:[s(Eh,{size:14}),s("span",{children:["Powered by ",s("strong",{children:"Jexity"})]})]})})}function Os({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 Ih({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 Ph={chat:s(Os,{size:28}),bot:s($r,{size:28}),sparkles:s(Ih,{size:28})},Nh={none:"0px",sm:"0.5rem",md:"0.75rem",lg:"1.25rem",full:"9999px"};function Mh({radius:t="full",iconOption:e="chat",label:n}){const r=R(),i=n??r.fabLabel,o=i!=="";return s("button",{class:`jex-floating-button${ae.value?"":" jex-fab-pulse"}${!ae.value&&o?" jex-has-label":""}`,style:{borderRadius:Nh[t]??"9999px"},onClick:()=>{ae.value=!ae.value},"aria-label":ae.value?r.closeChatAriaLabel:r.openChatAriaLabel,children:ae.value?s(Ps,{size:28}):s("div",{class:"jex-fab-inner",children:[Ph[e],o&&s("span",{class:"jex-fab-label",children:i})]})})}const Dr=B(!1);function Oh(t,e){return e?`jex-proactive-dismissed:${t}:${e}`:`jex-proactive-dismissed:${t}`}function Ls(t){try{return sessionStorage.getItem(t)!==null}catch{return!1}}function Lh(t){try{sessionStorage.setItem(t,"1")}catch{}}function $h(t){return t.isOpen||t.mode==="off"||t.hasHistory||t.dismissed?"skip":t.mode==="teaser"?"teaser":"open"}function Dh({title:t,message:e,guardKey:n}){const r=R();function i(){Dr.value=!1,ae.value=!0}function o(a){a.stopPropagation(),Lh(n),Dr.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($r,{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 pn=B(""),Gn=B(0),mn=B(null);function eo(t){mn.value=t,t&&(Gn.value+=1)}const $s=100;function Ds(t){const e=t.replace(/\s+/g," ").trim();return e.length>$s?`${e.slice(0,$s)}…`:e}const Kn=B(null),to=B(Date.now()),qr=B(!1),no=B(!1),Yn=B(!1),zr=B(null);function qs(){return $i.value==="explicit"&&!no.value}function zs(){qs()&&(Yn.value=!0)}function qh(){no.value=!0,Yn.value=!1}function Us(){no.value=!1,Yn.value=!1,zr.value=null}const kt=B([]),zh=4,Uh=8*1024*1024;function Bh(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`att-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,11)}`}function Fh(t){const e=Array.from(t).filter(i=>i.type.startsWith("image/")&&i.size<=Uh);if(e.length===0)return;const n=zh-kt.value.length;if(n<=0)return;const r=e.slice(0,n).map(i=>({id:Bh(),file:i,previewUrl:URL.createObjectURL(i)}));kt.value=[...kt.value,...r]}function Vh(t){const e=kt.value.find(n=>n.id===t);e&&URL.revokeObjectURL(e.previewUrl),kt.value=kt.value.filter(n=>n.id!==t)}function Hh(){for(const t of kt.value)URL.revokeObjectURL(t.previewUrl);kt.value=[]}function Bs(t){if(typeof t!="object"||t===null)return!1;const e=t.data;return typeof e!="object"||e===null?!1:e.kind==="maintenance"}const Et=B(null),Jn=B(null);function Fs(){Jn.value=null}function Vs({sessionId:t,visitorId:e,ensureSession:n}){const r=Bt(ke.functions.chat.public.conversations.send);return async function(o){if(qs()){zr.value=o,zs();return}if(!qr.value){qr.value=!0;try{const a=t&&e?{sessionId:t,visitorId:e}:await n();if(!a)return;const l=mn.value?.id;pn.value="",mn.value=null,Hh();try{const c=await r({sessionId:a.sessionId,visitorId:a.visitorId,content:o,...l!==void 0?{replyToId:l}:{},...typeof window<"u"?{pagePath:window.location.pathname}:{}});c.ok?Gi(a.visitorId):c.reason==="rate_limited"&&(Kn.value=Date.now()+c.retryAfterMs)}catch(c){ne.error("[jexity] Failed to send message:",c),Bs(c)&&(Et.value="maintenance"),pn.value.trim()||(pn.value=o)}}finally{qr.value=!1}}}}function Wh(){const t=Kn.value,e=to.value;M(()=>{if(t===null)return;const i=setInterval(()=>{to.value=Date.now()},1e3),o=setTimeout(()=>{Kn.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 Qh(){const t=R(),{isActive:e,remainingSeconds:n}=Wh();return e?s("div",{class:"jex-rate-limit-notice",role:"status","aria-live":"polite",children:t.errorRateLimited.replace("{seconds}",String(n))}):null}function Gh(t,e){return t??(e?"maintenance":null)}function Kh({maintenance:t=!1}={}){const e=R(),n=Gh(Et.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 Yh({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 Hs=132;function Jh({onSend:t}){const e=Ne(null),n=Ne(null);M(()=>{const c=e.current;if(!c)return;c.style.height="0";const u=Math.min(c.scrollHeight,Hs);c.style.height=`${u}px`,c.style.overflowY=c.scrollHeight>Hs?"auto":"hidden"},[pn.value]);const r=Ne(Gn.value);M(()=>{if(Gn.value===r.current)return;r.current=Gn.value;const c=e.current;c&&(c.focus(),c.setSelectionRange(c.value.length,c.value.length))},[Gn.value]);function i(c){c.key==="Enter"&&!c.shiftKey&&(c.preventDefault(),t())}function o(){n.current?.click()}function a(c){const u=c.currentTarget;u.files&&u.files.length>0&&Fh(u.files),u.value=""}function l(c){const u=c.target;(u===c.currentTarget||!u.closest("button, textarea, img"))&&e.current?.focus()}return{textareaRef:e,fileInputRef:n,onKeyDown:i,onAttachClick:o,onFilesPicked:a,onCardClick:l}}function Zh({isStreaming:t,disabled:e,inputDisabled:n,onSend:r,onFocus:i}){const o=R(),a=pn,l=kt,{textareaRef:c,fileInputRef:u,onKeyDown:h,onAttachClick:m,onFilesPicked:d,onCardClick:p}=Jh({onSend:r}),b=a.value.trim().length>0,S=l.value.length>0,y=(b||S)&&!e;return s("div",{class:"jex-composer-card",onClick:p,children:[S&&s("div",{class:"jex-composer-attachments",role:"list",children:l.value.map(x=>s("div",{class:"jex-attachment-chip",role:"listitem",children:[s("img",{src:x.previewUrl,alt:x.file.name,class:"jex-attachment-thumb"}),s("button",{type:"button",class:"jex-attachment-remove","aria-label":o.removeAttachmentAriaLabel,onClick:()=>{Vh(x.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"})]})})]},x.id))}),s("textarea",{ref:c,class:"jex-composer-textarea","aria-label":o.inputPlaceholder,placeholder:t?o.aiThinking:o.inputPlaceholder,value:a.value,rows:1,onInput:x=>{a.value=x.currentTarget.value},onKeyDown:h,onFocus:i,disabled:n}),s("div",{class:"jex-composer-actions",children:[s("div",{class:"jex-composer-actions-left",children:[s("input",{ref:u,class:"jex-visually-hidden",type:"file",accept:"image/*",multiple:!0,onChange:d,tabIndex:-1,"aria-hidden":"true"}),s("button",{type:"button",class:"jex-attach-btn","aria-label":o.attachComingSoon,title:o.attachComingSoon,disabled:!0,onClick:m,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"})})}),s("button",{type:"button",class:"jex-attach-btn","aria-label":o.voiceComingSoon,title:o.voiceComingSoon,disabled:!0,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:"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"})]})})]}),s("button",{class:`jex-send-btn${y?" jex-send-btn-active":""}`,type:"button",onClick:r,"aria-label":o.sendAriaLabel,disabled:e||!b&&!S,children:s(Yh,{size:16})})]})]})}const Xh=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim();const Ws=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const ef=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase());const Qs=t=>{const e=ef(t);return e.charAt(0).toUpperCase()+e.slice(1)};var tf={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 nf=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0;return!1};const rf=({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,children:i,iconNode:o,class:a="",...l})=>Ve("svg",{...tf,width:String(e),height:e,stroke:t,"stroke-width":r?Number(n)*24/Number(e):n,class:["lucide",a].join(" "),...!i&&!nf(l)&&{"aria-hidden":"true"},...l},[...o.map(([c,u])=>Ve(c,u)),...ot(i)]);const Gs=(t,e)=>{const n=({class:r="",className:i="",children:o,...a})=>Ve(rf,{...a,iconNode:e,class:Xh(`lucide-${Ws(Qs(t))}`,`lucide-${Ws(t)}`,r,i)},o);return n.displayName=Qs(t),n};const ro=Gs("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 of=Gs("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function af(){const t=R(),e=mn.value;if(!e)return null;const n=e.role==="user"?t.quotedYourMessage:e.authorName;return s("div",{class:"jex-reply-preview",children:[s(ro,{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,": "]}),Ds(e.content)]}),s("button",{type:"button",class:"jex-reply-preview-cancel","aria-label":t.cancelReply,title:t.cancelReply,onClick:()=>{eo(null)},children:s(of,{size:14})})]})}function Ks({variant:t,isOpen:e=!1,onAcknowledge:n}){const r=R(),i=Hn.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 sf({sessionId:t,visitorId:e,isLoading:n,isStreaming:r,sessionStatus:i,ensureSession:o,onStartFresh:a,maintenance:l=!1}){const c=R(),u=pn,h=$i.value,m=Vs({sessionId:t,visitorId:e,ensureSession:o}),d=Kn.value!==null&&Kn.value>to.value,p=n||r||d||l,b=h==="explicit"&&Yn.value;function S(){qh();const x=zr.value;zr.value=null,x&&m(x)}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 y(){const x=u.value.trim();!x||p||await m(x)}return s("div",{class:"jex-chat-input",children:[s(Qh,{}),s(Kh,{maintenance:l}),h==="chip"&&s(Ks,{variant:"chip"}),s(af,{}),s("div",{class:`jex-chat-input-composer-gate${b?" jex-chat-input-composer-gate-open":""}`,children:[s(Zh,{isStreaming:r,disabled:p,inputDisabled:n||r||b||l,onSend:y,onFocus:zs}),h==="explicit"&&s(Ks,{variant:"explicit",isOpen:Yn.value,onAcknowledge:S})]})]})}function io(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Vt=io();function Ys(t){Vt=t}var Ht={exec:()=>null};function gn(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 F(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(Ae.caret,"$1"),n=n.replace(i,a),r},getRegex:()=>new RegExp(n,e)};return r}var lf=((t="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+t)}catch{return!1}})(),Ae={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:gn(t=>new RegExp(`^ {0,${t}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:gn(t=>new RegExp(`^ {0,${t}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:gn(t=>new RegExp(`^ {0,${t}}(?:\`\`\`|~~~)`)),headingBeginRegex:gn(t=>new RegExp(`^ {0,${t}}#`)),htmlBeginRegex:gn(t=>new RegExp(`^ {0,${t}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:gn(t=>new RegExp(`^ {0,${t}}>`))},cf=/^(?:[ \t]*(?:\n|$))+/,uf=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,df=/^ {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+|$)/,hf=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,oo=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Js=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Zs=F(Js).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(),ff=F(Js).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(),ao=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,pf=/^[^\n]+/,so=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,mf=F(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",so).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),gf=F(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,oo).getRegex(),Ur="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",lo=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,xf=F("^ {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",lo).replace("tag",Ur).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Xs=F(ao).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",Ur).getRegex(),bf=F(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Xs).getRegex(),co={blockquote:bf,code:uf,def:mf,fences:df,heading:hf,hr:Zn,html:xf,lheading:Zs,list:gf,newline:cf,paragraph:Xs,table:Ht,text:pf},el=F("^ *([^\\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",Ur).getRegex(),yf={...co,lheading:ff,table:el,paragraph:F(ao).replace("hr",Zn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",el).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",Ur).getRegex()},vf={...co,html:F(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",lo).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:Ht,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:F(ao).replace("hr",Zn).replace("heading",` *#{1,6} *[^
|
|
15
|
+
]`).replace("lheading",Zs).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},wf=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,kf=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,tl=/^( {2,}|\\)\n(?!\s*$)/,_f=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,xn=/[\p{P}\p{S}]/u,Br=/[\s\p{P}\p{S}]/u,uo=/[^\s\p{P}\p{S}]/u,jf=F(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Br).getRegex(),nl=/(?!~)[\p{P}\p{S}]/u,Sf=/(?!~)[\s\p{P}\p{S}]/u,Tf=/(?:[^\s\p{P}\p{S}]|~)/u,Cf=F(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",lf?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),rl=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Af=F(rl,"u").replace(/punct/g,xn).getRegex(),Rf=F(rl,"u").replace(/punct/g,nl).getRegex(),il="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Ef=F(il,"gu").replace(/notPunctSpace/g,uo).replace(/punctSpace/g,Br).replace(/punct/g,xn).getRegex(),If=F(il,"gu").replace(/notPunctSpace/g,Tf).replace(/punctSpace/g,Sf).replace(/punct/g,nl).getRegex(),Pf=F("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,uo).replace(/punctSpace/g,Br).replace(/punct/g,xn).getRegex(),Nf=F(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,xn).getRegex(),Mf="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Of=F(Mf,"gu").replace(/notPunctSpace/g,uo).replace(/punctSpace/g,Br).replace(/punct/g,xn).getRegex(),Lf=F(/\\(punct)/,"gu").replace(/punct/g,xn).getRegex(),$f=F(/^<(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(),Df=F(lo).replace("(?:-->|$)","-->").getRegex(),qf=F("^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",Df).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Fr=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,zf=F(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Fr).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),ol=F(/^!?\[(label)\]\[(ref)\]/).replace("label",Fr).replace("ref",so).getRegex(),al=F(/^!?\[(ref)\](?:\[\])?/).replace("ref",so).getRegex(),Uf=F("reflink|nolink(?!\\()","g").replace("reflink",ol).replace("nolink",al).getRegex(),sl=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,ho={_backpedal:Ht,anyPunctuation:Lf,autolink:$f,blockSkip:Cf,br:tl,code:kf,del:Ht,delLDelim:Ht,delRDelim:Ht,emStrongLDelim:Af,emStrongRDelimAst:Ef,emStrongRDelimUnd:Pf,escape:wf,link:zf,nolink:al,punctuation:jf,reflink:ol,reflinkSearch:Uf,tag:qf,text:_f,url:Ht},Bf={...ho,link:F(/^!?\[(label)\]\((.*?)\)/).replace("label",Fr).getRegex(),reflink:F(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Fr).getRegex()},fo={...ho,emStrongRDelimAst:If,emStrongLDelim:Rf,delLDelim:Nf,delRDelim:Of,url:F(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",sl).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:F(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",sl).getRegex()},Ff={...fo,br:F(tl).replace("{2,}","*").getRegex(),text:F(fo.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Vr={normal:co,gfm:yf,pedantic:vf},Xn={normal:ho,gfm:fo,breaks:Ff,pedantic:Bf},Vf={"&":"&","<":"<",">":">",'"':""","'":"'"},ll=t=>Vf[t];function ut(t,e){if(e){if(Ae.escapeTest.test(t))return t.replace(Ae.escapeReplace,ll)}else if(Ae.escapeTestNoEncode.test(t))return t.replace(Ae.escapeReplaceNoEncode,ll);return t}function cl(t){try{t=encodeURI(t).replace(Ae.percentDecode,"%")}catch{return null}return t}function ul(t,e){let n=t.replace(Ae.findPipe,(o,a,l)=>{let c=!1,u=a;for(;--u>=0&&l[u]==="\\";)c=!c;return c?"|":" |"}),r=n.split(Ae.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(Ae.slashPipe,"|");return r}function It(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 dl(t){let e=t.split(`
|
|
12
16
|
`),n=e.length-1;for(;n>=0&&Ae.blankLine.test(e[n]);)n--;return e.length-n<=2?t:e.slice(0,n+1).join(`
|
|
13
|
-
`)}function
|
|
17
|
+
`)}function Hf(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 Wf(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 hl(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 Qf(t,e,n){let r=t.match(n.other.indentCodeCompensation);if(r===null)return e;let i=r[1];return e.split(`
|
|
14
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(`
|
|
15
|
-
`)}var Hr=class{options;rules;lexer;constructor(t){this.options=t||Vt}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]:
|
|
19
|
+
`)}var Hr=class{options;rules;lexer;constructor(t){this.options=t||Vt}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]:dl(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=Qf(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=It(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:It(e[0],`
|
|
16
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:It(e[0],`
|
|
17
21
|
`)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let n=It(e[0],`
|
|
18
22
|
`).split(`
|
|
19
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(`
|
|
20
|
-
`),
|
|
24
|
+
`),h=u.replace(this.rules.other.blockquoteSetextReplace,`
|
|
21
25
|
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
|
|
22
26
|
${u}`:u,i=i?`${i}
|
|
23
|
-
${
|
|
27
|
+
${h}`:h;let m=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(h,o,!0),this.lexer.state.top=m,n.length===0)break;let d=o.at(-1);if(d?.type==="code")break;if(d?.type==="blockquote"){let p=d,b=p.raw+`
|
|
24
28
|
`+n.join(`
|
|
25
|
-
`),
|
|
29
|
+
`),S=this.blockquote(b);o[o.length-1]=S,r=r.substring(0,r.length-p.raw.length)+S.raw,i=i.substring(0,i.length-p.text.length)+S.text;break}else if(d?.type==="list"){let p=d,b=p.raw+`
|
|
26
30
|
`+n.join(`
|
|
27
|
-
`),
|
|
28
|
-
`);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="",
|
|
31
|
+
`),S=this.list(b);o[o.length-1]=S,r=r.substring(0,r.length-d.raw.length)+S.raw,i=i.substring(0,i.length-p.raw.length)+S.raw,n=b.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="",h="";if(!(e=o.exec(t))||this.rules.block.hr.test(t))break;u=e[0],t=t.substring(u.length);let m=Wf(e[2].split(`
|
|
29
33
|
`,1)[0],e[1].length),d=t.split(`
|
|
30
|
-
`,1)[0],p=!m.trim(),
|
|
31
|
-
`,t=t.substring(d.length+1),c=!0),!c){let
|
|
32
|
-
`,1)[0],
|
|
33
|
-
`+
|
|
34
|
-
`+d}p=!d.trim(),u+=
|
|
35
|
-
`,t=t.substring(
|
|
36
|
-
`),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=
|
|
34
|
+
`,1)[0],p=!m.trim(),b=0;if(this.options.pedantic?(b=2,h=m.trimStart()):p?b=e[1].length+1:(b=m.search(this.rules.other.nonSpaceChar),b=b>4?1:b,h=m.slice(b),b+=e[1].length),p&&this.rules.other.blankLine.test(d)&&(u+=d+`
|
|
35
|
+
`,t=t.substring(d.length+1),c=!0),!c){let S=this.rules.other.nextBulletRegex(b),y=this.rules.other.hrRegex(b),x=this.rules.other.fencesBeginRegex(b),k=this.rules.other.headingBeginRegex(b),A=this.rules.other.htmlBeginRegex(b),N=this.rules.other.blockquoteBeginRegex(b);for(;t;){let P=t.split(`
|
|
36
|
+
`,1)[0],I;if(d=P,this.options.pedantic?(d=d.replace(this.rules.other.listReplaceNesting," "),I=d):I=d.replace(this.rules.other.tabCharGlobal," "),x.test(d)||k.test(d)||A.test(d)||N.test(d)||S.test(d)||y.test(d))break;if(I.search(this.rules.other.nonSpaceChar)>=b||!d.trim())h+=`
|
|
37
|
+
`+I.slice(b);else{if(p||m.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||x.test(m)||k.test(m)||y.test(m))break;h+=`
|
|
38
|
+
`+d}p=!d.trim(),u+=P+`
|
|
39
|
+
`,t=t.substring(P.length+1),m=I.slice(b)}}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(h),loose:!1,text:h,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 h=this.rules.other.listTaskCheckbox.exec(c.raw);if(h){let m={type:"checkbox",raw:h[0]+" ",checked:h[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 h=c.tokens.filter(d=>d.type==="space"),m=h.length>0&&h.some(d=>this.rules.other.anyLine.test(d.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=dl(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:It(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=ul(e[1]),r=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
37
41
|
`):[],o={type:"table",raw:It(e[0],`
|
|
38
|
-
`),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(
|
|
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(ul(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:It(e[0],`
|
|
39
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)===`
|
|
40
|
-
`?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=It(n.slice(0,-1),"\\");if((n.length-o.length)%2===0)return}else{let o=
|
|
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=It(n.slice(0,-1),"\\");if((n.length-o.length)%2===0)return}else{let o=Hf(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)),hl(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 hl(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 h=[...r[0]][0].length,m=t.slice(0,i+r.index+h+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 d=m.slice(2,-2);return{type:"strong",raw:m,text:d,tokens:this.lexer.inlineTokens(d)}}}}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,h=t.slice(0,i+r.index+u+a),m=h.slice(i,-i);return{type:"del",raw:h,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}}}},Ze=class Oo{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Vt,this.options.tokenizer=this.options.tokenizer||new Hr,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:Ae,block:Vr.normal,inline:Xn.normal};this.options.pedantic?(n.block=Vr.pedantic,n.inline=Xn.pedantic):this.options.gfm&&(n.block=Vr.gfm,this.options.breaks?n.inline=Xn.breaks:n.inline=Xn.gfm),this.tokenizer.rules=n}static get rules(){return{block:Vr,inline:Xn}}static lex(e,n){return new Oo(n).lex(e)}static lexInline(e,n){return new Oo(n).inlineTokens(e)}lex(e){e=e.replace(Ae.carriageReturn,`
|
|
41
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(Ae.tabCharGlobal," ").replace(Ae.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+=`
|
|
42
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(`
|
|
43
47
|
`)?"":`
|
|
@@ -45,15 +49,15 @@ ${f}`:f;let m=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
|
|
|
45
49
|
`+o.text,this.inlineQueue.at(-1).src=l.text):n.push(o);continue}if(o=this.tokenizer.fences(e)){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.heading(e)){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.hr(e)){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.blockquote(e)){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.list(e)){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.html(e)){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.def(e)){e=e.substring(o.raw.length);let l=n.at(-1);l?.type==="paragraph"||l?.type==="text"?(l.raw+=(l.raw.endsWith(`
|
|
46
50
|
`)?"":`
|
|
47
51
|
`)+o.raw,l.text+=`
|
|
48
|
-
`+o.raw,this.inlineQueue.at(-1).src=l.text):this.tokens.links[o.tag]||(this.tokens.links[o.tag]={href:o.href,title:o.title},n.push(o));continue}if(o=this.tokenizer.table(e)){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.lheading(e)){e=e.substring(o.raw.length),n.push(o);continue}let a=e;if(this.options.extensions?.startBlock){let l=1/0,c=e.slice(1),u;this.options.extensions.startBlock.forEach(
|
|
52
|
+
`+o.raw,this.inlineQueue.at(-1).src=l.text):this.tokens.links[o.tag]||(this.tokens.links[o.tag]={href:o.href,title:o.title},n.push(o));continue}if(o=this.tokenizer.table(e)){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.lheading(e)){e=e.substring(o.raw.length),n.push(o);continue}let a=e;if(this.options.extensions?.startBlock){let l=1/0,c=e.slice(1),u;this.options.extensions.startBlock.forEach(h=>{u=h.call({lexer:this},c),typeof u=="number"&&u>=0&&(l=Math.min(l,u))}),l<1/0&&l>=0&&(a=e.substring(0,l+1))}if(this.state.top&&(o=this.tokenizer.paragraph(a))){let l=n.at(-1);r&&l?.type==="paragraph"?(l.raw+=(l.raw.endsWith(`
|
|
49
53
|
`)?"":`
|
|
50
54
|
`)+o.raw,l.text+=`
|
|
51
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(`
|
|
52
56
|
`)?"":`
|
|
53
57
|
`)+o.raw,l.text+=`
|
|
54
|
-
`+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
|
|
55
|
-
`;return r?'<pre><code class="language-'+
|
|
56
|
-
`:"<pre><code>"+(n?i:
|
|
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 h=e;if(this.options.extensions?.startInline){let m=1/0,d=e.slice(1),p;this.options.extensions.startInline.forEach(b=>{p=b.call({lexer:this},d),typeof p=="number"&&p>=0&&(m=Math.min(m,p))}),m<1/0&&m>=0&&(h=e.substring(0,m+1))}if(u=this.tokenizer.inlineText(h)){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)}},Wr=class{options;parser;constructor(t){this.options=t||Vt}space(t){return""}code({text:t,lang:e,escaped:n}){let r=(e||"").match(Ae.notSpaceStart)?.[0],i=t.replace(Ae.endingNewline,"")+`
|
|
59
|
+
`;return r?'<pre><code class="language-'+ut(r)+'">'+(n?i:ut(i,!0))+`</code></pre>
|
|
60
|
+
`:"<pre><code>"+(n?i:ut(i,!0))+`</code></pre>
|
|
57
61
|
`}blockquote({tokens:t}){return`<blockquote>
|
|
58
62
|
${this.parser.parse(t)}</blockquote>
|
|
59
63
|
`}html({text:t}){return t}def(t){return""}heading({tokens:t,depth:e}){return`<h${e}>${this.parser.parseInline(t)}</h${e}>
|
|
@@ -69,12 +73,12 @@ ${this.parser.parse(t)}</blockquote>
|
|
|
69
73
|
`}tablerow({text:t}){return`<tr>
|
|
70
74
|
${t}</tr>
|
|
71
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}>
|
|
72
|
-
`}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>${
|
|
73
|
-
Please report this to https://github.com/markedjs/marked.`,t){let r="<p>An error occurred:</p><pre>"+
|
|
74
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ff(t,e){return zf(t)||Uf(t,e)||Vf(t,e)||Bf()}function Vf(t,e){if(t){if(typeof t=="string")return ll(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)?ll(t,e):void 0}}const cl=Object.entries,ul=Object.setPrototypeOf,Hf=Object.isFrozen,Wf=Object.getPrototypeOf,Qf=Object.getOwnPropertyDescriptor;let ke=Object.freeze,_e=Object.seal,gn=Object.create,dl=typeof Reflect<"u"&&Reflect,uo=dl.apply,ho=dl.construct;ke||(ke=function(e){return e}),_e||(_e=function(e){return e}),uo||(uo=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 er=ge(Array.prototype.forEach),Gf=ge(Array.prototype.lastIndexOf),hl=ge(Array.prototype.pop),xn=ge(Array.prototype.push),Kf=ge(Array.prototype.splice),Pt=Array.isArray,tr=ge(String.prototype.toLowerCase),fo=ge(String.prototype.toString),fl=ge(String.prototype.match),nr=ge(String.prototype.replace),pl=ge(String.prototype.indexOf),Yf=ge(String.prototype.trim),Jf=ge(Number.prototype.toString),Zf=ge(Boolean.prototype.toString),ml=typeof BigInt>"u"?null:ge(BigInt.prototype.toString),gl=typeof Symbol>"u"?null:ge(Symbol.prototype.toString),ye=ge(Object.prototype.hasOwnProperty),rr=ge(Object.prototype.toString),je=ge(RegExp.prototype.test),Qt=Xf(TypeError);function ge(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 uo(t,e,r)}}function Xf(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 U(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:tr;if(ul&&ul(t,null),!Pt(e))return t;let r=e.length;for(;r--;){let i=e[r];if(typeof i=="string"){const o=n(i);o!==i&&(Hf(e)||(e[r]=o),i=o)}t[i]=!0}return t}function ep(t){for(let e=0;e<t.length;e++)ye(t,e)||(t[e]=null);return t}function Ee(t){const e=gn(null);for(const r of cl(t)){var n=Ff(r,2);const i=n[0],o=n[1];ye(t,i)&&(Pt(o)?e[i]=ep(o):o&&typeof o=="object"&&o.constructor===Object?e[i]=Ee(o):e[i]=o)}return e}function tp(t){switch(typeof t){case"string":return t;case"number":return Jf(t);case"boolean":return Zf(t);case"bigint":return ml?ml(t):"0";case"symbol":return gl?gl(t):"Symbol()";case"undefined":return rr(t);case"function":case"object":{if(t===null)return rr(t);const e=t,n=ht(e,"toString");if(typeof n=="function"){const r=n(e);return typeof r=="string"?r:rr(r)}return rr(t)}default:return rr(t)}}function ht(t,e){for(;t!==null;){const r=Qf(t,e);if(r){if(r.get)return ge(r.get);if(typeof r.value=="function")return ge(r.value)}t=Wf(t)}function n(){return null}return n}function np(t){try{return je(t,""),!0}catch{return!1}}const xl=ke(["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"]),po=ke(["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"]),mo=ke(["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"]),rp=ke(["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"]),go=ke(["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"]),ip=ke(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),bl=ke(["#text"]),yl=ke(["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=ke(["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"]),vl=ke(["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"]),Qr=ke(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),op=_e(/{{[\w\W]*|^[\w\W]*}}/g),ap=_e(/<%[\w\W]*|^[\w\W]*%>/g),sp=_e(/\${[\w\W]*/g),lp=_e(/^data-[\-\w.\u00B7-\uFFFF]+$/),cp=_e(/^aria-[\-\w]+$/),wl=_e(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),up=_e(/^(?:\w+script|data):/i),dp=_e(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),hp=_e(/^html$/i),fp=_e(/^[a-z][.\w]*(-[.\w]+)+$/i),kl=_e(/<[/\w!]/g),pp=_e(/<[/\w]/g),mp=_e(/<\/no(script|embed|frames)/i),gp=_e(/\/>/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},xp=function(){return typeof window>"u"?null:window},bp=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}},_l=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Nt=function(e,n,r,i){return ye(e,n)&&Pt(e[n])?U(i.base?Ee(i.base):{},e[n],i.transform):r};function jl(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:xp();const e=j=>jl(j);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 f=t.DOMParser,m=t.trustedTypes,d=l.prototype,p=ht(d,"cloneNode"),x=ht(d,"remove"),k=ht(d,"nextSibling"),b=ht(d,"childNodes"),v=ht(d,"parentNode"),w=ht(d,"shadowRoot"),R=ht(d,"attributes"),y=a&&a.prototype?ht(a.prototype,"nodeType"):null,E=a&&a.prototype?ht(a.prototype,"nodeName"):null;if(typeof o=="function"){const j=n.createElement("template");j.content&&j.content.ownerDocument&&(n=j.content.ownerDocument)}let N,L="",Y,ue=!1,W=0;const de=function(){if(W>0)throw Qt('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.')},ae=function(h){de(),W++;try{return N.createHTML(h)}finally{W--}},S=function(h){de(),W++;try{return N.createScriptURL(h)}finally{W--}},X=function(){return ue||(Y=bp(m,i),ue=!0),Y},Ue=n,tt=Ue.implementation,mt=Ue.createNodeIterator,Lt=Ue.createDocumentFragment,_t=Ue.getElementsByTagName,Gt=r.importNode;let J=_l();e.isSupported=typeof cl=="function"&&typeof v=="function"&&tt&&tt.createHTMLDocument!==void 0;const We=op,se=ap,D=sp,Le=lp,nt=cp,Kt=up,be=dp,Qe=fp;let Se=wl,K=null;const T=U({},[...xl,...po,...mo,...go,...bl]);let C=null;const Ge=U({},[...yl,...xo,...vl,...Qr]);let Q=Object.seal(gn(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}})),jt=null,ee=null;const Ie=Object.seal(gn(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Be=!0,yn=!0,Yr=!1,Jr=!0,gt=!1,Yt=!0,St=!1,ar=!1,sr=null,lr=null,vn=!1,$t=!1,wn=!1,kn=!1,V=!0,$=!1;const le="user-content-";let rt=!0,he=!1,$e={},Ke=null;const cr=U({},["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 ec=null;const tc=U({},["audio","video","img","source","image","track"]);let ko=null;const nc=U({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Zr="http://www.w3.org/1998/Math/MathML",Xr="http://www.w3.org/2000/svg",xt="http://www.w3.org/1999/xhtml";let _n=xt,_o=!1,jo=null;const mg=U({},[Zr,Xr,xt],fo),rc=ke(["mi","mo","mn","ms","mtext"]);let So=U({},rc);const ic=ke(["annotation-xml"]);let To=U({},ic);const gg=U({},["title","style","font","a","script"]);let ur=null;const xg=["application/xhtml+xml","text/html"],bg="text/html";let ce=null,jn=null;const yg=n.createElement("form"),oc=function(h){return h instanceof RegExp||h instanceof Function},Co=function(){let h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(jn&&jn===h)return;(!h||typeof h!="object")&&(h={}),h=Ee(h),ur=xg.indexOf(h.PARSER_MEDIA_TYPE)===-1?bg:h.PARSER_MEDIA_TYPE,ce=ur==="application/xhtml+xml"?fo:tr,K=Nt(h,"ALLOWED_TAGS",T,{transform:ce}),C=Nt(h,"ALLOWED_ATTR",Ge,{transform:ce}),jo=Nt(h,"ALLOWED_NAMESPACES",mg,{transform:fo}),ko=Nt(h,"ADD_URI_SAFE_ATTR",nc,{transform:ce,base:nc}),ec=Nt(h,"ADD_DATA_URI_TAGS",tc,{transform:ce,base:tc}),Ke=Nt(h,"FORBID_CONTENTS",cr,{transform:ce}),jt=Nt(h,"FORBID_TAGS",Ee({}),{transform:ce}),ee=Nt(h,"FORBID_ATTR",Ee({}),{transform:ce}),$e=ye(h,"USE_PROFILES")?h.USE_PROFILES&&typeof h.USE_PROFILES=="object"?Ee(h.USE_PROFILES):h.USE_PROFILES:!1,Be=h.ALLOW_ARIA_ATTR!==!1,yn=h.ALLOW_DATA_ATTR!==!1,Yr=h.ALLOW_UNKNOWN_PROTOCOLS||!1,Jr=h.ALLOW_SELF_CLOSE_IN_ATTR!==!1,gt=h.SAFE_FOR_TEMPLATES||!1,Yt=h.SAFE_FOR_XML!==!1,St=h.WHOLE_DOCUMENT||!1,$t=h.RETURN_DOM||!1,wn=h.RETURN_DOM_FRAGMENT||!1,kn=h.RETURN_TRUSTED_TYPE||!1,vn=h.FORCE_BODY||!1,V=h.SANITIZE_DOM!==!1,$=h.SANITIZE_NAMED_PROPS||!1,rt=h.KEEP_CONTENT!==!1,he=h.IN_PLACE||!1,Se=np(h.ALLOWED_URI_REGEXP)?h.ALLOWED_URI_REGEXP:wl,_n=typeof h.NAMESPACE=="string"?h.NAMESPACE:xt,So=ye(h,"MATHML_TEXT_INTEGRATION_POINTS")&&h.MATHML_TEXT_INTEGRATION_POINTS&&typeof h.MATHML_TEXT_INTEGRATION_POINTS=="object"?Ee(h.MATHML_TEXT_INTEGRATION_POINTS):U({},rc),To=ye(h,"HTML_INTEGRATION_POINTS")&&h.HTML_INTEGRATION_POINTS&&typeof h.HTML_INTEGRATION_POINTS=="object"?Ee(h.HTML_INTEGRATION_POINTS):U({},ic);const g=ye(h,"CUSTOM_ELEMENT_HANDLING")&&h.CUSTOM_ELEMENT_HANDLING&&typeof h.CUSTOM_ELEMENT_HANDLING=="object"?Ee(h.CUSTOM_ELEMENT_HANDLING):gn(null);if(Q=gn(null),ye(g,"tagNameCheck")&&oc(g.tagNameCheck)&&(Q.tagNameCheck=g.tagNameCheck),ye(g,"attributeNameCheck")&&oc(g.attributeNameCheck)&&(Q.attributeNameCheck=g.attributeNameCheck),ye(g,"allowCustomizedBuiltInElements")&&typeof g.allowCustomizedBuiltInElements=="boolean"&&(Q.allowCustomizedBuiltInElements=g.allowCustomizedBuiltInElements),_e(Q),gt&&(yn=!1),wn&&($t=!0),$e&&(K=U({},bl),C=gn(null),$e.html===!0&&(U(K,xl),U(C,yl)),$e.svg===!0&&(U(K,po),U(C,xo),U(C,Qr)),$e.svgFilters===!0&&(U(K,mo),U(C,xo),U(C,Qr)),$e.mathMl===!0&&(U(K,go),U(C,vl),U(C,Qr))),Ie.tagCheck=null,Ie.attributeCheck=null,ye(h,"ADD_TAGS")&&(typeof h.ADD_TAGS=="function"?Ie.tagCheck=h.ADD_TAGS:Pt(h.ADD_TAGS)&&(K===T&&(K=Ee(K)),U(K,h.ADD_TAGS,ce))),ye(h,"ADD_ATTR")&&(typeof h.ADD_ATTR=="function"?Ie.attributeCheck=h.ADD_ATTR:Pt(h.ADD_ATTR)&&(C===Ge&&(C=Ee(C)),U(C,h.ADD_ATTR,ce))),ye(h,"ADD_URI_SAFE_ATTR")&&Pt(h.ADD_URI_SAFE_ATTR)&&U(ko,h.ADD_URI_SAFE_ATTR,ce),ye(h,"FORBID_CONTENTS")&&Pt(h.FORBID_CONTENTS)&&(Ke===cr&&(Ke=Ee(Ke)),U(Ke,h.FORBID_CONTENTS,ce)),ye(h,"ADD_FORBID_CONTENTS")&&Pt(h.ADD_FORBID_CONTENTS)&&(Ke===cr&&(Ke=Ee(Ke)),U(Ke,h.ADD_FORBID_CONTENTS,ce)),rt&&(K["#text"]=!0),St&&U(K,["html","head","body"]),K.table&&(U(K,["tbody"]),delete jt.tbody),h.TRUSTED_TYPES_POLICY){if(typeof h.TRUSTED_TYPES_POLICY.createHTML!="function")throw Qt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof h.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Qt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const _=N;N=h.TRUSTED_TYPES_POLICY;try{L=ae("")}catch(A){throw N=_,A}}else h.TRUSTED_TYPES_POLICY===null?(N=void 0,L=""):(N===void 0&&(N=X()),N&&typeof L=="string"&&(L=ae("")));ke&&ke(h),jn=h},ac=U({},[...po,...mo,...rp]),sc=U({},[...go,...ip]),vg=function(h,g,_){return g.namespaceURI===xt?h==="svg":g.namespaceURI===Zr?h==="svg"&&(_==="annotation-xml"||So[_]):!!ac[h]},wg=function(h,g,_){return g.namespaceURI===xt?h==="math":g.namespaceURI===Xr?h==="math"&&To[_]:!!sc[h]},kg=function(h,g,_){return g.namespaceURI===Xr&&!To[_]||g.namespaceURI===Zr&&!So[_]?!1:!sc[h]&&(gg[h]||!ac[h])},_g=function(h){let g=v(h);(!g||!g.tagName)&&(g={namespaceURI:_n,tagName:"template"});const _=tr(h.tagName),A=tr(g.tagName);return jo[h.namespaceURI]?h.namespaceURI===Xr?vg(_,g,A):h.namespaceURI===Zr?wg(_,g,A):h.namespaceURI===xt?kg(_,g,A):!!(ur==="application/xhtml+xml"&&jo[h.namespaceURI]):!1},Dt=function(h){xn(e.removed,{element:h});try{v(h).removeChild(h)}catch{if(x(h),!v(h))throw Qt("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},lc=function(h){const g=b(h);if(g){const A=[];er(g,O=>{xn(A,O)}),er(A,O=>{try{x(O)}catch{}})}const _=R(h);if(_)for(let A=_.length-1;A>=0;--A){const O=_[A],H=O&&O.name;if(typeof H=="string")try{h.removeAttribute(H)}catch{}}},Jt=function(h,g){try{xn(e.removed,{attribute:g.getAttributeNode(h),from:g})}catch{xn(e.removed,{attribute:null,from:g})}if(g.removeAttribute(h),h==="is")if($t||wn)try{Dt(g)}catch{}else try{g.setAttribute(h,"")}catch{}},jg=function(h){const g=R(h);if(g)for(let _=g.length-1;_>=0;--_){const A=g[_],O=A&&A.name;if(!(typeof O!="string"||C[ce(O)]))try{h.removeAttribute(O)}catch{}}},Sg=function(h){const g=[h];for(;g.length>0;){const _=g.pop();(y?y(_):_.nodeType)===ft.element&&jg(_);const O=b(_);if(O)for(let H=O.length-1;H>=0;--H)g.push(O[H])}},cc=function(h){let g=null,_=null;if(vn)h="<remove></remove>"+h;else{const H=fl(h,/^[\r\n\t ]+/);_=H&&H[0]}ur==="application/xhtml+xml"&&_n===xt&&(h='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+h+"</body></html>");const A=N?ae(h):h;if(_n===xt)try{g=new f().parseFromString(A,ur)}catch{}if(!g||!g.documentElement){g=tt.createDocument(_n,"template",null);try{g.documentElement.innerHTML=_o?L:A}catch{}}const O=g.body||g.documentElement;return h&&_&&O.insertBefore(n.createTextNode(_),O.childNodes[0]||null),_n===xt?_t.call(g,St?"html":"body")[0]:St?g.documentElement:O},uc=function(h){return mt.call(h.ownerDocument||h,h,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},ei=function(h){return h=nr(h,We," "),h=nr(h,se," "),h=nr(h,D," "),h},Ao=function(h){var g;h.normalize();const _=mt.call(h.ownerDocument||h,h,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null);let A=_.nextNode();for(;A;)A.data=ei(A.data),A=_.nextNode();const O=(g=h.querySelectorAll)===null||g===void 0?void 0:g.call(h,"template");O&&er(O,H=>{Sn(H.content)&&Ao(H.content)})},ti=function(h){const g=E?E(h):null;return typeof g!="string"||ce(g)!=="form"?!1:typeof h.nodeName!="string"||typeof h.textContent!="string"||typeof h.removeChild!="function"||h.attributes!==R(h)||typeof h.removeAttribute!="function"||typeof h.setAttribute!="function"||typeof h.namespaceURI!="string"||typeof h.insertBefore!="function"||typeof h.hasChildNodes!="function"||h.nodeType!==y(h)||h.childNodes!==b(h)},Sn=function(h){if(!y||typeof h!="object"||h===null)return!1;try{return y(h)===ft.documentFragment}catch{return!1}},dr=function(h){if(!y||typeof h!="object"||h===null)return!1;try{return typeof y(h)=="number"}catch{return!1}};function Tt(j,h,g){j.length!==0&&er(j,_=>{_.call(e,h,g,jn)})}const Tg=function(h,g){return!!(Yt&&h.hasChildNodes()&&!dr(h.firstElementChild)&&je(kl,h.textContent)&&je(kl,h.innerHTML)||Yt&&h.namespaceURI===xt&&g==="style"&&dr(h.firstElementChild)||h.nodeType===ft.processingInstruction||Yt&&h.nodeType===ft.comment&&je(pp,h.data))},Cg=function(h,g){if(!jt[g]&&fc(g)&&(Q.tagNameCheck instanceof RegExp&&je(Q.tagNameCheck,g)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(g)))return!1;if(rt&&!Ke[g]){const _=v(h),A=b(h);if(A&&_){const O=A.length;for(let H=O-1;H>=0;--H){const ve=he?A[H]:p(A[H],!0);_.insertBefore(ve,k(h))}}}return Dt(h),!0},dc=function(h){if(Tt(J.beforeSanitizeElements,h,null),ti(h))return Dt(h),!0;const g=ce(E?E(h):h.nodeName);if(Tt(J.uponSanitizeElement,h,{tagName:g,allowedTags:K}),Tg(h,g))return Dt(h),!0;if(jt[g]||!(Ie.tagCheck instanceof Function&&Ie.tagCheck(g))&&!K[g])return Cg(h,g);if((y?y(h):h.nodeType)===ft.element&&!_g(h)||(g==="noscript"||g==="noembed"||g==="noframes")&&je(mp,h.innerHTML))return Dt(h),!0;if(gt&&h.nodeType===ft.text){const A=ei(h.textContent);h.textContent!==A&&(xn(e.removed,{element:h.cloneNode()}),h.textContent=A)}return Tt(J.afterSanitizeElements,h,null),!1},hc=function(h,g,_){if(ee[g]||V&&(g==="id"||g==="name")&&(_ in n||_ in yg))return!1;const A=C[g]||Ie.attributeCheck instanceof Function&&Ie.attributeCheck(g,h);if(!(yn&&je(Le,g))){if(!(Be&&je(nt,g))){if(A){if(!ko[g]){if(!je(Se,nr(_,be,""))){if(!((g==="src"||g==="xlink:href"||g==="href")&&h!=="script"&&pl(_,"data:")===0&&ec[h])){if(!(Yr&&!je(Kt,nr(_,be,"")))){if(_)return!1}}}}}else if(!(fc(h)&&(Q.tagNameCheck instanceof RegExp&&je(Q.tagNameCheck,h)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(h))&&(Q.attributeNameCheck instanceof RegExp&&je(Q.attributeNameCheck,g)||Q.attributeNameCheck instanceof Function&&Q.attributeNameCheck(g,h))||g==="is"&&Q.allowCustomizedBuiltInElements&&(Q.tagNameCheck instanceof RegExp&&je(Q.tagNameCheck,_)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(_))))return!1}}return!0},Ag=U({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),fc=function(h){return!Ag[tr(h)]&&je(Qe,h)},Rg=function(h,g,_,A){if(N&&typeof m=="object"&&typeof m.getAttributeType=="function"&&!_)switch(m.getAttributeType(h,g)){case"TrustedHTML":return ae(A);case"TrustedScriptURL":return S(A)}return A},Eg=function(h,g,_,A){try{_?h.setAttributeNS(_,g,A):h.setAttribute(g,A),ti(h)?Dt(h):hl(e.removed)}catch{Jt(g,h)}},pc=function(h){Tt(J.beforeSanitizeAttributes,h,null);const g=h.attributes;if(!g||ti(h))return;const _={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:C,forceKeepAttr:void 0};let A=g.length;const O=ce(h.nodeName);for(;A--;){const H=g[A],ve=H.name,xe=H.namespaceURI,Ye=H.value,it=ce(ve),Eo=Ye;let Pe=ve==="value"?Eo:Yf(Eo);if(_.attrName=it,_.attrValue=Pe,_.keepAttr=!0,_.forceKeepAttr=void 0,Tt(J.uponSanitizeAttribute,h,_),Pe=_.attrValue,$&&(it==="id"||it==="name")&&pl(Pe,le)!==0&&(Jt(ve,h),Pe=le+Pe),Yt&&je(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Pe)){Jt(ve,h);continue}if(it==="attributename"&&fl(Pe,"href")){Jt(ve,h);continue}if(!_.forceKeepAttr){if(!_.keepAttr){Jt(ve,h);continue}if(!Jr&&je(gp,Pe)){Jt(ve,h);continue}if(gt&&(Pe=ei(Pe)),!hc(O,it,Pe)){Jt(ve,h);continue}Pe=Rg(O,it,xe,Pe),Pe!==Eo&&Eg(h,ve,xe,Pe)}}Tt(J.afterSanitizeAttributes,h,null)},ni=function(h){let g=null;const _=uc(h);for(Tt(J.beforeSanitizeShadowDOM,h,null);g=_.nextNode();)if(Tt(J.uponSanitizeShadowNode,g,null),dc(g),pc(g),Sn(g.content)&&ni(g.content),(y?y(g):g.nodeType)===ft.element){const O=w(g);Sn(O)&&(Ro(O),ni(O))}Tt(J.afterSanitizeShadowDOM,h,null)},Ro=function(h){const g=[{node:h,shadow:null}];for(;g.length>0;){const _=g.pop();if(_.shadow){ni(_.shadow);continue}const A=_.node,H=(y?y(A):A.nodeType)===ft.element,ve=b(A);if(ve)for(let xe=ve.length-1;xe>=0;--xe)g.push({node:ve[xe],shadow:null});if(H){const xe=E?E(A):null;if(typeof xe=="string"&&ce(xe)==="template"){const Ye=A.content;Sn(Ye)&&g.push({node:Ye,shadow:null})}}if(H){const xe=w(A);Sn(xe)&&g.push({node:null,shadow:xe},{node:xe,shadow:null})}}};return e.sanitize=function(j){let h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},g=null,_=null,A=null,O=null;if(_o=!j,_o&&(j="<!-->"),typeof j!="string"&&!dr(j)&&(j=tp(j),typeof j!="string"))throw Qt("dirty is not a string, aborting");if(!e.isSupported)return j;ar?(K=sr,C=lr):Co(h),(J.uponSanitizeElement.length>0||J.uponSanitizeAttribute.length>0)&&(K=Ee(K)),J.uponSanitizeAttribute.length>0&&(C=Ee(C)),e.removed=[];const H=he&&typeof j!="string"&&dr(j);if(H){const Ye=E?E(j):j.nodeName;if(typeof Ye=="string"){const it=ce(Ye);if(!K[it]||jt[it])throw Qt("root node is forbidden and cannot be sanitized in-place")}if(ti(j))throw Qt("root node is clobbered and cannot be sanitized in-place");try{Ro(j)}catch(it){throw lc(j),it}}else if(dr(j))g=cc("<!---->"),_=g.ownerDocument.importNode(j,!0),_.nodeType===ft.element&&_.nodeName==="BODY"||_.nodeName==="HTML"?g=_:g.appendChild(_),Ro(_);else{if(!$t&&!gt&&!St&&j.indexOf("<")===-1)return N&&kn?ae(j):j;if(g=cc(j),!g)return $t?null:kn?L:""}g&&vn&&Dt(g.firstChild);const ve=uc(H?j:g);try{for(;A=ve.nextNode();)dc(A),pc(A),Sn(A.content)&&ni(A.content)}catch(Ye){throw H&&lc(j),Ye}if(H)return er(e.removed,Ye=>{Ye.element&&Sg(Ye.element)}),gt&&Ao(j),j;if($t){if(gt&&Ao(g),wn)for(O=Lt.call(g.ownerDocument);g.firstChild;)O.appendChild(g.firstChild);else O=g;return(C.shadowroot||C.shadowrootmode)&&(O=Gt.call(r,O,!0)),O}let xe=St?g.outerHTML:g.innerHTML;return St&&K["!doctype"]&&g.ownerDocument&&g.ownerDocument.doctype&&g.ownerDocument.doctype.name&&je(hp,g.ownerDocument.doctype.name)&&(xe="<!DOCTYPE "+g.ownerDocument.doctype.name+`>
|
|
75
|
-
`+
|
|
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>${ut(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=cl(t);if(i===null)return r;t=i;let o='<a href="'+t+'"';return e&&(o+=' title="'+ut(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=cl(t);if(i===null)return ut(n);t=i;let o=`<img src="${t}" alt="${ut(n)}"`;return e&&(o+=` title="${ut(e)}"`),o+=">",o}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:ut(t.text)}},po=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}},Xe=class Lo{options;renderer;textRenderer;constructor(e){this.options=e||Vt,this.options.renderer=this.options.renderer||new Wr,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new po}static parse(e,n){return new Lo(n).parse(e)}static parseInline(e,n){return new Lo(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}},er=class{options;block;constructor(t){this.options=t||Vt}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?Ze.lex:Ze.lexInline}provideParser(t=this.block){return t?Xe.parse:Xe.parseInline}},Gf=class{defaults=io();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Xe;Renderer=Wr;TextRenderer=po;Lexer=Ze;Tokenizer=Hr;Hooks=er;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 Wr(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 h=l.apply(i,u);return h===!1&&(h=c.apply(i,u)),h||""}}r.renderer=i}if(n.tokenizer){let i=this.defaults.tokenizer||new Hr(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 h=l.apply(i,u);return h===!1&&(h=c.apply(i,u)),h}}r.tokenizer=i}if(n.hooks){let i=this.defaults.hooks||new er;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];er.passThroughHooks.has(o)?i[a]=u=>{if(this.defaults.async&&er.passThroughHooksRespectAsync.has(o))return(async()=>{let m=await l.call(i,u);return c.call(i,m)})();let h=l.call(i,u);return c.call(i,h)}: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 h=l.apply(i,u);return h===!1&&(h=c.apply(i,u)),h}}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 Ze.lex(t,e??this.defaults)}parser(t,e){return Xe.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?Ze.lex:Ze.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?Xe.parse:Xe.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?Ze.lex:Ze.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?Xe.parse:Xe.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>"+ut(n.message+"",!0)+"</pre>";return e?Promise.resolve(r):r}if(e)return Promise.reject(n);throw n}}},Wt=new Gf;function W(t,e){return Wt.parse(t,e)}W.options=W.setOptions=function(t){return Wt.setOptions(t),W.defaults=Wt.defaults,Ys(W.defaults),W},W.getDefaults=io,W.defaults=Vt,W.use=function(...t){return Wt.use(...t),W.defaults=Wt.defaults,Ys(W.defaults),W},W.walkTokens=function(t,e){return Wt.walkTokens(t,e)},W.parseInline=Wt.parseInline,W.Parser=Xe,W.parser=Xe.parse,W.Renderer=Wr,W.TextRenderer=po,W.Lexer=Ze,W.lexer=Ze.lex,W.Tokenizer=Hr,W.Hooks=er,W.parse=W,W.options,W.setOptions,W.use,W.walkTokens,W.parseInline,Xe.parse,Ze.lex;function fl(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 Kf(t){if(Array.isArray(t))return t}function Yf(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(h){u=!0,i=h}finally{try{if(!c&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw i}}return l}}function Jf(){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 Zf(t,e){return Kf(t)||Yf(t,e)||Xf(t,e)||Jf()}function Xf(t,e){if(t){if(typeof t=="string")return fl(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)?fl(t,e):void 0}}const pl=Object.entries,ml=Object.setPrototypeOf,ep=Object.isFrozen,tp=Object.getPrototypeOf,np=Object.getOwnPropertyDescriptor;let _e=Object.freeze,je=Object.seal,bn=Object.create,gl=typeof Reflect<"u"&&Reflect,mo=gl.apply,go=gl.construct;_e||(_e=function(e){return e}),je||(je=function(e){return e}),mo||(mo=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)}),go||(go=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 tr=me(Array.prototype.forEach),rp=me(Array.prototype.lastIndexOf),xl=me(Array.prototype.pop),yn=me(Array.prototype.push),ip=me(Array.prototype.splice),Pt=Array.isArray,nr=me(String.prototype.toLowerCase),xo=me(String.prototype.toString),bl=me(String.prototype.match),rr=me(String.prototype.replace),yl=me(String.prototype.indexOf),op=me(String.prototype.trim),ap=me(Number.prototype.toString),sp=me(Boolean.prototype.toString),vl=typeof BigInt>"u"?null:me(BigInt.prototype.toString),wl=typeof Symbol>"u"?null:me(Symbol.prototype.toString),ye=me(Object.prototype.hasOwnProperty),ir=me(Object.prototype.toString),Se=me(RegExp.prototype.test),Qt=lp(TypeError);function me(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 mo(t,e,r)}}function lp(t){return function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return go(t,n)}}function V(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:nr;if(ml&&ml(t,null),!Pt(e))return t;let r=e.length;for(;r--;){let i=e[r];if(typeof i=="string"){const o=n(i);o!==i&&(ep(e)||(e[r]=o),i=o)}t[i]=!0}return t}function cp(t){for(let e=0;e<t.length;e++)ye(t,e)||(t[e]=null);return t}function Ee(t){const e=bn(null);for(const r of pl(t)){var n=Zf(r,2);const i=n[0],o=n[1];ye(t,i)&&(Pt(o)?e[i]=cp(o):o&&typeof o=="object"&&o.constructor===Object?e[i]=Ee(o):e[i]=o)}return e}function up(t){switch(typeof t){case"string":return t;case"number":return ap(t);case"boolean":return sp(t);case"bigint":return vl?vl(t):"0";case"symbol":return wl?wl(t):"Symbol()";case"undefined":return ir(t);case"function":case"object":{if(t===null)return ir(t);const e=t,n=dt(e,"toString");if(typeof n=="function"){const r=n(e);return typeof r=="string"?r:ir(r)}return ir(t)}default:return ir(t)}}function dt(t,e){for(;t!==null;){const r=np(t,e);if(r){if(r.get)return me(r.get);if(typeof r.value=="function")return me(r.value)}t=tp(t)}function n(){return null}return n}function dp(t){try{return Se(t,""),!0}catch{return!1}}const kl=_e(["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"]),bo=_e(["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=_e(["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"]),hp=_e(["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"]),vo=_e(["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"]),fp=_e(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),_l=_e(["#text"]),jl=_e(["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"]),wo=_e(["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"]),Sl=_e(["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"]),Qr=_e(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),pp=je(/{{[\w\W]*|^[\w\W]*}}/g),mp=je(/<%[\w\W]*|^[\w\W]*%>/g),gp=je(/\${[\w\W]*/g),xp=je(/^data-[\-\w.\u00B7-\uFFFF]+$/),bp=je(/^aria-[\-\w]+$/),Tl=je(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),yp=je(/^(?:\w+script|data):/i),vp=je(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),wp=je(/^html$/i),kp=je(/^[a-z][.\w]*(-[.\w]+)+$/i),Cl=je(/<[/\w!]/g),_p=je(/<[/\w]/g),jp=je(/<\/no(script|embed|frames)/i),Sp=je(/\/>/i),ht={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Tp=function(){return typeof window>"u"?null:window},Cp=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}},Al=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Nt=function(e,n,r,i){return ye(e,n)&&Pt(e[n])?V(i.base?Ee(i.base):{},e[n],i.transform):r};function Rl(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Tp();const e=j=>Rl(j);if(e.version="3.4.11",e.removed=[],!t||!t.document||t.document.nodeType!==ht.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 h=t.DOMParser,m=t.trustedTypes,d=l.prototype,p=dt(d,"cloneNode"),b=dt(d,"remove"),S=dt(d,"nextSibling"),y=dt(d,"childNodes"),x=dt(d,"parentNode"),k=dt(d,"shadowRoot"),A=dt(d,"attributes"),N=a&&a.prototype?dt(a.prototype,"nodeType"):null,P=a&&a.prototype?dt(a.prototype,"nodeName"):null;if(typeof o=="function"){const j=n.createElement("template");j.content&&j.content.ownerDocument&&(n=j.content.ownerDocument)}let I,L="",v,se=!1,D=0;const K=function(){if(D>0)throw Qt('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.')},ie=function(f){K(),D++;try{return I.createHTML(f)}finally{D--}},T=function(f){K(),D++;try{return I.createScriptURL(f)}finally{D--}},J=function(){return se||(v=Cp(m,i),se=!0),v},$e=n,De=$e.implementation,pt=$e.createNodeIterator,Lt=$e.createDocumentFragment,_t=$e.getElementsByTagName,Kt=r.importNode;let X=Al();e.isSupported=typeof pl=="function"&&typeof x=="function"&&De&&De.createHTMLDocument!==void 0;const Qe=pp,le=mp,z=gp,qe=xp,tt=bp,Yt=yp,be=vp,Ge=kp;let Te=Tl,Z=null;const Jt=V({},[...kl,...bo,...yo,...vo,..._l]);let w=null;const $=V({},[...jl,...wo,...Sl,...Qr]);let H=Object.seal(bn(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}})),ce=null,mt=null;const Ie=Object.seal(bn(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Fe=!0,vn=!0,Jr=!1,Zr=!0,gt=!1,Zt=!0,jt=!1,sr=!1,lr=null,cr=null,wn=!1,$t=!1,kn=!1,_n=!1,Q=!0,q=!1;const ue="user-content-";let nt=!0,he=!1,ze={},Ke=null;const ur=V({},["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 ac=null;const sc=V({},["audio","video","img","source","image","track"]);let To=null;const lc=V({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Xr="http://www.w3.org/1998/Math/MathML",ei="http://www.w3.org/2000/svg",xt="http://www.w3.org/1999/xhtml";let jn=xt,Co=!1,Ao=null;const Tg=V({},[Xr,ei,xt],xo),cc=_e(["mi","mo","mn","ms","mtext"]);let Ro=V({},cc);const uc=_e(["annotation-xml"]);let Eo=V({},uc);const Cg=V({},["title","style","font","a","script"]);let dr=null;const Ag=["application/xhtml+xml","text/html"],Rg="text/html";let de=null,Sn=null;const Eg=n.createElement("form"),dc=function(f){return f instanceof RegExp||f instanceof Function},Io=function(){let f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Sn&&Sn===f)return;(!f||typeof f!="object")&&(f={}),f=Ee(f),dr=Ag.indexOf(f.PARSER_MEDIA_TYPE)===-1?Rg:f.PARSER_MEDIA_TYPE,de=dr==="application/xhtml+xml"?xo:nr,Z=Nt(f,"ALLOWED_TAGS",Jt,{transform:de}),w=Nt(f,"ALLOWED_ATTR",$,{transform:de}),Ao=Nt(f,"ALLOWED_NAMESPACES",Tg,{transform:xo}),To=Nt(f,"ADD_URI_SAFE_ATTR",lc,{transform:de,base:lc}),ac=Nt(f,"ADD_DATA_URI_TAGS",sc,{transform:de,base:sc}),Ke=Nt(f,"FORBID_CONTENTS",ur,{transform:de}),ce=Nt(f,"FORBID_TAGS",Ee({}),{transform:de}),mt=Nt(f,"FORBID_ATTR",Ee({}),{transform:de}),ze=ye(f,"USE_PROFILES")?f.USE_PROFILES&&typeof f.USE_PROFILES=="object"?Ee(f.USE_PROFILES):f.USE_PROFILES:!1,Fe=f.ALLOW_ARIA_ATTR!==!1,vn=f.ALLOW_DATA_ATTR!==!1,Jr=f.ALLOW_UNKNOWN_PROTOCOLS||!1,Zr=f.ALLOW_SELF_CLOSE_IN_ATTR!==!1,gt=f.SAFE_FOR_TEMPLATES||!1,Zt=f.SAFE_FOR_XML!==!1,jt=f.WHOLE_DOCUMENT||!1,$t=f.RETURN_DOM||!1,kn=f.RETURN_DOM_FRAGMENT||!1,_n=f.RETURN_TRUSTED_TYPE||!1,wn=f.FORCE_BODY||!1,Q=f.SANITIZE_DOM!==!1,q=f.SANITIZE_NAMED_PROPS||!1,nt=f.KEEP_CONTENT!==!1,he=f.IN_PLACE||!1,Te=dp(f.ALLOWED_URI_REGEXP)?f.ALLOWED_URI_REGEXP:Tl,jn=typeof f.NAMESPACE=="string"?f.NAMESPACE:xt,Ro=ye(f,"MATHML_TEXT_INTEGRATION_POINTS")&&f.MATHML_TEXT_INTEGRATION_POINTS&&typeof f.MATHML_TEXT_INTEGRATION_POINTS=="object"?Ee(f.MATHML_TEXT_INTEGRATION_POINTS):V({},cc),Eo=ye(f,"HTML_INTEGRATION_POINTS")&&f.HTML_INTEGRATION_POINTS&&typeof f.HTML_INTEGRATION_POINTS=="object"?Ee(f.HTML_INTEGRATION_POINTS):V({},uc);const g=ye(f,"CUSTOM_ELEMENT_HANDLING")&&f.CUSTOM_ELEMENT_HANDLING&&typeof f.CUSTOM_ELEMENT_HANDLING=="object"?Ee(f.CUSTOM_ELEMENT_HANDLING):bn(null);if(H=bn(null),ye(g,"tagNameCheck")&&dc(g.tagNameCheck)&&(H.tagNameCheck=g.tagNameCheck),ye(g,"attributeNameCheck")&&dc(g.attributeNameCheck)&&(H.attributeNameCheck=g.attributeNameCheck),ye(g,"allowCustomizedBuiltInElements")&&typeof g.allowCustomizedBuiltInElements=="boolean"&&(H.allowCustomizedBuiltInElements=g.allowCustomizedBuiltInElements),je(H),gt&&(vn=!1),kn&&($t=!0),ze&&(Z=V({},_l),w=bn(null),ze.html===!0&&(V(Z,kl),V(w,jl)),ze.svg===!0&&(V(Z,bo),V(w,wo),V(w,Qr)),ze.svgFilters===!0&&(V(Z,yo),V(w,wo),V(w,Qr)),ze.mathMl===!0&&(V(Z,vo),V(w,Sl),V(w,Qr))),Ie.tagCheck=null,Ie.attributeCheck=null,ye(f,"ADD_TAGS")&&(typeof f.ADD_TAGS=="function"?Ie.tagCheck=f.ADD_TAGS:Pt(f.ADD_TAGS)&&(Z===Jt&&(Z=Ee(Z)),V(Z,f.ADD_TAGS,de))),ye(f,"ADD_ATTR")&&(typeof f.ADD_ATTR=="function"?Ie.attributeCheck=f.ADD_ATTR:Pt(f.ADD_ATTR)&&(w===$&&(w=Ee(w)),V(w,f.ADD_ATTR,de))),ye(f,"ADD_URI_SAFE_ATTR")&&Pt(f.ADD_URI_SAFE_ATTR)&&V(To,f.ADD_URI_SAFE_ATTR,de),ye(f,"FORBID_CONTENTS")&&Pt(f.FORBID_CONTENTS)&&(Ke===ur&&(Ke=Ee(Ke)),V(Ke,f.FORBID_CONTENTS,de)),ye(f,"ADD_FORBID_CONTENTS")&&Pt(f.ADD_FORBID_CONTENTS)&&(Ke===ur&&(Ke=Ee(Ke)),V(Ke,f.ADD_FORBID_CONTENTS,de)),nt&&(Z["#text"]=!0),jt&&V(Z,["html","head","body"]),Z.table&&(V(Z,["tbody"]),delete ce.tbody),f.TRUSTED_TYPES_POLICY){if(typeof f.TRUSTED_TYPES_POLICY.createHTML!="function")throw Qt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof f.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Qt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const _=I;I=f.TRUSTED_TYPES_POLICY;try{L=ie("")}catch(C){throw I=_,C}}else f.TRUSTED_TYPES_POLICY===null?(I=void 0,L=""):(I===void 0&&(I=J()),I&&typeof L=="string"&&(L=ie("")));_e&&_e(f),Sn=f},hc=V({},[...bo,...yo,...hp]),fc=V({},[...vo,...fp]),Ig=function(f,g,_){return g.namespaceURI===xt?f==="svg":g.namespaceURI===Xr?f==="svg"&&(_==="annotation-xml"||Ro[_]):!!hc[f]},Pg=function(f,g,_){return g.namespaceURI===xt?f==="math":g.namespaceURI===ei?f==="math"&&Eo[_]:!!fc[f]},Ng=function(f,g,_){return g.namespaceURI===ei&&!Eo[_]||g.namespaceURI===Xr&&!Ro[_]?!1:!fc[f]&&(Cg[f]||!hc[f])},Mg=function(f){let g=x(f);(!g||!g.tagName)&&(g={namespaceURI:jn,tagName:"template"});const _=nr(f.tagName),C=nr(g.tagName);return Ao[f.namespaceURI]?f.namespaceURI===ei?Ig(_,g,C):f.namespaceURI===Xr?Pg(_,g,C):f.namespaceURI===xt?Ng(_,g,C):!!(dr==="application/xhtml+xml"&&Ao[f.namespaceURI]):!1},Dt=function(f){yn(e.removed,{element:f});try{x(f).removeChild(f)}catch{if(b(f),!x(f))throw Qt("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},pc=function(f){const g=y(f);if(g){const C=[];tr(g,O=>{yn(C,O)}),tr(C,O=>{try{b(O)}catch{}})}const _=A(f);if(_)for(let C=_.length-1;C>=0;--C){const O=_[C],G=O&&O.name;if(typeof G=="string")try{f.removeAttribute(G)}catch{}}},Xt=function(f,g){try{yn(e.removed,{attribute:g.getAttributeNode(f),from:g})}catch{yn(e.removed,{attribute:null,from:g})}if(g.removeAttribute(f),f==="is")if($t||kn)try{Dt(g)}catch{}else try{g.setAttribute(f,"")}catch{}},Og=function(f){const g=A(f);if(g)for(let _=g.length-1;_>=0;--_){const C=g[_],O=C&&C.name;if(!(typeof O!="string"||w[de(O)]))try{f.removeAttribute(O)}catch{}}},Lg=function(f){const g=[f];for(;g.length>0;){const _=g.pop();(N?N(_):_.nodeType)===ht.element&&Og(_);const O=y(_);if(O)for(let G=O.length-1;G>=0;--G)g.push(O[G])}},mc=function(f){let g=null,_=null;if(wn)f="<remove></remove>"+f;else{const G=bl(f,/^[\r\n\t ]+/);_=G&&G[0]}dr==="application/xhtml+xml"&&jn===xt&&(f='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+f+"</body></html>");const C=I?ie(f):f;if(jn===xt)try{g=new h().parseFromString(C,dr)}catch{}if(!g||!g.documentElement){g=De.createDocument(jn,"template",null);try{g.documentElement.innerHTML=Co?L:C}catch{}}const O=g.body||g.documentElement;return f&&_&&O.insertBefore(n.createTextNode(_),O.childNodes[0]||null),jn===xt?_t.call(g,jt?"html":"body")[0]:jt?g.documentElement:O},gc=function(f){return pt.call(f.ownerDocument||f,f,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},ti=function(f){return f=rr(f,Qe," "),f=rr(f,le," "),f=rr(f,z," "),f},Po=function(f){var g;f.normalize();const _=pt.call(f.ownerDocument||f,f,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null);let C=_.nextNode();for(;C;)C.data=ti(C.data),C=_.nextNode();const O=(g=f.querySelectorAll)===null||g===void 0?void 0:g.call(f,"template");O&&tr(O,G=>{Tn(G.content)&&Po(G.content)})},ni=function(f){const g=P?P(f):null;return typeof g!="string"||de(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!==y(f)},Tn=function(f){if(!N||typeof f!="object"||f===null)return!1;try{return N(f)===ht.documentFragment}catch{return!1}},hr=function(f){if(!N||typeof f!="object"||f===null)return!1;try{return typeof N(f)=="number"}catch{return!1}};function St(j,f,g){j.length!==0&&tr(j,_=>{_.call(e,f,g,Sn)})}const $g=function(f,g){return!!(Zt&&f.hasChildNodes()&&!hr(f.firstElementChild)&&Se(Cl,f.textContent)&&Se(Cl,f.innerHTML)||Zt&&f.namespaceURI===xt&&g==="style"&&hr(f.firstElementChild)||f.nodeType===ht.processingInstruction||Zt&&f.nodeType===ht.comment&&Se(_p,f.data))},Dg=function(f,g){if(!ce[g]&&yc(g)&&(H.tagNameCheck instanceof RegExp&&Se(H.tagNameCheck,g)||H.tagNameCheck instanceof Function&&H.tagNameCheck(g)))return!1;if(nt&&!Ke[g]){const _=x(f),C=y(f);if(C&&_){const O=C.length;for(let G=O-1;G>=0;--G){const ve=he?C[G]:p(C[G],!0);_.insertBefore(ve,S(f))}}}return Dt(f),!0},xc=function(f){if(St(X.beforeSanitizeElements,f,null),ni(f))return Dt(f),!0;const g=de(P?P(f):f.nodeName);if(St(X.uponSanitizeElement,f,{tagName:g,allowedTags:Z}),$g(f,g))return Dt(f),!0;if(ce[g]||!(Ie.tagCheck instanceof Function&&Ie.tagCheck(g))&&!Z[g])return Dg(f,g);if((N?N(f):f.nodeType)===ht.element&&!Mg(f)||(g==="noscript"||g==="noembed"||g==="noframes")&&Se(jp,f.innerHTML))return Dt(f),!0;if(gt&&f.nodeType===ht.text){const C=ti(f.textContent);f.textContent!==C&&(yn(e.removed,{element:f.cloneNode()}),f.textContent=C)}return St(X.afterSanitizeElements,f,null),!1},bc=function(f,g,_){if(mt[g]||Q&&(g==="id"||g==="name")&&(_ in n||_ in Eg))return!1;const C=w[g]||Ie.attributeCheck instanceof Function&&Ie.attributeCheck(g,f);if(!(vn&&Se(qe,g))){if(!(Fe&&Se(tt,g))){if(C){if(!To[g]){if(!Se(Te,rr(_,be,""))){if(!((g==="src"||g==="xlink:href"||g==="href")&&f!=="script"&&yl(_,"data:")===0&&ac[f])){if(!(Jr&&!Se(Yt,rr(_,be,"")))){if(_)return!1}}}}}else if(!(yc(f)&&(H.tagNameCheck instanceof RegExp&&Se(H.tagNameCheck,f)||H.tagNameCheck instanceof Function&&H.tagNameCheck(f))&&(H.attributeNameCheck instanceof RegExp&&Se(H.attributeNameCheck,g)||H.attributeNameCheck instanceof Function&&H.attributeNameCheck(g,f))||g==="is"&&H.allowCustomizedBuiltInElements&&(H.tagNameCheck instanceof RegExp&&Se(H.tagNameCheck,_)||H.tagNameCheck instanceof Function&&H.tagNameCheck(_))))return!1}}return!0},qg=V({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),yc=function(f){return!qg[nr(f)]&&Se(Ge,f)},zg=function(f,g,_,C){if(I&&typeof m=="object"&&typeof m.getAttributeType=="function"&&!_)switch(m.getAttributeType(f,g)){case"TrustedHTML":return ie(C);case"TrustedScriptURL":return T(C)}return C},Ug=function(f,g,_,C){try{_?f.setAttributeNS(_,g,C):f.setAttribute(g,C),ni(f)?Dt(f):xl(e.removed)}catch{Xt(g,f)}},vc=function(f){St(X.beforeSanitizeAttributes,f,null);const g=f.attributes;if(!g||ni(f))return;const _={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:w,forceKeepAttr:void 0};let C=g.length;const O=de(f.nodeName);for(;C--;){const G=g[C],ve=G.name,ge=G.namespaceURI,Ye=G.value,rt=de(ve),Mo=Ye;let Pe=ve==="value"?Mo:op(Mo);if(_.attrName=rt,_.attrValue=Pe,_.keepAttr=!0,_.forceKeepAttr=void 0,St(X.uponSanitizeAttribute,f,_),Pe=_.attrValue,q&&(rt==="id"||rt==="name")&&yl(Pe,ue)!==0&&(Xt(ve,f),Pe=ue+Pe),Zt&&Se(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Pe)){Xt(ve,f);continue}if(rt==="attributename"&&bl(Pe,"href")){Xt(ve,f);continue}if(!_.forceKeepAttr){if(!_.keepAttr){Xt(ve,f);continue}if(!Zr&&Se(Sp,Pe)){Xt(ve,f);continue}if(gt&&(Pe=ti(Pe)),!bc(O,rt,Pe)){Xt(ve,f);continue}Pe=zg(O,rt,ge,Pe),Pe!==Mo&&Ug(f,ve,ge,Pe)}}St(X.afterSanitizeAttributes,f,null)},ri=function(f){let g=null;const _=gc(f);for(St(X.beforeSanitizeShadowDOM,f,null);g=_.nextNode();)if(St(X.uponSanitizeShadowNode,g,null),xc(g),vc(g),Tn(g.content)&&ri(g.content),(N?N(g):g.nodeType)===ht.element){const O=k(g);Tn(O)&&(No(O),ri(O))}St(X.afterSanitizeShadowDOM,f,null)},No=function(f){const g=[{node:f,shadow:null}];for(;g.length>0;){const _=g.pop();if(_.shadow){ri(_.shadow);continue}const C=_.node,G=(N?N(C):C.nodeType)===ht.element,ve=y(C);if(ve)for(let ge=ve.length-1;ge>=0;--ge)g.push({node:ve[ge],shadow:null});if(G){const ge=P?P(C):null;if(typeof ge=="string"&&de(ge)==="template"){const Ye=C.content;Tn(Ye)&&g.push({node:Ye,shadow:null})}}if(G){const ge=k(C);Tn(ge)&&g.push({node:null,shadow:ge},{node:ge,shadow:null})}}};return e.sanitize=function(j){let f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},g=null,_=null,C=null,O=null;if(Co=!j,Co&&(j="<!-->"),typeof j!="string"&&!hr(j)&&(j=up(j),typeof j!="string"))throw Qt("dirty is not a string, aborting");if(!e.isSupported)return j;sr?(Z=lr,w=cr):Io(f),(X.uponSanitizeElement.length>0||X.uponSanitizeAttribute.length>0)&&(Z=Ee(Z)),X.uponSanitizeAttribute.length>0&&(w=Ee(w)),e.removed=[];const G=he&&typeof j!="string"&&hr(j);if(G){const Ye=P?P(j):j.nodeName;if(typeof Ye=="string"){const rt=de(Ye);if(!Z[rt]||ce[rt])throw Qt("root node is forbidden and cannot be sanitized in-place")}if(ni(j))throw Qt("root node is clobbered and cannot be sanitized in-place");try{No(j)}catch(rt){throw pc(j),rt}}else if(hr(j))g=mc("<!---->"),_=g.ownerDocument.importNode(j,!0),_.nodeType===ht.element&&_.nodeName==="BODY"||_.nodeName==="HTML"?g=_:g.appendChild(_),No(_);else{if(!$t&&!gt&&!jt&&j.indexOf("<")===-1)return I&&_n?ie(j):j;if(g=mc(j),!g)return $t?null:_n?L:""}g&&wn&&Dt(g.firstChild);const ve=gc(G?j:g);try{for(;C=ve.nextNode();)xc(C),vc(C),Tn(C.content)&&ri(C.content)}catch(Ye){throw G&&pc(j),Ye}if(G)return tr(e.removed,Ye=>{Ye.element&&Lg(Ye.element)}),gt&&Po(j),j;if($t){if(gt&&Po(g),kn)for(O=Lt.call(g.ownerDocument);g.firstChild;)O.appendChild(g.firstChild);else O=g;return(w.shadowroot||w.shadowrootmode)&&(O=Kt.call(r,O,!0)),O}let ge=jt?g.outerHTML:g.innerHTML;return jt&&Z["!doctype"]&&g.ownerDocument&&g.ownerDocument.doctype&&g.ownerDocument.doctype.name&&Se(wp,g.ownerDocument.doctype.name)&&(ge="<!DOCTYPE "+g.ownerDocument.doctype.name+`>
|
|
79
|
+
`+ge),gt&&(ge=ti(ge)),I&&_n?ie(ge):ge},e.setConfig=function(){let j=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Io(j),sr=!0,lr=Z,cr=w},e.clearConfig=function(){Sn=null,sr=!1,lr=null,cr=null,I=v,L=""},e.isValidAttribute=function(j,f,g){Sn||Io({});const _=de(j),C=de(f);return bc(_,C,g)},e.addHook=function(j,f){typeof f=="function"&&ye(X,j)&&yn(X[j],f)},e.removeHook=function(j,f){if(ye(X,j)){if(f!==void 0){const g=rp(X[j],f);return g===-1?void 0:ip(X[j],g,1)[0]}return xl(X[j])}},e.removeHooks=function(j){ye(X,j)&&(X[j]=[])},e.removeAllHooks=function(){X=Al()},e}var Ap=Rl();function Rp(t){return t.trim().split(/\n\s*-{3,}\s*\n/).map(e=>{const[n="",...r]=e.trim().split(`
|
|
76
80
|
`);return{title:n.replace(/^\*+|\*+$/g,"").trim(),body:r.join(`
|
|
77
|
-
`).trim()}}).filter(e=>(e.title!==""||e.body!=="")&&!/^-{3,}$/.test(e.title))}function wp(t){const e=vp(t);return e.length===0?"":`<div class="jex-card-grid">${e.map(r=>{const i=r.title?`<div class="jex-card-title">${F.parseInline(r.title)}</div>`:"",o=r.body?F.parse(r.body):"";return`<div class="jex-card">${i}${o}</div>`}).join("")}</div>`}F.setOptions({breaks:!0,gfm:!0}),F.use({renderer:{code(t){return t.lang==="cards"&&t.raw.trimEnd().endsWith("```")?wp(t.text):!1}}});const ir=typeof window<"u"?yp:null;ir&&typeof ir.addHook=="function"&&ir.addHook("afterSanitizeAttributes",t=>{t.tagName==="A"&&t.hasAttribute("href")&&(t.setAttribute("target","_blank"),t.setAttribute("rel","noopener noreferrer"))});function kp(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function _p(t){if(!t)return"";if(!ir)return kp(t);const e=F.parse(t),n=typeof e=="string"?e:"";return ir.sanitize(n)}function jp({text:t}){const e=fe(()=>_p(t),[t]);return s("div",{class:"jex-md",dangerouslySetInnerHTML:{__html:e}})}function Sl({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(Xi,{size:12})})}function Sp(t,e,n){return t.role==="user"?n:t.authorName??e??""}function Tp({authorLabel:t,content:e,onClick:n}){return s("button",{type:"button",class:"jex-quoted-chip",onClick:n,children:[s(Xi,{size:11}),s("span",{class:"jex-quoted-chip-text",children:[t&&s("span",{class:"jex-quoted-chip-author",children:[t,": "]}),Is(e)]})]})}function Tl({quotes:t,botName:e,yourMessageLabel:n,onQuotedClick:r}){return t.length===0?null:s("div",{class:"jex-quoted-list",children:t.map(i=>s(Tp,{authorLabel:Sp(i,e,n),content:i.content,onClick:r?o=>{r(i.id,o)}:void 0},i.id))})}function Cp(t){const e=t.trim().split(/\s+/).filter(Boolean);return e.length===0?"?":e.map(n=>n[0]).join("").slice(0,2).toUpperCase()}function bn({text:t,streaming:e,error:n,authorId:r,authorName:i,authorImage:o,botAvatarUrl:a,botName:l,onQuote:c,id:u,quoted:f,onQuotedClick:m}){const d=I(),p=!!r,[x,k]=q(!1),b=G(()=>k(!0),[]),v=p?i??"":l??"",w=["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:Cp(i??"")}):a&&!x?s("img",{src:a,alt:"",class:"jex-avatar-img",onError:b}):s($r,{size:14})}),v&&s("span",{class:"jex-message-author",children:v})]}),s("div",{class:w,id:u,children:[s(Tl,{quotes:f??[],botName:l,yourMessageLabel:d.quotedYourMessage,onQuotedClick:m}),s(jp,{text:t}),e&&s("span",{class:"jex-streaming-cursor"}),c&&s(Sl,{onQuote:c})]})]})}function Ap({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 Rp(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 Ep({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(Tl,{quotes:i??[],botName:r,yourMessageLabel:l.quotedYourMessage,onQuotedClick:o}),Rp(t,a??[]),n&&s(Sl,{onQuote:n})]})}function Cl(){return Bt(Ce.functions.chat.public.helpdesk.submitEscalation)}function Al(){const t=Bt(Ce.functions.chat.public.helpdesk.markEscalationWaiting);return e=>{Yn.value=e,t({sessionId:e.sessionId,visitorId:e.visitorId}).catch(n=>{ne.error("[waiting] markEscalationWaiting failed:",n)})}}function Ip({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(Pp,{messageId:t._id,sessionId:e,visitorId:n,waitingSetAt:r})})}function Pp({messageId:t,sessionId:e,visitorId:n,waitingSetAt:r}){const i=I(),[o,a]=q(""),[l,c]=q(""),[u,f]=q(!1),m=Vn.value,d=/^https?:\/\//i.test(m)?m:Fn,p=Cl(),x=Al();async function k(b){if(b.preventDefault(),!u){f(!0);try{await p({sessionId:e,visitorId:n,formMessageId:t,visitorName:o.trim(),visitorEmail:l.trim(),locale:ut.value})}catch(v){ne.error("[FormMessage] Submit failed:",v),f(!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:b=>{k(b)},children:[s("input",{class:"jex-form-input",type:"text",placeholder:i.escalationNameLabel,value:o,required:!0,disabled:u,onInput:b=>{a(b.currentTarget.value)}}),s("input",{class:"jex-form-input",type:"email",placeholder:i.escalationEmailLabel,value:l,required:!0,disabled:u,onInput:b=>{c(b.currentTarget.value)}}),s("button",{class:"jex-form-submit",type:"submit",disabled:u,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:d,target:"_blank",rel:"noopener noreferrer",class:"jex-privacy-notice-link",children:i.escalationPrivacyLinkText}),"."]})]})}function Np(){return Bt(Ce.functions.magicline.public.submitForm)}function Mp(){return zn(Ce.functions.magicline.actions.getTrialConfig)}function Op(){return zn(Ce.functions.magicline.actions.listTrialSlots)}function Lp(){return zn(Ce.functions.magicline.actions.getRateBundles)}function Rl(){return zn(Ce.functions.magicline.actions.getContractPreview)}function $p(){return zn(Ce.functions.magicline.actions.submitContractCreation)}const bo={en:Ui,de:ps},Dp=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function El(t){return Dp.test(t.trim())}function qp(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 Il(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 Pl(){const t=Vn.value;return/^https?:\/\//i.test(t)?t:Fn}const zp={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},Up=15,Bp=34;function Nl(t){return t.replace(/\s+/g,"").toUpperCase()}function Fp(t){const e=Nl(t),n=e.slice(0,2),r=zp[n];if(r!==void 0){if(e.length!==r)return!1}else if(e.length<Up||e.length>Bp)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 Vp(t){const e=Nl(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 et(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 Gr(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 Hp(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 yo(t,e,n){const r=bo[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 Wp(t,e,n,r,i){const o=bo[i],a=et(t,e,i);switch(n){case"TERM_BASED":return`${a} ${o.magiclineModulePerTerm}`;case"RECURRING":return`${a} ${yo(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 Qp(t,e,n,r){return e==="PERCENTAGE"?`-${t}%`:`-${et(t,n,r)}`}const Gp={startpaket:"magiclineFeeStarterPackage","starter package":"magiclineFeeStarterPackage",trainerpauschale:"magiclineFeeTrainerFee"};function Ml(t,e){const n=t.trim().toLowerCase(),r=Gp[n];return r!==void 0?e[r]:t}function Kp(t,e,n){const r=bo[n];if(t==="NONE")return r.magiclineRenewalNone;if(t==="TERM_EXTENSION"&&e!==null){const i=Gr(e.value,e.unit,n);return r.magiclineRenewalTerm.replace("{n} {unit}",i)}return""}const Ol=["MALE","FEMALE","UNISEX"],Yp=[{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 Jp(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 Zp={firstName:"",lastName:"",email:"",phone:"",birthDate:"",gender:"",street:"",houseNumber:"",zip:"",city:"",country:"",note:"",slotId:"",consent:!1,trainerRequired:!0};function Xp(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 em({sessionId:t,visitorId:e}){const n=Mp(),r=Op(),[i,o]=De(Xp,Zp),[a,l]=De((v,w)=>w,{phase:"loading"}),[c,u]=De((v,w)=>w,{phase:"loading"}),[f,m]=De(v=>v+1,0),d=G((v,w)=>{o({type:"set",key:v,value:w})},[]),p=G(v=>{o({type:"setTrainer",trainerRequired:v}),m()},[]),x=G(()=>{m()},[]);M(()=>{let v=!1;return(async()=>{try{const w=await n({sessionId:t,visitorId:e});if(v)return;w.status==="ok"?l({phase:"ready",config:{plan:w.plan,minimumAge:w.minimumAge,bookingWithoutTrainerAllowed:w.bookingWithoutTrainerAllowed,studioZoneId:w.studioZoneId}}):l({phase:"error",code:w.status,backendMessage:w.message})}catch{v||l({phase:"error",code:"unavailable",backendMessage:""})}})(),()=>{v=!0}},[n,t,e]);const k=a.phase==="ready",{trainerRequired:b}=i;return M(()=>{if(!k)return;let v=!1;return u({phase:"loading"}),(async()=>{try{const w=await r({sessionId:t,visitorId:e,trainerRequired:b});if(v)return;w.status==="ok"?w.slots.length>0?(u({phase:"ready",slots:w.slots}),o({type:"clearSlotIfAbsent",available:w.slots.map(R=>R.startDateTime)})):u({phase:"empty"}):u({phase:"error"})}catch{v||u({phase:"error"})}})(),()=>{v=!0}},[k,r,t,e,b,f]),{fields:i,setField:d,setTrainerRequired:p,configState:a,slotsState:c,refetchSlots:x}}function tm({formMessageId:t,sessionId:e,visitorId:n,slotUnavailable:r=!1,retryPending:i=!1}){const o=I(),a=Np(),{fields:l,setField:c,setTrainerRequired:u,configState:f,slotsState:m,refetchSlots:d}=em({sessionId:e,visitorId:n});return f.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})]}):f.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:cm(f.code,f.backendMessage,o)})]}):s(nm,{formMessageId:t,sessionId:e,visitorId:n,slotUnavailable:r,retryPending:i,config:f.config,fields:l,setField:c,setTrainerRequired:u,slotsState:m,refetchSlots:d,submitForm:a})}function nm({formMessageId:t,sessionId:e,visitorId:n,slotUnavailable:r,retryPending:i,config:o,fields:a,setField:l,setTrainerRequired:c,slotsState:u,refetchSlots:f,submitForm:m}){const d=I(),{plan:p,minimumAge:x,bookingWithoutTrainerAllowed:k,studioZoneId:b}=o,v=fe(()=>Jp(p,k),[p,k]),w=r?Math.max(v.indexOf("slot"),0):0,[R,y]=q(w),[E,N]=q({}),[L,Y]=q(!1),[ue,W]=q(null),de=fe(()=>Pl(),[]),ae=Math.min(R,v.length-1),S=v[ae],X=ae===v.length-1,Ue=ae===0;function tt(se){const D={};if(se==="slot")return a.slotId===""&&(D.slotId=d.magiclineSlotRequiredError),D;if(se==="personal"){if(a.firstName.trim()===""&&(D.firstName=d.magiclineRequiredError),a.lastName.trim()===""&&(D.lastName=d.magiclineRequiredError),p.email.visible&&p.email.required&&a.email.trim()===""&&(D.email=d.magiclineRequiredError),a.email.trim()!==""&&!El(a.email)&&(D.email=d.magiclineEmailError),p.phone.visible&&p.phone.required&&a.phone.trim()===""&&(D.phone=d.magiclineRequiredError),p.gender.visible&&p.gender.required&&a.gender===""&&(D.gender=d.magiclineRequiredError),p.dateOfBirth.visible&&(p.dateOfBirth.required&&a.birthDate.trim()===""&&(D.birthDate=d.magiclineRequiredError),a.birthDate.trim()!=="")){const Le=qp(a.birthDate);Le!==null&&Le<0?D.birthDate=d.magiclineRequiredError:x>0&&Le!==null&&Le<x&&(D.birthDate=d.magiclineMinAgeError.replace("{age}",String(x)))}return D}return se==="address"?(p.address.visible&&p.address.required&&(a.street.trim()===""&&(D.street=d.magiclineRequiredError),a.houseNumber.trim()===""&&(D.houseNumber=d.magiclineRequiredError),a.city.trim()===""&&(D.city=d.magiclineRequiredError),a.country===""&&(D.country=d.magiclineRequiredError)),p.zip.visible&&p.zip.required&&a.zip.trim()===""&&(D.zip=d.magiclineRequiredError),D):(se==="confirm"&&(a.consent||(D.consent=d.magiclineConsentError)),D)}function mt(){const se=tt(S);if(Object.keys(se).length>0){N(se);return}N({}),y(D=>Math.min(D+1,v.length-1))}function Lt(){N({}),W(null),y(se=>Math.max(se-1,0))}async function _t(){if(L)return;const se=tt("confirm");if(Object.keys(se).length>0){N(se);return}N({}),W(null),Y(!0);try{const D=um(p,a);await m({sessionId:e,visitorId:n,formMessageId:t,action:"trialSessionBooking",fields:D})}catch(D){ne.error("[TrialSessionBookingForm] Submit failed:",D),W(d.magiclineFailedDetail),Y(!1)}}function Gt(){X?_t():mt()}const J=lm(S,d),We=`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:d.magiclineTrialTitle}),s("div",{class:"jex-magicline-wizard-progress",children:[s("span",{class:"jex-magicline-wizard-step-label",children:J}),s("span",{class:"jex-magicline-wizard-counter",children:d.magiclineStepCounter.replace("{n}",String(ae+1)).replace("{total}",String(v.length))})]}),s("div",{class:"jex-magicline-wizard-dots","aria-hidden":"true",children:v.map((se,D)=>s("span",{class:D===ae?"jex-magicline-wizard-dot jex-magicline-wizard-dot-active":"jex-magicline-wizard-dot"},se))})]}),s("div",{class:"jex-form",role:"group","aria-label":J,children:[S==="trainer"?s(rm,{formMessageId:t,trainerRequired:a.trainerRequired,disabled:L,onChange:c}):null,S==="slot"?s(im,{slotsState:u,slotId:a.slotId,studioZoneId:b,disabled:L,retryPending:i,slotUnavailable:r,error:E.slotId,onSelect:se=>{l("slotId",se)},onRetry:f}):null,S==="personal"?s(om,{plan:p,fields:a,errors:E,disabled:L,setField:l}):null,S==="address"?s(am,{plan:p,fields:a,errors:E,disabled:L,setField:l}):null,S==="confirm"?s(sm,{consentId:We,privacyUrl:de,studioZoneId:b,fields:a,disabled:L,consentError:E.consent,setField:l}):null,ue!==null?s("div",{class:"jex-magicline-error",role:"alert",children:ue}):null,s("div",{class:"jex-magicline-wizard-nav",children:[Ue?null:s("button",{type:"button",class:"jex-magicline-wizard-back",disabled:L,onClick:Lt,children:d.magiclineWizardBack}),s("button",{type:"button",class:"jex-form-submit jex-magicline-wizard-next",disabled:L,onClick:Gt,children:X?L?d.magiclineSubmitting:d.magiclineSubmit:d.magiclineWizardNext})]})]})]})}function rm({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 im({slotsState:t,slotId:e,studioZoneId:n,disabled:r,retryPending:i,slotUnavailable:o,error:a,onSelect:l,onRetry:c}){const u=I();return s(Z,{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:f=>{l(f.currentTarget.value)},children:[s("option",{value:"",disabled:!0,children:u.magiclineSlotPlaceholder}),t.slots.map(f=>s("option",{value:f.startDateTime,children:$l(f.startDateTime,ut.value,n)},f.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 om({plan:t,fields:e,errors:n,disabled:r,setField:i}){const o=I(),a=fe(()=>Il(),[]);return s(Z,{children:[s("div",{class:"jex-magicline-row",children:[s(Mt,{label:o.magiclineFirstName,value:e.firstName,required:!0,disabled:r,error:n.firstName,fieldKey:"firstName",onInput:l=>{i("firstName",l)}}),s(Mt,{label:o.magiclineLastName,value:e.lastName,required:!0,disabled:r,error:n.lastName,fieldKey:"lastName",onInput:l=>{i("lastName",l)}})]}),t.email.visible?s(Mt,{label:He(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(Mt,{label:He(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:He(o.magiclineBirthDate,t.dateOfBirth.required,o)}),s("input",{class:"jex-form-input",type:"date","aria-label":He(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(Ll,{label:He(o.magiclineGender,t.gender.required,o),value:e.gender,required:t.gender.required,disabled:r,placeholder:He(o.magiclineGenderPlaceholder,t.gender.required,o),error:n.gender,onChange:l=>{i("gender",l)},options:Ol.map(l=>({value:l,label:dm(l,o)}))}):null]})}function am({plan:t,fields:e,errors:n,disabled:r,setField:i}){const o=I();return s(Z,{children:[t.address.visible?s(Z,{children:[s("div",{class:"jex-magicline-row",children:[s(Mt,{label:He(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(Mt,{label:He(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(Mt,{label:He(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(Ll,{label:He(o.magiclineCountry,t.address.required,o),value:e.country,required:t.address.required,disabled:r,placeholder:He(o.magiclineCountryPlaceholder,t.address.required,o),error:n.country,onChange:a=>{i("country",a)},options:Yp.map(a=>({value:a.code,label:a.label}))})]}):null,t.zip.visible?s(Mt,{label:He(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 sm({consentId:t,privacyUrl:e,studioZoneId:n,fields:r,disabled:i,consentError:o,setField:a}){const l=I(),c=r.slotId!==""?$l(r.slotId,ut.value,n):"—",u=`${r.firstName} ${r.lastName}`.trim();return s(Z,{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:f=>{a("note",f.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:f=>{a("consent",f.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 Mt({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 Ll({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 He(t,e,n){return e?t:t+n.magiclineOptionalSuffix}function lm(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 cm(t,e,n){return e.trim()!==""?e:t==="unsupported"?n.magiclineConfigUnsupported:t==="inconsistent"?n.magiclineConfigInconsistent:n.magiclineConfigUnavailable}function um(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 dm(t,e){return t==="MALE"?e.magiclineGenderMale:t==="FEMALE"?e.magiclineGenderFemale:e.magiclineGenderUnisex}function $l(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"})}}const hm={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 fm(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 Dl={draftVoucherCode:"",appliedVoucherCode:null,appliedVoucher:null,voucherStatus:"idle",voucherRequestId:0,voucherUnavailable:!1},pm="voucher:";function mm(t){const e={};for(const n of Object.keys(t))n.startsWith(pm)||(e[n]=t[n]);return e}function gm(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 xm(t,e){switch(e.type){case"dropVoucherAcks":{const n=mm(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 fm(t,e)}}function bm({sessionId:t,visitorId:e}){const n=Lp(),r=Rl(),[i,o]=De(xm,hm),[a,l]=De(gm,Dl),[c,u]=De((T,C)=>C,{phase:"loading"}),f=qe(null),[m,d]=De((T,C)=>C,{phase:"idle"}),p=G(T=>{T.phase==="ready"?f.current=T.pricing:(T.phase==="idle"||T.phase==="error")&&(f.current=null),d(T)},[]),[x,k]=De(T=>T+1,0),[b,v]=De(T=>T+1,0),w=G(T=>{o({type:"setTermId",termId:T}),l({type:"CLEAR_VOUCHER"})},[]),R=G((T,C)=>{o({type:"setPersonal",key:T,value:C})},[]),y=G((T,C)=>{o({type:"setAddress",key:T,value:C})},[]),E=G((T,C,Ge)=>{o({type:"toggleModule",moduleId:T,selected:C,consentAckKey:Ge}),o({type:"dropVoucherAcks"}),l({type:"CLEAR_VOUCHER"})},[]),N=G((T,C)=>{o({type:"setBlockAck",ackKey:T,value:C})},[]),L=G(T=>{o({type:"setAccountHolder",value:T})},[]),Y=G(T=>{o({type:"setIban",value:T})},[]),ue=G((T,C)=>{o({type:"setConsent",key:T,value:C})},[]),W=G(()=>{o({type:"clearIban"})},[]),de=G(()=>{o({type:"clearTermId"}),l({type:"CLEAR_VOUCHER"})},[]),ae=G(T=>{l({type:"SET_VOUCHER_DRAFT",value:T}),o({type:"dropVoucherAcks"})},[]),S=qe(Dl.voucherRequestId),X=G(()=>{const T=S.current+1;return S.current=T,l({type:"VOUCHER_APPLYING"}),T},[]),Ue=G(T=>{T.requestId===S.current&&(l({type:"VOUCHER_APPLIED",requestId:T.requestId,voucher:T.voucher,appliedCode:T.appliedCode,voucherAckKeys:T.voucherAckKeys}),p({phase:"ready",pricing:T.pricing}),o({type:"seedVoucherAcks",ackKeys:T.voucherAckKeys}))},[]),tt=G(()=>{l({type:"VOUCHER_INVALID"}),o({type:"dropVoucherAcks"}),v()},[]),mt=G(()=>{l({type:"VOUCHER_DISABLED"}),o({type:"dropVoucherAcks"}),v()},[]),Lt=G(()=>{l({type:"CLEAR_VOUCHER"}),o({type:"dropVoucherAcks"}),v()},[]),_t=G(()=>{k()},[]),Gt=G(()=>{p({phase:"idle"})},[]),J=G(()=>{v()},[]),We=c.phase==="ready"&&i.termId!==null?c.terms.find(T=>T.termId===i.termId)??null:null,{selectedModuleIds:se,acknowledgedBlocks:D}=i,{appliedVoucher:Le}=a,nt=fe(()=>{if(We===null)return[];const T=new Set;for(const C of We.textBlocks)C.isConfirmationRequired&&T.add(C.ackKey);for(const C of se){const Ge=We.optionalModules.find(Q=>Q.id===C);Ge?.consent&&T.add(Ge.consent.ackKey)}if(Le!==null)for(const C of Le.textBlocks)T.add(C.ackKey);return[...T]},[We,se,Le]),Kt=fe(()=>nt.every(T=>D[T]===!0),[nt,D]),{firstName:be,lastName:Qe}=i.personal,{accountHolder:Se,accountHolderTouched:K}=i.payment;return M(()=>{K||Se!==""||be.trim()!==""&&Qe.trim()!==""&&o({type:"prefillAccountHolder",value:`${be.trim()} ${Qe.trim()}`})},[be,Qe,Se,K]),M(()=>{let T=!1;return u({phase:"loading"}),(async()=>{try{const C=await n({sessionId:t,visitorId:e});if(T)return;C.status==="ok"?C.terms.length>0?u({phase:"ready",terms:C.terms,allowVoucherCodes:C.allowVoucherCodes}):u({phase:"empty"}):u({phase:"error"})}catch{T||u({phase:"error"})}})(),()=>{T=!0}},[n,t,e,x]),M(()=>{if(b===0)return;const T=We;if(!T){p({phase:"error",code:"offer_unavailable"});return}let C=!1;const Ge=f.current;p(Ge!==null?{phase:"reloading",pricing:Ge}:{phase:"loading"});const Q=T.defaultContractStartDate??"",jt={sessionId:t,visitorId:e,termId:T.termId,startDate:Q,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:T.optionalModules.filter(ee=>i.selectedModuleIds.includes(ee.id)).map(ee=>ee.id),privacyConsent:i.consents.privacy,sepaConsent:i.consents.sepa};return(async()=>{try{const ee=await r(jt);if(C)return;ee.status==="ok"?p({phase:"ready",pricing:{basePrice:ee.basePrice,preUseCharge:ee.preUseCharge,currencyCode:ee.currencyCode,flatFees:ee.flatFees,modules:ee.modules,contractVolume:ee.contractVolume,startDate:ee.startDate,paymentFrequency:ee.paymentFrequency,fingerprint:ee.pricingFingerprint}}):p({phase:"error",code:ee.status})}catch{C||p({phase:"error",code:"unavailable"})}})(),()=>{C=!0}},[b,r,t,e]),{fields:i,offersState:c,previewState:m,selectedTerm:We,requiredAckKeys:nt,allAcknowledged:Kt,serverAllowVoucherCodes:c.phase==="ready"?c.allowVoucherCodes:!1,voucherStatus:a.voucherStatus,draftVoucherCode:a.draftVoucherCode,appliedVoucherCode:a.appliedVoucherCode,appliedVoucher:a.appliedVoucher,voucherUnavailable:a.voucherUnavailable,setTermId:w,setPersonal:R,setAddress:y,toggleModule:E,setBlockAck:N,setAccountHolder:L,setIban:Y,setConsent:ue,clearIban:W,clearTermId:de,refetchOffers:_t,fetchPreview:J,resetPreview:Gt,setVoucherDraft:ae,beginVoucherApply:X,commitVoucherApplied:Ue,markVoucherInvalid:tt,markVoucherDisabled:mt,clearVoucher:Lt}}function ym(t){return t!==null&&t.optionalModules.length>0?["offer","upgrades","personal","address","payment","review"]:["offer","personal","address","payment","review"]}function vm({formMessageId:t,sessionId:e,visitorId:n,projectId:r,formStatus:i}){const o=I(),a=ut.value,l=$p(),c=Rl(),u=bm({sessionId:e,visitorId:n}),{fields:f,offersState:m,previewState:d,selectedTerm:p,requiredAckKeys:x,allAcknowledged:k,serverAllowVoucherCodes:b,voucherStatus:v,draftVoucherCode:w,appliedVoucher:R,appliedVoucherCode:y,voucherUnavailable:E,setTermId:N,setPersonal:L,setAddress:Y,toggleModule:ue,setBlockAck:W,setAccountHolder:de,setIban:ae,setConsent:S,clearIban:X,clearTermId:Ue,refetchOffers:tt,fetchPreview:mt,resetPreview:Lt,setVoucherDraft:_t,beginVoucherApply:Gt,commitVoucherApplied:J,markVoucherInvalid:We,markVoucherDisabled:se}=u,[D,Le]=q(0),[nt,Kt]=q({}),[be,Qe]=q(!1),[Se,K]=q(null),[T,C]=q(null),[Ge,Q]=q(null),jt=fe(()=>Pl(),[]);if(Se!==null&&Se.status==="succeeded")return s(ql,{customerNumber:Se.customerNumber});if(Se!==null&&Se.status==="failed"&&!Se.retryable){const V=Se.errorCode==="duplicate_submission"?o.magiclineDuplicateNotice:Se.errorCode==="unknown_outcome"?o.magiclineUnknownOutcome:Se.errorCode==="live_submission_disabled"?o.magiclineLiveSubmissionDisabled:o.magiclineFailedDetail;return s(zl,{message:V})}if(Se===null&&!be&&i==="submitted")return s(ql,{customerNumber:null});if(Se===null&&!be&&i==="failed")return s(zl,{message:o.magiclineFailedDetail});const ee=fe(()=>ym(p),[p]),Ie=Math.min(D,ee.length-1),Be=ee[Ie],yn=Ie===ee.length-1,Yr=Ie===0;function Jr(V){const $={};if(V==="offer")return f.termId===null&&($.termId=o.magiclineOfferRequiredError),$;if(V==="upgrades"){if(p!==null)for(const le of f.selectedModuleIds){const rt=p.optionalModules.find(he=>he.id===le);if(rt?.consent&&f.acknowledgedBlocks[rt.consent.ackKey]!==!0){$.upgrades=o.magiclineUpgradeConsentError;break}}return $}if(V==="personal"){const le=f.personal;return le.firstName.trim()===""&&($.firstName=o.magiclineRequiredError),le.lastName.trim()===""&&($.lastName=o.magiclineRequiredError),le.email.trim()===""?$.email=o.magiclineRequiredError:El(le.email)||($.email=o.magiclineEmailError),le.dateOfBirth.trim()===""&&($.dateOfBirth=o.magiclineRequiredError),le.gender===""&&($.gender=o.magiclineRequiredError),le.phone.trim()===""&&($.phone=o.magiclineRequiredError),$}if(V==="address"){const le=f.address;return le.street.trim()===""&&($.street=o.magiclineRequiredError),le.houseNumber.trim()===""&&($.houseNumber=o.magiclineRequiredError),le.zipCode.trim()===""&&($.zipCode=o.magiclineRequiredError),le.city.trim()===""&&($.city=o.magiclineRequiredError),$}return V==="payment"&&(f.payment.accountHolder.trim()===""&&($.accountHolder=o.magiclineRequiredError),Fp(f.payment.iban)||($.iban=o.magiclineIbanInvalidError),f.consents.privacy||($.privacy=o.magiclineConsentError),f.consents.sepa||($.sepa=o.magiclineConsentError)),$}function gt(){const V=Jr(Be);if(Object.keys(V).length>0){Kt(V);return}Kt({}),C(null);const $=Math.min(Ie+1,ee.length-1);ee[$]==="review"&&mt(),Le($)}function Yt(){Kt({}),C(null),Be==="review"&&Lt(),Le(V=>Math.max(V-1,0))}function St(){C(null),mt()}async function ar(){if(!be&&!(d.phase!=="ready"||p===null)){if(!k){C(o.magiclineConfirmRequiredError);return}Qe(!0),C(null);try{const V=await l({sessionId:e,visitorId:n,projectId:r,formMessageId:t,fields:{firstname:f.personal.firstName.trim(),lastname:f.personal.lastName.trim(),email:f.personal.email.trim(),phone:f.personal.phone.trim(),dateOfBirth:f.personal.dateOfBirth.trim(),gender:f.personal.gender,street:f.address.street.trim(),houseNumber:f.address.houseNumber.trim(),zipCode:f.address.zipCode.trim(),city:f.address.city.trim(),rateBundleTermId:p.termId,privacyConsent:f.consents.privacy,sepaConsent:f.consents.sepa},bankAccount:{accountHolder:f.payment.accountHolder.trim(),iban:f.payment.iban},selectedModuleIds:p.optionalModules.filter($=>f.selectedModuleIds.includes($.id)).map($=>$.id),acknowledgedAckKeys:x,pricingFingerprint:d.pricing.fingerprint,voucherCode:y??void 0});if(V.status==="succeeded"){K(V);return}if(V.errorCode==="price_changed"){C(o.magiclinePriceChangedNotice),mt(),Qe(!1);return}if(V.errorCode==="offer_unavailable"){Ue(),tt(),Lt(),C(o.magiclineOfferUnavailableNotice),Le(0),Qe(!1);return}if(V.errorCode==="confirmation_required"){C(o.magiclineConfirmationRequiredNotice),Qe(!1);return}if(V.errorCode==="live_submission_disabled"){K(V);return}if(!V.retryable){K(V);return}X(),C(V.message!==""?V.message:o.magiclineFailedDetail),Qe(!1)}catch(V){ne.error("[ContractCreationForm] Submit failed:",V),X(),C(o.magiclineFailedDetail),Qe(!1)}}}async function sr(){if(d.phase!=="ready"||p===null||w.trim()==="")return;const V=w.trim(),$=Gt();Q(null);const le=he=>{We(),_t(""),Q(he)},rt=o.magiclineVoucherInvalid.replace("{code}",V);try{const he=await c({sessionId:e,visitorId:n,termId:p.termId,startDate:p.defaultContractStartDate??"",fields:{firstname:f.personal.firstName.trim(),lastname:f.personal.lastName.trim(),email:f.personal.email.trim(),dateOfBirth:f.personal.dateOfBirth.trim(),gender:f.personal.gender,phone:f.personal.phone.trim(),street:f.address.street.trim(),houseNumber:f.address.houseNumber.trim(),zipCode:f.address.zipCode.trim(),city:f.address.city.trim()},selectedModuleIds:p.optionalModules.filter($e=>f.selectedModuleIds.includes($e.id)).map($e=>$e.id),privacyConsent:f.consents.privacy,sepaConsent:f.consents.sepa,voucherCode:w.trim()});if(he.status==="ok"){const $e=he.voucher;if($e!==null){const Ke=$e.textBlocks.map(cr=>cr.ackKey);J({requestId:$,voucher:$e,appliedCode:w.trim(),voucherAckKeys:Ke,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}})}else le(rt)}else he.status==="voucher_invalid"?le(rt):he.status==="voucher_disabled"?(se(),_t(""),Q(o.magiclineVoucherDisabled)):le(rt)}catch{le(rt)}}function lr(){yn?ar():gt()}const vn=Nm(Be,o),$t=v==="applying"||w.trim()!==""&&w.trim()!==(y??""),wn=Be==="review"&&(d.phase!=="ready"||!k||$t),kn=be||wn;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:vn}),s("span",{class:"jex-magicline-wizard-counter",children:o.magiclineStepCounter.replace("{n}",String(Ie+1)).replace("{total}",String(ee.length))})]}),s("div",{class:"jex-magicline-wizard-dots","aria-hidden":"true",children:ee.map((V,$)=>s("span",{class:$===Ie?"jex-magicline-wizard-dot jex-magicline-wizard-dot-active":"jex-magicline-wizard-dot"},V))})]}),s("div",{class:"jex-form",role:"group","aria-label":vn,children:[Be==="offer"?s(wm,{offersState:m,selectedTermId:f.termId,widgetLocale:a,disabled:be,error:nt.termId,onSelect:N,onRetry:tt}):null,Be==="upgrades"&&p!==null?s(jm,{modules:p.optionalModules,selectedModuleIds:f.selectedModuleIds,acknowledgedBlocks:f.acknowledgedBlocks,widgetLocale:a,disabled:be,error:nt.upgrades,onToggle:ue,onAck:W}):null,Be==="personal"?s(Tm,{personal:f.personal,errors:nt,disabled:be,setPersonal:L}):null,Be==="address"?s(Cm,{address:f.address,errors:nt,disabled:be,setAddress:Y}):null,Be==="payment"?s(Am,{formMessageId:t,fields:f,errors:nt,privacyUrl:jt,disabled:be,setAccountHolder:de,setIban:ae,setConsent:S}):null,Be==="review"?s(Rm,{fields:f,term:p,previewState:d,widgetLocale:a,disabled:be,acknowledgedBlocks:f.acknowledgedBlocks,onToggleAck:W,onRetry:St,allowVoucherCodes:b,voucherUnavailable:E,voucherStatus:v,draftVoucherCode:w,appliedVoucher:R,voucherBanner:Ge,onVoucherDraftChange:_t,onApplyVoucher:()=>{sr()}}):null,T!==null?s("div",{class:"jex-magicline-error",role:"alert",children:T}):null,s("div",{class:"jex-magicline-wizard-nav",children:[Yr?null:s("button",{type:"button",class:"jex-magicline-wizard-back",disabled:be,onClick:Yt,children:o.magiclineWizardBack}),s("button",{type:"button",class:"jex-form-submit jex-magicline-wizard-next",disabled:kn,onClick:lr,children:yn?be?o.magiclineSubmitting:o.magiclineSubmit:o.magiclineWizardNext})]})]})]})}function ql({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 zl({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 wm({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=Pm(t.terms);return s(Z,{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(f=>s(km,{term:f,checked:e===f.termId,widgetLocale:n,disabled:r,onSelect:o},f.termId)),s(_m,{subDescription:u.bundleSubDescription,footnote:u.footnote})]},u.bundleId))}),i!==void 0?s("div",{class:"jex-magicline-error",role:"alert",children:i}):null]})}function km({term:t,checked:e,widgetLocale:n,disabled:r,onSelect:i}){const o=I(),a=Gr(t.termValue,t.termUnit,n),l=et(t.price,t.currencyCode,n),c=t.flatFees.find(f=>f.isStarterPackage),u=t.flatFees.filter(f=>!f.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," ",yo(t.paymentFrequency.value,t.paymentFrequency.unit,n)]})]}),t.cancellationPeriod!==null?s("span",{class:"jex-magicline-offer-term-note",children:[o.magiclineCancellationPeriod,":"," ",Gr(t.cancellationPeriod.value,t.cancellationPeriod.unit,n)]}):null,c!==void 0?s("span",{class:"jex-magicline-offer-term-note",children:[o.magiclineStarterPackage,":"," ",et(c.price,t.currencyCode,n)]}):null,u.map(f=>s("span",{class:"jex-magicline-offer-term-note",children:[Ml(f.name,o),": ",et(f.price,t.currencyCode,n)]},f.name)),t.includedModuleNames.length>0?s("span",{class:"jex-magicline-offer-term-note",children:[o.magiclineIncludedModules,": ",t.includedModuleNames.join(", ")]}):null]})]})}function _m({subDescription:t,footnote:e}){const n=I(),r=Im(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 jm({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(Z,{children:[s("div",{class:"jex-magicline-slots-hint",children:c.magiclineUpgradesIntro}),s("div",{class:"jex-magicline-upgrade-group",children:t.map(u=>s(Sm,{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 Sm({module:t,selected:e,consentChecked:n,widgetLocale:r,disabled:i,onToggle:o,onAck:a}){const l=I(),c=Wp(t.price,t.currencyCode,t.paymentFrequencyType,t.recurringUnit,r),u=Kp(t.extensionType,t.termExtension,r),f=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:d=>{o(t.id,d.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:f}),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(vo,{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 Tm({personal:t,errors:e,disabled:n,setPersonal:r}){const i=I(),o=fe(()=>Il(),[]);return s(Z,{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(Em,{label:i.magiclineGender,value:t.gender,required:!0,disabled:n,placeholder:i.magiclineGenderPlaceholder,error:e.gender,onChange:a=>{r("gender",a)},options:Ol.map(a=>({value:a,label:Mm(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 Cm({address:t,errors:e,disabled:n,setAddress:r}){const i=I();return s(Z,{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 Am({formMessageId:t,fields:e,errors:n,privacyUrl:r,disabled:i,setAccountHolder:o,setIban:a,setConsent:l}){const c=I(),u=`jex-ml-privacy-${t}`,f=`jex-ml-sepa-${t}`;return s(Z,{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:f,children:[s("input",{id:f,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 Rm({fields:t,term:e,previewState:n,widgetLocale:r,disabled:i,acknowledgedBlocks:o,onToggleAck:a,onRetry:l,allowVoucherCodes:c,voucherUnavailable:u,voucherStatus:f,draftVoucherCode:m,appliedVoucher:d,voucherBanner:p,onVoucherDraftChange:x,onApplyVoucher:k}){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,w=n.phase==="reloading",R=v.contractVolume,y=`${t.personal.firstName} ${t.personal.lastName}`.trim(),E=t.address,N=[`${E.street} ${E.houseNumber}`.trim(),`${E.zipCode} ${E.city}`.trim(),b.magiclineCountryStatic].filter(S=>S!=="").join(", "),L=e!==null?`${e.bundleName} · ${Gr(e.termValue,e.termUnit,r)}`:"—",Y=e!==null?e.textBlocks.filter(S=>S.isConfirmationRequired):[],ue=e!==null?e.textBlocks.filter(S=>!S.isConfirmationRequired):[],W=e!==null?e.optionalModules.filter(S=>t.selectedModuleIds.includes(S.id)&&S.consent!==null).map(S=>({module:S,consent:S.consent})):[],de=d!==null?d.textBlocks.filter(S=>S.ackKey.startsWith("voucher:")):[],ae=c&&!u;return s("div",{class:"jex-magicline-review-wrap",children:[s("div",{class:w?"jex-magicline-review-body jex-magicline-review-body--reloading":"jex-magicline-review-body","aria-busy":w,children:[s("dl",{class:"jex-magicline-summary",children:[s("div",{class:"jex-magicline-summary-row",children:[s("dt",{children:b.magiclineReviewOffer}),s("dd",{children:L})]}),s("div",{class:"jex-magicline-summary-row",children:[s("dt",{children:b.magiclineReviewBasePrice}),s("dd",{children:[d!==null&&d.voucherType==="DISCOUNT"?et(d.discountedBasePrice,v.currencyCode,r):et(v.basePrice,v.currencyCode,r)," ",yo(v.paymentFrequency.value,v.paymentFrequency.unit,r)]})]}),d!==null&&d.voucherType==="DISCOUNT"?s("div",{class:"jex-magicline-summary-row jex-magicline-voucher-discount-row",children:[s("dt",{children:b.magiclineVoucherAppliedDiscount.replace("{discount}",Qp(d.discountValue,d.discountType,v.currencyCode,r))}),s("dd",{})]}):null,d!==null&&d.remarks!==null&&d.remarks!==""?s("div",{class:"jex-magicline-summary-row jex-magicline-voucher-remarks-row",children:[s("dt",{children:b.magiclineVoucherRemarks}),s("dd",{children:d.remarks})]}):null,v.flatFees.map((S,X)=>s("div",{class:"jex-magicline-summary-row",children:[s("dt",{children:Ml(S.name,b)}),s("dd",{children:et(S.price,v.currencyCode,r)})]},`${S.name}-${X}`)),v.preUseCharge>0?s("div",{class:"jex-magicline-summary-row",children:[s("dt",{children:b.magiclineReviewPreUseCharge}),s("dd",{children:et(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((S,X)=>s("div",{class:"jex-magicline-summary-row",children:[s("dt",{children:S.name}),s("dd",{children:et(S.amount,S.currencyCode,r)})]},`${S.moduleId}-${X}`))]}):null,R!==null&&R.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:d!==null&&d.voucherType==="DISCOUNT"?b.magiclineGesamtpreisBeforeDiscount:b.magiclineReviewContractVolume}),s("dd",{children:et(R.total,v.currencyCode,r)})]})}):null,d!==null&&d.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:Hp(v.startDate,r)})]}),s("div",{class:"jex-magicline-summary-row",children:[s("dt",{children:b.magiclineSummaryName}),s("dd",{children:y!==""?y:"—"})]}),s("div",{class:"jex-magicline-summary-row",children:[s("dt",{children:b.magiclineSummaryAddress}),s("dd",{children:N})]}),s("div",{class:"jex-magicline-summary-row",children:[s("dt",{children:b.magiclineReviewPayment}),s("dd",{children:Vp(t.payment.iban)})]})]}),ae?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||f==="applying",onInput:S=>{x(S.currentTarget.value)}}),s("button",{type:"button",class:"jex-magicline-voucher-apply",disabled:i||f==="applying"||m.trim()==="",onClick:k,children:b.magiclineVoucherApply})]}),p!==null?s("div",{class:"jex-magicline-error",role:"alert",children:p}):null]}):null,W.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}),W.map(({module:S,consent:X})=>s(Ul,{title:X.title!==""?X.title:S.name,text:X.text,attachmentLabel:X.attachmentLabel,attachmentUrl:X.attachmentUrl},X.ackKey))]}):null,Y.length>0||ue.length>0||de.length>0?s("div",{class:"jex-magicline-terms",role:"group","aria-label":b.magiclineReviewTerms,children:[Y.length>0||de.length>0?s("div",{class:"jex-magicline-terms-prompt",children:[b.magiclineConfirmPrompt,s("span",{class:"jex-magicline-required-pill",children:b.magiclineRequired})]}):null,Y.map(S=>s(vo,{ackKey:S.ackKey,title:S.title,text:S.text,attachmentLabel:S.attachmentLabel,attachmentUrl:S.attachmentUrl,checked:o[S.ackKey]===!0,disabled:i,onToggle:a},S.ackKey)),de.map(S=>s(vo,{ackKey:S.ackKey,title:S.title,text:S.text,attachmentLabel:S.attachmentLabel,attachmentUrl:S.attachmentUrl,checked:o[S.ackKey]===!0,disabled:i,onToggle:a},S.ackKey)),ue.map((S,X)=>s(Ul,{title:S.title,text:S.text,attachmentLabel:S.attachmentLabel,attachmentUrl:S.attachmentUrl},`${S.title}-${X}`))]}):null]}),w?s("div",{class:"jex-magicline-review-overlay","aria-hidden":"true",children:s("span",{class:"jex-magicline-review-spinner"})}):null]})}function vo({ackKey:t,title:e,text:n,attachmentLabel:r,attachmentUrl:i,checked:o,disabled:a,onToggle:l,showRequiredPill:c=!1}){const u=I(),f=`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:f,children:[s("input",{id:f,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(Z,{children:[" ",s("a",{href:i,target:"_blank",rel:"noopener noreferrer",class:"jex-privacy-notice-link",children:r!==null&&r!==""?r:i})]}):null]})]})]})]})}function Ul({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(Z,{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 Em({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 Im(t){return t===null?[]:t.split(`
|
|
78
|
-
`).map(e=>e.replace(/^\s*[-•]\s*/,"").trim()).filter(e=>e!=="")}function
|
|
79
|
-
${i.url}`:i.title,u=s(Z,{children:[typeof i.id=="number"?s("span",{class:"jex-source-id",children:i.id}):null,s("span",{class:"jex-source-type",children:Lm[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 Dm(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}function qm(){return s("div",{class:"jex-typing",children:[s("span",{}),s("span",{}),s("span",{})]})}const zm=/\s?\[\d+\]/g;function Kr(t){return t.replace(zm,"")}function Um(t){return t?.at(-1)?._creationTime??0}function Bm(t){return{id:t._id,content:Kr(t.content),role:t.role,authorName:t.authorName}}function Bl(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(Bm)}function Fl(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 Fm(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]}function Vm({conversations:t,greeting:e,botName:n,starterQuestions:r,onPickStarter:i,sessionNotFound:o,resumeFailed:a,onStartFresh:l,sessionId:c,visitorId:u}){const f=I(),m=qe(null),[d,p]=q(null),x=Um(t),k=Fm(t),b=Al(),v=qe(null);M(()=>{if(!u||!t)return;const y=t.at(-1);y&&y.role==="assistant"&&y.status!=="streaming"&&y._id!==v.current&&(v.current=y._id,Hi(u))},[t,u]),M(()=>{m.current?.scrollIntoView({behavior:"smooth"})},[t?.length,t?.at(-1)?.content]);const w=c===null||t!==void 0&&t.length===0,R=r.length>0&&!o&&!a&&w;return s("div",{class:"jex-chat-messages",children:[s(bn,{text:e,botName:n}),R?s(Ap,{questions:r,disabled:qr.value,onPick:i}):null,o&&a&&l?s("div",{class:"jex-session-prompt",children:[s("div",{class:"jex-session-prompt-text",children:f.sessionNotFoundPrompt}),s("button",{class:"jex-session-prompt-btn",type:"button",onClick:()=>{l()},children:f.startNewConversation})]}):o?s("div",{class:"jex-session-notice",children:f.sessionNotFound}):null,t?.map(y=>{if(y.contentType==="human-notice"){const L=y.noticeKind==="agent-joined"?f.noticeAgentJoined.replace("{name}",y.noticeData?.agentName??""):y.noticeKind==="human-requested"?f.noticeHumanRequested:y.noticeKind==="human-requested-form"?f.noticeHumanRequestedForm:y.noticeKind==="message-received"?f.noticeMessageReceived:y.noticeKind==="agent-handling"?f.noticeAgentHandling:y.noticeKind==="ai-resumed"?f.noticeAiResumed:y.content;return s(bn,{text:L,botName:n},y._id)}if(y.contentType==="escalation-form"&&c&&u)return lh.value==="screen"&&!y.formData?d===y._id?null:s("div",{class:"jex-inline-form jex-inline-form-card",children:[s("div",{class:"jex-inline-form-title",children:f.escalationPromptTitle}),s("div",{class:"jex-inline-form-subtitle",children:f.escalationPromptSubtitle}),s("button",{class:"jex-form-submit",type:"button",onClick:()=>{wt({id:"escalation-form",formMessageId:y._id,sessionId:c,visitorId:u,waitingSetAt:x})},children:f.escalationPromptSubmit}),s("button",{class:"jex-escalation-skip",type:"button",onClick:()=>{b({formMessageId:y._id,sessionId:c,visitorId:u,waitingSetAt:x}),p(y._id)},children:f.escalationSkip})]},y._id):s(Ip,{message:y,sessionId:c,visitorId:u,waitingSetAt:x},y._id);if(y.contentType==="magicline-form"&&c&&u)return s(Om,{message:y,sessionId:c,visitorId:u},y._id);if(y.contentType==="escalation-confirm"){const L=y.noticeKind==="escalation-confirmed"?f.noticeEscalationConfirmed.replace("{name}",y.noticeData?.visitorName??"").replace("{email}",y.noticeData?.visitorEmail??"").replace("{ref}",y.noticeData?.visitorId??""):y.content;return s(bn,{text:L,botName:n},y._id)}if(y.role==="user"){const L=Bl(y,t);return s(Ep,{id:`jex-msg-${y._id}`,text:y.content,botName:n,onQuote:()=>{Ji({id:y._id,content:y.content,role:"user"})},quoted:L,onQuotedClick:(Y,ue)=>{Fl(Y,ue.currentTarget)},agentNames:k},y._id)}const E={authorId:y.authorId,authorName:y.authorName,authorImage:y.authorImage};if(y.status==="streaming"&&y.content==="")return s(qm,{},y._id);if(y.status==="streaming")return s(bn,{id:`jex-msg-${y._id}`,text:Kr(y.content),streaming:!0,botName:n,...E},y._id);if(y.status==="error")return s(bn,{id:`jex-msg-${y._id}`,text:y.errorMessage??`${f.somethingWentWrong}. ${f.tryAgain}.`,error:!0,botName:n,...E},y._id);const N=Bl(y,t);return s("div",{children:[s(bn,{id:`jex-msg-${y._id}`,text:Kr(y.content),botName:n,onQuote:()=>{Ji({id:y._id,content:Kr(y.content),role:"assistant",authorName:y.authorName})},quoted:N,onQuotedClick:(L,Y)=>{Fl(L,Y.currentTarget)},...E}),y.sources&&y.sources.length>0?s($m,{sources:y.sources}):null]},y._id)}),s("div",{ref:m})]})}function Hm(){const t=I();function e(){const n=Yn.peek();n&&(qs(),wt({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 Vl({message:t}){const[e,n]=q(!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 Wm({sessionId:t,visitorId:e}){const n=Tr(Ce.functions.chat.public.conversations.listBySession,t&&e?{sessionId:t,visitorId:e}:"skip"),r=Tr(Ce.functions.chat.public.sessions.getSessionStatus,t&&e?{sessionId:t,visitorId:e}:"skip"),i=t!==null&&n===void 0,o=n?.some(a=>a.status==="streaming")??!1;return{conversations:n,sessionStatus:r??null,isLoading:i,isStreaming:o}}function Qm(t){const e=I(),n=qe(null),r=qe(null),[i,o]=q(!1);M(()=>{try{n.current=document.title}catch{}},[]),M(()=>{if(!t||t.length===0)return;const a=t[t.length-1];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 Gm({sessionId:t,visitorId:e}){const n=Bt(Ce.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 Km(){return Bt(Ce.functions.chat.public.helpdesk.createEscalationRequest)}function Hl({sessionId:t,visitorId:e,ensureSession:n,onSkipForm:r}){const i=I(),o=Km(),[a,l]=q(!1),[c,u]=q(null);async function f(){if(!a){l(!0),u(null);try{const m=t&&e?{sessionId:t,visitorId:e}:await n();if(!m)return;const d=Rt.value;if(!d)return;const p=await o({sessionId:m.sessionId,visitorId:m.visitorId,bootstrapToken:d,locale:ut.value});if(p.skipForm){r?.();return}wt({id:"escalation-form",formMessageId:p.formMessageId,sessionId:m.sessionId,visitorId:m.visitorId,waitingSetAt:p.waitingSetAt})}catch(m){const d=m instanceof Error?m.message:String(m);u(/RATE_LIMITED|Too many/.test(d)?i.handoffRateLimited:i.handoffFailed)}finally{l(!1)}}}return{requestHuman:f,busy:a,error:c}}function Ym({greeting:t,botName:e,starterQuestions:n,sessionId:r,visitorId:i,isLoading:o,sessionNotFound:a,resumeFailed:l,isOrgDeleted:c,ensureSession:u,startFresh:f}){const m=I(),{conversations:d,sessionStatus:p,isLoading:x,isStreaming:k}=Wm({sessionId:r,visitorId:i});Qm(d),Gm({sessionId:r,visitorId:i}),M(()=>{const E=Yn.peek();if(E===null||!d||d.length===0)return;const{waitingSetAt:N}=E;d.some(Y=>Y._creationTime>N&&(Y.noticeKind==="agent-joined"||!!Y.authorId))&&qs()},[d]);const b=Ds({sessionId:r,visitorId:i,ensureSession:u}),v=qe((()=>{const E=un.peek();return E!==null?E:Vi.peek()&&ze.peek()!==null?"resume":"fresh"})()).current,{requestHuman:w,error:R}=Hl({sessionId:r,visitorId:i,ensureSession:u});return M(()=>{v==="escalate"&&w()},[v]),M(()=>{un.value=null},[]),M(()=>{ze.peek()!==null&&u()},[u]),M(()=>{i&&Hi(i)},[i]),c?s("div",{class:"jex-chat-messages",children:s("div",{class:"jex-session-notice",children:m.chatNoLongerAvailable})}):v==="resume"&&(!r||x)?s(Vl,{message:m.resumeConversation}):s(Z,{children:[s(Vm,{conversations:d,greeting:t,botName:e,starterQuestions:n,onPickStarter:E=>{b(E)},sessionNotFound:a,resumeFailed:l,onStartFresh:f,sessionId:r,visitorId:i}),Yn.value!==null&&s(Hm,{}),R&&s("div",{class:"jex-session-error-notice",role:"alert",style:{margin:"8px 16px 0"},children:R}),s(Jh,{sessionId:r,visitorId:i,isLoading:o,isStreaming:k,sessionStatus:p,ensureSession:u,onStartFresh:f})]})}function Wl(t){return Tr(Ce.functions.chat.public.availability.getOrgAvailability,t?{orgSlug:t}:"skip")}function Ql(t){return t?.anyOnline?"online":t?.anyAway?"away":"offline"}function Jm({formMessageId:t,sessionId:e,visitorId:n,orgSlug:r}){const i=I(),o=Vn.value,a=/^https?:\/\//i.test(o)?o:Fn,[l,c]=q(""),[u,f]=q(""),m=Wl(r),d=m&&!m.anyOnline?i.escalationOfflineSubtitle:i.escalationSubtitle,p=Cl(),[x,k]=q(!1),[b,v]=q(null);async function w(R){R.preventDefault(),k(!0),v(null);try{await p({sessionId:e,visitorId:n,formMessageId:t,visitorName:l.trim(),visitorEmail:u.trim(),locale:ut.value}),Wi()}catch(y){ne.error("[EscalationFormScreen] Submit failed:",y),v(i.escalationSubmitFailed)}finally{k(!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:d}),b&&s("div",{class:"jex-form-error",role:"alert",children:b}),s("form",{class:"jex-form",onSubmit:R=>{w(R)},children:[s("input",{class:"jex-form-input",type:"text",placeholder:i.escalationNameLabel,value:l,required:!0,onInput:R=>{c(R.currentTarget.value)}}),s("input",{class:"jex-form-input",type:"email",placeholder:i.escalationEmailLabel,value:u,required:!0,onInput:R=>{f(R.currentTarget.value)}}),s("button",{class:"jex-form-submit",type:"submit",disabled:x,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 Gl({sessionId:t,visitorId:e,ensureSession:n,availability:r}){const i=I(),{requestHuman:o,busy:a,error:l}=Hl({sessionId:t,visitorId:e,ensureSession:n}),c=`jex-presence-dot--${Ql(r)}`,u=r?r.anyOnline?i.handoffAvailable:i.handoffOffline:i.talkToHuman;return s(Z,{children:[s("button",{class:"jex-header-handoff",type:"button",onClick:()=>{o()},disabled:a,"aria-label":i.talkToHumanAria,title:u,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 ${c}`,"aria-hidden":"true"})]}),l&&s("div",{class:"jex-handoff-error",role:"alert",children:l})]})}async function Zm(){const t=us.value;if(!t)return ne.warn("[JexityChat] Bootstrap refresh skipped — inputs missing"),{ok:!1,reason:"no-inputs"};const e=await qi(t.orgSlug,t.siteUrl,t.projSlug);if(!e.ok)return ne.warn("[JexityChat] Bootstrap refresh failed:",e.error),{ok:!1,reason:e.error};const n=e.token;return Rt.value=n,{ok:!0,token:n}}function Kl(t){return Yl(t)?"unauthorized":t instanceof Error&&/network|fetch|failed to fetch/i.test(t.message)?"network":"unknown"}function Yl(t){return t instanceof yr?t.data?.code==="UNAUTHORIZED_ORIGIN":!1}function Xm(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 eg(t,e){const n=qe(null),r=cn(!1),i=cn(!1),o=cn(!1),a=cn(null),l=Bt(Ce.functions.chat.public.sessions.createOrResume),c=async p=>{const x=await Xm();if(!x)return ne.warn("[JexityChat] No bootstrap token after 10s — session creation blocked."),fn.value="no-token",null;const k=w=>({orgSlug:t,...e?{projSlug:e}:{},visitorId:p,bootstrapToken:w,locale:ut.value,...Mr.value?{source:Mr.value}:{},...typeof window<"u"?{pagePath:window.location.pathname}:{}});Gi.value=!0;let b;try{try{b=await l(k(x))}catch(w){if(!Yl(w))throw w;const R=await Zm();if(!R.ok)return fn.value=R.reason==="rate_limited"?"network":"unauthorized",null;b=await l(k(R.token))}}finally{Gi.value=!1}fn.value=null,a.value=b.status;const v={sessionId:b.sessionId,visitorId:p};return n.current=v,{session:v,result:b}},u=G(async()=>{if(n.current)return n.current;if(o.value)return null;r.value=!0;const p=ze.value!==null,x=ze.value??vs();try{const k=await c(x);return k?(p&&k.result.isNew&&(i.value=!0,o.value=!0),k.session):null}catch(k){return ne.error("[JexityChat] Failed to create session:",k),fn.value=Kl(k),null}finally{r.value=!1}},[t,e,l,r,i,o]),f=G(()=>{n.current=null,i.value=!1,o.value=!1,Os(),hn.value=null},[i,o]);M(()=>uh(f),[f]);const m=G(async()=>{n.current=null,o.value=!1,i.value=!1,Os(),hn.value=null;const p=vs();r.value=!0;try{return(await c(p))?.session??null}catch(x){return ne.error("[JexityChat] Failed to create fresh session:",x),fn.value=Kl(x),null}finally{r.value=!1}},[t,e,l,r,i,o,a]),d=n.current;return{sessionId:d?.sessionId??null,visitorId:d?.visitorId??null,isLoading:r.value,sessionNotFound:i.value,resumeFailed:o.value,sessionStatus:a.value,isOrgDeleted:a.value==="org_deleted",ensureSession:u,startFresh:m,resetSession:f}}function tg({botName:t,availability:e,onResetSession:n}){const r=I(),[i,o]=q(""),a=e?.anyOnline===!0,l=Ql(e);function c(){Lr(),un.value="escalate",n(),ws(),wt({id:"chat"})}function u(){Lr(),un.value="fresh",n(),ws(),wt({id:"chat"})}function f(d){Lr(),un.value="resume",n(),ks(d),wt({id:"chat"})}function m(d){d.preventDefault();const p=i.trim().toUpperCase();p&&(Lr(),un.value="resume",n(),ks(p),wt({id:"chat"}))}return s("div",{class:"jex-home",children:[Wn.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(As,{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:[Te.value.length>0&&s(Z,{children:[s("span",{class:"jex-home-section-label",children:r.pickUpWhereLeftOff}),s("div",{class:"jex-home-history",children:Te.value.slice().reverse().map(d=>s("button",{class:"jex-home-resume-card",onClick:()=>{f(d.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:d.ref}),s("span",{class:"jex-home-resume-meta",children:r.resumeListTimestamp.replace("{minutes}",String(Math.max(1,Math.round((Date.now()-d.lastActivityAt)/6e4))))})]},d.ref))})]}),s("button",{class:"jex-home-new-btn",onClick:u,children:Te.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:d=>{o(d.currentTarget.value)}}),s("button",{class:"jex-home-lookup-submit",type:"submit",disabled:!i.trim(),children:r.resume})]})]})]})}function ng({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:()=>wt({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:()=>wt({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 rg(){const t=I(),[e,n]=q(""),[r,i]=q(""),[o,a]=q("");async function l(c){c.preventDefault(),Qi({id:"loading",message:t.submittingTicket}),await new Promise(f=>{setTimeout(f,1200)});const u="JEX-"+Math.random().toString(36).slice(2,8).toUpperCase();Qi({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 ig({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:()=>{oe.value=!1},children:e.done})]})}function og({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 Jl({greeting:t,starterQuestions:e,title:n,botName:r,orgSlug:i,availability:o,sessionId:a,visitorId:l,isLoading:c,sessionNotFound:u,resumeFailed:f,isOrgDeleted:m,ensureSession:d,startFresh:p,resetSession:x}){const k=Oe.value,b=k[k.length-1],v=[...k].reverse().find(w=>w.id==="confirmation");return s("div",{class:"jex-screen-container",children:[b.id==="home"&&s(tg,{botName:r,availability:o,onResetSession:x}),b.id==="selection"&&s(ng,{title:n}),b.id==="form"&&s(rg,{}),b.id==="escalation-form"&&s(Jm,{formMessageId:b.formMessageId,sessionId:b.sessionId,visitorId:b.visitorId,orgSlug:i,waitingSetAt:b.waitingSetAt}),b.id==="confirmation"&&v&&s(ig,{ticketRef:v.ref}),b.id==="chat"&&s(Ym,{greeting:t,botName:r,starterQuestions:e,sessionId:a,visitorId:l,isLoading:c,sessionNotFound:u,resumeFailed:f,isOrgDeleted:m,ensureSession:d,startFresh:p}),b.id==="loading"&&s(Vl,{message:b.message}),b.id==="error"&&s(og,{message:b.message,onRetry:()=>Qi({id:"loading"}),onBack:Wi})]})}function ag({options:t}){return Vd({orgSlug:t.orgSlug,projSlug:t.projSlug,preToken:t.bootstrapToken,convexUrl:t.convexUrl,preAllowedUrls:t.allowedUrls??[],preExcludedPaths:t.excludePaths}),Qd()?s(sg,{options:t}):null}function sg({options:t}){const e=Bd(t.orgSlug,t.projSlug,t.convexUrl,t.preloadedConfig);Zd(t.parentOrigin),M(()=>(oh(),sh(),()=>{Fi.value=!1}),[]);const{sessionId:n,visitorId:r,isLoading:i,sessionNotFound:o,resumeFailed:a,isOrgDeleted:l,ensureSession:c,startFresh:u,resetSession:f}=eg(t.orgSlug,t.projSlug),m=Wl(t.orgSlug),d=Dd(t,e.config),p=Et.value,x=Fi.value,k=e.config!==null||p!==void 0||e.settled,b=e.config!==null?d.sessionTimeoutMs:p!==void 0?p:d.sessionTimeoutMs;M(()=>{ut.value=ms(d.locale)},[d.locale]),M(()=>{Vn.value=d.privacyPolicyUrl??Fn,Oi.value=d.privacyNoticeStyle},[d.privacyNoticeStyle,d.privacyPolicyUrl]),M(()=>{if(!oe.value||d.mode==="embedded"||!window.matchMedia("(max-width: 480px), (pointer: coarse) and (max-width: 768px)").matches)return;const X=document.documentElement.style.overflow;return document.documentElement.style.overflow="hidden",()=>{document.documentElement.style.overflow=X}},[oe.value,d.mode]),M(()=>{if(x&&k&&d.mode!=="embedded"&&b!==null)try{return hh(b)}catch(S){ne.warn("[JexityChat] Idle-lock watcher failed to start:",S);return}},[x,d.mode,k,b]),M(()=>{if(!x||!k)return;const{activeRefPruned:S}=ah(b);S&&Yi()},[x,k,b]);const v=d.position==="bottom-left",w=d.colorScheme==="dark"||d.colorScheme==="light"?d.colorScheme:"",R=fh({...t,primaryColor:d.primaryColor,accentColor:d.accentColor,fontFamily:d.fontFamily,fontSize:d.fontSize,borderRadius:d.borderRadius,windowWidth:d.windowWidth,windowHeight:d.windowHeight,triggerOffsetX:d.triggerOffsetX,triggerOffsetY:d.triggerOffsetY}),y=d.mode==="embedded",E=t.trigger==="none",N=t.windowPosition==="middle-center",L=Oe.value,ue=L[L.length-1]?.id==="chat",W=e.config!==null||y||!!t.parentOrigin,de=W?R:{...R,visibility:"hidden"},ae=_h(t.orgSlug,t.projSlug);return M(()=>{if(y||E||!W||d.proactiveMode==="off"||Rs(ae))return;const S=t.proactiveAlreadyElapsed?0:d.proactiveDelaySeconds*1e3,X=window.setTimeout(()=>{const Ue=Sh({mode:d.proactiveMode,isOpen:oe.peek(),hasHistory:Vi.peek(),dismissed:Rs(ae)});Ue==="teaser"?Dr.value=!0:Ue==="open"&&(oe.value=!0)},S);return()=>{window.clearTimeout(X)}},[y,E,W,d.proactiveMode,d.proactiveDelaySeconds,ae,t.proactiveAlreadyElapsed]),s("div",{class:`jex-widget ${w}`.trim(),style:de,children:y?s("div",{class:"jex-embedded",children:[s(Ts,{title:d.title,rightAction:ue?s(Gl,{sessionId:n,visitorId:r,ensureSession:c,availability:m}):null,showClose:!y}),s(Jl,{greeting:d.greeting,starterQuestions:d.starterQuestions,title:d.title,botName:d.botName,orgSlug:t.orgSlug,projSlug:t.projSlug,availability:m,sessionId:n,visitorId:r,isLoading:i,sessionNotFound:o,resumeFailed:a,isOrgDeleted:l,ensureSession:c,startFresh:u,resetSession:f}),!d.hideBranding&&s(Cs,{})]}):s("div",{class:`jex-container${v?" jex-pos-left":""}`,children:[oe.value&&s("div",{class:`jex-chat-window${N?" jex-win-center":""}`,children:[s(Ts,{title:d.title,rightAction:ue?s(Gl,{sessionId:n,visitorId:r,ensureSession:c,availability:m}):null}),s(Jl,{greeting:d.greeting,starterQuestions:d.starterQuestions,title:d.title,botName:d.botName,orgSlug:t.orgSlug,projSlug:t.projSlug,availability:m,sessionId:n,visitorId:r,isLoading:i,sessionNotFound:o,resumeFailed:a,isOrgDeleted:l,ensureSession:c,startFresh:u,resetSession:f}),!d.hideBranding&&s(Cs,{})]}),Dr.value&&!oe.value&&!E&&s(Th,{title:d.title,message:d.greeting,guardKey:ae}),!E&&s(kh,{iconOption:d.triggerIcon,radius:d.triggerRadius,label:d.triggerLabel})]})})}const lg=`.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 h3{font-size:16px;font-weight:600;color:var(--jex-text-header);margin:0}.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 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:hover{transform:scale(1.08)}.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-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:1 0 100%;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:1 0 100%;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 cg(t){const e=document.createElement("style");e.textContent=lg,t.appendChild(e)}const ug="https://festive-mouse-978.eu-west-1.convex.cloud";let wo=null;function dg(t){const e=t??ug;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 wo||(wo=new yd(Ld(e))),wo}function hg(t,e){const n=t.shadowRoot??t.attachShadow({mode:"open"});for(;n.firstChild;)n.removeChild(n.firstChild);cg(n),Mr.value=e.source,Rt.value=e.bootstrapToken,Oe.value=[{id:"home"}],e.mode==="embedded"&&(t.classList.add("jex-mode-embedded"),oe.value=!0);const r=document.createElement("div");return e.mode==="embedded"&&(r.style.cssText="width:100%;height:100%"),n.appendChild(r),qt(s(wd,{client:dg(e.convexUrl),children:s(ag,{options:e})}),r),function(){qt(null,r),oe.value=!1,Mr.value=void 0,Rt.value=void 0,Oe.value=[{id:"home"}]}}function fg(t,e,n){const r=hg(t,e),i=new Set,o=oe.subscribe(l=>{for(const c of i)c(l)});return{shutdown(){o(),i.clear(),r(),n&&n()},open(){oe.value=!0},close(){oe.value=!1},toggle(){oe.value=!oe.value},get isOpen(){return oe.value},subscribe(l){return i.add(l),()=>{i.delete(l)}}}}let or=null;function pg(t){or&&or.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=fg(e,t,()=>{t.container||e.remove(),or===n&&(or=null)});return or=n,n}function Ot(t,e){return t.getAttribute(e)??void 0}function Zl(t,e){const n=t.getAttribute(e);if(!n)return;const r=parseInt(n,10);return Number.isNaN(r)?void 0:r}async function Xl(){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=Ot(t,"data-convex-url")??"https://festive-mouse-978.eu-west-1.convex.cloud"??"",i=Di(r),o=await qi(e,i,n);if(!o.ok){const l=window.location.origin,c=n?`project '${e}/${n}'`:`org '${e}'`;o.error==="unauthorized"?ne.warn(`[JexityChat] This domain is not authorized for ${c}. Add '${l}' under Allowed Domains in your Jexity dashboard.`):o.error==="not_found"?ne.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"?ne.warn(`[JexityChat] Bootstrap rate-limited for ${c}. Retry after ${o.retryAfterSec??60}s.`):ne.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=>zi(window.location.href,l))){const l=n?`project '${e}/${n}'`:`org '${e}'`;ne.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,position:Ot(t,"data-position")??void 0,theme:Ot(t,"data-theme")??void 0,greeting:Ot(t,"data-greeting"),title:Ot(t,"data-title"),primaryColor:Ot(t,"data-primary-color"),locale:Ot(t,"data-locale"),convexUrl:Ot(t,"data-convex-url"),triggerOffsetX:Zl(t,"data-trigger-offset-x"),triggerOffsetY:Zl(t,"data-trigger-offset-y")};window.JexityChat=pg(a)}document.readyState==="complete"?Xl():window.addEventListener("load",Xl)})();
|
|
81
|
+
`).trim()}}).filter(e=>(e.title!==""||e.body!=="")&&!/^-{3,}$/.test(e.title))}function Ep(t){const e=Rp(t);return e.length===0?"":`<div class="jex-card-grid">${e.map(r=>{const i=r.title?`<div class="jex-card-title">${W.parseInline(r.title)}</div>`:"",o=r.body?W.parse(r.body):"";return`<div class="jex-card">${i}${o}</div>`}).join("")}</div>`}W.setOptions({breaks:!0,gfm:!0});function Gr(t){return t.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}W.use({renderer:{code(t){return t.lang==="cards"&&t.raw.trimEnd().endsWith("```")?Ep(t.text):!1},image(t){const e=t.href??"",n=`<img src="${Gr(e)}" alt="${Gr(t.text??"")}"`+(t.title?` title="${Gr(t.title)}"`:"")+' loading="lazy" />';return/^https?:\/\//i.test(e)?`<a href="${Gr(e)}" class="jex-md-img-link">${n}</a>`:n}}});const or=typeof window<"u"?Ap:null;or&&typeof or.addHook=="function"&&or.addHook("afterSanitizeAttributes",t=>{t.tagName==="A"&&t.hasAttribute("href")&&(t.setAttribute("target","_blank"),t.setAttribute("rel","noopener noreferrer"))});function Ip(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Pp(t){if(!t)return"";if(!or)return Ip(t);const e=W.parse(t),n=typeof e=="string"?e:"";return or.sanitize(n)}function Np({text:t}){const e=xe(()=>Pp(t),[t]);return s("div",{class:"jex-md",dangerouslySetInnerHTML:{__html:e}})}function El({onQuote:t}){const e=R();return s("button",{type:"button",class:"jex-quote-btn","aria-label":e.quoteMessage,title:e.quoteMessage,onClick:t,children:s(ro,{size:12})})}function Mp(t,e,n){return t.role==="user"?n:t.authorName??e??""}function Op({authorLabel:t,content:e,onClick:n}){return s("button",{type:"button",class:"jex-quoted-chip",onClick:n,children:[s(ro,{size:11}),s("span",{class:"jex-quoted-chip-text",children:[t&&s("span",{class:"jex-quoted-chip-author",children:[t,": "]}),Ds(e)]})]})}function Il({quotes:t,botName:e,yourMessageLabel:n,onQuotedClick:r}){return t.length===0?null:s("div",{class:"jex-quoted-list",children:t.map(i=>s(Op,{authorLabel:Mp(i,e,n),content:i.content,onClick:r?o=>{r(i.id,o)}:void 0},i.id))})}function Lp(t){const e=t.trim().split(/\s+/).filter(Boolean);return e.length===0?"?":e.map(n=>n[0]).join("").slice(0,2).toUpperCase()}function Gt({text:t,streaming:e,error:n,authorId:r,authorName:i,authorImage:o,botAvatarUrl:a,botName:l,onQuote:c,id:u,quoted:h,onQuotedClick:m}){const d=R(),p=!!r,[b,S]=U(!1),y=Y(()=>S(!0),[]),x=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&&!b?s("img",{src:o,alt:i??"",class:"jex-avatar-img",onError:y}):p?s("span",{class:"jex-avatar-initials",children:Lp(i??"")}):a&&!b?s("img",{src:a,alt:"",class:"jex-avatar-img",onError:y}):s($r,{size:14})}),x&&s("span",{class:"jex-message-author",children:x})]}),s("div",{class:k,id:u,children:[s(Il,{quotes:h??[],botName:l,yourMessageLabel:d.quotedYourMessage,onQuotedClick:m}),s(Np,{text:t}),e&&s("span",{class:"jex-streaming-cursor"}),c&&s(El,{onQuote:c})]})]})}function $p({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 Dp(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 qp({text:t,id:e,onQuote:n,botName:r,quoted:i,onQuotedClick:o,agentNames:a}){const l=R();return s("div",{class:"jex-message user",id:e,children:[s(Il,{quotes:i??[],botName:r,yourMessageLabel:l.quotedYourMessage,onQuotedClick:o}),Dp(t,a??[]),n&&s(El,{onQuote:n})]})}function Pl(){return Bt(ke.escalations.public.submitEscalation)}function Nl(){const t=Bt(ke.escalations.public.markEscalationWaiting);return e=>{Jn.value=e,t({sessionId:e.sessionId,visitorId:e.visitorId}).catch(n=>{ne.error("[waiting] markEscalationWaiting failed:",n)})}}function zp({message:t,sessionId:e,visitorId:n,waitingSetAt:r}){const i=R();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(Up,{messageId:t._id,sessionId:e,visitorId:n,waitingSetAt:r})})}function Up({messageId:t,sessionId:e,visitorId:n,waitingSetAt:r}){const i=R(),[o,a]=U(""),[l,c]=U(""),[u,h]=U(!1),m=Hn.value,d=/^https?:\/\//i.test(m)?m:Vn,p=Pl(),b=Nl();async function S(y){if(y.preventDefault(),!u){h(!0);try{await p({sessionId:e,visitorId:n,formMessageId:t,visitorName:o.trim(),visitorEmail:l.trim(),locale:ct.value})}catch(x){ne.error("[FormMessage] Submit failed:",x),h(!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:y=>{S(y)},children:[s("input",{class:"jex-form-input",type:"text",placeholder:i.escalationNameLabel,value:o,required:!0,disabled:u,onInput:y=>{a(y.currentTarget.value)}}),s("input",{class:"jex-form-input",type:"email",placeholder:i.escalationEmailLabel,value:l,required:!0,disabled:u,onInput:y=>{c(y.currentTarget.value)}}),s("button",{class:"jex-form-submit",type:"submit",disabled:u,children:u?i.escalationSubmitting:i.escalationSubmit})]}),s("button",{type:"button",class:"jex-escalation-skip",onClick:()=>{b({formMessageId:t,sessionId:e,visitorId:n,waitingSetAt:r})},children:i.escalationSkip}),s("div",{class:"jex-inline-form-consent",children:[i.escalationConsent," ",s("a",{href:d,target:"_blank",rel:"noopener noreferrer",class:"jex-privacy-notice-link",children:i.escalationPrivacyLinkText}),"."]})]})}function Bp(){return Bt(ke.functions.magicline.public.submitForm)}function Fp(){return Un(ke.functions.magicline.actions.getTrialConfig)}function Vp(){return Un(ke.functions.magicline.actions.listTrialSlots)}function Hp(){return Un(ke.functions.magicline.actions.getRateBundles)}function Ml(){return Un(ke.functions.magicline.actions.getContractPreview)}function Wp(){return Un(ke.functions.magicline.actions.submitContractCreation)}const ko={en:Vi,de:ws},Qp=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function Ol(t){return Qp.test(t.trim())}function Gp(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 Ll(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 $l(){const t=Hn.value;return/^https?:\/\//i.test(t)?t:Vn}const Kp={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},Yp=15,Jp=34;function Dl(t){return t.replace(/\s+/g,"").toUpperCase()}function Zp(t){const e=Dl(t),n=e.slice(0,2),r=Kp[n];if(r!==void 0){if(e.length!==r)return!1}else if(e.length<Yp||e.length>Jp)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 Xp(t){const e=Dl(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 et(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 Kr(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 em(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 _o(t,e,n){const r=ko[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 tm(t,e,n,r,i){const o=ko[i],a=et(t,e,i);switch(n){case"TERM_BASED":return`${a} ${o.magiclineModulePerTerm}`;case"RECURRING":return`${a} ${_o(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 nm(t,e,n,r){return e==="PERCENTAGE"?`-${t}%`:`-${et(t,n,r)}`}const rm={startpaket:"magiclineFeeStarterPackage","starter package":"magiclineFeeStarterPackage",trainerpauschale:"magiclineFeeTrainerFee"};function ql(t,e){const n=t.trim().toLowerCase(),r=rm[n];return r!==void 0?e[r]:t}function im(t,e,n){const r=ko[n];if(t==="NONE")return r.magiclineRenewalNone;if(t==="TERM_EXTENSION"&&e!==null){const i=Kr(e.value,e.unit,n);return r.magiclineRenewalTerm.replace("{n} {unit}",i)}return""}const zl=["MALE","FEMALE","UNISEX"],om=[{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 am(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 sm={firstName:"",lastName:"",email:"",phone:"",birthDate:"",gender:"",street:"",houseNumber:"",zip:"",city:"",country:"",note:"",slotId:"",consent:!1,trainerRequired:!0};function lm(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 cm({sessionId:t,visitorId:e}){const n=Fp(),r=Vp(),[i,o]=Ue(lm,sm),[a,l]=Ue((x,k)=>k,{phase:"loading"}),[c,u]=Ue((x,k)=>k,{phase:"loading"}),[h,m]=Ue(x=>x+1,0),d=Y((x,k)=>{o({type:"set",key:x,value:k})},[]),p=Y(x=>{o({type:"setTrainer",trainerRequired:x}),m()},[]),b=Y(()=>{m()},[]);M(()=>{let x=!1;return(async()=>{try{const k=await n({sessionId:t,visitorId:e});if(x)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{x||l({phase:"error",code:"unavailable",backendMessage:""})}})(),()=>{x=!0}},[n,t,e]);const S=a.phase==="ready",{trainerRequired:y}=i;return M(()=>{if(!S)return;let x=!1;return u({phase:"loading"}),(async()=>{try{const k=await r({sessionId:t,visitorId:e,trainerRequired:y});if(x)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{x||u({phase:"error"})}})(),()=>{x=!0}},[S,r,t,e,y,h]),{fields:i,setField:d,setTrainerRequired:p,configState:a,slotsState:c,refetchSlots:b}}function um({formMessageId:t,sessionId:e,visitorId:n,slotUnavailable:r=!1,retryPending:i=!1}){const o=R(),a=Bp(),{fields:l,setField:c,setTrainerRequired:u,configState:h,slotsState:m,refetchSlots:d}=cm({sessionId:e,visitorId:n});return h.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})]}):h.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:bm(h.code,h.backendMessage,o)})]}):s(dm,{formMessageId:t,sessionId:e,visitorId:n,slotUnavailable:r,retryPending:i,config:h.config,fields:l,setField:c,setTrainerRequired:u,slotsState:m,refetchSlots:d,submitForm:a})}function dm({formMessageId:t,sessionId:e,visitorId:n,slotUnavailable:r,retryPending:i,config:o,fields:a,setField:l,setTrainerRequired:c,slotsState:u,refetchSlots:h,submitForm:m}){const d=R(),{plan:p,minimumAge:b,bookingWithoutTrainerAllowed:S,studioZoneId:y}=o,x=xe(()=>am(p,S),[p,S]),k=r?Math.max(x.indexOf("slot"),0):0,[A,N]=U(k),[P,I]=U({}),[L,v]=U(!1),[se,D]=U(null),K=xe(()=>$l(),[]),ie=Math.min(A,x.length-1),T=x[ie]??"slot",J=ie===x.length-1,$e=ie===0;function De(le){const z={};if(le==="slot")return a.slotId===""&&(z.slotId=d.magiclineSlotRequiredError),z;if(le==="personal"){if(a.firstName.trim()===""&&(z.firstName=d.magiclineRequiredError),a.lastName.trim()===""&&(z.lastName=d.magiclineRequiredError),p.email.visible&&p.email.required&&a.email.trim()===""&&(z.email=d.magiclineRequiredError),a.email.trim()!==""&&!Ol(a.email)&&(z.email=d.magiclineEmailError),p.phone.visible&&p.phone.required&&a.phone.trim()===""&&(z.phone=d.magiclineRequiredError),p.gender.visible&&p.gender.required&&a.gender===""&&(z.gender=d.magiclineRequiredError),p.dateOfBirth.visible&&(p.dateOfBirth.required&&a.birthDate.trim()===""&&(z.birthDate=d.magiclineRequiredError),a.birthDate.trim()!=="")){const qe=Gp(a.birthDate);qe!==null&&qe<0?z.birthDate=d.magiclineRequiredError:b>0&&qe!==null&&qe<b&&(z.birthDate=d.magiclineMinAgeError.replace("{age}",String(b)))}return z}return le==="address"?(p.address.visible&&p.address.required&&(a.street.trim()===""&&(z.street=d.magiclineRequiredError),a.houseNumber.trim()===""&&(z.houseNumber=d.magiclineRequiredError),a.city.trim()===""&&(z.city=d.magiclineRequiredError),a.country===""&&(z.country=d.magiclineRequiredError)),p.zip.visible&&p.zip.required&&a.zip.trim()===""&&(z.zip=d.magiclineRequiredError),z):(le==="confirm"&&(a.consent||(z.consent=d.magiclineConsentError)),z)}function pt(){const le=De(T);if(Object.keys(le).length>0){I(le);return}I({}),N(z=>Math.min(z+1,x.length-1))}function Lt(){I({}),D(null),N(le=>Math.max(le-1,0))}async function _t(){if(L)return;const le=De("confirm");if(Object.keys(le).length>0){I(le);return}I({}),D(null),v(!0);try{const z=ym(p,a);await m({sessionId:e,visitorId:n,formMessageId:t,action:"trialSessionBooking",fields:z})}catch(z){ne.error("[TrialSessionBookingForm] Submit failed:",z),D(d.magiclineFailedDetail),v(!1)}}function Kt(){J?_t():pt()}const X=xm(T,d),Qe=`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:d.magiclineTrialTitle}),s("div",{class:"jex-magicline-wizard-progress",children:[s("span",{class:"jex-magicline-wizard-step-label",children:X}),s("span",{class:"jex-magicline-wizard-counter",children:d.magiclineStepCounter.replace("{n}",String(ie+1)).replace("{total}",String(x.length))})]}),s("div",{class:"jex-magicline-wizard-dots","aria-hidden":"true",children:x.map((le,z)=>s("span",{class:z===ie?"jex-magicline-wizard-dot jex-magicline-wizard-dot-active":"jex-magicline-wizard-dot"},le))})]}),s("div",{class:"jex-form",role:"group","aria-label":X,children:[T==="trainer"?s(hm,{formMessageId:t,trainerRequired:a.trainerRequired,disabled:L,onChange:c}):null,T==="slot"?s(fm,{slotsState:u,slotId:a.slotId,studioZoneId:y,disabled:L,retryPending:i,slotUnavailable:r,error:P.slotId,onSelect:le=>{l("slotId",le)},onRetry:h}):null,T==="personal"?s(pm,{plan:p,fields:a,errors:P,disabled:L,setField:l}):null,T==="address"?s(mm,{plan:p,fields:a,errors:P,disabled:L,setField:l}):null,T==="confirm"?s(gm,{consentId:Qe,privacyUrl:K,studioZoneId:y,fields:a,disabled:L,consentError:P.consent,setField:l}):null,se!==null?s("div",{class:"jex-magicline-error",role:"alert",children:se}):null,s("div",{class:"jex-magicline-wizard-nav",children:[$e?null:s("button",{type:"button",class:"jex-magicline-wizard-back",disabled:L,onClick:Lt,children:d.magiclineWizardBack}),s("button",{type:"button",class:"jex-form-submit jex-magicline-wizard-next",disabled:L,onClick:Kt,children:J?L?d.magiclineSubmitting:d.magiclineSubmit:d.magiclineWizardNext})]})]})]})}function hm({formMessageId:t,trainerRequired:e,disabled:n,onChange:r}){const i=R(),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 fm({slotsState:t,slotId:e,studioZoneId:n,disabled:r,retryPending:i,slotUnavailable:o,error:a,onSelect:l,onRetry:c}){const u=R();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:h=>{l(h.currentTarget.value)},children:[s("option",{value:"",disabled:!0,children:u.magiclineSlotPlaceholder}),t.slots.map(h=>s("option",{value:h.startDateTime,children:Bl(h.startDateTime,ct.value,n)},h.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 pm({plan:t,fields:e,errors:n,disabled:r,setField:i}){const o=R(),a=xe(()=>Ll(),[]);return s(ee,{children:[s("div",{class:"jex-magicline-row",children:[s(Mt,{label:o.magiclineFirstName,value:e.firstName,required:!0,disabled:r,error:n.firstName,fieldKey:"firstName",onInput:l=>{i("firstName",l)}}),s(Mt,{label:o.magiclineLastName,value:e.lastName,required:!0,disabled:r,error:n.lastName,fieldKey:"lastName",onInput:l=>{i("lastName",l)}})]}),t.email.visible?s(Mt,{label:We(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(Mt,{label:We(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:We(o.magiclineBirthDate,t.dateOfBirth.required,o)}),s("input",{class:"jex-form-input",type:"date","aria-label":We(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(Ul,{label:We(o.magiclineGender,t.gender.required,o),value:e.gender,required:t.gender.required,disabled:r,placeholder:We(o.magiclineGenderPlaceholder,t.gender.required,o),error:n.gender,onChange:l=>{i("gender",l)},options:zl.map(l=>({value:l,label:vm(l,o)}))}):null]})}function mm({plan:t,fields:e,errors:n,disabled:r,setField:i}){const o=R();return s(ee,{children:[t.address.visible?s(ee,{children:[s("div",{class:"jex-magicline-row",children:[s(Mt,{label:We(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(Mt,{label:We(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(Mt,{label:We(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(Ul,{label:We(o.magiclineCountry,t.address.required,o),value:e.country,required:t.address.required,disabled:r,placeholder:We(o.magiclineCountryPlaceholder,t.address.required,o),error:n.country,onChange:a=>{i("country",a)},options:om.map(a=>({value:a.code,label:a.label}))})]}):null,t.zip.visible?s(Mt,{label:We(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 gm({consentId:t,privacyUrl:e,studioZoneId:n,fields:r,disabled:i,consentError:o,setField:a}){const l=R(),c=r.slotId!==""?Bl(r.slotId,ct.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:h=>{a("note",h.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:h=>{a("consent",h.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 Mt({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 Ul({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 We(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 bm(t,e,n){return e.trim()!==""?e:t==="unsupported"?n.magiclineConfigUnsupported:t==="inconsistent"?n.magiclineConfigInconsistent:n.magiclineConfigUnavailable}function ym(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 vm(t,e){return t==="MALE"?e.magiclineGenderMale:t==="FEMALE"?e.magiclineGenderFemale:e.magiclineGenderUnisex}function Bl(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 Fl(t){const e=Ne(t);return rn(()=>{e.current=t}),Y((...n)=>e.current(...n),[])}const wm={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 km(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 Vl={draftVoucherCode:"",appliedVoucherCode:null,appliedVoucher:null,voucherStatus:"idle",voucherRequestId:0,voucherUnavailable:!1},_m="voucher:";function jm(t){const e={};for(const n of Object.keys(t))n.startsWith(_m)||(e[n]=t[n]);return e}function Sm(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 Tm(t,e){switch(e.type){case"dropVoucherAcks":{const n=jm(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 km(t,e)}}function Cm({sessionId:t,visitorId:e}){const n=Hp(),r=Ml(),[i,o]=Ue(Tm,wm),[a,l]=Ue(Sm,Vl),[c,u]=Ue((w,$)=>$,{phase:"loading"}),h=Ne(null),[m,d]=Ue((w,$)=>$,{phase:"idle"}),p=Y(w=>{w.phase==="ready"?h.current=w.pricing:(w.phase==="idle"||w.phase==="error")&&(h.current=null),d(w)},[]),[b,S]=Ue(w=>w+1,0),[y,x]=Ue(w=>w+1,0),k=Y(w=>{o({type:"setTermId",termId:w}),l({type:"CLEAR_VOUCHER"})},[]),A=Y((w,$)=>{o({type:"setPersonal",key:w,value:$})},[]),N=Y((w,$)=>{o({type:"setAddress",key:w,value:$})},[]),P=Y((w,$,H)=>{o({type:"toggleModule",moduleId:w,selected:$,consentAckKey:H}),o({type:"dropVoucherAcks"}),l({type:"CLEAR_VOUCHER"})},[]),I=Y((w,$)=>{o({type:"setBlockAck",ackKey:w,value:$})},[]),L=Y(w=>{o({type:"setAccountHolder",value:w})},[]),v=Y(w=>{o({type:"setIban",value:w})},[]),se=Y((w,$)=>{o({type:"setConsent",key:w,value:$})},[]),D=Y(()=>{o({type:"clearIban"})},[]),K=Y(()=>{o({type:"clearTermId"}),l({type:"CLEAR_VOUCHER"})},[]),ie=Y(w=>{l({type:"SET_VOUCHER_DRAFT",value:w}),o({type:"dropVoucherAcks"})},[]),T=Ne(Vl.voucherRequestId),J=Y(()=>{const w=T.current+1;return T.current=w,l({type:"VOUCHER_APPLYING"}),w},[]),$e=Y(w=>{w.requestId===T.current&&(l({type:"VOUCHER_APPLIED",requestId:w.requestId,voucher:w.voucher,appliedCode:w.appliedCode,voucherAckKeys:w.voucherAckKeys}),p({phase:"ready",pricing:w.pricing}),o({type:"seedVoucherAcks",ackKeys:w.voucherAckKeys}))},[p]),De=Y(()=>{l({type:"VOUCHER_INVALID"}),o({type:"dropVoucherAcks"}),x()},[]),pt=Y(()=>{l({type:"VOUCHER_DISABLED"}),o({type:"dropVoucherAcks"}),x()},[]),Lt=Y(()=>{l({type:"CLEAR_VOUCHER"}),o({type:"dropVoucherAcks"}),x()},[]),_t=Y(()=>{S()},[]),Kt=Y(()=>{p({phase:"idle"})},[p]),X=Y(()=>{x()},[]),Qe=c.phase==="ready"&&i.termId!==null?c.terms.find(w=>w.termId===i.termId)??null:null,{selectedModuleIds:le,acknowledgedBlocks:z}=i,{appliedVoucher:qe}=a,tt=xe(()=>{if(Qe===null)return[];const w=new Set;for(const $ of Qe.textBlocks)$.isConfirmationRequired&&w.add($.ackKey);for(const $ of le){const H=Qe.optionalModules.find(ce=>ce.id===$);H?.consent&&w.add(H.consent.ackKey)}if(qe!==null)for(const $ of qe.textBlocks)w.add($.ackKey);return[...w]},[Qe,le,qe]),Yt=xe(()=>tt.every(w=>z[w]===!0),[tt,z]),{firstName:be,lastName:Ge}=i.personal,{accountHolder:Te,accountHolderTouched:Z}=i.payment;M(()=>{Z||Te!==""||be.trim()!==""&&Ge.trim()!==""&&o({type:"prefillAccountHolder",value:`${be.trim()} ${Ge.trim()}`})},[be,Ge,Te,Z]),M(()=>{let w=!1;return u({phase:"loading"}),(async()=>{try{const $=await n({sessionId:t,visitorId:e});if(w)return;$.status==="ok"?$.terms.length>0?u({phase:"ready",terms:$.terms,allowVoucherCodes:$.allowVoucherCodes}):u({phase:"empty"}):u({phase:"error"})}catch{w||u({phase:"error"})}})(),()=>{w=!0}},[n,t,e,b]);const Jt=Fl(()=>{const w=Qe;return w?{sessionId:t,visitorId:e,termId:w.termId,startDate:w.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:w.optionalModules.filter($=>i.selectedModuleIds.includes($.id)).map($=>$.id),privacyConsent:i.consents.privacy,sepaConsent:i.consents.sepa}:null});return M(()=>{if(y===0)return;const w=Jt();if(!w){p({phase:"error",code:"offer_unavailable"});return}let $=!1;const H=h.current;return p(H!==null?{phase:"reloading",pricing:H}:{phase:"loading"}),(async()=>{try{const ce=await r(w);if($)return;ce.status==="ok"?p({phase:"ready",pricing:{basePrice:ce.basePrice,preUseCharge:ce.preUseCharge,currencyCode:ce.currencyCode,flatFees:ce.flatFees,modules:ce.modules,contractVolume:ce.contractVolume,startDate:ce.startDate,paymentFrequency:ce.paymentFrequency,fingerprint:ce.pricingFingerprint}}):p({phase:"error",code:ce.status==="voucher_invalid"||ce.status==="voucher_disabled"?"unavailable":ce.status})}catch{$||p({phase:"error",code:"unavailable"})}})(),()=>{$=!0}},[y,r,t,e,p]),{fields:i,offersState:c,previewState:m,selectedTerm:Qe,requiredAckKeys:tt,allAcknowledged:Yt,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:I,setAccountHolder:L,setIban:v,setConsent:se,clearIban:D,clearTermId:K,refetchOffers:_t,fetchPreview:X,resetPreview:Kt,setVoucherDraft:ie,beginVoucherApply:J,commitVoucherApplied:$e,markVoucherInvalid:De,markVoucherDisabled:pt,clearVoucher:Lt}}function Am(t){return t!==null&&t.optionalModules.length>0?["offer","upgrades","personal","address","payment","review"]:["offer","personal","address","payment","review"]}function Rm({formMessageId:t,sessionId:e,visitorId:n,projectId:r,formStatus:i}){const o=R(),a=ct.value,l=Wp(),c=Ml(),u=Cm({sessionId:e,visitorId:n}),{fields:h,offersState:m,previewState:d,selectedTerm:p,requiredAckKeys:b,allAcknowledged:S,serverAllowVoucherCodes:y,voucherStatus:x,draftVoucherCode:k,appliedVoucher:A,appliedVoucherCode:N,voucherUnavailable:P,setTermId:I,setPersonal:L,setAddress:v,toggleModule:se,setBlockAck:D,setAccountHolder:K,setIban:ie,setConsent:T,clearIban:J,clearTermId:$e,refetchOffers:De,fetchPreview:pt,resetPreview:Lt,setVoucherDraft:_t,beginVoucherApply:Kt,commitVoucherApplied:X,markVoucherInvalid:Qe,markVoucherDisabled:le}=u,[z,qe]=U(0),[tt,Yt]=U({}),[be,Ge]=U(!1),[Te,Z]=U(null),[Jt,w]=U(null),[$,H]=U(null),ce=xe(()=>$l(),[]);if(Te!==null&&Te.status==="succeeded")return s(Hl,{customerNumber:Te.customerNumber});if(Te!==null&&Te.status==="failed"&&!Te.retryable){const Q=Te.errorCode==="duplicate_submission"?o.magiclineDuplicateNotice:Te.errorCode==="unknown_outcome"?o.magiclineUnknownOutcome:Te.errorCode==="live_submission_disabled"?o.magiclineLiveSubmissionDisabled:o.magiclineFailedDetail;return s(Wl,{message:Q})}if(Te===null&&!be&&i==="submitted")return s(Hl,{customerNumber:null});if(Te===null&&!be&&i==="failed")return s(Wl,{message:o.magiclineFailedDetail});const mt=Am(p),Ie=Math.min(z,mt.length-1),Fe=mt[Ie]??"offer",vn=Ie===mt.length-1,Jr=Ie===0;function Zr(Q){const q={};if(Q==="offer")return h.termId===null&&(q.termId=o.magiclineOfferRequiredError),q;if(Q==="upgrades"){if(p!==null)for(const ue of h.selectedModuleIds){const nt=p.optionalModules.find(he=>he.id===ue);if(nt?.consent&&h.acknowledgedBlocks[nt.consent.ackKey]!==!0){q.upgrades=o.magiclineUpgradeConsentError;break}}return q}if(Q==="personal"){const ue=h.personal;return ue.firstName.trim()===""&&(q.firstName=o.magiclineRequiredError),ue.lastName.trim()===""&&(q.lastName=o.magiclineRequiredError),ue.email.trim()===""?q.email=o.magiclineRequiredError:Ol(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(Q==="address"){const ue=h.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 Q==="payment"&&(h.payment.accountHolder.trim()===""&&(q.accountHolder=o.magiclineRequiredError),Zp(h.payment.iban)||(q.iban=o.magiclineIbanInvalidError),h.consents.privacy||(q.privacy=o.magiclineConsentError),h.consents.sepa||(q.sepa=o.magiclineConsentError)),q}function gt(){const Q=Zr(Fe);if(Object.keys(Q).length>0){Yt(Q);return}Yt({}),w(null);const q=Math.min(Ie+1,mt.length-1);mt[q]==="review"&&pt(),qe(q)}function Zt(){Yt({}),w(null),Fe==="review"&&Lt(),qe(Q=>Math.max(Q-1,0))}function jt(){w(null),pt()}async function sr(){if(!be&&!(d.phase!=="ready"||p===null)){if(!S){w(o.magiclineConfirmRequiredError);return}Ge(!0),w(null);try{const Q=await l({sessionId:e,visitorId:n,projectId:r,formMessageId:t,fields:{firstname:h.personal.firstName.trim(),lastname:h.personal.lastName.trim(),email:h.personal.email.trim(),phone:h.personal.phone.trim(),dateOfBirth:h.personal.dateOfBirth.trim(),gender:h.personal.gender,street:h.address.street.trim(),houseNumber:h.address.houseNumber.trim(),zipCode:h.address.zipCode.trim(),city:h.address.city.trim(),rateBundleTermId:p.termId,privacyConsent:h.consents.privacy,sepaConsent:h.consents.sepa},bankAccount:{accountHolder:h.payment.accountHolder.trim(),iban:h.payment.iban},selectedModuleIds:p.optionalModules.filter(q=>h.selectedModuleIds.includes(q.id)).map(q=>q.id),acknowledgedAckKeys:b,pricingFingerprint:d.pricing.fingerprint,voucherCode:N??void 0});if(Q.status==="succeeded"){Z(Q);return}if(Q.errorCode==="price_changed"){w(o.magiclinePriceChangedNotice),pt(),Ge(!1);return}if(Q.errorCode==="offer_unavailable"){$e(),De(),Lt(),w(o.magiclineOfferUnavailableNotice),qe(0),Ge(!1);return}if(Q.errorCode==="confirmation_required"){w(o.magiclineConfirmationRequiredNotice),Ge(!1);return}if(Q.errorCode==="live_submission_disabled"){Z(Q);return}if(!Q.retryable){Z(Q);return}J(),w(Q.message!==""?Q.message:o.magiclineFailedDetail),Ge(!1)}catch(Q){ne.error("[ContractCreationForm] Submit failed:",Q),J(),w(o.magiclineFailedDetail),Ge(!1)}}}async function lr(){if(d.phase!=="ready"||p===null||k.trim()==="")return;const Q=k.trim(),q=Kt();H(null);const ue=he=>{Qe(),_t(""),H(he)},nt=o.magiclineVoucherInvalid.replace("{code}",Q);try{const he=await c({sessionId:e,visitorId:n,termId:p.termId,startDate:p.defaultContractStartDate??"",fields:{firstname:h.personal.firstName.trim(),lastname:h.personal.lastName.trim(),email:h.personal.email.trim(),dateOfBirth:h.personal.dateOfBirth.trim(),gender:h.personal.gender,phone:h.personal.phone.trim(),street:h.address.street.trim(),houseNumber:h.address.houseNumber.trim(),zipCode:h.address.zipCode.trim(),city:h.address.city.trim()},selectedModuleIds:p.optionalModules.filter(ze=>h.selectedModuleIds.includes(ze.id)).map(ze=>ze.id),privacyConsent:h.consents.privacy,sepaConsent:h.consents.sepa,voucherCode:k.trim()});if(he.status==="ok"){const ze=he.voucher;if(ze!==null){const Ke=ze.textBlocks.map(ur=>ur.ackKey);X({requestId:q,voucher:ze,appliedCode:k.trim(),voucherAckKeys:Ke,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}})}else ue(nt)}else he.status==="voucher_invalid"?ue(nt):he.status==="voucher_disabled"?(le(),_t(""),H(o.magiclineVoucherDisabled)):ue(nt)}catch{ue(nt)}}function cr(){vn?sr():gt()}const wn=Bm(Fe,o),$t=x==="applying"||k.trim()!==""&&k.trim()!==(N??""),kn=Fe==="review"&&(d.phase!=="ready"||!S||$t),_n=be||kn;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:wn}),s("span",{class:"jex-magicline-wizard-counter",children:o.magiclineStepCounter.replace("{n}",String(Ie+1)).replace("{total}",String(mt.length))})]}),s("div",{class:"jex-magicline-wizard-dots","aria-hidden":"true",children:mt.map((Q,q)=>s("span",{class:q===Ie?"jex-magicline-wizard-dot jex-magicline-wizard-dot-active":"jex-magicline-wizard-dot"},Q))})]}),s("div",{class:"jex-form",role:"group","aria-label":wn,children:[Fe==="offer"?s(Em,{offersState:m,selectedTermId:h.termId,widgetLocale:a,disabled:be,error:tt.termId,onSelect:I,onRetry:De}):null,Fe==="upgrades"&&p!==null?s(Nm,{modules:p.optionalModules,selectedModuleIds:h.selectedModuleIds,acknowledgedBlocks:h.acknowledgedBlocks,widgetLocale:a,disabled:be,error:tt.upgrades,onToggle:se,onAck:D}):null,Fe==="personal"?s(Om,{personal:h.personal,errors:tt,disabled:be,setPersonal:L}):null,Fe==="address"?s(Lm,{address:h.address,errors:tt,disabled:be,setAddress:v}):null,Fe==="payment"?s($m,{formMessageId:t,fields:h,errors:tt,privacyUrl:ce,disabled:be,setAccountHolder:K,setIban:ie,setConsent:T}):null,Fe==="review"?s(Dm,{fields:h,term:p,previewState:d,widgetLocale:a,disabled:be,acknowledgedBlocks:h.acknowledgedBlocks,onToggleAck:D,onRetry:jt,allowVoucherCodes:y,voucherUnavailable:P,voucherStatus:x,draftVoucherCode:k,appliedVoucher:A,voucherBanner:$,onVoucherDraftChange:_t,onApplyVoucher:()=>{lr()}}):null,Jt!==null?s("div",{class:"jex-magicline-error",role:"alert",children:Jt}):null,s("div",{class:"jex-magicline-wizard-nav",children:[Jr?null:s("button",{type:"button",class:"jex-magicline-wizard-back",disabled:be,onClick:Zt,children:o.magiclineWizardBack}),s("button",{type:"button",class:"jex-form-submit jex-magicline-wizard-next",disabled:_n,onClick:cr,children:vn?be?o.magiclineSubmitting:o.magiclineSubmit:o.magiclineWizardNext})]})]})]})}function Hl({customerNumber:t}){const e=R();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 Wl({message:t}){const e=R();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 Em({offersState:t,selectedTermId:e,widgetLocale:n,disabled:r,error:i,onSelect:o,onRetry:a}){const l=R();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=Um(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(h=>s(Im,{term:h,checked:e===h.termId,widgetLocale:n,disabled:r,onSelect:o},h.termId)),s(Pm,{subDescription:u.bundleSubDescription,footnote:u.footnote})]},u.bundleId))}),i!==void 0?s("div",{class:"jex-magicline-error",role:"alert",children:i}):null]})}function Im({term:t,checked:e,widgetLocale:n,disabled:r,onSelect:i}){const o=R(),a=Kr(t.termValue,t.termUnit,n),l=et(t.price,t.currencyCode,n),c=t.flatFees.find(h=>h.isStarterPackage),u=t.flatFees.filter(h=>!h.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," ",_o(t.paymentFrequency.value,t.paymentFrequency.unit,n)]})]}),t.cancellationPeriod!==null?s("span",{class:"jex-magicline-offer-term-note",children:[o.magiclineCancellationPeriod,":"," ",Kr(t.cancellationPeriod.value,t.cancellationPeriod.unit,n)]}):null,c!==void 0?s("span",{class:"jex-magicline-offer-term-note",children:[o.magiclineStarterPackage,":"," ",et(c.price,t.currencyCode,n)]}):null,u.map(h=>s("span",{class:"jex-magicline-offer-term-note",children:[ql(h.name,o),": ",et(h.price,t.currencyCode,n)]},h.name)),t.includedModuleNames.length>0?s("span",{class:"jex-magicline-offer-term-note",children:[o.magiclineIncludedModules,": ",t.includedModuleNames.join(", ")]}):null]})]})}function Pm({subDescription:t,footnote:e}){const n=R(),r=zm(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 Nm({modules:t,selectedModuleIds:e,acknowledgedBlocks:n,widgetLocale:r,disabled:i,error:o,onToggle:a,onAck:l}){const c=R();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(Mm,{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 Mm({module:t,selected:e,consentChecked:n,widgetLocale:r,disabled:i,onToggle:o,onAck:a}){const l=R(),c=tm(t.price,t.currencyCode,t.paymentFrequencyType,t.recurringUnit,r),u=im(t.extensionType,t.termExtension,r),h=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:d=>{o(t.id,d.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:h}),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(jo,{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 Om({personal:t,errors:e,disabled:n,setPersonal:r}){const i=R(),o=xe(()=>Ll(),[]);return s(ee,{children:[s("div",{class:"jex-magicline-row",children:[s(ft,{label:i.magiclineFirstName,value:t.firstName,required:!0,disabled:n,error:e.firstName,fieldKey:"firstName",onInput:a=>{r("firstName",a)}}),s(ft,{label:i.magiclineLastName,value:t.lastName,required:!0,disabled:n,error:e.lastName,fieldKey:"lastName",onInput:a=>{r("lastName",a)}})]}),s(ft,{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(qm,{label:i.magiclineGender,value:t.gender,required:!0,disabled:n,placeholder:i.magiclineGenderPlaceholder,error:e.gender,onChange:a=>{r("gender",a)},options:zl.map(a=>({value:a,label:Fm(a,i)}))}),s(ft,{label:i.magiclinePhone,type:"tel",value:t.phone,required:!0,disabled:n,error:e.phone,fieldKey:"phone",onInput:a=>{r("phone",a)}})]})}function Lm({address:t,errors:e,disabled:n,setAddress:r}){const i=R();return s(ee,{children:[s("div",{class:"jex-magicline-row",children:[s(ft,{label:i.magiclineStreet,value:t.street,required:!0,disabled:n,error:e.street,fieldKey:"street",onInput:o=>{r("street",o)}}),s(ft,{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(ft,{label:i.magiclineZip,value:t.zipCode,required:!0,disabled:n,error:e.zipCode,fieldKey:"zipCode",onInput:o=>{r("zipCode",o)}}),s(ft,{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 $m({formMessageId:t,fields:e,errors:n,privacyUrl:r,disabled:i,setAccountHolder:o,setIban:a,setConsent:l}){const c=R(),u=`jex-ml-privacy-${t}`,h=`jex-ml-sepa-${t}`;return s(ee,{children:[s(ft,{label:c.magiclineAccountHolder,value:e.payment.accountHolder,required:!0,disabled:i,error:n.accountHolder,fieldKey:"accountHolder",onInput:o}),s(ft,{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:h,children:[s("input",{id:h,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 Dm({fields:t,term:e,previewState:n,widgetLocale:r,disabled:i,acknowledgedBlocks:o,onToggleAck:a,onRetry:l,allowVoucherCodes:c,voucherUnavailable:u,voucherStatus:h,draftVoucherCode:m,appliedVoucher:d,voucherBanner:p,onVoucherDraftChange:b,onApplyVoucher:S}){const y=R();if(n.phase==="loading"||n.phase==="idle")return s("div",{class:"jex-magicline-slots-hint","aria-live":"polite",children:y.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"?y.magiclineOfferUnavailableNotice:y.magiclineReviewError}),s("button",{type:"button",class:"jex-magicline-retry",disabled:i,onClick:l,children:y.magiclineRetry})]});const x=n.pricing,k=n.phase==="reloading",A=x.contractVolume,N=`${t.personal.firstName} ${t.personal.lastName}`.trim(),P=t.address,I=[`${P.street} ${P.houseNumber}`.trim(),`${P.zipCode} ${P.city}`.trim(),y.magiclineCountryStatic].filter(T=>T!=="").join(", "),L=e!==null?`${e.bundleName} · ${Kr(e.termValue,e.termUnit,r)}`:"—",v=e!==null?e.textBlocks.filter(T=>T.isConfirmationRequired):[],se=e!==null?e.textBlocks.filter(T=>!T.isConfirmationRequired):[],D=e!==null?e.optionalModules.filter(T=>t.selectedModuleIds.includes(T.id)&&T.consent!==null).map(T=>({module:T,consent:T.consent})):[],K=d!==null?d.textBlocks.filter(T=>T.ackKey.startsWith("voucher:")):[],ie=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:y.magiclineReviewOffer}),s("dd",{children:L})]}),s("div",{class:"jex-magicline-summary-row",children:[s("dt",{children:y.magiclineReviewBasePrice}),s("dd",{children:[d!==null&&d.voucherType==="DISCOUNT"?et(d.discountedBasePrice,x.currencyCode,r):et(x.basePrice,x.currencyCode,r)," ",_o(x.paymentFrequency.value,x.paymentFrequency.unit,r)]})]}),d!==null&&d.voucherType==="DISCOUNT"?s("div",{class:"jex-magicline-summary-row jex-magicline-voucher-discount-row",children:[s("dt",{children:y.magiclineVoucherAppliedDiscount.replace("{discount}",nm(d.discountValue,d.discountType,x.currencyCode,r))}),s("dd",{})]}):null,d!==null&&d.remarks!==null&&d.remarks!==""?s("div",{class:"jex-magicline-summary-row jex-magicline-voucher-remarks-row",children:[s("dt",{children:y.magiclineVoucherRemarks}),s("dd",{children:d.remarks})]}):null,x.flatFees.map((T,J)=>s("div",{class:"jex-magicline-summary-row",children:[s("dt",{children:ql(T.name,y)}),s("dd",{children:et(T.price,x.currencyCode,r)})]},`${T.name}-${J}`)),x.preUseCharge>0?s("div",{class:"jex-magicline-summary-row",children:[s("dt",{children:y.magiclineReviewPreUseCharge}),s("dd",{children:et(x.preUseCharge,x.currencyCode,r)})]}):null]}),x.modules.length>0?s("dl",{class:"jex-magicline-summary jex-magicline-summary-section",children:[s("div",{class:"jex-magicline-summary-heading",children:y.magiclineReviewSelectedUpgrades}),x.modules.map((T,J)=>s("div",{class:"jex-magicline-summary-row",children:[s("dt",{children:T.name}),s("dd",{children:et(T.amount,T.currencyCode,r)})]},`${T.moduleId}-${J}`))]}):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:d!==null&&d.voucherType==="DISCOUNT"?y.magiclineGesamtpreisBeforeDiscount:y.magiclineReviewContractVolume}),s("dd",{children:et(A.total,x.currencyCode,r)})]})}):null,d!==null&&d.voucherType==="CREDIT"?s("div",{class:"jex-magicline-voucher-credit-notice",role:"note",children:y.magiclineVoucherCreditNotice}):null,s("dl",{class:"jex-magicline-summary jex-magicline-summary-section",children:[s("div",{class:"jex-magicline-summary-row",children:[s("dt",{children:y.magiclineReviewStartsOn}),s("dd",{children:em(x.startDate,r)})]}),s("div",{class:"jex-magicline-summary-row",children:[s("dt",{children:y.magiclineSummaryName}),s("dd",{children:N!==""?N:"—"})]}),s("div",{class:"jex-magicline-summary-row",children:[s("dt",{children:y.magiclineSummaryAddress}),s("dd",{children:I})]}),s("div",{class:"jex-magicline-summary-row",children:[s("dt",{children:y.magiclineReviewPayment}),s("dd",{children:Xp(t.payment.iban)})]})]}),ie?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":y.magiclineVoucherLabel,placeholder:y.magiclineVoucherPlaceholder,value:m,disabled:i||h==="applying",onInput:T=>{b(T.currentTarget.value)}}),s("button",{type:"button",class:"jex-magicline-voucher-apply",disabled:i||h==="applying"||m.trim()==="",onClick:S,children:y.magiclineVoucherApply})]}),p!==null?s("div",{class:"jex-magicline-error",role:"alert",children:p}):null]}):null,D.length>0?s("div",{class:"jex-magicline-terms",role:"group","aria-label":y.magiclineReviewSelectedUpgrades,children:[s("div",{class:"jex-magicline-upgrades-recap-title",children:y.magiclineReviewSelectedUpgrades}),D.map(({module:T,consent:J})=>s(Ql,{title:J.title!==""?J.title:T.name,text:J.text,attachmentLabel:J.attachmentLabel,attachmentUrl:J.attachmentUrl},J.ackKey))]}):null,v.length>0||se.length>0||K.length>0?s("div",{class:"jex-magicline-terms",role:"group","aria-label":y.magiclineReviewTerms,children:[v.length>0||K.length>0?s("div",{class:"jex-magicline-terms-prompt",children:[y.magiclineConfirmPrompt,s("span",{class:"jex-magicline-required-pill",children:y.magiclineRequired})]}):null,v.map(T=>s(jo,{ackKey:T.ackKey,title:T.title,text:T.text,attachmentLabel:T.attachmentLabel,attachmentUrl:T.attachmentUrl,checked:o[T.ackKey]===!0,disabled:i,onToggle:a},T.ackKey)),K.map(T=>s(jo,{ackKey:T.ackKey,title:T.title,text:T.text,attachmentLabel:T.attachmentLabel,attachmentUrl:T.attachmentUrl,checked:o[T.ackKey]===!0,disabled:i,onToggle:a},T.ackKey)),se.map((T,J)=>s(Ql,{title:T.title,text:T.text,attachmentLabel:T.attachmentLabel,attachmentUrl:T.attachmentUrl},`${T.title}-${J}`))]}):null]}),k?s("div",{class:"jex-magicline-review-overlay","aria-hidden":"true",children:s("span",{class:"jex-magicline-review-spinner"})}):null]})}function jo({ackKey:t,title:e,text:n,attachmentLabel:r,attachmentUrl:i,checked:o,disabled:a,onToggle:l,showRequiredPill:c=!1}){const u=R(),h=`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:h,children:[s("input",{id:h,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 Ql({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 ft({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 qm({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 zm(t){return t===null?[]:t.split(`
|
|
82
|
+
`).map(e=>e.replace(/^\s*[-•]\s*/,"").trim()).filter(e=>e!=="")}function Um(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 Bm(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 Fm(t,e){return t==="MALE"?e.magiclineGenderMale:t==="FEMALE"?e.magiclineGenderFemale:e.magiclineGenderUnisex}function Vm({message:t,sessionId:e,visitorId:n}){const r=R(),i=t.magiclineForm,o=!!i&&i.status==="open"&&!!i.submissionId,a=zn(ke.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(Rm,{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(um,{formMessageId:t._id,sessionId:e,visitorId:n,slotUnavailable:l,retryPending:c})}const Hm={crawl:"🌐",file:"📄",snippet:"💡",qa:"❓"};function Wm({sources:t}){const e=R(),[n,r]=U(!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=Qm(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:Hm[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 Qm(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}function Gm(){return s("div",{class:"jex-typing",children:[s("span",{}),s("span",{}),s("span",{})]})}const Km=/\s?\[\d+\]/g;function Yr(t){return t.replace(Km,"")}function Ym(t){return t?.at(-1)?._creationTime??0}function Jm(t){return{id:t._id,content:Yr(t.content),role:t.role,authorName:t.authorName}}function Gl(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(Jm)}function Kl(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 Zm(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 Xm=6e4;function eg({conversations:t,greeting:e,botName:n,starterQuestions:r,onPickStarter:i,sessionNotFound:o,resumeFailed:a,onStartFresh:l,sessionId:c,visitorId:u}){const h=R(),m=Ne(null),[d,p]=U(null),[b,S]=U(()=>Date.now()),y=(t??[]).some(v=>v.status==="streaming"&&v.content==="");M(()=>{if(!y)return;const v=setInterval(()=>S(Date.now()),1e4);return()=>clearInterval(v)},[y]);const x=Ym(t),k=Zm(t),A=Nl(),N=Ne(null);M(()=>{if(!u||!t)return;const v=t.at(-1);v&&v.role==="assistant"&&v.status!=="streaming"&&v._id!==N.current&&(N.current=v._id,Gi(u))},[t,u]);const P=t?.at(-1)?.content;M(()=>{m.current?.scrollIntoView({behavior:"smooth"})},[t?.length,P]);const I=c===null||t!==void 0&&t.length===0,L=r.length>0&&!o&&!a&&I;return s("div",{class:"jex-chat-messages",children:[s(Gt,{text:e,botName:n}),L?s($p,{questions:r,disabled:qr.value,onPick:i}):null,o&&a&&l?s("div",{class:"jex-session-prompt",children:[s("div",{class:"jex-session-prompt-text",children:h.sessionNotFoundPrompt}),s("button",{class:"jex-session-prompt-btn",type:"button",onClick:()=>{l()},children:h.startNewConversation})]}):o?s("div",{class:"jex-session-notice",children:h.sessionNotFound}):null,t?.map(v=>{if(v.contentType==="human-notice"){const K=v.noticeKind==="agent-joined"?h.noticeAgentJoined.replace("{name}",v.noticeData?.agentName??""):v.noticeKind==="human-requested"?h.noticeHumanRequested:v.noticeKind==="human-requested-form"?h.noticeHumanRequestedForm:v.noticeKind==="message-received"?h.noticeMessageReceived:v.noticeKind==="agent-handling"?h.noticeAgentHandling:v.noticeKind==="ai-resumed"?h.noticeAiResumed:v.content;return s(Gt,{text:K,botName:n},v._id)}if(v.contentType==="escalation-form"&&c&&u)return vh.value==="screen"&&!v.formData?d===v._id?null:s("div",{class:"jex-inline-form jex-inline-form-card",children:[s("div",{class:"jex-inline-form-title",children:h.escalationPromptTitle}),s("div",{class:"jex-inline-form-subtitle",children:h.escalationPromptSubtitle}),s("button",{class:"jex-form-submit",type:"button",onClick:()=>{wt({id:"escalation-form",formMessageId:v._id,sessionId:c,visitorId:u,waitingSetAt:x})},children:h.escalationPromptSubmit}),s("button",{class:"jex-escalation-skip",type:"button",onClick:()=>{A({formMessageId:v._id,sessionId:c,visitorId:u,waitingSetAt:x}),p(v._id)},children:h.escalationSkip})]},v._id):s(zp,{message:v,sessionId:c,visitorId:u,waitingSetAt:x},v._id);if(v.contentType==="magicline-form"&&c&&u)return s(Vm,{message:v,sessionId:c,visitorId:u},v._id);if(v.contentType==="escalation-confirm"){const K=v.noticeKind==="escalation-confirmed"?h.noticeEscalationConfirmed.replace("{name}",v.noticeData?.visitorName??"").replace("{email}",v.noticeData?.visitorEmail??"").replace("{ref}",v.noticeData?.visitorId??""):v.content;return s(Gt,{text:K,botName:n},v._id)}if(v.role==="user"){const K=Gl(v,t);return s(qp,{id:`jex-msg-${v._id}`,text:v.content,botName:n,onQuote:()=>{eo({id:v._id,content:v.content,role:"user"})},quoted:K,onQuotedClick:(ie,T)=>{Kl(ie,T.currentTarget)},agentNames:k},v._id)}const se={authorId:v.authorId,authorName:v.authorName,authorImage:v.authorImage};if(v.status==="streaming"&&v.content==="")return b-v._creationTime>Xm?s(Gt,{id:`jex-msg-${v._id}`,text:`${h.somethingWentWrong}. ${h.tryAgain}.`,error:!0,botName:n,...se},v._id):s(Gm,{},v._id);if(v.status==="streaming")return s(Gt,{id:`jex-msg-${v._id}`,text:Yr(v.content),streaming:!0,botName:n,...se},v._id);if(v.status==="error")return s(Gt,{id:`jex-msg-${v._id}`,text:v.errorMessage??`${h.somethingWentWrong}. ${h.tryAgain}.`,error:!0,botName:n,...se},v._id);const D=Gl(v,t);return s("div",{children:[s(Gt,{id:`jex-msg-${v._id}`,text:Yr(v.content),botName:n,onQuote:()=>{eo({id:v._id,content:Yr(v.content),role:"assistant",authorName:v.authorName})},quoted:D,onQuotedClick:(K,ie)=>{Kl(K,ie.currentTarget)},...se}),v.sources&&v.sources.length>0?s(Wm,{sources:v.sources}):null]},v._id)}),s("div",{ref:m})]})}function tg(){const t=R();function e(){const n=Jn.peek();n&&(Fs(),wt({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 Yl({message:t}){const[e,n]=U(!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 ng({sessionId:t,visitorId:e}){const n=zn(ke.functions.chat.public.conversations.listBySession,t&&e?{sessionId:t,visitorId:e}:"skip"),r=zn(ke.functions.chat.public.sessions.getSessionStatus,t&&e?{sessionId:t,visitorId:e}:"skip"),i=t!==null&&n===void 0,o=n?.some(a=>a.status==="streaming")??!1;return{conversations:n,sessionStatus:r??null,isLoading:i,isStreaming:o}}function rg(t){const e=R(),n=Ne(null),r=Ne(null),[i,o]=U(!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 ig({sessionId:t,visitorId:e}){const n=Bt(ke.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 og(){return Bt(ke.escalations.public.createEscalationRequest)}function Jl({sessionId:t,visitorId:e,ensureSession:n,onSkipForm:r}){const i=R(),o=og(),[a,l]=U(!1),[c,u]=U(null);async function h(){if(!a){l(!0),u(null);try{const m=t&&e?{sessionId:t,visitorId:e}:await n();if(!m)return;const d=At.value;if(!d)return;const p=await o({sessionId:m.sessionId,visitorId:m.visitorId,bootstrapToken:d,locale:ct.value});if(p.skipForm){r?.();return}wt({id:"escalation-form",formMessageId:p.formMessageId,sessionId:m.sessionId,visitorId:m.visitorId,waitingSetAt:p.waitingSetAt})}catch(m){const d=m instanceof Error?m.message:String(m);u(/RATE_LIMITED|Too many/.test(d)?i.handoffRateLimited:i.handoffFailed)}finally{l(!1)}}}return{requestHuman:h,busy:a,error:c}}function ag({greeting:t,botName:e,starterQuestions:n,sessionId:r,visitorId:i,isLoading:o,sessionNotFound:a,resumeFailed:l,isOrgDeleted:c,ensureSession:u,startFresh:h,maintenance:m}){const d=R(),{conversations:p,sessionStatus:b,isLoading:S,isStreaming:y}=ng({sessionId:r,visitorId:i});rg(p),ig({sessionId:r,visitorId:i}),M(()=>{const L=Jn.peek();if(L===null||!p||p.length===0)return;const{waitingSetAt:v}=L;p.some(D=>D._creationTime>v&&(D.noticeKind==="agent-joined"||!!D.authorId))&&Fs()},[p]);const x=Vs({sessionId:r,visitorId:i,ensureSession:u}),k=Ne((()=>{const L=fn.peek();return L!==null?L:Qi.peek()&&Be.peek()!==null?"resume":"fresh"})()).current,{requestHuman:A,error:N}=Jl({sessionId:r,visitorId:i,ensureSession:u}),P=Fl(()=>{A()});return M(()=>{k==="escalate"&&P()},[k]),M(()=>{fn.value=null},[]),M(()=>{Be.peek()!==null&&u()},[u]),M(()=>{i&&Gi(i)},[i]),c?s("div",{class:"jex-chat-messages",children:s("div",{class:"jex-session-notice",children:d.chatNoLongerAvailable})}):k==="resume"&&!Et.value&&(!r||S)?s(Yl,{message:d.resumeConversation}):s(ee,{children:[s(eg,{conversations:p,greeting:t,botName:e,starterQuestions:n,onPickStarter:L=>{x(L)},sessionNotFound:a,resumeFailed:l,onStartFresh:h,sessionId:r,visitorId:i}),Jn.value!==null&&s(tg,{}),N&&s("div",{class:"jex-session-error-notice",role:"alert",style:{margin:"8px 16px 0"},children:N}),s(sf,{sessionId:r,visitorId:i,isLoading:o,isStreaming:y,sessionStatus:b,ensureSession:u,onStartFresh:h,maintenance:m})]})}function Zl(t){return zn(ke.functions.chat.public.availability.getOrgAvailability,t?{orgSlug:t}:"skip")}function Xl(t){return t?.anyOnline?"online":t?.anyAway?"away":"offline"}function sg({formMessageId:t,sessionId:e,visitorId:n,orgSlug:r}){const i=R(),o=Hn.value,a=/^https?:\/\//i.test(o)?o:Vn,[l,c]=U(""),[u,h]=U(""),m=Zl(r),d=m&&!m.anyOnline?i.escalationOfflineSubtitle:i.escalationSubtitle,p=Pl(),[b,S]=U(!1),[y,x]=U(null);async function k(A){A.preventDefault(),S(!0),x(null);try{await p({sessionId:e,visitorId:n,formMessageId:t,visitorName:l.trim(),visitorEmail:u.trim(),locale:ct.value}),Ki()}catch(N){ne.error("[EscalationFormScreen] Submit failed:",N),x(i.escalationSubmitFailed)}finally{S(!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:d}),y&&s("div",{class:"jex-form-error",role:"alert",children:y}),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=>{h(A.currentTarget.value)}}),s("button",{class:"jex-form-submit",type:"submit",disabled:b,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 ec({sessionId:t,visitorId:e,ensureSession:n,availability:r}){const i=R(),{requestHuman:o,busy:a,error:l}=Jl({sessionId:t,visitorId:e,ensureSession:n}),c=`jex-presence-dot--${Xl(r)}`,u=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,"aria-label":i.talkToHumanAria,title:u,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 ${c}`,"aria-hidden":"true"})]}),l&&s("div",{class:"jex-handoff-error",role:"alert",children:l})]})}async function lg(){const t=ms.value;if(!t)return ne.warn("[JexityChat] Bootstrap refresh skipped — inputs missing"),{ok:!1,reason:"no-inputs"};const e=await Bi(t.orgSlug,t.siteUrl,t.projSlug);if(!e.ok)return ne.warn("[JexityChat] Bootstrap refresh failed:",e.error),{ok:!1,reason:e.error};const n=e.token;return At.value=n,{ok:!0,token:n}}function tc(t){return Bs(t)?"maintenance":nc(t)?"unauthorized":t instanceof Error&&/network|fetch|failed to fetch/i.test(t.message)?"network":"unknown"}function nc(t){return t instanceof vr?t.data?.code==="UNAUTHORIZED_ORIGIN":!1}function cg(t=1e4){return At.value?Promise.resolve(At.value):new Promise(e=>{let n=!1;const r=a=>{n||(n=!0,clearTimeout(i),o(),e(a))},i=setTimeout(()=>{r(null)},t),o=At.subscribe(a=>{a&&r(a)})})}function ug(t,e){const n=Ne(null),r=hn(!1),i=hn(!1),o=hn(!1),a=hn(null),l=Bt(ke.functions.chat.public.sessions.createOrResume),c=Y(async p=>{const b=await cg();if(!b)return ne.warn("[JexityChat] No bootstrap token after 10s — session creation blocked."),Et.value="no-token",null;const S=k=>({orgSlug:t,...e?{projSlug:e}:{},visitorId:p,bootstrapToken:k,locale:ct.value,...Mr.value?{source:Mr.value}:{},...typeof window<"u"?{pagePath:window.location.pathname}:{}});Ji.value=!0;let y;try{try{y=await l(S(b))}catch(k){if(!nc(k))throw k;const A=await lg();if(!A.ok)return Et.value=A.reason==="rate_limited"?"network":"unauthorized",null;y=await l(S(A.token))}}finally{Ji.value=!1}Et.value=null,a.value=y.status;const x={sessionId:y.sessionId,visitorId:p};return n.current=x,{session:x,result:y}},[t,e,l,a]),u=Y(async()=>{if(n.current)return n.current;if(o.value)return null;r.value=!0;const p=Be.value!==null,b=Be.value??Cs();try{const S=await c(b);return S?(p&&S.result.isNew&&(i.value=!0,o.value=!0),S.session):null}catch(S){return ne.error("[JexityChat] Failed to create session:",S),Et.value=tc(S),null}finally{r.value=!1}},[c,r,i,o]),h=Y(()=>{n.current=null,i.value=!1,o.value=!1,Us(),mn.value=null},[i,o]);M(()=>kh(h),[h]);const m=Y(async()=>{n.current=null,o.value=!1,i.value=!1,Us(),mn.value=null;const p=Cs();r.value=!0;try{return(await c(p))?.session??null}catch(b){return ne.error("[JexityChat] Failed to create fresh session:",b),Et.value=tc(b),null}finally{r.value=!1}},[c,r,i,o]),d=n.current;return{sessionId:d?.sessionId??null,visitorId:d?.visitorId??null,isLoading:r.value,sessionNotFound:i.value,resumeFailed:o.value,sessionStatus:a.value,isOrgDeleted:a.value==="org_deleted",ensureSession:u,startFresh:m,resetSession:h}}function dg({botName:t,availability:e,onResetSession:n}){const r=R(),[i,o]=U(""),a=e?.anyOnline===!0,l=Xl(e);function c(){Lr(),fn.value="escalate",n(),As(),wt({id:"chat"})}function u(){Lr(),fn.value="fresh",n(),As(),wt({id:"chat"})}function h(d){Lr(),fn.value="resume",n(),Rs(d),wt({id:"chat"})}function m(d){d.preventDefault();const p=i.trim().toUpperCase();p&&(Lr(),fn.value="resume",n(),Rs(p),wt({id:"chat"}))}return s("div",{class:"jex-home",children:[Qn.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(Os,{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:[Ce.value.length>0&&s(ee,{children:[s("span",{class:"jex-home-section-label",children:r.pickUpWhereLeftOff}),s("div",{class:"jex-home-history",children:Ce.value.slice().reverse().map(d=>s("button",{class:"jex-home-resume-card",onClick:()=>{h(d.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:d.ref}),s("span",{class:"jex-home-resume-meta",children:r.resumeListTimestamp.replace("{minutes}",String(Math.max(1,Math.round((Date.now()-d.lastActivityAt)/6e4))))})]},d.ref))})]}),s("button",{class:"jex-home-new-btn",onClick:u,children:Ce.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:d=>{o(d.currentTarget.value)}}),s("button",{class:"jex-home-lookup-submit",type:"submit",disabled:!i.trim(),children:r.resume})]})]})]})}function hg({title:t}){const e=R();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:()=>wt({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:()=>wt({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 fg(){const t=R(),[e,n]=U(""),[r,i]=U(""),[o,a]=U("");async function l(c){c.preventDefault(),Yi({id:"loading",message:t.submittingTicket}),await new Promise(h=>{setTimeout(h,1200)});const u="JEX-"+Math.random().toString(36).slice(2,8).toUpperCase();Yi({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 pg({ticketRef:t}){const e=R();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:()=>{ae.value=!1},children:e.done})]})}function mg({message:t,onRetry:e,onBack:n}){const r=R();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 rc({greeting:t,starterQuestions:e,title:n,botName:r,orgSlug:i,availability:o,sessionId:a,visitorId:l,isLoading:c,sessionNotFound:u,resumeFailed:h,isOrgDeleted:m,ensureSession:d,startFresh:p,resetSession:b,maintenance:S}){const y=Le.value,x=y[y.length-1],k=[...y].reverse().find(A=>A.id==="confirmation");return s("div",{class:"jex-screen-container",children:[x.id==="home"&&s(dg,{botName:r,availability:o,onResetSession:b}),x.id==="selection"&&s(hg,{title:n}),x.id==="form"&&s(fg,{}),x.id==="escalation-form"&&s(sg,{formMessageId:x.formMessageId,sessionId:x.sessionId,visitorId:x.visitorId,orgSlug:i,waitingSetAt:x.waitingSetAt}),x.id==="confirmation"&&k&&s(pg,{ticketRef:k.ref}),x.id==="chat"&&s(ag,{greeting:t,botName:r,starterQuestions:e,sessionId:a,visitorId:l,isLoading:c,sessionNotFound:u,resumeFailed:h,isOrgDeleted:m,ensureSession:d,startFresh:p,maintenance:S}),x.id==="loading"&&s(Yl,{message:x.message}),x.id==="error"&&s(mg,{message:x.message,onRetry:()=>Yi({id:"loading"}),onBack:Ki})]})}function gg({options:t}){return nh({orgSlug:t.orgSlug,projSlug:t.projSlug,preToken:t.bootstrapToken,convexUrl:t.convexUrl,preAllowedUrls:t.allowedUrls??[],preExcludedPaths:t.excludePaths,preMaintenance:t.maintenance}),oh()?s(xg,{options:t}):null}function xg({options:t}){const e=Qd(),n=eh(t.orgSlug,t.projSlug,t.convexUrl,t.preloadedConfig);uh(t.parentOrigin),M(()=>(xh(),yh(),()=>{Wi.value=!1}),[]);const{sessionId:r,visitorId:i,isLoading:o,sessionNotFound:a,resumeFailed:l,isOrgDeleted:c,ensureSession:u,startFresh:h,resetSession:m}=ug(t.orgSlug,t.projSlug),d=Zl(t.orgSlug),p=Yd(t,n.config),b=Rt.value,S=Wi.value,y=n.config!==null||b!==void 0||n.settled,x=n.config!==null?p.sessionTimeoutMs:b!==void 0?b:p.sessionTimeoutMs;M(()=>{ct.value=ks(p.locale)},[p.locale]),M(()=>{Hn.value=p.privacyPolicyUrl??Vn,$i.value=p.privacyNoticeStyle},[p.privacyNoticeStyle,p.privacyPolicyUrl]),M(()=>{if(!ae.value||p.mode==="embedded"||!window.matchMedia("(max-width: 480px), (pointer: coarse) and (max-width: 768px)").matches)return;const $e=document.documentElement.style.overflow;return document.documentElement.style.overflow="hidden",()=>{document.documentElement.style.overflow=$e}},[ae.value,p.mode]),M(()=>{if(S&&y&&p.mode!=="embedded"&&x!==null)try{return jh(x)}catch(J){ne.warn("[JexityChat] Idle-lock watcher failed to start:",J);return}},[S,p.mode,y,x]),M(()=>{if(!S||!y)return;const{activeRefPruned:J}=bh(x);J&&Xi()},[S,y,x]);const k=p.position==="bottom-left",A=p.colorScheme==="dark"||p.colorScheme==="light"?p.colorScheme:"",N=Sh({...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",I=t.trigger==="none",L=t.windowPosition==="middle-center",v=Le.value,D=v[v.length-1]?.id==="chat",K=n.config!==null||P||!!t.parentOrigin,ie=K?N:{...N,visibility:"hidden"},T=Oh(t.orgSlug,t.projSlug);return M(()=>{if(P||I||!K||p.proactiveMode==="off"||Ls(T))return;const J=t.proactiveAlreadyElapsed?0:p.proactiveDelaySeconds*1e3,$e=window.setTimeout(()=>{const De=$h({mode:p.proactiveMode,isOpen:ae.peek(),hasHistory:Qi.peek(),dismissed:Ls(T)});De==="teaser"?Dr.value=!0:De==="open"&&(ae.value=!0)},J);return()=>{window.clearTimeout($e)}},[P,I,K,p.proactiveMode,p.proactiveDelaySeconds,T,t.proactiveAlreadyElapsed]),s("div",{class:`jex-widget ${A}`.trim(),style:ie,children:P?s("div",{class:"jex-embedded",children:[s(Ns,{title:p.title,rightAction:D?s(ec,{sessionId:r,visitorId:i,ensureSession:u,availability:d}):null,showClose:!P}),s(rc,{greeting:p.greeting,starterQuestions:p.starterQuestions,title:p.title,botName:p.botName,orgSlug:t.orgSlug,projSlug:t.projSlug,availability:d,sessionId:r,visitorId:i,isLoading:o,sessionNotFound:a,resumeFailed:l,isOrgDeleted:c,ensureSession:u,startFresh:h,resetSession:m,maintenance:e}),!p.hideBranding&&s(Ms,{})]}):s("div",{class:`jex-container${k?" jex-pos-left":""}`,children:[ae.value&&s("div",{class:`jex-chat-window${L?" jex-win-center":""}`,children:[s(Ns,{title:p.title,rightAction:D?s(ec,{sessionId:r,visitorId:i,ensureSession:u,availability:d}):null}),s(rc,{greeting:p.greeting,starterQuestions:p.starterQuestions,title:p.title,botName:p.botName,orgSlug:t.orgSlug,projSlug:t.projSlug,availability:d,sessionId:r,visitorId:i,isLoading:o,sessionNotFound:a,resumeFailed:l,isOrgDeleted:c,ensureSession:u,startFresh:h,resetSession:m,maintenance:e}),!p.hideBranding&&s(Ms,{})]}),Dr.value&&!ae.value&&!I&&s(Dh,{title:p.title,message:p.greeting,guardKey:T}),!I&&s(Mh,{iconOption:p.triggerIcon,radius:p.triggerRadius,label:p.triggerLabel})]})})}const bg=`.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 h3{font-size:16px;font-weight:600;color:var(--jex-text-header);margin:0}.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:hover{transform:scale(1.08)}.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-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 yg(t){const e=document.createElement("style");e.textContent=bg,t.appendChild(e)}const vg=Ad,wg="https://tame-spider-109.eu-west-1.convex.cloud";let So=null;function kg(t){const e=t??wg;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 So||(So=new Td(Gd(e))),So}function _g(t,e){const n=t.shadowRoot??t.attachShadow({mode:"open"});for(;n.firstChild;)n.removeChild(n.firstChild);yg(n),Mr.value=e.source,At.value=e.bootstrapToken,Le.value=[{id:"home"}],e.mode==="embedded"&&(t.classList.add("jex-mode-embedded"),ae.value=!0);const r=document.createElement("div");return e.mode==="embedded"&&(r.style.cssText="width:100%;height:100%"),n.appendChild(r),qt(s(vg,{client:kg(e.convexUrl),children:s(gg,{options:e})}),r),function(){qt(null,r),ae.value=!1,Mr.value=void 0,At.value=void 0,Le.value=[{id:"home"}]}}function jg(t,e,n){const r=_g(t,e),i=new Set,o=ae.subscribe(l=>{for(const c of i)c(l)});return{shutdown(){o(),i.clear(),r(),n&&n()},open(){ae.value=!0},close(){ae.value=!1},toggle(){ae.value=!ae.value},get isOpen(){return ae.value},subscribe(l){return i.add(l),()=>{i.delete(l)}}}}let ar=null;function Sg(t){ar&&ar.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=jg(e,t,()=>{t.container||e.remove(),ar===n&&(ar=null)});return ar=n,n}function Ot(t,e){return t.getAttribute(e)??void 0}function ic(t,e){const n=t.getAttribute(e);if(!n)return;const r=parseInt(n,10);return Number.isNaN(r)?void 0:r}async function oc(){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=Ot(t,"data-convex-url")??"https://tame-spider-109.eu-west-1.convex.cloud"??"",i=Ui(r),o=await Bi(e,i,n);if(!o.ok){const l=window.location.origin,c=n?`project '${e}/${n}'`:`org '${e}'`;o.error==="unauthorized"?ne.warn(`[JexityChat] This domain is not authorized for ${c}. Add '${l}' under Allowed Domains in your Jexity dashboard.`):o.error==="not_found"?ne.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"?ne.warn(`[JexityChat] Bootstrap rate-limited for ${c}. Retry after ${o.retryAfterSec??60}s.`):ne.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=>Fi(window.location.href,l))){const l=n?`project '${e}/${n}'`:`org '${e}'`;ne.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:Ot(t,"data-position")??void 0,theme:Ot(t,"data-theme")??void 0,greeting:Ot(t,"data-greeting"),title:Ot(t,"data-title"),primaryColor:Ot(t,"data-primary-color"),locale:Ot(t,"data-locale"),convexUrl:Ot(t,"data-convex-url"),triggerOffsetX:ic(t,"data-trigger-offset-x"),triggerOffsetY:ic(t,"data-trigger-offset-y")};window.JexityChat=Sg(a)}document.readyState==="complete"?oc():window.addEventListener("load",oc)})();
|
|
80
84
|
//# sourceMappingURL=widget.js.map
|