@evelan/jexity-widget 0.21.6 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +289 -264
- package/dist/index.mjs.map +1 -1
- package/dist/react.mjs +271 -246
- package/dist/react.mjs.map +1 -1
- package/dist/types/features/chat/components/MarkdownContent.d.ts.map +1 -1
- package/dist/types/features/chat/components/cards.d.ts +32 -0
- package/dist/types/features/chat/components/cards.d.ts.map +1 -0
- package/dist/widget.js +8 -6
- package/dist/widget.js.map +1 -1
- package/package.json +2 -2
package/dist/widget.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(){"use strict";var Tn,P,No,Mo,Ct,Oo,Lo,$o,ri,hr,Cn,Do,ii,oi,ai,qo,fr={},pr=[],fc=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,An=Array.isArray;function it(t,e){for(var n in e)t[n]=e[n];return t}function si(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function Be(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 pc(){return{current:null}}function Z(t){return t.children}function Ye(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 mc(t){if(t.__P&&t.__d){var e=t.__v,n=e.__e,r=[],i=[],o=it({},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,mc(t)}finally{Ct.length=mr.__r=0}}function Uo(t,e,n,r,i,o,a,l,c,u,h){var m,d,p,x,k,b,v,w=r&&r.__k||pr,R=e.length;for(c=gc(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,h),x=p.__e,p.ref&&d.ref!=p.ref&&(d.ref&&di(d.ref,null,p),h.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 gc(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]=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=xc(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=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 ot(t,e){return e=e||[],t==null||typeof t=="boolean"||(An(t)?t.some(function(n){ot(n,e)}):e.push(t)),e}function xc(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 Fo(t,e,n){e[0]=="-"?t.setProperty(e,n??""):t[e]=n==null?"":typeof n!="number"||fc.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 h,m,d,p,x,k,b,v,w,R,y,I,N,L,W,ge,F=e.type;if(e.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[l=e.__e=n.__e]),(h=P.__b)&&h(e);e:if(typeof F=="function"){m=a.length;try{if(w=e.props,R=F.prototype&&F.prototype.render,y=(h=F.contextType)&&r[h.__c],I=h?y?y.props.value:h.__:r,n.__c?v=(d=e.__c=n.__c).__=d.__E:(R?e.__c=d=new F(w,I):(e.__c=d=new Ye(w,I),d.constructor=F,d.render=yc),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&&F.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=it({},d.__s)),it(d.__s,F.getDerivedStateFromProps(w,d.__s))),x=d.props,k=d.state,d.__v=e,p)R&&F.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),R&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(R&&F.getDerivedStateFromProps==null&&w!==x&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(w,I),e.__v==n.__v||!d.__e&&d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(w,d.__s,I)===!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(X){X&&(X.__=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,I),R&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(x,k,b)})}if(d.context=I,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),h=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),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())),R&&!p&&d.getSnapshotBeforeUpdate!=null&&(b=d.getSnapshotBeforeUpdate(x,k)),W=h!=null&&h.type===Z&&h.key==null?Wo(h.props.children):h,l=Uo(t,An(W)?W:[W],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(X){if(a.length=m,e.__v=null,c||o!=null)if(X.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(ge=o.length;ge--;)si(o[ge]);ui(e)}else e.__e=n.__e,!e.__k&&n.__k&&(e.__k=n.__k),X.then||ui(e);P.__e(X,e,n)}}else o==null&&e.__v==n.__v?(e.__k=n.__k,e.__e=n.__e):l=e.__e=bc(n.__e,e,n,r,i,o,a,c,u);return(h=P.diffed)&&h(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:it({},t)}function bc(t,e,n,r,i,o,a,l,c){var u,h,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"?h=p:u=="value"?x=p:u=="checked"?k=p:l&&typeof p!="function"||b[u]===p||gr(t,u,p,b[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=""),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 yc(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=Be(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 vc(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?Tn.call(arguments,2):n),Rn(t.type,l,r||t.key,i||t.ref,null)}function wc(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},Ye.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),li(this))},Ye.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),li(this))},Ye.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 kc=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:--kc,__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 h=!1,m=r.__c.props!==l;if(r.__c.__H.__.some(function(p){if(p.__N){h=!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 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=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,he(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 he(t,e){var n=en(At++,7);return pi(n.__H,e)&&(n.__=t(),n.__H=e,n.__h=t),n.__}function K(t,e){return Xt=8,he(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)||_c)(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 _c(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 jc(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,Be(t,i)}return r.displayName="Memo("+(t.displayName||t.name)+")",r.__f=r.prototype.isReactComponent=!0,r.type=t,r}(xi.prototype=new Ye).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 Sc=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function Tc(t){function e(n){var r=ua({},n);return delete r.ref,t(r,n.ref||null)}return e.$$typeof=Sc,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:ot(ot(t).map(e))},Cc={map:xa,forEach:xa,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},Ac=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)}Ac(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 Rc(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?Be(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 Ye).__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 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)},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&&Be(Z,null,t.fallback);return a&&(a.__u&=-33),[Be(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 Ec(t){return this.getChildContext=function(){return t.context},t.children}function Ic(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(Be(Ec,{context:e.context},t.__v),e.h)}function Pc(t,e){var n=Be(Ic,{__v:t,v:e});return n.containerInfo=e,n}(Pn.prototype=new Ye).__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=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){ka(t,n,e)})};var _a=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,Nc=/^(?: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]/,Mc=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Oc=/[A-Z0-9]/g,Lc=typeof document<"u",$c=function(t){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(t)};function Dc(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 Go(t,e),typeof n=="function"&&n(),t?t.__c:null}Ye.prototype.isReactComponent=!0,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(t){Object.defineProperty(Ye.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,zc={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||Lc&&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"||$c(n.type)?c==="onfocus"?a="onfocusin":c==="onblur"?a="onfocusout":Mc.test(a)&&(a=c):c=a="oninput":o&&Nc.test(a)?a=a.replace(Oc,"-$&").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",zc)):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 Uc={ReactCurrentDispatcher:{current:{readContext:function(t){return bi.__n[t.__c].props.value},useCallback:K,useContext:In,useDebugValue:ia,useDeferredValue:fa,useEffect:M,useId:oa,useImperativeHandle:ra,useInsertionEffect:ma,useLayoutEffect:En,useMemo:he,useReducer:De,useRef:qe,useState:q,useSyncExternalStore:da,useTransition:pa}}};function Bc(t){return Be.bind(null,t)}function br(t){return!!t&&t.$$typeof===_a}function Fc(t){return br(t)&&t.type===Z}function Vc(t){return!!t&&typeof t.displayName=="string"&&t.displayName.indexOf("Memo(")==0}function Hc(t){return br(t)?vc.apply(null,arguments):t}function Wc(t){return!!t.__k&&(qt(null,t),!0)}function Qc(t){return t&&(t.base||t.nodeType===1&&t)||null}for(var Gc=function(t,e){return t(e)},Kc=function(t,e){var n=P.debounceRendering;P.debounceRendering=function(i){return i()};var r=t(e);return P.debounceRendering=n,r},Yc=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:he,useCallback:K,useContext:In,useDebugValue:ia,version:"18.3.1",Children:Cc,render:Dc,hydrate:qc,unmountComponentAtNode:Wc,createPortal:Pc,createElement:Be,createContext:wc,createFactory:Bc,cloneElement:Hc,createRef:pc,Fragment:Z,isValidElement:br,isElement:Yc,isFragment:Fc,isMemo:Vc,findDOMNode:Qc,Component:Ye,PureComponent:xi,memo:jc,forwardRef:Tc,flushSync:Kc,unstable_batchedUpdates:Gc,StrictMode:Z,Suspense:xr,SuspenseList:Pn,lazy:Rc,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Uc},at=[],Fe=[],Jc=Uint8Array,vi="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",tn=0,Zc=vi.length;tn<Zc;++tn)at[tn]=vi[tn],Fe[vi.charCodeAt(tn)]=tn;Fe[45]=62,Fe[95]=63;function Xc(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 eu(t,e,n){return(e+n)*3/4-n}function Nn(t){var e,n=Xc(t),r=n[0],i=n[1],o=new Jc(eu(t,r,i)),a=0,l=i>0?r-4:r,c;for(c=0;c<l;c+=4)e=Fe[t.charCodeAt(c)]<<18|Fe[t.charCodeAt(c+1)]<<12|Fe[t.charCodeAt(c+2)]<<6|Fe[t.charCodeAt(c+3)],o[a++]=e>>16&255,o[a++]=e>>8&255,o[a++]=e&255;return i===2&&(e=Fe[t.charCodeAt(c)]<<2|Fe[t.charCodeAt(c+1)]>>4,o[a++]=e&255),i===1&&(e=Fe[t.charCodeAt(c)]<<10|Fe[t.charCodeAt(c+1)]<<4|Fe[t.charCodeAt(c+2)]>>2,o[a++]=e>>8&255,o[a++]=e&255),o}function tu(t){return at[t>>18&63]+at[t>>12&63]+at[t>>6&63]+at[t&63]}function nu(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(tu(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(nu(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(!Aa(t))throw new Error(`The arguments to a Convex function must be an object. Received: ${t}`);return t}function ru(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"),iu=BigInt("8"),ou=BigInt("256");function Ea(t){return Number.isNaN(t)||!Number.isFinite(t)||Object.is(t,-0)}function au(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>>=iu;return Mn(n)}function su(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)*ou**r,r++;return n>wi&&(n+=nn+nn),n}function lu(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 cu(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 uu=DataView.prototype.setBigInt64?lu:au,du=DataView.prototype.getBigInt64?cu:su,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 du(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:uu(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 st(t){return _i(t,t,"")}var hu=Object.defineProperty,fu=(t,e,n)=>e in t?hu(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Si=(t,e,n)=>fu(t,typeof e!="symbol"?e+"":e,n),Ma,Oa;const pu=Symbol.for("ConvexError");class yr extends(Oa=Error,Ma=pu,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 mu=Object.defineProperty,gu=(t,e,n)=>e in t?mu(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Da=(t,e,n)=>gu(t,typeof e!="symbol"?e+"":e,n);const xu="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}]`,xu,c)}else t.error(`[CONVEX ${o}(${r})] ${i}`)}function bu(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}
|
|
1
|
+
(function(){"use strict";var Tn,P,No,Mo,Ct,Oo,Lo,$o,ri,hr,Cn,Do,ii,oi,ai,qo,fr={},pr=[],fc=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,An=Array.isArray;function it(t,e){for(var n in e)t[n]=e[n];return t}function si(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function Be(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 pc(){return{current:null}}function Z(t){return t.children}function Ye(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 mc(t){if(t.__P&&t.__d){var e=t.__v,n=e.__e,r=[],i=[],o=it({},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,mc(t)}finally{Ct.length=mr.__r=0}}function Uo(t,e,n,r,i,o,a,l,c,u,h){var m,d,p,x,k,b,v,w=r&&r.__k||pr,R=e.length;for(c=gc(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,h),x=p.__e,p.ref&&d.ref!=p.ref&&(d.ref&&di(d.ref,null,p),h.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 gc(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]=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=xc(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=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 ot(t,e){return e=e||[],t==null||typeof t=="boolean"||(An(t)?t.some(function(n){ot(n,e)}):e.push(t)),e}function xc(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 Fo(t,e,n){e[0]=="-"?t.setProperty(e,n??""):t[e]=n==null?"":typeof n!="number"||fc.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 h,m,d,p,x,k,b,v,w,R,y,I,N,L,Q,ge,V=e.type;if(e.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[l=e.__e=n.__e]),(h=P.__b)&&h(e);e:if(typeof V=="function"){m=a.length;try{if(w=e.props,R=V.prototype&&V.prototype.render,y=(h=V.contextType)&&r[h.__c],I=h?y?y.props.value:h.__:r,n.__c?v=(d=e.__c=n.__c).__=d.__E:(R?e.__c=d=new V(w,I):(e.__c=d=new Ye(w,I),d.constructor=V,d.render=yc),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&&V.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=it({},d.__s)),it(d.__s,V.getDerivedStateFromProps(w,d.__s))),x=d.props,k=d.state,d.__v=e,p)R&&V.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),R&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(R&&V.getDerivedStateFromProps==null&&w!==x&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(w,I),e.__v==n.__v||!d.__e&&d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(w,d.__s,I)===!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(X){X&&(X.__=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,I),R&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(x,k,b)})}if(d.context=I,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),h=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),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())),R&&!p&&d.getSnapshotBeforeUpdate!=null&&(b=d.getSnapshotBeforeUpdate(x,k)),Q=h!=null&&h.type===Z&&h.key==null?Wo(h.props.children):h,l=Uo(t,An(Q)?Q:[Q],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(X){if(a.length=m,e.__v=null,c||o!=null)if(X.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(ge=o.length;ge--;)si(o[ge]);ui(e)}else e.__e=n.__e,!e.__k&&n.__k&&(e.__k=n.__k),X.then||ui(e);P.__e(X,e,n)}}else o==null&&e.__v==n.__v?(e.__k=n.__k,e.__e=n.__e):l=e.__e=bc(n.__e,e,n,r,i,o,a,c,u);return(h=P.diffed)&&h(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:it({},t)}function bc(t,e,n,r,i,o,a,l,c){var u,h,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"?h=p:u=="value"?x=p:u=="checked"?k=p:l&&typeof p!="function"||b[u]===p||gr(t,u,p,b[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=""),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 yc(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=Be(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 vc(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?Tn.call(arguments,2):n),Rn(t.type,l,r||t.key,i||t.ref,null)}function wc(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},Ye.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),li(this))},Ye.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),li(this))},Ye.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 kc=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:--kc,__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 h=!1,m=r.__c.props!==l;if(r.__c.__H.__.some(function(p){if(p.__N){h=!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 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=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,he(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 he(t,e){var n=en(At++,7);return pi(n.__H,e)&&(n.__=t(),n.__H=e,n.__h=t),n.__}function K(t,e){return Xt=8,he(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)||_c)(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 _c(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 jc(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,Be(t,i)}return r.displayName="Memo("+(t.displayName||t.name)+")",r.__f=r.prototype.isReactComponent=!0,r.type=t,r}(xi.prototype=new Ye).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 Sc=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function Tc(t){function e(n){var r=ua({},n);return delete r.ref,t(r,n.ref||null)}return e.$$typeof=Sc,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:ot(ot(t).map(e))},Cc={map:xa,forEach:xa,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},Ac=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)}Ac(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 Rc(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?Be(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 Ye).__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 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)},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&&Be(Z,null,t.fallback);return a&&(a.__u&=-33),[Be(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 Ec(t){return this.getChildContext=function(){return t.context},t.children}function Ic(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(Be(Ec,{context:e.context},t.__v),e.h)}function Pc(t,e){var n=Be(Ic,{__v:t,v:e});return n.containerInfo=e,n}(Pn.prototype=new Ye).__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=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){ka(t,n,e)})};var _a=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,Nc=/^(?: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]/,Mc=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Oc=/[A-Z0-9]/g,Lc=typeof document<"u",$c=function(t){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(t)};function Dc(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 Go(t,e),typeof n=="function"&&n(),t?t.__c:null}Ye.prototype.isReactComponent=!0,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(t){Object.defineProperty(Ye.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,zc={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||Lc&&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"||$c(n.type)?c==="onfocus"?a="onfocusin":c==="onblur"?a="onfocusout":Mc.test(a)&&(a=c):c=a="oninput":o&&Nc.test(a)?a=a.replace(Oc,"-$&").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",zc)):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 Uc={ReactCurrentDispatcher:{current:{readContext:function(t){return bi.__n[t.__c].props.value},useCallback:K,useContext:In,useDebugValue:ia,useDeferredValue:fa,useEffect:M,useId:oa,useImperativeHandle:ra,useInsertionEffect:ma,useLayoutEffect:En,useMemo:he,useReducer:De,useRef:qe,useState:q,useSyncExternalStore:da,useTransition:pa}}};function Bc(t){return Be.bind(null,t)}function br(t){return!!t&&t.$$typeof===_a}function Fc(t){return br(t)&&t.type===Z}function Vc(t){return!!t&&typeof t.displayName=="string"&&t.displayName.indexOf("Memo(")==0}function Hc(t){return br(t)?vc.apply(null,arguments):t}function Wc(t){return!!t.__k&&(qt(null,t),!0)}function Qc(t){return t&&(t.base||t.nodeType===1&&t)||null}for(var Gc=function(t,e){return t(e)},Kc=function(t,e){var n=P.debounceRendering;P.debounceRendering=function(i){return i()};var r=t(e);return P.debounceRendering=n,r},Yc=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:he,useCallback:K,useContext:In,useDebugValue:ia,version:"18.3.1",Children:Cc,render:Dc,hydrate:qc,unmountComponentAtNode:Wc,createPortal:Pc,createElement:Be,createContext:wc,createFactory:Bc,cloneElement:Hc,createRef:pc,Fragment:Z,isValidElement:br,isElement:Yc,isFragment:Fc,isMemo:Vc,findDOMNode:Qc,Component:Ye,PureComponent:xi,memo:jc,forwardRef:Tc,flushSync:Kc,unstable_batchedUpdates:Gc,StrictMode:Z,Suspense:xr,SuspenseList:Pn,lazy:Rc,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Uc},at=[],Fe=[],Jc=Uint8Array,vi="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",tn=0,Zc=vi.length;tn<Zc;++tn)at[tn]=vi[tn],Fe[vi.charCodeAt(tn)]=tn;Fe[45]=62,Fe[95]=63;function Xc(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 eu(t,e,n){return(e+n)*3/4-n}function Nn(t){var e,n=Xc(t),r=n[0],i=n[1],o=new Jc(eu(t,r,i)),a=0,l=i>0?r-4:r,c;for(c=0;c<l;c+=4)e=Fe[t.charCodeAt(c)]<<18|Fe[t.charCodeAt(c+1)]<<12|Fe[t.charCodeAt(c+2)]<<6|Fe[t.charCodeAt(c+3)],o[a++]=e>>16&255,o[a++]=e>>8&255,o[a++]=e&255;return i===2&&(e=Fe[t.charCodeAt(c)]<<2|Fe[t.charCodeAt(c+1)]>>4,o[a++]=e&255),i===1&&(e=Fe[t.charCodeAt(c)]<<10|Fe[t.charCodeAt(c+1)]<<4|Fe[t.charCodeAt(c+2)]>>2,o[a++]=e>>8&255,o[a++]=e&255),o}function tu(t){return at[t>>18&63]+at[t>>12&63]+at[t>>6&63]+at[t&63]}function nu(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(tu(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(nu(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(!Aa(t))throw new Error(`The arguments to a Convex function must be an object. Received: ${t}`);return t}function ru(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"),iu=BigInt("8"),ou=BigInt("256");function Ea(t){return Number.isNaN(t)||!Number.isFinite(t)||Object.is(t,-0)}function au(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>>=iu;return Mn(n)}function su(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)*ou**r,r++;return n>wi&&(n+=nn+nn),n}function lu(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 cu(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 uu=DataView.prototype.setBigInt64?lu:au,du=DataView.prototype.getBigInt64?cu:su,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 du(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:uu(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 st(t){return _i(t,t,"")}var hu=Object.defineProperty,fu=(t,e,n)=>e in t?hu(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Si=(t,e,n)=>fu(t,typeof e!="symbol"?e+"":e,n),Ma,Oa;const pu=Symbol.for("ConvexError");class yr extends(Oa=Error,Ma=pu,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 mu=Object.defineProperty,gu=(t,e,n)=>e in t?mu(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Da=(t,e,n)=>gu(t,typeof e!="symbol"?e+"":e,n);const xu="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}]`,xu,c)}else t.error(`[CONVEX ${o}(${r})] ${i}`)}function bu(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
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:st(e)})}function Fa(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 yu=Object.defineProperty,vu=(t,e,n)=>e in t?yu(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,lt=(t,e,n)=>vu(t,typeof e!="symbol"?e+"":e,n);class wu{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 ku=Object.defineProperty,_u=(t,e,n)=>e in t?ku(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,wr=(t,e,n)=>_u(t,typeof e!="symbol"?e+"":e,n);class ju{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"),Su=Symbol.for("toReferencePath");function Tu(t){return t[Su]??null}function Cu(t){return t.startsWith("function://")}function Au(t){let e;if(typeof t=="string")Cu(t)?e={functionHandle:t}:e={name:t};else if(t[Ln])e={name:t[Ln]};else{const n=Tu(t);if(!n)throw new Error(`${t} is not a functionReference`);e={reference:n}}return e}function Re(t){const e=Au(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 Ru=Object.defineProperty,Eu=(t,e,n)=>e in t?Ru(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,kr=(t,e,n)=>Eu(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 Iu{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 Pu=Object.defineProperty,Nu=(t,e,n)=>e in t?Pu(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Ai=(t,e,n)=>Nu(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>=Mu?Ou: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,Mu=Dn*Dn,Ou=new Ne(-1,-1);var Lu=Object.defineProperty,$u=(t,e,n)=>e in t?Lu(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,_r=(t,e,n)=>$u(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 Du(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 qu(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:Du(t.maxObservedTimestamp)}:{...t,maxObservedTimestamp:void 0}}}var zu=Object.defineProperty,Uu=(t,e,n)=>e in t?zu(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,fe=(t,e,n)=>Uu(t,typeof e!="symbol"?e+"":e,n);const Bu=1e3,Fu=1001,Vu=1005,Hu=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 Wu(t){if(t===void 0)return"Unknown";for(const e of Object.keys(Ya))if(t.startsWith(e))return e;return"Unknown"}class Qu{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=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!==Bu&&n.code!==Fu&&n.code!==Vu&&n.code!==Hu){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=Wu(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=qu(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 Gu(){return Ku()}function Ku(){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 Yu(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 Ju(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 Yu(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=Ju(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 Zu=Object.defineProperty,Xu=(t,e,n)=>e in t?Zu(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Me=(t,e,n)=>Xu(t,typeof e!="symbol"?e+"":e,n);const ed=480*60*60*1e3,Za=2;class td{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 h=(Date.now()-n)/1e3;l=o-h,l<=0&&(l=0)}else l=a;let c=Math.min(ed,(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 nd=["convexClientConstructed","convexWebSocketOpen","convexFirstMessageReceived"];function rd(t,e){const n={sessionId:e};typeof performance>"u"||!performance.mark||performance.mark(t,{detail:n})}function id(t){let e=t.name.slice(6);return e=e.charAt(0).toLowerCase()+e.slice(1),{name:e,startTime:t.startTime}}function od(t){if(typeof performance>"u"||!performance.getEntriesByName)return[];const e=[];for(const n of nd){const r=performance.getEntriesByName(n).filter(i=>i.entryType==="mark").filter(i=>i.detail.sessionId===t);e.push(...r)}return e.map(id)}var ad=Object.defineProperty,sd=(t,e,n)=>e in t?ad(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,pe=(t,e,n)=>sd(t,typeof e!="symbol"?e+"":e,n);class ld{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 x of this.connectionStateSubscribers.values())x(p)}})}),pe(this,"mark",p=>{this.debug&&rd(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&&ru(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 h=`${u}://${l}/api/${$a}/sync`;this.state=new wu,this.remoteQuerySet=new Qa(p=>this.state.queryPath(p),this.logger),this.requestManager=new ju(this.logger,this.markConnectionStateDirty);const m=()=>{this.webSocketManager.pause(),this.state.pause()};this.authenticationManager=new td(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 Iu,this.addOnTransitionHandler(p=>{n(p.queries.map(x=>x.token))}),this._nextRequestId=0,this._sessionId=Gu();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 Qu(h,{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=bu(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 h=r.optimisticUpdate;if(h!==void 0){const m=x=>{h(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:[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?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:[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=od(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 cd=Object.defineProperty,ud=(t,e,n)=>e in t?cd(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Xa=(t,e,n)=>ud(t,typeof e!="symbol"?e+"":e,n);class dd{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 h=Ei(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=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,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).queryToken,h=n(u);if(!h)continue;const m=Ei(h);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 hd({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 fd=Object.defineProperty,pd=(t,e,n)=>e in t?fd(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,yt=(t,e,n)=>pd(t,typeof e!="symbol"?e+"":e,n);const md=5e3;if(typeof yi>"u")throw new Error("Required dependency 'react' not found");function es(t,e,n){function r(i){return vd(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 gd(t,e){return function(n){return e.action(t,n)}}class xd{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 ld(this.address,()=>{},this.options),this.adminAuth&&this.cachedSync.setAdminAuth(this.adminAuth,this.fakeUserIdentity),this.cachedPaginatedQueryClient=new dd(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??md,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 bd(){return In(Sr)}const yd=({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=he(()=>n?{}:{query:{query:i,args:r}},[JSON.stringify(st(r)),o,n]),c=jd(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 he(()=>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 he(()=>gd(n,e),[e,Re(n)])}function vd(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 wd=Object.defineProperty,kd=(t,e,n)=>e in t?wd(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Ii=(t,e,n)=>kd(t,typeof e!="symbol"?e+"":e,n);class _d{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(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 jd(t){const e=bd();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=he(()=>(r,i,{journal:o,paginationOptions:a})=>a?e.watchPaginatedQuery(r,i,a):e.watchQuery(r,i,o?{journal:o}:{}),[e]);return Sd(t,n)}function Sd(t,e){const[n]=q(()=>new _d(e));n.createWatch!==e&&n.setCreateWatch(e),M(()=>()=>n.destroy(),[n]);const r=he(()=>({getCurrentValue:()=>n.getLocalResults(t),subscribe:i=>(n.setQueries(t),n.subscribe(i))}),[n,t]);return hd(r)}var Td=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 Cd(t){if(vt>0)return t();Pi=++Ad,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,Ad=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=Td,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 Rd(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,Rd.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,Ed=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=he(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||""}),h=Ni(function(){return!Array.isArray(u.value)&&!Mo(u.value)}),m=Bn(function(){if(this.N=cs,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}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;Ed&&((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],h=r[c];u===void 0?(u=Id(n,c,h,i),o[c]=u):u.o(h,i)}}}t(e)});function Id(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 h=u.__$u;h&&(u.__$u=void 0,h.d())}}t(e)}),ln("__h",function(t,e,n,r){(r<3||r===9)&&(e.__$f|=2),t(e,n,r)}),Ye.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 he(function(){return B(t,e)},[])}var Pd=function(t){queueMicrotask(function(){queueMicrotask(t)})};function Nd(){Cd(function(){for(var t;t=ss.shift();)as.call(t)})}function cs(){ss.push(this)===1&&(P.requestAnimationFrame||Pd)(Nd)}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 Md(t){return t.replace(/\.convex\.site\b/,".convex.cloud")}function Di(t){return t.replace(/\.convex\.cloud\b/,".convex.site")}function Od(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 Ld(t,e){const n=t.title??e?.title??"Assistant",r=t.privacyPolicyMode??e?.privacyPolicyMode??"platform",i=$d(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"?Od(t.privacyPolicyUrl??e?.privacyPolicyUrl):void 0,privacyNoticeStyle:i,sessionTimeoutMs:Dd(e?.sessionTimeout),triggerIcon:t.triggerIcon??e?.triggerIcon??"chat",triggerRadius:t.triggerRadius??e?.triggerRadius??"full",triggerLabel:t.triggerLabel??e?.triggerLabel??"Chatte mit uns",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 $d(t){return t==="explicit"||t==="sheet"?"explicit":"chip"}function Dd(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 qd(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 zd(t,e,n){const[r,i]=q({config:null,settled:!1});return M(()=>{i({config:null,settled:!1});const o=n??"https://festive-mouse-978.eu-west-1.convex.cloud",a=o?Di(o):void 0;if(!a||!t){i({config:null,settled:!0});return}const l=new AbortController;async function c(u){try{const h=await qd(u,t,l.signal,e);l.signal.aborted||i({config:h,settled:!0})}catch(h){if(h instanceof Error&&h.name==="AbortError")return;l.signal.aborted||i({config:null,settled:!0})}}return c(a),()=>{l.abort()}},[t,e,n]),r}const ds=globalThis.console,ne={warn(...t){ds.warn(...t)},error(...t){ds.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}}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 Ud(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 Bd({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 h=e?`project '${t}/${e}'`:`org '${t}'`;u.error==="unauthorized"?ne.warn(`[JexityChat] Domain not authorized for ${h}. Check the widget's domain rules.`):u.error==="not_found"?ne.error(`[JexityChat] No active widget config found for ${h}.`):u.error==="rate_limited"?ne.error(`[JexityChat] Bootstrap rate-limited for ${h}. Retry after ${u.retryAfterSec??60}s.`):ne.error(`[JexityChat] Bootstrap failed: ${u.error}`)}})(),()=>{c=!0}},[t,e,n,r])}const Or=new Set;let hs=!1;function Fd(){if(hs)return;hs=!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 Vd(t){return Or.add(t),window.addEventListener("popstate",t),Fd(),()=>{Or.delete(t),window.removeEventListener("popstate",t)}}function Hd(){const t=cn(window.location.href);M(()=>Vd(()=>{t.value=window.location.href}),[]);const e=Li.value,n=$i.value,r=new URL(t.value).pathname,i=Ud(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.
|
|
3
3
|
We will contact you at {email} when an agent is ready.
|
|
4
4
|
|
|
@@ -70,9 +70,11 @@ ${this.parser.parse(t)}</blockquote>
|
|
|
70
70
|
${t}</tr>
|
|
71
71
|
`}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
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>${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=rl(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=rl(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)}},co=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}},Ze=class Po{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 co}static parse(e,n){return new Po(n).parse(e)}static parseInline(e,n){return new Po(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}},Xn=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?Je.lex:Je.lexInline}provideParser(t=this.block){return t?Ze.parse:Ze.parseInline}},$f=class{defaults=eo();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Ze;Renderer=Wr;TextRenderer=co;Lexer=Je;Tokenizer=Hr;Hooks=Xn;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 Xn;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];Xn.passThroughHooks.has(o)?i[a]=u=>{if(this.defaults.async&&Xn.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 Je.lex(t,e??this.defaults)}parser(t,e){return Ze.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?Je.lex:Je.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?Ze.parse:Ze.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?Je.lex:Je.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?Ze.parse:Ze.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+=`
|
|
73
|
-
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 $f;function
|
|
74
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Uf(t,e){return Df(t)||qf(t,e)||Bf(t,e)||zf()}function Bf(t,e){if(t){if(typeof t=="string")return sl(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)?sl(t,e):void 0}}const ll=Object.entries,cl=Object.setPrototypeOf,Ff=Object.isFrozen,Vf=Object.getPrototypeOf,Hf=Object.getOwnPropertyDescriptor;let ke=Object.freeze,_e=Object.seal,gn=Object.create,ul=typeof Reflect<"u"&&Reflect,uo=ul.apply,ho=ul.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=me(Array.prototype.forEach),Wf=me(Array.prototype.lastIndexOf),dl=me(Array.prototype.pop),xn=me(Array.prototype.push),Qf=me(Array.prototype.splice),Pt=Array.isArray,tr=me(String.prototype.toLowerCase),fo=me(String.prototype.toString),hl=me(String.prototype.match),nr=me(String.prototype.replace),fl=me(String.prototype.indexOf),Gf=me(String.prototype.trim),Kf=me(Number.prototype.toString),Yf=me(Boolean.prototype.toString),pl=typeof BigInt>"u"?null:me(BigInt.prototype.toString),ml=typeof Symbol>"u"?null:me(Symbol.prototype.toString),ye=me(Object.prototype.hasOwnProperty),rr=me(Object.prototype.toString),je=me(RegExp.prototype.test),Qt=Jf(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 uo(t,e,r)}}function Jf(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(cl&&cl(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&&(Ff(e)||(e[r]=o),i=o)}t[i]=!0}return t}function Zf(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 ll(t)){var n=Uf(r,2);const i=n[0],o=n[1];ye(t,i)&&(Pt(o)?e[i]=Zf(o):o&&typeof o=="object"&&o.constructor===Object?e[i]=Ee(o):e[i]=o)}return e}function Xf(t){switch(typeof t){case"string":return t;case"number":return Kf(t);case"boolean":return Yf(t);case"bigint":return pl?pl(t):"0";case"symbol":return ml?ml(t):"Symbol()";case"undefined":return rr(t);case"function":case"object":{if(t===null)return rr(t);const e=t,n=dt(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 dt(t,e){for(;t!==null;){const r=Hf(t,e);if(r){if(r.get)return me(r.get);if(typeof r.value=="function")return me(r.value)}t=Vf(t)}function n(){return null}return n}function ep(t){try{return je(t,""),!0}catch{return!1}}const gl=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"]),tp=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"]),np=ke(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),xl=ke(["#text"]),bl=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"]),yl=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"]),rp=_e(/{{[\w\W]*|^[\w\W]*}}/g),ip=_e(/<%[\w\W]*|^[\w\W]*%>/g),op=_e(/\${[\w\W]*/g),ap=_e(/^data-[\-\w.\u00B7-\uFFFF]+$/),sp=_e(/^aria-[\-\w]+$/),vl=_e(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),lp=_e(/^(?:\w+script|data):/i),cp=_e(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),up=_e(/^html$/i),dp=_e(/^[a-z][.\w]*(-[.\w]+)+$/i),wl=_e(/<[/\w!]/g),hp=_e(/<[/\w]/g),fp=_e(/<\/no(script|embed|frames)/i),pp=_e(/\/>/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},mp=function(){return typeof window>"u"?null:window},gp=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}},kl=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 _l(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:mp();const e=j=>_l(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"),x=dt(d,"remove"),k=dt(d,"nextSibling"),b=dt(d,"childNodes"),v=dt(d,"parentNode"),w=dt(d,"shadowRoot"),R=dt(d,"attributes"),y=a&&a.prototype?dt(a.prototype,"nodeType"):null,I=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 N,L="",W,ge=!1,F=0;const X=function(){if(F>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(f){X(),F++;try{return N.createHTML(f)}finally{F--}},S=function(f){X(),F++;try{return N.createScriptURL(f)}finally{F--}},le=function(){return ge||(W=gp(m,i),ge=!0),W},pt=n,et=pt.implementation,mt=pt.createNodeIterator,Lt=pt.createDocumentFragment,_t=pt.getElementsByTagName,Gt=r.importNode;let J=kl();e.isSupported=typeof ll=="function"&&typeof v=="function"&&et&&et.createHTMLDocument!==void 0;const He=rp,se=ip,D=op,Le=ap,tt=sp,Kt=lp,be=cp,We=dp;let Se=vl,Y=null;const T=U({},[...gl,...po,...mo,...go,...xl]);let C=null;const Qe=U({},[...bl,...xo,...yl,...Qr]);let G=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 Ue=!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 ce="user-content-";let nt=!0,de=!1,$e={},Ge=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 Zl=null;const Xl=U({},["audio","video","img","source","image","track"]);let ko=null;const ec=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 dg=U({},[Zr,Xr,xt],fo),tc=ke(["mi","mo","mn","ms","mtext"]);let So=U({},tc);const nc=ke(["annotation-xml"]);let To=U({},nc);const hg=U({},["title","style","font","a","script"]);let ur=null;const fg=["application/xhtml+xml","text/html"],pg="text/html";let ue=null,jn=null;const mg=n.createElement("form"),rc=function(f){return f instanceof RegExp||f instanceof Function},Co=function(){let f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(jn&&jn===f)return;(!f||typeof f!="object")&&(f={}),f=Ee(f),ur=fg.indexOf(f.PARSER_MEDIA_TYPE)===-1?pg:f.PARSER_MEDIA_TYPE,ue=ur==="application/xhtml+xml"?fo:tr,Y=Nt(f,"ALLOWED_TAGS",T,{transform:ue}),C=Nt(f,"ALLOWED_ATTR",Qe,{transform:ue}),jo=Nt(f,"ALLOWED_NAMESPACES",dg,{transform:fo}),ko=Nt(f,"ADD_URI_SAFE_ATTR",ec,{transform:ue,base:ec}),Zl=Nt(f,"ADD_DATA_URI_TAGS",Xl,{transform:ue,base:Xl}),Ge=Nt(f,"FORBID_CONTENTS",cr,{transform:ue}),jt=Nt(f,"FORBID_TAGS",Ee({}),{transform:ue}),ee=Nt(f,"FORBID_ATTR",Ee({}),{transform:ue}),$e=ye(f,"USE_PROFILES")?f.USE_PROFILES&&typeof f.USE_PROFILES=="object"?Ee(f.USE_PROFILES):f.USE_PROFILES:!1,Ue=f.ALLOW_ARIA_ATTR!==!1,yn=f.ALLOW_DATA_ATTR!==!1,Yr=f.ALLOW_UNKNOWN_PROTOCOLS||!1,Jr=f.ALLOW_SELF_CLOSE_IN_ATTR!==!1,gt=f.SAFE_FOR_TEMPLATES||!1,Yt=f.SAFE_FOR_XML!==!1,St=f.WHOLE_DOCUMENT||!1,$t=f.RETURN_DOM||!1,wn=f.RETURN_DOM_FRAGMENT||!1,kn=f.RETURN_TRUSTED_TYPE||!1,vn=f.FORCE_BODY||!1,V=f.SANITIZE_DOM!==!1,$=f.SANITIZE_NAMED_PROPS||!1,nt=f.KEEP_CONTENT!==!1,de=f.IN_PLACE||!1,Se=ep(f.ALLOWED_URI_REGEXP)?f.ALLOWED_URI_REGEXP:vl,_n=typeof f.NAMESPACE=="string"?f.NAMESPACE:xt,So=ye(f,"MATHML_TEXT_INTEGRATION_POINTS")&&f.MATHML_TEXT_INTEGRATION_POINTS&&typeof f.MATHML_TEXT_INTEGRATION_POINTS=="object"?Ee(f.MATHML_TEXT_INTEGRATION_POINTS):U({},tc),To=ye(f,"HTML_INTEGRATION_POINTS")&&f.HTML_INTEGRATION_POINTS&&typeof f.HTML_INTEGRATION_POINTS=="object"?Ee(f.HTML_INTEGRATION_POINTS):U({},nc);const g=ye(f,"CUSTOM_ELEMENT_HANDLING")&&f.CUSTOM_ELEMENT_HANDLING&&typeof f.CUSTOM_ELEMENT_HANDLING=="object"?Ee(f.CUSTOM_ELEMENT_HANDLING):gn(null);if(G=gn(null),ye(g,"tagNameCheck")&&rc(g.tagNameCheck)&&(G.tagNameCheck=g.tagNameCheck),ye(g,"attributeNameCheck")&&rc(g.attributeNameCheck)&&(G.attributeNameCheck=g.attributeNameCheck),ye(g,"allowCustomizedBuiltInElements")&&typeof g.allowCustomizedBuiltInElements=="boolean"&&(G.allowCustomizedBuiltInElements=g.allowCustomizedBuiltInElements),_e(G),gt&&(yn=!1),wn&&($t=!0),$e&&(Y=U({},xl),C=gn(null),$e.html===!0&&(U(Y,gl),U(C,bl)),$e.svg===!0&&(U(Y,po),U(C,xo),U(C,Qr)),$e.svgFilters===!0&&(U(Y,mo),U(C,xo),U(C,Qr)),$e.mathMl===!0&&(U(Y,go),U(C,yl),U(C,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)&&(Y===T&&(Y=Ee(Y)),U(Y,f.ADD_TAGS,ue))),ye(f,"ADD_ATTR")&&(typeof f.ADD_ATTR=="function"?Ie.attributeCheck=f.ADD_ATTR:Pt(f.ADD_ATTR)&&(C===Qe&&(C=Ee(C)),U(C,f.ADD_ATTR,ue))),ye(f,"ADD_URI_SAFE_ATTR")&&Pt(f.ADD_URI_SAFE_ATTR)&&U(ko,f.ADD_URI_SAFE_ATTR,ue),ye(f,"FORBID_CONTENTS")&&Pt(f.FORBID_CONTENTS)&&(Ge===cr&&(Ge=Ee(Ge)),U(Ge,f.FORBID_CONTENTS,ue)),ye(f,"ADD_FORBID_CONTENTS")&&Pt(f.ADD_FORBID_CONTENTS)&&(Ge===cr&&(Ge=Ee(Ge)),U(Ge,f.ADD_FORBID_CONTENTS,ue)),nt&&(Y["#text"]=!0),St&&U(Y,["html","head","body"]),Y.table&&(U(Y,["tbody"]),delete jt.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 _=N;N=f.TRUSTED_TYPES_POLICY;try{L=ae("")}catch(A){throw N=_,A}}else f.TRUSTED_TYPES_POLICY===null?(N=void 0,L=""):(N===void 0&&(N=le()),N&&typeof L=="string"&&(L=ae("")));ke&&ke(f),jn=f},ic=U({},[...po,...mo,...tp]),oc=U({},[...go,...np]),gg=function(f,g,_){return g.namespaceURI===xt?f==="svg":g.namespaceURI===Zr?f==="svg"&&(_==="annotation-xml"||So[_]):!!ic[f]},xg=function(f,g,_){return g.namespaceURI===xt?f==="math":g.namespaceURI===Xr?f==="math"&&To[_]:!!oc[f]},bg=function(f,g,_){return g.namespaceURI===Xr&&!To[_]||g.namespaceURI===Zr&&!So[_]?!1:!oc[f]&&(hg[f]||!ic[f])},yg=function(f){let g=v(f);(!g||!g.tagName)&&(g={namespaceURI:_n,tagName:"template"});const _=tr(f.tagName),A=tr(g.tagName);return jo[f.namespaceURI]?f.namespaceURI===Xr?gg(_,g,A):f.namespaceURI===Zr?xg(_,g,A):f.namespaceURI===xt?bg(_,g,A):!!(ur==="application/xhtml+xml"&&jo[f.namespaceURI]):!1},Dt=function(f){xn(e.removed,{element:f});try{v(f).removeChild(f)}catch{if(x(f),!v(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")}},ac=function(f){const g=b(f);if(g){const A=[];er(g,O=>{xn(A,O)}),er(A,O=>{try{x(O)}catch{}})}const _=R(f);if(_)for(let A=_.length-1;A>=0;--A){const O=_[A],H=O&&O.name;if(typeof H=="string")try{f.removeAttribute(H)}catch{}}},Jt=function(f,g){try{xn(e.removed,{attribute:g.getAttributeNode(f),from:g})}catch{xn(e.removed,{attribute:null,from:g})}if(g.removeAttribute(f),f==="is")if($t||wn)try{Dt(g)}catch{}else try{g.setAttribute(f,"")}catch{}},vg=function(f){const g=R(f);if(g)for(let _=g.length-1;_>=0;--_){const A=g[_],O=A&&A.name;if(!(typeof O!="string"||C[ue(O)]))try{f.removeAttribute(O)}catch{}}},wg=function(f){const g=[f];for(;g.length>0;){const _=g.pop();(y?y(_):_.nodeType)===ht.element&&vg(_);const O=b(_);if(O)for(let H=O.length-1;H>=0;--H)g.push(O[H])}},sc=function(f){let g=null,_=null;if(vn)f="<remove></remove>"+f;else{const H=hl(f,/^[\r\n\t ]+/);_=H&&H[0]}ur==="application/xhtml+xml"&&_n===xt&&(f='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+f+"</body></html>");const A=N?ae(f):f;if(_n===xt)try{g=new h().parseFromString(A,ur)}catch{}if(!g||!g.documentElement){g=et.createDocument(_n,"template",null);try{g.documentElement.innerHTML=_o?L:A}catch{}}const O=g.body||g.documentElement;return f&&_&&O.insertBefore(n.createTextNode(_),O.childNodes[0]||null),_n===xt?_t.call(g,St?"html":"body")[0]:St?g.documentElement:O},lc=function(f){return mt.call(f.ownerDocument||f,f,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},ei=function(f){return f=nr(f,He," "),f=nr(f,se," "),f=nr(f,D," "),f},Ao=function(f){var g;f.normalize();const _=mt.call(f.ownerDocument||f,f,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=f.querySelectorAll)===null||g===void 0?void 0:g.call(f,"template");O&&er(O,H=>{Sn(H.content)&&Ao(H.content)})},ti=function(f){const g=I?I(f):null;return typeof g!="string"||ue(g)!=="form"?!1:typeof f.nodeName!="string"||typeof f.textContent!="string"||typeof f.removeChild!="function"||f.attributes!==R(f)||typeof f.removeAttribute!="function"||typeof f.setAttribute!="function"||typeof f.namespaceURI!="string"||typeof f.insertBefore!="function"||typeof f.hasChildNodes!="function"||f.nodeType!==y(f)||f.childNodes!==b(f)},Sn=function(f){if(!y||typeof f!="object"||f===null)return!1;try{return y(f)===ht.documentFragment}catch{return!1}},dr=function(f){if(!y||typeof f!="object"||f===null)return!1;try{return typeof y(f)=="number"}catch{return!1}};function Tt(j,f,g){j.length!==0&&er(j,_=>{_.call(e,f,g,jn)})}const kg=function(f,g){return!!(Yt&&f.hasChildNodes()&&!dr(f.firstElementChild)&&je(wl,f.textContent)&&je(wl,f.innerHTML)||Yt&&f.namespaceURI===xt&&g==="style"&&dr(f.firstElementChild)||f.nodeType===ht.processingInstruction||Yt&&f.nodeType===ht.comment&&je(hp,f.data))},_g=function(f,g){if(!jt[g]&&dc(g)&&(G.tagNameCheck instanceof RegExp&&je(G.tagNameCheck,g)||G.tagNameCheck instanceof Function&&G.tagNameCheck(g)))return!1;if(nt&&!Ge[g]){const _=v(f),A=b(f);if(A&&_){const O=A.length;for(let H=O-1;H>=0;--H){const ve=de?A[H]:p(A[H],!0);_.insertBefore(ve,k(f))}}}return Dt(f),!0},cc=function(f){if(Tt(J.beforeSanitizeElements,f,null),ti(f))return Dt(f),!0;const g=ue(I?I(f):f.nodeName);if(Tt(J.uponSanitizeElement,f,{tagName:g,allowedTags:Y}),kg(f,g))return Dt(f),!0;if(jt[g]||!(Ie.tagCheck instanceof Function&&Ie.tagCheck(g))&&!Y[g])return _g(f,g);if((y?y(f):f.nodeType)===ht.element&&!yg(f)||(g==="noscript"||g==="noembed"||g==="noframes")&&je(fp,f.innerHTML))return Dt(f),!0;if(gt&&f.nodeType===ht.text){const A=ei(f.textContent);f.textContent!==A&&(xn(e.removed,{element:f.cloneNode()}),f.textContent=A)}return Tt(J.afterSanitizeElements,f,null),!1},uc=function(f,g,_){if(ee[g]||V&&(g==="id"||g==="name")&&(_ in n||_ in mg))return!1;const A=C[g]||Ie.attributeCheck instanceof Function&&Ie.attributeCheck(g,f);if(!(yn&&je(Le,g))){if(!(Ue&&je(tt,g))){if(A){if(!ko[g]){if(!je(Se,nr(_,be,""))){if(!((g==="src"||g==="xlink:href"||g==="href")&&f!=="script"&&fl(_,"data:")===0&&Zl[f])){if(!(Yr&&!je(Kt,nr(_,be,"")))){if(_)return!1}}}}}else if(!(dc(f)&&(G.tagNameCheck instanceof RegExp&&je(G.tagNameCheck,f)||G.tagNameCheck instanceof Function&&G.tagNameCheck(f))&&(G.attributeNameCheck instanceof RegExp&&je(G.attributeNameCheck,g)||G.attributeNameCheck instanceof Function&&G.attributeNameCheck(g,f))||g==="is"&&G.allowCustomizedBuiltInElements&&(G.tagNameCheck instanceof RegExp&&je(G.tagNameCheck,_)||G.tagNameCheck instanceof Function&&G.tagNameCheck(_))))return!1}}return!0},jg=U({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),dc=function(f){return!jg[tr(f)]&&je(We,f)},Sg=function(f,g,_,A){if(N&&typeof m=="object"&&typeof m.getAttributeType=="function"&&!_)switch(m.getAttributeType(f,g)){case"TrustedHTML":return ae(A);case"TrustedScriptURL":return S(A)}return A},Tg=function(f,g,_,A){try{_?f.setAttributeNS(_,g,A):f.setAttribute(g,A),ti(f)?Dt(f):dl(e.removed)}catch{Jt(g,f)}},hc=function(f){Tt(J.beforeSanitizeAttributes,f,null);const g=f.attributes;if(!g||ti(f))return;const _={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:C,forceKeepAttr:void 0};let A=g.length;const O=ue(f.nodeName);for(;A--;){const H=g[A],ve=H.name,xe=H.namespaceURI,Ke=H.value,rt=ue(ve),Eo=Ke;let Pe=ve==="value"?Eo:Gf(Eo);if(_.attrName=rt,_.attrValue=Pe,_.keepAttr=!0,_.forceKeepAttr=void 0,Tt(J.uponSanitizeAttribute,f,_),Pe=_.attrValue,$&&(rt==="id"||rt==="name")&&fl(Pe,ce)!==0&&(Jt(ve,f),Pe=ce+Pe),Yt&&je(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Pe)){Jt(ve,f);continue}if(rt==="attributename"&&hl(Pe,"href")){Jt(ve,f);continue}if(!_.forceKeepAttr){if(!_.keepAttr){Jt(ve,f);continue}if(!Jr&&je(pp,Pe)){Jt(ve,f);continue}if(gt&&(Pe=ei(Pe)),!uc(O,rt,Pe)){Jt(ve,f);continue}Pe=Sg(O,rt,xe,Pe),Pe!==Eo&&Tg(f,ve,xe,Pe)}}Tt(J.afterSanitizeAttributes,f,null)},ni=function(f){let g=null;const _=lc(f);for(Tt(J.beforeSanitizeShadowDOM,f,null);g=_.nextNode();)if(Tt(J.uponSanitizeShadowNode,g,null),cc(g),hc(g),Sn(g.content)&&ni(g.content),(y?y(g):g.nodeType)===ht.element){const O=w(g);Sn(O)&&(Ro(O),ni(O))}Tt(J.afterSanitizeShadowDOM,f,null)},Ro=function(f){const g=[{node:f,shadow:null}];for(;g.length>0;){const _=g.pop();if(_.shadow){ni(_.shadow);continue}const A=_.node,H=(y?y(A):A.nodeType)===ht.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=I?I(A):null;if(typeof xe=="string"&&ue(xe)==="template"){const Ke=A.content;Sn(Ke)&&g.push({node:Ke,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 f=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=Xf(j),typeof j!="string"))throw Qt("dirty is not a string, aborting");if(!e.isSupported)return j;ar?(Y=sr,C=lr):Co(f),(J.uponSanitizeElement.length>0||J.uponSanitizeAttribute.length>0)&&(Y=Ee(Y)),J.uponSanitizeAttribute.length>0&&(C=Ee(C)),e.removed=[];const H=de&&typeof j!="string"&&dr(j);if(H){const Ke=I?I(j):j.nodeName;if(typeof Ke=="string"){const rt=ue(Ke);if(!Y[rt]||jt[rt])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(rt){throw ac(j),rt}}else if(dr(j))g=sc("<!---->"),_=g.ownerDocument.importNode(j,!0),_.nodeType===ht.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=sc(j),!g)return $t?null:kn?L:""}g&&vn&&Dt(g.firstChild);const ve=lc(H?j:g);try{for(;A=ve.nextNode();)cc(A),hc(A),Sn(A.content)&&ni(A.content)}catch(Ke){throw H&&ac(j),Ke}if(H)return er(e.removed,Ke=>{Ke.element&&wg(Ke.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&&Y["!doctype"]&&g.ownerDocument&&g.ownerDocument.doctype&&g.ownerDocument.doctype.name&&je(up,g.ownerDocument.doctype.name)&&(xe="<!DOCTYPE "+g.ownerDocument.doctype.name+`>
|
|
75
|
-
`+xe),gt&&(xe=ei(xe)),N&&kn?ae(xe):xe},e.setConfig=function(){let j=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Co(j),ar=!0,sr=Y,lr=C},e.clearConfig=function(){jn=null,ar=!1,sr=null,lr=null,N=W,L=""},e.isValidAttribute=function(j,f,g){jn||Co({});const _=ue(j),A=ue(f);return uc(_,A,g)},e.addHook=function(j,f){typeof f=="function"&&ye(J,j)&&xn(J[j],f)},e.removeHook=function(j,f){if(ye(J,j)){if(f!==void 0){const g=Wf(J[j],f);return g===-1?void 0:Qf(J[j],g,1)[0]}return dl(J[j])}},e.removeHooks=function(j){ye(J,j)&&(J[j]=[])},e.removeAllHooks=function(){J=kl()},e}var xp=_l();Q.setOptions({breaks:!0,gfm:!0});const ir=typeof window<"u"?xp: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 bp(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function yp(t){if(!t)return"";if(!ir)return bp(t);const e=Q.parse(t),n=typeof e=="string"?e:"";return ir.sanitize(n)}function vp({text:t}){const e=he(()=>yp(t),[t]);return s("div",{class:"jex-md",dangerouslySetInnerHTML:{__html:e}})}function jl({onQuote:t}){const e=E();return s("button",{type:"button",class:"jex-quote-btn","aria-label":e.quoteMessage,title:e.quoteMessage,onClick:t,children:s(Xi,{size:12})})}function wp(t,e,n){return t.role==="user"?n:t.authorName??e??""}function kp({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,": "]}),Es(e)]})]})}function Sl({quotes:t,botName:e,yourMessageLabel:n,onQuotedClick:r}){return t.length===0?null:s("div",{class:"jex-quoted-list",children:t.map(i=>s(kp,{authorLabel:wp(i,e,n),content:i.content,onClick:r?o=>{r(i.id,o)}:void 0},i.id))})}function _p(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:h,onQuotedClick:m}){const d=E(),p=!!r,[x,k]=q(!1),b=K(()=>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:_p(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(Sl,{quotes:h??[],botName:l,yourMessageLabel:d.quotedYourMessage,onQuotedClick:m}),s(vp,{text:t}),e&&s("span",{class:"jex-streaming-cursor"}),c&&s(jl,{onQuote:c})]})]})}function jp({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 Sp(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 Tp({text:t,id:e,onQuote:n,botName:r,quoted:i,onQuotedClick:o,agentNames:a}){const l=E();return s("div",{class:"jex-message user",id:e,children:[s(Sl,{quotes:i??[],botName:r,yourMessageLabel:l.quotedYourMessage,onQuotedClick:o}),Sp(t,a??[]),n&&s(jl,{onQuote:n})]})}function Tl(){return Bt(Ce.functions.chat.public.helpdesk.submitEscalation)}function Cl(){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 Cp({message:t,sessionId:e,visitorId:n,waitingSetAt:r}){const i=E();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(Ap,{messageId:t._id,sessionId:e,visitorId:n,waitingSetAt:r})})}function Ap({messageId:t,sessionId:e,visitorId:n,waitingSetAt:r}){const i=E(),[o,a]=q(""),[l,c]=q(""),[u,h]=q(!1),m=Vn.value,d=/^https?:\/\//i.test(m)?m:Fn,p=Tl(),x=Cl();async function k(b){if(b.preventDefault(),!u){h(!0);try{await p({sessionId:e,visitorId:n,formMessageId:t,visitorName:o.trim(),visitorEmail:l.trim(),locale:ct.value})}catch(v){ne.error("[FormMessage] Submit failed:",v),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: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 Rp(){return Bt(Ce.functions.magicline.public.submitForm)}function Ep(){return zn(Ce.functions.magicline.actions.getTrialConfig)}function Ip(){return zn(Ce.functions.magicline.actions.listTrialSlots)}function Pp(){return zn(Ce.functions.magicline.actions.getRateBundles)}function Al(){return zn(Ce.functions.magicline.actions.getContractPreview)}function Np(){return zn(Ce.functions.magicline.actions.submitContractCreation)}const bo={en:Ui,de:fs},Mp=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function Rl(t){return Mp.test(t.trim())}function Op(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 El(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 Il(){const t=Vn.value;return/^https?:\/\//i.test(t)?t:Fn}const Lp={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},$p=15,Dp=34;function Pl(t){return t.replace(/\s+/g,"").toUpperCase()}function qp(t){const e=Pl(t),n=e.slice(0,2),r=Lp[n];if(r!==void 0){if(e.length!==r)return!1}else if(e.length<$p||e.length>Dp)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 zp(t){const e=Pl(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 Xe(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 Up(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 Bp(t,e,n,r,i){const o=bo[i],a=Xe(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 Fp(t,e,n,r){return e==="PERCENTAGE"?`-${t}%`:`-${Xe(t,n,r)}`}const Vp={startpaket:"magiclineFeeStarterPackage","starter package":"magiclineFeeStarterPackage",trainerpauschale:"magiclineFeeTrainerFee"};function Nl(t,e){const n=t.trim().toLowerCase(),r=Vp[n];return r!==void 0?e[r]:t}function Hp(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 Ml=["MALE","FEMALE","UNISEX"],Wp=[{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 Qp(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 Gp={firstName:"",lastName:"",email:"",phone:"",birthDate:"",gender:"",street:"",houseNumber:"",zip:"",city:"",country:"",note:"",slotId:"",consent:!1,trainerRequired:!0};function Kp(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 Yp({sessionId:t,visitorId:e}){const n=Ep(),r=Ip(),[i,o]=De(Kp,Gp),[a,l]=De((v,w)=>w,{phase:"loading"}),[c,u]=De((v,w)=>w,{phase:"loading"}),[h,m]=De(v=>v+1,0),d=K((v,w)=>{o({type:"set",key:v,value:w})},[]),p=K(v=>{o({type:"setTrainer",trainerRequired:v}),m()},[]),x=K(()=>{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,h]),{fields:i,setField:d,setTrainerRequired:p,configState:a,slotsState:c,refetchSlots:x}}function Jp({formMessageId:t,sessionId:e,visitorId:n,slotUnavailable:r=!1,retryPending:i=!1}){const o=E(),a=Rp(),{fields:l,setField:c,setTrainerRequired:u,configState:h,slotsState:m,refetchSlots:d}=Yp({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:om(h.code,h.backendMessage,o)})]}):s(Zp,{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 Zp({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=E(),{plan:p,minimumAge:x,bookingWithoutTrainerAllowed:k,studioZoneId:b}=o,v=he(()=>Qp(p,k),[p,k]),w=r?Math.max(v.indexOf("slot"),0):0,[R,y]=q(w),[I,N]=q({}),[L,W]=q(!1),[ge,F]=q(null),X=he(()=>Il(),[]),ae=Math.min(R,v.length-1),S=v[ae],le=ae===v.length-1,pt=ae===0;function et(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()!==""&&!Rl(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=Op(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=et(S);if(Object.keys(se).length>0){N(se);return}N({}),y(D=>Math.min(D+1,v.length-1))}function Lt(){N({}),F(null),y(se=>Math.max(se-1,0))}async function _t(){if(L)return;const se=et("confirm");if(Object.keys(se).length>0){N(se);return}N({}),F(null),W(!0);try{const D=am(p,a);await m({sessionId:e,visitorId:n,formMessageId:t,action:"trialSessionBooking",fields:D})}catch(D){ne.error("[TrialSessionBookingForm] Submit failed:",D),F(d.magiclineFailedDetail),W(!1)}}function Gt(){le?_t():mt()}const J=im(S,d),He=`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(Xp,{formMessageId:t,trainerRequired:a.trainerRequired,disabled:L,onChange:c}):null,S==="slot"?s(em,{slotsState:u,slotId:a.slotId,studioZoneId:b,disabled:L,retryPending:i,slotUnavailable:r,error:I.slotId,onSelect:se=>{l("slotId",se)},onRetry:h}):null,S==="personal"?s(tm,{plan:p,fields:a,errors:I,disabled:L,setField:l}):null,S==="address"?s(nm,{plan:p,fields:a,errors:I,disabled:L,setField:l}):null,S==="confirm"?s(rm,{consentId:He,privacyUrl:X,studioZoneId:b,fields:a,disabled:L,consentError:I.consent,setField:l}):null,ge!==null?s("div",{class:"jex-magicline-error",role:"alert",children:ge}):null,s("div",{class:"jex-magicline-wizard-nav",children:[pt?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:le?L?d.magiclineSubmitting:d.magiclineSubmit:d.magiclineWizardNext})]})]})]})}function Xp({formMessageId:t,trainerRequired:e,disabled:n,onChange:r}){const i=E(),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 em({slotsState:t,slotId:e,studioZoneId:n,disabled:r,retryPending:i,slotUnavailable:o,error:a,onSelect:l,onRetry:c}){const u=E();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:h=>{l(h.currentTarget.value)},children:[s("option",{value:"",disabled:!0,children:u.magiclineSlotPlaceholder}),t.slots.map(h=>s("option",{value:h.startDateTime,children:Ll(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 tm({plan:t,fields:e,errors:n,disabled:r,setField:i}){const o=E(),a=he(()=>El(),[]);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:Ve(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:Ve(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:Ve(o.magiclineBirthDate,t.dateOfBirth.required,o)}),s("input",{class:"jex-form-input",type:"date","aria-label":Ve(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(Ol,{label:Ve(o.magiclineGender,t.gender.required,o),value:e.gender,required:t.gender.required,disabled:r,placeholder:Ve(o.magiclineGenderPlaceholder,t.gender.required,o),error:n.gender,onChange:l=>{i("gender",l)},options:Ml.map(l=>({value:l,label:sm(l,o)}))}):null]})}function nm({plan:t,fields:e,errors:n,disabled:r,setField:i}){const o=E();return s(Z,{children:[t.address.visible?s(Z,{children:[s("div",{class:"jex-magicline-row",children:[s(Mt,{label:Ve(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:Ve(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:Ve(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(Ol,{label:Ve(o.magiclineCountry,t.address.required,o),value:e.country,required:t.address.required,disabled:r,placeholder:Ve(o.magiclineCountryPlaceholder,t.address.required,o),error:n.country,onChange:a=>{i("country",a)},options:Wp.map(a=>({value:a.code,label:a.label}))})]}):null,t.zip.visible?s(Mt,{label:Ve(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 rm({consentId:t,privacyUrl:e,studioZoneId:n,fields:r,disabled:i,consentError:o,setField:a}){const l=E(),c=r.slotId!==""?Ll(r.slotId,ct.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: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 Ol({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 Ve(t,e,n){return e?t:t+n.magiclineOptionalSuffix}function im(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 om(t,e,n){return e.trim()!==""?e:t==="unsupported"?n.magiclineConfigUnsupported:t==="inconsistent"?n.magiclineConfigInconsistent:n.magiclineConfigUnavailable}function am(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 sm(t,e){return t==="MALE"?e.magiclineGenderMale:t==="FEMALE"?e.magiclineGenderFemale:e.magiclineGenderUnisex}function Ll(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 lm={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 cm(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 $l={draftVoucherCode:"",appliedVoucherCode:null,appliedVoucher:null,voucherStatus:"idle",voucherRequestId:0,voucherUnavailable:!1},um="voucher:";function dm(t){const e={};for(const n of Object.keys(t))n.startsWith(um)||(e[n]=t[n]);return e}function hm(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 fm(t,e){switch(e.type){case"dropVoucherAcks":{const n=dm(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 cm(t,e)}}function pm({sessionId:t,visitorId:e}){const n=Pp(),r=Al(),[i,o]=De(fm,lm),[a,l]=De(hm,$l),[c,u]=De((T,C)=>C,{phase:"loading"}),h=qe(null),[m,d]=De((T,C)=>C,{phase:"idle"}),p=K(T=>{T.phase==="ready"?h.current=T.pricing:(T.phase==="idle"||T.phase==="error")&&(h.current=null),d(T)},[]),[x,k]=De(T=>T+1,0),[b,v]=De(T=>T+1,0),w=K(T=>{o({type:"setTermId",termId:T}),l({type:"CLEAR_VOUCHER"})},[]),R=K((T,C)=>{o({type:"setPersonal",key:T,value:C})},[]),y=K((T,C)=>{o({type:"setAddress",key:T,value:C})},[]),I=K((T,C,Qe)=>{o({type:"toggleModule",moduleId:T,selected:C,consentAckKey:Qe}),o({type:"dropVoucherAcks"}),l({type:"CLEAR_VOUCHER"})},[]),N=K((T,C)=>{o({type:"setBlockAck",ackKey:T,value:C})},[]),L=K(T=>{o({type:"setAccountHolder",value:T})},[]),W=K(T=>{o({type:"setIban",value:T})},[]),ge=K((T,C)=>{o({type:"setConsent",key:T,value:C})},[]),F=K(()=>{o({type:"clearIban"})},[]),X=K(()=>{o({type:"clearTermId"}),l({type:"CLEAR_VOUCHER"})},[]),ae=K(T=>{l({type:"SET_VOUCHER_DRAFT",value:T}),o({type:"dropVoucherAcks"})},[]),S=qe($l.voucherRequestId),le=K(()=>{const T=S.current+1;return S.current=T,l({type:"VOUCHER_APPLYING"}),T},[]),pt=K(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}))},[]),et=K(()=>{l({type:"VOUCHER_INVALID"}),o({type:"dropVoucherAcks"}),v()},[]),mt=K(()=>{l({type:"VOUCHER_DISABLED"}),o({type:"dropVoucherAcks"}),v()},[]),Lt=K(()=>{l({type:"CLEAR_VOUCHER"}),o({type:"dropVoucherAcks"}),v()},[]),_t=K(()=>{k()},[]),Gt=K(()=>{p({phase:"idle"})},[]),J=K(()=>{v()},[]),He=c.phase==="ready"&&i.termId!==null?c.terms.find(T=>T.termId===i.termId)??null:null,{selectedModuleIds:se,acknowledgedBlocks:D}=i,{appliedVoucher:Le}=a,tt=he(()=>{if(He===null)return[];const T=new Set;for(const C of He.textBlocks)C.isConfirmationRequired&&T.add(C.ackKey);for(const C of se){const Qe=He.optionalModules.find(G=>G.id===C);Qe?.consent&&T.add(Qe.consent.ackKey)}if(Le!==null)for(const C of Le.textBlocks)T.add(C.ackKey);return[...T]},[He,se,Le]),Kt=he(()=>tt.every(T=>D[T]===!0),[tt,D]),{firstName:be,lastName:We}=i.personal,{accountHolder:Se,accountHolderTouched:Y}=i.payment;return M(()=>{Y||Se!==""||be.trim()!==""&&We.trim()!==""&&o({type:"prefillAccountHolder",value:`${be.trim()} ${We.trim()}`})},[be,We,Se,Y]),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=He;if(!T){p({phase:"error",code:"offer_unavailable"});return}let C=!1;const Qe=h.current;p(Qe!==null?{phase:"reloading",pricing:Qe}:{phase:"loading"});const G=T.defaultContractStartDate??"",jt={sessionId:t,visitorId:e,termId:T.termId,startDate:G,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:He,requiredAckKeys:tt,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:I,setBlockAck:N,setAccountHolder:L,setIban:W,setConsent:ge,clearIban:F,clearTermId:X,refetchOffers:_t,fetchPreview:J,resetPreview:Gt,setVoucherDraft:ae,beginVoucherApply:le,commitVoucherApplied:pt,markVoucherInvalid:et,markVoucherDisabled:mt,clearVoucher:Lt}}function mm(t){return t!==null&&t.optionalModules.length>0?["offer","upgrades","personal","address","payment","review"]:["offer","personal","address","payment","review"]}function gm({formMessageId:t,sessionId:e,visitorId:n,projectId:r,formStatus:i}){const o=E(),a=ct.value,l=Np(),c=Al(),u=pm({sessionId:e,visitorId:n}),{fields:h,offersState:m,previewState:d,selectedTerm:p,requiredAckKeys:x,allAcknowledged:k,serverAllowVoucherCodes:b,voucherStatus:v,draftVoucherCode:w,appliedVoucher:R,appliedVoucherCode:y,voucherUnavailable:I,setTermId:N,setPersonal:L,setAddress:W,toggleModule:ge,setBlockAck:F,setAccountHolder:X,setIban:ae,setConsent:S,clearIban:le,clearTermId:pt,refetchOffers:et,fetchPreview:mt,resetPreview:Lt,setVoucherDraft:_t,beginVoucherApply:Gt,commitVoucherApplied:J,markVoucherInvalid:He,markVoucherDisabled:se}=u,[D,Le]=q(0),[tt,Kt]=q({}),[be,We]=q(!1),[Se,Y]=q(null),[T,C]=q(null),[Qe,G]=q(null),jt=he(()=>Il(),[]);if(Se!==null&&Se.status==="succeeded")return s(Dl,{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(ql,{message:V})}if(Se===null&&!be&&i==="submitted")return s(Dl,{customerNumber:null});if(Se===null&&!be&&i==="failed")return s(ql,{message:o.magiclineFailedDetail});const ee=he(()=>mm(p),[p]),Ie=Math.min(D,ee.length-1),Ue=ee[Ie],yn=Ie===ee.length-1,Yr=Ie===0;function Jr(V){const $={};if(V==="offer")return h.termId===null&&($.termId=o.magiclineOfferRequiredError),$;if(V==="upgrades"){if(p!==null)for(const ce of h.selectedModuleIds){const nt=p.optionalModules.find(de=>de.id===ce);if(nt?.consent&&h.acknowledgedBlocks[nt.consent.ackKey]!==!0){$.upgrades=o.magiclineUpgradeConsentError;break}}return $}if(V==="personal"){const ce=h.personal;return ce.firstName.trim()===""&&($.firstName=o.magiclineRequiredError),ce.lastName.trim()===""&&($.lastName=o.magiclineRequiredError),ce.email.trim()===""?$.email=o.magiclineRequiredError:Rl(ce.email)||($.email=o.magiclineEmailError),ce.dateOfBirth.trim()===""&&($.dateOfBirth=o.magiclineRequiredError),ce.gender===""&&($.gender=o.magiclineRequiredError),ce.phone.trim()===""&&($.phone=o.magiclineRequiredError),$}if(V==="address"){const ce=h.address;return ce.street.trim()===""&&($.street=o.magiclineRequiredError),ce.houseNumber.trim()===""&&($.houseNumber=o.magiclineRequiredError),ce.zipCode.trim()===""&&($.zipCode=o.magiclineRequiredError),ce.city.trim()===""&&($.city=o.magiclineRequiredError),$}return V==="payment"&&(h.payment.accountHolder.trim()===""&&($.accountHolder=o.magiclineRequiredError),qp(h.payment.iban)||($.iban=o.magiclineIbanInvalidError),h.consents.privacy||($.privacy=o.magiclineConsentError),h.consents.sepa||($.sepa=o.magiclineConsentError)),$}function gt(){const V=Jr(Ue);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),Ue==="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}We(!0),C(null);try{const V=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($=>h.selectedModuleIds.includes($.id)).map($=>$.id),acknowledgedAckKeys:x,pricingFingerprint:d.pricing.fingerprint,voucherCode:y??void 0});if(V.status==="succeeded"){Y(V);return}if(V.errorCode==="price_changed"){C(o.magiclinePriceChangedNotice),mt(),We(!1);return}if(V.errorCode==="offer_unavailable"){pt(),et(),Lt(),C(o.magiclineOfferUnavailableNotice),Le(0),We(!1);return}if(V.errorCode==="confirmation_required"){C(o.magiclineConfirmationRequiredNotice),We(!1);return}if(V.errorCode==="live_submission_disabled"){Y(V);return}if(!V.retryable){Y(V);return}le(),C(V.message!==""?V.message:o.magiclineFailedDetail),We(!1)}catch(V){ne.error("[ContractCreationForm] Submit failed:",V),le(),C(o.magiclineFailedDetail),We(!1)}}}async function sr(){if(d.phase!=="ready"||p===null||w.trim()==="")return;const V=w.trim(),$=Gt();G(null);const ce=de=>{He(),_t(""),G(de)},nt=o.magiclineVoucherInvalid.replace("{code}",V);try{const de=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($e=>h.selectedModuleIds.includes($e.id)).map($e=>$e.id),privacyConsent:h.consents.privacy,sepaConsent:h.consents.sepa,voucherCode:w.trim()});if(de.status==="ok"){const $e=de.voucher;if($e!==null){const Ge=$e.textBlocks.map(cr=>cr.ackKey);J({requestId:$,voucher:$e,appliedCode:w.trim(),voucherAckKeys:Ge,pricing:{basePrice:de.basePrice,preUseCharge:de.preUseCharge,currencyCode:de.currencyCode,flatFees:de.flatFees,modules:de.modules,contractVolume:de.contractVolume,startDate:de.startDate,paymentFrequency:de.paymentFrequency,fingerprint:de.pricingFingerprint}})}else ce(nt)}else de.status==="voucher_invalid"?ce(nt):de.status==="voucher_disabled"?(se(),_t(""),G(o.magiclineVoucherDisabled)):ce(nt)}catch{ce(nt)}}function lr(){yn?ar():gt()}const vn=Rm(Ue,o),$t=v==="applying"||w.trim()!==""&&w.trim()!==(y??""),wn=Ue==="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:[Ue==="offer"?s(xm,{offersState:m,selectedTermId:h.termId,widgetLocale:a,disabled:be,error:tt.termId,onSelect:N,onRetry:et}):null,Ue==="upgrades"&&p!==null?s(vm,{modules:p.optionalModules,selectedModuleIds:h.selectedModuleIds,acknowledgedBlocks:h.acknowledgedBlocks,widgetLocale:a,disabled:be,error:tt.upgrades,onToggle:ge,onAck:F}):null,Ue==="personal"?s(km,{personal:h.personal,errors:tt,disabled:be,setPersonal:L}):null,Ue==="address"?s(_m,{address:h.address,errors:tt,disabled:be,setAddress:W}):null,Ue==="payment"?s(jm,{formMessageId:t,fields:h,errors:tt,privacyUrl:jt,disabled:be,setAccountHolder:X,setIban:ae,setConsent:S}):null,Ue==="review"?s(Sm,{fields:h,term:p,previewState:d,widgetLocale:a,disabled:be,acknowledgedBlocks:h.acknowledgedBlocks,onToggleAck:F,onRetry:St,allowVoucherCodes:b,voucherUnavailable:I,voucherStatus:v,draftVoucherCode:w,appliedVoucher:R,voucherBanner:Qe,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 Dl({customerNumber:t}){const e=E();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 ql({message:t}){const e=E();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 xm({offersState:t,selectedTermId:e,widgetLocale:n,disabled:r,error:i,onSelect:o,onRetry:a}){const l=E();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=Am(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(h=>s(bm,{term:h,checked:e===h.termId,widgetLocale:n,disabled:r,onSelect:o},h.termId)),s(ym,{subDescription:u.bundleSubDescription,footnote:u.footnote})]},u.bundleId))}),i!==void 0?s("div",{class:"jex-magicline-error",role:"alert",children:i}):null]})}function bm({term:t,checked:e,widgetLocale:n,disabled:r,onSelect:i}){const o=E(),a=Gr(t.termValue,t.termUnit,n),l=Xe(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," ",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,":"," ",Xe(c.price,t.currencyCode,n)]}):null,u.map(h=>s("span",{class:"jex-magicline-offer-term-note",children:[Nl(h.name,o),": ",Xe(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 ym({subDescription:t,footnote:e}){const n=E(),r=Cm(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 vm({modules:t,selectedModuleIds:e,acknowledgedBlocks:n,widgetLocale:r,disabled:i,error:o,onToggle:a,onAck:l}){const c=E();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(wm,{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 wm({module:t,selected:e,consentChecked:n,widgetLocale:r,disabled:i,onToggle:o,onAck:a}){const l=E(),c=Bp(t.price,t.currencyCode,t.paymentFrequencyType,t.recurringUnit,r),u=Hp(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(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 km({personal:t,errors:e,disabled:n,setPersonal:r}){const i=E(),o=he(()=>El(),[]);return s(Z,{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(Tm,{label:i.magiclineGender,value:t.gender,required:!0,disabled:n,placeholder:i.magiclineGenderPlaceholder,error:e.gender,onChange:a=>{r("gender",a)},options:Ml.map(a=>({value:a,label:Em(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 _m({address:t,errors:e,disabled:n,setAddress:r}){const i=E();return s(Z,{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 jm({formMessageId:t,fields:e,errors:n,privacyUrl:r,disabled:i,setAccountHolder:o,setIban:a,setConsent:l}){const c=E(),u=`jex-ml-privacy-${t}`,h=`jex-ml-sepa-${t}`;return s(Z,{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 Sm({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:x,onApplyVoucher:k}){const b=E();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(),I=t.address,N=[`${I.street} ${I.houseNumber}`.trim(),`${I.zipCode} ${I.city}`.trim(),b.magiclineCountryStatic].filter(S=>S!=="").join(", "),L=e!==null?`${e.bundleName} · ${Gr(e.termValue,e.termUnit,r)}`:"—",W=e!==null?e.textBlocks.filter(S=>S.isConfirmationRequired):[],ge=e!==null?e.textBlocks.filter(S=>!S.isConfirmationRequired):[],F=e!==null?e.optionalModules.filter(S=>t.selectedModuleIds.includes(S.id)&&S.consent!==null).map(S=>({module:S,consent:S.consent})):[],X=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"?Xe(d.discountedBasePrice,v.currencyCode,r):Xe(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}",Fp(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,le)=>s("div",{class:"jex-magicline-summary-row",children:[s("dt",{children:Nl(S.name,b)}),s("dd",{children:Xe(S.price,v.currencyCode,r)})]},`${S.name}-${le}`)),v.preUseCharge>0?s("div",{class:"jex-magicline-summary-row",children:[s("dt",{children:b.magiclineReviewPreUseCharge}),s("dd",{children:Xe(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,le)=>s("div",{class:"jex-magicline-summary-row",children:[s("dt",{children:S.name}),s("dd",{children:Xe(S.amount,S.currencyCode,r)})]},`${S.moduleId}-${le}`))]}):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:Xe(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:Up(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:zp(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||h==="applying",onInput:S=>{x(S.currentTarget.value)}}),s("button",{type:"button",class:"jex-magicline-voucher-apply",disabled:i||h==="applying"||m.trim()==="",onClick:k,children:b.magiclineVoucherApply})]}),p!==null?s("div",{class:"jex-magicline-error",role:"alert",children:p}):null]}):null,F.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}),F.map(({module:S,consent:le})=>s(zl,{title:le.title!==""?le.title:S.name,text:le.text,attachmentLabel:le.attachmentLabel,attachmentUrl:le.attachmentUrl},le.ackKey))]}):null,W.length>0||ge.length>0||X.length>0?s("div",{class:"jex-magicline-terms",role:"group","aria-label":b.magiclineReviewTerms,children:[W.length>0||X.length>0?s("div",{class:"jex-magicline-terms-prompt",children:[b.magiclineConfirmPrompt,s("span",{class:"jex-magicline-required-pill",children:b.magiclineRequired})]}):null,W.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)),X.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)),ge.map((S,le)=>s(zl,{title:S.title,text:S.text,attachmentLabel:S.attachmentLabel,attachmentUrl:S.attachmentUrl},`${S.title}-${le}`))]}):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=E(),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(Z,{children:[" ",s("a",{href:i,target:"_blank",rel:"noopener noreferrer",class:"jex-privacy-notice-link",children:r!==null&&r!==""?r:i})]}):null]})]})]})]})}function zl({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 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 Tm({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 Cm(t){return t===null?[]:t.split(`
|
|
76
|
-
`)
|
|
77
|
-
${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:Pm[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 Mm(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 Om(){return s("div",{class:"jex-typing",children:[s("span",{}),s("span",{}),s("span",{})]})}const Lm=/\s?\[\d+\]/g;function Kr(t){return t.replace(Lm,"")}function $m(t){return t?.at(-1)?._creationTime??0}function Dm(t){return{id:t._id,content:Kr(t.content),role:t.role,authorName:t.authorName}}function Ul(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(Dm)}function Bl(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 qm(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 zm({conversations:t,greeting:e,botName:n,starterQuestions:r,onPickStarter:i,sessionNotFound:o,resumeFailed:a,onStartFresh:l,sessionId:c,visitorId:u}){const h=E(),m=qe(null),[d,p]=q(null),x=$m(t),k=qm(t),b=Cl(),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(jp,{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(y=>{if(y.contentType==="human-notice"){const L=y.noticeKind==="agent-joined"?h.noticeAgentJoined.replace("{name}",y.noticeData?.agentName??""):y.noticeKind==="human-requested"?h.noticeHumanRequested:y.noticeKind==="human-requested-form"?h.noticeHumanRequestedForm:y.noticeKind==="message-received"?h.noticeMessageReceived:y.noticeKind==="agent-handling"?h.noticeAgentHandling:y.noticeKind==="ai-resumed"?h.noticeAiResumed:y.content;return s(bn,{text:L,botName:n},y._id)}if(y.contentType==="escalation-form"&&c&&u)return ah.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: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:y._id,sessionId:c,visitorId:u,waitingSetAt:x})},children:h.escalationPromptSubmit}),s("button",{class:"jex-escalation-skip",type:"button",onClick:()=>{b({formMessageId:y._id,sessionId:c,visitorId:u,waitingSetAt:x}),p(y._id)},children:h.escalationSkip})]},y._id):s(Cp,{message:y,sessionId:c,visitorId:u,waitingSetAt:x},y._id);if(y.contentType==="magicline-form"&&c&&u)return s(Im,{message:y,sessionId:c,visitorId:u},y._id);if(y.contentType==="escalation-confirm"){const L=y.noticeKind==="escalation-confirmed"?h.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=Ul(y,t);return s(Tp,{id:`jex-msg-${y._id}`,text:y.content,botName:n,onQuote:()=>{Ji({id:y._id,content:y.content,role:"user"})},quoted:L,onQuotedClick:(W,ge)=>{Bl(W,ge.currentTarget)},agentNames:k},y._id)}const I={authorId:y.authorId,authorName:y.authorName,authorImage:y.authorImage};if(y.status==="streaming"&&y.content==="")return s(Om,{},y._id);if(y.status==="streaming")return s(bn,{id:`jex-msg-${y._id}`,text:Kr(y.content),streaming:!0,botName:n,...I},y._id);if(y.status==="error")return s(bn,{id:`jex-msg-${y._id}`,text:y.errorMessage??`${h.somethingWentWrong}. ${h.tryAgain}.`,error:!0,botName:n,...I},y._id);const N=Ul(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,W)=>{Bl(L,W.currentTarget)},...I}),y.sources&&y.sources.length>0?s(Nm,{sources:y.sources}):null]},y._id)}),s("div",{ref:m})]})}function Um(){const t=E();function e(){const n=Yn.peek();n&&(Ds(),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 Fl({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 Bm({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 Fm(t){const e=E(),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 Vm({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 Hm(){return Bt(Ce.functions.chat.public.helpdesk.createEscalationRequest)}function Vl({sessionId:t,visitorId:e,ensureSession:n,onSkipForm:r}){const i=E(),o=Hm(),[a,l]=q(!1),[c,u]=q(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=Rt.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 Wm({greeting:t,botName:e,starterQuestions:n,sessionId:r,visitorId:i,isLoading:o,sessionNotFound:a,resumeFailed:l,isOrgDeleted:c,ensureSession:u,startFresh:h}){const m=E(),{conversations:d,sessionStatus:p,isLoading:x,isStreaming:k}=Bm({sessionId:r,visitorId:i});Fm(d),Vm({sessionId:r,visitorId:i}),M(()=>{const I=Yn.peek();if(I===null||!d||d.length===0)return;const{waitingSetAt:N}=I;d.some(W=>W._creationTime>N&&(W.noticeKind==="agent-joined"||!!W.authorId))&&Ds()},[d]);const b=$s({sessionId:r,visitorId:i,ensureSession:u}),v=qe((()=>{const I=un.peek();return I!==null?I:Vi.peek()&&ze.peek()!==null?"resume":"fresh"})()).current,{requestHuman:w,error:R}=Vl({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(Fl,{message:m.resumeConversation}):s(Z,{children:[s(zm,{conversations:d,greeting:t,botName:e,starterQuestions:n,onPickStarter:I=>{b(I)},sessionNotFound:a,resumeFailed:l,onStartFresh:h,sessionId:r,visitorId:i}),Yn.value!==null&&s(Um,{}),R&&s("div",{class:"jex-session-error-notice",role:"alert",style:{margin:"8px 16px 0"},children:R}),s(Kh,{sessionId:r,visitorId:i,isLoading:o,isStreaming:k,sessionStatus:p,ensureSession:u,onStartFresh:h})]})}function Hl(t){return Tr(Ce.functions.chat.public.availability.getOrgAvailability,t?{orgSlug:t}:"skip")}function Wl(t){return t?.anyOnline?"online":t?.anyAway?"away":"offline"}function Qm({formMessageId:t,sessionId:e,visitorId:n,orgSlug:r}){const i=E(),o=Vn.value,a=/^https?:\/\//i.test(o)?o:Fn,[l,c]=q(""),[u,h]=q(""),m=Hl(r),d=m&&!m.anyOnline?i.escalationOfflineSubtitle:i.escalationSubtitle,p=Tl(),[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:ct.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=>{h(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 Ql({sessionId:t,visitorId:e,ensureSession:n,availability:r}){const i=E(),{requestHuman:o,busy:a,error:l}=Vl({sessionId:t,visitorId:e,ensureSession:n}),c=`jex-presence-dot--${Wl(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 Gm(){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 Gl(t){return Kl(t)?"unauthorized":t instanceof Error&&/network|fetch|failed to fetch/i.test(t.message)?"network":"unknown"}function Kl(t){return t instanceof yr?t.data?.code==="UNAUTHORIZED_ORIGIN":!1}function Km(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 Ym(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 Km();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:ct.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(!Kl(w))throw w;const R=await Gm();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=K(async()=>{if(n.current)return n.current;if(o.value)return null;r.value=!0;const p=ze.value!==null,x=ze.value??ys();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=Gl(k),null}finally{r.value=!1}},[t,e,l,r,i,o]),h=K(()=>{n.current=null,i.value=!1,o.value=!1,Ms(),hn.value=null},[i,o]);M(()=>lh(h),[h]);const m=K(async()=>{n.current=null,o.value=!1,i.value=!1,Ms(),hn.value=null;const p=ys();r.value=!0;try{return(await c(p))?.session??null}catch(x){return ne.error("[JexityChat] Failed to create fresh session:",x),fn.value=Gl(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:h}}function Jm({botName:t,availability:e,onResetSession:n}){const r=E(),[i,o]=q(""),a=e?.anyOnline===!0,l=Wl(e);function c(){Lr(),un.value="escalate",n(),vs(),wt({id:"chat"})}function u(){Lr(),un.value="fresh",n(),vs(),wt({id:"chat"})}function h(d){Lr(),un.value="resume",n(),ws(d),wt({id:"chat"})}function m(d){d.preventDefault();const p=i.trim().toUpperCase();p&&(Lr(),un.value="resume",n(),ws(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(Cs,{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:()=>{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: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 Zm({title:t}){const e=E();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 Xm(){const t=E(),[e,n]=q(""),[r,i]=q(""),[o,a]=q("");async function l(c){c.preventDefault(),Qi({id:"loading",message:t.submittingTicket}),await new Promise(h=>{setTimeout(h,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 eg({ticketRef:t}){const e=E();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 tg({message:t,onRetry:e,onBack:n}){const r=E();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 Yl({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: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(Jm,{botName:r,availability:o,onResetSession:x}),b.id==="selection"&&s(Zm,{title:n}),b.id==="form"&&s(Xm,{}),b.id==="escalation-form"&&s(Qm,{formMessageId:b.formMessageId,sessionId:b.sessionId,visitorId:b.visitorId,orgSlug:i,waitingSetAt:b.waitingSetAt}),b.id==="confirmation"&&v&&s(eg,{ticketRef:v.ref}),b.id==="chat"&&s(Wm,{greeting:t,botName:r,starterQuestions:e,sessionId:a,visitorId:l,isLoading:c,sessionNotFound:u,resumeFailed:h,isOrgDeleted:m,ensureSession:d,startFresh:p}),b.id==="loading"&&s(Fl,{message:b.message}),b.id==="error"&&s(tg,{message:b.message,onRetry:()=>Qi({id:"loading"}),onBack:Wi})]})}function ng({options:t}){return Bd({orgSlug:t.orgSlug,projSlug:t.projSlug,preToken:t.bootstrapToken,convexUrl:t.convexUrl,preAllowedUrls:t.allowedUrls??[],preExcludedPaths:t.excludePaths}),Hd()?s(rg,{options:t}):null}function rg({options:t}){const e=zd(t.orgSlug,t.projSlug,t.convexUrl);Yd(t.parentOrigin),M(()=>(rh(),oh(),()=>{Fi.value=!1}),[]);const{sessionId:n,visitorId:r,isLoading:i,sessionNotFound:o,resumeFailed:a,isOrgDeleted:l,ensureSession:c,startFresh:u,resetSession:h}=Ym(t.orgSlug,t.projSlug),m=Hl(t.orgSlug),d=Ld(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(()=>{ct.value=ps(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 ae=document.documentElement.style.overflow;return document.documentElement.style.overflow="hidden",()=>{document.documentElement.style.overflow=ae}},[oe.value,d.mode]),M(()=>{if(x&&k&&d.mode!=="embedded"&&b!==null)try{return uh(b)}catch(X){ne.warn("[JexityChat] Idle-lock watcher failed to start:",X);return}},[x,d.mode,k,b]),M(()=>{if(!x||!k)return;const{activeRefPruned:X}=ih(b);X&&Yi()},[x,k,b]);const v=d.position==="bottom-left",w=d.colorScheme==="dark"||d.colorScheme==="light"?d.colorScheme:"",R=dh({...t,primaryColor:d.primaryColor,accentColor:d.accentColor,fontFamily:d.fontFamily,fontSize:d.fontSize,borderRadius:d.borderRadius,windowWidth:d.windowWidth,windowHeight:d.windowHeight}),y=d.mode==="embedded",I=Oe.value,L=I[I.length-1]?.id==="chat",W=e.config!==null||y||!!t.parentOrigin,ge=W?R:{...R,visibility:"hidden"},F=wh(t.orgSlug,t.projSlug);return M(()=>{if(y||!W||d.proactiveMode==="off"||As(F))return;const X=window.setTimeout(()=>{const ae=_h({mode:d.proactiveMode,isOpen:oe.peek(),hasHistory:Vi.peek(),dismissed:As(F)});ae==="teaser"?Dr.value=!0:ae==="open"&&(oe.value=!0)},d.proactiveDelaySeconds*1e3);return()=>{window.clearTimeout(X)}},[y,W,d.proactiveMode,d.proactiveDelaySeconds,F]),s("div",{class:`jex-widget ${w}`.trim(),style:ge,children:y?s("div",{class:"jex-embedded",children:[s(Ss,{title:d.title,rightAction:L?s(Ql,{sessionId:n,visitorId:r,ensureSession:c,availability:m}):null,showClose:!y}),s(Yl,{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:h}),!d.hideBranding&&s(Ts,{})]}):s("div",{class:`jex-container${v?" jex-pos-left":""}`,children:[oe.value&&s("div",{class:"jex-chat-window",children:[s(Ss,{title:d.title,rightAction:L?s(Ql,{sessionId:n,visitorId:r,ensureSession:c,availability:m}):null}),s(Yl,{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:h}),!d.hideBranding&&s(Ts,{})]}),Dr.value&&!oe.value&&s(jh,{title:d.title,message:d.greeting,guardKey:F}),s(vh,{iconOption:d.triggerIcon,radius:d.triggerRadius,label:d.triggerLabel})]})})}const ig=`.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:24px;right:24px;display:flex;flex-direction:column;align-items:flex-end;gap:16px;z-index:9999}.jex-container.jex-pos-left{right:auto;left: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)}}@media(max-width:480px),(pointer:coarse)and (max-width:768px){.jex-chat-window{position:fixed;inset:0;width:100vw;height:100vh;height:100dvh;max-height:none;border:none;border-radius:0;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);margin:0 0 8px;padding:4px 12px;color:var(--jex-text-muted)}.jex-md blockquote: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 og(t){const e=document.createElement("style");e.textContent=ig,t.appendChild(e)}const ag="https://festive-mouse-978.eu-west-1.convex.cloud";let wo=null;function sg(t){const e=t??ag;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 xd(Md(e))),wo}function lg(t,e){const n=t.shadowRoot??t.attachShadow({mode:"open"});for(;n.firstChild;)n.removeChild(n.firstChild);og(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(yd,{client:sg(e.convexUrl),children:s(ng,{options:e})}),r),function(){qt(null,r),oe.value=!1,Mr.value=void 0,Rt.value=void 0,Oe.value=[{id:"home"}]}}function cg(t,e,n){const r=lg(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 ug(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=cg(e,t,()=>{t.container||e.remove(),or===n&&(or=null)});return or=n,n}function Ot(t,e){return t.getAttribute(e)??void 0}async function Jl(){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")};window.JexityChat=ug(a)}document.readyState==="complete"?Jl():window.addEventListener("load",Jl)})();
|
|
73
|
+
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 $f;function F(t,e){return Wt.parse(t,e)}F.options=F.setOptions=function(t){return Wt.setOptions(t),F.defaults=Wt.defaults,Vs(F.defaults),F},F.getDefaults=eo,F.defaults=Vt,F.use=function(...t){return Wt.use(...t),F.defaults=Wt.defaults,Vs(F.defaults),F},F.walkTokens=function(t,e){return Wt.walkTokens(t,e)},F.parseInline=Wt.parseInline,F.Parser=Ze,F.parser=Ze.parse,F.Renderer=Wr,F.TextRenderer=co,F.Lexer=Je,F.lexer=Je.lex,F.Tokenizer=Hr,F.Hooks=Xn,F.parse=F,F.options,F.setOptions,F.use,F.walkTokens,F.parseInline,Ze.parse,Je.lex;function sl(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 Df(t){if(Array.isArray(t))return t}function qf(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 zf(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
74
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Uf(t,e){return Df(t)||qf(t,e)||Bf(t,e)||zf()}function Bf(t,e){if(t){if(typeof t=="string")return sl(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)?sl(t,e):void 0}}const ll=Object.entries,cl=Object.setPrototypeOf,Ff=Object.isFrozen,Vf=Object.getPrototypeOf,Hf=Object.getOwnPropertyDescriptor;let ke=Object.freeze,_e=Object.seal,gn=Object.create,ul=typeof Reflect<"u"&&Reflect,uo=ul.apply,ho=ul.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=me(Array.prototype.forEach),Wf=me(Array.prototype.lastIndexOf),dl=me(Array.prototype.pop),xn=me(Array.prototype.push),Qf=me(Array.prototype.splice),Pt=Array.isArray,tr=me(String.prototype.toLowerCase),fo=me(String.prototype.toString),hl=me(String.prototype.match),nr=me(String.prototype.replace),fl=me(String.prototype.indexOf),Gf=me(String.prototype.trim),Kf=me(Number.prototype.toString),Yf=me(Boolean.prototype.toString),pl=typeof BigInt>"u"?null:me(BigInt.prototype.toString),ml=typeof Symbol>"u"?null:me(Symbol.prototype.toString),ye=me(Object.prototype.hasOwnProperty),rr=me(Object.prototype.toString),je=me(RegExp.prototype.test),Qt=Jf(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 uo(t,e,r)}}function Jf(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(cl&&cl(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&&(Ff(e)||(e[r]=o),i=o)}t[i]=!0}return t}function Zf(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 ll(t)){var n=Uf(r,2);const i=n[0],o=n[1];ye(t,i)&&(Pt(o)?e[i]=Zf(o):o&&typeof o=="object"&&o.constructor===Object?e[i]=Ee(o):e[i]=o)}return e}function Xf(t){switch(typeof t){case"string":return t;case"number":return Kf(t);case"boolean":return Yf(t);case"bigint":return pl?pl(t):"0";case"symbol":return ml?ml(t):"Symbol()";case"undefined":return rr(t);case"function":case"object":{if(t===null)return rr(t);const e=t,n=dt(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 dt(t,e){for(;t!==null;){const r=Hf(t,e);if(r){if(r.get)return me(r.get);if(typeof r.value=="function")return me(r.value)}t=Vf(t)}function n(){return null}return n}function ep(t){try{return je(t,""),!0}catch{return!1}}const gl=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"]),tp=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"]),np=ke(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),xl=ke(["#text"]),bl=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"]),yl=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"]),rp=_e(/{{[\w\W]*|^[\w\W]*}}/g),ip=_e(/<%[\w\W]*|^[\w\W]*%>/g),op=_e(/\${[\w\W]*/g),ap=_e(/^data-[\-\w.\u00B7-\uFFFF]+$/),sp=_e(/^aria-[\-\w]+$/),vl=_e(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),lp=_e(/^(?:\w+script|data):/i),cp=_e(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),up=_e(/^html$/i),dp=_e(/^[a-z][.\w]*(-[.\w]+)+$/i),wl=_e(/<[/\w!]/g),hp=_e(/<[/\w]/g),fp=_e(/<\/no(script|embed|frames)/i),pp=_e(/\/>/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},mp=function(){return typeof window>"u"?null:window},gp=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}},kl=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 _l(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:mp();const e=j=>_l(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"),x=dt(d,"remove"),k=dt(d,"nextSibling"),b=dt(d,"childNodes"),v=dt(d,"parentNode"),w=dt(d,"shadowRoot"),R=dt(d,"attributes"),y=a&&a.prototype?dt(a.prototype,"nodeType"):null,I=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 N,L="",Q,ge=!1,V=0;const X=function(){if(V>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(f){X(),V++;try{return N.createHTML(f)}finally{V--}},S=function(f){X(),V++;try{return N.createScriptURL(f)}finally{V--}},le=function(){return ge||(Q=gp(m,i),ge=!0),Q},pt=n,et=pt.implementation,mt=pt.createNodeIterator,Lt=pt.createDocumentFragment,_t=pt.getElementsByTagName,Gt=r.importNode;let J=kl();e.isSupported=typeof ll=="function"&&typeof v=="function"&&et&&et.createHTMLDocument!==void 0;const He=rp,se=ip,D=op,Le=ap,tt=sp,Kt=lp,be=cp,We=dp;let Se=vl,Y=null;const T=U({},[...gl,...po,...mo,...go,...xl]);let C=null;const Qe=U({},[...bl,...xo,...yl,...Qr]);let G=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 Ue=!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,H=!0,$=!1;const ce="user-content-";let nt=!0,de=!1,$e={},Ge=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 Zl=null;const Xl=U({},["audio","video","img","source","image","track"]);let ko=null;const ec=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 fg=U({},[Zr,Xr,xt],fo),tc=ke(["mi","mo","mn","ms","mtext"]);let So=U({},tc);const nc=ke(["annotation-xml"]);let To=U({},nc);const pg=U({},["title","style","font","a","script"]);let ur=null;const mg=["application/xhtml+xml","text/html"],gg="text/html";let ue=null,jn=null;const xg=n.createElement("form"),rc=function(f){return f instanceof RegExp||f instanceof Function},Co=function(){let f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(jn&&jn===f)return;(!f||typeof f!="object")&&(f={}),f=Ee(f),ur=mg.indexOf(f.PARSER_MEDIA_TYPE)===-1?gg:f.PARSER_MEDIA_TYPE,ue=ur==="application/xhtml+xml"?fo:tr,Y=Nt(f,"ALLOWED_TAGS",T,{transform:ue}),C=Nt(f,"ALLOWED_ATTR",Qe,{transform:ue}),jo=Nt(f,"ALLOWED_NAMESPACES",fg,{transform:fo}),ko=Nt(f,"ADD_URI_SAFE_ATTR",ec,{transform:ue,base:ec}),Zl=Nt(f,"ADD_DATA_URI_TAGS",Xl,{transform:ue,base:Xl}),Ge=Nt(f,"FORBID_CONTENTS",cr,{transform:ue}),jt=Nt(f,"FORBID_TAGS",Ee({}),{transform:ue}),ee=Nt(f,"FORBID_ATTR",Ee({}),{transform:ue}),$e=ye(f,"USE_PROFILES")?f.USE_PROFILES&&typeof f.USE_PROFILES=="object"?Ee(f.USE_PROFILES):f.USE_PROFILES:!1,Ue=f.ALLOW_ARIA_ATTR!==!1,yn=f.ALLOW_DATA_ATTR!==!1,Yr=f.ALLOW_UNKNOWN_PROTOCOLS||!1,Jr=f.ALLOW_SELF_CLOSE_IN_ATTR!==!1,gt=f.SAFE_FOR_TEMPLATES||!1,Yt=f.SAFE_FOR_XML!==!1,St=f.WHOLE_DOCUMENT||!1,$t=f.RETURN_DOM||!1,wn=f.RETURN_DOM_FRAGMENT||!1,kn=f.RETURN_TRUSTED_TYPE||!1,vn=f.FORCE_BODY||!1,H=f.SANITIZE_DOM!==!1,$=f.SANITIZE_NAMED_PROPS||!1,nt=f.KEEP_CONTENT!==!1,de=f.IN_PLACE||!1,Se=ep(f.ALLOWED_URI_REGEXP)?f.ALLOWED_URI_REGEXP:vl,_n=typeof f.NAMESPACE=="string"?f.NAMESPACE:xt,So=ye(f,"MATHML_TEXT_INTEGRATION_POINTS")&&f.MATHML_TEXT_INTEGRATION_POINTS&&typeof f.MATHML_TEXT_INTEGRATION_POINTS=="object"?Ee(f.MATHML_TEXT_INTEGRATION_POINTS):U({},tc),To=ye(f,"HTML_INTEGRATION_POINTS")&&f.HTML_INTEGRATION_POINTS&&typeof f.HTML_INTEGRATION_POINTS=="object"?Ee(f.HTML_INTEGRATION_POINTS):U({},nc);const g=ye(f,"CUSTOM_ELEMENT_HANDLING")&&f.CUSTOM_ELEMENT_HANDLING&&typeof f.CUSTOM_ELEMENT_HANDLING=="object"?Ee(f.CUSTOM_ELEMENT_HANDLING):gn(null);if(G=gn(null),ye(g,"tagNameCheck")&&rc(g.tagNameCheck)&&(G.tagNameCheck=g.tagNameCheck),ye(g,"attributeNameCheck")&&rc(g.attributeNameCheck)&&(G.attributeNameCheck=g.attributeNameCheck),ye(g,"allowCustomizedBuiltInElements")&&typeof g.allowCustomizedBuiltInElements=="boolean"&&(G.allowCustomizedBuiltInElements=g.allowCustomizedBuiltInElements),_e(G),gt&&(yn=!1),wn&&($t=!0),$e&&(Y=U({},xl),C=gn(null),$e.html===!0&&(U(Y,gl),U(C,bl)),$e.svg===!0&&(U(Y,po),U(C,xo),U(C,Qr)),$e.svgFilters===!0&&(U(Y,mo),U(C,xo),U(C,Qr)),$e.mathMl===!0&&(U(Y,go),U(C,yl),U(C,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)&&(Y===T&&(Y=Ee(Y)),U(Y,f.ADD_TAGS,ue))),ye(f,"ADD_ATTR")&&(typeof f.ADD_ATTR=="function"?Ie.attributeCheck=f.ADD_ATTR:Pt(f.ADD_ATTR)&&(C===Qe&&(C=Ee(C)),U(C,f.ADD_ATTR,ue))),ye(f,"ADD_URI_SAFE_ATTR")&&Pt(f.ADD_URI_SAFE_ATTR)&&U(ko,f.ADD_URI_SAFE_ATTR,ue),ye(f,"FORBID_CONTENTS")&&Pt(f.FORBID_CONTENTS)&&(Ge===cr&&(Ge=Ee(Ge)),U(Ge,f.FORBID_CONTENTS,ue)),ye(f,"ADD_FORBID_CONTENTS")&&Pt(f.ADD_FORBID_CONTENTS)&&(Ge===cr&&(Ge=Ee(Ge)),U(Ge,f.ADD_FORBID_CONTENTS,ue)),nt&&(Y["#text"]=!0),St&&U(Y,["html","head","body"]),Y.table&&(U(Y,["tbody"]),delete jt.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 _=N;N=f.TRUSTED_TYPES_POLICY;try{L=ae("")}catch(A){throw N=_,A}}else f.TRUSTED_TYPES_POLICY===null?(N=void 0,L=""):(N===void 0&&(N=le()),N&&typeof L=="string"&&(L=ae("")));ke&&ke(f),jn=f},ic=U({},[...po,...mo,...tp]),oc=U({},[...go,...np]),bg=function(f,g,_){return g.namespaceURI===xt?f==="svg":g.namespaceURI===Zr?f==="svg"&&(_==="annotation-xml"||So[_]):!!ic[f]},yg=function(f,g,_){return g.namespaceURI===xt?f==="math":g.namespaceURI===Xr?f==="math"&&To[_]:!!oc[f]},vg=function(f,g,_){return g.namespaceURI===Xr&&!To[_]||g.namespaceURI===Zr&&!So[_]?!1:!oc[f]&&(pg[f]||!ic[f])},wg=function(f){let g=v(f);(!g||!g.tagName)&&(g={namespaceURI:_n,tagName:"template"});const _=tr(f.tagName),A=tr(g.tagName);return jo[f.namespaceURI]?f.namespaceURI===Xr?bg(_,g,A):f.namespaceURI===Zr?yg(_,g,A):f.namespaceURI===xt?vg(_,g,A):!!(ur==="application/xhtml+xml"&&jo[f.namespaceURI]):!1},Dt=function(f){xn(e.removed,{element:f});try{v(f).removeChild(f)}catch{if(x(f),!v(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")}},ac=function(f){const g=b(f);if(g){const A=[];er(g,O=>{xn(A,O)}),er(A,O=>{try{x(O)}catch{}})}const _=R(f);if(_)for(let A=_.length-1;A>=0;--A){const O=_[A],W=O&&O.name;if(typeof W=="string")try{f.removeAttribute(W)}catch{}}},Jt=function(f,g){try{xn(e.removed,{attribute:g.getAttributeNode(f),from:g})}catch{xn(e.removed,{attribute:null,from:g})}if(g.removeAttribute(f),f==="is")if($t||wn)try{Dt(g)}catch{}else try{g.setAttribute(f,"")}catch{}},kg=function(f){const g=R(f);if(g)for(let _=g.length-1;_>=0;--_){const A=g[_],O=A&&A.name;if(!(typeof O!="string"||C[ue(O)]))try{f.removeAttribute(O)}catch{}}},_g=function(f){const g=[f];for(;g.length>0;){const _=g.pop();(y?y(_):_.nodeType)===ht.element&&kg(_);const O=b(_);if(O)for(let W=O.length-1;W>=0;--W)g.push(O[W])}},sc=function(f){let g=null,_=null;if(vn)f="<remove></remove>"+f;else{const W=hl(f,/^[\r\n\t ]+/);_=W&&W[0]}ur==="application/xhtml+xml"&&_n===xt&&(f='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+f+"</body></html>");const A=N?ae(f):f;if(_n===xt)try{g=new h().parseFromString(A,ur)}catch{}if(!g||!g.documentElement){g=et.createDocument(_n,"template",null);try{g.documentElement.innerHTML=_o?L:A}catch{}}const O=g.body||g.documentElement;return f&&_&&O.insertBefore(n.createTextNode(_),O.childNodes[0]||null),_n===xt?_t.call(g,St?"html":"body")[0]:St?g.documentElement:O},lc=function(f){return mt.call(f.ownerDocument||f,f,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},ei=function(f){return f=nr(f,He," "),f=nr(f,se," "),f=nr(f,D," "),f},Ao=function(f){var g;f.normalize();const _=mt.call(f.ownerDocument||f,f,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=f.querySelectorAll)===null||g===void 0?void 0:g.call(f,"template");O&&er(O,W=>{Sn(W.content)&&Ao(W.content)})},ti=function(f){const g=I?I(f):null;return typeof g!="string"||ue(g)!=="form"?!1:typeof f.nodeName!="string"||typeof f.textContent!="string"||typeof f.removeChild!="function"||f.attributes!==R(f)||typeof f.removeAttribute!="function"||typeof f.setAttribute!="function"||typeof f.namespaceURI!="string"||typeof f.insertBefore!="function"||typeof f.hasChildNodes!="function"||f.nodeType!==y(f)||f.childNodes!==b(f)},Sn=function(f){if(!y||typeof f!="object"||f===null)return!1;try{return y(f)===ht.documentFragment}catch{return!1}},dr=function(f){if(!y||typeof f!="object"||f===null)return!1;try{return typeof y(f)=="number"}catch{return!1}};function Tt(j,f,g){j.length!==0&&er(j,_=>{_.call(e,f,g,jn)})}const jg=function(f,g){return!!(Yt&&f.hasChildNodes()&&!dr(f.firstElementChild)&&je(wl,f.textContent)&&je(wl,f.innerHTML)||Yt&&f.namespaceURI===xt&&g==="style"&&dr(f.firstElementChild)||f.nodeType===ht.processingInstruction||Yt&&f.nodeType===ht.comment&&je(hp,f.data))},Sg=function(f,g){if(!jt[g]&&dc(g)&&(G.tagNameCheck instanceof RegExp&&je(G.tagNameCheck,g)||G.tagNameCheck instanceof Function&&G.tagNameCheck(g)))return!1;if(nt&&!Ge[g]){const _=v(f),A=b(f);if(A&&_){const O=A.length;for(let W=O-1;W>=0;--W){const ve=de?A[W]:p(A[W],!0);_.insertBefore(ve,k(f))}}}return Dt(f),!0},cc=function(f){if(Tt(J.beforeSanitizeElements,f,null),ti(f))return Dt(f),!0;const g=ue(I?I(f):f.nodeName);if(Tt(J.uponSanitizeElement,f,{tagName:g,allowedTags:Y}),jg(f,g))return Dt(f),!0;if(jt[g]||!(Ie.tagCheck instanceof Function&&Ie.tagCheck(g))&&!Y[g])return Sg(f,g);if((y?y(f):f.nodeType)===ht.element&&!wg(f)||(g==="noscript"||g==="noembed"||g==="noframes")&&je(fp,f.innerHTML))return Dt(f),!0;if(gt&&f.nodeType===ht.text){const A=ei(f.textContent);f.textContent!==A&&(xn(e.removed,{element:f.cloneNode()}),f.textContent=A)}return Tt(J.afterSanitizeElements,f,null),!1},uc=function(f,g,_){if(ee[g]||H&&(g==="id"||g==="name")&&(_ in n||_ in xg))return!1;const A=C[g]||Ie.attributeCheck instanceof Function&&Ie.attributeCheck(g,f);if(!(yn&&je(Le,g))){if(!(Ue&&je(tt,g))){if(A){if(!ko[g]){if(!je(Se,nr(_,be,""))){if(!((g==="src"||g==="xlink:href"||g==="href")&&f!=="script"&&fl(_,"data:")===0&&Zl[f])){if(!(Yr&&!je(Kt,nr(_,be,"")))){if(_)return!1}}}}}else if(!(dc(f)&&(G.tagNameCheck instanceof RegExp&&je(G.tagNameCheck,f)||G.tagNameCheck instanceof Function&&G.tagNameCheck(f))&&(G.attributeNameCheck instanceof RegExp&&je(G.attributeNameCheck,g)||G.attributeNameCheck instanceof Function&&G.attributeNameCheck(g,f))||g==="is"&&G.allowCustomizedBuiltInElements&&(G.tagNameCheck instanceof RegExp&&je(G.tagNameCheck,_)||G.tagNameCheck instanceof Function&&G.tagNameCheck(_))))return!1}}return!0},Tg=U({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),dc=function(f){return!Tg[tr(f)]&&je(We,f)},Cg=function(f,g,_,A){if(N&&typeof m=="object"&&typeof m.getAttributeType=="function"&&!_)switch(m.getAttributeType(f,g)){case"TrustedHTML":return ae(A);case"TrustedScriptURL":return S(A)}return A},Ag=function(f,g,_,A){try{_?f.setAttributeNS(_,g,A):f.setAttribute(g,A),ti(f)?Dt(f):dl(e.removed)}catch{Jt(g,f)}},hc=function(f){Tt(J.beforeSanitizeAttributes,f,null);const g=f.attributes;if(!g||ti(f))return;const _={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:C,forceKeepAttr:void 0};let A=g.length;const O=ue(f.nodeName);for(;A--;){const W=g[A],ve=W.name,xe=W.namespaceURI,Ke=W.value,rt=ue(ve),Eo=Ke;let Pe=ve==="value"?Eo:Gf(Eo);if(_.attrName=rt,_.attrValue=Pe,_.keepAttr=!0,_.forceKeepAttr=void 0,Tt(J.uponSanitizeAttribute,f,_),Pe=_.attrValue,$&&(rt==="id"||rt==="name")&&fl(Pe,ce)!==0&&(Jt(ve,f),Pe=ce+Pe),Yt&&je(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Pe)){Jt(ve,f);continue}if(rt==="attributename"&&hl(Pe,"href")){Jt(ve,f);continue}if(!_.forceKeepAttr){if(!_.keepAttr){Jt(ve,f);continue}if(!Jr&&je(pp,Pe)){Jt(ve,f);continue}if(gt&&(Pe=ei(Pe)),!uc(O,rt,Pe)){Jt(ve,f);continue}Pe=Cg(O,rt,xe,Pe),Pe!==Eo&&Ag(f,ve,xe,Pe)}}Tt(J.afterSanitizeAttributes,f,null)},ni=function(f){let g=null;const _=lc(f);for(Tt(J.beforeSanitizeShadowDOM,f,null);g=_.nextNode();)if(Tt(J.uponSanitizeShadowNode,g,null),cc(g),hc(g),Sn(g.content)&&ni(g.content),(y?y(g):g.nodeType)===ht.element){const O=w(g);Sn(O)&&(Ro(O),ni(O))}Tt(J.afterSanitizeShadowDOM,f,null)},Ro=function(f){const g=[{node:f,shadow:null}];for(;g.length>0;){const _=g.pop();if(_.shadow){ni(_.shadow);continue}const A=_.node,W=(y?y(A):A.nodeType)===ht.element,ve=b(A);if(ve)for(let xe=ve.length-1;xe>=0;--xe)g.push({node:ve[xe],shadow:null});if(W){const xe=I?I(A):null;if(typeof xe=="string"&&ue(xe)==="template"){const Ke=A.content;Sn(Ke)&&g.push({node:Ke,shadow:null})}}if(W){const xe=w(A);Sn(xe)&&g.push({node:null,shadow:xe},{node:xe,shadow:null})}}};return e.sanitize=function(j){let f=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=Xf(j),typeof j!="string"))throw Qt("dirty is not a string, aborting");if(!e.isSupported)return j;ar?(Y=sr,C=lr):Co(f),(J.uponSanitizeElement.length>0||J.uponSanitizeAttribute.length>0)&&(Y=Ee(Y)),J.uponSanitizeAttribute.length>0&&(C=Ee(C)),e.removed=[];const W=de&&typeof j!="string"&&dr(j);if(W){const Ke=I?I(j):j.nodeName;if(typeof Ke=="string"){const rt=ue(Ke);if(!Y[rt]||jt[rt])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(rt){throw ac(j),rt}}else if(dr(j))g=sc("<!---->"),_=g.ownerDocument.importNode(j,!0),_.nodeType===ht.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=sc(j),!g)return $t?null:kn?L:""}g&&vn&&Dt(g.firstChild);const ve=lc(W?j:g);try{for(;A=ve.nextNode();)cc(A),hc(A),Sn(A.content)&&ni(A.content)}catch(Ke){throw W&&ac(j),Ke}if(W)return er(e.removed,Ke=>{Ke.element&&_g(Ke.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&&Y["!doctype"]&&g.ownerDocument&&g.ownerDocument.doctype&&g.ownerDocument.doctype.name&&je(up,g.ownerDocument.doctype.name)&&(xe="<!DOCTYPE "+g.ownerDocument.doctype.name+`>
|
|
75
|
+
`+xe),gt&&(xe=ei(xe)),N&&kn?ae(xe):xe},e.setConfig=function(){let j=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Co(j),ar=!0,sr=Y,lr=C},e.clearConfig=function(){jn=null,ar=!1,sr=null,lr=null,N=Q,L=""},e.isValidAttribute=function(j,f,g){jn||Co({});const _=ue(j),A=ue(f);return uc(_,A,g)},e.addHook=function(j,f){typeof f=="function"&&ye(J,j)&&xn(J[j],f)},e.removeHook=function(j,f){if(ye(J,j)){if(f!==void 0){const g=Wf(J[j],f);return g===-1?void 0:Qf(J[j],g,1)[0]}return dl(J[j])}},e.removeHooks=function(j){ye(J,j)&&(J[j]=[])},e.removeAllHooks=function(){J=kl()},e}var xp=_l();function bp(t){return t.trim().split(/\n\s*-{3,}\s*\n/).map(e=>{const[n="",...r]=e.trim().split(`
|
|
76
|
+
`);return{title:n.replace(/^\*+|\*+$/g,"").trim(),body:r.join(`
|
|
77
|
+
`).trim()}}).filter(e=>(e.title!==""||e.body!=="")&&!/^-{3,}$/.test(e.title))}function yp(t){const e=bp(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("```")?yp(t.text):!1}}});const ir=typeof window<"u"?xp: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 vp(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function wp(t){if(!t)return"";if(!ir)return vp(t);const e=F.parse(t),n=typeof e=="string"?e:"";return ir.sanitize(n)}function kp({text:t}){const e=he(()=>wp(t),[t]);return s("div",{class:"jex-md",dangerouslySetInnerHTML:{__html:e}})}function jl({onQuote:t}){const e=E();return s("button",{type:"button",class:"jex-quote-btn","aria-label":e.quoteMessage,title:e.quoteMessage,onClick:t,children:s(Xi,{size:12})})}function _p(t,e,n){return t.role==="user"?n:t.authorName??e??""}function jp({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,": "]}),Es(e)]})]})}function Sl({quotes:t,botName:e,yourMessageLabel:n,onQuotedClick:r}){return t.length===0?null:s("div",{class:"jex-quoted-list",children:t.map(i=>s(jp,{authorLabel:_p(i,e,n),content:i.content,onClick:r?o=>{r(i.id,o)}:void 0},i.id))})}function Sp(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:h,onQuotedClick:m}){const d=E(),p=!!r,[x,k]=q(!1),b=K(()=>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:Sp(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(Sl,{quotes:h??[],botName:l,yourMessageLabel:d.quotedYourMessage,onQuotedClick:m}),s(kp,{text:t}),e&&s("span",{class:"jex-streaming-cursor"}),c&&s(jl,{onQuote:c})]})]})}function Tp({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 Cp(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 Ap({text:t,id:e,onQuote:n,botName:r,quoted:i,onQuotedClick:o,agentNames:a}){const l=E();return s("div",{class:"jex-message user",id:e,children:[s(Sl,{quotes:i??[],botName:r,yourMessageLabel:l.quotedYourMessage,onQuotedClick:o}),Cp(t,a??[]),n&&s(jl,{onQuote:n})]})}function Tl(){return Bt(Ce.functions.chat.public.helpdesk.submitEscalation)}function Cl(){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 Rp({message:t,sessionId:e,visitorId:n,waitingSetAt:r}){const i=E();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(Ep,{messageId:t._id,sessionId:e,visitorId:n,waitingSetAt:r})})}function Ep({messageId:t,sessionId:e,visitorId:n,waitingSetAt:r}){const i=E(),[o,a]=q(""),[l,c]=q(""),[u,h]=q(!1),m=Vn.value,d=/^https?:\/\//i.test(m)?m:Fn,p=Tl(),x=Cl();async function k(b){if(b.preventDefault(),!u){h(!0);try{await p({sessionId:e,visitorId:n,formMessageId:t,visitorName:o.trim(),visitorEmail:l.trim(),locale:ct.value})}catch(v){ne.error("[FormMessage] Submit failed:",v),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: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 Ip(){return Bt(Ce.functions.magicline.public.submitForm)}function Pp(){return zn(Ce.functions.magicline.actions.getTrialConfig)}function Np(){return zn(Ce.functions.magicline.actions.listTrialSlots)}function Mp(){return zn(Ce.functions.magicline.actions.getRateBundles)}function Al(){return zn(Ce.functions.magicline.actions.getContractPreview)}function Op(){return zn(Ce.functions.magicline.actions.submitContractCreation)}const bo={en:Ui,de:fs},Lp=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function Rl(t){return Lp.test(t.trim())}function $p(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 El(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 Il(){const t=Vn.value;return/^https?:\/\//i.test(t)?t:Fn}const Dp={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},qp=15,zp=34;function Pl(t){return t.replace(/\s+/g,"").toUpperCase()}function Up(t){const e=Pl(t),n=e.slice(0,2),r=Dp[n];if(r!==void 0){if(e.length!==r)return!1}else if(e.length<qp||e.length>zp)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 Bp(t){const e=Pl(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 Xe(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 Fp(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 Vp(t,e,n,r,i){const o=bo[i],a=Xe(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 Hp(t,e,n,r){return e==="PERCENTAGE"?`-${t}%`:`-${Xe(t,n,r)}`}const Wp={startpaket:"magiclineFeeStarterPackage","starter package":"magiclineFeeStarterPackage",trainerpauschale:"magiclineFeeTrainerFee"};function Nl(t,e){const n=t.trim().toLowerCase(),r=Wp[n];return r!==void 0?e[r]:t}function Qp(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 Ml=["MALE","FEMALE","UNISEX"],Gp=[{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 Kp(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 Yp={firstName:"",lastName:"",email:"",phone:"",birthDate:"",gender:"",street:"",houseNumber:"",zip:"",city:"",country:"",note:"",slotId:"",consent:!1,trainerRequired:!0};function Jp(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 Zp({sessionId:t,visitorId:e}){const n=Pp(),r=Np(),[i,o]=De(Jp,Yp),[a,l]=De((v,w)=>w,{phase:"loading"}),[c,u]=De((v,w)=>w,{phase:"loading"}),[h,m]=De(v=>v+1,0),d=K((v,w)=>{o({type:"set",key:v,value:w})},[]),p=K(v=>{o({type:"setTrainer",trainerRequired:v}),m()},[]),x=K(()=>{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,h]),{fields:i,setField:d,setTrainerRequired:p,configState:a,slotsState:c,refetchSlots:x}}function Xp({formMessageId:t,sessionId:e,visitorId:n,slotUnavailable:r=!1,retryPending:i=!1}){const o=E(),a=Ip(),{fields:l,setField:c,setTrainerRequired:u,configState:h,slotsState:m,refetchSlots:d}=Zp({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:sm(h.code,h.backendMessage,o)})]}):s(em,{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 em({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=E(),{plan:p,minimumAge:x,bookingWithoutTrainerAllowed:k,studioZoneId:b}=o,v=he(()=>Kp(p,k),[p,k]),w=r?Math.max(v.indexOf("slot"),0):0,[R,y]=q(w),[I,N]=q({}),[L,Q]=q(!1),[ge,V]=q(null),X=he(()=>Il(),[]),ae=Math.min(R,v.length-1),S=v[ae],le=ae===v.length-1,pt=ae===0;function et(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()!==""&&!Rl(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=$p(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=et(S);if(Object.keys(se).length>0){N(se);return}N({}),y(D=>Math.min(D+1,v.length-1))}function Lt(){N({}),V(null),y(se=>Math.max(se-1,0))}async function _t(){if(L)return;const se=et("confirm");if(Object.keys(se).length>0){N(se);return}N({}),V(null),Q(!0);try{const D=lm(p,a);await m({sessionId:e,visitorId:n,formMessageId:t,action:"trialSessionBooking",fields:D})}catch(D){ne.error("[TrialSessionBookingForm] Submit failed:",D),V(d.magiclineFailedDetail),Q(!1)}}function Gt(){le?_t():mt()}const J=am(S,d),He=`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(tm,{formMessageId:t,trainerRequired:a.trainerRequired,disabled:L,onChange:c}):null,S==="slot"?s(nm,{slotsState:u,slotId:a.slotId,studioZoneId:b,disabled:L,retryPending:i,slotUnavailable:r,error:I.slotId,onSelect:se=>{l("slotId",se)},onRetry:h}):null,S==="personal"?s(rm,{plan:p,fields:a,errors:I,disabled:L,setField:l}):null,S==="address"?s(im,{plan:p,fields:a,errors:I,disabled:L,setField:l}):null,S==="confirm"?s(om,{consentId:He,privacyUrl:X,studioZoneId:b,fields:a,disabled:L,consentError:I.consent,setField:l}):null,ge!==null?s("div",{class:"jex-magicline-error",role:"alert",children:ge}):null,s("div",{class:"jex-magicline-wizard-nav",children:[pt?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:le?L?d.magiclineSubmitting:d.magiclineSubmit:d.magiclineWizardNext})]})]})]})}function tm({formMessageId:t,trainerRequired:e,disabled:n,onChange:r}){const i=E(),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 nm({slotsState:t,slotId:e,studioZoneId:n,disabled:r,retryPending:i,slotUnavailable:o,error:a,onSelect:l,onRetry:c}){const u=E();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:h=>{l(h.currentTarget.value)},children:[s("option",{value:"",disabled:!0,children:u.magiclineSlotPlaceholder}),t.slots.map(h=>s("option",{value:h.startDateTime,children:Ll(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 rm({plan:t,fields:e,errors:n,disabled:r,setField:i}){const o=E(),a=he(()=>El(),[]);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:Ve(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:Ve(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:Ve(o.magiclineBirthDate,t.dateOfBirth.required,o)}),s("input",{class:"jex-form-input",type:"date","aria-label":Ve(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(Ol,{label:Ve(o.magiclineGender,t.gender.required,o),value:e.gender,required:t.gender.required,disabled:r,placeholder:Ve(o.magiclineGenderPlaceholder,t.gender.required,o),error:n.gender,onChange:l=>{i("gender",l)},options:Ml.map(l=>({value:l,label:cm(l,o)}))}):null]})}function im({plan:t,fields:e,errors:n,disabled:r,setField:i}){const o=E();return s(Z,{children:[t.address.visible?s(Z,{children:[s("div",{class:"jex-magicline-row",children:[s(Mt,{label:Ve(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:Ve(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:Ve(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(Ol,{label:Ve(o.magiclineCountry,t.address.required,o),value:e.country,required:t.address.required,disabled:r,placeholder:Ve(o.magiclineCountryPlaceholder,t.address.required,o),error:n.country,onChange:a=>{i("country",a)},options:Gp.map(a=>({value:a.code,label:a.label}))})]}):null,t.zip.visible?s(Mt,{label:Ve(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 om({consentId:t,privacyUrl:e,studioZoneId:n,fields:r,disabled:i,consentError:o,setField:a}){const l=E(),c=r.slotId!==""?Ll(r.slotId,ct.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: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 Ol({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 Ve(t,e,n){return e?t:t+n.magiclineOptionalSuffix}function am(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 sm(t,e,n){return e.trim()!==""?e:t==="unsupported"?n.magiclineConfigUnsupported:t==="inconsistent"?n.magiclineConfigInconsistent:n.magiclineConfigUnavailable}function lm(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 cm(t,e){return t==="MALE"?e.magiclineGenderMale:t==="FEMALE"?e.magiclineGenderFemale:e.magiclineGenderUnisex}function Ll(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 um={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 dm(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 $l={draftVoucherCode:"",appliedVoucherCode:null,appliedVoucher:null,voucherStatus:"idle",voucherRequestId:0,voucherUnavailable:!1},hm="voucher:";function fm(t){const e={};for(const n of Object.keys(t))n.startsWith(hm)||(e[n]=t[n]);return e}function pm(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 mm(t,e){switch(e.type){case"dropVoucherAcks":{const n=fm(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 dm(t,e)}}function gm({sessionId:t,visitorId:e}){const n=Mp(),r=Al(),[i,o]=De(mm,um),[a,l]=De(pm,$l),[c,u]=De((T,C)=>C,{phase:"loading"}),h=qe(null),[m,d]=De((T,C)=>C,{phase:"idle"}),p=K(T=>{T.phase==="ready"?h.current=T.pricing:(T.phase==="idle"||T.phase==="error")&&(h.current=null),d(T)},[]),[x,k]=De(T=>T+1,0),[b,v]=De(T=>T+1,0),w=K(T=>{o({type:"setTermId",termId:T}),l({type:"CLEAR_VOUCHER"})},[]),R=K((T,C)=>{o({type:"setPersonal",key:T,value:C})},[]),y=K((T,C)=>{o({type:"setAddress",key:T,value:C})},[]),I=K((T,C,Qe)=>{o({type:"toggleModule",moduleId:T,selected:C,consentAckKey:Qe}),o({type:"dropVoucherAcks"}),l({type:"CLEAR_VOUCHER"})},[]),N=K((T,C)=>{o({type:"setBlockAck",ackKey:T,value:C})},[]),L=K(T=>{o({type:"setAccountHolder",value:T})},[]),Q=K(T=>{o({type:"setIban",value:T})},[]),ge=K((T,C)=>{o({type:"setConsent",key:T,value:C})},[]),V=K(()=>{o({type:"clearIban"})},[]),X=K(()=>{o({type:"clearTermId"}),l({type:"CLEAR_VOUCHER"})},[]),ae=K(T=>{l({type:"SET_VOUCHER_DRAFT",value:T}),o({type:"dropVoucherAcks"})},[]),S=qe($l.voucherRequestId),le=K(()=>{const T=S.current+1;return S.current=T,l({type:"VOUCHER_APPLYING"}),T},[]),pt=K(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}))},[]),et=K(()=>{l({type:"VOUCHER_INVALID"}),o({type:"dropVoucherAcks"}),v()},[]),mt=K(()=>{l({type:"VOUCHER_DISABLED"}),o({type:"dropVoucherAcks"}),v()},[]),Lt=K(()=>{l({type:"CLEAR_VOUCHER"}),o({type:"dropVoucherAcks"}),v()},[]),_t=K(()=>{k()},[]),Gt=K(()=>{p({phase:"idle"})},[]),J=K(()=>{v()},[]),He=c.phase==="ready"&&i.termId!==null?c.terms.find(T=>T.termId===i.termId)??null:null,{selectedModuleIds:se,acknowledgedBlocks:D}=i,{appliedVoucher:Le}=a,tt=he(()=>{if(He===null)return[];const T=new Set;for(const C of He.textBlocks)C.isConfirmationRequired&&T.add(C.ackKey);for(const C of se){const Qe=He.optionalModules.find(G=>G.id===C);Qe?.consent&&T.add(Qe.consent.ackKey)}if(Le!==null)for(const C of Le.textBlocks)T.add(C.ackKey);return[...T]},[He,se,Le]),Kt=he(()=>tt.every(T=>D[T]===!0),[tt,D]),{firstName:be,lastName:We}=i.personal,{accountHolder:Se,accountHolderTouched:Y}=i.payment;return M(()=>{Y||Se!==""||be.trim()!==""&&We.trim()!==""&&o({type:"prefillAccountHolder",value:`${be.trim()} ${We.trim()}`})},[be,We,Se,Y]),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=He;if(!T){p({phase:"error",code:"offer_unavailable"});return}let C=!1;const Qe=h.current;p(Qe!==null?{phase:"reloading",pricing:Qe}:{phase:"loading"});const G=T.defaultContractStartDate??"",jt={sessionId:t,visitorId:e,termId:T.termId,startDate:G,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:He,requiredAckKeys:tt,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:I,setBlockAck:N,setAccountHolder:L,setIban:Q,setConsent:ge,clearIban:V,clearTermId:X,refetchOffers:_t,fetchPreview:J,resetPreview:Gt,setVoucherDraft:ae,beginVoucherApply:le,commitVoucherApplied:pt,markVoucherInvalid:et,markVoucherDisabled:mt,clearVoucher:Lt}}function xm(t){return t!==null&&t.optionalModules.length>0?["offer","upgrades","personal","address","payment","review"]:["offer","personal","address","payment","review"]}function bm({formMessageId:t,sessionId:e,visitorId:n,projectId:r,formStatus:i}){const o=E(),a=ct.value,l=Op(),c=Al(),u=gm({sessionId:e,visitorId:n}),{fields:h,offersState:m,previewState:d,selectedTerm:p,requiredAckKeys:x,allAcknowledged:k,serverAllowVoucherCodes:b,voucherStatus:v,draftVoucherCode:w,appliedVoucher:R,appliedVoucherCode:y,voucherUnavailable:I,setTermId:N,setPersonal:L,setAddress:Q,toggleModule:ge,setBlockAck:V,setAccountHolder:X,setIban:ae,setConsent:S,clearIban:le,clearTermId:pt,refetchOffers:et,fetchPreview:mt,resetPreview:Lt,setVoucherDraft:_t,beginVoucherApply:Gt,commitVoucherApplied:J,markVoucherInvalid:He,markVoucherDisabled:se}=u,[D,Le]=q(0),[tt,Kt]=q({}),[be,We]=q(!1),[Se,Y]=q(null),[T,C]=q(null),[Qe,G]=q(null),jt=he(()=>Il(),[]);if(Se!==null&&Se.status==="succeeded")return s(Dl,{customerNumber:Se.customerNumber});if(Se!==null&&Se.status==="failed"&&!Se.retryable){const H=Se.errorCode==="duplicate_submission"?o.magiclineDuplicateNotice:Se.errorCode==="unknown_outcome"?o.magiclineUnknownOutcome:Se.errorCode==="live_submission_disabled"?o.magiclineLiveSubmissionDisabled:o.magiclineFailedDetail;return s(ql,{message:H})}if(Se===null&&!be&&i==="submitted")return s(Dl,{customerNumber:null});if(Se===null&&!be&&i==="failed")return s(ql,{message:o.magiclineFailedDetail});const ee=he(()=>xm(p),[p]),Ie=Math.min(D,ee.length-1),Ue=ee[Ie],yn=Ie===ee.length-1,Yr=Ie===0;function Jr(H){const $={};if(H==="offer")return h.termId===null&&($.termId=o.magiclineOfferRequiredError),$;if(H==="upgrades"){if(p!==null)for(const ce of h.selectedModuleIds){const nt=p.optionalModules.find(de=>de.id===ce);if(nt?.consent&&h.acknowledgedBlocks[nt.consent.ackKey]!==!0){$.upgrades=o.magiclineUpgradeConsentError;break}}return $}if(H==="personal"){const ce=h.personal;return ce.firstName.trim()===""&&($.firstName=o.magiclineRequiredError),ce.lastName.trim()===""&&($.lastName=o.magiclineRequiredError),ce.email.trim()===""?$.email=o.magiclineRequiredError:Rl(ce.email)||($.email=o.magiclineEmailError),ce.dateOfBirth.trim()===""&&($.dateOfBirth=o.magiclineRequiredError),ce.gender===""&&($.gender=o.magiclineRequiredError),ce.phone.trim()===""&&($.phone=o.magiclineRequiredError),$}if(H==="address"){const ce=h.address;return ce.street.trim()===""&&($.street=o.magiclineRequiredError),ce.houseNumber.trim()===""&&($.houseNumber=o.magiclineRequiredError),ce.zipCode.trim()===""&&($.zipCode=o.magiclineRequiredError),ce.city.trim()===""&&($.city=o.magiclineRequiredError),$}return H==="payment"&&(h.payment.accountHolder.trim()===""&&($.accountHolder=o.magiclineRequiredError),Up(h.payment.iban)||($.iban=o.magiclineIbanInvalidError),h.consents.privacy||($.privacy=o.magiclineConsentError),h.consents.sepa||($.sepa=o.magiclineConsentError)),$}function gt(){const H=Jr(Ue);if(Object.keys(H).length>0){Kt(H);return}Kt({}),C(null);const $=Math.min(Ie+1,ee.length-1);ee[$]==="review"&&mt(),Le($)}function Yt(){Kt({}),C(null),Ue==="review"&&Lt(),Le(H=>Math.max(H-1,0))}function St(){C(null),mt()}async function ar(){if(!be&&!(d.phase!=="ready"||p===null)){if(!k){C(o.magiclineConfirmRequiredError);return}We(!0),C(null);try{const H=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($=>h.selectedModuleIds.includes($.id)).map($=>$.id),acknowledgedAckKeys:x,pricingFingerprint:d.pricing.fingerprint,voucherCode:y??void 0});if(H.status==="succeeded"){Y(H);return}if(H.errorCode==="price_changed"){C(o.magiclinePriceChangedNotice),mt(),We(!1);return}if(H.errorCode==="offer_unavailable"){pt(),et(),Lt(),C(o.magiclineOfferUnavailableNotice),Le(0),We(!1);return}if(H.errorCode==="confirmation_required"){C(o.magiclineConfirmationRequiredNotice),We(!1);return}if(H.errorCode==="live_submission_disabled"){Y(H);return}if(!H.retryable){Y(H);return}le(),C(H.message!==""?H.message:o.magiclineFailedDetail),We(!1)}catch(H){ne.error("[ContractCreationForm] Submit failed:",H),le(),C(o.magiclineFailedDetail),We(!1)}}}async function sr(){if(d.phase!=="ready"||p===null||w.trim()==="")return;const H=w.trim(),$=Gt();G(null);const ce=de=>{He(),_t(""),G(de)},nt=o.magiclineVoucherInvalid.replace("{code}",H);try{const de=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($e=>h.selectedModuleIds.includes($e.id)).map($e=>$e.id),privacyConsent:h.consents.privacy,sepaConsent:h.consents.sepa,voucherCode:w.trim()});if(de.status==="ok"){const $e=de.voucher;if($e!==null){const Ge=$e.textBlocks.map(cr=>cr.ackKey);J({requestId:$,voucher:$e,appliedCode:w.trim(),voucherAckKeys:Ge,pricing:{basePrice:de.basePrice,preUseCharge:de.preUseCharge,currencyCode:de.currencyCode,flatFees:de.flatFees,modules:de.modules,contractVolume:de.contractVolume,startDate:de.startDate,paymentFrequency:de.paymentFrequency,fingerprint:de.pricingFingerprint}})}else ce(nt)}else de.status==="voucher_invalid"?ce(nt):de.status==="voucher_disabled"?(se(),_t(""),G(o.magiclineVoucherDisabled)):ce(nt)}catch{ce(nt)}}function lr(){yn?ar():gt()}const vn=Im(Ue,o),$t=v==="applying"||w.trim()!==""&&w.trim()!==(y??""),wn=Ue==="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((H,$)=>s("span",{class:$===Ie?"jex-magicline-wizard-dot jex-magicline-wizard-dot-active":"jex-magicline-wizard-dot"},H))})]}),s("div",{class:"jex-form",role:"group","aria-label":vn,children:[Ue==="offer"?s(ym,{offersState:m,selectedTermId:h.termId,widgetLocale:a,disabled:be,error:tt.termId,onSelect:N,onRetry:et}):null,Ue==="upgrades"&&p!==null?s(km,{modules:p.optionalModules,selectedModuleIds:h.selectedModuleIds,acknowledgedBlocks:h.acknowledgedBlocks,widgetLocale:a,disabled:be,error:tt.upgrades,onToggle:ge,onAck:V}):null,Ue==="personal"?s(jm,{personal:h.personal,errors:tt,disabled:be,setPersonal:L}):null,Ue==="address"?s(Sm,{address:h.address,errors:tt,disabled:be,setAddress:Q}):null,Ue==="payment"?s(Tm,{formMessageId:t,fields:h,errors:tt,privacyUrl:jt,disabled:be,setAccountHolder:X,setIban:ae,setConsent:S}):null,Ue==="review"?s(Cm,{fields:h,term:p,previewState:d,widgetLocale:a,disabled:be,acknowledgedBlocks:h.acknowledgedBlocks,onToggleAck:V,onRetry:St,allowVoucherCodes:b,voucherUnavailable:I,voucherStatus:v,draftVoucherCode:w,appliedVoucher:R,voucherBanner:Qe,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 Dl({customerNumber:t}){const e=E();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 ql({message:t}){const e=E();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 ym({offersState:t,selectedTermId:e,widgetLocale:n,disabled:r,error:i,onSelect:o,onRetry:a}){const l=E();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=Em(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(h=>s(vm,{term:h,checked:e===h.termId,widgetLocale:n,disabled:r,onSelect:o},h.termId)),s(wm,{subDescription:u.bundleSubDescription,footnote:u.footnote})]},u.bundleId))}),i!==void 0?s("div",{class:"jex-magicline-error",role:"alert",children:i}):null]})}function vm({term:t,checked:e,widgetLocale:n,disabled:r,onSelect:i}){const o=E(),a=Gr(t.termValue,t.termUnit,n),l=Xe(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," ",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,":"," ",Xe(c.price,t.currencyCode,n)]}):null,u.map(h=>s("span",{class:"jex-magicline-offer-term-note",children:[Nl(h.name,o),": ",Xe(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 wm({subDescription:t,footnote:e}){const n=E(),r=Rm(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 km({modules:t,selectedModuleIds:e,acknowledgedBlocks:n,widgetLocale:r,disabled:i,error:o,onToggle:a,onAck:l}){const c=E();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(_m,{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 _m({module:t,selected:e,consentChecked:n,widgetLocale:r,disabled:i,onToggle:o,onAck:a}){const l=E(),c=Vp(t.price,t.currencyCode,t.paymentFrequencyType,t.recurringUnit,r),u=Qp(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(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 jm({personal:t,errors:e,disabled:n,setPersonal:r}){const i=E(),o=he(()=>El(),[]);return s(Z,{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(Am,{label:i.magiclineGender,value:t.gender,required:!0,disabled:n,placeholder:i.magiclineGenderPlaceholder,error:e.gender,onChange:a=>{r("gender",a)},options:Ml.map(a=>({value:a,label:Pm(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 Sm({address:t,errors:e,disabled:n,setAddress:r}){const i=E();return s(Z,{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 Tm({formMessageId:t,fields:e,errors:n,privacyUrl:r,disabled:i,setAccountHolder:o,setIban:a,setConsent:l}){const c=E(),u=`jex-ml-privacy-${t}`,h=`jex-ml-sepa-${t}`;return s(Z,{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 Cm({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:x,onApplyVoucher:k}){const b=E();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(),I=t.address,N=[`${I.street} ${I.houseNumber}`.trim(),`${I.zipCode} ${I.city}`.trim(),b.magiclineCountryStatic].filter(S=>S!=="").join(", "),L=e!==null?`${e.bundleName} · ${Gr(e.termValue,e.termUnit,r)}`:"—",Q=e!==null?e.textBlocks.filter(S=>S.isConfirmationRequired):[],ge=e!==null?e.textBlocks.filter(S=>!S.isConfirmationRequired):[],V=e!==null?e.optionalModules.filter(S=>t.selectedModuleIds.includes(S.id)&&S.consent!==null).map(S=>({module:S,consent:S.consent})):[],X=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"?Xe(d.discountedBasePrice,v.currencyCode,r):Xe(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}",Hp(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,le)=>s("div",{class:"jex-magicline-summary-row",children:[s("dt",{children:Nl(S.name,b)}),s("dd",{children:Xe(S.price,v.currencyCode,r)})]},`${S.name}-${le}`)),v.preUseCharge>0?s("div",{class:"jex-magicline-summary-row",children:[s("dt",{children:b.magiclineReviewPreUseCharge}),s("dd",{children:Xe(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,le)=>s("div",{class:"jex-magicline-summary-row",children:[s("dt",{children:S.name}),s("dd",{children:Xe(S.amount,S.currencyCode,r)})]},`${S.moduleId}-${le}`))]}):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:Xe(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:Fp(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:Bp(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||h==="applying",onInput:S=>{x(S.currentTarget.value)}}),s("button",{type:"button",class:"jex-magicline-voucher-apply",disabled:i||h==="applying"||m.trim()==="",onClick:k,children:b.magiclineVoucherApply})]}),p!==null?s("div",{class:"jex-magicline-error",role:"alert",children:p}):null]}):null,V.length>0?s("div",{class:"jex-magicline-terms",role:"group","aria-label":b.magiclineReviewSelectedUpgrades,children:[s("div",{class:"jex-magicline-upgrades-recap-title",children:b.magiclineReviewSelectedUpgrades}),V.map(({module:S,consent:le})=>s(zl,{title:le.title!==""?le.title:S.name,text:le.text,attachmentLabel:le.attachmentLabel,attachmentUrl:le.attachmentUrl},le.ackKey))]}):null,Q.length>0||ge.length>0||X.length>0?s("div",{class:"jex-magicline-terms",role:"group","aria-label":b.magiclineReviewTerms,children:[Q.length>0||X.length>0?s("div",{class:"jex-magicline-terms-prompt",children:[b.magiclineConfirmPrompt,s("span",{class:"jex-magicline-required-pill",children:b.magiclineRequired})]}):null,Q.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)),X.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)),ge.map((S,le)=>s(zl,{title:S.title,text:S.text,attachmentLabel:S.attachmentLabel,attachmentUrl:S.attachmentUrl},`${S.title}-${le}`))]}):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=E(),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(Z,{children:[" ",s("a",{href:i,target:"_blank",rel:"noopener noreferrer",class:"jex-privacy-notice-link",children:r!==null&&r!==""?r:i})]}):null]})]})]})]})}function zl({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 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 Am({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 Rm(t){return t===null?[]:t.split(`
|
|
78
|
+
`).map(e=>e.replace(/^\s*[-•]\s*/,"").trim()).filter(e=>e!=="")}function Em(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 Im(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 Pm(t,e){return t==="MALE"?e.magiclineGenderMale:t==="FEMALE"?e.magiclineGenderFemale:e.magiclineGenderUnisex}function Nm({message:t,sessionId:e,visitorId:n}){const r=E(),i=t.magiclineForm,o=!!i&&i.status==="open"&&!!i.submissionId,a=Tr(Ce.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(bm,{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(Xp,{formMessageId:t._id,sessionId:e,visitorId:n,slotUnavailable:l,retryPending:c})}const Mm={crawl:"🌐",file:"📄",snippet:"💡",qa:"❓"};function Om({sources:t}){const e=E(),[n,r]=q(!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=Lm(i),c=a&&i.url?`${i.title}
|
|
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:Mm[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 Lm(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 $m(){return s("div",{class:"jex-typing",children:[s("span",{}),s("span",{}),s("span",{})]})}const Dm=/\s?\[\d+\]/g;function Kr(t){return t.replace(Dm,"")}function qm(t){return t?.at(-1)?._creationTime??0}function zm(t){return{id:t._id,content:Kr(t.content),role:t.role,authorName:t.authorName}}function Ul(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(zm)}function Bl(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 Um(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 Bm({conversations:t,greeting:e,botName:n,starterQuestions:r,onPickStarter:i,sessionNotFound:o,resumeFailed:a,onStartFresh:l,sessionId:c,visitorId:u}){const h=E(),m=qe(null),[d,p]=q(null),x=qm(t),k=Um(t),b=Cl(),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(Tp,{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(y=>{if(y.contentType==="human-notice"){const L=y.noticeKind==="agent-joined"?h.noticeAgentJoined.replace("{name}",y.noticeData?.agentName??""):y.noticeKind==="human-requested"?h.noticeHumanRequested:y.noticeKind==="human-requested-form"?h.noticeHumanRequestedForm:y.noticeKind==="message-received"?h.noticeMessageReceived:y.noticeKind==="agent-handling"?h.noticeAgentHandling:y.noticeKind==="ai-resumed"?h.noticeAiResumed:y.content;return s(bn,{text:L,botName:n},y._id)}if(y.contentType==="escalation-form"&&c&&u)return ah.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: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:y._id,sessionId:c,visitorId:u,waitingSetAt:x})},children:h.escalationPromptSubmit}),s("button",{class:"jex-escalation-skip",type:"button",onClick:()=>{b({formMessageId:y._id,sessionId:c,visitorId:u,waitingSetAt:x}),p(y._id)},children:h.escalationSkip})]},y._id):s(Rp,{message:y,sessionId:c,visitorId:u,waitingSetAt:x},y._id);if(y.contentType==="magicline-form"&&c&&u)return s(Nm,{message:y,sessionId:c,visitorId:u},y._id);if(y.contentType==="escalation-confirm"){const L=y.noticeKind==="escalation-confirmed"?h.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=Ul(y,t);return s(Ap,{id:`jex-msg-${y._id}`,text:y.content,botName:n,onQuote:()=>{Ji({id:y._id,content:y.content,role:"user"})},quoted:L,onQuotedClick:(Q,ge)=>{Bl(Q,ge.currentTarget)},agentNames:k},y._id)}const I={authorId:y.authorId,authorName:y.authorName,authorImage:y.authorImage};if(y.status==="streaming"&&y.content==="")return s($m,{},y._id);if(y.status==="streaming")return s(bn,{id:`jex-msg-${y._id}`,text:Kr(y.content),streaming:!0,botName:n,...I},y._id);if(y.status==="error")return s(bn,{id:`jex-msg-${y._id}`,text:y.errorMessage??`${h.somethingWentWrong}. ${h.tryAgain}.`,error:!0,botName:n,...I},y._id);const N=Ul(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,Q)=>{Bl(L,Q.currentTarget)},...I}),y.sources&&y.sources.length>0?s(Om,{sources:y.sources}):null]},y._id)}),s("div",{ref:m})]})}function Fm(){const t=E();function e(){const n=Yn.peek();n&&(Ds(),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 Fl({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 Vm({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 Hm(t){const e=E(),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 Wm({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 Qm(){return Bt(Ce.functions.chat.public.helpdesk.createEscalationRequest)}function Vl({sessionId:t,visitorId:e,ensureSession:n,onSkipForm:r}){const i=E(),o=Qm(),[a,l]=q(!1),[c,u]=q(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=Rt.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 Gm({greeting:t,botName:e,starterQuestions:n,sessionId:r,visitorId:i,isLoading:o,sessionNotFound:a,resumeFailed:l,isOrgDeleted:c,ensureSession:u,startFresh:h}){const m=E(),{conversations:d,sessionStatus:p,isLoading:x,isStreaming:k}=Vm({sessionId:r,visitorId:i});Hm(d),Wm({sessionId:r,visitorId:i}),M(()=>{const I=Yn.peek();if(I===null||!d||d.length===0)return;const{waitingSetAt:N}=I;d.some(Q=>Q._creationTime>N&&(Q.noticeKind==="agent-joined"||!!Q.authorId))&&Ds()},[d]);const b=$s({sessionId:r,visitorId:i,ensureSession:u}),v=qe((()=>{const I=un.peek();return I!==null?I:Vi.peek()&&ze.peek()!==null?"resume":"fresh"})()).current,{requestHuman:w,error:R}=Vl({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(Fl,{message:m.resumeConversation}):s(Z,{children:[s(Bm,{conversations:d,greeting:t,botName:e,starterQuestions:n,onPickStarter:I=>{b(I)},sessionNotFound:a,resumeFailed:l,onStartFresh:h,sessionId:r,visitorId:i}),Yn.value!==null&&s(Fm,{}),R&&s("div",{class:"jex-session-error-notice",role:"alert",style:{margin:"8px 16px 0"},children:R}),s(Kh,{sessionId:r,visitorId:i,isLoading:o,isStreaming:k,sessionStatus:p,ensureSession:u,onStartFresh:h})]})}function Hl(t){return Tr(Ce.functions.chat.public.availability.getOrgAvailability,t?{orgSlug:t}:"skip")}function Wl(t){return t?.anyOnline?"online":t?.anyAway?"away":"offline"}function Km({formMessageId:t,sessionId:e,visitorId:n,orgSlug:r}){const i=E(),o=Vn.value,a=/^https?:\/\//i.test(o)?o:Fn,[l,c]=q(""),[u,h]=q(""),m=Hl(r),d=m&&!m.anyOnline?i.escalationOfflineSubtitle:i.escalationSubtitle,p=Tl(),[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:ct.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=>{h(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 Ql({sessionId:t,visitorId:e,ensureSession:n,availability:r}){const i=E(),{requestHuman:o,busy:a,error:l}=Vl({sessionId:t,visitorId:e,ensureSession:n}),c=`jex-presence-dot--${Wl(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 Ym(){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 Gl(t){return Kl(t)?"unauthorized":t instanceof Error&&/network|fetch|failed to fetch/i.test(t.message)?"network":"unknown"}function Kl(t){return t instanceof yr?t.data?.code==="UNAUTHORIZED_ORIGIN":!1}function Jm(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 Zm(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 Jm();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:ct.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(!Kl(w))throw w;const R=await Ym();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=K(async()=>{if(n.current)return n.current;if(o.value)return null;r.value=!0;const p=ze.value!==null,x=ze.value??ys();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=Gl(k),null}finally{r.value=!1}},[t,e,l,r,i,o]),h=K(()=>{n.current=null,i.value=!1,o.value=!1,Ms(),hn.value=null},[i,o]);M(()=>lh(h),[h]);const m=K(async()=>{n.current=null,o.value=!1,i.value=!1,Ms(),hn.value=null;const p=ys();r.value=!0;try{return(await c(p))?.session??null}catch(x){return ne.error("[JexityChat] Failed to create fresh session:",x),fn.value=Gl(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:h}}function Xm({botName:t,availability:e,onResetSession:n}){const r=E(),[i,o]=q(""),a=e?.anyOnline===!0,l=Wl(e);function c(){Lr(),un.value="escalate",n(),vs(),wt({id:"chat"})}function u(){Lr(),un.value="fresh",n(),vs(),wt({id:"chat"})}function h(d){Lr(),un.value="resume",n(),ws(d),wt({id:"chat"})}function m(d){d.preventDefault();const p=i.trim().toUpperCase();p&&(Lr(),un.value="resume",n(),ws(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(Cs,{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:()=>{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: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 eg({title:t}){const e=E();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 tg(){const t=E(),[e,n]=q(""),[r,i]=q(""),[o,a]=q("");async function l(c){c.preventDefault(),Qi({id:"loading",message:t.submittingTicket}),await new Promise(h=>{setTimeout(h,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 ng({ticketRef:t}){const e=E();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 rg({message:t,onRetry:e,onBack:n}){const r=E();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 Yl({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: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(Xm,{botName:r,availability:o,onResetSession:x}),b.id==="selection"&&s(eg,{title:n}),b.id==="form"&&s(tg,{}),b.id==="escalation-form"&&s(Km,{formMessageId:b.formMessageId,sessionId:b.sessionId,visitorId:b.visitorId,orgSlug:i,waitingSetAt:b.waitingSetAt}),b.id==="confirmation"&&v&&s(ng,{ticketRef:v.ref}),b.id==="chat"&&s(Gm,{greeting:t,botName:r,starterQuestions:e,sessionId:a,visitorId:l,isLoading:c,sessionNotFound:u,resumeFailed:h,isOrgDeleted:m,ensureSession:d,startFresh:p}),b.id==="loading"&&s(Fl,{message:b.message}),b.id==="error"&&s(rg,{message:b.message,onRetry:()=>Qi({id:"loading"}),onBack:Wi})]})}function ig({options:t}){return Bd({orgSlug:t.orgSlug,projSlug:t.projSlug,preToken:t.bootstrapToken,convexUrl:t.convexUrl,preAllowedUrls:t.allowedUrls??[],preExcludedPaths:t.excludePaths}),Hd()?s(og,{options:t}):null}function og({options:t}){const e=zd(t.orgSlug,t.projSlug,t.convexUrl);Yd(t.parentOrigin),M(()=>(rh(),oh(),()=>{Fi.value=!1}),[]);const{sessionId:n,visitorId:r,isLoading:i,sessionNotFound:o,resumeFailed:a,isOrgDeleted:l,ensureSession:c,startFresh:u,resetSession:h}=Zm(t.orgSlug,t.projSlug),m=Hl(t.orgSlug),d=Ld(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(()=>{ct.value=ps(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 ae=document.documentElement.style.overflow;return document.documentElement.style.overflow="hidden",()=>{document.documentElement.style.overflow=ae}},[oe.value,d.mode]),M(()=>{if(x&&k&&d.mode!=="embedded"&&b!==null)try{return uh(b)}catch(X){ne.warn("[JexityChat] Idle-lock watcher failed to start:",X);return}},[x,d.mode,k,b]),M(()=>{if(!x||!k)return;const{activeRefPruned:X}=ih(b);X&&Yi()},[x,k,b]);const v=d.position==="bottom-left",w=d.colorScheme==="dark"||d.colorScheme==="light"?d.colorScheme:"",R=dh({...t,primaryColor:d.primaryColor,accentColor:d.accentColor,fontFamily:d.fontFamily,fontSize:d.fontSize,borderRadius:d.borderRadius,windowWidth:d.windowWidth,windowHeight:d.windowHeight}),y=d.mode==="embedded",I=Oe.value,L=I[I.length-1]?.id==="chat",Q=e.config!==null||y||!!t.parentOrigin,ge=Q?R:{...R,visibility:"hidden"},V=wh(t.orgSlug,t.projSlug);return M(()=>{if(y||!Q||d.proactiveMode==="off"||As(V))return;const X=window.setTimeout(()=>{const ae=_h({mode:d.proactiveMode,isOpen:oe.peek(),hasHistory:Vi.peek(),dismissed:As(V)});ae==="teaser"?Dr.value=!0:ae==="open"&&(oe.value=!0)},d.proactiveDelaySeconds*1e3);return()=>{window.clearTimeout(X)}},[y,Q,d.proactiveMode,d.proactiveDelaySeconds,V]),s("div",{class:`jex-widget ${w}`.trim(),style:ge,children:y?s("div",{class:"jex-embedded",children:[s(Ss,{title:d.title,rightAction:L?s(Ql,{sessionId:n,visitorId:r,ensureSession:c,availability:m}):null,showClose:!y}),s(Yl,{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:h}),!d.hideBranding&&s(Ts,{})]}):s("div",{class:`jex-container${v?" jex-pos-left":""}`,children:[oe.value&&s("div",{class:"jex-chat-window",children:[s(Ss,{title:d.title,rightAction:L?s(Ql,{sessionId:n,visitorId:r,ensureSession:c,availability:m}):null}),s(Yl,{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:h}),!d.hideBranding&&s(Ts,{})]}),Dr.value&&!oe.value&&s(jh,{title:d.title,message:d.greeting,guardKey:V}),s(vh,{iconOption:d.triggerIcon,radius:d.triggerRadius,label:d.triggerLabel})]})})}const ag=`.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:24px;right:24px;display:flex;flex-direction:column;align-items:flex-end;gap:16px;z-index:9999}.jex-container.jex-pos-left{right:auto;left: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)}}@media(max-width:480px),(pointer:coarse)and (max-width:768px){.jex-chat-window{position:fixed;inset:0;width:100vw;height:100vh;height:100dvh;max-height:none;border:none;border-radius:0;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 sg(t){const e=document.createElement("style");e.textContent=ag,t.appendChild(e)}const lg="https://festive-mouse-978.eu-west-1.convex.cloud";let wo=null;function cg(t){const e=t??lg;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 xd(Md(e))),wo}function ug(t,e){const n=t.shadowRoot??t.attachShadow({mode:"open"});for(;n.firstChild;)n.removeChild(n.firstChild);sg(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(yd,{client:cg(e.convexUrl),children:s(ig,{options:e})}),r),function(){qt(null,r),oe.value=!1,Mr.value=void 0,Rt.value=void 0,Oe.value=[{id:"home"}]}}function dg(t,e,n){const r=ug(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 hg(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=dg(e,t,()=>{t.container||e.remove(),or===n&&(or=null)});return or=n,n}function Ot(t,e){return t.getAttribute(e)??void 0}async function Jl(){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")};window.JexityChat=hg(a)}document.readyState==="complete"?Jl():window.addEventListener("load",Jl)})();
|
|
78
80
|
//# sourceMappingURL=widget.js.map
|