@lamalibre/create-lamaste 4.3.0 → 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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/src/lib/service-config.js +6 -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 +50 -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 +6 -6
- 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 +12 -11
- 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 +7 -7
- 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 +393 -33
- package/vendor/docs/04-api-reference/app-host.md +87 -38
- package/vendor/docs/04-api-reference/audit-and-notifications.md +10 -10
- package/vendor/docs/04-api-reference/certificates.md +22 -19
- package/vendor/docs/04-api-reference/lifecycle-hooks.md +33 -11
- package/vendor/docs/04-api-reference/onboarding.md +1 -1
- package/vendor/docs/04-api-reference/overview.md +137 -135
- package/vendor/docs/04-api-reference/registry-and-oidc.md +1 -1
- package/vendor/docs/04-api-reference/tunnels.md +14 -10
- package/vendor/docs/05-operations/backup-and-restore.md +4 -1
- package/vendor/docs/05-operations/uninstalling.md +1 -1
- package/vendor/docs/05-operations/upgrades.md +6 -6
- package/vendor/docs/06-reference/config-files.md +94 -84
- 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 +11 -1
- package/vendor/server/package.json +4 -3
- package/vendor/server/src/commands/panel-pin.js +40 -0
- package/vendor/server/src/commands/plugin-settings.js +541 -0
- package/vendor/server/src/commands/plugins.js +94 -27
- package/vendor/server/src/panel-api.js +281 -34
- package/vendor/server/src/panel-identity.js +165 -0
- package/vendor/server/src/plugin-approval.js +78 -0
- package/vendor/server/src/plugin-settings.js +699 -0
- package/vendor/server-ui/dist/assets/index-25wo_8av.css +1 -0
- package/vendor/server-ui/dist/assets/index-CESyyK8V.js +84 -0
- package/vendor/server-ui/dist/index.html +2 -2
- package/vendor/serverd/package.json +2 -2
- package/vendor/serverd/src/index.js +9 -0
- package/vendor/serverd/src/lib/agent-presence.js +106 -0
- package/vendor/serverd/src/lib/hook-pipelines.js +20 -4
- package/vendor/serverd/src/lib/migrations/state/0012_plugin_settings_and_presence.sql +62 -0
- package/vendor/serverd/src/lib/mtls.js +44 -4
- package/vendor/serverd/src/lib/plugin-hooks.js +120 -20
- package/vendor/serverd/src/lib/plugin-hosting.js +35 -14
- package/vendor/serverd/src/lib/plugin-lifecycle.js +267 -83
- package/vendor/serverd/src/lib/plugin-settings.js +1101 -0
- package/vendor/serverd/src/lib/plugins.js +73 -22
- package/vendor/serverd/src/lib/tunnel-hooks.js +11 -0
- package/vendor/serverd/src/routes/management/plugins.js +166 -19
- package/vendor/serverd/src/routes/management/tunnels.js +21 -1
- package/vendor/server-ui/dist/assets/index-Bc5NCMSv.css +0 -1
- 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=Dn(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 M=C.ReactCurrentBatchConfig,Sn=!0;function Cn(e,t,n,r){var i=j,a=M.transition;M.transition=null;try{j=1,Tn(e,t,n,r)}finally{j=i,M.transition=a}}function wn(e,t,n,r){var i=j,a=M.transition;M.transition=null;try{j=4,Tn(e,t,n,r)}finally{j=i,M.transition=a}}function Tn(e,t,n,r){if(Sn){var i=Dn(e,t,n,r);if(i===null)pi(e,t,r,En,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=Dn(e,t,n,r),a===null&&pi(e,t,r,En,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else pi(e,t,r,null,n)}}var En=null;function Dn(e,t,n,r){if(En=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 En=e,null}function On(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 kn=null,An=null,jn=null;function Mn(){if(jn)return jn;var e,t=An,n=t.length,r,i=`value`in kn?kn.value:kn.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 jn=i.slice(e,1<r?1-r:void 0)}function Nn(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 Pn(){return!0}function Fn(){return!1}function In(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)?Pn:Fn,this.isPropagationStopped=Fn,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=Pn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=Pn)},persist:function(){},isPersistent:Pn}),t}var Ln={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Rn=In(Ln),zn=O({},Ln,{view:0,detail:0}),Bn=In(zn),Vn,Hn,Un,Wn=O({},zn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:P,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!==Un&&(Un&&e.type===`mousemove`?(Vn=e.screenX-Un.screenX,Hn=e.screenY-Un.screenY):Hn=Vn=0,Un=e),Vn)},movementY:function(e){return`movementY`in e?e.movementY:Hn}}),Gn=In(Wn),Kn=In(O({},Wn,{dataTransfer:0})),qn=In(O({},zn,{relatedTarget:0})),Jn=In(O({},Ln,{animationName:0,elapsedTime:0,pseudoElement:0})),Yn=In(O({},Ln,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Xn=In(O({},Ln,{data:0})),Zn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Qn={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`},N={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function $n(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=N[e])?!!t[e]:!1}function P(){return $n}var er=In(O({},zn,{key:function(e){if(e.key){var t=Zn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=Nn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Qn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:P,charCode:function(e){return e.type===`keypress`?Nn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?Nn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),tr=In(O({},Wn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),nr=In(O({},zn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:P})),rr=In(O({},Ln,{propertyName:0,elapsedTime:0,pseudoElement:0})),ir=In(O({},Wn,{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})),ar=[9,13,27,32],or=c&&`CompositionEvent`in window,sr=null;c&&`documentMode`in document&&(sr=document.documentMode);var cr=c&&`TextEvent`in window&&!sr,lr=c&&(!or||sr&&8<sr&&11>=sr),ur=` `,dr=!1;function fr(e,t){switch(e){case`keyup`:return ar.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function pr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var F=!1;function I(e,t){switch(e){case`compositionend`:return pr(t);case`keypress`:return t.which===32?(dr=!0,ur):null;case`textInput`:return e=t.data,e===ur&&dr?null:e;default:return null}}function mr(e,t){if(F)return e===`compositionend`||!or&&fr(e,t)?(e=Mn(),jn=An=kn=null,F=!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 lr&&t.locale!==`ko`?null:t.data;default:return null}}var hr={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 gr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!hr[e.type]:t===`textarea`}function _r(e,t,n,r){Qe(r),t=hi(t,`onChange`),0<t.length&&(n=new Rn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var vr=null,yr=null;function br(e){ci(e,0)}function xr(e){if(xe(Ui(e)))return e}function Sr(e,t){if(e===`change`)return t}var Cr=!1;if(c){var wr;if(c){var Tr=`oninput`in document;if(!Tr){var Er=document.createElement(`div`);Er.setAttribute(`oninput`,`return;`),Tr=typeof Er.oninput==`function`}wr=Tr}else wr=!1;Cr=wr&&(!document.documentMode||9<document.documentMode)}function Dr(){vr&&(vr.detachEvent(`onpropertychange`,Or),yr=vr=null)}function Or(e){if(e.propertyName===`value`&&xr(yr)){var t=[];_r(t,yr,e,Je(e)),rt(br,t)}}function kr(e,t,n){e===`focusin`?(Dr(),vr=t,yr=n,vr.attachEvent(`onpropertychange`,Or)):e===`focusout`&&Dr()}function Ar(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return xr(yr)}function jr(e,t){if(e===`click`)return xr(t)}function Mr(e,t){if(e===`input`||e===`change`)return xr(t)}function Nr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Pr=typeof Object.is==`function`?Object.is:Nr;function Fr(e,t){if(Pr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!l.call(t,i)||!Pr(e[i],t[i]))return!1}return!0}function Ir(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Lr(e,t){var n=Ir(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=Ir(n)}}function Rr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Rr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function zr(){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 Br(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 Vr(e){var t=zr(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Rr(n.ownerDocument.documentElement,n)){if(r!==null&&Br(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=Lr(n,a);var o=Lr(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 Hr=c&&`documentMode`in document&&11>=document.documentMode,Ur=null,Wr=null,Gr=null,Kr=!1;function qr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Kr||Ur==null||Ur!==Se(r)||(r=Ur,`selectionStart`in r&&Br(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}),Gr&&Fr(Gr,r)||(Gr=r,r=hi(Wr,`onSelect`),0<r.length&&(t=new Rn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Ur)))}function L(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Jr={animationend:L(`Animation`,`AnimationEnd`),animationiteration:L(`Animation`,`AnimationIteration`),animationstart:L(`Animation`,`AnimationStart`),transitionend:L(`Transition`,`TransitionEnd`)},Yr={},Xr={};c&&(Xr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Jr.animationend.animation,delete Jr.animationiteration.animation,delete Jr.animationstart.animation),`TransitionEvent`in window||delete Jr.transitionend.transition);function R(e){if(Yr[e])return Yr[e];if(!Jr[e])return e;var t=Jr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Xr)return Yr[e]=t[n];return e}var Zr=R(`animationend`),Qr=R(`animationiteration`),$r=R(`animationstart`),ei=R(`transitionend`),ti=new Map,z=`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 ni(e,t){ti.set(e,t),o(t,[e])}for(var ri=0;ri<z.length;ri++){var ii=z[ri];ni(ii.toLowerCase(),`on`+(ii[0].toUpperCase()+ii.slice(1)))}ni(Zr,`onAnimationEnd`),ni(Qr,`onAnimationIteration`),ni($r,`onAnimationStart`),ni(`dblclick`,`onDoubleClick`),ni(`focusin`,`onFocus`),ni(`focusout`,`onBlur`),ni(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 ai=`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(` `),oi=new Set(`cancel close invalid load scroll toggle`.split(` `).concat(ai));function si(e,t,n){var r=e.type||`unknown-event`;e.currentTarget=n,mt(r,t,void 0,e),e.currentTarget=null}function ci(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;si(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;si(i,s,l),a=c}}}if(ut)throw e=dt,ut=!1,dt=null,e}function B(e,t){var n=t[Ri];n===void 0&&(n=t[Ri]=new Set);var r=e+`__bubble`;n.has(r)||(fi(t,e,2,!1),n.add(r))}function li(e,t,n){var r=0;t&&(r|=4),fi(n,e,r,t)}var ui=`_reactListening`+Math.random().toString(36).slice(2);function di(e){if(!e[ui]){e[ui]=!0,i.forEach(function(t){t!==`selectionchange`&&(oi.has(t)||li(t,!1,e),li(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[ui]||(t[ui]=!0,li(`selectionchange`,!1,t))}}function fi(e,t,n,r){switch(On(t)){case 1:var i=Cn;break;case 4:i=wn;break;default:i=Tn}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 pi(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=Rn,l=e;switch(e){case`keypress`:if(Nn(n)===0)break a;case`keydown`:case`keyup`:c=er;break;case`focusin`:l=`focus`,c=qn;break;case`focusout`:l=`blur`,c=qn;break;case`beforeblur`:case`afterblur`:c=qn;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=Gn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:c=Kn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:c=nr;break;case Zr:case Qr:case $r:c=Jn;break;case ei:c=rr;break;case`scroll`:c=Bn;break;case`wheel`:c=ir;break;case`copy`:case`cut`:case`paste`:c=Yn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:c=tr}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(mi(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=Gn,h=`onMouseLeave`,f=`onMouseEnter`,p=`mouse`,(e===`pointerout`||e===`pointerover`)&&(u=tr,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=Sr;else if(gr(s))if(Cr)g=Mr;else{g=Ar;var _=kr}else (c=s.nodeName)&&c.toLowerCase()===`input`&&(s.type===`checkbox`||s.type===`radio`)&&(g=jr);if(g&&=g(e,r)){_r(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`:(gr(_)||_.contentEditable===`true`)&&(Ur=_,Wr=r,Gr=null);break;case`focusout`:Gr=Wr=Ur=null;break;case`mousedown`:Kr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Kr=!1,qr(o,n,i);break;case`selectionchange`:if(Hr)break;case`keydown`:case`keyup`:qr(o,n,i)}var v;if(or)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 F?fr(e,n)&&(y=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(y=`onCompositionStart`);y&&(lr&&n.locale!==`ko`&&(F||y!==`onCompositionStart`?y===`onCompositionEnd`&&F&&(v=Mn()):(kn=i,An=`value`in kn?kn.value:kn.textContent,F=!0)),_=hi(r,y),0<_.length&&(y=new Xn(y,e,null,n,i),o.push({event:y,listeners:_}),v?y.data=v:(v=pr(n),v!==null&&(y.data=v)))),(v=cr?I(e,n):mr(e,n))&&(r=hi(r,`onBeforeInput`),0<r.length&&(i=new Xn(`onBeforeInput`,`beforeinput`,null,n,i),o.push({event:i,listeners:r}),i.data=v))}ci(o,t)})}function mi(e,t,n){return{instance:e,listener:t,currentTarget:n}}function hi(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(mi(e,a,i)),a=it(e,t),a!=null&&r.push(mi(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(mi(n,c,s))):i||(c=it(n,a),c!=null&&o.push(mi(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 V(e){return{current:e}}function H(e){0>Ki||(e.current=Gi[Ki],Gi[Ki]=null,Ki--)}function U(e,t){Ki++,Gi[Ki]=e.current,e.current=t}var qi={},Ji=V(qi),Yi=V(!1),Xi=qi;function Zi(e,t){var n=e.type.contextTypes;if(!n)return qi;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 Qi(e){return e=e.childContextTypes,e!=null}function $i(){H(Yi),H(Ji)}function ea(e,t,n){if(Ji.current!==qi)throw Error(r(168));U(Ji,t),U(Yi,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||qi,Xi=Ji.current,U(Ji,e),U(Yi,Yi.current),!0}function ra(e,t,n){var i=e.stateNode;if(!i)throw Error(r(169));n?(e=ta(e,t,Xi),i.__reactInternalMemoizedMergedChildContext=e,H(Yi),H(Ji),U(Ji,e)):H(Yi),U(Yi,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=Yl(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 Da(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=Yl(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Ca=e,wa=null,!0);default:return!1}}function Oa(e){return(e.mode&1)!=0&&(e.flags&128)==0}function ka(e){if(W){var t=wa;if(t){var n=t;if(!Da(e,t)){if(Oa(e))throw Error(r(418));t=Mi(n.nextSibling);var i=Ca;t&&Da(e,t)?Ea(i,n):(e.flags=e.flags&-4097|2,W=!1,Ca=e)}}else{if(Oa(e))throw Error(r(418));e.flags=e.flags&-4097|2,W=!1,Ca=e}}}function Aa(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Ca=e}function ja(e){if(e!==Ca)return!1;if(!W)return Aa(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(Oa(e))throw Ma(),Error(r(418));for(;t;)Ea(e,t),t=Mi(t.nextSibling)}if(Aa(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 Ma(){for(var e=wa;e;)e=Mi(e.nextSibling)}function Na(){wa=Ca=null,W=!1}function Pa(e){Ta===null?Ta=[e]:Ta.push(e)}var Fa=C.ReactCurrentBatchConfig;function G(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=Ql(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=nu(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=G(e,t,n),r.return=e,r):(r=$l(n.type,n.key,n.props,null,e.mode,r),r.ref=G(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=ru(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=eu(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=nu(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case w:return n=$l(t.type,t.key,t.props,null,e.mode,n),n.ref=G(e,null,t),n.return=e,n;case T:return t=ru(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=eu(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=G(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=eu(i.props.children,e.mode,o,i.key),r.return=e,e=r):(o=$l(i.type,i.key,i.props,null,e.mode,o),o.ref=G(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=ru(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=nu(i,e.mode,o),r.return=e,e=r),s(e)):n(e,r)}return _}var za=Ra(!0),Ba=Ra(!1),Va=V(null),Ha=null,Ua=null,Wa=null;function Ga(){Wa=Ua=Ha=null}function Ka(e){var t=Va.current;H(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&&(Is=!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=V(lo),fo=V(lo),po=V(lo);function K(e){if(e===lo)throw Error(r(174));return e}function mo(e,t){switch(U(po,t),U(fo,e),U(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)}H(uo),U(uo,t)}function ho(){H(uo),H(fo),H(po)}function go(e){K(po.current);var t=K(uo.current),n=Ie(t,e.type);t!==n&&(U(fo,e),U(uo,n))}function _o(e){fo.current===e&&(H(uo),H(fo))}var vo=V(0);function yo(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 bo=[];function xo(){for(var e=0;e<bo.length;e++)bo[e]._workInProgressVersionPrimary=null;bo.length=0}var So=C.ReactCurrentDispatcher,Co=C.ReactCurrentBatchConfig,wo=0,q=null,To=null,Eo=null,Do=!1,Oo=!1,ko=0,Ao=0;function jo(){throw Error(r(321))}function Mo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Pr(e[n],t[n]))return!1;return!0}function No(e,t,n,i,a,o){if(wo=o,q=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,So.current=e===null||e.memoizedState===null?gs:_s,e=n(i,a),Oo){o=0;do{if(Oo=!1,ko=0,25<=o)throw Error(r(301));o+=1,Eo=To=null,t.updateQueue=null,So.current=vs,e=n(i,a)}while(Oo)}if(So.current=hs,t=To!==null&&To.next!==null,wo=0,Eo=To=q=null,Do=!1,t)throw Error(r(300));return e}function Po(){var e=ko!==0;return ko=0,e}function Fo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Eo===null?q.memoizedState=Eo=e:Eo=Eo.next=e,Eo}function Io(){if(To===null){var e=q.alternate;e=e===null?null:e.memoizedState}else e=To.next;var t=Eo===null?q.memoizedState:Eo.next;if(t!==null)Eo=t,To=e;else{if(e===null)throw Error(r(310));To=e,e={memoizedState:To.memoizedState,baseState:To.baseState,baseQueue:To.baseQueue,queue:To.queue,next:null},Eo===null?q.memoizedState=Eo=e:Eo=Eo.next=e}return Eo}function Lo(e,t){return typeof t==`function`?t(e):t}function Ro(e){var t=Io(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var i=To,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((wo&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,q.lanes|=d,Qc|=d}u=u.next}while(u!==null&&u!==o);l===null?s=i:l.next=c,Pr(i,t.memoizedState)||(Is=!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,q.lanes|=o,Qc|=o,a=a.next;while(a!==e)}else a===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function zo(e){var t=Io(),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);Pr(o,t.memoizedState)||(Is=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,i]}function Bo(){}function Vo(e,t){var n=q,i=Io(),a=t(),o=!Pr(i.memoizedState,a);if(o&&(i.memoizedState=a,Is=!0),i=i.queue,$o(Wo.bind(null,n,i,e),[e]),i.getSnapshot!==t||o||Eo!==null&&Eo.memoizedState.tag&1){if(n.flags|=2048,Jo(9,Uo.bind(null,n,i,a,t),void 0,null),Gc===null)throw Error(r(349));wo&30||Ho(n,t,a)}return a}function Ho(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=q.updateQueue,t===null?(t={lastEffect:null,stores:null},q.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Uo(e,t,n,r){t.value=n,t.getSnapshot=r,Go(t)&&Ko(e)}function Wo(e,t,n){return n(function(){Go(t)&&Ko(e)})}function Go(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Pr(e,n)}catch{return!0}}function Ko(e){var t=$a(e,1);t!==null&&vl(t,e,1,-1)}function qo(e){var t=Fo();return typeof e==`function`&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Lo,lastRenderedState:e},t.queue=e,e=e.dispatch=ds.bind(null,q,e),[t.memoizedState,e]}function Jo(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=q.updateQueue,t===null?(t={lastEffect:null,stores:null},q.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 Yo(){return Io().memoizedState}function Xo(e,t,n,r){var i=Fo();q.flags|=e,i.memoizedState=Jo(1|t,n,void 0,r===void 0?null:r)}function Zo(e,t,n,r){var i=Io();r=r===void 0?null:r;var a=void 0;if(To!==null){var o=To.memoizedState;if(a=o.destroy,r!==null&&Mo(r,o.deps)){i.memoizedState=Jo(t,n,a,r);return}}q.flags|=e,i.memoizedState=Jo(1|t,n,a,r)}function Qo(e,t){return Xo(8390656,8,e,t)}function $o(e,t){return Zo(2048,8,e,t)}function es(e,t){return Zo(4,2,e,t)}function ts(e,t){return Zo(4,4,e,t)}function ns(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 rs(e,t,n){return n=n==null?null:n.concat([e]),Zo(4,4,ns.bind(null,t,e),n)}function is(){}function as(e,t){var n=Io();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Mo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function os(e,t){var n=Io();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Mo(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function ss(e,t,n){return wo&21?(Pr(n,t)||(n=Kt(),q.lanes|=n,Qc|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Is=!0),e.memoizedState=n)}function cs(e,t){var n=j;j=n!==0&&4>n?n:4,e(!0);var r=Co.transition;Co.transition={};try{e(!1),t()}finally{j=n,Co.transition=r}}function ls(){return Io().memoizedState}function us(e,t,n){var r=_l(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},fs(e))ps(t,n);else if(n=Qa(e,t,n,r),n!==null){var i=gl();vl(n,e,r,i),ms(n,t,r)}}function ds(e,t,n){var r=_l(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(fs(e))ps(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Pr(s,o)){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=gl(),vl(n,e,r,i),ms(n,t,r))}}function fs(e){var t=e.alternate;return e===q||t!==null&&t===q}function ps(e,t){Oo=Do=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function ms(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Xt(e,n)}}var hs={readContext:Ya,useCallback:jo,useContext:jo,useEffect:jo,useImperativeHandle:jo,useInsertionEffect:jo,useLayoutEffect:jo,useMemo:jo,useReducer:jo,useRef:jo,useState:jo,useDebugValue:jo,useDeferredValue:jo,useTransition:jo,useMutableSource:jo,useSyncExternalStore:jo,useId:jo,unstable_isNewReconciler:!1},gs={readContext:Ya,useCallback:function(e,t){return Fo().memoizedState=[e,t===void 0?null:t],e},useContext:Ya,useEffect:Qo,useImperativeHandle:function(e,t,n){return n=n==null?null:n.concat([e]),Xo(4194308,4,ns.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Xo(4194308,4,e,t)},useInsertionEffect:function(e,t){return Xo(4,2,e,t)},useMemo:function(e,t){var n=Fo();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Fo();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=us.bind(null,q,e),[r.memoizedState,e]},useRef:function(e){var t=Fo();return e={current:e},t.memoizedState=e},useState:qo,useDebugValue:is,useDeferredValue:function(e){return Fo().memoizedState=e},useTransition:function(){var e=qo(!1),t=e[0];return e=cs.bind(null,e[1]),Fo().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var i=q,a=Fo();if(W){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),Gc===null)throw Error(r(349));wo&30||Ho(i,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,Qo(Wo.bind(null,i,o,e),[e]),i.flags|=2048,Jo(9,Uo.bind(null,i,o,n,t),void 0,null),n},useId:function(){var e=Fo(),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=ko++,0<n&&(t+=`H`+n.toString(32)),t+=`:`}else n=Ao++,t=`:`+t+`r`+n.toString(32)+`:`;return e.memoizedState=t},unstable_isNewReconciler:!1},_s={readContext:Ya,useCallback:as,useContext:Ya,useEffect:$o,useImperativeHandle:rs,useInsertionEffect:es,useLayoutEffect:ts,useMemo:os,useReducer:Ro,useRef:Yo,useState:function(){return Ro(Lo)},useDebugValue:is,useDeferredValue:function(e){return ss(Io(),To.memoizedState,e)},useTransition:function(){return[Ro(Lo)[0],Io().memoizedState]},useMutableSource:Bo,useSyncExternalStore:Vo,useId:ls,unstable_isNewReconciler:!1},vs={readContext:Ya,useCallback:as,useContext:Ya,useEffect:$o,useImperativeHandle:rs,useInsertionEffect:es,useLayoutEffect:ts,useMemo:os,useReducer:zo,useRef:Yo,useState:function(){return zo(Lo)},useDebugValue:is,useDeferredValue:function(e){var t=Io();return To===null?t.memoizedState=e:ss(t,To.memoizedState,e)},useTransition:function(){return[zo(Lo)[0],Io().memoizedState]},useMutableSource:Bo,useSyncExternalStore:Vo,useId:ls,unstable_isNewReconciler:!1};function ys(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 bs(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 xs={isMounted:function(e){return(e=e._reactInternals)?ht(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=gl(),i=_l(e),a=ro(r,i);a.payload=t,n!=null&&(a.callback=n),t=io(e,a,i),t!==null&&(vl(t,e,i,r),ao(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=gl(),i=_l(e),a=ro(r,i);a.tag=1,a.payload=t,n!=null&&(a.callback=n),t=io(e,a,i),t!==null&&(vl(t,e,i,r),ao(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=gl(),r=_l(e),i=ro(n,r);i.tag=2,t!=null&&(i.callback=t),t=io(e,i,r),t!==null&&(vl(t,e,r,n),ao(t,e,r))}};function Ss(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?!Fr(n,r)||!Fr(i,a):!0}function Cs(e,t,n){var r=!1,i=qi,a=t.contextType;return typeof a==`object`&&a?a=Ya(a):(i=Qi(t)?Xi:Ji.current,r=t.contextTypes,a=(r=r!=null)?Zi(e,i):qi),t=new t(n,a),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=xs,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=a),t}function ws(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&&xs.enqueueReplaceState(t,t.state,null)}function Ts(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=Qi(t)?Xi:Ji.current,i.context=Zi(e,a)),i.state=e.memoizedState,a=t.getDerivedStateFromProps,typeof a==`function`&&(bs(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&&xs.enqueueReplaceState(i,i.state,null),so(e,n,i,r),i.state=e.memoizedState),typeof i.componentDidMount==`function`&&(e.flags|=4194308)}function Es(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 Ds(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Os(e,t){try{console.error(t.value)}catch(e){setTimeout(function(){throw e})}}var ks=typeof WeakMap==`function`?WeakMap:Map;function As(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),Os(e,t)},n}function js(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(){Os(e,t)}}var a=e.stateNode;return a!==null&&typeof a.componentDidCatch==`function`&&(n.callback=function(){Os(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 Ms(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new ks;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=Hl.bind(null,e,t,n),t.then(e,e))}function Ns(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 Ps(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 Fs=C.ReactCurrentOwner,Is=!1;function Ls(e,t,n,r){t.child=e===null?Ba(t,null,n,r):za(t,e.child,n,r)}function Rs(e,t,n,r,i){n=n.render;var a=t.ref;return Ja(t,i),r=No(e,t,n,r,a,i),n=Po(),e!==null&&!Is?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,ic(e,t,i)):(W&&n&&xa(t),t.flags|=1,Ls(e,t,r,i),t.child)}function zs(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!Xl(a)&&a.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=a,Bs(e,t,a,r,i)):(e=$l(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?Fr:n,n(o,r)&&e.ref===t.ref)return ic(e,t,i)}return t.flags|=1,e=Ql(a,r),e.ref=t.ref,e.return=t,t.child=e}function Bs(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Fr(a,r)&&e.ref===t.ref)if(Is=!1,t.pendingProps=r=a,(e.lanes&i)!==0)e.flags&131072&&(Is=!0);else return t.lanes=e.lanes,ic(e,t,i)}return Us(e,t,n,r,i)}function Vs(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},U(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,U(Yc,Jc),Jc|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=a===null?n:a.baseLanes,U(Yc,Jc),Jc|=r}else a===null?r=n:(r=a.baseLanes|n,t.memoizedState=null),U(Yc,Jc),Jc|=r;return Ls(e,t,i,n),t.child}function Hs(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Us(e,t,n,r,i){var a=Qi(n)?Xi:Ji.current;return a=Zi(t,a),Ja(t,i),n=No(e,t,n,r,a,i),r=Po(),e!==null&&!Is?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,ic(e,t,i)):(W&&r&&xa(t),t.flags|=1,Ls(e,t,n,i),t.child)}function Ws(e,t,n,r,i){if(Qi(n)){var a=!0;na(t)}else a=!1;if(Ja(t,i),t.stateNode===null)rc(e,t),Cs(t,n,r),Ts(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=Qi(n)?Xi:Ji.current,l=Zi(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)&&ws(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||Yi.current||eo?(typeof u==`function`&&(bs(t,n,u,r),c=t.memoizedState),(s=eo||Ss(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:ys(t.type,s),o.props=l,d=t.pendingProps,f=o.context,c=n.contextType,typeof c==`object`&&c?c=Ya(c):(c=Qi(n)?Xi:Ji.current,c=Zi(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)&&ws(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||Yi.current||eo?(typeof p==`function`&&(bs(t,n,p,r),m=t.memoizedState),(l=eo||Ss(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 Gs(e,t,n,r,a,i)}function Gs(e,t,n,r,i,a){Hs(e,t);var o=(t.flags&128)!=0;if(!r&&!o)return i&&ra(t,n,!1),ic(e,t,a);r=t.stateNode,Fs.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)):Ls(e,t,s,a),t.memoizedState=r.state,i&&ra(t,n,!0),t.child}function Ks(e){var t=e.stateNode;t.pendingContext?ea(e,t.pendingContext,t.pendingContext!==t.context):t.context&&ea(e,t.context,!1),mo(e,t.containerInfo)}function qs(e,t,n,r,i){return Na(),Pa(i),t.flags|=256,Ls(e,t,n,r),t.child}var Js={dehydrated:null,treeContext:null,retryLane:0};function Ys(e){return{baseLanes:e,cachePool:null,transitions:null}}function Xs(e,t,n){var r=t.pendingProps,i=vo.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),U(vo,i&1),e===null)return ka(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=tu(o,r,0,null),e=eu(e,r,n,null),a.return=t,e.return=t,a.sibling=e,t.child=a,t.child.memoizedState=Ys(n),t.memoizedState=Js,e):Zs(t,o));if(i=e.memoizedState,i!==null&&(s=i.dehydrated,s!==null))return $s(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=Ql(i,c),r.subtreeFlags=i.subtreeFlags&14680064),s===null?(a=eu(a,o,n,null),a.flags|=2):a=Ql(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?Ys(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},a.memoizedState=o,a.childLanes=e.childLanes&~n,t.memoizedState=Js,r}return a=e.child,e=a.sibling,r=Ql(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 Zs(e,t){return t=tu({mode:`visible`,children:t},e.mode,0,null),t.return=e,e.child=t}function Qs(e,t,n,r){return r!==null&&Pa(r),za(t,e.child,null,n),e=Zs(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function $s(e,t,n,i,a,o,s){if(n)return t.flags&256?(t.flags&=-257,i=Ds(Error(r(422))),Qs(e,t,s,i)):t.memoizedState===null?(o=i.fallback,a=t.mode,i=tu({mode:`visible`,children:i.children},a,0,null),o=eu(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=Ys(s),t.memoizedState=Js,o):(t.child=e.child,t.flags|=128,null);if(!(t.mode&1))return Qs(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=Ds(o,i,void 0),Qs(e,t,s,i)}if(c=(s&e.childLanes)!==0,Is||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),vl(i,e,a,-1))}return jl(),i=Ds(Error(r(421))),Qs(e,t,s,i)}return a.data===`$?`?(t.flags|=128,t.child=e.child,t=Wl.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=Zs(t,i.children),t.flags|=4096,t)}function ec(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),qa(e.return,t,n)}function tc(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 nc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;if(Ls(e,t,r.children,n),r=vo.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&&ec(e,n,t);else if(e.tag===19)ec(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(U(vo,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&&yo(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),tc(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&&yo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}tc(t,!0,n,null,a);break;case`together`:tc(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function rc(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function ic(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=Ql(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Ql(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function ac(e,t,n){switch(t.tag){case 3:Ks(t),Na();break;case 5:go(t);break;case 1:Qi(t.type)&&na(t);break;case 4:mo(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;U(Va,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(U(vo,vo.current&1),e=ic(e,t,n),e===null?null:e.sibling):Xs(e,t,n):(U(vo,vo.current&1),t.flags|=128,null);U(vo,vo.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return nc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),U(vo,vo.current),r)break;return null;case 22:case 23:return t.lanes=0,Vs(e,t,n)}return ic(e,t,n)}var oc=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}},sc=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,K(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`&&B(`scroll`,e),o||c===l||(o=[])):(o||=[]).push(u,l))}n&&(o||=[]).push(`style`,n);var u=o;(t.updateQueue=u)&&(t.flags|=4)}},cc=function(e,t,n,r){n!==r&&(t.flags|=4)};function lc(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 uc(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 dc(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 uc(t),null;case 1:return Qi(t.type)&&$i(),uc(t),null;case 3:return i=t.stateNode,ho(),H(Yi),H(Ji),xo(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(ja(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ta!==null&&(Sl(Ta),Ta=null))),uc(t),null;case 5:_o(t);var o=K(po.current);if(n=t.type,e!==null&&t.stateNode!=null)sc(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 uc(t),null}if(e=K(uo.current),ja(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`:B(`cancel`,i),B(`close`,i);break;case`iframe`:case`object`:case`embed`:B(`load`,i);break;case`video`:case`audio`:for(o=0;o<ai.length;o++)B(ai[o],i);break;case`source`:B(`error`,i);break;case`img`:case`image`:case`link`:B(`error`,i),B(`load`,i);break;case`details`:B(`toggle`,i);break;case`input`:we(i,s),B(`invalid`,i);break;case`select`:i._wrapperState={wasMultiple:!!s.multiple},B(`invalid`,i);break;case`textarea`:Me(i,s),B(`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`&&B(`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,oc(e,t,!1,!1),t.stateNode=e;a:{switch(c=Ke(n,i),n){case`dialog`:B(`cancel`,e),B(`close`,e),o=i;break;case`iframe`:case`object`:case`embed`:B(`load`,e),o=i;break;case`video`:case`audio`:for(o=0;o<ai.length;o++)B(ai[o],e);o=i;break;case`source`:B(`error`,e),o=i;break;case`img`:case`image`:case`link`:B(`error`,e),B(`load`,e),o=i;break;case`details`:B(`toggle`,e),o=i;break;case`input`:we(e,i),o=Ce(e,i),B(`invalid`,e);break;case`option`:o=i;break;case`select`:e._wrapperState={wasMultiple:!!i.multiple},o=O({},i,{value:void 0}),B(`invalid`,e);break;case`textarea`:Me(e,i),o=je(e,i),B(`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`&&B(`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 uc(t),null;case 6:if(e&&t.stateNode!=null)cc(e,t,e.memoizedProps,i);else{if(typeof i!=`string`&&t.stateNode===null)throw Error(r(166));if(n=K(po.current),K(uo.current),ja(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 uc(t),null;case 13:if(H(vo),i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(W&&wa!==null&&t.mode&1&&!(t.flags&128))Ma(),Na(),t.flags|=98560,s=!1;else if(s=ja(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 Na(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;uc(t),s=!1}else Ta!==null&&(Sl(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||vo.current&1?Xc===0&&(Xc=3):jl())),t.updateQueue!==null&&(t.flags|=4),uc(t),null);case 4:return ho(),e===null&&di(t.stateNode.containerInfo),uc(t),null;case 10:return Ka(t.type._context),uc(t),null;case 17:return Qi(t.type)&&$i(),uc(t),null;case 19:if(H(vo),s=t.memoizedState,s===null)return uc(t),null;if(i=(t.flags&128)!=0,c=s.rendering,c===null)if(i)lc(s,!1);else{if(Xc!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(c=yo(e),c!==null){for(t.flags|=128,lc(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 U(vo,vo.current&1|2),t.child}e=e.sibling}s.tail!==null&&Tt()>il&&(t.flags|=128,i=!0,lc(s,!1),t.lanes=4194304)}else{if(!i)if(e=yo(c),e!==null){if(t.flags|=128,i=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),lc(s,!0),s.tail===null&&s.tailMode===`hidden`&&!c.alternate&&!W)return uc(t),null}else 2*Tt()-s.renderingStartTime>il&&n!==1073741824&&(t.flags|=128,i=!0,lc(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?(uc(t),null):(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=Tt(),t.sibling=null,n=vo.current,U(vo,i?n&1|2:n&1),t);case 22:case 23:return Ol(),i=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(t.flags|=8192),i&&t.mode&1?Jc&1073741824&&(uc(t),t.subtreeFlags&6&&(t.flags|=8192)):uc(t),null;case 24:return null;case 25:return null}throw Error(r(156,t.tag))}function fc(e,t){switch(Sa(t),t.tag){case 1:return Qi(t.type)&&$i(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ho(),H(Yi),H(Ji),xo(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return _o(t),null;case 13:if(H(vo),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));Na()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return H(vo),null;case 4:return ho(),null;case 10:return Ka(t.type._context),null;case 22:case 23:return Ol(),null;case 24:return null;default:return null}}var pc=!1,mc=!1,hc=typeof WeakSet==`function`?WeakSet:Set,J=null;function gc(e,t){var n=e.ref;if(n!==null)if(typeof n==`function`)try{n(null)}catch(n){Vl(e,t,n)}else n.current=null}function _c(e,t,n){try{n()}catch(n){Vl(e,t,n)}}var vc=!1;function yc(e,t){if(Ci=Sn,e=zr(),Br(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},Sn=!1,J=t;J!==null;)if(t=J,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,J=e;else for(;J!==null;){t=J;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:ys(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){Vl(t,t.return,e)}if(e=t.sibling,e!==null){e.return=t.return,J=e;break}J=t.return}return h=vc,vc=!1,h}function bc(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&&_c(t,n,a)}i=i.next}while(i!==r)}}function xc(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 Sc(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 Cc(e){var t=e.alternate;t!==null&&(e.alternate=null,Cc(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 wc(e){return e.tag===5||e.tag===3||e.tag===4}function Tc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||wc(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 Ec(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(Ec(e,t,n),e=e.sibling;e!==null;)Ec(e,t,n),e=e.sibling}function Dc(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(Dc(e,t,n),e=e.sibling;e!==null;)Dc(e,t,n),e=e.sibling}var Oc=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:mc||gc(n,t);case 6:var r=Oc,i=kc;Oc=null,Ac(e,t,n),Oc=r,kc=i,Oc!==null&&(kc?(e=Oc,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Oc.removeChild(n.stateNode));break;case 18:Oc!==null&&(kc?(e=Oc,n=n.stateNode,e.nodeType===8?ji(e.parentNode,n):e.nodeType===1&&ji(e,n),xn(e)):ji(Oc,n.stateNode));break;case 4:r=Oc,i=kc,Oc=n.stateNode.containerInfo,kc=!0,Ac(e,t,n),Oc=r,kc=i;break;case 0:case 11:case 14:case 15:if(!mc&&(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)&&_c(n,t,o),i=i.next}while(i!==r)}Ac(e,t,n);break;case 1:if(!mc&&(gc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){Vl(n,t,e)}Ac(e,t,n);break;case 21:Ac(e,t,n);break;case 22:n.mode&1?(mc=(r=mc)||n.memoizedState!==null,Ac(e,t,n),mc=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 hc),t.forEach(function(t){var r=Gl.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:Oc=c.stateNode,kc=!1;break a;case 3:Oc=c.stateNode.containerInfo,kc=!0;break a;case 4:Oc=c.stateNode.containerInfo,kc=!0;break a}c=c.return}if(Oc===null)throw Error(r(160));jc(o,s,a),Oc=null,kc=!1;var l=a.alternate;l!==null&&(l.return=null),a.return=null}catch(e){Vl(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{bc(3,e,e.return),xc(3,e)}catch(t){Vl(e,e.return,t)}try{bc(5,e,e.return)}catch(t){Vl(e,e.return,t)}}break;case 1:Nc(t,e),Fc(e),i&512&&n!==null&&gc(n,n.return);break;case 5:if(Nc(t,e),Fc(e),i&512&&n!==null&&gc(n,n.return),e.flags&32){var a=e.stateNode;try{ze(a,``)}catch(t){Vl(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){Vl(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){Vl(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){Vl(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?(mc=(u=mc)||d,Nc(t,e),mc=u):Nc(t,e),Fc(e),i&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(J=e,d=e.child;d!==null;){for(f=J=d;J!==null;){switch(p=J,m=p.child,p.tag){case 0:case 11:case 14:case 15:bc(4,p,p.return);break;case 1:gc(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){Vl(i,n,e)}}break;case 5:gc(p,p.return);break;case 22:if(p.memoizedState!==null){zc(f);continue}}m===null?zc(f):(m.return=p,J=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){Vl(e,e.return,t)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?``:f.memoizedProps}catch(t){Vl(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(wc(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),Dc(e,Tc(e),a);break;case 3:case 4:var o=i.stateNode.containerInfo;Ec(e,Tc(e),o);break;default:throw Error(r(161))}}catch(t){Vl(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Ic(e,t,n){J=e,Lc(e,t,n)}function Lc(e,t,n){for(var r=(e.mode&1)!=0;J!==null;){var i=J,a=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||pc;if(!o){var s=i.alternate,c=s!==null&&s.memoizedState!==null||mc;s=pc;var l=mc;if(pc=o,(mc=c)&&!l)for(J=i;J!==null;)o=J,c=o.child,o.tag===22&&o.memoizedState!==null||c===null?Bc(i):(c.return=o,J=c);for(;a!==null;)J=a,Lc(a,t,n),a=a.sibling;J=i,pc=s,mc=l}Rc(e,t,n)}else i.subtreeFlags&8772&&a!==null?(a.return=i,J=a):Rc(e,t,n)}}function Rc(e){for(;J!==null;){var t=J;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:mc||xc(5,t);break;case 1:var i=t.stateNode;if(t.flags&4&&!mc)if(n===null)i.componentDidMount();else{var a=t.elementType===t.type?n.memoizedProps:ys(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))}mc||t.flags&512&&Sc(t)}catch(e){Vl(t,t.return,e)}}if(t===e){J=null;break}if(n=t.sibling,n!==null){n.return=t.return,J=n;break}J=t.return}}function zc(e){for(;J!==null;){var t=J;if(t===e){J=null;break}var n=t.sibling;if(n!==null){n.return=t.return,J=n;break}J=t.return}}function Bc(e){for(;J!==null;){var t=J;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{xc(4,t)}catch(e){Vl(t,n,e)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount==`function`){var i=t.return;try{r.componentDidMount()}catch(e){Vl(t,i,e)}}var a=t.return;try{Sc(t)}catch(e){Vl(t,a,e)}break;case 5:var o=t.return;try{Sc(t)}catch(e){Vl(t,o,e)}}}catch(e){Vl(t,t.return,e)}if(t===e){J=null;break}var s=t.sibling;if(s!==null){s.return=t.return,J=s;break}J=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=V(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,pl=null,ml=-1,hl=0;function gl(){return Y&6?Tt():ml===-1?ml=Tt():ml}function _l(e){return e.mode&1?Y&2&&qc!==0?qc&-qc:Fa.transition===null?(e=j,e===0?(e=window.event,e=e===void 0?16:On(e.type),e):e):(hl===0&&(hl=Kt()),hl):1}function vl(e,t,n,i){if(50<fl)throw fl=0,pl=null,Error(r(185));Jt(e,n,i),(!(Y&2)||e!==Gc)&&(e===Gc&&(!(Y&2)&&($c|=n),Xc===4&&wl(e,qc)),yl(e,i),n===1&&Y===0&&!(t.mode&1)&&(il=Tt()+500,aa&&la()))}function yl(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(Tl.bind(null,e)):sa(Tl.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=ql(n,bl.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function bl(e,t){if(ml=-1,hl=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=X();(Gc!==e||qc!==t)&&(al=null,il=Tt()+500,kl(e,t));do try{Pl();break}catch(t){Al(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=xl(e,a))),t===1)throw n=Zc,kl(e,0),wl(e,i),yl(e,Tt()),n;if(t===6)wl(e,i);else{if(a=e.current.alternate,!(i&30)&&!Cl(a)&&(t=Ml(e,i),t===2&&(o=Gt(e),o!==0&&(i=o,t=xl(e,o))),t===1))throw n=Zc,kl(e,0),wl(e,i),yl(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(wl(e,i),(i&130023424)===i&&(t=rl+500-Tt(),10<t)){if(Ht(e,0)!==0)break;if(a=e.suspendedLanes,(a&i)!==i){gl(),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(wl(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 yl(e,Tt()),e.callbackNode===n?bl.bind(null,e):null}function xl(e,t){var n=tl;return e.current.memoizedState.isDehydrated&&(kl(e,t).flags|=256),e=Ml(e,t),e!==2&&(t=nl,nl=n,t!==null&&Sl(t)),e}function Sl(e){nl===null?nl=e:nl.push.apply(nl,e)}function Cl(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(!Pr(a(),i))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function wl(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 Tl(e){if(Y&6)throw Error(r(327));zl();var t=Ht(e,0);if(!(t&1))return yl(e,Tt()),null;var n=Ml(e,t);if(e.tag!==0&&n===2){var i=Gt(e);i!==0&&(t=i,n=xl(e,i))}if(n===1)throw n=Zc,kl(e,0),wl(e,t),yl(e,Tt()),n;if(n===6)throw Error(r(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Ll(e,nl,al),yl(e,Tt()),null}function El(e,t){var n=Y;Y|=1;try{return e(t)}finally{Y=n,Y===0&&(il=Tt()+500,aa&&la())}}function Dl(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 Ol(){Jc=Yc.current,H(Yc)}function kl(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&&$i();break;case 3:ho(),H(Yi),H(Ji),xo();break;case 5:_o(r);break;case 4:ho();break;case 13:H(vo);break;case 19:H(vo);break;case 10:Ka(r.type._context);break;case 22:case 23:Ol()}n=n.return}if(Gc=e,Kc=e=Ql(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 Al(e,t){do{var n=Kc;try{if(Ga(),So.current=hs,Do){for(var i=q.memoizedState;i!==null;){var a=i.queue;a!==null&&(a.pending=null),i=i.next}Do=!1}if(wo=0,Eo=To=q=null,Oo=!1,ko=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=Ns(s);if(m!==null){m.flags&=-257,Ps(m,s,c,o,t),m.mode&1&&Ms(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)){Ms(o,u,t),jl();break a}l=Error(r(426))}}else if(W&&c.mode&1){var _=Ns(s);if(_!==null){!(_.flags&65536)&&(_.flags|=256),Ps(_,s,c,o,t),Pa(Es(l,c));break a}}o=l=Es(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=As(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=js(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 X(){var e=Hc.current;return Hc.current=hs,e===null?hs:e}function jl(){(Xc===0||Xc===3||Xc===2)&&(Xc=4),Gc===null||!(Qc&268435455)&&!($c&268435455)||wl(Gc,qc)}function Ml(e,t){var n=Y;Y|=2;var i=X();(Gc!==e||qc!==t)&&(al=null,kl(e,t));do try{Nl();break}catch(t){Al(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=Kl(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=fc(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=dc(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,ql(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,yc(e,n),Pc(n,e),Vr(wi),Sn=!!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),yl(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===pl?fl++:(fl=0,pl=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,J=e.current;J!==null;){var o=J,s=o.child;if(J.flags&16){var c=o.deletions;if(c!==null){for(var l=0;l<c.length;l++){var u=c[l];for(J=u;J!==null;){var d=J;switch(d.tag){case 0:case 11:case 15:bc(8,d,o)}var f=d.child;if(f!==null)f.return=d,J=f;else for(;J!==null;){d=J;var p=d.sibling,m=d.return;if(Cc(d),d===u){J=null;break}if(p!==null){p.return=m,J=p;break}J=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)}}J=o}}if(o.subtreeFlags&2064&&s!==null)s.return=o,J=s;else b:for(;J!==null;){if(o=J,o.flags&2048)switch(o.tag){case 0:case 11:case 15:bc(9,o,o.return)}var v=o.sibling;if(v!==null){v.return=o.return,J=v;break b}J=o.return}}var y=e.current;for(J=y;J!==null;){s=J;var b=s.child;if(s.subtreeFlags&2064&&b!==null)b.return=s,J=b;else b:for(s=y;J!==null;){if(c=J,c.flags&2048)try{switch(c.tag){case 0:case 11:case 15:xc(9,c)}}catch(e){Vl(c,c.return,e)}if(c===s){J=null;break b}var x=c.sibling;if(x!==null){x.return=c.return,J=x;break b}J=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=Es(n,t),t=As(e,t,1),e=io(e,t,1),t=gl(),e!==null&&(Jt(e,1,t),yl(e,t))}function Vl(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=Es(n,e),e=js(t,e,1),t=io(t,e,1),e=gl(),t!==null&&(Jt(t,1,e),yl(t,e));break}}t=t.return}}function Hl(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=gl(),e.pingedLanes|=e.suspendedLanes&n,Gc===e&&(qc&n)===n&&(Xc===4||Xc===3&&(qc&130023424)===qc&&500>Tt()-rl?kl(e,0):el|=n),yl(e,t)}function Ul(e,t){t===0&&(e.mode&1?(t=Bt,Bt<<=1,!(Bt&130023424)&&(Bt=4194304)):t=1);var n=gl();e=$a(e,t),e!==null&&(Jt(e,t,n),yl(e,n))}function Wl(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Ul(e,n)}function Gl(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),Ul(e,n)}var Kl=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Yi.current)Is=!0;else{if((e.lanes&n)===0&&!(t.flags&128))return Is=!1,ac(e,t,n);Is=!!(e.flags&131072)}else Is=!1,W&&t.flags&1048576&&ba(t,pa,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;rc(e,t),e=t.pendingProps;var a=Zi(t,Ji.current);Ja(t,n),a=No(null,t,i,e,a,n);var o=Po();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,Qi(i)?(o=!0,na(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,to(t),a.updater=xs,t.stateNode=a,a._reactInternals=t,Ts(t,i,e,n),t=Gs(null,t,i,!0,o,n)):(t.tag=0,W&&o&&xa(t),Ls(null,t,a,n),t=t.child),t;case 16:i=t.elementType;a:{switch(rc(e,t),e=t.pendingProps,a=i._init,i=a(i._payload),t.type=i,a=t.tag=Zl(i),e=ys(i,e),a){case 0:t=Us(null,t,i,e,n);break a;case 1:t=Ws(null,t,i,e,n);break a;case 11:t=Rs(null,t,i,e,n);break a;case 14:t=zs(null,t,i,ys(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:ys(i,a),Us(e,t,i,a,n);case 1:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:ys(i,a),Ws(e,t,i,a,n);case 3:a:{if(Ks(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=Es(Error(r(423)),t),t=qs(e,t,i,n,a);break a}else if(i!==a){a=Es(Error(r(424)),t),t=qs(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(Na(),i===a){t=ic(e,t,n);break a}Ls(e,t,i,n)}t=t.child}return t;case 5:return go(t),e===null&&ka(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),Hs(e,t),Ls(e,t,s,n),t.child;case 6:return e===null&&ka(t),null;case 13:return Xs(e,t,n);case 4:return mo(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=za(t,null,i,n):Ls(e,t,i,n),t.child;case 11:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:ys(i,a),Rs(e,t,i,a,n);case 7:return Ls(e,t,t.pendingProps,n),t.child;case 8:return Ls(e,t,t.pendingProps.children,n),t.child;case 12:return Ls(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,U(Va,i._currentValue),i._currentValue=s,o!==null)if(Pr(o.value,s)){if(o.children===a.children&&!Yi.current){t=ic(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}Ls(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,Ls(e,t,i,n),t.child;case 14:return i=t.type,a=ys(i,t.pendingProps),a=ys(i.type,a),zs(e,t,i,a,n);case 15:return Bs(e,t,t.type,t.pendingProps,n);case 17:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:ys(i,a),rc(e,t),t.tag=1,Qi(i)?(e=!0,na(t)):e=!1,Ja(t,n),Cs(t,i,a),Ts(t,i,a,n),Gs(null,t,i,!0,e,n);case 19:return nc(e,t,n);case 22:return Vs(e,t,n)}throw Error(r(156,t.tag))};function ql(e,t){return xt(e,t)}function Jl(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 Yl(e,t,n,r){return new Jl(e,t,n,r)}function Xl(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Zl(e){if(typeof e==`function`)return+!!Xl(e);if(e!=null){if(e=e.$$typeof,e===re)return 11;if(e===oe)return 14}return 2}function Ql(e,t){var n=e.alternate;return n===null?(n=Yl(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 $l(e,t,n,i,a,o){var s=2;if(i=e,typeof e==`function`)Xl(e)&&(s=1);else if(typeof e==`string`)s=5;else a:switch(e){case E:return eu(n.children,a,o,t);case D:s=8,a|=8;break;case ee:return e=Yl(12,n,t,a|2),e.elementType=ee,e.lanes=o,e;case ie:return e=Yl(13,n,t,a),e.elementType=ie,e.lanes=o,e;case ae:return e=Yl(19,n,t,a),e.elementType=ae,e.lanes=o,e;case ce:return tu(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=Yl(s,n,t,a),t.elementType=e,t.type=i,t.lanes=o,t}function eu(e,t,n,r){return e=Yl(7,e,r,t),e.lanes=n,e}function tu(e,t,n,r){return e=Yl(22,e,r,t),e.elementType=ce,e.lanes=n,e.stateNode={isHidden:!1},e}function nu(e,t,n){return e=Yl(6,e,null,t),e.lanes=n,e}function ru(e,t,n){return t=Yl(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function iu(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 au(e,t,n,r,i,a,o,s,c){return e=new iu(e,t,n,s,c),t===1?(t=1,!0===a&&(t|=8)):t=0,a=Yl(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 ou(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 su(e){if(!e)return qi;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(Qi(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(Qi(n))return ta(e,n,t)}return t}function cu(e,t,n,r,i,a,o,s,c){return e=au(n,r,!0,e,i,a,o,s,c),e.context=su(null),n=e.current,r=gl(),i=_l(n),a=ro(r,i),a.callback=t??null,io(n,a,i),e.current.lanes=i,Jt(e,i,r),yl(e,r),e}function lu(e,t,n,r){var i=t.current,a=gl(),o=_l(i);return n=su(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&&(vl(e,i,o,a),ao(e,i,o)),o}function uu(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 du(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function fu(e,t){du(e,t),(e=e.alternate)&&du(e,t)}function pu(){return null}var mu=typeof reportError==`function`?reportError:function(e){console.error(e)};function hu(e){this._internalRoot=e}gu.prototype.render=hu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(r(409));lu(e,t,null,null)},gu.prototype.unmount=hu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Dl(function(){lu(null,e,null,null)}),t[Li]=null}};function gu(e){this._internalRoot=e}gu.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 _u(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function vu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==` react-mount-point-unstable `))}function Z(){}function yu(e,t,n,r,i){if(i){if(typeof r==`function`){var a=r;r=function(){var e=uu(o);a.call(e)}}var o=cu(t,r,e,0,null,!1,!1,``,Z);return e._reactRootContainer=o,e[Li]=o.current,di(e.nodeType===8?e.parentNode:e),Dl(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof r==`function`){var s=r;r=function(){var e=uu(c);s.call(e)}}var c=au(e,0,!1,null,null,!1,!1,``,Z);return e._reactRootContainer=c,e[Li]=c.current,di(e.nodeType===8?e.parentNode:e),Dl(function(){lu(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=uu(o);s.call(e)}}lu(t,o,e,i)}else o=yu(n,t,e,i,r);return uu(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),yl(t,Tt()),!(Y&6)&&(il=Tt()+500,la()))}break;case 13:Dl(function(){var t=$a(e,1);t!==null&&vl(t,e,1,gl())}),fu(e,1)}},$t=function(e){if(e.tag===13){var t=$a(e,134217728);t!==null&&vl(t,e,134217728,gl()),fu(e,134217728)}},en=function(e){if(e.tag===13){var t=_l(e),n=$a(e,t);n!==null&&vl(n,e,t,gl()),fu(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=El,tt=Dl;var xu={usingClientEntryPoint:!1,Events:[Hi,Ui,Wi,Qe,$e,El]},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||pu,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(!_u(t))throw Error(r(200));return ou(e,t,null,n)},e.createRoot=function(e,t){if(!_u(e))throw Error(r(299));var n=!1,i=``,a=mu;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onRecoverableError!==void 0&&(a=t.onRecoverableError)),t=au(e,1,!1,null,null,n,!1,i,a),e[Li]=t.current,di(e.nodeType===8?e.parentNode:e),new hu(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 Dl(e)},e.hydrate=function(e,t,n){if(!vu(t))throw Error(r(200));return bu(null,e,t,!0,n)},e.hydrateRoot=function(e,t,n){if(!_u(e))throw Error(r(405));var i=n!=null&&n.hydratedSources||null,a=!1,o=``,s=mu;if(n!=null&&(!0===n.unstable_strictMode&&(a=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=cu(t,null,e,1,n??null,a,!1,o,s),e[Li]=t.current,di(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 gu(t)},e.render=function(e,t,n){if(!vu(t))throw Error(r(200));return bu(null,e,t,!1,n)},e.unmountComponentAtNode=function(e){if(!vu(e))throw Error(r(40));return e._reactRootContainer?(Dl(function(){bu(null,null,e,!1,function(){e._reactRootContainer=null,e[Li]=null})}),!0):!1},e.unstable_batchedUpdates=El,e.unstable_renderSubtreeIntoContainer=function(e,t,n,i){if(!vu(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 M=xn(),Sn=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 Cn(e){return Math.min(1e3*2**e,3e4)}function wn(e){return(e??`online`)===`online`?Sn.isOnline():!0}var Tn=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function En(e){let t=!1,n=0,r,i=yn(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new Tn(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>Ht.isFocused()&&(e.networkMode===`always`||Sn.isOnline())&&e.canRun(),u=()=>wn(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??Cn,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 Dn=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 On(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?An:kn,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:kn(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 kn(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 An(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function jn(e,t){return t?kn(e,t)!=null:!1}function Mn(e,t){return!t||!e.getPreviousPageParam?!1:An(e,t)!=null}var Nn=class extends Dn{#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=In(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=In(this.options);e.data!==void 0&&(this.setState(Fn(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`?On(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=En({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Tn&&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 Tn){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,...Pn(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Fn(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),M.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function Pn(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:wn(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Fn(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function In(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 Ln=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),zn(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Bn(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Bn(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&&Vn(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 Un(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&&zn(e,t),o=i&&Vn(e,n,t,r);(a||o)&&(l={...l,...Pn(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:Hn(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){M.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function Rn(e,t){return Zt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&Zt(t.retryOnMount,e)===!1)}function zn(e,t){return Rn(e,t)||e.state.data!==void 0&&Bn(e,t,t.refetchOnMount)}function Bn(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&&Hn(e,t)}return!1}function Vn(e,t,n,r){return(e!==t||Zt(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Hn(e,n)}function Hn(e,t){return Zt(t.enabled,e)!==!1&&e.isStaleByTime(j(t.staleTime,e))}function Un(e,t){return!on(e.getCurrentResult(),t)}var Wn=class extends Ln{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:jn(t,n.data),hasPreviousPage:Mn(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},Gn=class extends Dn{#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||Kn(),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=En({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),M.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Kn(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var qn=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 Gn({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=Jn(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=Jn(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=Jn(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=Jn(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){M.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){M.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return M.batch(()=>Promise.all(e.map(e=>e.continue().catch(qt))))}};function Jn(e){return e.options.scope?.id}var Yn=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??Kn();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){M.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)})})}},Xn=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 Nn({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(){M.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){M.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){M.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){M.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Zn=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Xn,this.#t=e.mutationCache||new qn,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=Sn.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 M.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;M.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return M.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=M.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(qt).catch(qt)}invalidateQueries(e,t={}){return M.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=M.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 Sn.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()}},Qn=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})),N=o(((e,t)=>{t.exports=Qn()}))(),$n=g.createContext(void 0),P=e=>{let t=g.useContext($n);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},er=({client:e,children:t})=>(g.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,N.jsx)($n.Provider,{value:e,children:t})),tr=g.createContext(!1),nr=()=>g.useContext(tr);tr.Provider;function rr(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var ir=g.createContext(rr()),ar=()=>g.useContext(ir),or=(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))},sr=e=>{g.useEffect(()=>{e.clearReset()},[e])},cr=({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])),lr=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))}},ur=(e,t)=>e.isLoading&&e.isFetching&&!t,dr=(e,t)=>e?.suspense&&t.isPending,fr=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function pr(e,t,n){let r=nr(),i=ar(),a=P(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash);o._optimisticResults=r?`isRestoring`:`optimistic`,lr(o),or(o,i,s),sr(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(M.batchCalls(e)):qt;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),g.useEffect(()=>{l.setOptions(o)},[o,l]),dr(o,u))throw fr(o,l,i);if(cr({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()&&ur(u,r)&&(c?fr(o,l,i):s?.promise)?.catch(qt).finally(()=>{l.updateResult()}),o.notifyOnChangeProps?u:l.trackResult(u)}function F(e,t){return pr(e,Ln,t)}function I(e,t){let n=P(t),[r]=g.useState(()=>new Yn(n,e));g.useEffect(()=>{r.setOptions(e)},[r,e]);let i=g.useSyncExternalStore(g.useCallback(e=>r.subscribe(M.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 mr(e,t){return pr(e,Wn,t)}function hr(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 gr(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 _r(e,t=Date.now()){if(!e)return``;let n=t-new Date(e).getTime();if(n<0)return`just now`;let r=Math.floor(n/1e3);if(r<60)return`${r}s ago`;let i=Math.floor(r/60);if(i<60)return`${i}m ago`;let a=Math.floor(i/60);return a<24?`${a}h ago`:`${Math.floor(a/24)}d ago`}function vr(e,t){let n=Date.parse(e);if(!Number.isFinite(n))return`an unknown time`;let r=new Date(n);return`${new Date(t).toDateString()===r.toDateString()?r.toLocaleTimeString():r.toLocaleString()} (${_r(e,t)})`}function yr(e){return!e||e.health?.state!==`down`?null:{agentLabel:e.agentLabel,reason:e.health.reason??null,since:e.health.since??null,agentLastSeenAt:e.agentLastSeenAt??null}}function br(e){return!e||e.state!==`down`?null:{agentLabel:e.agentLabel,reason:e.reason??null,since:e.since??null,agentLastSeenAt:e.agentLastSeenAt??null}}function xr(e,t){let n=e.since?vr(e.since,t):`an unknown time`;if(e.reason===`app`)return`The agent half is not responding since ${n}`;if(e.reason===`tunnel`){let r=e.agentLastSeenAt?`last sync ${vr(e.agentLastSeenAt,t)}`:`no sync recorded`;return`Hosting agent ${e.agentLabel} is offline since ${n} — ${r}`}return`The hosting on ${e.agentLabel} is down since ${n}`}function Sr(e,t){if(!e||e.hosting!==`agent`||e.agent==null)return{state:`mount`};let n=e.agentHosting,r=e.displayName||e.name;if(!n)return{state:`waiting`,message:`${r} is not hosted on an agent — host it on the Plugins page`};if(n.phase&&n.phase!==`active`)return{state:`waiting`,message:n.phase===`installing`?`The hosting of ${r} on ${n.agentLabel} is being set up`:`The hosting of ${r} on ${n.agentLabel} is being removed`};let i=yr(n);return i?{state:`offline`,message:xr(i,t)}:{state:`mount`}}function Cr(e,t){let n=e.hosting;if(!n)return`Not hosted on an agent yet`;if(n.phase&&n.phase!==`active`)return n.phase===`installing`?`The hosting on ${n.agentLabel} is being set up`:`The hosting on ${n.agentLabel} is being removed`;let r=br(n);return r?xr(r,t):typeof e.revision==`number`?null:`The settings could not be read from the agent half yet`}function wr(e){return e.required===!0&&e.default===void 0}function Tr(e){return e.type===`secret`?e.required!==!0:!wr(e)}function Er(e,t){switch(e.type){case`boolean`:return typeof t==`boolean`?t:null;case`integer`:case`number`:return typeof t==`number`&&Number.isFinite(t)?String(t):``;case`string`:case`enum`:return typeof t==`string`?t:``;default:return``}}function Dr(e){let t={};for(let n of e.fields)n.type!==`secret`&&(t[n.key]=Er(n,e.values?.[n.key]));return t}function Or(e,t){let n=e.values?.[t];return typeof n==`object`&&n&&n.set===!0?{set:!0,setAt:typeof n.setAt==`string`?n.setAt:null}:{set:!1,setAt:null}}function kr(e){let t={};for(let n of e.fields)n.type===`secret`&&(t[n.key]=Or(e,n.key).set?`keep`:`replace`);return t}function Ar(e){if(!e.set)return`Not set`;if(!e.setAt)return`Set`;let t=new Date(e.setAt);return Number.isNaN(t.getTime())?`Set`:`Set on ${t.toLocaleString()}`}function jr(e){return e.type===`integer`?`Must be an integer`:`Must be a number`}function Mr(e,t){return e.min!==void 0&&t<e.min?`Must be at least ${e.min}`:e.max!==void 0&&t>e.max?`Must be at most ${e.max}`:null}function Nr(e,t){if(e.pattern===void 0)return!0;let n;try{n=new RegExp(e.pattern,`u`)}catch{return!0}return n.test(t)}function Pr(e,t,{badInput:n=!1}={}){switch(e.type){case`string`:{let n=typeof t==`string`?t:``;if(n===``)return{ok:!0,value:null};let r=e.maxLength??1024;return n.length>r?{ok:!1,message:`Must be at most ${r} characters`}:Nr(e,n)?{ok:!0,value:n}:{ok:!1,message:`Does not match the required format`}}case`integer`:case`number`:{if(n)return{ok:!1,message:jr(e)};let r=typeof t==`string`?t.trim():``;if(r===``)return{ok:!0,value:null};let i=Number(r);if(!(e.type===`integer`?Number.isSafeInteger(i):Number.isFinite(i)))return{ok:!1,message:jr(e)};let a=Mr(e,i);return a?{ok:!1,message:a}:{ok:!0,value:i}}case`boolean`:return{ok:!0,value:typeof t==`boolean`?t:null};case`enum`:{let n=typeof t==`string`?t:``;return n===``?{ok:!0,value:null}:(e.options??[]).some(e=>e.value===n)?{ok:!0,value:n}:{ok:!1,message:`Must be one of the options`}}default:return{ok:!1,message:`Cannot be set in this form`}}}function Fr(e,t,n,{badInput:r=!1}={}){if(n===void 0)return!1;if(e.type===`integer`||e.type===`number`){if(r)return!0;let e=typeof t==`string`?t.trim():``,i=typeof n==`string`?n.trim():``;if(e===``||i===``)return e!==i;let a=Number(e),o=Number(i);return Number.isNaN(a)||Number.isNaN(o)?e!==i:a!==o}return t!==n}function Ir(e){return JSON.stringify(e??[])}function Lr(e,t){let n=Dr(e),r=[];for(let i of e.fields){let e=i.key;if(i.type===`secret`){let n=t.secretActions[e];(n===`clear`||n===`replace`&&t.secretFilled?.[e]===!0)&&r.push(e)}else Fr(i,n[e],t.inputs[e],{badInput:t.badInput?.[e]})&&r.push(e)}return r}function Rr(e,t){let n=Dr(e),r=[],i=[],a=[];for(let o of e.fields){let e=o.key;if(o.type===`secret`){let{action:n,value:r=``}=t.secrets[e]??{action:`keep`};if(n===`clear`)Tr(o)?i.push([e,null]):a.push([e,`Is required`]);else if(n===`replace`&&r!==``){let t=o.maxLength??1024;r.length>t?a.push([e,`Must be at most ${t} characters`]):i.push([e,r])}continue}let s=t.badInput?.[e]===!0;if(!Fr(o,n[e],t.inputs[e],{badInput:s}))continue;let c=Pr(o,t.inputs[e],{badInput:s});c.ok?c.value===null&&!Tr(o)?a.push([e,`Is required`]):r.push([e,c.value]):a.push([e,c.message])}return a.length>0?{ok:!1,errors:Object.fromEntries(a)}:{ok:!0,body:{revision:e.revision,...r.length>0?{values:Object.fromEntries(r)}:{},...i.length>0?{secrets:Object.fromEntries(i)}:{}},changed:[...r,...i].map(([e])=>e)}}function zr(e){if(typeof e!=`object`||!e)return null;let t=e.errors;if(typeof t!=`object`||!t||Array.isArray(t))return null;let n=Object.entries(t).filter(([,e])=>typeof e==`string`);return n.length>0?Object.fromEntries(n):null}function Br(e,t){return e.source===`live`?`Read from the agent half`:e.source===`cache`?e.syncedAt?`From the relay's copy, synced from the agent half ${vr(e.syncedAt,t)}`:`From the relay's copy`:`Never synced from the agent half — showing the defaults`}var Vr=/key|token|secret|password|passwd|credential/i;function Hr(e){return e.type===`string`?Vr.test(e.key)||Vr.test(e.label??``):!1}function Ur(e){try{return typeof e?.supports==`function`&&e.supports(`-webkit-text-security`,`disc`)}catch{return!1}}function Wr(e){let t=e.type;if((e.type===`integer`||e.type===`number`)&&(e.min!==void 0&&e.max!==void 0?t+=` ${e.min}–${e.max}`:e.min===void 0?e.max!==void 0&&(t+=` ≤ ${e.max}`):t+=` ≥ ${e.min}`),e.type===`enum`){let n=(e.options??[]).map(e=>e.value);t+=`: ${n.length>5?`${n.slice(0,5).join(` | `)} | …`:n.join(` | `)}`}return e.required?`${t}, required`:t}function Gr(e){if(!e||typeof e!=`object`)return null;let t=e=>Array.isArray(e)?e:[],n=e=>e&&typeof e==`object`?`${e.key} (${e.type})`:String(e),r=[{label:`added`,entries:t(e.added).map(n),note:null},{label:`removed`,entries:t(e.removed).map(n),note:`their values are dropped`},{label:`type changed`,entries:t(e.retyped).map(e=>e&&typeof e==`object`?`${e.key} (${e.from} → ${e.to})`:String(e)),note:`their values are dropped, not converted`},{label:`newly required`,entries:t(e.newRequired).map(String),note:`to be set after the update`}].filter(e=>e.entries.length>0),i=t(e.secretToPlain).map(String);return r.length===0&&i.length===0?null:{rows:r,secretToPlain:i}}var Kr=`lamaste:2fa-required`;function qr(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 L(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(Kr)),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:{},r=zr(t);throw Object.assign(Error(qr(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}:{},...r?{errors:r}:{}})}return n.json()}async function Jr(){return L(`/api/onboarding/status`)}function Yr(){let{data:e,isLoading:t,isError:n,error:r,refetch:i}=F({queryKey:[`onboarding`,`status`],queryFn:Jr,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 Xr=(0,g.createContext)(null);function R(){let e=(0,g.useContext)(Xr);if(!e)throw Error(`useAdminClient must be used within an AdminClientProvider`);return e}function Zr({client:e,children:t}){return(0,N.jsx)(Xr.Provider,{value:e,children:t})}var Qr=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),$r=(...e)=>e.filter((e,t,n)=>!!e&&n.indexOf(e)===t).join(` `),ei={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`},ti=(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,...ei,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:$r(`lucide`,i),...s},[...o.map(([e,t])=>(0,g.createElement)(e,t)),...Array.isArray(a)?a:[a]])),z=(e,t)=>{let n=(0,g.forwardRef)(({className:n,...r},i)=>(0,g.createElement)(ti,{ref:i,iconNode:t,className:$r(`lucide-${Qr(e)}`,n),...r}));return n.displayName=`${e}`,n},ni=z(`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`}]]),ri=z(`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`}]]),ii=z(`ArrowDown`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),ai=z(`ArrowLeft`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),oi=z(`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`}]]),si=z(`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`}]]),ci=z(`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`}]]),B=z(`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`}]]),li=z(`CheckCheck`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),ui=z(`Check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),di=z(`ChevronDown`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),fi=z(`ChevronLeft`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),pi=z(`ChevronRight`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),mi=z(`ChevronUp`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),hi=z(`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`}]]),gi=z(`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`}]]),_i=z(`CircleCheck`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),vi=z(`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`}]]),yi=z(`Circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),bi=z(`Clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16 14`,key:`68esgv`}]]),xi=z(`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`}]]),Si=z(`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`}]]),Ci=z(`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`}]]),wi=z(`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`}]]),Ti=z(`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`}]]),Ei=z(`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`}]]),Di=z(`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`}]]),Oi=z(`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`}]]),ki=z(`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`}]]),Ai=z(`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`}]]),ji=z(`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`}]]),Mi=z(`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`}]]),Ni=z(`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`}]]),Pi=z(`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`}]]),Fi=z(`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`}]]),Ii=z(`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`}]]),Li=z(`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`}]]),Ri=z(`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`}]]),zi=z(`Info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),Bi=z(`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`}]]),Vi=z(`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`}]]),Hi=z(`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`}]]),Ui=z(`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`}]]),Wi=z(`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`}]]),Gi=z(`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`}]]),Ki=z(`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`}]]),V=z(`LoaderCircle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),H=z(`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`}]]),U=z(`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`}]]),qi=z(`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`}]]),Ji=z(`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`}]]),Yi=z(`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=z(`Minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),Zi=z(`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`}]]),Qi=z(`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`}]]),$i=z(`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`}]]),ea=z(`Play`,[[`polygon`,{points:`6 3 20 12 6 21 6 3`,key:`1oa8hb`}]]),ta=z(`Plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),na=z(`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`}]]),ra=z(`Power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),ia=z(`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`}]]),aa=z(`RotateCcw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),oa=z(`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`}]]),sa=z(`Save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),ca=z(`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`}]]),la=z(`ServerOff`,[[`path`,{d:`M7 2h13a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-5`,key:`bt2siv`}],[`path`,{d:`M10 10 2.5 2.5C2 2 2 2.5 2 5v3a2 2 0 0 0 2 2h6z`,key:`1hjrv1`}],[`path`,{d:`M22 17v-1a2 2 0 0 0-2-2h-1`,key:`1iynyr`}],[`path`,{d:`M4 14a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16.5l1-.5.5.5-8-8H4z`,key:`161ggg`}],[`path`,{d:`M6 18h.01`,key:`uhywen`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),ua=z(`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`}]]),da=z(`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`}]]),fa=z(`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`}]]),pa=z(`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`}]]),ma=z(`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`}]]),ha=z(`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`}]]),ga=z(`SlidersHorizontal`,[[`line`,{x1:`21`,x2:`14`,y1:`4`,y2:`4`,key:`obuewd`}],[`line`,{x1:`10`,x2:`3`,y1:`4`,y2:`4`,key:`1q6298`}],[`line`,{x1:`21`,x2:`12`,y1:`12`,y2:`12`,key:`1iu8h1`}],[`line`,{x1:`8`,x2:`3`,y1:`12`,y2:`12`,key:`ntss68`}],[`line`,{x1:`21`,x2:`16`,y1:`20`,y2:`20`,key:`14d8ph`}],[`line`,{x1:`12`,x2:`3`,y1:`20`,y2:`20`,key:`m0wm8r`}],[`line`,{x1:`14`,x2:`14`,y1:`2`,y2:`6`,key:`14e1ph`}],[`line`,{x1:`8`,x2:`8`,y1:`10`,y2:`14`,key:`1i6ji0`}],[`line`,{x1:`16`,x2:`16`,y1:`18`,y2:`22`,key:`1lctlv`}]]),_a=z(`Square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),va=z(`Terminal`,[[`polyline`,{points:`4 17 10 11 4 5`,key:`akl6gq`}],[`line`,{x1:`12`,x2:`20`,y1:`19`,y2:`19`,key:`q2wloq`}]]),ya=z(`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`}]]),ba=z(`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`}]]),xa=z(`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`}]]),Sa=z(`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`}]]),Ca=z(`Undo2`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5v0a5.5 5.5 0 0 1-5.5 5.5H11`,key:`llx8ln`}]]),wa=z(`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`}]]),W=z(`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`}]]),Ta=z(`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`}]]),Ea=z(`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`}]]),Da=z(`WifiOff`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Oa=z(`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`}]]),ka=z(`X`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Aa=z(`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 ja({onVerified:e}){let t=R(),[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,N.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/70`,children:(0,N.jsxs)(`div`,{className:`w-full max-w-sm rounded-lg bg-zinc-800 p-6 shadow-xl`,children:[(0,N.jsxs)(`div`,{className:`mb-4 flex items-center gap-3`,children:[(0,N.jsx)(ma,{className:`h-6 w-6 text-cyan-400`}),(0,N.jsx)(`h2`,{className:`text-lg font-bold text-white`,children:`Two-Factor Authentication`})]}),(0,N.jsx)(`p`,{className:`mb-4 text-sm text-zinc-400`,children:`Enter the 6-digit code from your authenticator app to continue.`}),(0,N.jsxs)(`form`,{onSubmit:u,className:`space-y-4`,children:[(0,N.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,N.jsx)(`p`,{className:`text-sm text-red-400`,children:i}),(0,N.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,N.jsxs)(`p`,{className:`mt-4 text-xs text-zinc-600`,children:[`Lost your authenticator? Run`,` `,(0,N.jsx)(`code`,{className:`text-zinc-500`,children:`sudo lamaste-reset-admin`}),` on the server.`]})]})})}var Ma=(0,g.createContext)(null),Na=`lamaste:2fa-required`;function Pa({children:e}){let t=R(),n=P(),[r,i]=(0,g.useState)(!1),{data:a}=F({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(Na,e),()=>window.removeEventListener(Na,e)},[]),(0,N.jsxs)(Ma.Provider,{value:{is2faEnabled:o,is2faRequired:r,require2fa:s,clearRequirement:c},children:[e,r&&(0,N.jsx)(ja,{onVerified:c})]})}var Fa=(0,g.createContext)(null);function G(){let e=(0,g.useContext)(Fa);if(!e)throw Error(`useToast must be used within a ToastProvider`);return e}var Ia=0;function La({children:e}){let[t,n]=(0,g.useState)([]),r=(0,g.useCallback)((e,t=`success`)=>{let r=++Ia;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,N.jsxs)(Fa.Provider,{value:r,children:[e,(0,N.jsx)(`div`,{className:`fixed bottom-4 right-4 z-50 flex flex-col gap-2`,children:t.map(e=>(0,N.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,N.jsx)(`span`,{className:`flex-1`,children:e.message}),(0,N.jsx)(`button`,{type:`button`,onClick:()=>i(e.id),className:`text-zinc-500 hover:text-zinc-300`,children:(0,N.jsx)(ka,{size:14})})]},e.id))})]})}function Ra(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 za(e){if(typeof e!=`object`||!e)return{result:e,secrets:[]};let{oidcClients:t,...n}=e;return{result:n,secrets:Ra(t)}}function Ba(e,t){return e.status===`running`?null:t===`reading`?`reading`:e.revealPending===!0?t===`followed`?`read`:`offer`:t===`followed`?`forget`:null}function Va(e,t){return e?.operations?{...e,operations:e.operations.map(e=>e.id===t?{...e,revealPending:!1}:e)}:e}var Ha={next:1,queue:[]};function Ua(e,t){switch(t.type){case`reveal`:{let n=Ra(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 Wa={install:`Installing`,enable:`Enabling`,update:`Updating`};function Ga({plugin:e,cause:t,secrets:n}){let r=n.length===1?`a confidential OIDC client`:`${n.length} confidential OIDC clients`,i=Wa[t];return i?`${i} ${e} created ${r}`:`An operation on ${e} created ${r}`}var Ka=(0,g.createContext)(null);function qa(){let e=(0,g.useContext)(Ka);if(!e)throw Error(`useOidcSecretReveal must be used within an OidcSecretRevealProvider`);return e}function Ja({children:e}){let[t,n]=(0,g.useReducer)(Ua,Ha),[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,N.jsxs)(Ka.Provider,{value:d,children:[e,f&&(0,N.jsx)(Xa,{reveal:f,waiting:t.queue.length-1,onAcknowledge:()=>n({type:`acknowledge`,key:f.key})},f.key)]})}var Ya=`button:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])`;function Xa({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,N.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4`,children:(0,N.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(Ya)];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,N.jsxs)(`div`,{className:`border-b border-zinc-800 px-6 py-4`,children:[(0,N.jsxs)(`h3`,{id:o,className:`flex items-center gap-2 text-lg font-semibold text-white`,children:[(0,N.jsx)(Bi,{size:20,className:`text-cyan-400`}),c?`Client secret`:`Client secrets`,` — shown once`]}),(0,N.jsxs)(`p`,{className:`mt-1 text-sm text-zinc-400`,children:[Ga(e),`.`]})]}),(0,N.jsxs)(`div`,{className:`space-y-5 overflow-y-auto px-6 py-5`,children:[(0,N.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,N.jsxs)(`p`,{className:`font-semibold`,children:[`Store `,c?`this secret`:`these secrets`,` now — Lamaste never shows`,` `,c?`it`:`them`,` again.`]}),(0,N.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,N.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,N.jsx)(Za,{clientId:e,secret:t},e)),(0,N.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-zinc-300`,children:[(0,N.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,N.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,N.jsx)(`span`,{className:`text-xs text-zinc-500`,children:t>0&&`${t} more to show after this`}),(0,N.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 Za({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,N.jsxs)(`div`,{children:[(0,N.jsxs)(`div`,{className:`mb-1 flex items-baseline gap-2 text-sm`,children:[(0,N.jsx)(`span`,{className:`shrink-0 text-zinc-500`,children:`Client ID`}),(0,N.jsx)(`span`,{className:`select-all break-all font-mono text-zinc-200`,children:e})]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.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,N.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,N.jsx)(ui,{size:16,className:`text-green-400`}):(0,N.jsx)(xi,{size:16})})]}),n===`failed`&&(0,N.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 Qa(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 eo({currentPath:e,onNavigate:t}){let n=e===`.`?[]:e.split(`/`);return(0,N.jsxs)(`div`,{className:`flex items-center gap-1 text-sm text-zinc-400 overflow-x-auto`,children:[(0,N.jsx)(`button`,{type:`button`,onClick:()=>t(`.`),className:`flex items-center gap-1 hover:text-cyan-400 shrink-0`,children:(0,N.jsx)(Ri,{size:14})}),n.map((e,r)=>{let i=n.slice(0,r+1).join(`/`),a=r===n.length-1;return(0,N.jsxs)(`span`,{className:`flex items-center gap-1 shrink-0`,children:[(0,N.jsx)(pi,{size:12,className:`text-zinc-600`}),a?(0,N.jsx)(`span`,{className:`text-zinc-200`,children:e}):(0,N.jsx)(`button`,{type:`button`,onClick:()=>t(i),className:`hover:text-cyan-400`,children:e})]},i)})]})}function to({fileName:e,onConfirm:t,onCancel:n,isPending:r}){return(0,N.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60`,children:(0,N.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,N.jsx)(`h3`,{className:`text-lg font-semibold text-white mb-2`,children:`Delete File`}),(0,N.jsxs)(`p`,{className:`text-zinc-400 text-sm mb-6`,children:[`Are you sure you want to delete`,` `,(0,N.jsx)(`span`,{className:`text-cyan-400 font-mono`,children:e}),`?`]}),(0,N.jsxs)(`div`,{className:`flex items-center justify-end gap-3`,children:[(0,N.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,N.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,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(V,{size:14,className:`animate-spin`}),`Deleting...`]}):`Delete`})]})]})})}function no({site:e,onBack:t}){let n=R(),r=P(),i=G(),a=(0,g.useRef)(null),[o,s]=(0,g.useState)(`.`),[c,l]=(0,g.useState)(null),u=F({queryKey:[`site-files`,e.id,o],queryFn:()=>n.getSiteFiles(e.id,o),refetchInterval:5e3}),d=I({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=I({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,N.jsxs)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:[(0,N.jsxs)(`div`,{className:`mb-6`,children:[(0,N.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,N.jsx)(ai,{size:14}),`Back to Sites`]}),(0,N.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsxs)(`h1`,{className:`text-xl font-bold text-white`,children:[e.name,(0,N.jsx)(`span`,{className:`text-zinc-500 font-normal ml-2 text-base`,children:`Files`})]}),(0,N.jsx)(`p`,{className:`text-zinc-500 text-sm mt-1 font-mono`,children:e.fqdn})]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(`input`,{ref:a,type:`file`,multiple:!0,onChange:_,className:`hidden`}),(0,N.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,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(V,{size:14,className:`animate-spin`}),`Uploading...`]}):(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(W,{size:14}),`Upload`]})})]})]})]}),(0,N.jsx)(`div`,{className:`bg-zinc-900 border border-zinc-800 rounded-t-lg px-4 py-3`,children:(0,N.jsx)(eo,{currentPath:o,onNavigate:p})}),u.isLoading?(0,N.jsx)(`div`,{className:`bg-zinc-900 border border-t-0 border-zinc-800 rounded-b-lg p-8 text-center`,children:(0,N.jsx)(V,{size:24,className:`mx-auto text-zinc-500 animate-spin`})}):u.isError?(0,N.jsx)(`div`,{className:`bg-zinc-900 border border-t-0 border-zinc-800 rounded-b-lg p-6`,children:(0,N.jsx)(`p`,{className:`text-red-400 text-sm`,children:`Failed to load files`})}):v.length===0?(0,N.jsx)(`div`,{className:`bg-zinc-900 border border-t-0 border-zinc-800 rounded-b-lg p-8 text-center`,children:(0,N.jsx)(`p`,{className:`text-zinc-500 text-sm`,children:`This directory is empty.`})}):(0,N.jsx)(`div`,{className:`bg-zinc-900 border border-t-0 border-zinc-800 rounded-b-lg overflow-x-auto`,children:(0,N.jsxs)(`table`,{className:`w-full`,children:[(0,N.jsx)(`thead`,{children:(0,N.jsxs)(`tr`,{className:`border-b border-zinc-800`,children:[(0,N.jsx)(`th`,{className:`text-left text-zinc-500 text-xs uppercase font-semibold py-2 px-4`,children:`Name`}),(0,N.jsx)(`th`,{className:`text-left text-zinc-500 text-xs uppercase font-semibold py-2 px-4 hidden sm:table-cell`,children:`Size`}),(0,N.jsx)(`th`,{className:`text-left text-zinc-500 text-xs uppercase font-semibold py-2 px-4 hidden md:table-cell`,children:`Modified`}),(0,N.jsx)(`th`,{className:`text-right text-zinc-500 text-xs uppercase font-semibold py-2 px-4 w-16`})]})}),(0,N.jsx)(`tbody`,{children:v.map(e=>(0,N.jsxs)(`tr`,{className:`border-b border-zinc-800/50 ${e.type===`directory`?`cursor-pointer hover:bg-zinc-800/50`:``}`,onClick:()=>m(e),children:[(0,N.jsx)(`td`,{className:`py-2.5 px-4 text-sm`,children:(0,N.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[e.type===`directory`?(0,N.jsx)(Ni,{size:14,className:`text-cyan-400 shrink-0`}):(0,N.jsx)(Ai,{size:14,className:`text-zinc-500 shrink-0`}),(0,N.jsx)(`span`,{className:`font-mono ${e.type===`directory`?`text-cyan-400`:`text-zinc-200`}`,children:e.name})]})}),(0,N.jsx)(`td`,{className:`py-2.5 px-4 text-sm text-zinc-500 font-mono hidden sm:table-cell`,children:e.type===`file`?Qa(e.size):`—`}),(0,N.jsx)(`td`,{className:`py-2.5 px-4 text-sm text-zinc-600 hidden md:table-cell`,children:$a(e.modifiedAt)}),(0,N.jsx)(`td`,{className:`py-2.5 px-4 text-right`,children:(0,N.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,N.jsx)(ba,{size:14})})})]},e.relativePath))})]})}),c&&(0,N.jsx)(to,{fileName:c.name,onConfirm:()=>f.mutate(c.relativePath),onCancel:()=>l(null),isPending:f.isPending})]})}var ro={bg:`zinc-950`,card:`zinc-900`,accent:`cyan-400`,border:`zinc-800`},io=1e4,ao=3e4;function oo(e,t){e.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=t,n.appendChild(r),e.appendChild(n)}function so(e,t){return e?.plugins?.find(e=>e.name===t)}function co({availability:e}){return(0,N.jsx)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-6`,children:(0,N.jsxs)(`div`,{className:`flex items-start gap-3`,children:[e.state===`offline`?(0,N.jsx)(Da,{size:18,className:`mt-0.5 shrink-0 text-red-400`}):(0,N.jsx)(la,{size:18,className:`mt-0.5 shrink-0 text-zinc-500`}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`p`,{className:`text-sm text-zinc-200`,children:e.message}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-zinc-500`,children:`Its pages come from its agent half. This page checks every 10 seconds and opens them once the hosting is up.`})]})]})})}function lo({pluginName:e,subPath:t=``,basePath:n,panelUrl:r}){let i=R(),a=(0,g.useRef)(null),o=F({queryKey:[`plugins`],queryFn:()=>i.getPlugins(),refetchInterval:t=>Sr(so(t.state.data,e),Date.now()).state===`mount`?ao:io}),s=o.data?Sr(so(o.data,e),o.dataUpdatedAt):o.isError?{state:`mount`}:{state:`checking`},[c,l]=(0,g.useState)(null);s.state===`mount`&&c!==e&&l(e);let u=s.state===`mount`||c===e;return(0,g.useEffect)(()=>{let o=a.current;if(!e||!u||!o)return;let s=!1,c=null,l=()=>{let i=window.__lamalibrePlugins?.[e];if(!i||typeof i.mount!=`function`)throw Error(`The plugin bundle registered no panel`);o.textContent=``;let a=i.mount({mountPoint:o,panelUrl:r||window.location.origin,basePath:n||`/plugins/${e}`,subPath:t||``,theme:ro});a&&typeof a.unmount==`function`?c=a.unmount:typeof a==`function`&&(c=a)},d=()=>{s||oo(o,`Failed to load plugin panel for "${e}"`)};if(window.__lamalibrePlugins?.[e])try{l()}catch{d()}else oo(o,`Loading plugin...`),i.fetchPluginBundle(e).then(e=>{if(!s)try{window.__lamalibrePlugins||(window.__lamalibrePlugins={}),Function(e)(),l()}catch{d()}},d);return()=>{s=!0,c&&c()}},[e,t,n,r,i,u]),(0,N.jsxs)(`div`,{className:`p-6 max-w-6xl mx-auto`,children:[!u&&s.state===`checking`&&(0,N.jsx)(`div`,{className:`flex items-center justify-center h-64`,children:(0,N.jsx)(`p`,{className:`text-zinc-500 text-sm`,children:`Loading plugin...`})}),!u&&(s.state===`offline`||s.state===`waiting`)&&(0,N.jsx)(co,{availability:s}),u&&(s.state===`offline`||s.state===`waiting`)&&(0,N.jsxs)(`div`,{className:`mb-4 flex items-start gap-2 rounded border px-3 py-2 text-xs ${s.state===`offline`?`border-red-500/30 text-red-400`:`border-zinc-700 text-zinc-400`}`,children:[(0,N.jsx)(Da,{size:12,className:`mt-0.5 shrink-0`}),(0,N.jsxs)(`span`,{children:[s.message,` — this page cannot reach its agent half until the hosting is up again.`]})]}),u&&(0,N.jsx)(`div`,{ref:a,className:`min-h-64`,"data-plugin":e})]})}function uo({icon:e,label:t,value:n,isLoading:r,isError:i}){return(0,N.jsxs)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-6`,children:[(0,N.jsx)(e,{size:20,className:`text-cyan-400 mb-2`}),(0,N.jsx)(`p`,{className:`text-zinc-400 text-sm mb-1`,children:t}),r?(0,N.jsx)(`div`,{className:`h-7 w-24 animate-pulse rounded bg-zinc-700`}):i?(0,N.jsx)(`p`,{className:`text-red-400 text-sm`,children:`Error`}):(0,N.jsx)(`p`,{className:`text-xl font-semibold text-white`,children:n})]})}function fo({status:e}){return(0,N.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 po(){let e=R(),t=F({queryKey:[`system-stats`],queryFn:()=>e.getSystemStats(),refetchInterval:5e3}),n=F({queryKey:[`services`],queryFn:()=>e.getServices(),refetchInterval:5e3}),r=t.data,i=n.data?.services;return(0,N.jsxs)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:[(0,N.jsxs)(`div`,{className:`mb-6`,children:[(0,N.jsx)(`h1`,{className:`text-xl font-bold text-white`,children:`Dashboard`}),(0,N.jsx)(`p`,{className:`text-zinc-500 text-sm mt-1`,children:`System overview and service health`})]}),(0,N.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4 mb-8`,children:[(0,N.jsx)(uo,{icon:Si,label:`CPU Usage`,value:r?`${r.cpu.usage}%`:`—`,isLoading:t.isLoading,isError:t.isError}),(0,N.jsx)(uo,{icon:Ci,label:`Memory Usage`,value:r?`${hr(r.memory.used)} / ${hr(r.memory.total)}`:`—`,isLoading:t.isLoading,isError:t.isError}),(0,N.jsx)(uo,{icon:Ii,label:`Disk Usage`,value:r?`${hr(r.disk.used)} / ${hr(r.disk.total)}`:`—`,isLoading:t.isLoading,isError:t.isError}),(0,N.jsx)(uo,{icon:bi,label:`Uptime`,value:r?gr(r.uptime):`—`,isLoading:t.isLoading,isError:t.isError})]}),(0,N.jsxs)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-6 mb-8`,children:[(0,N.jsxs)(`h2`,{className:`text-sm font-semibold text-zinc-300 mb-4 flex items-center gap-2`,children:[(0,N.jsx)(ni,{size:14,className:`text-cyan-400`}),`Service Health`]}),n.isLoading?(0,N.jsx)(`div`,{className:`flex gap-6 flex-wrap`,children:Array.from({length:4}).map((e,t)=>(0,N.jsx)(`div`,{className:`h-5 w-28 animate-pulse rounded bg-zinc-700`},t))}):n.isError?(0,N.jsx)(`p`,{className:`text-red-400 text-sm`,children:`Failed to load service status`}):(0,N.jsx)(`div`,{className:`flex gap-6 flex-wrap`,children:i?.map(e=>(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(fo,{status:e.status}),(0,N.jsx)(`span`,{className:`text-zinc-300 text-sm`,children:e.name})]},e.name))})]}),(0,N.jsxs)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-6`,children:[(0,N.jsxs)(`h2`,{className:`text-sm font-semibold text-zinc-300 mb-4 flex items-center gap-2`,children:[(0,N.jsx)(ni,{size:14,className:`text-cyan-400`}),`Quick Overview`]}),(0,N.jsxs)(`div`,{className:`flex gap-8 flex-wrap text-sm`,children:[(0,N.jsxs)(`div`,{className:`text-zinc-400`,children:[`Active Services:`,` `,(0,N.jsx)(`span`,{className:`text-white`,children:i?i.filter(e=>e.status===`active`).length:`—`})]}),(0,N.jsxs)(`div`,{className:`text-zinc-400`,children:[`Total Services: `,(0,N.jsx)(`span`,{className:`text-white`,children:i?i.length:`—`})]})]})]})]})}function K(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 mo(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 ho({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,N.jsx)(`span`,{className:`text-xs px-2 py-0.5 rounded-full ${t}`,children:n})}function go({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,N.jsxs)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-5`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(ua,{size:16,className:`text-cyan-400`}),(0,N.jsx)(`span`,{className:`text-white font-semibold`,children:e.name})]}),(0,N.jsx)(ho,{status:e.status})]}),(0,N.jsx)(`p`,{className:`text-zinc-400 text-sm mb-4`,children:e.status===`active`&&e.uptime?`Uptime: ${e.uptime}`:`—`}),(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.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,N.jsx)(ea,{size:12}),`Start`]}),r?(0,N.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs`,children:[(0,N.jsx)(`span`,{className:`text-zinc-400`,children:`Stop?`}),(0,N.jsx)(`button`,{type:`button`,onClick:o,className:`rounded bg-red-600 px-2 py-1 text-white hover:bg-red-500`,children:`Yes`}),(0,N.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,N.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,N.jsx)(_a,{size:12}),`Stop`]}),(0,N.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,N.jsx)(oa,{size:12}),`Restart`]})]})]})}var _o=1e3;function vo({services:e}){let t=R(),[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>_o?n.slice(-_o):n})}),()=>{l.current&&=(l.current(),null)}},[n,t]);let d=e?.map(e=>e.name)||[];return(0,N.jsxs)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-5`,children:[(0,N.jsx)(`h2`,{className:`text-sm font-semibold text-zinc-300 mb-4`,children:`Service Logs`}),(0,N.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,N.jsx)(`option`,{value:``,children:`Select a service...`}),d.map(e=>(0,N.jsx)(`option`,{value:e,children:e},e))]}),(0,N.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,N.jsx)(`p`,{className:`text-red-400`,children:o}):i.length===0?(0,N.jsx)(`p`,{className:`text-zinc-500 text-center mt-36`,children:`Waiting for log data...`}):i.map((e,t)=>(0,N.jsxs)(`div`,{className:`leading-relaxed`,children:[e.timestamp&&(0,N.jsxs)(`span`,{className:`text-zinc-500`,children:[e.timestamp,` `]}),(0,N.jsx)(`span`,{className:`text-zinc-300`,children:e.message})]},t)):(0,N.jsx)(`p`,{className:`text-zinc-500 text-center mt-36`,children:`Select a service to view its logs`})})]})}function yo(){let e=R(),t=P(),n=G(),r=F({queryKey:[`services`],queryFn:()=>e.getServices(),refetchInterval:5e3}),i=I({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(K(e),`error`)}}),a=(0,g.useCallback)((e,t)=>{i.mutate({name:e,action:t})},[i]),o=r.data?.services;return(0,N.jsxs)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:[(0,N.jsxs)(`div`,{className:`mb-6`,children:[(0,N.jsx)(`h1`,{className:`text-xl font-bold text-white`,children:`Services`}),(0,N.jsx)(`p`,{className:`text-zinc-500 text-sm mt-1`,children:`Manage system services and view live logs`})]}),r.isLoading?(0,N.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4 mb-8`,children:Array.from({length:4}).map((e,t)=>(0,N.jsx)(`div`,{className:`h-40 animate-pulse rounded-lg bg-zinc-900 border border-zinc-800`},t))}):r.isError?(0,N.jsx)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-6 mb-8`,children:(0,N.jsx)(`p`,{className:`text-red-400 text-sm`,children:`Failed to load services`})}):(0,N.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4 mb-8`,children:o?.map(e=>(0,N.jsx)(go,{service:e,onAction:a,isActing:i.isPending},e.name))}),(0,N.jsx)(vo,{services:o})]})}function bo(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 xo(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 So({site:e}){return e.certIssued&&e.dnsVerified?(0,N.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,N.jsx)(gi,{size:10}),`Live`]}):e.type===`custom`&&!e.dnsVerified?(0,N.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,N.jsx)(bi,{size:10}),`DNS Pending`]}):(0,N.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,N.jsx)(xa,{size:10}),`Setup Required`]})}function Co({type:e}){return(0,N.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 wo=/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/;function q(e){return[...new Set(e.split(/[\s,]+/).map(e=>e.trim().toLowerCase()).filter(Boolean))]}function To({domain:e,onClose:t}){let n=P(),r=G(),i=R(),[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=I({mutationFn:e=>i.createSite(e),onSuccess:e=>{n.invalidateQueries({queryKey:[`sites`]}),r(`Site ${e.site.fqdn} created`),t()},onError:e=>{x(K(e))}}),C=(0,g.useCallback)(e=>{e.preventDefault(),x(null);let t={};if(a?wo.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=q(d);e.length>0&&(n.aliases=e)}S.mutate(n)},[a,s,l,d,p,h,S]);return(0,N.jsxs)(`div`,{className:`bg-zinc-900 border border-zinc-800 rounded-lg p-5 mb-6`,children:[(0,N.jsxs)(`h2`,{className:`text-sm font-semibold text-zinc-300 mb-4 flex items-center gap-2`,children:[(0,N.jsx)(ta,{size:14,className:`text-cyan-400`}),`Add Static Site`]}),(0,N.jsxs)(`form`,{onSubmit:C,className:`space-y-4`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`label`,{className:`block text-xs text-zinc-400 mb-2`,children:`Domain Type`}),(0,N.jsxs)(`div`,{className:`flex gap-2`,children:[(0,N.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,N.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,N.jsxs)(`div`,{children:[(0,N.jsx)(`label`,{className:`block text-xs text-zinc-400 mb-1`,children:`Name`}),(0,N.jsxs)(`div`,{className:`flex items-center gap-0`,children:[(0,N.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,N.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,N.jsx)(`p`,{className:`text-red-400 text-xs mt-1`,children:v.name})]}),s===`custom`&&(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`label`,{className:`block text-xs text-zinc-400 mb-1`,children:`Custom Domain`}),(0,N.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,N.jsx)(`p`,{className:`text-red-400 text-xs mt-1`,children:v.customDomain}),(0,N.jsxs)(`label`,{className:`block text-xs text-zinc-400 mt-3 mb-1`,children:[`Redirect aliases `,(0,N.jsx)(`span`,{className:`text-zinc-600`,children:`(optional)`})]}),(0,N.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,N.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,N.jsxs)(`div`,{className:`flex flex-wrap gap-4`,children:[(0,N.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-zinc-400 cursor-pointer`,children:[(0,N.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,N.jsx)(`span`,{className:`text-zinc-600 text-xs`,children:`(fallback to index.html)`})]}),(0,N.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-zinc-400 cursor-pointer`,children:[(0,N.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,N.jsx)(`span`,{className:`text-zinc-600 text-xs`,children:`(require login)`})]})]}),b&&(0,N.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,N.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,N.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,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(V,{size:14,className:`animate-spin`}),`Creating site...`]}):(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(ta,{size:14}),`Create Site`]})}),(0,N.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 Eo({site:e,onClose:t}){let n=P(),r=G(),i=R(),[a,o]=(0,g.useState)(null),s=I({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:K(e)})}});return(0,N.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60`,children:(0,N.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,N.jsx)(`h3`,{className:`text-lg font-semibold text-white mb-2`,children:`DNS Verification`}),(0,N.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,N.jsxs)(`span`,{children:[(0,N.jsx)(`span`,{className:`text-cyan-400 font-mono`,children:e}),t<n.length-1?`, `:``]},e)),` `,`to your server IP.`]}),(0,N.jsx)(`div`,{className:`bg-zinc-800 rounded-lg p-4 mb-4`,children:(0,N.jsx)(`table`,{className:`w-full text-sm`,children:(0,N.jsxs)(`tbody`,{children:[(0,N.jsxs)(`tr`,{children:[(0,N.jsx)(`td`,{className:`text-zinc-500 py-1 pr-4`,children:`Type`}),(0,N.jsx)(`td`,{className:`text-zinc-200 font-mono`,children:`A`})]}),(0,N.jsxs)(`tr`,{children:[(0,N.jsx)(`td`,{className:`text-zinc-500 py-1 pr-4`,children:`Name`}),(0,N.jsx)(`td`,{className:`text-zinc-200 font-mono`,children:[e.fqdn,...e.aliases||[]].join(`, `)})]}),(0,N.jsxs)(`tr`,{children:[(0,N.jsx)(`td`,{className:`text-zinc-500 py-1 pr-4`,children:`Value`}),(0,N.jsx)(`td`,{className:`text-zinc-200 font-mono`,children:`(your server IP)`})]})]})})}),a&&(0,N.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,N.jsxs)(`div`,{className:`flex items-center justify-end gap-3`,children:[(0,N.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,N.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,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(V,{size:14,className:`animate-spin`}),`Verifying...`]}):`Verify DNS`})]})]})})}function Do({site:e,onConfirm:t,onCancel:n,isPending:r}){return(0,N.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60`,children:(0,N.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,N.jsx)(`h3`,{className:`text-lg font-semibold text-white mb-2`,children:`Delete Site`}),(0,N.jsxs)(`p`,{className:`text-zinc-400 text-sm mb-6`,children:[`Are you sure you want to delete`,` `,(0,N.jsx)(`span`,{className:`text-cyan-400 font-mono`,children:e.fqdn}),`? This will remove all files, the nginx configuration, and certificate mapping.`]}),(0,N.jsxs)(`div`,{className:`flex items-center justify-end gap-3`,children:[(0,N.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,N.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,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(V,{size:14,className:`animate-spin`}),`Deleting...`]}):`Delete`})]})]})})}function Oo({site:e,onClose:t}){let n=P(),r=G(),i=R(),[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=q(d),m=JSON.stringify(p.slice().sort())!==JSON.stringify((e.aliases||[]).slice().sort()),h=F({queryKey:[`users`],queryFn:()=>i.getUsers()}),_=I({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(K(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,N.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60`,children:(0,N.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,N.jsx)(`h3`,{className:`text-lg font-semibold text-white mb-1`,children:`Site Settings`}),(0,N.jsx)(`p`,{className:`text-zinc-500 text-sm mb-5 font-mono`,children:e.fqdn}),(0,N.jsxs)(`div`,{className:`space-y-4`,children:[(0,N.jsxs)(`label`,{className:`flex items-center justify-between gap-3 cursor-pointer`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`span`,{className:`text-sm text-zinc-200`,children:`SPA Mode`}),(0,N.jsx)(`p`,{className:`text-xs text-zinc-500 mt-0.5`,children:`Fallback to index.html for client-side routing`})]}),(0,N.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,N.jsxs)(`label`,{className:`flex items-center justify-between gap-3 cursor-pointer`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`span`,{className:`text-sm text-zinc-200`,children:`Authelia Protected`}),(0,N.jsx)(`p`,{className:`text-xs text-zinc-500 mt-0.5`,children:`Require login to access this site`})]}),(0,N.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,N.jsxs)(`div`,{children:[(0,N.jsx)(`span`,{className:`text-sm text-zinc-200`,children:`Redirect aliases`}),(0,N.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,N.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,N.jsxs)(`div`,{children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,N.jsx)(ha,{size:14,className:`text-cyan-400`}),(0,N.jsx)(`span`,{className:`text-sm text-zinc-200`,children:`Allowed Users`})]}),(0,N.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,N.jsx)(`div`,{className:`flex flex-wrap gap-2 mb-3`,children:l.map(e=>(0,N.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,N.jsx)(`button`,{type:`button`,onClick:()=>S(e),disabled:_.isPending,className:`hover:text-red-400`,children:(0,N.jsx)(ka,{size:12})})]},e))}),b.length>0&&(0,N.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,N.jsx)(`option`,{value:``,children:`Add user...`}),b.map(e=>(0,N.jsxs)(`option`,{value:e.username,children:[e.username,` (`,e.displayname,`)`]},e.username))]}),h.isLoading&&(0,N.jsx)(`p`,{className:`text-xs text-zinc-500`,children:`Loading users...`})]})]}),(0,N.jsxs)(`div`,{className:`flex items-center justify-end gap-3 mt-6`,children:[(0,N.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,N.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,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(V,{size:14,className:`animate-spin`}),`Saving...`]}):`Save Changes`})]})]})})}function ko({sites:e,onDelete:t,onFiles:n,onVerifyDns:r,onSettings:i}){return(0,N.jsx)(`div`,{className:`hidden md:block overflow-x-auto`,children:(0,N.jsxs)(`table`,{className:`w-full`,children:[(0,N.jsx)(`thead`,{children:(0,N.jsxs)(`tr`,{className:`border-b border-zinc-700`,children:[(0,N.jsx)(`th`,{className:`text-left text-zinc-400 text-xs uppercase font-semibold py-3 px-4`,children:`Name`}),(0,N.jsx)(`th`,{className:`text-left text-zinc-400 text-xs uppercase font-semibold py-3 px-4`,children:`Domain`}),(0,N.jsx)(`th`,{className:`text-left text-zinc-400 text-xs uppercase font-semibold py-3 px-4`,children:`Type`}),(0,N.jsx)(`th`,{className:`text-left text-zinc-400 text-xs uppercase font-semibold py-3 px-4`,children:`Status`}),(0,N.jsx)(`th`,{className:`text-left text-zinc-400 text-xs uppercase font-semibold py-3 px-4`,children:`Size`}),(0,N.jsx)(`th`,{className:`text-left text-zinc-400 text-xs uppercase font-semibold py-3 px-4`,children:`Created`}),(0,N.jsx)(`th`,{className:`text-right text-zinc-400 text-xs uppercase font-semibold py-3 px-4`,children:`Actions`})]})}),(0,N.jsx)(`tbody`,{children:e.map(e=>(0,N.jsxs)(`tr`,{className:`border-b border-zinc-700 bg-zinc-800/50`,children:[(0,N.jsx)(`td`,{className:`py-3 px-4 text-sm text-zinc-200 font-mono`,children:e.name}),(0,N.jsxs)(`td`,{className:`py-3 px-4 text-sm`,children:[e.certIssued?(0,N.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,N.jsx)(Ei,{size:12})]}):(0,N.jsx)(`span`,{className:`text-zinc-400 font-mono`,children:e.fqdn}),(e.aliases||[]).length>0&&(0,N.jsxs)(`p`,{className:`text-xs text-zinc-500 font-mono mt-0.5`,children:[`also `,e.aliases.join(`, `)]})]}),(0,N.jsx)(`td`,{className:`py-3 px-4`,children:(0,N.jsx)(Co,{type:e.type})}),(0,N.jsx)(`td`,{className:`py-3 px-4`,children:(0,N.jsx)(So,{site:e})}),(0,N.jsx)(`td`,{className:`py-3 px-4 text-sm text-zinc-400 font-mono`,children:xo(e.totalSize||0)}),(0,N.jsx)(`td`,{className:`py-3 px-4 text-sm text-zinc-500`,children:bo(e.createdAt)}),(0,N.jsx)(`td`,{className:`py-3 px-4 text-right`,children:(0,N.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[e.type===`custom`&&!e.dnsVerified&&(0,N.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,N.jsx)(Fi,{size:12}),`Verify DNS`]}),(0,N.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,N.jsx)(fa,{size:12}),`Settings`]}),(0,N.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,N.jsx)(Mi,{size:12}),`Files`]}),(0,N.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,N.jsx)(ba,{size:12}),`Delete`]})]})})]},e.id))})]})})}function Ao({sites:e,onDelete:t,onFiles:n,onVerifyDns:r,onSettings:i}){return(0,N.jsx)(`div`,{className:`md:hidden space-y-3`,children:e.map(e=>(0,N.jsxs)(`div`,{className:`bg-zinc-800/50 border border-zinc-700 rounded-lg p-4`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,N.jsx)(`span`,{className:`text-sm font-semibold text-zinc-200 font-mono`,children:e.name}),(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(Co,{type:e.type}),(0,N.jsx)(So,{site:e})]})]}),e.certIssued?(0,N.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,N.jsx)(Ei,{size:12})]}):(0,N.jsx)(`span`,{className:`text-zinc-400 text-sm font-mono`,children:e.fqdn}),(e.aliases||[]).length>0&&(0,N.jsxs)(`p`,{className:`text-xs text-zinc-500 font-mono mb-1`,children:[`also `,e.aliases.join(`, `)]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-4 text-xs text-zinc-500 mt-2`,children:[(0,N.jsx)(`span`,{children:xo(e.totalSize||0)}),(0,N.jsx)(`span`,{children:bo(e.createdAt)})]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-2 mt-3`,children:[e.type===`custom`&&!e.dnsVerified&&(0,N.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,N.jsx)(Fi,{size:12}),`Verify DNS`]}),(0,N.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,N.jsx)(fa,{size:12}),`Settings`]}),(0,N.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,N.jsx)(Mi,{size:12}),`Files`]}),(0,N.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,N.jsx)(ba,{size:12}),`Delete`]})]})]},e.id))})}function jo({domain:e}){let t=P(),n=G(),r=R(),[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=F({queryKey:[`sites`],queryFn:()=>r.getSites(),refetchInterval:1e4}),h=I({mutationFn:e=>r.deleteSite(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`sites`]}),n(`Site ${o.fqdn} deleted`),s(null)},onError:e=>{n(K(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,N.jsx)(no,{site:c,onBack:()=>l(null)}):(0,N.jsxs)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:[(0,N.jsxs)(`div`,{className:`mb-6 flex items-center justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h1`,{className:`text-xl font-bold text-white`,children:`Static Sites`}),(0,N.jsx)(`p`,{className:`text-zinc-500 text-sm mt-1`,children:`Host static websites, landing pages, and SPAs`})]}),!i&&(0,N.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,N.jsx)(ta,{size:14}),`Add Site`]})]}),i&&e&&(0,N.jsx)(To,{domain:e,onClose:()=>a(!1)}),m.isLoading?(0,N.jsx)(`div`,{className:`space-y-3`,children:Array.from({length:3}).map((e,t)=>(0,N.jsx)(`div`,{className:`h-16 animate-pulse rounded-lg bg-zinc-900 border border-zinc-800`},t))}):m.isError?(0,N.jsx)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-6`,children:(0,N.jsx)(`p`,{className:`text-red-400 text-sm`,children:`Failed to load sites`})}):S.length===0?(0,N.jsxs)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-12 text-center`,children:[(0,N.jsx)(ki,{size:32,className:`mx-auto text-zinc-600 mb-3`}),(0,N.jsx)(`p`,{className:`text-zinc-400 text-sm`,children:`No static sites yet. Create your first site to get started.`})]}):(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(ko,{sites:S,onDelete:_,onFiles:v,onVerifyDns:y,onSettings:b}),(0,N.jsx)(Ao,{sites:S,onDelete:_,onFiles:v,onVerifyDns:y,onSettings:b})]}),u&&(0,N.jsx)(Eo,{site:u,onClose:()=>d(null)}),f&&(0,N.jsx)(Oo,{site:f,onClose:()=>p(null)}),o&&(0,N.jsx)(Do,{site:o,onConfirm:x,onCancel:()=>s(null),isPending:h.isPending})]})}var Mo=Object.defineProperty,No=Object.getOwnPropertySymbols,Po=Object.prototype.hasOwnProperty,Fo=Object.prototype.propertyIsEnumerable,Io=(e,t,n)=>t in e?Mo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Lo=(e,t)=>{for(var n in t||={})Po.call(t,n)&&Io(e,n,t[n]);if(No)for(var n of No(t))Fo.call(t,n)&&Io(e,n,t[n]);return e},Ro=(e,t)=>{var n={};for(var r in e)Po.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&No)for(var r of No(e))t.indexOf(r)<0&&Fo.call(e,r)&&(n[r]=e[r]);return n},zo;(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})(zo||={}),(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||={})})(zo||={}),(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||={})})(zo||={});var Bo=zo,Vo={L:Bo.QrCode.Ecc.LOW,M:Bo.QrCode.Ecc.MEDIUM,Q:Bo.QrCode.Ecc.QUARTILE,H:Bo.QrCode.Ecc.HIGH},Ho=128,Uo=`L`,Wo=`#FFFFFF`,Go=`#000000`,Ko=!1,qo=1,Jo=4,Yo=0,Xo=.1;function Zo(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 Qo(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 $o(e,t,n,r){if(r==null)return null;let i=e.length+n*2,a=Math.floor(t*Xo),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 es(e,t){return t==null?e?Jo:Yo:Math.max(Math.floor(t),0)}function ts({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(...Bo.QrSegment.makeSegments(t)),e),[]);return Bo.QrCode.encodeSegments(r,Vo[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=es(r,i);return{cells:e,margin:t,numCells:e.length+t*2,calculatedImageSettings:$o(e,o,t,a)}},[c,o,a,r,i]);return{qrcode:c,margin:u,cells:l,numCells:d,calculatedImageSettings:f}}var ns=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),rs=g.forwardRef(function(e,t){let n=e,{value:r,size:i=Ho,level:a=Uo,bgColor:o=Wo,fgColor:s=Go,includeMargin:c=Ko,minVersion:l=qo,boostLevel:u,marginSize:d,imageSettings:f}=n,p=Ro(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`marginSize`,`imageSettings`]),{style:m}=p,h=Ro(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}=ts({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=Qo(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,ns?t.fill(new Path2D(Zo(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=Lo({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`,Lo({style:D,height:i,width:i,ref:b,role:`img`},h)),ee)});rs.displayName=`QRCodeCanvas`;var is=g.forwardRef(function(e,t){let n=e,{value:r,size:i=Ho,level:a=Uo,bgColor:o=Wo,fgColor:s=Go,includeMargin:c=Ko,minVersion:l=qo,boostLevel:u,title:d,marginSize:f,imageSettings:p}=n,m=Ro(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`title`,`marginSize`,`imageSettings`]),{margin:h,cells:_,numCells:v,calculatedImageSettings:y}=ts({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=Qo(_,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=Zo(b,h);return g.createElement(`svg`,Lo({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)});is.displayName=`QRCodeSVG`;function as({children:e,onClose:t}){return(0,N.jsx)(`div`,{className:`fixed inset-0 z-40 flex items-center justify-center bg-black/50`,children:(0,N.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,N.jsx)(`button`,{type:`button`,onClick:t,className:`absolute right-4 top-4 text-zinc-500 hover:text-zinc-300`,children:(0,N.jsx)(ka,{size:18})}),e]})})}function os({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,N.jsxs)(as,{onClose:t,children:[(0,N.jsx)(`h2`,{className:`mb-4 text-lg font-bold text-white`,children:`Two-Factor Authentication Setup`}),(0,N.jsx)(`p`,{className:`mb-4 text-sm text-zinc-400`,children:`Scan this QR code with your authenticator app (Google Authenticator, Authy, etc.)`}),(0,N.jsx)(`div`,{className:`mb-4 flex justify-center`,children:(0,N.jsx)(`div`,{className:`rounded-lg bg-zinc-900 p-4`,children:(0,N.jsx)(is,{value:e,size:200,bgColor:`transparent`,fgColor:`#ffffff`})})}),(0,N.jsx)(`p`,{className:`mb-2 text-sm text-zinc-400`,children:`Or enter this code manually:`}),(0,N.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 rounded-lg bg-zinc-900 px-4 py-3`,children:[(0,N.jsx)(`code`,{className:`flex-1 font-mono text-sm text-cyan-400 tracking-wider`,children:o}),(0,N.jsx)(`button`,{type:`button`,onClick:s,className:`text-zinc-500 hover:text-zinc-300`,title:`Copy secret`,children:n?(0,N.jsx)(ui,{size:16,className:`text-green-400`}):(0,N.jsx)(xi,{size:16})})]}),(0,N.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,N.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 ss({user:e,onClose:t,onSuccess:n}){let r=!!e,i=G(),a=P(),o=R(),[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=I({mutationFn:e=>o.createUser(e),onSuccess:()=>a.invalidateQueries({queryKey:[`users`]})}),m=I({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(K(e))}}let y=h.isPending;return(0,N.jsxs)(as,{onClose:t,children:[(0,N.jsx)(`h2`,{className:`mb-4 text-lg font-bold text-white`,children:r?`Edit User`:`Add User`}),(0,N.jsxs)(`form`,{onSubmit:v,className:`space-y-4`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`label`,{className:`mb-1 block text-sm text-zinc-400`,children:`Username`}),(0,N.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,N.jsxs)(`div`,{children:[(0,N.jsx)(`label`,{className:`mb-1 block text-sm text-zinc-400`,children:`Display Name`}),(0,N.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,N.jsxs)(`div`,{children:[(0,N.jsx)(`label`,{className:`mb-1 block text-sm text-zinc-400`,children:`Email`}),(0,N.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,N.jsxs)(`div`,{children:[(0,N.jsxs)(`label`,{className:`mb-1 block text-sm text-zinc-400`,children:[`Password`,r?` (leave blank to keep current)`:``]}),(0,N.jsxs)(`div`,{className:`relative`,children:[(0,N.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,N.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,N.jsx)(Di,{size:16}):(0,N.jsx)(Oi,{size:16})})]})]}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`label`,{className:`mb-1 block text-sm text-zinc-400`,children:`Groups (comma-separated)`}),(0,N.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,N.jsx)(`p`,{className:`text-sm text-red-400`,children:d}),(0,N.jsxs)(`div`,{className:`flex gap-3 pt-2`,children:[(0,N.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,N.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 cs({onClose:e,onSuccess:t}){let n=G(),r=P(),i=R(),[a,o]=(0,g.useState)({username:``,email:``,groups:``}),[s,c]=(0,g.useState)(``),l=I({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(K(e))}}return(0,N.jsxs)(as,{onClose:e,children:[(0,N.jsx)(`h2`,{className:`mb-4 text-lg font-bold text-white`,children:`Invite User`}),(0,N.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,N.jsxs)(`form`,{onSubmit:d,className:`space-y-4`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`label`,{className:`mb-1 block text-sm text-zinc-400`,children:`Username`}),(0,N.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,N.jsxs)(`div`,{children:[(0,N.jsx)(`label`,{className:`mb-1 block text-sm text-zinc-400`,children:`Email`}),(0,N.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,N.jsxs)(`div`,{children:[(0,N.jsx)(`label`,{className:`mb-1 block text-sm text-zinc-400`,children:`Groups (comma-separated, optional)`}),(0,N.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,N.jsx)(`p`,{className:`text-sm text-red-400`,children:s}),(0,N.jsxs)(`div`,{className:`flex gap-3 pt-2`,children:[(0,N.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,N.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 ls({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,N.jsxs)(as,{onClose:n,children:[(0,N.jsx)(`h2`,{className:`mb-4 text-lg font-bold text-white`,children:`Invitation Created`}),(0,N.jsx)(`p`,{className:`mb-4 text-sm text-zinc-400`,children:`Share this link with the invited user. It expires in 7 days.`}),(0,N.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 rounded-lg bg-zinc-900 px-4 py-3`,children:[(0,N.jsx)(`code`,{className:`flex-1 text-sm text-cyan-400 break-all`,children:a}),(0,N.jsx)(`button`,{type:`button`,onClick:o,className:`flex-shrink-0 text-zinc-500 hover:text-zinc-300`,title:`Copy link`,children:r?(0,N.jsx)(ui,{size:16,className:`text-green-400`}):(0,N.jsx)(xi,{size:16})})]}),!e&&(0,N.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,N.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 us({title:e,message:t,confirmLabel:n,destructive:r,onConfirm:i,onCancel:a,isPending:o}){return(0,N.jsxs)(as,{onClose:a,children:[(0,N.jsx)(`h2`,{className:`mb-2 text-lg font-bold text-white`,children:e}),(0,N.jsx)(`p`,{className:`mb-6 text-sm text-zinc-400`,children:t}),(0,N.jsxs)(`div`,{className:`flex gap-3`,children:[(0,N.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,N.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 ds(){let e=G(),t=P(),n=R(),[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=F({queryKey:[`users`],queryFn:()=>n.getUsers()}),x=I({mutationFn:e=>n.deleteUser(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`users`]}),e(`User deleted successfully`),c(null)},onError:t=>{e(K(t),`error`),c(null)}}),S=I({mutationFn:e=>n.resetTotp(e),onSuccess:e=>{f(null),u(e.totpUri)},onError:t=>{e(K(t),`error`),f(null)}}),C=F({queryKey:[`invitations`],queryFn:()=>n.getInvitations()}),w=I({mutationFn:e=>n.revokeInvitation(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`invitations`]}),e(`Invitation revoked`),y(null)},onError:t=>{e(K(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,N.jsxs)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:[(0,N.jsxs)(`div`,{className:`mb-6 flex items-center justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h1`,{className:`text-xl font-bold text-white`,children:`Users`}),(0,N.jsx)(`p`,{className:`text-zinc-500 text-sm mt-1`,children:`Manage Authelia users and two-factor authentication.`})]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.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,N.jsx)(qi,{size:16}),`Invite User`]}),(0,N.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,N.jsx)(Ta,{size:16}),`Add User`]})]})]}),(0,N.jsx)(`div`,{className:`overflow-x-auto rounded-lg border border-zinc-800 bg-zinc-900`,children:b.isLoading?(0,N.jsx)(`div`,{className:`p-8 text-center`,children:(0,N.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,N.jsx)(`div`,{className:`p-8 text-center text-red-400 text-sm`,children:`Failed to load users`}):T.length===0?(0,N.jsx)(`div`,{className:`p-8 text-center text-zinc-500 text-sm`,children:`No users configured. Add your first user to get started.`}):(0,N.jsxs)(`table`,{className:`w-full text-left`,children:[(0,N.jsx)(`thead`,{children:(0,N.jsxs)(`tr`,{className:`border-b border-zinc-700`,children:[(0,N.jsx)(`th`,{className:`px-4 py-3 text-xs font-semibold uppercase text-zinc-400`,children:`Username`}),(0,N.jsx)(`th`,{className:`px-4 py-3 text-xs font-semibold uppercase text-zinc-400`,children:`Display Name`}),(0,N.jsx)(`th`,{className:`px-4 py-3 text-xs font-semibold uppercase text-zinc-400 hidden sm:table-cell`,children:`Email`}),(0,N.jsx)(`th`,{className:`px-4 py-3 text-xs font-semibold uppercase text-zinc-400 hidden md:table-cell`,children:`Groups`}),(0,N.jsx)(`th`,{className:`px-4 py-3 text-xs font-semibold uppercase text-zinc-400 text-right`,children:`Actions`})]})}),(0,N.jsx)(`tbody`,{children:T.map(e=>(0,N.jsxs)(`tr`,{className:`border-b border-zinc-700 last:border-b-0`,children:[(0,N.jsx)(`td`,{className:`px-4 py-3 font-mono text-sm text-cyan-400`,children:e.username}),(0,N.jsx)(`td`,{className:`px-4 py-3 text-sm text-zinc-300`,children:e.displayname}),(0,N.jsx)(`td`,{className:`px-4 py-3 text-sm text-zinc-400 hidden sm:table-cell`,children:e.email}),(0,N.jsx)(`td`,{className:`px-4 py-3 hidden md:table-cell`,children:(0,N.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:(e.groups||[]).map(e=>(0,N.jsx)(`span`,{className:`rounded bg-zinc-700 px-2 py-0.5 text-xs text-zinc-300`,children:e},e))})}),(0,N.jsx)(`td`,{className:`px-4 py-3 text-right`,children:(0,N.jsxs)(`div`,{className:`flex items-center justify-end gap-1`,children:[(0,N.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,N.jsx)($i,{size:14})}),(0,N.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,N.jsx)(Bi,{size:14})}),(0,N.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,N.jsx)(ba,{size:14})})]})})]},e.username))})]})}),(0,N.jsxs)(`div`,{className:`mt-8 mb-6`,children:[(0,N.jsx)(`h2`,{className:`text-lg font-bold text-white mb-1`,children:`Invitations`}),(0,N.jsx)(`p`,{className:`text-zinc-500 text-sm`,children:`Pending and past invitation links.`})]}),(0,N.jsx)(`div`,{className:`overflow-x-auto rounded-lg border border-zinc-800 bg-zinc-900`,children:C.isLoading?(0,N.jsx)(`div`,{className:`p-8 text-center`,children:(0,N.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,N.jsx)(`div`,{className:`p-8 text-center text-red-400 text-sm`,children:`Failed to load invitations`}):E.length===0?(0,N.jsx)(`div`,{className:`p-8 text-center text-zinc-500 text-sm`,children:`No invitations yet. Click "Invite User" to generate a link.`}):(0,N.jsxs)(`table`,{className:`w-full text-left`,children:[(0,N.jsx)(`thead`,{children:(0,N.jsxs)(`tr`,{className:`border-b border-zinc-700`,children:[(0,N.jsx)(`th`,{className:`px-4 py-3 text-xs font-semibold uppercase text-zinc-400`,children:`Username`}),(0,N.jsx)(`th`,{className:`px-4 py-3 text-xs font-semibold uppercase text-zinc-400 hidden sm:table-cell`,children:`Email`}),(0,N.jsx)(`th`,{className:`px-4 py-3 text-xs font-semibold uppercase text-zinc-400`,children:`Status`}),(0,N.jsx)(`th`,{className:`px-4 py-3 text-xs font-semibold uppercase text-zinc-400 hidden md:table-cell`,children:`Expires`}),(0,N.jsx)(`th`,{className:`px-4 py-3 text-xs font-semibold uppercase text-zinc-400 text-right`,children:`Actions`})]})}),(0,N.jsx)(`tbody`,{children:E.map(e=>(0,N.jsxs)(`tr`,{className:`border-b border-zinc-700 last:border-b-0`,children:[(0,N.jsx)(`td`,{className:`px-4 py-3 font-mono text-sm text-cyan-400`,children:e.username}),(0,N.jsx)(`td`,{className:`px-4 py-3 text-sm text-zinc-400 hidden sm:table-cell`,children:e.email}),(0,N.jsx)(`td`,{className:`px-4 py-3`,children:(0,N.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,N.jsx)(`td`,{className:`px-4 py-3 text-sm text-zinc-500 hidden md:table-cell`,children:new Date(e.expiresAt).toLocaleDateString()}),(0,N.jsx)(`td`,{className:`px-4 py-3 text-right`,children:e.status===`pending`&&(0,N.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,N.jsx)(vi,{size:14})})})]},e.id))})]})}),p&&(0,N.jsx)(cs,{onClose:()=>m(!1),onSuccess:e=>{m(!1),_(e)}}),h&&(0,N.jsx)(ls,{inviteUrl:h.inviteUrl,token:h.token,onClose:()=>_(null)}),v&&(0,N.jsx)(us,{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,N.jsx)(ss,{onClose:()=>i(!1),onSuccess:ee}),a&&(0,N.jsx)(ss,{user:a,onClose:()=>o(null)}),s&&(0,N.jsx)(us,{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,N.jsx)(us,{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,N.jsx)(os,{totpUri:l,onClose:re}),(0,N.jsx)(fs,{})]})}function fs(){let e=R(),[t,n]=(0,g.useState)(!1),r=F({queryKey:[`identity-groups`],queryFn:()=>e.getIdentityGroups(),retry:!1,staleTime:6e4}),i=F({queryKey:[`identity-self`],queryFn:()=>e.getIdentitySelf(),retry:!1,staleTime:6e4,enabled:t}),a=r.data?.groups||[];return(0,N.jsxs)(`div`,{className:`mt-8 border-t border-zinc-700 pt-6`,children:[(0,N.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,N.jsx)(ji,{size:18,className:`text-cyan-400`}),`Identity & Groups`,t?(0,N.jsx)(mi,{size:16,className:`text-zinc-500 ml-auto`}):(0,N.jsx)(di,{size:16,className:`text-zinc-500 ml-auto`})]}),t&&(0,N.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[i.data&&(0,N.jsxs)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-4`,children:[(0,N.jsx)(`h3`,{className:`text-sm font-medium text-zinc-400 mb-2`,children:`Your Identity (via Authelia)`}),(0,N.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-sm`,children:[(0,N.jsx)(`span`,{className:`text-zinc-500`,children:`Username:`}),(0,N.jsx)(`span`,{className:`text-zinc-200`,children:i.data.username||`—`}),(0,N.jsx)(`span`,{className:`text-zinc-500`,children:`Display Name:`}),(0,N.jsx)(`span`,{className:`text-zinc-200`,children:i.data.displayName||`—`}),(0,N.jsx)(`span`,{className:`text-zinc-500`,children:`Email:`}),(0,N.jsx)(`span`,{className:`text-zinc-200`,children:i.data.email||`—`}),(0,N.jsx)(`span`,{className:`text-zinc-500`,children:`Groups:`}),(0,N.jsx)(`span`,{className:`text-zinc-200`,children:i.data.groups?.length>0?i.data.groups.join(`, `):`—`})]})]}),i.isError&&(0,N.jsx)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-4`,children:(0,N.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,N.jsx)(`div`,{className:`h-10 animate-pulse rounded-lg bg-zinc-900 border border-zinc-800`}):a.length>0?(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h3`,{className:`text-sm font-medium text-zinc-400 mb-2`,children:`All Groups`}),(0,N.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:a.map(e=>(0,N.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,N.jsx)(`p`,{className:`text-sm text-zinc-500`,children:`No groups defined in Authelia.`})]})]})}function ps(e){return e.os===`darwin`?`macOS`:e.distro?[e.distro.id,e.distro.versionId].filter(Boolean).join(` `):`Linux`}function ms({facts:e,at:t}){if(!e)return(0,N.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=[ps(e),e.arch,`Node ${e.node}`];return n&&r.push(e.systemd?`systemd`:`no systemd`),(0,N.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-x-1.5 text-xs text-zinc-500`,children:[(0,N.jsx)(Si,{size:11,className:`shrink-0 text-zinc-600`}),r.map((e,t)=>(0,N.jsxs)(`span`,{className:`whitespace-nowrap`,children:[t>0&&`· `,e]},`${t}-${e}`)),n&&(e.apphost?(0,N.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,N.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,N.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,N.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,N.jsxs)(`span`,{className:`whitespace-nowrap text-zinc-600`,children:[`· reported `,new Date(t).toLocaleString()]})]})}function hs({type:e}){return(0,N.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 gs({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,N.jsxs)(`span`,{className:`flex items-center gap-1.5 ${t}`,children:[(0,N.jsx)(`span`,{className:`inline-block h-2 w-2 rounded-full ${n}`}),e,`d`]})}function _s(e){if(!e)return`N/A`;try{return new Date(e).toLocaleDateString(`en-US`,{month:`short`,day:`numeric`,year:`numeric`})}catch{return e}}function vs({data:e,isLoading:t}){return t?(0,N.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm text-zinc-500`,children:[(0,N.jsx)(V,{size:14,className:`animate-spin`}),`Checking auto-renewal status...`]}):e?e.active?(0,N.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-x-4 gap-y-1 text-sm text-zinc-400`,children:[(0,N.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,N.jsx)(`span`,{className:`inline-block h-2 w-2 rounded-full bg-green-400`}),`Auto-renewal active`]}),e.nextRun&&(0,N.jsxs)(`span`,{children:[`Next run: `,_s(e.nextRun)]}),e.lastRun&&(0,N.jsxs)(`span`,{children:[`Last renewed: `,_s(e.lastRun)]})]}):(0,N.jsxs)(`div`,{className:`mb-4 flex items-center gap-1.5 text-sm text-amber-400`,children:[(0,N.jsx)(`span`,{className:`inline-block h-2 w-2 rounded-full bg-red-400`}),`Auto-renewal is not active. Certificates may expire.`]}):null}function ys({certs:e,onRenew:t,renewingDomain:n}){let r=e.filter(e=>e.type===`letsencrypt`);return r.length===0?(0,N.jsx)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-6`,children:(0,N.jsx)(`p`,{className:`text-zinc-500 text-sm text-center`,children:`No Let's Encrypt certificates found.`})}):(0,N.jsx)(`div`,{className:`overflow-x-auto rounded-lg border border-zinc-800`,children:(0,N.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,N.jsx)(`thead`,{children:(0,N.jsxs)(`tr`,{className:`border-b border-zinc-700 bg-zinc-900`,children:[(0,N.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400`,children:`Type`}),(0,N.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400`,children:`Domain`}),(0,N.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400`,children:`Expiry Date`}),(0,N.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400`,children:`Days Remaining`}),(0,N.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400`,children:`Actions`})]})}),(0,N.jsx)(`tbody`,{children:r.map(e=>(0,N.jsxs)(`tr`,{className:`border-b border-zinc-700 bg-zinc-800`,children:[(0,N.jsx)(`td`,{className:`px-4 py-3`,children:(0,N.jsx)(hs,{type:e.type})}),(0,N.jsx)(`td`,{className:`px-4 py-3 text-zinc-300 font-mono text-xs`,children:e.domain||`N/A`}),(0,N.jsx)(`td`,{className:`px-4 py-3 text-zinc-400`,children:_s(e.expiresAt)}),(0,N.jsx)(`td`,{className:`px-4 py-3`,children:(0,N.jsx)(gs,{days:e.daysUntilExpiry})}),(0,N.jsx)(`td`,{className:`px-4 py-3`,children:(0,N.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,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(V,{size:12,className:`animate-spin`}),`Renewing...`]}):(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(ia,{size:12}),`Renew`]})})})]},e.domain||e.path))})]})})}function bs({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,N.jsx)(`div`,{className:`mt-8`,children:(0,N.jsxs)(`div`,{className:`border-t border-zinc-700 pt-6`,children:[(0,N.jsxs)(`h2`,{className:`text-lg font-semibold text-white mb-4 flex items-center gap-2`,children:[(0,N.jsx)(ma,{size:18,className:`text-purple-400`}),`mTLS Certificates`,a&&(0,N.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,N.jsxs)(`div`,{className:`space-y-4`,children:[r&&(0,N.jsxs)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-5`,children:[(0,N.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,N.jsxs)(`div`,{children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,N.jsx)(hs,{type:`mtls-ca`}),(0,N.jsx)(`span`,{className:`text-white font-semibold text-sm`,children:`Certificate Authority`})]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-4 text-sm text-zinc-400 mt-2`,children:[(0,N.jsxs)(`span`,{children:[`Expires: `,_s(r.expiresAt)]}),(0,N.jsx)(gs,{days:r.daysUntilExpiry})]})]})}),(0,N.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,N.jsxs)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-5`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,N.jsx)(hs,{type:`mtls-client`}),(0,N.jsx)(`span`,{className:`text-white font-semibold text-sm`,children:`Client Certificate`})]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-4 text-sm text-zinc-400 mt-2`,children:[(0,N.jsxs)(`span`,{children:[`Expires: `,_s(i.expiresAt)]}),(0,N.jsx)(gs,{days:i.daysUntilExpiry})]})]}),!a&&(0,N.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,N.jsx)(ia,{size:12}),`Rotate`]})]}),a&&(0,N.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,N.jsx)(`code`,{className:`bg-zinc-800 px-1 py-0.5 rounded`,children:`sudo lamaste-reset-admin`}),` `,`on the server.`]})]})]})]})})}function xs({status:e}){return(0,N.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 Ss({method:e}){return e===`hardware-bound`?(0,N.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,N.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,N.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 Cs(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 ws({label:e}){let t=Cs(e);return t?(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`span`,{className:`text-zinc-200 font-semibold`,children:t.displayName}),(0,N.jsxs)(`span`,{className:`block text-xs text-zinc-500 mt-0.5`,title:e,children:[`via `,t.viaAgent]})]}):(0,N.jsx)(`span`,{className:`text-zinc-200 font-semibold`,children:e})}var Ts=[{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 Es({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,N.jsx)(`div`,{className:`space-y-2`,children:Ts.map(t=>(0,N.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,N.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,N.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,N.jsx)(`span`,{className:`text-sm font-mono text-zinc-200`,children:t.label}),(0,N.jsx)(`p`,{className:`text-xs text-zinc-500`,children:t.description})]})]},t.value))})}function Ds({onClose:e}){let t=R(),n=P(),r=G(),[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:_}=F({queryKey:[`sites`],queryFn:()=>t.getSites()}),v=I({mutationFn:e=>t.generateAgentCert(e),onSuccess:e=>{d(e),n.invalidateQueries({queryKey:[`agent-certs`]})},onError:e=>{h(K(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,N.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4`,children:(0,N.jsxs)(`div`,{className:`w-full max-w-lg rounded-lg bg-zinc-900 border border-zinc-800 shadow-xl`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between border-b border-zinc-800 px-6 py-4`,children:[(0,N.jsxs)(`h3`,{className:`flex items-center gap-2 text-lg font-semibold text-white`,children:[(0,N.jsx)(Vi,{size:20,className:`text-cyan-400`}),u?`Certificate Generated`:`Generate Agent Certificate`]}),!v.isPending&&(0,N.jsx)(`button`,{type:`button`,onClick:S,className:`text-zinc-500 hover:text-zinc-300`,children:(0,N.jsx)(ka,{size:18})})]}),(0,N.jsx)(`div`,{className:`px-6 py-5`,children:u?(0,N.jsxs)(`div`,{className:`space-y-5`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`label`,{className:`text-sm font-medium text-zinc-300 block mb-2`,children:`Certificate Password:`}),(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.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,N.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,N.jsx)(ui,{size:16,className:`text-green-400`}):(0,N.jsx)(xi,{size:16})})]})]}),(0,N.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,N.jsx)(`p`,{className:`font-semibold`,children:`Save this password — it cannot be retrieved later.`}),(0,N.jsx)(`p`,{children:`Share the .p12 file and password securely with the Mac user.`})]}),(0,N.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,N.jsx)(wi,{size:16}),`Download `,u.label,`.p12`]}),(0,N.jsx)(`div`,{className:`flex justify-end`,children:(0,N.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,N.jsxs)(`form`,{onSubmit:y,className:`space-y-4`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`label`,{className:`block text-sm font-medium text-zinc-300 mb-1`,children:`Label`}),(0,N.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,N.jsx)(`p`,{className:`text-xs text-zinc-500 mt-1`,children:`Lowercase letters, numbers, and hyphens only.`})]}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`label`,{className:`block text-sm font-medium text-zinc-300 mb-2`,children:`Capabilities`}),(0,N.jsx)(Es,{capabilities:o,onChange:s,disabled:v.isPending})]}),(o.includes(`sites:read`)||o.includes(`sites:write`))&&(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`label`,{className:`block text-sm font-medium text-zinc-300 mb-2`,children:`Site Access`}),(0,N.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,N.jsx)(`div`,{className:`space-y-1`,children:_.sites.map(e=>(0,N.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-zinc-300 cursor-pointer`,children:[(0,N.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,N.jsx)(`span`,{className:`font-mono`,children:e.name}),(0,N.jsxs)(`span`,{className:`text-zinc-500 text-xs`,children:[`(`,e.fqdn,`)`]})]},e.id))}):(0,N.jsx)(`p`,{className:`text-xs text-zinc-500`,children:`No sites created yet.`})]}),m&&(0,N.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,N.jsxs)(`div`,{className:`flex items-center gap-3 justify-end`,children:[(0,N.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,N.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,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(V,{size:14,className:`animate-spin`}),`Generating...`]}):(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(Vi,{size:14}),`Generate`]})})]})]})})]})})}function Os({label:e,onConfirm:t,onCancel:n,isPending:r}){return(0,N.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60`,children:(0,N.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,N.jsx)(`h3`,{className:`text-lg font-semibold text-white mb-2`,children:`Revoke Certificate`}),(0,N.jsxs)(`p`,{className:`text-zinc-400 text-sm mb-6`,children:[`Revoke certificate for ‘`,(0,N.jsx)(`span`,{className:`text-cyan-400 font-mono`,children:e}),`’? The Mac agent using this certificate will immediately lose access.`]}),(0,N.jsxs)(`div`,{className:`flex items-center justify-end gap-3`,children:[(0,N.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,N.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,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(V,{size:14,className:`animate-spin`}),`Revoking...`]}):`Revoke`})]})]})})}function ks({agent:e,onClose:t}){let n=R(),r=P(),i=G(),[a,o]=(0,g.useState)(e.capabilities||[`tunnels:read`]),s=I({mutationFn:t=>n.updateAgentCapabilities(e.label,t),onSuccess:()=>{r.invalidateQueries({queryKey:[`agent-certs`]}),i(`Capabilities updated for ${e.label}`),t()},onError:e=>{i(K(e),`error`)}});return(0,N.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4`,children:(0,N.jsxs)(`div`,{className:`w-full max-w-lg rounded-lg bg-zinc-900 border border-zinc-800 shadow-xl`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between border-b border-zinc-800 px-6 py-4`,children:[(0,N.jsxs)(`h3`,{className:`flex items-center gap-2 text-lg font-semibold text-white`,children:[(0,N.jsx)(fa,{size:20,className:`text-cyan-400`}),`Capabilities — `,e.label]}),(0,N.jsx)(`button`,{type:`button`,onClick:t,className:`text-zinc-500 hover:text-zinc-300`,children:(0,N.jsx)(ka,{size:18})})]}),(0,N.jsxs)(`div`,{className:`px-6 py-5 space-y-4`,children:[(0,N.jsx)(Es,{capabilities:a,onChange:o,disabled:s.isPending}),(0,N.jsxs)(`div`,{className:`flex items-center gap-3 justify-end`,children:[(0,N.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,N.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,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(V,{size:14,className:`animate-spin`}),`Saving...`]}):`Save`})]})]})]})})}function As({agent:e,onClose:t}){let n=R(),r=P(),i=G(),[a,o]=(0,g.useState)(e.allowedSites||[]),{data:s}=F({queryKey:[`sites`],queryFn:()=>n.getSites()}),c=I({mutationFn:t=>n.updateAgentAllowedSites(e.label,t),onSuccess:()=>{r.invalidateQueries({queryKey:[`agent-certs`]}),i(`Allowed sites updated for ${e.label}`),t()},onError:e=>{i(K(e),`error`)}});return(0,N.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4`,children:(0,N.jsxs)(`div`,{className:`w-full max-w-lg rounded-lg bg-zinc-900 border border-zinc-800 shadow-xl`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between border-b border-zinc-800 px-6 py-4`,children:[(0,N.jsxs)(`h3`,{className:`flex items-center gap-2 text-lg font-semibold text-white`,children:[(0,N.jsx)(Fi,{size:20,className:`text-cyan-400`}),`Site Access — `,e.label]}),(0,N.jsx)(`button`,{type:`button`,onClick:t,className:`text-zinc-500 hover:text-zinc-300`,children:(0,N.jsx)(ka,{size:18})})]}),(0,N.jsxs)(`div`,{className:`px-6 py-5 space-y-4`,children:[(0,N.jsx)(`p`,{className:`text-xs text-zinc-500`,children:`Select which static sites this agent can manage files for.`}),s?.sites?.length>0?(0,N.jsx)(`div`,{className:`space-y-1`,children:s.sites.map(e=>(0,N.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-zinc-300 cursor-pointer`,children:[(0,N.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,N.jsx)(`span`,{className:`font-mono`,children:e.name}),(0,N.jsxs)(`span`,{className:`text-zinc-500 text-xs`,children:[`(`,e.fqdn,`)`]})]},e.id))}):(0,N.jsx)(`p`,{className:`text-xs text-zinc-500`,children:`No sites created yet.`}),(0,N.jsxs)(`div`,{className:`flex items-center gap-3 justify-end`,children:[(0,N.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,N.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,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(V,{size:14,className:`animate-spin`}),`Saving...`]}):`Save`})]})]})]})})}function js({onClose:e}){let t=R(),n=P(),[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}=F({queryKey:[`sites`],queryFn:()=>t.getSites()}),x=I({mutationFn:e=>t.createEnrollmentToken(e),onSuccess:e=>{u(e),n.invalidateQueries({queryKey:[`agent-certs`]})},onError:e=>{f(K(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,N.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/70`,children:(0,N.jsxs)(`div`,{className:`w-full max-w-lg rounded-xl bg-zinc-900 border border-zinc-700 p-6 shadow-xl`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,N.jsx)(`h3`,{className:`text-lg font-semibold text-white`,children:l?`Enrollment Token`:`Generate Enrollment Token`}),(0,N.jsx)(`button`,{type:`button`,onClick:e,className:`text-zinc-400 hover:text-white`,children:(0,N.jsx)(ka,{size:20})})]}),l?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(`div`,{className:`space-y-4`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`label`,{className:`block text-sm font-medium text-zinc-300 mb-1`,children:`Agent Label`}),(0,N.jsx)(`p`,{className:`text-sm text-cyan-400 font-mono`,children:l.label})]}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`label`,{className:`block text-sm font-medium text-zinc-300 mb-1`,children:`Enrollment Token`}),(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.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,N.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,N.jsx)(ui,{size:14,className:`text-green-400`}):(0,N.jsx)(xi,{size:14})})]})]}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`label`,{className:`block text-sm font-medium text-zinc-300 mb-1`,children:`Expires`}),(0,N.jsxs)(`p`,{className:`text-sm text-zinc-400`,children:[new Date(l.expiresAt).toLocaleString(),` (10 minutes)`]})]}),(0,N.jsx)(`div`,{className:`rounded bg-amber-500/10 border border-amber-500/20 px-3 py-2`,children:(0,N.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,N.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,N.jsxs)(`div`,{children:[(0,N.jsx)(`label`,{className:`block text-sm font-medium text-zinc-300 mb-1`,children:`Setup Command`}),(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.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,N.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,N.jsx)(ui,{size:14,className:`text-green-400`}):(0,N.jsx)(xi,{size:14})})]}),(0,N.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,N.jsxs)(`div`,{className:`flex justify-end gap-3 mt-6`,children:[(0,N.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(K(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,N.jsx)(V,{size:14,className:`animate-spin inline mr-1`}):(0,N.jsx)(ba,{size:14,className:`inline mr-1`}),`Revoke Token`]}),(0,N.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,N.jsxs)(N.Fragment,{children:[(0,N.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,N.jsxs)(`div`,{className:`space-y-4`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`label`,{className:`block text-sm font-medium text-zinc-300 mb-1`,children:`Agent Label`}),(0,N.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,N.jsx)(Es,{capabilities:a,onChange:o}),(a.includes(`sites:read`)||a.includes(`sites:write`))&&b?.sites?.length>0&&(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`label`,{className:`block text-sm font-medium text-zinc-300 mb-2`,children:`Allowed Sites`}),(0,N.jsx)(`div`,{className:`space-y-2 max-h-40 overflow-y-auto`,children:b.sites.map(e=>(0,N.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,N.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,N.jsx)(`span`,{className:`text-zinc-300`,children:e.name}),e.fqdn&&(0,N.jsx)(`span`,{className:`text-zinc-500 text-xs`,children:e.fqdn})]},e.id))})]}),d&&(0,N.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,N.jsxs)(`div`,{className:`flex justify-end gap-3 mt-6`,children:[(0,N.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,N.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,N.jsx)(V,{size:14,className:`animate-spin inline mr-1`}):null,`Generate Token`]})]})]})]})})}function Ms(){let e=R(),t=P(),n=G(),[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=F({queryKey:[`agent-certs`],queryFn:()=>e.getAgentCerts(),refetchInterval:3e4}),_=I({mutationFn:t=>e.revokeAgentCert(t),onSuccess:()=>{t.invalidateQueries({queryKey:[`agent-certs`]}),n(`Certificate for ${s} revoked`),c(null)},onError:e=>{n(K(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,N.jsxs)(`div`,{className:`mt-8`,children:[(0,N.jsxs)(`div`,{className:`border-t border-zinc-700 pt-6`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,N.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,N.jsx)(Vi,{size:18,className:`text-cyan-400`}),`Agent Certificates`]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.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,N.jsx)(Vi,{size:14}),`Enrollment Token`]}),(0,N.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,N.jsx)(ta,{size:14}),`Generate P12`]})]})]}),x&&(0,N.jsx)(`div`,{className:`flex items-center gap-1 mb-4`,children:[`all`,`regular`,`delegated`].map(e=>(0,N.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,N.jsx)(`div`,{className:`space-y-3`,children:Array.from({length:2}).map((e,t)=>(0,N.jsx)(`div`,{className:`h-14 animate-pulse rounded-lg bg-zinc-900 border border-zinc-800`},t))}):h.isError?(0,N.jsx)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-6`,children:(0,N.jsx)(`p`,{className:`text-red-400 text-sm`,children:`Failed to load agent certificates`})}):S.length===0?(0,N.jsxs)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-8 text-center`,children:[(0,N.jsx)(Vi,{size:32,className:`mx-auto text-zinc-600 mb-3`}),(0,N.jsx)(`p`,{className:`text-zinc-400 text-sm`,children:`No agent certificates. Generate one to connect a Mac tunnel agent.`})]}):(0,N.jsx)(`div`,{className:`overflow-x-auto rounded-lg border border-zinc-800`,children:(0,N.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,N.jsx)(`thead`,{children:(0,N.jsxs)(`tr`,{className:`border-b border-zinc-700 bg-zinc-900`,children:[(0,N.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400`,children:`Label`}),(0,N.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400`,children:`Serial`}),(0,N.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400`,children:`Created`}),(0,N.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400`,children:`Expires`}),(0,N.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400`,children:`Capabilities`}),(0,N.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400`,children:`Delegated By`}),(0,N.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400`,children:`Type`}),(0,N.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400`,children:`Status`}),(0,N.jsx)(`th`,{className:`px-4 py-3 text-right text-xs font-medium uppercase text-zinc-400`,children:`Actions`})]})}),(0,N.jsx)(`tbody`,{children:S.map(t=>(0,N.jsxs)(`tr`,{className:`border-b border-zinc-700 bg-zinc-800`,children:[(0,N.jsxs)(`td`,{className:`px-4 py-3`,children:[(0,N.jsx)(ws,{label:t.label}),!t.revoked&&!Cs(t.label)&&(0,N.jsx)(`div`,{className:`mt-0.5 min-w-[16rem]`,children:(0,N.jsx)(ms,{facts:t.hostFacts,at:t.hostFactsAt})})]}),(0,N.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,N.jsx)(`td`,{className:`px-4 py-3 text-zinc-400`,children:_s(t.createdAt)}),(0,N.jsx)(`td`,{className:`px-4 py-3 text-zinc-400`,children:_s(t.expiresAt)}),(0,N.jsxs)(`td`,{className:`px-4 py-3`,children:[(0,N.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:(t.capabilities||[`tunnels:read`]).map(e=>(0,N.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,N.jsxs)(`span`,{className:`text-xs text-zinc-500 mt-1 block`,children:[`Sites: `,t.allowedSites.join(`, `)]})]}),(0,N.jsx)(`td`,{className:`px-4 py-3`,children:t.delegatedBy?(0,N.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs text-violet-400 font-mono`,children:[(0,N.jsx)(Wi,{size:12,className:`text-violet-400/70`}),t.delegatedBy]}):(0,N.jsx)(`span`,{className:`text-xs text-zinc-600`,children:`—`})}),(0,N.jsx)(`td`,{className:`px-4 py-3`,children:(0,N.jsx)(Ss,{method:t.enrollmentMethod})}),(0,N.jsx)(`td`,{className:`px-4 py-3`,children:(0,N.jsx)(xs,{status:t.status})}),(0,N.jsx)(`td`,{className:`px-4 py-3 text-right`,children:(0,N.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[t.status!==`revoked`&&(0,N.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,N.jsx)(fa,{size:12})}),t.status!==`revoked`&&(0,N.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,N.jsx)(Fi,{size:12})}),t.status!==`revoked`&&t.status!==`expired`&&t.enrollmentMethod!==`hardware-bound`&&(0,N.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,N.jsx)(wi,{size:12})}),t.status!==`revoked`&&(0,N.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,N.jsx)(ba,{size:12})})]})})]},t.label))})]})})]}),r&&(0,N.jsx)(Ds,{onClose:()=>i(!1)}),a&&(0,N.jsx)(js,{onClose:()=>o(!1)}),s&&(0,N.jsx)(Os,{label:s,onConfirm:y,onCancel:()=>c(null),isPending:_.isPending}),l&&(0,N.jsx)(ks,{agent:l,onClose:()=>u(null)}),d&&(0,N.jsx)(As,{agent:d,onClose:()=>f(null)})]})}function Ns({onClose:e}){let t=R(),n=P(),r=G(),[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),_=I({mutationFn:()=>t.rotateMtls(),onSuccess:e=>{s(e),a(`success`),n.invalidateQueries({queryKey:[`certs`]})},onError:e=>{l(K(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(K(e)||`Download failed`,`error`)}},[t,r]),x=(0,g.useCallback)(()=>{if(!m){h(!0);return}e()},[m,e]);return(0,N.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4`,children:(0,N.jsxs)(`div`,{className:`w-full max-w-lg rounded-lg bg-zinc-900 border border-zinc-800 shadow-xl`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between border-b border-zinc-800 px-6 py-4`,children:[(0,N.jsxs)(`h3`,{className:`flex items-center gap-2 text-lg font-semibold text-white`,children:[i===`warning`&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(xa,{size:20,className:`text-amber-400`}),`Rotate Client Certificate`]}),i===`rotating`&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(V,{size:20,className:`animate-spin text-cyan-400`}),`Generating New Certificate...`]}),i===`success`&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(ma,{size:20,className:`text-green-400`}),`New Certificate Ready`]}),i===`error`&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(xa,{size:20,className:`text-red-400`}),`Rotation Failed`]})]}),(i===`warning`||i===`error`)&&(0,N.jsx)(`button`,{type:`button`,onClick:e,className:`text-zinc-500 hover:text-zinc-300`,children:(0,N.jsx)(ka,{size:18})})]}),(0,N.jsxs)(`div`,{className:`px-6 py-5`,children:[i===`warning`&&(0,N.jsxs)(`div`,{className:`space-y-4`,children:[(0,N.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,N.jsx)(`p`,{className:`font-semibold`,children:`This will immediately invalidate your current browser certificate.`}),(0,N.jsxs)(`p`,{children:[`You `,(0,N.jsx)(`strong`,{children:`MUST`}),` download and import the new certificate before closing this page or your browser.`]}),(0,N.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,N.jsxs)(`div`,{className:`flex justify-end gap-3`,children:[(0,N.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,N.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,N.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,N.jsx)(`p`,{className:`text-zinc-400 text-sm`,children:`Generating new certificate...`})}),i===`success`&&o&&(0,N.jsxs)(`div`,{className:`space-y-5`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`label`,{className:`text-sm font-medium text-zinc-300 block mb-2`,children:`Certificate Password (copy this first):`}),(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.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,N.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,N.jsx)(ui,{size:16,className:`text-green-400`}):(0,N.jsx)(xi,{size:16})})]})]}),(0,N.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,N.jsx)(wi,{size:16}),`Download Certificate`]}),(0,N.jsxs)(`ol`,{className:`list-decimal list-inside text-sm text-zinc-400 space-y-1.5 pl-1`,children:[(0,N.jsx)(`li`,{children:`Copy the password above`}),(0,N.jsx)(`li`,{children:`Click Download Certificate`}),(0,N.jsx)(`li`,{children:`Double-click the downloaded file to import it into your browser's keychain`}),(0,N.jsx)(`li`,{children:`Enter the password when prompted`}),(0,N.jsx)(`li`,{children:`Restart your browser to use the new certificate`})]}),(0,N.jsxs)(`div`,{className:`border-t border-zinc-700 pt-4`,children:[(0,N.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,N.jsx)(mi,{size:14}):(0,N.jsx)(di,{size:14}),`Recovery instructions (if locked out)`]}),f&&(0,N.jsxs)(`div`,{className:`mt-3 rounded border border-zinc-700 bg-zinc-950 p-3`,children:[(0,N.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,N.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,N.jsx)(`div`,{className:`flex justify-end`,children:m?(0,N.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,N.jsx)(`span`,{className:`text-sm text-zinc-400`,children:`Have you downloaded and imported the new certificate?`}),(0,N.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,N.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,N.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,N.jsxs)(`div`,{className:`space-y-4`,children:[(0,N.jsxs)(`div`,{className:`rounded-lg bg-red-500/10 border border-red-500/20 p-4 text-sm text-red-400`,children:[(0,N.jsx)(`p`,{className:`font-semibold mb-1`,children:`Rotation failed`}),(0,N.jsx)(`p`,{children:c}),(0,N.jsx)(`p`,{className:`mt-2 text-zinc-400`,children:`Your existing certificate is still valid.`})]}),(0,N.jsx)(`div`,{className:`flex justify-end`,children:(0,N.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 Ps(){let e=R(),t=P(),n=G(),[r,i]=(0,g.useState)(null),[a,o]=(0,g.useState)(!1),s=F({queryKey:[`certs`],queryFn:()=>e.getCerts(),refetchInterval:3e4}),c=F({queryKey:[`auto-renew-status`],queryFn:()=>e.getAutoRenewStatus()}),l=F({queryKey:[`admin-auth-mode`],queryFn:()=>e.getAuthMode()}).data?.adminAuthMode||`p12`,u=I({mutationFn:t=>e.renewCert(t),onSuccess:e=>{t.invalidateQueries({queryKey:[`certs`]});let r=e.newExpiry?` New expiry: ${_s(e.newExpiry)}`:``;n(`Certificate for ${e.domain} renewed.${r}`),e.warning&&n(e.warning,`error`),i(null)},onError:e=>{n(K(e),`error`),i(null)}}),d=(0,g.useCallback)(e=>{i(e),u.mutate(e)},[u]),f=s.data?.certs||[];return(0,N.jsxs)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:[(0,N.jsxs)(`div`,{className:`mb-6`,children:[(0,N.jsx)(`h1`,{className:`text-xl font-bold text-white`,children:`Certificates`}),(0,N.jsx)(`p`,{className:`text-zinc-500 text-sm mt-1`,children:`View and manage TLS and mTLS certificates`})]}),(0,N.jsx)(vs,{data:c.data,isLoading:c.isLoading}),s.isLoading?(0,N.jsx)(`div`,{className:`space-y-3`,children:Array.from({length:3}).map((e,t)=>(0,N.jsx)(`div`,{className:`h-14 animate-pulse rounded-lg bg-zinc-900 border border-zinc-800`},t))}):s.isError?(0,N.jsx)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-6`,children:(0,N.jsx)(`p`,{className:`text-red-400 text-sm`,children:`Failed to load certificates`})}):(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(ys,{certs:f,onRenew:d,renewingDomain:r}),(0,N.jsx)(bs,{certs:f,onRotate:()=>o(!0),adminAuthMode:l}),(0,N.jsx)(Ms,{})]}),a&&(0,N.jsx)(Ns,{onClose:()=>o(!1)})]})}function Fs({status:e}){return(0,N.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 Is({ticket:e}){return e.used?(0,N.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,N.jsx)(`span`,{className:`text-xs px-2 py-0.5 rounded-full bg-red-500/20 text-red-400`,children:`expired`}):(0,N.jsx)(`span`,{className:`text-xs px-2 py-0.5 rounded-full bg-green-500/20 text-green-400`,children:`pending`})}function Ls(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 Rs=[{id:`scopes`,label:`Scopes`},{id:`instances`,label:`Instances`},{id:`assignments`,label:`Assignments`},{id:`tickets`,label:`Tickets`},{id:`sessions`,label:`Sessions`}];function zs(){let e=R(),t=P(),n=G(),{data:r,isLoading:i,isError:a}=F({queryKey:[`ticket-scopes`],queryFn:()=>e.getTicketScopes(),refetchInterval:1e4}),o=I({mutationFn:t=>e.deleteTicketScope(t),onSuccess:()=>{t.invalidateQueries({queryKey:[`ticket-scopes`]}),n(`Scope unregistered`)},onError:e=>n(K(e),`error`)}),[s,c]=(0,g.useState)(null);if(i)return(0,N.jsx)(`div`,{className:`animate-pulse h-32 rounded-lg bg-zinc-900 border border-zinc-800`});if(a)return(0,N.jsx)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-6`,children:(0,N.jsx)(`p`,{className:`text-red-400 text-sm`,children:`Failed to load scopes`})});let l=r?.scopes||[];return l.length===0?(0,N.jsxs)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-8 text-center`,children:[(0,N.jsx)(ya,{className:`mx-auto h-8 w-8 text-zinc-600 mb-3`}),(0,N.jsx)(`p`,{className:`text-zinc-400 text-sm`,children:`No ticket scopes registered`}),(0,N.jsx)(`p`,{className:`text-zinc-600 text-xs mt-1`,children:`Install a ticket scope package to get started`})]}):(0,N.jsx)(`div`,{className:`space-y-3`,children:l.map(e=>(0,N.jsxs)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-5`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(ya,{size:16,className:`text-cyan-400`}),(0,N.jsx)(`span`,{className:`text-white font-semibold`,children:e.name}),(0,N.jsxs)(`span`,{className:`text-zinc-500 text-xs`,children:[`v`,e.version]})]}),s===e.name?(0,N.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs`,children:[(0,N.jsx)(`span`,{className:`text-zinc-400`,children:`Remove?`}),(0,N.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,N.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,N.jsx)(`button`,{type:`button`,onClick:()=>c(e.name),className:`text-zinc-500 hover:text-red-400`,title:`Unregister scope`,children:(0,N.jsx)(ba,{size:14})})]}),(0,N.jsx)(`p`,{className:`text-zinc-400 text-sm mb-2`,children:e.description}),(0,N.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.scopes?.map(e=>(0,N.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,N.jsx)(`span`,{className:`text-zinc-500 ml-1`,children:`(instance-scoped)`})]},e.name))}),(0,N.jsxs)(`div`,{className:`mt-2 flex gap-3 text-xs text-zinc-500`,children:[(0,N.jsxs)(`span`,{children:[`Transport: `,e.transport?.strategies?.join(`, `)]}),(0,N.jsxs)(`span`,{children:[`Protocol: `,e.transport?.protocol]}),(0,N.jsxs)(`span`,{children:[`Installed: `,Ls(e.installedAt)]})]})]},e.name))})}function Bs(){let e=R(),t=P(),n=G(),[r,i]=(0,g.useState)(null),{data:a,isLoading:o,isError:s}=F({queryKey:[`ticket-instances`],queryFn:()=>e.getTicketInstances(),refetchInterval:1e4}),c=I({mutationFn:t=>e.deleteTicketInstance(t),onSuccess:()=>{t.invalidateQueries({queryKey:[`ticket-instances`]}),n(`Instance deregistered`),i(null)},onError:e=>n(K(e),`error`)});if(o)return(0,N.jsx)(`div`,{className:`animate-pulse h-32 rounded-lg bg-zinc-900 border border-zinc-800`});if(s)return(0,N.jsx)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-6`,children:(0,N.jsx)(`p`,{className:`text-red-400 text-sm`,children:`Failed to load instances`})});let l=a?.instances||[];return l.length===0?(0,N.jsxs)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-8 text-center`,children:[(0,N.jsx)(ua,{className:`mx-auto h-8 w-8 text-zinc-600 mb-3`}),(0,N.jsx)(`p`,{className:`text-zinc-400 text-sm`,children:`No instances registered`})]}):(0,N.jsx)(`div`,{className:`overflow-x-auto`,children:(0,N.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,N.jsx)(`thead`,{children:(0,N.jsxs)(`tr`,{className:`border-b border-zinc-800 text-left text-zinc-500`,children:[(0,N.jsx)(`th`,{className:`pb-2 pr-4 font-medium`,children:`Instance ID`}),(0,N.jsx)(`th`,{className:`pb-2 pr-4 font-medium`,children:`Scope`}),(0,N.jsx)(`th`,{className:`pb-2 pr-4 font-medium`,children:`Agent`}),(0,N.jsx)(`th`,{className:`pb-2 pr-4 font-medium`,children:`Status`}),(0,N.jsx)(`th`,{className:`pb-2 pr-4 font-medium`,children:`Last Heartbeat`}),(0,N.jsx)(`th`,{className:`pb-2 font-medium`,children:`Actions`})]})}),(0,N.jsx)(`tbody`,{children:l.map(e=>(0,N.jsxs)(`tr`,{className:`border-b border-zinc-800/50`,children:[(0,N.jsxs)(`td`,{className:`py-3 pr-4 font-mono text-cyan-400 text-xs`,children:[e.instanceId.slice(0,12),`...`]}),(0,N.jsx)(`td`,{className:`py-3 pr-4 font-mono text-zinc-300 text-xs`,children:e.scope}),(0,N.jsx)(`td`,{className:`py-3 pr-4 text-zinc-300`,children:e.agentLabel}),(0,N.jsx)(`td`,{className:`py-3 pr-4`,children:(0,N.jsx)(Fs,{status:e.status})}),(0,N.jsx)(`td`,{className:`py-3 pr-4 text-zinc-500 text-xs`,children:Ls(e.lastHeartbeat)}),(0,N.jsx)(`td`,{className:`py-3`,children:r===e.instanceId?(0,N.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs`,children:[(0,N.jsx)(`span`,{className:`text-zinc-400`,children:`Remove?`}),(0,N.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,N.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,N.jsx)(`button`,{type:`button`,onClick:()=>i(e.instanceId),className:`text-zinc-500 hover:text-red-400`,title:`Deregister instance`,children:(0,N.jsx)(ba,{size:14})})})]},e.instanceId))})]})})}function Vs(){let e=R(),t=P(),n=G(),[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}=F({queryKey:[`ticket-assignments`],queryFn:()=>e.getTicketAssignments(),refetchInterval:1e4}),{data:m}=F({queryKey:[`ticket-scopes`],queryFn:()=>e.getTicketScopes(),refetchInterval:1e4}),{data:h}=F({queryKey:[`agents-list`],queryFn:()=>e.getAgentCerts(),staleTime:3e4}),_=I({mutationFn:t=>e.createTicketAssignment(t),onSuccess:()=>{t.invalidateQueries({queryKey:[`ticket-assignments`]}),n(`Assignment created`),i(!1),o(``),c(``)},onError:e=>n(K(e),`error`)}),v=I({mutationFn:({agentLabel:t,instanceScope:n})=>e.deleteTicketAssignment(t,n),onSuccess:()=>{t.invalidateQueries({queryKey:[`ticket-assignments`]}),n(`Assignment removed`),u(null)},onError:e=>n(K(e),`error`)});if(f)return(0,N.jsx)(`div`,{className:`animate-pulse h-32 rounded-lg bg-zinc-900 border border-zinc-800`});if(p)return(0,N.jsx)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-6`,children:(0,N.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,N.jsxs)(`div`,{children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,N.jsx)(`p`,{className:`text-zinc-400 text-sm`,children:`Assign agents to ticket scope instances`}),(0,N.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,N.jsxs)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-4 mb-4`,children:[(0,N.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3 mb-3`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`label`,{className:`block text-xs text-zinc-400 mb-1`,children:`Agent`}),(0,N.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,N.jsx)(`option`,{value:``,children:`Select agent...`}),x.map(e=>(0,N.jsx)(`option`,{value:e.label,children:e.label},e.label))]})]}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`label`,{className:`block text-xs text-zinc-400 mb-1`,children:`Instance Scope`}),(0,N.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,N.jsx)(`option`,{value:``,children:`Select instance...`}),S.map(e=>(0,N.jsx)(`option`,{value:e,children:e},e))]})]})]}),(0,N.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,N.jsxs)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-8 text-center`,children:[(0,N.jsx)(Gi,{className:`mx-auto h-8 w-8 text-zinc-600 mb-3`}),(0,N.jsx)(`p`,{className:`text-zinc-400 text-sm`,children:`No assignments`})]}):(0,N.jsx)(`div`,{className:`overflow-x-auto`,children:(0,N.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,N.jsx)(`thead`,{children:(0,N.jsxs)(`tr`,{className:`border-b border-zinc-800 text-left text-zinc-500`,children:[(0,N.jsx)(`th`,{className:`pb-2 pr-4 font-medium`,children:`Agent`}),(0,N.jsx)(`th`,{className:`pb-2 pr-4 font-medium`,children:`Instance Scope`}),(0,N.jsx)(`th`,{className:`pb-2 pr-4 font-medium`,children:`Assigned`}),(0,N.jsx)(`th`,{className:`pb-2 font-medium`,children:`Actions`})]})}),(0,N.jsx)(`tbody`,{children:y.map(e=>(0,N.jsxs)(`tr`,{className:`border-b border-zinc-800/50`,children:[(0,N.jsx)(`td`,{className:`py-3 pr-4 text-zinc-300`,children:e.agentLabel}),(0,N.jsx)(`td`,{className:`py-3 pr-4 font-mono text-cyan-400 text-xs`,children:e.instanceScope}),(0,N.jsx)(`td`,{className:`py-3 pr-4 text-zinc-500 text-xs`,children:Ls(e.assignedAt)}),(0,N.jsx)(`td`,{className:`py-3`,children:l===`${e.agentLabel}:${e.instanceScope}`?(0,N.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs`,children:[(0,N.jsx)(`span`,{className:`text-zinc-400`,children:`Remove?`}),(0,N.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,N.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,N.jsx)(`button`,{type:`button`,onClick:()=>u(`${e.agentLabel}:${e.instanceScope}`),className:`text-zinc-500 hover:text-red-400`,title:`Remove assignment`,children:(0,N.jsx)(ba,{size:14})})})]},`${e.agentLabel}-${e.instanceScope}`))})]})})]})}function Hs(){let e=R(),t=P(),n=G(),[r,i]=(0,g.useState)(null),{data:a,isLoading:o,isError:s}=F({queryKey:[`tickets`],queryFn:()=>e.getTickets(),refetchInterval:5e3}),c=I({mutationFn:t=>e.revokeTicket(t),onSuccess:()=>{t.invalidateQueries({queryKey:[`tickets`]}),n(`Ticket revoked`),i(null)},onError:e=>n(K(e),`error`)});if(o)return(0,N.jsx)(`div`,{className:`animate-pulse h-32 rounded-lg bg-zinc-900 border border-zinc-800`});if(s)return(0,N.jsx)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-6`,children:(0,N.jsx)(`p`,{className:`text-red-400 text-sm`,children:`Failed to load tickets`})});let l=a?.tickets||[];return l.length===0?(0,N.jsxs)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-8 text-center`,children:[(0,N.jsx)(bi,{className:`mx-auto h-8 w-8 text-zinc-600 mb-3`}),(0,N.jsx)(`p`,{className:`text-zinc-400 text-sm`,children:`No recent tickets`})]}):(0,N.jsx)(`div`,{className:`overflow-x-auto`,children:(0,N.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,N.jsx)(`thead`,{children:(0,N.jsxs)(`tr`,{className:`border-b border-zinc-800 text-left text-zinc-500`,children:[(0,N.jsx)(`th`,{className:`pb-2 pr-4 font-medium`,children:`Ticket ID`}),(0,N.jsx)(`th`,{className:`pb-2 pr-4 font-medium`,children:`Scope`}),(0,N.jsx)(`th`,{className:`pb-2 pr-4 font-medium`,children:`Source`}),(0,N.jsx)(`th`,{className:`pb-2 pr-4 font-medium`,children:`Target`}),(0,N.jsx)(`th`,{className:`pb-2 pr-4 font-medium`,children:`Status`}),(0,N.jsx)(`th`,{className:`pb-2 pr-4 font-medium`,children:`Created`}),(0,N.jsx)(`th`,{className:`pb-2 font-medium`,children:`Actions`})]})}),(0,N.jsx)(`tbody`,{children:l.map(e=>(0,N.jsxs)(`tr`,{className:`border-b border-zinc-800/50`,children:[(0,N.jsxs)(`td`,{className:`py-3 pr-4 font-mono text-cyan-400 text-xs`,children:[e.id.slice(0,12),`...`]}),(0,N.jsx)(`td`,{className:`py-3 pr-4 font-mono text-zinc-300 text-xs`,children:e.scope}),(0,N.jsx)(`td`,{className:`py-3 pr-4 text-zinc-300`,children:e.source}),(0,N.jsx)(`td`,{className:`py-3 pr-4 text-zinc-300`,children:e.target}),(0,N.jsx)(`td`,{className:`py-3 pr-4`,children:(0,N.jsx)(Is,{ticket:e})}),(0,N.jsx)(`td`,{className:`py-3 pr-4 text-zinc-500 text-xs`,children:Ls(e.createdAt)}),(0,N.jsx)(`td`,{className:`py-3`,children:!e.used&&new Date(e.expiresAt)>new Date&&(r===e.id?(0,N.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs`,children:[(0,N.jsx)(`span`,{className:`text-zinc-400`,children:`Revoke?`}),(0,N.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,N.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,N.jsx)(`button`,{type:`button`,onClick:()=>i(e.id),className:`text-zinc-500 hover:text-red-400`,title:`Revoke ticket`,children:(0,N.jsx)(vi,{size:14})}))})]},e.id))})]})})}function Us(){let e=R(),t=P(),n=G(),[r,i]=(0,g.useState)(null),{data:a,isLoading:o,isError:s}=F({queryKey:[`ticket-sessions`],queryFn:()=>e.getTicketSessions(),refetchInterval:5e3}),c=I({mutationFn:t=>e.killTicketSession(t),onSuccess:()=>{t.invalidateQueries({queryKey:[`ticket-sessions`]}),n(`Session terminated`),i(null)},onError:e=>n(K(e),`error`)});if(o)return(0,N.jsx)(`div`,{className:`animate-pulse h-32 rounded-lg bg-zinc-900 border border-zinc-800`});if(s)return(0,N.jsx)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-6`,children:(0,N.jsx)(`p`,{className:`text-red-400 text-sm`,children:`Failed to load sessions`})});let l=a?.sessions||[];return l.length===0?(0,N.jsxs)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-8 text-center`,children:[(0,N.jsx)(ua,{className:`mx-auto h-8 w-8 text-zinc-600 mb-3`}),(0,N.jsx)(`p`,{className:`text-zinc-400 text-sm`,children:`No active sessions`})]}):(0,N.jsx)(`div`,{className:`overflow-x-auto`,children:(0,N.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,N.jsx)(`thead`,{children:(0,N.jsxs)(`tr`,{className:`border-b border-zinc-800 text-left text-zinc-500`,children:[(0,N.jsx)(`th`,{className:`pb-2 pr-4 font-medium`,children:`Session ID`}),(0,N.jsx)(`th`,{className:`pb-2 pr-4 font-medium`,children:`Scope`}),(0,N.jsx)(`th`,{className:`pb-2 pr-4 font-medium`,children:`Source`}),(0,N.jsx)(`th`,{className:`pb-2 pr-4 font-medium`,children:`Target`}),(0,N.jsx)(`th`,{className:`pb-2 pr-4 font-medium`,children:`Status`}),(0,N.jsx)(`th`,{className:`pb-2 pr-4 font-medium`,children:`Last Activity`}),(0,N.jsx)(`th`,{className:`pb-2 font-medium`,children:`Actions`})]})}),(0,N.jsx)(`tbody`,{children:l.map(e=>(0,N.jsxs)(`tr`,{className:`border-b border-zinc-800/50`,children:[(0,N.jsxs)(`td`,{className:`py-3 pr-4 font-mono text-cyan-400 text-xs`,children:[e.sessionId.slice(0,12),`...`]}),(0,N.jsx)(`td`,{className:`py-3 pr-4 font-mono text-zinc-300 text-xs`,children:e.scope}),(0,N.jsx)(`td`,{className:`py-3 pr-4 text-zinc-300`,children:e.source}),(0,N.jsx)(`td`,{className:`py-3 pr-4 text-zinc-300`,children:e.target}),(0,N.jsx)(`td`,{className:`py-3 pr-4`,children:(0,N.jsx)(Fs,{status:e.status})}),(0,N.jsx)(`td`,{className:`py-3 pr-4 text-zinc-500 text-xs`,children:Ls(e.lastActivityAt)}),(0,N.jsx)(`td`,{className:`py-3`,children:e.status!==`dead`&&(r===e.sessionId?(0,N.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs`,children:[(0,N.jsx)(`span`,{className:`text-zinc-400`,children:`Kill?`}),(0,N.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,N.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,N.jsx)(`button`,{type:`button`,onClick:()=>i(e.sessionId),className:`text-zinc-500 hover:text-red-400`,title:`Kill session`,children:(0,N.jsx)(vi,{size:14})}))})]},e.sessionId))})]})})}function Ws(){let[e,t]=(0,g.useState)(`scopes`);return(0,N.jsxs)(`div`,{className:`p-6 max-w-5xl mx-auto`,children:[(0,N.jsxs)(`div`,{className:`mb-6`,children:[(0,N.jsx)(`h1`,{className:`text-xl font-bold text-white`,children:`Tickets & Sessions`}),(0,N.jsx)(`p`,{className:`text-zinc-500 text-sm mt-1`,children:`Manage agent-to-agent authorization scopes, instances, and active sessions`})]}),(0,N.jsx)(`div`,{className:`flex gap-1 mb-6 border-b border-zinc-800`,children:Rs.map(n=>(0,N.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,N.jsx)(zs,{}),e===`instances`&&(0,N.jsx)(Bs,{}),e===`assignments`&&(0,N.jsx)(Vs,{}),e===`tickets`&&(0,N.jsx)(Hs,{}),e===`sessions`&&(0,N.jsx)(Us,{})]})}var Gs={install:`installs`,update:`updates`,uninstall:`removes`};function Ks(e,{agentLabel:t=null,action:n=`install`}={}){let{code:r,reasons:i}=mo(e),a=t?`agent "${t}"`:`the hosting agent`,o=null;return r===`push_install_refused`?o=`Lamaste ${Gs[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:K(e),code:r,reasons:i,hint:o}}function qs(e,t){let{message:n,hint:r}=Ks(e,t);return r?`${n} — ${r}`:n}function Js(e){return e?`${e.slice(0,8)}…${e.slice(-6)}`:``}function Ys(e){return e.length>32?`${e.slice(0,17)}…${e.slice(-8)}`:e}var Xs={done:(0,N.jsx)(_i,{size:12,className:`text-green-400`}),failed:(0,N.jsx)(vi,{size:12,className:`text-red-400`}),skipped:(0,N.jsx)(Xi,{size:12,className:`text-zinc-600`}),running:(0,N.jsx)(V,{size:12,className:`text-cyan-400 animate-spin`})},Zs={running:`text-cyan-400`,succeeded:`text-green-400`,"rolled-back":`text-yellow-400`,failed:`text-red-400`,interrupted:`text-red-400`},Qs={host:`Hosting`,unhost:`Removing the hosting`,update:`Update`,uninstall:`Uninstall`,"purge-data":`Purging retained data`};function $s({plugin:e}){let t=R(),n=P(),r=F({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,N.jsxs)(N.Fragment,{children:[a!=null&&!(c&&r.dataUpdatedAt-c>10*6e4)&&(0,N.jsx)(ec,{op:a}),(0,N.jsx)(tc,{plugin:e,operations:i})]})}function ec({op:e}){return(0,N.jsxs)(`div`,{className:`rounded border border-zinc-800 bg-zinc-950/60 p-3 mb-4 text-xs`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,N.jsx)(`span`,{className:`text-zinc-300 font-medium`,children:Qs[e.kind]??e.kind}),(0,N.jsx)(`span`,{className:Zs[e.status]??`text-zinc-400`,children:e.status===`rolled-back`?`rolled back`:e.status}),(0,N.jsxs)(`span`,{className:`text-zinc-600`,children:[`by `,e.actor]})]}),(0,N.jsxs)(`ul`,{className:`space-y-1`,children:[e.steps.map((e,t)=>(0,N.jsxs)(`li`,{className:`flex items-start gap-1.5`,children:[(0,N.jsx)(`span`,{className:`mt-0.5`,children:Xs[e.status]??(0,N.jsx)(yi,{size:12})}),(0,N.jsxs)(`span`,{className:e.status===`skipped`?`text-zinc-600`:`text-zinc-300`,children:[e.name,(e.error||e.detail)&&(0,N.jsxs)(`span`,{className:`text-zinc-500`,children:[` — `,e.error??e.detail]})]})]},t)),e.status===`running`&&e.steps.every(e=>e.status!==`running`)&&(0,N.jsxs)(`li`,{className:`flex items-center gap-1.5 text-zinc-500`,children:[(0,N.jsx)(V,{size:12,className:`animate-spin`}),` waiting…`]})]}),e.warnings?.length>0&&(0,N.jsx)(`ul`,{className:`mt-2 space-y-1`,children:e.warnings.map((e,t)=>(0,N.jsxs)(`li`,{className:`flex items-start gap-1.5 text-yellow-400`,children:[(0,N.jsx)(xa,{size:12,className:`mt-0.5 shrink-0`}),` `,e]},t))}),e.error&&e.status!==`running`&&(0,N.jsx)(`p`,{className:`mt-2 text-red-400`,children:e.error})]})}function tc({plugin:e,operations:t}){let n=R(),r=P(),i=G(),{reveal:a,followState:o,claimOperation:s,releaseOperation:c}=qa(),l=(0,g.useMemo)(()=>(t??[]).map(e=>({op:e,action:Ba(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}=za(s);r.setQueryData([`plugin-operations`,e],e=>Va(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: ${K(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,N.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,N.jsx)(Bi,{size:12,className:`shrink-0 text-amber-400`}),t===`offer`?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(`span`,{className:`flex-1 text-amber-400`,children:[Qs[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,N.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,N.jsxs)(`span`,{className:`flex items-center gap-1.5 text-zinc-400`,children:[(0,N.jsx)(V,{size:12,className:`animate-spin`}),`Reading the new client secrets…`]})]},e.id))}function nc({relay:e}){return(0,N.jsxs)(`div`,{className:`space-y-1.5 text-zinc-400`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`span`,{className:`text-zinc-500`,children:`module `}),e.entry?(0,N.jsxs)(`span`,{className:`font-mono text-zinc-300`,title:e.entrySha256,children:[e.entry,` `,(0,N.jsxs)(`span`,{className:`text-zinc-600`,children:[`sha256 `,Js(e.entrySha256)]})]}):(0,N.jsx)(`span`,{className:`text-zinc-500`,children:`none — shared hooks only`})]}),e.stages.length>0&&(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`span`,{className:`text-zinc-500`,children:`stages `}),e.stages.map(e=>(0,N.jsxs)(`span`,{className:`mr-2 font-mono text-zinc-300`,children:[e.stage,(0,N.jsxs)(`span`,{className:`text-zinc-600`,children:[` `,e.timeoutMs,` ms`]})]},e.stage))]}),e.request.map(e=>(0,N.jsxs)(`div`,{className:`rounded bg-zinc-900 px-2 py-1.5`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,N.jsx)(`span`,{className:`font-mono text-zinc-300`,children:e.stage}),(0,N.jsx)(`span`,{className:`text-zinc-500`,children:e.use??`plugin module`}),e.failOpen.length>0&&(0,N.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,N.jsx)(pa,{size:11}),` fail-open: `,e.failOpen.join(`, `)]})]}),(0,N.jsx)(`div`,{className:`font-mono text-zinc-400`,children:e.routes.join(`, `)}),(0,N.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,N.jsxs)(`div`,{className:`text-zinc-600`,children:[`not active until the user surface: `,e.inactiveRoutes.join(`, `)]})]},e.index)),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`span`,{className:`text-zinc-500`,children:`effects `}),(0,N.jsx)(`span`,{className:`text-zinc-300`,children:e.effects.length>0?e.effects.join(`, `):`none`}),e.packs.length>0&&(0,N.jsxs)(`span`,{className:`text-zinc-500`,children:[` · rule packs `,e.packs.join(`, `)]})]})]})}function rc({integrity:e}){let[t,n]=(0,g.useState)(!1);return(0,N.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,N.jsx)(`span`,{className:`font-mono text-zinc-300`,title:e,children:Ys(e)}),(0,N.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,N.jsx)(ui,{size:11,className:`text-green-400`}):(0,N.jsx)(xi,{size:11})})]})}function ic({agentHalf:e}){return(0,N.jsxs)(`div`,{className:`space-y-1 text-zinc-400`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`span`,{className:`text-zinc-500`,children:`package `}),(0,N.jsxs)(`span`,{className:`font-mono text-zinc-300`,children:[e.package,`@`,e.version]})]}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`span`,{className:`text-zinc-500`,children:`integrity `}),(0,N.jsx)(rc,{integrity:e.integrity})]}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`span`,{className:`text-zinc-500`,children:`entry `}),(0,N.jsx)(`span`,{className:`font-mono text-zinc-300`,children:e.entry}),(0,N.jsx)(`span`,{className:`text-zinc-500`,children:` · memory `}),(0,N.jsx)(`span`,{className:`font-mono text-zinc-300`,children:e.memoryMax??`not limited`})]}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`span`,{className:`text-zinc-500`,children:`runs as `}),(0,N.jsx)(`span`,{className:`font-mono text-zinc-300`,children:e.serviceUser}),(0,N.jsx)(`span`,{className:`text-zinc-500`,children:` · unit `}),(0,N.jsx)(`span`,{className:`font-mono text-zinc-300`,children:e.unitName})]}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`span`,{className:`text-zinc-500`,children:`data `}),(0,N.jsx)(`span`,{className:`font-mono text-zinc-300`,children:e.dataDir}),(0,N.jsx)(`span`,{className:`text-zinc-600`,children:` — kept when it is removed, unless purged`})]}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`span`,{className:`text-zinc-500`,children:`system packages `}),e.systemPackages.length>0?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`span`,{className:`font-mono text-zinc-300`,children:e.systemPackages.join(`, `)}),(0,N.jsx)(`span`,{className:`text-zinc-600`,children:` — installed with apt-get once approved`})]}):(0,N.jsx)(`span`,{className:`text-zinc-300`,children:`none`})]})]})}function ac(e,t){e.invalidateQueries({queryKey:[`plugin-hooks`,t]}),e.invalidateQueries({queryKey:[`plugins`]}),e.invalidateQueries({queryKey:[`plugin-operations`,t]})}function oc(e,t){return qs(e,{agentLabel:t.agentHosting?.agentLabel,action:`update`})}function sc({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 cc({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 lc({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.`}var uc=`settings.secret-to-plain`,dc=`digest.unapproved`;function fc(e){let t=new Set((e.approvalRequired??[]).map(e=>e.code)),n=e.settings?.secretToPlain??[],r=`${n.join(`, `)} into ${n.length===1?`a plain setting`:`plain settings`}`;return t.has(dc)&&t.has(uc)?`${cc(e).replace(/\?$/,``)}, and turn ${r}?`:t.has(uc)?`Turn ${r} and update?`:cc(e)}function pc({digest:e,approved:t=!1}){return(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`span`,{className:`text-zinc-500`,children:`approval digest `}),(0,N.jsx)(`span`,{className:`font-mono text-zinc-300`,title:e,children:Js(e)}),t&&(0,N.jsx)(`span`,{className:`text-zinc-500`,children:` — unchanged, already approved`})]})}function mc({reasons:e}){return e.length===0?null:(0,N.jsx)(`ul`,{className:`list-disc space-y-0.5 pl-5`,children:e.map(e=>(0,N.jsx)(`li`,{className:e.code===uc?`text-red-400`:`text-yellow-400/90`,children:e.reason},e.code))})}function hc({relay:e,agentHalf:t}){return(0,N.jsxs)(N.Fragment,{children:[e&&(0,N.jsxs)(`div`,{children:[(0,N.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,N.jsx)(nc,{relay:e})]}),t&&(0,N.jsxs)(`div`,{children:[(0,N.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,N.jsx)(ic,{agentHalf:t})]})]})}function J({diff:e}){let t=Gr(e);return t?(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`p`,{className:`mb-1 text-zinc-500`,children:`Settings — what this version changes in them:`}),(0,N.jsx)(`div`,{className:`space-y-0.5 text-zinc-400`,children:t.rows.map(e=>(0,N.jsxs)(`div`,{children:[(0,N.jsxs)(`span`,{className:`text-zinc-500`,children:[e.label,` `]}),(0,N.jsx)(`span`,{className:`font-mono text-zinc-300`,children:e.entries.join(`, `)}),e.note&&(0,N.jsxs)(`span`,{className:`text-yellow-400`,children:[` — `,e.note]})]},e.label))}),t.secretToPlain.length>0&&(0,N.jsxs)(`p`,{className:`mt-1.5 flex items-start gap-1.5 text-red-400`,children:[(0,N.jsx)(xa,{size:12,className:`mt-0.5 shrink-0`}),(0,N.jsxs)(`span`,{children:[`Secrets become plain values:`,` `,(0,N.jsx)(`span`,{className:`font-mono`,children:t.secretToPlain.join(`, `)}),`. Their secrets are dropped, but what is typed into them after the update is stored on the relay and shown in clear — never put a credential there.`]})]})]}):null}function gc({reasons:e}){return!Array.isArray(e)||e.length===0?null:(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`p`,{className:`mb-1 text-zinc-500`,children:`Auto-approve does not cover it:`}),(0,N.jsx)(`ul`,{className:`list-disc space-y-0.5 pl-5 text-yellow-400/90`,children:e.map(e=>(0,N.jsx)(`li`,{children:e},e))})]})}function _c({plugin:e,isActing:t}){let n=R(),r=P(),i=G(),{followOperation:a}=qa(),[o,s]=(0,g.useState)(!1),[c,l]=(0,g.useState)(null),u=F({queryKey:[`plugin-hooks`,e.name],queryFn:()=>n.getPluginHooks(e.name),refetchInterval:3e4}).data?.hooks,d=()=>ac(r,e.name),f=I({mutationFn:({digest:t,version:r})=>n.approvePluginHooks(e.name,t,r),onSuccess:t=>{t.operation&&a(t.operation.id),d(),i(t.operation?`Approved — updating ${e.name}`:`${e.name}: approved`)},onError:t=>{d(),i(oc(t,e),`error`)}}),p=I({mutationFn:t=>n.setPluginHooksAutoApprove(e.name,t),onSuccess:d,onError:e=>i(K(e),`error`)}),m=I({mutationFn:()=>n.discardPluginUpdate(e.name),onSuccess:()=>{d(),i(`Pending update discarded`)},onError:e=>i(K(e),`error`)});if(!u||!u.relay&&!u.agent&&!u.agentHalf&&!u.pendingUpdate)return null;let h=t||f.isPending||p.isPending||m.isPending,{approval:_,pendingUpdate:v}=u,y=_.state===`pending`,{subject:b,plural:x}=sc(u),S=Array.isArray(v?.approvalRequired)?v.approvalRequired:[],C=(v?.autoApproveWithheld??[]).filter(e=>!S.some(t=>t.reason===e)),w=(e,t,n,r)=>c===e?(0,N.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,N.jsx)(`span`,{className:`text-zinc-400`,children:n}),(0,N.jsx)(`button`,{type:`button`,disabled:h,onClick:()=>{l(null),f.mutate(r)},className:`rounded bg-cyan-600 px-2 py-1 text-white hover:bg-cyan-500 disabled:opacity-50`,children:`Approve`}),(0,N.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,N.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,N.jsx)(ma,{size:11}),` `,t]});return(0,N.jsxs)(`div`,{className:`rounded border border-zinc-800 bg-zinc-950/60 p-3 mb-4 text-xs`,children:[(0,N.jsxs)(`button`,{type:`button`,onClick:()=>s(e=>!e),className:`flex w-full flex-wrap items-center gap-2 text-left`,children:[o?(0,N.jsx)(di,{size:12}):(0,N.jsx)(pi,{size:12}),(0,N.jsx)(`span`,{className:`text-zinc-300 font-medium`,children:`Lifecycle hooks`}),_.required&&(y?(0,N.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,N.jsx)(pa,{size:11}),` `,b,` `,x?`wait`:`waits`,` for approval`]}):(0,N.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,N.jsx)(ui,{size:11}),` `,b,` approved`]})),u.relay?.failOpenCount>0&&(0,N.jsxs)(`span`,{className:`text-yellow-400`,children:[u.relay.failOpenCount,` fail-open`]}),v&&(0,N.jsxs)(`span`,{className:`text-yellow-400`,children:[`update `,v.version,` waiting`]})]}),o&&(0,N.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[_.required&&(0,N.jsxs)(`div`,{className:`space-y-2`,children:[(0,N.jsx)(`p`,{className:`text-zinc-500`,children:y?lc(u):`Approved by ${_.approvedBy} ${_.approvedAt?new Date(_.approvedAt).toLocaleString():``} (version ${_.approvedVersion}).`}),(0,N.jsx)(pc,{digest:_.digest}),(0,N.jsx)(hc,{relay:u.relay,agentHalf:u.agentHalf}),(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[y&&w(`installed`,`Approve`,cc(u),{digest:_.digest}),(0,N.jsxs)(`label`,{className:`flex items-center gap-1.5 text-zinc-400`,children:[(0,N.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,N.jsxs)(`div`,{children:[(0,N.jsx)(`p`,{className:`text-zinc-500 mb-1`,children:`Agent hooks — run by the agent half on its agent; no approval needed:`}),(0,N.jsx)(`div`,{className:`font-mono text-zinc-300`,children:u.agent.stages.map(e=>e.stage).join(`, `)})]}),v&&(0,N.jsxs)(`div`,{className:`space-y-2 rounded border border-yellow-500/30 p-2`,children:[(0,N.jsxs)(`p`,{className:`text-yellow-400`,children:[`Version `,v.version,` waits for your approval — the installed version stays live until then:`]}),(0,N.jsx)(mc,{reasons:S}),v.digest&&(0,N.jsx)(pc,{digest:v.digest,approved:v.digest===_.approvedDigest}),(0,N.jsx)(hc,{relay:v.relay,agentHalf:v.agentHalf}),(0,N.jsx)(J,{diff:v.settings}),(0,N.jsx)(gc,{reasons:C}),(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[w(`update`,`Approve and update`,fc(v),{digest:v.digest,version:v.version}),(0,N.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,N.jsx)(ka,{size:11}),` Discard`]})]})]})]})]})}function vc({plugin:e,isActing:t}){let n=R(),r=P(),i=G(),{followOperation:a}=qa(),[o,s]=(0,g.useState)(``),c=I({mutationFn:()=>n.updatePlugin(e.name,o.trim()||void 0),onSuccess:t=>{t.operation&&a(t.operation.id),ac(r,e.name),t.upToDate?i(`${e.name} is already at ${t.version}`):t.pendingUpdate?i(`${e.name} ${t.pendingUpdate.version} waits for your approval — see why under Lifecycle hooks`):i(`Updating ${e.name}`),s(``)},onError:t=>i(oc(t,e),`error`)});return(0,N.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,N.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,N.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, a new agent half and secret settings turned plain wait for approval`,children:[c.isPending?(0,N.jsx)(V,{size:12,className:`animate-spin`}):(0,N.jsx)(wi,{size:12}),`Update`]})]})}var yc=`push-install`;function bc(){requestAnimationFrame(()=>{document.getElementById(yc)?.scrollIntoView({behavior:`smooth`,block:`start`})})}function xc(e,t){return e!=null&&Date.parse(e)>t}var Sc=30;function Cc(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 wc({agent:e,config:t,onDone:n}){let r=R(),i=P(),a=G(),o=t.windowMinutes,[s,c]=(0,g.useState)(String(Math.min(Math.max(Sc,o.min),o.max))),[l,u]=(0,g.useState)(t.policies.some(t=>t.id===e.pushInstallPolicy)?e.pushInstallPolicy:t.defaultPolicy),d=Cc(s,o),f=I({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(K(e),`error`)});return(0,N.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),d||f.mutate()},className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,N.jsxs)(`label`,{className:`flex items-center gap-1.5 text-zinc-400`,children:[`for`,(0,N.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,N.jsxs)(`label`,{className:`flex items-center gap-1.5 text-zinc-400`,children:[`policy`,(0,N.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,N.jsxs)(`option`,{value:e.id,children:[e.name,e.id===t.defaultPolicy?` (default)`:``]},e.id))})]}),(0,N.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,N.jsx)(V,{size:11,className:`animate-spin`}):(0,N.jsx)(H,{size:11}),`Open`]}),(0,N.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,N.jsxs)(`span`,{className:`basis-full text-red-400`,children:[`A window is open `,d,`.`]})]})}function Tc({children:e}){let t=R(),n=P(),r=G(),[i,a]=(0,g.useState)(null),o=F({queryKey:[`push-install-config`],queryFn:()=>t.getPushInstallConfig(),refetchInterval:3e4}),s=F({queryKey:[`agent-certs`],queryFn:()=>t.getAgentCerts(),refetchInterval:3e4}),c=I({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(K(e),`error`)}),l=I({mutationFn:e=>t.disablePushInstall(e),onSuccess:(e,t)=>{n.invalidateQueries({queryKey:[`agent-certs`]}),r(`Push install closed for ${t}`)},onError:e=>r(K(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=>xc(e.pushInstallEnabledUntil,f),m=e=>u?.policies.find(t=>t.id===e)?.name??e;return(0,N.jsx)(`section`,{id:yc,className:`mt-8 scroll-mt-6`,children:(0,N.jsxs)(`div`,{className:`border-t border-zinc-700 pt-6`,children:[(0,N.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center justify-between gap-3`,children:[(0,N.jsxs)(`h2`,{className:`flex items-center gap-2 text-lg font-semibold text-white`,children:[(0,N.jsx)(ha,{size:18,className:`text-cyan-400`}),`Push Install`,u&&(0,N.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,N.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,N.jsx)(na,{size:12}):(0,N.jsx)(ra,{size:12}),u.enabled?`Turn off`:`Turn on`]})]}),(0,N.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,N.jsx)(`p`,{className:`mb-4 text-sm text-red-400`,children:K(o.error)}):u?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(`label`,{className:`mb-4 flex flex-wrap items-center gap-2 text-sm text-zinc-400`,children:[`Default policy for a window`,(0,N.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,N.jsx)(`option`,{value:e.id,children:e.name},e.id))})]}),(0,N.jsx)(`div`,{className:`mb-6 overflow-x-auto rounded-lg border border-zinc-800`,children:(0,N.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,N.jsx)(`thead`,{children:(0,N.jsxs)(`tr`,{className:`border-b border-zinc-700 bg-zinc-900`,children:[(0,N.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400`,children:`Agent`}),(0,N.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400`,children:`Window`}),(0,N.jsx)(`th`,{className:`px-4 py-3 text-right text-xs font-medium uppercase text-zinc-400`,children:`Manage`})]})}),(0,N.jsxs)(`tbody`,{children:[s.isError&&(0,N.jsx)(`tr`,{className:`bg-zinc-800`,children:(0,N.jsx)(`td`,{colSpan:3,className:`px-4 py-3 text-red-400`,children:K(s.error)})}),s.isSuccess&&d.length===0&&(0,N.jsx)(`tr`,{className:`bg-zinc-800`,children:(0,N.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,N.jsxs)(`tr`,{className:`border-b border-zinc-700 bg-zinc-800`,children:[(0,N.jsx)(`td`,{className:`whitespace-nowrap px-4 py-3 align-top font-mono text-zinc-200`,children:e.label}),(0,N.jsxs)(`td`,{className:`px-4 py-3 align-top`,children:[t?(0,N.jsxs)(`span`,{className:`flex items-center gap-1.5 text-green-400`,children:[(0,N.jsx)(bi,{size:12}),`open until `,new Date(e.pushInstallEnabledUntil).toLocaleString(),(0,N.jsxs)(`span`,{className:`text-zinc-500`,children:[`· policy `,m(e.pushInstallPolicy)]})]}):(0,N.jsx)(`span`,{className:`text-zinc-500`,children:`closed`}),i===e.label&&(0,N.jsx)(`div`,{className:`mt-2`,children:(0,N.jsx)(wc,{agent:e,config:u,onDone:()=>a(null)})})]}),(0,N.jsx)(`td`,{className:`px-4 py-3 text-right align-top`,children:(0,N.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[i!==e.label&&(0,N.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,N.jsx)(H,{size:12}),t?`Reopen…`:`Open…`]}),t&&(0,N.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,N.jsx)(U,{size:12}),`Close`]})]})})]},e.label)})]})]})})]}):(0,N.jsx)(`div`,{className:`mb-4 h-24 animate-pulse rounded-lg border border-zinc-800 bg-zinc-900`}),e]})})}function Ec({onClose:e}){return(0,N.jsxs)(`button`,{type:`button`,onClick:()=>{e(),bc()},className:`inline-flex items-center gap-1 text-cyan-400 hover:text-cyan-300 hover:underline`,children:[(0,N.jsx)(ii,{size:11}),`Push install`]})}function Dc({until:e,now:t}){return xc(e,t)?(0,N.jsxs)(`span`,{className:`text-green-400`,children:[`push install open until `,new Date(e).toLocaleTimeString()]}):(0,N.jsx)(`span`,{className:`text-zinc-500`,children:`push install closed`})}var Oc=(0,g.forwardRef)(function({refusal:e,pluginName:t,onClose:n},r){return(0,N.jsxs)(`div`,{ref:r,className:`rounded border border-red-500/30 bg-red-500/5 p-3 text-xs`,children:[(0,N.jsxs)(`p`,{className:`flex items-start gap-1.5 text-red-400`,children:[(0,N.jsx)(xa,{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,N.jsx)(`ul`,{className:`mt-1 list-disc space-y-0.5 pl-6 text-zinc-300`,children:e.reasons.map(e=>(0,N.jsx)(`li`,{children:e},e))}),e.hint&&(0,N.jsx)(`p`,{className:`mt-1.5 text-zinc-400`,children:e.hint}),e.code===`push_install_refused`&&(0,N.jsx)(`p`,{className:`mt-1.5`,children:(0,N.jsx)(Ec,{onClose:n})})]})});function kc({query:e}){let t=e.data?.fields;return(0,N.jsxs)(`div`,{className:`rounded border border-zinc-800 bg-zinc-950/60 p-3`,children:[(0,N.jsxs)(`p`,{className:`mb-1 flex items-center gap-1.5 font-medium text-zinc-300`,children:[(0,N.jsx)(ga,{size:12,className:`text-cyan-400`}),`Settings it asks for`]}),(0,N.jsx)(`p`,{className:`mb-2 text-zinc-500`,children:`Hosting takes no settings: the agent half starts without them, and you fill them in under Settings on the plugin's card once it is hosted. Secrets are kept by the agent half alone; every other value is also kept on the relay and shown in clear.`}),Array.isArray(t)?(0,N.jsx)(`ul`,{className:`space-y-1`,children:t.map(e=>(0,N.jsxs)(`li`,{className:`flex flex-wrap items-baseline gap-x-2`,children:[e.type===`secret`&&(0,N.jsx)(Bi,{size:11,className:`shrink-0 self-center text-cyan-400`}),(0,N.jsx)(`span`,{className:`text-zinc-300`,children:e.label}),(0,N.jsx)(`span`,{className:`font-mono text-zinc-600`,children:e.key}),(0,N.jsx)(`span`,{className:e.type===`secret`?`text-cyan-400`:`text-zinc-500`,children:Wr(e)}),Hr(e)&&(0,N.jsx)(`span`,{className:`w-full text-yellow-400/90`,children:`Stored on the relay and shown in clear — use a secret field for credentials.`})]},e.key))}):e.isError?(0,N.jsx)(`p`,{className:`text-red-400`,children:K(e.error)}):(0,N.jsx)(V,{size:12,className:`animate-spin text-zinc-500`})]})}function Ac({plugin:e,onHost:t,onClose:n,isActing:r}){let i=R(),[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=F({queryKey:[`plugin-hosting-eligibility`,e.name],queryFn:()=>i.getPluginHostingEligibility(e.name),refetchInterval:3e4}),h=F({queryKey:[`agent-certs`],queryFn:()=>i.getAgentCerts(),refetchInterval:3e4}),_=F({queryKey:[`push-install-config`],queryFn:()=>i.getPushInstallConfig(),enabled:f}),v=F({queryKey:[`plugin-hooks`,e.name],queryFn:()=>i.getPluginHooks(e.name),enabled:f}),y=e.settings!=null,b=F({queryKey:[`plugin-settings`,e.name],queryFn:()=>i.getPluginSettings(e.name),enabled:y,refetchOnWindowFocus:!1}),x=m.data?.agents??[],S=new Map((h.data?.agents??[]).map(e=>[e.label,e])),C=x.some(e=>e.label===a&&e.eligible)?a:``,w=v.data?.hooks?.agentHalf??null,T=f&&_.data?.enabled===!1,E=h.dataUpdatedAt,D=C?S.get(C):void 0,ee=f&&!T&&D!==void 0&&!xc(D.pushInstallEnabledUntil,E);return(0,N.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4`,children:(0,N.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,N.jsxs)(`div`,{className:`flex items-center justify-between border-b border-zinc-800 px-6 py-4`,children:[(0,N.jsxs)(`h3`,{className:`flex items-center gap-2 text-lg font-semibold text-white`,children:[(0,N.jsx)(ua,{size:18,className:`text-cyan-400`}),`Host `,e.displayName||e.name]}),(0,N.jsx)(`button`,{type:`button`,onClick:n,disabled:l,"aria-label":`Close`,className:`text-zinc-400 hover:text-white disabled:opacity-50`,children:(0,N.jsx)(ka,{size:20})})]}),(0,N.jsxs)(`div`,{className:`space-y-4 overflow-y-auto px-6 py-4 text-xs`,children:[(0,N.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,N.jsxs)(`div`,{className:`rounded border border-zinc-800 bg-zinc-950/60 p-3`,children:[(0,N.jsx)(`p`,{className:`mb-2 font-medium text-zinc-300`,children:`What Lamaste installs on the agent`}),w?(0,N.jsx)(ic,{agentHalf:w}):v.isError?(0,N.jsx)(`p`,{className:`text-red-400`,children:K(v.error)}):(0,N.jsx)(V,{size:12,className:`animate-spin text-zinc-500`})]}),y&&(0,N.jsx)(kc,{query:b}),p&&(0,N.jsxs)(`p`,{className:`flex items-start gap-1.5 text-yellow-400`,children:[(0,N.jsx)(pa,{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.`]}),T&&(0,N.jsxs)(`p`,{className:`flex flex-wrap items-start gap-1.5 text-yellow-400`,children:[(0,N.jsx)(xa,{size:12,className:`mt-0.5 shrink-0`}),(0,N.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,N.jsx)(Ec,{onClose:n}),`.`]})]}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`p`,{className:`mb-2 font-medium text-zinc-300`,children:`Agent`}),m.isLoading?(0,N.jsx)(`div`,{className:`space-y-2`,children:Array.from({length:2}).map((e,t)=>(0,N.jsx)(`div`,{className:`h-12 animate-pulse rounded bg-zinc-800`},t))}):m.isError?(0,N.jsx)(`p`,{className:`text-red-400`,children:K(m.error)}):x.length===0?(0,N.jsx)(`p`,{className:`text-zinc-500`,children:`No enrolled machine agent — enroll one under Certificates first.`}):(0,N.jsx)(`ul`,{className:`space-y-1.5`,role:`radiogroup`,"aria-label":`Hosting agent`,children:x.map(t=>{let n=S.get(t.label);return(0,N.jsx)(`li`,{children:(0,N.jsxs)(`label`,{className:`flex items-start gap-2 rounded border px-3 py-2 ${t.eligible?C===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,N.jsx)(`input`,{type:`radio`,name:`host-${e.name}`,value:t.label,checked:C===t.label,disabled:!t.eligible,onChange:()=>o(t.label),className:`mt-0.5 accent-cyan-500`}),(0,N.jsxs)(`span`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,N.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,N.jsx)(`span`,{className:`font-mono ${t.eligible?`text-zinc-200`:`text-zinc-500`}`,children:t.label}),f&&t.eligible&&n&&(0,N.jsx)(Dc,{until:n.pushInstallEnabledUntil,now:E})]}),(0,N.jsx)(`span`,{className:`block`,children:(0,N.jsx)(ms,{facts:n?.hostFacts??null,at:n?.hostFactsAt??null})}),!t.eligible&&(0,N.jsx)(`ul`,{className:`list-disc space-y-0.5 pl-4 text-yellow-400/90`,children:t.reasons.map(e=>(0,N.jsx)(`li`,{children:e},e))})]})]})},t.label)})})]}),ee&&(0,N.jsxs)(`p`,{className:`flex items-start gap-1.5 text-yellow-400`,children:[(0,N.jsx)(xa,{size:12,className:`mt-0.5 shrink-0`}),(0,N.jsxs)(`span`,{children:[`The push-install window of `,(0,N.jsx)(`span`,{className:`font-mono`,children:C}),` is closed: Lamaste installs the agent half by push install, so open it first — under`,` `,(0,N.jsx)(Ec,{onClose:n}),`.`]})]}),s&&(0,N.jsx)(Oc,{ref:d,refusal:s,pluginName:e.displayName||e.name,onClose:n})]}),(0,N.jsxs)(`div`,{className:`flex justify-end gap-3 border-t border-zinc-800 px-6 py-4`,children:[(0,N.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,N.jsxs)(`button`,{type:`button`,disabled:l||r||!C||p,onClick:()=>{c(null),u(!0),t(e.name,C,{onSuccess:n,onError:e=>{u(!1);let t=Ks(e,{agentLabel:C,action:`install`});c({...t,agentLabel:C}),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,N.jsx)(V,{size:14,className:`animate-spin`}):(0,N.jsx)(ua,{size:14}),C?`Host on ${C}`:`Host on agent`]})]})]})})}var jc=`w-full rounded bg-zinc-800 border px-2 py-1 text-xs text-zinc-300 placeholder-zinc-600 focus:outline-none focus:border-cyan-400 disabled:opacity-60`,Mc=1e4,Nc=Ur(typeof CSS>`u`?void 0:CSS);function Pc(e){e.preventDefault()}var Fc=`flex items-center gap-1.5 rounded bg-zinc-700 px-2 py-0.5 text-zinc-300 hover:bg-zinc-600 disabled:opacity-50`;function Ic(e){return`${jc} ${e?`border-red-500/70`:`border-zinc-700`}`}function Lc(e){let t=e.missing?.length??0;return t===0?`needs configuration`:`${t} required setting${t>1?`s`:``} not set`}function Rc({summary:e}){if(!e||e.configured!==!1)return null;let t=e.missing??[];return(0,N.jsxs)(`span`,{className:`flex items-center gap-1 text-xs px-2 py-0.5 rounded-full bg-yellow-500/15 text-yellow-400`,title:t.length>0?`Required settings not set: ${t.join(`, `)}`:`Required settings are not set`,children:[(0,N.jsx)(ga,{size:11}),`Needs configuration`]})}function zc(e){if(e.default!==void 0){let t=(e.options??[]).find(t=>t.value===e.default);return`Default (${t?t.label:e.default})`}return wr(e)?`Choose…`:`Not set`}function Bc({id:e,field:t,missing:n,error:r,children:i}){return(0,N.jsxs)(`div`,{children:[(0,N.jsxs)(`div`,{className:`mb-1 flex flex-wrap items-baseline gap-x-2`,children:[(0,N.jsx)(`label`,{htmlFor:e,className:`text-zinc-300`,children:t.label}),(0,N.jsx)(`span`,{className:`font-mono text-zinc-600`,children:t.key}),t.required&&(0,N.jsx)(`span`,{className:n?`text-yellow-400`:`text-zinc-500`,children:n?`required — not set`:`required`})]}),t.description&&(0,N.jsx)(`p`,{className:`mb-1 text-zinc-500`,children:t.description}),i,r&&(0,N.jsx)(`p`,{className:`mt-1 text-red-400`,children:r})]})}function Vc({pluginName:e,view:t,readOnly:n,saving:r,errors:i,onEdit:a,onInvalid:o,onSubmit:s,onDiscard:c}){let[l,u]=(0,g.useState)(()=>Dr(t)),[d,f]=(0,g.useState)({}),[p,m]=(0,g.useState)(()=>kr(t)),[h,_]=(0,g.useState)({}),v=(0,g.useRef)(new Map),y=Dr(t),b=Lr(t,{inputs:l,badInput:d,secretActions:p,secretFilled:h}),x=new Set(t.missing??[]),S=(e,t,n=!1)=>{u(n=>({...n,[e]:t})),f(t=>({...t,[e]:n})),a(e)},C=(e,t)=>{let n=v.current.get(e);n&&(n.value=``),_(t=>({...t,[e]:!1})),m(n=>({...n,[e]:t})),a(e)},w=e=>t=>{t?v.current.set(e,t):v.current.delete(e)},T=e=>{if(e.preventDefault(),n||r)return;let i={};for(let e of t.fields)e.type===`secret`&&(i[e.key]={action:p[e.key],value:v.current.get(e.key)?.value??``});let a=Rr(t,{inputs:l,badInput:d,secrets:i});if(!a.ok){o(a.errors);return}if(a.changed.length!==0){for(let e of v.current.values())e.value=``;_({}),s(a.body)}},E=(e,r)=>{let o=r.key,s=i[o]??null;switch(r.type){case`string`:return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`input`,{id:e,type:`text`,value:l[o],onChange:e=>S(o,e.target.value),placeholder:r.default===void 0?void 0:`Default: ${r.default}`,spellCheck:!1,"aria-invalid":s?!0:void 0,"aria-describedby":Hr(r)?`${e}-hint`:void 0,className:Ic(s)}),Hr(r)&&(0,N.jsxs)(`p`,{id:`${e}-hint`,className:`mt-1 flex items-start gap-1 text-yellow-400/90`,children:[(0,N.jsx)(zi,{size:11,className:`mt-0.5 shrink-0`}),`Stored on the relay and shown in clear — use a secret field for credentials.`]})]});case`integer`:case`number`:return(0,N.jsx)(`input`,{id:e,type:`number`,inputMode:r.type===`integer`?`numeric`:`decimal`,step:r.type===`integer`?1:`any`,min:r.min,max:r.max,value:l[o],onChange:e=>S(o,e.target.value,e.target.validity.badInput),placeholder:r.default===void 0?void 0:`Default: ${r.default}`,"aria-invalid":s?!0:void 0,className:`${Ic(s)} sm:w-48`});case`boolean`:return(0,N.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-zinc-400`,children:[(0,N.jsx)(`input`,{id:e,type:`checkbox`,checked:l[o]===!0,onChange:e=>S(o,e.target.checked),className:`accent-cyan-500`}),l[o]===null?`not set`:l[o]?`on`:`off`]});case`enum`:return(0,N.jsxs)(`select`,{id:e,value:l[o],onChange:e=>S(o,e.target.value),"aria-invalid":s?!0:void 0,className:`${Ic(s)} sm:w-auto`,children:[(Tr(r)||y[o]===``||l[o]===``)&&(0,N.jsx)(`option`,{value:``,children:zc(r)}),(r.options??[]).map(e=>(0,N.jsx)(`option`,{value:e.value,children:e.label},e.value))]});case`secret`:{let i=Or(t,o),c=p[o];return(0,N.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,N.jsxs)(`span`,{className:`inline-flex items-center gap-1 ${i.set?`text-zinc-300`:`text-zinc-500`}`,children:[(0,N.jsx)(Bi,{size:11}),Ar(i)]}),c===`clear`&&(0,N.jsx)(`span`,{className:`text-yellow-400`,children:`cleared when you save`}),!n&&i.set&&c===`keep`&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(`button`,{type:`button`,onClick:()=>C(o,`replace`),className:Fc,children:[(0,N.jsx)(ia,{size:11}),`Replace`]}),Tr(r)&&(0,N.jsxs)(`button`,{type:`button`,onClick:()=>C(o,`clear`),className:Fc,children:[(0,N.jsx)(Ti,{size:11}),`Clear`]})]}),!n&&i.set&&c!==`keep`&&(0,N.jsxs)(`button`,{type:`button`,onClick:()=>C(o,`keep`),className:Fc,children:[(0,N.jsx)(Ca,{size:11}),`Keep the current one`]})]}),!n&&c===`replace`&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`input`,{id:e,ref:w(o),type:`text`,autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`off`,spellCheck:!1,placeholder:i.set?`New value`:`Value`,onChange:e=>{let t=e.target.value!==``;_(e=>e[o]===t?e:{...e,[o]:t}),a(o)},onCopy:Pc,onCut:Pc,"aria-invalid":s?!0:void 0,"data-1p-ignore":!0,"data-lpignore":`true`,"data-bwignore":`true`,"data-form-type":`other`,className:`${Ic(s)} [-webkit-text-security:disc]`}),!Nc&&(0,N.jsx)(`p`,{className:`text-yellow-400/90`,children:`This browser cannot mask the value: it shows as you type it. Use a current browser to keep it out of sight.`})]})]})}default:return(0,N.jsxs)(`span`,{className:`text-zinc-500`,children:[`Cannot be set here (`,r.type,`)`]})}};return(0,N.jsx)(`form`,{onSubmit:T,autoComplete:`off`,noValidate:!0,children:(0,N.jsxs)(`fieldset`,{disabled:n||r,className:`space-y-3`,children:[t.fields.map(t=>{let n=`plugin-settings-${e}-${t.key}`;return(0,N.jsx)(Bc,{id:n,field:t,missing:x.has(t.key),error:i[t.key]??null,children:E(n,t)},t.key)}),!n&&(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,N.jsxs)(`button`,{type:`submit`,disabled:b.length===0||r,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:[r?(0,N.jsx)(V,{size:11,className:`animate-spin`}):(0,N.jsx)(sa,{size:11}),`Save`]}),b.length>0&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(`button`,{type:`button`,onClick:c,className:Fc,children:[(0,N.jsx)(Ca,{size:11}),`Discard changes`]}),(0,N.jsxs)(`span`,{className:`text-zinc-500`,children:[b.length,` change`,b.length>1?`s`:``]})]})]})]})})}function Hc({pluginName:e}){let t=R(),n=P(),r=G(),i=[`plugin-settings`,e],a=F({queryKey:i,queryFn:()=>t.getPluginSettings(e),refetchOnWindowFocus:!1,refetchInterval:e=>e.state.data&&Cr(e.state.data,e.state.dataUpdatedAt)!==null?Mc:!1}),[o,s]=(0,g.useState)({}),[c,l]=(0,g.useState)(null),[u,d]=(0,g.useState)(null),[f,p]=(0,g.useState)(0),m=(0,g.useRef)(null);(0,g.useEffect)(()=>()=>{m.current=null},[]);let h=()=>n.invalidateQueries({queryKey:i}),_=()=>p(e=>e+1),v=I({mutationFn:()=>{let n=m.current;return m.current=null,n===null?Promise.reject(Error(`Nothing to save`)):t.updatePluginSettings(e,n)},onSuccess:e=>{e&&Array.isArray(e.fields)?n.setQueryData(i,e):h(),_(),n.invalidateQueries({queryKey:[`plugins`]}),r(`Settings saved`)},onError:e=>{let{code:t}=mo(e);if(t===`revision_mismatch`||t===`schema_mismatch`){d(t===`revision_mismatch`?`The settings were changed elsewhere since this form was loaded. It now shows the current values — make your changes again.`:`The agent half runs another version of these settings (an update may be under way). The form was reloaded — try again once the update has finished.`),_(),h();return}if(t===`hosting_offline`||t===`timeout`||t===`unauthenticated`){l(K(e)),h();return}let n=zr(e);if(n){let e=new Set((a.data?.fields??[]).map(e=>e.key)),t=Object.fromEntries(Object.entries(n).filter(([t])=>e.has(t))),r=Object.entries(n).filter(([t])=>!e.has(t));s(t),l(r.length>0?r.map(([e,t])=>e===`_`?t:`${e}: ${t}`).join(`; `):`Not saved — see the fields above.`);return}l(K(e))}}),y=e=>{s(t=>{if(!(e in t))return t;let n={...t};return delete n[e],n})};if(a.isPending)return(0,N.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5 text-zinc-500`,children:[(0,N.jsx)(V,{size:12,className:`animate-spin`}),` Loading settings…`]});if(a.isError)return(0,N.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2 text-red-400`,children:[(0,N.jsx)(hi,{size:12}),K(a.error),(0,N.jsxs)(`button`,{type:`button`,onClick:()=>a.refetch(),className:Fc,children:[(0,N.jsx)(ia,{size:11}),`Retry`]})]});let b=a.data,x=a.dataUpdatedAt,S=Cr(b,x),C=br(b.hosting)!==null;return(0,N.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,N.jsx)(`p`,{className:`text-zinc-600`,children:Br(b,x)}),S&&(0,N.jsxs)(`div`,{className:`flex items-start gap-1.5 rounded border p-2 ${C?`border-red-500/30 text-red-400`:`border-zinc-700 text-zinc-400`}`,children:[C?(0,N.jsx)(Da,{size:12,className:`mt-0.5 shrink-0`}):(0,N.jsx)(zi,{size:12,className:`mt-0.5 shrink-0`}),(0,N.jsxs)(`span`,{children:[S,`.`,` `,(0,N.jsx)(`span`,{className:`text-zinc-500`,children:`Read-only for now: changes go to its agent half, which has to be reachable.`})]})]}),u&&(0,N.jsxs)(`p`,{className:`flex items-start gap-1.5 text-yellow-400`,children:[(0,N.jsx)(aa,{size:12,className:`mt-0.5 shrink-0`}),u]}),(0,N.jsx)(Vc,{pluginName:e,view:b,readOnly:S!==null,saving:v.isPending,errors:o,onEdit:y,onInvalid:e=>{s(e),l(`Not saved — see the fields above.`)},onSubmit:e=>{s({}),l(null),d(null),m.current=e,v.mutate()},onDiscard:()=>{s({}),l(null),_()}},`${b.revision}:${Ir(b.fields)}:${f}`),c&&(0,N.jsxs)(`p`,{className:`flex items-start gap-1.5 text-red-400`,children:[(0,N.jsx)(hi,{size:12,className:`mt-0.5 shrink-0`}),c]})]})}function Uc({plugin:e}){let[t,n]=(0,g.useState)(!1),r=e.settings;return(0,N.jsxs)(`div`,{className:`rounded border border-zinc-800 bg-zinc-950/60 p-3 mb-4 text-xs`,children:[(0,N.jsxs)(`button`,{type:`button`,onClick:()=>n(e=>!e),"aria-expanded":t,className:`flex w-full flex-wrap items-center gap-2 text-left`,children:[t?(0,N.jsx)(di,{size:12}):(0,N.jsx)(pi,{size:12}),(0,N.jsx)(`span`,{className:`text-zinc-300 font-medium`,children:`Settings`}),r.configured?(0,N.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-green-400`,children:[(0,N.jsx)(ui,{size:11}),` configured`]}):(0,N.jsx)(`span`,{className:`text-yellow-400`,children:Lc(r)})]}),t&&(0,N.jsx)(Hc,{pluginName:e.name})]})}function Wc({record:e,isActing:t}){let n=R(),r=P(),i=G(),[a,o]=(0,g.useState)(null),s=()=>{r.invalidateQueries({queryKey:[`plugins`]}),r.invalidateQueries({queryKey:[`plugin-operations`,e.plugin]})},c=I({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(qs(t,{agentLabel:e.agentLabel,action:`uninstall`}),`error`)}),l=I({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(K(e),`error`)}),u=t||c.isPending||l.isPending,d=(e,t,n)=>(0,N.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,N.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,N.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,N.jsxs)(`li`,{className:`rounded bg-zinc-900 px-2 py-1.5`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,N.jsx)(`span`,{className:`font-mono text-zinc-200`,children:e.agentLabel}),(0,N.jsxs)(`span`,{className:`text-zinc-500`,children:[`route `,(0,N.jsx)(`span`,{className:`font-mono text-zinc-300`,children:e.route})]}),(0,N.jsx)(`span`,{className:`font-mono text-zinc-400`,children:e.package}),(0,N.jsxs)(`span`,{className:`text-zinc-600`,children:[`since `,new Date(e.since).toLocaleString()]})]}),(0,N.jsxs)(`div`,{className:`font-mono text-zinc-500`,children:[e.dataDir,` `,(0,N.jsx)(`span`,{className:`text-zinc-600`,children:`· account`}),` `,e.serviceUser]}),a===`purge`&&(0,N.jsxs)(`div`,{className:`mt-1.5 space-y-1.5`,children:[(0,N.jsxs)(`p`,{className:`flex items-start gap-1 text-red-400`,children:[(0,N.jsx)(xa,{size:11,className:`mt-0.5 shrink-0`}),(0,N.jsxs)(`span`,{children:[`Delete `,(0,N.jsx)(`span`,{className:`font-mono`,children:e.dataDir}),` and the account`,` `,(0,N.jsx)(`span`,{className:`font-mono`,children:e.serviceUser}),` on agent`,` `,(0,N.jsx)(`span`,{className:`font-mono`,children:e.agentLabel}),` (route`,` `,(0,N.jsx)(`span`,{className:`font-mono`,children:e.route}),`)? The agent's app host helper deletes them once push install lets Lamaste remove`,` `,(0,N.jsx)(`span`,{className:`font-mono`,children:e.package}),` there — this cannot be undone.`]})]}),d(`Purge`,()=>c.mutate(),!0)]}),a===`forget`&&(0,N.jsxs)(`div`,{className:`mt-1.5 space-y-1.5`,children:[(0,N.jsxs)(`p`,{className:`text-zinc-400`,children:[`Drop only the relay's record? Nothing on`,` `,(0,N.jsx)(`span`,{className:`font-mono`,children:e.agentLabel}),` changes:`,` `,(0,N.jsx)(`span`,{className:`font-mono`,children:e.dataDir}),` and the account`,` `,(0,N.jsx)(`span`,{className:`font-mono`,children:e.serviceUser}),` stay on the machine — remove them there with`,` `,(0,N.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,N.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap items-center gap-2`,children:[(0,N.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,N.jsx)(ba,{size:11}),`Purge…`]}),(0,N.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,N.jsx)(Ti,{size:11}),`Forget…`]})]})]})}function Y({records:e,isActing:t}){return(0,N.jsx)(`ul`,{className:`space-y-1.5`,children:e.map(e=>(0,N.jsx)(Wc,{record:e,isActing:t},`${e.agentLabel}/${e.route}`))})}function Gc({plugin:e,isActing:t}){let n=e.retainedData??[];return n.length===0?null:(0,N.jsxs)(`div`,{className:`rounded border border-zinc-800 bg-zinc-950/60 p-3 mb-4 text-xs`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,N.jsx)(ri,{size:12,className:`text-cyan-400`}),(0,N.jsx)(`span`,{className:`text-zinc-300 font-medium`,children:`Retained data`})]}),(0,N.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,N.jsx)(Y,{records:n,isActing:t})]})}function Kc({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,N.jsxs)(`section`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-5 mt-8 text-xs`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,N.jsx)(ri,{size:14,className:`text-cyan-400`}),(0,N.jsx)(`h2`,{className:`text-sm font-semibold text-zinc-300`,children:`Retained data of uninstalled plugins`})]}),(0,N.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,N.jsx)(`div`,{className:`space-y-4`,children:[...r.entries()].map(([e,t])=>(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`p`,{className:`mb-2 font-mono text-sm text-zinc-200`,children:e}),(0,N.jsx)($s,{plugin:e}),(0,N.jsx)(Y,{records:t,isActing:n})]},e))})]})}function qc({status:e}){return(0,N.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 Jc(){return(0,N.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,N.jsx)(Zi,{size:11}),`Agent-hosted`]})}function Yc({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,N.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs px-2 py-0.5 rounded-full ${n}`,title:i,children:[(0,N.jsx)(ni,{size:11}),r]})}function Xc({hosting:e,dataDir:t,checked:n,onChange:r}){return(0,N.jsxs)(`span`,{className:`flex basis-full flex-col gap-1`,children:[(0,N.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,N.jsx)(`input`,{type:`checkbox`,checked:n,onChange:e=>r(e.target.checked)}),`also delete the agent half's data (purge)`]}),n&&(0,N.jsxs)(`span`,{className:`flex items-start gap-1 text-red-400`,children:[(0,N.jsx)(xa,{size:11,className:`mt-0.5 shrink-0`}),(0,N.jsxs)(`span`,{children:[`Deletes `,t?(0,N.jsx)(`span`,{className:`font-mono`,children:t}):`its data directory`,` `,`and the agent half's service account on`,` `,(0,N.jsx)(`span`,{className:`font-mono`,children:e.agentLabel}),` — this cannot be undone.`]})]})]})}function Zc({plugin:e,dataDir:t,now:n,onHost:r,onUnhost:i,onRotate:a,isActing:o}){let[s,c]=(0,g.useState)(!1),[l,u]=(0,g.useState)(!1),[d,f]=(0,g.useState)(!1),[p,m]=(0,g.useState)(!1),h=e.agentHosting,_=e.hooks?.agentHalf===!0,v=e.hooks?.approval===`pending`,y=h&&(!h.phase||h.phase===`active`)?yr(h):null;return h?(0,N.jsxs)(`div`,{className:`rounded border border-zinc-800 bg-zinc-950/60 p-3 mb-4 text-xs`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 mb-2`,children:[(0,N.jsx)(ua,{size:12,className:`text-cyan-400`}),(0,N.jsxs)(`span`,{className:`text-zinc-300`,children:[`Hosted on `,(0,N.jsx)(`span`,{className:`font-mono text-zinc-200`,children:h.agentLabel})]}),(0,N.jsxs)(`span`,{className:`text-zinc-500`,children:[`port `,(0,N.jsx)(`span`,{className:`font-mono`,children:h.port})]}),h.phase&&h.phase!==`active`?(0,N.jsxs)(`span`,{className:`text-cyan-400`,children:[h.phase,`…`]}):(0,N.jsx)(Yc,{health:h.health}),!h.secretAcknowledged&&(0,N.jsx)(`span`,{className:`text-zinc-500`,title:`The agent fetches it on its next sync`,children:`secret not yet fetched`}),h.rotationPending&&(0,N.jsx)(`span`,{className:`text-yellow-400`,children:`rotation pending`})]}),y&&(0,N.jsx)(`p`,{className:`mb-2 text-red-400`,children:xr(y,n)}),h.agentHalf&&(0,N.jsxs)(`p`,{className:`mb-2 text-zinc-500`,children:[`Agent half `,(0,N.jsx)(`span`,{className:`font-mono text-zinc-300`,children:h.agentHalf.version}),` `,`installed by Lamaste `,new Date(h.agentHalf.installedAt).toLocaleString()]}),(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,N.jsxs)(`button`,{type:`button`,disabled:o,onClick:()=>a(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,N.jsx)(ia,{size:11}),`Rotate secret`]}),l?(0,N.jsxs)(`span`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,N.jsx)(`span`,{className:`text-zinc-400`,children:_?`Run its uninstall hooks, then remove the agent half, tunnel, secret and capability?`:`Run its uninstall hooks, then remove tunnel, secret and capability?`}),(0,N.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,N.jsx)(`input`,{type:`checkbox`,checked:d,onChange:e=>f(e.target.checked)}),`force`]}),(0,N.jsx)(`button`,{type:`button`,onClick:()=>{u(!1),i(e.name,{force:d,purge:_&&p},h),f(!1),m(!1)},className:`rounded bg-red-600 px-2 py-1 text-white hover:bg-red-500`,children:`Yes`}),(0,N.jsx)(`button`,{type:`button`,onClick:()=>{u(!1),f(!1),m(!1)},className:`rounded bg-zinc-700 px-2 py-1 text-zinc-300 hover:bg-zinc-600`,children:`No`}),_&&(0,N.jsx)(Xc,{hosting:h,dataDir:t,checked:p,onChange:m})]}):(0,N.jsxs)(`button`,{type:`button`,disabled:o,onClick:()=>u(!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,N.jsx)(ka,{size:11}),`Clear hosting`]})]})]}):(0,N.jsxs)(`div`,{className:`rounded border border-zinc-800 bg-zinc-950/60 p-3 mb-4 text-xs`,children:[(0,N.jsx)(`p`,{className:`text-zinc-400 mb-2`,children:_?`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,N.jsxs)(`button`,{type:`button`,disabled:o,onClick:()=>c(!0),title:v?`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,N.jsx)(ua,{size:11}),`Host on an agent…`]}),s&&(0,N.jsx)(Ac,{plugin:e,onHost:r,onClose:()=>c(!1),isActing:o})]})}function Qc({plugin:e,now:t,onEnable:n,onDisable:r,onUninstall:i,onHost:a,onUnhost:o,onRotate:s,isActing:c}){let l=R(),u=e.hosting===`agent`,d=u&&e.agent!=null,f=e.agentHosting!=null&&e.hooks?.agentHalf===!0,p=F({queryKey:[`plugin-hooks`,e.name],queryFn:()=>l.getPluginHooks(e.name),enabled:e.hooks?.agentHalf===!0}).data?.hooks?.agentHalf?.dataDir??null,[m,h]=(0,g.useState)(!1),[_,v]=(0,g.useState)(!1),y=()=>{if(!m){h(!0);return}h(!1),i(e.name,{purge:f&&_},e.agentHosting),v(!1)};return(0,N.jsxs)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-5`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-2 mb-3`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(Qi,{size:16,className:`text-cyan-400`}),(0,N.jsx)(`span`,{className:`text-white font-semibold`,children:e.displayName||e.name}),(0,N.jsxs)(`span`,{className:`text-zinc-500 text-xs`,children:[`v`,e.version]})]}),(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[(0,N.jsx)(Rc,{summary:e.settings}),u&&(0,N.jsx)(Jc,{}),(0,N.jsx)(qc,{status:e.status})]})]}),e.displayName&&(0,N.jsx)(`p`,{className:`text-zinc-500 text-xs font-mono mb-1`,children:e.name}),e.description&&(0,N.jsx)(`p`,{className:`text-zinc-400 text-sm mb-2`,children:e.description}),u&&!d&&(0,N.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.`}),d&&(0,N.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,N.jsxs)(`p`,{className:`text-zinc-500 text-xs mb-4`,children:[e.packageName,e.installedAt&&(0,N.jsxs)(`span`,{children:[` · Installed `,new Date(e.installedAt).toLocaleDateString()]}),e.panel?.pages?.length>0&&(0,N.jsxs)(`span`,{children:[` `,`· `,e.panel.pages.length,` page`,e.panel.pages.length>1?`s`:``]})]}),e.capabilities&&e.capabilities.length>0&&(0,N.jsx)(`div`,{className:`flex flex-wrap gap-1 mb-4`,children:e.capabilities.map(e=>(0,N.jsx)(`span`,{className:`text-xs bg-zinc-800 text-zinc-400 px-2 py-0.5 rounded`,children:e},e))}),u&&(0,N.jsx)($s,{plugin:e.name}),(e.hooks?.relay||e.hooks?.agent||e.hooks?.agentHalf||e.hooks?.pendingUpdate)&&(0,N.jsx)(_c,{plugin:e,isActing:c}),d&&(0,N.jsx)(Zc,{plugin:e,dataDir:p,now:t,onHost:a,onUnhost:o,onRotate:s,isActing:c}),e.settings&&(0,N.jsx)(Uc,{plugin:e}),u&&(0,N.jsx)(Gc,{plugin:e,isActing:c}),(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[e.status===`disabled`?(0,N.jsxs)(`button`,{type:`button`,disabled:c,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,N.jsx)(ra,{size:12}),`Enable`]}):(0,N.jsxs)(`button`,{type:`button`,disabled:c,onClick:()=>r(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,N.jsx)(na,{size:12}),`Disable`]}),u&&(0,N.jsx)(vc,{plugin:e,isActing:c}),m?(0,N.jsxs)(`span`,{className:`flex flex-wrap items-center gap-1.5 text-xs`,children:[(0,N.jsx)(`span`,{className:`text-zinc-400`,children:f?`Remove its hosting and agent half, then uninstall?`:`Uninstall?`}),(0,N.jsx)(`button`,{type:`button`,onClick:y,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,N.jsx)(`button`,{type:`button`,onClick:()=>{h(!1),v(!1)},className:`rounded bg-zinc-700 px-2 py-1 text-zinc-300 hover:bg-zinc-600`,children:`No`}),f&&(0,N.jsx)(Xc,{hosting:e.agentHosting,dataDir:p,checked:_,onChange:v})]}):(0,N.jsxs)(`button`,{type:`button`,disabled:c||e.status===`enabled`,onClick:y,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,N.jsx)(ba,{size:12}),`Uninstall`]})]})]})}function $c({onInstall:e,isInstalling:t}){let[n,r]=(0,g.useState)(``);return(0,N.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),n.trim()&&(e(n.trim()),r(``))},className:`flex items-end gap-3`,children:[(0,N.jsxs)(`div`,{className:`flex-1`,children:[(0,N.jsx)(`label`,{className:`block text-xs text-zinc-400 mb-1`,htmlFor:`package-name`,children:`Package name`}),(0,N.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,N.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,N.jsx)(wi,{size:14}),`Install`]})]})}var el=[`install`,`update`,`uninstall`,`check-prerequisites`];function tl({policy:e,onClose:t}){let n=R(),r=P(),i=G(),[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||el.slice(0,3)),v=I({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(K(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,N.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/70`,children:(0,N.jsxs)(`div`,{className:`w-full max-w-lg rounded-xl bg-zinc-900 border border-zinc-700 p-6 shadow-xl`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,N.jsx)(`h3`,{className:`text-lg font-semibold text-white`,children:`Edit Policy`}),(0,N.jsx)(`button`,{type:`button`,onClick:t,className:`text-zinc-400 hover:text-white`,children:(0,N.jsx)(ka,{size:20})})]}),(0,N.jsxs)(`form`,{onSubmit:y,className:`space-y-4`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`label`,{className:`block text-sm font-medium text-zinc-300 mb-1`,children:`Name`}),(0,N.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,N.jsxs)(`div`,{children:[(0,N.jsx)(`label`,{className:`block text-sm font-medium text-zinc-300 mb-1`,children:`Description`}),(0,N.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,N.jsxs)(`div`,{children:[(0,N.jsx)(`label`,{className:`block text-sm font-medium text-zinc-300 mb-1`,children:`Allowed IPs (one per line)`}),(0,N.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,N.jsxs)(`div`,{children:[(0,N.jsx)(`label`,{className:`block text-sm font-medium text-zinc-300 mb-1`,children:`Denied IPs (one per line)`}),(0,N.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,N.jsxs)(`div`,{children:[(0,N.jsx)(`label`,{className:`block text-sm font-medium text-zinc-300 mb-1`,children:`Allowed Plugins (one per line)`}),(0,N.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,N.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,N.jsx)(`span`,{className:`font-mono`,children:`agent.package`}),`). Empty allows every package.`]})]}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`label`,{className:`block text-sm font-medium text-zinc-300 mb-2`,children:`Allowed Actions`}),(0,N.jsx)(`div`,{className:`flex flex-wrap gap-3`,children:el.map(e=>(0,N.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,N.jsx)(`input`,{type:`checkbox`,checked:h.includes(e),onChange:()=>b(e),className:`accent-cyan-500`}),(0,N.jsx)(`span`,{className:`text-zinc-300`,children:e})]},e))})]}),(0,N.jsxs)(`div`,{className:`flex justify-end gap-3 pt-2`,children:[(0,N.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,N.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,N.jsx)(V,{size:14,className:`animate-spin inline mr-1`}):null,`Save Changes`]})]})]})]})})}function nl(){let e=R(),t=P(),n=G(),[r,i]=(0,g.useState)(null),a=F({queryKey:[`push-install-policies`],queryFn:()=>e.getPushInstallPolicies(),refetchInterval:3e4}),o=I({mutationFn:t=>e.deletePushInstallPolicy(t),onSuccess:()=>{t.invalidateQueries({queryKey:[`push-install-policies`]}),t.invalidateQueries({queryKey:[`push-install-config`]}),n(`Policy deleted`)},onError:e=>n(K(e),`error`)}),s=a.data?.policies||[];return a.isLoading||s.length===0?null:(0,N.jsxs)(`div`,{children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2 mb-3`,children:[(0,N.jsx)(ha,{size:14,className:`text-cyan-400`}),(0,N.jsx)(`h3`,{className:`text-sm font-semibold text-zinc-300`,children:`Policies`})]}),(0,N.jsx)(`div`,{className:`overflow-x-auto rounded-lg border border-zinc-800`,children:(0,N.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,N.jsx)(`thead`,{children:(0,N.jsxs)(`tr`,{className:`border-b border-zinc-700 bg-zinc-900`,children:[(0,N.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400`,children:`Name`}),(0,N.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400 hidden md:table-cell`,children:`Description`}),(0,N.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400 hidden lg:table-cell`,children:`Actions`}),(0,N.jsx)(`th`,{className:`px-4 py-3 text-right text-xs font-medium uppercase text-zinc-400`,children:`Manage`})]})}),(0,N.jsx)(`tbody`,{children:s.map(e=>(0,N.jsxs)(`tr`,{className:`border-b border-zinc-700 bg-zinc-800`,children:[(0,N.jsx)(`td`,{className:`px-4 py-3 text-zinc-200 font-semibold`,children:e.name}),(0,N.jsx)(`td`,{className:`px-4 py-3 text-zinc-400 hidden md:table-cell`,children:e.description||`—`}),(0,N.jsx)(`td`,{className:`px-4 py-3 hidden lg:table-cell`,children:(0,N.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:(e.allowedActions||[]).map(e=>(0,N.jsx)(`span`,{className:`text-xs px-1.5 py-0.5 rounded bg-zinc-700 text-zinc-300`,children:e},e))})}),(0,N.jsx)(`td`,{className:`px-4 py-3 text-right`,children:(0,N.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,N.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,N.jsx)($i,{size:12})}),(0,N.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,N.jsx)(ba,{size:12})})]})})]},e.id))})]})}),r&&(0,N.jsx)(tl,{policy:r,onClose:()=>i(null)})]})}function rl(){let e=R(),t=P(),n=G(),{reveal:r}=qa(),i=F({queryKey:[`plugins`],queryFn:()=>e.getPlugins(),refetchInterval:1e4}),a=I({mutationFn:async t=>{let{result:n,secrets:i}=za(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(K(e),`error`)}),o=I({mutationFn:async t=>{let{result:n,secrets:i}=za(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(K(e),`error`)}),s=I({mutationFn:t=>e.disablePlugin(t),onSuccess:e=>{t.invalidateQueries({queryKey:[`plugins`]}),n(`Plugin "${e.name}" disabled`)},onError:e=>n(K(e),`error`)}),c=(e,{hosting:t})=>n(qs(e,{agentLabel:t?.agentLabel,action:`uninstall`}),`error`),l=I({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=I({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=I({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=I({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(K(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,N.jsxs)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:[(0,N.jsxs)(`div`,{className:`mb-6`,children:[(0,N.jsx)(`h1`,{className:`text-xl font-bold text-white`,children:`Plugins`}),(0,N.jsx)(`p`,{className:`text-zinc-500 text-sm mt-1`,children:`Install, enable, and manage plugins`})]}),(0,N.jsxs)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-5 mb-8`,children:[(0,N.jsx)(`h2`,{className:`text-sm font-semibold text-zinc-300 mb-4`,children:`Install Plugin`}),(0,N.jsx)($c,{onInstall:m,isInstalling:a.isPending}),a.isPending&&(0,N.jsx)(`p`,{className:`text-xs text-zinc-500 mt-2`,children:`Installing...`})]}),i.isLoading?(0,N.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:Array.from({length:2}).map((e,t)=>(0,N.jsx)(`div`,{className:`h-40 animate-pulse rounded-lg bg-zinc-900 border border-zinc-800`},t))}):i.isError?(0,N.jsx)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-6`,children:(0,N.jsxs)(`div`,{className:`flex items-center gap-2 text-red-400 text-sm`,children:[(0,N.jsx)(hi,{size:16}),`Failed to load plugins`]})}):S?.length===0?(0,N.jsx)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-6`,children:(0,N.jsx)(`p`,{className:`text-zinc-500 text-sm text-center`,children:`No plugins installed. Use the form above to install one.`})}):(0,N.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:S?.map(e=>(0,N.jsx)(Qc,{plugin:e,now:i.dataUpdatedAt,onEnable:h,onDisable:_,onUninstall:v,onHost:y,onUnhost:b,onRotate:x,isActing:p},e.name))}),(0,N.jsx)(Kc,{records:C,installedNames:w,isActing:p}),(0,N.jsx)(Tc,{children:(0,N.jsx)(nl,{})})]})}function il(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 al=/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/;function ol(e){return e?e.length>63?`Max 63 characters`:al.test(e)?null:`Lowercase letters, numbers, and hyphens only. Cannot start or end with a hyphen.`:`Subdomain is required`}var sl={default:10,min:1,max:10240};function cl(e){let t=Number(e);return e===``||!Number.isInteger(t)?`Must be a whole number of MiB`:t<sl.min?`Minimum ${sl.min}`:t>sl.max?`Maximum ${sl.max}`:null}function ll(e){return e.maxBodySizeMb??1}var ul=[{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`}],dl=[3100,9090,9091,9292,9294];function fl(e){let t=Number(e);return!e&&e!==0?`Port is required`:Number.isInteger(t)?t<1024?`Minimum 1024`:t>65535?`Maximum 65535`:dl.includes(t)?`Reserved for a Lamaste service on the relay`:null:`Must be an integer`}function pl(){let e=R(),t=F({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 ml({domain:e,onClose:t}){let n=R(),r=P(),i=G(),[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(sl.default)),{agents:v,isLoading:y}=pl(),[b,x]=(0,g.useState)({}),[S,C]=(0,g.useState)(null),w=I({mutationFn:e=>n.createTunnel(e),onSuccess:e=>{r.invalidateQueries({queryKey:[`tunnels`]}),i(`Tunnel ${e.tunnel.fqdn} created`),t()},onError:e=>{C(K(e))}}),T=(0,g.useCallback)(e=>{e.preventDefault(),C(null);let t=ol(a),n=fl(s),r={};t&&(r.subdomain=t),n&&(r.port=n),p||(r.agentLabel=`Choose the agent that carries this tunnel`);let i=cl(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,N.jsxs)(`div`,{className:`bg-zinc-900 border border-zinc-800 rounded-lg p-5 mb-6`,children:[(0,N.jsxs)(`h2`,{className:`text-sm font-semibold text-zinc-300 mb-4 flex items-center gap-2`,children:[(0,N.jsx)(ta,{size:14,className:`text-cyan-400`}),`Add Tunnel`]}),(0,N.jsxs)(`form`,{onSubmit:T,className:`space-y-4`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`label`,{className:`block text-xs text-zinc-400 mb-1`,children:`Subdomain`}),(0,N.jsxs)(`div`,{className:`flex items-center gap-0`,children:[(0,N.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,N.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,N.jsx)(`p`,{className:`text-red-400 text-xs mt-1`,children:b.subdomain})]}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`label`,{className:`block text-xs text-zinc-400 mb-1`,children:`Port`}),(0,N.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,N.jsx)(`p`,{className:`text-red-400 text-xs mt-1`,children:b.port})]}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`label`,{className:`block text-xs text-zinc-400 mb-1`,children:`Agent`}),(0,N.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,N.jsx)(`option`,{value:``,children:y?`Loading agents…`:`Select an agent`}),v.map(e=>(0,N.jsx)(`option`,{value:e,children:e},e))]}),(0,N.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,N.jsx)(`p`,{className:`text-yellow-400 text-xs mt-1`,children:`No agents enrolled yet — enroll one under Certificates first.`}),b.agentLabel&&(0,N.jsx)(`p`,{className:`text-red-400 text-xs mt-1`,children:b.agentLabel})]}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`label`,{className:`block text-xs text-zinc-400 mb-1`,children:`Largest request body (MiB)`}),(0,N.jsx)(`input`,{type:`number`,value:h,onChange:e=>{_(e.target.value),x(e=>({...e,maxBody:void 0}))},disabled:w.isPending,min:sl.min,max:sl.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,N.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,N.jsx)(`p`,{className:`text-red-400 text-xs mt-1`,children:b.maxBody})]}),(0,N.jsxs)(`div`,{children:[(0,N.jsxs)(`label`,{className:`block text-xs text-zinc-400 mb-1`,children:[`Description `,(0,N.jsx)(`span`,{className:`text-zinc-600`,children:`(optional)`})]}),(0,N.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,N.jsxs)(`div`,{children:[(0,N.jsx)(`label`,{className:`block text-xs text-zinc-400 mb-2`,children:`Access`}),(0,N.jsx)(`div`,{className:`space-y-2`,children:ul.map(e=>(0,N.jsxs)(`label`,{className:`flex items-start gap-2 cursor-pointer`,children:[(0,N.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,N.jsxs)(`div`,{children:[(0,N.jsx)(`span`,{className:`text-sm text-zinc-200`,children:e.label}),(0,N.jsx)(`p`,{className:`text-xs text-zinc-500`,children:e.desc})]})]},e.value))})]}),S&&(0,N.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,N.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,N.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,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(V,{size:14,className:`animate-spin`}),`Setting up tunnel...`]}):(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(ta,{size:14}),`Add Tunnel`]})}),(0,N.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 hl({tunnel:e,onConfirm:t,onCancel:n,isPending:r}){return(0,N.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60`,children:(0,N.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,N.jsx)(`h3`,{className:`text-lg font-semibold text-white mb-2`,children:`Delete Tunnel`}),(0,N.jsxs)(`p`,{className:`text-zinc-400 text-sm mb-6`,children:[`Are you sure you want to delete`,` `,(0,N.jsx)(`span`,{className:`text-cyan-400 font-mono`,children:e.fqdn}),`? This will remove the nginx configuration and TLS certificate mapping.`]}),(0,N.jsxs)(`div`,{className:`flex items-center justify-end gap-3`,children:[(0,N.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,N.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,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(V,{size:14,className:`animate-spin`}),`Deleting...`]}):`Delete`})]})]})})}function gl({tunnel:e,onConfirm:t,onCancel:n,isPending:r}){let{agents:i,isLoading:a}=pl(),[o,s]=(0,g.useState)(e.agentLabel||``),[c,l]=(0,g.useState)(e.accessMode||`restricted`),u=ll(e),[d,f]=(0,g.useState)(String(u)),p=cl(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,N.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60`,children:(0,N.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,N.jsx)(`h3`,{className:`text-lg font-semibold text-white mb-1`,children:`Edit Tunnel`}),(0,N.jsx)(`p`,{className:`text-cyan-400 font-mono text-sm mb-5`,children:e.fqdn}),(0,N.jsx)(`label`,{className:`block text-xs text-zinc-400 mb-1`,children:`Agent`}),(0,N.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,N.jsx)(`option`,{value:``,children:`Unassigned — select an agent`}),i.map(e=>(0,N.jsx)(`option`,{value:e,children:e},e))]}),m.agentLabel&&(0,N.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,N.jsx)(`label`,{className:`block text-xs text-zinc-400 mt-4 mb-2`,children:`Access`}),(0,N.jsx)(`div`,{className:`space-y-2`,children:ul.map(e=>(0,N.jsxs)(`label`,{className:`flex items-start gap-2 cursor-pointer`,children:[(0,N.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,N.jsxs)(`div`,{children:[(0,N.jsx)(`span`,{className:`text-sm text-zinc-200`,children:e.label}),(0,N.jsx)(`p`,{className:`text-xs text-zinc-500`,children:e.desc})]})]},e.value))}),(0,N.jsx)(`label`,{className:`block text-xs text-zinc-400 mt-4 mb-1`,children:`Largest request body (MiB)`}),(0,N.jsx)(`input`,{type:`number`,value:d,onChange:e=>f(e.target.value),disabled:r,min:sl.min,max:sl.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,N.jsx)(`p`,{className:`text-red-400 text-xs mt-1`,children:p}),(0,N.jsxs)(`div`,{className:`flex items-center justify-end gap-3 mt-6`,children:[(0,N.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,N.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,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(V,{size:14,className:`animate-spin`}),`Saving...`]}):`Save`})]})]})})}function _l({tunnel:e}){return(0,N.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 vl({tunnel:e}){return e.agentLabel?(0,N.jsx)(`span`,{className:`text-sm text-zinc-300 font-mono`,children:e.agentLabel}):(0,N.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 yl({tunnels:e,onDelete:t,onToggle:n,onEdit:r}){return(0,N.jsx)(`div`,{className:`hidden md:block overflow-x-auto`,children:(0,N.jsxs)(`table`,{className:`w-full`,children:[(0,N.jsx)(`thead`,{children:(0,N.jsxs)(`tr`,{className:`border-b border-zinc-700`,children:[(0,N.jsx)(`th`,{className:`text-left text-zinc-400 text-xs uppercase font-semibold py-3 px-4`,children:`Status`}),(0,N.jsx)(`th`,{className:`text-left text-zinc-400 text-xs uppercase font-semibold py-3 px-4`,children:`Subdomain`}),(0,N.jsx)(`th`,{className:`text-left text-zinc-400 text-xs uppercase font-semibold py-3 px-4`,children:`FQDN`}),(0,N.jsx)(`th`,{className:`text-left text-zinc-400 text-xs uppercase font-semibold py-3 px-4`,children:`Port`}),(0,N.jsx)(`th`,{className:`text-left text-zinc-400 text-xs uppercase font-semibold py-3 px-4`,children:`Agent`}),(0,N.jsx)(`th`,{className:`text-left text-zinc-400 text-xs uppercase font-semibold py-3 px-4`,children:`Access`}),(0,N.jsx)(`th`,{className:`text-left text-zinc-400 text-xs uppercase font-semibold py-3 px-4`,children:`Body limit`}),(0,N.jsx)(`th`,{className:`text-left text-zinc-400 text-xs uppercase font-semibold py-3 px-4`,children:`Description`}),(0,N.jsx)(`th`,{className:`text-left text-zinc-400 text-xs uppercase font-semibold py-3 px-4`,children:`Created`}),(0,N.jsx)(`th`,{className:`text-right text-zinc-400 text-xs uppercase font-semibold py-3 px-4`,children:`Actions`})]})}),(0,N.jsx)(`tbody`,{children:e.map(e=>{let i=e.enabled!==!1,a=e.exposure===`internal`;return(0,N.jsxs)(`tr`,{className:`border-b border-zinc-700 ${i?`bg-zinc-800/50`:`bg-zinc-800/20 opacity-60`}`,children:[(0,N.jsx)(`td`,{className:`py-3 px-4`,children:(0,N.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,N.jsx)(`td`,{className:`py-3 px-4 text-sm text-zinc-200 font-mono`,children:a?(0,N.jsx)(_l,{tunnel:e}):e.subdomain}),(0,N.jsx)(`td`,{className:`py-3 px-4 text-sm`,children:a?(0,N.jsx)(`span`,{className:`text-zinc-500`,children:`relay loopback only`}):(0,N.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,N.jsx)(Ei,{size:12})]})}),(0,N.jsx)(`td`,{className:`py-3 px-4 text-sm text-zinc-200 font-mono`,children:e.port}),(0,N.jsx)(`td`,{className:`py-3 px-4`,children:(0,N.jsx)(vl,{tunnel:e})}),(0,N.jsxs)(`td`,{className:`py-3 px-4 text-sm`,children:[a&&(0,N.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,N.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,N.jsx)(`td`,{className:`py-3 px-4 text-sm text-zinc-400 font-mono`,children:e.type===`panel`?`—`:`${ll(e)} MiB`}),(0,N.jsx)(`td`,{className:`py-3 px-4 text-sm text-zinc-400`,children:e.description||`—`}),(0,N.jsx)(`td`,{className:`py-3 px-4 text-sm text-zinc-500`,children:il(e.createdAt)}),(0,N.jsx)(`td`,{className:`py-3 px-4 text-right`,children:a?(0,N.jsx)(`span`,{className:`text-xs text-zinc-500`,title:`Managed with the plugin's hosting`,children:`managed by plugin hosting`}):(0,N.jsxs)(`div`,{className:`inline-flex items-center gap-2`,children:[e.type!==`panel`&&(0,N.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,N.jsx)(da,{size:12}),`Edit`]}),(0,N.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,N.jsx)(ra,{size:12}),i?`Disable`:`Enable`]}),(0,N.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,N.jsx)(ba,{size:12}),`Delete`]})]})})]},e.id)})})]})})}function bl({tunnels:e,onDelete:t,onToggle:n,onEdit:r}){return(0,N.jsx)(`div`,{className:`md:hidden space-y-3`,children:e.map(e=>{let i=e.enabled!==!1,a=e.exposure===`internal`;return(0,N.jsxs)(`div`,{className:`border border-zinc-700 rounded-lg p-4 ${i?`bg-zinc-800/50`:`bg-zinc-800/20 opacity-60`}`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.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,N.jsx)(`span`,{className:`text-sm font-semibold text-zinc-200 font-mono`,children:a?(0,N.jsx)(_l,{tunnel:e}):e.subdomain})]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.type!==`panel`&&!a&&(0,N.jsx)(`button`,{type:`button`,onClick:()=>r(e),className:`text-xs text-zinc-300`,title:`Agent, access mode, body limit`,children:(0,N.jsx)(da,{size:14})}),!a&&(0,N.jsx)(`button`,{type:`button`,onClick:()=>n(e),className:`text-xs ${i?`text-yellow-400`:`text-green-400`}`,children:(0,N.jsx)(ra,{size:14})}),!a&&(0,N.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,N.jsx)(ba,{size:12})})]})]}),a?(0,N.jsx)(`p`,{className:`text-sm text-zinc-500 mb-1`,children:`Relay loopback only — managed by plugin hosting`}):(0,N.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,N.jsx)(Ei,{size:12})]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-4 text-xs text-zinc-500 mt-2`,children:[(0,N.jsxs)(`span`,{children:[`Port: `,(0,N.jsx)(`span`,{className:`text-zinc-300 font-mono`,children:e.port})]}),(0,N.jsxs)(`span`,{children:[`Agent: `,(0,N.jsx)(vl,{tunnel:e})]}),(0,N.jsx)(`span`,{children:il(e.createdAt)})]}),e.description&&(0,N.jsx)(`p`,{className:`text-xs text-zinc-400 mt-2`,children:e.description})]},e.id)})})}function xl(){let e=R(),t=P(),n=G(),[r,i]=(0,g.useState)(!1),[a,o]=(0,g.useState)(null),[s,c]=(0,g.useState)(null),l=F({queryKey:[`tunnels`],queryFn:()=>e.getTunnels(),refetchInterval:1e4}),u=F({queryKey:[`tunnel-agent-config`],queryFn:()=>e.getTunnelAgentConfig()}).data?.domain,d=I({mutationFn:t=>e.deleteTunnel(t),onSuccess:()=>{t.invalidateQueries({queryKey:[`tunnels`]}),n(`Tunnel ${a.fqdn} deleted`),o(null)},onError:e=>{n(K(e),`error`),o(null)}}),f=I({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(K(e),`error`)}}),p=I({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(K(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,N.jsxs)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:[(0,N.jsxs)(`div`,{className:`mb-6 flex items-center justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h1`,{className:`text-xl font-bold text-white`,children:`Tunnels`}),(0,N.jsx)(`p`,{className:`text-zinc-500 text-sm mt-1`,children:`Manage reverse tunnel configurations`})]}),!r&&(0,N.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,N.jsx)(ta,{size:14}),`Add Tunnel`]})]}),r&&u&&(0,N.jsx)(ml,{domain:u,onClose:()=>i(!1)}),l.isLoading?(0,N.jsx)(`div`,{className:`space-y-3`,children:Array.from({length:3}).map((e,t)=>(0,N.jsx)(`div`,{className:`h-16 animate-pulse rounded-lg bg-zinc-900 border border-zinc-800`},t))}):l.isError?(0,N.jsx)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-6`,children:(0,N.jsx)(`p`,{className:`text-red-400 text-sm`,children:`Failed to load tunnels`})}):y.length===0?(0,N.jsxs)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-12 text-center`,children:[(0,N.jsx)(Zi,{size:32,className:`mx-auto text-zinc-600 mb-3`}),(0,N.jsx)(`p`,{className:`text-zinc-400 text-sm`,children:`No tunnels yet. Add your first tunnel to get started.`})]}):(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(yl,{tunnels:y,onDelete:h,onToggle:_,onEdit:m}),(0,N.jsx)(bl,{tunnels:y,onDelete:h,onToggle:_,onEdit:m})]}),s&&(0,N.jsx)(gl,{tunnel:s,onConfirm:e=>p.mutate({id:s.id,changes:e}),onCancel:()=>c(null),isPending:p.isPending}),a&&(0,N.jsx)(hl,{tunnel:a,onConfirm:v,onCancel:()=>o(null),isPending:d.isPending})]})}function Sl({hasDomain:e}){let t=R(),n=G(),r=P(),i=F({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=I({mutationFn:()=>t.setup2fa(),onSuccess:e=>o(e)}),b=I({mutationFn:e=>t.confirm2fa(e),onSuccess:()=>{r.invalidateQueries(),o(null),c(``),n(`Two-factor authentication enabled`)}}),x=I({mutationFn:e=>t.disable2fa(e),onSuccess:()=>{r.invalidateQueries(),u(``),n(`Two-factor authentication disabled`)}}),S=I({mutationFn:e=>t.triggerPanelUpdate(e),onSuccess:()=>{n(`Update initiated. The panel will restart shortly.`),m(``),_(!1)},onError:e=>n(K(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,N.jsx)(`div`,{className:`p-6`,children:(0,N.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,N.jsxs)(`div`,{className:`mx-auto max-w-2xl p-6`,children:[(0,N.jsx)(`h1`,{className:`text-xl font-bold text-white`,children:`Settings`}),(0,N.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,N.jsxs)(`div`,{className:`mx-auto max-w-2xl p-6`,children:[(0,N.jsxs)(`div`,{className:`mb-6`,children:[(0,N.jsx)(`h1`,{className:`text-xl font-bold text-white`,children:`Settings`}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-zinc-500`,children:`Configure panel security settings.`})]}),(0,N.jsxs)(`div`,{className:`rounded-lg border border-zinc-800 bg-zinc-900 p-6`,children:[(0,N.jsxs)(`div`,{className:`mb-4 flex items-center gap-3`,children:[(0,N.jsx)(ma,{className:`h-5 w-5 text-cyan-400`}),(0,N.jsx)(`h2`,{className:`text-lg font-bold text-white`,children:`Two-Factor Authentication`}),v.enabled&&(0,N.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,N.jsxs)(`div`,{children:[(0,N.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,N.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,N.jsx)(xa,{className:`mt-0.5 h-4 w-4 flex-shrink-0 text-yellow-400`}),(0,N.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,N.jsx)(`p`,{className:`mb-3 text-sm text-red-400`,children:te}),(0,N.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,N.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,N.jsxs)(`div`,{children:[(0,N.jsx)(`p`,{className:`mb-4 text-sm text-zinc-400`,children:`Scan this QR code with your authenticator app (Google Authenticator, Authy, etc.)`}),(0,N.jsx)(`div`,{className:`mb-4 flex justify-center`,children:(0,N.jsx)(`div`,{className:`rounded-lg bg-zinc-950 p-4`,children:(0,N.jsx)(is,{value:a.uri,size:200,bgColor:`transparent`,fgColor:`#ffffff`})})}),(0,N.jsx)(`p`,{className:`mb-2 text-sm text-zinc-400`,children:`Or enter this code manually:`}),(0,N.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 rounded-lg bg-zinc-950 px-4 py-3`,children:[(0,N.jsx)(`code`,{className:`flex-1 font-mono text-sm tracking-wider text-cyan-400`,children:a.manualKey?.replace(/(.{4})/g,`$1 `).trim()}),(0,N.jsx)(`button`,{type:`button`,onClick:w,className:`text-zinc-500 hover:text-zinc-300`,title:`Copy secret`,children:d?(0,N.jsx)(ui,{size:16,className:`text-green-400`}):(0,N.jsx)(xi,{size:16})})]}),(0,N.jsxs)(`form`,{onSubmit:T,className:`space-y-3`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`label`,{className:`mb-1 block text-sm text-zinc-400`,children:`Enter the code from your authenticator to confirm`}),(0,N.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,N.jsx)(`p`,{className:`text-sm text-red-400`,children:D}),(0,N.jsxs)(`div`,{className:`flex gap-3`,children:[(0,N.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,N.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,N.jsxs)(`div`,{children:[(0,N.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,N.jsx)(`div`,{className:`mb-4 rounded-lg border border-zinc-700 bg-zinc-950 p-3`,children:(0,N.jsxs)(`p`,{className:`text-xs text-zinc-500`,children:[`Recovery: if you lose access to your authenticator, run`,` `,(0,N.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,N.jsxs)(`form`,{onSubmit:E,className:`space-y-3`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`label`,{className:`mb-1 block text-sm text-zinc-400`,children:`Enter a TOTP code to disable 2FA`}),(0,N.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,N.jsx)(`p`,{className:`text-sm text-red-400`,children:ee}),(0,N.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,N.jsxs)(`div`,{className:`mt-6 rounded-lg border border-zinc-800 bg-zinc-900 p-6`,children:[(0,N.jsxs)(`div`,{className:`mb-4 flex items-center gap-3`,children:[(0,N.jsx)(ia,{className:`h-5 w-5 text-cyan-400`}),(0,N.jsx)(`h2`,{className:`text-lg font-bold text-white`,children:`Panel Update`})]}),(0,N.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,N.jsxs)(`div`,{className:`flex items-end gap-3`,children:[(0,N.jsxs)(`div`,{className:`flex-1`,children:[(0,N.jsx)(`label`,{className:`mb-1 block text-sm text-zinc-400`,htmlFor:`update-version`,children:`Version`}),(0,N.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,N.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,N.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,N.jsx)(`p`,{className:`mt-2 text-sm text-red-400`,children:S.error.message}),h&&(0,N.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/70`,children:(0,N.jsxs)(`div`,{className:`w-full max-w-sm rounded-xl border border-zinc-700 bg-zinc-900 p-6 shadow-xl`,children:[(0,N.jsxs)(`div`,{className:`mb-4 flex items-center gap-2`,children:[(0,N.jsx)(xa,{className:`h-5 w-5 text-amber-400`}),(0,N.jsx)(`h3`,{className:`text-lg font-semibold text-white`,children:`Confirm Update`})]}),(0,N.jsxs)(`p`,{className:`mb-4 text-sm text-zinc-400`,children:[`This will update the panel server to version`,` `,(0,N.jsx)(`strong`,{className:`text-white`,children:p}),` and restart the service. The panel will be unavailable for 1-2 minutes.`]}),(0,N.jsxs)(`div`,{className:`flex justify-end gap-3`,children:[(0,N.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,N.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 Cl({onClose:e}){let t=R(),n=P(),r=G(),[i,a]=(0,g.useState)({id:crypto.randomUUID(),label:``,provider:`digitalocean-spaces`,region:``,bucket:``,endpoint:``,accessKey:``,secretKey:``}),o=I({mutationFn:e=>t.registerStorageServer(e),onSuccess:()=>{n.invalidateQueries({queryKey:[`storage-servers`]}),r(`Storage server registered`),e()},onError:e=>r(K(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,N.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/70`,children:(0,N.jsxs)(`div`,{className:`w-full max-w-lg rounded-xl bg-zinc-900 border border-zinc-700 p-6 shadow-xl`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,N.jsx)(`h3`,{className:`text-lg font-semibold text-white`,children:`Register Storage Server`}),(0,N.jsx)(`button`,{type:`button`,onClick:e,className:`text-zinc-400 hover:text-white`,children:(0,N.jsx)(ka,{size:20})})]}),(0,N.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),o.mutate(i)},className:`space-y-4`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`label`,{className:`block text-sm font-medium text-zinc-300 mb-1`,children:`Label`}),(0,N.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,N.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`label`,{className:`block text-sm font-medium text-zinc-300 mb-1`,children:`Provider`}),(0,N.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,N.jsx)(`option`,{value:`digitalocean-spaces`,children:`DigitalOcean Spaces`}),(0,N.jsx)(`option`,{value:`s3`,children:`Amazon S3`})]})]}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`label`,{className:`block text-sm font-medium text-zinc-300 mb-1`,children:`Region`}),(0,N.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,N.jsxs)(`div`,{children:[(0,N.jsx)(`label`,{className:`block text-sm font-medium text-zinc-300 mb-1`,children:`Bucket`}),(0,N.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,N.jsxs)(`div`,{children:[(0,N.jsx)(`label`,{className:`block text-sm font-medium text-zinc-300 mb-1`,children:`Endpoint URL`}),(0,N.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,N.jsxs)(`div`,{children:[(0,N.jsx)(`label`,{className:`block text-sm font-medium text-zinc-300 mb-1`,children:`Access Key`}),(0,N.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,N.jsxs)(`div`,{children:[(0,N.jsx)(`label`,{className:`block text-sm font-medium text-zinc-300 mb-1`,children:`Secret Key`}),(0,N.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,N.jsx)(`div`,{className:`rounded bg-amber-500/10 border border-amber-500/20 px-3 py-2`,children:(0,N.jsx)(`p`,{className:`text-xs text-amber-300`,children:`Credentials are encrypted at rest using AES-256-GCM. They never leave the server.`})}),(0,N.jsxs)(`div`,{className:`flex justify-end gap-3 pt-2`,children:[(0,N.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,N.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,N.jsx)(V,{size:14,className:`animate-spin inline mr-1`}):null,`Register`]})]})]})]})})}function wl({servers:e,onClose:t}){let n=R(),r=P(),i=G(),[a,o]=(0,g.useState)(``),[s,c]=(0,g.useState)(e[0]?.id||``),l=F({queryKey:[`plugins`],queryFn:()=>n.getPlugins()}),u=I({mutationFn:e=>n.createStorageBinding(e),onSuccess:()=>{r.invalidateQueries({queryKey:[`storage-bindings`]}),i(`Plugin bound to storage`),t()},onError:e=>i(K(e),`error`)}),d=l.data?.plugins||[];return(0,N.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/70`,children:(0,N.jsxs)(`div`,{className:`w-full max-w-md rounded-xl bg-zinc-900 border border-zinc-700 p-6 shadow-xl`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,N.jsx)(`h3`,{className:`text-lg font-semibold text-white`,children:`Bind Plugin to Storage`}),(0,N.jsx)(`button`,{type:`button`,onClick:t,className:`text-zinc-400 hover:text-white`,children:(0,N.jsx)(ka,{size:20})})]}),(0,N.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),u.mutate({pluginName:a,storageServerId:s})},className:`space-y-4`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`label`,{className:`block text-sm font-medium text-zinc-300 mb-1`,children:`Plugin`}),(0,N.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,N.jsx)(`option`,{value:``,children:`Select a plugin...`}),d.map(e=>(0,N.jsx)(`option`,{value:e.name,children:e.displayName||e.name},e.name))]})]}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`label`,{className:`block text-sm font-medium text-zinc-300 mb-1`,children:`Storage Server`}),(0,N.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,N.jsxs)(`option`,{value:e.id,children:[e.label,` (`,e.provider,` / `,e.region,`)`]},e.id))})]}),(0,N.jsxs)(`div`,{className:`flex justify-end gap-3 pt-2`,children:[(0,N.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,N.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,N.jsx)(V,{size:14,className:`animate-spin inline mr-1`}):null,`Bind`]})]})]})]})})}function Tl(){let e=R(),t=P(),n=G(),[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({queryKey:[`storage-servers`],queryFn:()=>e.getStorageServers(),refetchInterval:1e4}),f=F({queryKey:[`storage-bindings`],queryFn:()=>e.getStorageBindings(),refetchInterval:1e4}),p=I({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(K(e),`error`),c(null)}}),m=I({mutationFn:t=>e.deleteStorageBinding(t),onSuccess:()=>{t.invalidateQueries({queryKey:[`storage-bindings`]}),n(`Plugin unbound from storage`),u(null)},onError:e=>{n(K(e),`error`),u(null)}}),h=d.data?.servers||[],_=f.data?.bindings||[];return(0,N.jsxs)(`div`,{className:`p-6 max-w-4xl mx-auto`,children:[(0,N.jsxs)(`div`,{className:`mb-6`,children:[(0,N.jsx)(`h1`,{className:`text-xl font-bold text-white`,children:`Storage`}),(0,N.jsx)(`p`,{className:`text-zinc-500 text-sm mt-1`,children:`Manage S3-compatible storage servers and bind them to plugins.`})]}),(0,N.jsxs)(`div`,{className:`mb-8`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,N.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,N.jsx)(Ii,{size:18,className:`text-cyan-400`}),`Storage Servers`]}),(0,N.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,N.jsx)(ta,{size:14}),`Register Server`]})]}),d.isLoading?(0,N.jsx)(`div`,{className:`space-y-3`,children:Array.from({length:2}).map((e,t)=>(0,N.jsx)(`div`,{className:`h-14 animate-pulse rounded-lg bg-zinc-900 border border-zinc-800`},t))}):d.isError?(0,N.jsx)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-6`,children:(0,N.jsxs)(`div`,{className:`flex items-center gap-2 text-red-400 text-sm`,children:[(0,N.jsx)(hi,{size:16}),`Failed to load storage servers`]})}):h.length===0?(0,N.jsxs)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-8 text-center`,children:[(0,N.jsx)(Ii,{size:32,className:`mx-auto text-zinc-600 mb-3`}),(0,N.jsx)(`p`,{className:`text-zinc-400 text-sm`,children:`No storage servers registered. Register one to enable plugin storage.`})]}):(0,N.jsx)(`div`,{className:`overflow-x-auto rounded-lg border border-zinc-800`,children:(0,N.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,N.jsx)(`thead`,{children:(0,N.jsxs)(`tr`,{className:`border-b border-zinc-700 bg-zinc-900`,children:[(0,N.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400`,children:`Label`}),(0,N.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400`,children:`Provider`}),(0,N.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400 hidden md:table-cell`,children:`Region`}),(0,N.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400 hidden lg:table-cell`,children:`Bucket`}),(0,N.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400 hidden lg:table-cell`,children:`Registered`}),(0,N.jsx)(`th`,{className:`px-4 py-3 text-right text-xs font-medium uppercase text-zinc-400`,children:`Actions`})]})}),(0,N.jsx)(`tbody`,{children:h.map(e=>(0,N.jsxs)(`tr`,{className:`border-b border-zinc-700 bg-zinc-800`,children:[(0,N.jsx)(`td`,{className:`px-4 py-3 text-zinc-200 font-semibold`,children:e.label}),(0,N.jsx)(`td`,{className:`px-4 py-3 text-zinc-400`,children:e.provider}),(0,N.jsx)(`td`,{className:`px-4 py-3 text-zinc-400 hidden md:table-cell`,children:e.region}),(0,N.jsx)(`td`,{className:`px-4 py-3 text-zinc-400 font-mono text-xs hidden lg:table-cell`,children:e.bucket}),(0,N.jsx)(`td`,{className:`px-4 py-3 text-zinc-500 hidden lg:table-cell`,children:e.registeredAt?_r(e.registeredAt):`—`}),(0,N.jsx)(`td`,{className:`px-4 py-3 text-right`,children:(0,N.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,N.jsx)(ba,{size:12})})})]},e.id))})]})})]}),(0,N.jsxs)(`div`,{children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,N.jsxs)(`h2`,{className:`text-lg font-semibold text-white flex items-center gap-2`,children:[(0,N.jsx)(Wi,{size:18,className:`text-cyan-400`}),`Plugin Bindings`]}),h.length>0&&(0,N.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,N.jsx)(ta,{size:14}),`Bind Plugin`]})]}),f.isLoading?(0,N.jsx)(`div`,{className:`space-y-3`,children:Array.from({length:2}).map((e,t)=>(0,N.jsx)(`div`,{className:`h-14 animate-pulse rounded-lg bg-zinc-900 border border-zinc-800`},t))}):f.isError?(0,N.jsx)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-6`,children:(0,N.jsxs)(`div`,{className:`flex items-center gap-2 text-red-400 text-sm`,children:[(0,N.jsx)(hi,{size:16}),`Failed to load bindings`]})}):_.length===0?(0,N.jsxs)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-8 text-center`,children:[(0,N.jsx)(Wi,{size:32,className:`mx-auto text-zinc-600 mb-3`}),(0,N.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,N.jsx)(`div`,{className:`overflow-x-auto rounded-lg border border-zinc-800`,children:(0,N.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,N.jsx)(`thead`,{children:(0,N.jsxs)(`tr`,{className:`border-b border-zinc-700 bg-zinc-900`,children:[(0,N.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400`,children:`Plugin`}),(0,N.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400`,children:`Storage Server`}),(0,N.jsx)(`th`,{className:`px-4 py-3 text-left text-xs font-medium uppercase text-zinc-400 hidden md:table-cell`,children:`Bound`}),(0,N.jsx)(`th`,{className:`px-4 py-3 text-right text-xs font-medium uppercase text-zinc-400`,children:`Actions`})]})}),(0,N.jsx)(`tbody`,{children:_.map(e=>{let t=h.find(t=>t.id===e.storageServerId);return(0,N.jsxs)(`tr`,{className:`border-b border-zinc-700 bg-zinc-800`,children:[(0,N.jsx)(`td`,{className:`px-4 py-3 text-zinc-200 font-semibold`,children:e.pluginName}),(0,N.jsx)(`td`,{className:`px-4 py-3 text-zinc-400`,children:t?.label||e.storageServerId.slice(0,8)}),(0,N.jsx)(`td`,{className:`px-4 py-3 text-zinc-500 hidden md:table-cell`,children:e.boundAt?_r(e.boundAt):`—`}),(0,N.jsx)(`td`,{className:`px-4 py-3 text-right`,children:(0,N.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,N.jsx)(wa,{size:12})})})]},e.pluginName)})})]})})]}),r&&(0,N.jsx)(Cl,{onClose:()=>i(!1)}),a&&(0,N.jsx)(wl,{servers:h,onClose:()=>o(!1)}),s&&(0,N.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/70`,children:(0,N.jsxs)(`div`,{className:`w-full max-w-sm rounded-xl border border-zinc-700 bg-zinc-900 p-6 shadow-xl`,children:[(0,N.jsx)(`h3`,{className:`text-lg font-semibold text-white mb-3`,children:`Remove Storage Server`}),(0,N.jsxs)(`p`,{className:`text-sm text-zinc-400 mb-2`,children:[`Are you sure you want to remove`,` `,(0,N.jsx)(`strong`,{className:`text-white`,children:s.label}),`?`]}),(0,N.jsx)(`p`,{className:`text-xs text-amber-400 mb-4`,children:`All plugin bindings to this server will also be removed.`}),(0,N.jsxs)(`div`,{className:`flex justify-end gap-3`,children:[(0,N.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,N.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,N.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/70`,children:(0,N.jsxs)(`div`,{className:`w-full max-w-sm rounded-xl border border-zinc-700 bg-zinc-900 p-6 shadow-xl`,children:[(0,N.jsx)(`h3`,{className:`text-lg font-semibold text-white mb-3`,children:`Unbind Plugin`}),(0,N.jsxs)(`p`,{className:`text-sm text-zinc-400 mb-4`,children:[`Remove storage binding for `,(0,N.jsx)(`strong`,{className:`text-white`,children:l}),`?`]}),(0,N.jsxs)(`div`,{className:`flex justify-end gap-3`,children:[(0,N.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,N.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 El=50,Dl={info:`text-cyan-400`,warning:`text-yellow-400`,critical:`text-red-400`};function Ol(){let e=R(),t=P(),n=G(),r=F({queryKey:[`notifications`],queryFn:()=>e.getNotifications({limit:50}),refetchInterval:3e4}),i=I({mutationFn:()=>e.markNotificationsRead({all:!0}),onSuccess:()=>t.invalidateQueries({queryKey:[`notifications`]}),onError:e=>n(K(e),`error`)}),a=r.data?.notifications??[],o=r.data?.unread??0;return(0,N.jsxs)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-5 mb-6`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,N.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-zinc-300`,children:[(0,N.jsx)(si,{size:14,className:`text-cyan-400`}),` Notifications`,o>0&&(0,N.jsx)(`span`,{className:`rounded-full bg-cyan-500/20 px-2 text-xs text-cyan-400`,children:o})]}),o>0&&(0,N.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,N.jsx)(li,{size:12}),` Mark all read`]})]}),a.length===0?(0,N.jsx)(`p`,{className:`text-xs text-zinc-500`,children:`Nothing to report.`}):(0,N.jsx)(`ul`,{className:`space-y-1.5 text-xs`,children:a.map(e=>(0,N.jsxs)(`li`,{className:`flex gap-3 ${e.read?`opacity-60`:``}`,children:[(0,N.jsx)(`span`,{className:`shrink-0 text-zinc-500`,children:new Date(e.at).toLocaleString()}),(0,N.jsx)(`span`,{className:`shrink-0 ${Dl[e.level]??`text-zinc-400`}`,children:e.level}),(0,N.jsx)(`span`,{className:`shrink-0 font-mono text-zinc-500`,children:e.source}),(0,N.jsx)(`span`,{className:`text-zinc-300 break-words`,children:e.message})]},e.id))})]})}function kl(e){return Object.entries(e??{}).map(([e,t])=>`${e}=${typeof t==`object`&&t?JSON.stringify(t):t}`).join(` `)}function Al(){let e=R(),[t,n]=(0,g.useState)(``),[r,i]=(0,g.useState)(``),a={plugin:t.trim()||void 0,action:r.trim()||void 0},o=mr({queryKey:[`audit`,a],queryFn:({pageParam:t})=>e.getAuditLog({...a,limit:El,...t?{before:t}:{}}),initialPageParam:void 0,getNextPageParam:e=>e.entries.length===El?e.entries[e.entries.length-1].id:void 0,refetchInterval:3e4}),s=o.data?.pages.flatMap(e=>e.entries)??[];return(0,N.jsxs)(`div`,{className:`p-6 max-w-5xl mx-auto`,children:[(0,N.jsxs)(`div`,{className:`mb-6`,children:[(0,N.jsx)(`h1`,{className:`text-xl font-bold text-white`,children:`Audit`}),(0,N.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,N.jsx)(Ol,{}),(0,N.jsxs)(`div`,{className:`rounded-lg bg-zinc-900 border border-zinc-800 p-5`,children:[(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 mb-4`,children:[(0,N.jsx)(ca,{size:14,className:`text-cyan-400`}),(0,N.jsx)(`h2`,{className:`text-sm font-semibold text-zinc-300 mr-4`,children:`Audit log`}),(0,N.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,N.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,N.jsxs)(`div`,{className:`flex items-center gap-2 text-red-400 text-sm`,children:[(0,N.jsx)(hi,{size:16}),` Failed to load the audit log`]}):s.length===0?(0,N.jsx)(`p`,{className:`text-xs text-zinc-500`,children:o.isLoading?`Loading…`:`No entries.`}):(0,N.jsxs)(`table`,{className:`w-full text-xs`,children:[(0,N.jsx)(`thead`,{children:(0,N.jsxs)(`tr`,{className:`text-left text-zinc-500`,children:[(0,N.jsx)(`th`,{className:`pb-2 pr-3 font-normal`,children:`When`}),(0,N.jsx)(`th`,{className:`pb-2 pr-3 font-normal`,children:`Action`}),(0,N.jsx)(`th`,{className:`pb-2 pr-3 font-normal`,children:`Actor`}),(0,N.jsx)(`th`,{className:`pb-2 pr-3 font-normal`,children:`Plugin`}),(0,N.jsx)(`th`,{className:`pb-2 font-normal`,children:`Details`})]})}),(0,N.jsx)(`tbody`,{children:s.map(e=>(0,N.jsxs)(`tr`,{className:`border-t border-zinc-800 align-top`,children:[(0,N.jsx)(`td`,{className:`py-1.5 pr-3 whitespace-nowrap text-zinc-500`,children:new Date(e.at).toLocaleString()}),(0,N.jsx)(`td`,{className:`py-1.5 pr-3 font-mono text-cyan-400`,children:e.action}),(0,N.jsx)(`td`,{className:`py-1.5 pr-3 font-mono text-zinc-300`,children:e.actor}),(0,N.jsx)(`td`,{className:`py-1.5 pr-3 font-mono text-zinc-300`,children:e.plugin??``}),(0,N.jsx)(`td`,{className:`py-1.5 font-mono text-zinc-500 break-all`,children:kl(e.details)})]},e.id))})]}),o.hasNextPage&&(0,N.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 X(e,t){return L(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)})}function jl(e,t){return L(e,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)})}function Ml(e,t){return L(e,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)})}function Nl(e,t){let n={method:`DELETE`};return t&&(n.headers={"Content-Type":`application/json`},n.body=JSON.stringify(t)),L(e,n)}function Pl(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 Fl({force:e=!1,purge:t=!1}={}){return Pl({force:e?`true`:void 0,purge:t?`true`:void 0})}var Il={getUsers:()=>L(`/api/users`),createUser:e=>X(`/api/users`,e),updateUser:(e,t)=>jl(`/api/users/${encodeURIComponent(e)}`,t),deleteUser:e=>Nl(`/api/users/${encodeURIComponent(e)}`),resetTotp:e=>X(`/api/users/${encodeURIComponent(e)}/reset-totp`),getInvitations:()=>L(`/api/invitations`),createInvitation:e=>X(`/api/invitations`,e),revokeInvitation:e=>Nl(`/api/invitations/${encodeURIComponent(e)}`),getSites:()=>L(`/api/sites`),createSite:e=>X(`/api/sites`,e),deleteSite:e=>Nl(`/api/sites/${encodeURIComponent(e)}`),updateSite:(e,t)=>Ml(`/api/sites/${encodeURIComponent(e)}`,t),getSiteFiles:(e,t)=>{let n=t&&t!==`.`?`?path=${encodeURIComponent(t)}`:``;return L(`/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 L(`/api/sites/${encodeURIComponent(e)}/files${i}`,{method:`POST`,body:r})},deleteSiteFile:(e,t)=>Nl(`/api/sites/${encodeURIComponent(e)}/files`,{path:t}),verifySiteDns:e=>X(`/api/sites/${encodeURIComponent(e)}/verify-dns`),getCerts:()=>L(`/api/certs`),renewCert:e=>X(`/api/certs/${encodeURIComponent(e)}/renew`),rotateMtls:()=>X(`/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:()=>L(`/api/certs/admin/auth-mode`),getAutoRenewStatus:()=>L(`/api/certs/auto-renew-status`),getAgentCerts:()=>L(`/api/certs/agent`),generateAgentCert:e=>X(`/api/certs/agent`,e),revokeAgentCert:e=>Nl(`/api/certs/agent/${encodeURIComponent(e)}`),createEnrollmentToken:e=>X(`/api/certs/agent/enroll`,e),revokeEnrollmentToken:e=>Nl(`/api/certs/agent/enroll/${encodeURIComponent(e)}`),updateAgentCapabilities:(e,t)=>Ml(`/api/certs/agent/${encodeURIComponent(e)}/capabilities`,{capabilities:t}),updateAgentAllowedSites:(e,t)=>Ml(`/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:()=>L(`/api/services`),serviceAction:(e,t)=>X(`/api/services/${encodeURIComponent(e)}/${encodeURIComponent(t)}`),getSystemStats:()=>L(`/api/system/stats`),triggerPanelUpdate:e=>X(`/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:()=>L(`/api/tickets/scopes`),createTicketScope:e=>X(`/api/tickets/scopes`,e),deleteTicketScope:e=>Nl(`/api/tickets/scopes/${encodeURIComponent(e)}`),getTicketInstances:()=>L(`/api/tickets/instances`),deleteTicketInstance:e=>Nl(`/api/tickets/instances/${encodeURIComponent(e)}`),getTicketAssignments:()=>L(`/api/tickets/assignments`),createTicketAssignment:e=>X(`/api/tickets/assignments`,e),deleteTicketAssignment:(e,t)=>Nl(`/api/tickets/assignments/${encodeURIComponent(e)}/${encodeURIComponent(t)}`),getTickets:()=>L(`/api/tickets`),revokeTicket:e=>Nl(`/api/tickets/${encodeURIComponent(e)}`),getTicketSessions:()=>L(`/api/tickets/sessions`),killTicketSession:e=>Nl(`/api/tickets/sessions/${encodeURIComponent(e)}`),getPlugins:()=>L(`/api/plugins`),installPlugin:e=>X(`/api/plugins/install`,{packageName:e}),enablePlugin:e=>X(`/api/plugins/${encodeURIComponent(e)}/enable`),disablePlugin:e=>X(`/api/plugins/${encodeURIComponent(e)}/disable`),uninstallPlugin:(e,t={})=>Nl(`/api/plugins/${encodeURIComponent(e)}${Fl(t)}`),getPluginHosting:e=>L(`/api/plugins/${encodeURIComponent(e)}/hosting`),getPluginHostingEligibility:e=>L(`/api/plugins/${encodeURIComponent(e)}/hosting/eligibility`),setPluginHosting:(e,t)=>X(`/api/plugins/${encodeURIComponent(e)}/hosting`,{agentLabel:t}),clearPluginHosting:(e,t={})=>Nl(`/api/plugins/${encodeURIComponent(e)}/hosting${Fl(t)}`),rotatePluginHostingSecret:e=>X(`/api/plugins/${encodeURIComponent(e)}/hosting/rotate-secret`),getPluginRetainedData:e=>L(`/api/plugins/${encodeURIComponent(e)}/retained-data`),purgePluginRetainedData:(e,t)=>Nl(`/api/plugins/${encodeURIComponent(e)}/retained-data${Pl({agentLabel:t})}`),forgetPluginRetainedData:(e,t)=>Nl(`/api/plugins/${encodeURIComponent(e)}/retained-data${Pl({agentLabel:t,forget:`true`})}`),getPluginSettings:e=>L(`/api/plugins/${encodeURIComponent(e)}/settings`),updatePluginSettings:(e,t)=>jl(`/api/plugins/${encodeURIComponent(e)}/settings`,t),getPluginOperations:e=>L(`/api/plugins/${encodeURIComponent(e)}/operations`),getPluginOperation:(e,t)=>L(`/api/plugins/${encodeURIComponent(e)}/operations/${encodeURIComponent(t)}`),getPluginHooks:e=>L(`/api/plugins/${encodeURIComponent(e)}/hooks`),approvePluginHooks:(e,t,n)=>X(`/api/plugins/${encodeURIComponent(e)}/hooks/approve`,{digest:t,...n?{version:n}:{}}),setPluginHooksAutoApprove:(e,t)=>jl(`/api/plugins/${encodeURIComponent(e)}/hooks/auto-approve`,{enabled:t}),updatePlugin:(e,t)=>X(`/api/plugins/${encodeURIComponent(e)}/update`,t?{version:t}:{}),discardPluginUpdate:e=>Nl(`/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:()=>L(`/api/plugins/push-install/config`),updatePushInstallConfig:e=>Ml(`/api/plugins/push-install/config`,e),getPushInstallPolicies:()=>L(`/api/plugins/push-install/policies`),createPushInstallPolicy:e=>X(`/api/plugins/push-install/policies`,e),deletePushInstallPolicy:e=>Nl(`/api/plugins/push-install/policies/${encodeURIComponent(e)}`),updatePushInstallPolicy:(e,t)=>Ml(`/api/plugins/push-install/policies/${encodeURIComponent(e)}`,t),enablePushInstall:(e,t)=>X(`/api/plugins/push-install/enable/${encodeURIComponent(e)}`,t),disablePushInstall:e=>Nl(`/api/plugins/push-install/enable/${encodeURIComponent(e)}`),pushInstallCommand:(e,t)=>X(`/api/plugins/push-install/${encodeURIComponent(e)}`,t),getPushInstallSessions:()=>L(`/api/plugins/push-install/sessions`),getAuditLog:(e={})=>L(`/api/audit${Pl(e)}`),getNotifications:(e={})=>L(`/api/notifications${Pl(e)}`),markNotificationsRead:e=>X(`/api/notifications/read`,e),registerStorageServer:e=>X(`/api/storage/servers`,e),getStorageServers:()=>L(`/api/storage/servers`),deleteStorageServer:e=>Nl(`/api/storage/servers/${encodeURIComponent(e)}`),createStorageBinding:e=>X(`/api/storage/bindings`,e),getStorageBindings:()=>L(`/api/storage/bindings`),getStorageBinding:e=>L(`/api/storage/bindings/${encodeURIComponent(e)}`),deleteStorageBinding:e=>Nl(`/api/storage/bindings/${encodeURIComponent(e)}`),getIdentitySelf:()=>L(`/api/identity/self`),getIdentityUsers:()=>L(`/api/identity/users`),getIdentityUser:e=>L(`/api/identity/users/${encodeURIComponent(e)}`),getIdentityGroups:()=>L(`/api/identity/groups`),get2faStatus:()=>L(`/api/settings/2fa`),setup2fa:()=>X(`/api/settings/2fa/setup`),confirm2fa:e=>X(`/api/settings/2fa/confirm`,{code:e}),verify2fa:e=>X(`/api/settings/2fa/verify`,{code:e}),disable2fa:e=>X(`/api/settings/2fa/disable`,{code:e}),getAgents:()=>L(`/api/certs/agent`),getUserAccessGrants:()=>L(`/api/user-access/grants`),createUserAccessGrant:e=>X(`/api/user-access/grants`,e),revokeUserAccessGrant:e=>Nl(`/api/user-access/grants/${encodeURIComponent(e)}`),getTunnels:()=>L(`/api/tunnels`),createTunnel:e=>X(`/api/tunnels`,e),updateTunnel:(e,t)=>Ml(`/api/tunnels/${encodeURIComponent(e)}`,t),deleteTunnel:e=>Nl(`/api/tunnels/${encodeURIComponent(e)}`),getTunnelAgentConfig:()=>L(`/api/tunnels/agent-config`)};function Ll({to:e,icon:t,label:n,offline:r=null,onClick:i}){return(0,N.jsxs)(Ft,{to:e,end:e===`/`,onClick:i,title:r??void 0,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,N.jsx)(t,{className:`h-5 w-5`}),n,r&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`span`,{className:`ml-auto h-1.5 w-1.5 shrink-0 rounded-full bg-red-500`,"aria-hidden":`true`}),(0,N.jsxs)(`span`,{className:`sr-only`,children:[`(offline: `,r,`)`]})]})]})}var Rl=`4.4.0`,zl={activity:ni,"bar-chart-3":oi,"book-open":ci,box:B,cpu:Si,database:Ci,"file-text":ki,folder:Ni,"git-branch":Pi,globe:Fi,"hard-drive":Ii,heart:Li,layers:Hi,"layout-dashboard":Ui,list:Ki,map:Ji,package:Qi,server:ua,settings:fa,shield:ha,"shield-check":ma,terminal:va,ticket:ya,truck:Sa,users:Ea,wifi:Oa,zap:Aa};function Bl(e){return e&&Object.hasOwn(zl,e)&&zl[e]||Qi}var Vl=[{type:`link`,to:`/`,icon:Ui,label:`Dashboard`},{type:`link`,to:`/tunnels`,icon:Fi,label:`Tunnels`},{type:`link`,to:`/sites`,icon:ki,label:`Static Sites`},{type:`link`,to:`/users`,icon:Ea,label:`Users`},{type:`link`,to:`/certificates`,icon:ma,label:`Certificates`},{type:`link`,to:`/services`,icon:ua,label:`Services`},{type:`link`,to:`/tickets`,icon:ya,label:`Tickets`},{type:`link`,to:`/plugins`,icon:Qi,label:`Plugins`},{type:`link`,to:`/storage`,icon:Ii,label:`Storage`},{type:`link`,to:`/audit`,icon:ca,label:`Audit`},{type:`link`,to:`/settings`,icon:fa,label:`Settings`},{type:`link`,to:`/docs`,icon:ci,label:`Documentation`}];function Hl({onLinkClick:e}){let t=R(),n=F({queryKey:[`plugins`],queryFn:()=>t.getPlugins(),select:e=>(e.plugins||[]).filter(e=>e.status===`enabled`&&(e.panel?.label||e.panel?.pages?.length)),refetchInterval:3e4,staleTime:15e3}),r=n.data,i=e=>{let t=e.hosting===`agent`?yr(e.agentHosting):null;return t?xr(t,n.dataUpdatedAt):null},a=(r||[]).flatMap(e=>{let t=i(e);return e.panel?.pages?.length?[{type:`section-header`,label:e.displayName||e.name,key:`section-${e.name}`},...e.panel.pages.map(n=>({type:`link`,to:`/plugins/${e.name}${n.path}`,icon:Bl(n.icon),label:n.title,offline:t}))]:e.panel?.label?[{type:`link`,to:`/plugins/${e.name}`,icon:Bl(e.panel?.icon),label:e.panel.label,offline:t}]:[]}),o=[...Vl,...a];return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(`div`,{className:`border-b border-zinc-800 px-4 py-5`,children:(0,N.jsx)(`span`,{className:`font-mono text-lg font-bold text-cyan-400`,children:`Lamaste`})}),(0,N.jsx)(`nav`,{className:`flex-1 space-y-1 px-2 py-4`,children:o.map(t=>t.type===`section-header`?(0,N.jsx)(`div`,{className:`px-3 pt-4 pb-1`,children:(0,N.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-zinc-600`,children:t.label})},t.key):(0,N.jsx)(Ll,{to:t.to,icon:t.icon,label:t.label,offline:t.offline??null,onClick:e},t.to))}),(0,N.jsx)(`div`,{className:`border-t border-zinc-800 px-4 py-3`,children:(0,N.jsxs)(`span`,{className:`font-mono text-xs text-zinc-600`,children:[`v`,Rl]})})]})}function Ul(){let[e,t]=(0,g.useState)(!1),n=()=>t(!1);return(0,N.jsxs)(N.Fragment,{children:[(0,N.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,N.jsx)(Yi,{className:`h-5 w-5`})}),e&&(0,N.jsxs)(`div`,{className:`fixed inset-0 z-50 lg:hidden`,children:[(0,N.jsx)(`div`,{className:`fixed inset-0 bg-black/50`,onClick:n}),(0,N.jsxs)(`div`,{className:`relative flex h-screen w-64 flex-col bg-zinc-900`,children:[(0,N.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,N.jsx)(ka,{className:`h-5 w-5`})}),(0,N.jsx)(Hl,{onLinkClick:n})]})]}),(0,N.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,N.jsx)(Hl,{})})]})}function Wl(){return(0,N.jsxs)(`div`,{className:`flex min-h-screen`,children:[(0,N.jsx)(Ul,{}),(0,N.jsx)(`main`,{className:`flex-1 overflow-y-auto bg-zinc-950 p-6 lg:p-8`,children:(0,N.jsx)(gt,{})})]})}function Gl(){return(0,N.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-zinc-950`,children:(0,N.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,N.jsx)(`div`,{className:`h-8 w-8 animate-spin rounded-full border-2 border-zinc-700 border-t-cyan-400`}),(0,N.jsx)(`p`,{className:`mt-4 text-sm text-zinc-500`,children:`Connecting to panel server...`})]})})}function Kl({onRetry:e}){return(0,N.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-zinc-950`,children:(0,N.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,N.jsx)(hi,{className:`mb-4 h-12 w-12 text-red-400`}),(0,N.jsx)(`h1`,{className:`mb-2 font-mono text-xl font-bold text-zinc-100`,children:`Unable to connect`}),(0,N.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,N.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 ql=/^(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,Jl=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function Yl({domain:e,onComplete:t}){let[n,r]=(0,g.useState)(e??``),[i,a]=(0,g.useState)(``),[o,s]=(0,g.useState)({}),c=P(),l=I({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 ql.test(n)||(e.domain=`Enter a valid domain name (e.g. example.com)`),Jl.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,N.jsxs)(`div`,{children:[(0,N.jsx)(`h2`,{className:`mb-2 text-xl font-semibold text-white`,children:`Configure your domain`}),(0,N.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,N.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,N.jsxs)(`form`,{onSubmit:d,className:`space-y-5`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`label`,{htmlFor:`domain`,className:`mb-1.5 block text-sm font-medium text-zinc-300`,children:`Domain`}),(0,N.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,N.jsx)(`p`,{className:`mt-1 text-xs text-red-400`,children:o.domain})]}),(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`label`,{htmlFor:`email`,className:`mb-1.5 block text-sm font-medium text-zinc-300`,children:`Email`}),(0,N.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,N.jsx)(`p`,{className:`mt-1 text-xs text-zinc-500`,children:`Used for Let's Encrypt certificate registration`}),o.email&&(0,N.jsx)(`p`,{className:`mt-1 text-xs text-red-400`,children:o.email})]}),(0,N.jsx)(`div`,{className:`flex justify-end pt-2`,children:(0,N.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,N.jsx)(V,{size:16,className:`animate-spin`}),l.isPending?`Saving...`:`Save & Continue`]})})]})]})}function Xl({text:e}){let[t,n]=(0,g.useState)(!1);function r(){navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),2e3)})}return(0,N.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,N.jsx)(xi,{size:14}),t&&(0,N.jsx)(`span`,{className:`ml-1 text-xs text-green-400`,children:`Copied`})]})}function Zl({type:e,name:t,value:n}){return(0,N.jsxs)(`tr`,{className:`border-b border-zinc-700 last:border-b-0`,children:[(0,N.jsx)(`td`,{className:`px-3 py-2.5 font-mono text-sm text-cyan-400`,children:e}),(0,N.jsx)(`td`,{className:`px-3 py-2.5 font-mono text-sm text-zinc-300`,children:t}),(0,N.jsx)(`td`,{className:`px-3 py-2.5 font-mono text-sm text-zinc-300`,children:(0,N.jsxs)(`span`,{className:`inline-flex items-center`,children:[n,(0,N.jsx)(Xl,{text:n})]})})]})}function Ql({name:e,ok:t,resolvedIps:n,expectedIp:r}){return(0,N.jsxs)(`div`,{className:`flex items-start gap-2`,children:[t?(0,N.jsx)(_i,{size:18,className:`mt-0.5 shrink-0 text-green-400`}):(0,N.jsx)(vi,{size:18,className:`mt-0.5 shrink-0 text-red-400`}),(0,N.jsxs)(`div`,{className:`text-sm`,children:[(0,N.jsx)(`span`,{className:t?`text-green-400`:`text-red-400`,children:e}),t?(0,N.jsxs)(`span`,{className:`text-zinc-400`,children:[` resolves to `,r]}):n.length>0?(0,N.jsxs)(`span`,{className:`text-zinc-400`,children:[` `,`resolves to `,n.join(`, `),` (expected `,r,`)`]}):(0,N.jsx)(`span`,{className:`text-zinc-400`,children:` does not resolve`})]})]})}function $l({name:e,ok:t,expectedIp:n,missingText:r}){return(0,N.jsxs)(`div`,{className:`flex items-start gap-2`,children:[t?(0,N.jsx)(_i,{size:18,className:`mt-0.5 shrink-0 text-green-400`}):(0,N.jsx)(xa,{size:18,className:`mt-0.5 shrink-0 text-yellow-400`}),(0,N.jsxs)(`div`,{className:`text-sm`,children:[(0,N.jsx)(`span`,{className:t?`text-green-400`:`text-yellow-400`,children:e}),t?(0,N.jsxs)(`span`,{className:`text-zinc-400`,children:[` resolves to `,n]}):(0,N.jsxs)(`span`,{className:`text-zinc-400`,children:[` `,r]})]})]})}function eu({result:e}){return e?(0,N.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,N.jsx)(Ql,{name:t.name,ok:t.ok,resolvedIps:t.resolvedIps,expectedIp:e.expectedIp},t.name)),(0,N.jsx)($l,{name:`*.${e.domain}`,ok:e.wildcardOk,expectedIp:e.expectedIp,missingText:`not configured — you can add individual subdomain records later`}),(0,N.jsx)($l,{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,N.jsx)(`p`,{className:`text-sm text-zinc-400`,children:e.message})]}):null}function tu({domain:e,ip:t,onComplete:n,onBack:r}){let[i,a]=(0,g.useState)(null),o=P(),s=I({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,N.jsxs)(`div`,{children:[(0,N.jsx)(`h2`,{className:`mb-2 text-xl font-semibold text-white`,children:`Configure DNS records`}),(0,N.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,N.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,N.jsx)(`div`,{className:`overflow-hidden rounded-md border border-zinc-700`,children:(0,N.jsxs)(`table`,{className:`w-full text-left`,children:[(0,N.jsx)(`thead`,{children:(0,N.jsxs)(`tr`,{className:`border-b border-zinc-700 bg-zinc-800/50`,children:[(0,N.jsx)(`th`,{className:`px-3 py-2 text-xs font-medium uppercase tracking-wider text-zinc-500`,children:`Type`}),(0,N.jsx)(`th`,{className:`px-3 py-2 text-xs font-medium uppercase tracking-wider text-zinc-500`,children:`Name`}),(0,N.jsx)(`th`,{className:`px-3 py-2 text-xs font-medium uppercase tracking-wider text-zinc-500`,children:`Value`})]})}),(0,N.jsxs)(`tbody`,{className:`bg-zinc-900`,children:[(0,N.jsx)(Zl,{type:`A`,name:`*.${e}`,value:t}),(0,N.jsx)(Zl,{type:`A`,name:e,value:t})]})]})}),(0,N.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,N.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,N.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,N.jsx)(eu,{result:i}),(0,N.jsxs)(`div`,{className:`mt-6 flex items-center justify-between`,children:[(0,N.jsx)(`button`,{type:`button`,onClick:r,className:`text-sm text-zinc-400 transition-colors hover:text-zinc-200`,children:`Back`}),(0,N.jsxs)(`div`,{className:`flex gap-3`,children:[(0,N.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,N.jsx)(V,{size:16,className:`animate-spin`}),s.isPending?`Verifying...`:`Verify DNS`]}),i?.ok&&(0,N.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 nu=1e4;function ru(){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,nu);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 iu({status:e}){switch(e){case`done`:return(0,N.jsx)(_i,{size:18,className:`shrink-0 text-green-400`});case`error`:return(0,N.jsx)(vi,{size:18,className:`shrink-0 text-red-400`});case`running`:return(0,N.jsx)(V,{size:18,className:`shrink-0 animate-spin text-cyan-400`});default:return(0,N.jsx)(yi,{size:18,className:`shrink-0 text-zinc-600`})}}function au({task:e,isLast:t}){let n=e.status===`pending`?`text-zinc-500`:`text-white`;return(0,N.jsxs)(`div`,{className:`flex gap-3`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,N.jsx)(iu,{status:e.status}),!t&&(0,N.jsx)(`div`,{className:`mt-1 w-px flex-1 bg-zinc-700`})]}),(0,N.jsxs)(`div`,{className:`pb-4`,children:[(0,N.jsx)(`p`,{className:`text-sm font-medium ${n}`,children:e.title}),e.message&&e.status!==`pending`&&(0,N.jsx)(`p`,{className:`mt-0.5 text-xs text-zinc-400`,children:e.message})]})]})}function ou({onComplete:e}){let{tasks:t,isComplete:n,isError:r,error:i,result:a,progress:o,logs:s,retry:c}=ru(),[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,N.jsxs)(`div`,{children:[(0,N.jsx)(`h2`,{className:`mb-2 text-xl font-semibold text-white`,children:`Setting up your Lamaste`}),(0,N.jsx)(`div`,{className:`mb-5 rounded-md border border-amber-700 bg-amber-900/30 px-4 py-3`,children:(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(xa,{size:16,className:`shrink-0 text-amber-300`}),(0,N.jsx)(`p`,{className:`text-sm text-amber-300`,children:`Do not close this page while provisioning is in progress`})]})}),(0,N.jsx)(`div`,{className:`mb-4`,children:t.map((e,n)=>(0,N.jsx)(au,{task:e,isLast:n===t.length-1},e.id))}),(0,N.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,N.jsx)(`p`,{className:`italic text-zinc-600`,children:`Waiting for provisioning to start...`}):s.map((e,t)=>(0,N.jsx)(`p`,{className:`leading-relaxed`,children:e},t))}),o.total>0&&(0,N.jsxs)(`p`,{className:`mb-4 text-sm text-zinc-500`,children:[`Step `,o.current,` of `,o.total]}),r&&i&&(0,N.jsxs)(`div`,{className:`mb-4 rounded-md border border-red-700 bg-red-900/30 px-4 py-3`,children:[(0,N.jsx)(`p`,{className:`text-sm font-medium text-red-300`,children:`Provisioning failed`}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-red-400`,children:i.message}),(0,N.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,N.jsx)(V,{size:16,className:`animate-spin`}),d?`Retrying...`:`Retry`]})]}),n&&(0,N.jsx)(`div`,{className:`text-center`,children:(0,N.jsx)(`p`,{className:`text-sm text-green-400`,children:`Provisioning complete. Continuing...`})})]})}function su({text:e}){let[t,n]=(0,g.useState)(!1);function r(){navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),2e3)})}return(0,N.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,N.jsx)(xi,{size:14}),t&&(0,N.jsx)(`span`,{className:`ml-1 text-xs text-green-400`,children:`Copied`})]})}function cu(e){try{let t=new URL(e);if(t.protocol===`https:`)return t.href}catch{}return``}function lu({result:e,ip:t}){let[n,r]=(0,g.useState)(!1),i=e?.adminUsername||`admin`,a=e?.adminPassword||``,o=cu(e?.panelUrl||``),s=cu(e?.authUrl||``),c=`https://${t}:9292`;return(0,N.jsxs)(`div`,{className:`animate-fade-in`,children:[(0,N.jsxs)(`div`,{className:`mb-6 text-center`,children:[(0,N.jsx)(ma,{size:48,className:`mx-auto mb-3 text-green-400`}),(0,N.jsx)(`h2`,{className:`text-2xl font-bold text-white`,children:`Lamaste is ready!`}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-zinc-400`,children:`Your stack is fully configured and operational.`})]}),(0,N.jsxs)(`div`,{className:`mb-5 rounded-lg border border-zinc-700 bg-zinc-800 p-6`,children:[(0,N.jsx)(`h3`,{className:`mb-1 font-semibold text-white`,children:`Admin Credentials`}),(0,N.jsx)(`p`,{className:`mb-4 text-sm text-amber-400`,children:`Save these credentials — they won't be shown again.`}),(0,N.jsxs)(`div`,{className:`space-y-3`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,N.jsx)(`span`,{className:`text-sm text-zinc-400`,children:`Username`}),(0,N.jsxs)(`span`,{className:`inline-flex items-center font-mono text-sm text-white`,children:[i,(0,N.jsx)(su,{text:i})]})]}),(0,N.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,N.jsx)(`span`,{className:`text-sm text-zinc-400`,children:`Password`}),(0,N.jsxs)(`span`,{className:`inline-flex items-center font-mono text-sm text-white`,children:[n?a:`•`.repeat(16),(0,N.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,N.jsx)(Di,{size:14}):(0,N.jsx)(Oi,{size:14})}),(0,N.jsx)(su,{text:a})]})]})]})]}),(0,N.jsxs)(`div`,{className:`mb-5 space-y-2`,children:[(0,N.jsx)(`h3`,{className:`text-sm font-semibold text-zinc-300`,children:`Access URLs`}),(0,N.jsxs)(`div`,{className:`flex items-center justify-between rounded border border-zinc-700 bg-zinc-900 px-3 py-2`,children:[(0,N.jsx)(`span`,{className:`text-sm text-zinc-400`,children:`Panel`}),(0,N.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,N.jsx)(Ei,{size:12})]})]}),(0,N.jsxs)(`div`,{className:`flex items-center justify-between rounded border border-zinc-700 bg-zinc-900 px-3 py-2`,children:[(0,N.jsx)(`span`,{className:`text-sm text-zinc-400`,children:`Auth Portal`}),(0,N.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,N.jsx)(Ei,{size:12})]})]}),(0,N.jsxs)(`div`,{className:`flex items-center justify-between rounded border border-zinc-700 bg-zinc-900 px-3 py-2`,children:[(0,N.jsx)(`span`,{className:`text-sm text-zinc-400`,children:`IP Access`}),(0,N.jsxs)(`span`,{className:`text-sm text-zinc-400`,children:[c,` `,(0,N.jsx)(`span`,{className:`text-xs text-zinc-500`,children:`(requires client certificate)`})]})]})]}),(0,N.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,N.jsx)(`div`,{className:`flex justify-center`,children:(0,N.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 uu=4;function du(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 fu({current:e}){return(0,N.jsxs)(`div`,{className:`mb-6 flex items-center gap-3`,children:[(0,N.jsxs)(`span`,{className:`text-sm text-zinc-400`,children:[`Step `,e,` of `,uu]}),(0,N.jsx)(`div`,{className:`flex gap-1.5`,children:Array.from({length:uu},(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,N.jsx)(`div`,{className:i},r)})})]})}function pu(){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=du(e),d=o!==null&&o<u?o:u;if(r)return(0,N.jsx)(Gl,{});if(i)return(0,N.jsx)(Kl,{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,N.jsx)(Yl,{domain:t,onComplete:f}):d===2?_=(0,N.jsx)(tu,{domain:t,ip:n,onComplete:p,onBack:m}):d===3?_=(0,N.jsx)(ou,{onComplete:h}):d===4&&(_=(0,N.jsx)(lu,{result:c,ip:n})),(0,N.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-zinc-950`,children:(0,N.jsxs)(`div`,{className:`mx-4 w-full max-w-xl rounded-lg border border-zinc-800 bg-zinc-900 p-8`,children:[(0,N.jsx)(`h1`,{className:`mb-2 font-mono text-2xl font-bold text-cyan-400`,children:`Lamaste`}),(0,N.jsx)(fu,{current:d}),_]})})}function mu(){let{pluginName:e,"*":t}=Xe();return(0,N.jsx)(lo,{pluginName:e,subPath:t||``,basePath:`/plugins/${e}`,panelUrl:window.location.origin})}function hu(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var gu=hu();function _u(e){gu=e}var vu={exec:()=>null};function Z(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(bu.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var yu=(()=>{try{return!0}catch{return!1}})(),bu={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)}}>`)},xu=/^(?:[ \t]*(?:\n|$))+/,Su=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Cu=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,wu=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Tu=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Eu=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Du=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Ou=Z(Du).replace(/bull/g,Eu).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(),ku=Z(Du).replace(/bull/g,Eu).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(),Au=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,ju=/^[^\n]+/,Mu=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Nu=Z(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,Mu).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Pu=Z(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Eu).getRegex(),Fu=`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`,Iu=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Lu=Z(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,Iu).replace(`tag`,Fu).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ru=Z(Au).replace(`hr`,wu).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`,Fu).getRegex(),zu={blockquote:Z(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,Ru).getRegex(),code:Su,def:Nu,fences:Cu,heading:Tu,hr:wu,html:Lu,lheading:Ou,list:Pu,newline:xu,paragraph:Ru,table:vu,text:ju},Bu=Z(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,wu).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`,Fu).getRegex(),Vu={...zu,lheading:ku,table:Bu,paragraph:Z(Au).replace(`hr`,wu).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,Bu).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`,Fu).getRegex()},Hu={...zu,html:Z(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,Iu).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:vu,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Z(Au).replace(`hr`,wu).replace(`heading`,` *#{1,6} *[^
|
|
16
|
+
]`).replace(`lheading`,Ou).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},Uu=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Wu=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Gu=/^( {2,}|\\)\n(?!\s*$)/,Ku=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,qu=/[\p{P}\p{S}]/u,Ju=/[\s\p{P}\p{S}]/u,Yu=/[^\s\p{P}\p{S}]/u,Xu=Z(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,Ju).getRegex(),Zu=/(?!~)[\p{P}\p{S}]/u,Qu=/(?!~)[\s\p{P}\p{S}]/u,$u=/(?:[^\s\p{P}\p{S}]|~)/u,ed=Z(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,yu?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),td=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,nd=Z(td,`u`).replace(/punct/g,qu).getRegex(),rd=Z(td,`u`).replace(/punct/g,Zu).getRegex(),id=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,ad=Z(id,`gu`).replace(/notPunctSpace/g,Yu).replace(/punctSpace/g,Ju).replace(/punct/g,qu).getRegex(),od=Z(id,`gu`).replace(/notPunctSpace/g,$u).replace(/punctSpace/g,Qu).replace(/punct/g,Zu).getRegex(),sd=Z(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,Yu).replace(/punctSpace/g,Ju).replace(/punct/g,qu).getRegex(),cd=Z(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,qu).getRegex(),ld=Z(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Yu).replace(/punctSpace/g,Ju).replace(/punct/g,qu).getRegex(),ud=Z(/\\(punct)/,`gu`).replace(/punct/g,qu).getRegex(),dd=Z(/^<(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(),fd=Z(Iu).replace(`(?:-->|$)`,`-->`).getRegex(),pd=Z(`^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`,fd).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),md=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,hd=Z(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,md).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),gd=Z(/^!?\[(label)\]\[(ref)\]/).replace(`label`,md).replace(`ref`,Mu).getRegex(),_d=Z(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,Mu).getRegex(),vd=Z(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,gd).replace(`nolink`,_d).getRegex(),yd=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,bd={_backpedal:vu,anyPunctuation:ud,autolink:dd,blockSkip:ed,br:Gu,code:Wu,del:vu,delLDelim:vu,delRDelim:vu,emStrongLDelim:nd,emStrongRDelimAst:ad,emStrongRDelimUnd:sd,escape:Uu,link:hd,nolink:_d,punctuation:Xu,reflink:gd,reflinkSearch:vd,tag:pd,text:Ku,url:vu},xd={...bd,link:Z(/^!?\[(label)\]\((.*?)\)/).replace(`label`,md).getRegex(),reflink:Z(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,md).getRegex()},Sd={...bd,emStrongRDelimAst:od,emStrongLDelim:rd,delLDelim:cd,delRDelim:ld,url:Z(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,yd).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:Z(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,yd).getRegex()},Cd={...Sd,br:Z(Gu).replace(`{2,}`,`*`).getRegex(),text:Z(Sd.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},wd={normal:zu,gfm:Vu,pedantic:Hu},Td={normal:bd,gfm:Sd,breaks:Cd,pedantic:xd},Ed={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},Dd=e=>Ed[e];function Od(e,t){if(t){if(bu.escapeTest.test(e))return e.replace(bu.escapeReplace,Dd)}else if(bu.escapeTestNoEncode.test(e))return e.replace(bu.escapeReplaceNoEncode,Dd);return e}function kd(e){try{e=encodeURI(e).replace(bu.percentDecode,`%`)}catch{return null}return e}function Ad(e,t){let n=e.replace(bu.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(bu.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(bu.slashPipe,`|`);return n}function jd(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 Md(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 Nd(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 Pd(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 Fd(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 Id=class{options;rules;lexer;constructor(e){this.options=e||gu}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:jd(e,`
|
|
19
|
+
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=Fd(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=jd(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:jd(t[0],`
|
|
20
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=jd(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=Nd(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=Ad(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(Ad(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=jd(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=Md(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)),Pd(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 Pd(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}}}},Ld=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||gu,this.options.tokenizer=this.options.tokenizer||new Id,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:bu,block:wd.normal,inline:Td.normal};this.options.pedantic?(t.block=wd.pedantic,t.inline=Td.pedantic):this.options.gfm&&(t.block=wd.gfm,this.options.breaks?t.inline=Td.breaks:t.inline=Td.gfm),this.tokenizer.rules=t}static get rules(){return{block:wd,inline:Td}}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(bu.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(bu.tabCharGlobal,` `).replace(bu.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}},Rd=class{options;parser;constructor(e){this.options=e||gu}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(bu.notSpaceStart)?.[0],i=e.replace(bu.endingNewline,``)+`
|
|
55
|
+
`;return r?`<pre><code class="language-`+Od(r)+`">`+(n?i:Od(i,!0))+`</code></pre>
|
|
56
|
+
`:`<pre><code>`+(n?i:Od(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>${Od(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=kd(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+Od(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=kd(e);if(i===null)return Od(n);e=i;let a=`<img src="${e}" alt="${Od(n)}"`;return t&&(a+=` title="${Od(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:Od(e.text)}},zd=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}},Bd=class e{options;renderer;textRenderer;constructor(e){this.options=e||gu,this.options.renderer=this.options.renderer||new Rd,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new zd}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}},Vd=class{options;block;constructor(e){this.options=e||gu}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?Ld.lex:Ld.lexInline}provideParser(e=this.block){return e?Bd.parse:Bd.parseInline}},Hd=new class{defaults=hu();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Bd;Renderer=Rd;TextRenderer=zd;Lexer=Ld;Tokenizer=Id;Hooks=Vd;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 Rd(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 Id(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 Vd;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];Vd.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&Vd.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 Ld.lex(e,t??this.defaults)}parser(e,t){return Bd.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?Ld.lex:Ld.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?Bd.parse:Bd.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?Ld.lex:Ld.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?Bd.parse:Bd.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>`+Od(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function Q(e,t){return Hd.parse(e,t)}Q.options=Q.setOptions=function(e){return Hd.setOptions(e),Q.defaults=Hd.defaults,_u(Q.defaults),Q},Q.getDefaults=hu,Q.defaults=gu,Q.use=function(...e){return Hd.use(...e),Q.defaults=Hd.defaults,_u(Q.defaults),Q},Q.walkTokens=function(e,t){return Hd.walkTokens(e,t)},Q.parseInline=Hd.parseInline,Q.Parser=Bd,Q.parser=Bd.parse,Q.Renderer=Rd,Q.TextRenderer=zd,Q.Lexer=Ld,Q.lexer=Ld.lex,Q.Tokenizer=Id,Q.Hooks=Vd,Q.parse=Q,Q.options,Q.setOptions,Q.use,Q.walkTokens,Q.parseInline,Bd.parse,Ld.lex;var{entries:Ud,setPrototypeOf:Wd,isFrozen:Gd,getPrototypeOf:Kd,getOwnPropertyDescriptor:qd}=Object,{freeze:Jd,seal:Yd,create:Xd}=Object,{apply:Zd,construct:Qd}=typeof Reflect<`u`&&Reflect;Jd||=function(e){return e},Yd||=function(e){return e},Zd||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},Qd||=function(e){return new e(...[...arguments].slice(1))};var $d=bf(Array.prototype.forEach),ef=bf(Array.prototype.lastIndexOf),tf=bf(Array.prototype.pop),nf=bf(Array.prototype.push),rf=bf(Array.prototype.splice),af=Array.isArray,of=bf(String.prototype.toLowerCase),sf=bf(String.prototype.toString),cf=bf(String.prototype.match),lf=bf(String.prototype.replace),uf=bf(String.prototype.indexOf),df=bf(String.prototype.trim),ff=bf(Number.prototype.toString),pf=bf(Boolean.prototype.toString),mf=typeof BigInt>`u`?null:bf(BigInt.prototype.toString),hf=typeof Symbol>`u`?null:bf(Symbol.prototype.toString),gf=bf(Object.prototype.hasOwnProperty),_f=bf(Object.prototype.toString),vf=bf(RegExp.prototype.test),yf=xf(TypeError);function bf(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return Zd(e,t,n)}}function xf(e){return function(){return Qd(e,[...arguments])}}function $(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:of;if(Wd&&Wd(e,null),!af(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(Gd(t)||(t[r]=e),i=e)}e[i]=!0}return e}function Sf(e){for(let t=0;t<e.length;t++)gf(e,t)||(e[t]=null);return e}function Cf(e){let t=Xd(null);for(let[n,r]of Ud(e))gf(e,n)&&(af(r)?t[n]=Sf(r):r&&typeof r==`object`&&r.constructor===Object?t[n]=Cf(r):t[n]=r);return t}function wf(e){switch(typeof e){case`string`:return e;case`number`:return ff(e);case`boolean`:return pf(e);case`bigint`:return mf?mf(e):`0`;case`symbol`:return hf?hf(e):`Symbol()`;case`undefined`:return _f(e);case`function`:case`object`:{if(e===null)return _f(e);let t=e,n=Tf(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:_f(e)}return _f(e)}default:return _f(e)}}function Tf(e,t){for(;e!==null;){let n=qd(e,t);if(n){if(n.get)return bf(n.get);if(typeof n.value==`function`)return bf(n.value)}e=Kd(e)}function n(){return null}return n}function Ef(e){try{return vf(e,``),!0}catch{return!1}}var Df=Jd(`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(`.`)),Of=Jd(`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(`.`)),kf=Jd([`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`]),Af=Jd([`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`]),jf=Jd(`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(`.`)),Mf=Jd([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),Nf=Jd([`#text`]),Pf=Jd(`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(`.`)),Ff=Jd(`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(`.`)),If=Jd(`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(`.`)),Lf=Jd([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),Rf=Yd(/\{\{[\w\W]*|[\w\W]*\}\}/gm),zf=Yd(/<%[\w\W]*|[\w\W]*%>/gm),Bf=Yd(/\$\{[\w\W]*/gm),Vf=Yd(/^data-[\-\w.\u00B7-\uFFFF]+$/),Hf=Yd(/^aria-[\-\w]+$/),Uf=Yd(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Wf=Yd(/^(?:\w+script|data):/i),Gf=Yd(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Kf=Yd(/^html$/i),qf=Yd(/^[a-z][.\w]*(-[.\w]+)+$/i),Jf=Object.freeze({__proto__:null,ARIA_ATTR:Hf,ATTR_WHITESPACE:Gf,CUSTOM_ELEMENT:qf,DATA_ATTR:Vf,DOCTYPE_NAME:Kf,ERB_EXPR:zf,IS_ALLOWED_URI:Uf,IS_SCRIPT_OR_DATA:Wf,MUSTACHE_EXPR:Rf,TMPLIT_EXPR:Bf}),Yf={element:1,text:3,progressingInstruction:7,comment:8,document:9},Xf=function(){return typeof window>`u`?null:window},Zf=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}},Qf=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function $f(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Xf(),t=e=>$f(e);if(t.version=`3.4.2`,t.removed=[],!e||!e.document||e.document.nodeType!==Yf.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=Tf(m,`cloneNode`),g=Tf(m,`remove`),_=Tf(m,`nextSibling`),v=Tf(m,`childNodes`),y=Tf(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=Qf();t.isSupported=typeof Ud==`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}=Jf,{IS_ALLOWED_URI:ce}=Jf,le=null,ue=$({},[...Df,...Of,...kf,...jf,...Nf]),O=null,de=$({},[...Pf,...Ff,...If,...Lf]),k=Object.seal(Xd(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(Xd(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],sf),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=Cf(e),Ye=Xe.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,A=Ye===`application/xhtml+xml`?sf:of,le=gf(e,`ALLOWED_TAGS`)&&af(e.ALLOWED_TAGS)?$({},e.ALLOWED_TAGS,A):ue,O=gf(e,`ALLOWED_ATTR`)&&af(e.ALLOWED_ATTR)?$({},e.ALLOWED_ATTR,A):de,We=gf(e,`ALLOWED_NAMESPACES`)&&af(e.ALLOWED_NAMESPACES)?$({},e.ALLOWED_NAMESPACES,sf):Ge,Le=gf(e,`ADD_URI_SAFE_ATTR`)&&af(e.ADD_URI_SAFE_ATTR)?$(Cf(Re),e.ADD_URI_SAFE_ATTR,A):Re,Fe=gf(e,`ADD_DATA_URI_TAGS`)&&af(e.ADD_DATA_URI_TAGS)?$(Cf(Ie),e.ADD_DATA_URI_TAGS,A):Ie,Ne=gf(e,`FORBID_CONTENTS`)&&af(e.FORBID_CONTENTS)?$({},e.FORBID_CONTENTS,A):Pe,fe=gf(e,`FORBID_TAGS`)&&af(e.FORBID_TAGS)?$({},e.FORBID_TAGS,A):Cf({}),pe=gf(e,`FORBID_ATTR`)&&af(e.FORBID_ATTR)?$({},e.FORBID_ATTR,A):Cf({}),Me=gf(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?Cf(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=Ef(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:Uf,He=typeof e.NAMESPACE==`string`?e.NAMESPACE:Ve,Ke=gf(e,`MATHML_TEXT_INTEGRATION_POINTS`)&&e.MATHML_TEXT_INTEGRATION_POINTS&&typeof e.MATHML_TEXT_INTEGRATION_POINTS==`object`?Cf(e.MATHML_TEXT_INTEGRATION_POINTS):$({},[`mi`,`mo`,`mn`,`ms`,`mtext`]),qe=gf(e,`HTML_INTEGRATION_POINTS`)&&e.HTML_INTEGRATION_POINTS&&typeof e.HTML_INTEGRATION_POINTS==`object`?Cf(e.HTML_INTEGRATION_POINTS):$({},[`annotation-xml`]);let t=gf(e,`CUSTOM_ELEMENT_HANDLING`)&&e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING==`object`?Cf(e.CUSTOM_ELEMENT_HANDLING):Xd(null);if(k=Xd(null),gf(t,`tagNameCheck`)&&$e(t.tagNameCheck)&&(k.tagNameCheck=t.tagNameCheck),gf(t,`attributeNameCheck`)&&$e(t.attributeNameCheck)&&(k.attributeNameCheck=t.attributeNameCheck),gf(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(k.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),ye&&(ge=!1),Te&&(we=!0),Me&&(le=$({},Nf),O=Xd(null),Me.html===!0&&($(le,Df),$(O,Pf)),Me.svg===!0&&($(le,Of),$(O,Ff),$(O,Lf)),Me.svgFilters===!0&&($(le,kf),$(O,Ff),$(O,Lf)),Me.mathMl===!0&&($(le,jf),$(O,If),$(O,Lf))),me.tagCheck=null,me.attributeCheck=null,gf(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?me.tagCheck=e.ADD_TAGS:af(e.ADD_TAGS)&&(le===ue&&(le=Cf(le)),$(le,e.ADD_TAGS,A))),gf(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?me.attributeCheck=e.ADD_ATTR:af(e.ADD_ATTR)&&(O===de&&(O=Cf(O)),$(O,e.ADD_ATTR,A))),gf(e,`ADD_URI_SAFE_ATTR`)&&af(e.ADD_URI_SAFE_ATTR)&&$(Le,e.ADD_URI_SAFE_ATTR,A),gf(e,`FORBID_CONTENTS`)&&af(e.FORBID_CONTENTS)&&(Ne===Pe&&(Ne=Cf(Ne)),$(Ne,e.FORBID_CONTENTS,A)),gf(e,`ADD_FORBID_CONTENTS`)&&af(e.ADD_FORBID_CONTENTS)&&(Ne===Pe&&(Ne=Cf(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 yf(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw yf(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);b=e.TRUSTED_TYPES_POLICY,x=b.createHTML(``)}else b===void 0&&(b=Zf(p,i)),b!==null&&typeof x==`string`&&(x=b.createHTML(``));Jd&&Jd(e),Ze=e},tt=$({},[...Of,...kf,...Af]),nt=$({},[...jf,...Mf]),rt=function(e){let t=y(e);(!t||!t.tagName)&&(t={namespaceURI:He,tagName:`template`});let n=of(e.tagName),r=of(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){nf(t.removed,{element:e});try{y(e).removeChild(e)}catch{g(e)}},at=function(e,n){try{nf(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch{nf(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=cf(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){$d(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)&&vf(/<[/\w!]/g,e.innerHTML)&&vf(/<[/\w!]/g,e.textContent)||be&&e.namespaceURI===Ve&&r===`style`&<(e.firstElementChild)||e.nodeType===Yf.progressingInstruction||be&&e.nodeType===Yf.comment&&vf(/<[/\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&&vf(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`)&&vf(/<\/no(script|embed|frames)/i,e.innerHTML)?(it(e),!0):(ye&&e.nodeType===Yf.text&&(n=e.textContent,$d([ee,te,ne],e=>{n=lf(n,e,` `)}),e.textContent!==n&&(nf(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]&&vf(re,t))&&!(he&&vf(ie,t))){if(!i||pe[t]){if(!(mt(e)&&(k.tagNameCheck instanceof RegExp&&vf(k.tagNameCheck,e)||k.tagNameCheck instanceof Function&&k.tagNameCheck(e))&&(k.attributeNameCheck instanceof RegExp&&vf(k.attributeNameCheck,t)||k.attributeNameCheck instanceof Function&&k.attributeNameCheck(t,e))||t===`is`&&k.allowCustomizedBuiltInElements&&(k.tagNameCheck instanceof RegExp&&vf(k.tagNameCheck,r)||k.tagNameCheck instanceof Function&&k.tagNameCheck(r))))return!1}else if(!Le[t]&&!vf(ce,lf(r,oe,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&uf(r,`data:`)===0&&Fe[e])&&!(_e&&!vf(ae,lf(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[of(e)]&&vf(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:df(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`)&&uf(u,ke)!==0&&(at(a,e),u=ke+u),be&&vf(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,u)){at(a,e);continue}if(c===`attributename`&&cf(u,`href`)){at(a,e);continue}if(r.forceKeepAttr)continue;if(!r.keepAttr){at(a,e);continue}if(!ve&&vf(/\/>/i,u)){at(a,e);continue}ye&&$d([ee,te,ne],e=>{u=lf(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):tf(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=wf(e),typeof e!=`string`))throw yf(`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 yf(`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===Yf.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;$d([ee,te,ne],t=>{e=lf(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&&vf(Kf,i.ownerDocument.doctype.name)&&(d=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
|
|
74
|
+
`+d),ye&&$d([ee,te,ne],e=>{d=lf(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`&&nf(D[e],t)},t.removeHook=function(e,t){if(t!==void 0){let n=ef(D[e],t);return n===-1?void 0:rf(D[e],n,1)[0]}return tf(D[e])},t.removeHooks=function(e){D[e]=[]},t.removeAllHooks=function(){D=Qf()},t}var ep=$f(),tp=new Q.Renderer;function np(e){let t=e,n;do n=t,t=t.replace(/<[^>]*>/g,``);while(t!==n);return t}tp.heading=({text:e,depth:t})=>`<h${t} id="${np(e).toLowerCase().replace(/[^\w\s-]/g,``).replace(/\s+/g,`-`).replace(/-+/g,`-`).replace(/^-|-$/g,``)}">${e}</h${t}>`,Q.setOptions({renderer:tp});function rp(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=np(n).toLowerCase().replace(/[^\w\s-]/g,``).replace(/\s+/g,`-`).replace(/-+/g,`-`).replace(/^-|-$/g,``);t.push({depth:e,text:n,id:i})}return t}function ip({index:e,currentSlug:t,sidebarOpen:n,onClose:r}){return(0,N.jsxs)(N.Fragment,{children:[n&&(0,N.jsxs)(`div`,{className:`fixed inset-0 z-50 lg:hidden`,children:[(0,N.jsx)(`div`,{className:`fixed inset-0 bg-black/50`,onClick:r}),(0,N.jsxs)(`div`,{className:`relative flex h-screen w-72 flex-col overflow-y-auto bg-zinc-900 border-r border-zinc-800`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between border-b border-zinc-800 px-4 py-4`,children:[(0,N.jsx)(`span`,{className:`text-sm font-semibold text-zinc-300`,children:`Documentation`}),(0,N.jsx)(`button`,{type:`button`,onClick:r,className:`text-zinc-400 hover:text-zinc-100`,children:(0,N.jsx)(ka,{className:`h-4 w-4`})})]}),(0,N.jsx)(ap,{index:e,currentSlug:t,onLinkClick:r})]})]}),(0,N.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,N.jsx)(`div`,{className:`border-b border-zinc-800 px-4 py-4`,children:(0,N.jsxs)(Pt,{to:`/docs`,className:`text-sm font-semibold text-zinc-300 hover:text-cyan-400 flex items-center gap-2`,children:[(0,N.jsx)(ci,{size:14,className:`text-cyan-400`}),`Documentation`]})}),(0,N.jsx)(ap,{index:e,currentSlug:t})]})]})}function ap({index:e,currentSlug:t,onLinkClick:n}){return(0,N.jsx)(`nav`,{className:`flex-1 px-3 py-4 space-y-5`,children:e.sections.map(e=>(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h3`,{className:`px-2 mb-1 text-xs font-semibold uppercase tracking-wider text-zinc-500`,children:e.title}),(0,N.jsx)(`ul`,{className:`space-y-0.5`,children:e.pages.map(e=>(0,N.jsx)(`li`,{children:(0,N.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 op({toc:e,activeId:t}){return e.length===0?null:(0,N.jsxs)(`div`,{className:`sticky top-6 hidden xl:block w-56 flex-shrink-0`,children:[(0,N.jsxs)(`h4`,{className:`mb-3 text-xs font-semibold uppercase tracking-wider text-zinc-500 flex items-center gap-1.5`,children:[(0,N.jsx)(Ki,{size:12}),`On this page`]}),(0,N.jsx)(`ul`,{className:`space-y-1 border-l border-zinc-800`,children:e.map(e=>(0,N.jsx)(`li`,{children:(0,N.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 sp({prevPage:e,nextPage:t}){return!e&&!t?null:(0,N.jsxs)(`div`,{className:`mt-12 flex items-stretch gap-4 border-t border-zinc-800 pt-6`,children:[e?(0,N.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,N.jsxs)(`span`,{className:`text-xs text-zinc-500 flex items-center gap-1`,children:[(0,N.jsx)(fi,{size:12}),`Previous`]}),(0,N.jsx)(`span`,{className:`mt-1 block text-sm text-zinc-300 group-hover:text-cyan-400 transition-colors`,children:e.title})]}):(0,N.jsx)(`div`,{className:`flex-1`}),t?(0,N.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,N.jsxs)(`span`,{className:`text-xs text-zinc-500 flex items-center justify-end gap-1`,children:[`Next`,(0,N.jsx)(pi,{size:12})]}),(0,N.jsx)(`span`,{className:`mt-1 block text-sm text-zinc-300 group-hover:text-cyan-400 transition-colors`,children:t.title})]}):(0,N.jsx)(`div`,{className:`flex-1`})]})}function cp(){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)(()=>rp(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,N.jsxs)(`div`,{className:`flex h-screen bg-zinc-950`,children:[(0,N.jsx)(ip,{index:r,currentSlug:h,sidebarOpen:a,onClose:()=>o(!1)}),(0,N.jsxs)(`div`,{ref:n,className:`flex-1 overflow-y-auto`,children:[(0,N.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,N.jsx)(Yi,{className:`h-4 w-4`})}),(0,N.jsxs)(`div`,{className:`flex gap-8 max-w-5xl mx-auto px-6 py-8 lg:px-8`,children:[(0,N.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[x&&_&&(0,N.jsxs)(`div`,{className:`mb-6 flex items-center gap-2 text-xs text-zinc-500`,children:[(0,N.jsx)(Pt,{to:`/docs`,className:`hover:text-zinc-300`,children:`Docs`}),(0,N.jsx)(pi,{size:10}),(0,N.jsx)(`span`,{children:x.title}),(0,N.jsx)(pi,{size:10}),(0,N.jsx)(`span`,{className:`text-zinc-400`,children:_.title})]}),f&&(0,N.jsx)(`div`,{className:`text-zinc-500 text-sm py-12`,children:`Loading...`}),p&&(0,N.jsxs)(`div`,{className:`rounded-lg border border-yellow-500/20 bg-yellow-500/5 p-6 text-sm text-yellow-400`,children:[(0,N.jsx)(`p`,{className:`font-semibold mb-2`,children:`Page Not Available`}),(0,N.jsx)(`p`,{className:`text-yellow-500/80`,children:p}),(0,N.jsx)(Pt,{to:`/docs/what-is-lamaste`,className:`mt-4 inline-block text-cyan-400 hover:underline`,children:`Go to Introduction`})]}),!f&&!p&&(0,N.jsxs)(N.Fragment,{children:[(0,N.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:ep.sanitize(C)}}),(0,N.jsx)(sp,{prevPage:y,nextPage:b})]})]}),(0,N.jsx)(op,{toc:S,activeId:s})]})]})]}):(0,N.jsx)(`div`,{className:`flex h-screen items-center justify-center bg-zinc-950`,children:(0,N.jsx)(`div`,{className:`text-zinc-500 text-sm`,children:`Loading documentation...`})})}var lp=new Zn({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}});function up(){let{status:e,domain:t,isLoading:n,isError:r,refetch:i}=Yr();return n?(0,N.jsx)(Gl,{}):r?(0,N.jsx)(Kl,{onRetry:i}):e===`COMPLETED`?(0,N.jsx)(yt,{children:(0,N.jsxs)(_t,{element:(0,N.jsx)(Wl,{}),children:[(0,N.jsx)(_t,{path:`/`,element:(0,N.jsx)(po,{})}),(0,N.jsx)(_t,{path:`/tunnels`,element:(0,N.jsx)(xl,{})}),(0,N.jsx)(_t,{path:`/sites`,element:(0,N.jsx)(jo,{domain:t})}),(0,N.jsx)(_t,{path:`/users`,element:(0,N.jsx)(ds,{})}),(0,N.jsx)(_t,{path:`/certificates`,element:(0,N.jsx)(Ps,{})}),(0,N.jsx)(_t,{path:`/services`,element:(0,N.jsx)(yo,{})}),(0,N.jsx)(_t,{path:`/tickets`,element:(0,N.jsx)(Ws,{})}),(0,N.jsx)(_t,{path:`/plugins`,element:(0,N.jsx)(rl,{})}),(0,N.jsx)(_t,{path:`/storage`,element:(0,N.jsx)(Tl,{})}),(0,N.jsx)(_t,{path:`/audit`,element:(0,N.jsx)(Al,{})}),(0,N.jsx)(_t,{path:`/plugins/:pluginName/*`,element:(0,N.jsx)(mu,{})}),(0,N.jsx)(_t,{path:`/settings`,element:(0,N.jsx)(Sl,{hasDomain:!!t})}),(0,N.jsx)(_t,{path:`/docs/*`,element:(0,N.jsx)(cp,{})})]})}):(0,N.jsx)(pu,{})}function dp(){return(0,N.jsx)(er,{client:lp,children:(0,N.jsx)(Zr,{client:Il,children:(0,N.jsx)(La,{children:(0,N.jsx)(Ja,{children:(0,N.jsx)(Pa,{children:(0,N.jsx)(jt,{children:(0,N.jsx)(up,{})})})})})})})}_.createRoot(document.getElementById(`root`)).render((0,N.jsx)(g.StrictMode,{children:(0,N.jsx)(dp,{})}));
|