@lamalibre/create-lamaste 4.3.0 → 4.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/scripts/bundle-vendor.js +13 -8
- package/src/index.js +4 -0
- package/src/lib/panel-pin.js +41 -0
- package/vendor/docs/00-introduction/how-it-works.md +2 -2
- package/vendor/docs/00-introduction/quickstart.md +5 -5
- package/vendor/docs/00-introduction/what-is-lamaste.md +5 -5
- package/vendor/docs/01-concepts/certificates.md +3 -3
- package/vendor/docs/01-concepts/mtls.md +2 -2
- package/vendor/docs/01-concepts/security-model.md +13 -2
- package/vendor/docs/01-concepts/tickets.md +2 -2
- package/vendor/docs/01-concepts/tunneling.md +4 -4
- package/vendor/docs/02-guides/agent-setup.md +5 -5
- package/vendor/docs/02-guides/certificate-management.md +2 -2
- package/vendor/docs/02-guides/cloud-provisioning.md +4 -4
- package/vendor/docs/02-guides/desktop-app-setup.md +11 -10
- package/vendor/docs/02-guides/installation.md +3 -3
- package/vendor/docs/02-guides/onboarding.md +2 -2
- package/vendor/docs/02-guides/standalone-plugin-with-tickets.md +2 -2
- package/vendor/docs/03-architecture/installer-flow.md +2 -2
- package/vendor/docs/03-architecture/installer.md +4 -4
- package/vendor/docs/03-architecture/management-flow.md +1 -1
- package/vendor/docs/03-architecture/overview.md +5 -5
- package/vendor/docs/03-architecture/panel-client.md +6 -6
- package/vendor/docs/03-architecture/panel-server.md +2 -2
- package/vendor/docs/03-architecture/state-management.md +2 -2
- package/vendor/docs/03-architecture/system-overview.md +1 -1
- package/vendor/docs/04-api-reference/agent-hosted-plugins.md +2 -2
- package/vendor/docs/04-api-reference/app-host.md +3 -3
- package/vendor/docs/04-api-reference/lifecycle-hooks.md +4 -4
- package/vendor/docs/04-api-reference/onboarding.md +1 -1
- package/vendor/docs/04-api-reference/registry-and-oidc.md +1 -1
- package/vendor/docs/05-operations/backup-and-restore.md +3 -1
- package/vendor/docs/05-operations/uninstalling.md +1 -1
- package/vendor/docs/05-operations/upgrades.md +5 -5
- package/vendor/docs/06-reference/config-files.md +6 -1
- package/vendor/docs/06-reference/glossary.md +3 -3
- package/vendor/docs/06-reference/installer-flags.md +13 -13
- package/vendor/docs/06-reference/ports-and-services.md +1 -1
- package/vendor/docs/06-reference/troubleshooting.md +8 -8
- package/vendor/docs/gatekeeper-design.md +8 -8
- package/vendor/docs/identity-directory-design.md +2 -2
- package/vendor/docs/package.json +1 -1
- package/vendor/docs/todo/lib-cli-desktop-refactor.md +27 -27
- package/vendor/gatekeeper/dist/cli/index.js +0 -0
- package/vendor/gatekeeper/package.json +2 -2
- package/vendor/server/bin/lamaste-server.js +7 -0
- package/vendor/server/package.json +2 -2
- package/vendor/server/src/commands/panel-pin.js +40 -0
- package/vendor/server/src/panel-api.js +247 -32
- package/vendor/server/src/panel-identity.js +165 -0
- package/vendor/server-ui/dist/assets/index-BTlBt_cD.js +84 -0
- package/vendor/server-ui/dist/index.html +1 -1
- package/vendor/serverd/package.json +2 -2
- package/vendor/server-ui/dist/assets/index-DBp3cmaU.js +0 -84
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));(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 l=o((e=>{var t=Symbol.for(`react.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.provider`),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.iterator;function p(e){return typeof e!=`object`||!e?null:(e=f&&e[f]||e[`@@iterator`],typeof e==`function`?e:null)}var m={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},h=Object.assign,g={};function _(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}_.prototype.isReactComponent={},_.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`setState(...): 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`)},_.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function v(){}v.prototype=_.prototype;function y(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}var b=y.prototype=new v;b.constructor=y,h(b,_.prototype),b.isPureReactComponent=!0;var x=Array.isArray,S=Object.prototype.hasOwnProperty,C={current:null},w={key:!0,ref:!0,__self:!0,__source:!0};function T(e,n,r){var i,a={},o=null,s=null;if(n!=null)for(i in n.ref!==void 0&&(s=n.ref),n.key!==void 0&&(o=``+n.key),n)S.call(n,i)&&!w.hasOwnProperty(i)&&(a[i]=n[i]);var c=arguments.length-2;if(c===1)a.children=r;else if(1<c){for(var l=Array(c),u=0;u<c;u++)l[u]=arguments[u+2];a.children=l}if(e&&e.defaultProps)for(i in c=e.defaultProps,c)a[i]===void 0&&(a[i]=c[i]);return{$$typeof:t,type:e,key:o,ref:s,props:a,_owner:C.current}}function E(e,n){return{$$typeof:t,type:e.type,key:n,ref:e.ref,props:e.props,_owner:e._owner}}function D(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function ee(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var te=/\/+/g;function ne(e,t){return typeof e==`object`&&e&&e.key!=null?ee(``+e.key):t.toString(36)}function re(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`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0}}if(c)return c=e,o=o(c),e=a===``?`.`+ne(c,0):a,x(o)?(i=``,e!=null&&(i=e.replace(te,`$&/`)+`/`),re(o,r,i,``,function(e){return e})):o!=null&&(D(o)&&(o=E(o,i+(!o.key||c&&c.key===o.key?``:(``+o.key).replace(te,`$&/`)+`/`)+e)),r.push(o)),1;if(c=0,a=a===``?`.`:a+`:`,x(e))for(var l=0;l<e.length;l++){s=e[l];var u=a+ne(s,l);c+=re(s,r,i,u,o)}else if(u=p(e),typeof u==`function`)for(e=u.call(e),l=0;!(s=e.next()).done;)s=s.value,u=a+ne(s,l++),c+=re(s,r,i,u,o);else if(s===`object`)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 ie(e,t,n){if(e==null)return e;var r=[],i=0;return re(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function ae(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 oe={current:null},se={transition:null},ce={ReactCurrentDispatcher:oe,ReactCurrentBatchConfig:se,ReactCurrentOwner:C};function le(){throw Error(`act(...) is not supported in production builds of React.`)}e.Children={map:ie,forEach:function(e,t,n){ie(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return ie(e,function(){t++}),t},toArray:function(e){return ie(e,function(e){return e})||[]},only:function(e){if(!D(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}},e.Component=_,e.Fragment=r,e.Profiler=a,e.PureComponent=y,e.StrictMode=i,e.Suspense=l,e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ce,e.act=le,e.cloneElement=function(e,n,r){if(e==null)throw Error(`React.cloneElement(...): The argument must be a React element, but you passed `+e+`.`);var i=h({},e.props),a=e.key,o=e.ref,s=e._owner;if(n!=null){if(n.ref!==void 0&&(o=n.ref,s=C.current),n.key!==void 0&&(a=``+n.key),e.type&&e.type.defaultProps)var c=e.type.defaultProps;for(l in n)S.call(n,l)&&!w.hasOwnProperty(l)&&(i[l]=n[l]===void 0&&c!==void 0?c[l]:n[l])}var l=arguments.length-2;if(l===1)i.children=r;else if(1<l){c=Array(l);for(var u=0;u<l;u++)c[u]=arguments[u+2];i.children=c}return{$$typeof:t,type:e.type,key:a,ref:o,props:i,_owner:s}},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:o,_context:e},e.Consumer=e},e.createElement=T,e.createFactory=function(e){var t=T.bind(null,e);return t.type=e,t},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=D,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:ae}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=se.transition;se.transition={};try{e()}finally{se.transition=t}},e.unstable_act=le,e.useCallback=function(e,t){return oe.current.useCallback(e,t)},e.useContext=function(e){return oe.current.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e){return oe.current.useDeferredValue(e)},e.useEffect=function(e,t){return oe.current.useEffect(e,t)},e.useId=function(){return oe.current.useId()},e.useImperativeHandle=function(e,t,n){return oe.current.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return oe.current.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return oe.current.useLayoutEffect(e,t)},e.useMemo=function(e,t){return oe.current.useMemo(e,t)},e.useReducer=function(e,t,n){return oe.current.useReducer(e,t,n)},e.useRef=function(e){return oe.current.useRef(e)},e.useState=function(e){return oe.current.useState(e)},e.useSyncExternalStore=function(e,t,n){return oe.current.useSyncExternalStore(e,t,n)},e.useTransition=function(){return oe.current.useTransition()},e.version=`18.3.1`})),u=o(((e,t)=>{t.exports=l()})),d=o((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(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=typeof setTimeout==`function`?setTimeout:null,_=typeof clearTimeout==`function`?clearTimeout:null,v=typeof setImmediate<`u`?setImmediate:null;typeof navigator<`u`&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(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 b(e){if(h=!1,y(e),!m)if(n(c)!==null)m=!0,ie(x);else{var t=n(l);t!==null&&ae(b,t.startTime-e)}}function x(t,i){m=!1,h&&(h=!1,_(w),w=-1),p=!0;var a=f;try{for(y(i),d=n(c);d!==null&&(!(d.expirationTime>i)||t&&!D());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=i);i=e.unstable_now(),typeof s==`function`?d.callback=s:d===n(c)&&r(c),y(i)}else r(c);d=n(c)}if(d!==null)var u=!0;else{var g=n(l);g!==null&&ae(b,g.startTime-i),u=!1}return u}finally{d=null,f=a,p=!1}}var S=!1,C=null,w=-1,T=5,E=-1;function D(){return!(e.unstable_now()-E<T)}function ee(){if(C!==null){var t=e.unstable_now();E=t;var n=!0;try{n=C(!0,t)}finally{n?te():(S=!1,C=null)}}else S=!1}var te;if(typeof v==`function`)te=function(){v(ee)};else if(typeof MessageChannel<`u`){var ne=new MessageChannel,re=ne.port2;ne.port1.onmessage=ee,te=function(){re.postMessage(null)}}else te=function(){g(ee,0)};function ie(e){C=e,S||(S=!0,te())}function ae(t,n){w=g(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_continueExecution=function(){m||p||(m=!0,ie(x))},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`):T=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return n(c)},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_pauseExecution=function(){},e.unstable_requestPaint=function(){},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?(_(w),w=-1):h=!0,ae(b,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,ie(x))),r},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),f=o(((e,t)=>{t.exports=d()})),p=o((e=>{var t=u(),n=f();function r(e){for(var t=`https://reactjs.org/docs/error-decoder.html?invariant=`+e,n=1;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.`}var i=new Set,a={};function o(e,t){s(e,t),s(e+`Capture`,t)}function s(e,t){for(a[e]=t,e=0;e<t.length;e++)i.add(t[e])}var c=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),l=Object.prototype.hasOwnProperty,d=/^[: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][: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]*$/,p={},m={};function h(e){return l.call(m,e)?!0:l.call(p,e)?!1:d.test(e)?m[e]=!0:(p[e]=!0,!1)}function g(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case`function`:case`symbol`:return!0;case`boolean`:return r?!1:n===null?(e=e.toLowerCase().slice(0,5),e!==`data-`&&e!==`aria-`):!n.acceptsBooleans;default:return!1}}function _(e,t,n,r){if(t==null||g(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function v(e,t,n,r,i,a,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=o}var y={};`children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style`.split(` `).forEach(function(e){y[e]=new v(e,0,!1,e,null,!1,!1)}),[[`acceptCharset`,`accept-charset`],[`className`,`class`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`]].forEach(function(e){var t=e[0];y[t]=new v(t,1,!1,e[1],null,!1,!1)}),[`contentEditable`,`draggable`,`spellCheck`,`value`].forEach(function(e){y[e]=new v(e,2,!1,e.toLowerCase(),null,!1,!1)}),[`autoReverse`,`externalResourcesRequired`,`focusable`,`preserveAlpha`].forEach(function(e){y[e]=new v(e,2,!1,e,null,!1,!1)}),`allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope`.split(` `).forEach(function(e){y[e]=new v(e,3,!1,e.toLowerCase(),null,!1,!1)}),[`checked`,`multiple`,`muted`,`selected`].forEach(function(e){y[e]=new v(e,3,!0,e,null,!1,!1)}),[`capture`,`download`].forEach(function(e){y[e]=new v(e,4,!1,e,null,!1,!1)}),[`cols`,`rows`,`size`,`span`].forEach(function(e){y[e]=new v(e,6,!1,e,null,!1,!1)}),[`rowSpan`,`start`].forEach(function(e){y[e]=new v(e,5,!1,e.toLowerCase(),null,!1,!1)});var b=/[\-:]([a-z])/g;function x(e){return e[1].toUpperCase()}`accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height`.split(` `).forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,null,!1,!1)}),`xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type`.split(` `).forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,`http://www.w3.org/1999/xlink`,!1,!1)}),[`xml:base`,`xml:lang`,`xml:space`].forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,`http://www.w3.org/XML/1998/namespace`,!1,!1)}),[`tabIndex`,`crossOrigin`].forEach(function(e){y[e]=new v(e,1,!1,e.toLowerCase(),null,!1,!1)}),y.xlinkHref=new v(`xlinkHref`,1,!1,`xlink:href`,`http://www.w3.org/1999/xlink`,!0,!1),[`src`,`href`,`action`,`formAction`].forEach(function(e){y[e]=new v(e,1,!1,e.toLowerCase(),null,!0,!0)});function S(e,t,n,r){var i=y.hasOwnProperty(t)?y[t]:null;(i===null?r||!(2<t.length)||t[0]!==`o`&&t[0]!==`O`||t[1]!==`n`&&t[1]!==`N`:i.type!==0)&&(_(t,n,i,r)&&(n=null),r||i===null?h(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,``+n)):i.mustUseProperty?e[i.propertyName]=n===null?i.type===3?!1:``:n:(t=i.attributeName,r=i.attributeNamespace,n===null?e.removeAttribute(t):(i=i.type,n=i===3||i===4&&!0===n?``:``+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var C=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,w=Symbol.for(`react.element`),T=Symbol.for(`react.portal`),E=Symbol.for(`react.fragment`),D=Symbol.for(`react.strict_mode`),ee=Symbol.for(`react.profiler`),te=Symbol.for(`react.provider`),ne=Symbol.for(`react.context`),re=Symbol.for(`react.forward_ref`),ie=Symbol.for(`react.suspense`),ae=Symbol.for(`react.suspense_list`),oe=Symbol.for(`react.memo`),se=Symbol.for(`react.lazy`),ce=Symbol.for(`react.offscreen`),le=Symbol.iterator;function ue(e){return typeof e!=`object`||!e?null:(e=le&&e[le]||e[`@@iterator`],typeof e==`function`?e:null)}var O=Object.assign,de;function k(e){if(de===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);de=t&&t[1]||``}return`
|
|
2
|
+
`+de+e}var fe=!1;function pe(e,t){if(!e||fe)return``;fe=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,`props`,{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(t,[])}catch(e){var r=e}Reflect.construct(e,[],t)}else{try{t.call()}catch(e){r=e}e.call(t.prototype)}else{try{throw Error()}catch(e){r=e}e()}}catch(t){if(t&&r&&typeof t.stack==`string`){for(var i=t.stack.split(`
|
|
3
|
+
`),a=r.stack.split(`
|
|
4
|
+
`),o=i.length-1,s=a.length-1;1<=o&&0<=s&&i[o]!==a[s];)s--;for(;1<=o&&0<=s;o--,s--)if(i[o]!==a[s]){if(o!==1||s!==1)do if(o--,s--,0>s||i[o]!==a[s]){var c=`
|
|
5
|
+
`+i[o].replace(` at new `,` at `);return e.displayName&&c.includes(`<anonymous>`)&&(c=c.replace(`<anonymous>`,e.displayName)),c}while(1<=o&&0<=s);break}}}finally{fe=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:``)?k(e):``}function me(e){switch(e.tag){case 5:return k(e.type);case 16:return k(`Lazy`);case 13:return k(`Suspense`);case 19:return k(`SuspenseList`);case 0:case 2:case 15:return e=pe(e.type,!1),e;case 11:return e=pe(e.type.render,!1),e;case 1:return e=pe(e.type,!0),e;default:return``}}function he(e){if(e==null)return null;if(typeof e==`function`)return e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case E:return`Fragment`;case T:return`Portal`;case ee:return`Profiler`;case D:return`StrictMode`;case ie:return`Suspense`;case ae:return`SuspenseList`}if(typeof e==`object`)switch(e.$$typeof){case ne:return(e.displayName||`Context`)+`.Consumer`;case te:return(e._context.displayName||`Context`)+`.Provider`;case re:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case oe:return t=e.displayName||null,t===null?he(e.type)||`Memo`:t;case se:t=e._payload,e=e._init;try{return he(e(t))}catch{}}return null}function ge(e){var t=e.type;switch(e.tag){case 24:return`Cache`;case 9:return(t.displayName||`Context`)+`.Consumer`;case 10:return(t._context.displayName||`Context`)+`.Provider`;case 18:return`DehydratedFragment`;case 11:return e=t.render,e=e.displayName||e.name||``,t.displayName||(e===``?`ForwardRef`:`ForwardRef(`+e+`)`);case 7:return`Fragment`;case 5:return t;case 4:return`Portal`;case 3:return`Root`;case 6:return`Text`;case 16:return he(t);case 8:return t===D?`StrictMode`:`Mode`;case 22:return`Offscreen`;case 12:return`Profiler`;case 21:return`Scope`;case 13:return`Suspense`;case 19:return`SuspenseList`;case 25:return`TracingMarker`;case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t==`function`)return t.displayName||t.name||null;if(typeof t==`string`)return t}return null}function _e(e){switch(typeof e){case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function ve(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function ye(e){var t=ve(e)?`checked`:`value`,n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=``+e[t];if(!e.hasOwnProperty(t)&&n!==void 0&&typeof n.get==`function`&&typeof n.set==`function`){var i=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){r=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function be(e){e._valueTracker||=ye(e)}function xe(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=ve(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function Se(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function Ce(e,t){var n=t.checked;return O({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function we(e,t){var n=t.defaultValue==null?``:t.defaultValue,r=t.checked==null?t.defaultChecked:t.checked;n=_e(t.value==null?n:t.value),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type===`checkbox`||t.type===`radio`?t.checked!=null:t.value!=null}}function Te(e,t){t=t.checked,t!=null&&S(e,`checked`,t,!1)}function Ee(e,t){Te(e,t);var n=_e(t.value),r=t.type;if(n!=null)r===`number`?(n===0&&e.value===``||e.value!=n)&&(e.value=``+n):e.value!==``+n&&(e.value=``+n);else if(r===`submit`||r===`reset`){e.removeAttribute(`value`);return}t.hasOwnProperty(`value`)?Oe(e,t.type,n):t.hasOwnProperty(`defaultValue`)&&Oe(e,t.type,_e(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function De(e,t,n){if(t.hasOwnProperty(`value`)||t.hasOwnProperty(`defaultValue`)){var r=t.type;if(!(r!==`submit`&&r!==`reset`||t.value!==void 0&&t.value!==null))return;t=``+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==``&&(e.name=``),e.defaultChecked=!!e._wrapperState.initialChecked,n!==``&&(e.name=n)}function Oe(e,t,n){(t!==`number`||Se(e.ownerDocument)!==e)&&(n==null?e.defaultValue=``+e._wrapperState.initialValue:e.defaultValue!==``+n&&(e.defaultValue=``+n))}var ke=Array.isArray;function Ae(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=``+_e(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 je(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(r(91));return O({},t,{value:void 0,defaultValue:void 0,children:``+e._wrapperState.initialValue})}function Me(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(r(92));if(ke(n)){if(1<n.length)throw Error(r(93));n=n[0]}t=n}t??=``,n=t}e._wrapperState={initialValue:_e(n)}}function Ne(e,t){var n=_e(t.value),r=_e(t.defaultValue);n!=null&&(n=``+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=``+r)}function Pe(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==``&&t!==null&&(e.value=t)}function Fe(e){switch(e){case`svg`:return`http://www.w3.org/2000/svg`;case`math`:return`http://www.w3.org/1998/Math/MathML`;default:return`http://www.w3.org/1999/xhtml`}}function Ie(e,t){return e==null||e===`http://www.w3.org/1999/xhtml`?Fe(t):e===`http://www.w3.org/2000/svg`&&t===`foreignObject`?`http://www.w3.org/1999/xhtml`:e}var Le,Re=function(e){return typeof MSApp<`u`&&MSApp.execUnsafeLocalFunction?function(t,n,r,i){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,i)})}:e}(function(e,t){if(e.namespaceURI!==`http://www.w3.org/2000/svg`||`innerHTML`in e)e.innerHTML=t;else{for(Le||=document.createElement(`div`),Le.innerHTML=`<svg>`+t.valueOf().toString()+`</svg>`,t=Le.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function ze(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Be={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Ve=[`Webkit`,`ms`,`Moz`,`O`];Object.keys(Be).forEach(function(e){Ve.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Be[t]=Be[e]})});function He(e,t,n){return t==null||typeof t==`boolean`||t===``?``:n||typeof t!=`number`||t===0||Be.hasOwnProperty(e)&&Be[e]?(``+t).trim():t+`px`}function Ue(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=n.indexOf(`--`)===0,i=He(n,t[n],r);n===`float`&&(n=`cssFloat`),r?e.setProperty(n,i):e[n]=i}}var We=O({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Ge(e,t){if(t){if(We[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(r(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(r(60));if(typeof t.dangerouslySetInnerHTML!=`object`||!(`__html`in t.dangerouslySetInnerHTML))throw Error(r(61))}if(t.style!=null&&typeof t.style!=`object`)throw Error(r(62))}}function Ke(e,t){if(e.indexOf(`-`)===-1)return typeof t.is==`string`;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 qe=null;function Je(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ye=null,Xe=null,A=null;function Ze(e){if(e=Hi(e)){if(typeof Ye!=`function`)throw Error(r(280));var t=e.stateNode;t&&(t=Wi(t),Ye(e.stateNode,e.type,t))}}function Qe(e){Xe?A?A.push(e):A=[e]:Xe=e}function $e(){if(Xe){var e=Xe,t=A;if(A=Xe=null,Ze(e),t)for(e=0;e<t.length;e++)Ze(t[e])}}function et(e,t){return e(t)}function tt(){}var nt=!1;function rt(e,t,n){if(nt)return e(t,n);nt=!0;try{return et(e,t,n)}finally{nt=!1,(Xe!==null||A!==null)&&(tt(),$e())}}function it(e,t){var n=e.stateNode;if(n===null)return null;var i=Wi(n);if(i===null)return null;n=i[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`:(i=!i.disabled)||(e=e.type,i=!(e===`button`||e===`input`||e===`select`||e===`textarea`)),e=!i;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(r(231,t,typeof n));return n}var at=!1;if(c)try{var ot={};Object.defineProperty(ot,`passive`,{get:function(){at=!0}}),window.addEventListener(`test`,ot,ot),window.removeEventListener(`test`,ot,ot)}catch{at=!1}function st(e,t,n,r,i,a,o,s,c){var l=Array.prototype.slice.call(arguments,3);try{t.apply(n,l)}catch(e){this.onError(e)}}var ct=!1,lt=null,ut=!1,dt=null,ft={onError:function(e){ct=!0,lt=e}};function pt(e,t,n,r,i,a,o,s,c){ct=!1,lt=null,st.apply(ft,arguments)}function mt(e,t,n,i,a,o,s,c,l){if(pt.apply(this,arguments),ct){if(ct){var u=lt;ct=!1,lt=null}else throw Error(r(198));ut||(ut=!0,dt=u)}}function ht(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 gt(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 _t(e){if(ht(e)!==e)throw Error(r(188))}function vt(e){var t=e.alternate;if(!t){if(t=ht(e),t===null)throw Error(r(188));return t===e?e:null}for(var n=e,i=t;;){var a=n.return;if(a===null)break;var o=a.alternate;if(o===null){if(i=a.return,i!==null){n=i;continue}break}if(a.child===o.child){for(o=a.child;o;){if(o===n)return _t(a),e;if(o===i)return _t(a),t;o=o.sibling}throw Error(r(188))}if(n.return!==i.return)n=a,i=o;else{for(var s=!1,c=a.child;c;){if(c===n){s=!0,n=a,i=o;break}if(c===i){s=!0,i=a,n=o;break}c=c.sibling}if(!s){for(c=o.child;c;){if(c===n){s=!0,n=o,i=a;break}if(c===i){s=!0,i=o,n=a;break}c=c.sibling}if(!s)throw Error(r(189))}}if(n.alternate!==i)throw Error(r(190))}if(n.tag!==3)throw Error(r(188));return n.stateNode.current===n?e:t}function yt(e){return e=vt(e),e===null?null:bt(e)}function bt(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=bt(e);if(t!==null)return t;e=e.sibling}return null}var xt=n.unstable_scheduleCallback,St=n.unstable_cancelCallback,Ct=n.unstable_shouldYield,wt=n.unstable_requestPaint,Tt=n.unstable_now,Et=n.unstable_getCurrentPriorityLevel,Dt=n.unstable_ImmediatePriority,Ot=n.unstable_UserBlockingPriority,kt=n.unstable_NormalPriority,At=n.unstable_LowPriority,jt=n.unstable_IdlePriority,Mt=null,Nt=null;function Pt(e){if(Nt&&typeof Nt.onCommitFiberRoot==`function`)try{Nt.onCommitFiberRoot(Mt,e,void 0,(e.current.flags&128)==128)}catch{}}var Ft=Math.clz32?Math.clz32:Rt,It=Math.log,Lt=Math.LN2;function Rt(e){return e>>>=0,e===0?32:31-(It(e)/Lt|0)|0}var zt=64,Bt=4194304;function Vt(e){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: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Ht(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,a=e.pingedLanes,o=n&268435455;if(o!==0){var s=o&~i;s===0?(a&=o,a!==0&&(r=Vt(a))):r=Vt(s)}else o=n&~i,o===0?a!==0&&(r=Vt(a)):r=Vt(o);if(r===0)return 0;if(t!==0&&t!==r&&(t&i)===0&&(i=r&-r,a=t&-t,i>=a||i===16&&a&4194240))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-Ft(t),i=1<<n,r|=e[n],t&=~i;return r}function Ut(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64: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:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Wt(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes;0<a;){var o=31-Ft(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Ut(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}}function Gt(e){return e=e.pendingLanes&-1073741825,e===0?e&1073741824?1073741824:0:e}function Kt(){var e=zt;return zt<<=1,!(zt&4194240)&&(zt=64),e}function qt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Jt(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Ft(t),e[t]=n}function Yt(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var i=31-Ft(n),a=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~a}}function Xt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Ft(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var j=0;function Zt(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Qt,$t,en,tn,nn,rn=!1,an=[],on=null,sn=null,cn=null,ln=new Map,un=new Map,dn=[],fn=`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 submit`.split(` `);function pn(e,t){switch(e){case`focusin`:case`focusout`:on=null;break;case`dragenter`:case`dragleave`:sn=null;break;case`mouseover`:case`mouseout`:cn=null;break;case`pointerover`:case`pointerout`:ln.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:un.delete(t.pointerId)}}function mn(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=Hi(t),t!==null&&$t(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function hn(e,t,n,r,i){switch(t){case`focusin`:return on=mn(on,e,t,n,r,i),!0;case`dragenter`:return sn=mn(sn,e,t,n,r,i),!0;case`mouseover`:return cn=mn(cn,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return ln.set(a,mn(ln.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,un.set(a,mn(un.get(a)||null,e,t,n,r,i)),!0}return!1}function gn(e){var t=Vi(e.target);if(t!==null){var n=ht(t);if(n!==null){if(t=n.tag,t===13){if(t=gt(n),t!==null){e.blockedOn=t,nn(e.priority,function(){en(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 _n(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=On(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);qe=r,n.target.dispatchEvent(r),qe=null}else return t=Hi(n),t!==null&&$t(t),e.blockedOn=n,!1;t.shift()}return!0}function vn(e,t,n){_n(e)&&n.delete(t)}function yn(){rn=!1,on!==null&&_n(on)&&(on=null),sn!==null&&_n(sn)&&(sn=null),cn!==null&&_n(cn)&&(cn=null),ln.forEach(vn),un.forEach(vn)}function bn(e,t){e.blockedOn===t&&(e.blockedOn=null,rn||(rn=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,yn)))}function xn(e){function t(t){return bn(t,e)}if(0<an.length){bn(an[0],e);for(var n=1;n<an.length;n++){var r=an[n];r.blockedOn===e&&(r.blockedOn=null)}}for(on!==null&&bn(on,e),sn!==null&&bn(sn,e),cn!==null&&bn(cn,e),ln.forEach(t),un.forEach(t),n=0;n<dn.length;n++)r=dn[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<dn.length&&(n=dn[0],n.blockedOn===null);)gn(n),n.blockedOn===null&&dn.shift()}var Sn=C.ReactCurrentBatchConfig,Cn=!0;function wn(e,t,n,r){var i=j,a=Sn.transition;Sn.transition=null;try{j=1,En(e,t,n,r)}finally{j=i,Sn.transition=a}}function Tn(e,t,n,r){var i=j,a=Sn.transition;Sn.transition=null;try{j=4,En(e,t,n,r)}finally{j=i,Sn.transition=a}}function En(e,t,n,r){if(Cn){var i=On(e,t,n,r);if(i===null)mi(e,t,r,Dn,n),pn(e,r);else if(hn(i,e,t,n,r))r.stopPropagation();else if(pn(e,r),t&4&&-1<fn.indexOf(e)){for(;i!==null;){var a=Hi(i);if(a!==null&&Qt(a),a=On(e,t,n,r),a===null&&mi(e,t,r,Dn,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else mi(e,t,r,null,n)}}var Dn=null;function On(e,t,n,r){if(Dn=null,e=Je(r),e=Vi(e),e!==null)if(t=ht(e),t===null)e=null;else if(n=t.tag,n===13){if(e=gt(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 Dn=e,null}function kn(e){switch(e){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`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 1;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`toggle`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 4;case`message`:switch(Et()){case Dt:return 1;case Ot:return 4;case kt:case At:return 16;case jt:return 536870912;default:return 16}default:return 16}}var An=null,jn=null,Mn=null;function Nn(){if(Mn)return Mn;var e,t=jn,n=t.length,r,i=`value`in An?An.value:An.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 Mn=i.slice(e,1<r?1-r:void 0)}function Pn(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 Fn(){return!0}function In(){return!1}function Ln(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)?Fn:In,this.isPropagationStopped=In,this}return O(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=Fn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=Fn)},persist:function(){},isPersistent:Fn}),t}var Rn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},zn=Ln(Rn),Bn=O({},Rn,{view:0,detail:0}),Vn=Ln(Bn),Hn,Un,Wn,Gn=O({},Bn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:N,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!==Wn&&(Wn&&e.type===`mousemove`?(Hn=e.screenX-Wn.screenX,Un=e.screenY-Wn.screenY):Un=Hn=0,Wn=e),Hn)},movementY:function(e){return`movementY`in e?e.movementY:Un}}),Kn=Ln(Gn),qn=Ln(O({},Gn,{dataTransfer:0})),Jn=Ln(O({},Bn,{relatedTarget:0})),Yn=Ln(O({},Rn,{animationName:0,elapsedTime:0,pseudoElement:0})),Xn=Ln(O({},Rn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Zn=Ln(O({},Rn,{data:0})),Qn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},$n={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:`F5`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},M={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function er(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=M[e])?!!t[e]:!1}function N(){return er}var tr=Ln(O({},Bn,{key:function(e){if(e.key){var t=Qn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=Pn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?$n[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:N,charCode:function(e){return e.type===`keypress`?Pn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?Pn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),nr=Ln(O({},Gn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),rr=Ln(O({},Bn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:N})),ir=Ln(O({},Rn,{propertyName:0,elapsedTime:0,pseudoElement:0})),ar=Ln(O({},Gn,{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})),or=[9,13,27,32],sr=c&&`CompositionEvent`in window,cr=null;c&&`documentMode`in document&&(cr=document.documentMode);var lr=c&&`TextEvent`in window&&!cr,ur=c&&(!sr||cr&&8<cr&&11>=cr),dr=` `,fr=!1;function pr(e,t){switch(e){case`keyup`:return or.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function mr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var P=!1;function F(e,t){switch(e){case`compositionend`:return mr(t);case`keypress`:return t.which===32?(fr=!0,dr):null;case`textInput`:return e=t.data,e===dr&&fr?null:e;default:return null}}function hr(e,t){if(P)return e===`compositionend`||!sr&&pr(e,t)?(e=Nn(),Mn=jn=An=null,P=!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 ur&&t.locale!==`ko`?null:t.data;default:return null}}var gr={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 _r(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!gr[e.type]:t===`textarea`}function I(e,t,n,r){Qe(r),t=B(t,`onChange`),0<t.length&&(n=new zn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var vr=null,yr=null;function br(e){li(e,0)}function L(e){if(xe(Ui(e)))return e}function xr(e,t){if(e===`change`)return t}var Sr=!1;if(c){var Cr;if(c){var wr=`oninput`in document;if(!wr){var Tr=document.createElement(`div`);Tr.setAttribute(`oninput`,`return;`),wr=typeof Tr.oninput==`function`}Cr=wr}else Cr=!1;Sr=Cr&&(!document.documentMode||9<document.documentMode)}function R(){vr&&(vr.detachEvent(`onpropertychange`,Er),yr=vr=null)}function Er(e){if(e.propertyName===`value`&&L(yr)){var t=[];I(t,yr,e,Je(e)),rt(br,t)}}function Dr(e,t,n){e===`focusin`?(R(),vr=t,yr=n,vr.attachEvent(`onpropertychange`,Er)):e===`focusout`&&R()}function Or(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return L(yr)}function kr(e,t){if(e===`click`)return L(t)}function Ar(e,t){if(e===`input`||e===`change`)return L(t)}function jr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Mr=typeof Object.is==`function`?Object.is:jr;function Nr(e,t){if(Mr(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(!l.call(t,i)||!Mr(e[i],t[i]))return!1}return!0}function Pr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Fr(e,t){var n=Pr(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=Pr(n)}}function Ir(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ir(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Lr(){for(var e=window,t=Se();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Se(e.document)}return t}function Rr(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`)}function zr(e){var t=Lr(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Ir(n.ownerDocument.documentElement,n)){if(r!==null&&Rr(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),`selectionStart`in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,a=Math.min(r.start,i);r=r.end===void 0?a:Math.min(r.end,i),!e.extend&&a>r&&(i=r,r=a,a=i),i=Fr(n,a);var o=Fr(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus==`function`&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var Br=c&&`documentMode`in document&&11>=document.documentMode,Vr=null,Hr=null,Ur=null,Wr=!1;function Gr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Wr||Vr==null||Vr!==Se(r)||(r=Vr,`selectionStart`in r&&Rr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Ur&&Nr(Ur,r)||(Ur=r,r=B(Hr,`onSelect`),0<r.length&&(t=new zn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Vr)))}function Kr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var qr={animationend:Kr(`Animation`,`AnimationEnd`),animationiteration:Kr(`Animation`,`AnimationIteration`),animationstart:Kr(`Animation`,`AnimationStart`),transitionend:Kr(`Transition`,`TransitionEnd`)},Jr={},Yr={};c&&(Yr=document.createElement(`div`).style,`AnimationEvent`in window||(delete qr.animationend.animation,delete qr.animationiteration.animation,delete qr.animationstart.animation),`TransitionEvent`in window||delete qr.transitionend.transition);function Xr(e){if(Jr[e])return Jr[e];if(!qr[e])return e;var t=qr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Yr)return Jr[e]=t[n];return e}var Zr=Xr(`animationend`),Qr=Xr(`animationiteration`),$r=Xr(`animationstart`),ei=Xr(`transitionend`),ti=new Map,ni=`abort auxClick 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(` `);function ri(e,t){ti.set(e,t),o(t,[e])}for(var ii=0;ii<ni.length;ii++){var ai=ni[ii];ri(ai.toLowerCase(),`on`+(ai[0].toUpperCase()+ai.slice(1)))}ri(Zr,`onAnimationEnd`),ri(Qr,`onAnimationIteration`),ri($r,`onAnimationStart`),ri(`dblclick`,`onDoubleClick`),ri(`focusin`,`onFocus`),ri(`focusout`,`onBlur`),ri(ei,`onTransitionEnd`),s(`onMouseEnter`,[`mouseout`,`mouseover`]),s(`onMouseLeave`,[`mouseout`,`mouseover`]),s(`onPointerEnter`,[`pointerout`,`pointerover`]),s(`onPointerLeave`,[`pointerout`,`pointerover`]),o(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),o(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),o(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),o(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),o(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),o(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var oi=`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(` `),si=new Set(`cancel close invalid load scroll toggle`.split(` `).concat(oi));function ci(e,t,n){var r=e.type||`unknown-event`;e.currentTarget=n,mt(r,t,void 0,e),e.currentTarget=null}function li(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;ci(i,s,l),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;ci(i,s,l),a=c}}}if(ut)throw e=dt,ut=!1,dt=null,e}function z(e,t){var n=t[Ri];n===void 0&&(n=t[Ri]=new Set);var r=e+`__bubble`;n.has(r)||(pi(t,e,2,!1),n.add(r))}function ui(e,t,n){var r=0;t&&(r|=4),pi(n,e,r,t)}var di=`_reactListening`+Math.random().toString(36).slice(2);function fi(e){if(!e[di]){e[di]=!0,i.forEach(function(t){t!==`selectionchange`&&(si.has(t)||ui(t,!1,e),ui(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[di]||(t[di]=!0,ui(`selectionchange`,!1,t))}}function pi(e,t,n,r){switch(kn(t)){case 1:var i=wn;break;case 4:i=Tn;break;default:i=En}n=i.bind(null,t,n,e),i=void 0,!at||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 mi(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||s.nodeType===8&&s.parentNode===i)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===i||c.nodeType===8&&c.parentNode===i))return;o=o.return}for(;s!==null;){if(o=Vi(s),o===null)return;if(c=o.tag,c===5||c===6){r=a=o;continue a}s=s.parentNode}}r=r.return}rt(function(){var r=a,i=Je(n),o=[];a:{var s=ti.get(e);if(s!==void 0){var c=zn,l=e;switch(e){case`keypress`:if(Pn(n)===0)break a;case`keydown`:case`keyup`:c=tr;break;case`focusin`:l=`focus`,c=Jn;break;case`focusout`:l=`blur`,c=Jn;break;case`beforeblur`:case`afterblur`:c=Jn;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=Kn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:c=qn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:c=rr;break;case Zr:case Qr:case $r:c=Yn;break;case ei:c=ir;break;case`scroll`:c=Vn;break;case`wheel`:c=ar;break;case`copy`:case`cut`:case`paste`:c=Xn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:c=nr}var u=(t&4)!=0,d=!u&&e===`scroll`,f=u?s===null?null:s+`Capture`:s;u=[];for(var p=r,m;p!==null;){m=p;var h=m.stateNode;if(m.tag===5&&h!==null&&(m=h,f!==null&&(h=it(p,f),h!=null&&u.push(hi(p,h,m)))),d)break;p=p.return}0<u.length&&(s=new c(s,l,null,n,i),o.push({event:s,listeners:u}))}}if(!(t&7)){a:{if(s=e===`mouseover`||e===`pointerover`,c=e===`mouseout`||e===`pointerout`,s&&n!==qe&&(l=n.relatedTarget||n.fromElement)&&(Vi(l)||l[Li]))break a;if((c||s)&&(s=i.window===i?i:(s=i.ownerDocument)?s.defaultView||s.parentWindow:window,c?(l=n.relatedTarget||n.toElement,c=r,l=l?Vi(l):null,l!==null&&(d=ht(l),l!==d||l.tag!==5&&l.tag!==6)&&(l=null)):(c=null,l=r),c!==l)){if(u=Kn,h=`onMouseLeave`,f=`onMouseEnter`,p=`mouse`,(e===`pointerout`||e===`pointerover`)&&(u=nr,h=`onPointerLeave`,f=`onPointerEnter`,p=`pointer`),d=c==null?s:Ui(c),m=l==null?s:Ui(l),s=new u(h,p+`leave`,c,n,i),s.target=d,s.relatedTarget=m,h=null,Vi(i)===r&&(u=new u(f,p+`enter`,l,n,i),u.target=m,u.relatedTarget=d,h=u),d=h,c&&l)b:{for(u=c,f=l,p=0,m=u;m;m=gi(m))p++;for(m=0,h=f;h;h=gi(h))m++;for(;0<p-m;)u=gi(u),p--;for(;0<m-p;)f=gi(f),m--;for(;p--;){if(u===f||f!==null&&u===f.alternate)break b;u=gi(u),f=gi(f)}u=null}else u=null;c!==null&&_i(o,s,c,u,!1),l!==null&&d!==null&&_i(o,d,l,u,!0)}}a:{if(s=r?Ui(r):window,c=s.nodeName&&s.nodeName.toLowerCase(),c===`select`||c===`input`&&s.type===`file`)var g=xr;else if(_r(s))if(Sr)g=Ar;else{g=Or;var _=Dr}else (c=s.nodeName)&&c.toLowerCase()===`input`&&(s.type===`checkbox`||s.type===`radio`)&&(g=kr);if(g&&=g(e,r)){I(o,g,n,i);break a}_&&_(e,s,r),e===`focusout`&&(_=s._wrapperState)&&_.controlled&&s.type===`number`&&Oe(s,`number`,s.value)}switch(_=r?Ui(r):window,e){case`focusin`:(_r(_)||_.contentEditable===`true`)&&(Vr=_,Hr=r,Ur=null);break;case`focusout`:Ur=Hr=Vr=null;break;case`mousedown`:Wr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Wr=!1,Gr(o,n,i);break;case`selectionchange`:if(Br)break;case`keydown`:case`keyup`:Gr(o,n,i)}var v;if(sr)b:{switch(e){case`compositionstart`:var y=`onCompositionStart`;break b;case`compositionend`:y=`onCompositionEnd`;break b;case`compositionupdate`:y=`onCompositionUpdate`;break b}y=void 0}else P?pr(e,n)&&(y=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(y=`onCompositionStart`);y&&(ur&&n.locale!==`ko`&&(P||y!==`onCompositionStart`?y===`onCompositionEnd`&&P&&(v=Nn()):(An=i,jn=`value`in An?An.value:An.textContent,P=!0)),_=B(r,y),0<_.length&&(y=new Zn(y,e,null,n,i),o.push({event:y,listeners:_}),v?y.data=v:(v=mr(n),v!==null&&(y.data=v)))),(v=lr?F(e,n):hr(e,n))&&(r=B(r,`onBeforeInput`),0<r.length&&(i=new Zn(`onBeforeInput`,`beforeinput`,null,n,i),o.push({event:i,listeners:r}),i.data=v))}li(o,t)})}function hi(e,t,n){return{instance:e,listener:t,currentTarget:n}}function B(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;i.tag===5&&a!==null&&(i=a,a=it(e,n),a!=null&&r.unshift(hi(e,a,i)),a=it(e,t),a!=null&&r.push(hi(e,a,i))),e=e.return}return r}function gi(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function _i(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(c!==null&&c===r)break;s.tag===5&&l!==null&&(s=l,i?(c=it(n,a),c!=null&&o.unshift(hi(n,c,s))):i||(c=it(n,a),c!=null&&o.push(hi(n,c,s)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var vi=/\r\n?/g,yi=/\u0000|\uFFFD/g;function bi(e){return(typeof e==`string`?e:``+e).replace(vi,`
|
|
6
|
+
`).replace(yi,``)}function xi(e,t,n){if(t=bi(t),bi(e)!==t&&n)throw Error(r(425))}function Si(){}var Ci=null,wi=null;function Ti(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Ei=typeof setTimeout==`function`?setTimeout:void 0,Di=typeof clearTimeout==`function`?clearTimeout:void 0,Oi=typeof Promise==`function`?Promise:void 0,ki=typeof queueMicrotask==`function`?queueMicrotask:Oi===void 0?Ei:function(e){return Oi.resolve(null).then(e).catch(Ai)};function Ai(e){setTimeout(function(){throw e})}function ji(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===`/$`){if(r===0){e.removeChild(i),xn(t);return}r--}else n!==`$`&&n!==`$?`&&n!==`$!`||r++;n=i}while(n);xn(t)}function Mi(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===`$?`)break;if(t===`/$`)return null}}return e}function Ni(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`){if(t===0)return e;t--}else n===`/$`&&t++}e=e.previousSibling}return null}var Pi=Math.random().toString(36).slice(2),Fi=`__reactFiber$`+Pi,Ii=`__reactProps$`+Pi,Li=`__reactContainer$`+Pi,Ri=`__reactEvents$`+Pi,zi=`__reactListeners$`+Pi,Bi=`__reactHandles$`+Pi;function Vi(e){var t=e[Fi];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Li]||n[Fi]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Ni(e);e!==null;){if(n=e[Fi])return n;e=Ni(e)}return t}e=n,n=e.parentNode}return null}function Hi(e){return e=e[Fi]||e[Li],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Ui(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(r(33))}function Wi(e){return e[Ii]||null}var Gi=[],Ki=-1;function qi(e){return{current:e}}function V(e){0>Ki||(e.current=Gi[Ki],Gi[Ki]=null,Ki--)}function H(e,t){Ki++,Gi[Ki]=e.current,e.current=t}var Ji={},Yi=qi(Ji),Xi=qi(!1),Zi=Ji;function Qi(e,t){var n=e.type.contextTypes;if(!n)return Ji;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in n)i[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function $i(e){return e=e.childContextTypes,e!=null}function U(){V(Xi),V(Yi)}function ea(e,t,n){if(Yi.current!==Ji)throw Error(r(168));H(Yi,t),H(Xi,n)}function ta(e,t,n){var i=e.stateNode;if(t=t.childContextTypes,typeof i.getChildContext!=`function`)return n;for(var a in i=i.getChildContext(),i)if(!(a in t))throw Error(r(108,ge(e)||`Unknown`,a));return O({},n,i)}function na(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ji,Zi=Yi.current,H(Yi,e),H(Xi,Xi.current),!0}function ra(e,t,n){var i=e.stateNode;if(!i)throw Error(r(169));n?(e=ta(e,t,Zi),i.__reactInternalMemoizedMergedChildContext=e,V(Xi),V(Yi),H(Yi,e)):V(Xi),H(Xi,n)}var ia=null,aa=!1,oa=!1;function sa(e){ia===null?ia=[e]:ia.push(e)}function ca(e){aa=!0,sa(e)}function la(){if(!oa&&ia!==null){oa=!0;var e=0,t=j;try{var n=ia;for(j=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}ia=null,aa=!1}catch(t){throw ia!==null&&(ia=ia.slice(e+1)),xt(Dt,la),t}finally{j=t,oa=!1}}return null}var ua=[],da=0,fa=null,pa=0,ma=[],ha=0,ga=null,_a=1,va=``;function ya(e,t){ua[da++]=pa,ua[da++]=fa,fa=e,pa=t}function ba(e,t,n){ma[ha++]=_a,ma[ha++]=va,ma[ha++]=ga,ga=e;var r=_a;e=va;var i=32-Ft(r)-1;r&=~(1<<i),n+=1;var a=32-Ft(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,_a=1<<32-Ft(t)+i|n<<i|r,va=a+e}else _a=1<<a|n<<i|r,va=e}function xa(e){e.return!==null&&(ya(e,1),ba(e,1,0))}function Sa(e){for(;e===fa;)fa=ua[--da],ua[da]=null,pa=ua[--da],ua[da]=null;for(;e===ga;)ga=ma[--ha],ma[ha]=null,va=ma[--ha],ma[ha]=null,_a=ma[--ha],ma[ha]=null}var Ca=null,wa=null,W=!1,Ta=null;function Ea(e,t){var n=Jl(5,null,null,0);n.elementType=`DELETED`,n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function G(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t===null?!1:(e.stateNode=t,Ca=e,wa=Mi(t.firstChild),!0);case 6:return t=e.pendingProps===``||t.nodeType!==3?null:t,t===null?!1:(e.stateNode=t,Ca=e,wa=null,!0);case 13:return t=t.nodeType===8?t:null,t===null?!1:(n=ga===null?null:{id:_a,overflow:va},e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Jl(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Ca=e,wa=null,!0);default:return!1}}function Da(e){return(e.mode&1)!=0&&(e.flags&128)==0}function Oa(e){if(W){var t=wa;if(t){var n=t;if(!G(e,t)){if(Da(e))throw Error(r(418));t=Mi(n.nextSibling);var i=Ca;t&&G(e,t)?Ea(i,n):(e.flags=e.flags&-4097|2,W=!1,Ca=e)}}else{if(Da(e))throw Error(r(418));e.flags=e.flags&-4097|2,W=!1,Ca=e}}}function ka(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Ca=e}function Aa(e){if(e!==Ca)return!1;if(!W)return ka(e),W=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!==`head`&&t!==`body`&&!Ti(e.type,e.memoizedProps)),t&&=wa){if(Da(e))throw ja(),Error(r(418));for(;t;)Ea(e,t),t=Mi(t.nextSibling)}if(ka(e),e.tag===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(r(317));a:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`){if(t===0){wa=Mi(e.nextSibling);break a}t--}else n!==`$`&&n!==`$!`&&n!==`$?`||t++}e=e.nextSibling}wa=null}}else wa=Ca?Mi(e.stateNode.nextSibling):null;return!0}function ja(){for(var e=wa;e;)e=Mi(e.nextSibling)}function Ma(){wa=Ca=null,W=!1}function Na(e){Ta===null?Ta=[e]:Ta.push(e)}var Pa=C.ReactCurrentBatchConfig;function Fa(e,t,n){if(e=n.ref,e!==null&&typeof e!=`function`&&typeof e!=`object`){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(r(309));var i=n.stateNode}if(!i)throw Error(r(147,e));var a=i,o=``+e;return t!==null&&t.ref!==null&&typeof t.ref==`function`&&t.ref._stringRef===o?t.ref:(t=function(e){var t=a.refs;e===null?delete t[o]:t[o]=e},t._stringRef=o,t)}if(typeof e!=`string`)throw Error(r(284));if(!n._owner)throw Error(r(290,e))}return e}function Ia(e,t){throw e=Object.prototype.toString.call(t),Error(r(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e))}function La(e){var t=e._init;return t(e._payload)}function Ra(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 i(e,t){for(e=new Map;t!==null;)t.key===null?e.set(t.index,t):e.set(t.key,t),t=t.sibling;return e}function a(e,t){return e=Zl(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=2,n):(r=r.index,r<n?(t.flags|=2,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=2),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=tu(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===E?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===se&&La(i)===t.type)?(r=a(t,n.props),r.ref=Fa(e,t,n),r.return=e,r):(r=Ql(n.type,n.key,n.props,null,e.mode,r),r.ref=Fa(e,t,n),r.return=e,r)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=nu(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=$l(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`)return t=tu(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case w:return n=Ql(t.type,t.key,t.props,null,e.mode,n),n.ref=Fa(e,null,t),n.return=e,n;case T:return t=nu(t,e.mode,n),t.return=e,t;case se:var r=t._init;return f(e,r(t._payload),n)}if(ke(t)||ue(t))return t=$l(t,e.mode,n,null),t.return=e,t;Ia(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`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case w:return n.key===i?l(e,t,n,r):null;case T:return n.key===i?u(e,t,n,r):null;case se:return i=n._init,p(e,t,i(n._payload),r)}if(ke(n)||ue(n))return i===null?d(e,t,n,r,null):null;Ia(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case w:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case T:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case se:var a=r._init;return m(e,t,n,a(r._payload),i)}if(ke(r)||ue(r))return e=e.get(n)||null,d(t,e,r,i,null);Ia(t,r)}return null}function h(r,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(r,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(r,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(r,d),W&&ya(r,h),l;if(d===null){for(;h<s.length;h++)d=f(r,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return W&&ya(r,h),l}for(d=i(r,d);h<s.length;h++)g=m(d,r,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(r,e)}),W&&ya(r,h),l}function g(a,s,c,l){var u=ue(c);if(typeof u!=`function`)throw Error(r(150));if(c=u.call(c),c==null)throw Error(r(151));for(var d=u=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),W&&ya(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return W&&ya(a,g),u}for(h=i(a,h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),W&&ya(a,g),u}function _(e,r,i,o){if(typeof i==`object`&&i&&i.type===E&&i.key===null&&(i=i.props.children),typeof i==`object`&&i){switch(i.$$typeof){case w:a:{for(var c=i.key,l=r;l!==null;){if(l.key===c){if(c=i.type,c===E){if(l.tag===7){n(e,l.sibling),r=a(l,i.props.children),r.return=e,e=r;break a}}else if(l.elementType===c||typeof c==`object`&&c&&c.$$typeof===se&&La(c)===l.type){n(e,l.sibling),r=a(l,i.props),r.ref=Fa(e,l,i),r.return=e,e=r;break a}n(e,l);break}else t(e,l);l=l.sibling}i.type===E?(r=$l(i.props.children,e.mode,o,i.key),r.return=e,e=r):(o=Ql(i.type,i.key,i.props,null,e.mode,o),o.ref=Fa(e,r,i),o.return=e,e=o)}return s(e);case T:a:{for(l=i.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===i.containerInfo&&r.stateNode.implementation===i.implementation){n(e,r.sibling),r=a(r,i.children||[]),r.return=e,e=r;break a}else{n(e,r);break}else t(e,r);r=r.sibling}r=nu(i,e.mode,o),r.return=e,e=r}return s(e);case se:return l=i._init,_(e,r,l(i._payload),o)}if(ke(i))return h(e,r,i,o);if(ue(i))return g(e,r,i,o);Ia(e,i)}return typeof i==`string`&&i!==``||typeof i==`number`?(i=``+i,r!==null&&r.tag===6?(n(e,r.sibling),r=a(r,i),r.return=e,e=r):(n(e,r),r=tu(i,e.mode,o),r.return=e,e=r),s(e)):n(e,r)}return _}var za=Ra(!0),Ba=Ra(!1),Va=qi(null),Ha=null,Ua=null,Wa=null;function Ga(){Wa=Ua=Ha=null}function Ka(e){var t=Va.current;V(Va),e._currentValue=t}function qa(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 Ja(e,t){Ha=e,Wa=Ua=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(Rs=!0),e.firstContext=null)}function Ya(e){var t=e._currentValue;if(Wa!==e)if(e={context:e,memoizedValue:t,next:null},Ua===null){if(Ha===null)throw Error(r(308));Ua=e,Ha.dependencies={lanes:0,firstContext:e}}else Ua=Ua.next=e;return t}var Xa=null;function Za(e){Xa===null?Xa=[e]:Xa.push(e)}function Qa(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,Za(t)):(n.next=i.next,i.next=n),t.interleaved=n,$a(e,r)}function $a(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var eo=!1;function to(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function no(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function ro(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function io(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Y&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,$a(e,n)}return i=r.interleaved,i===null?(t.next=t,Za(r)):(t.next=i.next,i.next=t),r.interleaved=t,$a(e,n)}function ao(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194240)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Xt(e,n)}}function oo(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={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,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,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function so(e,t,n,r){var i=e.updateQueue;eo=!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,p=s.eventTime;if((r&f)===f){u!==null&&(u=u.next={eventTime:p,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});a:{var m=e,h=s;switch(f=t,p=n,h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(p,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(p,d,f):m,f==null)break a;d=O({},d,f);break a;case 2:eo=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[s]:f.push(s))}else p={eventTime: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;f=s,s=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(1);if(u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else a===null&&(i.shared.lanes=0);Qc|=o,e.lanes=o,e.memoizedState=d}}function co(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var i=e[t],a=i.callback;if(a!==null){if(i.callback=null,i=n,typeof a!=`function`)throw Error(r(191,a));a.call(i)}}}var lo={},uo=qi(lo),fo=qi(lo),po=qi(lo);function mo(e){if(e===lo)throw Error(r(174));return e}function ho(e,t){switch(H(po,t),H(fo,e),H(uo,lo),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Ie(null,``);break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Ie(t,e)}V(uo),H(uo,t)}function go(){V(uo),V(fo),V(po)}function _o(e){mo(po.current);var t=mo(uo.current),n=Ie(t,e.type);t!==n&&(H(fo,e),H(uo,n))}function vo(e){fo.current===e&&(V(uo),V(fo))}var yo=qi(0);function bo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data===`$?`||n.data===`$!`))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){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 xo=[];function So(){for(var e=0;e<xo.length;e++)xo[e]._workInProgressVersionPrimary=null;xo.length=0}var Co=C.ReactCurrentDispatcher,wo=C.ReactCurrentBatchConfig,To=0,Eo=null,Do=null,Oo=null,ko=!1,Ao=!1,jo=0,Mo=0;function No(){throw Error(r(321))}function Po(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Mr(e[n],t[n]))return!1;return!0}function Fo(e,t,n,i,a,o){if(To=o,Eo=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Co.current=e===null||e.memoizedState===null?vs:ys,e=n(i,a),Ao){o=0;do{if(Ao=!1,jo=0,25<=o)throw Error(r(301));o+=1,Oo=Do=null,t.updateQueue=null,Co.current=bs,e=n(i,a)}while(Ao)}if(Co.current=_s,t=Do!==null&&Do.next!==null,To=0,Oo=Do=Eo=null,ko=!1,t)throw Error(r(300));return e}function Io(){var e=jo!==0;return jo=0,e}function Lo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Oo===null?Eo.memoizedState=Oo=e:Oo=Oo.next=e,Oo}function Ro(){if(Do===null){var e=Eo.alternate;e=e===null?null:e.memoizedState}else e=Do.next;var t=Oo===null?Eo.memoizedState:Oo.next;if(t!==null)Oo=t,Do=e;else{if(e===null)throw Error(r(310));Do=e,e={memoizedState:Do.memoizedState,baseState:Do.baseState,baseQueue:Do.baseQueue,queue:Do.queue,next:null},Oo===null?Eo.memoizedState=Oo=e:Oo=Oo.next=e}return Oo}function zo(e,t){return typeof t==`function`?t(e):t}function Bo(e){var t=Ro(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var i=Do,a=i.baseQueue,o=n.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}i.baseQueue=a=o,n.pending=null}if(a!==null){o=a.next,i=i.baseState;var c=s=null,l=null,u=o;do{var d=u.lane;if((To&d)===d)l!==null&&(l=l.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),i=u.hasEagerState?u.eagerState:e(i,u.action);else{var f={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};l===null?(c=l=f,s=i):l=l.next=f,Eo.lanes|=d,Qc|=d}u=u.next}while(u!==null&&u!==o);l===null?s=i:l.next=c,Mr(i,t.memoizedState)||(Rs=!0),t.memoizedState=i,t.baseState=s,t.baseQueue=l,n.lastRenderedState=i}if(e=n.interleaved,e!==null){a=e;do o=a.lane,Eo.lanes|=o,Qc|=o,a=a.next;while(a!==e)}else a===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Vo(e){var t=Ro(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var i=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);Mr(o,t.memoizedState)||(Rs=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,i]}function Ho(){}function Uo(e,t){var n=Eo,i=Ro(),a=t(),o=!Mr(i.memoizedState,a);if(o&&(i.memoizedState=a,Rs=!0),i=i.queue,ts(Ko.bind(null,n,i,e),[e]),i.getSnapshot!==t||o||Oo!==null&&Oo.memoizedState.tag&1){if(n.flags|=2048,Xo(9,Go.bind(null,n,i,a,t),void 0,null),Gc===null)throw Error(r(349));To&30||Wo(n,t,a)}return a}function Wo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Eo.updateQueue,t===null?(t={lastEffect:null,stores:null},Eo.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Go(e,t,n,r){t.value=n,t.getSnapshot=r,qo(t)&&Jo(e)}function Ko(e,t,n){return n(function(){qo(t)&&Jo(e)})}function qo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Mr(e,n)}catch{return!0}}function Jo(e){var t=$a(e,1);t!==null&&_l(t,e,1,-1)}function Yo(e){var t=Lo();return typeof e==`function`&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:zo,lastRenderedState:e},t.queue=e,e=e.dispatch=ps.bind(null,Eo,e),[t.memoizedState,e]}function Xo(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Eo.updateQueue,t===null?(t={lastEffect:null,stores:null},Eo.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function Zo(){return Ro().memoizedState}function Qo(e,t,n,r){var i=Lo();Eo.flags|=e,i.memoizedState=Xo(1|t,n,void 0,r===void 0?null:r)}function $o(e,t,n,r){var i=Ro();r=r===void 0?null:r;var a=void 0;if(Do!==null){var o=Do.memoizedState;if(a=o.destroy,r!==null&&Po(r,o.deps)){i.memoizedState=Xo(t,n,a,r);return}}Eo.flags|=e,i.memoizedState=Xo(1|t,n,a,r)}function es(e,t){return Qo(8390656,8,e,t)}function ts(e,t){return $o(2048,8,e,t)}function ns(e,t){return $o(4,2,e,t)}function rs(e,t){return $o(4,4,e,t)}function is(e,t){if(typeof t==`function`)return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function as(e,t,n){return n=n==null?null:n.concat([e]),$o(4,4,is.bind(null,t,e),n)}function os(){}function ss(e,t){var n=Ro();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Po(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function cs(e,t){var n=Ro();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Po(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function ls(e,t,n){return To&21?(Mr(n,t)||(n=Kt(),Eo.lanes|=n,Qc|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Rs=!0),e.memoizedState=n)}function us(e,t){var n=j;j=n!==0&&4>n?n:4,e(!0);var r=wo.transition;wo.transition={};try{e(!1),t()}finally{j=n,wo.transition=r}}function ds(){return Ro().memoizedState}function fs(e,t,n){var r=gl(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},ms(e))hs(t,n);else if(n=Qa(e,t,n,r),n!==null){var i=hl();_l(n,e,r,i),gs(n,t,r)}}function ps(e,t,n){var r=gl(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(ms(e))hs(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,Mr(s,o)){var c=t.interleaved;c===null?(i.next=i,Za(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}n=Qa(e,t,i,r),n!==null&&(i=hl(),_l(n,e,r,i),gs(n,t,r))}}function ms(e){var t=e.alternate;return e===Eo||t!==null&&t===Eo}function hs(e,t){Ao=ko=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function gs(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Xt(e,n)}}var _s={readContext:Ya,useCallback:No,useContext:No,useEffect:No,useImperativeHandle:No,useInsertionEffect:No,useLayoutEffect:No,useMemo:No,useReducer:No,useRef:No,useState:No,useDebugValue:No,useDeferredValue:No,useTransition:No,useMutableSource:No,useSyncExternalStore:No,useId:No,unstable_isNewReconciler:!1},vs={readContext:Ya,useCallback:function(e,t){return Lo().memoizedState=[e,t===void 0?null:t],e},useContext:Ya,useEffect:es,useImperativeHandle:function(e,t,n){return n=n==null?null:n.concat([e]),Qo(4194308,4,is.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Qo(4194308,4,e,t)},useInsertionEffect:function(e,t){return Qo(4,2,e,t)},useMemo:function(e,t){var n=Lo();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Lo();return t=n===void 0?t:n(t),r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=fs.bind(null,Eo,e),[r.memoizedState,e]},useRef:function(e){var t=Lo();return e={current:e},t.memoizedState=e},useState:Yo,useDebugValue:os,useDeferredValue:function(e){return Lo().memoizedState=e},useTransition:function(){var e=Yo(!1),t=e[0];return e=us.bind(null,e[1]),Lo().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var i=Eo,a=Lo();if(W){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),Gc===null)throw Error(r(349));To&30||Wo(i,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,es(Ko.bind(null,i,o,e),[e]),i.flags|=2048,Xo(9,Go.bind(null,i,o,n,t),void 0,null),n},useId:function(){var e=Lo(),t=Gc.identifierPrefix;if(W){var n=va,r=_a;n=(r&~(1<<32-Ft(r)-1)).toString(32)+n,t=`:`+t+`R`+n,n=jo++,0<n&&(t+=`H`+n.toString(32)),t+=`:`}else n=Mo++,t=`:`+t+`r`+n.toString(32)+`:`;return e.memoizedState=t},unstable_isNewReconciler:!1},ys={readContext:Ya,useCallback:ss,useContext:Ya,useEffect:ts,useImperativeHandle:as,useInsertionEffect:ns,useLayoutEffect:rs,useMemo:cs,useReducer:Bo,useRef:Zo,useState:function(){return Bo(zo)},useDebugValue:os,useDeferredValue:function(e){return ls(Ro(),Do.memoizedState,e)},useTransition:function(){return[Bo(zo)[0],Ro().memoizedState]},useMutableSource:Ho,useSyncExternalStore:Uo,useId:ds,unstable_isNewReconciler:!1},bs={readContext:Ya,useCallback:ss,useContext:Ya,useEffect:ts,useImperativeHandle:as,useInsertionEffect:ns,useLayoutEffect:rs,useMemo:cs,useReducer:Vo,useRef:Zo,useState:function(){return Vo(zo)},useDebugValue:os,useDeferredValue:function(e){var t=Ro();return Do===null?t.memoizedState=e:ls(t,Do.memoizedState,e)},useTransition:function(){return[Vo(zo)[0],Ro().memoizedState]},useMutableSource:Ho,useSyncExternalStore:Uo,useId:ds,unstable_isNewReconciler:!1};function xs(e,t){if(e&&e.defaultProps){for(var n in t=O({},t),e=e.defaultProps,e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Ss(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:O({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Cs={isMounted:function(e){return(e=e._reactInternals)?ht(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=hl(),i=gl(e),a=ro(r,i);a.payload=t,n!=null&&(a.callback=n),t=io(e,a,i),t!==null&&(_l(t,e,i,r),ao(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=hl(),i=gl(e),a=ro(r,i);a.tag=1,a.payload=t,n!=null&&(a.callback=n),t=io(e,a,i),t!==null&&(_l(t,e,i,r),ao(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=hl(),r=gl(e),i=ro(n,r);i.tag=2,t!=null&&(i.callback=t),t=io(e,i,r),t!==null&&(_l(t,e,r,n),ao(t,e,r))}};function ws(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?!Nr(n,r)||!Nr(i,a):!0}function Ts(e,t,n){var r=!1,i=Ji,a=t.contextType;return typeof a==`object`&&a?a=Ya(a):(i=$i(t)?Zi:Yi.current,r=t.contextTypes,a=(r=r!=null)?Qi(e,i):Ji),t=new t(n,a),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Cs,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=a),t}function Es(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&&Cs.enqueueReplaceState(t,t.state,null)}function Ds(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},to(e);var a=t.contextType;typeof a==`object`&&a?i.context=Ya(a):(a=$i(t)?Zi:Yi.current,i.context=Qi(e,a)),i.state=e.memoizedState,a=t.getDerivedStateFromProps,typeof a==`function`&&(Ss(e,t,a,n),i.state=e.memoizedState),typeof t.getDerivedStateFromProps==`function`||typeof i.getSnapshotBeforeUpdate==`function`||typeof i.UNSAFE_componentWillMount!=`function`&&typeof i.componentWillMount!=`function`||(t=i.state,typeof i.componentWillMount==`function`&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount==`function`&&i.UNSAFE_componentWillMount(),t!==i.state&&Cs.enqueueReplaceState(i,i.state,null),so(e,n,i,r),i.state=e.memoizedState),typeof i.componentDidMount==`function`&&(e.flags|=4194308)}function Os(e,t){try{var n=``,r=t;do n+=me(r),r=r.return;while(r);var i=n}catch(e){i=`
|
|
7
|
+
Error generating stack: `+e.message+`
|
|
8
|
+
`+e.stack}return{value:e,source:t,stack:i,digest:null}}function ks(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function As(e,t){try{console.error(t.value)}catch(e){setTimeout(function(){throw e})}}var js=typeof WeakMap==`function`?WeakMap:Map;function Ms(e,t,n){n=ro(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){ol||(ol=!0,sl=r),As(e,t)},n}function Ns(e,t,n){n=ro(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r==`function`){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){As(e,t)}}var a=e.stateNode;return a!==null&&typeof a.componentDidCatch==`function`&&(n.callback=function(){As(e,t),typeof r!=`function`&&(cl===null?cl=new Set([this]):cl.add(this));var n=t.stack;this.componentDidCatch(t.value,{componentStack:n===null?``:n})}),n}function Ps(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new js;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)||(i.add(n),e=Vl.bind(null,e,t,n),t.then(e,e))}function Fs(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t===null?!0:t.dehydrated!==null),t)return e;e=e.return}while(e!==null);return null}function Is(e,t,n,r,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=ro(-1,1),t.tag=2,io(n,t,1))),n.lanes|=1),e)}var Ls=C.ReactCurrentOwner,Rs=!1;function zs(e,t,n,r){t.child=e===null?Ba(t,null,n,r):za(t,e.child,n,r)}function Bs(e,t,n,r,i){n=n.render;var a=t.ref;return Ja(t,i),r=Fo(e,t,n,r,a,i),n=Io(),e!==null&&!Rs?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,oc(e,t,i)):(W&&n&&xa(t),t.flags|=1,zs(e,t,r,i),t.child)}function Vs(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!Yl(a)&&a.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=a,Hs(e,t,a,r,i)):(e=Ql(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,(e.lanes&i)===0){var o=a.memoizedProps;if(n=n.compare,n=n===null?Nr:n,n(o,r)&&e.ref===t.ref)return oc(e,t,i)}return t.flags|=1,e=Zl(a,r),e.ref=t.ref,e.return=t,t.child=e}function Hs(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Nr(a,r)&&e.ref===t.ref)if(Rs=!1,t.pendingProps=r=a,(e.lanes&i)!==0)e.flags&131072&&(Rs=!0);else return t.lanes=e.lanes,oc(e,t,i)}return Gs(e,t,n,r,i)}function Us(e,t,n){var r=t.pendingProps,i=r.children,a=e===null?null:e.memoizedState;if(r.mode===`hidden`)if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},H(Yc,Jc),Jc|=n;else{if(!(n&1073741824))return e=a===null?n:a.baseLanes|n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,H(Yc,Jc),Jc|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=a===null?n:a.baseLanes,H(Yc,Jc),Jc|=r}else a===null?r=n:(r=a.baseLanes|n,t.memoizedState=null),H(Yc,Jc),Jc|=r;return zs(e,t,i,n),t.child}function Ws(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Gs(e,t,n,r,i){var a=$i(n)?Zi:Yi.current;return a=Qi(t,a),Ja(t,i),n=Fo(e,t,n,r,a,i),r=Io(),e!==null&&!Rs?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,oc(e,t,i)):(W&&r&&xa(t),t.flags|=1,zs(e,t,n,i),t.child)}function Ks(e,t,n,r,i){if($i(n)){var a=!0;na(t)}else a=!1;if(Ja(t,i),t.stateNode===null)ac(e,t),Ts(t,n,r),Ds(t,n,r,i),r=!0;else if(e===null){var o=t.stateNode,s=t.memoizedProps;o.props=s;var c=o.context,l=n.contextType;typeof l==`object`&&l?l=Ya(l):(l=$i(n)?Zi:Yi.current,l=Qi(t,l));var u=n.getDerivedStateFromProps,d=typeof u==`function`||typeof o.getSnapshotBeforeUpdate==`function`;d||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==r||c!==l)&&Es(t,o,r,l),eo=!1;var f=t.memoizedState;o.state=f,so(t,r,o,i),c=t.memoizedState,s!==r||f!==c||Xi.current||eo?(typeof u==`function`&&(Ss(t,n,u,r),c=t.memoizedState),(s=eo||ws(t,n,s,r,f,c,l))?(d||typeof o.UNSAFE_componentWillMount!=`function`&&typeof o.componentWillMount!=`function`||(typeof o.componentWillMount==`function`&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount==`function`&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount==`function`&&(t.flags|=4194308)):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),o.props=r,o.state=c,o.context=l,r=s):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,no(e,t),s=t.memoizedProps,l=t.type===t.elementType?s:xs(t.type,s),o.props=l,d=t.pendingProps,f=o.context,c=n.contextType,typeof c==`object`&&c?c=Ya(c):(c=$i(n)?Zi:Yi.current,c=Qi(t,c));var p=n.getDerivedStateFromProps;(u=typeof p==`function`||typeof o.getSnapshotBeforeUpdate==`function`)||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==d||f!==c)&&Es(t,o,r,c),eo=!1,f=t.memoizedState,o.state=f,so(t,r,o,i);var m=t.memoizedState;s!==d||f!==m||Xi.current||eo?(typeof p==`function`&&(Ss(t,n,p,r),m=t.memoizedState),(l=eo||ws(t,n,l,r,f,m,c)||!1)?(u||typeof o.UNSAFE_componentWillUpdate!=`function`&&typeof o.componentWillUpdate!=`function`||(typeof o.componentWillUpdate==`function`&&o.componentWillUpdate(r,m,c),typeof o.UNSAFE_componentWillUpdate==`function`&&o.UNSAFE_componentWillUpdate(r,m,c)),typeof o.componentDidUpdate==`function`&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=m),o.props=r,o.state=m,o.context=c,r=l):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return qs(e,t,n,r,a,i)}function qs(e,t,n,r,i,a){Ws(e,t);var o=(t.flags&128)!=0;if(!r&&!o)return i&&ra(t,n,!1),oc(e,t,a);r=t.stateNode,Ls.current=t;var s=o&&typeof n.getDerivedStateFromError!=`function`?null:r.render();return t.flags|=1,e!==null&&o?(t.child=za(t,e.child,null,a),t.child=za(t,null,s,a)):zs(e,t,s,a),t.memoizedState=r.state,i&&ra(t,n,!0),t.child}function Js(e){var t=e.stateNode;t.pendingContext?ea(e,t.pendingContext,t.pendingContext!==t.context):t.context&&ea(e,t.context,!1),ho(e,t.containerInfo)}function Ys(e,t,n,r,i){return Ma(),Na(i),t.flags|=256,zs(e,t,n,r),t.child}var Xs={dehydrated:null,treeContext:null,retryLane:0};function Zs(e){return{baseLanes:e,cachePool:null,transitions:null}}function Qs(e,t,n){var r=t.pendingProps,i=yo.current,a=!1,o=(t.flags&128)!=0,s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:(i&2)!=0),s?(a=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),H(yo,i&1),e===null)return Oa(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data===`$!`?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(o=r.children,e=r.fallback,a?(r=t.mode,a=t.child,o={mode:`hidden`,children:o},!(r&1)&&a!==null?(a.childLanes=0,a.pendingProps=o):a=eu(o,r,0,null),e=$l(e,r,n,null),a.return=t,e.return=t,a.sibling=e,t.child=a,t.child.memoizedState=Zs(n),t.memoizedState=Xs,e):$s(t,o));if(i=e.memoizedState,i!==null&&(s=i.dehydrated,s!==null))return tc(e,t,o,r,s,i,n);if(a){a=r.fallback,o=t.mode,i=e.child,s=i.sibling;var c={mode:`hidden`,children:r.children};return!(o&1)&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=Zl(i,c),r.subtreeFlags=i.subtreeFlags&14680064),s===null?(a=$l(a,o,n,null),a.flags|=2):a=Zl(s,a),a.return=t,r.return=t,r.sibling=a,t.child=r,r=a,a=t.child,o=e.child.memoizedState,o=o===null?Zs(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},a.memoizedState=o,a.childLanes=e.childLanes&~n,t.memoizedState=Xs,r}return a=e.child,e=a.sibling,r=Zl(a,{mode:`visible`,children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function $s(e,t){return t=eu({mode:`visible`,children:t},e.mode,0,null),t.return=e,e.child=t}function ec(e,t,n,r){return r!==null&&Na(r),za(t,e.child,null,n),e=$s(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function tc(e,t,n,i,a,o,s){if(n)return t.flags&256?(t.flags&=-257,i=ks(Error(r(422))),ec(e,t,s,i)):t.memoizedState===null?(o=i.fallback,a=t.mode,i=eu({mode:`visible`,children:i.children},a,0,null),o=$l(o,a,s,null),o.flags|=2,i.return=t,o.return=t,i.sibling=o,t.child=i,t.mode&1&&za(t,e.child,null,s),t.child.memoizedState=Zs(s),t.memoizedState=Xs,o):(t.child=e.child,t.flags|=128,null);if(!(t.mode&1))return ec(e,t,s,null);if(a.data===`$!`){if(i=a.nextSibling&&a.nextSibling.dataset,i)var c=i.dgst;return i=c,o=Error(r(419)),i=ks(o,i,void 0),ec(e,t,s,i)}if(c=(s&e.childLanes)!==0,Rs||c){if(i=Gc,i!==null){switch(s&-s){case 4:a=2;break;case 16:a=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:a=32;break;case 536870912:a=268435456;break;default:a=0}a=(a&(i.suspendedLanes|s))===0?a:0,a!==0&&a!==o.retryLane&&(o.retryLane=a,$a(e,a),_l(i,e,a,-1))}return jl(),i=ks(Error(r(421))),ec(e,t,s,i)}return a.data===`$?`?(t.flags|=128,t.child=e.child,t=Ul.bind(null,e),a._reactRetry=t,null):(e=o.treeContext,wa=Mi(a.nextSibling),Ca=t,W=!0,Ta=null,e!==null&&(ma[ha++]=_a,ma[ha++]=va,ma[ha++]=ga,_a=e.id,va=e.overflow,ga=t),t=$s(t,i.children),t.flags|=4096,t)}function nc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),qa(e.return,t,n)}function rc(e,t,n,r,i){var a=e.memoizedState;a===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=r,a.tail=n,a.tailMode=i)}function ic(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;if(zs(e,t,r.children,n),r=yo.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&nc(e,n,t);else if(e.tag===19)nc(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}r&=1}if(H(yo,r),!(t.mode&1))t.memoizedState=null;else switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&bo(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),rc(t,!1,i,n,a);break;case`backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&bo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}rc(t,!0,n,null,a);break;case`together`:rc(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function ac(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function oc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Qc|=t.lanes,(n&t.childLanes)===0)return null;if(e!==null&&t.child!==e.child)throw Error(r(153));if(t.child!==null){for(e=t.child,n=Zl(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Zl(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function sc(e,t,n){switch(t.tag){case 3:Js(t),Ma();break;case 5:_o(t);break;case 1:$i(t.type)&&na(t);break;case 4:ho(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;H(Va,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(H(yo,yo.current&1),e=oc(e,t,n),e===null?null:e.sibling):Qs(e,t,n):(H(yo,yo.current&1),t.flags|=128,null);H(yo,yo.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return ic(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),H(yo,yo.current),r)break;return null;case 22:case 23:return t.lanes=0,Us(e,t,n)}return oc(e,t,n)}var cc=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},lc=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,mo(uo.current);var o=null;switch(n){case`input`:i=Ce(e,i),r=Ce(e,r),o=[];break;case`select`:i=O({},i,{value:void 0}),r=O({},r,{value:void 0}),o=[];break;case`textarea`:i=je(e,i),r=je(e,r),o=[];break;default:typeof i.onClick!=`function`&&typeof r.onClick==`function`&&(e.onclick=Si)}Ge(n,r);var s;for(u in n=null,i)if(!r.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null)if(u===`style`){var c=i[u];for(s in c)c.hasOwnProperty(s)&&(n||={},n[s]=``)}else u!==`dangerouslySetInnerHTML`&&u!==`children`&&u!==`suppressContentEditableWarning`&&u!==`suppressHydrationWarning`&&u!==`autoFocus`&&(a.hasOwnProperty(u)?o||=[]:(o||=[]).push(u,null));for(u in r){var l=r[u];if(c=i?.[u],r.hasOwnProperty(u)&&l!==c&&(l!=null||c!=null))if(u===`style`)if(c){for(s in c)!c.hasOwnProperty(s)||l&&l.hasOwnProperty(s)||(n||={},n[s]=``);for(s in l)l.hasOwnProperty(s)&&c[s]!==l[s]&&(n||={},n[s]=l[s])}else n||(o||=[],o.push(u,n)),n=l;else u===`dangerouslySetInnerHTML`?(l=l?l.__html:void 0,c=c?c.__html:void 0,l!=null&&c!==l&&(o||=[]).push(u,l)):u===`children`?typeof l!=`string`&&typeof l!=`number`||(o||=[]).push(u,``+l):u!==`suppressContentEditableWarning`&&u!==`suppressHydrationWarning`&&(a.hasOwnProperty(u)?(l!=null&&u===`onScroll`&&z(`scroll`,e),o||c===l||(o=[])):(o||=[]).push(u,l))}n&&(o||=[]).push(`style`,n);var u=o;(t.updateQueue=u)&&(t.flags|=4)}},uc=function(e,t,n,r){n!==r&&(t.flags|=4)};function dc(e,t){if(!W)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 fc(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&14680064,r|=i.flags&14680064,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 pc(e,t,n){var i=t.pendingProps;switch(Sa(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return fc(t),null;case 1:return $i(t.type)&&U(),fc(t),null;case 3:return i=t.stateNode,go(),V(Xi),V(Yi),So(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(Aa(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ta!==null&&(xl(Ta),Ta=null))),fc(t),null;case 5:vo(t);var o=mo(po.current);if(n=t.type,e!==null&&t.stateNode!=null)lc(e,t,n,i,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!i){if(t.stateNode===null)throw Error(r(166));return fc(t),null}if(e=mo(uo.current),Aa(t)){i=t.stateNode,n=t.type;var s=t.memoizedProps;switch(i[Fi]=t,i[Ii]=s,e=(t.mode&1)!=0,n){case`dialog`:z(`cancel`,i),z(`close`,i);break;case`iframe`:case`object`:case`embed`:z(`load`,i);break;case`video`:case`audio`:for(o=0;o<oi.length;o++)z(oi[o],i);break;case`source`:z(`error`,i);break;case`img`:case`image`:case`link`:z(`error`,i),z(`load`,i);break;case`details`:z(`toggle`,i);break;case`input`:we(i,s),z(`invalid`,i);break;case`select`:i._wrapperState={wasMultiple:!!s.multiple},z(`invalid`,i);break;case`textarea`:Me(i,s),z(`invalid`,i)}for(var c in Ge(n,s),o=null,s)if(s.hasOwnProperty(c)){var l=s[c];c===`children`?typeof l==`string`?i.textContent!==l&&(!0!==s.suppressHydrationWarning&&xi(i.textContent,l,e),o=[`children`,l]):typeof l==`number`&&i.textContent!==``+l&&(!0!==s.suppressHydrationWarning&&xi(i.textContent,l,e),o=[`children`,``+l]):a.hasOwnProperty(c)&&l!=null&&c===`onScroll`&&z(`scroll`,i)}switch(n){case`input`:be(i),De(i,s,!0);break;case`textarea`:be(i),Pe(i);break;case`select`:case`option`:break;default:typeof s.onClick==`function`&&(i.onclick=Si)}i=o,t.updateQueue=i,i!==null&&(t.flags|=4)}else{c=o.nodeType===9?o:o.ownerDocument,e===`http://www.w3.org/1999/xhtml`&&(e=Fe(n)),e===`http://www.w3.org/1999/xhtml`?n===`script`?(e=c.createElement(`div`),e.innerHTML=`<script><\/script>`,e=e.removeChild(e.firstChild)):typeof i.is==`string`?e=c.createElement(n,{is:i.is}):(e=c.createElement(n),n===`select`&&(c=e,i.multiple?c.multiple=!0:i.size&&(c.size=i.size))):e=c.createElementNS(e,n),e[Fi]=t,e[Ii]=i,cc(e,t,!1,!1),t.stateNode=e;a:{switch(c=Ke(n,i),n){case`dialog`:z(`cancel`,e),z(`close`,e),o=i;break;case`iframe`:case`object`:case`embed`:z(`load`,e),o=i;break;case`video`:case`audio`:for(o=0;o<oi.length;o++)z(oi[o],e);o=i;break;case`source`:z(`error`,e),o=i;break;case`img`:case`image`:case`link`:z(`error`,e),z(`load`,e),o=i;break;case`details`:z(`toggle`,e),o=i;break;case`input`:we(e,i),o=Ce(e,i),z(`invalid`,e);break;case`option`:o=i;break;case`select`:e._wrapperState={wasMultiple:!!i.multiple},o=O({},i,{value:void 0}),z(`invalid`,e);break;case`textarea`:Me(e,i),o=je(e,i),z(`invalid`,e);break;default:o=i}for(s in Ge(n,o),l=o,l)if(l.hasOwnProperty(s)){var u=l[s];s===`style`?Ue(e,u):s===`dangerouslySetInnerHTML`?(u=u?u.__html:void 0,u!=null&&Re(e,u)):s===`children`?typeof u==`string`?(n!==`textarea`||u!==``)&&ze(e,u):typeof u==`number`&&ze(e,``+u):s!==`suppressContentEditableWarning`&&s!==`suppressHydrationWarning`&&s!==`autoFocus`&&(a.hasOwnProperty(s)?u!=null&&s===`onScroll`&&z(`scroll`,e):u!=null&&S(e,s,u,c))}switch(n){case`input`:be(e),De(e,i,!1);break;case`textarea`:be(e),Pe(e);break;case`option`:i.value!=null&&e.setAttribute(`value`,``+_e(i.value));break;case`select`:e.multiple=!!i.multiple,s=i.value,s==null?i.defaultValue!=null&&Ae(e,!!i.multiple,i.defaultValue,!0):Ae(e,!!i.multiple,s,!1);break;default:typeof o.onClick==`function`&&(e.onclick=Si)}switch(n){case`button`:case`input`:case`select`:case`textarea`:i=!!i.autoFocus;break a;case`img`:i=!0;break a;default:i=!1}}i&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return fc(t),null;case 6:if(e&&t.stateNode!=null)uc(e,t,e.memoizedProps,i);else{if(typeof i!=`string`&&t.stateNode===null)throw Error(r(166));if(n=mo(po.current),mo(uo.current),Aa(t)){if(i=t.stateNode,n=t.memoizedProps,i[Fi]=t,(s=i.nodeValue!==n)&&(e=Ca,e!==null))switch(e.tag){case 3:xi(i.nodeValue,n,(e.mode&1)!=0);break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&xi(i.nodeValue,n,(e.mode&1)!=0)}s&&(t.flags|=4)}else i=(n.nodeType===9?n:n.ownerDocument).createTextNode(i),i[Fi]=t,t.stateNode=i}return fc(t),null;case 13:if(V(yo),i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(W&&wa!==null&&t.mode&1&&!(t.flags&128))ja(),Ma(),t.flags|=98560,s=!1;else if(s=Aa(t),i!==null&&i.dehydrated!==null){if(e===null){if(!s)throw Error(r(318));if(s=t.memoizedState,s=s===null?null:s.dehydrated,!s)throw Error(r(317));s[Fi]=t}else Ma(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;fc(t),s=!1}else Ta!==null&&(xl(Ta),Ta=null),s=!0;if(!s)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(i=i!==null,i!==(e!==null&&e.memoizedState!==null)&&i&&(t.child.flags|=8192,t.mode&1&&(e===null||yo.current&1?Xc===0&&(Xc=3):jl())),t.updateQueue!==null&&(t.flags|=4),fc(t),null);case 4:return go(),e===null&&fi(t.stateNode.containerInfo),fc(t),null;case 10:return Ka(t.type._context),fc(t),null;case 17:return $i(t.type)&&U(),fc(t),null;case 19:if(V(yo),s=t.memoizedState,s===null)return fc(t),null;if(i=(t.flags&128)!=0,c=s.rendering,c===null)if(i)dc(s,!1);else{if(Xc!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(c=bo(e),c!==null){for(t.flags|=128,dc(s,!1),i=c.updateQueue,i!==null&&(t.updateQueue=i,t.flags|=4),t.subtreeFlags=0,i=n,n=t.child;n!==null;)s=n,e=i,s.flags&=14680066,c=s.alternate,c===null?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=c.childLanes,s.lanes=c.lanes,s.child=c.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=c.memoizedProps,s.memoizedState=c.memoizedState,s.updateQueue=c.updateQueue,s.type=c.type,e=c.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return H(yo,yo.current&1|2),t.child}e=e.sibling}s.tail!==null&&Tt()>il&&(t.flags|=128,i=!0,dc(s,!1),t.lanes=4194304)}else{if(!i)if(e=bo(c),e!==null){if(t.flags|=128,i=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),dc(s,!0),s.tail===null&&s.tailMode===`hidden`&&!c.alternate&&!W)return fc(t),null}else 2*Tt()-s.renderingStartTime>il&&n!==1073741824&&(t.flags|=128,i=!0,dc(s,!1),t.lanes=4194304);s.isBackwards?(c.sibling=t.child,t.child=c):(n=s.last,n===null?t.child=c:n.sibling=c,s.last=c)}return s.tail===null?(fc(t),null):(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=Tt(),t.sibling=null,n=yo.current,H(yo,i?n&1|2:n&1),t);case 22:case 23:return Dl(),i=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(t.flags|=8192),i&&t.mode&1?Jc&1073741824&&(fc(t),t.subtreeFlags&6&&(t.flags|=8192)):fc(t),null;case 24:return null;case 25:return null}throw Error(r(156,t.tag))}function mc(e,t){switch(Sa(t),t.tag){case 1:return $i(t.type)&&U(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return go(),V(Xi),V(Yi),So(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return vo(t),null;case 13:if(V(yo),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));Ma()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return V(yo),null;case 4:return go(),null;case 10:return Ka(t.type._context),null;case 22:case 23:return Dl(),null;case 24:return null;default:return null}}var hc=!1,gc=!1,_c=typeof WeakSet==`function`?WeakSet:Set,K=null;function vc(e,t){var n=e.ref;if(n!==null)if(typeof n==`function`)try{n(null)}catch(n){Z(e,t,n)}else n.current=null}function yc(e,t,n){try{n()}catch(n){Z(e,t,n)}}var bc=!1;function xc(e,t){if(Ci=Cn,e=Lr(),Rr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(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(wi={focusedElem:e,selectionRange:n},Cn=!1,K=t;K!==null;)if(t=K,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,K=e;else for(;K!==null;){t=K;try{var h=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var g=h.memoizedProps,_=h.memoizedState,v=t.stateNode;v.__reactInternalSnapshotBeforeUpdate=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:xs(t.type,g),_)}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent=``:y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(e){Z(t,t.return,e)}if(e=t.sibling,e!==null){e.return=t.return,K=e;break}K=t.return}return h=bc,bc=!1,h}function Sc(e,t,n){var r=t.updateQueue;if(r=r===null?null:r.lastEffect,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,a!==void 0&&yc(t,n,a)}i=i.next}while(i!==r)}}function Cc(e,t){if(t=t.updateQueue,t=t===null?null:t.lastEffect,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function wc(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t==`function`?t(e):t.current=e}}function Tc(e){var t=e.alternate;t!==null&&(e.alternate=null,Tc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Fi],delete t[Ii],delete t[Ri],delete t[zi],delete t[Bi])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Ec(e){return e.tag===5||e.tag===3||e.tag===4}function q(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Ec(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.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 Dc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Si));else if(r!==4&&(e=e.child,e!==null))for(Dc(e,t,n),e=e.sibling;e!==null;)Dc(e,t,n),e=e.sibling}function Oc(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&&(e=e.child,e!==null))for(Oc(e,t,n),e=e.sibling;e!==null;)Oc(e,t,n),e=e.sibling}var J=null,kc=!1;function Ac(e,t,n){for(n=n.child;n!==null;)jc(e,t,n),n=n.sibling}function jc(e,t,n){if(Nt&&typeof Nt.onCommitFiberUnmount==`function`)try{Nt.onCommitFiberUnmount(Mt,n)}catch{}switch(n.tag){case 5:gc||vc(n,t);case 6:var r=J,i=kc;J=null,Ac(e,t,n),J=r,kc=i,J!==null&&(kc?(e=J,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):J.removeChild(n.stateNode));break;case 18:J!==null&&(kc?(e=J,n=n.stateNode,e.nodeType===8?ji(e.parentNode,n):e.nodeType===1&&ji(e,n),xn(e)):ji(J,n.stateNode));break;case 4:r=J,i=kc,J=n.stateNode.containerInfo,kc=!0,Ac(e,t,n),J=r,kc=i;break;case 0:case 11:case 14:case 15:if(!gc&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&yc(n,t,o),i=i.next}while(i!==r)}Ac(e,t,n);break;case 1:if(!gc&&(vc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){Z(n,t,e)}Ac(e,t,n);break;case 21:Ac(e,t,n);break;case 22:n.mode&1?(gc=(r=gc)||n.memoizedState!==null,Ac(e,t,n),gc=r):Ac(e,t,n);break;default:Ac(e,t,n)}}function Mc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new _c),t.forEach(function(t){var r=Wl.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function Nc(e,t){var n=t.deletions;if(n!==null)for(var i=0;i<n.length;i++){var a=n[i];try{var o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 5:J=c.stateNode,kc=!1;break a;case 3:J=c.stateNode.containerInfo,kc=!0;break a;case 4:J=c.stateNode.containerInfo,kc=!0;break a}c=c.return}if(J===null)throw Error(r(160));jc(o,s,a),J=null,kc=!1;var l=a.alternate;l!==null&&(l.return=null),a.return=null}catch(e){Z(a,t,e)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Pc(t,e),t=t.sibling}function Pc(e,t){var n=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Nc(t,e),Fc(e),i&4){try{Sc(3,e,e.return),Cc(3,e)}catch(t){Z(e,e.return,t)}try{Sc(5,e,e.return)}catch(t){Z(e,e.return,t)}}break;case 1:Nc(t,e),Fc(e),i&512&&n!==null&&vc(n,n.return);break;case 5:if(Nc(t,e),Fc(e),i&512&&n!==null&&vc(n,n.return),e.flags&32){var a=e.stateNode;try{ze(a,``)}catch(t){Z(e,e.return,t)}}if(i&4&&(a=e.stateNode,a!=null)){var o=e.memoizedProps,s=n===null?o:n.memoizedProps,c=e.type,l=e.updateQueue;if(e.updateQueue=null,l!==null)try{c===`input`&&o.type===`radio`&&o.name!=null&&Te(a,o),Ke(c,s);var u=Ke(c,o);for(s=0;s<l.length;s+=2){var d=l[s],f=l[s+1];d===`style`?Ue(a,f):d===`dangerouslySetInnerHTML`?Re(a,f):d===`children`?ze(a,f):S(a,d,f,u)}switch(c){case`input`:Ee(a,o);break;case`textarea`:Ne(a,o);break;case`select`:var p=a._wrapperState.wasMultiple;a._wrapperState.wasMultiple=!!o.multiple;var m=o.value;m==null?p!==!!o.multiple&&(o.defaultValue==null?Ae(a,!!o.multiple,o.multiple?[]:``,!1):Ae(a,!!o.multiple,o.defaultValue,!0)):Ae(a,!!o.multiple,m,!1)}a[Ii]=o}catch(t){Z(e,e.return,t)}}break;case 6:if(Nc(t,e),Fc(e),i&4){if(e.stateNode===null)throw Error(r(162));a=e.stateNode,o=e.memoizedProps;try{a.nodeValue=o}catch(t){Z(e,e.return,t)}}break;case 3:if(Nc(t,e),Fc(e),i&4&&n!==null&&n.memoizedState.isDehydrated)try{xn(t.containerInfo)}catch(t){Z(e,e.return,t)}break;case 4:Nc(t,e),Fc(e);break;case 13:Nc(t,e),Fc(e),a=e.child,a.flags&8192&&(o=a.memoizedState!==null,a.stateNode.isHidden=o,!o||a.alternate!==null&&a.alternate.memoizedState!==null||(rl=Tt())),i&4&&Mc(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(gc=(u=gc)||d,Nc(t,e),gc=u):Nc(t,e),Fc(e),i&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(K=e,d=e.child;d!==null;){for(f=K=d;K!==null;){switch(p=K,m=p.child,p.tag){case 0:case 11:case 14:case 15:Sc(4,p,p.return);break;case 1:vc(p,p.return);var h=p.stateNode;if(typeof h.componentWillUnmount==`function`){i=p,n=p.return;try{t=i,h.props=t.memoizedProps,h.state=t.memoizedState,h.componentWillUnmount()}catch(e){Z(i,n,e)}}break;case 5:vc(p,p.return);break;case 22:if(p.memoizedState!==null){zc(f);continue}}m===null?zc(f):(m.return=p,K=m)}d=d.sibling}a:for(d=null,f=e;;){if(f.tag===5){if(d===null){d=f;try{a=f.stateNode,u?(o=a.style,typeof o.setProperty==`function`?o.setProperty(`display`,`none`,`important`):o.display=`none`):(c=f.stateNode,l=f.memoizedProps.style,s=l!=null&&l.hasOwnProperty(`display`)?l.display:null,c.style.display=He(`display`,s))}catch(t){Z(e,e.return,t)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?``:f.memoizedProps}catch(t){Z(e,e.return,t)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break a;for(;f.sibling===null;){if(f.return===null||f.return===e)break a;d===f&&(d=null),f=f.return}d===f&&(d=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:Nc(t,e),Fc(e),i&4&&Mc(e);break;case 21:break;default:Nc(t,e),Fc(e)}}function Fc(e){var t=e.flags;if(t&2){try{a:{for(var n=e.return;n!==null;){if(Ec(n)){var i=n;break a}n=n.return}throw Error(r(160))}switch(i.tag){case 5:var a=i.stateNode;i.flags&32&&(ze(a,``),i.flags&=-33),Oc(e,q(e),a);break;case 3:case 4:var o=i.stateNode.containerInfo;Dc(e,q(e),o);break;default:throw Error(r(161))}}catch(t){Z(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Ic(e,t,n){K=e,Lc(e,t,n)}function Lc(e,t,n){for(var r=(e.mode&1)!=0;K!==null;){var i=K,a=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||hc;if(!o){var s=i.alternate,c=s!==null&&s.memoizedState!==null||gc;s=hc;var l=gc;if(hc=o,(gc=c)&&!l)for(K=i;K!==null;)o=K,c=o.child,o.tag===22&&o.memoizedState!==null||c===null?Bc(i):(c.return=o,K=c);for(;a!==null;)K=a,Lc(a,t,n),a=a.sibling;K=i,hc=s,gc=l}Rc(e,t,n)}else i.subtreeFlags&8772&&a!==null?(a.return=i,K=a):Rc(e,t,n)}}function Rc(e){for(;K!==null;){var t=K;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:gc||Cc(5,t);break;case 1:var i=t.stateNode;if(t.flags&4&&!gc)if(n===null)i.componentDidMount();else{var a=t.elementType===t.type?n.memoizedProps:xs(t.type,n.memoizedProps);i.componentDidUpdate(a,n.memoizedState,i.__reactInternalSnapshotBeforeUpdate)}var o=t.updateQueue;o!==null&&co(t,o,i);break;case 3:var s=t.updateQueue;if(s!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}co(t,s,n)}break;case 5:var c=t.stateNode;if(n===null&&t.flags&4){n=c;var l=t.memoizedProps;switch(t.type){case`button`:case`input`:case`select`:case`textarea`:l.autoFocus&&n.focus();break;case`img`:l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var f=d.dehydrated;f!==null&&xn(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}gc||t.flags&512&&wc(t)}catch(e){Z(t,t.return,e)}}if(t===e){K=null;break}if(n=t.sibling,n!==null){n.return=t.return,K=n;break}K=t.return}}function zc(e){for(;K!==null;){var t=K;if(t===e){K=null;break}var n=t.sibling;if(n!==null){n.return=t.return,K=n;break}K=t.return}}function Bc(e){for(;K!==null;){var t=K;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Cc(4,t)}catch(e){Z(t,n,e)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount==`function`){var i=t.return;try{r.componentDidMount()}catch(e){Z(t,i,e)}}var a=t.return;try{wc(t)}catch(e){Z(t,a,e)}break;case 5:var o=t.return;try{wc(t)}catch(e){Z(t,o,e)}}}catch(e){Z(t,t.return,e)}if(t===e){K=null;break}var s=t.sibling;if(s!==null){s.return=t.return,K=s;break}K=t.return}}var Vc=Math.ceil,Hc=C.ReactCurrentDispatcher,Uc=C.ReactCurrentOwner,Wc=C.ReactCurrentBatchConfig,Y=0,Gc=null,Kc=null,qc=0,Jc=0,Yc=qi(0),Xc=0,Zc=null,Qc=0,$c=0,el=0,tl=null,nl=null,rl=0,il=1/0,al=null,ol=!1,sl=null,cl=null,ll=!1,ul=null,dl=0,fl=0,X=null,pl=-1,ml=0;function hl(){return Y&6?Tt():pl===-1?pl=Tt():pl}function gl(e){return e.mode&1?Y&2&&qc!==0?qc&-qc:Pa.transition===null?(e=j,e===0?(e=window.event,e=e===void 0?16:kn(e.type),e):e):(ml===0&&(ml=Kt()),ml):1}function _l(e,t,n,i){if(50<fl)throw fl=0,X=null,Error(r(185));Jt(e,n,i),(!(Y&2)||e!==Gc)&&(e===Gc&&(!(Y&2)&&($c|=n),Xc===4&&Cl(e,qc)),vl(e,i),n===1&&Y===0&&!(t.mode&1)&&(il=Tt()+500,aa&&la()))}function vl(e,t){var n=e.callbackNode;Wt(e,t);var r=Ht(e,e===Gc?qc:0);if(r===0)n!==null&&St(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&St(n),t===1)e.tag===0?ca(wl.bind(null,e)):sa(wl.bind(null,e)),ki(function(){!(Y&6)&&la()}),n=null;else{switch(Zt(r)){case 1:n=Dt;break;case 4:n=Ot;break;case 16:n=kt;break;case 536870912:n=jt;break;default:n=kt}n=Kl(n,yl.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function yl(e,t){if(pl=-1,ml=0,Y&6)throw Error(r(327));var n=e.callbackNode;if(zl()&&e.callbackNode!==n)return null;var i=Ht(e,e===Gc?qc:0);if(i===0)return null;if(i&30||(i&e.expiredLanes)!==0||t)t=Ml(e,i);else{t=i;var a=Y;Y|=2;var o=Al();(Gc!==e||qc!==t)&&(al=null,il=Tt()+500,Ol(e,t));do try{Pl();break}catch(t){kl(e,t)}while(1);Ga(),Hc.current=o,Y=a,Kc===null?(Gc=null,qc=0,t=Xc):t=0}if(t!==0){if(t===2&&(a=Gt(e),a!==0&&(i=a,t=bl(e,a))),t===1)throw n=Zc,Ol(e,0),Cl(e,i),vl(e,Tt()),n;if(t===6)Cl(e,i);else{if(a=e.current.alternate,!(i&30)&&!Sl(a)&&(t=Ml(e,i),t===2&&(o=Gt(e),o!==0&&(i=o,t=bl(e,o))),t===1))throw n=Zc,Ol(e,0),Cl(e,i),vl(e,Tt()),n;switch(e.finishedWork=a,e.finishedLanes=i,t){case 0:case 1:throw Error(r(345));case 2:Ll(e,nl,al);break;case 3:if(Cl(e,i),(i&130023424)===i&&(t=rl+500-Tt(),10<t)){if(Ht(e,0)!==0)break;if(a=e.suspendedLanes,(a&i)!==i){hl(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=Ei(Ll.bind(null,e,nl,al),t);break}Ll(e,nl,al);break;case 4:if(Cl(e,i),(i&4194240)===i)break;for(t=e.eventTimes,a=-1;0<i;){var s=31-Ft(i);o=1<<s,s=t[s],s>a&&(a=s),i&=~o}if(i=a,i=Tt()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*Vc(i/1960))-i,10<i){e.timeoutHandle=Ei(Ll.bind(null,e,nl,al),i);break}Ll(e,nl,al);break;case 5:Ll(e,nl,al);break;default:throw Error(r(329))}}}return vl(e,Tt()),e.callbackNode===n?yl.bind(null,e):null}function bl(e,t){var n=tl;return e.current.memoizedState.isDehydrated&&(Ol(e,t).flags|=256),e=Ml(e,t),e!==2&&(t=nl,nl=n,t!==null&&xl(t)),e}function xl(e){nl===null?nl=e:nl.push.apply(nl,e)}function Sl(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(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(!Mr(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 Cl(e,t){for(t&=~el,t&=~$c,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Ft(t),r=1<<n;e[n]=-1,t&=~r}}function wl(e){if(Y&6)throw Error(r(327));zl();var t=Ht(e,0);if(!(t&1))return vl(e,Tt()),null;var n=Ml(e,t);if(e.tag!==0&&n===2){var i=Gt(e);i!==0&&(t=i,n=bl(e,i))}if(n===1)throw n=Zc,Ol(e,0),Cl(e,t),vl(e,Tt()),n;if(n===6)throw Error(r(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Ll(e,nl,al),vl(e,Tt()),null}function Tl(e,t){var n=Y;Y|=1;try{return e(t)}finally{Y=n,Y===0&&(il=Tt()+500,aa&&la())}}function El(e){ul!==null&&ul.tag===0&&!(Y&6)&&zl();var t=Y;Y|=1;var n=Wc.transition,r=j;try{if(Wc.transition=null,j=1,e)return e()}finally{j=r,Wc.transition=n,Y=t,!(Y&6)&&la()}}function Dl(){Jc=Yc.current,V(Yc)}function Ol(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,Di(n)),Kc!==null)for(n=Kc.return;n!==null;){var r=n;switch(Sa(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&U();break;case 3:go(),V(Xi),V(Yi),So();break;case 5:vo(r);break;case 4:go();break;case 13:V(yo);break;case 19:V(yo);break;case 10:Ka(r.type._context);break;case 22:case 23:Dl()}n=n.return}if(Gc=e,Kc=e=Zl(e.current,null),qc=Jc=t,Xc=0,Zc=null,el=$c=Qc=0,nl=tl=null,Xa!==null){for(t=0;t<Xa.length;t++)if(n=Xa[t],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,a=n.pending;if(a!==null){var o=a.next;a.next=i,r.next=o}n.pending=r}Xa=null}return e}function kl(e,t){do{var n=Kc;try{if(Ga(),Co.current=_s,ko){for(var i=Eo.memoizedState;i!==null;){var a=i.queue;a!==null&&(a.pending=null),i=i.next}ko=!1}if(To=0,Oo=Do=Eo=null,Ao=!1,jo=0,Uc.current=null,n===null||n.return===null){Xc=1,Zc=t,Kc=null;break}a:{var o=e,s=n.return,c=n,l=t;if(t=qc,c.flags|=32768,typeof l==`object`&&l&&typeof l.then==`function`){var u=l,d=c,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===15)){var p=d.alternate;p?(d.updateQueue=p.updateQueue,d.memoizedState=p.memoizedState,d.lanes=p.lanes):(d.updateQueue=null,d.memoizedState=null)}var m=Fs(s);if(m!==null){m.flags&=-257,Is(m,s,c,o,t),m.mode&1&&Ps(o,u,t),t=m,l=u;var h=t.updateQueue;if(h===null){var g=new Set;g.add(l),t.updateQueue=g}else h.add(l);break a}else{if(!(t&1)){Ps(o,u,t),jl();break a}l=Error(r(426))}}else if(W&&c.mode&1){var _=Fs(s);if(_!==null){!(_.flags&65536)&&(_.flags|=256),Is(_,s,c,o,t),Na(Os(l,c));break a}}o=l=Os(l,c),Xc!==4&&(Xc=2),tl===null?tl=[o]:tl.push(o),o=s;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var v=Ms(o,l,t);oo(o,v);break a;case 1:c=l;var y=o.type,b=o.stateNode;if(!(o.flags&128)&&(typeof y.getDerivedStateFromError==`function`||b!==null&&typeof b.componentDidCatch==`function`&&(cl===null||!cl.has(b)))){o.flags|=65536,t&=-t,o.lanes|=t;var x=Ns(o,c,t);oo(o,x);break a}}o=o.return}while(o!==null)}Il(n)}catch(e){t=e,Kc===n&&n!==null&&(Kc=n=n.return);continue}break}while(1)}function Al(){var e=Hc.current;return Hc.current=_s,e===null?_s:e}function jl(){(Xc===0||Xc===3||Xc===2)&&(Xc=4),Gc===null||!(Qc&268435455)&&!($c&268435455)||Cl(Gc,qc)}function Ml(e,t){var n=Y;Y|=2;var i=Al();(Gc!==e||qc!==t)&&(al=null,Ol(e,t));do try{Nl();break}catch(t){kl(e,t)}while(1);if(Ga(),Y=n,Hc.current=i,Kc!==null)throw Error(r(261));return Gc=null,qc=0,Xc}function Nl(){for(;Kc!==null;)Fl(Kc)}function Pl(){for(;Kc!==null&&!Ct();)Fl(Kc)}function Fl(e){var t=Gl(e.alternate,e,Jc);e.memoizedProps=e.pendingProps,t===null?Il(e):Kc=t,Uc.current=null}function Il(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=mc(n,t),n!==null){n.flags&=32767,Kc=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Xc=6,Kc=null;return}}else if(n=pc(n,t,Jc),n!==null){Kc=n;return}if(t=t.sibling,t!==null){Kc=t;return}Kc=t=e}while(t!==null);Xc===0&&(Xc=5)}function Ll(e,t,n){var r=j,i=Wc.transition;try{Wc.transition=null,j=1,Rl(e,t,n,r)}finally{Wc.transition=i,j=r}return null}function Rl(e,t,n,i){do zl();while(ul!==null);if(Y&6)throw Error(r(327));n=e.finishedWork;var a=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(r(177));e.callbackNode=null,e.callbackPriority=0;var o=n.lanes|n.childLanes;if(Yt(e,o),e===Gc&&(Kc=Gc=null,qc=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||ll||(ll=!0,Kl(kt,function(){return zl(),null})),o=(n.flags&15990)!=0,n.subtreeFlags&15990||o){o=Wc.transition,Wc.transition=null;var s=j;j=1;var c=Y;Y|=4,Uc.current=null,xc(e,n),Pc(n,e),zr(wi),Cn=!!Ci,wi=Ci=null,e.current=n,Ic(n,e,a),wt(),Y=c,j=s,Wc.transition=o}else e.current=n;if(ll&&(ll=!1,ul=e,dl=a),o=e.pendingLanes,o===0&&(cl=null),Pt(n.stateNode,i),vl(e,Tt()),t!==null)for(i=e.onRecoverableError,n=0;n<t.length;n++)a=t[n],i(a.value,{componentStack:a.stack,digest:a.digest});if(ol)throw ol=!1,e=sl,sl=null,e;return dl&1&&e.tag!==0&&zl(),o=e.pendingLanes,o&1?e===X?fl++:(fl=0,X=e):fl=0,la(),null}function zl(){if(ul!==null){var e=Zt(dl),t=Wc.transition,n=j;try{if(Wc.transition=null,j=16>e?16:e,ul===null)var i=!1;else{if(e=ul,ul=null,dl=0,Y&6)throw Error(r(331));var a=Y;for(Y|=4,K=e.current;K!==null;){var o=K,s=o.child;if(K.flags&16){var c=o.deletions;if(c!==null){for(var l=0;l<c.length;l++){var u=c[l];for(K=u;K!==null;){var d=K;switch(d.tag){case 0:case 11:case 15:Sc(8,d,o)}var f=d.child;if(f!==null)f.return=d,K=f;else for(;K!==null;){d=K;var p=d.sibling,m=d.return;if(Tc(d),d===u){K=null;break}if(p!==null){p.return=m,K=p;break}K=m}}}var h=o.alternate;if(h!==null){var g=h.child;if(g!==null){h.child=null;do{var _=g.sibling;g.sibling=null,g=_}while(g!==null)}}K=o}}if(o.subtreeFlags&2064&&s!==null)s.return=o,K=s;else b:for(;K!==null;){if(o=K,o.flags&2048)switch(o.tag){case 0:case 11:case 15:Sc(9,o,o.return)}var v=o.sibling;if(v!==null){v.return=o.return,K=v;break b}K=o.return}}var y=e.current;for(K=y;K!==null;){s=K;var b=s.child;if(s.subtreeFlags&2064&&b!==null)b.return=s,K=b;else b:for(s=y;K!==null;){if(c=K,c.flags&2048)try{switch(c.tag){case 0:case 11:case 15:Cc(9,c)}}catch(e){Z(c,c.return,e)}if(c===s){K=null;break b}var x=c.sibling;if(x!==null){x.return=c.return,K=x;break b}K=c.return}}if(Y=a,la(),Nt&&typeof Nt.onPostCommitFiberRoot==`function`)try{Nt.onPostCommitFiberRoot(Mt,e)}catch{}i=!0}return i}finally{j=n,Wc.transition=t}}return!1}function Bl(e,t,n){t=Os(n,t),t=Ms(e,t,1),e=io(e,t,1),t=hl(),e!==null&&(Jt(e,1,t),vl(e,t))}function Z(e,t,n){if(e.tag===3)Bl(e,e,n);else for(;t!==null;){if(t.tag===3){Bl(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(cl===null||!cl.has(r))){e=Os(n,e),e=Ns(t,e,1),t=io(t,e,1),e=hl(),t!==null&&(Jt(t,1,e),vl(t,e));break}}t=t.return}}function Vl(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=hl(),e.pingedLanes|=e.suspendedLanes&n,Gc===e&&(qc&n)===n&&(Xc===4||Xc===3&&(qc&130023424)===qc&&500>Tt()-rl?Ol(e,0):el|=n),vl(e,t)}function Hl(e,t){t===0&&(e.mode&1?(t=Bt,Bt<<=1,!(Bt&130023424)&&(Bt=4194304)):t=1);var n=hl();e=$a(e,t),e!==null&&(Jt(e,t,n),vl(e,n))}function Ul(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Hl(e,n)}function Wl(e,t){var n=0;switch(e.tag){case 13:var i=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(r(314))}i!==null&&i.delete(t),Hl(e,n)}var Gl=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Xi.current)Rs=!0;else{if((e.lanes&n)===0&&!(t.flags&128))return Rs=!1,sc(e,t,n);Rs=!!(e.flags&131072)}else Rs=!1,W&&t.flags&1048576&&ba(t,pa,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;ac(e,t),e=t.pendingProps;var a=Qi(t,Yi.current);Ja(t,n),a=Fo(null,t,i,e,a,n);var o=Io();return t.flags|=1,typeof a==`object`&&a&&typeof a.render==`function`&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,$i(i)?(o=!0,na(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,to(t),a.updater=Cs,t.stateNode=a,a._reactInternals=t,Ds(t,i,e,n),t=qs(null,t,i,!0,o,n)):(t.tag=0,W&&o&&xa(t),zs(null,t,a,n),t=t.child),t;case 16:i=t.elementType;a:{switch(ac(e,t),e=t.pendingProps,a=i._init,i=a(i._payload),t.type=i,a=t.tag=Xl(i),e=xs(i,e),a){case 0:t=Gs(null,t,i,e,n);break a;case 1:t=Ks(null,t,i,e,n);break a;case 11:t=Bs(null,t,i,e,n);break a;case 14:t=Vs(null,t,i,xs(i.type,e),n);break a}throw Error(r(306,i,``))}return t;case 0:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:xs(i,a),Gs(e,t,i,a,n);case 1:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:xs(i,a),Ks(e,t,i,a,n);case 3:a:{if(Js(t),e===null)throw Error(r(387));i=t.pendingProps,o=t.memoizedState,a=o.element,no(e,t),so(t,i,null,n);var s=t.memoizedState;if(i=s.element,o.isDehydrated)if(o={element:i,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){a=Os(Error(r(423)),t),t=Ys(e,t,i,n,a);break a}else if(i!==a){a=Os(Error(r(424)),t),t=Ys(e,t,i,n,a);break a}else for(wa=Mi(t.stateNode.containerInfo.firstChild),Ca=t,W=!0,Ta=null,n=Ba(t,null,i,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Ma(),i===a){t=oc(e,t,n);break a}zs(e,t,i,n)}t=t.child}return t;case 5:return _o(t),e===null&&Oa(t),i=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,s=a.children,Ti(i,a)?s=null:o!==null&&Ti(i,o)&&(t.flags|=32),Ws(e,t),zs(e,t,s,n),t.child;case 6:return e===null&&Oa(t),null;case 13:return Qs(e,t,n);case 4:return ho(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=za(t,null,i,n):zs(e,t,i,n),t.child;case 11:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:xs(i,a),Bs(e,t,i,a,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:a:{if(i=t.type._context,a=t.pendingProps,o=t.memoizedProps,s=a.value,H(Va,i._currentValue),i._currentValue=s,o!==null)if(Mr(o.value,s)){if(o.children===a.children&&!Xi.current){t=oc(e,t,n);break a}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var c=o.dependencies;if(c!==null){s=o.child;for(var l=c.firstContext;l!==null;){if(l.context===i){if(o.tag===1){l=ro(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),qa(o.return,n,t),c.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(r(341));s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),qa(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}zs(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,i=t.pendingProps.children,Ja(t,n),a=Ya(a),i=i(a),t.flags|=1,zs(e,t,i,n),t.child;case 14:return i=t.type,a=xs(i,t.pendingProps),a=xs(i.type,a),Vs(e,t,i,a,n);case 15:return Hs(e,t,t.type,t.pendingProps,n);case 17:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:xs(i,a),ac(e,t),t.tag=1,$i(i)?(e=!0,na(t)):e=!1,Ja(t,n),Ts(t,i,a),Ds(t,i,a,n),qs(null,t,i,!0,e,n);case 19:return ic(e,t,n);case 22:return Us(e,t,n)}throw Error(r(156,t.tag))};function Kl(e,t){return xt(e,t)}function ql(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.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 Jl(e,t,n,r){return new ql(e,t,n,r)}function Yl(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Xl(e){if(typeof e==`function`)return+!!Yl(e);if(e!=null){if(e=e.$$typeof,e===re)return 11;if(e===oe)return 14}return 2}function Zl(e,t){var n=e.alternate;return n===null?(n=Jl(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&14680064,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}function Ql(e,t,n,i,a,o){var s=2;if(i=e,typeof e==`function`)Yl(e)&&(s=1);else if(typeof e==`string`)s=5;else a:switch(e){case E:return $l(n.children,a,o,t);case D:s=8,a|=8;break;case ee:return e=Jl(12,n,t,a|2),e.elementType=ee,e.lanes=o,e;case ie:return e=Jl(13,n,t,a),e.elementType=ie,e.lanes=o,e;case ae:return e=Jl(19,n,t,a),e.elementType=ae,e.lanes=o,e;case ce:return eu(n,a,o,t);default:if(typeof e==`object`&&e)switch(e.$$typeof){case te:s=10;break a;case ne:s=9;break a;case re:s=11;break a;case oe:s=14;break a;case se:s=16,i=null;break a}throw Error(r(130,e==null?e:typeof e,``))}return t=Jl(s,n,t,a),t.elementType=e,t.type=i,t.lanes=o,t}function $l(e,t,n,r){return e=Jl(7,e,r,t),e.lanes=n,e}function eu(e,t,n,r){return e=Jl(22,e,r,t),e.elementType=ce,e.lanes=n,e.stateNode={isHidden:!1},e}function tu(e,t,n){return e=Jl(6,e,null,t),e.lanes=n,e}function nu(e,t,n){return t=Jl(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function ru(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=qt(0),this.expirationTimes=qt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=qt(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function iu(e,t,n,r,i,a,o,s,c){return e=new ru(e,t,n,s,c),t===1?(t=1,!0===a&&(t|=8)):t=0,a=Jl(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},to(a),e}function au(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:T,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}function ou(e){if(!e)return Ji;e=e._reactInternals;a:{if(ht(e)!==e||e.tag!==1)throw Error(r(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break a;case 1:if($i(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break a}}t=t.return}while(t!==null);throw Error(r(171))}if(e.tag===1){var n=e.type;if($i(n))return ta(e,n,t)}return t}function su(e,t,n,r,i,a,o,s,c){return e=iu(n,r,!0,e,i,a,o,s,c),e.context=ou(null),n=e.current,r=hl(),i=gl(n),a=ro(r,i),a.callback=t??null,io(n,a,i),e.current.lanes=i,Jt(e,i,r),vl(e,r),e}function cu(e,t,n,r){var i=t.current,a=hl(),o=gl(i);return n=ou(n),t.context===null?t.context=n:t.pendingContext=n,t=ro(a,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=io(i,t,o),e!==null&&(_l(e,i,o,a),ao(e,i,o)),o}function lu(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function uu(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function du(e,t){uu(e,t),(e=e.alternate)&&uu(e,t)}function fu(){return null}var pu=typeof reportError==`function`?reportError:function(e){console.error(e)};function mu(e){this._internalRoot=e}hu.prototype.render=mu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(r(409));cu(e,t,null,null)},hu.prototype.unmount=mu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;El(function(){cu(null,e,null,null)}),t[Li]=null}};function hu(e){this._internalRoot=e}hu.prototype.unstable_scheduleHydration=function(e){if(e){var t=tn();e={blockedOn:null,target:e,priority:t};for(var n=0;n<dn.length&&t!==0&&t<dn[n].priority;n++);dn.splice(n,0,e),n===0&&gn(e)}};function gu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function _u(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==` react-mount-point-unstable `))}function vu(){}function yu(e,t,n,r,i){if(i){if(typeof r==`function`){var a=r;r=function(){var e=lu(o);a.call(e)}}var o=su(t,r,e,0,null,!1,!1,``,vu);return e._reactRootContainer=o,e[Li]=o.current,fi(e.nodeType===8?e.parentNode:e),El(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof r==`function`){var s=r;r=function(){var e=lu(c);s.call(e)}}var c=iu(e,0,!1,null,null,!1,!1,``,vu);return e._reactRootContainer=c,e[Li]=c.current,fi(e.nodeType===8?e.parentNode:e),El(function(){cu(t,c,n,r)}),c}function bu(e,t,n,r,i){var a=n._reactRootContainer;if(a){var o=a;if(typeof i==`function`){var s=i;i=function(){var e=lu(o);s.call(e)}}cu(t,o,e,i)}else o=yu(n,t,e,i,r);return lu(o)}Qt=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Vt(t.pendingLanes);n!==0&&(Xt(t,n|1),vl(t,Tt()),!(Y&6)&&(il=Tt()+500,la()))}break;case 13:El(function(){var t=$a(e,1);t!==null&&_l(t,e,1,hl())}),du(e,1)}},$t=function(e){if(e.tag===13){var t=$a(e,134217728);t!==null&&_l(t,e,134217728,hl()),du(e,134217728)}},en=function(e){if(e.tag===13){var t=gl(e),n=$a(e,t);n!==null&&_l(n,e,t,hl()),du(e,t)}},tn=function(){return j},nn=function(e,t){var n=j;try{return j=e,t()}finally{j=n}},Ye=function(e,t,n){switch(t){case`input`:if(Ee(e,n),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name=`+JSON.stringify(``+t)+`][type="radio"]`),t=0;t<n.length;t++){var i=n[t];if(i!==e&&i.form===e.form){var a=Wi(i);if(!a)throw Error(r(90));xe(i),Ee(i,a)}}}break;case`textarea`:Ne(e,n);break;case`select`:t=n.value,t!=null&&Ae(e,!!n.multiple,t,!1)}},et=Tl,tt=El;var xu={usingClientEntryPoint:!1,Events:[Hi,Ui,Wi,Qe,$e,Tl]},Su={findFiberByHostInstance:Vi,bundleType:0,version:`18.3.1`,rendererPackageName:`react-dom`},Cu={bundleType:Su.bundleType,version:Su.version,rendererPackageName:Su.rendererPackageName,rendererConfig:Su.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:C.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=yt(e),e===null?null:e.stateNode},findFiberByHostInstance:Su.findFiberByHostInstance||fu,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:`18.3.1-next-f1338f8080-20240426`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var wu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!wu.isDisabled&&wu.supportsFiber)try{Mt=wu.inject(Cu),Nt=wu}catch{}}e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=xu,e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!gu(t))throw Error(r(200));return au(e,t,null,n)},e.createRoot=function(e,t){if(!gu(e))throw Error(r(299));var n=!1,i=``,a=pu;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onRecoverableError!==void 0&&(a=t.onRecoverableError)),t=iu(e,1,!1,null,null,n,!1,i,a),e[Li]=t.current,fi(e.nodeType===8?e.parentNode:e),new mu(t)},e.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(r(188)):(e=Object.keys(e).join(`,`),Error(r(268,e)));return e=yt(t),e=e===null?null:e.stateNode,e},e.flushSync=function(e){return El(e)},e.hydrate=function(e,t,n){if(!_u(t))throw Error(r(200));return bu(null,e,t,!0,n)},e.hydrateRoot=function(e,t,n){if(!gu(e))throw Error(r(405));var i=n!=null&&n.hydratedSources||null,a=!1,o=``,s=pu;if(n!=null&&(!0===n.unstable_strictMode&&(a=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=su(t,null,e,1,n??null,a,!1,o,s),e[Li]=t.current,fi(e),i)for(e=0;e<i.length;e++)n=i[e],a=n._getVersion,a=a(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,a]:t.mutableSourceEagerHydrationData.push(n,a);return new hu(t)},e.render=function(e,t,n){if(!_u(t))throw Error(r(200));return bu(null,e,t,!1,n)},e.unmountComponentAtNode=function(e){if(!_u(e))throw Error(r(40));return e._reactRootContainer?(El(function(){bu(null,null,e,!1,function(){e._reactRootContainer=null,e[Li]=null})}),!0):!1},e.unstable_batchedUpdates=Tl,e.unstable_renderSubtreeIntoContainer=function(e,t,n,i){if(!_u(n))throw Error(r(200));if(e==null||e._reactInternals===void 0)throw Error(r(38));return bu(e,t,n,!1,i)},e.version=`18.3.1-next-f1338f8080-20240426`})),m=o(((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=p()})),h=o((e=>{var t=m();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot})),g=c(u()),_=c(h(),1);m();function v(){return v=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},v.apply(this,arguments)}var y;(function(e){e.Pop=`POP`,e.Push=`PUSH`,e.Replace=`REPLACE`})(y||={});var b=`popstate`;function x(e){e===void 0&&(e={});function t(e,t){let{pathname:n,search:r,hash:i}=e.location;return E(``,{pathname:n,search:r,hash:i},t.state&&t.state.usr||null,t.state&&t.state.key||`default`)}function n(e,t){return typeof t==`string`?t:D(t)}return te(t,n,null,e)}function S(e,t){if(e===!1||e==null)throw Error(t)}function C(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function w(){return Math.random().toString(36).substr(2,8)}function T(e,t){return{usr:e.state,key:e.key,idx:t}}function E(e,t,n,r){return n===void 0&&(n=null),v({pathname:typeof e==`string`?e:e.pathname,search:``,hash:``},typeof t==`string`?ee(t):t,{state:n,key:t&&t.key||r||w()})}function D(e){let{pathname:t=`/`,search:n=``,hash:r=``}=e;return n&&n!==`?`&&(t+=n.charAt(0)===`?`?n:`?`+n),r&&r!==`#`&&(t+=r.charAt(0)===`#`?r:`#`+r),t}function ee(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function te(e,t,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=y.Pop,c=null,l=u();l??(l=0,o.replaceState(v({},o.state,{idx:l}),``));function u(){return(o.state||{idx:null}).idx}function d(){s=y.Pop;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=y.Push;let r=E(h.location,e,t);n&&n(r,e),l=u()+1;let d=T(r,l),f=h.createHref(r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=y.Replace;let r=E(h.location,e,t);n&&n(r,e),l=u();let i=T(r,l),d=h.createHref(r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){let t=i.location.origin===`null`?i.location.href:i.location.origin,n=typeof e==`string`?e:D(e);return n=n.replace(/ $/,`%20`),S(t,`No window.location.(origin|href) available to create URL for href: `+n),new URL(n,t)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(b,d),c=e,()=>{i.removeEventListener(b,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}var ne;(function(e){e.data=`data`,e.deferred=`deferred`,e.redirect=`redirect`,e.error=`error`})(ne||={});function re(e,t,n){return n===void 0&&(n=`/`),ie(e,t,n,!1)}function ie(e,t,n,r){let i=ye((typeof t==`string`?ee(t):t).pathname||`/`,n);if(i==null)return null;let a=ae(e);se(a);let o=null;for(let e=0;o==null&&e<a.length;++e){let t=ve(i);o=he(a[e],t,r)}return o}function ae(e,t,n,r){t===void 0&&(t=[]),n===void 0&&(n=[]),r===void 0&&(r=``);let i=(e,i,a)=>{let o={relativePath:a===void 0?e.path||``:a,caseSensitive:e.caseSensitive===!0,childrenIndex:i,route:e};o.relativePath.startsWith(`/`)&&(S(o.relativePath.startsWith(r),`Absolute route path "`+o.relativePath+`" nested under path `+(`"`+r+`" is not valid. An absolute child route path `)+`must start with the combined path of all its parent routes.`),o.relativePath=o.relativePath.slice(r.length));let s=Oe([r,o.relativePath]),c=n.concat(o);e.children&&e.children.length>0&&(S(e.index!==!0,`Index routes must not have child routes. Please remove `+(`all child routes from route path "`+s+`".`)),ae(e.children,t,c,s)),!(e.path==null&&!e.index)&&t.push({path:s,score:pe(s,e.index),routesMeta:c})};return e.forEach((e,t)=>{var n;if(e.path===``||!((n=e.path)!=null&&n.includes(`?`)))i(e,t);else for(let n of oe(e.path))i(e,t,n)}),t}function oe(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=oe(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function se(e){e.sort((e,t)=>e.score===t.score?me(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var ce=/^:[\w-]+$/,le=3,ue=2,O=1,de=10,k=-2,fe=e=>e===`*`;function pe(e,t){let n=e.split(`/`),r=n.length;return n.some(fe)&&(r+=k),t&&(r+=ue),n.filter(e=>!fe(e)).reduce((e,t)=>e+(ce.test(t)?le:t===``?O:de),r)}function me(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function he(e,t,n){n===void 0&&(n=!1);let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u=ge({path:s.relativePath,caseSensitive:s.caseSensitive,end:c},l),d=s.route;if(!u&&c&&n&&!r[r.length-1].route.index&&(u=ge({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!u)return null;Object.assign(i,u.params),o.push({params:i,pathname:Oe([a,u.pathname]),pathnameBase:ke(Oe([a,u.pathnameBase])),route:d}),u.pathnameBase!==`/`&&(a=Oe([a,u.pathnameBase]))}return o}function ge(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=_e(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,t,n)=>{let{paramName:r,isOptional:i}=t;if(r===`*`){let e=s[n]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let c=s[n];return i&&!c?e[r]=void 0:e[r]=(c||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function _e(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),C(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "`+e+`" will be treated as if it were `+(`"`+e.replace(/\*$/,`/*`)+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+(`please change the route path to "`+e.replace(/\*$/,`/*`)+`".`));let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n)=>(r.push({paramName:t,isOptional:n!=null}),n?`/?([^\\/]+)?`:`/([^\\/]+)`));return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function ve(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return C(!1,`The URL path "`+e+`" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent `+(`encoding (`+t+`).`)),e}}function ye(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}var be=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,xe=e=>be.test(e);function Se(e,t){t===void 0&&(t=`/`);let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?ee(e):e,a;if(n)if(xe(n))a=n;else{if(n.includes(`//`)){let e=n;n=n.replace(/\/\/+/g,`/`),C(!1,`Pathnames cannot have embedded double slashes - normalizing `+(e+` -> `+n))}a=n.startsWith(`/`)?Ce(n.substring(1),`/`):Ce(n,t)}else a=t;return{pathname:a,search:Ae(r),hash:je(i)}}function Ce(e,t){let n=t.replace(/\/+$/,``).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function we(e,t,n,r){return`Cannot include a '`+e+`' character in a manually specified `+("`to."+t+"` field ["+JSON.stringify(r)+`]. Please separate it out to the `)+("`to."+n+"` field. Alternatively you may provide the full path as ")+`a string in <Link to="..."> and the router will parse it for you.`}function Te(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function Ee(e,t){let n=Te(e);return t?n.map((e,t)=>t===n.length-1?e.pathname:e.pathnameBase):n.map(e=>e.pathnameBase)}function De(e,t,n,r){r===void 0&&(r=!1);let i;typeof e==`string`?i=ee(e):(i=v({},e),S(!i.pathname||!i.pathname.includes(`?`),we(`?`,`pathname`,`search`,i)),S(!i.pathname||!i.pathname.includes(`#`),we(`#`,`pathname`,`hash`,i)),S(!i.search||!i.search.includes(`#`),we(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=Se(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var Oe=e=>e.join(`/`).replace(/\/\/+/g,`/`),ke=e=>e.replace(/\/+$/,``).replace(/^\/*/,`/`),Ae=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,je=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e;function Me(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}var Ne=[`post`,`put`,`patch`,`delete`];new Set(Ne);var Pe=[`get`,...Ne];new Set(Pe);function Fe(){return Fe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Fe.apply(this,arguments)}var Ie=g.createContext(null),Le=g.createContext(null),Re=g.createContext(null),ze=g.createContext(null),Be=g.createContext({outlet:null,matches:[],isDataRoute:!1}),Ve=g.createContext(null);function He(e,t){let{relative:n}=t===void 0?{}:t;!Ue()&&S(!1);let{basename:r,navigator:i}=g.useContext(Re),{hash:a,pathname:o,search:s}=A(e,{relative:n}),c=o;return r!==`/`&&(c=o===`/`?r:Oe([r,o])),i.createHref({pathname:c,search:s,hash:a})}function Ue(){return g.useContext(ze)!=null}function We(){return!Ue()&&S(!1),g.useContext(ze).location}function Ge(e){g.useContext(Re).static||g.useLayoutEffect(e)}function Ke(){let{isDataRoute:e}=g.useContext(Be);return e?dt():qe()}function qe(){!Ue()&&S(!1);let e=g.useContext(Ie),{basename:t,future:n,navigator:r}=g.useContext(Re),{matches:i}=g.useContext(Be),{pathname:a}=We(),o=JSON.stringify(Ee(i,n.v7_relativeSplatPath)),s=g.useRef(!1);return Ge(()=>{s.current=!0}),g.useCallback(function(n,i){if(i===void 0&&(i={}),!s.current)return;if(typeof n==`number`){r.go(n);return}let c=De(n,JSON.parse(o),a,i.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:Oe([t,c.pathname])),(i.replace?r.replace:r.push)(c,i.state,i)},[t,r,o,a,e])}var Je=g.createContext(null);function Ye(e){let t=g.useContext(Be).outlet;return t&&g.createElement(Je.Provider,{value:e},t)}function Xe(){let{matches:e}=g.useContext(Be),t=e[e.length-1];return t?t.params:{}}function A(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=g.useContext(Re),{matches:i}=g.useContext(Be),{pathname:a}=We(),o=JSON.stringify(Ee(i,r.v7_relativeSplatPath));return g.useMemo(()=>De(e,JSON.parse(o),a,n===`path`),[e,o,a,n])}function Ze(e,t){return Qe(e,t)}function Qe(e,t,n,r){!Ue()&&S(!1);let{navigator:i}=g.useContext(Re),{matches:a}=g.useContext(Be),o=a[a.length-1],s=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:`/`;o&&o.route;let l=We(),u;if(t){let e=typeof t==`string`?ee(t):t;!(c===`/`||e.pathname?.startsWith(c))&&S(!1),u=e}else u=l;let d=u.pathname||`/`,f=d;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);f=`/`+d.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let p=re(e,{pathname:f}),m=rt(p&&p.map(e=>Object.assign({},e,{params:Object.assign({},s,e.params),pathname:Oe([c,i.encodeLocation?i.encodeLocation(e.pathname).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:Oe([c,i.encodeLocation?i.encodeLocation(e.pathnameBase).pathname:e.pathnameBase])})),a,n,r);return t&&m?g.createElement(ze.Provider,{value:{location:Fe({pathname:`/`,search:``,hash:``,state:null,key:`default`},u),navigationType:y.Pop}},m):m}function $e(){let e=ut(),t=Me(e)?e.status+` `+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null;return g.createElement(g.Fragment,null,g.createElement(`h2`,null,`Unexpected Application Error!`),g.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?g.createElement(`pre`,{style:{padding:`0.5rem`,backgroundColor:`rgba(200,200,200, 0.5)`}},n):null,null)}var et=g.createElement($e,null),tt=class extends g.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){console.error(`React Router caught the following error during render`,e,t)}render(){return this.state.error===void 0?this.props.children:g.createElement(Be.Provider,{value:this.props.routeContext},g.createElement(Ve.Provider,{value:this.state.error,children:this.props.component}))}};function nt(e){let{routeContext:t,match:n,children:r}=e,i=g.useContext(Ie);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),g.createElement(Be.Provider,{value:t},r)}function rt(e,t,n,r){if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var i;if(!n)return null;if(n.errors)e=n.matches;else if((i=r)!=null&&i.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let a=e,o=n?.errors;if(o!=null){let e=a.findIndex(e=>e.route.id&&o?.[e.route.id]!==void 0);!(e>=0)&&S(!1),a=a.slice(0,Math.min(a.length,e+1))}let s=!1,c=-1;if(n&&r&&r.v7_partialHydration)for(let e=0;e<a.length;e++){let t=a[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(c=e),t.route.id){let{loaderData:e,errors:r}=n,i=t.route.loader&&e[t.route.id]===void 0&&(!r||r[t.route.id]===void 0);if(t.route.lazy||i){s=!0,a=c>=0?a.slice(0,c+1):[a[0]];break}}}return a.reduceRight((e,r,i)=>{let l,u=!1,d=null,f=null;n&&(l=o&&r.route.id?o[r.route.id]:void 0,d=r.route.errorElement||et,s&&(c<0&&i===0?(pt(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),u=!0,f=null):c===i&&(u=!0,f=r.route.hydrateFallbackElement||null)));let p=t.concat(a.slice(0,i+1)),m=()=>{let t;return t=l?d:u?f:r.route.Component?g.createElement(r.route.Component,null):r.route.element?r.route.element:e,g.createElement(nt,{match:r,routeContext:{outlet:e,matches:p,isDataRoute:n!=null},children:t})};return n&&(r.route.ErrorBoundary||r.route.errorElement||i===0)?g.createElement(tt,{location:n.location,revalidation:n.revalidation,component:d,error:l,children:m(),routeContext:{outlet:null,matches:p,isDataRoute:!0}}):m()},null)}var it=function(e){return e.UseBlocker=`useBlocker`,e.UseRevalidator=`useRevalidator`,e.UseNavigateStable=`useNavigate`,e}(it||{}),at=function(e){return e.UseBlocker=`useBlocker`,e.UseLoaderData=`useLoaderData`,e.UseActionData=`useActionData`,e.UseRouteError=`useRouteError`,e.UseNavigation=`useNavigation`,e.UseRouteLoaderData=`useRouteLoaderData`,e.UseMatches=`useMatches`,e.UseRevalidator=`useRevalidator`,e.UseNavigateStable=`useNavigate`,e.UseRouteId=`useRouteId`,e}(at||{});function ot(e){let t=g.useContext(Ie);return!t&&S(!1),t}function st(e){let t=g.useContext(Le);return!t&&S(!1),t}function ct(e){let t=g.useContext(Be);return!t&&S(!1),t}function lt(e){let t=ct(e),n=t.matches[t.matches.length-1];return!n.route.id&&S(!1),n.route.id}function ut(){let e=g.useContext(Ve),t=st(at.UseRouteError),n=lt(at.UseRouteError);return e===void 0?t.errors?.[n]:e}function dt(){let{router:e}=ot(it.UseNavigateStable),t=lt(at.UseNavigateStable),n=g.useRef(!1);return Ge(()=>{n.current=!0}),g.useCallback(function(r,i){i===void 0&&(i={}),n.current&&(typeof r==`number`?e.navigate(r):e.navigate(r,Fe({fromRouteId:t},i)))},[e,t])}var ft={};function pt(e,t,n){!t&&!ft[e]&&(ft[e]=!0)}var mt=(e,t,n)=>(``+t+("You can use the `"+e+"` future flag to opt-in early. ")+(`For more information, see `+n+`.`),void 0);function ht(e,t){e?.v7_startTransition===void 0&&mt(`v7_startTransition`,"React Router will begin wrapping state updates in `React.startTransition` in v7",`https://reactrouter.com/v6/upgrading/future#v7_starttransition`),e?.v7_relativeSplatPath===void 0&&(!t||t.v7_relativeSplatPath===void 0)&&mt(`v7_relativeSplatPath`,`Relative route resolution within Splat routes is changing in v7`,`https://reactrouter.com/v6/upgrading/future#v7_relativesplatpath`),t&&(t.v7_fetcherPersist===void 0&&mt(`v7_fetcherPersist`,`The persistence behavior of fetchers is changing in v7`,`https://reactrouter.com/v6/upgrading/future#v7_fetcherpersist`),t.v7_normalizeFormMethod===void 0&&mt(`v7_normalizeFormMethod`,"Casing of `formMethod` fields is being normalized to uppercase in v7",`https://reactrouter.com/v6/upgrading/future#v7_normalizeformmethod`),t.v7_partialHydration===void 0&&mt(`v7_partialHydration`,"`RouterProvider` hydration behavior is changing in v7",`https://reactrouter.com/v6/upgrading/future#v7_partialhydration`),t.v7_skipActionErrorRevalidation===void 0&&mt(`v7_skipActionErrorRevalidation`,"The revalidation behavior after 4xx/5xx `action` responses is changing in v7",`https://reactrouter.com/v6/upgrading/future#v7_skipactionerrorrevalidation`))}function gt(e){return Ye(e.context)}function _t(e){S(!1)}function vt(e){let{basename:t=`/`,children:n=null,location:r,navigationType:i=y.Pop,navigator:a,static:o=!1,future:s}=e;Ue()&&S(!1);let c=t.replace(/^\/*/,`/`),l=g.useMemo(()=>({basename:c,navigator:a,static:o,future:Fe({v7_relativeSplatPath:!1},s)}),[c,s,a,o]);typeof r==`string`&&(r=ee(r));let{pathname:u=`/`,search:d=``,hash:f=``,state:p=null,key:m=`default`}=r,h=g.useMemo(()=>{let e=ye(u,c);return e==null?null:{location:{pathname:e,search:d,hash:f,state:p,key:m},navigationType:i}},[c,u,d,f,p,m,i]);return h==null?null:g.createElement(Re.Provider,{value:l},g.createElement(ze.Provider,{children:n,value:h}))}function yt(e){let{children:t,location:n}=e;return Ze(xt(t),n)}var bt=function(e){return e[e.pending=0]=`pending`,e[e.success=1]=`success`,e[e.error=2]=`error`,e}(bt||{});new Promise(()=>{}),g.Component;function xt(e,t){t===void 0&&(t=[]);let n=[];return g.Children.forEach(e,(e,r)=>{if(!g.isValidElement(e))return;let i=[...t,r];if(e.type===g.Fragment){n.push.apply(n,xt(e.props.children,i));return}e.type!==_t&&S(!1),!(!e.props.index||!e.props.children)&&S(!1);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,loader:e.props.loader,action:e.props.action,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=xt(e.props.children,i)),n.push(a)}),n}function St(){return St=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},St.apply(this,arguments)}function Ct(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}function wt(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Tt(e,t){return e.button===0&&(!t||t===`_self`)&&!wt(e)}var Et=[`onClick`,`relative`,`reloadDocument`,`replace`,`state`,`target`,`to`,`preventScrollReset`,`viewTransition`],Dt=[`aria-current`,`caseSensitive`,`className`,`end`,`style`,`to`,`viewTransition`,`children`],Ot=`6`;try{window.__reactRouterVersion=Ot}catch{}var kt=g.createContext({isTransitioning:!1}),At=g.startTransition;function jt(e){let{basename:t,children:n,future:r,window:i}=e,a=g.useRef();a.current??=x({window:i,v5Compat:!0});let o=a.current,[s,c]=g.useState({action:o.action,location:o.location}),{v7_startTransition:l}=r||{},u=g.useCallback(e=>{l&&At?At(()=>c(e)):c(e)},[c,l]);return g.useLayoutEffect(()=>o.listen(u),[o,u]),g.useEffect(()=>ht(r),[r]),g.createElement(vt,{basename:t,children:n,location:s.location,navigationType:s.action,navigator:o,future:r})}var Mt=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,Nt=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Pt=g.forwardRef(function(e,t){let{onClick:n,relative:r,reloadDocument:i,replace:a,state:o,target:s,to:c,preventScrollReset:l,viewTransition:u}=e,d=Ct(e,Et),{basename:f}=g.useContext(Re),p,m=!1;if(typeof c==`string`&&Nt.test(c)&&(p=c,Mt))try{let e=new URL(window.location.href),t=c.startsWith(`//`)?new URL(e.protocol+c):new URL(c),n=ye(t.pathname,f);t.origin===e.origin&&n!=null?c=n+t.search+t.hash:m=!0}catch{}let h=He(c,{relative:r}),_=zt(c,{replace:a,state:o,target:s,preventScrollReset:l,relative:r,viewTransition:u});function v(e){n&&n(e),e.defaultPrevented||_(e)}return g.createElement(`a`,St({},d,{href:p||h,onClick:m||i?n:v,ref:t,target:s}))}),Ft=g.forwardRef(function(e,t){let{"aria-current":n=`page`,caseSensitive:r=!1,className:i=``,end:a=!1,style:o,to:s,viewTransition:c,children:l}=e,u=Ct(e,Dt),d=A(s,{relative:u.relative}),f=We(),p=g.useContext(Le),{navigator:m,basename:h}=g.useContext(Re),_=p!=null&&Bt(d)&&c===!0,v=m.encodeLocation?m.encodeLocation(d).pathname:d.pathname,y=f.pathname,b=p&&p.navigation&&p.navigation.location?p.navigation.location.pathname:null;r||(y=y.toLowerCase(),b=b?b.toLowerCase():null,v=v.toLowerCase()),b&&h&&(b=ye(b,h)||b);let x=v!==`/`&&v.endsWith(`/`)?v.length-1:v.length,S=y===v||!a&&y.startsWith(v)&&y.charAt(x)===`/`,C=b!=null&&(b===v||!a&&b.startsWith(v)&&b.charAt(v.length)===`/`),w={isActive:S,isPending:C,isTransitioning:_},T=S?n:void 0,E;E=typeof i==`function`?i(w):[i,S?`active`:null,C?`pending`:null,_?`transitioning`:null].filter(Boolean).join(` `);let D=typeof o==`function`?o(w):o;return g.createElement(Pt,St({},u,{"aria-current":T,className:E,ref:t,style:D,to:s,viewTransition:c}),typeof l==`function`?l(w):l)}),It;(function(e){e.UseScrollRestoration=`useScrollRestoration`,e.UseSubmit=`useSubmit`,e.UseSubmitFetcher=`useSubmitFetcher`,e.UseFetcher=`useFetcher`,e.useViewTransitionState=`useViewTransitionState`})(It||={});var Lt;(function(e){e.UseFetcher=`useFetcher`,e.UseFetchers=`useFetchers`,e.UseScrollRestoration=`useScrollRestoration`})(Lt||={});function Rt(e){let t=g.useContext(Ie);return!t&&S(!1),t}function zt(e,t){let{target:n,replace:r,state:i,preventScrollReset:a,relative:o,viewTransition:s}=t===void 0?{}:t,c=Ke(),l=We(),u=A(e,{relative:o});return g.useCallback(t=>{Tt(t,n)&&(t.preventDefault(),c(e,{replace:r===void 0?D(l)===D(u):r,state:i,preventScrollReset:a,relative:o,viewTransition:s}))},[l,c,u,r,i,n,e,a,o,s])}function Bt(e,t){t===void 0&&(t={});let n=g.useContext(kt);n??S(!1);let{basename:r}=Rt(It.useViewTransitionState),i=A(e,{relative:t.relative});if(!n.isTransitioning)return!1;let a=ye(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=ye(n.nextLocation.pathname,r)||n.nextLocation.pathname;return ge(i.pathname,o)!=null||ge(i.pathname,a)!=null}var Vt=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Ht=new class extends Vt{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},Ut={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Wt=new class{#e=Ut;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function Gt(e){setTimeout(e,0)}var Kt=typeof window>`u`||`Deno`in globalThis;function qt(){}function Jt(e,t){return typeof e==`function`?e(t):e}function Yt(e){return typeof e==`number`&&e>=0&&e!==1/0}function Xt(e,t){return Math.max(e+(t||0)-Date.now(),0)}function j(e,t){return typeof e==`function`?e(t):e}function Zt(e,t){return typeof e==`function`?e(t):e}function Qt(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==en(o,t.options))return!1}else if(!nn(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function $t(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(tn(t.options.mutationKey)!==tn(a))return!1}else if(!nn(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function en(e,t){return(t?.queryKeyHashFn||tn)(e)}function tn(e){return JSON.stringify(e,(e,t)=>cn(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function nn(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>nn(e[n],t[n])):!1}var rn=Object.prototype.hasOwnProperty;function an(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=sn(e)&&sn(t);if(!r&&!(cn(e)&&cn(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:rn.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=an(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function on(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function sn(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function cn(e){if(!ln(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!ln(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function ln(e){return Object.prototype.toString.call(e)===`[object Object]`}function un(e){return new Promise(t=>{Wt.setTimeout(t,e)})}function dn(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:an(e,t)}function fn(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function pn(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var mn=Symbol();function hn(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===mn?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function gn(e,t){return typeof e==`function`?e(...t):!!e}function _n(e,t,n){let r=!1,i;return Object.defineProperty(e,`signal`,{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var vn=(()=>{let e=()=>Kt;return{isServer(){return e()},setIsServer(t){e=t}}})();function yn(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var bn=Gt;function xn(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=bn,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var Sn=xn(),Cn=new class extends Vt{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function wn(e){return Math.min(1e3*2**e,3e4)}function Tn(e){return(e??`online`)===`online`?Cn.isOnline():!0}var En=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Dn(e){let t=!1,n=0,r,i=yn(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new En(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>Ht.isFocused()&&(e.networkMode===`always`||Cn.isOnline())&&e.canRun(),u=()=>Tn(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(vn.isServer()?0:3),o=e.retryDelay??wn,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){f(r);return}n++,e.onFail?.(n,r),un(s).then(()=>l()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var On=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Yt(this.gcTime)&&(this.#e=Wt.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(vn.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(Wt.clearTimeout(this.#e),this.#e=void 0)}};function kn(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{_n(e,()=>t.signal,()=>n=!0)},u=hn(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?pn:fn;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?jn:An,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:An(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function An(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function jn(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function Mn(e,t){return t?An(e,t)!=null:!1}function Nn(e,t){return!t||!e.getPreviousPageParam?!1:jn(e,t)!=null}var Pn=class extends On{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Ln(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Ln(this.options);e.data!==void 0&&(this.setState(In(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=dn(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(qt).catch(qt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>Zt(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===mn||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>j(e.options.staleTime,this)===`static`):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!Xt(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,`signal`,{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=hn(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?kn(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=Dn({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof En&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof En){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...Fn(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...In(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),Sn.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Fn(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Tn(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function In(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Ln(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var Rn=class extends Vt{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=yn(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Bn(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Vn(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Vn(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof Zt(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!on(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Hn(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||Zt(this.options.enabled,this.#t)!==Zt(t.enabled,this.#t)||j(this.options.staleTime,this.#t)!==j(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||Zt(this.options.enabled,this.#t)!==Zt(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return Wn(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(qt)),t}#g(){this.#b();let e=j(this.options.staleTime,this.#t);if(vn.isServer()||this.#r.isStale||!Yt(e))return;let t=Xt(this.#r.dataUpdatedAt,e)+1;this.#d=Wt.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(vn.isServer()||Zt(this.options.enabled,this.#t)===!1||!Yt(this.#p)||this.#p===0)&&(this.#f=Wt.setInterval(()=>{(this.options.refetchIntervalInBackground||Ht.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(Wt.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(Wt.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Bn(e,t),o=i&&Hn(e,n,t,r);(a||o)&&(l={...l,...Fn(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=dn(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=dn(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0,x={status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Un(e,t),refetch:this.refetch,promise:this.#o,isEnabled:Zt(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=x.data!==void 0,r=x.status===`error`&&!t,i=e=>{r?e.reject(x.error):t&&e.resolve(x.data)},a=()=>{i(this.#o=x.promise=yn())},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||x.data!==o.value)&&a();break;case`rejected`:(!r||x.error!==o.reason)&&a();break}}return x}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!on(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){Sn.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function zn(e,t){return Zt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&Zt(t.retryOnMount,e)===!1)}function Bn(e,t){return zn(e,t)||e.state.data!==void 0&&Vn(e,t,t.refetchOnMount)}function Vn(e,t,n){if(Zt(t.enabled,e)!==!1&&j(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&Un(e,t)}return!1}function Hn(e,t,n,r){return(e!==t||Zt(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Un(e,n)}function Un(e,t){return Zt(t.enabled,e)!==!1&&e.isStaleByTime(j(t.staleTime,e))}function Wn(e,t){return!on(e.getCurrentResult(),t)}var Gn=class extends Rn{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:Mn(t,n.data),hasPreviousPage:Nn(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},Kn=class extends On{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||qn(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=Dn({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),Sn.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function qn(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Jn=class extends Vt{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new Kn({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=Yn(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=Yn(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Yn(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=Yn(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Sn.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>$t(t,e))}findAll(e={}){return this.getAll().filter(t=>$t(e,t))}notify(e){Sn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Sn.batch(()=>Promise.all(e.map(e=>e.continue().catch(qt))))}};function Yn(e){return e.options.scope?.id}var Xn=class extends Vt{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),on(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&tn(t.mutationKey)!==tn(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??qn();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){Sn.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},Zn=class extends Vt{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??en(r,t),a=this.get(i);return a||(a=new Pn({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){Sn.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Qt(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Qt(e,t)):t}notify(e){Sn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Sn.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Sn.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Qn=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Zn,this.#t=e.mutationCache||new Jn,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Ht.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Cn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(j(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=Jt(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return Sn.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;Sn.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Sn.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=Sn.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(qt).catch(qt)}invalidateQueries(e,t={}){return Sn.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=Sn.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(qt)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(qt)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(j(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(qt).catch(qt)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(qt).catch(qt)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Cn.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(tn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{nn(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(tn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{nn(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=en(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===mn&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},$n=o((e=>{var t=u(),n=Symbol.for(`react.element`),r=Symbol.for(`react.fragment`),i=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,r){var s,c={},l=null,u=null;for(s in r!==void 0&&(l=``+r),t.key!==void 0&&(l=``+t.key),t.ref!==void 0&&(u=t.ref),t)i.call(t,s)&&!o.hasOwnProperty(s)&&(c[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)c[s]===void 0&&(c[s]=t[s]);return{$$typeof:n,type:e,key:l,ref:u,props:c,_owner:a.current}}e.Fragment=r,e.jsx=s,e.jsxs=s})),M=o(((e,t)=>{t.exports=$n()}))(),er=g.createContext(void 0),N=e=>{let t=g.useContext(er);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},tr=({client:e,children:t})=>(g.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,M.jsx)(er.Provider,{value:e,children:t})),nr=g.createContext(!1),rr=()=>g.useContext(nr);nr.Provider;function ir(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var ar=g.createContext(ir()),or=()=>g.useContext(ar),sr=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?gn(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},cr=e=>{g.useEffect(()=>{e.clearReset()},[e])},lr=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||gn(n,[e.error,r])),ur=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},dr=(e,t)=>e.isLoading&&e.isFetching&&!t,fr=(e,t)=>e?.suspense&&t.isPending,pr=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function mr(e,t,n){let r=rr(),i=or(),a=N(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash);o._optimisticResults=r?`isRestoring`:`optimistic`,ur(o),sr(o,i,s),cr(i);let c=!a.getQueryCache().get(o.queryHash),[l]=g.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&e.subscribed!==!1;if(g.useSyncExternalStore(g.useCallback(e=>{let t=d?l.subscribe(Sn.batchCalls(e)):qt;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),g.useEffect(()=>{l.setOptions(o)},[o,l]),fr(o,u))throw pr(o,l,i);if(lr({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,u),o.experimental_prefetchInRender&&!vn.isServer()&&dr(u,r)&&(c?pr(o,l,i):s?.promise)?.catch(qt).finally(()=>{l.updateResult()}),o.notifyOnChangeProps?u:l.trackResult(u)}function P(e,t){return mr(e,Rn,t)}function F(e,t){let n=N(t),[r]=g.useState(()=>new Xn(n,e));g.useEffect(()=>{r.setOptions(e)},[r,e]);let i=g.useSyncExternalStore(g.useCallback(e=>r.subscribe(Sn.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=g.useCallback((e,t)=>{r.mutate(e,t).catch(qt)},[r]);if(i.error&&gn(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function hr(e,t){return mr(e,Gn,t)}var gr=`lamaste:2fa-required`;function _r(e,t){let n=e.error||`Request failed with status ${t}`,r=(Array.isArray(e.details?.issues)?e.details.issues:[]).filter(e=>typeof e?.message==`string`).map(e=>Array.isArray(e.path)&&e.path.length>0?`${e.path.join(`.`)}: ${e.message}`:e.message);return r.length>0?`${n}: ${[...new Set(r)].join(`; `)}`:n}async function I(e,t){let n=await fetch(e,t);if(n.status===401)try{if((await n.clone().json()).error===`2fa_required`)throw window.dispatchEvent(new CustomEvent(gr)),Error(`2fa_required`)}catch(e){if(e.message===`2fa_required`)throw e}if(!n.ok){let e=await n.json().catch(()=>null),t=typeof e==`object`&&e?e:{};throw Object.assign(Error(_r(t,n.status)),{status:n.status,...typeof t.code==`string`?{code:t.code}:{},...Array.isArray(t.reasons)?{reasons:t.reasons}:{},...typeof t.operationId==`string`?{operationId:t.operationId}:{}})}return n.json()}async function vr(){return I(`/api/onboarding/status`)}function yr(){let{data:e,isLoading:t,isError:n,error:r,refetch:i}=P({queryKey:[`onboarding`,`status`],queryFn:vr,staleTime:3e4,retry:2,refetchOnWindowFocus:!0});return{status:e?.status,domain:e?.domain??null,ip:e?.ip??null,isLoading:t,isError:n,error:r,refetch:i}}var br=(0,g.createContext)(null);function L(){let e=(0,g.useContext)(br);if(!e)throw Error(`useAdminClient must be used within an AdminClientProvider`);return e}function xr({client:e,children:t}){return(0,M.jsx)(br.Provider,{value:e,children:t})}var Sr=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),Cr=(...e)=>e.filter((e,t,n)=>!!e&&n.indexOf(e)===t).join(` `),wr={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`},Tr=(0,g.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,g.createElement)(`svg`,{ref:c,...wr,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Cr(`lucide`,i),...s},[...o.map(([e,t])=>(0,g.createElement)(e,t)),...Array.isArray(a)?a:[a]])),R=(e,t)=>{let n=(0,g.forwardRef)(({className:n,...r},i)=>(0,g.createElement)(Tr,{ref:i,iconNode:t,className:Cr(`lucide-${Sr(e)}`,n),...r}));return n.displayName=`${e}`,n},Er=R(`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`}]]),Dr=R(`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`}]]),Or=R(`ArrowDown`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),kr=R(`ArrowLeft`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),Ar=R(`BarChart3`,[[`path`,{d:`M3 3v18h18`,key:`1s2lah`}],[`path`,{d:`M18 17V9`,key:`2bz60n`}],[`path`,{d:`M13 17V5`,key:`1frdt8`}],[`path`,{d:`M8 17v-3`,key:`17ska0`}]]),jr=R(`Bell`,[[`path`,{d:`M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9`,key:`1qo2s2`}],[`path`,{d:`M10.3 21a1.94 1.94 0 0 0 3.4 0`,key:`qgo35s`}]]),Mr=R(`BookOpen`,[[`path`,{d:`M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z`,key:`vv98re`}],[`path`,{d:`M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z`,key:`1cyq3y`}]]),Nr=R(`Box`,[[`path`,{d:`M21 8a2 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.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]),Pr=R(`CheckCheck`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),Fr=R(`Check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Ir=R(`ChevronDown`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Lr=R(`ChevronLeft`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Rr=R(`ChevronRight`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),zr=R(`ChevronUp`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Br=R(`CircleAlert`,[[`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`}]]),Vr=R(`CircleCheckBig`,[[`path`,{d:`M22 11.08V12a10 10 0 1 1-5.93-9.14`,key:`g774vq`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),Hr=R(`CircleCheck`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Ur=R(`CircleX`,[[`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`}]]),Wr=R(`Circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Gr=R(`Clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16 14`,key:`68esgv`}]]),Kr=R(`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`}]]),qr=R(`Cpu`,[[`rect`,{width:`16`,height:`16`,x:`4`,y:`4`,rx:`2`,key:`14l7u7`}],[`rect`,{width:`6`,height:`6`,x:`9`,y:`9`,rx:`1`,key:`5aljv4`}],[`path`,{d:`M15 2v2`,key:`13l42r`}],[`path`,{d:`M15 20v2`,key:`15mkzm`}],[`path`,{d:`M2 15h2`,key:`1gxd5l`}],[`path`,{d:`M2 9h2`,key:`1bbxkp`}],[`path`,{d:`M20 15h2`,key:`19e6y8`}],[`path`,{d:`M20 9h2`,key:`19tzq7`}],[`path`,{d:`M9 2v2`,key:`165o2o`}],[`path`,{d:`M9 20v2`,key:`i2bqo8`}]]),Jr=R(`Database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),Yr=R(`Download`,[[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`polyline`,{points:`7 10 12 15 17 10`,key:`2ggqvy`}],[`line`,{x1:`12`,x2:`12`,y1:`15`,y2:`3`,key:`1vk2je`}]]),Xr=R(`Eraser`,[[`path`,{d:`m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21`,key:`182aya`}],[`path`,{d:`M22 21H7`,key:`t4ddhn`}],[`path`,{d:`m5 11 9 9`,key:`1mo9qw`}]]),Zr=R(`ExternalLink`,[[`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`}]]),Qr=R(`EyeOff`,[[`path`,{d:`M9.88 9.88a3 3 0 1 0 4.24 4.24`,key:`1jxqfv`}],[`path`,{d:`M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68`,key:`9wicm4`}],[`path`,{d:`M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61`,key:`1jreej`}],[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}]]),$r=R(`Eye`,[[`path`,{d:`M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z`,key:`rwhkz3`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),ei=R(`FileText`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),ti=R(`File`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}]]),ni=R(`Fingerprint`,[[`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`}]]),ri=R(`FolderOpen`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),ii=R(`Folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),ai=R(`GitBranch`,[[`line`,{x1:`6`,x2:`6`,y1:`3`,y2:`15`,key:`17qcm7`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`path`,{d:`M18 9a9 9 0 0 1-9 9`,key:`n2h4wq`}]]),oi=R(`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`}]]),si=R(`HardDrive`,[[`line`,{x1:`22`,x2:`2`,y1:`12`,y2:`12`,key:`1y58io`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}],[`line`,{x1:`6`,x2:`6.01`,y1:`16`,y2:`16`,key:`sgf278`}],[`line`,{x1:`10`,x2:`10.01`,y1:`16`,y2:`16`,key:`1l4acy`}]]),ci=R(`Heart`,[[`path`,{d:`M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z`,key:`c3ymky`}]]),li=R(`Home`,[[`path`,{d:`m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`y5dka4`}],[`polyline`,{points:`9 22 9 12 15 12 15 22`,key:`e2us08`}]]),z=R(`KeyRound`,[[`path`,{d:`M2 18v3c0 .6.4 1 1 1h4v-3h3v-3h2l1.4-1.4a6.5 6.5 0 1 0-4-4Z`,key:`167ctg`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),ui=R(`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`}]]),di=R(`Layers`,[[`path`,{d:`m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z`,key:`8b97xw`}],[`path`,{d:`m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65`,key:`dd6zsq`}],[`path`,{d:`m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65`,key:`ep9fru`}]]),fi=R(`LayoutDashboard`,[[`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`}]]),pi=R(`Link2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),mi=R(`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`}]]),hi=R(`List`,[[`line`,{x1:`8`,x2:`21`,y1:`6`,y2:`6`,key:`7ey8pc`}],[`line`,{x1:`8`,x2:`21`,y1:`12`,y2:`12`,key:`rjfblc`}],[`line`,{x1:`8`,x2:`21`,y1:`18`,y2:`18`,key:`c3b1m8`}],[`line`,{x1:`3`,x2:`3.01`,y1:`6`,y2:`6`,key:`1g7gq3`}],[`line`,{x1:`3`,x2:`3.01`,y1:`12`,y2:`12`,key:`1pjlvk`}],[`line`,{x1:`3`,x2:`3.01`,y1:`18`,y2:`18`,key:`28t2mc`}]]),B=R(`LoaderCircle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),gi=R(`LockOpen`,[[`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`}]]),_i=R(`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`}]]),vi=R(`Mail`,[[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}],[`path`,{d:`m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7`,key:`1ocrg3`}]]),yi=R(`Map`,[[`path`,{d:`M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z`,key:`169xi5`}],[`path`,{d:`M15 5.764v15`,key:`1pn4in`}],[`path`,{d:`M9 3.236v15`,key:`1uimfh`}]]),bi=R(`Menu`,[[`line`,{x1:`4`,x2:`20`,y1:`12`,y2:`12`,key:`1e0a9i`}],[`line`,{x1:`4`,x2:`20`,y1:`6`,y2:`6`,key:`1owob3`}],[`line`,{x1:`4`,x2:`20`,y1:`18`,y2:`18`,key:`yk5zj1`}]]),xi=R(`Minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),Si=R(`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`}]]),Ci=R(`Package`,[[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}],[`path`,{d:`M21 8a2 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.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]),wi=R(`Pencil`,[[`path`,{d:`M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z`,key:`5qss01`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),Ti=R(`Play`,[[`polygon`,{points:`6 3 20 12 6 21 6 3`,key:`1oa8hb`}]]),Ei=R(`Plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Di=R(`PowerOff`,[[`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`}]]),Oi=R(`Power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),ki=R(`RefreshCw`,[[`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`}]]),Ai=R(`RotateCw`,[[`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`}]]),ji=R(`ScrollText`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),Mi=R(`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`}]]),Ni=R(`Settings2`,[[`path`,{d:`M20 7h-9`,key:`3s1dr2`}],[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),Pi=R(`Settings`,[[`path`,{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z`,key:`1qme2f`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Fi=R(`ShieldAlert`,[[`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:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),Ii=R(`ShieldCheck`,[[`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`}]]),Li=R(`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`}]]),Ri=R(`Square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),zi=R(`Terminal`,[[`polyline`,{points:`4 17 10 11 4 5`,key:`akl6gq`}],[`line`,{x1:`12`,x2:`20`,y1:`19`,y2:`19`,key:`q2wloq`}]]),Bi=R(`Ticket`,[[`path`,{d:`M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z`,key:`qn84l0`}],[`path`,{d:`M13 5v2`,key:`dyzc3o`}],[`path`,{d:`M13 17v2`,key:`1ont0d`}],[`path`,{d:`M13 11v2`,key:`1wjjxi`}]]),Vi=R(`Trash2`,[[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6`,key:`4alrt4`}],[`path`,{d:`M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2`,key:`v07s0e`}],[`line`,{x1:`10`,x2:`10`,y1:`11`,y2:`17`,key:`1uufr5`}],[`line`,{x1:`14`,x2:`14`,y1:`11`,y2:`17`,key:`xtxkd`}]]),Hi=R(`TriangleAlert`,[[`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`}]]),Ui=R(`Truck`,[[`path`,{d:`M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2`,key:`wrbu53`}],[`path`,{d:`M15 18H9`,key:`1lyqi6`}],[`path`,{d:`M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14`,key:`lysw3i`}],[`circle`,{cx:`17`,cy:`18`,r:`2`,key:`332jqn`}],[`circle`,{cx:`7`,cy:`18`,r:`2`,key:`19iecd`}]]),Wi=R(`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`}]]),Gi=R(`Upload`,[[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`polyline`,{points:`17 8 12 3 7 8`,key:`t8dd8p`}],[`line`,{x1:`12`,x2:`12`,y1:`3`,y2:`15`,key:`widbto`}]]),Ki=R(`UserPlus`,[[`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`}]]),qi=R(`Users`,[[`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`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`path`,{d:`M16 3.13a4 4 0 0 1 0 7.75`,key:`1da9ce`}]]),V=R(`Wifi`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M2 8.82a15 15 0 0 1 20 0`,key:`dnpr2z`}],[`path`,{d:`M5 12.859a10 10 0 0 1 14 0`,key:`1x1e6c`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}]]),H=R(`X`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Ji=R(`Zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]);function Yi({onVerified:e}){let t=L(),[n,r]=(0,g.useState)(``),[i,a]=(0,g.useState)(``),[o,s]=(0,g.useState)(!1),c=(0,g.useRef)(null);(0,g.useEffect)(()=>{c.current?.focus()},[]);function l(e){r(e.target.value.replace(/\D/g,``).slice(0,6)),a(``)}async function u(i){if(i.preventDefault(),n.length!==6){a(`Enter a 6-digit code`);return}s(!0),a(``);try{(await t.verify2fa(n)).verified?e():a(`Verification failed. Please try again.`)}catch(e){let t=e?.message||String(e);a(t===`2fa_required`?`Session expired`:t||`Verification failed`)}finally{s(!1),r(``)}}return(0,M.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/70`,children:(0,M.jsxs)(`div`,{className:`w-full max-w-sm rounded-lg bg-zinc-800 p-6 shadow-xl`,children:[(0,M.jsxs)(`div`,{className:`mb-4 flex items-center gap-3`,children:[(0,M.jsx)(Ii,{className:`h-6 w-6 text-cyan-400`}),(0,M.jsx)(`h2`,{className:`text-lg font-bold text-white`,children:`Two-Factor Authentication`})]}),(0,M.jsx)(`p`,{className:`mb-4 text-sm text-zinc-400`,children:`Enter the 6-digit code from your authenticator app to continue.`}),(0,M.jsxs)(`form`,{onSubmit:u,className:`space-y-4`,children:[(0,M.jsx)(`input`,{ref:c,type:`text`,inputMode:`numeric`,autoComplete:`one-time-code`,value:n,onChange:l,placeholder:`000000`,maxLength:6,className:`w-full rounded-lg border border-zinc-700 bg-zinc-900 px-4 py-3 text-center font-mono text-2xl tracking-[0.3em] text-white placeholder-zinc-600 focus:border-cyan-500 focus:outline-none`}),i&&(0,M.jsx)(`p`,{className:`text-sm text-red-400`,children:i}),(0,M.jsx)(`button`,{type:`submit`,disabled:o||n.length!==6,className:`w-full rounded-lg bg-cyan-600 px-4 py-2 text-sm font-semibold text-white hover:bg-cyan-500 disabled:opacity-50`,children:o?`Verifying...`:`Verify`})]}),(0,M.jsxs)(`p`,{className:`mt-4 text-xs text-zinc-600`,children:[`Lost your authenticator? Run`,` `,(0,M.jsx)(`code`,{className:`text-zinc-500`,children:`sudo lamaste-reset-admin`}),` on the server.`]})]})})}var Xi=(0,g.createContext)(null),Zi=`lamaste:2fa-required`;function Qi({children:e}){let t=L(),n=N(),[r,i]=(0,g.useState)(!1),{data:a}=P({queryKey:[`settings-2fa`],queryFn:()=>t.get2faStatus(),staleTime:6e4,retry:!1}),o=a?.enabled??!1,s=(0,g.useCallback)(()=>{i(!0)},[]),c=(0,g.useCallback)(()=>{i(!1),n.invalidateQueries()},[n]);return(0,g.useEffect)(()=>{function e(){i(!0)}if(typeof window<`u`)return window.addEventListener(Zi,e),()=>window.removeEventListener(Zi,e)},[]),(0,M.jsxs)(Xi.Provider,{value:{is2faEnabled:o,is2faRequired:r,require2fa:s,clearRequirement:c},children:[e,r&&(0,M.jsx)(Yi,{onVerified:c})]})}var $i=(0,g.createContext)(null);function U(){let e=(0,g.useContext)($i);if(!e)throw Error(`useToast must be used within a ToastProvider`);return e}var ea=0;function ta({children:e}){let[t,n]=(0,g.useState)([]),r=(0,g.useCallback)((e,t=`success`)=>{let r=++ea;n(n=>[...n,{id:r,message:e,variant:t}]),setTimeout(()=>{n(e=>e.filter(e=>e.id!==r))},3e3)},[]),i=(0,g.useCallback)(e=>{n(t=>t.filter(t=>t.id!==e))},[]);return(0,M.jsxs)($i.Provider,{value:r,children:[e,(0,M.jsx)(`div`,{className:`fixed bottom-4 right-4 z-50 flex flex-col gap-2`,children:t.map(e=>(0,M.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg border px-4 py-3 text-sm font-mono shadow-lg ${e.variant===`error`?`bg-red-500/10 border-red-500/20 text-red-400`:`bg-green-500/10 border-green-500/20 text-green-400`}`,children:[(0,M.jsx)(`span`,{className:`flex-1`,children:e.message}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>i(e.id),className:`text-zinc-500 hover:text-zinc-300`,children:(0,M.jsx)(H,{size:14})})]},e.id))})]})}function na(e){return Array.isArray(e)?e.filter(e=>typeof e==`object`&&!!e&&typeof e.id==`string`&&e.id!==``&&typeof e.secret==`string`&&e.secret!==``).map(({id:e,secret:t})=>({id:e,secret:t})):[]}function ra(e){if(typeof e!=`object`||!e)return{result:e,secrets:[]};let{oidcClients:t,...n}=e;return{result:n,secrets:na(t)}}function ia(e,t){return e.status===`running`?null:t===`reading`?`reading`:e.revealPending===!0?t===`followed`?`read`:`offer`:t===`followed`?`forget`:null}function aa(e,t){return e?.operations?{...e,operations:e.operations.map(e=>e.id===t?{...e,revealPending:!1}:e)}:e}var oa={next:1,queue:[]};function sa(e,t){switch(t.type){case`reveal`:{let n=na(t.secrets);if(n.length===0)return e;let r={key:e.next,plugin:t.plugin,cause:t.cause,secrets:n};return{next:e.next+1,queue:[...e.queue,r]}}case`acknowledge`:return e.queue[0]?.key===t.key?{...e,queue:e.queue.slice(1)}:e;default:return e}}var ca={install:`Installing`,enable:`Enabling`,update:`Updating`};function la({plugin:e,cause:t,secrets:n}){let r=n.length===1?`a confidential OIDC client`:`${n.length} confidential OIDC clients`,i=ca[t];return i?`${i} ${e} created ${r}`:`An operation on ${e} created ${r}`}var ua=(0,g.createContext)(null);function da(){let e=(0,g.useContext)(ua);if(!e)throw Error(`useOidcSecretReveal must be used within an OidcSecretRevealProvider`);return e}function fa({children:e}){let[t,n]=(0,g.useReducer)(sa,oa),[r,i]=(0,g.useState)(()=>new Map),a=(0,g.useRef)(new Set),o=(0,g.useCallback)(({plugin:e,cause:t,secrets:r})=>n({type:`reveal`,plugin:e,cause:t,secrets:r}),[]),s=(0,g.useCallback)(e=>i(t=>new Map(t).set(e,`followed`)),[]),c=(0,g.useCallback)(e=>a.current.has(e)?!1:(a.current.add(e),i(t=>new Map(t).set(e,`reading`)),!0),[]),l=(0,g.useCallback)(e=>{a.current.delete(e),i(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),u=(0,g.useCallback)(e=>r.get(e),[r]),d=(0,g.useMemo)(()=>({reveal:o,followOperation:s,followState:u,claimOperation:c,releaseOperation:l}),[o,s,u,c,l]),f=t.queue[0]??null;return(0,g.useEffect)(()=>{if(!f)return;let e=e=>{e.preventDefault(),e.returnValue=``};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[f]),(0,M.jsxs)(ua.Provider,{value:d,children:[e,f&&(0,M.jsx)(ma,{reveal:f,waiting:t.queue.length-1,onAcknowledge:()=>n({type:`acknowledge`,key:f.key})},f.key)]})}var pa=`button:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])`;function ma({reveal:e,waiting:t,onAcknowledge:n}){let[r,i]=(0,g.useState)(!1),a=(0,g.useRef)(null),o=(0,g.useId)(),s=(0,g.useId)(),c=e.secrets.length===1;return(0,g.useEffect)(()=>{a.current?.focus()},[]),(0,M.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4`,children:(0,M.jsxs)(`div`,{ref:a,role:`alertdialog`,"aria-modal":`true`,"aria-labelledby":o,"aria-describedby":s,tabIndex:-1,onKeyDown:e=>{if(e.key!==`Tab`||!a.current)return;let t=[...a.current.querySelectorAll(pa)];if(t.length===0)return;let n=t[0],r=t[t.length-1],i=document.activeElement;e.shiftKey&&(i===n||i===a.current)?(e.preventDefault(),r.focus()):!e.shiftKey&&i===r&&(e.preventDefault(),n.focus())},className:`flex max-h-full w-full max-w-lg flex-col rounded-lg border border-zinc-800 bg-zinc-900 shadow-xl focus:outline-none`,children:[(0,M.jsxs)(`div`,{className:`border-b border-zinc-800 px-6 py-4`,children:[(0,M.jsxs)(`h3`,{id:o,className:`flex items-center gap-2 text-lg font-semibold text-white`,children:[(0,M.jsx)(z,{size:20,className:`text-cyan-400`}),c?`Client secret`:`Client secrets`,` — shown once`]}),(0,M.jsxs)(`p`,{className:`mt-1 text-sm text-zinc-400`,children:[la(e),`.`]})]}),(0,M.jsxs)(`div`,{className:`space-y-5 overflow-y-auto px-6 py-5`,children:[(0,M.jsxs)(`div`,{id:s,className:`space-y-1 rounded-lg border border-amber-500/20 bg-amber-500/10 p-4 text-sm text-amber-400`,children:[(0,M.jsxs)(`p`,{className:`font-semibold`,children:[`Store `,c?`this secret`:`these secrets`,` now — Lamaste never shows`,` `,c?`it`:`them`,` again.`]}),(0,M.jsxs)(`p`,{children:[`Copy `,c?`it`:`each one`,` into the application that authenticates with`,` `,c?`it`:`them`,`, or into your password manager. A secret that was not stored can only be replaced:`,` `,(0,M.jsx)(`code`,{className:`font-mono text-xs text-amber-300`,children:`lamaste-server plugins rotate-secret <plugin> <client id>`})]})]}),e.secrets.map(({id:e,secret:t})=>(0,M.jsx)(ha,{clientId:e,secret:t},e)),(0,M.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-zinc-300`,children:[(0,M.jsx)(`input`,{type:`checkbox`,checked:r,onChange:e=>i(e.target.checked),className:`accent-cyan-500`}),`I have stored `,c?`this secret`:`these secrets`]}),(0,M.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,M.jsx)(`span`,{className:`text-xs text-zinc-500`,children:t>0&&`${t} more to show after this`}),(0,M.jsx)(`button`,{type:`button`,disabled:!r,onClick:n,className:`rounded bg-cyan-600 px-4 py-2 text-sm font-semibold text-white hover:bg-cyan-500 disabled:cursor-not-allowed disabled:opacity-50`,children:`Done`})]})]})]})})}function ha({clientId:e,secret:t}){let[n,r]=(0,g.useState)(`idle`),i=(0,g.useRef)(null),a=(0,g.useRef)(null);return(0,g.useEffect)(()=>()=>clearTimeout(a.current),[]),(0,M.jsxs)(`div`,{children:[(0,M.jsxs)(`div`,{className:`mb-1 flex items-baseline gap-2 text-sm`,children:[(0,M.jsx)(`span`,{className:`shrink-0 text-zinc-500`,children:`Client ID`}),(0,M.jsx)(`span`,{className:`select-all break-all font-mono text-zinc-200`,children:e})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`div`,{ref:i,className:`flex-1 select-all break-all rounded border border-zinc-700 bg-zinc-950 p-3 font-mono text-sm text-yellow-400`,children:t}),(0,M.jsx)(`button`,{type:`button`,onClick:async()=>{try{await navigator.clipboard.writeText(t),r(`copied`),clearTimeout(a.current),a.current=setTimeout(()=>r(`idle`),2e3)}catch{let e=document.createRange();e.selectNodeContents(i.current);let t=window.getSelection();t.removeAllRanges(),t.addRange(e),r(`failed`)}},title:`Copy the secret`,"aria-label":`Copy the secret of ${e}`,className:`shrink-0 rounded bg-zinc-700 p-2 text-zinc-300 hover:bg-zinc-600`,children:n===`copied`?(0,M.jsx)(Fr,{size:16,className:`text-green-400`}):(0,M.jsx)(Kr,{size:16})})]}),n===`failed`&&(0,M.jsx)(`p`,{className:`mt-1 text-xs text-zinc-500`,children:`Copying is not available here — the secret is selected; copy it with ⌘C or Ctrl+C.`})]})}function ga(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(1)} GB`}function _a(e){return new Date(e).toLocaleString()}function va({currentPath:e,onNavigate:t}){let n=e===`.`?[]:e.split(`/`);return(0,M.jsxs)(`div`,{className:`flex items-center gap-1 text-sm text-zinc-400 overflow-x-auto`,children:[(0,M.jsx)(`button`,{type:`button`,onClick:()=>t(`.`),className:`flex items-center gap-1 hover:text-cyan-400 shrink-0`,children:(0,M.jsx)(li,{size:14})}),n.map((e,r)=>{let i=n.slice(0,r+1).join(`/`),a=r===n.length-1;return(0,M.jsxs)(`span`,{className:`flex items-center gap-1 shrink-0`,children:[(0,M.jsx)(Rr,{size:12,className:`text-zinc-600`}),a?(0,M.jsx)(`span`,{className:`text-zinc-200`,children:e}):(0,M.jsx)(`button`,{type:`button`,onClick:()=>t(i),className:`hover:text-cyan-400`,children:e})]},i)})]})}function ya({fileName:e,onConfirm:t,onCancel:n,isPending:r}){return(0,M.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60`,children:(0,M.jsxs)(`div`,{className:`bg-zinc-900 border border-zinc-800 rounded-lg p-6 max-w-md w-full mx-4 shadow-xl`,children:[(0,M.jsx)(`h3`,{className:`text-lg font-semibold text-white mb-2`,children:`Delete File`}),(0,M.jsxs)(`p`,{className:`text-zinc-400 text-sm mb-6`,children:[`Are you sure you want to delete`,` `,(0,M.jsx)(`span`,{className:`text-cyan-400 font-mono`,children:e}),`?`]}),(0,M.jsxs)(`div`,{className:`flex items-center justify-end gap-3`,children:[(0,M.jsx)(`button`,{type:`button`,onClick:n,disabled:r,className:`rounded bg-zinc-700 px-4 py-2 text-sm text-zinc-300 hover:bg-zinc-600 disabled:opacity-50`,children:`Cancel`}),(0,M.jsx)(`button`,{type:`button`,onClick:t,disabled:r,className:`flex items-center gap-2 rounded bg-red-600 px-4 py-2 text-sm font-semibold text-white hover:bg-red-500 disabled:opacity-50`,children:r?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(B,{size:14,className:`animate-spin`}),`Deleting...`]}):`Delete`})]})]})})}function ba({site:e,onBack:t}){let n=L(),r=N(),i=U(),a=(0,g.useRef)(null),[o,s]=(0,g.useState)(`.`),[c,l]=(0,g.useState)(null),u=P({queryKey:[`site-files`,e.id,o],queryFn:()=>n.getSiteFiles(e.id,o),refetchInterval:5e3}),d=F({mutationFn:({files:t})=>n.uploadSiteFiles(e.id,o,t),onSuccess:t=>{r.invalidateQueries({queryKey:[`site-files`,e.id]}),r.invalidateQueries({queryKey:[`sites`]});let n=t?.files?.length??0;i(t?.warning?`${n} file(s) uploaded. ${t.warning}`:`${n} file(s) uploaded`)},onError:e=>{i(e?.message||String(e),`error`)}}),f=F({mutationFn:t=>n.deleteSiteFile(e.id,t),onSuccess:()=>{r.invalidateQueries({queryKey:[`site-files`,e.id]}),r.invalidateQueries({queryKey:[`sites`]}),i(`File deleted`),l(null)},onError:e=>{i(e?.message||String(e),`error`),l(null)}}),p=(0,g.useCallback)(e=>{s(e)},[]),m=(0,g.useCallback)(e=>{e.type===`directory`&&s(e.relativePath)},[]),h=(0,g.useCallback)(()=>{a.current?.click()},[]),_=(0,g.useCallback)(e=>{let t=Array.from(e.target.files||[]);t.length>0&&d.mutate({files:t}),e.target.value=``},[d]),v=u.data?.files||[];return(0,M.jsxs)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:[(0,M.jsxs)(`div`,{className:`mb-6`,children:[(0,M.jsxs)(`button`,{type:`button`,onClick:t,className:`flex items-center gap-2 text-sm text-zinc-400 hover:text-zinc-200 mb-3`,children:[(0,M.jsx)(kr,{size:14}),`Back to Sites`]}),(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsxs)(`h1`,{className:`text-xl font-bold text-white`,children:[e.name,(0,M.jsx)(`span`,{className:`text-zinc-500 font-normal ml-2 text-base`,children:`Files`})]}),(0,M.jsx)(`p`,{className:`text-zinc-500 text-sm mt-1 font-mono`,children:e.fqdn})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`input`,{ref:a,type:`file`,multiple:!0,onChange:_,className:`hidden`}),(0,M.jsx)(`button`,{type:`button`,onClick:h,disabled:d.isPending,className:`flex items-center gap-2 rounded bg-cyan-600 px-4 py-2 text-sm font-semibold text-white hover:bg-cyan-500 disabled:opacity-50`,children:d.isPending?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(B,{size:14,className:`animate-spin`}),`Uploading...`]}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(Gi,{size:14}),`Upload`]})})]})]})]}),(0,M.jsx)(`div`,{className:`bg-zinc-900 border border-zinc-800 rounded-t-lg px-4 py-3`,children:(0,M.jsx)(va,{currentPath:o,onNavigate:p})}),u.isLoading?(0,M.jsx)(`div`,{className:`bg-zinc-900 border border-t-0 border-zinc-800 rounded-b-lg p-8 text-center`,children:(0,M.jsx)(B,{size:24,className:`mx-auto text-zinc-500 animate-spin`})}):u.isError?(0,M.jsx)(`div`,{className:`bg-zinc-900 border border-t-0 border-zinc-800 rounded-b-lg p-6`,children:(0,M.jsx)(`p`,{className:`text-red-400 text-sm`,children:`Failed to load files`})}):v.length===0?(0,M.jsx)(`div`,{className:`bg-zinc-900 border border-t-0 border-zinc-800 rounded-b-lg p-8 text-center`,children:(0,M.jsx)(`p`,{className:`text-zinc-500 text-sm`,children:`This directory is empty.`})}):(0,M.jsx)(`div`,{className:`bg-zinc-900 border border-t-0 border-zinc-800 rounded-b-lg overflow-x-auto`,children:(0,M.jsxs)(`table`,{className:`w-full`,children:[(0,M.jsx)(`thead`,{children:(0,M.jsxs)(`tr`,{className:`border-b border-zinc-800`,children:[(0,M.jsx)(`th`,{className:`text-left text-zinc-500 text-xs uppercase font-semibold py-2 px-4`,children:`Name`}),(0,M.jsx)(`th`,{className:`text-left text-zinc-500 text-xs uppercase font-semibold py-2 px-4 hidden sm:table-cell`,children:`Size`}),(0,M.jsx)(`th`,{className:`text-left text-zinc-500 text-xs uppercase font-semibold py-2 px-4 hidden md:table-cell`,children:`Modified`}),(0,M.jsx)(`th`,{className:`text-right text-zinc-500 text-xs uppercase font-semibold py-2 px-4 w-16`})]})}),(0,M.jsx)(`tbody`,{children:v.map(e=>(0,M.jsxs)(`tr`,{className:`border-b border-zinc-800/50 ${e.type===`directory`?`cursor-pointer hover:bg-zinc-800/50`:``}`,onClick:()=>m(e),children:[(0,M.jsx)(`td`,{className:`py-2.5 px-4 text-sm`,children:(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[e.type===`directory`?(0,M.jsx)(ii,{size:14,className:`text-cyan-400 shrink-0`}):(0,M.jsx)(ti,{size:14,className:`text-zinc-500 shrink-0`}),(0,M.jsx)(`span`,{className:`font-mono ${e.type===`directory`?`text-cyan-400`:`text-zinc-200`}`,children:e.name})]})}),(0,M.jsx)(`td`,{className:`py-2.5 px-4 text-sm text-zinc-500 font-mono hidden sm:table-cell`,children:e.type===`file`?ga(e.size):`—`}),(0,M.jsx)(`td`,{className:`py-2.5 px-4 text-sm text-zinc-600 hidden md:table-cell`,children:_a(e.modifiedAt)}),(0,M.jsx)(`td`,{className:`py-2.5 px-4 text-right`,children:(0,M.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),l(e)},className:`inline-flex items-center p-1 text-zinc-600 hover:text-red-400`,title:`Delete`,children:(0,M.jsx)(Vi,{size:14})})})]},e.relativePath))})]})}),c&&(0,M.jsx)(ya,{fileName:c.name,onConfirm:()=>f.mutate(c.relativePath),onCancel:()=>l(null),isPending:f.isPending})]})}function xa({pluginName:e,subPath:t=``,basePath:n,panelUrl:r}){let i=L(),a=(0,g.useRef)(null),o=(0,g.useRef)(null),s=(0,g.useCallback)(()=>{if(!a.current||!e)return;window.__lamalibrePlugins||(window.__lamalibrePlugins={});let i=window.__lamalibrePlugins[e];if(i&&typeof i.mount==`function`){let s={mountPoint:a.current,panelUrl:r||window.location.origin,basePath:n||`/plugins/${e}`,subPath:t||``,theme:{bg:`zinc-950`,card:`zinc-900`,accent:`cyan-400`,border:`zinc-800`}},c=i.mount(s);c&&typeof c.unmount==`function`?o.current=c.unmount:typeof c==`function`&&(o.current=c)}},[e,t,n,r]);return(0,g.useEffect)(()=>{if(!e)return;if(o.current&&=(o.current(),null),a.current&&(a.current.innerHTML=``),window.__lamalibrePlugins?.[e]){s();return}let t=!1;return i.fetchPluginBundle(e).then(n=>{if(!t)try{Function(n)(),s()}catch{if(a.current){a.current.textContent=``;let t=document.createElement(`div`);t.className=`flex items-center justify-center h-64`;let n=document.createElement(`p`);n.className=`text-zinc-500 text-sm`,n.textContent=`Failed to load plugin panel for "${e}"`,t.appendChild(n),a.current.appendChild(t)}}}).catch(()=>{if(t||!a.current)return;a.current.textContent=``;let n=document.createElement(`div`);n.className=`flex items-center justify-center h-64`;let r=document.createElement(`p`);r.className=`text-zinc-500 text-sm`,r.textContent=`Failed to load plugin panel for "${e}"`,n.appendChild(r),a.current.appendChild(n)}),()=>{t=!0,o.current&&=(o.current(),null)}},[e,i,s]),(0,g.useEffect)(()=>{window.__lamalibrePlugins?.[e]&&(o.current&&=(o.current(),null),a.current&&(a.current.innerHTML=``),s())},[t,e,s]),(0,M.jsx)(`div`,{className:`p-6 max-w-6xl mx-auto`,children:(0,M.jsx)(`div`,{ref:a,className:`min-h-64`,"data-plugin":e,children:(0,M.jsx)(`div`,{className:`flex items-center justify-center h-64`,children:(0,M.jsx)(`p`,{className:`text-zinc-500 text-sm`,children:`Loading plugin...`})})})})}function Sa(e,t=1){if(e===0)return`0 B`;let n=1024,r=[`B`,`KB`,`MB`,`GB`,`TB`],i=Math.floor(Math.log(e)/Math.log(n));return`${(e/n**+i).toFixed(t)} ${r[i]}`}function Ca(e){if(!e||e<=0)return`0s`;let t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60),i=Math.floor(e%60),a=[];return t>0&&a.push(`${t}d`),n>0&&a.push(`${n}h`),r>0&&a.push(`${r}m`),a.length===0&&a.push(`${i}s`),a.join(` `)}function wa(e){if(!e)return``;let t=Date.now()-new Date(e).getTime();if(t<0)return`just now`;let n=Math.floor(t/1e3);if(n<60)return`${n}s ago`;let r=Math.floor(n/60);if(r<60)return`${r}m ago`;let i=Math.floor(r/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function W({icon:e,label:t,value:n,isLoading:r,isError:i}){return(0,M.jsxs)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-6`,children:[(0,M.jsx)(e,{size:20,className:`text-cyan-400 mb-2`}),(0,M.jsx)(`p`,{className:`text-zinc-400 text-sm mb-1`,children:t}),r?(0,M.jsx)(`div`,{className:`h-7 w-24 animate-pulse rounded bg-zinc-700`}):i?(0,M.jsx)(`p`,{className:`text-red-400 text-sm`,children:`Error`}):(0,M.jsx)(`p`,{className:`text-xl font-semibold text-white`,children:n})]})}function Ta({status:e}){return(0,M.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-full ${e===`active`?`bg-green-500`:e===`failed`?`bg-red-500`:`bg-zinc-500`}`})}function Ea(){let e=L(),t=P({queryKey:[`system-stats`],queryFn:()=>e.getSystemStats(),refetchInterval:5e3}),n=P({queryKey:[`services`],queryFn:()=>e.getServices(),refetchInterval:5e3}),r=t.data,i=n.data?.services;return(0,M.jsxs)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:[(0,M.jsxs)(`div`,{className:`mb-6`,children:[(0,M.jsx)(`h1`,{className:`text-xl font-bold text-white`,children:`Dashboard`}),(0,M.jsx)(`p`,{className:`text-zinc-500 text-sm mt-1`,children:`System overview and service health`})]}),(0,M.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4 mb-8`,children:[(0,M.jsx)(W,{icon:qr,label:`CPU Usage`,value:r?`${r.cpu.usage}%`:`—`,isLoading:t.isLoading,isError:t.isError}),(0,M.jsx)(W,{icon:Jr,label:`Memory Usage`,value:r?`${Sa(r.memory.used)} / ${Sa(r.memory.total)}`:`—`,isLoading:t.isLoading,isError:t.isError}),(0,M.jsx)(W,{icon:si,label:`Disk Usage`,value:r?`${Sa(r.disk.used)} / ${Sa(r.disk.total)}`:`—`,isLoading:t.isLoading,isError:t.isError}),(0,M.jsx)(W,{icon:Gr,label:`Uptime`,value:r?Ca(r.uptime):`—`,isLoading:t.isLoading,isError:t.isError})]}),(0,M.jsxs)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-6 mb-8`,children:[(0,M.jsxs)(`h2`,{className:`text-sm font-semibold text-zinc-300 mb-4 flex items-center gap-2`,children:[(0,M.jsx)(Er,{size:14,className:`text-cyan-400`}),`Service Health`]}),n.isLoading?(0,M.jsx)(`div`,{className:`flex gap-6 flex-wrap`,children:Array.from({length:4}).map((e,t)=>(0,M.jsx)(`div`,{className:`h-5 w-28 animate-pulse rounded bg-zinc-700`},t))}):n.isError?(0,M.jsx)(`p`,{className:`text-red-400 text-sm`,children:`Failed to load service status`}):(0,M.jsx)(`div`,{className:`flex gap-6 flex-wrap`,children:i?.map(e=>(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(Ta,{status:e.status}),(0,M.jsx)(`span`,{className:`text-zinc-300 text-sm`,children:e.name})]},e.name))})]}),(0,M.jsxs)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-6`,children:[(0,M.jsxs)(`h2`,{className:`text-sm font-semibold text-zinc-300 mb-4 flex items-center gap-2`,children:[(0,M.jsx)(Er,{size:14,className:`text-cyan-400`}),`Quick Overview`]}),(0,M.jsxs)(`div`,{className:`flex gap-8 flex-wrap text-sm`,children:[(0,M.jsxs)(`div`,{className:`text-zinc-400`,children:[`Active Services:`,` `,(0,M.jsx)(`span`,{className:`text-white`,children:i?i.filter(e=>e.status===`active`).length:`—`})]}),(0,M.jsxs)(`div`,{className:`text-zinc-400`,children:[`Total Services: `,(0,M.jsx)(`span`,{className:`text-white`,children:i?i.length:`—`})]})]})]})]})}function G(e){return typeof e==`string`?e||`An unknown error occurred`:e instanceof Error?e.message||`An unknown error occurred`:String(e??`An unknown error occurred`)||`An unknown error occurred`}function Da(e){return typeof e!=`object`||!e?{code:null,reasons:[]}:{code:typeof e.code==`string`?e.code:null,reasons:Array.isArray(e.reasons)?e.reasons.filter(e=>typeof e==`string`):[]}}function Oa({status:e}){let t=e===`active`?`bg-green-500/20 text-green-400`:e===`failed`?`bg-red-500/20 text-red-400`:`bg-zinc-500/20 text-zinc-400`,n=e===`active`?`Active`:e===`failed`?`Failed`:e===`inactive`?`Inactive`:`Unknown`;return(0,M.jsx)(`span`,{className:`text-xs px-2 py-0.5 rounded-full ${t}`,children:n})}function ka({service:e,onAction:t,isActing:n}){let[r,i]=(0,g.useState)(!1),a=e.name===`lamalibre-lamaste-serverd`,o=()=>{if(!a){if(!r){i(!0);return}i(!1),t(e.name,`stop`)}};return(0,M.jsxs)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-5`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(Mi,{size:16,className:`text-cyan-400`}),(0,M.jsx)(`span`,{className:`text-white font-semibold`,children:e.name})]}),(0,M.jsx)(Oa,{status:e.status})]}),(0,M.jsx)(`p`,{className:`text-zinc-400 text-sm mb-4`,children:e.status===`active`&&e.uptime?`Uptime: ${e.uptime}`:`—`}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsxs)(`button`,{type:`button`,disabled:n,onClick:()=>t(e.name,`start`),className:`flex items-center gap-1.5 rounded bg-zinc-700 px-3 py-1.5 text-xs text-zinc-300 hover:bg-zinc-600 disabled:opacity-50 disabled:cursor-not-allowed`,children:[(0,M.jsx)(Ti,{size:12}),`Start`]}),r?(0,M.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs`,children:[(0,M.jsx)(`span`,{className:`text-zinc-400`,children:`Stop?`}),(0,M.jsx)(`button`,{type:`button`,onClick:o,className:`rounded bg-red-600 px-2 py-1 text-white hover:bg-red-500`,children:`Yes`}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>i(!1),className:`rounded bg-zinc-700 px-2 py-1 text-zinc-300 hover:bg-zinc-600`,children:`No`})]}):(0,M.jsxs)(`button`,{type:`button`,disabled:n||a,onClick:o,title:a?`Cannot stop panel service`:`Stop service`,className:`flex items-center gap-1.5 rounded bg-zinc-700 px-3 py-1.5 text-xs text-zinc-300 hover:bg-zinc-600 disabled:opacity-50 disabled:cursor-not-allowed`,children:[(0,M.jsx)(Ri,{size:12}),`Stop`]}),(0,M.jsxs)(`button`,{type:`button`,disabled:n,onClick:()=>t(e.name,`restart`),className:`flex items-center gap-1.5 rounded bg-zinc-700 px-3 py-1.5 text-xs text-zinc-300 hover:bg-zinc-600 disabled:opacity-50 disabled:cursor-not-allowed`,children:[(0,M.jsx)(Ai,{size:12}),`Restart`]})]})]})}var Aa=1e3;function ja({services:e}){let t=L(),[n,r]=(0,g.useState)(``),[i,a]=(0,g.useState)([]),[o,s]=(0,g.useState)(null),c=(0,g.useRef)(null),l=(0,g.useRef)(null),u=(0,g.useCallback)(e=>{r(e.target.value),a([]),s(null)},[]);(0,g.useEffect)(()=>{let e=c.current;e&&(e.scrollTop=e.scrollHeight)},[i]),(0,g.useEffect)(()=>{if(l.current&&=(l.current(),null),n)return l.current=t.startLogStream(n,e=>{a(t=>{let n=[...t,e];return n.length>Aa?n.slice(-Aa):n})}),()=>{l.current&&=(l.current(),null)}},[n,t]);let d=e?.map(e=>e.name)||[];return(0,M.jsxs)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-5`,children:[(0,M.jsx)(`h2`,{className:`text-sm font-semibold text-zinc-300 mb-4`,children:`Service Logs`}),(0,M.jsxs)(`select`,{value:n,onChange:u,className:`mb-4 rounded bg-zinc-800 border border-zinc-700 px-3 py-1.5 text-sm text-zinc-300 focus:outline-none focus:border-cyan-400`,children:[(0,M.jsx)(`option`,{value:``,children:`Select a service...`}),d.map(e=>(0,M.jsx)(`option`,{value:e,children:e},e))]}),(0,M.jsx)(`div`,{ref:c,className:`h-96 overflow-y-auto rounded-lg border border-zinc-800 bg-zinc-950 p-4 font-mono text-sm`,children:n?o?(0,M.jsx)(`p`,{className:`text-red-400`,children:o}):i.length===0?(0,M.jsx)(`p`,{className:`text-zinc-500 text-center mt-36`,children:`Waiting for log data...`}):i.map((e,t)=>(0,M.jsxs)(`div`,{className:`leading-relaxed`,children:[e.timestamp&&(0,M.jsxs)(`span`,{className:`text-zinc-500`,children:[e.timestamp,` `]}),(0,M.jsx)(`span`,{className:`text-zinc-300`,children:e.message})]},t)):(0,M.jsx)(`p`,{className:`text-zinc-500 text-center mt-36`,children:`Select a service to view its logs`})})]})}function Ma(){let e=L(),t=N(),n=U(),r=P({queryKey:[`services`],queryFn:()=>e.getServices(),refetchInterval:5e3}),i=F({mutationFn:({name:t,action:n})=>e.serviceAction(t,n),onSuccess:e=>{t.invalidateQueries({queryKey:[`services`]}),n(`${e.name} ${e.action}ed successfully`)},onError:e=>{n(G(e),`error`)}}),a=(0,g.useCallback)((e,t)=>{i.mutate({name:e,action:t})},[i]),o=r.data?.services;return(0,M.jsxs)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:[(0,M.jsxs)(`div`,{className:`mb-6`,children:[(0,M.jsx)(`h1`,{className:`text-xl font-bold text-white`,children:`Services`}),(0,M.jsx)(`p`,{className:`text-zinc-500 text-sm mt-1`,children:`Manage system services and view live logs`})]}),r.isLoading?(0,M.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4 mb-8`,children:Array.from({length:4}).map((e,t)=>(0,M.jsx)(`div`,{className:`h-40 animate-pulse rounded-lg bg-zinc-900 border border-zinc-800`},t))}):r.isError?(0,M.jsx)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-6 mb-8`,children:(0,M.jsx)(`p`,{className:`text-red-400 text-sm`,children:`Failed to load services`})}):(0,M.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4 mb-8`,children:o?.map(e=>(0,M.jsx)(ka,{service:e,onAction:a,isActing:i.isPending},e.name))}),(0,M.jsx)(ja,{services:o})]})}function Na(e){let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/1e3),r=Math.floor(n/60),i=Math.floor(r/60),a=Math.floor(i/24);return a>30?new Date(e).toLocaleDateString():a>0?`${a}d ago`:i>0?`${i}h ago`:r>0?`${r}m ago`:`just now`}function Pa(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(1)} GB`}function Fa({site:e}){return e.certIssued&&e.dnsVerified?(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs px-2 py-0.5 rounded-full border text-green-400 bg-green-500/10 border-green-500/20`,children:[(0,M.jsx)(Vr,{size:10}),`Live`]}):e.type===`custom`&&!e.dnsVerified?(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs px-2 py-0.5 rounded-full border text-yellow-400 bg-yellow-500/10 border-yellow-500/20`,children:[(0,M.jsx)(Gr,{size:10}),`DNS Pending`]}):(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs px-2 py-0.5 rounded-full border text-zinc-500 bg-zinc-800 border-zinc-700`,children:[(0,M.jsx)(Hi,{size:10}),`Setup Required`]})}function Ia({type:e}){return(0,M.jsx)(`span`,{className:`text-xs px-2 py-0.5 rounded-full border ${e===`managed`?`text-cyan-400 bg-cyan-500/10 border-cyan-500/20`:`text-purple-400 bg-purple-500/10 border-purple-500/20`}`,children:e})}var La=/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/;function Ra(e){return[...new Set(e.split(/[\s,]+/).map(e=>e.trim().toLowerCase()).filter(Boolean))]}function za({domain:e,onClose:t}){let n=N(),r=U(),i=L(),[a,o]=(0,g.useState)(``),[s,c]=(0,g.useState)(`managed`),[l,u]=(0,g.useState)(``),[d,f]=(0,g.useState)(``),[p,m]=(0,g.useState)(!1),[h,_]=(0,g.useState)(!1),[v,y]=(0,g.useState)({}),[b,x]=(0,g.useState)(null),S=F({mutationFn:e=>i.createSite(e),onSuccess:e=>{n.invalidateQueries({queryKey:[`sites`]}),r(`Site ${e.site.fqdn} created`),t()},onError:e=>{x(G(e))}}),C=(0,g.useCallback)(e=>{e.preventDefault(),x(null);let t={};if(a?La.test(a)||(t.name=`Lowercase letters, numbers, and hyphens only`):t.name=`Name is required`,s===`custom`&&!l&&(t.customDomain=`Domain is required for custom sites`),Object.keys(t).length>0){y(t);return}y({});let n={name:a,type:s,spaMode:p,autheliaProtected:h};if(s===`custom`){n.customDomain=l.toLowerCase();let e=Ra(d);e.length>0&&(n.aliases=e)}S.mutate(n)},[a,s,l,d,p,h,S]);return(0,M.jsxs)(`div`,{className:`bg-zinc-900 border border-zinc-800 rounded-lg p-5 mb-6`,children:[(0,M.jsxs)(`h2`,{className:`text-sm font-semibold text-zinc-300 mb-4 flex items-center gap-2`,children:[(0,M.jsx)(Ei,{size:14,className:`text-cyan-400`}),`Add Static Site`]}),(0,M.jsxs)(`form`,{onSubmit:C,className:`space-y-4`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`label`,{className:`block text-xs text-zinc-400 mb-2`,children:`Domain Type`}),(0,M.jsxs)(`div`,{className:`flex gap-2`,children:[(0,M.jsx)(`button`,{type:`button`,onClick:()=>c(`managed`),className:`px-3 py-1.5 text-sm rounded border ${s===`managed`?`border-cyan-400 text-cyan-400 bg-cyan-500/10`:`border-zinc-700 text-zinc-400 bg-zinc-800 hover:border-zinc-600`}`,children:`Managed Subdomain`}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>c(`custom`),className:`px-3 py-1.5 text-sm rounded border ${s===`custom`?`border-cyan-400 text-cyan-400 bg-cyan-500/10`:`border-zinc-700 text-zinc-400 bg-zinc-800 hover:border-zinc-600`}`,children:`Custom Domain`})]})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`label`,{className:`block text-xs text-zinc-400 mb-1`,children:`Name`}),(0,M.jsxs)(`div`,{className:`flex items-center gap-0`,children:[(0,M.jsx)(`input`,{type:`text`,value:a,onChange:e=>{o(e.target.value.toLowerCase()),y(e=>({...e,name:void 0}))},disabled:S.isPending,placeholder:`blog`,className:`flex-1 ${s===`managed`?`rounded-l`:`rounded`} bg-zinc-800 border border-zinc-700 px-3 py-2 text-sm text-zinc-200 font-mono placeholder:text-zinc-600 focus:outline-none focus:border-cyan-400 disabled:opacity-50`}),s===`managed`&&(0,M.jsxs)(`span`,{className:`rounded-r bg-zinc-800/60 border border-l-0 border-zinc-700 px-3 py-2 text-sm text-zinc-500 font-mono`,children:[`.`,e]})]}),v.name&&(0,M.jsx)(`p`,{className:`text-red-400 text-xs mt-1`,children:v.name})]}),s===`custom`&&(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`label`,{className:`block text-xs text-zinc-400 mb-1`,children:`Custom Domain`}),(0,M.jsx)(`input`,{type:`text`,value:l,onChange:e=>{u(e.target.value.toLowerCase()),y(e=>({...e,customDomain:void 0}))},disabled:S.isPending,placeholder:`example.com`,className:`w-full rounded bg-zinc-800 border border-zinc-700 px-3 py-2 text-sm text-zinc-200 font-mono placeholder:text-zinc-600 focus:outline-none focus:border-cyan-400 disabled:opacity-50`}),v.customDomain&&(0,M.jsx)(`p`,{className:`text-red-400 text-xs mt-1`,children:v.customDomain}),(0,M.jsxs)(`label`,{className:`block text-xs text-zinc-400 mt-3 mb-1`,children:[`Redirect aliases `,(0,M.jsx)(`span`,{className:`text-zinc-600`,children:`(optional)`})]}),(0,M.jsx)(`input`,{type:`text`,value:d,onChange:e=>f(e.target.value),disabled:S.isPending,placeholder:l?`www.${l}`:`www.example.com`,className:`w-full rounded bg-zinc-800 border border-zinc-700 px-3 py-2 text-sm text-zinc-200 font-mono placeholder:text-zinc-600 focus:outline-none focus:border-cyan-400 disabled:opacity-50`}),(0,M.jsx)(`p`,{className:`text-xs text-zinc-500 mt-1`,children:`These hostnames redirect to the site and share its certificate. Each needs its own A record.`})]}),(0,M.jsxs)(`div`,{className:`flex flex-wrap gap-4`,children:[(0,M.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-zinc-400 cursor-pointer`,children:[(0,M.jsx)(`input`,{type:`checkbox`,checked:p,onChange:e=>m(e.target.checked),disabled:S.isPending,className:`rounded border-zinc-700 bg-zinc-800 text-cyan-400 focus:ring-cyan-400`}),`SPA Mode`,(0,M.jsx)(`span`,{className:`text-zinc-600 text-xs`,children:`(fallback to index.html)`})]}),(0,M.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-zinc-400 cursor-pointer`,children:[(0,M.jsx)(`input`,{type:`checkbox`,checked:h,onChange:e=>_(e.target.checked),disabled:S.isPending,className:`rounded border-zinc-700 bg-zinc-800 text-cyan-400 focus:ring-cyan-400`}),`Authelia Protected`,(0,M.jsx)(`span`,{className:`text-zinc-600 text-xs`,children:`(require login)`})]})]}),b&&(0,M.jsx)(`div`,{className:`rounded bg-red-500/10 border border-red-500/20 px-3 py-2 text-sm text-red-400`,children:b}),(0,M.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,M.jsx)(`button`,{type:`submit`,disabled:S.isPending,className:`flex items-center gap-2 rounded bg-cyan-600 px-4 py-2 text-sm font-semibold text-white hover:bg-cyan-500 disabled:opacity-50 disabled:cursor-not-allowed`,children:S.isPending?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(B,{size:14,className:`animate-spin`}),`Creating site...`]}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(Ei,{size:14}),`Create Site`]})}),(0,M.jsx)(`button`,{type:`button`,onClick:t,disabled:S.isPending,className:`rounded bg-zinc-700 px-4 py-2 text-sm text-zinc-300 hover:bg-zinc-600 disabled:opacity-50`,children:`Cancel`})]})]})]})}function Ba({site:e,onClose:t}){let n=N(),r=U(),i=L(),[a,o]=(0,g.useState)(null),s=F({mutationFn:()=>i.verifySiteDns(e.id),onSuccess:e=>{o(e),e.ok&&(n.invalidateQueries({queryKey:[`sites`]}),r(`DNS verified and site is now live!`))},onError:e=>{o({ok:!1,message:G(e)})}});return(0,M.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60`,children:(0,M.jsxs)(`div`,{className:`bg-zinc-900 border border-zinc-800 rounded-lg p-6 max-w-lg w-full mx-4 shadow-xl`,children:[(0,M.jsx)(`h3`,{className:`text-lg font-semibold text-white mb-2`,children:`DNS Verification`}),(0,M.jsxs)(`p`,{className:`text-zinc-400 text-sm mb-4`,children:[`Add an A record pointing`,` `,[e.fqdn,...e.aliases||[]].map((e,t,n)=>(0,M.jsxs)(`span`,{children:[(0,M.jsx)(`span`,{className:`text-cyan-400 font-mono`,children:e}),t<n.length-1?`, `:``]},e)),` `,`to your server IP.`]}),(0,M.jsx)(`div`,{className:`bg-zinc-800 rounded-lg p-4 mb-4`,children:(0,M.jsx)(`table`,{className:`w-full text-sm`,children:(0,M.jsxs)(`tbody`,{children:[(0,M.jsxs)(`tr`,{children:[(0,M.jsx)(`td`,{className:`text-zinc-500 py-1 pr-4`,children:`Type`}),(0,M.jsx)(`td`,{className:`text-zinc-200 font-mono`,children:`A`})]}),(0,M.jsxs)(`tr`,{children:[(0,M.jsx)(`td`,{className:`text-zinc-500 py-1 pr-4`,children:`Name`}),(0,M.jsx)(`td`,{className:`text-zinc-200 font-mono`,children:[e.fqdn,...e.aliases||[]].join(`, `)})]}),(0,M.jsxs)(`tr`,{children:[(0,M.jsx)(`td`,{className:`text-zinc-500 py-1 pr-4`,children:`Value`}),(0,M.jsx)(`td`,{className:`text-zinc-200 font-mono`,children:`(your server IP)`})]})]})})}),a&&(0,M.jsx)(`div`,{className:`rounded px-3 py-2 text-sm mb-4 ${a.ok?`bg-green-500/10 border border-green-500/20 text-green-400`:`bg-yellow-500/10 border border-yellow-500/20 text-yellow-400`}`,children:a.message}),(0,M.jsxs)(`div`,{className:`flex items-center justify-end gap-3`,children:[(0,M.jsx)(`button`,{type:`button`,onClick:t,className:`rounded bg-zinc-700 px-4 py-2 text-sm text-zinc-300 hover:bg-zinc-600`,children:a?.ok?`Done`:`Cancel`}),!a?.ok&&(0,M.jsx)(`button`,{type:`button`,onClick:()=>s.mutate(),disabled:s.isPending,className:`flex items-center gap-2 rounded bg-cyan-600 px-4 py-2 text-sm font-semibold text-white hover:bg-cyan-500 disabled:opacity-50`,children:s.isPending?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(B,{size:14,className:`animate-spin`}),`Verifying...`]}):`Verify DNS`})]})]})})}function Va({site:e,onConfirm:t,onCancel:n,isPending:r}){return(0,M.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60`,children:(0,M.jsxs)(`div`,{className:`bg-zinc-900 border border-zinc-800 rounded-lg p-6 max-w-md w-full mx-4 shadow-xl`,children:[(0,M.jsx)(`h3`,{className:`text-lg font-semibold text-white mb-2`,children:`Delete Site`}),(0,M.jsxs)(`p`,{className:`text-zinc-400 text-sm mb-6`,children:[`Are you sure you want to delete`,` `,(0,M.jsx)(`span`,{className:`text-cyan-400 font-mono`,children:e.fqdn}),`? This will remove all files, the nginx configuration, and certificate mapping.`]}),(0,M.jsxs)(`div`,{className:`flex items-center justify-end gap-3`,children:[(0,M.jsx)(`button`,{type:`button`,onClick:n,disabled:r,className:`rounded bg-zinc-700 px-4 py-2 text-sm text-zinc-300 hover:bg-zinc-600 disabled:opacity-50`,children:`Cancel`}),(0,M.jsx)(`button`,{type:`button`,onClick:t,disabled:r,className:`flex items-center gap-2 rounded bg-red-600 px-4 py-2 text-sm font-semibold text-white hover:bg-red-500 disabled:opacity-50`,children:r?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(B,{size:14,className:`animate-spin`}),`Deleting...`]}):`Delete`})]})]})})}function Ha({site:e,onClose:t}){let n=N(),r=U(),i=L(),[a,o]=(0,g.useState)(e.spaMode),[s,c]=(0,g.useState)(e.autheliaProtected),[l,u]=(0,g.useState)(e.allowedUsers||[]),[d,f]=(0,g.useState)((e.aliases||[]).join(`, `)),p=Ra(d),m=JSON.stringify(p.slice().sort())!==JSON.stringify((e.aliases||[]).slice().sort()),h=P({queryKey:[`users`],queryFn:()=>i.getUsers()}),_=F({mutationFn:t=>i.updateSite(e.id,t),onSuccess:i=>{n.invalidateQueries({queryKey:[`sites`]}),r(`Site ${e.fqdn} settings updated`),i?.warning&&r(i.warning,`error`),t()},onError:e=>{r(G(e),`error`)}}),v=e.allowedUsers||[],y=a!==e.spaMode||s!==e.autheliaProtected||m||JSON.stringify(l.slice().sort())!==JSON.stringify(v.slice().sort()),b=(h.data?.users||[]).filter(e=>!l.includes(e.username)),x=e=>{u(t=>[...t,e])},S=e=>{u(t=>t.filter(t=>t!==e))};return(0,M.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60`,children:(0,M.jsxs)(`div`,{className:`bg-zinc-900 border border-zinc-800 rounded-lg p-6 max-w-md w-full mx-4 shadow-xl`,children:[(0,M.jsx)(`h3`,{className:`text-lg font-semibold text-white mb-1`,children:`Site Settings`}),(0,M.jsx)(`p`,{className:`text-zinc-500 text-sm mb-5 font-mono`,children:e.fqdn}),(0,M.jsxs)(`div`,{className:`space-y-4`,children:[(0,M.jsxs)(`label`,{className:`flex items-center justify-between gap-3 cursor-pointer`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`span`,{className:`text-sm text-zinc-200`,children:`SPA Mode`}),(0,M.jsx)(`p`,{className:`text-xs text-zinc-500 mt-0.5`,children:`Fallback to index.html for client-side routing`})]}),(0,M.jsx)(`input`,{type:`checkbox`,checked:a,onChange:e=>o(e.target.checked),disabled:_.isPending,className:`rounded border-zinc-700 bg-zinc-800 text-cyan-400 focus:ring-cyan-400 h-5 w-5`})]}),(0,M.jsxs)(`label`,{className:`flex items-center justify-between gap-3 cursor-pointer`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`span`,{className:`text-sm text-zinc-200`,children:`Authelia Protected`}),(0,M.jsx)(`p`,{className:`text-xs text-zinc-500 mt-0.5`,children:`Require login to access this site`})]}),(0,M.jsx)(`input`,{type:`checkbox`,checked:s,onChange:e=>c(e.target.checked),disabled:_.isPending,className:`rounded border-zinc-700 bg-zinc-800 text-cyan-400 focus:ring-cyan-400 h-5 w-5`})]}),e.type===`custom`&&(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`span`,{className:`text-sm text-zinc-200`,children:`Redirect aliases`}),(0,M.jsxs)(`p`,{className:`text-xs text-zinc-500 mt-0.5 mb-2`,children:[`Hostnames that redirect to `,e.fqdn,`. On a live site each new alias must already resolve to this server; the certificate is re-issued to cover it.`]}),(0,M.jsx)(`input`,{type:`text`,value:d,onChange:e=>f(e.target.value),disabled:_.isPending,placeholder:`www.${e.fqdn}`,className:`w-full rounded bg-zinc-800 border border-zinc-700 px-3 py-2 text-sm text-zinc-200 font-mono placeholder:text-zinc-600 focus:outline-none focus:border-cyan-400 disabled:opacity-50`})]}),s&&(0,M.jsxs)(`div`,{children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,M.jsx)(Li,{size:14,className:`text-cyan-400`}),(0,M.jsx)(`span`,{className:`text-sm text-zinc-200`,children:`Allowed Users`})]}),(0,M.jsx)(`p`,{className:`text-xs text-zinc-500 mb-3`,children:l.length===0?`All authenticated users can access this site.`:`Only the selected users can access this site.`}),l.length>0&&(0,M.jsx)(`div`,{className:`flex flex-wrap gap-2 mb-3`,children:l.map(e=>(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-xs px-2.5 py-1 rounded-full border border-cyan-500/20 bg-cyan-500/10 text-cyan-400`,children:[e,(0,M.jsx)(`button`,{type:`button`,onClick:()=>S(e),disabled:_.isPending,className:`hover:text-red-400`,children:(0,M.jsx)(H,{size:12})})]},e))}),b.length>0&&(0,M.jsxs)(`select`,{onChange:e=>{e.target.value&&(x(e.target.value),e.target.value=``)},disabled:_.isPending,className:`w-full rounded bg-zinc-800 border border-zinc-700 px-3 py-2 text-sm text-zinc-200 focus:outline-none focus:border-cyan-400 disabled:opacity-50`,children:[(0,M.jsx)(`option`,{value:``,children:`Add user...`}),b.map(e=>(0,M.jsxs)(`option`,{value:e.username,children:[e.username,` (`,e.displayname,`)`]},e.username))]}),h.isLoading&&(0,M.jsx)(`p`,{className:`text-xs text-zinc-500`,children:`Loading users...`})]})]}),(0,M.jsxs)(`div`,{className:`flex items-center justify-end gap-3 mt-6`,children:[(0,M.jsx)(`button`,{type:`button`,onClick:t,disabled:_.isPending,className:`rounded bg-zinc-700 px-4 py-2 text-sm text-zinc-300 hover:bg-zinc-600 disabled:opacity-50`,children:`Cancel`}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>_.mutate({spaMode:a,autheliaProtected:s,allowedUsers:l,...m?{aliases:p}:{}}),disabled:_.isPending||!y,className:`flex items-center gap-2 rounded bg-cyan-600 px-4 py-2 text-sm font-semibold text-white hover:bg-cyan-500 disabled:opacity-50 disabled:cursor-not-allowed`,children:_.isPending?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(B,{size:14,className:`animate-spin`}),`Saving...`]}):`Save Changes`})]})]})})}function Ua({sites:e,onDelete:t,onFiles:n,onVerifyDns:r,onSettings:i}){return(0,M.jsx)(`div`,{className:`hidden md:block overflow-x-auto`,children:(0,M.jsxs)(`table`,{className:`w-full`,children:[(0,M.jsx)(`thead`,{children:(0,M.jsxs)(`tr`,{className:`border-b border-zinc-700`,children:[(0,M.jsx)(`th`,{className:`text-left text-zinc-400 text-xs uppercase font-semibold py-3 px-4`,children:`Name`}),(0,M.jsx)(`th`,{className:`text-left text-zinc-400 text-xs uppercase font-semibold py-3 px-4`,children:`Domain`}),(0,M.jsx)(`th`,{className:`text-left text-zinc-400 text-xs uppercase font-semibold py-3 px-4`,children:`Type`}),(0,M.jsx)(`th`,{className:`text-left text-zinc-400 text-xs uppercase font-semibold py-3 px-4`,children:`Status`}),(0,M.jsx)(`th`,{className:`text-left text-zinc-400 text-xs uppercase font-semibold py-3 px-4`,children:`Size`}),(0,M.jsx)(`th`,{className:`text-left text-zinc-400 text-xs uppercase font-semibold py-3 px-4`,children:`Created`}),(0,M.jsx)(`th`,{className:`text-right text-zinc-400 text-xs uppercase font-semibold py-3 px-4`,children:`Actions`})]})}),(0,M.jsx)(`tbody`,{children:e.map(e=>(0,M.jsxs)(`tr`,{className:`border-b border-zinc-700 bg-zinc-800/50`,children:[(0,M.jsx)(`td`,{className:`py-3 px-4 text-sm text-zinc-200 font-mono`,children:e.name}),(0,M.jsxs)(`td`,{className:`py-3 px-4 text-sm`,children:[e.certIssued?(0,M.jsxs)(`a`,{href:`https://${e.fqdn}`,target:`_blank`,rel:`noopener noreferrer`,className:`text-cyan-400 hover:text-cyan-300 inline-flex items-center gap-1`,children:[e.fqdn,(0,M.jsx)(Zr,{size:12})]}):(0,M.jsx)(`span`,{className:`text-zinc-400 font-mono`,children:e.fqdn}),(e.aliases||[]).length>0&&(0,M.jsxs)(`p`,{className:`text-xs text-zinc-500 font-mono mt-0.5`,children:[`also `,e.aliases.join(`, `)]})]}),(0,M.jsx)(`td`,{className:`py-3 px-4`,children:(0,M.jsx)(Ia,{type:e.type})}),(0,M.jsx)(`td`,{className:`py-3 px-4`,children:(0,M.jsx)(Fa,{site:e})}),(0,M.jsx)(`td`,{className:`py-3 px-4 text-sm text-zinc-400 font-mono`,children:Pa(e.totalSize||0)}),(0,M.jsx)(`td`,{className:`py-3 px-4 text-sm text-zinc-500`,children:Na(e.createdAt)}),(0,M.jsx)(`td`,{className:`py-3 px-4 text-right`,children:(0,M.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[e.type===`custom`&&!e.dnsVerified&&(0,M.jsxs)(`button`,{type:`button`,onClick:()=>r(e),className:`inline-flex items-center gap-1.5 rounded bg-zinc-700 px-2.5 py-1.5 text-xs text-yellow-400 hover:bg-yellow-600/20 hover:text-yellow-300`,children:[(0,M.jsx)(oi,{size:12}),`Verify DNS`]}),(0,M.jsxs)(`button`,{type:`button`,onClick:()=>i(e),className:`inline-flex items-center gap-1.5 rounded bg-zinc-700 px-2.5 py-1.5 text-xs text-zinc-400 hover:bg-zinc-600 hover:text-zinc-300`,children:[(0,M.jsx)(Pi,{size:12}),`Settings`]}),(0,M.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:`inline-flex items-center gap-1.5 rounded bg-zinc-700 px-2.5 py-1.5 text-xs text-cyan-400 hover:bg-cyan-600/20 hover:text-cyan-300`,children:[(0,M.jsx)(ri,{size:12}),`Files`]}),(0,M.jsxs)(`button`,{type:`button`,onClick:()=>t(e),className:`inline-flex items-center gap-1.5 rounded bg-zinc-700 px-2.5 py-1.5 text-xs text-red-400 hover:bg-red-600/20 hover:text-red-300`,children:[(0,M.jsx)(Vi,{size:12}),`Delete`]})]})})]},e.id))})]})})}function Wa({sites:e,onDelete:t,onFiles:n,onVerifyDns:r,onSettings:i}){return(0,M.jsx)(`div`,{className:`md:hidden space-y-3`,children:e.map(e=>(0,M.jsxs)(`div`,{className:`bg-zinc-800/50 border border-zinc-700 rounded-lg p-4`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,M.jsx)(`span`,{className:`text-sm font-semibold text-zinc-200 font-mono`,children:e.name}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(Ia,{type:e.type}),(0,M.jsx)(Fa,{site:e})]})]}),e.certIssued?(0,M.jsxs)(`a`,{href:`https://${e.fqdn}`,target:`_blank`,rel:`noopener noreferrer`,className:`text-cyan-400 hover:text-cyan-300 text-sm inline-flex items-center gap-1 mb-1`,children:[e.fqdn,(0,M.jsx)(Zr,{size:12})]}):(0,M.jsx)(`span`,{className:`text-zinc-400 text-sm font-mono`,children:e.fqdn}),(e.aliases||[]).length>0&&(0,M.jsxs)(`p`,{className:`text-xs text-zinc-500 font-mono mb-1`,children:[`also `,e.aliases.join(`, `)]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-4 text-xs text-zinc-500 mt-2`,children:[(0,M.jsx)(`span`,{children:Pa(e.totalSize||0)}),(0,M.jsx)(`span`,{children:Na(e.createdAt)})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2 mt-3`,children:[e.type===`custom`&&!e.dnsVerified&&(0,M.jsxs)(`button`,{type:`button`,onClick:()=>r(e),className:`inline-flex items-center gap-1 text-xs text-yellow-400 hover:text-yellow-300`,children:[(0,M.jsx)(oi,{size:12}),`Verify DNS`]}),(0,M.jsxs)(`button`,{type:`button`,onClick:()=>i(e),className:`inline-flex items-center gap-1 text-xs text-zinc-400 hover:text-zinc-300`,children:[(0,M.jsx)(Pi,{size:12}),`Settings`]}),(0,M.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:`inline-flex items-center gap-1 text-xs text-cyan-400 hover:text-cyan-300`,children:[(0,M.jsx)(ri,{size:12}),`Files`]}),(0,M.jsxs)(`button`,{type:`button`,onClick:()=>t(e),className:`inline-flex items-center gap-1 text-xs text-red-400 hover:text-red-300`,children:[(0,M.jsx)(Vi,{size:12}),`Delete`]})]})]},e.id))})}function Ga({domain:e}){let t=N(),n=U(),r=L(),[i,a]=(0,g.useState)(!1),[o,s]=(0,g.useState)(null),[c,l]=(0,g.useState)(null),[u,d]=(0,g.useState)(null),[f,p]=(0,g.useState)(null),m=P({queryKey:[`sites`],queryFn:()=>r.getSites(),refetchInterval:1e4}),h=F({mutationFn:e=>r.deleteSite(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`sites`]}),n(`Site ${o.fqdn} deleted`),s(null)},onError:e=>{n(G(e),`error`),s(null)}}),_=(0,g.useCallback)(e=>s(e),[]),v=(0,g.useCallback)(e=>l(e),[]),y=(0,g.useCallback)(e=>d(e),[]),b=(0,g.useCallback)(e=>p(e),[]),x=(0,g.useCallback)(()=>{o&&h.mutate(o.id)},[o,h]),S=m.data?.sites||[];return c?(0,M.jsx)(ba,{site:c,onBack:()=>l(null)}):(0,M.jsxs)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:[(0,M.jsxs)(`div`,{className:`mb-6 flex items-center justify-between`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h1`,{className:`text-xl font-bold text-white`,children:`Static Sites`}),(0,M.jsx)(`p`,{className:`text-zinc-500 text-sm mt-1`,children:`Host static websites, landing pages, and SPAs`})]}),!i&&(0,M.jsxs)(`button`,{type:`button`,onClick:()=>a(!0),className:`flex items-center gap-2 rounded bg-cyan-600 px-4 py-2 text-sm font-semibold text-white hover:bg-cyan-500`,children:[(0,M.jsx)(Ei,{size:14}),`Add Site`]})]}),i&&e&&(0,M.jsx)(za,{domain:e,onClose:()=>a(!1)}),m.isLoading?(0,M.jsx)(`div`,{className:`space-y-3`,children:Array.from({length:3}).map((e,t)=>(0,M.jsx)(`div`,{className:`h-16 animate-pulse rounded-lg bg-zinc-900 border border-zinc-800`},t))}):m.isError?(0,M.jsx)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-6`,children:(0,M.jsx)(`p`,{className:`text-red-400 text-sm`,children:`Failed to load sites`})}):S.length===0?(0,M.jsxs)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-12 text-center`,children:[(0,M.jsx)(ei,{size:32,className:`mx-auto text-zinc-600 mb-3`}),(0,M.jsx)(`p`,{className:`text-zinc-400 text-sm`,children:`No static sites yet. Create your first site to get started.`})]}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(Ua,{sites:S,onDelete:_,onFiles:v,onVerifyDns:y,onSettings:b}),(0,M.jsx)(Wa,{sites:S,onDelete:_,onFiles:v,onVerifyDns:y,onSettings:b})]}),u&&(0,M.jsx)(Ba,{site:u,onClose:()=>d(null)}),f&&(0,M.jsx)(Ha,{site:f,onClose:()=>p(null)}),o&&(0,M.jsx)(Va,{site:o,onConfirm:x,onCancel:()=>s(null),isPending:h.isPending})]})}var Ka=Object.defineProperty,qa=Object.getOwnPropertySymbols,Ja=Object.prototype.hasOwnProperty,Ya=Object.prototype.propertyIsEnumerable,Xa=(e,t,n)=>t in e?Ka(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Za=(e,t)=>{for(var n in t||={})Ja.call(t,n)&&Xa(e,n,t[n]);if(qa)for(var n of qa(t))Ya.call(t,n)&&Xa(e,n,t[n]);return e},Qa=(e,t)=>{var n={};for(var r in e)Ja.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&qa)for(var r of qa(e))t.indexOf(r)<0&&Ya.call(e,r)&&(n[r]=e[r]);return n},$a;(e=>{let t=class t{constructor(e,n,r,a){if(this.version=e,this.errorCorrectionLevel=n,this.modules=[],this.isFunction=[],e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version value out of range`);if(a<-1||a>7)throw RangeError(`Mask value out of range`);this.size=e*4+17;let o=[];for(let e=0;e<this.size;e++)o.push(!1);for(let e=0;e<this.size;e++)this.modules.push(o.slice()),this.isFunction.push(o.slice());this.drawFunctionPatterns();let s=this.addEccAndInterleave(r);if(this.drawCodewords(s),a==-1){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);let n=this.getPenaltyScore();n<e&&(a=t,e=n),this.applyMask(t)}}i(0<=a&&a<=7),this.mask=a,this.applyMask(a),this.drawFormatBits(a),this.isFunction=[]}static encodeText(n,r){let i=e.QrSegment.makeSegments(n);return t.encodeSegments(i,r)}static encodeBinary(n,r){let i=e.QrSegment.makeBytes(n);return t.encodeSegments([i],r)}static encodeSegments(e,r,a=1,s=40,c=-1,l=!0){if(!(t.MIN_VERSION<=a&&a<=s&&s<=t.MAX_VERSION)||c<-1||c>7)throw RangeError(`Invalid value`);let u,d;for(u=a;;u++){let n=t.getNumDataCodewords(u,r)*8,i=o.getTotalBits(e,u);if(i<=n){d=i;break}if(u>=s)throw RangeError(`Data too long`)}for(let e of[t.Ecc.MEDIUM,t.Ecc.QUARTILE,t.Ecc.HIGH])l&&d<=t.getNumDataCodewords(u,e)*8&&(r=e);let f=[];for(let t of e){n(t.mode.modeBits,4,f),n(t.numChars,t.mode.numCharCountBits(u),f);for(let e of t.getData())f.push(e)}i(f.length==d);let p=t.getNumDataCodewords(u,r)*8;i(f.length<=p),n(0,Math.min(4,p-f.length),f),n(0,(8-f.length%8)%8,f),i(f.length%8==0);for(let e=236;f.length<p;e^=253)n(e,8,f);let m=[];for(;m.length*8<f.length;)m.push(0);return f.forEach((e,t)=>m[t>>>3]|=e<<7-(t&7)),new t(u,r,m,c)}getModule(e,t){return 0<=e&&e<this.size&&0<=t&&t<this.size&&this.modules[t][e]}getModules(){return this.modules}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0),this.setFunctionModule(e,6,e%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let r=0;r<t;r++)n==0&&r==0||n==0&&r==t-1||n==t-1&&r==0||this.drawAlignmentPattern(e[n],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.errorCorrectionLevel.formatBits<<3|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>>9)*1335;let a=(t<<10|n)^21522;i(a>>>15==0);for(let e=0;e<=5;e++)this.setFunctionModule(8,e,r(a,e));this.setFunctionModule(8,7,r(a,6)),this.setFunctionModule(8,8,r(a,7)),this.setFunctionModule(7,8,r(a,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,r(a,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,r(a,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,r(a,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;i(t>>>18==0);for(let e=0;e<18;e++){let n=r(t,e),i=this.size-11+e%3,a=Math.floor(e/3);this.setFunctionModule(i,a,n),this.setFunctionModule(a,i,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let r=-4;r<=4;r++){let i=Math.max(Math.abs(r),Math.abs(n)),a=e+r,o=t+n;0<=a&&a<this.size&&0<=o&&o<this.size&&this.setFunctionModule(a,o,i!=2&&i!=4)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,t+n,Math.max(Math.abs(r),Math.abs(n))!=1)}setFunctionModule(e,t,n){this.modules[t][e]=n,this.isFunction[t][e]=!0}addEccAndInterleave(e){let n=this.version,r=this.errorCorrectionLevel;if(e.length!=t.getNumDataCodewords(n,r))throw RangeError(`Invalid argument`);let a=t.NUM_ERROR_CORRECTION_BLOCKS[r.ordinal][n],o=t.ECC_CODEWORDS_PER_BLOCK[r.ordinal][n],s=Math.floor(t.getNumRawDataModules(n)/8),c=a-s%a,l=Math.floor(s/a),u=[],d=t.reedSolomonComputeDivisor(o);for(let n=0,r=0;n<a;n++){let i=e.slice(r,r+l-o+(n<c?0:1));r+=i.length;let a=t.reedSolomonComputeRemainder(i,d);n<c&&i.push(0),u.push(i.concat(a))}let f=[];for(let e=0;e<u[0].length;e++)u.forEach((t,n)=>{(e!=l-o||n>=c)&&f.push(t[e])});return i(f.length==s),f}drawCodewords(e){if(e.length!=Math.floor(t.getNumRawDataModules(this.version)/8))throw RangeError(`Invalid argument`);let n=0;for(let t=this.size-1;t>=1;t-=2){t==6&&(t=5);for(let i=0;i<this.size;i++)for(let a=0;a<2;a++){let o=t-a,s=t+1&2?i:this.size-1-i;!this.isFunction[s][o]&&n<e.length*8&&(this.modules[s][o]=r(e[n>>>3],7-(n&7)),n++)}}i(n==e.length*8)}applyMask(e){if(e<0||e>7)throw RangeError(`Mask value out of range`);for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let r;switch(e){case 0:r=(n+t)%2==0;break;case 1:r=t%2==0;break;case 2:r=n%3==0;break;case 3:r=(n+t)%3==0;break;case 4:r=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:r=n*t%2+n*t%3==0;break;case 6:r=(n*t%2+n*t%3)%2==0;break;case 7:r=((n+t)%2+n*t%3)%2==0;break;default:throw Error(`Unreachable`)}!this.isFunction[t][n]&&r&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[n][o]==r?(i++,i==5?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[n][o],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[o][n]==r?(i++,i==5?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[o][n],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n<this.size-1;n++)for(let r=0;r<this.size-1;r++){let i=this.modules[n][r];i==this.modules[n][r+1]&&i==this.modules[n+1][r]&&i==this.modules[n+1][r+1]&&(e+=t.PENALTY_N2)}let n=0;for(let e of this.modules)n=e.reduce((e,t)=>e+ +!!t,n);let r=this.size*this.size,a=Math.ceil(Math.abs(n*20-r*10)/r)-1;return i(0<=a&&a<=9),e+=a*t.PENALTY_N4,i(0<=e&&e<=2568888),e}getAlignmentPatternPositions(){if(this.version==1)return[];{let e=Math.floor(this.version/7)+2,t=this.version==32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,n=[6];for(let r=this.size-7;n.length<e;r-=t)n.splice(1,0,r);return n}}static getNumRawDataModules(e){if(e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version number out of range`);let n=(16*e+128)*e+64;if(e>=2){let t=Math.floor(e/7)+2;n-=(25*t-10)*t-55,e>=7&&(n-=36)}return i(208<=n&&n<=29648),n}static getNumDataCodewords(e,n){return Math.floor(t.getNumRawDataModules(e)/8)-t.ECC_CODEWORDS_PER_BLOCK[n.ordinal][e]*t.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][e]}static reedSolomonComputeDivisor(e){if(e<1||e>255)throw RangeError(`Degree out of range`);let n=[];for(let t=0;t<e-1;t++)n.push(0);n.push(1);let r=1;for(let i=0;i<e;i++){for(let e=0;e<n.length;e++)n[e]=t.reedSolomonMultiply(n[e],r),e+1<n.length&&(n[e]^=n[e+1]);r=t.reedSolomonMultiply(r,2)}return n}static reedSolomonComputeRemainder(e,n){let r=n.map(e=>0);for(let i of e){let e=i^r.shift();r.push(0),n.forEach((n,i)=>r[i]^=t.reedSolomonMultiply(n,e))}return r}static reedSolomonMultiply(e,t){if(e>>>8||t>>>8)throw RangeError(`Byte out of range`);let n=0;for(let r=7;r>=0;r--)n=n<<1^(n>>>7)*285,n^=(t>>>r&1)*e;return i(n>>>8==0),n}finderPenaltyCountPatterns(e){let t=e[1];i(t<=this.size*3);let n=t>0&&e[2]==t&&e[3]==t*3&&e[4]==t&&e[5]==t;return(n&&e[0]>=t*4&&e[6]>=t?1:0)+(n&&e[6]>=t*4&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){t[0]==0&&(e+=this.size),t.pop(),t.unshift(e)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function n(e,t,n){if(t<0||t>31||e>>>t)throw RangeError(`Value out of range`);for(let r=t-1;r>=0;r--)n.push(e>>>r&1)}function r(e,t){return(e>>>t&1)!=0}function i(e){if(!e)throw Error(`Assertion error`)}let a=class e{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError(`Invalid argument`);this.bitData=n.slice()}static makeBytes(t){let r=[];for(let e of t)n(e,8,r);return new e(e.Mode.BYTE,t.length,r)}static makeNumeric(t){if(!e.isNumeric(t))throw RangeError(`String contains non-numeric characters`);let r=[];for(let e=0;e<t.length;){let i=Math.min(t.length-e,3);n(parseInt(t.substring(e,e+i),10),i*3+1,r),e+=i}return new e(e.Mode.NUMERIC,t.length,r)}static makeAlphanumeric(t){if(!e.isAlphanumeric(t))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let r=[],i;for(i=0;i+2<=t.length;i+=2){let a=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i))*45;a+=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i+1)),n(a,11,r)}return i<t.length&&n(e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i)),6,r),new e(e.Mode.ALPHANUMERIC,t.length,r)}static makeSegments(t){return t==``?[]:e.isNumeric(t)?[e.makeNumeric(t)]:e.isAlphanumeric(t)?[e.makeAlphanumeric(t)]:[e.makeBytes(e.toUtf8ByteArray(t))]}static makeEci(t){let r=[];if(t<0)throw RangeError(`ECI assignment value out of range`);if(t<128)n(t,8,r);else if(t<16384)n(2,2,r),n(t,14,r);else if(t<1e6)n(6,3,r),n(t,21,r);else throw RangeError(`ECI assignment value out of range`);return new e(e.Mode.ECI,0,r)}static isNumeric(t){return e.NUMERIC_REGEX.test(t)}static isAlphanumeric(t){return e.ALPHANUMERIC_REGEX.test(t)}getData(){return this.bitData.slice()}static getTotalBits(e,t){let n=0;for(let r of e){let e=r.mode.numCharCountBits(t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}static toUtf8ByteArray(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)e.charAt(n)==`%`?(t.push(parseInt(e.substring(n+1,n+3),16)),n+=2):t.push(e.charCodeAt(n));return t}};a.NUMERIC_REGEX=/^[0-9]*$/,a.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,a.ALPHANUMERIC_CHARSET=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`;let o=a;e.QrSegment=a})($a||={}),(e=>{(e=>{let t=class{constructor(e,t){this.ordinal=e,this.formatBits=t}};t.LOW=new t(0,1),t.MEDIUM=new t(1,0),t.QUARTILE=new t(2,3),t.HIGH=new t(3,2),e.Ecc=t})(e.QrCode||={})})($a||={}),(e=>{(e=>{let t=class{constructor(e,t){this.modeBits=e,this.numBitsCharCount=t}numCharCountBits(e){return this.numBitsCharCount[Math.floor((e+7)/17)]}};t.NUMERIC=new t(1,[10,12,14]),t.ALPHANUMERIC=new t(2,[9,11,13]),t.BYTE=new t(4,[8,16,16]),t.KANJI=new t(8,[8,10,12]),t.ECI=new t(7,[0,0,0]),e.Mode=t})(e.QrSegment||={})})($a||={});var eo=$a,to={L:eo.QrCode.Ecc.LOW,M:eo.QrCode.Ecc.MEDIUM,Q:eo.QrCode.Ecc.QUARTILE,H:eo.QrCode.Ecc.HIGH},no=128,ro=`L`,io=`#FFFFFF`,ao=`#000000`,oo=!1,so=1,co=4,lo=0,uo=.1;function fo(e,t=0){let n=[];return e.forEach(function(e,r){let i=null;e.forEach(function(a,o){if(!a&&i!==null){n.push(`M${i+t} ${r+t}h${o-i}v1H${i+t}z`),i=null;return}if(o===e.length-1){if(!a)return;i===null?n.push(`M${o+t},${r+t} h1v1H${o+t}z`):n.push(`M${i+t},${r+t} h${o+1-i}v1H${i+t}z`);return}a&&i===null&&(i=o)})}),n.join(``)}function po(e,t){return e.slice().map((e,n)=>n<t.y||n>=t.y+t.h?e:e.map((e,n)=>n<t.x||n>=t.x+t.w?e:!1))}function mo(e,t,n,r){if(r==null)return null;let i=e.length+n*2,a=Math.floor(t*uo),o=i/t,s=(r.width||a)*o,c=(r.height||a)*o,l=r.x==null?e.length/2-s/2:r.x*o,u=r.y==null?e.length/2-c/2:r.y*o,d=r.opacity==null?1:r.opacity,f=null;if(r.excavate){let e=Math.floor(l),t=Math.floor(u);f={x:e,y:t,w:Math.ceil(s+l-e),h:Math.ceil(c+u-t)}}let p=r.crossOrigin;return{x:l,y:u,h:c,w:s,excavation:f,opacity:d,crossOrigin:p}}function ho(e,t){return t==null?e?co:lo:Math.max(Math.floor(t),0)}function go({value:e,level:t,minVersion:n,includeMargin:r,marginSize:i,imageSettings:a,size:o,boostLevel:s}){let c=g.useMemo(()=>{let r=(Array.isArray(e)?e:[e]).reduce((e,t)=>(e.push(...eo.QrSegment.makeSegments(t)),e),[]);return eo.QrCode.encodeSegments(r,to[t],n,void 0,void 0,s)},[e,t,n,s]),{cells:l,margin:u,numCells:d,calculatedImageSettings:f}=g.useMemo(()=>{let e=c.getModules(),t=ho(r,i);return{cells:e,margin:t,numCells:e.length+t*2,calculatedImageSettings:mo(e,o,t,a)}},[c,o,a,r,i]);return{qrcode:c,margin:u,cells:l,numCells:d,calculatedImageSettings:f}}var _o=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),vo=g.forwardRef(function(e,t){let n=e,{value:r,size:i=no,level:a=ro,bgColor:o=io,fgColor:s=ao,includeMargin:c=oo,minVersion:l=so,boostLevel:u,marginSize:d,imageSettings:f}=n,p=Qa(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`marginSize`,`imageSettings`]),{style:m}=p,h=Qa(p,[`style`]),_=f?.src,v=g.useRef(null),y=g.useRef(null),b=g.useCallback(e=>{v.current=e,typeof t==`function`?t(e):t&&(t.current=e)},[t]),[x,S]=g.useState(!1),{margin:C,cells:w,numCells:T,calculatedImageSettings:E}=go({value:r,level:a,minVersion:l,boostLevel:u,includeMargin:c,marginSize:d,imageSettings:f,size:i});g.useEffect(()=>{if(v.current!=null){let e=v.current,t=e.getContext(`2d`);if(!t)return;let n=w,r=y.current,a=E!=null&&r!==null&&r.complete&&r.naturalHeight!==0&&r.naturalWidth!==0;a&&E.excavation!=null&&(n=po(w,E.excavation));let c=window.devicePixelRatio||1;e.height=e.width=i*c;let l=i/T*c;t.scale(l,l),t.fillStyle=o,t.fillRect(0,0,T,T),t.fillStyle=s,_o?t.fill(new Path2D(fo(n,C))):w.forEach(function(e,n){e.forEach(function(e,r){e&&t.fillRect(r+C,n+C,1,1)})}),E&&(t.globalAlpha=E.opacity),a&&t.drawImage(r,E.x+C,E.y+C,E.w,E.h)}}),g.useEffect(()=>{S(!1)},[_]);let D=Za({height:i,width:i},m),ee=null;return _!=null&&(ee=g.createElement(`img`,{src:_,key:_,style:{display:`none`},onLoad:()=>{S(!0)},ref:y,crossOrigin:E?.crossOrigin})),g.createElement(g.Fragment,null,g.createElement(`canvas`,Za({style:D,height:i,width:i,ref:b,role:`img`},h)),ee)});vo.displayName=`QRCodeCanvas`;var yo=g.forwardRef(function(e,t){let n=e,{value:r,size:i=no,level:a=ro,bgColor:o=io,fgColor:s=ao,includeMargin:c=oo,minVersion:l=so,boostLevel:u,title:d,marginSize:f,imageSettings:p}=n,m=Qa(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`title`,`marginSize`,`imageSettings`]),{margin:h,cells:_,numCells:v,calculatedImageSettings:y}=go({value:r,level:a,minVersion:l,boostLevel:u,includeMargin:c,marginSize:f,imageSettings:p,size:i}),b=_,x=null;p!=null&&y!=null&&(y.excavation!=null&&(b=po(_,y.excavation)),x=g.createElement(`image`,{href:p.src,height:y.h,width:y.w,x:y.x+h,y:y.y+h,preserveAspectRatio:`none`,opacity:y.opacity,crossOrigin:y.crossOrigin}));let S=fo(b,h);return g.createElement(`svg`,Za({height:i,width:i,viewBox:`0 0 ${v} ${v}`,ref:t,role:`img`},m),!!d&&g.createElement(`title`,null,d),g.createElement(`path`,{fill:o,d:`M0,0 h${v}v${v}H0z`,shapeRendering:`crispEdges`}),g.createElement(`path`,{fill:s,d:S,shapeRendering:`crispEdges`}),x)});yo.displayName=`QRCodeSVG`;function bo({children:e,onClose:t}){return(0,M.jsx)(`div`,{className:`fixed inset-0 z-40 flex items-center justify-center bg-black/50`,children:(0,M.jsxs)(`div`,{className:`relative max-h-[90vh] w-full max-w-lg overflow-y-auto rounded-lg bg-zinc-800 p-6 shadow-xl`,onClick:e=>e.stopPropagation(),children:[(0,M.jsx)(`button`,{type:`button`,onClick:t,className:`absolute right-4 top-4 text-zinc-500 hover:text-zinc-300`,children:(0,M.jsx)(H,{size:18})}),e]})})}function xo({totpUri:e,onClose:t}){let[n,r]=(0,g.useState)(!1),i=e.match(/secret=([A-Z2-7]+)/),a=i?i[1]:``,o=a.replace(/(.{4})/g,`$1 `).trim();function s(){navigator.clipboard.writeText(a).then(()=>{r(!0),setTimeout(()=>r(!1),2e3)}).catch(()=>{})}return(0,M.jsxs)(bo,{onClose:t,children:[(0,M.jsx)(`h2`,{className:`mb-4 text-lg font-bold text-white`,children:`Two-Factor Authentication Setup`}),(0,M.jsx)(`p`,{className:`mb-4 text-sm text-zinc-400`,children:`Scan this QR code with your authenticator app (Google Authenticator, Authy, etc.)`}),(0,M.jsx)(`div`,{className:`mb-4 flex justify-center`,children:(0,M.jsx)(`div`,{className:`rounded-lg bg-zinc-900 p-4`,children:(0,M.jsx)(yo,{value:e,size:200,bgColor:`transparent`,fgColor:`#ffffff`})})}),(0,M.jsx)(`p`,{className:`mb-2 text-sm text-zinc-400`,children:`Or enter this code manually:`}),(0,M.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 rounded-lg bg-zinc-900 px-4 py-3`,children:[(0,M.jsx)(`code`,{className:`flex-1 font-mono text-sm text-cyan-400 tracking-wider`,children:o}),(0,M.jsx)(`button`,{type:`button`,onClick:s,className:`text-zinc-500 hover:text-zinc-300`,title:`Copy secret`,children:n?(0,M.jsx)(Fr,{size:16,className:`text-green-400`}):(0,M.jsx)(Kr,{size:16})})]}),(0,M.jsx)(`p`,{className:`mb-6 text-xs text-yellow-400`,children:`This code will only be shown once. Make sure the user scans it before closing.`}),(0,M.jsx)(`button`,{type:`button`,onClick:t,className:`w-full rounded-lg bg-cyan-600 px-4 py-2 text-sm font-semibold text-white hover:bg-cyan-500`,children:`Done`})]})}function So({user:e,onClose:t,onSuccess:n}){let r=!!e,i=U(),a=N(),o=L(),[s,c]=(0,g.useState)({username:e?.username||``,displayname:e?.displayname||``,email:e?.email||``,password:``,groups:e?.groups?.join(`, `)||``}),[l,u]=(0,g.useState)(!1),[d,f]=(0,g.useState)(``),p=F({mutationFn:e=>o.createUser(e),onSuccess:()=>a.invalidateQueries({queryKey:[`users`]})}),m=F({mutationFn:({username:e,...t})=>o.updateUser(e,t),onSuccess:()=>a.invalidateQueries({queryKey:[`users`]})}),h=r?m:p;function _(e,t){c(n=>({...n,[e]:t})),f(``)}async function v(a){if(a.preventDefault(),f(``),!r){if(!s.username||!s.displayname||!s.email||!s.password){f(`All required fields must be filled`);return}if(!/^[a-z0-9_-]+$/.test(s.username)){f(`Username must contain only lowercase alphanumeric characters, underscores, and hyphens`);return}if(s.username.length<2){f(`Username must be at least 2 characters`);return}if(s.password.length<8){f(`Password must be at least 8 characters`);return}}if(r&&s.password&&s.password.length<8){f(`Password must be at least 8 characters`);return}let o=s.groups.split(`,`).map(e=>e.trim()).filter(Boolean);try{if(r){let n={username:e.username};s.displayname!==e.displayname&&(n.displayname=s.displayname),s.email!==e.email&&(n.email=s.email),s.password&&(n.password=s.password);let r=(e.groups||[]).join(`, `);if(s.groups!==r&&(n.groups=o),Object.keys(n).length<=1){f(`No changes detected`);return}await h.mutateAsync(n),i(`User updated successfully`),t()}else{let e=await h.mutateAsync({username:s.username,displayname:s.displayname,email:s.email,password:s.password,groups:o});i(`User created successfully`),n(e.user.username)}}catch(e){f(G(e))}}let y=h.isPending;return(0,M.jsxs)(bo,{onClose:t,children:[(0,M.jsx)(`h2`,{className:`mb-4 text-lg font-bold text-white`,children:r?`Edit User`:`Add User`}),(0,M.jsxs)(`form`,{onSubmit:v,className:`space-y-4`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`label`,{className:`mb-1 block text-sm text-zinc-400`,children:`Username`}),(0,M.jsx)(`input`,{type:`text`,value:s.username,onChange:e=>_(`username`,e.target.value),disabled:r,placeholder:`johndoe`,className:`w-full rounded-lg border border-zinc-700 bg-zinc-900 px-3 py-2 text-sm text-white placeholder-zinc-600 focus:border-cyan-500 focus:outline-none disabled:text-zinc-500`})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`label`,{className:`mb-1 block text-sm text-zinc-400`,children:`Display Name`}),(0,M.jsx)(`input`,{type:`text`,value:s.displayname,onChange:e=>_(`displayname`,e.target.value),placeholder:`John Doe`,className:`w-full rounded-lg border border-zinc-700 bg-zinc-900 px-3 py-2 text-sm text-white placeholder-zinc-600 focus:border-cyan-500 focus:outline-none`})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`label`,{className:`mb-1 block text-sm text-zinc-400`,children:`Email`}),(0,M.jsx)(`input`,{type:`email`,value:s.email,onChange:e=>_(`email`,e.target.value),placeholder:`john@example.com`,className:`w-full rounded-lg border border-zinc-700 bg-zinc-900 px-3 py-2 text-sm text-white placeholder-zinc-600 focus:border-cyan-500 focus:outline-none`})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsxs)(`label`,{className:`mb-1 block text-sm text-zinc-400`,children:[`Password`,r?` (leave blank to keep current)`:``]}),(0,M.jsxs)(`div`,{className:`relative`,children:[(0,M.jsx)(`input`,{type:l?`text`:`password`,value:s.password,onChange:e=>_(`password`,e.target.value),placeholder:r?`Leave blank to keep current password`:`Minimum 8 characters`,className:`w-full rounded-lg border border-zinc-700 bg-zinc-900 px-3 py-2 pr-10 text-sm text-white placeholder-zinc-600 focus:border-cyan-500 focus:outline-none`}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>u(!l),className:`absolute right-3 top-1/2 -translate-y-1/2 text-zinc-500 hover:text-zinc-300`,children:l?(0,M.jsx)(Qr,{size:16}):(0,M.jsx)($r,{size:16})})]})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`label`,{className:`mb-1 block text-sm text-zinc-400`,children:`Groups (comma-separated)`}),(0,M.jsx)(`input`,{type:`text`,value:s.groups,onChange:e=>_(`groups`,e.target.value),placeholder:`admins, users`,className:`w-full rounded-lg border border-zinc-700 bg-zinc-900 px-3 py-2 text-sm text-white placeholder-zinc-600 focus:border-cyan-500 focus:outline-none`})]}),d&&(0,M.jsx)(`p`,{className:`text-sm text-red-400`,children:d}),(0,M.jsxs)(`div`,{className:`flex gap-3 pt-2`,children:[(0,M.jsx)(`button`,{type:`button`,onClick:t,className:`flex-1 rounded-lg border border-zinc-700 px-4 py-2 text-sm text-zinc-400 hover:text-white`,children:`Cancel`}),(0,M.jsx)(`button`,{type:`submit`,disabled:y,className:`flex-1 rounded-lg bg-cyan-600 px-4 py-2 text-sm font-semibold text-white hover:bg-cyan-500 disabled:opacity-50`,children:y?`Saving...`:r?`Save Changes`:`Create User`})]})]})]})}function Co({onClose:e,onSuccess:t}){let n=U(),r=N(),i=L(),[a,o]=(0,g.useState)({username:``,email:``,groups:``}),[s,c]=(0,g.useState)(``),l=F({mutationFn:e=>i.createInvitation(e),onSuccess:()=>r.invalidateQueries({queryKey:[`invitations`]})});function u(e,t){o(n=>({...n,[e]:t})),c(``)}async function d(e){if(e.preventDefault(),c(``),!a.username||!a.email){c(`Username and email are required`);return}if(!/^[a-z0-9_-]+$/.test(a.username)){c(`Username must contain only lowercase alphanumeric characters, underscores, and hyphens`);return}if(a.username.length<2){c(`Username must be at least 2 characters`);return}let r=a.groups.split(`,`).map(e=>e.trim()).filter(Boolean);try{let e=await l.mutateAsync({username:a.username,email:a.email,groups:r});n(`Invitation created`),t(e)}catch(e){c(G(e))}}return(0,M.jsxs)(bo,{onClose:e,children:[(0,M.jsx)(`h2`,{className:`mb-4 text-lg font-bold text-white`,children:`Invite User`}),(0,M.jsx)(`p`,{className:`mb-4 text-sm text-zinc-400`,children:`Generate an invitation link. The invited user will set their own password and TOTP.`}),(0,M.jsxs)(`form`,{onSubmit:d,className:`space-y-4`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`label`,{className:`mb-1 block text-sm text-zinc-400`,children:`Username`}),(0,M.jsx)(`input`,{type:`text`,value:a.username,onChange:e=>u(`username`,e.target.value),placeholder:`johndoe`,className:`w-full rounded-lg border border-zinc-700 bg-zinc-900 px-3 py-2 text-sm text-white placeholder-zinc-600 focus:border-cyan-500 focus:outline-none`})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`label`,{className:`mb-1 block text-sm text-zinc-400`,children:`Email`}),(0,M.jsx)(`input`,{type:`email`,value:a.email,onChange:e=>u(`email`,e.target.value),placeholder:`john@example.com`,className:`w-full rounded-lg border border-zinc-700 bg-zinc-900 px-3 py-2 text-sm text-white placeholder-zinc-600 focus:border-cyan-500 focus:outline-none`})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`label`,{className:`mb-1 block text-sm text-zinc-400`,children:`Groups (comma-separated, optional)`}),(0,M.jsx)(`input`,{type:`text`,value:a.groups,onChange:e=>u(`groups`,e.target.value),placeholder:`users`,className:`w-full rounded-lg border border-zinc-700 bg-zinc-900 px-3 py-2 text-sm text-white placeholder-zinc-600 focus:border-cyan-500 focus:outline-none`})]}),s&&(0,M.jsx)(`p`,{className:`text-sm text-red-400`,children:s}),(0,M.jsxs)(`div`,{className:`flex gap-3 pt-2`,children:[(0,M.jsx)(`button`,{type:`button`,onClick:e,className:`flex-1 rounded-lg border border-zinc-700 px-4 py-2 text-sm text-zinc-400 hover:text-white`,children:`Cancel`}),(0,M.jsx)(`button`,{type:`submit`,disabled:l.isPending,className:`flex-1 rounded-lg bg-cyan-600 px-4 py-2 text-sm font-semibold text-white hover:bg-cyan-500 disabled:opacity-50`,children:l.isPending?`Creating...`:`Create Invitation`})]})]})]})}function wo({inviteUrl:e,token:t,onClose:n}){let[r,i]=(0,g.useState)(!1),a=e||`(Domain not configured — token: ${t})`;function o(){let n=e||t;navigator.clipboard.writeText(n).then(()=>{i(!0),setTimeout(()=>i(!1),2e3)}).catch(()=>{})}return(0,M.jsxs)(bo,{onClose:n,children:[(0,M.jsx)(`h2`,{className:`mb-4 text-lg font-bold text-white`,children:`Invitation Created`}),(0,M.jsx)(`p`,{className:`mb-4 text-sm text-zinc-400`,children:`Share this link with the invited user. It expires in 7 days.`}),(0,M.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 rounded-lg bg-zinc-900 px-4 py-3`,children:[(0,M.jsx)(`code`,{className:`flex-1 text-sm text-cyan-400 break-all`,children:a}),(0,M.jsx)(`button`,{type:`button`,onClick:o,className:`flex-shrink-0 text-zinc-500 hover:text-zinc-300`,title:`Copy link`,children:r?(0,M.jsx)(Fr,{size:16,className:`text-green-400`}):(0,M.jsx)(Kr,{size:16})})]}),!e&&(0,M.jsx)(`p`,{className:`mb-4 text-xs text-yellow-400`,children:`Domain is not configured. The invitation token has been created but cannot generate a full URL.`}),(0,M.jsx)(`button`,{type:`button`,onClick:n,className:`w-full rounded-lg bg-cyan-600 px-4 py-2 text-sm font-semibold text-white hover:bg-cyan-500`,children:`Done`})]})}function To({title:e,message:t,confirmLabel:n,destructive:r,onConfirm:i,onCancel:a,isPending:o}){return(0,M.jsxs)(bo,{onClose:a,children:[(0,M.jsx)(`h2`,{className:`mb-2 text-lg font-bold text-white`,children:e}),(0,M.jsx)(`p`,{className:`mb-6 text-sm text-zinc-400`,children:t}),(0,M.jsxs)(`div`,{className:`flex gap-3`,children:[(0,M.jsx)(`button`,{type:`button`,onClick:a,className:`flex-1 rounded-lg border border-zinc-700 px-4 py-2 text-sm text-zinc-400 hover:text-white`,children:`Cancel`}),(0,M.jsx)(`button`,{type:`button`,onClick:i,disabled:o,className:`flex-1 rounded-lg px-4 py-2 text-sm font-semibold text-white disabled:opacity-50 ${r?`bg-red-600 hover:bg-red-500`:`bg-cyan-600 hover:bg-cyan-500`}`,children:o?`Please wait...`:n})]})]})}function Eo(){let e=U(),t=N(),n=L(),[r,i]=(0,g.useState)(!1),[a,o]=(0,g.useState)(null),[s,c]=(0,g.useState)(null),[l,u]=(0,g.useState)(null),[d,f]=(0,g.useState)(null),[p,m]=(0,g.useState)(!1),[h,_]=(0,g.useState)(null),[v,y]=(0,g.useState)(null),b=P({queryKey:[`users`],queryFn:()=>n.getUsers()}),x=F({mutationFn:e=>n.deleteUser(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`users`]}),e(`User deleted successfully`),c(null)},onError:t=>{e(G(t),`error`),c(null)}}),S=F({mutationFn:e=>n.resetTotp(e),onSuccess:e=>{f(null),u(e.totpUri)},onError:t=>{e(G(t),`error`),f(null)}}),C=P({queryKey:[`invitations`],queryFn:()=>n.getInvitations()}),w=F({mutationFn:e=>n.revokeInvitation(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`invitations`]}),e(`Invitation revoked`),y(null)},onError:t=>{e(G(t),`error`),y(null)}}),T=b.data?.users||[],E=C.data?.invitations||[],D=T.length<=1;async function ee(e){i(!1);try{u((await S.mutateAsync(e)).totpUri)}catch{}}function te(e){f(e)}function ne(){d&&S.mutate(d)}function re(){u(null)}return(0,M.jsxs)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:[(0,M.jsxs)(`div`,{className:`mb-6 flex items-center justify-between`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h1`,{className:`text-xl font-bold text-white`,children:`Users`}),(0,M.jsx)(`p`,{className:`text-zinc-500 text-sm mt-1`,children:`Manage Authelia users and two-factor authentication.`})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsxs)(`button`,{type:`button`,onClick:()=>m(!0),className:`flex items-center gap-2 rounded-lg border border-zinc-700 px-4 py-2 text-sm font-semibold text-zinc-300 hover:border-cyan-500 hover:text-white`,children:[(0,M.jsx)(vi,{size:16}),`Invite User`]}),(0,M.jsxs)(`button`,{type:`button`,onClick:()=>i(!0),className:`flex items-center gap-2 rounded-lg bg-cyan-600 px-4 py-2 text-sm font-semibold text-white hover:bg-cyan-500`,children:[(0,M.jsx)(Ki,{size:16}),`Add User`]})]})]}),(0,M.jsx)(`div`,{className:`overflow-x-auto rounded-lg border border-zinc-800 bg-zinc-900`,children:b.isLoading?(0,M.jsx)(`div`,{className:`p-8 text-center`,children:(0,M.jsx)(`div`,{className:`mx-auto h-6 w-6 animate-spin rounded-full border-2 border-zinc-600 border-t-cyan-400`})}):b.isError?(0,M.jsx)(`div`,{className:`p-8 text-center text-red-400 text-sm`,children:`Failed to load users`}):T.length===0?(0,M.jsx)(`div`,{className:`p-8 text-center text-zinc-500 text-sm`,children:`No users configured. Add your first user to get started.`}):(0,M.jsxs)(`table`,{className:`w-full text-left`,children:[(0,M.jsx)(`thead`,{children:(0,M.jsxs)(`tr`,{className:`border-b border-zinc-700`,children:[(0,M.jsx)(`th`,{className:`px-4 py-3 text-xs font-semibold uppercase text-zinc-400`,children:`Username`}),(0,M.jsx)(`th`,{className:`px-4 py-3 text-xs font-semibold uppercase text-zinc-400`,children:`Display Name`}),(0,M.jsx)(`th`,{className:`px-4 py-3 text-xs font-semibold uppercase text-zinc-400 hidden sm:table-cell`,children:`Email`}),(0,M.jsx)(`th`,{className:`px-4 py-3 text-xs font-semibold uppercase text-zinc-400 hidden md:table-cell`,children:`Groups`}),(0,M.jsx)(`th`,{className:`px-4 py-3 text-xs font-semibold uppercase text-zinc-400 text-right`,children:`Actions`})]})}),(0,M.jsx)(`tbody`,{children:T.map(e=>(0,M.jsxs)(`tr`,{className:`border-b border-zinc-700 last:border-b-0`,children:[(0,M.jsx)(`td`,{className:`px-4 py-3 font-mono text-sm text-cyan-400`,children:e.username}),(0,M.jsx)(`td`,{className:`px-4 py-3 text-sm text-zinc-300`,children:e.displayname}),(0,M.jsx)(`td`,{className:`px-4 py-3 text-sm text-zinc-400 hidden sm:table-cell`,children:e.email}),(0,M.jsx)(`td`,{className:`px-4 py-3 hidden md:table-cell`,children:(0,M.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:(e.groups||[]).map(e=>(0,M.jsx)(`span`,{className:`rounded bg-zinc-700 px-2 py-0.5 text-xs text-zinc-300`,children:e},e))})}),(0,M.jsx)(`td`,{className:`px-4 py-3 text-right`,children:(0,M.jsxs)(`div`,{className:`flex items-center justify-end gap-1`,children:[(0,M.jsx)(`button`,{type:`button`,onClick:()=>o(e),className:`rounded p-1.5 text-zinc-500 hover:bg-zinc-700 hover:text-zinc-300`,title:`Edit user`,children:(0,M.jsx)(wi,{size:14})}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>te(e.username),className:`rounded p-1.5 text-zinc-500 hover:bg-zinc-700 hover:text-zinc-300`,title:`Reset TOTP`,children:(0,M.jsx)(z,{size:14})}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>!D&&c(e.username),disabled:D,className:`rounded p-1.5 text-zinc-500 hover:bg-zinc-700 hover:text-red-400 disabled:cursor-not-allowed disabled:opacity-30`,title:D?`Cannot delete the last user`:`Delete user`,children:(0,M.jsx)(Vi,{size:14})})]})})]},e.username))})]})}),(0,M.jsxs)(`div`,{className:`mt-8 mb-6`,children:[(0,M.jsx)(`h2`,{className:`text-lg font-bold text-white mb-1`,children:`Invitations`}),(0,M.jsx)(`p`,{className:`text-zinc-500 text-sm`,children:`Pending and past invitation links.`})]}),(0,M.jsx)(`div`,{className:`overflow-x-auto rounded-lg border border-zinc-800 bg-zinc-900`,children:C.isLoading?(0,M.jsx)(`div`,{className:`p-8 text-center`,children:(0,M.jsx)(`div`,{className:`mx-auto h-6 w-6 animate-spin rounded-full border-2 border-zinc-600 border-t-cyan-400`})}):C.isError?(0,M.jsx)(`div`,{className:`p-8 text-center text-red-400 text-sm`,children:`Failed to load invitations`}):E.length===0?(0,M.jsx)(`div`,{className:`p-8 text-center text-zinc-500 text-sm`,children:`No invitations yet. Click "Invite User" to generate a link.`}):(0,M.jsxs)(`table`,{className:`w-full text-left`,children:[(0,M.jsx)(`thead`,{children:(0,M.jsxs)(`tr`,{className:`border-b border-zinc-700`,children:[(0,M.jsx)(`th`,{className:`px-4 py-3 text-xs font-semibold uppercase text-zinc-400`,children:`Username`}),(0,M.jsx)(`th`,{className:`px-4 py-3 text-xs font-semibold uppercase text-zinc-400 hidden sm:table-cell`,children:`Email`}),(0,M.jsx)(`th`,{className:`px-4 py-3 text-xs font-semibold uppercase text-zinc-400`,children:`Status`}),(0,M.jsx)(`th`,{className:`px-4 py-3 text-xs font-semibold uppercase text-zinc-400 hidden md:table-cell`,children:`Expires`}),(0,M.jsx)(`th`,{className:`px-4 py-3 text-xs font-semibold uppercase text-zinc-400 text-right`,children:`Actions`})]})}),(0,M.jsx)(`tbody`,{children:E.map(e=>(0,M.jsxs)(`tr`,{className:`border-b border-zinc-700 last:border-b-0`,children:[(0,M.jsx)(`td`,{className:`px-4 py-3 font-mono text-sm text-cyan-400`,children:e.username}),(0,M.jsx)(`td`,{className:`px-4 py-3 text-sm text-zinc-400 hidden sm:table-cell`,children:e.email}),(0,M.jsx)(`td`,{className:`px-4 py-3`,children:(0,M.jsx)(`span`,{className:`text-xs px-2 py-0.5 rounded-full border ${e.status===`accepted`?`text-green-400 bg-green-500/10 border-green-500/20`:e.status===`expired`?`text-zinc-500 bg-zinc-800 border-zinc-700`:`text-yellow-400 bg-yellow-500/10 border-yellow-500/20`}`,children:e.status})}),(0,M.jsx)(`td`,{className:`px-4 py-3 text-sm text-zinc-500 hidden md:table-cell`,children:new Date(e.expiresAt).toLocaleDateString()}),(0,M.jsx)(`td`,{className:`px-4 py-3 text-right`,children:e.status===`pending`&&(0,M.jsx)(`button`,{type:`button`,onClick:()=>y(e.id),className:`rounded p-1.5 text-zinc-500 hover:bg-zinc-700 hover:text-red-400`,title:`Revoke invitation`,children:(0,M.jsx)(Ur,{size:14})})})]},e.id))})]})}),p&&(0,M.jsx)(Co,{onClose:()=>m(!1),onSuccess:e=>{m(!1),_(e)}}),h&&(0,M.jsx)(wo,{inviteUrl:h.inviteUrl,token:h.token,onClose:()=>_(null)}),v&&(0,M.jsx)(To,{title:`Revoke Invitation`,message:`Are you sure you want to revoke this invitation? The link will no longer work.`,confirmLabel:`Revoke`,destructive:!0,onConfirm:()=>w.mutate(v),onCancel:()=>y(null),isPending:w.isPending}),r&&(0,M.jsx)(So,{onClose:()=>i(!1),onSuccess:ee}),a&&(0,M.jsx)(So,{user:a,onClose:()=>o(null)}),s&&(0,M.jsx)(To,{title:`Delete User`,message:`Are you sure you want to delete user '${s}'? This action cannot be undone.`,confirmLabel:`Delete`,destructive:!0,onConfirm:()=>x.mutate(s),onCancel:()=>c(null),isPending:x.isPending}),d&&!l&&(0,M.jsx)(To,{title:`Reset TOTP`,message:`This will invalidate the current TOTP secret for '${d}'. They will need to re-enroll their authenticator app.`,confirmLabel:`Reset TOTP`,onConfirm:ne,onCancel:()=>f(null),isPending:S.isPending}),l&&(0,M.jsx)(xo,{totpUri:l,onClose:re}),(0,M.jsx)(Do,{})]})}function Do(){let e=L(),[t,n]=(0,g.useState)(!1),r=P({queryKey:[`identity-groups`],queryFn:()=>e.getIdentityGroups(),retry:!1,staleTime:6e4}),i=P({queryKey:[`identity-self`],queryFn:()=>e.getIdentitySelf(),retry:!1,staleTime:6e4,enabled:t}),a=r.data?.groups||[];return(0,M.jsxs)(`div`,{className:`mt-8 border-t border-zinc-700 pt-6`,children:[(0,M.jsxs)(`button`,{type:`button`,onClick:()=>n(e=>!e),className:`flex items-center gap-2 text-lg font-semibold text-white hover:text-zinc-300 w-full text-left`,children:[(0,M.jsx)(ni,{size:18,className:`text-cyan-400`}),`Identity & Groups`,t?(0,M.jsx)(zr,{size:16,className:`text-zinc-500 ml-auto`}):(0,M.jsx)(Ir,{size:16,className:`text-zinc-500 ml-auto`})]}),t&&(0,M.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[i.data&&(0,M.jsxs)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-4`,children:[(0,M.jsx)(`h3`,{className:`text-sm font-medium text-zinc-400 mb-2`,children:`Your Identity (via Authelia)`}),(0,M.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-sm`,children:[(0,M.jsx)(`span`,{className:`text-zinc-500`,children:`Username:`}),(0,M.jsx)(`span`,{className:`text-zinc-200`,children:i.data.username||`—`}),(0,M.jsx)(`span`,{className:`text-zinc-500`,children:`Display Name:`}),(0,M.jsx)(`span`,{className:`text-zinc-200`,children:i.data.displayName||`—`}),(0,M.jsx)(`span`,{className:`text-zinc-500`,children:`Email:`}),(0,M.jsx)(`span`,{className:`text-zinc-200`,children:i.data.email||`—`}),(0,M.jsx)(`span`,{className:`text-zinc-500`,children:`Groups:`}),(0,M.jsx)(`span`,{className:`text-zinc-200`,children:i.data.groups?.length>0?i.data.groups.join(`, `):`—`})]})]}),i.isError&&(0,M.jsx)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-4`,children:(0,M.jsx)(`p`,{className:`text-xs text-zinc-500`,children:`Identity information is only available when accessing the panel through an Authelia-protected domain.`})}),r.isLoading?(0,M.jsx)(`div`,{className:`h-10 animate-pulse rounded-lg bg-zinc-900 border border-zinc-800`}):a.length>0?(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h3`,{className:`text-sm font-medium text-zinc-400 mb-2`,children:`All Groups`}),(0,M.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:a.map(e=>(0,M.jsx)(`span`,{className:`text-xs px-2.5 py-1 rounded-full bg-cyan-500/10 text-cyan-400 border border-cyan-500/20`,children:e},e))})]}):(0,M.jsx)(`p`,{className:`text-sm text-zinc-500`,children:`No groups defined in Authelia.`})]})]})}function Oo(e){return e.os===`darwin`?`macOS`:e.distro?[e.distro.id,e.distro.versionId].filter(Boolean).join(` `):`Linux`}function ko({facts:e,at:t}){if(!e)return(0,M.jsx)(`span`,{className:`text-xs text-zinc-600`,title:`The agent reports its host on its sync — it has not yet (sync not running, or lamaste-agent too old)`,children:`host not reported`});let n=e.os===`linux`,r=[Oo(e),e.arch,`Node ${e.node}`];return n&&r.push(e.systemd?`systemd`:`no systemd`),(0,M.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-x-1.5 text-xs text-zinc-500`,children:[(0,M.jsx)(qr,{size:11,className:`shrink-0 text-zinc-600`}),r.map((e,t)=>(0,M.jsxs)(`span`,{className:`whitespace-nowrap`,children:[t>0&&`· `,e]},`${t}-${e}`)),n&&(e.apphost?(0,M.jsxs)(`span`,{className:`whitespace-nowrap text-cyan-400`,title:`The app host helper is enabled: Lamaste can install agent halves here`,children:[`· app host v`,e.apphost.version,e.apphost.relayKid?(0,M.jsxs)(`span`,{className:`text-zinc-500`,title:`The helper runs app jobs signed with relay key ${e.apphost.relayKid}`,children:[` `,`(relay key `,e.apphost.relayKid.slice(0,12),`)`]}):(0,M.jsxs)(`span`,{className:`text-yellow-400`,title:`The helper has no key of this relay pinned and runs none of its app jobs: sudo lamaste-agent apphost pin`,children:[` `,`(no relay key pinned)`]})]}):(0,M.jsx)(`span`,{className:`whitespace-nowrap text-zinc-600`,title:`Enable it on the agent with: sudo lamaste-agent apphost enable`,children:`· app host off`})),t&&(0,M.jsxs)(`span`,{className:`whitespace-nowrap text-zinc-600`,children:[`· reported `,new Date(t).toLocaleString()]})]})}function Ao({type:e}){return(0,M.jsx)(`span`,{className:`text-xs px-2 py-0.5 rounded-full ${{letsencrypt:`bg-blue-500/20 text-blue-400`,"mtls-ca":`bg-purple-500/20 text-purple-400`,"mtls-client":`bg-purple-500/20 text-purple-400`}[e]||`bg-zinc-500/20 text-zinc-400`}`,children:{letsencrypt:`Let's Encrypt`,"mtls-ca":`mTLS CA`,"mtls-client":`mTLS Client`}[e]||e})}function jo({days:e}){let t=`text-green-400`,n=`bg-green-400`;return e<=7?(t=`text-red-400`,n=`bg-red-400`):e<=30&&(t=`text-amber-400`,n=`bg-amber-400`),(0,M.jsxs)(`span`,{className:`flex items-center gap-1.5 ${t}`,children:[(0,M.jsx)(`span`,{className:`inline-block h-2 w-2 rounded-full ${n}`}),e,`d`]})}function Mo(e){if(!e)return`N/A`;try{return new Date(e).toLocaleDateString(`en-US`,{month:`short`,day:`numeric`,year:`numeric`})}catch{return e}}function No({data:e,isLoading:t}){return t?(0,M.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm text-zinc-500`,children:[(0,M.jsx)(B,{size:14,className:`animate-spin`}),`Checking auto-renewal status...`]}):e?e.active?(0,M.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-x-4 gap-y-1 text-sm text-zinc-400`,children:[(0,M.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,M.jsx)(`span`,{className:`inline-block h-2 w-2 rounded-full bg-green-400`}),`Auto-renewal active`]}),e.nextRun&&(0,M.jsxs)(`span`,{children:[`Next run: `,Mo(e.nextRun)]}),e.lastRun&&(0,M.jsxs)(`span`,{children:[`Last renewed: `,Mo(e.lastRun)]})]}):(0,M.jsxs)(`div`,{className:`mb-4 flex items-center gap-1.5 text-sm text-amber-400`,children:[(0,M.jsx)(`span`,{className:`inline-block h-2 w-2 rounded-full bg-red-400`}),`Auto-renewal is not active. Certificates may expire.`]}):null}function Po({certs:e,onRenew:t,renewingDomain:n}){let r=e.filter(e=>e.type===`letsencrypt`);return r.length===0?(0,M.jsx)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-6`,children:(0,M.jsx)(`p`,{className:`text-zinc-500 text-sm text-center`,children:`No Let's Encrypt certificates found.`})}):(0,M.jsx)(`div`,{className:`overflow-x-auto rounded-lg border border-zinc-800`,children:(0,M.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,M.jsx)(`thead`,{children:(0,M.jsxs)(`tr`,{className:`border-b border-zinc-700 bg-zinc-900`,children:[(0,M.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400`,children:`Type`}),(0,M.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400`,children:`Domain`}),(0,M.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400`,children:`Expiry Date`}),(0,M.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400`,children:`Days Remaining`}),(0,M.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400`,children:`Actions`})]})}),(0,M.jsx)(`tbody`,{children:r.map(e=>(0,M.jsxs)(`tr`,{className:`border-b border-zinc-700 bg-zinc-800`,children:[(0,M.jsx)(`td`,{className:`px-4 py-3`,children:(0,M.jsx)(Ao,{type:e.type})}),(0,M.jsx)(`td`,{className:`px-4 py-3 text-zinc-300 font-mono text-xs`,children:e.domain||`N/A`}),(0,M.jsx)(`td`,{className:`px-4 py-3 text-zinc-400`,children:Mo(e.expiresAt)}),(0,M.jsx)(`td`,{className:`px-4 py-3`,children:(0,M.jsx)(jo,{days:e.daysUntilExpiry})}),(0,M.jsx)(`td`,{className:`px-4 py-3`,children:(0,M.jsx)(`button`,{type:`button`,disabled:!!n,onClick:()=>t(e.domain),className:`flex items-center gap-1.5 rounded bg-zinc-700 px-3 py-1.5 text-xs text-zinc-300 hover:bg-zinc-600 disabled:opacity-50 disabled:cursor-not-allowed`,children:n===e.domain?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(B,{size:12,className:`animate-spin`}),`Renewing...`]}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(ki,{size:12}),`Renew`]})})})]},e.domain||e.path))})]})})}function Fo({certs:e,onRotate:t,adminAuthMode:n}){let r=e.find(e=>e.type===`mtls-ca`),i=e.find(e=>e.type===`mtls-client`),a=n===`hardware-bound`;return!r&&!i?null:(0,M.jsx)(`div`,{className:`mt-8`,children:(0,M.jsxs)(`div`,{className:`border-t border-zinc-700 pt-6`,children:[(0,M.jsxs)(`h2`,{className:`text-lg font-semibold text-white mb-4 flex items-center gap-2`,children:[(0,M.jsx)(Ii,{size:18,className:`text-purple-400`}),`mTLS Certificates`,a&&(0,M.jsx)(`span`,{className:`text-xs px-2 py-0.5 rounded-full border text-emerald-400 bg-emerald-500/10 border-emerald-500/20`,children:`hardware-bound`})]}),(0,M.jsxs)(`div`,{className:`space-y-4`,children:[r&&(0,M.jsxs)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-5`,children:[(0,M.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,M.jsxs)(`div`,{children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,M.jsx)(Ao,{type:`mtls-ca`}),(0,M.jsx)(`span`,{className:`text-white font-semibold text-sm`,children:`Certificate Authority`})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-4 text-sm text-zinc-400 mt-2`,children:[(0,M.jsxs)(`span`,{children:[`Expires: `,Mo(r.expiresAt)]}),(0,M.jsx)(jo,{days:r.daysUntilExpiry})]})]})}),(0,M.jsx)(`p`,{className:`text-xs text-zinc-500 mt-3`,children:`The CA certificate cannot be rotated. It was created during initial setup.`})]}),i&&(0,M.jsxs)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-5`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,M.jsx)(Ao,{type:`mtls-client`}),(0,M.jsx)(`span`,{className:`text-white font-semibold text-sm`,children:`Client Certificate`})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-4 text-sm text-zinc-400 mt-2`,children:[(0,M.jsxs)(`span`,{children:[`Expires: `,Mo(i.expiresAt)]}),(0,M.jsx)(jo,{days:i.daysUntilExpiry})]})]}),!a&&(0,M.jsxs)(`button`,{type:`button`,onClick:t,className:`flex items-center gap-1.5 rounded bg-amber-600 px-3 py-1.5 text-xs text-white hover:bg-amber-500`,children:[(0,M.jsx)(ki,{size:12}),`Rotate`]})]}),a&&(0,M.jsxs)(`p`,{className:`text-xs text-emerald-400/70 mt-3`,children:[`Admin uses a hardware-bound certificate. P12 download and rotation are disabled. To revert, run`,` `,(0,M.jsx)(`code`,{className:`bg-zinc-800 px-1 py-0.5 rounded`,children:`sudo lamaste-reset-admin`}),` `,`on the server.`]})]})]})]})})}function Io({status:e}){return(0,M.jsx)(`span`,{className:`text-xs px-2 py-0.5 rounded-full border ${{active:`text-green-400 bg-green-500/10 border-green-500/20`,"expiring-soon":`text-yellow-400 bg-yellow-500/10 border-yellow-500/20`,expired:`text-red-400 bg-red-500/10 border-red-500/20`,revoked:`text-red-400 bg-red-500/10 border-red-500/20`}[e]||`text-zinc-500 bg-zinc-800 border-zinc-700`}`,children:{active:`active`,"expiring-soon":`expiring soon`,expired:`expired`,revoked:`revoked`}[e]||e})}function Lo({method:e}){return e===`hardware-bound`?(0,M.jsx)(`span`,{className:`text-xs px-2 py-0.5 rounded-full border text-emerald-400 bg-emerald-500/10 border-emerald-500/20`,children:`hardware-bound`}):e===`delegated`?(0,M.jsx)(`span`,{className:`text-xs px-2 py-0.5 rounded-full border text-violet-400 bg-violet-500/10 border-violet-500/20`,children:`delegated`}):(0,M.jsx)(`span`,{className:`text-xs px-2 py-0.5 rounded-full border text-zinc-500 bg-zinc-800 border-zinc-700`,children:`p12`})}function Ro(e){if(!e.startsWith(`plugin-agent:`))return null;let t=e.split(`:`);return t.length>=3?{displayName:t.slice(2).join(`:`),viaAgent:t[1]}:null}function zo({label:e}){let t=Ro(e);return t?(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`span`,{className:`text-zinc-200 font-semibold`,children:t.displayName}),(0,M.jsxs)(`span`,{className:`block text-xs text-zinc-500 mt-0.5`,title:e,children:[`via `,t.viaAgent]})]}):(0,M.jsx)(`span`,{className:`text-zinc-200 font-semibold`,children:e})}var Bo=[{value:`tunnels:read`,label:`tunnels:read`,description:`List tunnels and download plist`,mandatory:!0},{value:`tunnels:write`,label:`tunnels:write`,description:`Create and delete tunnels`},{value:`services:read`,label:`services:read`,description:`View service status`},{value:`services:write`,label:`services:write`,description:`Start/stop/restart services`},{value:`system:read`,label:`system:read`,description:`View system stats (CPU, RAM, disk)`},{value:`sites:read`,label:`sites:read`,description:`List sites and browse files`},{value:`sites:write`,label:`sites:write`,description:`Create, delete, and deploy to sites`},{value:`panel:expose`,label:`panel:expose`,description:`Expose agent management panel at agent-<label>.<domain>`},{value:`identity:read`,label:`identity:read`,description:`Parse Authelia identity headers on plugin routes`},{value:`identity:query`,label:`identity:query`,description:`Query panel for Authelia user metadata`}];function Vo({capabilities:e,onChange:t,disabled:n}){let r=n=>{n!==`tunnels:read`&&(e.includes(n)?t(e.filter(e=>e!==n)):t([...e,n]))};return(0,M.jsx)(`div`,{className:`space-y-2`,children:Bo.map(t=>(0,M.jsxs)(`label`,{className:`flex items-start gap-3 rounded border px-3 py-2 cursor-pointer ${e.includes(t.value)?`border-cyan-500/30 bg-cyan-500/5`:`border-zinc-700 bg-zinc-800/50`} ${t.mandatory||n?`opacity-80`:``}`,children:[(0,M.jsx)(`input`,{type:`checkbox`,checked:e.includes(t.value),onChange:()=>r(t.value),disabled:t.mandatory||n,className:`mt-0.5 accent-cyan-500`}),(0,M.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,M.jsx)(`span`,{className:`text-sm font-mono text-zinc-200`,children:t.label}),(0,M.jsx)(`p`,{className:`text-xs text-zinc-500`,children:t.description})]})]},t.value))})}function Ho({onClose:e}){let t=L(),n=N(),r=U(),[i,a]=(0,g.useState)(``),[o,s]=(0,g.useState)([`tunnels:read`]),[c,l]=(0,g.useState)([]),[u,d]=(0,g.useState)(null),[f,p]=(0,g.useState)(!1),[m,h]=(0,g.useState)(null),{data:_}=P({queryKey:[`sites`],queryFn:()=>t.getSites()}),v=F({mutationFn:e=>t.generateAgentCert(e),onSuccess:e=>{d(e),n.invalidateQueries({queryKey:[`agent-certs`]})},onError:e=>{h(G(e))}}),y=(0,g.useCallback)(e=>{if(e.preventDefault(),h(null),!i.trim()){h(`Label is required`);return}if(!/^[a-z0-9][a-z0-9-]*[a-z0-9]$|^[a-z0-9]$/.test(i)){h(`Lowercase letters, numbers, and hyphens only. Cannot start or end with a hyphen.`);return}v.mutate({label:i,capabilities:o,allowedSites:c})},[i,o,c,v]),b=(0,g.useCallback)(async()=>{if(u?.p12Password)try{await navigator.clipboard.writeText(u.p12Password),p(!0),setTimeout(()=>p(!1),2e3)}catch{r(`Failed to copy — please select and copy manually`,`error`)}},[u,r]),x=(0,g.useCallback)(()=>{u?.label&&t.downloadAgentCert(u.label)},[u,t]),S=(0,g.useCallback)(()=>{e()},[e]);return(0,M.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4`,children:(0,M.jsxs)(`div`,{className:`w-full max-w-lg rounded-lg bg-zinc-900 border border-zinc-800 shadow-xl`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between border-b border-zinc-800 px-6 py-4`,children:[(0,M.jsxs)(`h3`,{className:`flex items-center gap-2 text-lg font-semibold text-white`,children:[(0,M.jsx)(ui,{size:20,className:`text-cyan-400`}),u?`Certificate Generated`:`Generate Agent Certificate`]}),!v.isPending&&(0,M.jsx)(`button`,{type:`button`,onClick:S,className:`text-zinc-500 hover:text-zinc-300`,children:(0,M.jsx)(H,{size:18})})]}),(0,M.jsx)(`div`,{className:`px-6 py-5`,children:u?(0,M.jsxs)(`div`,{className:`space-y-5`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`label`,{className:`text-sm font-medium text-zinc-300 block mb-2`,children:`Certificate Password:`}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`div`,{className:`flex-1 rounded border border-zinc-700 bg-zinc-950 p-3 font-mono text-yellow-400 text-sm break-all select-all`,children:u.p12Password}),(0,M.jsx)(`button`,{type:`button`,onClick:b,className:`rounded bg-zinc-700 p-2 text-zinc-300 hover:bg-zinc-600 shrink-0`,title:`Copy password`,children:f?(0,M.jsx)(Fr,{size:16,className:`text-green-400`}):(0,M.jsx)(Kr,{size:16})})]})]}),(0,M.jsxs)(`div`,{className:`rounded-lg bg-amber-500/10 border border-amber-500/20 p-4 text-sm text-amber-400 space-y-1`,children:[(0,M.jsx)(`p`,{className:`font-semibold`,children:`Save this password — it cannot be retrieved later.`}),(0,M.jsx)(`p`,{children:`Share the .p12 file and password securely with the Mac user.`})]}),(0,M.jsxs)(`button`,{type:`button`,onClick:x,className:`flex w-full items-center justify-center gap-2 rounded bg-cyan-600 py-3 px-6 text-sm font-semibold text-white hover:bg-cyan-500`,children:[(0,M.jsx)(Yr,{size:16}),`Download `,u.label,`.p12`]}),(0,M.jsx)(`div`,{className:`flex justify-end`,children:(0,M.jsx)(`button`,{type:`button`,onClick:S,className:`rounded bg-zinc-700 px-4 py-2 text-sm text-zinc-300 hover:bg-zinc-600`,children:`Done`})})]}):(0,M.jsxs)(`form`,{onSubmit:y,className:`space-y-4`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`label`,{className:`block text-sm font-medium text-zinc-300 mb-1`,children:`Label`}),(0,M.jsx)(`input`,{type:`text`,value:i,onChange:e=>{a(e.target.value.toLowerCase()),h(null)},disabled:v.isPending,placeholder:`e.g. macbook-pro`,className:`w-full rounded bg-zinc-800 border border-zinc-700 px-3 py-2 text-sm text-zinc-200 font-mono placeholder:text-zinc-600 focus:outline-none focus:border-cyan-400 disabled:opacity-50`}),(0,M.jsx)(`p`,{className:`text-xs text-zinc-500 mt-1`,children:`Lowercase letters, numbers, and hyphens only.`})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`label`,{className:`block text-sm font-medium text-zinc-300 mb-2`,children:`Capabilities`}),(0,M.jsx)(Vo,{capabilities:o,onChange:s,disabled:v.isPending})]}),(o.includes(`sites:read`)||o.includes(`sites:write`))&&(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`label`,{className:`block text-sm font-medium text-zinc-300 mb-2`,children:`Site Access`}),(0,M.jsx)(`p`,{className:`text-xs text-zinc-500 mb-2`,children:`Select which static sites this agent can manage files for.`}),_?.sites?.length>0?(0,M.jsx)(`div`,{className:`space-y-1`,children:_.sites.map(e=>(0,M.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-zinc-300 cursor-pointer`,children:[(0,M.jsx)(`input`,{type:`checkbox`,checked:c.includes(e.name),onChange:()=>{l(t=>t.includes(e.name)?t.filter(t=>t!==e.name):[...t,e.name])},disabled:v.isPending,className:`rounded border-zinc-600 bg-zinc-800 text-cyan-400 focus:ring-cyan-400`}),(0,M.jsx)(`span`,{className:`font-mono`,children:e.name}),(0,M.jsxs)(`span`,{className:`text-zinc-500 text-xs`,children:[`(`,e.fqdn,`)`]})]},e.id))}):(0,M.jsx)(`p`,{className:`text-xs text-zinc-500`,children:`No sites created yet.`})]}),m&&(0,M.jsx)(`div`,{className:`rounded bg-red-500/10 border border-red-500/20 px-3 py-2 text-sm text-red-400`,children:m}),(0,M.jsxs)(`div`,{className:`flex items-center gap-3 justify-end`,children:[(0,M.jsx)(`button`,{type:`button`,onClick:S,disabled:v.isPending,className:`rounded bg-zinc-700 px-4 py-2 text-sm text-zinc-300 hover:bg-zinc-600 disabled:opacity-50`,children:`Cancel`}),(0,M.jsx)(`button`,{type:`submit`,disabled:v.isPending,className:`flex items-center gap-2 rounded bg-cyan-600 px-4 py-2 text-sm font-semibold text-white hover:bg-cyan-500 disabled:opacity-50 disabled:cursor-not-allowed`,children:v.isPending?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(B,{size:14,className:`animate-spin`}),`Generating...`]}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(ui,{size:14}),`Generate`]})})]})]})})]})})}function Uo({label:e,onConfirm:t,onCancel:n,isPending:r}){return(0,M.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60`,children:(0,M.jsxs)(`div`,{className:`bg-zinc-900 border border-zinc-800 rounded-lg p-6 max-w-md w-full mx-4 shadow-xl`,children:[(0,M.jsx)(`h3`,{className:`text-lg font-semibold text-white mb-2`,children:`Revoke Certificate`}),(0,M.jsxs)(`p`,{className:`text-zinc-400 text-sm mb-6`,children:[`Revoke certificate for ‘`,(0,M.jsx)(`span`,{className:`text-cyan-400 font-mono`,children:e}),`’? The Mac agent using this certificate will immediately lose access.`]}),(0,M.jsxs)(`div`,{className:`flex items-center justify-end gap-3`,children:[(0,M.jsx)(`button`,{type:`button`,onClick:n,disabled:r,className:`rounded bg-zinc-700 px-4 py-2 text-sm text-zinc-300 hover:bg-zinc-600 disabled:opacity-50`,children:`Cancel`}),(0,M.jsx)(`button`,{type:`button`,onClick:t,disabled:r,className:`flex items-center gap-2 rounded bg-red-600 px-4 py-2 text-sm font-semibold text-white hover:bg-red-500 disabled:opacity-50`,children:r?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(B,{size:14,className:`animate-spin`}),`Revoking...`]}):`Revoke`})]})]})})}function Wo({agent:e,onClose:t}){let n=L(),r=N(),i=U(),[a,o]=(0,g.useState)(e.capabilities||[`tunnels:read`]),s=F({mutationFn:t=>n.updateAgentCapabilities(e.label,t),onSuccess:()=>{r.invalidateQueries({queryKey:[`agent-certs`]}),i(`Capabilities updated for ${e.label}`),t()},onError:e=>{i(G(e),`error`)}});return(0,M.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4`,children:(0,M.jsxs)(`div`,{className:`w-full max-w-lg rounded-lg bg-zinc-900 border border-zinc-800 shadow-xl`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between border-b border-zinc-800 px-6 py-4`,children:[(0,M.jsxs)(`h3`,{className:`flex items-center gap-2 text-lg font-semibold text-white`,children:[(0,M.jsx)(Pi,{size:20,className:`text-cyan-400`}),`Capabilities — `,e.label]}),(0,M.jsx)(`button`,{type:`button`,onClick:t,className:`text-zinc-500 hover:text-zinc-300`,children:(0,M.jsx)(H,{size:18})})]}),(0,M.jsxs)(`div`,{className:`px-6 py-5 space-y-4`,children:[(0,M.jsx)(Vo,{capabilities:a,onChange:o,disabled:s.isPending}),(0,M.jsxs)(`div`,{className:`flex items-center gap-3 justify-end`,children:[(0,M.jsx)(`button`,{type:`button`,onClick:t,disabled:s.isPending,className:`rounded bg-zinc-700 px-4 py-2 text-sm text-zinc-300 hover:bg-zinc-600 disabled:opacity-50`,children:`Cancel`}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>s.mutate(a),disabled:s.isPending,className:`flex items-center gap-2 rounded bg-cyan-600 px-4 py-2 text-sm font-semibold text-white hover:bg-cyan-500 disabled:opacity-50`,children:s.isPending?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(B,{size:14,className:`animate-spin`}),`Saving...`]}):`Save`})]})]})]})})}function Go({agent:e,onClose:t}){let n=L(),r=N(),i=U(),[a,o]=(0,g.useState)(e.allowedSites||[]),{data:s}=P({queryKey:[`sites`],queryFn:()=>n.getSites()}),c=F({mutationFn:t=>n.updateAgentAllowedSites(e.label,t),onSuccess:()=>{r.invalidateQueries({queryKey:[`agent-certs`]}),i(`Allowed sites updated for ${e.label}`),t()},onError:e=>{i(G(e),`error`)}});return(0,M.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4`,children:(0,M.jsxs)(`div`,{className:`w-full max-w-lg rounded-lg bg-zinc-900 border border-zinc-800 shadow-xl`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between border-b border-zinc-800 px-6 py-4`,children:[(0,M.jsxs)(`h3`,{className:`flex items-center gap-2 text-lg font-semibold text-white`,children:[(0,M.jsx)(oi,{size:20,className:`text-cyan-400`}),`Site Access — `,e.label]}),(0,M.jsx)(`button`,{type:`button`,onClick:t,className:`text-zinc-500 hover:text-zinc-300`,children:(0,M.jsx)(H,{size:18})})]}),(0,M.jsxs)(`div`,{className:`px-6 py-5 space-y-4`,children:[(0,M.jsx)(`p`,{className:`text-xs text-zinc-500`,children:`Select which static sites this agent can manage files for.`}),s?.sites?.length>0?(0,M.jsx)(`div`,{className:`space-y-1`,children:s.sites.map(e=>(0,M.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-zinc-300 cursor-pointer`,children:[(0,M.jsx)(`input`,{type:`checkbox`,checked:a.includes(e.name),onChange:()=>{o(t=>t.includes(e.name)?t.filter(t=>t!==e.name):[...t,e.name])},disabled:c.isPending,className:`rounded border-zinc-600 bg-zinc-800 text-cyan-400 focus:ring-cyan-400`}),(0,M.jsx)(`span`,{className:`font-mono`,children:e.name}),(0,M.jsxs)(`span`,{className:`text-zinc-500 text-xs`,children:[`(`,e.fqdn,`)`]})]},e.id))}):(0,M.jsx)(`p`,{className:`text-xs text-zinc-500`,children:`No sites created yet.`}),(0,M.jsxs)(`div`,{className:`flex items-center gap-3 justify-end`,children:[(0,M.jsx)(`button`,{type:`button`,onClick:t,disabled:c.isPending,className:`rounded bg-zinc-700 px-4 py-2 text-sm text-zinc-300 hover:bg-zinc-600 disabled:opacity-50`,children:`Cancel`}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>c.mutate(a),disabled:c.isPending,className:`flex items-center gap-2 rounded bg-cyan-600 px-4 py-2 text-sm font-semibold text-white hover:bg-cyan-500 disabled:opacity-50`,children:c.isPending?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(B,{size:14,className:`animate-spin`}),`Saving...`]}):`Save`})]})]})]})})}function Ko({onClose:e}){let t=L(),n=N(),[r,i]=(0,g.useState)(``),[a,o]=(0,g.useState)([`tunnels:read`]),[s,c]=(0,g.useState)([]),[l,u]=(0,g.useState)(null),[d,f]=(0,g.useState)(null),[p,m]=(0,g.useState)(!1),[h,_]=(0,g.useState)(!1),[v,y]=(0,g.useState)(!1),{data:b}=P({queryKey:[`sites`],queryFn:()=>t.getSites()}),x=F({mutationFn:e=>t.createEnrollmentToken(e),onSuccess:e=>{u(e),n.invalidateQueries({queryKey:[`agent-certs`]})},onError:e=>{f(G(e))}}),S=/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/.test(r),C=()=>{f(null),x.mutate({label:r,capabilities:a,allowedSites:s})},w=async()=>{if(l?.token)try{await navigator.clipboard.writeText(l.token),m(!0),setTimeout(()=>m(!1),2e3)}catch{}},T=l?`npx @lamalibre/lamaste-agent setup --token ${l.token} --panel-url <PANEL_URL>`:``;return(0,M.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/70`,children:(0,M.jsxs)(`div`,{className:`w-full max-w-lg rounded-xl bg-zinc-900 border border-zinc-700 p-6 shadow-xl`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,M.jsx)(`h3`,{className:`text-lg font-semibold text-white`,children:l?`Enrollment Token`:`Generate Enrollment Token`}),(0,M.jsx)(`button`,{type:`button`,onClick:e,className:`text-zinc-400 hover:text-white`,children:(0,M.jsx)(H,{size:20})})]}),l?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`div`,{className:`space-y-4`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`label`,{className:`block text-sm font-medium text-zinc-300 mb-1`,children:`Agent Label`}),(0,M.jsx)(`p`,{className:`text-sm text-cyan-400 font-mono`,children:l.label})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`label`,{className:`block text-sm font-medium text-zinc-300 mb-1`,children:`Enrollment Token`}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`code`,{className:`flex-1 block rounded bg-zinc-800 border border-zinc-700 px-3 py-2 text-xs text-yellow-300 font-mono break-all`,children:l.token}),(0,M.jsx)(`button`,{type:`button`,onClick:w,className:`rounded bg-zinc-700 p-2 text-zinc-300 hover:bg-zinc-600`,title:`Copy token`,children:p?(0,M.jsx)(Fr,{size:14,className:`text-green-400`}):(0,M.jsx)(Kr,{size:14})})]})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`label`,{className:`block text-sm font-medium text-zinc-300 mb-1`,children:`Expires`}),(0,M.jsxs)(`p`,{className:`text-sm text-zinc-400`,children:[new Date(l.expiresAt).toLocaleString(),` (10 minutes)`]})]}),(0,M.jsx)(`div`,{className:`rounded bg-amber-500/10 border border-amber-500/20 px-3 py-2`,children:(0,M.jsx)(`p`,{className:`text-sm text-amber-300`,children:`This token is single-use and expires in 10 minutes. Copy and send it to the agent machine now.`})}),d&&(0,M.jsx)(`div`,{className:`rounded bg-red-500/10 border border-red-500/20 px-3 py-2 text-sm text-red-400`,children:d}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`label`,{className:`block text-sm font-medium text-zinc-300 mb-1`,children:`Setup Command`}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`code`,{className:`flex-1 block rounded bg-zinc-800 border border-zinc-700 px-3 py-2 text-xs text-zinc-300 font-mono break-all`,children:T}),(0,M.jsx)(`button`,{type:`button`,onClick:async()=>{try{await navigator.clipboard.writeText(T),_(!0),setTimeout(()=>_(!1),2e3)}catch{}},className:`rounded bg-zinc-700 p-2 text-zinc-300 hover:bg-zinc-600`,title:`Copy command`,children:h?(0,M.jsx)(Fr,{size:14,className:`text-green-400`}):(0,M.jsx)(Kr,{size:14})})]}),(0,M.jsx)(`p`,{className:`text-xs text-zinc-500 mt-1`,children:`Replace <PANEL_URL> with your panel address (e.g. https://1.2.3.4:9292)`})]})]}),(0,M.jsxs)(`div`,{className:`flex justify-end gap-3 mt-6`,children:[(0,M.jsxs)(`button`,{type:`button`,disabled:v,onClick:async()=>{y(!0);try{await t.revokeEnrollmentToken(l.label),n.invalidateQueries({queryKey:[`agent-certs`]}),e()}catch(e){f(G(e)),y(!1)}},className:`rounded bg-red-600/20 px-4 py-2 text-sm text-red-400 hover:bg-red-600/30 disabled:opacity-50`,children:[v?(0,M.jsx)(B,{size:14,className:`animate-spin inline mr-1`}):(0,M.jsx)(Vi,{size:14,className:`inline mr-1`}),`Revoke Token`]}),(0,M.jsx)(`button`,{type:`button`,onClick:e,className:`rounded bg-zinc-700 px-4 py-2 text-sm text-zinc-300 hover:bg-zinc-600`,children:`Done`})]})]}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`p`,{className:`text-sm text-zinc-400 mb-4`,children:`Generate a one-time token for hardware-bound agent enrollment. The agent will generate a non-exportable keypair in macOS Keychain.`}),(0,M.jsxs)(`div`,{className:`space-y-4`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`label`,{className:`block text-sm font-medium text-zinc-300 mb-1`,children:`Agent Label`}),(0,M.jsx)(`input`,{type:`text`,value:r,onChange:e=>i(e.target.value.toLowerCase()),placeholder:`e.g. macbook-pro`,className:`w-full rounded bg-zinc-800 border border-zinc-700 px-3 py-2 text-sm text-zinc-200 placeholder:text-zinc-600 focus:border-cyan-500 focus:outline-none`})]}),(0,M.jsx)(Vo,{capabilities:a,onChange:o}),(a.includes(`sites:read`)||a.includes(`sites:write`))&&b?.sites?.length>0&&(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`label`,{className:`block text-sm font-medium text-zinc-300 mb-2`,children:`Allowed Sites`}),(0,M.jsx)(`div`,{className:`space-y-2 max-h-40 overflow-y-auto`,children:b.sites.map(e=>(0,M.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,M.jsx)(`input`,{type:`checkbox`,checked:s.includes(e.name),onChange:()=>c(t=>t.includes(e.name)?t.filter(t=>t!==e.name):[...t,e.name]),className:`accent-cyan-500`}),(0,M.jsx)(`span`,{className:`text-zinc-300`,children:e.name}),e.fqdn&&(0,M.jsx)(`span`,{className:`text-zinc-500 text-xs`,children:e.fqdn})]},e.id))})]}),d&&(0,M.jsx)(`div`,{className:`rounded bg-red-500/10 border border-red-500/20 px-3 py-2 text-sm text-red-400`,children:d})]}),(0,M.jsxs)(`div`,{className:`flex justify-end gap-3 mt-6`,children:[(0,M.jsx)(`button`,{type:`button`,onClick:e,className:`rounded bg-zinc-700 px-4 py-2 text-sm text-zinc-300 hover:bg-zinc-600`,children:`Cancel`}),(0,M.jsxs)(`button`,{type:`button`,onClick:C,disabled:!S||x.isPending,className:`rounded bg-emerald-600 px-4 py-2 text-sm font-semibold text-white hover:bg-emerald-500 disabled:opacity-50`,children:[x.isPending?(0,M.jsx)(B,{size:14,className:`animate-spin inline mr-1`}):null,`Generate Token`]})]})]})]})})}function qo(){let e=L(),t=N(),n=U(),[r,i]=(0,g.useState)(!1),[a,o]=(0,g.useState)(!1),[s,c]=(0,g.useState)(null),[l,u]=(0,g.useState)(null),[d,f]=(0,g.useState)(null),[p,m]=(0,g.useState)(`all`),h=P({queryKey:[`agent-certs`],queryFn:()=>e.getAgentCerts(),refetchInterval:3e4}),_=F({mutationFn:t=>e.revokeAgentCert(t),onSuccess:()=>{t.invalidateQueries({queryKey:[`agent-certs`]}),n(`Certificate for ${s} revoked`),c(null)},onError:e=>{n(G(e),`error`),c(null)}}),v=(0,g.useCallback)(e=>{c(e)},[]),y=(0,g.useCallback)(()=>{s&&_.mutate(s)},[s,_]),b=h.data?.agents||[],x=b.some(e=>e.enrollmentMethod===`delegated`),S=b.filter(e=>p===`regular`?e.enrollmentMethod!==`delegated`:p===`delegated`?e.enrollmentMethod===`delegated`:!0);return(0,M.jsxs)(`div`,{className:`mt-8`,children:[(0,M.jsxs)(`div`,{className:`border-t border-zinc-700 pt-6`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,M.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,M.jsx)(ui,{size:18,className:`text-cyan-400`}),`Agent Certificates`]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsxs)(`button`,{type:`button`,onClick:()=>o(!0),className:`flex items-center gap-2 rounded bg-emerald-600 px-4 py-2 text-sm font-semibold text-white hover:bg-emerald-500`,title:`Generate a one-time token for hardware-bound enrollment`,children:[(0,M.jsx)(ui,{size:14}),`Enrollment Token`]}),(0,M.jsxs)(`button`,{type:`button`,onClick:()=>i(!0),className:`flex items-center gap-2 rounded bg-cyan-600 px-4 py-2 text-sm font-semibold text-white hover:bg-cyan-500`,title:`Generate a P12 certificate file`,children:[(0,M.jsx)(Ei,{size:14}),`Generate P12`]})]})]}),x&&(0,M.jsx)(`div`,{className:`flex items-center gap-1 mb-4`,children:[`all`,`regular`,`delegated`].map(e=>(0,M.jsx)(`button`,{type:`button`,onClick:()=>m(e),className:`rounded px-3 py-1 text-xs font-medium transition-colors ${p===e?`bg-zinc-700 text-zinc-200`:`text-zinc-500 hover:text-zinc-300 hover:bg-zinc-800`}`,children:e===`all`?`All`:e===`regular`?`Regular`:`Delegated`},e))}),h.isLoading?(0,M.jsx)(`div`,{className:`space-y-3`,children:Array.from({length:2}).map((e,t)=>(0,M.jsx)(`div`,{className:`h-14 animate-pulse rounded-lg bg-zinc-900 border border-zinc-800`},t))}):h.isError?(0,M.jsx)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-6`,children:(0,M.jsx)(`p`,{className:`text-red-400 text-sm`,children:`Failed to load agent certificates`})}):S.length===0?(0,M.jsxs)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-8 text-center`,children:[(0,M.jsx)(ui,{size:32,className:`mx-auto text-zinc-600 mb-3`}),(0,M.jsx)(`p`,{className:`text-zinc-400 text-sm`,children:`No agent certificates. Generate one to connect a Mac tunnel agent.`})]}):(0,M.jsx)(`div`,{className:`overflow-x-auto rounded-lg border border-zinc-800`,children:(0,M.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,M.jsx)(`thead`,{children:(0,M.jsxs)(`tr`,{className:`border-b border-zinc-700 bg-zinc-900`,children:[(0,M.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400`,children:`Label`}),(0,M.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400`,children:`Serial`}),(0,M.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400`,children:`Created`}),(0,M.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400`,children:`Expires`}),(0,M.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400`,children:`Capabilities`}),(0,M.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400`,children:`Delegated By`}),(0,M.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400`,children:`Type`}),(0,M.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400`,children:`Status`}),(0,M.jsx)(`th`,{className:`px-4 py-3 text-right text-xs font-medium uppercase text-zinc-400`,children:`Actions`})]})}),(0,M.jsx)(`tbody`,{children:S.map(t=>(0,M.jsxs)(`tr`,{className:`border-b border-zinc-700 bg-zinc-800`,children:[(0,M.jsxs)(`td`,{className:`px-4 py-3`,children:[(0,M.jsx)(zo,{label:t.label}),!t.revoked&&!Ro(t.label)&&(0,M.jsx)(`div`,{className:`mt-0.5 min-w-[16rem]`,children:(0,M.jsx)(ko,{facts:t.hostFacts,at:t.hostFactsAt})})]}),(0,M.jsx)(`td`,{className:`px-4 py-3 font-mono text-xs text-zinc-600`,children:t.serial?t.serial.slice(0,16):`N/A`}),(0,M.jsx)(`td`,{className:`px-4 py-3 text-zinc-400`,children:Mo(t.createdAt)}),(0,M.jsx)(`td`,{className:`px-4 py-3 text-zinc-400`,children:Mo(t.expiresAt)}),(0,M.jsxs)(`td`,{className:`px-4 py-3`,children:[(0,M.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:(t.capabilities||[`tunnels:read`]).map(e=>(0,M.jsx)(`span`,{className:`text-xs px-1.5 py-0.5 rounded bg-zinc-700 text-zinc-300 font-mono`,children:e},e))}),t.allowedSites?.length>0&&(0,M.jsxs)(`span`,{className:`text-xs text-zinc-500 mt-1 block`,children:[`Sites: `,t.allowedSites.join(`, `)]})]}),(0,M.jsx)(`td`,{className:`px-4 py-3`,children:t.delegatedBy?(0,M.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs text-violet-400 font-mono`,children:[(0,M.jsx)(pi,{size:12,className:`text-violet-400/70`}),t.delegatedBy]}):(0,M.jsx)(`span`,{className:`text-xs text-zinc-600`,children:`—`})}),(0,M.jsx)(`td`,{className:`px-4 py-3`,children:(0,M.jsx)(Lo,{method:t.enrollmentMethod})}),(0,M.jsx)(`td`,{className:`px-4 py-3`,children:(0,M.jsx)(Io,{status:t.status})}),(0,M.jsx)(`td`,{className:`px-4 py-3 text-right`,children:(0,M.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[t.status!==`revoked`&&(0,M.jsx)(`button`,{type:`button`,onClick:()=>u(t),className:`inline-flex items-center gap-1.5 rounded bg-zinc-700 px-2.5 py-1.5 text-xs text-zinc-300 hover:bg-zinc-600`,title:`Edit capabilities`,children:(0,M.jsx)(Pi,{size:12})}),t.status!==`revoked`&&(0,M.jsx)(`button`,{type:`button`,onClick:()=>f(t),className:`inline-flex items-center gap-1.5 rounded bg-zinc-700 px-2.5 py-1.5 text-xs text-zinc-300 hover:bg-zinc-600`,title:`Edit site access`,children:(0,M.jsx)(oi,{size:12})}),t.status!==`revoked`&&t.status!==`expired`&&t.enrollmentMethod!==`hardware-bound`&&(0,M.jsx)(`button`,{type:`button`,onClick:()=>e.downloadAgentCert(t.label),className:`inline-flex items-center gap-1.5 rounded bg-zinc-700 px-2.5 py-1.5 text-xs text-zinc-300 hover:bg-zinc-600`,title:`Download .p12`,children:(0,M.jsx)(Yr,{size:12})}),t.status!==`revoked`&&(0,M.jsx)(`button`,{type:`button`,onClick:()=>v(t.label),className:`inline-flex items-center gap-1.5 rounded bg-zinc-700 px-2.5 py-1.5 text-xs text-zinc-300 hover:bg-red-600/20 hover:text-red-400`,title:`Revoke certificate`,children:(0,M.jsx)(Vi,{size:12})})]})})]},t.label))})]})})]}),r&&(0,M.jsx)(Ho,{onClose:()=>i(!1)}),a&&(0,M.jsx)(Ko,{onClose:()=>o(!1)}),s&&(0,M.jsx)(Uo,{label:s,onConfirm:y,onCancel:()=>c(null),isPending:_.isPending}),l&&(0,M.jsx)(Wo,{agent:l,onClose:()=>u(null)}),d&&(0,M.jsx)(Go,{agent:d,onClose:()=>f(null)})]})}function Jo({onClose:e}){let t=L(),n=N(),r=U(),[i,a]=(0,g.useState)(`warning`),[o,s]=(0,g.useState)(null),[c,l]=(0,g.useState)(null),[u,d]=(0,g.useState)(!1),[f,p]=(0,g.useState)(!1),[m,h]=(0,g.useState)(!1),_=F({mutationFn:()=>t.rotateMtls(),onSuccess:e=>{s(e),a(`success`),n.invalidateQueries({queryKey:[`certs`]})},onError:e=>{l(G(e)),a(`error`)}}),v=(0,g.useCallback)(()=>{a(`rotating`),_.mutate()},[_]),y=(0,g.useCallback)(async()=>{if(o?.p12Password)try{await navigator.clipboard.writeText(o.p12Password),d(!0),setTimeout(()=>d(!1),2e3)}catch{r(`Failed to copy — please select and copy manually`,`error`)}},[o,r]),b=(0,g.useCallback)(async()=>{try{await t.downloadMtls()}catch(e){r(G(e)||`Download failed`,`error`)}},[t,r]),x=(0,g.useCallback)(()=>{if(!m){h(!0);return}e()},[m,e]);return(0,M.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4`,children:(0,M.jsxs)(`div`,{className:`w-full max-w-lg rounded-lg bg-zinc-900 border border-zinc-800 shadow-xl`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between border-b border-zinc-800 px-6 py-4`,children:[(0,M.jsxs)(`h3`,{className:`flex items-center gap-2 text-lg font-semibold text-white`,children:[i===`warning`&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(Hi,{size:20,className:`text-amber-400`}),`Rotate Client Certificate`]}),i===`rotating`&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(B,{size:20,className:`animate-spin text-cyan-400`}),`Generating New Certificate...`]}),i===`success`&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(Ii,{size:20,className:`text-green-400`}),`New Certificate Ready`]}),i===`error`&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(Hi,{size:20,className:`text-red-400`}),`Rotation Failed`]})]}),(i===`warning`||i===`error`)&&(0,M.jsx)(`button`,{type:`button`,onClick:e,className:`text-zinc-500 hover:text-zinc-300`,children:(0,M.jsx)(H,{size:18})})]}),(0,M.jsxs)(`div`,{className:`px-6 py-5`,children:[i===`warning`&&(0,M.jsxs)(`div`,{className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`rounded-lg bg-amber-500/10 border border-amber-500/20 p-4 text-sm text-amber-400 space-y-2`,children:[(0,M.jsx)(`p`,{className:`font-semibold`,children:`This will immediately invalidate your current browser certificate.`}),(0,M.jsxs)(`p`,{children:[`You `,(0,M.jsx)(`strong`,{children:`MUST`}),` download and import the new certificate before closing this page or your browser.`]}),(0,M.jsx)(`p`,{children:`If you fail to do this, you will be locked out of the panel and will need SSH access to recover.`})]}),(0,M.jsxs)(`div`,{className:`flex justify-end gap-3`,children:[(0,M.jsx)(`button`,{type:`button`,onClick:e,autoFocus:!0,className:`rounded bg-zinc-700 px-4 py-2 text-sm text-zinc-300 hover:bg-zinc-600`,children:`Cancel`}),(0,M.jsx)(`button`,{type:`button`,onClick:v,className:`rounded bg-red-600 px-4 py-2 text-sm text-white hover:bg-red-500`,children:`I Understand, Rotate`})]})]}),i===`rotating`&&(0,M.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,M.jsx)(`p`,{className:`text-zinc-400 text-sm`,children:`Generating new certificate...`})}),i===`success`&&o&&(0,M.jsxs)(`div`,{className:`space-y-5`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`label`,{className:`text-sm font-medium text-zinc-300 block mb-2`,children:`Certificate Password (copy this first):`}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`div`,{className:`flex-1 rounded border border-zinc-700 bg-zinc-950 p-3 font-mono text-cyan-400 text-sm break-all select-all`,children:o.p12Password}),(0,M.jsx)(`button`,{type:`button`,onClick:y,className:`rounded bg-zinc-700 p-2 text-zinc-300 hover:bg-zinc-600 shrink-0`,title:`Copy password`,children:u?(0,M.jsx)(Fr,{size:16,className:`text-green-400`}):(0,M.jsx)(Kr,{size:16})})]})]}),(0,M.jsxs)(`button`,{type:`button`,onClick:b,className:`flex w-full items-center justify-center gap-2 rounded bg-cyan-600 py-3 px-6 text-sm font-semibold text-white hover:bg-cyan-500`,children:[(0,M.jsx)(Yr,{size:16}),`Download Certificate`]}),(0,M.jsxs)(`ol`,{className:`list-decimal list-inside text-sm text-zinc-400 space-y-1.5 pl-1`,children:[(0,M.jsx)(`li`,{children:`Copy the password above`}),(0,M.jsx)(`li`,{children:`Click Download Certificate`}),(0,M.jsx)(`li`,{children:`Double-click the downloaded file to import it into your browser's keychain`}),(0,M.jsx)(`li`,{children:`Enter the password when prompted`}),(0,M.jsx)(`li`,{children:`Restart your browser to use the new certificate`})]}),(0,M.jsxs)(`div`,{className:`border-t border-zinc-700 pt-4`,children:[(0,M.jsxs)(`button`,{type:`button`,onClick:()=>p(e=>!e),className:`flex items-center gap-1.5 text-xs text-zinc-500 hover:text-zinc-400`,children:[f?(0,M.jsx)(zr,{size:14}):(0,M.jsx)(Ir,{size:14}),`Recovery instructions (if locked out)`]}),f&&(0,M.jsxs)(`div`,{className:`mt-3 rounded border border-zinc-700 bg-zinc-950 p-3`,children:[(0,M.jsx)(`p`,{className:`text-xs text-zinc-400 mb-2`,children:`If you get locked out, connect via SSH and run these commands to restore the backup:`}),(0,M.jsx)(`pre`,{className:`text-xs text-zinc-300 font-mono whitespace-pre-wrap`,children:`sudo cp /etc/lamalibre/lamaste/pki/client.crt.bak /etc/lamalibre/lamaste/pki/client.crt
|
|
9
|
+
sudo cp /etc/lamalibre/lamaste/pki/client.key.bak /etc/lamalibre/lamaste/pki/client.key
|
|
10
|
+
sudo cp /etc/lamalibre/lamaste/pki/client.p12.bak /etc/lamalibre/lamaste/pki/client.p12
|
|
11
|
+
sudo systemctl reload nginx`})]})]}),(0,M.jsx)(`div`,{className:`flex justify-end`,children:m?(0,M.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,M.jsx)(`span`,{className:`text-sm text-zinc-400`,children:`Have you downloaded and imported the new certificate?`}),(0,M.jsx)(`button`,{type:`button`,onClick:x,className:`rounded bg-green-600 px-4 py-2 text-sm text-white hover:bg-green-500`,children:`Yes, Done`}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>h(!1),className:`rounded bg-zinc-700 px-4 py-2 text-sm text-zinc-300 hover:bg-zinc-600`,children:`Not yet`})]}):(0,M.jsx)(`button`,{type:`button`,onClick:x,className:`rounded bg-zinc-700 px-4 py-2 text-sm text-zinc-300 hover:bg-zinc-600`,children:`Done`})})]}),i===`error`&&(0,M.jsxs)(`div`,{className:`space-y-4`,children:[(0,M.jsxs)(`div`,{className:`rounded-lg bg-red-500/10 border border-red-500/20 p-4 text-sm text-red-400`,children:[(0,M.jsx)(`p`,{className:`font-semibold mb-1`,children:`Rotation failed`}),(0,M.jsx)(`p`,{children:c}),(0,M.jsx)(`p`,{className:`mt-2 text-zinc-400`,children:`Your existing certificate is still valid.`})]}),(0,M.jsx)(`div`,{className:`flex justify-end`,children:(0,M.jsx)(`button`,{type:`button`,onClick:e,className:`rounded bg-zinc-700 px-4 py-2 text-sm text-zinc-300 hover:bg-zinc-600`,children:`Close`})})]})]})]})})}function Yo(){let e=L(),t=N(),n=U(),[r,i]=(0,g.useState)(null),[a,o]=(0,g.useState)(!1),s=P({queryKey:[`certs`],queryFn:()=>e.getCerts(),refetchInterval:3e4}),c=P({queryKey:[`auto-renew-status`],queryFn:()=>e.getAutoRenewStatus()}),l=P({queryKey:[`admin-auth-mode`],queryFn:()=>e.getAuthMode()}).data?.adminAuthMode||`p12`,u=F({mutationFn:t=>e.renewCert(t),onSuccess:e=>{t.invalidateQueries({queryKey:[`certs`]});let r=e.newExpiry?` New expiry: ${Mo(e.newExpiry)}`:``;n(`Certificate for ${e.domain} renewed.${r}`),e.warning&&n(e.warning,`error`),i(null)},onError:e=>{n(G(e),`error`),i(null)}}),d=(0,g.useCallback)(e=>{i(e),u.mutate(e)},[u]),f=s.data?.certs||[];return(0,M.jsxs)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:[(0,M.jsxs)(`div`,{className:`mb-6`,children:[(0,M.jsx)(`h1`,{className:`text-xl font-bold text-white`,children:`Certificates`}),(0,M.jsx)(`p`,{className:`text-zinc-500 text-sm mt-1`,children:`View and manage TLS and mTLS certificates`})]}),(0,M.jsx)(No,{data:c.data,isLoading:c.isLoading}),s.isLoading?(0,M.jsx)(`div`,{className:`space-y-3`,children:Array.from({length:3}).map((e,t)=>(0,M.jsx)(`div`,{className:`h-14 animate-pulse rounded-lg bg-zinc-900 border border-zinc-800`},t))}):s.isError?(0,M.jsx)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-6`,children:(0,M.jsx)(`p`,{className:`text-red-400 text-sm`,children:`Failed to load certificates`})}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(Po,{certs:f,onRenew:d,renewingDomain:r}),(0,M.jsx)(Fo,{certs:f,onRotate:()=>o(!0),adminAuthMode:l}),(0,M.jsx)(qo,{})]}),a&&(0,M.jsx)(Jo,{onClose:()=>o(!1)})]})}function Xo({status:e}){return(0,M.jsx)(`span`,{className:`text-xs px-2 py-0.5 rounded-full ${e===`active`?`bg-green-500/20 text-green-400`:e===`stale`?`bg-yellow-500/20 text-yellow-400`:e===`dead`?`bg-red-500/20 text-red-400`:e===`grace`?`bg-orange-500/20 text-orange-400`:`bg-zinc-500/20 text-zinc-400`}`,children:e})}function Zo({ticket:e}){return e.used?(0,M.jsx)(`span`,{className:`text-xs px-2 py-0.5 rounded-full bg-zinc-500/20 text-zinc-400`,children:`used`}):new Date(e.expiresAt)<new Date?(0,M.jsx)(`span`,{className:`text-xs px-2 py-0.5 rounded-full bg-red-500/20 text-red-400`,children:`expired`}):(0,M.jsx)(`span`,{className:`text-xs px-2 py-0.5 rounded-full bg-green-500/20 text-green-400`,children:`pending`})}function Qo(e){let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/1e3);if(n<60)return`${n}s ago`;let r=Math.floor(n/60);if(r<60)return`${r}m ago`;let i=Math.floor(r/60);return i<24?`${i}h ago`:new Date(e).toLocaleDateString()}var $o=[{id:`scopes`,label:`Scopes`},{id:`instances`,label:`Instances`},{id:`assignments`,label:`Assignments`},{id:`tickets`,label:`Tickets`},{id:`sessions`,label:`Sessions`}];function es(){let e=L(),t=N(),n=U(),{data:r,isLoading:i,isError:a}=P({queryKey:[`ticket-scopes`],queryFn:()=>e.getTicketScopes(),refetchInterval:1e4}),o=F({mutationFn:t=>e.deleteTicketScope(t),onSuccess:()=>{t.invalidateQueries({queryKey:[`ticket-scopes`]}),n(`Scope unregistered`)},onError:e=>n(G(e),`error`)}),[s,c]=(0,g.useState)(null);if(i)return(0,M.jsx)(`div`,{className:`animate-pulse h-32 rounded-lg bg-zinc-900 border border-zinc-800`});if(a)return(0,M.jsx)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-6`,children:(0,M.jsx)(`p`,{className:`text-red-400 text-sm`,children:`Failed to load scopes`})});let l=r?.scopes||[];return l.length===0?(0,M.jsxs)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-8 text-center`,children:[(0,M.jsx)(Bi,{className:`mx-auto h-8 w-8 text-zinc-600 mb-3`}),(0,M.jsx)(`p`,{className:`text-zinc-400 text-sm`,children:`No ticket scopes registered`}),(0,M.jsx)(`p`,{className:`text-zinc-600 text-xs mt-1`,children:`Install a ticket scope package to get started`})]}):(0,M.jsx)(`div`,{className:`space-y-3`,children:l.map(e=>(0,M.jsxs)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-5`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(Bi,{size:16,className:`text-cyan-400`}),(0,M.jsx)(`span`,{className:`text-white font-semibold`,children:e.name}),(0,M.jsxs)(`span`,{className:`text-zinc-500 text-xs`,children:[`v`,e.version]})]}),s===e.name?(0,M.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs`,children:[(0,M.jsx)(`span`,{className:`text-zinc-400`,children:`Remove?`}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>{o.mutate(e.name),c(null)},className:`rounded bg-red-600 px-2 py-1 text-white hover:bg-red-500`,children:`Yes`}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>c(null),className:`rounded bg-zinc-700 px-2 py-1 text-zinc-300 hover:bg-zinc-600`,children:`No`})]}):(0,M.jsx)(`button`,{type:`button`,onClick:()=>c(e.name),className:`text-zinc-500 hover:text-red-400`,title:`Unregister scope`,children:(0,M.jsx)(Vi,{size:14})})]}),(0,M.jsx)(`p`,{className:`text-zinc-400 text-sm mb-2`,children:e.description}),(0,M.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.scopes?.map(e=>(0,M.jsxs)(`span`,{className:`text-xs bg-zinc-800 text-cyan-400 px-2 py-0.5 rounded font-mono`,children:[e.name,e.instanceScoped&&(0,M.jsx)(`span`,{className:`text-zinc-500 ml-1`,children:`(instance-scoped)`})]},e.name))}),(0,M.jsxs)(`div`,{className:`mt-2 flex gap-3 text-xs text-zinc-500`,children:[(0,M.jsxs)(`span`,{children:[`Transport: `,e.transport?.strategies?.join(`, `)]}),(0,M.jsxs)(`span`,{children:[`Protocol: `,e.transport?.protocol]}),(0,M.jsxs)(`span`,{children:[`Installed: `,Qo(e.installedAt)]})]})]},e.name))})}function ts(){let e=L(),t=N(),n=U(),[r,i]=(0,g.useState)(null),{data:a,isLoading:o,isError:s}=P({queryKey:[`ticket-instances`],queryFn:()=>e.getTicketInstances(),refetchInterval:1e4}),c=F({mutationFn:t=>e.deleteTicketInstance(t),onSuccess:()=>{t.invalidateQueries({queryKey:[`ticket-instances`]}),n(`Instance deregistered`),i(null)},onError:e=>n(G(e),`error`)});if(o)return(0,M.jsx)(`div`,{className:`animate-pulse h-32 rounded-lg bg-zinc-900 border border-zinc-800`});if(s)return(0,M.jsx)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-6`,children:(0,M.jsx)(`p`,{className:`text-red-400 text-sm`,children:`Failed to load instances`})});let l=a?.instances||[];return l.length===0?(0,M.jsxs)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-8 text-center`,children:[(0,M.jsx)(Mi,{className:`mx-auto h-8 w-8 text-zinc-600 mb-3`}),(0,M.jsx)(`p`,{className:`text-zinc-400 text-sm`,children:`No instances registered`})]}):(0,M.jsx)(`div`,{className:`overflow-x-auto`,children:(0,M.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,M.jsx)(`thead`,{children:(0,M.jsxs)(`tr`,{className:`border-b border-zinc-800 text-left text-zinc-500`,children:[(0,M.jsx)(`th`,{className:`pb-2 pr-4 font-medium`,children:`Instance ID`}),(0,M.jsx)(`th`,{className:`pb-2 pr-4 font-medium`,children:`Scope`}),(0,M.jsx)(`th`,{className:`pb-2 pr-4 font-medium`,children:`Agent`}),(0,M.jsx)(`th`,{className:`pb-2 pr-4 font-medium`,children:`Status`}),(0,M.jsx)(`th`,{className:`pb-2 pr-4 font-medium`,children:`Last Heartbeat`}),(0,M.jsx)(`th`,{className:`pb-2 font-medium`,children:`Actions`})]})}),(0,M.jsx)(`tbody`,{children:l.map(e=>(0,M.jsxs)(`tr`,{className:`border-b border-zinc-800/50`,children:[(0,M.jsxs)(`td`,{className:`py-3 pr-4 font-mono text-cyan-400 text-xs`,children:[e.instanceId.slice(0,12),`...`]}),(0,M.jsx)(`td`,{className:`py-3 pr-4 font-mono text-zinc-300 text-xs`,children:e.scope}),(0,M.jsx)(`td`,{className:`py-3 pr-4 text-zinc-300`,children:e.agentLabel}),(0,M.jsx)(`td`,{className:`py-3 pr-4`,children:(0,M.jsx)(Xo,{status:e.status})}),(0,M.jsx)(`td`,{className:`py-3 pr-4 text-zinc-500 text-xs`,children:Qo(e.lastHeartbeat)}),(0,M.jsx)(`td`,{className:`py-3`,children:r===e.instanceId?(0,M.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs`,children:[(0,M.jsx)(`span`,{className:`text-zinc-400`,children:`Remove?`}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>c.mutate(e.instanceId),className:`rounded bg-red-600 px-2 py-1 text-white hover:bg-red-500`,children:`Yes`}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>i(null),className:`rounded bg-zinc-700 px-2 py-1 text-zinc-300 hover:bg-zinc-600`,children:`No`})]}):(0,M.jsx)(`button`,{type:`button`,onClick:()=>i(e.instanceId),className:`text-zinc-500 hover:text-red-400`,title:`Deregister instance`,children:(0,M.jsx)(Vi,{size:14})})})]},e.instanceId))})]})})}function ns(){let e=L(),t=N(),n=U(),[r,i]=(0,g.useState)(!1),[a,o]=(0,g.useState)(``),[s,c]=(0,g.useState)(``),[l,u]=(0,g.useState)(null),{data:d,isLoading:f,isError:p}=P({queryKey:[`ticket-assignments`],queryFn:()=>e.getTicketAssignments(),refetchInterval:1e4}),{data:m}=P({queryKey:[`ticket-scopes`],queryFn:()=>e.getTicketScopes(),refetchInterval:1e4}),{data:h}=P({queryKey:[`agents-list`],queryFn:()=>e.getAgentCerts(),staleTime:3e4}),_=F({mutationFn:t=>e.createTicketAssignment(t),onSuccess:()=>{t.invalidateQueries({queryKey:[`ticket-assignments`]}),n(`Assignment created`),i(!1),o(``),c(``)},onError:e=>n(G(e),`error`)}),v=F({mutationFn:({agentLabel:t,instanceScope:n})=>e.deleteTicketAssignment(t,n),onSuccess:()=>{t.invalidateQueries({queryKey:[`ticket-assignments`]}),n(`Assignment removed`),u(null)},onError:e=>n(G(e),`error`)});if(f)return(0,M.jsx)(`div`,{className:`animate-pulse h-32 rounded-lg bg-zinc-900 border border-zinc-800`});if(p)return(0,M.jsx)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-6`,children:(0,M.jsx)(`p`,{className:`text-red-400 text-sm`,children:`Failed to load assignments`})});let y=d?.assignments||[],b=m?.instances||[],x=(h?.agents||[]).filter(e=>!e.revoked),S=b.filter(e=>e.status!==`dead`).map(e=>`${e.scope}:${e.instanceId}`);return(0,M.jsxs)(`div`,{children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,M.jsx)(`p`,{className:`text-zinc-400 text-sm`,children:`Assign agents to ticket scope instances`}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>i(!r),className:`rounded bg-cyan-600 px-3 py-1.5 text-xs text-white hover:bg-cyan-500`,children:r?`Cancel`:`Add Assignment`})]}),r&&(0,M.jsxs)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-4 mb-4`,children:[(0,M.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3 mb-3`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`label`,{className:`block text-xs text-zinc-400 mb-1`,children:`Agent`}),(0,M.jsxs)(`select`,{value:a,onChange:e=>o(e.target.value),className:`w-full rounded bg-zinc-800 border border-zinc-700 px-3 py-1.5 text-sm text-zinc-300 focus:outline-none focus:border-cyan-400`,children:[(0,M.jsx)(`option`,{value:``,children:`Select agent...`}),x.map(e=>(0,M.jsx)(`option`,{value:e.label,children:e.label},e.label))]})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`label`,{className:`block text-xs text-zinc-400 mb-1`,children:`Instance Scope`}),(0,M.jsxs)(`select`,{value:s,onChange:e=>c(e.target.value),className:`w-full rounded bg-zinc-800 border border-zinc-700 px-3 py-1.5 text-sm text-zinc-300 focus:outline-none focus:border-cyan-400`,children:[(0,M.jsx)(`option`,{value:``,children:`Select instance...`}),S.map(e=>(0,M.jsx)(`option`,{value:e,children:e},e))]})]})]}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>_.mutate({agentLabel:a,instanceScope:s}),disabled:!a||!s||_.isPending,className:`rounded bg-cyan-600 px-4 py-1.5 text-xs text-white hover:bg-cyan-500 disabled:opacity-50`,children:`Assign`})]}),y.length===0?(0,M.jsxs)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-8 text-center`,children:[(0,M.jsx)(mi,{className:`mx-auto h-8 w-8 text-zinc-600 mb-3`}),(0,M.jsx)(`p`,{className:`text-zinc-400 text-sm`,children:`No assignments`})]}):(0,M.jsx)(`div`,{className:`overflow-x-auto`,children:(0,M.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,M.jsx)(`thead`,{children:(0,M.jsxs)(`tr`,{className:`border-b border-zinc-800 text-left text-zinc-500`,children:[(0,M.jsx)(`th`,{className:`pb-2 pr-4 font-medium`,children:`Agent`}),(0,M.jsx)(`th`,{className:`pb-2 pr-4 font-medium`,children:`Instance Scope`}),(0,M.jsx)(`th`,{className:`pb-2 pr-4 font-medium`,children:`Assigned`}),(0,M.jsx)(`th`,{className:`pb-2 font-medium`,children:`Actions`})]})}),(0,M.jsx)(`tbody`,{children:y.map(e=>(0,M.jsxs)(`tr`,{className:`border-b border-zinc-800/50`,children:[(0,M.jsx)(`td`,{className:`py-3 pr-4 text-zinc-300`,children:e.agentLabel}),(0,M.jsx)(`td`,{className:`py-3 pr-4 font-mono text-cyan-400 text-xs`,children:e.instanceScope}),(0,M.jsx)(`td`,{className:`py-3 pr-4 text-zinc-500 text-xs`,children:Qo(e.assignedAt)}),(0,M.jsx)(`td`,{className:`py-3`,children:l===`${e.agentLabel}:${e.instanceScope}`?(0,M.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs`,children:[(0,M.jsx)(`span`,{className:`text-zinc-400`,children:`Remove?`}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>v.mutate({agentLabel:e.agentLabel,instanceScope:e.instanceScope}),className:`rounded bg-red-600 px-2 py-1 text-white hover:bg-red-500`,children:`Yes`}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>u(null),className:`rounded bg-zinc-700 px-2 py-1 text-zinc-300 hover:bg-zinc-600`,children:`No`})]}):(0,M.jsx)(`button`,{type:`button`,onClick:()=>u(`${e.agentLabel}:${e.instanceScope}`),className:`text-zinc-500 hover:text-red-400`,title:`Remove assignment`,children:(0,M.jsx)(Vi,{size:14})})})]},`${e.agentLabel}-${e.instanceScope}`))})]})})]})}function rs(){let e=L(),t=N(),n=U(),[r,i]=(0,g.useState)(null),{data:a,isLoading:o,isError:s}=P({queryKey:[`tickets`],queryFn:()=>e.getTickets(),refetchInterval:5e3}),c=F({mutationFn:t=>e.revokeTicket(t),onSuccess:()=>{t.invalidateQueries({queryKey:[`tickets`]}),n(`Ticket revoked`),i(null)},onError:e=>n(G(e),`error`)});if(o)return(0,M.jsx)(`div`,{className:`animate-pulse h-32 rounded-lg bg-zinc-900 border border-zinc-800`});if(s)return(0,M.jsx)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-6`,children:(0,M.jsx)(`p`,{className:`text-red-400 text-sm`,children:`Failed to load tickets`})});let l=a?.tickets||[];return l.length===0?(0,M.jsxs)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-8 text-center`,children:[(0,M.jsx)(Gr,{className:`mx-auto h-8 w-8 text-zinc-600 mb-3`}),(0,M.jsx)(`p`,{className:`text-zinc-400 text-sm`,children:`No recent tickets`})]}):(0,M.jsx)(`div`,{className:`overflow-x-auto`,children:(0,M.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,M.jsx)(`thead`,{children:(0,M.jsxs)(`tr`,{className:`border-b border-zinc-800 text-left text-zinc-500`,children:[(0,M.jsx)(`th`,{className:`pb-2 pr-4 font-medium`,children:`Ticket ID`}),(0,M.jsx)(`th`,{className:`pb-2 pr-4 font-medium`,children:`Scope`}),(0,M.jsx)(`th`,{className:`pb-2 pr-4 font-medium`,children:`Source`}),(0,M.jsx)(`th`,{className:`pb-2 pr-4 font-medium`,children:`Target`}),(0,M.jsx)(`th`,{className:`pb-2 pr-4 font-medium`,children:`Status`}),(0,M.jsx)(`th`,{className:`pb-2 pr-4 font-medium`,children:`Created`}),(0,M.jsx)(`th`,{className:`pb-2 font-medium`,children:`Actions`})]})}),(0,M.jsx)(`tbody`,{children:l.map(e=>(0,M.jsxs)(`tr`,{className:`border-b border-zinc-800/50`,children:[(0,M.jsxs)(`td`,{className:`py-3 pr-4 font-mono text-cyan-400 text-xs`,children:[e.id.slice(0,12),`...`]}),(0,M.jsx)(`td`,{className:`py-3 pr-4 font-mono text-zinc-300 text-xs`,children:e.scope}),(0,M.jsx)(`td`,{className:`py-3 pr-4 text-zinc-300`,children:e.source}),(0,M.jsx)(`td`,{className:`py-3 pr-4 text-zinc-300`,children:e.target}),(0,M.jsx)(`td`,{className:`py-3 pr-4`,children:(0,M.jsx)(Zo,{ticket:e})}),(0,M.jsx)(`td`,{className:`py-3 pr-4 text-zinc-500 text-xs`,children:Qo(e.createdAt)}),(0,M.jsx)(`td`,{className:`py-3`,children:!e.used&&new Date(e.expiresAt)>new Date&&(r===e.id?(0,M.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs`,children:[(0,M.jsx)(`span`,{className:`text-zinc-400`,children:`Revoke?`}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>c.mutate(e.id),className:`rounded bg-red-600 px-2 py-1 text-white hover:bg-red-500`,children:`Yes`}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>i(null),className:`rounded bg-zinc-700 px-2 py-1 text-zinc-300 hover:bg-zinc-600`,children:`No`})]}):(0,M.jsx)(`button`,{type:`button`,onClick:()=>i(e.id),className:`text-zinc-500 hover:text-red-400`,title:`Revoke ticket`,children:(0,M.jsx)(Ur,{size:14})}))})]},e.id))})]})})}function is(){let e=L(),t=N(),n=U(),[r,i]=(0,g.useState)(null),{data:a,isLoading:o,isError:s}=P({queryKey:[`ticket-sessions`],queryFn:()=>e.getTicketSessions(),refetchInterval:5e3}),c=F({mutationFn:t=>e.killTicketSession(t),onSuccess:()=>{t.invalidateQueries({queryKey:[`ticket-sessions`]}),n(`Session terminated`),i(null)},onError:e=>n(G(e),`error`)});if(o)return(0,M.jsx)(`div`,{className:`animate-pulse h-32 rounded-lg bg-zinc-900 border border-zinc-800`});if(s)return(0,M.jsx)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-6`,children:(0,M.jsx)(`p`,{className:`text-red-400 text-sm`,children:`Failed to load sessions`})});let l=a?.sessions||[];return l.length===0?(0,M.jsxs)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-8 text-center`,children:[(0,M.jsx)(Mi,{className:`mx-auto h-8 w-8 text-zinc-600 mb-3`}),(0,M.jsx)(`p`,{className:`text-zinc-400 text-sm`,children:`No active sessions`})]}):(0,M.jsx)(`div`,{className:`overflow-x-auto`,children:(0,M.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,M.jsx)(`thead`,{children:(0,M.jsxs)(`tr`,{className:`border-b border-zinc-800 text-left text-zinc-500`,children:[(0,M.jsx)(`th`,{className:`pb-2 pr-4 font-medium`,children:`Session ID`}),(0,M.jsx)(`th`,{className:`pb-2 pr-4 font-medium`,children:`Scope`}),(0,M.jsx)(`th`,{className:`pb-2 pr-4 font-medium`,children:`Source`}),(0,M.jsx)(`th`,{className:`pb-2 pr-4 font-medium`,children:`Target`}),(0,M.jsx)(`th`,{className:`pb-2 pr-4 font-medium`,children:`Status`}),(0,M.jsx)(`th`,{className:`pb-2 pr-4 font-medium`,children:`Last Activity`}),(0,M.jsx)(`th`,{className:`pb-2 font-medium`,children:`Actions`})]})}),(0,M.jsx)(`tbody`,{children:l.map(e=>(0,M.jsxs)(`tr`,{className:`border-b border-zinc-800/50`,children:[(0,M.jsxs)(`td`,{className:`py-3 pr-4 font-mono text-cyan-400 text-xs`,children:[e.sessionId.slice(0,12),`...`]}),(0,M.jsx)(`td`,{className:`py-3 pr-4 font-mono text-zinc-300 text-xs`,children:e.scope}),(0,M.jsx)(`td`,{className:`py-3 pr-4 text-zinc-300`,children:e.source}),(0,M.jsx)(`td`,{className:`py-3 pr-4 text-zinc-300`,children:e.target}),(0,M.jsx)(`td`,{className:`py-3 pr-4`,children:(0,M.jsx)(Xo,{status:e.status})}),(0,M.jsx)(`td`,{className:`py-3 pr-4 text-zinc-500 text-xs`,children:Qo(e.lastActivityAt)}),(0,M.jsx)(`td`,{className:`py-3`,children:e.status!==`dead`&&(r===e.sessionId?(0,M.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs`,children:[(0,M.jsx)(`span`,{className:`text-zinc-400`,children:`Kill?`}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>c.mutate(e.sessionId),className:`rounded bg-red-600 px-2 py-1 text-white hover:bg-red-500`,children:`Yes`}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>i(null),className:`rounded bg-zinc-700 px-2 py-1 text-zinc-300 hover:bg-zinc-600`,children:`No`})]}):(0,M.jsx)(`button`,{type:`button`,onClick:()=>i(e.sessionId),className:`text-zinc-500 hover:text-red-400`,title:`Kill session`,children:(0,M.jsx)(Ur,{size:14})}))})]},e.sessionId))})]})})}function as(){let[e,t]=(0,g.useState)(`scopes`);return(0,M.jsxs)(`div`,{className:`p-6 max-w-5xl mx-auto`,children:[(0,M.jsxs)(`div`,{className:`mb-6`,children:[(0,M.jsx)(`h1`,{className:`text-xl font-bold text-white`,children:`Tickets & Sessions`}),(0,M.jsx)(`p`,{className:`text-zinc-500 text-sm mt-1`,children:`Manage agent-to-agent authorization scopes, instances, and active sessions`})]}),(0,M.jsx)(`div`,{className:`flex gap-1 mb-6 border-b border-zinc-800`,children:$o.map(n=>(0,M.jsx)(`button`,{type:`button`,onClick:()=>t(n.id),className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${e===n.id?`border-cyan-400 text-cyan-400`:`border-transparent text-zinc-500 hover:text-zinc-300`}`,children:n.label},n.id))}),e===`scopes`&&(0,M.jsx)(es,{}),e===`instances`&&(0,M.jsx)(ts,{}),e===`assignments`&&(0,M.jsx)(ns,{}),e===`tickets`&&(0,M.jsx)(rs,{}),e===`sessions`&&(0,M.jsx)(is,{})]})}var os={install:`installs`,update:`updates`,uninstall:`removes`};function ss(e,{agentLabel:t=null,action:n=`install`}={}){let{code:r,reasons:i}=Da(e),a=t?`agent "${t}"`:`the hosting agent`,o=null;return r===`push_install_refused`?o=`Lamaste ${os[n]??`changes`} the agent half by push install: push install must be on for this relay and enabled for ${a} with its window open, and the agent's policy must allow "${n}" of the agent package from your address.`:r===`agent_not_eligible`?o=`Each agent reports its host on its sync (about every 30 seconds) — once what the reasons name is fixed on the agent, it becomes eligible.`:r===`hooks_not_approved`&&(o=`Review and approve what the plugin brings under Lifecycle hooks on its card first.`),{message:G(e),code:r,reasons:i,hint:o}}function cs(e,t){let{message:n,hint:r}=ss(e,t);return r?`${n} — ${r}`:n}function ls(e){return e?`${e.slice(0,8)}…${e.slice(-6)}`:``}function us(e){return e.length>32?`${e.slice(0,17)}…${e.slice(-8)}`:e}var ds={done:(0,M.jsx)(Hr,{size:12,className:`text-green-400`}),failed:(0,M.jsx)(Ur,{size:12,className:`text-red-400`}),skipped:(0,M.jsx)(xi,{size:12,className:`text-zinc-600`}),running:(0,M.jsx)(B,{size:12,className:`text-cyan-400 animate-spin`})},fs={running:`text-cyan-400`,succeeded:`text-green-400`,"rolled-back":`text-yellow-400`,failed:`text-red-400`,interrupted:`text-red-400`},ps={host:`Hosting`,unhost:`Removing the hosting`,update:`Update`,uninstall:`Uninstall`,"purge-data":`Purging retained data`};function ms({plugin:e}){let t=L(),n=N(),r=P({queryKey:[`plugin-operations`,e],queryFn:()=>t.getPluginOperations(e),refetchInterval:e=>e.state.data?.operations?.[0]?.status===`running`?2e3:15e3}),i=r.data?.operations,a=i?.[0],o=a?.status,s=(0,g.useRef)(o);(0,g.useEffect)(()=>{s.current===`running`&&o!==`running`&&(n.invalidateQueries({queryKey:[`plugins`]}),n.invalidateQueries({queryKey:[`tunnels`]}),n.invalidateQueries({queryKey:[`plugin-hooks`,e]})),s.current=o},[o,e,n]);let c=a?.finishedAt?Date.parse(a.finishedAt):null;return(0,M.jsxs)(M.Fragment,{children:[a!=null&&!(c&&r.dataUpdatedAt-c>10*6e4)&&(0,M.jsx)(hs,{op:a}),(0,M.jsx)(gs,{plugin:e,operations:i})]})}function hs({op:e}){return(0,M.jsxs)(`div`,{className:`rounded border border-zinc-800 bg-zinc-950/60 p-3 mb-4 text-xs`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,M.jsx)(`span`,{className:`text-zinc-300 font-medium`,children:ps[e.kind]??e.kind}),(0,M.jsx)(`span`,{className:fs[e.status]??`text-zinc-400`,children:e.status===`rolled-back`?`rolled back`:e.status}),(0,M.jsxs)(`span`,{className:`text-zinc-600`,children:[`by `,e.actor]})]}),(0,M.jsxs)(`ul`,{className:`space-y-1`,children:[e.steps.map((e,t)=>(0,M.jsxs)(`li`,{className:`flex items-start gap-1.5`,children:[(0,M.jsx)(`span`,{className:`mt-0.5`,children:ds[e.status]??(0,M.jsx)(Wr,{size:12})}),(0,M.jsxs)(`span`,{className:e.status===`skipped`?`text-zinc-600`:`text-zinc-300`,children:[e.name,(e.error||e.detail)&&(0,M.jsxs)(`span`,{className:`text-zinc-500`,children:[` — `,e.error??e.detail]})]})]},t)),e.status===`running`&&e.steps.every(e=>e.status!==`running`)&&(0,M.jsxs)(`li`,{className:`flex items-center gap-1.5 text-zinc-500`,children:[(0,M.jsx)(B,{size:12,className:`animate-spin`}),` waiting…`]})]}),e.warnings?.length>0&&(0,M.jsx)(`ul`,{className:`mt-2 space-y-1`,children:e.warnings.map((e,t)=>(0,M.jsxs)(`li`,{className:`flex items-start gap-1.5 text-yellow-400`,children:[(0,M.jsx)(Hi,{size:12,className:`mt-0.5 shrink-0`}),` `,e]},t))}),e.error&&e.status!==`running`&&(0,M.jsx)(`p`,{className:`mt-2 text-red-400`,children:e.error})]})}function gs({plugin:e,operations:t}){let n=L(),r=N(),i=U(),{reveal:a,followState:o,claimOperation:s,releaseOperation:c}=da(),l=(0,g.useMemo)(()=>(t??[]).map(e=>({op:e,action:ia(e,o(e.id))})).filter(({action:e})=>e!==null),[t,o]),u=(0,g.useCallback)(async(t,{asked:o})=>{if(s(t.id))try{let{operation:s}=await n.getPluginOperation(e,t.id),{secrets:c}=ra(s);r.setQueryData([`plugin-operations`,e],e=>aa(e,t.id)),c.length>0?a({plugin:e,cause:t.kind,secrets:c}):o&&i(`Nothing to show — the secrets were shown elsewhere, or waited more than an hour`,`error`)}catch(e){i(`Could not read the client secrets: ${G(e)}`,`error`)}finally{c(t.id),r.invalidateQueries({queryKey:[`plugin-operations`,e]})}},[e,n,r,i,a,s,c]);(0,g.useEffect)(()=>{for(let{op:e,action:t}of l)t===`read`?u(e,{asked:!1}):t===`forget`&&c(e.id)},[l,u,c]);let d=l.filter(({action:e})=>e!==`forget`);return d.length===0?null:d.map(({op:e,action:t})=>(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 rounded border border-amber-500/30 bg-amber-500/5 p-3 mb-4 text-xs`,children:[(0,M.jsx)(z,{size:12,className:`shrink-0 text-amber-400`}),t===`offer`?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`span`,{className:`flex-1 text-amber-400`,children:[ps[e.kind]??e.kind,e.finishedAt?` (${new Date(e.finishedAt).toLocaleString()})`:``,` created confidential OIDC client secrets that were not shown yet. They are shown once.`]}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>u(e,{asked:!0}),className:`rounded bg-amber-600 px-2.5 py-1 text-white hover:bg-amber-500`,children:`Show the secrets`})]}):(0,M.jsxs)(`span`,{className:`flex items-center gap-1.5 text-zinc-400`,children:[(0,M.jsx)(B,{size:12,className:`animate-spin`}),`Reading the new client secrets…`]})]},e.id))}function _s({relay:e}){return(0,M.jsxs)(`div`,{className:`space-y-1.5 text-zinc-400`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`span`,{className:`text-zinc-500`,children:`module `}),e.entry?(0,M.jsxs)(`span`,{className:`font-mono text-zinc-300`,title:e.entrySha256,children:[e.entry,` `,(0,M.jsxs)(`span`,{className:`text-zinc-600`,children:[`sha256 `,ls(e.entrySha256)]})]}):(0,M.jsx)(`span`,{className:`text-zinc-500`,children:`none — shared hooks only`})]}),e.stages.length>0&&(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`span`,{className:`text-zinc-500`,children:`stages `}),e.stages.map(e=>(0,M.jsxs)(`span`,{className:`mr-2 font-mono text-zinc-300`,children:[e.stage,(0,M.jsxs)(`span`,{className:`text-zinc-600`,children:[` `,e.timeoutMs,` ms`]})]},e.stage))]}),e.request.map(e=>(0,M.jsxs)(`div`,{className:`rounded bg-zinc-900 px-2 py-1.5`,children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,M.jsx)(`span`,{className:`font-mono text-zinc-300`,children:e.stage}),(0,M.jsx)(`span`,{className:`text-zinc-500`,children:e.use??`plugin module`}),e.failOpen.length>0&&(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded bg-yellow-500/15 px-1.5 text-yellow-400`,title:`Traffic passes when this hook fails, times out, or cannot see the body`,children:[(0,M.jsx)(Fi,{size:11}),` fail-open: `,e.failOpen.join(`, `)]})]}),(0,M.jsx)(`div`,{className:`font-mono text-zinc-400`,children:e.routes.join(`, `)}),(0,M.jsxs)(`div`,{className:`text-zinc-600`,children:[`body `,e.bodyMaxBytes===null?`not seen`:`${e.bodyMaxBytes} B`,` · `,e.timeoutMs,` ms · on error `,e.onError,e.settings&&` · ${e.settings.action}, packs ${e.settings.packs.join(`, `)}, unscannable ${e.settings.onUnscannable}`]}),e.inactiveRoutes.length>0&&(0,M.jsxs)(`div`,{className:`text-zinc-600`,children:[`not active until the user surface: `,e.inactiveRoutes.join(`, `)]})]},e.index)),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`span`,{className:`text-zinc-500`,children:`effects `}),(0,M.jsx)(`span`,{className:`text-zinc-300`,children:e.effects.length>0?e.effects.join(`, `):`none`}),e.packs.length>0&&(0,M.jsxs)(`span`,{className:`text-zinc-500`,children:[` · rule packs `,e.packs.join(`, `)]})]})]})}function vs({integrity:e}){let[t,n]=(0,g.useState)(!1);return(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,M.jsx)(`span`,{className:`font-mono text-zinc-300`,title:e,children:us(e)}),(0,M.jsx)(`button`,{type:`button`,onClick:async()=>{try{await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500)}catch{}},title:`Copy the full integrity`,"aria-label":`Copy the full integrity`,className:`text-zinc-500 hover:text-zinc-300`,children:t?(0,M.jsx)(Fr,{size:11,className:`text-green-400`}):(0,M.jsx)(Kr,{size:11})})]})}function ys({agentHalf:e}){return(0,M.jsxs)(`div`,{className:`space-y-1 text-zinc-400`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`span`,{className:`text-zinc-500`,children:`package `}),(0,M.jsxs)(`span`,{className:`font-mono text-zinc-300`,children:[e.package,`@`,e.version]})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`span`,{className:`text-zinc-500`,children:`integrity `}),(0,M.jsx)(vs,{integrity:e.integrity})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`span`,{className:`text-zinc-500`,children:`entry `}),(0,M.jsx)(`span`,{className:`font-mono text-zinc-300`,children:e.entry}),(0,M.jsx)(`span`,{className:`text-zinc-500`,children:` · memory `}),(0,M.jsx)(`span`,{className:`font-mono text-zinc-300`,children:e.memoryMax??`not limited`})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`span`,{className:`text-zinc-500`,children:`runs as `}),(0,M.jsx)(`span`,{className:`font-mono text-zinc-300`,children:e.serviceUser}),(0,M.jsx)(`span`,{className:`text-zinc-500`,children:` · unit `}),(0,M.jsx)(`span`,{className:`font-mono text-zinc-300`,children:e.unitName})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`span`,{className:`text-zinc-500`,children:`data `}),(0,M.jsx)(`span`,{className:`font-mono text-zinc-300`,children:e.dataDir}),(0,M.jsx)(`span`,{className:`text-zinc-600`,children:` — kept when it is removed, unless purged`})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`span`,{className:`text-zinc-500`,children:`system packages `}),e.systemPackages.length>0?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`span`,{className:`font-mono text-zinc-300`,children:e.systemPackages.join(`, `)}),(0,M.jsx)(`span`,{className:`text-zinc-600`,children:` — installed with apt-get once approved`})]}):(0,M.jsx)(`span`,{className:`text-zinc-300`,children:`none`})]})]})}function bs(e,t){e.invalidateQueries({queryKey:[`plugin-hooks`,t]}),e.invalidateQueries({queryKey:[`plugins`]}),e.invalidateQueries({queryKey:[`plugin-operations`,t]})}function xs(e,t){return cs(e,{agentLabel:t.agentHosting?.agentLabel,action:`update`})}function Ss({relay:e,agentHalf:t}){return e&&t?{subject:`relay hooks and agent half`,plural:!0}:t?{subject:`agent half`,plural:!1}:{subject:`relay hooks`,plural:!0}}function Cs({relay:e,agentHalf:t}){return e&&t?`Run this code on the relay and install this agent half?`:t?`Install this agent half on the hosting agent?`:`Run this code on the relay?`}function ws({relay:e,agentHalf:t}){return e&&t?`Lamaste runs its relay hooks, installs its agent half and hosts the plugin only once this is approved.`:t?`Lamaste installs its agent half and hosts the plugin only once this is approved.`:`Lamaste runs its relay hooks and hosts the plugin only once they are approved.`}function Ts({digest:e}){return(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`span`,{className:`text-zinc-500`,children:`approval digest `}),(0,M.jsx)(`span`,{className:`font-mono text-zinc-300`,title:e,children:ls(e)})]})}function Es({relay:e,agentHalf:t}){return(0,M.jsxs)(M.Fragment,{children:[e&&(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`p`,{className:`mb-1 text-zinc-500`,children:`Relay hooks — run in a sandbox on the relay (no network, no files of Lamaste's):`}),(0,M.jsx)(_s,{relay:e})]}),t&&(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`p`,{className:`mb-1 text-zinc-500`,children:`Agent half — Lamaste installs it on the hosting agent as a hardened service of its own:`}),(0,M.jsx)(ys,{agentHalf:t})]})]})}function Ds({plugin:e,isActing:t}){let n=L(),r=N(),i=U(),{followOperation:a}=da(),[o,s]=(0,g.useState)(!1),[c,l]=(0,g.useState)(null),u=P({queryKey:[`plugin-hooks`,e.name],queryFn:()=>n.getPluginHooks(e.name),refetchInterval:3e4}).data?.hooks,d=()=>bs(r,e.name),f=F({mutationFn:t=>n.approvePluginHooks(e.name,t),onSuccess:t=>{t.operation&&a(t.operation.id),d(),i(t.operation?`Approved — updating ${e.name}`:`${e.name}: approved`)},onError:t=>{d(),i(xs(t,e),`error`)}}),p=F({mutationFn:t=>n.setPluginHooksAutoApprove(e.name,t),onSuccess:d,onError:e=>i(G(e),`error`)}),m=F({mutationFn:()=>n.discardPluginUpdate(e.name),onSuccess:()=>{d(),i(`Pending update discarded`)},onError:e=>i(G(e),`error`)});if(!u||!u.relay&&!u.agent&&!u.agentHalf&&!u.pendingUpdate)return null;let h=t||f.isPending||p.isPending||m.isPending,{approval:_}=u,v=_.state===`pending`,{subject:y,plural:b}=Ss(u),x=(e,t,n)=>c===e?(0,M.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,M.jsx)(`span`,{className:`text-zinc-400`,children:n}),(0,M.jsx)(`button`,{type:`button`,disabled:h,onClick:()=>{l(null),f.mutate(e)},className:`rounded bg-cyan-600 px-2 py-1 text-white hover:bg-cyan-500 disabled:opacity-50`,children:`Approve`}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>l(null),className:`rounded bg-zinc-700 px-2 py-1 text-zinc-300 hover:bg-zinc-600`,children:`Cancel`})]}):(0,M.jsxs)(`button`,{type:`button`,disabled:h,onClick:()=>{s(!0),l(e)},className:`flex items-center gap-1.5 rounded bg-cyan-600 px-2.5 py-1 text-white hover:bg-cyan-500 disabled:opacity-50`,children:[(0,M.jsx)(Ii,{size:11}),` `,t]});return(0,M.jsxs)(`div`,{className:`rounded border border-zinc-800 bg-zinc-950/60 p-3 mb-4 text-xs`,children:[(0,M.jsxs)(`button`,{type:`button`,onClick:()=>s(e=>!e),className:`flex w-full flex-wrap items-center gap-2 text-left`,children:[o?(0,M.jsx)(Ir,{size:12}):(0,M.jsx)(Rr,{size:12}),(0,M.jsx)(`span`,{className:`text-zinc-300 font-medium`,children:`Lifecycle hooks`}),_.required&&(v?(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-yellow-500/15 px-2 py-0.5 text-yellow-400`,children:[(0,M.jsx)(Fi,{size:11}),` `,y,` `,b?`wait`:`waits`,` for approval`]}):(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-green-500/15 px-2 py-0.5 text-green-400`,children:[(0,M.jsx)(Fr,{size:11}),` `,y,` approved`]})),u.relay?.failOpenCount>0&&(0,M.jsxs)(`span`,{className:`text-yellow-400`,children:[u.relay.failOpenCount,` fail-open`]}),u.pendingUpdate&&(0,M.jsxs)(`span`,{className:`text-yellow-400`,children:[`update `,u.pendingUpdate.version,` waiting`]})]}),o&&(0,M.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[_.required&&(0,M.jsxs)(`div`,{className:`space-y-2`,children:[(0,M.jsx)(`p`,{className:`text-zinc-500`,children:v?ws(u):`Approved by ${_.approvedBy} ${_.approvedAt?new Date(_.approvedAt).toLocaleString():``} (version ${_.approvedVersion}).`}),(0,M.jsx)(Ts,{digest:_.digest}),(0,M.jsx)(Es,{relay:u.relay,agentHalf:u.agentHalf}),(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[v&&x(_.digest,`Approve`,Cs(u)),(0,M.jsxs)(`label`,{className:`flex items-center gap-1.5 text-zinc-400`,children:[(0,M.jsx)(`input`,{type:`checkbox`,checked:u.autoApprove,disabled:h,onChange:e=>p.mutate(e.target.checked)}),`Approve what later versions of this plugin bring automatically`]})]})]}),u.agent&&(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`p`,{className:`text-zinc-500 mb-1`,children:`Agent hooks — run by the agent half on its agent; no approval needed:`}),(0,M.jsx)(`div`,{className:`font-mono text-zinc-300`,children:u.agent.stages.map(e=>e.stage).join(`, `)})]}),u.pendingUpdate&&(0,M.jsxs)(`div`,{className:`space-y-2 rounded border border-yellow-500/30 p-2`,children:[(0,M.jsxs)(`p`,{className:`text-yellow-400`,children:[`Version `,u.pendingUpdate.version,` waits for approval of what it brings (below). The installed version stays live until then.`]}),(0,M.jsx)(Ts,{digest:u.pendingUpdate.digest}),(0,M.jsx)(Es,{relay:u.pendingUpdate.relay,agentHalf:u.pendingUpdate.agentHalf}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[x(u.pendingUpdate.digest,`Approve and update`,Cs(u.pendingUpdate)),(0,M.jsxs)(`button`,{type:`button`,disabled:h,onClick:()=>m.mutate(),className:`flex items-center gap-1.5 rounded bg-zinc-700 px-2.5 py-1 text-zinc-300 hover:bg-zinc-600 disabled:opacity-50`,children:[(0,M.jsx)(H,{size:11}),` Discard`]})]})]})]})]})}function Os({plugin:e,isActing:t}){let n=L(),r=N(),i=U(),{followOperation:a}=da(),[o,s]=(0,g.useState)(``),c=F({mutationFn:()=>n.updatePlugin(e.name,o.trim()||void 0),onSuccess:t=>{t.operation&&a(t.operation.id),bs(r,e.name),t.upToDate?i(`${e.name} is already at ${t.version}`):t.pendingUpdate?i(`${e.name} ${t.pendingUpdate.version} waits for approval — review what it brings under Lifecycle hooks`):i(`Updating ${e.name}`),s(``)},onError:t=>i(xs(t,e),`error`)});return(0,M.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,M.jsx)(`input`,{type:`text`,value:o,onChange:e=>s(e.target.value),placeholder:`latest`,className:`w-20 rounded bg-zinc-800 border border-zinc-700 px-2 py-1 text-xs text-zinc-300 focus:outline-none focus:border-cyan-400`,"aria-label":`Version to update to`}),(0,M.jsxs)(`button`,{type:`button`,disabled:t||c.isPending,onClick:()=>c.mutate(),className:`flex items-center gap-1.5 rounded bg-zinc-700 px-3 py-1.5 text-xs text-zinc-300 hover:bg-zinc-600 disabled:opacity-50`,title:`Fetch the version and read it before installing it; relay hooks that changed or a new agent half wait for approval`,children:[c.isPending?(0,M.jsx)(B,{size:12,className:`animate-spin`}):(0,M.jsx)(Yr,{size:12}),`Update`]})]})}var ks=`push-install`;function As(){requestAnimationFrame(()=>{document.getElementById(ks)?.scrollIntoView({behavior:`smooth`,block:`start`})})}function js(e,t){return e!=null&&Date.parse(e)>t}var Ms=30;function Ns(e,t){let n=Number(e);return!/^\d+$/.test(e.trim())||n<t.min||n>t.max?`${t.min} to ${t.max} whole minutes`:null}function Ps({agent:e,config:t,onDone:n}){let r=L(),i=N(),a=U(),o=t.windowMinutes,[s,c]=(0,g.useState)(String(Math.min(Math.max(Ms,o.min),o.max))),[l,u]=(0,g.useState)(t.policies.some(t=>t.id===e.pushInstallPolicy)?e.pushInstallPolicy:t.defaultPolicy),d=Ns(s,o),f=F({mutationFn:()=>r.enablePushInstall(e.label,{durationMinutes:Number(s),policyId:l}),onSuccess:t=>{i.invalidateQueries({queryKey:[`agent-certs`]}),a(`Push install open for ${e.label} until ${new Date(t.pushInstallEnabledUntil).toLocaleTimeString()}`),n()},onError:e=>a(G(e),`error`)});return(0,M.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),d||f.mutate()},className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,M.jsxs)(`label`,{className:`flex items-center gap-1.5 text-zinc-400`,children:[`for`,(0,M.jsx)(`input`,{type:`number`,inputMode:`numeric`,min:o.min,max:o.max,step:1,value:s,onChange:e=>c(e.target.value),"aria-invalid":d!==null,className:`w-20 rounded border bg-zinc-800 px-2 py-1 text-zinc-200 focus:outline-none ${d?`border-red-500/70`:`border-zinc-700 focus:border-cyan-400`}`}),`minutes`]}),(0,M.jsxs)(`label`,{className:`flex items-center gap-1.5 text-zinc-400`,children:[`policy`,(0,M.jsx)(`select`,{value:l,onChange:e=>u(e.target.value),className:`rounded border border-zinc-700 bg-zinc-800 px-2 py-1 text-zinc-200 focus:border-cyan-400 focus:outline-none`,children:t.policies.map(e=>(0,M.jsxs)(`option`,{value:e.id,children:[e.name,e.id===t.defaultPolicy?` (default)`:``]},e.id))})]}),(0,M.jsxs)(`button`,{type:`submit`,disabled:d!==null||f.isPending,className:`flex items-center gap-1.5 rounded bg-cyan-600 px-2.5 py-1 text-white hover:bg-cyan-500 disabled:opacity-50`,children:[f.isPending?(0,M.jsx)(B,{size:11,className:`animate-spin`}):(0,M.jsx)(gi,{size:11}),`Open`]}),(0,M.jsx)(`button`,{type:`button`,onClick:n,className:`rounded bg-zinc-700 px-2.5 py-1 text-zinc-300 hover:bg-zinc-600`,children:`Cancel`}),d&&(0,M.jsxs)(`span`,{className:`basis-full text-red-400`,children:[`A window is open `,d,`.`]})]})}function Fs({children:e}){let t=L(),n=N(),r=U(),[i,a]=(0,g.useState)(null),o=P({queryKey:[`push-install-config`],queryFn:()=>t.getPushInstallConfig(),refetchInterval:3e4}),s=P({queryKey:[`agent-certs`],queryFn:()=>t.getAgentCerts(),refetchInterval:3e4}),c=F({mutationFn:e=>t.updatePushInstallConfig(e),onSuccess:(e,t)=>{n.invalidateQueries({queryKey:[`push-install-config`]}),n.invalidateQueries({queryKey:[`push-install-policies`]}),t.enabled===void 0?r(`Default policy: ${e.defaultPolicy}`):r(e.enabled?`Push install is on — open the window of the agent to push to`:`Push install is off — every push is refused`)},onError:e=>r(G(e),`error`)}),l=F({mutationFn:e=>t.disablePushInstall(e),onSuccess:(e,t)=>{n.invalidateQueries({queryKey:[`agent-certs`]}),r(`Push install closed for ${t}`)},onError:e=>r(G(e),`error`)}),u=o.data,d=(s.data?.agents??[]).filter(e=>!e.revoked&&!e.label.startsWith(`plugin-agent:`)).sort((e,t)=>e.label.localeCompare(t.label)),f=s.dataUpdatedAt,p=e=>js(e.pushInstallEnabledUntil,f),m=e=>u?.policies.find(t=>t.id===e)?.name??e;return(0,M.jsx)(`section`,{id:ks,className:`mt-8 scroll-mt-6`,children:(0,M.jsxs)(`div`,{className:`border-t border-zinc-700 pt-6`,children:[(0,M.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center justify-between gap-3`,children:[(0,M.jsxs)(`h2`,{className:`flex items-center gap-2 text-lg font-semibold text-white`,children:[(0,M.jsx)(Li,{size:18,className:`text-cyan-400`}),`Push Install`,u&&(0,M.jsx)(`span`,{className:`rounded-full px-2 py-0.5 text-xs font-normal ${u.enabled?`bg-green-500/20 text-green-400`:`bg-zinc-500/20 text-zinc-400`}`,children:u.enabled?`on`:`off`})]}),u&&(0,M.jsxs)(`button`,{type:`button`,disabled:c.isPending,onClick:()=>c.mutate({enabled:!u.enabled}),className:`flex items-center gap-1.5 rounded px-3 py-1.5 text-xs disabled:opacity-50 ${u.enabled?`bg-zinc-700 text-zinc-300 hover:bg-zinc-600`:`bg-cyan-600 text-white hover:bg-cyan-500`}`,children:[u.enabled?(0,M.jsx)(Di,{size:12}):(0,M.jsx)(Oi,{size:12}),u.enabled?`Turn off`:`Turn on`]})]}),(0,M.jsx)(`p`,{className:`mb-4 text-sm text-zinc-500`,children:`Lets the panel install, update and remove what Lamaste installs on an agent — the agent half of an app plugin — while that agent's window is open, within its policy. Off: every push is refused, open windows included.`}),o.isError?(0,M.jsx)(`p`,{className:`mb-4 text-sm text-red-400`,children:G(o.error)}):u?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`label`,{className:`mb-4 flex flex-wrap items-center gap-2 text-sm text-zinc-400`,children:[`Default policy for a window`,(0,M.jsx)(`select`,{value:u.defaultPolicy,disabled:c.isPending,onChange:e=>c.mutate({defaultPolicy:e.target.value}),className:`rounded border border-zinc-700 bg-zinc-800 px-2 py-1 text-sm text-zinc-200 focus:border-cyan-400 focus:outline-none`,children:u.policies.map(e=>(0,M.jsx)(`option`,{value:e.id,children:e.name},e.id))})]}),(0,M.jsx)(`div`,{className:`mb-6 overflow-x-auto rounded-lg border border-zinc-800`,children:(0,M.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,M.jsx)(`thead`,{children:(0,M.jsxs)(`tr`,{className:`border-b border-zinc-700 bg-zinc-900`,children:[(0,M.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400`,children:`Agent`}),(0,M.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400`,children:`Window`}),(0,M.jsx)(`th`,{className:`px-4 py-3 text-right text-xs font-medium uppercase text-zinc-400`,children:`Manage`})]})}),(0,M.jsxs)(`tbody`,{children:[s.isError&&(0,M.jsx)(`tr`,{className:`bg-zinc-800`,children:(0,M.jsx)(`td`,{colSpan:3,className:`px-4 py-3 text-red-400`,children:G(s.error)})}),s.isSuccess&&d.length===0&&(0,M.jsx)(`tr`,{className:`bg-zinc-800`,children:(0,M.jsx)(`td`,{colSpan:3,className:`px-4 py-3 text-zinc-500`,children:`No enrolled machine agent.`})}),d.map(e=>{let t=p(e);return(0,M.jsxs)(`tr`,{className:`border-b border-zinc-700 bg-zinc-800`,children:[(0,M.jsx)(`td`,{className:`whitespace-nowrap px-4 py-3 align-top font-mono text-zinc-200`,children:e.label}),(0,M.jsxs)(`td`,{className:`px-4 py-3 align-top`,children:[t?(0,M.jsxs)(`span`,{className:`flex items-center gap-1.5 text-green-400`,children:[(0,M.jsx)(Gr,{size:12}),`open until `,new Date(e.pushInstallEnabledUntil).toLocaleString(),(0,M.jsxs)(`span`,{className:`text-zinc-500`,children:[`· policy `,m(e.pushInstallPolicy)]})]}):(0,M.jsx)(`span`,{className:`text-zinc-500`,children:`closed`}),i===e.label&&(0,M.jsx)(`div`,{className:`mt-2`,children:(0,M.jsx)(Ps,{agent:e,config:u,onDone:()=>a(null)})})]}),(0,M.jsx)(`td`,{className:`px-4 py-3 text-right align-top`,children:(0,M.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[i!==e.label&&(0,M.jsxs)(`button`,{type:`button`,disabled:!u.enabled,onClick:()=>a(e.label),title:u.enabled?`Open the window for a number of minutes, under a policy`:`Turn push install on first`,className:`inline-flex items-center gap-1.5 rounded bg-zinc-700 px-2.5 py-1.5 text-xs text-zinc-300 hover:bg-zinc-600 disabled:opacity-50`,children:[(0,M.jsx)(gi,{size:12}),t?`Reopen…`:`Open…`]}),t&&(0,M.jsxs)(`button`,{type:`button`,disabled:l.isPending,onClick:()=>l.mutate(e.label),className:`inline-flex items-center gap-1.5 rounded bg-zinc-700 px-2.5 py-1.5 text-xs text-zinc-300 hover:bg-red-600/20 hover:text-red-400 disabled:opacity-50`,children:[(0,M.jsx)(_i,{size:12}),`Close`]})]})})]},e.label)})]})]})})]}):(0,M.jsx)(`div`,{className:`mb-4 h-24 animate-pulse rounded-lg border border-zinc-800 bg-zinc-900`}),e]})})}function Is({onClose:e}){return(0,M.jsxs)(`button`,{type:`button`,onClick:()=>{e(),As()},className:`inline-flex items-center gap-1 text-cyan-400 hover:text-cyan-300 hover:underline`,children:[(0,M.jsx)(Or,{size:11}),`Push install`]})}function Ls({until:e,now:t}){return js(e,t)?(0,M.jsxs)(`span`,{className:`text-green-400`,children:[`push install open until `,new Date(e).toLocaleTimeString()]}):(0,M.jsx)(`span`,{className:`text-zinc-500`,children:`push install closed`})}var Rs=(0,g.forwardRef)(function({refusal:e,pluginName:t,onClose:n},r){return(0,M.jsxs)(`div`,{ref:r,className:`rounded border border-red-500/30 bg-red-500/5 p-3 text-xs`,children:[(0,M.jsxs)(`p`,{className:`flex items-start gap-1.5 text-red-400`,children:[(0,M.jsx)(Hi,{size:12,className:`mt-0.5 shrink-0`}),e.code===`agent_not_eligible`?`Agent "${e.agentLabel}" cannot host ${t}:`:e.message]}),e.code===`agent_not_eligible`&&(0,M.jsx)(`ul`,{className:`mt-1 list-disc space-y-0.5 pl-6 text-zinc-300`,children:e.reasons.map(e=>(0,M.jsx)(`li`,{children:e},e))}),e.hint&&(0,M.jsx)(`p`,{className:`mt-1.5 text-zinc-400`,children:e.hint}),e.code===`push_install_refused`&&(0,M.jsx)(`p`,{className:`mt-1.5`,children:(0,M.jsx)(Is,{onClose:n})})]})});function zs({plugin:e,onHost:t,onClose:n,isActing:r}){let i=L(),[a,o]=(0,g.useState)(``),[s,c]=(0,g.useState)(null),[l,u]=(0,g.useState)(!1),d=(0,g.useRef)(null);(0,g.useEffect)(()=>{s&&d.current?.scrollIntoView({block:`nearest`,behavior:`smooth`})},[s]);let f=e.hooks?.agentHalf===!0,p=e.hooks?.approval===`pending`,m=P({queryKey:[`plugin-hosting-eligibility`,e.name],queryFn:()=>i.getPluginHostingEligibility(e.name),refetchInterval:3e4}),h=P({queryKey:[`agent-certs`],queryFn:()=>i.getAgentCerts(),refetchInterval:3e4}),_=P({queryKey:[`push-install-config`],queryFn:()=>i.getPushInstallConfig(),enabled:f}),v=P({queryKey:[`plugin-hooks`,e.name],queryFn:()=>i.getPluginHooks(e.name),enabled:f}),y=m.data?.agents??[],b=new Map((h.data?.agents??[]).map(e=>[e.label,e])),x=y.some(e=>e.label===a&&e.eligible)?a:``,S=v.data?.hooks?.agentHalf??null,C=f&&_.data?.enabled===!1,w=h.dataUpdatedAt,T=x?b.get(x):void 0,E=f&&!C&&T!==void 0&&!js(T.pushInstallEnabledUntil,w);return(0,M.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4`,children:(0,M.jsxs)(`div`,{className:`flex max-h-full w-full max-w-2xl flex-col rounded-xl border border-zinc-700 bg-zinc-900 shadow-xl`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between border-b border-zinc-800 px-6 py-4`,children:[(0,M.jsxs)(`h3`,{className:`flex items-center gap-2 text-lg font-semibold text-white`,children:[(0,M.jsx)(Mi,{size:18,className:`text-cyan-400`}),`Host `,e.displayName||e.name]}),(0,M.jsx)(`button`,{type:`button`,onClick:n,disabled:l,"aria-label":`Close`,className:`text-zinc-400 hover:text-white disabled:opacity-50`,children:(0,M.jsx)(H,{size:20})})]}),(0,M.jsxs)(`div`,{className:`space-y-4 overflow-y-auto px-6 py-4 text-xs`,children:[(0,M.jsx)(`p`,{className:`text-zinc-400`,children:f?`Lamaste installs the agent half on the agent you pick, as a service of its own, and runs the install hooks around creating the internal tunnel, assigning the port and issuing the installation secret.`:`Pick the agent that runs its agent half (installed there by hand): Lamaste runs the install hooks around creating the internal tunnel, assigning the port and issuing the installation secret.`}),f&&(0,M.jsxs)(`div`,{className:`rounded border border-zinc-800 bg-zinc-950/60 p-3`,children:[(0,M.jsx)(`p`,{className:`mb-2 font-medium text-zinc-300`,children:`What Lamaste installs on the agent`}),S?(0,M.jsx)(ys,{agentHalf:S}):v.isError?(0,M.jsx)(`p`,{className:`text-red-400`,children:G(v.error)}):(0,M.jsx)(B,{size:12,className:`animate-spin text-zinc-500`})]}),p&&(0,M.jsxs)(`p`,{className:`flex items-start gap-1.5 text-yellow-400`,children:[(0,M.jsx)(Fi,{size:12,className:`mt-0.5 shrink-0`}),f?`Not approved yet — approve what it brings under Lifecycle hooks on the plugin’s card, then host it.`:`Its relay hooks are not approved yet — approve them under Lifecycle hooks on the plugin’s card, then host it.`]}),C&&(0,M.jsxs)(`p`,{className:`flex flex-wrap items-start gap-1.5 text-yellow-400`,children:[(0,M.jsx)(Hi,{size:12,className:`mt-0.5 shrink-0`}),(0,M.jsxs)(`span`,{children:[`Push install is off on this relay: Lamaste cannot install the agent half until it is on and the agent's window is open — under `,(0,M.jsx)(Is,{onClose:n}),`.`]})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`p`,{className:`mb-2 font-medium text-zinc-300`,children:`Agent`}),m.isLoading?(0,M.jsx)(`div`,{className:`space-y-2`,children:Array.from({length:2}).map((e,t)=>(0,M.jsx)(`div`,{className:`h-12 animate-pulse rounded bg-zinc-800`},t))}):m.isError?(0,M.jsx)(`p`,{className:`text-red-400`,children:G(m.error)}):y.length===0?(0,M.jsx)(`p`,{className:`text-zinc-500`,children:`No enrolled machine agent — enroll one under Certificates first.`}):(0,M.jsx)(`ul`,{className:`space-y-1.5`,role:`radiogroup`,"aria-label":`Hosting agent`,children:y.map(t=>{let n=b.get(t.label);return(0,M.jsx)(`li`,{children:(0,M.jsxs)(`label`,{className:`flex items-start gap-2 rounded border px-3 py-2 ${t.eligible?x===t.label?`cursor-pointer border-cyan-500/60 bg-cyan-500/5`:`cursor-pointer border-zinc-800 bg-zinc-950/60 hover:border-zinc-700`:`cursor-not-allowed border-zinc-800 bg-zinc-950/40`}`,children:[(0,M.jsx)(`input`,{type:`radio`,name:`host-${e.name}`,value:t.label,checked:x===t.label,disabled:!t.eligible,onChange:()=>o(t.label),className:`mt-0.5 accent-cyan-500`}),(0,M.jsxs)(`span`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,M.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,M.jsx)(`span`,{className:`font-mono ${t.eligible?`text-zinc-200`:`text-zinc-500`}`,children:t.label}),f&&t.eligible&&n&&(0,M.jsx)(Ls,{until:n.pushInstallEnabledUntil,now:w})]}),(0,M.jsx)(`span`,{className:`block`,children:(0,M.jsx)(ko,{facts:n?.hostFacts??null,at:n?.hostFactsAt??null})}),!t.eligible&&(0,M.jsx)(`ul`,{className:`list-disc space-y-0.5 pl-4 text-yellow-400/90`,children:t.reasons.map(e=>(0,M.jsx)(`li`,{children:e},e))})]})]})},t.label)})})]}),E&&(0,M.jsxs)(`p`,{className:`flex items-start gap-1.5 text-yellow-400`,children:[(0,M.jsx)(Hi,{size:12,className:`mt-0.5 shrink-0`}),(0,M.jsxs)(`span`,{children:[`The push-install window of `,(0,M.jsx)(`span`,{className:`font-mono`,children:x}),` is closed: Lamaste installs the agent half by push install, so open it first — under`,` `,(0,M.jsx)(Is,{onClose:n}),`.`]})]}),s&&(0,M.jsx)(Rs,{ref:d,refusal:s,pluginName:e.displayName||e.name,onClose:n})]}),(0,M.jsxs)(`div`,{className:`flex justify-end gap-3 border-t border-zinc-800 px-6 py-4`,children:[(0,M.jsx)(`button`,{type:`button`,onClick:n,disabled:l,className:`rounded bg-zinc-700 px-4 py-2 text-sm text-zinc-300 hover:bg-zinc-600 disabled:opacity-50`,children:`Cancel`}),(0,M.jsxs)(`button`,{type:`button`,disabled:l||r||!x||p,onClick:()=>{c(null),u(!0),t(e.name,x,{onSuccess:n,onError:e=>{u(!1);let t=ss(e,{agentLabel:x,action:`install`});c({...t,agentLabel:x}),t.code===`agent_not_eligible`&&m.refetch()}})},title:p?`Approve what it brings first (Lifecycle hooks)`:void 0,className:`flex items-center gap-1.5 rounded bg-cyan-600 px-4 py-2 text-sm font-semibold text-white hover:bg-cyan-500 disabled:opacity-50`,children:[l?(0,M.jsx)(B,{size:14,className:`animate-spin`}):(0,M.jsx)(Mi,{size:14}),x?`Host on ${x}`:`Host on agent`]})]})]})})}function Bs({record:e,isActing:t}){let n=L(),r=N(),i=U(),[a,o]=(0,g.useState)(null),s=()=>{r.invalidateQueries({queryKey:[`plugins`]}),r.invalidateQueries({queryKey:[`plugin-operations`,e.plugin]})},c=F({mutationFn:()=>n.purgePluginRetainedData(e.plugin,e.agentLabel),onSuccess:()=>{s(),i(`Purging what ${e.agentLabel} keeps of "${e.plugin}" — follow the steps under its name`)},onError:t=>i(cs(t,{agentLabel:e.agentLabel,action:`uninstall`}),`error`)}),l=F({mutationFn:()=>n.forgetPluginRetainedData(e.plugin,e.agentLabel),onSuccess:()=>{s(),i(`Forgot the record — ${e.dataDir} stays on ${e.agentLabel} until it is removed there`)},onError:e=>i(G(e),`error`)}),u=t||c.isPending||l.isPending,d=(e,t,n)=>(0,M.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,M.jsx)(`button`,{type:`button`,disabled:u,onClick:()=>{o(null),t()},className:`rounded px-2 py-1 text-white disabled:opacity-50 ${n?`bg-red-600 hover:bg-red-500`:`bg-zinc-600 hover:bg-zinc-500`}`,children:e}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>o(null),className:`rounded bg-zinc-700 px-2 py-1 text-zinc-300 hover:bg-zinc-600`,children:`Cancel`})]});return(0,M.jsxs)(`li`,{className:`rounded bg-zinc-900 px-2 py-1.5`,children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,M.jsx)(`span`,{className:`font-mono text-zinc-200`,children:e.agentLabel}),(0,M.jsxs)(`span`,{className:`text-zinc-500`,children:[`route `,(0,M.jsx)(`span`,{className:`font-mono text-zinc-300`,children:e.route})]}),(0,M.jsx)(`span`,{className:`font-mono text-zinc-400`,children:e.package}),(0,M.jsxs)(`span`,{className:`text-zinc-600`,children:[`since `,new Date(e.since).toLocaleString()]})]}),(0,M.jsxs)(`div`,{className:`font-mono text-zinc-500`,children:[e.dataDir,` `,(0,M.jsx)(`span`,{className:`text-zinc-600`,children:`· account`}),` `,e.serviceUser]}),a===`purge`&&(0,M.jsxs)(`div`,{className:`mt-1.5 space-y-1.5`,children:[(0,M.jsxs)(`p`,{className:`flex items-start gap-1 text-red-400`,children:[(0,M.jsx)(Hi,{size:11,className:`mt-0.5 shrink-0`}),(0,M.jsxs)(`span`,{children:[`Delete `,(0,M.jsx)(`span`,{className:`font-mono`,children:e.dataDir}),` and the account`,` `,(0,M.jsx)(`span`,{className:`font-mono`,children:e.serviceUser}),` on agent`,` `,(0,M.jsx)(`span`,{className:`font-mono`,children:e.agentLabel}),` (route`,` `,(0,M.jsx)(`span`,{className:`font-mono`,children:e.route}),`)? The agent's app host helper deletes them once push install lets Lamaste remove`,` `,(0,M.jsx)(`span`,{className:`font-mono`,children:e.package}),` there — this cannot be undone.`]})]}),d(`Purge`,()=>c.mutate(),!0)]}),a===`forget`&&(0,M.jsxs)(`div`,{className:`mt-1.5 space-y-1.5`,children:[(0,M.jsxs)(`p`,{className:`text-zinc-400`,children:[`Drop only the relay's record? Nothing on`,` `,(0,M.jsx)(`span`,{className:`font-mono`,children:e.agentLabel}),` changes:`,` `,(0,M.jsx)(`span`,{className:`font-mono`,children:e.dataDir}),` and the account`,` `,(0,M.jsx)(`span`,{className:`font-mono`,children:e.serviceUser}),` stay on the machine — remove them there with`,` `,(0,M.jsxs)(`span`,{className:`font-mono`,children:[`sudo lamaste-agent apphost remove `,e.route,` --purge`]}),`. For an agent that is gone, or data already removed by hand.`]}),d(`Forget`,()=>l.mutate(),!1)]}),a===null&&(0,M.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap items-center gap-2`,children:[(0,M.jsxs)(`button`,{type:`button`,disabled:u,onClick:()=>o(`purge`),title:`Delete the data directory and the account on the agent (a push: uninstall)`,className:`flex items-center gap-1.5 rounded bg-zinc-700 px-2.5 py-1 text-zinc-300 hover:bg-red-600/20 hover:text-red-400 disabled:opacity-50`,children:[(0,M.jsx)(Vi,{size:11}),`Purge…`]}),(0,M.jsxs)(`button`,{type:`button`,disabled:u,onClick:()=>o(`forget`),title:`Drop the relay's record only; the data stays on the agent`,className:`flex items-center gap-1.5 rounded bg-zinc-700 px-2.5 py-1 text-zinc-300 hover:bg-zinc-600 disabled:opacity-50`,children:[(0,M.jsx)(Xr,{size:11}),`Forget…`]})]})]})}function Vs({records:e,isActing:t}){return(0,M.jsx)(`ul`,{className:`space-y-1.5`,children:e.map(e=>(0,M.jsx)(Bs,{record:e,isActing:t},`${e.agentLabel}/${e.route}`))})}function Hs({plugin:e,isActing:t}){let n=e.retainedData??[];return n.length===0?null:(0,M.jsxs)(`div`,{className:`rounded border border-zinc-800 bg-zinc-950/60 p-3 mb-4 text-xs`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,M.jsx)(Dr,{size:12,className:`text-cyan-400`}),(0,M.jsx)(`span`,{className:`text-zinc-300 font-medium`,children:`Retained data`})]}),(0,M.jsx)(`p`,{className:`mb-2 text-zinc-500`,children:`Its agent half was removed without purge: these agents keep its data and account. Hosting the same agent package there again takes the data back; another package is refused until it is purged.`}),(0,M.jsx)(Vs,{records:n,isActing:t})]})}function Us({records:e,installedNames:t,isActing:n}){let r=new Map;for(let n of e)t.has(n.plugin)||r.set(n.plugin,[...r.get(n.plugin)??[],n]);return r.size===0?null:(0,M.jsxs)(`section`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-5 mt-8 text-xs`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,M.jsx)(Dr,{size:14,className:`text-cyan-400`}),(0,M.jsx)(`h2`,{className:`text-sm font-semibold text-zinc-300`,children:`Retained data of uninstalled plugins`})]}),(0,M.jsx)(`p`,{className:`mb-4 text-zinc-500`,children:`These plugins are uninstalled, but agents keep the data and account of their agent halves. Purge it, or forget the record once it is gone from the agent.`}),(0,M.jsx)(`div`,{className:`space-y-4`,children:[...r.entries()].map(([e,t])=>(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`p`,{className:`mb-2 font-mono text-sm text-zinc-200`,children:e}),(0,M.jsx)(ms,{plugin:e}),(0,M.jsx)(Vs,{records:t,isActing:n})]},e))})]})}function Ws({status:e}){return(0,M.jsx)(`span`,{className:`text-xs px-2 py-0.5 rounded-full ${e===`enabled`?`bg-green-500/20 text-green-400`:`bg-zinc-500/20 text-zinc-400`}`,children:e===`enabled`?`Enabled`:`Disabled`})}function Gs(){return(0,M.jsxs)(`span`,{className:`flex items-center gap-1 text-xs px-2 py-0.5 rounded-full bg-cyan-500/10 text-cyan-400`,title:`The application runs on its own agent. Lamaste never loads its code.`,children:[(0,M.jsx)(Si,{size:11}),`Agent-hosted`]})}function Ks({health:e}){let t=e?.state??`unknown`,n=t===`up`?`bg-green-500/20 text-green-400`:t===`down`?`bg-red-500/20 text-red-400`:`bg-zinc-500/20 text-zinc-400`,r=t===`up`?`reachable`:t===`down`?`down (${e.reason??`?`})`:`unknown`,i=[e?.since?`since ${new Date(e.since).toLocaleString()}`:null,e?.checkedAt?`checked ${new Date(e.checkedAt).toLocaleTimeString()}`:null,t!==`up`&&e?.lastError?e.lastError:null].filter(Boolean).join(` · `);return(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs px-2 py-0.5 rounded-full ${n}`,title:i,children:[(0,M.jsx)(Er,{size:11}),r]})}function qs({hosting:e,dataDir:t,checked:n,onChange:r}){return(0,M.jsxs)(`span`,{className:`flex basis-full flex-col gap-1`,children:[(0,M.jsxs)(`label`,{className:`flex items-center gap-1 text-zinc-500`,title:`Kept by default: hosting the plugin on this agent again finds its data`,children:[(0,M.jsx)(`input`,{type:`checkbox`,checked:n,onChange:e=>r(e.target.checked)}),`also delete the agent half's data (purge)`]}),n&&(0,M.jsxs)(`span`,{className:`flex items-start gap-1 text-red-400`,children:[(0,M.jsx)(Hi,{size:11,className:`mt-0.5 shrink-0`}),(0,M.jsxs)(`span`,{children:[`Deletes `,t?(0,M.jsx)(`span`,{className:`font-mono`,children:t}):`its data directory`,` `,`and the agent half's service account on`,` `,(0,M.jsx)(`span`,{className:`font-mono`,children:e.agentLabel}),` — this cannot be undone.`]})]})]})}function Js({plugin:e,dataDir:t,onHost:n,onUnhost:r,onRotate:i,isActing:a}){let[o,s]=(0,g.useState)(!1),[c,l]=(0,g.useState)(!1),[u,d]=(0,g.useState)(!1),[f,p]=(0,g.useState)(!1),m=e.agentHosting,h=e.hooks?.agentHalf===!0,_=e.hooks?.approval===`pending`;return m?(0,M.jsxs)(`div`,{className:`rounded border border-zinc-800 bg-zinc-950/60 p-3 mb-4 text-xs`,children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 mb-2`,children:[(0,M.jsx)(Mi,{size:12,className:`text-cyan-400`}),(0,M.jsxs)(`span`,{className:`text-zinc-300`,children:[`Hosted on `,(0,M.jsx)(`span`,{className:`font-mono text-zinc-200`,children:m.agentLabel})]}),(0,M.jsxs)(`span`,{className:`text-zinc-500`,children:[`port `,(0,M.jsx)(`span`,{className:`font-mono`,children:m.port})]}),m.phase&&m.phase!==`active`?(0,M.jsxs)(`span`,{className:`text-cyan-400`,children:[m.phase,`…`]}):(0,M.jsx)(Ks,{health:m.health}),!m.secretAcknowledged&&(0,M.jsx)(`span`,{className:`text-zinc-500`,title:`The agent fetches it on its next sync`,children:`secret not yet fetched`}),m.rotationPending&&(0,M.jsx)(`span`,{className:`text-yellow-400`,children:`rotation pending`})]}),m.agentHalf&&(0,M.jsxs)(`p`,{className:`mb-2 text-zinc-500`,children:[`Agent half `,(0,M.jsx)(`span`,{className:`font-mono text-zinc-300`,children:m.agentHalf.version}),` `,`installed by Lamaste `,new Date(m.agentHalf.installedAt).toLocaleString()]}),(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,M.jsxs)(`button`,{type:`button`,disabled:a,onClick:()=>i(e.name),className:`flex items-center gap-1.5 rounded bg-zinc-700 px-2.5 py-1 text-zinc-300 hover:bg-zinc-600 disabled:opacity-50`,title:`Issue a new installation secret; the previous one stays accepted until the agent acknowledges the new one`,children:[(0,M.jsx)(ki,{size:11}),`Rotate secret`]}),c?(0,M.jsxs)(`span`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,M.jsx)(`span`,{className:`text-zinc-400`,children:h?`Run its uninstall hooks, then remove the agent half, tunnel, secret and capability?`:`Run its uninstall hooks, then remove tunnel, secret and capability?`}),(0,M.jsxs)(`label`,{className:`flex items-center gap-1 text-zinc-500`,title:`Go on when a pre-teardown hook fails or the agent does not answer (reported, audited)`,children:[(0,M.jsx)(`input`,{type:`checkbox`,checked:u,onChange:e=>d(e.target.checked)}),`force`]}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>{l(!1),r(e.name,{force:u,purge:h&&f},m),d(!1),p(!1)},className:`rounded bg-red-600 px-2 py-1 text-white hover:bg-red-500`,children:`Yes`}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>{l(!1),d(!1),p(!1)},className:`rounded bg-zinc-700 px-2 py-1 text-zinc-300 hover:bg-zinc-600`,children:`No`}),h&&(0,M.jsx)(qs,{hosting:m,dataDir:t,checked:f,onChange:p})]}):(0,M.jsxs)(`button`,{type:`button`,disabled:a,onClick:()=>l(!0),className:`flex items-center gap-1.5 rounded bg-zinc-700 px-2.5 py-1 text-zinc-300 hover:bg-zinc-600 disabled:opacity-50`,children:[(0,M.jsx)(H,{size:11}),`Clear hosting`]})]})]}):(0,M.jsxs)(`div`,{className:`rounded border border-zinc-800 bg-zinc-950/60 p-3 mb-4 text-xs`,children:[(0,M.jsx)(`p`,{className:`text-zinc-400 mb-2`,children:h?`Not hosted yet. Pick the agent it runs on: Lamaste installs the agent half there and runs the install hooks around creating the internal tunnel, assigning the port and issuing the installation secret.`:`Not hosted yet. Pick the agent that runs its agent half: Lamaste runs the plugin’s install hooks around creating the internal tunnel, assigning the port and issuing the installation secret.`}),(0,M.jsxs)(`button`,{type:`button`,disabled:a,onClick:()=>s(!0),title:_?`What it brings waits for approval (Lifecycle hooks)`:void 0,className:`flex items-center gap-1.5 rounded bg-cyan-600 px-3 py-1 text-white hover:bg-cyan-500 disabled:opacity-50`,children:[(0,M.jsx)(Mi,{size:11}),`Host on an agent…`]}),o&&(0,M.jsx)(zs,{plugin:e,onHost:n,onClose:()=>s(!1),isActing:a})]})}function Ys({plugin:e,onEnable:t,onDisable:n,onUninstall:r,onHost:i,onUnhost:a,onRotate:o,isActing:s}){let c=L(),l=e.hosting===`agent`,u=l&&e.agent!=null,d=e.agentHosting!=null&&e.hooks?.agentHalf===!0,f=P({queryKey:[`plugin-hooks`,e.name],queryFn:()=>c.getPluginHooks(e.name),enabled:e.hooks?.agentHalf===!0}).data?.hooks?.agentHalf?.dataDir??null,[p,m]=(0,g.useState)(!1),[h,_]=(0,g.useState)(!1),v=()=>{if(!p){m(!0);return}m(!1),r(e.name,{purge:d&&h},e.agentHosting),_(!1)};return(0,M.jsxs)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-5`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(Ci,{size:16,className:`text-cyan-400`}),(0,M.jsx)(`span`,{className:`text-white font-semibold`,children:e.displayName||e.name}),(0,M.jsxs)(`span`,{className:`text-zinc-500 text-xs`,children:[`v`,e.version]})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l&&(0,M.jsx)(Gs,{}),(0,M.jsx)(Ws,{status:e.status})]})]}),e.displayName&&(0,M.jsx)(`p`,{className:`text-zinc-500 text-xs font-mono mb-1`,children:e.name}),e.description&&(0,M.jsx)(`p`,{className:`text-zinc-400 text-sm mb-2`,children:e.description}),l&&!u&&(0,M.jsx)(`p`,{className:`text-zinc-500 text-xs mb-2`,children:`Runs on its own agent. Lamaste registers its OIDC clients and capabilities; it mounts no routes and serves no pages for it.`}),u&&(0,M.jsx)(`p`,{className:`text-zinc-500 text-xs mb-2`,children:`Runs on an agent; the panel forwards its admin API and pages to the agent half over an internal tunnel.`}),(0,M.jsxs)(`p`,{className:`text-zinc-500 text-xs mb-4`,children:[e.packageName,e.installedAt&&(0,M.jsxs)(`span`,{children:[` · Installed `,new Date(e.installedAt).toLocaleDateString()]}),e.panel?.pages?.length>0&&(0,M.jsxs)(`span`,{children:[` `,`· `,e.panel.pages.length,` page`,e.panel.pages.length>1?`s`:``]})]}),e.capabilities&&e.capabilities.length>0&&(0,M.jsx)(`div`,{className:`flex flex-wrap gap-1 mb-4`,children:e.capabilities.map(e=>(0,M.jsx)(`span`,{className:`text-xs bg-zinc-800 text-zinc-400 px-2 py-0.5 rounded`,children:e},e))}),l&&(0,M.jsx)(ms,{plugin:e.name}),(e.hooks?.relay||e.hooks?.agent||e.hooks?.agentHalf||e.hooks?.pendingUpdate)&&(0,M.jsx)(Ds,{plugin:e,isActing:s}),u&&(0,M.jsx)(Js,{plugin:e,dataDir:f,onHost:i,onUnhost:a,onRotate:o,isActing:s}),l&&(0,M.jsx)(Hs,{plugin:e,isActing:s}),(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[e.status===`disabled`?(0,M.jsxs)(`button`,{type:`button`,disabled:s,onClick:()=>t(e.name),className:`flex items-center gap-1.5 rounded bg-zinc-700 px-3 py-1.5 text-xs text-zinc-300 hover:bg-zinc-600 disabled:opacity-50 disabled:cursor-not-allowed`,children:[(0,M.jsx)(Oi,{size:12}),`Enable`]}):(0,M.jsxs)(`button`,{type:`button`,disabled:s,onClick:()=>n(e.name),className:`flex items-center gap-1.5 rounded bg-zinc-700 px-3 py-1.5 text-xs text-zinc-300 hover:bg-zinc-600 disabled:opacity-50 disabled:cursor-not-allowed`,children:[(0,M.jsx)(Di,{size:12}),`Disable`]}),l&&(0,M.jsx)(Os,{plugin:e,isActing:s}),p?(0,M.jsxs)(`span`,{className:`flex flex-wrap items-center gap-1.5 text-xs`,children:[(0,M.jsx)(`span`,{className:`text-zinc-400`,children:d?`Remove its hosting and agent half, then uninstall?`:`Uninstall?`}),(0,M.jsx)(`button`,{type:`button`,onClick:v,disabled:e.status===`enabled`,className:`rounded bg-red-600 px-2 py-1 text-white hover:bg-red-500 disabled:opacity-50 disabled:cursor-not-allowed`,children:`Yes`}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>{m(!1),_(!1)},className:`rounded bg-zinc-700 px-2 py-1 text-zinc-300 hover:bg-zinc-600`,children:`No`}),d&&(0,M.jsx)(qs,{hosting:e.agentHosting,dataDir:f,checked:h,onChange:_})]}):(0,M.jsxs)(`button`,{type:`button`,disabled:s||e.status===`enabled`,onClick:v,title:e.status===`enabled`?`Disable before uninstalling`:`Uninstall plugin`,className:`flex items-center gap-1.5 rounded bg-zinc-700 px-3 py-1.5 text-xs text-zinc-300 hover:bg-zinc-600 disabled:opacity-50 disabled:cursor-not-allowed`,children:[(0,M.jsx)(Vi,{size:12}),`Uninstall`]})]})]})}function Xs({onInstall:e,isInstalling:t}){let[n,r]=(0,g.useState)(``);return(0,M.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),n.trim()&&(e(n.trim()),r(``))},className:`flex items-end gap-3`,children:[(0,M.jsxs)(`div`,{className:`flex-1`,children:[(0,M.jsx)(`label`,{className:`block text-xs text-zinc-400 mb-1`,htmlFor:`package-name`,children:`Package name`}),(0,M.jsx)(`input`,{id:`package-name`,type:`text`,value:n,onChange:e=>r(e.target.value),placeholder:`@lamalibre/...`,className:`w-full rounded bg-zinc-800 border border-zinc-700 px-3 py-1.5 text-sm text-zinc-300 placeholder-zinc-600 focus:outline-none focus:border-cyan-400`})]}),(0,M.jsxs)(`button`,{type:`submit`,disabled:t||!n.trim(),className:`flex items-center gap-1.5 rounded bg-cyan-600 px-4 py-1.5 text-sm text-white hover:bg-cyan-500 disabled:opacity-50 disabled:cursor-not-allowed`,children:[(0,M.jsx)(Yr,{size:14}),`Install`]})]})}var Zs=[`install`,`update`,`uninstall`,`check-prerequisites`];function Qs({policy:e,onClose:t}){let n=L(),r=N(),i=U(),[a,o]=(0,g.useState)(e.name||``),[s,c]=(0,g.useState)(e.description||``),[l,u]=(0,g.useState)((e.allowedIps||[]).join(`
|
|
12
|
+
`)),[d,f]=(0,g.useState)((e.deniedIps||[]).join(`
|
|
13
|
+
`)),[p,m]=(0,g.useState)((e.allowedPlugins||[]).join(`
|
|
14
|
+
`)),[h,_]=(0,g.useState)(e.allowedActions||Zs.slice(0,3)),v=F({mutationFn:t=>n.updatePushInstallPolicy(e.id,t),onSuccess:()=>{r.invalidateQueries({queryKey:[`push-install-policies`]}),r.invalidateQueries({queryKey:[`push-install-config`]}),i(`Policy updated`),t()},onError:e=>i(G(e),`error`)}),y=e=>{e.preventDefault();let t=e=>e.split(`
|
|
15
|
+
`).map(e=>e.trim()).filter(Boolean);v.mutate({name:a,description:s,allowedIps:t(l),deniedIps:t(d),allowedPlugins:t(p),allowedActions:h})},b=e=>{_(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])};return(0,M.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/70`,children:(0,M.jsxs)(`div`,{className:`w-full max-w-lg rounded-xl bg-zinc-900 border border-zinc-700 p-6 shadow-xl`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,M.jsx)(`h3`,{className:`text-lg font-semibold text-white`,children:`Edit Policy`}),(0,M.jsx)(`button`,{type:`button`,onClick:t,className:`text-zinc-400 hover:text-white`,children:(0,M.jsx)(H,{size:20})})]}),(0,M.jsxs)(`form`,{onSubmit:y,className:`space-y-4`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`label`,{className:`block text-sm font-medium text-zinc-300 mb-1`,children:`Name`}),(0,M.jsx)(`input`,{type:`text`,value:a,onChange:e=>o(e.target.value),className:`w-full rounded bg-zinc-800 border border-zinc-700 px-3 py-2 text-sm text-zinc-200 focus:border-cyan-500 focus:outline-none`})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`label`,{className:`block text-sm font-medium text-zinc-300 mb-1`,children:`Description`}),(0,M.jsx)(`input`,{type:`text`,value:s,onChange:e=>c(e.target.value),className:`w-full rounded bg-zinc-800 border border-zinc-700 px-3 py-2 text-sm text-zinc-200 focus:border-cyan-500 focus:outline-none`})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`label`,{className:`block text-sm font-medium text-zinc-300 mb-1`,children:`Allowed IPs (one per line)`}),(0,M.jsx)(`textarea`,{value:l,onChange:e=>u(e.target.value),rows:3,placeholder:`192.168.1.0/24`,className:`w-full rounded bg-zinc-800 border border-zinc-700 px-3 py-2 text-sm text-zinc-200 font-mono placeholder-zinc-600 focus:border-cyan-500 focus:outline-none`})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`label`,{className:`block text-sm font-medium text-zinc-300 mb-1`,children:`Denied IPs (one per line)`}),(0,M.jsx)(`textarea`,{value:d,onChange:e=>f(e.target.value),rows:2,className:`w-full rounded bg-zinc-800 border border-zinc-700 px-3 py-2 text-sm text-zinc-200 font-mono focus:border-cyan-500 focus:outline-none`})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`label`,{className:`block text-sm font-medium text-zinc-300 mb-1`,children:`Allowed Plugins (one per line)`}),(0,M.jsx)(`textarea`,{value:p,onChange:e=>m(e.target.value),rows:2,placeholder:`@lamalibre/lamaste-herd-plugin`,className:`w-full rounded bg-zinc-800 border border-zinc-700 px-3 py-2 text-sm text-zinc-200 font-mono placeholder-zinc-600 focus:border-cyan-500 focus:outline-none`}),(0,M.jsxs)(`p`,{className:`mt-1 text-xs text-zinc-500`,children:[`For an agent half Lamaste installs, name its agent package (the manifest's`,` `,(0,M.jsx)(`span`,{className:`font-mono`,children:`agent.package`}),`). Empty allows every package.`]})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`label`,{className:`block text-sm font-medium text-zinc-300 mb-2`,children:`Allowed Actions`}),(0,M.jsx)(`div`,{className:`flex flex-wrap gap-3`,children:Zs.map(e=>(0,M.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,M.jsx)(`input`,{type:`checkbox`,checked:h.includes(e),onChange:()=>b(e),className:`accent-cyan-500`}),(0,M.jsx)(`span`,{className:`text-zinc-300`,children:e})]},e))})]}),(0,M.jsxs)(`div`,{className:`flex justify-end gap-3 pt-2`,children:[(0,M.jsx)(`button`,{type:`button`,onClick:t,className:`rounded bg-zinc-700 px-4 py-2 text-sm text-zinc-300 hover:bg-zinc-600`,children:`Cancel`}),(0,M.jsxs)(`button`,{type:`submit`,disabled:!a.trim()||v.isPending,className:`rounded bg-cyan-600 px-4 py-2 text-sm font-semibold text-white hover:bg-cyan-500 disabled:opacity-50`,children:[v.isPending?(0,M.jsx)(B,{size:14,className:`animate-spin inline mr-1`}):null,`Save Changes`]})]})]})]})})}function $s(){let e=L(),t=N(),n=U(),[r,i]=(0,g.useState)(null),a=P({queryKey:[`push-install-policies`],queryFn:()=>e.getPushInstallPolicies(),refetchInterval:3e4}),o=F({mutationFn:t=>e.deletePushInstallPolicy(t),onSuccess:()=>{t.invalidateQueries({queryKey:[`push-install-policies`]}),t.invalidateQueries({queryKey:[`push-install-config`]}),n(`Policy deleted`)},onError:e=>n(G(e),`error`)}),s=a.data?.policies||[];return a.isLoading||s.length===0?null:(0,M.jsxs)(`div`,{children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2 mb-3`,children:[(0,M.jsx)(Li,{size:14,className:`text-cyan-400`}),(0,M.jsx)(`h3`,{className:`text-sm font-semibold text-zinc-300`,children:`Policies`})]}),(0,M.jsx)(`div`,{className:`overflow-x-auto rounded-lg border border-zinc-800`,children:(0,M.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,M.jsx)(`thead`,{children:(0,M.jsxs)(`tr`,{className:`border-b border-zinc-700 bg-zinc-900`,children:[(0,M.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400`,children:`Name`}),(0,M.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400 hidden md:table-cell`,children:`Description`}),(0,M.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400 hidden lg:table-cell`,children:`Actions`}),(0,M.jsx)(`th`,{className:`px-4 py-3 text-right text-xs font-medium uppercase text-zinc-400`,children:`Manage`})]})}),(0,M.jsx)(`tbody`,{children:s.map(e=>(0,M.jsxs)(`tr`,{className:`border-b border-zinc-700 bg-zinc-800`,children:[(0,M.jsx)(`td`,{className:`px-4 py-3 text-zinc-200 font-semibold`,children:e.name}),(0,M.jsx)(`td`,{className:`px-4 py-3 text-zinc-400 hidden md:table-cell`,children:e.description||`—`}),(0,M.jsx)(`td`,{className:`px-4 py-3 hidden lg:table-cell`,children:(0,M.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:(e.allowedActions||[]).map(e=>(0,M.jsx)(`span`,{className:`text-xs px-1.5 py-0.5 rounded bg-zinc-700 text-zinc-300`,children:e},e))})}),(0,M.jsx)(`td`,{className:`px-4 py-3 text-right`,children:(0,M.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,M.jsx)(`button`,{type:`button`,onClick:()=>i(e),className:`inline-flex items-center gap-1.5 rounded bg-zinc-700 px-2.5 py-1.5 text-xs text-zinc-300 hover:bg-zinc-600`,title:`Edit policy`,children:(0,M.jsx)(wi,{size:12})}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>o.mutate(e.id),disabled:o.isPending,className:`inline-flex items-center gap-1.5 rounded bg-zinc-700 px-2.5 py-1.5 text-xs text-zinc-300 hover:bg-red-600/20 hover:text-red-400`,title:`Delete policy`,children:(0,M.jsx)(Vi,{size:12})})]})})]},e.id))})]})}),r&&(0,M.jsx)(Qs,{policy:r,onClose:()=>i(null)})]})}function ec(){let e=L(),t=N(),n=U(),{reveal:r}=da(),i=P({queryKey:[`plugins`],queryFn:()=>e.getPlugins(),refetchInterval:1e4}),a=F({mutationFn:async t=>{let{result:n,secrets:i}=ra(await e.installPlugin(t));return r({plugin:n.plugin?.name??t,cause:`install`,secrets:i}),n},onSuccess:e=>{t.invalidateQueries({queryKey:[`plugins`]}),n(`Plugin "${e.plugin?.name||`unknown`}" installed`)},onError:e=>n(G(e),`error`)}),o=F({mutationFn:async t=>{let{result:n,secrets:i}=ra(await e.enablePlugin(t));return r({plugin:t,cause:`enable`,secrets:i}),n},onSuccess:e=>{let r=i.data?.plugins?.find(t=>t.name===e.name);t.invalidateQueries({queryKey:[`plugins`]}),n(r?.hosting===`agent`?`Plugin "${e.name}" enabled (agent-hosted — nothing to mount)`:`Plugin "${e.name}" enabled (restart panel to mount routes)`)},onError:e=>n(G(e),`error`)}),s=F({mutationFn:t=>e.disablePlugin(t),onSuccess:e=>{t.invalidateQueries({queryKey:[`plugins`]}),n(`Plugin "${e.name}" disabled`)},onError:e=>n(G(e),`error`)}),c=(e,{hosting:t})=>n(cs(e,{agentLabel:t?.agentLabel,action:`uninstall`}),`error`),l=F({mutationFn:({name:t,purge:n})=>e.uninstallPlugin(t,{purge:n}),onSuccess:(e,{name:r,purge:i})=>{t.invalidateQueries({queryKey:[`plugins`]}),e.operation?(t.invalidateQueries({queryKey:[`plugin-operations`,r]}),n(`Uninstalling "${r}": its hosting is removed first${i?`, with its agent half’s data`:``} — follow the steps on its card`)):n(`Plugin "${e.name}" uninstalled`)},onError:c}),u=F({mutationFn:({name:t,agentLabel:n})=>e.setPluginHosting(t,n),onSuccess:(e,{name:r,agentLabel:i})=>{t.invalidateQueries({queryKey:[`plugin-operations`,r]}),n(`Hosting "${r}" on ${i} — follow the steps on its card`)}}),d=F({mutationFn:({name:t,force:n,purge:r})=>e.clearPluginHosting(t,{force:n,purge:r}),onSuccess:(e,{name:r,purge:i})=>{t.invalidateQueries({queryKey:[`plugin-operations`,r]}),n(`Removing the hosting of "${r}"${i?` and its agent half’s data`:``} — follow the steps on its card`)},onError:c}),f=F({mutationFn:t=>e.rotatePluginHostingSecret(t),onSuccess:()=>{t.invalidateQueries({queryKey:[`plugins`]}),n(`New installation secret issued — the agent picks it up on its next sync`)},onError:e=>n(G(e),`error`)}),p=a.isPending||o.isPending||s.isPending||l.isPending||u.isPending||d.isPending||f.isPending,m=(0,g.useCallback)(e=>a.mutate(e),[a]),h=(0,g.useCallback)(e=>o.mutate(e),[o]),_=(0,g.useCallback)(e=>s.mutate(e),[s]),v=(0,g.useCallback)((e,t={},n=null)=>l.mutate({name:e,purge:t.purge===!0,hosting:n}),[l]),y=(0,g.useCallback)((e,t,n)=>u.mutate({name:e,agentLabel:t},n),[u]),b=(0,g.useCallback)((e,t={},n=null)=>d.mutate({name:e,force:t.force===!0,purge:t.purge===!0,hosting:n}),[d]),x=(0,g.useCallback)(e=>f.mutate(e),[f]),S=i.data?.plugins,C=i.data?.retainedData??[],w=new Set((S??[]).map(e=>e.name));return(0,M.jsxs)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:[(0,M.jsxs)(`div`,{className:`mb-6`,children:[(0,M.jsx)(`h1`,{className:`text-xl font-bold text-white`,children:`Plugins`}),(0,M.jsx)(`p`,{className:`text-zinc-500 text-sm mt-1`,children:`Install, enable, and manage plugins`})]}),(0,M.jsxs)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-5 mb-8`,children:[(0,M.jsx)(`h2`,{className:`text-sm font-semibold text-zinc-300 mb-4`,children:`Install Plugin`}),(0,M.jsx)(Xs,{onInstall:m,isInstalling:a.isPending}),a.isPending&&(0,M.jsx)(`p`,{className:`text-xs text-zinc-500 mt-2`,children:`Installing...`})]}),i.isLoading?(0,M.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:Array.from({length:2}).map((e,t)=>(0,M.jsx)(`div`,{className:`h-40 animate-pulse rounded-lg bg-zinc-900 border border-zinc-800`},t))}):i.isError?(0,M.jsx)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-6`,children:(0,M.jsxs)(`div`,{className:`flex items-center gap-2 text-red-400 text-sm`,children:[(0,M.jsx)(Br,{size:16}),`Failed to load plugins`]})}):S?.length===0?(0,M.jsx)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-6`,children:(0,M.jsx)(`p`,{className:`text-zinc-500 text-sm text-center`,children:`No plugins installed. Use the form above to install one.`})}):(0,M.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:S?.map(e=>(0,M.jsx)(Ys,{plugin:e,onEnable:h,onDisable:_,onUninstall:v,onHost:y,onUnhost:b,onRotate:x,isActing:p},e.name))}),(0,M.jsx)(Us,{records:C,installedNames:w,isActing:p}),(0,M.jsx)(Fs,{children:(0,M.jsx)($s,{})})]})}function tc(e){let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/1e3),r=Math.floor(n/60),i=Math.floor(r/60),a=Math.floor(i/24);return a>30?new Date(e).toLocaleDateString():a>0?`${a}d ago`:i>0?`${i}h ago`:r>0?`${r}m ago`:`just now`}var nc=/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/;function rc(e){return e?e.length>63?`Max 63 characters`:nc.test(e)?null:`Lowercase letters, numbers, and hyphens only. Cannot start or end with a hyphen.`:`Subdomain is required`}var ic={default:10,min:1,max:10240};function ac(e){let t=Number(e);return e===``||!Number.isInteger(t)?`Must be a whole number of MiB`:t<ic.min?`Minimum ${ic.min}`:t>ic.max?`Maximum ${ic.max}`:null}function oc(e){return e.maxBodySizeMb??1}var sc=[{value:`restricted`,label:`Restricted`,desc:`Only granted users and groups`},{value:`authenticated`,label:`All Authelia Users`,desc:`Any authenticated user can access`},{value:`public`,label:`Public`,desc:`No authentication required`}],cc=[3100,9090,9091,9292,9294];function lc(e){let t=Number(e);return!e&&e!==0?`Port is required`:Number.isInteger(t)?t<1024?`Minimum 1024`:t>65535?`Maximum 65535`:cc.includes(t)?`Reserved for a Lamaste service on the relay`:null:`Must be an integer`}function uc(){let e=L(),t=P({queryKey:[`admin-agents`],queryFn:()=>e.getAgents()});return{agents:(t.data?.agents||[]).filter(e=>!e.revoked&&e.certType!==`plugin-agent`).map(e=>e.label).sort(),isLoading:t.isLoading}}function dc({domain:e,onClose:t}){let n=L(),r=N(),i=U(),[a,o]=(0,g.useState)(``),[s,c]=(0,g.useState)(``),[l,u]=(0,g.useState)(``),[d,f]=(0,g.useState)(`restricted`),[p,m]=(0,g.useState)(``),[h,_]=(0,g.useState)(String(ic.default)),{agents:v,isLoading:y}=uc(),[b,x]=(0,g.useState)({}),[S,C]=(0,g.useState)(null),w=F({mutationFn:e=>n.createTunnel(e),onSuccess:e=>{r.invalidateQueries({queryKey:[`tunnels`]}),i(`Tunnel ${e.tunnel.fqdn} created`),t()},onError:e=>{C(G(e))}}),T=(0,g.useCallback)(e=>{e.preventDefault(),C(null);let t=rc(a),n=lc(s),r={};t&&(r.subdomain=t),n&&(r.port=n),p||(r.agentLabel=`Choose the agent that carries this tunnel`);let i=ac(h);if(i&&(r.maxBody=i),Object.keys(r).length>0){x(r);return}x({}),w.mutate({subdomain:a,port:Number(s),description:l||void 0,accessMode:d,agentLabel:p,maxBodySizeMb:Number(h)})},[a,s,l,d,p,h,w]);return(0,M.jsxs)(`div`,{className:`bg-zinc-900 border border-zinc-800 rounded-lg p-5 mb-6`,children:[(0,M.jsxs)(`h2`,{className:`text-sm font-semibold text-zinc-300 mb-4 flex items-center gap-2`,children:[(0,M.jsx)(Ei,{size:14,className:`text-cyan-400`}),`Add Tunnel`]}),(0,M.jsxs)(`form`,{onSubmit:T,className:`space-y-4`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`label`,{className:`block text-xs text-zinc-400 mb-1`,children:`Subdomain`}),(0,M.jsxs)(`div`,{className:`flex items-center gap-0`,children:[(0,M.jsx)(`input`,{type:`text`,value:a,onChange:e=>{o(e.target.value.toLowerCase()),x(e=>({...e,subdomain:void 0}))},disabled:w.isPending,placeholder:`myapp`,className:`flex-1 rounded-l bg-zinc-800 border border-zinc-700 px-3 py-2 text-sm text-zinc-200 font-mono placeholder:text-zinc-600 focus:outline-none focus:border-cyan-400 disabled:opacity-50`}),(0,M.jsxs)(`span`,{className:`rounded-r bg-zinc-800/60 border border-l-0 border-zinc-700 px-3 py-2 text-sm text-zinc-500 font-mono`,children:[`.`,e]})]}),b.subdomain&&(0,M.jsx)(`p`,{className:`text-red-400 text-xs mt-1`,children:b.subdomain})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`label`,{className:`block text-xs text-zinc-400 mb-1`,children:`Port`}),(0,M.jsx)(`input`,{type:`number`,value:s,onChange:e=>{c(e.target.value),x(e=>({...e,port:void 0}))},disabled:w.isPending,placeholder:`8080`,min:1024,max:65535,className:`w-40 rounded bg-zinc-800 border border-zinc-700 px-3 py-2 text-sm text-zinc-200 font-mono placeholder:text-zinc-600 focus:outline-none focus:border-cyan-400 disabled:opacity-50`}),b.port&&(0,M.jsx)(`p`,{className:`text-red-400 text-xs mt-1`,children:b.port})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`label`,{className:`block text-xs text-zinc-400 mb-1`,children:`Agent`}),(0,M.jsxs)(`select`,{value:p,onChange:e=>{m(e.target.value),x(e=>({...e,agentLabel:void 0}))},disabled:w.isPending||y,className:`w-64 rounded bg-zinc-800 border border-zinc-700 px-3 py-2 text-sm text-zinc-200 font-mono focus:outline-none focus:border-cyan-400 disabled:opacity-50`,children:[(0,M.jsx)(`option`,{value:``,children:y?`Loading agents…`:`Select an agent`}),v.map(e=>(0,M.jsx)(`option`,{value:e,children:e},e))]}),(0,M.jsx)(`p`,{className:`text-xs text-zinc-500 mt-1`,children:`Only this agent forwards the port. It starts carrying the tunnel within 30 seconds.`}),!y&&v.length===0&&(0,M.jsx)(`p`,{className:`text-yellow-400 text-xs mt-1`,children:`No agents enrolled yet — enroll one under Certificates first.`}),b.agentLabel&&(0,M.jsx)(`p`,{className:`text-red-400 text-xs mt-1`,children:b.agentLabel})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`label`,{className:`block text-xs text-zinc-400 mb-1`,children:`Largest request body (MiB)`}),(0,M.jsx)(`input`,{type:`number`,value:h,onChange:e=>{_(e.target.value),x(e=>({...e,maxBody:void 0}))},disabled:w.isPending,min:ic.min,max:ic.max,className:`w-40 rounded bg-zinc-800 border border-zinc-700 px-3 py-2 text-sm text-zinc-200 font-mono focus:outline-none focus:border-cyan-400 disabled:opacity-50`}),(0,M.jsx)(`p`,{className:`text-xs text-zinc-500 mt-1`,children:`Larger uploads are rejected with 413. Raise it for apps that accept big files.`}),b.maxBody&&(0,M.jsx)(`p`,{className:`text-red-400 text-xs mt-1`,children:b.maxBody})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsxs)(`label`,{className:`block text-xs text-zinc-400 mb-1`,children:[`Description `,(0,M.jsx)(`span`,{className:`text-zinc-600`,children:`(optional)`})]}),(0,M.jsx)(`input`,{type:`text`,value:l,onChange:e=>u(e.target.value),disabled:w.isPending,placeholder:`My web application`,maxLength:200,className:`w-full rounded bg-zinc-800 border border-zinc-700 px-3 py-2 text-sm text-zinc-200 placeholder:text-zinc-600 focus:outline-none focus:border-cyan-400 disabled:opacity-50`})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`label`,{className:`block text-xs text-zinc-400 mb-2`,children:`Access`}),(0,M.jsx)(`div`,{className:`space-y-2`,children:sc.map(e=>(0,M.jsxs)(`label`,{className:`flex items-start gap-2 cursor-pointer`,children:[(0,M.jsx)(`input`,{type:`radio`,name:`accessMode`,value:e.value,checked:d===e.value,onChange:e=>f(e.target.value),disabled:w.isPending,className:`mt-1 text-cyan-500 focus:ring-cyan-500 bg-zinc-800 border-zinc-700`}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`span`,{className:`text-sm text-zinc-200`,children:e.label}),(0,M.jsx)(`p`,{className:`text-xs text-zinc-500`,children:e.desc})]})]},e.value))})]}),S&&(0,M.jsx)(`div`,{className:`rounded bg-red-500/10 border border-red-500/20 px-3 py-2 text-sm text-red-400`,children:S}),(0,M.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,M.jsx)(`button`,{type:`submit`,disabled:w.isPending,className:`flex items-center gap-2 rounded bg-cyan-600 px-4 py-2 text-sm font-semibold text-white hover:bg-cyan-500 disabled:opacity-50 disabled:cursor-not-allowed`,children:w.isPending?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(B,{size:14,className:`animate-spin`}),`Setting up tunnel...`]}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(Ei,{size:14}),`Add Tunnel`]})}),(0,M.jsx)(`button`,{type:`button`,onClick:t,disabled:w.isPending,className:`rounded bg-zinc-700 px-4 py-2 text-sm text-zinc-300 hover:bg-zinc-600 disabled:opacity-50`,children:`Cancel`})]})]})]})}function fc({tunnel:e,onConfirm:t,onCancel:n,isPending:r}){return(0,M.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60`,children:(0,M.jsxs)(`div`,{className:`bg-zinc-900 border border-zinc-800 rounded-lg p-6 max-w-md w-full mx-4 shadow-xl`,children:[(0,M.jsx)(`h3`,{className:`text-lg font-semibold text-white mb-2`,children:`Delete Tunnel`}),(0,M.jsxs)(`p`,{className:`text-zinc-400 text-sm mb-6`,children:[`Are you sure you want to delete`,` `,(0,M.jsx)(`span`,{className:`text-cyan-400 font-mono`,children:e.fqdn}),`? This will remove the nginx configuration and TLS certificate mapping.`]}),(0,M.jsxs)(`div`,{className:`flex items-center justify-end gap-3`,children:[(0,M.jsx)(`button`,{type:`button`,onClick:n,disabled:r,className:`rounded bg-zinc-700 px-4 py-2 text-sm text-zinc-300 hover:bg-zinc-600 disabled:opacity-50`,children:`Cancel`}),(0,M.jsx)(`button`,{type:`button`,onClick:t,disabled:r,className:`flex items-center gap-2 rounded bg-red-600 px-4 py-2 text-sm font-semibold text-white hover:bg-red-500 disabled:opacity-50`,children:r?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(B,{size:14,className:`animate-spin`}),`Deleting...`]}):`Delete`})]})]})})}function pc({tunnel:e,onConfirm:t,onCancel:n,isPending:r}){let{agents:i,isLoading:a}=uc(),[o,s]=(0,g.useState)(e.agentLabel||``),[c,l]=(0,g.useState)(e.accessMode||`restricted`),u=oc(e),[d,f]=(0,g.useState)(String(u)),p=ac(d),m={};o&&o!==e.agentLabel&&(m.agentLabel=o),c!==(e.accessMode||`restricted`)&&(m.accessMode=c),!p&&Number(d)!==u&&(m.maxBodySizeMb=Number(d));let h=Object.keys(m).length>0;return(0,M.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60`,children:(0,M.jsxs)(`div`,{className:`bg-zinc-900 border border-zinc-800 rounded-lg p-6 max-w-md w-full mx-4 shadow-xl`,children:[(0,M.jsx)(`h3`,{className:`text-lg font-semibold text-white mb-1`,children:`Edit Tunnel`}),(0,M.jsx)(`p`,{className:`text-cyan-400 font-mono text-sm mb-5`,children:e.fqdn}),(0,M.jsx)(`label`,{className:`block text-xs text-zinc-400 mb-1`,children:`Agent`}),(0,M.jsxs)(`select`,{value:o,onChange:e=>s(e.target.value),disabled:r||a,className:`w-full rounded bg-zinc-800 border border-zinc-700 px-3 py-2 text-sm text-zinc-200 font-mono focus:outline-none focus:border-cyan-400 disabled:opacity-50`,children:[!e.agentLabel&&(0,M.jsx)(`option`,{value:``,children:`Unassigned — select an agent`}),i.map(e=>(0,M.jsx)(`option`,{value:e,children:e},e))]}),m.agentLabel&&(0,M.jsxs)(`p`,{className:`text-xs text-zinc-500 mt-1`,children:[e.agentLabel?`Both agents pick`:`${m.agentLabel} picks`,` the change up within 30 seconds.`]}),(0,M.jsx)(`label`,{className:`block text-xs text-zinc-400 mt-4 mb-2`,children:`Access`}),(0,M.jsx)(`div`,{className:`space-y-2`,children:sc.map(e=>(0,M.jsxs)(`label`,{className:`flex items-start gap-2 cursor-pointer`,children:[(0,M.jsx)(`input`,{type:`radio`,name:`editAccessMode`,value:e.value,checked:c===e.value,onChange:e=>l(e.target.value),disabled:r,className:`mt-1 text-cyan-500 focus:ring-cyan-500 bg-zinc-800 border-zinc-700`}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`span`,{className:`text-sm text-zinc-200`,children:e.label}),(0,M.jsx)(`p`,{className:`text-xs text-zinc-500`,children:e.desc})]})]},e.value))}),(0,M.jsx)(`label`,{className:`block text-xs text-zinc-400 mt-4 mb-1`,children:`Largest request body (MiB)`}),(0,M.jsx)(`input`,{type:`number`,value:d,onChange:e=>f(e.target.value),disabled:r,min:ic.min,max:ic.max,className:`w-40 rounded bg-zinc-800 border border-zinc-700 px-3 py-2 text-sm text-zinc-200 font-mono focus:outline-none focus:border-cyan-400 disabled:opacity-50`}),p&&(0,M.jsx)(`p`,{className:`text-red-400 text-xs mt-1`,children:p}),(0,M.jsxs)(`div`,{className:`flex items-center justify-end gap-3 mt-6`,children:[(0,M.jsx)(`button`,{type:`button`,onClick:n,disabled:r,className:`rounded bg-zinc-700 px-4 py-2 text-sm text-zinc-300 hover:bg-zinc-600 disabled:opacity-50`,children:`Cancel`}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>t(m),disabled:r||!h||!!p,className:`flex items-center gap-2 rounded bg-cyan-600 px-4 py-2 text-sm font-semibold text-white hover:bg-cyan-500 disabled:opacity-50`,children:r?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(B,{size:14,className:`animate-spin`}),`Saving...`]}):`Save`})]})]})})}function mc({tunnel:e}){return(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs px-2 py-0.5 rounded-full bg-cyan-500/10 text-cyan-400`,title:`Internal tunnel of an agent-hosted plugin: no hostname, no certificate, reachable only by the panel's forwarder`,children:[`plugin:`,e.pluginRoute||`?`]})}function hc({tunnel:e}){return e.agentLabel?(0,M.jsx)(`span`,{className:`text-sm text-zinc-300 font-mono`,children:e.agentLabel}):(0,M.jsx)(`span`,{className:`inline-block px-2 py-0.5 rounded text-xs bg-red-500/10 text-red-400`,title:`No agent carries this tunnel. Move it to an agent to bring it back.`,children:`unassigned`})}function gc({tunnels:e,onDelete:t,onToggle:n,onEdit:r}){return(0,M.jsx)(`div`,{className:`hidden md:block overflow-x-auto`,children:(0,M.jsxs)(`table`,{className:`w-full`,children:[(0,M.jsx)(`thead`,{children:(0,M.jsxs)(`tr`,{className:`border-b border-zinc-700`,children:[(0,M.jsx)(`th`,{className:`text-left text-zinc-400 text-xs uppercase font-semibold py-3 px-4`,children:`Status`}),(0,M.jsx)(`th`,{className:`text-left text-zinc-400 text-xs uppercase font-semibold py-3 px-4`,children:`Subdomain`}),(0,M.jsx)(`th`,{className:`text-left text-zinc-400 text-xs uppercase font-semibold py-3 px-4`,children:`FQDN`}),(0,M.jsx)(`th`,{className:`text-left text-zinc-400 text-xs uppercase font-semibold py-3 px-4`,children:`Port`}),(0,M.jsx)(`th`,{className:`text-left text-zinc-400 text-xs uppercase font-semibold py-3 px-4`,children:`Agent`}),(0,M.jsx)(`th`,{className:`text-left text-zinc-400 text-xs uppercase font-semibold py-3 px-4`,children:`Access`}),(0,M.jsx)(`th`,{className:`text-left text-zinc-400 text-xs uppercase font-semibold py-3 px-4`,children:`Body limit`}),(0,M.jsx)(`th`,{className:`text-left text-zinc-400 text-xs uppercase font-semibold py-3 px-4`,children:`Description`}),(0,M.jsx)(`th`,{className:`text-left text-zinc-400 text-xs uppercase font-semibold py-3 px-4`,children:`Created`}),(0,M.jsx)(`th`,{className:`text-right text-zinc-400 text-xs uppercase font-semibold py-3 px-4`,children:`Actions`})]})}),(0,M.jsx)(`tbody`,{children:e.map(e=>{let i=e.enabled!==!1,a=e.exposure===`internal`;return(0,M.jsxs)(`tr`,{className:`border-b border-zinc-700 ${i?`bg-zinc-800/50`:`bg-zinc-800/20 opacity-60`}`,children:[(0,M.jsx)(`td`,{className:`py-3 px-4`,children:(0,M.jsx)(`span`,{className:`text-xs px-2 py-0.5 rounded-full border ${i?`text-green-400 bg-green-500/10 border-green-500/20`:`text-zinc-500 bg-zinc-800 border-zinc-700`}`,children:i?`active`:`disabled`})}),(0,M.jsx)(`td`,{className:`py-3 px-4 text-sm text-zinc-200 font-mono`,children:a?(0,M.jsx)(mc,{tunnel:e}):e.subdomain}),(0,M.jsx)(`td`,{className:`py-3 px-4 text-sm`,children:a?(0,M.jsx)(`span`,{className:`text-zinc-500`,children:`relay loopback only`}):(0,M.jsxs)(`a`,{href:`https://${e.fqdn}`,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 ${i?`text-cyan-400 hover:text-cyan-300`:`text-zinc-500`}`,children:[e.fqdn,(0,M.jsx)(Zr,{size:12})]})}),(0,M.jsx)(`td`,{className:`py-3 px-4 text-sm text-zinc-200 font-mono`,children:e.port}),(0,M.jsx)(`td`,{className:`py-3 px-4`,children:(0,M.jsx)(hc,{tunnel:e})}),(0,M.jsxs)(`td`,{className:`py-3 px-4 text-sm`,children:[a&&(0,M.jsx)(`span`,{className:`inline-block px-2 py-0.5 rounded text-xs bg-zinc-700/60 text-zinc-300`,children:`Internal`}),e.type!==`panel`&&!a&&(0,M.jsx)(`span`,{className:`inline-block px-2 py-0.5 rounded text-xs ${e.accessMode===`public`?`bg-green-500/10 text-green-400`:e.accessMode===`authenticated`?`bg-blue-500/10 text-blue-400`:`bg-orange-500/10 text-orange-400`}`,children:e.accessMode===`public`?`Public`:e.accessMode===`authenticated`?`All Users`:`Restricted`})]}),(0,M.jsx)(`td`,{className:`py-3 px-4 text-sm text-zinc-400 font-mono`,children:e.type===`panel`?`—`:`${oc(e)} MiB`}),(0,M.jsx)(`td`,{className:`py-3 px-4 text-sm text-zinc-400`,children:e.description||`—`}),(0,M.jsx)(`td`,{className:`py-3 px-4 text-sm text-zinc-500`,children:tc(e.createdAt)}),(0,M.jsx)(`td`,{className:`py-3 px-4 text-right`,children:a?(0,M.jsx)(`span`,{className:`text-xs text-zinc-500`,title:`Managed with the plugin's hosting`,children:`managed by plugin hosting`}):(0,M.jsxs)(`div`,{className:`inline-flex items-center gap-2`,children:[e.type!==`panel`&&(0,M.jsxs)(`button`,{type:`button`,onClick:()=>r(e),className:`inline-flex items-center gap-1.5 rounded bg-zinc-700 px-2.5 py-1.5 text-xs text-zinc-300 hover:bg-zinc-600`,title:`Agent, access mode, body limit`,children:[(0,M.jsx)(Ni,{size:12}),`Edit`]}),(0,M.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:`inline-flex items-center gap-1.5 rounded bg-zinc-700 px-2.5 py-1.5 text-xs hover:bg-zinc-600 ${i?`text-yellow-400`:`text-green-400`}`,title:i?`Disable tunnel`:`Enable tunnel`,children:[(0,M.jsx)(Oi,{size:12}),i?`Disable`:`Enable`]}),(0,M.jsxs)(`button`,{type:`button`,onClick:()=>t(e),className:`inline-flex items-center gap-1.5 rounded bg-zinc-700 px-2.5 py-1.5 text-xs text-red-400 hover:bg-red-600/20 hover:text-red-300`,children:[(0,M.jsx)(Vi,{size:12}),`Delete`]})]})})]},e.id)})})]})})}function _c({tunnels:e,onDelete:t,onToggle:n,onEdit:r}){return(0,M.jsx)(`div`,{className:`md:hidden space-y-3`,children:e.map(e=>{let i=e.enabled!==!1,a=e.exposure===`internal`;return(0,M.jsxs)(`div`,{className:`border border-zinc-700 rounded-lg p-4 ${i?`bg-zinc-800/50`:`bg-zinc-800/20 opacity-60`}`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`span`,{className:`text-xs px-2 py-0.5 rounded-full border ${i?`text-green-400 bg-green-500/10 border-green-500/20`:`text-zinc-500 bg-zinc-800 border-zinc-700`}`,children:i?`active`:`disabled`}),(0,M.jsx)(`span`,{className:`text-sm font-semibold text-zinc-200 font-mono`,children:a?(0,M.jsx)(mc,{tunnel:e}):e.subdomain})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.type!==`panel`&&!a&&(0,M.jsx)(`button`,{type:`button`,onClick:()=>r(e),className:`text-xs text-zinc-300`,title:`Agent, access mode, body limit`,children:(0,M.jsx)(Ni,{size:14})}),!a&&(0,M.jsx)(`button`,{type:`button`,onClick:()=>n(e),className:`text-xs ${i?`text-yellow-400`:`text-green-400`}`,children:(0,M.jsx)(Oi,{size:14})}),!a&&(0,M.jsx)(`button`,{type:`button`,onClick:()=>t(e),className:`inline-flex items-center gap-1 text-xs text-red-400 hover:text-red-300`,children:(0,M.jsx)(Vi,{size:12})})]})]}),a?(0,M.jsx)(`p`,{className:`text-sm text-zinc-500 mb-1`,children:`Relay loopback only — managed by plugin hosting`}):(0,M.jsxs)(`a`,{href:`https://${e.fqdn}`,target:`_blank`,rel:`noopener noreferrer`,className:`text-sm inline-flex items-center gap-1 mb-1 ${i?`text-cyan-400 hover:text-cyan-300`:`text-zinc-500`}`,children:[e.fqdn,(0,M.jsx)(Zr,{size:12})]}),(0,M.jsxs)(`div`,{className:`flex items-center gap-4 text-xs text-zinc-500 mt-2`,children:[(0,M.jsxs)(`span`,{children:[`Port: `,(0,M.jsx)(`span`,{className:`text-zinc-300 font-mono`,children:e.port})]}),(0,M.jsxs)(`span`,{children:[`Agent: `,(0,M.jsx)(hc,{tunnel:e})]}),(0,M.jsx)(`span`,{children:tc(e.createdAt)})]}),e.description&&(0,M.jsx)(`p`,{className:`text-xs text-zinc-400 mt-2`,children:e.description})]},e.id)})})}function K(){let e=L(),t=N(),n=U(),[r,i]=(0,g.useState)(!1),[a,o]=(0,g.useState)(null),[s,c]=(0,g.useState)(null),l=P({queryKey:[`tunnels`],queryFn:()=>e.getTunnels(),refetchInterval:1e4}),u=P({queryKey:[`tunnel-agent-config`],queryFn:()=>e.getTunnelAgentConfig()}).data?.domain,d=F({mutationFn:t=>e.deleteTunnel(t),onSuccess:()=>{t.invalidateQueries({queryKey:[`tunnels`]}),n(`Tunnel ${a.fqdn} deleted`),o(null)},onError:e=>{n(G(e),`error`),o(null)}}),f=F({mutationFn:({id:t,enabled:n})=>e.updateTunnel(t,{enabled:n}),onSuccess:e=>{t.invalidateQueries({queryKey:[`tunnels`]});let r=e.tunnel;n(`Tunnel ${r.fqdn} ${r.enabled?`enabled`:`disabled`}`)},onError:e=>{n(G(e),`error`)}}),p=F({mutationFn:({id:t,changes:n})=>e.updateTunnel(t,n),onSuccess:e=>{t.invalidateQueries({queryKey:[`tunnels`]}),n(`Tunnel ${e.tunnel.fqdn} updated`),c(null)},onError:e=>{n(G(e),`error`),c(null)}}),m=(0,g.useCallback)(e=>{c(e)},[]),h=(0,g.useCallback)(e=>{o(e)},[]),_=(0,g.useCallback)(e=>{let t=e.enabled!==!1;f.mutate({id:e.id,enabled:!t})},[f]),v=(0,g.useCallback)(()=>{a&&d.mutate(a.id)},[a,d]),y=l.data?.tunnels||[];return(0,M.jsxs)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:[(0,M.jsxs)(`div`,{className:`mb-6 flex items-center justify-between`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h1`,{className:`text-xl font-bold text-white`,children:`Tunnels`}),(0,M.jsx)(`p`,{className:`text-zinc-500 text-sm mt-1`,children:`Manage reverse tunnel configurations`})]}),!r&&(0,M.jsxs)(`button`,{type:`button`,onClick:()=>i(!0),className:`flex items-center gap-2 rounded bg-cyan-600 px-4 py-2 text-sm font-semibold text-white hover:bg-cyan-500`,children:[(0,M.jsx)(Ei,{size:14}),`Add Tunnel`]})]}),r&&u&&(0,M.jsx)(dc,{domain:u,onClose:()=>i(!1)}),l.isLoading?(0,M.jsx)(`div`,{className:`space-y-3`,children:Array.from({length:3}).map((e,t)=>(0,M.jsx)(`div`,{className:`h-16 animate-pulse rounded-lg bg-zinc-900 border border-zinc-800`},t))}):l.isError?(0,M.jsx)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-6`,children:(0,M.jsx)(`p`,{className:`text-red-400 text-sm`,children:`Failed to load tunnels`})}):y.length===0?(0,M.jsxs)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-12 text-center`,children:[(0,M.jsx)(Si,{size:32,className:`mx-auto text-zinc-600 mb-3`}),(0,M.jsx)(`p`,{className:`text-zinc-400 text-sm`,children:`No tunnels yet. Add your first tunnel to get started.`})]}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(gc,{tunnels:y,onDelete:h,onToggle:_,onEdit:m}),(0,M.jsx)(_c,{tunnels:y,onDelete:h,onToggle:_,onEdit:m})]}),s&&(0,M.jsx)(pc,{tunnel:s,onConfirm:e=>p.mutate({id:s.id,changes:e}),onCancel:()=>c(null),isPending:p.isPending}),a&&(0,M.jsx)(fc,{tunnel:a,onConfirm:v,onCancel:()=>o(null),isPending:d.isPending})]})}function vc({hasDomain:e}){let t=L(),n=U(),r=N(),i=P({queryKey:[`settings-2fa`],queryFn:()=>t.get2faStatus()}),[a,o]=(0,g.useState)(null),[s,c]=(0,g.useState)(``),[l,u]=(0,g.useState)(``),[d,f]=(0,g.useState)(!1),[p,m]=(0,g.useState)(``),[h,_]=(0,g.useState)(!1),v=i.data||{enabled:!1,setupComplete:!1},y=F({mutationFn:()=>t.setup2fa(),onSuccess:e=>o(e)}),b=F({mutationFn:e=>t.confirm2fa(e),onSuccess:()=>{r.invalidateQueries(),o(null),c(``),n(`Two-factor authentication enabled`)}}),x=F({mutationFn:e=>t.disable2fa(e),onSuccess:()=>{r.invalidateQueries(),u(``),n(`Two-factor authentication disabled`)}}),S=F({mutationFn:e=>t.triggerPanelUpdate(e),onSuccess:()=>{n(`Update initiated. The panel will restart shortly.`),m(``),_(!1)},onError:e=>n(G(e),`error`)}),C=/^\d+\.\d+\.\d+$/.test(p);function w(){a?.manualKey&&navigator.clipboard.writeText(a.manualKey).then(()=>{f(!0),setTimeout(()=>f(!1),2e3)},()=>{n(`Failed to copy to clipboard`,`error`)})}function T(e){e.preventDefault(),s.length===6&&b.mutate(s)}function E(e){e.preventDefault(),l.length===6&&x.mutate(l)}if(i.isLoading)return(0,M.jsx)(`div`,{className:`p-6`,children:(0,M.jsx)(`div`,{className:`mx-auto h-6 w-6 animate-spin rounded-full border-2 border-zinc-600 border-t-cyan-400`})});if(i.isError)return(0,M.jsxs)(`div`,{className:`mx-auto max-w-2xl p-6`,children:[(0,M.jsx)(`h1`,{className:`text-xl font-bold text-white`,children:`Settings`}),(0,M.jsx)(`p`,{className:`mt-4 text-sm text-red-400`,children:`Failed to load settings. Please try again.`})]});let D=b.error?.message,ee=x.error?.message,te=y.error?.message;return(0,M.jsxs)(`div`,{className:`mx-auto max-w-2xl p-6`,children:[(0,M.jsxs)(`div`,{className:`mb-6`,children:[(0,M.jsx)(`h1`,{className:`text-xl font-bold text-white`,children:`Settings`}),(0,M.jsx)(`p`,{className:`mt-1 text-sm text-zinc-500`,children:`Configure panel security settings.`})]}),(0,M.jsxs)(`div`,{className:`rounded-lg border border-zinc-800 bg-zinc-900 p-6`,children:[(0,M.jsxs)(`div`,{className:`mb-4 flex items-center gap-3`,children:[(0,M.jsx)(Ii,{className:`h-5 w-5 text-cyan-400`}),(0,M.jsx)(`h2`,{className:`text-lg font-bold text-white`,children:`Two-Factor Authentication`}),v.enabled&&(0,M.jsx)(`span`,{className:`rounded-full border border-green-500/20 bg-green-500/10 px-2 py-0.5 text-xs text-green-400`,children:`Enabled`})]}),!v.enabled&&!a&&(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`p`,{className:`mb-4 text-sm text-zinc-400`,children:`Add a second layer of protection to the admin panel. When enabled, you will need both your mTLS certificate and a TOTP code from your authenticator app to access the panel.`}),!e&&(0,M.jsxs)(`div`,{className:`mb-4 flex items-start gap-2 rounded-lg border border-yellow-500/20 bg-yellow-500/5 p-3`,children:[(0,M.jsx)(Hi,{className:`mt-0.5 h-4 w-4 flex-shrink-0 text-yellow-400`}),(0,M.jsx)(`p`,{className:`text-sm text-yellow-400`,children:`A domain must be configured before enabling 2FA. Enabling 2FA disables IP:9292 access.`})]}),te&&(0,M.jsx)(`p`,{className:`mb-3 text-sm text-red-400`,children:te}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>y.mutate(),disabled:!e||y.isPending,className:`rounded-lg bg-cyan-600 px-4 py-2 text-sm font-semibold text-white hover:bg-cyan-500 disabled:cursor-not-allowed disabled:opacity-50`,children:y.isPending?`Setting up...`:`Enable Two-Factor Authentication`}),e&&(0,M.jsx)(`p`,{className:`mt-3 text-xs text-zinc-600`,children:`This will disable IP:9292 access. The panel will only be accessible via domain.`})]}),!v.enabled&&a&&(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`p`,{className:`mb-4 text-sm text-zinc-400`,children:`Scan this QR code with your authenticator app (Google Authenticator, Authy, etc.)`}),(0,M.jsx)(`div`,{className:`mb-4 flex justify-center`,children:(0,M.jsx)(`div`,{className:`rounded-lg bg-zinc-950 p-4`,children:(0,M.jsx)(yo,{value:a.uri,size:200,bgColor:`transparent`,fgColor:`#ffffff`})})}),(0,M.jsx)(`p`,{className:`mb-2 text-sm text-zinc-400`,children:`Or enter this code manually:`}),(0,M.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 rounded-lg bg-zinc-950 px-4 py-3`,children:[(0,M.jsx)(`code`,{className:`flex-1 font-mono text-sm tracking-wider text-cyan-400`,children:a.manualKey?.replace(/(.{4})/g,`$1 `).trim()}),(0,M.jsx)(`button`,{type:`button`,onClick:w,className:`text-zinc-500 hover:text-zinc-300`,title:`Copy secret`,children:d?(0,M.jsx)(Fr,{size:16,className:`text-green-400`}):(0,M.jsx)(Kr,{size:16})})]}),(0,M.jsxs)(`form`,{onSubmit:T,className:`space-y-3`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`label`,{className:`mb-1 block text-sm text-zinc-400`,children:`Enter the code from your authenticator to confirm`}),(0,M.jsx)(`input`,{type:`text`,inputMode:`numeric`,autoComplete:`one-time-code`,value:s,onChange:e=>c(e.target.value.replace(/\D/g,``).slice(0,6)),placeholder:`000000`,maxLength:6,className:`w-full rounded-lg border border-zinc-700 bg-zinc-950 px-3 py-2 font-mono text-center text-lg tracking-[0.2em] text-white placeholder-zinc-600 focus:border-cyan-500 focus:outline-none`})]}),D&&(0,M.jsx)(`p`,{className:`text-sm text-red-400`,children:D}),(0,M.jsxs)(`div`,{className:`flex gap-3`,children:[(0,M.jsx)(`button`,{type:`button`,onClick:()=>{o(null),c(``),b.reset()},className:`flex-1 rounded-lg border border-zinc-700 px-4 py-2 text-sm text-zinc-400 hover:text-white`,children:`Cancel`}),(0,M.jsx)(`button`,{type:`submit`,disabled:b.isPending||s.length!==6,className:`flex-1 rounded-lg bg-cyan-600 px-4 py-2 text-sm font-semibold text-white hover:bg-cyan-500 disabled:opacity-50`,children:b.isPending?`Confirming...`:`Confirm & Enable`})]})]})]}),v.enabled&&(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`p`,{className:`mb-4 text-sm text-zinc-400`,children:`Two-factor authentication is active. The panel requires both your mTLS certificate and a TOTP code.`}),(0,M.jsx)(`div`,{className:`mb-4 rounded-lg border border-zinc-700 bg-zinc-950 p-3`,children:(0,M.jsxs)(`p`,{className:`text-xs text-zinc-500`,children:[`Recovery: if you lose access to your authenticator, run`,` `,(0,M.jsx)(`code`,{className:`text-zinc-400`,children:`sudo lamaste-reset-admin`}),` on the server via the DigitalOcean console. This will reset admin auth to P12 and disable 2FA.`]})}),(0,M.jsxs)(`form`,{onSubmit:E,className:`space-y-3`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`label`,{className:`mb-1 block text-sm text-zinc-400`,children:`Enter a TOTP code to disable 2FA`}),(0,M.jsx)(`input`,{type:`text`,inputMode:`numeric`,autoComplete:`one-time-code`,value:l,onChange:e=>u(e.target.value.replace(/\D/g,``).slice(0,6)),placeholder:`000000`,maxLength:6,className:`w-full rounded-lg border border-zinc-700 bg-zinc-950 px-3 py-2 font-mono text-center text-lg tracking-[0.2em] text-white placeholder-zinc-600 focus:border-cyan-500 focus:outline-none`})]}),ee&&(0,M.jsx)(`p`,{className:`text-sm text-red-400`,children:ee}),(0,M.jsx)(`button`,{type:`submit`,disabled:x.isPending||l.length!==6,className:`rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-2 text-sm font-semibold text-red-400 hover:bg-red-500/20 disabled:opacity-50`,children:x.isPending?`Disabling...`:`Disable Two-Factor Authentication`})]})]})]}),(0,M.jsxs)(`div`,{className:`mt-6 rounded-lg border border-zinc-800 bg-zinc-900 p-6`,children:[(0,M.jsxs)(`div`,{className:`mb-4 flex items-center gap-3`,children:[(0,M.jsx)(ki,{className:`h-5 w-5 text-cyan-400`}),(0,M.jsx)(`h2`,{className:`text-lg font-bold text-white`,children:`Panel Update`})]}),(0,M.jsx)(`p`,{className:`mb-4 text-sm text-zinc-400`,children:`Trigger an update of the panel server to a specific version. The server will restart automatically after the update completes.`}),(0,M.jsxs)(`div`,{className:`flex items-end gap-3`,children:[(0,M.jsxs)(`div`,{className:`flex-1`,children:[(0,M.jsx)(`label`,{className:`mb-1 block text-sm text-zinc-400`,htmlFor:`update-version`,children:`Version`}),(0,M.jsx)(`input`,{id:`update-version`,type:`text`,value:p,onChange:e=>m(e.target.value.trim()),placeholder:`1.0.43`,className:`w-full rounded-lg border border-zinc-700 bg-zinc-950 px-3 py-2 text-sm text-white placeholder-zinc-600 focus:border-cyan-500 focus:outline-none font-mono`})]}),(0,M.jsx)(`button`,{type:`button`,disabled:!C||S.isPending,onClick:()=>_(!0),className:`rounded-lg bg-cyan-600 px-4 py-2 text-sm font-semibold text-white hover:bg-cyan-500 disabled:cursor-not-allowed disabled:opacity-50`,children:`Update Panel`})]}),!C&&p.length>0&&(0,M.jsx)(`p`,{className:`mt-2 text-xs text-red-400`,children:`Version must be in semver format (e.g. 1.0.43)`}),S.error&&(0,M.jsx)(`p`,{className:`mt-2 text-sm text-red-400`,children:S.error.message}),h&&(0,M.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/70`,children:(0,M.jsxs)(`div`,{className:`w-full max-w-sm rounded-xl border border-zinc-700 bg-zinc-900 p-6 shadow-xl`,children:[(0,M.jsxs)(`div`,{className:`mb-4 flex items-center gap-2`,children:[(0,M.jsx)(Hi,{className:`h-5 w-5 text-amber-400`}),(0,M.jsx)(`h3`,{className:`text-lg font-semibold text-white`,children:`Confirm Update`})]}),(0,M.jsxs)(`p`,{className:`mb-4 text-sm text-zinc-400`,children:[`This will update the panel server to version`,` `,(0,M.jsx)(`strong`,{className:`text-white`,children:p}),` and restart the service. The panel will be unavailable for 1-2 minutes.`]}),(0,M.jsxs)(`div`,{className:`flex justify-end gap-3`,children:[(0,M.jsx)(`button`,{type:`button`,onClick:()=>_(!1),className:`rounded-lg border border-zinc-700 px-4 py-2 text-sm text-zinc-400 hover:text-white`,children:`Cancel`}),(0,M.jsx)(`button`,{type:`button`,disabled:S.isPending,onClick:()=>S.mutate({version:p}),className:`rounded-lg bg-cyan-600 px-4 py-2 text-sm font-semibold text-white hover:bg-cyan-500 disabled:opacity-50`,children:S.isPending?`Updating...`:`Update Now`})]})]})})]})]})}function yc({onClose:e}){let t=L(),n=N(),r=U(),[i,a]=(0,g.useState)({id:crypto.randomUUID(),label:``,provider:`digitalocean-spaces`,region:``,bucket:``,endpoint:``,accessKey:``,secretKey:``}),o=F({mutationFn:e=>t.registerStorageServer(e),onSuccess:()=>{n.invalidateQueries({queryKey:[`storage-servers`]}),r(`Storage server registered`),e()},onError:e=>r(G(e),`error`)}),s=(e,t)=>a(n=>({...n,[e]:t})),c=i.label&&i.region&&i.bucket&&i.endpoint&&i.accessKey&&i.secretKey;return(0,M.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/70`,children:(0,M.jsxs)(`div`,{className:`w-full max-w-lg rounded-xl bg-zinc-900 border border-zinc-700 p-6 shadow-xl`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,M.jsx)(`h3`,{className:`text-lg font-semibold text-white`,children:`Register Storage Server`}),(0,M.jsx)(`button`,{type:`button`,onClick:e,className:`text-zinc-400 hover:text-white`,children:(0,M.jsx)(H,{size:20})})]}),(0,M.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),o.mutate(i)},className:`space-y-4`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`label`,{className:`block text-sm font-medium text-zinc-300 mb-1`,children:`Label`}),(0,M.jsx)(`input`,{type:`text`,value:i.label,onChange:e=>s(`label`,e.target.value),placeholder:`my-storage`,className:`w-full rounded bg-zinc-800 border border-zinc-700 px-3 py-2 text-sm text-zinc-200 placeholder-zinc-600 focus:border-cyan-500 focus:outline-none`})]}),(0,M.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`label`,{className:`block text-sm font-medium text-zinc-300 mb-1`,children:`Provider`}),(0,M.jsxs)(`select`,{value:i.provider,onChange:e=>s(`provider`,e.target.value),className:`w-full rounded bg-zinc-800 border border-zinc-700 px-3 py-2 text-sm text-zinc-200 focus:border-cyan-500 focus:outline-none`,children:[(0,M.jsx)(`option`,{value:`digitalocean-spaces`,children:`DigitalOcean Spaces`}),(0,M.jsx)(`option`,{value:`s3`,children:`Amazon S3`})]})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`label`,{className:`block text-sm font-medium text-zinc-300 mb-1`,children:`Region`}),(0,M.jsx)(`input`,{type:`text`,value:i.region,onChange:e=>s(`region`,e.target.value),placeholder:`nyc3`,className:`w-full rounded bg-zinc-800 border border-zinc-700 px-3 py-2 text-sm text-zinc-200 placeholder-zinc-600 focus:border-cyan-500 focus:outline-none`})]})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`label`,{className:`block text-sm font-medium text-zinc-300 mb-1`,children:`Bucket`}),(0,M.jsx)(`input`,{type:`text`,value:i.bucket,onChange:e=>s(`bucket`,e.target.value),placeholder:`my-bucket`,className:`w-full rounded bg-zinc-800 border border-zinc-700 px-3 py-2 text-sm text-zinc-200 placeholder-zinc-600 focus:border-cyan-500 focus:outline-none`})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`label`,{className:`block text-sm font-medium text-zinc-300 mb-1`,children:`Endpoint URL`}),(0,M.jsx)(`input`,{type:`url`,value:i.endpoint,onChange:e=>s(`endpoint`,e.target.value),placeholder:`https://nyc3.digitaloceanspaces.com`,className:`w-full rounded bg-zinc-800 border border-zinc-700 px-3 py-2 text-sm text-zinc-200 placeholder-zinc-600 focus:border-cyan-500 focus:outline-none`})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`label`,{className:`block text-sm font-medium text-zinc-300 mb-1`,children:`Access Key`}),(0,M.jsx)(`input`,{type:`password`,value:i.accessKey,onChange:e=>s(`accessKey`,e.target.value),className:`w-full rounded bg-zinc-800 border border-zinc-700 px-3 py-2 text-sm text-zinc-200 font-mono focus:border-cyan-500 focus:outline-none`})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`label`,{className:`block text-sm font-medium text-zinc-300 mb-1`,children:`Secret Key`}),(0,M.jsx)(`input`,{type:`password`,value:i.secretKey,onChange:e=>s(`secretKey`,e.target.value),className:`w-full rounded bg-zinc-800 border border-zinc-700 px-3 py-2 text-sm text-zinc-200 font-mono focus:border-cyan-500 focus:outline-none`})]}),(0,M.jsx)(`div`,{className:`rounded bg-amber-500/10 border border-amber-500/20 px-3 py-2`,children:(0,M.jsx)(`p`,{className:`text-xs text-amber-300`,children:`Credentials are encrypted at rest using AES-256-GCM. They never leave the server.`})}),(0,M.jsxs)(`div`,{className:`flex justify-end gap-3 pt-2`,children:[(0,M.jsx)(`button`,{type:`button`,onClick:e,className:`rounded bg-zinc-700 px-4 py-2 text-sm text-zinc-300 hover:bg-zinc-600`,children:`Cancel`}),(0,M.jsxs)(`button`,{type:`submit`,disabled:!c||o.isPending,className:`rounded bg-cyan-600 px-4 py-2 text-sm font-semibold text-white hover:bg-cyan-500 disabled:opacity-50`,children:[o.isPending?(0,M.jsx)(B,{size:14,className:`animate-spin inline mr-1`}):null,`Register`]})]})]})]})})}function bc({servers:e,onClose:t}){let n=L(),r=N(),i=U(),[a,o]=(0,g.useState)(``),[s,c]=(0,g.useState)(e[0]?.id||``),l=P({queryKey:[`plugins`],queryFn:()=>n.getPlugins()}),u=F({mutationFn:e=>n.createStorageBinding(e),onSuccess:()=>{r.invalidateQueries({queryKey:[`storage-bindings`]}),i(`Plugin bound to storage`),t()},onError:e=>i(G(e),`error`)}),d=l.data?.plugins||[];return(0,M.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/70`,children:(0,M.jsxs)(`div`,{className:`w-full max-w-md rounded-xl bg-zinc-900 border border-zinc-700 p-6 shadow-xl`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,M.jsx)(`h3`,{className:`text-lg font-semibold text-white`,children:`Bind Plugin to Storage`}),(0,M.jsx)(`button`,{type:`button`,onClick:t,className:`text-zinc-400 hover:text-white`,children:(0,M.jsx)(H,{size:20})})]}),(0,M.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),u.mutate({pluginName:a,storageServerId:s})},className:`space-y-4`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`label`,{className:`block text-sm font-medium text-zinc-300 mb-1`,children:`Plugin`}),(0,M.jsxs)(`select`,{value:a,onChange:e=>o(e.target.value),className:`w-full rounded bg-zinc-800 border border-zinc-700 px-3 py-2 text-sm text-zinc-200 focus:border-cyan-500 focus:outline-none`,children:[(0,M.jsx)(`option`,{value:``,children:`Select a plugin...`}),d.map(e=>(0,M.jsx)(`option`,{value:e.name,children:e.displayName||e.name},e.name))]})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`label`,{className:`block text-sm font-medium text-zinc-300 mb-1`,children:`Storage Server`}),(0,M.jsx)(`select`,{value:s,onChange:e=>c(e.target.value),className:`w-full rounded bg-zinc-800 border border-zinc-700 px-3 py-2 text-sm text-zinc-200 focus:border-cyan-500 focus:outline-none`,children:e.map(e=>(0,M.jsxs)(`option`,{value:e.id,children:[e.label,` (`,e.provider,` / `,e.region,`)`]},e.id))})]}),(0,M.jsxs)(`div`,{className:`flex justify-end gap-3 pt-2`,children:[(0,M.jsx)(`button`,{type:`button`,onClick:t,className:`rounded bg-zinc-700 px-4 py-2 text-sm text-zinc-300 hover:bg-zinc-600`,children:`Cancel`}),(0,M.jsxs)(`button`,{type:`submit`,disabled:!a||!s||u.isPending,className:`rounded bg-cyan-600 px-4 py-2 text-sm font-semibold text-white hover:bg-cyan-500 disabled:opacity-50`,children:[u.isPending?(0,M.jsx)(B,{size:14,className:`animate-spin inline mr-1`}):null,`Bind`]})]})]})]})})}function xc(){let e=L(),t=N(),n=U(),[r,i]=(0,g.useState)(!1),[a,o]=(0,g.useState)(!1),[s,c]=(0,g.useState)(null),[l,u]=(0,g.useState)(null),d=P({queryKey:[`storage-servers`],queryFn:()=>e.getStorageServers(),refetchInterval:1e4}),f=P({queryKey:[`storage-bindings`],queryFn:()=>e.getStorageBindings(),refetchInterval:1e4}),p=F({mutationFn:t=>e.deleteStorageServer(t),onSuccess:()=>{t.invalidateQueries({queryKey:[`storage-servers`]}),t.invalidateQueries({queryKey:[`storage-bindings`]}),n(`Storage server removed`),c(null)},onError:e=>{n(G(e),`error`),c(null)}}),m=F({mutationFn:t=>e.deleteStorageBinding(t),onSuccess:()=>{t.invalidateQueries({queryKey:[`storage-bindings`]}),n(`Plugin unbound from storage`),u(null)},onError:e=>{n(G(e),`error`),u(null)}}),h=d.data?.servers||[],_=f.data?.bindings||[];return(0,M.jsxs)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:[(0,M.jsxs)(`div`,{className:`mb-6`,children:[(0,M.jsx)(`h1`,{className:`text-xl font-bold text-white`,children:`Storage`}),(0,M.jsx)(`p`,{className:`text-zinc-500 text-sm mt-1`,children:`Manage S3-compatible storage servers and bind them to plugins.`})]}),(0,M.jsxs)(`div`,{className:`mb-8`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,M.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,M.jsx)(si,{size:18,className:`text-cyan-400`}),`Storage Servers`]}),(0,M.jsxs)(`button`,{type:`button`,onClick:()=>i(!0),className:`flex items-center gap-2 rounded bg-cyan-600 px-4 py-2 text-sm font-semibold text-white hover:bg-cyan-500`,children:[(0,M.jsx)(Ei,{size:14}),`Register Server`]})]}),d.isLoading?(0,M.jsx)(`div`,{className:`space-y-3`,children:Array.from({length:2}).map((e,t)=>(0,M.jsx)(`div`,{className:`h-14 animate-pulse rounded-lg bg-zinc-900 border border-zinc-800`},t))}):d.isError?(0,M.jsx)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-6`,children:(0,M.jsxs)(`div`,{className:`flex items-center gap-2 text-red-400 text-sm`,children:[(0,M.jsx)(Br,{size:16}),`Failed to load storage servers`]})}):h.length===0?(0,M.jsxs)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-8 text-center`,children:[(0,M.jsx)(si,{size:32,className:`mx-auto text-zinc-600 mb-3`}),(0,M.jsx)(`p`,{className:`text-zinc-400 text-sm`,children:`No storage servers registered. Register one to enable plugin storage.`})]}):(0,M.jsx)(`div`,{className:`overflow-x-auto rounded-lg border border-zinc-800`,children:(0,M.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,M.jsx)(`thead`,{children:(0,M.jsxs)(`tr`,{className:`border-b border-zinc-700 bg-zinc-900`,children:[(0,M.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400`,children:`Label`}),(0,M.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400`,children:`Provider`}),(0,M.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400 hidden md:table-cell`,children:`Region`}),(0,M.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400 hidden lg:table-cell`,children:`Bucket`}),(0,M.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400 hidden lg:table-cell`,children:`Registered`}),(0,M.jsx)(`th`,{className:`px-4 py-3 text-right text-xs font-medium uppercase text-zinc-400`,children:`Actions`})]})}),(0,M.jsx)(`tbody`,{children:h.map(e=>(0,M.jsxs)(`tr`,{className:`border-b border-zinc-700 bg-zinc-800`,children:[(0,M.jsx)(`td`,{className:`px-4 py-3 text-zinc-200 font-semibold`,children:e.label}),(0,M.jsx)(`td`,{className:`px-4 py-3 text-zinc-400`,children:e.provider}),(0,M.jsx)(`td`,{className:`px-4 py-3 text-zinc-400 hidden md:table-cell`,children:e.region}),(0,M.jsx)(`td`,{className:`px-4 py-3 text-zinc-400 font-mono text-xs hidden lg:table-cell`,children:e.bucket}),(0,M.jsx)(`td`,{className:`px-4 py-3 text-zinc-500 hidden lg:table-cell`,children:e.registeredAt?wa(e.registeredAt):`—`}),(0,M.jsx)(`td`,{className:`px-4 py-3 text-right`,children:(0,M.jsx)(`button`,{type:`button`,onClick:()=>c(e),className:`inline-flex items-center gap-1.5 rounded bg-zinc-700 px-2.5 py-1.5 text-xs text-zinc-300 hover:bg-red-600/20 hover:text-red-400`,title:`Remove server`,children:(0,M.jsx)(Vi,{size:12})})})]},e.id))})]})})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,M.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,M.jsx)(pi,{size:18,className:`text-cyan-400`}),`Plugin Bindings`]}),h.length>0&&(0,M.jsxs)(`button`,{type:`button`,onClick:()=>o(!0),className:`flex items-center gap-2 rounded bg-cyan-600 px-4 py-2 text-sm font-semibold text-white hover:bg-cyan-500`,children:[(0,M.jsx)(Ei,{size:14}),`Bind Plugin`]})]}),f.isLoading?(0,M.jsx)(`div`,{className:`space-y-3`,children:Array.from({length:2}).map((e,t)=>(0,M.jsx)(`div`,{className:`h-14 animate-pulse rounded-lg bg-zinc-900 border border-zinc-800`},t))}):f.isError?(0,M.jsx)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-6`,children:(0,M.jsxs)(`div`,{className:`flex items-center gap-2 text-red-400 text-sm`,children:[(0,M.jsx)(Br,{size:16}),`Failed to load bindings`]})}):_.length===0?(0,M.jsxs)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-8 text-center`,children:[(0,M.jsx)(pi,{size:32,className:`mx-auto text-zinc-600 mb-3`}),(0,M.jsxs)(`p`,{className:`text-zinc-400 text-sm`,children:[`No plugins bound to storage.`,` `,h.length===0?`Register a storage server first.`:`Use the button above to bind one.`]})]}):(0,M.jsx)(`div`,{className:`overflow-x-auto rounded-lg border border-zinc-800`,children:(0,M.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,M.jsx)(`thead`,{children:(0,M.jsxs)(`tr`,{className:`border-b border-zinc-700 bg-zinc-900`,children:[(0,M.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400`,children:`Plugin`}),(0,M.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400`,children:`Storage Server`}),(0,M.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400 hidden md:table-cell`,children:`Bound`}),(0,M.jsx)(`th`,{className:`px-4 py-3 text-right text-xs font-medium uppercase text-zinc-400`,children:`Actions`})]})}),(0,M.jsx)(`tbody`,{children:_.map(e=>{let t=h.find(t=>t.id===e.storageServerId);return(0,M.jsxs)(`tr`,{className:`border-b border-zinc-700 bg-zinc-800`,children:[(0,M.jsx)(`td`,{className:`px-4 py-3 text-zinc-200 font-semibold`,children:e.pluginName}),(0,M.jsx)(`td`,{className:`px-4 py-3 text-zinc-400`,children:t?.label||e.storageServerId.slice(0,8)}),(0,M.jsx)(`td`,{className:`px-4 py-3 text-zinc-500 hidden md:table-cell`,children:e.boundAt?wa(e.boundAt):`—`}),(0,M.jsx)(`td`,{className:`px-4 py-3 text-right`,children:(0,M.jsx)(`button`,{type:`button`,onClick:()=>u(e.pluginName),className:`inline-flex items-center gap-1.5 rounded bg-zinc-700 px-2.5 py-1.5 text-xs text-zinc-300 hover:bg-red-600/20 hover:text-red-400`,title:`Unbind plugin`,children:(0,M.jsx)(Wi,{size:12})})})]},e.pluginName)})})]})})]}),r&&(0,M.jsx)(yc,{onClose:()=>i(!1)}),a&&(0,M.jsx)(bc,{servers:h,onClose:()=>o(!1)}),s&&(0,M.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/70`,children:(0,M.jsxs)(`div`,{className:`w-full max-w-sm rounded-xl border border-zinc-700 bg-zinc-900 p-6 shadow-xl`,children:[(0,M.jsx)(`h3`,{className:`text-lg font-semibold text-white mb-3`,children:`Remove Storage Server`}),(0,M.jsxs)(`p`,{className:`text-sm text-zinc-400 mb-2`,children:[`Are you sure you want to remove`,` `,(0,M.jsx)(`strong`,{className:`text-white`,children:s.label}),`?`]}),(0,M.jsx)(`p`,{className:`text-xs text-amber-400 mb-4`,children:`All plugin bindings to this server will also be removed.`}),(0,M.jsxs)(`div`,{className:`flex justify-end gap-3`,children:[(0,M.jsx)(`button`,{type:`button`,onClick:()=>c(null),className:`rounded bg-zinc-700 px-4 py-2 text-sm text-zinc-300 hover:bg-zinc-600`,children:`Cancel`}),(0,M.jsx)(`button`,{type:`button`,disabled:p.isPending,onClick:()=>p.mutate(s.id),className:`rounded bg-red-600 px-4 py-2 text-sm font-semibold text-white hover:bg-red-500 disabled:opacity-50`,children:p.isPending?`Removing...`:`Remove`})]})]})}),l&&(0,M.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/70`,children:(0,M.jsxs)(`div`,{className:`w-full max-w-sm rounded-xl border border-zinc-700 bg-zinc-900 p-6 shadow-xl`,children:[(0,M.jsx)(`h3`,{className:`text-lg font-semibold text-white mb-3`,children:`Unbind Plugin`}),(0,M.jsxs)(`p`,{className:`text-sm text-zinc-400 mb-4`,children:[`Remove storage binding for `,(0,M.jsx)(`strong`,{className:`text-white`,children:l}),`?`]}),(0,M.jsxs)(`div`,{className:`flex justify-end gap-3`,children:[(0,M.jsx)(`button`,{type:`button`,onClick:()=>u(null),className:`rounded bg-zinc-700 px-4 py-2 text-sm text-zinc-300 hover:bg-zinc-600`,children:`Cancel`}),(0,M.jsx)(`button`,{type:`button`,disabled:m.isPending,onClick:()=>m.mutate(l),className:`rounded bg-red-600 px-4 py-2 text-sm font-semibold text-white hover:bg-red-500 disabled:opacity-50`,children:m.isPending?`Unbinding...`:`Unbind`})]})]})})]})}var Sc=50,Cc={info:`text-cyan-400`,warning:`text-yellow-400`,critical:`text-red-400`};function wc(){let e=L(),t=N(),n=U(),r=P({queryKey:[`notifications`],queryFn:()=>e.getNotifications({limit:50}),refetchInterval:3e4}),i=F({mutationFn:()=>e.markNotificationsRead({all:!0}),onSuccess:()=>t.invalidateQueries({queryKey:[`notifications`]}),onError:e=>n(G(e),`error`)}),a=r.data?.notifications??[],o=r.data?.unread??0;return(0,M.jsxs)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-5 mb-6`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,M.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-zinc-300`,children:[(0,M.jsx)(jr,{size:14,className:`text-cyan-400`}),` Notifications`,o>0&&(0,M.jsx)(`span`,{className:`rounded-full bg-cyan-500/20 px-2 text-xs text-cyan-400`,children:o})]}),o>0&&(0,M.jsxs)(`button`,{type:`button`,disabled:i.isPending,onClick:()=>i.mutate(),className:`flex items-center gap-1.5 rounded bg-zinc-700 px-2.5 py-1 text-xs text-zinc-300 hover:bg-zinc-600 disabled:opacity-50`,children:[(0,M.jsx)(Pr,{size:12}),` Mark all read`]})]}),a.length===0?(0,M.jsx)(`p`,{className:`text-xs text-zinc-500`,children:`Nothing to report.`}):(0,M.jsx)(`ul`,{className:`space-y-1.5 text-xs`,children:a.map(e=>(0,M.jsxs)(`li`,{className:`flex gap-3 ${e.read?`opacity-60`:``}`,children:[(0,M.jsx)(`span`,{className:`shrink-0 text-zinc-500`,children:new Date(e.at).toLocaleString()}),(0,M.jsx)(`span`,{className:`shrink-0 ${Cc[e.level]??`text-zinc-400`}`,children:e.level}),(0,M.jsx)(`span`,{className:`shrink-0 font-mono text-zinc-500`,children:e.source}),(0,M.jsx)(`span`,{className:`text-zinc-300 break-words`,children:e.message})]},e.id))})]})}function Tc(e){return Object.entries(e??{}).map(([e,t])=>`${e}=${typeof t==`object`&&t?JSON.stringify(t):t}`).join(` `)}function Ec(){let e=L(),[t,n]=(0,g.useState)(``),[r,i]=(0,g.useState)(``),a={plugin:t.trim()||void 0,action:r.trim()||void 0},o=hr({queryKey:[`audit`,a],queryFn:({pageParam:t})=>e.getAuditLog({...a,limit:Sc,...t?{before:t}:{}}),initialPageParam:void 0,getNextPageParam:e=>e.entries.length===Sc?e.entries[e.entries.length-1].id:void 0,refetchInterval:3e4}),s=o.data?.pages.flatMap(e=>e.entries)??[];return(0,M.jsxs)(`div`,{className:`p-6 max-w-5xl mx-auto`,children:[(0,M.jsxs)(`div`,{className:`mb-6`,children:[(0,M.jsx)(`h1`,{className:`text-xl font-bold text-white`,children:`Audit`}),(0,M.jsx)(`p`,{className:`text-zinc-500 text-sm mt-1`,children:`What administrators decided and what plugins' hooks reported — metadata only, never a request or response body.`})]}),(0,M.jsx)(wc,{}),(0,M.jsxs)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-5`,children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 mb-4`,children:[(0,M.jsx)(ji,{size:14,className:`text-cyan-400`}),(0,M.jsx)(`h2`,{className:`text-sm font-semibold text-zinc-300 mr-4`,children:`Audit log`}),(0,M.jsx)(`input`,{type:`text`,value:t,onChange:e=>n(e.target.value),placeholder:`plugin`,className:`w-36 rounded bg-zinc-800 border border-zinc-700 px-2 py-1 text-xs text-zinc-300 focus:outline-none focus:border-cyan-400`}),(0,M.jsx)(`input`,{type:`text`,value:r,onChange:e=>i(e.target.value),placeholder:`action, or prefix ending in .`,className:`w-56 rounded bg-zinc-800 border border-zinc-700 px-2 py-1 text-xs text-zinc-300 focus:outline-none focus:border-cyan-400`})]}),o.isError?(0,M.jsxs)(`div`,{className:`flex items-center gap-2 text-red-400 text-sm`,children:[(0,M.jsx)(Br,{size:16}),` Failed to load the audit log`]}):s.length===0?(0,M.jsx)(`p`,{className:`text-xs text-zinc-500`,children:o.isLoading?`Loading…`:`No entries.`}):(0,M.jsxs)(`table`,{className:`w-full text-xs`,children:[(0,M.jsx)(`thead`,{children:(0,M.jsxs)(`tr`,{className:`text-left text-zinc-500`,children:[(0,M.jsx)(`th`,{className:`pb-2 pr-3 font-normal`,children:`When`}),(0,M.jsx)(`th`,{className:`pb-2 pr-3 font-normal`,children:`Action`}),(0,M.jsx)(`th`,{className:`pb-2 pr-3 font-normal`,children:`Actor`}),(0,M.jsx)(`th`,{className:`pb-2 pr-3 font-normal`,children:`Plugin`}),(0,M.jsx)(`th`,{className:`pb-2 font-normal`,children:`Details`})]})}),(0,M.jsx)(`tbody`,{children:s.map(e=>(0,M.jsxs)(`tr`,{className:`border-t border-zinc-800 align-top`,children:[(0,M.jsx)(`td`,{className:`py-1.5 pr-3 whitespace-nowrap text-zinc-500`,children:new Date(e.at).toLocaleString()}),(0,M.jsx)(`td`,{className:`py-1.5 pr-3 font-mono text-cyan-400`,children:e.action}),(0,M.jsx)(`td`,{className:`py-1.5 pr-3 font-mono text-zinc-300`,children:e.actor}),(0,M.jsx)(`td`,{className:`py-1.5 pr-3 font-mono text-zinc-300`,children:e.plugin??``}),(0,M.jsx)(`td`,{className:`py-1.5 font-mono text-zinc-500 break-all`,children:Tc(e.details)})]},e.id))})]}),o.hasNextPage&&(0,M.jsx)(`button`,{type:`button`,disabled:o.isFetchingNextPage,onClick:()=>o.fetchNextPage(),className:`mt-3 rounded bg-zinc-700 px-3 py-1.5 text-xs text-zinc-300 hover:bg-zinc-600 disabled:opacity-50`,children:`Load older`})]})]})}function q(e,t){return I(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)})}function Dc(e,t){return I(e,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)})}function Oc(e,t){return I(e,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)})}function J(e,t){let n={method:`DELETE`};return t&&(n.headers={"Content-Type":`application/json`},n.body=JSON.stringify(t)),I(e,n)}function kc(e){let t=new URLSearchParams;for(let[n,r]of Object.entries(e))r!=null&&r!==``&&t.set(n,String(r));let n=t.toString();return n?`?${n}`:``}function Ac({force:e=!1,purge:t=!1}={}){return kc({force:e?`true`:void 0,purge:t?`true`:void 0})}var jc={getUsers:()=>I(`/api/users`),createUser:e=>q(`/api/users`,e),updateUser:(e,t)=>Dc(`/api/users/${encodeURIComponent(e)}`,t),deleteUser:e=>J(`/api/users/${encodeURIComponent(e)}`),resetTotp:e=>q(`/api/users/${encodeURIComponent(e)}/reset-totp`),getInvitations:()=>I(`/api/invitations`),createInvitation:e=>q(`/api/invitations`,e),revokeInvitation:e=>J(`/api/invitations/${encodeURIComponent(e)}`),getSites:()=>I(`/api/sites`),createSite:e=>q(`/api/sites`,e),deleteSite:e=>J(`/api/sites/${encodeURIComponent(e)}`),updateSite:(e,t)=>Oc(`/api/sites/${encodeURIComponent(e)}`,t),getSiteFiles:(e,t)=>{let n=t&&t!==`.`?`?path=${encodeURIComponent(t)}`:``;return I(`/api/sites/${encodeURIComponent(e)}/files${n}`)},uploadSiteFiles:(e,t,n)=>{let r=new FormData;for(let e of n)r.append(`files`,e);let i=t&&t!==`.`?`?path=${encodeURIComponent(t)}`:``;return I(`/api/sites/${encodeURIComponent(e)}/files${i}`,{method:`POST`,body:r})},deleteSiteFile:(e,t)=>J(`/api/sites/${encodeURIComponent(e)}/files`,{path:t}),verifySiteDns:e=>q(`/api/sites/${encodeURIComponent(e)}/verify-dns`),getCerts:()=>I(`/api/certs`),renewCert:e=>q(`/api/certs/${encodeURIComponent(e)}/renew`),rotateMtls:()=>q(`/api/certs/mtls/rotate`),downloadMtls:async()=>{let e=await fetch(`/api/certs/mtls/download`,{credentials:`same-origin`});if(!e.ok)throw Error(`Download failed`);let t=await e.blob(),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`client.p12`,r.click(),URL.revokeObjectURL(n)},getAuthMode:()=>I(`/api/certs/admin/auth-mode`),getAutoRenewStatus:()=>I(`/api/certs/auto-renew-status`),getAgentCerts:()=>I(`/api/certs/agent`),generateAgentCert:e=>q(`/api/certs/agent`,e),revokeAgentCert:e=>J(`/api/certs/agent/${encodeURIComponent(e)}`),createEnrollmentToken:e=>q(`/api/certs/agent/enroll`,e),revokeEnrollmentToken:e=>J(`/api/certs/agent/enroll/${encodeURIComponent(e)}`),updateAgentCapabilities:(e,t)=>Oc(`/api/certs/agent/${encodeURIComponent(e)}/capabilities`,{capabilities:t}),updateAgentAllowedSites:(e,t)=>Oc(`/api/certs/agent/${encodeURIComponent(e)}/allowed-sites`,{allowedSites:t}),downloadAgentCert:async e=>{let t=await fetch(`/api/certs/agent/${encodeURIComponent(e)}/download`,{credentials:`same-origin`});if(!t.ok)throw Error(`Download failed`);let n=await t.blob(),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`${e}.p12`,i.click(),URL.revokeObjectURL(r)},getServices:()=>I(`/api/services`),serviceAction:(e,t)=>q(`/api/services/${encodeURIComponent(e)}/${encodeURIComponent(t)}`),getSystemStats:()=>I(`/api/system/stats`),triggerPanelUpdate:e=>q(`/api/system/update`,e),startLogStream:(e,t)=>{let n=`${window.location.protocol===`https:`?`wss:`:`ws:`}//${window.location.host}/api/services/${encodeURIComponent(e)}/logs`,r=new WebSocket(n);return r.onmessage=e=>{try{t(JSON.parse(e.data))}catch{t({message:e.data,timestamp:new Date().toISOString()})}},r.onerror=()=>{},r.onclose=()=>{},()=>r.close()},getTicketScopes:()=>I(`/api/tickets/scopes`),createTicketScope:e=>q(`/api/tickets/scopes`,e),deleteTicketScope:e=>J(`/api/tickets/scopes/${encodeURIComponent(e)}`),getTicketInstances:()=>I(`/api/tickets/instances`),deleteTicketInstance:e=>J(`/api/tickets/instances/${encodeURIComponent(e)}`),getTicketAssignments:()=>I(`/api/tickets/assignments`),createTicketAssignment:e=>q(`/api/tickets/assignments`,e),deleteTicketAssignment:(e,t)=>J(`/api/tickets/assignments/${encodeURIComponent(e)}/${encodeURIComponent(t)}`),getTickets:()=>I(`/api/tickets`),revokeTicket:e=>J(`/api/tickets/${encodeURIComponent(e)}`),getTicketSessions:()=>I(`/api/tickets/sessions`),killTicketSession:e=>J(`/api/tickets/sessions/${encodeURIComponent(e)}`),getPlugins:()=>I(`/api/plugins`),installPlugin:e=>q(`/api/plugins/install`,{packageName:e}),enablePlugin:e=>q(`/api/plugins/${encodeURIComponent(e)}/enable`),disablePlugin:e=>q(`/api/plugins/${encodeURIComponent(e)}/disable`),uninstallPlugin:(e,t={})=>J(`/api/plugins/${encodeURIComponent(e)}${Ac(t)}`),getPluginHosting:e=>I(`/api/plugins/${encodeURIComponent(e)}/hosting`),getPluginHostingEligibility:e=>I(`/api/plugins/${encodeURIComponent(e)}/hosting/eligibility`),setPluginHosting:(e,t)=>q(`/api/plugins/${encodeURIComponent(e)}/hosting`,{agentLabel:t}),clearPluginHosting:(e,t={})=>J(`/api/plugins/${encodeURIComponent(e)}/hosting${Ac(t)}`),rotatePluginHostingSecret:e=>q(`/api/plugins/${encodeURIComponent(e)}/hosting/rotate-secret`),getPluginRetainedData:e=>I(`/api/plugins/${encodeURIComponent(e)}/retained-data`),purgePluginRetainedData:(e,t)=>J(`/api/plugins/${encodeURIComponent(e)}/retained-data${kc({agentLabel:t})}`),forgetPluginRetainedData:(e,t)=>J(`/api/plugins/${encodeURIComponent(e)}/retained-data${kc({agentLabel:t,forget:`true`})}`),getPluginOperations:e=>I(`/api/plugins/${encodeURIComponent(e)}/operations`),getPluginOperation:(e,t)=>I(`/api/plugins/${encodeURIComponent(e)}/operations/${encodeURIComponent(t)}`),getPluginHooks:e=>I(`/api/plugins/${encodeURIComponent(e)}/hooks`),approvePluginHooks:(e,t)=>q(`/api/plugins/${encodeURIComponent(e)}/hooks/approve`,{digest:t}),setPluginHooksAutoApprove:(e,t)=>Dc(`/api/plugins/${encodeURIComponent(e)}/hooks/auto-approve`,{enabled:t}),updatePlugin:(e,t)=>q(`/api/plugins/${encodeURIComponent(e)}/update`,t?{version:t}:{}),discardPluginUpdate:e=>J(`/api/plugins/${encodeURIComponent(e)}/update`),fetchPluginBundle:async e=>{let t=await fetch(`/api/${encodeURIComponent(e)}/panel.js`);if(!t.ok)throw Error(`Failed to load plugin bundle for "${e}"`);return t.text()},getPushInstallConfig:()=>I(`/api/plugins/push-install/config`),updatePushInstallConfig:e=>Oc(`/api/plugins/push-install/config`,e),getPushInstallPolicies:()=>I(`/api/plugins/push-install/policies`),createPushInstallPolicy:e=>q(`/api/plugins/push-install/policies`,e),deletePushInstallPolicy:e=>J(`/api/plugins/push-install/policies/${encodeURIComponent(e)}`),updatePushInstallPolicy:(e,t)=>Oc(`/api/plugins/push-install/policies/${encodeURIComponent(e)}`,t),enablePushInstall:(e,t)=>q(`/api/plugins/push-install/enable/${encodeURIComponent(e)}`,t),disablePushInstall:e=>J(`/api/plugins/push-install/enable/${encodeURIComponent(e)}`),pushInstallCommand:(e,t)=>q(`/api/plugins/push-install/${encodeURIComponent(e)}`,t),getPushInstallSessions:()=>I(`/api/plugins/push-install/sessions`),getAuditLog:(e={})=>I(`/api/audit${kc(e)}`),getNotifications:(e={})=>I(`/api/notifications${kc(e)}`),markNotificationsRead:e=>q(`/api/notifications/read`,e),registerStorageServer:e=>q(`/api/storage/servers`,e),getStorageServers:()=>I(`/api/storage/servers`),deleteStorageServer:e=>J(`/api/storage/servers/${encodeURIComponent(e)}`),createStorageBinding:e=>q(`/api/storage/bindings`,e),getStorageBindings:()=>I(`/api/storage/bindings`),getStorageBinding:e=>I(`/api/storage/bindings/${encodeURIComponent(e)}`),deleteStorageBinding:e=>J(`/api/storage/bindings/${encodeURIComponent(e)}`),getIdentitySelf:()=>I(`/api/identity/self`),getIdentityUsers:()=>I(`/api/identity/users`),getIdentityUser:e=>I(`/api/identity/users/${encodeURIComponent(e)}`),getIdentityGroups:()=>I(`/api/identity/groups`),get2faStatus:()=>I(`/api/settings/2fa`),setup2fa:()=>q(`/api/settings/2fa/setup`),confirm2fa:e=>q(`/api/settings/2fa/confirm`,{code:e}),verify2fa:e=>q(`/api/settings/2fa/verify`,{code:e}),disable2fa:e=>q(`/api/settings/2fa/disable`,{code:e}),getAgents:()=>I(`/api/certs/agent`),getUserAccessGrants:()=>I(`/api/user-access/grants`),createUserAccessGrant:e=>q(`/api/user-access/grants`,e),revokeUserAccessGrant:e=>J(`/api/user-access/grants/${encodeURIComponent(e)}`),getTunnels:()=>I(`/api/tunnels`),createTunnel:e=>q(`/api/tunnels`,e),updateTunnel:(e,t)=>Oc(`/api/tunnels/${encodeURIComponent(e)}`,t),deleteTunnel:e=>J(`/api/tunnels/${encodeURIComponent(e)}`),getTunnelAgentConfig:()=>I(`/api/tunnels/agent-config`)};function Mc({to:e,icon:t,label:n,onClick:r}){return(0,M.jsxs)(Ft,{to:e,end:e===`/`,onClick:r,className:({isActive:e})=>[`flex items-center gap-3 px-3 py-2 rounded-md text-sm font-medium transition-colors`,e?`text-cyan-400 bg-zinc-800/50`:`text-zinc-400 hover:text-zinc-100 hover:bg-zinc-800`].join(` `),children:[(0,M.jsx)(t,{className:`h-5 w-5`}),n]})}var Nc=`4.3.1`,Pc={activity:Er,"bar-chart-3":Ar,"book-open":Mr,box:Nr,cpu:qr,database:Jr,"file-text":ei,folder:ii,"git-branch":ai,globe:oi,"hard-drive":si,heart:ci,layers:di,"layout-dashboard":fi,list:hi,map:yi,package:Ci,server:Mi,settings:Pi,shield:Li,"shield-check":Ii,terminal:zi,ticket:Bi,truck:Ui,users:qi,wifi:V,zap:Ji};function Fc(e){return e&&Object.hasOwn(Pc,e)&&Pc[e]||Ci}var Ic=[{type:`link`,to:`/`,icon:fi,label:`Dashboard`},{type:`link`,to:`/tunnels`,icon:oi,label:`Tunnels`},{type:`link`,to:`/sites`,icon:ei,label:`Static Sites`},{type:`link`,to:`/users`,icon:qi,label:`Users`},{type:`link`,to:`/certificates`,icon:Ii,label:`Certificates`},{type:`link`,to:`/services`,icon:Mi,label:`Services`},{type:`link`,to:`/tickets`,icon:Bi,label:`Tickets`},{type:`link`,to:`/plugins`,icon:Ci,label:`Plugins`},{type:`link`,to:`/storage`,icon:si,label:`Storage`},{type:`link`,to:`/audit`,icon:ji,label:`Audit`},{type:`link`,to:`/settings`,icon:Pi,label:`Settings`},{type:`link`,to:`/docs`,icon:Mr,label:`Documentation`}];function Lc({onLinkClick:e}){let t=L(),{data:n}=P({queryKey:[`sidebar-plugins`],queryFn:async()=>{try{return((await t.getPlugins()).plugins||[]).filter(e=>e.status===`enabled`&&(e.panel?.label||e.panel?.pages?.length))}catch{return[]}},refetchInterval:3e4,staleTime:15e3}),r=(n||[]).flatMap(e=>e.panel?.pages?.length?[{type:`section-header`,label:e.displayName||e.name,key:`section-${e.name}`},...e.panel.pages.map(t=>({type:`link`,to:`/plugins/${e.name}${t.path}`,icon:Fc(t.icon),label:t.title}))]:e.panel?.label?[{type:`link`,to:`/plugins/${e.name}`,icon:Fc(e.panel?.icon),label:e.panel.label}]:[]),i=[...Ic,...r];return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`div`,{className:`border-b border-zinc-800 px-4 py-5`,children:(0,M.jsx)(`span`,{className:`font-mono text-lg font-bold text-cyan-400`,children:`Lamaste`})}),(0,M.jsx)(`nav`,{className:`flex-1 space-y-1 px-2 py-4`,children:i.map(t=>t.type===`section-header`?(0,M.jsx)(`div`,{className:`px-3 pt-4 pb-1`,children:(0,M.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-zinc-600`,children:t.label})},t.key):(0,M.jsx)(Mc,{to:t.to,icon:t.icon,label:t.label,onClick:e},t.to))}),(0,M.jsx)(`div`,{className:`border-t border-zinc-800 px-4 py-3`,children:(0,M.jsxs)(`span`,{className:`font-mono text-xs text-zinc-600`,children:[`v`,Nc]})})]})}function Rc(){let[e,t]=(0,g.useState)(!1),n=()=>t(!1);return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`button`,{type:`button`,onClick:()=>t(!0),className:`fixed left-4 top-4 z-40 rounded-md bg-zinc-900 p-2 text-zinc-400 hover:text-zinc-100 lg:hidden`,"aria-label":`Open sidebar`,children:(0,M.jsx)(bi,{className:`h-5 w-5`})}),e&&(0,M.jsxs)(`div`,{className:`fixed inset-0 z-50 lg:hidden`,children:[(0,M.jsx)(`div`,{className:`fixed inset-0 bg-black/50`,onClick:n}),(0,M.jsxs)(`div`,{className:`relative flex h-screen w-64 flex-col bg-zinc-900`,children:[(0,M.jsx)(`button`,{type:`button`,onClick:n,className:`absolute right-3 top-4 rounded-md p-1 text-zinc-400 hover:text-zinc-100`,"aria-label":`Close sidebar`,children:(0,M.jsx)(H,{className:`h-5 w-5`})}),(0,M.jsx)(Lc,{onLinkClick:n})]})]}),(0,M.jsx)(`div`,{className:`sticky top-0 hidden h-screen w-64 flex-col border-r border-zinc-800 bg-zinc-900 lg:flex`,children:(0,M.jsx)(Lc,{})})]})}function zc(){return(0,M.jsxs)(`div`,{className:`flex min-h-screen`,children:[(0,M.jsx)(Rc,{}),(0,M.jsx)(`main`,{className:`flex-1 overflow-y-auto bg-zinc-950 p-6 lg:p-8`,children:(0,M.jsx)(gt,{})})]})}function Bc(){return(0,M.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-zinc-950`,children:(0,M.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,M.jsx)(`div`,{className:`h-8 w-8 animate-spin rounded-full border-2 border-zinc-700 border-t-cyan-400`}),(0,M.jsx)(`p`,{className:`mt-4 text-sm text-zinc-500`,children:`Connecting to panel server...`})]})})}function Vc({onRetry:e}){return(0,M.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-zinc-950`,children:(0,M.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,M.jsx)(Br,{className:`mb-4 h-12 w-12 text-red-400`}),(0,M.jsx)(`h1`,{className:`mb-2 font-mono text-xl font-bold text-zinc-100`,children:`Unable to connect`}),(0,M.jsx)(`p`,{className:`mb-6 max-w-md text-center text-zinc-400`,children:`Could not reach the Lamaste panel server. Make sure the server is running and try again.`}),(0,M.jsx)(`button`,{type:`button`,onClick:e,className:`rounded-md bg-cyan-400 px-4 py-2 font-medium text-zinc-900 transition-colors hover:bg-cyan-300`,children:`Retry`})]})})}var Hc=/^(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,Uc=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function Wc({domain:e,onComplete:t}){let[n,r]=(0,g.useState)(e??``),[i,a]=(0,g.useState)(``),[o,s]=(0,g.useState)({}),c=N(),l=F({mutationFn:async e=>{let t=await fetch(`/api/onboarding/domain`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok){let e=await t.json();throw Error(e.error||`Request failed`)}return t.json()},onSuccess:()=>{c.invalidateQueries({queryKey:[`onboarding`,`status`]}),t()}});function u(){let e={};return Hc.test(n)||(e.domain=`Enter a valid domain name (e.g. example.com)`),Uc.test(i)||(e.email=`Enter a valid email address`),s(e),Object.keys(e).length===0}function d(e){e.preventDefault(),u()&&l.mutate({domain:n.trim(),email:i.trim()})}return(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h2`,{className:`mb-2 text-xl font-semibold text-white`,children:`Configure your domain`}),(0,M.jsx)(`p`,{className:`mb-6 text-sm text-zinc-400`,children:`Enter the domain you want to use for Lamaste. You will need to configure DNS records in the next step.`}),l.isError&&(0,M.jsx)(`div`,{className:`mb-4 rounded-md bg-red-500/10 border border-red-500/20 px-4 py-3 text-sm text-red-400`,children:l.error.message}),(0,M.jsxs)(`form`,{onSubmit:d,className:`space-y-5`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`label`,{htmlFor:`domain`,className:`mb-1.5 block text-sm font-medium text-zinc-300`,children:`Domain`}),(0,M.jsx)(`input`,{id:`domain`,type:`text`,placeholder:`example.com`,value:n,onChange:e=>{r(e.target.value),s(e=>({...e,domain:void 0}))},className:`w-full rounded-md border border-zinc-600 bg-zinc-900 px-3 py-2 font-mono text-sm text-white placeholder-zinc-500 focus:border-cyan-400 focus:outline-none focus:ring-1 focus:ring-cyan-400`}),o.domain&&(0,M.jsx)(`p`,{className:`mt-1 text-xs text-red-400`,children:o.domain})]}),(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`label`,{htmlFor:`email`,className:`mb-1.5 block text-sm font-medium text-zinc-300`,children:`Email`}),(0,M.jsx)(`input`,{id:`email`,type:`email`,placeholder:`you@example.com`,value:i,onChange:e=>{a(e.target.value),s(e=>({...e,email:void 0}))},className:`w-full rounded-md border border-zinc-600 bg-zinc-900 px-3 py-2 font-mono text-sm text-white placeholder-zinc-500 focus:border-cyan-400 focus:outline-none focus:ring-1 focus:ring-cyan-400`}),(0,M.jsx)(`p`,{className:`mt-1 text-xs text-zinc-500`,children:`Used for Let's Encrypt certificate registration`}),o.email&&(0,M.jsx)(`p`,{className:`mt-1 text-xs text-red-400`,children:o.email})]}),(0,M.jsx)(`div`,{className:`flex justify-end pt-2`,children:(0,M.jsxs)(`button`,{type:`submit`,disabled:l.isPending,className:`flex items-center gap-2 rounded-md bg-cyan-500 px-6 py-2 font-medium text-white transition-colors hover:bg-cyan-600 disabled:opacity-50`,children:[l.isPending&&(0,M.jsx)(B,{size:16,className:`animate-spin`}),l.isPending?`Saving...`:`Save & Continue`]})})]})]})}function Y({text:e}){let[t,n]=(0,g.useState)(!1);function r(){navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),2e3)})}return(0,M.jsxs)(`button`,{type:`button`,onClick:r,className:`ml-2 inline-flex items-center text-zinc-500 transition-colors hover:text-zinc-300`,title:`Copy to clipboard`,children:[(0,M.jsx)(Kr,{size:14}),t&&(0,M.jsx)(`span`,{className:`ml-1 text-xs text-green-400`,children:`Copied`})]})}function Gc({type:e,name:t,value:n}){return(0,M.jsxs)(`tr`,{className:`border-b border-zinc-700 last:border-b-0`,children:[(0,M.jsx)(`td`,{className:`px-3 py-2.5 font-mono text-sm text-cyan-400`,children:e}),(0,M.jsx)(`td`,{className:`px-3 py-2.5 font-mono text-sm text-zinc-300`,children:t}),(0,M.jsx)(`td`,{className:`px-3 py-2.5 font-mono text-sm text-zinc-300`,children:(0,M.jsxs)(`span`,{className:`inline-flex items-center`,children:[n,(0,M.jsx)(Y,{text:n})]})})]})}function Kc({name:e,ok:t,resolvedIps:n,expectedIp:r}){return(0,M.jsxs)(`div`,{className:`flex items-start gap-2`,children:[t?(0,M.jsx)(Hr,{size:18,className:`mt-0.5 shrink-0 text-green-400`}):(0,M.jsx)(Ur,{size:18,className:`mt-0.5 shrink-0 text-red-400`}),(0,M.jsxs)(`div`,{className:`text-sm`,children:[(0,M.jsx)(`span`,{className:t?`text-green-400`:`text-red-400`,children:e}),t?(0,M.jsxs)(`span`,{className:`text-zinc-400`,children:[` resolves to `,r]}):n.length>0?(0,M.jsxs)(`span`,{className:`text-zinc-400`,children:[` `,`resolves to `,n.join(`, `),` (expected `,r,`)`]}):(0,M.jsx)(`span`,{className:`text-zinc-400`,children:` does not resolve`})]})]})}function qc({name:e,ok:t,expectedIp:n,missingText:r}){return(0,M.jsxs)(`div`,{className:`flex items-start gap-2`,children:[t?(0,M.jsx)(Hr,{size:18,className:`mt-0.5 shrink-0 text-green-400`}):(0,M.jsx)(Hi,{size:18,className:`mt-0.5 shrink-0 text-yellow-400`}),(0,M.jsxs)(`div`,{className:`text-sm`,children:[(0,M.jsx)(`span`,{className:t?`text-green-400`:`text-yellow-400`,children:e}),t?(0,M.jsxs)(`span`,{className:`text-zinc-400`,children:[` resolves to `,n]}):(0,M.jsxs)(`span`,{className:`text-zinc-400`,children:[` `,r]})]})]})}function Jc({result:e}){return e?(0,M.jsxs)(`div`,{className:`mt-5 space-y-3 rounded-md border border-zinc-700 bg-zinc-900 p-4`,children:[e.records.map(t=>(0,M.jsx)(Kc,{name:t.name,ok:t.ok,resolvedIps:t.resolvedIps,expectedIp:e.expectedIp},t.name)),(0,M.jsx)(qc,{name:`*.${e.domain}`,ok:e.wildcardOk,expectedIp:e.expectedIp,missingText:`not configured — you can add individual subdomain records later`}),(0,M.jsx)(qc,{name:e.domain,ok:e.apexOk,expectedIp:e.expectedIp,missingText:`does not point here — only needed to serve a site on the domain itself`}),(0,M.jsx)(`p`,{className:`text-sm text-zinc-400`,children:e.message})]}):null}function Yc({domain:e,ip:t,onComplete:n,onBack:r}){let[i,a]=(0,g.useState)(null),o=N(),s=F({mutationFn:async()=>{let e=await fetch(`/api/onboarding/verify-dns`,{method:`POST`});if(!e.ok){let t=await e.json();throw Error(t.error||`Verification failed`)}return e.json()},onSuccess:e=>{a(e),e.ok&&o.invalidateQueries({queryKey:[`onboarding`,`status`]})}});function c(){s.mutate()}function l(){n()}return(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h2`,{className:`mb-2 text-xl font-semibold text-white`,children:`Configure DNS records`}),(0,M.jsx)(`p`,{className:`mb-5 text-sm text-zinc-400`,children:`Add these DNS records at your domain registrar or DNS provider.`}),s.isError&&(0,M.jsx)(`div`,{className:`mb-4 rounded-md bg-red-500/10 border border-red-500/20 px-4 py-3 text-sm text-red-400`,children:s.error.message}),(0,M.jsx)(`div`,{className:`overflow-hidden rounded-md border border-zinc-700`,children:(0,M.jsxs)(`table`,{className:`w-full text-left`,children:[(0,M.jsx)(`thead`,{children:(0,M.jsxs)(`tr`,{className:`border-b border-zinc-700 bg-zinc-800/50`,children:[(0,M.jsx)(`th`,{className:`px-3 py-2 text-xs font-medium uppercase tracking-wider text-zinc-500`,children:`Type`}),(0,M.jsx)(`th`,{className:`px-3 py-2 text-xs font-medium uppercase tracking-wider text-zinc-500`,children:`Name`}),(0,M.jsx)(`th`,{className:`px-3 py-2 text-xs font-medium uppercase tracking-wider text-zinc-500`,children:`Value`})]})}),(0,M.jsxs)(`tbody`,{className:`bg-zinc-900`,children:[(0,M.jsx)(Gc,{type:`A`,name:`*.${e}`,value:t}),(0,M.jsx)(Gc,{type:`A`,name:e,value:t})]})]})}),(0,M.jsx)(`p`,{className:`mt-3 text-xs italic text-zinc-500`,children:`DNS propagation can take up to 48 hours, but usually completes within a few minutes.`}),(0,M.jsxs)(`p`,{className:`mt-1 text-xs text-zinc-500`,children:[`The wildcard record (*.`,e,`) covers the panel, auth and tunnel subdomains Lamaste needs and every tunnel you create later. Without it, add an A record for each of panel.`,e,`, auth.`,e,` and tunnel.`,e,`.`]}),(0,M.jsxs)(`p`,{className:`mt-1 text-xs text-zinc-500`,children:[`The record for `,e,` itself is optional — it is only needed to serve a site on the domain, and can stay with another host until then.`]}),(0,M.jsx)(Jc,{result:i}),(0,M.jsxs)(`div`,{className:`mt-6 flex items-center justify-between`,children:[(0,M.jsx)(`button`,{type:`button`,onClick:r,className:`text-sm text-zinc-400 transition-colors hover:text-zinc-200`,children:`Back`}),(0,M.jsxs)(`div`,{className:`flex gap-3`,children:[(0,M.jsxs)(`button`,{type:`button`,onClick:c,disabled:s.isPending,className:`flex items-center gap-2 rounded-md bg-cyan-500 px-6 py-2 font-medium text-white transition-colors hover:bg-cyan-600 disabled:opacity-50`,children:[s.isPending&&(0,M.jsx)(B,{size:16,className:`animate-spin`}),s.isPending?`Verifying...`:`Verify DNS`]}),i?.ok&&(0,M.jsx)(`button`,{type:`button`,onClick:l,className:`rounded-md bg-green-600 px-6 py-2 font-medium text-white transition-colors hover:bg-green-700`,children:`Continue`})]})]})]})}var Xc=1e4;function Zc(){let[e,t]=(0,g.useState)([]),[n,r]=(0,g.useState)(!1),[i,a]=(0,g.useState)(!1),[o,s]=(0,g.useState)(null),[c,l]=(0,g.useState)(null),[u,d]=(0,g.useState)({current:0,total:0}),[f,p]=(0,g.useState)([]),m=(0,g.useRef)(null),h=(0,g.useRef)(0),_=(0,g.useRef)(null),v=(0,g.useRef)(!1),y=(0,g.useRef)(null);return(0,g.useEffect)(()=>{v.current=!1;function e(){if(v.current)return;let n=`${window.location.protocol===`https:`?`wss:`:`ws:`}//${window.location.host}/api/onboarding/provision/stream`,i=new WebSocket(n);m.current=i,i.onopen=()=>{h.current=0},i.onmessage=e=>{let n;try{n=JSON.parse(e.data)}catch{return}if(n.type===`state`){n.tasks&&t(n.tasks),n.error&&(a(!0),s(n.error)),n.result&&(l(n.result),r(!0));return}if(n.task===`complete`&&n.status===`done`){r(!0),n.result&&l(n.result);return}n.status===`error`&&(a(!0),s({task:n.task,message:n.error||n.message})),n.progress&&d(n.progress),n.log&&p(e=>[...e.slice(-500),n.log]),n.message&&p(e=>[...e.slice(-500),n.message]),t(e=>{let t=e.findIndex(e=>e.id===n.task);if(t!==-1){let r=[...e];return r[t]={...r[t],status:n.status,message:n.message,log:n.log},r}return[...e,{id:n.task,title:n.title||n.task,status:n.status,message:n.message,log:n.log}]})},i.onclose=()=>{if(v.current)return;let t=h.current,n=Math.min(1e3*2**t,Xc);h.current=t+1,_.current=setTimeout(()=>{v.current||e()},n)},i.onerror=()=>{}}return y.current=e,e(),()=>{v.current=!0,_.current&&clearTimeout(_.current),m.current&&m.current.close()}},[]),{tasks:e,isComplete:n,isError:i,error:o,result:c,progress:u,logs:f,retry:(0,g.useCallback)(async()=>{a(!1),s(null),r(!1),l(null),t([]),p([]),d({current:0,total:0});let e=await fetch(`/api/onboarding/provision`,{method:`POST`});if(!e.ok){let t=await e.json();throw Error(t.error||`Failed to start provisioning`)}},[])}}function Qc({status:e}){switch(e){case`done`:return(0,M.jsx)(Hr,{size:18,className:`shrink-0 text-green-400`});case`error`:return(0,M.jsx)(Ur,{size:18,className:`shrink-0 text-red-400`});case`running`:return(0,M.jsx)(B,{size:18,className:`shrink-0 animate-spin text-cyan-400`});default:return(0,M.jsx)(Wr,{size:18,className:`shrink-0 text-zinc-600`})}}function $c({task:e,isLast:t}){let n=e.status===`pending`?`text-zinc-500`:`text-white`;return(0,M.jsxs)(`div`,{className:`flex gap-3`,children:[(0,M.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,M.jsx)(Qc,{status:e.status}),!t&&(0,M.jsx)(`div`,{className:`mt-1 w-px flex-1 bg-zinc-700`})]}),(0,M.jsxs)(`div`,{className:`pb-4`,children:[(0,M.jsx)(`p`,{className:`text-sm font-medium ${n}`,children:e.title}),e.message&&e.status!==`pending`&&(0,M.jsx)(`p`,{className:`mt-0.5 text-xs text-zinc-400`,children:e.message})]})]})}function el({onComplete:e}){let{tasks:t,isComplete:n,isError:r,error:i,result:a,progress:o,logs:s,retry:c}=Zc(),[l,u]=(0,g.useState)(!1),[d,f]=(0,g.useState)(!1),p=(0,g.useRef)(null);(0,g.useEffect)(()=>{l||(u(!0),fetch(`/api/onboarding/provision`,{method:`POST`}).catch(()=>{}))},[l]),(0,g.useEffect)(()=>{p.current&&(p.current.scrollTop=p.current.scrollHeight)},[s]),(0,g.useEffect)(()=>{if(n&&e){let t=setTimeout(()=>{e(a)},1e3);return()=>clearTimeout(t)}},[n,e,a]);async function m(){f(!0);try{await c()}catch{}finally{f(!1)}}return(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h2`,{className:`mb-2 text-xl font-semibold text-white`,children:`Setting up your Lamaste`}),(0,M.jsx)(`div`,{className:`mb-5 rounded-md border border-amber-700 bg-amber-900/30 px-4 py-3`,children:(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(Hi,{size:16,className:`shrink-0 text-amber-300`}),(0,M.jsx)(`p`,{className:`text-sm text-amber-300`,children:`Do not close this page while provisioning is in progress`})]})}),(0,M.jsx)(`div`,{className:`mb-4`,children:t.map((e,n)=>(0,M.jsx)($c,{task:e,isLast:n===t.length-1},e.id))}),(0,M.jsx)(`div`,{ref:p,className:`mb-3 max-h-48 overflow-y-auto rounded border border-zinc-800 bg-zinc-950 p-3 font-mono text-sm text-zinc-400`,children:s.length===0?(0,M.jsx)(`p`,{className:`italic text-zinc-600`,children:`Waiting for provisioning to start...`}):s.map((e,t)=>(0,M.jsx)(`p`,{className:`leading-relaxed`,children:e},t))}),o.total>0&&(0,M.jsxs)(`p`,{className:`mb-4 text-sm text-zinc-500`,children:[`Step `,o.current,` of `,o.total]}),r&&i&&(0,M.jsxs)(`div`,{className:`mb-4 rounded-md border border-red-700 bg-red-900/30 px-4 py-3`,children:[(0,M.jsx)(`p`,{className:`text-sm font-medium text-red-300`,children:`Provisioning failed`}),(0,M.jsx)(`p`,{className:`mt-1 text-xs text-red-400`,children:i.message}),(0,M.jsxs)(`button`,{type:`button`,onClick:m,disabled:d,className:`mt-3 flex items-center gap-2 rounded-md bg-cyan-500 px-6 py-2 font-medium text-white transition-colors hover:bg-cyan-600 disabled:opacity-50`,children:[d&&(0,M.jsx)(B,{size:16,className:`animate-spin`}),d?`Retrying...`:`Retry`]})]}),n&&(0,M.jsx)(`div`,{className:`text-center`,children:(0,M.jsx)(`p`,{className:`text-sm text-green-400`,children:`Provisioning complete. Continuing...`})})]})}function tl({text:e}){let[t,n]=(0,g.useState)(!1);function r(){navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),2e3)})}return(0,M.jsxs)(`button`,{type:`button`,onClick:r,className:`ml-2 inline-flex items-center text-zinc-500 transition-colors hover:text-zinc-300`,title:`Copy to clipboard`,children:[(0,M.jsx)(Kr,{size:14}),t&&(0,M.jsx)(`span`,{className:`ml-1 text-xs text-green-400`,children:`Copied`})]})}function nl(e){try{let t=new URL(e);if(t.protocol===`https:`)return t.href}catch{}return``}function rl({result:e,ip:t}){let[n,r]=(0,g.useState)(!1),i=e?.adminUsername||`admin`,a=e?.adminPassword||``,o=nl(e?.panelUrl||``),s=nl(e?.authUrl||``),c=`https://${t}:9292`;return(0,M.jsxs)(`div`,{className:`animate-fade-in`,children:[(0,M.jsxs)(`div`,{className:`mb-6 text-center`,children:[(0,M.jsx)(Ii,{size:48,className:`mx-auto mb-3 text-green-400`}),(0,M.jsx)(`h2`,{className:`text-2xl font-bold text-white`,children:`Lamaste is ready!`}),(0,M.jsx)(`p`,{className:`mt-1 text-sm text-zinc-400`,children:`Your stack is fully configured and operational.`})]}),(0,M.jsxs)(`div`,{className:`mb-5 rounded-lg border border-zinc-700 bg-zinc-800 p-6`,children:[(0,M.jsx)(`h3`,{className:`mb-1 font-semibold text-white`,children:`Admin Credentials`}),(0,M.jsx)(`p`,{className:`mb-4 text-sm text-amber-400`,children:`Save these credentials — they won't be shown again.`}),(0,M.jsxs)(`div`,{className:`space-y-3`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsx)(`span`,{className:`text-sm text-zinc-400`,children:`Username`}),(0,M.jsxs)(`span`,{className:`inline-flex items-center font-mono text-sm text-white`,children:[i,(0,M.jsx)(tl,{text:i})]})]}),(0,M.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,M.jsx)(`span`,{className:`text-sm text-zinc-400`,children:`Password`}),(0,M.jsxs)(`span`,{className:`inline-flex items-center font-mono text-sm text-white`,children:[n?a:`•`.repeat(16),(0,M.jsx)(`button`,{type:`button`,onClick:()=>r(e=>!e),className:`ml-2 text-zinc-500 transition-colors hover:text-zinc-300`,title:n?`Hide password`:`Show password`,children:n?(0,M.jsx)(Qr,{size:14}):(0,M.jsx)($r,{size:14})}),(0,M.jsx)(tl,{text:a})]})]})]})]}),(0,M.jsxs)(`div`,{className:`mb-5 space-y-2`,children:[(0,M.jsx)(`h3`,{className:`text-sm font-semibold text-zinc-300`,children:`Access URLs`}),(0,M.jsxs)(`div`,{className:`flex items-center justify-between rounded border border-zinc-700 bg-zinc-900 px-3 py-2`,children:[(0,M.jsx)(`span`,{className:`text-sm text-zinc-400`,children:`Panel`}),(0,M.jsxs)(`a`,{href:o,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-sm text-cyan-400 hover:underline`,children:[o,(0,M.jsx)(Zr,{size:12})]})]}),(0,M.jsxs)(`div`,{className:`flex items-center justify-between rounded border border-zinc-700 bg-zinc-900 px-3 py-2`,children:[(0,M.jsx)(`span`,{className:`text-sm text-zinc-400`,children:`Auth Portal`}),(0,M.jsxs)(`a`,{href:s,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 text-sm text-cyan-400 hover:underline`,children:[s,(0,M.jsx)(Zr,{size:12})]})]}),(0,M.jsxs)(`div`,{className:`flex items-center justify-between rounded border border-zinc-700 bg-zinc-900 px-3 py-2`,children:[(0,M.jsx)(`span`,{className:`text-sm text-zinc-400`,children:`IP Access`}),(0,M.jsxs)(`span`,{className:`text-sm text-zinc-400`,children:[c,` `,(0,M.jsx)(`span`,{className:`text-xs text-zinc-500`,children:`(requires client certificate)`})]})]})]}),(0,M.jsxs)(`p`,{className:`mb-6 text-xs text-zinc-400`,children:[`On your first login to `,s?new URL(s).hostname:`the auth portal`,`, you will be prompted to set up two-factor authentication (TOTP). Use an authenticator app like Google Authenticator or Authy.`]}),(0,M.jsx)(`div`,{className:`flex justify-center`,children:(0,M.jsx)(`a`,{href:`/`,className:`rounded-md bg-cyan-500 px-8 py-2.5 font-medium text-white transition-colors hover:bg-cyan-600`,children:`Go to Dashboard`})})]})}var il=4;function al(e){switch(e){case`FRESH`:return 1;case`DOMAIN_SET`:return 2;case`DNS_READY`:case`PROVISIONING`:return 3;case`COMPLETED`:return 4;default:return 1}}function ol({current:e}){return(0,M.jsxs)(`div`,{className:`mb-6 flex items-center gap-3`,children:[(0,M.jsxs)(`span`,{className:`text-sm text-zinc-400`,children:[`Step `,e,` of `,il]}),(0,M.jsx)(`div`,{className:`flex gap-1.5`,children:Array.from({length:il},(t,n)=>{let r=n+1,i=`h-2 w-2 rounded-full`;return r<e?i+=` bg-cyan-400`:r===e?i+=` border-2 border-cyan-400 bg-transparent`:i+=` bg-zinc-600`,(0,M.jsx)(`div`,{className:i},r)})})]})}function sl(){let{status:e,domain:t,ip:n,isLoading:r,isError:i,refetch:a}=yr(),[o,s]=(0,g.useState)(null),[c,l]=(0,g.useState)(null),u=al(e),d=o!==null&&o<u?o:u;if(r)return(0,M.jsx)(Bc,{});if(i)return(0,M.jsx)(Vc,{onRetry:a});function f(){a(),s(null)}function p(){a(),s(null)}function m(){s(1)}function h(e){l(e),s(4),a()}let _;return d===1?_=(0,M.jsx)(Wc,{domain:t,onComplete:f}):d===2?_=(0,M.jsx)(Yc,{domain:t,ip:n,onComplete:p,onBack:m}):d===3?_=(0,M.jsx)(el,{onComplete:h}):d===4&&(_=(0,M.jsx)(rl,{result:c,ip:n})),(0,M.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-zinc-950`,children:(0,M.jsxs)(`div`,{className:`mx-4 w-full max-w-xl rounded-lg border border-zinc-800 bg-zinc-900 p-8`,children:[(0,M.jsx)(`h1`,{className:`mb-2 font-mono text-2xl font-bold text-cyan-400`,children:`Lamaste`}),(0,M.jsx)(ol,{current:d}),_]})})}function cl(){let{pluginName:e,"*":t}=Xe();return(0,M.jsx)(xa,{pluginName:e,subPath:t||``,basePath:`/plugins/${e}`,panelUrl:window.location.origin})}function ll(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var ul=ll();function dl(e){ul=e}var fl={exec:()=>null};function X(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(ml.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var pl=(()=>{try{return!0}catch{return!1}})(),ml={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,`i`),blockquoteBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}>`)},hl=/^(?:[ \t]*(?:\n|$))+/,gl=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,_l=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,vl=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,yl=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,bl=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,xl=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Sl=X(xl).replace(/bull/g,bl).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),Cl=X(xl).replace(/bull/g,bl).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),wl=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Tl=/^[^\n]+/,El=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Dl=X(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,El).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ol=X(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,bl).getRegex(),kl=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,Al=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,jl=X(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,Al).replace(`tag`,kl).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ml=X(wl).replace(`hr`,vl).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,kl).getRegex(),Nl={blockquote:X(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,Ml).getRegex(),code:gl,def:Dl,fences:_l,heading:yl,hr:vl,html:jl,lheading:Sl,list:Ol,newline:hl,paragraph:Ml,table:fl,text:Tl},Pl=X(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,vl).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,kl).getRegex(),Fl={...Nl,lheading:Cl,table:Pl,paragraph:X(wl).replace(`hr`,vl).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,Pl).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,kl).getRegex()},Il={...Nl,html:X(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,Al).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:fl,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:X(wl).replace(`hr`,vl).replace(`heading`,` *#{1,6} *[^
|
|
16
|
+
]`).replace(`lheading`,Sl).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},Ll=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Rl=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,zl=/^( {2,}|\\)\n(?!\s*$)/,Bl=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Z=/[\p{P}\p{S}]/u,Vl=/[\s\p{P}\p{S}]/u,Hl=/[^\s\p{P}\p{S}]/u,Ul=X(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,Vl).getRegex(),Wl=/(?!~)[\p{P}\p{S}]/u,Gl=/(?!~)[\s\p{P}\p{S}]/u,Kl=/(?:[^\s\p{P}\p{S}]|~)/u,ql=X(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,pl?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),Jl=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Yl=X(Jl,`u`).replace(/punct/g,Z).getRegex(),Xl=X(Jl,`u`).replace(/punct/g,Wl).getRegex(),Zl=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,Ql=X(Zl,`gu`).replace(/notPunctSpace/g,Hl).replace(/punctSpace/g,Vl).replace(/punct/g,Z).getRegex(),$l=X(Zl,`gu`).replace(/notPunctSpace/g,Kl).replace(/punctSpace/g,Gl).replace(/punct/g,Wl).getRegex(),eu=X(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,Hl).replace(/punctSpace/g,Vl).replace(/punct/g,Z).getRegex(),tu=X(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,Z).getRegex(),nu=X(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Hl).replace(/punctSpace/g,Vl).replace(/punct/g,Z).getRegex(),ru=X(/\\(punct)/,`gu`).replace(/punct/g,Z).getRegex(),iu=X(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),au=X(Al).replace(`(?:-->|$)`,`-->`).getRegex(),ou=X(`^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,au).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),su=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,cu=X(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,su).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),lu=X(/^!?\[(label)\]\[(ref)\]/).replace(`label`,su).replace(`ref`,El).getRegex(),uu=X(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,El).getRegex(),du=X(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,lu).replace(`nolink`,uu).getRegex(),fu=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,pu={_backpedal:fl,anyPunctuation:ru,autolink:iu,blockSkip:ql,br:zl,code:Rl,del:fl,delLDelim:fl,delRDelim:fl,emStrongLDelim:Yl,emStrongRDelimAst:Ql,emStrongRDelimUnd:eu,escape:Ll,link:cu,nolink:uu,punctuation:Ul,reflink:lu,reflinkSearch:du,tag:ou,text:Bl,url:fl},mu={...pu,link:X(/^!?\[(label)\]\((.*?)\)/).replace(`label`,su).getRegex(),reflink:X(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,su).getRegex()},hu={...pu,emStrongRDelimAst:$l,emStrongLDelim:Xl,delLDelim:tu,delRDelim:nu,url:X(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,fu).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:X(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,fu).getRegex()},gu={...hu,br:X(zl).replace(`{2,}`,`*`).getRegex(),text:X(hu.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},_u={normal:Nl,gfm:Fl,pedantic:Il},vu={normal:pu,gfm:hu,breaks:gu,pedantic:mu},yu={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},bu=e=>yu[e];function xu(e,t){if(t){if(ml.escapeTest.test(e))return e.replace(ml.escapeReplace,bu)}else if(ml.escapeTestNoEncode.test(e))return e.replace(ml.escapeReplaceNoEncode,bu);return e}function Su(e){try{e=encodeURI(e).replace(ml.percentDecode,`%`)}catch{return null}return e}function Cu(e,t){let n=e.replace(ml.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(ml.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``);for(;r<n.length;r++)n[r]=n[r].trim().replace(ml.slashPipe,`|`);return n}function wu(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function Tu(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function Eu(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function Du(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`);r.state.inLink=!0;let c={type:e[0].charAt(0)===`!`?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,c}function Ou(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
|
|
17
|
+
`).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e}).join(`
|
|
18
|
+
`)}var ku=class{options;rules;lexer;constructor(e){this.options=e||ul}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=t[0].replace(this.rules.other.codeRemoveIndent,``);return{type:`code`,raw:t[0],codeBlockStyle:`indented`,text:this.options.pedantic?e:wu(e,`
|
|
19
|
+
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=Ou(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=wu(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:wu(t[0],`
|
|
20
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=wu(t[0],`
|
|
21
|
+
`).split(`
|
|
22
|
+
`),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o;for(o=0;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
|
|
23
|
+
`),c=s.replace(this.rules.other.blockquoteSetextReplace,`
|
|
24
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
|
|
25
|
+
${s}`:s,r=r?`${r}
|
|
26
|
+
${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`)break;if(u?.type===`blockquote`){let t=u,a=t.raw+`
|
|
27
|
+
`+e.join(`
|
|
28
|
+
`),o=this.blockquote(a);i[i.length-1]=o,n=n.substring(0,n.length-t.raw.length)+o.raw,r=r.substring(0,r.length-t.text.length)+o.text;break}else if(u?.type===`list`){let t=u,a=t.raw+`
|
|
29
|
+
`+e.join(`
|
|
30
|
+
`),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
|
|
31
|
+
`);continue}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=Eu(t[2].split(`
|
|
32
|
+
`,1)[0],t[1].length),l=e.split(`
|
|
33
|
+
`,1)[0],u=!c.trim(),d=0;if(this.options.pedantic?(d=2,s=c.trimStart()):u?d=t[1].length+1:(d=c.search(this.rules.other.nonSpaceChar),d=d>4?1:d,s=c.slice(d),d+=t[1].length),u&&this.rules.other.blankLine.test(l)&&(r+=l+`
|
|
34
|
+
`,e=e.substring(l.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),a=this.rules.other.headingBeginRegex(d),o=this.rules.other.htmlBeginRegex(d),f=this.rules.other.blockquoteBeginRegex(d);for(;e;){let p=e.split(`
|
|
35
|
+
`,1)[0],m;if(l=p,this.options.pedantic?(l=l.replace(this.rules.other.listReplaceNesting,` `),m=l):m=l.replace(this.rules.other.tabCharGlobal,` `),i.test(l)||a.test(l)||o.test(l)||f.test(l)||t.test(l)||n.test(l))break;if(m.search(this.rules.other.nonSpaceChar)>=d||!l.trim())s+=`
|
|
36
|
+
`+m.slice(d);else{if(u||c.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(c)||a.test(c)||n.test(c))break;s+=`
|
|
37
|
+
`+l}u=!l.trim(),r+=p+`
|
|
38
|
+
`,e=e.substring(p.length+1),c=m.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0)),i.items.push({type:`list_item`,raw:r,task:!!this.options.gfm&&this.rules.other.listIsTask.test(s),loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e of i.items){if(this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]),e.task){if(e.text=e.text.replace(this.rules.other.listReplaceTask,``),e.tokens[0]?.type===`text`||e.tokens[0]?.type===`paragraph`){e.tokens[0].raw=e.tokens[0].raw.replace(this.rules.other.listReplaceTask,``),e.tokens[0].text=e.tokens[0].text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}}let t=this.rules.other.listTaskCheckbox.exec(e.raw);if(t){let n={type:`checkbox`,raw:t[0]+` `,checked:t[0]!==`[ ]`};e.checked=n.checked,i.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=n.raw+e.tokens[0].raw,e.tokens[0].text=n.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(n)):e.tokens.unshift({type:`paragraph`,raw:n.raw,text:n.raw,tokens:[n]}):e.tokens.unshift(n)}}if(!i.loose){let t=e.tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}}if(i.loose)for(let e of i.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return i}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:`html`,block:!0,raw:t[0],pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:t[0],href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=Cu(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
|
|
39
|
+
`):[],a={type:`table`,raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(Cu(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:t[0],depth:t[2].charAt(0)===`=`?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
|
|
40
|
+
`?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=wu(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=Tu(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let n=t[2],r=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):``;return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),Du(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,`$1`),title:r&&r.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `).toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return Du(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=0,c=r[0][0]===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+n);(r=c.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){o+=a;continue}else if((r[5]||r[6])&&n%3&&!((n+a)%3)){s+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+s);let t=[...r[0]][0].length,c=e.slice(0,n+r.index+t+a);if(Math.min(n,a)%2){let e=c.slice(1,-1);return{type:`em`,raw:c,text:e,tokens:this.lexer.inlineTokens(e)}}let l=c.slice(2,-2);return{type:`strong`,raw:c,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:t[0],escaped:e}}}},Au=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||ul,this.options.tokenizer=this.options.tokenizer||new ku,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:ml,block:_u.normal,inline:vu.normal};this.options.pedantic?(t.block=_u.pedantic,t.inline=vu.pedantic):this.options.gfm&&(t.block=_u.gfm,this.options.breaks?t.inline=vu.breaks:t.inline=vu.gfm),this.tokenizer.rules=t}static get rules(){return{block:_u,inline:vu}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(ml.carriageReturn,`
|
|
41
|
+
`),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){for(this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(ml.tabCharGlobal,` `).replace(ml.spaceLine,``));e;){let r;if(this.options.extensions?.block?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let n=t.at(-1);r.raw.length===1&&n!==void 0?n.raw+=`
|
|
42
|
+
`:t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
43
|
+
`)?``:`
|
|
44
|
+
`)+r.raw,n.text+=`
|
|
45
|
+
`+r.text,this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if(r=this.tokenizer.fences(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.heading(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.hr(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.blockquote(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.list(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.html(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
46
|
+
`)?``:`
|
|
47
|
+
`)+r.raw,n.text+=`
|
|
48
|
+
`+r.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},t.push(r));continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(this.state.top&&(r=this.tokenizer.paragraph(i))){let a=t.at(-1);n&&a?.type===`paragraph`?(a.raw+=(a.raw.endsWith(`
|
|
49
|
+
`)?``:`
|
|
50
|
+
`)+r.raw,a.text+=`
|
|
51
|
+
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(r),n=i.length!==e.length,e=e.substring(r.raw.length);continue}if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
52
|
+
`)?``:`
|
|
53
|
+
`)+r.raw,n.text+=`
|
|
54
|
+
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}else throw Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=e,r=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!==null;)e.includes(r[0].slice(r[0].lastIndexOf(`[`)+1,-1))&&(n=n.slice(0,r.index)+`[`+`a`.repeat(r[0].length-2)+`]`+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!==null;)n=n.slice(0,r.index)+`++`+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!==null;)i=r[2]?r[2].length:0,n=n.slice(0,r.index+i)+`[`+`a`.repeat(r[0].length-i-2)+`]`+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let a=!1,o=``;for(;e;){a||(o=``),a=!1;let r;if(this.options.extensions?.inline?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.escape(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.tag(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.link(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length);let n=t.at(-1);r.type===`text`&&n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(r=this.tokenizer.emStrong(e,n,o)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.codespan(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.br(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.del(e,n,o)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.autolink(e)){e=e.substring(r.raw.length),t.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(e))){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(r=this.tokenizer.inlineText(i)){e=e.substring(r.raw.length),r.raw.slice(-1)!==`_`&&(o=r.raw.slice(-1)),a=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}else throw Error(t)}}return t}},ju=class{options;parser;constructor(e){this.options=e||ul}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(ml.notSpaceStart)?.[0],i=e.replace(ml.endingNewline,``)+`
|
|
55
|
+
`;return r?`<pre><code class="language-`+xu(r)+`">`+(n?i:xu(i,!0))+`</code></pre>
|
|
56
|
+
`:`<pre><code>`+(n?i:xu(i,!0))+`</code></pre>
|
|
57
|
+
`}blockquote({tokens:e}){return`<blockquote>
|
|
58
|
+
${this.parser.parse(e)}</blockquote>
|
|
59
|
+
`}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
60
|
+
`}hr(e){return`<hr>
|
|
61
|
+
`}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
|
|
62
|
+
`+r+`</`+i+`>
|
|
63
|
+
`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
|
|
64
|
+
`}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
65
|
+
`}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&=`<tbody>${r}</tbody>`,`<table>
|
|
66
|
+
<thead>
|
|
67
|
+
`+t+`</thead>
|
|
68
|
+
`+r+`</table>
|
|
69
|
+
`}tablerow({text:e}){return`<tr>
|
|
70
|
+
${e}</tr>
|
|
71
|
+
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
72
|
+
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${xu(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=Su(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+xu(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=Su(e);if(i===null)return xu(n);e=i;let a=`<img src="${e}" alt="${xu(n)}"`;return t&&(a+=` title="${xu(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:xu(e.text)}},Mu=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},Nu=class e{options;renderer;textRenderer;constructor(e){this.options=e||ul,this.options.renderer=this.options.renderer||new ju,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Mu}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},Pu=class{options;block;constructor(e){this.options=e||ul}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?Au.lex:Au.lexInline}provideParser(e=this.block){return e?Nu.parse:Nu.parseInline}},Fu=new class{defaults=ll();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Nu;Renderer=ju;TextRenderer=Mu;Lexer=Au;Tokenizer=ku;Hooks=Pu;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new ju(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new ku(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new Pu;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];Pu.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&Pu.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:t[r]=(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Au.lex(e,t??this.defaults)}parser(e,t){return Nu.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?Au.lex:Au.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?Nu.parse:Nu.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?Au.lex:Au.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?Nu.parse:Nu.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
|
|
73
|
+
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+xu(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function Q(e,t){return Fu.parse(e,t)}Q.options=Q.setOptions=function(e){return Fu.setOptions(e),Q.defaults=Fu.defaults,dl(Q.defaults),Q},Q.getDefaults=ll,Q.defaults=ul,Q.use=function(...e){return Fu.use(...e),Q.defaults=Fu.defaults,dl(Q.defaults),Q},Q.walkTokens=function(e,t){return Fu.walkTokens(e,t)},Q.parseInline=Fu.parseInline,Q.Parser=Nu,Q.parser=Nu.parse,Q.Renderer=ju,Q.TextRenderer=Mu,Q.Lexer=Au,Q.lexer=Au.lex,Q.Tokenizer=ku,Q.Hooks=Pu,Q.parse=Q,Q.options,Q.setOptions,Q.use,Q.walkTokens,Q.parseInline,Nu.parse,Au.lex;var{entries:Iu,setPrototypeOf:Lu,isFrozen:Ru,getPrototypeOf:zu,getOwnPropertyDescriptor:Bu}=Object,{freeze:Vu,seal:Hu,create:Uu}=Object,{apply:Wu,construct:Gu}=typeof Reflect<`u`&&Reflect;Vu||=function(e){return e},Hu||=function(e){return e},Wu||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},Gu||=function(e){return new e(...[...arguments].slice(1))};var Ku=fd(Array.prototype.forEach),qu=fd(Array.prototype.lastIndexOf),Ju=fd(Array.prototype.pop),Yu=fd(Array.prototype.push),Xu=fd(Array.prototype.splice),Zu=Array.isArray,Qu=fd(String.prototype.toLowerCase),$u=fd(String.prototype.toString),ed=fd(String.prototype.match),td=fd(String.prototype.replace),nd=fd(String.prototype.indexOf),rd=fd(String.prototype.trim),id=fd(Number.prototype.toString),ad=fd(Boolean.prototype.toString),od=typeof BigInt>`u`?null:fd(BigInt.prototype.toString),sd=typeof Symbol>`u`?null:fd(Symbol.prototype.toString),cd=fd(Object.prototype.hasOwnProperty),ld=fd(Object.prototype.toString),ud=fd(RegExp.prototype.test),dd=pd(TypeError);function fd(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return Wu(e,t,n)}}function pd(e){return function(){return Gu(e,[...arguments])}}function $(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Qu;if(Lu&&Lu(e,null),!Zu(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(Ru(t)||(t[r]=e),i=e)}e[i]=!0}return e}function md(e){for(let t=0;t<e.length;t++)cd(e,t)||(e[t]=null);return e}function hd(e){let t=Uu(null);for(let[n,r]of Iu(e))cd(e,n)&&(Zu(r)?t[n]=md(r):r&&typeof r==`object`&&r.constructor===Object?t[n]=hd(r):t[n]=r);return t}function gd(e){switch(typeof e){case`string`:return e;case`number`:return id(e);case`boolean`:return ad(e);case`bigint`:return od?od(e):`0`;case`symbol`:return sd?sd(e):`Symbol()`;case`undefined`:return ld(e);case`function`:case`object`:{if(e===null)return ld(e);let t=e,n=_d(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:ld(e)}return ld(e)}default:return ld(e)}}function _d(e,t){for(;e!==null;){let n=Bu(e,t);if(n){if(n.get)return fd(n.get);if(typeof n.value==`function`)return fd(n.value)}e=zu(e)}function n(){return null}return n}function vd(e){try{return ud(e,``),!0}catch{return!1}}var yd=Vu(`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(`.`)),bd=Vu(`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(`.`)),xd=Vu([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),Sd=Vu([`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`]),Cd=Vu(`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(`.`)),wd=Vu([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),Td=Vu([`#text`]),Ed=Vu(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.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(`.`)),Dd=Vu(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-rendering.textlength.type.u1.u2.unicode.values.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),Od=Vu(`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(`.`)),kd=Vu([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),Ad=Hu(/\{\{[\w\W]*|[\w\W]*\}\}/gm),jd=Hu(/<%[\w\W]*|[\w\W]*%>/gm),Md=Hu(/\$\{[\w\W]*/gm),Nd=Hu(/^data-[\-\w.\u00B7-\uFFFF]+$/),Pd=Hu(/^aria-[\-\w]+$/),Fd=Hu(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Id=Hu(/^(?:\w+script|data):/i),Ld=Hu(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Rd=Hu(/^html$/i),zd=Hu(/^[a-z][.\w]*(-[.\w]+)+$/i),Bd=Object.freeze({__proto__:null,ARIA_ATTR:Pd,ATTR_WHITESPACE:Ld,CUSTOM_ELEMENT:zd,DATA_ATTR:Nd,DOCTYPE_NAME:Rd,ERB_EXPR:jd,IS_ALLOWED_URI:Fd,IS_SCRIPT_OR_DATA:Id,MUSTACHE_EXPR:Ad,TMPLIT_EXPR:Md}),Vd={element:1,text:3,progressingInstruction:7,comment:8,document:9},Hd=function(){return typeof window>`u`?null:window},Ud=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}},Wd=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Gd(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Hd(),t=e=>Gd(e);if(t.version=`3.4.2`,t.removed=[],!e||!e.document||e.document.nodeType!==Vd.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e,r=n,i=r.currentScript,{DocumentFragment:a,HTMLTemplateElement:o,Node:s,Element:c,NodeFilter:l,NamedNodeMap:u=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:d,DOMParser:f,trustedTypes:p}=e,m=c.prototype,h=_d(m,`cloneNode`),g=_d(m,`remove`),_=_d(m,`nextSibling`),v=_d(m,`childNodes`),y=_d(m,`parentNode`);if(typeof o==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let b,x=``,{implementation:S,createNodeIterator:C,createDocumentFragment:w,getElementsByTagName:T}=n,{importNode:E}=r,D=Wd();t.isSupported=typeof Iu==`function`&&typeof y==`function`&&S&&S.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:ee,ERB_EXPR:te,TMPLIT_EXPR:ne,DATA_ATTR:re,ARIA_ATTR:ie,IS_SCRIPT_OR_DATA:ae,ATTR_WHITESPACE:oe,CUSTOM_ELEMENT:se}=Bd,{IS_ALLOWED_URI:ce}=Bd,le=null,ue=$({},[...yd,...bd,...xd,...Cd,...Td]),O=null,de=$({},[...Ed,...Dd,...Od,...kd]),k=Object.seal(Uu(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}})),fe=null,pe=null,me=Object.seal(Uu(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),he=!0,ge=!0,_e=!1,ve=!0,ye=!1,be=!0,xe=!1,Se=!1,Ce=!1,we=!1,Te=!1,Ee=!1,De=!0,Oe=!1,ke=`user-content-`,Ae=!0,je=!1,Me={},Ne=null,Pe=$({},[`annotation-xml`,`audio`,`colgroup`,`desc`,`foreignobject`,`head`,`iframe`,`math`,`mi`,`mn`,`mo`,`ms`,`mtext`,`noembed`,`noframes`,`noscript`,`plaintext`,`script`,`style`,`svg`,`template`,`thead`,`title`,`video`,`xmp`]),Fe=null,Ie=$({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Le=null,Re=$({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),ze=`http://www.w3.org/1998/Math/MathML`,Be=`http://www.w3.org/2000/svg`,Ve=`http://www.w3.org/1999/xhtml`,He=Ve,Ue=!1,We=null,Ge=$({},[ze,Be,Ve],$u),Ke=$({},[`mi`,`mo`,`mn`,`ms`,`mtext`]),qe=$({},[`annotation-xml`]),Je=$({},[`title`,`style`,`font`,`a`,`script`]),Ye=null,Xe=[`application/xhtml+xml`,`text/html`],A=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={}),e=hd(e),Ye=Xe.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,A=Ye===`application/xhtml+xml`?$u:Qu,le=cd(e,`ALLOWED_TAGS`)&&Zu(e.ALLOWED_TAGS)?$({},e.ALLOWED_TAGS,A):ue,O=cd(e,`ALLOWED_ATTR`)&&Zu(e.ALLOWED_ATTR)?$({},e.ALLOWED_ATTR,A):de,We=cd(e,`ALLOWED_NAMESPACES`)&&Zu(e.ALLOWED_NAMESPACES)?$({},e.ALLOWED_NAMESPACES,$u):Ge,Le=cd(e,`ADD_URI_SAFE_ATTR`)&&Zu(e.ADD_URI_SAFE_ATTR)?$(hd(Re),e.ADD_URI_SAFE_ATTR,A):Re,Fe=cd(e,`ADD_DATA_URI_TAGS`)&&Zu(e.ADD_DATA_URI_TAGS)?$(hd(Ie),e.ADD_DATA_URI_TAGS,A):Ie,Ne=cd(e,`FORBID_CONTENTS`)&&Zu(e.FORBID_CONTENTS)?$({},e.FORBID_CONTENTS,A):Pe,fe=cd(e,`FORBID_TAGS`)&&Zu(e.FORBID_TAGS)?$({},e.FORBID_TAGS,A):hd({}),pe=cd(e,`FORBID_ATTR`)&&Zu(e.FORBID_ATTR)?$({},e.FORBID_ATTR,A):hd({}),Me=cd(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?hd(e.USE_PROFILES):e.USE_PROFILES:!1,he=e.ALLOW_ARIA_ATTR!==!1,ge=e.ALLOW_DATA_ATTR!==!1,_e=e.ALLOW_UNKNOWN_PROTOCOLS||!1,ve=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ye=e.SAFE_FOR_TEMPLATES||!1,be=e.SAFE_FOR_XML!==!1,xe=e.WHOLE_DOCUMENT||!1,we=e.RETURN_DOM||!1,Te=e.RETURN_DOM_FRAGMENT||!1,Ee=e.RETURN_TRUSTED_TYPE||!1,Ce=e.FORCE_BODY||!1,De=e.SANITIZE_DOM!==!1,Oe=e.SANITIZE_NAMED_PROPS||!1,Ae=e.KEEP_CONTENT!==!1,je=e.IN_PLACE||!1,ce=vd(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:Fd,He=typeof e.NAMESPACE==`string`?e.NAMESPACE:Ve,Ke=cd(e,`MATHML_TEXT_INTEGRATION_POINTS`)&&e.MATHML_TEXT_INTEGRATION_POINTS&&typeof e.MATHML_TEXT_INTEGRATION_POINTS==`object`?hd(e.MATHML_TEXT_INTEGRATION_POINTS):$({},[`mi`,`mo`,`mn`,`ms`,`mtext`]),qe=cd(e,`HTML_INTEGRATION_POINTS`)&&e.HTML_INTEGRATION_POINTS&&typeof e.HTML_INTEGRATION_POINTS==`object`?hd(e.HTML_INTEGRATION_POINTS):$({},[`annotation-xml`]);let t=cd(e,`CUSTOM_ELEMENT_HANDLING`)&&e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING==`object`?hd(e.CUSTOM_ELEMENT_HANDLING):Uu(null);if(k=Uu(null),cd(t,`tagNameCheck`)&&$e(t.tagNameCheck)&&(k.tagNameCheck=t.tagNameCheck),cd(t,`attributeNameCheck`)&&$e(t.attributeNameCheck)&&(k.attributeNameCheck=t.attributeNameCheck),cd(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(k.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),ye&&(ge=!1),Te&&(we=!0),Me&&(le=$({},Td),O=Uu(null),Me.html===!0&&($(le,yd),$(O,Ed)),Me.svg===!0&&($(le,bd),$(O,Dd),$(O,kd)),Me.svgFilters===!0&&($(le,xd),$(O,Dd),$(O,kd)),Me.mathMl===!0&&($(le,Cd),$(O,Od),$(O,kd))),me.tagCheck=null,me.attributeCheck=null,cd(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?me.tagCheck=e.ADD_TAGS:Zu(e.ADD_TAGS)&&(le===ue&&(le=hd(le)),$(le,e.ADD_TAGS,A))),cd(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?me.attributeCheck=e.ADD_ATTR:Zu(e.ADD_ATTR)&&(O===de&&(O=hd(O)),$(O,e.ADD_ATTR,A))),cd(e,`ADD_URI_SAFE_ATTR`)&&Zu(e.ADD_URI_SAFE_ATTR)&&$(Le,e.ADD_URI_SAFE_ATTR,A),cd(e,`FORBID_CONTENTS`)&&Zu(e.FORBID_CONTENTS)&&(Ne===Pe&&(Ne=hd(Ne)),$(Ne,e.FORBID_CONTENTS,A)),cd(e,`ADD_FORBID_CONTENTS`)&&Zu(e.ADD_FORBID_CONTENTS)&&(Ne===Pe&&(Ne=hd(Ne)),$(Ne,e.ADD_FORBID_CONTENTS,A)),Ae&&(le[`#text`]=!0),xe&&$(le,[`html`,`head`,`body`]),le.table&&($(le,[`tbody`]),delete fe.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw dd(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw dd(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);b=e.TRUSTED_TYPES_POLICY,x=b.createHTML(``)}else b===void 0&&(b=Ud(p,i)),b!==null&&typeof x==`string`&&(x=b.createHTML(``));Vu&&Vu(e),Ze=e},tt=$({},[...bd,...xd,...Sd]),nt=$({},[...Cd,...wd]),rt=function(e){let t=y(e);(!t||!t.tagName)&&(t={namespaceURI:He,tagName:`template`});let n=Qu(e.tagName),r=Qu(t.tagName);return We[e.namespaceURI]?e.namespaceURI===Be?t.namespaceURI===Ve?n===`svg`:t.namespaceURI===ze?n===`svg`&&(r===`annotation-xml`||Ke[r]):!!tt[n]:e.namespaceURI===ze?t.namespaceURI===Ve?n===`math`:t.namespaceURI===Be?n===`math`&&qe[r]:!!nt[n]:e.namespaceURI===Ve?t.namespaceURI===Be&&!qe[r]||t.namespaceURI===ze&&!Ke[r]?!1:!nt[n]&&(Je[n]||!tt[n]):!!(Ye===`application/xhtml+xml`&&We[e.namespaceURI]):!1},it=function(e){Yu(t.removed,{element:e});try{y(e).removeChild(e)}catch{g(e)}},at=function(e,n){try{Yu(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch{Yu(t.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e===`is`)if(we||Te)try{it(n)}catch{}else try{n.setAttribute(e,``)}catch{}},ot=function(e){let t=null,r=null;if(Ce)e=`<remove></remove>`+e;else{let t=ed(e,/^[\r\n\t ]+/);r=t&&t[0]}Ye===`application/xhtml+xml`&&He===Ve&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=b?b.createHTML(e):e;if(He===Ve)try{t=new f().parseFromString(i,Ye)}catch{}if(!t||!t.documentElement){t=S.createDocument(He,`template`,null);try{t.documentElement.innerHTML=Ue?x:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),He===Ve?T.call(t,xe?`html`:`body`)[0]:xe?t.documentElement:a},st=function(e){return C.call(e.ownerDocument||e,e,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},ct=function(e){return e instanceof d&&(typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||!(e.attributes instanceof u)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`)},lt=function(e){return typeof s==`function`&&e instanceof s};function ut(e,n,r){Ku(e,e=>{e.call(t,n,r,Ze)})}let dt=function(e){let n=null;if(ut(D.beforeSanitizeElements,e,null),ct(e))return it(e),!0;let r=A(e.nodeName);if(ut(D.uponSanitizeElement,e,{tagName:r,allowedTags:le}),be&&e.hasChildNodes()&&!lt(e.firstElementChild)&&ud(/<[/\w!]/g,e.innerHTML)&&ud(/<[/\w!]/g,e.textContent)||be&&e.namespaceURI===Ve&&r===`style`&<(e.firstElementChild)||e.nodeType===Vd.progressingInstruction||be&&e.nodeType===Vd.comment&&ud(/<[/\w]/g,e.data))return it(e),!0;if(fe[r]||!(me.tagCheck instanceof Function&&me.tagCheck(r))&&!le[r]){if(!fe[r]&&mt(r)&&(k.tagNameCheck instanceof RegExp&&ud(k.tagNameCheck,r)||k.tagNameCheck instanceof Function&&k.tagNameCheck(r)))return!1;if(Ae&&!Ne[r]){let t=y(e)||e.parentNode,n=v(e)||e.childNodes;if(n&&t){let r=n.length;for(let i=r-1;i>=0;--i){let r=h(n[i],!0);t.insertBefore(r,_(e))}}}return it(e),!0}return e instanceof c&&!rt(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&ud(/<\/no(script|embed|frames)/i,e.innerHTML)?(it(e),!0):(ye&&e.nodeType===Vd.text&&(n=e.textContent,Ku([ee,te,ne],e=>{n=td(n,e,` `)}),e.textContent!==n&&(Yu(t.removed,{element:e.cloneNode()}),e.textContent=n)),ut(D.afterSanitizeElements,e,null),!1)},ft=function(e,t,r){if(pe[t]||De&&(t===`id`||t===`name`)&&(r in n||r in Qe))return!1;let i=O[t]||me.attributeCheck instanceof Function&&me.attributeCheck(t,e);if(!(ge&&!pe[t]&&ud(re,t))&&!(he&&ud(ie,t))){if(!i||pe[t]){if(!(mt(e)&&(k.tagNameCheck instanceof RegExp&&ud(k.tagNameCheck,e)||k.tagNameCheck instanceof Function&&k.tagNameCheck(e))&&(k.attributeNameCheck instanceof RegExp&&ud(k.attributeNameCheck,t)||k.attributeNameCheck instanceof Function&&k.attributeNameCheck(t,e))||t===`is`&&k.allowCustomizedBuiltInElements&&(k.tagNameCheck instanceof RegExp&&ud(k.tagNameCheck,r)||k.tagNameCheck instanceof Function&&k.tagNameCheck(r))))return!1}else if(!Le[t]&&!ud(ce,td(r,oe,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&nd(r,`data:`)===0&&Fe[e])&&!(_e&&!ud(ae,td(r,oe,``)))&&r)return!1}return!0},pt=$({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),mt=function(e){return!pt[Qu(e)]&&ud(se,e)},ht=function(e){ut(D.beforeSanitizeAttributes,e,null);let{attributes:n}=e;if(!n||ct(e))return;let r={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:O,forceKeepAttr:void 0},i=n.length;for(;i--;){let{name:a,namespaceURI:o,value:s}=n[i],c=A(a),l=s,u=a===`value`?l:rd(l);if(r.attrName=c,r.attrValue=u,r.keepAttr=!0,r.forceKeepAttr=void 0,ut(D.uponSanitizeAttribute,e,r),u=r.attrValue,Oe&&(c===`id`||c===`name`)&&nd(u,ke)!==0&&(at(a,e),u=ke+u),be&&ud(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,u)){at(a,e);continue}if(c===`attributename`&&ed(u,`href`)){at(a,e);continue}if(r.forceKeepAttr)continue;if(!r.keepAttr){at(a,e);continue}if(!ve&&ud(/\/>/i,u)){at(a,e);continue}ye&&Ku([ee,te,ne],e=>{u=td(u,e,` `)});let d=A(e.nodeName);if(!ft(d,c,u)){at(a,e);continue}if(b&&typeof p==`object`&&typeof p.getAttributeType==`function`&&!o)switch(p.getAttributeType(d,c)){case`TrustedHTML`:u=b.createHTML(u);break;case`TrustedScriptURL`:u=b.createScriptURL(u);break}if(u!==l)try{o?e.setAttributeNS(o,a,u):e.setAttribute(a,u),ct(e)?it(e):Ju(t.removed)}catch{at(a,e)}}ut(D.afterSanitizeAttributes,e,null)},gt=function(e){let t=null,n=st(e);for(ut(D.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)ut(D.uponSanitizeShadowNode,t,null),dt(t),ht(t),t.content instanceof a&>(t.content);ut(D.afterSanitizeShadowDOM,e,null)};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,o=null,c=null,l=null;if(Ue=!e,Ue&&(e=`<!-->`),typeof e!=`string`&&!lt(e)&&(e=gd(e),typeof e!=`string`))throw dd(`dirty is not a string, aborting`);if(!t.isSupported)return e;if(Se||et(n),t.removed=[],typeof e==`string`&&(je=!1),je){let t=e.nodeName;if(typeof t==`string`){let e=A(t);if(!le[e]||fe[e])throw dd(`root node is forbidden and cannot be sanitized in-place`)}}else if(e instanceof s)i=ot(`<!---->`),o=i.ownerDocument.importNode(e,!0),o.nodeType===Vd.element&&o.nodeName===`BODY`||o.nodeName===`HTML`?i=o:i.appendChild(o);else{if(!we&&!ye&&!xe&&e.indexOf(`<`)===-1)return b&&Ee?b.createHTML(e):e;if(i=ot(e),!i)return we?null:Ee?x:``}i&&Ce&&it(i.firstChild);let u=st(je?e:i);for(;c=u.nextNode();)dt(c),ht(c),c.content instanceof a&>(c.content);if(je)return e;if(we){if(ye){i.normalize();let e=i.innerHTML;Ku([ee,te,ne],t=>{e=td(e,t,` `)}),i.innerHTML=e}if(Te)for(l=w.call(i.ownerDocument);i.firstChild;)l.appendChild(i.firstChild);else l=i;return(O.shadowroot||O.shadowrootmode)&&(l=E.call(r,l,!0)),l}let d=xe?i.outerHTML:i.innerHTML;return xe&&le[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&ud(Rd,i.ownerDocument.doctype.name)&&(d=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
|
|
74
|
+
`+d),ye&&Ku([ee,te,ne],e=>{d=td(d,e,` `)}),b&&Ee?b.createHTML(d):d},t.setConfig=function(){et(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}),Se=!0},t.clearConfig=function(){Ze=null,Se=!1},t.isValidAttribute=function(e,t,n){return Ze||et({}),ft(A(e),A(t),n)},t.addHook=function(e,t){typeof t==`function`&&Yu(D[e],t)},t.removeHook=function(e,t){if(t!==void 0){let n=qu(D[e],t);return n===-1?void 0:Xu(D[e],n,1)[0]}return Ju(D[e])},t.removeHooks=function(e){D[e]=[]},t.removeAllHooks=function(){D=Wd()},t}var Kd=Gd(),qd=new Q.Renderer;function Jd(e){let t=e,n;do n=t,t=t.replace(/<[^>]*>/g,``);while(t!==n);return t}qd.heading=({text:e,depth:t})=>`<h${t} id="${Jd(e).toLowerCase().replace(/[^\w\s-]/g,``).replace(/\s+/g,`-`).replace(/-+/g,`-`).replace(/^-|-$/g,``)}">${e}</h${t}>`,Q.setOptions({renderer:qd});function Yd(e){let t=[],n=/^(#{2,3})\s+(.+)$/gm,r;for(;(r=n.exec(e))!==null;){let e=r[1].length,n=r[2].replace(/`([^`]+)`/g,`$1`),i=Jd(n).toLowerCase().replace(/[^\w\s-]/g,``).replace(/\s+/g,`-`).replace(/-+/g,`-`).replace(/^-|-$/g,``);t.push({depth:e,text:n,id:i})}return t}function Xd({index:e,currentSlug:t,sidebarOpen:n,onClose:r}){return(0,M.jsxs)(M.Fragment,{children:[n&&(0,M.jsxs)(`div`,{className:`fixed inset-0 z-50 lg:hidden`,children:[(0,M.jsx)(`div`,{className:`fixed inset-0 bg-black/50`,onClick:r}),(0,M.jsxs)(`div`,{className:`relative flex h-screen w-72 flex-col overflow-y-auto bg-zinc-900 border-r border-zinc-800`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between border-b border-zinc-800 px-4 py-4`,children:[(0,M.jsx)(`span`,{className:`text-sm font-semibold text-zinc-300`,children:`Documentation`}),(0,M.jsx)(`button`,{type:`button`,onClick:r,className:`text-zinc-400 hover:text-zinc-100`,children:(0,M.jsx)(H,{className:`h-4 w-4`})})]}),(0,M.jsx)(Zd,{index:e,currentSlug:t,onLinkClick:r})]})]}),(0,M.jsxs)(`div`,{className:`sticky top-0 hidden h-screen w-72 flex-shrink-0 flex-col overflow-y-auto border-r border-zinc-800 bg-zinc-900/50 lg:flex`,children:[(0,M.jsx)(`div`,{className:`border-b border-zinc-800 px-4 py-4`,children:(0,M.jsxs)(Pt,{to:`/docs`,className:`text-sm font-semibold text-zinc-300 hover:text-cyan-400 flex items-center gap-2`,children:[(0,M.jsx)(Mr,{size:14,className:`text-cyan-400`}),`Documentation`]})}),(0,M.jsx)(Zd,{index:e,currentSlug:t})]})]})}function Zd({index:e,currentSlug:t,onLinkClick:n}){return(0,M.jsx)(`nav`,{className:`flex-1 px-3 py-4 space-y-5`,children:e.sections.map(e=>(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h3`,{className:`px-2 mb-1 text-xs font-semibold uppercase tracking-wider text-zinc-500`,children:e.title}),(0,M.jsx)(`ul`,{className:`space-y-0.5`,children:e.pages.map(e=>(0,M.jsx)(`li`,{children:(0,M.jsx)(Pt,{to:`/docs/${e.slug}`,onClick:n,className:[`block rounded-md px-2 py-1.5 text-sm transition-colors`,t===e.slug?`text-cyan-400 bg-zinc-800/50 font-medium`:`text-zinc-400 hover:text-zinc-100 hover:bg-zinc-800/30`].join(` `),children:e.title})},e.slug))})]},e.title))})}function Qd({toc:e,activeId:t}){return e.length===0?null:(0,M.jsxs)(`div`,{className:`sticky top-6 hidden xl:block w-56 flex-shrink-0`,children:[(0,M.jsxs)(`h4`,{className:`mb-3 text-xs font-semibold uppercase tracking-wider text-zinc-500 flex items-center gap-1.5`,children:[(0,M.jsx)(hi,{size:12}),`On this page`]}),(0,M.jsx)(`ul`,{className:`space-y-1 border-l border-zinc-800`,children:e.map(e=>(0,M.jsx)(`li`,{children:(0,M.jsx)(`a`,{href:`#${e.id}`,className:[`block border-l-2 -ml-px text-xs transition-colors py-1`,e.depth===3?`pl-5`:`pl-3`,t===e.id?`border-cyan-400 text-cyan-400`:`border-transparent text-zinc-500 hover:text-zinc-300 hover:border-zinc-600`].join(` `),children:e.text})},e.id))})]})}function $d({prevPage:e,nextPage:t}){return!e&&!t?null:(0,M.jsxs)(`div`,{className:`mt-12 flex items-stretch gap-4 border-t border-zinc-800 pt-6`,children:[e?(0,M.jsxs)(Pt,{to:`/docs/${e.slug}`,className:`flex-1 group rounded-lg border border-zinc-800 p-4 hover:border-zinc-700 transition-colors`,children:[(0,M.jsxs)(`span`,{className:`text-xs text-zinc-500 flex items-center gap-1`,children:[(0,M.jsx)(Lr,{size:12}),`Previous`]}),(0,M.jsx)(`span`,{className:`mt-1 block text-sm text-zinc-300 group-hover:text-cyan-400 transition-colors`,children:e.title})]}):(0,M.jsx)(`div`,{className:`flex-1`}),t?(0,M.jsxs)(Pt,{to:`/docs/${t.slug}`,className:`flex-1 group rounded-lg border border-zinc-800 p-4 hover:border-zinc-700 transition-colors text-right`,children:[(0,M.jsxs)(`span`,{className:`text-xs text-zinc-500 flex items-center justify-end gap-1`,children:[`Next`,(0,M.jsx)(Rr,{size:12})]}),(0,M.jsx)(`span`,{className:`mt-1 block text-sm text-zinc-300 group-hover:text-cyan-400 transition-colors`,children:t.title})]}):(0,M.jsx)(`div`,{className:`flex-1`})]})}function ef(){let{"*":e}=Xe(),t=Ke(),n=(0,g.useRef)(null),[r,i]=(0,g.useState)(null),[a,o]=(0,g.useState)(!1),[s,c]=(0,g.useState)(``),[l,u]=(0,g.useReducer)((e,t)=>{switch(t.type){case`fetch`:return{content:``,loading:!0,error:null};case`success`:return{content:t.content,loading:!1,error:null};case`error`:return{content:``,loading:!1,error:t.error};default:return e}},{content:``,loading:!0,error:null}),{content:d,loading:f,error:p}=l;(0,g.useEffect)(()=>{fetch(`/docs/_index.json`).then(e=>e.json()).then(i).catch(e=>u({type:`error`,error:`Failed to load docs index: ${e.message}`}))},[]);let m=(0,g.useMemo)(()=>r?r.sections.flatMap(e=>e.pages):[],[r]),h=e||m[0]?.slug;(0,g.useEffect)(()=>{!e&&m.length>0&&t(`/docs/${m[0].slug}`,{replace:!0})},[e,m,t]);let _=(0,g.useMemo)(()=>m.find(e=>e.slug===h),[m,h]),v=m.indexOf(_),y=v>0?m[v-1]:null,b=v<m.length-1?m[v+1]:null,x=(0,g.useMemo)(()=>!r||!_?null:r.sections.find(e=>e.pages.some(e=>e.slug===h)),[r,_,h]);(0,g.useEffect)(()=>{if(!_)return;let e=!1;return u({type:`fetch`}),fetch(`/docs/${_.file}`).then(e=>{if(!e.ok)throw Error(`Document not found (${e.status})`);return e.text()}).then(t=>{e||u({type:`success`,content:t})}).catch(t=>{e||u({type:`error`,error:t.message})}),()=>{e=!0}},[_]),(0,g.useEffect)(()=>{n.current?.scrollTo(0,0)},[h]);let S=(0,g.useMemo)(()=>Yd(d),[d]),C=(0,g.useMemo)(()=>d?Q.parse(d):``,[d]),w=(0,g.useCallback)(()=>{if(!n.current)return;let e=n.current.querySelectorAll(`h2[id], h3[id]`),t=``;for(let n of e)n.getBoundingClientRect().top<=100&&(t=n.id);c(t)},[]);return(0,g.useEffect)(()=>{let e=n.current;if(e)return e.addEventListener(`scroll`,w),()=>e.removeEventListener(`scroll`,w)},[w]),r?(0,M.jsxs)(`div`,{className:`flex h-screen bg-zinc-950`,children:[(0,M.jsx)(Xd,{index:r,currentSlug:h,sidebarOpen:a,onClose:()=>o(!1)}),(0,M.jsxs)(`div`,{ref:n,className:`flex-1 overflow-y-auto`,children:[(0,M.jsx)(`button`,{type:`button`,onClick:()=>o(!0),className:`sticky top-4 left-4 z-40 rounded-md bg-zinc-900 border border-zinc-800 p-2 text-zinc-400 hover:text-zinc-100 lg:hidden m-4`,"aria-label":`Open docs navigation`,children:(0,M.jsx)(bi,{className:`h-4 w-4`})}),(0,M.jsxs)(`div`,{className:`flex gap-8 max-w-5xl mx-auto px-6 py-8 lg:px-8`,children:[(0,M.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[x&&_&&(0,M.jsxs)(`div`,{className:`mb-6 flex items-center gap-2 text-xs text-zinc-500`,children:[(0,M.jsx)(Pt,{to:`/docs`,className:`hover:text-zinc-300`,children:`Docs`}),(0,M.jsx)(Rr,{size:10}),(0,M.jsx)(`span`,{children:x.title}),(0,M.jsx)(Rr,{size:10}),(0,M.jsx)(`span`,{className:`text-zinc-400`,children:_.title})]}),f&&(0,M.jsx)(`div`,{className:`text-zinc-500 text-sm py-12`,children:`Loading...`}),p&&(0,M.jsxs)(`div`,{className:`rounded-lg border border-yellow-500/20 bg-yellow-500/5 p-6 text-sm text-yellow-400`,children:[(0,M.jsx)(`p`,{className:`font-semibold mb-2`,children:`Page Not Available`}),(0,M.jsx)(`p`,{className:`text-yellow-500/80`,children:p}),(0,M.jsx)(Pt,{to:`/docs/what-is-lamaste`,className:`mt-4 inline-block text-cyan-400 hover:underline`,children:`Go to Introduction`})]}),!f&&!p&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`article`,{className:`prose prose-invert prose-zinc max-w-none
|
|
75
|
+
prose-headings:font-mono prose-headings:scroll-mt-20
|
|
76
|
+
prose-a:text-cyan-400 prose-a:no-underline hover:prose-a:underline
|
|
77
|
+
prose-code:text-cyan-300 prose-code:before:content-none prose-code:after:content-none
|
|
78
|
+
prose-code:rounded prose-code:bg-zinc-800 prose-code:px-1.5 prose-code:py-0.5
|
|
79
|
+
prose-pre:bg-zinc-900 prose-pre:border prose-pre:border-zinc-800
|
|
80
|
+
prose-blockquote:border-cyan-400/30 prose-blockquote:text-zinc-400
|
|
81
|
+
prose-strong:text-zinc-200
|
|
82
|
+
prose-th:text-zinc-300 prose-td:text-zinc-400
|
|
83
|
+
prose-hr:border-zinc-800
|
|
84
|
+
prose-img:rounded-lg`,dangerouslySetInnerHTML:{__html:Kd.sanitize(C)}}),(0,M.jsx)($d,{prevPage:y,nextPage:b})]})]}),(0,M.jsx)(Qd,{toc:S,activeId:s})]})]})]}):(0,M.jsx)(`div`,{className:`flex h-screen items-center justify-center bg-zinc-950`,children:(0,M.jsx)(`div`,{className:`text-zinc-500 text-sm`,children:`Loading documentation...`})})}var tf=new Qn({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}});function nf(){let{status:e,domain:t,isLoading:n,isError:r,refetch:i}=yr();return n?(0,M.jsx)(Bc,{}):r?(0,M.jsx)(Vc,{onRetry:i}):e===`COMPLETED`?(0,M.jsx)(yt,{children:(0,M.jsxs)(_t,{element:(0,M.jsx)(zc,{}),children:[(0,M.jsx)(_t,{path:`/`,element:(0,M.jsx)(Ea,{})}),(0,M.jsx)(_t,{path:`/tunnels`,element:(0,M.jsx)(K,{})}),(0,M.jsx)(_t,{path:`/sites`,element:(0,M.jsx)(Ga,{domain:t})}),(0,M.jsx)(_t,{path:`/users`,element:(0,M.jsx)(Eo,{})}),(0,M.jsx)(_t,{path:`/certificates`,element:(0,M.jsx)(Yo,{})}),(0,M.jsx)(_t,{path:`/services`,element:(0,M.jsx)(Ma,{})}),(0,M.jsx)(_t,{path:`/tickets`,element:(0,M.jsx)(as,{})}),(0,M.jsx)(_t,{path:`/plugins`,element:(0,M.jsx)(ec,{})}),(0,M.jsx)(_t,{path:`/storage`,element:(0,M.jsx)(xc,{})}),(0,M.jsx)(_t,{path:`/audit`,element:(0,M.jsx)(Ec,{})}),(0,M.jsx)(_t,{path:`/plugins/:pluginName/*`,element:(0,M.jsx)(cl,{})}),(0,M.jsx)(_t,{path:`/settings`,element:(0,M.jsx)(vc,{hasDomain:!!t})}),(0,M.jsx)(_t,{path:`/docs/*`,element:(0,M.jsx)(ef,{})})]})}):(0,M.jsx)(sl,{})}function rf(){return(0,M.jsx)(tr,{client:tf,children:(0,M.jsx)(xr,{client:jc,children:(0,M.jsx)(ta,{children:(0,M.jsx)(fa,{children:(0,M.jsx)(Qi,{children:(0,M.jsx)(jt,{children:(0,M.jsx)(nf,{})})})})})})})}_.createRoot(document.getElementById(`root`)).render((0,M.jsx)(g.StrictMode,{children:(0,M.jsx)(rf,{})}));
|