1var sn=Object.defineProperty;var an=(e,t,r)=>t in e?sn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var mt=(e,t,r)=>an(e,typeof t!="symbol"?t+"":t,r);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const l of s.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&n(l)}).observe(document,{childList:!0,subtree:!0});function r(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(i){if(i.ep)return;i.ep=!0;const s=r(i);fetch(i.href,s)}})();var it,Y,fr,ze,Uo,_r,gr,Dt,xt,rt,yr,ao,Zt,Qt,mr,St={},Pt=[],ln=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,st=Array.isArray;function Ie(e,t){for(var r in t)e[r]=t[r];return e}function lo(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Re(e,t,r){var n,i,s,l={};for(s in t)s=="key"?n=t[s]:s=="ref"?i=t[s]:l[s]=t[s];if(arguments.length>2&&(l.children=arguments.length>3?it.call(arguments,2):r),typeof e=="function"&&e.defaultProps!=null)for(s in e.defaultProps)l[s]===void 0&&(l[s]=e.defaultProps[s]);return nt(e,l,n,i,null)}function nt(e,t,r,n,i){var s={type:e,props:t,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++fr,__i:-1,__u:0};return i==null&&Y.vnode!=null&&Y.vnode(s),s}function cn(){return{current:null}}function te(e){return e.children}function Oe(e,t){this.props=e,this.context=t}function Fe(e,t){if(t==null)return e.__?Fe(e.__,e.__i+1):null;for(var r;t<e.__k.length;t++)if((r=e.__k[t])!=null&&r.__e!=null)return r.__e;return typeof e.type=="function"?Fe(e):null}function dn(e){if(e.__P&&e.__d){var t=e.__v,r=t.__e,n=[],i=[],s=Ie({},t);s.__v=t.__v+1,Y.vnode&&Y.vnode(s),co(e.__P,s,t,e.__n,e.__P.namespaceURI,32&t.__u?[r]:null,n,r??Fe(t),!!(32&t.__u),i),s.__v=t.__v,s.__.__k[s.__i]=s,kr(n,s,i),t.__e=t.__=null,s.__e!=r&&vr(s)}}function vr(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),vr(e)}function eo(e){(!e.__d&&(e.__d=!0)&&ze.push(e)&&!Tt.__r++||Uo!=Y.debounceRendering)&&((Uo=Y.debounceRendering)||_r)(Tt)}function Tt(){try{for(var e,t=1;ze.length;)ze.length>t&&ze.sort(gr),e=ze.shift(),t=ze.length,dn(e)}finally{ze.length=Tt.__r=0}}function br(e,t,r,n,i,s,l,d,_,g,k){var b,h,x,c,P,M,B=n&&n.__k||Pt,D=t.length;for(_=un(r,t,B,_,D),b=0;b<D;b++)(x=r.__k[b])!=null&&(h=x.__i!=-1&&B[x.__i]||St,x.__i=b,M=co(e,x,h,i,s,l,d,_,g,k),c=x.__e,x.ref&&h.ref!=x.ref&&(h.ref&&uo(h.ref,null,x),k.push(x.ref,x.__c||c,x)),P==null&&c!=null&&(P=c),4&x.__u?(_=wr(x,_,e),h.__e&&(h.__e=null)):typeof x.type=="function"&&M!==void 0?_=M:c&&(_=c.nextSibling),x.__u&=-7);return r.__e=P,_}function un(e,t,r,n,i){var s,l,d,_,g,k=r.length,b=k,h=0;for(e.__k=new Array(i),s=0;s<i;s++)(l=t[s])!=null&&typeof l!="boolean"&&typeof l!="function"?(typeof l=="string"||typeof l=="number"||typeof l=="bigint"||l.constructor==String?l=e.__k[s]=nt(null,l,null,null,null):st(l)?l=e.__k[s]=nt(te,{children:l},null,null,null):l.constructor===void 0&&l.__b>0?l=e.__k[s]=nt(l.type,l.props,l.key,l.ref?l.ref:null,l.__v):e.__k[s]=l,_=s+h,l.__=e,l.__b=e.__b+1,d=null,(g=l.__i=pn(l,r,_,b))!=-1&&(b--,(d=r[g])&&(d.__u|=2)),d==null||d.__v==null?(g==-1&&(i>k?h--:i<k&&h++),typeof l.type!="function"&&(l.__u|=4)):g!=_&&(g==_-1?h--:g==_+1?h++:(g>_?h--:h++,l.__u|=4))):e.__k[s]=null;if(b)for(s=0;s<k;s++)(d=r[s])!=null&&!(2&d.__u)&&(d.__e==n&&(n=Fe(d)),Sr(d,d));return n}function wr(e,t,r){var n,i;if(typeof e.type=="function"){for(n=e.__k,i=0;n&&i<n.length;i++)n[i]&&(n[i].__=e,t=wr(n[i],t,r));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Fe(e)),t=r.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Ae(e,t){return t=t||[],e==null||typeof e=="boolean"||(st(e)?e.some(function(r){Ae(r,t)}):t.push(e)),t}
vendor: 2,005 bytes, line 1
1function pn(e,t,r,n){var i,s,l,d=e.key,_=e.type,g=t[r],k=g!=null&&(2&g.__u)==0;if(g===null&&d==null||k&&d==g.key&&_==g.type)return r;if(n>(k?1:0)){for(i=r-1,s=r+1;i>=0||s<t.length;)if((g=t[l=i>=0?i--:s++])!=null&&!(2&g.__u)&&d==g.key&&_==g.type)return l}return-1}function Do(e,t,r){t[0]=="-"?e.setProperty(t,r??""):e[t]=r==null?"":typeof r!="number"||ln.test(t)?r:r+"px"}function vt(e,t,r,n,i){var s,l;e:if(t=="style")if(typeof r=="string")e.style.cssText=r;else{if(typeof n=="string"&&(e.style.cssText=n=""),n)for(t in n)r&&t in r||Do(e.style,t,"");if(r)for(t in r)n&&r[t]==n[t]||Do(e.style,t,r[t])}else if(t[0]=="o"&&t[1]=="n")s=t!=(t=t.replace(yr,"$1")),l=t.toLowerCase(),t=l in e||t=="onFocusOut"||t=="onFocusIn"?l.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+s]=r,r?n?r[rt]=n[rt]:(r[rt]=ao,e.addEventListener(t,s?Qt:Zt,s)):e.removeEventListener(t,s?Qt:Zt,s);else{if(i=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=r??"";break e}catch{}typeof r=="function"||(r==null||r===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&r==1?"":r))}}function Fo(e){return function(t){if(this.l){var r=this.l[t.type+e];if(t[xt]==null)t[xt]=ao++;else if(t[xt]<r[rt])return;return r(Y.event?Y.event(t):t)}}}function co(e,t,r,n,i,s,l,d,_,g){var k,b,h,x,c,P,M,B,D,q,V,W,A,a,T,w,L=t.type;if(t.constructor!==void 0)return null;128&r.__u&&(_=!!(32&r.__u),s=[d=t.__e=r.__e]),(k=Y.__b)&&k(t);e:if(typeof L=="function"){b=l.length;try{if(D=t.props,q=L.prototype&&L.prototype.render,V=(k=L.contextType)&&n[k.__c],W=k?V?V.props.value:k.__:n,r.__c?B=(h=t.__c=r.__c).__=h.__E:(q?t.__c=h=new L(D,W):(t.__c=h=new Oe(D,W),h.constructor=L,h.render=fn),V&&V.sub(h),h.state||(h.state={}),h.__n=n,x=h.__d=!0,h.__h=[],h._sb=[]),q&&h.__s==null&&(h.__s=h.state),q&&L.getDerivedStateFromProps!=null&&(h.__s==h.state&&(h.__s=Ie({}
vendor: 6,085 bytes, line 1
1,h.__s)),Ie(h.__s,L.getDerivedStateFromProps(D,h.__s))),c=h.props,P=h.state,h.__v=t,x)q&&L.getDerivedStateFromProps==null&&h.componentWillMount!=null&&h.componentWillMount(),q&&h.componentDidMount!=null&&h.__h.push(h.componentDidMount);else{if(q&&L.getDerivedStateFromProps==null&&D!==c&&h.componentWillReceiveProps!=null&&h.componentWillReceiveProps(D,W),t.__v==r.__v||!h.__e&&h.shouldComponentUpdate!=null&&h.shouldComponentUpdate(D,h.__s,W)===!1){t.__v!=r.__v&&(h.props=D,h.state=h.__s,h.__d=!1),t.__e=r.__e,t.__k=r.__k,t.__k.some(function(j){j&&(j.__=t)}),Pt.push.apply(h.__h,h._sb),h._sb=[],h.__h.length&&l.push(h),d=Fe(r);break e}h.componentWillUpdate!=null&&h.componentWillUpdate(D,h.__s,W),q&&h.componentDidUpdate!=null&&h.__h.push(function(){h.componentDidUpdate(c,P,M)})}if(h.context=W,h.props=D,h.__P=e,h.__e=!1,A=Y.__r,a=0,q)h.state=h.__s,h.__d=!1,A&&A(t),k=h.render(h.props,h.state,h.context),Pt.push.apply(h.__h,h._sb),h._sb=[];else do h.__d=!1,A&&A(t),k=h.render(h.props,h.state,h.context),h.state=h.__s;while(h.__d&&++a<25);h.state=h.__s,h.getChildContext!=null&&(n=Ie(Ie({},n),h.getChildContext())),q&&!x&&h.getSnapshotBeforeUpdate!=null&&(M=h.getSnapshotBeforeUpdate(c,P)),T=k!=null&&k.type===te&&k.key==null?Cr(k.props.children):k,d=br(e,st(T)?T:[T],t,r,n,i,s,l,d,_,g),h.base=t.__e,t.__u&=-161,h.__h.length&&l.push(h),B&&(h.__E=h.__=null)}catch(j){if(l.length=b,t.__v=null,_||s!=null){if(j.then){for(t.__u|=_?160:128;d&&d.nodeType==8&&d.nextSibling;)d=d.nextSibling;s!=null&&(s[s.indexOf(d)]=null),t.__e=d}else if(s!=null)for(w=s.length;w--;)lo(s[w])}else t.__e=r.__e;t.__k==null&&(t.__k=r.__k||[]),j.then||xr(t),Y.__e(j,t,r)}}else s==null&&t.__v==r.__v?(t.__k=r.__k,t.__e=r.__e):d=t.__e=hn(r.__e,t,r,n,i,s,l,_,g);return(k=Y.diffed)&&k(t),128&t.__u?void 0:d}function xr(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(xr))}function kr(e,t,r){for(var n=0;n<r.length;n++)uo(r[n],r[++n],r[++n]);Y.__c&&Y.__c(t,e),e.some(function(i){try{e=i.__h,i.__h=[],e.some(function(s){s.call(i)})}catch(s){Y.__e(s,i.__v)}})}function Cr(e){return typeof e!="object"||e==null||e.__b>0?e:st(e)?e.map(Cr):e.constructor!==void 0?null:Ie({},e)}function hn(e,t,r,n,i,s,l,d,_){var g,k,b,h,x,c,P,M=r.props||St,B=t.props,D=t.type;if(D=="svg"?i="http://www.w3.org/2000/svg":D=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),s!=null){for(g=0;g<s.length;g++)if((x=s[g])&&"setAttribute"in x==!!D&&(D?x.localName==D:x.nodeType==3)){e=x,s[g]=null;break}}if(e==null){if(D==null)return document.createTextNode(B);e=document.createElementNS(i,D,B.is&&B),d&&(Y.__m&&Y.__m(t,s),d=!1),s=null}if(D==null)M===B||d&&e.data==B||(e.data=B);else{if(s=D=="textarea"&&B.defaultValue!=null?null:s&&it.call(e.childNodes),!d&&s!=null)for(M={},g=0;g<e.attributes.length;g++)M[(x=e.attributes[g]).name]=x.value;for(g in M)x=M[g],g=="dangerouslySetInnerHTML"?b=x:g=="children"||g in B||g=="value"&&"defaultValue"in B||g=="checked"&&"defaultChecked"in B||vt(e,g,null,x,i);for(g in B)x=B[g],g=="children"?h=x:g=="dangerouslySetInnerHTML"?k=x:g=="value"?c=x:g=="checked"?P=x:d&&typeof x!="function"||M[g]===x||vt(e,g,x,M[g],i);if(k)d||b&&(k.__html==b.__html||k.__html==e.innerHTML)||(e.innerHTML=k.__html),t.__k=[];else if(b&&(e.innerHTML=""),br(t.type=="template"?e.content:e,st(h)?h:[h],t,r,n,D=="foreignObject"?"http://www.w3.org/1999/xhtml":i,s,l,s?s[0]:r.__k&&Fe(r,0),d,_),s!=null)for(g=s.length;g--;)lo(s[g]);d&&D!="textarea"||(g="value",D=="progress"&&c==null?e.removeAttribute("value"):c!=null&&(c!==e[g]||D=="progress"&&!c||D=="option"&&c!=M[g])&&vt(e,g,c,M[g],i),g="checked",P!=null&&P!=e[g]&&vt(e,g,P,M[g],i))}return e}function uo(e,t,r){try{if(typeof e=="function"){var n=typeof e.__u=="function";n&&e.__u(),n&&t==null||(e.__u=e(t))}else e.current=t}catch(i){Y.__e(i,r)}}function Sr(e,t,r){var n,i;if(Y.unmount&&Y.unmount(e),(n=e.ref)&&(n.current&&n.current!=e.__e||uo(n,null,t)),(n=e.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(s){Y.__e(s,t)}n.base=n.__P=n.__n=null}if(n=e.__k)for(i=0;i<n.length;i++)n[i]&&Sr(n[i],t,r||typeof e.type!="function");r||lo(e.__e),e.__c=e.__=e.__e=void 0}function fn(e,t,r){return this.constructor(e,r)}function Ke(e,t,r){var n,i,s,l;t==document&&(t=document.documentElement),Y.__&&Y.__(e,t),i=(n=typeof r=="function")?null:r&&r.__k||t.__k,s=[],l=[],co(t,e=(!n&&r||t).__k=Re(te,null,[e]),i||St,St,t.namespaceURI,!n&&r?[r]:i?null:t.firstChild?it.call(t.childNodes):null,s,!n&&r?r:i?i.__e:t.firstChild,n,l),kr(s,e,l),e.props.children=null}function Pr(e,t){Ke(e,t,Pr)}function _n(e,t,r){var n,i,s,l,d=Ie({},e.props);for(s in e.type&&e.type.defaultProps&&(l=e.type.defaultProps),t)s=="key"?n=t[s]:s=="ref"?i=t[s]:d[s]=t[s]===void 0&&l!=null?l[s]:t[s];return arguments.length>2&&(d.children=arguments.length>3?it.call(arguments,2):r),nt(e.type,d,n||e.key,i||e.ref,null)}function gn(e){function t(r){var n,i;return this.getChildContext||(n=new Set,(i={})[t.__c]=this,this.getChildContext=function(){return i},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(s){this.props.value!=s.value&&n.forEach(function(l){l.__e=!0,eo(l)})},this.sub=function(s){n.add(s);var l=s.componentWillUnmount;s.componentWillUnmount=function(){n&&n.delete(s),l&&l.call(s)}}),r.children}return t.__c="__cC"+mr++,t.__=e,t.Provider=t.__l=(t.Consumer=function(r,n){return r.children(n)}).contextType=t,t}it=Pt.slice,Y={__e:function(e,t,r,n){for(var i,s,l;t=t.__;)if((i=t.__c)&&!i.__)try{if((s=i.constructor)&&s.getDerivedStateFromError!=null&&(i.setState(s.getDerivedStateFromError(e)),l=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,n||{}),l=i.__d),l)return i.__E=i}catch(d){e=d}throw e}},fr=0,Oe.prototype.setState=function(e,t){var r;r=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Ie({},this.state),typeof e=="function"&&(e=e(Ie({},r),this.props)),e&&Ie(r,e),e!=null&&this.__v&&(t&&this._sb.push(t),eo(this))},Oe.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),eo(this))},Oe.prototype.render=te,ze=[],_r=typeof Promise=="function"?Promise.prototype.then.bind(Prom
vendor: 12,193 bytes, line 1
1ise.resolve()):setTimeout,gr=function(e,t){return e.__v.__b-t.__v.__b},Tt.__r=0,Dt=Math.random().toString(8),xt="__d"+Dt,rt="__a"+Dt,yr=/(PointerCapture)$|Capture$/i,ao=0,Zt=Fo(!1),Qt=Fo(!0),mr=0;var yn=0;function o(e,t,r,n,i,s){t||(t={});var l,d,_=t;if("ref"in _)for(d in _={},t)d=="ref"?l=t[d]:_[d]=t[d];var g={type:e,props:_,key:r,ref:l,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--yn,__i:-1,__u:0,__source:i,__self:s};if(typeof e=="function"&&(l=e.defaultProps))for(d in l)_[d]===void 0&&(_[d]=l[d]);return Y.vnode&&Y.vnode(g),g}var Be,re,Ft,Ho,Ge=0,Tr=[],ie=Y,Vo=ie.__b,qo=ie.__r,Jo=ie.diffed,Ko=ie.__c,Go=ie.unmount,Yo=ie.__;function Ye(e,t){ie.__h&&ie.__h(re,e,Ge||t),Ge=0;var r=re.__H||(re.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function F(e){return Ge=1,po(Rr,e)}function po(e,t,r){var n=Ye(Be++,2);if(n.t=e,!n.__c&&(n.__=[r?r(t):Rr(void 0,t),function(d){var _=n.__N?n.__N[0]:n.__[0],g=n.t(_,d);_!==g&&(n.__N=[g,n.__[1]],n.__c.setState({}))}],n.__c=re,!re.__f)){var i=function(d,_,g){if(!n.__c.__H)return!0;var k=!1,b=n.__c.props!==d;if(n.__c.__H.__.some(function(x){if(x.__N){k=!0;var c=x.__[0];x.__=x.__N,x.__N=void 0,c!==x.__[0]&&(b=!0)}}),s){var h=s.call(this,d,_,g);return k?h||b:h}return!k||b};re.__f=!0;var s=re.shouldComponentUpdate,l=re.componentWillUpdate;re.componentWillUpdate=function(d,_,g){if(this.__e){var k=s;s=void 0,i(d,_,g),s=k}l&&l.call(this,d,_,g)},re.shouldComponentUpdate=i}return n.__N||n.__}function ee(e,t){var r=Ye(Be++,3);!ie.__s&&ho(r.__H,t)&&(r.__=e,r.u=t,re.__H.__h.push(r))}function at(e,t){var r=Ye(Be++,4);!ie.__s&&ho(r.__H,t)&&(r.__=e,r.u=t,re.__h.push(r))}function We(e){return Ge=5,It(function(){return{current:e}},[])}function Er(e,t,r){Ge=6,at(function(){if(typeof e=="function"){var n=e(t());return function(){e(null),n&&typeof n=="function"&&n()}}if(e)return e.current=t(),function(){return e.current=null}},r==null?r:r.concat(e))}function It(e,t){var r=Ye(Be++,7);return ho(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function Ir(e,t){return Ge=8,It(function(){return e},t)}function Or(e){var t=re.context[e.__c],r=Ye(Be++,9);return r.c=e,t?(r.__==null&&(r.__=!0,t.sub(re)),t.props.value):e.__}function Lr(e,t){ie.useDebugValue&&ie.useDebugValue(t?t(e):e)}function Ar(){var e=Ye(Be++,11);if(!e.__){for(var t=re.__v;t!==null&&!t.__m&&t.__!==null;)t=t.__;var r=t.__m||(t.__m=[0,0]);e.__="P"+r[0]+"-"+r[1]++}return e.__}function mn(){for(var e;e=Tr.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(kt),t.__h.some(to),t.__h=[]}catch(r){t.__h=[],ie.__e(r,e.__v)}}}ie.__b=function(e){re=null,Vo&&Vo(e)},ie.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Yo&&Yo(e,t)},ie.__r=function(e){qo&&qo(e),Be=0;var t=(re=e.__c).__H;t&&(Ft===re?(t.__h=[],re.__h=[],t.__.some(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(t.__h.some(kt),t.__h.some(to),t.__h=[],Be=0)),Ft=re},ie.diffed=function(e){Jo&&Jo(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Tr.push(t)!==1&&Ho===ie.requestAnimationFrame||((Ho=ie.requestAnimationFrame)||vn)(mn)),t.__H.__.some(function(r){r.u&&(r.__H=r.u,r.u=void 0)})),Ft=re=null},ie.__c=function(e,t){t.some(function(r){try{r.__h.some(kt),r.__h=r.__h.filter(function(n){return!n.__||to(n)})}catch(n){t.some(function(i){i.__h&&(i.__h=[])}),t=[],ie.__e(n,r.__v)}}),Ko&&Ko(e,t)},ie.unmount=function(e){Go&&Go(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.some(function(n){try{kt(n)}catch(i){t=i}}),r.__H=void 0,t&&ie.__e(t,r.__v))};var Xo=typeof requestAnimationFrame=="function";function vn(e){var t,r=function(){clearTimeout(n),Xo&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,35);Xo&&(t=requestAnimationFrame(r))}function kt(e){var t=re,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),re=t}function to(e){var t=re;e.__c=e.__(),re=t}function ho(e,t){return!e||e.length!==t.length||t.some(function(r,n){return r!==e[n]})}function Rr(e,t){return typeof t=="function"?t(e):t}const Zo=e=>{let t;const r=new Set,n=(g,k)=>{const b=typeof g=="function"?g(t):g;if(!Object.is(b,t)){const h=t;t=k??(typeof b!="object"||b===null)?b:Object.assign({},t,b),r.forEach(x=>x(t,h))}},i=()=>t,d={setState:n,getState:i,getInitialState:()=>_,subscribe:g=>(r.add(g),()=>r.delete(g))},_=t=e(n,i,d);return d},bn=e=>e?Zo(e):Zo;function jr(e,t){for(var r in t)e[r]=t[r];return e}function oo(e,t){for(var r in e)if(r!=="__source"&&!(r in t))return!0;for(var n in t)if(n!=="__source"&&e[n]!==t[n])return!0;return!1}function $r(e,t){var r=t(),n=F({t:{__:r,u:t}}),i=n[0].t,s=n[1];return at(function(){i.__=r,i.u=t,Ht(i)&&s({t:i})},[e,r,t]),ee(function(){return Ht(i)&&s({t:i}),e(function(){Ht(i)&&s({t:i})})},[e]),r}function Ht(e){try{return!((t=e.__)===(r=e.u())&&(t!==0||1/t==1/r)||t!=t&&r!=r)}catch{return!0}var t,r}function zr(e){e()}function Mr(e){return e}function Br(){return[!1,zr]}var Wr=at;function ro(e,t){this.props=e,this.context=t}function wn(e,t){function r(i){var s=this.props.ref;return s!=i.ref&&s&&(typeof s=="function"?s(null):s.current=null),t?!t(this.props,i)||s!=i.ref:oo(this.props,i)}function n(i){return this.shouldComponentUpdate=r,Re(e,i)}return n.displayName="Memo("+(e.displayName||e.name)+")",n.__f=n.prototype.isReactComponent=!0,n.type=e,n}(ro.prototype=new Oe).isPureReactComponent=!0,ro.prototype.shouldComponentUpdate=function(e,t){return oo(this.props,e)||oo(this.state,t)};var Qo=Y.__b;Y.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Qo&&Qo(e)};var xn=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function kn(e){function t(r){var n=jr({},r);return delete n.ref,e(n,r.ref||null)}return t.$$typeof=xn,t.render=e,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var er=function(e,t){return e==null?null:Ae(Ae(e).map(t))},Cn={map:er,forEach:er,count:function(e){return e?Ae(e).length:0},only:function(e){var t=Ae(e);if(t.length!==1)throw"Children.only";return t[0]},toArray:Ae},Sn=Y.__e;Y.__e=function(e,t,r,n){if(e.then){for(var i,s=t;s=s.__;)if((i=s.__c)&&i.__c)return t.__e==null&&(t.__e=r.__e,t.__k=r.__k||[]),i.__c(e,t)}Sn(e,t,r,n)};var tr=Y.unmount;function Nr(e,t,r){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(n){typeof n.__c=="function"&&n.__c()}),e.__c.__H=null),(e=jr({},e)).__c!=null&&(e.__c.__P===r&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(n){return Nr(n,t,r)})),e}function Ur(e,t,r){return e&&r&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(n){return Ur(n,t,r)}),e.__c&&e.__c.__P===t&&(e.__e&&r.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=r)),e}function Ct(){this.__u=0,this.o=null,this.__b=null}function Dr(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function Pn(e){var t,r,n,i=null;function s(l){if(t||(t=e()).then(function(d){d&&(i=d.default||d),n=!0},function(d){r=d,n=!0}),r)throw r;if(!n)throw t;return i?Re(i,l):null}return s.displayName="Lazy",s.__f=!0,s}function ot(){this.i=null,this.l=null}Y.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),tr&&tr(e)},(Ct.prototype=new Oe).__c=function(e,t){var r=t.__c,n=this;n.o==null&&(n.o=[]),n.o.push(r);var i=Dr(n.__v),s=!1,l=function(){s||n.__z||(s=!0,r.__R=null,i?i(_):_())};r.__R=l;var d=r.__P;r.__P=null;var _=function(){if(!--n.__u){if(n.state.__a){var g=n.state.__a;n.__v.__k[0]=Ur(g,g.__c.__P,g.__c.__O)}var k;for(n.setState({__a:n.__b=null});k=n.o.pop();)k.__P=d,k.forceUpdate()}};n.__u++||32&t.__u||n.setState({__a:n.__b=n.__v.__k[0]}),e.then(l,l)},Ct.prototype.componentWillUnmount=function(){this.o=[]},Ct.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var r=document.createElement("div"),n=this.__v.__k[0].__c;this.__v.__k[0]=Nr(this.__b,r,n.__O=n.__P)}this.__b=null}var i=t.__a&&Re(te,null,e.fallback);return i&&(i.__u&=-33),[Re(te,null,t.__a?null:e.children),i]};var or=function(e,t,r){if(++r[1]===r[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.l.size))for(r=e.i;r;){for(;r.length>3;)r.pop()();if(r[1]<r[0])break;e.i=r=r[2]}};function Tn(e){return this.getChildContext=function(){return e.context},e.children}function En(e){var t=this,r=e.h;if(t.componentWillUnmount=function(){Ke(null,t.v),t.v=null,t.h=null},t.h&&t.h!==r&&t.componentWillUnmount(),!t.v){for(var n=t.__v;n!==null&&!n.__m&&n.__!==null;)n=n.__;t.h=r,t.v={nodeType:1,parentNode:r,childNodes:[],__k:{__m:n.__m},contains:function(){return!0},namespaceURI:r.namespaceURI,insertBefore:function(i,s){this.childNodes.push(i),t.h.insertBefore(i,s)},removeChild:function(i){this.childNodes.splice(this.childNodes.indexOf(i)>>>1,1),t.h.removeChild(i)}}}Ke(Re(Tn,{context:t.context},e.__v),t.v)}function In(e,t){var r=Re(En,{__v:e,h:t});return r.containerInfo=t,r}(ot.prototype=new Oe).__a=function(e){var t=this,r=Dr(t.__v),n=t.l.get(e);return n[0]++,function(i){var s=function(){t.props.revealOrder?(n.push(i),or(t,e,n)):i()};r?r(s):s()}},ot.prototype.render=function(e){this.i=null,this.l=new Map;var t=Ae(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var r=t.length;r--;)this.l.set(t[r],this.i=[1,0,this.i]);return e.children},ot.prototype.componentDidUpdate=ot.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,r){or(e,r,t)})};var Fr=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,On=/^(?: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]/,Ln=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,An=/[A-Z0-9]/g,Rn=typeof document<"u",jn=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};function $n(e,t,r){return t.__k==null&&(t.textContent=""),Ke(e,t),typeof r=="function"&&r(),e?e.__c:null}function zn(e,t,r){return Pr(e,t),typeof r=="function"&&r(),e?e.__c:null}Oe.prototype.isReactComponent=!0,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(Oe.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var rr=Y.event;Y.event=function(e){return rr&&(e=rr(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var fo,Mn={configurable:!0,get:function(){return this.class}},nr=Y.vnode;Y.vnode=function(e){typeof e.type=="string"&&function(t){var r=t.props,n=t.type,i={},s=n.indexOf("-")==-1;for(var l in r){var d=r[l];if(!(l==="value"&&"defaultValue"in r&&d==null||Rn&&l==="children"&&n==="noscript"||l==="class"||l==="className")){var _=l.toLowerCase();l==="defaultValue"&&"value"in r&&r.value==null?l="value":l==="download"&&d===!0?d="":_==="translate"&&d==="no"?d=!1:_[0]==="o"&&_[1]==="n"?_==="ondoubleclick"?l="ondblclick":_!=="onchange"||n!=="input"&&n!=="textarea"||jn(r.type)?_==="onfocus"?l="onfocusin":_==="onblur"?l="onfocusout":Ln.test(l)&&(l=_):_=l="oninput":s&&On.test(l)?l=l.replace(An,"-$&").toLowerCase():d===null&&(d=void 0),_==="oninput"&&i[l=_]&&(l="oninputCapture"),i[l]=d}}n=="select"&&(i.multiple&&Array.isArray(i.value)&&(i.value=Ae(r.children).forEach(function(g){g.props.selected=i.value.indexOf(g.props.value)!=-1})),i.defaultValue!=null&&(i.value=Ae(r.children).forEach(function(g){g.props.selected=i.multiple?i.defaultValue.indexOf(g.props.value)!=-1:i.defaultValue==g.props.value}))),r.class&&!r.className?(i.class=r.class,Object.defineProperty(i,"className",Mn)):r.className&&(i.class=i.className=r.className),t.props=i}(e),e.$$typeof=Fr,nr&&nr(e)};var ir=Y.__r;Y.__r=function(e){ir&&ir(e),fo=e.__c};var sr=Y.diffed;Y.diffed=function(e){sr&&sr(e);var t=e.props,r=e.__e;r!=null&&e.type==="textarea"&&"value"in t&&t.value!==r.value&&(r.value=t.value==null?"":t.value),fo=null};var Bn={ReactCurrentDispatcher:{current:{readContext:function(e){return fo.__n[e.__c].props.value},useCallback:Ir,useContext:Or,useDebugValue:Lr,useDeferredValue:Mr,useEffect:ee,useId:Ar,useImperativeHandle:Er,useInsertionEffect:Wr,useLayoutEffect:at,useMemo:It,useReducer:po,useRef
1:We,useState:F,useSyncExternalStore:$r,useTransition:Br}}};function Wn(e){return Re.bind(null,e)}function Ot(e){return!!e&&e.$$typeof===Fr}function Nn(e){return Ot(e)&&e.type===te}function Un(e){return!!e&&typeof e.displayName=="string"&&e.displayName.indexOf("Memo(")==0}function Dn(e){return Ot(e)?_n.apply(null,arguments):e}function Fn(e){return!!e.__k&&(Ke(null,e),!0)}function Hn(e){return e&&(e.base||e.nodeType===1&&e)||null}var Vn=function(e,t){return e(t)},qn=function(e,t){var r,n=Y.debounceRendering;Y.debounceRendering=function(s){r=s};try{var i=e(t);return r&&r(),i}finally{Y.debounceRendering=n}},Jn=Ot,bt={useState:F,useId:Ar,useReducer:po,useEffect:ee,useLayoutEffect:at,useInsertionEffect:Wr,useTransition:Br,useDeferredValue:Mr,useSyncExternalStore:$r,startTransition:zr,useRef:We,useImperativeHandle:Er,useMemo:It,useCallback:Ir,useContext:Or,useDebugValue:Lr,version:"18.3.1",Children:Cn,render:$n,hydrate:zn,unmountComponentAtNode:Fn,createPortal:In,createElement:Re,createContext:gn,createFactory:Wn,cloneElement:Dn,createRef:cn,Fragment:te,isValidElement:Ot,isElement:Jn,isFragment:Nn,isMemo:Un,findDOMNode:Hn,Component:Oe,PureComponent:ro,memo:wn,forwardRef:kn,flushSync:qn,unstable_batchedUpdates:Vn,StrictMode:te,Suspense:Ct,SuspenseList:ot,lazy:Pn,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Bn};const Kn=e=>e;function Gn(e,t=Kn){const r=bt.useSyncExternalStore(e.subscribe,bt.useCallback(()=>t(e.getState()),[e,t]),bt.useCallback(()=>t(e.getInitialState()),[e,t]));return bt.useDebugValue(r),r}const Yn=e=>{const t=bn(e),r=n=>Gn(t,n);return Object.assign(r,t),r},Xn=e=>Yn;function Zn(e,t){let r;try{r=e()}catch{return}return{getItem:i=>{var s;const l=_=>_===null?null:JSON.parse(_,void 0),d=(s=r.getItem(i))!=null?s:null;return d instanceof Promise?d.then(l):l(d)},setItem:(i,s)=>r.setItem(i,JSON.stringify(s,void 0)),removeItem:i=>r.removeItem(i)}}const no=e=>t=>{try{const r=e(t);return r instanceof Promise?r:{then(n){return no(n)(r)},catch(n){return this}}}catch(r){return{then(n){return this},catch(n){return no(n)(r)}}}},Qn=(e,t)=>(r,n,i)=>{let s={storage:Zn(()=>window.localStorage),partialize:M=>M,version:0,merge:(M,B)=>({...B,...M}),...t},l=!1,d=0;const _=new Set,g=new Set;let k=s.storage;if(!k)return e((...M)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),r(...M)},n,i);const b=()=>{const M=s.partialize({...n()});return k.setItem(s.name,{state:M,version:s.version})},h=i.setState;i.setState=(M,B)=>(h(M,B),b());const x=e((...M)=>(r(...M),b()),n,i);i.getInitialState=()=>x;let c;const P=()=>{var M,B;if(!k)return;const D=++d;l=!1,_.forEach(V=>{var W;return V((W=n())!=null?W:x)});const q=((B=s.onRehydrateStorage)==null?void 0:B.call(s,(M=n())!=null?M:x))||void 0;return no(k.getItem.bind(k))(s.name).then(V=>{if(V)if(typeof V.version=="number"&&V.version!==s.version){if(s.migrate){const W=s.migrate(V.state,V.version);return W instanceof Promise?W.then(A=>[!0,A]):[!0,W]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,V.state];return[!1,void 0]}).then(V=>{var W;if(D!==d)return;const[A,a]=V;if(c=s.merge(a,(W=n())!=null?W:x),r(c,!0),A)return b()}).then(()=>{D===d&&(q==null||q(n(),void 0),c=n(),l=!0,g.forEach(V=>V(c)))}).catch(V=>{D===d&&(q==null||q(void 0,V))})};return i.persist={setOptions:M=>{s={...s,...M},M.storage&&(k=M.storage)},clearStorage:()=>{++d,k==null||k.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>P(),hasHydrated:()=>l,onHydrate:M=>(_.add(M),()=>{_.delete(M)}),onFinishHydration:M=>(g.add(M),()=>{g.delete(M)})},s.skipHydration||P(),c||x},ei=Qn,me={set(e,t,r=7){const n=new Date;n.setTime(n.getTime()+r*24*60*60*1e3),document.cookie=`${e}=${t};expires=${n.toUTCString()};path=/`},get(e){const t=`${e}=`,r=document.cookie.split(";");for(let n=0;n<r.length;n++){let i=r[n];for(;i.charAt(0)===" ";)i=i.substring(1,i.length);if(i.indexOf(t)===0)return i.substring(t.length,i.length)}return null},remove(e){document.cookie=`${e}=;expires=Thu, 01 Jan 1970 00:00:01 GMT;path=/`}};function Hr(e){const t=new URLSearchParams(e);return t.get("session_id")||t.get("state_id")||null}function ti(e,t){const r=e.indexOf("#"),n=r>=0?e.slice(r):"",i=r>=0?e.slice(0,r):e,s=i.indexOf("?"),l=s>=0?i.slice(0,s):i,d=new URLSearchParams(s>=0?i.slice(s+1):"");d.delete("state_id"),t?d.set("session_id",t):d.delete("session_id");const _=d.toString();return`${l}${_?`?${_}`:""}${n}`}const $e={API_KEY:"mj_api_key",CLIENT_ID:"ssojet_client_id"},wt={STATE_ID:"otp_state_id"},ar=e=>{if(typeof window>"u")return;const t=`${window.location.pathname}${window.location.search}${window.location.hash}`,r=ti(t,e);r!==t&&window.history.replaceState(window.history.state,"",r)},oi="#5e00cf",ri="#1d4ed8",ni="#fff",ii=e=>typeof e!="string"?null:e.trim().toLowerCase(),io=e=>{if(Array.isArray(e))return e.map(t=>io(t));if(e&&typeof e=="object"){const t={};for(const[r,n]of Object.entries(e))t[r]=io(n);return ii(t.btn_color)===oi&&(t.btn_color=ri,t.text_color=ni),t}return e},ge=Xn()(ei((e,t)=>({isAuthenticated:!1,oauth:null,user:null,email:null,phone:null,branding:null,apiKey:null,clientId:null,loading:!1,error:null,webAuthnSession:null,setAuth:(r,n)=>{e({isAuthenticated:!0,oauth:r,user:n,error:null})},setEmail:r=>e({email:r}),setPhone:r=>e({phone:r}),setBranding:r=>{var l,d,_;const n=io(r),i=n==null?void 0:n.api_key,s=(n==null?void 0:n.client_id)||((l=n==null?void 0:n.data)==null?void 0:l.client_id)||((_=(d=n==null?void 0:n.data)==null?void 0:d.data)==null?void 0:_.client_id);i&&me.set($e.API_KEY,i),s&&me.set($e.CLIENT_ID,s),e({branding:n,apiKey:i||t().apiKey,clientId:s||t().clientId})},setApiKey:r=>{me.set($e.API_KEY,r),e({apiKey:r})},getApiKey:()=>{const r=t().apiKey,n=me.get($e.API_KEY);return r||n||t().getClientId()},setClientId:r=>{me.set($e.CLIENT_ID,r),e({clientId:r})},getClientId:()=>{const r=t().clientId,n=me.get($e.CLIENT_ID);return r||n}
1,setLoading:r=>e({loading:r}),setError:r=>e({error:r}),setStateId:r=>{sessionStorage.setItem(wt.STATE_ID,r),ar(r)},getStateId:()=>{const r=sessionStorage.getItem(wt.STATE_ID);if(r)return r;if(typeof window<"u"){const n=Hr(window.location.search);if(n)return n}return null},clearStateId:()=>{sessionStorage.removeItem(wt.STATE_ID),ar(null)},setWebAuthnSession:r=>{e({webAuthnSession:r})},clearWebAuthnSession:()=>{e({webAuthnSession:null})},logout:()=>{me.remove($e.API_KEY),me.remove($e.CLIENT_ID),sessionStorage.removeItem(wt.STATE_ID),e({isAuthenticated:!1,oauth:null,user:null,apiKey:null,clientId:null,error:null})}}),{name:"auth_store"})),se=({size:e="medium",text:t="Loading...",showText:r=!1,variant:n="primary"})=>o("div",{class:`loading-spinner-container ${r?"with-text":""}`,children:[o("div",{class:`spinner ${e} ${{primary:"spinner-primary",secondary:"spinner-secondary",light:"spinner-light",dark:"spinner-dark"}[n]}`,children:o("svg",{viewBox:"0 0 50 50",children:o("circle",{class:"path",cx:"25",cy:"25",r:"20",fill:"none","stroke-width":"5"})})}),r&&o("span",{class:"loading-text",children:t})]}),Vr=({text:e="Loading..."})=>o("div",{class:"page-loader",children:o("div",{class:"page-loader-content",children:[o("div",{class:"page-spinner",children:o("svg",{viewBox:"0 0 50 50",children:o("circle",{class:"path",cx:"25",cy:"25",r:"20",fill:"none","stroke-width":"3"})})}),o("h2",{class:"page-loader-text",children:e})]})}),Vt=[{code:"US",name:"United States",dialCode:"+1",flag:"ðºð¸"},{code:"GB",name:"United Kingdom",dialCode:"+44",flag:"ð¬ð§"},{code:"IN",name:"India",dialCode:"+91",flag:"ð®ð³"},{code:"CA",name:"Canada",dialCode:"+1",flag:"ð¨ð¦"},{code:"AU",name:"Australia",dialCode:"+61",flag:"ð¦ðº"},{code:"DE",name:"Germany",dialCode:"+49",flag:"ð©ðª"},{code:"FR",name:"France",dialCode:"+33",flag:"ð«ð·"},{code:"JP",name:"Japan",dialCode:"+81",flag:"ð¯ðµ"},{code:"CN",name:"China",dialCode:"+86",flag:"ð¨ð³"},{code:"BR",name:"Brazil",dialCode:"+55",flag:"ð§ð·"},{code:"MX",name:"Mexico",dialCode:"+52",flag:"ð²ð½"},{code:"ES",name:"Spain",dialCode:"+34",flag:"ðªð¸"},{code:"IT",name:"Italy",dialCode:"+39",flag:"ð®ð¹"},{code:"RU",name:"Russia",dialCode:"+7",flag:"ð·ðº"},{code:"KR",name:"South Korea",dialCode:"+82",flag:"ð°ð·"},{code:"NL",name:"Netherlands",dialCode:"+31",flag:"ð³ð±"},{code:"SE",name:"Sweden",dialCode:"+46",flag:"ð¸ðª"},{code:"CH",name:"Switzerland",dialCode:"+41",flag:"ð¨ð"},{code:"NO",name:"Norway",dialCode:"+47",flag:"ð³ð´"},{code:"SG",name:"Singapore",dialCode:"+65",flag:"ð¸ð¬"}],si=({value:e,onChange:t,placeholder:r="",disabled:n=!1,style:i={},onPhoneChange:s,inputRef:l,hideLabel:d=!1})=>{const[_,g]=F(Vt[0]),[k,b]=F(!1),[h,x]=F(""),[c,P]=F(""),[M,B]=F(!1),D=We(null);ee(()=>{const A=a=>{D.current&&!D.current.contains(a.target)&&(b(!1),P(""))};return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[]),ee(()=>{const A=h?`${_.dialCode}${h}`:"";t(A),s&&s(A,_.dialCode)},[_,h,t,s]),ee(()=>{if(e&&e.startsWith("+")){const A=Vt.find(a=>e.startsWith(a.dialCode));A&&(g(A),x(e.substring(A.dialCode.length)))}else e&&!e.startsWith("+")&&x(e)},[e]);const q=A=>{let T=A.target.value;T=T.replace(/[^\d\s-]/g,""),x(T)},V=A=>{g(A),b(!1),P("")},W=Vt.filter(A=>A.name.toLowerCase().includes(c.toLowerCase())||A.dialCode.includes(c)||A.code.toLowerCase().includes(c.toLowerCase()));return o("div",{style:{position:"relative",width:"100%",...i},class:"phone-input-label",children:o("div",{style:{display:"flex",border:"1px solid #c1c7cd",borderRadius:"6px",overflow:"visible",backgroundColor:n?"#f5f5f5":"#fff",transition:"border-color 0.2s ease",boxShadow:"0 1px 2px rgba(0, 0, 0, 0.05)",position:"relative"},children:[!d&&o("label",{style:{position:"absolute",top:h||M||k?"-7px":"15px",left:h||M||k?"18px":"108px",textAlign:"left",display:"inline-block",height:"14px",lineHeight:"14px",fontSize:"14px",fontWeight:400,background:"#fff",color:h||M||k?"#1d4ed8":"#747778",margin:"0px auto",cursor:"text",transition:"all .15s ease-in-out",padding:"0 4px",zIndex:10,pointerEvents:"none"},children:r}),o("div",{ref:D,style:{position:"relative",borderRight:"1px solid #e1e5e9"},children:[o("button",{type:"button",onClick:()=>b(!k),disabled:n,style:{display:"flex",alignItems:"center",padding:"12px 24px 12px 16px",border:"none",backgroundColor:"transparent",curs
1or:n?"not-allowed":"pointer",fontSize:"14px",minWidth:"90px",justifyContent:"space-between",gap:"6px",transition:"background-color 0.2s ease",borderTopLeftRadius:"6px",borderBottomLeftRadius:"6px"},onMouseEnter:A=>{n||(A.target.style.backgroundColor="#f8f9fa")},onMouseLeave:A=>{A.target.style.backgroundColor="transparent"},children:[o("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[o("span",{style:{fontSize:"18px"},children:_.flag}),o("span",{style:{fontSize:"13px",color:"#666",fontWeight:"500"},children:_.dialCode})]}),o("svg",{style:{width:"14px",height:"14px",transform:k?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s ease",fill:"#999",flexShrink:0},viewBox:"0 0 24 24",children:o("path",{d:"M7 10l5 5 5-5z"})})]}),k&&o("div",{style:{position:"absolute",top:"calc(100% + 4px)",left:0,backgroundColor:"#fff",border:"1px solid #e1e5e9",borderRadius:"8px",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.15)",zIndex:1e3,maxHeight:"280px",overflow:"hidden",minWidth:"320px",maxWidth:"400px"},children:[o("div",{style:{padding:"12px 16px",borderBottom:"1px solid #f0f0f0"},children:o("input",{type:"text",placeholder:"Search countries...",value:c,onChange:A=>P(A.target.value),style:{width:"100%",padding:"10px 12px",border:"1px solid #e1e5e9",borderRadius:"6px",fontSize:"14px",outline:"none",backgroundColor:"#f8f9fa",transition:"all 0.2s ease"},onFocus:A=>{A.target.style.borderColor="#6a7bd2",A.target.style.backgroundColor="#fff",A.target.style.boxShadow="0 0 0 3px rgba(106, 123, 210, 0.1)"},onBlur:A=>{A.target.style.borderColor="#e1e5e9",A.target.style.backgroundColor="#f8f9fa",A.target.style.boxShadow="none"}})}),o("div",{style:{maxHeight:"188px",overflowY:"auto"},children:W.length>0?W.map(A=>o("button",{type:"button",onClick:()=>V(A),style:{width:"100%",padding:"12px 16px",border:"none",backgroundColor:_.code===A.code?"#f0f4ff":"transparent",cursor:"pointer",textAlign:"left",fontSize:"14px",display:"flex",alignItems:"center",gap:"12px",transition:"background-color 0.15s ease"},onMouseEnter:a=>{_.code!==A.code&&(a.target.style.backgroundColor="#f8f9fa")},onMouseLeave:a=>{_.code!==A.code&&(a.target.style.backgroundColor="transparent")},children:[o("span",{style:{fontSize:"20px"},children:A.flag}),o("div",{style:{flex:1,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[o("span",{style:{color:"#333",fontWeight:"400"},children:A.name}),o("span",{style:{color:"#666",fontSize:"13px",fontWeight:"500"},children:A.dialCode})]})]},A.code)):o("div",{style:{padding:"20px 16px",textAlign:"center",color:"#999",fontSize:"14px"},children:"No countries found"})})]})]}),o("input",{ref:l,type:"tel",value:h,onChange:q,placeholder:d?r:"",disabled:n,style:{flex:1,padding:"12px 16px",border:"none",fontSize:"14px",outline:"none",backgroundColor:"transparent",color:"#333",borderTopRightRadius:"6px",borderBottomRightRadius:"6px",transition:"box-shadow 0.2s ease"},onFocus:A=>{B(!0),A.target.parentElement.style.borderColor="#6a7bd2",A.target.parentElement.style.boxShadow="0 0 0 3px rgba(106, 123, 210, 0.1)"},onBlur:A=>{B(!1),A.target.parentElement.style.borderColor="#c1c7cd",A.target.parentElement.style.boxShadow="0 1px 2px rgba(0, 0, 0, 0.05)"}})]})})},ai=/(token|secret|password|passwd|credential|assertion|authorization|apikey|privatekey|signingkey|clientsecret)/,li=new Set(["code","codeverifier","otp","pin","pwd","cookie","setcookie","session","sessionid","jwt","samlresponse","samlrequest","answer","recoverycode","backupcode"]),ci=new Set(["statuscode","errorcode","countrycode","postalcode","zipcode","areacode","dialcode","currencycode","languagecode","localecode","httpcode","responsecode"]);function lr(e){const t=e.toLowerCase().replace(/[^a-z0-9]/g,"");return ci.has(t)?!1:li.has(t)?!0:ai.test(t)}const di=/^[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]*$/,ui=/^v[1-4]\.(local|public)\./,pi=/^(Bearer|Basic|Digest)\s+\S+$/i;function hi(e){return di.test(e)||ui.test(e)||pi.test(e)}function qt(e){return typeof e=="string"?`[redacted ${e.length} chars]`:"[redacted]"}const fi=6,Jt=50;function so(e,t=0,r=new WeakSet){if(e==null)return e;if(typeof e=="string")return hi(e)?qt(e):e;if(typeof e!="object")return e;if(typeof Headers<"u"&&e instanceof Headers){const i={};return e.forEach((s,l)=>{i[l]=lr(l)?qt(s):s}),i}if(e instanceof Error)return{name:e.name,message:e.message,stack:e.stack};if(e instanceof Date)return e.toISOString();if(r.has(e))return"[circular]";if(t>=fi)return"[depth limit]";if(r.add(e),Array.isArray(e)){const i=e.slice(0,Jt).map(s=>so(s,t+1,r));return e.length>Jt&&i.push(`[+${e.length-Jt} more]`),i}const n={};for(const[i,s]of Object.entries(e))n[i]=lr(i)?qt(s):so(s,t+1,r);return n}var cr={};const ae={ERROR:0,WARN:1,INFO:2,DEBUG:3,TRACE:4},Me=class Me{constructor(t={}){mt(this,"config");this.config={level:this.getLogLevelFromEnv(),prefix:"",timestamp:!0,colors:!0,...t}}static getInstance(t){return Me.instance||(Me.instance=new Me(t)),Me.instance}getLogLevelFromEnv(){let t;try{if(typeof globalThis<"u"&&cr){const r=cr;t=r.LOG_LEVEL||r.DEBUG_MODE}}catch{t=void 0}if(t==="true"||t==="1")return ae.DEBUG;switch(t==null?void 0:t.toLowerCase()){case"error":return ae.ERROR;case"warn":return ae.WARN;case"info":return ae.INFO;case"debug":return ae.DEBUG;case"trace":return ae.TRACE;default:return ae.INFO}}shouldLog(t){return t<=this.config.level}formatMessage(t,r,n){const i=this.config.timestamp?new Date().toISOString():"",s=this.config.prefix?`[${this.config.prefix}]`:"",l=`[${t}]`;let d=`${i} ${s} ${l} ${this.render(r)}`;for(const _ of n)d+=` ${this.render(_)}`;return d.trim()}render(t){const r=so(t);if(typeof r=="string")return r;if(r===void 0)return"undefined";try{return JSON.stringify(r,null,2)}catch{return String(r)}}getColorCode(t){if(!this.config.colors)return"";switch(t){case ae.ERROR:return"\x1B[31m";case ae.WARN:return"\x1B[33m";case ae.INFO:return"\x1B[36m";case ae.DEBUG:return"\x1B[32m";case ae.TRACE:return"\x1B[35m";default:return""}}resetColor(){return this.config.colors?"\x1B[0m":""}error(t,...r){if(this.shouldLog(ae.ERROR)){const n=this.getColorCode(ae.ERROR),i=this.resetColor();console.error(`${n}${this.formatMessage("ERROR",t,r)}${i}`)}}warn(t,...r){if(this.shouldLog(ae.WARN)){const n=this.getColorCode(ae.WARN),i=this.resetColor();console.warn(`${n}${this.formatMessage("WARN",t,r)}${i}`)}}info(t,...r){if(this.shouldLog(ae.INFO)){const n=this.getColorCode(ae.INFO),i=this.resetColor();console.info(`${n}${this.formatMessage("INFO",t,r)}${i}`)}}debug(t,...r){if(this.shouldLog(ae.DEBUG)){const n=this.getColorCode(ae.DEBUG),i=this.resetColor();console.log(`${n}${this.formatMessage("DEBUG",t,r)}${i}`)}}trace(t,...r){if(this.shouldLog(ae.TRACE)){const n=this.getColorCode(ae.TRACE),i=this.resetColor();console.log(`${n}${this.formatMessage("TRACE",t,r)}${i}`)}}log(t,...r){this.debug(t,...r)}setLogLevel(t){this.config.level=t}getLogLevel(){return this.config.level}child(t){return new Me({...this.config,prefix:this.config.prefix?`${this.config.prefix}:${t}`:t})}};mt(Me,"instance");let Et=Me;const Lt=Et.getInstance({prefix:"SERVER"}),ve=Et.getInstance({prefix:"CLIENT"});Lt.child("AUTH");Lt.child("BRANDING");const H=Lt.child("API");class oe{static getStateFromURL(){return new URLSearchParams(window.location.search).get(this.STATE_PARAM)}static validateState(t){if(!t)return{isValid:!1,isExpired:!1,error:"State parameter is missing"};try{const r=t.split(".");if(r.length===3){const n=r[1].replace(/-/g,"+").replace(/_/g,"/"),i=n.padEnd(n.length+(4-n.length%4)%4,"="),s=atob(i),l=JSON.parse(s);return l.exp&&Math.floor(Date.now()/1e3)>l.exp?{isValid:!1,isExpired:!0,state:t,payload:l,error:"State has expired"}:{isValid:!0,isExpired:!1,state:t,payload:l}}return{isValid:!0,isExpired:!1,state:t,payload:null}}catch(r){return Lt.error("Error validating state as JWT. Treating as opaque:",r),{isValid:!0,isExpired:!1,state:t,payload:null}}}static getCurrentStateInfo(){const t=this.getStateFromURL();return t?this.validateState(t):{isValid:!1,isExpired:!1,error:"No state parameter found"}}static isOIDCFlow(){return!!this.getStateFromURL()}static getOIDCState(){const t=this.getCurrentStateInfo();return t.isValid&&t.state||null}static preserveStateInURL(t){const r=this.getStateFromURL();if(r){const n=t.includes("?")?"&":"?";return`${t}${n}state=${encodeURIComponent(r)}`}return t}static generateRetryURL(){return"/login?error=invalid_state&message=Please try again with a valid login link"}}mt(oe,"STATE_PARAM","state");const qr="branding_cache_v1:";function _i(e){return e.cached}function gi(e,t){return e.filter(r=>r.startsWith(qr)&&r!==t)}function fe(){return oe.getOIDCState()}const yi=(e,t)=>`${qr}${e}::${t}`,mi=e=>{try{const t=localStorage.getItem(e);if(!t)return null;const r=JSON.parse(t);return(r==null?void 0:r.data)||null}catch{return null}},vi=(e,t)=>{try{const r=[];for(let n=0;n<localStorage.length;n++){const i=localStorage.key(n);i&&r.push(i)}for(const n of gi(r,e))localStorage.removeItem(n);localStorage.setItem(e,JSON.stringify({data:t,cachedAt:Date.now()}))}catch{}},de={async hostedPageSSO(e,t){const r={"Content-Type":"application/json"};t&&(r["x-client-id"]=t);const n=await fetch("/api/v1/hosted-page/sso",{method:"POST",headers:r,body:JSON.stringify(e),credentials:"include"}),i=await n.json();if(!n.ok)throw new Error(i.error_description||"SSO failed");return i},async retryHostedPageLogin(e,t){const r={"Content-Type":"application/json"};t&&(r["x-client-id"]=t);const n=await fetch("/api/v1/hosted-page/login/retry",{method:"POST",headers:r,body:JSON.stringify(e),credentials:"include"}),i=await n.json();if(!n.ok)throw new Error(i.error_description||"Retry failed");return i},async verifyHostedPageOTP(e){const t=await fetch("/api/v1/hosted-page/verify-otp",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),credentials:"include"}),r=await t.json();if(!t.ok)throw new Error(r.error_description||"OTP verification failed");return r}
1,async initiateEmailOTP(e,t,r){H.debug("initiateEmailOTP function called",{email:e,apiKey:t,hasCaptcha:!!r});try{const n={email:e};r&&(n.captcha_token=r,H.debug("Including captcha token in request"));const i=fe();H.debug("Client: Raw state from URL",oe.getStateFromURL()),H.debug("Client: OIDC flow detected",oe.isOIDCFlow()),H.debug("Client: State info",oe.getCurrentStateInfo()),H.debug("Client: Final state value",i),i?(n.state=i,H.debug("Client sending state parameter in body",i)):H.debug("Client: No state parameter available"),H.debug("Client: Final request body",n);const s=await fetch("/api/auth/emailotp",{method:"POST",headers:{"Content-Type":"application/json","X-API-Key":t,"x-client-id":t},body:JSON.stringify(n)}),l=s.headers.get("content-type");if(!l||!l.includes("application/json"))throw new Error("Server returned non-JSON response. Make sure the API server is running.");const d=await s.json();if(!s.ok||!d.status)throw new Error((d==null?void 0:d.error_description)||(d==null?void 0:d.message)||(d==null?void 0:d.error)||"Failed to send OTP");return d}catch(n){throw n instanceof TypeError&&n.message.includes("fetch")?new Error("Cannot connect to API server. Make sure both servers are running (npm run dev)."):n}},async verifyEmailOTP(e,t,r,n){try{const i={email:e,otp:t},s=fe();s?(i.state=s,H.log("======> Client verifyEmailOTP sending state parameter in body:",s)):H.log("======> Client: No state parameter available"),n&&(i.state_id=n);const l=await fetch("/api/auth/emailotp/verify",{method:"POST",headers:{"Content-Type":"application/json","X-API-Key":r},body:JSON.stringify(i)}),d=l.headers.get("content-type");if(!d||!d.includes("application/json"))throw new Error("Server returned non-JSON response. Make sure the API server is running.");const _=await l.json();if(H.log("======> Client: verifyEmailOTP response data:",_),H.log("======> Client: verifyEmailOTP response status:",l.status),H.log("======> Client: verifyEmailOTP response ok:",l.ok),!l.ok||!_.status)throw new Error(_.message||"Failed to verify OTP");return _}catch(i){throw i instanceof TypeError&&i.message.includes("fetch")?new Error("Cannot connect to API server. Make sure both servers are running (npm run dev)."):i}},async resendEmailOTP(e,t){H.debug("resendEmailOTP function called",{apiKey:e,stateId:t});try{const r={},n=fe();n&&(r.state=n,H.debug("Client sending state parameter in body",n)),t&&(r.session_id=t,H.debug("Client resendEmailOTP sending session id in body",t)),H.debug("Client resendEmailOTP final request body",r);const i=await fetch("/api/auth/emailotp/resend",{method:"POST",headers:{"Content-Type":"application/json","X-API-Key":e},body:JSON.stringify(r)}),s=i.headers.get("content-type");if(!s||!s.includes("application/json"))throw new Error("Server returned non-JSON response. Make sure the API server is running.");if(!i.ok){const d=await i.json();throw new Error(d.message||"Failed to resend email OTP")}const l=await i.json();if(H.debug("Email OTP resend response data",l),!l.status)throw new Error(l.message||"Failed to resend email OTP");return l}catch(r){throw r instanceof TypeError&&r.message.includes("fetch")?new Error("Cannot connect to API server. Make sure both servers are running (npm run dev)."):r}},async initiateMagicLink(e,t,r){H.log("======> initiateMagicLink function called with:",{email:e,apiKey:t,hasCaptcha:!!r});try{const n={email:e};r&&(n.captcha_token=r);const i=fe();i&&(n.state=i);const s=await fetch("/api/auth/magiclink",{method:"POST",headers:{"Content-Type":"application/json","X-API-Key":t},body:JSON.stringify(n)});if(!s.ok)if(s.status>=400&&s.status<500){const l=await s.json().catch(()=>null);throw new Error((l==null?void 0:l.message)||`Request failed: ${s.status} ${s.statusText}`)}else throw new Error(`Server error: ${s.status} ${s.statusText}`);return await s.json()}catch(n){throw n instanceof TypeError&&n.message.includes("fetch")?new Error("Cannot connect to API server. Make sure both servers are running (npm run dev)."):n}},async checkMagicLinkStatus(e){H.log("======> checkMagicLinkStatus function called with:",{stateId:e});try{const t=new URL("/api/auth/magiclink/status",window.location.origin);t.searchParams.set("state_id",e);const r=fe();r&&t.searchParams.set("state",r);const n=await fetch(t.toString(),{method:"GET",headers:{"Content-Type":"application/json"}});if(!n.ok)if(n.status>=400&&n.status<500){const i=await n.json().catch(()=>null);throw new Error((i==null?void 0:i.message)||`Request failed: ${n.status} ${n.statusText}`)}else throw new Error(`Server error: ${n.status} ${n.statusText}`);return await n.json()}catch(t){throw t instanceof TypeError&&t.message.includes("fetch")?new Error("Cannot connect to API server. Make sure both servers are running (npm run dev)."):t}},async initiatePhoneOTP(e,t,r){try{const n={phone:e};r&&(n.captcha_token=r);const i=fe();i?n.state=i:H.log("======> Client: No state parameter available");const s=await fetch("/api/auth/phoneotp",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...n,apiKey:t,client_id:t})});if(H.log("======> Phone OTP initiation response:",s),!s.ok){const d=await s.json();throw new Error(d.message||"Failed to send phone OTP")}const l=await s.json();return H.log("======> Phone OTP initiation data:",l),l}catch(n){throw n instanceof TypeError&&n.message.includes("fetch")?new Error("Cannot connect to API server. Make sure both servers are running (npm run dev)."):n}},async verifyPhoneOTP(e,t,r){H.log("======> verifyPhoneOTP function called with:",{otp:e,apiKey:t,stateId:r});try{const n={otp:e},i=fe();H.log("======> Client verifyPhoneOTP state from URL:",oe.getStateFromURL()),H.log("======> Client verifyPhoneOTP OIDC flow detected:",oe.isOIDCFlow()),H.log("======> Client verifyPhoneOTP state info:",oe.getCurrentStateInfo()),i&&(n.state=i,H.log("======> Client verifyPhoneOTP sending state parameter in body:",i)),r&&(n.state_id=r,H.log("======> Client verifyPhoneOTP sending state_id in body:",r)),H.log("======> Client verifyPhoneOTP final request body:",n);const s=await fetch("/api/auth/phoneotp/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...n,apiKey:t})});if(H.log("======> Phone OTP verification response:",s),!s.ok){const d=await s.json();throw new Error(d.message||"Failed to verify phone OTP")}return await s.json()}catch(n){throw n instanceof TypeError&&n.message.includes("fetch")?new Error("Cannot connect to API server. Make sure both servers are running (npm run dev)."):n}},async resendPhoneOTP(e,t){H.log("======> resendPhoneOTP function called with:",{apiKey:e,stateId:t});try{const r={},n=fe();n&&(r.state=n),t&&(r.state_id=t,H.log("======> Client resendPhoneOTP sending state_id in body:",t)),H.log("======> Client resendPhoneOTP final request body:",r);const i=await fetch("/api/auth/phoneotp/resend",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...r,apiKey:e})});if(!i.ok){const l=await i.json();throw new Error(l.message||"Failed to resend phone OTP")}return await i.json()}catch(r){throw r instanceof TypeError&&r.message.includes("fetch")?new Error("Cannot connect to API server. Make sure both servers are running (npm run dev)."):r}},async initiateWhatsAppOTP(e,t,r){H.log("======> initiateWhatsAppOTP function called with:",{phoneNumber:e,apiKey:t,hasCaptcha:!!r});try{const n={phone:e};r&&(n.captcha_token=r);const i=fe();H.log("======> Client initiateWhatsAppOTP state from URL:",oe.getStateFromURL()),H.log("======> Client initiateWhatsAppOTP OIDC flow detected:",oe.isOIDCFlow()),H.log("======> Client initiateWhatsAppOTP state info:",oe.getCurrentStateInfo()),i&&(n.state=i,H.log("======> Client initiateWhatsAppOTP sending state parameter in body:",i)),H.log("======> Client initiateWhatsAppOTP final request body:",n);const s=await fetch("/api/auth/whatsappotp/send",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...n,apiKey:t})});if(H.log("======> WhatsApp OTP initiation response:",s),!s.ok){const d=await s.json();throw new Error(d.message||"Failed to send WhatsApp OTP")}const l=await s.json();return H.log("======> WhatsApp OTP initiation data:",l),l}catch(n){throw n instanceof TypeError&&n.message.includes("fetch")?new Error("Cannot connect to API server. Make sure both servers are running (npm run dev)."):n}},async verifyWhatsAppOTP(e,t,r){H.log("======> verifyWhatsAppOTP function called with:",{otp:e,apiKey:t,stateId:r});try{const n={otp:e},i=fe();H.log("======> Client verifyWhatsAppOTP state from URL:",oe.getStateFromURL()),H.log("======> Client verifyWhatsAppOTP OIDC flow detected:",oe.isOIDCFlow()),H.log("======> Client verifyWhatsAppOTP state info:",oe.getCurrentStateInfo()),i&&(n.state=i,H.log("======> Client verifyWhatsAppOTP sending state parameter in body:",i)),r&&(n.state_id=r,H.log("======> Client verifyWhatsAppOTP sending state_id in body:",r)),H.log("======> Client verifyWhatsAppOTP final request body:",n);const s=await fetch("/api/auth/whatsappotp/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...n,apiKey:t})});if(H.log("======> WhatsApp OTP verification response:",s),!s.ok){const d=await s.json();throw new Error(d.message||"Failed to verify WhatsApp OTP")}return await s.json()}catch(n){throw n instanceof TypeError&&n.message.includes("fetch")?new Error("Cannot connect to API server. Make sure both servers are running (npm run dev)."):n}},async resendWhatsAppOTP(e,t){H.log("======> resendWhatsAppOTP function called with:",{apiKey:e,stateId:t});try{const r={},n=fe();n&&(r.state=n),t&&(r.state_id=t,H.log("======> Client resendWhatsAppOTP sending state_id in body:",t)),H.log("======> Client resendWhatsAppOTP final request body:",r);const i=await fetch("/api/auth/whatsappotp/resend",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...r,apiKey:e})});if(H.log("======> WhatsApp OTP resend response:",i),!i.ok){const l=await i.json();throw new Error(l.message||"Failed to resend WhatsApp OTP")}return await i.json()}catch(r){throw r instanceof TypeError&&r.message.includes("fetch")?new Error("Cannot connect to API server. Make sure both servers are running (npm run dev)."):r}},async initializeWebAuthnSession(e,t,r){try{const n={session_id:e,user_id:t,apiKey:r},i=fe();return i&&(n.state=i),await(await fetch("/api/auth/webauthn/session/initialize",{method:"POST",headers:{"Content-Type":"application/json","X-Origin":window.location.origin},body:JSON.stringify(n)})).json()}catch(n){throw n instanceof TypeError&&n.message.includes("fetch")?new Error("Cannot connect to API server. Make sure both servers are running (npm run dev)."):n}},async skipWebAuthnRegistration(e,t,r){try{const n={session_id:e,user_id:t,apiKey:r},i=fe();return i&&(n.state=i),await(await fetch("/api/auth/webauthn/session/skip",{method:"POST",headers:{"Content-Type":"application/json","X-Origin":window.location.origin},body:JSON.stringify(n)})).json()}catch(n){throw n instanceof TypeError&&n.message.includes("fetch")?new Error("Cannot connect to API server. Make sure both servers are running (npm run dev)."):n}},async registerWebAuthnCredential(e,t){try{const r=fe();let n="/api/auth/webauthn/register";r&&(n+=`?state=${encodeURIComponent(r)}`);const i={"Content-Type":"application/json","X-Client-Id":t,"X-Origin":window.location.origin};return r&&(i.Authorization=`Bearer ${r}`),await(await fetch(n,{method:"POST",credentials:"include",headers:i,body:JSON.stringify(e)})).json()}catch(r){throw r instanceof TypeError&&r.message.includes("fetch")?new Error("Cannot connect to API server. Make sure both servers are running (npm run dev)."):r}},async initializePasskeyLogin(e,t,r){try{const n=fe(),i=new URL("/api/auth/passkey/login/initialize",window.location.origin);i.searchParams.set("identifier",e),n&&i.searchParams.set("state",n),r&&i.searchParams.set("captcha_token",r);const s={"Content-Type":"application/json",State:n||"","X-Origin":window.location.origin};return await(await fetch(i.toString(),{method:"GET",headers:s})).json()}catch(n){throw n instanceof TypeError&&n.message.includes("fetch")?new Error("Cannot connect to API server. Make sure both servers are running (npm run dev)."):n}},async finishPasskeyLogin(e,t,r,n){try{const i=fe(),s=new URL("/api/auth/passkey/login/finish",window.location.origin);s.searchParams.set("state_id",t),s.searchParams.set("identifier",r),i&&s.searchParams.set("state",i);const l={"Content-Type":"application/json","X-API-Key":n,"X-Origin":window.location.origin};return await(await fetch(s.toString(),{method:"POST",headers:l,body:JSON.stringify(e)})).json()}catch(i){throw i instanceof TypeError&&i.message.includes("fetch")?new Error("Cannot connect to API server. Make sure both servers are running (npm run dev)."):i}}
1,async checkPasskeyStatus(e){try{const t=fe(),r=new URL("/api/auth/passkey/status",window.location.origin);r.searchParams.set("identifier",e),t&&r.searchParams.set("state",t);const n={"Content-Type":"application/json","X-Origin":window.location.origin};return await(await fetch(r.toString(),{method:"GET",headers:n})).json()}catch(t){throw t instanceof TypeError&&t.message.includes("fetch")?new Error("Cannot connect to API server. Make sure both servers are running (npm run dev)."):t}}},bi={async getBranding(e){var t;try{const r=new URL("/api/branding",window.location.origin);r.searchParams.set("domain",e);const n=oe.getStateFromURL();n&&r.searchParams.set("state",n);const i=new URL(window.location.href),s=i.searchParams.get("env");s&&r.searchParams.set("env",s);const l=i.searchParams.get("lang");l&&r.searchParams.set("lang",l);const d=(t=navigator.languages)!=null&&t.length?navigator.languages.join(","):navigator.language||"",_=r.toString(),g=yi(_,d),k=mi(g),b=async()=>{const x=await fetch(_,{headers:d?{"Accept-Language":d}:void 0}),c=x.headers.get("content-type");if(!c||!c.includes("application/json"))throw new Error("Server returned non-JSON response. Make sure the API server is running.");return{payload:await x.json(),ok:x.ok}};let h;try{h=await b()}catch(x){const c=_i({live:null,liveFailed:!0,cached:k});if(c)return H.debug("Branding live fetch failed; using cached copy",x),c;throw x}return h.ok&&vi(g,h.payload),h.payload}catch(r){throw r instanceof TypeError&&r.message.includes("fetch")?new Error("Cannot connect to API server. Make sure both servers are running (npm run dev)."):r}}};class le{static normalizePath(t){return t.startsWith("/")||(t=`/${t}`),t=t.replace(/^\/v1\/u\/v1\/u\//,"/v1/u/"),t==="/v1/u"||t.startsWith("/v1/u/"),t}static isVersionedPath(){return window.location.pathname==="/v1/u"||window.location.pathname.startsWith("/v1/u/")}static getPath(t){return t=this.normalizePath(t),t==="/v1/u"||t.startsWith("/v1/u/")?t:this.isVersionedPath()?`/v1/u${t}`:t}static buildUrl(t,r=!0){const n=this.getPath(t);if(r){const i=new URLSearchParams(window.location.search);return i.toString()?`${n}?${i.toString()}`:n}return n}static navigateTo(t,r=!0){const n=this.buildUrl(t,r);window.location.href=n}}const Se="/assets/ssojet-logo-BQyuwePq.svg",Kt=({mode:e="login"})=>{var Co,So,Po,To,Eo,Io,Oo,Lo,Ao,Ro,jo,$o,zo,Mo,Bo,Wo,No;const[t,r]=F(""),[n,i]=F(null),[s,l]=F(""),d=We(null),_=We(null),[g,k]=F(""),[b,h]=F(!1),[x,c]=F(null),[P,M]=F(!1),[B,D]=F(null),[q,V]=F(!1),[W,A]=F("email"),{branding:a,setEmail:T,setPhone:w,setStateId:L}=ge(),j=y=>{if(!y.trim())return null;const z=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,$=[/^\+?[1-9]\d{1,14}$/,/^\+?1?[2-9]\d{2}[2-9]\d{2}\d{4}$/,/^\+?44[1-9]\d{8,9}$/,/^\+?91[6-9]\d{9}$/,/^\+?61[4,5]\d{8}$/,/^\d{10}$/,/^\d{11}$/],U=y.replace(/[\s\-\(\)\.]/g,"");return z.test(y.trim())?"email":$.some(G=>G.test(U))||U.length>=10&&/^\+?\d+$/.test(U)?"phone":null},O=y=>{var z;if(r(y),(z=a==null?void 0:a.auth_config)!=null&&z.is_phone_login_enabled)i(W);else{const $=j(y);i($)}},E=(y,z)=>{l(y),r(y),i("phone")},R=()=>{const y=W==="email"?"phone":"email";A(y),r(""),l(""),k(""),i(y),setTimeout(()=>{y==="phone"&&d.current?d.current.focus():y==="email"&&_.current&&_.current.focus()},0)};ee(()=>{me.get("provider"),me.get("redirect_url"),me.get("oidcstate")},[]),ee(()=>{var $,U;new URLSearchParams(window.location.search).get("preferred_auth_method")==="phone"&&(($=a==null?void 0:a.auth_config)!=null&&$.is_phone_login_enabled||(U=a==null?void 0:a.auth_config)!=null&&U.is_whatsapp_login_enabled)&&(A("phone"),i("phone"))},[(Co=a==null?void 0:a.auth_config)==null?void 0:Co.is_phone_login_enabled,(So=a==null?void 0:a.auth_config)==null?void 0:So.is_whatsapp_login_enabled]),ee(()=>{const z=new URLSearchParams(window.location.search).get("identifier");if(!z)return;const $=z.includes("@")?z.trim().replace(/\s+/g,"+"):z.trim();if(!$)return;j($)==="phone"?(A("phone"),l($),i("phone")):(A("email"),i("email")),r($)},[]),ee(()=>{var z,$,U;const y=((z=a==null?void 0:a.data)==null?void 0:z.data)||(a==null?void 0:a.data)||{};if(Object.keys(y).length>0){const G=document.documentElement;if(y.btn_color&&(G.style.setProperty("--primary-color",y.btn_color),G.style.setProperty("--button-background",y.btn_color)),y.text_color&&G.style.setProperty("--button-text-color",y.text_color),y.background&&G.style.setProperty("--card-background",y.background),y.page_background&&(G.style.setProperty("--page-background",y.page_background),document.body.style.backgroundColor=y.page_background),y.button_border&&G.style.setProperty("--button-border-color",y.button_border),y.icon_color&&G.style.setProperty("--icon-color",y.icon_color),($=y.font)!=null&&$.family&&(G.style.setProperty("--font-family",y.font.family),document.body.style.fontFamily=y.font.family),(U=y.font)!=null&&U.url){const Q=document.createElement("link");Q.rel="stylesheet",Q.href=y.font.url,document.head.appendChild(Q)}if(y.favicon){const Q=document.querySelector('link[rel="icon"]')||document.createElement("link");Q.rel="icon",Q.href=y.favicon,document.querySelector('link[rel="icon"]')||document.head.appendChild(Q)}y.brand&&(document.title=e==="signup"?`Sign up - ${y.brand}`:`Sign in - ${y.brand}`)}},[a,e]),ee(()=>{var $;const y=(($=a==null?void 0:a.data)==null?void 0:$.auth_config)||(a==null?void 0:a.auth_config)||{},z=y==null?void 0:y.captcha;if(z!=null&&z.enabled&&z.provider==="cloudflare_turnstile"){const U=z.script_url||"https://challenges.cloudflare.com/turnstile/v0/api.js";if(document.querySelector(`script[src="${U}"]`)){V(!0);return}const G=document.createElement("script");return G.src=U,G.async=!0,G.defer=!0,G.onload=()=>{V(!0)},G.onerror=()=>{ve.error("Failed to load Cloudflare Turnstile script"),k("Failed to load captcha. Please refresh the page.")},document.head.appendChild(G),()=>{const Q=document.querySelector(`script[src="${U}"]`);Q&&Q.remove()}}},[(Po=a==null?void 0:a.auth_config)==null?void 0:Po.captcha]),ee(()=>{var $,U,G,Q,ue;const y=(($=a==null?void 0:a.data)==null?void 0:$.auth_config)||(a==null?void 0:a.auth_config)||{},z=y==null?void 0:y.captcha;if(q&&(z!=null&&z.enabled)&&z.provider==="cloudflare_turnstile"&&window.turnstile){const ce=document.getElementById("cf-turnstile-widget");if(ce&&!ce.hasChildNodes())try{window.turnstile.render(ce,{sitekey:((U=z.config)==null?void 0:U.key)||"",theme:((G=z.config)==null?void 0:G.theme)||"light",size:((Q=z.config)==null?void 0:Q.size)||"normal",language:((ue=z.config)==null?void 0:ue.language)||"auto",callback:ye=>{D(ye),k("")},"error-callback":()=>{D(null),k("Captcha verification failed. Please try again.")},"expired-callback":()=>{D(null),k("Captcha expired. Please verify again.")}})}catch(ye){ve.error("Error initializing Turnstile widget:",ye),k("Failed to initialize captcha. Please refresh the page.")}}},[q,(To=a==null?void 0:a.auth_config)==null?void 0:To.captcha]);const I=()=>{var z,$;const y=((z=a==null?void 0:a.data)==null?void 0:z.auth_config)||(a==null?void 0:a.auth_config)||{};if(window.turnstile&&(($=y==null?void 0:y.captcha)!=null&&$.enabled))try{window.turnstile.reset(),D(null)}catch(U){ve.error("Error resetting captcha:",U)}},p=y=>{var z,$,U,G,Q,ue,ce,ye,Pe;try{c(y.key),k("");const xe=new URLSearchParams(window.location.search).get("state"),ne=ge.getState().getApiKey()||(($=(z=a==null?void 0:a.data)==null?void 0:z.data)==null?void 0:$.client_id)||((G=(U=a==null?void 0:a.data)==null?void 0:U.data)==null?void 0:G.api_key)||((Q=a==null?void 0:a.data)==null?void 0:Q.client_id)||((ue=a==null?void 0:a.data)==null?void 0:ue.api_key);if(!ne)throw new Error("API key not found. Please refresh the page and try again.");me.set("provider",y.key,5/1440);const ke=`${window.location.origin}/oauth/callback/${ne}`;me.set("redirect_url",ke,5/1440),xe&&me.set("oidcstate",xe,5/1440);const Ce=((ye=(ce=a==null?void 0:a.data)==null?void 0:ce.data)==null?void 0:ye.social_provider_login_url)||((Pe=a==null?void 0:a.data)==null?void 0:Pe.social_provider_login_url)||(a==null?void 0:a.social_provider_login_url)||(S==null?void 0:S.social_provider_login_url);if(Ce){const Ue=new URL(Ce,window.location.origin);Ue.searchParams.set("connection_id",y.connectionId||""),window.location.href=Ue.toString();return}const Te=new URL("/api/auth/oauth/social",window.location.origin);Te.searchParams.set("provider",y.key),Te.searchParams.set("connection_id",y.connectionId||""),xe&&Te.searchParams.set("state",xe),window.location.href=Te.toString()}catch(we){ve.error("Error initiating social login:",we),k(we instanceof Error?we.message:"Failed to initiate social login. Please try again."),c(null)}},v=y=>{const z="=".repeat((4-y.length%4)%4),$=(y+z).replace(/-/g,"+").replace(/_/g,"/"),U=atob($),G=new Uint8Array(U.length);for(let Q=0;Q<U.length;Q++)G[Q]=U.charCodeAt(Q);return G.buffer},u=y=>{const z=new Uint8Array(y),$=Array.from(z).map(G=>String.fromCharCode(G)).join("");return btoa($).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},f=y=>({id:y.id,rawId:u(y.rawId),response:{authenticatorData:u(y.response.authenticatorData),signature:u(y.response.signature),userHandle:y.response.userHandle?u(y.response.userHandle):null,clientDataJSON:u(y.response.clientDataJSON)},type:y.type}),C=async()=>{var $,U,G,Q,ue,ce,ye,Pe,we,xe;if(!t.trim()){const ne=(($=a==null?void 0:a.data)==null?void 0:$.auth_config)||(a==null?void 0:a.auth_config)||{},Ce=(ne==null?void 0:ne.is_phone_login_enabled)?"Enter your email or phone number to enable passkey login":"Enter your email to enable passkey login";k(Ce);return}const y=((U=a==null?void 0:a.data)==null?void 0:U.auth_config)||(a==null?void 0:a.auth_config)||{},z=y==null?void 0:y.captcha;if(z!=null&&z.enabled&&!B){k("Please complete the captcha verification.");return}M(!0),k("");try{const ne=((Q=(G=a==null?void 0:a.data)==null?void 0:G.data)==null?void 0:Q.client_id)||((ce=(ue=a==null?void 0:a.data)==null?void 0:ue.data)==null?void 0:ce.api_key)||((ye=a==null?void 0:a.data)==null?void 0:ye.client_id)||((Pe=a==null?void 0:a.data)==null?void 0:Pe.api_key)||"",ke=t.trim(),Ce=await de.initializePasskeyLogin(ke,ne,B||void 0);if(!Ce.status||!Ce.data)throw new Error(Ce.message||"Failed to initialize passkey login");const{publicKey:Te,state_id:Ue}=Ce.data,_t={...Te,challenge:v(Te.challenge),allowCredentials:((we=Te.allowCredentials)==null?void 0:we.map(Le=>({...Le,id:v(Le.id)}
1)))||[]},et=await navigator.credentials.get({publicKey:_t});if(!et)throw new Error("Passkey authentication was cancelled");const gt=f(et),De=await de.finishPasskeyLogin(gt,Ue,ke,ne);if(De.status&&((xe=De.data)!=null&&xe.redirect_url))window.location.href=De.data.redirect_url;else throw new Error(De.message||"Passkey login failed")}catch(ne){ve.error("Passkey login error:",ne),I(),ne.name==="NotAllowedError"?k("Passkey authentication was cancelled or not allowed."):ne.name==="NotSupportedError"?k("Passkeys are not supported on this device or browser."):ne.name==="SecurityError"?k("Security error during passkey authentication."):k(ne.message||"Passkey login failed. Please try again.")}finally{M(!1)}},N=async y=>{var G,Q,ue,ce,ye,Pe,we,xe;y.preventDefault();const z=s.trim();if(!z){k("Please enter your phone number.");return}const $=((G=a==null?void 0:a.data)==null?void 0:G.auth_config)||(a==null?void 0:a.auth_config)||{},U=$==null?void 0:$.captcha;if(U!=null&&U.enabled&&!B){k("Please complete the captcha verification.");return}h(!0),k("");try{const ne=((ue=(Q=a==null?void 0:a.data)==null?void 0:Q.data)==null?void 0:ue.client_id)||((ye=(ce=a==null?void 0:a.data)==null?void 0:ce.data)==null?void 0:ye.api_key)||((Pe=a==null?void 0:a.data)==null?void 0:Pe.client_id)||((we=a==null?void 0:a.data)==null?void 0:we.api_key)||"",ke=await de.initiateWhatsAppOTP(z,ne,B||void 0);if(ke.status)w(z),(xe=ke.data)!=null&&xe.state_id&&L(ke.data.state_id),le.navigateTo("/whatsapp-verify");else throw new Error(ke.message||"Failed to send WhatsApp OTP")}catch(ne){ve.error("WhatsApp OTP error:",ne),k(ne.message||"Failed to send WhatsApp OTP. Please try again.")}finally{h(!1)}},X=async y=>{var G,Q,ue,ce,ye,Pe,we,xe,ne,ke,Ce,Te,Ue,_t,et,gt,De;if(y.preventDefault(),!(W==="phone"?s:t.trim())){k(W==="phone"?"Please enter your phone number.":"Please enter your email address.");return}const $=((G=a==null?void 0:a.data)==null?void 0:G.auth_config)||(a==null?void 0:a.auth_config)||{},U=$==null?void 0:$.captcha;if(U!=null&&U.enabled&&!B){k("Please complete the captcha verification.");return}h(!0),k("");try{const Le=((Q=a==null?void 0:a.data)==null?void 0:Q.api_key)||(a==null?void 0:a.client_id)||"",nn=$==null?void 0:$.is_phone_login_enabled,Vi=$==null?void 0:$.is_whatsapp_login_enabled;if(W==="phone"&&nn){const yt=s,Je=await de.initiatePhoneOTP(yt,Le,B||void 0);if(Je.status){w(yt);const _e=((ue=Je.data)==null?void 0:ue.session_id)||((ce=Je.data)==null?void 0:ce.state_id);_e&&L(_e),le.navigateTo("/phone-verify")}else throw new Error(Je.message||"Failed to send phone OTP")}else{const yt=[(Pe=(ye=a==null?void 0:a.data)==null?void 0:ye.data)==null?void 0:Pe.is_magic_code_login_enabled,(we=a==null?void 0:a.data)==null?void 0:we.is_magic_code_login_enabled,$==null?void 0:$.is_magic_code_login_enabled,(ne=(xe=a==null?void 0:a.data)==null?void 0:xe.data)==null?void 0:ne.is_email_otp_login_enabled,(ke=a==null?void 0:a.data)==null?void 0:ke.is_email_otp_login_enabled,$==null?void 0:$.is_email_otp_login_enabled].some(_e=>_e===!0),Je=[(Te=(Ce=a==null?void 0:a.data)==null?void 0:Ce.data)==null?void 0:Te.is_magic_link_login_enabled,(Ue=a==null?void 0:a.data)==null?void 0:Ue.is_magic_link_login_enabled,$==null?void 0:$.is_magic_link_login_enabled].some(_e=>_e===!0);if(yt){const _e=await de.initiateEmailOTP(t.trim(),Le,B||void 0);if(_e.status){T(t.trim());const tt=((_t=_e.data)==null?void 0:_t.session_id)||((et=_e.data)==null?void 0:et.state_id);tt&&L(tt),le.navigateTo("/login/otp")}else throw new Error(_e.message||"Failed to send OTP")}else if(Je){const _e=await de.initiateMagicLink(t.trim(),Le,B||void 0);if(_e.status){T(t.trim());const tt=((gt=_e.data)==null?void 0:gt.session_id)||((De=_e.data)==null?void 0:De.state_id);tt&&L(tt),le.navigateTo("/magiclink")}else throw new Error(_e.message||"Failed to send magic link")}else throw new Error("No valid email login method enabled for this application.")}}catch(Le){k(Le instanceof Error?Le.message:"An error occurred"),I()}finally{h(!1)}},K=(y,z)=>{var G,Q,ue;const $=y.split(".");let U=((Q=(G=a==null?void 0:a.data)==null?void 0:G.data)==null?void 0:Q.localization)||((ue=a==null?void 0:a.data)==null?void 0:ue.localization)||(a==null?void 0:a.localization);for(const ce of $)if(U&&typeof U=="object"&&ce in U)U=U[ce];else return z;if(typeof U=="string"){const ce=U.trim();return ce.length>0?ce:z}return typeof U=="string"?U:z},he=(y,z,$)=>{const U=K(y,z);return $&&U.includes("%s")?U.replace("%s",$):U},m=((Eo=a==null?void 0:a.data)==null?void 0:Eo.data)||(a==null?void 0:a.data)||{},be=e==="signup"?"signup":"login",He=e==="signup"?"/login":"/signup",lt=e==="signup"?"
1Sign in":"Create account",J=(y,z)=>K(`${be}.${y}`,z),pe=(y,z,$)=>he(`${be}.${y}`,z,$),ct=he(`${be}.heading`,"Sign in to your account",m.brand),Ve=he(`${be}.sub_heading`,"",m.brand),S=((Io=a==null?void 0:a.data)==null?void 0:Io.auth_config)||(a==null?void 0:a.auth_config)||{},Xe=(m==null?void 0:m.social_providers)||(S==null?void 0:S.social_providers)||[],dt=new Map;((S==null?void 0:S.social)||[]).forEach(y=>{const z=y.toLowerCase(),$=Xe.find(U=>((U==null?void 0:U.Name)||(U==null?void 0:U.name)||"").toLowerCase()===z);dt.set(z,{name:y,key:z,connectionId:($==null?void 0:$.ConnectionId)||($==null?void 0:$.connection_id)||""})}),Xe.forEach(y=>{const z=(y==null?void 0:y.Name)||(y==null?void 0:y.name)||"";if(!z)return;const $=z.toLowerCase();dt.has($)||dt.set($,{name:z,key:$,connectionId:(y==null?void 0:y.ConnectionId)||(y==null?void 0:y.connection_id)||""})});const Jr=Array.from(dt.values()),je=y=>{if(typeof y=="boolean")return y;if(typeof y=="number")return y===1?!0:y===0?!1:null;if(typeof y=="string"){const z=y.trim().toLowerCase();if(["true","1","yes","enabled","on"].includes(z))return!0;if(["false","0","no","disabled","off"].includes(z))return!1}return null},_o=(m==null?void 0:m.button_position)||(S==null?void 0:S.button_position)||(m==null?void 0:m.social_position)||(S==null?void 0:S.social_position)||(m==null?void 0:m.social_login_position)||(S==null?void 0:S.social_login_position)||"",go=typeof _o=="string"?_o.trim().toLowerCase():"",yo=je((m==null?void 0:m.is_social_login_first_enabled)??(S==null?void 0:S.is_social_login_first_enabled)??(m==null?void 0:m.social_login_first)??(S==null?void 0:S.social_login_first)??(m==null?void 0:m.is_social_first_enabled)??(S==null?void 0:S.is_social_first_enabled)),mo=yo!==null?yo?"top":"bottom":go==="top"||go==="social_first"?"top":"bottom",Rt=(m==null?void 0:m.is_sso_enabled)??(S==null?void 0:S.is_sso_enabled)??!1,Ze=(m==null?void 0:m.is_phone_login_enabled)??(S==null?void 0:S.is_phone_login_enabled)??!1,qe=(m==null?void 0:m.is_whatsapp_login_enabled)??(S==null?void 0:S.is_whatsapp_login_enabled)??!1,jt=[m==null?void 0:m.is_passkey_login_enabled,S==null?void 0:S.is_passkey_login_enabled,m==null?void 0:m.webauthn,S==null?void 0:S.webauthn].some(y=>y===!0),Ee=((Oo=S==null?void 0:S.captcha)==null?void 0:Oo.enabled)??!1,$t=(m==null?void 0:m.terms_conditions_url)||((Lo=m==null?void 0:m.auth_config)==null?void 0:Lo.terms_conditions_url)||(S==null?void 0:S.terms_conditions_url)||((Ao=a==null?void 0:a.data)==null?void 0:Ao.terms_conditions_url)||((jo=(Ro=a==null?void 0:a.data)==null?void 0:Ro.data)==null?void 0:jo.terms_conditions_url)||(a==null?void 0:a.terms_conditions_url)||"",ut=(m==null?void 0:m.privacy_policy_url)||(($o=m==null?void 0:m.auth_config)==null?void 0:$o.privacy_policy_url)||(S==null?void 0:S.privacy_policy_url)||((zo=a==null?void 0:a.data)==null?void 0:zo.privacy_policy_url)||((Bo=(Mo=a==null?void 0:a.data)==null?void 0:Mo.data)==null?void 0:Bo.privacy_policy_url)||(a==null?void 0:a.privacy_policy_url)||"",Z=(m==null?void 0:m.login_ui)||(S==null?void 0:S.login_ui)||{},zt=je((Z==null?void 0:Z.show_email_input_icon)??(m==null?void 0:m.show_email_input_icon)??(S==null?void 0:S.show_email_input_icon))??!0;je((Z==null?void 0:Z.show_trust_note)??(m==null?void 0:m.show_trust_note)??(S==null?void 0:S.show_trust_note));const Kr=je((Z==null?void 0:Z.show_passkey_speed_badge)??(m==null?void 0:m.show_passkey_speed_badge)??(S==null?void 0:S.show_passkey_speed_badge))??!0,pt=je((Z==null?void 0:Z.show_combined_auth_options)??(m==null?void 0:m.show_combined_auth_options)??(S==null?void 0:S.show_combined_auth_options))??!1,ht=pt&&Rt?{name:J("enterprise_login_short_text","SSO"),key:"sso",connectionId:"",type:"sso"}:null,Ne=[...Jr.map(y=>({...y,type:"social"}))],Mt=[...ht?[ht]:[],...Ne],Gr=Math.max(1,Math.min(3,Ne.length)),Qe=pt&&Ne.length>0,vo=Qe&&Ne.length>3?`${Math.min(920,422+(Ne.length-3)*120)}px`:void 0,Yr=mo==="top"&&Mt.length>0,Bt=mo==="bottom"&&Mt.length>0,Wt=!pt&&Rt&&(je((Z==null?void 0:Z.show_sso_card)??(m==null?void 0:m.show_sso_card)??(S==null?void 0:S.show_sso_card))??!1);je((Z==null?void 0:Z.show_help_doc_link)??(m==null?void 0:m.show_help_doc_link)??(S==null?void 0:S.show_help_doc_link)),Z!=null&&Z.documentation_url||m!=null&&m.documentation_url||S!=null&&S.documentation_url||m!=null&&m.help_center_url||S!=null&&S.help_center_url;const bo=je((Z==null?void 0:Z.show_compliance_footer)??(m==null?void 0:m.show_compliance_footer)??(S==null?void 0:S.show_compliance_footer))??!0,ft=(Z==null?void 0:Z.compliance_badges_text)??(m==null?void 0:m.compliance_badges_text)??(S==null?void 0:S.compliance_badges_text)??(Z==null?void 0:Z.compliance_badges)??(m==null?void 0:m.compliance_badges)??(S==null?void 0:S.compliance_badges)??K("common.compliance_badges_text",K("common.compliance_badges","SO
1C 2 Type II|GDPR Compliant|ISO 27001")),Nt=Array.isArray(ft)?ft.filter(y=>typeof y=="string"&&y.trim().length>0):typeof ft=="string"?ft.split(/[|,]/).map(y=>y.trim()).filter(y=>y.length>0):[],Xr=Bt||jt,Zr=jt||Bt||Wt,Qr=J("or_continue_with","or continue with"),wo=J("send_verification_code_button_text","Continue with Email"),en=J("passkey_fastest_badge","Fastest"),tn=J("enterprise_login_prefix","Enterprise login?"),xo=(Z==null?void 0:Z.enterprise_login_button_text)??(m==null?void 0:m.enterprise_login_button_text)??(S==null?void 0:S.enterprise_login_button_text)??(Z==null?void 0:Z.enterprise_login_button)??(m==null?void 0:m.enterprise_login_button)??(S==null?void 0:S.enterprise_login_button),on=xo||J("enterprise_login_cta","Continue with SSO"),rn=J("continue_with_sso_text",xo||pe("continue_with_provider","Continue with %s","SSO")),Ut=y=>{const z=y.type==="sso",$=!z&&x===y.key,U=x!==null||b||P,G=y.name.split(" ").map(ue=>ue.charAt(0).toUpperCase()+ue.slice(1)).join(" "),Q=Qe&&Ne.length>1?G:pe("continue_with_provider","Continue with %s",G);return o("button",{class:`${y.key} social-provider ${$?"btn-loading":""}`,style:{backgroundColor:"transparent",color:"#111827",borderColor:m.button_border||"#c1c7cd",border:`1px solid ${m.button_border||"#e5e7eb"}`,borderRadius:"6px",opacity:U&&!$?.6:1,cursor:U?"not-allowed":"pointer",marginBottom:"0",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"},onClick:()=>z?le.navigateTo("/sso"):p(y),disabled:U,children:$?o(te,{children:[o(se,{}),o("div",{children:"Connecting..."})]}):o("span",{class:"social-provider-content",children:[o("span",{class:"icon"}),o("span",{class:"social-provider-label",children:z?rn:Q})]})},y.key)},ko=()=>Qe?o(te,{children:[o("div",{class:"social-provider-grid",style:{gridTemplateColumns:`repeat(${Gr}, minmax(0, 1fr))`},children:Ne.map(y=>Ut(y))}),ht&&Ut(ht)]}):Mt.map(y=>Ut(y));return o("div",{class:"signin-pageLayout-wrapper v-middle login-page-layout",children:[o("div",{class:"signin-pageLayout-bg",style:{backgroundColor:m.page_background||"#f2f4f8"}}),o("div",{class:"signin-pageLayout",style:{backgroundColor:m.background||"#fff",borderColor:m.button_border||"#c1c7cd",...vo?{maxWidth:vo}:{}},children:o("div",{class:"login-card",style:{backgroundColor:m.theme.background||"transparent",borderColor:m.button_border||"transparent"},children:[o("div",{class:"header",children:[o("div",{class:"logo",children:o("img",{src:m.brand_logo||"https://cdn.ssojet.com/assets/logo.png",alt:m.brand||"SSOJet",class:"logo"})}),o("div",{class:"login-card-title",children:o("div",{class:"title",children:[o("h1",{style:{marginBottom:Ve?"8px":"0"},children:ct}),Ve&&o("p",{style:{color:"#6b7280",opacity:.8,marginTop:"0"},children:Ve})]})})]}),o("div",{class:"login-card-form",children:[Yr&&o(te,{children:[o("div",{class:`social-login-buttons login-social-top-buttons ${Qe?"adaptive-social-layout":""}`,style:{marginBottom:"0px"},children:ko()}),o("div",{class:"divider login-primary-divider",style:{margin:"12px 0 20px"},children:J("or","or")||"or"})]}),o("form",{onSubmit:X,children:[o("div",{class:"form-control",children:[(Ze||qe)&&o("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"4px",width:"100%"},children:[o("label",{style:{fontSize:"13px",fontWeight:"500",color:"#111827",display:"flex",margin:"0",flex:"0 0 auto"},children:W==="email"?J("input.label","Work email"):J("phone_input.label","Phone Number")}),o("button",{type:"button",onClick:R,style:{background:"none",border:"none",color:"#9ca3af",cursor:"pointer",fontSize:"13px",padding:"0",display:"flex",alignItems:"center",gap:"4px",flex:"0 0 auto",marginLeft:"auto",whiteSpace:"nowrap"},children:W==="email"?o(te,{children:[o("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",children:o("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"})}),J("use_phone_number_text","Use Phone Number")]}):o(te,{children:[o("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",children:[o("path",{d:"M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"}),o("polyline",{points:"22,6 12,13 2,6"})]}),J("use_email_text","Use Email")]})})]}),W==="phone"&&(Ze||qe)?o("div",{children:o(si,{value:s,onChange:l,onPhoneChange:E,inputRef:d,placeholder:J("phone_input.placeholder","812XX XXXX9"),disabled:b||x!==null||P,hideLabel:!0,style:{borderColor:m.button_border||"#c1c7cd"}})}):o("div",{children:[!(Ze||qe)&&o("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"4px",width:"100%"},children:o("label",{style:{fontSize:"13px",display:"flex",fontWeight:"500",color:"#374151",margin:"0",flex:"0 0 auto"},children:J("input.label","Work email")})}),o("div",{class:`login-enhanced-input-wrap ${zt?"has-leading-icon":""}`,children:[zt&&o("span",{class:"login-enhanced-input-icon","aria-hidden":"true",children:o("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o("rect",{x:"3",y:"5",width:"18",height:"14",rx:"2"}),o("polyline",{points:"3 7 12 13 21 7"})]})}),o("input",{id:"input",ref:_,type:"email",value:t,maxLength:255,onChange:y=>O(y.target.value),placeholder:J("input.placeholder","[email protected]"),required:!0,disabled:b||x!==null||P,style:{borderColor:m.button_border||"#c1c7cd",width:"100%",padding:zt?"12px 16px 12px 44px":"12px 16px",fontSize:"16px",border:`1px solid ${m.button_border||"#c1c7cd"}`,borderRadius:"6px",outline:"none",transition:"border-color 0.2s ease-in-out"},onFocus:y=>{y.target.style.borderColor=m.btn_color||"#1d4ed8"},onBlur:y=>{y.target.style.borderColor=m.button_border||"#c1c7cd"}})]})]}),g&&o("div",{class:"form-error",style:{color:"#e74c3c"},children:g})]}),((Wo=S==null?void 0:S.captcha)==null?void 0:Wo.enabled)&&((No=S==null?void 0:S.captcha)==null?void 0:No.provider)==="cloudflare_turnstile"&&o("div",{class:"form-control",children:o("div",{id:"cf-turnstile-widget"})}),!(W==="phone"&&qe&&!Ze)&&o("div",{class:"form-control",style:{marginTop:Ee?"0":"20px"},children:o("button",{type:"submit",class:`btn btn-primary w-full ${b?"btn-loading":""}`,disabled:b||x!==null||P||Ee&&!B,style:{backgroundColor:m.btn_color||"#6a7bd2",color:m.text_color||"#fff",borderColor:m.btn_color||"#6a7bd2",opacity:x!==null||P||Ee&&!B?.6:1,cursor:b||x!==null||P||Ee&&!B?"not-allowed":"pointer"},children:b?o(te,{children:o(se,{})}):x!==null?o(te,{children:o(se,{})}):P?o(te,{children:o(se,{})}):Ze||qe?W==="email"?o("span",{class:"login-primary-cta-content",children:J("continue_with_email_button_text",wo)}):J("continue_with_phone_button_text","Continue with Phone"):o("span",{class:"login-primary-cta-content",children:J("button.text",wo)})})})]}),W==="phone"&&qe&&o("div",{style:{marginTop:"0px"},children:o("button",{type:"button",onClick:N,disabled:b||x!==null||P||!s.trim()||Ee&&!B,class:"btn btn-primary w-full",style:{backgroundColor:"#25D366",color:"#fff",borderColor:"#25D366",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",opacity:b||x!==null||P||!s.trim()||Ee&&!B?.6:1,cursor:b||x!==null||P||!s.trim()||Ee&&!B?"not-allowed":"pointer"},children:b?o(te,{children:o(se,{})}):o(te,{children:[o("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",children:o("path",{d:"M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.
1198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.890-5.335 11.893-11.893A11.821 11.821 0 0020.465 3.085",fill:"currentColor"})}),J("continue_with_phone_button_text","Continue with WhatsApp")]})})}),Zr&&o("div",{class:"login-secondary-auth-section",children:[Xr&&o("div",{class:"divider login-alt-divider",style:{margin:"16px 0 12px"},children:Qr}),jt&&o("div",{class:"form-control login-passkey-row",style:{marginBottom:"1px"},children:o("button",{type:"button",class:`btn btn-secondary w-full passkey-login-btn ${P?"btn-loading":""}`,onClick:C,disabled:b||x!==null||P||Ee&&!B,style:{backgroundColor:"transparent",color:"#111827",borderColor:m.button_border||"#c1c7cd",border:`1px solid ${m.button_border||"#c1c7cd"}`,opacity:b||x!==null||Ee&&!B?.6:1,cursor:b||x!==null||P||Ee&&!B?"not-allowed":"pointer",display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px"},children:P?o(te,{children:[o(se,{}),"Authenticating with Passkey..."]}):o(te,{children:[o("span",{class:"passkey-btn-main",children:[o("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:o("path",{d:"M21 2l-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0l3 3L22 7l-3-3m-3.5 3.5L19 4"})}),J("sign_in_with_passkeys_text","Continue with Passkey")]}),Kr&&o("span",{class:"passkey-speed-badge",children:en})]})})}),Bt&&o("div",{class:`social-login-buttons login-social-bottom-buttons ${Qe?"adaptive-social-layout":""}`,style:{marginBottom:"0px"},children:ko()}),Wt&&o("div",{class:"login-sso-card",children:[o("div",{class:"login-sso-card-left",children:[o("div",{class:"login-sso-card-icon",children:o("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),o("path",{d:"M8 20v-4"}),o("path",{d:"M12 20v-4"}),o("path",{d:"M16 20v-4"}),o("path",{d:"M8 10h.01"}),o("path",{d:"M12 10h.01"}),o("path",{d:"M16 10h.01"})]})}),o("div",{class:"login-sso-card-text",children:[o("div",{class:"title",children:J("sso_card_title","Use your company account")}
1),o("div",{class:"description",children:J("sso_card_subtitle","Sign in with SAML / OIDC / Enterprise SSO")})]})]}),o("button",{type:"button",class:"login-sso-card-btn",onClick:()=>le.navigateTo("/sso"),style:{color:m.btn_color||"#1d4ed8",borderColor:m.btn_color||"#1d4ed8"},children:[o("span",{children:J("sso_card_cta","Sign in with SSO")}),o("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[o("path",{d:"M5 12h14"}),o("path",{d:"M13 5l7 7-7 7"})]})]})]})]}),o("div",{class:"login-support-links",children:[!Wt&&Rt&&!pt&&o("div",{children:[o("span",{children:[tn," "]}),o("a",{href:"#",onClick:y=>{y.preventDefault(),le.navigateTo("/sso")},style:{color:m.btn_color||"#1d4ed8",textDecoration:"none",fontWeight:"500"},children:on})]}),o("div",{children:[J("no_account_text",e==="signup"?"Already have an account?":"Donât have an account?")," ",o("a",{href:"#",onClick:y=>{y.preventDefault(),le.navigateTo(He)},style:{color:m.btn_color||"#1d4ed8",textDecoration:"none",fontWeight:"500"},children:J("create_account_text",e==="signup"?lt:"Create a free account")})]})]}),($t||ut)&&o("div",{class:"term-links",style:{marginTop:"20px",fontSize:"12px",color:"#666",textAlign:"center",lineHeight:"1.4"},children:[J("footer_prefix","By continuing, you agree to the")," ",$t&&o(te,{children:[o("a",{href:$t,target:"_blank",style:{color:m.btn_color||"#6a7bd2",textDecoration:"none"},children:J("terms_label","Terms")}),ut&&" and "]}),ut&&o("a",{href:ut,target:"_blank",style:{color:m.btn_color||"#6a7bd2",textDecoration:"none"},children:J("privacy_label","Privacy Policy")})," ","."]})]})]})}),!m.white_label&&o("div",{class:`footer ${bo&&Nt.length>0?"footer-with-compliance":""}`,children:[o("div",{class:"footer-brand-row",children:[o("span",{style:{fontSize:"12px",color:"#666"},children:K("common.secured_by","Secured by")}),o("a",{href:"https://ssojet.com",target:"_blank",rel:"noreferrer",style:{display:"inline-flex",alignItems:"center",textDecoration:"none",color:"#000",fontWeight:"600",marginLeft:"6px"},children:o("img",{src:Se,alt:"SSOJet",height:"18",style:{opacity:.5}})})]}),bo&&Nt.length>0&&o("div",{class:"footer-compliance-row",children:Nt.map((y,z)=>o(te,{children:[z>0&&o("span",{class:"footer-compliance-sep",children:"â¢"}),o("span",{children:y})]},y))})]})]})};function At(e,t){if(!t||t!=="form_post"){window.location.assign(e);return}const r=new URL(e,window.location.origin),n=document.createElement("form");n.method="POST",n.action=`${r.origin}${r.pathname}${r.hash}`,n.style.display="none";for(const[i,s]of r.searchParams.entries()){const l=document.createElement("input");l.type="hidden",l.name=i,l.value=s,n.appendChild(l)}document.body.appendChild(n),n.submit()}const wi=()=>{var R,I;const e=Array(6).fill(0).map(()=>We(null)),[t,r]=F(""),[n,i]=F(!1),[s,l]=F(0),[d,_]=F(!1),[g,k]=F(!1),[b,h]=F(""),{email:x,branding:c,setLoading:P,getStateId:M}=ge(),B=(()=>{const p=new URLSearchParams(window.location.search).get("identifier");if(!p)return null;const v=p.trim();return v?v.includes("@")?v.replace(/\s+/g,"+"):v:null})(),D=x||B||"",q=()=>{if(B){le.navigateTo("/login",!0);return}history.back()};ee(()=>{var p,v,u;if(c!=null&&c.data){const f=((p=c==null?void 0:c.data)==null?void 0:p.data)||(c==null?void 0:c.data)||{},C=document.documentElement;if(f.btn_color&&(C.style.setProperty("--primary-color",f.btn_color),C.style.setProperty("--button-background",f.btn_color)),f.text_color&&C.style.setProperty("--button-text-color",f.text_color),f.background&&C.style.setProperty("--card-background",f.background),f.page_background&&(C.style.setProperty("--page-background",f.page_background),document.body.style.backgroundColor=f.page_background),f.button_border&&C.style.setProperty("--button-border-color",f.button_border),f.icon_color&&C.style.setProperty("--icon-color",f.icon_color),(v=f.font)!=null&&v.family&&(C.style.setProperty("--font-family",f.font.family),document.body.style.fontFamily=f.font.family),(u=f.font)!=null&&u.url){const N=document.createElement("link");N.rel="stylesheet",N.href=f.font.url,document.head.appendChild(N)}if(f.favicon){const N=document.querySelector('link[rel="icon"]')||document.createElement("link");N.rel="icon",N.href=f.favicon,document.querySelector('link[rel="icon"]')||document.head.appendChild(N)}f.brand&&(document.title=`Verify Email - ${f.brand}`)}},[c]),ee(()=>{let p;return s>0&&(p=setInterval(()=>{l(v=>v-1)},1e3)),()=>clearInterval(p)},[s]),ee(()=>{const p=setTimeout(()=>{e[0].current&&e[0].current.focus()},100);return()=>clearTimeout(p)},[]);const V=(p,v)=>{var C,N;const f=v.target.value;if(setTimeout(()=>{const X=A();h(X)},0),f.match(/[0-9]/))if(p<5)(C=e[p+1].current)==null||C.focus();else{const X=A();X.length===6&&a(X)}else v.key==="Backspace"&&p>0&&((N=e[p-1].current)==null||N.focus())},W=p=>{var f;p.preventDefault();const u=(((f=p.clipboardData)==null?void 0:f.getData("text"))||"").match(/\d/g);u&&u.length===6&&(e.forEach((C,N)=>{C.current&&(C.current.value=u[N])}),h(u.join("")),a(u.join("")))},A=()=>e.reduce((p,v)=>{var u;return p+(((u=v.current)==null?void 0:u.value)||"")},""),a=async p=>{var v;r(""),_(!0),P(!0);try{const u=oe.getOIDCState(),f=M();if(!u||!f)throw new Error("Missing verification session. Please request a new OTP.");const C=await de.verifyHostedPageOTP({state:u,session_id:f,otp:p});if(C.status&&((v=C.data)!=null&&v.redirect_uri)){_(!1),k(!0),At(C.data.redirect_uri,C.data.response_mode);return}else r(C.message||"Invalid OTP. Please try again."),T()}catch(u){const f=u instanceof Error?u.message:"Failed to verify OTP. Please try again.";r(f),T()}finally{_(!1),P(!1)}},T=()=>{var p;e.forEach(v=>{v.current&&(v.current.value="")}
1),h(""),(p=e[0].current)==null||p.focus()},w=async()=>{var p,v,u,f;if(!(s>0)){l(30),r("");try{const C=M(),N=await de.resendEmailOTP(E.client_id||E.api_key||((p=c==null?void 0:c.data)==null?void 0:p.client_id)||((v=c==null?void 0:c.data)==null?void 0:v.api_key)||"",C||void 0),X=((u=N.data)==null?void 0:u.session_id)||((f=N.data)==null?void 0:f.state_id);if(X){const{setStateId:K}=ge.getState();K(X)}l(30)}catch(C){const N=C instanceof Error?C.message:"Failed to resend OTP. Please try again.";r(N)}finally{i(!1)}}},L=(p,v)=>{var C,N,X;const u=p.split(".");let f=((N=(C=c==null?void 0:c.data)==null?void 0:C.data)==null?void 0:N.localization)||((X=c==null?void 0:c.data)==null?void 0:X.localization)||(c==null?void 0:c.localization);for(const K of u)if(f&&typeof f=="object"&&K in f)f=f[K];else return v;return typeof f=="string"?f:v},j=(p,v,u)=>{const f=L(p,v);return u&&f.includes("%s")?f.replace("%s",u):f},O=p=>{const v=p.trim(),u=v.indexOf("?");return u===-1?{prefix:"",linkText:v}:{prefix:v.slice(0,u+1).trim(),linkText:v.slice(u+1).trim()}},E=((R=c==null?void 0:c.data)==null?void 0:R.data)||(c==null?void 0:c.data)||{};return ee(()=>{var v,u,f;const p=((v=c==null?void 0:c.data)==null?void 0:v.data)||(c==null?void 0:c.data)||{};if(Object.keys(p).length>0){const C=document.documentElement;if(p.btn_color&&(C.style.setProperty("--primary-color",p.btn_color),C.style.setProperty("--button-background",p.btn_color)),p.text_color&&C.style.setProperty("--button-text-color",p.text_color),p.background&&C.style.setProperty("--card-background",p.background),p.page_background&&(C.style.setProperty("--page-background",p.page_background),document.body.style.backgroundColor=p.page_background),p.button_border&&C.style.setProperty("--button-border-color",p.button_border),p.icon_color&&C.style.setProperty("--icon-color",p.icon_color),(u=p.font)!=null&&u.family&&(C.style.setProperty("--font-family",p.font.family),document.body.style.fontFamily=p.font.family),(f=p.font)!=null&&f.url){const N=document.createElement("link");N.rel="stylesheet",N.href=p.font.url,document.head.appendChild(N)}if(p.favicon){const N=document.querySelector('link[rel="icon"]')||document.createElement("link");N.rel="icon",N.href=p.favicon,document.querySelector('link[rel="icon"]')||document.head.appendChild(N)}p.brand&&(document.title=`Sign in - ${p.brand}`)}},[c]),o("div",{class:"signin-pageLayout-wrapper v-middle",children:[o("div",{class:"signin-pageLayout-bg",style:{backgroundColor:E.page_background||"#f2f4f8"}}),o("div",{class:"signin-pageLayout align-start",style:{backgroundColor:E.background||"#fff",borderColor:E.button_border||"#c1c7cd"},children:o("div",{class:"login-card",style:{backgroundColor:((I=E==null?void 0:E.theme)==null?void 0:I.background)||"transparent",borderColor:E.button_border||"transparent",color:E.btn_color||"#1d4ed8"},children:[o("div",{class:"back-btn",children:o("button",{onClick:q,style:{color:E.btn_color||"#1d4ed8"},children:[o("svg",{width:"8",height:"12",viewBox:"0 0 8 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:o("path",{d:"M6.5 1L1.5 6L6.5 11",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})}),"Back"]})}),o("div",{class:"header",children:o("div",{class:"login-card-title",children:[o("div",{class:"title",children:o("h1",{style:{fontSize:"24px",marginBottom:"2px"},children:j("magic_otp.title_text",L("magic_otp.title","Verify your email"),E.brand||void 0)})}),o("div",{class:"description",children:[L("magic_otp.subtitle","The verification code has been sent to your email ")," ",o("b",{children:[" ",D,"."," "]}),o("button",{class:"edit-email",title:"Edit email",style:{color:E.btn_color||"#1d4ed8"},onClick:q,children:o("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:[o("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),o("path",{d:"M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4"}),o("path",{d:"M13.5 6.5l4 4"})]})})]})]})}),o("form",{onSubmit:p=>p.preventDefault(),class:"login-card-form",children:[o("div",{class:"form-control otp-field",children:e.map((p,v)=>o("input",{id:`otp-input-${v}`,ref:p,type:"text",inputmode:"numeric",maxLength:1,onInput:u=>{const f=u.target,C=f.value.replace(/[^0-9]/g,"");C.length>1?f.value=C.slice(0,1):f.value=C},onKeyUp:u=>V(v,u),onPaste:v===0?W:void 0,disabled:d||g,style:{borderColor:E.button_border||"#d1d5db"}},v))}),t&&o("div",{class:"form-error",style:{color:"#e74c3c"},children:t}),o("div",{class:"form-control",children:o("button",{type:"button",class:`btn btn-primary w-full ${d||g?"btn-loading":""}`,onClick:()=>a(A()),disabled:d||g||b.length!==6,style:{backgroundColor:E.btn_color||"#6a7bd2",color:E.text_color||"#fff",borderColor:E.btn_color||"#6a7bd2",opacity:g||b.length!==6?.7:1,cursor:d||g||b.length!==6?"not-allowed":"pointer"},children:d?o("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"},children:[o(se,{}),o("span",{children:L("magic_otp.button.verifying","Verifying")})]}):g?o("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"},children:[o(se,{}),o("span",{children:L("magic_otp.button.redirecting","Redirecting")})]}):L("magic_otp.button.text","Continue")})}),g&&o("div",{class:"redirect-message",style:{textAlign:"center",marginTop:"15p
1x",padding:"10px",backgroundColor:"#f2f4f8",border:"1px solid #c1c7cd",borderRadius:"6px",color:"#111827",fontSize:"14px",display:"none",alignItems:"center",justifyContent:"center",gap:"8px"},children:L("phone_otp.redirect_message","Authentication successful! Redirecting you now...")})]}),o("div",{class:"sign-method",children:s>0?o("div",{children:[L("magic_otp.button.resend_again","Can't find your code? Request a new code in")," ",s," ",L("magic_otp.seconds","seconds"),"."]}):o("div",{children:(()=>{const p=L("magic_otp.button.resend","Not received yet? Resend verification code"),{prefix:v,linkText:u}=O(p);return o(te,{children:[v,o("a",{href:"#",onClick:f=>{f.preventDefault(),w()},class:n?"disabled":"",style:{color:E.btn_color||"#1d4ed8",marginLeft:v?"4px":"0"},children:n?o(te,{children:o(se,{variant:"secondary",size:"small"})}):u||p})]})})()})})]})}),!E.white_label&&o("div",{class:"footer",children:[o("span",{style:{fontSize:"12px",color:"#666"},children:L("common.secured_by","Secured by")}),o("a",{href:"https://ssojet.com",target:"_blank",style:{display:"inline-flex",alignItems:"center",textDecoration:"none",color:"#000",fontWeight:"600",marginLeft:"6px"},children:o("img",{src:Se,alt:"SSOJet",height:"18",style:{opacity:.5}})})]})]})},xi=()=>{var E,R;const e=Array(6).fill(0).map(()=>We(null)),[t,r]=F(""),[n,i]=F(!1),[s,l]=F(0),[d,_]=F(!1),[g,k]=F(!1),[b,h]=F(""),{phone:x,branding:c,setLoading:P,getStateId:M}=ge(),B=(()=>{const I=new URLSearchParams(window.location.search).get("identifier");if(!I)return null;const p=I.trim();return p?p.includes("@")?p.replace(/\s+/g,"+"):p:null})(),D=x||B||"";ee(()=>{var I,p,v;if(c!=null&&c.data){const u=((I=c==null?void 0:c.data)==null?void 0:I.data)||(c==null?void 0:c.data)||{},f=document.documentElement;if(u.btn_color&&(f.style.setProperty("--primary-color",u.btn_color),f.style.setProperty("--button-background",u.btn_color)),u.text_color&&f.style.setProperty("--button-text-color",u.text_color),u.background&&f.style.setProperty("--card-background",u.background),u.page_background&&(f.style.setProperty("--page-background",u.page_background),document.body.style.backgroundColor=u.page_background),u.button_border&&f.style.setProperty("--button-border-color",u.button_border),u.icon_color&&f.style.setProperty("--icon-color",u.icon_color),(p=u.font)!=null&&p.family&&(f.style.setProperty("--font-family",u.font.family),document.body.style.fontFamily=u.font.family),(v=u.font)!=null&&v.url){const C=document.createElement("link");C.rel="stylesheet",C.href=u.font.url,document.head.appendChild(C)}if(u.favicon){const C=document.querySelector('link[rel="icon"]')||document.createElement("link");C.rel="icon",C.href=u.favicon,document.querySelector('link[rel="icon"]')||document.head.appendChild(C)}u.brand&&(document.title=`Verify Phone - ${u.brand}`)}},[c]),ee(()=>{let I;return s>0&&(I=setInterval(()=>{l(p=>p-1)},1e3)),()=>clearInterval(I)},[s]),ee(()=>{const I=setTimeout(()=>{e[0].current&&e[0].current.focus()},100);return()=>clearTimeout(I)},[]);const q=(I,p)=>{var f,C;const u=p.target.value;if(setTimeout(()=>{const N=W();h(N)},0),u.match(/[0-9]/))if(I<5)(f=e[I+1].current)==null||f.focus();else{const N=W();N.length===6&&A(N)}else p.key==="Backspace"&&I>0&&((C=e[I-1].current)==null||C.focus())},V=I=>{var u;I.preventDefault();const v=(((u=I.clipboardData)==null?void 0:u.getData("text"))||"").match(/\d/g);v&&v.length===6&&(e.forEach((f,C)=>{f.current&&(f.current.value=v[C])}),h(v.join("")),A(v.join("")))},W=()=>e.reduce((I,p)=>{var v;return I+(((v=p.current)==null?void 0:v.value)||"")},""),A=async I=>{var p;r(""),_(!0),P(!0);try{const v=oe.getOIDCState(),u=M();if(!v||!u)throw new Error("Missing verification session. Please request a new OTP.");const f=await de.verifyHostedPageOTP({state:v,session_id:u,otp:I});if(f.status&&((p=f.data)!=null&&p.redirect_uri)){_(!1),k(!0),At(f.data.redirect_uri,f.data.response_mode);return}else r(f.message||"Invalid OTP. Please try again."),a()}catch(v){const u=v instanceof Error?v.message:"Failed to verify OTP. Please try again.";r(u),a()}finally{_(!1),P(!1)}},a=()=>{var I;e.forEach(p=>{p.current&&(p.current.value="")}
1),h(""),(I=e[0].current)==null||I.focus()},T=async()=>{var I,p,v,u;if(!(s>0)){i(!0),r("");try{const f=M(),C=await de.resendPhoneOTP(O.client_id||O.api_key||((I=c==null?void 0:c.data)==null?void 0:I.client_id)||((p=c==null?void 0:c.data)==null?void 0:p.api_key)||"",f||void 0),N=((v=C.data)==null?void 0:v.session_id)||((u=C.data)==null?void 0:u.state_id);if(N){const{setStateId:X}=ge.getState();X(N)}l(30)}catch(f){const C=f instanceof Error?f.message:"Failed to resend OTP. Please try again.";r(C)}finally{i(!1)}}},w=(I,p)=>{var f,C,N;const v=I.split(".");let u=((C=(f=c==null?void 0:c.data)==null?void 0:f.data)==null?void 0:C.localization)||((N=c==null?void 0:c.data)==null?void 0:N.localization)||(c==null?void 0:c.localization);for(const X of v)if(u&&typeof u=="object"&&X in u)u=u[X];else return p;return typeof u=="string"?u:p},L=(I,p,v)=>{const u=w(I,p);return v&&u.includes("%s")?u.replace("%s",v):u},j=I=>{const p=I.trim(),v=p.indexOf("?");return v===-1?{prefix:"",linkText:p}:{prefix:p.slice(0,v+1).trim(),linkText:p.slice(v+1).trim()}},O=((E=c==null?void 0:c.data)==null?void 0:E.data)||(c==null?void 0:c.data)||{};return ee(()=>{var I,p,v;if(c!=null&&c.data){const u=((I=c==null?void 0:c.data)==null?void 0:I.data)||(c==null?void 0:c.data)||{},f=document.documentElement;if(u.btn_color&&(f.style.setProperty("--primary-color",u.btn_color),f.style.setProperty("--button-background",u.btn_color)),u.text_color&&f.style.setProperty("--button-text-color",u.text_color),u.background&&f.style.setProperty("--card-background",u.background),u.page_background&&(f.style.setProperty("--page-background",u.page_background),document.body.style.backgroundColor=u.page_background),u.button_border&&f.style.setProperty("--button-border-color",u.button_border),u.icon_color&&f.style.setProperty("--icon-color",u.icon_color),(p=u.font)!=null&&p.family&&(f.style.setProperty("--font-family",u.font.family),document.body.style.fontFamily=u.font.family),(v=u.font)!=null&&v.url){const C=document.createElement("link");C.rel="stylesheet",C.href=u.font.url,document.head.appendChild(C)}if(u.favicon){const C=document.querySelector('link[rel="icon"]')||document.createElement("link");C.rel="icon",C.href=u.favicon,document.querySelector('link[rel="icon"]')||document.head.appendChild(C)}u.brand&&(document.title=`Verify Email - ${u.brand}`)}},[c]),o("div",{class:"signin-pageLayout-wrapper v-middle",children:[o("div",{class:"signin-pageLayout-bg",style:{backgroundColor:O.page_background||"#f2f4f8"}}),o("div",{class:"signin-pageLayout align-start",style:{backgroundColor:O.background||"#fff",borderColor:O.button_border||"#c1c7cd"},children:o("div",{class:"login-card",style:{backgroundColor:((R=O==null?void 0:O.theme)==null?void 0:R.background)||"transparent",borderColor:O.button_border||"transparent"},children:[o("div",{class:"back-btn",children:o("button",{onClick:()=>history.back(),style:{color:O.btn_color||"#1d4ed8"},children:[o("svg",{width:"8",height:"12",viewBox:"0 0 8 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:o("path",{d:"M6.5 1L1.5 6L6.5 11",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})}),w("sso.back","Back")]})}),o("div",{class:"header",children:o("div",{class:"login-card-title",children:[o("div",{class:"title",children:o("h1",{style:{fontSize:"24px",marginBottom:"2px"},children:L("magic_otp.title_text","Verify your phone number",O.brand||void 0)})}),o("div",{class:"description",children:[w("magic_otp.phone_text","We sent a verification code to")," ",o("b",{children:[D,"."," "]}),o("p",{children:"If you can't see the SMS, please check your phone or try again."}),o("button",{class:"edit-email",title:"Edit phone number",style:{color:O.btn_color||"#1d4ed8"},onClick:()=>history.back(),children:o("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:[o("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),o("path",{d:"M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4"}),o("path",{d:"M13.5 6.5l4 4"})]})})]})]})}),o("form",{onSubmit:I=>I.preventDefault(),class:"login-card-form",children:[o("div",{class:"form-control otp-field",children:e.map((I,p)=>o("input",{ref:I,id:`otp-input-${p}`,type:"text",inputmode:"numeric",maxLength:1,onInput:v=>{const u=v.target,f=u.value.replace(/[^0-9]/g,"");f.length>1?u.value=f.slice(0,1):u.value=f},onKeyUp:v=>q(p,v),onPaste:p===0?V:void 0,disabled:d||g,style:{borderColor:O.button_border||"#d1d5db"}},p))}),t&&o("div",{class:"form-error",style:{color:"#e74c3c"},children:t}),o("div",{class:"form-control",children:o("button",{type:"button",class:`btn btn-primary w-full ${d||g?"btn-loading":""}`,onClick:()=>A(W()),disabled:d||g||b.length!==6,style:{backgroundColor:O.btn_color||"#6a7bd2",color:O.text_color||"#fff",borderColor:O.btn_color||"#6a7bd2",opacity:g||b.length!==6?.7:1,cursor:d||g||b.length!==6?"not-allowed":"pointer"},children:d?o("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"},children:[o(se,{}),o("span",{children:w("magic_otp.button.verifying","Verifying...")})]}):g?o("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"},children:[o(se,{}),o("span",{children:w("magic_otp.button.redirecting","Redirecting...")})]}):w("magic_otp.button.text","Continue")})}),g&&o("div",{class:"redirect-message",style:{textAlign:"center",marginTop:"15p
1x",padding:"10px",backgroundColor:"#f2f4f8",border:"1px solid #c1c7cd",borderRadius:"6px",color:"#111827",fontSize:"14px",display:"none",alignItems:"center",justifyContent:"center",gap:"8px"},children:w("phone_otp.redirect_message","Authentication successful! Redirecting you now...")})]}),o("div",{class:"sign-method",children:s>0?o("div",{children:[w("magic_otp.button.resend_again","Can't find your code? Request a new code in")," ",s," ",w("magic_otp.seconds","seconds"),"."]}):o("div",{style:{fontSize:"12px"},children:(()=>{const I=w("magic_otp.button.resend","Not received yet? Resend verification code"),{prefix:p,linkText:v}=j(I);return o(te,{children:[p,o("a",{href:"#",onClick:u=>{u.preventDefault(),T()},class:n?"disabled":"",style:{color:O.btn_color||"#1d4ed8",marginLeft:p?"4px":"0"},children:n?o(te,{children:o(se,{variant:"secondary",size:"small"})}):v||I})]})})()})})]})}),!O.white_label&&o("div",{class:"footer",children:[o("span",{style:{fontSize:"12px",color:"#666"},children:w("common.secured_by","Secured by")}),o("a",{href:"https://ssojet.com",target:"_blank",style:{display:"inline-flex",alignItems:"center",textDecoration:"none",color:"#000",fontWeight:"600",marginLeft:"6px"},children:o("img",{src:Se,alt:"SSOJet",height:"18",style:{opacity:.5}})})]})]})},ki=()=>{var R,I;const e=Array(6).fill(0).map(()=>We(null)),[t,r]=F(""),[n,i]=F(!1),[s,l]=F(0),[d,_]=F(!1),[g,k]=F(!1),[b,h]=F(""),{phone:x,branding:c,setLoading:P,setAuth:M,getStateId:B,clearStateId:D,setWebAuthnSession:q}=ge();ee(()=>{var p,v,u;if(c!=null&&c.data){const f=((p=c==null?void 0:c.data)==null?void 0:p.data)||(c==null?void 0:c.data)||{},C=document.documentElement;if(f.btn_color&&(C.style.setProperty("--primary-color",f.btn_color),C.style.setProperty("--button-background",f.btn_color)),f.text_color&&C.style.setProperty("--button-text-color",f.text_color),f.background&&C.style.setProperty("--card-background",f.background),f.page_background&&(C.style.setProperty("--page-background",f.page_background),document.body.style.backgroundColor=f.page_background),f.button_border&&C.style.setProperty("--button-border-color",f.button_border),f.icon_color&&C.style.setProperty("--icon-color",f.icon_color),(v=f.font)!=null&&v.family&&(C.style.setProperty("--font-family",f.font.family),document.body.style.fontFamily=f.font.family),(u=f.font)!=null&&u.url){const N=document.createElement("link");N.rel="stylesheet",N.href=f.font.url,document.head.appendChild(N)}if(f.favicon){const N=document.querySelector('link[rel="icon"]')||document.createElement("link");N.rel="icon",N.href=f.favicon,document.querySelector('link[rel="icon"]')||document.head.appendChild(N)}f.brand&&(document.title=`Verify WhatsApp - ${f.brand}`)}},[c]),ee(()=>{let p;return s>0&&(p=setInterval(()=>{l(v=>v-1)},1e3)),()=>clearInterval(p)},[s]),ee(()=>{var v;const p=(v=e[0])==null?void 0:v.current;p&&setTimeout(()=>{p.focus()},100)},[]);const V=(p,v)=>{var X;const f=v.currentTarget.value;if(f&&!/^\d$/.test(f)){v.preventDefault();return}const C=b.split("");C[p]=f||"";const N=C.join("");if(h(N),t&&r(""),f&&p<e.length-1){const K=(X=e[p+1])==null?void 0:X.current;K&&K.focus()}N.length===6&&/^\d{6}$/.test(N)&&a(N)},W=(p,v)=>{var u;if(v.key==="Backspace"){v.preventDefault();const f=b.split("");if(f[p])f[p]="",h(f.join(""));else if(p>0){f[p-1]="",h(f.join(""));const C=(u=e[p-1])==null?void 0:u.current;C&&C.focus()}}},A=p=>{var f,C;p.preventDefault();const u=(((f=p.clipboardData)==null?void 0:f.getData("text/plain"))||"").replace(/\D/g,"").slice(0,6);if(u.length>0){h(u.padEnd(6,""));const N=Math.min(u.length,e.length-1),X=(C=e[N])==null?void 0:C.current;X&&setTimeout(()=>X.focus(),0),u.length===6&&a(u)}},a=async p=>{var v,u,f,C,N;if(!(d||g)){r(""),_(!0),P(!0);try{const X=B(),K=await de.verifyWhatsAppOTP(p,E.client_id||E.api_key||((v=c==null?void 0:c.data)==null?void 0:v.client_id)||((u=c==null?void 0:c.data)==null?void 0:u.api_key)||"",X||void 0);if(K.status&&((f=K.data)!=null&&f.authenticated||(C=K.data)!=null&&C.success)){const he=B();if(c!=null&&c.webauthn&&K.data.flow==="webauthn_registration"){ve.log("======> WebAuthn registration flow detected, redirecting to passkey setup"),q(K.data),_(!1),k(!0);const be=new URLSearchParams(window.location.search),He=`/v1/u/passkey-setup${be.toString()?`?${be.toString()}`:""}`;window.location.href=He;return}if(K.data.redirect&&K.data.redirect_url){ve.log("======> Redirect URL received from server:",K.data.redirect_url),_(!1),k(!0),D(),window.location.href=K.data.redirect_url;return}const m=w();if(K.data.oauth&&K.data.user&&M(K.data.oauth,K.data.user),m){_(!1),k(!0);const be={};he&&(be.state_id=he),T(m,be)}else D(),_(!1),k(!0),le.navigateTo("/profile")}else throw new Error(K.message||"Invalid WhatsApp OTP")}catch(X){const K=X instanceof Error?X.message:"Verification failed";r(K),h(""),e.forEach(m=>{m.current&&(m.current.value="")}
1);const he=(N=e[0])==null?void 0:N.current;he&&setTimeout(()=>he.focus(),100)}finally{_(!1),P(!1)}}},T=(p,v)=>{const u=document.createElement("form");u.method="POST",u.action=p,u.style.display="none",Object.keys(v).forEach(f=>{const C=document.createElement("input");C.type="hidden",C.name=f,C.value=v[f],u.appendChild(C)}),document.body.appendChild(u),u.submit()},w=()=>{var u;const v=new URLSearchParams(window.location.search).get("redirect_url");return v||((u=c==null?void 0:c.data)!=null&&u.redirect_url?c.data.redirect_url:null)},L=async()=>{var p,v,u,f;if(!(s>0)){r("");try{const C=B(),N=await de.resendWhatsAppOTP(E.client_id||E.api_key||((p=c==null?void 0:c.data)==null?void 0:p.client_id)||((v=c==null?void 0:c.data)==null?void 0:v.api_key)||"",C||void 0),X=((u=N.data)==null?void 0:u.session_id)||((f=N.data)==null?void 0:f.state_id);if(X){const{setStateId:K}=ge.getState();K(X)}l(30)}catch(C){const N=C instanceof Error?C.message:"Failed to resend WhatsApp OTP. Please try again.";r(N)}finally{i(!1)}}},j=(p,v)=>{var C,N,X;const u=p.split(".");let f=((N=(C=c==null?void 0:c.data)==null?void 0:C.data)==null?void 0:N.localization)||((X=c==null?void 0:c.data)==null?void 0:X.localization)||(c==null?void 0:c.localization);for(const K of u)if(f&&typeof f=="object"&&K in f)f=f[K];else return v;return typeof f=="string"?f:v},O=(p,v,u)=>{const f=j(p,v);return u&&f.includes("%s")?f.replace("%s",u):f};if(!(c!=null&&c.data))return o("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:"100vh"},children:o(se,{})});const E=((R=c==null?void 0:c.data)==null?void 0:R.data)||(c==null?void 0:c.data)||{};return o("div",{class:"signin-pageLayout-wrapper v-middle",style:{backgroundColor:E.page_background||"#f2f4f8"},children:[o("div",{class:"signin-pageLayout-bg"}),o("div",{class:"signin-pageLayout align-start",children:o("div",{class:"login-card",style:{backgroundColor:((I=E==null?void 0:E.theme)==null?void 0:I.login_box_color)||"#fff",borderColor:E.button_border||"#c1c7cd"},children:[o("div",{class:"back-btn",children:o("button",{onClick:()=>history.back(),style:{color:E.btn_color||"#1d4ed8"},children:[o("svg",{width:"8",height:"12",viewBox:"0 0 8 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:o("path",{d:"M6.5 1L1.5 6L6.5 11",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})}),j("sso.back","Back")]})}),o("div",{class:"header",children:o("div",{class:"login-card-title",children:[E.logo&&o("img",{src:E.logo,alt:E.brand||"Logo",class:"logo",style:{maxWidth:"200px",height:"auto"}}),o("div",{class:"title",children:o("h1",{style:{fontSize:"24px"},children:O("magic_otp.title_text","Verify your WhatsApp OTP",E.brand||void 0)})}),o("div",{class:"description",children:[j("magic_otp.phone_text","We sent a verification code to your WhatsApp")," ",o("b",{children:[x,"."," "]}),o("button",{class:"edit-email",title:"Edit phone number",style:{color:E.btn_color||"#1d4ed8"},onClick:()=>history.back(),children:o("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:[o("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),o("path",{d:"M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4"}),o("path",{d:"M13.5 6.5l4 4"})]})})]})]})}),o("form",{onSubmit:p=>p.preventDefault(),class:"login-card-form",children:[o("div",{class:"form-control otp-field",children:e.map((p,v)=>o("input",{ref:p,type:"text",inputMode:"numeric",pattern:"[0-9]",maxLength:1,class:"otp-input",value:b[v]||"",onInput:u=>V(v,u),onKeyDown:u=>W(v,u),onPaste:v===0?A:void 0,disabled:d||g,style:{borderColor:E.button_border||"#d1d5db"}},v))}),t&&o("div",{class:"form-error",style:{color:"#e74c3c"},children:t}),o("div",{class:"form-control",children:o("button",{type:"button",class:`btn btn-primary w-full ${d||g?"btn-loading":""}`,style:{backgroundColor:E.btn_color||"#6a7bd2",color:E.text_color||"#fff",borderColor:E.btn_color||"#6a7bd2",opacity:g||b.length!==6?.7:1,cursor:d||g||b.length!==6?"not-allowed":"pointer"},onClick:()=>a(b),disabled:b.length!==6||d||g,children:d||g?o("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"},children:[o(se,{}),o("span",{children:j("magic_otp.button.verifying","Verifying")})]}):g?o("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"},children:[o(se,{}),o("span",{children:j("magic_otp.button.redirecting","Redirecting")})]}):j("magic_otp.button.text","Continue")})}),g&&o("div",{class:"redirect-message",style:{textAlign:"center",marginTop:"15p
1x",padding:"10px",backgroundColor:"#f2f4f8",border:"1px solid #c1c7cd",borderRadius:"6px",color:"#111827",fontSize:"14px",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"},children:j("phone_otp.redirect_message","Authentication successful! Redirecting you now...")})]}),o("div",{class:"sign-method",children:s>0?o("div",{style:{fontSize:"12px",color:"#6b7280"},children:[j("magic_otp.button.resend_again","Can't find your code? Request a new code in")," ",s," ",j("magic_otp.seconds","seconds"),"."]}):o("div",{style:{fontSize:"12px"},children:[j("magic_otp.button.resend_prompt","Can't find your code?"),o("a",{href:"#",onClick:p=>{p.preventDefault(),L()},class:n?"disabled":"",style:{color:E.btn_color||"#1d4ed8",marginLeft:"4px"},children:n?o(te,{children:o(se,{variant:"secondary",size:"small"})}):j("magic_otp.button.resend","Request a new code")})]})})]})}),!E.white_label&&o("div",{class:"footer",children:[o("span",{style:{fontSize:"12px",color:"#666"},children:j("common.secured_by","Secured by")}),o("a",{href:"https://ssojet.com",target:"_blank",style:{display:"inline-flex",alignItems:"center",textDecoration:"none",color:"#000",fontWeight:"600",marginLeft:"6px"},children:o("img",{src:Se,alt:"SSOJet",height:"18",style:{opacity:.5}})})]})]})},Gt=e=>{const t=atob(e.replace(/-/g,"+").replace(/_/g,"/")),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r.buffer},Yt=e=>{const t=new Uint8Array(e);let r="";for(let n=0;n<t.byteLength;n++)r+=String.fromCharCode(t[n]);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},Ci=e=>({id:e.id,rawId:Yt(e.rawId),type:e.type,response:{attestationObject:Yt(e.response.attestationObject),clientDataJSON:Yt(e.response.clientDataJSON)}}),Si=()=>{var A;const[e,t]=F(!1),[r,n]=F(!1),[i,s]=F(!0),[l,d]=F(!1),[_,g]=F("Checking your account settings..."),[k,b]=F(""),[h,x]=F(!1),{branding:c,webAuthnSession:P,email:M}=ge();ee(()=>{x(!!(window.PublicKeyCredential&&navigator.credentials&&navigator.credentials.create))},[]),ee(()=>{(async()=>{var T;if(!M){b("No email found. Please try logging in again."),s(!1);return}try{const w=await de.checkPasskeyStatus(M);w.status&&((T=w.data)!=null&&T.passkey_registered)?await B():s(!1)}catch{s(!1)}})()},[M]);const B=async()=>{var a,T;try{if(g("Passkey already configured. Proceeding..."),d(!0),P!=null&&P.session_id&&(P!=null&&P.user_id)){const w=((a=c==null?void 0:c.data)==null?void 0:a.api_key)||"",L=await de.skipWebAuthnRegistration(P.session_id,P.user_id,w);if(L.status)g("Redirecting..."),(T=L.data)!=null&&T.redirect?window.location.href=L.data.redirect_url:le.navigateTo("/profile");else throw new Error(L.message||"Failed to proceed")}else g("Redirecting..."),le.navigateTo("/profile")}catch(w){ve.error("Error handling already registered passkey:",w),s(!1),d(!1)}};ee(()=>{var a;if(c!=null&&c.data){const T=((a=c==null?void 0:c.data)==null?void 0:a.data)||(c==null?void 0:c.data)||{},w=document.documentElement;T.btn_color&&(w.style.setProperty("--primary-color",T.btn_color),w.style.setProperty("--button-background",T.btn_color)),T.text_color&&w.style.setProperty("--button-text-color",T.text_color),T.background&&w.style.setProperty("--card-background",T.background),T.page_background&&(w.style.setProperty("--page-background",T.page_background),document.body.style.backgroundColor=T.page_background),T.button_border&&w.style.setProperty("--button-border-color",T.button_border),T.brand&&(document.title=`Passkey Setup - ${T.brand}`)}},[c]);const D=async()=>{var a,T;if(!h){b("Passkeys are not supported on this device/browser.");return}if(!(P!=null&&P.session_id)||!(P!=null&&P.user_id)){b("Invalid session. Please try again.");return}t(!0),b("");try{const w=((a=c==null?void 0:c.data)==null?void 0:a.api_key)||"",L=await de.initializeWebAuthnSession(P.session_id,P.user_id,w);if(!L.status)throw new Error(L.message||"Failed to initialize passkey setup");const O=L.data.publicKey,E=P.session_id;if(!O||!O.challenge)throw new Error("Invalid credential creation options received from server");const R={...O,challenge:Gt(O.challenge)};O.user&&O.user.id&&(R.user={...O.user,id:Gt(O.user.id)}),O.excludeCredentials&&Array.isArray(O.excludeCredentials)&&(R.excludeCredentials=O.excludeCredentials.map(u=>({...u,id:Gt(u.id)})));const I=await navigator.credentials.create({publicKey:R});if(!I)throw new Error("Failed to create passkey credential");const p={...Ci(I),session_id:E},v=await de.registerWebAuthnCredential(p,w);if(v.status)(T=v.data)!=null&&T.redirect?window.location.href=v.data.redirect_url:le.navigateTo("/profile");else throw new Error(v.message||"Failed to register passkey")}catch(w){ve.error("Passkey registration error:",w),w.name==="NotAllowedError"?b("Passkey registration was cancelled or not allowed."):w.name==="NotSupportedError"?b("Passkeys are not supported on this device."):b(w instanceof Error?w.message:"Failed to register passkey"),t(!1)}},q=async()=>{var a,T;if(!(P!=null&&P.session_id)||!(P!=null&&P.user_id)){b("Invalid session. Please try again.");return}n(!0),b("");try{const w=((a=c==null?void 0:c.data)==null?void 0:a.api_key)||"",L=await de.skipWebAuthnRegistration(P.session_id,P.user_id,w);if(L.status)(T=L.data)!=null&&T.redirect?window.location.href=L.data.redirect_url:le.navigateTo("/profile");else throw new Error(L.message||"Failed to skip passkey setup")}catch(w){ve.error("Skip passkey error:",w),b(w instanceof Error?w.message:"Failed to skip passkey setup"),n(!1)}},V=(a,T)=>{var j,O,E;const w=a.split(".");let L=((O=(j=c==null?void 0:c.data)==null?void 0:j.data)==null?void 0:O.localization)||((E=c==null?void 0:c.data)==null?void 0:E.localization)||(c==null?void 0:c.localization);for(const R of w)if(L&&typeof L=="object"&&R in L)L=L[R];else return T;return typeof L=="string"?L:T},W=((A=c==null?void 0:c.data)==null?void 0:A.data)||(c==null?void 0:c.data)||{};return P?i||l?o("div",{class:"signin-pageLayout-wrapper v-middle",style:{backgroundColor:W.page_background||"#f2f4f8"},children:[o("div",{class:"signin-pageLayout-bg"}),o("div",{class:"signin-pageLayout",children:o("div",{class:"login-card",style:{backgroundColor:W.background||"#fff",borderColor:W.button_border||"#c1c7cd",textAlign:"center",padding:"40px 30px",minHeight:"320px",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",boxShadow:"0 0px 0px rgba(0, 0, 0, 0.1)"},children:[o("div",{style:{marginBottom:"30px"},children:o("img",{src:W.brand_logo||"https://cdn.ssojet.com/assets/logo.png",alt:W.brand||"SSOJet",style:{maxHeight:"40px",maxWidth:"120px",objectFit:"contain",opacity:.8}})}),o("div",{style:{marginBottom:"24px"},children:o(se,{size:"large"})}),o("div",{style:{textAlign:"center",maxWidth:"280px"},children:[o("h3",{style:{margin:"0 0 8px 0",fontSize:"18px",fontWeight:"600",color:W.btn_color||"#333",lineHeight:"1.4"},children:_}),o("p",{style:{margin:"0",fontSize:"14px",color:"#666",lineHeight:"1.5",opacity:.8},children:i?"We're verifying your account configuration...":"Please wait while we complete the setup..."})]}),o("div",{style:{marginTop:"24px",width:"100%",maxWidth:"200px",height:"2px",backgroundColor:"#e1e5e9",borderRadius:"1px",overflow:"hidden"},children:o("div",{style:{width:"100%",height:"100%",background:`linear-gradient(90deg, ${W.btn_color||"#6a7bd2"}, ${W.btn_color||"#6a7bd2"}cc)`,borderRadius:"1px",animation:"progressSlide 2s ease-in-out infinite"}})}),o("style",{children:` 2 @keyframes progressSlide { 3 0% { transform: translateX(-100%); } 4 50% { transform: translateX(0%); } 5 100% { transform: translateX(100%); } 6 } 7 `})]})})]}):o("div",{class:"signin-pageLayout-wrapper v-middle",style:{backgroundColor:W.page_background||"#f2f4f8"},children:[o("div",{class:"signin-pageLayout-bg"}),o("div",{class:"signin-pageLayout",children:o("div",{class:"login-card",style:{backgroundColor:W.background||"#fff",borderColor:W.button_border||"#c1c7cd"},children:[o("div",{class:"header",children:[o("div",{class:"logo",children:o("img",{src:W.brand_logo||"https://cdn.ssojet.com/assets/logo.png",alt:W.brand||"SSOJet",class:"logo"})}),o("div",{class:"login-card-title",children:o("div",{class:"title",children:[o("h1",{children:V("passkeys_page.title_text","Set up Passkey")}),o("p",{style:{color:"#666",opacity:.8,marginTop:"10px"},children:V("passkeys_page.sub_title_text","Enhance your account security with passkeys. You can use your fingerprint, face, or device PIN for faster, more secure sign-ins.")}
7)]})})]}),o("div",{class:"login-card-form",children:[k&&o("div",{class:"form-error",style:{color:"#e74c3c",marginBottom:"20px"},children:k}),!h&&o("div",{style:{background:"#fff3cd",border:"1px solid #ffeaa7",borderRadius:"4px",padding:"15px",marginBottom:"20px",color:"#856404"},children:[o("strong",{children:"Browser not supported:"})," Passkeys are not supported on this device or browser. You can continue without setting up a passkey."]}),o("div",{class:"passkey-info",style:{textAlign:"center",marginBottom:"30px",padding:"20px",background:"#f8f9fa",borderRadius:"8px",border:"1px solid #e9ecef"},children:[o("div",{style:{fontSize:"48px",marginBottom:"15px"},children:"ð"}),o("h3",{style:{margin:"0 0 10px 0",color:"#333"},children:V("passkey.benefits.title","Why use Passkeys?")}),o("ul",{style:{textAlign:"left",margin:"15px 0",paddingLeft:"20px",color:"#666",lineHeight:"1.6"},children:[o("li",{children:V("passkey.benefits.security","More secure than passwords")}),o("li",{children:V("passkey.benefits.convenience","Faster sign-in with biometrics")}),o("li",{children:V("passkey.benefits.phishing","Protection against phishing attacks")}),o("li",{children:V("passkey.benefits.sync","Syncs across your devices")})]})]}),o("div",{class:"form-control",children:o("button",{type:"button",class:`btn btn-primary w-full ${e?"btn-loading":""}`,disabled:e||r||!h,onClick:D,style:{backgroundColor:W.btn_color||"#6a7bd2",color:W.text_color||"#fff",borderColor:W.btn_color||"#6a7bd2",marginBottom:"15px",cursor:e||r||!h?"not-allowed":"pointer"},children:e?o(se,{}):V("passkeys_page.button1.text","Set up Passkey")})}),o("div",{class:"form-control",children:o("button",{type:"button",class:`btn btn-secondary w-full ${r?"btn-loading":""}`,disabled:e||r,onClick:q,style:{backgroundColor:"transparent",color:W.btn_color||"#6a7bd2",borderColor:W.button_border||"#c1c7cd",border:`1px solid ${W.button_border||"#c1c7cd"}`,cursor:e||r?"not-allowed":"pointer"},children:r?o(se,{}):V("passkeys_page.button2.text","Skip for now")})}),o("div",{style:{textAlign:"center",marginTop:"20px",fontSize:"12px",color:"#999"},children:V("passkey.footer_note","You can always set up passkeys later in your account settings.")})]})]})}),!W.white_label&&o("div",{class:"footer",children:[o("span",{style:{fontSize:"12px",color:"#666"},children:V("common.secured_by","Secured by")}),o("a",{href:"https://ssojet.com",target:"_blank",style:{display:"inline-flex",alignItems:"center",textDecoration:"none",color:"#000",fontWeight:"600",marginLeft:"6px"},children:o("img",{src:Se,alt:"SSOJet",height:"18",style:{opacity:.5}})})]})]}):o("div",{class:"signin-pageLayout-wrapper v-middle",children:o("div",{class:"signin-pageLayout",children:o("div",{class:"login-card",children:o("div",{class:"form-error",children:"Invalid session. Please try logging in again."})})})})},Pi=()=>{var w,L;const[e,t]=F(!1),[r,n]=F(0),[i,s]=F(0),[l,d]=F(""),[_,g]=F("waiting"),{email:k,branding:b,setLoading:h,setAuth:x,getStateId:c,clearStateId:P}=ge(),M=(()=>{const j=new URLSearchParams(window.location.search).get("identifier");if(!j)return null;const O=j.trim();return O?O.includes("@")?O.replace(/\s+/g,"+"):O:null})(),B=k||M||"";ee(()=>{var j,O,E;if(b!=null&&b.data){const R=((j=b==null?void 0:b.data)==null?void 0:j.data)||(b==null?void 0:b.data)||{},I=document.documentElement;if(R.btn_color&&(I.style.setProperty("--primary-color",R.btn_color),I.style.setProperty("--button-background",R.btn_color)),R.text_color&&I.style.setProperty("--button-text-color",R.text_color),R.background&&I.style.setProperty("--card-background",R.background),R.page_background&&(I.style.setProperty("--page-background",R.page_background),document.body.style.backgroundColor=R.page_background),R.button_border&&I.style.setProperty("--button-border-color",R.button_border),R.icon_color&&I.style.setProperty("--icon-color",R.icon_color),(O=R.font)!=null&&O.family&&(I.style.setProperty("--font-family",R.font.family),document.body.style.fontFamily=R.font.family),(E=R.font)!=null&&E.url){const p=document.createElement("link");p.rel="stylesheet",p.href=R.font.url,document.head.appendChild(p)}if(R.favicon){const p=document.querySelector('link[rel="icon"]')||document.createElement("link");p.rel="icon",p.href=R.favicon,document.querySelector('link[rel="icon"]')||document.head.appendChild(p)}R.brand&&(document.title=`Verify Email - ${R.brand}`)}},[b]),ee(()=>{let j;return r>0&&(j=setInterval(()=>{n(O=>O-1)},1e3)),()=>clearInterval(j)},[r]),ee(()=>{const j=c();if(!j||_!=="waiting")return;let O=0;const E=async()=>{var I,p,v;try{const u=await de.checkMagicLinkStatus(j);if(u.status&&(((I=u.data)==null?void 0:I.authenticated)||((p=u.data)==null?void 0:p.is_authenticated))){if(g("success"),(v=u.data)!=null&&v.redirect_uri){At(u.data.redirect_uri,u.data.response_mode);return}if(u.data.redirect&&u.data.redirect_url){window.location.href=u.data.redirect_url;return}const C=D();if(u.data.oauth&&u.data.user&&x(u.data.oauth,u.data.user),C){const N={};j&&(N.state_id=j),q(C,N)}else P(),le.navigateTo("/profile")}}catch(u){ve.error("Error checking magic link status:",u)}},R=setInterval(()=>{O<10&&_==="waiting"?(E(),O++,s(O)):O>=10&&(g("failed"),d("Magic link verification failed. Please try again."),clearInterval(R))},5e3);return E(),O=1,s(O),()=>clearInterval(R)},[b,_]);const D=()=>{var E;
7const O=new URLSearchParams(window.location.search).get("redirect_url");return O||((E=b==null?void 0:b.data)!=null&&E.redirect_url?b.data.redirect_url:null)},q=(j,O)=>{const E=document.createElement("form");E.method="POST",E.action=j,E.style.display="none",Object.keys(O).forEach(R=>{const I=document.createElement("input");I.type="hidden",I.name=R,I.value=O[R],E.appendChild(I)}),document.body.appendChild(E),E.submit()},V=async()=>{var j,O,E,R;if(!(r>0)){if(!B){d("Missing email identifier. Please go back and try again.");return}t(!0),d(""),s(0);try{const I=await de.initiateMagicLink(B,T.client_id||T.api_key||((j=b==null?void 0:b.data)==null?void 0:j.client_id)||((O=b==null?void 0:b.data)==null?void 0:O.api_key)||""),p=((E=I.data)==null?void 0:E.session_id)||((R=I.data)==null?void 0:R.state_id);if(p){const{setStateId:v}=ge.getState();v(p)}n(30),g("waiting")}catch(I){const p=I instanceof Error?I.message:"Failed to resend magic link. Please try again.";d(p)}finally{t(!1)}}},W=()=>{le.navigateTo("/login")},A=()=>{const j=D();j?window.location.href=j:le.navigateTo("/profile")},a=(j,O)=>{var I,p,v;const E=j.split(".");let R=((p=(I=b==null?void 0:b.data)==null?void 0:I.data)==null?void 0:p.localization)||((v=b==null?void 0:b.data)==null?void 0:v.localization)||(b==null?void 0:b.localization);for(const u of E)if(R&&typeof R=="object"&&u in R)R=R[u];else return O;return typeof R=="string"?R:O},T=((w=b==null?void 0:b.data)==null?void 0:w.data)||(b==null?void 0:b.data)||{};return _==="success"?o("div",{class:"signin-pageLayout-wrapper v-middle",children:[o("div",{class:"signin-pageLayout-bg",style:{backgroundColor:T.page_background||"#f2f4f8"}}),o("div",{class:"signin-pageLayout",style:{backgroundColor:T.background||"#fff",borderColor:T.button_border||"#c1c7cd"},children:o("div",{class:"login-card",style:{backgroundColor:((L=T==null?void 0:T.theme)==null?void 0:L.login_box_color)||"transparent",borderColor:(T==null?void 0:T.button_border)||"transparent"},children:[o("div",{class:"header",children:[o("div",{class:"icon-wrap",children:[o("div",{class:"wave success"}),o("div",{class:"icon success",children:o("svg",{xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"#00c951","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round",children:[o("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),o("path",{d:"M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"}),o("path",{d:"M9 12l2 2l4 -4"})]})})]}),o("div",{class:"login-card-title",children:[o("div",{class:"title",children:o("h1",{style:{fontSize:"24px"},children:a("magic_link.success.title","Email Verified")})}),o("div",{class:"description",children:a("magic_link.success.subtitle","Your email address was successfully verified.")})]})]}),o("div",{class:"form-control",children:o("button",{type:"button",class:"btn btn-primary w-full",onClick:A,style:{display:"none",backgroundColor:T.btn_color||"#6a7bd2",borderColor:T.btn_color||"#6a7bd2"},children:a("magic_link.success.button","Back to home")})})]})}),!T.white_label&&o("div",{class:"footer",children:[o("span",{children:a("common.secured_by","Secured by")}),o("a",{href:"https://ssojet.com",target:"_blank",children:o("svg",{viewBox:"0 0 211 198",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"18px",width:"auto",verticalAlign:"middle",opacity:"0.5",marginLeft:"4px"},children:o("path",{d:"M209.768 160.513C209.415 159.459 208.927 158.454 208.316 157.524C208.316 157.524 208.316 157.398 208.189 157.335C205.011 152.513 198.505 148.135 189.558 144.408C189.174 144.209 188.772 144.047 188.358 143.924C187.621 143.629 186.905 143.313 186.126 143.019C183.474 142.177 180.653 141.335 177.579 140.492C172.716 139.229 167.474 138.092 161.895 137.061L161.768 136.282V135.924C161.053 131.713 159.179 124.913 155.874 113.482C150.884 95.924 144.021 71.7977 137.895 43.0398C136.442 36.3661 137.284 30.9556 140.463 26.3871C147.747 15.5029 166.337 12.5977 173.179 11.3556C173.974 11.1526 174.783 11.0118 175.6 10.9345C179.453 10.0924 179.916 7.50294 179.916 6.36609C179.907 5.24625 179.496 4.16693 178.758 3.32461C178.02 2.48229 177.004 1.93296 175.895 1.77662H175.474H175.284C155.684 -0.0339065 137.032 -1.63391 121.347 3.22925C103.347 8.63978 91.0316 21.6293 82.7789 44.1766L48.6105 136.282V136.408L48.021 137.25C42.9052 138.198 38.021 139.356 33.4526 140.492C29.3684 141.566 25.7052 142.724 22.3368 143.924C21.9223 144.047 21.5205 144.209 21.1368 144.408C19.9789 144.829 18.9052 145.313 17.8737 145.735C17.7681 145.744 17.6668 145.781 17.5789 145.84C13.076 147.768 8.91098 150.405 5.24208 153.65V153.65C4.22234 154.739 3.31919 155.932 2.54734 157.208C2.54734 157.208 2.42103 157.335 2.42103 157.398C1.32586 159.3 0.745379 161.455 0.736816 163.65C0.736816 171.587 8.31577 178.387 23.3473 183.798V184.892C35.6992 189.416 48.5142 192.558 61.5579 194.261C64.0842 194.619 66.6105 194.998 69.1789 195.229C71.7473 195.461 74.2316 195.84 76.821 196.071H77.1368C86.021 196.85 95.4737 197.271 105.158 197.271C115.874 197.271 126.21 196.787 135.895 195.84H136.189C138.779 195.587 141.368 195.356 143.832 195.061L151.474 193.903C164.451 192.131 177.172 188.824 189.368 184.05L189.663 183.924V182.956C203.326 177.735 210.189 171.229 210.189 163.65C210.194 162.59 210.053 161.535 209.768 160.513V160.513ZM94.1473 82.0714C94.6788 80.4969 95.5395 79.0537 96.672 77.8377C97.8046 76.6216 99.183 75.6607 100.716 75.0187C103.093 73.9424 105.768 73.7121 108.295 74.3661C110.572 74.8998 112.645 76.0851 114.259 77.7772C115.874 79.4694 116.961 81.5952 117.387 83.8949C117.814 86.1947 117.561 88.5688 116.661 90.7274C115.76 92.886 114.25 94.7356 112.316 96.0503C111.999 96.2247 111.759 96.5128 111.646 96.8565C111.533 97.2003 111.554 97.5742 111.705 97.9029C112.505 100.85 113.158 103.798 113.811 106.745C114.421 109.208 115.074 111.671 115.684 114.156C116.168 116.261 116.695 118.24 117.116 120.282C117.432 121.545 117.116 121.777 115.916 121.777H95.0526C93.7894 121.777 93.5579 121.545 93.8526 120.345C94.3368 118.113 94.9263 115.882 95.4737 113.735C96.021 111.587 96.5473 109.145 97.1579 106.871C97.7684 104.598 98.2947 102.303 98.9052 100.008C99.0737 99.1029 99.3895 98.1977 99.4947 97.2503C99.4892 97.05 99.4391 96.8535 99.348 96.6751C99.257 96.4966 99.1273 96.3407 98.9684 96.2187C96.6925 94.7768 94.9883 92.5889 94.1473 90.0293C93.2683 87.4494 93.2683 84.6512 94.1473 82.0714V82.0714Z",fill:"#202124"})})})]})]}):_==="failed"?o("div",{class:"signin-pageLayout-wrapper v-middle",style:{backgroundColor:T.page_background||"#f2f4f8"},children:[o("div",{class:"signin-pageLayout-bg"}),o("div",{class:"signin-pageLayout",children:o("div",{class:"login-card",style:{backgroundColor:T.background||"#fff",borderColor:T.button_border||"#c1c7cd"},children:[o("div",{class:"header",children:[o("div",{class:"icon-wrap",children:[o("div",{class:"wave error"}),o("div",{class:"icon error",children:o("svg",{xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"#ef4444","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round",children:[o("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),o("path",{d:"M5 13a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v6a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-6z"}),o("path",{d:"M11 16a1 1 0 1 0 2 0a1 1 0 0 0 -2 0"}),o("path",{d:"M8 11v-4a4 4 0 1 1 8 0v4"})]})})]}),o("div",{class:"login-card-title",children:[o("div",{class:"title",children:o("h1",{style:{fontSize:"24px"},children:a("magic_link_page.heading","Verification Failed")})}),o("div",{class:"description",children:a("magic_link_page.sub_heading","The MagicLink has expired or is invali
7d. Please request a new link.")})]})]}),o("div",{class:"form-control",children:o("button",{type:"button",class:"btn btn-primary w-full",onClick:W,style:{backgroundColor:T.btn_color||"#6a7bd2",color:T.text_color||"#fff",borderColor:T.btn_color||"#6a7bd2"},children:a("magic_link_page.button_text","Request a new link")})}),o("div",{class:"sign-method",children:o("div",{style:{display:"none"},children:[a("magic_link_page.help_text","Need help?"),o("a",{href:"#",style:{color:T.btn_color||"#1d4ed8",marginLeft:"4px"},children:a("magic_link.failed.support","Contact support")})]})})]})}),!T.white_label&&o("div",{class:"footer",children:[o("span",{children:a("common.secured_by","Secured by")}),o("a",{href:"https://ssojet.com",target:"_blank",children:o("svg",{viewBox:"0 0 211 198",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"18px",width:"auto",verticalAlign:"middle",opacity:"0.5",marginLeft:"4px"},children:o("path",{d:"M209.768 160.513C209.415 159.459 208.927 158.454 208.316 157.524C208.316 157.524 208.316 157.398 208.189 157.335C205.011 152.513 198.505 148.135 189.558 144.408C189.174 144.209 188.772 144.047 188.358 143.924C187.621 143.629 186.905 143.313 186.126 143.019C183.474 142.177 180.653 141.335 177.579 140.492C172.716 139.229 167.474 138.092 161.895 137.061L161.768 136.282V135.924C161.053 131.713 159.179 124.913 155.874 113.482C150.884 95.924 144.021 71.7977 137.895 43.0398C136.442 36.3661 137.284 30.9556 140.463 26.3871C147.747 15.5029 166.337 12.5977 173.179 11.3556C173.974 11.1526 174.783 11.0118 175.6 10.9345C179.453 10.0924 179.916 7.50294 179.916 6.36609C179.907 5.24625 179.496 4.16693 178.758 3.32461C178.02 2.48229 177.004 1.93296 175.895 1.77662H175.474H175.284C155.684 -0.0339065 137.032 -1.63391 121.347 3.22925C103.347 8.63978 91.0316 21.6293 82.7789 44.1766L48.6105 136.282V136.408L48.021 137.25C42.9052 138.198 38.021 139.356 33.4526 140.492C29.3684 141.566 25.7052 142.724 22.3368 143.924C21.9223 144.047 21.5205 144.209 21.1368 144.408C19.9789 144.829 18.9052 145.313 17.8737 145.735C17.7681 145.744 17.6668 145.781 17.5789 145.84C13.076 147.768 8.91098 150.405 5.24208 153.65V153.65C4.22234 154.739 3.31919 155.932 2.54734 157.208C2.54734 157.208 2.42103 157.335 2.42103 157.398C1.32586 159.3 0.745379 161.455 0.736816 163.65C0.736816 171.587 8.31577 178.387 23.3473 183.798V184.892C35.6992 189.416 48.5142 192.558 61.5579 194.261C64.0842 194.619 66.6105 194.998 69.1789 195.229C71.7473 195.461 74.2316 195.84 76.821 196.071H77.1368C86.021 196.85 95.4737 197.271 105.158 197.271C115.874 197.271 126.21 196.787 135.895 195.84H136.189C138.779 195.587 141.368 195.356 143.832 195.061L151.474 193.903C164.451 192.131 177.172 188.824 189.368 184.05L189.663 183.924V182.956C203.326 177.735 210.189 171.229 210.189 163.65C210.194 162.59 210.053 161.535 209.768 160.513V160.513ZM94.1473 82.0714C94.6788 80.4969 95.5395 79.0537 96.672 77.8377C97.8046 76.6216 99.183 75.6607 100.716 75.0187C103.093 73.9424 105.768 73.7121 108.295 74.3661C110.572 74.8998 112.645 76.0851 114.259 77.7772C115.874 79.4694 116.961 81.5952 117.387 83.8949C117.814 86.1947 117.561 88.5688 116.661 90.7274C115.76 92.886 114.25 94.7356 112.316 96.0503C111.999 96.2247 111.759 96.5128 111.646 96.8565C111.533 97.2003 111.554 97.5742 111.705 97.9029C112.505 100.85 113.158 103.798 113.811 106.745C114.421 109.208 115.074 111.671 115.684 114.156C116.168 116.261 116.695 118.24 117.116 120.282C117.432 121.545 117.116 121.777 115.916 121.777H95.0526C93.7894 121.777 93.5579 121.545 93.8526 120.345C94.3368 118.113 94.9263 115.882 95.4737 113.735C96.021 111.587 96.5473 109.145 97.1579 106.871C97.7684 104.598 98.2947 102.303 98.9052 100.008C99.0737 99.1029 99.3895 98.1977 99.4947 97.2503C99.4892 97.05 99.4391 96.8535 99.348 96.6751C99.257 96.4966 99.1273 96.3407 98.9684 96.2187C96.6925 94.7768 94.9883 92.5889 94.1473 90.0293C93.2683 87.4494 93.2683 84.6512 94.1473 82.0714V82.0714Z",fill:"#202124"})})})]})]}):o("div",{class:"signin-pageLayout-wrapper v-middle",style:{backgroundColor:T.page_background||"#f2f4f8"},children:[o("div",{class:"signin-pageLayout-bg"}),o("div",{class:"signin-pageLayout",children:o("div",{class:"login-card",style:{backgroundColor:T.background||"#fff",borderColor:T.button_border||"#c1c7cd"},children:[o("div",{class:"header",children:[o("div",{class:"logo",children:o("img",{src:T.brand_logo||"https://cdn.ssojet.com/assets/logo.png",alt:T.brand||"SSOJet",class:"logo"})}),o("div",{class:"login-card-title",children:[o("div",{class:"title",children:o("h1",{style:{fontSize:"24px"},children:a("verification.heading","Verify your account")}
7)}),o("div",{class:"description",children:[a("verification.sub_heading","A verification link has been sent to")," ",B,"."]})]})]}),o("div",{class:"loader",children:o("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 200 200",children:[o("circle",{fill:T.btn_color||"#1D4ED8",stroke:T.btn_color||"#1D4ED8","stroke-width":"2",r:"15",cx:"40",cy:"100",children:o("animate",{attributeName:"opacity",calcMode:"spline",dur:"2",values:"1;0;1;",keySplines:".5 0 .5 1;.5 0 .5 1",repeatCount:"indefinite",begin:"-.4"})}),o("circle",{fill:T.btn_color||"#1D4ED8",stroke:T.btn_color||"#1D4ED8","stroke-width":"2",r:"15",cx:"100",cy:"100",children:o("animate",{attributeName:"opacity",calcMode:"spline",dur:"2",values:"1;0;1;",keySplines:".5 0 .5 1;.5 0 .5 1",repeatCount:"indefinite",begin:"-.2"})}),o("circle",{fill:T.btn_color||"#1D4ED8",stroke:T.btn_color||"#1D4ED8","stroke-width":"2",r:"15",cx:"160",cy:"100",children:o("animate",{attributeName:"opacity",calcMode:"spline",dur:"2",values:"1;0;1;",keySplines:".5 0 .5 1;.5 0 .5 1",repeatCount:"indefinite",begin:"0"})})]})}),o("div",{class:"sign-method",children:[r>0?o("div",{children:[a("verification.button.resend_again","You can request a new link in")," ",r," ",a("verification.seconds","seconds"),"."]}):o("div",{children:[a("verification.help_text","Not received yet?"),o("a",{href:"#",onClick:j=>{j.preventDefault(),V()},class:e?"disabled":"",style:{color:T.btn_color||"#1d4ed8",marginLeft:"4px"},children:e?o(te,{children:[o(se,{variant:"secondary",size:"small"})," Sending..."]}):a("verification.button.resend","Resend verification link")})]}),l&&o("div",{class:"form-error",style:{color:"#e74c3c",marginTop:"8px"},children:l})]})]})}),!T.white_label&&o("div",{class:"footer",children:[o("span",{style:{fontSize:"12px",color:"#666"},children:a("common.secured_by","Secured by")}),o("a",{href:"https://ssojet.com",target:"_blank",style:{display:"inline-flex",alignItems:"center",textDecoration:"none",color:"#000",fontWeight:"600",marginLeft:"6px"},children:o("img",{src:Se,alt:"SSOJet",height:"18",style:{opacity:.5}})})]})]})},Ti=()=>{const{isAuthenticated:e,user:t,oauth:r,logout:n}=ge();return e?!r||!t?o("div",{class:"profile-container",children:o(Vr,{text:"Loading profile..."})}):o("div",{class:"profile-container",children:[o("div",{class:"profile-header",children:[o("h1",{children:"User Profile"}),o("button",{onClick:()=>{n(),window.location.href="/"},class:"logout-btn",children:"Logout"})]}),o("div",{class:"profile-content",children:[o("div",{class:"profile-section",children:[o("h2",{children:"User Information"}),o("div",{class:"profile-info",children:[o("div",{class:"info-item",children:[o("label",{children:"User ID:"}),o("span",{children:t.user_id})]}),o("div",{class:"info-item",children:[o("label",{children:"Email:"}),o("span",{children:t.identifier})]}),o("div",{class:"info-item",children:[o("label",{children:"Issuer:"}),o("span",{children:t.issuer})]}),o("div",{class:"info-item",children:[o("label",{children:"Created:"}),o("span",{children:new Date(t.created_at).toLocaleDateString()})]}),o("div",{class:"info-item",children:[o("label",{children:"Updated:"}),o("span",{children:new Date(t.updated_at).toLocaleDateString()})]})]})]}),o("div",{class:"profile-section",children:[o("h2",{children:"OAuth Information"}),o("div",{class:"oauth-info",children:[o("div",{class:"info-item",children:[o("label",{children:"Token Type:"}),o("span",{children:r.token_type})]}),o("div",{class:"info-item",children:[o("label",{children:"Expires In:"}),o("span",{children:[r.expires_in," seconds"]})]}),o("div",{class:"info-item",children:[o("label",{children:"Access Token:"}),o("span",{class:"token",children:[r.access_token.substring(0,20),"..."]})]}),o("div",{class:"info-item",children:[o("label",{children:"ID Token:"}),o("span",{class:"token",children:[r.id_token.substring(0,20),"..."]})]}),o("div",{class:"info-item",children:[o("label",{children:"Refresh Token:"}),o("span",{class:"token",children:[r.refresh_token.substring(0,20),"..."]})]})]})]})]})]}):(window.location.href="/",null)},Xt={okta:"okta.com",entraid:"microsoft.com",onelogin:"onelogin.com",googleworkspace:"google.com",salesforce:"salesforce.com",jumpcloud:"jumpcloud.com",cloudflare:"cloudflare.com",auth0:"auth0.com",duo:"duo.com",cyberark:"cyberark.com",oracle:"oracle.com",cas:"apereo.org",pingone:"pingidentity.com",pingfederate:"pingidentity.com",shibboleth:"shibboleth.net",azuread:"microsoft.com",azure:"microsoft.com",entra:"microsoft.com",microsoft:"microsoft.com",adfs:"microsoft.com",google:"google.com",ping:"pingidentity.com"},Ei="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23111827' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='11' width='18' height='11' rx='2' ry='2'/%3E%3Cpath d='M7 11V7a5 5 0 0 1 10 0v4'/%3E%3C/svg%3E",Ii="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M68 77 A30 30 0 1 1 68 39' fill='none' stroke='%239e9e9e' stroke-width='14'/%3E%3Cpath d='M60 23 L92 39 L60 55 Z' fill='%239e9e9e'/%3E%3Crect x='44' y='6' width='12' height='88' rx='1.5' fill='%23F7931E'/%3E%3C/svg%3E",Oi=()=>{var a,T;const{branding:e,getApiKey:t}=ge(),[r,n]=F(""),[i,s]=F(!1),[l,d]=F(null),[_,g]=F(null),[k,b]=F(null),h="sso",x=((a=e==null?void 0:e.data)==null?void 0:a.data)||(e==null?void 0:e.data)||{},c=(w,L)=>P(`${h}.${w}`,L),P=(w,L)=>{var E,R,I;const j=w.split(".");let O=((R=(E=e==null?void 0:e.data)==null?void 0:E.data)==null?void 0:R.localization)||((I=e==null?void 0:e.data)==null?void 0:I.localization)||(e==null?void 0:e.localization);for(const p of j)if(O&&typeof O=="object"&&p in O)O=O[p];else return L;return typeof O=="string"?O:L},M=async w=>{var O,E;if(d(null),!r){d(P("sso.validation.email_required","Email is required"));return}const L=oe.getOIDCState();if(!L){d(P("sso.validation.state_required","State is required"));return}const j=x.client_id||x.api_key||((O=e==null?void 0:e.data)==null?void 0:O.client_id)||((E=e==null?void 0:e.data)==null?void 0:E.api_key)||t()||"";w?b(w):s(!0);
7try{const I=(await de.hostedPageSSO({state:L,email:r.trim(),...w?{connection_id:w}:{}},j)).data||{};if(I.action==="sso_selection"){g(I.connections||[]);return}At(I.redirect_uri||"",I.response_mode)}catch(R){d(R instanceof Error?R.message:P("sso.validation.failed","SSO failed"))}finally{s(!1),b(null)}},B=async w=>{w.preventDefault(),await M()},D=async w=>{k||await M(w)},q=()=>{g(null),b(null),d(null)},V=w=>w.display_name||w.name||w.type||P("sso.connection.fallback","SSO provider"),W=w=>(w.protocol||"").toLowerCase()==="oidc"?Ii:Ei,A=w=>{const L=(w.type||"").toLowerCase().replace(/[^a-z0-9]/g,"");let j=Xt[L];if(!j){const O=`${w.type||""} ${w.name||""} ${w.display_name||""}`.toLowerCase(),E=Object.keys(Xt).find(R=>O.includes(R));j=E?Xt[E]:void 0}return j?`https://www.google.com/s2/favicons?domain=${j}&sz=64`:W(w)};return ee(()=>{var L,j,O;const w=((L=e==null?void 0:e.data)==null?void 0:L.data)||(e==null?void 0:e.data)||{};if(Object.keys(w).length>0){const E=document.documentElement;if(w.btn_color&&(E.style.setProperty("--primary-color",w.btn_color),E.style.setProperty("--button-background",w.btn_color)),w.text_color&&E.style.setProperty("--button-text-color",w.text_color),w.background&&E.style.setProperty("--card-background",w.background),w.page_background&&(E.style.setProperty("--page-background",w.page_background),document.body.style.backgroundColor=w.page_background),w.button_border&&E.style.setProperty("--button-border-color",w.button_border),w.icon_color&&E.style.setProperty("--icon-color",w.icon_color),(j=w.font)!=null&&j.family&&(E.style.setProperty("--font-family",w.font.family),document.body.style.fontFamily=w.font.family),(O=w.font)!=null&&O.url){const R=document.createElement("link");R.rel="stylesheet",R.href=w.font.url,document.head.appendChild(R)}if(w.favicon){const R=document.querySelector('link[rel="icon"]')||document.createElement("link");R.rel="icon",R.href=w.favicon,document.querySelector('link[rel="icon"]')||document.head.appendChild(R)}w.brand&&(document.title=`Sign in - ${w.brand}`)}},[e]),o("div",{class:"signin-pageLayout-wrapper v-middle login-page-layout",children:[o("div",{class:"signin-pageLayout-bg",style:{backgroundColor:x.page_background||"#f2f4f8"}}),o("div",{class:"signin-pageLayout align-start",style:{backgroundColor:x.background||"#fff",borderColor:x.button_border||"#c1c7cd"},children:o("div",{class:"login-card sso-login-card",style:{backgroundColor:((T=x==null?void 0:x.theme)==null?void 0:T.background)||"transparent",borderColor:(x==null?void 0:x.button_border)||"transparent"},children:[o("div",{class:"back-btn",children:o("button",{onClick:w=>{w.preventDefault(),_?q():le.navigateTo("/login")},style:{color:x.btn_color||"#1d4ed8"},children:[o("svg",{width:"8",height:"12",viewBox:"0 0 8 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:o("path",{d:"M6.5 1L1.5 6L6.5 11",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})}),P("sso.back","Back")]})}),o("div",{class:"login-card-header",style:{marginBottom:"10px",textAlign:"center"},children:[o("h1",{style:{color:"#111827",fontSize:"20px",fontWeight:"600",marginBottom:"2px"},children:_?P("sso.selection.heading","Choose a provider"):P("sso.heading","Single Sign-On")}),o("p",{style:{color:"#6b7280",fontSize:"14px",margin:0},children:_?P("sso.selection.sub_heading","Select how you'd like to sign in"):P("sso.sub_heading","Enter your enterprise email address")})]}),o("div",{class:"login-card-form",children:[l&&o("div",{class:"error-wrapper",style:{marginBottom:"16px"},children:o("div",{class:"error-message",children:o("span",{children:l})})}),_?o("div",{class:"social-login-buttons sso-connection-list",children:[_.length===0&&o("p",{style:{color:"#6b7280",fontSize:"14px",textAlign:"center",margin:0},children:P("sso.selection.empty","No sign-in providers are available.")}),_.map(w=>{const L=k===w.connection_id,j=!!k;return o("button",{type:"button",class:`social-provider sso-connection-btn${L?" btn-loading":""}`,onClick:()=>D(w.connection_id),disabled:j,style:{justifyContent:"space-between",opacity:j&&!L?.6:1,cursor:j?"not-allowed":"pointer"}
7,children:L?o("span",{class:"social-provider-content",children:[o(se,{}),o("span",{class:"social-provider-label",children:P("sso.button.connecting","Connecting...")})]}):o(te,{children:[o("span",{class:"social-provider-content",children:[o("img",{class:"sso-provider-favicon",src:A(w),alt:"",width:20,height:20,loading:"lazy",onError:O=>{O.currentTarget.src=W(w)}}),o("span",{class:"social-provider-label",children:V(w)})]}),w.protocol&&o("span",{class:"sso-protocol-badge",children:w.protocol})]})},w.connection_id)})]}):o("form",{onSubmit:B,children:[o("div",{class:"form-control",style:{marginBottom:"16px"},children:[o("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"0px",width:"100%"},children:o("label",{style:{fontSize:"13px",display:"flex",fontWeight:"500",color:"#374151",margin:"0",flex:"0 0 auto"},children:c("input.label","Email")})}),o("input",{type:"email",placeholder:P("sso.input.placeholder","Email"),value:r,onInput:w=>n(w.target.value),class:"input-field",style:{boxSizing:"border-box",width:"100%",padding:"10px 14px",borderRadius:"6px",border:"1px solid #d1d5db",fontSize:"14px"},disabled:i})]}),o("div",{class:"form-control",children:o("button",{type:"submit",class:"btn w-full",disabled:i||!r.trim(),style:{backgroundColor:x.btn_color||"#2563eb",color:"#ffffff",opacity:i||!r.trim()?.6:1,cursor:i||!r.trim()?"not-allowed":"pointer",padding:"10px",borderRadius:"6px",border:"none",width:"100%",fontWeight:"500",fontSize:"14px",transition:"all 0.2s"},children:i?o("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"},children:[o(se,{}),P("sso.button.connecting","Connecting...")]}):P("sso.button.text","Single Sign-On")})})]})]})]})}),!x.white_label&&o("div",{class:"footer",style:{marginTop:"24px",textAlign:"center",display:"flex",justifyContent:"center",alignItems:"center",gap:"6px"},children:[o("span",{style:{fontSize:"12px",color:"#666"},children:P("common.secured_by","Secured by")}),o("a",{href:"https://ssojet.com",target:"_blank",style:{display:"inline-flex",alignItems:"center",textDecoration:"none",color:"#000",fontWeight:"600"},children:o("img",{src:Se,alt:"SSOJet",height:"18",style:{opacity:.5}})})]})]})},Li=({domain:e})=>o("div",{class:"error-page",style:{background:"#f8fafc",minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center",padding:"20px"},children:o("div",{class:"error-container",style:{backgroundColor:"#fff",borderRadius:"16px",boxShadow:"0 20px 40px rgba(0, 0, 0, 0.1)",maxWidth:"600px",width:"100%",padding:"48px 40px",textAlign:"center"},children:[o("div",{class:"error-icon-container",style:{width:"80px",height:"80px",backgroundColor:"#e2e8f0",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",margin:"0 auto 32px",fontSize:"32px"},children:"âï¸"}),o("h1",{style:{color:"#2c3e50",fontSize:"32px",fontWeight:"700",margin:"0 0 16px 0",lineHeight:"1.2"},children:"Configuration Error"}),o("p",{style:{fontSize:"18px",color:"#64748b",margin:"0 0 24px 0",lineHeight:"1.5"},children:"Unable to load authentication configuration for domain:"}),o("div",{style:{backgroundColor:"#f1f5f9",border:"1px solid #e2e8f0",borderRadius:"8px",padding:"16px",margin:"0 0 32px 0",fontFamily:"monospace",fontSize:"16px",color:"#475569",wordBreak:"break-all"},children:e}),o("div",{class:"help-text",style:{backgroundColor:"#f8fafc",borderRadius:"12px",padding:"32px",margin:"0 0 32px 0",textAlign:"left",border:"1px solid #e2e8f0"},children:[o("h2",{style:{color:"#374151",fontSize:"20px",fontWeight:"600",margin:"0 0 20px 0",display:"flex",alignItems:"center",gap:"8px"},children:"ð§ Troubleshooting Steps:"}),o("ol",{style:{margin:"0",paddingLeft:"20px",color:"#64748b",fontSize:"16px",lineHeight:"1.7"},children:[o("li",{style:{marginBottom:"12px"},children:[o("strong",{children:"Verify Domain Configuration:"})," Check that your domain is correctly configured in the SSOJet Dashboard"]}),o("li",{style:{marginBottom:"12px"},children:[o("strong",{children:"Validate API Key:"})," Ensure your API Key is valid and has the necessary permissions"]}),o("li",{style:{marginBottom:"12px"},children:[o("strong",{children:"Domain Whitelist:"})," Confirm your domain is added to the whitelist in your SSOJet settings"]})]})]}),o("div",{class:"actions",style:{display:"flex",gap:"16px",justifyContent:"center"},children:[o("a",{href:"https://docs.ssojet.com",target:"_blank",rel:"noopener noreferrer",style:{backgroundColor:"#475569",color:"#fff",textDecoration:"none",padding:"14px 24px",borderRadius:"12px",fontSize:"16px",fontWeight:"600",display:"inline-flex",alignItems:"center",gap:"8px",transition:"all 0.2s ease"},onMouseOver:t=>{t.currentTarget.style.transform="translateY(-2px)",t.currentTarget.style.boxShadow="0 8px 16px rgba(71, 85, 105, 0.3)"},onMouseOut:t=>{t.currentTarget.style.transform="translateY(0)",t.currentTarget.style.boxShadow="none"},children:"ð View Documentation"}),o("button",{onClick:()=>window.location.reload(),style:{backgroundColor:"#94a3b8",color:"#fff",border:"none",padding:"14px 24px",borderRadius:"12px",fontSize:"16px",fontWeight:"600",cursor:"pointer",display:"inline-flex",alignItems:"center",gap:"8px",transition:"all 0.2s ease"},onMouseOver:t=>{t.currentTarget.style.transform="translateY(-2px)",t.currentTarget.style.boxShadow="0 8px 16px rgba(148, 163,
7184, 0.3)"},onMouseOut:t=>{t.currentTarget.style.transform="translateY(0)",t.currentTarget.style.boxShadow="none"},children:"ð Retry"})]}),o("div",{style:{marginTop:"32px",paddingTop:"24px",borderTop:"1px solid #e2e8f0",fontSize:"14px",color:"#94a3b8",lineHeight:"1.5"},children:"Need help? Contact your system administrator or visit our support documentation for detailed configuration instructions."})]})});function Ai({stateInfo:e}){var s,l,d;const t=()=>{var g;if((g=e.error)!=null&&g.includes("required")){alert("Please use the proper login link provided by your administrator. Direct access to this page is not allowed.");return}const _=window.location.origin+"/login";window.location.href=_},r=()=>{var _;return(_=e.error)!=null&&_.includes("required")?"This login page requires a valid state parameter. Please access this page through the proper login link provided by your administrator.":e.isExpired?"Your login session has expired. Please try again.":e.error?e.error:"Invalid login state. Please try again."},n=()=>{var _;return(_=e.error)!=null&&_.includes("required")?"Access Denied":e.isExpired?"Session Expired":"Invalid Login Link"};return o("div",{class:"signin-pageLayout-wrapper v-middle",style:{background:"#f8fafc",minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center"},children:o("div",{class:"signin-pageLayout",children:o("div",{class:"login-card error-card",style:{backgroundColor:"#fff",borderRadius:"16px",border:"none",maxWidth:"500px",width:"100%",padding:"40px",textAlign:"center"},children:[o("div",{class:"error-header",style:{marginBottom:"32px"},children:[o("div",{class:"error-icon-container",style:{width:"80px",height:"80px",backgroundColor:"#e2e8f0",borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",margin:"0 auto 24px",fontSize:"32px"},children:(()=>{var _;return(_=e.error)!=null&&_.includes("required")?"ð":e.isExpired?"â°":"â ï¸"})()}),o("h1",{class:"error-title",style:{color:"#2c3e50",fontSize:"28px",fontWeight:"700",margin:"0 0 16px 0",lineHeight:"1.2"},children:n()}),o("p",{class:"error-message",style:{fontSize:"16px",color:"#64748b",margin:"0",lineHeight:"1.5"},children:r()})]}),o("div",{class:"error-details",style:{padding:"24px 0",margin:"24px 0",textAlign:"left"},children:[o("p",{style:{margin:"0 0 16px 0",fontWeight:"600",color:"#475569",fontSize:"14px"},children:"This can happen when:"}),o("ul",{style:{margin:"0",paddingLeft:"20px",color:"#64748b",fontSize:"14px",lineHeight:"1.6"},children:(s=e.error)!=null&&s.includes("required")?o(te,{children:[o("li",{style:{marginBottom:"8px"},children:"You accessed this page directly without a proper login link"}),o("li",{style:{marginBottom:"8px"},children:"The URL was modified or incomplete"}),o("li",{style:{marginBottom:"8px"},children:"You bookmarked this page (which is not allowed)"})]}):o(te,{children:[o("li",{style:{marginBottom:"8px"},children:"The login link has expired"}),o("li",{style:{marginBottom:"8px"},children:"The login link was already used"}),o("li",{style:{marginBottom:"8px"},children:"The login link is malformed"})]})})]}),o("button",{type:"button",class:"retry-btn",onClick:t,style:{backgroundColor:"#475569",color:"#fff",border:"none",borderRadius:"12px",padding:"14px 32px",fontSize:"16px",fontWeight:"600",cursor:"pointer",transition:"all 0.2s ease",width:"100%",marginBottom:"24px"},onMouseOver:_=>{_.currentTarget.style.transform="translateY(-2px)",_.currentTarget.style.boxShadow="0 8px 16px rgba(0, 0, 0, 0.15)"},onMouseOut:_=>{_.currentTarget.style.transform="translateY(0)",_.currentTarget.style.boxShadow="none"},children:(l=e.error)!=null&&l.includes("required")?"Contact Administrator":"Try Again"}),o("div",{class:"help-text",style:{paddingTop:"24px",borderTop:"1px solid #e2e8f0"},children:o("p",{style:{fontSize:"14px",color:"#94a3b8",lineHeight:"1.5",margin:"0"},children:(d=e.error)!=null&&d.includes("required")?"Please obtain a proper login link from your administrator or the system that initiated this login process.":"If you continue to see this error, please contact your administrator or try accessing the login page from the original source."})})]})})})}const dr="login_retry_existing_state";function Ri(){var k,b;const[e,t]=F(!1),[r,n]=F(null),{branding:i,getApiKey:s}=ge(),l=((k=i==null?void 0:i.data)==null?void 0:k.data)||(i==null?void 0:i.data)||{},d=(h,x)=>{var M,B,D;const c=h.split(".");let P=((B=(M=i==null?void 0:i.data)==null?void 0:M.data)==null?void 0:B.localization)||((D=i==null?void 0:i.data)==null?void 0:D.localization)||(i==null?void 0:i.localization);for(const q of c)if(P&&typeof P=="object"&&q in P)P=P[q];else return x;if(typeof P=="string"){const q=P.trim();return q.length>
70?q:x}return x},_=()=>{const x=new URLSearchParams(window.location.search).get("state");return x||sessionStorage.getItem(dr)||""},g=async()=>{var x,c,P,M;n(null);const h=_();if(!h){n(d("errors.invalid_request","Unable to retry. Missing state."));return}t(!0);try{const B=l.client_id||l.api_key||((x=i==null?void 0:i.data)==null?void 0:x.client_id)||((c=i==null?void 0:i.data)==null?void 0:c.api_key)||s()||"",D=await de.retryHostedPageLogin({state:h},B),q=((P=D.data)==null?void 0:P.redirect_url)||((M=D.data)==null?void 0:M.redirect_uri);if(!q)throw new Error(d("errors.resource_not_found","Retry failed: redirect URL missing"));sessionStorage.removeItem(dr),window.location.assign(q)}catch(B){n(B instanceof Error?B.message:d("errors.internal_server_error","Retry failed"))}finally{t(!1)}};return o("div",{class:"signin-pageLayout-wrapper v-middle login-page-layout",style:{backgroundColor:l.page_background||"#eef2f6"},children:[o("div",{class:"signin-pageLayout",children:o("div",{class:"login-card",style:{backgroundColor:((b=l==null?void 0:l.theme)==null?void 0:b.login_box_color)||"#ffffff",minHeight:"520px",maxWidth:"620px",width:"100%",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"40px 52px",textAlign:"center"},children:[o("div",{style:{width:"90px",height:"90px",borderRadius:"999px",backgroundColor:"#f9ebbf",display:"flex",alignItems:"center",justifyContent:"center",marginBottom:"26px",color:"#d98a00",fontSize:"40px",lineHeight:1},children:"â°"}),o("img",{src:l.brand_logo||Se,alt:"SSOJet",style:{height:"50px",width:"auto",marginBottom:"16px"}}),o("h2",{style:{color:"#111827",fontSize:"24px",fontWeight:600,margin:"0 0 18px 0"},children:d("retry_page.heading","Session Expired")}),o("p",{style:{color:"#667085",fontSize:"14px",lineHeight:"1.35",margin:"0 0 32px 0",maxWidth:"540px"},children:d("retry_page.sub_heading","Your authentication session has expired for security reasons. Please try signing in again to continue.")}),r&&o("div",{class:"error-wrapper",style:{marginBottom:"16px",width:"100%"},children:o("div",{class:"error-message",children:o("span",{children:r})})}),o("button",{type:"button",onClick:g,disabled:e,class:"btn",style:{backgroundColor:l.btn_color||"#4f46e5",color:"#ffffff",border:"none",borderRadius:"12px",minWidth:"170px",height:"58px",fontSize:"16px",fontWeight:600,cursor:e?"not-allowed":"pointer",opacity:e?.7:1},children:e?o(se,{}):d("retry_page.button_text","Try Again")}),o("a",{href:"mailto:[email protected]",style:{marginTop:"30px",color:l.btn_color||"#4f46e5",textDecoration:"none",fontSize:"14px",fontWeight:500},children:d("retry_page.help_text","Need help?")})]})}),!l.white_label&&o("div",{class:"footer",style:{marginTop:"24px",textAlign:"center",display:"flex",justifyContent:"center",alignItems:"center",gap:"6px"},children:[o("span",{style:{fontSize:"12px",color:"#666"},children:d("common.secured_by","Secured by")}),o("a",{href:"https://ssojet.com",target:"_blank",style:{display:"inline-flex",alignItems:"center",textDecoration:"none",color:"#000",fontWeight:"600"},children:o("img",{src:Se,alt:"SSOJet",height:"18",style:{opacity:.5}})})]})]})}function ji(){const e=new URLSearchParams(window.location.search);return{error:e.get("error")||"authentication_error",errorDescription:e.get("error_description")||"Your authentication request could not be completed. Please try again or contact your administrator.",errorCode:e.get("error_code")||""}}function $i(){var i;const{branding:e}=ge(),t=((i=e==null?void 0:e.data)==null?void 0:i.data)||(e==null?void 0:e.data)||{},r=ji(),n=(s,l)=>{var g,k,b;const d=s.split(".");let _=((k=(g=e==null?void 0:e.data)==null?void 0:g.data)==null?void 0:k.localization)||((b=e==null?void 0:e.data)==null?void 0:b.localization)||(e==null?void 0:e.localization);for(const h of d)if(_&&typeof _=="object"&&h in _)_=_[h];else return l;if(typeof _=="string"){const h=_.trim();return h.length>0?h:l}return l};return o("div",{class:"signin-pageLayout-wrapper v-middle",style:{backgroundColor:t.page_background||"#eef2f6",padding:"8px 0"},children:[o("div",{class:"signin-pageLayout",children:o("div",{class:"login-card",style:{backgroundColor:t.background||"#ffffff",borderRadius:"14px",minHeight:"auto",maxWidth:"560px",width:"100%",padding:"0px 0px 0px",textAlign:"center"},children:[o("div",{style:{width:"72px",height:"72px",borderRadius:"999px",backgroundColor:"#fee2e2",display:"flex",alignItems:"center",justifyContent:"center",margin:"0 auto 1px",color:"#b91c1c",fontSize:"34px",lineHeight:1},children:"!"}),o("img",{src:Se,alt:"SSOJet",style:{height:"42px",width:"auto",marginBottom:"10px",display:"block",marginLeft:"auto",marginRight:"auto"}}),o("h1",{style:{color:"#111827",fontSize:"16px",fontWeight:600,lineHeight:"1.28",margin:"0 auto 8px",maxWidth:"360px"},children:n("error_page.heading","Authentication Could Not Be Completed")}),o("p",{style:{color:"#667085",fontSize:"12px",lineHeight:"1.4",margin:"0 auto 16px",maxWidth:"420px"},children:r.errorDescription}),o("div",{style:{backgroundColor:"#f8fafc",border:"1px solid #e2e8f0",borderRadius:"8px",padding:"11px 8px",margin:"0 auto 16px",width:"100%",textAlign:"left",maxWidth:"400px"},children:[o("div",{style:{color:"#0f172a",fontWeight:600,fontSize:"14px",marginBottom:"6px"},children:n("error_page.details_title","Error Details")}),o("div",{style:{color:"#475569",fontSize:"14px",lineHeight:"1.6"},children:[o("div",{children:[o("strong",{children:[n("error_page.type_label","Type"),":"]})," ",r.error]}),r.errorCode?o("div",{children:[o("strong",{children:[n("error_page.code_label","Code"),":"]})," ",r.errorCode]}):null]})]}),o("div",{class:"common-error-actions",style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px",width:"100%",maxWidth:"340px",margin:"0 auto"},children:[o("button",{type:"button",onClick:()=>{window.location.href=oe.preserveStateInURL(le.getPath("/login"))},style:{backgroundColor:t.btn_color||"#4f46e5",color:"#ffffff",border:"none",borderRadius:"12px",height:"48px",width:"100%",fontSize:"14px",fontWeight:600,cursor:"pointer",lineHeight:1},children:n("error_page.primary_cta","Return To Login")}),o("button",{type:"button",onClick:()=>window.location.reload(),style:{backgroundColor:"#e2e8f0",color:"#0f172a",border:"1px solid #cbd5e1",borderRadius:"12px",height:"48px",width:"100%",fontSize:"14px",fontWeight:600,cursor:"pointer",lineHeight:1},children:n("error_page.secondary_cta","Retry")})]}),o("a",{href:"mailto:[email protected]",style:{marginTop:"12px",color:t.btn_color||"#4f46e5",textDecoration:"none",fontSize:"13px",fontWeight:500},children:n("error_page.help_text","Need help?")})]})}),!t.white_label&&o("div",{class:"footer",style:{marginTop:"10px",textAlign:"center",display:"flex",justifyContent:"center",alignItems:"center",gap:"6px"},children:[o("span",{style:{fontSize:"12px",color:"#666"},children:n("common.secured_by","Secured by")}),o("a",{href:"https://ssojet.com",target:"_blank",style:{display:"inline-flex",alignItems:"center",textDecoration:"none",color:"#000",fontWeight:"600"},children:o("img",{src:Se,alt:"SSOJet",height:"18",style:{opacity:.5}})})]})]})}const ur=()=>o("svg",{width:"56",height:"56",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5",children:[o("rect",{x:"5",y:"11",width:"14",height:"9",rx:"2"}),o("path",{d:"M8 11V8a4 4 0 1 1 8 0v3"})]}),zi=()=>o("svg",{width:"56",height:"56",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5",children:[o("path",{d:"M14 3H8a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V9z"}),o("path",{d:"M14 3v6h6"})]}),Mi=()=>o("svg",{width:"56",height:"56",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5",children:[o("circle",{cx:"9",cy:"8",r:"3"}),o("path",{d:"M3 20v-1a6 6 0 0 1 12 0v1"}),o("path",{d:"M17 10a3 3 0 1 0-1-5.83"}),o("path",{d:"M21 20v-1a6 6 0 0 0-4-5.66"})]}),Bi=()=>o("svg",{width:"56",height:"56",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5",children:[o("path",{d:"M4.5 19.5c1.5.2 2.8-.2 3.8-1.2l8.8-8.8A8.5 8.5 0 0 0 20 4a8.5 8.5 0 0 0-5.5 2.9L5.7 15.7c-1 1-1.4 2.3-1.2 3.8z"}),o("path",{d:"M9 15l-2.5 2.5"}),o("path",{d:"M14.5 9.5 18 6"})]}),Wi=()=>o("svg",{width:"56",height:"56",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5",children:[o("path",{d:"M4 5.5A2.5 2.5 0 0 1 6.5 3H20v16H6.5A2.5 2.5 0 0 0 4 21V5.5z"}),o("path",{d:"M6.5 19A2.5 2.5 0 0 1 9 21h11"})]});function Ni(){return o("div",{class:"ssojet-home",children:[o("header",{class:"ssojet-home-header",children:o("div",{class:"ssojet-home-header-inner",children:[o("a",{class:"ssojet-home-logo",href:"https://ssojet.com",target:"_blank",rel:"noreferrer",children:o("img",{src:Se,alt:"SSOJet"})}),o("div",{class:"ssojet-home-actions",children:[o("button",{class:"ssojet-home-btn ssojet-home-btn-primary",type:"button",onClick:()=>le.navigateTo("/v1/u/login",!1),children:"Sign in"}),o("a",{class:"ssojet-home-btn ssojet-home-btn-outline",href:"https://ssojet.com",target:"_blank",rel:"noreferrer",children:"Start 30-day free trial"})]})]})}),o("main",{class:"ssojet-home-main",children:[o("section",{class:"ssojet-home-hero",children:[o("h1",{children:"SSOJet Enterprise SSO"}),o("p",{children:"Enterprise-grade Single Sign-On and Identity Management API. Connect with 25+ Identity Providers, enable SCIM provisioning, and implement passwordless authentication with industry-standard protocols."})]}),o("section",{class:"ssojet-home-grid",children:[o("article",{class:"ssojet-home-card",children:[o("div",{class:"ssojet-home-card-icon",children:o(ur,{})}),o("h3",{children:"OIDC/OAuth 2.0"}),o("p",{children:"Industry-standard OpenID Connect and OAuth 2.0 protocols for secure authentication and authorization flows"}),o("a",{href:"/.well-known/openid-configuration",children:"View Configuration"})]}),o("article",{class:"ssojet-home-card",children:[o("div",{class:"ssojet-home-card-icon",children:o(zi,{})}),o("h3",{children:"SAML 2.0"}
7),o("p",{children:"Implement secure, standards-compliant SAML 2.0 integration to provide seamless Single Sign-On (SSO) with enterprise identity providers"}),o("a",{href:"https://docs.ssojet.com",target:"_blank",rel:"noreferrer",children:"API Documentation"})]}),o("article",{class:"ssojet-home-card",children:[o("div",{class:"ssojet-home-card-icon",children:o(Mi,{})}),o("h3",{children:"SCIM Provisioning"}),o("p",{children:"Automated user provisioning and de-provisioning using System for Cross-domain Identity Management"}),o("a",{href:"https://docs.ssojet.com",target:"_blank",rel:"noreferrer",children:"Documentation"})]})]}),o("section",{class:"ssojet-home-section ssojet-home-section-muted",children:[o("h2",{children:"Quick Links"}),o("div",{class:"ssojet-home-grid",children:[o("article",{class:"ssojet-home-card",children:[o("div",{class:"ssojet-home-card-icon",children:o(Bi,{})}),o("h3",{children:"Getting Started"}),o("p",{children:"Complete Getting Started guide and examples"}),o("a",{href:"https://docs.ssojet.com",target:"_blank",rel:"noreferrer",children:"Learn more"})]}),o("article",{class:"ssojet-home-card",children:[o("div",{class:"ssojet-home-card-icon",children:o(ur,{})}),o("h3",{children:"OIDC Configuration"}),o("p",{children:"OpenID Connect discovery document"}),o("a",{href:"/.well-known/openid-configuration",children:"Learn more"})]}),o("article",{class:"ssojet-home-card",children:[o("div",{class:"ssojet-home-card-icon",children:o(Wi,{})}),o("h3",{children:"Developer Guide"}),o("p",{children:"Integration tutorials and best practices"}),o("a",{href:"https://docs.ssojet.com",target:"_blank",rel:"noreferrer",children:"Learn more"})]})]})]}),o("section",{class:"ssojet-home-section",children:[o("h2",{children:"API Endpoints"}),o("div",{class:"ssojet-home-endpoints",children:[o("div",{class:"ssojet-home-endpoint",children:[o("h4",{children:["Authorization: ",o("code",{children:"/authorize"})]}),o("p",{children:"OIDC authorization endpoint"})]}),o("div",{class:"ssojet-home-endpoint",children:[o("h4",{children:["Token: ",o("code",{children:"/oauth2/token"})]}),o("p",{children:"OAuth 2.0 token endpoint"})]}),o("div",{class:"ssojet-home-endpoint",children:[o("h4",{children:["User Info: ",o("code",{children:"/userinfo"})]}),o("p",{children:"OIDC user information endpoint"})]}),o("div",{class:"ssojet-home-endpoint",children:[o("h4",{children:["JWKS: ",o("code",{children:"/.well-known/jwks.json"})]}),o("p",{children:"JSON Web Key Set for token verification"})]})]})]})]}),o("footer",{class:"ssojet-home-footer",children:o("div",{class:"ssojet-home-footer-inner",children:[o("p",{children:"© Copyright 2026, SSOJet | 650 California St., San Francisco, CA 94108, US"}),o("div",{class:"ssojet-home-footer-links",children:[o("a",{href:"https://status.ssojet.com",target:"_blank",rel:"noreferrer",children:"Status"}),o("a",{href:"https://ssojet.com/privacy-policy",target:"_blank",rel:"noreferrer",children:"Privacy"}),o("a",{href:"https://ssojet.com/terms-and-conditions",target:"_blank",rel:"noreferrer",children:"Terms"})]})]})})]})}const pr="login_retry_existing_state",hr="branding-custom-css",Ui=e=>{if(!e)return null;const t=e.trim();return t?t.includes("@")?t.replace(/\s+/g,"+"):t:null},Di=e=>{if(!e||typeof e!="object")return"";const t=e,r=t.data,n=r==null?void 0:r.data,i=(n==null?void 0:n.custom_css)??(r==null?void 0:r.custom_css)??t.custom_css;return typeof i=="string"?i.trim():""};function Fi(){const[e,t]=F(!1),[r,n]=F(!1),[i,s]=F(null),{email:l,phone:d,setEmail:_,setPhone:g,setStateId:k,getStateId:b,setBranding:h,branding:x,isAuthenticated:c,oauth:P,user:M,webAuthnSession:B}=ge(),[D,q]=F(!0),V=window.location.hostname,W=window.location.pathname,A=oe.isOIDCFlow(),a=new URLSearchParams(window.location.search),T=Ui(a.get("identifier")),w=Hr(window.location.search),L=K=>K.some(he=>{const m=le.normalizePath(he);return W===m||W===m.replace(/^\/v1\/u/,"")?!0:m.startsWith("/v1/u/")?!1:W===`/v1/u${m}`}),j=L(["/login/otp"]),O=L(["/sso"]),E=L(["/phone-verify"]),R=L(["/whatsapp-verify"]),I=L(["/magiclink"]),p=L(["/passkey-setup"]),v=L(["/profile"]),u=L(["/login/retry"]),f=L(["/error"]),C=L(["/signup","/sign-up","/register"]),N=W==="/"&&!A,X=L(["/login","/sign-in"])||W==="/v1/u/"||W==="/"&&A;return ee(()=>{if((j||E||R||I)&&w&&b()!==w&&k(w),!!T){if((j||I)&&!l){_(T);return}(E||R)&&!d&&g(T)}},[w,T,j,I,E,R,l,d,k,b,_,g]),ee(()=>{const K=()=>{const m=oe.getCurrentStateInfo();if(X||C){if(!oe.isOIDCFlow())return s({isValid:!1,isExpired:!1,error:"State parameter is required for login"}),n(!0),q(!1),!1;if(!m.isValid||m.isExpired)return ve.log("======> App: Invalid or expired state detected"+JSON.stringify(m)),s(m),n(!0),q(!1),!1}return oe.isOIDCFlow()&&(!m.isValid||m.isExpired)?(s(m),n(!0),q(!1),!1):!0},he=async()=>{var m,be,He,lt;try{const J=await bi.getBranding(V),pe=(J==null?void 0:J.status_validation)||((m=J==null?void 0:J.data)==null?void 0:m.status_validation)||((He=(be=J==null?void 0:J.data)==null?void 0:be.data)==null?void 0:He.state_validation),ct=((pe==null?void 0:pe.status)||(pe==null?void 0:pe.Status)||"").toString().toLowerCase(),Ve=(pe==null?void 0:pe.redirect_url)||(pe==null?void 0:pe.redirectUrl)||(pe==null?void 0:pe.RedirectURL);if(!u&&pe&&ct&&ct!=="valid"&&Ve){const S=oe.getStateFromURL();S&&sessionStorage.setItem(pr,S),window.location.href=Ve;return}if(!J.status){const S=J.redirect_url||((lt=J.data)==null?void 0:lt.redirect_url);if(S){const Xe=oe.getStateFromURL();Xe&&sessionStorage.setItem(pr,Xe),window.location.href=S;return}throw new Error(J.message||"Invalid branding data")}if(J.data)h(J.data);else throw new Error(J.message||"Invalid branding data")}catch(J){ve.error("Failed to load branding:",J),t(!0)}finally{q(!1)}};!f&&!K()||he()},[V,h,X,C,f]),ee(()=>{const K=Di(x),he=document.getElementById(hr);if(!K){he&&he.remove();return}const m=he||document.createElement("style");he||(m.id=hr,m.setAttribute("data-source","branding-api-custom-css"),document.head.appendChild(m)),m.textContent!==K&&(m.textContent=K)},[x]),r&&i&&!u?o(Ai,{stateInfo:i}):D?o("div",{class:"signin-pageLayout-wrapper v-middle",children:o("div",{class:"signin-pageLayout",children:o("div",{class:"login-card",children:o(Vr,{text:"Loading..."})})})}):f?o($i,{}):e?o(Li,{domain:V}):v?o(Ti,{}):(l||T)&&j?o(wi,{}):(d||T)&&E?o(xi,{}):(d||T)&&R?o(ki,{}):(l||T)&&I?o(Pi,{}):B&&p?o(Si,{}):c&&P&&M&&(X||C)?(le.navigateTo("/profile"),null):O?o(Oi,{}):N?o(Ni,{}):u?o(Ri,{}):C?o(Kt,{mode:"signup"}):X?o(Kt,{}):o(Kt,{})}Ke(o(Fi,{}),document.getElementById("app"));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.