vendor: 8,182 bytes, line 1
1var e=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports);(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var t=e((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function M(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function N(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),N(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+j(a,u),c+=N(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+j(a,u++),c+=N(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return N(M(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function P(e,t,n){if(e==null)return e;var r=[],i=0;return N(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function F(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var I=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},L={map:P,forEach:function(e,t,n){P(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return P(e,function(){t++}),t},toArray:function(e){return P(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=L,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:F}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,I)}catch(e){I(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()}
vendor: 11,742 bytes, lines 1-3
1,e.version=`19.2.4`})),n=e(((e,n)=>{n.exports=t()})),r=e((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),i=e(((e,t)=>{t.exports=r()})),a=e((e=>{var t=n();function r(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function i(){}var a={d:{f:i,r:function(){throw Error(r(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},o=Symbol.for(`react.portal`);function s(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var c=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(r(299));return s(e,t,null,n)},e.flushSync=function(e){var t=c.T,n=a.p;try{if(c.T=null,a.p=2,e)return e()}finally{c.T=t,a.p=n,a.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,a.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&a.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin),i=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?a.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:i,fetchPriority:o}):n===`script`&&a.d.X(e,{crossOrigin:r,integrity:i,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=l(t.as,t.crossOrigin);a.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??a.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin);a.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=l(t.as,t.crossOrigin);a.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else a.d.m(e)},e.requestFormReset=function(e){a.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return c.H.useFormState(e,t,n)},e.useFormStatus=function(){return c.H.useHostTransitionStatus()},e.version=`19.2.4`})),o=e(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=a()})),s=e((e=>{var t=i(),r=n(),a=o();function s(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function l(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function u(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function d(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function f(e){if(l(e)!==e)throw Error(s(188))}function p(e){var t=e.alternate;if(!t){if(t=l(e),t===null)throw Error(s(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var a=i.alternate;if(a===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===a.child){for(a=i.child;a;){if(a===n)return f(i),e;if(a===r)return f(i),t;a=a.sibling}throw Error(s(188))}if(n.return!==r.return)n=i,r=a;else{for(var o=!1,c=i.child;c;){if(c===n){o=!0,n=i,r=a;break}if(c===r){o=!0,r=i,n=a;break}c=c.sibling}if(!o){for(c=a.child;c;){if(c===n){o=!0,n=a,r=i;break}if(c===r){o=!0,r=a,n=i;break}c=c.sibling}if(!o)throw Error(s(189))}}if(n.alternate!==r)throw Error(s(190))}if(n.tag!==3)throw Error(s(188));return n.stateNode.current===n?e:t}function m(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=m(e),t!==null)return t;e=e.sibling}return null}var h=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),S=Symbol.for(`react.consumer`),C=Symbol.for(`react.context`),w=Symbol.for(`react.forward_ref`),T=Symbol.for(`react.suspense`),E=Symbol.for(`react.suspense_list`),D=Symbol.for(`react.memo`),O=Symbol.for(`react.lazy`),k=Symbol.for(`react.activity`),A=Symbol.for(`react.memo_cache_sentinel`),j=Symbol.iterator;function M(e){return typeof e!=`object`||!e?null:(e=j&&e[j]||e[`@@iterator`],typeof e==`function`?e:null)}var N=Symbol.for(`react.client.reference`);function P(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===N?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case T:return`Suspense`;case E:return`SuspenseList`;case k:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case C:return e.displayName||`Context`;case S:return(e._context.displayName||`Context`)+`.Consumer`;case w:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case D:return t=e.displayName||null,t===null?P(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return P(e(t))}catch{}}return null}var F=Array.isArray,I=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,R={pending:!1,data:null,method:null,action:null},z=[],B=-1;function V(e){return{current:e}}function H(e){0>B||(e.current=z[B],z[B]=null,B--)}function U(e,t){B++,z[B]=e.current,e.current=t}var W=V(null),G=V(null),ee=V(null),te=V(null);function ne(e,t){switch(U(ee,t),U(G,e),U(W,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}H(W),U(W,e)}function re(){H(W),H(G),H(ee)}function K(e){e.memoizedState!==null&&U(te,e);var t=W.current,n=Hd(t,e.type);t!==n&&(U(G,e),U(W,n))}function ie(e){G.current===e&&(H(W),H(G)),te.current===e&&(H(te),Qf._currentValue=R)}var q,ae;function oe(e){if(q===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);q=t&&t[1]||``,ae=-1<e.stack.indexOf(` 2 at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return` 3`+q+e+ae}var se=!1;function ce(e,t){if(!e||se)return``;se=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}
vendor: 6,582 bytes, lines 3-8
3else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(` 4`),l=s.split(` 5`);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=` 6`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{se=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?oe(n):``}function le(e,t){switch(e.tag){case 26:case 27:case 5:return oe(e.type);case 16:return oe(`Lazy`);case 13:return e.child!==t&&t!==null?oe(`Suspense Fallback`):oe(`Suspense`);case 19:return oe(`SuspenseList`);case 0:case 15:return ce(e.type,!1);case 11:return ce(e.type.render,!1);case 1:return ce(e.type,!0);case 31:return oe(`Activity`);default:return``}}function ue(e){try{var t=``,n=null;do t+=le(e,n),n=e,e=e.return;while(e);return t}catch(e){return` 7Error generating stack: `+e.message+` 8`+e.stack}}var de=Object.prototype.hasOwnProperty,fe=t.unstable_scheduleCallback,pe=t.unstable_cancelCallback,me=t.unstable_shouldYield,he=t.unstable_requestPaint,ge=t.unstable_now,_e=t.unstable_getCurrentPriorityLevel,ve=t.unstable_ImmediatePriority,ye=t.unstable_UserBlockingPriority,be=t.unstable_NormalPriority,xe=t.unstable_LowPriority,Se=t.unstable_IdlePriority,Ce=t.log,we=t.unstable_setDisableYieldValue,Te=null,Ee=null;function De(e){if(typeof Ce==`function`&&we(e),Ee&&typeof Ee.setStrictMode==`function`)try{Ee.setStrictMode(Te,e)}catch{}}var Oe=Math.clz32?Math.clz32:je,ke=Math.log,Ae=Math.LN2;function je(e){return e>>>=0,e===0?32:31-(ke(e)/Ae|0)|0}var Me=256,Ne=262144,Pe=4194304;function Fe(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Ie(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=Fe(n))):i=Fe(o):i=Fe(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Fe(n))):i=Fe(o)):i=Fe(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function Le(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Re(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ze(){var e=Pe;return Pe<<=1,!(Pe&62914560)&&(Pe=4194304),e}function Be(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ve(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function He(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-Oe(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&Ue(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Ue(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Oe(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function We(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Oe(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function Ge(e,t){var n=t&-t;return n=n&42?1:Ke(n),(n&(e.suspendedLanes|t))===0?n:0}function Ke(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function qe(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function Je(){var e=L.p;return e===0?(e=window.event,e===void 0?32:mp(e.type)):e}function Ye(e,t){var n=L.p;try{return L.p=e,t()}finally{L.p=n}}var Xe=Math.random().toString(36).slice(2),Ze=`__reactFiber$`+Xe,Qe=`__reactProps$`+Xe,$e=`__reactContainer$`+Xe,et=`__reactEvents$`+Xe,tt=`__reactListeners$`+Xe,nt=`__reactHandles$`+Xe,rt=`__reactResources$`+Xe,it=`__reactMarker$`+Xe;function at(e){delete e[Ze],delete e[Qe],delete e[et],delete e[tt],delete e[nt]}function ot(e){var t=e[Ze];if(t)return t;for(var n=e.parentNode;n;){if(t=n[$e]||n[Ze]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=df(e);e!==null;){if(n=e[Ze])return n;e=df(e)}return t}e=n,n=e.parentNode}return null}function st(e){if(e=e[Ze]||e[$e]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function ct(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(s(33))}function lt(e){var t=e[rt];return t||=e[rt]={hoistableStyles:new Map,hoistableScripts:new Map},t}function ut(e){e[it]=!0}var dt=new Set,ft={};function pt(e,t){mt(e,t),mt(e+`Capture`,t)}function mt(e,t){for(ft[e]=t,e=0;e<t.length;e++)dt.add(t[e])}var ht=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u
8037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`),gt={},_t={};function vt(e){return de.call(_t,e)?!0:de.call(gt,e)?!1:ht.test(e)?_t[e]=!0:(gt[e]=!0,!1)}function yt(e,t,n){if(vt(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}function bt(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,``+n)}}function xt(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function St(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Ct(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function wt(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Tt(e){if(!e._valueTracker){var t=Ct(e)?`checked`:`value`;e._valueTracker=wt(e,t,``+e[t])}}function Et(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Ct(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function Dt(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var Ot=/[\n"\\]/g;function kt(e){return e.replace(Ot,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function At(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+St(t)):e.value!==``+St(t)&&(e.value=``+St(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Mt(e,o,St(n)):Mt(e,o,St(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+St(s):e.removeAttribute(`name`)}function jt(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){Tt(e);return}n=n==null?``:``+St(n),t=t==null?n:``+St(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),Tt(e)}function Mt(e,t,n){t===`number`&&Dt(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function Nt(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+St(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Pt(e,t,n){if(t!=null&&(t=``+St(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+St(n)}function Ft(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(s(92));if(F(r)){if(1<r.length)throw Error(s(93));r=r[0]}n=r}n??=``,t=n}
vendor: 9,508 bytes, line 8
8n=St(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Tt(e)}function It(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Lt=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function Rt(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||Lt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function zt(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(s(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var i in t)r=t[i],t.hasOwnProperty(i)&&n[i]!==r&&Rt(e,i,r)}else for(var a in t)t.hasOwnProperty(a)&&Rt(e,a,t[a])}function Bt(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var Vt=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),Ht=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Ut(e){return Ht.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function Wt(){}var Gt=null;function Kt(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var qt=null,Jt=null;function Yt(e){var t=st(e);if(t&&(e=t.stateNode)){var n=e[Qe]||null;a:switch(e=t.stateNode,t.type){case`input`:if(At(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+kt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=r[Qe]||null;if(!i)throw Error(s(90));At(r,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&Et(r)}break a;case`textarea`:Pt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Nt(e,!!n.multiple,t,!1)}}}var Xt=!1;function Zt(e,t,n){if(Xt)return e(t,n);Xt=!0;try{return e(t)}finally{if(Xt=!1,(qt!==null||Jt!==null)&&(_u(),qt&&(t=qt,e=Jt,Jt=qt=null,Yt(t),e)))for(t=0;t<e.length;t++)Yt(e[t])}}function Qt(e,t){var n=e.stateNode;if(n===null)return null;var r=n[Qe]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=!(e===`button`||e===`input`||e===`select`||e===`textarea`)),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(s(231,t,typeof n));return n}var $t=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),en=!1;if($t)try{var tn={};Object.defineProperty(tn,"passive",{get:function(){en=!0}}),window.addEventListener(`test`,tn,tn),window.removeEventListener(`test`,tn,tn)}catch{en=!1}var nn=null,rn=null,an=null;function on(){if(an)return an;var e,t=rn,n=t.length,r,i=`value`in nn?nn.value:nn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return an=i.slice(e,1<r?1-r:void 0)}function sn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function cn(){return!0}function ln(){return!1}function un(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?cn:ln,this.isPropagationStopped=ln,this}return h(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=cn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=cn)},persist:function(){},isPersistent:cn}),t}var dn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},fn=un(dn),pn=h({},dn,{view:0,detail:0}),mn=un(pn),hn,gn,_n,vn=h({},pn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:kn,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==_n&&(_n&&e.type===`mousemove`?(hn=e.screenX-_n.screenX,gn=e.screenY-_n.screenY):gn=hn=0,_n=e),hn)},movementY:function(e){return`movementY`in e?e.movementY:gn}}),yn=un(vn),bn=un(h({},vn,{dataTransfer:0})),xn=un(h({},pn,{relatedTarget:0})),Sn=un(h({},dn,{animationName:0,elapsedTime:0,pseudoElement:0})),Cn=un(h({},dn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),wn=un(h({},dn,{data:0})),Tn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},En={8:`Backspace`,9:`Tab`,12:`Clear`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,19:`Pause`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,45:`Insert`,46:`Delete`,112:`F1`,113:`F2`,114:`F3`,115:`F4`,116:`F
85`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},Dn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function On(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Dn[e])?!!t[e]:!1}function kn(){return On}var An=un(h({},pn,{key:function(e){if(e.key){var t=Tn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=sn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?En[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:kn,charCode:function(e){return e.type===`keypress`?sn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?sn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),jn=un(h({},vn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Mn=un(h({},pn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:kn})),Nn=un(h({},dn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Pn=un(h({},vn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),Fn=un(h({},dn,{newState:0,oldState:0})),In=[9,13,27,32],Ln=$t&&`CompositionEvent`in window,Rn=null;$t&&`documentMode`in document&&(Rn=document.documentMode);var zn=$t&&`TextEvent`in window&&!Rn,Bn=$t&&(!Ln||Rn&&8<Rn&&11>=Rn),Vn=` `,Hn=!1;function Un(e,t){switch(e){case`keyup`:return In.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Wn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Gn=!1;function Kn(e,t){switch(e){case`compositionend`:return Wn(t);case`keypress`:return t.which===32?(Hn=!0,Vn):null;case`textInput`:return e=t.data,e===Vn&&Hn?null:e;default:return null}}function qn(e,t){if(Gn)return e===`compositionend`||!Ln&&Un(e,t)?(e=on(),an=rn=nn=null,Gn=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return Bn&&t.locale!==`ko`?null:t.data;default:return null}}var Jn={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Yn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!Jn[e.type]:t===`textarea`}function Xn(e,t,n,r){qt?Jt?Jt.push(r):Jt=[r]:qt=r,t=Td(t,`onChange`),0<t.length&&(n=new fn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var Zn=null,Qn=null;function $n(e){_d(e,0)}function er(e){if(Et(ct(e)))return e}function tr(e,t){if(e===`change`)return t}var nr=!1;if($t){var rr;if($t){var ir=`oninput`in document;if(!ir){var ar=document.createElement(`div`);ar.setAttribute(`oninput`,`return;`),ir=typeof ar.oninput==`function`}rr=ir}else rr=!1;nr=rr&&(!document.documentMode||9<document.documentMode)}function or(){Zn&&(Zn.detachEvent(`onpropertychange`,sr),Qn=Zn=null)}function sr(e){if(e.propertyName===`value`&&er(Qn)){var t=[];Xn(t,Qn,e,Kt(e)),Zt($n,t)}}function cr(e,t,n){e===`focusin`?(or(),Zn=t,Qn=n,Zn.attachEvent(`onpropertychange`,sr)):e===`focusout`&&or()}function lr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return er(Qn)}function ur(e,t){if(e===`click`)return er(t)}function dr(e,t){if(e===`input`||e===`change`)return er(t)}function fr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var pr=typeof Object.is==`function`?Object.is:fr;function mr(e,t){if(pr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!de.call(t,i)||!pr(e[i],t[i]))return!1}return!0}function hr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function gr(e,t){var n=hr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=hr(n)}}function _r(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?_r(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function vr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Dt(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Dt(e.document)}return t}function yr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var br=$t&&`documentMode`in document&&11>=document.documentMode,xr=null,Sr=null,Cr=null,wr=!1;function Tr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;wr||xr==null||xr!==Dt(r)||(r=xr,`selectionStart`in r&&yr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focu
vendor: 72,410 bytes, line 8
8sNode:r.focusNode,focusOffset:r.focusOffset}),Cr&&mr(Cr,r)||(Cr=r,r=Td(Sr,`onSelect`),0<r.length&&(t=new fn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=xr)))}function Er(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Dr={animationend:Er(`Animation`,`AnimationEnd`),animationiteration:Er(`Animation`,`AnimationIteration`),animationstart:Er(`Animation`,`AnimationStart`),transitionrun:Er(`Transition`,`TransitionRun`),transitionstart:Er(`Transition`,`TransitionStart`),transitioncancel:Er(`Transition`,`TransitionCancel`),transitionend:Er(`Transition`,`TransitionEnd`)},Or={},kr={};$t&&(kr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Dr.animationend.animation,delete Dr.animationiteration.animation,delete Dr.animationstart.animation),`TransitionEvent`in window||delete Dr.transitionend.transition);function Ar(e){if(Or[e])return Or[e];if(!Dr[e])return e;var t=Dr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in kr)return Or[e]=t[n];return e}var jr=Ar(`animationend`),Mr=Ar(`animationiteration`),Nr=Ar(`animationstart`),Pr=Ar(`transitionrun`),Fr=Ar(`transitionstart`),Ir=Ar(`transitioncancel`),Lr=Ar(`transitionend`),Rr=new Map,zr=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);zr.push(`scrollEnd`);function Br(e,t){Rr.set(e,t),pt(t,[e])}var Vr=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},Hr=[],Ur=0,Wr=0;function Gr(){for(var e=Ur,t=Wr=Ur=0;t<e;){var n=Hr[t];Hr[t++]=null;var r=Hr[t];Hr[t++]=null;var i=Hr[t];Hr[t++]=null;var a=Hr[t];if(Hr[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&Yr(n,i,a)}}function Kr(e,t,n,r){Hr[Ur++]=e,Hr[Ur++]=t,Hr[Ur++]=n,Hr[Ur++]=r,Wr|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function qr(e,t,n,r){return Kr(e,t,n,r),Xr(e)}function Jr(e,t){return Kr(e,null,null,t),Xr(e)}function Yr(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-Oe(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function Xr(e){if(50<cu)throw cu=0,lu=null,Error(s(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Zr={};function Qr(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function $r(e,t,n,r){return new Qr(e,t,n,r)}function ei(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ti(e,t){var n=e.alternate;return n===null?(n=$r(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function ni(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function ri(e,t,n,r,i,a){var o=0;if(r=e,typeof e==`function`)ei(e)&&(o=1);else if(typeof e==`string`)o=Uf(e,n,W.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case k:return e=$r(31,n,t,i),e.elementType=k,e.lanes=a,e;case y:return ii(n.children,i,a,t);case b:o=8,i|=24;break;case x:return e=$r(12,n,t,i|2),e.elementType=x,e.lanes=a,e;case T:return e=$r(13,n,t,i),e.elementType=T,e.lanes=a,e;case E:return e=$r(19,n,t,i),e.elementType=E,e.lanes=a,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case C:o=10;break a;case S:o=9;break a;case w:o=11;break a;case D:o=14;break a;case O:o=16,r=null;break a}o=29,n=Error(s(130,e===null?`null`:typeof e,``)),r=null}return t=$r(o,n,t,i),t.elementType=e,t.type=r,t.lanes=a,t}function ii(e,t,n,r){return e=$r(7,e,r,t),e.lanes=n,e}function ai(e,t,n){return e=$r(6,e,null,t),e.lanes=n,e}function oi(e){var t=$r(18,null,null,0);return t.stateNode=e,t}function si(e,t,n){return t=$r(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var ci=new WeakMap;function li(e,t){if(typeof e==`object`&&e){var n=ci.get(e);return n===void 0?(t={value:e,source:t,stack:ue(t)},ci.set(e,t),t):n}return{value:e,source:t,stack:ue(t)}}var ui=[],di=0,fi=null,pi=0,mi=[],hi=0,gi=null,_i=1,vi=``;function yi(e,t){ui[di++]=pi,ui[di++]=fi,fi=e,pi=t}function bi(e,t,n){mi[hi++]=_i,mi[hi++]=vi,mi[hi++]=gi,gi=e;var r=_i;e=vi;var i=32-Oe(r)-1;r&=~(1<<i),n+=1;var a=32-Oe(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,_i=1<<32-Oe(t)+i|n<<i|r,vi=a+e}else _i=1<<a|n<<i|r,vi=e}function xi(e){e.return!==null&&(yi(e,1),bi(e,1,0))}function Si(e){for(;e===fi;)fi=ui[--di],ui[di]=null,pi=ui[--di],ui[di]=null;for(;e===gi;)gi=mi[--hi],mi[hi]=null,vi=mi[--hi],mi[hi]=null,_i=mi[--hi],mi[hi]=null}function Ci(e,t){mi[hi++]=_i,mi[hi++]=vi,mi[hi++]=gi,_i=t.id,vi=t.overflow,gi=e}var wi=null,Ti=null,Ei=!1,Di=null,Oi=!1,ki=Error(s(519));function Ai(e){throw Ii(li(Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),ki}function ji(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[Ze]=e,t[Qe]=r,n){case`dialog`:vd(`cancel`,t),vd(`close`,t);break;case`iframe`:case`object`:case`embed`:vd(`load`,t);break;case`video`:case`audio`:for(n=0;n<hd.length;n++)vd(hd[n],t);break;case`source`:vd(`error`,t);break;case`img`:case`image`:case`link`:vd(`error`,t),vd(`load`,t);break;case`details`:vd(`toggle`,t);break;case`input`:vd(`invalid`,t),jt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:vd(`invalid`,t);break;case`textarea`:vd(`invalid`,t),Ft(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||jd(t.textContent,n)?(r.popover!=null&&(vd(`beforetoggle`,t),vd(`toggle`,t)),r.onScroll!=null&&vd(`scroll`,t),r.onScrollEnd!=null&&vd(`scrollend`,t),r.onClick!=null&&(t.onclick=Wt),t=!0):t=!1,t||Ai(e,!0)}function Mi(e){for(wi=e.return;wi;)switch(wi.tag){case 5:case 31:case 13:Oi=!1;return;case 27:case 3:Oi=!0;return;default:wi=wi.return}}function Ni(e){if(e!==wi)return!1;if(!Ei)return Mi(e),Ei=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!==`form`&&n!==`button`)||Ud(e.type,e.memoizedProps)),n=!n),n&&Ti&&Ai(e),Mi(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(s(317));Ti=uf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(s(317));Ti=uf(e)}else t===27?(t=Ti,Zd(e.type)?(e=lf,lf=null,Ti=e):Ti=t):Ti=wi?cf(e.stateNode.nextSibling):null;return!0}function Pi(){Ti=wi=null,Ei=!1}function Fi(){var e=Di;return e!==null&&(Jl===null?Jl=e:Jl.push.apply(Jl,e),Di=null),e}function Ii(e){Di===null?Di=[e]:Di.push(e)}var Li=V(null),Ri=null,zi=null;function Bi(e,t,n){U(Li,t._currentValue),t._currentValue=n}function Vi(e){e._currentValue=Li.current,H(Li)}function Hi(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Ui(e,t,n,r){var i=e.child;for(i!==null&&(i.return=e);i!==null;){var a=i.dependencies;if(a!==null){var o=i.child;a=a.firstContext;a:for(;a!==null;){var c=a;a=i;for(var l=0;l<t.length;l++)if(c.context===t[l]){a.lanes|=n,c=a.alternate,c!==null&&(c.lanes|=n),Hi(a.return,n,e),r||(o=null);break a}a=c.next}}else if(i.tag===18){if(o=i.return,o===null)throw Error(s(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),Hi(o,n,e),o=null}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===e){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}}function Wi(e,t,n,r){e=null;for(var i=t,a=!1;i!==null;){if(!a){if(i.flags&524288)a=!0;else if(i.flags&262144)break}if(i.tag===10){var o=i.alternate;if(o===null)throw Error(s(387));if(o=o.memoizedProps,o!==null){var c=i.type;pr(i.pendingProps.value,o.value)||(e===null?e=[c]:e.push(c))}}else if(i===te.current){if(o=i.alternate,o===null)throw Error(s(387));o.memoizedState.memoizedState!==i.memoizedState.memoizedState&&(e===null?e=[Qf]:e.push(Qf))}i=i.return}e!==null&&Ui(t,e,n,r),t.flags|=262144}function Gi(e){for(e=e.firstContext;e!==null;){if(!pr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ki(e){Ri=e,zi=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function qi(e){return Yi(Ri,e)}function Ji(e,t){return Ri===null&&Ki(e),Yi(e,t)}function Yi(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},zi===null){if(e===null)throw Error(s(308));zi=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else zi=zi.next=t;return n}var Xi=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},Zi=t.unstable_scheduleCallback,Qi=t.unstable_NormalPriority,$i={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ea(){return{controller:new Xi,data:new Map,refCount:0}}function ta(e){e.refCount--,e.refCount===0&&Zi(Qi,function(){e.controller.abort()})}var na=null,ra=0,ia=0,aa=null;function oa(e,t){if(na===null){var n=na=[];ra=0,ia=ld(),aa={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return ra++,t.then(sa,sa),t}function sa(){if(--ra===0&&na!==null){aa!==null&&(aa.status=`fulfilled`);var e=na;na=null,ia=0,aa=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function ca(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var la=I.S;I.S=function(e,t){Zl=ge(),typeof t==`object`&&t&&typeof t.then==`function`&&oa(e,t),la!==null&&la(e,t)};var ua=V(null);function da(){var e=ua.current;return e===null?Pl.pooledCache:e}function fa(e,t){t===null?U(ua,ua.current):U(ua,t.pool)}function pa(){var e=da();return e===null?null:{parent:$i._currentValue,pool:e}}var ma=Error(s(460)),ha=Error(s(474)),ga=Error(s(542)),_a={then:function(){}};function va(e){return e=e.status,e===`fulfilled`||e===`rejected`}function ya(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Wt,Wt),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Ca(e),e;default:if(typeof t.status==`string`)t.then(Wt,Wt);else{if(e=Pl,e!==null&&100<e.shellSuspendCounter)throw Error(s(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Ca(e),e}throw xa=t,ma}}function ba(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(xa=e,ma):e}}var xa=null;function Sa(){if(xa===null)throw Error(s(459));var e=xa;return xa=null,e}function Ca(e){if(e===ma||e===ga)throw Error(s(483))}var wa=null,Ta=0;function Ea(e){var t=Ta;return Ta+=1,wa===null&&(wa=[]),ya(wa,e,t)}function Da(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function Oa(e,t){throw t.$$typeof===g?Error(s(525)):(e=Object.prototype.toString.call(t),Error(s(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function ka(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function i(e,t){return e=ti(e,t),e.index=0,e.sibling=null,e}function a(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function o(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=ai(n,e.mode,r),t.return=e,t):(t=i(t,n),t.return=e,t)}function l(e,t,n,r){var a=n.type;return a===y?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===a||typeof a==`object`&&a&&a.$$typeof===O&&ba(a)===t.type)?(t=i(t,n.props),Da(t,n),t.return=e,t):(t=ri(n.type,n.key,n.props,null,e.mode,r),Da(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=si(n,e.mode,r),t.return=e,t):(t=i(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,a){return t===null||t.tag!==7?(t=ii(n,e.mode,r,a),t.return=e,t):(t=i(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=ai(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case _:return n=ri(t.type,t.key,t.props,null,e.mode,n),Da(n,t),n.return=e,n;case v:return t=si(t,e.mode,n),t.return=e,t;case O:return t=ba(t),f(e,t,n)}if(F(t)||M(t))return t=ii(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Ea(t),n);if(t.$$typeof===C)return f(e,Ji(e,t),n);Oa(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case _:return n.key===i?l(e,t,n,r):null;case v:return n.key===i?u(e,t,n,r):null;case O:return n=ba(n),p(e,t,n,r)}if(F(n)||M(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,Ea(n),r);if(n.$$typeof===C)return p(e,t,Ji(e,n),r);Oa(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case _:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case v:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case O:return r=ba(r),m(e,t,n,r,i)}if(F(r)||M(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,Ea(r),i);if(r.$$typeof===C)return m(e,t,n,Ji(t,r),i);Oa(t,r)}return null}function h(i,o,s,c){for(var l=null,u=null,d=o,h=o=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),o=a(_,o,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),Ei&&yi(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(o=a(d,o,h),u===null?l=d:u.sibling=d,u=d);return Ei&&yi(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),o=a(g,o,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),Ei&&yi(i,h),l}function g(i,o,c,l){if(c==null)throw Error(s(151));for(var u=null,d=null,h=o,g=o=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(i,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(i,h),o=a(y,o,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(i,h),Ei&&yi(i,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(i,v.value,l),v!==null&&(o=a(v,o,g),d===null?u=v:d.sibling=v,d=v);return Ei&&yi(i,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,i,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),o=a(v,o,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(i,e)}),Ei&&yi(i,g),u}function b(e,r,a,c){if(typeof a==`object`&&a&&a.type===y&&a.key===null&&(a=a.props.children),typeof a==`object`&&a){switch(a.$$typeof){case _:a:{for(var l=a.key;r!==null;){if(r.key===l){if(l=a.type,l===y){if(r.tag===7){n(e,r.sibling),c=i(r,a.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===O&&ba(l)===r.type){n(e,r.sibling),c=i(r,a.props),Da(c,a),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}a.type===y?(c=ii(a.props.children,e.mode,c,a.key),c.return=e,e=c):(c=ri(a.type,a.key,a.props,null,e.mode,c),Da(c,a),c.return=e,e=c)}return o(e);case v:a:{for(l=a.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===a.containerInfo&&r.stateNode.implementation===a.implementation){n(e,r.sibling),c=i(r,a.children||[]),c.return=e,e=c;break a}else{n(e,r);break}else t(e,r);r=r.sibling}c=si(a,e.mode,c),c.return=e,e=c}return o(e);case O:return a=ba(a),b(e,r,a,c)}if(F(a))return h(e,r,a,c);if(M(a)){if(l=M(a),typeof l!=`function`)throw Error(s(150));return a=l.call(a),g(e,r,a,c)}if(typeof a.then==`function`)return b(e,r,Ea(a),c);if(a.$$typeof===C)return b(e,r,Ji(e,a),c);Oa(e,a)}return typeof a==`string`&&a!==``||typeof a==`number`||typeof a==`bigint`?(a=``+a,r!==null&&r.tag===6?(n(e,r.sibling),c=i(r,a),c.return=e,e=c):(n(e,r),c=ai(a,e.mode,c),c.return=e,e=c),o(e)):n(e,r)}return function(e,t,n,r){try{Ta=0;var i=b(e,t,n,r);return wa=null,i}catch(t){if(t===ma||t===ga)throw t;var a=$r(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Aa=ka(!0),ja=ka(!1),Ma=!1;function Na(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Pa(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Fa(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ia(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Nl&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=Xr(e),Yr(e,null,n),t}return Kr(e,r,t,n),Xr(e)}function La(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,We(e,n)}}function Ra(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var za=!1;function Ba(){if(za){var e=aa;if(e!==null)throw e}}function Va(e,t,n,r){za=!1;var i=e.updateQueue;Ma=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(Il&f)===f:(r&f)===f){f!==0&&f===ia&&(za=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(m=g.payload,typeof m==`function`){d=m.call(_,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=g.payload,f=typeof m==`function`?m.call(_,d,f):m,f==null)break a;d=h({},d,f);break a;case 2:Ma=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Q|=o,e.lanes=o,e.memoizedState=d}}function Ha(e,t){if(typeof e!=`function`)throw Error(s(191,e));e.call(t)}function Ua(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Ha(n[e],t)}var Wa=V(null),Ga=V(0);function Ka(e,t){e=Hl,U(Ga,e),U(Wa,t),Hl=e|t.baseLanes}function qa(){U(Ga,Hl),U(Wa,Wa.current)}function Ja(){Hl=Ga.current,H(Wa),H(Ga)}var Ya=V(null),Xa=null;function Za(e){var t=e.alternate;U(no,no.current&1),U(Ya,e),Xa===null&&(t===null||Wa.current!==null||t.memoizedState!==null)&&(Xa=e)}function Qa(e){U(no,no.current),U(Ya,e),Xa===null&&(Xa=e)}function $a(e){e.tag===22?(U(no,no.current),U(Ya,e),Xa===null&&(Xa=e)):eo(e)}function eo(){U(no,no.current),U(Ya,Ya.current)}function to(e){H(Ya),Xa===e&&(Xa=null),H(no)}var no=V(0);function ro(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||af(n)||of(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var io=0,ao=null,oo=null,so=null,co=!1,lo=!1,uo=!1,fo=0,po=0,mo=null,ho=0;function go(){throw Error(s(321))}function _o(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!pr(e[n],t[n]))return!1;return!0}function vo(e,t,n,r,i,a){return io=a,ao=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,I.H=e===null||e.memoizedState===null?J:Fs,uo=!1,a=n(r,i),uo=!1,lo&&(a=bo(t,n,r,i)),yo(e),a}function yo(e){I.H=Ps;var t=oo!==null&&oo.next!==null;if(io=0,so=oo=ao=null,co=!1,po=0,mo=null,t)throw Error(s(300));e===null||Xs||(e=e.dependencies,e!==null&&Gi(e)&&(Xs=!0))}function bo(e,t,n,r){ao=e;var i=0;do{if(lo&&(mo=null),po=0,lo=!1,25<=i)throw Error(s(301));if(i+=1,so=oo=null,e.updateQueue!=null){var a=e.updateQueue;a.lastEffect=null,a.events=null,a.stores=null,a.memoCache!=null&&(a.memoCache.index=0)}I.H=Y,a=t(n,r)}while(lo);return a}function xo(){var e=I.H,t=e.useState()[0];return t=typeof t.then==`function`?Oo(t):t,e=e.useState()[0],(oo===null?null:oo.memoizedState)!==e&&(ao.flags|=1024),t}function So(){var e=fo!==0;return fo=0,e}function Co(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function wo(e){if(co){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}co=!1}io=0,so=oo=ao=null,lo=!1,po=fo=0,mo=null}function To(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return so===null?ao.memoizedState=so=e:so=so.next=e,so}function Eo(){if(oo===null){var e=ao.alternate;e=e===null?null:e.memoizedState}else e=oo.next;var t=so===null?ao.memoizedState:so.next;if(t!==null)so=t,oo=e;else{if(e===null)throw ao.alternate===null?Error(s(467)):Error(s(310));oo=e,e={memoizedState:oo.memoizedState,baseState:oo.baseState,baseQueue:oo.baseQueue,queue:oo.queue,next:null},so===null?ao.memoizedState=so=e:so=so.next=e}return so}function Do(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Oo(e){var t=po;return po+=1,mo===null&&(mo=[]),e=ya(mo,e,t),t=ao,(so===null?t.memoizedState:so.next)===null&&(t=t.alternate,I.H=t===null||t.memoizedState===null?J:Fs),e}function ko(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return Oo(e);if(e.$$typeof===C)return qi(e)}throw Error(s(438,String(e)))}function Ao(e){var t=null,n=ao.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=ao.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=Do(),ao.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=A;return t.index++,n}function jo(e,t){return typeof t==`function`?t(e):t}function Mo(e){return No(Eo(),oo,e)}function No(e,t,n){var r=e.queue;if(r===null)throw Error(s(311));r.lastRenderedReducer=n;var i=e.baseQueue,a=r.pending;if(a!==null){if(i!==null){var o=i.next;i.next=a.next,a.next=o}t.baseQueue=i=a,r.pending=null}if(a=e.baseState,i===null)e.memoizedState=a;else{t=i.next;var c=o=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(io&f)===f:(Il&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===ia&&(d=!0);else if((io&p)===p){u=u.next,p===ia&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,o=a):l=l.next=f,ao.lanes|=p,Q|=p;f=u.action,uo&&n(a,f),a=u.hasEagerState?u.eagerState:n(a,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,o=a):l=l.next=p,ao.lanes|=f,Q|=f;u=u.next}while(u!==null&&u!==t);if(l===null?o=a:l.next=c,!pr(a,e.memoizedState)&&(Xs=!0,d&&(n=aa,n!==null)))throw n;e.memoizedState=a,e.baseState=o,e.baseQueue=l,r.lastRenderedState=a}return i===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Po(e){var t=Eo(),n=t.queue;if(n===null)throw Error(s(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,a=t.memoizedState;if(i!==null){n.pending=null;var o=i=i.next;do a=e(a,o.action),o=o.next;while(o!==i);pr(a,t.memoizedState)||(Xs=!0),t.memoizedState=a,t.baseQueue===null&&(t.baseState=a),n.lastRenderedState=a}return[a,r]}function Fo(e,t,n){var r=ao,i=Eo(),a=Ei;if(a){if(n===void 0)throw Error(s(407));n=n()}else n=t();var o=!pr((oo||i).memoizedState,n);if(o&&(i.memoizedState=n,Xs=!0),i=i.queue,os(Ro.bind(null,r,i,e),[e]),i.getSnapshot!==t||o||so!==null&&so.memoizedState.tag&1){if(r.flags|=2048,ts(9,{destroy:void 0},Lo.bind(null,r,i,n,t),null),Pl===null)throw Error(s(349));a||io&127||Io(r,t,n)}return n}function Io(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=ao.updateQueue,t===null?(t=Do(),ao.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Lo(e,t,n,r){t.value=n,t.getSnapshot=r,zo(t)&&Bo(e)}function Ro(e,t,n){return n(function(){zo(t)&&Bo(e)})}function zo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!pr(e,n)}catch{return!0}}function Bo(e){var t=Jr(e,2);t!==null&&fu(t,e,2)}function Vo(e){var t=To();if(typeof e==`function`){var n=e;if(e=n(),uo){De(!0);try{n()}finally{De(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:jo,lastRenderedState:e},t}function Ho(e,t,n,r){return e.baseState=n,No(e,oo,typeof r==`function`?r:jo)}function Uo(e,t,n,r,i){if(js(e))throw Error(s(485));if(e=t.action,e!==null){var a={payload:i,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){a.listeners.push(e)}};I.T===null?a.isTransition=!1:n(!0),r(a),n=t.pending,n===null?(a.next=t.pending=a,Wo(t,a)):(a.next=n.next,t.pending=n.next=a)}}function Wo(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=I.T,o={};I.T=o;try{var s=n(i,r),c=I.S;c!==null&&c(o,s),Go(e,t,s)}catch(n){qo(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),I.T=a}}else try{a=n(i,r),Go(e,t,a)}catch(n){qo(e,t,n)}}function Go(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){Ko(e,t,n)},function(n){return qo(e,t,n)}):Ko(e,t,n)}function Ko(e,t,n){t.status=`fulfilled`,t.value=n,Jo(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Wo(e,n)))}function qo(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Jo(t),t=t.next;while(t!==r)}e.action=null}function Jo(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Yo(e,t){return t}function Xo(e,t){if(Ei){var n=Pl.formState;if(n!==null){a:{var r=ao;if(Ei){if(Ti){b:{for(var i=Ti,a=Oi;i.nodeType!==8;){if(!a){i=null;break b}if(i=cf(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Ti=cf(i.nextSibling),r=i.data===`F!`;break a}}Ai(r)}r=!1}r&&(t=n[0])}}return n=To(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Yo,lastRenderedState:t},n.queue=r,n=Os.bind(null,ao,r),r.dispatch=n,r=Vo(!1),a=As.bind(null,ao,!1,r.queue),r=To(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Uo.bind(null,ao,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Zo(e){return Qo(Eo(),oo,e)}function Qo(e,t,n){if(t=No(e,t,Yo)[0],e=Mo(jo)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=Oo(t)}catch(e){throw e===ma?ga:e}else r=t;t=Eo();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(ao.flags|=2048,ts(9,{destroy:void 0},$o.bind(null,i,n),null)),[r,a,e]}function $o(e,t){e.action=t}function es(e){var t=Eo(),n=oo;if(n!==null)return Qo(t,n,e);Eo(),t=t.memoizedState,n=Eo();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function ts(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=ao.updateQueue,t===null&&(t=Do(),ao.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function ns(){return Eo().memoizedState}function rs(e,t,n,r){var i=To();ao.flags|=e,i.memoizedState=ts(1|t,{destroy:void 0},n,r===void 0?null:r)}function is(e,t,n,r){var i=Eo();r=r===void 0?null:r;var a=i.memoizedState.inst;oo!==null&&r!==null&&_o(r,oo.memoizedState.deps)?i.memoizedState=ts(t,a,n,r):(ao.flags|=e,i.memoizedState=ts(1|t,a,n,r))}function as(e,t){rs(8390656,8,e,t)}function os(e,t){is(2048,8,e,t)}function ss(e){ao.flags|=4;var t=ao.updateQueue;if(t===null)t=Do(),ao.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function cs(e){var t=Eo().memoizedState;return ss({ref:t,nextImpl:e}),function(){if(Nl&2)throw Error(s(440));return t.impl.apply(void 0,arguments)}}function ls(e,t){return is(4,2,e,t)}function us(e,t){return is(4,4,e,t)}function ds(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function fs(e,t,n){n=n==null?null:n.concat([e]),is(4,4,ds.bind(null,t,e),n)}function ps(){}function ms(e,t){var n=Eo();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&_o(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function hs(e,t){var n=Eo();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&_o(t,r[1]))return r[0];if(r=e(),uo){De(!0);try{e()}finally{De(!1)}}return n.memoizedState=[r,t],r}function gs(e,t,n){return n===void 0||io&1073741824&&!(Il&261930)?e.memoizedState=t:(e.memoizedState=n,e=du(),ao.lanes|=e,Q|=e,n)}function _s(e,t,n,r){return pr(n,t)?n:Wa.current===null?!(io&42)||io&1073741824&&!(Il&261930)?(Xs=!0,e.memoizedState=n):(e=du(),ao.lanes|=e,Q|=e,t):(e=gs(e,n,r),pr(e,t)||(Xs=!0),e)}function vs(e,t,n,r,i){var a=L.p;L.p=a!==0&&8>a?a:8;var o=I.T,s={};I.T=s,As(e,!1,t,n);try{var c=i(),l=I.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?ks(e,t,ca(c,r),uu(e)):ks(e,t,r,uu(e))}catch(n){ks(e,t,{then:function(){},status:`rejected`,reason:n},uu())}finally{L.p=a,o!==null&&s.types!==null&&(o.types=s.types),I.T=o}}function ys(){}function bs(e,t,n,r){if(e.tag!==5)throw Error(s(476));var i=xs(e).queue;vs(e,i,t,R,n===null?ys:function(){return Ss(e),n(r)})}function xs(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:R,baseState:R,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:jo,lastRenderedState:R},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:jo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Ss(e){var t=xs(e);t.next===null&&(t=e.alternate.memoizedState),ks(e,t.next.queue,{},uu())}function Cs(){return qi(Qf)}function ws(){return Eo().memoizedState}function Ts(){return Eo().memoizedState}function Es(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=uu();e=Fa(n);var r=Ia(t,e,n);r!==null&&(fu(r,t,n),La(r,t,n)),t={cache:ea()},e.payload=t;return}t=t.return}}function Ds(e,t,n){var r=uu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},js(e)?Ms(t,n):(n=qr(e,t,n,r),n!==null&&(fu(n,e,r),Ns(n,t,r)))}function Os(e,t,n){ks(e,t,n,uu())}function ks(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(js(e))Ms(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,pr(s,o))return Kr(e,t,i,0),Pl===null&&Gr(),!1}catch{}if(n=qr(e,t,i,r),n!==null)return fu(n,e,r),Ns(n,t,r),!0}return!1}function As(e,t,n,r){if(r={lane:2,revertLane:ld(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},js(e)){if(t)throw Error(s(479))}else t=qr(e,n,r,2),t!==null&&fu(t,e,2)}function js(e){var t=e.alternate;return e===ao||t!==null&&t===ao}function Ms(e,t){lo=co=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ns(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,We(e,n)}}var Ps={readContext:qi,use:ko,useCallback:go,useContext:go,useEffect:go,useImperativeHandle:go,useLayoutEffect:go,useInsertionEffect:go,useMemo:go,useReducer:go,useRef:go,useState:go,useDebugValue:go,useDeferredValue:go,useTransition:go,useSyncExternalStore:go,useId:go,useHostTransitionStatus:go,useFormState:go,useActionState:go,useOptimistic:go,useMemoCache:go,useCacheRefresh:go};Ps.useEffectEvent=go;var J={readContext:qi,use:ko,useCallback:function(e,t){return To().memoizedState=[e,t===void 0?null:t],e},useContext:qi,useEffect:as,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),rs(4194308,4,ds.bind(null,t,e),n)},useLayoutEffect:function(e,t){return rs(4194308,4,e,t)},useInsertionEffect:function(e,t){rs(4,2,e,t)},useMemo:function(e,t){var n=To();t=t===void 0?null:t;var r=e();if(uo){De(!0);try{e()}finally{De(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=To();if(n!==void 0){var i=n(t);if(uo){De(!0);try{n(t)}finally{De(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Ds.bind(null,ao,e),[r.memoizedState,e]},useRef:function(e){var t=To();return e={current:e},t.memoizedState=e},useState:function(e){e=Vo(e);var t=e.queue,n=Os.bind(null,ao,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:ps,useDeferredValue:function(e,t){return gs(To(),e,t)},useTransition:function(){var e=Vo(!1);return e=vs.bind(null,ao,e.queue,!0,!1),To().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=ao,i=To();if(Ei){if(n===void 0)throw Error(s(407));n=n()}else{if(n=t(),Pl===null)throw Error(s(349));Il&127||Io(r,t,n)}i.memoizedState=n;var a={value:n,getSnapshot:t};return i.queue=a,as(Ro.bind(null,r,a,e),[e]),r.flags|=2048,ts(9,{destroy:void 0},Lo.bind(null,r,a,n,t),null),n},useId:function(){var e=To(),t=Pl.identifierPrefix;if(Ei){var n=vi,r=_i;n=(r&~(1<<32-Oe(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=fo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=ho++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Cs,useFormState:Xo,useActionState:Xo,useOptimistic:function(e){var t=To();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=As.bind(null,ao,!0,n),n.dispatch=t,[e,t]},useMemoCache:Ao,useCacheRefresh:function(){return To().memoizedState=Es.bind(null,ao)},useEffectEvent:function(e){var t=To(),n={impl:e};return t.memoizedState=n,function(){if(Nl&2)throw Error(s(440));return n.impl.apply(void 0,arguments)}}},Fs={readContext:qi,use:ko,useCallback:ms,useContext:qi,useEffect:os,useImperativeHandle:fs,useInsertionEffect:ls,useLayoutEffect:us,useMemo:hs,useReducer:Mo,useRef:ns,useState:function(){return Mo(jo)},useDebugValue:ps,useDeferredValue:function(e,t){return _s(Eo(),oo.memoizedState,e,t)},useTransition:function(){var e=Mo(jo)[0],t=Eo().memoizedState;return[typeof e==`boolean`?e:Oo(e),t]},useSyncExternalStore:Fo,useId:ws,useHostTransitionStatus:Cs,useFormState:Zo,useActionState:Zo,useOptimistic:function(e,t){return Ho(Eo(),oo,e,t)},useMemoCache:Ao,useCacheRefresh:Ts};Fs.useEffectEvent=cs;var Y={readContext:qi,use:ko,useCallback:ms,useContext:qi,useEffect:os,useImperativeHandle:fs,useInsertionEffect:ls,useLayoutEffect:us,useMemo:hs,useReducer:Po,useRef:ns,useState:function(){return Po(jo)},useDebugValue:ps,useDeferredValue:function(e,t){var n=Eo();return oo===null?gs(n,e,t):_s(n,oo.memoizedState,e,t)},useTransition:function(){var e=Po(jo)[0],t=Eo().memoizedState;return[typeof e==`boolean`?e:Oo(e),t]},useSyncExternalStore:Fo,useId:ws,useHostTransitionStatus:Cs,useFormState:es,useActionState:es,useOptimistic:function(e,t){var n=Eo();return oo===null?(n.baseState=e,[e,n.queue.dispatch]):Ho(n,oo,e,t)},useMemoCache:Ao,useCacheRefresh:Ts};Y.useEffectEvent=cs;function Is(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:h({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Ls={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=uu(),i=Fa(r);i.payload=t,n!=null&&(i.callback=n),t=Ia(e,i,r),t!==null&&(fu(t,e,r),La(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=uu(),i=Fa(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Ia(e,i,r),t!==null&&(fu(t,e,r),La(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=uu(),r=Fa(n);r.tag=2,t!=null&&(r.callback=t),t=Ia(e,r,n),t!==null&&(fu(t,e,n),La(t,e,n))}};function Rs(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!mr(n,r)||!mr(i,a):!0}function zs(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Ls.enqueueReplaceState(t,t.state,null)}function Bs(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=h({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Vs(e){Vr(e)}function Hs(e){console.error(e)}function X(e){Vr(e)}function Us(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Ws(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function Gs(e,t,n){return n=Fa(n),n.tag=3,n.payload={element:null},n.callback=function(){Us(e,t)},n}function Ks(e){return e=Fa(e),e.tag=3,e}function qs(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){Ws(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Ws(t,n,r),typeof i!=`function`&&(eu===null?eu=new Set([this]):eu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Js(e,t,n,r,i){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Wi(t,n,i,!0),n=Ya.current,n!==null){switch(n.tag){case 31:case 13:return Xa===null?wu():n.alternate===null&&Ul===0&&(Ul=3),n.flags&=-257,n.flags|=65536,n.lanes=i,r===_a?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),Uu(e,r,i)),!1;case 22:return n.flags|=65536,r===_a?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),Uu(e,r,i)),!1}throw Error(s(435,n.tag))}return Uu(e,r,i),wu(),!1}if(Ei)return t=Ya.current,t===null?(r!==ki&&(t=Error(s(423),{cause:r}),Ii(li(t,n))),e=e.current.alternate,e.flags|=65536,i&=-i,e.lanes|=i,r=li(r,n),i=Gs(e.stateNode,r,i),Ra(e,i),Ul!==4&&(Ul=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=i,r!==ki&&(e=Error(s(422),{cause:r}),Ii(li(e,n)))),!1;var a=Error(s(520),{cause:r});if(a=li(a,n),ql===null?ql=[a]:ql.push(a),Ul!==4&&(Ul=2),t===null)return!0;r=li(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=i&-i,n.lanes|=e,e=Gs(n.stateNode,r,e),Ra(n,e),!1;case 1:if(t=n.type,a=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||a!==null&&typeof a.componentDidCatch==`function`&&(eu===null||!eu.has(a))))return n.flags|=65536,i&=-i,n.lanes|=i,i=Ks(i),qs(i,e,n,r),Ra(n,i),!1}n=n.return}while(n!==null);return!1}var Ys=Error(s(461)),Xs=!1;function Zs(e,t,n,r){t.child=e===null?ja(t,null,n,r):Aa(t,e.child,n,r)}function Qs(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return Ki(t),r=vo(e,t,n,o,a,i),s=So(),e!==null&&!Xs?(Co(e,t,i),Sc(e,t,i)):(Ei&&s&&xi(t),t.flags|=1,Zs(e,t,r,i),t.child)}function $s(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!ei(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,ec(e,t,a,r,i)):(e=ri(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!Cc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?mr:n,n(o,r)&&e.ref===t.ref)return Sc(e,t,i)}return t.flags|=1,e=ti(a,r),e.ref=t.ref,e.return=t,t.child=e}function ec(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(mr(a,r)&&e.ref===t.ref)if(Xs=!1,t.pendingProps=r=a,Cc(e,i))e.flags&131072&&(Xs=!0);else return t.lanes=e.lanes,Sc(e,t,i)}return cc(e,t,n,r,i)}function tc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return rc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&fa(t,a===null?null:a.cachePool),a===null?qa():Ka(t,a),$a(t);else return r=t.lanes=536870912,rc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&fa(t,null),qa(),eo(t)):(fa(t,a.cachePool),Ka(t,a),eo(t),t.memoizedState=null);return Zs(e,t,i,n),t.child}function nc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function rc(e,t,n,r,i){var a=da();return a=a===null?null:{parent:$i._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&fa(t,null),qa(),$a(t),e!==null&&Wi(e,t,r,!0),t.childLanes=i,null}function ic(e,t){return t=_c({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function ac(e,t,n){return Aa(t,e.child,null,n),e=ic(t,t.pendingProps),e.flags|=2,to(t),t.memoizedState=null,e}function oc(e,t,n){var r=t.pendingProps,i=(t.flags&128)!=0;if(t.flags&=-129,e===null){if(Ei){if(r.mode===`hidden`)return e=ic(t,r),t.lanes=536870912,nc(null,e);if(Qa(t),(e=Ti)?(e=rf(e,Oi),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:gi===null?null:{id:_i,overflow:vi},retryLane:536870912,hydrationErrors:null},n=oi(e),n.return=t,t.child=n,wi=t,Ti=null)):e=null,e===null)throw Ai(t);return t.lanes=536870912,null}return ic(t,r)}var a=e.memoizedState;if(a!==null){var o=a.dehydrated;if(Qa(t),i)if(t.flags&256)t.flags&=-257,t=ac(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(s(558));else if(Xs||Wi(e,t,n,!1),i=(n&e.childLanes)!==0,Xs||i){if(r=Pl,r!==null&&(o=Ge(r,n),o!==0&&o!==a.retryLane))throw a.retryLane=o,Jr(e,o),fu(r,e,o),Ys;wu(),t=ac(e,t,n)}else e=a.treeContext,Ti=cf(o.nextSibling),wi=t,Ei=!0,Di=null,Oi=!1,e!==null&&Ci(t,e),t=ic(t,r),t.flags|=4096;return t}return e=ti(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function sc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(s(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function cc(e,t,n,r,i){return Ki(t),n=vo(e,t,n,r,void 0,i),r=So(),e!==null&&!Xs?(Co(e,t,i),Sc(e,t,i)):(Ei&&r&&xi(t),t.flags|=1,Zs(e,t,n,i),t.child)}function lc(e,t,n,r,i,a){return Ki(t),t.updateQueue=null,n=bo(t,r,n,i),yo(e),r=So(),e!==null&&!Xs?(Co(e,t,a),Sc(e,t,a)):(Ei&&r&&xi(t),t.flags|=1,Zs(e,t,n,a),t.child)}function uc(e,t,n,r,i){if(Ki(t),t.stateNode===null){var a=Zr,o=n.contextType;typeof o==`object`&&o&&(a=qi(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Ls,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},Na(t),o=n.contextType,a.context=typeof o==`object`&&o?qi(o):Zr,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Is(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&Ls.enqueueReplaceState(a,a.state,null),Va(t,r,a,i),Ba(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=Bs(n,s);a.props=c;var l=a.context,u=n.contextType;o=Zr,typeof u==`object`&&u&&(o=qi(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&zs(t,a,r,o),Ma=!1;var f=t.memoizedState;a.state=f,Va(t,r,a,i),Ba(),l=t.memoizedState,s||f!==l||Ma?(typeof d==`function`&&(Is(t,n,d,r),l=t.memoizedState),(c=Ma||Rs(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,Pa(e,t),o=t.memoizedProps,u=Bs(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=Zr,typeof l==`object`&&l&&(c=qi(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&zs(t,a,r,c),Ma=!1,f=t.memoizedState,a.state=f,Va(t,r,a,i),Ba();var p=t.memoizedState;o!==d||f!==p||Ma||e!==null&&e.dependencies!==null&&Gi(e.dependencies)?(typeof s==`function`&&(Is(t,n,s,r),p=t.memoizedState),(u=Ma||Rs(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Gi(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,sc(e,t),r=(t.flags&128)!=0,a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=Aa(t,e.child,null,i),t.child=Aa(t,null,n,i)):Zs(e,t,n,i),t.memoizedState=a.state,e=t.child):e=Sc(e,t,i),e}function dc(e,t,n,r){return Pi(),t.flags|=256,Zs(e,t,n,r),t.child}var fc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function pc(e){return{baseLanes:e,cachePool:pa()}}function mc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=Gl),e}function hc(e,t,n){var r=t.pendingProps,i=!1,a=(t.flags&128)!=0,o;if((o=a)||(o=e!==null&&e.memoizedState===null?!1:(no.current&2)!=0),o&&(i=!0,t.flags&=-129),o=(t.flags&32)!=0,t.flags&=-33,e===null){if(Ei){if(i?Za(t):eo(t),(e=Ti)?(e=rf(e,Oi),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:gi===null?null:{id:_i,overflow:vi},retryLane:536870912,hydrationErrors:null},n=oi(e),n.return=t,t.child=n,wi=t,Ti=null)):e=null,e===null)throw Ai(t);return of(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,i?(eo(t),i=t.mode,c=_c({mode:`hidden`,children:c},i),r=ii(r,i,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=pc(n),r.childLanes=mc(e,o,n),t.memoizedState=fc,nc(null,r)):(Za(t),gc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(a)t.flags&256?(Za(t),t.flags&=-257,t=vc(e,t,n)):t.memoizedState===null?(eo(t),c=r.fallback,i=t.mode,r=_c({mode:`visible`,children:r.children},i),c=ii(c,i,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,Aa(t,e.child,null,n),r=t.child,r.memoizedState=pc(n),r.childLanes=mc(e,o,n),t.memoizedState=fc,t=nc(null,r)):(eo(t),t.child=e.child,t.flags|=128,t=null);else if(Za(t),of(c)){if(o=c.nextSibling&&c.nextSibling.dataset,o)var u=o.dgst;o=u,r=Error(s(419)),r.stack=``,r.digest=o,Ii({value:r,source:null,stack:null}),t=vc(e,t,n)}else if(Xs||Wi(e,t,n,!1),o=(n&e.childLanes)!==0,Xs||o){if(o=Pl,o!==null&&(r=Ge(o,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,Jr(e,r),fu(o,e,r),Ys;af(c)||wu(),t=vc(e,t,n)}else af(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Ti=cf(c.nextSibling),wi=t,Ei=!0,Di=null,Oi=!1,e!==null&&Ci(t,e),t=gc(t,r.children),t.flags|=4096);return t}return i?(eo(t),c=r.fallback,i=t.mode,l=e.child,u=l.sibling,r=ti(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=ii(c,i,n,null),c.flags|=2):c=ti(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,nc(null,r),r=t.child,c=e.child.memoizedState,c===null?c=pc(n):(i=c.cachePool,i===null?i=pa():(l=$i._currentValue,i=i.parent===l?i:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:i}),r.memoizedState=c,r.childLanes=mc(e,o,n),t.memoizedState=fc,nc(e.child,r)):(Za(t),n=e.child,e=n.sibling,n=ti(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(o=t.deletions,o===null?(t.deletions=[e],t.flags|=16):o.push(e)),t.child=n,t.memoizedState=null,n)}function gc(e,t){return t=_c({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function _c(e,t){return e=$r(22,e,null,t),e.lanes=0,e}function vc(e,t,n){return Aa(t,e.child,null,n),e=gc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function yc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Hi(e.return,t,n)}function bc(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function xc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=no.current,s=(o&2)!=0;if(s?(o=o&1|2,t.flags|=128):o&=1,U(no,o),Zs(e,t,r,n),r=Ei?pi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&yc(e,n,t);else if(e.tag===19)yc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&ro(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),bc(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&ro(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}bc(t,!0,n,null,a,r);break;case`together`:bc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Sc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Q|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Wi(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(s(153));if(t.child!==null){for(e=t.child,n=ti(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ti(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Cc(e,t){return(e.lanes&t)===0?(e=e.dependencies,!!(e!==null&&Gi(e))):!0}function wc(e,t,n){switch(t.tag){case 3:ne(t,t.stateNode.containerInfo),Bi(t,$i,e.memoizedState.cache),Pi();break;case 27:case 5:K(t);break;case 4:ne(t,t.stateNode.containerInfo);break;case 10:Bi(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Qa(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(Za(t),e=Sc(e,t,n),e===null?null:e.sibling):hc(e,t,n):(Za(t),t.flags|=128,null);Za(t);break;case 19:var i=(e.flags&128)!=0;if(r=(n&t.childLanes)!==0,r||=(Wi(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return xc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),U(no,no.current),r)break;return null;case 22:return t.lanes=0,tc(e,t,n,t.pendingProps);case 24:Bi(t,$i,e.memoizedState.cache)}return Sc(e,t,n)}function Tc(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Xs=!0;else{if(!Cc(e,n)&&!(t.flags&128))return Xs=!1,wc(e,t,n);Xs=!!(e.flags&131072)}else Xs=!1,Ei&&t.flags&1048576&&bi(t,pi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=ba(t.elementType),t.type=e,typeof e==`function`)ei(e)?(r=Bs(e,r),t.tag=1,t=uc(null,t,e,r,n)):(t.tag=0,t=cc(null,t,e,r,n));else{if(e!=null){var i=e.$$typeof;if(i===w){t.tag=11,t=Qs(null,t,e,r,n);break a}else if(i===D){t.tag=14,t=$s(null,t,e,r,n);break a}}throw t=P(e)||e,Error(s(306,t,``))}}return t;case 0:return cc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,i=Bs(r,t.pendingProps),uc(e,t,r,i,n);case 3:a:{if(ne(t,t.stateNode.containerInfo),e===null)throw Error(s(387));r=t.pendingProps;var a=t.memoizedState;i=a.element,Pa(e,t),Va(t,r,null,n);var o=t.memoizedState;if(r=o.cache,Bi(t,$i,r),r!==a.cache&&Ui(t,[$i],n,!0),Ba(),r=o.element,a.isDehydrated)if(a={element:r,isDehydrated:!1,cache:o.cache},t.updateQueue.baseState=a,t.memoizedState=a,t.flags&256){t=dc(e,t,r,n);break a}else if(r!==i){i=li(Error(s(424)),t),Ii(i),t=dc(e,t,r,n);break a}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(Ti=cf(e.firstChild),wi=t,Ei=!0,Di=null,Oi=!0,n=ja(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Pi(),r===i){t=Sc(e,t,n);break a}Zs(e,t,r,n)}t=t.child}return t;case 26:return sc(e,t),e===null?(n=kf(t.type,null,t.pendingProps,null))?t.memoizedState=n:Ei||(n=t.type,e=t.pendingProps,r=Bd(ee.current).createElement(n),r[Ze]=t,r[Qe]=e,Pd(r,n,e),ut(r),t.stateNode=r):t.memoizedState=kf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return K(t),e===null&&Ei&&(r=t.stateNode=ff(t.type,t.pendingProps,ee.current),wi=t,Oi=!0,i=Ti,Zd(t.type)?(lf=i,Ti=cf(r.firstChild)):Ti=i),Zs(e,t,t.pendingProps.children,n),sc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ei&&((i=r=Ti)&&(r=tf(r,t.type,t.pendingProps,Oi),r===null?i=!1:(t.stateNode=r,wi=t,Ti=cf(r.firstChild),Oi=!1,i=!0)),i||Ai(t)),K(t),i=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,r=a.children,Ud(i,a)?r=null:o!==null&&Ud(i,o)&&(t.flags|=32),t.memoizedState!==null&&(i=vo(e,t,xo,null,null,n),Qf._currentValue=i),sc(e,t),Zs(e,t,r,n),t.child;case 6:return e===null&&Ei&&((e=n=Ti)&&(n=nf(n,t.pendingProps,Oi),n===null?e=!1:(t.stateNode=n,wi=t,Ti=null,e=!0)),e||Ai(t)),null;case 13:return hc(e,t,n);case 4:return ne(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Aa(t,null,r,n):Zs(e,t,r,n),t.child;case 11:return Qs(e,t,t.type,t.pendingProps,n);case 7:return Zs(e,t,t.pendingProps,n),t.child;case 8:return Zs(e,t,t.pendingProps.children,n),t.child;case 12:return Zs(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Bi(t,t.type,r.value),Zs(e,t,r.children,n),t.child;case 9:return i=t.type._context,r=t.pendingProps.children,Ki(t),i=qi(i),r=r(i),t.flags|=1,Zs(e,t,r,n),t.child;case 14:return $s(e,t,t.type,t.pendingProps,n);case 15:return ec(e,t,t.type,t.pendingProps,n);case 19:return xc(e,t,n);case 31:return oc(e,t,n);case 22:return tc(e,t,n,t.pendingProps);case 24:return Ki(t),r=qi($i),e===null?(i=da(),i===null&&(i=Pl,a=ea(),i.pooledCache=a,a.refCount++,a!==null&&(i.pooledCacheLanes|=n),i=a),t.memoizedState={parent:r,cache:i},Na(t),Bi(t,$i,i)):((e.lanes&n)!==0&&(Pa(e,t),Va(t,null,null,n),Ba()),i=e.memoizedState,a=t.memoizedState,i.parent===r?(r=a.cache,Bi(t,$i,r),r!==i.cache&&Ui(t,[$i],n,!0)):(i={parent:r,cache:r},t.memoizedState=i,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=i),Bi(t,$i,r))),Zs(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(s(156,t.tag))}function Ec(e){e.flags|=4}function Dc(e,t,n,r,i){if((t=(e.mode&32)!=0)&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i)if(e.stateNode.complete)e.flags|=8192;else if(xu())e.flags|=8192;else throw xa=_a,ha}else e.flags&=-16777217}function Oc(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Wf(t))if(xu())e.flags|=8192;else throw xa=_a,ha}function kc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:ze(),e.lanes|=t,Kl|=t)}function Ac(e,t){if(!Ei)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function jc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Mc(e,t,n){var r=t.pendingProps;switch(Si(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return jc(t),null;case 1:return jc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Vi($i),re(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Ni(t)?Ec(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Fi())),jc(t),null;case 26:var i=t.type,a=t.memoizedState;return e===null?(Ec(t),a===null?(jc(t),Dc(t,i,null,r,n)):(jc(t),Oc(t,a))):a?a===e.memoizedState?(jc(t),t.flags&=-16777217):(Ec(t),jc(t),Oc(t,a)):(e=e.memoizedProps,e!==r&&Ec(t),jc(t),Dc(t,i,e,r,n)),null;case 27:if(ie(t),n=ee.current,i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Ec(t);else{if(!r){if(t.stateNode===null)throw Error(s(166));return jc(t),null}e=W.current,Ni(t)?ji(t,e):(e=ff(i,r,n),t.stateNode=e,Ec(t))}return jc(t),null;case 5:if(ie(t),i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Ec(t);else{if(!r){if(t.stateNode===null)throw Error(s(166));return jc(t),null}if(a=W.current,Ni(t))ji(t,a);else{var o=Bd(ee.current);switch(a){case 1:a=o.createElementNS(`http://www.w3.org/2000/svg`,i);break;case 2:a=o.createElementNS(`http://www.w3.org/1998/Math/MathML`,i);break;default:switch(i){case`svg`:a=o.createElementNS(`http://www.w3.org/2000/svg`,i);break;case`math`:a=o.createElementNS(`http://www.w3.org/1998/Math/MathML`,i);break;case`script`:a=o.createElement(`div`),a.innerHTML=`<script><\/script>`,a=a.removeChild(a.firstChild);break;case`select`:a=typeof r.is==`string`?o.createElement(`select`,{is:r.is}):o.createElement(`select`),r.multiple?a.multiple=!0:r.size&&(a.size=r.size);break;default:a=typeof r.is==`string`?o.createElement(i,{is:r.is}):o.createElement(i)}}a[Ze]=t,a[Qe]=r;a:for(o=t.child;o!==null;){if(o.tag===5||o.tag===6)a.appendChild(o.stateNode);else if(o.tag!==4&&o.tag!==27&&o.child!==null){o.child.return=o,o=o.child;continue}if(o===t)break a;for(;o.sibling===null;){if(o.return===null||o.return===t)break a;o=o.return}o.sibling.return=o.return,o=o.sibling}t.stateNode=a;a:switch(Pd(a,i,r),i){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Ec(t)}}return jc(t),Dc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Ec(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(s(166));if(e=ee.current,Ni(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,i=wi,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}e[Ze]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||jd(e.nodeValue,n)),e||Ai(t,!0)}else e=Bd(e).createTextNode(r),e[Ze]=t,t.stateNode=e}return jc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Ni(t),n!==null){if(e===null){if(!r)throw Error(s(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(s(557));e[Ze]=t}else Pi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;jc(t),e=!1}else n=Fi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(to(t),t):(to(t),null);if(t.flags&128)throw Error(s(558))}return jc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=Ni(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(s(318));if(i=t.memoizedState,i=i===null?null:i.dehydrated,!i)throw Error(s(317));i[Ze]=t}else Pi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;jc(t),i=!1}else i=Fi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(to(t),t):(to(t),null)}return to(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,i=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(i=r.alternate.memoizedState.cachePool.pool),a=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(a=r.memoizedState.cachePool.pool),a!==i&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),kc(t,t.updateQueue),jc(t),null);case 4:return re(),e===null&&xd(t.stateNode.containerInfo),jc(t),null;case 10:return Vi(t.type),jc(t),null;case 19:if(H(no),r=t.memoizedState,r===null)return jc(t),null;if(i=(t.flags&128)!=0,a=r.rendering,a===null)if(i)Ac(r,!1);else{if(Ul!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=ro(e),a!==null){for(t.flags|=128,Ac(r,!1),e=a.updateQueue,t.updateQueue=e,kc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ni(n,e),n=n.sibling;return U(no,no.current&1|2),Ei&&yi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&ge()>Ql&&(t.flags|=128,i=!0,Ac(r,!1),t.lanes=4194304)}else{if(!i)if(e=ro(a),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,kc(t,e),Ac(r,!0),r.tail===null&&r.tailMode===`hidden`&&!a.alternate&&!Ei)return jc(t),null}else 2*ge()-r.renderingStartTime>Ql&&n!==536870912&&(t.flags|=128,i=!0,Ac(r,!1),t.lanes=4194304);r.isBackwards?(a.sibling=t.child,t.child=a):(e=r.last,e===null?t.child=a:e.sibling=a,r.last=a)}return r.tail===null?(jc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=ge(),e.sibling=null,n=no.current,U(no,i?n&1|2:n&1),Ei&&yi(t,r.treeForkCount),e);case 22:case 23:return to(t),Ja(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(jc(t),t.subtreeFlags&6&&(t.flags|=8192)):jc(t),n=t.updateQueue,n!==null&&kc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&H(ua),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Vi($i),jc(t),null;case 25:return null;case 30:return null}throw Error(s(156,t.tag))}function Nc(e,t){switch(Si(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Vi($i),re(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ie(t),null;case 31:if(t.memoizedState!==null){if(to(t),t.alternate===null)throw Error(s(340));Pi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(to(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(s(340));Pi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return H(no),null;case 4:return re(),null;case 10:return Vi(t.type),null;case 22:case 23:return to(t),Ja(),e!==null&&H(ua),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Vi($i),null;case 25:return null;default:return null}}function Pc(e,t){switch(Si(t),t.tag){case 3:Vi($i),re();break;case 26:case 27:case 5:ie(t);break;case 4:re();break;case 31:t.memoizedState!==null&&to(t);break;case 13:to(t);break;case 19:H(no);break;case 10:Vi(t.type);break;case 22:case 23:to(t),Ja(),e!==null&&H(ua);break;case 24:Vi($i)}}function Fc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Hu(t,t.return,e)}}function Ic(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Hu(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Hu(t,t.return,e)}}function Lc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Ua(t,n)}catch(t){Hu(e,e.return,t)}}}function Rc(e,t,n){n.props=Bs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Hu(e,t,n)}}function zc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Hu(e,t,n)}}function Bc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){Hu(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Hu(e,t,n)}else n.current=null}function Vc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Hu(e,e.return,t)}}function Hc(e,t,n){try{var r=e.stateNode;Fd(r,e.type,n,t),r[Qe]=t}catch(t){Hu(e,e.return,t)}}function Uc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Zd(e.type)||e.tag===4}function Wc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Uc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Zd(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Gc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Wt));else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Gc(e,t,n),e=e.sibling;e!==null;)Gc(e,t,n),e=e.sibling}function Kc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Kc(e,t,n),e=e.sibling;e!==null;)Kc(e,t,n),e=e.sibling}function qc(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Pd(t,r,n),t[Ze]=e,t[Qe]=n}catch(t){Hu(e,e.return,t)}}var Jc=!1,Yc=!1,Xc=!1,Zc=typeof WeakSet==`function`?WeakSet:Set,Qc=null;function $c(e,t){if(e=e.containerInfo,Rd=sp,e=vr(e),yr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,a=r.focusNode;r=r.focusOffset;try{n.nodeType,a.nodeType}catch{n=null;break a}var o=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||i!==0&&f.nodeType!==3||(c=o+i),f!==a||r!==0&&f.nodeType!==3||(l=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===i&&(c=o),p===a&&++d===r&&(l=o),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(zd={focusedElem:e,selectionRange:n},sp=!1,Qc=t;Qc!==null;)if(t=Qc,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,Qc=e;else for(;Qc!==null;){switch(t=Qc,a=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)i=e[n],i.ref.impl=i.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&a!==null){e=void 0,n=t,i=a.memoizedProps,a=a.memoizedState,r=n.stateNode;try{var h=Bs(n.type,i);e=r.getSnapshotBeforeUpdate(h,a),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){Hu(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)ef(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:ef(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(s(163))}if(e=t.sibling,e!==null){e.return=t.return,Qc=e;break}Qc=t.return}}function el(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:hl(e,n),r&4&&Fc(5,n);break;case 1:if(hl(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Hu(n,n.return,e)}else{var i=Bs(n.type,t.memoizedProps);t=t.memoizedState;
vendor: 4,312 bytes, line 8
8try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Hu(n,n.return,e)}}r&64&&Lc(n),r&512&&zc(n,n.return);break;case 3:if(hl(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Ua(e,t)}catch(e){Hu(n,n.return,e)}}break;case 27:t===null&&r&4&&qc(n);case 26:case 5:hl(e,n),t===null&&r&4&&Vc(n),r&512&&zc(n,n.return);break;case 12:hl(e,n);break;case 31:hl(e,n),r&4&&ol(e,n);break;case 13:hl(e,n),r&4&&sl(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Ku.bind(null,n),sf(e,n))));break;case 22:if(r=n.memoizedState!==null||Jc,!r){t=t!==null&&t.memoizedState!==null||Yc,i=Jc;var a=Yc;Jc=r,(Yc=t)&&!a?gl(e,n,(n.subtreeFlags&8772)!=0):hl(e,n),Jc=i,Yc=a}break;case 30:break;default:hl(e,n)}}function tl(e){var t=e.alternate;t!==null&&(e.alternate=null,tl(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&at(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var nl=null,rl=!1;function il(e,t,n){for(n=n.child;n!==null;)al(e,t,n),n=n.sibling}function al(e,t,n){if(Ee&&typeof Ee.onCommitFiberUnmount==`function`)try{Ee.onCommitFiberUnmount(Te,n)}catch{}switch(n.tag){case 26:Yc||Bc(n,t),il(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Yc||Bc(n,t);var r=nl,i=rl;Zd(n.type)&&(nl=n.stateNode,rl=!1),il(e,t,n),pf(n.stateNode),nl=r,rl=i;break;case 5:Yc||Bc(n,t);case 6:if(r=nl,i=rl,nl=null,il(e,t,n),nl=r,rl=i,nl!==null)if(rl)try{(nl.nodeType===9?nl.body:nl.nodeName===`HTML`?nl.ownerDocument.body:nl).removeChild(n.stateNode)}catch(e){Hu(n,t,e)}else try{nl.removeChild(n.stateNode)}catch(e){Hu(n,t,e)}break;case 18:nl!==null&&(rl?(e=nl,Qd(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Np(e)):Qd(nl,n.stateNode));break;case 4:r=nl,i=rl,nl=n.stateNode.containerInfo,rl=!0,il(e,t,n),nl=r,rl=i;break;case 0:case 11:case 14:case 15:Ic(2,n,t),Yc||Ic(4,n,t),il(e,t,n);break;case 1:Yc||(Bc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Rc(n,t,r)),il(e,t,n);break;case 21:il(e,t,n);break;case 22:Yc=(r=Yc)||n.memoizedState!==null,il(e,t,n),Yc=r;break;default:il(e,t,n)}}function ol(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Np(e)}catch(e){Hu(t,t.return,e)}}}function sl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Np(e)}catch(e){Hu(t,t.return,e)}}function cl(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Zc),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Zc),t;default:throw Error(s(435,e.tag))}}function ll(e,t){var n=cl(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=qu.bind(null,e,t);t.then(r,r)}})}function ul(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r],a=e,o=t,c=o;a:for(;c!==null;){switch(c.tag){case 27:if(Zd(c.type)){nl=c.stateNode,rl=!1;break a}break;case 5:nl=c.stateNode,rl=!1;break a;case 3:case 4:nl=c.stateNode.containerInfo,rl=!0;break a}c=c.return}if(nl===null)throw Error(s(160));al(a,o,i),nl=null,rl=!1,a=i.alternate,a!==null&&(a.return=null),i.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)fl(t,e),t=t.sibling}var dl=null;function fl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:ul(t,e),pl(e),r&4&&(Ic(3,e,e.return),Fc(3,e),Ic(5,e,e.return));break;case 1:ul(t,e),pl(e),r&512&&(Yc||n===null||Bc(n,n.return)),r&64&&Jc&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var i=dl;if(ul(t,e),pl(e),r&512&&(Yc||n===null||Bc(n,n.return)),r&4){var a=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null)if(r===null)if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,i=i.ownerDocument||i;b:switch(r){case`title`:a=i.getElementsByTagName(`title`)[0],(!a||a[it]||a[Ze]||a.namespaceURI===`http://www.w3.org/2000/svg`||a.hasAttribute(`itemprop`))&&(a=i.createElement(r),i.head.insertBefore(a,i.querySelector(`head >
8 title`))),Pd(a,r,n),a[Ze]=e,ut(a),r=a;break a;case`link`:var o=Vf(`link`,`href`,i).get(r+(n.href||``));if(o){for(var c=0;c<o.length;c++)if(a=o[c],a.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&a.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&a.getAttribute(`title`)===(n.title==null?null:n.title)&&a.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){o.splice(c,1);break b}}a=i.createElement(r),Pd(a,r,n),i.head.appendChild(a);break;case`meta`:if(o=Vf(`meta`,`content`,i).get(r+(n.content||``))){for(c=0;c<o.length;c++)if(a=o[c],a.getAttribute(`content`)===(n.content==null?null:``+n.content)&&a.getAttribute(`name`)===(n.name==null?null:n.name)&&a.getAttribute(`property`)===(n.property==null?null:n.property)&&a.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&a.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){o.splice(c,1);break b}}a=i.createElement(r),Pd(a,r,n),i.head.appendChild(a);break;default:throw Error(s(468,r))}a[Ze]=e,ut(a),r=a}e.stateNode=r}else Hf(i,e.type,e.stateNode);else e.stateNode=If(i,r,e.memoizedProps);else a===r?r===null&&e.stateNode!==null&&Hc(e,e.memoizedProps,n.memoizedProps):(a===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):a.count--,r===null?Hf(i,e.type,e.stateNode):If(i,r,e.memoizedProps))}break;case 27:ul(t,e),pl(e),r&512&&(Yc||n===null||Bc(n,n.return)),n!==null&&r&4&&Hc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(ul(t,e),pl(e),r&512&&(Yc||n===null||Bc(n,n.return)),e.flags&32){i=e.stateNode;try{It(i,``)}catch(t){Hu(e,e.return,t)}}r&4&&e.stateNode!=null&&(i=e.memoizedProps,Hc(e,i,n===null?i:n.memoizedProps)),r&1024&&(Xc=!0);break;case 6:if(ul(t,e),pl(e),r&4){if(e.stateNode===null)throw Error(s(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){Hu(e,e.return,t)}}break;case 3:if(Bf=null,i=dl,dl=gf(t.containerInfo),ul(t,e),dl=i,pl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Np(t.containerInfo)}catch(t){Hu(e,e.return,t)}Xc&&(Xc=!1,ml(e));break;case 4:r=dl,dl=gf(e.stateNode.containerInfo),ul(t,e),pl(e),dl=r;break;case 12:ul(t,e),pl(e);break;case 31:ul(t,e),pl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ll(e,r)));break;case 13:ul(t,e),pl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Xl=ge()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ll(e,r)));break;case 22:i=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=Jc,d=Yc;if(Jc=u||i,Yc=d||l,ul(t,e),Yc=d,Jc=u,pl(e),r&8192)a:for(t=e.stateNode,t._visibility=i?t._visibility&-2:t._visibility|1,i&&(n===null||l||Jc||Yc||Z(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(a=l.stateNode,i)o=a.style,typeof o.setProperty==`function`?o.setProperty(`display`,`none`,`important`):o.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){Hu(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=i?``:l.memoizedProps}catch(e){Hu(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;i?$d(m,!0):$d(l.stateNode,!1)}catch(e){Hu(l,l.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,ll(e,n))));break;case 19:ul(t,e),pl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ll(e,r)));break;case 30:break;case 21:break;default:ul(t,e),pl(e)}}function pl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Uc(r)){n=r;break}r=r.return}if(n==null)throw Error(s(160));switch(n.tag){case 27:var i=n.stateNode;Kc(e,Wc(e),i);break;case 5:var a=n.stateNode;n.flags&32&&(It(a,``),n.flags&=-33),Kc(e,Wc(e),a);break;case 3:case 4:var o=n.stateNode.containerInfo;Gc(e,Wc(e),o);break;default:throw Error(s(161))}}catch(t){Hu(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function ml(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;ml(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function hl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)el(e,t.alternate,t),t=t.sibling}function Z(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Ic(4,t,t.return),Z(t);break;case 1:Bc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Rc(t,t.return,n),Z(t);break;case 27:pf(t.stateNode);case 26:case 5:Bc(t,t.return),Z(t);break;case 22:t.memoizedState===null&&Z(t);break;case 30:Z(t);break;default:Z(t)}e=e.sibling}}function gl(e,t,n){for(n&&=(t.subtreeFlags&8772)!=0,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:gl(i,a,n),Fc(4,a);break;case 1:if(gl(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Hu(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;
vendor: 18,658 bytes, line 8
8if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)Ha(c[i],s)}catch(e){Hu(r,r.return,e)}}n&&o&64&&Lc(a),zc(a,a.return);break;case 27:qc(a);case 26:case 5:gl(i,a,n),n&&r===null&&o&4&&Vc(a),zc(a,a.return);break;case 12:gl(i,a,n);break;case 31:gl(i,a,n),n&&o&4&&ol(i,a);break;case 13:gl(i,a,n),n&&o&4&&sl(i,a);break;case 22:a.memoizedState===null&&gl(i,a,n),zc(a,a.return);break;case 30:break;default:gl(i,a,n)}t=t.sibling}}function _l(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&ta(n))}function vl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ta(e))}function yl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)bl(e,t,n,r),t=t.sibling}function bl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:yl(e,t,n,r),i&2048&&Fc(9,t);break;case 1:yl(e,t,n,r);break;case 3:yl(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ta(e)));break;case 12:if(i&2048){yl(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){Hu(t,t.return,e)}}else yl(e,t,n,r);break;case 31:yl(e,t,n,r);break;case 13:yl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?yl(e,t,n,r):(a._visibility|=2,xl(e,t,n,r,(t.subtreeFlags&10256)!=0||!1)):a._visibility&2?yl(e,t,n,r):Sl(e,t),i&2048&&_l(o,t);break;case 24:yl(e,t,n,r),i&2048&&vl(t.alternate,t);break;default:yl(e,t,n,r)}}function xl(e,t,n,r,i){for(i&&=(t.subtreeFlags&10256)!=0||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:xl(a,o,s,c,i),Fc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,xl(a,o,s,c,i)):u._visibility&2?xl(a,o,s,c,i):Sl(a,o),i&&l&2048&&_l(o.alternate,o);break;case 24:xl(a,o,s,c,i),i&&l&2048&&vl(o.alternate,o);break;default:xl(a,o,s,c,i)}t=t.sibling}}function Sl(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:Sl(n,r),i&2048&&_l(r.alternate,r);break;case 24:Sl(n,r),i&2048&&vl(r.alternate,r);break;default:Sl(n,r)}t=t.sibling}}var Cl=8192;function wl(e,t,n){if(e.subtreeFlags&Cl)for(e=e.child;e!==null;)Tl(e,t,n),e=e.sibling}function Tl(e,t,n){switch(e.tag){case 26:wl(e,t,n),e.flags&Cl&&e.memoizedState!==null&&Gf(n,dl,e.memoizedState,e.memoizedProps);break;case 5:wl(e,t,n);break;case 3:case 4:var r=dl;dl=gf(e.stateNode.containerInfo),wl(e,t,n),dl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Cl,Cl=16777216,wl(e,t,n),Cl=r):wl(e,t,n));break;default:wl(e,t,n)}}function El(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Dl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];Qc=r,Al(r,e)}El(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Ol(e),e=e.sibling}function Ol(e){switch(e.tag){case 0:case 11:case 15:Dl(e),e.flags&2048&&Ic(9,e,e.return);break;case 3:Dl(e);break;case 12:Dl(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,kl(e)):Dl(e);break;default:Dl(e)}}function kl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];Qc=r,Al(r,e)}El(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Ic(8,t,t.return),kl(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,kl(t));break;default:kl(t)}e=e.sibling}}function Al(e,t){for(;Qc!==null;){var n=Qc;switch(n.tag){case 0:case 11:case 15:Ic(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:ta(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,Qc=r;else a:for(n=e;Qc!==null;){r=Qc;var i=r.sibling,a=r.return;if(tl(r),r===n){Qc=null;break a}if(i!==null){i.return=a,Qc=i;break a}Qc=a}}}var jl={getCacheForType:function(e){var t=qi($i),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return qi($i).controller.signal}},Ml=typeof WeakMap==`function`?WeakMap:Map,Nl=0,Pl=null,Fl=null,Il=0,Ll=0,Rl=null,zl=!1,Bl=!1,Vl=!1,Hl=0,Ul=0,Q=0,$=0,Wl=0,Gl=0,Kl=0,ql=null,Jl=null,Yl=!1,Xl=0,Zl=0,Ql=1/0,$l=null,eu=null,tu=0,nu=null,ru=null,iu=0,au=0,ou=null,su=null,cu=0,lu=null;function uu(){return Nl&2&&Il!==0?Il&-Il:I.T===null?Je():ld()}function du(){if(Gl===0)if(!(Il&536870912)||Ei){var e=Ne;Ne<<=1,!(Ne&3932160)&&(Ne=262144),Gl=e}else Gl=536870912;return e=Ya.current,e!==null&&(e.flags|=32),Gl}function fu(e,t,n){(e===Pl&&(Ll===2||Ll===9)||e.cancelPendingCommit!==null)&&(yu(e,0),gu(e,Il,Gl,!1)),Ve(e,n),(!(Nl&2)||e!==Pl)&&(e===Pl&&(!(Nl&2)&&($|=n),Ul===4&&gu(e,Il,Gl,!1)),td(e))}function pu(e,t,n){if(Nl&6)throw Error(s(327));var r=!n&&(t&127)==0&&(t&e.expiredLanes)===0||Le(e,t),i=r?Du(e,t):Tu(e,t,!0),a=r;do{if(i===0){Bl&&!r&&gu(e,t,0,!1);break}else{if(n=e.current.alternate,a&&!hu(n)){i=Tu(e,t,!1),a=!1;continue}if(i===2){if(a=t,e.errorRecoveryDisabledLanes&a)var o=0;else o=e.pendingLanes&-536870913,o=o===0?o&536870912?536870912:0:o;if(o!==0){t=o;a:{var c=e;i=ql;var l=c.current.memoizedState.isDehydrated;if(l&&(yu(c,o).flags|=256),o=Tu(c,o,!1),o!==2){if(Vl&&!l){c.errorRecoveryDisabledLanes|=a,$|=a,i=4;break a}a=Jl,Jl=i,a!==null&&(Jl===null?Jl=a:Jl.push.apply(Jl,a))}i=o}if(a=!1,i!==2)continue}}if(i===1){yu(e,0),gu(e,t,0,!0);break}a:{switch(r=e,a=i,a){case 0:case 1:throw Error(s(345));case 4:if((t&4194048)!==t)break;case 6:gu(r,t,Gl,!zl);break a;case 2:Jl=null;break;case 3:case 5:break;default:throw Error(s(329))}if((t&62914560)===t&&(i=Xl+300-ge(),10<i)){if(gu(r,t,Gl,!zl),Ie(r,0,!0)!==0)break a;iu=t,r.timeoutHandle=Kd(mu.bind(null,r,n,Jl,$l,Yl,t,Gl,$,Kl,zl,a,`Throttled`,-0,0),i);break a}mu(r,n,Jl,$l,Yl,t,Gl,$,Kl,zl,a,null,-0,0)}}break}while(1);td(e)}function mu(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Wt},Tl(t,a,d);var m=(a&62914560)===a?Xl-ge():(a&4194048)===a?Zl-ge():0;if(m=qf(d,m),m!==null){iu=a,e.cancelPendingCommit=m(Pu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),gu(e,a,o,!l);return}}Pu(e,t,a,n,r,i,o,s,c)}function hu(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!pr(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function gu(e,t,n,r){t&=~Wl,t&=~$,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Oe(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&Ue(e,n,t)}function _u(){return Nl&6?!0:(nd(0,!1),!1)}function vu(){if(Fl!==null){if(Ll===0)var e=Fl.return;else e=Fl,zi=Ri=null,wo(e),wa=null,Ta=0,e=Fl;for(;e!==null;)Pc(e.alternate,e),e=e.return;Fl=null}}function yu(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,qd(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),iu=0,vu(),Pl=e,Fl=n=ti(e.current,null),Il=t,Ll=0,Rl=null,zl=!1,Bl=Le(e,t),Vl=!1,Kl=Gl=Wl=$=Q=Ul=0,Jl=ql=null,Yl=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-Oe(r),a=1<<i;t|=e[i],r&=~a}return Hl=t,Gr(),n}function bu(e,t){ao=null,I.H=Ps,t===ma||t===ga?(t=Sa(),Ll=3):t===ha?(t=Sa(),Ll=4):Ll=t===Ys?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Rl=t,Fl===null&&(Ul=1,Us(e,li(t,e.current)))}function xu(){var e=Ya.current;return e===null?!0:(Il&4194048)===Il?Xa===null:(Il&62914560)===Il||Il&536870912?e===Xa:!1}function Su(){var e=I.H;return I.H=Ps,e===null?Ps:e}function Cu(){var e=I.A;return I.A=jl,e}function wu(){Ul=4,zl||(Il&4194048)!==Il&&Ya.current!==null||(Bl=!0),!(Q&134217727)&&!($&134217727)||Pl===null||gu(Pl,Il,Gl,!1)}function Tu(e,t,n){var r=Nl;Nl|=2;var i=Su(),a=Cu();(Pl!==e||Il!==t)&&($l=null,yu(e,t)),t=!1;var o=Ul;a:do try{if(Ll!==0&&Fl!==null){var s=Fl,c=Rl;switch(Ll){case 8:vu(),o=6;break a;case 3:case 2:case 9:case 6:Ya.current===null&&(t=!0);var l=Ll;if(Ll=0,Rl=null,ju(e,s,c,l),n&&Bl){o=0;break a}break;default:l=Ll,Ll=0,Rl=null,ju(e,s,c,l)}}Eu(),o=Ul;break}catch(t){bu(e,t)}while(1);return t&&e.shellSuspendCounter++,zi=Ri=null,Nl=r,I.H=i,I.A=a,Fl===null&&(Pl=null,Il=0,Gr()),o}function Eu(){for(;Fl!==null;)ku(Fl)}function Du(e,t){var n=Nl;Nl|=2;var r=Su(),i=Cu();Pl!==e||Il!==t?($l=null,Ql=ge()+500,yu(e,t)):Bl=Le(e,t);a:do try{if(Ll!==0&&Fl!==null){t=Fl;var a=Rl;b:switch(Ll){case 1:Ll=0,Rl=null,ju(e,t,a,1);break;case 2:case 9:if(va(a)){Ll=0,Rl=null,Au(t);break}t=function(){Ll!==2&&Ll!==9||Pl!==e||(Ll=7),td(e)},a.then(t,t);break a;case 3:Ll=7;break a;case 4:Ll=5;break a;case 7:va(a)?(Ll=0,Rl=null,Au(t)):(Ll=0,Rl=null,ju(e,t,a,7));break;case 5:var o=null;switch(Fl.tag){case 26:o=Fl.memoizedState;case 5:case 27:var c=Fl;if(o?Wf(o):c.stateNode.complete){Ll=0,Rl=null;var l=c.sibling;if(l!==null)Fl=l;else{var u=c.return;u===null?Fl=null:(Fl=u,Mu(u))}break b}}Ll=0,Rl=null,ju(e,t,a,5);break;case 6:Ll=0,Rl=null,ju(e,t,a,6);break;case 8:vu(),Ul=6;break a;default:throw Error(s(462))}}Ou();break}catch(t){bu(e,t)}while(1);return zi=Ri=null,I.H=r,I.A=i,Nl=n,Fl===null?(Pl=null,Il=0,Gr(),Ul):0}function Ou(){for(;Fl!==null&&!me();)ku(Fl)}function ku(e){var t=Tc(e.alternate,e,Hl);e.memoizedProps=e.pendingProps,t===null?Mu(e):Fl=t}function Au(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=lc(n,t,t.pendingProps,t.type,void 0,Il);break;case 11:t=lc(n,t,t.pendingProps,t.type.render,t.ref,Il);break;case 5:wo(t);default:Pc(n,t),t=Fl=ni(t,Hl),t=Tc(n,t,Hl)}e.memoizedProps=e.pendingProps,t===null?Mu(e):Fl=t}function ju(e,t,n,r){zi=Ri=null,wo(t),wa=null,Ta=0;var i=t.return;try{if(Js(e,i,t,n,Il)){Ul=1,Us(e,li(n,e.current)),Fl=null;return}}catch(t){if(i!==null)throw Fl=i,t;Ul=1,Us(e,li(n,e.current)),Fl=null;return}t.flags&32768?(Ei||r===1?e=!0:Bl||Il&536870912?e=!1:(zl=e=!0,(r===2||r===9||r===3||r===6)&&(r=Ya.current,r!==null&&r.tag===13&&(r.flags|=16384))),Nu(t,e)):Mu(t)}function Mu(e){var t=e;do{if(t.flags&32768){Nu(t,zl);return}e=t.return;var n=Mc(t.alternate,t,Hl);if(n!==null){Fl=n;return}if(t=t.sibling,t!==null){Fl=t;return}Fl=t=e}while(t!==null);Ul===0&&(Ul=5)}function Nu(e,t){do{var n=Nc(e.alternate,e);if(n!==null){n.flags&=32767,Fl=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Fl=e;return}Fl=e=n}while(e!==null);Ul=6,Fl=null}function Pu(e,t,n,r,i,a,o,c,l){e.cancelPendingCommit=null;do zu();while(tu!==0);if(Nl&6)throw Error(s(327));if(t!==null){if(t===e.current)throw Error(s(177));if(a=t.lanes|t.childLanes,a|=Wr,He(e,n,a,o,c,l),e===Pl&&(Fl=Pl=null,Il=0),ru=t,nu=e,iu=n,au=a,ou=i,su=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,Ju(be,function(){return Bu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!=0,t.subtreeFlags&13878||r){r=I.T,I.T=null,i=L.p,L.p=2,o=Nl,Nl|=4;try{$c(e,t,n)}finally{Nl=o,L.p=i,I.T=r}}tu=1,Fu(),Iu(),Lu()}}function Fu(){if(tu===1){tu=0;var e=nu,t=ru,n=(t.flags&13878)!=0;if(t.subtreeFlags&13878||n){n=I.T,I.T=null;var r=L.p;L.p=2;var i=Nl;Nl|=4;try{fl(t,e);var a=zd,o=vr(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&_r(s.ownerDocument.documentElement,s)){if(c!==null&&yr(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=gr(s,h),v=gr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}sp=!!Rd,zd=Rd=null}finally{Nl=i,L.p=r,I.T=n}}e.current=t,tu=2}}function Iu(){if(tu===2){tu=0;var e=nu,t=ru,n=(t.flags&8772)!=0;if(t.subtreeFlags&8772||n){n=I.T,I.T=null;var r=L.p;L.p=2;var i=Nl;Nl|=4;try{el(e,t.alternate,t)}finally{Nl=i,L.p=r,I.T=n}}tu=3}}function Lu(){if(tu===4||tu===3){tu=0,he();var e=nu,t=ru,n=iu,r=su;t.subtreeFlags&10256||t.flags&10256?tu=5:(tu=0,ru=nu=null,Ru(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(eu=null),qe(n),t=t.stateNode,Ee&&typeof Ee.onCommitFiberRoot==`function`)try{Ee.onCommitFiberRoot(Te,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=I.T,i=L.p,L.p=2,I.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{I.T=t,L.p=i}}iu&3&&zu(),td(e),i=e.pendingLanes,n&261930&&i&42?e===lu?cu++:(cu=0,lu=e):cu=0,nd(0,!1)}}function Ru(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,ta(t)))}function zu(){return Fu(),Iu(),Lu(),Bu()}function Bu(){if(tu!==5)return!1;var e=nu,t=au;au=0;var n=qe(iu),r=I.T,i=L.p;try{L.p=32>n?32:n,I.T=null,n=ou,ou=null;var a=nu,o=iu;if(tu=0,ru=nu=null,iu=0,Nl&6)throw Error(s(331));var c=Nl;if(Nl|=4,Ol(a.current),bl(a,a.current,o,n),Nl=c,nd(0,!1),Ee&&typeof Ee.onPostCommitFiberRoot==`function`)try{Ee.onPostCommitFiberRoot(Te,a)}catch{}return!0}finally{L.p=i,I.T=r,Ru(e,t)}}function Vu(e,t,n){t=li(n,t),t=Gs(e.stateNode,t,2),e=Ia(e,t,2),e!==null&&(Ve(e,2),td(e))}function Hu(e,t,n){if(e.tag===3)Vu(e,e,n);else for(;t!==null;){if(t.tag===3){Vu(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(eu===null||!eu.has(r))){e=li(n,e),n=Ks(2),r=Ia(t,n,2),r!==null&&(qs(n,r,t,e),Ve(r,2),td(r));break}}t=t.return}}function Uu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Ml;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Vl=!0,i.add(n),e=Wu.bind(null,e,t,n),t.then(e,e))}function Wu(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Pl===e&&(Il&n)===n&&(Ul===4||Ul===3&&(Il&62914560)===Il&&300>ge()-Xl?!(Nl&2)&&yu(e,0):Wl|=n,Kl===Il&&(Kl=0)),td(e)}function Gu(e,t){t===0&&(t=ze()),e=Jr(e,t),e!==null&&(Ve(e,t),td(e))}function Ku(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Gu(e,n)}function qu(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(s(314))}r!==null&&r.delete(t),Gu(e,n)}function Ju(e,t){return fe(e,t)}var Yu=null,Xu=null,Zu=!1,Qu=!1,$u=!1,ed=0;function td(e){e!==Xu&&e.next===null&&(Xu===null?Yu=Xu=e:Xu=Xu.next=e),Qu=!0,Zu||(Zu=!0,cd())}function nd(e,t){if(!$u&&Qu){$u=!0;do for(var n=!1,r=Yu;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Oe(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,sd(r,a))}else a=Il,a=Ie(r,r===Pl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Le(r,a)||(n=!0,sd(r,a));r=r.next}while(n);$u=!1}}function rd(){id()}function id(){Qu=Zu=!1;var e=0;ed!==0&&Gd()&&(e=ed);for(var t=ge(),n=null,r=Yu;r!==null;){var i=r.next,a=ad(r,t);a===0?(r.next=null,n===null?Yu=i:n.next=i,i===null&&(Xu=n)):(n=r,(e!==0||a&3)&&(Qu=!0)),r=i}tu!==0&&tu!==5||nd(e,!1),ed!==0&&(ed=0)}function ad(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Oe(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Re(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Pl,n=Il,n=Ie(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Ll===2||Ll===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&pe(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Le(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&pe(r),qe(n)){case 2:case 8:n=ye;break;case 32:n=be;break;case 268435456:n=Se;break;default:n=be}return r=od.bind(null,e),n=fe(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&pe(r),e.callbackPriority=2,e.callbackNode=null,2}function od(e,t){if(tu!==0&&tu!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(zu()&&e.callbackNode!==n)return null;var r=Il;return r=Ie(e,e===Pl?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(pu(e,r,t),ad(e,ge()),e.callbackNode!=null&&e.callbackNode===n?od.bind(null,e):null)}function sd(e,t){if(zu())return null;pu(e,t,!0)}function cd(){Yd(function(){Nl&6?fe(ve,rd):id()})}function ld(){if(ed===0){var e=ia;e===0&&(e=Me,Me<<=1,!(Me&261888)&&(Me=256)),ed=e}return ed}function ud(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Ut(``+e)}function dd(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function fd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=ud((i[Qe]||null).action),o=r.submitter;o&&(t=(t=o[Qe]||null)?ud(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new fn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(ed!==0){var e=o?dd(i,o):new FormData(i);bs(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?dd(i,o):new FormData(i),bs(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var pd=0;pd<zr.length;pd++){var md=zr[pd];Br(md.toLowerCase(),`on`+(md[0].toUpperCase()+md.slice(1)))}Br(jr,`onAnimationEnd`),Br(Mr,`onAnimationIteration`),Br(Nr,`onAnimationStart`),Br(`dblclick`,`onDoubleClick`),Br(`focu
8sin`,`onFocus`),Br(`focusout`,`onBlur`),Br(Pr,`onTransitionRun`),Br(Fr,`onTransitionStart`),Br(Ir,`onTransitionCancel`),Br(Lr,`onTransitionEnd`),mt(`onMouseEnter`,[`mouseout`,`mouseover`]),mt(`onMouseLeave`,[`mouseout`,`mouseover`]),mt(`onPointerEnter`,[`pointerout`,`pointerover`]),mt(`onPointerLeave`,[`pointerout`,`pointerover`]),pt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),pt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),pt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),pt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),pt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),pt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var hd=`abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting`.split(` `),gd=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(hd));function _d(e,t){t=(t&4)!=0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Vr(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Vr(e)}i.currentTarget=null,a=c}}}}function vd(e,t){var n=t[et];n===void 0&&(n=t[et]=new Set);var r=e+`__bubble`;n.has(r)||(Sd(t,e,2,!1),n.add(r))}function yd(e,t,n){var r=0;t&&(r|=4),Sd(n,e,r,t)}var bd=`_reactListening`+Math.random().toString(36).slice(2);function xd(e){if(!e[bd]){e[bd]=!0,dt.forEach(function(t){t!==`selectionchange`&&(gd.has(t)||yd(t,!1,e),yd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[bd]||(t[bd]=!0,yd(`selectionchange`,!1,t))}}function Sd(e,t,n,r){switch(mp(t)){case 2:var i=cp;break;case 8:i=lp;break;default:i=up}n=i.bind(null,t,n,e),i=void 0,!en||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function Cd(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var s=r.stateNode.containerInfo;if(s===i)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&o.stateNode.containerInfo===i)return;o=o.return}for(;s!==null;){if(o=ot(s),o===null)return;if(c=o.tag,c===5||c===6||c===26||c===27){r=a=o;continue a}s=s.parentNode}}r=r.return}Zt(function(){var r=a,i=Kt(n),o=[];a:{var s=Rr.get(e);if(s!==void 0){var c=fn,u=e;switch(e){case`keypress`:if(sn(n)===0)break a;case`keydown`:case`keyup`:c=An;break;case`focusin`:u=`focus`,c=xn;break;case`focusout`:u=`blur`,c=xn;break;case`beforeblur`:case`afterblur`:c=xn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:c=yn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:c=bn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:c=Mn;break;case jr:case Mr:case Nr:c=Sn;break;case Lr:c=Nn;break;case`scroll`:case`scrollend`:c=mn;break;case`wheel`:c=Pn;break;case`copy`:case`cut`:case`paste`:c=Cn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:c=jn;break;case`toggle`:case`beforetoggle`:c=Fn}var d=(t&4)!=0,f=!d&&(e===`scroll`||e===`scrollend`),p=d?s===null?null:s+`Capture`:s;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=Qt(m,p),g!=null&&d.push(wd(m,g,h))),f)break;m=m.return}0<d.length&&(s=new c(s,u,null,n,i),o.push({event:s,listeners:d}))}}if(!(t&7)){a:{if(s=e===`mouseover`||e===`pointerover`,c=e===`mouseout`||e===`pointerout`,s&&n!==Gt&&(u=n.relatedTarget||n.fromElement)&&(ot(u)||u[$e]))break a;if((c||s)&&(s=i.window===i?i:(s=i.ownerDocument)?s.defaultView||s.parentWindow:window,c?(u=n.relatedTarget||n.toElement,c=r,u=u?ot(u):null,u!==null&&(f=l(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(c=null,u=r),c!==u)){
vendor: 5,736 bytes, lines 8-9
8if(d=yn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=jn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=c==null?s:ct(c),h=u==null?s:ct(u),s=new d(g,m+`leave`,c,n,i),s.target=f,s.relatedTarget=h,g=null,ot(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,c&&u)b:{for(d=Ed,p=c,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;c!==null&&Dd(o,s,c,d,!1),u!==null&&f!==null&&Dd(o,f,u,d,!0)}}a:{if(s=r?ct(r):window,c=s.nodeName&&s.nodeName.toLowerCase(),c===`select`||c===`input`&&s.type===`file`)var v=tr;else if(Yn(s))if(nr)v=dr;else{v=lr;var y=cr}else c=s.nodeName,!c||c.toLowerCase()!==`input`||s.type!==`checkbox`&&s.type!==`radio`?r&&Bt(r.elementType)&&(v=tr):v=ur;if(v&&=v(e,r)){Xn(o,v,n,i);break a}y&&y(e,s,r),e===`focusout`&&r&&s.type===`number`&&r.memoizedProps.value!=null&&Mt(s,`number`,s.value)}switch(y=r?ct(r):window,e){case`focusin`:(Yn(y)||y.contentEditable===`true`)&&(xr=y,Sr=r,Cr=null);break;case`focusout`:Cr=Sr=xr=null;break;case`mousedown`:wr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:wr=!1,Tr(o,n,i);break;case`selectionchange`:if(br)break;case`keydown`:case`keyup`:Tr(o,n,i)}var b;if(Ln)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else Gn?Un(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Bn&&n.locale!==`ko`&&(Gn||x!==`onCompositionStart`?x===`onCompositionEnd`&&Gn&&(b=on()):(nn=i,rn=`value`in nn?nn.value:nn.textContent,Gn=!0)),y=Td(r,x),0<y.length&&(x=new wn(x,e,null,n,i),o.push({event:x,listeners:y}),b?x.data=b:(b=Wn(n),b!==null&&(x.data=b)))),(b=zn?Kn(e,n):qn(e,n))&&(x=Td(r,`onBeforeInput`),0<x.length&&(y=new wn(`onBeforeInput`,`beforeinput`,null,n,i),o.push({event:y,listeners:x}),y.data=b)),fd(o,e,r,n,i)}_d(o,t)})}function wd(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Td(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=Qt(e,n),i!=null&&r.unshift(wd(e,i,a)),i=Qt(e,t),i!=null&&r.push(wd(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Ed(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Dd(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=Qt(n,a),l!=null&&o.unshift(wd(n,l,c))):i||(l=Qt(n,a),l!=null&&o.push(wd(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Od=/\r\n?/g,kd=/\u0000|\uFFFD/g;function Ad(e){return(typeof e==`string`?e:``+e).replace(Od,` 9`).replace(kd,``)}function jd(e,t){return t=Ad(t),Ad(e)===t}function Md(e,t,n,r,i,a){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||It(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&It(e,``+r);break;case`className`:bt(e,`class`,r);break;case`tabIndex`:bt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:bt(e,n,r);break;case`style`:zt(e,r,a);break;case`data`:if(t!==`object`){bt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Ut(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}else typeof a==`function`&&(n===`formAction`?(t!==`input`&&Md(e,t,`name`,i.name,i,null),Md(e,t,`formEncType`,i.formEncType,i,null),Md(e,t,`formMethod`,i.formMethod,i,null),Md(e,t,`formTarget`,i.formTarget,i,null)):(Md(e,t,`encType`,i.encType,i,null),Md(e,t,`method`,i.method,i,null),Md(e,t,`target`,i.target,i,null)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Ut(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=Wt);break;case`onScroll`:r!=null&&vd(`scroll`,e);break;case`onScrollEnd`:r!=null&&vd(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(s(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(s(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=Ut(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInl
9ine`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:vd(`beforetoggle`,e),vd(`toggle`,e),yt(e,`popover`,r);break;case`xlinkActuate`:xt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:xt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:xt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:xt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:xt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:xt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:xt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:xt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:xt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:yt(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=Vt.get(n)||n,yt(e,n,r))}}function Nd(e,t,n,r,i,a){switch(n){case`style`:zt(e,r,a);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(s(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(s(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?It(e,r):(typeof r==`number`||typeof r==`bigint`)&&It(e,``+r);break;case`onScroll`:r!=null&&vd(`scroll`,e);break;case`onScrollEnd`:r!=null&&vd(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=Wt);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!ft.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(i=n.endsWith(`Capture`),t=n.slice(2,i?n.length-7:void 0),a=e[Qe]||null,a=a==null?null:a[n],typeof a==`function`&&e.removeEventListener(t,a,i),typeof r==`function`)){typeof a!=`function`&&a!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,i);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):yt(e,n,r)}}}function Pd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:vd(`error`,e),vd(`load`,e);var r=!1,i=!1,a;for(a in n)if(n.hasOwnProperty(a)){var o=n[a];if(o!=null)switch(a){case`src`:r=!0;break;case`srcSet`:i=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(s(137,t));default:Md(e,t,a,o,n,null)}}i&&Md(e,t,`srcSet`,n.srcSet,n,null),r&&Md(e,t,`src`,n.src,n,null);return;
vendor: 4,505 bytes, line 9
9case`input`:vd(`invalid`,e);var c=a=o=i=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:i=d;break;case`type`:o=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:a=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(s(137,t));break;default:Md(e,t,r,d,n,null)}}jt(e,a,c,l,u,o,i,!1);return;case`select`:for(i in vd(`invalid`,e),r=o=a=null,n)if(n.hasOwnProperty(i)&&(c=n[i],c!=null))switch(i){case`value`:a=c;break;case`defaultValue`:o=c;break;case`multiple`:r=c;default:Md(e,t,i,c,n,null)}t=a,n=o,e.multiple=!!r,t==null?n!=null&&Nt(e,!!r,n,!0):Nt(e,!!r,t,!1);return;case`textarea`:for(o in vd(`invalid`,e),a=i=r=null,n)if(n.hasOwnProperty(o)&&(c=n[o],c!=null))switch(o){case`value`:r=c;break;case`defaultValue`:i=c;break;case`children`:a=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(s(91));break;default:Md(e,t,o,c,n,null)}Ft(e,r,i,a);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Md(e,t,l,r,n,null)}return;case`dialog`:vd(`beforetoggle`,e),vd(`toggle`,e),vd(`cancel`,e),vd(`close`,e);break;case`iframe`:case`object`:vd(`load`,e);break;case`video`:case`audio`:for(r=0;r<hd.length;r++)vd(hd[r],e);break;case`image`:vd(`error`,e),vd(`load`,e);break;case`details`:vd(`toggle`,e);break;case`embed`:case`source`:case`link`:vd(`error`,e),vd(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(s(137,t));default:Md(e,t,u,r,n,null)}return;default:if(Bt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Nd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Md(e,t,c,r,n,null))}function Fd(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var i=null,a=null,o=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Md(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:a=m;break;case`name`:i=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:o=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(s(137,t));break;default:m!==f&&Md(e,t,p,m,r,f)}}At(e,o,c,l,u,d,a,i);return;case`select`:for(a in m=o=c=p=null,n)if(l=n[a],n.hasOwnProperty(a)&&l!=null)switch(a){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(a)||Md(e,t,a,null,r,l)}for(i in r)if(a=r[i],l=n[i],r.hasOwnProperty(i)&&(a!=null||l!=null))switch(i){case`value`:p=a;break;case`defaultValue`:c=a;break;case`multiple`:o=a;default:a!==l&&Md(e,t,i,a,r,l)}t=c,n=o,r=m,p==null?!!r!=!!n&&(t==null?Nt(e,!!n,n?[]:``,!1):Nt(e,!!n,t,!0)):Nt(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(i=n[c],n.hasOwnProperty(c)&&i!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Md(e,t,c,null,r,i)}for(o in r)if(i=r[o],a=n[o],r.hasOwnProperty(o)&&(i!=null||a!=null))switch(o){case`value`:p=i;break;case`defaultValue`:m=i;break;case`children`:break;case`dangerouslySetInnerHTML`:if(i!=null)throw Error(s(91));break;default:i!==a&&Md(e,t,o,i,r,a)}Pt(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Md(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Md(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Md(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(s(137,t));break;default:Md(e,t,u,p,r,m)}return;default:if(Bt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Nd(e,t,_,void 0,r,p);
vendor: 4,463 bytes, line 9
9for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Nd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Md(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Md(e,t,f,p,r,m)}function Id(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Ld(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Id(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Id(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Rd=null,zd=null;function Bd(e){return e.nodeType===9?e:e.ownerDocument}function Vd(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function Hd(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function Ud(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Wd=null;function Gd(){var e=window.event;return e&&e.type===`popstate`?e===Wd?!1:(Wd=e,!0):(Wd=null,!1)}var Kd=typeof setTimeout==`function`?setTimeout:void 0,qd=typeof clearTimeout==`function`?clearTimeout:void 0,Jd=typeof Promise==`function`?Promise:void 0,Yd=typeof queueMicrotask==`function`?queueMicrotask:Jd===void 0?Kd:function(e){return Jd.resolve(null).then(e).catch(Xd)};function Xd(e){setTimeout(function(){throw e})}function Zd(e){return e===`head`}function Qd(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Np(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)pf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,pf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[it]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&pf(e.ownerDocument.body);n=i}while(n);Np(t)}function $d(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8)if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++;n=r}while(n)}function ef(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:ef(n),at(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function tf(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r)if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e;else if(!e[it])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=cf(e.nextSibling),e===null)break}return null}function nf(e,t,n){if(t===``)return null;for(;
vendor: 20,904 bytes, line 9
9e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=cf(e.nextSibling),e===null))return null;return e}function rf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=cf(e.nextSibling),e===null))return null;return e}function af(e){return e.data===`$?`||e.data===`$~`}function of(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function sf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function cf(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var lf=null;function uf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return cf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function df(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function ff(e,t,n){switch(t=Bd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(s(452));return e;case`head`:if(e=t.head,!e)throw Error(s(453));return e;case`body`:if(e=t.body,!e)throw Error(s(454));return e;default:throw Error(s(451))}}function pf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);at(e)}var mf=new Map,hf=new Set;function gf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var _f=L.d;L.d={f:vf,r:yf,D:Sf,C:Cf,L:wf,m:Tf,X:Df,S:Ef,M:Of};function vf(){var e=_f.f(),t=_u();return e||t}function yf(e){var t=st(e);t!==null&&t.tag===5&&t.type===`form`?Ss(t):_f.r(e)}var bf=typeof document>`u`?null:document;function xf(e,t,n){var r=bf;if(r&&typeof t==`string`&&t){var i=kt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),hf.has(i)||(hf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Pd(t,`link`,e),ut(t),r.head.appendChild(t)))}}function Sf(e){_f.D(e),xf(`dns-prefetch`,e,null)}function Cf(e,t){_f.C(e,t),xf(`preconnect`,e,t)}function wf(e,t,n){_f.L(e,t,n);var r=bf;if(r&&e&&t){var i=`link[rel="preload"][as="`+kt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+kt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+kt(n.imageSizes)+`"]`)):i+=`[href="`+kt(e)+`"]`;var a=i;switch(t){case`style`:a=Af(e);break;case`script`:a=Pf(e)}mf.has(a)||(e=h({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),mf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(jf(a))||t===`script`&&r.querySelector(Ff(a))||(t=r.createElement(`link`),Pd(t,`link`,e),ut(t),r.head.appendChild(t)))}}function Tf(e,t){_f.m(e,t);var n=bf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+kt(r)+`"][href="`+kt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Pf(e)}if(!mf.has(a)&&(e=h({rel:`modulepreload`,href:e},t),mf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Ff(a)))return}r=n.createElement(`link`),Pd(r,`link`,e),ut(r),n.head.appendChild(r)}}}function Ef(e,t,n){_f.S(e,t,n);var r=bf;if(r&&e){var i=lt(r).hoistableStyles,a=Af(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(jf(a)))s.loading=5;else{e=h({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=mf.get(a))&&Rf(e,n);var c=o=r.createElement(`link`);ut(c),Pd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Lf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Df(e,t){_f.X(e,t);var n=bf;if(n&&e){var r=lt(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=h({src:e,async:!0},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),ut(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Of(e,t){_f.M(e,t);var n=bf;if(n&&e){var r=lt(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=h({src:e,async:!0,type:`module`},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),ut(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function kf(e,t,n,r){var i=(i=ee.current)?gf(i):null;if(!i)throw Error(s(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Af(n.href),n=lt(i).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Af(n.href);var a=lt(i).hoistableStyles,o=a.get(e);if(o||(i=i.ownerDocument||i,o={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},a.set(e,o),(a=i.querySelector(jf(e)))&&!a._p&&(o.instance=a,o.state.loading=5),mf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},mf.set(e,n),a||Nf(i,e,n,o.state))),t&&r===null)throw Error(s(528,``));return o}if(t&&r!==null)throw Error(s(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Pf(n),n=lt(i).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(s(444,e))}}function Af(e){return`href="`+kt(e)+`"`}function jf(e){return`link[rel="stylesheet"][`+e+`]`}function Mf(e){return h({},e,{"data-precedence":e.precedence,precedence:null})}function Nf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Pd(t,`link`,n),ut(t),e.head.appendChild(t))}function Pf(e){return`[src="`+kt(e)+`"]`}function Ff(e){return`script[async]`+e}function If(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+kt(n.href)+`"]`);if(r)return t.instance=r,ut(r),r;var i=h({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),ut(r),Pd(r,`style`,i),Lf(r,n.precedence,e),t.instance=r;case`stylesheet`:i=Af(n.href);var a=e.querySelector(jf(i));if(a)return t.state.loading|=4,t.instance=a,ut(a),a;r=Mf(n),(i=mf.get(i))&&Rf(r,i),a=(e.ownerDocument||e).createElement(`link`),ut(a);var o=a;return o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Pd(a,`link`,r),t.state.loading|=4,Lf(a,n.precedence,e),t.instance=a;case`script`:return a=Pf(n.src),(i=e.querySelector(Ff(a)))?(t.instance=i,ut(i),i):(r=n,(i=mf.get(a))&&(r=h({},n),zf(r,i)),e=e.ownerDocument||e,i=e.createElement(`script`),ut(i),Pd(i,`link`,r),e.head.appendChild(i),t.instance=i);case`void`:return null;default:throw Error(s(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Lf(r,n.precedence,e));return t.instance}function Lf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Rf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function zf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Bf=null;function Vf(e,t,n){if(Bf===null){var r=new Map,i=Bf=new Map;i.set(n,r)}else i=Bf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[it]||a[Ze]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Hf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Uf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Wf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Gf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Af(r.href),a=t.querySelector(jf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Jf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,ut(a);return}a=t.ownerDocument||t,r=Mf(r),(i=mf.get(i))&&Rf(r,i),a=a.createElement(`link`),ut(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Pd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Jf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Kf=0;function qf(e,t){return e.stylesheets&&e.count===0&&Xf(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&Xf(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&Kf===0&&(Kf=62500*Ld());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Xf(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>Kf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Jf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Yf=null;function Xf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Yf=new Map,t.forEach(Zf,e),Yf=null,Jf.call(e))}function Zf(e,t){if(!(t.state.loading&4)){var n=Yf.get(e);if(n)var r=n.get(null);else{n=new Map,Yf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=Jf.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var Qf={$$typeof:C,Provider:null,Consumer:null,_currentValue:R,_currentValue2:R,_threadCount:0};function $f(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Be(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Be(0),this.hiddenUpdates=Be(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function ep(e,t,n,r,i,a,o,s,c,l,u,d){return e=new $f(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=$r(3,null,null,t),e.current=a,a.stateNode=e,t=ea(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Na(a),e}function tp(e){return e?(e=Zr,e):Zr}function np(e,t,n,r,i,a){i=tp(i),r.context===null?r.context=i:r.pendingContext=i,r=Fa(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Ia(e,r,t),n!==null&&(fu(n,e,t),La(n,e,t))}function rp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ip(e,t){rp(e,t),(e=e.alternate)&&rp(e,t)}function ap(e){if(e.tag===13||e.tag===31){var t=Jr(e,67108864);t!==null&&fu(t,e,67108864),ip(e,67108864)}}function op(e){if(e.tag===13||e.tag===31){var t=uu();t=Ke(t);var n=Jr(e,t);n!==null&&fu(n,e,t),ip(e,t)}}var sp=!0;function cp(e,t,n,r){var i=I.T;I.T=null;var a=L.p;try{L.p=2,up(e,t,n,r)}finally{L.p=a,I.T=i}}function lp(e,t,n,r){var i=I.T;I.T=null;var a=L.p;try{L.p=8,up(e,t,n,r)}finally{L.p=a,I.T=i}}function up(e,t,n,r){if(sp){var i=dp(r);if(i===null)Cd(e,t,r,fp,n),Cp(e,r);else if(Tp(i,e,t,n,r))r.stopPropagation();else if(Cp(e,r),t&4&&-1<Sp.indexOf(e)){for(;i!==null;){var a=st(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Fe(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Oe(o);s.entanglements[1]|=c,o&=~c}td(a),!(Nl&6)&&(Ql=ge()+500,nd(0,!1))}}break;case 31:case 13:s=Jr(a,2),s!==null&&fu(s,a,2),_u(),ip(a,2)}if(a=dp(r),a===null&&Cd(e,t,r,fp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Cd(e,t,r,null,n)}}function dp(e){return e=Kt(e),pp(e)}var fp=null;function pp(e){if(fp=null,e=ot(e),e!==null){var t=l(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=u(t),e!==null)return e;e=null}else if(n===31){if(e=d(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return fp=e,null}function mp(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(_e()){case ve:return 2;case ye:return 8;case be:case xe:return 32;case Se:return 268435456;default:return 32}default:return 32}}var hp=!1,gp=null,_p=null,vp=null,yp=new Map,bp=new Map,xp=[],Sp=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Cp(e,t){switch(e){case`focusin`:case`focusout`:gp=null;break;case`dragenter`:case`dragleave`:_p=null;break;case`mouseover`:case`mouseout`:vp=null;break;case`pointerover`:case`pointerout`:yp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:bp.delete(t.pointerId)}}function wp(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=st(t),t!==null&&ap(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Tp(e,t,n,r,i){switch(t){case`focusin`:return gp=wp(gp,e,t,n,r,i),!0;case`dragenter`:return _p=wp(_p,e,t,n,r,i),!0;case`mouseover`:return vp=wp(vp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return yp.set(a,wp(yp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,bp.set(a,wp(bp.get(a)||null,e,t,n,r,i)),!0}return!1}function Ep(e){var t=ot(e.target);if(t!==null){var n=l(t);if(n!==null){if(t=n.tag,t===13){if(t=u(n),t!==null){e.blockedOn=t,Ye(e.priority,function(){op(n)});return}}else if(t===31){if(t=d(n),t!==null){e.blockedOn=t,Ye(e.priority,function(){op(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Dp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=dp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Gt=r,n.target.dispatchEvent(r),Gt=null}else return t=st(n),t!==null&&ap(t),e.blockedOn=n,!1;t.shift()}return!0}function Op(e,t,n){Dp(e)&&n.delete(t)}function kp(){hp=!1,gp!==null&&Dp(gp)&&(gp=null),_p!==null&&Dp(_p)&&(_p=null),vp!==null&&Dp(vp)&&(vp=null),yp.forEach(Op),bp.forEach(Op)}function Ap(e,n){e.blockedOn===n&&(e.blockedOn=null,hp||(hp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,kp)))}var jp=null;function Mp(e){jp!==e&&(jp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){jp===e&&(jp=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(pp(r||n)===null)continue;break}var a=st(n);a!==null&&(e.splice(t,3),t-=3,bs(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Np(e){function t(t){return Ap(t,e)}gp!==null&&Ap(gp,e),_p!==null&&Ap(_p,e),vp!==null&&Ap(vp,e),yp.forEach(t),bp.forEach(t);for(var n=0;n<xp.length;n++){var r=xp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<xp.length&&(n=xp[0],n.blockedOn===null);)Ep(n),n.blockedOn===null&&xp.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[Qe]||null;if(typeof a==`function`)o||Mp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[Qe]||null)s=o.formAction;else if(pp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Mp(n)}}}function Pp(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Fp(e){this._internalRoot=e}Ip.prototype.render=Fp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(s(409));var n=t.current;np(n,uu(),e,t,null,null)},Ip.prototype.unmount=Fp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;np(e.current,2,null,e,null,null),_u(),t[$e]=null}};function Ip(e){this._internalRoot=e}Ip.prototype.unstable_scheduleHydration=function(e){if(e){var t=Je();e={blockedOn:null,target:e,priority:t};for(var n=0;n<xp.length&&t!==0&&t<xp[n].priority;n++);xp.splice(n,0,e),n===0&&Ep(e)}};var Lp=r.version;if(Lp!==`19.2.4`)throw Error(s(527,Lp,`19.2.4`));L.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(s(188)):(e=Object.keys(e).join(`,`),Error(s(268,e)));return e=p(t),e=e===null?null:m(e),e=e===null?null:e.stateNode,e};var Rp={bundleType:0,version:`19.2.4`,rendererPackageName:`react-dom`,currentDispatcherRef:I,reconcilerVersion:`19.2.4`};
vendor: 5,422 bytes, lines 9-37
9if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var zp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!zp.isDisabled&&zp.supportsFiber)try{Te=zp.inject(Rp),Ee=zp}catch{}}e.createRoot=function(e,t){if(!c(e))throw Error(s(299));var n=!1,r=``,i=Vs,a=Hs,o=X;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(i=t.onUncaughtError),t.onCaughtError!==void 0&&(a=t.onCaughtError),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=ep(e,1,!1,null,null,n,r,null,i,a,o,Pp),e[$e]=t.current,xd(e),new Fp(t)}})),c=e(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=s()})),l=n(),u=c(),d=e((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),f=e(((e,t)=>{t.exports=d()}))();function p({className:e=``,style:t}){return(0,f.jsx)(`svg`,{viewBox:`0 0 1280 297`,xmlns:`http://www.w3.org/2000/svg`,className:e,style:t,fill:`none`,children:(0,f.jsxs)(`g`,{children:[(0,f.jsxs)(`g`,{children:[(0,f.jsx)(`path`,{fill:`#2AA9E0`,d:`M230.303,0.687c24.045,31.517,47.996,63.106,72.007,94.657c-24.004,31.554-47.996,63.125-72.007,94.684 10 c0-15.641-0.006-31.278,0.006-46.919c-48.119-0.037-96.238-0.007-144.357-0.02c0.062-16.956,1.305-33.959,4.607-50.609 11 c2.064-9.897,4.783-19.818,9.791-28.671c3.136-5.476,7.429-10.638,13.333-13.202c2.917-1.296,6.14-1.732,9.309-1.664 12 c35.771,0.021,71.54,0,107.311,0.005C230.303,32.862,230.309,16.775,230.303,0.687`}),(0,f.jsx)(`path`,{fill:`#2AA9E0`,d:`M879.185,32.583c12.62-2.042,25.986-0.548,37.499,5.156c9.67,4.79,17.506,12.966,22.182,22.664 13 c6.064,12.198,7.104,26.297,5.6,39.663c-1.55,13.226-7.388,26.286-17.59,35.081c-8.929,7.786-20.747,11.599-32.438,12.36 14 c-13.183,0.896-26.956-1.94-37.893-9.587c-8.679-5.991-15.009-14.979-18.496-24.865c-3.878-11.074-4.37-23.123-2.856-34.685 15 c1.9-13.381,8.535-26.271,19.101-34.841C861.402,37.7,870.168,34.125,879.185,32.583 M885.698,53.983 16 c-8.65,0.869-16.474,6.447-20.491,14.098c-4.537,8.469-5.537,18.427-4.594,27.867c0.858,8.25,3.801,16.669,9.921,22.5 17 c7.809,7.542,20.124,8.921,30.059,5.253c5.198-1.978,9.662-5.724,12.599-10.436c4.406-6.936,6.018-15.3,5.97-23.422 18 c0.054-7.379-1.22-14.917-4.673-21.506c-2.389-4.572-5.992-8.557-10.518-11.073C898.467,54.127,891.92,53.291,885.698,53.983`}),(0,f.jsx)(`path`,{fill:`#2AA9E0`,d:`M974.27,35.887c8.578-1.715,17.315-2.433,26.041-2.759c12.324-0.436,25.001,0.086,36.646,4.526 19 c6.072,2.346,11.882,5.976,15.707,11.356c4.279,5.882,5.889,13.313,5.842,20.49c0.048,6.629-1.304,13.537-5.274,18.979 20 c-3.839,5.323-9.485,9.062-15.476,11.569c10.931,13.936,19.847,29.345,27.548,45.262c-9.379,0.156-18.757,0.04-28.133,0.062 21 c-7.761-13.942-15.482-28.057-25.537-40.517c-4.092-0.022-8.176-0.008-12.252-0.008c-0.008,13.508-0.008,27.025,0,40.53 22 c-8.375,0.008-16.74,0-25.104,0.008C974.264,108.878,974.276,72.382,974.27,35.887 M999.382,54.879 23 c-0.007,10.007-0.017,20.023,0,30.03c8.254-0.062,16.806,0.476,24.716-2.368c3.679-1.27,6.805-4.214,7.844-8.02 24 c1.199-4.531,1.025-9.864-1.934-13.705c-2.423-3.066-6.306-4.452-9.975-5.312C1013.247,54.038,1006.238,54.221,999.382,54.879`}),(0,f.jsx)(`path`,{fill:`#2AA9E0`,d:`M352.52,34.273c6.872,0.034,13.753-0.068,20.626,0.062c18.874,19.996,34.685,42.609,50.1,65.311 25 c0.02-21.794,0-43.579,0.006-65.372h24.844c0.009,37.04,0,74.07,0,111.101c-7.013,0.007-14.022-0.005-21.037,0.007 26 c-14.533-25.516-30.601-50.302-49.762-72.617c-0.026,24.202-0.007,48.411-0.014,72.61c-8.256,0.009-16.515,0.009-24.764,0V34.273z 27 `}),(0,f.jsx)(`path`,{fill:`#2AA9E0`,d:`M476.514,34.273c25.023,0.007,50.04-0.008,75.063,0.007c-0.022,7.043,0.021,14.078-0.022,21.121 28 c-16.644-0.012-33.286,0-49.931-0.007c-0.014,7.207-0.006,14.42-0.006,21.623c14.784,0.008,29.568,0,44.351,0 29 c0.01,6.874,0,13.739,0.01,20.606c-14.792,0.012-29.577,0-44.36,0.007v26.719c17.897,0,35.791-0.007,53.681,0 30 c0.006,7.008,0,14.019,0,21.025c-26.257,0.009-52.521,0-78.786,0.009V34.273H476.514z`}),(0,f.jsx)(`path`,{fill:`#2AA9E0`,d:`M569.638,34.28c30.7-0.007,61.402,0,92.102-0.007c-0.007,7.132,0.022,14.261-0.021,21.386 31 c-11.163-0.027-22.321-0.007-33.476-0.007c-0.007,29.906-0.007,59.816,0,89.722c-8.373,0.007-16.739,0-25.105,0 32 c-0.014-29.907,0.017-59.823-0.014-89.729c-11.167,0.005-22.329,0-33.49,0C569.63,48.521,569.638,41.405,569.638,34.28`}),(0,f.jsx)(`path`,{fill:`#2AA9E0`,d:`M672.26,34.238c9.043,0.081,18.087,0.016,27.13,0.035c3.232,18.795,6.907,37.506,10.979,56.131 33 c1.611,7.179,3.25,14.355,5.272,21.426c7.701-21.515,13.587-43.625,19.509-65.684c7.137,0.007,14.274-0.008,21.41,0.007 34 c6.277,21.97,12.474,43.973,19.779,65.622c6.655-25.519,10.986-51.556,15.584-77.497c8.692-0.007,17.376-0.007,26.067,0 35 c-7.694,37.494-16.852,74.743-28.863,111.101c-7.661-0.007-15.313,0-22.966-0.007c-7.959-21.681-14.442-43.871-21.224-65.946 36 c-6.806,22.038-12.998,44.276-20.945,65.938c-7.659,0.024-15.313,0.008-22.973,0.008 37 C689.053,109.001,679.812,71.767,672.26,34.238`}),(0,f.jsx)(`path`,{fill:`#2AA9E0`,d:`M1086.824,34.273c8.368,0.007,16.725,0,25.1,0c0.013,13.848-0.022,27.696,0.013,41.545
38 c13.028-13.468,25.377-27.577,37.853-41.545c9.941,0,19.877,0.007,29.814,0c-14.816,17.798-30.644,34.731-46.959,51.151 39 c20.07,16.679,35.663,38.011,49.49,59.965c-9.947-0.017-19.893-0.022-29.834,0c-5.785-9.141-12.284-17.805-19.245-26.073 40 c-6.434-7.528-13.293-14.759-21.122-20.852c-0.015,15.64,0,31.277-0.008,46.915c-8.373-0.007-16.739-0.007-25.104,0 41 C1086.816,108.344,1086.81,71.307,1086.824,34.273`})]}),(0,f.jsxs)(`g`,{children:[(0,f.jsx)(`path`,{fill:`currentColor`,d:`M-1.07,202.683c24.039-31.497,47.901-63.122,72.001-94.568c0.034,15.61,0.006,31.228,0.014,46.843 42 c48.119,0.021,96.237-0.007,144.357,0.013c-0.125,16.793-1.291,33.633-4.526,50.129c-2.036,9.898-4.722,19.81-9.641,28.704 43 c-2.844,5.037-6.561,9.824-11.685,12.699c-3.072,1.739-6.602,2.605-10.129,2.598c-36.123,0.008-72.254-0.012-108.376,0.008 44 c-0.014,16.071,0.034,32.137-0.027,48.202C46.839,265.829,22.901,234.245-1.07,202.683`}),(0,f.jsx)(`path`,{fill:`currentColor`,d:`M1056.727,169.367c11.345-7.877,25.557-10.678,39.181-9.973c10.823,0.624,21.78,3.091,31.203,8.608 45 c-2.458,6.977-4.966,13.931-7.449,20.892c-6.097-3.12-12.697-5.36-19.504-6.251c-6.123-0.739-12.46-0.95-18.416,0.863 46 c-5.767,1.566-10.954,5.13-14.473,9.951c-4.227,5.753-6.337,12.831-6.837,19.894c-0.506,7.498-0.02,15.165,2.281,22.363 47 c1.962,6.105,5.886,11.676,11.384,15.081c4.866,3.167,10.68,4.545,16.444,4.778c10.665,0.389,21.541-1.512,31.101-6.396 48 c2.389,6.871,4.703,13.771,7.125,20.631c-11.758,6.609-25.559,8.679-38.896,8.632c-12.565-0.077-25.655-2.634-35.922-10.253 49 c-10.471-7.64-16.764-19.874-19.005-32.445c-2.049-11.67-2.172-23.841,0.765-35.37 50 C1038.956,188.088,1046.156,176.607,1056.727,169.367`}),(0,f.jsx)(`path`,{fill:`currentColor`,d:`M1169.27,160.485c15.686-2.883,32.328-0.683,46.535,6.657c-2.374,6.838-4.973,13.601-7.402,20.421 51 c-6.526-3.222-13.51-5.896-20.855-6.159c-5.448-0.211-11.23-0.359-16.283,1.975c-3.617,1.623-5.374,5.822-4.765,9.614 52 c0.34,4.016,3.768,6.785,7.05,8.597c5.807,3.147,12.279,4.764,18.345,7.342c8.501,3.487,17.548,7.219,23.313,14.745 53 c5.178,6.633,6.362,15.429,5.964,23.604c-0.325,7.137-2.917,14.305-7.952,19.471c-7.47,7.825-18.576,10.567-29.01,11.379 54 c-15.727,1.099-32.257-0.698-46.232-8.441c2.387-6.812,4.906-13.576,7.179-20.424c6.96,3.288,14.309,6.036,22.038,6.733 55 c5.842,0.507,11.81,0.855,17.602-0.359c3.284-0.787,6.805-2.232,8.576-5.306c2.069-4.057,1.704-9.499-1.549-12.845 56 c-3.012-3.128-7.109-4.83-10.992-6.563c-9.939-4.103-20.841-6.57-29.433-13.346c-5.782-4.547-10.13-11.208-11.052-18.591 57 c-1.009-7.545-0.013-15.572,3.914-22.198C1149.43,167.745,1159.281,162.413,1169.27,160.485`}),(0,f.jsx)(`path`,{fill:`currentColor`,d:`M351.651,163.363c8.984-1.602,18.087-2.297,27.2-2.591c13.191-0.545,26.689,0.195,39.224,4.66 58 c10.299,3.673,19.662,10.502,25.335,19.963c7.107,11.499,8.718,25.477,8.026,38.741c-0.599,12.145-4.405,24.439-12.391,33.794 59 c-7.088,8.411-17.171,13.823-27.71,16.592c-15.211,4.126-31.169,3.346-46.714,2.101c-4.323-0.588-8.895-0.813-12.987-2.178 60 C351.563,237.42,351.535,200.39,351.651,163.363 M377.244,183.161c0.047,23.959,0.095,47.917-0.021,71.873 61 c10.131,0.874,20.857,0.874,30.282-3.456c7.985-3.631,13.645-11.265,15.856-19.637c2.151-8.149,2.077-16.833,0.407-25.063 62 c-1.716-8.275-6.666-16.229-14.435-20.015C399.438,182.015,387.963,182.104,377.244,183.161`}),(0,f.jsx)(`path`,{fill:`currentColor`,d:`M464.396,161.931c10.004,0.007,20.003-0.081,30.003,0.05c7.038,16.073,15.322,31.576,24.229,46.68 63 c8.971-15.165,17.536-30.606,24.684-46.723c9.479-0.039,18.963-0.012,28.442-0.012c-11.74,23.231-24.883,45.743-38.874,67.687 64 c-0.724,1.293-1.993,2.482-1.842,4.091c0.032,14.14-0.023,28.277,0.032,42.419c-8.604,0.09-17.208,0.016-25.805,0.035 65 c-0.053-14.42,0.095-28.853-0.073-43.265C490.688,209.786,476.689,186.311,464.396,161.931`}),(0,f.jsx)(`path`,{fill:`currentColor`,d:`M588.479,161.911c6.968,0,13.942,0.039,20.911-0.022c6.807,6.798,12.898,14.262,18.901,21.774 66 c11.624,14.598,22.351,29.901,32.718,45.421c0.128-22.393,0.006-44.782,0.061-67.166c8.533,0.008,17.071-0.007,25.606,0v114.238 67 c-7.232-0.022-14.465,0.055-21.691-0.035c-9.813-17.477-20.538-34.459-32.256-50.729c-5.987-8.128-12.092-16.202-18.808-23.747 68 c-0.022,24.836-0.022,49.658,0,74.492c-8.482,0.059-16.964,0-25.443,0.026C588.458,238.079,588.458,199.995,588.479,161.911`}),(0,f.jsx)(`path`,{fill:`currentColor`,d:`M748.317,161.985c8.162-0.153,16.333-0.027,24.5-0.06
687c17.716,37.035,32.217,75.495,45.697,114.245 69 c-9.201-0.007-18.4-0.007-27.601,0c-2.684-8.307-5.619-16.522-8.497-24.767c-14.825,0.008-29.655-0.031-44.479,0.023 70 c-2.81,8.25-5.732,16.45-8.402,24.743c-8.921-0.05-17.85,0.074-26.771-0.062C716.355,237.462,730.611,198.965,748.317,161.985 71 M760.048,188.149c-5.332,14.294-10.963,28.481-16.233,42.802h32.5C771.259,216.551,765.979,202.208,760.048,188.149`}),(0,f.jsx)(`path`,{fill:`currentColor`,d:`M838.83,161.918c8.229,0.047,16.465-0.089,24.696,0.067c11.54,21.958,21.19,44.835,30.813,67.682 72 c4.991-10.824,9.289-21.957,14.244-32.807c5.277-11.781,10.726-23.489,16.777-34.902c7.831-0.102,15.659,0,23.497-0.047 73 c4.369,30.52,6.043,61.334,7.911,92.087c0.41,7.375,0.813,14.755,1.173,22.139c-8.371,0.054-16.752,0.007-25.124,0.021 74 c-0.807-25.172-1.574-50.364-3.794-75.465c-8.894,20.261-17.368,40.703-26.215,60.984c-5.986-0.037-11.969-0.016-17.952-0.016 75 c-8.765-20.246-17.274-40.607-26.108-60.825c-2.423,25.029-2.964,50.201-3.894,75.319c-8.37-0.016-16.744,0.037-25.118-0.027 76 C831.895,238.005,833.55,199.773,838.83,161.918`}),(0,f.jsx)(`path`,{fill:`currentColor`,d:`M983.605,161.918c8.554-0.007,17.117,0.008,25.687,0c0.04,38.056-0.04,76.12,0.04,114.184 77 c-8.578,0.133-17.159,0.02-25.728,0.055C983.6,238.079,983.605,200.003,983.605,161.918`}),(0,f.jsx)(`path`,{fill:`currentColor`,d:`M1254.192,233.119c6.551-1.541,13.884-0.015,18.974,4.483c8.623,7.67,9.174,22.408,1.621,30.996 78 c-7.226,8.305-21.257,8.968-29.394,1.629c-7.238-6.358-8.719-17.654-4.783-26.198 79 C1243.094,238.514,1248.297,234.416,1254.192,233.119 M1255.057,236.213c-2.771,0.65-5.394,1.989-7.449,3.956 80 c-6.973,6.846-7.228,19.222-0.87,26.556c6.227,7.117,18.604,7.164,24.937,0.148c6.211-7.021,6.248-18.763,0.106-25.838 81 C1267.691,236.402,1260.938,234.876,1255.057,236.213`}),(0,f.jsx)(`path`,{fill:`currentColor`,d:`M1250.85,242.651c4.547-0.663,9.526-1.263,13.803,0.849c3.486,1.696,4.328,6.669,2.189,9.724 82 c-0.855,1.255-2.262,1.939-3.507,2.717c2.459,2.989,4.526,6.296,6.361,9.708c-1.316,0-2.618-0.
82026-3.915-0.047 83 c-1.798-3.217-3.875-6.264-6.129-9.168c-1.781-0.041-3.569-0.041-5.332-0.033c-0.014,3.084-0.007,6.159-0.007,9.241h-3.473 84 C1250.844,257.972,1250.828,250.312,1250.85,242.651 M1254.283,245.128c0.054,2.85,0.027,5.705,0.041,8.556 85 c2.667-0.066,5.511,0.299,8.014-0.86c2.382-1.142,2.638-4.833,0.554-6.378C1260.443,244.614,1257.152,244.871,1254.283,245.128`})]})]})})}var m={};(function e(t,n,r,i){var a=!!(t.Worker&&t.Blob&&t.Promise&&t.OffscreenCanvas&&t.OffscreenCanvasRenderingContext2D&&t.HTMLCanvasElement&&t.HTMLCanvasElement.prototype.transferControlToOffscreen&&t.URL&&t.URL.createObjectURL),o=typeof Path2D==`function`&&typeof DOMMatrix==`function`,s=(function(){if(!t.OffscreenCanvas)return!1;try{var e=new OffscreenCanvas(1,1),n=e.getContext(`2d`);n.fillRect(0,0,1,1);var r=e.transferToImageBitmap();n.createPattern(r,`no-repeat`)}catch{return!1}return!0})();function c(){}function l(e){var r=n.exports.Promise,i=r===void 0?t.Promise:r;return typeof i==`function`?new i(e):(e(c,c),null)}var u=(function(e,t){return{transform:function(n){if(e)return n;if(t.has(n))return t.get(n);var r=new OffscreenCanvas(n.width,n.height);return r.getContext(`2d`).drawImage(n,0,0),t.set(n,r),r},clear:function(){t.clear()}}})(s,new Map),d=function(){var e=16,t,n,r={},i=0;return typeof requestAnimationFrame==`function`&&typeof cancelAnimationFrame==`function`?(t=function(t){var n=Math.random();return r[n]=requestAnimationFrame(function a(o){i===o||i+e-1<o?(i=o,delete r[n],t()):r[n]=requestAnimationFrame(a)}),n},n=function(e){r[e]&&cancelAnimationFrame(r[e])}):(t=function(t){return setTimeout(t,e)},n=function(e){return clearTimeout(e)}),{frame:t,cancel:n}}(),f=(function(){var t,n,i={};function o(e){function t(t,n){e.postMessage({options:t||{},callback:n})}e.init=function(t){var n=t.transferControlToOffscreen();e.postMessage({canvas:n},[n])},e.fire=function(r,a,o){if(n)return t(r,null),n;var s=Math.random().toString(36).slice(2);return n=l(function(a){function c(t){t.data.callback===s&&(delete i[s],e.removeEventListener(`message`,c),n=null,u.clear(),o(),a())}e.addEventListener(`message`,c),t(r,s),i[s]=c.bind(null,{data:{callback:s}})}),n},e.reset=function(){for(var t in e.postMessage({reset:!0}),i)i[t](),delete i[t]}}return function(){if(t)return t;if(!r&&a){var n=[`var CONFETTI, SIZE = {}, module = {};`,`(`+e.toString()+`)(this, module, true, SIZE);`,`onmessage = function(msg) {`,` if (msg.data.options) {`,` CONFETTI(msg.data.options).then(function () {`,` if (msg.data.callback) {`,` postMessage({ callback: msg.data.callback });`,` }`,` });`,` } else if (msg.data.reset) {`,` CONFETTI && CONFETTI.reset();`,` } else if (msg.data.resize) {`,` SIZE.width = msg.data.resize.width;`,` SIZE.height = msg.data.resize.height;`,` } else if (msg.data.canvas) {`,` SIZE.width = msg.data.canvas.width;`,` SIZE.height = msg.data.canvas.height;`,` CONFETTI = module.exports.create(msg.data.canvas);`,` }`,`}`].join(` 86`);try{t=new Worker(URL.createObjectURL(new Blob([n])))}catch(e){return typeof console<`u`&&typeof console.warn==`function`&&console.warn(`ð Could not load worker`,e),null}o(t)}return t}})(),p={particleCount:50,angle:90,spread:45,startVelocity:45,decay:.9,gravity:1,drift:0,ticks:200,x:.5,y:.5,shapes:[`square`,`circle`],zIndex:100,colors:[`#26ccff`,`#a25afd`,`#ff5e7e`,`#88ff5a`,`#fcff42`,`#ffa62d`,`#ff36ff`],disableForReducedMotion:!1,scalar:1};function m(e,t){return t?t(e):e}function h(e){return e!=null}function g(e,t,n){return m(e&&h(e[t])?e[t]:p[t],n)}function _(e){return e<0?0:Math.floor(e)}function v(e,t){return Math.floor(Math.random()*(t-e))+e}function y(e){return parseInt(e,16)}function b(e){return e.map(x)}function x(e){var t=String(e).replace(/[^0-9a-f]/gi,``);return t.length<6&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),{r:y(t.substring(0,2)),g:y(t.substring(2,4)),b:y(t.substring(4,6))}}function S(e){var t=g(e,`origin`,Object);return t.x=g(t,`x`,Number),t.y=g(t,`y`,Number),t}function C(e){e.width=document.documentElement.clientWidth,e.height=document.documentElement.clientHeight}function w(e){var t=e.getBoundingClientRect();e.width=t.width,e.height=t.height}function T(e){var t=document.createElement(`canvas`);return t.style.position=`fixed`,t.style.top=`0px`,t.style.left=`0px`,t.style.pointerEvents=`none`,t.style.zIndex=e,t}function E(e,t,n,r,i,a,o,s,c){e.save(),e.translate(t,n),e.rotate(a),e.scale(r,i),e.arc(0,0,1,o,s,c),e.restore(
vendor: 4,784 bytes, line 86
86)}function D(e){var t=e.angle*(Math.PI/180),n=e.spread*(Math.PI/180);return{x:e.x,y:e.y,wobble:Math.random()*10,wobbleSpeed:Math.min(.11,Math.random()*.1+.05),velocity:e.startVelocity*.5+Math.random()*e.startVelocity,angle2D:-t+(.5*n-Math.random()*n),tiltAngle:(Math.random()*.5+.25)*Math.PI,color:e.color,shape:e.shape,tick:0,totalTicks:e.ticks,decay:e.decay,drift:e.drift,random:Math.random()+2,tiltSin:0,tiltCos:0,wobbleX:0,wobbleY:0,gravity:e.gravity*3,ovalScalar:.6,scalar:e.scalar,flat:e.flat}}function O(e,t){t.x+=Math.cos(t.angle2D)*t.velocity+t.drift,t.y+=Math.sin(t.angle2D)*t.velocity+t.gravity,t.velocity*=t.decay,t.flat?(t.wobble=0,t.wobbleX=t.x+10*t.scalar,t.wobbleY=t.y+10*t.scalar,t.tiltSin=0,t.tiltCos=0,t.random=1):(t.wobble+=t.wobbleSpeed,t.wobbleX=t.x+10*t.scalar*Math.cos(t.wobble),t.wobbleY=t.y+10*t.scalar*Math.sin(t.wobble),t.tiltAngle+=.1,t.tiltSin=Math.sin(t.tiltAngle),t.tiltCos=Math.cos(t.tiltAngle),t.random=Math.random()+2);var n=t.tick++/t.totalTicks,r=t.x+t.random*t.tiltCos,i=t.y+t.random*t.tiltSin,a=t.wobbleX+t.random*t.tiltCos,s=t.wobbleY+t.random*t.tiltSin;if(e.fillStyle=`rgba(`+t.color.r+`, `+t.color.g+`, `+t.color.b+`, `+(1-n)+`)`,e.beginPath(),o&&t.shape.type===`path`&&typeof t.shape.path==`string`&&Array.isArray(t.shape.matrix))e.fill(N(t.shape.path,t.shape.matrix,t.x,t.y,Math.abs(a-r)*.1,Math.abs(s-i)*.1,Math.PI/10*t.wobble));else if(t.shape.type===`bitmap`){var c=Math.PI/10*t.wobble,l=Math.abs(a-r)*.1,d=Math.abs(s-i)*.1,f=t.shape.bitmap.width*t.scalar,p=t.shape.bitmap.height*t.scalar,m=new DOMMatrix([Math.cos(c)*l,Math.sin(c)*l,-Math.sin(c)*d,Math.cos(c)*d,t.x,t.y]);m.multiplySelf(new DOMMatrix(t.shape.matrix));var h=e.createPattern(u.transform(t.shape.bitmap),`no-repeat`);h.setTransform(m),e.globalAlpha=1-n,e.fillStyle=h,e.fillRect(t.x-f/2,t.y-p/2,f,p),e.globalAlpha=1}else if(t.shape===`circle`)e.ellipse?e.ellipse(t.x,t.y,Math.abs(a-r)*t.ovalScalar,Math.abs(s-i)*t.ovalScalar,Math.PI/10*t.wobble,0,2*Math.PI):E(e,t.x,t.y,Math.abs(a-r)*t.ovalScalar,Math.abs(s-i)*t.ovalScalar,Math.PI/10*t.wobble,0,2*Math.PI);else if(t.shape===`star`)for(var g=Math.PI/2*3,_=4*t.scalar,v=8*t.scalar,y=t.x,b=t.y,x=5,S=Math.PI/x;x--;)y=t.x+Math.cos(g)*v,b=t.y+Math.sin(g)*v,e.lineTo(y,b),g+=S,y=t.x+Math.cos(g)*_,b=t.y+Math.sin(g)*_,e.lineTo(y,b),g+=S;else e.moveTo(Math.floor(t.x),Math.floor(t.y)),e.lineTo(Math.floor(t.wobbleX),Math.floor(i)),e.lineTo(Math.floor(a),Math.floor(s)),e.lineTo(Math.floor(r),Math.floor(t.wobbleY));return e.closePath(),e.fill(),t.tick<t.totalTicks}function k(e,t,n,a,o){var s=t.slice(),c=e.getContext(`2d`),f,p,m=l(function(t){function l(){f=p=null,c.clearRect(0,0,a.width,a.height),u.clear(),o(),t()}function m(){r&&!(a.width===i.width&&a.height===i.height)&&(a.width=e.width=i.width,a.height=e.height=i.height),!a.width&&!a.height&&(n(e),a.width=e.width,a.height=e.height),c.clearRect(0,0,a.width,a.height),s=s.filter(function(e){return O(c,e)}),s.length?f=d.frame(m):l()}f=d.frame(m),p=l});return{addFettis:function(e){return s=s.concat(e),m},canvas:e,promise:m,reset:function(){f&&d.cancel(f),p&&p()}}}function A(e,n){var r=!e,i=!!g(n||{},`resize`),o=!1,s=g(n,`disableForReducedMotion`,Boolean),c=a&&g(n||{},`useWorker`)?f():null,u=r?C:w,d=e&&c?!!e.__confetti_initialized:!1,p=typeof matchMedia==`function`&&matchMedia(`(prefers-reduced-motion)`).matches,m;function h(t,n,r){for(var i=g(t,`particleCount`,_),a=g(t,`angle`,Number),o=g(t,`spread`,Number),s=g(t,`startVelocity`,Number),c=g(t,`decay`,Number),l=g(t,`gravity`,Number),d=g(t,`drift`,Number),f=g(t,`colors`,b),p=g(t,`ticks`,Number),h=g(t,`shapes`),y=g(t,`scalar`),x=!!g(t,`flat`),C=S(t),w=i,T=[],E=e.width*C.x,O=e.height*C.y;w--;)T.push(D({x:E,y:O,angle:a,spread:o,startVelocity:s,color:f[w%f.length],shape:h[v(0,h.length)],ticks:p,decay:c,gravity:l,drift:d,scalar:y,flat:x}));return m?m.addFettis(T):(m=k(e,T,u,n,r),m.promise)}function y(n){var a=s||g(n,`disableForReducedMotion`,Boolean),f=g(n,`zIndex`,Number);if(a&&p)return l(function(e){e()});r&&m?e=m.canvas:r&&!e&&(e=T(f),document.body.appendChild(e)),i&&!d&&u(e);var _={width:e.width,height:e.height};c&&!d&&c.init(e),d=!0,c&&(e.__confetti_initialized=!0);function v(){if(c){var t={getBoundingClientRect:function(){if(!r)return e.getBoundingClientRect()}};u(t),c.postMessage({resize:{width:t.width,height:t.height}});return}_.width=_.height=null}function y(){m=null,i&&(o=!1,t.removeEventListener(`resize`,v)),r&&e&&(document.body.contains(e)&&document.body.removeChild(e),e=null,d=!1)}return i&&!o&&(o=!0,t.addEventListener(`resize`,v,!1)),c?c.fire(n,_,y):h(n,_,y)}return y.reset=function(){c&&c.reset(),m&&m.reset()},y}var j;function M(){return j||=A(null,{useWorker:!0,resize:!0}),j}function N(e,t,n,r,i,a,o){var s=new Path2D(e),c=new Path2D;c.addPath(s,new DOMMatrix(t));var l=new Path2D;
86return l.addPath(c,new DOMMatrix([Math.cos(o)*i,Math.sin(o)*i,-Math.sin(o)*a,Math.cos(o)*a,n,r])),l}function P(e){if(!o)throw Error(`path confetti are not supported in this browser`);var t,n;typeof e==`string`?t=e:(t=e.path,n=e.matrix);var r=new Path2D(t),i=document.createElement(`canvas`).getContext(`2d`);if(!n){for(var a=1e3,s=a,c=a,l=0,u=0,d,f,p=0;p<a;p+=2)for(var m=0;m<a;m+=2)i.isPointInPath(r,p,m,`nonzero`)&&(s=Math.min(s,p),c=Math.min(c,m),l=Math.max(l,p),u=Math.max(u,m));d=l-s,f=u-c;var h=10,g=Math.min(h/d,h/f);n=[g,0,0,g,-Math.round(d/2+s)*g,-Math.round(f/2+c)*g]}return{type:`path`,path:t,matrix:n}}function F(e){var t,n=1,r=`#000000`,i=`"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", "EmojiOne Color", "Android Emoji", "Twemoji Mozilla", "system emoji", sans-serif`;typeof e==`string`?t=e:(t=e.text,n=`scalar`in e?e.scalar:n,i=`fontFamily`in e?e.fontFamily:i,r=`color`in e?e.color:r);var a=10*n,o=``+a+`px `+i,s=new OffscreenCanvas(a,a),c=s.getContext(`2d`);c.font=o;var l=c.measureText(t),u=Math.ceil(l.actualBoundingBoxRight+l.actualBoundingBoxLeft),d=Math.ceil(l.actualBoundingBoxAscent+l.actualBoundingBoxDescent),f=2,p=l.actualBoundingBoxLeft+f,m=l.actualBoundingBoxAscent+f;u+=f+f,d+=f+f,s=new OffscreenCanvas(u,d),c=s.getContext(`2d`),c.font=o,c.fillStyle=r,c.fillText(t,p,m);var h=1/n;return{type:`bitmap`,bitmap:s.transferToImageBitmap(),matrix:[h,0,0,h,-u*h/2,-d*h/2]}}n.exports=function(){return M().apply(this,arguments)},n.exports.reset=function(){M().reset()},n.exports.create=A,n.exports.shapeFromPath=P,n.exports.shapeFromText=F})((function(){return typeof window<`u`?window:typeof self<`u`?self:this||{}})(),m,!1);var h=m.exports;m.exports.create;var g=class{constructor(){this.lastTs=0,this.lastSuffix=1,this.backDict={},this.getKey=e=>{let t=!1,n=`__${e}`;if(!this.backDict[n]){t=!0;let e=Date.now()%10**11,r=e;r===this.lastTs?(r=r*1e4+this.lastSuffix,this.lastSuffix+=1):this.lastSuffix=1,this.backDict[n]=r,this.lastTs=e}return[this.backDict[n],t]}}},_=class{constructor(e){this.sendSetAttribute=(e,t,n)=>{if(this.isDictDisabled){let r=[12,e,t,n];return this.app.send(r)}else{let r=[35,e,this.applyDict(t),this.applyDict(n)];return this.app.send(r)}},this.app=e.app,this.isDictDisabled=e.isDictDisabled,this.dict=new g}applyDict(e){let[t,n]=this.dict.getKey(e);return n&&this.app.send([34,t,e]),t}clear(){this.dict=new g}},v=class{constructor(e,t){this.app=e,this.startParams=t,this.conditions=[],this.hasStarted=!1,this.createConditionFromFilter=e=>{let t=b(e);if(t.type)return t},this.durationInts=[]}setConditions(e){this.conditions=e}async fetchConditions(e,t){try{let{conditions:n}=await(await fetch(`${this.app.options.ingestPoint}/v1/web/conditions/${e}`,{method:`GET`,headers:{Authorization:`Bearer ${t}`}})).json(),r=[];n.forEach(e=>{e.filters.forEach(t=>{let n;t.type===`fetch`?(n={type:`network_request`,subConditions:[],name:e.name},t.filters.forEach(e=>{let t=this.createConditionFromFilter(e);t&&n.subConditions.push(t)})):n=this.createConditionFromFilter(t),n&&(n.type===`session_duration`&&this.processDuration(n.value[0],e.name),r.push({...n,name:e.name}))})}),this.conditions=r}catch{this.app.debug.error(`Critical: cannot fetch start conditions`)}}trigger(e){if(!this.hasStarted)try{this.hasStarted=!0,this.app.start(this.startParams,void 0,e)}catch(e){this.app.debug.error(e)}}processMessage(e){if(!this.hasStarted)switch(e[0]){case 78:this.jsExceptionEvent(e);break;case 27:this.customEvent(e);break;case 68:this.clickEvent(e);break;case 122:this.pageLocationEvent(e);break;case 83:this.networkRequest(e);break}}processFlags(e){let t=this.conditions.filter(e=>e.type===`feature_flag`);t.length&&t.forEach(t=>{let n=y[t.operator];n&&e.find(e=>n(e.key,t.value))&&this.trigger(t.name)})}clearDurationInt(e){clearInterval(e),this.durationInts=this.durationInts.filter(t=>t!==e)}processDuration(e,t){let n=setInterval(()=>{performance.now()>e&&(this.clearDurationInt(n),this.trigger(t))},1e3);this.durationInts.push(n),this.app.attachStopCallback(()=>this.clearDurationInt(n))}networkRequest(e){let t=this.conditions.filter(e=>e.type===`network_request`);t.length&&t.forEach(t=>{let n=t.subConditions.filter(e=>e.operator!==`isAny`);n.length?n.every(t=>{let n;switch(t.key){case`url`:n=e[3];break;case`status`:n=e[6];break;case`method`:n=e[2];break;case`duration`:n=e[8];break}let r=y[t.operator];if(r&&r(n,t.value))return!0}
86)&&this.trigger(t.name):n.length===0&&t.subConditions.length&&this.trigger(t.name)})}customEvent(e){let t=this.conditions.filter(e=>e.type===`custom_event`);t.length&&t.forEach(t=>{let n=y[t.operator];n&&(n(e[1],t.value)||n(e[2],t.value))&&this.trigger(t.name)})}clickEvent(e){let t=this.conditions.filter(e=>e.type===`click`);t.length&&t.forEach(t=>{let n=y[t.operator];n&&(n(e[3],t.value)||n(e[4],t.value))&&this.trigger(t.name)})}pageLocationEvent(e){let t=this.conditions.filter(e=>e.type===`visited_url`);t&&t.forEach(t=>{let n=y[t.operator];n&&n(e[1],t.value)&&this.trigger(t.name)})}jsExceptionEvent(e){let t=[e[1],e[2],e[3]],n=this.conditions.filter(e=>e.type===`exception`);n&&n.forEach(e=>{let n=y[e.operator];n&&t.some(t=>n(t,e.value))&&this.trigger(e.name)})}},y={is:(e,t)=>t.some(t=>e.includes(t)),isAny:()=>!0,isNot:(e,t)=>!t.some(t=>e.includes(t)),contains:(e,t)=>t.some(t=>e.includes(t)),notContains:(e,t)=>!t.some(t=>e.includes(t)),startsWith:(e,t)=>t.some(t=>e.startsWith(t)),endsWith:(e,t)=>t.some(t=>e.endsWith(t)),greaterThan:(e,t)=>e>t,greaterOrEqual:(e,t)=>e>=t,lessOrEqual:(e,t)=>e<=t,lessThan:(e,t)=>e<t},b=e=>{let t={on:`is`,notOn:`isNot`,">":`greaterThan`,"<":`lessThan`,"=":`is`,"<=":`lessOrEqual`,">=":`greaterOrEqual`},n=e=>{if(Object.keys(t).includes(e))return t[e]},r={type:``,operator:``,value:e.value,key:``};switch(e.type){case`click`:r={type:`click`,operator:n(e.operator),value:e.value,key:``};break;case`location`:r={type:`visited_url`,operator:e.operator,value:e.value,key:``};break;case`custom`:r={type:`custom_event`,operator:e.operator,value:e.value,key:``};break;case`metadata`:r={type:e.source===`featureFlag`?`feature_flag`:e.type,operator:e.operator,value:e.value,key:``};break;case`error`:r={type:`exception`,operator:e.operator,value:e.value,key:``};break;case`duration`:r={type:`session_duration`,value:e.value,key:``,operator:`is`};break;case`fetchUrl`:r={type:`network_request`,key:`url`,operator:e.operator,value:e.value};break;case`fetchStatusCode`:r={type:`network_request`,key:`status`,operator:n(e.operator),value:e.value};break;case`fetchMethod`:r={type:`network_request`,key:`method`,operator:n(e.operator),value:e.value};break;case`fetchDuration`:r={type:`network_request`,key:`duration`,operator:n(e.operator),value:e.value};break}return r},x={htmlmasked:`hidden`,masked:`obscured`},S=!(typeof window>`u`),C=S&&navigator.userAgent.match(/firefox|fxios/i),w=1e5,T=S?Date.now()-performance.now():0;function E(){T=Date.now()-performance.now()}function D(){return T}var O=S&&performance.now?()=>Math.round(performance.now()+T):()=>Date.now(),k=`repeat`in String.prototype?e=>`*`.repeat(e.length):e=>e.replace(/./g,`*`);function A(e){return e?e.trim().replace(/\s+/g,` `):``}function j(e){return e.startsWith(`https://`)||e.startsWith(`http://`)}var M=`https://docs.openreplay.com`,N={};function P(e,t,n=`/`){N[e]||(console.warn(`OpenReplay: ${e} is deprecated. ${t?`Please, use ${t} instead.`:``} Visit ${M}${n} for more information.`),N[e]=!0)}function F(e,t){if(!t||t.length===0)return``;let n=[];for(let r of t){let t=e.getAttribute(r);t!==null&&n.push(`[${r}=${t}]`)}return n.join(``)}function I(e){return!e.classList||e.classList.length===0?``:`.`+Array.from(e.classList).join(`.`)}function L(e){let t=e.getAttribute(`data-openreplay-label`);return t===null?(t=e.getAttribute(`data-asayer-label`),t!==null&&P(`"data-asayer-label" attribute`,`"data-openreplay-label" attribute`,`/`),t):t}function R(e,t){let n=`data-openreplay-${t}`;return e.hasAttribute(n)?(x[t]&&P(`"${n}" attribute`,`"${x[t]}" attribute`,`/en/sdk/sanitize-data`),!0):!1}function z(e){try{return!!e.contentDocument}catch{return!1}}function B(e){try{return e instanceof HTMLIFrameElement?e.contentDocument:e instanceof Window?e.document:e instanceof Document?e.defaultView:`nodeType`in e?e.nodeType:`addEventListener`in e&&e.addEventListener,!0}catch(e){if(e instanceof DOMException&&e.name===`SecurityError`)return!1}return!0}function V(e){return e.toString(16).padStart(2,`0`)}function H(e){let t=new Uint8Array(e/2),n=window.crypto||window.msCrypto;return n?(n.getRandomValues(t),Array.from(t,V).join(``)):Array.from({length:e},()=>V(Math.floor(Math.random()*16))).join(``)}function U(){try{return window.self&&window.top&&window.self!==window.top}catch{return!0}}function W(e){return window.Zone&&`__symbol__`in window.Zone?window.Zone.__symbol__(e):e}function G(e,t){if(t)return new MutationObserver(e);{let t=W(`MutationObserver`);return new window[t](e)}}function ee(e,t,n,r,i){if(!B(e))return;let a=`addEventListener`;i||(a=W(`addEventListener`));try{e[a]?e[a](t,n,r):e.addEventListener(t,n,r)}catch(n){let r=n.message;console.error(`Openreplay: ${r}; if this error is caused by an IframeObserver, ignore it`,t,e)}}function te(e,t,n,r,i){if(!B(e))return;let a=`removeEventListener`;i||(a=W(`removeEventListener`));try{e[a]?e[a](t,n,r):e.removeEventListener(t,n,r)}catch(n){let r=n.message;console.error(`Openreplay: ${r}; if this error is caused by an IframeObserver, ignore it`,t,e)}}var ne=new class{constructor(){this.taskQueue=[],this.isRunning=!1}addTask(e){this.taskQueue.push(e),this.runTasks()}runTasks(){if(this.isRunning||this.taskQueue.length===0)return;this.isRunning=!0;let e=()=>{if(this.taskQueue.length===0){this.isRunning=!1;return}let t=this.taskQueue.shift();Promise.resolve(t()).then(()=>{requestAnimationFrame(()=>e())})};e()}};function re(e){ne.addTask(e)}function K(e,t){let n={...e};for(let r in t)if(t.hasOwnProperty(r)){let i=t[r],a=e[r];typeof i==`object`&&!Array.isArray(i)&&i!==null?n[r]=K(a||{},i):n[r]=i}return n}function ie(e,t){let n=new Map,r=new Map,i=new Map,a=function(a,...o){let s=Date.now(),c=t-(s-(n.get(a)??0));if(i.set(a,o),c<=0)r.has(a)&&(clearTimeout(r.get(a)),r.delete(a)),n.set(a,s),i.delete(a),e(a,...o);else if(!r.has(a)){let t=setTimeout(()=>{r.delete(a);let t=i.get(a);i.delete(a),n.delete(a),e(a,...t)},c);r.set(a,t)}};return a.clear=()=>{for(let e of r.values())clearTimeout(e);r.clear(),i.clear(),n.clear()},a}function q(e){return[0,e]}function ae(e,t){return[5,e,t]}function oe(e,t){return[6,e,t]}function se(){return[7]}function ce(e,t,n,r,i){return[8,e,t,n,r,i]}function le(e,t,n){return[9,e,t,n]}function ue(e,t,n){return[10,e,t,n]}function de(e){return[11,e]}function fe(e,t,n){return[12,e,t,n]}function pe(e,t){return[13,e,t]}function me(e,t){return[14,e,t]}function he(e,t,n){return[16,e,t,n]}function ge(e,t,n){return[18,e,t,n]}function _e(e,t){return[19,e,t]}function ve(e,t){return[20,e,t]}function ye(e,t){return[22,e,t]}function be(e,t,n,r,i,a,o,s,c){return[23,e,t,n,r,i,a,o,s,c]}function xe(e,t,n){return[24,e,t,n]}function Se(e,t){return[27,e,t]}function Ce(e){return[28,e]}function we(e){return[29,e]}function Te(e,t){return[30,e,t]}function Ee(e,t){return[36,e,t]}function De(e,t,n,r){return[49,e,t,n,r]}function Oe(e,t){return[54,e,t]}function ke(e){return[55,e]}function Ae(e,t,n,r){return[57,e,t,n,r]}function je(e){return[58,e]}function Me(e,t,n,r){return[60,e,t,n,r]}function Ne(e,t,n){return[61,e,t,n]}function Pe(e,t){return[63,e,t]}function Fe(e,t){return[64,e,t]}function Ie(e,t){return[65,e,t]}function Le(e,t,n,r,i,a){return[68,e,t,n,r,i,a]}function Re(e,t){return[70,e,t]}function ze(e,t,n){return[71,e,t,n]}function Be(e,t,n,r){return[73,e,t,n,r]}function Ve(e,t){return[75,e,t]}function He(e,t){return[76,e,t]}function Ue(e,t){return[77,e,t]}function We(e,t,n,r){return[78,e,t,n,r]}function Ge(e,t,n,r,i,a,o,s,c){return[83,e,t,n,r,i,a,o,s,c]}function Ke(e,t,n,r,i,a){return[84,e,t,n,r,i,a]}function qe(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g){return[85,e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g]}function Je(e,t,n){return[87,e,t,n]}function Ye(e,t,n,r,i,a){return[89,e,t,n,r,i,a]}function Xe(e,t,n,r,i,a){return[112,e,t,n,r,i,a]}function Ze(e,t,n){return[113,e,t,n]}function Qe(e){return[114,e]}function $e(e){return[115,e]}function et(e){return[117,e]}function tt(e){return[118,e]}function nt(e,t){return[119,e,t]}function rt(e){return[120,e]}function it(e,t,n,r){return[122,e,t,n,r]}function at(e,t){return[124,e,t]}var ot=S&&`performance`in window&&`memory`in performance?performance:{memory:{}},st=S?(navigator.deviceMemory||0)*1024:0,ct=ot.memory.jsHeapSizeLimit||0,lt=-1;function ut(e,t){if(!Object.assign({capturePerformance:!0},t).capturePerformance)return;let n=S&&typeof window.requestAnimationFrame==`function`?window.requestAnimationFrame.bind(window):null,r=S&&typeof window.cancelAnimationFrame==`function`?window.cancelAnimationFrame.bind(window):null,i=!1,a=0,o=0,s=null,c=!1,l=()=>{s=null,!(!i||a===lt)&&(a++,!c&&u())},u=()=>{!n||s!==null||(c=!0,s=n(l),c=!1)},d=()=>{s!==null&&r&&r(s),s=null};e.ticker.attach(()=>{!i||o===lt||o++},0,!1);let f=()=>
86{i&&(e.send(De(a,o,ot.memory.totalJSHeapSize||0,ot.memory.usedJSHeapSize||0)),document.hidden?a=o=lt:(a=o=0,u()))};e.attachStartCallback(()=>{i=!0,a=o=lt,f()}),e.attachStopCallback(()=>{i=!1,a=o=0,d()}),e.ticker.attach(f,165,!1),document.hidden!==void 0&&e.attachEventListener(document,`visibilitychange`,f,!1,!1)}var dt=class{constructor(){this.tags=[],this.byId=new Map,this.byDataAttr=new Map,this.byClass=new Map,this.fallback=[]}setTags(e){this.tags=e,this.byId.clear(),this.byDataAttr.clear(),this.byClass.clear(),this.fallback=[];for(let t of e){let e=ft(t.selector);if(!e){this.fallback.push(t);continue}if(e.startsWith(`#`))this.byId.set(e.slice(1),t);else if(e.startsWith(`[data-`))this.byDataAttr.set(e,t);else{let n=pt(e);n?this.byClass.set(n,t):this.fallback.push(t)}}}getTags(){return this.tags}match(e){let t=this.matchExact(e);if(t)return t;if(e.parentElement){let t=this.matchExact(e.parentElement);if(t)return t}let n=e.children;for(let e=0;e<n.length;e++){let t=this.matchExact(n[e]);if(t)return t}return null}matchExact(e){if(e.id&&this.byId.has(e.id)){let t=this.byId.get(e.id);if(mt(e,t.selector)&&ht(t))return t}if(this.byDataAttr.size>0){let t=e.attributes;for(let n=0;n<t.length;n++){let r=t[n];if(r.name.startsWith(`data-`)){let t=`[${r.name}="${r.value}"]`;if(this.byDataAttr.has(t)){let n=this.byDataAttr.get(t);if(mt(e,n.selector)&&ht(n))return n}}}}if(this.byClass.size>0&&e.classList)for(let t=0;t<e.classList.length;t++){let n=e.classList[t];if(this.byClass.has(n)){let t=this.byClass.get(n);if(mt(e,t.selector)&&ht(t))return t}}for(let t of this.fallback)if(mt(e,t.selector)&&ht(t))return t;return null}clear(){this.tags=[],this.byId.clear(),this.byDataAttr.clear(),this.byClass.clear(),this.fallback=[]}};function ft(e){let t=e.trim();if(!t)return null;let n=t.split(/\s*[>+~ ]\s*/);return n[n.length-1]?.trim()||null}function pt(e){let t=e.match(/\.([a-zA-Z_-][\w-]*)/);return t?t[1]:null}function mt(e,t){try{return e.matches(t)}catch{return!1}}function ht(e){if(!e.location)return!0;try{let t=e.location;return t.startsWith(`/`)?window.location.pathname===t:window.location.href===t}catch{return!0}}var gt=`__or__watched_tags__`,_t=class{constructor(e){this.interval=null,this.tags=[],this.matcher=new dt,this.sessionStorage=e.sessionStorage,this.errLog=e.errLog,this.onTag=e.onTag;let t=JSON.parse(e.sessionStorage.getItem(gt)??`[]`);this.setTags(t),this.observer=new IntersectionObserver(e=>{e.forEach(e=>{if(e.isIntersecting&&e.target){let t=e.target.__or_watcher_tagname;t&&this.onTagRendered(t),this.observer.unobserve(e.target)}})})}async fetchTags(e,t){return fetch(`${e}/v1/web/tags`,{method:`GET`,headers:{Authorization:`Bearer ${t}`}}).then(e=>e.json()).then(({tags:e})=>{if(e&&e.length){this.setTags(e);let t=JSON.stringify(e);this.sessionStorage.setItem(gt,t||``)}}).catch(e=>this.errLog(e))}setTags(e){this.tags=e,this.matcher.setTags(e),this.interval&&=(clearInterval(this.interval),null),this.interval=setInterval(()=>
86{this.tags.forEach(e=>{if(!ht(e))return;let t=document.querySelectorAll(e.selector);if(t.length>0){let n=t[0];n.__or_watcher_tagname=e.id,this.observer.observe(n)}})},500)}onTagRendered(e){let t=this.tags.find(t=>t.id===e);t&&(this.tags=this.tags.filter(t=>t.id!==e),!ht(t))||this.onTag(e)}clear(){this.tags=[],this.matcher.clear(),this.interval&&=(clearInterval(this.interval),null),this.observer.disconnect()}};function vt(e){return!!e&&e.nodeType!=null}function yt(e){return e.namespaceURI===`http://www.w3.org/2000/svg`||e.localName===`svg`}function bt(e){return e.localName===`use`}function xt(e){return e.nodeType===Node.ELEMENT_NODE}function St(e){return e.nodeType===Node.COMMENT_NODE}function Ct(e){return e.nodeType===Node.TEXT_NODE}function wt(e){return e.nodeType===Node.DOCUMENT_NODE}function Tt(e){return e.nodeType===Node.DOCUMENT_NODE||e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function Et(e,t){return e.localName===t}var Dt=class{constructor(e,t){this.app=e,this.options=t,this.snapshots={},this.intervals=new Map,this.observers=new Map,this.uploadQueue=0,this.MAX_CONCURRENT_UPLOADS=2,this.MAX_QUEUE_SIZE=50,this.pendingBatches=[],this.isProcessingQueue=!1,this.resanitizeCanvas=(e,t)=>{if(Et(e,`canvas`))if(this.app.sanitizer.isObscured(t)||this.app.sanitizer.isHidden(t)){if(this.snapshots[t]||this.observers.has(t)){let e=this.observers.get(t);e&&(e.disconnect(),this.observers.delete(t)),this.cleanupCanvas(t)}}else!this.snapshots[t]&&!this.observers.has(t)&&this.captureCanvas(e)},this.restartTracking=()=>{this.clear(),this.app.nodes.scanTree(this.captureCanvas)},this.captureCanvas=e=>{let t=this.app.nodes.getID(e);if(!t||!Et(e,`canvas`)||this.app.sanitizer.isObscured(t)||this.app.sanitizer.isHidden(t)||this.snapshots[t])return;let n=new IntersectionObserver(e=>{e.forEach(e=>{e.isIntersecting?this.snapshots[t]&&this.snapshots[t].createdAt?this.snapshots[t].paused=!1:this.recordCanvas(e.target,t):this.snapshots[t]&&(this.snapshots[t].paused=!0)})});this.observers.set(t,n),n.observe(e)},this.recordCanvas=(e,t)=>{let n=this.app.timestamp();this.snapshots[t]={images:[],createdAt:n,paused:!1,dummy:document.createElement(`canvas`),isCapturing:!1,isStopped:!1};let r=nt(t.toString(),n);this.app.send(r);let i=e,a=e=>{!this.snapshots[t]||this.snapshots[t].isCapturing||this.snapshots[t].isStopped||(this.snapshots[t].isCapturing=!0,kt(e,this.options.quality,this.snapshots[t].dummy,this.options.fixedScaling,this.fileExt,e=>{this.snapshots[t]&&(this.snapshots[t].isCapturing=!1),!(!e||!this.snapshots[t]||this.snapshots[t].isStopped)&&(this.snapshots[t].images.push({id:this.app.timestamp(),data:e}),this.snapshots[t].images.length>9&&(this.sendSnaps(this.snapshots[t].images,t,this.snapshots[t].createdAt),this.snapshots[t].images=[]))}))},o=setInterval(()=>{let n=this.snapshots[t];if(!n||n.isStopped){this.app.debug.log(`Canvas is not present in {snapshots}`),this.cleanupCanvas(t);return}if(!document.contains(i)){this.app.debug.log(`Canvas element not in sync`,i,e),this.cleanupCanvas(t);return}n.paused||(this.options.useAnimationFrame?requestAnimationFrame(()=>{a(i)}):a(i))},this.interval);this.intervals.set(t,o)},this.fileExt=`webp`,this.interval=1e3/t.fps}startTracking(){setTimeout(()=>{this.app.nodes.scanTree(this.captureCanvas),this.app.nodes.attachNodeCallback(this.captureCanvas),this.app.attachResanitizeCallback(this.resanitizeCanvas)},125)}sendSnaps(e,t,n){if(Object.keys(this.snapshots).length!==0){if(this.pendingBatches.length>=this.MAX_QUEUE_SIZE){this.app.debug.warn(`Upload queue full, dropping canvas batch`);return}this.pendingBatches.push({images:e,canvasId:t,createdAt:n}),this.isProcessingQueue||this.processUploadQueue()}}async processUploadQueue(){for(this.isProcessingQueue=!0;this.pendingBatches.length>0;){if(this.uploadQueue>=this.MAX_CONCURRENT_UPLOADS){await new Promise(e=>setTimeout(e,100));continue}let e=this.pendingBatches.shift();if(!e)break;this.uploadBatch(e.images,e.canvasId,e.createdAt)}this.isProcessingQueue=!1}async uploadBatch(e,t,n){if(this.options.isDebug){let r=await At(e);if(r){let e=`${n}_${t}.${this.fileExt}.frames`,i=URL.createObjectURL(new Blob([r])),a=document.createElement(`a`);a.href=i,a.download=e,a.style.display=`none`,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i)}}let r;if(this.options.framesSupport){let i=[],a=0;for(let t of e){if(!t.data)continue;let e=await t.data.arrayBuffer();i.push(e),a+=12+e.byteLength}if(a===0)return;let o=new ArrayBuffer(a),s=new DataView(o),c=new Uint8Array(o),l=0;for(let t=0;t<e.length;t++){if(!e[t].data)continue;let n=i.shift(),r=e[t].id;s.setUint32(l,r%4294967296,!0),s.setUint32(l+4,Math.floor(r/4294967296),!0),l+=8,s.setUint32(l,n.byteLength,!0),l+=4,c.set(new Uint8Array(n),l),l+=n.byteLength}r=new FormData,r.append(`type`,`frames`);let u=`${n}_${t}.${this.fileExt}.frames`;r.append(`frames`,new Blob([o]),u)}
86else r=new FormData,e.forEach(e=>{let i=e.data;if(!i)return;let a=`${n}_${t}_${e.id}.${this.fileExt}`;r.append(`snapshot`,i,a)});let i=()=>{this.app.debug.log(`Restarting tracker; token expired`),this.app.stop(!1),setTimeout(()=>{this.app.start({},!0)},250)};this.uploadQueue++,fetch(this.app.options.ingestPoint+`/v1/web/images`,{method:`POST`,headers:{Authorization:`Bearer ${this.app.session.getSessionToken()??``}`},body:r}).then(e=>e.status===401?i():!0).catch(e=>{this.app.debug.error(`error saving canvas`,e)}).finally(()=>{this.uploadQueue--})}cleanupCanvas(e){this.snapshots[e]&&(this.snapshots[e].isStopped=!0);let t=this.intervals.get(e);t&&(clearInterval(t),this.intervals.delete(e));let n=this.observers.get(e);if(n&&(n.disconnect(),this.observers.delete(e)),this.snapshots[e]?.dummy){let t=this.snapshots[e].dummy;t.width=0,t.height=0}delete this.snapshots[e]}clear(){Object.keys(this.snapshots).forEach(e=>{let t=parseInt(e,10),n=this.snapshots[t];n&&n.images.length>0&&(this.sendSnaps(n.images,t,n.createdAt),n.images=[])}),Object.keys(this.snapshots).forEach(e=>{let t=parseInt(e,10);this.cleanupCanvas(t)}),this.intervals.clear(),this.observers.clear(),this.snapshots={}}},Ot={low:.35,medium:.55,high:.8};function kt(e,t=`medium`,n,r=!1,i,a){let o=`image/${i}`;if(r){let r=window.devicePixelRatio||1;n.width=e.width/r,n.height=e.height/r;let i=n.getContext(`2d`);if(!i)return``;i.clearRect(0,0,n.width,n.height),i.drawImage(e,0,0,n.width,n.height),n.toBlob(a,o,Ot[t])}else e.toBlob(a,o,Ot[t])}async function At(e){let t=[],n=0;for(let r of e){if(!r.data)continue;let e=await r.data.arrayBuffer();t.push(e),n+=12+e.byteLength}if(n===0)return null;let r=new ArrayBuffer(n),i=new DataView(r),a=new Uint8Array(r),o=0;for(let n=0;n<e.length;n++){if(!e[n].data)continue;let r=t.shift(),s=e[n].id;i.setUint32(o,s%4294967296,!0),i.setUint32(o+4,Math.floor(s/4294967296),!0),o+=8,i.setUint32(o,r.byteLength,!0),o+=4,a.set(new Uint8Array(r),o),o+=r.byteLength}return r}var jt={Verbose:5,Log:4,Warnings:3,Errors:2,Silent:0},Mt=class{constructor(e=jt.Silent){this.shouldLog=e=>this.level>=e,this.info=(...e)=>{this.shouldLog(jt.Verbose)&&console.info(...e)},this.log=(...e)=>{this.shouldLog(jt.Log)&&console.log(...e)},this.warn=(...e)=>{this.shouldLog(jt.Warnings)&&console.warn(...e)},this.error=(...e)=>{this.shouldLog(jt.Errors)&&console.error(...e)},this.level=e}},Nt=1e3;function Pt(e,t,n,r,i){let a=e.entries();function o(){let e=0,s=a.next();for(;!s.done&&e<t;){let t=s.value[1];t&&n(t),e++,s=a.next()}e>0?r(setTimeout(o,50)):i()}o()}function Ft(e){try{if(!e.isConnected)return[!1,`not connected`];let t=e.nodeType===Node.DOCUMENT_NODE,n=t?e.defaultView:e.ownerDocument?.defaultView,r=t?e:e.ownerDocument;return n?n.closed?[!1,`window closed`]:r?.documentElement.isConnected?[!0,`ok`]:[!1,`documentElement not connected`]:[!1,`no window`]}catch(e){return[!1,e]}}var It={interval:Nt*30,batchSize:2500,enabled:!0},Lt=class{constructor(e,t,n){this.nodes=e,this.unregisterNode=t,this.isScanning=!1,this.start=()=>{this.options.enabled&&(this.stop(),this.interval=setInterval(()=>{this.isScanning||(this.isScanning=!0,Pt(this.nodes,this.options.batchSize,e=>{Ft(e)[0]||this.unregisterNode(e)},e=>{this.batchTimeout=e},()=>{this.batchTimeout=void 0,this.isScanning=!1}))},this.options.interval))},this.stop=()=>{this.interval&&clearInterval(this.interval),this.batchTimeout&&=(clearTimeout(this.batchTimeout),void 0),this.isScanning=!1},this.options={...It,...n}}},Rt=2,zt=7,Bt=22,Vt=Bt,Ht=29,Ut=(1<<Bt)-1,Wt=(1<<zt)-1,Gt=(1<<Rt)-1;function Kt(e,t,n){if(e<0||e>Gt)throw RangeError(`OR: nesting level overflow, max 4`);if(t<0||t>Wt)throw RangeError(`OR: frame order overflow, max 128`);return((e&Gt)<<Ht|(t&Wt)<<Vt|n&Ut)>>>0}var qt=class{constructor(e){this.nodes=new Map,this.totalNodeAmount=0,this.nodeCallbacks=[],this.elementListeners=new Map,this.nextNodeId=0,this.attachNodeCallback=e=>this.nodeCallbacks.push(e),this.scanTree=e=>{this.nodes.forEach(t=>t?e(t):void 0)},this.attachNodeListener=(e,t,n,r=!0)=>{let i=this.getID(e);if(i===void 0)return;ee(e,t,n,r,this.forceNgOff);let a=this.elementListeners.get(i);a===void 0&&(a=[],this.elementListeners.set(i,a)),a.push([t,n,r])},this.createFrameId=(e,t)=>Kt(e,t,0),this.unregisterNode=e=>{let t=e[this.node_id];if(t!==void 0){e[this.node_id]=void 0,delete e[this.node_id],this.nodes.delete(t);let n=this.elementListeners.get(t);
86n!==void 0&&(this.elementListeners.delete(t),n.forEach(t=>te(e,t[0],t[1],t[2],this.forceNgOff))),this.totalNodeAmount--}return t},this.node_id=e.node_id,this.forceNgOff=e.forceNgOff,this.maintainer=new Lt(this.nodes,this.unregisterNode,e.maintainer),this.maintainer.start()}crossdomainMode(e,t){this.nextNodeId=this.createFrameId(e,t)}registerNode(e){let t=e[this.node_id],n=t===void 0||this.nodes.get(t)!==e,r=t;return n&&(r=this.nextNodeId,this.totalNodeAmount++,this.nextNodeId++,this.nodes.set(r,e),e[this.node_id]=r),[r,n]}cleanTree(){for(let[e,t]of this.nodes)t&&!document.contains(t)&&this.unregisterNode(t)}callNodeCallbacks(e,t){this.nodeCallbacks.forEach(n=>n(e,t))}getID(e){if(e)return e[this.node_id]}isBound(e){if(!e)return!1;let t=e[this.node_id];return t!==void 0&&this.nodes.get(t)===e}getNode(e){return this.nodes.get(e)}getNodeCount(){return this.totalNodeAmount}clear(){for(let[e,t]of this.nodes)t&&this.unregisterNode(t);this.nextNodeId=0,this.nodes.clear()}},Jt=1e6*99;function Yt(e,t,n,r,i,a,o,s,c){let l=s?null:r();s||a(l,t);let u=e.sheet;if(u&&!o)try{let e=m(u);if(e){f(e);return}}catch{}e.href?fetch(e.href).then(e=>{if(!e.ok)throw Error(`response status ${e.status}`);return e.text()}).then(e=>{s&&c?c(e,Jt++):f(e)}).catch(t=>{console.error(`OpenReplay: Failed to fetch CSS from ${e.href}:`,t),d()}):d();function d(){let t=()=>{let t=e.sheet;if(t)try{let e=m(t);if(e){s&&c?c(e,Jt++):f(e);return}}catch{}};e.sheet?t():e.addEventListener(`load`,function n(){e.removeEventListener(`load`,n),t()})}function f(e){e=e.replace(/\/\*[\s\S]*?\*\//g,``);let t=p(e);for(let e=0;e<t.length;e++)i(l,t[e],e,n)}function p(e){let t=[],n=!1,r=!1,i=``,a=0,o=``;for(let s=0;s<e.length;s++){let c=e[s],l=e[s+1]||``;if(!r&&c===`/`&&l===`*`){n=!0,s++;continue}if(n){c===`*`&&l===`/`&&(n=!1,s++);continue}if(!r&&(c===`"`||c===`'`)){r=!0,i=c,o+=c;continue}if(r){o+=c,c===i&&e[s-1]!==`\\`&&(r=!1);continue}o+=c,c===`{`?a++:c===`}`&&(a--,a===0&&(t.push(o.trim()),o=``))}return o.trim()&&t.push(o.trim()),t}function m(e){try{let t=e.rules||e.cssRules;if(!t)return null;let n=e.href;return!n&&e.ownerNode&&e.ownerNode.ownerDocument&&(n=e.ownerNode.ownerDocument.location.href),g(Array.from(t,e=>h(e,n)).join(``))}catch{return null}}function h(e,t){if(y(e)){let t;try{t=m(e.styleSheet)||_(e)}catch{t=e.cssText}return e.styleSheet.href?x(t,e.styleSheet.href):t}else{let n=e.cssText;return b(e)&&e.selectorText.includes(`:`)&&(n=v(n)),t?x(n,t):n}}function g(e){return e.includes(` background-clip: text;`)&&!e.includes(` -webkit-background-clip: text;`)&&(e=e.replace(/\sbackground-clip:\s*text;/g,` -webkit-background-clip: text; background-clip: text;`)),e}function _(e){let{cssText:t}=e;if(t.split(`"`).length<3)return t;let n=[`@import`,`url(${JSON.stringify(e.href)})`];return e.layerName===``?n.push(`layer`):e.layerName&&n.push(`layer(${e.layerName})`),e.supportsText&&n.push(`supports(${e.supportsText})`),e.media.length&&n.push(e.media.mediaText),n.join(` `)+`;`}function v(e){return e.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,`$1\\$2`)}function y(e){return`styleSheet`in e}function b(e){return`selectorText`in e}function x(e,t){if(!e)return``;let n=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,r=/^(?:[a-z+]+:)?\/\//i,i=/^www\..*/i,a=/^(data:)([^,]*),(.*)/i;return e.replace(n,(e,n,o,s,c,l)=>{let u=o||c||l,d=n||s||``;if(!u)return e;if(r.test(u)||i.test(u)||a.test(u))return`url(${d}${u}${d})`;if(u[0]===`/`)return`url(${d}${S(t)+u}${d})`;let f=t.split(`/`),p=u.split(`/`);f.pop();for(let e of p)if(e===`.`)continue;else e===`..`?f.pop():f.push(e);return`url(${d}${f.join(`/`)}${d})`})}function S(e){let t=``;return t=e.indexOf(`//`)>-1?e.split(`/`).slice(0,3).join(`/`):e.split(`/`)[0],t=t.split(`?`)[0],t}}function Xt(e){return Tt(e)&&!!e.adoptedStyleSheets}var Zt=15;function Qt(){return Zt++}var $t=new Map;function en(e){if(e===null||!Xt(document))return;let t=new Map,n=n=>setTimeout(()=>{let r=e.nodes.getID(n);if(n===document&&(r=0),r===void 0)return;let i=t.get(r);i||=[];let a=[],o=n.adoptedStyleSheets;if(o&&Symbol.iterator in o)for(let t of o){let n=$t.get(t),o=!n;if(n||(n=Qt(),$t.set(t,n)),i.includes(n)||e.send(He(n,r)),o)try{let r=t.cssRules;for(let t=0;t<r.length;t++)e.send(Be(n,r[t].cssText,t,e.getBaseHref()))}catch(t){e.debug.log(`Couldnt access adopted stylesheet`,t)}a.push(n)}if(Symbol.iterator in i)for(let t of i)a.includes(t)||e.send(Ue(t,r));t.set(r,a)},20);function r(e){let t=Object.getOwnPropertyDescriptor(e,`adoptedStyleSheets`);t&&Object.defineProperty(e,"adoptedStyleSheets",{...t,set:function(e){let r=t.set.call(this,e);return n(this),r}})}let i=t=>{if(t.__openreplay_adpss_patched__)return;t.__openreplay_adpss_patched__=!0,r(t.Document.prototype),r(t.ShadowRoot.prototype);let{replace:n,replaceSync:i}=t.CSSStyleSheet.prototype;t.CSSStyleSheet.prototype.replace=function(t){return n.call(this,t).then(n=>{let r=$t.get(this);return r&&e.send(ze(r,t,e.getBaseHref())),n})},t.CSSStyleSheet.prototype.replaceSync=function(t){let n=$t.get(this);return n&&e.send(ze(n,t,e.getBaseHref())),i.call(this,t)}};i(window),e.observer.attachContextCallback(e.safe(i)),e.attachStopCallback(()=>{$t.clear(),t.clear()}),e.attachStartCallback(()=>{n(document)}),e.nodes.attachNodeCallback(e=>{Xt(e)&&n(e)})}var tn;(function(e){e[e.Plain=0]=`Plain`,e[e.Obscured=1]=`Obscured`,e[e.Hidden=2]=`Hidden`})(tn||={});var nn=e=>e.trim().replace(/[^\f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff\s]/g,`*`),rn=class{constructor(e){this.levels=new Map,this.app=e.app;let t={obscureTextEmails:!0,obscureTextNumbers:!1,privateMode:!1,domSanitizer:void 0};this.privateMode=e.options?.privateMode??!1,this.options=Object.assign(t,e.options)}computeLevel(e,t){if(this.options.privateMode&&(xt(e)&&!R(e,`unmask`)||Ct(e)&&!R(e.parentNode,`unmask`)))return tn.Obscured;let n=tn.Plain;if((t>=tn.Obscured||xt(e)&&(R(e,`masked`)||R(e,`obscured`)))&&(n=tn.Obscured),(t===tn.Hidden||xt(e)&&(R(e,`htmlmasked`)||R(e,`hidden`)))&&(n=tn.Hidden),this.options.domSanitizer!==void 0&&xt(e)){let t=this.options.domSanitizer(e);t===tn.Obscured&&n<tn.Obscured&&(n=tn.Obscured),t===tn.Hidden&&(n=tn.Hidden)}return n}getLevel(e){return this.levels.get(e)??tn.Plain}setLevel(e,t){let n=this.getLevel(e);return t===tn.Plain?this.levels.delete(e):this.levels.set(e,t),n}handleNode(e,t,n){let r=this.computeLevel(n,this.getLevel(t));r>this.getLevel(e)&&this.setLevel(e,r)}sanitize(e,t){return this.getLevel(e)>=tn.Obscured?nn(t):(this.options.obscureTextNumbers&&(t=t.replace(/\d/g,`0`)),this.options.obscureTextEmails&&(t=t.replace(/[^\s@]+@[^\s@]+\.[^\s@]+/g,e=>{let t=e.lastIndexOf(`@`),n=e.slice(0,t),r=e.slice(t+1).split(`.`).map(e=>k(e)).join(`.`);return`${k(n)}@${r}`})),t)}isObscured(e){return this.getLevel(e)>=tn.Obscured}isHidden(e){return this.getLevel(e)===tn.Hidden}getInnerTextSecure(e){let t=this.app.nodes.getID(e);return t?this.sanitize(t,e.innerText):``}clear(){this.levels.clear()}},an={},on={};async function sn(e,t,n){try{let r=e.getAttribute(`xlink:href`)||e.getAttribute(`href`);if(!r){console.debug(`Openreplay: xlink:href or href not found on <use>.`);return}let[i,a]=r.split(`#`);if(!i&&!a){console.warn(`Openreplay: Invalid xlink:href or href found on <use>.`);return}let o=i?`url:${i}#${a}#${t}`:`doc:${a}#${t}`;if(an[o])return an[o];if(!i&&a){let e=r.startsWith(`#`),t;t=e?`#${CSS.escape(r.substring(1))}`:CSS.escape(r);let n=document.querySelector(t);if(n){let e=` 87 <svg xmlns="http://www.w3.org/2000/svg" viewBox="${n.getAttribute(`viewBox`)||`0 0 24 24`}"> 88 ${n.innerHTML} 89 </svg> 90 `;return an[o]=e,e}else{console.warn(`Openreplay: Sprite symbol not found in the document.`);return}}let s;if(on[i])on[i]===1?await new Promise(e=>{let t=0,n=setInterval(()=>{t>100&&(clearInterval(n),e(!1)),on[i]===1?t++:(s=on[i],clearInterval(n),e(!0))},100)}):s=on[i]??`<svg xmlns="http://www.w3.org/2000/svg"></svg>`;else{on[i]=1;try{let e=await(await fetch(i)).text();s=n.parseFromString(e,`image/svg+xml`),on[i]=s}catch(e){throw delete on[i],e}}if(!s)return;let c=s.getElementById(a);if(!c)return console.debug(`Openreplay: Symbol not found in SVG.`),``;if(t===`svgtext`){let e=` 91 <svg xmlns="http://www.w3.org/2000/svg" viewBox="${c.getAttribute(`viewBox`)||`0 0 24 24`}"> 92 ${c.innerHTML} 93 </svg> 94 `;return an[o]=e,e}console.debug(`Openreplay: Unknown mode: ${t}. Use "inline" or "dataurl".`)}catch(e){console.error(`Openreplay: Error processing <use> element:`,e)}}function cn(e){if(St(e))return!0;
94if(Ct(e))return!1;if(!xt(e))return!0;let t=e.tagName.toUpperCase();if(t===`LINK`){let t=e.getAttribute(`rel`),n=e.getAttribute(`as`);return!(t?.includes(`stylesheet`)||n===`style`||n===`font`)}return t===`SCRIPT`||t===`NOSCRIPT`||t===`META`||t===`TITLE`||t===`BASE`}function ln(e){return Tt(e)?!0:!cn(e)}var un=new Set([`button`,`reset`,`submit`,`checkbox`,`radio`]);function dn(e){return Et(e,`input`)&&!un.has(e.type)}var fn;(function(e){e[e.New=0]=`New`,e[e.Removed=1]=`Removed`,e[e.Changed=2]=`Changed`})(fn||={});var pn=class{constructor(e,t=!1,n={}){this.app=e,this.isTopContext=t,this.commited=[],this.recents=new Map,this.indexes=[],this.attributesMap=new Map,this.textSet=new Set,this.slotMap=new Map,this.disableSprites=!1,this.inlineRemoteCss=!1,this.inlinerOptions=void 0,this.domParser=new DOMParser,this.generation=0,this.throttling=!0,this.throttledSetNodeData=ie((e,t,n)=>this.sendNodeData(e,t,n),30),this.throttling=!n.disableThrottling,this.disableSprites=!!n.disableSprites,this.inlineRemoteCss=!!n.inlineRemoteCss,this.inlinerOptions=n.inlinerOptions,this.observer=G(this.app.safe(e=>{for(let t of e)try{let e=t.target,n=t.type;if(!ln(e))continue;if(n===`childList`){for(let e=0;e<t.removedNodes.length;e++)ln(t.removedNodes[e])&&this.bindNode(t.removedNodes[e]);for(let e=0;e<t.addedNodes.length;e++)this.bindTree(t.addedNodes[e]);continue}let r=this.app.nodes.getID(e);if(r===void 0)continue;if(this.recents.has(r)||this.recents.set(r,fn.Changed),n===`attributes`){let e=t.attributeName;if(e===null)continue;let n=this.attributesMap.get(r);n===void 0&&this.attributesMap.set(r,n=new Set),n.add(e);continue}if(n===`characterData`){this.textSet.add(r);continue}}catch{t.target}this.commitNodes()}),this.app.options.forceNgOff)}clear(){this.commited.length=0,this.recents.clear(),this.indexes.length=1,this.attributesMap.clear(),this.textSet.clear()}handleIframeSrcChange(e){let t=e.contentDocument;if(t&&this.app.nodes.getID(t)!==void 0){let n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT+NodeFilter.SHOW_TEXT,{acceptNode:e=>cn(e)||this.app.nodes.getID(e)===void 0?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},!1),r=0,i=this.app.nodes.getNodeCount(),a=e.contentDocument,o=this.app.nodes.unregisterNode.bind(this.app.nodes);for(;n.nextNode();)a.contains(n.currentNode)||(r+=1,o(n.currentNode));let s=Math.floor(r/i*100);s>30&&this.app.send($e(s))}}sendNodeAttribute(e,t,n,r){if(yt(t)){if(n.startsWith(`xlink:`)&&(n=n.substring(6)),r===null){this.app.send(pe(e,n));return}if(bt(t)&&n===`href`&&!this.disableSprites){sn(t,`svgtext`,this.domParser).then(t=>{t&&this.app.send(fe(e,n,`_$OPENREPLAY_SPRITE$_${t}`))}).catch(e=>{console.error(`Openreplay: Error parsing <use> element:`,e)});return}n===`href`?(r.length>1e5&&(r=``),this.app.send(Me(e,n,r,this.app.getBaseHref()))):this.app.attributeSender.sendSetAttribute(e,n,r);return}if(n===`open`&&Et(t,`dialog`)){let n;if(r===null)n=`closed`;else{let e=!1;try{e=t.matches(`dialog:modal`)}catch{}n=e?`modal`:`nonmodal`}this.app.send(fe(e,`__openreplay_dialog`,n))}if(!(n===`src`||n===`srcset`||n===`integrity`||n===`crossorigin`||n===`autocomplete`||n.substring(0,2)===`on`)&&!(n===`value`&&dn(t))){if(r===null){this.app.send(pe(e,n));return}if(n===`style`||n===`href`&&Et(t,`link`)){if(`rel`in t&&t.rel===`stylesheet`&&this.inlineRemoteCss){let n=this.generation;setTimeout(()=>{Yt(t,e,this.app.getBaseHref(),Qt,(e,t,r,i)=>{this.generation===n&&this.app.send(Be(e,t,r,i))},(e,t)=>{this.generation===n&&this.app.send(He(e,t))},this.inlinerOptions?.forceFetch,this.inlinerOptions?.forcePlain,(t,r)=>{this.generation===n&&(this.app.send(le(r,e,0)),this.app.send(Ne(r,t,this.app.getBaseHref())))})},0);return}this.app.send(Me(e,n,r,this.app.getBaseHref()));return}(n===`href`||r.length>1e5)&&(r=``),[`alt`,`placeholder`].includes(n)&&this.app.sanitizer.privateMode&&(r=r.replaceAll(/./g,`*`)),this.app.attributeSender.sendSetAttribute(e,n,r)}}sendNodeData(e,t,n){if(Et(t,`style`)){this.app.send(Ne(e,n,this.app.getBaseHref()));return}n=this.app.sanitizer.sanitize(e,n),this.app.send(me(e,n))}bindNode(e){let[t,n]=this.app.nodes.registerNode(e);xt(e)&&Et(e,`slot`)&&this.app.nodes.attachNodeListener(e,`slotchange`,()=>{e.assignedNodes({flatten:!0}
94).forEach(e=>{let t=this.app.nodes.getID(e);t!==void 0&&this.recents.set(t,fn.Changed)})}),n?this.recents.set(t,fn.New):this.recents.get(t)!==fn.New&&this.recents.set(t,fn.Removed)}bindTree(e){if(!ln(e))return;this.bindNode(e);let t=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT+NodeFilter.SHOW_TEXT,{acceptNode:e=>cn(e)||this.app.nodes.isBound(e)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},!1);for(;t.nextNode();)this.bindNode(t.currentNode)}unbindTree(e){let t=this.app.nodes.unregisterNode(e);if(t!==void 0&&this.slotMap.delete(t),t!==void 0&&this.recents.get(t)===fn.Removed){this.app.send(de(t));let n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT+NodeFilter.SHOW_TEXT,{acceptNode:e=>cn(e)||this.app.nodes.getID(e)===void 0?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},!1),r=0,i=this.app.nodes.getNodeCount();for(;n.nextNode();)r+=1,this.app.nodes.unregisterNode(n.currentNode);let a=Math.floor(r/i*100);a>30&&this.app.send($e(a))}}_commitNode(e,t){if(Tt(t))return!0;let n=t.assignedSlot,r=t.parentNode,i;if(!Et(t,`html`)||!this.isTopContext){if(r===null||(i=this.app.nodes.getID(r),i===void 0)||!this.commitNode(i))return this.unbindTree(t),!1;if(this.app.sanitizer.handleNode(e,i,t),this.app.sanitizer.isHidden(i))return!1}let a=t.previousSibling;for(;a!==null;){let t=this.app.nodes.getID(a);if(t!==void 0){this.commitNode(t),this.indexes[e]=this.indexes[t]+1;break}a=a.previousSibling}a===null&&(this.indexes[e]=0);let o=this.recents.get(e),s=o===fn.New,c=this.indexes[e];if(c===void 0)throw`commitNode: missing node index`;if(s){if(xt(t)){let n=t;if(i!==void 0){if(this.app.sanitizer.isHidden(e)){let e=n.clientWidth,r=n.clientHeight;n=t.cloneNode(),n.style.width=`${e}px`,n.style.height=`${r}px`}`rel`in n&&n.rel===`stylesheet`&&this.inlineRemoteCss?this.app.send(ce(e,i,c,`STYLE`,!1)):this.app.send(ce(e,i,c,n.tagName,yt(t)))}for(let t=0;t<n.attributes.length;t++){let r=n.attributes[t];this.sendNodeAttribute(e,n,r.nodeName,r.value)}}else Ct(t)&&(this.app.send(le(e,i,c)),this.throttling?this.throttledSetNodeData(e,r,t.data):this.sendNodeData(e,r,t.data));if(n){let t=this.app.nodes.getID(n);t!==void 0&&(this.slotMap.set(e,t),this.app.send(Ie(e,t)))}return!0}if(o===fn.Removed&&i!==void 0)if(this.app.send(ue(e,i,c)),n){let t=this.app.nodes.getID(n);t!==void 0&&this.slotMap.get(e)!==t&&(this.slotMap.set(e,t),this.app.send(Ie(e,t)))}else this.slotMap.has(e)&&(this.slotMap.delete(e),this.app.send(Ie(e,0)));let l=this.attributesMap.get(e);if(l!==void 0){if(!xt(t))throw`commitNode: node is not an element`;for(let n of l)this.sendNodeAttribute(e,t,n,t.getAttribute(n))}
94if(this.textSet.has(e)){if(!Ct(t))throw`commitNode: node is not a text`;this.throttling?this.throttledSetNodeData(e,r,t.data):this.sendNodeData(e,r,t.data)}return!0}commitNode(e){let t=this.app.nodes.getNode(e);if(!t)return!1;let n=this.commited[e];return n===void 0?this.commited[e]=this._commitNode(e,t):n}commitNodes(e=!1){let t;for(let[n,r]of this.recents.entries())this.commitNode(n),r===fn.New&&(t=this.app.nodes.getNode(n))&&this.app.nodes.callNodeCallbacks(t,e);this.clear()}observeRoot(e,t,n=e){this.observer.observe(e,{childList:!0,attributes:!0,characterData:!0,subtree:!0,attributeOldValue:!1,characterDataOldValue:!1}),this.bindTree(n),t(this.app.nodes.getID(e)),this.commitNodes(!0)}resanitizeSubtree(e){if(!ln(e))return;let t=e.parentNode,n=t===null?void 0:this.app.nodes.getID(t),r=n===void 0?tn.Plain:this.app.sanitizer.getLevel(n);this.resanitizeNode(e,r)}resanitizeNode(e,t){if(cn(e))return;let n=this.app.nodes.getID(e);if(n===void 0)return;let r=this.app.sanitizer.computeLevel(e,t),i=this.app.sanitizer.getLevel(n),a=i===tn.Hidden,o=r===tn.Hidden;if(a!==o){this.recreateSubtree(e);return}if(!o){i!==r&&(this.app.sanitizer.setLevel(n,r),this.reemitNode(n,e));for(let t=e.firstChild;t!==null;t=t.nextSibling)this.resanitizeNode(t,r)}}recreateSubtree(e){let t=this.app.nodes.getID(e);t!==void 0&&(this.app.send(de(t)),this.clearSubtreeRegistration(e),this.bindTree(e),this.commitNodes())}clearSubtreeRegistration(e){let t=e=>{let t=this.app.nodes.getID(e);t!==void 0&&this.app.sanitizer.setLevel(t,tn.Plain),this.app.nodes.unregisterNode(e)},n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT+NodeFilter.SHOW_TEXT,{acceptNode:e=>cn(e)||this.app.nodes.getID(e)===void 0?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},!1),r=[];for(;n.nextNode();)r.push(n.currentNode);t(e),r.forEach(t)}reemitNode(e,t){if(Ct(t)){let n=t.parentNode;n!==null&&xt(n)&&this.sendNodeData(e,n,t.data);return}xt(t)&&this.app.callResanitizeCallbacks(t,e)}disconnect(){let e=this.observer.takeRecords();if(e.length){let t=[];for(let n of e)for(let e=0;e<n.addedNodes.length;e++){let r=n.addedNodes[e];r.tagName&&t.length<10&&t.push(r.tagName)}}this.observer.disconnect(),this.clear(),this.throttledSetNodeData.clear(),this.generation++}resetThrottledSetNodeData(){this.throttledSetNodeData.clear()}},mn=class extends pn{observe(e){let t=e.contentDocument,n=this.app.nodes.getID(e);!t||n===void 0||this.observeRoot(t,e=>{if(e===void 0){this.app.debug.log(`OpenReplay: Iframe document not bound`);return}this.docId=e,this.app.send(Re(n,e))})}syntheticObserve(e,t){this.observeRoot(t,t=>{if(t===void 0){this.app.debug.log(`OpenReplay: Iframe document not bound`);return}this.app.send(Re(e,t))})}},hn=class extends pn{observe(e){let t=e.shadowRoot,n=this.app.nodes.getID(e);!t||n===void 0||this.observeRoot(t,e=>{if(e===void 0){this.app.debug.error(`OpenReplay: Shadow Root was not bound`);return}this.app.send(Re(n,e))})}},gn=class{constructor(){this.states=new WeakMap}calcOffset(e){let t=0,n=0;if(e.parent&&([t,n]=this.calcOffset(e.parent)),!e.offset){let{left:t,top:n}=e.iFrame.getBoundingClientRect();e.offset=[t,n]}let[r,i]=e.offset;return[t+r,n+i]}getDocumentOffset(e){let t=this.states.get(e);return t?this.calcOffset(t):[0,0]}observe(e){let t=e.contentDocument;if(!t)return;let n=e.ownerDocument,r={offset:null,iFrame:e,parent:this.states.get(n)||null,clear:()=>{n.removeEventListener(`scroll`,i),n.defaultView?.removeEventListener(`resize`,i)}},i=()=>{r.offset=null};n.addEventListener(`scroll`,i),n.defaultView?.addEventListener(`resize`,i),this.states.set(t,r)}clear(){this.states=new WeakMap}},_n;(function(e){e[e.Unset=-1]=`Unset`,e[e.Disabled=0]=`Disabled`,e[e.Inline=1]=`Inline`,e[e.InlineFetched=2]=`InlineFetched`,e[e.PlainFetched=3]=`PlainFetched`})(_n||={});var vn=`https://docs.openreplay.com/en/troubleshooting/localhost/`;function yn(e,t){switch(e){case _n.Inline:return{inlineRemoteCss:!0,inlinerOptions:{forceFetch:!1,forcePlain:!1}};case _n.InlineFetched:return{inlineRemoteCss:!0,inlinerOptions:{forceFetch:!0,forcePlain:!1}};case _n.PlainFetched:return{inlineRemoteCss:!0,inlinerOptions:{forceFetch:!0,forcePlain:!0}};case _n.Unset:return/^https?:\/\/(localhost|127\.0\.0\.1)(:\d+)?\/?/.test(window.location.href)?(t(`Enabling InlineCssMode.PlainFetched by default on localhost to preserve css styles, refer to ${vn} for details, set InlineCssMode to 0 to skip this behavior`),{inlineRemoteCss:!0,inlinerOptions:{forceFetch:!0,forcePlain:!0}}):{inlineRemoteCss:!1,inlinerOptions:{forceFetch:!1,forcePlain:!1}};case _n.Disabled:default:return{inlineRemoteCss:!1,inlinerOptions:{forceFetch:!1,forcePlain:!1}}}}var bn=S?Element.prototype.attachShadow:()=>new ShadowRoot,xn=class extends pn{constructor(e){let t=Object.assign({captureIFrames:!0,disableSprites:!1,inl
94ineCss:0},e.options),n={disableSprites:t.disableSprites,disableThrottling:t.disableThrottling,...yn(t.inlineCss,console.warn)};super(e.app,!0,n),this.iframeOffsets=new gn,this.contextCallbacks=[],this.contextsSet=new WeakSet,this.iframeObserversArr=[],this.iframeObservers=new WeakMap,this.docObservers=new WeakMap,this.shadowRootObservers=new WeakMap,this.colorSchemeMQL=null,this.colorSchemeListener=null,this.app=e.app,this.options=t,this.app.nodes.attachNodeCallback(e=>{Et(e,`iframe`)&&(this.options.captureIFrames&&!R(e,`obscured`)||R(e,`capture`))&&this.handleIframe(e)}),this.app.nodes.attachNodeCallback(e=>{xt(e)&&e.shadowRoot!==null&&this.handleShadowRoot(e.shadowRoot)})}attachContextCallback(e){this.contextCallbacks.push(e)}getDocumentOffset(e){return this.iframeOffsets.getDocumentOffset(e)}handleIframe(e){let t=this.app.safe(()=>setTimeout(()=>{let t=this.app.nodes.getID(e);if(t===void 0||!z(e))return;let n=e.contentWindow,r=e.contentDocument;if(!r){this.app.debug.warn(`no doc for iframe found`,e);return}if(r&&this.docObservers.has(r)){this.app.debug.info(`doc already observed for`,t);return}let i=new mn(this.app,!1,{disableSprites:this.options.disableSprites,...yn(this.options.inlineCss,console.warn)});this.iframeObservers.set(e,i),this.docObservers.set(r,i),this.iframeObserversArr.push(i),i.observe(e),this.iframeOffsets.observe(e),n&&n===n.window&&!this.contextsSet.has(n)&&(this.contextsSet.add(n),this.contextCallbacks.forEach(e=>e(n)))},250));e.addEventListener(`load`,t),t()}handleShadowRoot(e){let t=new hn(this.app,!1,{disableSprites:this.options.disableSprites,...yn(this.options.inlineCss,console.warn)});this.shadowRootObservers.set(e,t),t.observe(e.host)}observe(){let e=this;Element.prototype.attachShadow=function(){let t=bn.apply(this,arguments);return e.handleShadowRoot(t),t},this.resetThrottledSetNodeData(),this.app.nodes.clear(),this.observeRoot(window.document,()=>{this.app.send(se()),this.app.nodes.callNodeCallbacks(document,!0)},window.document.documentElement),this.sendColorScheme(),this.app.send(fe(0,`orloaded`,`true`)),S&&window.matchMedia&&(this.colorSchemeMQL=window.matchMedia(`(prefers-color-scheme: dark)`),this.colorSchemeListener=this.app.safe(()=>this.sendColorScheme()),this.colorSchemeMQL.addEventListener?.(`change`,this.colorSchemeListener))}sendColorScheme(){if(!S)return;let e=document.documentElement,t=getComputedStyle(e).colorScheme;if(!t||t===`normal`){let e=document.querySelector(`meta[name="color-scheme" i]`),n=e&&e.getAttribute(`content`);n&&(t=n)}let n=`normal`;if(t&&t!==`normal`){let e=!!window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches;n=t.includes(`dark`)&&(e||!t.includes(`light`))?`dark`:`light`}this.app.send(fe(0,`__openreplay_color_scheme`,n))}crossdomainObserve(e,t,n){let r=this;Element.prototype.attachShadow=function(){let e=bn.apply(this,arguments);return r.handleShadowRoot(e),e},this.app.nodes.clear(),this.app.nodes.crossdomainMode(n,t);let i=new mn(this.app,!1,{disableSprites:this.options.disableSprites,...yn(this.options.inlineCss,console.warn)});this.iframeObservers.set(window.document,i),i.syntheticObserve(e,window.document)}disconnect(){this.colorSchemeMQL&&this.colorSchemeListener&&this.colorSchemeMQL.removeEventListener?.(`change`,this.colorSchemeListener),this.colorSchemeMQL=null,this.colorSchemeListener=null,this.iframeOffsets.clear(),Element.prototype.attachShadow=bn,this.iframeObserversArr.forEach(e=>e.disconnect()),this.iframeObserversArr=[],this.iframeObservers=new WeakMap,this.shadowRootObservers=new WeakMap,this.docObservers=new WeakMap,super.disconnect()}},Sn=`_$_`,Cn=class{constructor(e){this.metadata={},this.userID=null,this.callbacks=[],this.timestamp=0,this.getPageNumber=()=>{let e=this.app.sessionStorage.getItem(this.options.session_pageno_key);if(e!=null)return parseInt(e)},this.incPageNo=()=>{let e=this.getPageNumber();return e===void 0?e=0:e++,this.app.sessionStorage.setItem(this.options.session_pageno_key,e.toString()),e},this.getSessionToken=e=>{let t=this.token||this.app.sessionStorage.getItem(this.options.session_token_key);if(e&&t){let n=t.split(Sn)[1];if(!n||n!==e){this.app.sessionStorage.removeItem(this.options.session_token_key),this.token=void 0;return}}return(t?t.split(Sn)[0]:null)||void 0},this.getRawTokenWithProject=()=>this.token||this.app.sessionStorage.getItem(this.options.session_token_key),this.setSessionToken=(e,t)=>{this.token=`${e}${Sn}${t}`,this.app.sessionStorage.setItem(this.options.session_token_key,`${e}${Sn}${t}`)},this.app=e.app,this.options=e.options,this.createTabId()}attachUpdateCallback(e){this.callbacks.push(e)}handleUpdate(e){e.userID??delete e.userID,e.sessionID??delete e.sessionID,this.callbacks.forEach(t=>t(e))}assign(e){e.userID!==void 0&&(this.userID=e.userID),e.metadata!==void 0&&Object.entries(e.metadata).forEac
94h(([e,t])=>this.metadata[e]=t),e.sessionID!==void 0&&(this.sessionID=e.sessionID),e.timestamp!==void 0&&(this.timestamp=e.timestamp),e.projectID!==void 0&&(this.projectID=e.projectID),this.handleUpdate(e)}setMetadata(e,t){this.metadata[e]=t,this.handleUpdate({metadata:{[e]:t}})}setUserID(e){this.userID=e,this.handleUpdate({userID:e})}setUserInfo(e){this.userInfo=e}applySessionHash(e){let t=decodeURI(e).split(`&`),n=e,r=`100500`;t.length==2&&([r,n]=t),!(!r||!n)&&(this.app.sessionStorage.setItem(this.options.session_token_key,n),this.app.sessionStorage.setItem(this.options.session_pageno_key,r))}getSessionHash(){let e=this.getPageNumber(),t=this.getRawTokenWithProject();if(!(e===void 0||t===void 0))return encodeURI(String(e)+`&`+t)}getTabId(){return this.tabId||this.createTabId(),this.tabId}regenerateTabId(){let e=H(12);this.app.sessionStorage.setItem(this.options.session_tabid_key,e),this.tabId=e}createTabId(){let e=this.app.sessionStorage.getItem(this.options.session_tabid_key);e?this.tabId=e:this.regenerateTabId()}getInfo(){return{sessionID:this.sessionID,metadata:this.metadata,userID:this.userID,timestamp:this.timestamp,projectID:this.projectID}}reset(){this.app.sessionStorage.removeItem(this.options.session_token_key),this.metadata={},this.userID=null,this.sessionID=void 0,this.timestamp=0}};function wn(e,t){let n=0;return()=>{n++>=t&&(n=0,e())}}var Tn=class{constructor(e){this.app=e,this.timer=null,this.callbacks=[]}attach(e,t=0,n=!0,r){r&&(e=e.bind(r)),n&&(e=this.app.safe(e)),this.callbacks.unshift(t?wn(e,t):e)-1}start(){this.timer===null&&(this.timer=setInterval(()=>this.callbacks.forEach(e=>{e&&e()}),30))}stop(){this.timer!==null&&(clearInterval(this.timer),this.timer=null)}},En='!function(){"use strict";class t{constructor(t,s,i,e=10,n=250,h,r){this.onUnauthorised=s,this.onFailure=i,this.MAX_ATTEMPTS_COUNT=e,this.ATTEMPT_TIMEOUT=n,this.onCompress=h,this.pageNo=r,this.attemptsCount=0,this.busy=!1,this.queue=[],this.token=null,this.lastBatchNum=0,this.inflightKeepaliveBytes=0,this.ingestURL=t+"/v1/web/i",this.isCompressing=void 0!==h}getQueueStatus(){return 0===this.queue.length&&!this.busy}authorise(t){this.token=t,this.busy||this.sendNext()}push(t,s="player",i){if(this.busy||!this.token)this.queue.push({batch:t,dataType:s,split:i});else if(this.busy=!0,this.isCompressing&&this.onCompress)this.onCompress(t,s,i);else{const e=++this.lastBatchNum;this.sendBatch(t,!1,e,s,i)}}sendNext(){const t=this.queue.shift();if(t)if(this.busy=!0,this.isCompressing&&this.onCompress)this.onCompress(t.batch,t.dataType,t.split);else{const s=++this.lastBatchNum;this.sendBatch(t.batch,!1,s,t.dataType,t.split)}else this.busy=!1}retry(t,s,i,e="player",n){if(this.attemptsCount>=this.MAX_ATTEMPTS_COUNT)return void this.onFailure(`Failed to send batch after ${this.attemptsCount} attempts.`);this.attemptsCount++;const h=new Uint8Array(t);setTimeout((()=>this.sendBatch(h,s,i,e,n)),this.ATTEMPT_TIMEOUT*this.attemptsCount)}sendBatch(t,s,i,e="player",n){var h,r,a;if(0===t.length)return console.error("OpenReplay: refusing to send 0-byte batch.",{batchNum:i,dataType:e,isCompressed:s,batch:t}),this.attemptsCount=0,void this.sendNext();const u=(null!==(h=null==i?void 0:i.toString())&&void 0!==h?h:"0").match(/^([^_]+)(?:_([^_]+))?/),o=null!==(r=null==u?void 0:u[1])&&void 0!==r?r:"0",l=(null==u?void 0:u[2])?u[2]:"";this.busy=!0;const c={Authorization:`Bearer ${this.token}`,DataType:e};if(s&&(c["Content-Encoding"]="gzip"),null===this.token)return void setTimeout((()=>{this.sendBatch(t,s,`${null!=i?i:"noBatchNum"}_newToken`,e,n)}),500);const d=t.length<65536&&this.inflightKeepaliveBytes+t.length<=65536;d&&(this.inflightKeepaliveBytes+=t.length);const p=()=>{d&&(this.inflightKeepaliveBytes-=t.length)},f=t.byteLength;let g=this.ingestURL;g+=`?batch=${null!==(a=this.pageNo)&&void 0!==a?a:0}`,g+=`_${o}`,g+=`_${f}`,g+="_"+(d?"kyes":"kno"),l&&(g+=`_${l}`),void 0!==n&&(g+=`&split=${n}`),fetch(g,{body:t,method:"POST",headers:c,keepalive:d}).then((h=>{var r;if(p(),null===(r=h.body)||void 0===r||r.cancel().catch((()=>{})),401===h.status)return this.busy=!1,void this.onUnauthorised();h.status>=400?this.retry(t,s,`${null!=i?i:"noBatchNum"}_network:${h.status}`,e,n):(this.attemptsCount=0,this.sendNext())})).catch((h=>{p(),console.warn("OpenReplay:",h),this.retry(t,s,`${null!=i?i:"noBatchNum"}_reject:${h.message}`,e,n)}))}sendCompressed(t,s="player",i){const e=++this.lastBatchNum;this.sendBatch(t,!0,e,s,i)}sendUncompressed(t,s="player",i){const e=++this.lastBatchNum;this.sendBatch(t,!1,e,s,i)}clean(){this.sendNext(),setTimeout((()=>{this.token=null,this.queue.length=0}),10)}}const s=new Set([60,61,71,73]),i=new Set([21,22,40,41,44,45,46,47,48,79,83,84,85,87,89,116,120,121,123]),e=new Set([17,23,24,27,28,29,30,42,63,64,78,112,115,124]),n="function"==typeof TextEncoder?new TextEncoder:{encode(t){const s=t.length,i=new Uint8Array(3*s);let e=-1;for(let n=0,h=0,r=0;r!==s;){if(n=t.charCodeAt(r),r+=1,n>=55296&&n<=56319){if(r===s){i[e+=1]=239,i[e+=1]=191,i[e+=1]=189;break}if(h=t.charCodeAt(r),!(h>=56320&&h<=57343)){i[e+=1]=239,i[e+=1]=191,i[e+=1]=189;continue}
94if(n=1024*(n-55296)+h-56320+65536,r+=1,n>65535){i[e+=1]=240|n>>>18,i[e+=1]=128|n>>>12&63,i[e+=1]=128|n>>>6&63,i[e+=1]=128|63&n;continue}}n<=127?i[e+=1]=0|n:n<=2047?(i[e+=1]=192|n>>>6,i[e+=1]=128|63&n):(i[e+=1]=224|n>>>12,i[e+=1]=128|n>>>6&63,i[e+=1]=128|63&n)}return i.subarray(0,e+1)}};class h{constructor(t){this.size=t,this.offset=0,this.checkpointOffset=0,this.data=new Uint8Array(t)}getCurrentOffset(){return this.offset}getCurrentCheckpoint(){return this.checkpointOffset}checkpoint(){this.checkpointOffset=this.offset}get isEmpty(){return 0===this.offset}skip(t){return this.offset+=t,this.offset<=this.size}set(t,s){this.data.set(t,s)}boolean(t){return this.data[this.offset++]=+t,this.offset<=this.size}uint(t){for((t<0||t>Number.MAX_SAFE_INTEGER)&&(t=0);t>=128;)this.data[this.offset++]=t%256|128,t=Math.floor(t/128);return this.data[this.offset++]=t,this.offset<=this.size}int(t){return t=Math.round(t),this.uint(t>=0?2*t:-2*t-1)}string(t){const s=n.encode(t),i=s.byteLength;return!(!this.uint(i)||this.offset+i>this.size)&&(this.data.set(s,this.offset),this.offset+=i,!0)}reset(){this.offset=0,this.checkpointOffset=0}rewind(t,s){t>this.offset||s>this.checkpointOffset||(this.offset=t,this.checkpointOffset=s)}flush(){const t=this.data.slice(0,this.checkpointOffset);return this.reset(),t}}class r extends h{encode(t){switch(t[0]){case 0:case 11:case 114:case 115:return this.uint(t[1]);case 4:case 44:case 47:return this.string(t[1])&&this.string(t[2])&&this.uint(t[3]);case 5:case 20:case 65:case 70:case 75:case 76:case 77:return this.uint(t[1])&&this.uint(t[2]);case 6:return this.int(t[1])&&this.int(t[2]);case 7:return!0;case 8:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.string(t[4])&&this.boolean(t[5]);case 9:case 10:case 24:case 35:case 51:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3]);case 12:case 52:case 61:case 71:return this.uint(t[1])&&this.string(t[2])&&this.string(t[3]);case 13:case 14:case 17:case 34:case 36:case 50:case 54:return this.uint(t[1])&&this.string(t[2]);case 16:return this.uint(t[1])&&this.int(t[2])&&this.int(t[3]);case 18:return this.uint(t[1])&&this.string(t[2])&&this.int(t[3]);case 19:return this.uint(t[1])&&this.boolean(t[2]);case 21:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4])&&this.string(t[5])&&this.uint(t[6])&&this.uint(t[7])&&this.uint(t[8]);case 22:case 27:case 30:case 41:case 45:case 46:case 43:case 63:case 64:case 79:case 124:return this.string(t[1])&&this.string(t[2]);case 23:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.uint(t[4])&&this.uint(t[5])&&this.uint(t[6])&&this.uint(t[7])&&this.uint(t[8])&&this.uint(t[9]);case 28:case 29:case 42:case 117:case 118:return this.string(t[1]);case 40:return this.string(t[1])&&this.uint(t[2])&&this.string(t[3])&&this.string(t[4]);case 48:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4])&&this.int(t[5]);case 49:return this.int(t[1])&&this.int(t[2])&&this.uint(t[3])&&this.uint(t[4]);case 53:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.uint(t[4])&&this.uint(t[5])&&this.uint(t[6])&&this.string(t[7])&&this.string(t[8]);case 55:return this.boolean(t[1]);case 57:case 60:return this.uint(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4]);case 58:case 120:return this.int(t[1]);case 68:return this.uint(t[1])&&this.uint(t[2])&&this.string(t[3])&&this.string(t[4])&&this.uint(t[5])&&this.uint(t[6]);case 69:return this.uint(t[1])&&this.uint(t[2])&&this.string(t[3])&&this.string(t[4]);case 73:return this.uint(t[1])&&this.string(t[2])&&this.uint(t[3])&&this.string(t[4]);case 78:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4]);case 81:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.int(t[4])&&this.string(t[5]);case 83:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4])&&this.string(t[5])&&this.uint(t[6])&&this.uint(t[7])&&this.uint(t[8])&&this.uint(t[9]);case 84:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.uint(t[4])&&this.string(t[5])&&this.string(t[6]);case 85:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.uint(t[4])&&this.uint(t[5])&&this.uint(t[6])&&this.string(t[7])&&this.string(t[8])&&this.uint(t[9])&&this.boolean(t[10])&&this.uint(t[11])&&this.uint(t[12])&&this.uint(t[13])&&this.uint(t[14])&&this.uint(t[15])&&this.uint(t[16])&&this.uint(t[17]);case 87:return this.string(t[1])&&this.int(t[2])&&this.int(t[3]);case 89:return this.string(t[1])&&this.int(t[2])&&this.int(t[3])&&this.int(t[4])&&this.int(t[5])&&this.string(t[6]);case 112:return this.uint(t[1])&&this.string(t[2])&&this.boolean(t[3])&&this.string(t[4])&&this.int(t[5])&&this.int(t[6]);case 113:return this.uint(t[1])&&this.uint(t[2])&&this.string(t[3]);case 116:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.uint(t[4])&&this.uint(t[5])&&this.uint(t[6])&&this.string(t[7])&&this.string(t[8])&&this.uint(t[9])&&this.boolean(t[10]);case 119:return this.string(t[1])&&this.uint(t[2]);case 121:return this.string(t[1])&&this.string(t[2])&&this.uint(t[3])&&this.uint(t[4]);case 122:return this.string(t[1])&&this.string(t[2])&&this.uint(t[3])&&this.string(t[4]);case 123:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4])&&this.uint(t[5])}}}class a{constructor(t,s,i){this.bufferSize=t,this.version=s,this.dataType=i,this.sizeBuffer=new Uint8Array(3),this.snap=null,this.hasNonTimestamp=!1,this.lastPushedTs=0,this.encoder=new r(t)}push(t,s){const i=this.encoder,e=null===this.snap,n=i.getCurrentOffset(),h=i.getCurrentCheckpoint();if(e){const t={pageNo:s.pageNo,firstIndex:s.index,timestamp:s.timestamp,url:s.url,tabId:s.tabId};if(!this.writeHeader(t))return i.rewind(n,h),!1;this.snap=t,this.lastPushedTs=s.timestamp}return 0===t[0]||s.timestamp===this.lastPushedTs||this.writeMessageWithSize([0,s.timestamp])?this.writeMessageWithSize(t)?(this.lastPushedTs=s.timestamp,0!==t[0]&&(this.hasNonTimestamp=!0),!0):(i.rewind(n,h),e&&(this.snap=null),!1):(i.rewind(n,h),!1)}hasContent(){return null!==this.snap&&this.hasNonTimestamp}size(){return null===this.snap?0:this.encoder.getCurrentOffset()}flush(){if(!this.hasContent())return this.reset(),null;const t=this.encoder.flush();return this.snap=null,this.hasNonTimestamp=!1,this.lastPushedTs=0,t}reset(){this.encoder.reset(),this.snap=null,this.hasNonTimestamp=!1,this.lastPushedTs=0}writeHeader(t){const s=this.encoder,i=[81,this.version,t.pageNo,t.firstIndex,t.timestamp,t.url];return!!s.uint(i[0])&&(!!s.encode(i)&&(!(s.getCurrentOffset()>this.bufferSize)&&(s.checkpoint(),!!this.writeMessageWithSize([0,t.timestamp])&&!!this.writeMessageWithSize([118,t.tabId])
94)))}writeMessageWithSize(t){const s=this.encoder;if(!s.uint(t[0])||!s.skip(3))return!1;const i=s.getCurrentOffset();if(!s.encode(t))return!1;const e=s.getCurrentOffset(),n=e-i;return n>16777215?(console.warn("OpenReplay: max message size overflow."),!1):!(e>this.bufferSize)&&(this.writeSizeAt(n,i-3),s.checkpoint(),!0)}writeSizeAt(t,s){for(let s=0;s<3;s++)this.sizeBuffer[s]=t>>8*s;this.encoder.set(this.sizeBuffer,s)}}class u{constructor(t,s,i,e,n,h,r=!1,u){this.pageNo=t,this.timestamp=s,this.url=i,this.onBatch=e,this.tabId=n,this.onOfflineEnd=h,this.localDebug=r,this.onLocalSave=u,this.nextIndex=0,this.beaconSize=2e5,this.beaconSizeLimit=1e6,this.protocolVersion=1,this.visualSent=!1,this.signalSeen=!1,this.heldOther=[],this.playerBuilder=new a(this.beaconSize,this.playerVersion(),"player"),this.assetBuilder=new a(this.beaconSize,3,"assets"),this.devtoolsBuilder=new a(this.beaconSize,4,"devtools"),this.analyticsBuilder=new a(this.beaconSize,5,"analytics")}initActive(){return 2===this.protocolVersion&&!this.visualSent}playerVersion(){return 2===this.protocolVersion?2:1}currentCtx(){return{pageNo:this.pageNo,index:this.nextIndex,timestamp:this.timestamp,url:this.url,tabId:this.tabId}}setBeaconSizeLimit(t){this.beaconSizeLimit=t}setProtocolVersion(t){if(this.protocolVersion!==t){if(this.protocolVersion=t,2===t&&!this.signalSeen)return this.playerBuilder.reset(),this.assetBuilder.reset(),this.playerBuilder=new a(this.beaconSizeLimit,this.playerVersion(),"player"),void(this.assetBuilder=new a(this.beaconSizeLimit,3,"assets"));2===t&&(this.visualSent=!0),this.playerBuilder.reset(),this.playerBuilder=new a(this.beaconSize,this.playerVersion(),"player")}}writeMessage(t){if(-1===t[0])return this.finaliseBatch(),this.onOfflineEnd();if(12===t[0]&&"orloaded"===t[2])return void(this.initActive()?this.finalizeVisual():this.signalSeen=!0);0===t[0]&&(this.timestamp=t[1]),122===t[0]&&(this.url=t[1]);const s=this.routeMessage(t);this.pushTo(s,t)}routeMessage(t){if(2===this.protocolVersion){const n=t[0];if(s.has(n))return this.assetBuilder;if(i.has(n))return this.devtoolsBuilder;if(e.has(n))return this.analyticsBuilder}return this.playerBuilder}pushTo(t,s){const i=this.currentCtx();if(this.initActive())return void this.pushDuringInit(t,s,i);if(t.push(s,i))return void this.nextIndex++;if(t===this.assetBuilder&&this.flushBuilder(this.playerBuilder),this.flushBuilder(t),t.push(s,i))return void this.nextIndex++;const e=new a(this.beaconSizeLimit,t.version,t.dataType);if(!e.push(s,i))return void console.warn("OpenReplay: beacon size overflow. Skipping large message.",s);this.nextIndex++;const n=e.flush();n&&(t===this.assetBuilder&&this.flushBuilder(this.playerBuilder),this.emitBatch(n,t.dataType,!1))}pushDuringInit(t,s,i){const e=t===this.playerBuilder||t===this.assetBuilder;if(t.push(s,i))return this.nextIndex++,void(e&&this.playerBuilder.size()+this.assetBuilder.size()>=this.beaconSizeLimit&&this.finalizeVisual());if(e)return this.finalizeVisual(),void this.pushTo(this.routeMessage(s),s);if(this.flushBuilderToHeld(t),t.push(s,i))return void this.nextIndex++;const n=new a(this.beaconSizeLimit,t.version,t.dataType);if(!n.push(s,i))return void console.warn("OpenReplay: beacon size overflow. Skipping large message.",s);this.nextIndex++;const h=n.flush();h&&this.heldOther.push({batch:h,dataType:t.dataType})}flushBuilderToHeld(t){const s=t.flush();s&&this.heldOther.push({batch:s,dataType:t.dataType})}finalizeVisual(t=!1){const s=this.playerBuilder.flush(),i=this.assetBuilder.flush();if(this.visualSent=!0,this.playerBuilder=new a(this.beaconSize,this.playerVersion(),"player"),this.assetBuilder=new a(this.beaconSize,3,"assets"),s&&i){const e=new Uint8Array(s.length+i.length);e.set(s,0),e.set(i,s.length),this.emitBatch(e,"visual",t,s.length)}else s?this.emitBatch(s,"player",t):i&&this.emitBatch(i,"assets",t);for(const s of this.heldOther)this.emitBatch(s.batch,s.dataType,t);this.heldOther.length=0,this.flushBuilder(this.devtoolsBuilder,t),this.flushBuilder(this.analyticsBuilder,t)}flushBuilder(t,s=!1){const i=t.flush();return!!i&&(this.emitBatch(i,t.dataType,s),!0)}emitBatch(t,s,i,e){this.localDebug&&this.onLocalSave&&this.onLocalSave(`${s}-${Date.now()}`,t.slice()),this.onBatch(t,i,s,e)}finaliseBatch(t=!1){this.initActive()?this.finalizeVisual(t):(this.flushBuilder(this.playerBuilder,t),this.flushBuilder(this.assetBuilder,t),this.flushBuilder(this.devtoolsBuilder,t),this.flushBuilder(this.analyticsBuilder,t))}clean(){this.playerBuilder.reset(),this.assetBuilder.reset(),this.devtoolsBuilder.reset(),this.analyticsBuilder.reset(),this.heldOther.length=0,this.visualSent=!1,this.signalSeen=!1}}var o;
94!function(t){t[t.NotActive=0]="NotActive",t[t.Starting=1]="Starting",t[t.Stopping=2]="Stopping",t[t.Active=3]="Active",t[t.Stopped=4]="Stopped"}(o||(o={}));let l=null,c=null,d=o.NotActive;function p(t){c&&c.finaliseBatch(t)}function f(){return new Promise((t=>{d=o.Stopping,null!==y&&(clearInterval(y),y=null),c&&(c.clean(),c=null),l&&(l.clean(),setTimeout((()=>{l=null}),20)),setTimeout((()=>{d=o.NotActive,t(null)}),100)}))}function g(){[o.Stopped,o.Stopping].includes(d)||(postMessage("a_stop"),f().then((()=>{postMessage("a_start")})))}let m,y=null;self.onmessage=({data:s})=>{var i;if("stop"===s)return p(),void f().then((()=>{d=o.Stopped}));if("forceFlushBatch"!==s)if("closing"!==s){if(!Array.isArray(s)){if("compressed"===s.type){if(!l)return console.debug("OR WebWorker: sender not initialised. Compressed batch."),void g();s.batch&&l.sendCompressed(s.batch,s.dataType,s.split)}if("uncompressed"===s.type){if(!l)return console.debug("OR WebWorker: sender not initialised. Uncompressed batch."),void g();s.batch&&l.sendUncompressed(s.batch,s.dataType,s.split)}return"start"===s.type?(d=o.Starting,l=new t(s.ingestPoint,(()=>{g()}),(t=>{!function(t){postMessage({type:"failure",reason:t}),f()}(t)}),s.connAttemptCount,s.connAttemptGap,((t,s,i)=>{postMessage({type:"compress",batch:t,dataType:s,split:i},[t.buffer])}),s.pageNo),c=new u(s.pageNo,s.timestamp,s.url,((t,s,i="player",e)=>{l&&(s?l.sendUncompressed(t,i,e):l.push(t,i,e))}),s.tabId,(()=>postMessage({type:"queue_empty"})),null!==(i=s.localDebug)&&void 0!==i&&i,((t,s)=>{postMessage({type:"local_save",name:t,batch:s},[s.buffer])})),null===y&&(y=setInterval(p,3e4)),d=o.Active):"auth"===s.type?l?c?(l.authorise(s.token),s.beaconSizeLimit&&c.setBeaconSizeLimit(s.beaconSizeLimit),void(s.protocolVersion&&c.setProtocolVersion(s.protocolVersion))):(console.debug("OR WebWorker: writer not initialised. Received auth."),void g()):(console.debug("OR WebWorker: sender not initialised. Received auth."),void g()):void 0}if(c){const t=c;s.forEach((s=>{55===s[0]&&(s[1]?m=setTimeout((()=>g()),18e5):clearTimeout(m)),t.writeMessage(s)}))}else postMessage("not_init"),g()}else p(!0);else p()}}();\n',Dn=`canceled`,On=`or_buffer_1`,kn=e=>({reason:e,success:!1}),An=e=>({...e,success:!0}),jn;(function(e){e[e.NotActive=0]=`NotActive`,e[e.Starting=1]=`Starting`,e[e.Active=2]=`Active`,e[e.ColdStart=3]=`ColdStart`})(jn||={});var Mn=`https://api.openreplay.com/ingest`;function Nn(){let e=new Date().getTimezoneOffset()*-1,t=e>=0?`+`:`-`,n=Math.floor(Math.abs(e)/60),r=Math.abs(e)%60;return`UTC${t}${String(n).padStart(2,`0`)}:${String(r).padStart(2,`0`)}`}var Pn=e=>new Promise(t=>setTimeout(t,e)),Fn={ask:`never-gonna-give-you-up`,resp:`never-gonna-let-you-down`,reg:`never-gonna-run-around-and-desert-you`,iframeSignal:`tracker inside a child iframe`,iframeId:`getting node id for child iframe`,iframeBatch:`batch of messages from an iframe window`,parentAlive:`signal that parent is live`,killIframe:`stop tracker inside frame`,startIframe:`start tracker inside frame`,iframeDebug:`iframe debug snapshot`,polling:`hello-how-are-you-im-under-the-water-please-help-me`,reset:`reset-your-session-please`},In=Object.fromEntries(Object.entries(Fn).map(([e,t])=>[t,e])),Ln=class{get tagMatcher(){return this.tagWatcher.matcher}constructor(e,t,n,r,i){this.signalError=r,this.insideIframe=i,this.resanitizeCallbacks=[],this.messages=[],this.bufferedMessages1=[],this.bufferedMessages2=[],this.startCallbacks=[],this.stopCallbacks=[],this.commitCallbacks=[],this.activityState=jn.NotActive,this.version=`18.1.3`,this.socketMode=!1,this.compressionThreshold=24*1e3,this.bc=null,this.canvasRecorder=null,this.conditionsManager=null,this.canStart=!1,this.rootId=null,this.pageFrames=[],this.frameOderNumber=0,this.frameLevel=0,this.emptyBatchCounter=0,this.lastHiddenAt=null,this.parentActive=!1,this.checkStatus=()=>this.parentActive,this.lastTokenReceived=null,this.lastParentMsgAt=0,this.lastSentToParentAt=0,this.iframeDebugInterval=null,this.emitIframeDebug=()=>{if(!this.insideIframe||!this.options.crossdomain?.enabled)return;let e=Date.now(),t=t=>t?e-t:null,n={ctx:this.contextId,active:this.active(),state:jn[this.activityState],parentActive:this.parentActive,rootId:this.rootId,frameOrder:this.frameOderNumber,token:this.lastTokenReceived?{tok:this.lastTokenReceived.tok,agoMs:e-this.lastTokenReceived.at}:null,lastParentMsgAgoMs:t(this.lastParentMsgAt),lastSentToParentAgoMs:t(this.lastSentToParentAt)},r=JSON.stringify(n),i;try{i=btoa(r)}catch{i=r}try{window.parent.postMessage({line:Fn.iframeDebug,context:this.contextId,debug:i},this.options.crossdomain?.parentDomain??`*`),this.markSentToParent()}catch(e){this.debug.error(`iframe debug post failed`,e)}},this.parentCrossDomainFrameListener=e=>{let{data:t}=e;
94if(!(!t||e.source===window)){if((t.line===Fn.startIframe||t.line===Fn.parentAlive||t.line===Fn.iframeId||t.line===Fn.killIframe)&&(this.lastParentMsgAt=Date.now()),t.line===Fn.startIframe){if(this.activityState===jn.Starting)return;try{this.active()&&this.stop(),t.token&&(this.session.setSessionToken(t.token,this.projectKey),this.lastTokenReceived={tok:String(t.token).slice(-8),at:Date.now()}),t.id!==void 0&&(this.rootId=t.id),this.allowAppStart(),this.start()}catch(e){console.error(`children frame restart failed:`,e)}}t.line===Fn.parentAlive&&(this.parentActive=!0),t.line===Fn.iframeId&&(this.parentActive=!0,this.rootId=t.id,this.session.setSessionToken(t.token,this.projectKey),this.lastTokenReceived={tok:String(t.token).slice(-8),at:Date.now()},this.frameOderNumber=t.frameOrderNumber,this.frameLevel=t.frameLevel,this.debug.log(`starting iframe tracking`,t),this.allowAppStart()),t.line===Fn.killIframe&&this.active()&&this.stop()}},this.trackedFrames=[],this.everTrackedFrames=new Set,this.frameLastSeen=new Map,this.frameOrigin=new Map,this.frameAnyLastSeen=new Map,this.frameBatchLastSeen=new Map,this.frameLastSent=new Map,this.xdomainDebugInterval=null,this.reAdoptCooldown=new Map,this.RE_ADOPT_COOLDOWN_MS=2e3,this.frameAlloc=new Map,this.usedOrdersByLevel=new Map,this.FRAME_STALE_MS=1500,this.XDOMAIN_DEBUG_RETENTION_MS=10*6e4,this.emitCrossdomainDebug=()=>{if(this.insideIframe||!this.options.crossdomain?.enabled||!this.active())return;let e=Date.now(),t=t=>t===void 0?null:e-t,n=new Set(this.trackedFrames),r=new Set([...this.trackedFrames,...this.frameAnyLastSeen.keys(),...this.frameLastSent.keys()]),i=Array.from(r).map((r,i)=>{let a=this.frameLastSent.get(r),o=this.frameAlloc.get(r);return{n:o?o.order:i+1,level:o?o.level:null,id:this.frameOrigin.get(r)||r||`#${i+1}`,tracked:n.has(r),lastAnyMsgAgoMs:t(this.frameAnyLastSeen.get(r)),lastBatchAgoMs:t(this.frameBatchLastSeen.get(r)),lastSent:a?{line:a.line,agoMs:e-a.t}:null}}),a=e-this.XDOMAIN_DEBUG_RETENTION_MS;for(let e of r){if(n.has(e))continue;let t=this.frameAnyLastSeen.get(e)??0,r=this.frameLastSent.get(e)?.t??0;Math.max(t,r)<a&&(this.frameOrigin.delete(e),this.frameAnyLastSeen.delete(e),this.frameBatchLastSeen.delete(e),this.frameLastSent.delete(e),this.reAdoptCooldown.delete(e),this.everTrackedFrames.delete(e),this.freeFrameOrder(e))}let o={t:e,count:i.length,frames:i},s=JSON.stringify(o),c;try{c=btoa(s)}catch{c=s}this.send(ye(`info`,`[OR_XDOMAIN_DEBUG] ${c}`))},this.crossDomainIframeListener=e=>{if(e.source===window)return;let{data:t}=e;if(t&&(t.context&&(this.frameAnyLastSeen.set(t.context,Date.now()),e.origin&&!this.frameOrigin.has(t.context)&&this.frameOrigin.set(t.context,e.origin)),(t.line===Fn.polling||t.line===Fn.iframeSignal)&&t.context&&this.frameLastSeen.set(t.context,Date.now()),this.active())){if(t.line===Fn.iframeDebug){this.send(ye(`info`,`[OR_XDOMAIN_IFRAME_DEBUG] ${t.debug}`));return}if(t.line===Fn.iframeSignal&&(e.source?.postMessage({ping:!0,line:Fn.parentAlive},`*`),this.recordSentToFrame(t.context,Fn.parentAlive),(async()=>{if(e.source===null)return console.error(`Couldnt connect to event.source for child iframe tracking`);let n=await this.checkNodeId(e.source);if(!n){this.debug.log(`Couldnt get node id for iframe`,e.source);return}try{this.trackedFrames.includes(t.context)?this.debug.log(`Trying to observe already added iframe; ignore if its a restart`):this.trackedFrames.push(t.context),this.everTrackedFrames.add(t.context),await this.waitStarted();let r=this.session.getSessionToken(this.projectKey),i=this.frameLevel+1,a=this.allocateFrameOrder(t.context,i),o={line:Fn.iframeId,id:n,token:r,frameOrderNumber:a,frameLevel:i};this.debug.log(`Got child frame signal; nodeId`,n,e.source,o),e.source?.postMessage(o,`*`),this.recordSentToFrame(t.context,Fn.iframeId)}catch(e){console.error(e)}})()),t.line===Fn.iframeBatch){t.context&&this.frameBatchLastSeen.set(t.context,Date.now());let n=t.messages,r=[];n.forEach(t=>{if(t[0]===20){let n=t;this.pageFrames.forEach(r=>{if(r.contentWindow===e.source){let[e,i,a]=t,{left:o,top:s}=r.getBoundingClientRect();n=[e,i+o,a+s]}}),r.push(n)}if(t[0]===68){let n=t;
94this.pageFrames.forEach(r=>{if(r.contentWindow===e.source){let[e,i,a,o,s,c,l]=t,{left:u,top:d,width:f,height:p}=r.getBoundingClientRect(),m=document.documentElement.scrollWidth,h=document.documentElement.scrollHeight,g=c/100*f+u,_=l/100*p+d,v=g/m,y=_/h;n=[e,i,a,o,s,Math.round(v*1e3)/10,Math.round(y*1e3)/10]}}),r.push(n)}[28,29,30].includes(t[0])||r.push(t)}),this.messages.push(...r)}if(t.line===Fn.polling){if(t.context&&this.everTrackedFrames.has(t.context)&&!this.trackedFrames.includes(t.context)){this.reAdoptOrphanFrame(e,t.context);return}if(!this.pollingQueue.order.length)return;this.pruneStaleFrames();let n=new Set(this.trackedFrames);for(;this.pollingQueue.order.length>0;){let e=this.pollingQueue.order[0];if(this.pollingQueue[e]=this.pollingQueue[e].filter(e=>n.has(e)),this.pollingQueue[e].length===0)delete this.pollingQueue[e],this.pollingQueue.order.shift();else break}if(!this.pollingQueue.order.length)return;let r=this.pollingQueue.order[0];if(this.pollingQueue[r].includes(t.context)){this.pollingQueue[r]=this.pollingQueue[r].filter(e=>e!==t.context);let n={line:r};if(r===Fn.startIframe){n.token=this.session.getSessionToken(this.projectKey);let t=this.pageFrames.find(t=>t.contentWindow===e.source)||Array.from(document.querySelectorAll(`iframe`)).find(t=>t.contentWindow===e.source);if(t){let e=t[this.options.node_id];e!==void 0&&(n.id=e)}}e.source?.postMessage(n,`*`),this.recordSentToFrame(t.context,r),this.pollingQueue[r].length===0&&(delete this.pollingQueue[r],this.pollingQueue.order.shift())}}}},this.pollingQueue={order:[]},this.addCommand=e=>{if(this.pruneStaleFrames(),this.pollingQueue[e]){this.pollingQueue[e]=Array.from(new Set([...this.pollingQueue[e],...this.trackedFrames]));return}this.pollingQueue.order.push(e),this.pollingQueue[e]=[...this.trackedFrames]},this.bootChildrenFrames=async()=>{await this.waitStarted(),this.addCommand(Fn.startIframe)},this.killChildrenFrames=()=>{this.addCommand(Fn.killIframe)},this.signalIframeTracker=()=>{let e=this.session.getTabId();window.parent.postMessage({line:Fn.iframeSignal,source:e,context:this.contextId},this.options.crossdomain?.parentDomain??`*`),this.markSentToParent();let t=0,n=250,r=0,i=!1,a=()=>{if(i||this.checkStatus()){i=!0;return}window.parent.postMessage({line:Fn.iframeSignal,source:e,context:this.contextId},this.options.crossdomain?.parentDomain??`*`),this.markSentToParent(),this.debug.info(`Trying to signal to parent, attempt:`,t+1),t++};for(let e=0;e<10;e++){if(this.checkStatus()){i=!0;break}r+=n,setTimeout(()=>{a()},r),n*=1.5}},this.startTimeout=null,this.restart=(e=!1)=>{this.stop(!1),this.waitStatus(jn.NotActive).then(()=>{this.allowAppStart();let t=e?{...this.prevOpts,forceNew:!0}:this.prevOpts;this.start(t,!0).then(t=>{e&&(this.prevOpts={...this.prevOpts,forceNew:!1}),this.debug.info(`Session restart`,t)}).catch(e=>{this.debug.error(`Session restart failed`,e)})})},this.handlePageShow=e=>{if(!(!e||!e.persisted)&&this.activityState!==jn.NotActive)try{let e=this.lastHiddenAt==null?null:Date.now()-this.lastHiddenAt;this.lastHiddenAt=null;let t=this.options.bfcacheRestartThreshold??1800*1e3;e===null||e>=t?(this.debug.info(`OpenReplay: restarting session after bfcache restore`,{frozenMs:e}),this.restart(!0)):this.debug.info(`OpenReplay: resuming session after bfcache restore`,{frozenMs:e})}catch(e){this._debug(`bfcache_restore`,e)}},this.send=(e,t=!1)=>{this.activityState!==jn.NotActive&&(this.activityState===jn.ColdStart?(this.bufferedMessages1.push(e),this.singleBuffer||this.bufferedMessages2.push(e),this.conditionsManager?.processMessage(e)):this.messages.push(e),this.activityState===jn.Active&&t&&this.commit())},this.coldStartCommitN=0,this.delay=0,this.attachStartCallback=(e,t=!1)=>{t&&(e=this.safe(e)),this.startCallbacks.push(e)},this.attachStopCallback=(e,t=!1)=>{t&&(e=this.safe(e)),this.stopCallbacks.push(e)},this.attachEventListener=(e,t,n,r=!0,i=!0)=>{r&&(n=this.safe(n)),this.attachStartCallback(()=>e?ee(e,t,n,i,this.options.forceNgOff):null,r),this.attachStopCallback(()=>e?te(e,t,n,i,this.options.forceNgOff):null,r)},this.coldInterval=null,this.orderNumber=0,this.coldStartTs=0,this.singleBuffer=!1,this.onSessionSent=()=>{},this.prevOpts={},this.restartCanvasTracking=()=>{this.canvasRecorder?.restartTracking()},this.attachResanitizeCallback=e=>{this.resanitizeCallbacks.push(e)},this.callResanitizeCallbacks=(e,t)=>{this.resanitizeCallbacks.forEach(n=>n(e,t))},this.resanitize=e=>{let t=e??(S?document.documentElement:void 0);t&&this.observer.resanitizeSubtree(t)},this.checkSanitization=e=>{let t=this.nodes.getID(e);if(t!==void 0)return this.sanitizer.getLevel(t)}
94,this.flushBuffer=async e=>new Promise((t,n)=>{if(e.length===0){t(null);return}let r=1;for(;r<e.length&&e[r][0]!==0;)r++;re(()=>{try{let n=e.splice(0,r);this.postToWorker(n.map(e=>[...e])),t(null)}catch(e){this._debug(`flushBuffer`,e),n(Error(`flushBuffer failed`))}})}),this.contextId=Math.random().toString(36).slice(2),this.projectKey=e,this.networkOptions=n.network;let a={revID:``,node_id:`__openreplay_id`,session_token_key:`__openreplay_token`,session_pageno_key:`__openreplay_pageno`,session_reset_key:`__openreplay_reset`,session_tabid_key:`__openreplay_tabid`,local_uuid_key:`__openreplay_uuid`,ingestPoint:Mn,resourceBaseHref:null,__is_snippet:!1,__debug_report_edp:null,__debug__:jt.Silent,__local_debug:!1,localStorage:null,sessionStorage:null,forceSingleTab:!1,bfcacheRestartThreshold:1800*1e3,assistSocketHost:``,captureIFrames:!0,obscureTextEmails:!1,obscureTextNumbers:!1,disableStringDict:!1,crossdomain:{parentDomain:`*`},canvas:{disableCanvas:!1,fixedCanvasScaling:!1,__save_canvas_locally:!1,useAnimationFrame:!1},forceNgOff:!1,inlineCss:_n.Unset,disableSprites:!1,disableThrottling:!1};if(this.options=K(a,n),!this.insideIframe&&!this.options.forceSingleTab&&globalThis&&`BroadcastChannel`in globalThis){let e=location.hostname.split(`.`).slice(-2).join(`_`);this.bc=new BroadcastChannel(`rick_${e}`)}else this.options.forceSingleTab&&this.allowAppStart();this.revID=this.options.revID,this.localStorage=this.options.localStorage??window.localStorage,this.sessionStorage=this.options.sessionStorage??window.sessionStorage,this.sanitizer=new rn({app:this,options:n}),this.nodes=new qt({node_id:this.options.node_id,forceNgOff:!!n.forceNgOff,maintainer:this.options.nodes?.maintainer}),this.observer=new xn({app:this,options:n}),this.ticker=new Tn(this),this.ticker.attach(()=>this.commit()),this.debug=new Mt(this.options.__debug__),this.session=new Cn({app:this,options:this.options}),this.attributeSender=new _({app:this,isDictDisabled:!!(this.options.disableStringDict||this.options.crossdomain?.enabled)}),this.tagWatcher=new _t({sessionStorage:this.sessionStorage,errLog:this.debug.error,onTag:e=>this.send(rt(e))}),this.session.attachUpdateCallback(({userID:e,metadata:t})=>{if(e!=null){if(!e||typeof e!=`string`||e.trim().length===0){this.debug.warn(`Invalid userID (must be type string), ignoring.`);return}this.send(Ce(e))}t!=null&&Object.entries(t).forEach(([e,t])=>this.send(Te(e,t)))}),t!=null&&this.session.applySessionHash(t);let o=this.session.getTabId();this.insideIframe?(window.addEventListener(`message`,this.parentCrossDomainFrameListener),window.addEventListener(`message`,this.crossDomainIframeListener),setInterval(()=>{window.parent.postMessage({line:Fn.polling,context:this.contextId},n.crossdomain?.parentDomain??`*`),this.markSentToParent()},250),this.iframeDebugInterval&&clearInterval(this.iframeDebugInterval),this.iframeDebugInterval=setInterval(this.emitIframeDebug,6e4)):(this.initWorker(),window.addEventListener(`message`,this.crossDomainIframeListener),this.options.crossdomain?.enabled&&(this.xdomainDebugInterval&&clearInterval(this.xdomainDebugInterval),this.xdomainDebugInterval=setInterval(this.emitCrossdomainDebug,6e4))),this.bc!==null&&(this.bc.postMessage({line:Fn.ask,source:o,context:this.contextId,projectKey:this.projectKey}),this.startTimeout=setTimeout(()=>{this.allowAppStart()},250),this.bc.onmessage=e=>{if(e.data.context===this.contextId||this.projectKey!==e.data.projectKey){this.debug.log(`same ctx event`,e);return}if(this.debug.log(e),e.data.line===Fn.resp){let t=e.data.token;this.session.setSessionToken(t,this.projectKey),this.adoptSessionVersion(e.data.version),this.allowAppStart()}if(e.data.line===Fn.reg){let t=e.data.token;this.session.regenerateTabId(),this.session.setSessionToken(t,this.projectKey),this.adoptSessionVersion(e.data.version),this.allowAppStart()}if(e.data.line===Fn.ask){let t=this.session.getSessionToken(this.projectKey);t&&this.bc&&this.bc.postMessage({line:e.data.source===o?Fn.reg:Fn.resp,token:t,version:this.getSessionVersionHash(),source:o,context:this.contextId,projectKey:this.projectKey})}if(e.data.line===Fn.reset){let t=e.data.token;this.debug.log(`Received reset signal from another tab`),this.session.setSessionToken(t,this.projectKey),this.restart()}})}markSentToParent(){this.lastSentToParentAt=Date.now()}allocateFrameOrder(e,t){let n=this.frameAlloc.get(e);if(n!==void 0)return n.order;let r=this.usedOrdersByLevel.get(t);r||(r=new Set,this.usedOrdersByLevel.set(t,r));let i=-1;for(let e=1;e<=Wt;
94e++)if(!r.has(e)){i=e;break}if(i===-1){let n=null,r=1/0,a=new Set(this.trackedFrames);this.frameAlloc.forEach((e,i)=>{if(e.level!==t||a.has(i))return;let o=this.frameAnyLastSeen.get(i)??0;o<r&&(r=o,n=i)}),n===null?(i=Wt,this.debug.error(`OR: frame order overflow, reusing max order for`,e)):(i=this.frameAlloc.get(n).order,this.frameAlloc.delete(n),this.debug.error(`OR: frame order space exhausted, evicting`,n,`for`,e))}return r.add(i),this.frameAlloc.set(e,{order:i,level:t}),i}freeFrameOrder(e){let t=this.frameAlloc.get(e);t&&(this.frameAlloc.delete(e),this.usedOrdersByLevel.get(t.level)?.delete(t.order))}pruneStaleFrames(){let e=Date.now()-this.FRAME_STALE_MS;this.trackedFrames=this.trackedFrames.filter(t=>{let n=this.frameLastSeen.get(t);return n!==void 0&&n>=e?!0:(this.frameLastSeen.delete(t),!1)})}recordSentToFrame(e,t){e&&this.frameLastSent.set(e,{line:In[t]??t,t:Date.now()})}reAdoptOrphanFrame(e,t){let n=Date.now();if(n-(this.reAdoptCooldown.get(t)??0)<this.RE_ADOPT_COOLDOWN_MS)return;this.reAdoptCooldown.set(t,n);let r={line:Fn.startIframe,token:this.session.getSessionToken(this.projectKey)},i=this.pageFrames.find(t=>t.contentWindow===e.source)||Array.from(document.querySelectorAll(`iframe`)).find(t=>t.contentWindow===e.source);if(i){let e=i[this.options.node_id];e!==void 0&&(r.id=e)}e.source?.postMessage(r,`*`),this.recordSentToFrame(t,Fn.startIframe),this.debug.log(`Re-adopting orphaned crossdomain iframe`,t)}allowAppStart(){this.canStart=!0,this.startTimeout&&=(clearTimeout(this.startTimeout),null)}async checkNodeId(e){let t;if(this.pageFrames.length>0&&(t=this.pageFrames.find(t=>t.contentWindow===e)),!t||!this.pageFrames.length){let n=Array.from(document.querySelectorAll(`iframe`));this.pageFrames=n,t=n.find(t=>t.contentWindow===e)}if(!t)return null;let n=0;for(;n<100;){let e=t[this.options.node_id];if(e!==void 0)return n=100,e;n++,await Pn(100)}return null}initWorker(){try{this.worker=new Worker(URL.createObjectURL(new Blob([En],{type:`text/javascript`}))),this.worker.onerror=e=>{this._debug(`webworker_error`,e)},this.worker.onmessage=({data:e})=>{this.handleWorkerMsg(e)};let e=!1,t=()=>{e||(e=!0,setTimeout(()=>{e=!1},500),this.worker&&this.worker.postMessage(`closing`))};this.attachEventListener(document.body,`mouseleave`,t,!1,!1),this.attachEventListener(window,`pagehide`,()=>{this.lastHiddenAt=Date.now(),t()},!1,!1),this.attachEventListener(window,`pageshow`,this.handlePageShow,!1,!1),this.attachEventListener(document,`visibilitychange`,e=>document.visibilityState===`hidden`&&t(),!1)}catch(e){this._debug(`worker_start`,e)}}handleWorkerMsg(e){if(e===`a_stop`)this.stop(!1);else if(e===`a_start`)this.waitStatus(jn.NotActive).then(()=>{this.allowAppStart(),this.start(this.prevOpts,!0).then(e=>{this.debug.info(`Worker restart, session too long`,e)}).catch(e=>{this.debug.error(`Worker restart failed`,e)})});else if(e===`not_init`)this.debug.warn(`OR WebWorker: writer not initialised. Restarting tracker`);else if(e.type===`failure`)this.stop(!1),this.debug.error(`worker_failed`,e.reason),this._debug(`worker_failed`,e.reason);else if(e.type===`compress`){let t=e.batch,n=e.dataType,r=e.split,i=t.byteLength,a=`CompressionStream`in globalThis;if(i>this.compressionThreshold&&a){let e=new Blob([t]).stream().pipeThrough(new CompressionStream(`gzip`));new Response(e).arrayBuffer().then(e=>{this.worker?.postMessage({type:`compressed`,batch:new Uint8Array(e),dataType:n,split:r})}).catch(e=>{this.debug.error(`Openreplay compression error:`,e),this.worker?.postMessage({type:`uncompressed`,batch:t,dataType:n,split:r})})}else this.worker?.postMessage({type:`uncompressed`,batch:t,dataType:n,split:r})}else if(e.type===`local_save`){let t=new Blob([e.batch],{type:`application/octet-stream`}),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=e.name,r.click(),URL.revokeObjectURL(n)}else e.type===`queue_empty`&&this.onSessionSent()}_debug(e,t){this.options.__debug_report_edp!==null&&fetch(this.options.__debug_report_edp,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({context:e,error:`${t}`})}),this.debug.error(`OpenReplay error: `,e,t)}_nCommit(){if(this.socketMode){this.messages.unshift(q(this.timestamp()),tt(this.session.getTabId())),this.commitCallbacks.forEach(e
94=>e(this.messages)),this.messages.length=0;return}if(this.insideIframe){window.parent.postMessage({line:Fn.iframeBatch,messages:this.messages,context:this.contextId},this.options.crossdomain?.parentDomain??`*`),this.markSentToParent(),this.commitCallbacks.forEach(e=>e(this.messages)),this.messages.length=0;return}if(this.worker!==void 0){if(!this.messages.length){if(this.emptyBatchCounter<1e3){this.emptyBatchCounter++;return}this.emptyBatchCounter=0;try{this.worker?.postMessage([q(this.timestamp()),tt(this.session.getTabId())])}catch(e){this._debug(`worker_keepalive`,e)}return}this.emptyBatchCounter=0;try{re(()=>{this.messages.length&&(this.messages.unshift(q(this.timestamp()),tt(this.session.getTabId())),this.worker?.postMessage(this.messages),this.commitCallbacks.forEach(e=>e(this.messages)),this.messages.length=0)})}catch(e){this._debug(`worker_commit`,e),this.stop(!0),setTimeout(()=>{this.start()},500)}}}_cStartCommit(){if(this.coldStartCommitN+=1,this.coldStartCommitN===2){let e=[q(this.timestamp()),tt(this.session.getTabId())];this.bufferedMessages1.push(...e),this.bufferedMessages2.push(...e),this.coldStartCommitN=0}}commit(){this.activityState===jn.ColdStart?this._cStartCommit():this._nCommit()}postToWorker(e){this.worker?.postMessage(e),this.commitCallbacks.forEach(t=>t(e))}timestamp(){return O()+this.delay}safe(e){let t=this;return function(...n){try{e.apply(this,n)}catch(e){t._debug(`safe_fn_call`,e)}}}attachCommitCallback(e){this.commitCallbacks.push(e)}checkRequiredVersion(e){let t=e.split(/[.-]/),n=this.version.split(/[.-]/);for(let e=0;e<3;e++){if(isNaN(Number(n[e]))||isNaN(Number(t[e])))return!1;if(Number(n[e])>Number(t[e]))return!0;if(Number(n[e])<Number(t[e]))return!1}return!0}getTrackerInfo(){return{userUUID:this.localStorage.getItem(this.options.local_uuid_key),projectKey:this.projectKey,revID:this.revID,trackerVersion:this.version,isSnippet:this.options.__is_snippet}}getSessionInfo(){return{...this.session.getInfo(),...this.getTrackerInfo()}}getSessionToken(){return this.session.getSessionToken(this.projectKey)}getSessionID(){return this.session.getInfo().sessionID||void 0}getSessionURL(e){let{projectID:t,sessionID:n,timestamp:r}=this.session.getInfo();if(!t||!n){this.debug.error(`OpenReplay error: Unable to build session URL`);return}let i=this.options.ingestPoint,a=(/api\.openreplay\.com/.test(i)?`https://app.openreplay.com/ingest`:i).replace(/ingest$/,`${t}/session/${n}`);return e?.withCurrentTime?`${a}?jumpto=${O()-r}`:a}getHost(){return new URL(this.options.ingestPoint).host}getProjectKey(){return this.projectKey}getBaseHref(){return typeof this.options.resourceBaseHref==`string`?this.options.resourceBaseHref:(this.options.resourceBaseHref,document.baseURI?document.baseURI:document.head?.getElementsByTagName(`base`)[0]?.getAttribute(`href`)||location.origin+location.pathname)}resolveResourceURL(e){let t=new URL(this.getBaseHref());
94return t.pathname+=`/`+new URL(e).pathname,t.pathname.replace(/\/+/g,`/`),t.toString()}isServiceURL(e){return e.startsWith(this.options.ingestPoint)}active(){return this.activityState===jn.Active}resetNextPageSession(e){e?this.sessionStorage.setItem(this.options.session_reset_key,`t`):this.sessionStorage.removeItem(this.options.session_reset_key)}getSessionVersionHash(){return`2x${this.version}`}get sessionVersionKey(){return`${this.options.session_token_key}_version`}storeSessionVersion(e){this.sessionStorage.setItem(this.sessionVersionKey,e)}adoptSessionVersion(e){e&&this.storeSessionVersion(e)}checkSessionToken(e){let t=this.getSessionVersionHash(),n=this.sessionStorage.getItem(this.options.session_reset_key)!==null,r=!!(e||n),i=this.session.getSessionToken(this.projectKey);if(i){let e=this.sessionStorage.getItem(this.sessionVersionKey);(!e||e!==t)&&(r=!0),this.storeSessionVersion(t)}return r||!i}async coldStart(e={},t){this.singleBuffer=!1;let n=this.checkSessionToken(e.forceNew);t&&await this.setupConditionalStart(e);let r=()=>{this.orderNumber+=1,E(),this.coldStartTs=O(),this.orderNumber%2==0?(this.bufferedMessages1.length=0,this.bufferedMessages1.push(q(this.timestamp())),this.bufferedMessages1.push(tt(this.session.getTabId()))):(this.bufferedMessages2.length=0,this.bufferedMessages2.push(q(this.timestamp())),this.bufferedMessages2.push(tt(this.session.getTabId()))),this.stop(!1),this.activityState=jn.ColdStart,e.sessionHash&&this.session.applySessionHash(e.sessionHash),e.forceNew&&this.session.reset(),this.session.assign({userID:e.userID,metadata:e.metadata}),n||(this.debug.log(`continuing session on new tab`,this.session.getTabId()),this.send(et(this.session.getTabId()))),this.observer.observe(),this.ticker.start()};this.coldInterval=setInterval(()=>{r()},30*1e3),r()}async setupConditionalStart(e){this.conditionsManager=new v(this,e);let{token:t,userBrowser:n,userCity:r,userCountry:i,userDevice:a,userOS:o,userState:s,projectID:c}=await(await fetch(this.options.ingestPoint+`/v1/web/start`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...this.getTrackerInfo(),timestamp:O(),doNotRecord:!0,bufferDiff:0,userID:this.session.getInfo().userID,token:void 0,deviceMemory:st,jsHeapSizeLimit:ct,timezone:Nn(),width:window.screen.width,height:window.screen.height})})).json();this.session.assign({projectID:c}),this.session.setUserInfo({userBrowser:n,userCity:r,userCountry:i,userDevice:a,userOS:o,userState:s});let l={sessionToken:t,userUUID:``,sessionID:``};this.startCallbacks.forEach(e=>e(l)),await this.conditionsManager?.fetchConditions(c,t),await this.tagWatcher.fetchTags(this.options.ingestPoint,t)}offlineRecording(e={},t){this.onSessionSent=t,this.singleBuffer=!0;let n=this.checkSessionToken(e.forceNew);E(),this.coldStartTs=O();let r=this.localStorage.getItem(On);if(r){let e=JSON.parse(r);this.bufferedMessages1=Array.isArray(e)?e:this.bufferedMessages1,this.localStorage.removeItem(On)}this.bufferedMessages1.push(q(this.timestamp())),this.bufferedMessages1.push(tt(this.session.getTabId())),this.activityState=jn.ColdStart,e.sessionHash&&this.session.applySessionHash(e.sessionHash),e.forceNew&&this.session.reset(),this.session.assign({userID:e.userID,metadata:e.metadata});let i={sessionToken:``,userUUID:``,sessionID:``};return this.startCallbacks.forEach(e=>e(i)),n||this.send(et(this.session.getTabId())),this.observer.observe(),this.ticker.start(),{saveBuffer:this.saveBuffer,getBuffer:this.getBuffer,setBuffer:this.setBuffer}}saveBuffer(){this.localStorage.setItem(On,JSON.stringify(this.bufferedMessages1))}getBuffer(){return this.bufferedMessages1}setBuffer(e){this.bufferedMessages1=e}async uploadOfflineRecording(){this.stop(!1);let e=O();this.worker?.postMessage({type:`start`,pageNo:this.session.incPageNo(),ingestPoint:this.options.ingestPoint,timestamp:this.coldStartTs,url:document.URL,connAttemptCount:this.options.connAttemptCount,connAttemptGap:this.options.connAttemptGap,tabId:this.session.getTabId(),localDebug:this.options.__local_debug});let{token:t,userBrowser:n,userCity:r,userCountry:i,userDevice:a,userOS:o,userState:s,beaconSizeLimit:c,projectID:l,protocolVersion:u}=await(await fetch(this.options.ingestPoint+`/v1/web/start`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...this.getTrackerInfo(),timestamp:e,doNotRecord:!1,bufferDiff:e-this.coldStartTs,userID:this.session.getInfo().userID,token:void 0,deviceMemory:st,jsHeapSizeLimit:ct,timezone:Nn()})})).json();for(this.worker?.postMessage({type:`auth`,token:t,beaconSizeLimit:c,protocolVersion:u}),this.session.assign({projectID:l}),this.session.setUserInfo({userBrowser:n,userCity:r,userCountry:i,userDevice:a,userOS:o,userState:s});this.bufferedMessages1.length>0;)await this.flushBuffer(this.bufferedMessages1);this.postToWorker([[-1]]),this.clearBuffers()}async _start(e={},t=!1,n){Object.keys(e).length!==0&&(this.prevOpts=e),e.startCallback&&(this.userStartCallback=e.startCallback);let r=this.activityState===jn.ColdStart;if(r&&this.coldInterval&&clearInterval(this.coldInterval),!this.worker&&!this.insideIframe){let e=`No worker found: perhaps, CSP is not set.`;return this.signalError(e,[]),Promise.resolve(kn(e))}if(this.activityState===jn.Active||this.activityState===jn.Starting)return Promise.resolve(kn("OpenReplay: trying to call `start()` on the instance that has been started already."));this.activityState=jn.Starting,r||E(),e.sessionHash&&this.session.applySessionHash(e.sessionHash),e.forceNew&&this.session.reset();let i=e.userID?e.userID.trim():void 0;this.session.assign({userID:i||void 0,metadata:e.metadata});let a=O();this.worker?.postMessage({type:`start`,pageNo:this.session.incPageNo(),ingestPoint:this.options.ingestPoint,timestamp:r?this.coldStartTs:a,url:document.URL,connAttemptCount:this.options.connAttemptCount,connAttemptGap:this.options.connAttemptGap,tabId:this.session.getTabId(),localDebug:this.options.__local_debug});let o=this.session.getSessionToken(this.projectKey),s=this.checkSessionToken(e.forceNew);this.sessionStorage.removeItem(this.options.session_reset_key),this.debug.log(`OpenReplay: starting session; need new session id?`,s,`session token: `,o);try{let t=await window.fetch(this.options.ingestPoint+`/v1/web/start`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...this.getTrackerInfo(),timestamp:a,doNotRecord:!1,bufferDiff:this.coldStartTs?a-this.coldStartTs:0,userID:this.session.getInfo().userID,token:s?void 0:o,deviceMemory:st,jsHeapSizeLimit:ct,timezone:Nn(),condition:n,assistOnly:e.assistOnly??this.socketMode,width:window.screen.width,height:window.screen.height,referrer:document.referrer})});if(t.status!==200){let e=await t.text();return kn(e===Dn?Dn:`Server error: ${t.status}. ${e}`)}if(!this.worker&&!this.insideIframe){let e=`no worker found after start request (this should not happen in real world)`;return this.signalError(e,[]),kn(e)}let{token:i,userUUID:c,projectID:l,beaconSizeLimit:u,compressionThreshold:d,delay:f,sessionID:p,startTimestamp:m,userBrowser:h,userCity:g,userCountry:_,userDevice:v,userOS:y,userState:b,canvasEnabled:x,canvasQuality:S,canvasFPS:C,framesSupport:w,assistOnly:T,protocolVersion:E}=await t.json();if(typeof i!=`string`||typeof c!=`string`||typeof m!=`number`&&m!==void 0||typeof p!=`string`||typeof f!=`number`||typeof u!=`number`&&u!==void 0){let e=`Incorrect server response: ${JSON.stringify(t)}`;return this.signalError(e,[]),kn(e)}this.delay=f,this.session.setSessionToken(i,this.projectKey),this.storeSessionVersion(this.getSessionVersionHash()),o&&o!==i&&this.bc?.postMessage({type:Fn.reset,token:i}),this.session.setUserInfo({userBrowser:h,userCity:g,userCountry:_,userDevice:v,userOS:y,userState:b}),this.session.assign({sessionID:p,timestamp:m||a,projectID:l}),T?(this.socketMode=!0,this.worker?.postMessage(`stop`)):this.worker?.postMessage({type:`auth`,token:i,beaconSizeLimit:u,protocolVersion:E}),!s&&i===o&&(this.debug.log(`continuing session on new tab`,this.session.getTabId()),this.send(et(this.session.getTabId()))),Object.entries(this.session.getInfo().metadata).forEac
94h(([e,t])=>this.send(Te(e,t))),this.localStorage.setItem(this.options.local_uuid_key,c),this.compressionThreshold=d;let D={sessionToken:i,userUUID:c,sessionID:p};if(this.startCallbacks.forEach(e=>e(D)),this.userStartCallback&&this.userStartCallback(An(D)),this.activityState=jn.Active,this.options.crossdomain?.enabled&&this.bootChildrenFrames(),x&&!this.options.canvas.disableCanvas&&(this.canvasRecorder=this.canvasRecorder??new Dt(this,{fps:C,quality:S,isDebug:this.options.canvas.__save_canvas_locally,fixedScaling:this.options.canvas.fixedCanvasScaling,useAnimationFrame:this.options.canvas.useAnimationFrame,framesSupport:!!w})),r){let e=this.bufferedMessages1.length>this.bufferedMessages2.length?this.bufferedMessages1:this.bufferedMessages2;for(;e.length>0;)await this.flushBuffer(e);this.clearBuffers(),this.commit()}return this.insideIframe&&this.rootId?this.observer.crossdomainObserve(this.rootId,this.frameOderNumber,this.frameLevel):this.observer.observe(),this.ticker.start(),this.canvasRecorder?.startTracking(),this.tagWatcher.fetchTags(this.options.ingestPoint,i),An(D)}catch(e){if(this.stop(),this.session.reset(),!e)return console.error(`Unknown error during start`),this.signalError(`Unknown error`,[]),kn(`Unknown error`);if(e===Dn)return this.signalError(Dn,[]),kn(Dn);this._debug(`session_start`,e);let t=e instanceof Error?e.message:e.toString();return this.signalError(t,[]),kn(t)}}async waitStart(){return new Promise(e=>{let t=setInterval(()=>{this.canStart&&(clearInterval(t),e(!0))},100)})}async waitStarted(){return this.waitStatus(jn.Active)}async waitStatus(e){return new Promise(t=>{let n=()=>{this.activityState===e?t(!0):setTimeout(n,25)};n()})}async start(...e){return this.activityState===jn.Active||this.activityState===jn.Starting?Promise.resolve(kn("OpenReplay: trying to call `start()` on the instance that has been started already.")):(this.insideIframe&&this.signalIframeTracker(),document.hidden?new Promise(t=>{let n=async()=>{document.hidden||(await this.waitStart(),document.removeEventListener(`visibilitychange`,n),t(this._start(...e)))};document.addEventListener(`visibilitychange`,n)}):(await this.waitStart(),this._start(...e)))}forceFlushBatch(){this.worker?.postMessage(`forceFlushBatch`)}getTabId(){return this.session.getTabId()}clearBuffers(){this.bufferedMessages1.length=0,this.bufferedMessages2.length=0}trackWs(e){let t=e;return(e,n,r=`down`)=>{typeof e!=`string`||typeof n!=`string`||n.length>5*1024*1024||e.length>255||this.send(Ke(`websocket`,t,n,this.timestamp(),r,e))}}stop(e=!0){if(this.activityState!==jn.NotActive)try{this.options.crossdomain?.enabled&&this.killChildrenFrames(),this.attributeSender.clear(),this.sanitizer.clear(),this.observer.disconnect(),this.nodes.clear(),this.ticker.stop(),this.stopCallbacks.forEach(e=>e()),this.tagWatcher.clear(),this.worker&&e&&this.worker.postMessage(`stop`),this.canvasRecorder?.clear(),this.messages.length=0,this.parentActive=!1,this.pageFrames=[]}finally{this.activityState=jn.NotActive,this.debug.log(`OpenReplay tracking stopped.`)}}};function Rn(e){let t=navigator.connection||navigator.mozConnection||navigator.webkitConnection;if(t===void 0)return;let n=()=>{e.send(Oe(Math.round(t.downlink*1e3),t.effectiveType||`unknown`))};e.attachStartCallback(()=>{n(),t.addEventListener(`change`,n)}),e.attachStopCallback(()=>{t.removeEventListener(`change`,n)})}var zn=S&&`InstallTrigger`in window?e=>e.message+` 95`+e.stack:e=>e.stack||e.message;function Bn(e){return e===void 0?`undefined`:e===null?`null`:e instanceof Error?zn(e):Array.isArray(e)?`Array(${e.length})`:String(e)}function Vn(e){return typeof e==`number`?e.toString():`NaN`}function Hn(e){return typeof e==`number`?Math.floor(e).toString():`NaN`}function Un(e){if(e===void 0)return`undefined`;if(e===null)return`null`;if(e instanceof Error)return zn(e);if(Array.isArray(e))return`Array(${e.length})[${e.slice(0,10).map(Bn).join(`, `)}]`;if(typeof e==`object`){let t=[],n=0;for(let r in e){if(++n===10)break;let i=e[r];t.push(r+`: `+Bn(i))}return`{`+t.join(`, `)+`}`}return e.toString()}function Wn(e){return typeof e[0]==`string`&&e.unshift(e.shift().replace(/%(o|s|f|d|i)/g,(t,n)=>{let r=e.shift();if(r===void 0)return t;switch(n){case`o`:return Un(r);case`s`:return Bn(r);case`f`:return Vn(r);case`d`:case`i`:return Hn(r);default:return t}})),e.map(Un).join(` `)}var Gn=[`log`,`info`,`warn`,`error`,`debug`,`assert`];function Kn(e,t){let n=Object.assign({consoleMethods:Gn,consoleThrottling:30},t);
95if(!Array.isArray(n.consoleMethods)||n.consoleMethods.length===0)return;let r=e.safe((t,n)=>{let r=Wn(n);e.sanitizer.privateMode&&(r=r.replaceAll(/./g,`*`)),e.send(ye(t,r))}),i=0,a=()=>{i=0};e.attachStartCallback(a),e.ticker.attach(a,33,!1);let o=[],s=(t,a)=>{let s={apply:function(e,t,o){Reflect.apply(e,a,o),i+=1,!(i>n.consoleThrottling)&&r(e.name,o)}};n.consoleMethods.forEach(n=>{if(Gn.indexOf(n)===-1){e.debug.error(`OpenReplay: unsupported console method "${n}"`);return}let r=a.console[n];t[n]=new Proxy(r,s),o.push(()=>{t[n]=r})})},c=e.safe(e=>s(e.console,e)),l=!1,u=()=>{l||(l=!0,c(window))};u(),e.attachStartCallback(u),e.attachStopCallback(()=>{l=!1,o.forEach(e=>e()),o.length=0}),e.observer.attachContextCallback(c)}var qn=/(^|@)\S+:\d+/,Jn=/^\s*at .*(\S+:\d+|\(native\))/m,Yn=/^(eval@)?(\[native code\])?$/;function Xn(e,t){if(e.stacktrace!==void 0||e[`opera#sourceloc`]!==void 0)return rr(e);if(e.stack&&Jn.test(e.stack))return $n(e);if(e.stack)return tr(e);throw Error(`Cannot parse given Error object`)}function Zn(e){if(!e.includes(`:`))return[e,void 0,void 0];let t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,``));return[t[1],t[2]||void 0,t[3]||void 0]}function Qn(e,t){return e}function $n(e,t){return er(e.stack)}function er(e,t){return Qn(e.split(` 96`).filter(e=>!!e.match(Jn))).map(e=>{e.includes(`(eval `)&&(e=e.replace(/eval code/g,`eval`).replace(/(\(eval at [^()]*)|(,.*$)/g,``));let t=e.replace(/^\s+/,``).replace(/\(eval code/g,`(`).replace(/^.*?\s+/,``),n=t.match(/ (\(.+\)$)/);t=n?t.replace(n[0],``):t;let r=Zn(n?n[1]:t);return{function:n&&t||void 0,file:[`eval`,`<anonymous>`].includes(r[0])?void 0:r[0],line:r[1]?+r[1]:void 0,col:r[2]?+r[2]:void 0,raw:e}})}function tr(e,t){return nr(e.stack)}function nr(e,t){return Qn(e.split(` 97`).filter(e=>!e.match(Yn))).map(e=>{if(e.includes(` > eval`)&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,`:$1`)),!e.includes(`@`)&&!e.includes(`:`))return{function:e};{let t=/(([^\n\r"\u2028\u2029]*".[^\n\r"\u2028\u2029]*"[^\n\r@\u2028\u2029]*(?:@[^\n\r"\u2028\u2029]*"[^\n\r@\u2028\u2029]*)*(?:[\n\r\u2028\u2029][^@]*)?)?[^@]*)@/,n=e.match(t),r=n&&n[1]?n[1]:void 0,i=Zn(e.replace(t,``));return{function:r,file:i[0],line:i[1]?+i[1]:void 0,col:i[2]?+i[2]:void 0,raw:e}}})}function rr(e,t){return!e.stacktrace||e.message.includes(` 98`)&&e.message.split(` 99`).length>e.stacktrace.split(` 100`).length?ir(e):e.stack?or(e):ar(e)}function ir(e,t){let n=/Line (\d+).*script (?:in )?(\S+)/i,r=e.message.split(` 101`),i=[];for(let e=2,t=r.length;e<t;e+=2){let t=n.exec(r[e]);t&&i.push({file:t[2],line:+t[1],raw:r[e]})}return Qn(i)}function ar(e,t){let n=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,r=e.stacktrace.split(` 102`),i=[];for(let e=0,t=r.length;e<t;e+=2){let t=n.exec(r[e]);t&&i.push({function:t[3]||void 0,file:t[2],line:t[1]?+t[1]:void 0,raw:r[e]})}return Qn(i)}function or(e,t){return Qn(e.stack.split(` 103`).filter(e=>!!e.match(qn)&&!e.match(/^Error created at/))).map(e=>{let t=e.split(`@`),n=Zn(t.pop()),r=t.shift()||``,i=r.replace(/<anonymous function(: (\w+))?>/,`$2`).replace(/\([^)]*\)/g,``)||void 0,a;return/\([^)]*\)/.test(r)&&(a=r.replace(/^[^(]+\(([^)]*)\)$/,`$1`)),{function:i,args:a===void 0||a===`[arguments not available]`?void 0:a.split(`,`),file:n[0],line:n[1]?+n[1]:void 0,col:n[2]?+n[2]:void 0,raw:e}})}function sr(e){return e.map(e=>({functionName:e.function,args:e.args,fileName:e.file,lineNumber:e.line,columnNumber:e.col,source:e.raw}))}function cr(e,t){return sr(Xn(e))}function lr(e){return[{columnNumber:e.colno,lineNumber:e.lineno,fileName:e.filename,functionName:``,source:``}]}function ur(e,t,n={}){let r=t;try{r=cr(e)}catch{}return We(e.name,e.message,JSON.stringify(r),JSON.stringify(n))}function dr(e,t=window,n={}){if(e instanceof ErrorEvent){if(e.error instanceof Error)return ur(e.error,lr(e),n);{let[t,r]=e.message.split(`:`);return r||=(t=`Error`,e.message),We(t,r,JSON.stringify(lr(e)),JSON.stringify(n))}}else if(`PromiseRejectionEvent`in t&&e instanceof t.PromiseRejectionEvent){if(e.reason instanceof Error)return ur(e.reason,[],n);{let t;try{t=JSON.stringify(e.reason)}catch{t=String(e.reason)}return We(`Unhandled Promise Rejection`,t,`[]`,JSON.stringify(n))}}return null}function fr(e,t){let n=Object.assign({captureExceptions:!0},t);function r(t){function n(n){let r=dr(n,t);r!=null&&e.send(r)}try{e.attachEventListener(t,`unhandledrejection`,n),e.attachEventListener(t,`error`,n)}catch(e){console.error(`Error while attaching to error proto contexts`,e)}}n.captureExceptions&&(e.observer.attachContextCallback(r),r(window))}function pr(e,t=document.location){return e=e.trim(),e.startsWith(`//`)||e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`data:`)?e:e.startsWith(`/`)?t.origin+e:t.origin+t.pathname+e}function mr(e){return C&&(e.startsWith(`data:image/svg+xml`)||e.match(/.svg$|/i))}var hr=`https://static.openreplay.com/tracker/placeholder.jpeg`;function gr(e){function t(t,n){e.attributeSender.sendSetAttribute(t,`src`,hr);let{width:r,height:i}=n.getBoundingClientRect();n.hasAttribute(`width`)||e.attributeSender.sendSetAttribute(t,`width`,String(r)),n.hasAttribute(`height`)||e.attributeSender.sendSetAttribute(t,`height`,String(i))}let n=function(t,n){let{srcset:r}=n;if(!r)return;let i=r.split(r.match(/,\s+/)?/,\s+/:`,`).map(e=>pr(e)).join(`, `);e.attributeSender.sendSetAttribute(t,`srcset`,i)},r=function(n,r){r.src.length>w&&t(n,r),e.send(Me(n,`src`,r.src,e.getBaseHref()))},i=e.safe(function(t){let n=pr(t.src||``);j(n)&&e.send(qe(e.timestamp(),0,0,0,0,0,n,`img`,0,!1,0,0,0,0,0,0,0))}),a=e.safe(function(a){let o=e.nodes.getID(a);
103o!==void 0&&a.complete&&(a.naturalHeight===0&&a.naturalWidth===0&&!mr(a.src)?i(a):e.sanitizer.isHidden(o)||e.sanitizer.isObscured(o)?t(o,a):(r(o,a),n(o,a)))}),o=G(e.safe(t=>{for(let i of t)if(i.type===`attributes`){let t=i.target,a=e.nodes.getID(t);if(a===void 0)continue;i.attributeName===`src`&&r(a,t),i.attributeName===`srcset`&&n(a,t)}}),e.options.forceNgOff);e.attachStopCallback(()=>{o.disconnect()}),e.nodes.attachNodeCallback(t=>{Et(t,`img`)&&(e.nodes.attachNodeListener(t,`error`,()=>i(t)),e.nodes.attachNodeListener(t,`load`,()=>a(t)),a(t),o.observe(t,{attributes:!0,attributeFilter:[`src`,`srcset`]}))}),e.attachResanitizeCallback(e=>{Et(e,`img`)&&a(e)})}var _r=[`text`,`password`,`email`,`search`,`number`,`range`,`date`,`tel`,`time`];function vr(e){return Et(e,`textarea`)?!0:Et(e,`input`)?_r.includes(e.type):!1}function yr(e){if(!Et(e,`input`))return!1;let t=e.type;return t===`checkbox`||t===`radio`}var br=S&&`labels`in HTMLInputElement.prototype?e=>{let t=e;for(;(t=t.parentNode)!==null;)if(Et(t,`label`))return t;let n=e.labels;if(n!==null&&n.length===1)return n[0]}:e=>{let t=e;for(;(t=t.parentNode)!==null;)if(Et(t,`label`))return t;let n=e.id;if(n){let t=e.ownerDocument.querySelectorAll(`label[for="`+n+`"]`);if(t!==null&&t.length===1)return t[0]}};function xr(e,t){let n=L(e);if(n!==null)return A(n).slice(0,100);let r=F(e,t);if(r)return r;if(e.id)return`#${e.id}`;let i=I(e);if(i)return i;let a=br(e);return A(e.name||e.placeholder||a&&a.innerText||e.type||``).slice(0,100)}var Sr={Plain:0,Obscured:1,Hidden:2};function Cr(e,t){let n=Object.assign({obscureInputNumbers:!0,obscureInputEmails:!0,defaultInputMode:Sr.Obscured,obscureInputDates:!1},t),r=new Map;function i(t,n){let i=r.get(t);if(i!==void 0)return i;let a=e.tagMatcher.match(n);return a?(r.set(t,a.selector),a.selector):null}function a(t,r){let i=r.value,a=n.defaultInputMode;r.type===`password`||e.sanitizer.isHidden(t)?a=Sr.Hidden:(e.sanitizer.isObscured(t)||a===Sr.Plain&&(n.obscureInputNumbers&&r.type!==`date`&&/\d\d\d\d/.test(i)||n.obscureInputDates&&r.type===`date`||n.obscureInputEmails&&(r.type===`email`||~i.indexOf(`@`))))&&(a=Sr.Obscured);let o=0;switch(a){case Sr.Hidden:o=-1,i=``;break;case Sr.Obscured:o=i.length,i=``;break}return{value:i,mask:o}}function o(t,n){let{value:r,mask:i}=a(t,n);e.send(ge(t,r,i))}let s=new Map,c=new Map,l=new Map;e.attachStopCallback(()=>{s.clear(),c.clear(),l.clear(),r.clear()});function u(e,t){s.get(e)!==t.value&&(s.set(e,t.value),o(e,t))}function d(t,n){c.get(t)!==n&&(c.set(t,n),e.send(_e(t,n)))}function f(e,t){l.get(e)!==t.value&&(l.set(e,t.value),o(e,t))}e.ticker.attach(()=>{s.forEach((t,n)=>{let r=e.nodes.getNode(n);if(!r)return s.delete(n);u(n,r)}),c.forEach((t,n)=>{let r=e.nodes.getNode(n);if(!r)return c.delete(n);d(n,r.checked)}),l.forEach((t,n)=>{let r=e.nodes.getNode(n);if(!r)return l.delete(n);f(n,r)})},3);function p(t,r,o,s){let{value:c,mask:l}=a(t,r),u=i(t,r)||xr(r,n.customAttributes);e.sanitizer.privateMode&&(u=u.replaceAll(/./g,`*`)),e.send(Xe(t,c,l!==0,u,o,s))}e.attachResanitizeCallback((e,t)=>{(vr(e)||Et(e,`select`))&&o(t,e)}),e.nodes.attachNodeCallback(e.safe(t=>{let n=e.nodes.getID(t);if(n!==void 0){if(Et(t,`select`)&&(f(n,t),e.nodes.attachNodeListener(t,`change`,()=>f(n,t))),vr(t)){u(n,t);let r=0,i=0,a=0;e.nodes.attachNodeListener(t,`focus`,()=>{r=O()}),e.nodes.attachNodeListener(t,`input`,()=>{i===0&&r!==0&&(i=O()-r)}),e.nodes.attachNodeListener(t,`change`,()=>{r!==0&&(a=O()-r),p(n,t,i,a),i=0,a=0,r=0});return}if(yr(t)){d(n,t.checked),e.nodes.attachNodeListener(t,`change`,()=>d(n,t.checked));return}}}))}var wr=typeof CSS<`u`&&CSS.escape||(e=>e),Tr=new WeakMap;function Er(e){return Pr(e)||``}function Dr(e){let t=e.tagName.toUpperCase();return t===`BUTTON`||t===`A`||t===`LI`||t===`SELECT`||t===`TR`||t===`TH`||e.onclick!=null||e.getAttribute(`role`)===`button`}function Or(e,t){return e instanceof Element?kr(e,t):null}function kr(e,t){let n=e;for(;n!==null&&n!==t.documentElement;){if(R(n,`masked`))return null;n=n.parentElement}if(yt(e)){let t=e.ownerSVGElement;for(;t!==null;)e=t,t=t.ownerSVGElement}for(n=e;n!==null&&n!==t.documentElement;){let e=n.tagName.toUpperCase();if(e===`LABEL`)return null;if(e===`INPUT`||Dr(n)||L(n)!==null)return n;n=n.parentElement}return e===t.documentElement?null:e}function Ar(e,t){let{disableClickmaps:n=!1,customAttributes:r}=t||{};function i(t){let n=L(t);if(n!==null)return n;if(Et(t,`input`))return xr(t,r);let i=F(t,r);if(i)return i;if(t.id)return`#${t.id}`;let a=I(t);if(a)return a;
103if(Dr(t)){let n=``;return t instanceof HTMLElement&&(n=e.sanitizer.getInnerTextSecure(t)),A(n).slice(0,100)}return``}let a=-1,o=-1,s=!1,c=null,l=0,u={},d=0,f=0,p=0,m=0,h;function g(){let t=m/225;if(!d){d=t;return}let n=(t-d)/225;p>4&&n>.008&&e.send(Qe(O())),m=0,p=0,d=t}e.attachStartCallback(()=>{h=setInterval(()=>g(),225)}),e.attachStopCallback(()=>{a=-1,o=-1,s=!1,c=null,u={},h&&clearInterval(h)});let _=()=>{s&&=(e.send(ve(a,o)),!1)},v=(t,r=!1)=>{function d(t,n){if(u[t])return u[t];let r=e.tagMatcher.match(n);return r?u[t]=r.selector:u[t]=Er(n)}let h=r?e.attachEventListener.bind(e):e.nodes.attachNodeListener.bind(e.nodes);h(t.documentElement,`mouseover`,e=>{let n=Or(e.target,t);n!==c&&(c=n,l=performance.now())}),h(t,`mousemove`,n=>{let[r,i]=e.observer.getDocumentOffset(t);a=n.clientX+r,o=n.clientY+i,s=!0;let c=Math.sign(n.movementX);m+=Math.abs(n.movementX)+Math.abs(n.movementY),c!==f&&(f=c,p++)},!1),h(t,`click`,r=>{let a=Or(r.target,t);if(!r.clientX&&!r.clientY||a===null)return;let o=e.nodes.getID(a);if(o!==void 0){let s=r.pageX,u=r.pageY,f=t.documentElement.scrollWidth,p=t.documentElement.scrollHeight,m=jr(s/f),h=jr(u/p);_();let g=i(a);e.send(Le(o,c===a?Math.round(performance.now()-l):0,e.sanitizer.privateMode?g.replaceAll(/./g,`*`):g,Dr(a)&&!n?d(o,a):``,m,h),!0)}c=null})};e.nodes.attachNodeCallback(e=>{wt(e)&&v(e)}),v(document,!0),e.ticker.attach(_,t?.trackingOffset||7)}function jr(e){return Math.round(e*1e4)}function Mr(e,t){let n=Tr.get(t);if(n||(n=Object.create(null),Tr.set(t,n)),e in n)return n[e];let r=t.querySelectorAll(`.${wr(e)}`).length===1;return n[e]=r,r}function Nr(e){if(/^[a-z\-]{3,}$/i.test(e)){let t=e.split(/-|[A-Z]/);for(let e of t)if(e.length<=2||/[^aeiou]{4,}/i.test(e))return!1;return!0}return!1}function Pr(e){if(!e||e.nodeType!==1)return!1;if(e.id)return`#${wr(e.id)}`;let t=Array.from(e.attributes).find(e=>e.name.startsWith(`data-`));if(t)return`[${t.name}="${wr(t.value)}"]`;let n=[];for(;e&&e.nodeType===1&&e!==e.ownerDocument;){if(e.id){n.unshift(`#${wr(e.id)}`);break}let t=e.tagName.toLowerCase();if(e.classList?.length){for(let r of e.classList)if(Nr(r)&&Mr(r,e.ownerDocument))return n.unshift(`${t}.${wr(r)}`),n.join(` > `)}let r=Fr(e);if(r)n.unshift(`${t}.${wr(r)}`);else if(e===e.ownerDocument.body||e===e.ownerDocument.documentElement)n.unshift(t);else{let r=1;for(let n=e.previousElementSibling;n;n=n.previousElementSibling)n.tagName.toLowerCase()===t&&r++;n.unshift(`${t}:nth-of-type(${r})`)}e=e.parentNode}return n.join(` > `)}function Fr(e){if(!e.classList?.length||!e.parentNode)return null;let t=e.parentNode.children;outer:for(let n of e.classList)if(!(!Nr(n)||!Mr(n,e.ownerDocument))){for(let r of t)if(r!==e&&r.classList?.contains(n))continue outer;return n}return null}var Ir=-1,Lr=e=>{addEventListener(`pageshow`,t=>{t.persisted&&(Ir=t.timeStamp,e(t))},!0)},Rr=(e,t,n,r)=>{let i,a;return o=>{t.value>=0&&(o||r)&&(a=t.value-(i??0),(a||i===void 0)&&(i=t.value,t.delta=a,t.rating=((e,t)=>e>t[1]?`poor`:e>t[0]?`needs-improvement`:`good`)(t.value,n),e(t)))}},zr=e=>{requestAnimationFrame(()=>requestAnimationFrame(e))},Br=()=>{let e=performance.getEntriesByType(`navigation`)[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},Vr=()=>Br()?.activationStart??0,Hr=(e,t=-1)=>{let n=Br(),r=`navigate`;return Ir>=0?r=`back-forward-cache`:n&&(document.prerendering||Vr()>0?r=`prerender`:document.wasDiscarded?r=`restore`:n.type&&(r=n.type.replace(/_/g,`-`))),{name:e,value:t,rating:`good`,delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+0xe8d4a51000}`,navigationType:r}},Ur=new WeakMap;function Wr(e,t){let n=Ur.get(t);return n||(n=new WeakMap,Ur.set(t,n)),n.get(e)||n.set(e,new t),n.get(e)}var Gr=class{t;i=0;o=[];h(e){if(e.hadRecentInput)return;let t=this.o[0],n=this.o.at(-1);this.i&&t&&n&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}},Kr=(e,t,n={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){let r=new PerformanceObserver(e=>{queueMicrotask(()=>{t(e.getEntries())})});return r.observe({type:e,buffered:!0,...n}),r}}catch{}},qr=e=>{let t=!1;return()=>{t||=(e(),!0)}},Jr=-1,Yr=new Set,Xr=()=>document.visibilityState!==`hidden`||document.prerendering?1/0:0,Zr=e=>{if(document.visibilityState===`hidden`){if(e.type===`visibilitychange`)for(let e of Yr)e();isFinite(Jr)||(Jr=e.type===`visibilitychange`?e.timeStamp:0,removeEventListener(`prerenderingchange`,Zr,!0))}},Qr=()=>{if(Jr<0){let e=Vr();Jr=(document.prerendering?void 0:globalThis.performance.getEntriesByType(`visibility-state`).find(t=>t.name===`hidden`&&t.startTime>=e)?.startTime)??Xr(),addEventListener(`visibilitychange`,Zr,!0),addEventListener(`prerenderingchange`,Zr,!0),Lr(()=>{setTimeout(()=>{Jr=Xr()})})}return{get firstHiddenTime(){return Jr},onHidden(e){Yr.add(e)}}},$r=e=>{document.prerendering?addEventListener(`prerenderingchange`,e,!0):e()},ei=[1800,3e3],ti=(e,t={})=>{$r(()=>{let n=Qr(),r,i=Hr(`FCP`),a=Kr(`paint`,e=>{for(let t of e)t.name===`first-contentful-paint`&&(a.disconnect(),t.startTime<n.firstHiddenTime&&(i.value=Math.max(t.startTime-Vr(),0),i.entries.push(t),r(!0)))});a&&(r=Rr(e,i,ei,t.reportAllChanges),Lr(n=>{i=Hr(`FCP`),r=Rr(e,i,ei,t.reportAllChanges),zr(()=>{i.value=performance.now()-n.timeStamp,r(!0)})}))})},ni=[.1,.25],ri=(e,t={})=>{let n=Qr();ti(qr(()=>{let r,i=Hr(`CLS`,0),a=Wr(t,Gr),o=e=>{for(let t of e)a.h(t);a.i>i.value&&(i.value=a.i,i.entries=a.o,r())},s=Kr(`layout-shift`,o);s&&(r=Rr(e,i,ni,t.reportAllChanges),n.onHidden(()=>{o(s.takeRecords()),r(!0)}),Lr(()=>{a.i=0,i=Hr(`CLS`,0),r=Rr(e,i,ni,t.reportAllChanges),zr(r)}),setTimeout(r))}))},ii=0,ai=1/0,oi=0,si=e=>{for(let t of e)t.interactionId&&(ai=Math.min(ai,t.interactionId),oi=Math.max(oi,t.interactionId),ii=oi?(oi-ai)/7+1:0)},ci,li=()=>ci?ii:performance.interactionCount??0,ui=()=>{`interactionCount`in performance||ci||(ci=Kr(`event`,si,{durationThreshold:0}))},di=0,fi=class{l=[];u=new Map;m;p;v(){di=li(),this.l.length=0,this.u.clear()}T(){let e=Math.min(this.l.length-1,Math.floor((li()-di)/50));return this.l[e]}h(e){if(this.m?.(e),!e.interactionId&&e.entryType!==`first-input`)return;let t=this.l.at(-1),n=this.u.get(e.interactionId);if(n||this.l.length<10||e.duration>t.L){if(n?e.duration>n.L?(n.entries=[e],n.L=e.duration):e.duration===n.L&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],L:e.duration},this.u.set(n.id,n),this.l.push(n)),this.l.sort((e,t)=>
103t.L-e.L),this.l.length>10){let e=this.l.splice(10);for(let t of e)this.u.delete(t.id)}this.p?.(n)}}},pi=e=>{let t=globalThis.requestIdleCallback||setTimeout,n=globalThis.cancelIdleCallback||clearTimeout;if(document.visibilityState===`hidden`)e();else{let r=qr(e),i=-1,a=()=>{n(i),r()};addEventListener(`visibilitychange`,a,{once:!0,capture:!0}),i=t(()=>{removeEventListener(`visibilitychange`,a,{capture:!0}),r()})}},mi=[200,500],hi=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!(`interactionId`in PerformanceEventTiming.prototype))return;let n=Qr();$r(()=>{ui();let r,i=Hr(`INP`),a=Wr(t,fi),o=e=>{pi(()=>{for(let t of e)a.h(t);let t=a.T();t&&t.L!==i.value&&(i.value=t.L,i.entries=t.entries,r())})},s=Kr(`event`,o,{durationThreshold:t.durationThreshold??40});r=Rr(e,i,mi,t.reportAllChanges),s&&(s.observe({type:`first-input`,buffered:!0}),n.onHidden(()=>{o(s.takeRecords()),r(!0)}),Lr(()=>{a.v(),i=Hr(`INP`),r=Rr(e,i,mi,t.reportAllChanges)}))})},gi=class{m;h(e){this.m?.(e)}},_i=[2500,4e3],vi=(e,t={})=>{$r(()=>{let n=Qr(),r,i=Hr(`LCP`),a=Wr(t,gi),o=e=>{t.reportAllChanges||(e=e.slice(-1));for(let t of e)a.h(t),t.startTime<n.firstHiddenTime&&(i.value=Math.max(t.startTime-Vr(),0),i.entries=[t],r())},s=Kr(`largest-contentful-paint`,o);if(s){r=Rr(e,i,_i,t.reportAllChanges);let n=qr(()=>{o(s.takeRecords()),s.disconnect(),r(!0)}),a=e=>{e.isTrusted&&(pi(n),removeEventListener(e.type,a,{capture:!0}))};for(let e of[`keydown`,`click`,`visibilitychange`])addEventListener(e,a,{capture:!0});Lr(n=>{i=Hr(`LCP`),r=Rr(e,i,_i,t.reportAllChanges),zr(()=>{i.value=performance.now()-n.timeStamp,r(!0)})})}})},yi=[800,1800],bi=e=>{document.prerendering?$r(()=>bi(e)):document.readyState===`complete`?setTimeout(e):addEventListener(`load`,()=>bi(e),!0)},xi=(e,t={})=>{let n=Hr(`TTFB`),r=Rr(e,n,yi,t.reportAllChanges);bi(()=>{let i=Br();i&&(n.value=Math.max(i.responseStart-Vr(),0),n.entries=[i],r(!0),Lr(()=>{n=Hr(`TTFB`,0),r=Rr(e,n,yi,t.reportAllChanges),r(!0)}))})};function Si(e){let t=[],n=document.getElementsByTagName(`*`),r=/url\(("[^"]*"|'[^']*'|[^)]*)\)/i;for(let i=0;i<n.length;i++){let a=n[i],o=``;if(Et(a,`img`)&&(o=a.currentSrc||a.src),!o){let e=getComputedStyle(a).getPropertyValue(`background-image`);if(e){let t=r.exec(e);t!==null&&(o=t[1],(o.startsWith(`"`)||o.startsWith(`'`))&&(o=o.substr(1,o.length-2)))}}if(!o)continue;let s=o.substr(0,10)===`data:image`?0:e[o];if(s===void 0)continue;let c=a.getBoundingClientRect(),l=Math.max(c.top,0),u=Math.max(c.left,0),d=Math.min(c.bottom,window.innerHeight||document.documentElement&&document.documentElement.clientHeight||0),f=Math.min(c.right,window.innerWidth||document.documentElement&&document.documentElement.clientWidth||0);if(d<=l||f<=u)continue;let p=(d-l)*(f-u);t.push({time:s,area:p})}return t}function Ci(e,t){let n=Math.max(document.documentElement&&document.documentElement.clientWidth||0,window.innerWidth||0)*Math.max(document.documentElement&&document.documentElement.clientHeight||0,window.innerHeight||0)/10,r=n*e;for(let i=0;i<t.length;i++){let{time:a,area:o}=t[i];n+=o,r+=o*(a>e?a:e)}return n===0?0:r/n}function wi(e,t){let n=Object.assign({captureResourceTimings:!0,capturePageLoadTimings:!0,capturePageRenderTimings:!0,excludedResourceUrls:[]},t);if(`PerformanceObserver`in window||(n.captureResourceTimings=!1),!n.captureResourceTimings)return;let r={};function i(t){if(t.duration<0||!j(t.name)||e.isServiceURL(t.name))return;r!==null&&(r[t.name]=t.startTime+t.duration);let i=!1;if(n.excludedResourceUrls?.forEach(e=>{if(t.name.startsWith(e)){i=!0;return}}),i)return;let a=0;a=t.connectEnd&&t.connectEnd>t.domainLookupEnd?Math.max(0,t.requestStart-t.connectEnd):Math.max(0,t.requestStart-t.domainLookupEnd);let o={queueing:t.requestStart-t.fetchStart,dnsLookup:t.domainLookupEnd-t.domainLookupStart,initialConnection:t.connectEnd-t.connectStart,ssl:t.secureConnectionStart>0?t.connectEnd-t.secureConnectionStart:0,ttfb:t.responseStart-t.requestStart,contentDownload:t.responseEnd-t.responseStart,total:t.duration??t.responseEnd-t.startTime,stalled:a},s=n.resourceNameSanitizer?n.resourceNameSanitizer(t.name):t.name,c=t.responseStatus&&t.responseStatus===304||t.deliveryType&&t.deliveryType===`cache`||t.transferSize===0&&t.decodedBodySize>0,l=t.responseStatus&&t.responseStatus>=400?-111:t.decodedBodySize||0;e.send(qe(t.startTime+D(),t.duration,o.ttfb,t.transferSize>t.encodedBodySize?t.transferSize-t.encodedBodySize:0,t.encodedBodySize||0,l,e.sanitizer.privateMode?t.name.replaceAll(/./g,`*`):s,t.initiatorType,t.transferSize,c,o.queueing,o.dnsLookup,o.initialConnection,o.ssl,o.contentDownload,o.total,o.stalled))}let a=new PerformanceObserver(e=>
103e.getEntries().forEach(i));function o(t){if(e.active())return e.send(at(t.name,String(t.value)))}e.attachStartCallback(function({sessionID:e}){a.observe({type:`resource`,buffered:!0}),ri(o),hi(o),vi(o),xi(o)}),e.attachStopCallback(function(){a.disconnect()});let s=0,c=0;if(n.capturePageLoadTimings){let t=!1;e.ticker.attach(()=>{if(!t&&((s===0||c===0)&&performance.getEntriesByType(`paint`).forEach(e=>{let{name:t,startTime:n}=e;switch(t){case`first-paint`:s=n;break;case`first-contentful-paint`:c=n;break}}),performance.timing.loadEventEnd||performance.now()>3e4)){t=!0;let{navigationStart:n,requestStart:r,responseStart:i,responseEnd:a,domContentLoadedEventStart:o,domContentLoadedEventEnd:l,loadEventStart:u,loadEventEnd:d}=performance.timing;e.send(be(r-n||0,i-n||0,a-n||0,o-n||0,l-n||0,u-n||0,d-n||0,s,c))}},30)}if(n.capturePageRenderTimings){let t=0,n=0,i=0,a=null,o=!1;e.ticker.attach(()=>{if(o)return;let l=performance.now();if(r!==null&&(t=Math.max.apply(null,Object.keys(r).map(e=>r[e])),l-t>1e3&&(a=Si(r),r=null)),i!==null&&(l-i>50&&(n=l),i=l-n>5e3?null:l),a!==null&&i===null||l>3e4){o=!0,r=null;let l=a===null?0:Ci(c||s,a),{domContentLoadedEventEnd:u,navigationStart:d}=performance.timing,f=i===null?Math.max(n,c,u-d||0):0;e.send(xe(l,c>t?c:t,f))}})}}function Ti(e){let t=e.defaultView;return[t&&t.scrollX||e.documentElement&&e.documentElement.scrollLeft||e.body&&e.body.scrollLeft||0,t&&t.scrollY||e.documentElement&&e.documentElement.scrollTop||e.body&&e.body.scrollTop||0]}function Ei(e,t){let n=!1,r=new Map;function i(e){vt(e)&&(xt(e)&&r.set(e,[e.scrollLeft,e.scrollTop]),wt(e)&&r.set(e,Ti(e)))}let a=e.safe(()=>{t||e.send(oe(...Ti(document)))}),o=e.safe((t,n)=>{let r=e.nodes.getID(n);r!==void 0&&e.send(he(r,t[0],t[1]))});e.attachStartCallback(a),e.attachStopCallback(()=>{n=!1,r.clear()}),e.nodes.attachNodeCallback((t,n)=>{n&&(xt(t)&&t.scrollLeft+t.scrollTop>0?r.set(t,[t.scrollLeft,t.scrollTop]):wt(t)&&r.set(t,Ti(t))),Tt(t)&&e.nodes.attachNodeListener(t,`scroll`,e=>{i(e.target)})}),e.attachEventListener(document,`scroll`,e=>{let t=e.target;if(t===document){n=!0;return}i(t)}),e.ticker.attach(()=>{n&&=(a(),!1),r.forEach(o),r.clear()},5,!1)}var Di=e=>{let t=[`jwt`,`password`,`reset-password`,`invitation`,`secret`,`token`];try{let n=new URL(e);return n.searchParams.forEach((e,r)=>{t.includes(r.toLowerCase())&&n.searchParams.set(r,`*`.repeat(e.length))}),n.toString()}catch{return e}};function Oi(e,t){let n,r,i,a,o=document.referrer,s=t?.urlSanitizer||Di,c=t?.titleSanitizer||(e=>e),l=e.safe(()=>{let r=document.URL;if(r!==n){if(n=r,t?.replaceHashSymbol){let e=new URL(r),t=e.hash.startsWith(`#/`)?e.hash.slice(2):``,i=t?`/`+t.replace(/^\/+/,``):``;n=e.origin+e.pathname.replace(/\/$/,``)+i+e.search}let i=s(n),l=e.sanitizer.privateMode?nn(document.title):c(document.title),u=e.sanitizer.privateMode?nn(i):i,d=e.sanitizer.privateMode?nn(o):o;e.send(it(u,d,a,l)),a=0,o=n}}),u=e.safe(()=>{let{innerWidth:t,innerHeight:n}=window;(t!==r||n!==i)&&(r=t,i=n,e.send(ae(r,i)))}),d=document.hidden===void 0?Function.prototype:e.safe(()=>e.send(ke(document.hidden)));e.attachStartCallback(()=>{n=null,a=D(),r=i=-1,l(),u(),d()}),document.hidden!==void 0&&e.attachEventListener(document,`visibilitychange`,d,!1,!1),e.ticker.attach(l,1,!1),e.ticker.attach(u,5,!1)}var ki={checkCssInterval:200,scanInMemoryCSS:!1,checkLimit:void 0};function Ai(e,t){if(e===null)return;if(!window.CSSStyleSheet){e.send(Pe(`no_stylesheet_prototype_in_window`,``));return}let n={...ki,...t},r=new Map,i=null,a=new Set,o=n.checkCssInterval||200,s={};function c(){if(!n.scanInMemoryCSS)return;let t=a.values();for(let i of t)try{let t=$t.get(i);if(!t)continue;if(n.checkLimit&&(s[t]=(s[t]??0)+1,s[t]>n.checkLimit)){a.delete(i);continue}for(let n=0;n<i.cssRules.length;n++)try{let a=i.cssRules[n],o=`${t}:${n}`,s=r.get(o),c=a.cssText;s!==c&&(s===void 0||e.send(Ve(t,n)),e.send(Be(t,c,n,e.getBaseHref())),r.set(o,c))}catch{}let o=Array.from(r.keys()).filter(e=>e.startsWith(`${t}:`));for(let e of o)parseInt(e.split(`:`)[1],10)>=i.cssRules.length&&r.delete(e)}catch{a.delete(i)}}let l=/{\s*}/;function u(e){return l.test(e)}let d=e.safe((t,n,i)=>{let o=$t.get(t);o&&(typeof i==`string`?(e.send(Be(o,i,n,e.getBaseHref())),u(i)&&(r.set(`${o}:${n}`,i),a.add(t))):(e.send(Ve(o,n)),r.has(`${o}:${n}`)&&r.delete(`${o}:${n}`)))}),f=e.safe(t=>{let n=t;for(;n.parentRule;)n=n.parentRule;let i=n.parentStyleSheet;if(!i)return;let o=$t.get(i);if(!o)return;let s=n.cssText,c=Array.from(i.cssRules).indexOf(n);c>=0&&(e.send(Be(o,s,c,e.getBaseHref())),e.send(Ve(o,c+1)),u(s)&&(r.set(`${o}:${c}`,s),a.add(i)))}),p=e.safe(e=>{if(e.__css_tracking_patched__)return;e.__css_tracking_patched__=!0;let{insertRule:t,deleteRule:n}=e.CSSStyleSheet.prototype,{insertRule:r,deleteRule:i}=e.CSSGroupingRule.prototype;e.CSSStyleSheet.prototype.insertRule=function(e,n=0){let r=t.call(this,e,n);return d(this,r,e),r},e.CSSStyleSheet.prototype.deleteRule=function(e){return d(this,e),n.call(this,e)},e.CSSGroupingRule.prototype.insertRule=function(e,t=0){let n=r.call(this,e,t);return f(this),n},e.CSSGroupingRule.prototype.deleteRule=function(e){let t=i.call(this,e);return f(this),t}});
103p(window),e.observer.attachContextCallback(p),e.nodes.attachNodeCallback(t=>{if(!Et(t,`style`)||!t.sheet||t.textContent!==null&&t.textContent.trim().length>0)return;let n=e.nodes.getID(t);if(!n)return;let r=t.sheet,i;try{i=r.cssRules}catch(t){e.debug.log(`Couldnt access stylesheet during initial scan`,t);return}let a=Qt();$t.set(r,a),e.send(He(a,n));for(let t=0;t<i.length;t++)try{d(r,t,i[t].cssText)}catch(t){e.debug.log(`Couldnt access stylesheet rule during initial scan`,t)}});function m(){i||!n.scanInMemoryCSS||(i=window.setInterval(c,o))}setTimeout(m,50),e.attachStopCallback(()=>{i&&=(clearInterval(i),null),r.clear()})}function ji(e){function t(t){let n=e.nodes.getID(t);n!==void 0&&e.send(je(n))}let n=!1;e.nodes.attachNodeCallback(r=>{Et(r,`body`)&&(e.nodes.attachNodeListener(r,`focus`,e=>{vt(e.target)&&(t(e.target),n=!1)}),e.nodes.attachNodeListener(r,`blur`,t=>{t.relatedTarget===null&&(n=!0,setTimeout(()=>{n&&e.send(je(-1))},0))}))}),e.attachStartCallback(()=>{let e=document.activeElement;for(;e&&Et(e,`iframe`)&&e.contentDocument;)e=e.contentDocument.activeElement;e&&e!==e.ownerDocument.body&&t(e)},!0)}function Mi(e){if(!window.FontFace)return;let t=new Map,n=n=>{class r extends n.FontFace{constructor(...r){if(typeof r[1]==`string`){let i=``;r[2]&&e.safe(()=>{i=JSON.stringify(r[2])});let a=[r[0],r[1],i],o=t.get(n.document)||[];o.push(a),t.set(n.document,o);let s=n===window?0:e.nodes.getID(n.document);if(s===void 0)return;e.active()&&e.send(Ae(s,...a))}super(...r)}}n.FontFace=r};e.observer.attachContextCallback(n),n(window),e.nodes.attachNodeCallback(e.safe(n=>{if(!wt(n))return;let r=t.get(n);if(!r)return;let i=n.defaultView===window?0:e.nodes.getID(n);i!==void 0&&r.forEach(t=>{e.send(Ae(i,...t))})}))}function Ni(e,t,n,r,i){e.debug.log(`Openreplay: attaching axios spy to instance`,t);function a(t){e.debug.log(`Openreplay: capturing axios response data`,t);let{headers:a,data:o,method:s,url:c,baseURL:l}=t.config,{data:u,headers:d,status:f,response:p}=t,{data:m,headers:h,status:g}=p||{},_=n.ignoreHeaders,v=Array.isArray(_)?e=>_.includes(e):()=>_;function y(e,t){v(t[0])||(e[t[0]]=t[1])}let b={},x={};a.toJSON?b=a.toJSON():a instanceof Headers?a.forEach((e,t)=>y(b,[t,e])):Array.isArray(a)?a.forEach(e=>y(b,e)):typeof a==`object`&&Object.entries(a).forEach(e=>y(b,e));let S=h||d;S.toJSON?x=S.toJSON():S instanceof Headers?S.forEach((e,t)=>y(x,[t,e])):Array.isArray(S)?S.forEach(e=>y(x,e)):typeof S==`object`&&Object.entries(S).forEach(([e,t])=>{v(e)||(x[e]=t)});let C=r({url:c,method:s||``,status:f||g||0,request:{headers:b,body:o},response:{headers:x,body:m||u}});if(!C){e.debug.log(`Openreplay: empty request/response info, skipping`);return}let w=t.config.__openreplay_timing,T=performance.now()-w;e.debug.log(`Openreplay: final req object`,C),e.send(Ge(`xhr`,String(s),String(C.url),i(C.request),i(C.response),C.status,w+D(),T,0))}function o(t){if(e.debug.log(`Openreplay: capturing API request`,t),t.__openreplay_timing=performance.now(),n.sessionTokenHeader){let r=typeof n.sessionTokenHeader==`string`?n.sessionTokenHeader:`X-OpenReplay-Session-Token`,i=e.getSessionToken();i&&t.headers.set(r,i)}return t}function s(e){return n.failuresOnly||a(e),e}function c(t){return e.debug.log(`Openreplay: capturing API request error`,t),Pi(t)&&t.response?a(t.response):t instanceof Error&&e.send(ur(t,[])),Promise.reject(t)}function l(t){e.debug.log(`Openreplay: failed API request, skipping`,t)}let u=t.interceptors.request.use(o,l,{synchronous:!0}),d=t.interceptors.response.use(s,c,{synchronous:!0});e.attachStopCallback(()=>{t.interceptors.request.eject?.(u),t.interceptors.response.eject?.(d)})}function Pi(e){return Fi(e)&&e.isAxiosError===!0}function Fi(e){return typeof e==`object`&&!!e}var Ii=new Set(`password.pass.pwd.mdp.token.bearer.jwt.api_key.api-key.apiKey.secret.ssn.zip.zipcode.x-api-key.www-authenticate.x-csrf-token.x-requested-with.x-forwarded-for.x-real-ip.cookie.authorization.auth.proxy-authorization.set-cookie.account_key`.split(`.`));function Li(e){return(Math.log10((e^e>>31)-(e>>31))|0)+1}function Ri(e){if(typeof e==`number`){let t=Li(e);return`9`.repeat(t)}return typeof e==`string`?e.replace(/[^\f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff\s]/g,`*`):e}function zi(e){let t={};if(Array.isArray(e))e.forEach(({name:e,value:n})=>{Ii.has(e.toLowerCase())?t[e]=Ri(n):t[e]=n});else for(let[n,r]of Object.entries(e))Ii.has(n.toLowerCase())?t[n]=Ri(r):t[n]=r;return t}function Bi(e){if(!e)return e;let t,n=!1;try{t=JSON.parse(e),n=!0}catch{}if(n)return Hi(t),JSON.stringify(t);if(typeof e==`string`&&e.includes(`?`)&&e.includes(`=`))try{let t=new URLSearchParams(e);for(let e of t.keys())if(Ii.has(e.toLowerCase())){let n=Ri(t.get(e));t.set(e,n)}return t.toString()}catch{return e}else return e}function Vi(e){return Hi(e),e}function Hi(e){if(Array.isArray(e))e.forEach(Hi);else if(e&&typeof e==`object`)for(let t in e)Object.hasOwn(e,t)&&(Ii.has(t.toLowerCase())?e[t]=Ri(e[t]):e[t]!==null&&typeof e[t]==`object`&&Hi(e[t]))}function Ui(e){if(!e)return``;try{let t=new URL(e);if(t.searchParams)for(let e of t.searchParams.keys())Ii.has(e.toLowerCase())&&t.searchParams.set(e,`******`);return t.toString()}catch{return e}}var Wi=class{constructor(e=[],t,n){this.ignoredHeaders=e,this.setSessionTokenHeader=t,this.sanitize=n,this.id=``,this.name=``,this.method=``,this.url=``,this.status=0,this.statusText=``,this.cancelState=0,this.readyState=0,this.header={},this.responseType=``,this.requestType=`xhr`,this.requestHeader={},this.responseSize=0,this.responseSizeText=``,this.startTime=0,this.endTime=0,this.duration=0,this.getData={},this.requestData=null}getMessage(){let{reqHs:e,resHs:t}=this.writeHeaders(),n=this.method===`GET`?JSON.stringify(Vi(this.getData)):Bi(this.requestData),r={headers:zi(e),body:n},i={headers:zi(t),body:Bi(this.response)},a=this.sanitize({url:Ui(this.url),method:this.method,status:this.status,request:r,response:i});return a?((a.url.includes(`/graphql`)||Object.values(a.request.headers).some(e=>e&&typeof e==`string`&&e.includes(`application/graphql-response`)))&&a.response.body&&typeof a.response.body==`string`&&(a.status=a.response.body.includes(`errors`)?400:200,this.requestType=`graphql`),{requestType:this.requestType,method:a.method,url:a.url,request:JSON.stringify(a.request),response:JSON.stringify(a.response),status:a.status,startTime:this.startTime,duration:this.duration,responseSize:this.responseSize}):null}writeHeaders(){let e={};Object.entries(this.requestHeader).forEach(([t,n])=>{this.isHeaderIgnored(t)||(e[t]=n)}),this.setSessionTokenHeader((t,n)=>{e[t]=n});let t={};return Object.entries(this.header).forEach(([e,n])=>{this.isHeaderIgnored(e)||(t[e]=n)}),{reqHs:e,resHs:t}}isHeaderIgnored(e){return Array.isArray(this.ignoredHeaders)?this.ignoredHeaders.map(e=>e.toLowerCase()).includes(e.toLowerCase()):this.ignoredHeaders}},Gi=(e,t)=>{let n=``;switch(e){case``:case`text`:case`json`:typeof t==`string`?n=t:Ji(t)||Array.isArray(t)?n=JSON.stringify(t):t!==void 0&&(n=Object.prototype.toString.call(t));break;default:t!==void 0&&(n=Object.prototype.toString.call(t));break}return n},Ki=e=>{if(!e)return null;let t;try{if(typeof e==`string`){(e[0]===`{`||e[0]===`[`)&&(t=e);let n=e.split(`&`);t=n.length===1?e:n.join(`,`)}else if(Yi(e)){let n=[];for(let[t,r]of e)n.push(`${t}=${typeof r==`string`?r:`[object Object]`}`);t=n.join(`,`)}else t=e instanceof Blob||e instanceof ReadableStream||ArrayBuffer.isView(e)||e instanceof ArrayBuffer?`byte data`:Ji(e)?e:`can't parse body ${typeof e}`;return t}catch{return`can't parse body`}},qi=(e,t={})=>{Ji(t)||(t={});let n=e?e.split(`?`):[];if(n.shift(),n.length>0){n=n.join(`?`).split(`&`);for(let e of n){let n=e.split(`=`);try{t[n[0]]=decodeURIComponent(n[1])}catch{t[n[0]]=n[1]}}}return t};function Ji(e){return typeof e==`object`&&!!e}function Yi(e){return e==null||ArrayBuffer.isView(e)?!1:typeof Symbol<`u`&&typeof e[Symbol.iterator]==`function`}function Xi(e){return e<=0?``:e>=1e3*1e3?(e/1e3/1e3).toFixed(1)+` MB`:e>=1e3?(e/1e3).toFixed(1)+` KB`:`${e}B`}var Zi=e=>(e.startsWith(`//`)&&(e=`${new URL(window.location.href).protocol}${e}`),e.startsWith(`http`)?new URL(e):new URL(e,window.location.href)),Qi=e=>e instanceof Blob?e.type:e instanceof FormData?`multipart/form-data`:e instanceof URLSearchParams?`application/x-www-form-urlencoded;charset=UTF-8`:`text/plain;charset=UTF-8`,$i=class{constructor(e,t,n,r,i){this.ignoredHeaders=e,this.setSessionTokenHeader=t,this.sanitize=n,this.sendMessage=r,this.isServiceUrl=i}apply(e,t,n){let r=n[0],i=n[1],a=new Wi(this.ignoredHeaders,this.setSessionTokenHeader,this.sanitize);if(this.isServiceUrl(r))return e.apply(t,n);let o=Zi(r);if(a.method=`POST`,a.url=r,a.name=(o.pathname.split(`/`).pop()||``)+o.search,a.requestType=`beacon`,a.requestHeader={"Content-Type":Qi(i)},a.status=0,a.statusText=`Pending`,o.search&&o.searchParams){a.getData={};for(let[e,t]of o.searchParams)a.getData[e]=t}a.requestData=Ki(i),a.startTime||=performance.now();let s=e.apply(t,n);s?(a.endTime=performance.now(),a.duration=a.endTime-(a.startTime||a.endTime),a.status=0,a.statusText=`Sent`,a.readyState=4):(a.status=500,a.statusText=`Unknown`);let c=a.getMessage();return c&&this.sendMessage(c),s}},ea=class{static create(e,t,n,r,i,a){if(e)return new Proxy(e,new $i(t,n,r,i,a))}},ta=class{constructor(e,t){this.resp=e,this.item=t}set(e,t,n){return Reflect.set(e,t,n)}get(e,t){let n=Reflect.get(e,t);if(t===`arrayBuffer`||t===`blob`)return typeof n==`function`?n.bind(e):n;switch(t){case`formData`:case`json`:case`text`:return()=>(this.item.responseType=t.toLowerCase(),n.apply(e).then(e=>(this.item.response=Gi(this.item.responseType,e),e)))}return typeof n==`function`?n.bind(e):n}},na=class{constructor(e,t,n,r,i,a){this.ignoredHeaders=e,this.setSessionTokenHeader=t,this.sanitize=n,this.sendMessage=r,this.isServiceUrl=i,this.tokenUrlMatcher=a}apply(e,t,n){let r=n[0],i=n[1];if(!r||typeof r!=`string`&&!r?.url||(r instanceof URL||typeof r==`string`?this.isServiceUrl(String(r)):this.isServiceUrl(String(r.url))))return e.apply(window,n);let a=new Wi(this.ignoredHeaders,this.setSessionTokenHeader,this.sanitize);this.beforeFetch(a,r,i);let o=(n[0]instanceof Request?n[0].signal:void 0)||n[1]?.signal,s=!1,c=()=>
103{if(s)return;s=!0,a.endTime=performance.now(),a.duration=a.endTime-(a.startTime||a.endTime),a.status=0,a.statusText=`Aborted`,a.readyState=0;let e=a.getMessage();e&&this.sendMessage(e)};return o&&(o.aborted?c():o.addEventListener(`abort`,c,{once:!0})),this.setSessionTokenHeader((e,t)=>{if(!(this.tokenUrlMatcher!==void 0&&!this.tokenUrlMatcher(a.url))){if(n[1]===void 0&&n[0]instanceof Request)return n[0].headers.append(e,t);n[1]||={},n[1].headers===void 0&&(n[1]=Object.assign(Object.assign({},n[1]),{headers:{}})),n[1].headers instanceof Headers?n[1].headers.append(e,t):Array.isArray(n[1].headers)?n[1].headers.push([e,t]):n[1].headers[e]=t}}),e.apply(window,n).then(this.afterFetch(a,()=>{s=!0})).catch(e=>{if(a.endTime=performance.now(),a.duration=a.endTime-(a.startTime||a.endTime),e&&e.name===`AbortError`&&(a.status=0,a.statusText=`Aborted`,a.readyState=0,!s)){let e=a.getMessage();e&&this.sendMessage(e)}throw e})}beforeFetch(e,t,n){let r,i=`GET`,a={};if(typeof t==`string`?(i=n?.method||`GET`,r=Zi(t),a=n?.headers||{}):(i=t.method||`GET`,r=Zi(t.url),a=t.headers),e.method=i,e.requestType=`fetch`,e.requestHeader=a,e.url=r.toString(),e.name=(r.pathname.split(`/`).pop()||``)+r.search,e.status=0,e.statusText=`Pending`,e.readyState=1,e.startTime||=performance.now(),Object.prototype.toString.call(a)===`[object Headers]`){e.requestHeader={};for(let[t,n]of a)e.requestHeader[t]=n}else e.requestHeader=a;if(r.search&&r.searchParams){e.getData={};for(let[t,n]of r.searchParams)e.getData[t]=n}n?.body&&(e.requestData=Ki(n.body))}afterFetch(e,t){return n=>{t&&t?.(),e.endTime=performance.now(),e.duration=e.endTime-(e.startTime||e.endTime),e.status=n.status,e.statusText=String(n.status);let r=!1;e.header={};for(let[t,i]of n.headers)e.header[t]=i,r=i.toLowerCase().indexOf(`chunked`)>-1?!0:r;r?e.readyState=3:(e.readyState=4,this.handleResponseBody(n.clone(),e).then(t=>{e.responseSize=typeof t==`string`?t.length:t.byteLength,e.responseSizeText=Xi(e.responseSize),e.response=Gi(e.responseType,t);let n=e.getMessage();n&&this.sendMessage(n)}).catch(t=>{if(t.name===`AbortError`){e.status=0,e.statusText=`Aborted`,e.readyState=0;let t=e.getMessage();t&&this.sendMessage(t)}else throw t}));let i=(n.headers.get(`content-type`)||``).toLowerCase();return i.includes(`application/json`)||i.startsWith(`text/`)?new Proxy(n,new ta(n,e)):n}}handleResponseBody(e,t){let n=e.headers.get(`content-type`);return n&&n.includes(`application/json`)?(t.responseType=`json`,e.text()):n&&(n.includes(`text/html`)||n.includes(`text/plain`))?(t.responseType=`text`,e.text()):(t.responseType=`arraybuffer`,e.arrayBuffer())}},ra=class{static create(e,t,n,r,i,a){return new Proxy(fetch,new na(e,t,n,r,i,a))}},ia;(function(e){e[e.UNSENT=0]=`UNSENT`,e[e.OPENED=1]=`OPENED`,e[e.HEADERS_RECEIVED=2]=`HEADERS_RECEIVED`,e[e.LOADING=3]=`LOADING`,e[e.DONE=4]=`DONE`})(ia||={});var aa=class{constructor(e,t,n,r,i,a,o){this.ignoredHeaders=t,this.setSessionTokenHeader=n,this.sanitize=r,this.sendMessage=i,this.isServiceUrl=a,this.tokenUrlMatcher=o,this.XMLReq=e,this.XMLReq.onreadystatechange=()=>{this.onReadyStateChange()},this.XMLReq.onabort=()=>{this.onAbort()},this.XMLReq.ontimeout=()=>{this.onTimeout()},this.item=new Wi(t,n,r),this.item.requestType=`xhr`}get(e,t){switch(t){case`open`:return this.getOpen(e);case`send`:return this.setSessionTokenHeader((t,n)=>{this.tokenUrlMatcher!==void 0&&!this.tokenUrlMatcher(this.item.url)||e.readyState===1&&e.setRequestHeader(t,n)}),this.getSend(e);case`setRequestHeader`:return this.getSetRequestHeader(e);default:let n=Reflect.get(e,t);return typeof n==`function`?n.bind(e):n}}set(e,t,n){switch(t){case`onreadystatechange`:return this.setOnReadyStateChange(e,t,n);case`onabort`:return this.setOnAbort(e,t,n);case`ontimeout`:return this.setOnTimeout(e,t,n)}return Reflect.set(e,t,n)}onReadyStateChange(){if(this.item.url&&this.isServiceUrl(this.item.url))return;this.item.readyState=this.XMLReq.readyState,this.item.responseType=this.XMLReq.responseType,this.item.endTime=performance.now(),this.item.duration=this.item.endTime-this.item.startTime,this.updateItemByReadyState();let e=this.item.responseType||``;if((e===``||e===`text`||e===`json`)&&setTimeout(()=>{this.item.response=Gi(e,this.XMLReq.response)}
103,0),this.XMLReq.readyState===ia.DONE){let e=this.item.getMessage();e&&this.sendMessage(e)}}onAbort(){this.item.cancelState=1,this.item.statusText=`Abort`;let e=this.item.getMessage();e&&this.sendMessage(e)}onTimeout(){this.item.cancelState=3,this.item.statusText=`Timeout`;let e=this.item.getMessage();e&&this.sendMessage(e)}getOpen(e){let t=Reflect.get(e,`open`);return(...n)=>{let r=n[0],i=n[1];return this.item.method=r?r.toUpperCase():`GET`,this.item.url=i.toString?.call(i)||``,this.item.name=this.item.url?.replace(RegExp(`/*$`),``).split(`/`).pop()??``,this.item.getData=qi(this.item.url,{}),t.apply(e,n)}}getSend(e){let t=Reflect.get(e,`send`);return(...n)=>{let r=n[0];return this.item.requestData=Ki(r),t.apply(e,n)}}getSetRequestHeader(e){let t=Reflect.get(e,`setRequestHeader`);return(...n)=>(this.item.requestHeader||(this.item.requestHeader={}),this.item.requestHeader[n[0]]=n[1],t.apply(e,n))}setOnReadyStateChange(e,t,n){return Reflect.set(e,t,(...t)=>{this.onReadyStateChange(),n?.apply(e,t)})}setOnAbort(e,t,n){return Reflect.set(e,t,(...t)=>{this.onAbort(),n.apply(e,t)})}setOnTimeout(e,t,n){return Reflect.set(e,t,(...t)=>{this.onTimeout(),n.apply(e,t)})}updateItemByReadyState(){switch(this.XMLReq.readyState){case ia.UNSENT:case ia.OPENED:this.item.status=ia.UNSENT,this.item.statusText=`Pending`,this.item.startTime||(this.item.startTime=performance.now());break;case ia.HEADERS_RECEIVED:this.item.status=this.XMLReq.status,this.item.statusText=`Loading`,this.item.header={};let e=(this.XMLReq.getAllResponseHeaders()||``).split(` 104`);for(let t=0;t<e.length;t++){let n=e[t];if(!n)continue;let r=n.split(`: `),i=r[0];this.item.header[i]=r.slice(1).join(`: `)}break;case ia.LOADING:this.item.status=this.XMLReq.status,this.item.statusText=`Loading`;let t=this.XMLReq.response;if(t){let e=typeof t==`string`?t.length:t instanceof ArrayBuffer?t.byteLength:typeof Blob<`u`&&t instanceof Blob?t.size:0;e&&(this.item.responseSize=e,this.item.responseSizeText=Xi(this.item.responseSize))}break;case ia.DONE:this.item.status=this.XMLReq.status||this.item.status||0,this.item.statusText=String(this.item.status),this.item.endTime=performance.now(),this.item.duration=this.item.endTime-(this.item.startTime||this.item.endTime);let n=this.XMLReq.response,r=this.XMLReq.responseType||``;if((r===``||r===`text`||r===`json`)&&(this.item.response=n),n){let e=typeof n==`string`?n.length:n instanceof ArrayBuffer?n.byteLength:typeof Blob<`u`&&n instanceof Blob?n.size:0;e&&(this.item.responseSize=e,this.item.responseSizeText=Xi(e))}break;default:this.item.status=this.XMLReq.status,this.item.statusText=`Unknown`;break}}},oa=class{static create(e,t,n,r,i,a){return new Proxy(XMLHttpRequest,{construct(o){let s=new o;return new Proxy(s,new aa(s,e,t,n,r,i,a))}})}},sa=e=>{let t=`Openreplay: Can't find ${e} in global context.`;console.warn(t)},ca=Symbol(`OpenReplayProxyOriginal`),la=e=>!!e&&e[ca]!==void 0,ua=e=>la(e)?e[ca]:e,da=(e,t)=>(e[ca]=t,e);function fa(e,t,n,r,i,a,o={xhr:!0,fetch:!0,beacon:!0},s){if(e){if(o.xhr){let o=ua(e.XMLHttpRequest);o?e.XMLHttpRequest=da(oa.create(t,n,r,i,a,s),o):sa(`XMLHttpRequest`)}if(o.fetch){let o=ua(e.fetch);o?e.fetch=da(ra.create(t,n,r,i,a,s),o):sa(`fetch`)}if(o.beacon&&e.navigator?.sendBeacon){let o=ua(e.navigator.sendBeacon);e.navigator.sendBeacon=da(ea.create(o,t,n,r,i,a),o)}}}function pa(e){return e.__or_req_data__||={body:void 0,headers:{}},e.__or_req_data__}function ma(e){return typeof e==`string`?e.toUpperCase():`GET`}function ha(e,t={}){if(t.disabled)return;let n=Object.assign({failuresOnly:!1,ignoreHeaders:[`cookie`,`set-cookie`,`authorization`],capturePayload:!1,sessionTokenHeader:!1,captureInIframes:!0,axiosInstances:void 0,useProxy:!0},t);n.useProxy===!1&&e.debug.warn(`Network module is migrating to proxy api, to gradually migrate and test it set useProxy to true`);let r=n.ignoreHeaders,i=Array.isArray(r)?e=>r.includes(e):()=>r,a=n.sessionTokenHeader===!0?`X-OpenReplay-SessionToken`:n.sessionTokenHeader;function o(t){if(a){let n=e.getSessionToken();n&&e.safe(t)(a,n)}}function s(t){if((!n.capturePayload||e.sanitizer.privateMode)&&(delete t.request.body,delete t.response.body),n.sanitizer){let e=t.response.body;if(typeof e==`string`)try{t.response.body=JSON.parse(e)}catch{}return n.sanitizer(t)}return t}function c(t){if(t&&typeof t.body!=`string`)try{t.body=JSON.stringify(t.body)}catch{t.body=`<unable to stringify>`,e.notify.warn(`Openreplay fetch couldn't stringify body:`,t.body)}return JSON.stringify(t)}let l=t=>{if(n.useProxy)return fa(t,e.sanitizer.privateMode?!0:n.ignoreHeaders,o,s,t=>{if(n.failuresOnly&&t.status<400)return;let r=e.sanitizer.privateMode?`************`:t.url;e.send(Ge(t.requestType,t.method,r,t.request,t.response,t.status,t.startTime+D(),t.duration,t.responseSize))},t=>e.isServiceURL(t),{xhr:!0,fetch:!0,beacon:!0},n.tokenUrlMatcher);let a=t.fetch.bind(t);t.fetch=(t,l={})=>
104{if(!(typeof t==`string`||t instanceof URL)||e.isServiceURL(String(t)))return a(t,l);o(function(e,t){l.headers===void 0&&(l.headers={}),l.headers instanceof Headers?l.headers.append(e,t):Array.isArray(l.headers)?l.headers.push([e,t]):l.headers[e]=t});let u=performance.now();return a(t,l).then(a=>{let o=performance.now()-u;if(n.failuresOnly&&a.status<400)return a;let d=a.clone();return d.text().then(n=>{let a={},f={};if(r!==!0){let e=([e,t])=>{i(e)||(a[e]=t)};l.headers instanceof Headers?l.headers.forEach((t,n)=>e([n,t])):Array.isArray(l.headers)?l.headers.forEach(e):typeof l.headers==`object`&&Object.entries(l.headers).forEach(e),d.headers.forEach((e,t)=>{i(t)||(f[t]=e)})}let p=ma(l.method),m=s({url:String(t),method:p,status:d.status,request:{headers:a,body:l.body||null},response:{headers:f,body:n}});m&&e.send(Ge(`fetch`,p,String(m.url),c(m.request),c(m.response),d.status,u+D(),o,0))}).catch(t=>e.debug.error(`Could not process Fetch response:`,t)),a})};let l=t.XMLHttpRequest.prototype.open,u=t.XMLHttpRequest.prototype.setRequestHeader,d=t.XMLHttpRequest.prototype.send;function f(t,n){let r=this;o((e,t)=>r.setRequestHeader(e,t));let a=0;return r.addEventListener(`loadstart`,e=>{a=e.timeStamp}),r.addEventListener(`load`,e.safe(o=>{let{headers:l,body:u}=pa(r),d=a>0?o.timeStamp-a:0,f=(r.getAllResponseHeaders()||``).trim().split(/[\r\n]+/),p={};f.forEach(function(e){let t=e.split(`: `),n=t.shift();i(n)||(p[n]=t.join(`: `))});let m=ma(t),h=s({url:String(n),method:m,status:r.status,request:{headers:l,body:u||null},response:{headers:p,body:r.response}});h&&e.send(Ge(`xhr`,m,String(h.url),c(h.request),c(h.response),r.status,a+D(),d,0))})),l.apply(this,arguments)}function p(e){let t=pa(this);return t.body=e,d.apply(this,arguments)}function m(e,t){if(!i(e)){let n=pa(this);n.headers[e]=t}return u.apply(this,arguments)}n.axiosInstances||(t.XMLHttpRequest.prototype.open=f,t.XMLHttpRequest.prototype.send=p,t.XMLHttpRequest.prototype.setRequestHeader=m)};l(window),n.axiosInstances&&n.axiosInstances.forEach(t=>{Ni(e,t,n,s,c)}),n.captureInIframes&&e.observer.attachContextCallback(e.safe(l))}function ga(e){e.attachEventListener(document,`selectionchange`,()=>{let t=document.getSelection();if(t!==null&&!t.isCollapsed){let n=e.nodes.getID(t.anchorNode),r=e.nodes.getID(t.focusNode),i=t.toString().replace(/\s+/g,` `);n&&r&&e.send(Ze(n,r,i))}else e.send(Ze(-1,-1,``))})}function _a(e){function t(){document.hidden||(e.debug.log(`Openreplay: tab change to`+e.session.getTabId()),e.send(et(e.session.getTabId())))}e.attachStartCallback(()=>{t()}),e.attachEventListener(window,`focus`,t,!1,!1)}function va(e,t){if(!t.longTasks||!(`PerformanceObserver`in window))return;let n=t=>{e.send(Ye(t.name,t.duration,t.blockingDuration,t.firstUIEventTimestamp,t.startTime,JSON.stringify(t.scripts??[])))},r=new PerformanceObserver(e=>{e.getEntries().forEach(e=>{e.entryType===`long-animation-frame`&&n(e)})});e.attachStartCallback(()=>{performance.getEntriesByType(`long-animation-frame`).forEach(e=>{n(e)}),r.observe({entryTypes:[`long-animation-frame`]})}),e.attachStopCallback(()=>{r.disconnect()})}var ya=[`composite`,`computedOffset`,`easing`,`offset`];function ba(e,t={}){let{allElements:n=!1}=t,r=new WeakSet,i=new WeakSet;function a(t,n,r){i.has(t)||(i.add(t),t.addEventListener(`finish`,()=>{let i=t.effect.getKeyframes().at(-1);if(!i||!n||!(n instanceof Element)||!n.isConnected)return;let a=getComputedStyle(n),o=Object.keys(i).filter(e=>!ya.includes(e)),s={};o.forEach(e=>{s[e]=a[e]}),e.send(Ee(r,JSON.stringify(s)))},{once:!0}))}function o(e,t){e.getAnimations({subtree:!1}).forEach(n=>a(n,e,t))}e.nodes.attachNodeCallback(t=>{if((n||t.nodeName.includes(`-`))&&`getAnimations`in t){let n=t.getAnimations({subtree:!1}),i=e.nodes.getID(t);n.length>0&&!r.has(t)&&i&&(r.add(t),o(t,i),t.addEventListener(`animationstart`,()=>o(t,i)))}});let s=Element.prototype.animate;Element.prototype.animate=function(...t){let n=s.apply(this,t),r=e.nodes.getID(this);return r&&a(n,this,r),n},e.attachStopCallback(()=>{Element.prototype.animate=s,r=new WeakSet,i=new WeakSet})}function xa(e,t){let n=0,r=0,i=``;e.screen.width&&(n=e.screen.width,r=e.screen.height,i=`${n} x ${r}`);let a=e.navigator.appVersion??`0`,o=e.navigator.userAgent??`unknown`,s=e.navigator.appName??`unknown`,c=String(parseFloat(a)),l,u,d;(u=o.indexOf(`YaBrowser`))===-1?(u=o.indexOf(`SamsungBrowser`))===-1?(u=o.indexOf(`UCBrowser`))===-1?(u=o.indexOf(`OPR`))===-1?(u=o.indexOf(`Opera`))===-1?(u=o.indexOf(`Edge`))===-1?(u=o.indexOf(`Edg`))===-1?(u=o.indexOf(`MSIE`))===-1?(u=o.indexOf(`Chrome`))===-1?(u=o.indexOf(`Safari`))===-1?(u=o.indexOf(`Firefox`))===-1?o.indexOf(`Trident/`)===-1?(l=o.lastIndexOf(` `)+1)<(u=o.lastIndexOf(`/`))&&(s=o.substring(l,u),c=o.substring(u+1),s.toLowerCase()===s.toUpperCase()&&(s=e.navigator.appName)):(s=`Microsoft Internet Explorer`,c=o.substring(o.indexOf(`rv:`)+3)):(s=`Firefox`,c=o.substring(u+8)):(s=`Safari`,c=o.substring(u+7),(u=o.indexOf(`Version`))!==-1&&(c=o.substring(u+8))):(s=`Chrome`,c=o.substring(u+7)):(s=`Microsoft Internet Explorer`,c=o.substring(u+5)):(s=`Microsoft Edge`,c=o.substring(u+4)):(s=`Microsoft Legacy Edge`,c=o.substring(u+5)):(s=`Opera`,c=o.substring(u+6),(u=o.indexOf(`Version`))!==-1&&(c=o.substring(u+8))):(s=`Opera`,c=o.substring(u+4)):(s=`UC Browser`,c=o.substring(u+10)):(s=`Samsung`,c=o.substring(u+15)):(s=`Yandex`,c=o.substring(u+10)),(d=c.indexOf(`;`))!==-1&&(c=c.substring(0,d)),(d=c.indexOf(` `))!==-1&&(c=c.substring(0,d)),(d=c.indexOf(`)`))!==-1&&(c=c.substring(0,d));let f=parseInt(c,10);isNaN(f)&&(c=String(parseFloat(a)),f=parseInt(a,10));let p=/Mobile|mini|Fennec|Android|iP(ad|od|hone)/.test(a),m=e.navigator.cookieEnabled||!1;navigator.cookieEnabled===void 0&&!m&&(e.document.cookie=`testcookie`,m=e.document.cookie.indexOf(`testcookie`)!==-1);let h=`-`;
104for(let e of[{s:`Windows 10`,r:/(Windows 10.0|Windows NT 10.0)/},{s:`Windows 8.1`,r:/(Windows 8.1|Windows NT 6.3)/},{s:`Windows 8`,r:/(Windows 8|Windows NT 6.2)/},{s:`Windows 7`,r:/(Windows 7|Windows NT 6.1)/},{s:`Windows Vista`,r:/Windows NT 6.0/},{s:`Windows Server 2003`,r:/Windows NT 5.2/},{s:`Windows XP`,r:/(Windows NT 5.1|Windows XP)/},{s:`Windows 2000`,r:/(Windows NT 5.0|Windows 2000)/},{s:`Windows ME`,r:/(Win 9x 4.90|Windows ME)/},{s:`Windows 98`,r:/(Windows 98|Win98)/},{s:`Windows 95`,r:/(Windows 95|Win95|Windows_95)/},{s:`Windows NT 4.0`,r:/(Windows NT 4.0|WinNT4.0|WinNT|Windows NT)/},{s:`Windows CE`,r:/Windows CE/},{s:`Windows 3.11`,r:/Win16/},{s:`Android`,r:/Android/},{s:`Open BSD`,r:/OpenBSD/},{s:`Sun OS`,r:/SunOS/},{s:`Chrome OS`,r:/CrOS/},{s:`Linux`,r:/(Linux|X11(?!.*CrOS))/},{s:`iOS`,r:/(iPhone|iPad|iPod)/},{s:`Mac OS X`,r:/Mac OS X/},{s:`Mac OS`,r:/(Mac OS|MacPPC|MacIntel|Mac_PowerPC|Macintosh)/},{s:`QNX`,r:/QNX/},{s:`UNIX`,r:/UNIX/},{s:`BeOS`,r:/BeOS/},{s:`OS/2`,r:/OS\/2/},{s:`Search Bot`,r:/(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask Jeeves\/Teoma|ia_archiver)/}])if(e.r.test(o)){h=e.s;break}let g=`-`;if(/Windows/.test(h)){let n=/Windows (.*)/.exec(h);if(n&&n[1]&&(g=n[1],g===`10`&&`userAgentData`in e.navigator)){let e=navigator;e.userAgentData&&e.userAgentData.getHighEntropyValues([`platformVersion`]).then(e=>{let n=parseInt(e.platformVersion.split(`.`)[0],10)<13?`10`:`11`;g=n,t?.(n)}).catch(()=>{})}h=`Windows`}switch(h){case`Mac OS`:case`Mac OS X`:case`Android`:{let e=/(?:Android|Mac OS|Mac OS X|MacPPC|MacIntel|Mac_PowerPC|Macintosh) ([\.\_\d]+)/.exec(o);g=e&&e[1]?e[1]:`-`;break}case`iOS`:{let e=/OS (\d+)_(\d+)_?(\d+)?/.exec(a);e&&e[1]&&(g=`${e[1]}.${e[2]}.${parseInt(e[3]||`0`,10)}`);break}}return{screen:i,width:n,height:r,browser:s,browserVersion:c,browserMajorVersion:f,mobile:p,os:h,osVersion:g,cookies:m}}function Sa(e){let t=e===null;return!!(e&&typeof e==`object`&&!Array.isArray(e)&&!t)}function Ca(){let e=new Date().getTimezoneOffset(),t=Math.abs(Math.floor(e/60)),n=Math.abs(e%60);return`UTC${e<=0?`+`:`-`}${t.toString().padStart(2,`0`)}:${n.toString().padStart(2,`0`)}`}var wa=`$__or__initial_ref__$`,Ta=`$__or__distinct_device_id__$`,Ea=`$__or__utm_params__$`,Da=`$__or__super_properties__$`,Oa=`$__or__user_id__$`,ka=`window`in globalThis?window:{navigator:{userAgent:``},screen:{},document:{cookie:``},location:{search:``}},Aa=`document`in globalThis?document:{referrer:``},ja=[`google`,`bing`,`yahoo`,`baidu`,`yandex`,`duckduckgo`,`ecosia`,`ask`,`aol`,`wolframalpha`,`startpage`,`swisscows`,`qwant`,`lycos`,`dogpile`,`info`,`teoma`,`webcrawler`,`naver`,`seznam`,`perplexity`],Ma=class{constructor(e,t){this.localStorage=e,this.sessionStorage=t,this.user_id=null,this.setUserId=e=>{this.user_id=e,this.sessionStorage.setItem(Oa,e??``)},this.resetUserId=e=>{this.user_id=null,e&&(this.deviceId=this.getDistinctDeviceId(!0))},this.getDistinctDeviceId=e=>{let t=this.localStorage.getItem(Ta);if(t&&!e)return t;{let e=`${Math.random().toString(36).slice(2)}-${Math.random().toString(36).slice(2)}-${Math.random().toString(36).slice(2)}`;return this.localStorage.setItem(Ta,e),e}},this.getReferrer=()=>{let e=this.sessionStorage.getItem(wa);if(e)return e;{let e=Aa.referrer;return this.sessionStorage.setItem(wa,e),e}},this.parseUTM=()=>{let e=this.sessionStorage.getItem(Ea);if(e){let t=JSON.parse(e);this.utmSource=t.utm_source,this.utmMedium=t.utm_medium,this.utmCampaign=t.utm_campaign}else{let e=new URLSearchParams(ka.location.search);this.utmSource=e.get(`utm_source`)||null,this.utmMedium=e.get(`utm_medium`)||null,this.utmCampaign=e.get(`utm_campaign`)||null;let t={utm_source:this.utmSource,utm_medium:this.utmMedium,utm_campaign:this.utmCampaign};this.sessionStorage.setItem(Ea,JSON.stringify(t))}}
104,this.getSearchEngine=e=>{for(let t of ja)if(e.includes(t))return t;return null},this.getSuperProperties=()=>{let e=this.localStorage.getItem(Da);return e?JSON.parse(e):{}},this.saveSuperProperties=e=>{this.localStorage.setItem(Da,JSON.stringify(e))},this.clearSuperProperties=()=>{this.localStorage.setItem(Da,JSON.stringify({}))};let{width:n,height:r,browser:i,browserVersion:a,browserMajorVersion:o,os:s,osVersion:c,mobile:l}=xa(ka,e=>{this.osVersion=e}),u=this.sessionStorage.getItem(Oa);u&&(this.user_id=u),this.os=s,this.osVersion=c,this.browser=`${i}`,this.browserVersion=`${a} (${o})`,this.platform=l?`mobile`:`desktop`,this.screenHeight=r,this.screenWidth=n,this.initialReferrer=this.getReferrer(),this.deviceId=this.getDistinctDeviceId(),this.searchEngine=this.getSearchEngine(this.initialReferrer),this.parseUTM()}get all(){return{os:this.os,os_version:this.osVersion,browser:this.browser,browser_version:this.browserVersion,platform:this.platform,screen_height:this.screenHeight,screen_width:this.screenWidth,initial_referrer:this.initialReferrer,utm_source:this.utmSource,utm_medium:this.utmMedium,utm_campaign:this.utmCampaign,user_id:this.user_id,distinct_id:this.deviceId,sdk_edition:`web`,sdk_version:`18.1.3`,timezone:Ca(),search_engine:this.searchEngine}}get defaultPropertyKeys(){return Object.keys(this.all)}get distinctId(){return this.deviceId}},Na={identity:`identity`,deleteUser:`delete_user`,setProperty:`set_property`,setPropertyOnce:`set_property_once`,appendProperty:`append_property`,appendUniqueProperty:`append_unique_property`,incrementProperty:`increment_property`},Pa={people:`user_actions`,events:`events`},Fa=(e,t,n,r)=>{if(e===Pa.people)return{category:e,data:{type:t,user_id:r.user_id,payload:r.properties,timestamp:n}};if(!r)throw Error(`Payload is required for event creation`);return{category:e,data:{name:r.name,payload:r.properties,timestamp:n}}},Ia=[`properties`,`token`,`timestamp`],La=class{constructor(e,t,n){this.constantProperties=e,this.getTimestamp=t,this.batcher=n,this.ownProperties={}
104,this.sendEvent=(e,t,n)=>{let r={};if(t){if(!Sa(t))throw Error(`Properties must be an object`);Object.entries(t).forEach(([e,t])=>{this.constantProperties.defaultPropertyKeys.includes(e)||(r[e]=t)})}let i={name:e,properties:{...this.ownProperties,...r}},a=Fa(Pa.events,void 0,this.getTimestamp(),i);n?.send_immediately?this.batcher.sendImmediately(a):this.batcher.addEvent(a)},this.setProperty=(e,t)=>{let n=!1;Sa(e)&&Object.entries(e).forEach(([e,t])=>{this.constantProperties.defaultPropertyKeys.includes(e)||(this.ownProperties[e]=t,n=!0)}),typeof e==`string`&&t!==void 0&&(this.constantProperties.defaultPropertyKeys.includes(e)||(this.ownProperties[e]=t,n=!0)),n&&this.constantProperties.saveSuperProperties(this.ownProperties)},this.setPropertiesOnce=(e,t)=>{let n=!1;Sa(e)&&Object.entries(e).forEach(([e,t])=>{!this.ownProperties[e]&&!Ia.includes(e)&&(this.ownProperties[e]=t,n=!0)}),typeof e==`string`&&t!==void 0&&!this.ownProperties[e]&&!Ia.includes(e)&&(this.ownProperties[e]=t,n=!0),n&&this.constantProperties.saveSuperProperties(this.ownProperties)},this.unsetProperties=e=>{let t=!1;Array.isArray(e)?e.forEach(e=>{this.ownProperties[e]&&!Ia.includes(e)&&(delete this.ownProperties[e],t=!0)}):this.ownProperties[e]&&!Ia.includes(e)&&(delete this.ownProperties[e],t=!0),t&&this.constantProperties.saveSuperProperties(this.ownProperties)},this.reset=()=>{this.ownProperties={},this.constantProperties.clearSuperProperties()},this.register=this.setProperty,this.register_once=this.setPropertiesOnce,this.unregister=this.unsetProperties,this.track=this.sendEvent,this.ownProperties=this.constantProperties.getSuperProperties()}},Ra=class{constructor(e,t,n,r){this.constantProperties=e,this.getTimestamp=t,this.onId=n,this.batcher=r,this.ownProperties={},this.identify=(e,t)=>{if(!e||typeof e!=`string`)throw Error(`OR SDK: user_id (string) is required for .identify()`);this.constantProperties.user_id&&this.constantProperties.user_id!==e&&this.reset(),this.constantProperties.setUserId(e),t?.fromTracker||this.onId(e);let n=Fa(Pa.people,Na.identity,this.getTimestamp(),{user_id:e});this.batcher.addEvent(n)},this.reset=e=>{this.constantProperties.resetUserId(e),this.ownProperties={}},this.deleteUser=()=>{let e=this.constantProperties.user_id;if(!e)return;this.constantProperties.setUserId(null),this.ownProperties={};let t=Fa(Pa.people,Na.deleteUser,void 0,{user_id:e});this.batcher.addEvent(t),this.reset()},this.setProperties=(e,t)=>{if(!e)throw Error(`OR SDK: no user properties provided to set`);let n={};if(typeof e==`string`&&e&&t)n[e]=t;else if(Sa(e))Object.assign(n,e);else throw Error(`OR SDK: invalid user properties provided to set`);Object.entries(n).forEach(([e,t])=>{this.constantProperties.defaultPropertyKeys.includes(e)||(this.ownProperties[e]=t)});let r=Fa(Pa.people,Na.setProperty,void 0,{user_id:this.user_id,properties:n});this.batcher.addEvent(r)},this.setPropertiesOnce=e=>{if(!Sa(e))throw Error(`Properties must be an object`);Object.entries(e).forEach(([e,t])=>{!this.constantProperties.defaultPropertyKeys.includes(e)&&!this.ownProperties[e]&&(this.ownProperties[e]=t)});let t=Fa(Pa.people,Na.setPropertyOnce,void 0,{user_id:this.user_id,properties:e});this.batcher.addEvent(t)},this.appendValues=(e,t)=>{!this.constantProperties.defaultPropertyKeys.includes(e)&&this.ownProperties[e]&&(Array.isArray(this.ownProperties[e])?this.ownProperties[e].push(t):this.ownProperties[e]=[this.ownProperties[e],t]);let n=Fa(Pa.people,Na.appendProperty,void 0,{properties:{[e]:t},user_id:this.user_id});this.batcher.addEvent(n)},this.appendUniqueValues=(e,t)=>{if(!this.ownProperties[e])return;Array.isArray(this.ownProperties[e])?this.ownProperties[e].includes(t)||this.appendValues(e,t):this.ownProperties[e]!==t&&this.appendValues(e,t);let n=Fa(Pa.people,Na.appendUniqueProperty,void 0,{properties:{[e]:t},user_id:this.user_id});this.batcher.addEvent(n)},this.increment=(e,t)=>{if(this.ownProperties[e]||(this.ownProperties[e]=0),this.ownProperties[e]&&typeof this.ownProperties[e]!=`number`)throw Error(`OR SDK: Property must be a number to increment`);this.ownProperties[e]+=t;let n=Fa(Pa.people,Na.incrementProperty,void 0,{user_id:this.user_id,properties:{[e]:t}});this.batcher.addEvent(n)},this.union=this.appendUniqueValues,this.set=this.setProperties,this.set_once=this.setPropertiesOnce,this.append=this.appendValues,this.incrementBy=this.increment}get user_id(){return this.constantProperties.user_id}},za=class{constructor(e,t,n,r){this.backendUrl=e,this.getToken=t,this.init=n,this.standalone=r,this.autosendInterval=5*1e3,this.retryTimeout=3*1e3,this.retryLimit=3,this.apiEdp=`/v1/sdk/i`,this.batch={[Pa.people]:[],[Pa.events]:[]},this.intervalId=null,this.stopped=!1,this.paused=!1,this.onVisibilityChange=()=>{document.hidden?(this.flush(!0),this.paused=!0):this.paused=!1}}getBatches(){return this.batch[Pa.people]=this.dedupePeopleEvents(),{data:{[Pa.people]:[...this.batch[Pa.people]],[Pa.events]:[...this.batch[Pa.events]]}}}addEvent(e){this.batch[e.category].push(e.data)}sendImmediately(e){this.sendBatch({[e.category]:[e.data]})}dedupePeopleEvents(){let e=this.batch[Pa.people],t=[],n=[];for(let r of e)r.type===`identity`?n.length>0?(t.push(...this.squashPeopleEvents(n),r),n.length=0):t.push(r):n.push(r);return n.length>0&&t.push(...this.squashPeopleEvents(n)),t}squashPeopleEvents(e){if(!e||e.length===0)return[];let t=new Map;for(let n of e){let e=t.get(n.type);if(e){if(n.type===`increment_property`){let r=Object.entries(e.payload),i=Object.entries(n.payload),a=new Set([...r.map(([e])=>e),...i.map(([e])=>e)]),o={};a.forEach(t=>{o[t]=(typeof e.payload[t]==`number`?e.payload[t]:0)+(typeof n.payload[t]==`number`?n.payload[t]:0)}),t.set(n.type,{type:n.type,timestamp:n.timestamp,payload:o});continue}t.set(n.type,{type:n.type,timestamp:n.timestamp,payload:{...e.payload??{},...n.payload??{}}})}else t.set(n.type,n)}return Array.from(t.values())}
104sendBatch(e,t=!1,n){if(this.stopped){n?.();return}let r=e,i=0,a=()=>{let e=this.getToken();if(!e){n?.();return}return i++,fetch(`${this.backendUrl}${this.apiEdp}`,{method:`POST`,keepalive:t,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${e}`},body:JSON.stringify(r)}).then(async e=>{if(e.status===401){let t=await e.json().catch(()=>null);if(!this.standalone&&t?.error===`token expired`){this.stop();return}if(i<this.retryLimit)return this.init().then(()=>{a()});n?.();return}if(e.status===403){if(i<this.retryLimit)return this.init().then(()=>{a()});n?.();return}if(!e.ok)throw Error(`HTTP error! status: ${e.status}`)}).catch(()=>{i<this.retryLimit?setTimeout(()=>void a(),this.retryTimeout):n?.()})};a()}startAutosend(){this.intervalId&&clearInterval(this.intervalId),this.paused=document.hidden,document.addEventListener(`visibilitychange`,this.onVisibilityChange),this.intervalId=setInterval(()=>{this.paused||this.flush()},this.autosendInterval)}flush(e=!1){let t=Object.keys(this.batch);if(t.every(e=>this.batch[e].length===0))return;let n=this.getBatches(),r={[Pa.people]:[...n.data[Pa.people]],[Pa.events]:[...n.data[Pa.events]]};t.forEach(e=>{this.batch[e]=[]}),this.sendBatch(n,e,()=>this.requeue(r))}requeue(e){this.stopped||(this.batch[Pa.people]=[...e[Pa.people],...this.batch[Pa.people]],this.batch[Pa.events]=[...e[Pa.events],...this.batch[Pa.events]])}stop(){this.flush(),this.intervalId&&=(clearInterval(this.intervalId),null),document.removeEventListener(`visibilitychange`,this.onVisibilityChange),this.stopped=!0}restart(){this.stopped=!1,this.startAutosend()}},Ba=`__or_sdk_analytics_token`,Va=class{constructor(e){this.token=null,this.standalone=!1,this._getToken=()=>this.standalone?this.token:this.getToken(),this._getTimestamp=()=>this.standalone?Date.now():this.getTimestamp(),this.init=async()=>{if(this.standalone){let e=this.constantProperties.all,t={projectKey:this.projectKey,defaultFields:e},n=await fetch(`/v1/sdk/start`,{method:`POST`,body:JSON.stringify(t)});if(!n.ok)throw Error(`HTTP error! status: ${n.status}`);let r=await n.json();if(r.token)this.token=r.token,this.sessionStorage.setItem(Ba,r.token);else throw Error(`No token received from server`)}else{this.batcher.startAutosend();return}},this.onStart=()=>{this.standalone||this.batcher.restart()},this.onStop=()=>{this.standalone||this.batcher.stop()},this.reset=()=>{this.people.reset(!0),this.events.reset(),this.batcher.stop(),this.standalone&&(this.token=null,this.sessionStorage.setItem(Ba,``))},this.identify=e=>this.people.identify(e),this.track=(e,t,n)=>this.events.track(e,t,n),this.sessionStorage=e.sessionStorage||sessionStorage,this.localStorage=e.localStorage||localStorage,this.backendUrl=e.ingestPoint,this.projectKey=e.projectKey,this.getToken=e.getToken||(()=>``),this.getTimestamp=e.getTimestamp||(()=>Date.now()),this.setUserId=e.setUserId||(()=>{}),this.standalone=!e.notStandalone,this.token=this.sessionStorage.getItem(Ba),this.constantProperties=new Ma(this.localStorage,this.sessionStorage),this.batcher=new za(this.backendUrl,this._getToken,this.init,this.standalone),this.events=new La(this.constantProperties,this._getTimestamp,this.batcher),this.people=new Ra(this.constantProperties,this._getTimestamp,this.setUserId,this.batcher),e.notStandalone&&this.init()}},Ha=`/en/sdk`;function Ua(e){if(e==null)return console.error(`OpenReplay: invalid options argument type. Please, check documentation on ${M}${Ha}`),!1;if(typeof e.projectKey!=`string`)if(typeof e.projectKey!=`number`){if(typeof e.projectID!=`number`)return console.error(`OpenReplay: projectKey is missing or wrong type (string is expected). Please, check ${M}${Ha} for more information.`),!1;e.projectKey=e.projectID.toString(),P("`projectID` option","`projectKey` option",Ha)}else console.warn(`OpenReplay: projectKey is expected to have a string type.`),e.projectKey=e.projectKey.toString();return e.sessionToken!=null&&P("`sessionToken` option","`sessionHash` start() option",`/`),!0}var Wa=()=>{try{return!!window.top?.document}catch{return!1}},Ga=class{constructor(e){if(this.options=e,this.app=null,this.analytics=null,this.crossdomainMode=!1,this.checkDoNotTrack=()=>this.options.respectDoNotTrack&&(navigator.doNotTrack==`1`||window.doNotTrack==`1`),this.signalStartIssue=(e,t)=>
104{let n=this.checkDoNotTrack();console.log(`Tracker couldn't start due to:`,JSON.stringify({trackerVersion:`18.1.3`,projectKey:this.options.projectKey,doNotTrack:n,reason:t.length?`missing api: ${t.join(`,`)}`:e}))},this.restartCanvasTracking=()=>{this.app!==null&&this.app.restartCanvasTracking()},this.resanitize=e=>{this.app!==null&&this.app.resanitize(e)},this.checkSanitization=e=>{if(this.app!==null)return this.app.checkSanitization(e)},this.getSessionURL=e=>{if(this.app!==null)return this.app.getSessionURL(e)},this.setUserID=e=>{typeof e==`string`&&this.app!==null&&(this.app.session.setUserID(e),this.analytics?.people.identify(e,{fromTracker:!0}))},this.identify=this.setUserID,this.track=(e,t,n)=>this.analytics?.track(e,t,n),this.userID=e=>{P(`'userID' method`,`'setUserID' method`,`/`),this.setUserID(e)},this.handleError=(e,t={})=>{if(this.app!==null){if(e instanceof Error){let n=ur(e,[],t);this.app.send(n)}else if(e instanceof ErrorEvent||`PromiseRejectionEvent`in window&&e instanceof PromiseRejectionEvent){let n=dr(e,void 0,t);n!=null&&this.app.send(n)}}},this.incident=e=>{this.app!==null&&this.app.send(Je(e.label??``,e.startTime,e.endTime??e.startTime))},this.analyticsToken=null,this.setAnalyticsToken=e=>{this.analyticsToken=e},this.getAnalyticsToken=()=>this.analyticsToken?this.analyticsToken:this.app?.session.getSessionToken()??``,this.crossdomainMode=!!(U()&&e.crossdomain?.enabled),!S||!Ua(e))return;if(window.__OPENREPLAY__||!this.crossdomainMode&&U()&&Wa()&&window.top.__OPENREPLAY__){console.error(`OpenReplay: one tracker instance has been initialised already`);return}if(!e.__DISABLE_SECURE_MODE&&location.protocol!==`https:`){console.error("OpenReplay: Your website must be publicly accessible and running on SSL in order for OpenReplay to properly capture and replay the user session. You can disable this check by setting `__DISABLE_SECURE_MODE` option to `true` if you are testing in localhost. Keep in mind, that asset files on a local machine are not available to the outside world. This might affect tracking if you use css files.");return}let t=this.checkDoNotTrack(),n=[],r=[`Map`,`Set`,`MutationObserver`,`performance`,`timing`,`startsWith`,`Blob`,`Worker`];if(t)n.push(`doNotTrack`);else for(let e of r)if(e===`timing`){if(`performance`in window&&!(e in performance)){n.push(e);break}}else if(e===`startsWith`){if(!(e in String.prototype)){n.push(e);break}}else if(!(e in window)){n.push(e);break}if(n.length>0){let e=n.join(`,`);console.error(`OpenReplay: browser doesn't support API required for tracking or doNotTrack is set to 1. Reason: ${e}`),this.signalStartIssue(`missing_api`,n);return}let i=new Ln(e.projectKey,e.sessionToken,e,this.signalStartIssue,this.crossdomainMode);if(this.app=i,e.projectKey&&e.analytics?.active){let t=!1;e.ingestPoint||(t=!0),e.ingestPoint&&new URL(e.ingestPoint).hostname===`api.openreplay.com`&&(t=!0);let n=`https://api.openreplay.com/ingest`;this.analytics=new Va({localStorage:e.localStorage??localStorage,sessionStorage:e.sessionStorage??sessionStorage,getToken:()=>this.getAnalyticsToken(),getTimestamp:()=>this.app?.timestamp()??Date.now(),setUserId:e=>{this.app?.session.setUserID(e)},notStandalone:!0,ingestPoint:t?n:e.analytics?.ingestPoint??e.ingestPoint??n,projectKey:e.projectKey}),i.attachStartCallback(()=>{this.analytics?.onStart()}),i.attachStopCallback(()=>{this.analytics?.onStop()})}this.crossdomainMode||(Oi(i,e.urls),Rn(i),ut(i,e),_a(i)),Ar(i,{...e.mouse,customAttributes:e.customAttributes}),Ei(i,this.crossdomainMode),Ai(i,e.css),en(i),Kn(i,e),fr(i,e),gr(i),Cr(i,e),wi(i,e),va(i,e),ji(i),Mi(i),e.network?.disabled||ha(i,e.network),ga(i),ba(i,e.webAnimations),window.__OPENREPLAY__=this;let a=window.open;(e.autoResetOnWindowOpen||e.resetTabOnWindowOpen)&&(i.attachStartCallback(()=>{let t=i.getTabId(),n=i.sessionStorage??window.sessionStorage;window.open=function(...r){return e.autoResetOnWindowOpen&&i.resetNextPageSession(!0),e.resetTabOnWindowOpen&&n.removeItem(e.session_tabid_key||`__openreplay_tabid`),i.resetNextPageSession(!1),n.setItem(e.session_tabid_key||`__openreplay_tabid`,t),a.call(window,...r)}}),i.attachStopCallback(()=>{window.open=a}))}use(e){return e(this.app,this.options)}isActive(){return this.app===null?!1:this.app.active()}trackWs(e){if(this.app!==null)return this.app.trackWs(e)}start(e){return this.browserEnvCheck()?this.app===null?Promise.reject(`Browser doesn't support required api, or doNotTrack is active.`):(e?.userID&&(this.app.session.setUserID(e.userID),this.analytics?.people.identify(e.userID,{fromTracker:!0})),this.app.start(e)):Promise.reject(`Trying to start not in browser.`)}browserEnvCheck(){return S?!0:(console.error(`OpenReplay: you are trying to start Tracker on a node.js environment. If you want to use OpenReplay with SSR, please, use componentDidMount or useEffect API for placing the \`tracker.start()\` line. Check documentation on ${M}${Ha}`),!1)}coldStart(e,t){if(this.browserEnvCheck()){if(this.app===null)return Promise.reject(`Tracker not initialized`);this.app.coldStart(e,t)}else return Promise.reject(`Trying to start not in browser.`)}startOfflineRecording(e,t){return this.browserEnvCheck()?this.app===null?Promise.reject(`Tracker not initialized`):this.app.offlineRecording(e,t):Promise.reject(`Trying to start not in browser.`)}uploadOfflineRecording(){if(this.app!==null)return this.app.uploadOfflineRecording()}stop(){if(this.app!==null)return this.app.stop(),this.app.session.getSessionHash()}forceFlushBatch(){this.app!==null&&this.app.forceFlushBatch()}getSessionToken(){return this.app===null?null:this.app.getSessionToken()}getSessionInfo(){return this.app===null?null:this.app.session.getInfo()}getSessionID(){return this.app===null?null:this.app.getSessionID()}getTabId(){return this.app===null?null:this.app.getTabId()}sessionID(){return P(`'sessionID' method`,`'getSessionID' method`,`/`),this.get
104SessionID()}setUserAnonymousID(e){typeof e==`string`&&this.app!==null&&this.app.send(we(e))}userAnonymousID(e){P(`'userAnonymousID' method`,`'setUserAnonymousID' method`,`/`),this.setUserAnonymousID(e)}setMetadata(e,t){typeof e==`string`&&typeof t==`string`&&this.app!==null&&this.app.session.setMetadata(e,t)}metadata(e,t){P(`'metadata' method`,`'setMetadata' method`,`/`),this.setMetadata(e,t)}event(e,t=null,n=!1){if(typeof e==`string`&&this.app!==null){if(n)return this.issue(e,t);if(!t||typeof t==`string`)return this.app.send(Se(e,t));try{if(`or_timestamp`in t){let n=this.getSessionInfo()?.timestamp??0;t.or_timestamp-n<0&&console.error(`OpenReplay: event ${e} has or_timestamp (${t.or_timestamp}) before session start (${n}). It will be ignored.`)}t=JSON.stringify(t)}catch{}this.app.send(Se(e,t))}}issue(e,t=null){if(typeof e==`string`&&this.app!==null){try{t=JSON.stringify(t)}catch{return}this.app.send(Fe(e,t))}}},Ka=new class{constructor(){this.instance=null,this.isConfigured=!1,this.setUserID=e=>{!S||!this.ensureConfigured()||!this.instance||this.instance.setUserID(e)},this.identify=this.setUserID,this.track=(e,t,n)=>{!S||!this.ensureConfigured()||!this.instance||this.instance.analytics?.track(e,t,n)}}configure(e){if(S){if(this.isConfigured){console.warn(`OpenReplay: Tracker is already configured. You should only call configure once.`);return}if(!e.projectKey){console.error(`OpenReplay: Missing required projectKey option`);return}this.instance=new Ga(e),this.isConfigured=!0}}get options(){return this.instance?.options||null}start(e){return S?!this.ensureConfigured()||!this.instance?Promise.resolve({success:!1,reason:`Tracker not configured`}):this.instance.start(e).catch(e=>({success:!1,reason:typeof e==`string`?e:String(e)})):Promise.resolve({success:!1,reason:`Not in browser environment`})}stop(){if(!(!S||!this.ensureConfigured()||!this.instance))return this.instance.stop()}get analytics(){return this.instance?.analytics??null}setMetadata(e,t){!S||!this.ensureConfigured()||!this.instance||this.instance.setMetadata(e,t)}getSessionURL(e){if(!(!S||!this.ensureConfigured()||!this.instance))return this.instance.getSessionURL(e)}getSessionID(){return!S||!this.ensureConfigured()||!this.instance?null:this.instance.getSessionID()}getSessionToken(){return!S||!this.ensureConfigured()||!this.instance?null:this.instance.getSessionToken()}event(e,t=null,n=!1){!S||!this.ensureConfigured()||!this.instance||this.instance.event(e,t,n)}issue(e,t=null){!S||!this.ensureConfigured()||!this.instance||this.instance.issue(e,t)}handleError(e,t={}){!S||!this.ensureConfigured()||!this.instance||this.instance.handleError(e,t)}restartCanvasTracking(){!S||!this.ensureConfigured()||!this.instance||this.instance.restartCanvasTracking()}setUserAnonymousID(e){!S||!this.ensureConfigured()||!this.instance||this.instance.setUserAnonymousID(e)}isActive(){return!S||!this.ensureConfigured()||!this.instance?!1:this.instance.isActive()}getInstance(){return!this.ensureConfigured()||!S?null:this.instance}coldStart(e,t){if(!(!S||!this.ensureConfigured()||!this.instance))return this.instance.coldStart(e,t)}trackWs(e){return!S||!this.ensureConfigured()||!this.instance?()=>{}:this.instance.trackWs(e)}ensureConfigured(){return!this.isConfigured&&S?(console.warn(`OpenReplay: Tracker must be configured before use. Call tracker.configure({projectKey: "your-project-key"}) first.`),!1):!0}use(e){return!S||!this.ensureConfigured()||!this.instance?e(null):this.instance.use(e)}startOfflineRecording(...e){if(!(!S||!this.ensureConfigured()||!this.instance))return this.instance.startOfflineRecording(...e)}uploadOfflineRecording(){if(!(!S||!this.ensureConfigured()||!this.instance))return this.instance.uploadOfflineRecording()}forceFlushBatch(){if(!(!S||!this.ensureConfigured()||!this.instance))return this.instance.forceFlushBatch()}getSessionInfo(){return!S||!this.ensureConfigured()||!this.instance?null:this.instance.getSessionInfo()}getTabId(){return!S||!this.ensureConfigured()||!this.instance?null:this.instance.getTabId()}resanitize(e){if(!(!S||!this.ensureConfigured()||!this.instance))return this.instance.resanitize(e)}checkSanitization(e){if(!(!S||!this.ensureConfigured()||!this.instance))return this.instance.checkSanitization(e)}incident(e){!S||!this.ensureConfigured()||!this.instance||this.instance.incident(e)}setAnalyticsToken(e){!S||!this.ensureConfigured()||!this.instance||this.instance.setAnalyticsToken(e)}getAnalyticsToken(){if(!(!S||!this.ensureConfigured()||!this.instance))return this.instance.getAnalyticsToken()}},qa=!1,Ja=/card[\s_-]*(number|num|no)\b|creditcard|\bcvc\b|\bcvv\b|security[\s_-]*code|\bbsb\b|account[\s_-]*number/i;function Ya(e){if(e.tagName!==`INPUT`)return tn.Plain;try{if(/^cc-/i.test(e.getAttribute(`autocomplete`)||``))return tn.Hidden;let t=`${e.getAttribute(`name`)||``} ${e.id||``} ${e.getAttribute(`data-testid`)||``}`;if(Ja.test(t))return tn.Hidden}catch{}return tn.Plain}function Xa({userID:e}={}){if(typeof window>`u`)return null;if(qa)return Ka;try{Ka.configure({projectKey:`YjWZWXhevXcVQgMtp2E8`,ingestPoint:`https://session.servercompany.com.au/ingest`,defaultInputMode:0,obscureInputEmails:!1,obscureInputNumbers:!1,obscureInputDates:!1,obscureTextEmails:!1,obscureTextNumbers:!1,domSanitizer:Ya}),qa=!0,Promise.resolve(Ka.start(e?{userID:e}:void 0)).catch(e=>console.warn(`OpenReplay failed to start`,e))}catch(e){console.warn(`OpenReplay failed to start`,e)}return Ka}function Za(e,t={}){if(qa)try{let{impersonation:n=null,loginEmail:r=null}=t;if(n){Ka.setUserID(`Staff Impersonation`),n.staff&&Ka.setMetadata(`impersonatedBy`,String(n.staff)),e&&e.id!=null&&Ka.setMetadata(`clientId`,String(e.id));return}let i=r||e&&(e.email||e.id);i?(Ka.setUserID(String(i)),e&&e.id!=null&&Ka.setMetadata(`clientId`,String(e.id))):Ka.setUserID(``)}catch(e){console.warn(`OpenReplay identify failed`,e)}}function Qa(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function $a(e){if(Array.isArray(e))return e}function eo(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}
vendor: 4,303 bytes, lines 104-105
104finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function to(){throw TypeError(`Invalid attempt to destructure non-iterable instance. 105In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function no(e,t){return $a(e)||eo(e,t)||ro(e,t)||to()}function ro(e,t){if(e){if(typeof e==`string`)return Qa(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Qa(e,t):void 0}}var io=Object.entries,ao=Object.setPrototypeOf,oo=Object.isFrozen,so=Object.getPrototypeOf,co=Object.getOwnPropertyDescriptor,lo=Object.freeze,uo=Object.seal,fo=Object.create,po=typeof Reflect<`u`&&Reflect,mo=po.apply,ho=po.construct;lo||=function(e){return e},uo||=function(e){return e},mo||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},ho||=function(e){return new e(...[...arguments].slice(1))};var go=Io(Array.prototype.forEach),_o=Io(Array.prototype.lastIndexOf),vo=Io(Array.prototype.pop),yo=Io(Array.prototype.push),bo=Io(Array.prototype.splice),xo=Array.isArray,So=Io(String.prototype.toLowerCase),Co=Io(String.prototype.toString),wo=Io(String.prototype.match),To=Io(String.prototype.replace),Eo=Io(String.prototype.indexOf),Do=Io(String.prototype.trim),Oo=Io(Number.prototype.toString),ko=Io(Boolean.prototype.toString),Ao=typeof BigInt>`u`?null:Io(BigInt.prototype.toString),jo=typeof Symbol>`u`?null:Io(Symbol.prototype.toString),Mo=Io(Object.prototype.hasOwnProperty),No=Io(Object.prototype.toString),Po=Io(RegExp.prototype.test),Fo=Lo(TypeError);function Io(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return mo(e,t,n)}}function Lo(e){return function(){return ho(e,[...arguments])}}function Ro(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:So;if(ao&&ao(e,null),!xo(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(oo(t)||(t[r]=e),i=e)}e[i]=!0}return e}function zo(e){for(let t=0;t<e.length;t++)Mo(e,t)||(e[t]=null);return e}function Bo(e){let t=fo(null);for(let r of io(e)){var n=no(r,2);let i=n[0],a=n[1];Mo(e,i)&&(xo(a)?t[i]=zo(a):a&&typeof a==`object`&&a.constructor===Object?t[i]=Bo(a):t[i]=a)}return t}function Vo(e){switch(typeof e){case`string`:return e;case`number`:return Oo(e);case`boolean`:return ko(e);case`bigint`:return Ao?Ao(e):`0`;case`symbol`:return jo?jo(e):`Symbol()`;case`undefined`:return No(e);case`function`:case`object`:{if(e===null)return No(e);let t=e,n=Ho(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:No(e)}return No(e)}default:return No(e)}}function Ho(e,t){for(;e!==null;){let n=co(e,t);if(n){if(n.get)return Io(n.get);if(typeof n.value==`function`)return Io(n.value)}e=so(e)}function n(){return null}return n}function Uo(e){try{return Po(e,``),!0}catch{return!1}}var Wo=lo(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),Go=lo(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),Ko=lo([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOff
105set`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),qo=lo([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),Jo=lo(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),Yo=lo([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),Xo=lo([`#text`]),Zo=lo(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),Qo=lo(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dominant-baseline.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.pointer-events.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-orientation.text-rendering.textlength.type.u1.u2.unicode.values.vector-effect.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),$o=lo(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),es=lo([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),ts=uo(/{{[\w\W]*|^[\w\W]*}}/g),ns=uo(/<%[\w\W]*|^[\w\W]*%>/g),rs=uo(/\${[\w\W]*/g),is=uo(/^data-[\-\w.\u00B7-\uFFFF]+$/),as=uo(/^aria-[\-\w]+$/),os=uo(/^(?:(?:(?
vendor: 4,968 bytes, line 105
105:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ss=uo(/^(?:\w+script|data):/i),cs=uo(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ls=uo(/^html$/i),us=uo(/^[a-z][.\w]*(-[.\w]+)+$/i),ds=uo(/<[/\w!]/g),fs=uo(/<[/\w]/g),ps=uo(/<\/no(script|embed|frames)/i),ms=uo(/\/>/i),hs={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},gs=[`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`],_s=lo(Ro({},gs)),vs=function(){let e={};return go(gs,t=>{e[t]=uo(RegExp(`</`+t+`(?=[\\t\\n\\f\\r />])`,`i`))}),lo(e)}(),ys=function(){return typeof window>`u`?null:window},bs=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},xs=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Ss=function(e,t,n,r){return Mo(e,t)&&xo(e[t])?Ro(r.base?Bo(r.base):{},e[t],r.transform):n},Cs=function(e,t,n){let r=Mo(e,t)?e[t]:void 0;return r&&typeof r==`object`?Bo(r):n()};function ws(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ys(),t=e=>ws(e);if(t.version=`3.4.15`,t.removed=[],!e||!e.document||e.document.nodeType!==hs.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,f=Ho(d,`cloneNode`),p=Ho(d,`remove`),m=Ho(d,`removeAttributeNode`),h=Ho(d,`nextSibling`),g=Ho(d,`childNodes`),_=Ho(d,`parentNode`),v=Ho(d,`shadowRoot`),y=Ho(d,`attributes`),b=o&&o.prototype?Ho(o.prototype,`nodeType`):null,x=o&&o.prototype?Ho(o.prototype,`nodeName`):null,S=o&&o.prototype?Ho(o.prototype,`ownerDocument`):null,C=function(e){return b?b(e):e.nodeType},w=function(e){return x?x(e):e.nodeName};if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let T,E=``,D,O=!1,k=0,A=function(){if(k>0)throw Fo(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},j=function(e){A(),k++;try{return T.createHTML(e)}finally{k--}},M=function(e){A(),k++;try{return T.createScriptURL(e)}finally{k--}},N=function(){return O||=(D=bs(u,i),!0),D},P=n,F=P.implementation,I=P.createNodeIterator,L=P.createDocumentFragment,R=P.getElementsByTagName,z=r.importNode,B=xs();t.isSupported=typeof io==`function`&&typeof _==`function`&&F&&F.createHTMLDocument!==void 0;let V=ts,H=ns,U=rs,W=is,G=as,ee=ss,te=cs,ne=us,re=os,K=null,ie=Ro({},[...Wo,...Go,...Ko,...Jo,...Xo]),q=null,ae=Ro({},[...Zo,...Qo,...$o,...es]),oe=Object.seal(fo(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),se=null,ce=null,le=Object.seal(fo(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),ue=!0,de=!0,fe=!1,pe=!0,me=!1,he=!0,ge=!1,_e=!1,ve=null,ye=null,be=!1,xe=!1,Se=!1,Ce=!1,we=!0,Te=!1,Ee=`user-content-`,De=!0,Oe=!1,ke={},Ae=null,je=Ro({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),Me=null,Ne=Ro({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Pe=null,Fe=Ro({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Ie=`http://www.w3.org/1998/Math/MathML`,Le=`http://www.w3.org/2000/svg`,Re=`http://www.w3.org/1999/xhtml`,ze=Re,Be=!1,Ve=null,He=Ro({},[Ie,Le,Re],Co),Ue=lo([`mi`,`mo`,`mn`,`ms`,`mtext`]),We=Ro({},Ue),Ge=lo([`annotation-xml`]),Ke=Ro({},Ge),qe=Ro({},[`title`,`style`,`font`,`a`,`script`]),Je=null,Ye=[`application/xhtml+xml`,`text/html`],Xe=null,Ze=null,Qe=n.createElement(`form`),$e=function(e){return e instanceof RegExp||e instanceof Function},et=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Ze&&Ze===e)return;(!e||typeof e!=`object`)&&(e={}
vendor: 5,021 bytes, line 105
105),e=Bo(e),Je=Ye.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,Xe=Je===`application/xhtml+xml`?Co:So,K=Ss(e,`ALLOWED_TAGS`,ie,{transform:Xe}),q=Ss(e,`ALLOWED_ATTR`,ae,{transform:Xe}),Ve=Ss(e,`ALLOWED_NAMESPACES`,He,{transform:Co}),Pe=Ss(e,`ADD_URI_SAFE_ATTR`,Fe,{transform:Xe,base:Fe}),Me=Ss(e,`ADD_DATA_URI_TAGS`,Ne,{transform:Xe,base:Ne}),Ae=Ss(e,`FORBID_CONTENTS`,je,{transform:Xe}),se=Ss(e,`FORBID_TAGS`,Bo({}),{transform:Xe}),ce=Ss(e,`FORBID_ATTR`,Bo({}),{transform:Xe}),ke=Mo(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?Bo(e.USE_PROFILES):e.USE_PROFILES:!1,ue=e.ALLOW_ARIA_ATTR!==!1,de=e.ALLOW_DATA_ATTR!==!1,fe=e.ALLOW_UNKNOWN_PROTOCOLS||!1,pe=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,me=e.SAFE_FOR_TEMPLATES||!1,he=e.SAFE_FOR_XML!==!1,ge=e.WHOLE_DOCUMENT||!1,xe=e.RETURN_DOM||!1,Se=e.RETURN_DOM_FRAGMENT||!1,Ce=e.RETURN_TRUSTED_TYPE||!1,be=e.FORCE_BODY||!1,we=e.SANITIZE_DOM!==!1,Te=e.SANITIZE_NAMED_PROPS||!1,De=e.KEEP_CONTENT!==!1,Oe=e.IN_PLACE||!1,re=Uo(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:os,ze=typeof e.NAMESPACE==`string`?e.NAMESPACE:Re,We=Cs(e,`MATHML_TEXT_INTEGRATION_POINTS`,()=>Ro({},Ue)),Ke=Cs(e,`HTML_INTEGRATION_POINTS`,()=>Ro({},Ge));let t=Cs(e,`CUSTOM_ELEMENT_HANDLING`,()=>fo(null));if(oe=fo(null),Mo(t,`tagNameCheck`)&&$e(t.tagNameCheck)&&(oe.tagNameCheck=t.tagNameCheck),Mo(t,`attributeNameCheck`)&&$e(t.attributeNameCheck)&&(oe.attributeNameCheck=t.attributeNameCheck),Mo(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(oe.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),uo(oe),me&&(de=!1),Se&&(xe=!0),ke&&(K=Ro({},Xo),q=fo(null),ke.html===!0&&(Ro(K,Wo),Ro(q,Zo)),ke.svg===!0&&(Ro(K,Go),Ro(q,Qo),Ro(q,es)),ke.svgFilters===!0&&(Ro(K,Ko),Ro(q,Qo),Ro(q,es)),ke.mathMl===!0&&(Ro(K,Jo),Ro(q,$o),Ro(q,es))),le.tagCheck=null,le.attributeCheck=null,Mo(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?le.tagCheck=e.ADD_TAGS:xo(e.ADD_TAGS)&&(K===ie&&(K=Bo(K)),Ro(K,e.ADD_TAGS,Xe))),Mo(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?le.attributeCheck=e.ADD_ATTR:xo(e.ADD_ATTR)&&(q===ae&&(q=Bo(q)),Ro(q,e.ADD_ATTR,Xe))),Mo(e,`ADD_FORBID_CONTENTS`)&&xo(e.ADD_FORBID_CONTENTS)&&(Ae===je&&(Ae=Bo(Ae)),Ro(Ae,e.ADD_FORBID_CONTENTS,Xe)),De&&(K[`#text`]=!0),ge&&Ro(K,[`html`,`head`,`body`]),K.table&&(Ro(K,[`tbody`]),delete se.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw Fo(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw Fo(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=T;T=e.TRUSTED_TYPES_POLICY;try{E=j(``)}catch(e){throw T=t,e}}else e.TRUSTED_TYPES_POLICY===null?(T=void 0,E=``):(T===void 0&&(T=N()),T&&typeof E==`string`&&(E=j(``)));lo&&lo(e),Ze=e},tt=Ro({},[...Go,...Ko,...qo]),nt=Ro({},[...Jo,...Yo]),rt=function(e,t,n){return t.namespaceURI===Re?e===`svg`:t.namespaceURI===Ie?e===`svg`&&(n===`annotation-xml`||We[n]):!!tt[e]},it=function(e,t,n){return t.namespaceURI===Re?e===`math`:t.namespaceURI===Le?e===`math`&&Ke[n]:!!nt[e]},at=function(e,t,n){return t.namespaceURI===Le&&!Ke[n]||t.namespaceURI===Ie&&!We[n]?!1:!nt[e]&&(qe[e]||!tt[e])},ot=function(e){let t=_(e);(!t||!t.tagName)&&(t={namespaceURI:ze,tagName:`template`});let n=So(e.tagName),r=So(t.tagName);return Ve[e.namespaceURI]?e.namespaceURI===Le?rt(n,t,r):e.namespaceURI===Ie?it(n,t,r):e.namespaceURI===Re?at(n,t,r):!!(Je===`application/xhtml+xml`&&Ve[e.namespaceURI]):!1},st=function(e){yo(t.removed,{element:e});try{_(e).removeChild(e)}catch{if(p(e),!_(e))throw Fo(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},ct=function(e,t,n){try{m(e,t)}catch{try{e.removeAttribute(n)}catch{}}},lt=function(e){ft(e);let t=g(e);if(t){let e=[];go(t,t=>{yo(e,t)}),go(e,e=>{try{p(e)}catch{}})}let n=y(e);if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;typeof i==`string`&&ct(e,r,i)}},ut=function(e,n,r){if(!r)try{r=n.getAttributeNode(e)}catch{r=null}yo(t.removed,{attribute:r||null,from:n});try{r?m(n,r):n.removeAttribute(e)}catch{try{n.removeAttribute(e)}catch{}}if(e===`is`)if(xe||Se)try{st(n)}catch{}else try{n.setAttribute(e,``)}catch{}},dt=function(e){let t=y(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;typeof i!=`string`||q[Xe(i)]||ct(e,r,i)}},ft=function(e){let t=[e];for(;t.length>0;){let e=t.pop();C(e)===hs.element&&dt(e);let n=g(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},pt=function(e,t){return he?e===`patchsrc`?!0:e===`for`&&t!==`label`&&t!==`output`:!1},mt=function(e){if(!he)return;let t=[e];for(;t.length>0;){let e=t.pop(),n=C(e);if(n===hs.processingInstruction||n===hs.comment&&Po(fs,e.data)){try{p(e)}catch{}continue}if(n===hs.element){let t=e,n=Xe(w(e));try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&pt(`for`,n)&&t.removeAttribute(`for`)}catch{}}let r=g(e);
vendor: 4,359 bytes, line 105
105if(r)for(let e=r.length-1;e>=0;--e)t.push(r[e])}},ht=function(e){let t=null,r=null;if(be)e=`<remove></remove>`+e;else{let t=wo(e,/^[\r\n\t ]+/);r=t&&t[0]}Je===`application/xhtml+xml`&&ze===Re&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=T?j(e):e;if(ze===Re)try{t=new l().parseFromString(i,Je)}catch{}if(!t||!t.documentElement){t=F.createDocument(ze,`template`,null);try{t.documentElement.innerHTML=Be?E:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),ze===Re?R.call(t,ge?`html`:`body`)[0]:ge?t.documentElement:a},gt=function(e){let t=S?S(e):e.ownerDocument;return I.call(t||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},_t=function(e){return e=To(e,V,` `),e=To(e,H,` `),e=To(e,U,` `),e},vt=function(e){e.normalize();let t=S?S(e):e.ownerDocument,n=I.call(t||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),r=n.nextNode();for(;r;)r.data=_t(r.data),r=n.nextNode();let i=e.querySelectorAll?.call(e,`template`);i&&go(i,e=>{bt(e.content)&&vt(e.content)})},yt=function(e){let t=x?x(e):null;return typeof t!=`string`||Xe(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==y(e)||typeof e.removeAttribute!=`function`||typeof e.removeAttributeNode!=`function`||typeof e.getAttributeNode!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==b(e)||e.childNodes!==g(e)},bt=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return b(e)===hs.documentFragment}catch{return!1}},xt=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return typeof b(e)==`number`}catch{return!1}};function St(e,n,r){e.length!==0&&go(e,e=>{e.call(t,n,r,Ze)})}let Ct=function(e,t){return!!(he&&e.hasChildNodes()&&!xt(e.firstElementChild)&&Po(ds,e.textContent)&&Po(ds,e.innerHTML)||he&&e.namespaceURI===Re&&_s[t]&&(xt(e.firstElementChild)||typeof e.textContent==`string`&&Po(vs[t],e.textContent))||e.nodeType===hs.processingInstruction||he&&e.nodeType===hs.comment&&Po(fs,e.data))},wt=function(e,t){return e instanceof RegExp?Po(e,t):e instanceof Function?!!e(t,...[...arguments].slice(2)):!1},Tt=function(e,t,n){if(!se[t]&&jt(t)&&wt(oe.tagNameCheck,t))return!1;if(De&&!Ae[t]){let t=_(e),r=g(e);if(r&&t){let i=r.length;for(let a=i-1;a>=0;--a){let i=e===n?f(r[a],!0):r[a];t.insertBefore(i,h(e))}}}return st(e),!0},Et=function(e,t,n,r){return e.length===0?t:t===n||t===r?Bo(t):t},Dt=function(e,t){return e===t||_(e)!==null?!1:(Oe&&ft(e),!0)},Ot=function(e,n){if(St(B.beforeSanitizeElements,e,null),Dt(e,n))return!0;if(yt(e))return st(e),!0;let r=Xe(w(e));if(K=Et(B.uponSanitizeElement,K,ie,ve),St(B.uponSanitizeElement,e,{tagName:r,allowedTags:K}),Dt(e,n))return!0;if(Ct(e,r))return st(e),!0;if(se[r]||!(le.tagCheck instanceof Function&&le.tagCheck(r))&&!K[r]){let t=Tt(e,r,n);return t===!1&&St(B.afterSanitizeElements,e,null),t}if(C(e)===hs.element&&!ot(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&Po(ps,e.innerHTML))return st(e),!0;if(me&&e.nodeType===hs.text){let n=_t(e.textContent);e.textContent!==n&&(yo(t.removed,{element:e.cloneNode()}),e.textContent=n)}return St(B.afterSanitizeElements,e,null),!1},kt=function(e,t,r){if(ce[t]||pt(t,e)||we&&(t===`id`||t===`name`)&&(r in n||r in Qe))return!1;let i=q[t]||le.attributeCheck instanceof Function&&le.attributeCheck(t,e);return de&&Po(W,t)||ue&&Po(G,t)?!0:i?Pe[t]||Po(re,To(r,te,``))||(t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&Eo(r,`data:`)===0&&Me[e]||fe&&!Po(ee,To(r,te,``))?!0:!r:jt(e)&&wt(oe.tagNameCheck,e)&&wt(oe.attributeNameCheck,t,e)||t===`is`&&oe.allowCustomizedBuiltInElements&&wt(oe.tagNameCheck,r)},At=Ro({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),jt=function(e){return!At[So(e)]&&Po(ne,e)},Mt=function(e,t,n,r){if(T&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return j(r);case`TrustedScriptURL`:return M(r)}return r},Nt=function(e,t,n,r){try{return n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),yt(e)?(st(e),!1):!0}catch{return ut(t,e),!1}}
vendor: 4,079 bytes, lines 105-106
105,Pt=function(e){St(B.beforeSanitizeAttributes,e,null);let n=e.attributes;if(!n||yt(e))return;q=Et(B.uponSanitizeAttribute,q,ae,ye);let r={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:q,forceKeepAttr:void 0},i=n.length,a=Xe(e.nodeName);for(;i--;){let o=n[i],s=o.name,c=o.namespaceURI,l=o.value,u=Xe(s),d=l,f=s===`value`?d:Do(d),p=!1;if(r.attrName=u,r.attrValue=f,r.keepAttr=!0,r.forceKeepAttr=void 0,St(B.uponSanitizeAttribute,e,r),f=r.attrValue,Te&&(u===`id`||u===`name`)&&Eo(f,Ee)!==0&&(ut(s,e,o),f=Ee+f,p=!0),he&&Po(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,f)){ut(s,e,o);continue}if(u===`attributename`&&wo(f,`href`)){ut(s,e,o);continue}if(!r.forceKeepAttr){if(!r.keepAttr){ut(s,e,o);continue}if(!pe&&Po(ms,f)){ut(s,e,o);continue}if(me&&(f=_t(f)),!kt(a,u,f)){ut(s,e,o);continue}f=Mt(a,u,c,f),f!==d&&Nt(e,s,c,f)&&p&&vo(t.removed)}}St(B.afterSanitizeAttributes,e,null)},Ft=function(e){let t=null,n=gt(e);for(St(B.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(St(B.uponSanitizeShadowNode,t,null),Ot(t,e),Pt(t),bt(t.content)&&Ft(t.content),C(t)===hs.element){let e=v(t);bt(e)&&(It(e),Ft(e))}St(B.afterSanitizeShadowDOM,e,null)},It=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){Ft(e.shadow);continue}let n=e.node,r=C(n)===hs.element,i=g(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=x?x(n):null;if(typeof e==`string`&&Xe(e)===`template`){let e=n.content;bt(e)&&t.push({node:e,shadow:null})}}if(r){let e=v(n);bt(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(Be=!e,Be&&(e=`<!-->`),typeof e!=`string`&&!xt(e)&&(e=Vo(e),typeof e!=`string`))throw Fo(`dirty is not a string, aborting`);if(!t.isSupported)return e;_e?(K=ve,q=ye):et(n),(B.uponSanitizeElement.length>0||B.uponSanitizeAttribute.length>0)&&(K=Bo(K)),B.uponSanitizeAttribute.length>0&&(q=Bo(q)),t.removed=[];let c=Oe&&typeof e!=`string`&&xt(e);if(c){mt(e);let t=w(e);if(typeof t==`string`){let n=Xe(t);if(!K[n]||se[n])throw lt(e),Fo(`root node is forbidden and cannot be sanitized in-place`)}if(yt(e))throw lt(e),Fo(`root node is clobbered and cannot be sanitized in-place`);try{It(e)}catch(t){throw lt(e),t}}else if(xt(e))i=ht(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===hs.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),It(i);else{if(!xe&&!me&&!ge&&e.indexOf(`<`)===-1)return T&&Ce?j(e):e;if(i=ht(e),!i)return xe?null:Ce?E:``}i&&be&&st(i.firstChild);let l=c?e:i;try{let e=gt(l);for(;o=e.nextNode();)Ot(o,l),Pt(o),bt(o.content)&&Ft(o.content)}catch(n){throw c&&(lt(e),go(t.removed,e=>{e.element&&ft(e.element)})),n}if(c)return go(t.removed,e=>{e.element&&ft(e.element)}),me&&vt(e),e;if(xe){if(me&&vt(i),Se)for(s=L.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(q.shadowroot||q.shadowrootmode)&&(s=z.call(r,s,!0)),s}let u=ge?i.outerHTML:i.innerHTML;return ge&&K[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&Po(ls,i.ownerDocument.doctype.name)&&(u=`<!DOCTYPE `+i.ownerDocument.doctype.name+`> 106`+u),me&&(u=_t(u)),T&&Ce?j(u):u},t.setConfig=function(){et(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}),_e=!0,ve=K,ye=q},t.clearConfig=function(){Ze=null,_e=!1,ve=null,ye=null,T=D,E=``},t.isValidAttribute=function(e,t,n){return Ze||et({}),kt(Xe(e),Xe(t),n)},t.addHook=function(e,t){typeof t==`function`&&Mo(B,e)&&yo(B[e],t)},t.removeHook=function(e,t){if(Mo(B,e)){if(t!==void 0){let n=_o(B[e],t);return n===-1?void 0:bo(B[e],n,1)[0]}return vo(B[e])}},t.removeHooks=function(e){Mo(B,e)&&(B[e]=[])},t.removeAllHooks=function(){B=xs()},t}var Ts=ws(),Es=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Ds=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),Os=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),ks=e=>{let t=Os(e);return t.charAt(0).toUpperCase()+t.slice(1)}
106,As={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},js=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},Ms=(0,l.createContext)({}),Ns=()=>(0,l.useContext)(Ms),Ps=(0,l.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:u=24,strokeWidth:d=2,absoluteStrokeWidth:f=!1,color:p=`currentColor`,className:m=``}=Ns()??{},h=r??f?Number(n??d)*24/Number(t??u):n??d;return(0,l.createElement)(`svg`,{ref:c,...As,width:t??u??As.width,height:t??u??As.height,stroke:e??p,strokeWidth:h,className:Es(`lucide`,m,i),...!a&&!js(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,l.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),J=(e,t)=>{let n=(0,l.forwardRef)(({className:n,...r},i)=>(0,l.createElement)(Ps,{ref:i,iconNode:t,className:Es(`lucide-${Ds(ks(e))}`,`lucide-${e}`,n),...r}));return n.displayName=ks(e),n},Fs=J(`fingerprint-pattern`,[[`path`,{d:`M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4`,key:`1nerag`}],[`path`,{d:`M14 13.12c0 2.38 0 6.38-1 8.88`,key:`o46ks0`}],[`path`,{d:`M17.29 21.02c.12-.6.43-2.3.5-3.02`,key:`ptglia`}],[`path`,{d:`M2 12a10 10 0 0 1 18-6`,key:`ydlgp0`}],[`path`,{d:`M2 16h.01`,key:`1gqxmh`}],[`path`,{d:`M21.8 16c.2-2 .131-5.354 0-6`,key:`drycrb`}],[`path`,{d:`M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2`,key:`1tidbn`}],[`path`,{d:`M8.65 22c.21-.66.45-1.32.57-2`,key:`13wd9y`}],[`path`,{d:`M9 6.8a6 6 0 0 1 9 5.2v2`,key:`1fr1j5`}]]),Y=J(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),Is=J(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Ls=J(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Rs=J(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),zs=J(`code-xml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]),Bs=J(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),Vs=J(`file-pen-line`,[[`path`,{d:`M14.364 13.634a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506l4.013-4.009a1 1 0 0 0-3.004-3.004z`,key:`ukzhwg`}],[`path`,{d:`M14.487 7.858A1 1 0 0 1 14 7V2`,key:`1klhew`}],[`path`,{d:`M20 19.645V20a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l2.516 2.516`,key:`rxaxab`}],[`path`,{d:`M8 18h1`,key:`13wk12`}]]),Hs=J(`funnel`,[[`path`,{d:`M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z`,key:`sc7q7i`}]]),X=J(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),Us=J(`lock-open`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 9.9-1`,key:`1mm8w8`}]]),Ws=J(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Gs=J(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),Ks=J(`archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),qs=J(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),Js=J(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),Ys=J(`badge-percent`,[[`path`,{d:`M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z`,key:`3c2336`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`M9 9h.01`,key:`1q5me6`}],[`path`,{d:`M15 15h.01`,key:`lqbp3k`}]]),Xs=J(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),Zs=J(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),Qs=J(`building-2`,[[`path`,{d:`M10 12h4`,key:`a56b0p`}],[`path`,{d:`M10 8h4`,key:`1sr2af`}],[`path`,{d:`M14 21v-3a2 2 0 0 0-4 0v3`,key:`1rgiei`}],[`path`,{d:`M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2`,key:`secmi2`}],[`path`,{d:`M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16`,key:`16ra0t`}
106]]),$s=J(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),ec=J(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),tc=J(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),nc=J(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),rc=J(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),ic=J(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),ac=J(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),oc=J(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),sc=J(`credit-card`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`5`,rx:`2`,key:`ynyp8z`}],[`line`,{x1:`2`,x2:`22`,y1:`10`,y2:`10`,key:`1b3vmo`}]]),cc=J(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),lc=J(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),uc=J(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),dc=J(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),fc=J(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),pc=J(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),mc=J(`gift`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M20 11v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-8`,key:`1sqzm4`}],[`path`,{d:`M7.5 7a1 1 0 0 1 0-5A4.8 8 0 0 1 12 7a4.8 8 0 0 1 4.5-5 1 1 0 0 1 0 5`,key:`kc0143`}],[`rect`,{x:`3`,y:`7`,width:`18`,height:`4`,rx:`1`,key:`1hberx`}]]),hc=J(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),gc=J(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),_c=J(`image-off`,[[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}],[`path`,{d:`M10.41 10.41a2 2 0 1 1-2.83-2.83`,key:`1bzlo9`}],[`line`,{x1:`13.5`,x2:`6`,y1:`13.5`,y2:`21`,key:`1q0aeu`}],[`line`,{x1:`18`,x2:`21`,y1:`12`,y2:`15`,key:`5mozeu`}],[`path`,{d:`M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59`,key:`mmje98`}],[`path`,{d:`M21 15V5a2 2 0 0 0-2-2H9`,key:`43el77`}]]),vc=J(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),yc=J(`key`,[[`path`,{d:`m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4`,key:`g0fldk`}],[`path`,{d:`m21 2-9.6 9.6`,key:`1j0ho8`}],[`circle`,{cx:`7.5`,cy:`15.5`,r:`5.5`,key:`yqb3hr`}]]),bc=J(`keyboard`,[[`path`,{d:`M10 8h.01`,key:`1r9ogq`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M14 8h.01`,key:`1primd`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}],[`path`,{d:`M18 8h.01`,key:`emo2bl`}],[`path`,{d:`M6 8h.01`,key:`x9i8wu`}],[`path`,{d:`M7 16h10`,key:`wp8him`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}
106]]),xc=J(`landmark`,[[`path`,{d:`M10 18v-7`,key:`wt116b`}],[`path`,{d:`M11.12 2.198a2 2 0 0 1 1.76.006l7.866 3.847c.476.233.31.949-.22.949H3.474c-.53 0-.695-.716-.22-.949z`,key:`1m329m`}],[`path`,{d:`M14 18v-7`,key:`vav6t3`}],[`path`,{d:`M18 18v-7`,key:`aexdmj`}],[`path`,{d:`M3 22h18`,key:`8prr45`}],[`path`,{d:`M6 18v-7`,key:`1ivflk`}]]),Sc=J(`layout-dashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]),Cc=J(`link`,[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]),wc=J(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),Tc=J(`log-in`,[[`path`,{d:`m10 17 5-5-5-5`,key:`1bsop3`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`,key:`u53s6r`}]]),Ec=J(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),Dc=J(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]),Oc=J(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),kc=J(`megaphone`,[[`path`,{d:`M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z`,key:`q8bfy3`}],[`path`,{d:`M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14`,key:`1853fq`}],[`path`,{d:`M8 6v8`,key:`15ugcq`}]]),Ac=J(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),jc=J(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),Mc=J(`minimize-2`,[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]),Nc=J(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),Pc=J(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),Fc=J(`network`,[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]),Ic=J(`package`,[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]),Lc=J(`paperclip`,[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]),Rc=J(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),zc=J(`phone`,[[`path`,{d:`M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384`,key:`9njp5v`}]]),Bc=J(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),Vc=J(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Hc=J(`power-off`,[[`path`,{d:`M18.36 6.64A9 9 0 0 1 20.77 15`,key:`dxknvb`}],[`path`,{d:`M6.16 6.16a9 9 0 1 0 12.68 12.68`,key:`1x7qb5`}],[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Uc=J(`radio-off`,[[`path`,{d:`M10.4103 10.7852C10.1529 11.1218 10 11.5425 10 11.999C10 13.1036 10.8954 13.999 12 13.999C12.5077 13.999 12.9713 13.8098 13.324 13.498`,key:`a36qgt`}],[`path`,{d:`M16.1992 7.80078C17.4739 9.07549 18.0422 10.8109 17.9039 12.5134`,key:`1dac3h`}],[`path`,{d:`M19.0996 4.89844C22.0892 7.88804 22.7871 12.2879 21.1932 15.936`,key:`uqg46b`}],[`path`,{d:`M2 2L22 22`,key:`1tltpl`}],[`path`,{d:`M4.89961 19.0984C0.999609 15.1984 0.999609 8.79844 4.89961 4.89844`,key:`1aden0`}],[`path`,{d:`M7.79922 16.1992C5.66828 14.0683 5.51165 10.6498 7.32931 8.25`,key:`18j9a2`}]]),Wc=J(`radio`,[[`path`,{d:`M16.247 7.761a6 6 0 0 1 0 8.478`,key:`1fwjs5`}],[`path`,{d:`M19.075 4.933a10 10 0 0 1 0 14.134`,key:`ehdyv1`}],[`path`,{d:`M4.925 19.067a10 10 0 0 1 0-14.134`,key:`1q22gi`}],[`path`,{d:`M7.753 16.239a6 6 0 0 1 0-8.478`,key:`r2q7qm`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}]]),Gc=J(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),Kc=J(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),qc=J(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),Jc=J(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}
106]]),Yc=J(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),Xc=J(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Zc=J(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),Qc=J(`shopping-cart`,[[`circle`,{cx:`8`,cy:`21`,r:`1`,key:`jimo8o`}],[`circle`,{cx:`19`,cy:`21`,r:`1`,key:`13723u`}],[`path`,{d:`M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12`,key:`9zh506`}]]),$c=J(`smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),el=J(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),tl=J(`store`,[[`path`,{d:`M15 21v-5a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v5`,key:`slp6dd`}],[`path`,{d:`M17.774 10.31a1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.451 0 1.12 1.12 0 0 0-1.548 0 2.5 2.5 0 0 1-3.452 0 1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.77-3.248l2.889-4.184A2 2 0 0 1 7 2h10a2 2 0 0 1 1.653.873l2.895 4.192a2.5 2.5 0 0 1-3.774 3.244`,key:`o0xfot`}],[`path`,{d:`M4 10.95V19a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8.05`,key:`wn3emo`}]]),nl=J(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),rl=J(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),il=J(`trending-up`,[[`path`,{d:`M16 7h6v6`,key:`box55l`}],[`path`,{d:`m22 7-8.5 8.5-5-5L2 17`,key:`1t1m79`}]]),al=J(`type`,[[`path`,{d:`M12 4v16`,key:`1654pz`}],[`path`,{d:`M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2`,key:`e0r10z`}],[`path`,{d:`M9 20h6`,key:`s66wpe`}]]),ol=J(`unlink`,[[`path`,{d:`m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71`,key:`yqzxt4`}],[`path`,{d:`m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71`,key:`4qinb0`}],[`line`,{x1:`8`,x2:`8`,y1:`2`,y2:`5`,key:`1041cp`}],[`line`,{x1:`2`,x2:`5`,y1:`8`,y2:`8`,key:`14m1p5`}],[`line`,{x1:`16`,x2:`16`,y1:`19`,y2:`22`,key:`rzdirn`}],[`line`,{x1:`19`,x2:`22`,y1:`16`,y2:`16`,key:`ox905f`}]]),sl=J(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),cl=J(`user-check`,[[`path`,{d:`m16 11 2 2 4-4`,key:`9rsbq5`}],[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),ll=J(`user-plus`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}],[`line`,{x1:`19`,x2:`19`,y1:`8`,y2:`14`,key:`1bvyxn`}],[`line`,{x1:`22`,x2:`16`,y1:`11`,y2:`11`,key:`1shjgl`}]]),ul=J(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),dl=J(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),fl=J(`wallet`,[[`path`,{d:`M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1`,key:`18etb6`}],[`path`,{d:`M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4`,key:`xoc0q4`}]]),pl=J(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),ml=o(),hl=`crm:portal:token`;function Z(e,t={}){let n=localStorage.getItem(hl),r={"Content-Type":`application/json`,...t.headers||{}};return n&&(r.Authorization=`Bearer ${n}`),fetch(e,{...t,headers:r}).then(e=>e.json())}function gl(e,t){let n=localStorage.getItem(hl),r=n?{Authorization:`Bearer ${n}`}:{};return fetch(e,{method:`POST`,headers:r,body:t}).then(e=>e.json())}function _l(e){let t=localStorage.getItem(hl);return`/api/portal/uploads/${e}${t?`?token=${t}`:``}`}function vl(e){let t=localStorage.getItem(hl);return`/api/portal/invoices/${e}/pdf${t?`?token=${t}`:``}`}function yl(e){let t=localStorage.getItem(hl);return`/api/portal/quotes/${e}/pdf${t?`?token=${t}`:``}`}function bl(e={}){let t=localStorage.getItem(hl),n=new URLSearchParams(e);return t&&n.set(`token`,t),`/api/portal/statements/export?${n.toString()}`}var xl={operational:{label:`Operational`,color:`#34d399`,bg:`rgba(52,211,153,0.12)`},watch:{label:`Watch`,color:`#fbbf24`,bg:`rgba(251,191,36,0.12)`},"at-capacity":{label:`At capacity`,color:`#fb923c`,bg:`rgba(251,146,60,0.14)`},degraded:{label:`Degraded`,color:`#fb923c`,bg:`rgba(251,146,60,0.14)`},down:{label:`Down`,color:`#f87171`,bg:`rgba(248,113,113,0.14)`},suspended:{label:`Suspended`,color:`#f87171`,bg:`rgba(248,113,113,0.14)`},provisioning:{label:`Setting up`,color:`#60a5fa`,bg:`rgba(96,165,250,0.14)`}},Sl={critical:{label:`Critical`,color:`#f87171`,bg:`rgba(248,113,113,0.10)`,border:`rgba(248,113,113,0.28)`,Icon:Y},attention:{label:`Action needed`,color:`#fbbf24`,bg:`rgba(251,191,36,0.09)`,border:`rgba(251,191,36,0.26)`,Icon:Ws},info:{label:`For information`,color:`var(--text-muted)`,bg:`var(--bg-elevated)`,border:`var(--border)`,Icon:vc}},Cl={availability:`Availability`,capacity:`Capacity`,security:`Certificates`,billing:`Billing`,lifecycle:`Renewals`,coverage:`Coverage`,maintenance:`Notices`};function wl(e){if(!e)return null;let t=Date.parse(e);if(Number.isNaN(t))return null;let n=Math.floor((Date.now()-t)/6e4);if(n<1)return`just now`;if(n<60)return`${n} min ago`;let r=Math.floor(n/60);if(r<24)return`${r} hour${r===1?``:`s`} ago`;let i=Math.floor(r/24);return i<31?`${i} day${i===1?``:`s`} ago`:new Date(t).toLocaleDateString(`en-AU`,{day:`numeric`,month:`short`,year:`numeric`})}function Tl({label:e,pct:t}){if(t==null)return null;
106let n=Math.max(0,Math.min(100,Number(t))),r=n>=90?`#f87171`:n>=80?`#fbbf24`:`var(--accent)`;return(0,f.jsxs)(`div`,{style:{minWidth:96},children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between gap-2 mb-1`,children:[(0,f.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide text-faint`,children:e}),(0,f.jsxs)(`span`,{className:`text-[10px] font-semibold`,style:{color:r},children:[n.toFixed(0),`%`]})]}),(0,f.jsx)(`div`,{className:`rounded-full overflow-hidden`,style:{height:4,background:`var(--bg-elevated)`},children:(0,f.jsx)(`div`,{style:{width:`${n}%`,height:`100%`,background:r,borderRadius:999}})})]})}function El({inc:e,onAct:t,onDismiss:n,dismissing:r}){let i=Sl[e.severity]||Sl.info,{Icon:a}=i,o=wl(e.resolved_at||e.started_at);return(0,f.jsx)(`div`,{className:`rounded-xl border p-4`,style:{background:i.bg,borderColor:i.border},children:(0,f.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,f.jsx)(a,{size:16,style:{color:i.color,flexShrink:0,marginTop:2}}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,f.jsx)(`p`,{className:`text-sm font-semibold text-primary`,style:{margin:0},children:e.title}),(0,f.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-wide px-1.5 py-0.5 rounded`,style:{background:`var(--bg-elevated)`,color:`var(--text-muted)`},children:Cl[e.category]||e.category})]}),e.detail&&(0,f.jsx)(`p`,{className:`text-xs text-muted mt-1.5 leading-relaxed`,style:{margin:`0.35rem 0 0`},children:e.detail}),o&&(0,f.jsxs)(`p`,{className:`text-[11px] text-faint mt-1.5`,style:{margin:`0.35rem 0 0`},children:[e.resolved_at?`Resolved`:`Started`,` `,o]}),(0,f.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[e.action&&(0,f.jsx)(`button`,{className:`btn-primary text-xs`,onClick:()=>t(e.action),children:e.action.label}),e.dismissible&&(0,f.jsx)(`button`,{className:`text-xs text-faint hover:text-muted transition-colors disabled:opacity-40`,disabled:r,onClick:()=>n(e.key),children:r?`Dismissingâ¦`:`Dismiss`})]}),e.opportunity&&(0,f.jsxs)(`div`,{className:`mt-3 pt-3 flex flex-wrap items-center gap-2`,style:{borderTop:`1px solid var(--border)`},children:[(0,f.jsx)(il,{size:13,className:`text-accent shrink-0`}),(0,f.jsx)(`span`,{className:`text-xs text-muted flex-1 min-w-[180px]`,children:e.opportunity.blurb}),(0,f.jsx)(`button`,{className:`btn-secondary text-xs`,onClick:()=>t({tab:e.opportunity.tab}),children:e.opportunity.label})]})]})]})})}function Dl({setTab:e,onOpenService:t,onOpenDomain:n,onOpenInvoice:r}){let[i,a]=(0,l.useState)(null),[o,s]=(0,l.useState)(!0),[c,u]=(0,l.useState)(null),[d,p]=(0,l.useState)(``),[m,h]=(0,l.useState)(`all`),[g,_]=(0,l.useState)(!1),[v,y]=(0,l.useState)(null),[b,x]=(0,l.useState)(1),[S,C]=(0,l.useState)(null),w=(0,l.useCallback)(async(e=!1)=>{e||s(!0),u(null);try{let e=await Z(`/api/portal/monitoring`);e.ok?(a(e),C(Date.now())):u(e.error||`Could not load monitoring`)}catch(e){u(e.message||`Could not load monitoring`)}finally{s(!1)}},[]);(0,l.useEffect)(()=>{w()},[w]),(0,l.useEffect)(()=>{x(1)},[d,m]);function T(i){if(i){if(i.serviceId&&t)return t(i.serviceId);if(i.domainId&&n)return n(i.domainId);if(i.invoiceId&&r)return r(i.invoiceId);i.tab&&e?.(i.tab,i.subTab)}}async function E(e){y(e);try{(await Z(`/api/portal/monitoring/ack`,{method:`POST`,body:JSON.stringify({key:e})})).ok&&await w(!0)}catch{}finally{y(null)}}let D=i?.summary||{},O=i?.incidents||[],k=O.filter(e=>e.severity!==`info`),A=O.filter(e=>e.severity===`info`),j=i?.services||[],M=j.some(e=>e.coverage!==`none`),N=d.trim().toLowerCase(),P=j.filter(e=>m===`attention`&&e.state===`operational`||m===`uncovered`&&e.coverage!==`none`?!1:N?`${e.name} ${e.domain||``} ${e.product_name||``}`.toLowerCase().includes(N):!0),F=Math.max(1,Math.ceil(P.length/25)),I=P.slice((b-1)*25,b*25),L=[{key:`all`,label:`Services`,value:D.services??0,color:`var(--text-primary)`},{key:`attention`,label:`Services to watch`,value:(D.impaired??0)+(D.watch??0),color:`#fbbf24`},...M?[{key:`uncovered`,label:`Not monitored`,value:D.uncovered??0,color:`var(--text-muted)`}]:[]];return(0,f.jsxs)(`div`,{className:`p-4 md:p-6 max-w-6xl mx-auto`,children:[(0,f.jsxs)(`div`,{className:`flex items-start gap-3 mb-1`,children:[(0,f.jsxs)(`h1`,{className:`text-2xl font-bold text-primary flex-1 flex items-center gap-2.5`,children:[(0,f.jsx)(Gs,{size:22,className:`text-faint shrink-0`}),`Monitoring`]}),(0,f.jsxs)(`button`,{className:`btn-secondary text-xs gap-1.5 shrink-0`,onClick:()=>w(!0),disabled:o,children:[(0,f.jsx)(Gc,{size:13,className:o?`animate-spin`:``}),` Refresh`]})]}),(0,f.jsxs)(`p`,{className:`text-sm text-muted mb-5`,children:[`How your services are running, and anything we think you should know about.`,S&&(0,f.jsxs)(`span`,{className:`text-faint`,children:[` Updated `,wl(new Date(S).toISOString()),`.`]})]}),o&&!i?(0,f.jsx)(`p`,{className:`text-sm text-muted py-10 text-center`,children:`Loading monitoringâ¦`}):c?(0,f.jsx)(`div`,{className:`p-4 rounded-xl text-sm`,style:{background:`rgba(239,68,68,0.08)`,border:`1px solid rgba(239,68,68,0.2)`,color:`#f87171`},children:c}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`div`,{className:`grid ${L.length===3?`grid-cols-3`:`grid-cols-2`} gap-3 mb-6`,children:L.map(e=>{let t=m===e.key;return(0,f.jsxs)(`button`,{onClick:()=>h(e.key),className:`rounded-xl border p-3.5 text-left transition-colors`,style:{background:t?`color-mix(in srgb, var(--accent) 8%, var(--bg-surface))`:`var(--bg-surface)`,borderColor:t?`var(--accent)`:`var(--border)`},children:[(0,f.jsx)(`p`,{className:`text-2xl font-bold`,style:{color:e.color,margin:0},children:e.value}),(0,f.jsx)(`p`,{className:`text-xs text-muted mt-0.5`,style:{margin:`0.15rem 0 0`},children:e.label})]},e.key)})}),(0,f.jsxs)(`div`,{className:`mb-6`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 mb-3`,children:[(0,f.jsx)(`h2`,{className:`text-sm font-semibold text-primary`,style:{margin:0},children:`Needs your attention`}),k.length>0&&(0,f.jsx)(`span`,{className:`text-[11px] font-semibold px-1.5 py-0.5 rounded-full`,style:{background:`rgba(251,191,36,0.15)`,color:`#fbbf24`},children:k.length})]}),k.length===0?(0,f.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface p-5 flex items-center gap-3`,children:[(0,f.jsx)(Is,{size:18,style:{color:`#34d399`,flexShrink:0}}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-sm font-semibold text-primary`,style:{margin:0},children:`Nothing needs you right now`}),(0,f.jsx)(`p`,{className:`text-xs text-muted`,style:{margin:`0.2rem 0 0`},children:`We will list anything here that needs a decision or a payment from you.`})]})]}):(0,f.jsx)(`div`,{className:`space-y-3`,children:k.map(e=>(0,f.jsx)(El,{inc:e,onAct:T,onDismiss:E,dismissing:v===e.key},e.key))})]}),A.length>0&&(0,f.jsxs)(`div`,{className:`mb-6`,children:[(0,f.jsxs)(`button`,{onClick:()=>_(e=>!e),className:`flex items-center gap-2 mb-3 group`,children:[(0,f.jsx)(`h2`,{className:`text-sm font-semibold text-primary`,style:{margin:0},children:`For your information`}),(0,f.jsx)(`span`,{className:`text-[11px] font-semibold px-1.5 py-0.5 rounded-full`,style:{background:`var(--bg-elevated)`,color:`var(--text-muted)`},children:A.length}),g?(0,f.jsx)(rc,{size:14,className:`text-faint`}):(0,f.jsx)(ec,{size:14,className:`text-faint`})]}),g&&(0,f.jsx)(`div`,{className:`space-y-3`,children:A.map(e=>(0,f.jsx)(El,{inc:e,onAct:T,onDismiss:E,dismissing:v===e.key},e.key))})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2 mb-3`,children:[(0,f.jsx)(`h2`,{className:`text-sm font-semibold text-primary flex-1`,style:{margin:0},children:`Service status`}),(0,f.jsxs)(`div`,{className:`relative`,children:[(0,f.jsx)(qc,{size:14,className:`absolute left-2.5 top-1/2 -translate-y-1/2 text-faint pointer-events-none`}),(0,f.jsx)(`input`,{value:d,onChange:e=>p(e.target.value),placeholder:`Filter servicesâ¦`,className:`pl-8 pr-3 py-1.5 rounded-lg text-sm bg-elevated border border-edge text-primary placeholder:text-faint focus:outline-none focus:border-accent`,style:{width:180}})]})]}),!M&&(0,f.jsx)(`p`,{className:`text-[11px] text-faint mb-2`,children:i?.uptime?.error?`Availability checks could not be read just now, so this list shows what our records hold.`:`We are not running availability checks on this account yet, so the status below reflects our own records rather than a live probe.`}),I.length===0?(0,f.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface p-8 text-center`,children:[(0,f.jsx)(Yc,{size:30,className:`mx-auto mb-3 text-faint opacity-30`}),(0,f.jsx)(`p`,{className:`text-sm text-muted`,style:{margin:0},children:d?`No services matching "${d}"`:`No services match this filter`})]}):(0,f.jsx)(`div`,{className:`rounded-xl border border-edge overflow-hidden bg-surface`,children:I.map((e,n)=>{let r=xl[e.state]||xl.operational,i=e.usage||{};return(0,f.jsxs)(`div`,{className:`px-4 py-3.5 flex flex-wrap items-center gap-x-4 gap-y-3`,style:{borderBottom:n<I.length-1?`1px solid var(--border)`:`none`},children:[(0,f.jsx)(`span`,{className:`shrink-0 rounded-full`,title:r.label,style:{width:8,height:8,background:r.color,boxShadow:`0 0 0 3px ${r.bg}`}}),(0,f.jsxs)(`div`,{className:`min-w-0`,style:{flex:`1 1 220px`},children:[(0,f.jsx)(`p`,{className:`text-sm font-semibold text-primary truncate`,style:{margin:0},children:e.domain||e.name}),(0,f.jsx)(`p`,{className:`text-xs text-muted truncate`,style:{margin:`0.15rem 0 0`},children:e.domain?e.name:e.product_name||`Service`})]}),(0,f.jsx)(`span`,{className:`inline-flex items-center px-2.5 py-1 rounded-full text-xs font-semibold shrink-0`,style:{background:r.bg,color:r.color},children:r.label}),M?e.coverage===`monitored`?(0,f.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[11px] text-muted shrink-0`,title:`Availability checks are running`,children:[(0,f.jsx)(Wc,{size:11,style:{color:`#34d399`}}),e.monitor?.uptime_pct_30d==null?`Monitored`:`${e.monitor.uptime_pct_30d}% / 30d`]}):e.coverage===`paused`?(0,f.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[11px] shrink-0`,style:{color:`#fbbf24`},title:`Checks are paused`,children:[(0,f.jsx)(Uc,{size:11}),` Checks paused`]}):(0,f.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[11px] text-faint shrink-0`,title:`No availability checks are running`,children:[(0,f.jsx)(Uc,{size:11}),` Not monitored`]}
106):null,(i.disk_pct!=null||i.mem_pct!=null)&&(0,f.jsxs)(`div`,{className:`flex items-center gap-4 shrink-0`,children:[(0,f.jsx)(Tl,{label:`Disk`,pct:i.disk_pct}),(0,f.jsx)(Tl,{label:`Memory`,pct:i.mem_pct})]}),(0,f.jsx)(`button`,{className:`btn-secondary text-xs shrink-0 ml-auto`,onClick:()=>t?.(e.public_id),children:`View`})]},e.id)})}),F>1&&(0,f.jsxs)(`div`,{className:`flex items-center justify-center gap-3 mt-4`,children:[(0,f.jsx)(`button`,{className:`btn-secondary text-xs`,disabled:b<=1,onClick:()=>x(e=>e-1),children:`Previous`}),(0,f.jsxs)(`span`,{className:`text-xs text-muted`,children:[`Page `,b,` of `,F]}),(0,f.jsx)(`button`,{className:`btn-secondary text-xs`,disabled:b>=F,onClick:()=>x(e=>e+1),children:`Next`})]}),(0,f.jsx)(`p`,{className:`text-[11px] text-faint mt-6 leading-relaxed`,children:`Monitoring reflects what we can see from our side. If something looks wrong here but your service is fine â or the other way around â tell us and we will check it.`})]})]})}var Ol=[{iso:`AU`,name:`Australia`,dial:`61`},{iso:`NZ`,name:`New Zealand`,dial:`64`},{iso:`US`,name:`United States`,dial:`1`},{iso:`GB`,name:`United Kingdom`,dial:`44`},{iso:`CA`,name:`Canada`,dial:`1`},{iso:`AE`,name:`United Arab Emirates`,dial:`971`},{iso:`AR`,name:`Argentina`,dial:`54`},{iso:`AT`,name:`Austria`,dial:`43`},{iso:`BD`,name:`Bangladesh`,dial:`880`},{iso:`BE`,name:`Belgium`,dial:`32`},{iso:`BR`,name:`Brazil`,dial:`55`},{iso:`CH`,name:`Switzerland`,dial:`41`},{iso:`CL`,name:`Chile`,dial:`56`},{iso:`CN`,name:`China`,dial:`86`},{iso:`CO`,name:`Colombia`,dial:`57`},{iso:`CZ`,name:`Czechia`,dial:`420`},{iso:`DE`,name:`Germany`,dial:`49`},{iso:`DK`,name:`Denmark`,dial:`45`},{iso:`EG`,name:`Egypt`,dial:`20`},{iso:`ES`,name:`Spain`,dial:`34`},{iso:`FI`,name:`Finland`,dial:`358`},{iso:`FJ`,name:`Fiji`,dial:`679`},{iso:`FR`,name:`France`,dial:`33`},{iso:`GR`,name:`Greece`,dial:`30`},{iso:`HK`,name:`Hong Kong`,dial:`852`},{iso:`HU`,name:`Hungary`,dial:`36`},{iso:`ID`,name:`Indonesia`,dial:`62`},{iso:`IE`,name:`Ireland`,dial:`353`},{iso:`IL`,name:`Israel`,dial:`972`},{iso:`IN`,name:`India`,dial:`91`},{iso:`IT`,name:`Italy`,dial:`39`},{iso:`JP`,name:`Japan`,dial:`81`},{iso:`KE`,name:`Kenya`,dial:`254`}
106,{iso:`KR`,name:`South Korea`,dial:`82`},{iso:`LK`,name:`Sri Lanka`,dial:`94`},{iso:`MX`,name:`Mexico`,dial:`52`},{iso:`MY`,name:`Malaysia`,dial:`60`},{iso:`NG`,name:`Nigeria`,dial:`234`},{iso:`NL`,name:`Netherlands`,dial:`31`},{iso:`NO`,name:`Norway`,dial:`47`},{iso:`NP`,name:`Nepal`,dial:`977`},{iso:`PE`,name:`Peru`,dial:`51`},{iso:`PG`,name:`Papua New Guinea`,dial:`675`},{iso:`PH`,name:`Philippines`,dial:`63`},{iso:`PK`,name:`Pakistan`,dial:`92`},{iso:`PL`,name:`Poland`,dial:`48`},{iso:`PT`,name:`Portugal`,dial:`351`},{iso:`RO`,name:`Romania`,dial:`40`},{iso:`RU`,name:`Russia`,dial:`7`},{iso:`SA`,name:`Saudi Arabia`,dial:`966`},{iso:`SE`,name:`Sweden`,dial:`46`},{iso:`SG`,name:`Singapore`,dial:`65`},{iso:`TH`,name:`Thailand`,dial:`66`},{iso:`TR`,name:`Turkey`,dial:`90`},{iso:`TW`,name:`Taiwan`,dial:`886`},{iso:`VN`,name:`Vietnam`,dial:`84`},{iso:`ZA`,name:`South Africa`,dial:`27`}],kl=Object.fromEntries(Ol.map(e=>[e.iso,e]));function Al(e){return kl[e]||Ol[0]}function jl(e){return Al(e).dial}function Ml(e){return/^[A-Za-z]{2}$/.test(e||``)?e.toUpperCase().replace(/./g,e=>String.fromCodePoint(127397+e.charCodeAt(0))):``}var Nl={"Australia/Sydney":`AU`,"Australia/Melbourne":`AU`,"Australia/Brisbane":`AU`,"Australia/Adelaide":`AU`,"Australia/Perth":`AU`,"Australia/Darwin":`AU`,"Australia/Hobart":`AU`,"Australia/Canberra":`AU`,"Australia/Broken_Hill":`AU`,"Australia/Lord_Howe":`AU`,"Antarctica/Macquarie":`AU`,"Pacific/Auckland":`NZ`,"Pacific/Chatham":`NZ`,"Pacific/Fiji":`FJ`,"Pacific/Port_Moresby":`PG`,"Asia/Singapore":`SG`,"Asia/Hong_Kong":`HK`,"Asia/Tokyo":`JP`,"Asia/Seoul":`KR`,"Asia/Shanghai":`CN`,"Asia/Taipei":`TW`,"Asia/Kolkata":`IN`,"Asia/Dubai":`AE`,"Asia/Bangkok":`TH`,"Asia/Jakarta":`ID`,"Asia/Manila":`PH`,"Asia/Kuala_Lumpur":`MY`,"Asia/Ho_Chi_Minh":`VN`,"Asia/Karachi":`PK`,"Asia/Dhaka":`BD`,"Asia/Colombo":`LK`,"Asia/Kathmandu":`NP`,"Asia/Riyadh":`SA`,"Asia/Jerusalem":`IL`,"Europe/London":`GB`,"Europe/Dublin":`IE`,"Europe/Paris":`FR`,"Europe/Berlin":`DE`,"Europe/Madrid":`ES`,"Europe/Rome":`IT`,"Europe/Amsterdam":`NL`,"Europe/Brussels":`BE`,"Europe/Zurich":`CH`,"Europe/Vienna":`AT`,"Europe/Stockholm":`SE`,"Europe/Oslo":`NO`,"Europe/Copenhagen":`DK`,"Europe/Helsinki":`FI`,"Europe/Warsaw":`PL`,"Europe/Lisbon":`PT`,"Europe/Athens":`GR`,"Europe/Prague":`CZ`,"Europe/Bucharest":`RO`,"Europe/Budapest":`HU`,"Europe/Moscow":`RU`,"Europe/Istanbul":`TR`,"America/New_York":`US`,"America/Chicago":`US`,"America/Denver":`US`,"America/Los_Angeles":`US`,"America/Phoenix":`US`,"America/Anchorage":`US`,"America/Toronto":`CA`,"America/Vancouver":`CA`,"America/Edmonton":`CA`,"America/Mexico_City":`MX`,"America/Sao_Paulo":`BR`,"America/Argentina/Buenos_Aires":`AR`,"America/Santiago":`CL`,"America/Bogota":`CO`,"America/Lima":`PE`,"Africa/Johannesburg":`ZA`,"Africa/Cairo":`EG`,"Africa/Lagos":`NG`,"Africa/Nairobi":`KE`};function Pl(){try{let e=Intl.DateTimeFormat().resolvedOptions().timeZone;if(e&&Nl[e])return Nl[e]}catch{}try{let e=new Intl.Locale(navigator.language).region;if(e&&kl[e])return e}catch{}return`AU`}function Fl(e){let t=(e||``).replace(/[^\d+]/g,``);if(t.startsWith(`+`)){let e=t.slice(1),n=Ol.filter(t=>e.startsWith(t.dial)).sort((e,t)=>t.dial.length-e.dial.length)[0];if(n)return n.iso}return Pl()}function Il(e,t){let n=(t||``).replace(/\D/g,``).replace(/^0+/,``);return n?`+`+jl(e)+n:``}var Ll=[`script`,`style`,`iframe`,`object`,`embed`,`applet`,`frame`,`frameset`,`form`,`input`,`button`,`textarea`,`select`,`option`,`link`,`meta`,`base`,`svg`,`math`],Rl=[`srcset`,`ping`,`formaction`,`background`,`lowsrc`,`dynsrc`],zl=[`.gmail_quote`,`blockquote[type="cite"]`,`#divRplyFwdMsg`,`#appendonsend ~ *`,`.moz-cite-prefix`,`.OutlookMessageHeader`,`.yahoo_quoted`].join(`, `);function Bl(e){let t=String(e||``),n=[/^\s*On .{0,200}\bwrote:\s*$/m,/^\s*-{2,}\s*Original Message\s*-{2,}/im,/^\s*_{10,}\s*$/m,/^\s*-{5,}\s*$/m,/^\s*From:\s.+$/m,/^\s*Sent from my \w+/m],r=-1;for(let e of n){let n=t.match(e);n&&n.index>0&&(r===-1||n.index<r)&&(r=n.index)}let i=t.search(/^>.*$/m);if(i>0&&(r===-1||i<r)&&(r=i),r<=0)return{reply:t,quoted:``};let a=t.slice(0,r).trimEnd();return a.trim()?{reply:a,quoted:t.slice(r).trim()}:{reply:t,quoted:``}}function Vl(e,{cidMap:t=new Map,allowRemote:n=!1,showQuoted:r=!1}={}
106){let i=Ts.sanitize(String(e||``),{FORBID_TAGS:Ll,FORBID_ATTR:Rl,ALLOW_DATA_ATTR:!1,RETURN_DOM_FRAGMENT:!0}),a=!1;if(!r){let e=[...i.querySelectorAll(zl)];if(e.length){let t=i.cloneNode(!0);for(let e of t.querySelectorAll(zl))e.remove();if(t.textContent.trim()||t.querySelector(`img`)){for(let t of e)t.remove();a=!0}}}let o=0;for(let e of[...i.querySelectorAll(`img`)]){let r=(e.getAttribute(`src`)||``).trim(),i=r.match(/^cid:(.+)$/i);if(i){let n=t.get(decodeURIComponent(i[1]).toLowerCase());n?e.setAttribute(`src`,n):e.remove();continue}if(!/^data:image\//i.test(r)){if(/^https?:/i.test(r)){if(n)continue;o++,e.removeAttribute(`src`),e.remove();continue}e.remove()}}for(let e of[...i.querySelectorAll(`[style]`)]){let t=e.getAttribute(`style`)||``,r=t;/javascript:|vbscript:|expression\s*\(|behavior\s*:|-moz-binding/i.test(r)&&(r=r.replace(/[^;]*(?:javascript:|vbscript:|expression\s*\(|behavior\s*:|-moz-binding)[^;]*;?/gi,``)),!n&&/url\(\s*['"]?\s*https?:/i.test(r)&&(o++,r=r.replace(/[^;]*url\(\s*['"]?\s*https?:[^;]*;?/gi,``)),r!==t&&(r.trim()?e.setAttribute(`style`,r):e.removeAttribute(`style`))}for(let e of[...i.querySelectorAll(`a`)]){let t=(e.getAttribute(`href`)||``).trim();/^(https?:|mailto:|tel:)/i.test(t)||e.removeAttribute(`href`),e.setAttribute(`target`,`_blank`),e.setAttribute(`rel`,`noopener noreferrer nofollow`)}let s=document.createElement(`div`);return s.appendChild(i),{html:s.innerHTML,blocked:o,hasQuoted:a}}function Hl({html:e,allowRemote:t}){let n=(0,l.useRef)(null),[r,i]=(0,l.useState)(60),a=(0,l.useMemo)(()=>`<!doctype html><html><head><meta charset="utf-8"><meta http-equiv="Content-Security-Policy" content="${[`default-src 'none'`,`img-src ${t?`'self' data: https: http:`:`'self' data:`}`,`style-src 'unsafe-inline'`,`font-src data:`,`base-uri 'none'`,`form-action 'none'`].join(`; `)}"><style>html,body{margin:0;padding:12px;background:#fff;color:#1a1a1a;font:14px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;word-break:break-word;overflow-wrap:anywhere}img{max-width:100%;height:auto}table{max-width:100%}blockquote{margin:8px 0;padding-left:12px;border-left:3px solid #ddd;color:#555}a{color:#c2410c}*{max-width:100%!important}</style></head><body>${e}</body></html>`,[e,t]);return(0,l.useLayoutEffect)(()=>{let e=n.current;if(!e)return;let t,r=()=>{try{let t=e.contentDocument;if(!t?.body)return;let n=Math.max(t.body.scrollHeight,t.documentElement?.scrollHeight||0);n&&i(Math.min(n+4,5e3))}catch{}},a=()=>{r();try{let n=e.contentDocument;n?.body&&`ResizeObserver`in window&&(t=new ResizeObserver(r),t.observe(n.body));for(let e of n?.images||[])e.complete||e.addEventListener(`load`,r,{once:!0})}catch{}};return e.addEventListener(`load`,a),e.contentDocument?.readyState===`complete`&&a(),()=>{e.removeEventListener(`load`,a),t?.disconnect()}},[a]),(0,f.jsx)(`iframe`,{ref:n,title:`Email message`,srcDoc:a,sandbox:`allow-same-origin allow-popups allow-popups-to-escape-sandbox`,referrerPolicy:`no-referrer`,loading:`lazy`,style:{width:`100%`,height:r,border:0,display:`block`,borderRadius:10,background:`#fff`,colorScheme:`light`}})}function Ul({text:e,html:t,cidMap:n,className:r,textStyle:i}){let[a,o]=(0,l.useState)(!0),[s,c]=(0,l.useState)(!1),[u,d]=(0,l.useState)(!1),p=(0,l.useMemo)(()=>t?Vl(t,{cidMap:n,allowRemote:s,showQuoted:u}):null,[t,n,s,u]),m=(0,l.useMemo)(()=>Bl(e),[e]),h=!!p&&p.html.trim().length>0,g=()=>(0,f.jsxs)(`button`,{onClick:()=>d(e=>!e),className:`inline-flex items-center gap-1 text-[11px] opacity-40 hover:opacity-80 transition-opacity`,title:u?`Hide the quoted conversation`:`Show the quoted conversation`,children:[(0,f.jsx)(Bs,{size:11}),` `,u?`Hide quoted text`:`Show quoted text`]});return!h||!a?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`div`,{className:r,style:i,children:u||!m.quoted?e||`(no message body)`:m.reply}),(0,f.jsxs)(`div`,{className:`mt-2 flex items-center gap-3 flex-wrap`,children:[!!m.quoted&&(0,f.jsx)(g,{}),h&&(0,f.jsxs)(`button`,{onClick:()=>o(!0),className:`inline-flex items-center gap-1 text-[11px] opacity-50 hover:opacity-90 transition-opacity`,children:[(0,f.jsx)(zs,{size:11}),` Show HTML version`]})]})]}):(0,f.jsxs)(`div`,{children:[(0,f.jsx)(Hl,{html:p.html,allowRemote:s}),(0,f.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-3 flex-wrap`,children:[p.blocked>0&&!s&&(0,f.jsxs)(`button`,{onClick:()=>c(!0),className:`inline-flex items-center gap-1 text-[11px] opacity-60 hover:opacity-100 transition-opacity`,title:`Remote images can tell the sender when this ticket was opened`,children:[(0,f.jsx)(_c,{size:11}),p.blocked,` remote image`,p.blocked===1?``:`s`,` blocked â show`]}),(p.hasQuoted||u)&&(0,f.jsx)(g,{}),(0,f.jsxs)(`button`,{onClick:()=>o(!1),className:`inline-flex items-center gap-1 text-[11px] opacity-40 hover:opacity-80 transition-opacity`,children:[(0,f.jsx)(al,{size:11}),` View plain text`]})]})]})}function Q(e){return e?new Date(e).toLocaleDateString(`en-AU`,{day:`2-digit`,month:`short`,year:`numeric`}):`â`}function $(e){let t=parseFloat(e);return isNaN(t)?`$0.00`:`$`+t.toFixed(2)}var Wl={monitor:0,protect:1,plus:2},Gl={monitor:`Bot Monitoring`,protect:`Bot Protection`,plus:`Bot Protection +`},Kl={monitor:{rules:!1,rulesets:!1,loadbalancer:!1,custom_rules:!1,events:!0},protect:{rules:!0,rulesets:!0,loadbalancer:!1,custom_rules:!1,events:!0},plus:{rules:!0,rulesets:!0,loadbalancer:!0,custom_rules:!0,events:!0}},ql=[{key:`24h`,label:`24 hours`,sub:`last 24h`},{key:`7d`,label:`7 days`,sub:`last 7 days`},{key:`30d`,label:`30 days`,sub:`last 30 days`}],Jl=[{key:`overview`,label:`Overview`,min:`monitor`},{key:`rules`,label:`Rules`,min:`protect`,teaserTitle:`Decide who gets in`,teaserBody:`Set how each kind of visitor is handled â search engines, real people, scrapers, headless browsers.`,teaserPoints:[`Grant, block or challenge each of the eight visitor categories`,`Changes take effect at the edge within seconds`]}
106,{key:`customrules`,label:`Custom Rules`,min:`plus`,teaserTitle:`Rules you write yourself`,teaserBody:`Match on path, IP, country, network, user-agent, referer or any header â then block, allow, challenge, redirect or rate-limit.`,teaserPoints:[`Rate-limit your login page to five requests a minute`,`Block whole networks by country or ASN`,`Allow-list your uptime monitor so it is never challenged`]},{key:`lb`,label:`Edge Settings`,min:`plus`,teaserTitle:`Edge delivery and DDoS`,teaserBody:`Serve your site from the edge with caching, HTTP/3 and forced HTTPS, backed by network-level DDoS mitigation.`,teaserPoints:[`Advanced DDoS absorption over BGP Anycast`,`Static and dynamic page caching at the edge`,`HTTP/3 (QUIC), forced HTTPS and upstream TLS`]},{key:`eventlog`,label:`Event Log`,min:`monitor`}],Yl={search_engines:{label:`Search Engines`,desc:`Googlebot, Bingbot, and other verified crawlers`},social_networks:{label:`Social Networks`,desc:`Facebook, Twitter, LinkedIn link-preview bots`},services_and_payments:{label:`Services & Payments`,desc:`Payment processors, monitoring, and SaaS platforms`},humans:{label:`Human Visitors`,desc:`Real browser-based users passing fingerprint checks`},security_issues:{label:`Security Issues`,desc:`Known attack tools, CVE scanners, and exploit kits`},content_scrapers:{label:`Content Scrapers`,desc:`Automated tools harvesting content or pricing data`},emulated_humans:{label:`Emulated Humans`,desc:`Headless browsers and automation frameworks`},suspicious_behaviour:{label:`Suspicious Behaviour`,desc:`Anomalous patterns not matching any known category`}},Xl={search_engines:`#60a5fa`,social_networks:`#a78bfa`,services_and_payments:`#34d399`,humans:`#34d399`,security_issues:`#f87171`,content_scrapers:`#fb923c`,emulated_humans:`#f87171`,suspicious_behaviour:`#fbbf24`},Zl={human:{key:`human`,label:`Humans`,color:`#34d399`,desc:`Real people in real browsers`},good_bot:{key:`good_bot`,label:`Good bots`,color:`#60a5fa`,desc:`Search engines, link previews and services you want`},unwanted:{key:`unwanted`,label:`Unwanted`,color:`#f87171`,desc:`Scrapers, automation, scanners and probing`},other:{key:`other`,label:`Other`,color:`#94a3b8`,desc:`Matched one of your own rules`}},Ql={humans:`human`,search_engines:`good_bot`,social_networks:`good_bot`,services_and_payments:`good_bot`,security_issues:`unwanted`,content_scrapers:`unwanted`,emulated_humans:`unwanted`,suspicious_behaviour:`unwanted`,security_violators:`unwanted`,custom:`other`},$l=[`human`,`good_bot`,`unwanted`,`other`],eu=e=>Zl[Ql[e]||`other`],tu={custom:`Matched a custom rule`,security_violators:`Security Violators`},nu=e=>Yl[e]?.label||tu[e]||String(e).replace(/_/g,` `);function ru(e){let t=new Map;for(let n of[`requests_passed`,`requests_blocked`])for(let[r,i]of Object.entries(e?.[n]||{})){if(!i)continue;let e=t.get(r)||{cat:r,label:nu(r),cls:eu(r),passed:0,blocked:0,total:0};e[n===`requests_passed`?`passed`:`blocked`]+=i,e.total+=i,t.set(r,e)}let n=[...t.values()].sort((e,t)=>t.total-e.total),r=n.reduce((e,t)=>e+t.total,0),i=e?.requests_total||r||0;return{rows:n,classes:$l.map(e=>{let t=Zl[e],r=n.filter(t=>t.cls.key===e).reduce((e,t)=>e+t.total,0);return{...t,count:r,pct:i>0?r/i*100:0}}),total:i,max:n.length?n[0].total:0,counted:r}}var iu=e=>e>0&&e<10?`${e.toFixed(1)}%`:`${Math.round(e)}%`,au={domain:`Domain`,path:`Path`,method:`Method`,ip:`IP Address`,ip_asn:`ASN`,ip_isp:`ISP`,ip_country:`Country`,user_agent:`User-Agent`,ref:`Referer`,http_header:`HTTP Header`},ou={equal:`=`,not_equal:`â `,contains:`contains`,not_contains:`!contains`,greater_than:`>`,less_than:`<`,any_of:`any of`,match:`~`},su={equal:`equals`,not_equal:`does not equal`,contains:`contains`,not_contains:`does not contain`,greater_than:`is greater than`,less_than:`is less than`,any_of:`is any of`,match:`matches`},cu={deny:`Block`,grant:`Allow`,captcha:`Challenge`,redirect:`Redirect`,rpm:`Rate limit â per minute`,rph:`Rate limit â per hour`,rp24:`Rate limit â per 24 hours`},lu={deny:`Block`,grant:`Allow`,captcha:`Challenge`,redirect:`Redirect`,rpm:`RPM`,rph:`RPH`,rp24:`RP24`},uu=new Set([`rpm`,`rph`,`rp24`]),du=new Set([`greater_than`,`less_than`]),fu=50,pu=10,mu={background:`var(--bg-surface)`,border:`1px solid var(--border)`,borderRadius:12,padding:`1.25rem`,marginBottom:`1rem`},hu={fontSize:`0.8125rem`,fontWeight:700,textTransform:`uppercase`,letterSpacing:`0.09em`,color:`var(--text-faint)`,marginBottom:`0.75rem`},gu={grant:`#34d399`,deny:`#f87171`,captcha:`#fbbf24`},_u={grant:`#34d39918`,deny:`#f8717118`,captcha:`#fbbf2418`},vu={deny:`#f87171`,grant:`#34d399`,captcha:`#fbbf24`,redirect:`#60a5fa`,rpm:`#a78bfa`,rph:`#a78bfa`,rp24:`#a78bfa`},yu={deny:`#f8717118`,grant:`#34d39918`,captcha:`#fbbf2418`,redirect:`#60a5fa18`,rpm:`#a78bfa18`,rph:`#a78bfa18`,rp24:`#a78bfa18`},bu={grant:`#34d399`,deny:`#f87171`,captcha:`#fbbf24`,redirect:`#60a5fa`,return_fake_data:`#a78bfa`,block:`#f87171`,allow:`#34d399`},xu={grant:`#34d39918`,deny:`#f8717118`,captcha:`#fbbf2418`,redirect:`#60a5fa18`,return_fake_data:`#a78bfa18`,block:`#f8717118`,allow:`#34d39918`},Su=Date.now(),Cu={website:{domain:`example-demo.com.au`,status:`online`,subdomain:[`www`,`shop`,`api`],ip:[`103.24.128.44`,`103.24.128.45`],tag:[`wordpress`,`ecommerce`,`crm:1234`]},stats:{requests_total:47832,requests_passed:{search_engines:3241,social_networks:847,services_and_payments:1205,humans:27419,security_issues:0,content_scrapers:0,emulated_humans:0,suspicious_behaviour:0},requests_blocked:{search_engines:0,social_networks:0,services_and_payments:0,humans:0,security_issues:8203,content_scrapers:4107,emulated_humans:2301,suspicious_behaviour:509},trend:[{day:`Mon`,passed:34100,blocked:7100}
106,{day:`Tue`,passed:32400,blocked:6500},{day:`Wed`,passed:33100,blocked:6700},{day:`Thu`,passed:30200,blocked:5900},{day:`Fri`,passed:29400,blocked:6e3},{day:`Sat`,passed:36500,blocked:7600},{day:`Sun`,passed:32712,blocked:15120}]},settings:{rules:{search_engines:`grant`,social_networks:`grant`,services_and_payments:`grant`,humans:`grant`,security_issues:`deny`,content_scrapers:`captcha`,emulated_humans:`deny`,suspicious_behaviour:`captcha`},rulesets:{wordpress:!0,cpanel:!1,drupal:!1,joomla:!1,prestashop:!1,nextcloud:!1,xenforo:!1,dokuwiki:!1,bitrix:!1},loadbalancer:{botguard_protection:!0,ddos_protection:!0,ddos_protection_advanced:!1,force_https:!0,enable_http3:!0,cache_static_files:!0,cache_dynamic_pages:!1,certs_issuer:`letsencrypt`,upstreams_use_https:!1,webhook:``},custom_rules:[{rule_name:`Rate-Limit Login Page`,active:!0,rules:[{field:`path`,comparison:`equal`,field_value:`/wp-login.php`}],rule_action:{action:`rpm`,action_value:5}},{rule_name:`Block High-Risk ASNs`,active:!0,rules:[{field:`ip_asn`,comparison:`any_of`,field_value:`AS62041, AS202425, AS209588`}],rule_action:{action:`deny`,action_value:null}},{rule_name:`Redirect Joomla Probes`,active:!0,rules:[{field:`path`,comparison:`contains`,field_value:`/administrator/`}],rule_action:{action:`redirect`,action_value:`/not-found`}},{rule_name:`Allow Uptime Monitor`,active:!0,rules:[{field:`ip`,comparison:`equal`,field_value:`1.2.3.4`},{field:`path`,comparison:`contains`,field_value:`/health`}],rule_action:{action:`grant`,action_value:null}},{rule_name:`Block Python Scrapers`,active:!1,rules:[{field:`user_agent`,comparison:`contains`,field_value:`python-requests`}],rule_action:{action:`deny`,action_value:null}}]},plans:[{product_id:1217,sku:`NDBM`,tier:`monitor`,name:`Bot Monitoring`,amount:0,billingcycle:`Monthly`,description:`Free bot monitoring so you can see exactly how much automated traffic is hitting your website before you block anything.`,features:[`Bot traffic analytics`,`Identify automated traffic`,`No active blocking`]},{product_id:1101,sku:`NDBP`,tier:`protect`,name:`Bot Protection`,amount:19,billingcycle:`Monthly`,description:`Bot protection that helps reduce automated abuse, fake traffic, and malicious requests before they impact your website.`,features:[`Automated bot blocking`,`Network Dynamics managed rules`,`Full event log`]},{product_id:1208,sku:`NDBPP`,tier:`plus`,name:`Bot Protection +`,amount:99,billingcycle:`Monthly`,description:`Advanced bot protection with customisable rules, giving you granular control over malicious traffic.`,features:[`Custom allow, block & rate-limit rules`,`Country & ASN controls`,`Edge settings: CDN, DDoS and HTTPS`]}]},wu=[{date_time:new Date(Su-45e3).toISOString(),url:`https://example-demo.com.au/wp-login.php`,visitor_ip:`185.220.101.45`,country_provider:`RU, AS62041`,user_agent:`python-requests/2.28.1`,category:`emulated_humans`,mitigation:`deny`},{date_time:new Date(Su-78e3).toISOString(),url:`https://example-demo.com.au/xmlrpc.php`,visitor_ip:`103.24.77.12`,country_provider:`CN, AS4134`,user_agent:`Mozilla/5.0 Masscan/1.0`,category:`security_issues`,mitigation:`deny`},{date_time:new Date(Su-134e3).toISOString(),url:`https://example-demo.com.au/shop/products/`,visitor_ip:`54.36.148.200`,country_provider:`FR, AS16276`,user_agent:`AhrefsBot/7.0`,category:`content_scrapers`,mitigation:`captcha`},{date_time:new Date(Su-201e3).toISOString(),url:`https://example-demo.com.au/`,visitor_ip:`203.110.242.33`,country_provider:`AU, AS7474`,user_agent:`Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36`,category:`humans`,mitigation:`grant`},{date_time:new Date(Su-267e3).toISOString(),url:`https://example-demo.com.au/wp-admin/`,visitor_ip:`45.142.212.12`,country_provider:`NL, AS202425`,user_agent:`Go-http-client/2.0`,category:`emulated_humans`,mitigation:`deny`},{date_time:new Date(Su-334e3).toISOString(),url:`https://example-demo.com.au/shop/`,visitor_ip:`66.249.66.33`,country_provider:`US, AS15169`,user_agent:`Googlebot/2.1`,category:`search_engines`,mitigation:`grant`},{date_time:new Date(Su-401e3).toISOString(),url:`https://example-demo.com.au/.env`,visitor_ip:`195.178.110.45`,country_provider:`DE, AS9009`,user_agent:`Nuclei - Open-source project`,category:`security_issues`,mitigation:`deny`},{date_time:new Date(Su-512e3).toISOString(),url:`https://example-demo.com.au/shop/checkout/`,visitor_ip:`180.76.15.141`,country_provider:`CN, AS38365`,user_agent:`Baiduspider/2.0`,category:`content_scrapers`,mitigation:`captcha`},{date_time:new Date(Su-623e3).toISOString(),url:`https://example-demo.com.au/contact/`,visitor_ip:`119.81.1.34`,country_provider:`SG, AS36351`,user_agent:`Mozilla/5.0 (iPhone; CPU iPhone OS 17_4)`,category:`humans`,mitigation:`grant`},{date_time:new Date(Su-734e3).toISOString(),url:`https://example-demo.com.au/wp-json/wp/v2/`,visitor_ip:`82.148.8.250`,country_provider:`RU, AS29076`,user_agent:`curl/7.88.1`,category:`suspicious_behaviour`,mitigation:`captcha`},{date_time:new Date(Su-845e3).toISOString(),url:`https://example-demo.com.au/api/v1/products`,visitor_ip:`188.40.77.15`,country_provider:`DE, AS24940`,user_agent:`Screaming Frog SEO Spider/19.0`,category:`content_scrapers`,mitigation:`captcha`},{date_time:new Date(Su-956e3).toISOString(),url:`https://example-demo.com.au/`,visitor_ip:`143.202.88.241`,country_provider:`US, AS36352`,user_agent:`HeadlessChrome/120.0.6099.71`,category:`emulated_humans`,mitigation:`deny`}];function Tu({trend:e}){if(!e?.length)return null;let t=(300-3*(e.length-1))/e.length,n=Math.max(...e.map(e=>e.passed+e.blocked),1);
106return(0,f.jsx)(`svg`,{viewBox:`0 0 300 56`,preserveAspectRatio:`none`,style:{width:`100%`,height:56},children:e.map((e,r)=>{let i=r*(t+3),a=e.passed/n*56,o=e.blocked/n*56;return(0,f.jsxs)(`g`,{children:[(0,f.jsx)(`rect`,{x:i,y:56-a,width:t,height:a,fill:`#34d39938`,rx:2}),(0,f.jsx)(`rect`,{x:i,y:56-a-o,width:t,height:o,fill:`#f8717138`,rx:2})]},r)})})}function Eu({on:e,onClick:t,size:n=`md`}){let r=n===`sm`?30:34,i=n===`sm`?16:18,a=n===`sm`?10:12;return(0,f.jsx)(`div`,{onClick:t,style:{width:r,height:i,borderRadius:999,background:e?`#34d39940`:`var(--bg-elevated)`,border:`1px solid var(--border)`,position:`relative`,cursor:`pointer`,transition:`background 0.2s`,flexShrink:0},children:(0,f.jsx)(`div`,{style:{position:`absolute`,top:2,left:e?r-a-4:2,width:a,height:a,borderRadius:`50%`,background:e?`#34d399`:`var(--text-faint)`,transition:`left 0.2s`}})})}var Du=e=>{let t=String(e||`Monthly`).toLowerCase();return t===`annually`?`year`:t===`monthly`?`month`:t};function Ou({offer:e,serviceId:t,isDemo:n,onClose:r,onGoBilling:i}){let[a,o]=(0,l.useState)(!1),[s,c]=(0,l.useState)(null),[u,d]=(0,l.useState)(null),p=e.direction===`down`,m=Du(e.billingcycle);async function h(){if(n){d({demo:!0});return}o(!0),c(null);try{let n=await Z(`/api/portal/services/${t}/change-package`,{method:`POST`,body:JSON.stringify({product_id:e.product_id})});if(!n.ok){c(n.message||n.error||`Could not change plan`),o(!1);return}d(n)}catch{c(`Network error. Please try again.`)}finally{o(!1)}}return(0,f.jsx)(`div`,{style:{position:`fixed`,inset:0,background:`rgba(0,0,0,0.55)`,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`1rem`,zIndex:60},onClick:r,children:(0,f.jsxs)(`div`,{onClick:e=>e.stopPropagation(),style:{background:`var(--bg-surface)`,border:`1px solid var(--border)`,borderRadius:14,padding:`1.5rem`,width:`100%`,maxWidth:460,maxHeight:`85vh`,overflowY:`auto`},children:[(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:`1rem`},children:[(0,f.jsx)(`h2`,{style:{fontSize:`1.05rem`,fontWeight:700,color:`var(--text-primary)`,margin:0},children:u?u.demo?`Demo mode`:u.scheduled?`Change scheduled`:`You're almost there`:p?`Move to ${e.name}`:`Upgrade to ${e.name}`}),(0,f.jsx)(`button`,{onClick:r,style:{background:`none`,border:`none`,cursor:`pointer`,color:`var(--text-muted)`},children:(0,f.jsx)(pl,{size:18})})]}),s&&(0,f.jsxs)(`div`,{className:`alert-error`,style:{marginBottom:`0.9rem`},children:[(0,f.jsx)(Y,{size:15}),s]}),u?u.demo?(0,f.jsx)(`p`,{style:{fontSize:`0.85rem`,color:`var(--text-muted)`,margin:0},children:`This is sample data, so nothing was ordered and no invoice was raised.`}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`p`,{style:{fontSize:`0.85rem`,color:`var(--text-muted)`,lineHeight:1.6,marginTop:0},children:u.invoiceId?(0,f.jsxs)(f.Fragment,{children:[`Invoice `,(0,f.jsxs)(`strong`,{style:{color:`var(--text-primary)`},children:[`#`,u.invoiceId]}),u.diff!=null&&(0,f.jsxs)(f.Fragment,{children:[` for `,(0,f.jsx)(`strong`,{style:{color:`var(--text-primary)`},children:$(u.diff)})]}),` is ready to pay. Once it's paid we'll switch you to `,e.name,`, and the new tabs unlock shortly afterwards.`]}):u.message||`We've recorded your move to ${e.name}.`}),(0,f.jsxs)(`div`,{style:{display:`flex`,gap:`0.5rem`,justifyContent:`flex-end`},children:[u.invoiceId&&(0,f.jsxs)(`button`,{onClick:i,style:{display:`flex`,alignItems:`center`,gap:`0.35rem`,padding:`0.42rem 0.95rem`,borderRadius:8,border:`none`,background:`var(--btn-solid)`,color:`var(--btn-solid-text)`,fontSize:`0.8125rem`,fontWeight:600,cursor:`pointer`},children:[`Go to Billing `,(0,f.jsx)(Js,{size:13,strokeWidth:2.5})]}),(0,f.jsx)(`button`,{className:`btn-secondary`,onClick:r,children:`Close`})]})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`div`,{style:{padding:`0.6rem 0.8rem`,borderRadius:9,background:`var(--bg-elevated)`,marginBottom:`0.85rem`},children:[[`Now`,e.amount!=null&&e.diff!=null?e.amount-e.diff:null],[e.name,e.amount],[`Difference`,e.diff]].map(([e,t],n)=>(0,f.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,padding:`0.18rem 0`,fontSize:`0.83rem`},children:[(0,f.jsx)(`span`,{style:{color:`var(--text-muted)`},children:e}),(0,f.jsxs)(`span`,{style:{color:`var(--text-primary)`,fontWeight:n===2?700:500},children:[t==null?`â`:(n===2&&t>0?`+`:``)+$(t),n<2&&t!=null?` / ${m}`:``]})]},n))}),(0,f.jsx)(`p`,{style:{fontSize:`0.83rem`,color:`var(--text-muted)`,lineHeight:1.55,marginTop:0,marginBottom:`1rem`},children:p?`We'll move you to ${e.name} at your next renewal â you keep everything you've already paid for until then.`:`We'll raise an invoice for the difference. Your upgrade applies as soon as it's paid.`}),(0,f.jsxs)(`div`,{style:{display:`flex`,gap:`0.5rem`,justifyContent:`flex-end`},children:[(0,f.jsx)(`button`,{className:`btn-secondary`,onClick:r,disabled:a,children:`Cancel`}),(0,f.jsx)(`button`,{onClick:h,disabled:a,style:{padding:`0.42rem 0.95rem`,borderRadius:8,border:`none`,background:`var(--btn-solid)`,color:`var(--btn-solid-text)`,fontSize:`0.8125rem`,fontWeight:600,cursor:`pointer`,o
106pacity:a?.7:1},children:a?`Workingâ¦`:p?`Confirm change`:`Confirm upgrade`})]})]})]})})}function ku({plans:e,serviceId:t,isDemo:n,onGoBilling:r,onGoSupport:i}){let[a,o]=(0,l.useState)(null);return e.length?(0,f.jsxs)(`div`,{style:mu,children:[(0,f.jsx)(`p`,{style:hu,children:`Protection Level`}),(0,f.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(190px, 1fr))`,gap:`0.6rem`},children:e.map(e=>{let t=e.direction===`current`,n=e.direction===`up`,r=e.amount!=null;return(0,f.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`0.5rem`,padding:`0.85rem 0.9rem`,borderRadius:11,background:t?`color-mix(in srgb, var(--accent) 7%, var(--bg-surface))`:`var(--bg-elevated)`,border:t?`1.5px solid color-mix(in srgb, var(--accent) 45%, transparent)`:`1px solid var(--border)`},children:[(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`0.35rem`,marginBottom:2},children:[t?(0,f.jsx)(Xc,{size:14,strokeWidth:2.2,style:{color:`var(--accent)`,flexShrink:0}}):(0,f.jsx)(Zc,{size:14,strokeWidth:2,style:{color:`var(--text-faint)`,flexShrink:0}}),(0,f.jsx)(`span`,{style:{fontSize:`0.85rem`,fontWeight:700,color:`var(--text-primary)`},children:e.name})]}),(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`},children:r?e.amount>0?`${$(e.amount)} / ${Du(e.billingcycle)}`:`Free`:`â`})]}),!!e.features?.length&&(0,f.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`0.22rem`},children:e.features.slice(0,3).map((e,n)=>(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:`0.35rem`},children:[(0,f.jsx)($s,{size:12,strokeWidth:2.5,style:{color:t?`var(--accent)`:`var(--text-faint)`,flexShrink:0,marginTop:2}}),(0,f.jsx)(`span`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`,lineHeight:1.35},children:e})]},n))}),(0,f.jsx)(`div`,{style:{marginTop:`auto`,paddingTop:`0.2rem`},children:t?(0,f.jsx)(`span`,{style:{display:`inline-block`,fontSize:`0.8125rem`,fontWeight:700,padding:`0.2rem 0.5rem`,borderRadius:6,background:`color-mix(in srgb, var(--accent) 15%, transparent)`,color:`var(--accent)`},children:`Current plan`}):r?n?(0,f.jsxs)(`button`,{onClick:()=>o(e),style:{width:`100%`,padding:`0.4rem 0.7rem`,borderRadius:8,border:`none`,background:`var(--btn-solid)`,color:`var(--btn-solid-text)`,fontSize:`0.8125rem`,fontWeight:600,cursor:`pointer`},children:[`Upgrade`,e.diff!=null&&e.diff>0?` â +${$(e.diff)}`:``]}):(0,f.jsx)(`button`,{onClick:()=>o(e),style:{background:`none`,border:`none`,padding:0,cursor:`pointer`,color:`var(--text-faint)`,fontSize:`0.8125rem`,fontWeight:600,textAlign:`left`},children:`Switch to this plan`}):(0,f.jsx)(`button`,{onClick:i,style:{background:`none`,border:`none`,padding:0,cursor:`pointer`,color:`var(--text-muted)`,fontSize:`0.8125rem`,fontWeight:600,textAlign:`left`},children:`Talk to us â`})})]},e.product_id)})}),a&&(0,f.jsx)(Ou,{offer:a,serviceId:t,isDemo:n,onClose:()=>o(null),onGoBilling:r})]}):null}function Au({offer:e,serviceId:t,isDemo:n,onGoBilling:r,onGoSupport:i}){let[a,o]=(0,l.useState)(!1),s=e.amount!=null;return(0,f.jsxs)(`div`,{style:{...mu,background:`color-mix(in srgb, var(--accent) 6%, var(--bg-surface))`,border:`1px solid color-mix(in srgb, var(--accent) 30%, transparent)`},children:[(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`0.6rem`,marginBottom:`0.55rem`},children:[(0,f.jsx)(`div`,{style:{width:30,height:30,borderRadius:9,background:`color-mix(in srgb, var(--accent) 14%, transparent)`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0},children:(0,f.jsx)(Xc,{size:16,strokeWidth:2,style:{color:`var(--accent)`}})}),(0,f.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,f.jsxs)(`div`,{style:{fontSize:`0.92rem`,fontWeight:700,color:`var(--text-primary)`},children:[`Upgrade to `,e.name]}),s&&(0,f.jsxs)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`},children:[$(e.amount),` / `,Du(e.billingcycle),e.diff!=null&&e.diff>0&&(0,f.jsxs)(`span`,{style:{color:`var(--text-faint)`},children:[` · `,$(e.diff),` more than you pay now`]})]})]})]}),e.description&&(0,f.jsx)(`p`,{style:{fontSize:`0.83rem`,color:`var(--text-muted)`,lineHeight:1.55,marginTop:0,marginBottom:`0.85rem`},children:e.description}),s?(0,f.jsxs)(`button`,{onClick:()=>o(!0),style:{padding:`0.45rem 1rem`,borderRadius:8,border:`none`,background:`var(--btn-solid)`,color:`var(--btn-solid-text)`,fontSize:`0.84rem`,fontWeight:600,cursor:`pointer`},children:[`Upgrade â `,$(e.amount),`/`,Du(e.billingcycle)]}):(0,f.jsx)(`button`,{onClick:i,style:{padding:`0.45rem 1rem`,borderRadius:8,border:`1px solid var(--border)`,background:`var(--bg-elevated)`,color:`var(--text-primary)`,fontSize:`0.84rem`,fontWeight:600,cursor:`pointer`},children:`Talk to us about upgrading`}),a&&(0,f.jsx)(Ou,{offer:e,serviceId:t,isDemo:n,onClose:()=>o(!1),onGoBilling:r})]})}function ju({tab:e,offer:t,serviceId:n,isDemo:r,onGoBilling:i,onGoSupport:a}){return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`div`,{style:mu,children:[(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`0.6rem`,marginBottom:`0.6rem`}
106,children:[(0,f.jsx)(`div`,{style:{width:34,height:34,borderRadius:10,background:`var(--bg-elevated)`,border:`1px solid var(--border)`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0},children:(0,f.jsx)(wc,{size:16,strokeWidth:2,style:{color:`var(--text-faint)`}})}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{style:{fontSize:`0.97rem`,fontWeight:700,color:`var(--text-primary)`},children:e.teaserTitle}),(0,f.jsxs)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-faint)`},children:[`Part of `,Gl[e.min]||e.min]})]})]}),(0,f.jsx)(`p`,{style:{fontSize:`0.85rem`,color:`var(--text-muted)`,lineHeight:1.6,marginTop:0,marginBottom:`0.85rem`},children:e.teaserBody}),(0,f.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`0.4rem`},children:(e.teaserPoints||[]).map((e,t)=>(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:`0.45rem`},children:[(0,f.jsx)($s,{size:14,strokeWidth:2.5,style:{color:`var(--accent)`,flexShrink:0,marginTop:2}}),(0,f.jsx)(`span`,{style:{fontSize:`0.83rem`,color:`var(--text-muted)`},children:e})]},t))})]}),t?(0,f.jsx)(Au,{offer:t,serviceId:n,isDemo:r,onGoBilling:i,onGoSupport:a}):(0,f.jsx)(`div`,{style:mu,children:(0,f.jsxs)(`p`,{style:{fontSize:`0.83rem`,color:`var(--text-muted)`,margin:0},children:[`Get in touch and we'll sort out `,Gl[e.min]||e.min,` for you.`]})})]})}var Mu=()=>({rule_name:``,active:!0,rules:[{field:`path`,comparison:`contains`,field_value:``}],rule_action:{action:`deny`,action_value:null}});function Nu(e,t,n){let r=String(e.rule_name||``).trim();if(!r)return`Give the rule a name.`;if(r.length>80)return`Rule names are limited to 80 characters.`;if(t.some((e,t)=>t!==n&&String(e.rule_name||``).trim().toLowerCase()===r.toLowerCase()))return`You already have a rule with that name.`;if(!e.rules?.length)return`Add at least one condition.`;if(e.rules.length>pu)return`A rule can have at most ${pu} conditions.`;for(let t of e.rules){if(!au[t.field])return`Pick a field for every condition.`;if(!ou[t.comparison])return`Pick a comparison for every condition.`;let e=String(t.field_value??``).trim();if(!e)return`Every condition needs a value.`;if(e.length>512)return`Condition values are limited to 512 characters.`;if(du.has(t.comparison)&&!/^-?\d+(\.\d+)?$/.test(e))return`"${su[t.comparison]}" needs a number.`}let i=e.rule_action?.action;if(!cu[i])return`Pick an action.`;if(i===`redirect`){let t=String(e.rule_action.action_value??``).trim();if(!t)return`A redirect needs a destination.`;if(!/^(\/|https:\/\/)/.test(t))return`The redirect must start with / or https://`;if(t.length>500)return`The redirect destination is too long.`}if(uu.has(i)){let t=Number(e.rule_action.action_value);if(!Number.isInteger(t)||t<1||t>1e5)return`The rate limit must be a whole number between 1 and 100000.`}return null}function Pu({draft:e,all:t,index:n,onSave:r,onClose:i}){let[a,o]=(0,l.useState)(e),[s,c]=(0,l.useState)(null),u=a.rule_action?.action,d=e=>{o(t=>({...t,...e})),c(null)},p=(e,t)=>d({rules:a.rules.map((n,r)=>r===e?{...n,...t}:n)}),m={padding:`0.4rem 0.55rem`,borderRadius:7,border:`1px solid var(--border)`,background:`var(--bg-elevated)`,color:`var(--text-primary)`,fontSize:`0.8125rem`,width:`100%`},h={fontSize:`0.8125rem`,color:`var(--text-faint)`,marginBottom:`0.3rem`,display:`block`};function g(){let e={...a,rule_name:String(a.rule_name||``).trim(),rules:a.rules.map(e=>({...e,field_value:String(e.field_value??``).trim()})),rule_action:{action:u,action_value:uu.has(u)?Number(a.rule_action.action_value):u===`redirect`?String(a.rule_action.action_value??``).trim():null}},i=Nu(e,t,n);if(i)return c(i);r(e)}return(0,f.jsx)(`div`,{style:{position:`fixed`,inset:0,background:`rgba(0,0,0,0.55)`,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`1rem`,zIndex:60},onClick:i,children:(0,f.jsxs)(`div`,{onClick:e=>e.stopPropagation(),style:{background:`var(--bg-surface)`,border:`1px solid var(--border)`,borderRadius:14,padding:`1.5rem`,width:`100%`,maxWidth:560,maxHeight:`85vh`,overflowY:`auto`},children:[(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:`1rem`},children:[(0,f.jsx)(`h2`,{style:{fontSize:`1.05rem`,fontWeight:700,color:`var(--text-primary)`,margin:0},children:n<0?`New rule`:`Edit rule`}),(0,f.jsx)(`button`,{onClick:i,style:{background:`none`,border:`none`,cursor:`pointer`,color:`var(--text-muted)`},children:(0,f.jsx)(pl,{size:18})})]}),s&&(0,f.jsxs)(`div`,{className:`alert-error`,style:{marginBottom:`0.9rem`},children:[(0,f.jsx)(Y,{size:15}),s]}),(0,f.jsxs)(`div`,{style:{marginBottom:`1rem`},children:[(0,f.jsx)(`label`,{style:h,children:`Rule name`}),(0,f.jsx)(`input`,{value:a.rule_name,maxLength:80,placeholder:`Rate-limit login page`,onChange:e=>d({rule_name:e.target.value}),style:m})]}),(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,padding:`0.5rem 0`,borderTop:`1px solid var(--border)`,borderBottom:`1px solid var(--border)`,marginBottom:`1rem`},children:[(0,f.jsx)(`span`,{style:{fontSize:`0.83rem`,color:`var(--text-primary)`},children:`Rule is active`}),(0,f.jsx)(Eu,{on:a.active!==!1,onClick:()=>d({active:a.active===!1})})]}),(0,f.jsx)(`p`,{style:hu,children:`When`}),(0,f.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`0.5rem`,marginBottom:`0.75rem`},children:a.rules.map((e,t)=>(0,f.jsxs)(`div`,{children:[t>0&&(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,fontWeight:700,color:`var(--text-faint)`,marginBottom:`0.3rem`},children:`AND`}),(0,f.jsxs)(`div`,{style:{display:`flex`,gap:`0.35rem`,alignItems:`center`},children:[(0,f.jsx)(`select`,{value:e.field,onChange:e=>p(t,{field:e.target.value}),style:{...m,width:`auto`,flex:`1 1 30%`,cursor:`pointer`},children:Object.entries(au).map(([e,t])=>(0,f.jsx)(`option`,{value:e,children:t},e))}),(0,f.jsx)(`select`,{value:e.comparison,onChange:e=>p(t,{comparison:e.target.value}),style:{...m,width:`auto`,flex:`1 1 30%`,cursor:`pointer`},children:Object.entries(su).map(([e,t])=>(0,f.jsx)(`option`,{value:e,children:t},e))}),(0,f.jsx)(`input`,{value:e.field_value,maxLength:512,placeholder:`value`,onChange:e=>p(t,{field_value:e.target.value}),style:{...m,flex:`1 1 40%`}}),a.rules.length>1&&(0,f.jsx)(`button`,{onClick:()=>
106d({rules:a.rules.filter((e,n)=>n!==t)}),title:`Remove condition`,style:{background:`none`,border:`none`,cursor:`pointer`,color:`var(--text-faint)`,padding:`0.2rem`,flexShrink:0},children:(0,f.jsx)(pl,{size:14})})]})]},t))}),a.rules.length<pu&&(0,f.jsxs)(`button`,{onClick:()=>d({rules:[...a.rules,{field:`path`,comparison:`contains`,field_value:``}]}),style:{display:`flex`,alignItems:`center`,gap:`0.3rem`,background:`none`,border:`none`,cursor:`pointer`,color:`var(--accent)`,fontSize:`0.8125rem`,fontWeight:600,padding:0,marginBottom:`1.1rem`},children:[(0,f.jsx)(Vc,{size:13,strokeWidth:2.5}),` Add condition`]}),(0,f.jsx)(`p`,{style:hu,children:`Then`}),(0,f.jsxs)(`div`,{style:{display:`flex`,gap:`0.4rem`,marginBottom:`1.25rem`,flexWrap:`wrap`},children:[(0,f.jsx)(`select`,{value:u,onChange:e=>d({rule_action:{action:e.target.value,action_value:null}}),style:{...m,width:`auto`,flex:`1 1 45%`,cursor:`pointer`},children:Object.entries(cu).map(([e,t])=>(0,f.jsx)(`option`,{value:e,children:t},e))}),(u===`redirect`||uu.has(u))&&(0,f.jsx)(`input`,{value:a.rule_action.action_value??``,type:uu.has(u)?`number`:`text`,placeholder:u===`redirect`?`/not-found`:`5`,onChange:e=>d({rule_action:{...a.rule_action,action_value:e.target.value}}),style:{...m,flex:`1 1 45%`}})]}),(0,f.jsxs)(`div`,{style:{display:`flex`,gap:`0.5rem`,justifyContent:`flex-end`},children:[(0,f.jsx)(`button`,{className:`btn-secondary`,onClick:i,children:`Cancel`}),(0,f.jsx)(`button`,{onClick:g,style:{padding:`0.42rem 0.95rem`,borderRadius:8,border:`none`,background:`var(--btn-solid)`,color:`var(--btn-solid-text)`,fontSize:`0.8125rem`,fontWeight:600,cursor:`pointer`},children:`Save rule`})]})]})})}function Fu({crs:e,setCrs:t,onDirty:n}){let[r,i]=(0,l.useState)(null),[a,o]=(0,l.useState)(null),s=e=>{t(e),n()};return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:`0.75rem`},children:[(0,f.jsxs)(`span`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`},children:[e.length,` rule`,e.length===1?``:`s`]}),(0,f.jsxs)(`button`,{disabled:e.length>=fu,onClick:()=>i({index:-1,draft:Mu()}),title:e.length>=fu?`You can have at most ${fu} rules`:void 0,style:{display:`flex`,alignItems:`center`,gap:`0.35rem`,padding:`0.4rem 0.85rem`,borderRadius:8,border:`none`,background:`var(--btn-solid)`,color:`var(--btn-solid-text)`,fontSize:`0.8125rem`,fontWeight:600,cursor:e.length>=fu?`not-allowed`:`pointer`,opacity:e.length>=fu?.65:1},children:[(0,f.jsx)(Vc,{size:13,strokeWidth:2.5}),` Add Rule`]})]}),e.length===0?(0,f.jsx)(`div`,{style:mu,children:(0,f.jsx)(`p`,{style:{fontSize:`0.82rem`,color:`var(--text-muted)`,margin:0},children:`No custom rules yet â add one to match on paths, IPs, countries, networks or headers.`})}):(0,f.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`0.55rem`},children:e.map((t,n)=>{let r=t.rule_action?.action;return(0,f.jsxs)(`div`,{style:{...mu,marginBottom:0,padding:`0.85rem 1rem`},children:[(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`0.55rem`,marginBottom:`0.5rem`},children:[(0,f.jsx)(`span`,{style:{fontSize:`0.8125rem`,fontWeight:700,padding:`0.13rem 0.48rem`,borderRadius:5,background:yu[r]||`var(--bg-elevated)`,color:vu[r]||`var(--text-muted)`,flexShrink:0,textTransform:`uppercase`,letterSpacing:`0.05em`},children:lu[r]||r}),(0,f.jsx)(`span`,{style:{fontSize:`0.87rem`,fontWeight:600,color:`var(--text-primary)`,flex:1,minWidth:0},children:t.rule_name}),(0,f.jsx)(Eu,{size:`sm`,on:t.active!==!1,onClick:()=>s(e.map((e,t)=>t===n?{...e,active:e.active===!1}:e))}),(0,f.jsx)(`button`,{onClick:()=>i({index:n,draft:JSON.parse(JSON.stringify(t))}),title:`Edit rule`,style:{background:`none`,border:`none`,cursor:`pointer`,color:`var(--text-faint)`,padding:`0.15rem`,flexShrink:0},children:(0,f.jsx)(Rc,{size:14})}),a===n?(0,f.jsxs)(`span`,{style:{display:`flex`,gap:`0.3rem`,alignItems:`center`,flexShrink:0},children:[(0,f.jsx)(`button`,{onClick:()=>{s(e.filter((e,t)=>t!==n)),o(null)},style:{background:`none`,border:`none`,cursor:`pointer`,color:`#f87171`,fontSize:`0.8125rem`,fontWeight:600,padding:0},children:`Delete?`}),(0,f.jsx)(`button`,{onClick:()=>o(null),style:{background:`none`,border:`none`,cursor:`pointer`,color:`var(--text-faint)`,padding:0},children:(0,f.jsx)(pl,{size:13})})]}):(0,f.jsx)(`button`,{onClick:()=>o(n),title:`Delete rule`,style:{background:`none`,border:`none`,cursor:`pointer`,color:`var(--text-faint)`,padding:`0.15rem`,flexShrink:0},children:(0,f.jsx)(rl,{size:14})})]}),(0,f.jsx)(`div`,{style:{padding:`0.4rem 0.5rem`,borderRadius:7,background:`var(--bg-elevated)`,marginBottom:t.rule_action?.action_value==null?0:`0.4rem`},children:(t.rules||[]).map((e,t)=>(0,f.jsxs)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`,display:`flex`,alignItems:`center`,gap:`0.3rem`,flexWrap:`wrap`,padding:`0.1rem 0`},children:[t>0&&(0,f.jsx)(`span`,{style:{fontSize:`0.8125rem`,color:`var(--text-faint)`,fontWeight:700},children:`AND`}),(0,f.jsx)(`span`,{style:{color:`var(--text-primary)`,fontWeight:500},children:au[e.field]||e.field}),(0,f.jsx)(`span`,{style:{color:`var(--text-faint)`,fontFamily:`monospace`,fontSize:`0.8125rem`},children:ou[e.comparison]||e.comparison}),(0,f.jsx)(`span`,{style:{fontFamily:`monospace`,color:`#60a5fa`,background:`#60a5fa10`,padding:`0.04rem 0.28rem`,borderRadius:4},children:e.field_value})]},t))}),t.rule_action?.action_value!=null&&(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-faint)`},children:r===`redirect`?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`span`,{style:{color:`var(--text-muted)`},children:`Redirect â`}),` `,t.rule_action.action_value]}):r===`rpm`?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`span`,{style:{color:`var(--text-muted)`},children:`Limit:`}),` `,t.rule_action.action_value,` req/min`]}):r===`rph`?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`span`,{style:{color:`var(--text-muted)`},children:`Limit:`}),` `,t.rule_action.action_value,` req/hr`]}):r===`rp24`?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`span`,{style:{color:`var(--text-muted)`},children:`Limit:`}),` `,t.rule_action.action_value,` req/24h`]}):String(t.rule_action.action_value)})]},n)})}),r&&(0,f.jsx)(Pu,{draft:r.draft,all:e,index:r.index,onClose:()=>i(null),onSave:t=>{s(r.index<0?[...e,t]:e.map((e,n)=>n===r.index?t:e)),i(null)}})]})}function Iu({rules:e,setRules:t,stats:n,onDirty:r}){return(0,f.jsx)(f.Fragment,{children:(0,f.jsxs)(`div`,{style:mu,children:[(0,f.jsx)(`p`,{style:hu,children:`Visitor Category Rules`}),(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-faint)`,marginBottom:`0.75rem`,marginTop:`-0.4rem`},children:`Control how each visitor type is handled by the GateKeeper`}),(0,f.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:0},children:Object.entries(Yl).map(([i,a],o,s)=>{let c=e[i]||`grant`,l=n?.requests_passed?.[i]||0,u=n?.requests_blocked?.[i]||0;return(0,f.jsx)(`div`,{style:{padding:`0.85rem 0`,borderBottom:o<s.length-1?`1px solid var(--border)`:`none`},children:(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:`0.75rem`},children:[(0,f.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,f.jsx)(`div`,{style:{fontSize:`0.84rem`,fontWeight:600,color:`var(--text-primary)`,marginBottom:2},children:a.label}),(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`,lineHeight:1.4},children:a.desc}),(l>0||u>0)&&(0,f.jsxs)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-faint)`,marginTop:4,display:`flex`,gap:`0.6rem`},children:[l>0&&(0,f.jsxs)(`span`,{style:{color:`#34d399`}
106,children:[l.toLocaleString(),` passed`]}),u>0&&(0,f.jsxs)(`span`,{style:{color:`#f87171`},children:[u.toLocaleString(),` blocked`]})]})]}),(0,f.jsx)(`div`,{style:{display:`flex`,borderRadius:8,overflow:`hidden`,border:`1px solid var(--border)`,flexShrink:0},children:[`grant`,`deny`,`captcha`].map(e=>(0,f.jsx)(`button`,{onClick:()=>{t(t=>({...t,[i]:e})),r()},style:{padding:`0.32rem 0.6rem`,fontSize:`0.8125rem`,fontWeight:600,border:`none`,cursor:`pointer`,textTransform:`capitalize`,transition:`all 0.15s`,background:c===e?_u[e]:`var(--bg-elevated)`,color:c===e?gu[e]:`var(--text-faint)`,borderRight:e===`captcha`?`none`:`1px solid var(--border)`},children:e},e))})]})},i)})})]})})}function Lu({field:e,label:t,desc:n,lb:r,setLb:i,onDirty:a,last:o}){return(0,f.jsx)(`div`,{style:{padding:`0.85rem 0`,borderBottom:o?`none`:`1px solid var(--border)`},children:(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:`0.75rem`},children:[(0,f.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,f.jsx)(`div`,{style:{fontSize:`0.84rem`,fontWeight:600,color:`var(--text-primary)`,marginBottom:2},children:t}),(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`,lineHeight:1.4},children:n})]}),(0,f.jsx)(Eu,{on:!!r[e],onClick:()=>{i(t=>({...t,[e]:!t[e]})),a()}})]})})}var Ru=[[`botguard_protection`,`Bot Filtering`,`Screens every request against the bot filter before it reaches your server. Switch this off and the edge still delivers and caches your site, but nothing is inspected â your visitor category rules and custom rules stop applying.`],[`ddos_protection`,`DDoS Protection`,`Absorbs request floods at the edge so they never reach your hosting. Leave this on: it is what keeps an attack from exhausting your server rather than ours.`],[`ddos_protection_advanced`,`Advanced DDoS (BGP Anycast)`,`Spreads a large attack across the whole Anycast network instead of the single edge location nearest the attacker. Worth enabling if you have been hit by traffic big enough to saturate one point of presence.`],[`force_https`,`Force HTTPS Redirect`,`Redirects any http:// request to https:// at the edge, so a visitor never loads your site over an unencrypted connection.`],[`enable_http3`,`HTTP/3 (QUIC)`,`Serves modern browsers over HTTP/3, which establishes connections faster than HTTP/2 on mobile and lossy networks. Browsers that do not support it fall back on their own, so there is no compatibility risk.`],[`cache_static_files`,`Cache Static Files`,`Holds images, CSS, JavaScript and fonts on the edge servers. Repeat visitors are served straight from the edge, which cuts load time and takes the requests off your hosting entirely.`],[`cache_dynamic_pages`,`Cache Dynamic Pages`,`Also caches your generated HTML. Considerably faster, but only safe when every visitor sees the same page â leave it off if you run logins, carts, checkouts or any personalised content, or visitors will be served each otherâs pages.`],[`upstreams_use_https`,`Upstream Connections via HTTPS`,`Encrypts the leg between the edge and your own server, not just the leg to the visitor. Your hosting must already serve a working certificate on port 443 â turn this on without one and the edge cannot reach your site.`]],zu={letsencrypt:{label:`Letâs Encrypt`,desc:`The default, and the right choice for almost every site. Free certificates, renewed automatically before they expire.`},buypass:{label:`Buypass`,desc:`An alternative free authority. Worth trying if Letâs Encrypt validation keeps failing for your domain.`},custom:{label:`Custom`,desc:`Use a certificate you have supplied yourself â an EV or wildcard certificate you already hold, for instance. Get in touch and we will load it for you.`}},Bu={webhook:!1,issuers:[`letsencrypt`,`custom`]};function Vu({lb:e,setLb:t,onDirty:n,options:r}){let i=r||Bu,a=(i.issuers?.length?i.issuers:Bu.issuers).filter(e=>zu[e]),o=e.certs_issuer||`letsencrypt`,s=e=>i.show?.[e]!==!1,c=Ru.filter(([e])=>s(e));return(0,f.jsxs)(`div`,{style:mu,children:[(0,f.jsx)(`p`,{style:hu,children:`Edge Settings`}),(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-faint)`,marginBottom:`0.75rem`,marginTop:`-0.4rem`},children:`How the edge network delivers, caches and shields your site`}),c.map(([r,i,a],o,s)=>(0,f.jsx)(Lu,{field:r,label:i,desc:a,lb:e,setLb:t,onDirty:n,last:o===s.length-1},r)),s(`certs_issuer`)&&(0,f.jsxs)(`div`,{style:{paddingTop:`0.85rem`,borderTop:c.length?`1px solid var(--border)`:`none`,marginTop:c.length?`0.85rem`:0},children:[(0,f.jsx)(`div`,{style:{fontSize:`0.84rem`,fontWeight:600,color:`var(--text-primary)`,marginBottom:2},children:`Certificate issuer`}),(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`,lineHeight:1.4,marginBottom:`0.55rem`},children:`Who issues the TLS certificate the edge presents to your visitors. This is the certificate on the padlock â it is separate from any certificate on your own hosting.`}),(0,f.jsx)(`div`,{style:{display:`flex`,gap:`0.4rem`,flexWrap:`wrap`},children:a.map(e=>(0,f.jsx)(`button`,{onClick:()=>{t(t=>({...t,certs_issuer:e})),n()},style:{padding:`0.3rem 0.75rem`,borderRadius:7,border:`1px solid var(--border)`,fontSize:`0.8125rem`,fontWeight:o===e?600:400,cursor:`pointer`,background:o===e?`var(--accent)`:`var(--bg-elevated)`,color:o===e?`#fff`:`var(--text-muted)`},children:zu[e].label},e))}),(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-faint)`,lineHeight:1.4,marginTop:`0.5rem`},children:zu[o]?.desc||``})]}),c.length===0&&!s(`certs_issuer`)&&!i.webhook&&(0,f.jsx)(`p`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`,margin:0},children:`No edge settings are available for self-service on this site. Get in touch and we'll change them for you.`}),i.webhook&&(0,f.jsxs)(`div`,{style:{paddingTop:`0.85rem`,borderTop:`1px solid var(--border)`,marginTop:`0.85rem`},children:[(0,f.jsx)(`div`,{style:{fontSize:`0.84rem`,fontWeight:600,color:`var(--text-primary)`,marginBottom:2},children:`Webhook URL`}),(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`,lineHeight:1.4,marginBottom:`0.45rem`},children:`An https:// endpoint we post security events to as they happen, for feeding your own alerting or logging. Ask support if you would like one set up.`}),(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,fontFamily:`monospace`,color:e.webhook?`var(--text-primary)`:`var(--text-faint)`,padding:`0.4rem 0.6rem`,borderRadius:6,background:`var(--bg-elevated)`,border:`1px solid var(--border)`},children:e.webhook||`Not configured`})]})]})}function Hu({events:e,loading:t,error:n,page:r,hasMore:i,windowLabel:a,scanCapped:o,query:s,onQuery:c,onRefresh:u,isMonitor:d}){let p=s.category||``,m=s.mitigation||``,h=s.q||``,g=e||[],[_,v]=(0,l.useState)(h);(0,l.useEffect)(()=>{v(h)},[h]),(0,l.useEffect)(()=>
106{if(_.trim()===h.trim())return;let e=setTimeout(()=>c({q:_.trim(),page:0}),600);return()=>clearTimeout(e)},[_]);let y={padding:`0.35rem 0.6rem`,borderRadius:7,border:`1px solid var(--border)`,background:`var(--bg-elevated)`,color:`var(--text-primary)`,fontSize:`0.8125rem`,cursor:`pointer`,flex:1},b=e=>({padding:`0.3rem 0.7rem`,borderRadius:7,border:`1px solid var(--border)`,fontSize:`0.8125rem`,background:`var(--bg-elevated)`,color:e?`var(--text-primary)`:`var(--text-faint)`,cursor:e?`pointer`:`default`,opacity:e?1:.45}),x=g.length?r*50+1:0,S=r*50+g.length;return(0,f.jsxs)(f.Fragment,{children:[d&&(0,f.jsx)(`div`,{style:{...mu,padding:`0.65rem 0.9rem`,marginBottom:`0.75rem`},children:(0,f.jsxs)(`p`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`,margin:0,lineHeight:1.5},children:[`Every request is shown as `,(0,f.jsx)(`strong`,{style:{color:`var(--text-primary)`},children:`granted`}),` because Monitoring watches without blocking. The category on each row is what we identified the visitor as â that is what would be acted on with Bot Protection.`]})}),(0,f.jsxs)(`div`,{style:{position:`relative`,marginBottom:`0.5rem`},children:[(0,f.jsx)(qc,{size:14,style:{position:`absolute`,left:`0.65rem`,top:`50%`,transform:`translateY(-50%)`,color:`var(--text-faint)`,pointerEvents:`none`}}),(0,f.jsx)(`input`,{type:`search`,value:_,placeholder:`Search by URL, IP, country, user agentâ¦`,onChange:e=>v(e.target.value),onKeyDown:e=>{e.key===`Enter`&&_.trim()!==h.trim()&&c({q:_.trim(),page:0})},style:{width:`100%`,boxSizing:`border-box`,padding:`0.45rem 0.7rem 0.45rem 2rem`,borderRadius:7,border:`1px solid var(--border)`,background:`var(--bg-elevated)`,color:`var(--text-primary)`,fontSize:`0.8125rem`}})]}),(0,f.jsxs)(`div`,{style:{display:`flex`,gap:`0.5rem`,marginBottom:`0.75rem`,flexWrap:`wrap`,alignItems:`center`},children:[(0,f.jsxs)(`select`,{value:p,disabled:t,onChange:e=>c({category:e.target.value,page:0}),style:{...y,minWidth:130},children:[(0,f.jsx)(`option`,{value:``,children:`All categories`}),Object.entries(Yl).map(([e,t])=>(0,f.jsx)(`option`,{value:e,children:t.label},e))]}),(0,f.jsxs)(`select`,{value:m,disabled:t,onChange:e=>c({mitigation:e.target.value,page:0}),style:{...y,minWidth:110},children:[(0,f.jsx)(`option`,{value:``,children:`All actions`}),[`grant`,`deny`,`captcha`,`redirect`,`return_fake_data`].map(e=>(0,f.jsx)(`option`,{value:e,children:e.replace(/_/g,` `)},e))]}),(0,f.jsxs)(`button`,{className:`btn-secondary`,style:{flexShrink:0},onClick:u,disabled:t,children:[(0,f.jsx)(Gc,{size:12}),` Refresh`]})]}),a&&(0,f.jsxs)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-faint)`,marginBottom:`0.6rem`},children:[`Showing the last `,a,g.length>0&&(0,f.jsxs)(f.Fragment,{children:[` · events `,x.toLocaleString(),`â`,S.toLocaleString()]}),d&&(0,f.jsx)(f.Fragment,{children:` · Bot Protection keeps 30 days`})]}),t?(0,f.jsx)(`div`,{style:{textAlign:`center`,padding:`2rem`},children:(0,f.jsx)(X,{size:20,style:{color:`var(--text-muted)`,animation:`spin 1s linear infinite`}})}):n?(0,f.jsx)(`div`,{style:mu,children:(0,f.jsx)(`p`,{style:{fontSize:`0.82rem`,color:`#dc2626`,margin:0},children:`Could not load the event log â please try again shortly.`})}):e===null?(0,f.jsx)(`div`,{style:mu,children:(0,f.jsx)(`p`,{style:{fontSize:`0.82rem`,color:`var(--text-muted)`,margin:0},children:`Click Refresh to load events.`})}):g.length===0?(0,f.jsx)(`div`,{style:mu,children:(0,f.jsx)(`p`,{style:{fontSize:`0.82rem`,color:`var(--text-muted)`,margin:0},children:o?`No matches in the most recent 1,000 events. Try narrowing the filter, or check back over a shorter period.`:p||m||h?`No events match that filter in the last ${a||`window`}.`:`No events recorded in the last ${a||`window`}.`})}):(0,f.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`0.4rem`},children:g.map((e,t)=>{let n=e.mitigation||`grant`,r=bu[n]||`var(--text-faint)`,i=xu[n]||`var(--bg-elevated)`,a=Xl[e.category]||`#94a3b8`,o=(e.country_provider||``).split(`,`)[0].trim(),s=e.url?(()=>{try{let t=new URL(e.url,`https://x`);return t.pathname+(t.search||``)}catch{return e.url}})():`â`,c=e.date_time?new Date(e.date_time).toLocaleTimeString(`en-AU`,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`}):`â`;return(0,f.jsxs)(`div`,{style:{padding:`0.6rem 0.8rem`,borderRadius:9,background:`var(--bg-surface)`,border:`1px solid var(--border)`},children:[(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`0.45rem`,marginBottom:`0.28rem`,flexWrap:`wrap`},children:[(0,f.jsx)(`span`,{style:{fontSize:`0.8125rem`,fontWeight:700,padding:`0.11rem 0.42rem`,borderRadius:5,background:i,color:r,textTransform:`capitalize`,flexShrink:0},children:n.replace(/_/g,` `)}),(0,f.jsx)(`span`,{style:{fontSize:`0.8125rem`,fontWeight:600,padding:`0.09rem 0.38rem`,borderRadius:5,background:a+`18`,color:a,flexShrink:0},children:Yl[e.category]?.label||e.category||`â`}),(0,f.jsx)(`span`,{style:{fontSize:`0.8125rem`,color:`var(--text-faint)`,marginLeft:`auto`,flexShrink:0},children:c})]}),(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,fontFamily:`monospace`,color:`var(--text-primary)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,marginBottom:`0.18rem`},children:s}),(0,f.jsxs)(`div`,{style:{display:`flex`,gap:`0.65rem`,flexWrap:`wrap`},children:[(0,f.jsx)(`span`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`,fontFamily:`monospace`,flexShrink:0},children:e.visitor_ip||`â`}),o&&(0,f.jsx)(`span`,{style:{fontSize:`0.8125rem`,color:`var(--text-faint)`,flexShrink:0},children:o}),(0,f.jsx)(`span`,{style:{fontSize:`0.8125rem`,color:`var(--text-faint)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,flex:1,minWidth:0},children:e.user_agent||`â`})]})]},t)})}),(r>0||i)&&(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`0.5rem`,marginTop:`0.75rem`},children:[(0,f.jsx)(`button`,{onClick:()=>r>0&&c({page:r-1}),disabled:t||r===0,style:b(r>0&&!t),children:`â Newer`}),(0,f.jsxs)(`span`,{style:{fontSize:`0.8125rem`,color:`var(--text-faint)`},children:[`Page `,r+1]}),(0,f.jsx)(`button`,{onClick:()=>i&&c({page:r+1}),disabled:t||!i,style:b(i&&!t),children:`Older â`})]}),o&&g.length>0&&(0,f.jsx)(`p`,{style:{fontSize:`0.8125rem`,color:`var(--text-faint)`,marginTop:`0.6rem`,marginBottom:0},children:`Filtered across the most recent 1,000 events.`})]})}var Uu={protected:{label:`Routed through Bot Protection`,color:`#34d399`},origin:{label:`Points straight at your server â bypasses protection`,color:`#f87171`},partial:{label:`Only some records point at Bot Protection`,color:`#fbbf24`},elsewhere:{label:`Not pointed at Bot Protection`,color:`#fbbf24`},none:{label:`No A record found`,color:`#fbbf24`},error:{label:`Couldn't look this up`,color:`var(--text-faint)`}};function Wu({check:e,serviceId:t,isDemo:n}){let[r,i]=(0,l.useState)(e);(0,l.useEffect)(()=>{i(e)},[e]);let a=r.hosts||[],o=r.edge_ips||[],s=r.origin_ips||[],[c,u]=(0,l.useState)(!1),[d,p]=(0,l.useState)(``),[m,h]=(0,l.useState)(!1),[g,_]=(0,l.useState)(null),v=()=>{p(s.join(`, `)),_(null),u(!0)},y=()=>{let e=d.split(/[\s,]+/).map(e=>
106e.trim()).filter(Boolean);if(!e.length){_(`Enter at least one IP address.`);return}if(n){i(t=>({...t,origin_ips:e})),u(!1);return}h(!0),_(null),Z(`/api/portal/services/${t}/botguard/origin`,{method:`PUT`,body:JSON.stringify({ips:e})}).then(t=>{if(!t.ok){_(t.error||`Couldn't save the server IP.`);return}i(t.dns_check||(n=>({...n,origin_ips:t.origin_ips||e}))),u(!1)}).catch(e=>_(e.message||`Couldn't save the server IP.`)).finally(()=>h(!1))},b=r.ok?`#34d399`:a.some(e=>e.status===`origin`)?`#f87171`:`#fbbf24`,x={padding:`0.75rem 0.85rem`,borderRadius:10,background:`var(--bg-elevated)`,border:`1px solid var(--border)`,minWidth:0},S={fontSize:`0.8125rem`,fontWeight:600,color:`var(--text-primary)`},C=s.length?`#34d399`:`#f87171`;return(0,f.jsxs)(`div`,{style:{marginTop:`0.85rem`,paddingTop:`0.85rem`,borderTop:`1px solid var(--border)`,display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(240px, 1fr))`,gap:`0.6rem`},children:[(0,f.jsxs)(`div`,{style:x,children:[(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`0.45rem`,marginBottom:`0.55rem`,flexWrap:`wrap`},children:[(0,f.jsx)(`span`,{style:S,children:`DNS A records`}),(0,f.jsx)(`span`,{style:{fontSize:`0.8125rem`,fontWeight:700,padding:`0.1rem 0.4rem`,borderRadius:4,background:`${b}18`,color:b},children:r.ok?`Pointed at Bot Protection`:`Needs attention`})]}),(0,f.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`0.5rem`},children:a.map(e=>{let t=Uu[e.status]||Uu.error,n=[...e.a||[],...e.aaaa||[]];return(0,f.jsxs)(`div`,{style:{fontSize:`0.8125rem`},children:[(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`0.45rem`,flexWrap:`wrap`},children:[(0,f.jsx)(`span`,{style:{width:8,height:8,borderRadius:`50%`,background:t.color,display:`inline-block`,flexShrink:0}}),(0,f.jsx)(`span`,{style:{fontWeight:600,color:`var(--text-primary)`,wordBreak:`break-all`},children:e.host}),(0,f.jsx)(`span`,{style:{color:`var(--text-muted)`,fontFamily:`ui-monospace, monospace`,wordBreak:`break-all`},children:n.length?n.join(`, `):`â`})]}),(0,f.jsx)(`div`,{style:{color:t.color,marginLeft:`calc(8px + 0.45rem)`,marginTop:1},children:t.label})]},e.host)})}),!r.ok&&o.length>0&&(0,f.jsxs)(`div`,{style:{marginTop:`0.65rem`,fontSize:`0.8125rem`,color:`var(--text-muted)`,lineHeight:1.55},children:[`Point the A record`,a.length===1?``:`s`,` for `,a.map(e=>e.host).join(` and `),` at`,` `,(0,f.jsx)(`strong`,{style:{fontFamily:`ui-monospace, monospace`,color:`var(--text-primary)`},children:o.join(`, `)}),a.some(e=>(e.aaaa||[]).some(e=>!o.includes(e)))&&`, and remove any AAAA (IPv6) records`,` `,`â until then, visitors reach your site without going through Bot Protection. DNS changes can take a few hours to show here.`]})]}),(0,f.jsxs)(`div`,{style:x,children:[(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`0.45rem`,marginBottom:`0.55rem`,flexWrap:`wrap`},children:[(0,f.jsx)(`span`,{style:S,children:`Web server`}),(0,f.jsx)(`span`,{style:{fontSize:`0.8125rem`,fontWeight:700,padding:`0.1rem 0.4rem`,borderRadius:4,background:`${C}18`,color:C},children:s.length?`Set`:`Not set`}),!c&&(0,f.jsxs)(`button`,{onClick:v,title:`Change the web server IP`,style:{marginLeft:`auto`,display:`inline-flex`,alignItems:`center`,gap:4,padding:`0.15rem 0.45rem`,borderRadius:6,border:`1px solid var(--border)`,background:`var(--bg-surface)`,color:`var(--text-muted)`,fontSize:`0.8125rem`,cursor:`pointer`},children:[(0,f.jsx)(Rc,{size:11}),` `,s.length?`Edit`:`Add`]})]}),(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-faint)`,marginBottom:`0.35rem`},children:`Routing traffic to`}),c?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`div`,{style:{display:`flex`,gap:`0.4rem`,flexWrap:`wrap`},children:[(0,f.jsx)(`input`,{value:d,autoFocus:!0,disabled:m,placeholder:`e.g. 203.0.113.10`,onChange:e=>p(e.target.value),onKeyDown:e=>{e.key===`Enter`&&y(),e.key===`Escape`&&u(!1)},style:{flex:`1 1 150px`,minWidth:0,padding:`0.3rem 0.55rem`,borderRadius:7,border:`1px solid var(--border)`,background:`var(--bg-surface)`,color:`var(--text-primary)`,fontSize:`0.8125rem`,fontFamily:`ui-monospace, monospace`}}),(0,f.jsxs)(`button`,{className:`btn-primary`,style:{flexShrink:0},onClick:y,disabled:m,children:[m?(0,f.jsx)(X,{size:12,style:{animation:`spin 1s linear infinite`}}):(0,f.jsx)($s,{size:12}),` Save`]}),(0,f.jsx)(`button`,{className:`btn-secondary`,style:{flexShrink:0},onClick:()=>u(!1),disabled:m,children:`Cancel`})]}),!g&&(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-faint)`,marginTop:`0.45rem`,lineHeight:1.5},children:`Your web server's public IP â where we send visitors once they pass the checks. Separate more than one with commas.`})]}):s.length?(0,f.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`0.2rem`},children:s.map(e=>(0,f.jsx)(`span`,{style:{fontSize:`0.9rem`,fontWeight:600,color:`var(--text-primary)`,fontFamily:`ui-monospace, monospace`,wordBreak:`break-all`},children:e},e))}):(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,color:`#f87171`,lineHeight:1.5},children:`No web server IP set â add one before pointing DNS here, or visitors will have nowhere to go.`}),g&&(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,color:`#f87171`,marginTop:`0.45rem`},children:g})]})]})}function Gu({data:e,tier:t,website:n,stats:r,lb:i,plans:a,serviceId:o,isDemo:s,statWindow:c,onStatWindow:l,statLoading:u,statError:d,onGoBilling:p,onGoSupport:m}){let h=t===`monitor`,g=(ql.find(e=>e.key===c)||ql[0]).sub,_=r?Object.values(r.requests_passed||{}).reduce((e,t)=>
106e+t,0):0,v=r?Object.values(r.requests_blocked||{}).reduce((e,t)=>e+t,0):0,y=r?.requests_total||_+v||0,b=y>0?Math.round(_/y*100):0,x=y>0?Math.round(v/y*100):0,S=ru(r),C=S.classes.filter(e=>e.key!==`other`||e.count>0),w=(n?.tag||n?.tags||[]).filter(e=>!/^crm:/i.test(String(e))),T=n?.status===`online`,E=h?`#60a5fa`:T?`#34d399`:`#fbbf24`;return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`div`,{style:mu,children:[(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`1rem`},children:[(0,f.jsx)(`div`,{style:{width:52,height:52,borderRadius:14,background:`${E}18`,border:`1.5px solid ${E}40`,display:`flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0},children:(0,f.jsx)(Zc,{size:26,style:{color:E}})}),(0,f.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-faint)`,marginBottom:2},children:`Protection Status`}),(0,f.jsxs)(`div`,{style:{fontSize:`1rem`,fontWeight:700,color:`var(--text-primary)`,display:`flex`,alignItems:`center`,gap:`0.5rem`,flexWrap:`wrap`},children:[(0,f.jsx)(`span`,{style:{color:E,textTransform:`capitalize`},children:h?`Monitoring only`:T?`Active`:n?.status||`Inactive`}),!h&&i.ddos_protection_advanced&&(0,f.jsx)(`span`,{style:{fontSize:`0.8125rem`,fontWeight:700,padding:`0.1rem 0.4rem`,borderRadius:4,background:`#a78bfa18`,color:`#a78bfa`},children:`Advanced DDoS`}),!h&&i.ddos_protection&&!i.ddos_protection_advanced&&(0,f.jsx)(`span`,{style:{fontSize:`0.8125rem`,fontWeight:700,padding:`0.1rem 0.4rem`,borderRadius:4,background:`#60a5fa18`,color:`#60a5fa`},children:`DDoS Shield`})]}),(0,f.jsxs)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`,marginTop:3},children:[e.domain||n?.domain,e.protected_since&&(0,f.jsxs)(`span`,{style:{color:`var(--text-faint)`,marginLeft:`0.5rem`},children:[`· Watching since `,Q(e.protected_since)]})]})]})]}),h&&(0,f.jsx)(`div`,{style:{marginTop:`0.85rem`,paddingTop:`0.85rem`,borderTop:`1px solid var(--border)`,fontSize:`0.8125rem`,color:`var(--text-muted)`,lineHeight:1.55},children:`We're watching this site's traffic and telling you what we see â nothing is being blocked yet.`}),e.dns_check&&(0,f.jsx)(Wu,{check:e.dns_check,serviceId:o,isDemo:s}),w.length>0&&(0,f.jsx)(`div`,{style:{marginTop:`0.9rem`,paddingTop:`0.9rem`,borderTop:`1px solid var(--border)`,display:`flex`,flexWrap:`wrap`,gap:`0.4rem`},children:w.map(e=>(0,f.jsx)(`span`,{style:{fontSize:`0.8125rem`,padding:`0.11rem 0.4rem`,borderRadius:5,background:`#60a5fa14`,border:`1px solid #60a5fa25`,color:`#60a5fa`,textTransform:`capitalize`},children:e},e))})]}),(0,f.jsx)(ku,{plans:a,serviceId:o,isDemo:s,onGoBilling:p,onGoSupport:m}),(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`0.4rem`,marginBottom:`0.55rem`,flexWrap:`wrap`},children:[(0,f.jsx)(`span`,{style:{fontSize:`0.8125rem`,color:`var(--text-faint)`,marginRight:`0.15rem`},children:`Traffic over the`}),ql.map(e=>(0,f.jsx)(`button`,{onClick:()=>l?.(e.key),disabled:u,style:{padding:`0.22rem 0.6rem`,borderRadius:7,border:`1px solid var(--border)`,fontSize:`0.8125rem`,fontWeight:c===e.key?600:400,cursor:u?`default`:`pointer`,opacity:u&&c!==e.key?.5:1,background:c===e.ke
106y?`var(--accent)`:`var(--bg-elevated)`,color:c===e.key?`#fff`:`var(--text-muted)`},children:e.label},e.key)),u&&(0,f.jsx)(X,{size:12,style:{color:`var(--text-faint)`,animation:`spin 1s linear infinite`}})]}),d&&(0,f.jsx)(`div`,{style:{...mu,padding:`0.6rem 0.8rem`,marginBottom:`0.55rem`},children:(0,f.jsx)(`p`,{style:{fontSize:`0.8125rem`,color:`#f87171`,margin:0},children:`Couldn't load traffic for that period â showing what we last had.`})}),(0,f.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(${h?C.length:3},1fr)`,gap:`0.55rem`,marginBottom:`1rem`},children:(h?C.map(e=>({label:e.label,value:e.count.toLocaleString(),sub:`${iu(e.pct)} of traffic`,color:e.color,bg:`${e.color}10`})):[{label:`Total`,value:y.toLocaleString(),sub:`requests, ${g}`,color:`var(--text-primary)`,bg:`var(--bg-surface)`},{label:`Legit`,value:_.toLocaleString(),sub:`${b}% of traffic`,color:`#34d399`,bg:`#34d39910`},{label:`Blocked`,value:v.toLocaleString(),sub:`${x}% of traffic`,color:`#f87171`,bg:`#f8717110`}]).map(({label:e,value:t,sub:n,color:r,bg:i})=>(0,f.jsxs)(`div`,{style:{padding:`0.8rem 0.5rem`,borderRadius:11,background:i,border:`1px solid var(--border)`,textAlign:`center`},children:[(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-faint)`,marginBottom:5,textTransform:`uppercase`,letterSpacing:`0.07em`},children:e}),(0,f.jsx)(`div`,{style:{fontSize:`1.2rem`,fontWeight:800,color:r,lineHeight:1},children:t}),(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-faint)`,marginTop:3},children:n})]},e))}),r&&(0,f.jsxs)(`div`,{style:{...mu,padding:`0.9rem 1.1rem`,marginBottom:`1rem`},children:[(0,f.jsxs)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-faint)`,marginBottom:`0.5rem`},children:[y.toLocaleString(),` request`,y===1?``:`s`,` · `,g]}),(0,f.jsx)(`div`,{style:{display:`flex`,height:8,borderRadius:999,overflow:`hidden`,marginBottom:`0.45rem`,background:`var(--bg-elevated)`},children:(h?S.classes.filter(e=>e.count>0).map(e=>({k:e.key,w:e.pct,c:e.color})):[{k:`passed`,w:b,c:`#34d399`},{k:`blocked`,w:x,c:`#f87171`}]).map(e=>(0,f.jsx)(`div`,{style:{width:`${e.w}%`,background:e.c}},e.k))}),(0,f.jsx)(`div`,{style:{display:`flex`,gap:`1.25rem`,flexWrap:`wrap`},children:(h?S.classes.filter(e=>e.count>0).map(e=>[e.label,e.color,iu(e.pct)]):[[`Legit`,`#34d399`,`${b}%`],[`Blocked`,`#f87171`,`${x}%`]]).map(([e,t,n])=>(0,f.jsxs)(`span`,{style:{fontSize:`0.8125rem`,color:`var(--text-faint)`,display:`flex`,alignItems:`center`,gap:4},children:[(0,f.jsx)(`span`,{style:{width:8,height:8,borderRadius:`50%`,background:t,display:`inline-block`,flexShrink:0}}),e,` â `,n]},e))})]}),r&&S.rows.length>0&&(0,f.jsxs)(`div`,{style:mu,children:[(0,f.jsx)(`p`,{style:hu,children:`Traffic by Category`}),(0,f.jsx)(`div`,{style:{display:`flex`,gap:`0.9rem`,flexWrap:`wrap`,marginTop:`-0.35rem`,marginBottom:`0.85rem`},children:S.classes.filter(e=>e.count>0).map(e=>(0,f.jsxs)(`span`,{title:e.desc,style:{fontSize:`0.8125rem`,color:`var(--text-faint)`,display:`flex`,alignItems:`center`,gap:4},children:[(0,f.jsx)(`span`,{style:{width:8,height:8,borderRadius:2,background:e.color,display:`inline-block`,flexShrink:0}}),e.label,` `,iu(e.pct)]},e.key))}),(0,f.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`0.7rem`},children:S.rows.map(e=>{let t=S.total>0?e.total/S.total*100:0,n=S.max>0?e.total/S.max*100:0,r=e.total>0?e.blocked/e.total*100:0;return(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`baseline`,gap:`0.6rem`,marginBottom:4},children:[(0,f.jsxs)(`span`,{style:{fontSize:`0.8125rem`,color:`var(--text-primary)`,fontWeight:500,display:`flex`,alignItems:`center`,gap:5,minWidth:0},children:[(0,f.jsx)(`span`,{style:{width:7,height:7,borderRadius:2,background:e.cls.color,display:`inline-block`,flexShrink:0}}),(0,f.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.label})]}),(0,f.jsxs)(`span`,{style:{fontSize:`0.8125rem`,color:`var(--text-faint)`,flexShrink:0,whiteSpace:`nowrap`},children:[(0,f.jsx)(`span`,{style:{color:`var(--text-muted)`,fontWeight:600}
106,children:e.total.toLocaleString()}),` · `,iu(t),e.blocked>0&&(0,f.jsxs)(`span`,{style:{color:`#f87171`},children:[` · `,e.blocked.toLocaleString(),` blocked`]})]})]}),(0,f.jsx)(`div`,{style:{height:6,borderRadius:999,background:`var(--bg-elevated)`,overflow:`hidden`},children:(0,f.jsxs)(`div`,{style:{width:`${Math.max(n,e.total>0?1.5:0)}%`,height:`100%`,display:`flex`,borderRadius:999,overflow:`hidden`,transition:`width 0.3s`},children:[(0,f.jsx)(`div`,{style:{width:`${100-r}%`,background:e.cls.color}}),(0,f.jsx)(`div`,{style:{width:`${r}%`,background:`#f87171`}})]})})]},e.cat)})}),S.counted<S.total&&(0,f.jsxs)(`p`,{style:{fontSize:`0.8125rem`,color:`var(--text-faint)`,marginTop:`0.75rem`,marginBottom:0},children:[(S.total-S.counted).toLocaleString(),` request`,S.total-S.counted===1?``:`s`,` not yet attributed to a category.`]})]}),r?.trend&&(0,f.jsxs)(`div`,{style:mu,children:[(0,f.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:`0.7rem`},children:[(0,f.jsx)(`p`,{style:{...hu,marginBottom:0},children:`7-Day Traffic`}),(0,f.jsx)(`div`,{style:{display:`flex`,gap:`0.75rem`},children:[[`Legit`,`#34d399`],[`Blocked`,`#f87171`]].map(([e,t])=>(0,f.jsxs)(`span`,{style:{fontSize:`0.8125rem`,color:`var(--text-faint)`,display:`flex`,alignItems:`center`,gap:3},children:[(0,f.jsx)(`span`,{style:{width:7,height:7,borderRadius:`50%`,background:t,display:`inline-block`}}),e]},e))})]}),(0,f.jsx)(Tu,{trend:r.trend}),(0,f.jsx)(`div`,{style:{display:`flex`,marginTop:`0.3rem`},children:r.trend.map((e,t)=>(0,f.jsx)(`span`,{style:{fontSize:`0.8125rem`,color:`var(--text-faint)`,textAlign:`center`,flex:1},children:e.day},t))})]})]})}function Ku({data:e,serviceId:t,onGoBilling:n,onGoSupport:r,onTabChange:i}){let a=typeof window<`u`?new URLSearchParams(window.location.search):new URLSearchParams,o=a.has(`bgdemo`),s=o&&[`monitor`,`protect`,`plus`].includes(a.get(`bgtier`))?a.get(`bgtier`):o?`plus`:null,c=s||e.tier||`protect`,u=Wl[c]??1,d=(s?Kl[c]:e.tier_caps)||Kl[c]||Kl.protect,p=e.website||(o?Cu.website:null),m=e.stats||(o?Cu.stats:null),h=e.settings||(o&&c!==`monitor`?{...Cu.settings,...d.custom_rules?{}:{custom_rules:void 0}}:null),g=e.error&&!e.website&&!e.stats?e.error:null,_=o?Cu.plans.map(e=>({...e,direction:Wl[e.tier]>u?`up`:Wl[e.tier]<u?`down`:`current`,diff:e.amount==null?null:e.amount-(Cu.plans.find(e=>e.tier===c)?.amount??0)})):e.plans||[],v=_.filter(e=>e.direction===`up`),[y,b]=(0,l.useState)(`overview`),[x,S]=(0,l.useState)(null),[C,w]=(0,l.useState)(!1),[T,E]=(0,l.useState)(null),[D,O]=(0,l.useState)({page:0,category:``,mitigation:``,q:``}),[k,A]=(0,l.useState)({has_more:!1,window_label:``,scan_capped:!1}),[j,M]=(0,l.useState)(ql[0].key),[N,P]=(0,l.useState)(null),[F,I]=(0,l.useState)(!1),[L,R]=(0,l.useState)(!1),z=N||m,B=async e=>{if(e===j)return;if(M(e),R(!1),e===ql[0].key){P(null);return}if(o){P(m);return}I(!0);let n=await Z(`/api/portal/services/${t}/botguard/stats?window=${encodeURIComponent(e)}`).catch(()=>({ok:!1}));I(!1),n.ok?P(n.stats||{}):R(!0)},[V,H]=(0,l.useState)(()=>h||{}),[U,W]=(0,l.useState)(()=>h?.rules||{}),[G,ee]=(0,l.useState)(()=>h?.rulesets||{}),[te,ne]=(0,l.useState)(()=>h?.loadbalancer||{}),[re,K]=(0,l.useState)(()=>h?.custom_rules||[]),[ie,q]=(0,l.useState)(!1),[ae,oe]=(0,l.useState)(!1),[se,ce]=(0,l.useState)(null),[le,ue]=(0,l.useState)(!0);(0,l.useEffect)(()=>{i?.(y)},[y,i]);let de=()=>q(!0),fe=async()=>{if(o){ce(`Demo mode â changes not saved`),ue(!0),q(!1),setTimeout(()=>ce(null),2500);return}let e={};d.rules&&(e.rules=U),d.rulesets&&(e.rulesets=G),d.loadbalancer&&(e.loadbalancer=te),d.custom_rules&&(e.custom_rules=re),oe(!0),ce(null);let n=await Z(`/api/portal/services/${t}/botguard/settings`,{method:`PUT`,body:JSON.stringify(e)}).catch(()=>({ok:!1,error:`Network error. Please try again.`}));if(oe(!1),ue(!!n.ok),ce(n.ok?`Saved`:n.error||`Could not save your changes`),n.ok){q(!1);let e=n.settings||{};H(e),W(e.rules||{}),ee(e.rulesets||{}),ne(e.loadbalancer||{}),K(e.custom_rules||[])}setTimeout(()=>ce(null),n.ok?3e3:8e3)},pe=()=>{W(V.rules||{}),ee(V.rulesets||{}),ne(V.loadbalancer||{}),K(V.custom_rules||[]),q(!1)},me=(e=D)=>
106{if(O(e),o){let t=(e.q||``).toLowerCase().split(/\s+/).filter(Boolean),n=wu.filter(n=>(!e.category||n.category===e.category)&&(!e.mitigation||n.mitigation===e.mitigation)&&t.every(e=>[n.url,n.visitor_ip,n.country_provider,n.user_agent,n.category,Yl[n.category]?.label,n.mitigation].join(` `).toLowerCase().includes(e)));S(n.slice(e.page*50,e.page*50+50)),A({has_more:n.length>(e.page+1)*50,window_label:`30 days`,scan_capped:!1});return}w(!0),E(null);let n=new URLSearchParams({page:String(e.page)});e.category&&n.set(`category`,e.category),e.mitigation&&n.set(`mitigation`,e.mitigation),e.q&&n.set(`q`,e.q),Z(`/api/portal/services/${t}/botguard/events?${n}`).then(e=>{A({has_more:!!e.has_more,window_label:e.window_label||``,scan_capped:!!e.scan_capped}),e.ok?S(e.events||[]):(S([]),E(e.error||`Could not load the event log`))}).catch(e=>{S([]),E(e.message||`Could not load the event log`)}).finally(()=>w(!1))},he=e=>me({...D,...e}),ge=e=>(Wl[e.min]??0)>u,_e=e=>v.find(t=>t.tier===e.min)||v[0]||null,ve=Jl.find(e=>e.key===y)||Jl[0],ye=ge(ve);return(0,f.jsxs)(f.Fragment,{children:[o&&(0,f.jsxs)(`div`,{style:{marginBottom:`1rem`,padding:`0.55rem 0.9rem`,borderRadius:9,background:`#fbbf2412`,border:`1px solid #fbbf2430`,fontSize:`0.8125rem`,color:`#d97706`,display:`flex`,alignItems:`center`,gap:`0.5rem`},children:[(0,f.jsx)(Y,{size:13,strokeWidth:2,style:{flexShrink:0}}),`Sample data â not this site's real traffic`,s?` (previewing ${Gl[s]})`:``]}),g&&(0,f.jsxs)(`div`,{style:{marginBottom:`1rem`,padding:`0.55rem 0.9rem`,borderRadius:9,background:`#f8717112`,border:`1px solid #f8717130`,fontSize:`0.8125rem`,color:`#dc2626`,display:`flex`,alignItems:`center`,gap:`0.5rem`},children:[(0,f.jsx)(Y,{size:13,strokeWidth:2,style:{flexShrink:0}}),`Live protection data is temporarily unavailable. Your site is still protected â please try again shortly.`]}),(0,f.jsx)(`div`,{className:`no-scrollbar`,style:{display:`flex`,gap:0,marginBottom:`1.25rem`,borderBottom:`1px solid var(--border)`,overflowX:`auto`},children:Jl.map(e=>{let t=ge(e);return(0,f.jsxs)(`button`,{onClick:()=>{b(e.key),e.key===`eventlog`&&!t&&x===null&&me()},style:{display:`flex`,alignItems:`center`,gap:`0.3rem`,padding:`0.5rem 1rem`,fontSize:`0.82rem`,fontWeight:y===e.key?600:400,border:`none`,background:`none`,cursor:`pointer`,whiteSpace:`nowrap`,color:y===e.key?`var(--text-primary)`:`var(--text-muted)`,borderBottom:y===e.key?`2px solid var(--accent)`:`2px solid transparent`,marginBottom:`-1px`,transition:`color 0.15s`,opacity:t?.6:1},children:[t&&(0,f.jsx)(wc,{size:11,strokeWidth:2.5,style:{flexShrink:0}}),e.label]},e.key)})}),ie&&!ye&&(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`0.75rem`,marginBottom:`1rem`,padding:`0.65rem 1rem`,borderRadius:10,background:`var(--bg-elevated)`,border:`1px solid var(--border)`,flexWrap:`wrap`},children:[(0,f.jsx)(`span`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`,flex:1},children:`You have unsaved changes`}),(0,f.jsx)(`button`,{className:`btn-secondary`,onClick:pe,children:`Discard`}),(0,f.jsx)(`button`,{onClick:fe,disabled:ae,style:{padding:`0.35rem 0.9rem`,borderRadius:7,border:`none`,background:`var(--btn-solid)`,color:`var(--btn-solid-text)`,fontSize:`0.8125rem`,fontWeight:600,cursor:`pointer`,opacity:ae?.7:1},children:ae?`Savingâ¦`:`Save changes`})]}),se&&(0,f.jsx)(`div`,{style:{marginBottom:`1rem`,padding:`0.5rem 0.9rem`,borderRadius:9,fontSize:`0.8125rem`,background:le?`#34d39912`:`#f8717112`,border:`1px solid ${le?`#34d39930`:`#f8717130`}`,color:le?`#059669`:`#dc2626`},children:se}),ye?(0,f.jsx)(ju,{tab:ve,offer:_e(ve),serviceId:t,isDemo:o,onGoBilling:n,onGoSupport:r}):y===`overview`?(0,f.jsx)(Gu,{data:e,tier:c,website:p,stats:z,lb:te,plans:_,serviceId:t,isDemo:o,statWindow:j,onStatWindow:B,statLoading:F,statError:L,onGoBilling:n,onGoSupport:r}):y===`eventlog`?(0,f.jsx)(Hu,{events:x,loading:C,error:T,page:D.page,hasMore:k.has_more,windowLabel:k.window_label,scanCapped:k.scan_capped,query:D,onQuery:he,onRefresh:()=>me(),isMonitor:c===`monitor`}):h?y===`rules`?(0,f.jsx)(Iu,{rules:U,setRules:W,stats:z,onDirty:de}):y===`lb`?(0,f.jsx)(Vu,{lb:te,setLb:ne,onDirty:de,options:e?.lb_options}):y===`customrules`?(0,f.jsx)(Fu,{crs:re,setCrs:K,onDirty:de}):null:(0,f.jsx)(`div`,{style:mu,children:(0,f.jsx)(`p`,{style:{color:`var(--text-muted)`,fontSize:`0.875rem`,margin:0},children:e?.error?`We couldn't load these settings just now â ${e.error}`:`We couldn't load these settings just now. Please try again shortly.`})})]})}async function qu(e){if(/^https:\/\//i.test(e||``))return window.open(e,`_blank`,`noopener`),``;
106try{let t=await Z(`/api/portal/store/handoff`,{method:`POST`,body:JSON.stringify({to:e||`/`})});return!t?.ok||!t.url?t?.error||`We could not open the store just now.`:(window.location.assign(t.url),``)}catch{return`We could not reach the store. Check your connection and try again.`}}function Ju({caps:e={}}){let[t,n]=(0,l.useState)(``),[r,i]=(0,l.useState)(!0),a=(0,l.useCallback)(async()=>{i(!0),n(``);try{let e=await Z(`/api/portal/store/handoff`,{method:`POST`,body:JSON.stringify({})});if(!e?.ok||!e.url){n(e?.error||`We could not open the store just now.`),i(!1);return}window.location.replace(e.url)}catch{n(`We could not reach the store. Check your connection and try again.`),i(!1)}},[]);return(0,l.useEffect)(()=>{if(e.order===!1){i(!1),n(`Your access to this account does not include placing orders.`);return}a()},[e.order,a]),(0,f.jsxs)(`div`,{className:`flex flex-col items-center justify-center text-center py-24 px-4`,children:[(0,f.jsx)(Qc,{size:40,className:`text-muted mb-4`}),(0,f.jsx)(`h2`,{className:`text-xl font-semibold text-primary mb-2`,children:t?`Store unavailable`:`Opening the storeâ¦`}),t?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`p`,{className:`text-sm text-muted max-w-md flex items-start gap-2 justify-center`,children:[(0,f.jsx)(Y,{size:16,className:`mt-0.5 shrink-0`}),(0,f.jsx)(`span`,{children:t})]}),e.order!==!1&&(0,f.jsxs)(`div`,{className:`flex flex-wrap gap-2 justify-center mt-5`,children:[(0,f.jsx)(`button`,{className:`btn-primary`,onClick:a,children:`Try again`}),(0,f.jsxs)(`a`,{className:`btn-secondary gap-2`,href:`https://store.networkdynamics.com`,target:`_blank`,rel:`noreferrer`,children:[`Open the store `,(0,f.jsx)(lc,{size:14})]})]})]}):(0,f.jsxs)(`p`,{className:`text-sm text-muted max-w-md`,children:[`Taking you to our store, signed in â your account and billing details are already there`,r?``:`.`]})]})}var Yu=`https://js.stripe.com/v3/`;function Xu(e,{timeoutMs:t=15e3}={}){if(!e)return Promise.reject(Error(`Card payments are not currently available.`));if(window.Stripe)try{return Promise.resolve(window.Stripe(e))}catch{}if(!document.querySelector(`script[src="${Yu}"]`)){let e=document.createElement(`script`);e.src=Yu,e.async=!0,document.head.appendChild(e)}return new Promise((n,r)=>{let i=Date.now(),a=setInterval(()=>{if(window.Stripe){clearInterval(a);try{n(window.Stripe(e))}catch(e){r(e)}}else Date.now()-i>t&&(clearInterval(a),r(Error(`The secure card form took too long to load. Please refresh and try again.`)))},150)})}var Zu={insufficient_funds:`Your card was declined for insufficient funds. Please use another card or payment method.`,expired_card:`That card has expired. Please use another card.`,incorrect_cvc:`The card's security code (CVC) doesn't match. Please check it and try again.`,invalid_cvc:`The card's security code (CVC) doesn't match. Please check it and try again.`,incorrect_number:`That card number was not accepted. Please check it and try again.`,invalid_number:`That card number was not accepted. Please check it and try again.`,invalid_expiry_month:`The expiry date on that card is not valid. Please check it and try again.`,invalid_expiry_year:`The expiry date on that card is not valid. Please check it and try again.`,incorrect_zip:`The postcode does not match the one your bank has for this card.`,card_not_supported:`Your bank doesn't allow this card to be used for this kind of purchase. Please use another card.`,currency_not_supported:`That card can't be charged in Australian dollars. Please use another card.`,transaction_not_allowed:`Your bank declined this payment. Please use another card, or contact your bank.`,authentication_required:`Your bank needs to verify this payment. Please try again and complete the verification.`,processing_error:`Your bank could not process that card just now. Please try again in a moment.`,call_issuer:`Your bank declined this payment. Please contact your bank, or use another card.`,card_declined:`Your card was declined. Please try another card or payment method.`,generic_decline:`Your card was declined. Please try another card or payment method.`},Qu=`We could not complete that payment. Please try again, or use another payment method.`;function $u(e,t=Qu){e&&console.error(`[stripe]`,e.type||``,e.code||``,e.decline_code||``,e.message||e);let n=e?.decline_code||e?.code||``;return Zu[n]?Zu[n]:e?.type===`card_error`?Zu.card_declined:e?.type===`validation_error`?`Please check your payment details and try again.`:t}var ed={portal:{form:`p-4 space-y-3 border-t border-edge`,title:`text-sm font-semibold text-primary`,hint:`text-xs text-muted`,label:`block text-xs font-medium mb-1 text-muted`,input:`w-full px-3 py-2 rounded-lg bg-surface border border-edge text-sm text-primary placeholder:text-faint focus:outline-none focus:border-blue-500`,error:`text-xs text-rose-400`,cancel:`btn-secondary text-xs flex-1`,submit:`btn-primary text-xs flex-1 disabled:opacity-50`,fallback:`w-full text-center text-[11px] text-muted hover:text-primary transition-colors pt-1`,appearance:{theme:`night`,variables:{colorPrimary:`#3b82f6`,borderRadius:`8px`,fontFamily:`system-ui, sans-serif`}}}};function td({onCancel:e,onSaved:t,kind:n=`card`,onFallback:r=null}){let i=ed.portal,a=n===`payto`,o=n===`becs`,s=a||o,c=s?`Direct Debit`:`card`,[u,d]=(0,l.useState)(``),[p,m]=(0,l.useState)(``),[h,g]=(0,l.useState)(!1),[_,v]=(0,l.useState)(``),[y,b]=(0,l.useState)(null),[x,S]=(0,l.useState)(!1),C=(0,l.useRef)(null),w=(0,l.useRef)(null),T=(0,l.useRef)(null);(0,l.useEffect)(()=>{let e=!1;return Z(`/api/portal/payment-methods/setup-intent`,{method:`POST`,body:JSON.stringify({kind:n})}).then(t=>{e||(t.ok?(d(t.clientSecret),m(t.publishableKey)):b(t.error||`Could not open the secure ${c} form.`))}),()=>{e=!0}},[]),(0,l.useEffect)(()=>
106{if(!p)return;let e=!1;return Xu(p).then(t=>{e||(C.current=t,g(!0))}).catch(t=>{e||b(t.message||`Could not load the secure card form.`)}),()=>{e=!0}},[p]),(0,l.useEffect)(()=>{if(!h||!C.current||!u||!T.current)return;let e;try{let t=C.current.elements({clientSecret:u,appearance:i.appearance});e=t.create(`payment`,{layout:{type:`tabs`,defaultCollapsed:!1},wallets:{applePay:`never`,googlePay:`never`}}),e.on(`change`,e=>b(e.error?$u(e.error):null)),e.mount(T.current),w.current=t}catch{b(`Could not display the card form.`)}return()=>{try{e?.unmount()}catch{}w.current=null}},[h,u]);async function E(e){e.preventDefault(),b(null);let i=w.current;if(!C.current||!i){b(`The card form is still loading â please wait a moment.`);return}S(!0);try{let{error:e}=await i.submit();if(e){b($u(e,`Please check your card details.`)),S(!1);return}let{error:o,setupIntent:l}=await C.current.confirmSetup({elements:i,clientSecret:u,confirmParams:{return_url:window.location.href},redirect:`if_required`});if(o){b($u(o,`Your ${c} could not be saved. Please try again.`)),S(!1);return}if(!(s?[`succeeded`,`processing`,`requires_action`]:[`succeeded`]).includes(l?.status)){a&&l?.status===`requires_payment_method`?b(r?`Your bank didn't approve a PayTo agreement for this account. You can set up a direct debit with your BSB and account number instead, or add a card.`:`Your bank didn't approve a Direct Debit agreement for this account â it may not support PayTo agreements. Please try a different bank account, or add a card instead.`):b(`${s?`Direct Debit`:`Card`} setup not completed (${l?.status||`unknown`}).`),S(!1);return}let d=await Z(`/api/portal/payment-methods/confirm`,{method:`POST`,body:JSON.stringify({setup_intent_id:l.id,label:_.trim(),kind:n})});if(!d.ok){b(d.error||`Your ${c} was authorised but we could not save it. Please contact support.`),S(!1);return}t(d)}catch(e){b($u(e,`We could not save that ${c}. Please try again.`))}finally{S(!1)}}let D=o?`Set up Direct Debit (BSB & account)`:a?`Set up Bank Direct Debit (PayTo)`:`Add credit card`;return(0,f.jsxs)(`form`,{onSubmit:E,className:i.form,children:[(0,f.jsx)(`p`,{className:i.title,children:D}),a&&(0,f.jsx)(`p`,{className:i.hint,children:`Enter your bank (BSB & account or PayID) below. You'll approve the Direct Debit agreement in your banking app â it may take a few minutes to activate.`}),o&&(0,f.jsx)(`p`,{className:i.hint,children:`Enter your BSB and account number below. By continuing you authorise a direct debit request (DDR) against this account for future invoices. This works with any Australian bank account.`}),!h&&!y&&(0,f.jsxs)(`p`,{className:i.hint,children:[`Loading secure `,c,` formâ¦`]}),(0,f.jsx)(`div`,{ref:T}),(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`label`,{className:i.label,children:[`Label `,(0,f.jsx)(`span`,{className:`font-normal opacity-70`,children:`(optional)`})]}),(0,f.jsx)(`input`,{value:_,onChange:e=>v(e.target.value),placeholder:s?`e.g. Business account`:`e.g. Personal, Business`,className:i.input})]}),y&&(0,f.jsx)(`p`,{className:i.error,children:y}),(0,f.jsxs)(`div`,{className:`flex gap-2 pt-1`,children:[(0,f.jsx)(`button`,{type:`button`,onClick:e,className:i.cancel,children:`Cancel`}),(0,f.jsx)(`button`,{type:`submit`,disabled:x||!h,className:i.submit,children:x?`Savingâ¦`:s?`Set up Direct Debit`:`Save card`})]}),a&&r&&(0,f.jsx)(`button`,{type:`button`,onClick:r,className:i.fallback,children:`Bank doesn't support PayTo? Use BSB & account number instead`})]})}function nd(e){return e?e.method_type===`paypal`?`PayPal`:e.method_type===`gocardless`?e.label||`your direct debit mandate`:e.method_type===`payto`||e.method_type===`becs`?e.label||`your bank account`:e.brand?`${e.brand} â¢â¢â¢â¢ ${e.last4}`:`your saved card`:`your default payment method`}function rd(e){if(!e)return``;if(e.method_type===`payto`||e.method_type===`becs`){let t=[];return e.bank_bsb&&t.push(`BSB ${e.bank_bsb}`),e.bank_last4&&t.push(`â¢â¢â¢â¢ ${e.bank_last4}`),t.join(` · `)||`Bank Direct Debit`}return e.method_type===`paypal`?`PayPal billing agreement`:e.method_type===`gocardless`?`Direct debit mandate`:e.expiry_month&&e.expiry_year?`Expires ${String(e.expiry_month).padStart(2,`0`)}/${String(e.expiry_year).slice(-2)}`:``}function id(e){return!e||e.chargeable!==!1?``:e.pending?`Waiting for approval from your bank`:`Can't be charged â add this card again to reconnect it`}var ad=[`/pay-invoice`,`/feedback`],od=()=>window.location.pathname.replace(/\/+$/,``),sd=()=>ad.includes(od());function cd(e){if(!e)return null;try{let t=e.lastIndexOf(`.`),n=t>
1060?e.slice(0,t):e;return JSON.parse(atob(n))}catch{return null}}var ld=null;try{let e=/(?:^|&)nh=([^&]+)/.exec(window.location.hash.slice(1));e&&(ld=decodeURIComponent(e[1]),history.replaceState(null,``,window.location.pathname+window.location.search))}catch{}async function ud(){let e=ld;if(ld=null,e)try{let t=await(await fetch(`/api/portal/store/checkout-session`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({handoff:e})})).json();t?.ok&&t.token&&(localStorage.setItem(hl,t.token),localStorage.removeItem(`crm:portal:origin-token`),localStorage.removeItem(`crm:portal:origin-client`))}catch{}}var dd=365,fd=`portal:signin-upsell-dismissed`;function pd(){let e=cd(localStorage.getItem(hl)),t=String(e?.loginEmail||e?.email||``).toLowerCase();return t?`portal:signin-upsell-snoozed:${t}`:`portal:signin-upsell-snoozed`}function md(){try{return sessionStorage.getItem(fd)?!0:Number(localStorage.getItem(pd())||0)>Date.now()}catch{return!1}}function hd(){try{localStorage.setItem(pd(),String(Date.now()+dd*864e5)),sessionStorage.setItem(fd,`1`)}catch{}}function gd(e){if(!e)return`â`;let t=new Date(e);return`${t.toLocaleDateString(`en-AU`,{day:`numeric`,month:`short`,year:`numeric`})}, ${t.toLocaleTimeString(`en-AU`,{hour:`numeric`,minute:`2-digit`,hour12:!0})}`}function _d(e){return e?.invoicenum||`#${e?.id??``}`}function vd(e,t){let n=String(t||``).trim().toLowerCase();if(!n)return!0;let r=e=>String(e??``).toLowerCase().replace(/[^a-z0-9]/g,``),i=r(n);if(i&&(r(e?.invoicenum).includes(i)||String(e?.id??``).includes(i)))return!0;let a=`${e?.invoicenum||``} ${e?.id??``} ${e?.items_text||``}`.toLowerCase();return n.split(/\s+/).every(e=>a.includes(e))}function yd(e,t){let n=String(e||``).trim().split(/\s+/).filter(Boolean);return n.length>=2?(n[0][0]+n[n.length-1][0]).toUpperCase():n.length===1?n[0][0].toUpperCase():(String(t||`?`)[0]||`?`).toUpperCase()}var bd=`#2AA9E0`,xd=`linear-gradient(135deg, #5CC3EC 0%, #2AA9E0 100%)`;function Sd(e){let t=parseFloat(e?.balance);return isNaN(t)?parseFloat(e?.total)||0:t}function Cd(e){let t=parseFloat(e?.balance);if(isNaN(t))return!1;let n=parseFloat(e?.total)||0;return t>.005&&t<n-.005}function wd({text:e,children:t}){return(0,f.jsxs)(`div`,{className:`relative group/tip inline-flex min-w-0 max-w-full`,children:[t,(0,f.jsx)(`div`,{className:`pointer-events-none absolute bottom-full left-1/2 -translate-x-1/2 mb-1.5 z-50 107 opacity-0 group-hover/tip:opacity-100 transition-opacity duration-150`,children:(0,f.jsxs)(`div`,{className:`rounded-lg px-2.5 py-1.5 text-xs font-medium whitespace-nowrap shadow-lg`,style:{background:`var(--bg-elevated)`,border:`1px solid var(--border)`,color:`var(--text-primary)`},children:[e,(0,f.jsx)(`div`,{className:`absolute top-full left-1/2 -translate-x-1/2 -mt-px`,style:{width:0,height:0,borderLeft:`5px solid transparent`,borderRight:`5px solid transparent`,borderTop:`5px solid var(--border)`}}),(0,f.jsx)(`div`,{className:`absolute top-full left-1/2 -translate-x-1/2 -mt-[4px]`,style:{width:0,height:0,borderLeft:`4px solid transparent`,borderRight:`4px solid transparent`,borderTop:`4px solid var(--bg-elevated)`}})]})})]})}var Td=e=>e?.status===`Active`||e?.status===`Trial`,Ed=50,Dd={Active:`#34d399`,Trial:`#a78bfa`,Suspended:`#fbbf24`},Od=e=>Dd[e]||`var(--text-muted)`;function kd({status:e}){let{cls:t=`bg-zinc-500/15 text-zinc-400`,icon:n=`â`}={Active:{cls:`bg-green-500/15 text-green-500`,icon:`â`},Trial:{cls:`bg-violet-500/15 text-violet-400`,icon:`â`},Suspended:{cls:`bg-amber-500/15 text-amber-500`,icon:`â`},Cancelled:{cls:`bg-zinc-500/15 text-zinc-400`,icon:`â`},Terminated:{cls:`bg-red-500/15 text-red-400`,icon:`â`},Expired:{cls:`bg-red-500/15 text-red-400`,icon:`â`},Pending:{cls:`bg-blue-500/15 text-blue-400`,icon:`â`},Fraud:{cls:`bg-red-500/15 text-red-400`,icon:`â`},Paid:{cls:`bg-green-500/15 text-green-500`,icon:`â`},Unpaid:{cls:`bg-amber-500/15 text-amber-500`,icon:`â`},Overdue:{cls:`bg-red-500/15 text-red-400`,icon:`â`},Open:{cls:`bg-blue-500/15 text-blue-400`,icon:`â`},"Customer-Reply":{cls:`bg-purple-500/15 text-purple-400`,icon:`â`},Answered:{cls:`bg-green-500/15 text-green-500`,icon:`â`},"In Progress":{cls:`bg-amber-500/15 text-amber-500`,icon:`â`},Closed:{cls:`bg-zinc-500/15 text-zinc-400`,icon:`â`},"Awaiting Activation":{cls:`bg-amber-500/15 text-amber-500`,icon:`â`},"On hold":{cls:`bg-amber-500/15 text-amber-500`,icon:`â`},Expiring:{cls:`bg-red-500/15 text-red-400`,icon:`â`},"Pending Transfer":{cls:`bg-sky-500/15 text-sky-400`,icon:`â`},"Pending Registration":{cls:`bg-amber-500/15 text-amber-500`,icon:`â`},"Transfer expired":{cls:`bg-red-500/15 text-red-400`,icon:`â`},Sent:{cls:`bg-blue-500/15 text-blue-400`,icon:`â`},Accepted:{cls:`bg-green-500/15 text-green-500`,icon:`â`},Declined:{cls:`bg-zinc-500/15 text-zinc-400`,icon:`â`}}[e]||{};return(0,f.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-semibold ${t}`,children:[(0,f.jsx)(`span`,{className:`text-[8px] leading-none`,children:n}),e]})}function Ad(e){let t=String(e||``).trim();if(!t)return`Unknown`;let n=t.toLowerCase();return n.startsWith(`ok_transfer`)?/waiting_auth|_pending/.test(n)?`Pending Transfer`:`Transfer expired`:/redemption|pendingdelete|pendingrestore/.test(n)?`Expiring`:/hold/.test(n)?`On hold`:/pending/.test(n)?`Pending`:/expired/.test(n)?`Expired`:/inactive/.test(n)?`Pending`:/prohibited/.test(n)||n===`ok`||n===`active`||/(^|\s)ok(\s|$)/.test(n)?`Active`:t.charAt(0).toUpperCase()+t.slice(1)}var jd=[10,25,50,100];function Md({total:e,page:t,pageSize:n,onPage:r,onPageSize:i}){let a=Math.max(1,Math.ceil(e/n)),o=e===0?0:(t-1)*n+1,s=Math.min(t*n,e);return(0,f.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 px-4 py-3 border-t border-edge bg-elevated text-xs text-muted`,children:[(0,f.jsx)(`span`,{children:e===0?`No results`:`${o}â${s} of ${e}`}),(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,f.jsx)(`span`,{className:`text-faint`,children:`Per page`}),(0,f.jsx)(`select`,{value:n,onChange:e=>{i(Number(e.target.value)),r(1)},className:`rounded-md border border-edge bg-surface text-primary text-xs px-2 py-1 focus:outline-none focus:border-accent`,children:jd.map(e=>(0,f.jsx)(`option`,{value:e,children:e},e))})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,f.jsx)(`button`,{onClick:()=>r(t-1),disabled:t<=1,className:`w-7 h-7 flex items-center justify-center rounded-md border border-edge bg-surface disabled:opacity-30 hover:bg-[var(--bg-hover)] transition-colors`,children:(0,f.jsx)(tc,{size:13})}),(0,f.jsxs)(`span`,{className:`px-2 tabular-nums`,children:[t,` / `,a]}),(0,f.jsx)(`button`,{onClick:()=>r(t+1),disabled:t>=a,className:`w-7 h-7 flex items-center justify-center rounded-md border border-edge bg-surface disabled:opacity-30 hover:bg-[var(--bg-hover)] transition-colors`,children:(0,f.jsx)(nc,{size:13})})]})]})]})}function Nd(e){if(e&&typeof e==`object`){let t=Array.isArray(e.data)?e.data:Object.values(e).filter(e=>typeof e==`number`);return new Uint8Array(t)}let t=String(e).replace(/-/g,`+`).replace(/_/g,`/`);return Uint8Array.from(atob(t),e=>e.charCodeAt(0))}function Pd(e){return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=/g,``)}async function Fd(e){if(!navigator.credentials)throw Error(`Passkeys require a secure connection (HTTPS). Please contact your administrator.`);let t=await navigator.credentials.create({publicKey:{...e,challenge:Nd(e.challenge),user:{...e.user,id:Nd(e.user.id)},excludeCredentials:(e.excludeCredentials||[]).map(e=>({...e,id:Nd(e.id)}
107))}});return{id:t.id,rawId:Pd(t.rawId),type:t.type,response:{clientDataJSON:Pd(t.response.clientDataJSON),attestationObject:Pd(t.response.attestationObject)},clientExtensionResults:t.getClientExtensionResults()}}async function Id(e){if(!navigator.credentials)throw Error(`Passkeys require a secure connection (HTTPS). Please contact your administrator.`);let t=await navigator.credentials.get({publicKey:{...e,challenge:Nd(e.challenge),allowCredentials:(e.allowCredentials||[]).map(e=>({...e,id:Nd(e.id)}))}});return{id:t.id,rawId:Pd(t.rawId),type:t.type,response:{clientDataJSON:Pd(t.response.clientDataJSON),authenticatorData:Pd(t.response.authenticatorData),signature:Pd(t.response.signature),userHandle:t.response.userHandle?Pd(t.response.userHandle):null},clientExtensionResults:t.getClientExtensionResults()}}var Ld={google:{label:`Google`,bg:`#ffffff`,fg:`#1f1f1f`,border:`#dadce0`},microsoft:{label:`Microsoft`,bg:`#2f2f2f`,fg:`#ffffff`,border:`#2f2f2f`},apple:{label:`Apple`,bg:`#000000`,fg:`#ffffff`,border:`#000000`},github:{label:`GitHub`,bg:`#24292e`,fg:`#ffffff`,border:`#24292e`},facebook:{label:`Facebook`,bg:`#1877f2`,fg:`#ffffff`,border:`#1877f2`}};function Rd({id:e,size:t=18}){let n={width:t,height:t,display:`block`};switch(e){case`google`:return(0,f.jsxs)(`svg`,{viewBox:`0 0 24 24`,style:n,"aria-hidden":`true`,children:[(0,f.jsx)(`path`,{fill:`#4285F4`,d:`M22.5 12.2c0-.7-.1-1.4-.2-2H12v3.9h5.9a5 5 0 0 1-2.2 3.3v2.7h3.6c2.1-1.9 3.2-4.8 3.2-7.9z`}),(0,f.jsx)(`path`,{fill:`#34A853`,d:`M12 23c2.9 0 5.4-1 7.2-2.6l-3.6-2.7c-1 .7-2.3 1.1-3.6 1.1-2.8 0-5.1-1.9-6-4.4H2.3v2.8A11 11 0 0 0 12 23z`}),(0,f.jsx)(`path`,{fill:`#FBBC05`,d:`M6 14.4a6.6 6.6 0 0 1 0-4.2V7.4H2.3a11 11 0 0 0 0 9.8L6 14.4z`}),(0,f.jsx)(`path`,{fill:`#EA4335`,d:`M12 5.6c1.6 0 3 .5 4.1 1.6l3.1-3.1A11 11 0 0 0 2.3 7.4L6 10.2c.9-2.6 3.2-4.6 6-4.6z`})]});case`apple`:return(0,f.jsx)(`svg`,{viewBox:`0 0 24 24`,style:n,fill:`currentColor`,"aria-hidden":`true`,children:(0,f.jsx)(`path`,{d:`M16.4 12.7c0-2.3 1.9-3.4 2-3.5-1.1-1.6-2.8-1.8-3.4-1.8-1.4-.1-2.8.8-3.5.8s-1.8-.8-3-.8c-1.5 0-3 .9-3.8 2.3-1.6 2.8-.4 7 1.2 9.3.8 1.1 1.7 2.4 2.9 2.3 1.2-.1 1.6-.7 3-.7s1.8.7 3 .7 2-1.1 2.8-2.2c.9-1.3 1.2-2.5 1.3-2.6-.1 0-2.5-1-2.5-3.8zM14.3 5.8c.6-.8 1-1.9.9-3-.9 0-2 .6-2.7 1.4-.6.7-1.1 1.8-.9 2.8 1 .1 2-.5 2.7-1.2z`})});case`github`:return(0,f.jsx)(`svg`,{viewBox:`0 0 24 24`,style:n,fill:`currentColor`,"aria-hidden":`true`,children:(0,f.jsx)(`path`,{d:`M12 2a10 10 0 0 0-3.2 19.5c.5.1.7-.2.7-.5v-1.7c-2.8.6-3.4-1.3-3.4-1.3-.4-1.2-1.1-1.5-1.1-1.5-.9-.6.1-.6.1-.6 1 .1 1.5 1 1.5 1 .9 1.6 2.4 1.1 3 .9.1-.7.3-1.1.6-1.4-2.2-.2-4.6-1.1-4.6-5a4 4 0 0 1 1-2.7c-.1-.3-.5-1.3.1-2.7 0 0 .8-.2 2.7 1a9.3 9.3 0 0 1 5 0c1.9-1.2 2.7-1 2.7-1 .6 1.4.2 2.4.1 2.7a4 4 0 0 1 1 2.7c0 3.9-2.4 4.8-4.6 5 .3.3.7 1 .7 2v2.9c0 .3.2.6.7.5A10 10 0 0 0 12 2z`})});case`facebook`:return(0,f.jsx)(`svg`,{viewBox:`0 0 24 24`,style:n,fill:`currentColor`,"aria-hidden":`true`,children:(0,f.jsx)(`path`,{d:`M22 12a10 10 0 1 0-11.6 9.9v-7H7.9V12h2.5V9.8c0-2.5 1.5-3.9 3.8-3.9 1.1 0 2.2.2 2.2.2v2.5h-1.2c-1.2 0-1.6.8-1.6 1.5V12h2.7l-.4 2.9h-2.3v7A10 10 0 0 0 22 12z`})});case`microsoft`:return(0,f.jsxs)(`svg`,{viewBox:`0 0 24 24`,style:n,"aria-hidden":`true`,children:[(0,f.jsx)(`path`,{fill:`#F25022`,d:`M3 3h8v8H3z`}),(0,f.jsx)(`path`,{fill:`#7FBA00`,d:`M13 3h8v8h-8z`}),(0,f.jsx)(`path`,{fill:`#00A4EF`,d:`M3 13h8v8H3z`}),(0,f.jsx)(`path`,{fill:`#FFB900`,d:`M13 13h8v8h-8z`})]});default:return(0,f.jsx)(Tc,{size:t})}}var zd=[`google`,`microsoft`,`github`,`apple`,`facebook`],Bd=e=>[...e].sort((e,t)=>{let n=zd.indexOf(e.id),r=zd.indexOf(t.id);return(n<0?99:n)-(r<0?99:r)}),Vd={not_linked:`That account isnât linked to any portal login. Sign in with your email first, then link it under Security.`,email_unverified:`Your provider didnât confirm a verified email, so we couldnât link it.`,expired:`The sign-in request expired. Please try again.`,provider_error:`We couldnât complete sign-in with that provider. Please try again.`,provider_unavailable:`That sign-in provider is not currently available.`,link_failed:`We couldnât link that account. It may already be linked to another login.`,access_de
107nied:`Sign-in was cancelled.`},Hd=e=>Vd[e]||`Sign-in could not be completed. Please try again.`;function Ud({onLogin:e,inviteInfo:t=null,authError:n=``}){let[r,i]=(0,l.useState)(``),[a,o]=(0,l.useState)(`email`),[s,c]=(0,l.useState)(``),[u,d]=(0,l.useState)([]),[m,h]=(0,l.useState)(``),[g,_]=(0,l.useState)(null),[v,y]=(0,l.useState)(``),[b,x]=(0,l.useState)([]),[S,C]=(0,l.useState)([]),[w,T]=(0,l.useState)(``),[E,D]=(0,l.useState)(!1),[O,k]=(0,l.useState)(n||``),[A,j]=(0,l.useState)(`email`),[M,N]=(0,l.useState)(null),[P,F]=(0,l.useState)(null),[I,L]=(0,l.useState)(``);(0,l.useEffect)(()=>{fetch(`/api/portal/auth/providers`).then(e=>e.json()).then(e=>{e.ok&&C(Bd(e.providers||[]))}).catch(()=>{})},[]);async function R(t){k(``),D(!0);try{let n=await fetch(`/api/portal/login`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({email:r,...t?{force:t}:{}})}).then(e=>e.json());if(!n.ok)return k(n.error||`Sign in failed`);n.step===`oauth`?(x(n.providers||[]),y(n.clientEmail),o(`oauth`)):n.step===`2fa`?(c(n.sessionId),d(n.methods),h(n.methods[0]),y(n.clientEmail),n.passkeyOptions&&_(n.passkeyOptions),o(`2fa`),n.methods[0]===`passkey`&&n.passkeyOptions&&H(n.sessionId,n.passkeyOptions)):(localStorage.setItem(hl,n.token),e(n.client))}catch{k(`Network error. Please try again.`)}finally{D(!1)}}function z(e){e.preventDefault(),R()}async function B(e){k(``),D(!0);try{let t=await fetch(`/api/portal/auth/${e}/start`,{method:`POST`,headers:{"Content-Type":`application/json`},body:`{}`}).then(e=>e.json());if(!t.ok||!t.url)return D(!1),k(t.error||`Could not start sign-in`);window.location.assign(t.url)}catch{D(!1),k(`Network error. Please try again.`)}}async function V(){k(``),D(!0);try{let t=await fetch(`/api/portal/auth/passkey/login/begin`,{method:`POST`,headers:{"Content-Type":`application/json`},body:`{}`}).then(e=>e.json());if(!t.ok)return D(!1),k(t.error||`Could not start passkey sign-in`);let n=await Id(t.options),r=await fetch(`/api/portal/auth/passkey/login/complete`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({sessionId:t.sessionId,credential:n})}).then(e=>e.json());if(!r.ok)return D(!1),k(r.error||`Passkey sign-in failed`);localStorage.setItem(hl,r.token),e(r.client)}catch(e){D(!1),k(e.name===`NotAllowedError`?`Passkey prompt was dismissed.`:e.message||`Passkey sign-in failed`)}}async function H(t,n){D(!0),k(``);try{let r=await Id(n),i=await fetch(`/api/portal/2fa/passkey/verify`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({sessionId:t,credential:r})}).then(e=>e.json());if(!i.ok)return k(i.error||`Passkey verification failed`);localStorage.setItem(hl,i.token),e(i.client)}catch(e){k(e.name===`NotAllowedError`?`Passkey prompt was dismissed.`:e.message||`Passkey failed`)}finally{D(!1)}}async function U(t){t.preventDefault(),k(``),D(!0);try{let t=await fetch(`/api/portal/2fa/verify`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({sessionId:s,code:w})}).then(e=>e.json());if(!t.ok)return k(t.error||`Invalid code`);localStorage.setItem(hl,t.token),e(t.client)}catch{k(`Network error.`)}finally{D(!1)}}async function W(e){e?.preventDefault(),k(``),D(!0);try{let e=await fetch(`/api/portal/recover/start`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({email:r})}).then(e=>e.json());if(!e.ok)return k(e.error||`Could not start recovery`);N(e.sessionId),F(e.phoneHint),L(``),j(`code`)}catch{k(`Network error. Please try again.`)}finally{D(!1)}}async function G(t){t?.preventDefault(),k(``),D(!0);try{let t=await fetch(`/api/portal/recover/verify`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({sessionId:M,code:I})}).then(e=>e.json());if(!t.ok)return k(t.error||`Incorrect code`);localStorage.setItem(hl,t.token),e(t.client)}catch{k(`Network error. Please try again.`)}finally{D(!1)}}function ee(){o(`recover`),j(`email`),L(``),k(``)}let te=`hsl(220 13% 13%)`,ne=`hsl(220 9% 46%)`,re=`hsl(220 13% 91%)`,K=`h-11 w-full rounded-md px-3 py-2 text-base outline-none focus:ring-2 focus:ring-[hsl(196_100%_46%)]`,ie={background:`#ffffff`,border:`1px solid ${re}`,color:te},q=`h-14 w-56 text-center text-3xl font-bold tracking-[0.4rem] rounded-md px-3 outline-none focus:ring-2 focus:ring-[hsl(196_100%_46%)]`,ae=`w-full inline-flex items-center justify-center gap-2 rounded-lg text-lg font-semibold px-8 py-3 transition-all disabled:opacity-50 disabled:pointer-events-none`,oe={background:te,color:`#ffffff`},se=`w-full inline-flex items-center justify-start gap-2.5 rounded-lg text-base font-semibold px-5 py-3 transition-colors disabled:opacity-50 disabled:pointer-events-none hover:bg-black/[0.03]`,ce={background:`#ffffff`,border:`1px solid ${re}`,color:te},le=e=>(0,f.jsxs)(`div`,{className:`min-h-screen flex flex-col`,style:{background:`#f5fbfe`},children:[(0,f.jsx)(`header`,{className:`container mx-auto px-4 py-6 flex items-center justify-center`,children:(0,f.jsx)(p,{className:`h-10 w-auto`,style:{color:te}})}),(0,f.jsx)(`main`,{className:`flex-1 container mx-auto px-4 pb-16 max-w-sm w-full flex flex-col justify-center`,children:e})]}),ue=(e,t)=>
107(0,f.jsxs)(`div`,{className:`text-center mb-6`,children:[(0,f.jsx)(`h1`,{className:`text-xl font-bold`,style:{color:te},children:e}),t&&(0,f.jsx)(`p`,{className:`text-sm mt-2 leading-relaxed`,style:{color:ne},children:t})]}),de=O?(0,f.jsx)(`p`,{className:`text-sm text-center mb-1`,style:{color:`hsl(0 84.2% 60.2%)`},children:O}):null,fe=e=>(0,f.jsx)(`button`,{onClick:e,className:`w-full text-center text-sm mt-6 hover:underline`,style:{color:ne},children:`â Back to sign in`});return le(a===`recover`?(0,f.jsxs)(f.Fragment,{children:[ue(`Canât log in?`,A===`email`?(0,f.jsx)(f.Fragment,{children:`We can text a recovery code to the mobile number on your account.`}):(0,f.jsxs)(f.Fragment,{children:[`If we have a mobile number on file`,P?(0,f.jsxs)(f.Fragment,{children:[` ending in `,(0,f.jsx)(`strong`,{style:{color:te},children:P})]}):``,`, weâve sent a code.`]})),de,A===`email`?(0,f.jsxs)(`form`,{onSubmit:W,className:`space-y-3`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-sm font-medium mb-1.5`,style:{color:te},children:`Email address`}),(0,f.jsx)(`input`,{type:`email`,value:r,onChange:e=>i(e.target.value),required:!0,autoFocus:!0,placeholder:`[email protected]`,className:K,style:ie})]}),(0,f.jsx)(`button`,{type:`submit`,disabled:E||!r,className:ae,style:oe,children:E?`Sendingâ¦`:`Text me a code`})]}):(0,f.jsxs)(`form`,{onSubmit:G,className:`space-y-4`,children:[(0,f.jsx)(`div`,{className:`flex justify-center`,children:(0,f.jsx)(`input`,{value:I,onChange:e=>L(e.target.value.replace(/\D/g,``)),required:!0,autoFocus:!0,inputMode:`numeric`,maxLength:6,placeholder:`000000`,className:q,style:ie})}),(0,f.jsxs)(`div`,{className:`rounded-md px-3 py-2.5 text-xs`,style:{background:`rgba(21,164,233,0.08)`,border:`1px solid ${re}`,color:ne},children:[`Verifying resets your sign-in to `,(0,f.jsx)(`strong`,{style:{color:te},children:`email codes`}),` and removes any passkeys and connected sign-ins from your account.`]}),(0,f.jsx)(`button`,{type:`submit`,disabled:E||!I,className:ae,style:oe,children:E?`Verifyingâ¦`:`Verify & reset sign-in`}),(0,f.jsx)(`button`,{type:`button`,onClick:()=>{j(`email`),k(``)},className:`w-full text-center text-sm hover:underline`,style:{color:ne},children:`Use a different email`})]}),fe(()=>{o(`email`),k(``)})]}):a===`oauth`?(0,f.jsxs)(f.Fragment,{children:[ue(`Welcome back`,(0,f.jsxs)(f.Fragment,{children:[`Continue with your connected sign-in for `,(0,f.jsx)(`strong`,{style:{color:te},children:v})]})),de,(0,f.jsx)(`div`,{className:`space-y-2`,children:b.map(e=>{let t=Ld[e.id]||{label:e.name};return(0,f.jsxs)(`button`,{onClick:()=>B(e.id),disabled:E,className:se,style:ce,children:[(0,f.jsx)(Rd,{id:e.id}),` Continue with `,t.label]},e.id)})}),fe(()=>{o(`email`),k(``)})]}):a===`2fa`?(0,f.jsxs)(f.Fragment,{children:[ue(m===`passkey`?`Verify with passkey`:`Check your email`,m===`passkey`?`Use your passkey to verify your identity.`:(0,f.jsxs)(f.Fragment,{children:[`If `,(0,f.jsx)(`strong`,{style:{color:te},children:v}),` is in our system, a sign-in code has been sent to that address.`,(0,f.jsx)(`span`,{className:`block mt-3`,children:`For security we donât confirm whether an email exists. If nothing arrives within 10 minutes, try a different address.`})]})),de,m===`passkey`?(0,f.jsxs)(`button`,{onClick:()=>H(s,g),disabled:E||!g,className:ae,style:oe,children:[E?(0,f.jsx)(X,{size:16,className:`animate-spin`}):(0,f.jsx)(Fs,{size:16}),E?`Waiting for passkeyâ¦`:`Use passkey / biometric`]}):(0,f.jsxs)(`form`,{onSubmit:U,className:`space-y-4`,children:[(0,f.jsx)(`div`,{className:`flex justify-center`,children:(0,f.jsx)(`input`,{value:w,onChange:e=>T(e.target.value.replace(/\D/g,``)),required:!0,autoFocus:!0,inputMode:`numeric`,maxLength:6,placeholder:`000000`,className:q,style:ie})}),(0,f.jsx)(`button`,{type:`submit`,disabled:E||!w,className:ae,style:oe,children:E?`Verifyingâ¦`:`Verify & continue`})]}),fe(()=>{o(`email`),T(``),k(``)})]}):(0,f.jsxs)(f.Fragment,{children:[t&&(0,f.jsxs)(`div`,{className:`mb-4 px-4 py-2.5 rounded-lg border text-sm text-center`,style:{background:`rgba(79,70,229,0.08)`,borderColor:`rgba(79,70,229,0.25)`,color:te},children:[`Sign in to accept your invite to `,(0,f.jsx)(`strong`,{children:t.accountName}),t.roleLabel?(0,f.jsxs)(f.Fragment,{children:[` as `,(0,f.jsx)(`strong`,{children:t.roleLabel})]}):null]}),(0,f.jsxs)(`form`,{onSubmit:z,className:`space-y-3`,children:[(0,f.jsx)(`div`,{children:(0,f.jsx)(`input`,{type:`email`,value:r,onChange:e=>i(e.target.value),required:!0,placeholder:`Email Address`,className:K,style:ie})}),de,(0,f.jsxs)(`button`,{type:`submit`,disabled:E||!r,className:ae,style:oe,children:[(0,f.jsx)(Dc,{className:`w-4 h-4`}),` `,E?`Signing inâ¦`:`Sign in`]})]}),(0,f.jsxs)(`div`,{className:`relative my-6`,children:[(0,f.jsx)(`div`,{className:`absolute inset-0 flex items-center`,children:(0,f.jsx)(`span`,{className:`w-full border-t`,style:{borderColor:re}})}),(0,f.jsx)(`div`,{className:`relative flex justify-center text-xs uppercase`,children:(0,f.jsx)(`span`,{className:`px-2`,style:{background:`#f5fbfe`,color:ne},children:`or continue with`})})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[S.map(e=>{let t=Ld[e.id]||{label:e.name};return(0,f.jsxs)(`button`,{onClick:()=>B(e.id),disabled:E,className:se,style:ce,children:[(0,f.jsx)(Rd,{id:e.id}),` Sign in with `,t.label]},e.id)}),(0,f.jsxs)(`button`,{onClick:V,disabled:E,className:se,style:ce,children:[(0,f.jsx)(Fs,{size:18}),` Sign in with a passkey`]})]}),(0,f.jsxs)(`div`,{className:`text-center mt-8 space-y-2`,children:[(0,f.jsx)(`button`,{onClick:ee,className:`block w-full text-sm hover:underline`,style:{color:ne},children:`Canât log in?`}),(0,f.jsx)(`a`,{href:`/pay-invoice`,className:`block w-full text-sm hover:underline`,style:{color:ne},children:`Make a one-time payment`})]})]}))}function Wd({announcement:e}){let t=`hsl(220 13% 13%)`;return(0,f.jsxs)(`div`,{className:`min-h-screen flex flex-col items-center justify-center px-4 py-16`,style:{background:`#f5fbfe`},children:[(0,f.jsx)(p,{className:`h-10 w-auto mb-6`,style:{color:t}}),(0,f.jsx)(`div`,{className:`w-full max-w-lg rounded-xl p-8 shadow-sm`,style:{background:`#ffffff`,border:`1px solid hsl(220 13% 91%)`},children:e&&e.trim()?(0,f.jsx)(`div`,{className:`maintenance-announcement text-center leading-relaxed [&_a]:text-[hsl(196_100%_46%)] [&_a]:underline [&_h1]:text-xl [&_h1]:font-bold [&_h2]:text-lg [&_h2]:font-bold [&_p]:mt-2`,
107style:{color:t},dangerouslySetInnerHTML:{__html:Ts.sanitize(e)}}):(0,f.jsxs)(`div`,{className:`text-center`,children:[(0,f.jsx)(`h1`,{className:`text-xl font-bold`,style:{color:t},children:`Weâll be back soon`}),(0,f.jsx)(`p`,{className:`text-sm mt-2`,style:{color:`hsl(220 9% 46%)`},children:`The portal is temporarily unavailable for scheduled maintenance.`})]})})]})}var Gd=`portal:gamification`;function Kd(){try{return JSON.parse(localStorage.getItem(Gd)||`{}`)}catch{return{}}}function qd(e){localStorage.setItem(Gd,JSON.stringify(e))}var Jd=[{id:`profile`,label:`Complete profile`,enabled:!0},{id:`first_service`,label:`Activate a service`,enabled:!0},{id:`paid_invoice`,label:`Pay first invoice`,enabled:!0},{id:`explore_addons`,label:`Explore add-ons`,enabled:!0},{id:`multi_service`,label:`Get a second service`,enabled:!0}];function Yd({client:e,services:t,invoices:n,setTab:r}){let[i,a]=(0,l.useState)(()=>Kd().addonsVisited||!1),[o,s]=(0,l.useState)(null);(0,l.useEffect)(()=>{Z(`/api/portal/account-setup`).then(e=>s(e.ok&&e.config?e.config:{enabled:!0,tasks:Jd})).catch(()=>s({enabled:!0,tasks:Jd}))},[]);let c=[`phonenumber`,`address1`,`city`,`state`,`postcode`,`country`],u=c.filter(t=>(e[t]||``).trim().length>0).length===c.length,d=(t||[]).filter(Td),p=d.length>=1,m=d.length>=2,h=(n||[]).some(e=>e.status===`Paid`),g={profile:{done:u,action:()=>r(`account`),icon:`ð¤`},first_service:{done:p,action:()=>r(`services`),icon:`ð`},paid_invoice:{done:h,action:()=>r(`billing`),icon:`ð³`},explore_addons:{done:i,action:()=>{qd({...Kd(),addonsVisited:!0}),a(!0),r(`order`)},icon:`â¨`},multi_service:{done:m,action:()=>r(`order`),icon:`â¡`}};if(!o||o.enabled===!1)return null;let _=(o.tasks||[]).filter(e=>e.enabled&&g[e.id]).map(e=>({id:e.id,label:e.label,...g[e.id]}));if(_.length===0)return null;let v=_.length,y=_.filter(e=>e.done).length,b=Math.round(y/v*100);return y===v?null:(0,f.jsxs)(`div`,{className:`px-3 py-4 border-t border-edge`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,f.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-widest text-faint`,children:`Account Setup`}),(0,f.jsxs)(`span`,{className:`text-[10px] font-bold`,style:{color:b===100?`#4ade80`:`var(--accent)`},children:[b,`%`]})]}),(0,f.jsx)(`div`,{className:`h-1.5 rounded-full overflow-hidden mb-3 bg-elevated`,children:(0,f.jsx)(`div`,{className:`h-full rounded-full transition-all duration-500`,style:{width:`${b}%`,background:`linear-gradient(90deg, var(--accent), #f97316)`}})}),(0,f.jsx)(`div`,{className:`space-y-1`,children:_.map(e=>(0,f.jsxs)(`button`,{onClick:e.done?void 0:e.action,className:`w-full flex items-center gap-2 px-2 py-1.5 rounded-lg text-left transition-colors`,style:{cursor:e.done?`default`:`pointer`,background:`transparent`},onMouseEnter:t=>{e.done||(t.currentTarget.style.background=`var(--bg-elevated)`)},onMouseLeave:e=>{e.currentTarget.style.background=`transparent`},children:[(0,f.jsx)(`span`,{className:`shrink-0 w-4 h-4 rounded-full flex items-center justify-center text-[9px]`,style:{background:e.done?`rgba(34,197,94,0.2)`:`var(--bg-elevated)`,border:e.done?`1px solid rgba(34,197,94,0.4)`:`1px solid var(--border)`,color:e.done?`#4ade80`:`var(--text-faint)`},children:e.done?`â`:``}),(0,f.jsx)(`span`,{className:`text-xs truncate`,style:{color:e.done?`var(--text-faint)`:`var(--text-muted)`,textDecoration:e.done?`line-through`:`none`,opacity:e.done?.5:1},children:e.label})]},e.id))})]})}function Xd(e,t,n,r=0,i=0){let a=e||[],o=t||[],s=n||[],c=a.filter(Td),l=o.filter(e=>e.status===`Unpaid`||e.status===`Overdue`),u=l.filter(e=>e.status===`Overdue`),d=s.filter(e=>e.status!==`Closed`).filter(e=>e.status===`Answered`),f=c.length,p=i||0,m;if(f===0&&p===0)m=`You don't have any active services yet.`;else{let e=[];f>0&&e.push(`${f} active service${f===1?``:`s`}`),p>0&&e.push(`${p} domain${p===1?``:`s`}`),m=`You have ${e.join(` and `)}.`}let h=[];return u.length>0?h.push(`${u.length===1?`1 invoice is overdue`:`${u.length} invoices are overdue`} â urgent attention needed.`):l.length>0&&h.push(`${l.length===1?`1 invoice is`:`${l.length} invoices are`} unpaid and awaiting payment.`),d.length>0&&h.push(`${d.length===1?`1 support ticket has`:`${d.length} support tickets have`} a reply waiting for you.`),r>0&&h.push(`You have ${r} unread notification${r===1?``:`s`}.`),h.length===0&&h.push(`All clear â have a great day!`),`${m}\n${h.join(` 108`)}`}function Zd({announcements:e,readIds:t,onMarkRead:n,onMarkAllRead:r}){let i=(e||[]).filter(e=>!t.includes(e.id)),a=(e||[]).filter(e=>t.includes(e.id));return(0,f.jsxs)(`div`,{className:`max-w-2xl mx-auto px-4 py-6 space-y-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`h1`,{className:`text-2xl font-bold text-primary flex items-center gap-2.5`,children:[(0,f.jsx)(Xs,{size:22,className:`text-faint shrink-0`}),`Notifications`]}),i.length>0&&(0,f.jsx)(`button`,{onClick:r,className:`btn-ghost text-xs`,children:`Mark all as read`})]}),i.length>0?(0,f.jsx)(`div`,{className:`space-y-3`,children:i.map(e=>(0,f.jsxs)(`div`,{className:`card p-4 flex gap-4 items-start`,style:{borderLeft:`3px solid var(--accent)`},children:[(0,f.jsx)(`div`,{className:`w-8 h-8 rounded-lg bg-elevated flex items-center justify-center shrink-0 mt-0.5`,children:(0,f.jsx)(kc,{size:14,className:`text-accent`})}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsx)(`p`,{className:`text-sm text-primary leading-relaxed whitespace-pre-wrap`,children:e.body}),e.created_at&&(0,f.jsx)(`p`,{className:`text-xs text-faint mt-1.5`,children:Q(e.created_at)})]}),(0,f.jsxs)(`button`,{onClick:()=>n(e.id),className:`btn-ghost text-xs shrink-0`,title:`Mark as read`,children:[(0,f.jsx)(Is,{size:14}),(0,f.jsx)(`span`,{className:`hidden sm:inline`,children:`Mark as read`})]})]},e.id))}):(0,f.jsxs)(`div`,{className:`card p-8 flex flex-col items-center gap-3 text-center`,children:[(0,f.jsx)(`div`,{className:`w-12 h-12 rounded-full bg-elevated flex items-center justify-center`,children:(0,f.jsx)(Is,{size:22,className:`text-accent`})}),(0,f.jsx)(`p`,{className:`text-sm font-semibold text-primary`,children:`You're all caught up`}),(0,f.jsx)(`p`,{className:`text-xs text-muted`,children:`No new notifications at the moment.`})]}),a.length>0&&(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(`p`,{className:`section-label pt-2`,children:`Read`}),a.map(e=>(0,f.jsxs)(`div`,{className:`card p-4 flex gap-4 items-start opacity-50`,children:[(0,f.jsx)(`div`,{className:`w-8 h-8 rounded-lg bg-elevated flex items-center justify-center shrink-0 mt-0.5`,children:(0,f.jsx)(kc,{size:14,className:`text-muted`})}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsx)(`p`,{className:`text-sm text-muted leading-relaxed whitespace-pre-wrap`,children:e.body}),e.created_at&&(0,f.jsx)(`p`,{className:`text-xs text-faint mt-1.5`,children:Q(e.created_at)})]})]},e.id))]})]})}function Qd({summary:e,needsAttention:t}){let[n,r]=(0,l.useState)(``),[i,a]=(0,l.useState)(!1),[o,s]=(0,l.useState)(!0);(0,l.useEffect)(()=>
108{if(r(``),a(!1),!e)return;let t=0,n=setInterval(()=>{t++,r(e.slice(0,t)),t>=e.length&&(clearInterval(n),a(!0))},18);return()=>clearInterval(n)},[e]),(0,l.useEffect)(()=>{let e=setInterval(()=>s(e=>!e),530);return()=>clearInterval(e)},[]);let c=t?`#fbbf24`:`#4ade80`;return(0,f.jsxs)(`div`,{className:`rounded-xl overflow-hidden border`,style:{background:`var(--terminal-bg)`,borderColor:`var(--terminal-border)`,fontFamily:`'Courier New', Courier, monospace`},children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 border-b`,style:{background:`var(--terminal-bar)`,borderColor:`var(--terminal-border)`},children:[(0,f.jsx)(`span`,{className:`w-3 h-3 rounded-full bg-rose-500/80`}),(0,f.jsx)(`span`,{className:`w-3 h-3 rounded-full bg-amber-400/80`}),(0,f.jsx)(`span`,{className:`w-3 h-3 rounded-full bg-emerald-500/80`}),(0,f.jsx)(`span`,{className:`flex-1 text-center text-[11px]`,style:{color:`var(--terminal-title)`},children:`account-summary â portal`})]}),(0,f.jsxs)(`div`,{className:`px-6 py-5 text-sm font-bold leading-relaxed`,style:{height:165,overflow:`hidden`},children:[(0,f.jsx)(`span`,{style:{color:`var(--terminal-prompt)`},children:`~ % `}),(0,f.jsx)(`span`,{style:{color:c},children:`status`}),(0,f.jsx)(`br`,{}),(0,f.jsx)(`span`,{style:{color:`var(--terminal-text)`,whiteSpace:`pre-wrap`},children:n}),(0,f.jsx)(`span`,{style:{display:`inline-block`,width:7,height:`0.9em`,background:i?o?c:`transparent`:c,marginLeft:1,verticalAlign:`text-bottom`,transition:i?`background 0.1s`:`none`}})]})]})}var $d=[{icon:Yc,eyebrow:`Cloud Hosting`,headline:`Scale up with managed cloud hosting`,body:`Guaranteed resources, NVMe SSD storage, and fully managed infrastructure â built for growing businesses.`,cta:`Explore cloud plans`,accent:`#6366f1`,bg:`rgba(99,102,241,0.07)`,border:`rgba(99,102,241,0.2)`},{icon:gc,eyebrow:`Domains`,headline:`Claim your perfect domain name`,body:`From .com to .com.au and beyond. Search, register, and manage everything in one place with free DNS included.`,cta:`Search for a domain`,accent:`#10b981`,bg:`rgba(16,185,129,0.07)`,border:`rgba(16,185,129,0.2)`},{icon:Dc,eyebrow:`Business Email`,headline:`Email at your own domain`,body:`Look professional from day one. Generous mailbox storage, spam filtering, and full mobile sync included.`,cta:`Set up email hosting`,accent:`#8b5cf6`,bg:`rgba(139,92,246,0.07)`,border:`rgba(139,92,246,0.2)`},{icon:Xc,eyebrow:`SSL Certificates`,headline:`Secure your site and boost SEO`,body:`Show visitors you're trustworthy. SSL certificates with one-click install, auto-renewal, and browser trust built in.`,cta:`Get SSL`,accent:`#f59e0b`,bg:`rgba(245,158,11,0.07)`,border:`rgba(245,158,11,0.2)`},{icon:Gc,eyebrow:`Website Backups`,headline:`Automated daily backups`,body:`Your data is priceless. Daily automated backups with 30-day history and one-click restore â just in case.`,cta:`Protect my data`,accent:`#f43f5e`,bg:`rgba(244,63,94,0.07)`,border:`rgba(244,63,94,0.2)`}],ef={server:Yc,globe:gc,mail:Dc,shield:Xc,refresh:Gc,package:Ic,megaphone:kc,gift:mc,bot:Zs};function tf(e){return{icon:ef[e.icon_name]||Ic,eyebrow:e.eyebrow,headline:e.headline,body:e.body,cta:e.cta_label,link:e.link_path||``,accent:e.accent,bg:e.accent+`12`,border:e.accent+`33`}}function nf({onOrder:e}){let[t,n]=(0,l.useState)(0),[r,i]=(0,l.useState)(!1),[a,o]=(0,l.useState)(!1),[s,c]=(0,l.useState)($d);(0,l.useEffect)(()=>{Z(`/api/portal/ctas`).then(e=>{e.ok&&e.ctas?.length&&c(e.ctas.map(tf))}).catch(()=>{})},[]);function u(e){r||(i(!0),setTimeout(()=>{n(e),i(!1)},180))}let d=s.length?t%s.length:0;function p(){u((d-1+s.length)%s.length)}function m(){u((d+1)%s.length)}(0,l.useEffect)(()=>{if(a||!s.length)return;let e=setInterval(()=>{i(!0),setTimeout(()=>{n(e=>(e+1)%s.length),i(!1)},180)},6e3);return()=>clearInterval(e)},[a,s]);let h=s[d],g=h.icon;return(0,f.jsxs)(`div`,{className:`relative rounded-xl overflow-hidden border`,style:{background:h.bg,borderColor:h.border,transition:`background 0.4s, border-color 0.4s`},onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),children:[(0,f.jsx)(`div`,{className:`absolute right-6 top-1/2 -translate-y-1/2 pointer-events-none select-none hidden sm:block`,style:{opacity:.07},children:(0,f.jsx)(g,{size:140,style:{color:h.accent},strokeWidth:1.5})}),(0,f.jsxs)(`div`,{className:`relative px-6 py-6 flex flex-col gap-4 sm:flex-row sm:items-center sm:gap-8`,style:{opacity:+!r,transition:`opacity 0.18s ease`},children:[(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsx)(`p`,{className:`text-[10px] font-bold uppercase tracking-widest mb-1.5`,style:{color:h.accent},children:h.eyebrow}),(0,f.jsx)(`h3`,{className:`text-base font-bold text-primary mb-1.5 leading-snug`,children:h.headline}),(0,f.jsx)(`p`,{className:`text-sm text-muted leading-relaxed max-w-lg`,children:h.body})]}),(0,f.jsxs)(`div`,{className:`flex flex-col items-start sm:items-end gap-4 shrink-0`,children:[(0,f.jsxs)(`button`,{onClick:()=>h.link?qu(h.link):e(),className:`inline-flex items-center gap-2 rounded-lg px-4 py-2.5 text-sm font-semibold text-white transition-opacity hover:opacity-90`,style:{background:h.accent,border:`none`,cursor:`pointer`,transition:`background 0.4s`},children:[h.cta,(0,f.jsx)(Js,{size:14})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsx)(`button`,{onClick:p,className:`w-6 h-6 flex items-center justify-center rounded text-muted hover:bg-elevated transition-colors`,children:(0,f.jsx)(tc,{size:14})}),(0,f.jsx)(`div`,{className:`flex items-center gap-1.5`,children:s.map((e,t)=>(0,f.jsx)(`button`,{onClick:()=>u(t),className:`rounded-full transition-all`,style:{width:t===d?16:6,height:6,background:t===d?h.accent:`var(--border)`}},t))}),(0,f.jsx)(`button`,{onClick:m,className:`w-6 h-6 flex items-center justify-center rounded text-muted hover:bg-elevated transition-colors`,children:(0,f.jsx)(nc,{size:14})})]})]})]})]})}function rf(){try{let e=e=>h({particleCount:70,spread:70,startVelocity:45,disableForReducedMotion:!0,...e});e({origin:{x:.5,y:.6}}),setTimeout(()=>e({angle:60,origin:{x:0,y:.7}}),120),setTimeout(()=>e({angle:120,origin:{x:1,y:.7}}),240)}catch{}}function af(){let[e,t]=(0,l.useState)(null),[n,r]=(0,l.useState)(!1),[i,a]=(0,l.useState)(!1),[o,s]=(0,l.useState)(!1);(0,l.useEffect)(()=>{Z(`/api/portal/nps`).then(e=>{e?.ok&&e.score!=null&&(t(e.score),r(!0)),s(!0)}).catch(()=>s(!0))},[]);let[c,u]=(0,l.useState)(!1),[d,p]=(0,l.useState)(``),[m,h]=(0,l.useState)(!1),[g,_]=(0,l.useState)(!1);async function v(e){t(e),a(!0),u(!0),p(``),h(!1);try{(await Z(`/api/portal/nps`,{method:`POST`,body:JSON.stringify({score:e})}))?.ok&&(r(!0),e>=9&&rf())}finally{a(!1)}}async function y(){if(d.trim()){_(!0);try{(await Z(`/api/portal/nps/feedback`,{method:`POST`,body:JSON.stringify({score:e,message:d.trim()})}))?.ok&&h(!0)}finally{_(!1)}}}return o?(0,f.jsxs)(`div`,{className:`card p-5`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsx)(`div`,{className:`w-10 h-10 rounded-xl bg-elevated flex items-center justify-center`,children:(0,f.jsx)(pc,{size:18,className:`text-accent`})}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-[11px] text-faint uppercase tracking-wider`,children:`Your feedback`}),(0,f.jsx)(`p`,{className:`text-sm font-semibold text-primary`,children:`How likely are you to recommend us to a friend or colleague?`})]})]}),(0,f.jsxs)(`div`,{className:`mt-4`,children:[(0,f.jsx)(`div`,{className:`grid grid-cols-11 gap-1`,children:Array.from({length:11}
108,(e,t)=>t).map(t=>{let n=e===t;return(0,f.jsx)(`button`,{onClick:()=>v(t),disabled:i,"aria-pressed":n,className:`rounded-lg text-xs sm:text-sm font-semibold py-2 transition-colors`,style:{background:n?`var(--accent)`:`var(--bg-elevated)`,color:n?`#fff`:`var(--text-primary)`,border:`1px solid ${n?`var(--accent)`:`var(--border)`}`},onMouseEnter:e=>{n||(e.currentTarget.style.borderColor=`var(--accent)`)},onMouseLeave:e=>{n||(e.currentTarget.style.borderColor=`var(--border)`)},children:t},t)})}),(0,f.jsxs)(`div`,{className:`flex justify-between mt-1.5`,children:[(0,f.jsx)(`span`,{className:`text-[11px] text-muted`,children:`Not likely`}),(0,f.jsx)(`span`,{className:`text-[11px] text-muted`,children:`Very likely`})]}),c?e>=9?(0,f.jsxs)(`div`,{className:`mt-4 text-center`,children:[(0,f.jsx)(`p`,{className:`text-sm font-semibold text-emerald-400`,children:`Thank you! ð`}),(0,f.jsx)(`p`,{className:`text-xs text-muted mt-1`,children:`We're so glad you're enjoying working with us â it means a lot.`})]}):m?(0,f.jsxs)(`div`,{className:`mt-4 text-center`,children:[(0,f.jsx)(`p`,{className:`text-sm font-semibold text-primary`,children:`Thanks â we've shared this with our team.`}),(0,f.jsx)(`p`,{className:`text-xs text-muted mt-1`,children:`Your comments go straight to the team who can act on them.`})]}):(0,f.jsxs)(`div`,{className:`mt-4`,children:[(0,f.jsx)(`p`,{className:`text-sm text-muted mb-2`,children:`Thanks for your honesty. What could we do to improve your score?`}),(0,f.jsx)(`textarea`,{value:d,onChange:e=>p(e.target.value),placeholder:`Tell us what would make this betterâ¦`,rows:3,className:`w-full text-sm`,style:{background:`var(--bg-elevated)`,border:`1px solid var(--border)`,borderRadius:8,padding:`0.5rem 0.65rem`,color:`var(--text-primary)`,resize:`vertical`}}),(0,f.jsx)(`button`,{onClick:y,disabled:g||!d.trim(),className:`btn-primary text-xs mt-2`,children:g?`Sendingâ¦`:`Send feedback`})]}):n?(0,f.jsxs)(`p`,{className:`text-center text-xs text-muted mt-3`,children:[`Thanks for your feedback! You rated us `,(0,f.jsxs)(`span`,{className:`text-primary font-semibold`,children:[e,`/10`]})]}):null]})]}):null}function of({accounts:e,loading:t,onSwitch:n}){return t?(0,f.jsx)(`div`,{className:`flex justify-center py-12`,children:(0,f.jsx)(X,{size:20,className:`animate-spin text-faint`})}):e.length?(0,f.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:e.map(e=>(0,f.jsxs)(`button`,{onClick:()=>n(e),className:`card p-4 text-left flex items-start gap-3 hover:border-accent/40 transition-colors`,children:[(0,f.jsx)(`div`,{className:`w-9 h-9 rounded-lg bg-elevated flex items-center justify-center shrink-0`,children:(0,f.jsx)(Qs,{size:16,className:`text-accent`})}),(0,f.jsxs)(`div`,{className:`min-w-0`,children:[(0,f.jsx)(`p`,{className:`text-sm font-semibold text-primary truncate`,children:e.company||e.name||e.email}),e.company&&(0,f.jsx)(`p`,{className:`text-xs text-muted truncate`,children:e.name}),(0,f.jsx)(kd,{status:e.status})]}),(0,f.jsx)(nc,{size:14,className:`text-faint shrink-0 mt-1 ml-auto`})]},e.id))}):null}function sf({client:e,services:t,invoices:n,tickets:r,unreadNotifications:i=0,domainCount:a=0,loading:o,setTab:s,hasOwnAccount:c=!0,isHomeAccount:u=!1,accountChosen:d=!1,totalAccessible:p=1,onSwitchAccount:m,mustSelectAccount:h=!1}){let g=(t||[]).filter(Td),_=(n||[]).filter(e=>e.status===`Unpaid`||e.status===`Overdue`),v=_.reduce((e,t)=>e+Sd(t),0),y=(r||[]).filter(e=>e.status!==`Closed`),b=!o&&_.length>0,x=!o&&(b||y.some(e=>e.status===`Answered`)||i>0),[S,C]=(0,l.useState)([]),[w,T]=(0,l.useState)(!1),E=(()=>{let e=new Date().getHours();return e<12?`Good morning`:e<17?`Good afternoon`:`Good evening`})(),D=g.length===0&&a===0,O=!o&&D&&p>1,k=c||u,A=!d&&O&&!k||h&&p>1,j=!d&&O&&k,M=e=>{Z(`/api/portal/switch-account`,{method:`POST`,body:JSON.stringify({accountId:e.id})}).then(e=>{e.ok&&e.token&&m(e.client,e.token)}).catch(()=>{})};if((0,l.useEffect)(()=>{!A&&!j||(T(!0),Z(`/api/portal/linked-accounts?page=1`).then(e=>C(e.accounts||[])).catch(()=>{}).finally(()=>T(!1)))},[A,j]),A){let e=h?S.filter(e=>e.status===`Active`):S.filter(e=>!e.is_current);return(0,f.jsxs)(`div`,{className:`max-w-2xl mx-auto px-4 py-10 space-y-6`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-xs text-faint uppercase tracking-widest mb-1`,children:`Welcome back`}),(0,f.jsx)(`h2`,{className:`text-xl font-bold text-primary`,children:`Select an account`}),(0,f.jsx)(`p`,{className:`text-sm text-muted mt-1`,children:h?`Choose an account to continue.`:`You have access to multiple accounts. Choose one to continue.`})]}),(0,f.jsx)(of,{accounts:e,loading:w,onSwitch:M})]})}return(0,f.jsxs)(`div`,{className:`max-w-4xl mx-auto px-4 py-6 space-y-6`,children:[!
108o&&(0,f.jsx)(Qd,{summary:`${E}, ${e.firstname}.\n${Xd(t,n,r,i,a)}`,needsAttention:x}),j?(0,f.jsxs)(`div`,{className:`space-y-3`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(Qs,{size:15,className:`text-accent`}),(0,f.jsx)(`p`,{className:`text-sm font-semibold text-primary`,children:`Your accounts`})]}),(0,f.jsx)(`p`,{className:`text-xs text-muted`,children:`You don't have any services on this account. Choose an account you manage to continue.`}),(0,f.jsx)(of,{accounts:S.filter(e=>!e.is_current),loading:w,onSwitch:M})]}):(0,f.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-3 gap-4`,children:[(0,f.jsxs)(`div`,{className:`card p-5 flex flex-col gap-4`,style:b?{borderColor:`rgba(245,158,11,0.4)`}:{},children:[(0,f.jsx)(`div`,{className:`w-10 h-10 rounded-xl bg-elevated flex items-center justify-center`,children:(0,f.jsx)(fc,{size:18,className:b?`text-amber-400`:`text-accent`})}),(0,f.jsxs)(`div`,{className:`flex-1`,children:[(0,f.jsx)(`p`,{className:`text-[11px] text-faint uppercase tracking-wider mb-1.5`,children:`Billing`}),(0,f.jsx)(`p`,{className:`text-2xl font-bold leading-none ${b?`text-amber-400`:`text-primary`}`,children:o?`â`:b?$(v):`All paid up`}),(0,f.jsx)(`p`,{className:`text-xs text-muted mt-1.5`,children:o?``:b?`${_.length} invoice${_.length===1?``:`s`} outstanding`:`No outstanding invoices`})]}),(0,f.jsx)(`button`,{onClick:()=>s(`billing`),className:`w-full text-xs ${b?`btn-success`:`btn-secondary`}`,children:b?`Pay now`:`View invoices`})]}),(0,f.jsxs)(`div`,{className:`card p-5 flex flex-col gap-4`,children:[(0,f.jsx)(`div`,{className:`w-10 h-10 rounded-xl bg-elevated flex items-center justify-center`,children:(0,f.jsx)(Ic,{size:18,className:`text-accent`})}),(0,f.jsxs)(`div`,{className:`flex-1`,children:[(0,f.jsx)(`p`,{className:`text-[11px] text-faint uppercase tracking-wider mb-1.5`,children:`Services`}),(0,f.jsx)(`p`,{className:`text-2xl font-bold leading-none text-primary`,children:o?`â`:g.length}),(0,f.jsx)(`p`,{className:`text-xs text-muted mt-1.5`,children:o?``:`Active service${g.length===1?``:`s`}`})]}),(0,f.jsx)(`button`,{onClick:()=>s(`services`),className:`w-full btn-secondary text-xs`,children:`Manage services`})]}),(0,f.jsxs)(`div`,{className:`card p-5 flex flex-col gap-4`,children:[(0,f.jsx)(`div`,{className:`w-10 h-10 rounded-xl bg-elevated flex items-center justify-center`,children:(0,f.jsx)(jc,{size:18,className:`text-accent`})}),(0,f.jsxs)(`div`,{className:`flex-1`,children:[(0,f.jsx)(`p`,{className:`text-[11px] text-faint uppercase tracking-wider mb-1.5`,children:`Support`}),(0,f.jsx)(`p`,{className:`text-2xl font-bold leading-none text-primary`,children:o?`â`:y.length>0?y.length:`Get help`}),(0,f.jsx)(`p`,{className:`text-xs text-muted mt-1.5`,children:o?``:y.length>0?`Open ticket${y.length===1?``:`s`}`:`We're here if you need us`})]}),(0,f.jsx)(`button`,{onClick:()=>s(`support`),className:`w-full btn-secondary text-xs`,children:y.length>0?`View tickets`:`Open a ticket`})]})]}),!o&&(0,f.jsx)(af,{}),!j&&(0,f.jsx)(nf,{onOrder:()=>s(`order`)}),!o&&!j&&g.length===0&&(n||[]).length===0&&(0,f.jsxs)(`div`,{className:`card p-6 text-center`,children:[(0,f.jsx)(`p`,{className:`text-sm text-muted mb-3`,children:`Ready to get started? Place your first order.`}),(0,f.jsxs)(`button`,{onClick:()=>s(`order`),className:`btn-primary text-sm mx-auto`,children:[(0,f.jsx)(Vc,{size:14}),` Place an order`]})]})]})}function cf({title:e,paragraphs:t,onClose:n}){return(0,l.useEffect)(()=>{let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n]),(0,ml.createPortal)((0,f.jsx)(`div`,{className:`fixed inset-0 flex items-center justify-center p-4`,style:{zIndex:1e4,background:`rgba(0,0,0,0.7)`},onClick:e=>{e.target===e.currentTarget&&n()},children:(0,f.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":e,className:`rounded-2xl border border-edge bg-surface shadow-xl w-full max-w-lg flex flex-col`,style:{maxHeight:`85vh`},children:[(0,f.jsxs)(`div`,{className:`p-5 border-b border-edge flex items-start justify-between gap-3`,children:[(0,f.jsxs)(`h3`,{className:`text-base font-bold text-primary flex items-center gap-2`,children:[(0,f.jsx)(vc,{size:16,className:`text-accent shrink-0`}),e]}),(0,f.jsx)(`button`,{onClick:n,"aria-label":`Close`,className:`text-faint hover:text-primary shrink-0`,children:(0,f.jsx)(pl,{size:16})})]}),(0,f.jsx)(`div`,{className:`p-5 overflow-y-auto flex flex-col gap-3`,children:t.map((e,t)=>(0,f.jsx)(`p`,{className:`text-sm text-muted leading-relaxed`,children:e},t))}),(0,f.jsx)(`div`,{className:`p-4 border-t border-edge flex justify-end`,children:(0,f.jsx)(`button`,{onClick:n,className:`btn-secondary`,children:`Got it`})})]})}),document.body)}function lf({label:e,onClick:t}){return(0,f.jsxs)(`button`,{onClick:t,className:`inline-flex items-center gap-1.5 text-xs font-medium text-muted hover:text-accent transition-colors`,children:[(0,f.jsx)(Ls,{size:13,className:`shrink-0`}),` `,e]})}var uf=[`A domain is your unique address on the internet, such as example.com.au.`,`Registering a domain gives you the licence to use that domain name for a set period. The registration needs to be renewed to keep the domain active and maintain your right to use it.`,`A domain registration does not include website hosting, email, SSL certificates or other services. These are separate services that can be connected to your domain.`,`This section shows the domains registered through your account, including their status and renewal details.`],df=[`Services are the products that provide the functionality behind your domains, such as website hosting, WordPress hosting, cloud servers, SSL certificates, email, spam filtering, security, backups and monitoring.`,`A domain can be linked to one or more services. For example, your domain might point to a website hosted on one service, while email and spam filtering are provided by another.`,`Unlike a domain registration, which gives you the licence to use a domain name, services provide the infrastru
108cture and functionality that make your website, email and other systems work.`,`This section shows the services associated with your account, including their status, billing and management options.`];function ff(e){if(e==null)return`â`;let t=parseFloat(e);return isNaN(t)?e:t>=1024?`${(t/1024).toFixed(1)} GB`:`${t} MB`}function pf(e){if(!e)return`â`;let t=parseInt(e);return t>=1073741824?`${(t/1073741824).toFixed(2)} GB`:t>=1048576?`${(t/1048576).toFixed(1)} MB`:t>=1024?`${(t/1024).toFixed(0)} KB`:`${t} B`}function mf(e){if(!e)return`Just started`;let t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60);return[t&&`${t}d`,n&&`${n}h`,r&&`${r}m`].filter(Boolean).join(` `)||`<1m`}function hf({pct:e,size:t=96,strokeWidth:n=9,label:r,sub:i,unlimited:a}){let o=(t-n)/2,s=2*Math.PI*o,c=a?0:Math.min(100,Math.max(0,e||0)),l=c>85?`#f87171`:c>70?`#fbbf24`:`#3b82f6`,u=c/100*s;return(0,f.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,alignItems:`center`,gap:`0.4rem`},children:[(0,f.jsxs)(`div`,{style:{position:`relative`,width:t,height:t},children:[(0,f.jsxs)(`svg`,{width:t,height:t,style:{transform:`rotate(-90deg)`},children:[(0,f.jsx)(`circle`,{cx:t/2,cy:t/2,r:o,fill:`none`,stroke:`var(--bg-elevated)`,strokeWidth:n}),(0,f.jsx)(`circle`,{cx:t/2,cy:t/2,r:o,fill:`none`,stroke:a?`#3b82f6`:l,strokeWidth:n,strokeDasharray:a?`${s} 0`:`${u} ${s}`,strokeLinecap:`round`,style:{transition:`stroke-dasharray 0.6s ease`}})]}),(0,f.jsx)(`div`,{style:{position:`absolute`,inset:0,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:1},children:(0,f.jsx)(`span`,{style:{fontSize:`1rem`,fontWeight:800,color:a?`#3b82f6`:l,lineHeight:1},children:a?`â`:`${Math.round(c)}%`})})]}),(0,f.jsxs)(`div`,{style:{textAlign:`center`},children:[(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,fontWeight:600,color:`var(--text-primary)`},children:r}),i&&(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-faint)`,marginTop:1},children:i})]})]})}function gf({warnings:e}){if(!e.length)return null;let t={critical:[`#f87171`,`rgba(248,113,113,0.08)`,`rgba(248,113,113,0.25)`],warning:[`#fbbf24`,`rgba(251,191,36,0.08)`,`rgba(251,191,36,0.25)`],info:[`#60a5fa`,`rgba(96,165,250,0.08)`,`rgba(96,165,250,0.25)`]};return(0,f.jsx)(`div`,{style:{marginBottom:`1rem`,display:`flex`,flexDirection:`column`,gap:`0.5rem`},children:e.map((e,n)=>{let[r,i,a]=t[e.level]||t.info;return(0,f.jsxs)(`div`,{style:{padding:`0.6rem 0.9rem`,borderRadius:10,background:i,border:`1px solid ${a}`,fontSize:`0.8125rem`,color:r,display:`flex`,alignItems:`flex-start`,gap:`0.5rem`},children:[(0,f.jsx)(`span`,{style:{fontSize:`0.9rem`,lineHeight:1.3,flexShrink:0},children:e.level===`critical`?`â ï¸`:e.level===`warning`?`â¡`:`â¹ï¸`}),(0,f.jsx)(`span`,{children:e.msg})]},n)})})}function _f(e){let t=[];if(e.type===`cpanel`){let n=parseFloat(e.disk_pct)||0;if(!e.disk_unlimited&&n>=90?t.push({level:`critical`,msg:`Disk usage is critically high at ${n.toFixed(0)}% â free up space or upgrade your plan immediately.`}):!e.disk_unlimited&&n>=80&&t.push({level:`warning`,msg:`Disk usage is at ${n.toFixed(0)}% â consider cleaning up files or upgrading your plan.`}),!e.bw_unlimited&&e.bw_limit_bytes>0){let n=Math.round(e.bw_used_bytes/e.bw_limit_bytes*100);n>=90?t.push({level:`critical`,msg:`Bandwidth usage is at ${n}% â your site may be suspended if it reaches 100%.`}):n>=80&&t.push({level:`warning`,msg:`Bandwidth usage is at ${n}% â monitor closely or upgrade your plan.`})}(e.ssl_certs||[]).forEach(e=>{let n=e.expires?Math.floor((e.expires*1e3-Date.now())/864e5):null;n!==null&&(n<0?t.push({level:`critical`,msg:`SSL certificate for ${e.domain} has expired.`}):n<7?t.push({level:`critical`,msg:`SSL certificate for ${e.domain} expires in ${n} day${n===1?``:`s`} â renew immediately.`}):n<30&&t.push({level:`warning`,msg:`SSL certificate for ${e.domain} expires in ${n} days.`}))}),(e.email_accounts||[]).forEach(e=>{e.disk_quota>0&&e.disk_used>=e.disk_quota*.95&&t.push({level:`warning`,msg:`Email account ${e.email} is at quota (${e.humandiskused} / ${e.humandiskquota}).`})}),e.max_emails>0&&e.email_count>=Math.floor(e.max_emails*.9)&&t.push({level:`warning`,msg:`Email account limit nearly reached: ${e.email_count} of ${e.max_emails} used.`}),e.max_dbs>0&&e.db_count>=Math.floor(e.max_dbs*.9)&&t.push({level:`warning`,msg:`MySQL database limit nearly reached: ${e.db_count} of ${e.max_dbs} used.`})}if(e.type===`proxmox`){e.vm_status===`stopped`&&t.push({level:`critical`,msg:`Your VPS is currently stopped.`});let n=Math.round((e.cpu_usage||0)*100);if(n>=90?t.push({level:`critical`,msg:`CPU usage is critically high at ${n}%.`}):n>=80&&t.push({level:`warning`,msg:`CPU usage is high at ${n}%.`}),e.mem_max>0){let n=Math.round(e.mem_used/e.mem_max*100);n>=90?t.push({level:`critical`,msg:`RAM usage is critically high at ${n}%.`}):n>=80&&t.push({level:`warning`,msg:`RAM usage is high at ${n}%.`})}if(e.disk_max>0){let n=Math.round(e.disk_used/e.disk_max*100);n>=90&&t.push({level:`warning`,msg:`VPS disk usage is high at ${n}%.`})}}if((e.type===`enhance`||e.type===`clouddedicated`)&&(e.disk_pct>=90?t.push({level:`critical`,msg:`Disk usage is critically high at ${e.disk_pct?.toFixed(0)}%.`}):e.disk_pct>=80&&t.push({level:`warning`,msg:`Disk usage is at ${e.disk_pct?.toFixed(0)}%.`}),e.bw_pct>=90?t.push({level:`critical`,msg:`Bandwidth usage is critically high at ${e.bw_pct?.toFixed(0)}%.`}):e.bw_pct>=80&&t.push({level:`warning`,msg:`Bandwidth usage is at ${e.bw_pct?.toFixed(0)}%.`})),e.type===`clouddedicated`&&e.server_stats){let n=e.server_stats;if(n.status&&n.status!==`online`&&t.push({level:`critical`,msg:`Your dedicated server is currently ${n.status}.`}),n.disk?.total>0){let e=Math.round(n.disk.used/n.disk.total*100);e>=90?t.push({level:`critical`,msg:`Server disk usage is critically high at ${e}% â free up space to avoid downtime.`}):e>=80&&t.push({level:`warning`,msg:`Server disk usage is at ${e}%.`})}}return t}function vf({serviceId:e,seed:t}){let[n,r]=(0,l.useState)(()=>typeof t==`number`?[t]:[]);(0,l.useEffect)(()=>{let t=!0,n=()=>Z(`/api/portal/services/${e}/load`).then(e=>{t&&typeof e?.load==`number`&&r(t=>[...t,e.load].slice(-60))}).catch(()=>{});n();let i=setInterval(n,5e3);return()=>{t=!1,clearInterval(i)}},[e]);let i=n.length?n[n.length-1]:null,a=n.length?Math.max(...n):null,o=n.length?Math.min(...n):0,s=n.length?Math.max(...n):1,c=s-o<.05?o+.05:s,u=e=>3+(n.length<=1?0:e/(n.length-1)*254),d=e=>41-(e-o)/(c-o)*38,p=n.map((e,t)=>`${t===0?`M`:`L`}${u(t).toFixed(1)},${d(e).toFixed(1)}`).join(` `),m=n.length?`${p} L${u(n.length-1).toFixed(1)},44 L${u(0).toFixed(1)},44 Z`:``;return(0,f.jsxs)(`div`,{style:{marginBottom:`1.25rem`},children:[(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`baseline`,justifyContent:`space-between`,marginBottom:`0.4rem`},children:[(0,f.jsx)(`span`,{style:{fontSize:`0.8125rem`,color:`var(--text-faint)`},children:`Load average`}),(0,f.jsx)(`span`,{style:{fontSize:`0.95rem`,fontWeight:700,color:`var(--text-primary)`,fontVariantNumeric:`tabular-nums`},children:i==null?`â`:i.toFixed(2)})]}
108),(0,f.jsxs)(`svg`,{viewBox:`0 0 260 44`,preserveAspectRatio:`none`,style:{width:`100%`,height:44,display:`block`},children:[(0,f.jsx)(`defs`,{children:(0,f.jsxs)(`linearGradient`,{id:`ldg-${e}`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,f.jsx)(`stop`,{offset:`0%`,stopColor:`var(--accent)`,stopOpacity:`0.28`}),(0,f.jsx)(`stop`,{offset:`100%`,stopColor:`var(--accent)`,stopOpacity:`0`})]})}),n.length>1&&(0,f.jsx)(`path`,{d:m,fill:`url(#ldg-${e})`}),n.length>1?(0,f.jsx)(`path`,{d:p,fill:`none`,stroke:`var(--accent)`,strokeWidth:`1.5`,strokeLinejoin:`round`,strokeLinecap:`round`}):(0,f.jsx)(`line`,{x1:3,y1:44/2,x2:257,y2:44/2,stroke:`var(--border)`,strokeWidth:`1`,strokeDasharray:`3 3`}),i!=null&&(0,f.jsx)(`circle`,{cx:u(n.length-1),cy:d(i),r:`2.5`,fill:`var(--accent)`})]}),(0,f.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,fontSize:`0.75rem`,color:`var(--text-faint)`,marginTop:`0.25rem`},children:[(0,f.jsx)(`span`,{children:n.length>1?`Live · ${n.length} samples`:`Sampling liveâ¦`}),a!=null&&n.length>1&&(0,f.jsxs)(`span`,{children:[`peak `,a.toFixed(2)]})]})]})}function yf({data:e,cardStyle:t,sectionHead:n,serviceId:r}){let i=e.server_stats;if(!i)return(0,f.jsxs)(`div`,{style:t,children:[(0,f.jsx)(`p`,{style:n,children:`Dedicated Server`}),(0,f.jsx)(`p`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`},children:e.error||`Server details are not available yet.`})]});let a=i.status===`online`,o=a?`#34d399`:i.status?`#f87171`:`#fbbf24`,s=i.disk,c=s?.total>0?Math.round(s.used/s.total*100):0,l=i.ram,u=i.swap,d=l?.total>0?Math.round(l.used/l.total*100):0,p=u?.total>0?Math.round(u.used/u.total*100):0,m=[[`Hostname`,i.hostname||`â`],[`IP address`,i.ip||`â`]].filter(Boolean);return(0,f.jsxs)(`div`,{style:t,children:[(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:`0.85rem`},children:[(0,f.jsx)(`p`,{style:{...n,marginBottom:0},children:`Dedicated Server`}),(0,f.jsxs)(`span`,{style:{fontSize:`0.8125rem`,fontWeight:600,color:o,display:`flex`,alignItems:`center`,gap:`0.35rem`},children:[(0,f.jsx)(`span`,{style:{width:8,height:8,borderRadius:999,background:o,display:`inline-block`}}),a?`Online`:i.status?i.status[0].toUpperCase()+i.status.slice(1):`Unknown`]})]}),(0,f.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:`0.6rem 1rem`,marginBottom:`1.25rem`},children:m.map(([e,t])=>(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-faint)`},children:e}),(0,f.jsx)(`div`,{style:{fontSize:`0.875rem`,color:`var(--text-primary)`,marginTop:2,wordBreak:`break-word`},children:t})]},e))}),i.load!=null&&r!=null&&(0,f.jsx)(vf,{serviceId:r,seed:i.load}),(s||l||u)&&(0,f.jsxs)(`div`,{style:{display:`flex`,gap:`1.5rem`,justifyContent:`center`,flexWrap:`wrap`,padding:`0.25rem 0`},children:[s&&(0,f.jsx)(hf,{pct:c,label:`Disk`,sub:`${pf(s.used)} / ${pf(s.total)}`}),l&&(0,f.jsx)(hf,{pct:d,label:`RAM`,sub:`${pf(l.used)} / ${pf(l.total)}`}),u&&(0,f.jsx)(hf,{pct:p,label:`Swap`,sub:`${pf(u.used)} / ${pf(u.total)}`})]}),i.update_required&&(0,f.jsx)(`div`,{style:{marginTop:`0.75rem`,fontSize:`0.8125rem`,color:`#fbbf24`},children:`A server software update is available.`})]})}function bf({label:e,used:t,max:n,color:r}){let i=n>0?Math.min(100,Math.round(t/n*100)):0,a=n>0,o=i>85?`#f87171`:i>70?`#fbbf24`:r;return(0,f.jsxs)(`div`,{style:{padding:`0.6rem 0.75rem`,borderRadius:10,background:`var(--bg-elevated)`,border:`1px solid var(--border)`},children:[(0,f.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`baseline`,marginBottom:a?`0.35rem`:0},children:[(0,f.jsx)(`span`,{style:{fontSize:`0.8125rem`,color:`var(--text-faint)`},children:e}),(0,f.jsxs)(`span`,{style:{fontSize:`1rem`,fontWeight:800,color:t>0?r:`var(--text-faint)`},children:[t??`â`,n>0?(0,f.jsxs)(`span`,{style:{fontSize:`0.8125rem`,fontWeight:400,color:`var(--text-faint)`},children:[` / `,n]}):``]})]}),a&&(0,f.jsx)(`div`,{style:{height:3,background:`var(--bg-surface)`,borderRadius:999,overflow:`hidden`},children:(0,f.jsx)(`div`,{style:{height:`100%`,width:`${i}%`,background:o,borderRadius:999,transition:`width 0.5s`}})})]})}function xf({accounts:e}){let[t,n]=(0,l.useState)(!1);if(!e?.length)return null;e.filter(e=>e.disk_quota>0);let r=t?e:e.slice(0,4);return(0,f.jsxs)(`div`,{style:{marginTop:`0.75rem`},children:[(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,fontWeight:600,textTransform:`uppercase`,letterSpacing:`0.07em`,color:`var(--text-faint)`,marginBottom:`0.5rem`},children:`Email Account Quotas`}),r.map((e,t)=>{let n=e.disk_quota>0?Math.min(100,Math.round(e.disk_used/e.disk_quota*100)):0,r=n>85?`#f87171`:n>70?`#fbbf24`:`#8b5cf6`;return(0,f.jsxs)(`div`,{style:{marginBottom:`0.45rem`},children:[(0,f.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,fontSize:`0.8125rem`,marginBottom:`0.2rem`},children:[(0,f.jsx)(`span`,{style:{color:`var(--text-muted)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,maxWidth:`60%`},children:e.email}),(0,f.jsx)(`span`,{style:{color:`var(--text-faint)`,flexShrink:0},children:e.disk_quota>0?`${e.humandiskused||pf(e.disk_used)} / ${e.humandiskquota||pf(e.disk_quota)}`:e.humandiskused||pf(e.disk_used)})]}),e.disk_quota>0&&(0,f.jsx)(`div`,{style:{height:3,background:`var(--bg-elevated)`,borderRadius:999,overflow:`hidden`},children:(0,f.jsx)(`div`,{style:{height:`100%`,width:`${n}%`,background:r,borderRadius:999}})})]},t)}),e.length>4&&(0,f.jsx)(`button`,{onClick:()=>n(e=>!e),style:{background:`none`,border:`none`,color:`var(--accent)`,fontSize:`0.8125rem`,cursor:`pointer`,padding:0,marginTop:`0.25rem`},children:t?`Show less`:`Show all ${e.length} accounts`})]})}function Sf(){return(0,f.jsxs)(`div`,{style:{marginTop:`0.75rem`,padding:`0.75rem`,borderRadius:10,background:`rgba(59,130,246,0.08)`,border:`1px solid rgba(59,130,246,0.25)`},children:[(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`0.6rem`,marginBottom:`0.5rem`},children:[(0,f.jsx)(`div`,{style:{display:`flex`,gap:3},children:[0,1,2].map(e=>(0,f.jsx)(`span`,{style:{display:`inline-block`,width:7,height:7,borderRadius:`50%`,background:`#60a5fa`,animation:`bounce 1.2s ease-in-out infinite`,animationDelay:`${e*200}ms`}},e))}),(0,f.jsx)(`span`,{style:{fontSize:`0.8125rem`,fontWeight:600,color:`#60a5fa`},children:`Provisioning in progress`})]}),(0,f.jsx)(`p`,{style:{fontSize:`0.8125rem`,color:`rgba(147,197,253,0.7)`,margin:0},children:`Your service is being set up. This usually takes a few minutes â we'll send you a confirmation once it's ready.`}),(0,f.jsx)(`div`,{style:{marginTop:`0.6rem`,height:4,background:`rgba(59,130,246,0.15)`,borderRadius:999,overflow:`hidden`},children:(0,f.jsx)(`div`,{style:{height:`100%`,width:`65%`,background:`rgba(96,165,250,0.6)`,borderRadius:999,animation:`pulse 2s ease-in-out infinite`}})}),(0,f.jsx)(`style`,{children:`@keyframes bounce{0%,80%,100%{transform:translateY(0)}40%{transform:translateY(-6px)}}`})]})}function Cf({serviceId:e,setTab:t}){let[n,r]=(0,l.useState)(null),[i,a]=(0,l.useState)(!1),[o,s]=(0,l.useState)(null);(0,l.useEffect)(()=>{Z(`/api/portal/services/${e}/invoices`).then(e=>r(e.invoices||[])).catch(()=>r([]))},[e]);async function c(){a(!0);try{s(await Z(`/api/portal/services/${e}/reactivate`,{method:`POST`}))}catch(e){s({ok:!1,error:e.message})}finally{a(!1)}}let u=(n||[]).reduce((e,t)=>
108e+parseFloat(t.total||0),0);return(0,f.jsxs)(`div`,{style:{marginTop:`0.75rem`,padding:`0.75rem`,borderRadius:10,background:`rgba(245,158,11,0.07)`,border:`1px solid rgba(245,158,11,0.25)`},children:[(0,f.jsx)(`p`,{style:{fontSize:`0.8125rem`,fontWeight:600,color:`#fbbf24`,marginBottom:`0.4rem`},children:`â Service Suspended`}),n===null?(0,f.jsx)(`p`,{style:{fontSize:`0.8125rem`,color:`rgba(251,191,36,0.6)`},children:`Loading invoice statusâ¦`}):n.length>0?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`p`,{style:{fontSize:`0.8125rem`,color:`rgba(251,191,36,0.75)`,marginBottom:`0.5rem`},children:[`You have `,n.length,` outstanding invoice`,n.length===1?``:`s`,` totalling `,(0,f.jsxs)(`strong`,{children:[`$`,u.toFixed(2)]}),`. Paying these should restore your service.`]}),n.map(e=>(0,f.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,fontSize:`0.8125rem`,color:`rgba(251,191,36,0.55)`,padding:`0.2rem 0`},children:[(0,f.jsxs)(`span`,{children:[`Invoice `,_d(e),` · Due `,e.duedate?new Date(e.duedate).toLocaleDateString(`en-AU`):`â`]}),(0,f.jsxs)(`span`,{children:[`$`,parseFloat(e.total).toFixed(2)]})]},e.id)),(0,f.jsx)(`button`,{onClick:()=>t(`billing`),style:{marginTop:`0.5rem`,fontSize:`0.8125rem`,color:`var(--accent)`,background:`none`,border:`none`,cursor:`pointer`,padding:0},children:`View & pay invoices â`})]}):(0,f.jsx)(`p`,{style:{fontSize:`0.8125rem`,color:`rgba(251,191,36,0.65)`,marginBottom:`0.5rem`},children:`No outstanding invoices. You can request to have this service reactivated.`}),o?o.ok?(0,f.jsxs)(`div`,{style:{marginTop:`0.6rem`,fontSize:`0.8125rem`,color:`#34d399`},children:[`â Reactivation request submitted â a support ticket (#`,o.ticketId,`) has been created. Our team will process it shortly.`]}):(0,f.jsx)(`div`,{style:{marginTop:`0.6rem`,fontSize:`0.8125rem`,color:`#f87171`},children:o.error||`Request failed`}):(0,f.jsx)(`button`,{className:`btn-primary`,style:{marginTop:`0.6rem`},onClick:c,disabled:i,children:i?`Requestingâ¦`:`Request Reactivation`})]})}function wf({serviceId:e,service:t,setTab:n}){let[r,i]=(0,l.useState)(0),[a,o]=(0,l.useState)(!1),[s,c]=(0,l.useState)(null);async function u(){o(!0);try{c(await Z(`/api/portal/services/${e}/reactivate`,{method:`POST`})),i(2)}catch(e){c({ok:!1,error:e.message}),i(2)}finally{o(!1)}}let d=t?.status===`Cancelled`;return r===0?(0,f.jsx)(`div`,{style:{marginTop:`0.75rem`,padding:`0.75rem`,borderRadius:10,background:`rgba(239,68,68,0.07)`,border:`1px solid rgba(239,68,68,0.2)`},children:(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:`0.75rem`},children:[(0,f.jsxs)(`p`,{style:{fontSize:`0.8125rem`,color:`rgba(252,165,165,0.8)`,margin:0},children:[`Service `,d?`cancelled`:`terminated`,` â would you like to restore it?`]}),(0,f.jsx)(`button`,{className:`btn-primary`,style:{flexShrink:0},onClick:()=>i(1),children:`Reactivate â`})]})}):r===1?(0,f.jsxs)(`div`,{style:{marginTop:`0.75rem`,padding:`0.75rem`,borderRadius:10,background:`rgba(249,115,22,0.07)`,border:`1px solid rgba(249,115,22,0.25)`,display:`flex`,flexDirection:`column`,gap:`0.6rem`},children:[(0,f.jsxs)(`p`,{style:{fontSize:`0.8125rem`,fontWeight:600,color:`#fb923c`,margin:0},children:[`Reactivate "`,t?.name,`"`]}),(0,f.jsx)(`p`,{style:{fontSize:`0.8125rem`,color:`rgba(253,186,116,0.7)`,margin:0},children:`Clicking confirm will submit a reactivation request to our support team. We'll be in touch to arrange payment and restore your service.`}),(0,f.jsxs)(`div`,{style:{display:`flex`,gap:`0.5rem`},children:[(0,f.jsx)(`button`,{onClick:u,disabled:a,style:{padding:`0.4rem 1rem`,borderRadius:8,background:`rgba(249,115,22,0.2)`,border:`1px solid rgba(249,115,22,0.35)`,color:`#fb923c`,fontSize:`0.8125rem`,fontWeight:600,cursor:`pointer`,opacity:a?.6:1},children:a?`Submittingâ¦`:`Confirm Request`}),(0,f.jsx)(`button`,{onClick:()=>i(0),style:{background:`none`,border:`none`,color:`rgba(255,255,255,0.3)`,fontSize:`0.8125rem`,cursor:`pointer`},children:`Cancel`})]})]}):(0,f.jsx)(`div`,{style:{marginTop:`0.75rem`,padding:`0.75rem`,borderRadius:10,background:s?.ok?`rgba(16,185,129,0.08)`:`rgba(239,68,68,0.08)`,border:`1px solid ${s?.ok?`rgba(16,185,129,0.25)`:`rgba(239,68,68,0.25)`}`},children:s?.ok?(0,f.jsxs)(`div`,{style:{fontSize:`0.8125rem`,color:`#34d399`},children:[`â Reactivation request submitted â support ticket #`,s.ticketId,` has been opened. We'll follow up shortly.`,(0,f.jsx)(`button`,{onClick:()=>n(`support`),style:{marginLeft:`0.5rem`,color:`var(--accent)`,background:`none`,border:`none`,cursor:`pointer`,textDecoration:`underline`,fontSize:`0.8125rem`},children:`View ticket â`})]}):(0,f.jsx)(`p`,{style:{fontSize:`0.8125rem`,color:`#f87171`,margin:0},children:s?.error||`Request failed`})})}async function Tf(e,t){let n=window.open(``,`_blank`);if(n)try{n.opener=null,n.document.write(`<!doctype html><meta name="referrer" content="no-referrer"><p style="font-family:system-ui;padding:2rem;color:#888">Opening ${t}â¦</p>`),n.document.close()}catch{}try{let t=await Z(e,{method:`POST`});return!t?.ok||!t?.url?(n&&n.close(),{error:t?.error||`Could not create session`}):n?(n.location.replace(t.url),{}):{blockedUrl:t.url}}catch(e){return n&&n.close(),{error:e.message||`Failed to connect`}}}function Ef({url:e,label:t,onClose:n}){return(0,f.jsx)(`div`,{style:{position:`fixed`,inset:0,background:`rgba(0,0,0,0.55)`,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`1rem`,zIndex:60},onClick:n,children:(0,f.jsxs)(`div`,{style:{background:`var(--bg-surface)`,border:`1px solid var(--border)`,borderRadius:14,padding:`1.5rem`,width:`100%`,maxWidth:420},onClick:e=>e.stopPropagation(),children:[(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:`1rem`},children:[(0,f.jsx)(`h2`,{style:{fontSize:`1.05rem`,fontWeight:700,color:`var(--text-primary)`,margin:0},children:`Your browser blocked the new tab`}),(0,f.jsx)(`button`,{onClick:n,style:{background:`none`,border:`none`,cursor:`pointer`,color:`var(--text-muted)`},children:(0,f.jsx)(pl,{size:18})})]}),(0,f.jsxs)(`p`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`,margin:`0 0 1.1rem`,lineHeight:1.5},children:[`Use the button below to open `,t,`. To skip this next time, allow pop-ups for this site in your browser settings.`]}),(0,f.jsxs)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,onClick:n,style:{display:`flex`,width:`100%`,alignItems:`center`,justifyContent:`center`,gap:`0.55rem`,padding:`0.8rem 1rem`,borderRadius:10,fontSize:`0.95rem`,fontWeight:700,background:`var(--accent)`,color:`#fff`,textDecoration:`none`,boxSizing:`border-box`},children:[`Open `,t,` `,(0,f.jsx)(Js,{size:16})]})]})})}function Df({serviceId:e}){let[t,n]=(0,l.useState)(!1),[r,i]=(0,l.useState)(null),[a,o]=(0,l.useState)(null);async function s(){if(t)return;n(!0),i(null);let r=await Tf(`/api/portal/services/${e}/cpanel-sso`,`cPanel`);r.error?i(r.error):r.blockedUrl&&o(r.blockedUrl),n(!1)}return(0,f.jsxs)(`div`,{style:{marginTop:`1.1rem`},children:[(0,f.jsxs)(`button`,{onClick:s,disabled:t,style:{display:`flex`,width:`100%`,alignItems:`center`,justifyContent:`center`,gap:`0.55rem`,padding:`0.8rem 1rem`,borderRadius:10,fontSize:`0.95rem`,fontWeight:700,background:t?`var(--bg-elevated)`:`var(--accent)`,color:t?`var(--text-muted)`:`#fff`,border:`none`,cursor:t?`default`:`pointer`,transition:`background 0.15s`},children:[t?(0,f.jsx)(`span`,{style:{display:`inline-block`,width:14,height:14,border:`2px solid currentColor`,borderTopColor:`transparent`,borderRadius:`50%`,animation:`spin 0.7s linear infinite`}}):(0,f.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,f.jsx)(`rect`,{x:`3`,y:`11`,width:`18`,height:`11`,rx:`2`}),(0,f.jsx)(`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`})]}),t?`Opening cPanelâ¦`:`Log in to cPanel`,!t&&(0,f.jsx)(Js,{size:16})]}),r&&(0,f.jsx)(`p`,{style:{fontSize:`0.8125rem`,color:`#f87171`,marginTop:`0.4rem`},children:r}),a&&(0,f.jsx)(Ef,{url:a,label:`cPanel`,onClose:()=>o(null)})]})}var Of=80;function kf({serviceId:e,username:t,onClose:n}){let[r,i]=(0,l.useState)(``),[a,o]=(0,l.useState)(!1),[s,c]=(0,l.useState)(0),[u,d]=(0,l.useState)(!1),[p,m]=(0,l.useState)(!1),[h,g]=(0,l.useState)(``),[_,v]=(0,l.useState)(!1),y=(0,l.useRef)(0);(0,l.useEffect)(()=>
108{if(!r){c(0),d(!1);return}d(!0);let t=++y.current,n=setTimeout(()=>{Z(`/api/portal/services/${e}/password-strength`,{method:`POST`,body:JSON.stringify({password:r})}).then(e=>{t===y.current&&e?.ok&&c(e.score??0)}).catch(()=>{}).finally(()=>{t===y.current&&d(!1)})},350);return()=>clearTimeout(n)},[r,e]);let b=s>=Of;async function x(){if(!(p||!b)){m(!0),g(``);try{let t=await Z(`/api/portal/services/${e}/cpanel-password`,{method:`POST`,body:JSON.stringify({password:r})});if(!t?.ok){g(t?.error||`Could not reset the password.`);return}v(!0)}catch(e){g(e.message||`Could not reset the password.`)}finally{m(!1)}}}let S={position:`fixed`,inset:0,background:`rgba(0,0,0,0.55)`,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`1rem`,zIndex:60},C={background:`var(--bg-surface)`,border:`1px solid var(--border)`,borderRadius:14,padding:`1.5rem`,width:`100%`,maxWidth:460,maxHeight:`85vh`,overflowY:`auto`},w={background:`var(--bg-elevated)`,border:`1px solid var(--border)`,borderRadius:8,padding:`0.55rem 2.2rem 0.55rem 0.65rem`,fontSize:`0.9rem`,color:`var(--text-primary)`,width:`100%`,fontFamily:a?`monospace`:`inherit`},T=s>=Of?`#34d399`:s>=50?`#fbbf24`:`#f87171`;return(0,f.jsx)(`div`,{style:S,onClick:n,children:(0,f.jsxs)(`div`,{style:C,onClick:e=>e.stopPropagation(),children:[(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:`1rem`},children:[(0,f.jsx)(`h2`,{style:{fontSize:`1.05rem`,fontWeight:700,color:`var(--text-primary)`,margin:0},children:_?`Password reset`:`Reset cPanel password`}),(0,f.jsx)(`button`,{onClick:n,style:{background:`none`,border:`none`,cursor:`pointer`,color:`var(--text-muted)`},children:(0,f.jsx)(pl,{size:18})})]}),_?(0,f.jsxs)(`div`,{style:{fontSize:`0.875rem`,color:`var(--text-muted)`,lineHeight:1.6},children:[(0,f.jsxs)(`div`,{className:`alert-success`,style:{marginBottom:`0.9rem`},children:[(0,f.jsx)($s,{size:15}),`The cPanel password for `,(0,f.jsx)(`strong`,{children:t}),` has been updated.`]}),(0,f.jsxs)(`p`,{style:{marginTop:0},children:[(0,f.jsx)(Y,{size:12,style:{display:`inline`,verticalAlign:`-1px`,marginRight:4}}),`We have `,(0,f.jsx)(`strong`,{children:`not saved this password`}),` and cannot show it to you again. If you havenât recorded it somewhere safe, do that now before closing.`]}),(0,f.jsx)(`button`,{className:`btn-primary`,style:{width:`100%`,marginTop:`0.5rem`},onClick:n,children:`Done`})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`p`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`,margin:`0 0 0.9rem`,lineHeight:1.5},children:[`Sets a new password for cPanel user `,(0,f.jsx)(`strong`,{style:{color:`var(--text-primary)`,fontFamily:`monospace`},children:t}),`. This is also the password for FTP and any other cPanel logins on this account.`]}),h&&(0,f.jsxs)(`div`,{className:`alert-error`,style:{marginBottom:`0.9rem`},children:[(0,f.jsx)(Y,{size:15}),h]}),(0,f.jsxs)(`div`,{style:{position:`relative`},children:[(0,f.jsx)(`input`,{type:a?`text`:`password`,style:w,value:r,placeholder:`New password`,autoComplete:`new-password`,autoFocus:!0,onChange:e=>{i(e.target.value),g(``)},onKeyDown:e=>{e.key===`Enter`&&x()}}),(0,f.jsx)(`button`,{type:`button`,onClick:()=>o(e=>!e),"aria-label":a?`Hide password`:`Show password`,title:a?`Hide password`:`Show password`,style:{position:`absolute`,right:8,top:`50%`,transform:`translateY(-50%)`,background:`none`,border:`none`,padding:2,cursor:`pointer`,color:`var(--text-faint)`,display:`flex`,alignItems:`center`},children:a?(0,f.jsx)(uc,{size:15}):(0,f.jsx)(dc,{size:15})})]}),(0,f.jsxs)(`div`,{style:{marginTop:`0.6rem`},children:[(0,f.jsx)(`div`,{style:{height:5,borderRadius:3,background:`var(--bg-elevated)`,overflow:`hidden`},children:(0,f.jsx)(`div`,{style:{height:`100%`,width:`${Math.min(100,s)}%`,background:T,transition:`width 0.2s, background 0.2s`}})}),(0,f.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,marginTop:`0.35rem`,fontSize:`0.75rem`},children:[(0,f.jsx)(`span`,{style:{color:`var(--text-faint)`},children:u?`Checking strengthâ¦`:r?`Strength ${s}/100`:`Strength`}),(0,f.jsx)(`span`,{style:{color:b?`#34d399`:`var(--text-faint)`},children:b?`Strong enough`:`Needs ${Of}+`})]})]}),(0,f.jsxs)(`p`,{style:{fontSize:`0.75rem`,color:`var(--text-muted)`,margin:`0.85rem 0 0`,lineHeight:1.5},children:[(0,f.jsx)(Y,{size:12,style:{display:`inline`,verticalAlign:`-1px`,marginRight:4}}),`This password is sent straight to cPanel and is `,(0,f.jsx)(`strong`,{children:`not saved in the portal`}),` â we canât show it to you again, so record it somewhere safe.`]}),(0,f.jsxs)(`div`,{style:{display:`flex`,gap:`0.5rem`,marginTop:`1rem`},children:[(0,f.jsxs)(`button`,{className:`btn-primary`,style:{flex:1},disabled:p||!b||u,onClick:x,children:[p?(0,f.jsx)(X,{size:14,style:{animation:`spin 1s linear infinite`}}):(0,f.jsx)(yc,{size:14}),` Reset password`]}),(0,f.jsx)(`button`,{className:`btn-secondary`,disabled:p,onClick:n,children:`Cancel`})]})]})]})})}function Af({serviceId:e}){let[t,n]=(0,l.useState)(!1),[r,i]=(0,l.useState)(null),[a,o]=(0,l.useState)(null);async function s(){if(t)return;n(!0),i(null);let r=await Tf(`/api/portal/services/${e}/enhance-sso`,`Cloud Hosting`);r.error?i(r.error):r.blockedUrl&&o(r.blockedUrl),n(!1)}return(0,f.jsxs)(`div`,{style:{marginTop:`1.1rem`},children:[(0,f.jsxs)(`button`,{onClick:s,disabled:t,style:{display:`flex`,width:`100%`,alignItems:`center`,justifyContent:`center`,gap:`0.55rem`,padding:`0.8rem 1rem`,borderRadius:10,fontSize:`0.95rem`,fontWeight:700,background:t?`var(--bg-elevated)`:`var(--accent)`,color:t?`var(--text-muted)`:`#fff`,border:`none`,cursor:t?`default`:`pointer`,transition:`background 0.15s`},children:[t?(0,f.jsx)(`span`,{style:{display:`inline-block`,width:14,height:14,border:`2px solid currentColor`,borderTopColor:`transparent`,borderRadius:`50%`,animation:`spin 0.7s linear infinite`}}):(0,f.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,f.jsx)(`rect`,{x:`3`,y:`11`,width:`18`,height:`11`,rx:`2`}),(0,f.jsx)(`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`})]}),t?`Opening Cloud Hostingâ¦`:`Log in to Cloud Hosting`,!t&&(0,f.jsx)(Js,{size:16})]}),r&&(0,f.jsx)(`p`,{style:{fontSize:`0.8125rem`,color:`#f87171`,marginTop:`0.4rem`},children:r}),a&&(0,f.jsx)(Ef,{url:a,label:`Cloud Hosting`,onClose:()=>o(null)})]})}function jf({data:e,serviceId:t}){let n=e.stats||{},r=!!e.provisioned,[i,a]=(0,l.useState)(e.transport?.host||``),[o,s]=(0,l.useState)(e.transport?.port||25),[c,u]=(0,l.useState)(e.transport?.protocol||`smtp`),[d,p]=(0,l.useState)(!1),[m,h]=(0,l.useState)(null),[g,_]=(0,l.useState)(null),[v,y]=(0,l.useState)(!1),[b,x]=(0,l.useState)(null);async function S(){if(!i.trim()){h({ok:!1,m:`Mail destination server is required`});return}p(!0),h(null);try{let e=await Z(`/api/portal/services/${t}/mailfilter/transport`,{method:`PUT`,body:JSON.stringify({host:i.trim(),port:Number(o)||25,protocol:c})});h(e.ok?{ok:!0,m:`Mail destination saved`}:{ok:!1,m:e.error||`Failed`})}catch(e){h({ok:!1,m:e.message})}finally{p(!1)}}async function C(){y(!0),x(null);try{let e=await Z(`/api/portal/services/${t}/mailfilter/login-url`,{method:`POST`});e.ok?(_(e),window.open(e.login_url,`_blank`,`noopener`)):x(e.error||`Could not create a login link`)}catch(e){x(e.message)}finally{y(!1)}}let w={background:`var(--bg-surface)`,border:`1px solid var(--border)`,borderRadius:12,padding:`1.25rem`,marginBottom:`1rem`},T={fontSize:`0.8125rem`,fontWeight:700,textTransform:`uppercase`,letterSpacing:`0.09em`,color:`var(--text-faint)`,marginBottom:`0.75rem`},E={width:`100%`,padding:`0.5rem 0.6rem`,borderRadius:8,border:`1px solid var(--border)`,background:`var(--bg-base)`,color:`var(--text-primary)`,fontSize:`0.875rem`}
108,D={fontSize:`0.72rem`,color:`var(--text-faint)`,display:`block`,marginBottom:4},O=e=>{if(e=Number(e)||0,e<1024)return`${e} B`;let t=[`KB`,`MB`,`GB`,`TB`],n=-1;do e/=1024,n++;while(e>=1024&&n<t.length-1);return`${e.toFixed(1)} ${t[n]}`},k=n.month?`${[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`][n.month-1]} ${n.year}`:`this month`,A=[[`Messages`,n.count_in,`var(--text-primary)`],[`Clean`,n.clean_in,`#34d399`],[`Spam`,n.spamcount_in,`#fbbf24`],[`Viruses`,n.viruscount_in,`#f87171`]];return r?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`div`,{style:w,children:[(0,f.jsxs)(`p`,{style:T,children:[`Spam Filtering â `,e.domain||`your domain`]}),e.suspended&&(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,color:`#fbbf24`,background:`#fbbf2415`,border:`1px solid #fbbf2440`,borderRadius:8,padding:`0.6rem 0.75rem`,marginBottom:`0.9rem`},children:`Filtering is currently suspended for this domain. Please contact support.`}),(0,f.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(110px, 1fr))`,gap:`0.6rem`},children:A.map(([e,t,n])=>(0,f.jsxs)(`div`,{style:{background:`var(--bg-base)`,border:`1px solid var(--border)`,borderRadius:10,padding:`0.75rem`,textAlign:`center`},children:[(0,f.jsx)(`div`,{style:{fontSize:`0.72rem`,color:`var(--text-faint)`,marginBottom:4},children:e}),(0,f.jsx)(`div`,{style:{fontSize:`1.25rem`,fontWeight:700,color:n},children:(Number(t)||0).toLocaleString()})]},e))}),(0,f.jsx)(`div`,{style:{fontSize:`0.72rem`,color:`var(--text-faint)`,marginTop:`0.6rem`},children:n.count_in?`Inbound mail for ${k} â ${O(n.bytes_in)} filtered.`:`No mail processed in ${k} yet.`}),(0,f.jsx)(`button`,{onClick:C,disabled:v,style:{marginTop:`1rem`,fontSize:`0.8125rem`,fontWeight:600,padding:`0.5rem 1rem`,borderRadius:8,border:`none`,background:`var(--accent)`,color:`#fff`,cursor:v?`default`:`pointer`,opacity:v?.6:1},children:v?`Openingâ¦`:`Manage your filtering â`}),g&&(0,f.jsx)(`p`,{style:{fontSize:`0.72rem`,color:`var(--text-faint)`,marginTop:`0.5rem`},children:`Opened in a new tab. The link is single-use and expires in five minutes â click again for a fresh one.`}),b&&(0,f.jsx)(`p`,{style:{fontSize:`0.8125rem`,color:`#ef4444`,marginTop:`0.5rem`},children:b})]}),(0,f.jsxs)(`div`,{style:w,children:[(0,f.jsx)(`p`,{style:T,children:`Mail Destination Server`}),(0,f.jsx)(`p`,{style:{fontSize:`0.8rem`,color:`var(--text-muted)`,marginTop:`-0.4rem`,marginBottom:`0.9rem`},children:`Where we deliver your filtered mail â your mail server or hosting providerâs inbound host.`}),(0,f.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`2fr 1fr 1fr`,gap:`0.6rem`},children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{style:D,children:`Destination host`}),(0,f.jsx)(`input`,{value:i,onChange:e=>a(e.target.value),placeholder:`mail.yourdomain.com`,style:E})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{style:D,children:`Port`}),(0,f.jsx)(`input`,{type:`number`,value:o,onChange:e=>s(e.target.value),placeholder:`25`,style:E})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{style:D,children:`Protocol`}),(0,f.jsxs)(`select`,{value:c,onChange:e=>u(e.target.value),style:E,children:[(0,f.jsx)(`option`,{value:`smtp`,children:`SMTP`}),(0,f.jsx)(`option`,{value:`lmtp`,children:`LMTP`})]})]})]}),(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`0.75rem`,marginTop:`0.9rem`},children:[(0,f.jsx)(`button`,{onClick:S,disabled:d,style:{fontSize:`0.8125rem`,fontWeight:600,padding:`0.5rem 1rem`,borderRadius:8,border:`none`,background:`var(--accent)`,color:`#fff`,cursor:d?`default`:`pointer`,opacity:d?.6:1},children:d?`Savingâ¦`:`Save Destination`}),m&&(0,f.jsx)(`span`,{style:{fontSize:`0.8125rem`,color:m.ok?`#34d399`:`#ef4444`},children:m.m})]})]}),(e.mailboxes||[]).length>0&&(0,f.jsxs)(`div`,{style:w,children:[(0,f.jsxs)(`p`,{style:T,children:[`Mailbox Logins (`,e.mailboxes.length,`)`]}),(0,f.jsx)(`p`,{style:{fontSize:`0.8rem`,color:`var(--text-muted)`,marginTop:`-0.4rem`,marginBottom:`0.9rem`},children:`These addresses can sign in to the filtering portal with a one-time code to manage their own quarantine and sender lists.`}),(0,f.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`},children:e.mailboxes.map(e=>(0,f.jsx)(`div`,{style:{padding:`0.5rem 0`,borderBottom:`1px solid var(--border)`,fontSize:`0.875rem`,color:`var(--text-primary)`,fontFamily:`monospace`},children:e.address},e.id))})]})]}):(0,f.jsxs)(`div`,{style:w,children:[(0,f.jsxs)(`p`,{style:T,children:[`Spam Filtering â `,e.domain||`your domain`]}),(0,f.jsx)(`p`,{style:{fontSize:`0.875rem`,color:`var(--text-muted)`},children:`Weâre still setting this service up. Filtering statistics and settings appear here once itâs live.`})]})}function Mf(e){let t=(e?.name||e?.domain||``).toLowerCase();return t.includes(`cloud hosting`)||t.includes(`cloud`)}function Nf({value:e}){let[t,n]=(0,l.useState)(!1);return(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`0.5rem`,background:`var(--bg-elevated)`,border:`1px solid var(--border)`,borderRadius:8,padding:`0.45rem 0.65rem`},children:[(0,f.jsx)(`span`,{style:{flex:1,minWidth:0,fontFamily:`ui-monospace, SFMono-Regular, Menlo, monospace`,fontSize:`0.875rem`,color:`var(--text-primary)`,wordBreak:`break-all`},children:e}),(0,f.jsx)(`button`,{onClick:()=>{navigator.clipboard?.writeText(e),n(!0),setTimeout(()=>n(!1),1500)},title:`Copy`,style:{background:`none`,border:`none`,color:t?`#34d399`:`var(--accent)`,cursor:`pointer`,padding:2,display:`flex`,flexShrink:0},children:t?(0,f.jsx)($s,{size:14}):(0,f.jsx)(oc,{size:14})})]})}function Pf({serviceId:e,cardStyle:t,sectionHead:n}){let[r,i]=(0,l.useState)(null),[a,o]=(0,l.useState)(!1),[s,c]=(0,l.useState)(!1),[u,d]=(0,l.useState)(!1),[p,m]=(0,l.useState)(null),[h,g]=(0,l.useState)(!1);(0,l.useEffect)(()=>{let t=!1;return Z(`/api/portal/services/${e}/domain-connect`).then(e=>{t||i(e)}).catch(()=>{t||i({ok:!1})}),()=>{t=!0}},[e]);let _=async()=>{o(!0),m(null);try{let t=await Z(`/api/portal/services/${e}/domain-connect`,{method:`POST`,body:JSON.stringify({action:`applyNameservers`})});t?.ok?(i(t),g(!0),c(!1),d(!1)):m(t?.error||`We couldnât change the nameservers. Please contact support.`)}catch{m(`We couldnât change the nameservers. Please contact support.`)}finally{o(!1)}},v=(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`0.5rem`,marginBottom:`0.75rem`},children:[(0,f.jsx)(Fc,{size:15,style:{color:`var(--accent)`}}),(0,f.jsx)(`p`,{style:{...n,margin:0},children:`Connect your domain`})]});if(!r)return(0,f.jsxs)(`div`,{style:t,children:[v,(0,f.jsx)(`p`,{style:{fontSize:`0.85rem`,color:`var(--text-faint)`},children:`Checking your domainâ¦`})]});if(!r.ok)return null;let y={fontSize:`0.8125rem`,fontWeight:700,color:`var(--text-primary)`,marginBottom:`0.35rem`},b={fontSize:`0.8125rem`,color:`var(--text-muted)`,lineHeight:1.5,margin:`0 0 0.6rem`},x={border:`1px solid var(--border)`,borderRadius:10,padding:`0.9rem`},S=(r.nameservers||[]).map(e=>e.toLowerCase()),C=r.nsConnected||r.aConnected,w=r.mxAtRisk||[];return r.domain?(0,f.jsxs)(`div`,{style:t,children:[v,C?(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:`0.5rem`,background:`rgba(52,211,153,0.10)`,border:`1px solid rgba(52,211,153,0.30)`,borderRadius:8,padding:`0.6rem 0.75rem`,marginBottom:`0.9rem`},children:[(0,f.jsx)(Is,{size:15,style:{color:`#34d399`,flexShrink:0,marginTop:1}}),(0,f.jsxs)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-primary)`,lineHeight:1.5},children:[(0,f.jsx)(`strong`,{children:r.domain}),` is connected to this hosting`,r.nsConnected?` using our nameservers.`:` with an A record pointing at this server.`]})]}):(0,f.jsxs)(`p`,{style:b,children:[`Point `,(0,f.jsx)(`strong`,{children:r.domain}),` at this hosting using `,(0,f.jsx)(`strong`,{children:`one`}),` of the two options below. You only need one â whichever suits where your DNS is managed today.`]}),h&&(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:`0.5rem`,background:`rgba(59,130,246,0.10)`,border:`1px solid rgba(59,130,246,0.30)`,borderRadius:8,padding:`0.6rem 0.75rem`,marginBottom:`0.9rem`},children:[(0,f.jsx)(ac,{size:15,style:{color:`var(--accent)`,flexShrink:0,marginTop:1}}),(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-primary)`,lineHeight:1.5}
108,children:`Nameservers updated. It can take up to 24â48 hours for the change to reach everyone on the internet â until then some visitors will still land on your old host.`})]}),(0,f.jsxs)(`div`,{style:{display:`grid`,gap:`0.75rem`},children:[(0,f.jsxs)(`div`,{style:x,children:[(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`0.4rem`,marginBottom:`0.35rem`},children:[(0,f.jsx)(`div`,{style:y,children:`Option 1 â Use our nameservers`}),(0,f.jsx)(`span`,{style:{fontSize:`0.6875rem`,fontWeight:700,letterSpacing:`0.04em`,textTransform:`uppercase`,color:`#34d399`,background:`rgba(52,211,153,0.12)`,border:`1px solid rgba(52,211,153,0.28)`,borderRadius:999,padding:`0.1rem 0.45rem`},children:`Recommended`})]}),(0,f.jsx)(`p`,{style:b,children:`Set these as the nameservers on your domain and we take care of the rest â DNS, your website record and your SSL certificate are all configured for you.`}),(0,f.jsx)(`div`,{style:{display:`grid`,gap:`0.4rem`},children:(r.nameservers||[]).map(e=>(0,f.jsx)(Nf,{value:e},e))}),r.canApply?(0,f.jsx)(`div`,{style:{marginTop:`0.75rem`},children:s?(0,f.jsxs)(`div`,{style:{border:`1px solid rgba(251,191,36,0.35)`,background:`rgba(251,191,36,0.08)`,borderRadius:10,padding:`0.85rem`},children:[(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`0.45rem`,marginBottom:`0.5rem`},children:[(0,f.jsx)(Y,{size:15,style:{color:`#fbbf24`}}),(0,f.jsx)(`strong`,{style:{fontSize:`0.8125rem`,color:`var(--text-primary)`},children:`Before you change nameservers`})]}),(0,f.jsxs)(`ul`,{style:{margin:`0 0 0.65rem 1.1rem`,padding:0,fontSize:`0.8125rem`,color:`var(--text-muted)`,lineHeight:1.6},children:[(0,f.jsxs)(`li`,{children:[`Changing nameservers moves `,(0,f.jsx)(`strong`,{children:`all`}),` of your DNS to us â your website, your email (MX records), and anything else pointing at `,r.domain,`.`]}
108),(0,f.jsxs)(`li`,{children:[`Any records you currently have elsewhere will `,(0,f.jsx)(`strong`,{children:`not`}),` come across automatically. Copy them into your DNS here first, or your email and other services will stop working.`]}),w.length>0&&(0,f.jsxs)(`li`,{style:{color:`#fbbf24`},children:[`Your email is currently delivered by `,(0,f.jsx)(`strong`,{children:w.join(`, `)}),`, and we donât have a matching mail record here. Add it before you switch, or mail to `,r.domain,` will start bouncing.`]}),r.dnsChecked&&(r.zoneReady?(0,f.jsxs)(`li`,{children:[`We already hold a DNS zone for `,r.domain,r.zoneA?.length?(0,f.jsxs)(f.Fragment,{children:[` â it points the website at `,(0,f.jsx)(`strong`,{children:r.zoneA.join(`, `)})]}):null,`. Check those records look right before you switch.`]}):(0,f.jsxs)(`li`,{style:{color:`#f87171`},children:[`We donât have a DNS zone for `,r.domain,` yet. If you switch now the domain will stop resolving until one is built â please raise a ticket first, or use Option\xA02 instead.`]})),(0,f.jsx)(`li`,{children:`Changes can take up to 24â48 hours to take effect worldwide.`})]}),(0,f.jsxs)(`label`,{style:{display:`flex`,alignItems:`flex-start`,gap:`0.5rem`,fontSize:`0.8125rem`,color:`var(--text-primary)`,cursor:`pointer`,marginBottom:`0.7rem`},children:[(0,f.jsx)(`input`,{type:`checkbox`,checked:u,onChange:e=>d(e.target.checked),style:{marginTop:3}}),(0,f.jsxs)(`span`,{children:[`I understand this moves all DNS for `,r.domain,` to Network Dynamics, and Iâve checked my email and other records are set up here.`]})]}),p&&(0,f.jsx)(`p`,{style:{fontSize:`0.8125rem`,color:`#f87171`,margin:`0 0 0.6rem`},children:p}),(0,f.jsxs)(`div`,{style:{display:`flex`,gap:`0.5rem`,flexWrap:`wrap`},children:[(0,f.jsxs)(`button`,{className:`btn-primary`,onClick:_,disabled:!u||a,children:[a?(0,f.jsx)(X,{size:14,style:{animation:`spin 1s linear infinite`}}):(0,f.jsx)(Is,{size:14}),a?`Updatingâ¦`:`Change nameservers`]}),(0,f.jsx)(`button`,{className:`btn-secondary`,onClick:()=>{c(!1),d(!1),m(null)},disabled:a,children:`Cancel`})]})]}):(0,f.jsxs)(`button`,{className:`btn-primary`,onClick:()=>{c(!0),m(null)},disabled:r.nsConnected,children:[(0,f.jsx)(Fc,{size:14}),` `,r.nsConnected?`Nameservers already set`:`Connect nameservers automatically`]})}):(0,f.jsx)(`p`,{style:{...b,margin:`0.6rem 0 0`},children:r.withUs?`This domain canât be changed from here at the moment â please contact support.`:`${r.domain} isnât registered with us, so make this change at your domain registrar.`})]}),(0,f.jsxs)(`div`,{style:x,children:[(0,f.jsx)(`div`,{style:y,children:`Option 2 â Point an A record at our server`}),(0,f.jsxs)(`p`,{style:b,children:[`Keep your DNS where it is today and change the A record for `,(0,f.jsx)(`strong`,{children:r.domain}),` (and`,` `,(0,f.jsxs)(`strong`,{children:[`www.`,r.domain]}),`) to this serverâs IP address. Your email and every other record stay exactly as they are.`]}),r.ip?(0,f.jsx)(Nf,{value:r.ip}):(0,f.jsx)(`p`,{style:{...b,margin:0},children:`We couldnât read this serverâs IP address right now. Please refresh, or contact support.`})]})]}),r.dnsChecked&&(0,f.jsxs)(`div`,{style:{marginTop:`0.9rem`,paddingTop:`0.75rem`,borderTop:`1px solid var(--border)`},children:[(0,f.jsxs)(`div`,{style:{fontSize:`0.75rem`,fontWeight:700,textTransform:`uppercase`,letterSpacing:`0.06em`,color:`var(--text-faint)`,marginBottom:`0.45rem`},children:[r.domain,` right now`]}),(0,f.jsxs)(`div`,{style:{display:`grid`,gap:`0.3rem`,fontSize:`0.8125rem`,color:`var(--text-muted)`},children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`span`,{style:{color:`var(--text-faint)`}
108,children:`Nameservers: `}),r.liveNameservers?.length?r.liveNameservers.map(e=>(0,f.jsxs)(`span`,{style:{color:S.includes(e)?`#34d399`:`var(--text-muted)`},children:[e,` `]},e)):`not found`]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`span`,{style:{color:`var(--text-faint)`},children:`Points to: `}),r.liveA?.length?r.liveA.map(e=>(0,f.jsxs)(`span`,{style:{color:e===r.ip?`#34d399`:`var(--text-muted)`},children:[e,` `]},e)):`not found`]})]})]})]}):(0,f.jsxs)(`div`,{style:t,children:[v,(0,f.jsx)(`p`,{style:b,children:`Thereâs no domain on this hosting account yet. Open a ticket with the domain youâd like to use and weâll add it, then this panel will show you exactly how to point it here.`}),r.hostname&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`div`,{style:y,children:`Temporary address`}),(0,f.jsx)(`p`,{style:b,children:`Your site is reachable at this address in the meantime.`}),(0,f.jsx)(Nf,{value:r.hostname})]})]})}function Ff({serviceId:e,current:t,onClose:n,onChanged:r,onRequested:i}){let[a,o]=(0,l.useState)(null),[s,c]=(0,l.useState)(``),[u,d]=(0,l.useState)([]),[p,m]=(0,l.useState)(null),[h,g]=(0,l.useState)(!1),[_,v]=(0,l.useState)(``),[y,b]=(0,l.useState)(null),[x,S]=(0,l.useState)(null),[C,w]=(0,l.useState)(!1),[T,E]=(0,l.useState)(null);(0,l.useEffect)(()=>{Z(`/api/portal/services/${e}/upgrade-options`).then(e=>{e.ok?(o(e.options||[]),c(e.billingcycle||``),d(e.current?.features||[]),S(e.nextduedate||null),E(e.crossgrade_notes||null)):(o([]),v(e.error||`Could not load packages`))}).catch(()=>{o([]),v(`Could not load packages`)})},[e]);let D=e=>String(e||``).trim(),O=e=>{let t=D(e).toLowerCase();return t&&t!==`x`&&t!==`-`&&t!==`â`},k=(e,t)=>{let n=new Set((t||[]).filter(O).map(e=>D(e).toLowerCase()));return(e||[]).filter(O).filter(e=>!n.has(D(e).toLowerCase()))},A=e=>String(e||``).split(/\r?\n|;/).map(e=>e.trim()).filter(Boolean),j=p?.condition===`crossgrade`&&u.length===0,M=p?j?A(T?.gain):k(p.features,u):[],N=p?j?A(T?.lose):k(u,p.features):[];async function P(){g(!0),v(``);try{let t=await Z(`/api/portal/services/${e}/change-package`,{method:`POST`,body:JSON.stringify({product_id:p.product_id,confirm_ip_change:C})});if(!t.ok)return g(!1),v(t.message||t.error||`Could not change plan`);b(t),t.applied&&r?.({name:p.name,amount:t.new_amount,product_id:p.product_id}),i?.()}catch{g(!1),v(`Network error. Please try again.`)}finally{g(!1)}}let F={position:`fixed`,inset:0,background:`rgba(0,0,0,0.55)`,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`1rem`,zIndex:60},I={background:`var(--bg-surface)`,border:`1px solid var(--border)`,borderRadius:14,padding:`1.5rem`,width:`100%`,maxWidth:520,maxHeight:`85vh`,overflowY:`auto`},L=e=>typeof e==`object`&&e?.condition===`crossgrade`?{label:`Cross-grade`,color:`#8b5cf6`,bg:`rgba(139,92,246,0.12)`}:(()=>{let t=typeof e==`object`?e?.direction:e;return t===`upgrade`?{label:`Upgrade`,color:`#16a34a`,bg:`rgba(22,163,74,0.12)`}:t===`downgrade`?{label:`Downgrade`,color:`#f59e0b`,bg:`rgba(245,158,11,0.12)`}:{label:`Same price`,color:`var(--text-muted)`,bg:`var(--bg-elevated)`}})(),R=e=>e.blocked?{label:`Too small for your usage`,color:`#dc2626`,bg:`rgba(220,38,38,0.12)`}:e.condition===`crossgrade`?{label:`Applies now`,color:`#8b5cf6`,bg:`rgba(139,92,246,0.12)`}:e.condition===`migrate`?{label:`Migration`,color:`#6366f1`,bg:`rgba(99,102,241,0.12)`}:e.condition===`ip_change`?{label:`IP changes`,color:`#dc2626`,bg:`rgba(220,38,38,0.12)`}:e.condition===`scheduled`||e.condition===`resource_check`?{label:`At renewal`,color:`#0891b2`,bg:`rgba(8,145,178,0.12)`}:e.condition===`staff`?{label:`Team applies`,color:`var(--text-muted)`,bg:`var(--bg-elevated)`}:null,z=p?.condition===`migrate`,B=p?.condition===`ip_change`,V=p?.condition===`crossgrade`,H=p&&(p.condition===`scheduled`||p.condition===`resource_check`);return(0,f.jsx)(`div`,{style:F,onClick:n,children:(0,f.jsxs)(`div`,{style:I,onClick:e=>e.stopPropagation(),children:[(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:`1rem`},children:[(0,f.jsx)(`h2`,{style:{fontSize:`1.05rem`,fontWeight:700,color:`var(--text-primary)`,margin:0},children:y?`Plan changed`:p?`Confirm plan change`:`Change plan`}),(0,f.jsx)(`button`,{onClick:n,style:{background:`none`,border:`none`,cursor:`pointer`,color:`var(--text-muted)`},children:(0,f.jsx)(pl,{size:18})})]}),_&&(0,f.jsxs)(`div`,{className:`alert-error`,style:{marginBottom:`0.9rem`},children:[(0,f.jsx)(Y,{size:15}),_]}),y?(0,f.jsxs)(`div`,{style:{fontSize:`0.875rem`,color:`var(--text-muted)`,lineHeight:1.6},children:[(0,f.jsx)(`p`,{style:{color:`var(--text-primary)`,fontWeight:600,marginTop:0},children:y.message}),y.scheduled&&y.effective_date&&(0,f.jsxs)(`p`,{children:[`Takes effect on `,(0,f.jsx)(`strong`,{style:{color:`var(--text-primary)`},children:String(y.effective_date).slice(0,10)}),`, renewing at `,(0,f.jsx)(`strong`,{style:{color:`var(--text-primary)`},children:$(y.new_amount)}),` / `,s,`.`]}),y.kind===`cpanel_to_cloud`&&(0,f.jsxs)(`p`,{children:[`Pay order invoice `,(0,f.jsxs)(`strong`,{style:{color:`var(--text-primary)`},children:[`#`,y.invoiceId]}),` (`,$(y.amount),`) to get started â see Billing. Once it's paid we'll migrate your site across, then retire the old plan.`]}),y.awaiting_payment&&y.invoiceId&&(0,f.jsxs)(`p`,{children:[`Invoice `,(0,f.jsxs)(`strong`,{style:{color:`var(--text-primary)`},children:[`#`,y.invoiceId]}),y.diff==null?``:` for ${$(y.diff)}`,` is ready to pay â see Billing. Your new plan applies as soon as it's paid.`]}),y.applied&&y.new_amount!=null&&(0,f.jsxs)(`p`,{children:[`New recurring charge: `,(0,f.jsx)(`strong`,{style:{color:`var(--text-primary)`},children:$(y.new_amount)}),` / `,s,`.`]}),y.kind===`crossgrade`&&y.invoiceId&&(0,f.jsxs)(`p`,{children:[`Weâve also updated your open invoice `,(0,f.jsxs)(`strong`,{style:{color:`var(--text-primary)`},children:[`#`,y.invoiceId]}),` to the new plan and price.`]}),y.provisioning?.message&&(0,f.jsx)(`p`,{style:{color:`var(--text-faint)`},children:y.provisioning.message}),(0,f.jsx)(`button`,{className:`btn-primary`,style:{marginTop:`0.5rem`,width:`100%`},onClick:n,children:`Done`})]}):p?(0,f.jsxs)(`div`,{style:{fontSize:`0.875rem`,color:`var(--text-muted)`,lineHeight:1.6},children:[(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`0.6rem`,justifyContent:`center`,margin:`0.5rem 0 1rem`},children:[(0,f.jsx)(`span`,{style:{color:`var(--text-muted)`},children:t.name}),(0,f.jsx)(Js,{size:16,style:{color:`var(--text-faint)`}}),(0,f.jsx)(`span`,{style:{color:`var(--text-primary)`,fontWeight:700},children:p.name})]}),M.length>0||N.length>0?(0,f.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:`0.6rem`,marginBottom:`1rem`},children:[(0,f.jsxs)(`div`,{style:{background:`rgba(22,163,74,0.08)`,border:`1px solid rgba(22,163,74,0.25)`,borderRadius:10,padding:`0.75rem`},children:[(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,fontWeight:700,textTransform:`uppercase`,letterSpacing:`0.05em`,color:`#16a34a`,marginBottom:`0.45rem`},children:`What you gain`}),M.length?M.map((e,t)=>(0,f.jsxs)(`div`,{style:{display:`flex`,gap:`0.4rem`,fontSize:`0.8125rem`,color:`var(--text-primary)`,padding:`0.12rem 0`,lineHeight:1.35},children:[(0,f.jsx)(`span`,{style:{color:`#16a34a`,flex:`0 0 auto`}
108,children:`ï¼`}),(0,f.jsx)(`span`,{children:e})]},t)):(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-faint)`},children:`â`})]}),(0,f.jsxs)(`div`,{style:{background:`rgba(245,158,11,0.08)`,border:`1px solid rgba(245,158,11,0.25)`,borderRadius:10,padding:`0.75rem`},children:[(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,fontWeight:700,textTransform:`uppercase`,letterSpacing:`0.05em`,color:`#f59e0b`,marginBottom:`0.45rem`},children:`What you lose`}),N.length?N.map((e,t)=>(0,f.jsxs)(`div`,{style:{display:`flex`,gap:`0.4rem`,fontSize:`0.8125rem`,color:`var(--text-primary)`,padding:`0.12rem 0`,lineHeight:1.35},children:[(0,f.jsx)(`span`,{style:{color:`#f59e0b`,flex:`0 0 auto`},children:`ï¼`}),(0,f.jsx)(`span`,{children:e})]},t)):(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-faint)`},children:`â`})]})]}):(0,f.jsx)(`p`,{style:{fontSize:`0.8125rem`,color:`var(--text-faint)`,textAlign:`center`,margin:`0 0 1rem`},children:V?`Same plan, same server â nothing about your site changes.`:`Same features â only the price changes.`}),(0,f.jsxs)(`div`,{style:{background:`var(--bg-elevated)`,borderRadius:10,padding:`0.9rem`,marginBottom:`1rem`},children:[(0,f.jsx)(If,{k:z?`New plan price`:V?`Renews at`:`New recurring`,v:`${$(p.new_amount)} / ${s}`}),(0,f.jsx)(If,{k:`Was`,v:`${$(t.amount)} / ${s}`}),(0,f.jsx)(If,{k:p.diff>=0?`Difference`:`You save`,v:`${p.diff>=0?`+`:``}${$(Math.abs(p.diff))}`,strong:!0})]}),V?(0,f.jsxs)(`p`,{children:[p.name,` is your plan on our current range, so it switches over`,` `,(0,f.jsx)(`strong`,{style:{color:`var(--text-primary)`},children:`straight away`}),` â same server, same IP address, nothing to move. Thereâs `,(0,f.jsx)(`strong`,{style:{color:`var(--text-primary)`},children:`nothing to pay now`}),`: the term youâve already paid for runs as normal, and your renewal`,x?` on ${String(x).slice(0,10)}`:``,` becomes `,$(p.new_amount),` / `,s,`.`]}):z?(0,f.jsxs)(`p`,{children:[`Moving to `,p.name,` means setting up a `,(0,f.jsx)(`strong`,{style:{color:`var(--text-primary)`},children:`new cloud service`}),`. Weâll create it and raise an order invoice; once itâs paid our team migrates your site across and then cancels this cPanel plan. Nothing is removed until the migration is complete.`]}):B?(0,f.jsxs)(`p`,{children:[p.name,` runs on a `,(0,f.jsx)(`strong`,{style:{color:`var(--text-primary)`},children:`dedicated server`}),`, so your siteâs `,(0,f.jsx)(`strong`,{style:{color:`var(--text-primary)`},children:`IP address will change`}),`. Our team coordinates the DNS cutover with you â it isnât applied automatically.`]}):H?(0,f.jsxs)(`p`,{children:[`This change takes effect at your `,(0,f.jsxs)(`strong`,{style:{color:`var(--text-primary)`},children:[`next renewal`,x?` (${String(x).slice(0,10)})`:``]}),`. Your renewal price will be `,$(p.new_amount),` / `,s,`.`,p.fit?.indeterminate?` Weâll confirm your usage fits before it applies.`:``]}):(0,f.jsxs)(`p`,{children:[`This upgrade applies `,(0,f.jsx)(`strong`,{style:{color:`var(--text-primary)`},children:`once you pay the difference`}),`. Weâll raise an invoice for `,(0,f.jsx)(`strong`,{style:{color:`var(--text-primary)`},children:$(p.diff)}),` (or update your current unpaid invoice); as soon as itâs paid, `,p.name,` is applied and your renewals become `,$(p.new_amount),` / `,s,`.`]}),p.fit&&!p.fit.ok&&!p.fit.indeterminate&&p.fit.offenders?.length>0&&(0,f.jsxs)(`div`,{style:{background:`rgba(220,38,38,0.08)`,border:`1px solid rgba(220,38,38,0.25)`,borderRadius:10,padding:`0.6rem 0.75rem`,marginBottom:`0.75rem`,fontSize:`0.8125rem`,color:`#dc2626`},children:[`Your current usage is larger than this plan allows: `,p.fit.offenders.map(e=>e.resource).join(`, `),`. Reduce usage or choose a bigger plan.`]}),B&&(0,f.jsxs)(`label`,{style:{display:`flex`,gap:`0.5rem`,alignItems:`flex-start`,fontSize:`0.8125rem`,color:`var(--text-primary)`,marginBottom:`0.75rem`,cursor:`pointer`},children:[(0,f.jsx)(`input`,{type:`checkbox`,checked:C,onChange:e=>w(e.target.checked),style:{marginTop:`0.15rem`}}),(0,f.jsx)(`span`,{children:`I understand my siteâs IP address will change and that your team will c
108oordinate the switch with me.`})]}),(0,f.jsxs)(`div`,{style:{display:`flex`,gap:`0.6rem`,marginTop:`0.5rem`},children:[(0,f.jsx)(`button`,{className:`btn-secondary`,style:{flex:`0 0 auto`},onClick:()=>{m(null),v(``),w(!1)},disabled:h,children:`Back`}),(0,f.jsx)(`button`,{className:`btn-primary`,style:{flex:1},onClick:P,disabled:h||p.blocked||B&&!C,children:h?`Applyingâ¦`:z?`Order new service`:B?`Request change`:H?`Schedule change`:`Confirm change`})]})]}):a===null?(0,f.jsx)(`div`,{style:{textAlign:`center`,padding:`1.5rem`,color:`var(--text-muted)`,fontSize:`0.875rem`},children:`Loading packagesâ¦`}):a.length===0?(0,f.jsx)(`div`,{style:{textAlign:`center`,padding:`1.5rem`,color:`var(--text-muted)`,fontSize:`0.875rem`},children:`No alternative packages are available for this service.`}):(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`p`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`,marginTop:0,marginBottom:`0.9rem`},children:[`Youâre on `,(0,f.jsx)(`strong`,{style:{color:`var(--text-primary)`},children:t.name}),` at `,$(t.amount),` / `,s,`. Choose a package to switch to:`]}),(0,f.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`0.5rem`},children:[...a].sort((e,t)=>(t.condition===`crossgrade`)-(e.condition===`crossgrade`)).map(e=>{let t=L(e),n=R(e),r=e.condition===`crossgrade`;return(0,f.jsxs)(`button`,{onClick:()=>{e.blocked||(m(e),v(``),w(!1))},disabled:e.blocked,style:{textAlign:`left`,display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:`0.75rem`,padding:`0.8rem 0.9rem`,borderRadius:10,border:`1px solid ${r&&!e.blocked?`#8b5cf6`:`var(--border)`}`,background:`var(--bg-elevated)`,cursor:e.blocked?`not-allowed`:`pointer`,opacity:e.blocked?.6:1},children:[(0,f.jsxs)(`div`,{style:{minWidth:0},children:[(0,f.jsx)(`div`,{style:{fontSize:`0.9rem`,fontWeight:600,color:`var(--text-primary)`},children:e.name}),(0,f.jsxs)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`,marginTop:2},children:[$(e.new_amount),` / `,s]}),r&&!e.blocked&&(0,f.jsx)(`div`,{style:{fontSize:`0.75rem`,color:`#8b5cf6`,marginTop:2},children:`Your plan on our current range â switches over straight away`}),e.blocked&&e.fit?.offenders?.length>0&&(0,f.jsxs)(`div`,{style:{fontSize:`0.75rem`,color:`#dc2626`,marginTop:2},children:[`Too small for your usage: `,e.fit.offenders.map(e=>e.resource).join(`, `)]})]}),(0,f.jsxs)(`div`,{style:{flex:`0 0 auto`,display:`flex`,flexDirection:`column`,gap:`0.25rem`,alignItems:`flex-end`},children:[(0,f.jsx)(`span`,{style:{fontSize:`0.8125rem`,fontWeight:700,padding:`0.2rem 0.55rem`,borderRadius:999,color:t.color,background:t.bg},children:t.label}),n&&(0,f.jsx)(`span`,{style:{fontSize:`0.7rem`,fontWeight:600,padding:`0.12rem 0.45rem`,borderRadius:999,color:n.color,background:n.bg},children:n.label})]})]},e.product_id)})})]})]})})}function If({k:e,v:t,strong:n}){return(0,f.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,fontSize:`0.82rem`,padding:`0.15rem 0`},children:[(0,f.jsx)(`span`,{style:{color:`var(--text-muted)`},children:e}),(0,f.jsx)(`span`,{style:{color:`var(--text-primary)`,fontWeight:n?700:600},children:t})]})}function Lf({serviceId:e,current:t,onClose:n,onChanged:r}){let[i,a]=(0,l.useState)(null),[o,s]=(0,l.useState)(null),[c,u]=(0,l.useState)(!1),[d,p]=(0,l.useState)(``),[m,h]=(0,l.useState)(null);(0,l.useEffect)(()=>{Z(`/api/portal/services/${e}/billing-cycles`).then(e=>{e.ok?a(e):(a({cycles:[]}),p(e.error||`Could not load billing cycles`))}).catch(()=>{a({cycles:[]}),p(`Could not load billing cycles`)})},[e]);async function g(){u(!0),p(``);try{let t=await Z(`/api/portal/services/${e}/billing-cycle`,{method:`POST`,body:JSON.stringify({billingcycle:o.cycle})});if(!t.ok)return u(!1),p(t.error||`Could not change billing cycle`);h(t),r?.({billingcycle:t.billingcycle,amount:t.amount})}catch{u(!1),p(`Network error. Please try again.`)}finally{u(!1)}}let _={position:`fixed`,inset:0,background:`rgba(0,0,0,0.55)`,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`1rem`,zIndex:60},v={background:`var(--bg-surface)`,border:`1px solid var(--border)`,borderRadius:14,padding:`1.5rem`,width:`100%`,maxWidth:480,maxHeight:`85vh`,overflowY:`auto`},y=i?.current||t.billingcycle;return(0,f.jsx)(`div`,{style:_,onClick:n,children:(0,f.jsxs)(`div`,{style:v,onClick:e=>e.stopPropagation(),children:[(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:`1rem`},children:[(0,f.jsx)(`h2`,{style:{fontSize:`1.05rem`,fontWeight:700,color:`var(--text-primary)`,margin:0},children:m?`Billing cycle updated`:o?`Confirm billing cycle`:`Change billing cycle`}),(0,f.jsx)(`button`,{onClick:n,style:{background:`none`,border:`none`,cursor:`pointer`,color:`var(--text-muted)`},children:(0,f.jsx)(pl,{size:18})})]}),d&&(0,f.jsxs)(`div`,{className:`alert-error`,style:{marginBottom:`0.9rem`},children:[(0,f.jsx)(Y,{size:15}),d]}),m?(0,f.jsxs)(`div`,{style:{fontSize:`0.875rem`,color:`var(--text-muted)`,lineHeight:1.6},children:[(0,f.jsxs)(`p`,{style:{color:`var(--text-primary)`,fontWeight:600,marginTop:0},children:[`Now billed `,(0,f.jsx)(`strong`,{children:m.billingcycle}),` at `,$(m.amount),`.`]}
108),m.invoicesUpdated?.length?(0,f.jsxs)(`p`,{children:[`Updated invoice`,m.invoicesUpdated.length>1?`s`:``,` `,m.invoicesUpdated.map(e=>`#`+e).join(`, `),` to match â see Billing.`]}):(0,f.jsx)(`p`,{style:{color:`var(--text-faint)`},children:`No open invoice needed updating.`}),(0,f.jsx)(`button`,{className:`btn-primary`,style:{marginTop:`0.5rem`,width:`100%`},onClick:n,children:`Done`})]}):o?(0,f.jsxs)(`div`,{style:{fontSize:`0.875rem`,color:`var(--text-muted)`,lineHeight:1.6},children:[(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`0.6rem`,justifyContent:`center`,margin:`0.5rem 0 1rem`},children:[(0,f.jsx)(`span`,{children:y}),(0,f.jsx)(Js,{size:16,style:{color:`var(--text-faint)`}}),(0,f.jsx)(`span`,{style:{color:`var(--text-primary)`,fontWeight:700},children:o.cycle})]}),(0,f.jsxs)(`div`,{style:{background:`var(--bg-elevated)`,borderRadius:10,padding:`0.9rem`,marginBottom:`1rem`},children:[(0,f.jsx)(If,{k:`New charge`,v:`${$(o.amount)} / ${o.cycle}`,strong:!0}),(0,f.jsx)(If,{k:`Was`,v:`${$(i.current_amount)} / ${y}`})]}),(0,f.jsxs)(`p`,{children:[`Your service will be billed `,(0,f.jsx)(`strong`,{style:{color:`var(--text-primary)`},children:o.cycle}),` at `,$(o.amount),`. Any unpaid invoice for this service will be updated to match.`]}),(0,f.jsxs)(`div`,{style:{display:`flex`,gap:`0.6rem`,marginTop:`0.5rem`},children:[(0,f.jsx)(`button`,{className:`btn-secondary`,onClick:()=>{s(null),p(``)},disabled:c,children:`Back`}),(0,f.jsx)(`button`,{onClick:g,disabled:c,className:`bg-accent`,style:{flex:1,padding:`0.6rem`,borderRadius:8,border:`none`,color:`#fff`,fontWeight:700,fontSize:`0.875rem`,cursor:c?`default`:`pointer`,opacity:c?.7:1},children:c?`Updatingâ¦`:`Confirm`})]})]}):i?(i.cycles||[]).filter(e=>e.cycle!==y).length===0?(0,f.jsxs)(`div`,{style:{fontSize:`0.875rem`,color:`var(--text-muted)`,lineHeight:1.6,padding:`0.5rem 0`},children:[(0,f.jsxs)(`p`,{style:{marginTop:0},children:[`This service is billed `,(0,f.jsx)(`strong`,{style:{color:`var(--text-primary)`},children:y}),`, which canât be changed automatically.`]}),(0,f.jsx)(`p`,{style:{color:`var(--text-faint)`,marginBottom:0},children:`Please contact support if youâd like to change how this service is billed.`})]}):(0,f.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`0.5rem`},children:(i.cycles||[]).map(e=>{let t=e.cycle===y;return(0,f.jsxs)(`button`,{disabled:t,onClick:()=>{s(e),p(``)},style:{textAlign:`left`,display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:`0.75rem`,padding:`0.8rem 0.9rem`,borderRadius:10,border:`1px solid ${t?`var(--accent)`:`var(--border)`}`,background:`var(--bg-elevated)`,cursor:t?`default`:`pointer`,opacity:t?.75:1},children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{style:{fontSize:`0.9rem`,fontWeight:600,color:`var(--text-primary)`},children:e.cycle}),(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`,marginTop:2},children:e.amount==null?`Price on request`:`${$(e.amount)} / ${e.cycle}`})]}),t&&(0,f.jsx)(`span`,{style:{fontSize:`0.8125rem`,fontWeight:700,padding:`0.2rem 0.55rem`,borderRadius:999,color:`var(--accent)`,background:`var(--bg-active)`},children:`Current`})]},e.cycle)})}):(0,f.jsx)(`div`,{style:{textAlign:`center`,padding:`1.5rem`,color:`var(--text-muted)`,fontSize:`0.875rem`},children:`Loadingâ¦`})]})})}function Rf({label:e,pct:t,detail:n,unlimited:r}){let i=Math.max(0,Math.min(100,Math.round(t||0))),a=r?`var(--accent)`:i>=85?`#f87171`:i>=70?`#fbbf24`:`var(--accent)`;return(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`baseline`,fontSize:`0.8125rem`,marginBottom:5},children:[(0,f.jsx)(`span`,{style:{color:`var(--text-muted)`},children:e}),(0,f.jsx)(`span`,{style:{color:`var(--text-primary)`,fontWeight:600},children:n})]}),(0,f.jsx)(`div`,{style:{height:6,borderRadius:999,background:`var(--bg-elevated)`,overflow:`hidden`},children:(0,f.jsx)(`div`,{style:{height:`100%`,width:`${r?8:i}%`,background:a,borderRadius:999,transition:`width 0.4s`}})})]})}function zf({stats:e,cardStyle:t,sectionHead:n}){if(!e)return null;if(e.paused)return(0,f.jsxs)(`div`,{style:t,children:[(0,f.jsx)(`p`,{style:n,children:`Resource Usage`}),(0,f.jsx)(`p`,{style:{fontSize:`0.875rem`,color:`var(--text-muted)`},children:`Monitoring is paused for this server, so live figures are not available.`})]});let{cpu:r,memory:i,disk:a,traffic:o}=e;if(!r&&!i&&!a&&!o)return null;let s=e=>e==null?`â`:e>=1e9?`${(e/1e9).toFixed(2)}
108 Gbit/s`:e>=1e6?`${(e/1e6).toFixed(2)} Mbit/s`:e>=1e3?`${(e/1e3).toFixed(0)} kbit/s`:`${e} bit/s`,c=(e,t)=>e!=null&&t!=null?`${pf(e)} / ${pf(t)}`:null,l=[r&&{key:`cpu`,label:`CPU`,pct:r.pct,detail:`${Math.round(r.pct)}%`},i&&{key:`mem`,label:`RAM`,pct:i.pct,detail:c(i.used_bytes,i.total_bytes)||`${Math.round(i.pct)}%`},a&&{key:`disk`,label:`Disk`,pct:a.pct,detail:c(a.used_bytes,a.total_bytes)||`${Math.round(a.pct)}%`}].filter(Boolean);return(0,f.jsxs)(`div`,{style:t,children:[(0,f.jsx)(`p`,{style:n,children:`Resource Usage`}),l.length>0&&(0,f.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(${l.length}, 1fr)`,gap:`1rem`},children:l.map(e=>(0,f.jsx)(Rf,{label:e.label,pct:Math.round(e.pct),detail:e.detail},e.key))}),o&&(0,f.jsxs)(`div`,{style:{display:`flex`,gap:`1.5rem`,marginTop:l.length?`1rem`:0,fontSize:`0.875rem`},children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{style:{color:`var(--text-faint)`,fontSize:`0.8125rem`},children:`Traffic In`}),(0,f.jsx)(`div`,{style:{color:`var(--text-primary)`,fontWeight:600},children:s(o.in_bps)})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{style:{color:`var(--text-faint)`,fontSize:`0.8125rem`},children:`Traffic Out`}),(0,f.jsx)(`div`,{style:{color:`var(--text-primary)`,fontWeight:600},children:s(o.out_bps)})]})]}),(0,f.jsxs)(`p`,{style:{fontSize:`0.75rem`,color:`var(--text-faint)`,marginTop:`0.85rem`},children:[a?.mount&&a.mount!==`/`?`Disk shown for ${a.mount}. `:``,`Current values, refreshed every few minutes.`]})]})}var Bf=`#3b82f6`,Vf=`#d97706`;function Hf(e){return e==null?`â`:e>=1073741824?`${(e/1073741824).toFixed(2)} GB/s`:e>=1048576?`${(e/1048576).toFixed(1)} MB/s`:e>=1024?`${(e/1024).toFixed(0)} KB/s`:`${Math.round(e)} B/s`}function Uf({series:e,keys:t,floor:n=1,fmt:r,height:i=92}){let[a,o]=(0,l.useState)(null),s=i,c=e||[];if(c.length<2)return(0,f.jsx)(`div`,{style:{height:i,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:`0.8125rem`,color:`var(--text-faint)`},children:`Not enough history yet`});let u=c[0].t,d=c[c.length-1].t,p=d-u||1,m=Math.max(...c.flatMap(e=>t.map(t=>e[t.key]??0)),0),h=Math.max(m*1.25,n),g=e=>(e-u)/p*600,_=e=>s-6-Math.min(e,h)/h*(s-12),v=e=>new Date(e).toLocaleString(`en-AU`,p>3*864e5?{day:`numeric`,month:`short`}:p>6*36e5?{day:`numeric`,month:`short`,hour:`2-digit`,minute:`2-digit`}:{hour:`2-digit`,minute:`2-digit`}),y=e=>{let t=[],n=[];for(let r of c)r[e]==null?(n.length>1&&t.push(n),n=[]):n.push(r);return n.length>1&&t.push(n),t};return(0,f.jsxs)(`div`,{style:{position:`relative`},onMouseMove:e=>{let t=e.currentTarget.getBoundingClientRect(),n=(e.clientX-t.left)/t.width*600,r=null,i=1/0;for(let e of c){let t=Math.abs(g(e.t)-n);t<i&&(i=t,r=e)}r&&o(r)},onMouseLeave:()=>o(null),children:[(0,f.jsx)(`div`,{style:{position:`absolute`,top:-2,right:0,fontSize:`0.7rem`,color:`var(--text-faint)`,pointerEvents:`none`,zIndex:1},children:r(h)}),(0,f.jsxs)(`svg`,{viewBox:`0 0 600 ${s}`,preserveAspectRatio:`none`,style:{width:`100%`,height:i,display:`block`,overflow:`visible`},children:[(0,f.jsx)(`defs`,{children:t.map(e=>(0,f.jsxs)(`linearGradient`,{id:`mg-${e.key}`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,f.jsx)(`stop`,{offset:`0%`,stopColor:e.color,stopOpacity:`0.22`}),(0,f.jsx)(`stop`,{offset:`100%`,stopColor:e.color,stopOpacity:`0`})]},e.key))}),[.25,.5,.75].map(e=>(0,f.jsx)(`line`,{x1:`0`,x2:600,y1:6+e*(s-12),y2:6+e*(s-12),stroke:`var(--border)`,strokeWidth:`1`},e)),t.map(e=>y(e.key).map((n,r)=>{let i=n.map((t,n)=>`${n?`L`:`M`}${g(t.t).toFixed(1)},${_(t[e.key]??0).toFixed(1)}`).join(` `),a=`${i} L${g(n[n.length-1].t).toFixed(1)},${s} L${g(n[0].t).toFixed(1)},${s} Z`;return(0,f.jsxs)(`g`,{children:[t.length===1&&(0,f.jsx)(`path`,{d:a,fill:`url(#mg-${e.key})`}),(0,f.jsx)(`path`,{d:i,fill:`none`,stroke:e.color,strokeWidth:`2`,strokeLinejoin:`round`,strokeLinecap:`round`,vectorEffect:`non-scaling-stroke`})]},`${e.key}-${r}`)})),a&&(0,f.jsx)(`line`,{x1:g(a.t),x2:g(a.t),y1:`0`,y2:s,stroke:`var(--text-faint)`,strokeWidth:`1`,strokeDasharray:`3 3`,vectorEffect:`non-scaling-stroke`})]}),a&&(0,f.jsxs)(`div`,{style:{position:`absolute`,top:0,left:`${Math.min(78,Math.max(2,g(a.t)/600*100))}%`,transform:`translateX(-8px)`,pointerEvents:`none`,background:`var(--bg-elevated)`,border:`1px solid var(--border)`,borderRadius:8,padding:`0.4rem 0.55rem`,fontSize:`0.75rem`,whiteSpace:`nowrap`,zIndex:2},children:[(0,f.jsx)(`div`,{style:{color:`var(--text-faint)`,marginBottom:`0.15rem`}
108,children:new Date(a.t).toLocaleString(`en-AU`,{day:`numeric`,month:`short`,hour:`2-digit`,minute:`2-digit`})}),t.map(e=>(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`0.35rem`,color:`var(--text-primary)`},children:[(0,f.jsx)(`span`,{style:{width:8,height:8,borderRadius:2,background:e.color,flexShrink:0}}),e.label,`: `,a[e.key]==null?`no data`:r(a[e.key])]},e.key))]}),(0,f.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,fontSize:`0.7rem`,color:`var(--text-faint)`,marginTop:`0.15rem`},children:[(0,f.jsx)(`span`,{children:v(u)}),(0,f.jsx)(`span`,{children:v(d)})]})]})}function Wf({label:e,value:t,sub:n}){return(0,f.jsxs)(`div`,{style:{background:`var(--bg-base)`,border:`1px solid var(--border)`,borderRadius:10,padding:`0.6rem 0.7rem`},children:[(0,f.jsx)(`div`,{style:{fontSize:`0.75rem`,color:`var(--text-faint)`},children:e}),(0,f.jsx)(`div`,{style:{fontSize:`1.05rem`,fontWeight:700,color:`var(--text-primary)`,fontVariantNumeric:`tabular-nums`},children:t}),n&&(0,f.jsx)(`div`,{style:{fontSize:`0.72rem`,color:`var(--text-faint)`},children:n})]})}function Gf({serviceId:e,cardStyle:t,sectionHead:n}){let[r,i]=(0,l.useState)(`day`),[a,o]=(0,l.useState)({loading:!0,data:null,error:null});(0,l.useEffect)(()=>{let t=!0;return Z(`/api/portal/services/${e}/vm/metrics?range=${r}`).then(e=>{t&&o({loading:!1,data:e?.ok?e:null,error:e?.ok?null:e?.error||`Metrics are not available right now.`})}).catch(e=>{t&&o({loading:!1,data:null,error:e.message})}),()=>{t=!1}},[e,r]);let{loading:s,data:c,error:u}=a,d=!s&&!!c&&c.range!==r,p=c?.current,m=!!p&&p.status!==`running`,h=c?.series||[],g=c?.ranges||[{key:`hour`,label:`Last hour`},{key:`day`,label:`Last 24 hours`},{key:`week`,label:`Last 7 days`},{key:`month`,label:`Last 30 days`}],_=[{key:`netin_bps`,label:`In`,color:Bf},{key:`netout_bps`,label:`Out`,color:Vf}],v=e=>({padding:`0.25rem 0.6rem`,borderRadius:7,fontSize:`0.78rem`,cursor:`pointer`,border:`1px solid ${e?`var(--accent)`:`var(--border)`}`,background:e?`var(--bg-active)`:`transparent`,color:e?`var(--text-primary)`:`var(--text-muted)`,fontWeight:e?600:500});return(0,f.jsxs)(`div`,{style:t,children:[(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:`0.75rem`,flexWrap:`wrap`},children:[(0,f.jsxs)(`p`,{style:{...n,marginBottom:0},children:[`Server Metrics`,d&&(0,f.jsx)(`span`,{style:{marginLeft:`0.5rem`,fontWeight:400,textTransform:`none`,letterSpacing:0,color:`var(--text-faint)`},children:`updatingâ¦`})]}),(0,f.jsx)(`div`,{style:{display:`flex`,gap:`0.35rem`,flexWrap:`wrap`},children:g.map(e=>(0,f.jsx)(`button`,{onClick:()=>i(e.key),style:v(e.key===r),children:e.label},e.key))})]}),s&&!c?(0,f.jsxs)(`div`,{style:{padding:`1.5rem 0`,textAlign:`center`,color:`var(--text-faint)`,fontSize:`0.875rem`},children:[(0,f.jsx)(X,{size:16,style:{animation:`spin 1s linear infinite`}}),` Reading metricsâ¦`]}):u?(0,f.jsx)(`div`,{style:{padding:`0.75rem 0`,color:`var(--text-muted)`,fontSize:`0.875rem`},children:u}):(0,f.jsxs)(f.Fragment,{children:[m&&(0,f.jsx)(`div`,{style:{marginTop:`0.85rem`,padding:`0.5rem 0.7rem`,borderRadius:8,background:`var(--bg-base)`,border:`1px solid var(--border)`,fontSize:`0.8125rem`,color:`var(--text-muted)`},children:`This server is powered off. The history below runs up to the moment it stopped.`}),p&&!m&&(0,f.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(120px, 1fr))`,gap:`0.6rem`,marginTop:`0.85rem`},children:[(0,f.jsx)(Wf,{label:`CPU`,value:p.cpu_pct==null?`â`:`${p.cpu_pct}%`,sub:p.cores?`${p.cores} vCPU`:null}),(0,f.jsx)(Wf,{label:`Memory allocated`,value:pf(p.mem_bytes),sub:p.maxmem_bytes?`of ${pf(p.maxmem_bytes)}`:null}),(0,f.jsx)(Wf,{label:`Uptime`,value:mf(p.uptime),sub:p.status}),(0,f.jsx)(Wf,{label:`Transferred`,value:pf(p.netin_total),sub:`in · ${pf(p.netout_total)} out`})]}),(0,f.jsxs)(`div`,{style:{marginTop:`1.1rem`},children:[(0,f.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`baseline`,marginBottom:`0.3rem`},children:[(0,f.jsx)(`span`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`},children:`CPU usage`}),(0,f.jsxs)(`span`,{style:{fontSize:`0.75rem`,color:`var(--text-faint)`},children:[`peak `,(()=>{let e=h.map(e=>e.cpu_pct).filter(e=>e!=null);return e.length?`${Math.max(...e).toFixed(1)}%`:`â`})()]})]}),(0,f.jsx)(Uf,{series:h,keys:[{key:`cpu_pct`,label:`CPU`,color:Bf}],floor:10,fmt:e=>`${e.toFixed(1)}%`})]}),(0,f.jsxs)(`div`,{style:{marginTop:`1.1rem`},children:[(0,f.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`baseline`,marginBottom:`0.3rem`,gap:`0.75rem`,flexWrap:`wrap`},children:[(0,f.jsx)(`span`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`},children:`Network`}),(0,f.jsx)(`div`,{style:{display:`flex`,gap:`0.75rem`},children:_.map(e=>(0,f.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:`0.3rem`,fontSize:`0.75rem`,color:`var(--text-faint)`},children:[(0,f.jsx)(`span`,{style:{width:8,height:8,borderRadius:2,background:e.color}}),e.label]},e.key))})]}),(0,f.jsx)(Uf,{series:h,keys:_,floor:1024,fmt:Hf})]}),(0,f.jsxs)(`div`,{style:{marginTop:`1.1rem`},children:[(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`,marginBottom:`0.45rem`},children:`Disk usage`}),c?.filesystems?.length?c.filesystems.map(e=>{let t=e.used_pct!=null&&e.used_pct>=90;return(0,f.jsxs)(`div`,{style:{marginBottom:`0.55rem`},children:[(0,f.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,fontSize:`0.78rem`,marginBottom:`0.25rem`},children:[(0,f.jsx)(`span`,{style:{color:`var(--text-primary)`,fontFamily:`ui-monospace, monospace`},children:e.mountpoint}),(0,f.jsxs)(`span`,{style:{color:`var(--text-faint)`},children:[pf(e.used_bytes),` / `,pf(e.total_bytes),e.used_pct!=null&&` · ${e.used_pct}%`,t&&(0,f.jsx)(`span`,{style:{color:`#f87171`,fontWeight:600},children:` · nearly full`})]})]}),(0,f.jsx)(`div`,{style:{height:6,borderRadius:4,background:`var(--bg-base)`,border:`1px solid var(--border)`,overflow:`hidden`},children:(0,f.jsx)(`div`,{style:{width:`${Math.min(100,e.used_pct||0)}%`,height:`100%`,borderRadius:4,background:t?`#f87171`:Bf}})})]},e.mountpoint)}):(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-faint)`},children:m?`Disk usage is read from inside the server, so it is only available while it is running.`:`Disk usage needs the guest agent, which this
108server is not reporting.`})]}),(0,f.jsxs)(`p`,{style:{fontSize:`0.72rem`,color:`var(--text-faint)`,marginTop:`0.9rem`},children:[`CPU, memory and network measured by the hypervisor at one-minute resolution.`,c?.sources?.filesystems?` Disk read from inside the server.`:``]})]})]})}function Kf({data:e,cardStyle:t,sectionHead:n}){let[r,i]=(0,l.useState)(!1),{panel_url:a,panel_username:o,panel_password:s}=e||{};if(!a&&!o&&!s)return null;let c={display:`flex`,alignItems:`center`,gap:`0.5rem`,padding:`0.5rem 0`,borderBottom:`1px solid var(--border)`},u={fontSize:`0.8125rem`,color:`var(--text-faint)`,width:130,flexShrink:0},d={fontSize:`0.875rem`,color:`var(--text-primary)`,fontFamily:`ui-monospace, monospace`,wordBreak:`break-all`},p=({label:e,children:t})=>(0,f.jsxs)(`div`,{style:c,children:[(0,f.jsx)(`span`,{style:u,children:e}),(0,f.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`0.5rem`,flex:1,minWidth:0},children:t})]}),m=({text:e})=>(0,f.jsx)(`button`,{onClick:()=>navigator.clipboard.writeText(e),title:`Copy`,style:{background:`none`,border:`none`,color:`var(--accent)`,cursor:`pointer`,padding:2,display:`flex`,flexShrink:0},children:(0,f.jsx)(oc,{size:14})});return(0,f.jsxs)(`div`,{style:t,children:[(0,f.jsx)(`p`,{style:n,children:`Control Panel Access`}),a&&(0,f.jsxs)(p,{label:`Control Panel URL`,children:[(0,f.jsx)(`a`,{href:a,target:`_blank`,rel:`noopener noreferrer`,style:{...d,color:`var(--accent)`},children:a}),(0,f.jsx)(m,{text:a})]}),o&&(0,f.jsxs)(p,{label:`Username`,children:[(0,f.jsx)(`span`,{style:d,children:o}),(0,f.jsx)(m,{text:o})]}),s?(0,f.jsxs)(p,{label:`Password`,children:[(0,f.jsx)(`span`,{style:{...d,letterSpacing:r?`normal`:`0.15em`},children:r?s:`â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢`}),(0,f.jsx)(`button`,{onClick:()=>i(e=>!e),title:r?`Hide`:`Reveal`,style:{background:`none`,border:`none`,color:`var(--accent)`,cursor:`pointer`,padding:2,display:`flex`,flexShrink:0},children:r?(0,f.jsx)(uc,{size:14}):(0,f.jsx)(dc,{size:14})}),(0,f.jsx)(m,{text:s})]}):(0,f.jsx)(p,{label:`Password`,children:(0,f.jsx)(`span`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`},children:`Not on file â contact support if you need it reset.`})})]})}function qf({s:e,data:t,cardStyle:n,serviceId:r,canSso:i=!0}){if(!t||t.ok===!1)return null;let a=t.type,o={fontSize:`0.8125rem`,fontWeight:600,textTransform:`uppercase`,letterSpacing:`0.08em`,color:`var(--text-faint)`,marginBottom:`0.75rem`},s=(e,t,n,r)=>(0,f.jsxs)(`div`,{style:{marginBottom:`1rem`},children:[(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`0.55rem`},children:[(0,f.jsx)(`div`,{style:{width:34,height:34,borderRadius:9,background:`var(--bg-active)`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,f.jsx)(e,{size:17,style:{color:`var(--accent)`}})}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{style:{fontSize:`1rem`,fontWeight:700,color:`var(--text-primary)`,lineHeight:1.2},children:t}),(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,marginTop:1},children:n})]})]}),r&&(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`,marginTop:`0.6rem`},children:r})]});if(a===`proxmox`){let e=t.vm_status===`running`,r=t.vm_status===`stopped`,i=(0,f.jsx)(`span`,{style:{color:e?`#34d399`:r?`#f87171`:`#fbbf24`,fontWeight:600},children:e?`Powered on · up ${mf(t.uptime)}`:r?`Powered off`:t.vm_status||`Unknown`});return(0,f.jsxs)(`div`,{style:n,children:[(0,f.jsx)(`p`,{style:o,children:`Overview`}),s(Yc,`Virtual Server`,i,t.ip?`IP ${t.ip}`:``),(0,f.jsx)(`p`,{style:{fontSize:`0.8125rem`,color:`var(--text-faint)`},children:`Resource usage, power controls and network details are below.`})]})}if(a===`ssl`){let r=t.cert,i=r?r.days_remaining<0?`expired`:r.days_remaining<30?`expiring`:`valid`:`unknown`,a=i===`expired`?`#f87171`:i===`expiring`?`#fbbf24`:`var(--text-primary)`,c=e=>e?new Date(e).toLocaleDateString(`en-AU`,{day:`numeric`,month:`short`,year:`numeric`}):`â`,l=(0,f.jsxs)(`span`,{style:{color:Od(e.status),fontWeight:600},children:[e.status,t.plan?` · ${t.plan}`:``]});return(0,f.jsxs)(`div`,{style:n,children:[(0,f.jsx)(`p`,{style:o,children:`Overview`}),s(Xc,`SSL Certificate`,l,t.domain&&`Secures ${t.domain}`),r?(0,f.jsxs)(`div`,{style:{display:`flex`,gap:`1.5rem`,flexWrap:`wrap`},children:[(0,f.jsxs)(`span`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`},children:[`Issuer `,(0,f.jsx)(`strong`,{style:{color:`var(--text-primary)`},children:r.issuer||`â`})]}),(0,f.jsxs)(`span`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`},children:[`Expires `,(0,f.jsx)(`strong`,{style:{color:a},children:c(r.valid_to)}),r.days_remaining>=0?` · ${r.days_remaining} days left`:` · expired`]})]}):(0,f.jsx)(`p`,{style:{fontSize:`0.8125rem`,color:`var(--text-faint)`},children:`Live certificate could not be verified right now.`})]})}if(a===`dns`){let a=(0,f.jsxs)(`span`,{style:{color:Od(e.status),fontWeight:600},children:[e.status,t.plan?` · ${t.plan}`:``]});return(0,f.jsxs)(`div`,{style:n,children:[(0,f.jsx)(`p`,{style:o,children:`Overview`}),s(Fc,`Managed DNS Hosting`,a),t.nameservers?.length>0&&(0,f.jsxs)(`div`,{style:{marginTop:`0.2rem`},children:[(0,f.jsx)(`p`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`,marginBottom:`0.6rem`},children:`To use this service, point each domainâs nameservers at ours, at the registrar where the domain is registered:`}),(0,f.jsx)(`div`,{style:{display:`grid`,gap:`0.4rem`,maxWidth:360},children:t.nameservers.map(e=>(0,f.jsx)(Nf,{value:e},e))}),(0,f.jsx)(`p`,{style:{fontSize:`0.78rem`,color:`var(--text-faint)`,marginTop:`0.6rem`},children:`Changes take a few hours to spread across the internet. Until then the domain keeps answering from wherever its DNS is now.`})]}),i&&t.cpanel_login&&Td(e)&&r!=null&&(0,f.jsx)(Df,{serviceId:r})]})}if(a===`cpanel`||a===`enhance`||a===`clouddedicated`){let c=Math.round(t.disk_pct||0),l=Math.round(t.bw_pct||0),u=(0,f.jsxs)(`span`,{style:{color:Od(e.status),fontWeight:600},children:[e.status,t.plan?` · ${t.plan}`:``]}),d=[(t.main_domain||e.domain)&&`Primary domain ${t.main_domain||e.domain}`,t.username&&`User ${t.username}`,t.ip&&`IP ${t.ip}
108`].filter(Boolean);return(0,f.jsxs)(`div`,{style:n,children:[(0,f.jsx)(`p`,{style:o,children:`Overview`}),s(a===`clouddedicated`?Yc:gc,a===`clouddedicated`?`Cloud Dedicated Server`:a===`enhance`?`Cloud Hosting`:`Web Hosting`,u,d.join(` · `)),t.layout?.usage!==!1&&(0,f.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:`1rem`},children:[(0,f.jsx)(Rf,{label:`Disk usage`,pct:c,unlimited:t.disk_unlimited,detail:t.disk_unlimited?`Unlimited`:t.disk_used_bytes!=null&&t.disk_limit_bytes?`${pf(t.disk_used_bytes)} / ${pf(t.disk_limit_bytes)}`:t.disk_used!=null&&t.disk_limit?`${ff(t.disk_used)} / ${ff(t.disk_limit)}`:`${c}%`}),(0,f.jsx)(Rf,{label:`Bandwidth`,pct:l,unlimited:t.bw_unlimited,detail:t.bw_unlimited?`Unlimited`:t.bw_used_bytes!=null&&t.bw_limit_bytes?`${pf(t.bw_used_bytes)} / ${pf(t.bw_limit_bytes)}`:`${l}%`})]}),(t.email_count!=null||t.db_count!=null)&&(0,f.jsxs)(`div`,{style:{display:`flex`,gap:`1.5rem`,marginTop:`0.85rem`,flexWrap:`wrap`},children:[t.domain_count!=null&&(0,f.jsxs)(`span`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`},children:[(0,f.jsx)(`strong`,{style:{color:`var(--text-primary)`},children:t.domain_count}),` domain`,t.domain_count===1?``:`s`]}),t.email_count!=null&&(0,f.jsxs)(`span`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`},children:[(0,f.jsx)(`strong`,{style:{color:`var(--text-primary)`},children:t.email_count}),` email account`,t.email_count===1?``:`s`]}),t.db_count!=null&&(0,f.jsxs)(`span`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`},children:[(0,f.jsx)(`strong`,{style:{color:`var(--text-primary)`},children:t.db_count}),` database`,t.db_count===1?``:`s`]}),t.php_version&&a!==`clouddedicated`&&(0,f.jsxs)(`span`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`},children:[`PHP `,(0,f.jsx)(`strong`,{style:{color:`var(--text-primary)`},children:t.php_version})]})]}),i&&t.layout?.login!==!1&&a===`cpanel`&&Td(e)&&r!=null&&(0,f.jsx)(Df,{serviceId:r}),i&&t.layout?.login!==!1&&(a===`enhance`||a===`clouddedicated`)&&Td(e)&&r!=null&&t.enhance_customer_id&&(0,f.jsx)(Af,{serviceId:r})]})}return null}function Jf({serviceId:e,service:t,data:n,cardStyle:r,sectionHead:i}){let[a,o]=(0,l.useState)(null),[s,c]=(0,l.useState)(null),[u,d]=(0,l.useState)(!0),[p,m]=(0,l.useState)(null),[h,g]=(0,l.useState)(!1),[_,v]=(0,l.useState)(``),[y,b]=(0,l.useState)([]),[x,S]=(0,l.useState)(``),[C,w]=(0,l.useState)(``),[T,E]=(0,l.useState)(``),[D,O]=(0,l.useState)(!1),[k,A]=(0,l.useState)(null),[j,M]=(0,l.useState)(!1),[N,P]=(0,l.useState)(null),[F,I]=(0,l.useState)(``),[L,R]=(0,l.useState)(!1),[z,B]=(0,l.useState)(`npm run build`),[V,H]=(0,l.useState)(`dist`),[U,W]=(0,l.useState)(!0),[G,ee]=(0,l.useState)(`app`),[te,ne]=(0,l.useState)(!1),[re,K]=(0,l.useState)(`3000`),[ie,q]=(0,l.useState)(`stable`),[ae,oe]=(0,l.useState)(``),[se,ce]=(0,l.useState)(`npm start`),[le,ue]=(0,l.useState)(``),[de,fe]=(0,l.useState)(null),[pe,me]=(0,l.useState)(null),[he,ge]=(0,l.useState)(!1),[_e,ve]=(0,l.useState)(null),ye=(0,l.useRef)({}),be=[n.main_domain,...n.subdomains||[],...n.addon_domains||[]].filter(Boolean),xe=C||be[0]||n.main_domain||``,Se=Array.isArray(n.allowances)&&n.allowances.length>0&&!n.allowances.includes(`featureSSH`),Ce=(pe||[])[0]||null,we=!!_e&&(Ce?.run_id||null)===_e.baseline,Te=we||Ce?.status===`running`,Ee=we?`queued`:Ce?.status===`running`?`running`:null,De=(0,l.useCallback)(()=>{d(!0),Promise.all([Z(`/api/portal/github/status`),Z(`/api/portal/services/${e}/github`),Z(`/api/portal/services/${e}/github/runs?limit=10`)]).then(([e,t,n])=>{o(e?.ok?e:{configured:!1,installed:!1}),c(t?.connection||null),me(n?.ok&&n.runs||[])}).finally(()=>d(!1))},[e]),Oe=e=>(e||[]).map(e=>`${e.run_id}:${e.status}:${e.finished_at||``}`).join(`|`),ke=(0,l.useCallback)(()=>{Z(`/api/portal/services/${e}/github/runs?limit=10`).then(e=>{e?.ok&&me(t=>Oe(t)===Oe(e.runs)?t:e.runs||[])})},[e]);(0,l.useEffect)(()=>{De()},[De]),(0,l.useEffect)(()=>{if(!Te)return;let e=setInterval(()=>{_e&&Date.now()-_e.since>180*1e3&&ve(null),ke()},3e3);return()=>clearInterval(e)},[Te,ke,_e]),(0,l.useEffect)(()=>
108{if(new URLSearchParams(window.location.search).get(`github`)){De();let e=new URL(window.location.href);e.searchParams.delete(`github`),window.history.replaceState({},``,e.pathname+e.search)}},[De]);let Ae=()=>{g(!0),Z(`/api/portal/github/repos`).then(e=>m(e?.repos||[])).finally(()=>g(!1))};(0,l.useEffect)(()=>{a?.installed&&!s&&p===null&&Ae()},[a,s]);let je=e=>{v(e),S(``),b([]),A(null),E(``),O(!1),e&&Z(`/api/portal/github/branches?repo=${encodeURIComponent(e)}`).then(t=>{let n=t?.branches||[];b(n);let r=p?.find(t=>t.full_name===e);S(n.includes(r?.default_branch)?r.default_branch:n[0]||``)})};(0,l.useEffect)(()=>{if(!_||!x)return;let e=`${_}@${x}`,t=e=>{if(A(e),!e?.kind)return;D||E(e.kind);let t=e.suggested||{};R(!!t.build),t.publishDir&&H(t.publishDir),t.buildCommand&&B(t.buildCommand),t.command&&ce(t.command),t.nodeVersion&&q(t.nodeVersion)};if(ye.current[e]){Promise.resolve(ye.current[e]).then(t);return}M(!0),Z(`/api/portal/github/inspect?repo=${encodeURIComponent(_)}&branch=${encodeURIComponent(x)}`).then(n=>{n?.ok&&(ye.current[e]=n,t(n))}).finally(()=>M(!1))},[_,x]),(0,l.useEffect)(()=>{!xe||s||Z(`/api/portal/services/${e}/github/target?domain=${encodeURIComponent(xe)}`).then(e=>{e?.ok&&P({...e,domain:e.domain||xe})})},[xe,e,s]);let Me=N?.domain===xe?N:null,Ne=F===xe,Pe=(T===`site`||T===`app`&&U)&&Me&&Me.occupied!==`no`,Fe=()=>{Z(`/api/portal/github/install-url?service=${encodeURIComponent(t?.public_id||``)}`).then(e=>{e?.url?window.location.href=e.url:fe({kind:`err`,text:e?.error||`GitHub deploys are not configured yet.`})})},Ie=()=>{fe(null),ue(`connect`),Z(`/api/portal/services/${e}/github/connect`,{method:`POST`,body:JSON.stringify({repo:_,branch:x,kind:T,domain:xe,...T===`site`?{build:L,buildCommand:z,publishDir:V}:{path:U?``:G,port:parseInt(re,10)||3e3,nodeVersion:ie,workingDirectory:ae,command:se},overwriteAck:Ne})}).then(e=>{e?.ok?(c(e.connection),ve({since:Date.now(),baseline:null})):e?.needs_ack?(P({...e.target,domain:e.target?.domain||xe}),I(``),fe({kind:`err`,text:`Please confirm the replacement below before connecting.`})):fe({kind:`err`,text:e?.error||`Could not connect the repository.`})}).finally(()=>ue(``))},Le=()=>{fe(null),ue(`redeploy`),Z(`/api/portal/services/${e}/github/redeploy`,{method:`POST`}).then(e=>{e?.ok?ve({since:Date.now(),baseline:(pe||[])[0]?.run_id||null}):fe({kind:`err`,text:e?.error||`Could not trigger a deploy.`})}).finally(()=>ue(``))},Re=()=>{let e=(a?.accounts||[]).join(`, `)||`your GitHub account`;window.confirm(`Disconnect ${e}?\n\nThis removes our access to your repositories and stops any site on this account deploying from GitHub. Your repositories and the files already published are not affected.`)&&(fe(null),ue(`unlink`),Z(`/api/portal/github/installation`,{method:`DELETE`}).then(e=>{e?.ok?(c(null),m(null),v(``),S(``),E(``),O(!1),o(e=>({...e||{},installed:!1,accounts:[]})),fe({kind:`ok`,text:e.services?`Disconnected. ${e.services} deploy connection${e.services===1?``:`s`} removed.`:`GitHub disconnected.`})):fe({kind:`err`,text:e?.error||`Could not disconnect GitHub.`})}).finally(()=>ue(``)))},ze=()=>{let t=s?.deploy_kind===`site`?`Disconnect this repository? This removes the deploy workflow from your repo. The files already published stay on the server.`:`Disconnect this repository? This removes the deploy workflow and the Node.js app. The files already deployed stay on the server.`;window.confirm(t)&&(fe(null),ue(`disconnect`),Z(`/api/portal/services/${e}/github`,{method:`DELETE`,body:JSON.stringify({removeFromRepo:!0})}).then(e=>{e?.ok?(c(null),v(``),S(``),m(null),E(``),O(!1),fe({kind:`ok`,text:`Disconnected.`})):fe({kind:`err`,text:e?.error||`Could not disconnect.`})}).finally(()=>ue(``)))},Be={width:`100%`,padding:`0.5rem 0.65rem`,borderRadius:8,border:`1px solid var(--border)`,background:`var(--bg-elevated)`,color:`var(--text-primary)`,fontSize:`0.85rem`},Ve={fontSize:`0.8125rem`,color:`var(--text-faint)`,marginBottom:3,display:`block`},He={fontSize:`0.8125rem`,color:`var(--text-faint)`,marginTop:4,lineHeight:1.5},Ue={fontSize:`0.8125rem`,fontWeight:700,color:`var(--text-primary)`,marginBottom:`0.4rem`},We=e=>({border:`1px solid ${e?`var(--accent)`:`var(--border)`}`,background:e?`color-mix(in srgb, var(--accent) 8%, transparent)`:`var(--bg-elevated)`,borderRadius:9,padding:`0.7rem 0.85rem`,cursor:`pointer`,display:`flex`,gap:`0.55rem`,alignItems:`flex-start`}),Ge=e=>(0,f.jsx)(`span`,{style:{width:15,height:15,borderRadius:`50%`,border:`2px solid ${e?`var(--accent)`:`var(--text-muted)`}`,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0,marginTop:2},children:e&&(0,f.jsx)(`span`,{style:{width:7,height:7,borderRadius:`50%`,background:`var(--accent)`}})}),Ke=(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`0.5rem`,marginBottom:`0.85rem`},children:[(0,f.jsx)(hc,{size:16,style:{color:`var(--accent)`}}),(0,f.jsx)(`p`,{style:{...i,margin:0},children:`Deploy from GitHub`})]}),qe=de&&(0,f.jsxs)(`div`,{className:de.kind===`ok`?`alert-success`:`alert-error`,style:{marginTop:`0.75rem`},children:[de.kind===`ok`?(0,f.jsx)(Is,{size:15}):(0,f.jsx)(Y,{size:15}),de.text]});if(u)return(0,f.jsxs)(`div`,{style:r,children:[Ke,(0,f.jsx)(`p`,{style:{fontSize:`0.82rem`,color:`var(--text-muted)`},children:`Loadingâ¦`})]});if(!a?.configured)return null;if(Se&&!s)return(0,f.jsxs)(`div`,{style:r,children:[Ke,(0,f.jsxs)(`div`,{className:`alert-warning`,children:[(0,f.jsx)(Y,{size:15}),`Deploying from GitHub needs SSH access, which isnât included on this hosting plan. Contact support about mov
108ing to a plan that has it.`]})]});if(s){let e=s.deploy_kind===`site`,t=s.domain?`https://${s.domain}`:null,n=s.domain?`https://${s.domain}${s.proxy_path?`/${String(s.proxy_path).replace(/^\/+/,``)}`:``}`:null,i=e=>e?(0,f.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,style:{color:`var(--accent)`,textDecoration:`none`},children:e}):`â`,a=e?[[`Repository`,s.repo_full_name],[`Branch`,s.branch],[`Published at`,i(t)],[`Web folder`,s.document_root||`â`],[`Build`,s.build_enabled?`${s.build_command} â ${s.publish_dir}`:`None â your files are published as they are`],[`Deploy path`,s.deploy_path||`â`]]:[[`Repository`,s.repo_full_name],[`Branch`,s.branch],[`App URL`,i(n)],[`Serving`,s.proxy_path?`the /${s.proxy_path} path`:`the whole domain`],[`Port`,s.port],[`Node version`,s.node_version],[`Hosting user`,s.ssh_user||`â`],[`Deploy path`,s.deploy_path||`â`]],o=e?`#34d399`:`#3b82f6`,c={running:{c:`#fbbf24`,t:`Deployingâ¦`},success:{c:`#34d399`,t:`Succeeded`},failure:{c:`#f87171`,t:`Failed`},cancelled:{c:`var(--text-muted)`,t:`Cancelled`},skipped:{c:`var(--text-muted)`,t:`Skipped`}},l=e=>{if(!e)return``;let t=Math.max(0,(Date.now()-new Date(e).getTime())/1e3);if(t<60)return`just now`;let n=Math.round(t/60);if(n<60)return`${n} minute${n===1?``:`s`} ago`;let r=Math.round(n/60);if(r<24)return`${r} hour${r===1?``:`s`} ago`;let i=Math.round(r/24);return i<30?`${i} day${i===1?``:`s`} ago`:new Date(e).toLocaleDateString(`en-AU`,{day:`numeric`,month:`short`,year:`numeric`})},u=e=>(0,f.jsx)(`span`,{style:{width:8,height:8,borderRadius:`50%`,flexShrink:0,background:(c[e]||c.skipped).c,...e===`running`?{animation:`pulse 1.5s ease-in-out infinite`}:{}}}),d=(pe||[])[0];return(0,f.jsxs)(`div`,{style:r,children:[Ke,(0,f.jsx)(`div`,{style:{marginBottom:`0.85rem`},children:(0,f.jsx)(`span`,{style:{fontSize:`0.8125rem`,fontWeight:600,padding:`0.15rem 0.45rem`,borderRadius:4,background:`${o}20`,color:o,border:`1px solid ${o}40`},children:e?`Website`:`Node.js app`})}),(0,f.jsxs)(`div`,{style:{position:`relative`,overflow:`hidden`,display:`flex`,alignItems:`center`,gap:`0.5rem`,padding:`0.6rem 0.75rem`,marginBottom:`0.85rem`,borderRadius:9,background:Te?`color-mix(in srgb, var(--accent) 7%, var(--bg-elevated))`:`var(--bg-elevated)`,border:`1px solid ${Te?`color-mix(in srgb, var(--accent) 35%, var(--border))`:`var(--border)`}`,transition:`background 200ms ease, border-color 200ms ease`},children:[Te&&(0,f.jsx)(`div`,{"aria-hidden":!0,style:{position:`absolute`,top:0,left:0,right:0,height:2,background:`color-mix(in srgb, var(--accent) 18%, transparent)`},children:(0,f.jsx)(`div`,{style:{width:`33%`,height:`100%`,background:`var(--accent)`,animation:`indeterminate 1.4s ease-in-out infinite`}})}),Te?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(X,{size:15,style:{color:`var(--accent)`,flexShrink:0,animation:`spin 1s linear infinite`}}),(0,f.jsxs)(`div`,{style:{minWidth:0,flex:1},"aria-live":`polite`,children:[(0,f.jsx)(`div`,{style:{fontSize:`0.85rem`,color:`var(--text-primary)`,fontWeight:600},children:Ee===`queued`?`Waiting for GitHub to start the deployâ¦`:`Deploying â building and publishing your siteâ¦`}),(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`,lineHeight:1.45,...Ee===`queued`?{}:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`}},children:Ee===`queued`?`This usually starts within a few seconds. You can leave this page â the deploy keeps going.`:(0,f.jsxs)(f.Fragment,{children:[d?.commit_sha?(0,f.jsx)(`code`,{children:String(d.commit_sha).slice(0,7)}):null,d?.commit_message?` ${d.commit_message.split(` 109`)[0]}`:` Your site is unchanged until this finishes.`]})})]}),d?.run_url&&Ee===`running`&&(0,f.jsx)(`a`,{href:d.run_url,target:`_blank`,rel:`noreferrer`,style:{flexShrink:0,color:`var(--accent)`,textDecoration:`none`,fontSize:`0.8125rem`},children:`Live log`})]}):d?(0,f.jsxs)(f.Fragment,{children:[u(d.status),(0,f.jsxs)(`div`,{style:{minWidth:0,flex:1},"aria-live":`polite`,children:[(0,f.jsxs)(`div`,{style:{fontSize:`0.85rem`,color:`var(--text-primary)`,fontWeight:600},children:[d.status===`success`?`Deployed`:(c[d.status]||c.skipped).t,(0,f.jsxs)(`span`,{style:{fontWeight:400,color:`var(--text-muted)`},children:[` · `,l(d.finished_at||d.received_at)]})]}),(d.commit_sha||d.commit_message)&&(0,f.jsxs)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:[d.commit_sha?(0,f.jsx)(`code`,{children:String(d.commit_sha).slice(0,7)}):null,d.commit_message?` ${d.commit_message.split(` 110`)[0]}`:``,d.actor?` â ${d.actor}`:``]}),d.status===`failure`&&(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`,marginTop:2},children:`Your site hasnât changed â the previous version is still live.`})]}),pe.length>1&&(0,f.jsx)(`button`,{onClick:()=>ge(e=>!e),style:{background:`none`,border:`none`,color:`var(--accent)`,fontSize:`0.8125rem`,cursor:`pointer`,flexShrink:0},children:he?`Hide`:`History`})]}):(0,f.jsxs)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`},children:[`No deploys recorded yet â push to `,(0,f.jsx)(`code`,{children:s.branch}),`, or use Redeploy below.`]})]}),he&&(0,f.jsx)(`div`,{style:{marginBottom:`0.85rem`,border:`1px solid var(--border)`,borderRadius:9,overflow:`hidden`},children:(pe||[]).map(e=>(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`0.5rem`,padding:`0.45rem 0.75rem`,borderBottom:`1px solid var(--border)`,fontSize:`0.8125rem`},children:[u(e.status),(0,f.jsx)(`code`,{style:{flexShrink:0,color:`var(--text-muted)`},children:e.commit_sha?String(e.commit_sha).slice(0,7):`â`}),(0,f.jsx)(`span`,{style:{flex:1,minWidth:0,color:`var(--text-primary)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.commit_message?e.commit_message.split(` 111`)[0]:(c[e.status]||c.skipped).t}),(0,f.jsx)(`span`,{style:{flexShrink:0,color:`var(--text-faint)`},children:l(e.finished_at||e.received_at)}),e.run_url&&(0,f.jsx)(`a`,{href:e.run_url,target:`_blank`,rel:`noreferrer`,style:{flexShrink:0,color:`var(--accent)`,textDecoration:`none`},children:`log`})]},e.run_id))}),(0,f.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:`0.6rem 1rem`,marginBottom:`0.85rem`},children:a.map(([e,t])=>(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-faint)`,marginBottom:2},children:e}),(0,f.jsx)(`div`,{style:{fontSize:`0.82rem`,color:`var(--text-primary)`,fontWeight:500,wordBreak:`break-all`},children:t})]},e))}),(0,f.jsxs)(`div`,{style:{display:`flex`,gap:`0.6rem`,flexWrap:`wrap`},children:[(0,f.jsx)(`button`,{className:`btn-primary`,onClick:Le,disabled:le||Te,children:le===`redeploy`||Te?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(X,{size:14,style:{animation:`spin 1s linear infinite`}}),` Deployingâ¦`]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(Kc,{size:14}),` Redeploy`]})}),(0,f.jsxs)(`a`,{href:`https://github.com/${s.repo_full_name}/actions`,target:`_blank`,rel:`noreferrer`,className:`btn-secondary`,style:{textDecoration:`none`},children:[`View deploys `,(0,f.jsx)(Js,{size:14})]}),(0,f.jsxs)(`button`,{className:`btn-danger`,onClick:ze,disabled:le||Te,children:[le===`disconnect`?(0,f.jsx)(X,{size:14,style:{animation:`spin 1s linear infinite`}}):(0,f.jsx)(ol,{size:14}),` Disconnect`]})]}),qe]})}if(!a.installed)return(0,f.jsxs)(`div`,{style:r,children:[Ke,(0,f.jsx)(`p`,{style:{fontSize:`0.82rem`,color:`var(--text-muted)`,marginBottom:`0.85rem`}
111,children:`Connect a GitHub repository to publish your website or app to this hosting account automatically on every push.`}),(0,f.jsxs)(`button`,{className:`btn-primary`,onClick:Fe,children:[(0,f.jsx)(hc,{size:14}),` Connect GitHub`]}),qe]});let Je=_&&x&&T&&(!Pe||Ne)&&!le;return(0,f.jsxs)(`div`,{style:r,children:[Ke,(0,f.jsxs)(`div`,{style:{display:`grid`,gap:`1.1rem`},children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{style:Ue,children:`1. Which repository?`}),(0,f.jsxs)(`select`,{value:_,onChange:e=>je(e.target.value),style:Be,disabled:h,children:[(0,f.jsx)(`option`,{value:``,children:h?`Loading repositoriesâ¦`:`Select a repositoryâ¦`}),(p||[]).map(e=>(0,f.jsxs)(`option`,{value:e.full_name,children:[e.full_name,e.private?` (private)`:``]},e.full_name))]}),(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`0.75rem`,flexWrap:`wrap`,paddingTop:`0.3rem`},children:[(0,f.jsx)(`button`,{onClick:Fe,style:{background:`none`,border:`none`,color:`var(--accent)`,fontSize:`0.8125rem`,cursor:`pointer`,padding:0},children:`Repository missing? Manage GitHub access â`}),(0,f.jsx)(`button`,{onClick:Re,disabled:le,style:{background:`none`,border:`none`,color:`var(--text-muted)`,fontSize:`0.8125rem`,cursor:`pointer`,padding:0},children:le===`unlink`?`Disconnectingâ¦`:`Disconnect ${(a?.accounts||[]).join(`, `)||`GitHub`}`})]})]}),_&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{style:Ue,children:`2. Which branch, and where should it go?`}),(0,f.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:`0.75rem`},children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{style:Ve,children:`Branch`}),(0,f.jsxs)(`select`,{value:x,onChange:e=>S(e.target.value),style:Be,disabled:!y.length,children:[!y.length&&(0,f.jsx)(`option`,{value:``,children:`Loadingâ¦`}),y.map(e=>(0,f.jsx)(`option`,{value:e,children:e},e))]}),(0,f.jsx)(`div`,{style:He,children:`Every push to this branch deploys.`})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{style:Ve,children:`Domain`}),(0,f.jsxs)(`select`,{value:xe,onChange:e=>w(e.target.value),style:Be,children:[be.length===0&&(0,f.jsx)(`option`,{value:``,children:n.main_domain||`Primary domain`}),be.map(e=>(0,f.jsx)(`option`,{value:e,children:e},e))]}),Me?.shared_with?.length>0&&(0,f.jsxs)(`div`,{style:He,children:[(0,f.jsx)(Y,{size:12,style:{verticalAlign:-2,color:`#fbbf24`}}),` `,Me.shared_with.join(`, `),` `,Me.shared_with.length===1?`shares`:`share`,` the same folder, so `,Me.shared_with.length===1?`it`:`they`,` will show this too.`]})]})]})]}),_&&x&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{style:Ue,children:`3. What are you deploying?`}),(0,f.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:`0.6rem`},children:[(0,f.jsxs)(`div`,{style:We(T===`site`),onClick:()=>{E(`site`),O(!0)},children:[Ge(T===`site`),(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`div`,{style:{fontSize:`0.85rem`,fontWeight:600,color:`var(--text-primary)`,display:`flex`,alignItems:`center`,gap:`0.35rem`},children:[(0,f.jsx)(gc,{size:14}),` A website`]}),(0,f.jsxs)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`,marginTop:2,lineHeight:1.45},children:[`HTML, PHP, or a site built from source. Your files are published to the web folder for `,xe||`your domain`,`.`]})]})]}),(0,f.jsxs)(`div`,{style:We(T===`app`),onClick:()=>{E(`app`),O(!0)},children:[Ge(T===`app`),(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`div`,{style:{fontSize:`0.85rem`,fontWeight:600,color:`var(--text-primary)`,display:`flex`,alignItems:`center`,gap:`0.35rem`},children:[(0,f.jsx)(Yc,{size:14}),` A Node.js app`]}),(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`,marginTop:2,lineHeight:1.45},children:`Express, Next.js, an API â anything that runs as a process. We keep it running and send traffic to it.`})]})]})]}),(0,f.jsx)(`div`,{style:He,children:j?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(X,{size:12,style:{animation:`spin 1s linear infinite`,verticalAlign:-2}}),` Looking at your repositoryâ¦`]}):k?.reason?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(vc,{size:12,style:{verticalAlign:-2}}),` Suggested â `,k.reason]}):null})]}),T===`site`&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{style:Ue,children:`4. How should it be published?`}),(0,f.jsxs)(`label`,{style:{display:`flex`,gap:`0.5rem`,alignItems:`flex-start`,cursor:`pointer`},children:[(0,f.jsx)(`input`,{type:`checkbox`,checked:L,onChange:e=>R(e.target.checked),style:{marginTop:3}}),(0,f.jsxs)(`span`,{children:[(0,f.jsx)(`span`,{style:{fontSize:`0.85rem`,color:`var(--text-primary)`,fontWeight:600},children:`Build this site first`}),(0,f.jsx)(`span`,{style:{...He,display:`block`,marginTop:2},children:`Some sites are written in source code that has to be built before it can be published. Weâll run the build on GitHub and upload only the finished files.`})]})]}),L&&(0,f.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:`0.75rem`,marginTop:`0.7rem`},children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{style:Ve,children:`Build command`}),(0,f.jsx)(`input`,{value:z,onChange:e=>B(e.target.value),placeholder:`npm run build`,style:Be})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{style:Ve,children:`Publish folder`}),(0,f.jsx)(`input`,{value:V,onChange:e=>H(e.target.value),placeholder:`dist`,style:Be}),(0,f.jsxs)(`div`,{style:He,children:[`Only whatâs inside `,(0,f.jsx)(`code`,{children:V||`dist`}),` is uploaded.`]})]})]})]}),T===`app`&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{style:Ue,children:`4. Where should the app answer?`}),(0,f.jsxs)(`div`,{style:{display:`grid`,gap:`0.6rem`},children:[(0,f.jsxs)(`div`,{style:We(U),onClick:()=>W(!0),children:[Ge(U),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{style:{fontSize:`0.85rem`,fontWeight:600,color:`var(--text-primary)`},children:`The whole domain`}),(0,f.jsxs)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`,marginTop:2},children:[(0,f.jsx)(`code`,{children:xe||`your domain`}),` â the app is the site.`]})]})]}),(0,f.jsxs)(`div`,{style:We(!U),onClick:()=>W(!1),children:[Ge(!U),(0,f.jsxs)(`div`,{style:{flex:1},children:[(0,f.jsx)(`div`,{style:{fontSize:`0.85rem`,fontWeight:600,color:`var(--text-primary)`},children:`A path under it`}),(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`,marginTop:2,marginBottom:U?0:`0.5rem`},children:`Runs beside an existing website â good for an API.`}),!U&&(0,f.jsxs)(`div`,{onClick:e=>e.stopPropagation(),children:[(0,f.jsx)(`input`,{value:G,onChange:e=>ee(e.target.value),placeholder:`app`,style:Be}),(0,f.jsxs)(`div`,{style:He,children:[`Requests to `,(0,f.jsxs)(`code`,{children:[xe||`your domain`,`/`,(G||`app`).replace(/^\/+/,``)]}),` go to the app.`]})]})]})]})]}),(0,f.jsxs)(`button`,{onClick:()=>ne(e=>!e),style:{background:`none`,border:`none`,color:`var(--text-muted)`,fontSize:`0.8125rem`,cursor:`pointer`,textAlign:`left`,padding:`0.6rem 0 0`},children:[te?`â¾`:`â¸`,` Advanced settings`]}),te&&(0,f.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:`0.75rem`,marginTop:`0.5rem`},children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{style:Ve,children:`Port`}),(0,f.jsx)(`input`,{value:re,onChange:e=>K(e.target.value),style:Be}),(0,f.jsx)(`div`,{style:He,children:`The port your app listens on. 1024â65535.`})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{style:Ve,children:`Node version`}),(0,f.jsxs)(`select`,{value:ie,onChange:e=>q(e.target.value),style:Be,children:[(0,f.jsx)(`option`,{value:`stable`,children:`Latest stable`}),(0,f.jsx)(`option`,{value:`22`,children:`22`}),(0,f.jsx)(`option`,{value:`20`,children:`20`}),(0,f.jsx)(`option`,{value:`18`,children:`18`})]})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{style:Ve,children:`Start command`}),(0,f.jsx)(`input`,{value:se,onChange:e=>ce(e.target.value),placeholder:`npm start`,style:Be})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{style:Ve,children:`Folder on the server`}),(0,f.jsx)(`input`,{value:ae,onChange:e=>oe(e.target.value),placeholder:U?`app`:G||`app`,style:Be}),(0,f.jsx)(`div`,{style:He,children:`Where your files land, inside your hosting account.`})]})]})]}),T&&Pe&&(0,f.jsxs)(`div`,{style:{border:`1px solid rgba(251,191,36,0.35)`,background:`rgba(251,191,36,0.08)`,borderRadius:10,padding:`0.85rem`},children:[(0,f.jsxs)(`div`,{style:{display:`flex`,gap:`0.5rem`,alignItems:`flex-start`,marginBottom:`0.5rem`},children:[(0,f.jsx)(Y,{size:15,style:{color:`#fbbf24`,flexShrink:0,marginTop:2}}),(0,f.jsx)(`div`,{style:{fontSize:`0.85rem`,fontWeight:700,color:`var(--text-primary)`},children:Me.occupied===`unknown`?`We couldnât check whatâs at ${xe} right now`:`${xe} is already serving something`})]}),Me.evidence?.length>0&&(0,f.jsx)(`ul`,{style:{margin:`0 0 0.5rem 1.6rem`,padding:0,fontSize:`0.8125rem`,color:`var(--text-muted)`,lineHeight:1.6},children:Me.evidence.map((e,t)=>(0,f.jsx)(`li`,{children:e},t))}),(0,f.jsxs)(`p`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`,margin:`0 0 0.6rem 1.6rem`,lineHeight:1.55},children:[T===`site`?(0,f.jsxs)(f.Fragment,{children:[`Every push replaces the contents of `,(0,f.jsx)(`code`,{children:Me.document_root||`public_html`}),` with this repository, and anything not in the repository is deleted.`]}):(0,f.jsxs)(f.Fragment,{children:[`The app will answer `,(0,f.jsx)(`code`,{children:xe}),` instead of whatever is published there now. Your files stay on the server, but the site stops being shown.`]}),Me.shared_with?.length>0&&(0,f.jsxs)(f.Fragment,{children:[` This also changes `,Me.shared_with.join(`, `),`.`]})]}),(0,f.jsxs)(`label`,{style:{display:`flex`,gap:`0.5rem`,alignItems:`flex-start`,cursor:`pointer`,marginLeft:`1.6rem`},children:[(0,f.jsx)(`input`,{type:`checkbox`,checked:Ne,onChange:e=>I(e.target.checked?xe:``),style:{marginTop:3}}),(0,f.jsxs)(`span`,{style:{fontSize:`0.8125rem`,color:`var(--text-primary)`},children:[`I understand this replaces what `,xe,` serves today.`]})]})]}),(0,f.jsx)(`div`,{children:(0,f.jsxs)(`button`,{className:`btn-primary`,onClick:Ie,disabled:!Je,children:[le===`connect`?(0,f.jsx)(X,{size:14,style:{animation:`spin 1s linear infinite`}}):(0,f.jsx)(Is,{size:14}),` Connect & Deploy`]})})]}),qe]})}var Yf=()=>requestAnimationFrame(()=>document.getElementById(`dns-records`)?.scrollIntoView({behavior:`smooth`,block:`start`}));function Xf({serviceId:e,primary:t,addon:n=[],alias:r=[],cap:i=Ed,canAdd:a=!0,cardStyle:o,sectionHead:s,onAdded:c,onEditDns:u}){let[d,p]=(0,l.useState)(!1),[m,h]=(0,l.useState)(``),[g,_]=(0,l.useState)(!1),[v,y]=(0,l.useState)(null),[b,x]=(0,l.useState)(null),[S,C]=(0,l.useState)(null),w=new Set,T=[...t?[[t,`Primary`,`#34d399`]]:[],...(n||[]).map(e=>[e,`Addon`,`#6b7280`]),...(r||[]).map(e=>[e,`Alias`,`#3b82f6`])].filter(([e])=>{let t=String(e||``).toLowerCase().replace(/\.$/,``);return!t||w.has(t)?!1:(w.add(t),!0)}),E=T.length>=i,D=T.map(([e])=>e).join(`,`);(0,l.useEffect)(()=>
111{if(!D){C(null);return}let t=!0;return Z(`/api/portal/services/${e}/dns/delegation?all=1`).then(e=>{t&&e?.ok&&C(e.delegations||{})}).catch(()=>{}),()=>{t=!1}},[e,D]);let O=e=>{if(!S)return{icon:X,color:`var(--text-faint)`,label:`Checkingâ¦`,spin:!0,title:``};let t=S[String(e).toLowerCase()];return!t||!t.known?{icon:Ls,color:`var(--text-faint)`,label:`No answer`,title:`${e} doesn't resolve â it may be new, expired or not registered.`}:t.ours?{icon:Is,color:`#34d399`,label:`Using our DNS`,title:`Nameservers: ${(t.nameservers||[]).join(`, `)}`}:{icon:Y,color:`#fbbf24`,label:t.provider?`At ${t.provider}`:`Elsewhere`,title:`Nameservers: ${(t.nameservers||[]).join(`, `)} â records edited here won't take effect.`}},k=async()=>{let t=m.trim();if(!t){y(`Enter a domain name.`);return}_(!0),y(null);try{let n=await Z(`/api/portal/services/${e}/dns/domains`,{method:`POST`,body:JSON.stringify({domain:t})});n?.ok?(p(!1),h(``),x(`${n.domain} added â its DNS zone is ready to edit below.`),setTimeout(()=>x(null),6e3),c?.({domain:n.domain,addon_domains:n.addon_domains,alias_domains:n.alias_domains})):y(n?.error||`Could not add that domain.`)}catch{y(`Could not add that domain.`)}finally{_(!1)}},A={background:`var(--bg-elevated)`,border:`1px solid var(--border)`,borderRadius:8,padding:`0.45rem 0.6rem`,fontSize:`0.8125rem`,color:`var(--text-primary)`,width:`100%`};return(0,f.jsxs)(`div`,{style:o,children:[(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:`0.5rem`,flexWrap:`wrap`},children:[(0,f.jsx)(`p`,{style:{...s,marginBottom:0},children:`Linked Domains`}),(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`0.6rem`,flexWrap:`wrap`},children:[T.length>0&&(0,f.jsxs)(`span`,{style:{fontSize:`0.78rem`,color:`var(--text-faint)`},children:[T.length,` of `,i,` domain`,i===1?``:`s`]}),a&&!d&&!E&&(0,f.jsxs)(`button`,{className:`btn-secondary`,onClick:()=>{y(null),p(!0)},children:[(0,f.jsx)(Vc,{size:14}),` Add domain`]})]})]}),a&&E&&(0,f.jsx)(`p`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`,margin:`0.75rem 0 0`},children:T.length>i?`This service holds ${T.length} domains, above the ${i}-domain limit, so no more can be added. Contact support if you need to.`:`This service holds the maximum of ${i} domains. Contact support if you need more.`}),b&&(0,f.jsxs)(`div`,{className:`alert-success`,style:{margin:`0.75rem 0 0`},children:[(0,f.jsx)($s,{size:14}),b]}),d&&(0,f.jsxs)(`div`,{style:{background:`var(--bg-elevated)`,border:`1px solid var(--border)`,borderRadius:10,padding:`0.85rem`,display:`grid`,gap:`0.55rem`,margin:`0.85rem 0 0`},children:[(0,f.jsx)(`input`,{style:A,autoFocus:!0,placeholder:`example.com.au`,value:m,spellCheck:!1,autoCapitalize:`none`,onChange:e=>h(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!g&&k()}}),(0,f.jsx)(`p`,{style:{fontSize:`0.78rem`,color:`var(--text-faint)`,margin:0},children:`Weâll create the DNS zone for this domain. Point the domainâs nameservers at us at its registrar for the zone to take effect.`}),v&&(0,f.jsx)(`p`,{style:{fontSize:`0.8rem`,color:`#f87171`,margin:0},children:v}),(0,f.jsxs)(`div`,{style:{display:`flex`,gap:`0.5rem`},children:[(0,f.jsxs)(`button`,{className:`btn-primary`,disabled:g,onClick:k,children:[g?(0,f.jsx)(X,{size:14,style:{animation:`spin 1s linear infinite`}}):(0,f.jsx)($s,{size:14}),` Add domain`]}),(0,f.jsx)(`button`,{className:`btn-secondary`,disabled:g,onClick:()=>{p(!1),h(``),y(null)},children:`Cancel`})]})]}),T.length>0?(0,f.jsx)(`div`,{style:{marginTop:`0.85rem`},children:T.map(([e,t,n])=>{let r=O(e),i=r.icon;return(0,f.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`minmax(0,1fr) auto`,gap:`0.4rem 0.75rem`,alignItems:`center`,padding:`0.5rem 0`,borderBottom:`1px solid var(--border)`},children:[(0,f.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:`0.5rem`,minWidth:0},children:[(0,f.jsx)(`span`,{style:{fontSize:`0.8125rem`,fontWeight:600,padding:`0.15rem 0.4rem`,borderRadius:4,background:`${n}20`,color:n,border:`1px solid ${n}40`,flexShrink:0},children:t}),(0,f.jsx)(`span`,{style:{fontSize:`0.875rem`,color:`var(--text-primary)`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e})]}),(0,f.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:`0.75rem`,justifyContent:`flex-end`},children:[(0,f.jsxs)(`span`,{title:r.title,style:{display:`flex`,alignItems:`center`,gap:`0.3rem`,color:r.color,fontSize:`0.78rem`,fontWeight:600,minWidth:112,cursor:r.title?`help`:`default`},children:[(0,f.jsx)(i,{size:14,style:r.spin?{animation:`spin 1s linear infinite`,flexShrink:0}:{flexShrink:0}}),(0,f.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:r.label})]}),u&&(0,f.jsxs)(`button`,{onClick:()=>u(e),style:{background:`none`,border:`none`,cursor:`pointer`,padding:`0.15rem 0`,color:`var(--accent)`,fontSize:`0.8125rem`,fontWeight:600,display:`flex`,alignItems:`center`,gap:`0.3rem`,flexShrink:0},children:[(0,f.jsx)(Rc,{size:13}),` Edit DNS`]})]})]},e)})}):!d&&(0,f.jsx)(`p`,{style:{fontSize:`0.85rem`,color:`var(--text-muted)`,marginTop:`0.85rem`},children:`No domains on this service yet. Add one to host its DNS here.`})]})}function Zf({delegation:e,domain:t,ourNameservers:n=[]}){if(!e?.known||e.ours!==!1)return null;let r=e.nameservers||[];return(0,f.jsxs)(`div`,{style:{display:`flex`,gap:`0.55rem`,alignItems:`flex-start`,padding:`0.7rem 0.85rem`,margin:`0.2rem 0 0.85rem`,borderRadius:10,background:`#fbbf2412`,border:`1px solid #fbbf2433`},children:[(0,f.jsx)(Y,{size:15,style:{color:`#fbbf24`,flexShrink:0,marginTop:2}}),(0,f.jsxs)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`,lineHeight:1.5},children:[(0,f.jsx)(`strong`,{style:{color:`var(--text-primary)`},children:`Weâre not managing DNS for this domain`}),(0,f.jsxs)(`p`,{style:{margin:`0.3rem 0 0`},children:[t?(0,f.jsx)(`strong`,{style:{color:`var(--text-primary)`},children:t}):`This domain`,` currently uses`,e.provider?(0,f.jsxs)(f.Fragment,{children:[` nameservers at `,(0,f.jsx)(`strong`,{style:{color:`var(--text-primary)`},children:e.provider})]}):` external nameservers`,`, so DNS is answered there â not by us. Changes made here have no effect until the domainâs nameservers are pointed back to us at your domain registrar.`]}),r.length>0&&(0,f.jsxs)(`p`,{style:{margin:`0.4rem 0 0`,fontFamily:`monospace`,fontSize:`0.78rem`,color:`var(--text-faint)`},children:[`Current: `,r.join(`, `)]}),n.length>0&&(0,f.jsxs)(`p`,{style:{margin:`0.4rem 0 0`},children:[`Point it at: `,n.map((e,t)=>(0,f.jsxs)(`span`,{children:[(0,f.jsx)(`span`,{style:{fontFamily:`monospace`,color:`var(--text-primary)`},children:e}),t<n.length-1?`, `:``]},e))]})]})]})}
111function Qf({serviceId:e,zone:t=null,onZoneChange:n}){let[r,i]=(0,l.useState)(null),[a,o]=(0,l.useState)(null),[s,c]=(0,l.useState)(!0),[u,d]=(0,l.useState)(null),[p,m]=(0,l.useState)(!1),[h,g]=(0,l.useState)(null),[_,v]=(0,l.useState)({type:`A`,name:``,value:``,ttl:14400,preference:10}),[y,b]=(0,l.useState)(null),x=t=>{c(!0),d(null),Z(`/api/portal/services/${e}/dns${t?`?zone=${encodeURIComponent(t)}`:``}`).then(e=>{e?.ok?i(e):d(e?.error||`Failed to load DNS records`)}).catch(()=>d(`Failed to load DNS records`)).finally(()=>c(!1))};(0,l.useEffect)(()=>{x(t||void 0)},[e,t]),(0,l.useEffect)(()=>{let t=r?.zone;if(!t){o(null);return}let n=!0;return o(null),Z(`/api/portal/services/${e}/dns/delegation?zone=${encodeURIComponent(t)}`).then(e=>{n&&e?.ok&&o(e.delegation)}).catch(()=>{}),()=>{n=!1}},[e,r?.zone]);let S={background:`var(--bg-surface)`,border:`1px solid var(--border)`,borderRadius:12,padding:`1.25rem`,marginBottom:`1rem`},C={fontSize:`0.8125rem`,fontWeight:600,textTransform:`uppercase`,letterSpacing:`0.08em`,color:`var(--text-faint)`},w={background:`var(--bg-elevated)`,border:`1px solid var(--border)`,borderRadius:8,padding:`0.45rem 0.6rem`,fontSize:`0.8125rem`,color:`var(--text-primary)`,width:`100%`},T=[`A`,`AAAA`,`CNAME`,`MX`,`TXT`],E={A:`e.g. 203.0.113.10`,AAAA:`e.g. 2400:cb00::1`,CNAME:`e.g. target.example.com`,MX:`e.g. mail.example.com`,TXT:`e.g. v=spf1 include:_spf.google.com ~all`},D=()=>{d(null),v({type:`A`,name:``,value:``,ttl:14400,preference:10}),g(`new`)},O=e=>{d(null),v({type:e.type,name:e.name===`@`?``:e.name,value:e.value,ttl:e.ttl,preference:e.preference??10}),g(e.line)},k=()=>{g(null),d(null)},A=e=>{b(e),setTimeout(()=>b(null),2500)},j=async()=>{m(!0),d(null);let t=h===`new`,n={zone:r.zone,type:_.type,name:_.name,value:_.value,ttl:_.ttl,preference:_.preference};t||(n.line=h);try{let r=await Z(`/api/portal/services/${e}/dns`,{method:t?`POST`:`PUT`,body:JSON.stringify(n)});r?.ok?(i(r),g(null),A(t?`Record added`:`Record updated`)):d(r?.error||`Could not save the record.`)}catch{d(`Could not save the record.`)}finally{m(!1)}},M=async t=>{if(window.confirm(`Delete this DNS record? This changes your live DNS immediately.`)){m(!0),d(null);try{let n=await Z(`/api/portal/services/${e}/dns`,{method:`DELETE`,body:JSON.stringify({zone:r.zone,line:t})});n?.ok?(i(n),A(`Record deleted`)):d(n?.error||`Could not delete the record.`)}catch{d(`Could not delete the record.`)}finally{m(!1)}}},N=(0,f.jsxs)(`div`,{style:{background:`var(--bg-elevated)`,border:`1px solid var(--border)`,borderRadius:10,padding:`0.85rem`,display:`grid`,gap:`0.55rem`},children:[(0,f.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:_.type===`MX`?`96px 1fr 84px`:`96px 1fr`,gap:`0.5rem`},children:[(0,f.jsx)(`select`,{style:w,value:_.type,onChange:e=>v(t=>({...t,type:e.target.value})),children:T.map(e=>(0,f.jsx)(`option`,{value:e,children:e},e))}),(0,f.jsx)(`input`,{style:w,placeholder:`Name (@ for root, or e.g. www)`,value:_.name,onChange:e=>v(t=>({...t,name:e.target.value}))}),_.type===`MX`&&(0,f.jsx)(`input`,{style:w,type:`number`,placeholder:`Priority`,value:_.preference,onChange:e=>v(t=>({...t,preference:e.target.value}))})]}),(0,f.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 96px`,gap:`0.5rem`},children:[(0,f.jsx)(`input`,{style:w,placeholder:E[_.type]||`Value`,value:_.value,onChange:e=>v(t=>({...t,value:e.target.value}))}),(0,f.jsx)(`input`,{style:w,type:`number`,placeholder:`TTL`,value:_.ttl,onChange:e=>v(t=>({...t,ttl:e.target.value}))})]}),u&&(0,f.jsx)(`p`,{style:{fontSize:`0.8rem`,color:`#f87171`,margin:0},children:u}),(0,f.jsxs)(`div`,{style:{display:`flex`,gap:`0.5rem`},children:[(0,f.jsxs)(`button`,{className:`btn-primary`,disabled:p,onClick:j,children:[p?(0,f.jsx)(X,{size:14,style:{animation:`spin 1s linear infinite`}}):(0,f.jsx)($s,{size:14}),` Save`]}),(0,f.jsx)(`button`,{className:`btn-secondary`,disabled:p,onClick:k,children:`Cancel`})]})]});if(s)return(0,f.jsxs)(`div`,{id:`dns-records`,style:S,children:[(0,f.jsx)(`p`,{style:C,children:`DNS Records`}),(0,f.jsx)(`p`,{style:{fontSize:`0.85rem`,color:`var(--text-faint)`,marginTop:`0.6rem`},children:`Loading DNS recordsâ¦`})]});if(!r)return(0,f.jsxs)(`div`,{id:`dns-records`,style:S,children:[(0,f.jsx)(`p`,{style:C,children:`DNS Records`}),(0,f.jsx)(`p`,{style:{fontSize:`0.85rem`,color:`#f87171`,marginTop:`0.6rem`},children:u||`DNS records are unavailable for this service.`})]});let P=`1.3fr 68px 2fr 66px 72px`;return(0,f.jsxs)(`div`,{id:`dns-records`,style:S,children:[(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:`0.5rem`,marginBottom:`0.85rem`,flexWrap:`wrap`},children:[(0,f.jsx)(`p`,{style:{...C,marginBottom:0},children:`DNS Records`}),(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`0.5rem`,flexWrap:`wrap`},children:[r.zones?.length>1&&(0,f.jsx)(`select`,{style:{...w,width:`auto`},value:r.zone,onChange:e=>{g(null),n?n(e.target.value):x(e.target.value)},children:r.zones.map(e=>(0,f.jsx)(`option`,{value:e,children:e},e))}),h===null&&(0,f.jsxs)(`button`,{className:`btn-secondary`,onClick:D,children:[(0,f.jsx)(Vc,{size:14}),` Add record`]}
111)]})]}),(0,f.jsx)(Zf,{delegation:a,domain:r.zone,ourNameservers:r.nameservers||[]}),r.nameservers?.length>0&&!(a?.known&&a.ours===!1)&&(0,f.jsxs)(`p`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`,marginBottom:`0.85rem`},children:[`Authoritative nameservers: `,r.nameservers.map((e,t)=>(0,f.jsxs)(`span`,{style:{fontFamily:`monospace`,color:`var(--text-primary)`},children:[e,t<r.nameservers.length-1?`, `:``]},e))]}),y&&(0,f.jsxs)(`div`,{className:`alert-success`,style:{marginBottom:`0.75rem`},children:[(0,f.jsx)($s,{size:14}),y]}),u&&h===null&&(0,f.jsxs)(`div`,{className:`alert-error`,style:{marginBottom:`0.75rem`},children:[(0,f.jsx)(Y,{size:14}),u]}),h===`new`&&(0,f.jsx)(`div`,{style:{marginBottom:`0.85rem`},children:N}),r.records.length===0&&h!==`new`?(0,f.jsx)(`p`,{style:{fontSize:`0.85rem`,color:`var(--text-muted)`},children:`No editable records in this zone yet. Use âAdd recordâ to create one.`}):(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:P,gap:`0.5rem`,padding:`0 0 0.4rem`,fontSize:`0.72rem`,color:`var(--text-faint)`,textTransform:`uppercase`,letterSpacing:`0.05em`,borderBottom:`1px solid var(--border)`}
111,children:[(0,f.jsx)(`span`,{children:`Name`}),(0,f.jsx)(`span`,{children:`Type`}),(0,f.jsx)(`span`,{children:`Value`}),(0,f.jsx)(`span`,{children:`TTL`}),(0,f.jsx)(`span`,{})]}),r.records.map(e=>h===e.line?(0,f.jsx)(`div`,{style:{padding:`0.6rem 0`},children:N},e.line):(0,f.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:P,gap:`0.5rem`,alignItems:`center`,padding:`0.5rem 0`,borderBottom:`1px solid var(--border)`,fontSize:`0.8125rem`},children:[(0,f.jsx)(`span`,{style:{color:`var(--text-primary)`,fontWeight:600,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},title:e.name,children:e.name}),(0,f.jsx)(`span`,{children:(0,f.jsx)(`span`,{style:{fontSize:`0.72rem`,fontWeight:700,padding:`0.1rem 0.35rem`,borderRadius:4,background:`var(--bg-active)`,color:`var(--accent)`},children:e.type})}),(0,f.jsx)(`span`,{style:{color:`var(--text-muted)`,fontFamily:`monospace`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},title:e.type===`MX`?`${e.preference} ${e.value}`:e.value,children:e.type===`MX`?`${e.preference} ${e.value}`:e.value}),(0,f.jsx)(`span`,{style:{color:`var(--text-muted)`},children:e.ttl}),(0,f.jsxs)(`span`,{style:{display:`flex`,gap:`0.15rem`,justifyContent:`flex-end`},children:[(0,f.jsx)(`button`,{onClick:()=>O(e),title:`Edit`,disabled:p,style:{background:`none`,border:`none`,cursor:`pointer`,color:`var(--text-muted)`,padding:4},children:(0,f.jsx)(Rc,{size:14})}),(0,f.jsx)(`button`,{onClick:()=>M(e.line),title:`Delete`,disabled:p,style:{background:`none`,border:`none`,cursor:`pointer`,color:`#f87171`,padding:4},children:(0,f.jsx)(rl,{size:14})})]})]},e.line))]}),(0,f.jsx)(`p`,{style:{fontSize:`0.78rem`,color:`var(--text-faint)`,marginTop:`0.85rem`},children:`Changes apply to your live DNS zone immediately. Allow a few minutes for propagation.`})]})}function $f({migration:e}){if(!e||!e.to_product)return null;let t=(e.gain||``).trim(),n=(e.lose||``).trim();return(0,f.jsxs)(`div`,{style:{background:`color-mix(in srgb, var(--accent) 8%, transparent)`,border:`1px solid var(--accent)`,borderRadius:12,padding:`1rem 1.25rem`,marginBottom:`1rem`},children:[(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`0.5rem`,marginBottom:t||n?`0.6rem`:0},children:[(0,f.jsx)(Gc,{size:15,style:{color:`var(--accent)`,flexShrink:0}}),(0,f.jsxs)(`span`,{style:{fontSize:`0.875rem`,fontWeight:600,color:`var(--accent)`},children:[`This service is moving to `,e.to_product]})]}),(t||n)&&(0,f.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`0.4rem`},children:[t&&(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:`0.4rem`,fontSize:`0.8125rem`,color:`#4ade80`},children:[(0,f.jsx)(Vc,{size:13,style:{marginTop:2,flexShrink:0}}),(0,f.jsx)(`span`,{style:{whiteSpace:`pre-wrap`,color:`var(--text-primary)`},children:t})]}),n&&(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:`0.4rem`,fontSize:`0.8125rem`,color:`#f87171`},children:[(0,f.jsx)(Nc,{size:13,style:{marginTop:2,flexShrink:0}}),(0,f.jsx)(`span`,{style:{whiteSpace:`pre-wrap`,color:`var(--text-primary)`},children:n})]})]})]})}function ep({notice:e}){if(!e?.body?.trim())return null;let t=e.body.split(/\n\s*\n/).map(e=>e.trim()).filter(Boolean);return(0,f.jsxs)(`div`,{style:{background:`color-mix(in srgb, #f97316 8%, transparent)`,border:`1px solid color-mix(in srgb, #f97316 40%, transparent)`,borderLeft:`3px solid #f97316`,borderRadius:12,padding:`1rem 1.25rem`,marginBottom:`1rem`},children:[(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`0.5rem`,marginBottom:e.title?`0.5rem`:0},children:[(0,f.jsx)(kc,{size:15,style:{color:`#f97316`,flexShrink:0}}),e.title&&(0,f.jsx)(`span`,{style:{fontSize:`0.875rem`,fontWeight:600,color:`var(--text-primary)`},children:e.title})]}),t.map((e,n)=>(0,f.jsx)(`p`,{style:{margin:n===t.length-1?0:`0 0 0.55rem`,fontSize:`0.8125rem`,lineHeight:1.55,color:`var(--text-muted)`,whiteSpace:`pre-wrap`},children:e},n))]})}function tp({change:e}){if(!e?.to_name)return null;let t=e=>e?new Date(`${String(e).slice(0,10)}T00:00:00`).toLocaleDateString(`en-AU`,{day:`numeric`,month:`long`,year:`numeric`}):null,n=t(e.effective_date),r=t(e.invoice_expected),i=ip(e.billingcycle),a=e=>e==null?null:`${$(e)}${i}`,o=a(e.new_amount),s=a(e.old_amount),c=e.status===`awaiting_payment`&&e.invoice_status===`Paid`,l=c?`Plan change applying now`:e.status===`pen
111ding_staff`?`Plan change in progress`:e.status===`awaiting_payment`?`Plan change waiting on payment`:e.kind===`downgrade`?`Downgrade scheduled`:e.kind===`upgrade`?`Upgrade scheduled`:`Plan change scheduled`,u=c?(0,f.jsxs)(f.Fragment,{children:[`Your payment has come through, so weâre moving you to `,(0,f.jsx)(`strong`,{children:e.to_name}),` now. It can take a few minutes to show here.`]}):e.status===`pending_staff`?(0,f.jsxs)(f.Fragment,{children:[`Youâve asked to move to `,(0,f.jsx)(`strong`,{children:e.to_name}),`. Because this one involves moving your site, our team coordinates it with you rather than switching it over automatically â weâll be in touch.`]}):e.status===`awaiting_payment`?(0,f.jsxs)(f.Fragment,{children:[`Your plan changes to `,(0,f.jsx)(`strong`,{children:e.to_name}),` as soon as `,e.invoice_id?(0,f.jsxs)(f.Fragment,{children:[`invoice `,(0,f.jsxs)(`strong`,{children:[`#`,e.invoice_id]})]}):`your current invoice`,` is paid. Nothing changes on your service until then.`]}):(0,f.jsxs)(f.Fragment,{children:[`Your plan changes from `,(0,f.jsx)(`strong`,{children:e.from_name||`your current plan`}),` to `,(0,f.jsx)(`strong`,{children:e.to_name}),n?(0,f.jsxs)(f.Fragment,{children:[` on `,(0,f.jsx)(`strong`,{children:n}),`, your next renewal date`]}):` at your next renewal`,`. Nothing changes before then â your site and settings stay exactly as they are.`]}),d=[];return o&&d.push({k:e.status===`scheduled`?`New price from then`:`New price`,v:(0,f.jsxs)(f.Fragment,{children:[o,s&&s!==o&&(0,f.jsxs)(`span`,{style:{color:`var(--text-faint)`},children:[` (was `,s,`)`]})]})}),!c&&e.status===`scheduled`&&n&&d.push({k:`Change applies`,v:n}),!c&&e.status!==`pending_staff`&&r&&d.push(e.invoice_id?{k:`Invoice #${e.invoice_id}`,v:(0,f.jsxs)(f.Fragment,{children:[`due `,r,e.invoice_total==null?``:` · ${$(e.invoice_total)}`]})}:{k:`Renewal invoice`,v:(0,f.jsxs)(f.Fragment,{children:[`expected around `,r]})}),e.status===`pending_staff`&&e.invoice_id&&d.push({k:`Invoice #${e.invoice_id}`,v:(0,f.jsxs)(f.Fragment,{children:[e.invoice_status||`Unpaid`,e.invoice_total==null?``:` · ${$(e.invoice_total)}`]})}),(0,f.jsxs)(`div`,{style:{background:`color-mix(in srgb, var(--accent) 8%, transparent)`,border:`1px solid color-mix(in srgb, var(--accent) 40%, transparent)`,borderLeft:`3px solid var(--accent)`,borderRadius:12,padding:`1rem 1.25rem`,marginBottom:`1rem`},children:[(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`0.5rem`,marginBottom:`0.5rem`},children:[(0,f.jsx)(ac,{size:15,style:{color:`var(--accent)`,flexShrink:0}}),(0,f.jsx)(`span`,{style:{fontSize:`0.875rem`,fontWeight:600,color:`var(--text-primary)`},children:l})]}),(0,f.jsx)(`p`,{style:{margin:0,fontSize:`0.8125rem`,lineHeight:1.55,color:`var(--text-muted)`},children:u}),d.length>0&&(0,f.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:`0.35rem 1.75rem`,marginTop:`0.75rem`},children:d.map(e=>(0,f.jsxs)(`div`,{style:{fontSize:`0.8125rem`},children:[(0,f.jsxs)(`span`,{style:{color:`var(--text-faint)`},children:[e.k,`: `]}),(0,f.jsx)(`span`,{style:{color:`var(--text-primary)`,fontWeight:600},children:e.v})]},e.k))})]})}var np={monthly:1,quarterly:3,"semi-annually":6,"semi annually":6,annually:12,yearly:12,biennially:24,triennially:36},rp=e=>np[String(e||``).trim().toLowerCase()]||1,ip=e=>{let t=String(e||``).toLowerCase();return t.startsWith(`month`)?` /mo`:t.startsWith(`annual`)||t.startsWith(`year`)?` /yr`:t.startsWith(`quarter`)?` /qtr`:t.startsWith(`semi`)?` /6mo`:e?` ${e}`:``};function ap(e,t){let n=Number(e?.recurringamount??e?.amount??0)||0,r=Array.isArray(t)?t:[],i=r.filter(e=>String(e.status||`Active`).toLowerCase()===`active`),a=e?.billingcycle||`Monthly`,o=i.some(e=>rp(e.billingcycle||a)!==rp(a)),s=i.reduce((e,t)=>e+(Number(t.amount)||0),0),c=i.reduce((e,t)=>e+(Number(t.amount)||0)/rp(t.billingcycle||a),0);return{base:n,addons:r,total:o?Math.round((n/rp(a)+c)*100)/100:Math.round((n+s)*100)/100,perMonth:o,cycleSuffix:ip(a),totalSuffix:o?` /mo`:ip(a),suffixFor:e=>ip(e||a),inactiveCount:r.length-i.length}}function op({serviceId:e,service:t,onBack:n,setTab:r,caps:i={}}){let a=i.pricing!==!1,[o,s]=(0,l.useState)(`overview`),[c,u]=(0,l.useState)(null),[d,p]=(0,l.useState)(!0),[m,h]=(0,l.useState)(t),[g,_]=(0,l.useState)(!1),[v,y]=(0,l.useState)(!1),[b,x]=(0,l.useState)(!1),[S,C]=(0,l.useState)(null),[w,T]=(0,l.useState)(!1),[E,D]=(0,l.useState)(``),[O,k]=(0,l.useState)(!1),[A,j]=(0,l.useState)(!1),[M,N]=(0,l.useState)(null),[P,F]=(0,l.useState)(null),[I,L]=(0,l.useState)(null),R=async t=>{F(t),L(null);try{let n=await Z(`/api/portal/services/${e}/vm/${t}`,{method:`POST`});L(n.ok?`${t.charAt(0).toUpperCase()+t.slice(1)} initiated`:n.error||`Failed`),n.ok&&setTimeout(()=>{Z(`/api/portal/services/${e}/detail`).then(e=>u(e)).catch(()=>{})},3e3)}catch{L(`Request failed`)}F(null),setTimeout(()=>L(null),4e3)},z=async()=>{k(!0),N(null);try{let t=await Z(`/api/portal/services/${e}/disable-autorenew`,{method:`POST`,body:JSON.stringify({reason:E})});t.ok?(h(e=>({...e,auto_renew:!1})),j(!0)):N(t.error||`Something went wrong. Please try again.`)}catch{N(`Something went wrong. Please try again.`)}finally{k(!1)}},B=async()=>{k(!0),N(null);try{let t=await Z(`/api/portal/services/${e}/enable-autorenew`,{method:`POST`});t.ok?h(e=>({...e,auto_renew:!0})):N(t.error||`Something went wrong. Please try again.`)}catch{N(`Something went wrong. Please try again.`)}finally{k(!1)}};(0,l.useEffect)(()=>{Z(`/api/portal/services/${e}/detail`).then(e=>u(e)).catch(()=>u({ok:!1,error:`Failed to load`})).finally(()=>p(!1))},[e]);let V={background:`var(--bg-surface)`,border:`1px solid var(--border)`,borderRadius:12,padding:`1.25rem`,marginBottom:`1rem`},H={fontSize:`0.8125rem`,fontWeight:600,textTransform:`uppercase`,letterSpacing:`0.08em`,color:`var(--text-faint)`,marginBottom:`0.75rem`},U=ap(m,c?.addons),W=[`proxmox`,`clouddedicated`].includes(c?.type)&&!!c?.legacy_product;return(0,f.jsxs)(`div`,{style:{maxWidth:896,margin:`0 auto`,padding:`1.5rem`},children:[(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`0.75rem`,marginBottom:`1.5rem`},children:[(0,f.jsx)(`button`,{onClick:n,style:{background:`none`,border:`none`,cursor:`pointer`,color:`var(--accent)`,fontSize:`0.9rem`,padding:0},children:`â Back`}),(0,f.jsxs)(`div`,{style:{flex:1},children:[(0,f.jsx)(`h1`,{style:{fontSize:`1.25rem`,fontWeight:700,color:`var(--text-primary)`,margin:0},children:m.name}),m.domain&&(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`,marginTop:2},children:m.domain})]}),(0,f.jsx)(kd,{status:m.status})]}),(0,f.jsx)($f,{migration:m.migration}),(0,f.jsx)(ep,{notice:c?.notice}),(0,f.jsx)(tp,{change:c?.plan_change}),d?(0,f.jsx)(`div`,{style:{...V,color:`var(--text-faint)`,fontSize:`0.85rem`},children:`Loading live statusâ¦`}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(qf,{s:m,data:c,cardStyle:V,serviceId:e,canSso:i.ssoReal!==!1}),(0,f.jsx)(zf,{stats:c?.stats,cardStyle:V,sectionHead:H})]}),g&&(0,f.jsx)(Ff,{serviceId:e,current:m,onClose:()=>_(!1),onChanged:({name:e,amount:t,product_id:n})=>h(r=>({...r,name:e,amount:t,product_id:n})),onRequested:()=>{Z(`/api/portal/services/${e}/detail`).then(e=>u(e)).catch(()=>{})}}),v&&(0,f.jsx)(Lf,{serviceId:e,current:m,onClose:()=>y(!1),onChanged:({billingcycle:e,amount:t})=>h(n=>({...n,billingcycle:e,amount:t}))}),Mf(m)&&(0,f.jsx)(Pf,{serviceId:e,cardStyle:V,sectionHead:H}),m.status===`Pending`&&(0,f.jsx)(Sf,{}),m.status===`Suspended`&&(0,f.jsx)(Cf,{serviceId:e,setTab:r}),(m.status===`Cancelled`||m.status===`Terminated`)&&(0,f.jsx)(wf,{serviceId:e,service:m,setTab:r}),d?(0,f.jsx)(`div`,{style:{textAlign:`center`,padding:`2rem`,color:`var(--text-muted)`},children:`Loading service detailsâ¦`}):c?.ok?(()=>{let t=_f(c);if(c.type===`cpanel`)return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(gf,{warnings:t}),(0,f.jsxs)(`div`,{style:V,children:[(0,f.jsx)(`p`,{style:H,children:`Account`}),(0,f.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:`0.5rem`,marginBottom:`1.25rem`},children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-faint)`},children:`Username`}),(0,f.jsx)(`div`,{style:{fontSize:`0.875rem`,color:`var(--text-primary)`,marginTop:2},children:c.username||`â`}),c.username&&Td(m)&&e!=null&&(0,f.jsxs)(`button`,{onClick:()=>x(!0),style:{background:`none`,border:`none`,padding:0,marginTop:4,cursor:`pointer`,font:`inherit`,fontSize:`0.75rem`,color:`var(--accent)`,textDecoration:`underline`,display:`inline-flex`,alignItems:`center`,gap:`0.25rem`},children:[(0,f.jsx)(yc,{size:11}),` Reset password`]})]}),[[`Plan`,c.plan||`â`],[`Server`,c.server],[`IP Address`,c.ip||`â`]].map(([e,t])=>(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-faint)`},children:e}),(0,f.jsx)(`div`,{style:{fontSize:`0.875rem`,color:`var(--text-primary)`,marginTop:2},children:t||`â`})]},e))]})]}),b&&(0,f.jsx)(kf,{serviceId:e,username:c.username,onClose:()=>x(!1)}),c.layout?.resources!==!1&&(0,f.jsxs)(`div`,{style:V,children:[(0,f.jsx)(`p`,{style:H,children:`Resources`}),(0,f.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr 1fr`,gap:`0.5rem`},children:[(0,f.jsx)(bf,{label:`Email Accounts`,used:c.email_count,max:c.max_emails>0?c.max_emails:0,color:`#8b5cf6`}),(0,f.jsx)(bf,{label:`MySQL Databases`,used:c.db_count,max:c.max_dbs>0?c.max_dbs:0,color:`#3b82f6`}),(0,f.jsx)(bf,{label:`FTP Accounts`,used:c.ftp_count,max:0,color:`#f97316`})]}),(0,f.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:`0.5rem`,marginTop:`0.5rem`},children:[(0,f.jsx)(bf,{label:`Addon Domains`,used:c.addon_domains?.length||0,max:c.max_addons>0?c.max_addons:0,color:`#10b981`}),(0,f.jsx)(bf,{label:`Subdomains`,used:c.subdomains?.length||0,max:c.max_subdomains>0?c.max_subdomains:0,color:`#10b981`})]}),(0,f.jsx)(xf,{accounts:c.email_accounts})]}),c.layout?.domains!==!1&&(0,f.jsxs)(`div`,{style:V,children:[(0,f.jsx)(`p`,{style:H,children:`Domains`}),[[c.main_domain,`Primary`,`#f97316`],...(c.addon_domains||[]).map(e=>[e,`Addon`,`#6b7280`]),...(c.alias_domains||[]).map(e=>[e,`Alias`,`#3b82f6`]),...(c.subdomains||[]).map(e=>[e,`Sub`,`#6b7280`])].filter(([e])=>e).map(([e,t,n])=>(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`0.5rem`,padding:`0.4rem 0`,borderBottom:`1px solid var(--border)`},children:[(0,f.jsx)(`span`,{style:{fontSize:`0.8125rem`,fontWeight:600,padding:`0.15rem 0.4rem`,borderRadius:4,background:`${n}20`,color:n,border:`1px solid ${n}40`,flexShrink:0},children:t}),(0,f.jsx)(`span`,{style:{fontSize:`0.875rem`,color:`var(--text-primary)`},children:e})]},e)),!c.main_domain&&(0,f.jsx)(`p`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`},children:`No domain data available`})]}
111),c.ssl_certs?.length>0&&(0,f.jsxs)(`div`,{style:V,children:[(0,f.jsx)(`p`,{style:H,children:`SSL Certificates`}),c.ssl_certs.slice(0,10).map((e,t)=>{let n=e.expires?Math.floor((e.expires*1e3-Date.now())/864e5):null,r=n===null?`var(--text-faint)`:n<7?`#f87171`:n<30?`#fbbf24`:`#34d399`;return(0,f.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,padding:`0.5rem 0`,borderBottom:`1px solid var(--border)`},children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{style:{fontSize:`0.875rem`,color:`var(--text-primary)`},children:e.domain}),(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-faint)`},children:e.issuer})]}),n!==null&&(0,f.jsx)(`span`,{style:{fontSize:`0.8125rem`,fontWeight:600,color:r,whiteSpace:`nowrap`},children:n<0?`Expired`:n===0?`Expires today`:`${n}d left`})]},t)})]})]});if(c.type===`proxmox`){if(c.error||!c.vm_status)return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(Kf,{data:c,cardStyle:V,sectionHead:H}),!c.stats&&(0,f.jsx)(`div`,{style:{...V,color:`var(--text-muted)`,fontSize:`0.875rem`},children:`Live server statistics are not available for this service.`})]});let n=c.vm_status===`running`,r=c.vm_status===`stopped`,i={display:`flex`,alignItems:`center`,gap:`0.4rem`,padding:`0.45rem 0.9rem`,borderRadius:8,border:`none`,cursor:`pointer`,fontSize:`0.82rem`,fontWeight:600,transition:`opacity 0.15s`};return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(gf,{warnings:t}),(0,f.jsx)(Kf,{data:c,cardStyle:V,sectionHead:H}),(0,f.jsx)(Gf,{serviceId:e,cardStyle:V,sectionHead:H}),(0,f.jsxs)(`div`,{style:V,children:[(0,f.jsx)(`p`,{style:H,children:`Power Controls`}),(0,f.jsx)(`div`,{style:{display:`flex`,gap:`0.5rem`,flexWrap:`wrap`},children:[{key:`start`,label:`Start`,Icon:Bc,color:`#34d399`,bg:`#34d39920`,disabled:n},{key:`stop`,label:`Stop`,Icon:el,color:`#f87171`,bg:`#f8717120`,disabled:r},{key:`reboot`,label:`Reboot`,Icon:Kc,color:`#fbbf24`,bg:`#fbbf2420`,disabled:r},{key:`shutdown`,label:`Shutdown`,Icon:Hc,color:`#fb923c`,bg:`#fb923c20`,disabled:r}].map(({key:e,label:t,Icon:n,color:r,bg:a,disabled:o})=>(0,f.jsxs)(`button`,{onClick:()=>R(e),disabled:o||!!P,style:{...i,color:r,background:a,opacity:o||P?.45:1},children:[P===e?(0,f.jsx)(X,{size:14,style:{animation:`spin 1s linear infinite`}}):(0,f.jsx)(n,{size:14}),t]},e))}),I&&(0,f.jsx)(`div`,{style:{marginTop:`0.6rem`,fontSize:`0.8125rem`,color:I.includes(`initiated`)?`#34d399`:`#f87171`},children:I})]})]})}if(c.type===`enhance`||c.type===`clouddedicated`){let n=c.php_version?c.php_version.replace(`php`,`PHP `).replace(/(\d)(\d)$/,`$1.$2`):`â`,r=e=>(c.resource_quotas||[]).find(t=>t.key===e);return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(gf,{warnings:t}),c.type===`clouddedicated`&&(0,f.jsx)(yf,{data:c,cardStyle:V,sectionHead:H,serviceId:e}),(0,f.jsxs)(`div`,{style:V,children:[(0,f.jsx)(`p`,{style:H,children:`Account`}),(0,f.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:`0.5rem`,marginBottom:`1.25rem`},children:[c.type!==`clouddedicated`&&[`Username`,c.unix_user],[`Plan`,c.plan||`â`],[`Server`,c.server],c.type!==`clouddedicated`&&[`PHP`,n]].filter(Boolean).map(([e,t])=>(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-faint)`},children:e}),(0,f.jsx)(`div`,{style:{fontSize:`0.875rem`,color:`var(--text-primary)`,marginTop:2},children:t||`â`})]},e))})]}),c.layout?.resources!==!1&&(0,f.jsxs)(`div`,{style:V,children:[(0,f.jsx)(`p`,{style:H,children:`Resources`}),(0,f.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr 1fr`,gap:`0.5rem`},children:[(0,f.jsx)(bf,{label:`Email Accounts`,used:c.email_count,max:r(`mailboxes`)?.total||0,color:`#8b5cf6`}),(0,f.jsx)(bf,{label:`MySQL Databases`,used:c.db_count,max:r(`mysqlDbs`)?.total||0,color:`#3b82f6`}),(0,f.jsx)(bf,{label:`FTP Accounts`,used:r(`ftpUsers`)?.usage||0,max:r(`ftpUsers`)?.total||0,color:`#f97316`})]}),(0,f.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:`0.5rem`,marginTop:`0.5rem`},children:[(0,f.jsx)(bf,{label:`Addon Domains`,used:c.addon_domains?.length||0,max:r(`addonDomains`)?.total||0,color:`#10b981`}),(0,f.jsx)(bf,{label:`Subdomains`,used:c.subdomains?.length||0,max:r(`subdomains`)?.total||0,color:`#10b981`})]})]}),c.layout?.domains!==!1&&(()=>{let e=(c.all_domains?.length?c.all_domains.map(e=>[e.domain,e.type,e.type===`Primary`?`#f97316`:`#6b7280`]):[[c.main_domain,`Primary`,`#f97316`],...(c.addon_domains||[]).map(e=>[e,`Addon`,`#6b7280`]),...(c.subdomains||[]).map(e=>[e,`Sub`,`#6b7280`])]).filter(([e])=>e);return(0,f.jsxs)(`div`,{style:V,children:[(0,f.jsxs)(`p`,{style:H,children:[`Domains`,e.length?` (${e.length})`:``]}),e.map(([e,t,n])=>(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`0.5rem`,padding:`0.4rem 0`,borderBottom:`1px solid var(--border)`},children:[(0,f.jsx)(`span`,{style:{fontSize:`0.8125rem`,fontWeight:600,padding:`0.15rem 0.4rem`,borderRadius:4,background:`${n}20`,color:n,border:`1px solid ${n}40`,flexShrink:0},children:t}),(0,f.jsx)(`span`,{style:{fontSize:`0.875rem`,color:`var(--text-primary)`},children:e})]},e)),!e.length&&(0,f.jsx)(`p`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`},children:`No domain data available`})]})})(),c.type!==`clouddedicated`&&(0,f.jsx)(Jf,{serviceId:e,service:m,data:c,cardStyle:V,sectionHead:H})]})}
111if(c.type===`botprotection`)return(0,f.jsx)(Ku,{data:c,serviceId:e,onTabChange:s,onGoBilling:()=>r(`billing`),onGoSupport:()=>r(`support`)},c.tier);if(c.type===`mailfilter`)return(0,f.jsx)(jf,{data:c,serviceId:e});if(c.type===`ssl`){let e=c.cert,t=e=>e?new Date(e).toLocaleDateString(`en-AU`,{day:`numeric`,month:`short`,year:`numeric`}):`â`,n=e?e.days_remaining<0?`expired`:e.days_remaining<30?`expiring`:`valid`:`unknown`,r={valid:`#34d399`,expiring:`#fbbf24`,expired:`#f87171`,unknown:`var(--text-muted)`}[n],i={valid:`Valid`,expiring:`Expiring soon`,expired:`Expired`,unknown:`Not verified`}[n];return(0,f.jsxs)(`div`,{style:V,children:[(0,f.jsx)(`p`,{style:H,children:`SSL Certificate`}),(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`0.5rem`,marginBottom:`1rem`,flexWrap:`wrap`},children:[(0,f.jsx)(Xc,{size:18,style:{color:r}}),(0,f.jsx)(`span`,{style:{fontSize:`1rem`,fontWeight:700,color:`var(--text-primary)`},children:i}),e&&e.days_remaining>=0&&(0,f.jsxs)(`span`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`},children:[`· `,e.days_remaining,` days remaining`]})]}),e?(0,f.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:`0.75rem 1rem`},children:[[`Secured domain`,c.domain],[`Issued to`,e.subject],[`Issuer`,e.issuer],[`Issued on`,t(e.valid_from)],[`Expires on`,t(e.valid_to)],[`Also covers`,(e.altnames||[]).join(`, `)]].map(([e,t])=>(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-faint)`},children:e}),(0,f.jsx)(`div`,{style:{fontSize:`0.875rem`,color:`var(--text-primary)`,marginTop:2,wordBreak:`break-word`},children:t||`â`})]},e))}):(0,f.jsxs)(`p`,{style:{fontSize:`0.85rem`,color:`var(--text-muted)`},children:[`We couldnât reach `,c.domain||`the domain`,` to read its live certificate. If the site is online, please try again shortly.`]})]})}return c.type===`dns`?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(Xf,{serviceId:e,primary:c.main_domain||c.domain,addon:c.addon_domains,alias:c.alias_domains,cap:c.domain_cap||Ed,canAdd:Td(m),cardStyle:V,sectionHead:H,onEditDns:e=>{C(e),Yf()},onAdded:({domain:e,addon_domains:t,alias_domains:n})=>{u(e=>({...e,addon_domains:t,alias_domains:n})),C(e)}}),(0,f.jsx)(Qf,{serviceId:e,zone:S,onZoneChange:C})]}):c.type===`generic`?(0,f.jsxs)(`div`,{style:V,children:[(0,f.jsx)(`p`,{style:H,children:`Service`}),(0,f.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:`0.5rem`},children:[[`Service`,c.plan],[`Domain`,c.domain],[`Status`,m.status]].map(([e,t])=>(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-faint)`},children:e}),(0,f.jsx)(`div`,{style:{fontSize:`0.875rem`,color:`var(--text-primary)`,marginTop:2},children:t||`â`})]},e))}),(0,f.jsx)(`p`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`,marginTop:`0.85rem`},children:`Billing details are shown above. Contact support for any changes to this service.`})]}):(0,f.jsx)(`div`,{style:V,children:(0,f.jsx)(`p`,{style:{color:`var(--text-muted)`,fontSize:`0.875rem`},children:`Detailed service information is not available for this service type.`})})})():(0,f.jsx)(`div`,{style:{...V,color:`var(--text-muted)`,fontSize:`0.875rem`},children:c?.error||`Could not load live service data.`}),a&&(c?.type!==`botprotection`||o===`overview`)&&(0,f.jsxs)(`div`,{style:V,children:[(0,f.jsx)(`p`,{style:H,children:`Billing`}),W&&(0,f.jsxs)(`div`,{style:{display:`flex`,gap:`0.55rem`,alignItems:`flex-start`,padding:`0.7rem 0.85rem`,marginBottom:`0.9rem`,borderRadius:10,background:`#fbbf2412`,border:`1px solid #fbbf2433`},children:[(0,f.jsx)(vc,{size:15,style:{color:`#fbbf24`,flexShrink:0,marginTop:1}}),(0,f.jsxs)(`p`,{style:{margin:0,fontSize:`0.8125rem`,color:`var(--text-muted)`,lineHeight:1.5},children:[`This is a legacy product with legacy specs and pricing.`,` `,(0,f.jsx)(`button`,{onClick:()=>r(`support`),style:{background:`none`,border:`none`,padding:0,font:`inherit`,color:`var(--accent)`,cursor:`pointer`,textDecoration:`underline`},children:`Contact us`}),` `,`for options to upgrade to our latest specs and pricing.`]})]}),m.status===`Trial`&&(0,f.jsxs)(`div`,{style:{display:`flex`,gap:`0.55rem`,alignItems:`flex-start`,padding:`0.7rem 0.85rem`,marginBottom:`0.9rem`,borderRadius:10,background:`#a78bfa12`,border:`1px solid #a78bfa33`},children:[(0,f.jsx)(vc,{size:15,style:{color:`#a78bfa`,flexShrink:0,marginTop:1}}),(0,f.jsxs)(`p`,{style:{margin:0,fontSize:`0.8125rem`,color:`var(--text-muted)`,lineHeight:1.5},children:[`This service is on a `,(0,f.jsx)(`strong`,{style:{color:`var(--text-primary)`},children:`free trial`}),` â you are not being billed for it`,m.nextduedate?(0,f.jsxs)(f.Fragment,{children:[` until the trial ends on `,(0,f.jsx)(`strong`,{style:{color:`var(--text-primary)`},children:Q(m.nextduedate)})]}):``,`. The figures below are what it will cost if you keep it.`,` `,m.trial_auto_convert?(0,f.jsx)(f.Fragment,{children:`On that date it continues automatically and your first invoice is issued and paid from your saved payment method. Cancel before then and you won't be charged.`}):(0,f.jsx)(f.Fragment,{children:`Nothing is charged automatically â we will be in touch first.`})]})]}),(0,f.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr 1fr`,gap:`0.5rem`},children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-faint)`},children:U.addons.length?`Recurring total`:`Amount`}),(0,f.jsxs)(`div`,{style:{fontSize:`0.875rem`,fontWeight:600,color:`var(--text-primary)`,marginTop:2},children:[$(U.total),U.perMonth&&(0,f.jsx)(`span`,{style:{fontSize:`0.75rem`,fontWeight:400,color:`var(--text-faint)`},children:` / month`})]})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-faint)`},children:`Cycle`}),(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`0.35rem`,marginTop:2},children:[(0,f.jsx)(`span`,{style:{fontSize:`0.875rem`,fontWeight:600,color:`var(--text-primary)`},children:m.billingcycle||`â`}),[`Active`,`Trial`,`Suspended`,`Pending`].includes(m.status)&&(0,f.jsx)(`button`,{onClick:()=>y(!0),title:`Change billing cycle`,style:{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,padding:2,borderRadius:6,border:`none`,background:`none`,color:`var(--accent)`,cursor:`pointer`},children:(0,f.jsx)(Rc,{size:13})})]})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-faint)`},children:m.status===`Trial`?`Trial ends`:`Next Due`}),m.auto_renew===!1?(0,f.jsx)(`div`,{style:{fontSize:`0.875rem`,fontWeight:600,color:`#ef4444`,marginTop:2},children:`Auto-renew disabled`}):(0,f.jsx)(`div`,{style:{fontSize:`0.875rem`,fontWeight:600,color:`var(--text-primary)`,marginTop:2},children:Q(m.nextduedate)})]})]}),U.addons.length>0&&(0,f.jsxs)(`div`,{style:{marginTop:`1rem`,paddingTop:`0.85rem`,borderTop:`1px solid var(--border)`},children:[(0,f.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,gap:`0.75rem`,padding:`0.4rem 0`},children:[(0,f.jsxs)(`span`,{style:{fontSize:`0.8125rem`,color:`var(--text-primary)`},children:[m.product_name||m.name,(0,f.jsx)(`span`,{style:{color:`var(--text-faint)`},children:` â plan`})]}),(0,f.jsxs)(`span`,{style:{fontSize:`0.8125rem`,color:`var(--text-primary)`,whiteSpace:`nowrap`,fontVariantNumeric:`tabular-nums`},children:[$(U.base),(0,f.jsx)(`span`,{style:{color:`var(--text-faint)`},children:U.cycleSuffix})]})]}),U.addons.map(e=>{let t=String(e.status||`Active`).toLowerCase()!==`active`;return(0,f.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,gap:`0.75rem`,padding:`0.4rem 0`,opacity:t?.55:1},children:[(0,f.jsxs)(`span`,{style:{fontSize:`0.8125rem`,color:`var(--text-primary)`},children:[(0,f.jsxs)(`span`,{style:{color:`var(--text-faint)`},children:[e.addon_type||`Service`,` â `]}),e.name,e.qty>1&&(0,f.jsxs)(`span`,{style:{color:`var(--text-faint)`},children:[` à `,e.qty]}),t&&(0,f.jsx)(`span`,{style:{marginLeft:`0.4rem`,fontSize:`0.7rem`,fontWeight:600,padding:`0.05rem 0.35rem`,borderRadius:4,background:`#fbbf2420`,color:`#fbbf24`},children:e.status}),e.description&&(0,f.jsx)(`span`,{style:{display:`block`,fontSize:`0.75rem`,color:`var(--text-muted)`,marginTop:1},children:e.description})]}),(0,f.jsxs)(`span`,{style:{fontSize:`0.8125rem`,color:`var(--text-primary)`,whiteSpace:`nowrap`,fontVariantNumeric:`tabular-nums`},children:[e.amount==null?`â`:$(e.amount),(0,f.jsx)(`span`,{style:{color:`var(--text-faint)`},children:U.suffixFor(e.billingcycle)})]})]},e.id)}),(0,f.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,gap:`0.75rem`,paddingTop:`0.55rem`,marginTop:`0.3rem`,borderTop:`1px solid var(--border)`},children:[(0,f.jsx)(`span`,{style:{fontSize:`0.875rem`,fontWeight:700,color:`var(--text-primary)`},children:`Total`}),(0,f.jsxs)(`span`,{style:{fontSize:`0.875rem`,fontWeight:700,color:`var(--text-primary)`,whiteSpace:`nowrap`,fontVariantNumeric:`tabular-nums`},children:[$(U.total),(0,f.jsx)(`span`,{style:{color:`var(--text-faint)`,fontWeight:400},children:U.totalSuffix})]})]}),U.perMonth&&(0,f.jsxs)(`p`,{style:{fontSize:`0.75rem`,color:`var(--text-faint)`,margin:`0.5rem 0 0`},children:[`Your plan renews `,String(m.billingcycle||``).toLowerCase(),` and some add-ons renew monthly, so the total is shown per month. Each line is invoiced on its own cycle.`]}),U.inactiveCount>0&&(0,f.jsx)(`p`,{style:{fontSize:`0.75rem`,color:`var(--text-faint)`,margin:`0.5rem 0 0`},children:`Lines not marked active are not included in the total.`})]}),[`cpanel`,`enhance`,`clouddedicated`].includes(c?.type)&&!W&&(Td(m)||m.status===`Suspended`)&&(0,f.jsxs)(`div`,{style:{marginTop:`1rem`,paddingTop:`1rem`,borderTop:`1px solid var(--border)`,display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:`0.75rem`,flexWrap:`wrap`},children:[(0,f.jsx)(`p`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`,margin:0},children:`Need more (or less)? Switch this service to a different package.`}),(0,f.jsxs)(`button`,{className:`btn-primary`,onClick:()=>_(!0),children:[(0,f.jsx)(Gc,{size:14}),` Change plan`]})]})]}),(0,f.jsx)(`div`,{style:{marginTop:`1rem`},children:(0,f.jsx)(`button`,{onClick:()=>r(`support`),style:{fontSize:`0.875rem`,color:`var(--accent)`,background:`none`,border:`none`,cursor:`pointer`,padding:0},children:`Need help with this service? Contact support â`})}),[`Active`,`Suspended`,`Pending`].includes(m.status)&&(0,f.jsx)(`div`,{style:{marginTop:`2rem`,paddingTop:`1.25rem`,borderTop:`1px solid var(--border)`,textAlign:`center`},children:m.auto_renew===!1?m.nextduedate&&new Date(m.nextduedate)>=new Date(new Date().toDateString())?(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`button`,{onClick:B,disabled:O,style:{fontSize:`0.8125rem`,color:`var(--accent)`,background:`none`,border:`none`,cursor:O?`default`:`pointer`,padding:0,textDecoration:`underline`,opacity:O?.6:1},children:O?`Enablingâ¦`:`Enable auto-renew for this service`}),M&&(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,color:`#ef4444`,marginTop:`0.4rem`},children:M})]}):(0,f.jsx)(`span`,{style:{fontSize:`0.8125rem`,color:`var(--text-faint)`},children:`Auto-renew is turned off for this service. Contact support to turn it back on.`}):(0,f.jsx)(`button`,{onClick:()=>{T(!0),j(!1),N(null),D(``)},style:{fontSize:`0.8125rem`,color:`#ef4444`,background:`none`,border:`none`,cursor:`pointer`,padding:0,textDecoration:`underline`},children:`Disable auto-renew for this service`})}),w&&(0,f.jsx)(`div`,{onClick:e=>e.target===e.currentTarget&&!O&&T(!1),style:{position:`fixed`,inset:0,zIndex:9999,background:`rgba(0,0,0,0.65)`,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`1rem`},children:(0,f.jsx)(`div`,{style:{background:`var(--bg-surface)`,border:`1px solid var(--border)`,borderRadius:14,width:`100%`,maxWidth:460,padding:`1.5rem`,maxHeight:`90vh`,overflow:`auto`}
111,children:A?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`div`,{style:{fontSize:`1.05rem`,fontWeight:700,color:`var(--text-primary)`,marginBottom:`0.5rem`},children:`Auto-renew disabled`}),(0,f.jsxs)(`p`,{style:{fontSize:`0.85rem`,color:`var(--text-muted)`,lineHeight:1.6,margin:`0 0 1.1rem`},children:[(0,f.jsx)(`strong`,{style:{color:`var(--text-primary)`},children:m.name}),` wonât renew automatically. It stays active until`,` `,(0,f.jsx)(`strong`,{style:{color:`var(--text-primary)`},children:m.nextduedate?new Date(m.nextduedate).toLocaleDateString(`en-AU`):`the end of your current term`}),`.`,` Weâve emailed you a confirmation, and you can re-enable auto-renew any time before then.`,E.trim()&&` Thanks for telling us why â our team will be in touch.`]}),(0,f.jsx)(`button`,{className:`btn-primary`,style:{width:`100%`},onClick:()=>T(!1),children:`Close`})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`div`,{style:{fontSize:`1.05rem`,fontWeight:700,color:`var(--text-primary)`,marginBottom:`0.5rem`},children:`Disable auto-renew?`}),(0,f.jsx)(`div`,{style:{padding:`0.85rem 1rem`,borderRadius:10,background:`rgba(239,68,68,0.08)`,border:`1px solid rgba(239,68,68,0.25)`,marginBottom:`1.1rem`},children:(0,f.jsxs)(`p`,{style:{fontSize:`0.82rem`,color:`var(--text-muted)`,lineHeight:1.6,margin:0},children:[`If you turn off auto-renew, `,(0,f.jsx)(`strong`,{style:{color:`var(--text-primary)`},children:m.name}),` will `,(0,f.jsx)(`strong`,{style:{color:`var(--text-primary)`},children:`not renew automatically`}),`. It stays active until `,(0,f.jsx)(`strong`,{style:{color:`var(--text-primary)`},children:m.nextduedate?new Date(m.nextduedate).toLocaleDateString(`en-AU`):`the end of your current term`}),`, after which it will be suspended and then terminated â and any data, settings or content may be permanently lost. Youâd need to renew manually to keep it.`]})}),(0,f.jsx)(`label`,{htmlFor:`ar-reason`,style:{display:`block`,fontSize:`0.85rem`,fontWeight:600,color:`var(--text-primary)`,marginBottom:`0.45rem`},children:`Whatâs the one thing that would keep your service active with us today?`}),(0,f.jsx)(`textarea`,{id:`ar-reason`,value:E,onChange:e=>D(e.target.value),rows:3,placeholder:`Tell us what would change your mindâ¦`,style:{width:`100%`,boxSizing:`border-box`,padding:`0.6rem 0.75rem`,borderRadius:9,background:`var(--bg-elevated, rgba(255,255,255,0.04))`,border:`1px solid var(--border)`,color:`var(--text-primary)`,fontSize:`0.85rem`,resize:`vertical`,outline:`none`}}),M&&(0,f.jsx)(`p`,{style:{fontSize:`0.8125rem`,color:`#ef4444`,margin:`0.6rem 0 0`},children:M}),(0,f.jsxs)(`div`,{style:{display:`flex`,gap:`0.6rem`,marginTop:`1.1rem`},children:[(0,f.jsx)(`button`,{className:`btn-secondary`,style:{flex:1},onClick:()=>T(!1),disabled:O,children:`Keep auto-renew`}),(0,f.jsx)(`button`,{className:`btn-danger`,style:{flex:1},onClick:z,disabled:O,children:O?`Submittingâ¦`:`Disable auto-renew`})]})]})})})]})}function sp({setTab:e,routeServiceId:t=null,onServiceRoute:n,canViewDetail:r=!0,caps:i={}}){let a=i.pricing!==!1,o=a?`grid-cols-[3fr_1fr_1fr_1.6fr_auto]`:`grid-cols-[3fr_1fr_1.6fr_auto]`,[s,c]=(0,l.useState)(!1),[u,d]=(0,l.useState)([]),[p,m]=(0,l.useState)(!0),[h,g]=(0,l.useState)(``),[_,v]=(0,l.useState)(`active`),[y,b]=(0,l.useState)(`nextduedate`),[x,S]=(0,l.useState)(`asc`),[C,w]=(0,l.useState)(1),[T,E]=(0,l.useState)(25);(0,l.useEffect)(()=>{Z(`/api/portal/services`).then(e=>{d(e.services||[]),m(!1)})},[]),(0,l.useEffect)(()=>{w(1)},[h,_,y,x]);function D(e){y===e?S(e=>e===`asc`?`desc`:`asc`):(b(e),S(`asc`))}function O({col:e}){return y===e?x===`asc`?(0,f.jsx)(rc,{size:12,className:`text-accent ml-1 inline-block`}):(0,f.jsx)(ec,{size:12,className:`text-accent ml-1 inline-block`}):(0,f.jsx)(ic,{size:12,className:`text-faint ml-1 inline-block`})}function k({col:e,label:t,className:n=``}){return(0,f.jsxs)(`button`,{onClick:()=>D(e),className:`flex items-center gap-0.5 text-xs font-semibold uppercase tracking-wide transition-colors hover:text-primary ${y===e?`text-primary`:`text-muted`} ${n}`,children:[t,(0,f.jsx)(O,{col:e})]})}if(p)return(0,f.jsx)(`div`,{className:`flex items-center justify-center py-20`,children:(0,f.jsx)(X,{size:20,className:`animate-spin text-faint`})});if(t){if(!r)return setTimeout(()=>n?.(null),0),null;let a=u.find(e=>e.public_id===t);return a?(0,f.jsx)(op,{serviceId:a.id,service:a,onBack:()=>n?.(null),setTab:e,caps:i}):(setTimeout(()=>n?.(null),0),null)}let A=r?`button`:`div`,j=h.toLowerCase(),M=e=>e.status===`Cancelled`||e.status===`Terminated`,N={active:u.filter(Td).length,pending:u.filter(e=>e.status===`Pending`).length,cancelled:u.filter(M).length,all:u.length},P=u.filter(e=>{let t=!j||(e.name||``).toLowerCase().includes(j)||(e.domain||``).toLowerCase().includes(j),n=_===`all`||_===`active`&&Td(e)||_===`pending`&&e.status===`Pending`||_===`cancelled`&&M(e);return t&&n}).sort((e,t)=>
111{let n,r;return y===`name`?(n=e.name||``,r=t.name||``):y===`amount`?(n=parseFloat(e.amount)||0,r=parseFloat(t.amount)||0):y===`nextduedate`?(n=e.nextduedate||``,r=t.nextduedate||``):y===`status`&&(n=e.status||``,r=t.status||``),n<r?x===`asc`?-1:1:n>r?x===`asc`?1:-1:0}),F=P.slice((C-1)*T,C*T);return(0,f.jsxs)(`div`,{className:`p-4 md:p-6 pb-16 max-w-4xl mx-auto`,children:[(0,f.jsxs)(`div`,{className:`flex items-start justify-between gap-4 mb-5`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`h1`,{className:`text-2xl font-bold text-primary flex items-center gap-2.5`,children:[(0,f.jsx)(Ic,{size:22,className:`text-faint shrink-0`}),`Products & Services`]}),(0,f.jsx)(`div`,{className:`mt-1.5`,children:(0,f.jsx)(lf,{label:`What are services?`,onClick:()=>c(!0)})})]}),(0,f.jsxs)(`button`,{onClick:()=>e(`order`),className:`btn-success gap-2 shrink-0`,children:[(0,f.jsx)(Vc,{size:14,strokeWidth:2.5}),` New order`]})]}),s&&(0,f.jsx)(cf,{title:`What are services?`,paragraphs:df,onClose:()=>c(!1)}),(0,f.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 mb-4`,children:[(0,f.jsx)(`div`,{className:`flex gap-1.5 flex-wrap`,children:[{key:`active`,label:`Active`},{key:`pending`,label:`Pending`},{key:`cancelled`,label:`Cancelled`},{key:`all`,label:`All`}].map(e=>(0,f.jsxs)(`button`,{onClick:()=>v(e.key),className:`px-3 py-1 rounded-full text-xs font-semibold border transition-colors`,style:{background:_===e.key?`color-mix(in srgb, var(--accent) 12%, transparent)`:`var(--bg-elevated)`,borderColor:_===e.key?`var(--accent)`:`var(--border)`,color:_===e.key?`var(--accent)`:`var(--text-muted)`},children:[e.label,(0,f.jsx)(`span`,{className:`ml-1.5 text-[10px] font-semibold opacity-70`,children:N[e.key]})]},e.key))}),(0,f.jsxs)(`div`,{className:`relative ml-auto`,children:[(0,f.jsx)(qc,{size:14,className:`absolute left-2.5 top-1/2 -translate-y-1/2 text-faint pointer-events-none`}),(0,f.jsx)(`input`,{value:h,onChange:e=>g(e.target.value),placeholder:`Search servicesâ¦`,className:`pl-8 pr-3 py-1.5 rounded-lg text-sm bg-elevated border border-edge text-primary placeholder:text-faint focus:outline-none focus:border-accent`,style:{width:180}})]})]}),P.length===0?(0,f.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface text-center py-12 px-4`,children:[(0,f.jsx)(Ic,{size:32,className:`mx-auto mb-3 text-faint opacity-40`}),(0,f.jsx)(`p`,{className:`font-semibold text-primary mb-1`,children:h?`No results for "${h}"`:`No services yet`}),(0,f.jsx)(`p`,{className:`text-sm text-muted mb-4`,children:`Order hosting, domains, email and more.`}),(0,f.jsxs)(`button`,{onClick:()=>e(`order`),className:`btn-success gap-2 mx-auto`,children:[(0,f.jsx)(Vc,{size:14}),` Place new order`]})]}):(0,f.jsxs)(`div`,{className:`rounded-xl border border-edge overflow-hidden bg-surface`,children:[(0,f.jsxs)(`div`,{className:`hidden sm:grid ${o} gap-4 px-4 py-2.5 border-b border-edge bg-elevated`,children:[(0,f.jsx)(k,{col:`name`,label:`Service`}),(0,f.jsx)(k,{col:`status`,label:`Status`}),a&&(0,f.jsx)(k,{col:`amount`,label:`Amount`}),(0,f.jsx)(k,{col:`nextduedate`,label:`Next due`}),(0,f.jsx)(`span`,{className:`w-4`})]}),F.map((e,t)=>(0,f.jsxs)(A,{onClick:r?()=>n?.(e.public_id):void 0,className:`w-full text-left ${r?`transition-colors hover:bg-[var(--bg-hover)]`:`cursor-default`}`,style:{borderBottom:t<F.length-1?`1px solid var(--border)`:`none`},children:[(0,f.jsxs)(`div`,{className:`hidden sm:grid ${o} gap-4 items-center px-4 py-3.5`,children:[(0,f.jsxs)(`div`,{className:`min-w-0`,children:[(0,f.jsxs)(`div`,{className:`font-semibold text-sm text-primary truncate flex items-center gap-1.5`,children:[e.name,e.migration&&(0,f.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full text-[10px] font-semibold shrink-0`,style:{background:`color-mix(in srgb, var(--accent) 14%, transparent)`,color:`var(--accent)`},children:[(0,f.jsx)(Gc,{size:9}),` Upgrade`]})]}),e.domain&&(0,f.jsx)(`div`,{className:`text-xs text-muted mt-0.5 truncate`,children:e.domain})]}),(0,f.jsx)(`span`,{children:(0,f.jsx)(kd,{status:e.status})}),a&&(0,f.jsx)(`span`,{className:`text-sm text-primary font-medium`,children:$(e.amount)}),e.auto_renew===!1?(0,f.jsx)(`span`,{className:`text-sm font-semibold whitespace-nowrap`,style:{color:`#ef4444`},children:`Auto-renew disabled`}):(0,f.jsxs)(`span`,{className:`text-sm text-muted`,children:[Q(e.nextduedate),e.status===`Trial`&&e.nextduedate&&(0,f.jsx)(`span`,{className:`text-xs text-faint ml-1`,children:`trial ends`})]}),r?(0,f.jsx)(nc,{size:14,className:`text-faint`}):(0,f.jsx)(`span`,{})]}),(0,f.jsxs)(`div`,{className:`sm:hidden flex items-center gap-3 px-4 py-3.5`,children:[(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`font-semibold text-sm text-primary truncate flex items-center gap-1.5`,children:[e.name,e.migration&&(0,f.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full text-[10px] font-semibold shrink-0`,style:{background:`color-mix(in srgb, var(--accent) 14%, transparent)`,color:`var(--accent)`},children:[(0,f.jsx)(Gc,{size:9}),` Upgrade`]})]}),e.domain&&(0,f.jsx)(`div`,{className:`text-xs text-muted mt-0.5 truncate`,children:e.domain}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2 mt-1`,children:[(0,f.jsx)(kd,{status:e.status}),e.auto_renew===!1?(0,f.jsx)(`span`,{className:`text-xs font-semibold`,style:{color:`#ef4444`},children:`Auto-renew disabled`}):(0,f.jsxs)(`span`,{className:`text-xs text-muted`,children:[Q(e.nextduedate),e.status===`Trial`&&e.nextduedate&&(0,f.jsx)(`span`,{className:`text-faint ml-1`,children:`trial ends`})]})]})]}),(0,f.jsxs)(`div`,{className:`shrink-0 flex items-center gap-2`,children:[a&&(0,f.jsx)(`span`,{className:`text-sm font-semibold text-primary`,children:$(e.amount)}),r&&(0,f.jsx)(nc,{size:14,className:`text-faint`})]})]})]},e.id)),(0,f.jsx)(Md,{total:P.length,page:C,pageSize:T,onPage:w,onPageSize:E})]})]})}async function cp(e,t=null){let n={method:`POST`};t&&(n.body=JSON.stringify({payment_method_id:t}));let r=await Z(`/api/portal/invoices/${e}/pay`,n);if(r.ok)return{ok:!0,amount:r.amount};if(r.requires_action&&r.client_secret&&r.publishable_key)try{let{error:t,paymentIntent:n}=await(await Xu(r.publishable_key)).handleNextAction({clientSecret:r.client_secret});if(t)return{ok:!1,error:$u(t,`Your bank could not verify that card. Please try again.`)};if(n?.status!==`succeeded`)return{ok:!1,error:`Payment not completed (${n?.status||`unknown`}). Please try again.`};let i=await Z(`/api/portal/invoices/${e}/pay/settle`,{method:`POST`,body:JSON.stringify({payment_intent_id:r.payment_intent_id})});return i.ok?{ok:!0,amount:i.amount}:{ok:!1,error:i.error||`Your payment went through but we could not confirm it â please contact support.`}}catch(e){return{ok:!1,error:$u(e,`Your bank could not verify that card. Please try again.`)}}return{ok:!1,error:r.error||``,error_code:r.error_code||``}}function lp({method:e,onGoToPaymentMethods:t,onClose:n}){let r=e?e.brand?`${e.brand} â¢â¢â¢â¢ ${e.last4}`:nd(e):`your saved card`;return(0,ml.createPortal)((0,f.jsx)(`div`,{className:`fixed inset-0 flex items-center justify-center p-4`,style:{zIndex:1e4,background:`rgba(0,0,0,0.7)`},onClick:e=>{e.target===e.currentTarget&&n()},children:(0,f.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface shadow-xl w-full max-w-md p-6 space-y-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(Y,{size:20,style:{color:`#f59e0b`}}),(0,f.jsx)(`h3`,{className:`text-base font-bold text-primary`,children:`Your saved card needs reconnecting`})]}),(0,f.jsxs)(`p`,{className:`text-sm text-secondary`,children:[`We still have `,(0,f.jsx)(`strong`,{className:`text-primary`,children:r}),` on your account, but it isnât linked to our payment provider â so we canât charge it. This affects some cards carried over from our previous billing system.`]}
111),(0,f.jsxs)(`div`,{className:`rounded-xl border border-edge p-3.5 space-y-2.5`,style:{background:`var(--bg-elevated)`},children:[(0,f.jsx)(`div`,{className:`text-xs font-semibold uppercase tracking-wide text-muted`,children:`To fix it`}),(0,f.jsxs)(`div`,{className:`flex items-start gap-2.5 text-sm text-secondary`,children:[(0,f.jsx)(rl,{size:15,className:`shrink-0 mt-0.5`,style:{color:`#ef4444`}}),(0,f.jsxs)(`span`,{children:[(0,f.jsx)(`strong`,{className:`text-primary`,children:`Remove`}),` the card from your payment methods.`]})]}),(0,f.jsxs)(`div`,{className:`flex items-start gap-2.5 text-sm text-secondary`,children:[(0,f.jsx)(Vc,{size:15,className:`shrink-0 mt-0.5`,style:{color:`#22c55e`}}),(0,f.jsxs)(`span`,{children:[(0,f.jsx)(`strong`,{className:`text-primary`,children:`Add it again`}),` â the same card is fine. Itâll be connected properly this time, and future invoices will pay automatically.`]})]})]}),(0,f.jsx)(`p`,{className:`text-xs text-muted`,children:`Your card details are entered directly with our payment provider â we never see or store the number.`}),(0,f.jsxs)(`div`,{className:`flex gap-2 justify-end pt-1`,children:[(0,f.jsx)(`button`,{className:`btn-secondary`,onClick:n,children:`Not now`}),(0,f.jsxs)(`button`,{className:`btn-primary flex items-center gap-1.5`,onClick:t,children:[(0,f.jsx)(sc,{size:14}),` Go to Payment Methods `,(0,f.jsx)(Js,{size:14})]})]})]})}),document.body)}function up({invoiceId:e,client:t,onClose:n,defaultMethod:r,onPaid:i,onManagePaymentMethods:a}){let[o,s]=(0,l.useState)(null),[c,u]=(0,l.useState)({}),[d,m]=(0,l.useState)(!0),[h,g]=(0,l.useState)(!1),[_,v]=(0,l.useState)(null),[y,b]=(0,l.useState)(null),[x,S]=(0,l.useState)(!1);(0,l.useEffect)(()=>{Z(`/api/portal/invoices/${e}`).then(e=>{e.ok&&(s(e.invoice),u(e.branding||{})),m(!1)})},[e]);let C=c.company_name||`Network Dynamics`,w=c.support_email||`[email protected]`,T=w,E=(c.abn||``).trim(),D=(c.phone||``).trim(),O=(c.postal_address||``).trim();function k(){if(!o?.public_id)return;let e=vl(o.public_id),t=document.createElement(`iframe`);Object.assign(t.style,{position:`fixed`,right:`0`,bottom:`0`,width:`0`,height:`0`,border:`0`});let n=!1,r=()=>{n||(n=!0,setTimeout(()=>t.remove(),6e4))};t.onload=()=>{try{t.contentWindow.focus(),t.contentWindow.print(),r()}catch{t.remove(),window.open(e,`_blank`,`noopener`)}},t.onerror=()=>{t.remove(),window.open(e,`_blank`,`noopener`)},t.src=e,document.body.appendChild(t)}function A(e){s(e=>e&&{...e,status:`Paid`,datepaid:new Date().toISOString()}),b(`Payment successful â ${$(e!=null&&!Number.isNaN(parseFloat(e))?e:Sd(o))} charged to ${nd(r)}. A receipt has been emailed to you.`),i?.()}async function j(){if(h)return;if(!r){v(`Add a payment method in your account settings first.`);return}g(!0),v(null),b(null),S(!1);let t=await cp(e);if(g(!1),t.ok){A(t.amount);return}if(t.error_code===`no_gateway_token`){S(!0);return}v(t.error?`Payment failed â ${t.error}`:`Payment failed. Please try again or contact support.`)}let M=Sd(o),N=parseFloat(o?.amount_paid||0)||0,P=parseFloat(o?.credit_applied||0)||0,F=parseFloat(o?.amount_refunded||0)||0,I=o&&(o.status===`Unpaid`||o.status===`Overdue`)&&M>0,L=parseFloat(o?.discount_pct||0),R=parseFloat(o?.discount||0)>0&&(o?.items||[]).some(e=>e.discountable===!1),z={Paid:{bg:`#d1fae5`,color:`#065f46`,border:`#6ee7b7`},Unpaid:{bg:`#fef3c7`,color:`#92400e`,border:`#fcd34d`},Overdue:{bg:`#fee2e2`,color:`#991b1b`,border:`#fca5a5`}}[o?.status]||{bg:`#f3f4f6`,color:`#374151`,border:`#d1d5db`},B=o?.invoicenum||o?.id,V=typeof window<`u`?window.location.origin:``,H=`${V}/pay-invoice?ref=${encodeURIComponent(B??``)}`,U=V||`/`;return(0,ml.createPortal)((0,f.jsxs)(`div`,{style:{position:`fixed`,inset:0,zIndex:9999,background:`rgba(0,0,0,0.7)`,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`1rem`},className:`invoice-print-overlay`,onClick:e=>e.target===e.currentTarget&&n(),children:[x&&(0,f.jsx)(lp,{method:r,onClose:()=>S(!1),onGoToPaymentMethods:()=>{S(!1),n(),a?.()}}),(0,f.jsx)(`style`,{children:` 112 @media print { 113 /* The modal is rendered through a React portal as a direct child of 114 <body> (sibling to #root), so we can fully remove everything else 115 with display:none â which collapses its layout height too. The old 116 visibility:hidden approach kept that height, leaving blank pages. */ 117 @page { margin: 1.6cm; } 118 html, body { background: #fff !important; margin: 0 !important; padding: 0 !important; } 119 body > *:not(.invoice-print-overlay) { display: none !important; } 120 /* The on-screen modal padding (2.5rem) stacks on top of the @page 121 margin when printing, leaving too much top/side whitespace â trim 122 it right down for print so only the page margin frames the invoice. */ 123 .invoice-body { padding: 0.5rem 0.25rem !important; } 124 /* Neutralise the screen-centred fixed overlay so the invoice flows as 125 normal page content. A fixed/absolute print root that is taller than 126 the viewport gets repeated on every printed page (the duplication). */ 127 .invoice-print-overlay { 128 position: static !important; 129 display: block !important; 130 background: none !important; 131 padding: 0 !important; 132 } 133 #invoice-print-root { 134 position: static !important; 135 max-width: none !important; 136 max-height: none !important; 137 overflow: visible !important; 138 box-shadow: none !important; 139 border-radius: 0 !important; 140 } 141 .no-print { display: none !important; } 142 } 143 /* Shown only on the printed/PDF page, not in the on-screen modal. */ 144 @media screen { .print-only { display: none !important; } } 145 `}),(0,f.jsxs)(`div`,{id:`invoice-print-root`,style:{background:`#fff`,borderRadius:12,width:`100%`,maxWidth:680,maxHeight:`92vh`,overflow:`auto`,display:`flex`,flexDirection:`column`},className:`invoice-page`,children:[(0,f.jsxs)(`div`,{className:`no-print`,style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,padding:`0.75rem 1.25rem`,borderBottom:`1px solid #e5e7eb`,background:`#f9fafb`,borderRadius:`12px 12px 0 0`},children:[(0,f.jsxs)(`span`,{style:{fontWeight:700,fontSize:`0.9rem`,color:`#111`},children:[`Invoice `,o?_d(o):`#${e}`]}),(0,f.jsxs)(`div`,{style:{display:`flex`,gap:`0.5rem`,alignItems:`center`},children:[I&&(0,f.jsx)(`button`,{className:`btn-success`,onClick:j,disabled:h,children:h?`Processingâ¦`:`Pay ${$(M)}`}),o?.public_id&&(0,f.jsx)(`button`,{className:`btn-primary`,onClick:()=>window.open(vl(o.public_id),`_blank`,`noopener`),children:`⬠Download PDF`}),o?.public_id&&(0,f.jsx)(`button`,{className:`btn-secondary no-print`,onClick:k,children:`ð¨ Print`}),(0,f.jsx)(`button`,{className:`btn-secondary`,onClick:n,children:`â Close`})]})]}),_&&(0,f.jsxs)(`div`,{className:`no-print`,style:{padding:`0.6rem 1.25rem`,background:`#fef2f2`,borderBottom:`1px solid #fecaca`,color:`#991b1b`,fontSize:`0.8125rem`,display:`flex`,alignItems:`center`,gap:`0.5rem`},children:[(0,f.jsx)(Rs,{size:15,style:{flexShrink:0}}),(0,f.jsx)(`span`,{children:_})]}),y&&(0,f.jsxs)(`div`,{className:`no-print`,style:{padding:`0.6rem 1.25rem`,background:`#ecfdf5`,borderBottom:`1px solid #a7f3d0`,color:`#065f46`,fontSize:`0.8125rem`,display:`flex`,alignItems:`center`,gap:`0.5rem`},children:[(0,f.jsx)(Is,{size:15,style:{flexShrink:0}}),(0,f.jsx)(`span`,{children:y})]}),d?(0,f.jsx)(`div`,{style:{padding:`3rem`,textAlign:`center`,color:`#9ca3af`},children:`Loading invoiceâ¦`}):o?(0,f.jsxs)(`div`,{className:`invoice-body`,style:{padding:`2.5rem`,fontFamily:`system-ui, sans-serif`,color:`#111`,fontSize:`0.875rem`,lineHeight:1.6},children:[(0,f.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`flex-start`,marginBottom:`2rem`,flexWrap:`wrap`,gap:`1rem`},children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(p,{style:{height:`2.4rem`,width:`auto`,display:`block`,color:`#343234`,marginBottom:`0.6rem`}}),(0,f.jsxs)(`div`,{style:{color:`#6b7280`,fontSize:`0.8125rem`,lineHeight:1.5},children:[(0,f.jsx)(`div`,{style:{fontWeight:600,color:`#374151`},children:C}),O&&O.split(` 146`).map((e,t)=>(0,f.jsx)(`div`,{children:e},t)),E&&(0,f.jsxs)(`div`,{children:[`ABN `,E]}),D&&(0,f.jsx)(`div`,{children:D}),(0,f.jsx)(`div`,{children:w})]})]}),(0,f.jsxs)(`div`,{style:{textAlign:`right`},children:[(0,f.jsx)(`div`,{style:{fontWeight:800,fontSize:`1.4rem`,color:`#111`,marginBottom:`0.25rem`},children:`INVOICE`}),(0,f.jsxs)(`div`,{style:{color:`#6b7280`,fontSize:`0.8125rem`},children:[(0,f.jsx)(`div`,{children:(0,f.jsx)(`strong`,{style:{color:`#111`},children:_d(o)})}),(0,f.jsxs)(`div`,{children:[`Issued: `,Q(o.date)]}),o.duedate&&(0,f.jsxs)(`div`,{children:[`Due: `,Q(o.duedate)]})]}),(0,f.jsx)(`div`,{style:{marginTop:`0.5rem`,display:`inline-block`,padding:`0.25rem 0.75rem`,borderRadius:20,background:z.bg,color:z.color,border:`1px solid ${z.border}`,fontWeight:700,fontSize:`0.8125rem`},children:o.status})]})]}),(0,f.jsxs)(`div`,{style:{marginBottom:`2rem`},children:[(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,fontWeight:700,color:`#9ca3af`,textTransform:`uppercase`,letterSpacing:`0.08em`,marginBottom:`0.35rem`},children:`Bill To`}),(0,f.jsx)(`div`,{style:{fontWeight:700,fontSize:`0.95rem`},children:t?.companyname||`${t?.firstname||``} ${t?.lastname||``}`.trim()}),t?.companyname&&(0,f.jsxs)(`div`,{style:{color:`#6b7280`},children:[t.firstname,` `,t.lastname]}),t?.address1&&(0,f.jsx)(`div`,{style:{color:`#6b7280`}
146,children:[t.address1,t.city,t.state,t.postcode].filter(Boolean).join(`, `)})]}),(0,f.jsxs)(`table`,{style:{width:`100%`,borderCollapse:`collapse`,marginBottom:`1.5rem`},children:[(0,f.jsx)(`thead`,{children:(0,f.jsxs)(`tr`,{style:{background:`#f9fafb`,borderBottom:`2px solid #e5e7eb`},children:[(0,f.jsx)(`th`,{style:{textAlign:`left`,padding:`0.6rem 0.75rem`,fontWeight:700,color:`#374151`,fontSize:`0.8125rem`,textTransform:`uppercase`,letterSpacing:`0.05em`},children:`Description`}),(0,f.jsx)(`th`,{style:{textAlign:`right`,padding:`0.6rem 0.75rem`,fontWeight:700,color:`#374151`,fontSize:`0.8125rem`,textTransform:`uppercase`,letterSpacing:`0.05em`},children:`Amount`})]})}),(0,f.jsx)(`tbody`,{children:(o.items||[]).length===0?(0,f.jsx)(`tr`,{children:(0,f.jsx)(`td`,{colSpan:2,style:{padding:`1rem 0.75rem`,color:`#9ca3af`,fontStyle:`italic`},children:`No line items`})}):(o.items||[]).map((e,t)=>(0,f.jsxs)(`tr`,{style:{borderBottom:`1px solid #f3f4f6`},children:[(0,f.jsx)(`td`,{style:{padding:`0.65rem 0.75rem`,color:`#111`},children:e.description}),(0,f.jsxs)(`td`,{style:{padding:`0.65rem 0.75rem`,textAlign:`right`,fontWeight:600,color:`#111`},children:[$(e.amount),R&&e.discountable!==!1&&(0,f.jsx)(`span`,{title:`${L}% reseller discount applied`,style:{color:`#059669`,fontWeight:700,marginLeft:2},children:`*`})]})]},t))}),(0,f.jsxs)(`tfoot`,{children:[parseFloat(o.discount||0)>0&&(0,f.jsxs)(`tr`,{children:[(0,f.jsxs)(`td`,{style:{padding:`0.5rem 0.75rem`,textAlign:`right`,color:`#6b7280`,fontSize:`0.82rem`},children:[`Reseller discount`,parseFloat(o.discount_pct)>0?` (${parseFloat(o.discount_pct)}%)`:``]}),(0,f.jsxs)(`td`,{style:{padding:`0.5rem 0.75rem`,textAlign:`right`,color:`#059669`},children:[`â`,$(o.discount)]})]}),o.subtotal&&o.tax>0&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`tr`,{children:[(0,f.jsx)(`td`,{style:{padding:`0.5rem 0.75rem`,textAlign:`right`,color:`#6b7280`,fontSize:`0.82rem`},children:`Subtotal`}),(0,f.jsx)(`td`,{style:{padding:`0.5rem 0.75rem`,textAlign:`right`,color:`#374151`},children:$(o.subtotal)})]}),(0,f.jsxs)(`tr`,{children:[(0,f.jsxs)(`td`,{style:{padding:`0.5rem 0.75rem`,textAlign:`right`,color:`#6b7280`,fontSize:`0.82rem`},children:[`GST (`,o.taxrate||10,`%)`]}),(0,f.jsx)(`td`,{style:{padding:`0.5rem 0.75rem`,textAlign:`right`,color:`#374151`},children:$(o.tax)})]})]}),(0,f.jsxs)(`tr`,{style:{borderTop:`2px solid #e5e7eb`},children:[(0,f.jsx)(`td`,{style:{padding:`0.75rem 0.75rem`,textAlign:`right`,fontWeight:800,fontSize:`1rem`,color:`#111`},children:`Total`}),(0,f.jsx)(`td`,{style:{padding:`0.75rem 0.75rem`,textAlign:`right`,fontWeight:800,fontSize:`1.1rem`,color:P>.005||N>.005?`#111`:`#f97316`},children:$(o.total)})]}),P>.005&&(0,f.jsxs)(`tr`,{children:[(0,f.jsx)(`td`,{style:{padding:`0.5rem 0.75rem`,textAlign:`right`,color:`#6b7280`,fontSize:`0.82rem`},children:`Account credit applied`}),(0,f.jsxs)(`td`,{style:{padding:`0.5rem 0.75rem`,textAlign:`right`,color:`#059669`},children:[`â`,$(P)]})]}),N-P>.005&&(0,f.jsxs)(`tr`,{children:[(0,f.jsx)(`td`,{style:{padding:`0.5rem 0.75rem`,textAlign:`right`,color:`#6b7280`,fontSize:`0.82rem`},children:`Paid`}),(0,f.jsxs)(`td`,{style:{padding:`0.5rem 0.75rem`,textAlign:`right`,color:`#059669`},children:[`â`,$(N-P)]})]}),F>.005&&(0,f.jsxs)(`tr`,{children:[(0,f.jsx)(`td`,{style:{padding:`0.5rem 0.75rem`,textAlign:`right`,color:`#6b7280`,fontSize:`0.82rem`},children:`Refunded`}),(0,f.jsxs)(`td`,{style:{padding:`0.5rem 0.75rem`,textAlign:`right`,color:`#374151`},children:[`+`,$(F)]})]}),(P>.005||N>.005||F>.005)&&(0,f.jsxs)(`tr`,{style:{borderTop:`1px solid #e5e7eb`},children:[(0,f.jsx)(`td`,{style:{padding:`0.75rem 0.75rem`,textAlign:`right`,fontWeight:800,fontSize:`1rem`,color:`#111`},children:`Amount due`}),(0,f.jsx)(`td`,{style:{padding:`0.75rem 0.75rem`,textAlign:`right`,fontWeight:800,fontSize:`1.1rem`,color:M>.005?`#f97316`:`#059669`},children:$(M)})]})]})]}),R&&(0,f.jsxs)(`p`,{style:{margin:`-1rem 0 1.5rem`,fontSize:`0.75rem`,color:`#6b7280`,lineHeight:1.5},children:[(0,f.jsx)(`span`,{style:{color:`#059669`,fontWeight:700},children:`*`}),` `,`The `,L>0?`${L}% `:``,`reseller discount applies to the items marked with an asterisk. Licences and other items billed at cost are charged in full.`]}),o.status!==`Paid`&&(0,f.jsxs)(`div`,{style:{padding:`1rem`,borderRadius:8,background:`#fff7ed`,border:`1px solid #fed7aa`,marginBottom:`1rem`},children:[(0,f.jsx)(`div`,{style:{fontWeight:700,color:`#9a3412`,marginBottom:`0.5rem`,fontSize:`0.82rem`},children:`How to Pay`}),(0,f.jsxs)(`div`,{style:{color:`#7c2d12`,fontSize:`0.8125rem`,lineHeight:1.6},children:[(0,f.jsxs)(`div`,{style:{marginBottom:`0.35rem`},children:[(0,f.jsx)(`strong`,{children:`Pay now by card (no login):`}),(0,f.jsx)(`br`,{}),(0,f.jsx)(`a`,{href:H,style:{color:`#9a3412`,fontWeight:600,wordBreak:`break-all`},children:H})]}),(0,f.jsxs)(`div`,{style:{marginBottom:`0.35rem`},children:[(0,f.jsx)(`strong`,{children:`Log in to pay & manage invoices:`}),(0,f.jsx)(`br`,{}),(0,f.jsx)(`a`,{href:U,style:{color:`#9a3412`,fontWeight:600,wordBreak:`break-all`},children:U})]}),(0,f.jsxs)(`div`,{style:{marginTop:`0.5rem`},children:[`Have a payment method saved? This invoice will be paid automatically from your stored details on the due date`,o.duedate?` (${Q(o.duedate)})`:``,` â no action needed.`]}),(0,f.jsxs)(`div`,{style:{marginTop:`0.5rem`},children:[`Questions? Contact `,(0,f.jsx)(`strong`,{children:T}),` and quote invoice `,(0,f.jsx)(`strong`,{children:_d(o)}),`.`]})]})]}),o.status===`Paid`&&o.datepaid&&(0,f.jsxs)(`div`,{style:{padding:`0.75rem 1rem`,borderRadius:8,background:`#ecfdf5`,border:`1px solid #6ee7b7`,fontSize:`0.8125rem`,color:`#065f46`},children:[`â Paid on `,Q(o.datepaid)]}),(0,f.jsxs)(`div`,{style:{marginTop:`2rem`,paddingTop:`1rem`,borderTop:`1px solid #f3f4f6`,textAlign:`center`,fontSize:`0.8125rem`,color:`#9ca3af`},children:[(0,f.jsx)(`div`,{children:[C,E&&`ABN ${E}
146`,D,w].filter(Boolean).join(` · `)}),(0,f.jsxs)(`div`,{className:`print-only`,style:{marginTop:`0.35rem`},children:[`Printed `,gd(new Date)]})]})]}):(0,f.jsx)(`div`,{style:{padding:`3rem`,textAlign:`center`,color:`#ef4444`},children:`Failed to load invoice.`})]})]}),document.body)}function dp({client:e,setTab:t,onInvoicesChanged:n,focusInvoiceId:r=null,onFocusInvoiceHandled:i}){let[a,o]=(0,l.useState)([]),[s,c]=(0,l.useState)(!0),[u,d]=(0,l.useState)(()=>Ch(`portal:billing:filter`,`All`)),[p,m]=(0,l.useState)(``),[h,g]=(0,l.useState)(`date`),[_,v]=(0,l.useState)(`desc`),[y,b]=(0,l.useState)(null),[x,S]=(0,l.useState)(1),[C,w]=(0,l.useState)(25),[T,E]=(0,l.useState)(void 0),[D,O]=(0,l.useState)(!1),[k,A]=(0,l.useState)(!1),[j,M]=(0,l.useState)(null),[N,P]=(0,l.useState)(!1);(0,l.useEffect)(()=>{wh(`portal:billing:filter`,u)},[u]),(0,l.useEffect)(()=>{S(1)},[u,p,h,_]),(0,l.useEffect)(()=>{r&&(b(r),i?.())},[r]),(0,l.useEffect)(()=>{Z(`/api/portal/invoices?all=1`).then(e=>{o(e.invoices||[]),c(!1)}),Z(`/api/portal/payment-methods`).then(e=>{let t=e.methods||[];E(t.find(e=>e.is_default)||t[0]||null)})},[]);async function F(){O(!1),A(!0),M(null);let e=await Z(`/api/portal/invoices/pay-all`,{method:`POST`});if(A(!1),e.ok){let t=e.results||[];if(e.succeeded===0&&t.length&&t.every(e=>e.error_code===`no_gateway_token`)){P(!0);return}M(e),Z(`/api/portal/invoices?all=1`).then(e=>o(e.invoices||[])),n?.()}else M({ok:!1,error:e.error})}function I(e){h===e?v(e=>e===`asc`?`desc`:`asc`):(g(e),v(`asc`))}let L=a.filter(e=>u===`All`||e.status===u).filter(e=>vd(e,p)).sort((e,t)=>{let n,r;return h===`id`?(n=e.id,r=t.id):h===`date`?(n=e.date||``,r=t.date||``):h===`duedate`?(n=e.duedate||``,r=t.duedate||``):h===`status`?(n=e.status||``,r=t.status||``):h===`total`&&(n=parseFloat(e.total)||0,r=parseFloat(t.total)||0),n<r?_===`asc`?-1:1:n>r?_===`asc`?1:-1:0}),R=L.slice((x-1)*C,x*C);function z({col:e}){return h===e?_===`asc`?(0,f.jsx)(rc,{size:12,className:`text-accent ml-1 inline-block`}):(0,f.jsx)(ec,{size:12,className:`text-accent ml-1 inline-block`}):(0,f.jsx)(ic,{size:12,className:`text-faint ml-1 inline-block`})}function B({col:e,label:t,className:n=``}){return(0,f.jsxs)(`button`,{onClick:()=>I(e),className:`flex items-center gap-0.5 text-xs font-semibold uppercase tracking-wide transition-colors hover:text-primary ${h===e?`text-primary`:`text-muted`} ${n}`,children:[t,(0,f.jsx)(z,{col:e})]})}let V=[`All`,`Unpaid`,`Paid`,`Overdue`],H=a.filter(e=>e.status===`Unpaid`||e.status===`Overdue`),U=H.reduce((e,t)=>e+Sd(t),0);return(0,f.jsxs)(`div`,{className:`p-4 md:p-6 pb-16 max-w-4xl mx-auto`,children:[y&&(0,f.jsx)(up,{invoiceId:y,client:e,onClose:()=>b(null),defaultMethod:T,onManagePaymentMethods:()=>t?.(`account`,`payment`),onPaid:()=>{Z(`/api/portal/invoices?all=1`).then(e=>o(e.invoices||[])),n?.()}}),N&&(0,f.jsx)(lp,{method:T,onClose:()=>P(!1),onGoToPaymentMethods:()=>{P(!1),t?.(`account`,`payment`)}}),D&&(0,f.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center p-4`,style:{background:`rgba(0,0,0,0.55)`},onClick:e=>{e.target===e.currentTarget&&O(!1)},children:(0,f.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface shadow-xl w-full max-w-sm p-6 space-y-4`,children:[(0,f.jsx)(`h3`,{className:`text-base font-bold text-primary`,children:`Pay All Invoices`}),(0,f.jsxs)(`p`,{className:`text-sm text-secondary`,children:[`This will charge `,(0,f.jsxs)(`strong`,{children:[`$`,U.toFixed(2)]}),` across`,` `,(0,f.jsx)(`strong`,{children:H.length}),` unpaid invoice`,H.length===1?``:`s`,` using your default payment method.`]}),(0,f.jsxs)(`div`,{className:`flex gap-2 justify-end pt-1`,children:[(0,f.jsx)(`button`,{className:`btn-secondary`,onClick:()=>O(!1),children:`Cancel`}),(0,f.jsx)(`button`,{className:`btn-success`,onClick:F,children:`Confirm Payment`})]})]})}),j&&(0,f.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center p-4`,style:{background:`rgba(0,0,0,0.55)`},onClick:e=>{e.target===e.currentTarget&&M(null)},children:(0,f.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface shadow-xl w-full max-w-sm p-6 space-y-4`,children:[j.ok===!1?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(Rs,{size:20,style:{color:`#ef4444`}}),(0,f.jsx)(`h3`,{className:`text-base font-bold text-primary`,children:`Payment Failed`})]}),(0,f.jsx)(`p`,{className:`text-sm text-secondary`,children:j.error||`An error occurred.`})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[j.failed===0?(0,f.jsx)(Is,{size:20,style:{color:`#22c55e`}}):(0,f.jsx)(Y,{size:20,style:{color:`#f59e0b`}}),(0,f.jsx)(`h3`,{className:`text-base font-bold text-primary`,children:j.failed===0?`All Payments Successful`:`Payments Processed`})]}),(0,f.jsx)(`div`,{className:`space-y-1`,children:j.results.map(e=>(0,f.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[e.ok?(0,f.jsx)(Is,{size:14,style:{color:`#22c55e`,flexShrink:0}}):(0,f.jsx)(Rs,{size:14,style:{color:`#ef4444`,flexShrink:0}}),(0,f.jsxs)(`span`,{className:`text-secondary`,children:[`Invoice `,_d({invoicenum:e.invoicenum,id:e.invoice_id})]}),e.ok?(0,f.jsxs)(`span`,{className:`ml-auto text-muted text-xs`,children:[`$`,parseFloat(e.amount).toFixed(2)]}):(0,f.jsx)(`span`,{className:`ml-auto text-xs`,style:{color:`#ef4444`},children:e.error})]},e.invoicenum||e.invoice_id))}),j.failed>0&&(0,f.jsxs)(`p`,{className:`text-xs text-muted`,children:[j.succeeded,` succeeded, `,j.failed,` failed.`]})]}),(0,f.jsx)(`div`,{className:`flex justify-end pt-1`,children:(0,f.jsx)(`button`,{className:`btn-primary`,onClick:()=>M(null),children:`Done`})})]})}),(0,f.jsxs)(`h1`,{className:`text-2xl font-bold text-primary mb-5 flex items-center gap-2.5`,children:[(0,f.jsx)(fc,{size:22,className:`text-faint shrink-0`}),`Billing`]}),(0,f.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface flex items-center gap-3 px-4 py-3 mb-5`,children:[(0,f.jsx)(`div`,{className:`flex items-center justify-center w-9 h-9 rounded-lg shrink-0`,style:{background:`color-mix(in srgb, var(--accent) 10%, transparent)`,border:`1px solid color-mix(in srgb, var(--accent) 20%, transparent)`},children:(0,f.jsx)(sc,{size:16,style:{color:`var(--accent)`}})}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsx)(`p`,{className:`text-xs font-semibold text-muted mb-0.5`,children:`Payment method`}),T===void 0?(0,f.jsx)(`p`,{className:`text-sm text-faint`,children:`Loadingâ¦`}):T?(0,f.jsxs)(`p`,{className:`text-sm font-semibold text-primary`,children:[T.method_type===`paypal`?(0,f.jsxs)(f.Fragment,{children:[`PayPal`,T.agreement_id&&(0,f.jsx)(`span`,{className:`text-xs font-normal text-muted ml-2 font-mono`,children:T.agreement_id})]}):(0,f.jsxs)(f.Fragment,{children:[T.brand,` â¢â¢â¢â¢ `,T.last4,(0,f.jsxs)(`span`,{className:`text-xs font-normal text-muted ml-2`,children:[`Exp `,String(T.expiry_month).padStart(2,`0`),`/`,String(T.expiry_year).slice(-2)]})]}),T.is_default&&(0,f.jsx)(`span`,{className:`ml-2 text-[11px] font-semibold px-1.5 py-0.5 rounded-full`,style:{background:`color-mix(in srgb, var(--accent) 12%, transparent)`,color:`var(--accent)`},children:`Default`})]}):(0,f.jsx)(`p`,{className:`text-sm text-faint`,children:`No payment method saved`})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,f.jsx)(`button`,{onClick:()=>t?.(`account`,`payment`),className:`text-xs font-semibold px-3 py-1.5 rounded-lg transition-colors`,style:{background:`var(--bg-elevated)`,border:`1px solid var(--border)`,color:`var(--text-muted)`},children:T?`Manage`:`+ Add`}),T&&a.some(e=>e.status===`Unpaid`||e.status===`Overdue`)&&(0,f.jsxs)(`button`,{className:`btn-success`,onClick:()=>O(!0),disabled:k,children:[k?(0,f.jsx)(X,{size:12,className:`animate-spin`}):null,`Pay All Invoices`]})]})]}),(0,f.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 mb-4`,children:[(0,f.jsx)(`div`,{className:`flex gap-1.5 flex-wrap`,children:V.map(e=>(0,f.jsx)(`button`,{onClick:()=>d(e),className:`px-3 py-1 rounded-full text-xs font-semibold border transition-colors`,style:{background:u===e?`color-mix(in srgb, var(--accent) 12%, transparent)`:`var(--bg-elevated)`,borderColor:u===e?`var(--accent)`:`var(--border)`,color:u===e?`var(--accent)`:`var(--text-muted)`},children:e},e))}),(0,f.jsxs)(`div`,{className:`relative ml-auto`,children:[(0,f.jsx)(qc,{size:14,className:`absolute left-2.5 top-1/2 -translate-y-1/2 text-faint pointer-events-none`}),(0,f.jsx)(`input`,{value:p,onChange:e=>m(e.target.value),placeholder:`Search invoice # or item`,className:`pl-8 pr-3 py-1.5 rounded-lg text-sm bg-elevated border border-edge text-primary placeholder:text-faint focus:outline-none focus:border-accent`,style:{width:210}})]})]}),s?(0,f.jsx)(`p`,{className:`text-sm text-muted py-8 text-center`,children:`Loadingâ¦`}):L.length===0?(0,f.jsx)(`p`,{className:`text-sm text-muted text-center py-12`,children:p.trim()?`No invoices match â${p.trim()}â.`:`No invoices found.`}):(0,f.jsxs)(`div`,{className:`rounded-xl border border-edge overflow-hidden bg-surface`,children:[(0,f.jsxs)(`div`,{className:`hidden sm:grid grid-cols-[2fr_1fr_1fr_1fr_8rem] gap-4 px-4 py-2.5 border-b border-edge bg-elevated`,children:[(0,f.jsx)(B,{col:`id`,label:`Invoice`}),(0,f.jsx)(B,{col:`date`,label:`Issued`}),(0,f.jsx)(B,{col:`duedate`,label:`Due`}),(0,f.jsx)(`div`,{style:{display:`flex`,justifyContent:`center`},children:(0,f.jsx)(B,{col:`status`,label:`Status`})}),(0,f.jsx)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,paddingRight:`1.5rem`},children:(0,f.jsx)(B,{col:`total`,label:`Amount`})})]}),R.map((e,t)=>(0,f.jsxs)(`button`,{onClick:()=>b(e.id),className:`w-full text-left transition-colors hover:bg-[var(--bg-hover)]`,style:{borderBottom:t<R.length-1?`1px solid var(--border)`:`none`},children:[(0,f.jsxs)(`div`,{className:`hidden sm:grid grid-cols-[2fr_1fr_1fr_1fr_8rem] gap-4 items-center px-4 py-3.5`,children:[(0,f.jsxs)(`span`,{className:`font-semibold text-sm text-primary`,children:[`Invoice `,_d(e)]}),(0,f.jsx)(`span`,{className:`text-sm text-muted`,style:{textAlign:`left`},children:Q(e.date)}),(0,f.jsx)(`span`,{className:`text-sm text-muted`,style:{textAlign:`left`},children:e.duedate?Q(e.duedate):`â`}),(0,f.jsx)(`span`,{style:{display:`flex`,justifyContent:`center`},children:(0,f.jsx)(kd,{status:e.status})}),(0,f.jsxs)(`div`,{className:`flex items-center gap-3 justify-end`,children:[(0,f.jsxs)(`div`,{style:{textAlign:`right`},children:[(0,f.jsx)(`span`,{className:`font-bold text-sm text-primary`,children:$(e.total)}),Cd(e)&&(0,f.jsxs)(`div`,{className:`text-xs text-muted mt-0.5`,children:[$(Sd(e)),` due`]})]}),(0,f.jsx)(nc,{size:14,className:`text-faint`})]})]}),(0,f.jsxs)(`div`,{className:`sm:hidden flex items-center justify-between gap-3 px-4 py-3.5`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`div`,{className:`font-semibold text-sm text-primary`,children:[`Invoice `,_d(e)]}),(0,f.jsxs)(`div`,{className:`text-xs text-muted mt-0.5`,children:[Q(e.date),e.duedate?` · Due ${Q(e.duedate)}`:``]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,f.jsx)(kd,{status:e.status}),(0,f.jsxs)(`div`,{style:{textAlign:`right`},children:[(0,f.jsx)(`span`,{className:`font-bold text-sm text-primary`,children:$(e.total)}),Cd(e)&&(0,f.jsxs)(`div`,{className:`text-xs text-muted mt-0.5`,children:[$(Sd(e)),` due`]})]}),(0,f.jsx)(nc,{size:14,className:`text-faint`})]})]})]},e.id)),(0,f.jsx)(Md,{total:L.length,page:x,pageSize:C,onPage:S,onPageSize:w})]})]})}function fp({option:e,quote:t,selectable:n,selected:r,onSelect:i}){let a=e.totals||{};return(0,f.jsxs)(`div`,{onClick:n?i:void 0,className:`rounded-xl border p-4 transition-colors ${n?`cursor-pointer`:``}`,style:{borderColor:r?`var(--accent)`:`var(--border)`,background:r?`var(--bg-active)`:`var(--bg-surface)`},children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2.5 mb-3`,children:[n&&(0,f.jsx)(`span`,{className:`w-4 h-4 rounded border-2 shrink-0 flex items-center justify-center transition-colors`,style:{borderColor:r?`var(--accent)`:`var(--border)`,background:r?`var(--accent)`:`transparent`},children:r&&(0,f.jsx)($s,{size:11,strokeWidth:3,style:{color:`var(--bg-base)`}})}),(0,f.jsx)(`p`,{className:`text-sm font-semibold text-primary flex-1`,children:e.heading}),(0,f.jsx)(`p`,{className:`text-sm font-bold text-primary`,children:$(a.total)})]}),(0,f.jsx)(`div`,{className:`space-y-2`,children:(e.items||[]).map(e=>(0,f.jsxs)(`div`,{className:`flex items-start gap-3 text-xs`,children:[(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsx)(`p`,{className:`text-secondary`,children:e.description}),(e.show_cycle||!e.taxed)&&(0,f.jsx)(`p`,{className:`text-[11px] text-faint mt-0.5`,children:[e.show_cycle?e.billing_cycle:null,!e.taxed&&!e.fee_waived?`tax-free`:null].filter(
146Boolean).join(` · `)}),e.fee_waived&&(0,f.jsxs)(`p`,{className:`text-[11px] font-semibold mt-0.5`,style:{color:`var(--success, #22c55e)`},children:[`Fee waived â normally `,$(e.rrp),`, included at no charge`]})]}),(0,f.jsxs)(`span`,{className:`text-faint shrink-0`,children:[`Ã`,Number(e.qty)]}),(0,f.jsx)(`span`,{className:`w-20 text-right shrink-0`,children:e.fee_waived?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`span`,{className:`text-faint line-through mr-1`,children:$(e.rrp)}),(0,f.jsx)(`span`,{style:{color:`var(--success, #22c55e)`},children:$(0)})]}):(0,f.jsx)(`span`,{className:`text-secondary`,children:$(e.line_total)})})]},e.id))}),(0,f.jsxs)(`div`,{className:`mt-3 pt-3 border-t space-y-1`,style:{borderColor:`var(--border)`},children:[Number(a.tax)>0&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`div`,{className:`flex justify-between text-xs text-muted`,children:[(0,f.jsx)(`span`,{children:`Subtotal`}),(0,f.jsx)(`span`,{children:$(a.subtotal)})]}),(0,f.jsxs)(`div`,{className:`flex justify-between text-xs text-muted`,children:[(0,f.jsxs)(`span`,{children:[t.tax_label||`GST`,` (`,Number(t.tax_rate).toFixed(2),`%)`]}),(0,f.jsx)(`span`,{children:$(a.tax)})]})]}),(0,f.jsxs)(`div`,{className:`flex justify-between text-sm font-bold text-primary`,children:[(0,f.jsx)(`span`,{children:`Total`}),(0,f.jsx)(`span`,{children:$(a.total)})]}),Number(a.waived)>0&&(0,f.jsxs)(`p`,{className:`text-[11px] font-semibold text-right`,style:{color:`var(--success, #22c55e)`},children:[`Fees waived on this quote: `,$(a.waived),` â not charged.`]})]})]})}function pp({quote:e,canAct:t,onDecided:n}){let r=e.options||[],i=e.quote_type===`options`&&r.length>1,[a,o]=(0,l.useState)(()=>i||r[0]?.id==null?[]:[r[0].id]),[s,c]=(0,l.useState)(!1),[u,d]=(0,l.useState)(null),[p,m]=(0,l.useState)(!1),[h,g]=(0,l.useState)(``),_=e.number||`Q-${String(e.id).padStart(4,`0`)}`,v=r.filter(e=>a.includes(e.id)),y=v.reduce((e,t)=>e+Number(t.totals?.total||0),0);function b(e){o(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])}async function x(t){c(!0),d(null);let r=t===`accept`?{option_ids:a}:{reason:h},i=await Z(`/api/portal/quotes/${e.id}/${t}`,{method:`POST`,body:JSON.stringify(r)}).catch(()=>({ok:!1,error:`Network error â please try again.`}));if(c(!1),!i.ok){d(i.error||`Something went wrong.`);return}n(i.quote)}let S=e.accepted_option_ids?.length?e.accepted_option_ids:e.accepted_option_id?[e.accepted_option_id]:[],C=r.filter(e=>S.includes(e.id));return(0,f.jsxs)(`div`,{className:`card p-5 space-y-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-start gap-3 flex-wrap`,children:[(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsx)(`p`,{className:`text-base font-semibold text-primary`,children:_}),(0,f.jsxs)(`p`,{className:`text-xs text-muted mt-0.5`,children:[e.is_open&&e.valid_until?`Valid until ${Q(e.valid_until)}`:`Dated ${Q(e.created_at)}`,e.status===`Accepted`&&e.accepted_at?` · Accepted ${Q(e.accepted_at)}`:``,e.status===`Declined`&&e.declined_at?` · Declined ${Q(e.declined_at)}`:``]})]}),(0,f.jsx)(kd,{status:e.expired&&e.status===`Sent`?`Expired`:e.status}),(0,f.jsxs)(`a`,{href:yl(e.public_id),target:`_blank`,rel:`noreferrer`,className:`btn-secondary text-xs flex items-center gap-1.5`,children:[(0,f.jsx)(cc,{size:13}),` PDF`]})]}),e.notes&&(0,f.jsx)(`p`,{className:`text-xs text-muted whitespace-pre-line`,children:e.notes}),C.length>0&&(0,f.jsxs)(`p`,{className:`text-xs`,style:{color:`var(--success, #22c55e)`},children:[`You accepted `,(0,f.jsx)(`strong`,{children:C.map(e=>e.heading).join(` + `)}),C.length>1&&(0,f.jsxs)(f.Fragment,{children:[` â `,$(C.reduce((e,t)=>e+Number(t.totals?.total||0),0)),` in total`]}),`.`]}),e.status===`Declined`&&e.decline_reason&&(0,f.jsxs)(`p`,{className:`text-xs text-muted`,children:[`You declined this quote â â`,e.decline_reason,`â`]}),i&&e.is_open&&(0,f.jsx)(`p`,{className:`text-xs text-muted`,children:`Tick everything you'd like to go ahead with â you can take more than one.`}),(0,f.jsx)(`div`,{className:`space-y-3`,children:r.map(n=>(0,f.jsx)(fp,{option:n,quote:e,selectable:i&&e.is_open&&t,selected:i&&e.is_open?a.includes(n.id
146):S.includes(n.id),onSelect:()=>b(n.id)},n.id))}),i&&e.is_open&&t&&v.length>1&&(0,f.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-2.5 rounded-xl border`,style:{borderColor:`var(--accent)`,background:`var(--bg-active)`},children:[(0,f.jsxs)(`span`,{className:`text-xs text-secondary`,children:[v.length,` options selected`]}),(0,f.jsx)(`span`,{className:`text-sm font-bold text-primary`,children:$(y)})]}),u&&(0,f.jsx)(`p`,{className:`text-xs text-red-400`,children:u}),e.expired&&e.status===`Sent`&&(0,f.jsxs)(`p`,{className:`text-xs text-amber-500`,children:[`This quote expired on `,Q(e.valid_until),` â get in touch and we'll send you an updated one.`]}),e.status===`Sent`&&(p?(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsxs)(`label`,{className:`block text-xs text-muted`,children:[`Let us know why, if you'd like to (optional)`,(0,f.jsx)(`textarea`,{value:h,onChange:e=>g(e.target.value),rows:3,maxLength:2e3,className:`mt-1 w-full rounded-lg px-3 py-2 text-xs bg-elevated border border-edge text-primary outline-none focus:border-[var(--accent)]`})]}),(0,f.jsxs)(`div`,{className:`flex gap-2`,children:[(0,f.jsx)(`button`,{onClick:()=>x(`decline`),disabled:s,className:`btn-secondary text-xs`,children:s?`Sendingâ¦`:`Confirm decline`}),(0,f.jsx)(`button`,{onClick:()=>{m(!1),g(``)},disabled:s,className:`btn-secondary text-xs`,children:`Cancel`})]})]}):(0,f.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[!e.expired&&(0,f.jsx)(`button`,{onClick:()=>x(`accept`),disabled:s||!t||!a.length,className:`btn-primary text-xs disabled:opacity-40 disabled:cursor-not-allowed`,children:s?`Sendingâ¦`:i?v.length===0?`Tick an option to accept`:v.length===1?`Accept ${v[0].heading} â ${$(y)}`:`Accept ${v.length} options â ${$(y)}`:`Accept quote â ${$(r[0]?.totals?.total)}`}),(0,f.jsx)(`button`,{onClick:()=>m(!0),disabled:s||!t,className:`btn-secondary text-xs disabled:opacity-40`,children:`Decline`}),!t&&(0,f.jsx)(`p`,{className:`text-xs text-faint`,children:`Only Billing users and the account owner can accept or decline a quote. You can still read it and download the PDF.`})]}))]})}function mp({caps:e={},onQuotesChanged:t}){let[n,r]=(0,l.useState)([]),[i,a]=(0,l.useState)(!0),[o,s]=(0,l.useState)(!1);(0,l.useEffect)(()=>{Z(`/api/portal/quotes`).then(e=>{e.ok&&r(e.quotes||[])}).catch(()=>{}).finally(()=>a(!1))},[]);let c=e.paymentEditReal!==!1&&!e.readOnly;function u(e){r(t=>t.map(t=>t.id===e.id?{...t,...e,is_open:!1,options:t.options}:t)),t?.()}let d=n.filter(e=>e.is_open),p=n.filter(e=>!e.is_open);return(0,f.jsxs)(`div`,{className:`max-w-4xl mx-auto px-4 py-6 space-y-6`,children:[(0,f.jsxs)(`h1`,{className:`text-2xl font-bold text-primary mb-1 flex items-center gap-2.5`,children:[(0,f.jsx)(Vs,{size:22,className:`text-faint shrink-0`}),`Quotes`]}),i?(0,f.jsx)(`div`,{className:`flex justify-center py-16`,children:(0,f.jsx)(X,{size:20,className:`animate-spin text-faint`})}):n.length===0?(0,f.jsxs)(`div`,{className:`card p-8 text-center`,children:[(0,f.jsx)(`p`,{className:`text-sm text-muted`,children:`You don't have any quotes at the moment.`}),(0,f.jsx)(`p`,{className:`text-xs text-faint mt-1`,children:`When we send you one it'll appear here.`})]}):(0,f.jsxs)(f.Fragment,{children:[d.length>0&&(0,f.jsxs)(`div`,{className:`space-y-3`,children:[(0,f.jsx)(`p`,{className:`section-label`,children:`Awaiting your response`}),d.map(e=>(0,f.jsx)(pp,{quote:e,canAct:c,onDecided:u},e.id))]}),d.length===0&&p.length>0&&(0,f.jsx)(`p`,{className:`text-sm text-muted`,children:`Nothing needs your attention right now.`}),p.length>0&&(0,f.jsxs)(`div`,{className:`space-y-3`,children:[(0,f.jsxs)(`button`,{onClick:()=>s(e=>!e),className:`flex items-center gap-1.5 section-label hover:text-primary transition-colors`,children:[o?(0,f.jsx)(ec,{size:13}):(0,f.jsx)(nc,{size:13}),`Past quotes (`,p.length,`)`]}),o&&p.map(e=>(0,f.jsx)(pp,{quote:e,canAct:c,onDecided:u},e.id))]})]})]})}var hp={supported:[`Hosting, server and website availability`,`Email hosting and mail delivery issues`,`Domain registration, transfers and DNS changes`,`SSL certificates and security configuration`,`Billing, invoices and account enquiries`,`New services, upgrades and cancellations`,`Website migrations and deployments`,`Technical advice relating to your Network Dynamics services`,`Website maintenance, development and optimisation (where included in your service or quoted separately)`],billable:[`Website design or redesign`,`New features or custom development`,`C
146ontent updates and data entry`,`SEO, digital marketing or advertising`,`Malware removal on unmanaged websites`,`Third-party software troubleshooting not related to our hosting platform`,`Advanced consulting or custom engineering work`]},gp=`.gif,.png,.jpg,.jpeg,.pdf,.doc,.docx`,_p=new Set([`.gif`,`.png`,`.jpg`,`.jpeg`,`.pdf`,`.doc`,`.docx`]),vp={Open:{label:`Open`,dot:`#60a5fa`},Answered:{label:`Answered`,dot:`#4ade80`},"Customer-Reply":{label:`Awaiting reply`,dot:`#fbbf24`},"On Hold":{label:`On hold`,dot:`#a78bfa`},Closed:{label:`Closed`,dot:`var(--text-faint)`}};function yp({files:e,onChange:t}){let n=(0,l.useRef)(null);function r(e){let n=Array.from(e.target.files||[]).filter(e=>{let t=`.`+e.name.split(`.`).pop().toLowerCase();return _p.has(t)});t(e=>{let t=new Set(e.map(e=>e.name+e.size));return[...e,...n.filter(e=>!t.has(e.name+e.size))]}),e.target.value=``}function i(e){t(t=>t.filter((t,n)=>n!==e))}function a(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}return(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsxs)(`label`,{className:`block text-xs font-medium text-muted`,children:[`Attachments `,(0,f.jsx)(`span`,{className:`font-normal opacity-60`,children:`(gif, png, jpg, pdf, doc/docx · max 10 MB each)`})]}),(0,f.jsxs)(`button`,{className:`btn-secondary`,type:`button`,onClick:()=>n.current?.click(),children:[(0,f.jsx)(Lc,{size:11}),` Attach`]}),(0,f.jsx)(`input`,{ref:n,type:`file`,multiple:!0,hidden:!0,accept:gp,onChange:r})]}),e.length>0&&(0,f.jsx)(`ul`,{className:`space-y-1`,children:e.map((e,t)=>(0,f.jsxs)(`li`,{className:`flex items-center gap-2 px-3 py-2 rounded-lg text-xs bg-elevated border border-edge`,children:[(0,f.jsx)(Lc,{size:12,style:{color:`var(--text-muted)`,flexShrink:0}}),(0,f.jsx)(`span`,{className:`flex-1 truncate text-white`,children:e.name}),(0,f.jsx)(`span`,{style:{color:`var(--text-muted)`,flexShrink:0},children:a(e.size)}),(0,f.jsx)(`button`,{type:`button`,onClick:()=>i(t),className:`hover:text-red-400 transition-colors flex-shrink-0 text-muted`,children:(0,f.jsx)(pl,{size:12})})]},t))})]})}function bp({onStart:e,onClose:t}){return(0,f.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-end sm:items-center justify-center p-4`,style:{background:`rgba(0,0,0,0.5)`},children:(0,f.jsxs)(`div`,{className:`w-full max-w-2xl rounded-2xl border border-edge bg-surface shadow-2xl overflow-hidden flex flex-col`,style:{maxHeight:`90vh`},children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between px-5 py-4 border-b border-edge shrink-0`,children:[(0,f.jsx)(`h2`,{className:`text-base font-bold text-primary`,children:`Before you open a ticket`}),(0,f.jsx)(`button`,{onClick:t,className:`w-7 h-7 flex items-center justify-center rounded-lg text-muted hover:bg-elevated transition-colors`,children:(0,f.jsx)(pl,{size:15})})]}),(0,f.jsxs)(`div`,{className:`overflow-y-auto p-5 space-y-5`,children:[(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-wide text-faint`,children:`Help us resolve your request faster`}),(0,f.jsx)(`ul`,{className:`space-y-2`,children:[`Choose the department that best matches your request.`,`Tell us what's happening, including any error messages and what you've already tried.`,`Include affected services, such as domain names, hosting accounts, email addresses or server names.`,`Attach screenshots or files if they help explain the issue.`].map((e,t)=>(0,f.jsxs)(`li`,{className:`flex items-start gap-2.5 text-sm text-muted`,children:[(0,f.jsx)(`span`,{className:`w-5 h-5 rounded-full flex-shrink-0 flex items-center justify-center text-[10px] font-bold mt-0.5`,style:{background:`color-mix(in srgb, var(--accent) 12%, transparent)`,color:`var(--accent)`},children:t+1}),e]},t))})]}),(0,f.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:[(0,f.jsxs)(`div`,{className:`rounded-xl p-3 space-y-1.5`,style:{background:`rgba(74,222,128,0.06)`,border:`1px solid rgba(74,222,128,0.18)`},children:[(0,f.jsx)(`p`,{className:`text-xs font-semibold`,style:{color:`#4ade80`},children:`â We can help with`}),(0,f.jsx)(`ul`,{className:`space-y-1`,children:hp.supported.map((e,t)=>(0,f.jsxs)(`li`,{className:`flex items-start gap-1.5 text-xs text-muted leading-snug`,children:[(0,f.jsx)(`span`,{className:`mt-[3px] shrink-0 w-1 h-1 rounded-full`,style:{background:`#4ade80`}}),e]},t))})]}),(0,f.jsxs)(`div`,{className:`rounded-xl p-3 space-y-1.5`,style:{background:`rgba(251,191,36,0.06)`,border:`1px solid rgba(251,191,36,0.18)`},children:[(0,f.jsx)(`p`,{className:`text-xs font-semibold`,style:{color:`#fbbf24`},children:`â¹ Some requests may be billable`}),(0,f.jsx)(`p`,{className:`text-xs text-muted leading-snug`,children:`Some work falls outside standard hosting support and may require a professional services quote, including:`}),(0,f.jsx)(`ul`,{className:`space-y-1`,children:hp.billable.map((e,t)=>(0,f.jsxs)(`li`,{className:`flex items-start gap-1.5 text-xs text-muted leading-snug`,children:[(0,f.jsx)(`span`,{className:`mt-[3px] shrink-0 w-1 h-1 rounded-full`,style:{background:`#fbbf24`}}),e]},t))})]})]})]}),(0,f.jsxs)(`div`,{className:`px-5 py-4 border-t border-edge shrink-0 flex justify-end gap-2`,children:[(0,f.jsx)(`button`,{onClick:t,className:`btn-secondary text-sm`,children:`Cancel`}),(0,f.jsx)(`button`,{onClick:e,className:`btn-primary text-sm`,children:`Start ticket`})]})]})})}function xp({services:e,value:t,onChange:n}){let[r,i]=(0,l.useState)(``),[a,o]=(0,l.useState)(!1),s=(0,l.useRef)(null),c=(e||[]).filter(e=>{if(!r)return!0;let t=r.toLowerCase();return e.name.toLowerCase().includes(t)||(e.domain||``).toLowerCase().includes(t)});function u(e){n(e),i(e?e.domain?`${e.name} â ${e.domain}`:e.name:``),o(!1)}return(0,l.useEffect)(()=>{function e(e){s.current&&!s.current.contains(e.target)&&o(!1)}return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[]),(0,f.jsxs)(`div`,{ref:s,className:`relative flex-1`,children:[(0,f.jsxs)(`div`,{className:`flex items-center rounded-lg border border-edge bg-elevated focus-within:border-accent transition-colors`,children:[(0,f.jsx)(`input`,{value:r,onChange:e=>{i(e.target.value),o(!0),e.target.value||n(null)},onFocus:()=>o(!0),placeholder:`Search servicesâ¦`,className:`flex-1 px-2.5 py-1.5 text-sm bg-transparent text-primary placeholder-faint outline-none rounded-lg`}),t&&(0,f.jsx)(`button`,{onClick:()=>u(null),className:`px-2 text-faint hover:text-primary transition-colors`,children:(0,f.jsx)(pl,{size:12})})]}),a&&c.length>0&&(0,f.jsx)(`div`,{className:`absolute z-50 mt-1 w-full rounded-lg border border-edge bg-surface shadow-lg overflow-hidden max-h-48 overflow-y-auto`,children:c.map(e=>(0,f.jsxs)(`button`,{onMouseDown:()=>u(e),className:`w-full text-left px-3 py-2 text-sm hover:bg-elevated transition-colors flex items-center gap-2 ${t?.id===e.id?`bg-elevated`:``}`,children:[(0,f.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full shrink-0 ${e.status===`Active`?`bg-emerald-400`:e.status===`Trial`?`bg-violet-400`:`bg-white/20`}`}),(0,f.jsx)(`span`,{className:`truncate text-primary`,children:e.name}),e.domain&&(0,f.jsx)(`span`,{className:`text-xs text-faint truncate`,children:e.domain}),e.status!==`Active`&&(0,f.jsx)(`span`,{className:`text-[10px] text-faint ml-auto shrink-0`,children:e.status})]},e.id))})]})}function Sp({value:e=[],onChange:t}){let[n,r]=(0,l.useState)([]),[i,a]=(0,l.useState)(!1),[o,s]=(0,l.useState)(``),[c,u]=(0,l.useState)(``);(0,l.useEffect)(()=>{Z(`/api/portal/users`).then(e=>r((e.users||[]).filter(e=>!e.isSelf).map(e=>({name:e.name,email:String(e.email||``).toLowerCase()})).filter(e=>e.email))).catch(()=>{})},[]);let d=new Set(e.map(e=>e.toLowerCase()));function p(n){let r=String(n||``).trim().toLowerCase();if(r){if(!/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(r)){u(`Enter a valid email address`);return}d.has(r)||t([...e,r]),s(``),u(``),a(!1)}}function m(n){t(e.filter(e=>e.toLowerCase()!==n.toLowerCase()))}let h=e=>n.find(t=>t.email===e.toLowerCase())?.name||null,g=n.filter(e=>!d.has(e.email));return(0,f.jsxs)(`div`,{className:`w-full flex flex-wrap items-center gap-1.5`,children:[e.length===0&&!i&&(0,f.jsx)(`span`,{className:`text-xs text-faint`,children:`No one copied`}),e.map(e=>(0,f.jsxs)(`span`,{title:e,className:`inline-flex items-center gap-1 pl-2 pr-1 py-0.5 rounded-full text-xs`,style:{background:`var(--bg-elevated)`,border:`1px solid var(--border)`,color:`var(--text-primary)`},children:[h(e)||e,(0,f.jsx)(`button`,{type:`button`,onClick:()=>m(e),title:`Remove ${e}`,className:`w-4 h-4 flex items-center justify-center rounded-full text-faint hover:text-rose-400 transition-colors`,children:(0,f.jsx)(pl,{size:10})})]},e)),i?(0,f.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,f.jsx)(`input`,{autoFocus:!0,value:o,type:`email`,onChange:e=>{s(e.target.value),u(``)},onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),p(o)):e.key===`Escape`&&(a(!1),s(``),u(``))},onBlur:()=>{o.trim()||(a(!1),u(``))},placeholder:`[email protected]`,className:`w-44 text-xs rounded-full px-2.5 py-1 bg-elevated border border-edge text-primary focus:outline-none focus:border-accent`}),(0,f.jsx)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:()=>p(o),disabled:!o.trim(),title:`Add`,className:`w-5 h-5 flex items-center justify-center rounded-full disabled:opacity-30 transition-colors`,style:{background:`var(--accent)`,color:`#fff`},children:(0,f.jsx)(Vc,{size:11})})]}):(0,f.jsxs)(`button`,{type:`button`,onClick:()=>a(!0),className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full border border-dashed text-xs text-muted hover:text-primary transition-colors`,style:{borderColor:`var(--border)`},children:[(0,f.jsx)(Vc,{size:11}),` Add`]}),g.map(e=>(0,f.jsxs)(`button`,{type:`button`,onClick:()=>p(e.email),title:`Copy ${e.email}`,className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full border border-dashed text-xs text-muted hover:text-primary transition-colors`,style:{borderColor:`var(--border)`},children:[(0,f.jsx)(ll,{size:11}),` `,e.name||e.email]},e.email)),c&&(0,f.jsx)(`span`,{className:`text-xs text-rose-400 w-full`,children:c})]})}var Cp=[{label:`Send your message`,combos:[[`Ctrl`,`Enter`],[`â`,`Enter`]]},{label:`Start a new line`,combos:[[`Enter`],[`Shift`,`Enter`]]},{label:`Close this dialog`,combos:[[`Esc`]]}];function wp(){let[e,t]=(0,l.useState)(!1);return(0,l.useEffect)(()=>
146{if(!e)return;let n=e=>{e.key===`Escape`&&t(!1)};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e]),(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`button`,{type:`button`,onClick:()=>t(!0),title:`Keyboard shortcuts`,"aria-label":`Keyboard shortcuts`,className:`p-1 rounded text-faint hover:text-primary transition-colors`,children:(0,f.jsx)(bc,{size:14})}),e&&(0,f.jsx)(`div`,{className:`fixed inset-0 z-[100] flex items-center justify-center p-4`,style:{background:`rgba(0,0,0,0.7)`},onClick:e=>{e.target===e.currentTarget&&t(!1)},children:(0,f.jsxs)(`div`,{className:`w-full max-w-xl rounded-2xl border border-edge overflow-hidden`,style:{background:`var(--bg-surface)`},children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-3 border-b border-edge`,children:[(0,f.jsx)(bc,{size:15,className:`text-accent shrink-0`}),(0,f.jsx)(`div`,{className:`font-semibold text-sm text-primary flex-1`,children:`Keyboard shortcuts`}),(0,f.jsx)(`button`,{type:`button`,onClick:()=>t(!1),className:`w-7 h-7 flex items-center justify-center rounded-lg text-muted hover:text-primary hover:bg-white/10 transition-colors`,children:(0,f.jsx)(pl,{size:15})})]}),(0,f.jsxs)(`div`,{className:`p-4 space-y-4`,children:[(0,f.jsxs)(`p`,{className:`text-sm text-muted leading-relaxed`,children:[`These are optional â you can always just click `,(0,f.jsx)(`strong`,{className:`text-primary`,children:`Send`}),`.`]}),(0,f.jsx)(`div`,{className:`space-y-2.5`,children:Cp.map(e=>(0,f.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,f.jsx)(`span`,{className:`text-xs text-muted`,children:e.label}),(0,f.jsx)(`div`,{className:`flex items-center gap-1.5 shrink-0 flex-wrap justify-end`,children:e.combos.map((e,t)=>(0,f.jsxs)(l.Fragment,{children:[t>0&&(0,f.jsx)(`span`,{className:`text-[10px] text-faint`,children:`or`}),(0,f.jsx)(`span`,{className:`flex items-center gap-1`,children:e.map((e,t)=>(0,f.jsxs)(l.Fragment,{children:[t>0&&(0,f.jsx)(`span`,{className:`text-[10px] text-faint`,children:`+`}),(0,f.jsx)(`kbd`,{className:`px-1.5 py-0.5 rounded border border-edge bg-elevated text-[11px] font-medium text-primary`,children:e})]},e))})]},t))})]},e.label))})]})]})})]})}function Tp({onClose:e,onCreated:t,services:n=[]}){let[r,i]=(0,l.useState)([]),[a,o]=(0,l.useState)(``),[s,c]=(0,l.useState)(null),[u,d]=(0,l.useState)(``),[p,m]=(0,l.useState)([]),[h,g]=(0,l.useState)([]),[_,v]=(0,l.useState)(!1),[y,b]=(0,l.useState)(null),[x,S]=(0,l.useState)(!0),C=(0,l.useRef)(null);(0,l.useEffect)(()=>{Z(`/api/portal/departments`).then(e=>i(e.departments||[]))},[]),(0,l.useEffect)(()=>{x||setTimeout(()=>C.current?.focus(),50)},[x]);async function w(e){if(e.preventDefault(),!u.trim())return;v(!0),b(null);let n=await Z(`/api/portal/tickets`,{method:`POST`,body:JSON.stringify({deptid:a||void 0,message:u,service_id:s?.id||void 0,service_name:s?.name||void 0,cc:h.length?h:void 0})});if(!n.ok){v(!1),b(n.error||`Failed to send`);return}if(p.length>0){let e=new FormData;n.replyId&&e.append(`reply_id`,n.replyId),p.forEach(t=>e.append(`files`,t)),await gl(`/api/portal/tickets/${n.id}/attachments`,e)}v(!1),t(n.id)}return(0,f.jsxs)(f.Fragment,{children:[x&&(0,f.jsx)(bp,{onClose:e,onStart:()=>S(!1)}),(0,f.jsxs)(`div`,{className:`flex flex-col h-full overflow-y-auto`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-3 border-b border-edge bg-surface shrink-0`,children:[(0,f.jsx)(`button`,{onClick:e,className:`md:hidden text-sm font-medium text-accent`,children:`â Back`}),(0,f.jsx)(`span`,{className:`font-semibold text-primary text-sm flex-1`,children:`New ticket`}),(0,f.jsxs)(`button`,{onClick:()=>S(!0),className:`flex items-center gap-1 text-xs text-muted hover:text-primary transition-colors`,children:[(0,f.jsx)(Ls,{size:13}),` Tips`]})]}),(0,f.jsxs)(`div`,{className:`w-full max-w-4xl mx-auto px-4 pt-4 pb-8 flex flex-col gap-3`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`span`,{className:`text-xs text-muted shrink-0 w-20`,children:`Department`}),(0,f.jsx)(`select`,{value:a,onChange:e=>o(e.target.value),className:`flex-1 rounded-lg px-2.5 py-1.5 text-sm text-primary bg-elevated border border-edge focus:outline-none focus:border-accent`,children:r.map(e=>(0,f.jsx)(`option`,{value:e.id,children:e.name},e.id))})]}),n.length>0&&(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`span`,{className:`text-xs text-muted shrink-0 w-20`,children:`Service`}),(0,f.jsx)(xp,{services:n,value:s,onChange:c})]}),(0,f.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,f.jsx)(`span`,{className:`text-xs text-muted shrink-0 w-20 pt-1.5`,children:`CC`}),(0,f.jsx)(`div`,{className:`flex-1`,children:(0,f.jsx)(Sp,{value:h,onChange:g})})]}),(0,f.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,f.jsx)(`textarea`,{ref:C,value:u,onChange:e=>d(e.target.value),placeholder:`Describe your issue⦠include any error messages, affected services, or domain names.`,className:`w-full rounded-xl px-4 py-3 text-sm text-primary resize-none bg-elevated border border-edge focus:outline-none focus:border-accent`,rows:10,onKeyDown:e=>{e.key===`Enter`&&(e.nativeEvent?.isComposing||e.keyCode===229||e.shiftKey||(e.metaKey||e.ctrlKey)&&
146(e.preventDefault(),w(e)))}}),y&&(0,f.jsxs)(`div`,{className:`alert-error text-xs`,children:[(0,f.jsx)(Y,{size:13}),` `,y]}),(0,f.jsx)(yp,{files:p,onChange:m}),(0,f.jsxs)(`div`,{className:`flex items-center justify-between gap-2 pt-1`,children:[(0,f.jsx)(wp,{}),(0,f.jsxs)(`button`,{onClick:w,disabled:_||!u.trim(),className:`btn-primary gap-1.5 text-sm`,children:[_?(0,f.jsx)(X,{size:13,className:`animate-spin`}):(0,f.jsx)(Jc,{size:13}),_?`Sendingâ¦`:`Send`]})]})]})]})]})]})}function Ep(e){return!!e&&e.startsWith(`image/`)&&e!==`image/svg+xml`}function Dp(e){return e===`application/pdf`}function Op(e){return e?e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`:``}function kp({attachment:e,onClose:t}){if(!e)return null;let n=_l(e.filename);return(0,l.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t]),(0,f.jsxs)(`div`,{className:`fixed inset-0 z-[100] flex flex-col`,style:{background:`rgba(0,0,0,0.88)`},onClick:e=>{e.target===e.currentTarget&&t()},children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 shrink-0`,style:{background:`rgba(0,0,0,0.5)`},children:[(0,f.jsx)(`span`,{className:`text-sm font-medium text-white truncate max-w-[60%]`,children:e.original_name}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsxs)(`a`,{href:n,download:e.original_name,className:`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium text-white bg-accent`,children:[(0,f.jsx)(cc,{size:13}),` Download`]}),(0,f.jsx)(`button`,{onClick:t,className:`w-8 h-8 flex items-center justify-center rounded-lg text-white/50 hover:text-white hover:bg-white/10 transition-colors`,children:(0,f.jsx)(pl,{size:16})})]})]}),(0,f.jsx)(`div`,{className:`flex-1 min-h-0 flex items-center justify-center p-4 overflow-auto`,children:Ep(e.mime_type)?(0,f.jsx)(`img`,{src:n,alt:e.original_name,className:`max-w-full max-h-full object-contain rounded-lg shadow-2xl`}):Dp(e.mime_type)?(0,f.jsx)(`iframe`,{src:n,title:e.original_name,className:`w-full h-full rounded-lg`,style:{minHeight:`70vh`,border:`none`,background:`#fff`}}):(0,f.jsxs)(`div`,{className:`text-center space-y-3`,children:[(0,f.jsx)(`div`,{className:`w-16 h-16 rounded-2xl flex items-center justify-center mx-auto`,style:{background:`rgba(255,255,255,0.08)`},children:(0,f.jsx)(fc,{size:32,style:{color:`rgba(255,255,255,0.7)`}})}),(0,f.jsx)(`p`,{className:`text-white font-medium`,children:e.original_name}),(0,f.jsx)(`p`,{className:`text-sm opacity-50 text-white`,children:Op(e.size)}),(0,f.jsxs)(`a`,{href:n,download:e.original_name,className:`inline-flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-medium text-white bg-accent`,children:[(0,f.jsx)(cc,{size:14}),` Download`]})]})})]})}function Ap({attachments:e,replyId:t,onOpen:n,hideEmbedded:r}){let i=t==null?e.filter(e=>!e.reply_id):e.filter(e=>e.reply_id===t);return r&&(i=i.filter(e=>!e.content_id)),i.length?(0,f.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:i.map((e,t)=>(0,f.jsx)(`button`,{onClick:()=>n(e),className:`group relative flex items-center gap-2 rounded-lg overflow-hidden transition-opacity hover:opacity-80`,style:{background:`var(--bg-elevated)`,border:`1px solid var(--border)`},children:Ep(e.mime_type)?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`img`,{src:_l(e.filename),alt:e.original_name,className:`w-20 h-20 object-cover`}),(0,f.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity`,style:{background:`rgba(0,0,0,0.45)`},children:(0,f.jsx)(cc,{size:16,color:`#fff`})})]}):(0,f.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2`,children:[(0,f.jsx)(Lc,{size:12,className:`opacity-60 flex-shrink-0`}),(0,f.jsxs)(`div`,{className:`text-left`,children:[(0,f.jsx)(`div`,{className:`text-xs font-medium max-w-[140px] truncate`,children:e.original_name}),e.size?(0,f.jsx)(`div`,{className:`text-[10px] opacity-50`,children:Op(e.size)}):null]}),(0,f.jsx)(cc,{size:11,className:`opacity-40 group-hover:opacity-80 transition-opacity flex-shrink-0`})]})},t))}):null}function jp({ticketId:e,client:t,onBack:n,onNewTicket:r}){let[i,a]=(0,l.useState)(null),[o,s]=(0,l.useState)([]),[c,u]=(0,l.useState)(null),[d,p]=(0,l.useState)(``),[m,h]=(0,l.useState)([]),[g,_]=(0,l.useState)([]),[v,y]=(0,l.useState)(!1),[b,x]=(0,l.useState)(!1),[S,C]=(0,l.useState)(!1),[w,T]=(0,l.useState)(``),[E,D]=(0,l.useState)(!1),O
146=(0,l.useRef)(null),k=(0,l.useRef)(null),A=(0,l.useRef)(!1),j=(0,l.useRef)(0),[M,N]=(0,l.useState)(()=>{let e=Number(sessionStorage.getItem(`portal:composeHeight`));return e>=76&&e<=640?e:96}),P=e=>Math.min(640,Math.max(76,Math.round(e)));function F(e){let t=P(e);j.current=t,N(t);try{sessionStorage.setItem(`portal:composeHeight`,String(t))}catch{}}function I(e){if(e.button!=null&&e.button!==0)return;e.preventDefault();let t=e.currentTarget,n=e.pointerId;try{t.setPointerCapture(n)}catch{}A.current=!0;let r=e.clientY,i=k.current?.offsetHeight??M;j.current=i;let a=e=>{let t=P(i+(r-e.clientY));j.current=t,k.current&&(k.current.style.height=t+`px`)},o=()=>{t.removeEventListener(`pointermove`,a),t.removeEventListener(`pointerup`,o),t.removeEventListener(`pointercancel`,o);try{t.releasePointerCapture(n)}catch{}document.body.style.userSelect=``,document.body.style.cursor=``,A.current=!1,F(j.current)};document.body.style.userSelect=`none`,document.body.style.cursor=`ns-resize`,t.addEventListener(`pointermove`,a),t.addEventListener(`pointerup`,o),t.addEventListener(`pointercancel`,o)}function L(e){e.key===`Enter`&&(e.nativeEvent?.isComposing||e.keyCode===229||e.shiftKey||(e.metaKey||e.ctrlKey)&&(e.preventDefault(),z(e)))}let R=(0,l.useCallback)(()=>{Z(`/api/portal/tickets/${e}`).then(e=>{e.ok&&a(e)}),Z(`/api/portal/tickets/${e}/attachments`).then(e=>{e.ok&&s(e.attachments||[])})},[e]);(0,l.useEffect)(()=>{R()},[R]);async function z(e){if(e&&e.preventDefault(),!(!d.trim()&&m.length===0)){if(i?.ticket?.status===`Closed`){x(!0);return}await B()}}async function B(){x(!1),y(!0);let t=await Z(`/api/portal/tickets/${e}/reply`,{method:`POST`,body:JSON.stringify({message:d,cc:g.length?g:void 0})});if(m.length>0&&t.ok){let n=new FormData;t.replyId&&n.append(`reply_id`,t.replyId),m.forEach(e=>n.append(`files`,e)),await gl(`/api/portal/tickets/${e}/attachments`,n)}p(``),h([]),_([]),y(!1),R()}function V(){T(i?.ticket?.client_secret||``),C(!0)}async function H(){D(!0),await Z(`/api/portal/tickets/${e}/secret`,{method:`POST`,body:JSON.stringify({secret:w})}),D(!1),C(!1),R()}if(!i)return(0,f.jsx)(`div`,{className:`p-6 text-sm text-muted`,children:`Loadingâ¦`});let{ticket:U,replies:W}=i,G=!!(U.client_secret&&U.client_secret.trim()),ee=new Map(o.filter(e=>e.content_id).map(e=>[String(e.content_id).toLowerCase(),_l(e.filename)]));return(0,f.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-3 border-b border-edge`,children:[(0,f.jsx)(`button`,{onClick:n,className:`md:hidden text-sm text-accent`,children:`â Back`}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsx)(`div`,{className:`font-semibold text-sm text-primary truncate`,children:U.subject}),(0,f.jsxs)(`div`,{className:`text-xs flex items-center gap-2 mt-0.5 text-muted`,children:[(0,f.jsxs)(`span`,{children:[`#`,U.id]}),(0,f.jsx)(`span`,{children:`·`}),(0,f.jsx)(`span`,{children:U.deptname||`General`}),(0,f.jsx)(`span`,{children:`·`}),(0,f.jsx)(kd,{status:U.status})]})]})]}),(0,f.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:(0,f.jsxs)(`div`,{className:`w-full max-w-4xl mx-auto px-4 py-4 space-y-3`,children:[W.map((e,t)=>{let n=!e.is_staff,r=n?e.name||`Client`:e.staff_name||`Support`,i=(r[0]||`?`).toUpperCase();return(0,f.jsxs)(`div`,{className:`rounded-xl px-4 py-3 text-sm border`,style:n?{background:`var(--bg-elevated)`,borderColor:`var(--border)`,color:`var(--text-primary)`}:{background:`color-mix(in srgb, var(--accent) 6%, var(--bg-surface))`,borderColor:`color-mix(in srgb, var(--accent) 20%, transparent)`,color:`var(--text-primary)`},children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between gap-2 mb-2`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`div`,{className:`w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-bold shrink-0 text-white`,style:{background:n?`var(--text-faint)`:`var(--accent)`},children:i}),(0,f.jsx)(`span`,{className:`text-xs font-semibold`,style:{color:`var(--text-muted)`},children:r})]}),(0,f.jsx)(`span`,{className:`text-[10px] shrink-0`,style:{color:`var(--text-faint)`},children:gd(e.date)})]}),(0,f.jsx)(Ul,{text:e.message,html:e.message_html,cidMap:ee,className:`text-sm`,textStyle:{whiteSpace:`pre-wrap`,color:`var(--text-primary)`}}),(0,f.jsx)(Ap,{attachments:o,replyId:e.id,onOpen:u,hideEmbedded:!!e.message_html})]},t)}),(0,f.jsx)(Ap,{attachments:o,replyId:null,onOpen:u})]})}),(0,f.jsx)(`form`,{onSubmit:z,className:`border-t border-edge`,children:(0,f.jsxs)(`div`,{className:`w-full max-w-4xl mx-auto p-3 space-y-2`,children:[U.status===`Closed`&&(0,f.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg px-3 py-2 text-xs`,style:{background:`color-mix(in srgb, var(--accent) 8%, transparent)`,color:`var(--text-muted)`},children:[(0,f.jsx)(Y,{size:13,className:`shrink-0 mt-0.5 text-accent`}),(0,f.jsxs)(`span`,{children:[`This ticket is closed â replying will reopen it. For a new issue,`,` `,(0,f.jsx)(`button`,{type:`button`,onClick:r,className:`text-accent font-semibold underline`,children:`open a new ticket`}),`.`]})]}),(0,f.jsxs)(`div`,{className:`h-5 flex items-center select-none`,children:[(0,f.jsx)(`div`,{className:`flex-1`}),(0,f.jsx)(`div`,{onPointerDown:I,title:`Drag to resize`,className:`group flex-1 h-full flex items-center justify-center cursor-ns-resize`,children:(0,f.jsx)(`div`,{className:`w-10 h-1 rounded-full transition-colors bg-edge group-hover:bg-accent`})}),(0,f.jsxs)(`div`,{className:`flex-1 flex items-center justify-end gap-1`,children:[(0,f.jsx)(`button`,{type:`button`,onClick:()=>F(M+120),disabled:M>=640,title:`Expand`,className:`p-1 rounded text-faint hover:text-primary disabled:opacity-25 disabled:hover:text-faint transition-colors`,children:(0,f.jsx)(Oc,{size:12})}),(0,f.jsx)(`button`,{type:`button`,onClick:()=>F(M-120),disabled:M<=76,title:`Collapse`,className:`p-1 rounded text-faint hover:text-primary disabled:opacity-25 disabled:hover:text-faint transition-colors`,children:(0,f.jsx)(Mc,{size:12})})]})]}),(0,f.jsx)(`textarea`,{ref:k,value:d,onChange:e=>p(e.target.value),placeholder:`Type a replyâ¦`,style:{height:A.current?j.current:M},className:`w-full rounded-lg px-3 py-2 text-sm text-primary resize-none overflow-y-auto bg-elevated border border-edge`,onKeyDown:L}),m.length>0&&(0,f.jsx)(`ul`,{className:`space-y-1`,children:m.map((e,t)=>(0,f.jsxs)(`li`,{className:`flex items-center gap-2 px-2.5 py-1 rounded text-xs bg-elevated border border-edge`,children:[(0,f.jsx)(Lc,{size:11,className:`text-muted`}),(0,f.jsx)(`span`,{className:`flex-1 truncate text-primary`,children:e.name}),(0,f.jsx)(`button`,{type:`button`,onClick:()=>h(e=>
146e.filter((e,n)=>n!==t)),className:`hover:text-red-400 transition-colors text-muted`,children:(0,f.jsx)(pl,{size:11})})]},t))}),(0,f.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,f.jsx)(`span`,{className:`text-[11px] text-muted shrink-0 w-8 pt-1.5`,children:`CC`}),(0,f.jsx)(`div`,{className:`flex-1`,children:(0,f.jsx)(Sp,{value:g,onChange:_})})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsxs)(`button`,{className:`btn-secondary`,type:`button`,onClick:()=>O.current?.click(),title:`Attach file`,children:[(0,f.jsx)(Lc,{size:12}),` Attach`]}),(0,f.jsx)(`input`,{ref:O,type:`file`,multiple:!0,hidden:!0,accept:gp,onChange:e=>{let t=Array.from(e.target.files||[]).filter(e=>{let t=`.`+e.name.split(`.`).pop().toLowerCase();return _p.has(t)});h(e=>[...e,...t]),e.target.value=``}}),(0,f.jsxs)(`button`,{className:`btn-secondary`,type:`button`,onClick:V,title:`Share a password or other secret with support â destroyed when the ticket closes`,children:[(0,f.jsx)(yc,{size:12}),` Secrets`,G&&(0,f.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full`,style:{background:`var(--accent)`}})]}),(0,f.jsx)(`div`,{className:`flex-1`}),(0,f.jsx)(wp,{}),(0,f.jsxs)(`button`,{className:`btn-primary`,type:`submit`,disabled:v||!d.trim()&&m.length===0,children:[(0,f.jsx)(Jc,{size:13}),` `,v?`Sendingâ¦`:`Send`]})]})]})}),b&&(0,f.jsx)(`div`,{className:`fixed inset-0 z-[100] flex items-center justify-center p-4`,style:{background:`rgba(0,0,0,0.7)`},onClick:e=>{e.target===e.currentTarget&&x(!1)},children:(0,f.jsxs)(`div`,{className:`w-full max-w-md rounded-2xl border border-edge overflow-hidden`,style:{background:`var(--bg-surface)`},children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-3 border-b border-edge`,children:[(0,f.jsx)(Y,{size:15,className:`text-accent shrink-0`}),(0,f.jsx)(`div`,{className:`font-semibold text-sm text-primary flex-1`,children:`This ticket is closed`}),(0,f.jsx)(`button`,{onClick:()=>x(!1),className:`w-7 h-7 flex items-center justify-center rounded-lg text-muted hover:text-primary hover:bg-white/10 transition-colors`,children:(0,f.jsx)(pl,{size:15})})]}),(0,f.jsxs)(`div`,{className:`p-4 space-y-4`,children:[(0,f.jsxs)(`p`,{className:`text-sm text-muted leading-relaxed`,children:[`Only reply here if your message relates to this conversation â your reply will reopen the ticket. If this is a `,(0,f.jsx)(`strong`,{children:`new issue`}),`, please open a new ticket instead so our team can track it properly.`]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsxs)(`button`,{type:`button`,onClick:()=>{x(!1),r?.()},className:`btn-secondary`,children:[(0,f.jsx)(Vc,{size:12}),` Open a new ticket`]}),(0,f.jsx)(`div`,{className:`flex-1`}),(0,f.jsxs)(`button`,{type:`button`,onClick:B,disabled:v,className:`btn-primary`,children:[(0,f.jsx)(Jc,{size:13}),` `,v?`Sendingâ¦`:`Reply anyway`]})]})]})]})}),c&&(0,f.jsx)(kp,{attachment:c,onClose:()=>u(null)}),S&&(0,f.jsx)(`div`,{className:`fixed inset-0 z-[100] flex items-center justify-center p-4`,style:{background:`rgba(0,0,0,0.7)`},onClick:e=>{e.target===e.currentTarget&&C(!1)},children:(0,f.jsxs)(`div`,{className:`w-full max-w-lg rounded-2xl border border-edge overflow-hidden`,style:{background:`var(--bg-surface)`},children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-3 border-b border-edge`,children:[(0,f.jsx)(yc,{size:15,className:`text-accent shrink-0`}),(0,f.jsx)(`div`,{className:`font-semibold text-sm text-primary flex-1`,children:`Secrets & passwords`}),(0,f.jsx)(`button`,{onClick:()=>C(!1),className:`w-7 h-7 flex items-center justify-center rounded-lg text-muted hover:text-primary hover:bg-white/10 transition-colors`,children:(0,f.jsx)(pl,{size:15})})]}),(0,f.jsxs)(`div`,{className:`p-4 space-y-3`,children:[(0,f.jsxs)(`p`,{className:`text-xs text-muted leading-relaxed`,children:[`Share a password or access detail our team needs to work on this ticket. It's visible only to support staff and is `,(0,f.jsx)(`strong`,{children:`permanently destroyed the moment this ticket is closed`}),`.`]}),(0,f.jsx)(`textarea`,{value:w,onChange:e=>T(e.target.value),placeholder:`e.g. cPanel login, temporary password, access codeâ¦`,rows:5,autoFocus:!0,className:`w-full rounded-lg px-3 py-2 text-sm text-primary resize-none bg-elevated border border-edge font-mono`}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`button`,{type:`button`,onClick:()=>C(!1),className:`btn-secondary`,children:`Cancel`}),(0,f.jsx)(`div`,{className:`flex-1`}),(0,f.jsx)(`button`,{type:`button`,onClick:H,disabled:E,className:`btn-primary`,children:E?`Savingâ¦`:`Save secret`})]})]})]})})]})}function Mp({status:e}){let t=vp[e]||{label:e,dot:`var(--text-faint)`};return(0,f.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px] font-semibold shrink-0 whitespace-nowrap`,style:{color:t.dot},children:[(0,f.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full shrink-0`,style:{background:t.dot}}),t.label]})}function Np({client:e,services:t=[]}
146){let[n,r]=(0,l.useState)([]),[i,a]=(0,l.useState)(!0),[o,s]=(0,l.useState)(()=>Ch(`portal:support:selected`,null)),[c,u]=(0,l.useState)(()=>Ch(`portal:support:showNew`,!1)),[d,p]=(0,l.useState)(()=>Ch(`portal:support:selected`,null)!=null),[m,h]=(0,l.useState)(!1),g=(0,l.useCallback)(()=>{Z(`/api/portal/tickets`).then(e=>{r(e.tickets||[]),a(!1)})},[]);(0,l.useEffect)(()=>{g()},[g]),(0,l.useEffect)(()=>{wh(`portal:support:selected`,o)},[o]),(0,l.useEffect)(()=>{wh(`portal:support:showNew`,c)},[c]);function _(e){u(!1),g(),s(e),p(!0)}function v(){s(null),u(!0),p(!0)}function y(e){u(!1),s(e),p(!0)}let b=n.filter(e=>m?e.status===`Closed`:e.status!==`Closed`),x=n.filter(e=>e.status===`Closed`).length,S=d||c;return(0,f.jsxs)(`div`,{className:`flex h-full`,style:{overflow:`hidden`},children:[(0,f.jsxs)(`div`,{className:`flex flex-col border-r md:w-80 lg:w-96 flex-shrink-0 ${S?`hidden md:flex`:`flex w-full`}`,style:{borderColor:`var(--border)`,background:`var(--bg-surface)`},children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 border-b border-edge shrink-0`,children:[(0,f.jsxs)(`h1`,{className:`font-semibold text-primary flex items-center gap-2`,children:[(0,f.jsx)(jc,{size:16,className:`text-faint shrink-0`}),`Support`]}),(0,f.jsxs)(`button`,{className:`btn-primary`,onClick:v,children:[(0,f.jsx)(Vc,{size:12}),` New ticket`]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-0 px-3 py-2 border-b border-edge shrink-0`,children:[(0,f.jsx)(`button`,{onClick:()=>h(!1),className:`flex-1 py-1.5 text-xs font-semibold rounded-l-lg border transition-colors`,style:m?{background:`var(--bg-elevated)`,borderColor:`var(--border)`,color:`var(--text-muted)`}:{background:`var(--bg-active)`,borderColor:`var(--accent)`,color:`var(--accent)`},children:`Open`}),(0,f.jsxs)(`button`,{onClick:()=>h(!0),className:`flex-1 py-1.5 text-xs font-semibold rounded-r-lg border-t border-b border-r transition-colors`,style:m?{background:`var(--bg-active)`,borderColor:`var(--accent)`,color:`var(--accent)`}:{background:`var(--bg-elevated)`,borderColor:`var(--border)`,color:`var(--text-muted)`},children:[`Closed`,x>0&&` (${x})`]})]}),(0,f.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:i?(0,f.jsx)(`div`,{className:`p-4 text-sm text-muted`,children:`Loadingâ¦`}):b.length===0?(0,f.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-3 p-8 text-center`,children:[(0,f.jsx)(`div`,{className:`w-12 h-12 rounded-full bg-elevated flex items-center justify-center mx-auto`,children:m?(0,f.jsx)(Ks,{size:20,className:`text-faint`}):(0,f.jsx)(jc,{size:20,className:`text-faint`})}),(0,f.jsx)(`p`,{className:`text-sm font-medium text-primary`,children:m?`No closed tickets`:`No open tickets`}),!m&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`p`,{className:`text-xs text-muted`,children:`Open a ticket and our team will get back to you.`}),(0,f.jsx)(`button`,{className:`btn-primary`,onClick:v,children:`Open a ticket`})]})]}):b.map(e=>(0,f.jsxs)(`button`,{onClick:()=>y(e.id),className:`w-full text-left px-4 py-3 border-b hover:bg-[var(--bg-hover)] transition-colors`,style:{borderColor:`var(--border)`,background:o===e.id&&!c?`var(--bg-active)`:`transparent`},children:[(0,f.jsxs)(`div`,{className:`flex items-start justify-between gap-2 mb-1`,children:[(0,f.jsx)(`p`,{className:`text-sm font-medium text-primary truncate leading-snug`,children:e.subject}),(0,f.jsx)(Mp,{status:e.status})]}),(0,f.jsxs)(`p`,{className:`text-xs text-muted truncate`,children:[e.deptname||`General`,` · `,Q(e.lastreply)]})]},e.id))})]}),(0,f.jsx)(`div`,{className:`flex-1 overflow-hidden bg-canvas ${S?`flex flex-col`:`hidden md:flex md:flex-col`}`,children:c?(0,f.jsx)(Tp,{onClose:()=>{u(!1),p(!1)},onCreated:_,services:t}):o?(0,f.jsx)(jp,{ticketId:o,client:e,onBack:()=>p(!1),onNewTicket:v}):(0,f.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center gap-3 text-center p-8`,children:[(0,f.jsx)(`div`,{className:`w-12 h-12 rounded-full bg-elevated flex items-center justify-center`,children:(0,f.jsx)(jc,{size:20,className:`text-faint`})}),(0,f.jsx)(`p`,{className:`text-sm font-medium text-primary`,children:`Select a ticket`}),(0,f.jsx)(`p`,{className:`text-xs text-muted`,children:`Choose a conversation from the list, or open a new ticket.`}),(0,f.jsx)(`button`,{className:`btn-primary`,onClick:v,children:`New ticket`})]})})]})}function Pp({onVerified:e,onCancel:t}){let[n,r]=(0,l.useState)(`enter`),[i,a]=(0,l.useState)(()=>Pl()),[o,s]=(0,l.useState)(``),[c,u]=(0,l.useState)(``),[d,p]=(0,l.useState)(!1),[m,h]=(0,l.useState)(``),[g,_]=(0,l.useState)(``);async function v(){let e=Il(i,o);if(!e){h(`Enter your mobile number`);return}p(!0),h(``);try{let t=await Z(`/api/portal/profile/mobile/start`,{method:`POST`,body:JSON.stringify({mobile:e})});t.ok?(r(`code`),u(``),_(`Weâve sent a 6-digit code by SMS to ${e}. Enter it below to confirm.`)):h(t.error||`Could not send the code`)}catch{h(`Could not send the code`)}finally{p(!1)}}async function y(){if(!c.trim()){h(`Enter the code from the SMS`);return}p(!0),h(``);try{let e=await Z(`/api/portal/profile/mobile/verify`,{method:`POST`,body:JSON.stringify({code:c.trim()})});e.ok?(r(`done`),_(``),s(e.mobile||``)):h(e.error||`Could not confirm the code`)}catch{h(`Could not confirm the code`)}finally{p(!1)}}return(0,f.jsxs)(`div`,{className:`space-y-3 rounded-lg p-3 bg-elevated`,children:[(0,f.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,f.jsx)($c,{size:15,className:`text-accent shrink-0 mt-0.5`}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-sm font-medium text-primary`,children:`Add your mobile number first`}),(0,f.jsx)(`p`,{className:`text-xs text-muted mt-0.5`,children:`A passkey only w
146orks on the device that holds it. If you ever lose that device, we text a code to this number to get you back in â so we need it before the passkey is created.`})]})]}),m&&(0,f.jsxs)(`div`,{className:`alert-error`,children:[(0,f.jsx)(Y,{size:14}),m]}),g&&(0,f.jsx)(`p`,{className:`text-xs text-muted`,children:g}),n===`enter`&&(0,f.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,f.jsxs)(`div`,{className:`flex items-stretch gap-2 w-full sm:max-w-sm`,children:[(0,f.jsx)(kh,{value:i,onChange:a,disabled:d}),(0,f.jsx)(`input`,{value:o,onChange:e=>s(e.target.value),type:`tel`,inputMode:`tel`,placeholder:`412 345 678`,className:`flex-1 min-w-0 rounded-lg px-3 py-2 text-sm bg-surface border border-edge text-primary`,onKeyDown:e=>{e.key===`Enter`&&v()}})]}),(0,f.jsxs)(`div`,{className:`flex gap-2`,children:[(0,f.jsxs)(`button`,{onClick:v,disabled:d,className:`btn-primary px-3 py-1.5 text-sm flex items-center gap-1.5 disabled:opacity-50`,children:[d?(0,f.jsx)(X,{size:14,className:`animate-spin`}):(0,f.jsx)(Jc,{size:14}),` Send code`]}),(0,f.jsx)(`button`,{onClick:t,disabled:d,className:`btn-secondary px-3 py-1.5 text-sm`,children:`Cancel`})]})]}),n===`code`&&(0,f.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,f.jsx)(`input`,{value:c,onChange:e=>u(e.target.value.replace(/\D/g,``).slice(0,6)),inputMode:`numeric`,placeholder:`000000`,maxLength:6,className:`w-40 rounded-lg px-3 py-2 text-lg font-mono tracking-[0.3rem] text-center bg-surface border border-edge text-primary`,onKeyDown:e=>{e.key===`Enter`&&y()}}),(0,f.jsxs)(`div`,{className:`flex gap-2`,children:[(0,f.jsxs)(`button`,{onClick:y,disabled:d,className:`btn-primary px-3 py-1.5 text-sm flex items-center gap-1.5 disabled:opacity-50`,children:[d?(0,f.jsx)(X,{size:14,className:`animate-spin`}):(0,f.jsx)($s,{size:14}),` Confirm`]}),(0,f.jsx)(`button`,{onClick:()=>{r(`enter`),u(``),h(``),_(``)},disabled:d,className:`btn-secondary px-3 py-1.5 text-sm`,children:`Back`})]})]}),n===`done`&&(0,f.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,f.jsxs)(`p`,{className:`text-xs flex items-center gap-1.5`,style:{color:`var(--color-success, #16a34a)`},children:[(0,f.jsx)($s,{size:13}),` Mobile number saved`,o?` (${o})`:``,`. You can now create your passkey.`]}),(0,f.jsxs)(`button`,{onClick:e,className:`btn-primary px-3 py-1.5 text-sm flex items-center gap-1.5`,children:[(0,f.jsx)(Fs,{size:14}),` Continue`]})]})]})}function Fp(){let[e,t]=(0,l.useState)([]),[n,r]=(0,l.useState)([]),[i,a]=(0,l.useState)([]),[o,s]=(0,l.useState)(!0),[c,u]=(0,l.useState)(``),[d,p]=(0,l.useState)(``),[m,h]=(0,l.useState)(``),[g,_]=(0,l.useState)(!1),[v,y]=(0,l.useState)(``),[b,x]=(0,l.useState)(!1),[S,C]=(0,l.useState)(``),[w]=(0,l.useState)(()=>{let e=cd(localStorage.getItem(hl));return e?.imp?{admin:!!e.impAdmin}:null});function T(e){h(e),setTimeout(()=>h(``),3e3)}async function E(){let[e,n]=await Promise.all([Z(`/api/portal/2fa/status`).catch(()=>({})),Z(`/api/portal/identities`).catch(()=>({}))]);t(e?.passkeys||[]),C(e?.recoveryMobile||``),r(n?.identities||[]),a(n?.available||[]),s(!1)}(0,l.useEffect)(()=>{let e=sessionStorage.getItem(`portal:identity_linked`);e&&(sessionStorage.removeItem(`portal:identity_linked`),T(`${Ld[e]?.label||e} connected`)),E()},[]);async function D(){u(`pk`),p(``);try{let e=await Z(`/api/portal/2fa/passkey/register/begin`,{method:`POST`});if(e.needMobile){x(!0),p(``);return}if(!e.ok){p(e.error||`Could not start registration`);return}let t=await Fd(e.options),n=await Z(`/api/portal/2fa/passkey/register/complete`,{method:`POST`,body:JSON.stringify({credential:t,name:v.trim()||void 0})});n.ok?(y(``),_(!1),T(`Passkey "${n.name}" added`),E()):n.needMobile?(x(!0),p(``)):p(n.error||`Registration failed`)}catch(e){p(e.name===`NotAllowedError`?`Passkey prompt was dismissed.`:e.message||`Registration failed`)}finally{u(``)}}async function O(t,n){let r=e.length===1?` It's the last one, so ${w?`they`:`you`}'ll go back to signing in with an email code.`:` ${w?`They`:`You`}'ll sign in with the remaining passkeys.`,i=w?`Remove this customer's passkey "${n}" on their behalf? This is recorded against your name in their audit log.`:`Remove your passkey "${n}"?`;if(!confirm(i+r))return;u(`pk_`+t),p(``);let a=await Z(`/api/portal/2fa/passkey/${encodeURIComponent(t)}`,{method:`DELETE`});u(``),a.ok?(T(`Passkey removed`),E()):p(a.error||`Could not remove that passkey.`)}async function k(e){u(`ip_`+e),p(``);try{let t=await Z(`/api/portal/auth/${e}/link/start`,{method:`POST`});if(!t.ok||!t.url){p(t.error||`Could not start linking`),u(``);return}window.location.assign(t.url)}catch{p(`Network error. Please try again.`),u(``)}}async function A(e){if(!confirm(`Disconnect ${Ld[e]?.label||e} sign-in?`))return;u(`ip_`+e);let t=await Z(`/api/portal/identities/${e}`,{method:`DELETE`});u(``),t.ok&&(T(`Sign-in method disconnected`),E())}if(o)return(0,f.jsx)(`div`,{className:`text-sm py-4 text-muted`,children:`Loadingâ¦`});let j=e.length>0,M=n.length>0,N=j?`passkey`:M?`provider`:`email`,P=N===`passkey`?`a passkey`:N===`provider`?`a connected sign-in`:`email codes`,F=i.filter(e=>!n.some(t=>t.provider===e.id)),I=()=>(0,f.jsx)(`span`,{className:`text-[10px] px-2 py-0.5 rounded-full font-semibold shrink-0`,style:{background:`rgba(22,163,74,0.15)`,color:`var(--color-success, #16a34a)`,border:`1px solid rgba(22,163,74,0.3)`},children:`Active â you sign in with this`}),L=({children:e})=>(0,f.jsx)(`span`,{className:`text-[10px] px-2 py-0.5 rounded-full font-medium shrink-0 text-faint`,style:{background:`var(--bg-elevated)`,border:`1px solid var(--border, rgba(0,0,0,0.08))`},children:e}),R=`card p-5 space-y-3 transition-opacity`,z={opacity:.6};
146return(0,f.jsxs)(`div`,{className:`space-y-4 mt-6`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(Xc,{size:18,className:`text-accent`}),(0,f.jsx)(`h2`,{className:`text-base font-semibold text-primary`,children:`How you sign in`})]}),(()=>{let e=[{k:`email`,label:`Email code`,Icon:Dc},{k:`provider`,label:`Connected sign-in`,Icon:Tc},{k:`passkey`,label:`Passkey`,Icon:Fs}],t=e.findIndex(e=>e.k===N);return(0,f.jsxs)(`div`,{className:`card p-5 space-y-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between text-[10px] font-semibold uppercase tracking-wider text-faint`,children:[(0,f.jsx)(`span`,{children:`Weaker`}),(0,f.jsx)(`span`,{children:`Stronger`})]}),(0,f.jsx)(`div`,{className:`flex items-start`,children:e.map((e,n)=>{let r=n<=t,i=n===t;return(0,f.jsxs)(l.Fragment,{children:[n>0&&(0,f.jsx)(`div`,{className:`flex-1 h-1.5 rounded-full`,style:{marginTop:13,background:r?`var(--accent)`:`var(--bg-elevated)`}}),(0,f.jsxs)(`div`,{className:`flex flex-col items-center gap-1.5 text-center shrink-0`,style:{width:92},children:[(0,f.jsx)(`div`,{className:`w-8 h-8 rounded-full flex items-center justify-center z-10`,style:i?{background:`var(--accent)`,color:`#fff`,boxShadow:`0 0 0 4px var(--bg-active)`}:r?{background:`var(--accent)`,color:`#fff`,opacity:.45}:{background:`var(--bg-elevated)`,color:`var(--text-faint)`,border:`1px solid var(--border, rgba(0,0,0,0.08))`},children:(0,f.jsx)(e.Icon,{size:15})}),(0,f.jsx)(`span`,{className:`text-xs font-medium leading-tight`,style:{color:i?`var(--text-primary)`:`var(--text-muted)`},children:e.label}),i&&(0,f.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded-full font-semibold`,style:{background:`rgba(22,163,74,0.15)`,color:`var(--color-success, #16a34a)`},children:`Youâre here`})]})]},e.k)})}),(0,f.jsxs)(`p`,{className:`text-xs text-muted`,children:[`You always sign in with the strongest method youâve set up â right now thatâs `,(0,f.jsx)(`strong`,{className:`text-primary`,children:P}),`.`,N!==`passkey`&&` Set up a stronger one to move up the scale; it automatically turns off the weaker ones.`]})]})})(),m&&(0,f.jsx)(`div`,{className:`rounded-lg px-3 py-2 text-sm`,style:{background:`rgba(22,163,74,0.08)`,color:`var(--color-success, #16a34a)`},children:m}),d&&(0,f.jsxs)(`div`,{className:`alert-error`,children:[(0,f.jsx)(Y,{size:14}),d]}),(0,f.jsxs)(`div`,{className:R,children:[(0,f.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsx)(`div`,{className:`w-9 h-9 rounded-lg flex items-center justify-center shrink-0 bg-elevated`,children:(0,f.jsx)(Fs,{size:17,className:`text-accent`})}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-sm font-medium text-primary`,children:`Passkey`}),(0,f.jsx)(`p`,{className:`text-xs text-muted`,children:`Fingerprint, face, or device PIN â the strongest option. Yours alone; anyone else on this account sets up their own.`})]})]}),N===`passkey`&&(0,f.jsx)(I,{})]}),j&&(0,f.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>(0,f.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg px-3 py-2 bg-elevated`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-sm text-primary`,children:e.name}),(0,f.jsxs)(`p`,{className:`text-xs mt-0.5 text-faint`,children:[`Added `,new Date(e.created_at).toLocaleDateString(`en-AU`,{day:`numeric`,month:`short`,year:`numeric`})]})]}),(!w||w.admin)&&(0,f.jsx)(`button`,{onClick:()=>O(e.id,e.name),disabled:c===`pk_`+e.id,title:w?`Remove this passkey on the customerâs behalf`:void 0,className:`p-1.5 rounded-lg disabled:opacity-50`,style:{color:`#f87171`},children:(0,f.jsx)(rl,{size:14})})]},e.id))}),w?(0,f.jsx)(`p`,{className:`text-xs text-faint`,children:w.admin?`Staff view: you can remove a passkey for this customer (recorded in their audit log), but a new one can only be created by them, on their own device.`:`Staff view: passkeys can only be managed by the customer. Removing one requires an administrator.`}):g&&b?(0,f.jsx)(Pp,{onVerified:()=>{x(!1),D()},onCancel:()=>{x(!1),_(!1),y(``)}}):g?(0,f.jsxs)(`div`,{className:`space-y-2.5 rounded-lg p-3 bg-elevated`,children:[(0,f.jsx)(`p`,{className:`text-xs text-muted`,children:`Your browser will prompt you to create a passkey. Give it a name so you can tell your devices apart.`}
146),(0,f.jsx)(`input`,{value:v,onChange:e=>y(e.target.value),placeholder:`e.g. My phone`,className:`w-full rounded-lg px-3 py-2 text-sm outline-none`,style:{background:`var(--bg-base)`,border:`1px solid var(--border, rgba(0,0,0,0.1))`,color:`var(--text-primary)`}}),(0,f.jsxs)(`div`,{className:`flex gap-2`,children:[(0,f.jsxs)(`button`,{onClick:D,disabled:c===`pk`,className:`btn-primary px-3 py-1.5 text-sm flex items-center gap-1.5 disabled:opacity-50`,children:[(0,f.jsx)(Fs,{size:14}),c===`pk`?`Waiting for browserâ¦`:`Create passkey`]}),(0,f.jsx)(`button`,{onClick:()=>{_(!1),y(``),x(!1)},className:`btn-secondary px-3 py-1.5 text-sm`,children:`Cancel`})]})]}):(0,f.jsxs)(`button`,{onClick:()=>_(!0),className:`btn-secondary px-3 py-1.5 text-sm flex items-center gap-1.5`,children:[(0,f.jsx)(Vc,{size:14}),` `,j?`Add another passkey`:`Add a passkey`]}),!w&&(0,f.jsxs)(`p`,{className:`text-xs text-faint flex items-center gap-1.5`,children:[(0,f.jsx)($c,{size:12,className:`shrink-0`}),S?(0,f.jsxs)(f.Fragment,{children:[`Lost the device? Weâll text a recovery code to `,S,`. Change it under Profile settings.`]}):(0,f.jsx)(f.Fragment,{children:`No mobile number on file â weâll ask for one when you add a passkey, so you can still get in if you lose the device.`})]}),!j&&!g&&!w&&(0,f.jsx)(`p`,{className:`text-xs text-faint`,children:`Add a passkey to make it your own sign-in method â no codes, no provider needed. It only affects you, not others on this account.`})]}),(0,f.jsxs)(`div`,{className:R,style:N===`passkey`&&!M?z:void 0,children:[(0,f.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsx)(`div`,{className:`w-9 h-9 rounded-lg flex items-center justify-center shrink-0 bg-elevated`,children:(0,f.jsx)(Tc,{size:17,className:`text-accent`})}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-sm font-medium text-primary`,children:`Connected sign-in`}),(0,f.jsx)(`p`,{className:`text-xs text-muted`,children:`Sign in with Google, Microsoft, GitHub, Apple, or Facebook.`})]})]}),N===`provider`&&(0,f.jsx)(I,{}),N===`passkey`&&(M?(0,f.jsx)(L,{children:`Connected · passkey is default`}):(0,f.jsx)(L,{children:`Off â passkey is active`}))]}),N===`passkey`&&!M?(0,f.jsx)(`p`,{className:`text-xs text-faint`,children:`Turned off while you have a passkey. Remove your passkey above to use a connected sign-in as your default.`}):(0,f.jsxs)(f.Fragment,{children:[N===`passkey`&&M&&(0,f.jsx)(`p`,{className:`text-xs text-faint`,children:`Your passkey is used by default when you sign in with your email. These connected sign-ins stay linked and still work from their buttons on the login screen.`}),n.map(e=>{let t=Ld[e.provider]||{label:e.provider};return(0,f.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg px-3 py-2 bg-elevated`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,f.jsx)(Rd,{id:e.provider}),(0,f.jsxs)(`div`,{className:`min-w-0`,children:[(0,f.jsx)(`p`,{className:`text-sm text-primary`,children:t.label}),(0,f.jsx)(`p`,{className:`text-xs text-faint truncate`,children:e.provider_email||`Connected`})]})]}),(0,f.jsxs)(`button`,{onClick:()=>A(e.provider),disabled:c===`ip_`+e.provider,className:`btn-secondary px-2.5 py-1.5 text-xs flex items-center gap-1.5 disabled:opacity-50`,children:[(0,f.jsx)(ol,{size:13}),` Disconnect`]})]},e.provider)}),F.length>0&&(0,f.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:F.map(e=>(0,f.jsxs)(`button`,{onClick:()=>k(e.id),disabled:c===`ip_`+e.id,className:`btn-secondary px-3 py-1.5 text-sm flex items-center gap-1.5 disabled:opacity-50`,children:[(0,f.jsx)(Rd,{id:e.id,size:14}),` Connect `,Ld[e.id]?.label||e.name]},e.id))}),!i.length&&!n.length&&(0,f.jsx)(`p`,{className:`text-xs text-faint`,children:`No providers are available yet. Ask your administrator to enable them.`}),N===`email`&&F.length>0&&(0,f.jsx)(`p`,{className:`text-xs text-faint`,children:`Connect one to sign in without email codes.`})]})]}),(0,f.jsxs)(`div`,{className:R,style:N===`email`?void 0:z,children:[(0,f.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsx)(`div`,{className:`w-9 h-9 rounded-lg flex items-center justify-center shrink-0 bg-elevated`,children:(0,f.jsx)(Dc,{size:17,className:`text-accent`})}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-sm font-medium text-primary`,children:`Email verification code`}),(0,f.jsx)(`p`,{className:`text-xs text-muted`,children:`We email you a one-time code when you sign in.`})]})]}),N===`email`?(0,f.jsx)(I,{}):(0,f.jsxs)(L,{children:[`Off â `,N===`passkey`?`passkey`:`connected sign-in`,` is active`]})]}),(0,f.jsx)(`p`,{className:`text-xs text-faint`,children:N===`email`?`This is your default sign-in. Add a passkey or connect a sign-in above to stop using email codes.`:`Automatically turned back on if you remove your ${N===`passkey`?`passkey`:`connected sign-in`}.`})]})]})}var Ip={Visa:{bg:`#1a1f71`,color:`#fff`,label:`VISA`},Mastercard:{bg:`#eb001b`,color:`#fff`,label:`MC`},Amex:{bg:`#007bc1`,color:`#fff`,label:`AMEX`},Eftpos:{bg:`#1a7f37`,color:`#fff`,label:`eft`},Other:{bg:`#6b7280`,color:`#fff`,label:`â¢â¢`}};function Lp({brand:e}){let t=Ip[e]||Ip.Other;return(0,f.jsx)(`span`,{className:`inline-flex items-center justify-center rounded px-1.5 text-[10px] font-black tracking-tight w-10 h-6 shrink-0`,style:{background:t.bg,color:t.color},children:t.label})}function Rp(e){let t=String(e||`card`).toLowerCase();return t===`paypal`?`PayPal agreement`:t===`payto`||t===`becs`||t===`bank`||t===`gocardless`?`bank account`:`card`}function zp(e){return!!e?.requires_update||e?.chargeable===!1&&!e?.pending}function Bp(e){return String(e||``).replace(/\s*[([]\s*needs\s+re-?adding\s*[)\]]/gi,``).replace(/needs\s+re-?adding/gi,``).replace(/\s{2,}/g,` `).replace(/^[\s·,-]+|[\s·,-]+$/g,``)}function Vp(){return(0,f.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[11px] font-semibold px-1.5 py-0.5 rounded-full`,style:{background:`rgba(244,63,94,0.14)`,color:`#fb7185`},children:[(0,f.jsx)(Y,{size:10}),` Needs re-adding`]})}function Hp({method:e}){let t=Rp(e?.method_type);return(0,f.jsxs)(`div`,{className:`mt-1.5 flex items-start gap-1.5 rounded-lg px-2.5 py-1.5`,role:`alert`,style:{background:`rgba(244,63,94,0.10)`,border:`1px solid rgba(244,63,94,0.22)`},children:[(0,f.jsx)(Y,{size:12,className:`mt-px shrink-0`,style:{color:`#fb7185`}}),(0,f.jsxs)(`div`,{className:`min-w-0`,children:[(0,f.jsx)(`p`,{className:`text-[11px] font-semibold`,style:{color:`#fb7185`},children:`Needs re-adding`}),(0,f.jsxs)(`p`,{className:`text-[11px] text-muted mt-0.5`,children:[`This saved `,t,` can no longer be used. Please remove it and add `,t===`card`?`your card`:`it`,` again.`]})]})]})}function Up(){return(0,f.jsxs)(`div`,{className:`mt-1.5 flex items-start gap-1.5 rounded-lg px-2.5 py-1.5`,role:`alert`,style:{background:`rgba(244,63,94,0.10)`,border:`1px solid rgba(244,63,94,0.22)`},children:[(0,f.jsx)(Y,{size:12,className:`mt-px shrink-0`,style:{color:`#fb7185`}}),(0,f.jsxs)(`div`,{className:`min-w-0`,children:[(0,f.jsx)(`p`,{className:`text-[11px] font-semibold`,style:{color:`#fb7185`},children:`Not authorised`}),(0,f.jsx)(`p`,{className:`text-[11px] text-muted mt-0.5`,children:`This request was never approved in your banking app and has now timed out, so it can't be used to pay your invoices. Please remove it and set up the direct debit again.`})]})]})}function Wp({type:e,title:t,icon:n,iconColor:r,methods:i,adding:a,setAdding:o,onSetDefault:s,onDelete:c,deleting:l,settingDefault:u=null,disabled:d=!1,readOnly:p=!1,children:m}){let h=i.length>0||a;return(0,f.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface overflow-hidden`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 border-b border-edge`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(n,{size:15,style:{color:d?`var(--text-faint)`:r}}),(0,f.jsx)(`span`,{className:`text-sm font-semibold text-primary`,children:t}),i.length>0&&(0,f.jsx)(`span`,{className:`text-[11px] px-1.5 py-0.5 rounded-full bg-elevated border border-edge text-muted`,children:i.length})]}
146),!d&&!p&&!a&&(0,f.jsxs)(`button`,{className:`btn-secondary`,onClick:()=>o(e),children:[(0,f.jsx)(Vc,{size:11}),` Add`]}),d&&(0,f.jsx)(`span`,{className:`text-[11px] text-faint`,children:`Not available`}),!d&&p&&(0,f.jsx)(`span`,{className:`text-[11px] text-faint`,children:`View only`})]}),!h&&(0,f.jsxs)(`p`,{className:`px-4 py-3 text-xs text-muted`,children:[`No `,t.toLowerCase(),` on file.`]}),i.length>0&&(0,f.jsx)(`ul`,{className:`divide-y divide-edge`,children:i.map(t=>(0,f.jsxs)(`li`,{className:`flex items-center gap-3 px-4 py-3 relative`,style:t.is_default?{borderLeft:`3px solid var(--accent)`,paddingLeft:`13px`}:{},children:[e===`card`?(0,f.jsx)(Lp,{brand:t.brand}):(0,f.jsx)(`div`,{className:`w-8 h-8 rounded-lg flex items-center justify-center shrink-0`,style:{background:`${r}18`,border:`1px solid ${r}30`},children:(0,f.jsx)(n,{size:14,style:{color:r}})}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[e===`card`?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,f.jsxs)(`span`,{className:`text-sm text-primary font-medium`,children:[`â¢â¢â¢â¢ `,t.last4]}),(0,f.jsxs)(`span`,{className:`text-xs text-muted`,children:[String(t.expiry_month).padStart(2,`0`),`/`,String(t.expiry_year).slice(-2)]}),Bp(t.label)&&(0,f.jsxs)(`span`,{className:`text-xs text-muted`,children:[`· `,Bp(t.label)]}),zp(t)&&(0,f.jsx)(Vp,{}),t.is_default&&(0,f.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[11px] font-semibold px-1.5 py-0.5 rounded-full`,style:{background:`color-mix(in srgb, var(--accent) 12%, transparent)`,color:`var(--accent)`},children:[(0,f.jsx)($s,{size:10}),` Default`]})]}),t.cardholder_name&&(0,f.jsx)(`p`,{className:`text-[11px] text-faint mt-0.5`,children:t.cardholder_name})]}):e===`payto`?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,f.jsx)(`span`,{className:`text-sm text-primary font-medium`,children:t.bank_last4?`Bank account â¢â¢â¢â¢ ${t.bank_last4}`:`Bank account`}),t.bank_bsb&&(0,f.jsxs)(`span`,{className:`text-xs text-muted`,children:[`BSB `,t.bank_bsb]}),(0,f.jsx)(`span`,{className:`text-[10px] font-semibold px-1.5 py-0.5 rounded-full bg-elevated border border-edge text-muted`,children:t.method_type===`becs`?`BSB debit`:`PayTo`}),t.pending&&(t.payto_status===`failed`?(0,f.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[11px] font-semibold px-1.5 py-0.5 rounded-full`,style:{background:`rgba(244,63,94,0.14)`,color:`#fb7185`},children:[(0,f.jsx)(Y,{size:10}),` Not authorised`]}):(0,f.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[11px] font-semibold px-1.5 py-0.5 rounded-full`,style:{background:`rgba(245,158,11,0.14)`,color:`#fbbf24`},children:[(0,f.jsx)(ac,{size:10}),` Pending authorisation`]})),zp(t)&&(0,f.jsx)(Vp,{}),t.is_default&&(0,f.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[11px] font-semibold px-1.5 py-0.5 rounded-full`,style:{background:`color-mix(in srgb, var(--accent) 12%, transparent)`,color:`var(--accent)`},children:[(0,f.jsx)($s,{size:10}),` Default`]})]}),Bp(t.label)&&(0,f.jsx)(`p`,{className:`text-[11px] text-faint mt-0.5`,children:Bp(t.label)})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,f.jsx)(`span`,{className:`text-sm text-primary font-medium font-mono`,children:t.agreement_id}),zp(t)&&(0,f.jsx)(Vp,{}),t.is_default&&(0,f.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[11px] font-semibold px-1.5 py-0.5 rounded-full`,style:{background:`color-mix(in srgb, var(--accent) 12%, transparent)`,color:`var(--accent)`},children:[(0,f.jsx)($s,{size:10}),` Default`]})]}),Bp(t.label)&&(0,f.jsx)(`p`,{className:`text-[11px] text-faint mt-0.5`,children:Bp(t.label)})]}),zp(t)&&(0,f.jsx)(Hp,{method:t}),t.payto_status===`failed`&&(0,f.jsx)(Up,{})]}),!p&&(0,f.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[!t.is_default&&!t.pending&&(0,f.jsx)(`button`,{onClick:()=>s(t.id),disabled:u===t.id,className:`text-[11px] text-muted hover:text-primary transition-colors whitespace-nowrap disabled:pointer-events-none`,children:u===t.id?(0,f.jsx)(X,{size:12,className:`animate-spin text-muted`}):`Set default`}),(0,f.jsx)(`button`,{onClick:()=>c(t),disabled:l===t.id,className:`w-7 h-7 flex items-center justify-center rounded-lg text-muted hover:text-rose-400 transition-colors disabled:opacity-40`,children:(0,f.jsx)(rl,{size:13})})]})]},t.id))}),a&&m]})}function Gp({gcAvailable:e=!1,ppAvailable:t=!1,payToAvailable:n=!1,bpay:r=null,canEdit:i=!0}){let a=!i,[o,s]=(0,l.useState)([]),[c,u]=(0,l.useState)(!0),[d,p]=(0,l.useState)(null),[m,h]=(0,l.useState)(`payto`),[g,_]=(0,l.useState)(null),[v,y]=(0,l.useState)(null),[b,x]=(0,l.useState)(null),[S,C]=(0,l.useState)(null),[w,T]=(0,l.useState)(null),[E,D]=(0,l.useState)(!1),[O,k]=(0,l.useState)(!1),[A,j]=(0,l.useState)(!1),[M,N]=(0,l.useState)(!1),[P,F]=(0,l.useState)(null),[I,L]=(0,l.useState)(!1),[R,z]=(0,l.useState)(null),[B,V]=(0,l.useState)({agreement_id:``,label:``}),[H,U]=(0,l.useState)(null),[W,G]=(0,l.useState)(!1),ee=(0,l.useCallback)(()=>Z(`/api/portal/payment-methods`).then(e=>{e.ok&&s(e.methods||[]),u(!1)}),[]);(0,l.useEffect)(()=>{ee(),sessionStorage.getItem(`portal:gc_success`)&&(sessionStorage.removeItem(`portal:gc_success`),D(!0)),sessionStorage.getItem(`portal:pp_success`)&&(sessionStorage.removeItem(`portal:pp_success`),k(!0));let e=sessionStorage.getItem(`portal:pp_error`);e&&(sessionStorage.removeItem(`portal:pp_error`),z(e))},[ee]);function te(){p(null),U(null),V({agreement_id:``,label:``}),h(`payto`)}let[ne,re]=(0,l.useState)(null);async function K(e){re(e),U(null);let t=await Z(`/api/portal/payment-methods/${e}/default`,{method:`PATCH`});t?.ok||U(t?.error||`Could not set that as your default payment method.`),await ee(),re(null)}function ie(e){if(e.method_type===`gocardless`){y(e),x(null);return}C(e),T(null)}async function q(){if(!S)return;_(S.id),T(null);let e=await Z(`/api/portal/payment-methods/${S.id}`,{method:`DELETE`});_(null),e.ok?(C(null),ee()):T(e.error||`Failed to remove the payment method.`)}async function ae(){if(!v)return;_(v.id),x(null);let e=await Z(`/api/portal/payment-methods/${v.id}`,{method:`DELETE`});_(null),e.ok?(y(null),ee()):x(e.error||`Failed to cancel mandate.`)}async function oe(e){N(!0),F(null);let t=await Z(`/api/portal/gocardless/start`,{method:`POST`,body:JSON.stringify({label:e})});
146N(!1),t.ok?window.location.href=t.redirectUrl:F(t.error||`Failed to start GoCardless setup.`)}async function se(e){L(!0),z(null);let t=await Z(`/api/portal/paypal/start`,{method:`POST`,body:JSON.stringify({label:e})});L(!1),t.ok?(sessionStorage.setItem(`portal:pp_ba_token`,t.baToken||``),sessionStorage.setItem(`portal:pp_session`,t.sessionToken||``),sessionStorage.setItem(`portal:pp_label`,e||``),window.location.href=t.redirectUrl):z(t.error||`Failed to start PayPal setup.`)}let ce=`w-full rounded-lg px-3 py-2.5 text-sm text-primary bg-elevated border border-edge outline-none focus:border-accent transition-colors`,le=o.filter(e=>!e.method_type||e.method_type===`card`||e.source===`stripe`),ue=o.filter(e=>e.method_type===`paypal`),de=o.filter(e=>e.method_type===`payto`||e.method_type===`becs`),fe=o.filter(e=>e.method_type===`gocardless`);return c?(0,f.jsx)(`div`,{className:`py-8 text-sm text-muted text-center`,children:`Loadingâ¦`}):(0,f.jsxs)(`div`,{className:`space-y-4`,children:[(0,f.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-wider text-muted`,children:`Payment Methods`}),H&&d===null&&(0,f.jsx)(`p`,{className:`text-xs text-rose-400`,role:`alert`,children:H}),(0,f.jsx)(Wp,{type:`card`,title:`Credit Cards`,icon:sc,iconColor:`#3b82f6`,methods:le,adding:d===`card`,setAdding:p,readOnly:a,onSetDefault:K,onDelete:ie,deleting:g,settingDefault:ne,children:(0,f.jsx)(td,{onCancel:te,onSaved:()=>{te(),ee()}})}),(t||ue.length>
1460)&&(0,f.jsx)(Wp,{type:`paypal`,title:`PayPal`,icon:fl,iconColor:`#0070ba`,methods:ue,adding:d===`paypal`,setAdding:t?p:null,readOnly:a,onSetDefault:K,onDelete:ie,deleting:g,settingDefault:ne,disabled:!t,children:(0,f.jsxs)(`div`,{className:`p-4 space-y-4 border-t border-edge`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-sm font-semibold text-primary mb-1`,children:`Link your PayPal account`}),(0,f.jsx)(`p`,{className:`text-xs text-muted`,children:`You'll be taken to PayPal to authorise future payments. Your PayPal login is handled by PayPal â we never see your password.`})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`label`,{className:`block text-xs font-medium mb-1 text-muted`,children:[`Label `,(0,f.jsx)(`span`,{className:`text-faint font-normal`,children:`(optional â e.g. "Personal PayPal")`})]}),(0,f.jsx)(`input`,{value:B.label,onChange:e=>V(t=>({...t,label:e.target.value})),placeholder:`e.g. Personal PayPal`,className:ce})]}),R&&(0,f.jsx)(`p`,{className:`text-xs text-rose-400`,children:R}),(0,f.jsxs)(`div`,{className:`flex gap-2`,children:[(0,f.jsx)(`button`,{type:`button`,onClick:te,className:`btn-secondary text-xs flex-1`,children:`Cancel`}),(0,f.jsx)(`button`,{type:`button`,onClick:()=>se(B.label),disabled:I,className:`flex-1 flex items-center justify-center gap-2 text-xs font-semibold px-4 py-2.5 rounded-lg text-white disabled:opacity-50 transition-colors`,style:{background:`#0070ba`},children:I?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(X,{size:13,className:`animate-spin`}),` Redirectingâ¦`]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(Js,{size:13}),` Continue to PayPal`]})})]}),(0,f.jsx)(`p`,{className:`text-[11px] text-faint`,children:`You'll be redirected back here once your PayPal account is linked.`})]})}),(n||de.length>0)&&(0,f.jsx)(Wp,{type:`payto`,title:`Bank Direct Debit`,icon:xc,iconColor:`#7c3aed`,methods:de,adding:d===`payto`,setAdding:n?p:null,readOnly:a,onSetDefault:K,onDelete:ie,deleting:g,settingDefault:ne,disabled:!n,children:(0,f.jsx)(td,{kind:m,onFallback:m===`payto`?()=>h(`becs`):null,onCancel:te,onSaved:()=>{te(),ee()}},m)}),r?.available&&r.billerCode&&(0,f.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface overflow-hidden`,children:[(0,f.jsxs)(`button`,{type:`button`,onClick:()=>G(e=>!e),className:`w-full flex items-center justify-between px-4 py-3 text-left hover:bg-hover transition-colors`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(xc,{size:15,style:{color:`#e11d48`}}),(0,f.jsx)(`span`,{className:`text-sm font-semibold text-primary`,children:`BPAY`})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`span`,{className:`text-[11px] text-faint`,children:`Manual payment`}),(0,f.jsx)(ec,{size:15,className:`text-muted transition-transform`,style:{transform:W?`rotate(180deg)`:`none`}})]})]}),W&&(0,f.jsxs)(`div`,{className:`px-4 py-3 space-y-3 border-t border-edge`,children:[(0,f.jsx)(`p`,{className:`text-xs text-muted`,children:`Pay any invoice from your bank's BillPay using the details below.`}),(0,f.jsxs)(`div`,{className:`flex flex-wrap gap-4`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-[11px] font-semibold uppercase tracking-wider text-faint mb-0.5`,children:`Biller Code`}),(0,f.jsx)(`p`,{className:`text-sm text-primary font-mono font-medium`,children:r.billerCode})]}),r.billerCode2&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-[11px] font-semibold uppercase tracking-wider text-faint mb-0.5`,children:`Biller Code (alt)`}),(0,f.jsx)(`p`,{className:`text-sm text-primary font-mono font-medium`,children:r.billerCode2})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-[11px] font-semibold uppercase tracking-wider text-faint mb-0.5`,children:`Reference`}),(0,f.jsx)(`p`,{className:`text-sm text-primary font-medium`,children:`Found on invoice`})]})]}),r.instructions&&(0,f.jsx)(`p`,{className:`text-[11px] text-faint border-t border-edge pt-2`,children:r.instructions}),(0,f.jsx)(`p`,{className:`text-[11px] text-faint`,children:`BPAY payments can take 3â5 business days to appear on your account.`})]})]}),(e||fe.length>0)&&(0,f.jsx)(Wp,{type:`gocardless`,title:`GoCardless (Direct Debit)`,icon:Qs,iconColor:`#00b67a`,methods:fe,adding:d===`gocardless`,setAdding:e?p:null,readOnly:a,onSetDefault:K,onDelete:ie,deleting:g,settingDefault:ne,disabled:!e,children:(0,f.jsxs)(`div`,{className:`p-4 space-y-4 border-t border-edge`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-sm font-semibold text-primary mb-1`,children:`Set up Direct Debit`}),(0,f.jsx)(`p`,{className:`text-xs text-muted`,children:`You'll be taken to GoCardless to securely authorise a Direct Debit mandate. Your bank details are entered on GoCardless â we never see them.`})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`label`,{className:`block text-xs font-medium mb-1 text-muted`,children:[`Label `,(0,f.jsx)(`span`,{className:`text-faint font-normal`,children:`(optional â e.g. "Business account")`})]}),(0,f.jsx)(`input`,{value:B.label,onChange:e=>V(t=>({...t,label:e.target.value})),placeholder:`e.g. Business account`,className:ce})]}),P&&(0,f.jsx)(`p`,{className:`text-xs text-rose-400`,children:P}),(0,f.jsxs)(`div`,{className:`flex gap-2`,children:[(0,f.jsx)(`button`,{type:`button`,onClick:te,className:`btn-secondary text-xs flex-1`,children:`Cancel`}),(0,f.jsx)(`button`,{type:`button`,onClick:()=>oe(B.label),disabled:M,className:`flex-1 flex items-center justify-center gap-2 text-xs font-semibold px-4 py-2.5 rounded-lg text-white disabled:opacity-50 transition-colors`,style:{background:`#00b67a`},children:M?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(X,{size:13,className:`animate-spin`}),` Redirectingâ¦`]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(Js,{size:13}),` Continue to GoCardless`]})})]}),(0,f.jsx)(`p`,{className:`text-[11px] text-faint`,children:`You'll be redirected back here once the mandate is authorised.`})]})}),o.length>0&&(0,f.jsx)(`p`,{className:`text-[11px] text-faint`,children:`Your default payment method will be charged for invoices. Others act as backups and will be tried if the primary fails.`}),O&&(0,f.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center p-4`,style:{background:`rgba(0,0,0,0.55)`},onClick:e=>{e.target===e.currentTarget&&k(!1)},children:(0,f.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface shadow-xl w-full max-w-sm p-6 space-y-4 text-center`,children:[(0,f.jsx)(`div`,{className:`w-14 h-14 roun
146ded-full flex items-center justify-center mx-auto`,style:{background:`#0070ba20`},children:(0,f.jsx)($s,{size:26,style:{color:`#0070ba`}})}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-base font-semibold text-primary`,children:`PayPal account linked`}),(0,f.jsx)(`p`,{className:`text-sm text-muted mt-1`,children:`Your PayPal account has been linked successfully. You can now use PayPal as a payment method for future invoices.`})]}),(0,f.jsx)(`button`,{onClick:()=>k(!1),className:`w-full text-sm font-semibold px-4 py-2.5 rounded-lg text-white transition-colors`,style:{background:`#0070ba`},children:`Done`})]})}),E&&(0,f.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center p-4`,style:{background:`rgba(0,0,0,0.55)`},onClick:e=>{e.target===e.currentTarget&&D(!1)},children:(0,f.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface shadow-xl w-full max-w-sm p-6 space-y-4 text-center`,children:[(0,f.jsx)(`div`,{className:`w-14 h-14 rounded-full flex items-center justify-center mx-auto`,style:{background:`#00b67a20`},children:(0,f.jsx)($s,{size:26,style:{color:`#00b67a`}})}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-base font-semibold text-primary`,children:`Direct Debit authorised`}),(0,f.jsx)(`p`,{className:`text-sm text-muted mt-1`,children:`Your bank account has been added successfully. You can now use Direct Debit as a payment method.`})]}),(0,f.jsx)(`button`,{onClick:()=>D(!1),className:`w-full text-sm font-semibold px-4 py-2.5 rounded-lg text-white transition-colors`,style:{background:`#00b67a`},children:`Done`})]})}),v&&(0,f.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center p-4`,style:{background:`rgba(0,0,0,0.55)`},onClick:e=>{e.target===e.currentTarget&&!g&&y(null)},children:(0,f.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface shadow-xl w-full max-w-sm p-6 space-y-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,f.jsx)(`div`,{className:`w-9 h-9 rounded-xl flex items-center justify-center shrink-0`,style:{background:`#ef444420`},children:(0,f.jsx)(rl,{size:16,style:{color:`#ef4444`}})}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-sm font-semibold text-primary`,children:`Cancel Direct Debit mandate?`}),(0,f.jsxs)(`p`,{className:`text-xs text-muted mt-1`,children:[`This will cancel mandate `,(0,f.jsx)(`span`,{className:`font-mono text-primary`,children:v.agreement_id}),v.label?` (${v.label})`:``,` in GoCardless and remove it from your account. This action cannot be undone.`]})]})]}),b&&(0,f.jsx)(`p`,{className:`text-xs text-rose-400`,children:b}),(0,f.jsxs)(`div`,{className:`flex gap-2 pt-1`,children:[(0,f.jsx)(`button`,{onClick:()=>{y(null),x(null)},disabled:!!g,className:`btn-secondary text-xs flex-1`,children:`Keep mandate`}),(0,f.jsx)(`button`,{className:`btn-danger`,onClick:ae,disabled:!!g,children:g?`Cancellingâ¦`:`Yes, cancel mandate`})]})]})}),S&&(()=>{let e=S,t=e.method_type===`card`||!e.method_type&&e.brand?`${e.brand||`Card`} ending ${e.last4}`:e.method_type===`paypal`?`this PayPal agreement`:e.method_type===`payto`||e.method_type===`becs`?`this bank direct debit`:`this payment method`;return(0,f.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center p-4`,style:{background:`rgba(0,0,0,0.55)`},onClick:e=>{e.target===e.currentTarget&&!g&&(C(null),T(null))},children:(0,f.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface shadow-xl w-full max-w-sm p-6 space-y-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,f.jsx)(`div`,{className:`w-9 h-9 rounded-xl flex items-center justify-center shrink-0`,style:{background:`#ef444420`},children:(0,f.jsx)(rl,{size:16,style:{color:`#ef4444`}})}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-sm font-semibold text-primary`,children:`Remove payment method?`}),(0,f.jsxs)(`p`,{className:`text-xs text-muted mt-1`,children:[`This will remove `,(0,f.jsx)(`span`,{className:`font-medium text-primary`,children:t}),` from your account. This action cannot be undone.`]})]})]}),w&&(0,f.jsx)(`p`,{className:`text-xs text-rose-400`,children:w}),(0,f.jsxs)(`div`,{className:`flex gap-2 pt-1`,children:[(0,f.jsx)(`button`,{onClick:()=>{C(null),T(null)},disabled:!!g,className:`btn-secondary text-xs flex-1`,children:`Keep it`}),(0,f.jsx)(`button`,{className:`btn-danger`,onClick:q,disabled:!!g,children:g?`Removingâ¦`:`Yes, remove`})]})]})})})()]})}var Kp={awaiting_auth:{label:`Awaiting your confirmation`,tone:`warn`},pending:{label:`Awaiting acceptance`,tone:`warn`},accepted:{label:`Accepted`,tone:`ok`},completed:{label:`Completed`,tone:`ok`}
146,declined:{label:`Declined`,tone:`bad`},cancelled:{label:`Cancelled`,tone:`muted`},expired:{label:`Expired`,tone:`muted`},failed:{label:`Failed`,tone:`bad`}},qp={ok:`var(--color-success, #16a34a)`,warn:`var(--color-warning, #d97706)`,bad:`var(--color-danger, #dc2626)`,muted:`var(--text-faint)`};function Jp({status:e}){let t=Kp[e]||{label:e,tone:`muted`};return(0,f.jsx)(`span`,{style:{fontSize:`0.7rem`,fontWeight:600,padding:`0.15rem 0.5rem`,borderRadius:999,color:qp[t.tone],border:`1px solid ${qp[t.tone]}`,whiteSpace:`nowrap`},children:t.label})}function Yp({items:e}){let t=(t,n,r)=>{let i=e.filter(e=>e.type===t);return i.length?(0,f.jsxs)(`div`,{style:{marginTop:`0.5rem`},children:[(0,f.jsxs)(`p`,{className:`text-xs font-semibold text-muted`,style:{display:`flex`,alignItems:`center`,gap:`0.35rem`,margin:`0 0 0.25rem`},children:[(0,f.jsx)(r,{size:13,className:`text-faint`}),n]}),(0,f.jsx)(`ul`,{style:{margin:0,paddingLeft:`1.1rem`},children:i.map(e=>(0,f.jsxs)(`li`,{className:`text-xs text-primary`,style:{margin:`0.15rem 0`},children:[e.label,e.skipReason&&(0,f.jsxs)(`span`,{className:`text-faint`,children:[` â not moved (`,e.skipReason,`)`]})]},`${e.type}-${e.id}`))})]},t):null};return(0,f.jsxs)(`div`,{children:[t(`service`,`Services`,Ic),t(`domain`,`Domains`,gc),t(`invoice`,`Unpaid invoices`,fc)]})}function Xp({transfer:e,onConfirmed:t,onClose:n}){let[r,i]=(0,l.useState)(`loading`),[a,o]=(0,l.useState)(null),[s,c]=(0,l.useState)([]),[u,d]=(0,l.useState)(``),[p,m]=(0,l.useState)(``),[h,g]=(0,l.useState)(!1),[_,v]=(0,l.useState)(``),y=(0,l.useRef)(!1),b=(0,l.useCallback)(async(n,r)=>{g(!0),v(``);try{let i=await Id(r),a=await Z(`/api/portal/transfers/${e.id}/auth/verify`,{method:`POST`,body:JSON.stringify({sessionId:n,credential:i})});a.ok?t(a.transfer):v(a.error||`Confirmation failed.`)}catch(e){v(e.message||`Passkey confirmation was cancelled.`)}finally{g(!1)}},[e.id,t]);(0,l.useEffect)(()=>{y.current||(y.current=!0,Z(`/api/portal/transfers/${e.id}/auth/start`,{method:`POST`}).then(e=>{if(!e.ok){i(`error`),v(e.error||`Could not start confirmation.`);return}i(e.method),o(e.sessionId||null),c(e.providers||[]),d(e.sentTo||``),e.method===`passkey`&&b(e.sessionId,e.passkeyOptions)}).catch(()=>{i(`error`),v(`Could not start confirmation.`)}))},[e.id,b]);async function x(n){n.preventDefault(),g(!0),v(``);let r=await Z(`/api/portal/transfers/${e.id}/auth/verify`,{method:`POST`,body:JSON.stringify({sessionId:a,code:p.trim()})});g(!1),r.ok?t(r.transfer):v(r.error||`Invalid code.`)}async function S(t){g(!0),v(``);try{sessionStorage.setItem(`portal:pending-transfer`,String(e.id))}catch{}let n=await Z(`/api/portal/transfers/${e.id}/auth/oauth/${t}`,{method:`POST`});g(!1),n.ok&&n.url?window.location.href=n.url:v(n.error||`Could not start sign-in.`)}return(0,f.jsx)(`div`,{style:{position:`fixed`,inset:0,background:`rgba(0,0,0,0.55)`,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`1rem`,zIndex:70},onClick:h?void 0:n,children:(0,f.jsxs)(`div`,{style:{background:`var(--bg-surface)`,border:`1px solid var(--border)`,borderRadius:14,padding:`1.5rem`,width:`100%`,maxWidth:440},onClick:e=>e.stopPropagation(),children:[(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,justifyContent:`space-between`,gap:`1rem`,marginBottom:`0.75rem`},children:[(0,f.jsx)(`h2`,{style:{fontSize:`1.05rem`,fontWeight:700,color:`var(--text-primary)`,margin:0},children:`Confirm this transfer`}),(0,f.jsx)(`button`,{onClick:n,disabled:h,style:{background:`none`,border:`none`,cursor:`pointer`,color:`var(--text-muted)`},children:(0,f.jsx)(pl,{size:18})})]}),(0,f.jsxs)(`p`,{className:`text-xs text-muted`,style:{margin:`0 0 1rem`,lineHeight:1.55},children:[`You are about to hand `,(0,f.jsxs)(`strong`,{className:`text-primary`,children:[e.items.length,` item`,e.items.length===1?``:`s`]}),` to`,` `,(0,f.jsx)(`strong`,{className:`text-primary`,children:e.toEmail}),`. Because this changes who owns and pays for them, please sign in again.`]}),r===`loading`&&(0,f.jsxs)(`p`,{className:`text-xs text-muted`,style:{display:`flex`,alignItems:`center`,gap:`0.5rem`},children:[(0,f.jsx)(X,{size:14,className:`animate-spin`}),` Preparingâ¦`]}),r===`passkey`&&(0,f.jsxs)(`div`,{style:{textAlign:`center`,padding:`0.5rem 0`},children:[(0,f.jsx)(Fs,{size:30,style:{color:`var(--accent)`}}),(0,f.jsx)(`p`,{className:`text-sm text-primary`,style:{margin:`0.6rem 0 0.25rem`,fontWeight:600},children:`Use your passkey`}),(0,f.jsx)(`p`,{className:`text-xs text-muted`,style:{margin:0},children:`Follow the prompt from your device.`}),!h&&(0,f.jsx)(`button`,{className:`btn-secondary`,style:{marginTop:`0.9rem`},onClick:()=>{Z(`/api/portal/transfers/${e.id}/auth/start`,{method:`POST`}).then(e=>{e.ok&&e.method===`passkey`&&b(e.sessionId,e.passkeyOptions)})},children:`Try again`})]}),r===`oauth`&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-xs text-muted`,style:{margin:`0 0 0.7rem`},children:`Confirm with the account you sign in with:`}),s.map(e=>(0,f.jsxs)(`button`,{disabled:h,onClick:()=>S(e.id),className:`btn-secondary`,style:{display:`flex`,alignItems:`center`,gap:`0.6rem`,width:`100%`,justifyContent:`center`,marginBottom:`0.5rem`},children:[(0,f.jsx)(Rd,{id:e.id,size:16}),` Continue with `,e.name]},e.id))]}),r===`email`&&(0,f.jsxs)(`form`,{onSubmit:x,children:[(0,f.jsxs)(`p`,{className:`text-xs text-muted`,style:{margin:`0 0 0.6rem`},children:[`We emailed a 6-digit code to `,(0,f.jsx)(`strong`,{className:`text-primary`,children:u}),`.`]}),(0,f.jsx)(`input`,{value:p,onChange:e=>m(e.target.value.replace(/\D/g,``).slice(0,6)),inputMode:`numeric`,autoFocus:!0,placeholder:`000000`,className:`w-full rounded-lg px-3 py-2.5 text-primary bg-elevated border border-edge`,style:{fontFamily:`monospace`,fontSize:`1.4rem`,letterSpacing:`0.4em`,textAlign:`center`}}),(0,f.jsx)(`button`,{type:`submit`,disabled:h||p.length!==6,className:`btn-primary`,style:{width:`100%`,marginTop:`0.8rem`},children:h?`Confirmingâ¦`:`Confirm and send transfer`})]}
146),r===`error`&&(0,f.jsx)(`p`,{className:`text-xs`,style:{color:`var(--color-danger, #dc2626)`,margin:0},children:_}),r!==`error`&&_&&(0,f.jsx)(`p`,{className:`text-xs`,style:{color:`var(--color-danger, #dc2626)`,marginTop:`0.7rem`},children:_})]})})}function Zp({client:e,onTransfersChanged:t,focusTransferId:n=null}){let[r,i]=(0,l.useState)(null),[a,o]=(0,l.useState)(null),[s,c]=(0,l.useState)(!0),[u,d]=(0,l.useState)(!1),[p,m]=(0,l.useState)([]),[h,g]=(0,l.useState)([]),[_,v]=(0,l.useState)([]),[y,b]=(0,l.useState)(``),[x,S]=(0,l.useState)(``),[C,w]=(0,l.useState)(!1),[T,E]=(0,l.useState)(``),[D,O]=(0,l.useState)(null),[k,A]=(0,l.useState)(null),[j,M]=(0,l.useState)(``),N=(0,l.useCallback)(()=>Z(`/api/portal/transfers`).then(e=>{e.ok&&(o(e),t?.(e))}).catch(()=>{}),[t]),P=(0,l.useCallback)((e,t)=>{let n=new URLSearchParams;return e?.length&&n.set(`services`,e.join(`,`)),t?.length&&n.set(`domains`,t.join(`,`)),Z(`/api/portal/transfers/eligible?${n}`).then(e=>{e.ok&&i(e)}).catch(()=>{})},[]);(0,l.useEffect)(()=>{Promise.all([P([],[]),N()]).finally(()=>c(!1))},[P,N]),(0,l.useEffect)(()=>u?(P(p,h).then(()=>{}),()=>{}):void 0,[u,p,h,P]),(0,l.useEffect)(()=>{if(!r)return;let e=new Set(r.invoices.filter(e=>e.transferable&&!e.locked).map(e=>e.id));v(t=>t.filter(t=>e.has(t)))},[r]);let F=e=>t=>e(e=>e.includes(t)?e.filter(e=>e!==t):[...e,t]);function I(){d(!1),m([]),g([]),v([]),b(``),S(``),E(``),M(``)}async function L(e){e.preventDefault(),w(!0),E(``);let t=await Z(`/api/portal/transfers`,{method:`POST`,body:JSON.stringify({toEmail:y.trim(),note:x,serviceIds:p,domainIds:h,invoiceIds:_})});if(w(!1),!t.ok){E(t.error||`Could not start the transfer.`);return}O(t.transfer)}async function R(e){if(!confirm(`Cancel this transfer? Nothing will move and the recipient will no longer be able to accept it.`))return;let t=await Z(`/api/portal/transfers/${e}/cancel`,{method:`POST`});t.ok?(A({tone:`ok`,msg:`Transfer cancelled.`}),N(),P(p,h)):A({tone:`bad`,msg:t.error||`Could not cancel that transfer.`})}async function z(e,t){if(t===`accept`&&!confirm(`Accept this transfer? These services, domains and invoices become yours, and you will be billed for their future renewals.`)||t===`decline`&&!confirm(`Decline this transfer? Nothing will move and the sender will be notified.`))return;w(!0);let n=await Z(`/api/portal/transfers/${e}/${t}`,{method:`POST`});if(w(!1),!n.ok){A({tone:`bad`,msg:n.error||`Could not complete that action.`});return}if(t===`accept`){let e=[n.moved.services?`${n.moved.services} service(s)`:null,n.moved.domains?`${n.moved.domains} domain(s)`:null,n.moved.invoices?`${n.moved.invoices} invoice(s)`:null].filter(Boolean).join(`, `)||`nothing`,t=n.skipped?.length?` ${n.skipped.length} item(s) could not be moved: ${n.skipped.map(e=>`${e.label} (${e.reason})`).join(`; `)}.`:``;A({tone:n.skipped?.length?`warn`:`ok`,msg:`Transfer accepted â ${e} moved to your account.${t}`})}else A({tone:`ok`,msg:`Transfer declined. The sender has been notified.`});N()}if(s)return(0,f.jsx)(`div`,{className:`rounded-xl p-6 bg-surface border border-edge text-sm text-muted`,children:`Loading transfersâ¦`});let B=a?.canTransfer!==!1,V=a?.inbound||[],H=a?.outbound||[],U=V.filter(e=>e.status===`pending`),W=[...V.filter(e=>e.status!==`pending`),...H.filter(e=>![`awaiting_auth`,`pending`].includes(e.status))].sort((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)),G=H.filter(e=>[`awaiting_auth`,`pending`].includes(e.status)),ee=p.length+h.length,te=j.trim().toLowerCase(),ne=e=>!te||(e.label||``).toLowerCase().includes(te),re=(r?.services||[]).filter(ne),K=(r?.domains||[]).filter(ne),ie=(r?.services?.length||0)+(r?.domains?.length||0),q=(e,t,n,r,i,a)=>(0,f.jsxs)(`label`,{style:{display:`flex`,alignItems:`flex-start`,gap:`0.7rem`,padding:`0.65rem 0.75rem`,borderRadius:10,border:`1px solid var(--border)`,marginBottom:`0.4rem`,background:e?`var(--bg-elevated)`:`transparent`,cursor:n?`not-allowed`:`pointer`,opacity:n?.5:1},children:[(0,f.jsx)(`input`,{type:`checkbox`,checked:e,disabled:n,onChange:t,style:{marginTop:`0.15rem`}}),(0,f.jsxs)(`span`,{style:{flex:1,minWidth:0},children:[(0,f.jsx)(`span`,{className:`text-sm text-primary`,style:{display:`block`,fontWeight:500,wordBreak:`break-word`},children:r}),i&&(0,f.jsx)(`span`,{className:`text-xs text-muted`,style:{display:`block`,marginTop:`0.1rem`},children:i})]}),a&&(0,f.jsx)(`span`,{className:`text-xs text-muted`,style:{whiteSpace:`nowrap`},children:a})]});return(0,f.jsxs)(`div`,{className:`space-y-5`,children:[k&&(0,f.jsx)(`div`,{className:`rounded-xl p-4 border`,style:{borderColor:qp[k.tone],background:`var(--bg-surface)`},children:(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:`0.6rem`},children:[k.tone===`ok`?(0,f.jsx)(Is,{size:16,style:{color:qp.ok,flexShrink:0,marginTop:2}}):(0,f.jsx)(Y,{size:16,style:{color:qp[k.tone],flexShrink:0,marginTop:2}}),(0,f.jsx)(`p`,{className:`text-sm text-primary`,style:{margin:0,flex:1},children:k.msg}),(0,f.jsx)(`button`,{onClick:()=>A(null),style:{background:`none`,border:`none`,cursor:`pointer`,color:`var(--text-muted)`},children:(0,f.jsx)(pl,{size:15})})]})}),U.length>0&&(0,f.jsxs)(`div`,{className:`rounded-xl p-5 bg-surface border`,style:{borderColor:qp.warn},children:[(0,f.jsxs)(`h2`,{className:`text-base font-semibold text-primary`,style:{display:`flex`,alignItems:`center`,gap:`0.5rem`,margin:`0 0 0.35rem`},children:[(0,f.jsx)(qs,{size:16,style:{color:qp.warn}}),`Incoming transfer`,U.length>1?`s`:``]}),(0,f.jsx)(`p`,{className:`text-xs text-muted`,style:{margin:`0 0 1rem`},children:`Accepting makes these part of your account â you'll be billed for their future renewals.`}),U.map(e=>(0,f.jsxs)(`div`,{id:`transfer-${e.id}`,className:`rounded-lg p-4 border border-edge`,style:{marginBottom:`0.6rem`,background:String(n)===String(e.id)?`var(--bg-elevated)`:`transparent`},children:[(0,f.jsxs)(`div`,{style:{display:`flex`,flexWrap:`wrap`,alignItems:`center`,gap:`0.5rem`,justifyContent:`space-between`},children:[(0,f.jsxs)(`span`,{className:`text-sm text-primary`,style:{fontWeight:600},children:[`From `,e.fromName]}),(0,f.jsxs)(`span`,{className:`text-xs text-faint`,children:[`expires `,Q(e.expiresAt)]})]}),e.note&&(0,f.jsxs)(`p`,{className:`text-xs text-muted`,style:{margin:`0.5rem 0 0`,fontStyle:`italic`},children:[`â`,e.note,`â`]}),(0,f.jsx)(Yp,{items:e.items}),e.counts.invoice>0&&(0,f.jsxs)(`p`,{className:`text-xs`,style:{color:qp.warn,margin:`0.6rem 0 0`},children:[`This transfer includes `,e.counts.invoice,` unpaid invoice`,e.counts.invoice===1?``:`s`,` that will become payable by you.`]}),(0,f.jsxs)(`div`,{style:{display:`flex`,gap:`0.5rem`,marginTop:`0.9rem`,flexWrap:`wrap`},children:[(0,f.jsx)(`button`,{className:`btn-success`,disabled:C,onClick:()=>z(e.id,`accept`),children:`Accept transfer`}),(0,f.jsx)(`button`,{className:`btn-secondary`,disabled:C,onClick:()=>z(e.id,`decline`),children:`Decline`})]})]},e.id))]}),G.length>0&&(0,f.jsxs)(`div`,{className:`rounded-xl p-5 bg-surface border border-edge`,children:[(0,f.jsx)(`h2`,{className:`text-base font-semibold text-primary`,style:{margin:`0 0 0.9rem`},children:`Transfers in progress`}),G.map(e=>(0,f.jsxs)(`div`,{className:`rounded-lg p-4 border border-edge`,style:{marginBottom:`0.6rem`},children:[(0,f.jsxs)(`div`,{style:{display:`flex`,flexWrap:`wrap`,alignItems:`center`,gap:`0.5rem`,justifyContent:`space-between`},children:[(0,f.jsxs)(`span`,{className:`text-sm text-primary`,style:{fontWeight:600,wordBreak:`break-all`},children:[`To `,e.toEmail]}),(0,f.jsx)(Jp,{status:e.status})]}),(0,f.jsxs)(`p`,{className:`text-xs text-muted`,style:{margin:`0.35rem 0 0`},children:[e.status===`awaiting_auth`?`Not sent yet â confirm it to notify the recipient.`:e.toExists?`The recipient has been emailed and can accept it in their portal.`:`The recipient has been emailed a link to create an account and accept.`,` `,`Expires `,Q(e.expiresAt),`.`]}
146),(0,f.jsx)(Yp,{items:e.items}),(0,f.jsxs)(`div`,{style:{display:`flex`,gap:`0.5rem`,marginTop:`0.9rem`,flexWrap:`wrap`},children:[e.status===`awaiting_auth`&&(0,f.jsx)(`button`,{className:`btn-primary`,onClick:()=>O(e),children:`Confirm and send`}),(0,f.jsx)(`button`,{className:`btn-secondary`,onClick:()=>R(e.id),children:`Cancel transfer`})]})]},e.id))]}),B?u?(0,f.jsxs)(`form`,{onSubmit:L,className:`rounded-xl p-5 bg-surface border border-edge space-y-5`,children:[(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:`1rem`},children:[(0,f.jsx)(`h2`,{className:`text-base font-semibold text-primary`,style:{margin:0},children:`New transfer`}),(0,f.jsx)(`button`,{type:`button`,className:`btn-secondary`,onClick:I,children:`Cancel`})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-sm font-semibold text-primary`,style:{margin:`0 0 0.15rem`},children:`1. Choose what to transfer`}),(0,f.jsx)(`p`,{className:`text-xs text-muted`,style:{margin:`0 0 0.7rem`},children:`Select the services and domains that should move to the new customer.`}),ie>4&&(0,f.jsxs)(`div`,{className:`relative`,style:{margin:`0 0 0.7rem`,maxWidth:320},children:[(0,f.jsx)(qc,{size:14,className:`absolute left-2.5 top-1/2 -translate-y-1/2 text-faint pointer-events-none`}),(0,f.jsx)(`input`,{value:j,onChange:e=>M(e.target.value),placeholder:`Filter by domain or service nameâ¦`,className:`w-full pl-8 pr-3 py-1.5 rounded-lg text-sm bg-elevated border border-edge text-primary placeholder:text-faint focus:outline-none focus:border-accent`})]}),re.length>0&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`p`,{className:`text-xs font-semibold text-muted`,style:{margin:`0.6rem 0 0.35rem`},children:`Services`}),re.map(e=>q(p.includes(e.id),()=>F(m)(e.id),e.locked,e.label,`${e.status} · ${e.billingcycle||`â`}${e.nextduedate?` · next due ${Q(e.nextduedate)}`:``}${e.locked?` · already in another transfer`:``}`,$(e.amount)))]}),K.length>0&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`p`,{className:`text-xs font-semibold text-muted`,style:{margin:`0.9rem 0 0.35rem`},children:`Domains`}),K.map(e=>q(h.includes(e.id),()=>F(g)(e.id),e.locked,e.label,`${e.status}${e.expirydate?` · expires ${Q(e.expirydate)}`:``}${e.locked?` · already in another transfer`:``}`,$(e.amount)))]}),te&&re.length===0&&K.length===0&&(0,f.jsxs)(`p`,{className:`text-xs text-faint`,style:{margin:`0.4rem 0 0`},children:[`No services or domains match â`,j,`â.`]})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-sm font-semibold text-primary`,style:{margin:`0 0 0.15rem`},children:`2. Unpaid invoices`}),(0,f.jsx)(`p`,{className:`text-xs text-muted`,style:{margin:`0 0 0.7rem`},children:`Tick any unpaid invoices that should become the new customer's responsibility. An invoice can only move when every charge on it relates to something you're transferring.`}),ee?r?.invoices.length?r.invoices.map(e=>q(_.includes(e.id),()=>F(v)(e.id),!e.transferable||e.locked,`Invoice ${e.number}`,e.locked?`Already in another transfer`:e.transferable?`Due ${Q(e.duedate)} · ${e.lineCount} line item${e.lineCount===1?``:`s`}`:e.reason,$(e.total))):(0,f.jsx)(`p`,{className:`text-xs text-faint`,style:{margin:0},children:`You have no unpaid invoices.`}):(0,f.jsx)(`p`,{className:`text-xs text-faint`,style:{margin:0},children:`Choose a service or domain first.`})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-sm font-semibold text-primary`,style:{margin:`0 0 0.15rem`},children:`3. Who is receiving them?`}),(0,f.jsx)(`p`,{className:`text-xs text-muted`,style:{margin:`0 0 0.7rem`},children:`If they're already a Network Dynamics customer they'll see the transfer in their portal. If not, we'll invite them to create an account so they can accept it.`}),(0,f.jsx)(`label`,{className:`block text-xs font-medium mb-1 text-muted`,children:`Recipient email address`}),(0,f.jsx)(`input`,{type:`email`,required:!0,value:y,onChange:e=>b(e.target.value),placeholder:`[email protected]`,className:`w-full rounded-lg px-3 py-2.5 text-sm text-primary bg-elevated border border-edge`}),(0,f.jsx)(`label`,{className:`block text-xs font-medium mb-1 mt-3 text-muted`,children:`Message (optional)`}),(0,f.jsx)(`textarea`,{value:x,onChange:e=>S(e.target.value.slice(0,500)),rows:3,placeholder:`Anything the recipient should know about this handover.`,className:`w-full rounded-lg px-3 py-2.5 text-sm text-primary bg-elevated border border-edge`})]}),(0,f.jsx)(`div`,{className:`rounded-lg p-3.5 border border-edge`,style:{background:`var(--bg-elevated)`},children:(0,f.jsxs)(`p`,{className:`text-xs text-muted`,style:{margin:0,lineHeight:1.6},children:[(0,f.jsx)(`strong`,{className:`text-primary`,children:`Before you confirm:`}),` transferred services and domains leave your account and are billed to the recipient from their next renewal. This can't be und
146one from the portal â ask the new owner to transfer them back. Domain `,(0,f.jsx)(`strong`,{className:`text-primary`,children:`registrant contact details are not changed`}),`; a separate Change of Registrant may be required.`]})}),T&&(0,f.jsx)(`p`,{className:`text-xs`,style:{color:`var(--color-danger, #dc2626)`,margin:0},children:T}),(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`0.75rem`,flexWrap:`wrap`},children:[(0,f.jsx)(`button`,{type:`submit`,className:`btn-primary`,disabled:C||!ee||!y.trim(),children:C?`Preparingâ¦`:`Continue to confirmation`}),(0,f.jsxs)(`span`,{className:`text-xs text-muted`,children:[ee,` item`,ee===1?``:`s`,_.length?` + ${_.length} invoice${_.length===1?``:`s`}`:``,` selected`]})]})]}):(0,f.jsxs)(`div`,{className:`rounded-xl p-5 bg-surface border border-edge`,children:[(0,f.jsx)(`h2`,{className:`text-base font-semibold text-primary`,style:{margin:`0 0 0.35rem`},children:`Transfer services to another customer`}),(0,f.jsx)(`p`,{className:`text-xs text-muted`,style:{margin:`0 0 1rem`,lineHeight:1.6,maxWidth:640},children:`Move services, domains and their unpaid invoices to another Network Dynamics customer â for example when you sell a business or hand a client's hosting back to them. Nothing moves until they accept.`}),(0,f.jsx)(`button`,{className:`btn-primary`,onClick:()=>d(!0),disabled:!r?.services.length&&!r?.domains.length,children:`Start a transfer`}),!r?.services.length&&!r?.domains.length&&(0,f.jsx)(`p`,{className:`text-xs text-faint`,style:{margin:`0.7rem 0 0`},children:`You have no active services or domains to transfer.`})]}):(0,f.jsx)(`div`,{className:`rounded-xl p-5 bg-surface border border-edge`,children:(0,f.jsx)(`p`,{className:`text-sm text-muted`,style:{margin:0},children:`Only the account owner can transfer services and domains to another customer.`})}),W.length>0&&(0,f.jsxs)(`div`,{className:`rounded-xl p-5 bg-surface border border-edge`,children:[(0,f.jsx)(`h2`,{className:`text-base font-semibold text-primary`,style:{margin:`0 0 0.9rem`},children:`Transfer history`}),W.map(e=>(0,f.jsxs)(`div`,{className:`border-b border-edge`,style:{padding:`0.6rem 0`},children:[(0,f.jsxs)(`div`,{style:{display:`flex`,flexWrap:`wrap`,alignItems:`center`,gap:`0.5rem`,justifyContent:`space-between`},children:[(0,f.jsxs)(`span`,{className:`text-sm text-primary`,children:[e.direction===`outbound`?(0,f.jsxs)(f.Fragment,{children:[`To `,(0,f.jsx)(`strong`,{children:e.toName||e.toEmail})]}):(0,f.jsxs)(f.Fragment,{children:[`From `,(0,f.jsx)(`strong`,{children:e.fromName})]}),(0,f.jsxs)(`span`,{className:`text-faint`,children:[` · `,e.items.length,` item`,e.items.length===1?``:`s`]})]}),(0,f.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:`0.5rem`},children:[(0,f.jsx)(`span`,{className:`text-xs text-faint`,children:Q(e.completedAt||e.respondedAt||e.createdAt)}),(0,f.jsx)(Jp,{status:e.status})]})]}),e.items.some(e=>e.skipReason)&&(0,f.jsxs)(`p`,{className:`text-xs`,style:{color:qp.warn,margin:`0.3rem 0 0`},children:[`Some items could not be moved: `,e.items.filter(e=>e.skipReason).map(e=>`${e.label} (${e.skipReason})`).join(`; `),`.`]})]},`${e.direction}-${e.id}`))]}),D&&(0,f.jsx)(Xp,{transfer:D,onClose:()=>{O(null),N()},onConfirmed:()=>{O(null),I(),A({tone:`ok`,msg:`Transfer sent. Weâve emailed the recipient â nothing moves until they accept.`}),N(),P([],[])}})]})}function Qp(e=0){let t=new Date,n=(t.getMonth()>=6?t.getFullYear():t.getFullYear()-1)+e;return{from:`${n}-07-01`,to:`${n+1}-06-30`,label:`FY ${n}/${String(n+1).slice(2)}`}}function $p(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}function em(){let e=new Date,t=Qp(0),n=Qp(-1),r=new Date(e);r.setFullYear(r.getFullYear()-1);let i=new Date(e);return i.setMonth(i.getMonth()-3),[{id:`fy`,label:t.label+` (current)`,from:t.from,to:$p(e)},{id:`lastfy`,label:n.label,from:n.from,to:n.to},{id:`12m`,label:`Last 12 months`,from:$p(r),to:$p(e)},{id:`3m`,label:`Last 3 months`,from:$p(i),to:$p(e)}]}function tm({detail:e}){let t=e?.invoice,n=t?.items||[],r=(e,t,n={})=>(0,f.jsxs)(`div`,{className:`grid grid-cols-[1fr_7rem] gap-3 px-3 py-1.5 text-xs`,children:[(0,f.jsx)(`span`,{className:`text-right text-muted`,children:e}),(0,f.jsx)(`span`,{className:`text-right font-semibold`,style:{color:n.color||`var(--text-primary)`},children:t})]});return(0,f.jsx)(`div`,{className:`px-4 pb-4 pt-3 border-t border-edge`,style:{background:`var(--bg-elevated)`},children:!e||e.loading?(0,f.jsx)(`p`,{className:`text-xs text-muted py-2`,children:`Loading invoiceâ¦`}):e.error?(0,f.jsx)(`p`,{className:`text-xs py-2`,style:{color:`#f87171`},children:e.error}):(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted`,children:[(0,f.jsxs)(`span`,{children:[`Invoice `,(0,f.jsx)(`span`,{className:`text-primary font-semibold`,children:_d(t)})]}),(0,f.jsxs)(`span`,{children:[`Issued `,Q(t.date)]}),t.duedate&&(0,f.jsxs)(`span`,{children:[`Due `,Q(t.duedate)]}),(0,f.jsxs)(`span`,{children:[`Status `,(0,f.jsx)(`span`,{className:`text-primary font-semibold`,children:t.status})]}),t.datepaid&&(0,f.jsxs)(`span`,{children:[`Paid `,Q(t.datepaid)]}),t.public_id&&(0,f.jsxs)(`a`,{href:vl(t.public_id),target:`_blank`,rel:`noopener`,onClick:e=>e.stopPropagation(),className:`ml-auto inline-flex items-center gap-1 font-semibold text-primary hover:opacity-80`,children:[(0,f.jsx)(cc,{size:12}),` PDF`]})]}),(0,f.jsxs)(`div`,{className:`rounded-lg border border-edge overflow-hidden`,style:{background:`var(--bg-surface)`},children:[n.length===0?(0,f.jsx)(`p`,{className:`px-3 py-2.5 text-xs text-faint`,children:`No line items recorded on this invoice.`}):n.map((e,t)=>(0,f.jsxs)(`div`,{className:`grid grid-cols-[1fr_7rem] gap-3 px-3 py-2 text-xs border-b border-edge last:border-b-0`,children:[(0,f.jsx)(`span`,{className:`text-primary`,children:e.description}),(0,f.jsx)(`span`,{className:`text-right text-primary`,children:$(e.amount)})]},e.id??t)),(0,f.jsxs)(`div`,{className:`border-t border-edge py-1`,style:{background:`var(--bg-elevated)`},children:[parseFloat(t.discount||0)>0&&r(`Reseller discount${parseFloat(t.discount_pct)>0?` (${parseFloat(t.discount_pct)}%)`:``}`,`â ${$(t.discount)}`,{color:`#22c55e`}),parseFloat(t.tax||0)>0&&(0,f.jsxs)(f.Fragment,{children:[r(`Subtotal`,$(t.subtotal)),r(`GST (${parseFloat(t.taxrate)||
14610}%)`,$(t.tax))]}),r(`Total`,$(t.total)),parseFloat(t.credit_applied||0)>0&&r(`Account credit applied`,`â ${$(t.credit_applied)}`,{color:`#22c55e`}),parseFloat(t.amount_paid||0)-parseFloat(t.credit_applied||0)>.005&&r(`Paid`,`â ${$(parseFloat(t.amount_paid)-parseFloat(t.credit_applied||0))}`,{color:`#22c55e`}),parseFloat(t.amount_refunded||0)>.005&&r(`Refunded`,`+ ${$(t.amount_refunded)}`),parseFloat(t.amount_paid||0)>.005&&r(`Amount due`,$(Sd(t)))]})]})]})})}function nm(){let e=em(),[t,n]=(0,l.useState)(()=>({from:e[0].from,to:e[0].to})),[r,i]=(0,l.useState)(`fy`),[a,o]=(0,l.useState)(`all`),[s,c]=(0,l.useState)(null),[u,d]=(0,l.useState)(!0),[p,m]=(0,l.useState)(``),[h,g]=(0,l.useState)(!1),[_,v]=(0,l.useState)(()=>localStorage.getItem(`portal:xero:account_code`)||`429`),[y,b]=(0,l.useState)(()=>localStorage.getItem(`portal:xero:tax_type`)||`GST on Expenses`),[x,S]=(0,l.useState)(50),[C,w]=(0,l.useState)(null),[T,E]=(0,l.useState)({});(0,l.useEffect)(()=>{localStorage.setItem(`portal:xero:account_code`,_)},[_]),(0,l.useEffect)(()=>{localStorage.setItem(`portal:xero:tax_type`,y)},[y]),(0,l.useEffect)(()=>{let e=!1;return Z(`/api/portal/statements?${new URLSearchParams({from:t.from,to:t.to,status:a})}`).then(t=>{e||(t.ok?(c(t),m(``)):m(t.error||`Could not load your statement.`),d(!1),S(50),w(null))}),()=>{e=!0}},[t.from,t.to,a]);function D(e,t){w(t=>t===e?null:e),!(!t||T[t])&&(E(e=>({...e,[t]:{loading:!0}})),Z(`/api/portal/invoices/${t}`).then(e=>E(n=>({...n,[t]:e.ok?{invoice:e.invoice}:{error:e.error||`Could not load this invoice.`}}))).catch(()=>E(e=>({...e,[t]:{error:`Could not load this invoice.`}}))))}function O(e){if(e.from===t.from&&e.to===t.to){i(e.id);return}d(!0),i(e.id),n({from:e.from,to:e.to})}function k(e,r){!r||t[e]===r||(d(!0),i(`custom`),n(t=>({...t,[e]:r})))}function A(e){e!==a&&(d(!0),o(e))}function j(e){let n={format:e,from:t.from,to:t.to,status:a};e===`xero`&&(n.account_code=_.trim(),n.tax_type=y);let r=bl(n);if(e===`pdf`){window.open(r,`_blank`,`noopener`);return}let i=document.createElement(`a`);i.href=r,i.rel=`noopener`,i.style.display=`none`,document.body.appendChild(i),i.click(),setTimeout(()=>i.remove(),1e3)}let M=s?.totals,N=s?.entries||[],P=N.slice(0,x),F=N.length>0,I=a!==`all`,L=(e,t,n={})=>(0,f.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface px-4 py-3`,children:[(0,f.jsx)(`p`,{className:`text-xs font-semibold text-muted mb-1`,children:e}),(0,f.jsx)(`p`,{className:`text-lg font-bold`,style:{color:n.color||`var(--text-primary)`},children:u?`â`:$(t)}),n.sub&&(0,f.jsx)(`p`,{className:`text-xs text-faint mt-0.5`,children:n.sub})]}),R=({id:e,icon:t,title:n,blurb:r,button:i,extra:a})=>(0,f.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface p-4 flex flex-col gap-3`,children:[(0,f.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,f.jsx)(`div`,{className:`flex items-center justify-center w-9 h-9 rounded-lg shrink-0`,style:{background:`color-mix(in srgb, var(--accent) 10%, transparent)`,border:`1px solid color-mix(in srgb, var(--accent) 20%, transparent)`},children:t}),(0,f.jsxs)(`div`,{className:`min-w-0`,children:[(0,f.jsx)(`p`,{className:`text-sm font-semibold text-primary`,children:n}),(0,f.jsx)(`p`,{className:`text-xs text-muted mt-0.5 leading-relaxed`,children:r})]})]}),a,(0,f.jsxs)(`button`,{className:`btn-secondary w-full mt-auto justify-center flex items-center gap-2 disabled:opacity-50`,disabled:u||!F,onClick:()=>j(e),children:[(0,f.jsx)(cc,{size:14}),i]})]},e);return(0,f.jsxs)(`div`,{className:`space-y-5`,children:[(0,f.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface p-4 space-y-3`,children:[(0,f.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,f.jsx)(`span`,{className:`text-xs font-semibold text-muted mr-1`,children:`Period`}),e.map(e=>(0,f.jsx)(`button`,{onClick:()=>O(e),className:`px-3 py-1.5 rounded-lg text-xs font-medium transition-colors`,style:{background:r===e.id?`var(--bg-elevated)`:`transparent`,color:r===e.id?`var(--text-primary)`:`var(--text-muted)`,border:`1px solid ${r===e.id?`var(--border)`:`transparent`}`},children:e.label},e.id))]}),(0,f.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-xs font-medium mb-1 text-muted`,children:`From`}),(0,f.jsx)(`input`,{type:`date`,value:t.from,max:t.to,onChange:e=>k(`from`,e.target.value),className:`rounded-lg px-3 py-2 text-sm text-primary bg-elevated border border-edge`})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-xs font-medium mb-1 text-muted`,children:`To`}),(0,f.jsx)(`input`,{type:`date`,value:t.to,min:t.from,onChange:e=>k(`to`,e.target.value),className:`rounded-lg px-3 py-2 text-sm text-primary bg-elevated border border-edge`})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-xs font-medium mb-1 text-muted`,children:`Invoices`}),(0,f.jsxs)(`select`,{value:a,onChange:e=>A(e.target.value),className:`rounded-lg px-3 py-2 text-sm text-primary bg-elevated border border-edge`,children:[(0,f.jsx)(`option`,{value:`all`,children:`All invoices`}),(0,f.jsx)(`option`,{value:`paid`,children:`Paid only`}),(0,f.jsx)(`option`,{value:`unpaid`,children:`Unpaid only`})]})]})]}),I&&(0,f.jsx)(`p`,{className:`text-xs text-faint`,children:`Filtered exports list the matching invoices only. Choose âAll invoicesâ for a full statement with payments and a running balance.`})]}),p&&(0,f.jsxs)(`div`,{className:`rounded-xl border p-4 flex items-center gap-2 text-sm`,style:{borderColor:`rgba(239,68,68,0.3)`,background:`rgba(239,68,68,0.08)`,color:`#f87171`},children:[(0,f.jsx)(Y,{size:16,className:`shrink-0`}),p]}),(0,f.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 ${I?`lg:grid-cols-3`:`lg:grid-cols-5`}`,children:[!I&&L(`Opening balance`,M?.openingBalance??0,{sub:`as at ${Q(t.from)}`}),L(I?`Total invoiced`:`Charges`,M?.invoiced??0,{sub:`${M?.invoiceCount??0} invoice${(M?.invoiceCount??0)===1?``:`s`}`}),L(`GST included`,M?.gst??0),I?L(`Outstanding`,M?.outstanding??0,{color:(M?.outstanding??0)>0?`#f59e0b`:void 0}):L(`Payments`,M?.paid??0,{color:`#22c55e`,sub:M?.refunded?`${$(M.refunded)} refunded`:void 0}
146),!I&&L(`Closing balance`,M?.closingBalance??0,{color:(M?.closingBalance??0)>0?`#f59e0b`:void 0,sub:`as at ${Q(t.to)}`})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h2`,{className:`text-sm font-bold text-primary mb-3`,children:`Download statement`}),(0,f.jsxs)(`div`,{className:`grid md:grid-cols-3 gap-3`,children:[R({id:`xero`,icon:(0,f.jsx)(xc,{size:16,style:{color:`var(--accent)`}}),title:`Xero (Bills import)`,blurb:`CSV in Xeroâs bill template. Import under Business â Bills to pay â Import. Amounts are GST-exclusive with GST added by the tax type.`,button:`Download Xero CSV`,extra:(0,f.jsxs)(`div`,{className:`rounded-lg border border-edge bg-elevated p-3 space-y-2`,children:[(0,f.jsxs)(`button`,{onClick:()=>g(e=>!e),className:`flex items-center gap-1 text-xs font-semibold text-muted hover:text-primary transition-colors`,children:[h?(0,f.jsx)(ec,{size:12}):(0,f.jsx)(nc,{size:12}),` Xero settings`]}),h?(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-xs font-medium mb-1 text-muted`,children:`Account code`}),(0,f.jsx)(`input`,{value:_,onChange:e=>v(e.target.value),placeholder:`429`,className:`w-full rounded-lg px-2.5 py-1.5 text-xs text-primary bg-surface border border-edge`}),(0,f.jsx)(`p`,{className:`text-[11px] text-faint mt-1`,children:`Must exist in your Xero chart of accounts.`})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-xs font-medium mb-1 text-muted`,children:`Tax type (GST lines)`}),(0,f.jsxs)(`select`,{value:y,onChange:e=>b(e.target.value),className:`w-full rounded-lg px-2.5 py-1.5 text-xs text-primary bg-surface border border-edge`,children:[(0,f.jsx)(`option`,{children:`GST on Expenses`}),(0,f.jsx)(`option`,{children:`GST Free Expenses`}),(0,f.jsx)(`option`,{children:`BAS Excluded`})]}),(0,f.jsx)(`p`,{className:`text-[11px] text-faint mt-1`,children:`GST-free invoices always export as âGST Free Expensesâ.`})]})]}):(0,f.jsxs)(`p`,{className:`text-[11px] text-faint`,children:[`Account code `,_||`â`,` · `,y]})]})}),R({id:`csv`,icon:(0,f.jsx)(fc,{size:16,style:{color:`var(--accent)`}}),title:`Spreadsheet (CSV)`,blurb:`Every invoice and payment in the period with a running balance. Opens in Excel, Numbers or Google Sheets.`,button:`Download CSV`}),R({id:`pdf`,icon:(0,f.jsx)(cc,{size:16,style:{color:`var(--accent)`}}),title:`Statement (PDF)`,blurb:`Printable statement of account with your details, a running balance and an aged-balance summary.`,button:`Open PDF`})]})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h2`,{className:`text-sm font-bold text-primary mb-3`,children:I?`Invoices`:`Account activity`}),u?(0,f.jsx)(`p`,{className:`text-sm text-muted py-8 text-center`,children:`Loadingâ¦`}):F?(0,f.jsxs)(`div`,{className:`rounded-xl border border-edge overflow-hidden bg-surface`,children:[(0,f.jsxs)(`div`,{className:`hidden sm:grid grid-cols-[1.25rem_6rem_5.5rem_1fr_7rem_7rem] gap-3 px-4 py-2.5 border-b border-edge bg-elevated text-xs font-semibold uppercase tracking-wide text-muted`,children:[(0,f.jsx)(`span`,{}),(0,f.jsx)(`span`,{children:`Date`}),(0,f.jsx)(`span`,{children:`Type`}),(0,f.jsx)(`span`,{children:`Description`}),(0,f.jsx)(`span`,{className:`text-right`,children:`Amount`}),(0,f.jsx)(`span`,{className:`text-right`,children:I?`Outstanding`:`Balance`})]}),!I&&(0,f.jsxs)(`div`,{className:`hidden sm:grid grid-cols-[1.25rem_6rem_5.5rem_1fr_7rem_7rem] gap-3 px-4 py-2.5 border-b border-edge text-xs text-faint`,children:[(0,f.jsx)(`span`,{}),(0,f.jsx)(`span`,{children:`â`}),(0,f.jsx)(`span`,{children:`Opening`}),(0,f.jsx)(`span`,{children:`Balance brought forward`}),(0,f.jsx)(`span`,{className:`text-right`,children:`â`}),(0,f.jsx)(`span`,{className:`text-right font-semibold text-muted`,children:$(M?.openingBalance??0)})]}),P.map((e,t)=>{let n=`${e.kind}-${e.ref}-${e.date}-${t}`,r=!!e.invoice_id,i=r&&C===n,a=e.invoice_id?T[e.invoice_id]:null,o=r?i?(0,f.jsx)(ec,{size:14,className:`text-muted`}):(0,f.jsx)(nc,{size:14,className:`text-muted`}):null,s=r?()=>D(n,e.invoice_id):void 0;return(0,f.jsxs)(`div`,{className:`border-b border-edge last:border-b-0`,children:[(0,f.jsxs)(`div`,{onClick:s,role:r?`button`:void 0,tabIndex:r?0:void 0,"aria-expanded":r?i:void 0,onKeyDown:r?(e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),s())}):void 0,className:`hidden sm:grid grid-cols-[1.25rem_6rem_5.5rem_1fr_7rem_7rem] gap-3 items-center px-4 py-3 text-sm transition-colors${r?` cursor-pointer hover:bg-elevated`:``}`,style:i?{background:`var(--bg-elevated)`}:void 0,children:[(0,f.jsx)(`span`,{className:`flex items-center`,children:o}),(0,f.jsx)(`span`,{className:`text-muted`,children:Q(e.date)}),(0,f.jsx)(`span`,{className:`text-muted capitalize`,children:e.kind}),(0,f.jsx)(`span`,{className:`text-primary truncate`,title:e.description,children:e.description}),(0,f.jsx)(`span`,{className:`text-right font-semibold`,style:{color:e.credit?`#22c55e`:`var(--text-primary)`},children:e.credit?`â ${$(e.credit)}`:$(e.debit)}),(0,f.jsx)(`span`,{className:`text-right text-muted`,children:I?e.outstanding==null?`â`:$(e.outstanding):$(e.balance)})]}),(0,f.jsxs)(`div`,{onClick:s,role:r?`button`:void 0,tabIndex:r?0:void 0,"aria-expanded":r?i:void 0,onKeyDown:r?(e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),s())}):void 0,className:`sm:hidden flex items-start justify-between gap-3 px-4 py-3`,style:i?{background:`var(--bg-elevated)`}:void 0,children:[(0,f.jsxs)(`div`,{className:`min-w-0 flex items-start gap-2`,children:[r&&(0,f.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:o}),(0,f.jsxs)(`div`,{className:`min-w-0`,children:[(0,f.jsx)(`div`,{className:`text-sm text-primary truncate`,children:e.description}),(0,f.jsxs)(`div`,{className:`text-xs text-muted mt-0.5`,children:[Q(e.date),I?e.outstanding==null?``:` · Outstanding ${$(e.outstanding)}`:` · Balance ${$(e.balance)}`]})]})]}),(0,f.jsx)(`span`,{className:`text-sm font-semibold shrink-0`,style:{color:e.credit?`#22c55e`:`var(--text-primary)`},children:e.credit?`â ${$(e.credit)}`:$(e.debit)})]}),i&&(0,f.jsx)(tm,{detail:a})]},n)}),N.length>P.length&&(0,f.jsxs)(`button`,{onClick:()=>S(e=>e+100),className:`w-full px-4 py-3 text-xs font-semibold text-muted hover:text-primary transition-colors border-t border-edge`,children:[`Show more (`,N.length-P.length,` remaining)`]}),(0,f.jsxs)(`div`,{className:`grid grid-cols-[1fr_auto] gap-3 px-4 py-3 border-t border-edge bg-elevated`,children:[(0,f.jsx)(`span`,{className:`text-sm font-semibold text-primary`,children:I?`Total outstanding`:`Closing balance`}),(0,f.jsx)(`span`,{className:`text-sm font-bold`,style:{color:((I?M?.outstanding:M?.closingBalance)??0)>0?`#f59e0b`:`var(--text-primary)`},children:$((I?M?.outstanding:M?.closingBalance)??0)})]})]}):(0,f.jsx)(`p`,{className:`text-sm text-muted text-center py-12 rounded-xl border border-edge bg-surface`,children:`No invoices or payments in this period.`})]}),!u&&s?.aging&&s.aging.current+s.aging.d1_30+s.aging.d31_60+s.aging.d61_90+s.aging.d90plus>0&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h2`,{className:`text-sm font-bold text-primary mb-3`,children:`Amounts outstanding`}),(0,f.jsx)(`div`,{className:`grid grid-cols-2 sm:grid-cols-5 ga
146p-3`,children:[[`Current`,s.aging.current,!1],[`1â30 days`,s.aging.d1_30,!0],[`31â60 days`,s.aging.d31_60,!0],[`61â90 days`,s.aging.d61_90,!0],[`90+ days`,s.aging.d90plus,!0]].map(([e,t,n])=>(0,f.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface px-3 py-2.5`,children:[(0,f.jsx)(`p`,{className:`text-xs font-semibold text-muted mb-1`,children:e}),(0,f.jsx)(`p`,{className:`text-sm font-bold`,style:{color:n&&t>0?`#f87171`:`var(--text-primary)`},children:$(t)})]},e))})]}),(0,f.jsx)(`p`,{className:`text-xs text-faint`,children:`Statements are generated from your invoices and receipted payments. If anything looks wrong, raise a support ticket and weâll reconcile it with you.`})]})}function rm({methods:e,value:t,onChange:n,onAddCard:r,adding:i,onCancelAdd:a,onCardSaved:o}){let s=e.filter(e=>e.chargeable!==!1),c=e.filter(e=>e.chargeable===!1),l=e=>e.method_type===`paypal`?fl:e.method_type===`payto`||e.method_type===`becs`||e.method_type===`gocardless`?xc:sc;return(0,f.jsxs)(`div`,{className:`space-y-2`,children:[s.map(e=>{let r=l(e),i=String(t)===String(e.id);return(0,f.jsxs)(`button`,{type:`button`,"aria-pressed":i,onClick:()=>n(e.id),className:`w-full flex items-center gap-3 rounded-xl px-3 py-2.5 text-left transition-colors bg-elevated`,style:{border:i?`1px solid var(--accent)`:`1px solid var(--border)`},children:[(0,f.jsx)(`span`,{className:`h-4 w-4 shrink-0 rounded-full flex items-center justify-center`,style:{border:`1px solid ${i?`var(--accent)`:`var(--border)`}`},children:i&&(0,f.jsx)(`span`,{className:`h-2 w-2 rounded-full`,style:{background:`var(--accent)`}})}),(0,f.jsx)(r,{size:16,className:`shrink-0 text-muted`}),(0,f.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,f.jsx)(`span`,{className:`block text-sm text-primary font-medium truncate`,children:nd(e)}),rd(e)&&(0,f.jsx)(`span`,{className:`block text-[11px] text-faint truncate`,children:rd(e)})]}),e.is_default&&(0,f.jsx)(`span`,{className:`shrink-0 text-[11px] font-semibold px-1.5 py-0.5 rounded-full`,style:{background:`color-mix(in srgb, var(--accent) 12%, transparent)`,color:`var(--accent)`},children:`Default`})]},e.id)}),c.map(e=>(0,f.jsxs)(`div`,{className:`w-full flex items-start gap-3 rounded-xl px-3 py-2.5 border border-dashed border-edge opacity-70`,children:[(0,f.jsx)(Y,{size:16,className:`shrink-0 mt-0.5 text-muted`}),(0,f.jsxs)(`div`,{className:`min-w-0`,children:[(0,f.jsx)(`div`,{className:`text-sm text-primary truncate`,children:nd(e)}),(0,f.jsx)(`div`,{className:`text-[11px] text-faint`,children:id(e)})]})]},e.id)),!i&&(0,f.jsxs)(`button`,{type:`button`,onClick:r,className:`w-full flex items-center justify-center gap-1.5 rounded-xl px-3 py-2.5 text-xs font-medium text-muted hover:text-primary border border-dashed border-edge transition-colors`,children:[(0,f.jsx)(Vc,{size:13}),` `,s.length?`Use a different card`:`Add a card`]}),i&&(0,f.jsx)(`div`,{className:`rounded-xl border border-edge bg-elevated overflow-hidden`,children:(0,f.jsx)(td,{kind:`card`,onCancel:a,onSaved:e=>o(e?.method_id)})})]})}function im({canTopUp:e=!0,onManagePaymentMethods:t}){let[n,r]=(0,l.useState)(null),[i,a]=(0,l.useState)([]),[o,s]=(0,l.useState)(null),[c,u]=(0,l.useState)(!1),[d,p]=(0,l.useState)(null),[m,h]=(0,l.useState)(null),[g,_]=(0,l.useState)(!1),[v,y]=(0,l.useState)(!1),[b,x]=(0,l.useState)(null),[S,C]=(0,l.useState)(!1),[w,T]=(0,l.useState)(null),E=(0,l.useCallback)(async()=>{let e=await Z(`/api/portal/credit`);r(e.ok?e:{balance:0,entries:[],pending:[],presets:[50,100,250,500]})},[]),D=(0,l.useCallback)(async e=>{let t=await Z(`/api/portal/payment-methods`),n=t.ok&&t.methods||[];a(n);let r=n.filter(e=>e.chargeable!==!1),i=e&&r.find(t=>String(t.id)===String(e))||r.find(e=>e.is_default)||r[0];i?(_(!1),h(i.id)):_(!0)},[]);(0,l.useEffect)(()=>{E()},[E]);let O=n?.presets?.length?n.presets:[50,100,250,500],k=n?.pending||[],A=e&&n?.canTopUp!==!1;async function j(e,t=null){if(x(null),C(!1),T(null),t){p({invoice_id:t.invoiceid,invoicenum:t.invoicenum,amount:t.amount}),D();return}u(!0);let n=await Z(`/api/portal/credit/topup`,{method:`POST`,body:JSON.stringify({amount:e})});if(u(!1),!n.ok){x(n.error||`We could not raise that invoice. Please try again.`);return}p({invoice_id:n.invoice_id,invoicenum:n.invoicenum,amount:n.amount}),D()}async function M(){if(v||!d)return;if(!m){x(`Choose a payment method first.`);return}y(!0),x(null),C(!1);let e=await cp(d.invoice_id,m);if(y(!1),e.ok){T({amount:e.amount??d.amount}),p(null),s(null),E();return}if(e.error_code===`no_gateway_token`){C(!0);return}x(e.error?`Payment failed â ${e.error}
146`:`Payment failed. Please try again or contact support.`)}function N(){p(null),s(null),x(null),C(!1),_(!1),E()}if(n===null)return(0,f.jsx)(`div`,{className:`py-8 text-sm text-muted text-center`,children:`Loadingâ¦`});let P=e=>e?new Date(e).toLocaleDateString(`en-AU`,{day:`numeric`,month:`short`,year:`numeric`}):`â`;return(0,f.jsxs)(`div`,{className:`space-y-4`,children:[(0,f.jsxs)(`div`,{className:`rounded-xl p-6 bg-surface border border-edge`,children:[(0,f.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-wider text-muted`,children:`Available credit`}),(0,f.jsx)(`p`,{className:`mt-1 text-4xl font-bold text-primary tabular-nums`,children:$(n.balance)}),(0,f.jsx)(`p`,{className:`mt-2 text-xs text-muted`,children:`Credit is applied to your invoices automatically as they fall due, oldest first. Anything left over stays on your account.`})]}),w&&(0,f.jsxs)(`div`,{className:`rounded-xl p-4 border flex items-start gap-2.5`,style:{background:`rgba(16,185,129,0.08)`,borderColor:`rgba(16,185,129,0.25)`},children:[(0,f.jsx)(Is,{size:16,className:`shrink-0 mt-0.5`,style:{color:`#34d399`}}),(0,f.jsxs)(`p`,{className:`text-sm`,style:{color:`#6ee7b7`},children:[$(w.amount),` added to your account credit. A receipt has been emailed to you.`]})]}),(0,f.jsxs)(`div`,{className:`rounded-xl bg-surface border border-edge overflow-hidden`,children:[(0,f.jsxs)(`div`,{className:`px-4 py-3 border-b border-edge flex items-center gap-2`,children:[(0,f.jsx)(fl,{size:14,className:`text-muted`}),(0,f.jsx)(`span`,{className:`text-sm font-semibold text-primary`,children:`Add credit`})]}),A?d?(0,f.jsxs)(`div`,{className:`p-4 space-y-4`,children:[(0,f.jsxs)(`div`,{className:`rounded-xl border border-edge bg-elevated px-3.5 py-3`,children:[(0,f.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,f.jsxs)(`span`,{className:`text-xs text-muted`,children:[`Invoice `,(0,f.jsx)(`span`,{className:`text-primary font-medium`,children:d.invoicenum||`#${d.invoice_id}`})]}),(0,f.jsx)(`span`,{className:`text-lg font-bold text-primary tabular-nums`,children:$(d.amount)})]}),(0,f.jsxs)(`p`,{className:`mt-1 text-[11px] text-faint`,children:[$(d.amount),` is added to your credit balance as soon as this is paid.`]})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-xs font-medium text-muted mb-2`,children:`Pay with`}),(0,f.jsx)(rm,{methods:i,value:m,onChange:e=>{h(e),x(null)},adding:g,onAddCard:()=>_(!0),onCancelAdd:()=>_(!1),onCardSaved:e=>D(e)})]}),S&&(0,f.jsxs)(`div`,{className:`rounded-xl border px-3.5 py-3 space-y-2`,style:{background:`rgba(245,158,11,0.08)`,borderColor:`rgba(245,158,11,0.25)`},children:[(0,f.jsx)(`p`,{className:`text-xs`,style:{color:`#fbbf24`},children:`That saved card isn't linked to our payment provider, so we can't charge it. Remove it and add it again â the same card is fine.`}),(0,f.jsxs)(`button`,{className:`btn-secondary text-xs flex items-center gap-1.5`,onClick:t,children:[(0,f.jsx)(sc,{size:13}),` Go to Payment Methods `,(0,f.jsx)(Js,{size:13})]})]}),b&&(0,f.jsx)(`p`,{className:`text-xs text-rose-400`,role:`alert`,children:b}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2 justify-end`,children:[(0,f.jsx)(`button`,{className:`btn-secondary text-sm`,onClick:N,disabled:v,children:`Cancel`}),(0,f.jsx)(`button`,{className:`btn-primary text-sm disabled:opacity-50`,onClick:M,disabled:v||!m,children:v?`Processingâ¦`:`Pay ${$(d.amount)}`})]})]}):(0,f.jsxs)(`div`,{className:`p-4 space-y-4`,children:[k.map(e=>(0,f.jsxs)(`div`,{className:`rounded-xl border border-edge bg-elevated px-3.5 py-3 flex items-center gap-3 flex-wrap`,children:[(0,f.jsx)(ac,{size:14,className:`shrink-0 text-muted`}),(0,f.jsxs)(`span`,{className:`text-xs text-secondary flex-1 min-w-0`,children:[`Invoice `,(0,f.jsx)(`span`,{className:`text-primary font-medium`,children:e.invoicenum||`#${e.invoiceid}`}),` for`,` `,(0,f.jsx)(`span`,{className:`text-primary font-medium`,children:$(e.amount)}),` of credit is waiting to be paid.`]}),(0,f.jsx)(`button`,{className:`btn-secondary text-xs`,onClick:()=>j(e.amount,e),children:`Pay it now`})]},e.id)),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-xs text-muted mb-2`,children:`Choose an amount. We'll raise an invoice for it and you can pay it right here.`}),(0,f.jsx)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-2`,children:O.map(e=>
146{let t=o===e;return(0,f.jsxs)(`button`,{type:`button`,"aria-pressed":t,onClick:()=>{s(e),x(null)},className:`rounded-xl py-3 text-base font-semibold transition-colors bg-elevated`,style:{border:t?`1px solid var(--accent)`:`1px solid var(--border)`,color:t?`var(--accent)`:`var(--text-primary)`,background:t?`color-mix(in srgb, var(--accent) 10%, transparent)`:void 0},children:[`$`,e]},e)})})]}),b&&(0,f.jsx)(`p`,{className:`text-xs text-rose-400`,role:`alert`,children:b}),(0,f.jsxs)(`div`,{className:`flex items-center justify-between gap-3 flex-wrap`,children:[(0,f.jsx)(`p`,{className:`text-[11px] text-faint`,children:`No GST is charged on a top-up â it's added to the services your credit later pays for.`}),(0,f.jsx)(`button`,{className:`btn-primary text-sm disabled:opacity-50`,disabled:!o||c,onClick:()=>j(o),children:c?`Raising invoiceâ¦`:o?`Add ${$(o)} credit`:`Add credit`})]})]}):(0,f.jsx)(`p`,{className:`px-4 py-4 text-xs text-muted`,children:`Adding credit needs Billing access on this account. A billing contact or the account owner can top it up.`})]}),(0,f.jsxs)(`div`,{className:`rounded-xl bg-surface border border-edge overflow-hidden`,children:[(0,f.jsx)(`div`,{className:`px-4 py-3 border-b border-edge`,children:(0,f.jsx)(`span`,{className:`text-sm font-semibold text-primary`,children:`Credit activity`})}),n.entries?.length?(0,f.jsx)(`ul`,{className:`divide-y divide-edge`,children:n.entries.map(e=>{let t=parseFloat(e.amount||0);return(0,f.jsxs)(`li`,{className:`flex items-center gap-3 px-4 py-3`,children:[(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsx)(`p`,{className:`text-sm text-primary truncate`,children:e.reason||(t>0?`Credit added`:`Credit applied`)}),(0,f.jsx)(`p`,{className:`text-[11px] text-faint`,children:P(e.created_at)})]}),(0,f.jsxs)(`span`,{className:`text-sm font-semibold tabular-nums shrink-0`,style:{color:t>0?`#34d399`:`var(--text-muted)`},children:[t>0?`+`:`â`,$(Math.abs(t))]})]},e.id)})}):(0,f.jsx)(`p`,{className:`px-4 py-4 text-xs text-muted`,children:`No credit has been added to or used on this account yet.`})]})]})}function am({client:e,setClient:t,initialTab:n=`details`,onTabChange:r,gcAvailable:i=!1,ppAvailable:a=!1,payToAvailable:o=!1,bpay:s=null,caps:c={},onTransfersChanged:u,focusTransferId:d=null}){let p=!c.readOnly&&c.billingEdit!==!1,m=c.paymentEditReal!==!1,[h,g]=(0,l.useState)(n);(0,l.useEffect)(()=>{g(n)},[n]);let[_,v]=(0,l.useState)({firstname:e.firstname||``,lastname:e.lastname||``,companyname:e.companyname||``,phonenumber:e.phonenumber||``,address1:e.address1||``,city:e.city||``,state:e.state||``,postcode:e.postcode||``,country:e.country||``}),[y,b]=(0,l.useState)(!1),[x,S]=(0,l.useState)(!1);async function C(e){e.preventDefault(),b(!0);let n=await Z(`/api/portal/account`,{method:`PUT`,body:JSON.stringify(_)});b(!1),n.ok&&(t(n.client),S(!0),setTimeout(()=>S(!1),3e3))}function w(e,t,n={}){return(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-xs font-medium mb-1 text-muted`,children:e}),(0,f.jsx)(`input`,{value:_[t],onChange:e=>v(n=>({...n,[t]:e.target.value})),disabled:!p,className:`w-full rounded-lg px-3 py-2.5 text-sm text-primary bg-elevated border border-edge disabled:opacity-60`,...n})]},t)}return(0,f.jsxs)(`div`,{className:`p-4 md:p-6 mx-auto`,style:{maxWidth:896},children:[(0,f.jsxs)(`h1`,{className:`text-2xl font-bold text-primary mb-6 flex items-center gap-2.5`,children:[(0,f.jsx)(dl,{size:22,className:`text-faint shrink-0`}),`Account`]}),(0,f.jsx)(`div`,{className:`flex gap-1 mb-6 rounded-xl p-1 bg-surface border border-edge w-fit`,children:[{id:`details`,label:`Billing Details`},{id:`payment`,label:`Payment Methods`},{id:`credits`,label:`Credits`},{id:`transfer`,label:`Transfer Services`}].map(e=>(0,f.jsx)(`button`,{onClick:()=>{g(e.id),r?.(e.id)},className:`px-4 py-1.5 rounded-lg text-sm font-medium transition-colors`,style:{background:h===e.id?`var(--bg-elevated)`:`transparent`,color:h===e.id?`var(--text-primary)`:`var(--text-muted)`,border:h===e.id?`1px solid var(--border)`:`1px solid transparent`},children:e.label},e.id))}),h===`details`&&(0,f.jsxs)(`form`,{onSubmit:C,className:`rounded-xl p-6 space-y-4 bg-surface border border-edge`,children:[w(`Company`,`companyname`,{placeholder:`Optional`}),(0,f.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[w(`First Name`,`firstname`),w(`
146Last Name`,`lastname`)]}),w(`Phone Number`,`phonenumber`),w(`Address`,`address1`),(0,f.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[w(`City`,`city`),w(`State`,`state`)]}),(0,f.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[w(`Postcode`,`postcode`),w(`Country`,`country`)]}),(0,f.jsxs)(`div`,{className:`flex items-center justify-between pt-2`,children:[x&&(0,f.jsx)(`span`,{className:`text-sm`,style:{color:`var(--color-success, #16a34a)`},children:`Changes saved!`}),p?(0,f.jsx)(`div`,{className:`ml-auto`,children:(0,f.jsx)(`button`,{type:`submit`,disabled:y,className:`px-5 py-2.5 rounded-lg text-sm font-semibold text-white disabled:opacity-50 bg-accent`,children:y?`Savingâ¦`:`Save changes`})}):(0,f.jsx)(`p`,{className:`ml-auto text-xs text-faint`,children:`Only Billing users and the account owner can edit these details.`})]})]}),h===`payment`&&(0,f.jsx)(Gp,{gcAvailable:i,ppAvailable:a,payToAvailable:o,bpay:s,canEdit:m}),h===`credits`&&(0,f.jsx)(im,{canTopUp:m,onManagePaymentMethods:()=>{g(`payment`),r?.(`payment`)}}),h===`transfer`&&(0,f.jsx)(Zp,{client:e,onTransfersChanged:u,focusTransferId:d})]})}function om(e){if(!e)return{label:`â`,days:null};let t=new Date(e);if(isNaN(t))return{label:e,days:null};let n=Math.floor((t-Date.now())/864e5);return{label:t.toLocaleDateString(`en-AU`,{day:`numeric`,month:`short`,year:`numeric`}),days:n}}function sm(e){let t=(e||``).toLowerCase();return t===`active`?{bg:`rgba(16,185,129,0.1)`,border:`rgba(16,185,129,0.25)`,color:`#6ee7b7`}:t===`expired`||t===`cancelled`?{bg:`rgba(239,68,68,0.1)`,border:`rgba(239,68,68,0.25)`,color:`#f87171`}:t===`pending`?{bg:`rgba(251,191,36,0.1)`,border:`rgba(251,191,36,0.25)`,color:`#fbbf24`}:t.startsWith(`pending`)?{bg:`rgba(56,189,248,0.1)`,border:`rgba(56,189,248,0.25)`,color:`#38bdf8`}:t===`transfer expired`?{bg:`rgba(239,68,68,0.1)`,border:`rgba(239,68,68,0.25)`,color:`#f87171`}:{bg:`rgba(255,255,255,0.05)`,border:`rgba(255,255,255,0.1)`,color:`var(--text-muted)`}}function cm({tone:e=`info`,title:t,children:n,action:r}){let i={info:{bg:`rgba(59,130,246,0.08)`,border:`rgba(59,130,246,0.25)`,color:`#60a5fa`},warning:{bg:`rgba(251,191,36,0.1)`,border:`rgba(251,191,36,0.25)`,color:`#fbbf24`},danger:{bg:`rgba(239,68,68,0.08)`,border:`rgba(239,68,68,0.25)`,color:`#f87171`}},a=i[e]||i.info;return(0,f.jsxs)(`div`,{style:{background:a.bg,border:`1px solid ${a.border}`,borderRadius:12,padding:`0.875rem 1rem`,marginBottom:`0.75rem`},children:[(0,f.jsx)(`div`,{style:{color:a.color,fontWeight:600,fontSize:`0.875rem`,marginBottom:`0.35rem`},children:t}),(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`,lineHeight:1.5},children:n}),r&&(0,f.jsx)(`div`,{style:{marginTop:`0.625rem`},children:r})]})}var lm=[{v:`8`,l:`8 - RSA/SHA-256`},{v:`10`,l:`10 - RSA/SHA-512`},{v:`13`,l:`13 - ECDSA P-256/SHA-256`},{v:`14`,l:`14 - ECDSA P-384/SHA-384`},{v:`15`,l:`15 - Ed25519`},{v:`16`,l:`16 - Ed448`}],um=[{v:`1`,l:`1 - SHA-1`},{v:`2`,l:`2 - SHA-256`},{v:`4`,l:`4 - SHA-384`}];function dm({dnssec:e,doAction:t,actioning:n}){let[r,i]=(0,l.useState)(!1),[a,o]=(0,l.useState)({keyTag:``,algorithm:`13`,digestType:`2`,digest:``}),s={background:`var(--bg-surface)`,border:`1px solid var(--border)`,borderRadius:12,padding:`1rem`,marginBottom:`0.75rem`},c={width:`100%`,padding:`0.45rem 0.7rem`,borderRadius:7,background:`var(--bg-elevated)`,border:`1px solid var(--border)`,color:`var(--text)`,fontSize:`0.8125rem`,boxSizing:`border-box`},u={display:`block`,fontSize:`0.8125rem`,color:`var(--text-muted)`,marginBottom:3};async function d(){!a.keyTag||!a.digest.trim()||(await t(`addDnssec`,{...a,digest:a.digest.trim()}))?.ok!==!1&&o({keyTag:``,algorithm:`13`,digestType:`2`,digest:``})}return(0,f.jsxs)(`div`,{style:s,children:[(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{style:{fontWeight:600,fontSize:`0.875rem`,marginBottom:`0.25rem`},children:`DNSSEC`}),(0,f.jsx)(`p`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`,lineHeight:1.5},children:`Protects against DNS spoofing. Add the DS record from your DNS provider.`})]}),(0,f.jsx)(`button`,{onClick:()=>i(e=>!e),style:{padding:`0.45rem 0.9rem`,borderRadius:7,fontSize:`0.8125rem`,fontWeight:600,cursor:`pointer`,flexShrink:0,marginLeft:`1rem`,background:r?`var(--btn-solid)`:`var(--bg-elevated)`,border:r?`1px solid var(--btn-solid)`:`1px solid var(--border)`,color:r?`var(--btn-solid-text)`:`var(--text-muted)`},children:r?`Close`:`View`})]}),r&&(0,f.jsxs)(`div`,{style:{marginTop:`0.85rem`,borderTop:`1px solid var(--border)`,paddingTop:`0.85rem`},children:[(0,f.jsxs)(`p`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`,marginBottom:`0.7rem`},children:[`Status: `,(0,f.jsx)(`strong`,{style:{color:e===`1`?`#6ee7b7`:`var(--text)`},children:e===`1`?`Enabled`:`Not enabled`})]}),(0,f.jsx)(`p`,{style:{fontSize:`0.8125rem`,fontWeight:600,marginBottom:`0.6rem`},children:`Add new DNS Security data`}),(0,f.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`0.6rem`},children:[(0,f.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:`0.5rem`},children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{style:u,children:`Key Tag`}),(0,f.jsx)(`input`,{type:`number`,min:`0`,value:a.keyTag,onChange:e=>o(t=>({...t,keyTag:e.target.value})),style:c,placeholder:`e.g. 12345`})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{style:u,children:`Algorithm`}),(0,f.jsx)(`select`,{value:a.algorithm,onChange:e=>o(t=>({...t,algorithm:e.target.value})),style:c,children:lm.map(e=>(0,f.jsx)(`option`,{value:e.v,children:e.l},e.v))})]})]}),(0,f.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:`0.5rem`},children:(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{style:u,children:`Digest Type`}
146),(0,f.jsx)(`select`,{value:a.digestType,onChange:e=>o(t=>({...t,digestType:e.target.value})),style:c,children:um.map(e=>(0,f.jsx)(`option`,{value:e.v,children:e.l},e.v))})]})}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{style:u,children:`Digest`}),(0,f.jsx)(`input`,{value:a.digest,onChange:e=>o(t=>({...t,digest:e.target.value})),style:{...c,fontFamily:`monospace`},placeholder:`DS record digest (hex)`})]}),(0,f.jsx)(`div`,{children:(0,f.jsx)(`button`,{className:`btn-primary`,onClick:d,disabled:!!n||!a.keyTag||!a.digest.trim(),children:n===`addDnssec`?`Addingâ¦`:`Add DNS Security data`})})]})]})]})}function fm(e,t){if(!t)return`custom`;let n=(e||[]).map(e=>String(e).trim().toLowerCase()).filter(Boolean);for(let e of[`cpanel`,`cloud`,`park`]){let r=(t[e]||[]).map(e=>e.toLowerCase());if(r.length&&r.every(e=>n.includes(e)))return e}return`custom`}var pm={cpanel:`cPanel cluster`,cloud:`Cloud Hosting cluster`,park:`Parked`};function mm({domain:e,onBack:t,setTab:n}){let[r,i]=(0,l.useState)(null),[a,o]=(0,l.useState)(!0),[s,c]=(0,l.useState)(null),[u,d]=(0,l.useState)(null),[p,m]=(0,l.useState)(!1),[h,g]=(0,l.useState)([``,``,``,``,``]),[_,v]=(0,l.useState)(null),[y,b]=(0,l.useState)(`cpanel`),[x,S]=(0,l.useState)(null),[C,w]=(0,l.useState)(null),[T,E]=(0,l.useState)(!1),[D,O]=(0,l.useState)(null),k=(0,l.useCallback)(async()=>{o(!0);let t=await Z(`/api/portal/domains/${encodeURIComponent(e)}`).catch(e=>({ok:!1,error:e.message}));i(t),t.nameservers&&g([...t.nameservers,``,``,``].slice(0,5));let n=fm(t.nameservers,t.nsPresets);v(e=>e??(n===`cpanel`||n===`cloud`?`nd`:n)),(n===`cpanel`||n===`cloud`)&&b(n),t.referralSlug&&S(t.referralSlug),o(!1)},[e]);(0,l.useEffect)(()=>{k()},[k]),(0,l.useEffect)(()=>{d(null);let t=String(r?.auRegistrantID||``).replace(/\s/g,``);e.endsWith(`.au`)&&/^\d{11}$/.test(t)&&Z(`/api/portal/abn-lookup?abn=${t}`).then(e=>d(e)).catch(()=>{})},[r?.auRegistrantID,e]);function A(e,t=!0){O({text:e,ok:t}),setTimeout(()=>O(null),3500)}async function j(t,n={}){c(t);let r=await Z(`/api/portal/domains/${encodeURIComponent(e)}`,{method:`POST`,body:JSON.stringify({action:t,...n})}).catch(e=>({ok:!1,error:e.message}));return r.ok?(A(r.message||`Done`),k()):A(r.error||`Action failed`,!1),c(null),r}async function M(e){e?.preventDefault?.();let t=h.map(e=>e.trim()).filter(Boolean);if(t.length<2){A(`At least 2 nameservers required`,!1);return}await j(`setNameservers`,{mode:`custom`,nameservers:t})}async function N(e){let t=await j(`setNameservers`,{mode:e});t?.ok&&e===`park`&&t.referralSlug&&S(t.referralSlug)}async function P(){E(!0);let t=await Z(`/api/portal/domains/${encodeURIComponent(e)}`,{method:`POST`,body:JSON.stringify({action:`getEppCode`})}).catch(e=>({ok:!1,error:e.message}));t.ok?w(t.eppCode):A(t.error||`Could not retrieve EPP code`,!1),E(!1)}let F={background:`var(--bg-surface)`,border:`1px solid var(--border)`,borderRadius:12,padding:`1rem`,marginBottom:`0.75rem`},I=(e,t,n,r)=>(0,f.jsx)(`button`,{onClick:t,disabled:!!s,style:{padding:`0.45rem 0.85rem`,borderRadius:7,fontSize:`0.8125rem`,fontWeight:600,cursor:`pointer`,opacity:s?.6:1,background:e?`var(--btn-solid)`:`var(--bg-elevated)`,border:e?`1px solid var(--btn-solid)`:`1px solid var(--border)`,color:e?`var(--btn-solid-text)`:`var(--text-muted)`},children:s===r?`â¦`:n});if(a)return(0,f.jsx)(`div`,{style:{padding:`2rem`,textAlign:`center`,color:`var(--text-muted)`},children:`Loadingâ¦`});if(!r?.ok)return(0,f.jsxs)(`div`,{style:{padding:`1.5rem`},children:[(0,f.jsx)(`button`,{onClick:t,style:{background:`none`,border:`none`,color:`var(--accent)`,cursor:`pointer`,marginBottom:`1rem`,fontSize:`0.8125rem`},children:`â Back`}),(0,f.jsx)(`p`,{style:{color:`#f87171`,fontSize:`0.875rem`},children:r?.error||`Failed to load domain info`})]});let{days:L}=om(r.expiry),R=L===null?`var(--text-muted)`:L<0?`#f87171`:L<30?`#fbbf24`:`var(--text-muted)`;sm(r.status);let z=r.transfer||null,B=r.manageable!==!1,V=r.registrar===`resellerclub`,H=z?.completeBy?new Date(String(z.completeBy).replace(` `,`T`)).toLocaleDateString(`en-AU`,{day:`numeric`,month:`short`,year:`numeric`}):null;return(0,f.jsxs)(`div`,{style:{padding:`1rem 1rem 4rem`,maxWidth:896,margin:`0 auto`}
146,children:[(0,f.jsxs)(`button`,{onClick:t,style:{display:`flex`,alignItems:`center`,gap:`0.4rem`,background:`none`,border:`none`,color:`var(--accent)`,cursor:`pointer`,marginBottom:`1rem`,fontSize:`0.8125rem`},children:[(0,f.jsx)(qs,{size:13}),` Back`]}),D&&(0,f.jsx)(`div`,{style:{marginBottom:`0.75rem`,padding:`0.6rem 1rem`,borderRadius:8,fontSize:`0.8125rem`,fontWeight:600,background:D.ok?`rgba(16,185,129,0.1)`:`rgba(239,68,68,0.1)`,border:`1px solid ${D.ok?`rgba(16,185,129,0.3)`:`rgba(239,68,68,0.3)`}`,color:D.ok?`#34d399`:`#f87171`},children:D.text}),z&&(z.phase===`pending`?(0,f.jsxs)(cm,{tone:`warning`,title:`Transfer in progress`,children:[`We've asked your current provider to release `,(0,f.jsx)(`strong`,{children:e}),`.`,` `,z.approvalEmail?(0,f.jsxs)(f.Fragment,{children:[`An approval email was sent to `,(0,f.jsx)(`strong`,{style:{color:`var(--text)`},children:z.approvalEmail}),`, and the transfer completes once it's approved.`]}):(0,f.jsx)(f.Fragment,{children:`An approval email was sent to the domain's registrant contact at your current provider, and the transfer completes once it's approved.`}),H&&(0,f.jsxs)(f.Fragment,{children:[` If it isn't approved by `,(0,f.jsx)(`strong`,{style:{color:`var(--text)`},children:H}),` the request expires and we'll need to start it again.`]})]}):(0,f.jsxs)(cm,{tone:`danger`,title:`Transfer didn't complete`,children:[z.approvalEmail?(0,f.jsxs)(f.Fragment,{children:[`The approval email sent to `,(0,f.jsx)(`strong`,{style:{color:`var(--text)`},children:z.approvalEmail}),` wasn't actioned in time, so the request expired and `,(0,f.jsx)(`strong`,{children:e}),` is still with your current provider.`]}):(0,f.jsxs)(f.Fragment,{children:[`The approval request for `,(0,f.jsx)(`strong`,{children:e}),` expired before it was actioned, so the domain is still with your previous provider. The approval email would have gone to the domain's registrant contact on record there.`]}),` `,`Contact us and we'll start the transfer again.`]})),(0,f.jsxs)(`div`,{style:{...F,display:`flex`,flexDirection:`column`,gap:`0.85rem`},children:[(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`0.75rem`},children:[(0,f.jsx)(gc,{size:20,style:{color:`#fb923c`,flexShrink:0}}),(0,f.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,f.jsx)(`p`,{style:{fontWeight:700,fontSize:`1rem`,wordBreak:`break-all`},children:e}),(0,f.jsxs)(`div`,{style:{display:`flex`,gap:`0.5rem`,flexWrap:`wrap`,marginTop:`0.35rem`,alignItems:`center`},children:[(0,f.jsx)(kd,{status:Ad(r.status)}),(r.locked===`1`||r.locked===`true`||r.locked===!0)&&!e.endsWith(`.au`)&&(0,f.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-semibold bg-indigo-500/15 text-indigo-400`,children:[(0,f.jsx)(`span`,{className:`text-[8px] leading-none`,children:`â`}),`Locked`]}),r.billingAutoRenew===!1&&(0,f.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-semibold bg-amber-500/15 text-amber-400`,children:[(0,f.jsx)(`span`,{className:`text-[8px] leading-none`,children:`â`}),`No auto-renew`]}),r.idProtect===`1`&&!e.endsWith(`.au`)&&(0,f.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-semibold bg-violet-500/15 text-violet-400`,children:[(0,f.jsx)(`span`,{className:`text-[8px] leading-none`,children:`â`}),`ID Protect`]})]})]}),(0,f.jsxs)(`div`,{style:{textAlign:`right`,flexShrink:0},children:[(0,f.jsx)(`p`,{style:{fontSize:`0.8125rem`,color:R,fontWeight:600},children:om(r.expiry).label}),L!==null&&(0,f.jsx)(`p`,{style:{fontSize:`0.8125rem`,color:R},children:L<0?`${Math.abs(L)}d ago`:`${L}d left`}),r.regPeriod>0&&(0,f.jsxs)(`p`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`,marginTop:`0.15rem`},children:[r.regPeriod,` year term`]})]})]}),B&&(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`1rem`,flexWrap:`wrap`,borderTop:`1px solid var(--border)`,paddingTop:`0.75rem`},children:[(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`0.5rem`},children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`span`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`,fontWeight:600},children:`Auto-renew`}),(0,f.jsx)(`span`,{style:{fontSize:`0.8125rem`,color:`var(--text-faint)`,dis
146play:`block`,lineHeight:1.3},children:r.billingAutoRenew===!1?`No renewal invoice - renew manually`:`Renewal invoice issued automatically`})]}),I(r.billingAutoRenew!==!1,()=>j(`setBillingAutoRenew`,{enabled:!0}),`On`,`setBillingAutoRenew`),I(r.billingAutoRenew===!1,()=>j(`setBillingAutoRenew`,{enabled:!1}),`Off`,`setBillingAutoRenew`)]}),r.termOptions?.length>1&&(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`0.5rem`},children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`span`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`,fontWeight:600},children:`Billing term`}),(0,f.jsx)(`span`,{style:{fontSize:`0.8125rem`,color:`var(--text-faint)`,display:`block`,lineHeight:1.3},children:`How many years each renewal covers`})]}),(0,f.jsx)(`select`,{value:r.regPeriod||1,disabled:s===`setBillingTerm`,onChange:e=>j(`setBillingTerm`,{years:parseInt(e.target.value,10)}),style:{background:`var(--bg-input, rgba(255,255,255,0.05))`,color:`var(--text-primary)`,border:`1px solid var(--border)`,borderRadius:8,padding:`0.35rem 0.5rem`,fontSize:`0.8125rem`,fontWeight:600},children:r.termOptions.map(e=>(0,f.jsxs)(`option`,{value:e,children:[e,` year`,e>1?`s`:``]},e))})]}),(0,f.jsx)(`div`,{style:{marginLeft:`auto`},children:(0,f.jsx)(hm,{domainName:e,expiry:r.expiry,doAction:j,actioning:s,flash:A,inline:!0})})]})]}),B&&r.contacts&&(0,f.jsx)(_m,{contacts:r.contacts,contactTypes:r.contactTypes,domainName:e,doAction:j,actioning:s,readOnly:V}),B&&e.endsWith(`.au`)&&(r.auRegistrantName||r.auRegistrantID)&&(0,f.jsxs)(`div`,{style:F,children:[(0,f.jsxs)(`div`,{style:{padding:`0.6rem 1rem`,borderBottom:`1px solid var(--border)`,display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:[(0,f.jsx)(`p`,{style:{fontWeight:600,color:`var(--text-muted)`,textTransform:`uppercase`,letterSpacing:`0.06em`,fontSize:`0.8125rem`},children:`.au Eligibility`}),r.abnStatus&&(0,f.jsxs)(`span`,{style:{fontSize:`0.8125rem`,fontWeight:600,padding:`0.15rem 0.5rem`,borderRadius:9999,background:r.abnStatus===`Active`?`rgba(16,185,129,0.12)`:`rgba(239,68,68,0.12)`,color:r.abnStatus===`Active`?`#34d399`:`#f87171`,border:`1px solid ${r.abnStatus===`Active`?`rgba(16,185,129,0.25)`:`rgba(239,68,68,0.25)`}`},children:[`ABN `,r.abnStatus]})]}),r.abnStatus&&r.abnStatus!==`Active`&&(0,f.jsx)(`div`,{style:{padding:`0.65rem 1rem`,background:`rgba(239,68,68,0.05)`,borderBottom:`1px solid rgba(239,68,68,0.12)`},children:(0,f.jsxs)(`p`,{style:{fontSize:`0.8125rem`,color:`rgba(252,165,165,0.9)`,lineHeight:1.5},children:[`â ï¸ Your ABN appears to be `,(0,f.jsx)(`strong`,{children:r.abnStatus}),`. Australian .au domain registrations require an active ABN. Please contact us or update your registrant details to avoid suspension.`,r.abnCheckedAt&&` (Checked ${new Date(r.abnCheckedAt).toLocaleDateString(`en-AU`,{day:`numeric`,month:`short`,year:`numeric`})})`]})}),(0,f.jsxs)(`div`,{style:{padding:`0.75rem 1rem`,display:`flex`,flexDirection:`column`,gap:`0.45rem`},children:[[[`Registrant`,r.auRegistrantName],[`ID Type`,r.auRegistrantIDType],[`Registrant ID`,r.auRegistrantID],[`Eligibility Type`,r.auEligibilityType],[`Policy`,r.auPolicyIDDesc]].filter(([,e])=>e).map(([e,t])=>(0,f.jsxs)(`div`,{style:{display:`flex`,gap:`0.75rem`,fontSize:`0.8125rem`},children:[(0,f.jsx)(`span`,{style:{color:`var(--text-muted)`,width:100,flexShrink:0},children:e}),(0,f.jsx)(`span`,{style:{color:`var(--text)`,wordBreak:`break-all`},children:t})]},e)),r.abnCheckedAt&&r.abnStatus===`Active`&&(0,f.jsxs)(`div`,{style:{display:`flex`,gap:`0.75rem`,fontSize:`0.8125rem`},children:[(0,f.jsx)(`span`,{style:{color:`var(--text-muted)`,width:100,flexShrink:0},children:`ABN Checked`}),(0,f.jsx)(`span`,{style:{color:`var(--text)`},children:new Date(r.abnCheckedAt).toLocaleDateString(`en-AU`,{day:`numeric`,month:`short`,year:`numeric`})})]})]}),u&&u.ok&&u.status&&u.status!==`Active`&&(0,f.jsxs)(`div`,{style:{margin:`0 1rem 1rem`,padding:`0.7rem 0.85rem`,borderRadius:8,background:`rgba(239,68,68,0.08)`,border:`1px solid rgba(239,68,68,0.25)`},children:[(0,f.jsx)(`p`,{style:{fontSize:`0.8125rem`,color:`#f87171`,fontWeight:600,marginBottom:`0.3rem`},children:`â ABN not active`}),(0,f.jsxs)(`p`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`,lineHeight:1.5,marginBottom:`0.6rem`},children:[`The ABN `,(0,f.jsx)(`strong`,{style:{color:`var(--text)`},children:u.abn}),` registered for this .au domain shows as `,(0,f.jsx)(`strong`,{style:{color:`#f87171`},children:u.status}),` with the ABR. .au domains require an active ABN - it needs to be activated or updated to keep this domain eligible.`]}),(0,f.jsx)(`a`,{href:`https://www.abr.gov.au/business-super-funds-charities/updating-or-cancelling-your-abn`,target:`_blank`,rel:`noreferrer`,style:{display:`inline-block`,padding:`0.45rem 0.9rem`,borderRadius:7,background:`rgba(239,68,68,0.15)`,border:`1px solid rgba(239,68,68,0.3)`,color:`#f87171`,fontWeight:600,fontSize:`0.8125rem`,textDecoration:`none`},children:`Update your ABN â`})]}),(0,f.jsx)(gm,{domainName:e,cor:r.cor,reload:k,setTab:n})]}),B&&(()=>{let e=r.nsPresets||{},t=fm(r.nameservers,e),n=s===`setNameservers`,i=x?`${window.location.origin}/?ref=${x}`:``,a=e=>({border:`1px solid ${e?`var(--accent)`:`var(--border)`}`,background:e?`color-mix(in srgb, var(--accent) 8%, transparent)`:`var(--bg-elevated)`,borderRadius:9,padding:`0.7rem 0.85rem`,cursor:`pointer`}),o=e=>(0,f.jsx)(`span`,{style:{width:15,height:15,borderRadius:`50%`,border:`2px solid ${e?`var(--accent)`:`var(--text-muted)`}`,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,flexShrink:0,marginTop:2},children:e&&(0,f.jsx)(`span`,{style:{width:7,height:7,borderRadius:`50%`,background:`var(--accent)`}})}),c=(e,t,r)=>(0,f.jsx)(`button`,{className:`btn-primary`,style:{marginTop:`0.7rem`},onClick:t,disabled:n||r,children:n?`Applyingâ¦`:e});return(0,f.jsxs)(`div`,{style:F,children:[(0,f.jsx)(`p`,{style:{fontWeight:600,fontSize:`0.875rem`,marginBottom:`0.2rem`}
146,children:`Nameservers`}),(0,f.jsxs)(`p`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`,marginBottom:`0.75rem`},children:[`Current: `,(0,f.jsx)(`span`,{style:{fontFamily:`monospace`,color:`var(--text)`},children:(r.nameservers||[]).join(`, `)||`none`}),pm[t]&&(0,f.jsx)(`span`,{style:{marginLeft:6,fontSize:`0.8125rem`,padding:`0.1rem 0.4rem`,borderRadius:20,background:`var(--bg-surface)`,border:`1px solid var(--border)`,color:`var(--text-muted)`},children:pm[t]})]}),(0,f.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`0.5rem`},children:[(0,f.jsx)(`div`,{style:a(_===`nd`),onClick:()=>v(`nd`),children:(0,f.jsxs)(`div`,{style:{display:`flex`,gap:`0.6rem`,alignItems:`flex-start`},children:[o(_===`nd`),(0,f.jsxs)(`div`,{style:{flex:1},children:[(0,f.jsx)(`p`,{style:{fontSize:`0.83rem`,fontWeight:600,color:`var(--text)`},children:`Use Network Dynamics nameservers`}),(0,f.jsx)(`p`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`},children:`Point your domain at our hosting DNS.`}),_===`nd`&&(0,f.jsxs)(`div`,{style:{marginTop:`0.5rem`},onClick:e=>e.stopPropagation(),children:[[[`cpanel`,`cPanel Hosting`],[`cloud`,`Cloud Hosting`]].map(([t,n])=>(0,f.jsxs)(`label`,{style:{display:`flex`,alignItems:`center`,gap:`0.5rem`,padding:`0.3rem 0`,cursor:`pointer`},children:[(0,f.jsx)(`input`,{type:`radio`,name:`ndc`,checked:y===t,onChange:()=>b(t)}),(0,f.jsx)(`span`,{style:{fontSize:`0.8125rem`,color:`var(--text)`},children:n}),(0,f.jsx)(`span`,{style:{fontSize:`0.8125rem`,fontFamily:`monospace`,color:`var(--text-muted)`},children:(e[t]||[]).join(` / `)})]},t)),c(t===y?`Applied`:`Use ${y===`cpanel`?`cPanel`:`Cloud`} nameservers`,()=>N(y),t===y)]})]})]})}),(0,f.jsx)(`div`,{style:a(_===`custom`),onClick:()=>v(`custom`),children:(0,f.jsxs)(`div`,{style:{display:`flex`,gap:`0.6rem`,alignItems:`flex-start`},children:[o(_===`custom`),(0,f.jsxs)(`div`,{style:{flex:1},children:[(0,f.jsx)(`p`,{style:{fontSize:`0.83rem`,fontWeight:600,color:`var(--text)`},children:`Use custom nameservers`}),(0,f.jsx)(`p`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`},children:`Enter your own nameservers.`}),_===`custom`&&(0,f.jsxs)(`div`,{style:{marginTop:`0.5rem`},onClick:e=>e.stopPropagation(),children:[(0,f.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`0.4rem`},children:h.map((e,t)=>(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`0.5rem`},children:[(0,f.jsxs)(`span`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`,width:26,textAlign:`right`,flexShrink:0},children:[`NS`,t+1]}),(0,f.jsx)(`input`,{value:e,onChange:e=>{let n=[...h];n[t]=e.target.value,g(n)},placeholder:t<2?`ns${t+1}.example.com (required)`:`ns${t+1}.example.com (optional)`,style:{flex:1,padding:`0.4rem 0.7rem`,borderRadius:7,background:`var(--bg-surface)`,border:`1px solid var(--border)`,color:`var(--text)`,fontSize:`0.8125rem`}})]},t))}),c(`Save custom nameservers`,M)]})]})]})}),(0,f.jsx)(`div`,{style:a(_===`park`),onClick:()=>v(`park`),children:(0,f.jsxs)(`div`,{style:{display:`flex`,gap:`0.6rem`,alignItems:`flex-start`},children:[o(_===`park`),(0,f.jsxs)(`div`,{style:{flex:1},children:[(0,f.jsxs)(`p`,{style:{fontSize:`0.83rem`,fontWeight:600,color:`var(--text)`,display:`flex`,alignItems:`center`,gap:`0.4rem`,flexWrap:`wrap`},children:[`Park domain to earn refer-a-friend credits`,(0,f.jsx)(`span`,{style:{fontSize:`0.8125rem`,fontWeight:700,textTransform:`uppercase`,letterSpacing:`0.04em`,padding:`2px 6px`,borderRadius:20,background:`rgba(249,115,22,0.12)`,border:`1px solid rgba(249,115,22,0.3)`,color:`#fb923c`},children:`Coming soon`})]}),(0,f.jsx)(`p`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`},children:`We host a parking page featuring your referral link - earn account credit when friends sign up through it.`}),_===`park`&&(0,f.jsx)(`div`,{style:{marginTop:`0.5rem`},onClick:e=>e.stopPropagation(),children:t===`park`?(0,f.jsxs)(`div`,{style:{padding:`0.6rem 0.75rem`,borderRadius:8,background:`rgba(34,197,94,0.08)`,border:`1px solid rgba(34,197,94,0.25)`},children:[(0,f.jsx)(`p`,{style:{fontSize:`0.8125rem`,color:`var(--text)`,marginBottom:i?`0.45rem`:0},children:`â This domain is parked and earning refer-a-friend credits.`}),i&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`,marginBottom:`0.25rem`},children:`Your referral link:`}),(0,f.jsxs)(`div`,{style:{display:`flex`,gap:`0.4rem`,alignItems:`center`},children:[(0,f.jsx)(`input`,{readOnly:!0,value:i,onFocus:e=>e.target.select(),style:{flex:1,padding:`0.35rem 0.55rem`,borderRadius:6,background:`var(--bg-surface)`,border:`1px solid var(--border)`,color:`var(--text)`,fontSize:`0.8125rem`,fontFamily:`monospace`}}),(0,f.jsx)(`button`,{onClick:()=>{navigator.clipboard?.writeText(i),A(`Referral link copied`)},style:{padding:`0.35rem 0.6rem`,borderRadius:6,background:`var(--bg-surface)`,border:`1px solid var(--border)`,color:`var(--accent)`,fontSize:`0.8125rem`,cursor:`pointer`},children:`Copy`})]})]})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`p`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`,marginBottom:`0.2rem`},children:[`Parking points your domain at `,(0,f.jsx)(`span`,{style:{fontFamily:`monospace`},children:(e.park||[]).join(` / `)}),`. This feature is coming soon.`]}),c(`Park this domain`,()=>N(`park`),!0)]})})]})]})})]})]})})(),B&&!e.endsWith(`.au`)&&(0,f.jsxs)(`div`,{style:F,children:[(0,f.jsx)(`p`,{style:{fontWeight:600,fontSize:`0.875rem`,marginBottom:`0.75rem`},children:`Settings`}),(0,f.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`0.75rem`},children:[(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{style:{fontSize:`0.8125rem`,fontWeight:600},children:`Domain Lock`}),(0,f.jsx)(`p`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`},children:`Prevent unauthorised transfers away`})]}),(()=>{let e=r.locked===`1`||r.locked===`true`||r.locked===!0;return(0,f.jsx)(`button`,{onClick:()=>j(e?`unlock`:`lock`),disabled:!!s,role:`switch`,"aria-checked":e,title:e?`Locked â click to unlock`:`Unlocked â click to lock`,style:{position:`relative`,width:58,height:30,borderRadius:15,padding:0,flexShrink:0,cursor:s?`default`:`pointer`,o
146pacity:s?.6:1,transition:`background 0.2s, border-color 0.2s`,background:e?`var(--btn-solid)`:`var(--bg-elevated)`,border:e?`1px solid var(--btn-solid)`:`1px solid var(--border)`},children:(0,f.jsx)(`span`,{style:{position:`absolute`,top:`50%`,left:e?30:3,transform:`translateY(-50%)`,width:24,height:24,borderRadius:`50%`,background:`#fff`,display:`flex`,alignItems:`center`,justifyContent:`center`,boxShadow:`0 1px 3px rgba(0,0,0,0.3)`,transition:`left 0.2s`,color:e?`var(--btn-solid)`:`var(--text-muted)`},children:s===`lock`||s===`unlock`?(0,f.jsx)(X,{size:14,style:{animation:`spin 1s linear infinite`}}):e?(0,f.jsx)(wc,{size:14}):(0,f.jsx)(Us,{size:14})})})})()]}),!V&&(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{style:{fontSize:`0.8125rem`,fontWeight:600},children:`WHOIS Privacy (ID Protect)`}),(0,f.jsx)(`p`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`},children:`Hide your contact details from WHOIS`})]}),(0,f.jsxs)(`div`,{style:{display:`flex`,gap:`0.4rem`},children:[I(r.idProtect===`1`,()=>j(`enableIdProtect`),`On`,`enableIdProtect`),I(r.idProtect!==`1`,()=>j(`disableIdProtect`),`Off`,`disableIdProtect`)]})]})]})]}),B&&!V&&(0,f.jsx)(dm,{dnssec:r.dnssec,doAction:j,actioning:s}),B&&(0,f.jsxs)(`div`,{style:F,children:[(0,f.jsx)(`p`,{style:{fontWeight:600,fontSize:`0.875rem`,marginBottom:`0.5rem`},children:`Domain Password`}),(0,f.jsxs)(`p`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`,marginBottom:`0.75rem`,lineHeight:1.5},children:[`To transfer this domain to another registrar, you'll need the EPP/authorisation code.`,!e.endsWith(`.au`)&&(0,f.jsxs)(f.Fragment,{children:[`Make sure the domain is `,(0,f.jsx)(`strong`,{style:{color:`var(--text)`},children:`unlocked`}),` before initiating a transfer.`]}),e.endsWith(`.au`)&&(0,f.jsx)(`span`,{style:{display:`block`,marginTop:`0.35rem`},children:`.au domains do not support registrar lock - no unlock step is required.`})]}),C?(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`0.75rem`,padding:`0.6rem 0.85rem`,borderRadius:8,background:`var(--bg-elevated)`,border:`1px solid var(--border)`},children:[(0,f.jsx)(`span`,{style:{fontFamily:`monospace`,fontSize:`0.875rem`,flex:1,wordBreak:`break-all`},children:C}),(0,f.jsx)(`button`,{onClick:()=>{navigator.clipboard.writeText(C),A(`Copied!`)},style:{background:`none`,border:`none`,color:`var(--accent)`,cursor:`pointer`,fontSize:`0.8125rem`,flexShrink:0},children:`Copy`})]}):(0,f.jsx)(`button`,{className:`btn-secondary`,onClick:P,disabled:T,children:T?`Retrievingâ¦`:`Get EPP / Auth Code`})]})]})}function hm({expiry:e,doAction:t,actioning:n,flash:r,inline:i=!1,domainName:a=``}){let[o,s]=(0,l.useState)(1),[c,u]=(0,l.useState)(!1),[d,p]=(0,l.useState)(!1),m=e?new Date(e):null,h=m?new Date(new Date(m).setFullYear(m.getFullYear()+o)):null;async function g(){confirm(`Renew for ${o} year${o>1?`s`:``}? This will extend the expiry date.`)&&(await t(`renew`,{years:o}))?.ok&&u(!1)}if(i){let e=String(a).endsWith(`.au`),t=m?Math.ceil((m.getTime()-Date.now())/864e5):null,r=e&&t!=null&&t>90;return(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`0.5rem`,flexWrap:`wrap`,justifyContent:`flex-end`},children:[c?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`select`,{value:o,onChange:e=>s(Number(e.target.value)),style:{padding:`0.35rem 0.6rem`,borderRadius:7,background:`var(--bg-elevated)`,border:`1px solid var(--border)`,color:`var(--text)`,fontSize:`0.8125rem`},children:[1,2,3,4,5].map(e=>(0,f.jsxs)(`option`,{value:e,children:[e,`yr`,e>1?`s`:``]},e))}),h&&(0,f.jsxs)(`span`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`},children:[`â `,h.toLocaleDateString(`en-AU`,{day:`numeric`,month:`short`,year:`numeric`})]}),(0,f.jsx)(`button`,{className:`btn-primary`,onClick:g,disabled:!!n,children:n===`renew`?`Processingâ¦`:`Confirm`}),(0,f.jsx)(`button`,{className:`btn-secondary`,onClick:()=>u(!1),children:`Cancel`})]}):(0,f.jsx)(`button`,{className:`btn-primary`,onClick:()=>{r?p(!0):u(!0)},children:`Renew`}),d&&!c&&r&&(0,f.jsx)(`span`,{style:{flexBasis:`100%`,textAlign:`right`,fontSize:`0.8125rem`,color:`#fbbf24`,marginTop:`0.15rem`},children:`.au domains can only be renewed within 90 days of expiry.`})]})}return(0,f.jsxs)(`div`,{style:{background:`var(--bg-surface)`,border:`1px solid var(--border)`,borderRadius:12,padding:`1rem`,marginBottom:`0.75rem`},children:[(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:c?`0.75rem`:0},children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{style:{fontWeight:600,fontSize:`0.875rem`},children:`Renew Domain`}),m&&(0,f.jsxs)(`p`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`,marginTop:`0.15rem`},children:[`Expires `,m.toLocaleDateString(`en-AU`,{day:`numeric`,month:`short`,year:`numeric`})]})]}),(0,f.jsx)(`button`,{onClick:()=>u(e=>!e),style:{background:`none`,border:`none`,color:`var(--accent)`,cursor:`pointer`,fontSize:`0.8125rem`},children:c?`Cancel`:`Renew`})]}),c&&(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`0.75rem`,flexWrap:`wrap`},children:[(0,f.jsx)(`select`,{value:o,onChange:e=>s(Number(e.target.value)),style:{padding:`0.45rem 0.75rem`,borderRadius:7,background:`var(--bg-elevated)`,border:`1px solid var(--border)`,color:`var(--text)`,fontSize:`0.8125rem`},children:[1,2,3,4,5].map(e=>(0,f.jsxs)(`option`,{value:e,children:[e,` year`,e>1?`s`:``]},e))}),h&&(0,f.jsxs)(`span`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`},children:[`â expires `,h.toLocaleDateString(`en-AU`,{day:`numeric`,month:`short`,year:`numeric`})]}),(0,f.jsx)(`button`,{className:`btn-primary`,onClick:g,disabled:!!n,children:n===`renew`?`Processingâ¦`:`Confirm Renew`})]})]})}function gm({domainName:e,cor:t,reload:n,setTab:r}){let[i,a]=(0,l.useState)(!1),[o,s]=(0,l.useState)(1),[c,u]=(0,l.useState)(null),[d,p]=(0,l.useState)(!1),[m,h]=(0,l.useState)(null),g=typeof t?.maxYears==`number`?t.maxYears:null,_=t?.unitPrice,v=g==null,y=g===0,b=t?.pending||!!t?.awaitingPayment;async function x(){p(!0),h(null);let t=await Z(`/api/portal/domains/${encodeURIComponent(e)}`,{method:`POST`,body:JSON.stringify({action:`requestChangeOfRegistrant`,years:o})}).catch(e=>({ok:!1,error:e.message}));p(!1),t?.ok?u(t):h(t?.error||`Could not submit the request. Please try again.`)}function S(){let e=!!c;a(!1),u(null),s(1),h(null),e&&n?.()}let C={color:`var(--text-muted)`,fontSize:`0.8125rem`,lineHeight:1.55},w={fontWeight:600,fontSize:`0.875rem`,color:`var(--text)`,marginBottom:`0.35rem`},T={...C,marginLeft:`1rem`,listStyle:`disc`};return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`div`,{style:{padding:`0.75rem 1rem`,borderTop:`1px solid var(--border)`,display:`flex`,gap:`1rem`,alignItems:`flex-start`,justifyContent:`space-between`,flexWrap:`wrap`},children:[(0,f.jsxs)(`div`,{style:{flex:`1 1 320px`},children:[(0,f.jsx)(`p`,{style:{fontWeight:600,fontSize:`0.875rem`,marginBottom:`0.2rem`},children:`Change of Registrant`}),(0,f.jsx)(`p`,{style:C,children:`Transfer legal ownership of this .au domain to a different eligible registrant (for example, when the business owner or ABN changes).`}),t?.pending&&(0,f.jsxs)(`p`,{style:{...C,color:`#fbbf24`,marginTop:`0.35rem`},children:[`In progress â `,t.pendingLabel,`.`,t.pendingLink&&(0,f.jsxs)(f.Fragment,{children:[` `,(0,f.jsx)(`a`,{href:t.pen
146dingLink,target:`_blank`,rel:`noreferrer`,style:{color:`var(--accent)`},children:`Open request â`})]})]}),!t?.pending&&t?.awaitingPayment&&(0,f.jsxs)(`p`,{style:{...C,color:`#fbbf24`,marginTop:`0.35rem`},children:[`Awaiting payment â the request is sent to the registry once invoice `,t.awaitingPayment.invoiceNum||`#${t.awaitingPayment.invoiceId}`,` is paid.`]})]}),(0,f.jsx)(`button`,{className:`btn-secondary`,onClick:()=>a(!0),disabled:b,title:b?`A Change of Registrant is already in progress for this domain.`:void 0,children:`Change of Registrant`})]}),i&&(0,ml.createPortal)((0,f.jsx)(`div`,{style:{position:`fixed`,inset:0,zIndex:9999,background:`rgba(0,0,0,0.7)`,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`1rem`},onClick:e=>e.target===e.currentTarget&&S(),children:(0,f.jsxs)(`div`,{style:{background:`var(--bg-surface)`,border:`1px solid var(--border)`,borderRadius:12,width:`100%`,maxWidth:620,maxHeight:`92vh`,overflow:`auto`},children:[(0,f.jsxs)(`div`,{style:{padding:`0.85rem 1.1rem`,borderBottom:`1px solid var(--border)`,display:`flex`,alignItems:`center`,justifyContent:`space-between`,position:`sticky`,top:0,background:`var(--bg-surface)`},children:[(0,f.jsx)(`p`,{style:{fontWeight:600},children:`Change of Registrant`}),(0,f.jsx)(`button`,{onClick:S,style:{background:`none`,border:`none`,color:`var(--text-muted)`,cursor:`pointer`,fontSize:`1.15rem`,lineHeight:1},children:`Ã`})]}),c?(0,f.jsxs)(`div`,{style:{padding:`1.1rem`},children:[(0,f.jsx)(`p`,{style:{...w,color:`#34d399`},children:`Request received`}),(0,f.jsx)(`p`,{style:C,children:c.message}),(0,f.jsxs)(`div`,{style:{display:`flex`,gap:`0.5rem`,marginTop:`1rem`},children:[(0,f.jsx)(`button`,{className:`btn-primary`,onClick:()=>{S(),r?.(`billing`)},children:`Pay invoice`}),(0,f.jsx)(`button`,{className:`btn-secondary`,onClick:S,children:`Close`})]})]}):(0,f.jsxs)(`div`,{style:{padding:`1.1rem`,display:`flex`,flexDirection:`column`,gap:`1rem`},children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{style:w,children:`What is a Change of Registrant (CoR)?`}),(0,f.jsx)(`p`,{style:C,children:`A Change of Registrant (CoR) is the process used to change the legal owner of an .au domain name.`}),(0,f.jsx)(`p`,{style:{...C,marginTop:`0.5rem`},children:`A CoR is required whenever the registrant's eligibility details change, including their:`}),(0,f.jsx)(`ul`,{style:{marginTop:`0.3rem`},children:[`ABN`,`ACN`,`RBN`,`Eligibility type`].map(e=>(0,f.jsx)(`li`,{style:T,children:e},e))})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{style:w,children:`Common examples`}),(0,f.jsx)(`ul`,{children:[`The business has been sold or ownership has changed.`,`The domain needs to be transferred to a different ABN or ACN.`,`The existing ABN or ACN has been cancelled or replaced.`,`The legal entity that owns the domain has changed.`].map(e=>(0,f.jsx)(`li`,{style:T,children:e},e))}),(0,f.jsx)(`p`,{style:{...C,marginTop:`0.5rem`},children:`A Change of Registrant must be completed in accordance with auDA policies to ensure ownership is transferred securely and correctly.`})]}),(0,f.jsx)(`div`,{style:{padding:`0.7rem 0.85rem`,borderRadius:8,background:`var(--bg-elevated)`,border:`1px solid var(--border)`},children:(0,f.jsx)(`p`,{style:{...C,margin:0},children:`After you confirm, we'll email the current registrant with the steps to complete the change. The new owner's details (ABN/ACN and eligibility) are entered securely during that process â you don't need to provide them here.`})}),v?(0,f.jsx)(`div`,{style:{padding:`0.7rem 0.85rem`,borderRadius:8,background:`rgba(251,191,36,0.08)`,border:`1px solid rgba(251,191,36,0.25)`},children:(0,f.jsx)(`p`,{style:{...C,color:`#fbbf24`,margin:0},children:`We couldn't confirm this domain's expiry date with the registry, so the available terms can't be calculated right now. Please try again shortly or contact support.`})}):y?(0,f.jsx)(`div`,{style:{padding:`0.7rem 0.85rem`,borderRadius:8,background:`rgba(251,191,36,0.08)`,border:`1px solid rgba(251,191,36,0.25)`},children:(0,f.jsx)(`p`,{style:{...C,color:`#fbbf24`,margin:0},children:`This domain is already registered for the maximum 5 years. A Change of Registrant can't be purchased until the remaining term drops below five years.`})}):(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{style:w,children:`Registration term`}),(0,f.jsxs)(`p`,{style:C,children:[`A CoR issues a new registration term. Any remaining days that don't make up a full year are forfeited, and the total registration period can never exceed 5 years â so this domain can be extended by up to `,g,` year`,g>1?`s`:``,`.`]}),(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`0.75rem`,flexWrap:`wrap`,marginTop:`0.6rem`},children:[(0,f.jsx)(`select`,{value:o,onChange:e=>s(Number(e.target.value)),style:{padding:`0.45rem 0.75rem`,borderRadius:7,background:`var(--bg-elevated)`,border:`1px solid var(--border)`,color:`var(--text)`,fontSize:`0.8125rem`},children:Array.from({length:g},(e,t)=>t+1).map(e=>(0,f.jsxs)(`option`,{value:e,children:[e,` year`,e>1?`s`:``]},e))}),_!=null&&(0,f.jsxs)(`span`,{style:{fontSize:`0.8125rem`,color:`var(--text)`},children:[`$`,(_*o).toFixed(2),(0,f.jsx)(`span`,{style:{color:`var(--text-muted)`},children:` â the CoR fee equals the registration price for the selected term`})]})]})]}),m&&(0,f.jsx)(`div`,{style:{padding:`0.7rem 0.85rem`,borderRadius:8,background:`rgba(239,68,68,0.08)`,border:`1px solid rgba(239,68,68,0.25)`},children:(0,f.jsx)(`p`,{style:{...C,color:`#f87171`,margin:0},children:m})}),(0,f.jsxs)(`div`,{style:{display:`flex`,gap:`0.5rem`,justifyContent:`flex-end`,borderTop:`1px solid var(--border)`,paddingTop:`0.85rem`},children:[(0,f.jsx)(`button`,{className:`btn-secondary`,onClick:S,children:`Cancel`}),!y&&!v&&(0,f.jsx)(`button`,{className:`btn-primary`,onClick:x,disabled:d,children:d?`Submittingâ¦`:`Request Change of Registrant`})]})]})]})}),document.body)]})}function _m({contacts:e,contactTypes:t,domainName:n,doAction:r,actioning:i,readOnly:a=!1}){let[o,s]=(0,l.useState)(`registrant`),[c,u]=(0,l.useState)(!1),[d,p]=(0,l.useState)({}),[m,h]=(0,l.useState)(!1),[g,_]=(0,l.useState)(!1),v=Array.isArray(t)&&t.length?t:[`registrant`,`admin`,`tech`],y=e[o]||{};function b(){p({...y}),_(!1),u(!0)}function x(){u(!1),p({}),_(!1)}async function S(){h(!0);try{(await r(`updateContact`,{contactType:o,contact:d}))?.ok!==!1&&u(!1)}finally{h(!1)}}let C={width:`100%`,padding:`0.45rem 0.75rem`,borderRadius:7,background:`var(--bg-elevated)`,border:`1px solid var(--border)`,color:`var(--text)`,fontSize:`0.8125rem`,boxSizing:`border-box`};return(0,f.jsxs)(`div`,{style:{background:`var(--bg-surface)`,border:`1px solid var(--border)`,borderRadius:12,overflow:`hidden`,marginBottom:`0.75rem`},children:[(0,f.jsxs)(`div`,{style:{padding:`0.75rem 1rem`,borderBottom:`1px solid var(--border)`,display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:[(0,f.jsx)(`p`,{style:{fontWeight:600,fontSize:`0.875rem`},children:`Contact Details`}),!c&&!a&&(0,f.jsx)(`button`,{onClick:b,style:{background:`none`,border:`none`,color:`var(--accent)`,cursor:`pointer`,fontSize:`0.8125rem`,fontWeight:600},children:`Edit`}),a&&(0,f.jsx)(`span`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`},children:`Contact support to change these`})]}),(0,f.jsx)(`div`,{style:{display:`flex`,gap:`0.4rem`,padding:`0.6rem 1rem`,borderBottom:`1px solid var(--border)`},children:v.map(e=>(0,f.jsx)(`button`,{onClick:()=>{s(e),u(!1),p({}),_(!1)},style:{padding:`0.3rem 0.75rem`,borderRadius:6,fontSize:`0.8125rem`,fontWeight:600,cursor:`pointer`,border:`1px solid`,background:o===e?`var(--btn-solid)`:`var(--bg-elevated)`,borderColor:o===e?`var(--btn-solid)`:`var(--border)`,color:o===e?`var(--btn-solid-text)`:`var(--text-muted)`,textTransform:`capitalize`},children:e},e))}),(0,f.jsx)(`div`,{style:{padding:`1rem`},children:c?(0,f.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`0.6rem`},children:[o!==`registrant`&&(0,f.jsxs)(`label`,{style:{display:`flex`,alignItems:`center`,gap:`0.5rem`,fontSize:`0.8125rem`,color:`var(--text-muted)`,cursor:`pointer`,paddingBottom:`0.2rem`},children:[(0,f.jsx)(`input`,{type:`checkbox`,checked:g,onChange:t=>{_(t.target.checked),t.target.checked&&p({...e.registrant||{}})}}),`Copy details from registrant`]}),(0,f.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:`0.5rem`},children:[[`firstName`,`First Name`],[`lastName`,`Last Name`]].map(([e,t])=>(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{style:{display:`block`,fontSize:`0.8125rem`,color:`var(--text-muted)`,marginBottom:3},children:t}),(0,f.jsx)(`input`,{value:d[e]||``,onChange:t=>p(n=>({...n,[e]:t.target.value})),style:C})]},e))}),[[`email`,`Email`],[`phone`,`Phone`],[`address`,`Address`],[`city`,`City`]].map(([e,t])=>(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{style:{display:`block`,fontSize:`0.8125rem`,color:`var(--text-muted)`,marginBottom:3},children:t}),(0,f.jsx)(`input`,{value:d[e]||``,onChange:t=>p(n=>({...n,[e]:t.target.value})),style:C})]},e)),(0,f.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr 1fr`,gap:`0.5rem`},children:[[`state`,`State`],[`postCode`,`Post Code`],[`country`,`Country`]].map(([e,t])=>(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{style:{display:`block`,fontSize:`0.8125rem`,color:`var(--text-muted)`,marginBottom:3},children:t}),(0,f.jsx)(`input`,{value:d[e]||``,onChange:t=>p(n=>({...n,[e]:t.target.value})),style:C})]},e))}),(0,f.jsxs)(`div`,{style:{display:`flex`,gap:`0.5rem`,marginTop:`0.25rem`},children:[(0,f.jsx)(`button`,{className:`btn-primary`,style:{flex:1},onClick:S,disabled:m,children:m?`Savingâ¦`:`Save ${o.charAt(0).toUpperCase()+o.slice(1)}`}),(0,f.jsx)(`button`,{className:`btn-secondary`,onClick:x,children:`Cancel`})]})]}):(0,f.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`0.4rem`},children:[[[`Name`,`${y.firstName||``} ${y.lastName||``}`.trim()||`â`],[`Email`,y.email||`â`],[`Phone`,y.phone||`â`],[`Address`,y.address||`â`],[`City`,y.city||`â`],[`State`,y.state||`â`],[`Post Code`,y.postCode||`â`],[`Country`,y.country||`â`]].map(([e,t])=>(0,f.jsxs)(`div`,{style:{display:`flex`,gap:`0.75rem`,fontSize:`0.8125rem`},children:[(0,f.jsx)(`span`,{style:{color:`var(--text-muted)`,width:72,flexShrink:0},children:e}),(0,f.jsx)(`span`,{style:{color:`var(--text)`,wordBreak:`break-all`},children:t})]},e)),!Object.values(y).some(Boolean)&&(0,f.jsx)(`p`,{style:{fontSize:`0.8125rem`,color:`var(--text-muted)`,fontStyle:`italic`},children:`Contact details not available â sync in progress.`})]})})]})}var vm=e=>e?.transferOrder?.status===`awaiting_epp`;function ym({preselect:e=null,onBack:t,caps:n={},bpay:r=null,setTab:i}){let[a,o]=(0,l.useState)(null),[s,c]=(0,l.useState)(!0),[u,d]=(0,l.useState)(null),[p,m]=(0,l.useState)(`select`),[h,g]=(0,l.useState)(()=>new Set(e?[e.toLowerCase()]:[])),[_,v]=(0,l.useState)(``),[y,b]=(0,l.useState)(!1),[x,S]=(0,l.useState)(null),[C,w]=(0,l.useState)([]),[T,E]=(0,l.useState)(null),[D,O]=(0,l.useState)(!1),[k,A]=(0,l.useState)(!1),[j,M]=(0,l.useState)(!1),[N,P]=(0,l.useState)({}),[F,I]=(0,l.useState)(null),[L,R]=(0,l.useState)({}),z=(0,l.useCallback)(async e=>{let t=await Z(`/api/portal/payment-methods`).catch(()=>({ok:!1})),n=t.ok&&t.methods||[];w(n);let r=n.filter(e=>e.chargeable!==!1),i=e&&r.find(t=>String(t.id)===String(e))||r.find(e=>e.is_default)||r[0];
146i?(O(!1),E(i.id)):O(!0)},[]),B=(0,l.useCallback)(async()=>{c(!0),d(null);let t=await Z(`/api/portal/domains/transfer`).catch(e=>({ok:!1,error:e.message}));if(!t.ok)return d(t.error||`We could not load your domains.`),c(!1),t;o(t);let n=(t.inFlight||[]).filter(e=>e.status===`awaiting_epp`),r=e&&n.some(t=>t.domain===e.toLowerCase());return n.length&&(r||!t.domains.length)&&(S({invoiceId:n[0].invoiceId,invoiceNum:n[0].invoiceNum,total:n[0].invoiceTotal,paid:n[0].invoicePaid,orders:n.map(e=>({id:e.id,domain:e.domain,amount:e.amount})),resumed:!0}),n[0].invoicePaid||z(),m(n[0].invoicePaid?`epp`:`pay`)),c(!1),t},[e,z]);(0,l.useEffect)(()=>{B()},[B]);let V=a?.domains||[],H=V.filter(e=>!e.blocked),U=V.filter(e=>!_||e.domainName.includes(_.toLowerCase())),W=H.filter(e=>h.has(e.domainName)),G=W.reduce((e,t)=>e+(t.price||0),0),ee=W.length>0&&W.every(e=>e.free);function te(e){g(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function ne(){if(y||!W.length)return;b(!0),d(null);let e=await Z(`/api/portal/domains/transfer/order`,{method:`POST`,body:JSON.stringify({domains:W.map(e=>e.domainName)})}).catch(e=>({ok:!1,error:e.message}));if(b(!1),!e.ok){d(e.error||`We could not start that transfer.`),m(`select`);return}if(S(e),e.paid){m(`epp`);return}z(),m(`pay`)}async function re(){if(k||!x)return;if(!T){d(`Choose a payment method first.`);return}A(!0),d(null),M(!1);let e=await cp(x.invoiceId,T);if(A(!1),e.ok){S(e=>({...e,paid:!0})),m(`epp`);return}if(e.error_code===`no_gateway_token`){M(!0);return}d(e.error?`Payment failed â ${e.error}`:`Payment failed. Please try again or contact support.`)}async function K(e){let t=(N[e.id]||``).trim();if(!t||F)return;I(e.id),d(null);let n=await Z(`/api/portal/domains/transfer/${e.id}/epp`,{method:`POST`,body:JSON.stringify({epp:t})}).catch(e=>({ok:!1,error:e.message}));if(I(null),!n.ok){R(t=>({...t,[e.id]:{ok:!1,message:n.error||`That code was not accepted.`}}));return}R(t=>({...t,[e.id]:{ok:!0,submitted:n.submitted,awaitingPayment:n.awaitingPayment,message:n.message,approvalEmail:n.approvalEmail}}))}if(n.order===!1)return(0,f.jsx)(bm,{onBack:t,children:(0,f.jsx)(`div`,{className:`rounded-xl border border-edge bg-surface p-6`,children:(0,f.jsx)(`p`,{className:`text-sm text-muted`,children:`Your access to this account does not include placing orders, so you can't start a domain transfer. An account owner or billing contact can.`})})});if(s)return(0,f.jsx)(bm,{onBack:t,children:(0,f.jsx)(`p`,{className:`py-8 text-center text-sm text-muted`,children:`Loading your domainsâ¦`})});if(p===`epp`&&x){let e=x.orders.filter(e=>!L[e.id]?.submitted);return(0,f.jsxs)(bm,{onBack:t,title:`Transfer codes`,children:[x.paid?(0,f.jsx)(xm,{tone:`success`,icon:Is,children:x.total>0?`Payment received. Now we need the transfer code for each domain.`:`Nothing to pay â ${x.orders.length>1?`these transfers are`:`this transfer is`} free. Now we need the transfer code for each domain.`}):(0,f.jsxs)(xm,{tone:`warning`,icon:Y,children:[`Invoice `,x.invoiceNum||`#${x.invoiceId}`,` is still to be paid. You can add the transfer codes now â each transfer starts as soon as the invoice is paid.`]}),(0,f.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface p-4 space-y-4`,children:[(0,f.jsx)(`p`,{className:`text-sm text-muted leading-relaxed`,children:`A transfer code (also called an EPP code, auth code, or domain password) comes from your current registrar â usually from the domain's settings, or by asking their support. You may also need to unlock the domain there first.`}),x.orders.map(e=>{let t=L[e.id];return t?.submitted?(0,f.jsxs)(`div`,{className:`rounded-xl border p-3.5`,style:{background:`rgba(16,185,129,0.08)`,borderColor:`rgba(16,185,129,0.25)`},children:[(0,f.jsxs)(`p`,{className:`text-sm font-semibold`,style:{color:`#6ee7b7`},children:[e.domain,` â transfer started`]}),(0,f.jsxs)(`p`,{className:`mt-1 text-xs`,style:{color:`#6ee7b7`},children:[`Check the registrant email for `,(0,f.jsx)(`strong`,{children:e.domain}),t.approvalEmail?(0,f.jsxs)(f.Fragment,{children:[` (`,(0,f.jsx)(`span`,{className:`font-mono`,children:t.approvalEmail}),`)`]}
146):null,` `,`â your current registrar will send an approval request there. The transfer completes once it's approved, and can take a few days.`]})]},e.id):t?.ok&&t.awaitingPayment?(0,f.jsxs)(`div`,{className:`rounded-xl border p-3.5`,style:{background:`rgba(245,158,11,0.08)`,borderColor:`rgba(245,158,11,0.25)`},children:[(0,f.jsxs)(`p`,{className:`text-sm font-semibold`,style:{color:`#fbbf24`},children:[e.domain,` â code saved`]}),(0,f.jsxs)(`p`,{className:`mt-1 text-xs`,style:{color:`#fbbf24`},children:[`We'll start this transfer as soon as invoice `,x.invoiceNum||`#${x.invoiceId}`,` is paid.`]})]},e.id):(0,f.jsxs)(`div`,{className:`rounded-xl border border-edge bg-elevated p-3.5`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,f.jsx)(gc,{size:14,className:`text-muted shrink-0`}),(0,f.jsx)(`span`,{className:`text-sm font-semibold text-primary`,children:e.domain})]}),(0,f.jsxs)(`div`,{className:`flex gap-2 flex-wrap`,children:[(0,f.jsx)(`input`,{value:N[e.id]||``,onChange:t=>P(n=>({...n,[e.id]:t.target.value})),placeholder:`Transfer / EPP code`,autoComplete:`off`,spellCheck:!1,className:`flex-1 min-w-[12rem] px-3 py-2 rounded-lg text-sm bg-surface border border-edge text-primary placeholder:text-faint focus:outline-none focus:border-accent`}),(0,f.jsx)(`button`,{className:`btn-primary text-sm disabled:opacity-50`,disabled:!(N[e.id]||``).trim()||F===e.id,onClick:()=>K(e),children:F===e.id?`Startingâ¦`:`Start transfer`})]}),t&&!t.ok&&(0,f.jsx)(`p`,{className:`mt-2 text-xs text-rose-400`,role:`alert`,children:t.message}),t?.ok&&!t.submitted&&!t.awaitingPayment&&t.message&&(0,f.jsxs)(`p`,{className:`mt-2 text-xs text-rose-400`,role:`alert`,children:[`The registrar refused that code: `,t.message]})]},e.id)}),e.length>0&&(0,f.jsxs)(`p`,{className:`text-xs text-faint border-t border-edge pt-3`,children:[`Don't have `,e.length>1?`the codes`:`the code`,` yet? Leave this page â we'll hold `,e.length>1?`these domains`:`this domain`,` as`,(0,f.jsx)(`strong`,{className:`text-muted`,children:` Awaiting transfer code`}),` and you can come back to your Domains page any time to finish.`]})]}),(0,f.jsx)(`div`,{className:`flex justify-end`,children:(0,f.jsx)(`button`,{className:`btn-secondary text-sm`,onClick:t,children:`Back to domains`})})]})}if(p===`pay`&&x)return(0,f.jsxs)(bm,{onBack:t,title:`Pay for your transfer`,children:[(0,f.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface p-4 space-y-4`,children:[(0,f.jsxs)(`div`,{className:`rounded-xl border border-edge bg-elevated px-3.5 py-3`,children:[(0,f.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,f.jsxs)(`span`,{className:`text-xs text-muted`,children:[`Invoice `,(0,f.jsx)(`span`,{className:`text-primary font-medium`,children:x.invoiceNum||`#${x.invoiceId}`})]}),(0,f.jsx)(`span`,{className:`text-lg font-bold text-primary tabular-nums`,children:$(x.total)})]}),(0,f.jsxs)(`p`,{className:`mt-1 text-[11px] text-faint`,children:[x.orders.map(e=>e.domain).join(`, `),` â each transfer includes a 1-year renewal.`]})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-xs font-medium text-muted mb-2`,children:`Pay with`}),(0,f.jsx)(rm,{methods:C,value:T,onChange:e=>{E(e),d(null)},adding:D,onAddCard:()=>O(!0),onCancelAdd:()=>O(!1),onCardSaved:e=>z(e)})]}),j&&(0,f.jsxs)(`div`,{className:`rounded-xl border px-3.5 py-3 space-y-2`,style:{background:`rgba(245,158,11,0.08)`,borderColor:`rgba(245,158,11,0.25)`},children:[(0,f.jsx)(`p`,{className:`text-xs`,style:{color:`#fbbf24`},children:`That saved card isn't linked to our payment provider, so we can't charge it. Remove it and add it again â the same card is fine.`}),(0,f.jsxs)(`button`,{className:`btn-secondary text-xs flex items-center gap-1.5`,onClick:()=>i?.(`account`,`payment`),children:[(0,f.jsx)(sc,{size:13}),` Go to Payment Methods `,(0,f.jsx)(Js,{size:13})]})]}),u&&(0,f.jsx)(`p`,{className:`text-xs text-rose-400`,role:`alert`,children:u}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2 justify-end flex-wrap`,children:[(0,f.jsx)(`button`,{className:`btn-secondary text-sm`,onClick:()=>m(`epp`),disabled:k,children:`Pay later`}),(0,f.jsx)(`button`,{className:`btn-primary text-sm disabled:opacity-50`,onClick:re,disabled:k||!T,children:k?`Processingâ¦`:`Pay ${$(x.total)}`})]})]}),(0,f.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface p-4`,children:[(0,f.jsx)(`p`,{className:`text-sm font-semibold text-primary mb-2`,children:`Prefer to pay another way?`}),(0,f.jsxs)(`p`,{className:`text-xs text-muted leading-relaxed`,children:[`Invoice `,(0,f.jsx)(`strong`,{className:`text-primary`,children:x.invoiceNum||`#${x.invoiceId}`}),` for`,` `,$(x.total),` is on your account and can be paid at any time. Your domains are held as `,(0,f.jsx)(`strong`,{className:`text-muted`,children:`Awaiting transfer code`}),` until it's paid â nothing expires and nothing is lost.`]}
146),r?.available&&r.billerCode&&(0,f.jsxs)(`div`,{className:`mt-3 text-xs`,children:[(0,f.jsx)(`p`,{className:`text-muted`,children:`BPAY biller code`}),(0,f.jsx)(`p`,{className:`text-primary font-mono font-medium`,children:r.billerCode}),(0,f.jsx)(`p`,{className:`text-muted mt-2`,children:`Your BPAY reference is printed on the invoice â open it from Billing to get it.`}),r.instructions&&(0,f.jsx)(`p`,{className:`text-faint mt-2`,children:r.instructions})]}),(0,f.jsxs)(`div`,{className:`mt-3 flex gap-2 flex-wrap`,children:[(0,f.jsx)(`button`,{className:`btn-secondary text-xs`,onClick:()=>i?.(`billing`),children:`View in Billing`}),(0,f.jsx)(`button`,{className:`btn-secondary text-xs`,onClick:()=>m(`epp`),children:`Add transfer codes now`})]})]})]});if(p===`confirm`)return(0,f.jsx)(bm,{onBack:()=>m(`select`),title:`Ready to start the transfer?`,children:(0,f.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface p-5 space-y-4`,children:[(0,f.jsxs)(`div`,{className:`space-y-1.5`,children:[W.map(e=>(0,f.jsx)(If,{k:e.domainName,v:e.free?`Free`:$(e.price)},e.domainName)),(0,f.jsx)(`div`,{className:`border-t border-edge pt-2 mt-2`,children:(0,f.jsx)(If,{k:`Total`,v:ee?`Free`:$(G),strong:!0})})]}),(0,f.jsxs)(`div`,{className:`rounded-xl border border-edge bg-elevated p-3.5`,children:[(0,f.jsx)(`p`,{className:`text-xs font-semibold text-primary mb-1.5`,children:`What happens next`}),(0,f.jsxs)(`ol`,{className:`text-xs text-muted leading-relaxed space-y-1 list-decimal pl-4`,children:[ee?(0,f.jsxs)(`li`,{children:[`Nothing to pay â `,W.length>1?`these transfers are`:`this transfer is`,` free.`]}):(0,f.jsxs)(`li`,{children:[`We raise an invoice for `,$(G),` that you can pay now or later.`]}),(0,f.jsx)(`li`,{children:`You give us the transfer (EPP) code for each domain.`}),(0,f.jsx)(`li`,{children:`Your current registrar emails the domain's registrant for approval.`}),(0,f.jsx)(`li`,{children:`Once approved, the transfer completes â usually within a few days.`})]})]}),(0,f.jsxs)(`p`,{className:`text-xs text-faint leading-relaxed`,children:[`Each transfer includes a 1-year renewal`,W.some(e=>e.domainName.endsWith(`.au`))?` (except .au domains, which keep their existing expiry)`:``,`. Your domain keeps its current nameservers, so your website and email carry on working.`]}),u&&(0,f.jsx)(`p`,{className:`text-xs text-rose-400`,role:`alert`,children:u}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2 justify-end`,children:[(0,f.jsx)(`button`,{className:`btn-secondary text-sm`,onClick:()=>m(`select`),disabled:y,children:`Back`}),(0,f.jsx)(`button`,{className:`btn-primary text-sm disabled:opacity-50`,onClick:ne,disabled:y,children:y?`Startingâ¦`:ee?`Start transfer`:`Continue â ${$(G)}`})]})]})});let ie=(a?.inFlight||[]).filter(e=>e.status!==`awaiting_epp`),q=(a?.inFlight||[]).filter(e=>e.status===`awaiting_epp`);return(0,f.jsxs)(bm,{onBack:t,title:`Transfer your domains to us`,children:[u&&(0,f.jsx)(`div`,{className:`alert-error text-sm`,children:u}),(0,f.jsx)(`p`,{className:`text-sm text-muted leading-relaxed`,children:`These domains are linked to your hosting with us but registered somewhere else. Transfer them across and we'll handle renewals, DNS and billing in one place. Your nameservers don't change, so nothing goes down.`}),q.length>0&&(0,f.jsx)(xm,{tone:`warning`,icon:Y,children:(0,f.jsxs)(`span`,{children:[q.length===1?`${q[0].domain} is waiting on its transfer code.`:`${q.length} domains are waiting on their transfer codes.`,` `,(0,f.jsxs)(`button`,{className:`underline font-semibold`,onClick:()=>{S({invoiceId:q[0].invoiceId,invoiceNum:q[0].invoiceNum,total:q[0].invoiceTotal,paid:q[0].invoicePaid,orders:q.map(e=>({id:e.id,domain:e.domain,amount:e.amount})),resumed:!0}),m(`epp`)},children:[`Add `,q.length>1?`them`:`it`,` now`]})]})}),ie.length>0&&(0,f.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface p-4`,children:[(0,f.jsx)(`p`,{className:`text-sm font-semibold text-primary mb-2`,children:`Transfers under way`}),(0,f.jsx)(`ul`,{className:`space-y-1`,children:ie.map(e=>(0,f.jsxs)(`li`,{className:`flex items-center justify-between gap-3 text-xs`,children:[(0,f.jsx)(`span`,{className:`text-primary`,children:e.domain}),(0,f.jsx)(`span`,{className:`text-muted`,children:e.status===`submitted`?`Awaiting approval at your current registrar`:e.status===`failed`?e.result||`Needs attention â contact support`:`Startingâ¦`})]},e.id))})]}),V.length===0?(0,f.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface p-6 text-center`,children:[(0,f.jsx)(gc,{size:32,className:`mx-auto mb-3 text-faint opacity-40`}),(0,f.jsx)(`p`,{className:`font-semibold text-primary mb-1`,children:`No domains to transfer`}),(0,f.jsx)(`p`,{className:`text-sm text-muted max-w-sm mx-auto leading-relaxed`,children:`We can't see any domains on your hosting that are registered elsewhere. If you have one to move across, our support team can start it for you.`}),(0,f.jsx)(`button`,{className:`btn-secondary text-sm mt-4`,onClick:()=>i?.(`support`),children:`Ask a question`})]}):(0,f.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface p-4 space-y-3`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,f.jsx)(`p`,{className:`text-sm font-semibold text-primary flex-1`,children:`Choose domains to transfer`}),V.length>
1466&&(0,f.jsx)(`input`,{value:_,onChange:e=>v(e.target.value),placeholder:`Filterâ¦`,className:`px-3 py-1.5 rounded-lg text-sm bg-elevated border border-edge text-primary placeholder:text-faint focus:outline-none focus:border-accent`,style:{width:160}})]}),(0,f.jsxs)(`div`,{children:[U.map(e=>(0,f.jsxs)(`label`,{style:{display:`flex`,alignItems:`flex-start`,gap:`0.7rem`,padding:`0.65rem 0.75rem`,borderRadius:10,border:`1px solid var(--border)`,marginBottom:`0.4rem`,background:h.has(e.domainName)?`var(--bg-elevated)`:`transparent`,cursor:e.blocked?`not-allowed`:`pointer`,opacity:e.blocked?.5:1},children:[(0,f.jsx)(`input`,{type:`checkbox`,checked:h.has(e.domainName),disabled:e.blocked,onChange:()=>te(e.domainName),style:{marginTop:`0.15rem`}}),(0,f.jsxs)(`span`,{style:{flex:1,minWidth:0},children:[(0,f.jsx)(`span`,{className:`text-sm text-primary`,style:{display:`block`,fontWeight:500,wordBreak:`break-word`},children:e.domainName}),e.blocked&&(0,f.jsx)(`span`,{className:`text-xs text-muted`,style:{display:`block`,marginTop:`0.1rem`},children:e.blockedReason})]}),!e.blocked&&(0,f.jsx)(`span`,{className:`text-xs shrink-0`,style:{whiteSpace:`nowrap`,color:e.free?`#6ee7b7`:`var(--text-muted)`,fontWeight:e.free?600:400},children:e.free?`Free`:`${$(e.price)} / yr`})]},e.domainName)),U.length===0&&(0,f.jsxs)(`p`,{className:`text-xs text-muted py-3 text-center`,children:[`No domains match "`,_,`".`]})]}),(0,f.jsxs)(`div`,{className:`flex items-center justify-between gap-3 flex-wrap border-t border-edge pt-3`,children:[(0,f.jsx)(`p`,{className:`text-xs text-muted`,children:W.length?(0,f.jsxs)(f.Fragment,{children:[W.length,` selected · `,(0,f.jsx)(`strong`,{className:`text-primary`,children:ee?`Free`:$(G)})]}):`Nothing selected yet`}),(0,f.jsx)(`button`,{className:`btn-primary text-sm disabled:opacity-50`,disabled:!W.length,onClick:()=>{d(null),m(`confirm`)},children:`Continue`})]})]})]})}function bm({onBack:e,title:t,children:n}){return(0,f.jsxs)(`div`,{className:`p-4 md:p-6 pb-16 max-w-3xl mx-auto space-y-4`,children:[(0,f.jsxs)(`button`,{onClick:e,className:`flex items-center gap-1.5 text-sm text-accent bg-transparent border-0 cursor-pointer p-0`,children:[(0,f.jsx)(qs,{size:13}),` Back`]}),t&&(0,f.jsxs)(`h1`,{className:`text-xl font-bold text-primary flex items-center gap-2.5`,children:[(0,f.jsx)(Gc,{size:18,className:`text-faint shrink-0`}),t]}),n]})}function xm({tone:e=`info`,icon:t,children:n}){let r={success:{bg:`rgba(16,185,129,0.08)`,border:`rgba(16,185,129,0.25)`,fg:`#6ee7b7`},warning:{bg:`rgba(245,158,11,0.08)`,border:`rgba(245,158,11,0.25)`,fg:`#fbbf24`},info:{bg:`rgba(59,130,246,0.08)`,border:`rgba(59,130,246,0.25)`,fg:`#93c5fd`}},i=r[e]||r.info;return(0,f.jsxs)(`div`,{className:`rounded-xl border p-3.5 flex items-start gap-2.5`,style:{background:i.bg,borderColor:i.border},children:[t&&(0,f.jsx)(t,{size:16,className:`shrink-0 mt-0.5`,style:{color:i.fg}}),(0,f.jsx)(`div`,{className:`text-sm`,style:{color:i.fg},children:n})]})}function Sm({setTab:e,routeDomainId:t=null,onDomainRoute:n,canViewDetail:r=!0,caps:i={},bpay:a=null}){let o=i.pricing!==!1,s=o?`grid-cols-[3fr_1fr_1fr_1fr_8rem]`:`grid-cols-[3fr_1fr_1fr_8rem]`,[c,u]=(0,l.useState)(!1),[d,p]=(0,l.useState)([]),[m,h]=(0,l.useState)(!0),[g,_]=(0,l.useState)(null),[v,y]=(0,l.useState)(``),b=(t?d.find(e=>e.public_id===t):null)?.domainName||null,x=e=>n?.(e||null),[S,C]=(0,l.useState)(()=>new Set([`active`,`pending`,`external`])),[w,T]=(0,l.useState)(`expiry`),[E,D]=(0,l.useState)(`asc`),[O,k]=(0,l.useState)(1),[A,j]=(0,l.useState)(25),M=(0,l.useCallback)(async()=>{h(!0),_(null);let e=await Z(`/api/portal/domains`).catch(e=>({ok:!1,error:e.message}));e.ok?p(e.domains||[]):_(e.error||`Failed to load`),h(!1)},[]);if((0,l.useEffect)(()=>{M()},[M]),(0,l.useEffect)(()=>{k(1)},[v,S,w,E]),b){if(!r)return setTimeout(()=>x(null),0),null;let t=d.find(e=>e.domainName===b);return t?.source===`local`||vm(t)?(0,f.jsx)(ym,{preselect:b,onBack:()=>{x(null),M()},caps:i,bpay:a,setTab:e}):(0,f.jsx)(mm,{domain:b,onBack:()=>{x(null),M()},setTab:e})}let N=e=>String(e||``).startsWith(`Pending`),P=e=>e.source===`local`,F=d.filter(e=>!P(e)),I={active:F.filter(e=>e.status===`Active`).length,pending:F.filter(e=>N(e.status)).length,inactive:F.filter(e=>e.status!==`Active`&&!N(e.status)).length,external:d.filter(P).length,all:d.length},L=e=>P(e)?`external`:e.status===`Active`?`active`:N(e.status)?`pending`:`inactive`,R=S.size===0||S.has(`all`),z=S.has(`pending`);function B(e){C(t=>{if(e===`all`)return new Set([`all`]);let n=new Set(t);return n.delete(`all`),n.has(e)?n.delete(e):n.add(e),n.size===0?new Set([`all`]):n})}let V=d.filter(e=>{let t=!v||e.domainName?.toLowerCase().includes(v.toLowerCase()),n=R||S.has(L(e));return t&&n});function H(e){w===e?D(e=>e===`asc`?`desc`:`asc`):(T(e),D(`asc`))}function U({col:e}){return w===e?E===`asc`?(0,f.jsx)(rc,{size:12,className:`text-accent ml-1 inline-block`}):(0,f.jsx)(ec,{size:12,className:`text-accent ml-1 inline-block`}):(0,f.jsx)(ic,{size:12,className:`text-faint ml-1 inline-block`})}function W({col:e,label:t,className:n=``}){return(0,f.jsxs)(`button`,{onClick:()=>H(e),className:`flex items-center gap-0.5 text-xs font-semibold uppercase tracking-wide transition-colors hover:text-primary ${w===e?`text-primary`:`text-muted`} ${n}`,children:[t,(0,f.jsx)(U,{col:e})]})}let G=V.slice().sort((e,t)=>
146{if(z){let n=e.status===`Pending`?0:1,r=t.status===`Pending`?0:1;if(n!==r)return n-r}if(w===`expiry`&&!e.expiry!=!t.expiry)return e.expiry?-1:1;let n,r;return w===`domainName`?(n=e.domainName||``,r=t.domainName||``):w===`status`?(n=e.status||``,r=t.status||``):w===`amount`?(n=parseFloat(e.amount)||0,r=parseFloat(t.amount)||0):w===`expiry`&&(n=e.expiry||``,r=t.expiry||``),n<r?E===`asc`?-1:1:n>r?E===`asc`?1:-1:0}),ee=G.slice((O-1)*A,O*A);return(0,f.jsxs)(`div`,{className:`p-4 md:p-6 pb-16 max-w-4xl mx-auto`,children:[(0,f.jsxs)(`div`,{className:`flex items-start gap-3 mb-5`,children:[(0,f.jsxs)(`div`,{className:`flex-1`,children:[(0,f.jsxs)(`h1`,{className:`text-2xl font-bold text-primary flex items-center gap-2.5`,children:[(0,f.jsx)(gc,{size:22,className:`text-faint shrink-0`}),`Domains`]}),(0,f.jsx)(`div`,{className:`mt-1.5`,children:(0,f.jsx)(lf,{label:`What are domains?`,onClick:()=>u(!0)})})]}),(0,f.jsxs)(`button`,{onClick:()=>e?.(`order`),className:`btn-success gap-2 shrink-0`,children:[(0,f.jsx)(Vc,{size:14,strokeWidth:2.5}),` New order`]})]}),c&&(0,f.jsx)(cf,{title:`What are domains?`,paragraphs:uf,onClose:()=>u(!1)}),(0,f.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 mb-4`,children:[(0,f.jsx)(`div`,{className:`flex gap-1.5 flex-wrap`,children:[{key:`active`,label:`Active`},{key:`pending`,label:`Pending`},{key:`inactive`,label:`Inactive`},{key:`external`,label:`External`},{key:`all`,label:`All`}].map(e=>{let t=S.has(e.key);return(0,f.jsxs)(`button`,{onClick:()=>B(e.key),className:`px-3 py-1 rounded-full text-xs font-semibold border transition-colors`,style:{background:t?`color-mix(in srgb, var(--accent) 12%, transparent)`:`var(--bg-elevated)`,borderColor:t?`var(--accent)`:`var(--border)`,color:t?`var(--accent)`:`var(--text-muted)`},children:[e.label,(0,f.jsx)(`span`,{className:`ml-1.5 text-[10px] font-semibold opacity-70`,children:I[e.key]})]},e.key)})}),(0,f.jsxs)(`div`,{className:`relative ml-auto`,children:[(0,f.jsx)(qc,{size:14,className:`absolute left-2.5 top-1/2 -translate-y-1/2 text-faint pointer-events-none`}),(0,f.jsx)(`input`,{value:v,onChange:e=>y(e.target.value),placeholder:`Filter domainsâ¦`,className:`pl-8 pr-3 py-1.5 rounded-lg text-sm bg-elevated border border-edge text-primary placeholder:text-faint focus:outline-none focus:border-accent`,style:{width:180}})]})]}),m?(0,f.jsx)(`p`,{className:`text-sm text-muted py-8 text-center`,children:`Loading domainsâ¦`}):g?(0,f.jsx)(`div`,{className:`p-4 rounded-xl text-sm`,style:{background:`rgba(239,68,68,0.08)`,border:`1px solid rgba(239,68,68,0.2)`,color:`#f87171`},children:g}):G.length===0?(0,f.jsxs)(`div`,{className:`text-center py-12 px-4`,children:[(0,f.jsx)(gc,{size:36,className:`mx-auto mb-4 text-faint opacity-30`}),(0,f.jsx)(`p`,{className:`font-bold text-primary mb-1`,children:v?`No domains matching "${v}"`:R?`No domains yet`:`No domains match this filter`}),!v&&R&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`p`,{className:`text-sm text-muted mb-6 max-w-sm mx-auto leading-relaxed`,children:`You don't have any domain names registered with us yet. Get your domain sorted today â we can register a new one or transfer an existing domain across.`}),(0,f.jsxs)(`div`,{className:`flex flex-col gap-2 max-w-xs mx-auto`,children:[(0,f.jsxs)(`button`,{onClick:()=>e?.(`order`),className:`btn-primary gap-2`,children:[(0,f.jsx)(gc,{size:14}),` Register a new domain`]}),(0,f.jsxs)(`button`,{onClick:()=>e?.(`order`),className:`btn-secondary gap-2`,children:[(0,f.jsx)(Gc,{size:14}),` Transfer a domain to us`]})]})]})]}):(0,f.jsxs)(`div`,{className:`rounded-xl border border-edge overflow-hidden bg-surface`,children:[(0,f.jsxs)(`div`,{className:`hidden sm:grid ${s} gap-4 px-4 py-2.5 border-b border-edge bg-elevated`,children:[(0,f.jsx)(W,{col:`domainName`,label:`Domain`}),(0,f.jsx)(`div`,{style:{display:`flex`,justifyContent:`center`},children:(0,f.jsx)(W,{col:`status`,label:`Status`})}),o&&(0,f.jsx)(W,{col:`amount`,label:`Amount`}),(0,f.jsx)(W,{col:`expiry`,label:`Expiry`}),(0,f.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wide text-muted pr-6`,children:`Auto-renew`})]}),ee.map((e,t)=>{sm(e.status);let{label:n,days:i}=om(e.expiry),a=i===null?`var(--text-muted)`:i<0?`#f87171`:i<30?`#fbbf24`:`var(--text-muted)`,c=i!==null&&i<30?700:400,l=parseFloat(e.amount),u=!isNaN(l)&&l>0?$(l):`â`;return(0,f.jsxs)(r?`button`:`div`,{onClick:r?()=>x(e.public_id):void 0,className:`w-full text-left ${r?`transition-colors hover:bg-[var(--bg-hover)]`:`cursor-default`}`,style:{borderBottom:t<ee.length-1?`1px solid var(--border)`:`none`},children:[(0,f.jsxs)(`div`,{className:`hidden sm:grid ${s} gap-4 items-center px-4 py-3.5`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2.5 min-w-0`,children:[(0,f.jsx)(gc,{size:14,className:e.source===`local`?`text-faint shrink-0`:`text-accent shrink-0`}),(0,f.jsx)(`span`,{className:`font-semibold text-sm text-primary truncate`,children:e.domainName}),e.source===`local`&&(0,f.jsx)(`span`,{className:`text-[10px] font-semibold px-1.5 py-0.5 rounded shrink-0`,style:{background:`rgba(251,191,36,0.1)`,border:`1px solid rgba(251,191,36,0.25)`,color:`#fbbf24`},children:`External provider`})]}),(0,f.jsx)(`span`,{style:{display:`flex`,justifyContent:`center`},children:e.source===`local`?(0,f.jsx)(`span`,{className:`inline-flex items-center px-2.5 py-1 rounded-full text-xs font-semibold bg-zinc-500/15 text-zinc-400`,children:`Not managed`}):vm(e)?(0,f.jsx)(`span`,{className:`inline-flex items-center px-2.5 py-1 rounded-full text-xs font-semibold`,style:{background:`rgba(245,158,11,0.15)`,color:`#fbbf24`},children:`Awaiting transfer code`}):(0,f.jsx)(kd,{status:e.status||`Unknown`})}),o&&(0,f.jsxs)(`span`,{className:`text-sm text-primary font-medium`,children:[u,e.termYears>1&&u!==`â`&&(0,f.jsx)(`span`,{className:`text-xs text-muted font-normal`,children:` / ${e.termYears} yrs`})]}),(0,f.jsxs)(`span`,{className:`text-sm`,style:{color:a,fontWeight:c,textAlign:`left`},title:e.expirySource===`registry`?`Expiry at the current registrar`:void 0,children:[n,e.expirySource===`registry`&&(0,f.jsx)(`span`,{className:`text-faint`,children:`*`})]}),(0,f.jsx)(`div`,{className:`flex items-center gap-3 justify-end pr-2`,children:e.source===`local`?r&&(0,f.jsx)(`span`,{className:`text-xs font-semibold px-2.5 py-1 rounded-lg`,style:{background:`color-mix(in srgb, var(--accent) 12%, transparent)`,color:`var(--accent)`,border:`1px solid color-mix(in srgb, var(--accent) 25%, transparent)`},children:`Transfer â`}):vm(e)?(0,f.jsx)(`span`,{className:`text-xs font-semibold px-2.5 py-1 rounded-lg`,style:{background:`rgba(245,158,11,0.12)`,color:`#fbbf24`,border:`1px solid rgba(245,158,11,0.25)`},children:`Enter code â`}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`span`,{className:`text-sm text-muted`,children:e.auto_renew===!1?(0,f.jsx)(`span`,{className:`text-faint`,children:`Off`}):(0,f.jsx)(`span`,{style:{color:`#6ee7b7`},children:`On`})}),r&&(0,f.jsx)(nc,{size:14,className:`text-faint`})]})})]}),(0,f.jsxs)(`div`,{className:`sm:hidden flex items-center gap-3 px-4 py-3.5`,children:[(0,f.jsx)(gc,{size:14,className:e.source===`local`?`text-faint shrink-0`:`text-accent shrink-0`}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsx)(`p`,{className:`font-semibold text-sm text-primary truncate`,children:e.domainName}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2 mt-0.5 flex-wrap`,children:[e.source===`local`?(0,f.jsx)(`span`,{className:`text-xs font-semibold px-1.5 py-0.5 rounded`,style:{background:`rgba(251,191,36,0.1)`,border:`1px solid rgba(251,191,36,0.25)`,color:`#fbbf24`},children:`External provider`}):vm(e)?(0,f.jsx)(`span`,{className:`text-xs font-semibold px-1.5 py-0.5 rounded`,style:{background:`rgba(245,158,11,0.12)`,border:`1px solid rgba(245,158,11,0.25)`,color:`#fbbf24`},children:`Awaiting transfer code`}):(0,f.jsx)(kd,{status:e.status||`Unknown`}),(0,f.jsx)(`span`,{className:`text-xs`,style:{color:a,fontWeight:c},children:n})]})]}),o&&u!==`â`&&(0,f.jsx)(`span`,{className:`text-sm font-semibold text-primary shrink-0`,children:u}),e.source===`local`?r&&(0,f.jsx)(`span`,{className:`text-xs font-semibold px-2 py-1 rounded-lg shrink-0`,style:{background:`color-mix(in srgb, var(--accent) 12%, transparent)`,color:`var(--accent)`},children:`Transfer â`}):vm(e)?r&&(0,f.jsx)(`span`,{className:`text-xs font-semibold px-2 py-1 rounded-lg shrink-0`,style:{background:`rgba(245,158,11,0.12)`,color:`#fbbf24`},children:`Enter code â`}):r&&(0,f.jsx)(nc,{size:14,className:`text-faint shrink-0`})]})]},e.public_id||e.domainName)}),(0,f.jsx)(Md,{total:G.length,page:O,pageSize:A,onPage:k,onPageSize:j})]})]})}function Cm({text:e}){let[t,n]=(0,l.useState)(!1);function r(){navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),1500)})}return(0,f.jsxs)(`button`,{className:`btn-secondary`,onClick:r,children:[t?(0,f.jsx)($s,{size:12}):(0,f.jsx)(oc,{size:12}),t?`Copied!`:`Copy Link`]})}function wm(e){if(!e)return`â`;let[t,n]=String(e).split(`@`);return n?t.slice(0,3)+`**@`+n:`â`}function Tm({status:e}
146){let t={pending:{bg:`rgba(245,158,11,0.15)`,color:`#fbbf24`,border:`rgba(245,158,11,0.25)`},approved:{bg:`rgba(59,130,246,0.15)`,color:`#60a5fa`,border:`rgba(59,130,246,0.25)`},rejected:{bg:`rgba(239,68,68,0.15)`,color:`#f87171`,border:`rgba(239,68,68,0.25)`},paid:{bg:`rgba(34,197,94,0.15)`,color:`#4ade80`,border:`rgba(34,197,94,0.25)`}}[e]||{bg:`rgba(113,113,122,0.15)`,color:`#a1a1aa`,border:`rgba(113,113,122,0.25)`};return(0,f.jsx)(`span`,{style:{background:t.bg,color:t.color,border:`1px solid ${t.border}`,padding:`2px 8px`,borderRadius:6,fontSize:11,fontWeight:600},children:nh[e]||e})}function Em({client:e,affiliateStatus:t=null,onStatusChange:n}){let[r,i]=(0,l.useState)(null),[a,o]=(0,l.useState)(!0),[s,c]=(0,l.useState)(!1),[u,d]=(0,l.useState)(null);async function p(){o(!0);try{let e=await Z(`/api/portal/affiliate`);e.ok&&(i(e),n&&n(e.affiliate?{status:e.affiliate.status,blocked:e.affiliate.blocked}:null))}catch{}o(!1)}(0,l.useEffect)(()=>{p()},[]);async function m(){c(!0),d(null);try{let e=await Z(`/api/portal/affiliate/join`,{method:`POST`});if(!e.ok)throw Error(e.error||`Failed to join`);await p()}catch(e){d(e.message)}c(!1)}if(a)return(0,f.jsx)(`div`,{className:`flex items-center justify-center py-20`,children:(0,f.jsx)(X,{size:20,className:`animate-spin text-faint`})});let h=r?.affiliate,g=!h||h.status===`inactive`,_=r?.referrals||[],v=r?.clicks||0,y=parseFloat(r?.earned||0),b=parseFloat(r?.credits||0),x=h?`${window.location.protocol}//${window.location.hostname}/?ref=${h.slug}`:``,S=Number(r?.defaults?.reward_amt??h?.reward_amt??0),C=Number(r?.defaults?.credit_amt??h?.credit_amt??0),w=e=>`$`+(Number(e)||0).toFixed(2);return(0,f.jsxs)(`div`,{className:`mx-auto px-4 py-8 flex flex-col gap-6`,style:{maxWidth:896},children:[(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`h1`,{className:`text-2xl font-bold text-primary flex items-center gap-2.5`,children:[(0,f.jsx)(mc,{size:22,className:`text-faint shrink-0`}),`Refer & Earn`]}),(0,f.jsx)(`p`,{className:`text-sm mt-1 text-muted`,children:C>0?`Share your unique link. When a friend signs up and pays, you get ${w(S)} and they get ${w(C)} in account credit.`:`Share your unique link. When a friend signs up and pays their first invoice, you earn ${w(S)} in account credit.`})]}),g?(0,f.jsxs)(`div`,{className:`rounded-2xl p-6 flex flex-col gap-4 items-center text-center bg-surface border border-edge`,children:[(0,f.jsx)(mc,{size:32,className:`text-accent`}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{className:`font-semibold text-primary`,children:`Join the Affiliate Program`}),(0,f.jsxs)(`div`,{className:`text-sm mt-1 text-muted`,children:[`Get a unique referral link and earn `,w(S),` for every friend who signs up and pays their first invoice.`]})]}),u&&(0,f.jsx)(`div`,{style:{color:`#f87171`,fontSize:13},children:u}),(0,f.jsxs)(`button`,{className:`btn-primary`,onClick:m,disabled:s,children:[s?(0,f.jsx)(X,{size:14,className:`animate-spin`}):(0,f.jsx)(mc,{size:14}),`Get My Referral Link`]})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`div`,{className:`grid grid-cols-2 gap-3`,children:[{label:`Clicks`,value:v},{label:`Referrals`,value:_.length},{label:`Earnings`,value:`$`+y.toFixed(2)},{label:`Credits Applied`,value:`$`+b.toFixed(2)}].map(e=>(0,f.jsxs)(`div`,{className:`rounded-xl p-4 bg-surface border border-edge`,children:[(0,f.jsx)(`div`,{className:`text-xs uppercase tracking-widest mb-1 text-faint`,children:e.label}),(0,f.jsx)(`div`,{className:`text-xl font-bold text-primary`,children:e.value})]},e.label))}),(0,f.jsxs)(`div`,{className:`rounded-2xl p-5 flex flex-col gap-3 bg-surface border border-edge`,children:[(0,f.jsx)(`div`,{className:`text-xs font-semibold uppercase tracking-widest text-faint`,children:`Your Referral Link`}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`code`,{className:`flex-1 text-xs font-mono px-3 py-2 rounded-lg truncate`,style:{background:`var(--bg-elevated)`,color:`var(--text-muted)`,border:`1px solid var(--border)`},children:x}),(0,f.jsx)(Cm,{text:x})]})]}),(0,f.jsxs)(`div`,{className:`rounded-2xl p-5 bg-surface border border-edge`,children:[(0,f.jsx)(`div`,{className:`text-xs font-semibold uppercase tracking-widest mb-4 text-faint`,children:`How It Works`}),(0,f.jsx)(`div`,{className:`flex gap-4`,children:[{n:`1`,title:`Share Link`,desc:`Send your unique link to friends`},{n:`2`,title:`They Sign Up & Pay`,desc:`They open an account through your link and pay their first invoice`},C>0?{n:`3`,title:`Both Get Credit`,desc:`You earn ${w(S)}, they get ${w(C)}`}:{n:`3`,title:`You Get Credit`,desc:`You earn ${w(S)} in account credit`}].map(e=>(0,f.jsxs)(`div`,{className:`flex-1 text-center`,children:[(0,f.jsx)(`div`,{className:`w-8 h-8 rounded-full flex items-center justify-center text-sm font-bold mx-auto mb-2`,style:{background:`rgba(249,115,22,0.15)`,color:`var(--accent)`,border:`1px solid rgba(249,115,22,0.3)`},children:e.n}),(0,f.jsx)(`div`,{className:`text-sm font-semibold text-primary`,children:e.title}),(0,f.jsx)(`div`,{className:`text-xs mt-0.5 text-muted`,children:e.desc})]},e.n))}),(0,f.jsx)(`div`,{className:`text-[11px] text-faint mt-4 pt-3 border-t border-edge`,children:`Credit is confirmed once your referral pays their first invoice, and lands in your account 30 days later.`})]}),_.length>0&&(0,f.jsxs)(`div`,{className:`rounded-2xl overflow-hidden bg-surface border border-edge`,children:[(0,f.jsx)(`div`,{className:`px-5 py-3 border-b border-edge`,children:(0,f.jsx)(`div`,{className:`text-xs font-semibold uppercase tracking-widest text-faint`,children:`Referral History`})}),(0,f.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,f.jsx)(`thead`,{children:(0,f.jsxs)(`tr`,{style:{borderBottom:`1px solid var(--border)`},children:[(0,f.jsx)(`th`,{className:`text-left px-4 py-2 text-xs text-faint`,children:`Date`}),(0,f.jsx)(`th`,{className:`text-left px-4 py-2 text-xs text-faint`,children:`Client`}),(0,f.jsx)(`th`,{className:`text-left px-4 py-2 text-xs text-faint`,children:`Status`})]})}),(0,f.jsx)(`tbody`,{children:_.map(e=>(0,f.jsxs)(`tr`,{style:{borderBottom:`1px solid var(--border)`},children:[(0,f.jsx)(`td`,{className:`px-4 py-2 text-xs text-muted`,children:new Date(e.created_at).toLocaleDateString(`en-AU`,{day:`2-digit`,month:`short`,year:`numeric`})}),(0,f.jsx)(`td`,{className:`px-4 py-2 text-xs text-muted`,children:wm(e.ref_email)}),(0,f.jsx)(`td`,{className:`px-4 py-2`,children:(0,f.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[(0,f.jsx)(Tm,{status:e.status}),e.status===`approved`&&e.mature_at&&new Date(e.mature_at)>new Date&&(0,f.jsxs)(`span`,{className:`text-[11px] text-faint whitespace-nowrap`,children:[`Available `,Q(e.mature_at)]})]})})]},e.id))})]})]})]})]})}function Dm({isActive:e}){let[t,n]=(0,l.useState)([]),[r,i]=(0,l.useState)(!0),[a,o]=(0,l.useState)({}),[s,c]=(0,l.useState)(null),[u,d]=(0,l.useState)(null),[p,m]=(0,l.useState)(null),[h,g]=(0,l.useState)(``),[_,v]=(0,l.useState)({});async function y(){i(!0);try{let e=await Z(`/api/portal/reseller/products`);if(e.ok){n(e.products||[]);let t={};for(let n of e.products||[])t[n.id]={display_name:n.display_name===n.name?``:n.display_name||``,markup_pct:n.markup_pct??``,override_price:n.override_price??``};o(t)}}catch(e){d(e.message)}i(!1)}(0,l.useEffect)(()=>{y()},[]);function b(e){let t=parseFloat(e);return isNaN(t)?`â`:`$`+t.toFixed(2)}async function x(e,t){c(e.id),d(null);try{let n=a[e.id]||{},r=await Z(`/api/portal/reseller/products/${e.id}`,{method:`PUT`,body:JSON.stringify({enabled:t,display_name:n.display_name||null,markup_pct:n.markup_pct===``?null:n.markup_pct,override_price:n.override_price===``?null:n.override_price})});if(!r.ok)throw Error(r.error||`Failed`);await y()}catch(e){d(e.message)}c(null)}async function S(e){c(e.id),d(null);try{let t=a[e.id]||{},n=await Z(`/api/portal/reseller/products/${e.id}`,{method:`PUT`,body:JSON.stringify({enabled:e.enabled,display_name:t.display_name||null,markup_pct:t.markup_pct===``?null:t.markup_pct,override_price:t.override_price===``?null:t.override_price})});if(!n.ok)throw Error(n.error||`Failed`);m(e.id),setTimeout(()=>m(null),1500),await y()}catch(e){d(e.message)}c(null)}async function C(e){if(window.confirm(`Reset overrides for "${e.name}"? It will use the wholesale price and original name.`)){c(e.id),d(null);try{let t=await Z(`/api/portal/reseller/products/${e.id}`,{method:`DELETE`});if(!t.ok)throw Error(t.error||`Failed`);await y()}catch(e){d(e.message)}c(null)}}let w=t.filter(e=>{if(!h)return!0;let t=h.toLowerCase();return e.name.toLowerCase().includes(t)||(e.category||``).toLowerCase().includes(t)||(e.display_name||``).toLowerCase().includes(t)}),T={};for(let e of w){let t=e.group_name||e.category||`Other`;T[t]||(T[t]=[]),T[t].push(e)}let E=Object.keys(T).sort();return(0,f.jsxs)(`div`,{className:`rounded-2xl bg-surface border border-edge overflow-hidden`,children:[(0,f.jsxs)(`div`,{className:`px-5 py-4 border-b border-edge flex items-center justify-between gap-3 flex-wrap`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{className:`text-xs font-semibold uppercase tracking-widest text-faint`,children:`Services / Products`}),(0,f.jsx)(`div`,{className:`text-xs text-muted mt-0.5`,children:`Enable products in your storefront, rename them, and set markup or override the price.`})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`input`,{value:h,onChange:e=>g(e.target.value),placeholder:`Searchâ¦`,className:`bg-elevated border border-edge rounded-lg px-3 py-1.5 text-xs text-primary outline-none focus:border-accent/40 w-44`}),(0,f.jsx)(`button`,{onClick:y,className:`p-1.5 rounded border border-edge text-muted hover:text-primary`,title:`Refresh`,children:(0,f.jsx)(Gc,{size:12})})]})]}),!e&&(0,f.jsx)(`div`,{className:`px-5 py-3 text-xs text-amber-400 bg-amber-500/5 border-b border-edge`,children:`Your reseller account isn't active yet â settings here are saved but won't show on your storefront until you're approved.`}),u&&(0,f.jsx)(`div`,{className:`px-5 py-2 text-xs text-rose-400 bg-rose-500/5 border-b border-edge`,children:u}),r?(0,f.jsx)(`div`,{className:`px-5 py-8 text-center`,children:(0,f.jsx)(X,{size:16,className:`animate-spin text-faint inline`})}):w.length===0?(0,f.jsx)(`div`,{className:`px-5 py-8 text-xs text-faint text-center`,children:`No products available yet`}
146):(0,f.jsx)(`div`,{className:`divide-y divide-edge`,children:E.map(e=>{let t=T[e],n=_[e]!==!1;return(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`button`,{onClick:()=>v({..._,[e]:!n}),className:`w-full flex items-center justify-between px-5 py-2.5 hover:bg-elevated/40 transition-colors text-left`,children:[(0,f.jsxs)(`span`,{className:`text-xs font-semibold uppercase tracking-widest text-muted`,children:[e,` `,(0,f.jsxs)(`span`,{className:`text-faint font-normal`,children:[`(`,t.length,`)`]})]}),n?(0,f.jsx)(rc,{size:12,className:`text-faint`}):(0,f.jsx)(ec,{size:12,className:`text-faint`})]}),n&&(0,f.jsx)(`div`,{className:`divide-y divide-edge`,children:t.map(e=>{let t=a[e.id]||{},n=t.override_price!==``&&t.override_price!=null?parseFloat(t.override_price):t.markup_pct!==``&&t.markup_pct!=null?e.wholesale_price*(1+parseFloat(t.markup_pct)/100):e.wholesale_price;return(0,f.jsxs)(`div`,{className:`px-5 py-3 flex flex-col gap-2`,style:{opacity:e.enabled?1:.55,background:e.enabled?`transparent`:`rgba(0,0,0,0.15)`},children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,f.jsx)(dh,{checked:e.enabled,disabled:s===e.id,onChange:t=>x(e,t)}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-[200px]`,children:[(0,f.jsx)(`div`,{className:`text-sm font-medium text-primary`,children:e.display_name||e.name}),e.display_name!==e.name&&(0,f.jsxs)(`div`,{className:`text-[10px] text-faint`,children:[`Wholesale name: `,e.name]})]}),(0,f.jsxs)(`div`,{className:`text-right`,children:[(0,f.jsx)(`div`,{className:`text-xs text-faint`,children:`Wholesale`}),(0,f.jsxs)(`div`,{className:`text-xs font-mono text-muted`,children:[b(e.wholesale_price),` `,(0,f.jsxs)(`span`,{className:`text-faint`,children:[`/`,e.billing_cycle?.toLowerCase().slice(0,2)||`mo`]})]})]}),(0,f.jsxs)(`div`,{className:`text-right`,children:[(0,f.jsx)(`div`,{className:`text-xs text-faint`,children:`Your price`}),(0,f.jsx)(`div`,{className:`text-sm font-mono font-semibold text-primary`,children:b(n)})]})]}),(0,f.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-3 gap-2 pl-12`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-[10px] text-faint mb-0.5 uppercase tracking-wider`,children:`Display name (optional)`}),(0,f.jsx)(`input`,{className:`w-full bg-elevated border border-edge rounded-lg px-2 py-1.5 text-xs text-primary outline-none focus:border-accent/40`,placeholder:e.name,value:t.display_name||``,onChange:n=>o({...a,[e.id]:{...t,display_name:n.target.value}})})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-[10px] text-faint mb-0.5 uppercase tracking-wider`,children:`Markup %`}),(0,f.jsx)(`input`,{type:`number`,step:`0.1`,className:`w-full bg-elevated border border-edge rounded-lg px-2 py-1.5 text-xs text-primary outline-none focus:border-accent/40 disabled:opacity-40`,placeholder:`0`,disabled:t.override_price!==``&&t.override_price!=null,value:t.markup_pct??``,onChange:n=>o({...a,[e.id]:{...t,markup_pct:n.target.value}})})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-[10px] text-faint mb-0.5 uppercase tracking-wider`,children:`Override price (RRP)`}),(0,f.jsx)(`input`,{type:`number`,step:`0.01`,className:`w-full bg-elevated border border-edge rounded-lg px-2 py-1.5 text-xs text-primary outline-none focus:border-accent/40`,placeholder:`â`,value:t.override_price??``,onChange:n=>o({...a,[e.id]:{...t,override_price:n.target.value}})})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center justify-end gap-2 pl-12`,children:[e.has_override&&(0,f.jsx)(`button`,{onClick:()=>C(e),disabled:s===e.id,className:`text-[11px] text-rose-400/70 hover:text-rose-400 disabled:opacity-40`,children:`Reset`}),(0,f.jsx)(`button`,{onClick:()=>S(e),disabled:s===e.id,className:`px-3 py-1 rounded-lg bg-accent/15 border border-accent/30 text-[11px] font-semibold disabled:opacity-40`,style:{color:`var(--accent)`},children:s===e.id?`Savingâ¦`:p===e.id?`Saved â`:`Save`})]})]},e.id)})})]},e)})})]})}function Om({isActive:e}){let[t,n]=(0,l.useState)([]),[r,i]=(0,l.useState)(!0),[a,o]=(0,l.useState)(null),[s,c]=(0,l.useState)({}),[u,d]=(0,l.useState)(null),[p,m]=(0,l.useState)(null),[h,g]=(0,l.useState)(``),[_,v]=(0,l.useState)(!1);async function y(){i(!0);try{let e=await Z(`/api/portal/reseller/domains`);if(e.ok){n(e.domains||[]);let t={};for(let n of e.domains||[])t[n.tld]={markup_pct:n.markup_pct??``,override_register:n.override_register??``,override_renew:n.override_renew??``,override_transfer:n.override_transfer??``};c(t)}}catch(e){o(e.message)}i(!1)}(0,l.useEffect)(()=>{y()},[]);let b=e=>isNaN(parseFloat(e))?`â`:`$`+parseFloat(e).toFixed(2);async function x(e,t){d(e.tld),o(null);try{let n=s[e.tld]||{},r=await Z(`/api/portal/reseller/domains/${encodeURIComponent(e.tld)}`,{method:`PUT`,body:JSON.stringify({enabled:t,markup_pct:n.markup_pct===``?null:n.markup_pct,override_register:n.override_register===``?null:n.override_register,override_renew:n.override_renew===``?null:n.override_renew,override_transfer:n.override_transfer===``?null:n.override_transfer})});if(!r.ok)throw Error(r.error||`Failed`);await y()}catch(e){o(e.message)}d(null)}async function S(e){d(e.tld),o(null);try{let t=s[e.tld]||{},n=await Z(`/api/portal/reseller/domains/${encodeURIComponent(e.tld)}`,{method:`PUT`,body:JSON.stringify({enabled:e.enabled,markup_pct:t.markup_pct===``?null:t.markup_pct,override_register:t.override_register===``?null:t.override_register,override_renew:t.override_renew===``?null:t.override_renew,override_transfer:t.override_transfer===``?null:t.override_transfer})});if(!n.ok)throw Error(n.error||`Failed`);m(e.tld),setTimeout(()=>m(null),1500),await y()}catch(e){o(e.message)}d(null)}async function C(e){if(window.confirm(`Reset overrides for "${e.tld}"?`)){d(e.tld),o(null);try{let t=await Z(`/api/portal/reseller/domains/${encodeURIComponent(e.tld)}`,{method:`DELETE`});if(!t.ok)throw Error(t.error||`Failed`);await y()}catch(e){o(e.message)}d(null)}}let w=t.filter(e=>_&&!e.enabled?!1:h?e.tld.toLowerCase().includes(h.toLowerCase()):!0);return(0,f.jsxs)(`div`,{className:`rounded-2xl bg-surface border border-edge overflow-hidden`,children:[(0,f.jsxs)(`div`,{className:`px-5 py-4 border-b border-edge flex items-center justify-between gap-3 flex-wrap`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{className:`text-xs font-semibold uppercase tracking-widest text-faint`,children:`Domains / TLD Pricing`}),(0,f.jsx)(`div`,{className:`text-xs text-muted mt-0.5`,children:`Enable TLDs in your storefront, set a markup % or override register/renew/transfer prices.`})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs text-muted cursor-pointer`,children:[(0,f.jsx)(`input`,{type:`checkbox`,checked:_,onChange:e=>v(e.target.checked)}),`Enabled only`]}),(0,f.jsx)(`input`,{value:h,onChange:e=>g(e.target.value),placeholder:`Search TLDâ¦`,className:`bg-elevated border border-edge rounded-lg px-3 py-1.5 text-xs text-primary outline-none focus:border-accent/40 w-32`}),(0,f.jsx)(`button`,{onClick:y,className:`p-1.5 rounded border border-edge text-muted hover:text-primary`,title:`Refresh`,children:(0,f.jsx)(Gc,{size:12})})]})]}),!e&&(0,f.jsx)(`div`,{className:`px-5 py-3 text-xs text-amber-400 bg-amber-500/5 border-b border-edge`,children:`Your reseller account isn't active yet â pricing changes are saved but won't show on your storefront until you're approved.`}),a&&(0,f.jsx)(`div`,{className:`px-5 py-2 text-xs text-rose-400 bg-rose-500/5 border-b border-edge`,children:a}
146),r?(0,f.jsx)(`div`,{className:`px-5 py-8 text-center`,children:(0,f.jsx)(X,{size:16,className:`animate-spin text-faint inline`})}):w.length===0?(0,f.jsx)(`div`,{className:`px-5 py-8 text-xs text-faint text-center`,children:`No TLDs available`}):(0,f.jsx)(`div`,{className:`overflow-x-auto`,children:(0,f.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,f.jsx)(`thead`,{children:(0,f.jsxs)(`tr`,{className:`border-b border-edge`,children:[(0,f.jsx)(`th`,{className:`text-left px-4 py-2 text-[10px] uppercase tracking-widest text-faint font-semibold`,children:`On`}),(0,f.jsx)(`th`,{className:`text-left px-4 py-2 text-[10px] uppercase tracking-widest text-faint font-semibold`,children:`TLD`}),(0,f.jsx)(`th`,{className:`text-left px-4 py-2 text-[10px] uppercase tracking-widest text-faint font-semibold`,children:`Markup %`}),(0,f.jsx)(`th`,{className:`text-left px-4 py-2 text-[10px] uppercase tracking-widest text-faint font-semibold`,children:`Register`}),(0,f.jsx)(`th`,{className:`text-left px-4 py-2 text-[10px] uppercase tracking-widest text-faint font-semibold`,children:`Renew`}),(0,f.jsx)(`th`,{className:`text-left px-4 py-2 text-[10px] uppercase tracking-widest text-faint font-semibold`,children:`Transfer`}),(0,f.jsx)(`th`,{className:`text-right px-4 py-2 text-[10px] uppercase tracking-widest text-faint font-semibold`,children:`Actions`})]})}),(0,f.jsx)(`tbody`,{children:w.map(e=>{let t=s[e.tld]||{};return(0,f.jsxs)(`tr`,{className:`border-b border-edge`,style:{opacity:e.enabled?1:.5},children:[(0,f.jsx)(`td`,{className:`px-4 py-2`,children:(0,f.jsx)(dh,{checked:e.enabled,disabled:u===e.tld,onChange:t=>x(e,t)})}),(0,f.jsxs)(`td`,{className:`px-4 py-2 text-sm font-mono text-primary`,children:[`.`,e.tld.replace(/^\./,``)]}),(0,f.jsx)(`td`,{className:`px-4 py-2`,children:(0,f.jsx)(`input`,{type:`number`,step:`0.1`,placeholder:`â`,className:`w-16 bg-elevated border border-edge rounded px-2 py-1 text-xs text-primary outline-none focus:border-accent/40`,value:t.markup_pct??``,onChange:n=>c({...s,[e.tld]:{...t,markup_pct:n.target.value}})})}),[`register`,`renew`,`transfer`].map(n=>{let r=e[`wholesale_${n}`],i=`override_${n}`,a=e[`effective_${n}`];return(0,f.jsx)(`td`,{className:`px-4 py-2`,children:(0,f.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,f.jsx)(`input`,{type:`number`,step:`0.01`,placeholder:b(r),className:`w-20 bg-elevated border border-edge rounded px-2 py-1 text-xs text-primary outline-none focus:border-accent/40`,value:t[i]??``,onChange:n=>c({...s,[e.tld]:{...t,[i]:n.target.value}})}),(0,f.jsxs)(`div`,{className:`text-[10px] text-faint font-mono`,children:[b(r),` â `,(0,f.jsx)(`span`,{className:`text-muted`,children:b(a)})]})]})},n)}),(0,f.jsx)(`td`,{className:`px-4 py-2 text-right`,children:(0,f.jsxs)(`div`,{className:`inline-flex items-center gap-2`,children:[e.has_override&&(0,f.jsx)(`button`,{onClick:()=>C(e),disabled:u===e.tld,className:`text-[11px] text-rose-400/70 hover:text-rose-400 disabled:opacity-40`,children:`Reset`}),(0,f.jsx)(`button`,{onClick:()=>S(e),disabled:u===e.tld,className:`px-2 py-1 rounded bg-accent/15 border border-accent/30 text-[11px] font-semibold disabled:opacity-40`,style:{color:`var(--accent)`},children:u===e.tld?`Savingâ¦`:p===e.tld?`Saved â`:`Save`})]})})]},e.tld)})})]})})]})}var km=[{type:`referral`,name:`Referral Partner`,tagline:`Send customers our way. We do the rest.`,summary:`Share your referral link and earn account credit for every customer who signs up and pays. We bill and support them.`},{type:`reseller`,name:`Reseller Partner`,tagline:`You manage your clients. We support you.`,summary:`You bill and support your clients directly at discounted partner pricing.`},{type:`platform`,name:`Platform Partner`,tagline:`Sell under your own pricing. We automate provisioning.`,summary:`Connect your own Stripe account, set your retail prices, and we retain a wholesale fee.`}],Am={reseller:`Reseller Partner`,platform:`Platform Partner`,referral:`Referral Partner`},jm=[{id:`statistics`,label:`Dashboard`},{id:`store-setup`,label:`Store setup`},{id:`products`,label:`Products`},{id:`pricing`,label:`Pricing`},{id:`domains`,label:`Domains`},{id:`onboarding`,label:`Onboarding`},{id:`referrals`,label:`Referrals`},{id:`statements`,label:`Statements`}
146],Mm={platform:[`statistics`,`store-setup`,`products`,`domains`],reseller:[`statistics`,`pricing`],referral:[`statistics`,`onboarding`,`referrals`]};function Nm(e,{statements:t=!1,dashboardHidden:n=!1}={}){let r=n?[`statistics`]:[...Mm[e]||[`statistics`]];return t&&r.push(`statements`),r}var Pm=e=>`$`+(Number(e)||0).toFixed(2);function Fm({label:e,value:t,sub:n,pending:r}){return(0,f.jsxs)(`div`,{className:`rounded-xl p-4 bg-surface border border-edge`,children:[(0,f.jsx)(`div`,{className:`text-xs uppercase tracking-widest mb-1 text-faint`,children:e}),(0,f.jsx)(`div`,{className:`text-xl font-bold`,style:{color:r?`var(--text-faint)`:`var(--text-primary)`},children:r?`â`:t}),(0,f.jsx)(`div`,{className:`text-[11px] mt-0.5 text-faint`,children:r?`Not yet tracked`:n||`\xA0`})]})}function Im({title:e,children:t}){return(0,f.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,f.jsx)(`div`,{className:`text-xs font-semibold uppercase tracking-widest text-faint`,children:e}),t]})}function Lm({icon:e,label:t,onClick:n}){return(0,f.jsxs)(`button`,{onClick:n,className:`flex items-center gap-2 px-3 py-2.5 rounded-xl bg-surface border border-edge text-sm text-primary transition-colors text-left hover:border-[var(--accent)]`,children:[e&&(0,f.jsx)(e,{size:15,className:`text-faint shrink-0`}),(0,f.jsx)(`span`,{className:`truncate`,children:t})]})}var Rm=[{key:`monthly`,label:`Monthly`,unit:`/mo`,only:`Monthly only`},{key:`annually`,label:`Annually`,unit:`/yr`,only:`Annual only`}],zm=(e,t)=>e>0?(e-t)/e*100:null;function Bm({label:e,children:t,width:n,tone:r}){return(0,f.jsxs)(`div`,{className:`text-right shrink-0`,style:{width:n},children:[(0,f.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-faint sm:hidden`,children:e}),(0,f.jsx)(`div`,{className:`text-sm tabular-nums`,style:{color:r===`bad`?`#f87171`:r===`good`?`#34d399`:r===`muted`?`var(--text-muted)`:`var(--text-primary)`},children:t})]})}function Vm({p:e,cycle:t,onSave:n}){let r=e.cycles[t.key],i=e.sell?.[t.key],[a,o]=(0,l.useState)(i==null?``:String(i)),[s,c]=(0,l.useState)(null);if(!r){let n=Rm.find(e=>e.key!==t.key);return(0,f.jsx)(`div`,{className:`px-4 py-3 border-b border-edge last:border-b-0 flex items-center gap-3`,children:(0,f.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,f.jsx)(`div`,{className:`text-sm text-muted truncate`,children:e.name}),(0,f.jsxs)(`div`,{className:`text-[11px] text-faint`,children:[`Not sold `,t.label.toLowerCase(),` â `,n.only.toLowerCase()]})]})})}let u=a===``?null:parseFloat(a),d=u!=null&&Number.isFinite(u)&&u>=0,p=d?Math.round((u-r.buy)*100)/100:null,m=d?zm(u,r.buy):null;async function h(){let r=a.trim()===``?null:Number(a);if(r!=null&&(!Number.isFinite(r)||r<0)){c(`error`);return}let s=r==null?null:Math.round(r*100)/100;if((i??null)===s){o(s==null?``:s.toFixed(2)),c(null);return}c(`saving`);try{await n(e.id,t.key,r),o(r==null?``:r.toFixed(2)),c(`saved`),setTimeout(()=>c(e=>e===`saved`?null:e),1500)}catch{c(`error`)}}return(0,f.jsxs)(`div`,{className:`px-4 py-3 border-b border-edge last:border-b-0 flex flex-wrap items-center gap-x-3 sm:gap-x-4 gap-y-2`,children:[(0,f.jsxs)(`div`,{className:`min-w-0 w-full sm:w-auto sm:flex-1`,children:[(0,f.jsx)(`div`,{className:`text-sm text-primary truncate`,children:e.name}),e.excluded&&(0,f.jsx)(`div`,{className:`text-[11px]`,style:{color:`#fbbf24`},children:`No partner discount on this product`})]}),(0,f.jsx)(Bm,{label:`RRP`,width:78,tone:`muted`,children:Wm(r.rrp)}),(0,f.jsx)(Bm,{label:`You pay`,width:86,children:Wm(r.buy)}),(0,f.jsxs)(`div`,{className:`shrink-0`,style:{width:116},children:[(0,f.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-faint sm:hidden`,children:`Your price`}),(0,f.jsxs)(`div`,{className:`relative`,children:[(0,f.jsx)(`span`,{className:`absolute left-2 top-1/2 -translate-y-1/2 text-xs text-faint pointer-events-none`,children:`$`}),(0,f.jsx)(`input`,{value:a,onChange:e=>{o(e.target.value.replace(/[^0-9.]/g,``)),c(null)},onBlur:h,onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur()},inputMode:`decimal`,placeholder:r.rrp.toFixed(2),className:`w-full bg-elevated border rounded-lg pl-5 pr-6 py-1.5 text-sm text-primary text-right tabular-nums outline-none focus:border-accent/40 placeholder:text-[var(--text-faint)]`,style:{borderColor:s===`error`?`rgba(239,68,68,0.5)`:`var(--border)`}}),s===`saving`&&(0,f.jsx)(X,{size:12,className:`animate-spin text-faint absolute right-2 top-1/2 -translate-y-1/2`}),s===`saved`&&(0,f.jsx)($s,{size:12,style:{color:`#34d399`},className:`absolute right-2 top-1/2 -translate-y-1/2`})]})]}),(0,f.jsx)(Bm,{label:`Profit`,width:86,tone:p==null?`muted`:p<0?`bad`:`good`,children:p==null?`â`:(p<0?`â`:``)+Wm(Math.abs(p))}),(0,f.jsx)(Bm,{label:`Margin`,width:64,tone:m==null?`muted`:m<0?`bad`:void 0,children:m==null?`â`:(m<0?`â`:``)+Math.abs(m).toFixed(0)+`%`})]})}function Hm({isActive:e}){let[t,n]=(0,l.useState)(null),[r,i]=(0,l.useState)(!0),[a,o]=(0,l.useState)(null),[s,c]=(0,l.useState)(``),[u,d]=(0,l.useState)(()=>{try{return sessionStorage.getItem(`portal:pricing:cycle`)||`monthly`}catch{return`monthly`}});(0,l.useEffect)(()=>{try{sessionStorage.setItem(`portal:pricing:cycle`,u)}catch{}},[u]);let p=Rm.find(e=>e.key===u)||Rm[0];async function m(){i(!0);try{let e=await Z(`/api/portal/reseller/pricing`);if(!e.ok)throw Error(e.error||`Failed to load pricing`);n(e),o(null)}catch(e){o(e.message)}i(!1)}(0,l.useEffect)(()=>{m()},[]);async function h(e,r,i){let a=t.products.find(t=>
146t.id===e),o={sell_monthly:r===`monthly`?i:a?.sell?.monthly??null,sell_annually:r===`annually`?i:a?.sell?.annually??null},s=await Z(`/api/portal/reseller/pricing/${e}`,{method:`PUT`,body:JSON.stringify(o)});if(!s.ok)throw Error(s.error||`Save failed`);n(t=>({...t,products:t.products.map(t=>t.id===e?{...t,sell:s.sell}:t)}))}if(r)return(0,f.jsx)(`div`,{className:`flex items-center justify-center py-16`,children:(0,f.jsx)(X,{size:18,className:`animate-spin text-faint`})});if(a||!t)return(0,f.jsx)(`div`,{className:`rounded-2xl p-6 bg-surface border border-edge text-sm text-muted text-center`,children:a||`Pricing unavailable.`});let g=s.trim().toLowerCase(),_=t.products.filter(e=>!g||e.name.toLowerCase().includes(g)||e.group_name.toLowerCase().includes(g)),v=[];for(let e of _){let t=v.find(t=>t.name===e.group_name);t?t.items.push(e):v.push({name:e.group_name,items:[e]})}let y=t.products.map(e=>({price:e.cycles[p.key],sell:e.sell?.[p.key]})).filter(e=>e.price&&e.sell!=null&&e.sell>0),b=y.length?y.reduce((e,t)=>e+zm(t.sell,t.price.buy),0)/y.length:null,x=t.products.filter(e=>e.cycles[p.key]).length;return(0,f.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,f.jsxs)(`div`,{className:`rounded-2xl bg-surface border border-edge overflow-hidden`,children:[(0,f.jsxs)(`div`,{className:`px-5 py-4 border-b border-edge flex items-start justify-between gap-3 flex-wrap`,children:[(0,f.jsxs)(`div`,{className:`min-w-0`,children:[(0,f.jsx)(`div`,{className:`text-sm font-semibold text-primary`,children:`Partner pricing`}),(0,f.jsxs)(`div`,{className:`text-xs text-muted mt-0.5`,style:{maxWidth:560},children:[`RRP is what your client would pay us direct. `,(0,f.jsx)(`span`,{className:`text-primary`,children:`You pay`}),` is what we invoice you`,t.discount_pct>0?` at your ${t.discount_pct}% partner rate`:``,` â GST inclusive. Set your own price to see profit and margin; it's saved for your reference only and never charged to anyone.`]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,f.jsx)(`input`,{value:s,onChange:e=>c(e.target.value),placeholder:`Searchâ¦`,className:`bg-elevated border border-edge rounded-lg px-3 py-1.5 text-xs text-primary outline-none focus:border-accent/40 w-36`}),(0,f.jsx)(`div`,{className:`flex items-center gap-1 rounded-lg p-0.5 bg-elevated border border-edge`,children:Rm.map(e=>(0,f.jsx)(`button`,{onClick:()=>
146d(e.key),className:`px-2.5 py-1 rounded-md text-xs font-medium transition-colors`,style:{background:u===e.key?`var(--bg-active)`:`transparent`,color:u===e.key?`var(--text-primary)`:`var(--text-muted)`},children:e.label},e.key))})]})]}),!e&&(0,f.jsx)(`div`,{className:`px-5 py-2.5 text-xs border-b border-edge`,style:{background:`rgba(245,158,11,0.08)`,color:`#fbbf24`},children:`Your partner account isn't active yet, so these are retail prices â your partner rate applies once you're approved.`}),u===`annually`&&t.discount_pct>0&&t.products.some(e=>e.two_mo_free)&&(0,f.jsxs)(`div`,{className:`px-5 py-2.5 text-xs border-b border-edge text-muted`,style:{background:`rgba(56,189,248,0.06)`},children:[`Annual retail already has two months free built into it, so your `,t.discount_pct,`% comes off the full twelve-month price rather than the promo â the two never stack. That's why the annual saving reads smaller than `,t.discount_pct,`%: you're already getting most of it as free months.`]}),(0,f.jsxs)(`div`,{className:`px-5 py-2.5 border-b border-edge flex items-center gap-4 flex-wrap text-xs text-muted`,children:[(0,f.jsxs)(`span`,{children:[x,` product`,x===1?``:`s`,` available `,p.label.toLowerCase()]}),(0,f.jsx)(`span`,{className:`text-faint`,children:`·`}),(0,f.jsxs)(`span`,{children:[y.length,` priced by you`]}),b!=null&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`span`,{className:`text-faint`,children:`·`}),(0,f.jsxs)(`span`,{children:[`Average margin `,(0,f.jsxs)(`span`,{className:`text-primary font-semibold`,children:[b.toFixed(0),`%`]})]})]})]}),(0,f.jsxs)(`div`,{className:`px-4 py-2 border-b border-edge hidden sm:flex items-center gap-x-4 bg-elevated/40`,children:[(0,f.jsx)(`div`,{className:`flex-1 text-[10px] uppercase tracking-wider text-faint`,children:`Product`}),(0,f.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-faint text-right shrink-0`,style:{width:78},children:`RRP`}),(0,f.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-faint text-right shrink-0`,style:{width:86},children:`You pay`}),(0,f.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-faint text-right shrink-0`,style:{width:116},children:`Your price`}),(0,f.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-faint text-right shrink-0`,style:{width:86},children:`Profit`}),(0,f.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-faint text-right shrink-0`,style:{width:64},children:`Margin`})]}),v.length===0?(0,f.jsxs)(`div`,{className:`px-5 py-8 text-xs text-faint text-center`,children:[`No products match â`,s,`â.`]}):v.map(e=>(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{className:`px-4 py-2 text-[11px] font-semibold uppercase tracking-widest text-faint bg-elevated/60 border-b border-edge`,children:e.name}),e.items.map(e=>(0,f.jsx)(Vm,{p:e,cycle:p,onSave:h},`${e.id}-${p.key}`))]},e.name))]}),(0,f.jsx)(`div`,{className:`text-[11px] text-faint px-1`,children:`Prices are current retail and can change; your invoice is always priced at the rate on the day it's raised.`})]})}var Um=`#38bdf8`,Wm=e=>`$`+(Number(e)||0).toLocaleString(`en-AU`,{minimumFractionDigits:2,maximumFractionDigits:2}),Gm=e=>e<0?`${Math.abs(e)}d overdue`:e===0?`today`:e===1?`tomorrow`:`in ${e} days`;function Km({label:e,value:t,sub:n,tone:r,onClick:i}){return(0,f.jsxs)(i?`button`:`div`,{onClick:i,className:`rounded-xl p-4 bg-surface border border-edge text-left`+(i?` transition-colors hover:border-[var(--accent)]`:``),children:[(0,f.jsx)(`div`,{className:`text-xs uppercase tracking-widest mb-1 text-faint`,children:e}),(0,f.jsx)(`div`,{className:`text-xl font-bold`,style:{color:r===`warn`?`#fbbf24`:r===`bad`?`#f87171`:r===`good`?`#34d399`:`var(--text-primary)`},children:t}),(0,f.jsx)(`div`,{className:`text-[11px] mt-0.5 text-faint`,children:n||` `})]})}function qm({item:e,onOpenService:t,onOpenDomain:n,onOpenInvoice:r}){let i=e.kind===`domain`?gc:Yc,a=()=>{e.kind===`domain`?n?.(e.public_id):t?.(e.public_id)},o=e.wholesale<e.retail;return(0,f.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-3 border-b border-edge last:border-b-0`,children:[(0,f.jsx)(i,{size:15,className:`text-faint shrink-0`}),(0,f.jsxs)(`button`,{onClick:a,className:`min-w-0 flex-1 text-left`,children:[(0,f.jsx)(`div`,{className:`text-sm text-primary truncate`,children:e.label}),(0,f.jsxs)(`div`,{className:`text-xs text-faint truncate`,children:[e.kind===`service`&&e.domain?e.domain+` · `:``,e.cycle,e.auto_renew===!1&&(0,f.jsx)(`span`,{style:{color:`#fbbf24`},children:` · auto-renew off`})]})]}),(0,f.jsxs)(`div`,{className:`text-right shrink-0`,children:[(0,f.jsx)(`div`,{className:`text-xs text-muted whitespace-nowrap`,children:Q(e.due)}),(0,f.jsx)(`div`,{className:`text-[11px] whitespace-nowrap`,style:{color:e.days<=7?`#fbbf24`:`var(--text-faint)`},children:Gm(e.days)})]}),(0,f.jsxs)(`div`,{className:`text-right shrink-0`,style:{minWidth:96},children:[(0,f.jsx)(`div`,{className:`text-sm font-semibold text-primary whitespace-nowrap`,children:Wm(e.wholesale)}),o&&(0,f.jsxs)(`div`,{className:`text-[11px] text-faint whitespace-nowrap`,children:[(0,f.jsx)(`s`,{children:Wm(e.retail)}),` retail`]})]}),(0,f.jsx)(`div`,{className:`shrink-0 hidden sm:block`,style:{minWidth:104},children:e.invoice_id?(0,f.jsx)(`button`,{onClick:()=>r?.(e.invoice_id),className:`text-[11px] px-2 py-1 rounded-md border whitespace-nowrap`,style:{background:`rgba(56,189,248,0.1)`,borderColor:`rgba(56,189,248,0.25)`,color:`#38bdf8`},children:e.invoice_num||`Invoiced`}):(0,f.jsx)(`span`,{className:`text-[11px] text-faint whitespace-nowrap`,children:`Not yet invoiced`})})]})}function Jm({programLabel:e,setTab:t,onOpenService:n,onOpenDomain:r,onOpenInvoice:i}){let[a,o]=(0,l.useState)(null),[s,c]=(0,l.useState)(!0),[u,d]=(0,l.useState)(null),[p,m]=(0,l.useState)(!0),[h,g]=(0,l.useState)(!1);if((0,l.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await Z(`/api/portal/reseller/dashboard`);if(e)return;if(!t.ok)throw Error(t.error||`Failed to load`);o(t)}catch(t){e||d(t.message)}e||c(!1)})(),()=>{e=!0}},[]),s)return(0,f.jsx)(`div`,{className:`flex items-center justify-center py-16`,children:(0,f.jsx)(X,{size:18,className:`animate-spin text-faint`})});if(u||!a)return(0,f.jsx)(`div`,{className:`rounded-2xl p-6 bg-surface border border-edge text-sm text-muted text-center`,children:u||`Dashboard unavailable.`});let{portfolio:_,billing:v,renewals:y,mix:b,partner:x}=a,S=p?y.items.filter(e=>e.days<=30):y.items,C=h?S:S.slice(0,8),w=p?y.due_30_wholesale:y.due_60_wholesale,T=S.filter(e=>!e.invoice_id).length,E=[];return v.overdue_count>0?E.push({tone:`bad`,text:`${v.overdue_count} overdue invoice${v.overdue_count===1?``:`s`} totalling ${Wm(v.overdue_total)}. Services can be suspended while these are outstanding.`,cta:`Pay now`,onClick:()=>t(`billing`)}):v.open_count>0&&E.push({tone:`warn`,text:`${v.open_count} invoice${v.open_count===1?``:`s`} open for ${Wm(v.open_total)}${v.oldest_due?`, due from ${Q(v.oldest_due)}`:``}
146.`,cta:`View invoices`,onClick:()=>t(`billing`)}),_.domains_lapsed>0&&E.push({tone:`bad`,text:`${_.domains_lapsed} domain${_.domains_lapsed===1?` has`:`s have`} passed their expiry date and may stop resolving for your client.`,cta:`Review domains`,onClick:()=>t(`domains`)}),y.domains_no_auto_renew>0&&E.push({tone:`warn`,text:`${y.domains_no_auto_renew} domain${y.domains_no_auto_renew===1?``:`s`} expiring within ${y.window_days} days ${y.domains_no_auto_renew===1?`has`:`have`} auto-renew turned off.`,cta:`Review domains`,onClick:()=>t(`domains`)}),_.services_suspended>0&&E.push({tone:`warn`,text:`${_.services_suspended} service${_.services_suspended===1?` is`:`s are`} suspended.`,cta:`View services`,onClick:()=>t(`services`)}),(0,f.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,f.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,f.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 flex-wrap`,children:[(0,f.jsx)(`div`,{className:`text-xs font-semibold uppercase tracking-widest text-faint`,children:`Your book`}),(0,f.jsxs)(`div`,{className:`text-[11px] text-faint`,children:[e,x.since?` · partner since ${Q(x.since)}`:``]})]}),(0,f.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-3`,children:[(0,f.jsx)(Km,{label:`Owing now`,tone:v.overdue_count>0?`bad`:v.open_total>0?`warn`:`good`,value:Wm(v.open_total),sub:v.open_count?`${v.open_count} open invoice${v.open_count===1?``:`s`}`:`Nothing outstanding`,onClick:()=>t(`billing`)}),(0,f.jsx)(Km,{label:`Renewing in 30 days`,value:Wm(y.due_30_wholesale),sub:`${y.due_30_count} item${y.due_30_count===1?``:`s`} at your rate`}),(0,f.jsx)(Km,{label:`Wholesale run rate`,value:Wm(_.monthly_wholesale),sub:`per month · ${Wm(_.annual_wholesale)} a year`}),(0,f.jsx)(Km,{label:`Under management`,value:_.domains_managed,sub:`${_.services_active} service${_.services_active===1?``:`s`} · ${_.domains_active} domain${_.domains_active===1?``:`s`}`}),(0,f.jsx)(Km,{label:`Partner discount`,value:x.discount_pct?x.discount_pct+`%`:`â`,sub:x.discount_pct?x.discount_live?`off retail, on every invoice`:`applies once approved`:x.discount_locked?`${x.active_services} of ${x.min_services} active services to unlock ${x.discount_rate}%`:`No wholesale rate set`})]}),(0,f.jsx)(`div`,{className:`text-[11px] text-faint`,children:`All figures are GST-inclusive and shown at your partner rate â what we invoice you, not what you charge your client.`})]}),(0,f.jsx)(Im,{title:`Needs attention`,children:E.length===0?(0,f.jsxs)(`div`,{className:`rounded-xl px-4 py-4 bg-surface border border-edge flex items-center gap-2 text-sm text-muted`,children:[(0,f.jsx)(Is,{size:16,className:`text-faint shrink-0`}),` Nothing outstanding â invoices are settled and no renewals are at risk.`]}):(0,f.jsx)(`div`,{className:`flex flex-col gap-2`,children:E.map((e,t)=>{let n=e.tone===`bad`?{bg:`rgba(239,68,68,0.08)`,border:`rgba(239,68,68,0.25)`,fg:`#f87171`}:{bg:`rgba(245,158,11,0.08)`,border:`rgba(245,158,11,0.25)`,fg:`#fbbf24`};return(0,f.jsxs)(`div`,{className:`rounded-xl px-4 py-3 flex items-center justify-between gap-3 border`,style:{background:n.bg,borderColor:n.border},children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,style:{color:n.fg},children:[(0,f.jsx)(Y,{size:16,className:`shrink-0`}),` `,e.text]}),e.cta&&(0,f.jsx)(`button`,{onClick:e.onClick,className:`btn-secondary text-xs whitespace-nowrap shrink-0`,children:e.cta})]},t)})})}),(0,f.jsx)(Im,{title:`Upcoming renewals`,children:(0,f.jsxs)(`div`,{className:`rounded-2xl bg-surface border border-edge overflow-hidden`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-4 py-3 border-b border-edge flex-wrap`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`div`,{className:`text-sm font-semibold text-primary`,children:[Wm(w),` across `,S.length,` item`,S.length===1?``:`s`]}),(0,f.jsx)(`div`,{className:`text-[11px] text-faint`,children:S.length===0?`Nothing due in this window`:T===0?`All already invoiced`:`${T} not yet invoiced`})]}),(0,f.jsx)(`div`,{className:`flex items-center gap-1 rounded-lg p-0.5 bg-elevated border border-edge`,children:[{v:!0,l:`30 days`},{v:!1,l:`${y.window_days} days`}].map(e=>(0,f.jsx)(`button`,{onClick:()=>{m(e.v),g(!1)},className:`px-2.5 py-1 rounded-md text-xs font-medium transition-colors`,style:{background:p===e.v?`var(--bg-active)`:`transparent`,color:p===e.v?`var(--text-primary)`:`var(--text-muted)`},children:e.l},e.l))})]}),S.length===0?(0,f.jsxs)(`div`,{className:`px-4 py-8 text-xs text-faint text-center`,children:[`Nothing renews in the next `,p?30:y.window_days,` days.`]}):(0,f.jsxs)(f.Fragment,{children:[C.map(e=>(0,f.jsx)(qm,{item:e,onOpenService:n,onOpenDomain:r,onOpenInvoice:i},`${e.kind}-${e.id}`)),S.length>C.length&&(0,f.jsxs)(`button`,{onClick:()=>g(!0),className:`w-full px-4 py-2.5 text-xs text-muted border-t border-edge hover:text-primary transition-colors`,children:[`Show `,S.length-C.length,` more`]})]})]})}),b.length>0&&(0,f.jsx)(Im,{title:`Plan mix`,children:(0,f.jsx)(`div`,{className:`rounded-2xl bg-surface border border-edge overflow-hidden`,children:b.slice(0,8).map(e=>{let t=b[0].monthly_wholesale||1;return(0,f.jsx)(`div`,{className:`px-4 py-2.5 border-b border-edge last:border-b-0 flex items-center gap-3`,children:(0,f.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,f.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2`,children:[(0,f.jsx)(`span`,{className:`text-sm text-primary truncate`,children:e.name}),(0,f.jsxs)(`span`,{className:`text-xs text-muted whitespace-nowrap`,children:[e.count,` à · `,Wm(e.monthly_wholesale),`/mo`]})]}),(0,f.jsx)(`div`,{className:`mt-1.5 h-1.5 rounded-full overflow-hidden`,style:{background:`var(--bg-elevated)`},children:(0,f.jsx)(`div`,{className:`h-full rounded-full`,style:{width:`${Math.max(2,Math.round(e.monthly_wholesale/t*100))}%`,background:Um,opacity:.7}})})]})},e.name)})})})]})}function Ym(e,t,n){let r=(e||``).replace(/\/+$/,``),i=`?ref=${encodeURIComponent(t||``)}`;return n?`${r}/store/configure/${n}${i}`:`${r}/${i}`}function Xm(e){let t=window.open(``,`_blank`,`noopener`);return e().then(e=>{if(!e)throw Error(`No hand-off URL`);t?t.location=e:window.location.href=e}).catch(e=>{try{t?.close()}catch{}throw e})}function Zm({product:e,onClose:t}){let[n,r]=(0,l.useState)(`existing`),[i,a]=(0,l.useState)(null),[o,s]=(0,l.useState)(``),[c,u]=(0,l.useState)(!1),[d,p]=(0,l.useState)(``),[m,h]=(0,l.useState)({firstname:``,lastname:``,email:``,companyname:``});(0,l.useEffect)(()=>{Z(`/api/portal/linked-accounts?hide_inactive=1`).then(e=>a(e.ok&&e.accounts||[])).catch(()=>a([]))},[]);async function g(n){u(!0),p(``);try{await Xm(async()=>{let t=await Z(`/api/portal/affiliate/client-order`,{method:`POST`,body:JSON.stringify({product_id:e.id,...n})});if(t.ok===!1)throw Error(t.error||`Could not start that order`);return t.url}),t()}catch(e){p(e?.message||`Could not start that order`),u(!1)}}let _=o.trim().toLowerCase(),v=(i||[]).filter(e=>
146!_||[e.companyname,e.firstname,e.lastname,e.email].filter(Boolean).join(` `).toLowerCase().includes(_));return(0,ml.createPortal)((0,f.jsx)(`div`,{className:`fixed inset-0 flex items-center justify-center p-4`,style:{zIndex:1e4,background:`rgba(0,0,0,0.7)`},onClick:e=>{e.target===e.currentTarget&&t()},children:(0,f.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface shadow-xl w-full max-w-md flex flex-col`,style:{maxHeight:`85vh`},children:[(0,f.jsxs)(`div`,{className:`p-5 border-b border-edge flex items-start justify-between gap-3`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h3`,{className:`text-base font-bold text-primary`,children:`Buy for a client`}),(0,f.jsxs)(`p`,{className:`text-xs mt-1 text-muted`,children:[e.name,` â the order and the invoice go to the client, not to you.`]})]}),(0,f.jsx)(`button`,{onClick:t,className:`text-faint hover:text-primary shrink-0`,children:(0,f.jsx)(pl,{size:16})})]}),(0,f.jsx)(`div`,{className:`flex border-b border-edge`,children:[[`existing`,`My clients`],[`new`,`New client`]].map(([e,t])=>(0,f.jsx)(`button`,{onClick:()=>{r(e),p(``)},className:`px-4 py-2.5 text-sm font-medium transition-colors`,style:{color:n===e?`var(--text-primary)`:`var(--text-muted)`,borderBottom:n===e?`2px solid var(--accent)`:`2px solid transparent`,marginBottom:-1},children:t},e))}),n===`existing`?(0,f.jsxs)(`div`,{className:`flex flex-col min-h-0`,children:[(0,f.jsx)(`div`,{className:`p-4 pb-2`,children:(0,f.jsx)(`input`,{value:o,onChange:e=>s(e.target.value),placeholder:`Search your clients`,className:`w-full rounded-lg px-3 py-2 text-sm outline-none`,style:{background:`var(--bg-elevated)`,color:`var(--text-primary)`,border:`1px solid var(--border)`}})}),(0,f.jsx)(`div`,{className:`px-4 pb-4 overflow-y-auto flex flex-col gap-1.5`,children:i===null?(0,f.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,f.jsx)(X,{size:18,className:`animate-spin text-faint`})}):v.length?v.map(e=>(0,f.jsxs)(`button`,{type:`button`,disabled:c,onClick:()=>g({account_id:e.id}),className:`text-left rounded-xl px-3 py-2.5 border transition-colors hover:border-[var(--accent)] disabled:opacity-40`,style:{borderColor:`var(--border)`,background:`var(--bg-elevated)`},children:[(0,f.jsx)(`div`,{className:`text-sm text-primary truncate`,children:e.companyname||[e.firstname,e.lastname].filter(Boolean).join(` `)||e.email}),(0,f.jsx)(`div`,{className:`text-xs text-muted truncate`,children:e.email})]},e.id)):(0,f.jsx)(`div`,{className:`text-sm text-muted py-4`,children:i.length?`No clients match that search.`:`You donât have access to any client accounts yet. Use the New client tab.`})})]}):(0,f.jsxs)(`form`,{className:`p-4 flex flex-col gap-2 overflow-y-auto`,onSubmit:e=>{e.preventDefault(),g({new_client:m})},children:[(0,f.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:[[`firstname`,`First name`],[`lastname`,`Last name`]].map(([e,t])=>(0,f.jsx)(`input`,{value:m[e],required:!0,placeholder:t,onChange:t=>h(n=>({...n,[e]:t.target.value})),className:`rounded-lg px-3 py-2 text-sm outline-none`,style:{background:`var(--bg-elevated)`,color:`var(--text-primary)`,border:`1px solid var(--border)`}},e))}),(0,f.jsx)(`input`,{value:m.email,required:!0,type:`email`,placeholder:`Email`,autoComplete:`off`,onChange:e=>h(t=>({...t,email:e.target.value})),className:`rounded-lg px-3 py-2 text-sm outline-none`,style:{background:`var(--bg-elevated)`,color:`var(--text-primary)`,border:`1px solid var(--border)`}}),(0,f.jsx)(`input`,{value:m.companyname,placeholder:`Company (optional)`,onChange:e=>h(t=>({...t,companyname:e.target.value})),className:`rounded-lg px-3 py-2 text-sm outline-none`,style:{background:`var(--bg-elevated)`,color:`var(--text-primary)`,border:`1px solid var(--border)`}}),(0,f.jsx)(`p`,{className:`text-[11px] text-faint leading-relaxed`,children:`Weâll create their account, credit the referral to you, and email them the invoice to pay. You wonât be billed for it.`}),(0,f.jsxs)(`button`,{type:`submit`,className:`btn-primary flex items-center gap-1.5 self-start mt-1`,disabled:c,children:[c?(0,f.jsx)(X,{size:13,className:`animate-spin`}):(0,f.jsx)(Js,{size:13}),` Continue to order`]})]}),d&&(0,f.jsx)(`div`,{className:`px-5 pb-4 text-xs`,style:{color:`#f87171`},children:d})]})}),document.body)}function Qm({product:e,link:t,onClose:n,onSent:r}){let[i,a]=(0,l.useState)(``),[o,s]=(0,l.useState)(``),[c,u]=(0,l.useState)(!1),[d,p]=(0,l.useState)(!1),[m,h]=(0,l.useState)(``);async function g(t){t.preventDefault(),u(!0),h(``);try{let t=await Z(`/api/portal/affiliate/invite`,{method:`POST`,body:JSON.stringify({name:i,email:o,product_id:e.id})});if(t.ok===!1)throw Error(t.error||`Could not send that link`);p(!0),r?.()}catch(e){h(e?.message||`Could not send that link`)}u(!1)}return(0,ml.createPortal)((0,f.jsx)(`div`,{className:`fixed inset-0 flex items-center justify-center p-4`,style:{zIndex:1e4,background:`rgba(0,0,0,0.7)`},onClick:e=>{e.target===e.currentTarget&&n()},children:(0,f.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface shadow-xl w-full max-w-md`,children:[(0,f.jsxs)(`div`,{className:`p-5 border-b border-edge flex items-start justify-between gap-3`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h3`,{className:`text-base font-bold text-primary`,children:`Send this to a client`}),(0,f.jsxs)(`p`,{className:`text-xs mt-1 text-muted`,children:[e.name,` â the link carries your referral code.`]})]}),(0,f.jsx)(`button`,{onClick:n,className:`text-faint hover:text-primary shrink-0`,children:(0,f.jsx)(pl,{size:16})})]}),d?(0,f.jsxs)(`div`,{className:`p-5 flex flex-col gap-3`,children:[(0,f.jsx)(`div`,{className:`text-sm`,style:{color:`#4ade80`},children:`Sent â weâve emailed them the link.`}),(0,f.jsx)(`button`,{className:`btn-secondary self-start`,onClick:n,children:`Done`})]}):(0,f.jsxs)(`form`,{className:`p-5 flex flex-col gap-2`,onSubmit:g,children:[(0,f.jsx)(`input`,{value:i,onChange:e=>a(e.target.value),placeholder:`Their name`,className:`rounded-lg px-3 py-2 text-sm outline-none`,style:{background:`var(--bg-elevated)`,color:`var(--text-primary)`,border:`1px solid var(--border)`}}),(0,f.jsx)(`input`,{value:o,onChange:e=>s(e.target.value),placeholder:`Their email`,type:`email`,required:!0,autoComplete:`off`,className:`rounded-lg px-3 py-2 text-sm outline-none`,style:{background:`var(--bg-elevated)`,color:`var(--text-primary)`,border:`1px solid var(--border)`}}),m&&(0,f.jsx)(`div`,{className:`text-xs`,style:{color:`#f87171`},children:m}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2 mt-1`,children:[(0,f.jsxs)(`button`,{type:`submit`,className:`btn-primary flex items-center gap-1.5`,disabled:c||!o.trim(),children:[c?(0,f.jsx)(X,{size:13,className:`animate-spin`}):(0,f.jsx)(Jc,{size:13}),` Send link`]}),(0,f.jsx)(`span`,{className:`text-[11px] text-faint`,children:`Or copy it:`}),(0,f.jsx)(Cm,{text:t})]})]})]})}),document.body)}function $m({current:e,onClose:t,onSave:n}){let[r,i]=(0,l.useState)(null),[a,o]=(0,l.useState)(()=>new Set(e)),[s,c]=(0,l.useState)(!1),[u,d]=(0,l.useState)(``);(0,l.useEffect)(()=>{Z(`/api/portal/store/products`).then(e=>i(e.ok&&e.products||[])).catch(()=>i([]))},[]);let p=e=>o(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.size<12&&n.add(e),n});async function m(){c(!0),d(``);try{let e=await Z(`/api/portal/affiliate/favourites`,{method:`PUT`,body:JSON.stringify({product_ids:[...a]})});if(e.ok===!1)throw Error(e.error||`Could not save`);n()}catch(e){d(e?.message||`Could not save`),c(!1)}}let h={};for(let e of r||[])(h[e.group_name||`Other`]||=[]).push(e);return(0,ml.createPortal)((0,f.jsx)(`div`,{className:`fixed inset-0 flex items-center justify-center p-4`,style:{zIndex:1e4,background:`rgba(0,0,0,0.7)`},onClick:e=>{e.target===e.currentTarget&&t()},children:(0,f.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface shadow-xl w-full max-w-lg flex flex-col`,style:{maxHeight:`85vh`},children:[(0,f.jsxs)(`div`,{className:`p-5 border-b border-edge flex items-start justify-between gap-3`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h3`,{className:`text-base font-bold text-primary`,children:`Your favourite products`}),(0,f.jsx)(`p`,{className:`text-xs mt-1 text-muted`,children:`Pin the products you recommend most. They appear on your dashboard as ready-to-share links.`})]}),(0,f.jsx)(`button`,{onClick:t,className:`text-faint hover:text-primary shrink-0`,children:(0,f.jsx)(pl,{size:16})})]}),(0,f.jsx)(`div`,{className:`p-5 overflow-y-auto flex flex-col gap-4`,children:r===null?(0,f.jsx)(`div`,{className:`flex items-center justify-center py-10`,children:(0,f.jsx)(X,{size:18,className:`animate-spin text-faint`})}):r.length?Object.entries(h).map(([e,t])=>(0,f.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,f.jsx)(`div`,{className:`text-xs font-semibold uppercase tracking-widest text-faint`,children:e}),t.map(e=>{let t=a.has(e.id);return(0,f.jsxs)(`button`,{type:`button`,onClick:()=>p(e.id),disabled:!t&&a.size>=12,className:`text-left rounded-xl px-3 py-2.5 border transition-colors flex items-start gap-2.5 disabled:opacity-40`,style:{borderColor:t?`var(--accent)`:`var(--border)`,background:t?`var(--bg-active)`:`var(--bg-elevated)`},children:[(0,f.jsx)(`span`,{className:`mt-0.5 shrink-0 flex items-center justify-center rounded border`,style:{width:16,height:16,borderColor:t?`var(--accent)`:`var(--border)`,background:t?`var(--accent)`:`transparent`},children:t&&(0,f.jsx)($s,{size:11,style:{color:`#fff`}})}),(0,f.jsxs)(`span`,{className:`min-w-0`,children:[(0,f.jsx)(`span`,{className:`block text-sm text-primary truncate`,children:e.name}),e.description&&(0,f.jsx)(`span`,{className:`block text-xs text-muted truncate`,children:e.description})]})]},e.id)})]},e)):(0,f.jsx)(`div`,{className:`text-sm text-muted`,children:`No products are available to pin right now.`})}),(0,f.jsxs)(`div`,{className:`p-5 border-t border-edge flex items-center justify-between gap-3`,children:[(0,f.jsxs)(`span`,{className:`text-xs text-faint`,children:[a.size,` of `,12,` selected`]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[u&&(0,f.jsx)(`span`,{className:`text-xs`,style:{color:`#f87171`},children:u}),(0,f.jsx)(`button`,{className:`btn-secondary`,onClick:t,children:`Cancel`}),(0,f.jsxs)(`button`,{className:`btn-primary flex items-center gap-1.5`,onClick:m,disabled:s,children:[s&&(0,f.jsx)(X,{size:13,className:`animate-spin`}),` Save`]})]})]})]})}),document.body)}
146function eh({affiliate:e,onChanged:t}){let[n,r]=(0,l.useState)(!1),[i,a]=(0,l.useState)(null),[o,s]=(0,l.useState)(null),[c,u]=(0,l.useState)(null),[d,p]=(0,l.useState)(``),m=e?.favourites||[],h=e?.affiliate?.slug,g=e?.storeUrl;async function _(e){u(e.id),p(``);try{await Xm(async()=>{let t=await Z(`/api/portal/store/handoff`,{method:`POST`,body:JSON.stringify({to:`/store/configure/${e.id}`})});if(t.ok===!1)throw Error(t.error||`Could not open the store`);return t.url})}catch(e){p(e?.message||`Could not open the store`)}u(null)}return(0,f.jsxs)(Im,{title:`Favourite products`,children:[(0,f.jsx)(`div`,{className:`flex flex-col gap-3`,children:m.length?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:m.map(e=>(Ym(g,h,e.id),(0,f.jsxs)(`div`,{className:`rounded-xl p-4 bg-surface border border-edge flex flex-col gap-2`,children:[(0,f.jsxs)(`div`,{className:`min-w-0`,children:[(0,f.jsx)(`div`,{className:`text-sm font-semibold text-primary truncate`,children:e.name}),e.description&&(0,f.jsx)(`div`,{className:`text-xs mt-0.5 text-muted line-clamp-2`,children:e.description})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-1.5 mt-auto pt-1 flex-wrap`,children:[(0,f.jsxs)(`button`,{className:`btn-secondary flex items-center gap-1.5 text-xs`,disabled:c===e.id,onClick:()=>_(e),children:[c===e.id?(0,f.jsx)(X,{size:12,className:`animate-spin`}):(0,f.jsx)(Qc,{size:12}),`Buy for me`]}),(0,f.jsxs)(`button`,{className:`btn-secondary flex items-center gap-1.5 text-xs`,onClick:()=>a(e),children:[(0,f.jsx)(ll,{size:12}),` Buy for client`]}),(0,f.jsxs)(`button`,{className:`btn-secondary flex items-center gap-1.5 text-xs`,onClick:()=>s(e),children:[(0,f.jsx)(Jc,{size:12}),` Send link`]})]})]},e.id)))}),(0,f.jsx)(`div`,{children:(0,f.jsxs)(`button`,{className:`btn-secondary flex items-center gap-1.5`,onClick:()=>r(!0),children:[(0,f.jsx)(Rc,{size:13}),` Edit favourites`]})})]}):(0,f.jsxs)(`div`,{className:`rounded-xl px-4 py-4 bg-surface border border-edge flex items-center justify-between gap-3 flex-wrap`,children:[(0,f.jsx)(`div`,{className:`text-sm text-muted`,children:`Pin the products you recommend most â each one becomes a link that credits you automatically.`}),(0,f.jsxs)(`button`,{className:`btn-secondary flex items-center gap-1.5 shrink-0`,onClick:()=>r(!0),children:[(0,f.jsx)(Vc,{size:13}),` Choose products`]})]})}),d&&(0,f.jsx)(`div`,{className:`mt-2 px-3 py-2 rounded-lg text-xs`,style:{background:`rgba(239,68,68,0.1)`,border:`1px solid rgba(239,68,68,0.25)`,color:`#f87171`},children:d}),n&&(0,f.jsx)($m,{current:m.map(e=>e.id),onClose:()=>r(!1),onSave:()=>{r(!1),t?.()}}),i&&(0,f.jsx)(Zm,{product:i,onClose:()=>a(null)}),o&&(0,f.jsx)(Qm,{product:o,link:Ym(g,h,o.id),onClose:()=>s(null),onSent:t})]})}function th({affiliate:e,onChanged:t}){let n=e||{},r=n.affiliate,i=n.favourites||[],a=n.invites||[],o=n.referrals||[],s=Number(n.defaults?.reward_amt??r?.reward_amt??0),c=Number(n.defaults?.credit_amt??r?.credit_amt??0),u=Ym(n.storeUrl,r?.slug,null),[d,p]=(0,l.useState)(`share`),[m,h]=(0,l.useState)(``),[g,_]=(0,l.useState)(``),[v,y]=(0,l.useState)(!1),[b,x]=(0,l.useState)(!1),[S,C]=(0,l.useState)(``);async function w(e){e?.preventDefault?.(),y(!0),C(``),x(!1);try{let e=await Z(`/api/portal/affiliate/invite`,{method:`POST`,body:JSON.stringify({name:m,email:g})});if(e.ok===!1)throw Error(e.error||`Could not send that invite`);x(!0),h(``),_(``),t?.()}catch(e){C(e?.message||`Could not send that invite`)}y(!1)}return r?(0,f.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,f.jsx)(Im,{title:`Getting started`,children:(0,f.jsx)(`div`,{className:`rounded-2xl bg-surface border border-edge overflow-hidden`,children:[{done:!0,title:`Your referral link is ready`,body:`Every link below carries your code. Anyone who arrives through it is credited to you for 30 days, even if they buy later.`},{done:i.length>0,title:`Pick the products you recommend`,body:`Pin your favourites to your dashboard so the products you sell most are always one click from a shareable link.`},{done:a.length>0||o.length>0,title:`Share it, or introduce us`,body:`Send your link yourself, or give us a name and email and weâll make the introduction for you.`},{done:o.length>0,title:`Your first referral`,body:`A referral appears here as soon as someone signs up through your link.`},{done:o.some(e=>
146e.status===`paid`),title:`Get paid`,body:`You earn ${Pm(s)} once they pay their first invoice. It clears into your account credit 30 days later â the wait covers refunds and chargebacks.`}].map((e,t)=>(0,f.jsxs)(`div`,{className:`flex items-start gap-3 px-5 py-4`,style:{borderTop:t?`1px solid var(--border)`:`none`},children:[(0,f.jsx)(`span`,{className:`shrink-0 mt-0.5 flex items-center justify-center rounded-full`,style:{width:22,height:22,background:e.done?`rgba(34,197,94,0.15)`:`var(--bg-elevated)`,border:`1px solid ${e.done?`rgba(34,197,94,0.3)`:`var(--border)`}`,color:e.done?`#4ade80`:`var(--text-faint)`,fontSize:11,fontWeight:700},children:e.done?(0,f.jsx)($s,{size:12}):t+1}),(0,f.jsxs)(`div`,{className:`min-w-0`,children:[(0,f.jsx)(`div`,{className:`text-sm font-semibold text-primary`,children:e.title}),(0,f.jsx)(`div`,{className:`text-xs mt-0.5 text-muted leading-relaxed`,children:e.body})]})]},e.title))})}),(0,f.jsx)(Im,{title:`Bring in a customer`,children:(0,f.jsxs)(`div`,{className:`rounded-2xl bg-surface border border-edge overflow-hidden`,children:[(0,f.jsx)(`div`,{className:`flex border-b border-edge`,children:[[`share`,`Share my link`],[`invite`,`Weâll introduce you`]].map(([e,t])=>(0,f.jsx)(`button`,{onClick:()=>{p(e),C(``),x(!1)},className:`px-4 py-2.5 text-sm font-medium transition-colors`,style:{color:d===e?`var(--text-primary)`:`var(--text-muted)`,borderBottom:d===e?`2px solid var(--accent)`:`2px solid transparent`,marginBottom:-1},children:t},e))}),d===`share`?(0,f.jsxs)(`div`,{className:`p-5 flex flex-col gap-3`,children:[(0,f.jsx)(`div`,{className:`text-sm text-muted`,children:`Send this to anyone. It works in an email, a text, or on your own website.`}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`code`,{className:`flex-1 text-xs font-mono px-3 py-2 rounded-lg truncate`,style:{background:`var(--bg-elevated)`,color:`var(--text-muted)`,border:`1px solid var(--border)`},children:u}),(0,f.jsx)(Cm,{text:u})]}),i.length>0&&(0,f.jsx)(`div`,{className:`text-xs text-faint`,children:`Linking to a specific product? Your favourites on the Dashboard tab each have their own shareable link.`})]}):(0,f.jsxs)(`form`,{className:`p-5 flex flex-col gap-3`,onSubmit:w,children:[(0,f.jsx)(`div`,{className:`text-sm text-muted`,children:`Give us their name and email and weâll send a short introduction with your link in it. Theyâre credited to you automatically â they donât have to mention you.`}),(0,f.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-2`,children:[(0,f.jsx)(`input`,{value:m,onChange:e=>h(e.target.value),placeholder:`Their name`,className:`rounded-lg px-3 py-2 text-sm outline-none`,style:{background:`var(--bg-elevated)`,color:`var(--text-primary)`,border:`1px solid var(--border)`}}),(0,f.jsx)(`input`,{value:g,onChange:e=>_(e.target.value),placeholder:`Their email`,type:`email`,required:!0,autoComplete:`off`,className:`rounded-lg px-3 py-2 text-sm outline-none`,style:{background:`var(--bg-elevated)`,color:`var(--text-primary)`,border:`1px solid var(--border)`}})]}),S&&(0,f.jsx)(`div`,{className:`text-xs`,style:{color:`#f87171`},children:S}),b&&(0,f.jsx)(`div`,{className:`text-xs`,style:{color:`#4ade80`},children:`Sent â weâve emailed the introduction.`}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsxs)(`button`,{type:`submit`,className:`btn-primary flex items-center gap-1.5`,disabled:v||!g.trim(),children:[v?(0,f.jsx)(X,{size:13,className:`animate-spin`}):(0,f.jsx)(Jc,{size:13}),` Send introduction`]}),(0,f.jsx)(`span`,{className:`text-[11px] text-faint`,children:`We only email them once.`})]})]})]})}),a.length>0&&(0,f.jsx)(Im,{title:`Introductions sent`,children:(0,f.jsx)(`div`,{className:`rounded-2xl overflow-hidden bg-surface border border-edge`,children:(0,f.jsx)(`div`,{className:`overflow-x-auto`,children:(0,f.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,f.jsx)(`thead`,{children:(0,f.jsxs)(`tr`,{style:{borderBottom:`1px solid var(--border)`},children:[(0,f.jsx)(`th`,{className:`text-left px-4 py-2 text-xs text-faint`,children:`Sent`}),(0,f.jsx)(`th`,{className:`text-left px-4 py-2 text-xs text-faint`,children:`N
146ame`}),(0,f.jsx)(`th`,{className:`text-left px-4 py-2 text-xs text-faint`,children:`Email`})]})}),(0,f.jsx)(`tbody`,{children:a.map(e=>(0,f.jsxs)(`tr`,{style:{borderBottom:`1px solid var(--border)`},children:[(0,f.jsx)(`td`,{className:`px-4 py-2 text-xs text-muted whitespace-nowrap`,children:Q(e.sent_at||e.created_at)}),(0,f.jsx)(`td`,{className:`px-4 py-2 text-xs text-muted`,children:e.name||`â`}),(0,f.jsx)(`td`,{className:`px-4 py-2 text-xs text-muted`,children:e.email})]},e.id))})]})})})}),(0,f.jsx)(Im,{title:`How you get paid`,children:(0,f.jsxs)(`div`,{className:`rounded-2xl px-5 py-4 bg-surface border border-edge text-sm text-muted leading-relaxed`,children:[`You earn `,(0,f.jsx)(`strong`,{className:`text-primary`,children:Pm(s)}),` for every customer who signs up through your link and pays their first invoice`,c>0?(0,f.jsxs)(f.Fragment,{children:[`, and they start with `,(0,f.jsx)(`strong`,{className:`text-primary`,children:Pm(c)}),` of account credit`]}):null,`. Earnings are held for 30 days after that first payment â that window covers refunds and chargebacks â then land in your account credit automatically. You can watch each one move on the Referrals tab.`]})})]}):(0,f.jsx)(`div`,{className:`rounded-2xl px-5 py-5 bg-surface border border-edge text-sm text-muted`,children:`Your referral link is still being set up. If this doesnât clear shortly, contact support.`})}var nh={pending:`pending`,approved:`qualified`,paid:`paid`,rejected:`declined`};function rh({affiliate:e,r:t,setActiveTab:n}){let r=e||{},i=r.affiliate,a=r.referrals||[],o=Number(r.defaults?.reward_amt??i?.reward_amt??0),s=Number(r.defaults?.credit_amt??i?.credit_amt??0),c=i?`${window.location.protocol}//${window.location.hostname}/?ref=${i.slug}`:``;return i?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(Im,{title:`Referral overview`,children:(0,f.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-3`,children:[(0,f.jsx)(Fm,{label:`Link clicks`,value:r.clicks??0}),(0,f.jsx)(Fm,{label:`Referrals`,value:a.length,sub:r.pending?`${r.pending} awaiting first payment`:` `}),(0,f.jsx)(Fm,{label:`Earned`,value:Pm(r.earned),sub:`Qualified and paid`}),(0,f.jsx)(Fm,{label:`In holdback`,value:Pm(r.holdingAmt),sub:r.holding?`${r.holding} clearing`:`Nothing held`}),(0,f.jsx)(Fm,{label:`Credited`,value:Pm(r.credits),sub:`Posted to your account`})]})}),(0,f.jsx)(Im,{title:`Your referral link`,children:(0,f.jsxs)(`div`,{className:`rounded-xl p-4 bg-surface border border-edge flex flex-col gap-3`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`code`,{className:`flex-1 text-xs font-mono px-3 py-2 rounded-lg truncate`,style:{background:`var(--bg-elevated)`,color:`var(--text-muted)`,border:`1px solid var(--border)`},children:c}),(0,f.jsx)(Cm,{text:c})]}),(0,f.jsxs)(`div`,{className:`text-[11px] text-faint`,children:[`You earn `,Pm(o),` for every customer who signs up through this link and pays their first invoice`,s>0?`, and they get ${Pm(s)} account credit to start with`:``,`.`,` `,`Credit is confirmed once they pay, and lands in your account 30 days later.`]})]})}),(0,f.jsx)(Im,{title:`Referral history`,children:a.length?(0,f.jsx)(`div`,{className:`rounded-xl overflow-hidden bg-surface border border-edge`,children:(0,f.jsx)(`div`,{className:`overflow-x-auto`,children:(0,f.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,f.jsx)(`thead`,{children:(0,f.jsxs)(`tr`,{style:{borderBottom:`1px solid var(--border)`},children:[(0,f.jsx)(`th`,{className:`text-left px-4 py-2 text-xs text-faint`,children:`Date`}),(0,f.jsx)(`th`,{className:`text-left px-4 py-2 text-xs text-faint`,children:`Customer`}),(0,f.jsx)(`th`,{className:`text-left px-4 py-2 text-xs text-faint`,children:`Reward`}),(0,f.jsx)(`th`,{className:`text-left px-4 py-2 text-xs text-faint`,children:`Status`})]})}),(0,f.jsx)(`tbody`,{children:a.map(e=>(0,f.jsxs)(`tr`,{style:{borderBottom:`1px solid var(--border)`},children:[(0,f.jsx)(`td`,{className:`px-4 py-2 text-xs text-muted whitespace-nowrap`,children:Q(e.created_at)}),(0,f.jsx)(`td`,{className:`px-4 py-2 text-xs text-muted`,children:wm(e.referred_email)}),(0,f.jsx)(`td`,{className:`px-4 py-2 text-xs text-muted whitespace-nowrap`,children:Pm(e.reward_amt)}),(0,f.jsx)(`td`,{className:`px-4 py-2`,children:(0,f.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[(0,f.jsx)(Tm,{status:e.status}),e.status===`approved`&&e.mature_at&&new Date(e.mature_at)>new Date&&(0,f.jsxs)(`span`,{className:`text-[11px] text-faint whitespace-nowrap`,children:[`Available `,Q(e.mature_at)]})]})})]},e.id))})]})})}):(0,f.jsx)(`div`,{className:`rounded-xl px-4 py-4 bg-surface border border-edge text-sm text-muted`,children:`No referrals yet â share your link to get started.`})})]}):(0,f.jsx)(Im,{title:`Referrals`,children:(0,f.jsx)(`div`,{className:`rounded-xl px-4 py-4 bg-surface border border-edge text-sm text-muted`,children:`Your referral link is still being set up. If this doesnât clear shortly, contact support.`})})}function ih({r:e,stats:t,affiliate:n,storefrontUrl:r,setTab:i,setActiveTab:a,onAffiliate
146Changed:o,onOpenService:s,onOpenDomain:c,onOpenInvoice:l}){let u=e.reseller_type,d=Am[u]||`Partner`,p=e.approved_at||e.created_at,m=t||{},h=[];u===`platform`&&(e.stripe_account_id?(!e.stripe_charges_enabled||!e.stripe_payouts_enabled)&&h.push({text:`Your Stripe setup is incomplete â finish onboarding to enable payouts.`,cta:`Finish setup`,onClick:()=>a(`store-setup`)}):h.push({text:`Connect your Stripe account to start receiving payments.`,cta:`Connect Stripe`,onClick:()=>a(`store-setup`)})),u===`platform`&&e.storefront_enabled===!1&&h.push({text:`Your storefront is turned off â enable it so customers can place orders.`,cta:`Enable storefront`,onClick:()=>a(`store-setup`)});let g=e.stripe_account_id?e.stripe_charges_enabled&&e.stripe_payouts_enabled?`Connected`:`Incomplete`:`Not connected`;return(0,f.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[u===`platform`&&(0,f.jsx)(Im,{title:`Summary`,children:(0,f.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-3`,children:[(0,f.jsx)(Fm,{label:`Program`,value:d}),(0,f.jsx)(Fm,{label:`Status`,value:e.blocked?`Blocked`:e.status.charAt(0).toUpperCase()+e.status.slice(1)}),(0,f.jsx)(Fm,{label:`Partner since`,value:p?Q(p):`â`}),(0,f.jsx)(Fm,{label:`Linked customers`,value:m.clients??0}),(0,f.jsx)(Fm,{label:`New customers (mo.)`,value:m.signups_month??0})]})}),u===`platform`&&(0,f.jsx)(Im,{title:`Alerts`,children:h.length===0?(0,f.jsxs)(`div`,{className:`rounded-xl px-4 py-4 bg-surface border border-edge flex items-center gap-2 text-sm text-muted`,children:[(0,f.jsx)(Is,{size:16,className:`text-faint shrink-0`}),` Youâre all caught up â nothing needs your attention.`]}):(0,f.jsx)(`div`,{className:`flex flex-col gap-2`,children:h.map((e,t)=>(0,f.jsxs)(`div`,{className:`rounded-xl px-4 py-3 flex items-center justify-between gap-3 border`,style:{background:`rgba(245,158,11,0.08)`,borderColor:`rgba(245,158,11,0.25)`},children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,style:{color:`#fbbf24`},children:[(0,f.jsx)(Y,{size:16,className:`shrink-0`}),` `,e.text]}),e.cta&&(0,f.jsx)(`button`,{onClick:e.onClick,className:`btn-secondary text-xs whitespace-nowrap shrink-0`,children:e.cta})]},t))})}),u===`reseller`&&(0,f.jsx)(Jm,{programLabel:d,setTab:i,onOpenService:s,onOpenDomain:c,onOpenInvoice:l}),u===`referral`&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(eh,{affiliate:n,onChanged:o}),(0,f.jsx)(rh,{affiliate:n,r:e,setActiveTab:a})]}),u===`platform`&&(0,f.jsx)(Im,{title:`Marketplace overview`,children:(0,f.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 gap-3`,children:[(0,f.jsx)(Fm,{label:`Gross sales (mo.)`,pending:!0}),(0,f.jsx)(Fm,{label:`Partner earnings`,value:Pm(m.paid_amt),sub:`Paid to date`}),(0,f.jsx)(Fm,{label:`Pending earnings`,value:Pm(m.pending_amt),sub:`Awaiting payout`}),(0,f.jsx)(Fm,{label:`Active subscriptions`,pending:!0}),(0,f.jsx)(Fm,{label:`Failed payments`,pending:!0}),(0,f.jsx)(Fm,{label:`Stripe`,value:g,sub:g===`Connected`?`Payments enabled`:`Action needed`})]})}),(0,f.jsx)(Im,{title:`Quick actions`,children:(0,f.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-3 gap-2`,children:[u===`reseller`&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(Lm,{icon:Qc,label:`Order service`,onClick:()=>i(`order`)}),(0,f.jsx)(Lm,{icon:gc,label:`Register domain`,onClick:()=>i(`order`)}),(0,f.jsx)(Lm,{icon:sc,label:`View partner pricing`,onClick:()=>a(`pricing`)}),(0,f.jsx)(Lm,{icon:gc,label:`Manage domains`,onClick:()=>i(`domains`)}),(0,f.jsx)(Lm,{icon:jc,label:`Contact support`,onClick:()=>i(`support`)})]}),u===`platform`&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(Lm,{icon:tl,label:`Manage marketplace`,onClick:()=>a(`store-setup`)}),(0,f.jsx)(Lm,{icon:Ic,label:`Manage products`,onClick:()=>a(`products`)}),(0,f.jsx)(Lm,{icon:sc,label:`Manage Stripe`,onClick:()=>a(`store-setup`)}),(0,f.jsx)(Lm,{icon:tl,label:`Open storefront`,onClick:()=>window.open(r,`_blank`,`noopener`)}),(0,f.jsx)(Lm,{icon:jc,label:`Contact support`,onClick:()=>i(`support`)})]}),u===`referral`&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(Lm,{icon:mc,label:`My referrals`,onClick:()=>a(`referrals`)}
146),(0,f.jsx)(Lm,{icon:Qc,label:`Order service`,onClick:()=>i(`order`)}),(0,f.jsx)(Lm,{icon:jc,label:`Contact support`,onClick:()=>i(`support`)})]}),u!==`referral`&&(0,f.jsx)(Lm,{icon:mc,label:`Refer & Earn`,onClick:()=>i(`referrals`)})]})})]})}function ah({client:e,setTab:t,onOpenService:n,onOpenDomain:r,onOpenInvoice:i}){let[a,o]=(0,l.useState)(null),[s,c]=(0,l.useState)(!0),[u,d]=(0,l.useState)(!1),[p,m]=(0,l.useState)(()=>e?.companyname||``),[h,g]=(0,l.useState)(null),[_,v]=(0,l.useState)(null),[y,b]=(0,l.useState)(null),[x,S]=(0,l.useState)(null),[C,w]=(0,l.useState)(!1),[T,E]=(0,l.useState)(null),[D,O]=(0,l.useState)(null),[k,A]=(0,l.useState)(()=>{try{return sessionStorage.getItem(`portal:reseller:tab`)||`statistics`}catch{return`statistics`}});(0,l.useEffect)(()=>{try{sessionStorage.setItem(`portal:reseller:tab`,k)}catch{}},[k]);let j=a?.reseller?.reseller_type,M=a?.statements===!0,N=a?.reseller?.dashboard_hidden===!0,P=Nm(j,{statements:M,dashboardHidden:N}),F=P.includes(k)?k:`statistics`,I=F===`statistics`&&!N;(0,l.useEffect)(()=>{j&&!P.includes(k)&&A(`statistics`)},[j,M]),(0,l.useEffect)(()=>{e?.companyname&&!p&&m(e.companyname)},[e?.companyname]);let[L,R]=(0,l.useState)({});async function z(e=!1){e||c(!0);try{let e=await Z(`/api/portal/reseller`);e.ok&&(o(e),e.reseller&&R({company_name:e.reseller.company_name||``,tagline:e.reseller.tagline||``,brand_color:e.reseller.brand_color||`#f97316`,bg_color:e.reseller.bg_color||`#111111`,cname_host:e.reseller.cname_host||``}))}catch{}e||c(!1)}(0,l.useEffect)(()=>{z()},[]),(0,l.useEffect)(()=>{let e=!1;async function t(){let t=new URL(window.location.href);if(t.searchParams.get(`stripe_connect`)!==`1`)return;let n=t.searchParams.get(`code`),r=t.searchParams.get(`state`),i=t.searchParams.get(`error`)||t.searchParams.get(`error_description`),a=window.location.pathname+window.location.hash;if(window.history.replaceState({},``,a),i){e||O({type:`err`,msg:`Stripe connect cancelled: ${i}`});return}if(!(!n||!r)){b(`stripe_connect`);try{let t=await Z(`/api/portal/reseller/stripe/exchange`,{method:`POST`,body:JSON.stringify({code:n,state:r})});if(!t.ok)throw Error(t.error||`Stripe connect failed`);e||O({type:`ok`,msg:`Connected ${t.account_id}`}),await z()}catch(t){e||O({type:`err`,msg:t.message})}e||b(null)}}return t(),()=>{e=!0}},[]);async function B(){if(!h){v(`Please select a partner program to apply for.`);return}d(!0),v(null);try{let e=await Z(`/api/portal/reseller/apply`,{method:`POST`,body:JSON.stringify({company_name:p,reseller_type:h})});if(!e.ok)throw Error(e.error||`Failed`);await z()}catch(e){v(e.message)}d(!1)}async function V(e,t){b(e);try{let n=await Z(`/api/portal/reseller`,{method:`PUT`,body:JSON.stringify({[e]:t})});if(!n.ok){v(n.error);return}o(e=>({...e,reseller:n.reseller})),S(e),setTimeout(()=>S(null),1500)}catch(e){v(e.message)}b(null)}async function H(e,t=`light`){if(e){w(t),v(null);try{let n=new FormData;n.append(`logo`,e),n.append(`variant`,t);let r=await gl(`/api/portal/reseller/logo`,n);if(!r.ok)throw Error(r.error||`Upload failed`);await z()}catch(e){v(e.message)}w(!1)}}async function U(e=`light`){if(window.confirm(`Remove the ${e} logo?`)){w(e),v(null);try{let t=await Z(`/api/portal/reseller/logo?variant=${e}`,{method:`DELETE`});if(!t.ok)throw Error(t.error||`Failed`);await z()}catch(e){v(e.message)}w(!1)}}async function W(){E(null),b(`cname_verify`);try{let e=await Z(`/api/portal/reseller/cname/verify`,{method:`POST`});if(!e.ok)throw Error(e.error||`Verify failed`);E(e.verified?`Verified â (points to ${e.target})`:`Not pointing to ${e.target} yet â DNS may take time to propagate.`),await z()}catch(e){E(e.message)}b(null)}if(s)return(0,f.jsx)(`div`,{className:`flex items-center justify-center py-20`,children:(0,f.jsx)(X,{size:20,className:`animate-spin text-faint`})});let G=a?.reseller,ee=a?.settings;if(!G)return(0,f.jsxs)(`div`,{className:`mx-auto px-4 py-8 flex flex-col gap-6`,style:{maxWidth:720},children:[(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`h1`,{className:`text-2xl font-bold text-primary flex items-center gap-2.5`,children:[(0,f.jsx)(tl,{size:22,className:`text-faint shrink-0`}),`Become a Partner`]}),(0,f.jsx)(`p`,{className:`text-sm mt-1 text-muted`,children:`Join our partner program in the way that suits you - refer customers and earn rewards, resell at wholesale pricing to your own clients, or run your own branded storefront with Stripe payments.`})]}),ee?.signup_open===!1?(0,f.jsx)(`div`,{className:`rounded-2xl p-6 text-center bg-surface border border-edge text-sm text-muted`,children:`Partner applications are currently closed. Please check back later.`}):(0,f.jsxs)(`div`,{className:`rounded-2xl p-6 flex flex-col gap-4 bg-surface border border-edge`,children:[(0,f.jsx)(`div`,{className:`text-sm font-semibold text-primary`,children:`Choose a partner program to apply for`}),(0,f.jsx)(`div`,{className:`flex flex-col gap-3`,children:km.map(e=>{let t=h===e.type;return(0,f.jsx)(`button`,{type:`button`,onClick:()=>{g(e.type),v(null)},className:`text-left rounded-xl p-4 border transition-colors`,style:{borderColor:t?`var(--accent)`:`var(--border)`,background:t?`var(--bg-active)`:`var(--bg-elevated)`},children:(0,f.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,f.jsx)(`span`,{className:`mt-0.5 shrink-0 flex items-center justify-center rounded-full border`,style:{width:18,height:18,borderColor:t?`var(--accent)`:`var(--border)`},children:t&&(0,f.jsx)(`span`,{className:`rounded-full`,style:{width:9,height:9,background:`var(--accent)`}})}),(0,f.jsxs)(`div`,{className:`min-w-0`,children:[(0,f.jsx)(`div`,{className:`text-sm font-semibold text-primary`,children:e.name}),(0,f.jsx)(`div`,{className:`text-xs text-faint mt-0.5`,children:e.tagline}),(0,f.jsx)(`div`,{className:`text-xs text-muted mt-1.5`,children:e.summary})]})]})},e.type)})}),ee?.terms_html&&(0,f.jsx)(`div`,{className:`text-xs text-muted/80 p-3 rounded-lg bg-elevated border border-edge max-h-32 overflow-y-auto`,dangerouslySetInnerHTML:{__html:Ts.sanitize(ee.terms_html)}}),h&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-xs font-semibold text-muted mb-1.5`,children:`Business / trading name`}),(0,f.jsx)(`input`,{className:`w-full bg-elevated border border-edge rounded-lg px-3 py-2 text-sm text-primary outline-none focus:border-accent/40`,placeholder:`Acme Hosting`,value:p,onChange:e=>m(e.target.value)})]}),_&&(0,f.jsx)(`div`,{className:`text-xs px-3 py-2 rounded-lg`,style:{background:`rgba(239,68,68,0.1)`,color:`#f87171`},children:_}),(0,f.jsxs)(`button`,{className:`btn-primary`,onClick:B,disabled:u||!h,children:[u?(0,f.jsx)(X,{size:14,className:`animate-spin`}):(0,f.jsx)(tl,{size:14}),`Submit application`]})]})]});
146if(G.status===`pending`&&!G.blocked){let e=km.find(e=>e.type===G.reseller_type);return(0,f.jsxs)(`div`,{className:`mx-auto px-4 py-8 flex flex-col gap-6`,style:{maxWidth:720},children:[(0,f.jsx)(`div`,{children:(0,f.jsxs)(`h1`,{className:`text-2xl font-bold text-primary flex items-center gap-2.5`,children:[(0,f.jsx)(tl,{size:22,className:`text-faint shrink-0`}),`Partner Program`]})}),(0,f.jsxs)(`div`,{className:`rounded-2xl p-8 text-center bg-surface border border-edge flex flex-col items-center gap-3`,children:[(0,f.jsx)(`span`,{className:`flex items-center justify-center rounded-full`,style:{width:44,height:44,background:`rgba(245,158,11,0.12)`},children:(0,f.jsx)(X,{size:20,className:`animate-spin`,style:{color:`#fbbf24`}})}),(0,f.jsx)(`div`,{className:`text-base font-semibold text-primary`,children:`Application under review`}),e&&(0,f.jsx)(`div`,{className:`text-sm text-muted`,children:e.name}),(0,f.jsx)(`div`,{className:`text-xs text-faint`,children:`Weâll be in touch once your application has been reviewed.`})]})]})}let te=a.stats||{},ne=a.signups||[],re=a.payouts||[],K=G.status===`active`&&!G.blocked,ie=G.cname_host&&G.cname_verified?`https://${G.cname_host}`:`https://store.networkdynamics.com/?reseller=${G.slug}`,q=(0,f.jsxs)(`div`,{className:`rounded-2xl p-8 bg-surface border border-edge text-center flex flex-col items-center gap-3`,children:[(0,f.jsx)(ac,{size:26,className:`text-faint`}),(0,f.jsx)(`div`,{className:`text-lg font-semibold text-primary`,children:`Dashboard coming soon`}),(0,f.jsx)(`p`,{className:`text-sm text-muted`,style:{maxWidth:460},children:`Your partner dashboard is being prepared and will be available here shortly. In the meantime, our team is happy to help with anything you need.`}),(0,f.jsx)(`button`,{onClick:()=>t(`support`),className:`btn-secondary text-sm mt-1`,children:`Contact support`})]});return(0,f.jsxs)(`div`,{className:`mx-auto px-4 py-8 flex flex-col gap-5`,style:{maxWidth:F===`statements`?1120:960},children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between gap-3 flex-wrap`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`h1`,{className:`text-2xl font-bold text-primary flex items-center gap-2.5`,children:[(0,f.jsx)(tl,{size:22,className:`text-faint shrink-0`}),`Partner Hub`]}),(0,f.jsx)(`p`,{className:`text-sm mt-1 text-muted`,children:`Manage your partner program, track your signups, and view your earnings.`})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[j===`referral`&&(0,f.jsxs)(`span`,{className:`text-xs px-2 py-1 rounded-md border inline-flex items-center gap-1.5`,style:{background:`rgba(249,115,22,0.1)`,color:`var(--accent)`,borderColor:`rgba(249,115,22,0.25)`},children:[(0,f.jsx)(mc,{size:12,className:`shrink-0`}),`Referral Partner`]}),(0,f.jsx)(`span`,{className:`text-xs px-2 py-1 rounded-md border`,style:{background:G.blocked?`rgba(239,68,68,0.1)`:G.status===`active`?`rgba(34,197,94,0.1)`:`rgba(245,158,11,0.1)`,color:G.blocked?`#f87171`:G.status===`active`?`#4ade80`:`#fbbf24`,borderColor:G.blocked?`rgba(239,68,68,0.25)`:G.status===`active`?`rgba(34,197,94,0.25)`:`rgba(245,158,11,0.25)`},children:G.blocked?`Blocked`:G.status})]})]}),G.blocked&&(0,f.jsx)(`div`,{className:`rounded-xl p-3 text-sm border`,style:{background:`rgba(239,68,68,0.08)`,borderColor:`rgba(239,68,68,0.25)`,color:`#f87171`},children:`Your reseller account is currently blocked. Please contact support.`}),j===`reseller`&&a?.discount&&(()=>{let e=a.discount,t=e.active_services||0,n=e.min_services||0,r=`${Math.round(e.rate*100)/100}%`;if(e.qualifies)return(0,f.jsxs)(`div`,{className:`rounded-xl p-3 text-sm border flex items-center gap-2.5`,style:{background:`rgba(34,197,94,0.08)`,borderColor:`rgba(34,197,94,0.25)`,color:`#4ade80`},children:[(0,f.jsx)(Is,{size:16,className:`shrink-0`}),(0,f.jsxs)(`span`,{children:[`Your `,r,` reseller discount is active`,e.automatic&&n>0?` â you hold ${t} active service${t===1?``:`s`} (minimum ${n}).`:`.`]})]});let i=Math.max(n-t,0);return(0,f.jsxs)(`div`,{className:`rounded-xl p-4 border bg-surface border-edge flex flex-col gap-2.5`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2.5 text-sm text-primary`,children:[(0,f.jsx)(Ys,{size:16,className:`shrink-0`,style:{color:`var(--accent)`}}),(0,f.jsxs)(`span`,{children:[`You're at `,(0,f.jsxs)(`strong`,{children:[t,` of `,n]}),` active services â `,i,` more to unlock your `,r,` reseller discount.`]})]}),(0,f.jsx)(`div`,{className:`h-2 rounded-full overflow-hidden`,style:{background:`var(--border)`},role:`progressbar`,"aria-valuemin":0,"aria-valuemax":n,"aria-valuenow":t,"aria-label":`${t} of ${n} active services`,children:(0,f.jsx)(`div`,{className:`h-full rounded-full`,style:{width:`${n?Math.min(100,t/n*100):0}%`,background:`var(--accent)`}})}),(0,f.jsxs)(`p`,{className:`text-xs text-muted`,children:[`Until then your invoices are billed at standard pricing. The discount applies automatically from your next invoice once you reach `,n,`, and pauses again if you drop below it â your partner account stays open either way.`]})]})}
146)(),N&&!M?q:(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`div`,{className:`no-scrollbar flex items-center gap-1 border-b border-edge -mx-1 px-1 overflow-x-auto`,children:jm.filter(e=>P.includes(e.id)).map(e=>(0,f.jsx)(`button`,{onClick:()=>A(e.id),className:`px-3 py-2 text-sm font-medium whitespace-nowrap transition-colors`,style:{color:F===e.id?`var(--text-primary)`:`var(--text-muted)`,borderBottom:F===e.id?`2px solid var(--accent)`:`2px solid transparent`,marginBottom:-1},children:e.label},e.id))}),F===`statistics`&&(N?q:(0,f.jsx)(ih,{r:G,stats:te,affiliate:a?.affiliate,storefrontUrl:ie,setTab:t,setActiveTab:A,onAffiliateChanged:()=>z(!0),onOpenService:n,onOpenDomain:r,onOpenInvoice:i})),F===`onboarding`&&(0,f.jsx)(th,{affiliate:a?.affiliate,onChanged:()=>z(!0)}),F===`referrals`&&(0,f.jsx)(rh,{affiliate:a?.affiliate,r:G,setActiveTab:A}),F===`statements`&&(0,f.jsx)(nm,{}),F===`store-setup`&&(0,f.jsxs)(`div`,{className:`rounded-2xl p-5 bg-surface border border-edge flex items-center justify-between gap-3`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{className:`font-semibold text-primary`,children:`Storefront`}),(0,f.jsx)(`div`,{className:`text-xs text-muted mt-0.5`,children:G.storefront_enabled?(0,f.jsxs)(f.Fragment,{children:[`Live at `,(0,f.jsx)(`a`,{href:ie,target:`_blank`,rel:`noreferrer`,className:`font-mono underline`,children:ie})]}):`Enable to start selling. Once approved, customers can place orders.`})]}),(0,f.jsx)(dh,{checked:!!G.storefront_enabled,disabled:!K||y===`storefront_enabled`,onChange:e=>V(`storefront_enabled`,e)})]}),F===`store-setup`&&(0,f.jsxs)(`div`,{className:`rounded-2xl p-5 bg-surface border border-edge flex flex-col gap-4`,children:[(0,f.jsx)(`div`,{className:`text-xs font-semibold uppercase tracking-widest text-faint`,children:`Branding`}),(0,f.jsxs)(`div`,{className:`grid sm:grid-cols-2 gap-3`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-xs text-muted mb-1`,children:`Company name`}),(0,f.jsx)(`input`,{className:`w-full bg-elevated border border-edge rounded-lg px-3 py-2 text-sm text-primary outline-none focus:border-accent/40`,value:L.company_name||``,onChange:e=>R({...L,company_name:e.target.value}),onBlur:()=>L.company_name!==G.company_name&&V(`company_name`,L.company_name)})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-xs text-muted mb-1`,children:`Tagline`}),(0,f.jsx)(`input`,{className:`w-full bg-elevated border border-edge rounded-lg px-3 py-2 text-sm text-primary outline-none focus:border-accent/40`,value:L.tagline||``,onChange:e=>R({...L,tagline:e.target.value}),onBlur:()=>L.tagline!==G.tagline&&V(`tagline`,L.tagline)})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-xs text-muted mb-1`,children:`Brand colour`}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`input`,{type:`color`,value:L.brand_color||`#f97316`,onChange:e=>R({...L,brand_color:e.target.value}),onBlur:()=>L.brand_color!==G.brand_color&&V(`brand_color`,L.brand_color),className:`w-10 h-9 rounded border border-edge bg-transparent cursor-pointer`}),(0,f.jsx)(`code`,{className:`text-xs text-muted font-mono`,children:L.brand_color})]})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-xs text-muted mb-1`,children:`Background colour`}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`input`,{type:`color`,value:L.bg_color||`#111111`,onChange:e=>R({...L,bg_color:e.target.value}),onBlur:()=>L.bg_color!==G.bg_color&&V(`bg_color`,L.bg_color),className:`w-10 h-9 rounded border border-edge bg-transparent cursor-pointer`}),(0,f.jsx)(`code`,{className:`text-xs text-muted font-mono`,children:L.bg_color})]})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center justify-between gap-3 pt-2 border-t border-edge`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{className:`text-sm text-primary`,children:`Hide company name`}),(0,f.jsx)(`div`,{className:`text-xs text-muted mt-0.5`,children:`Show only the logo in the storefront header.`})]}),(0,f.jsx)(dh,{checked:!!G.hide_company_name,disabled:y===`hide_company_name`,onChange:e=>V(`hide_company_name`,e)})]}),(0,f.jsxs)(`div`,{className:`pt-2 border-t border-edge`,children:[(0,f.jsx)(`label`,{className:`block text-xs text-muted mb-1`,children:`Theme`}),(0,f.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:[{id:`auto`,label:`Visitor chooses`},{id:`light`,label:`Always light`},{id:`dark`,label:`Always dark`}].map(e=>(0,f.jsx)(`button`,{onClick:()=>V(`theme_mode`,e.id),disabled:y===`theme_mode`,className:`px-3 py-1.5 rounded-lg text-xs font-medium transition-colors`,style:(G.theme_mode||`auto`)===e.id?{background:`var(--accent)`,color:`#fff`}:{background:`var(--bg-elevated)`,color:`var(--text-muted)`,border:`1px solid var(--border)`},children:e.label},e.id))}),(0,f.jsxs)(`div`,{className:`text-[11px] text-faint mt-1`,children:[G.theme_mode===`light`&&`Storefront forced to light mode; the dark theme toggle is hidden.`,G.theme_mode===`dark`&&`Storefront forced to dark mode; the light theme toggle is hidden.`,(!G.theme_mode||G.theme_mode===`auto`)&&`Visitors see a sun/moon toggle in the header.`]})]}),(0,f.jsxs)(`div`,{className:`pt-2 border-t border-edge grid sm:grid-cols-2 gap-4`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-xs text-muted mb-1`,children:`Light-mode logo`}),(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[G.logo_ext?(0,f.jsx)(`img`,{src:`/api/public/reseller-logo/${G.id}?v=${Date.now()}`,alt:`logo`,style:{height:40,width:`auto`,background:`#ffffff`,padding:4,borderRadius:6,border:`1px solid var(--border)`}}):(0,f.jsx)(`div`,{className:`px-3 py-2 rounded border border-edge text-xs text-faint`,children:`No logo yet`}),(0,f.jsxs)(`label`,{className:`px-3 py-2 rounded-lg border border-edge text-xs text-muted hover:text-primary curs
146or-pointer flex items-center gap-1.5`,children:[(0,f.jsx)(sl,{size:12}),C===`light`?`Uploadingâ¦`:`Upload`,(0,f.jsx)(`input`,{type:`file`,accept:`image/png,image/jpeg,image/svg+xml,image/webp`,onChange:e=>H(e.target.files?.[0],`light`),className:`hidden`})]}),G.logo_ext&&(0,f.jsx)(`button`,{onClick:()=>U(`light`),disabled:C===`light`,className:`text-[11px] text-rose-400/70 hover:text-rose-400 disabled:opacity-40`,children:`Remove`})]})]}),(G.theme_mode||`auto`)!==`light`&&(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`label`,{className:`block text-xs text-muted mb-1`,children:[`Dark-mode logo `,(0,f.jsx)(`span`,{className:`text-faint`,children:`(optional)`})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[G.logo_ext_dark?(0,f.jsx)(`img`,{src:`/api/public/reseller-logo/${G.id}?variant=dark&v=${Date.now()}`,alt:`dark logo`,style:{height:40,width:`auto`,background:`#111111`,padding:4,borderRadius:6,border:`1px solid var(--border)`}}):(0,f.jsx)(`div`,{className:`px-3 py-2 rounded border border-edge text-xs text-faint`,children:`Falls back to light logo`}),(0,f.jsxs)(`label`,{className:`px-3 py-2 rounded-lg border border-edge text-xs text-muted hover:text-primary cursor-pointer flex items-center gap-1.5`,children:[(0,f.jsx)(sl,{size:12}),C===`dark`?`Uploadingâ¦`:`Upload`,(0,f.jsx)(`input`,{type:`file`,accept:`image/png,image/jpeg,image/svg+xml,image/webp`,onChange:e=>H(e.target.files?.[0],`dark`),className:`hidden`})]}),G.logo_ext_dark&&(0,f.jsx)(`button`,{onClick:()=>U(`dark`),disabled:C===`dark`,className:`text-[11px] text-rose-400/70 hover:text-rose-400 disabled:opacity-40`,children:`Remove`})]})]})]})]}),F===`store-setup`&&(0,f.jsxs)(`div`,{className:`rounded-2xl p-5 bg-surface border border-edge flex flex-col gap-3`,children:[(0,f.jsx)(`div`,{className:`text-xs font-semibold uppercase tracking-widest text-faint`,children:`Custom domain`}),(0,f.jsxs)(`div`,{className:`text-xs text-muted`,children:[`Set a CNAME record on your domain pointing to `,(0,f.jsx)(`code`,{className:`font-mono`,children:`store.networkdynamics.com`}),`, then enter it here and verify.`]}),(0,f.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,f.jsx)(`input`,{className:`flex-1 min-w-[200px] bg-elevated border border-edge rounded-lg px-3 py-2 text-sm text-primary outline-none focus:border-accent/40`,placeholder:`shop.acme.com`,value:L.cname_host||``,onChange:e=>R({...L,cname_host:e.target.value}),onBlur:()=>L.cname_host!==G.cname_host&&V(`cname_host`,L.cname_host)}),(0,f.jsxs)(`button`,{className:`btn-secondary`,onClick:W,disabled:!G.cname_host||y===`cname_verify`,children:[y===`cname_verify`?(0,f.jsx)(X,{size:12,className:`animate-spin`}):(0,f.jsx)(Cc,{size:12}),`Verify`]}),G.cname_verified&&(0,f.jsxs)(`span`,{className:`text-xs text-green-400 flex items-center gap-1`,children:[(0,f.jsx)($s,{size:12}),` Verified`]})]}),T&&(0,f.jsx)(`div`,{className:`text-xs text-muted`,children:T})]}),F===`store-setup`&&!!ee?.powered_by_offered&&(0,f.jsxs)(`div`,{className:`rounded-2xl p-5 bg-surface border border-edge flex items-center justify-between gap-3`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`div`,{className:`font-semibold text-primary`,children:`"Powered by Network Dynamics" badge`}),(0,f.jsxs)(`div`,{className:`text-xs text-muted mt-0.5`,children:[`Show our badge in y
146our storefront footer to reduce the platform fee on every sale by `,ee?.default_powered_by_discount_pct??G.powered_by_discount_pct,` percentage points.`]})]}),(0,f.jsx)(dh,{checked:!!G.powered_by_enabled,disabled:y===`powered_by_enabled`,onChange:e=>V(`powered_by_enabled`,e)})]}),F===`products`&&(0,f.jsx)(Dm,{isActive:K}),F===`pricing`&&(0,f.jsx)(Hm,{isActive:K}),F===`domains`&&(0,f.jsx)(Om,{isActive:K}),F===`store-setup`&&(0,f.jsxs)(`div`,{className:`rounded-2xl p-5 bg-surface border border-edge flex flex-col gap-3`,children:[(0,f.jsx)(`div`,{className:`text-xs font-semibold uppercase tracking-widest text-faint`,children:`Payments â Stripe Connect`}),D&&(0,f.jsx)(`div`,{className:`text-xs px-3 py-2 rounded-lg`,style:D.type===`ok`?{background:`rgba(34,197,94,0.1)`,color:`#4ade80`}:{background:`rgba(239,68,68,0.1)`,color:`#f87171`},children:D.msg}),(0,f.jsx)(`div`,{className:`text-xs text-muted`,children:`Payments flow directly to your Stripe account. You're the merchant of record and get your own Stripe dashboard. We never see your customers' card details and don't hold your money.`}),G.stripe_account_id?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,f.jsxs)(`span`,{className:`text-xs px-2 py-1 rounded-md border bg-green-500/10 border-green-500/25 text-green-400 inline-flex items-center gap-1`,children:[(0,f.jsx)($s,{size:12}),` Connected`]}),(0,f.jsx)(`code`,{className:`text-xs font-mono text-muted`,children:G.stripe_account_id})]}),(0,f.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 text-xs`,children:[(0,f.jsx)(`span`,{className:`text-muted`,children:`Charges:`}),(0,f.jsx)(`span`,{className:G.stripe_charges_enabled?`text-green-400`:`text-amber-400`,children:G.stripe_charges_enabled?`â enabled`:`pending verification`}),(0,f.jsx)(`span`,{className:`text-muted`,children:`·`}),(0,f.jsx)(`span`,{className:`text-muted`,children:`Payouts:`}),(0,f.jsx)(`span`,{className:G.stripe_payouts_enabled?`text-green-400`:`text-amber-400`,children:G.stripe_payouts_enabled?`â enabled`:`pending verification`})]}),!G.stripe_charges_enabled&&(0,f.jsx)(`div`,{className:`text-xs text-amber-400/80`,children:`Stripe still needs more info from you (ID, bank details, etc). Open your Stripe dashboard to finish onboarding.`}),(0,f.jsxs)(`div`,{className:`flex gap-2`,children:[(0,f.jsxs)(`button`,{className:`btn-secondary`,onClick:async()=>{b(`stripe_sync`);try{let e=await Z(`/api/portal/reseller/stripe/sync`,{method:`POST`});if(!e.ok)throw Error(e.error||`Sync failed`);await z()}catch(e){v(e.message)}b(null)},disabled:y===`stripe_sync`,children:[y===`stripe_sync`?(0,f.jsx)(X,{size:12,className:`animate-spin`}):(0,f.jsx)(Gc,{size:12}),`Refresh status`]}),(0,f.jsx)(`a`,{href:`https://dashboard.stripe.com`,target:`_blank`,rel:`noreferrer`,className:`px-3 py-1.5 rounded-lg border border-edge text-xs text-muted hover:text-primary inline-flex items-center gap-1.5`,children:`Open Stripe dashboard`}),(0,f.jsx)(`button`,{className:`btn-danger`,onClick:async()=>{if(window.confirm(`Disconnect your Stripe account? Your storefront will stop accepting payments.`)){b(`stripe_disconnect`);try{let e=await Z(`/api/portal/reseller/stripe/disconnect`,{method:`POST`});if(!e.ok)throw Error(e.error||`Disconnect failed`);await z()}catch(e){v(e.message)}b(null)}},disabled:y===`stripe_disconnect`,children:`Disconnect`})]})]}):(0,f.jsxs)(`button`,{className:`btn-primary`,onClick:async()=>{b(`stripe_connect`),v(null);try{let e=await Z(`/api/portal/reseller/stripe/authorize`);if(!e.ok)throw Error(e.error||`Failed to start Stripe connect`);window.location.href=e.url}catch(e){v(e.message),b(null)}},disabled:y===`stripe_connect`,children:[y===`stripe_connect`?(0,f.jsx)(X,{size:14,className:`animate-spin`}):(0,f.jsx)(sc,{size:14}),`Connect with Stripe`]})]}),I&&j===`platform`&&(0,f.jsxs)(`div`,{className:`rounded-2xl bg-surface border border-edge overflow-hidden`,children:[(0,f.jsx)(`div`,{className:`px-5 py-3 border-b border-edge`,children:(0,f.jsx)(`div`,{className:`text-xs font-semibold uppercase tracking-widest text-faint`,children:`Payouts`})}),re.length===0?(0,f.jsx)(`div`,{className:`px-5 py-6 text-xs text-faint text-center`,children:`No payouts yet`}):(0,f.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,f.jsx)(`thead`,{children:(0,f.jsxs)(`tr`,{style:{borderBottom:`1px solid var(--border)`},children:[(0,f.jsx)(`th`,{className:`text-left px-4 py-2 text-xs text-faint`,children:`Date`}),(0,f.jsx)(`th`,{className:`text-left px-4 py-2 text-xs text-faint`,children:`Amount`}),(0,f.jsx)(`th`,{className:`text-left px-4 py-2 text-xs text-faint`,children:`Status`}),(0,f.jsx)(`th`,{className:`text-left px-4 py-2 text-xs text-faint`,children:`Period`})]})}),(0,f.jsx)(`tbody`,{children:re.map(e=>(0,f.jsxs)(`tr`,{style:{borderBottom:`1px solid var(--border)`},children:[(0,f.jsx)(`td`,{className:`px-4 py-2 text-xs text-muted`,children:Q(e.created_at)}),(0,f.jsxs)(`td`,{className:`px-4 py-2 text-xs text-primary font-mono`,children:[`$`,parseFloat(e.amount).toFixed(2),` `,(0,f.jsx)(`span`,{className:`text-faint`,children:e.currency})]}),(0,f.jsx)(`td`,{className:`px-4 py-2 text-xs`,children:(0,f.jsx)(`span`,{className:`px-1.5 py-0.5 rounded text-[10px]`,style:e.status===`paid`?{background:`rgba(34,197,94,0.15)`,color:`#4ade80`}:{background:`rgba(245,158,11,0.15)`,color:`#fbbf24`},children:e.status})}),(0,f.jsx)(`td`,{className:`px-4 py-2 text-xs text-muted`,children:e.period_start?`${Q(e.period_start)} â ${Q(e.period_end)}`:`â`})]},e.id))})]})]}),I&&j===`platform`&&(0,f.jsxs)(`div`,{className:`rounded-2xl bg-surface border border-edge overflow-hidden`,children:[(0,f.jsx)(`div`,{className:`px-5 py-3 border-b border-edge`,children:(0,f.jsxs)(`div`,{className:`text-xs font-semibold uppercase tracking-widest text-faint`,children:[`Customers (`,ne.length,`)`]})}),ne.length===0?(0,f.jsx)(`div`,{className:`px-5 py-6 text-xs text-faint text-center`,children:`No customers yet â share your storefront link to start.`}):(0,f.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,f.jsx)(`thead`,{children:(0,f.jsxs)(`tr`,{style:{borderBottom:`1px solid var(--border)`},children:[(0,f.jsx)(`th`,{className:`text-left px-4 py-2 text-xs text-faint`,children:`Date`}),(0,f.jsx)(`th`,{className:`text-left px-4 py-2 text-xs text-faint`,children:`Customer`}),(0,f.jsx)(`th`,{className:`text-left px-4 py-2 text-xs text-faint`,children:`From`})]})}),(0,f.jsx)(`tbody`,{children:ne.map(e=>(0,f.jsxs)(`tr`,{style:{borderBottom:`1px solid var(--border)`},children:[(0,f.jsx)(`td`,{className:`px-4 py-2 text-xs text-muted`,children:Q(e.created_at)}),(0,f.jsx)(`td`,{className:`px-4 py-2 text-xs text-primary`,children:e.firstname?`${e.firstname} ${e.lastname}`:e.email}),(0,f.jsx)(`td`,{className:`px-4 py-2 text-xs text-muted`,children:e.source_host||`â`})]},e.id))})]})]})]}),_&&(0,f.jsx)(`div`,{className:`text-xs px-3 py-2 rounded-lg`,style:{background:`rgba(239,68,68,0.1)`,color:`#f87171`},children:_})]})}var oh={owner:{label:`Owner`,bg:`rgba(168,85,247,0.12)`,border:`rgba(168,85,247,0.3)`,color:`#c084fc`},administrator:{label:`Administrator`,bg:`rgba(239,68,68,0.12)`,border:`rgba(239,68,68,0.25)`,color:`#f87171`},admin:{label:`Administrator`,bg:`rgba(239,68,68,0.12)`,border:`rgba(239,68,68,0.25)`,color:`#f87171`},billing:{label:`Billing`,bg:`rgba(245,158,11,0.12)`,border:`rgba(245,158,11,0.25)`,color:`#fbbf24`},technical:{label:`Technical`,bg:`rgba(20,184,166,0.12)`,border:`rgba(20,184,166,0.25)`,color:`#2dd4bf`},user:{label:`User`,bg:`rgba(59,130,246,0.12)`,border:`rgba(59,130,246,0.25)`,color:`#60a5fa`},inactive:{label:`Inactive`,bg:`rgba(113,113,122,0.12)`,border:`rgba(113,113,122,0.25)`,color:`#a1a1aa`}},sh=[{value:`administrator`,label:`Administrator`,hint:`Everything operationally, but cannot manage users or transfer ownership.`}
146,{value:`billing`,label:`Billing`,hint:`Everything except signing in to services (SSO).`},{value:`technical`,label:`Technical`,hint:`Everything except adding or removing payment methods.`},{value:`user`,label:`User (read-only)`,hint:`Can view the account and manage their own profile, but cannot make changes.`}];function ch({role:e}){let t=oh[e===`admin`?`administrator`:e]||oh.user;return(0,f.jsx)(`span`,{className:`text-xs font-semibold px-2 py-0.5 rounded`,style:{background:t.bg,border:`1px solid ${t.border}`,color:t.color},children:t.label})}function lh({active:e,label:t,activeColor:n,onClick:r,disabled:i,title:a}){return(0,f.jsx)(`button`,{onClick:r,disabled:i,title:a,className:`text-[10px] font-semibold px-1.5 py-0.5 rounded border transition-colors disabled:opacity-40 cursor-pointer`,style:e?{background:n.bg,border:`1px solid ${n.border}`,color:n.color}:{background:`var(--bg-elevated)`,border:`1px solid var(--border)`,color:`var(--text-faint)`},children:t})}function uh({value:e,onChange:t,disabled:n}){return(0,f.jsx)(`select`,{value:e===`admin`?`administrator`:e||`user`,disabled:n,onChange:e=>t(e.target.value),className:`text-xs font-semibold px-2 py-1 rounded border cursor-pointer disabled:opacity-40`,style:{background:`var(--bg-elevated)`,border:`1px solid var(--border)`,color:`var(--text-primary)`},children:sh.map(e=>(0,f.jsx)(`option`,{value:e.value,children:e.label},e.value))})}function dh({checked:e,onChange:t,disabled:n}){return(0,f.jsx)(`button`,{role:`switch`,"aria-checked":e,disabled:n,onClick:()=>t(!e),className:`relative inline-flex h-5 w-9 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors disabled:opacity-40 focus:outline-none`,style:{background:e?`var(--accent)`:`var(--bg-elevated)`,border:`1px solid var(--border)`},children:(0,f.jsx)(`span`,{className:`pointer-events-none inline-block h-3.5 w-3.5 rounded-full shadow transition-transform`,style:{background:`#fff`,transform:e?`translateX(16px)`:`translateX(1px)`,marginTop:1}})})}function fh({inviteToken:e,inviteInfo:t,onAccepted:n}){let[r,i]=(0,l.useState)(``),[a,o]=(0,l.useState)(``),[s,c]=(0,l.useState)(!1),[u,d]=(0,l.useState)(null);async function p(t){if(t.preventDefault(),!r.trim()){d(`First name is required`);return}c(!0),d(null);try{let t=await fetch(`/api/portal/invite/accept`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:e,firstname:r.trim(),lastname:a.trim()})}).then(e=>e.json());if(!t.ok){d(t.error||`Failed to accept invite`);return}n(t.client,t.token)}catch{d(`Something went wrong. Please try again.`)}finally{c(!1)}}return(0,f.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-canvas px-4`,children:(0,f.jsxs)(`div`,{className:`w-full max-w-sm`,children:[(0,f.jsxs)(`div`,{className:`text-center mb-6`,children:[(0,f.jsx)(`div`,{className:`inline-flex items-center justify-center w-12 h-12 rounded-full mb-4`,style:{background:`rgba(79,70,229,0.12)`},children:(0,f.jsx)(ll,{size:22,style:{color:`var(--accent)`}})}),(0,f.jsx)(`h1`,{className:`text-xl font-bold text-primary`,children:`You've been invited`}),(0,f.jsxs)(`p`,{className:`text-sm text-muted mt-1`,children:[`Create your account to access `,(0,f.jsx)(`strong`,{className:`text-primary`,children:t?.accountName||`the portal`}),t?.roleLabel&&(0,f.jsxs)(f.Fragment,{children:[` as `,(0,f.jsx)(`strong`,{className:`text-primary`,children:t.roleLabel})]})]})]}),(0,f.jsxs)(`div`,{className:`card p-6 space-y-4`,children:[u&&(0,f.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-rose-400 bg-rose-500/10 border border-rose-500/20 rounded-lg px-3 py-2`,children:[(0,f.jsx)(Y,{size:14,className:`shrink-0`}),u]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-xs font-medium text-muted mb-1`,children:`Email`}),(0,f.jsx)(`div`,{className:`px-3 py-2 rounded-lg border border-edge bg-elevated text-sm text-faint`,children:t?.email})]}),(0,f.jsxs)(`form`,{onSubmit:p,className:`space-y-3`,children:[(0,f.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`label`,{className:`block text-xs font-medium text-muted mb-1`,children:[`First name `,(0,f.jsx)(`span`,{className:`text-rose-400`,children:`*`})]}),(0,f.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),placeholder:`First`,className:`w-full px-3 py-2 rounded-lg border border-edge bg-surface text-sm text-primary focus:outline-none focus:ring-2 focus:ring-accent/40`})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-xs font-medium text-muted mb-1`,children:`Last name`}),(0,f.jsx)(`input`,{value:a,onChange:e=>o(e.target.value),placeholder:`Last`,className:`w-full px-3 py-2 rounded-lg border border-edge bg-surface text-sm text-primary focus:outline-none focus:ring-2 focus:ring-accent/40`})]})]}),(0,f.jsxs)(`button`,{type:`submit`,disabled:s,className:`btn-primary w-full py-2.5 text-sm font-semibold gap-2 justify-center`,children:[s?(0,f.jsx)(X,{size:15,className:`animate-spin`}):(0,f.jsx)(ll,{size:15}),`Create account & accept invite`]})]})]}),(0,f.jsxs)(`p`,{className:`text-center text-xs text-faint mt-4`,children:[`Already have an account? `,(0,f.jsx)(`a`,{href:`/`,className:`text-accent hover:underline`,children:`Sign in`})]})]})})}function ph({token:e,info:t,onSignedUp:n}){let[r,i]=(0,l.useState)({firstname:``,lastname:``,companyname:``,phonenumber:``,address1:``,city:``,state:``,postcode:``,country:`AU`}),[a,o]=(0,l.useState)(!1),[s,c]=(0,l.useState)(null),u=e=>t=>i(n=>({...n,[e]:t.target.value})),d=`w-full px-3 py-2 rounded-lg border border-edge bg-surface text-sm text-primary focus:outline-none focus:ring-2 focus:ring-accent/40`;async function p(t){if(t.preventDefault(),!r.firstname.trim()||!r.lastname.trim()){c(`First and last name are required`);return}o(!0),c(null);try{let t=await fetch(`/api/portal/transfer/signup`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:e,...r})}).then(e=>e.json());if(!t.ok){c(t.error||`Could not create your account.`);return}if(t.existing){c(`You already have an account for this address. Please sign in below â this transfer will be waiting for you.`);return}n(t.client,t.token)}catch{c(`Something went wrong. Please try again.`)}finally{o(!1)}}let m=t?.counts||{},h=[m.service?`${m.service} service${m.service===1?``:`s`}`:null,m.domain?`${m.domain} domain${m.domain===1?``:`s`}`:null,m.invoice?`${m.invoice} unpaid invoice${m.invoice===1?``:`s`}
146`:null].filter(Boolean).join(`, `);return(0,f.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-canvas px-4 py-10`,children:(0,f.jsxs)(`div`,{className:`w-full`,style:{maxWidth:560},children:[(0,f.jsxs)(`div`,{className:`text-center mb-6`,children:[(0,f.jsx)(`div`,{className:`inline-flex items-center justify-center w-12 h-12 rounded-full mb-4`,style:{background:`rgba(79,70,229,0.12)`},children:(0,f.jsx)(Js,{size:22,style:{color:`var(--accent)`}})}),(0,f.jsx)(`h1`,{className:`text-xl font-bold text-primary`,children:`Sign up to receive your new services`}),(0,f.jsxs)(`p`,{className:`text-sm text-muted mt-1`,children:[(0,f.jsx)(`strong`,{className:`text-primary`,children:t?.fromName}),` would like to transfer `,h||`their services`,` to you.`]})]}),(0,f.jsxs)(`div`,{className:`card p-6 space-y-4`,children:[t?.note&&(0,f.jsxs)(`p`,{className:`text-xs text-muted`,style:{fontStyle:`italic`,margin:0},children:[`â`,t.note,`â`]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`text-xs font-semibold text-muted mb-1.5`,children:`What you'll receive`}),(0,f.jsx)(`ul`,{style:{margin:0,paddingLeft:`1.1rem`},children:(t?.items||[]).map((e,t)=>(0,f.jsx)(`li`,{className:`text-sm text-primary`,style:{margin:`0.15rem 0`},children:e.label},t))}),m.invoice>0&&(0,f.jsxs)(`p`,{className:`text-xs mt-2`,style:{color:`var(--color-warning, #d97706)`,margin:`0.5rem 0 0`},children:[`Includes `,m.invoice,` unpaid invoice`,m.invoice===1?``:`s`,` that will become payable by you.`]})]}),s&&(0,f.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-rose-400 bg-rose-500/10 border border-rose-500/20 rounded-lg px-3 py-2`,children:[(0,f.jsx)(Y,{size:14,className:`shrink-0`}),s]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-xs font-medium text-muted mb-1`,children:`Email`}),(0,f.jsx)(`div`,{className:`px-3 py-2 rounded-lg border border-edge bg-elevated text-sm text-faint`,children:t?.email})]}),(0,f.jsxs)(`form`,{onSubmit:p,className:`space-y-3`,children:[(0,f.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`label`,{className:`block text-xs font-medium text-muted mb-1`,children:[`First name `,(0,f.jsx)(`span`,{className:`text-rose-400`,children:`*`})]}),(0,f.jsx)(`input`,{value:r.firstname,onChange:u(`firstname`),placeholder:`First`,className:d})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`label`,{className:`block text-xs font-medium text-muted mb-1`,children:[`Last name `,(0,f.jsx)(`span`,{className:`text-rose-400`,children:`*`})]}),(0,f.jsx)(`input`,{value:r.lastname,onChange:u(`lastname`),placeholder:`Last`,className:d})]})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-xs font-medium text-muted mb-1`,children:`Company (optional)`}),(0,f.jsx)(`input`,{value:r.companyname,onChange:u(`companyname`),className:d})]}),(0,f.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-xs font-medium text-muted mb-1`,children:`Phone`}),(0,f.jsx)(`input`,{value:r.phonenumber,onChange:u(`phonenumber`),className:d})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-xs font-medium text-muted mb-1`,children:`Country`}),(0,f.jsx)(`select`,{value:r.country,onChange:u(`country`),className:d,children:Ol.map(e=>(0,f.jsx)(`option`,{value:e.iso,children:e.name},e.iso))})]})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-xs font-medium text-muted mb-1`,children:`Address`}),(0,f.jsx)(`input`,{value:r.address1,onChange:u(`address1`),className:d})]}),(0,f.jsxs)(`div`,{className:`grid grid-cols-3 gap-3`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-xs font-medium text-muted mb-1`,children:`City`}),(0,f.jsx)(`input`,{value:r.city,onChange:u(`city`),className:d})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-xs font-medium text-muted mb-1`,children:`State`}),(0,f.jsx)(`input`,{value:r.state,onChange:u(`state`),className:d})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-xs font-medium text-muted mb-1`,children:`Postcode`}),(0,f.jsx)(`input`,{value:r.postcode,onChange:u(`postcode`),className:d})]})]}),(0,f.jsxs)(`button`,{type:`submit`,disabled:a,className:`btn-primary w-full py-2.5 text-sm font-semibold gap-2 justify-center`,children:[a?(0,f.jsx)(X,{size:15,className:`animate-spin`}):(0,f.jsx)(ll,{size:15}),`Create my account`]}),(0,f.jsx)(`p`,{className:`text-xs text-faint text-center`,style:{margin:0},children:`You'll review and accept the transfer once you're signed in. Nothing moves until you do.`})]})]}),(0,f.jsxs)(`p`,{className:`text-center text-xs text-faint mt-4`,children:[`Already have an account? `,(0,f.jsx)(`a`,{href:`/`,className:`text-accent hover:underline`,children:`Sign in`})]})]})})}function mh({inviteToken:e,inviteInfo:t,onAccepted:n,onDismiss:r}){let[i,a]=(0,l.useState)(!1),[o,s]=(0,l.useState)(null),[c,u]=(0,l.useState)(!1);async function d(){a(!0),s(null);try{let t=await Z(`/api/portal/invite/accept`,{method:`POST`,body:JSON.stringify({token:e})});if(!t.ok){s(t.error||`Failed to accept invite`);return}u(!0),setTimeout(()=>n(t.client),1200)}catch{s(`Something went wrong. Please try again.`)}finally{a(!1)}}return(0,f.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,style:{background:`rgba(0,0,0,0.55)`},children:(0,f.jsx)(`div`,{className:`rounded-xl border border-edge bg-surface p-6 max-w-sm w-full mx-4 shadow-2xl`,children:c?(0,f.jsxs)(`div`,{className:`text-center py-2`,children:[(0,f.jsx)(Is,{size:32,className:`mx-auto mb-3`,style:{color:`var(--color-success)`}}),(0,f.jsx)(`p`,{className:`text-sm font-semibold text-primary`,children:`Invite accepted!`}),(0,f.jsxs)(`p`,{className:`text-xs text-muted mt-1`,children:[`Switching to `,t?.accountName,`â¦`]}
146)]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`div`,{className:`flex items-start gap-3 mb-4`,children:[(0,f.jsx)(`div`,{className:`w-9 h-9 rounded-full flex items-center justify-center shrink-0`,style:{background:`rgba(79,70,229,0.12)`},children:(0,f.jsx)(ll,{size:17,style:{color:`var(--accent)`}})}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h3`,{className:`text-sm font-bold text-primary`,children:`Accept invite`}),(0,f.jsxs)(`p`,{className:`text-xs text-muted mt-0.5`,children:[`You've been invited to access `,(0,f.jsx)(`strong`,{className:`text-primary`,children:t?.accountName||`an account`}),t?.roleLabel&&(0,f.jsxs)(f.Fragment,{children:[` as `,(0,f.jsx)(`strong`,{className:`text-primary`,children:t.roleLabel})]})]})]})]}),o&&(0,f.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-rose-400 bg-rose-500/10 border border-rose-500/20 rounded-lg px-3 py-2 mb-4`,children:[(0,f.jsx)(Y,{size:13,className:`shrink-0`}),o]}),(0,f.jsxs)(`div`,{className:`flex gap-3 justify-end`,children:[(0,f.jsx)(`button`,{onClick:r,className:`btn-secondary px-4 py-2 text-xs`,children:`Dismiss`}),(0,f.jsxs)(`button`,{onClick:d,disabled:i,className:`btn-primary px-4 py-2 text-xs gap-1.5`,children:[i?(0,f.jsx)(X,{size:12,className:`animate-spin`}):null,`Accept invite`]})]})]})})})}function hh({clientId:e,navigate:t}){let[n,r]=(0,l.useState)(`users`),[i,a]=(0,l.useState)([]),[o,s]=(0,l.useState)(!1),[c,u]=(0,l.useState)(!0),[d,p]=(0,l.useState)(!0),[m,h]=(0,l.useState)(null),[g,_]=(0,l.useState)(null),[v,y]=(0,l.useState)(null),[b,x]=(0,l.useState)([]),[S,C]=(0,l.useState)(!1),[w,T]=(0,l.useState)(``),[E,D]=(0,l.useState)(`user`),[O,k]=(0,l.useState)(!1),[A,j]=(0,l.useState)([]),[M,N]=(0,l.useState)(!1),[P,F]=(0,l.useState)(null),[I,L]=(0,l.useState)(null),[R,z]=(0,l.useState)(null),[B,V]=(0,l.useState)(null),[H,U]=(0,l.useState)(!1),[W,G]=(0,l.useState)(``),[ee,te]=(0,l.useState)([]),[ne,re]=(0,l.useState)(``);function K(){p(!0),Promise.all([Z(`/api/portal/users`),Z(`/api/portal/users/invites`)]).then(([e,t])=>{a(e.users||[]),s(e.viewerIsPrimary||!1),u(e.canViewUsers!==!1),U(e.canEditNotify===!0),te(e.notifyRecipients||[]),x(t.invites||[])}).catch(()=>{}).finally(()=>p(!1))}async function ie(){let e=ne.trim().toLowerCase();if(!/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(e)){G(`Enter a valid email address.`);return}G(``);try{let t=await Z(`/api/portal/notify-recipients`,{method:`POST`,body:JSON.stringify({email:e})});if(!t.ok){G(t.error||`Could not add recipient`);return}re(``),K()}catch(e){G(e.message||`Could not add recipient`)}}async function q(e,t){G(``),te(n=>n.map(n=>n.id===e?{...n,...`billing`in t?{notifyBilling:t.billing}:{},...`service`in t?{notifyService:t.service}:{}}:n));try{await Z(`/api/portal/notify-recipients/${e}`,{method:`PATCH`,body:JSON.stringify(t)})}catch(e){G(e.message||`Update failed`),K()}}async function ae(e){te(t=>t.filter(t=>t.id!==e));try{await Z(`/api/portal/notify-recipients/${e}`,{method:`DELETE`})}catch(e){G(e.message||`Remove failed`),K()}}async function oe(e,t){G(``);let n=i;a(n=>n.map(n=>n.id===e?{...n,...`billing`in t?{notifyBilling:t.billing}:{},...`service`in t?{notifyService:t.service}:{}}:n));try{let r=await Z(`/api/portal/users/${e}/notify`,{method:`PATCH`,body:JSON.stringify(t)});r.ok||(a(n),G(r.error||`Update failed`))}catch(e){a(n),G(e.message||`Update failed`)}}(0,l.useEffect)(()=>{K()},[e]);function se(){N(!0),Z(`/api/portal/audit-log`).then(e=>j(e.entries||[])).catch(()=>{}).finally(()=>N(!1))}(0,l.useEffect)(()=>{n===`audit`&&se()},[n,e]);async function ce(e,t){h(e);try{let n=await Z(`/api/portal/users/${e}`,{method:`PATCH`,body:JSON.stringify(t)});if(!n.ok){alert(n.error||`Update failed`);return}(`isActive`in t||`isBilling`in t||`role`in t)&&a(n=>n.map(n=>n.id===e?{...n,...t}:n)),`isPrimary`in t&&K()}catch(e){alert(e.message||`Update failed`)}finally{h(null),_(null)}}async function le(e){h(e);try{let t=await Z(`/api/portal/users/${e}`,{method:`DELETE`});if(!t.ok){alert(t.error||`Remove failed`);return}a(t=>t.filter(t=>t.id!==e))}catch(e){alert(e.message||`Remove failed`)}finally{h(null),y(null)}}function ue(e){return e?new Date(e).toLocaleDateString(`en-AU`,{day:`numeric`,month:`short`,year:`numeric`}):null}async function de(e){if(e.preventDefault(),!w.trim()){F(`Email is required`);return}k(!0),F(null),L(null);try{let e=await Z(`/api/portal/users/invite`,{method:`POST`,body:JSON.stringify({email:w.trim(),role:E})});if(!e.ok){F(e.error||`Failed to send invite`);return}let t=e.role||E;L({email:w.trim(),roleLabel:sh.find(e=>e.value===t)?.label||t}),T(``),D(`user`),K()}catch{F(`Something went wrong. Please try again.`)}finally{k(!1)}}async function fe(e){await Z(`/api/portal/users/invites/${e}`,{method:`DELETE`}).catch(()=>{}),x(t=>t.filter(t=>t.id!==e))}async function pe(e){z(e);try{let t=await Z(`/api/portal/users/invites/${e}/resend`,{method:`POST`});if(!t.ok){alert(t.error||`Could not resend the invite`);return}V(e),setTimeout(()=>V(t=>t===e?null:t),2500)}catch{alert(`Something went wrong. Please try again.`)}finally{z(null)}}let me={bg:`rgba(168,85,247,0.12)`,border:`rgba(168,85,247,0.3)`,color:`#c084fc`},he=o?`grid-cols-[2fr_2fr_minmax(190px,auto)_1fr_auto]`:`grid-cols-[2fr_2fr_1fr_1fr_1fr]`,ge=o?`sm:grid-cols-[2fr_2fr_minmax(190px,auto)_1fr_auto]`:`sm:grid-cols-[2fr_2fr_1fr_1fr_1fr]`,_e=(0,f.jsxs)(`div`,{className:`hidden sm:grid ga
146p-4 px-4 py-2.5 border-b border-edge bg-elevated ${he}`,children:[(0,f.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wide text-muted`,children:`Name`}),(0,f.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wide text-muted`,children:`Email`}),(0,f.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wide text-muted`,children:`Access`}),(0,f.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wide text-muted`,children:`Last login`}),o?(0,f.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wide text-muted`}):(0,f.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wide text-muted`,children:`Status`})]}),ve=(e,t,n)=>{let r=m===e.id;return(0,f.jsxs)(`div`,{className:`flex sm:grid gap-4 items-start px-4 py-3.5 transition-colors ${e.isActive===!1&&!e.isSelf?`opacity-60`:``} ${ge}`,style:{borderBottom:t<n.length-1?`1px solid var(--border)`:`none`},children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2.5 min-w-0`,children:[(0,f.jsx)(`div`,{className:`w-8 h-8 rounded-full flex items-center justify-center text-sm font-bold shrink-0`,style:{background:xd,color:`#fff`},children:yd(e.name,e.email)}),(0,f.jsxs)(`div`,{className:`min-w-0`,children:[(0,f.jsx)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:(0,f.jsx)(`p`,{className:`text-sm font-semibold text-primary truncate leading-tight`,children:e.name||(0,f.jsx)(`span`,{className:`text-faint italic`,children:`No name`})})}),(0,f.jsx)(`div`,{className:`flex items-center gap-1 mt-0.5 flex-wrap sm:hidden`,children:e.isPrimary?(0,f.jsx)(`span`,{className:`text-xs font-semibold px-2 py-0.5 rounded`,style:{background:me.bg,border:`1px solid ${me.border}`,color:me.color},children:`Owner`}):(0,f.jsx)(ch,{role:e.isActive===!1?`inactive`:e.role})}),(0,f.jsx)(wd,{text:e.email,children:(0,f.jsx)(`p`,{className:`text-xs text-muted truncate sm:hidden`,children:e.email})})]})]}),(0,f.jsx)(wd,{text:e.email,children:(0,f.jsx)(`p`,{className:`hidden sm:block text-sm text-muted truncate min-w-0 pt-0.5`,children:e.email})}),o?(0,f.jsx)(`div`,{className:`hidden sm:flex items-center gap-2 flex-wrap`,children:e.isPrimary?(0,f.jsx)(`span`,{className:`text-xs font-semibold px-2 py-0.5 rounded`,style:{background:me.bg,border:`1px solid ${me.border}`,color:me.color},children:`Owner`}):(0,f.jsx)(uh,{value:e.isActive===!1?`user`:e.role,disabled:r,onChange:t=>ce(e.id,{role:t,isActive:!0})})}):(0,f.jsx)(`div`,{className:`hidden sm:flex items-center`,children:e.isPrimary?(0,f.jsx)(`span`,{className:`text-xs font-semibold px-2 py-0.5 rounded`,style:{background:me.bg,border:`1px solid ${me.border}`,color:me.color},children:`Owner`}):(0,f.jsx)(ch,{role:e.isActive===!1?`inactive`:e.role})}),(0,f.jsx)(`p`,{className:`hidden sm:block text-sm text-muted`,children:ue(e.lastLogin)||(0,f.jsx)(`span`,{className:`text-faint`,children:`Never`})}),o?(0,f.jsx)(f.Fragment,{children:(0,f.jsxs)(`div`,{className:`hidden sm:flex items-center gap-2 justify-end`,children:[!e.isPrimary&&!e.isSelf&&e.isActive!==!1&&(0,f.jsx)(lh,{active:!1,label:`Make owner`,activeColor:me,onClick:()=>_(e.id),disabled:r,title:`Transfer account ownership to this user`}),!e.isPrimary&&!e.isSelf&&(0,f.jsx)(`button`,{onClick:()=>y(e.id),disabled:r,title:`Remove from account`,className:`p-1 rounded text-faint hover:text-rose-400 transition-colors disabled:opacity-40`,children:(0,f.jsx)(rl,{size:13})}),r&&(0,f.jsx)(X,{size:12,className:`animate-spin text-faint`})]})}):(0,f.jsx)(`div`,{className:`hidden sm:block`,children:(0,f.jsx)(`span`,{className:`text-xs font-semibold px-2 py-0.5 rounded`,style:e.status===`Active`?{background:`rgba(34,197,94,0.12)`,border:`1px solid rgba(34,197,94,0.25)`,color:`var(--color-success)`}:{background:`rgba(113,113,122,0.12)`,border:`1px solid rgba(113,113,122,0.25)`,color:`var(--text-faint)`},children:e.status||`Unknown`})})]},e.id)},ye=i.find(e=>e.isSelf),be=i.filter(e=>!e.isSelf);return(0,f.jsxs)(`div`,{className:`p-4 md:p-6 pb-16 max-w-4xl mx-auto`,children:[(0,f.jsxs)(`h1`,{className:`text-2xl font-bold text-primary mb-6 flex items-center gap-2.5`,children:[(0,f.jsx)(ul,{size:22,className:`text-faint shrink-0`}),`Users`]}),c&&(0,f.jsx)(`div`,{className:`flex gap-1 mb-6 rounded-xl p-1 bg-surface border border-edge w-fit`,children:[{id:`users`,label:`User Accounts`},{id:`notifications`,label:`Notifications`},{id:`audit`,label:`User Actions`}].map(e=>(0,f.jsx)(`button`,{onClick:()=>r(e.id),className:`px-4 py-1.5 rounded-lg text-sm font-medium transition-colors`,style:{background:n===e.id?`var(--bg-elevated)`:`transparent`,color:n===e.id?`var(--text-primary)`:`var(--text-muted)`,border:n===e.id?`1px solid var(--border)`:`1px solid transparent`},children:e.label},e.id))}),g&&(()=>{let e=i.find(e=>e.id===g);return(0,f.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,style:{background:`rgba(0,0,0,0.55)`},children:(0,f.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface p-6 max-w-sm w-full mx-4 shadow-2xl`,children:[(0,f.jsx)(`h3`,{className:`text-base font-bold text-primary mb-2`,children:`Transfer ownership?`}),(0,f.jsxs)(`p`,{className:`text-sm text-muted mb-3`,children:[`This will make `,(0,f.jsx)(`strong`,{className:`text-primary`,children:e?.name||e?.email}),` the account owner. You will lose your owner privileges immediately.`]}),e?.ownsAccount&&(0,f.jsxs)(`p`,{className:`text-xs text-muted mb-5 rounded-lg px-3 py-2`,style:{background:`var(--bg-elevated)`,border:`1px solid var(--border)`},children:[e?.name||e?.email,` already owns an account of their own. They'll own both â signing in still takes them to their own account unless support sets this one as their home account.`]}),!e?.ownsAccount&&(0,f.jsx)(`div`,{className:`mb-5`}),(0,f.jsxs)(`div`,{className:`flex gap-3 justify-end`,children:[(0,f.jsx)(`button`,{onClick:()=>_(null),className:`btn-secondary px-4 py-2 text-xs`,children:`Cancel`}),(0,f.jsxs)(`button`,{onClick:()=>ce(g,{isPrimary:!0}),disabled:m===g,className:`btn-primary px-4 py-2 text-xs gap-1.5`,style:{background:bd,color:`#fff`},children:[m===g?(0,f.jsx)(X,{size:13,className:`animate-spin`}):null,`Transfer ownership`]})]})]})})})(),v&&(()=>{let e=i.find(e=>e.id===v);return(0,f.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,style:{background:`rgba(0,0,0,0.55)`},children:(0,f.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface p-6 max-w-sm w-full mx-4 shadow-2xl`,children:[(0,f.jsx)(`h3`,{className:`text-base font-bold text-primary mb-2`,children:`Remove user?`}),(0,f.jsxs)(`p`,{className:`text-sm text-muted mb-5`,children:[(0,f.jsx)(`strong`,{className:`text-primary`,children:e?.name||e?.email}),` will lose access to this account. This cannot be undone.`]}),(0,f.jsxs)(`div`,{className:`flex gap-3 justify-end`,children:[(0,f.jsx)(`button`,{onClick:()=>y(null),className:`btn-secondary px-4 py-2 text-xs`,children:`Cancel`}),(0,f.jsxs)(`button`,{onClick:()=>le(v),disabled:m===v,className:`btn-primary px-4 py-2 text-xs gap-1.5`,style:{background:`#e11d48`},children:[m===v?(0,f.jsx)(X,{size:13,className:`animate-spin`}):(0,f.jsx)(rl,{size:13}),`Remove`]})]})]})})})(),S&&(0,f.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center`,style:{background:`rgba(0,0,0,0.55)`},children:(0,f.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface p-6 max-w-sm w-full mx-4 shadow-2xl`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 mb-4`,children:[(0,f.jsx)(ll,{size:17,style:{color:`var(--accent)`}}),(0,f.jsx)(`h3`,{className:`text-base font-bold text-primary flex-1`,children:`Invite user`}),(0,f.jsx)(`button`,{onClick:()=>{C(!1),F(null),L(null),T(``),D(`user`)},className:`text-faint hover:text-muted transition-colors`,children:(0,f.jsx)(pl,{size:16})})]}),(0,f.jsx)(`p`,{className:`text-xs text-muted mb-4`,children:`An invitation will be emailed to the address below. If they already have a portal account they'll be linked once they accept. Otherwise they'll be prompted to create one. They'll get the role you pick here as soon as they accept.`}),I&&(0,f.jsxs)(`div`,{className:`flex items-center gap-2 text-xs mb-4 px-3 py-2 rounded-lg border`,style:{background:`rgba(34,197,94,0.08)`,borderColor:`rgba(34,197,94,0.2)`,color:`var(--color-success)`},children:[(0,f.jsx)(Is,{size:13,className:`shrink-0`}),`Invite sent to `,I.email,` as `,I.roleLabel]}),P&&(0,f.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-rose-400 bg-rose-500/10 border border-rose-500/20 rounded-lg px-3 py-2 mb-4`,children:[(0,f.jsx)(Y,{size:13,className:`shrink-0`}),P]}),(0,f.jsxs)(`form`,{onSubmit:de,className:`space-y-3`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-xs font-medium text-muted mb-1`,children:`Email address`}),(0,f.jsx)(`input`,{type:`email`,value:w,onChange:e=>{T(e.target.value),F(null)},placeholder:`[email protected]`,className:`w-full px-3 py-2 rounded-lg border border-edge bg-surface text-sm text-primary focus:outline-none focus:ring-2 focus:ring-accent/40`,autoFocus:!0})]}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`label`,{className:`block text-xs font-medium text-muted mb-1`,children:`Role`}),(0,f.jsx)(`select`,{value:E,onChange:e=>D(e.target.value),className:`w-full px-3 py-2 rounded-lg border border-edge bg-surface text-sm text-primary focus:outline-none focus:ring-2 focus:ring-accent/40 cursor-pointer`,children:sh.map(e=>(0,f.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,f.jsx)(`p`,{className:`text-xs text-faint mt-1.5`,children:sh.find(e=>e.value===E)?.hint})]}),(0,f.jsxs)(`div`,{className:`flex gap-3 justify-end pt-1`,children:[(0,f.jsx)(`button`,{type:`button`,onClick:()=>{C(!1),F(null),L(null),T(``),D(`user`)},className:`btn-secondary px-4 py-2 text-xs`,children:`Cancel`}),(0,f.jsxs)(`button`,{type:`submit`,disabled:O,className:`btn-primary px-4 py-2 text-xs gap-1.5`,children:[O?(0,f.jsx)(X,{size:12,className:`animate-spin`}):(0,f.jsx)(Jc,{size:12}),`Send invite`]})]})]})]})}),n===`users`&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3 mb-4`,children:[(0,f.jsxs)(`span`,{className:`text-xs text-muted flex-1`,children:[i.length,` user`,i.length===1?``:`s`]}),o&&(0,f.jsxs)(`button`,{onClick:()=>{C(!0),L(null),F(null),D(`user`)},className:`btn-primary px-3 py-1.5 text-xs gap-1.5`,children:[(0,f.jsx)(ll,{size:13}),`Invite user`]})]}),o&&(0,f.jsx)(`p`,{className:`text-xs text-muted mb-3 -mt-2`,children:`As account owner you can toggle user access, assign a billing contact, or transfer ownership.`}),d?(0,f.jsx)(`div`,{className:`rounded-xl border border-edge bg-surface flex items-center justify-center py-10`,children:(0,f.jsx)(X,{size:20,className:`animate-spin text-faint`})}):i.length===0?(0,f.jsx)(`div`,{className:`rounded-xl border border-edge bg-surface py-10 text-center text-sm text-muted`,children:`No users found.`}):(0,f.jsxs)(f.Fragment,{children:[ye&&(0,f.jsxs)(`div`,{className:`mb-6`,children:[(0,f.jsx)(`p`,{className:`section-label mb-2`,children:`Your access`}),(0,f.jsxs)(`div`,{className:`rounded-xl border border-edge overflow-hidden bg-surface`,children:[_e,ve(ye,0,[ye])]})]}),c&&(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`p`,{className:`section-label mb-2`,children:`Other users on this account`}),(0,f.jsxs)(`div`,{className:`rounded-xl border border-edge overflow-hidden bg-surface`,children:[_e,be.length===0?(0,f.jsxs)(`div`,{className:`py-8 text-center text-sm text-muted`,children:[`No other users on this account.`,o&&` Invite someone to give them access.`]}):be.map((e,t)=>ve(e,t,be))]})]})]}),o&&b.length>0&&(0,f.jsxs)(`div`,{className:`mt-6`,children:[(0,f.jsx)(`p`,{className:`section-label mb-2`,children:`Pending invites`}),(0,f.jsx)(`div`,{className:`rounded-xl border border-edge overflow-hidden bg-surface`,children:b.map((e,t)=>(0,f.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-3`,style:{borderBottom:t<b.length-1?`1px solid var(--border)`:`none`},children:[(0,f.jsx)(`div`,{className:`w-8 h-8 rounded-full flex items-center justify-center shrink-0 text-sm font-bold`,style:{background:`rgba(148,163,184,0.12)`,color:`var(--text-faint)`},children:e.email[0].toUpperCase()}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsx)(`p`,{className:`text-sm text-primary truncate`,children:e.email}),(0,f.jsxs)(`p`,{className:`text-xs text-faint`,children:[`Expires `,ue(e.expires_at)]})]}),(0,f.jsx)(`div`,{className:`hidden sm:block`,children:(0,f.jsx)(ch,{role:e.role||`user`})}),(0,f.jsx)(`span`,{className:`text-[10px] font-semibold px-2 py-0.5 rounded border`,style:{background:`rgba(245,158,11,0.1)`,borderColor:`rgba(245,158,11,0.25)`,color:`#f59e0b`},children:`Pending`}),B===e.id?(0,f.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs font-medium text-emerald-400 ml-1`,title:`Invite email sent`,children:[(0,f.jsx)($s,{size:13}),` Sent`]}):(0,f.jsx)(`button`,{onClick:()=>pe(e.id),disabled:R===e.id,className:`text-faint hover:text-primary transition-colors ml-1 disabled:opacity-50`,title:`Resend invite email`,children:R===e.id?(0,f.jsx)(X,{size:14,className:`animate-spin`}):(0,f.jsx)(Kc,{size:14})}),(0,f.jsx)(`button`,{onClick:()=>fe(e.id),className:`text-faint hover:text-rose-400 transition-colors ml-1`,title:`Cancel invite`,children:(0,f.jsx)(pl,{size:14})})]},e.id))})]}),o&&(0,f.jsxs)(`div`,{className:`mt-6 rounded-xl border border-edge bg-surface p-5 space-y-4`,children:[(0,f.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-wider text-faint`,children:`Role & Access Guide`}),(0,f.jsx)(`div`,{className:`flex flex-col gap-3`,children:[{label:`Owner`,bg:`rgba(168,85,247,0.12)`,border:`rgba(168,85,247,0.3)`,color:`#c084fc`,desc:`Full account access, including managing users and transferring ownership. Every account has exactly one Owner.`},{label:`Administrator`,bg:`rgba(239,68,68,0.12)`,border:`rgba(239,68,68,0.25)`,color:`#f87171`,desc:`Can do everything operationally â services, sign-in, orders, invoices, payment methods and billing details â but cannot invite or manage users or transfer ownership.`},{label:`Billing`,bg:`rgba(245,158,11,0.12)`,border:`rgba(245,158,11,0.25)`,color:`#fbbf24`,desc:`Full access except signing in to services (SSO). Manages payment methods, invoices and billing details.`},{label:`Technical`,bg:`rgba(20,184,166,0.12)`,border:`rgba(20,184,166,0.25)`,color:`#2dd4bf`,desc:`Full access except adding or removing payment methods. Can sign in to services (SSO), order and manage services.`},{label:`User`,bg:`rgba(59,130,246,0.12)`,border:`rgba(59,130,246,0.25)`,color:`#60a5fa`,desc:`Read-only: can view everything on the account and manage their own profile and security, but cannot make changes. Can request a role from the Owner.`}].map(e=>(0,f.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,f.jsx)(`span`,{className:`text-xs font-semibold px-2 py-0.5 rounded shrink-0 mt-0.5 w-24 text-center`,style:{background:e.bg,border:`1px solid ${e.border}`,color:e.color},children:e.label}),(0,f.jsx)(`p`,{className:`text-xs text-muted leading-relaxed`,children:e.desc})]},e.label))}),(0,f.jsx)(`p`,{className:`text-xs text-faint`,children:`Each user has a single role per account. A user can hold a different role on each account they belong to. The Owner can change roles at any time.`}),(0,f.jsxs)(`p`,{className:`text-xs text-faint`,children:[`Enable or disable notifications for your own user profile in`,` `,(0,f.jsx)(`button`,{onClick:()=>t(`user-settings`),className:`font-medium text-blue-400 hover:text-blue-300 hover:underline`,children:`profile settings`}),`.`]})]})]}),n===`notifications`&&(0,f.jsxs)(`div`,{className:`space-y-4`,children:[(0,f.jsx)(`div`,{className:`rounded-xl border border-edge bg-surface p-4`,children:(0,f.jsxs)(`p`,{className:`text-sm text-muted`,children:[`Choose who receives `,(0,f.jsx)(`strong`,{className:`text-primary`,children:`Billing`}),` (invoices, receipts, payment reminders) and `,(0,f.jsx)(`strong`,{className:`text-primary`,children:`Service`}),` (service & account notices) emails for this account. At least one person must receive Billing emails.`,!H&&` Only the account owner or an administrator can change these.`]})}),W&&(0,f.jsx)(`div`,{className:`rounded-lg px-4 py-2.5 text-sm`,style:{background:`var(--bg-elevated)`,color:`var(--danger, #ef4444)`,border:`1
146px solid var(--border)`},children:W}),(0,f.jsxs)(`div`,{className:`rounded-xl border border-edge overflow-hidden bg-surface`,children:[(0,f.jsxs)(`div`,{className:`grid grid-cols-[1fr_84px_84px] gap-3 px-4 py-2.5 border-b border-edge bg-elevated`,children:[(0,f.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wide text-muted`,children:`User`}),(0,f.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wide text-muted text-center`,children:`Billing`}),(0,f.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wide text-muted text-center`,children:`Service`})]}),i.map((e,t)=>{let n=e.globalNotifications===!1,r=i.filter(e=>e.isActive&&e.notifyBilling).length,a=e.notifyBilling&&r<=1;return(0,f.jsxs)(`div`,{className:`grid grid-cols-[1fr_84px_84px] gap-3 items-center px-4 py-3 ${n?`opacity-60`:``}`,style:{borderBottom:t<i.length-1?`1px solid var(--border)`:`none`},children:[(0,f.jsxs)(`div`,{className:`min-w-0`,children:[(0,f.jsxs)(`p`,{className:`text-sm font-medium text-primary truncate`,children:[e.name||e.email,e.isPrimary?` · Owner`:``]}),(0,f.jsx)(`p`,{className:`text-xs text-muted truncate`,children:e.email}),n&&(0,f.jsx)(`p`,{className:`text-[11px] mt-0.5`,style:{color:`#fbbf24`},children:`Turned notifications off in their profile â won't receive email until they turn it back on.`})]}),(0,f.jsx)(`div`,{className:`flex justify-center`,children:(0,f.jsx)(`input`,{type:`checkbox`,checked:!!e.notifyBilling,disabled:!H||e.notifyBilling&&a,title:e.notifyBilling&&a?`At least one user must receive billing notifications`:void 0,onChange:t=>oe(e.id,{billing:t.target.checked})})}),(0,f.jsx)(`div`,{className:`flex justify-center`,children:(0,f.jsx)(`input`,{type:`checkbox`,checked:!!e.notifyService,disabled:!H,onChange:t=>oe(e.id,{service:t.target.checked})})})]},e.id)})]}),(0,f.jsxs)(`div`,{className:`rounded-xl border border-edge overflow-hidden bg-surface`,children:[(0,f.jsxs)(`div`,{className:`px-4 py-3 border-b border-edge`,children:[(0,f.jsx)(`p`,{className:`text-sm font-semibold text-primary`,children:`Notification-only recipients`}),(0,f.jsx)(`p`,{className:`text-xs text-muted mt-0.5`,children:`Email addresses that receive Billing/Service emails but can't sign in to the portal.`})]}),ee.length>0&&(0,f.jsxs)(`div`,{className:`grid grid-cols-[1fr_84px_84px_40px] gap-3 px-4 py-2 border-b border-edge bg-elevated`,children:[(0,f.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wide text-muted`,children:`Email`}),(0,f.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wide text-muted text-center`,children:`Billing`}),(0,f.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wide text-muted text-center`,children:`Service`}),(0,f.jsx)(`span`,{})]}),ee.map(e=>(0,f.jsxs)(`div`,{className:`grid grid-cols-[1fr_84px_84px_40px] gap-3 items-center px-4 py-3`,style:{borderBottom:`1px solid var(--border)`},children:[(0,f.jsx)(`p`,{className:`text-sm text-primary truncate min-w-0`,children:e.email}),(0,f.jsx)(`div`,{className:`flex justify-center`,children:(0,f.jsx)(`input`,{type:`checkbox`,checked:!!e.notifyBilling,disabled:!H,onChange:t=>q(e.id,{billing:t.target.checked})})}),(0,f.jsx)(`div`,{className:`flex justify-center`,children:(0,f.jsx)(`input`,{type:`checkbox`,checked:!!e.notifyService,disabled:!H,onChange:t=>q(e.id,{service:t.target.checked})})}),(0,f.jsx)(`div`,{className:`flex justify-center`,children:H&&(0,f.jsx)(`button`,{onClick:()=>ae(e.id),title:`Remove recipient`,className:`p-1 rounded text-faint hover:text-rose-400 transition-colors`,children:(0,f.jsx)(rl,{size:13})})})]},e.id)),ee.length===0&&(0,f.jsx)(`p`,{className:`px-4 py-3 text-sm text-muted`,children:`No notification-only recipients yet.`}),H&&(0,f.jsxs)(`div`,{className:`flex gap-2 px-4 py-3 border-t border-edge`,children:[(0,f.jsx)(`input`,{value:ne,onChange:e=>re(e.target.value),type:`email`,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),ie())},placeholder:`Add an email address`,className:`flex-1 text-sm rounded-lg px-3 py-1.5 bg-elevated border border-edge text-primary focus:outline-none focus:border-accent`}),(0,f.jsx)(`button`,{onClick:ie,className:`btn-primary text-sm`,children:`Add recipient`})]})]})]}),n===`audit`&&(0,f.jsxs)(`div`,{className:`rounded-xl border border-edge overflow-hidden bg-surface`,children:[(0,f.jsxs)(`div`,{className:`hidden sm:grid grid-cols-[160px_1fr_2fr] gap-4 px-4 py-2.5 border-b border-edge bg-elevated`,children:[(0,f.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wide text-muted`,children:`Date`}),(0,f.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wide text-muted`,children:`User`}),(0,f.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wide text-muted`,children:`Description`})]}),M?(0,f.jsx)(`div`,{className:`flex items-center justify-center py-10`,children:(0,f.jsx)(X,{size:20,className:`animate-spin text-faint`})}):A.length===0?(0,f.jsx)(`div`,{className:`py-10 text-center text-sm text-muted`,children:`No activity recorded yet.`}):A.map((e,t)=>(0,f.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-[160px_1fr_2fr] gap-1 sm:gap-4 items-start px-4 py-3`,style:{borderBottom:t<A.length-1?`1px solid var(--border)`:`none`},children:[(0,f.jsx)(`p`,{className:`text-xs text-muted`,children:gd(e.created_at)}),(0,f.jsx)(`p`,{className:`text-sm text-primary truncate`,children:e.actor_email}),(0,f.jsx)(`p`,{className:`text-sm text-muted`,children:e.description})]},e.id))]})]})}function gh({onSwitch:e}){let[t,n]=(0,l.useState)([]),[r,i]=(0,l.useState)(0),[a,o]=(0,l.useState)(0),[s,c]=(0,l.useState)(1),[u,d]=(0,l.useState)(``),[p,m]=(0,l.useState)(``),[h,g]=(0,l.useState)(!0),[_,v]=(0,l.useState)(null),[y,b]=(0,l.useState)(()=>{try{return localStorage.getItem(`portal:linked_hide_inactive`)===`1`}catch{return!1}}),x=(0,l.useRef)(null);(0,l.useEffect)(()=>(clearTimeout(x.current),x.current=setTimeout(()=>{m(u),c(1)},300),()=>clearTimeout(x.current)),[u]),(0,l.useEffect)(()=>{try{localStorage.setItem(`portal:linked_hide_inactive`,y?`1`:`0`)}catch{}},[y]),(0,l.useEffect)(()=>{g(!0),Z(`/api/portal/linked-accounts?q=${encodeURIComponent(p)}&page=${s}&hide_inactive=${+!!y}`).then(e=>{n(e.accounts||[]),i(e.total||0),o(e.inactive_count||0)}).catch(()=>{}).finally(()=>g(!1))},[p,s,y]);function S(e){b(e),c(1)}async function C(t){if(!_){v(t);try{let n=await Z(`/api/portal/switch-account`,{method:`POST`,body:JSON.stringify({accountId:t})});if(!n.ok){alert(n.error||`Switch failed`);return}e(n.client,n.token)}catch(e){alert(e.message||`Switch failed`)}finally{v(null)}}}
146let w=Math.ceil(r/20);return(0,f.jsxs)(`div`,{className:`p-4 md:p-6 pb-16 mx-auto`,style:{maxWidth:896},children:[(0,f.jsx)(`div`,{className:`flex items-center gap-3 mb-1`,children:(0,f.jsxs)(`h1`,{className:`text-2xl font-bold text-primary flex-1 flex items-center gap-2.5`,children:[(0,f.jsx)(cl,{size:22,className:`text-faint shrink-0`}),`Linked Accounts`]})}),(0,f.jsx)(`p`,{className:`text-sm text-muted mb-5`,children:`All accounts your login has access to.`}),(0,f.jsxs)(`div`,{className:`relative mb-4`,children:[(0,f.jsx)(qc,{size:13,className:`absolute left-3 top-1/2 -translate-y-1/2 text-faint`}),(0,f.jsx)(`input`,{value:u,onChange:e=>d(e.target.value),placeholder:`Search by name, company or emailâ¦`,className:`w-full pl-8 pr-8 py-2.5 text-sm rounded-xl bg-surface border border-edge text-primary placeholder:text-faint outline-none focus:border-accent`}),u&&(0,f.jsx)(`button`,{onClick:()=>d(``),className:`absolute right-2.5 top-1/2 -translate-y-1/2 text-faint hover:text-muted transition-colors`,children:(0,f.jsx)(pl,{size:14})})]}),(a>0||y)&&(0,f.jsxs)(`div`,{className:`rounded-xl bg-surface border border-edge mb-4 overflow-hidden`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3 px-3.5 py-2.5 cursor-pointer select-none hover:bg-elevated transition-colors`,onClick:()=>S(!y),children:[(0,f.jsx)(Hs,{size:14,className:`text-faint shrink-0`}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsx)(`p`,{className:`text-sm text-primary`,children:`Hide inactive accounts`}),(0,f.jsx)(`p`,{className:`text-xs text-faint truncate`,children:y?`${a} account${a===1?``:`s`} hidden`:`${a} inactive account${a===1?``:`s`} in this list`})]}),(0,f.jsx)(`div`,{onClick:e=>e.stopPropagation(),className:`shrink-0`,children:(0,f.jsx)(dh,{checked:y,onChange:S})})]}),(0,f.jsxs)(`div`,{className:`border-t border-edge px-3.5 py-2.5 flex gap-2.5`,children:[(0,f.jsx)(Ls,{size:13,className:`text-faint shrink-0 mt-0.5`}),(0,f.jsx)(`p`,{className:`text-xs text-muted leading-relaxed`,children:`An account turns inactive once its services have all been cancelled, terminated or have expired, or once it's been closed at the client's request. It can't be opened from the portal because there's nothing left to manage there. Contact the account owner to reactivate an account.`})]})]}),(0,f.jsx)(`div`,{className:`card divide-y divide-edge overflow-hidden`,children:h?(0,f.jsx)(`div`,{className:`flex items-center justify-center py-10`,children:(0,f.jsx)(X,{size:20,className:`animate-spin text-faint`})}):t.length===0?(0,f.jsxs)(`div`,{className:`py-10 text-center text-sm text-muted`,children:[`No accounts found.`,y&&a>0&&(0,f.jsxs)(f.Fragment,{children:[` `,(0,f.jsxs)(`button`,{onClick:()=>S(!1),className:`text-accent hover:underline`,children:[`Show `,a,` inactive account`,a===1?``:`s`]})]})]}):t.map(e=>{let t=e.is_current,n=_===e.id,r=e.company||e.name||e.email,i=e.company?e.name:null,a=e.status&&e.status!==`Active`;return(0,f.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-3.5 ${t?`bg-[var(--bg-active)]`:`hover:bg-elevated`} transition-colors`,children:[(0,f.jsx)(`div`,{className:`w-9 h-9 rounded-full flex items-center justify-center text-sm font-bold shrink-0`,style:{background:t?`color-mix(in srgb, var(--accent) 20%, transparent)`:`var(--bg-elevated)`,color:t?`var(--accent)`:`var(--text-muted)`},children:(r[0]||`?`).toUpperCase()}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[(0,f.jsx)(`span`,{className:`text-sm font-semibold text-primary truncate`,children:r}),t&&(0,f.jsx)(`span`,{className:`text-[10px] font-semibold px-1.5 py-0.5 rounded-full bg-[var(--bg-active)] text-accent border border-accent/20`,children:`Current`}),e.is_primary&&!t&&(0,f.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded-full bg-elevated text-faint border border-edge`,children:`Primary`}),a&&(0,f.jsx)(`span`,{className:`text-[10px] font-semibold px-1.5 py-0.5 rounded-full border`,style:{color:`#f59e0b`,borderColor:`rgba(245,158,11,0.3)`,background:`rgba(245,158,11,0.1)`},children:e.status})]}),i&&(0,f.jsx)(`p`,{className:`text-xs text-muted truncate`,children:i}),(0,f.jsx)(`p`,{className:`text-xs text-faint truncate`,children:e.email})]}),t?(0,f.jsx)(`span`,{className:`text-xs text-accent font-medium shrink-0`,children:`Active`}):a?(0,f.jsx)(`span`,{className:`text-xs text-faint shrink-0`,title:`This account is ${String(e.status).toLowerCase()} and can't be opened`,children:`Unavailable`}):(0,f.jsxs)(`button`,{className:`btn-secondary`,onClick:()=>C(e.id),disabled:!!_,children:[n?(0,f.jsx)(`span`,{className:`w-3 h-3 border-2 border-current border-t-transparent roun
146ded-full`,style:{animation:`spin 0.7s linear infinite`}}):(0,f.jsx)(ul,{size:11}),`Switch`]})]},e.id)})}),w>1&&(0,f.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted mt-3`,children:[(0,f.jsxs)(`span`,{children:[r,` account`,r===1?``:`s`]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`button`,{disabled:s<=1,onClick:()=>c(e=>e-1),className:`px-2.5 py-1 rounded-md border border-edge bg-surface disabled:opacity-30 hover:bg-elevated transition-colors`,children:`â Prev`}),(0,f.jsxs)(`span`,{className:`text-faint`,children:[s,` / `,w]}),(0,f.jsx)(`button`,{disabled:s>=w,onClick:()=>c(e=>e+1),className:`px-2.5 py-1 rounded-md border border-edge bg-surface disabled:opacity-30 hover:bg-elevated transition-colors`,children:`Next â`})]})]})]})}var _h=[{id:`dashboard`,label:`Dashboard`,icon:Sc},{id:`services`,label:`Services`,icon:Ic},{id:`domains`,label:`Domains`,icon:gc},{id:`monitoring`,label:`Monitoring`,icon:Gs},{id:`billing`,label:`Billing`,icon:fc},{id:`quotes`,label:`Quotes`,icon:Vs},{id:`support`,label:`Support`,icon:jc},{id:`account`,label:`Account`,icon:dl},{id:`users`,label:`Users`,icon:ul},{id:`linked-accounts`,label:`Linked Accounts`,icon:cl},{id:`order`,label:`Order`,icon:Qc},{id:`referrals`,label:`Refer & Earn`,icon:mc},{id:`reseller`,label:`Partner Hub`,icon:tl},{id:`notifications`,label:`Notifications`,icon:Xs,hidden:!0}],vh={dashboard:`/`,services:`/services`,domains:`/domains`,monitoring:`/monitoring`,billing:`/billing`,support:`/support`,account:`/account`,security:`/security`,order:`/order`,quotes:`/quotes`,referrals:`/referrals`,reseller:`/reseller`,users:`/users`,"linked-accounts":`/linked-accounts`,notifications:`/notifications`,"user-settings":`/user-settings`},yh={details:`/account`,payment:`/payment-methods`,credits:`/credits`,transfer:`/transfer-services`},bh=e=>Object.keys(yh).find(t=>yh[t]===e)||null;function xh(){let e={tab:`dashboard`,serviceId:null,domainId:null,accountSubTab:`details`};try{let t=window.location.pathname.replace(/^\/+|\/+$/g,``).split(`/`).filter(Boolean);if(!t.length)return{...e};let n=`/`+t[0];if(n===`/services`)return{...e,tab:`services`,serviceId:t[1]||null};if(n===`/domains`)return{...e,tab:`domains`,domainId:t[1]||null};if(n===`/account`&&t[1])return{...e,tab:`account`,accountSubTab:bh(`/`+t[1])||`details`};let r=bh(n);if(r)return{...e,tab:`account`,accountSubTab:r};let i=Object.keys(vh).find(e=>vh[e]===n);return{...e,tab:i||`dashboard`}}catch{return{...e}}}function Sh(e,{serviceId:t,domainId:n,subTab:r}={}){return e===`services`&&t?`/services/`+t:e===`domains`&&n?`/domains/`+n:e===`account`?yh[r]||`/account`:vh[e]||`/`}function Ch(e,t){try{let n=sessionStorage.getItem(e);return n==null?t:JSON.parse(n)}catch{return t}}function wh(e,t){try{sessionStorage.setItem(e,JSON.stringify(t))}catch{}}var Th={dashboard:`dashboard`,services:`servicesSummary`,domains:`domainsSummary`,monitoring:`servicesSummary`,b
146illing:`invoices`,support:`tickets`,account:`billingView`,order:`order`,users:`viewUsers`},Eh=(e,t={})=>{let n=Th[e];return!(n&&t[n]===!1||(e===`reseller`||e===`referrals`)&&t.dashboard===!1)},Dh=(e,t={})=>e===`dashboard`||Eh(e,t);function Oh({client:e,tab:t,navigate:n,services:r,invoices:i,dataLoading:a,linkedAccountCount:o=0,totalAccessible:s=1,affiliateStatus:c=null,isSwitched:l=!1,caps:u={},showQuotes:d=!1,openQuoteCount:m=0,hideReferralsNav:h=!1,monitoringEnabled:g=!1}){let _=_h.filter(e=>!(e.hidden||e.id===`referrals`&&c?.blocked||e.id===`referrals`&&h||e.id===`linked-accounts`&&(s<=1||l)||e.id===`quotes`&&!d||e.id===`monitoring`&&!g||!Dh(e.id,u)));return(0,f.jsxs)(`div`,{className:`flex grow flex-col gap-y-5 overflow-y-auto bg-surface border-r border-edge px-4 pb-4`,children:[(0,f.jsxs)(`div`,{className:`flex h-16 shrink-0 items-center gap-3 border-b border-edge -mx-4 px-4`,children:[(0,f.jsx)(p,{className:`h-7 w-auto shrink-0`,style:{color:`var(--text-primary)`}}),(0,f.jsx)(`span`,{className:`text-sm font-semibold text-primary`,children:`Client Portal`})]}),(0,f.jsxs)(`nav`,{className:`flex flex-1 flex-col`,children:[(0,f.jsx)(`p`,{className:`section-label px-2 mb-2`,children:`Navigation`}),(0,f.jsx)(`ul`,{className:`space-y-0.5`,children:_.map(e=>(0,f.jsx)(`li`,{children:(0,f.jsxs)(`button`,{onClick:()=>n(e.id),className:`group flex w-full items-center gap-x-3 rounded-md px-2 py-2 text-base font-medium transition-colors text-left ${t===e.id?`bg-[var(--bg-active)] text-accent`:`text-muted hover:bg-[var(--bg-hover)] hover:text-primary`}`,children:[(0,f.jsx)(e.icon,{size:18,className:`shrink-0 transition-colors ${t===e.id?`text-accent`:`text-faint group-hover:text-muted`}`}),(0,f.jsx)(`span`,{className:`flex-1`,children:e.label}),e.id===`quotes`&&m>0&&(0,f.jsx)(`span`,{className:`ml-auto text-[11px] font-semibold px-1.5 py-0.5 rounded-full`,style:{background:`var(--bg-elevated)`,color:`var(--text-muted)`},children:m}),e.id===`linked-accounts`&&o>0&&(0,f.jsx)(`span`,{className:`ml-auto text-[11px] font-semibold px-1.5 py-0.5 rounded-full`,style:{background:`var(--bg-elevated)`,color:`var(--text-muted)`},children:o})]})},e.id))})]}),!a&&(0,f.jsx)(Yd,{client:e,services:r,invoices:i,setTab:n})]})}function kh({value:e,onChange:t,disabled:n=!1}){let[r,i]=(0,l.useState)(!1),[a,o]=(0,l.useState)(``),s=(0,l.useRef)(null);(0,l.useEffect)(()=>{if(!r)return;function e(e){s.current&&!s.current.contains(e.target)&&i(!1)}function t(e){e.key===`Escape`&&i(!1)}return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[r]);let c=Ol.find(t=>t.iso===e)||Ol[0],u=a.trim().toLowerCase(),d=u?Ol.filter(e=>e.name.toLowerCase().includes(u)||e.iso.toLowerCase()===u||(`+`+e.dial).includes(u.replace(/[^\d+]/g,``))||e.dial.includes(u.replace(/\D/g,``))):Ol;return(0,f.jsxs)(`div`,{className:`relative shrink-0`,ref:s,children:[(0,f.jsxs)(`button`,{type:`button`,disabled:n,onClick:()=>i(e=>!e),className:`flex items-center gap-1.5 rounded-lg px-3 py-2 text-sm bg-surface border border-edge text-primary disabled:opacity-50`,title:`${c.name} (+${c.dial})`,children:[(0,f.jsx)(`span`,{className:`text-base leading-none`,children:Ml(c.iso)}),(0,f.jsxs)(`span`,{className:`tabular-nums`,children:[`+`,c.dial]}),(0,f.jsx)(ec,{size:14,className:`text-faint`})]}),r&&(0,f.jsxs)(`div`,{className:`absolute z-50 mt-1 w-64 rounded-lg border border-edge bg-surface shadow-lg overflow-hidden`,style:{boxShadow:`0 8px 24px rgba(0,0,0,0.15)`},children:[(0,f.jsx)(`div`,{className:`p-2 border-b border-edge`,children:(0,f.jsx)(`input`,{autoFocus:!0,value:a,onChange:e=>o(e.target.value),placeholder:`Search country or code`,className:`w-full rounded-md px-2.5 py-1.5 text-sm bg-elevated border border-edge text-primary`})}),(0,f.jsxs)(`ul`,{className:`max-h-56 overflow-y-auto py-1`,children:[d.map(n=>(0,f.jsx)(`li`,{children:(0,f.jsxs)(`button`,{type:`button`,onClick:()=>{t(n.iso),i(!1),o(``)},className:`flex w-full items-center gap-2.5 px-3 py-1.5 text-sm text-left hover:bg-elevated ${n.iso===e?`text-accent`:`text-primary`}`,children:[(0,f.jsx)(`span`,{className:`text-base leading-none`,children:Ml(n.iso)}),(0,f.jsx)(`span`,{className:`flex-1 truncate`,children:n.name}),(0,f.jsxs)(`span`,{className:`text-faint tabular-nums`,children:[`+`,n.dial]})]})},n.iso)),!d.length&&(0,f.jsx)(`li`,{className:`px-3 py-2 text-sm text-faint`,children:`No matches`})]})]})]})}function Ah({onSaved:e}){let[t,n]=(0,l.useState)(!0),[r,i]=(0,l.useState)(``),[a,o]=(0,l.useState)({firstname:``,lastname:``,email:``,phone:``}),[s,c]=(0,l.useState)(!1),[u,d]=(0,l.useState)({firstname:``,lastname:``}),[p,m]=(0,l.useState)(!1),[h,g]=(0,l.useState)(!1),[_,v]=(0,l.useState)(null),[y,b]=(0,l.useState)(``),[x,S]=(0,l.useState)(``),[C,w]=(0,l.useState)(!1),[T,E]=(0,l.useState)(``),[D,O]=(0,l.useState)(``),[k,A]=(0,l.useState)(null),[j,M]=(0,l.useState)(()=>Pl()),[N,P]=(0,l.useState)(``),[F,I]=(0,l.useState)(``),[L,R]=(0,l.useState)(!1),[z,B]=(0,l.useState)(``),[V,H]=(0,l.useState)(``);(0,l.useEffect)(()=>{Z(`/api/portal/profile`).then(e=>{e.ok?o(e.profile):i(e.error||`Could not load your profile`)}
146).catch(()=>i(`Could not load your profile`)).finally(()=>n(!1))},[]);function U(){d({firstname:a.firstname||``,lastname:a.lastname||``}),i(``),c(!0)}function W(){c(!1),i(``)}async function G(){if(!u.firstname.trim()){i(`First name is required`);return}m(!0),i(``);try{let t=await Z(`/api/portal/profile`,{method:`PUT`,body:JSON.stringify(u)});t.ok?(o(e=>({...e,...t.profile})),c(!1),g(!0),setTimeout(()=>g(!1),2500),e?.(t.profile)):i(t.error||`Could not save your changes`)}catch{i(`Could not save your changes`)}finally{m(!1)}}function ee(){A(null),v(`enter`),b(``),S(``),E(``),O(``)}function te(){v(null),b(``),S(``),E(``),O(``)}async function ne(){let e=y.trim().toLowerCase();if(!e){E(`Enter your new email address`);return}w(!0),E(``);try{let t=await Z(`/api/portal/profile/email/start`,{method:`POST`,body:JSON.stringify({email:e})});t.ok?(v(`code`),O(`We've sent a 6-digit code to ${e}. Enter it below to confirm the change.`)):E(t.error||`Could not send the code`)}catch{E(`Could not send the code`)}finally{w(!1)}}async function re(){if(!x.trim()){E(`Enter the code from your email`);return}w(!0),E(``);try{let e=await Z(`/api/portal/profile/email/verify`,{method:`POST`,body:JSON.stringify({code:x.trim()})});e.ok?(e.token&&localStorage.setItem(hl,e.token),window.location.reload()):E(e.error||`Could not confirm the code`)}catch{E(`Could not confirm the code`)}finally{w(!1)}}function K(){v(null),A(`enter`),M(Fl(a.phone)),P(``),I(``),B(``),H(``)}function ie(){A(null),P(``),I(``),B(``),H(``)}async function q(){let e=Il(j,N);if(!e){B(`Enter your mobile number`);return}R(!0),B(``);try{let t=await Z(`/api/portal/profile/mobile/start`,{method:`POST`,body:JSON.stringify({mobile:e})});t.ok?(A(`code`),H(`We've sent a 6-digit code by SMS to ${e}. Enter it below to confirm.`)):B(t.error||`Could not send the code`)}catch{B(`Could not send the code`)}finally{R(!1)}}async function ae(){if(!F.trim()){B(`Enter the code from the SMS`);return}R(!0),B(``);try{let e=await Z(`/api/portal/profile/mobile/verify`,{method:`POST`,body:JSON.stringify({code:F.trim()})});e.ok?(o(t=>({...t,phone:e.mobile})),ie(),g(!0),setTimeout(()=>g(!1),2500)):B(e.error||`Could not confirm the code`)}catch{B(`Could not confirm the code`)}finally{R(!1)}}let oe=[a.firstname,a.lastname].filter(Boolean).join(` `)||`â`,se=_||k;return(0,f.jsxs)(`div`,{className:`rounded-xl p-6 space-y-5 bg-surface border border-edge`,children:[(0,f.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,f.jsx)(`div`,{className:`w-10 h-10 rounded-full flex items-center justify-center shrink-0`,style:{background:xd,color:`#fff`},children:(0,f.jsx)(dl,{size:18})}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h2`,{className:`text-base font-semibold text-primary`,children:`Your profile`}),(0,f.jsx)(`p`,{className:`text-sm text-muted`,children:`The name and contact details for your sign-in.`})]})]}),!s&&!t&&!se&&(0,f.jsxs)(`button`,{onClick:U,className:`btn-secondary shrink-0`,children:[(0,f.jsx)(Rc,{size:12}),` Edit`]}),h&&(0,f.jsxs)(`span`,{className:`text-xs text-green-500 flex items-center gap-1 shrink-0`,children:[(0,f.jsx)($s,{size:13}),` Saved`]})]}),r&&(0,f.jsxs)(`div`,{className:`rounded-lg px-4 py-2.5 text-sm flex items-center gap-2`,style:{background:`var(--bg-elevated)`,color:`var(--danger, #ef4444)`,border:`1px solid var(--border)`},children:[(0,f.jsx)(Y,{size:15,className:`shrink-0`}),` `,r]}),t?(0,f.jsx)(`div`,{className:`text-sm text-muted`,children:`Loadingâ¦`}):s?(0,f.jsxs)(`div`,{className:`space-y-4`,children:[(0,f.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-4`,children:[(0,f.jsxs)(`label`,{className:`block`,children:[(0,f.jsx)(`span`,{className:`text-xs font-medium text-faint`,children:`First name`}),(0,f.jsx)(`input`,{value:u.firstname,onChange:e=>d(t=>({...t,firstname:e.target.value})),className:`mt-1 w-full rounded-lg px-3 py-2 text-sm bg-elevated border border-edge text-primary`})]}),(0,f.jsxs)(`label`,{className:`block`,children:[(0,f.jsx)(`span`,{className:`text-xs font-medium text-faint`,children:`Last name`}),(0,f.jsx)(`input`,{value:u.lastname,onChange:e=>d(t=>({...t,lastname:e.target.value})),className:`mt-1 w-full rounded-lg px-3 py-2 text-sm bg-elevated border border-edge text-primary`})]})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsxs)(`button`,{onClick:G,disabled:p,className:`btn-primary disabled:opacity-50`,children:[p?(0,f.jsx)(X,{size:14,className:`animate-spin`}):(0,f.jsx)($s,{size:14}),` Save`]}),(0,f.jsx)(`button`,{onClick:W,disabled:p,className:`btn-secondary`,children:`Cancel`})]})]}
146):(0,f.jsxs)(`dl`,{className:`divide-y divide-edge`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-3 py-3`,children:[(0,f.jsx)(dl,{size:15,className:`text-faint shrink-0`}),(0,f.jsx)(`dt`,{className:`text-sm text-muted w-32 shrink-0`,children:`Name`}),(0,f.jsx)(`dd`,{className:`text-sm text-primary font-medium`,children:oe})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-3 py-3`,children:[(0,f.jsx)(Dc,{size:15,className:`text-faint shrink-0`}),(0,f.jsx)(`dt`,{className:`text-sm text-muted w-32 shrink-0`,children:`Email`}),(0,f.jsx)(`dd`,{className:`text-sm text-primary font-medium flex-1 break-all`,children:a.email||`â`}),!se&&(0,f.jsx)(`button`,{onClick:ee,className:`btn-secondary shrink-0`,children:`Change`})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-3 py-3`,children:[(0,f.jsx)(zc,{size:15,className:`text-faint shrink-0`}),(0,f.jsx)(`dt`,{className:`text-sm text-muted w-32 shrink-0`,children:`Mobile number`}),(0,f.jsx)(`dd`,{className:`text-sm text-primary font-medium flex-1`,children:a.phone||`â`}),!se&&(0,f.jsx)(`button`,{onClick:K,className:`btn-secondary shrink-0`,children:a.phone?`Change`:`Add`})]})]}),_&&!s&&(0,f.jsxs)(`div`,{className:`rounded-lg p-4 space-y-3 bg-elevated border border-edge`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsx)(`h3`,{className:`text-sm font-semibold text-primary`,children:`Change email address`}),(0,f.jsx)(`button`,{onClick:te,className:`text-faint hover:text-primary`,children:(0,f.jsx)(pl,{size:15})})]}),D&&(0,f.jsx)(`p`,{className:`text-xs text-muted`,children:D}),T&&(0,f.jsxs)(`div`,{className:`rounded-lg px-3 py-2 text-xs flex items-center gap-2`,style:{background:`var(--bg-surface)`,color:`var(--danger, #ef4444)`,border:`1px solid var(--border)`},children:[(0,f.jsx)(Y,{size:13,className:`shrink-0`}),` `,T]}),_===`enter`?(0,f.jsxs)(`div`,{className:`space-y-3`,children:[(0,f.jsx)(`p`,{className:`text-xs text-muted`,children:`We'll email a confirmation code to the new address. Your email won't change until you enter that code.`}),(0,f.jsx)(`input`,{value:y,onChange:e=>b(e.target.value),type:`email`,placeholder:`[email protected]`,className:`w-full sm:max-w-sm rounded-lg px-3 py-2 text-sm bg-surface border border-edge text-primary`,onKeyDown:e=>{e.key===`Enter`&&ne()}}),(0,f.jsx)(`div`,{children:(0,f.jsxs)(`button`,{onClick:ne,disabled:C,className:`btn-primary disabled:opacity-50`,children:[C?(0,f.jsx)(X,{size:14,className:`animate-spin`}):(0,f.jsx)(Jc,{size:14}),` Send code`]})})]}):(0,f.jsxs)(`div`,{className:`space-y-3`,children:[(0,f.jsx)(`input`,{value:x,onChange:e=>S(e.target.value.replace(/\D/g,``).slice(0,6)),inputMode:`numeric`,placeholder:`000000`,maxLength:6,className:`w-40 rounded-lg px-3 py-2 text-lg font-mono tracking-[0.3rem] text-center bg-surface border border-edge text-primary`,onKeyDown:e=>{e.key===`Enter`&&re()}}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsxs)(`button`,{onClick:re,disabled:C,className:`btn-primary disabled:opacity-50`,children:[C?(0,f.jsx)(X,{size:14,className:`animate-spin`}):(0,f.jsx)($s,{size:14}),` Confirm change`]}),(0,f.jsx)(`button`,{onClick:()=>{v(`enter`),S(``),E(``)},disabled:C,className:`btn-secondary`,children:`Back`})]})]})]}),k&&!s&&(0,f.jsxs)(`div`,{className:`rounded-lg p-4 space-y-3 bg-elevated border border-edge`,children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,f.jsx)(`h3`,{className:`text-sm font-semibold text-primary`,children:a.phone?`Change mobile number`:`Add mobile number`}),(0,f.jsx)(`button`,{onClick:ie,className:`text-faint hover:text-primary`,children:(0,f.jsx)(pl,{size:15})})]}),V&&(0,f.jsx)(`p`,{className:`text-xs text-muted`,children:V}),z&&(0,f.jsxs)(`div`,{className:`rounded-lg px-3 py-2 text-xs flex items-center gap-2`,style:{background:`var(--bg-surface)`,color:`var(--danger, #ef4444)`,border:`1px solid var(--border)`},children:[(0,f.jsx)(Y,{size:13,className:`shrink-0`}),` `,z]}),k===`enter`?(0,f.jsxs)(`div`,{className:`space-y-3`,children:[(0,f.jsx)(`p`,{className:`text-xs text-muted`,children:`We'll text a confirmation code to this number. It won't be saved until you enter that c
146ode.`}),(0,f.jsxs)(`div`,{className:`flex items-stretch gap-2 w-full sm:max-w-sm`,children:[(0,f.jsx)(kh,{value:j,onChange:M,disabled:L}),(0,f.jsx)(`input`,{value:N,onChange:e=>P(e.target.value),type:`tel`,inputMode:`tel`,placeholder:`412 345 678`,className:`flex-1 min-w-0 rounded-lg px-3 py-2 text-sm bg-surface border border-edge text-primary`,onKeyDown:e=>{e.key===`Enter`&&q()}})]}),(0,f.jsx)(`div`,{children:(0,f.jsxs)(`button`,{onClick:q,disabled:L,className:`btn-primary disabled:opacity-50`,children:[L?(0,f.jsx)(X,{size:14,className:`animate-spin`}):(0,f.jsx)(Jc,{size:14}),` Send code`]})})]}):(0,f.jsxs)(`div`,{className:`space-y-3`,children:[(0,f.jsx)(`input`,{value:F,onChange:e=>I(e.target.value.replace(/\D/g,``).slice(0,6)),inputMode:`numeric`,placeholder:`000000`,maxLength:6,className:`w-40 rounded-lg px-3 py-2 text-lg font-mono tracking-[0.3rem] text-center bg-surface border border-edge text-primary`,onKeyDown:e=>{e.key===`Enter`&&ae()}}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsxs)(`button`,{onClick:ae,disabled:L,className:`btn-primary disabled:opacity-50`,children:[L?(0,f.jsx)(X,{size:14,className:`animate-spin`}):(0,f.jsx)($s,{size:14}),` Confirm`]}),(0,f.jsx)(`button`,{onClick:()=>{A(`enter`),I(``),B(``)},disabled:L,className:`btn-secondary`,children:`Back`})]})]})]})]})}function jh(){return(0,f.jsxs)(`div`,{className:`p-4 md:p-6 mx-auto space-y-4`,style:{maxWidth:896},children:[(0,f.jsxs)(`h1`,{className:`text-2xl font-bold text-primary mb-6 flex items-center gap-2.5`,children:[(0,f.jsx)(Zc,{size:22,className:`text-faint shrink-0`}),`Security`]}),(0,f.jsx)(Fp,{})]})}var Mh=[`Australia/Sydney`,`Australia/Melbourne`,`Australia/Brisbane`,`Australia/Adelaide`,`Australia/Perth`,`Australia/Darwin`,`Australia/Hobart`,`Pacific/Auckland`,`Pacific/Fiji`,`Asia/Singapore`,`Asia/Hong_Kong`,`Asia/Tokyo`,`Asia/Kolkata`,`Asia/Dubai`,`Europe/London`,`Europe/Paris`,`Europe/Berlin`,`America/New_York`,`America/Chicago`,`America/Denver`,`America/Los_Angeles`,`UTC`];function Nh(){try{let e=Intl.supportedValuesOf(`timeZone`);if(Array.isArray(e)&&e.length)return e}catch{}return Mh}function Ph({theme:e,onThemeChange:t,onProfileSaved:n}){let[r,i]=(0,l.useState)(!0),[a,o]=(0,l.useState)(!1),[s,c]=(0,l.useState)(!1),[u,d]=(0,l.useState)(``),[p,m]=(0,l.useState)(``),[h,g]=(0,l.useState)(!0),[_,v]=(0,l.useState)(!1),[y,b]=(0,l.useState)(!1),x=Nh(),S=(()=>{try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return``}})();(0,l.useEffect)(()=>{Z(`/api/portal/settings`).then(e=>{e.ok?(m(e.settings?.timezone||``),g(e.settings?.email_notifications!==!1)):d(e.error||`Could not load settings`)}).catch(()=>d(`Could not load settings`)).finally(()=>i(!1))},[]);async function C(t){o(!0),c(!1),d(``);try{let n=await Z(`/api/portal/settings`,{method:`PUT`,body:JSON.stringify({timezone:t.timezone??p,email_notifications:t.email_notifications??h,theme:t.theme??e})});n.ok?(c(!0),setTimeout(()=>c(!1),2500)):d(n.error||`Could not save`)}catch{d(`Could not save`)}finally{o(!1)}}function w(e){m(e),C({timezone:e})}function T(){if(h){b(!1),v(!0);return}g(!0),C({email_notifications:!0})}function E(){g(!1),C({email_notifications:!1}),v(!1)}function D(e){t(e)}return(0,f.jsxs)(`div`,{className:`p-4 md:p-6 mx-auto space-y-4`,style:{maxWidth:896},children:[(0,f.jsxs)(`div`,{className:`flex items-center justify-between mb-6`,children:[(0,f.jsxs)(`h1`,{className:`text-2xl font-bold text-primary flex items-center gap-2.5`,children:[(0,f.jsx)(dl,{size:22,className:`text-faint shrink-0`}),`Profile Settings`]}),a?(0,f.jsx)(`span`,{className:`text-xs text-muted`,children:`Savingâ¦`}):s?(0,f.jsxs)(`span`,{className:`text-xs text-green-500 flex items-center gap-1`,children:[(0,f.jsx)($s,{size:13}),` Saved`]}):null]}),u&&(0,f.jsxs)(`div`,{className:`rounded-lg px-4 py-2.5 text-sm flex items-center gap-2`,style:{background:`var(--bg-elevated)`,color:`var(--danger, #ef4444)`,border:`1px solid var(--border)`},children:[(0,f.jsx)(Y,{size:15,className:`shrink-0`}),` `,u]}),(0,f.jsx)(Ah,{onSaved:n}),(0,f.jsxs)(`div`,{className:`rounded-xl p-6 space-y-4 bg-surface border border-edge`,children:[(0,f.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,f.jsx)(ac,{size:16,className:`text-faint shrink-0 mt-0.5`}),(0,f.jsxs)(`div`,{className:`flex-1`,children:[(0,f.jsx)(`h2`,{className:`text-base font-semibold text-primary`,children:`Time zone`}),(0,f.jsx)(`p`,{className:`text-sm mt-1 text-muted`,children:`Dates and times across the portal are shown in this time zone.`})]})]}),(0,f.jsxs)(`select`,{value:p,onChange:e=>w(e.target.value),disabled:r||a,className:`w-full max-w-md rounded-lg px-3 py-2 text-sm bg-elevated border border-edge text-primary disabled:opacity-50`,children:[(0,f.jsxs)(`option`,{value:``,children:[`Automatic`,S?` (${S})`:``]}),x.map(e=>(0,f.jsx)(`option`,{value:e,children:e.replace(/_/g,` `)},e))]})]}),(0,f.jsxs)(`div`,{className:`rounded-xl p-6 bg-surface border border-edge`,children:[(0,f.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,f.jsx)(Dc,{size:16,className:`text-faint shrink-0 mt-0.5`}),(0,f.jsxs)(`div`,{className:`flex-1`,children:[(0,f.jsx)(`h2`,{className:`text-base font-semibold text-primary`,children:`Email notifications`}),(0,f.jsx)(`p`,{className:`text-sm mt-1 text-muted`,children:`Receive emails about invoices, payments, and service updates. When off, only sign-in codes and support-ticket messages are still sent â everything else is silenced, on every account you belong to.`})]})]}),(0,f.jsx)(`button`,{role:`switch`,"aria-checked":h,onClick:T,disabled:r||a,className:`relative inline-flex h-6 w-11 shrink-0 items-center rounded-full transition-colors disabled:opacity-50`,style:{background:h?`var(--accent)`:`var(--bg-elevated)`,border:`1px solid var(--border)`},children:(0,f.jsx)(`span`,{className:`inline-block h-4 w-4 roun
146ded-full bg-white transition-transform`,style:{transform:h?`translateX(1.5rem)`:`translateX(0.15rem)`}})})]}),_&&(0,f.jsx)(`div`,{className:`mt-4 rounded-lg p-4 border`,style:{background:`var(--bg-elevated)`,borderColor:`rgba(245,158,11,0.4)`},children:(0,f.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,f.jsx)(Y,{size:16,className:`shrink-0 mt-0.5`,style:{color:`#fbbf24`}}),(0,f.jsxs)(`div`,{className:`flex-1`,children:[(0,f.jsx)(`p`,{className:`text-sm font-semibold text-primary`,children:`Silence all notification emails?`}),(0,f.jsxs)(`p`,{className:`text-sm text-muted mt-1`,children:[`You'll stop receiving invoices, payment and service emails for `,(0,f.jsx)(`strong`,{children:`every account`}),` you belong to, and you may miss important messages. Make sure someone else in your organisation still has notifications turned on. (Sign-in codes and support-ticket messages are unaffected.)`]}),(0,f.jsxs)(`label`,{className:`flex items-center gap-2 mt-3 text-sm text-primary cursor-pointer`,children:[(0,f.jsx)(`input`,{type:`checkbox`,checked:y,onChange:e=>b(e.target.checked)}),`I understand and want to turn notifications off.`]}),(0,f.jsxs)(`div`,{className:`flex gap-2 mt-3`,children:[(0,f.jsx)(`button`,{onClick:E,disabled:!y,className:`btn-primary text-sm disabled:opacity-40`,children:`Turn off notifications`}),(0,f.jsx)(`button`,{onClick:()=>v(!1),className:`text-sm px-3 py-1.5 text-muted hover:text-primary`,children:`Cancel`})]})]})]})})]}),(0,f.jsxs)(`div`,{className:`rounded-xl p-6 space-y-4 bg-surface border border-edge`,children:[(0,f.jsxs)(`div`,{className:`flex items-start gap-3`,children:[e===`dark`?(0,f.jsx)(Pc,{size:16,className:`text-faint shrink-0 mt-0.5`}):(0,f.jsx)(nl,{size:16,className:`text-faint shrink-0 mt-0.5`}),(0,f.jsxs)(`div`,{className:`flex-1`,children:[(0,f.jsx)(`h2`,{className:`text-base font-semibold text-primary`,children:`Appearance`}),(0,f.jsx)(`p`,{className:`text-sm mt-1 text-muted`,children:`Choose how the portal looks on this device.`})]})]}),(0,f.jsx)(`div`,{className:`inline-flex rounded-lg p-1 gap-1 bg-elevated border border-edge`,children:[{id:`light`,label:`Light`,icon:nl},{id:`dark`,label:`Dark`,icon:Pc}].map(t=>(0,f.jsxs)(`button`,{onClick:()=>D(t.id),className:`flex items-center gap-2 px-4 py-1.5 rounded-md text-sm font-medium transition-colors ${e===t.id?`text-accent`:`text-muted hover:text-primary`}`,style:e===t.id?{background:`var(--bg-surface)`,border:`1px solid var(--border)`}:{border:`1px solid transparent`},children:[(0,f.jsx)(t.icon,{size:14}),` `,t.label]},t.id))})]})]})}function Fh({onClose:e,onGoToSecurity:t}){let[n,r]=(0,l.useState)(``),[i,a]=(0,l.useState)(``),[o,s]=(0,l.useState)([]),[c,u]=(0,l.useState)(!1);(0,l.useEffect)(()=>{Z(`/api/portal/identities`).then(e=>{e.ok&&s(e.available||[])}).catch(()=>{})},[]);async function d(){r(`passkey`),a(``);try{let e=await Z(`/api/portal/2fa/passkey/register/begin`,{method:`POST`});if(e.needMobile){u(!0),a(``),r(``);return}if(!e.ok){a(e.error||`Could not start`),r(``);return}let n=await Fd(e.options),i=await Z(`/api/portal/2fa/passkey/register/complete`,{method:`POST`,body:JSON.stringify({credential:n})});i.ok?(m(),t?.()):i.needMobile?(u(!0),a(``),r(``)):(a(i.error||`Registration failed`),r(``))}catch(e){a(e.name===`NotAllowedError`?`Passkey prompt was dismissed.`:e.message||`Registration failed`),r(``)}}async function p(e){r(e),a(``);try{let t=await Z(`/api/portal/auth/${e}/link/start`,{method:`POST`});if(!t.ok||!t.url){a(t.error||`Could not start`),r(``);return}window.location.assign(t.url)}catch{a(`Network error.`),r(``)}}function m(){hd(),e()}return(0,f.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center p-4`,style:{background:`rgba(0,0,0,0.5)`},children:(0,f.jsxs)(`div`,{className:`w-full max-w-md rounded-xl p-6 space-y-4 bg-canvas`,style:{border:`1px solid var(--border, rgba(0,0,0,0.1))`},children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(Xc,{size:20,className:`text-accent`}),(0,f.jsx)(`h2`,{className:`text-lg font-bold text-primary`,children:`Make signing in easier`})]}),(0,f.jsx)(`p`,{className:`text-sm text-muted`,children:`Skip the email codes next time. Add a passkey or connect a sign-in provider â entering your email will take you straight there.`}),i&&(0,f.jsxs)(`div`,{className:`alert-error`,children:[(0,f.jsx)(Y,{size:14}),i]}),c?(0,f.jsx)(Pp,{onVerified:()=>{u(!1),d()},onCancel:()=>u(!1)}):(0,f.jsxs)(`button`,{onClick:d,disabled:!!n,className:`w-full btn-primary py-2.5 flex items-center justify-center gap-2 disabled:opacity-50`,children:[(0,f.jsx)(Fs,{size:16}),` `,n===`passkey`?`Waiting for browserâ¦`:`Add a passkey`]}),o.length>0&&(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(`p`,{className:`text-xs text-muted text-center`,children:`or connect a provider`}),(0,f.jsx)(`div`,{className:`flex flex-wrap justify-center gap-2`,children:o.map(e=>(0,f.jsxs)(`button`,{onClick:()=>p(e.id),disabled:!!n,className:`btn-secondary px-3 py-1.5 text-sm flex items-center gap-1.5 disabled:opacity-50`,children:[(0,f.jsx)(Rd,{id:e.id,size:14}),` `,Ld[e.id]?.label||e.name]},e.id))})]}),(0,f.jsx)(`button`,{onClick:m,disabled:!!n,className:`w-full text-xs pt-1 disabled:opacity-50 text-faint cursor-pointer disabled:cursor-default hover:underline`,children:`Keep using email codes`})]})})}var Ih=`portal:bannerHidden`;function Lh(){try{return JSON.parse(sessionStorage.getItem(Ih)||`[]`)}catch{return[]}}function Rh({top:e=0,onHeight:t}){let[n,r]=(0,l.useState)(null),[i,a]=(0,l.useState)(!1),[o,s]=(0,l.useState)(``),c=(0,l.useRef)(null);if((0,l.useEffect)(()=>{let e=!0;return Z(`/api/portal/banner`).then(t=>{e&&t?.ok&&t.banner&&!Lh().includes(t.banner.id)&&r(t.banner)}
146).catch(()=>{}),()=>{e=!1}},[]),(0,l.useEffect)(()=>{let e=c.current;if(!e){t?.(0);return}let n=new ResizeObserver(()=>t?.(e.offsetHeight));return n.observe(e),()=>{n.disconnect(),t?.(0)}},[n,t]),!n)return null;let u=/^#[0-9a-f]{6}$/i.test(n.accent||``)?n.accent:`#6366f1`,d=ef[n.icon_name]||Ic;function p(){try{sessionStorage.setItem(Ih,JSON.stringify([...Lh(),n.id]))}catch{}r(null),Z(`/api/portal/banner/${n.id}/dismiss`,{method:`POST`,body:`{}`}).catch(()=>{})}async function m(){a(!0),s(``),Z(`/api/portal/banner/${n.id}/click`,{method:`POST`,body:`{}`,keepalive:!0}).catch(()=>{});let e=await qu(n.link_path);e?(s(e),a(!1)):/^https:\/\//i.test(n.link_path||``)&&a(!1)}return(0,f.jsx)(`div`,{ref:c,role:`region`,"aria-label":n.eyebrow||`Promotion`,className:`fixed left-0 right-0 z-[55] border-b`,style:{top:e,background:`linear-gradient(90deg, ${u}1c, ${u}0a), var(--bg-surface)`,borderColor:`${u}40`},children:(0,f.jsxs)(`div`,{className:`relative flex items-center justify-center gap-x-3 gap-y-1.5 flex-wrap pl-4 pr-11 py-2 min-h-[44px]`,children:[(0,f.jsx)(d,{size:15,className:`hidden sm:block shrink-0`,style:{color:u}}),(0,f.jsxs)(`p`,{className:`text-sm text-primary leading-snug text-center sm:text-left`,style:{margin:0},children:[n.eyebrow&&(0,f.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-wider mr-2 align-[1px]`,style:{color:u},children:n.eyebrow}),(0,f.jsx)(`span`,{className:`font-semibold`,children:n.headline}),n.body&&(0,f.jsxs)(`span`,{className:`text-muted hidden md:inline`,children:[` â `,n.body]}),n.test_mode&&(0,f.jsx)(`span`,{className:`ml-2 text-[10px] font-semibold uppercase tracking-wider px-1.5 py-0.5 rounded align-[1px]`,style:{background:`var(--bg-elevated)`,color:`var(--text-muted)`,border:`1px solid var(--border)`},children:`Test mode`})]}),(0,f.jsxs)(`button`,{onClick:m,disabled:i,className:`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1 text-xs font-semibold text-white shrink-0 whitespace-nowrap transition-opacity hover:opacity-90`,style:{background:u,border:`none`,cursor:i?`default`:`pointer`},children:[i?(0,f.jsx)(X,{size:12,className:`animate-spin`}):null,n.cta_label||`Learn more`,!i&&(0,f.jsx)(Js,{size:12})]}),o&&(0,f.jsx)(`p`,{className:`w-full text-xs text-center`,style:{margin:0,color:`var(--color-danger, #dc2626)`},children:o}),(0,f.jsx)(`button`,{onClick:p,"aria-label":`Dismiss`,title:`Dismiss`,className:`absolute right-2 top-1/2 -translate-y-1/2 w-7 h-7 flex items-center justify-center rounded-md text-muted hover:bg-elevated hover:text-primary transition-colors`,children:(0,f.jsx)(pl,{size:14})})]})})}function zh(){let[e,t]=(0,l.useState)(!1),[n,r]=(0,l.useState)(`administrator`),[i,a]=(0,l.useState)(!1),[o,s]=(0,l.useState)(!1),[c,u]=(0,l.useState)(``);async function d(){a(!0),u(``);try{let e=await Z(`/api/portal/request-role`,{method:`POST`,body:JSON.stringify({role:n})});e.ok?s(!0):u(e.error||`Could not send your request.`)}catch{u(`Could not send your request.`)}finally{a(!1)}}return(0,f.jsxs)(`div`,{className:`mb-4 rounded-xl border border-edge bg-surface p-4`,children:[(0,f.jsxs)(`div`,{className:`flex items-start gap-3 flex-wrap`,children:[(0,f.jsx)(`div`,{className:`w-9 h-9 rounded-full flex items-center justify-center shrink-0`,style:{background:`var(--bg-elevated)`},children:(0,f.jsx)(Xc,{size:16,className:`text-faint`})}),(0,f.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,f.jsx)(`p`,{className:`text-sm font-semibold text-primary`,children:`You have read-only access`}),(0,f.jsx)(`p`,{className:`text-xs text-muted mt-0.5`,children:`You can view everything on this account but can't make changes. Request a role and the account owner will be notified.`})]}),!e&&!o&&(0,f.jsxs)(`button`,{className:`btn-primary shrink-0`,onClick:()=>t(!0),children:[(0,f.jsx)(Jc,{size:14}),` Request access`]})]}),o?(0,f.jsxs)(`div`,{className:`mt-3 rounded-lg px-3 py-2 text-sm flex items-center gap-2`,style:{background:`var(--bg-elevated)`,color:`var(--accent)`,border:`1px solid var(--border)`},children:[(0,f.jsx)($s,{size:15}),` Your request was sent to the account owner.`]}):e&&(0,f.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 flex-wrap`,children:[(0,f.jsxs)(`select`,{value:n,onChange:e=>r(e.target.value),className:`text-sm px-2 py-1.5 rounded border cursor-pointer`,style:{background:`var(--bg-elevated)`,border:`1px solid var(--border)`,color:`var(--text-primary)`},children:[(0,f.jsx)(`option`,{value:`administrator`,children:`Administrator â full access`}
146),(0,f.jsx)(`option`,{value:`billing`,children:`Billing â invoices & payments`}),(0,f.jsx)(`option`,{value:`technical`,children:`Technical â services & sign-in`})]}),(0,f.jsxs)(`button`,{className:`btn-primary`,onClick:d,disabled:i,children:[i?(0,f.jsx)(X,{size:14,className:`animate-spin`}):(0,f.jsx)(Jc,{size:14}),` Send request`]}),c&&(0,f.jsx)(`span`,{className:`text-xs`,style:{color:`var(--danger, #ef4444)`},children:c})]})]})}function Bh({totalAccessible:e=1,onSwitchAccount:t}){let[n,r]=(0,l.useState)({administrator:!1,technical:!1,billing:!1}),[i,a]=(0,l.useState)(!1),[o,s]=(0,l.useState)(!1),[c,u]=(0,l.useState)(``),[d,p]=(0,l.useState)([]),[m,h]=(0,l.useState)(!1),g=e>1,_=e=>r(t=>({...t,[e]:!t[e]}));async function v(){let e=Object.keys(n).filter(e=>n[e]);if(!e.length){u(`Select at least one type of access to request.`);return}a(!0),u(``);try{let t=await Z(`/api/portal/request-role`,{method:`POST`,body:JSON.stringify({roles:e})});t.ok?s(!0):u(t.error||`Could not send your request.`)}catch{u(`Could not send your request.`)}finally{a(!1)}}(0,l.useEffect)(()=>{g&&(h(!0),Z(`/api/portal/linked-accounts?page=1`).then(e=>p((e.accounts||[]).filter(e=>!e.is_current))).catch(()=>{}).finally(()=>h(!1)))},[g]);function y(e){Z(`/api/portal/switch-account`,{method:`POST`,body:JSON.stringify({accountId:e.id})}).then(e=>{e.ok&&e.token&&t?.(e.client,e.token)}).catch(()=>{})}return(0,f.jsxs)(`div`,{className:`p-4 md:p-6 mx-auto space-y-4`,style:{maxWidth:560},children:[(0,f.jsxs)(`div`,{className:`rounded-xl p-6 md:p-8 bg-surface border border-edge text-center space-y-4`,children:[(0,f.jsx)(`div`,{className:`w-12 h-12 mx-auto rounded-full flex items-center justify-center`,style:{background:`var(--bg-elevated)`},children:(0,f.jsx)(Xc,{size:22,className:`text-faint`})}),(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h1`,{className:`text-lg font-bold text-primary`,children:`You don't have full access yet`}),(0,f.jsx)(`p`,{className:`text-sm text-muted mt-1`,children:`The account owner controls what you can see. Request Administrator, Billing or Technical access below and the owner will be notified â they can grant it in their Users settings.`})]}),o?(0,f.jsxs)(`div`,{className:`rounded-lg px-4 py-3 text-sm flex items-center justify-center gap-2`,style:{background:`var(--bg-elevated)`,color:`var(--accent)`,border:`1px solid var(--border)`},children:[(0,f.jsx)($s,{size:15}),` Your request was sent to the account owner.`]}):(0,f.jsxs)(`div`,{className:`space-y-3`,children:[(0,f.jsx)(`div`,{className:`flex flex-col gap-2 text-left`,children:[{k:`administrator`,label:`Administrator access`,desc:`Full access to everything except managing users`},{k:`technical`,label:`Technical access`,desc:`Services & domains, ordering, sign-in`},{k:`billing`,label:`Billing access`,desc:`Invoices, payments, billing details`}].map(e=>(0,f.jsxs)(`button`,{onClick:()=>_(e.k),type:`button`,className:`flex items-center gap-3 rounded-lg px-4 py-3 text-left border transition-colors`,style:{background:n[e.k]?`var(--bg-elevated)`:`transparent`,borderColor:n[e.k]?`var(--accent)`:`var(--border)`},children:[(0,f.jsx)(`span`,{className:`w-4 h-4 rounded border flex items-center justify-center shrink-0`,style:{borderColor:n[e.k]?`var(--accent)`:`var(--border)`,background:n[e.k]?`var(--accent)`:`transparent`},children:n[e.k]&&(0,f.jsx)($s,{size:11,style:{color:`#fff`}})}),(0,f.jsxs)(`span`,{className:`flex-1`,children:[(0,f.jsx)(`span`,{className:`text-sm font-medium text-primary block`,children:e.label}),(0,f.jsx)(`span`,{className:`text-xs text-muted`,children:e.desc})]})]},e.k))}),c&&(0,f.jsx)(`p`,{className:`text-xs`,style:{color:`var(--danger, #ef4444)`},children:c}),(0,f.jsxs)(`button`,{onClick:v,disabled:i,className:`btn-primary w-full justify-center disabled:opacity-50`,children:[i?(0,f.jsx)(X,{size:14,className:`animate-spin`}):(0,f.jsx)(Jc,{size:14}),` Request access`]})]})]}),g&&(0,f.jsxs)(`div`,{className:`rounded-xl p-6 bg-surface border border-edge space-y-3`,children:[(0,f.jsxs)(`div`,{children:[(0,f.jsx)(`h2`,{className:`text-base font-semibold text-primary`,children:`Your other accounts`}),(0,f.jsx)(`p`,{className:`text-sm text-muted mt-0.5`,children:`You have access to these accounts â switch to one to continue.`})]}),m?(0,f.jsx)(`div`,{className:`flex justify-center py-6`,children:(0,f.jsx)(X,{size:18,className:`animate-spin text-faint`})}):d.length?(0,f.jsx)(of,{accounts:d,loading:!1,onSwitch:y}):(0,f.jsx)(`p`,{className:`text-sm text-muted`,children:`No other accounts available.`})]})]})}function Vh({client:e,setClient:t,onLogout:n,gcAvailable:r=!1,ppAvailable:i=!1,payToAvailable:a=!1,bpay:o=null,pendingNav:s=null}){let[c,u]=(0,l.useState)(()=>
146{try{if(new URL(window.location.href).searchParams.get(`stripe_connect`)===`1`)return`reseller`}catch{}return xh().tab}),[d,p]=(0,l.useState)(()=>xh().serviceId),[m,h]=(0,l.useState)(()=>xh().domainId),[g,_]=(0,l.useState)(()=>xh().accountSubTab),[v,y]=(0,l.useState)(()=>localStorage.getItem(`portal:theme`)||`light`),[b,x]=(0,l.useState)(!1),[S,C]=(0,l.useState)(!1),[w,T]=(0,l.useState)(!1),[E]=(0,l.useState)(()=>{let e=cd(localStorage.getItem(hl));return e?.imp?{staff:e.staff||null}:null}),D=(0,l.useRef)(null),O=!!cd(localStorage.getItem(hl))?.pending;(0,l.useEffect)(()=>{function e(e){D.current&&!D.current.contains(e.target)&&C(!1)}return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[]),(0,l.useEffect)(()=>{E||md()||Promise.all([Z(`/api/portal/2fa/status`).catch(()=>({})),Z(`/api/portal/identities`).catch(()=>({}))]).then(([e,t])=>{let n=(e?.passkeys?.length||0)>0,r=(t?.identities?.length||0)>0;!n&&!r&&T(!0)}).catch(()=>{})},[]);let[k,A]=(0,l.useState)([]),[j,M]=(0,l.useState)([]),[N,P]=(0,l.useState)([]),[F,I]=(0,l.useState)([]),[L,R]=(0,l.useState)(!0),[z,B]=(0,l.useState)(()=>{try{return JSON.parse(localStorage.getItem(`portal:read-ann`)||`[]`)}catch{return[]}}),[V,H]=(0,l.useState)(0),[U,W]=(0,l.useState)(0),[G,ee]=(0,l.useState)(0),[te,ne]=(0,l.useState)(!1),re=G>0||te,K=(0,l.useCallback)(()=>{Z(`/api/portal/me`).then(e=>{e?.ok&&(ee(e.openQuoteCount||0),(e.quoteCount||0)>0&&ne(!0))}).catch(()=>{})},[]),[ie,q]=(0,l.useState)(!0),[ae,oe]=(0,l.useState)(!1),[se,ce]=(0,l.useState)(1),[le,ue]=(0,l.useState)(!0),[de,fe]=(0,l.useState)({}),[pe,me]=(0,l.useState)(0),[he,ge]=(0,l.useState)(!1),[_e,ve]=(0,l.useState)(null),[ye,be]=(0,l.useState)(null),[xe,Se]=(0,l.useState)(null),[Ce,we]=(0,l.useState)(()=>{try{return sessionStorage.getItem(`portal:chosen-account`)||``}catch{return``}}),[Te,Ee]=(0,l.useState)(()=>{try{return JSON.parse(localStorage.getItem(`crm:portal:origin-client`)||`null`)}catch{return null}}),[De,Oe]=(0,l.useState)([]),[ke,Ae]=(0,l.useState)(null),[je,Me]=(0,l.useState)(null);(0,l.useEffect)(()=>{s&&(s.subTab&&_(s.subTab),s.focusTransferId&&Ae(s.focusTransferId),u(s.tab),Ie(s.tab,{subTab:s.subTab||`details`},{replace:!0}))},[s]);let Ne=(0,l.useCallback)(()=>Z(`/api/portal/transfers`).then(e=>{e.ok&&Oe((e.inbound||[]).filter(e=>e.status===`pending`))}).catch(()=>{}),[]),Pe=(0,l.useCallback)(e=>{Oe((e?.inbound||[]).filter(e=>e.status===`pending`))},[]);(0,l.useEffect)(()=>{Z(`/api/portal/affiliate`).then(e=>{e.ok&&Se(e.affiliate?{status:e.affiliate.status,blocked:e.affiliate.blocked}:null)}).catch(()=>{}),Promise.all([Z(`/api/portal/me`).then(e=>(H(e.linkedAccountCount||0),q(e.hasOwnAccount!==!1),oe(e.isHomeAccount===!0),ce(e.totalAccessible??(e.linkedAccountCount||0)),W(e.domainCount||0),ee(e.openQuoteCount||0),(e.quoteCount||0)>0&&ne(!0),ue(e.canViewDetail!==!1),fe(e.caps||{}),ge(e.monitoringEnabled===!0),ve(e.partner||null),e.ownerProfile&&be(t=>t||e.ownerProfile),(e.theme===`light`||e.theme===`dark`)&&y(e.theme),e.services||[])),Z(`/api/portal/invoices`).then(e=>e.invoices||[]),Z(`/api/portal/tickets`).then(e=>e.tickets||[]),Z(`/api/portal/announcements`).then(e=>e.announcements||[]).catch(()=>[])]).then(([e,t,n,r])=>{A(e),M(t),P(n),I(r)}).catch(()=>{}).finally(()=>R(!1)),Ne()},[Ne]);let Fe=(0,l.useCallback)(()=>Z(`/api/portal/invoices`).then(e=>{e.invoices&&M(e.invoices)}).catch(()=>{}),[]);(0,l.useEffect)(()=>{function e(){document.visibilityState===`visible`&&Fe()}return window.addEventListener(`focus`,e),document.addEventListener(`visibilitychange`,e),()=>{window.removeEventListener(`focus`,e),document.removeEventListener(`visibilitychange`,e)}},[Fe]),(0,l.useEffect)(()=>{document.documentElement.setAttribute(`data-theme`,v),localStorage.setItem(`portal:theme`,v)},[v]),(0,l.useEffect)(()=>{wh(`portal:tab`,c)},[c]),(0,l.useEffect)(()=>{function e(){let e=xh();u(e.tab),p(e.serviceId),h(e.domainId),_(e.accountSubTab)}return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]);function Ie(e,t,{replace:n=!1}={}){let r=Sh(e,t);try{if(window.location.pathname===r)return;n?window.history.replaceState({},``,r):window.history.pushState({},``,r)}catch{}}let Le=_e?.type===`referral`&&_e.status===`active`&&!_e.blocked;(0,l.useEffect)(()=>{Le&&c===`referrals`&&(u(`reseller`),Ie(`reseller`,{},{replace:!0}))},[Le,c]);function Re(e,t){e===`services`&&wh(`portal:svc:selected`,null),e===`support`&&(wh(`portal:support:selected`,null),wh(`portal:support:showNew`,!1)),p(null),h(null),u(e);let n=e===`account`&&t||`details`;Ie(e,{subTab:n}),_(n),x(!1),window.scrollTo({top:0,left:0,behavior:`auto`})}function ze(e){_(e),Ie(`account`,{subTab:e})}function Be(e){Me(e||null),Re(`billing`)}function Ve(e){wh(`portal:svc:selected`,null),h(null),p(e||null),u(`services`),_(`details`),Ie(`services`,{serviceId:e||null}),x(!1),window.scrollTo({top:0,left:0,behavior:`auto`})}function He(e){p(null),h(e||null),u(`domains`),Ie(`domains`,{domainId:e||null}),x(!1),window.scrollTo({top:0,left:0,behavior:`auto`})}function Ue(e){p(e||null),Ie(`services`,{serviceId:e||null})}function We(e){h(e||null),Ie(`domains`,{domainId:e||null})}function Ge(e){y(e),Z(`/api/portal/theme`,{method:`PUT`,body:JSON.stringify({theme:e})}).catch(()=>{})}function Ke(){Ge(v===`dark`?`light`:`dark`)}function qe(n,r){let i=!!cd(localStorage.getItem(hl))?.pending;!Te&&!i&&(localStorage.setItem(`crm:portal:origin-token`,localStorage.getItem(`crm:portal:token`)||``),localStorage.setItem(`crm:portal:origin-client`,JSON.stringify(e)),Ee(e)),r&&localStorage.setItem(hl,r);let a=n?.id==null?``:String(n.id);try{sessionStorage.setItem(`portal:chosen-account`,a)}catch{}
146we(a),t(n),u(`dashboard`),x(!1),R(!0),Z(`/api/portal/affiliate`).then(e=>{Se(e.ok&&e.affiliate?{status:e.affiliate.status,blocked:e.affiliate.blocked}:null)}).catch(()=>{}),Promise.all([Z(`/api/portal/me`).then(e=>(H(e.linkedAccountCount||0),q(e.hasOwnAccount!==!1),oe(e.isHomeAccount===!0),ce(e.totalAccessible??(e.linkedAccountCount||0)),W(e.domainCount||0),ee(e.openQuoteCount||0),(e.quoteCount||0)>0&&ne(!0),ue(e.canViewDetail!==!1),fe(e.caps||{}),ge(e.monitoringEnabled===!0),ve(e.partner||null),e.ownerProfile&&be(t=>t||e.ownerProfile),(e.theme===`light`||e.theme===`dark`)&&y(e.theme),e.services||[])),Z(`/api/portal/invoices`).then(e=>e.invoices||[]),Z(`/api/portal/tickets`).then(e=>e.tickets||[]),Z(`/api/portal/announcements`).then(e=>e.announcements||[]).catch(()=>[])]).then(([e,t,n,r])=>{A(e),M(t),P(n),I(r)}).catch(()=>{}).finally(()=>R(!1)),Ne()}function Je(){let e=localStorage.getItem(`crm:portal:origin-token`),n=Te;localStorage.removeItem(`crm:portal:origin-token`),localStorage.removeItem(`crm:portal:origin-client`),Ee(null);try{sessionStorage.removeItem(`portal:chosen-account`)}catch{}we(``),e&&localStorage.setItem(hl,e),t(n),u(`linked-accounts`),x(!1),R(!0),Promise.all([Z(`/api/portal/me`).then(e=>(H(e.linkedAccountCount||0),q(e.hasOwnAccount!==!1),oe(e.isHomeAccount===!0),ce(e.totalAccessible??(e.linkedAccountCount||0)),W(e.domainCount||0),ee(e.openQuoteCount||0),(e.quoteCount||0)>0&&ne(!0),ue(e.canViewDetail!==!1),fe(e.caps||{}),ge(e.monitoringEnabled===!0),ve(e.partner||null),e.ownerProfile&&be(t=>t||e.ownerProfile),(e.theme===`light`||e.theme===`dark`)&&y(e.theme),e.services||[])),Z(`/api/portal/invoices`).then(e=>e.invoices||[]),Z(`/api/portal/tickets`).then(e=>e.tickets||[]),Z(`/api/portal/announcements`).then(e=>e.announcements||[]).catch(()=>[])]).then(([e,t,n,r])=>{A(e),M(t),P(n),I(r)}).catch(()=>{}).finally(()=>R(!1)),Ne()}let Ye=F.filter(e=>!z.includes(e.id));function Xe(e){let t=[...new Set([...z,e])];B(t),localStorage.setItem(`portal:read-ann`,JSON.stringify(t))}function Ze(){let e=[...new Set([...z,...F.map(e=>e.id)])];B(e),localStorage.setItem(`portal:read-ann`,JSON.stringify(e))}_h.find(e=>e.id===c);let Qe=O&&se>1,$e=!!Te||!!Ce&&String(e?.id)===Ce,et=Te||E?40:0,tt=et+pe;return(0,f.jsxs)(`div`,{className:`h-screen overflow-hidden bg-canvas`,children:[w&&(0,f.jsx)(Fh,{onClose:()=>T(!1),onGoToSecurity:()=>{T(!1),u(`security`)}}),Te&&(0,f.jsxs)(`div`,{className:`fixed top-0 left-0 right-0 z-[60] h-10 flex items-center justify-center gap-3 px-4 text-sm font-medium`,style:{background:`#dc2626`,color:`#fff`,boxShadow:`0 2px 8px rgba(0,0,0,0.25)`},children:[(0,f.jsxs)(`span`,{children:[`You are viewing `,(0,f.jsx)(`strong`,{children:e.companyname||`${e.firstname} ${e.lastname}`}),` `,`â not your own account.`]}),(0,f.jsxs)(`button`,{onClick:Je,className:`inline-flex items-center gap-1 rounded px-2.5 py-0.5 text-xs font-semibold transition-colors`,style:{background:`rgba(255,255,255,0.2)`,color:`#fff`},children:[`Switch back to `,Te.companyname||`${Te.firstname} ${Te.lastname}`]})]}),E&&(0,f.jsxs)(`div`,{className:`fixed top-0 left-0 right-0 z-[60] h-10 flex items-center justify-center gap-3 px-4 text-sm font-medium`,style:{background:`#dc2626`,color:`#fff`,boxShadow:`0 2px 8px rgba(0,0,0,0.25)`},children:[(0,f.jsxs)(`span`,{children:[`Staff view`,E.staff?(0,f.jsxs)(f.Fragment,{children:[` (`,E.staff,`)`]}):null,`: you are logged in as`,` `,(0,f.jsx)(`strong`,{children:e.companyname||`${e.firstname} ${e.lastname}`}),`.`]}),(0,f.jsx)(`button`,{onClick:n,className:`inline-flex items-center gap-1 rounded px-2.5 py-0.5 text-xs font-semibold transition-colors`,style:{background:`rgba(255,255,255,0.2)`,color:`#fff`},children:`Exit`})]}),!Qe&&c!==`order`&&de.order!==!1&&Eh(c,de)&&(0,f.jsx)(Rh,{top:et,onHeight:me},e?.id),(0,f.jsx)(`aside`,{className:`hidden lg:fixed lg:z-50 lg:flex lg:w-64 lg:flex-col`,style:{top:tt,bottom:0},children:(0,f.jsx)(Oh,{client:e,tab:c,navigate:Re,services:k,invoices:j,dataLoading:L,linkedAccountCount:V,totalAccessible:se,affiliateStatus:xe,hideReferralsNav:Le,isSwitched:!!Te,caps:de,showQuotes:re,openQuoteCount:G,monitoringEnabled:he})}),b&&(0,f.jsxs)(`div`,{className:`lg:hidden fixed inset-0 z-50 flex`,children:[(0,f.jsx)(`div`,{className:`fixed inset-0`,style:{background:`rgba(0,0,0,0.4)`},onClick:()=>x(!1)}),(0,f.jsx)(`aside`,{className:`relative flex w-64 flex-col z-10 shadow-xl`,children:(0,f.jsx)(Oh,{client:e,tab:c,navigate:Re,onLogout:n,services:k,invoices:j,dataLoading:L,linkedAccountCount:V,totalAccessible:se,affiliateStatus:xe,hideReferralsNav:Le,isSwitched:!!Te,caps:de,showQuotes:re,openQuoteCount:G,monitoringEnabled:he})})]}),(0,f.jsxs)(`div`,{className:`lg:pl-64 flex flex-col`,style:{marginTop:tt,height:tt?`calc(100dvh - ${tt}px)`:`100dvh`},children:[(0,f.jsxs)(`div`,{className:`z-40 flex h-16 shrink-0 items-center gap-x-3 border-b border-edge bg-surface px-4 sm:px-6 lg:px-8`,style:{boxShadow:`0 1px 3px rgba(0,0,0,0.06)`},children:[(0,f.jsx)(`button`,{onClick:()=>x(!0),className:`lg:hidden w-8 h-8 flex items-center justify-center rounded-md text-muted hover:bg-elevated transition-colors`,children:(0,f.jsx)(Ac,{size:18})}),(0,f.jsx)(`div`,{className:`h-5 w-px bg-edge lg:hidden`}),(0,f.jsx)(`div`,{className:`flex flex-1 items-center`}),(0,f.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[(0,f.jsx)(`button`,{className:`w-8 h-8 flex items-center justify-center rounded-md text-muted hover:bg-elevated transition-colors`,title:`Help`,children:(0,f.jsx)(Ls,{size:17})}),(0,f.jsxs)(`button`,{onClick:()=>
146Re(`notifications`),className:`relative w-8 h-8 flex items-center justify-center rounded-md text-muted hover:bg-elevated transition-colors`,title:`Notifications`,children:[(0,f.jsx)(Xs,{size:17}),Ye.length>0&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`span`,{className:`absolute top-1 right-1 w-2 h-2 rounded-full bg-red-500 animate-ping opacity-75 pointer-events-none`}),(0,f.jsx)(`span`,{className:`absolute top-1 right-1 w-2 h-2 rounded-full bg-red-500 pointer-events-none`})]})]}),(0,f.jsx)(`button`,{onClick:Ke,className:`w-8 h-8 flex items-center justify-center rounded-md text-muted hover:bg-elevated transition-colors`,title:v===`dark`?`Switch to light mode`:`Switch to dark mode`,children:v===`dark`?(0,f.jsx)(nl,{size:17}):(0,f.jsx)(Pc,{size:17})}),(()=>{let e=j.filter(e=>e.status===`Unpaid`||e.status===`Overdue`);return e.length>0?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`div`,{className:`h-5 w-px bg-edge mx-1.5`}),(0,f.jsxs)(`button`,{onClick:()=>Re(`billing`),className:`btn-success gap-1.5`,children:[(0,f.jsx)(fc,{size:14}),(0,f.jsx)(`span`,{className:`hidden sm:inline`,children:`Pay invoice`}),(0,f.jsx)(`span`,{className:`inline-flex items-center justify-center w-4 h-4 rounded-full text-[10px] font-bold text-white`,style:{background:`var(--btn-green-hover)`},children:e.length})]})]}):null})(),(0,f.jsx)(`div`,{className:`h-5 w-px bg-edge mx-1.5`}),(()=>{let t=ye||Te||e;return(0,f.jsxs)(`div`,{className:`relative hidden sm:block`,ref:D,children:[(0,f.jsxs)(`button`,{onClick:()=>C(e=>!e),className:`flex items-center gap-2 pl-1 pr-1.5 py-1 rounded-lg hover:bg-elevated transition-colors`,children:[(0,f.jsx)(`div`,{className:`w-7 h-7 rounded-full flex items-center justify-center text-xs font-bold shrink-0`,style:{background:xd,color:`#fff`},children:yd(`${t.firstname||``} ${t.lastname||``}`,t.email)}),(0,f.jsxs)(`div`,{className:`leading-tight`,children:[(0,f.jsxs)(`p`,{className:`text-xs font-semibold text-primary whitespace-nowrap`,children:[t.firstname,` `,t.lastname]}),(0,f.jsx)(`p`,{className:`text-[10px] text-muted whitespace-nowrap`,children:t.email})]}),(0,f.jsx)(ec,{size:12,className:`text-faint ml-0.5 shrink-0`})]}),S&&(0,f.jsxs)(`div`,{className:`absolute right-0 mt-1.5 w-44 rounded-xl border border-edge bg-surface shadow-lg z-50 py-1 overflow-hidden`,style:{boxShadow:`0 8px 24px rgba(0,0,0,0.15)`},children:[(0,f.jsxs)(`button`,{onClick:()=>{C(!1),Re(`security`)},className:`flex w-full items-center gap-2.5 px-3 py-2 text-sm text-muted hover:bg-elevated hover:text-primary transition-colors`,children:[(0,f.jsx)(Zc,{size:14,className:`shrink-0`}),` Security`]}),(0,f.jsxs)(`button`,{onClick:()=>{C(!1),Re(`user-settings`)},className:`flex w-full items-center gap-2.5 px-3 py-2 text-sm text-muted hover:bg-elevated hover:text-primary transition-colors`,children:[(0,f.jsx)(dl,{size:14,className:`shrink-0`}),` Profile Settings`]}),(0,f.jsx)(`div`,{className:`my-1 border-t border-edge`}),(0,f.jsxs)(`button`,{onClick:()=>{C(!1),n()},className:`flex w-full items-center gap-2.5 px-3 py-2 text-sm text-muted hover:bg-elevated hover:text-primary transition-colors`,children:[(0,f.jsx)(Ec,{size:14,className:`shrink-0`}),` Sign Out`]})]})]})})()]})]}),(0,f.jsxs)(`main`,{className:`flex-1 min-h-0 overflow-y-auto pb-16 lg:pb-0`,children:[De.length>0&&!(c===`account`&&g===`transfer`)&&(0,f.jsx)(`div`,{className:`px-4 md:px-6 pt-4`,children:(0,f.jsxs)(`div`,{className:`rounded-xl p-4 border flex items-start gap-3`,style:{borderColor:`var(--color-warning, #d97706)`,background:`var(--bg-surface)`},children:[(0,f.jsx)(qs,{size:17,style:{color:`var(--color-warning, #d97706)`,flexShrink:0,marginTop:2}}),(0,f.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,f.jsx)(`p`,{className:`text-sm font-semibold text-primary`,style:{margin:0},children:De.length===1?`${De[0].fromName} wants to transfer ${De[0].items.length} item${De[0].items.length===1?``:`s`} to you`:`You have ${De.length} incoming service transfers`}),(0,f.jsx)(`p`,{className:`text-xs text-muted`,style:{margin:`0.2rem 0 0`},children:`Review and accept or decline â nothing moves until you do.`})]}),(0,f.jsx)(`button`,{className:`btn-primary shrink-0`,onClick:()=>{Ae(De[0].id),Re(`account`,`transfer`)},children:`Review`})]})}),Qe?(0,f.jsx)(sf,{client:e,services:k,invoices:j,tickets:N,unreadNotifications:Ye.length,domainCount:U,loading:L,setTab:Re,hasOwnAccount:ie,isHomeAccount:ae,accountChosen:$e,totalAccessible:se,onSwitchAccount:qe,mustSelectAccount:!0}):Eh(c,de)?(0,f.jsxs)(f.Fragment,{children:[de.readOnly&&(0,f.jsx)(zh,{}),c===`dashboard`&&(0,f.jsx)(sf,{client:e,services:k,invoices:j,tickets:N,unreadNotifications:Ye.length,domainCount:U,loading:L,setTab:Re,hasOwnAccount:ie,isHomeAccount:ae,accountChosen:$e,totalAccessible:se,onSwitchAccount:qe}),c===`notifications`&&(0,f.jsx)(Zd,{announcements:F,readIds:z,onMarkRead:Xe,onMarkAllRead:Ze}),c===`services`&&(0,f.jsx)(sp,{setTab:Re,routeServiceId:d,onServiceRoute:Ue,canViewDetail:le,caps:de}),c===`domains`&&(0,f.jsx)(Sm,{setTab:Re,routeDomainId:m,onDomainRoute:We,canViewDetail:le,caps:de,bpay:o}),c===`monitoring`&&(he?(0,f.jsx)(Dl,{setTab:Re,onOpenService:Ve,onOpenDomain:He,onOpenInvoice:Be}):(0,f.jsx)(sf,{client:e,services:k,invoices:j,tickets:N,unreadNotifications:Ye.length,domainCount:U,loading:L,setTab:Re,hasOwnAccount:ie,isHomeAccount:ae,accountChosen:$e,totalAccessible:se,onSwitchAccount:qe})),c===`billing`&&(0,f.jsx)(dp,{client:e,setTab:Re,onInvoicesChanged:Fe,focusInvoiceId:je,onFocusInvoiceHandled:()=>Me(null)}),c===`quotes`&&(0,f.jsx)(mp,{caps:de,onQuotesChanged:K}
146),c===`support`&&(0,f.jsx)(Np,{client:e,services:k}),c===`account`&&(0,f.jsx)(am,{client:e,setClient:t,initialTab:g,onTabChange:ze,gcAvailable:r,ppAvailable:i,payToAvailable:a,bpay:o,caps:de,onTransfersChanged:Pe,focusTransferId:ke}),c===`security`&&(0,f.jsx)(jh,{}),c===`user-settings`&&(0,f.jsx)(Ph,{theme:v,onThemeChange:Ge,onProfileSaved:e=>be(t=>({...t||{},firstname:e.firstname,lastname:e.lastname}))}),c===`order`&&(0,f.jsx)(Ju,{caps:de}),c===`referrals`&&(0,f.jsx)(Em,{client:e,affiliateStatus:xe,onStatusChange:Se}),c===`reseller`&&(0,f.jsx)(ah,{client:e,setTab:Re,onOpenService:Ve,onOpenDomain:He,onOpenInvoice:Be}),c===`users`&&(0,f.jsx)(hh,{clientId:e.id,navigate:Re}),c===`linked-accounts`&&(0,f.jsx)(gh,{onSwitch:qe})]}):(0,f.jsx)(Bh,{totalAccessible:se,onSwitchAccount:qe})]})]}),(0,f.jsx)(`div`,{className:`fixed bottom-0 left-0 right-0 z-30 flex lg:hidden border-t border-edge bg-surface`,children:_h.filter(e=>!e.hidden&&Dh(e.id,de)&&(e.id!==`quotes`||re)&&e.id!==`monitoring`&&(e.id!==`referrals`||!Le)).slice(0,5).map(e=>(0,f.jsxs)(`button`,{onClick:()=>Re(e.id),className:`flex-1 flex flex-col items-center py-2 gap-0.5 text-[10px] font-medium transition-colors`,style:{color:c===e.id?`var(--accent)`:`var(--text-muted)`},children:[(0,f.jsx)(e.icon,{size:18}),(0,f.jsx)(`span`,{className:`truncate max-w-[50px]`,children:e.label})]},e.id))})]})}function Hh(){let[e]=(0,l.useState)(()=>new URLSearchParams(window.location.search).get(`t`)||``),[t]=(0,l.useState)(()=>{let e=new URLSearchParams(window.location.search).get(`s`),t=parseInt(e,10);return Number.isInteger(t)&&t>=0&&t<=10?t:null}),[n,r]=(0,l.useState)(!0),[i,a]=(0,l.useState)(``),[o,s]=(0,l.useState)(null),[c,u]=(0,l.useState)(null),[d,m]=(0,l.useState)(!1),[h,g]=(0,l.useState)(!1),[_,v]=(0,l.useState)(``),[y,b]=(0,l.useState)(!1),[x,S]=(0,l.useState)(!1),C=(t,n)=>fetch(t,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...n,t:e})}).then(e=>e.json().then(t=>({...t,_status:e.status})));async function w(e){u(e),m(!0);try{let t=await C(`/api/portal/feedback/score`,{score:e});t?.ok?(g(!0),b(!1),v(``),e>=9&&rf()):a(t?.error||`We could not record that rating.`)}catch{a(`We could not reach the server. Please try again.`)}finally{m(!1)}}(0,l.useEffect)(()=>{if(!e){a(`This feedback link is not valid.`),r(!1);return}let n=!1;return(async()=>{try{let i=await(await fetch(`/api/portal/feedback/info?t=${encodeURIComponent(e)}`)).json();if(n)return;if(!i?.ok){a(i?.error||`This feedback link is not valid.`),r(!1);return}s(i),i.score!=null&&(u(i.score),g(!0)),r(!1),t!=null&&i.score==null&&document.visibilityState===`visible`?w(t):t!=null&&i.score==null&&u(t)}catch{n||(a(`We could not reach the server. Please try again.`),r(!1))}})(),()=>{n=!0}},[e]);async function T(){if(_.trim()){S(!0);try{(await C(`/api/portal/feedback/comment`,{message:_.trim()}))?.ok&&b(!0)}finally{S(!1)}}}let E={page:{minHeight:`100vh`,background:`linear-gradient(160deg,#0f172a 0%,#1e293b 100%)`,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`1.5rem`,fontFamily:`system-ui, -apple-system, Segoe UI, sans-serif`},card:{width:`100%`,maxWidth:480,background:`#fff`,borderRadius:16,boxShadow:`0 20px 50px rgba(0,0,0,0.35)`,overflow:`hidden`},head:{padding:`1.75rem 1.75rem 1.25rem`,borderBottom:`1px solid #f1f5f9`},body:{padding:`1.5rem 1.75rem 1.9rem`},note:{fontSize:`0.8125rem`,color:`#94a3b8`,textAlign:`center`,marginTop:`1rem`},btn:{padding:`0.7rem 1.1rem`,borderRadius:9,background:`#2563eb`,color:`#fff`,border:`none`,fontWeight:700,fontSize:`0.9rem`,cursor:`pointer`},ta:{width:`100%`,padding:`0.7rem 0.85rem`,borderRadius:9,border:`1px solid #cbd5e1`,fontSize:`0.95rem`,color:`#0f172a`,outline:`none`,boxSizing:`border-box`,resize:`vertical`,fontFamily:`inherit`}},D=e=>{let t=c===e;return{padding:`0.55rem 0`,borderRadius:8,cursor:d?`default`:`pointer`,background:t?`#2563eb`:`#fff`,color:t?`#fff`:`#0f172a`,border:`1px solid ${t?`#2563eb`:`#cbd5e1`}`,fontWeight:700,fontSize:`0.9rem`,textAlign:`center`}},O=(e,t)=>(0,f.jsx)(`div`,{style:E.page,children:(0,f.jsxs)(`div`,{style:{width:`100%`,maxWidth:480,display:`flex`,flexDirection:`column`,alignItems:`center`},children:[(0,f.jsx)(p,{style:{height:`2.8rem`,width:`auto`,color:`#ffffff`,marginBottom:`1.6rem`}}),(0,f.jsxs)(`div`,{style:E.card,children:[(0,f.jsxs)(`div`,{style:E.head,children:[(0,f.jsx)(`div`,{style:{fontSize:`1.6rem`,fontWeight:800,color:`#0f172a`},children:o?.firstname?`Thanks, ${o.firstname}`:`Your feedback`}),(0,f.jsx)(`div`,{style:{fontSize:`1rem`,color:`#64748b`,marginTop:`0.45rem`},children:t})]}),(0,f.jsx)(`div`,{style:E.body,children:e})]})]})});return n?O((0,f.jsx)(`div`,{style:{color:`#64748b`,fontSize:`0.9rem`},children:`Loadingâ¦`}
146),`One momentâ¦`):i&&!h?O((0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`div`,{style:{color:`#334155`,fontSize:`0.95rem`},children:i}),(0,f.jsxs)(`div`,{style:E.note,children:[`You can still rate us from your `,(0,f.jsx)(`a`,{href:`/`,style:{color:`#2563eb`},children:`client portal`}),`.`]})]}),`This link is no longer usable`):O((0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`div`,{style:{fontSize:`0.95rem`,fontWeight:600,color:`#0f172a`,marginBottom:`0.9rem`},children:`How likely are you to recommend us to a friend or colleague?`}),(0,f.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(11, 1fr)`,gap:4},children:Array.from({length:11},(e,t)=>(0,f.jsx)(`button`,{onClick:()=>w(t),disabled:d,"aria-pressed":c===t,style:D(t),children:t},t))}),(0,f.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,marginTop:6},children:[(0,f.jsx)(`span`,{style:{fontSize:`0.75rem`,color:`#94a3b8`},children:`Not likely`}),(0,f.jsx)(`span`,{style:{fontSize:`0.75rem`,color:`#94a3b8`},children:`Very likely`})]}),h&&(c>=9?(0,f.jsxs)(`div`,{style:{marginTop:`1.4rem`,textAlign:`center`},children:[(0,f.jsx)(`div`,{style:{fontSize:`1rem`,fontWeight:700,color:`#059669`},children:`Thank you! ð`}),(0,f.jsx)(`div`,{style:{fontSize:`0.85rem`,color:`#64748b`,marginTop:`0.35rem`},children:`We're glad you're enjoying working with us - it means a lot.`})]}):y?(0,f.jsxs)(`div`,{style:{marginTop:`1.4rem`,textAlign:`center`},children:[(0,f.jsx)(`div`,{style:{fontSize:`1rem`,fontWeight:700,color:`#0f172a`},children:`Thanks - we've shared this with our team.`}),(0,f.jsx)(`div`,{style:{fontSize:`0.85rem`,color:`#64748b`,marginTop:`0.35rem`},children:`Your comments go straight to the team who can act on them.`})]}):(0,f.jsxs)(`div`,{style:{marginTop:`1.4rem`},children:[(0,f.jsx)(`div`,{style:{fontSize:`0.9rem`,color:`#475569`,marginBottom:`0.55rem`},children:`Thanks for your honesty. What could we do to improve your score?`}),(0,f.jsx)(`textarea`,{value:_,onChange:e=>v(e.target.value),rows:4,placeholder:`Tell us what would make this betterâ¦`,style:E.ta}),(0,f.jsx)(`button`,{onClick:T,disabled:x||!_.trim(),style:{...E.btn,marginTop:`0.7rem`,...x||!_.trim()?{opacity:.6,cursor:`default`}:{}},children:x?`Sendingâ¦`:`Send feedback`})]})),h&&(0,f.jsx)(`div`,{style:E.note,children:`Changed your mind? Pick a different number - we'll keep the latest.`})]}),h?`You rated us ${c}/10`:`One question, one click`)}function Uh(){let[e,t]=(0,l.useState)(`lookup`),[n,r]=(0,l.useState)(``),[i,a]=(0,l.useState)(!1),[o,s]=(0,l.useState)(null),[c,u]=(0,l.useState)(null),[d,m]=(0,l.useState)(``),[h,g]=(0,l.useState)(``),[_,v]=(0,l.useState)(!1),[y,b]=(0,l.useState)(``),[x,S]=(0,l.useState)(!1),[C,w]=(0,l.useState)(null),T=(0,l.useRef)(null),E=(0,l.useRef)(null),D=(0,l.useRef)(null),O=(0,l.useRef)(null),k=c?Math.max(50,Math.round(c.amount*100)):0,A=e=>`$${Number(e||0).toFixed(2)}`;(0,l.useEffect)(()=>{let e=new URLSearchParams(window.location.search),t=(e.get(`ref`)||e.get(`invoice`)||``).trim();t&&(r(t),j(null,t))},[]);async function j(e,r){e?.preventDefault();let i=String(r??n).trim();if(!i||!/\d/.test(i)){s({type:`error`,text:`Please enter your invoice number â e.g. ND-952262 or 952262.`});return}a(!0),s(null);try{let e=await fetch(`/api/portal/pay-invoice/lookup`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({reference:i})}),n={type:`info`,text:`This invoice is unavailable for payment. Please contact support if you think this is a mistake.`},r=await e.json();if(!r.ok||!r.found){s(n);return}let a=r.invoiceNumber||i;if(!r.payable){s(n);return}if(!r.cardAvailable||!r.publishableKey){s({type:`error`,text:`Online card payment is unavailable right now. Please contact us to pay.`});return}u({id:r.invoiceId,number:a,amount:r.amount,total:r.total,status:r.status,publishableKey:r.publishableKey,testMode:r.testMode}),t(`pay`)}catch{s({type:`error`,text:`Something went wrong. Please try again.`})}finally{a(!1)}}(0,l.useEffect)(()=>{if(e!==`pay`||!c?.publishableKey)return;let t=!1,n=()=>{if(t)return!0;if(T.current)return S(!0),!0;if(window.Stripe)try{return T.current=window.Stripe(c.publishableKey),S(!0),!0}catch{}return!1};if(n())return;if(!document.querySelector(`script[src="https://js.stripe.com/v3/"]`)){let e=document.createElement(`script`);
146e.src=`https://js.stripe.com/v3/`,e.async=!0,document.head.appendChild(e)}let r=setInterval(()=>{n()&&clearInterval(r)},150),i=setTimeout(()=>{clearInterval(r),!t&&!T.current&&b(`The secure card form took too long to load. Please refresh the page and try again.`)},15e3);return()=>{t=!0,clearInterval(r),clearTimeout(i)}},[e,c]),(0,l.useEffect)(()=>{if(e!==`pay`||!x||!T.current)return;let t=O.current;if(!t)return;b(``);let n;try{n=T.current.elements({mode:`payment`,amount:k,currency:`aud`,appearance:{theme:`stripe`,variables:{colorPrimary:`#2563eb`,borderRadius:`8px`,fontFamily:`system-ui, sans-serif`}},paymentMethodTypes:[`card`]});let e=n.create(`payment`,{layout:{type:`tabs`,defaultCollapsed:!1},wallets:{applePay:`never`,googlePay:`never`}});e.on(`change`,e=>b(e.error?$u(e.error):``)),e.mount(t),E.current=n,D.current=e}catch{}return()=>{try{D.current?.unmount()}catch{}E.current=null,D.current=null}},[e,x,c?.id]);async function M(e){if(e?.preventDefault(),b(``),!d.trim()){b(`Please enter your name for the receipt.`);return}if(!/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(h.trim())){b(`Please enter a valid email address for the receipt.`);return}let n=E.current;if(!T.current||!n){b(`The payment form is still loading â please wait a moment and try again.`);return}v(!0);try{let{error:e}=await n.submit();if(e){b($u(e,`Please check your card details.`)),v(!1);return}let r=await(await fetch(`/api/portal/pay-invoice/create-intent`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({invoiceId:c.id})})).json();if(!r.ok){b(r.error||`Could not start the payment.`),v(!1);return}let{error:i,paymentIntent:a}=await T.current.confirmPayment({elements:n,clientSecret:r.clientSecret,confirmParams:{return_url:window.location.href},redirect:`if_required`});if(i){b($u(i)),v(!1);return}if(a?.status!==`succeeded`){b(`Payment not completed (${a?.status||`unknown`}). Please try again.`),v(!1);return}let o=await(await fetch(`/api/portal/pay-invoice/confirm`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({invoiceId:c.id,paymentIntentId:a.id,name:d.trim(),email:h.trim()})})).json();if(!o.ok){b(o.error||`Your payment went through but we could not confirm it â please contact support with your reference.`),v(!1);return}w(o),t(`done`)}catch(e){b($u(e))}finally{v(!1)}}let N={page:{minHeight:`100vh`,background:`linear-gradient(160deg,#0f172a 0%,#1e293b 100%)`,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`1.5rem`,fontFamily:`system-ui, -apple-system, Segoe UI, sans-serif`},card:{width:`100%`,maxWidth:440,background:`#fff`,borderRadius:16,boxShadow:`0 20px 50px rgba(0,0,0,0.35)`,overflow:`hidden`},head:{padding:`1.75rem 1.75rem 1.25rem`,borderBottom:`1px solid #f1f5f9`},body:{padding:`1.5rem 1.75rem 1.9rem`},label:{display:`block`,fontSize:`0.8125rem`,fontWeight:600,color:`#475569`,marginBottom:`0.4rem`},input:{width:`100%`,padding:`0.7rem 0.85rem`,borderRadius:9,border:`1px solid #cbd5e1`,fontSize:`0.95rem`,color:`#0f172a`,outline:`none`,boxSizing:`border-box`},btn:{width:`100%`,padding:`0.8rem`,borderRadius:9,background:`#2563eb`,color:`#fff`,border:`none`,fontWeight:700,fontSize:`0.95rem`,cursor:`pointer`},btnDis:{opacity:.6,cursor:`default`},note:{fontSize:`0.8125rem`,color:`#94a3b8`,textAlign:`center`,marginTop:`1rem`},link:{background:`none`,border:`none`,color:`#2563eb`,fontSize:`0.8125rem`,cursor:`pointer`,padding:0}},P=e=>({marginTop:`1rem`,padding:`0.7rem 0.9rem`,borderRadius:9,fontSize:`0.83rem`,background:e===`success`?`#ecfdf5`:e===`info`?`#f1f5f9`:`#fef2f2`,color:e===`success`?`#065f46`:e===`info`?`#334155`:`#991b1b`,border:`1px solid ${e===`success`?`#a7f3d0`:e===`info`?`#cbd5e1`:`#fecaca`}`});return(0,f.jsx)(`div`,{style:N.page,children:(0,f.jsxs)(`div`,{style:{width:`100%`,maxWidth:440,display:`flex`,flexDirection:`column`,alignItems:`center`},children:[(0,f.jsx)(p,{style:{height:`2.8rem`,width:`auto`,color:`#ffffff`,marginBottom:`1.6rem`}}),(0,f.jsxs)(`div`,{style:N.card,children:[(0,f.jsxs)(`div`,{style:N.head,children:[(0,f.jsx)(`div`,{style:{fontSize:`2rem`,fontWeight:800,color:`#0f172a`},children:`Pay an invoice`}),(0,f.jsx)(`div`,{style:{fontSize:`1.1rem`,color:`#64748b`,marginTop:`0.45rem`}
146,children:e===`done`?`Payment complete`:`Make a one-time card payment. Your card details are not saved.`})]}),(0,f.jsxs)(`div`,{style:N.body,children:[e===`lookup`&&(0,f.jsxs)(`form`,{onSubmit:j,children:[(0,f.jsx)(`label`,{style:N.label,htmlFor:`pi-num`,children:`Invoice number`}),(0,f.jsx)(`input`,{id:`pi-num`,style:N.input,autoFocus:!0,placeholder:`e.g. ND-123456 or 123456`,value:n,onChange:e=>r(e.target.value)}),(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,color:`#94a3b8`,marginTop:`0.35rem`},children:`You can enter it with or without the âND-â prefix.`}),(0,f.jsx)(`button`,{type:`submit`,style:{...N.btn,marginTop:`1.1rem`,...i?N.btnDis:{}},disabled:i,children:i?`Checkingâ¦`:`Continue`}),o&&(0,f.jsx)(`div`,{style:P(o.type),children:o.text}),(0,f.jsx)(`div`,{style:N.note,children:`One-time payment processed securely by Stripe. We do not see your credit card details.`})]}),e===`pay`&&c&&(0,f.jsxs)(`form`,{onSubmit:M,children:[(0,f.jsxs)(`div`,{style:{display:`flex`,alignItems:`baseline`,justifyContent:`space-between`,padding:`0.9rem 1rem`,background:`#f8fafc`,border:`1px solid #e2e8f0`,borderRadius:10,marginBottom:`1.25rem`},children:[(0,f.jsxs)(`div`,{children:[(0,f.jsxs)(`div`,{style:{fontSize:`0.8125rem`,color:`#64748b`},children:[`Invoice `,c.number]}),(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,color:`#94a3b8`},children:`Amount due`})]}),(0,f.jsxs)(`div`,{style:{textAlign:`right`},children:[(0,f.jsxs)(`div`,{style:{fontSize:`1.5rem`,fontWeight:800,color:`#0f172a`},children:[A(c.amount),` `,(0,f.jsx)(`span`,{style:{fontSize:`0.8125rem`,color:`#94a3b8`,fontWeight:600},children:`AUD`})]}),c.total!=null&&c.total-c.amount>.005&&(0,f.jsxs)(`div`,{style:{fontSize:`0.75rem`,color:`#64748b`,marginTop:2},children:[A(c.total),` invoiced, less `,A(c.total-c.amount),` already credited or paid`]})]})]}),c.testMode&&(0,f.jsx)(`div`,{style:{...P(`error`),marginTop:0,marginBottom:`1rem`,background:`#fffbeb`,color:`#92400e`,borderColor:`#fde68a`},children:`Test mode â use a Stripe test card.`}),(0,f.jsxs)(`div`,{style:{marginBottom:`0.9rem`},children:[(0,f.jsx)(`label`,{style:N.label,htmlFor:`pi-name`,children:`Your name (for the receipt)`}),(0,f.jsx)(`input`,{id:`pi-name`,style:N.input,value:d,onChange:e=>m(e.target.value),placeholder:`Full name`,autoComplete:`name`})]}),(0,f.jsxs)(`div`,{style:{marginBottom:`1.1rem`},children:[(0,f.jsx)(`label`,{style:N.label,htmlFor:`pi-email`,children:`Email (receipt sent here)`}),(0,f.jsx)(`input`,{id:`pi-email`,style:N.input,type:`email`,value:h,onChange:e=>g(e.target.value),placeholder:`[email protected]`,autoComplete:`email`})]}),(0,f.jsx)(`label`,{style:N.label,children:`Card details`}),(0,f.jsxs)(`div`,{style:{padding:`0.15rem 0`,minHeight:44},children:[(0,f.jsx)(`div`,{ref:O}),!x&&(0,f.jsx)(`div`,{style:{fontSize:`0.8125rem`,color:`#94a3b8`},children:`Loading secure card formâ¦`})]}),y&&(0,f.jsx)(`div`,{style:P(`error`),children:y}),(0,f.jsx)(`button`,{type:`submit`,style:{...N.btn,marginTop:`1.2rem`,..._?N.btnDis:{}},disabled:_,children:_?`Processingâ¦`:`Pay ${A(c.amount)}`}),(0,f.jsx)(`div`,{style:{textAlign:`center`,marginTop:`0.9rem`},children:(0,f.jsx)(`button`,{type:`button`,style:N.link,onClick:()=>{t(`lookup`),u(null),S(!1),b(``)},children:`â Pay a different invoice`})}),(0,f.jsx)(`div`,{style:N.note,children:`One-time payment · Secured by Stripe · Your card details are not saved.`})]}),e===`done`&&C&&(0,f.jsxs)(`div`,{style:{textAlign:`center`},children:[(0,f.jsx)(`div`,{style:{width:56,height:56,borderRadius:`50%`,background:`#dcfce7`,color:`#16a34a`,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:`1.8rem`,margin:`0.5rem auto 1rem`},children:`â`}),(0,f.jsx)(`div`,{style:{fontSize:`1.1rem`,fontWeight:800,color:`#0f172a`},children:`Payment received`}),(0,f.jsxs)(`div`,{style:{fontSize:`0.9rem`,color:`#475569`,marginTop:`0.4rem`},children:[`Thank you â your payment of `,(0,f.jsxs)(`strong`,{children:[A(C.amount),` AUD`]}),` for invoice `,c?.number||`#${C.invoiceId}`,` has been processed.`]}),(0,f.jsx)(`div`,{style:{fontSize:`0.82rem`,color:`#64748b`,marginTop:`0.8rem`},children:C.receiptSent?(0,f.jsxs)(f.Fragment,{children:[`A receipt has been emailed to `,(0,f.jsx)(`strong`,{children:h}),`.`]}):(0,f.jsx)(f.Fragment,{children:`Your payment succeeded. Please keep your reference below for your records.`})}),(0,f.jsxs)(`div`,{style:{fontSize:`0.8125rem`,color:`#94a3b8`,marginTop:`0.8rem`,fontFamily:`monospace`},children:[`Ref: `,C.transactionId]}),(0,f.jsx)(`button`,{type:`button`,style:{...N.btn,marginTop:`1.4rem`},onClick:()=>{t(`lookup`),u(null),w(null),r(``),m(``),g(``),S(!1)},children:`Pay another invoice`})]})]})]}),(0,f.jsxs)(`div`,{style:{marginTop:`1.5rem`,color:`#ffffff`,fontSize:`0.9rem`,opacity:.85},children:[`Visit `,(0,f.jsx)(`a`,{href:`https://networkdynamics.com`,style:{color:`#ffffff`,textDecoration:`underline`},children:`networkdynamics.com`}),` `,`or `,(0,f.jsx)(`a`,{href:`/`,style:{color:`#ffffff`,textDecoration:`underline`},children:`login`})]})]})})}function Wh(){let[e,t]=(0,l.useState)(null),[n,r]=(0,l.useState)(!0),[i,a]=(0,l.useState)(!1),[o,s]=(0,l.useState)(!1),[c,u]=(0,l.useState)(!1),[d,p]=(0,l.useState)(null),[m,h]=(0,l.useState)(null),[g,_]=(0,l.useState)(null),[v,y]=(0,l.useState)(null),[b,x]=(0,l.useState)(null),[S,C]=(0,l.useState)(null),[w,T]=(0,l.useState)(null),[E,D]=(0,l.useState)(null),[O,k]=(0,l.useState)(``),[A,j]=(0,l.useState)(null);(0,l.useEffect)(()=>{fetch(`/api/portal/config`).then(e=>e.json()).then(e=>{if(e.primaryColor&&/^#[0-9a-fA-F]{6}$/.test(e.primaryColor)){document.documentElement.style.setProperty(`--accent`,e.primaryColor);let t=e.primaryColor.slice(1),n=parseInt(t.slice(0,2),16),r=parseInt(t.slice(2,4),16),i=parseInt(t.slice(4,6),16);document.documentElement.style.setProperty(`--bg-hover`,`rgba(${n},${r},${i},0.06)`),document.documentElement.style.setProperty(`--bg-active`,`rgba(${n},${r},${i},0.12)`)}e.gcAvailable&&a(!0),e.ppAvailable&&s(!0),e.payToAvailable&&u(!0),e.bpay&&p(e.bpay),j(e.maintenance||{enabled:!1,announcement:``})}).catch(()=>j({enabled:!1,announcement:``}));let e=new URLSearchParams(window.location.search);if(window.location.hash&&window.location.hash.length>1){let e=new URLSearchParams(window.location.hash.slice(1)),t=e.get(`token`),n=e.get(`linked`),r=e.get(`error`),i=e.get(`transfer`);
146if(i){try{sessionStorage.removeItem(`portal:pending-transfer`)}catch{}h({tab:`account`,subTab:`transfer`,focusTransferId:i}),window.history.replaceState({},``,window.location.pathname)}else t?(localStorage.setItem(hl,t),localStorage.removeItem(`crm:portal:origin-token`),localStorage.removeItem(`crm:portal:origin-client`),window.history.replaceState({},``,window.location.pathname)):n?(sessionStorage.setItem(`portal:identity_linked`,n),h({tab:`security`}),window.history.replaceState({},``,window.location.pathname)):r&&(k(Hd(r)),window.history.replaceState({},``,window.location.pathname))}let n=e.get(`pp_session`),i=e.get(`token`);i&&!n&&(localStorage.setItem(hl,i),localStorage.removeItem(`crm:portal:origin-token`),localStorage.removeItem(`crm:portal:origin-client`),window.history.replaceState({},``,window.location.pathname));let o=sd()?null:e.get(`ref`);if(o){fetch(`/api/portal/ref?slug=${encodeURIComponent(o)}`).then(e=>e.json()).then(e=>{e.redirect&&(window.location.href=e.redirect)}).catch(()=>{});return}let c=e.get(`transfer`)||sessionStorage.getItem(`portal:transfer-link`);c&&(e.get(`transfer`)&&window.history.replaceState({},``,window.location.pathname),sessionStorage.setItem(`portal:transfer-link`,c),C(c),fetch(`/api/portal/transfer/info?token=${encodeURIComponent(c)}`).then(e=>e.json()).then(e=>{e.ok?T(e):(sessionStorage.removeItem(`portal:transfer-link`),C(null),D(e.error||`This transfer link is no longer valid.`))}).catch(()=>{sessionStorage.removeItem(`portal:transfer-link`),C(null)}));let l=e.get(`invite`);if(l)window.history.replaceState({},``,window.location.pathname),sessionStorage.setItem(`portal:pending-invite`,l),_(l),fetch(`/api/portal/invite/info?token=${encodeURIComponent(l)}`).then(e=>e.json()).then(e=>{e.ok?y(e):x(e.error||`Invalid invite`)}).catch(()=>x(`Could not load invite`));else{let e=sessionStorage.getItem(`portal:pending-invite`);e&&(_(e),fetch(`/api/portal/invite/info?token=${encodeURIComponent(e)}`).then(e=>e.json()).then(e=>{e.ok?y(e):(sessionStorage.removeItem(`portal:pending-invite`),_(null))}).catch(()=>{sessionStorage.removeItem(`portal:pending-invite`),_(null)}))}let d=e.get(`redirect_flow_id`),f=e.get(`gc_session`),m=e.get(`gc_label`)||``,g=e.get(`pp_session`),v=g?sessionStorage.getItem(`portal:pp_ba_token`)||e.get(`ba_token`):null,b=sessionStorage.getItem(`portal:pp_label`)||e.get(`pp_label`)||``,S=e.get(`pp_cancelled`);ud().then(()=>{if(!localStorage.getItem(`crm:portal:token`)){r(!1);return}Z(`/api/portal/me`).then(async e=>{if(e.ok){if(t(e.client),d&&f&&(window.history.replaceState({},``,window.location.pathname),(await Z(`/api/portal/gocardless/complete`,{method:`POST`,body:JSON.stringify({redirect_flow_id:d,session_token:f,label:m})})).ok&&(sessionStorage.setItem(`portal:gc_success`,`1`),h({tab:`account`,subTab:`payment`}))),v&&g){window.history.replaceState({},``,window.location.pathname);let e=sessionStorage.getItem(`portal:pp_session`)||g;sessionStorage.removeItem(`portal:pp_ba_token`),sessionStorage.removeItem(`portal:pp_session`),sessionStorage.removeItem(`portal:pp_label`);let t=await Z(`/api/portal/paypal/complete`,{method:`POST`,body:JSON.stringify({ba_token:v,session_token:e,label:b})});t.ok?(sessionStorage.setItem(`portal:pp_success`,`1`),h({tab:`account`,subTab:`payment`})):(console.error(`[PayPal complete] failed:`,t),sessionStorage.setItem(`portal:pp_error`,t.error||`PayPal setup failed. Please try again.`),h({tab:`account`,subTab:`payment`}))}S&&(window.history.replaceState({},``,window.location.pathname),h({tab:`account`,subTab:`payment`}))}else localStorage.removeItem(hl);r(!1)}).catch(()=>{localStorage.removeItem(hl),r(!1)})})},[]),(0,l.useEffect)(()=>{let t=cd(localStorage.getItem(hl));Za(e,{impersonation:t?.imp?{staff:t.staff||null}:null,loginEmail:t?.loginEmail||null})},[e]);function M(e){localStorage.removeItem(`crm:portal:origin-token`),localStorage.removeItem(`crm:portal:origin-client`),t(e),sessionStorage.getItem(`portal:pending-invite`)&&sessionStorage.removeItem(`portal:pending-invite`)}function N(){Z(`/api/portal/logout`,{method:`POST`}).catch(()=>{}),localStorage.removeItem(hl),localStorage.removeItem(`crm:portal:origin-token`),localStorage.removeItem(`crm:portal:origin-client`),localStorage.removeItem(`portal:theme`),sessionStorage.removeItem(`portal:pending-invite`),t(null),_(null),y(null)}(0,l.useEffect)(()=>{e&&S&&w&&(sessionStorage.removeItem(`portal:transfer-link`),h({tab:`account`,subTab:`transfer`}),C(null),T(null))},[e,S,w]);function P(e,n){sessionStorage.removeItem(`portal:pending-invite`),_(null),y(null),localStorage.setItem(hl,n),t(e)}return typeof window<`u`&&od()===`/feedback`?(0,f.jsx)(Hh,{}):typeof window<`u`&&od()===`/pay-invoice`?(0,f.jsx)(Uh,{}):n?(0,f.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-canvas`,children:(0,f.jsx)(`div`,{className:`text-sm text-muted`,children:`Loadingâ¦`})}):S&&w&&!e&&!w.userExists?(0,f.jsx)(ph,{token:S,info:w,onSignedUp:(e,n)=>{sessionStorage.removeItem(`portal:transfer-link`),C(null),T(null),localStorage.setItem(hl,n),h({tab:`account`,subTab:`transfer`}),t(e)}}):g&&v&&!e&&!v.userExists?(0,f.jsx)(fh,{inviteToken:g,inviteInfo:v,onAccepted:(e,t)=>P(e,t)}):e?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(Vh,{client:e,setClient:t,onLogout:N,gcAvailable:i,ppAvailable:o,payToAvailable:c,bpay:d,pendingNav:m}),g&&v&&(0,f.jsx)(mh,{inviteToken:g,inviteInfo:v,onAccepted:n=>{sessionStorage.removeItem(`portal:pending-invite`),_(null),y(null),n.id!==e.id&&(localStorage.setItem(`crm:portal:token`,makeToken(n.id,n.email)),t(n))},onDismiss:()=>{sessionStorage.removeItem(`portal:pending-invite`),_(null),y(null)}})]}):A===null?(0,f.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-canvas`,children:(0,f.jsx)(`div`,{className:`text-sm text-muted`,children:`Loadingâ¦`})}):A.enabled?(0,f.jsx)(Wd,{announcement:A.announcement}):(0,f.jsx)(Ud,{onLogin:M,inviteInfo:g&&v?v:null,authError:O||E})}var Gh=[`/pay-invoice`,`/feedback`],Kh=/^(utm_[a-z_]+|gclid|gbraid|wbraid|dclid|fbclid|msclkid|li_fat_id|ttclid|twclid|_gl|github|stripe_connect)$/i,qh=()=>window.location.pathname.replace(/\/+$/,``);function Jh(){if(window.location.hash.length>1)return!1;for(let e of new URLSearchParams(window.location.search).keys())if(!Kh.test(e))return!1;return!0}function Yh(){try{let e=localStorage.getItem(`crm:portal:token`)||``,t=e.lastIndexOf(`.`);return!!JSON.parse(atob(t>0?e.slice(0,t):e))?.imp}catch{return!1}}
146function Xh(e,t,n){let r=document.createElement(`script`);for(let t of e.attributes)r.setAttribute(t.name,t.value);r.text=e.textContent,r.setAttribute(`data-snippet`,String(n));let i=(e.getAttribute(`type`)||``).toLowerCase(),a=!i||/^(text|application)\/(java|ecma)script$/.test(i);return e.hasAttribute(`src`)&&a&&!e.hasAttribute(`async`)&&!e.hasAttribute(`defer`)?(r.async=!1,new Promise(e=>{let n=()=>{clearTimeout(i),e()},i=setTimeout(e,1e4);r.onload=n,r.onerror=n,t(r)})):(t(r),Promise.resolve())}async function Zh({id:e,placement:t,code:n}){let r=t===`body`?document.body:document.head,i=document.createElement(`template`);i.innerHTML=n;for(let t of[...i.content.childNodes]){if(t.nodeName===`SCRIPT`){await Xh(t,e=>r.appendChild(e),e);continue}if(r.appendChild(t),t.nodeType===Node.ELEMENT_NODE){t.setAttribute(`data-snippet`,String(e));for(let n of[...t.querySelectorAll(`script`)])await Xh(n,e=>n.replaceWith(e),e)}}}var Qh=!1;function $h(){if(Qh||typeof window>`u`||Gh.includes(qh()))return;Qh=!0;let e=async()=>{if(Yh())return;let e=[];try{e=(await(await fetch(`/api/portal/snippets`,{credentials:`omit`})).json())?.snippets||[]}catch{return}for(let t of e)try{await Zh(t)}catch(e){console.warn(`[snippets] failed to inject`,t.id,e)}};if(Jh()){e();return}let t=Date.now(),n=setInterval(()=>{if(Gh.includes(qh())||Date.now()-t>12e4){clearInterval(n);return}Jh()&&(clearInterval(n),e())},500)}window.location.pathname.replace(/\/+$/,``)!==`/feedback`&&Xa(),$h();try{sessionStorage.removeItem(`portal:stale-reload`)}catch{}(0,u.createRoot)(document.getElementById(`root`)).render((0,f.jsx)(l.StrictMode,{children:(0,f.jsx)(Wh,{})}));
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.