easy-vps 0.2.3 → 0.2.4

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.
@@ -99,6 +99,6 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
99
99
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function aY(e,t){if(e){if(typeof e==`string`)return oY(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?oY(e,t):void 0}}function oY(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function sY(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function cY(e){if(Array.isArray(e))return e}var lY=(0,N.createContext)(void 0),uY=e=>{var t=e.children,n=rY((0,N.useState)(`${db(`recharts`)}-clip`),1)[0],r=FJ();if(r==null)return null;var i=r.x,a=r.y,o=r.width,s=r.height;return N.createElement(lY.Provider,{value:n},N.createElement(`defs`,null,N.createElement(`clipPath`,{id:n},N.createElement(`rect`,{x:i,y:a,height:s,width:o}))),t)},dY=()=>(0,N.useContext)(lY),fY=class{constructor(e){var t=e.x,n=e.y;this.xAxisScale=t,this.yAxisScale=n}map(e,t){var n=t.position;return{x:this.xAxisScale.map(e.x,{position:n})??0,y:this.yAxisScale.map(e.y,{position:n})??0}}mapWithFallback(e,t){var n=t.position,r=t.fallback,i=r===`rangeMin`?this.yAxisScale.rangeMin():r===`rangeMax`?this.yAxisScale.rangeMax():0,a=r===`rangeMin`?this.xAxisScale.rangeMin():r===`rangeMax`?this.xAxisScale.rangeMax():0;return{x:this.xAxisScale.map(e.x,{position:n})??a,y:this.yAxisScale.map(e.y,{position:n})??i}}isInRange(e){var t=e.x,n=e.y,r=t==null||this.xAxisScale.isInRange(t),i=n==null||this.yAxisScale.isInRange(n);return r&&i}};function pY(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function mY(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?pY(Object(n),!0).forEach(function(t){hY(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pY(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function hY(e,t,n){return(t=gY(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function gY(e){var t=_Y(e,`string`);return typeof t==`symbol`?t:t+``}function _Y(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function vY(){return vY=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},vY.apply(null,arguments)}var yY=(e,t)=>{var n;if(N.isValidElement(e))n=N.cloneElement(e,t);else if(typeof e==`function`)n=e(t);else{if(!$(t.x1)||!$(t.y1)||!$(t.x2)||!$(t.y2))return null;n=N.createElement(`line`,vY({},t,{className:`recharts-reference-line-line`}))}return n},bY=(e,t,n,r,i,a)=>{var o=a.x,s=a.width,c=i.map(e,{position:n});if(!$(c)||t===`discard`&&!i.isInRange(c))return null;var l=[{x:o+s,y:c},{x:o,y:c}];return r===`left`?l.reverse():l},xY=(e,t,n,r,i,a)=>{var o=a.y,s=a.height,c=i.map(e,{position:n});if(!$(c)||t===`discard`&&!i.isInRange(c))return null;var l=[{x:c,y:o+s},{x:c,y:o}];return r===`top`?l.reverse():l},SY=(e,t,n,r)=>{var i=[r.mapWithFallback(e[0],{position:n,fallback:`rangeMin`}),r.mapWithFallback(e[1],{position:n,fallback:`rangeMax`})];return t===`discard`&&i.some(e=>!r.isInRange(e))?null:i},CY=(e,t,n,r,i,a,o)=>{var s=o.x,c=o.y,l=o.segment,u=o.ifOverflow,d=lb(s);return lb(c)?bY(c,u,r,a,t,n):d?xY(s,u,r,i,e,n):l!=null&&l.length===2?SY(l,u,r,new fY({x:e,y:t})):null};function wY(e){var t=nC();return(0,N.useEffect)(()=>(t(eY(e)),()=>{t(tY(e))})),null}function TY(e){var t=e.xAxisId,n=e.yAxisId,r=e.shape,i=e.className,a=e.ifOverflow,o=FD(),s=dY(),c=Z(e=>jz(e,t)),l=Z(e=>Pz(e,n)),u=Z(e=>dV(e,`xAxis`,t,o)),d=Z(e=>dV(e,`yAxis`,n,o)),f=_O();if(!s||!f||c==null||l==null||u==null||d==null)return null;var p=CY(u,d,f,e.position,c.orientation,l.orientation,e);if(!p)return null;var m=p[0],h=p[1];if(m==null||h==null)return null;var g=m.x,_=m.y,v=h.x,y=h.y,b=mY(mY({clipPath:a===`hidden`?`url(#${s})`:void 0},Iy(e)),{},{x1:g,y1:_,x2:v,y2:y}),x=YJ({x1:g,y1:_,x2:v,y2:y});return N.createElement(rW,{zIndex:e.zIndex},N.createElement(qy,{className:R(`recharts-reference-line`,i)},yY(r,b),N.createElement(DK,vY({},x,{lowerWidth:x.width,upperWidth:x.width}),N.createElement(VK,{label:e.label}),e.children)))}var EY={ifOverflow:`discard`,xAxisId:0,yAxisId:0,fill:`none`,label:!1,stroke:`#ccc`,fillOpacity:1,strokeWidth:1,position:`middle`,zIndex:YM.line};function DY(e){var t=Rx(e,EY);return N.createElement(N.Fragment,null,N.createElement(wY,{yAxisId:t.yAxisId,xAxisId:t.xAxisId,ifOverflow:t.ifOverflow,x:t.x,y:t.y,segment:t.segment}),N.createElement(TY,t))}DY.displayName=`ReferenceLine`;function OY(){}function kY(e){if(!e||typeof e!=`object`)return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null?!1:Object.prototype.toString.call(e)===`[object Object]`}function AY(e,t,n){return jY(e,t,void 0,void 0,void 0,void 0,n)}function jY(e,t,n,r,i,a,o){let s=o(e,t,n,r,i,a);if(s!==void 0)return s;if(typeof e==typeof t)switch(typeof e){case`bigint`:case`string`:case`boolean`:case`symbol`:case`undefined`:return e===t;case`number`:return e===t||Object.is(e,t);case`function`:return e===t;case`object`:return MY(e,t,a,o)}return MY(e,t,a,o)}function MY(e,t,n,r){if(Object.is(e,t))return!0;let i=Jx(e),a=Jx(t);if(i===`[object Arguments]`&&(i=sS),a===`[object Arguments]`&&(a=sS),i!==a)return!1;switch(i){case Xx:return e.toString()===t.toString();case Zx:return OS(e.valueOf(),t.valueOf());case Qx:case tS:case eS:return Object.is(e.valueOf(),t.valueOf());case Yx:return e.source===t.source&&e.flags===t.flags;case aS:return e===t}n??=new Map;let o=n.get(e),s=n.get(t);if(o!=null&&s!=null)return o===t;n.set(e,t),n.set(t,e);try{switch(i){case nS:if(e.size!==t.size)return!1;for(let[i,a]of e.entries())if(!t.has(i)||!jY(a,t.get(i),i,e,t,n,r))return!1;return!0;case rS:{if(e.size!==t.size)return!1;let i=Array.from(e.values()),a=Array.from(t.values());for(let o=0;o<i.length;o++){let s=i[o],c=a.findIndex(i=>jY(s,i,void 0,e,t,n,r));if(c===-1)return!1;a.splice(c,1)}return!0}case iS:case uS:case dS:case fS:case pS:case mS:case hS:case gS:case _S:case vS:case yS:case bS:if(SS(e)!==SS(t)||e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!jY(e[i],t[i],i,e,t,n,r))return!1;return!0;case oS:return e.byteLength===t.byteLength&&MY(new Uint8Array(e),new Uint8Array(t),n,r);case lS:return e.byteLength!==t.byteLength||e.byteOffset!==t.byteOffset?!1:MY(new Uint8Array(e),new Uint8Array(t),n,r);case cS:return e.name===t.name&&e.message===t.message;case sS:{if(!(MY(e.constructor,t.constructor,n,r)||kY(e)&&kY(t)))return!1;let i=[...Object.keys(e),...qx(e)],a=[...Object.keys(t),...qx(t)];if(i.length!==a.length)return!1;for(let a=0;a<i.length;a++){let o=i[a],s=e[o];if(!Object.hasOwn(t,o))return!1;let c=t[o];if(!jY(s,c,o,e,t,n,r))return!1}return!0}default:return!1}}finally{n.delete(e),n.delete(t)}}function NY(e,t){return AY(e,t,OY)}function PY(e,t){if(t<1)return[];if(t===1)return e;for(var n=[],r=0;r<e.length;r+=t){var i=e[r];i!==void 0&&n.push(i)}return n}function FY(e,t,n){return ZJ({width:e.width+t.width,height:e.height+t.height},n)}function IY(e,t,n){var r=n===`width`,i=e.x,a=e.y,o=e.width,s=e.height;return t===1?{start:r?i:a,end:r?i+o:a+s}:{start:r?i+o:a+s,end:r?i:a}}function LY(e,t,n,r,i){if(e*t<e*r||e*t>e*i)return!1;var a=n();return e*(t-e*a/2-r)>=0&&e*(t+e*a/2-i)<=0}function RY(e,t){return PY(e,t+1)}function zY(e,t,n,r,i){for(var a=(r||[]).slice(),o=t.start,s=t.end,c=0,l=1,u=o,d=function(){var t=r?.[c];if(t===void 0)return{v:PY(r,l)};var a=c,d,f=()=>(d===void 0&&(d=n(t,a)),d),p=t.coordinate,m=c===0||LY(e,p,f,u,s);m||(c=0,u=o,l+=1),m&&(u=p+e*(f()/2+i),c+=l)},f;l<=a.length;)if(f=d(),f)return f.v;return[]}function BY(e,t,n,r,i){var a=(r||[]).slice().length;if(a===0)return[];for(var o=t.start,s=t.end,c=1;c<=a;c++){for(var l=(a-1)%c,u=o,d=!0,f=function(){var t=r[m];if(t==null)return 0;var a=m,o,c=()=>(o===void 0&&(o=n(t,a)),o),f=t.coordinate,p=m===l||LY(e,f,c,u,s);if(!p)return d=!1,1;p&&(u=f+e*(c()/2+i))},p,m=l;m<a&&(p=f(),p===0||p!==1);m+=c);if(d){for(var h=[],g=l;g<a;g+=c){var _=r[g];_!=null&&h.push(_)}return h}}return[]}function VY(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function HY(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?VY(Object(n),!0).forEach(function(t){UY(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):VY(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function UY(e,t,n){return(t=WY(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function WY(e){var t=GY(e,`string`);return typeof t==`symbol`?t:t+``}function GY(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function KY(e,t,n,r,i){for(var a=(r||[]).slice(),o=a.length,s=t.start,c=t.end,l=function(t){var r=a[t];if(r==null)return 1;var l=r,u,d=()=>(u===void 0&&(u=n(r,t)),u);if(t===o-1){var f=e*(l.coordinate+e*d()/2-c);a[t]=l=HY(HY({},l),{},{tickCoord:f>0?l.coordinate-f*e:l.coordinate})}else a[t]=l=HY(HY({},l),{},{tickCoord:l.coordinate});l.tickCoord!=null&&LY(e,l.tickCoord,d,s,c)&&(c=l.tickCoord-e*(d()/2+i),a[t]=HY(HY({},l),{},{isShow:!0}))},u=o-1;u>=0;u--)if(l(u))continue;return a}function qY(e,t,n,r,i,a){var o=(r||[]).slice(),s=o.length,c=t.start,l=t.end;if(a){var u=r[s-1];if(u!=null){var d=n(u,s-1),f=e*(u.coordinate+e*d/2-l);o[s-1]=u=HY(HY({},u),{},{tickCoord:f>0?u.coordinate-f*e:u.coordinate}),u.tickCoord!=null&&LY(e,u.tickCoord,()=>d,c,l)&&(l=u.tickCoord-e*(d/2+i),o[s-1]=HY(HY({},u),{},{isShow:!0}))}}for(var p=a?s-1:s,m=function(t){var r=o[t];if(r==null)return 1;var a=r,s,u=()=>(s===void 0&&(s=n(r,t)),s);if(t===0){var d=e*(a.coordinate-e*u()/2-c);o[t]=a=HY(HY({},a),{},{tickCoord:d<0?a.coordinate-d*e:a.coordinate})}else o[t]=a=HY(HY({},a),{},{tickCoord:a.coordinate});a.tickCoord!=null&&LY(e,a.tickCoord,u,c,l)&&(c=a.tickCoord+e*(u()/2+i),o[t]=HY(HY({},a),{},{isShow:!0}))},h=0;h<p;h++)if(m(h))continue;return o}function JY(e,t,n){var r=e.tick,i=e.ticks,a=e.viewBox,o=e.minTickGap,s=e.orientation,c=e.interval,l=e.tickFormatter,u=e.unit,d=e.angle;if(!i||!i.length||!r)return[];if(X(c)||xk.isSsr)return RY(i,X(c)?c:0)??[];var f=[],p=s===`top`||s===`bottom`?`width`:`height`,m=u&&p===`width`?vG(u,{fontSize:t,letterSpacing:n}):{width:0,height:0},h=(e,r)=>{var i=typeof l==`function`?l(e.value,r):e.value;return p===`width`?FY(vG(i,{fontSize:t,letterSpacing:n}),m,d):vG(i,{fontSize:t,letterSpacing:n})[p]},g=i[0],_=i[1],v=i.length>=2&&g!=null&&_!=null?ob(_.coordinate-g.coordinate):1,y=IY(a,v,p);return c===`equidistantPreserveStart`?zY(v,y,h,i,o):c===`equidistantPreserveEnd`?BY(v,y,h,i,o):(f=c===`preserveStart`||c===`preserveStartEnd`?qY(v,y,h,i,o,c===`preserveStartEnd`):KY(v,y,h,i,o),f.filter(e=>e.isShow))}var YY=e=>{var t=e.ticks,n=e.label,r=e.labelGapWithTick,i=r===void 0?5:r,a=e.tickSize,o=a===void 0?0:a,s=e.tickMargin,c=s===void 0?0:s,l=0;if(t){Array.from(t).forEach(e=>{if(e){var t=e.getBoundingClientRect();t.width>l&&(l=t.width)}});var u=n?n.getBoundingClientRect().width:0,d=o+c,f=l+d+u+(n?i:0);return Math.round(f)}return 0},XY=e=>{var t=e.ticks,n=e.label,r=e.labelGapWithTick,i=r===void 0?5:r,a=e.tickSize,o=a===void 0?0:a,s=e.tickMargin,c=s===void 0?0:s,l=0;if(t){Array.from(t).forEach(e=>{if(e){var t=e.getBoundingClientRect();t.height>l&&(l=t.height)}});var u=n?n.getBoundingClientRect().height:0,d=o+c,f=l+d+u+(n?i:0);return Math.round(f)}return 0},ZY=qT({name:`renderedTicks`,initialState:{xAxis:{},yAxis:{}},reducers:{setRenderedTicks:(e,t)=>{var n=t.payload,r=n.axisType,i=n.axisId,a=n.ticks;e[r][i]=bT(a)},removeRenderedTicks:(e,t)=>{var n=t.payload,r=n.axisType,i=n.axisId;delete e[r][i]}}}),QY=ZY.actions,$Y=QY.setRenderedTicks,eX=QY.removeRenderedTicks,tX=ZY.reducer,nX=[`axisLine`,`width`,`height`,`className`,`hide`,`ticks`,`axisType`,`axisId`];function rX(e,t){return cX(e)||sX(e,t)||aX(e,t)||iX()}function iX(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
100
100
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function aX(e,t){if(e){if(typeof e==`string`)return oX(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?oX(e,t):void 0}}function oX(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function sX(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function cX(e){if(Array.isArray(e))return e}function lX(e,t){if(e==null)return{};var n,r,i=uX(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function uX(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function dX(){return dX=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},dX.apply(null,arguments)}function fX(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function pX(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?fX(Object(n),!0).forEach(function(t){mX(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fX(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function mX(e,t,n){return(t=hX(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function hX(e){var t=gX(e,`string`);return typeof t==`symbol`?t:t+``}function gX(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var _X={x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:`bottom`,ticks:[],stroke:`#666`,tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:`preserveEnd`,zIndex:YM.axis};function vX(e){var t=e.x,n=e.y,r=e.width,i=e.height,a=e.orientation,o=e.mirror,s=e.axisLine,c=e.otherSvgProps;if(!s)return null;var l=pX(pX(pX({},c),Py(s)),{},{fill:`none`});if(a===`top`||a===`bottom`){var u=+(a===`top`&&!o||a===`bottom`&&o);l=pX(pX({},l),{},{x1:t,y1:n+u*i,x2:t+r,y2:n+u*i})}else{var d=+(a===`left`&&!o||a===`right`&&o);l=pX(pX({},l),{},{x1:t+d*r,y1:n,x2:t+d*r,y2:n+i})}return N.createElement(`line`,dX({},l,{className:R(`recharts-cartesian-axis-line`,tb(s,`className`))}))}function yX(e,t,n,r,i,a,o,s,c){var l,u,d,f,p,m,h=s?-1:1,g=e.tickSize||o,_=X(e.tickCoord)?e.tickCoord:e.coordinate;switch(a){case`top`:l=u=e.coordinate,f=n+ +!s*i,d=f-h*g,m=d-h*c,p=_;break;case`left`:d=f=e.coordinate,u=t+ +!s*r,l=u-h*g,p=l-h*c,m=_;break;case`right`:d=f=e.coordinate,u=t+ +s*r,l=u+h*g,p=l+h*c,m=_;break;default:l=u=e.coordinate,f=n+ +s*i,d=f+h*g,m=d+h*c,p=_}return{line:{x1:l,y1:d,x2:u,y2:f},tick:{x:p,y:m}}}function bX(e,t){switch(e){case`left`:return t?`start`:`end`;case`right`:return t?`end`:`start`;default:return`middle`}}function xX(e,t){switch(e){case`left`:case`right`:return`middle`;case`top`:return t?`start`:`end`;default:return t?`end`:`start`}}function SX(e){var t=e.option,n=e.tickProps,r=e.value,i,a=R(n.className,`recharts-cartesian-axis-tick-value`);if(N.isValidElement(t))i=N.cloneElement(t,pX(pX({},n),{},{className:a}));else if(typeof t==`function`)i=t(pX(pX({},n),{},{className:a}));else{var o=`recharts-cartesian-axis-tick-value`;typeof t!=`boolean`&&(o=R(o,oq(t))),i=N.createElement(hK,dX({},n,{className:o}),r)}return i}function CX(e){var t=e.ticks,n=e.axisType,r=e.axisId,i=nC(),a=(0,N.useRef)(null);return(0,N.useEffect)(()=>{if(r!=null&&n!=null){var e=t.map(e=>({value:e.value,coordinate:e.coordinate,offset:e.offset,index:e.index})),o=a.current;o!=null&&o.axisId===r&&o.axisType===n&&NY(o.ticks,e)||(a.current={ticks:e,axisId:r,axisType:n},i($Y({ticks:e,axisId:r,axisType:n})))}},[i,t,r,n]),(0,N.useEffect)(()=>r==null||n==null?yb:()=>{i(eX({axisId:r,axisType:n}))},[i,r,n]),null}var wX=(0,N.forwardRef)((e,t)=>{var n=e.ticks,r=n===void 0?[]:n,i=e.tick,a=e.tickLine,o=e.stroke,s=e.tickFormatter,c=e.unit,l=e.padding,u=e.tickTextProps,d=e.orientation,f=e.mirror,p=e.x,m=e.y,h=e.width,g=e.height,_=e.tickSize,v=e.tickMargin,y=e.fontSize,b=e.letterSpacing,x=e.getTicksConfig,S=e.events,C=e.axisType,w=e.axisId,T=JY(pX(pX({},x),{},{ticks:r}),y,b),E=Py(x),D=Fy(i),O=iK(E.textAnchor)?E.textAnchor:bX(d,f),k=xX(d,f),A={};typeof a==`object`&&(A=a);var j=pX(pX({},E),{},{fill:`none`},A),M=T.map(e=>pX({entry:e},yX(e,p,m,h,g,d,_,f,v))),ee=M.map(e=>{var t=e.entry,n=e.line;return N.createElement(qy,{className:`recharts-cartesian-axis-tick`,key:`tick-${t.value}-${t.coordinate}-${t.tickCoord}`},a&&N.createElement(`line`,dX({},j,n,{className:R(`recharts-cartesian-axis-tick-line`,tb(a,`className`))})))}),te=M.map((e,t)=>{var n=e.entry,r=e.tick,a=pX(pX({},pX(pX(pX(pX({verticalAnchor:k},E),{},{textAnchor:O,stroke:`none`,fill:o},r),{},{index:t,payload:n,visibleTicksCount:T.length,tickFormatter:s,padding:l},u),{},{angle:u?.angle??E.angle??0})),D);return N.createElement(qy,dX({className:`recharts-cartesian-axis-tick-label`,key:`tick-label-${n.value}-${n.coordinate}-${n.tickCoord}`},Mx(S,n,t)),i&&N.createElement(SX,{option:i,tickProps:a,value:`${typeof s==`function`?s(n.value,t):n.value}${c||``}`}))});return N.createElement(`g`,{className:`recharts-cartesian-axis-ticks recharts-${C}-ticks`},N.createElement(CX,{ticks:T,axisId:w,axisType:C}),te.length>0&&N.createElement(rW,{zIndex:YM.label},N.createElement(`g`,{className:`recharts-cartesian-axis-tick-labels recharts-${C}-tick-labels`,ref:t},te)),ee.length>0&&N.createElement(`g`,{className:`recharts-cartesian-axis-tick-lines recharts-${C}-tick-lines`},ee))}),TX=(0,N.forwardRef)((e,t)=>{var n=e.axisLine,r=e.width,i=e.height,a=e.className,o=e.hide,s=e.ticks,c=e.axisType,l=e.axisId,u=lX(e,nX),d=rX((0,N.useState)(``),2),f=d[0],p=d[1],m=rX((0,N.useState)(``),2),h=m[0],g=m[1],_=(0,N.useRef)(null);(0,N.useImperativeHandle)(t,()=>({getCalculatedWidth:()=>YY({ticks:_.current,label:e.labelRef?.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin}),getCalculatedHeight:()=>XY({ticks:_.current,label:e.labelRef?.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin})}));var v=(0,N.useCallback)(e=>{if(e){var t=e.getElementsByClassName(`recharts-cartesian-axis-tick-value`);_.current=t;var n=t[0];if(n){var r=window.getComputedStyle(n),i=r.fontSize,a=r.letterSpacing;(i!==f||a!==h)&&(p(i),g(a))}}},[f,h]);return o||r!=null&&r<=0||i!=null&&i<=0?null:N.createElement(rW,{zIndex:e.zIndex},N.createElement(qy,{className:R(`recharts-cartesian-axis`,a)},N.createElement(vX,{x:e.x,y:e.y,width:r,height:i,orientation:e.orientation,mirror:e.mirror,axisLine:n,otherSvgProps:Py(e)}),N.createElement(wX,{ref:v,axisType:c,events:u,fontSize:f,getTicksConfig:e,height:e.height,letterSpacing:h,mirror:e.mirror,orientation:e.orientation,padding:e.padding,stroke:e.stroke,tick:e.tick,tickFormatter:e.tickFormatter,tickLine:e.tickLine,tickMargin:e.tickMargin,tickSize:e.tickSize,tickTextProps:e.tickTextProps,ticks:s,unit:e.unit,width:e.width,x:e.x,y:e.y,axisId:l}),N.createElement(DK,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},N.createElement(VK,{label:e.label,labelRef:e.labelRef}),e.children)))}),EX=N.forwardRef((e,t)=>{var n=Rx(e,_X);return N.createElement(TX,dX({},n,{ref:t}))});EX.displayName=`CartesianAxis`;var DX=(0,N.createContext)({grid:{stroke:`#ccc`,fill:`none`}});DX.Provider;var OX=()=>(0,N.useContext)(DX),kX=[`x1`,`y1`,`x2`,`y2`,`key`],AX=[`offset`],jX=[`xAxisId`,`yAxisId`],MX=[`xAxisId`,`yAxisId`];function NX(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function PX(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?NX(Object(n),!0).forEach(function(t){FX(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):NX(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function FX(e,t,n){return(t=IX(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function IX(e){var t=LX(e,`string`);return typeof t==`symbol`?t:t+``}function LX(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function RX(){return RX=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},RX.apply(null,arguments)}function zX(e,t){if(e==null)return{};var n,r,i=BX(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function BX(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var VX=e=>{var t=e.fill;if(!t||t===`none`)return null;var n=e.fillOpacity,r=e.x,i=e.y,a=e.width,o=e.height,s=e.ry;return N.createElement(`rect`,{x:r,y:i,ry:s,width:a,height:o,stroke:`none`,fill:t,fillOpacity:n,className:`recharts-cartesian-grid-bg`})};function HX(e){var t=e.option,n=e.lineItemProps,r;if(N.isValidElement(t))r=N.cloneElement(t,n);else if(typeof t==`function`)r=t(n);else{var i=n.x1,a=n.y1,o=n.x2,s=n.y2,c=n.key,l=Py(zX(n,kX))??{};l.offset;var u=zX(l,AX),d=Array.isArray(u.strokeDasharray)?u.strokeDasharray.join(`,`):u.strokeDasharray;r=N.createElement(`line`,RX({},u,{strokeDasharray:d,x1:i,y1:a,x2:o,y2:s,fill:`none`,key:c}))}return r}function UX(e){var t=e.x,n=e.width,r=e.horizontal,i=r===void 0||r,a=e.horizontalPoints;if(!i||!a||!a.length)return null;e.xAxisId,e.yAxisId;var o=zX(e,jX),s=a.map((e,r)=>{var a=PX(PX({},o),{},{x1:t,y1:e,x2:t+n,y2:e,key:`line-${r}`,index:r});return N.createElement(HX,{key:`line-${r}`,option:i,lineItemProps:a})});return N.createElement(`g`,{className:`recharts-cartesian-grid-horizontal`},s)}function WX(e){var t=e.y,n=e.height,r=e.vertical,i=r===void 0||r,a=e.verticalPoints;if(!i||!a||!a.length)return null;e.xAxisId,e.yAxisId;var o=zX(e,MX),s=a.map((e,r)=>{var a=PX(PX({},o),{},{x1:e,y1:t,x2:e,y2:t+n,key:`line-${r}`,index:r});return N.createElement(HX,{option:i,lineItemProps:a,key:`line-${r}`})});return N.createElement(`g`,{className:`recharts-cartesian-grid-vertical`},s)}function GX(e){var t=e.horizontalFill,n=e.fillOpacity,r=e.x,i=e.y,a=e.width,o=e.height,s=e.horizontalPoints,c=e.horizontal;if(!(c===void 0||c)||!t||!t.length||s==null)return null;var l=s.map(e=>Math.round(e+i-i)).sort((e,t)=>e-t);i!==l[0]&&l.unshift(0);var u=l.map((e,s)=>{var c=l[s+1],u=c==null?i+o-e:c-e;if(u<=0)return null;var d=s%t.length;return N.createElement(`rect`,{key:`react-${s}`,y:e,x:r,height:u,width:a,stroke:`none`,fill:t[d],fillOpacity:n,className:`recharts-cartesian-grid-bg`})});return N.createElement(`g`,{className:`recharts-cartesian-gridstripes-horizontal`},u)}function KX(e){var t=e.vertical,n=t===void 0||t,r=e.verticalFill,i=e.fillOpacity,a=e.x,o=e.y,s=e.width,c=e.height,l=e.verticalPoints;if(!n||!r||!r.length)return null;var u=l.map(e=>Math.round(e+a-a)).sort((e,t)=>e-t);a!==u[0]&&u.unshift(0);var d=u.map((e,t)=>{var n=u[t+1],l=n==null?a+s-e:n-e;if(l<=0)return null;var d=t%r.length;return N.createElement(`rect`,{key:`react-${t}`,x:e,y:o,width:l,height:c,stroke:`none`,fill:r[d],fillOpacity:i,className:`recharts-cartesian-grid-bg`})});return N.createElement(`g`,{className:`recharts-cartesian-gridstripes-vertical`},d)}var qX=(e,t)=>{var n=e.xAxis,r=e.width,i=e.height,a=e.offset;return QE(JY(PX(PX(PX({},_X),n),{},{ticks:$E(n,!0),viewBox:{x:0,y:0,width:r,height:i}})),a.left,a.left+a.width,t)},JX=(e,t)=>{var n=e.yAxis,r=e.width,i=e.height,a=e.offset;return QE(JY(PX(PX(PX({},_X),n),{},{ticks:$E(n,!0),viewBox:{x:0,y:0,width:r,height:i}})),a.top,a.top+a.height,t)},YX={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:YM.grid};function XX(e){var t=bO(),n=xO(),r=yO(),i=PX(PX({},Rx(e,YX)),{},{x:X(e.x)?e.x:r.left,y:X(e.y)?e.y:r.top,width:X(e.width)?e.width:r.width,height:X(e.height)?e.height:r.height}),a=i.xAxisId,o=i.yAxisId,s=i.x,c=i.y,l=i.width,u=i.height,d=i.syncWithTicks,f=i.horizontalValues,p=i.verticalValues,m=FD(),h=Z(e=>kV(e,`xAxis`,a,m)),g=Z(e=>kV(e,`yAxis`,o,m)),_=OX(),v={stroke:i.stroke??_.grid.stroke,strokeWidth:i.strokeWidth??_.grid.strokeWidth,strokeOpacity:i.strokeOpacity??_.grid.strokeOpacity,strokeDasharray:i.strokeDasharray??_.grid.strokeDasharray};if(!UE(l)||!UE(u)||!X(s)||!X(c))return null;var y=i.verticalCoordinatesGenerator||qX,b=i.horizontalCoordinatesGenerator||JX,x=i.horizontalPoints,S=i.verticalPoints;if((!x||!x.length)&&typeof b==`function`){var C=f&&f.length,w=b({yAxis:g?PX(PX({},g),{},{ticks:C?f:g.ticks}):void 0,width:t??l,height:n??u,offset:r},C?!0:d);VD(Array.isArray(w),`horizontalCoordinatesGenerator should return Array but instead it returned [${typeof w}]`),Array.isArray(w)&&(x=w)}if((!S||!S.length)&&typeof y==`function`){var T=p&&p.length,E=y({xAxis:h?PX(PX({},h),{},{ticks:T?p:h.ticks}):void 0,width:t??l,height:n??u,offset:r},T?!0:d);VD(Array.isArray(E),`verticalCoordinatesGenerator should return Array but instead it returned [${typeof E}]`),Array.isArray(E)&&(S=E)}return N.createElement(rW,{zIndex:i.zIndex},N.createElement(`g`,{className:`recharts-cartesian-grid`},N.createElement(VX,{fill:i.fill??_.grid.fill,fillOpacity:i.fillOpacity??_.grid.fillOpacity,x:i.x,y:i.y,width:i.width,height:i.height,ry:i.ry}),N.createElement(GX,RX({},i,{horizontalPoints:x})),N.createElement(KX,RX({},i,{verticalPoints:S})),N.createElement(UX,RX({},i,v,{offset:r,horizontalPoints:x,xAxis:h,yAxis:g})),N.createElement(WX,RX({},i,v,{offset:r,verticalPoints:S,xAxis:h,yAxis:g}))))}XX.displayName=`CartesianGrid`;var ZX=[`animationElapsedTime`,`isAnimating`,`isEntrance`,`visibleLength`,`strokeDasharray`,`connectNulls`];function QX(){return QX=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},QX.apply(null,arguments)}function $X(e,t){if(e==null)return{};var n,r,i=eZ(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function eZ(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function tZ(e){try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch{return 0}}function nZ(e,t){return`${t}px ${e}px`}function rZ(e){return e.length%2==0?e:[...e,...e]}function iZ(e,t){for(var n=[],r=0;r<t;++r)n.push(...e);return n}function aZ(e,t,n){var r=rZ(n),i=r.reduce((e,t)=>e+t,0);if(!i)return nZ(t,e);for(var a=Math.floor(e/i),o=e%i,s=[],c=0,l=0;c<r.length;l+=(u=r[c])??0,++c){var u,d=r[c];if(d!=null&&l+d>o){s=[...r.slice(0,c),o-l];break}}var f=s.length%2==0?[0,t]:[t];return[...iZ(r,a),...s,...f].map(e=>`${e}px`).join(`, `)}function oZ(e,t,n){return e?aZ(n,t,`${e}`.split(/[,\s]+/gim).map(e=>parseFloat(e))):nZ(t,n)}function sZ(e){e.animationElapsedTime,e.isAnimating,e.isEntrance;var t=e.visibleLength,n=e.strokeDasharray,r=e.connectNulls,i=$X(e,ZX),a=r??!1,o;if(t!=null){var s=i.pathRef;o=oZ(n,tZ(s?.current??null),t)}else n!=null&&(o=String(n));return N.createElement(iA,QX({},i,{connectNulls:a,strokeDasharray:o}))}function cZ(e){var t=(0,N.useRef)(0),n=(0,N.useRef)(0),r=(0,N.useRef)(!1),i=(0,N.useRef)(e);return i.current!==e&&(t.current=n.current,i.current=e),(0,N.useCallback)((e,i)=>{if(r.current)return null;var a=Math.min(ib(t.current+e*i),i);return e>0&&i>0&&(n.current=Math.max(n.current,a),a>=i)?(r.current=!0,null):a},[])}var lZ=qT({name:`errorBars`,initialState:{},reducers:{addErrorBar:(e,t)=>{var n=t.payload,r=n.itemId,i=n.errorBar;e[r]||(e[r]=[]),e[r].push(i)},replaceErrorBar:(e,t)=>{var n=t.payload,r=n.itemId,i=n.prev,a=n.next;e[r]&&(e[r]=e[r].map(e=>e.dataKey===i.dataKey&&e.direction===i.direction?a:e))},removeErrorBar:(e,t)=>{var n=t.payload,r=n.itemId,i=n.errorBar;e[r]&&(e[r]=e[r].filter(e=>e.dataKey!==i.dataKey||e.direction!==i.direction))}}}),uZ=lZ.actions;uZ.addErrorBar,uZ.replaceErrorBar,uZ.removeErrorBar;var dZ=lZ.reducer,fZ=[`children`];function pZ(e,t){if(e==null)return{};var n,r,i=mZ(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function mZ(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var hZ=(0,N.createContext)({data:[],xAxisId:`xAxis-0`,yAxisId:`yAxis-0`,dataPointFormatter:()=>({x:0,y:0,value:0}),errorBarOffset:0});function gZ(e){var t=e.children,n=pZ(e,fZ);return N.createElement(hZ.Provider,{value:n},t)}function _Z(e,t){var n=Z(t=>jz(t,e)),r=Z(e=>Pz(e,t)),i=n?.allowDataOverflow??kz.allowDataOverflow,a=r?.allowDataOverflow??Mz.allowDataOverflow;return{needClip:i||a,needClipX:i,needClipY:a}}function vZ(e){var t=e.xAxisId,n=e.yAxisId,r=e.clipPathId,i=FJ(),a=_Z(t,n),o=a.needClipX,s=a.needClipY,c=a.needClip,l=Z(e=>iV(e,t,!1)),u=Z(e=>aV(e,n,!1));if(!c||!i)return null;var d=i.x,f=i.y,p=i.width,m=i.height,h=o&&l?Math.min(l[0],l[1]):d-p/2,g=s&&u?Math.min(u[0],u[1]):f-m/2,_=o&&l?Math.abs(l[1]-l[0]):p*2,v=s&&u?Math.abs(u[1]-u[0]):m*2;return N.createElement(`clipPath`,{id:`clipPath-${r}`},N.createElement(`rect`,{x:h,y:g,width:_,height:v}))}var yZ=(e,t,n,r)=>MV(e,`xAxis`,t,r),bZ=(e,t,n,r)=>jV(e,`xAxis`,t,r),xZ=(e,t,n,r)=>MV(e,`yAxis`,n,r),SZ=(e,t,n,r)=>jV(e,`yAxis`,n,r),CZ=Q([SO,yZ,xZ,bZ,SZ],(e,t,n,r,i)=>ZE(e,`xAxis`)?lD(t,r,!1):lD(n,i,!1)),wZ=(e,t,n,r,i)=>i;function TZ(e){return e.type===`line`}var EZ=Q([SO,yZ,xZ,bZ,SZ,Q([Hz,wZ],(e,t)=>e.filter(TZ).find(e=>e.id===t)),CZ,dM],(e,t,n,r,i,a,o,s)=>{var c=s.chartData,l=s.dataStartIndex,u=s.dataEndIndex;if(!(a==null||t==null||n==null||r==null||i==null||r.length===0||i.length===0||o==null||e!==`horizontal`&&e!==`vertical`)){var d=a.dataKey,f=a.data,p=f!=null&&f.length>0?f:c?.slice(l,u+1);if(p!=null)return QZ({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataKey:d,bandSize:o,displayedData:p})}});function DZ(e){var t=Fy(e),n=3,r=2;if(t!=null){var i=t.r,a=t.strokeWidth,o=Number(i),s=Number(a);return(Number.isNaN(o)||o<0)&&(o=n),(Number.isNaN(s)||s<0)&&(s=r),{r:o,strokeWidth:s}}return{r:n,strokeWidth:r}}var OZ=[`id`],kZ=[`type`,`layout`,`connectNulls`,`needClip`,`shape`,`strokeDasharray`],AZ=[`activeDot`,`animateNewValues`,`animationBegin`,`animationDuration`,`animationEasing`,`connectNulls`,`dot`,`hide`,`isAnimationActive`,`label`,`legendType`,`xAxisId`,`yAxisId`,`id`];function jZ(){return jZ=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},jZ.apply(null,arguments)}function MZ(e,t){if(e==null)return{};var n,r,i=NZ(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function NZ(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function PZ(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function FZ(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?PZ(Object(n),!0).forEach(function(t){IZ(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):PZ(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function IZ(e,t,n){return(t=LZ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function LZ(e){var t=RZ(e,`string`);return typeof t==`symbol`?t:t+``}function RZ(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function zZ(e){try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch{return 0}}function BZ(e){var t=0,n=0;for(var r of e)r.status===`matched`&&r.prev.x!=null&&r.next.x!=null&&(t+=r.next.x-r.prev.x,n++);return n>0?t/n:0}var VZ={activeDot:!0,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:`ease`,animationInterpolateFn:(e,t)=>{if(e==null)return[];if(t===1)return e.flatMap(e=>e.status===`removed`?[]:[e.next]);var n=BZ(e),r=[];for(var i of e)if(i.status===`matched`)r.push(FZ(FZ({},i.next),{},{x:mb(i.prev.x,i.next.x,t),y:mb(i.prev.y,i.next.y,t)}));else if(i.status===`added`){if(i.next.x!=null){var a=i.next.x-n;r.push(FZ(FZ({},i.next),{},{x:mb(a,i.next.x,t),y:i.next.y}))}else r.push(i.next)}else if(i.status===`removed`&&i.prev.x!=null){var o=i.prev.x+n;r.push(FZ(FZ({},i.prev),{},{x:mb(i.prev.x,o,t),y:i.prev.y}))}return r},animationMatchBy:Dq,connectNulls:!1,dot:!0,fill:`#fff`,hide:!1,isAnimationActive:`auto`,label:!1,legendType:`line`,shape:sZ,stroke:`#3182bd`,strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:YM.line,type:`linear`},HZ=e=>{var t=e.dataKey,n=e.name,r=e.stroke,i=e.legendType;return[{inactive:e.hide,dataKey:t,type:i,color:r,value:dD(n,t),payload:e}]},UZ=N.memo(e=>{var t=e.dataKey,n=e.data,r=e.stroke,i=e.strokeWidth,a=e.fill,o=e.name,s=e.hide,c=e.unit,l=e.formatter,u=e.tooltipType,d=e.id,f={dataDefinedOnItem:n,getPosition:yb,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:dD(o,t),hide:s,type:u,color:r,unit:c,formatter:l,graphicalItemId:d}};return N.createElement(yq,{tooltipEntrySettings:f})});function WZ(e){var t=e.clipPathId,n=e.points,r=e.props,i=r.dot,a=r.dataKey,o=r.needClip;r.id;var s=Py(MZ(r,OZ));return N.createElement(_J,{points:n,dot:i,className:`recharts-line-dots`,dotClassName:`recharts-line-dot`,dataKey:a,baseProps:s,needClip:o,clipPathId:t})}function GZ(e){var t=e.showLabels,n=e.children,r=e.points,i=(0,N.useMemo)(()=>r?.map(e=>{var t={x:e.x??0,y:e.y??0,width:0,lowerWidth:0,upperWidth:0,height:0};return FZ(FZ({},t),{},{value:e.value,payload:e.payload,viewBox:t,parentViewBox:void 0,fill:void 0})}),[r]);return N.createElement(YK,{value:t?i:void 0},n)}function KZ(e){var t=e.clipPathId,n=e.pathRef,r=e.points,i=e.props,a=e.animationElapsedTime,o=e.isAnimating,s=e.isEntrance,c=e.visibleLength,l=i.type,u=i.layout,d=i.connectNulls,f=i.needClip,p=i.shape,m=i.strokeDasharray,h=FZ(FZ({},Iy(MZ(i,kZ))),{},{fill:`none`,className:`recharts-line-curve`,clipPath:f?`url(#clipPath-${t})`:void 0,points:r,type:l,layout:u,connectNulls:d,strokeDasharray:m??i.strokeDasharray,pathRef:n,animationElapsedTime:a,isAnimating:o,isEntrance:i.animateNewValues?s:!1,visibleLength:c});return N.createElement(N.Fragment,null,r?.length>1&&N.createElement(vq,{option:p,DefaultShape:VZ.shape,shapeProps:h}),N.createElement(WZ,{points:r,clipPathId:t,props:i}))}function qZ(e){var t=e.clipPathId,n=e.props,r=e.pathRef,i=e.previousPointsRef,a=n.points,o=n.isAnimationActive,s=n.animationBegin,c=n.animationDuration,l=n.animationEasing,u=n.animationMatchBy,d=n.animationInterpolateFn,f=n.layout,p=zZ(r.current),m=Vq(n.onAnimationStart,n.onAnimationEnd),h=m.isAnimating,g=m.handleAnimationStart,_=m.handleAnimationEnd,v=!h,y=cZ(a),b=(0,N.useCallback)(e=>e>0&&p>0,[p]);return N.createElement(GZ,{points:a,showLabels:v},n.children,N.createElement(Hq,{animationInput:a,animationIdPrefix:`recharts-line-`,items:a,previousItemsRef:i,isAnimationActive:o,animationBegin:s,animationDuration:c,animationEasing:l,onAnimationStart:g,onAnimationEnd:_,animationInterpolateFn:d,animationMatchBy:u,shouldUpdatePreviousRef:b,layout:f},(e,i,a)=>{var o=h||i<1,s=o?y(i,p):null;return N.createElement(KZ,{props:n,points:e,clipPathId:t,pathRef:r,animationElapsedTime:i,isAnimating:o,isEntrance:a,visibleLength:s})}),N.createElement(eq,{label:n.label}))}function JZ(e){var t=e.clipPathId,n=e.props,r=(0,N.useRef)(null),i=(0,N.useRef)(null);return N.createElement(qZ,{props:n,clipPathId:t,previousPointsRef:r,pathRef:i})}var YZ=(e,t)=>({x:e.x??void 0,y:e.y??void 0,value:e.value,errorVal:YE(e.payload,t)}),XZ=class extends N.Component{render(){var e=this.props,t=e.hide,n=e.dot,r=e.points,i=e.className,a=e.xAxisId,o=e.yAxisId,s=e.top,c=e.left,l=e.width,u=e.height,d=e.id,f=e.needClip,p=e.zIndex;if(t)return null;var m=R(`recharts-line`,i),h=d,g=DZ(n),_=g.r,v=g.strokeWidth,y=sq(n),b=_*2+v,x=f?`url(#clipPath-${y?``:`dots-`}${h})`:void 0;return N.createElement(rW,{zIndex:p},N.createElement(qy,{className:m},f&&N.createElement(`defs`,null,N.createElement(vZ,{clipPathId:h,xAxisId:a,yAxisId:o}),!y&&N.createElement(`clipPath`,{id:`clipPath-dots-${h}`},N.createElement(`rect`,{x:c-b/2,y:s-b/2,width:l+b,height:u+b}))),N.createElement(gZ,{xAxisId:a,yAxisId:o,data:r,dataPointFormatter:YZ,errorBarOffset:0},N.createElement(JZ,{props:this.props,clipPathId:h}))),N.createElement(UJ,{activeDot:this.props.activeDot,points:r,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:x}))}};function ZZ(e){var t=Rx(e,VZ),n=t.activeDot,r=t.animateNewValues,i=t.animationBegin,a=t.animationDuration,o=t.animationEasing,s=t.connectNulls,c=t.dot,l=t.hide,u=t.isAnimationActive,d=t.label,f=t.legendType,p=t.xAxisId,m=t.yAxisId,h=t.id,g=MZ(t,AZ),_=_Z(p,m).needClip,v=FJ(),y=CO(),b=FD(),x=Z(e=>EZ(e,p,m,b,h));if(y!==`horizontal`&&y!==`vertical`||x==null||v==null)return null;var S=v.height,C=v.width,w=v.x,T=v.y;return N.createElement(XZ,jZ({},g,{id:h,connectNulls:s,dot:c,activeDot:n,animateNewValues:r,animationBegin:i,animationDuration:a,animationEasing:o,isAnimationActive:u,hide:l,label:d,legendType:f,xAxisId:p,yAxisId:m,points:x,layout:y,height:S,width:C,left:w,top:T,needClip:_}))}function QZ(e){var t=e.layout,n=e.xAxis,r=e.yAxis,i=e.xAxisTicks,a=e.yAxisTicks,o=e.dataKey,s=e.bandSize;return e.displayedData.map((e,c)=>{var l=YE(e,o);if(t===`horizontal`)return{x:rD({axis:n,ticks:i,bandSize:s,entry:e,index:c}),y:(gb(l)?null:r.scale.map(l))??null,value:l,payload:e};var u=gb(l)?null:n.scale.map(l),d=rD({axis:r,ticks:a,bandSize:s,entry:e,index:c});return u==null||d==null?null:{x:u,y:d,value:l,payload:e}}).filter(Boolean)}function $Z(e){var t=Rx(e,VZ),n=FD();return N.createElement(Qq,{id:t.id,type:`line`},e=>N.createElement(N.Fragment,null,N.createElement(bq,{legendPayload:HZ(t)}),N.createElement(UZ,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,formatter:t.formatter,tooltipType:t.tooltipType,id:e}),N.createElement(aJ,{type:`line`,id:e,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:n}),N.createElement(ZZ,jZ({},t,{id:e}))))}var eQ=N.memo($Z,QO);eQ.displayName=`Line`;function tQ(e,t){return e.graphicalItems.cartesianItems.find(e=>e.id===t)?.xAxisId??0}function nQ(e,t){return e.graphicalItems.cartesianItems.find(e=>e.id===t)?.yAxisId??0}var rQ=(e,t,n)=>MV(e,`xAxis`,tQ(e,t),n),iQ=(e,t,n)=>jV(e,`xAxis`,tQ(e,t),n),aQ=(e,t,n)=>MV(e,`yAxis`,nQ(e,t),n),oQ=(e,t,n)=>jV(e,`yAxis`,nQ(e,t),n),sQ=Q([SO,rQ,aQ,iQ,oQ],(e,t,n,r,i)=>ZE(e,`xAxis`)?lD(t,r,!1):lD(n,i,!1)),cQ=Q([Hz,(e,t)=>t],(e,t)=>e.filter(e=>e.type===`area`).find(e=>e.id===t)),lQ=e=>ZE(SO(e),`xAxis`)?`yAxis`:`xAxis`,uQ=(e,t)=>lQ(e)===`yAxis`?nQ(e,t):tQ(e,t),dQ=(e,t,n)=>mB(e,lQ(e),uQ(e,t),n),fQ=Q([SO,rQ,aQ,iQ,oQ,Q([cQ,dQ],(e,t)=>{if(e!=null&&t!=null){var n=e.stackId,r=vN(e);if(n!=null&&r!=null){var i=(t[n]?.stackedData)?.find(e=>e.key===r);if(i!=null)return i.map(e=>[e[0],e[1]])}}}),fM,sQ,cQ,JM,Q([cQ,dQ],(e,t)=>{if(e!=null&&e.stackId!=null&&t!=null){var n=t[e.stackId];if(n!=null)return n.graphicalItems.map(e=>e.dataKey).filter(vb)}})],(e,t,n,r,i,a,o,s,c,l,u)=>{var d=o.chartData,f=o.dataStartIndex,p=o.dataEndIndex;if(!(c==null||e!==`horizontal`&&e!==`vertical`||t==null||n==null||r==null||i==null||r.length===0||i.length===0||s==null)){var m=c.data,h=m&&m.length>0?m:d?.slice(f,p+1);if(h!=null)return GQ({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataStartIndex:f,areaSettings:c,stackedData:a,displayedData:h,chartBaseValue:l,bandSize:s,stackDataKeys:u})}}),pQ=[`animationElapsedTime`,`isAnimating`,`isEntrance`,`layout`,`isRange`,`stroke`,`connectNulls`],mQ=[`id`,`baseLine`];function hQ(){return hQ=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},hQ.apply(null,arguments)}function gQ(e,t){if(e==null)return{};var n,r,i=_Q(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function _Q(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function vQ(e){var t=e.alpha,n=e.baseLine,r=e.points,i=e.strokeWidth,a=r[0]?.x,o=r[r.length-1]?.x;if(!$(a)||!$(o))return null;var s=t*Math.abs(a-o),c=Math.max(...r.map(e=>e.y||0));return X(n)?c=Math.max(n,c):n&&Array.isArray(n)&&n.length&&(c=Math.max(...n.map(e=>e.y||0),c)),X(c)?N.createElement(`rect`,{x:a<o?a:a-s,y:0,width:s,height:Math.floor(c+(i?parseInt(`${i}`,10):1))}):null}function yQ(e){var t=e.alpha,n=e.baseLine,r=e.points,i=e.strokeWidth,a=r[0]?.y,o=r[r.length-1]?.y;if(!$(a)||!$(o))return null;var s=t*Math.abs(a-o),c=Math.max(...r.map(e=>e.x||0));return X(n)?c=Math.max(n,c):n&&Array.isArray(n)&&n.length&&(c=Math.max(...n.map(e=>e.x||0),c)),X(c)?N.createElement(`rect`,{x:0,y:a<o?a:a-s,width:c+(i?parseInt(`${i}`,10):1),height:Math.floor(s)}):null}function bQ(e){var t=e.alpha,n=e.layout,r=e.points,i=e.baseLine,a=e.strokeWidth;return n===`vertical`?N.createElement(yQ,{alpha:t,points:r,baseLine:i,strokeWidth:a}):N.createElement(vQ,{alpha:t,points:r,baseLine:i,strokeWidth:a})}function xQ(e){var t=e.animationElapsedTime,n=t===void 0?1:t,r=e.isAnimating,i=r!==void 0&&r,a=e.isEntrance,o=a!==void 0&&a,s=e.layout,c=e.isRange,l=e.stroke,u=e.connectNulls,d=gQ(e,pQ),f=s===`vertical`?`vertical`:`horizontal`,p=u??!1,m=Yq(),h=d.id,g=d.baseLine,_=Py(gQ(d,mQ)),v=N.createElement(iA,hQ({},d,{id:h,baseLine:g,connectNulls:p,stroke:`none`,className:`recharts-area-area`,layout:f})),y=l!==`none`&&N.createElement(iA,hQ({},_,{className:`recharts-area-curve`,layout:f,type:d.type,connectNulls:p,fill:`none`,stroke:l,points:d.points})),b=l!==`none`&&c&&Array.isArray(g)&&N.createElement(iA,hQ({},_,{className:`recharts-area-curve`,layout:f,type:d.type,connectNulls:p,fill:`none`,stroke:l,points:g}));return o&&(i||n<1)?N.createElement(qy,null,N.createElement(`defs`,null,N.createElement(`clipPath`,{id:m},N.createElement(bQ,{alpha:n,points:d.points??[],baseLine:g,layout:f,strokeWidth:d.strokeWidth}))),N.createElement(qy,{clipPath:`url(#${m})`},v,y,b)):N.createElement(N.Fragment,null,v,y,b)}var SQ=[`id`],CQ=[`activeDot`,`animationBegin`,`animationDuration`,`animationEasing`,`connectNulls`,`dot`,`fill`,`fillOpacity`,`hide`,`isAnimationActive`,`legendType`,`stroke`,`xAxisId`,`yAxisId`];function wQ(){return wQ=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},wQ.apply(null,arguments)}function TQ(e,t){if(e==null)return{};var n,r,i=EQ(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function EQ(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function DQ(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function OQ(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?DQ(Object(n),!0).forEach(function(t){kQ(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):DQ(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function kQ(e,t,n){return(t=AQ(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function AQ(e){var t=jQ(e,`string`);return typeof t==`symbol`?t:t+``}function jQ(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var MQ={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:`ease`,animationMatchBy:Dq,animationInterpolateFn:(e,t)=>e==null?[]:t===1?e.flatMap(e=>e.status===`removed`?[]:[e.next]):e.flatMap(e=>e.status===`matched`?[OQ(OQ({},e.next),{},{x:mb(e.prev.x,e.next.x,t),y:mb(e.prev.y,e.next.y,t)})]:e.status===`added`?[e.next]:[]),connectNulls:!1,dot:!1,fill:`#3182bd`,fillOpacity:.6,hide:!1,isAnimationActive:`auto`,legendType:`line`,stroke:`#3182bd`,strokeWidth:1,type:`linear`,label:!1,shape:xQ,xAxisId:0,yAxisId:0,zIndex:YM.area};function NQ(e,t){return e&&e!==`none`?e:t}var PQ=e=>{var t=e.dataKey,n=e.name,r=e.stroke,i=e.fill,a=e.legendType;return[{inactive:e.hide,dataKey:t,type:a,color:NQ(r,i),value:dD(n,t),payload:e}]},FQ=N.memo(e=>{var t=e.dataKey,n=e.data,r=e.stroke,i=e.strokeWidth,a=e.fill,o=e.name,s=e.hide,c=e.unit,l=e.formatter,u=e.tooltipType,d=e.id,f={dataDefinedOnItem:n,getPosition:yb,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:dD(o,t),hide:s,type:u,color:NQ(r,a),unit:c,formatter:l,graphicalItemId:d}};return N.createElement(yq,{tooltipEntrySettings:f})});function IQ(e){var t=e.clipPathId,n=e.points,r=e.props,i=r.needClip,a=r.dot,o=r.dataKey,s=Py(r);return N.createElement(_J,{points:n,dot:a,className:`recharts-area-dots`,dotClassName:`recharts-area-dot`,dataKey:o,baseProps:s,needClip:i,clipPathId:t})}function LQ(e){var t=e.showLabels,n=e.children,r=e.points.map(e=>{var t={x:e.x??0,y:e.y??0,width:0,lowerWidth:0,upperWidth:0,height:0};return OQ(OQ({},t),{},{value:e.value,payload:e.payload,parentViewBox:void 0,viewBox:t,fill:void 0})});return N.createElement(YK,{value:t?r:void 0},n)}function RQ(e){var t=e.points,n=e.baseLine,r=e.needClip,i=e.clipPathId,a=e.props,o=e.animationElapsedTime,s=e.isAnimating,c=e.isEntrance,l=a.layout,u=a.type,d=a.stroke,f=a.connectNulls,p=a.isRange,m=a.shape,h=a.id,g=TQ(a,SQ),_=OQ(OQ({},Iy(g)),{},{id:h,points:t,connectNulls:f,type:u,baseLine:n,layout:l,stroke:d,isRange:p,animationElapsedTime:o,isAnimating:s,isEntrance:c});return N.createElement(N.Fragment,null,t?.length>1&&N.createElement(qy,{clipPath:r?`url(#clipPath-${i})`:void 0},N.createElement(vq,{option:m,DefaultShape:MQ.shape,shapeProps:_})),N.createElement(IQ,{points:t,props:g,clipPathId:i}))}function zQ(e,t,n){return X(e)?mb(X(t)?t:void 0,e,n):gb(e)||sb(e)?mb(X(t)?t:void 0,0,n):e}function BQ(e){var t=e.needClip,n=e.clipPathId,r=e.props,i=e.previousPointsRef,a=e.previousBaselineRef,o=r.points,s=r.baseLine,c=r.isAnimationActive,l=r.animationBegin,u=r.animationDuration,d=r.animationEasing,f=r.animationMatchBy,p=r.animationInterpolateFn,m=(0,N.useMemo)(()=>({points:o,baseLine:s}),[o,s]),h=Pq(m,a),g=wO(),_=Vq(r.onAnimationStart,r.onAnimationEnd),v=_.isAnimating,y=_.handleAnimationStart,b=_.handleAnimationEnd,x=h.startValue;if(g==null)return null;var S=Array.isArray(s)&&Array.isArray(x)?Nq(x,s,f):Array.isArray(s)?Nq(null,s,f):null;return N.createElement(Hq,{animationInput:m,animationIdPrefix:`recharts-area-`,items:o,previousItemsRef:i,isAnimationActive:c,animationBegin:l,animationDuration:u,animationEasing:d,onAnimationStart:y,onAnimationEnd:b,animationInterpolateFn:p,animationMatchBy:f,layout:g},(e,i,a)=>{var c=i===1?s:Array.isArray(s)?p(S,i,g):a?s:zQ(s,x,i);return h.syncStepValue(c,i),N.createElement(LQ,{showLabels:!v,points:o},r.children,N.createElement(RQ,{points:e,baseLine:c,needClip:t,clipPathId:n,props:r,animationElapsedTime:i,isAnimating:v||i<1,isEntrance:a}),N.createElement(eq,{label:r.label}))})}function VQ(e){var t=e.needClip,n=e.clipPathId,r=e.props,i=(0,N.useRef)(null),a=(0,N.useRef)();return N.createElement(BQ,{needClip:t,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:a})}var HQ=class extends N.PureComponent{render(){var e=this.props,t=e.hide,n=e.dot,r=e.points,i=e.className,a=e.top,o=e.left,s=e.needClip,c=e.xAxisId,l=e.yAxisId,u=e.width,d=e.height,f=e.id,p=e.baseLine,m=e.zIndex;if(t)return null;var h=R(`recharts-area`,i),g=f,_=DZ(n),v=_.r,y=_.strokeWidth,b=sq(n),x=v*2+y,S=s?`url(#clipPath-${b?``:`dots-`}${g})`:void 0;return N.createElement(rW,{zIndex:m},N.createElement(qy,{className:h},s&&N.createElement(`defs`,null,N.createElement(vZ,{clipPathId:g,xAxisId:c,yAxisId:l}),!b&&N.createElement(`clipPath`,{id:`clipPath-dots-${g}`},N.createElement(`rect`,{x:o-x/2,y:a-x/2,width:u+x,height:d+x}))),N.createElement(VQ,{needClip:s,clipPathId:g,props:this.props})),N.createElement(UJ,{points:r,mainColor:NQ(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:S}),this.props.isRange&&Array.isArray(p)&&N.createElement(UJ,{points:p,mainColor:NQ(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:S}))}};function UQ(e){var t=e.activeDot,n=e.animationBegin,r=e.animationDuration,i=e.animationEasing,a=e.connectNulls,o=e.dot,s=e.fill,c=e.fillOpacity,l=e.hide,u=e.isAnimationActive,d=e.legendType,f=e.stroke,p=e.xAxisId,m=e.yAxisId,h=TQ(e,CQ),g=CO(),_=CU(),v=_Z(p,m).needClip,y=FD(),b=Z(t=>fQ(t,e.id,y))??{},x=b.points,S=b.isRange,C=b.baseLine,w=FJ();if(g!==`horizontal`&&g!==`vertical`||w==null||_!==`AreaChart`&&_!==`ComposedChart`)return null;var T=w.height,E=w.width,D=w.x,O=w.y;return!x||!x.length?null:N.createElement(HQ,wQ({},h,{activeDot:t,animationBegin:n,animationDuration:r,animationEasing:i,baseLine:C,connectNulls:a,dot:o,fill:s,fillOpacity:c,height:T,hide:l,layout:g,isAnimationActive:u,isRange:S,legendType:d,needClip:v,points:x,stroke:f,width:E,left:D,top:O,xAxisId:p,yAxisId:m}))}var WQ=(e,t,n,r,i)=>{var a=n??t;if(X(a))return a;var o=e===`horizontal`?i:r,s=o.scale.domain();if(o.type===`number`){var c=Math.max(s[0],s[1]),l=Math.min(s[0],s[1]);return a===`dataMin`?l:a===`dataMax`||c<0?c:Math.max(Math.min(s[0],s[1]),0)}return a===`dataMin`?s[0]:a===`dataMax`?s[1]:s[0]};function GQ(e){var t=e.areaSettings,n=t.connectNulls,r=t.baseValue,i=t.dataKey,a=e.stackedData,o=e.layout,s=e.chartBaseValue,c=e.xAxis,l=e.yAxis,u=e.displayedData,d=e.dataStartIndex,f=e.xAxisTicks,p=e.yAxisTicks,m=e.bandSize,h=e.stackDataKeys,g=a&&a.length,_=WQ(o,s,r,c,l),v=o===`horizontal`,y=!1,b=u.map((e,t)=>{var r;if(g)r=a[d+t];else{var o=YE(e,i);Array.isArray(o)?(r=o,y=!0):r=[_,o]}var s=r?.[1]??null,u=YE(e,i),b=g&&u==null&&h!=null&&h.length>0&&h.every(t=>YE(e,t)==null),x=s==null||g&&!n&&u==null||b;return v?{x:rD({axis:c,ticks:f,bandSize:m,entry:e,index:t}),y:x?null:l.scale.map(s)??null,value:r,payload:e}:{x:x?null:c.scale.map(s)??null,y:rD({axis:l,ticks:p,bandSize:m,entry:e,index:t}),value:r,payload:e}});return{points:b,baseLine:(g||y?b.map(e=>{var t=Array.isArray(e.value)?e.value[0]:null;return v?{x:e.x,y:t!=null&&e.y!=null?l.scale.map(t)??null:null,payload:e.payload}:{x:t==null?null:c.scale.map(t)??null,y:e.y,payload:e.payload}}):v?l.scale.map(_):c.scale.map(_))??0,isRange:y}}function KQ(e){var t=Rx(e,MQ),n=FD();return N.createElement(Qq,{id:t.id,type:`area`},e=>N.createElement(N.Fragment,null,N.createElement(bq,{legendPayload:PQ(t)}),N.createElement(FQ,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,formatter:t.formatter,tooltipType:t.tooltipType,id:e}),N.createElement(aJ,{type:`area`,id:e,data:t.data,dataKey:t.dataKey,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,stackId:nD(t.stackId),hide:t.hide,barSize:void 0,baseValue:t.baseValue,isPanorama:n,connectNulls:t.connectNulls}),N.createElement(UQ,wQ({},t,{id:e}))))}var qQ=N.memo(KQ,QO);qQ.displayName=`Area`;var JQ=[`domain`,`range`],YQ=[`domain`,`range`];function XQ(e,t){if(e==null)return{};var n,r,i=ZQ(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function ZQ(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function QQ(e,t){return e===t?!0:Array.isArray(e)&&e.length===2&&Array.isArray(t)&&t.length===2?e[0]===t[0]&&e[1]===t[1]:!1}function $Q(e,t){if(e===t)return!0;var n=e.domain,r=e.range,i=XQ(e,JQ),a=t.domain,o=t.range,s=XQ(t,YQ);return!QQ(n,a)||!QQ(r,o)?!1:QO(i,s)}var e$=[`type`],t$=[`dangerouslySetInnerHTML`,`ticks`,`scale`],n$=[`id`,`scale`];function r$(){return r$=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},r$.apply(null,arguments)}function i$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function a$(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?i$(Object(n),!0).forEach(function(t){o$(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i$(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function o$(e,t,n){return(t=s$(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s$(e){var t=c$(e,`string`);return typeof t==`symbol`?t:t+``}function c$(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function l$(e,t){if(e==null)return{};var n,r,i=u$(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function u$(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function d$(e){var t=nC(),n=(0,N.useRef)(null),r=wO(),i=e.type,a=l$(e,e$),o=$M(r,`xAxis`,i),s=(0,N.useMemo)(()=>{if(o!=null)return a$(a$({},a),{},{type:o})},[a,o]);return(0,N.useLayoutEffect)(()=>{s!=null&&(n.current===null?t(TJ(s)):n.current!==s&&t(EJ({prev:n.current,next:s})),n.current=s)},[s,t]),(0,N.useLayoutEffect)(()=>()=>{n.current&&=(t(DJ(n.current)),null)},[t]),null}var f$=e=>{var t=e.xAxisId,n=e.className,r=e.height,i=e.label,a=(0,N.useRef)(null),o=(0,N.useRef)(null),s=Z(ND),c=FD(),l=nC(),u=`xAxis`,d=Z(e=>AV(e,u,t,c)),f=Z(e=>yV(e,t)),p=Z(e=>wV(e,t)),m=Z(e=>Az(e,t));if((0,N.useLayoutEffect)(()=>{if(!(r!==`auto`||!f||MK(i)||(0,N.isValidElement)(i)||m==null)){var e=a.current;if(e){var n=e.getCalculatedHeight();Math.round(f.height)!==Math.round(n)&&l(MJ({id:t,height:n}))}}},[d,f,l,i,t,r,m]),f==null||p==null||m==null)return null;e.dangerouslySetInnerHTML,e.ticks,e.scale;var h=l$(e,t$);m.id,m.scale;var g=l$(m,n$);return N.createElement(EX,r$({},h,g,{ref:a,labelRef:o,x:p.x,y:p.y,width:f.width,height:f.height,className:R(`recharts-${u} ${u}`,n),viewBox:s,ticks:d,axisType:u,axisId:t}))},p$={allowDataOverflow:kz.allowDataOverflow,allowDecimals:kz.allowDecimals,allowDuplicatedCategory:kz.allowDuplicatedCategory,angle:kz.angle,axisLine:_X.axisLine,height:kz.height,hide:!1,includeHidden:kz.includeHidden,interval:kz.interval,label:!1,minTickGap:kz.minTickGap,mirror:kz.mirror,orientation:kz.orientation,padding:kz.padding,reversed:kz.reversed,scale:kz.scale,tick:kz.tick,tickCount:kz.tickCount,tickLine:_X.tickLine,tickSize:_X.tickSize,type:kz.type,niceTicks:kz.niceTicks,xAxisId:0},m$=N.memo(e=>{var t=Rx(e,p$);return N.createElement(N.Fragment,null,N.createElement(d$,{allowDataOverflow:t.allowDataOverflow,allowDecimals:t.allowDecimals,allowDuplicatedCategory:t.allowDuplicatedCategory,angle:t.angle,dataKey:t.dataKey,domain:t.domain,height:t.height,hide:t.hide,id:t.xAxisId,includeHidden:t.includeHidden,interval:t.interval,minTickGap:t.minTickGap,mirror:t.mirror,name:t.name,orientation:t.orientation,padding:t.padding,reversed:t.reversed,scale:t.scale,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,niceTicks:t.niceTicks}),N.createElement(f$,t))},$Q);m$.displayName=`XAxis`;var h$=[`type`],g$=[`dangerouslySetInnerHTML`,`ticks`,`scale`],_$=[`id`,`scale`];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)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},v$.apply(null,arguments)}function y$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function b$(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?y$(Object(n),!0).forEach(function(t){x$(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):y$(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function x$(e,t,n){return(t=S$(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function S$(e){var t=C$(e,`string`);return typeof t==`symbol`?t:t+``}function C$(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function w$(e,t){if(e==null)return{};var n,r,i=T$(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function T$(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function E$(e){var t=nC(),n=(0,N.useRef)(null),r=wO(),i=e.type,a=w$(e,h$),o=$M(r,`yAxis`,i),s=(0,N.useMemo)(()=>{if(o!=null)return b$(b$({},a),{},{type:o})},[o,a]);return(0,N.useLayoutEffect)(()=>{s!=null&&(n.current===null?t(OJ(s)):n.current!==s&&t(kJ({prev:n.current,next:s})),n.current=s)},[s,t]),(0,N.useLayoutEffect)(()=>()=>{n.current&&=(t(AJ(n.current)),null)},[t]),null}function D$(e){var t=e.yAxisId,n=e.className,r=e.width,i=e.label,a=(0,N.useRef)(null),o=(0,N.useRef)(null),s=Z(ND),c=FD(),l=nC(),u=`yAxis`,d=Z(e=>EV(e,t)),f=Z(e=>TV(e,t)),p=Z(e=>AV(e,u,t,c)),m=Z(e=>Nz(e,t));if((0,N.useLayoutEffect)(()=>{if(!(r!==`auto`||!d||MK(i)||(0,N.isValidElement)(i)||m==null)){var e=a.current;if(e){var n=e.getCalculatedWidth();Math.round(d.width)!==Math.round(n)&&l(jJ({id:t,width:n}))}}},[p,d,l,i,t,r,m]),d==null||f==null||m==null)return null;e.dangerouslySetInnerHTML,e.ticks,e.scale;var h=w$(e,g$);m.id,m.scale;var g=w$(m,_$);return N.createElement(EX,v$({},h,g,{ref:a,labelRef:o,x:f.x,y:f.y,tickTextProps:r===`auto`?{width:void 0}:{width:r},width:d.width,height:d.height,className:R(`recharts-${u} ${u}`,n),viewBox:s,ticks:p,axisType:u,axisId:t}))}var O$={allowDataOverflow:Mz.allowDataOverflow,allowDecimals:Mz.allowDecimals,allowDuplicatedCategory:Mz.allowDuplicatedCategory,angle:Mz.angle,axisLine:_X.axisLine,hide:!1,includeHidden:Mz.includeHidden,interval:Mz.interval,label:!1,minTickGap:Mz.minTickGap,mirror:Mz.mirror,orientation:Mz.orientation,padding:Mz.padding,reversed:Mz.reversed,scale:Mz.scale,tick:Mz.tick,tickCount:Mz.tickCount,tickLine:_X.tickLine,tickSize:_X.tickSize,type:Mz.type,niceTicks:Mz.niceTicks,width:Mz.width,yAxisId:0},k$=N.memo(e=>{var t=Rx(e,O$);return N.createElement(N.Fragment,null,N.createElement(E$,{interval:t.interval,id:t.yAxisId,scale:t.scale,type:t.type,domain:t.domain,allowDataOverflow:t.allowDataOverflow,dataKey:t.dataKey,allowDuplicatedCategory:t.allowDuplicatedCategory,allowDecimals:t.allowDecimals,tickCount:t.tickCount,padding:t.padding,includeHidden:t.includeHidden,reversed:t.reversed,ticks:t.ticks,width:t.width,orientation:t.orientation,mirror:t.mirror,hide:t.hide,unit:t.unit,name:t.name,angle:t.angle,minTickGap:t.minTickGap,tick:t.tick,tickFormatter:t.tickFormatter,niceTicks:t.niceTicks}),N.createElement(D$,t))},$Q);k$.displayName=`YAxis`;var A$=Q([(e,t)=>t,SO,hN,wN,KH,JH,DU,jD],zU);function j$(e){return`getBBox`in e.currentTarget&&typeof e.currentTarget.getBBox==`function`}function M$(e){var t=e.currentTarget.getBoundingClientRect(),n,r;if(j$(e)){var i=e.currentTarget.getBBox();n=i.width>0?t.width/i.width:1,r=i.height>0?t.height/i.height:1}else{var a=e.currentTarget;n=a.offsetWidth>0?t.width/a.offsetWidth:1,r=a.offsetHeight>0?t.height/a.offsetHeight:1}var o=(e,i)=>({relativeX:Math.round((e-t.left)/n),relativeY:Math.round((i-t.top)/r)});return`touches`in e?Array.from(e.touches).map(e=>o(e.clientX,e.clientY)):o(e.clientX,e.clientY)}var N$=TT(`mouseClick`),P$=NE();P$.startListening({actionCreator:N$,effect:(e,t)=>{var n=e.payload,r=A$(t.getState(),M$(n));r?.activeIndex!=null&&t.dispatch(ZV({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var F$=TT(`mouseMove`),I$=NE(),L$=null,R$=null,z$=null;I$.startListening({actionCreator:F$,effect:(e,t)=>{var n=e.payload,r=t.getState().eventSettings,i=r.throttleDelay,a=r.throttledEvents,o=a===`all`||a?.includes(`mousemove`);L$!==null&&(cancelAnimationFrame(L$),L$=null),R$!==null&&(typeof i!=`number`||!o)&&(clearTimeout(R$),R$=null),z$=M$(n);var s=()=>{var e=t.getState(),n=LV(e,e.tooltip.settings.shared);if(!z$){L$=null,R$=null;return}if(n===`axis`){var r=A$(e,z$);r?.activeIndex==null?t.dispatch(YV()):t.dispatch(XV({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}L$=null,R$=null};if(!o){s();return}i===`raf`?L$=requestAnimationFrame(s):typeof i==`number`&&R$===null&&(R$=setTimeout(s,i))}});function B$(e,t){return t instanceof HTMLElement?`HTMLElement <${t.tagName} class="${t.className}">`:t===window?`global.window`:e===`children`&&typeof t==`object`&&t?`<<CHILDREN>>`:t}var V$={accessibilityLayer:!0,barCategoryGap:`10%`,barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:`none`,syncId:void 0,syncMethod:`index`,baseValue:void 0,reverseStackOrder:!1},H$=qT({name:`rootProps`,initialState:V$,reducers:{updateOptions:(e,t)=>{e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=t.payload.barGap??V$.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue,e.reverseStackOrder=t.payload.reverseStackOrder}}}),U$=H$.reducer,W$=H$.actions.updateOptions,G$=qT({name:`polarOptions`,initialState:null,reducers:{updatePolarOptions:(e,t)=>e===null?t.payload:(e.startAngle=t.payload.startAngle,e.endAngle=t.payload.endAngle,e.cx=t.payload.cx,e.cy=t.payload.cy,e.innerRadius=t.payload.innerRadius,e.outerRadius=t.payload.outerRadius,e)}});G$.actions.updatePolarOptions;var K$=G$.reducer,q$=TT(`keyDown`),J$=TT(`focus`),Y$=TT(`blur`),X$=NE(),Z$=null,Q$=null,$$=null;X$.startListening({actionCreator:q$,effect:(e,t)=>{$$=e.payload,Z$!==null&&(cancelAnimationFrame(Z$),Z$=null);var n=t.getState().eventSettings,r=n.throttleDelay,i=n.throttledEvents,a=i===`all`||i.includes(`keydown`);Q$!==null&&(typeof r!=`number`||!a)&&(clearTimeout(Q$),Q$=null);var o=()=>{try{var e=t.getState();if(e.rootProps.accessibilityLayer===!1)return;var n=e.tooltip.keyboardInteraction,r=$$;if(r!==`ArrowRight`&&r!==`ArrowLeft`&&r!==`Enter`)return;var i=fH(n,PH(e),dB(e),UH(e)),a=i==null?-1:Number(i),o=!Number.isFinite(a)||a<0,s=JH(e),c=PH(e),l=LV(e,e.tooltip.settings.shared);if(r===`Enter`){if(o)return;var u=MU(e,l,`hover`,String(n.index));t.dispatch($V({active:!n.active,activeIndex:n.index,activeCoordinate:u}));return}var d=NV(e)===`left-to-right`?1:-1,f=r===`ArrowRight`?1:-1,p;if(o){var m=dB(e),h=UH(e),g=f*d,_=e=>({active:!1,index:String(e),dataKey:void 0,graphicalItemId:void 0,coordinate:void 0});if(p=-1,g>0){for(var v=0;v<c.length;v++)if(fH(_(v),c,m,h)!=null){p=v;break}}else for(var y=c.length-1;y>=0;y--)if(fH(_(y),c,m,h)!=null){p=y;break}if(p<0)return}else{p=a+f*d;var b=s?.length||c.length;if(b===0||p>=b||p<0)return}var x=MU(e,l,`hover`,String(p));t.dispatch($V({active:!0,activeIndex:p.toString(),activeCoordinate:x}))}finally{Z$=null,Q$=null}};if(!a){o();return}r===`raf`?Z$=requestAnimationFrame(o):typeof r==`number`&&Q$===null&&(o(),$$=null,Q$=setTimeout(()=>{$$?o():(Q$=null,Z$=null)},r))}}),X$.startListening({actionCreator:J$,effect:(e,t)=>{var n=t.getState();if(n.rootProps.accessibilityLayer!==!1){var r=n.tooltip.keyboardInteraction;if(!r.active&&r.index==null){var i=`0`,a=MU(n,LV(n,n.tooltip.settings.shared),`hover`,String(i));t.dispatch($V({active:!0,activeIndex:i,activeCoordinate:a}))}}}}),X$.startListening({actionCreator:Y$,effect:(e,t)=>{var n=t.getState();if(n.rootProps.accessibilityLayer!==!1){var r=n.tooltip.keyboardInteraction;r.active&&t.dispatch($V({active:!1,activeIndex:r.index,activeCoordinate:r.coordinate}))}}});function e1(e){e.persist();var t=e.currentTarget;return new Proxy(e,{get:(e,n)=>{if(n===`currentTarget`)return t;var r=Reflect.get(e,n);return typeof r==`function`?r.bind(e):r}})}var t1=TT(`externalEvent`),n1=NE(),r1=new Map,i1=new Map,a1=new Map;n1.startListening({actionCreator:t1,effect:(e,t)=>{var n=e.payload,r=n.handler,i=n.reactEvent;if(r!=null){var a=i.type,o=e1(i);a1.set(a,{handler:r,reactEvent:o});var s=r1.get(a);s!==void 0&&(cancelAnimationFrame(s),r1.delete(a));var c=t.getState().eventSettings,l=c.throttleDelay,u=c.throttledEvents,d=u===`all`||u?.includes(a),f=i1.get(a);f!==void 0&&(typeof l!=`number`||!d)&&(clearTimeout(f),i1.delete(a));var p=()=>{var e=a1.get(a);try{if(!e)return;var n=e.handler,r=e.reactEvent,i=t.getState(),o={activeCoordinate:iU(i),activeDataKey:tU(i),activeIndex:$H(i),activeLabel:eU(i),activeTooltipIndex:$H(i),isTooltipActive:aU(i)};n&&n(o,r)}finally{r1.delete(a),i1.delete(a),a1.delete(a)}};if(!d){p();return}if(l===`raf`){var m=requestAnimationFrame(p);r1.set(a,m)}else if(typeof l==`number`){if(!i1.has(a)){p();var h=setTimeout(p,l);i1.set(a,h)}}else p()}}});var o1=Q([Q([gH],e=>e.tooltipItemPayloads),(e,t)=>t,(e,t,n)=>n],(e,t,n)=>{if(t!=null){var r=e.find(e=>e.settings.graphicalItemId===n);if(r!=null){var i=r.getPosition;if(i!=null)return i(t)}}}),s1=TT(`touchMove`),c1=NE(),l1=null,u1=null,d1=null,f1=null;c1.startListening({actionCreator:s1,effect:(e,t)=>{var n=e.payload;if(n.touches!=null&&n.touches.length!==0){f1=e1(n);var r=t.getState().eventSettings,i=r.throttleDelay,a=r.throttledEvents,o=a===`all`||a.includes(`touchmove`);l1!==null&&(cancelAnimationFrame(l1),l1=null),u1!==null&&(typeof i!=`number`||!o)&&(clearTimeout(u1),u1=null),d1=Array.from(n.touches).map(e=>M$({clientX:e.clientX,clientY:e.clientY,currentTarget:n.currentTarget}));var s=()=>{if(f1!=null){var e=t.getState(),n=LV(e,e.tooltip.settings.shared);if(n===`axis`){var r=d1?.[0];if(r==null){l1=null,u1=null;return}var i=A$(e,r);i?.activeIndex!=null&&t.dispatch(XV({activeIndex:i.activeIndex,activeDataKey:void 0,activeCoordinate:i.activeCoordinate}))}else if(n===`item`){var a=f1.touches[0];if(document.elementFromPoint==null||a==null)return;var o=document.elementFromPoint(a.clientX,a.clientY);if(!o||!o.getAttribute)return;var s=o.getAttribute(bD),c=o.getAttribute(`data-recharts-item-id`)??void 0,l=AH(e).find(e=>e.id===c);if(s==null||l==null||c==null)return;var u=l.dataKey,d=o1(e,s,c);t.dispatch(JV({activeDataKey:u,activeIndex:s,activeCoordinate:d,activeGraphicalItemId:c}))}l1=null,u1=null}};if(!o){s();return}i===`raf`?l1=requestAnimationFrame(s):typeof i==`number`&&u1===null&&(s(),f1=null,u1=setTimeout(()=>{f1?s():(u1=null,l1=null)},i))}}});var p1={throttleDelay:`raf`,throttledEvents:[`mousemove`,`touchmove`,`pointermove`,`scroll`,`wheel`]},m1=qT({name:`eventSettings`,initialState:p1,reducers:{setEventSettings:(e,t)=>{t.payload.throttleDelay!=null&&(e.throttleDelay=t.payload.throttleDelay),t.payload.throttledEvents!=null&&(e.throttledEvents=bT(t.payload.throttledEvents))}}}),h1=m1.actions.setEventSettings,g1=m1.reducer,_1=JC({brush:qJ,cartesianAxis:NJ,chartData:OW,errorBars:dZ,eventSettings:g1,graphicalItems:iJ,layout:VE,legend:NO,options:xW,polarAxis:aq,polarOptions:K$,referenceElements:nY,renderedTicks:tX,rootProps:U$,tooltip:eH,zIndex:nW}),v1=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:`Chart`;return LT({reducer:_1,preloadedState:e,middleware:e=>e({serializableCheck:!1,immutableCheck:![`commonjs`,`es6`,`production`].includes(`es6`)}).concat([P$.middleware,I$.middleware,X$.middleware,n1.middleware,c1.middleware]),enhancers:e=>{var t=e;return typeof e==`function`&&(t=e()),t.concat(FT({type:`raf`}))},devTools:xk.devToolsEnabled&&{serialize:{replacer:B$},name:`recharts-${t}`}})};function y1(e){var t=e.preloadedState,n=e.children,r=e.reduxStoreName,i=FD(),a=(0,N.useRef)(null);if(i)return n;a.current??=v1(t,r);var o=$S;return N.createElement(YO,{context:o,store:a.current},n)}function b1(e){var t=e.layout,n=e.margin,r=nC(),i=FD();return(0,N.useEffect)(()=>{i||(r(RE(t)),r(LE(n)))},[r,i,t,n]),null}var x1=(0,N.memo)(b1,QO);function S1(e){var t=nC();return(0,N.useEffect)(()=>{t(W$(e))},[t,e]),null}var C1=(0,N.memo)(e=>{var t=nC();return(0,N.useEffect)(()=>{t(h1(e))},[t,e]),null},QO);function w1(e){var t=e.zIndex,n=e.isPanorama,r=(0,N.useRef)(null),i=nC();return(0,N.useLayoutEffect)(()=>(r.current&&i(eW({zIndex:t,element:r.current,isPanorama:n})),()=>{i(tW({zIndex:t,isPanorama:n}))}),[i,t,n]),N.createElement(`g`,{tabIndex:-1,ref:r,className:`recharts-zIndex-layer_${t}`})}function T1(e){var t=e.children,n=e.isPanorama,r=Z(VU);if(!r||r.length===0)return t;var i=r.filter(e=>e<0),a=r.filter(e=>e>0);return N.createElement(N.Fragment,null,i.map(e=>N.createElement(w1,{key:e,zIndex:e,isPanorama:n})),t,a.map(e=>N.createElement(w1,{key:e,zIndex:e,isPanorama:n})))}var E1=[`children`];function D1(e,t){if(e==null)return{};var n,r,i=O1(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function O1(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function k1(){return k1=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},k1.apply(null,arguments)}var A1={width:`100%`,height:`100%`,display:`block`},j1=(0,N.forwardRef)((e,t)=>{var n=bO(),r=xO(),i=Uk();if(!UE(n)||!UE(r))return null;var a=e.children,o=e.otherAttributes,s=e.title,c=e.desc,l,u;return o!=null&&(l=typeof o.tabIndex==`number`?o.tabIndex:i?0:void 0,u=typeof o.role==`string`?o.role:i?`application`:void 0),N.createElement(Hy,k1({},o,{title:s,desc:c,role:u,tabIndex:l,width:n,height:r,style:A1,ref:t}),a)}),M1=e=>{var t=e.children,n=Z(LD);if(!n)return null;var r=n.width,i=n.height,a=n.y,o=n.x;return N.createElement(Hy,{width:r,height:i,x:o,y:a},t)},N1=(0,N.forwardRef)((e,t)=>{var n=e.children,r=D1(e,E1);return FD()?N.createElement(M1,null,N.createElement(T1,{isPanorama:!0},n)):N.createElement(j1,k1({ref:t},r),N.createElement(T1,{isPanorama:!1},n))});function P1(e,t){return z1(e)||R1(e,t)||I1(e,t)||F1()}function F1(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
101
101
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function I1(e,t){if(e){if(typeof e==`string`)return L1(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?L1(e,t):void 0}}function L1(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function R1(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function z1(e){if(Array.isArray(e))return e}function B1(){var e=nC(),t=P1((0,N.useState)(null),2),n=t[0],r=t[1],i=Z(gD);return(0,N.useEffect)(()=>{if(n!=null){var t=n.getBoundingClientRect().width/n.offsetWidth;$(t)&&t!==i&&e(BE(t))}},[n,e,i]),r}function V1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function H1(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?V1(Object(n),!0).forEach(function(t){U1(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):V1(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function U1(e,t,n){return(t=W1(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function W1(e){var t=G1(e,`string`);return typeof t==`symbol`?t:t+``}function G1(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function K1(){return K1=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},K1.apply(null,arguments)}function q1(e,t){return Q1(e)||Z1(e,t)||Y1(e,t)||J1()}function J1(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
102
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Y1(e,t){if(e){if(typeof e==`string`)return X1(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?X1(e,t):void 0}}function X1(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Z1(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function Q1(e){if(Array.isArray(e))return e}var $1=()=>(zW(),null);function e0(e){if(typeof e==`number`)return e;if(typeof e==`string`){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var t0=(0,N.forwardRef)((e,t)=>{var n=(0,N.useRef)(null),r=q1((0,N.useState)({containerWidth:e0(e.style?.width),containerHeight:e0(e.style?.height)}),2),i=r[0],a=r[1],o=(0,N.useCallback)((e,t)=>{a(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]),s=(0,N.useCallback)(e=>{if(typeof t==`function`&&t(e),n.current!=null&&(n.current.disconnect(),n.current=null),e!=null&&typeof ResizeObserver<`u`){var r=e.getBoundingClientRect(),i=r.width,a=r.height;o(i,a);var s=new ResizeObserver(e=>{var t=e[0];if(t!=null){var n=t.contentRect,r=n.width,i=n.height;o(r,i)}});s.observe(e),n.current=s}},[t,o]);return(0,N.useEffect)(()=>()=>{n.current?.disconnect()},[o]),N.createElement(N.Fragment,null,N.createElement(DO,{width:i.containerWidth,height:i.containerHeight}),N.createElement(`div`,K1({ref:s},e)))}),n0=(0,N.forwardRef)((e,t)=>{var n=e.width,r=e.height,i=q1((0,N.useState)({containerWidth:e0(n),containerHeight:e0(r)}),2),a=i[0],o=i[1],s=(0,N.useCallback)((e,t)=>{o(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]),c=(0,N.useCallback)(e=>{if(typeof t==`function`&&t(e),e!=null){var n=e.getBoundingClientRect(),r=n.width,i=n.height;s(r,i)}},[t,s]);return N.createElement(N.Fragment,null,N.createElement(DO,{width:a.containerWidth,height:a.containerHeight}),N.createElement(`div`,K1({ref:c},e)))}),r0=(0,N.forwardRef)((e,t)=>{var n=e.width,r=e.height;return N.createElement(N.Fragment,null,N.createElement(DO,{width:n,height:r}),N.createElement(`div`,K1({ref:t},e)))}),i0=(0,N.forwardRef)((e,t)=>{var n=e.width,r=e.height;return typeof n==`string`||typeof r==`string`?N.createElement(n0,K1({},e,{ref:t})):typeof n==`number`&&typeof r==`number`?N.createElement(r0,K1({},e,{width:n,height:r,ref:t})):N.createElement(N.Fragment,null,N.createElement(DO,{width:n,height:r}),N.createElement(`div`,K1({ref:t},e)))});function a0(e){return e?t0:i0}var o0=(0,N.forwardRef)((e,t)=>{var n=e.children,r=e.className,i=e.height,a=e.onClick,o=e.onContextMenu,s=e.onDoubleClick,c=e.onMouseDown,l=e.onMouseEnter,u=e.onMouseLeave,d=e.onMouseMove,f=e.onMouseUp,p=e.onTouchEnd,m=e.onTouchMove,h=e.onTouchStart,g=e.style,_=e.width,v=e.responsive,y=e.dispatchTouchEvents,b=y===void 0||y,x=(0,N.useRef)(null),S=nC(),C=q1((0,N.useState)(null),2),w=C[0],T=C[1],E=q1((0,N.useState)(null),2),D=E[0],O=E[1],k=B1(),A=mO(),j=A?.width>0?A.width:_,M=A?.height>0?A.height:i,ee=(0,N.useCallback)(e=>{k(e),typeof t==`function`&&t(e),T(e),O(e),e!=null&&(x.current=e)},[k,t,T,O]),te=(0,N.useCallback)(e=>{S(N$(e)),S(t1({handler:a,reactEvent:e}))},[S,a]),P=(0,N.useCallback)(e=>{S(F$(e)),S(t1({handler:l,reactEvent:e}))},[S,l]),F=(0,N.useCallback)(e=>{S(YV()),S(t1({handler:u,reactEvent:e}))},[S,u]),ne=(0,N.useCallback)(e=>{S(F$(e)),S(t1({handler:d,reactEvent:e}))},[S,d]),re=(0,N.useCallback)(()=>{S(J$())},[S]),ie=(0,N.useCallback)(()=>{S(Y$())},[S]),ae=(0,N.useCallback)(e=>{S(q$(e.key))},[S]),I=(0,N.useCallback)(e=>{S(t1({handler:o,reactEvent:e}))},[S,o]),oe=(0,N.useCallback)(e=>{S(t1({handler:s,reactEvent:e}))},[S,s]),se=(0,N.useCallback)(e=>{S(t1({handler:c,reactEvent:e}))},[S,c]),ce=(0,N.useCallback)(e=>{S(t1({handler:f,reactEvent:e}))},[S,f]),le=(0,N.useCallback)(e=>{S(t1({handler:h,reactEvent:e}))},[S,h]),ue=(0,N.useCallback)(e=>{b&&S(s1(e)),S(t1({handler:m,reactEvent:e}))},[S,b,m]),de=(0,N.useCallback)(e=>{S(t1({handler:p,reactEvent:e}))},[S,p]),fe=a0(v);return N.createElement(pW.Provider,{value:w},N.createElement(kb.Provider,{value:D},N.createElement(fe,{width:j??g?.width,height:M??g?.height,className:R(`recharts-wrapper`,r),style:H1({position:`relative`,cursor:`default`,width:j,height:M},g),onClick:te,onContextMenu:I,onDoubleClick:oe,onFocus:re,onBlur:ie,onKeyDown:ae,onMouseDown:se,onMouseEnter:P,onMouseLeave:F,onMouseMove:ne,onMouseUp:ce,onTouchEnd:de,onTouchMove:ue,onTouchStart:le,ref:ee},N.createElement($1,null),n)))}),s0=[`width`,`height`,`responsive`,`children`,`className`,`style`,`compact`,`title`,`desc`];function c0(e,t){if(e==null)return{};var n,r,i=l0(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function l0(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var u0=(0,N.forwardRef)((e,t)=>{var n=e.width,r=e.height,i=e.responsive,a=e.children,o=e.className,s=e.style,c=e.compact,l=e.title,u=e.desc,d=Py(c0(e,s0));return c?N.createElement(N.Fragment,null,N.createElement(DO,{width:n,height:r}),N.createElement(N1,{otherAttributes:d,title:l,desc:u},a)):N.createElement(o0,{className:o,style:s,width:n,height:r,responsive:i??!1,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},N.createElement(N1,{otherAttributes:d,title:l,desc:u,ref:t},N.createElement(uY,null,a)))});function d0(){return d0=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},d0.apply(null,arguments)}function f0(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function p0(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?f0(Object(n),!0).forEach(function(t){m0(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):f0(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function m0(e,t,n){return(t=h0(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function h0(e){var t=g0(e,`string`);return typeof t==`symbol`?t:t+``}function g0(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var _0=p0({accessibilityLayer:!0,barCategoryGap:`10%`,barGap:4,layout:`horizontal`,margin:{top:5,right:5,bottom:5,left:5},responsive:!1,reverseStackOrder:!1,stackOffset:`none`,syncMethod:`index`},p1),v0=(0,N.forwardRef)(function(e,t){var n=Rx(e.categoricalChartProps,_0),r=e.chartName,i=e.defaultTooltipEventType,a=e.validateTooltipEventTypes,o=e.tooltipPayloadSearcher,s=e.categoricalChartProps,c={chartName:r,defaultTooltipEventType:i,validateTooltipEventTypes:a,tooltipPayloadSearcher:o,eventEmitter:void 0};return N.createElement(y1,{preloadedState:{options:c},reduxStoreName:s.id??r},N.createElement(WJ,{chartData:s.data}),N.createElement(x1,{layout:n.layout,margin:n.margin}),N.createElement(C1,{throttleDelay:n.throttleDelay,throttledEvents:n.throttledEvents}),N.createElement(S1,{baseValue:n.baseValue,accessibilityLayer:n.accessibilityLayer,barCategoryGap:n.barCategoryGap,maxBarSize:n.maxBarSize,stackOffset:n.stackOffset,barGap:n.barGap,barSize:n.barSize,syncId:n.syncId,syncMethod:n.syncMethod,className:n.className,reverseStackOrder:n.reverseStackOrder}),N.createElement(u0,d0({},n,{ref:t})))}),y0=[`axis`],b0=(0,N.forwardRef)((e,t)=>N.createElement(v0,{chartName:`LineChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:y0,tooltipPayloadSearcher:yW,categoricalChartProps:e,ref:t}));function x0(e){return e>=1?`hsl(var(--destructive))`:e>=.7?`hsl(45, 93%, 47%)`:`hsl(142, 71%, 45%)`}function S0(e){return new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}var C0=36e5;function w0({cpuCores:e,className:t}){let{data:n}=j_(`/system/metrics/history`),r=Date.now(),i=r-C0,a=(n??[]).filter(e=>e.t>=i).map(e=>({t:e.t,value:e.one})),o=[0,15,30,45,60].map(e=>i+e*60*1e3),s=x0((a.length?a[a.length-1].value:0)/Math.max(e,1)),c=Math.max(...(n??[]).map(e=>Math.max(e.one,e.five,e.fifteen)),e,1);return(0,U.jsxs)(vy,{className:t,children:[(0,U.jsxs)(yy,{className:`flex flex-row items-center justify-between space-y-0 pb-2`,children:[(0,U.jsx)(by,{className:`text-sm font-medium text-muted-foreground`,children:`Load Average · last 1 hour`}),(0,U.jsx)(Yn,{className:`size-4 text-muted-foreground`})]}),(0,U.jsxs)(xy,{children:[(0,U.jsx)(gO,{width:`100%`,height:180,children:(0,U.jsxs)(b0,{data:a,margin:{top:0,right:0,left:-20,bottom:0},children:[(0,U.jsx)(`defs`,{children:(0,U.jsxs)(`linearGradient`,{id:`loadGradient`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,U.jsx)(`stop`,{offset:`0%`,stopColor:s,stopOpacity:.35}),(0,U.jsx)(`stop`,{offset:`100%`,stopColor:s,stopOpacity:0})]})}),(0,U.jsx)(XX,{strokeDasharray:`3 3`,vertical:!1,stroke:`hsl(var(--border))`}),(0,U.jsx)(m$,{dataKey:`t`,type:`number`,scale:`time`,domain:[i,r],ticks:o,tickFormatter:S0,tick:{fontSize:12},tickLine:!1,axisLine:!1}),(0,U.jsx)(k$,{tick:{fontSize:12},tickLine:!1,axisLine:!1,domain:[0,Math.ceil(c*1.2)],allowDecimals:!1}),(0,U.jsx)(nG,{contentStyle:{backgroundColor:`hsl(var(--card))`,border:`1px solid hsl(var(--border))`,borderRadius:`8px`,fontSize:`12px`},labelFormatter:e=>S0(Number(e)),formatter:e=>[Number(e).toFixed(2),`Load (1 min)`]}),(0,U.jsx)(DY,{y:e,stroke:`hsl(var(--destructive))`,strokeDasharray:`4 4`,strokeOpacity:.6}),(0,U.jsx)(qQ,{type:`monotone`,dataKey:`value`,stroke:`none`,fill:`url(#loadGradient)`,isAnimationActive:!1}),(0,U.jsx)(eQ,{type:`monotone`,dataKey:`value`,stroke:s,strokeWidth:2,dot:{r:3,fill:s},activeDot:{r:6}})]})}),(0,U.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-2 text-center`,children:[e,` CPU core`,e===1?``:`s`,` · Load ≥ `,e,` means saturated`]})]})]})}function T0(e){return e>=90?`bg-destructive`:e>=70?`bg-amber-500`:`bg-emerald-500`}function E0({title:e,value:t,subtitle:n,icon:r,percent:i,className:a}){return(0,U.jsxs)(vy,{className:a,children:[(0,U.jsxs)(yy,{className:`flex flex-row items-center justify-between space-y-0 pb-2`,children:[(0,U.jsx)(by,{className:`text-sm font-medium text-muted-foreground`,children:e}),(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:r})]}),(0,U.jsxs)(xy,{children:[(0,U.jsx)(`div`,{className:`text-2xl font-bold`,children:t}),n?(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:n}):null,i===void 0?null:(0,U.jsxs)(`div`,{className:`mt-3`,children:[(0,U.jsx)(`div`,{className:`h-2 w-full rounded-full bg-secondary`,children:(0,U.jsx)(`div`,{className:H(`h-full rounded-full transition-all`,T0(i)),style:{width:`${Math.min(100,Math.max(0,i))}%`}})}),(0,U.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-1 text-right`,children:[i.toFixed(1),`%`]})]})]})]})}function D0(){let{data:e}=j_(`/instances`),t=e?.filter(e=>e.status===`running`)??[],n=e?.filter(e=>e.status===`stopped`)??[],r=e?.length??0;return(0,U.jsxs)(vy,{children:[(0,U.jsxs)(yy,{className:`flex flex-row items-center justify-between space-y-0 pb-2`,children:[(0,U.jsx)(by,{className:`text-sm font-medium text-muted-foreground`,children:`PM2 Processes`}),(0,U.jsx)(Kn,{className:`size-4 text-muted-foreground`})]}),(0,U.jsxs)(xy,{children:[(0,U.jsx)(`div`,{className:`text-3xl font-bold`,children:r}),(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:r===0?`No processes running`:`process${r===1?``:`es`} managed`}),r>0?(0,U.jsxs)(`div`,{className:`flex items-center gap-4 mt-4`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,U.jsx)(g_,{tone:`running`}),(0,U.jsxs)(`span`,{className:`text-sm`,children:[t.length,` running`]})]}),n.length>0?(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,U.jsx)(g_,{tone:`stopped`}),(0,U.jsxs)(`span`,{className:`text-sm`,children:[n.length,` stopped`]})]}):null]}):null,r>0?(0,U.jsx)(`div`,{className:`mt-4 space-y-1.5 max-h-[140px] overflow-y-auto`,children:e?.slice(0,5).map(e=>(0,U.jsxs)(`div`,{className:`flex items-center justify-between text-xs`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,U.jsx)(g_,{tone:e.status===`running`?`running`:`stopped`}),(0,U.jsx)(`span`,{className:`truncate`,children:e.name})]}),(0,U.jsx)(`span`,{className:`text-muted-foreground shrink-0`,children:e.uptime})]},e.name))}):null]})]})}function O0({host:e,user:t}){return(0,U.jsxs)(Ug,{className:`mb-6`,children:[(0,U.jsx)(Ir,{className:`size-4`}),(0,U.jsxs)(Wg,{children:[`Limited privileges on `,e]}),(0,U.jsxs)(Gg,{children:[`Installing dependencies and writing Nginx config needs root on the server. Sign in as root, or enable passwordless sudo for `,(0,U.jsx)(`span`,{className:`font-medium`,children:t}),`, to enable those actions.`]})]})}function k0(e){return e>=1024?`${(e/1024).toFixed(1)} GB`:`${Math.round(e)} MB`}function A0(e){return e>=1024?`${(e/1024).toFixed(1)} TB`:`${e.toFixed(1)} GB`}function j0({metrics:e}){let{cpu:t,memory:n,disk:r,swap:i,uptime:a}=e;return(0,U.jsxs)(`div`,{className:`grid gap-4 grid-cols-2 lg:grid-cols-5`,children:[(0,U.jsx)(E0,{title:`CPU`,value:`${t.usagePercent.toFixed(1)}%`,subtitle:`${t.cores} cores`,icon:(0,U.jsx)(ar,{className:`size-4`}),percent:t.usagePercent}),(0,U.jsx)(E0,{title:`Memory`,value:`${n.usagePercent.toFixed(1)}%`,subtitle:`${k0(n.usedMb)} / ${k0(n.totalMb)}`,icon:(0,U.jsx)(br,{className:`size-4`}),percent:n.usagePercent}),(0,U.jsx)(E0,{title:`Swap`,value:i.totalMb>0?`${i.usagePercent.toFixed(1)}%`:`N/A`,subtitle:i.totalMb>0?`${k0(i.usedMb)} / ${k0(i.totalMb)}`:`No swap configured`,icon:(0,U.jsx)(Jn,{className:`size-4`}),percent:i.totalMb>0?i.usagePercent:void 0}),(0,U.jsx)(E0,{title:`Disk`,value:`${r.usagePercent.toFixed(1)}%`,subtitle:`${A0(r.usedGb)} / ${A0(r.totalGb)}`,icon:(0,U.jsx)(pr,{className:`size-4`}),percent:r.usagePercent}),(0,U.jsx)(E0,{title:`Uptime`,value:a,subtitle:`System uptime`,icon:(0,U.jsx)(Gr,{className:`size-4`})})]})}function M0({processes:e}){return(0,U.jsxs)(vy,{children:[(0,U.jsxs)(yy,{className:`flex flex-row items-center justify-between space-y-0 pb-2`,children:[(0,U.jsx)(by,{className:`text-sm font-medium text-muted-foreground`,children:`Top Processes`}),(0,U.jsx)(Kn,{className:`size-4 text-muted-foreground`})]}),(0,U.jsx)(xy,{children:e.length===0?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground text-center py-4`,children:`No process data available`}):(0,U.jsxs)(Dv,{children:[(0,U.jsx)(Ov,{children:(0,U.jsxs)(Av,{children:[(0,U.jsx)(jv,{children:`Process`}),(0,U.jsx)(jv,{className:`text-right`,children:`CPU`}),(0,U.jsx)(jv,{className:`text-right`,children:`Memory`})]})}),(0,U.jsx)(kv,{children:e.map(e=>(0,U.jsxs)(Av,{children:[(0,U.jsx)(Mv,{className:`font-medium`,children:(0,U.jsx)(`span`,{className:`truncate max-w-[120px] block`,children:e.name})}),(0,U.jsx)(Mv,{className:`text-right`,children:(0,U.jsxs)(`span`,{className:e.cpu>50?`text-destructive font-medium`:e.cpu>20?`text-amber-500 font-medium`:``,children:[e.cpu.toFixed(1),`%`]})}),(0,U.jsx)(Mv,{className:`text-right`,children:(0,U.jsxs)(`span`,{className:e.memory>50?`text-destructive font-medium`:e.memory>20?`text-amber-500 font-medium`:``,children:[e.memory.toFixed(1),`%`]})})]},`${e.name}-${e.pid}`))})]})})]})}function N0({open:e,onOpenChange:t,onFinished:n}){let{lines:r,status:i}=Nv(e?`/api/system/update/install/stream`:null);return(0,N.useEffect)(()=>{i===`done`&&n()},[i,n]),(0,U.jsx)(i_,{open:e,title:`Updating easy-vps`,description:i===`running`?`Pulling the latest version from npm…`:i===`done`?`Installed. The panel is restarting to apply the update.`:`Update failed — see output below.`,lines:r,status:i,onOpenChange:t})}function P0({active:e}){return e?(0,U.jsxs)(Fv,{variant:`secondary`,className:`gap-1 font-normal text-emerald-700 dark:text-emerald-400`,children:[(0,U.jsx)(Rr,{className:`size-3`}),`Certificate active`]}):(0,U.jsxs)(Fv,{variant:`outline`,className:`gap-1 border-amber-200 font-normal text-amber-600 dark:border-amber-900 dark:text-amber-500`,children:[(0,U.jsx)(Ir,{className:`size-3`}),`Certificate expired`]})}var F0=/^[a-z][a-z0-9+.-]*:\/\//i,I0=/^([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,}$/i;function L0(e){let t=e.trim();if(!t)return{valid:!1,error:`Enter a domain`};if(F0.test(t)){let e=t.replace(F0,``);return{valid:!1,error:`Remove the "${t.slice(0,t.indexOf(`://`)+3)}" prefix — enter just "${e.split(`/`)[0]}"`}}return t.includes(`/`)?{valid:!1,error:`Domain should not include a path`}:t.includes(`:`)?{valid:!1,error:`Domain should not include a port — set that below`}:/\s/.test(t)?{valid:!1,error:`Domain cannot contain spaces`}:I0.test(t)?{valid:!0}:{valid:!1,error:`Enter a valid domain, e.g. example.com`}}function R0(e){let t=e.trim();if(!t)return{valid:!1,error:`Enter a port`};if(!/^\d+$/.test(t))return{valid:!1,error:`Port must be a number`};let n=Number(t);return n<1||n>65535?{valid:!1,error:`Port must be between 1 and 65535`}:n===80||n===443?{valid:!0,warning:`Nginx itself listens on 80/443 — this should be the port your app runs on`}:n<1024?{valid:!0,warning:`Ports below 1024 usually need root to bind`}:{valid:!0}}function z0(){let{hostname:e}=window.location;return e&&e!==`localhost`?e:`your-server-ip`}function B0(){let e=z0();return(0,U.jsxs)(Ug,{variant:`warning`,children:[(0,U.jsx)(qr,{}),(0,U.jsx)(Wg,{children:`Point your DNS here first`}),(0,U.jsxs)(Gg,{children:[(0,U.jsx)(`p`,{children:`Nginx needs the domain already resolving to this server:`}),(0,U.jsxs)(`ol`,{className:`mt-1.5 list-decimal space-y-0.5 pl-4`,children:[(0,U.jsx)(`li`,{children:`Open your domain's DNS settings with your registrar`}),(0,U.jsxs)(`li`,{children:[`Add an `,(0,U.jsx)(`span`,{className:`font-medium`,children:`A record`}),` — host `,(0,U.jsx)(`code`,{children:`@`}),` (or a subdomain), value `,(0,U.jsx)(`code`,{className:`font-medium`,children:e})]}),(0,U.jsx)(`li`,{children:`Wait for it to propagate — usually minutes, sometimes longer`})]})]})]})}function V0({value:e,onChange:t,validation:n,touched:r}){let i=r&&!n.valid;return(0,U.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,U.jsxs)(hg,{htmlFor:`domain`,className:`text-muted-foreground flex items-center gap-1 text-xs font-medium`,children:[`Domain`,(0,U.jsx)(Bg,{children:`A domain or subdomain, e.g. example.com or app.example.com`})]}),(0,U.jsx)(Ng,{id:`domain`,value:e,onChange:e=>t(e.target.value),placeholder:`example.com`,autoComplete:`off`,autoCapitalize:`off`,spellCheck:!1,"aria-invalid":i,className:H(`h-9`,i&&`border-destructive focus-visible:ring-destructive/20`)}),i?(0,U.jsx)(Pg,{tone:`error`,children:n.error}):(0,U.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Just the domain — no https:// and no trailing path.`})]})}function H0({value:e,onChange:t,validation:n,touched:r}){let i=r&&!n.valid,a=r&&n.valid&&!!n.warning;return(0,U.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,U.jsxs)(hg,{htmlFor:`port`,className:`text-muted-foreground flex items-center gap-1 text-xs font-medium`,children:[`Port`,(0,U.jsx)(Bg,{children:`The project's port, e.g. localhost:3000, 5000, 8000`})]}),(0,U.jsx)(Ng,{id:`port`,value:e,onChange:e=>t(e.target.value),placeholder:`3000`,inputMode:`numeric`,"aria-invalid":i,className:H(`h-9`,i&&`border-destructive focus-visible:ring-destructive/20`)}),i?(0,U.jsx)(Pg,{tone:`error`,children:n.error}):a?(0,U.jsx)(Pg,{tone:`warning`,children:n.warning}):(0,U.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`The local port you want to connect.`})]})}function U0({checked:e,onChange:t}){return(0,U.jsxs)(`div`,{className:`border-border flex items-start justify-between gap-4 rounded-lg border px-3 py-2.5`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(hg,{htmlFor:`ssl`,className:`text-sm font-medium`,children:`Request SSL certificate`}),(0,U.jsx)(`p`,{className:`text-muted-foreground mt-0.5 text-xs`,children:`Uses Certbot. The domain's DNS must already point at this server's IP.`})]}),(0,U.jsx)(Ev,{id:`ssl`,checked:e,onCheckedChange:t,className:`mt-0.5`})]})}function W0({onSubmit:e,onCancel:t}){let n=(0,N.useId)(),[r,i]=(0,N.useState)(``),[a,o]=(0,N.useState)(``),[s,c]=(0,N.useState)(!0),[l,u]=(0,N.useState)(!1),[d,f]=(0,N.useState)(!1),[p,m]=(0,N.useState)(!1),h=L0(r),g=R0(a),_=h.valid&&g.valid;return(0,U.jsxs)(`form`,{id:n,onSubmit:async t=>{if(t.preventDefault(),u(!0),f(!0),!(!_||p)){m(!0);try{await e({domain:r.trim(),port:a.trim(),ssl:s})}catch{}finally{m(!1)}}},className:`grid gap-4`,children:[(0,U.jsx)(V0,{value:r,onChange:e=>{i(e),u(!0)},validation:h,touched:l}),(0,U.jsx)(H0,{value:a,onChange:e=>{o(e),f(!0)},validation:g,touched:d}),(0,U.jsx)(U0,{checked:s,onChange:c}),(0,U.jsx)(B0,{}),(0,U.jsxs)(`div`,{className:`mt-1 flex justify-end gap-2`,children:[(0,U.jsx)(Y,{type:`button`,variant:`outline`,onClick:t,disabled:p,children:`Cancel`}),(0,U.jsx)(Y,{type:`submit`,disabled:p,children:p?`Adding…`:`Add domain`})]})]})}function G0({onCreate:e,disabled:t}){let[n,r]=(0,N.useState)(!1);return(0,U.jsxs)(Yg,{open:n,onOpenChange:r,children:[(0,U.jsx)(Xg,{asChild:!0,children:(0,U.jsxs)(Y,{size:`sm`,disabled:t,children:[(0,U.jsx)(Or,{className:`size-4`}),`Add domain`]})}),(0,U.jsxs)($g,{className:`sm:max-w-100`,children:[(0,U.jsxs)(e_,{children:[(0,U.jsx)(n_,{children:`Add domain`}),(0,U.jsx)(r_,{children:`Nginx will proxy this domain to a port on this server.`})]}),(0,U.jsx)(W0,{onCancel:()=>r(!1),onSubmit:async t=>{await e(t),r(!1)}})]})]})}function K0({domain:e,onDelete:t}){return(0,U.jsxs)(_g,{children:[(0,U.jsx)(vg,{asChild:!0,children:(0,U.jsx)(Y,{variant:`ghost`,size:`icon-sm`,"aria-label":`Delete ${e}`,className:`text-muted-foreground hover:text-destructive`,children:(0,U.jsx)(Kr,{className:`size-3.5`})})}),(0,U.jsxs)(xg,{children:[(0,U.jsxs)(Sg,{children:[(0,U.jsxs)(wg,{children:[`Delete `,e,`?`]}),(0,U.jsx)(Tg,{children:`This removes the Nginx config for this domain and revokes its certificate. The site will stop responding at this domain.`})]}),(0,U.jsxs)(Cg,{children:[(0,U.jsx)(Dg,{children:`Cancel`}),(0,U.jsx)(Eg,{variant:`destructive`,onClick:()=>t(e),children:`Delete domain`})]})]})]})}function q0({active:e=!0,className:t}){return(0,U.jsx)(`span`,{role:`img`,"aria-label":e?`Active`:`Inactive`,title:e?`Active`:`Inactive`,className:H(`inline-block size-1.5 shrink-0 rounded-full`,e?`bg-emerald-500`:`bg-red-500`,t)})}function J0({secure:e}){return e?(0,U.jsxs)(Fv,{variant:`secondary`,className:`gap-1 font-normal`,children:[(0,U.jsx)(vr,{className:`size-3`}),`SSL`]}):(0,U.jsxs)(Fv,{variant:`outline`,className:`text-muted-foreground gap-1 font-normal`,children:[(0,U.jsx)(zr,{className:`size-3`}),`No SSL`]})}function Y0({domain:e,onReissue:t,onDelete:n}){let r=e.ssl&&e.certificateActive===!1;return(0,U.jsx)(Vg,{leading:(0,U.jsx)(q0,{active:e.active}),title:e.domain,subtitle:`Proxied to localhost:${e.port}`,trailing:(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[e.ssl?(0,U.jsx)(P0,{active:e.certificateActive}):null,e.ssl?null:(0,U.jsxs)(Y,{variant:`outline`,size:`sm`,"aria-label":`Issue SSL certificate for ${e.domain}`,onClick:()=>t(e.domain),children:[(0,U.jsx)(Br,{className:`size-3.5`}),`Issue SSL Certificate`]}),r?(0,U.jsxs)(Lg,{children:[(0,U.jsx)(Rg,{asChild:!0,children:(0,U.jsx)(Y,{variant:`outline`,size:`icon-sm`,"aria-label":`Reissue certificate for ${e.domain}`,onClick:()=>t(e.domain),children:(0,U.jsx)(kr,{className:`size-3.5`})})}),(0,U.jsx)(zg,{children:`Reissue certificate`})]}):null,(0,U.jsx)(J0,{secure:e.ssl}),(0,U.jsx)(K0,{domain:e.domain,onDelete:n})]})})}function X0({domains:e,onReissue:t,onDelete:n}){return e.length===0?(0,U.jsx)(jg,{icon:fr,title:`No domains yet`,description:`Point a domain at this server and easy vps will write the Nginx config and fetch a certificate.`}):(0,U.jsx)(`div`,{className:`border-border rounded-lg border px-3`,children:e.map(e=>(0,U.jsx)(Y0,{domain:e,onReissue:t,onDelete:n},e.domain))})}function Z0(){let e=j_(`/domains`);return{domains:e.data??[],loading:e.loading,error:e.error,reload:e.reload}}function Q0(){let{domains:e,loading:t,error:n,reload:r}=Z0(),{data:i,reload:a}=j_(`/system/status`),[o,s]=(0,N.useState)(null),c=i?.dependencies.some(e=>e.name===`nginx`&&e.installed);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(a_,{title:`Domains`,description:`Nginx virtual hosts and their certificates.`,action:(0,U.jsx)(G0,{onCreate:async e=>{let t={domain:e.domain,port:Number(e.port),ssl:e.ssl},n=D_.post(`/domains`,t);Y_.promise(n,{loading:`Adding ${t.domain}…`,success:e=>e.ssl===`failed`?`${t.domain} added without SSL`:`${t.domain} added`,description:e=>e.ssl===`failed`?e.sslError??`The certificate could not be issued.`:`Proxies to localhost:${t.port}${e.ssl===`issued`?` · SSL active`:``}`,error:e=>e.message||`Could not add ${t.domain}`}),await n,r()},disabled:!c})}),i&&!i.root?(0,U.jsx)(O0,{host:i.host,user:i.user}):null,i&&!c?(0,U.jsxs)(Ug,{className:`mb-6`,children:[(0,U.jsx)(Nr,{className:`size-4`}),(0,U.jsx)(Wg,{children:`Nginx is not installed`}),(0,U.jsx)(Gg,{children:`Nginx is required to manage domains. Install it before adding a domain.`}),(0,U.jsx)(Kg,{children:(0,U.jsx)(Y,{size:`sm`,onClick:()=>s({name:`nginx`,action:`install`}),children:`Install Nginx`})})]}):null,(0,U.jsx)(Oy,{run:o,onOpenChange:e=>!e&&s(null),onFinished:a}),(0,U.jsx)(Jg,{loading:t,error:n,children:(0,U.jsx)(X0,{domains:e,onReissue:async e=>{let t=D_.post(`/domains/${e}/ssl`);Y_.promise(t,{loading:`Reissuing certificate for ${e}…`,success:`Certificate renewed for ${e}`,error:t=>t.message||`Could not reissue certificate for ${e}`}),await t.catch(()=>{}),r()},onDelete:async e=>{let t=D_.delete(`/domains/${e}`);Y_.promise(t,{loading:`Deleting ${e}…`,success:`${e} deleted`,error:t=>t.message||`Could not delete ${e}`}),await t.catch(()=>{}),r()}})})]})}function $0(e){let t=e.trim();return t?/\s/.test(t)?{valid:!1,error:`Project name cannot contain spaces`}:/^[a-z0-9][a-z0-9._-]*$/i.test(t)?t.length>63?{valid:!1,error:`Project name must be 63 characters or fewer`}:{valid:!0}:{valid:!1,error:`Use only letters, numbers, hyphens, dots, or underscores`}:{valid:!1,error:`Enter a project name`}}function e2(e){let t=e.trim();return t?/^https:\/\/github\.com\/.+\/.+/.test(t)?{valid:!0}:{valid:!1,error:`Enter a GitHub URL, e.g. https://github.com/user/repo`}:{valid:!1,error:`Enter a repository URL`}}function t2(e){let t=e.trim();return t?/[~^:?*[\\\s]/.test(t)?{valid:!1,error:`Branch name contains invalid characters`}:{valid:!0}:{valid:!1,error:`Enter a branch name`}}function n2(e){return e.trim()?{valid:!0}:{valid:!1,error:`Enter an install command`}}function r2(e){return e.trim()?{valid:!0}:{valid:!1,error:`Enter a build command`}}function i2(e){return e.trim()?{valid:!0}:{valid:!1,error:`Enter a run command`}}function a2(e){return e.trim()?{valid:!0}:{valid:!1,error:`Choose a domain`}}var o2={npm:{install:`npm install`,build:`npm run build`,run:`npm start`},yarn:{install:`yarn install`,build:`yarn build`,run:`yarn start`},pnpm:{install:`pnpm install`,build:`pnpm build`,run:`pnpm start`},bun:{install:`bun install`,build:`bun run build`,run:`bun run start`}};function s2(e){return o2[e]??{install:`npm install`,build:`npm run build`,run:`npm start`}}var c2=[`npm`,`yarn`,`pnpm`,`bun`],l2=[`pm2`,`docker`];function u2({onSubmit:e,onCancel:t,submitting:n}){let r=(0,N.useId)(),{domains:i,loading:a}=Z0(),[o,s]=(0,N.useState)({name:``,domain:``,repository:``,branch:`main`,installCommand:`npm install`,buildCommand:`npm run build`,runCommand:`npm start`}),[c,l]=(0,N.useState)(`npm`),[u,d]=(0,N.useState)(`pm2`),[f,p]=(0,N.useState)({}),[m,h]=(0,N.useState)(null),[g,_]=(0,N.useState)(null),v=`${r}-envFile`,y={name:$0(o.name),domain:a2(o.domain),repository:e2(o.repository),branch:t2(o.branch),installCommand:n2(o.installCommand),buildCommand:r2(o.buildCommand),runCommand:i2(o.runCommand)},b=Object.values(y).every(e=>e.valid),x=(e,t)=>{s(n=>({...n,[e]:t})),p(t=>({...t,[e]:!0}))},S=e=>({id:`${r}-${e}`,value:o[e],error:f[e]&&!y[e].valid?y[e].error:void 0}),C=e=>({...S(e),onChange:t=>x(e,t.target.value)}),w=e=>({...S(e),onValueChange:t=>x(e,t)}),T=e=>{l(e);let t=s2(e);s(e=>({...e,installCommand:t.install,buildCommand:t.build,runCommand:t.run}))},E=async e=>{let t=e.target.files?.[0];if(e.target.value=``,!t){h(null),_(null);return}h(t.name),_(await t.text())};return(0,U.jsxs)(`form`,{id:r,onSubmit:t=>{t.preventDefault(),p(Object.fromEntries(Object.keys(y).map(e=>[e,!0]))),b&&e({name:o.name.trim(),domain:o.domain,port:i.find(e=>e.domain===o.domain)?.port??0,repository:o.repository.trim(),branch:o.branch.trim(),packageManager:c,installCommand:o.installCommand.trim(),buildCommand:o.buildCommand.trim(),runCommand:o.runCommand.trim(),runtime:u,...g?{envContent:g}:{}})},className:`grid gap-4`,children:[(0,U.jsx)(Fg,{...C(`name`),label:`Project name`,placeholder:`my-app`,autoComplete:`off`,autoCapitalize:`off`,spellCheck:!1,hint:`A short identifier — letters, numbers, hyphens only.`}),(0,U.jsx)(p_,{...w(`domain`),label:`Domain`,options:i.map(e=>({value:e.domain,label:`${e.domain} · port ${e.port}`})),placeholder:a?`Loading domains…`:`Select a domain`,disabled:a||i.length===0,hint:i.length===0&&!a?`No domains configured yet — add one on the Domains page first.`:`The site is served here, on the port this domain already proxies to.`}),(0,U.jsx)(Fg,{...C(`repository`),label:`GitHub repository`,placeholder:`https://github.com/user/repo`,autoComplete:`off`,spellCheck:!1}),(0,U.jsx)(Fg,{...C(`branch`),label:`Branch`,placeholder:`main`,autoComplete:`off`,spellCheck:!1,hint:`The branch to deploy from.`}),(0,U.jsx)(gg,{label:`Package manager`,options:c2,value:c,onChange:T}),(0,U.jsx)(Fg,{...C(`installCommand`),label:`Install command`,placeholder:`npm install`,autoComplete:`off`,spellCheck:!1,hint:`Command to install dependencies after cloning.`}),(0,U.jsx)(Fg,{...C(`buildCommand`),label:`Build command`,placeholder:`npm run build`,autoComplete:`off`,spellCheck:!1,hint:`Command to compile or bundle the app.`}),(0,U.jsx)(Fg,{...C(`runCommand`),label:`Run command`,placeholder:`npm start`,autoComplete:`off`,spellCheck:!1,hint:`Command that starts the app in production.`}),(0,U.jsx)(gg,{label:`Runtime`,options:l2,value:u,onChange:d,hint:`PM2 keeps the process alive. Docker runs it in a container.`}),(0,U.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,U.jsx)(hg,{htmlFor:v,className:`text-muted-foreground text-xs font-medium`,children:`Environment file`}),(0,U.jsx)(`input`,{id:v,type:`file`,accept:`.env,.env.*`,onChange:E,className:`text-muted-foreground border-input hover:border-foreground/20 cursor-pointer rounded-md border border-dashed bg-transparent px-3 py-6 text-center text-xs transition-colors disabled:cursor-not-allowed disabled:opacity-50`}),(0,U.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:m?`Will write ${m} as .env before install.`:`Optional — upload a .env file to include in the deploy.`})]}),(0,U.jsxs)(`div`,{className:`mt-1 flex justify-end gap-2`,children:[(0,U.jsx)(Y,{type:`button`,variant:`outline`,onClick:t,children:`Cancel`}),(0,U.jsx)(Y,{type:`submit`,disabled:n,children:n?`Deploying…`:`Create website`})]})]})}function d2(e){return e.kind===`create`?{name:e.input.name,domain:e.input.domain,port:e.input.port,runtime:e.input.runtime}:{name:e.website.name,domain:e.website.domain,port:e.website.port,runtime:e.website.runtime}}function f2({trigger:e,onOpenChange:t,onDeployed:n}){let[r,i]=(0,N.useState)(null),[a,o]=(0,N.useState)(null);(0,N.useEffect)(()=>{if(!e){i(null),o(null);return}let t=!1;return(e.kind===`create`?D_.post(`/deployments`,e.input):D_.post(`/deployments/${e.website.name}/${e.kind===`redeploy`?`rebuild`:`redeploy`}`)).then(({id:e})=>!t&&i(e)).catch(e=>!t&&o(e.message)),()=>{t=!0}},[e]);let{lines:s,status:c}=Nv(r?`/api/deployments/jobs/${r}/stream`:null),l=(0,N.useMemo)(()=>e?d2(e):null,[e]);(0,N.useEffect)(()=>{c===`done`&&l&&n(l)},[c,l,n]);let u=!!a||c===`error`,d=e?.kind===`redeploy`?`Redeploying`:e?.kind===`pull-redeploy`?`Pulling & redeploying`:`Deploying`,f=e?.kind===`create`?`Cloning ${e.input.repository} and starting it with ${e.input.runtime}…`:e?.kind===`pull-redeploy`?`Pulling the latest commit, reinstalling, and rebuilding ${l?.name}…`:`Rebuilding and restarting ${l?.name}…`;return(0,U.jsx)(i_,{open:!!e,title:l?`${d} ${l.name}`:d,description:a||(c===`running`?f:c===`done`?`Live on ${l?.domain??`port ${l?.port}`}.`:`Deploy failed — see the output below.`),lines:a?[a]:s,status:u?`error`:c,onOpenChange:t,className:`sm:max-w-2xl`})}var p2={pm2:`PM2`,docker:`Docker`};function m2({runtime:e}){return(0,U.jsx)(Fv,{variant:`outline`,className:`text-muted-foreground font-normal`,children:p2[e]})}var h2={running:`Running`,success:`Success`,failed:`Failed`},g2={deploy:`Full deploy`,rebuild:`Rebuild`},_2={running:`unknown`,success:`running`,failed:`failed`};function v2(e){let t=Date.now()-e,n=Math.round(t/6e4);if(n<1)return`just now`;if(n<60)return`${n}m ago`;let r=Math.round(n/60);return r<24?`${r}h ago`:`${Math.round(r/24)}d ago`}function y2(e){if(!e.finishedAt)return null;let t=Math.round((e.finishedAt-e.startedAt)/1e3);return t<60?`${t}s`:`${Math.round(t/60)}m`}function b2({name:e}){let{data:t,loading:n,error:r}=j_(`/deployments/${e}/history`),i=t??[];return(0,U.jsx)(kg,{title:`Deployments`,children:(0,U.jsx)(Jg,{loading:n,error:r,rows:3,children:i.length===0?(0,U.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`No deploys recorded yet — they show up here once you deploy or redeploy this site.`}):(0,U.jsx)(`div`,{className:`rounded-md border`,children:i.map(e=>(0,U.jsxs)(`div`,{className:`border-border flex items-start gap-3 border-b px-3 py-3 last:border-b-0`,children:[(0,U.jsx)(g_,{tone:_2[e.status],className:`mt-1.5`}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-0.5 text-sm`,children:[(0,U.jsx)(`span`,{className:`font-medium`,children:h2[e.status]}),(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:`·`}),(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:g2[e.kind]}),(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:`·`}),(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:e.branch}),e.commit?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:`·`}),(0,U.jsx)(`span`,{className:`text-muted-foreground font-mono text-xs`,children:e.commit})]}):null]}),(0,U.jsxs)(`div`,{className:`text-muted-foreground mt-0.5 text-xs`,children:[v2(e.startedAt),y2(e)?` · ${y2(e)}`:``]}),e.status===`failed`&&e.error?(0,U.jsx)(`p`,{className:`text-destructive mt-1.5 font-mono text-xs break-all`,children:e.error}):null]})]},e.id))})})})}function x2({label:e,icon:t,title:n,description:r,onConfirm:i,disabled:a}){return(0,U.jsxs)(_g,{children:[(0,U.jsx)(vg,{asChild:!0,children:(0,U.jsxs)(Y,{size:`sm`,variant:`outline`,disabled:a,children:[t,e]})}),(0,U.jsxs)(xg,{children:[(0,U.jsxs)(Sg,{children:[(0,U.jsx)(wg,{children:n}),(0,U.jsx)(Tg,{children:r})]}),(0,U.jsxs)(Cg,{children:[(0,U.jsx)(Dg,{children:`Cancel`}),(0,U.jsx)(Eg,{onClick:i,children:e})]})]})]})}function S2({title:e,description:t,onBack:n,onRedeploy:r,onPullRedeploy:i,running:a}){return(0,U.jsx)(a_,{title:e,description:t,action:(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[r?(0,U.jsx)(x2,{label:`Redeploy`,icon:(0,U.jsx)(jr,{className:`size-4`}),title:`Redeploy ${e}?`,description:`Rebuilds the existing code and restarts the process. It won't pull new commits — the site will be briefly unavailable while it restarts.`,onConfirm:r,disabled:a}):null,i?(0,U.jsx)(x2,{label:`Pull & Redeploy`,icon:(0,U.jsx)(dr,{className:`size-4`}),title:`Pull the latest commit and redeploy ${e}?`,description:`Fetches the latest commit on its branch, reinstalls dependencies, rebuilds, and restarts. It will be briefly unavailable while this runs.`,onConfirm:i,disabled:a}):null,(0,U.jsxs)(Y,{size:`sm`,variant:`outline`,onClick:n,children:[(0,U.jsx)(qn,{className:`size-4`}),`Back`]})]})})}function C2({website:e}){let t=Cv(),n=t.status===`authenticated`?t.session.host:null;return(0,U.jsx)(kg,{title:`Website details`,children:(0,U.jsxs)(`div`,{className:`grid gap-4`,children:[(0,U.jsx)(Ag,{label:`Name`,value:e.name}),e.domain?(0,U.jsx)(Mg,{label:`Website URL`,href:`https://${e.domain}`,children:e.domain}):(0,U.jsx)(Ag,{label:`Website URL`,value:`No domain attached`}),n?(0,U.jsx)(Mg,{label:`Server`,href:`http://${n}:${e.port}`,children:`${n}:${e.port}`}):(0,U.jsx)(Ag,{label:`Server`,value:`Port ${e.port}`}),(0,U.jsx)(Ag,{label:`Repository`,value:e.repository}),(0,U.jsx)(Ag,{label:`Branch`,value:e.branch??`main`}),(0,U.jsx)(Ag,{label:`Runtime`,value:e.runtime.toUpperCase()}),(0,U.jsx)(Ag,{label:`Status`,value:e.status.charAt(0).toUpperCase()+e.status.slice(1)})]})})}function w2(e){return e.split(`
102
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Y1(e,t){if(e){if(typeof e==`string`)return X1(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?X1(e,t):void 0}}function X1(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Z1(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function Q1(e){if(Array.isArray(e))return e}var $1=()=>(zW(),null);function e0(e){if(typeof e==`number`)return e;if(typeof e==`string`){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var t0=(0,N.forwardRef)((e,t)=>{var n=(0,N.useRef)(null),r=q1((0,N.useState)({containerWidth:e0(e.style?.width),containerHeight:e0(e.style?.height)}),2),i=r[0],a=r[1],o=(0,N.useCallback)((e,t)=>{a(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]),s=(0,N.useCallback)(e=>{if(typeof t==`function`&&t(e),n.current!=null&&(n.current.disconnect(),n.current=null),e!=null&&typeof ResizeObserver<`u`){var r=e.getBoundingClientRect(),i=r.width,a=r.height;o(i,a);var s=new ResizeObserver(e=>{var t=e[0];if(t!=null){var n=t.contentRect,r=n.width,i=n.height;o(r,i)}});s.observe(e),n.current=s}},[t,o]);return(0,N.useEffect)(()=>()=>{n.current?.disconnect()},[o]),N.createElement(N.Fragment,null,N.createElement(DO,{width:i.containerWidth,height:i.containerHeight}),N.createElement(`div`,K1({ref:s},e)))}),n0=(0,N.forwardRef)((e,t)=>{var n=e.width,r=e.height,i=q1((0,N.useState)({containerWidth:e0(n),containerHeight:e0(r)}),2),a=i[0],o=i[1],s=(0,N.useCallback)((e,t)=>{o(n=>{var r=Math.round(e),i=Math.round(t);return n.containerWidth===r&&n.containerHeight===i?n:{containerWidth:r,containerHeight:i}})},[]),c=(0,N.useCallback)(e=>{if(typeof t==`function`&&t(e),e!=null){var n=e.getBoundingClientRect(),r=n.width,i=n.height;s(r,i)}},[t,s]);return N.createElement(N.Fragment,null,N.createElement(DO,{width:a.containerWidth,height:a.containerHeight}),N.createElement(`div`,K1({ref:c},e)))}),r0=(0,N.forwardRef)((e,t)=>{var n=e.width,r=e.height;return N.createElement(N.Fragment,null,N.createElement(DO,{width:n,height:r}),N.createElement(`div`,K1({ref:t},e)))}),i0=(0,N.forwardRef)((e,t)=>{var n=e.width,r=e.height;return typeof n==`string`||typeof r==`string`?N.createElement(n0,K1({},e,{ref:t})):typeof n==`number`&&typeof r==`number`?N.createElement(r0,K1({},e,{width:n,height:r,ref:t})):N.createElement(N.Fragment,null,N.createElement(DO,{width:n,height:r}),N.createElement(`div`,K1({ref:t},e)))});function a0(e){return e?t0:i0}var o0=(0,N.forwardRef)((e,t)=>{var n=e.children,r=e.className,i=e.height,a=e.onClick,o=e.onContextMenu,s=e.onDoubleClick,c=e.onMouseDown,l=e.onMouseEnter,u=e.onMouseLeave,d=e.onMouseMove,f=e.onMouseUp,p=e.onTouchEnd,m=e.onTouchMove,h=e.onTouchStart,g=e.style,_=e.width,v=e.responsive,y=e.dispatchTouchEvents,b=y===void 0||y,x=(0,N.useRef)(null),S=nC(),C=q1((0,N.useState)(null),2),w=C[0],T=C[1],E=q1((0,N.useState)(null),2),D=E[0],O=E[1],k=B1(),A=mO(),j=A?.width>0?A.width:_,M=A?.height>0?A.height:i,ee=(0,N.useCallback)(e=>{k(e),typeof t==`function`&&t(e),T(e),O(e),e!=null&&(x.current=e)},[k,t,T,O]),te=(0,N.useCallback)(e=>{S(N$(e)),S(t1({handler:a,reactEvent:e}))},[S,a]),P=(0,N.useCallback)(e=>{S(F$(e)),S(t1({handler:l,reactEvent:e}))},[S,l]),F=(0,N.useCallback)(e=>{S(YV()),S(t1({handler:u,reactEvent:e}))},[S,u]),ne=(0,N.useCallback)(e=>{S(F$(e)),S(t1({handler:d,reactEvent:e}))},[S,d]),re=(0,N.useCallback)(()=>{S(J$())},[S]),ie=(0,N.useCallback)(()=>{S(Y$())},[S]),ae=(0,N.useCallback)(e=>{S(q$(e.key))},[S]),I=(0,N.useCallback)(e=>{S(t1({handler:o,reactEvent:e}))},[S,o]),oe=(0,N.useCallback)(e=>{S(t1({handler:s,reactEvent:e}))},[S,s]),se=(0,N.useCallback)(e=>{S(t1({handler:c,reactEvent:e}))},[S,c]),ce=(0,N.useCallback)(e=>{S(t1({handler:f,reactEvent:e}))},[S,f]),le=(0,N.useCallback)(e=>{S(t1({handler:h,reactEvent:e}))},[S,h]),ue=(0,N.useCallback)(e=>{b&&S(s1(e)),S(t1({handler:m,reactEvent:e}))},[S,b,m]),de=(0,N.useCallback)(e=>{S(t1({handler:p,reactEvent:e}))},[S,p]),fe=a0(v);return N.createElement(pW.Provider,{value:w},N.createElement(kb.Provider,{value:D},N.createElement(fe,{width:j??g?.width,height:M??g?.height,className:R(`recharts-wrapper`,r),style:H1({position:`relative`,cursor:`default`,width:j,height:M},g),onClick:te,onContextMenu:I,onDoubleClick:oe,onFocus:re,onBlur:ie,onKeyDown:ae,onMouseDown:se,onMouseEnter:P,onMouseLeave:F,onMouseMove:ne,onMouseUp:ce,onTouchEnd:de,onTouchMove:ue,onTouchStart:le,ref:ee},N.createElement($1,null),n)))}),s0=[`width`,`height`,`responsive`,`children`,`className`,`style`,`compact`,`title`,`desc`];function c0(e,t){if(e==null)return{};var n,r,i=l0(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function l0(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var u0=(0,N.forwardRef)((e,t)=>{var n=e.width,r=e.height,i=e.responsive,a=e.children,o=e.className,s=e.style,c=e.compact,l=e.title,u=e.desc,d=Py(c0(e,s0));return c?N.createElement(N.Fragment,null,N.createElement(DO,{width:n,height:r}),N.createElement(N1,{otherAttributes:d,title:l,desc:u},a)):N.createElement(o0,{className:o,style:s,width:n,height:r,responsive:i??!1,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},N.createElement(N1,{otherAttributes:d,title:l,desc:u,ref:t},N.createElement(uY,null,a)))});function d0(){return d0=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},d0.apply(null,arguments)}function f0(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function p0(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?f0(Object(n),!0).forEach(function(t){m0(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):f0(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function m0(e,t,n){return(t=h0(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function h0(e){var t=g0(e,`string`);return typeof t==`symbol`?t:t+``}function g0(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var _0=p0({accessibilityLayer:!0,barCategoryGap:`10%`,barGap:4,layout:`horizontal`,margin:{top:5,right:5,bottom:5,left:5},responsive:!1,reverseStackOrder:!1,stackOffset:`none`,syncMethod:`index`},p1),v0=(0,N.forwardRef)(function(e,t){var n=Rx(e.categoricalChartProps,_0),r=e.chartName,i=e.defaultTooltipEventType,a=e.validateTooltipEventTypes,o=e.tooltipPayloadSearcher,s=e.categoricalChartProps,c={chartName:r,defaultTooltipEventType:i,validateTooltipEventTypes:a,tooltipPayloadSearcher:o,eventEmitter:void 0};return N.createElement(y1,{preloadedState:{options:c},reduxStoreName:s.id??r},N.createElement(WJ,{chartData:s.data}),N.createElement(x1,{layout:n.layout,margin:n.margin}),N.createElement(C1,{throttleDelay:n.throttleDelay,throttledEvents:n.throttledEvents}),N.createElement(S1,{baseValue:n.baseValue,accessibilityLayer:n.accessibilityLayer,barCategoryGap:n.barCategoryGap,maxBarSize:n.maxBarSize,stackOffset:n.stackOffset,barGap:n.barGap,barSize:n.barSize,syncId:n.syncId,syncMethod:n.syncMethod,className:n.className,reverseStackOrder:n.reverseStackOrder}),N.createElement(u0,d0({},n,{ref:t})))}),y0=[`axis`],b0=(0,N.forwardRef)((e,t)=>N.createElement(v0,{chartName:`LineChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:y0,tooltipPayloadSearcher:yW,categoricalChartProps:e,ref:t}));function x0(e){return e>=1?`hsl(var(--destructive))`:e>=.7?`hsl(45, 93%, 47%)`:`hsl(142, 71%, 45%)`}function S0(e){return new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}var C0=36e5;function w0({cpuCores:e,className:t}){let{data:n}=j_(`/system/metrics/history`),r=Date.now(),i=r-C0,a=(n??[]).filter(e=>e.t>=i).map(e=>({t:e.t,value:e.one})),o=[0,15,30,45,60].map(e=>i+e*60*1e3),s=x0((a.length?a[a.length-1].value:0)/Math.max(e,1)),c=Math.max(...(n??[]).map(e=>Math.max(e.one,e.five,e.fifteen)),e,1);return(0,U.jsxs)(vy,{className:t,children:[(0,U.jsxs)(yy,{className:`flex flex-row items-center justify-between space-y-0 pb-2`,children:[(0,U.jsx)(by,{className:`text-sm font-medium text-muted-foreground`,children:`Load Average · last 1 hour`}),(0,U.jsx)(Yn,{className:`size-4 text-muted-foreground`})]}),(0,U.jsxs)(xy,{children:[(0,U.jsx)(gO,{width:`100%`,height:180,children:(0,U.jsxs)(b0,{data:a,margin:{top:0,right:0,left:-20,bottom:0},children:[(0,U.jsx)(`defs`,{children:(0,U.jsxs)(`linearGradient`,{id:`loadGradient`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,U.jsx)(`stop`,{offset:`0%`,stopColor:s,stopOpacity:.35}),(0,U.jsx)(`stop`,{offset:`100%`,stopColor:s,stopOpacity:0})]})}),(0,U.jsx)(XX,{strokeDasharray:`3 3`,vertical:!1,stroke:`hsl(var(--border))`}),(0,U.jsx)(m$,{dataKey:`t`,type:`number`,scale:`time`,domain:[i,r],ticks:o,tickFormatter:S0,tick:{fontSize:12},tickLine:!1,axisLine:!1}),(0,U.jsx)(k$,{tick:{fontSize:12},tickLine:!1,axisLine:!1,domain:[0,Math.ceil(c*1.2)],allowDecimals:!1}),(0,U.jsx)(nG,{contentStyle:{backgroundColor:`hsl(var(--card))`,border:`1px solid hsl(var(--border))`,borderRadius:`8px`,fontSize:`12px`},labelFormatter:e=>S0(Number(e)),formatter:e=>[Number(e).toFixed(2),`Load (1 min)`]}),(0,U.jsx)(DY,{y:e,stroke:`hsl(var(--destructive))`,strokeDasharray:`4 4`,strokeOpacity:.6}),(0,U.jsx)(qQ,{type:`monotone`,dataKey:`value`,stroke:`none`,fill:`url(#loadGradient)`,isAnimationActive:!1}),(0,U.jsx)(eQ,{type:`monotone`,dataKey:`value`,stroke:s,strokeWidth:2,dot:{r:3,fill:s},activeDot:{r:6}})]})}),(0,U.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-2 text-center`,children:[e,` CPU core`,e===1?``:`s`,` · Load ≥ `,e,` means saturated`]})]})]})}function T0(e){return e>=90?`bg-destructive`:e>=70?`bg-amber-500`:`bg-emerald-500`}function E0({title:e,value:t,subtitle:n,icon:r,percent:i,className:a}){return(0,U.jsxs)(vy,{className:a,children:[(0,U.jsxs)(yy,{className:`flex flex-row items-center justify-between space-y-0 pb-2`,children:[(0,U.jsx)(by,{className:`text-sm font-medium text-muted-foreground`,children:e}),(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:r})]}),(0,U.jsxs)(xy,{children:[(0,U.jsx)(`div`,{className:`text-2xl font-bold`,children:t}),n?(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:n}):null,i===void 0?null:(0,U.jsxs)(`div`,{className:`mt-3`,children:[(0,U.jsx)(`div`,{className:`h-2 w-full rounded-full bg-secondary`,children:(0,U.jsx)(`div`,{className:H(`h-full rounded-full transition-all`,T0(i)),style:{width:`${Math.min(100,Math.max(0,i))}%`}})}),(0,U.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-1 text-right`,children:[i.toFixed(1),`%`]})]})]})]})}function D0(){let{data:e}=j_(`/instances`),t=e?.filter(e=>e.status===`running`)??[],n=e?.filter(e=>e.status===`stopped`)??[],r=e?.length??0;return(0,U.jsxs)(vy,{children:[(0,U.jsxs)(yy,{className:`flex flex-row items-center justify-between space-y-0 pb-2`,children:[(0,U.jsx)(by,{className:`text-sm font-medium text-muted-foreground`,children:`PM2 Processes`}),(0,U.jsx)(Kn,{className:`size-4 text-muted-foreground`})]}),(0,U.jsxs)(xy,{children:[(0,U.jsx)(`div`,{className:`text-3xl font-bold`,children:r}),(0,U.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:r===0?`No processes running`:`process${r===1?``:`es`} managed`}),r>0?(0,U.jsxs)(`div`,{className:`flex items-center gap-4 mt-4`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,U.jsx)(g_,{tone:`running`}),(0,U.jsxs)(`span`,{className:`text-sm`,children:[t.length,` running`]})]}),n.length>0?(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,U.jsx)(g_,{tone:`stopped`}),(0,U.jsxs)(`span`,{className:`text-sm`,children:[n.length,` stopped`]})]}):null]}):null,r>0?(0,U.jsx)(`div`,{className:`mt-4 space-y-1.5 max-h-[140px] overflow-y-auto`,children:e?.slice(0,5).map(e=>(0,U.jsxs)(`div`,{className:`flex items-center justify-between text-xs`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,U.jsx)(g_,{tone:e.status===`running`?`running`:`stopped`}),(0,U.jsx)(`span`,{className:`truncate`,children:e.name})]}),(0,U.jsx)(`span`,{className:`text-muted-foreground shrink-0`,children:e.uptime})]},e.name))}):null]})]})}function O0({host:e,user:t}){return(0,U.jsxs)(Ug,{className:`mb-6`,children:[(0,U.jsx)(Ir,{className:`size-4`}),(0,U.jsxs)(Wg,{children:[`Limited privileges on `,e]}),(0,U.jsxs)(Gg,{children:[`Installing dependencies and writing Nginx config needs root on the server. Sign in as root, or enable passwordless sudo for `,(0,U.jsx)(`span`,{className:`font-medium`,children:t}),`, to enable those actions.`]})]})}function k0(e){return e>=1024?`${(e/1024).toFixed(1)} GB`:`${Math.round(e)} MB`}function A0(e){return e>=1024?`${(e/1024).toFixed(1)} TB`:`${e.toFixed(1)} GB`}function j0({metrics:e}){let{cpu:t,memory:n,disk:r,swap:i,uptime:a}=e;return(0,U.jsxs)(`div`,{className:`grid gap-4 grid-cols-2 lg:grid-cols-5`,children:[(0,U.jsx)(E0,{title:`CPU`,value:`${t.usagePercent.toFixed(1)}%`,subtitle:`${t.cores} cores`,icon:(0,U.jsx)(ar,{className:`size-4`}),percent:t.usagePercent}),(0,U.jsx)(E0,{title:`Memory`,value:`${n.usagePercent.toFixed(1)}%`,subtitle:`${k0(n.usedMb)} / ${k0(n.totalMb)}`,icon:(0,U.jsx)(br,{className:`size-4`}),percent:n.usagePercent}),(0,U.jsx)(E0,{title:`Swap`,value:i.totalMb>0?`${i.usagePercent.toFixed(1)}%`:`N/A`,subtitle:i.totalMb>0?`${k0(i.usedMb)} / ${k0(i.totalMb)}`:`No swap configured`,icon:(0,U.jsx)(Jn,{className:`size-4`}),percent:i.totalMb>0?i.usagePercent:void 0}),(0,U.jsx)(E0,{title:`Disk`,value:`${r.usagePercent.toFixed(1)}%`,subtitle:`${A0(r.usedGb)} / ${A0(r.totalGb)}`,icon:(0,U.jsx)(pr,{className:`size-4`}),percent:r.usagePercent}),(0,U.jsx)(E0,{title:`Uptime`,value:a,subtitle:`System uptime`,icon:(0,U.jsx)(Gr,{className:`size-4`})})]})}function M0({processes:e}){return(0,U.jsxs)(vy,{children:[(0,U.jsxs)(yy,{className:`flex flex-row items-center justify-between space-y-0 pb-2`,children:[(0,U.jsx)(by,{className:`text-sm font-medium text-muted-foreground`,children:`Top Processes`}),(0,U.jsx)(Kn,{className:`size-4 text-muted-foreground`})]}),(0,U.jsx)(xy,{children:e.length===0?(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground text-center py-4`,children:`No process data available`}):(0,U.jsxs)(Dv,{children:[(0,U.jsx)(Ov,{children:(0,U.jsxs)(Av,{children:[(0,U.jsx)(jv,{children:`Process`}),(0,U.jsx)(jv,{className:`text-right`,children:`CPU`}),(0,U.jsx)(jv,{className:`text-right`,children:`Memory`})]})}),(0,U.jsx)(kv,{children:e.map(e=>(0,U.jsxs)(Av,{children:[(0,U.jsx)(Mv,{className:`font-medium`,children:(0,U.jsx)(`span`,{className:`truncate max-w-[120px] block`,children:e.name})}),(0,U.jsx)(Mv,{className:`text-right`,children:(0,U.jsxs)(`span`,{className:e.cpu>50?`text-destructive font-medium`:e.cpu>20?`text-amber-500 font-medium`:``,children:[e.cpu.toFixed(1),`%`]})}),(0,U.jsx)(Mv,{className:`text-right`,children:(0,U.jsxs)(`span`,{className:e.memory>50?`text-destructive font-medium`:e.memory>20?`text-amber-500 font-medium`:``,children:[e.memory.toFixed(1),`%`]})})]},`${e.name}-${e.pid}`))})]})})]})}function N0({open:e,onOpenChange:t,onFinished:n}){let{lines:r,status:i}=Nv(e?`/api/system/update/install/stream`:null);return(0,N.useEffect)(()=>{i===`done`&&n()},[i,n]),(0,U.jsx)(i_,{open:e,title:`Updating easy-vps`,description:i===`running`?`Pulling the latest version from npm…`:i===`done`?`Installed. The panel is restarting to apply the update.`:`Update failed — see output below.`,lines:r,status:i,onOpenChange:t})}function P0({active:e}){return e?(0,U.jsxs)(Fv,{variant:`secondary`,className:`gap-1 font-normal text-emerald-700 dark:text-emerald-400`,children:[(0,U.jsx)(Rr,{className:`size-3`}),`Certificate active`]}):(0,U.jsxs)(Fv,{variant:`outline`,className:`gap-1 border-amber-200 font-normal text-amber-600 dark:border-amber-900 dark:text-amber-500`,children:[(0,U.jsx)(Ir,{className:`size-3`}),`Certificate expired`]})}var F0=/^[a-z][a-z0-9+.-]*:\/\//i,I0=/^([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,}$/i;function L0(e){let t=e.trim();if(!t)return{valid:!1,error:`Enter a domain`};if(F0.test(t)){let e=t.replace(F0,``);return{valid:!1,error:`Remove the "${t.slice(0,t.indexOf(`://`)+3)}" prefix — enter just "${e.split(`/`)[0]}"`}}return t.includes(`/`)?{valid:!1,error:`Domain should not include a path`}:t.includes(`:`)?{valid:!1,error:`Domain should not include a port — set that below`}:/\s/.test(t)?{valid:!1,error:`Domain cannot contain spaces`}:I0.test(t)?{valid:!0}:{valid:!1,error:`Enter a valid domain, e.g. example.com`}}function R0(e){let t=e.trim();if(!t)return{valid:!1,error:`Enter a port`};if(!/^\d+$/.test(t))return{valid:!1,error:`Port must be a number`};let n=Number(t);return n<1||n>65535?{valid:!1,error:`Port must be between 1 and 65535`}:n===80||n===443?{valid:!0,warning:`Nginx itself listens on 80/443 — this should be the port your app runs on`}:n<1024?{valid:!0,warning:`Ports below 1024 usually need root to bind`}:{valid:!0}}function z0(){let{hostname:e}=window.location;return e&&e!==`localhost`?e:`your-server-ip`}function B0(){let e=z0();return(0,U.jsxs)(Ug,{variant:`warning`,children:[(0,U.jsx)(qr,{}),(0,U.jsx)(Wg,{children:`Point your DNS here first`}),(0,U.jsxs)(Gg,{children:[(0,U.jsx)(`p`,{children:`Nginx needs the domain already resolving to this server:`}),(0,U.jsxs)(`ol`,{className:`mt-1.5 list-decimal space-y-0.5 pl-4`,children:[(0,U.jsx)(`li`,{children:`Open your domain's DNS settings with your registrar`}),(0,U.jsxs)(`li`,{children:[`Add an `,(0,U.jsx)(`span`,{className:`font-medium`,children:`A record`}),` — host `,(0,U.jsx)(`code`,{children:`@`}),` (or a subdomain), value `,(0,U.jsx)(`code`,{className:`font-medium`,children:e})]}),(0,U.jsx)(`li`,{children:`Wait for it to propagate — usually minutes, sometimes longer`})]})]})]})}function V0({value:e,onChange:t,validation:n,touched:r}){let i=r&&!n.valid;return(0,U.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,U.jsxs)(hg,{htmlFor:`domain`,className:`text-muted-foreground flex items-center gap-1 text-xs font-medium`,children:[`Domain`,(0,U.jsx)(Bg,{children:`A domain or subdomain, e.g. example.com or app.example.com`})]}),(0,U.jsx)(Ng,{id:`domain`,value:e,onChange:e=>t(e.target.value),placeholder:`example.com`,autoComplete:`off`,autoCapitalize:`off`,spellCheck:!1,"aria-invalid":i,className:H(`h-9`,i&&`border-destructive focus-visible:ring-destructive/20`)}),i?(0,U.jsx)(Pg,{tone:`error`,children:n.error}):(0,U.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Just the domain — no https:// and no trailing path.`})]})}function H0({value:e,onChange:t,validation:n,touched:r}){let i=r&&!n.valid,a=r&&n.valid&&!!n.warning;return(0,U.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,U.jsxs)(hg,{htmlFor:`port`,className:`text-muted-foreground flex items-center gap-1 text-xs font-medium`,children:[`Port`,(0,U.jsx)(Bg,{children:`The project's port, e.g. localhost:3000, 5000, 8000`})]}),(0,U.jsx)(Ng,{id:`port`,value:e,onChange:e=>t(e.target.value),placeholder:`3000`,inputMode:`numeric`,"aria-invalid":i,className:H(`h-9`,i&&`border-destructive focus-visible:ring-destructive/20`)}),i?(0,U.jsx)(Pg,{tone:`error`,children:n.error}):a?(0,U.jsx)(Pg,{tone:`warning`,children:n.warning}):(0,U.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`The local port you want to connect.`})]})}function U0({checked:e,onChange:t}){return(0,U.jsxs)(`div`,{className:`border-border flex items-start justify-between gap-4 rounded-lg border px-3 py-2.5`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(hg,{htmlFor:`ssl`,className:`text-sm font-medium`,children:`Request SSL certificate`}),(0,U.jsx)(`p`,{className:`text-muted-foreground mt-0.5 text-xs`,children:`Uses Certbot. The domain's DNS must already point at this server's IP.`})]}),(0,U.jsx)(Ev,{id:`ssl`,checked:e,onCheckedChange:t,className:`mt-0.5`})]})}function W0({onSubmit:e,onCancel:t}){let n=(0,N.useId)(),[r,i]=(0,N.useState)(``),[a,o]=(0,N.useState)(``),[s,c]=(0,N.useState)(!0),[l,u]=(0,N.useState)(!1),[d,f]=(0,N.useState)(!1),[p,m]=(0,N.useState)(!1),h=L0(r),g=R0(a),_=h.valid&&g.valid;return(0,U.jsxs)(`form`,{id:n,onSubmit:async t=>{if(t.preventDefault(),u(!0),f(!0),!(!_||p)){m(!0);try{await e({domain:r.trim(),port:a.trim(),ssl:s})}catch{}finally{m(!1)}}},className:`grid gap-4`,children:[(0,U.jsx)(V0,{value:r,onChange:e=>{i(e),u(!0)},validation:h,touched:l}),(0,U.jsx)(H0,{value:a,onChange:e=>{o(e),f(!0)},validation:g,touched:d}),(0,U.jsx)(U0,{checked:s,onChange:c}),(0,U.jsx)(B0,{}),(0,U.jsxs)(`div`,{className:`mt-1 flex justify-end gap-2`,children:[(0,U.jsx)(Y,{type:`button`,variant:`outline`,onClick:t,disabled:p,children:`Cancel`}),(0,U.jsx)(Y,{type:`submit`,disabled:p,children:p?`Adding…`:`Add domain`})]})]})}function G0({onCreate:e,disabled:t}){let[n,r]=(0,N.useState)(!1);return(0,U.jsxs)(Yg,{open:n,onOpenChange:r,children:[(0,U.jsx)(Xg,{asChild:!0,children:(0,U.jsxs)(Y,{size:`sm`,disabled:t,children:[(0,U.jsx)(Or,{className:`size-4`}),`Add domain`]})}),(0,U.jsxs)($g,{className:`sm:max-w-100`,children:[(0,U.jsxs)(e_,{children:[(0,U.jsx)(n_,{children:`Add domain`}),(0,U.jsx)(r_,{children:`Nginx will proxy this domain to a port on this server.`})]}),(0,U.jsx)(W0,{onCancel:()=>r(!1),onSubmit:async t=>{await e(t),r(!1)}})]})]})}function K0({domain:e,onDelete:t}){return(0,U.jsxs)(_g,{children:[(0,U.jsx)(vg,{asChild:!0,children:(0,U.jsx)(Y,{variant:`ghost`,size:`icon-sm`,"aria-label":`Delete ${e}`,className:`text-muted-foreground hover:text-destructive`,children:(0,U.jsx)(Kr,{className:`size-3.5`})})}),(0,U.jsxs)(xg,{children:[(0,U.jsxs)(Sg,{children:[(0,U.jsxs)(wg,{children:[`Delete `,e,`?`]}),(0,U.jsx)(Tg,{children:`This removes the Nginx config for this domain and revokes its certificate. The site will stop responding at this domain.`})]}),(0,U.jsxs)(Cg,{children:[(0,U.jsx)(Dg,{children:`Cancel`}),(0,U.jsx)(Eg,{variant:`destructive`,onClick:()=>t(e),children:`Delete domain`})]})]})]})}function q0({active:e=!0,className:t}){return(0,U.jsx)(`span`,{role:`img`,"aria-label":e?`Active`:`Inactive`,title:e?`Active`:`Inactive`,className:H(`inline-block size-1.5 shrink-0 rounded-full`,e?`bg-emerald-500`:`bg-red-500`,t)})}function J0({secure:e}){return e?(0,U.jsxs)(Fv,{variant:`secondary`,className:`gap-1 font-normal`,children:[(0,U.jsx)(vr,{className:`size-3`}),`SSL`]}):(0,U.jsxs)(Fv,{variant:`outline`,className:`text-muted-foreground gap-1 font-normal`,children:[(0,U.jsx)(zr,{className:`size-3`}),`No SSL`]})}function Y0({domain:e,onReissue:t,onDelete:n}){let r=e.ssl&&e.certificateActive===!1;return(0,U.jsx)(Vg,{leading:(0,U.jsx)(q0,{active:e.active}),title:e.domain,subtitle:`Proxied to localhost:${e.port}`,trailing:(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[e.ssl?(0,U.jsx)(P0,{active:e.certificateActive}):null,e.ssl?null:(0,U.jsxs)(Y,{variant:`outline`,size:`sm`,"aria-label":`Issue SSL certificate for ${e.domain}`,onClick:()=>t(e.domain),children:[(0,U.jsx)(Br,{className:`size-3.5`}),`Issue SSL Certificate`]}),r?(0,U.jsxs)(Lg,{children:[(0,U.jsx)(Rg,{asChild:!0,children:(0,U.jsx)(Y,{variant:`outline`,size:`icon-sm`,"aria-label":`Reissue certificate for ${e.domain}`,onClick:()=>t(e.domain),children:(0,U.jsx)(kr,{className:`size-3.5`})})}),(0,U.jsx)(zg,{children:`Reissue certificate`})]}):null,(0,U.jsx)(J0,{secure:e.ssl}),(0,U.jsx)(K0,{domain:e.domain,onDelete:n})]})})}function X0({domains:e,onReissue:t,onDelete:n}){return e.length===0?(0,U.jsx)(jg,{icon:fr,title:`No domains yet`,description:`Point a domain at this server and easy vps will write the Nginx config and fetch a certificate.`}):(0,U.jsx)(`div`,{className:`border-border rounded-lg border px-3`,children:e.map(e=>(0,U.jsx)(Y0,{domain:e,onReissue:t,onDelete:n},e.domain))})}function Z0(){let e=j_(`/domains`);return{domains:e.data??[],loading:e.loading,error:e.error,reload:e.reload}}function Q0(){let{domains:e,loading:t,error:n,reload:r}=Z0(),{data:i,reload:a}=j_(`/system/status`),[o,s]=(0,N.useState)(null),c=i?.dependencies.some(e=>e.name===`nginx`&&e.installed);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(a_,{title:`Domains`,description:`Nginx virtual hosts and their certificates.`,action:(0,U.jsx)(G0,{onCreate:async e=>{let t={domain:e.domain,port:Number(e.port),ssl:e.ssl},n=D_.post(`/domains`,t);Y_.promise(n,{loading:`Adding ${t.domain}…`,success:e=>e.ssl===`failed`?`${t.domain} added without SSL`:`${t.domain} added`,description:e=>e.ssl===`failed`?e.sslError??`The certificate could not be issued.`:`Proxies to localhost:${t.port}${e.ssl===`issued`?` · SSL active`:``}`,error:e=>e.message||`Could not add ${t.domain}`}),await n,r()},disabled:!c})}),i&&!i.root?(0,U.jsx)(O0,{host:i.host,user:i.user}):null,i&&!c?(0,U.jsxs)(Ug,{className:`mb-6`,children:[(0,U.jsx)(Nr,{className:`size-4`}),(0,U.jsx)(Wg,{children:`Nginx is not installed`}),(0,U.jsx)(Gg,{children:`Nginx is required to manage domains. Install it before adding a domain.`}),(0,U.jsx)(Kg,{children:(0,U.jsx)(Y,{size:`sm`,onClick:()=>s({name:`nginx`,action:`install`}),children:`Install Nginx`})})]}):null,(0,U.jsx)(Oy,{run:o,onOpenChange:e=>!e&&s(null),onFinished:a}),(0,U.jsx)(Jg,{loading:t,error:n,children:(0,U.jsx)(X0,{domains:e,onReissue:async e=>{let t=D_.post(`/domains/${e}/ssl`);Y_.promise(t,{loading:`Reissuing certificate for ${e}…`,success:`Certificate renewed for ${e}`,error:t=>t.message||`Could not reissue certificate for ${e}`}),await t.catch(()=>{}),r()},onDelete:async e=>{let t=D_.delete(`/domains/${e}`);Y_.promise(t,{loading:`Deleting ${e}…`,success:`${e} deleted`,error:t=>t.message||`Could not delete ${e}`}),await t.catch(()=>{}),r()}})})]})}function $0(e){let t=e.trim();return t?/\s/.test(t)?{valid:!1,error:`Project name cannot contain spaces`}:/^[a-z0-9][a-z0-9._-]*$/i.test(t)?t.length>63?{valid:!1,error:`Project name must be 63 characters or fewer`}:{valid:!0}:{valid:!1,error:`Use only letters, numbers, hyphens, dots, or underscores`}:{valid:!1,error:`Enter a project name`}}function e2(e){let t=e.trim();return t?/^https:\/\/github\.com\/.+\/.+/.test(t)?{valid:!0}:{valid:!1,error:`Enter a GitHub URL, e.g. https://github.com/user/repo`}:{valid:!1,error:`Enter a repository URL`}}function t2(e){let t=e.trim();return t?/[~^:?*[\\\s]/.test(t)?{valid:!1,error:`Branch name contains invalid characters`}:{valid:!0}:{valid:!1,error:`Enter a branch name`}}function n2(e){return e.trim()?{valid:!0}:{valid:!1,error:`Enter an install command`}}function r2(e){return e.trim()?{valid:!0}:{valid:!1,error:`Enter a build command`}}function i2(e){return e.trim()?{valid:!0}:{valid:!1,error:`Enter a run command`}}function a2(e){return e.trim()?{valid:!0}:{valid:!1,error:`Choose a domain`}}var o2={npm:{install:`npm install`,build:`npm run build`,run:`npm start`},yarn:{install:`yarn install`,build:`yarn build`,run:`yarn start`},pnpm:{install:`pnpm install`,build:`pnpm build`,run:`pnpm start`},bun:{install:`bun install`,build:`bun run build`,run:`bun run start`}};function s2(e){return o2[e]??{install:`npm install`,build:`npm run build`,run:`npm start`}}var c2=[`npm`,`yarn`,`pnpm`,`bun`],l2=[`pm2`,`docker`];function u2({onSubmit:e,onCancel:t,submitting:n}){let r=(0,N.useId)(),{domains:i,loading:a}=Z0(),[o,s]=(0,N.useState)({name:``,domain:``,repository:``,branch:`main`,installCommand:`npm install`,buildCommand:`npm run build`,runCommand:`npm start`}),[c,l]=(0,N.useState)(`npm`),[u,d]=(0,N.useState)(`pm2`),[f,p]=(0,N.useState)({}),[m,h]=(0,N.useState)(null),[g,_]=(0,N.useState)(null),v=`${r}-envFile`,y={name:$0(o.name),domain:a2(o.domain),repository:e2(o.repository),branch:t2(o.branch),installCommand:n2(o.installCommand),buildCommand:r2(o.buildCommand),runCommand:i2(o.runCommand)},b=Object.values(y).every(e=>e.valid),x=(e,t)=>{s(n=>({...n,[e]:t})),p(t=>({...t,[e]:!0}))},S=e=>({id:`${r}-${e}`,value:o[e],error:f[e]&&!y[e].valid?y[e].error:void 0}),C=e=>({...S(e),onChange:t=>x(e,t.target.value)}),w=e=>({...S(e),onValueChange:t=>x(e,t)}),T=e=>{l(e);let t=s2(e);s(e=>({...e,installCommand:t.install,buildCommand:t.build,runCommand:t.run}))},E=async e=>{let t=e.target.files?.[0];if(e.target.value=``,!t){h(null),_(null);return}h(t.name),_(await t.text())};return(0,U.jsxs)(`form`,{id:r,onSubmit:t=>{t.preventDefault(),p(Object.fromEntries(Object.keys(y).map(e=>[e,!0]))),b&&e({name:o.name.trim(),domain:o.domain,port:i.find(e=>e.domain===o.domain)?.port??0,repository:o.repository.trim(),branch:o.branch.trim(),packageManager:c,installCommand:o.installCommand.trim(),buildCommand:o.buildCommand.trim(),runCommand:o.runCommand.trim(),runtime:u,...g?{envContent:g}:{}})},className:`grid gap-4`,children:[(0,U.jsx)(Fg,{...C(`name`),label:`Project name`,placeholder:`my-app`,autoComplete:`off`,autoCapitalize:`off`,spellCheck:!1,hint:`A short identifier — letters, numbers, hyphens only.`}),(0,U.jsx)(p_,{...w(`domain`),label:`Domain`,options:i.map(e=>({value:e.domain,label:`${e.domain} · port ${e.port}`})),placeholder:a?`Loading domains…`:`Select a domain`,disabled:a||i.length===0,hint:i.length===0&&!a?`No domains configured yet — add one on the Domains page first.`:`The site is served here, on the port this domain already proxies to.`}),(0,U.jsx)(Fg,{...C(`repository`),label:`GitHub repository`,placeholder:`https://github.com/user/repo`,autoComplete:`off`,spellCheck:!1}),(0,U.jsx)(Fg,{...C(`branch`),label:`Branch`,placeholder:`main`,autoComplete:`off`,spellCheck:!1,hint:`The branch to deploy from.`}),(0,U.jsx)(gg,{label:`Package manager`,options:c2,value:c,onChange:T}),(0,U.jsx)(Fg,{...C(`installCommand`),label:`Install command`,placeholder:`npm install`,autoComplete:`off`,spellCheck:!1,hint:`Command to install dependencies after cloning.`}),(0,U.jsx)(Fg,{...C(`buildCommand`),label:`Build command`,placeholder:`npm run build`,autoComplete:`off`,spellCheck:!1,hint:`Command to compile or bundle the app.`}),(0,U.jsx)(Fg,{...C(`runCommand`),label:`Run command`,placeholder:`npm start`,autoComplete:`off`,spellCheck:!1,hint:`Command that starts the app in production.`}),(0,U.jsx)(gg,{label:`Runtime`,options:l2,value:u,onChange:d,hint:`PM2 keeps the process alive. Docker runs it in a container.`}),(0,U.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,U.jsx)(hg,{className:`text-muted-foreground text-xs font-medium`,children:`Environment file`}),(0,U.jsxs)(`label`,{htmlFor:v,className:`border-input hover:bg-accent/60 flex cursor-pointer items-center gap-2.5 rounded-md border border-dashed px-3 py-2.5 text-sm transition-colors`,children:[(0,U.jsx)(Jr,{className:`text-muted-foreground size-4 shrink-0`}),(0,U.jsx)(`span`,{className:m?`truncate`:`text-muted-foreground truncate`,children:m??`Choose a .env file`}),(0,U.jsx)(`input`,{id:v,type:`file`,accept:`.env,.env.*`,className:`sr-only`,onChange:E})]}),(0,U.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:m?`Will write ${m} as .env before install.`:`Optional — upload a .env file to include in the deploy.`})]}),(0,U.jsxs)(`div`,{className:`mt-1 flex justify-end gap-2`,children:[(0,U.jsx)(Y,{type:`button`,variant:`outline`,onClick:t,children:`Cancel`}),(0,U.jsx)(Y,{type:`submit`,disabled:n,children:n?`Deploying…`:`Create website`})]})]})}function d2(e){return e.kind===`create`?{name:e.input.name,domain:e.input.domain,port:e.input.port,runtime:e.input.runtime}:{name:e.website.name,domain:e.website.domain,port:e.website.port,runtime:e.website.runtime}}function f2({trigger:e,onOpenChange:t,onDeployed:n}){let[r,i]=(0,N.useState)(null),[a,o]=(0,N.useState)(null);(0,N.useEffect)(()=>{if(!e){i(null),o(null);return}let t=!1;return(e.kind===`create`?D_.post(`/deployments`,e.input):D_.post(`/deployments/${e.website.name}/${e.kind===`redeploy`?`rebuild`:`redeploy`}`)).then(({id:e})=>!t&&i(e)).catch(e=>!t&&o(e.message)),()=>{t=!0}},[e]);let{lines:s,status:c}=Nv(r?`/api/deployments/jobs/${r}/stream`:null),l=(0,N.useMemo)(()=>e?d2(e):null,[e]);(0,N.useEffect)(()=>{c===`done`&&l&&n(l)},[c,l,n]);let u=!!a||c===`error`,d=e?.kind===`redeploy`?`Redeploying`:e?.kind===`pull-redeploy`?`Pulling & redeploying`:`Deploying`,f=e?.kind===`create`?`Cloning ${e.input.repository} and starting it with ${e.input.runtime}…`:e?.kind===`pull-redeploy`?`Pulling the latest commit, reinstalling, and rebuilding ${l?.name}…`:`Rebuilding and restarting ${l?.name}…`;return(0,U.jsx)(i_,{open:!!e,title:l?`${d} ${l.name}`:d,description:a||(c===`running`?f:c===`done`?`Live on ${l?.domain??`port ${l?.port}`}.`:`Deploy failed — see the output below.`),lines:a?[a]:s,status:u?`error`:c,onOpenChange:t,className:`sm:max-w-2xl`})}var p2={pm2:`PM2`,docker:`Docker`};function m2({runtime:e}){return(0,U.jsx)(Fv,{variant:`outline`,className:`text-muted-foreground font-normal`,children:p2[e]})}var h2={running:`Running`,success:`Success`,failed:`Failed`},g2={deploy:`Full deploy`,rebuild:`Rebuild`},_2={running:`unknown`,success:`running`,failed:`failed`};function v2(e){let t=Date.now()-e,n=Math.round(t/6e4);if(n<1)return`just now`;if(n<60)return`${n}m ago`;let r=Math.round(n/60);return r<24?`${r}h ago`:`${Math.round(r/24)}d ago`}function y2(e){if(!e.finishedAt)return null;let t=Math.round((e.finishedAt-e.startedAt)/1e3);return t<60?`${t}s`:`${Math.round(t/60)}m`}function b2({name:e}){let{data:t,loading:n,error:r}=j_(`/deployments/${e}/history`),i=t??[];return(0,U.jsx)(kg,{title:`Deployments`,children:(0,U.jsx)(Jg,{loading:n,error:r,rows:3,children:i.length===0?(0,U.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`No deploys recorded yet — they show up here once you deploy or redeploy this site.`}):(0,U.jsx)(`div`,{className:`rounded-md border`,children:i.map(e=>(0,U.jsxs)(`div`,{className:`border-border flex items-start gap-3 border-b px-3 py-3 last:border-b-0`,children:[(0,U.jsx)(g_,{tone:_2[e.status],className:`mt-1.5`}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-0.5 text-sm`,children:[(0,U.jsx)(`span`,{className:`font-medium`,children:h2[e.status]}),(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:`·`}),(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:g2[e.kind]}),(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:`·`}),(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:e.branch}),e.commit?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:`·`}),(0,U.jsx)(`span`,{className:`text-muted-foreground font-mono text-xs`,children:e.commit})]}):null]}),(0,U.jsxs)(`div`,{className:`text-muted-foreground mt-0.5 text-xs`,children:[v2(e.startedAt),y2(e)?` · ${y2(e)}`:``]}),e.status===`failed`&&e.error?(0,U.jsx)(`p`,{className:`text-destructive mt-1.5 font-mono text-xs break-all`,children:e.error}):null]})]},e.id))})})})}function x2({label:e,icon:t,title:n,description:r,onConfirm:i,disabled:a}){return(0,U.jsxs)(_g,{children:[(0,U.jsx)(vg,{asChild:!0,children:(0,U.jsxs)(Y,{size:`sm`,variant:`outline`,disabled:a,children:[t,e]})}),(0,U.jsxs)(xg,{children:[(0,U.jsxs)(Sg,{children:[(0,U.jsx)(wg,{children:n}),(0,U.jsx)(Tg,{children:r})]}),(0,U.jsxs)(Cg,{children:[(0,U.jsx)(Dg,{children:`Cancel`}),(0,U.jsx)(Eg,{onClick:i,children:e})]})]})]})}function S2({title:e,description:t,onBack:n,onRedeploy:r,onPullRedeploy:i,running:a}){return(0,U.jsx)(a_,{title:e,description:t,action:(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[r?(0,U.jsx)(x2,{label:`Redeploy`,icon:(0,U.jsx)(jr,{className:`size-4`}),title:`Redeploy ${e}?`,description:`Rebuilds the existing code and restarts the process. It won't pull new commits — the site will be briefly unavailable while it restarts.`,onConfirm:r,disabled:a}):null,i?(0,U.jsx)(x2,{label:`Pull & Redeploy`,icon:(0,U.jsx)(dr,{className:`size-4`}),title:`Pull the latest commit and redeploy ${e}?`,description:`Fetches the latest commit on its branch, reinstalls dependencies, rebuilds, and restarts. It will be briefly unavailable while this runs.`,onConfirm:i,disabled:a}):null,(0,U.jsxs)(Y,{size:`sm`,variant:`outline`,onClick:n,children:[(0,U.jsx)(qn,{className:`size-4`}),`Back`]})]})})}function C2({website:e}){let t=Cv(),n=t.status===`authenticated`?t.session.host:null;return(0,U.jsx)(kg,{title:`Website details`,children:(0,U.jsxs)(`div`,{className:`grid gap-4`,children:[(0,U.jsx)(Ag,{label:`Name`,value:e.name}),e.domain?(0,U.jsx)(Mg,{label:`Website URL`,href:`https://${e.domain}`,children:e.domain}):(0,U.jsx)(Ag,{label:`Website URL`,value:`No domain attached`}),n?(0,U.jsx)(Mg,{label:`Server`,href:`http://${n}:${e.port}`,children:`${n}:${e.port}`}):(0,U.jsx)(Ag,{label:`Server`,value:`Port ${e.port}`}),(0,U.jsx)(Ag,{label:`Repository`,value:e.repository}),(0,U.jsx)(Ag,{label:`Branch`,value:e.branch??`main`}),(0,U.jsx)(Ag,{label:`Runtime`,value:e.runtime.toUpperCase()}),(0,U.jsx)(Ag,{label:`Status`,value:e.status.charAt(0).toUpperCase()+e.status.slice(1)})]})})}function w2(e){return e.split(`
103
103
  `).map(e=>e.trim()).filter(e=>e&&!e.startsWith(`#`)).map(e=>{let t=e.indexOf(`=`);return t===-1?{key:e,value:``}:{key:e.slice(0,t).trim(),value:e.slice(t+1).trim()}})}function T2({name:e}){let{data:t,loading:n,error:r,reload:i}=j_(`/deployments/${e}/env`),[a,o]=(0,N.useState)(!1),[s,c]=(0,N.useState)(!1),l=(0,N.useId)(),u=t?.content??null,d=u?w2(u):[];return(0,U.jsxs)(kg,{title:`Environment variables`,children:[(0,U.jsxs)(`div`,{className:`mb-4 flex items-center justify-between gap-3`,children:[(0,U.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:u?`${d.length} variable${d.length===1?``:`s`} in .env`:`No .env file uploaded yet.`}),u?(0,U.jsxs)(`label`,{className:`text-muted-foreground flex items-center gap-2 text-xs`,children:[a?(0,U.jsx)(rr,{className:`size-3.5`}):(0,U.jsx)(Wr,{className:`size-3.5`}),`Developer mode`,(0,U.jsx)(Ev,{checked:a,onCheckedChange:o,size:`sm`})]}):null]}),(0,U.jsx)(Jg,{loading:n,error:r,rows:2,children:u?(0,U.jsx)(`div`,{className:`mb-4`,children:a?(0,U.jsx)(`pre`,{className:`bg-muted max-h-72 overflow-auto rounded-md p-3 font-mono text-xs whitespace-pre-wrap`,children:u}):(0,U.jsx)(`div`,{className:`rounded-md border`,children:(0,U.jsxs)(`table`,{className:`w-full text-xs`,children:[(0,U.jsx)(`thead`,{children:(0,U.jsxs)(`tr`,{className:`border-b text-left`,children:[(0,U.jsx)(`th`,{className:`text-muted-foreground px-3 py-2 font-medium`,children:`Key`}),(0,U.jsx)(`th`,{className:`text-muted-foreground px-3 py-2 font-medium`,children:`Value`})]})}),(0,U.jsx)(`tbody`,{children:d.map(({key:e,value:t},n)=>(0,U.jsxs)(`tr`,{className:`last:border-b-0`,children:[(0,U.jsx)(`td`,{className:`px-3 py-2 font-mono`,children:e}),(0,U.jsx)(`td`,{className:`text-muted-foreground px-3 py-2 font-mono break-all`,children:t})]},`${e}-${n}`))})]})})}):null}),(0,U.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,U.jsx)(hg,{htmlFor:l,className:`text-muted-foreground text-xs font-medium`,children:u?`Replace .env file`:`Upload .env file`}),(0,U.jsx)(`input`,{id:l,type:`file`,accept:`.env,.env.*`,disabled:s,onChange:async t=>{let n=t.target.files?.[0];if(t.target.value=``,!n)return;let r=n.text().then(t=>D_.put(`/deployments/${e}/env`,{content:t}));c(!0),Y_.promise(r,{loading:`Uploading ${n.name}…`,success:`Environment updated — restarting ${e}…`,error:e=>e.message||`Could not upload environment file`}),await r.catch(()=>void 0),c(!1),i()},className:`text-muted-foreground border-input hover:border-foreground/20 cursor-pointer rounded-md border border-dashed bg-transparent px-3 py-6 text-center text-xs transition-colors disabled:cursor-not-allowed disabled:opacity-50`}),(0,U.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Replaces .env in the project root and restarts `,e,` with the updated values.`]})]})]})}function E2({website:e}){let t=st();return(0,U.jsx)(Vg,{leading:(0,U.jsx)(g_,{tone:e.status}),title:e.name,subtitle:`${e.domain??e.repository} · port ${e.port}`,trailing:(0,U.jsx)(m2,{runtime:e.runtime}),className:`cursor-pointer`,onClick:()=>t(`/websites/${e.name}`)})}function D2({websites:e}){return e.length===0?(0,U.jsx)(jg,{icon:Ar,title:`No websites yet`,description:`Clone a repository and easy vps will run it with PM2 or Docker and keep it alive.`}):(0,U.jsx)(`div`,{className:`border-border rounded-lg border px-3`,children:e.map(e=>(0,U.jsx)(E2,{website:e},e.name))})}function O2({website:e}){let{lines:t,status:n}=Nv(`/api/deployments/${e.name}/logs/stream`),r=(0,N.useRef)(null);return(0,N.useEffect)(()=>{r.current?.scrollTo({top:r.current.scrollHeight})},[t]),(0,U.jsxs)(kg,{title:`Logs`,children:[(0,U.jsx)(`div`,{ref:r,className:`bg-muted max-h-96 overflow-y-auto rounded-md p-4 font-mono text-xs whitespace-pre-wrap`,children:t.length>0?t.join(`
104
104
  `):n===`running`?`Waiting for output…`:`No logs available.`}),n===`error`?(0,U.jsxs)(`p`,{className:`text-destructive mt-2 text-xs`,children:[`Log stream ended — `,e.name,` may not be running.`]}):null]})}function k2({website:e,onDelete:t}){return(0,U.jsxs)(`div`,{className:`grid gap-6`,children:[(0,U.jsx)(kg,{title:`General`,children:(0,U.jsxs)(`div`,{className:`grid gap-4`,children:[(0,U.jsx)(Ag,{label:`Name`,value:e.name}),(0,U.jsx)(Ag,{label:`Branch`,value:e.branch??`main`}),(0,U.jsx)(Ag,{label:`Port`,value:String(e.port)})]})}),(0,U.jsx)(Og,{description:`Permanently delete this website and stop the running process. This cannot be undone.`,actionLabel:`Delete website`,confirmTitle:`Delete ${e.name}?`,confirmDescription:`This will remove the website and stop the running process. This action cannot be undone.`,onConfirm:t})]})}function A2({creating:e,onCreate:t,onCancel:n}){return(0,U.jsx)(a_,{title:`Websites`,description:`Apps running on this server, from Git to PM2 or Docker.`,action:e?(0,U.jsxs)(Y,{size:`sm`,variant:`outline`,onClick:n,children:[(0,U.jsx)(qn,{className:`size-4`}),`Back`]}):(0,U.jsxs)(Y,{size:`sm`,onClick:t,children:[(0,U.jsx)(Or,{className:`size-4`}),`New website`]})})}function j2(){let{data:e,loading:t,error:n,reload:r}=j_(`/deployments`);return{websites:e??[],loading:t,error:n,reload:r}}var M2=[{id:`details`,label:`Details`},{id:`deployments`,label:`Deployments`},{id:`logs`,label:`Logs`},{id:`env`,label:`Environment`},{id:`settings`,label:`Settings`}];function N2(){let{name:e}=dt(),t=st(),[n,r]=(0,N.useState)(`details`),[i,a]=(0,N.useState)(null),{websites:o,loading:s,error:c,reload:l}=j2(),u=o.find(t=>t.name===e),d=()=>t(`/websites`),f=async()=>{if(!u)return;let e=D_.delete(`/deployments/${u.name}`);Y_.promise(e,{loading:`Deleting ${u.name}…`,success:`${u.name} deleted`,error:e=>e.message||`Could not delete ${u.name}`});try{await e}catch{return}l(),d()},p=(0,N.useCallback)(e=>{l(),Y_.success(`${e.name} redeployed`)},[l]);return u?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(S2,{title:u.name,description:`${u.repository} · port ${u.port}`,onBack:d,onRedeploy:()=>a({kind:`redeploy`,website:u}),onPullRedeploy:()=>a({kind:`pull-redeploy`,website:u}),running:!!i}),(0,U.jsxs)(`div`,{className:`flex gap-8`,children:[(0,U.jsx)(__,{tabs:M2,active:n,onChange:r}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[n===`details`&&(0,U.jsx)(C2,{website:u}),n===`deployments`&&(0,U.jsx)(b2,{name:u.name}),n===`logs`&&(0,U.jsx)(O2,{website:u}),n===`env`&&(0,U.jsx)(T2,{name:u.name}),n===`settings`&&(0,U.jsx)(k2,{website:u,onDelete:f})]})]}),(0,U.jsx)(f2,{trigger:i,onOpenChange:e=>!e&&a(null),onDeployed:p})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(S2,{title:e??`Website`,description:s?`Loading…`:`Not found.`,onBack:d}),(0,U.jsx)(Jg,{loading:s,error:c,children:(0,U.jsx)(jg,{icon:lr,title:`Website not found`,description:`This website may have been deleted.`})})]})}function P2(){let{websites:e,loading:t,error:n,reload:r}=j2(),[i,a]=(0,N.useState)(!1),[o,s]=(0,N.useState)(null),c=e=>{a(!1),s({kind:`create`,input:e})},l=(0,N.useCallback)(e=>{r(),Y_.success(`${e.name} is live`,{description:`${e.domain??`port ${e.port}`} · ${e.runtime}`})},[r]);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(A2,{creating:i,onCreate:()=>a(!0),onCancel:()=>a(!1)}),i?(0,U.jsx)(`div`,{className:`border-border rounded-lg border p-4`,children:(0,U.jsx)(u2,{onSubmit:c,onCancel:()=>a(!1)})}):(0,U.jsx)(Jg,{loading:t,error:n,children:(0,U.jsx)(D2,{websites:e})}),(0,U.jsx)(f2,{trigger:o,onOpenChange:e=>!e&&s(null),onDeployed:l})]})}function F2({instance:e}){return(0,U.jsxs)(`div`,{className:`text-muted-foreground flex items-center gap-3 text-xs tabular-nums`,children:[(0,U.jsxs)(`span`,{children:[e.cpu,`% CPU`]}),(0,U.jsxs)(`span`,{children:[e.memoryMb,` MB`]}),(0,U.jsxs)(`span`,{children:[e.restarts,` restarts`]})]})}var I2={running:`Online`,stopped:`Stopped`,unknown:`Unknown`};function L2({status:e}){return(0,U.jsxs)(Fv,{variant:`outline`,className:`text-muted-foreground gap-1.5 font-normal`,children:[(0,U.jsx)(g_,{tone:e}),I2[e]]})}function R2({instance:e,onRestart:t,onStop:n,onDelete:r,onLogs:i}){return(0,U.jsx)(Vg,{title:`${e.name} #${e.instanceId}`,subtitle:(0,U.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(L2,{status:e.status}),(0,U.jsx)(F2,{instance:e})]}),trailing:(0,U.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,U.jsx)(Y,{variant:`ghost`,size:`icon`,"aria-label":`Logs for ${e.name}`,className:`size-7`,onClick:()=>i(e.name),children:(0,U.jsx)(Mr,{className:`size-3.5`})}),(0,U.jsx)(Y,{variant:`ghost`,size:`icon`,"aria-label":`Restart ${e.name}`,className:`size-7`,onClick:()=>t(e.name),children:(0,U.jsx)(jr,{className:`size-3.5`})}),(0,U.jsx)(Y,{variant:`ghost`,size:`icon`,"aria-label":`Stop ${e.name}`,className:`size-7`,onClick:()=>n(e.name),children:(0,U.jsx)(Hr,{className:`size-3.5`})}),(0,U.jsxs)(_g,{children:[(0,U.jsx)(vg,{asChild:!0,children:(0,U.jsx)(Y,{variant:`ghost`,size:`icon`,"aria-label":`Delete ${e.name}`,className:`text-muted-foreground hover:text-destructive size-7`,children:(0,U.jsx)(Kr,{className:`size-3.5`})})}),(0,U.jsxs)(xg,{children:[(0,U.jsxs)(Sg,{children:[(0,U.jsxs)(wg,{children:[`Delete `,e.name,`?`]}),(0,U.jsx)(Tg,{children:`This will remove the PM2 process permanently. It will stop running and be deregistered from PM2.`})]}),(0,U.jsxs)(Cg,{children:[(0,U.jsx)(Dg,{children:`Cancel`}),(0,U.jsx)(Eg,{variant:`destructive`,onClick:()=>r(e.name),children:`Delete`})]})]})]})]})})}function z2({instances:e,onRestart:t,onStop:n,onDelete:r,onLogs:i}){return e.length===0?(0,U.jsx)(jg,{icon:Kn,title:`No PM2 instances`,description:`Apps deployed with the PM2 runtime will appear here, with live CPU, memory and restart counts.`}):(0,U.jsx)(`div`,{className:`border-border rounded-lg border px-3`,children:e.map(e=>(0,U.jsx)(R2,{instance:e,onRestart:t,onStop:n,onDelete:r,onLogs:i},`${e.name}-${e.instanceId}`))})}function B2(){let{data:e,error:t,loading:n,reload:r}=j_(`/instances`),[i,a]=(0,N.useState)(null),{lines:o,status:s}=Nv(i?`/api/instances/${i}/logs/stream`:null);function c(e){let t=D_.post(`/instances/${e}/restart`);Y_.promise(t,{loading:`Restarting ${e}...`,success:`${e} restarted`,error:e=>e.message||`Failed to restart`}),t.then(()=>r(),()=>{})}function l(e){let t=D_.post(`/instances/${e}/stop`);Y_.promise(t,{loading:`Stopping ${e}...`,success:`${e} stopped`,error:e=>e.message||`Failed to stop`}),t.then(()=>r(),()=>{})}function u(e){let t=D_.delete(`/instances/${e}`);Y_.promise(t,{loading:`Deleting ${e}...`,success:`${e} deleted`,error:e=>e.message||`Failed to delete`}),t.then(()=>r(),()=>{})}return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(a_,{title:`PM2 instances`,description:`Processes managed by PM2, with live status and resource use.`}),(0,U.jsx)(Jg,{loading:n,error:t,children:(0,U.jsx)(z2,{instances:e??[],onRestart:c,onStop:l,onDelete:u,onLogs:a})}),(0,U.jsx)(i_,{open:i!==null,title:i?`${i} logs`:`Logs`,description:`Live PM2 output for this process.`,lines:o,status:s,onOpenChange:e=>{e||a(null)}})]})}function V2({following:e,onToggle:t}){return(0,U.jsxs)(Y,{variant:`outline`,size:`sm`,className:`h-7`,onClick:t,children:[e?(0,U.jsx)(Tr,{className:`size-3.5`}):(0,U.jsx)(Dr,{className:`size-3.5`}),e?`Pause`:`Follow`]})}var H2=[{id:`panel`,label:`Panel`,origin:`journalctl -u easy-vps`},{id:`nginx`,label:`Nginx`,origin:`/var/log/nginx/error.log`},{id:`pm2`,label:`PM2`,origin:`pm2 logs`},{id:`docker`,label:`Docker`,origin:`docker logs`}];function U2({value:e,onChange:t}){return(0,U.jsx)(mv,{value:e,onValueChange:e=>t(e),children:(0,U.jsx)(gv,{children:H2.map(e=>(0,U.jsx)(_v,{value:e.id,children:e.label},e.id))})})}function W2({lines:e,source:t}){return(0,U.jsx)(`div`,{className:`log-viewer border-border bg-muted/40 max-h-[90vh] overflow-auto rounded-lg border`,children:e.length===0?(0,U.jsxs)(`div`,{className:`flex flex-col items-center justify-center px-6 py-14 text-center`,children:[(0,U.jsx)(Mr,{className:`text-muted-foreground/70 size-5`}),(0,U.jsxs)(`p`,{className:`mt-3 text-sm font-medium`,children:[`No `,t.label,` output yet`]}),(0,U.jsxs)(`p`,{className:`text-muted-foreground mt-1 max-w-xs text-xs`,children:[`Lines from `,t.origin,` will stream here once log streaming is connected.`]})]}):(0,U.jsx)(`pre`,{className:`w-max min-w-full px-3 py-2.5 font-mono text-xs leading-relaxed`,children:e.map((e,t)=>(0,U.jsxs)(`div`,{className:`whitespace-pre`,children:[e.timestamp?(0,U.jsxs)(`span`,{className:`text-muted-foreground`,children:[e.timestamp,` `]}):null,e.message]},t))})})}function G2(){let[e,t]=(0,N.useState)(`panel`),[n,r]=(0,N.useState)(!1),i=H2.find(t=>t.id===e)??H2[0],{lines:a,status:o}=Nv(n?`/api/logs/${e}/stream`:null),s=(0,N.useMemo)(()=>a.map(t=>({timestamp:``,source:e,message:t})),[a,e]);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(a_,{title:`Runtime logs`,description:`Output from the panel, Nginx, PM2 and Docker.`,action:(0,U.jsx)(V2,{following:n,onToggle:()=>r(e=>!e)})}),(0,U.jsx)(`div`,{className:`mb-3`,children:(0,U.jsx)(U2,{value:e,onChange:e=>{t(e),r(!1)}})}),(0,U.jsx)(W2,{lines:s,source:i}),n&&o===`error`?(0,U.jsx)(`p`,{className:`text-destructive mt-2 text-xs`,children:`Log stream ended unexpectedly.`}):null]})}function K2(){let{data:e,error:t,loading:n,reload:r}=j_(`/system/status`),[i,a]=(0,N.useState)(``),[o,s]=(0,N.useState)(null),[c,l]=(0,N.useState)(null),u=(0,N.useMemo)(()=>{if(!e)return[];let t=i.toLowerCase();return e.dependencies.filter(e=>e.name.toLowerCase().includes(t)||Cy[e.name].toLowerCase().includes(t)||wy[e.name].toLowerCase().includes(t))},[e,i]),d=(0,N.useMemo)(()=>u.filter(e=>e.installed),[u]),f=(0,N.useMemo)(()=>u.filter(e=>!e.installed),[u]);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(a_,{title:`Dependencies`,description:`Manage system packages installed on this server.`}),(0,U.jsx)(`div`,{className:`mb-6`,children:(0,U.jsx)(Ng,{placeholder:`Search dependencies...`,value:i,onChange:e=>a(e.target.value),className:`max-w-sm`})}),(0,U.jsx)(Jg,{loading:n,error:t,rows:5,children:e?(0,U.jsxs)(`div`,{className:`space-y-8`,children:[d.length>0&&(0,U.jsxs)(`section`,{children:[(0,U.jsx)(`h2`,{className:`text-muted-foreground mb-3 text-sm font-medium`,children:`Installed Dependencies`}),(0,U.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:d.map(e=>(0,U.jsx)(q2,{dependency:e,busy:o?.name===e.name,onClick:()=>l(e)},e.name))})]}),f.length>0&&(0,U.jsxs)(`section`,{children:[(0,U.jsx)(`h2`,{className:`text-muted-foreground mb-3 text-sm font-medium`,children:`Suggested for You`}),(0,U.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:f.map(e=>(0,U.jsx)(q2,{dependency:e,busy:o?.name===e.name,onClick:()=>l(e)},e.name))})]})]}):null}),c?(0,U.jsx)(_g,{open:!!c,onOpenChange:e=>{e||l(null)},children:(0,U.jsxs)(xg,{children:[(0,U.jsxs)(Sg,{children:[(0,U.jsxs)(wg,{children:[c.installed?`Uninstall`:`Install`,` `,Cy[c.name],`?`]}),(0,U.jsx)(Tg,{asChild:!0,children:(0,U.jsx)(`div`,{className:`space-y-2`,children:c.installed?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{children:[`This purges the `,Cy[c.name],` package from the server and permanently deletes its configuration. It cannot be undone.`]}),c.removes.length>0&&(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`text-foreground font-medium`,children:`These are deleted:`}),(0,U.jsx)(`ul`,{className:`mt-1 list-disc space-y-0.5 pl-5 font-mono text-xs`,children:c.removes.map(e=>(0,U.jsx)(`li`,{children:e},e))})]})]}):(0,U.jsxs)(`p`,{children:[`This runs the package manager on the server to install`,` `,Cy[c.name],`. It may take a minute.`]})})})]}),(0,U.jsxs)(Cg,{children:[(0,U.jsx)(Dg,{children:`Cancel`}),(0,U.jsx)(Eg,{className:c.installed?`bg-destructive text-black hover:bg-destructive/90`:``,onClick:()=>{s({name:c.name,action:c.installed?`uninstall`:`install`}),l(null)},children:c.installed?`Uninstall`:`Install`})]})]})}):null,(0,U.jsx)(Oy,{run:o,onOpenChange:e=>!e&&s(null),onFinished:r})]})}function q2({dependency:e,busy:t,onClick:n}){return(0,U.jsx)(`button`,{type:`button`,onClick:n,disabled:t,className:H(`text-left transition-colors cursor-pointer`,`rounded-xl ring-1 ring-foreground/10`,`focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 outline-none`,`disabled:pointer-events-none disabled:opacity-50`),children:(0,U.jsx)(vy,{size:`sm`,className:`border-0 ring-0`,children:(0,U.jsxs)(xy,{className:`flex items-center gap-3`,children:[(0,U.jsx)(Dy,{name:e.name,className:`size-5 shrink-0`}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`truncate text-sm font-medium`,children:Cy[e.name]}),e.installed&&e.version&&(0,U.jsx)(`span`,{className:`bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 rounded-full px-1.5 py-0.5 text-[10px] font-medium leading-none`,children:e.version.split(`.`).slice(0,2).join(`.`)})]}),(0,U.jsx)(`p`,{className:`text-muted-foreground mt-0.5 truncate text-xs`,children:wy[e.name]})]})]})})})}var J2=3e4;function Y2(){let{data:e,error:t,loading:n,reload:r}=j_(`/system/metrics`),[i,a]=(0,N.useState)(null),[o,s]=(0,N.useState)(!1),c=(0,N.useCallback)(async()=>{try{let e=await(await fetch(`/api/system/update/check`)).json();a(e)}catch{}},[]);(0,N.useEffect)(()=>{let e=setInterval(r,J2);return()=>clearInterval(e)},[r]),(0,N.useEffect)(()=>{c()},[c]);let l=(0,N.useCallback)(()=>{window.location.reload()},[]);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(a_,{title:`Dashboard`,description:`Real-time system overview and resource usage.`,action:(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[i?.updateAvailable?(0,U.jsxs)(Y,{size:`sm`,onClick:()=>s(!0),children:[(0,U.jsx)(sr,{className:`size-4 mr-1.5`}),`Update to v`,i.latest]}):null,(0,U.jsxs)(Y,{variant:`outline`,size:`sm`,onClick:r,children:[(0,U.jsx)(kr,{className:`size-4 mr-1.5`}),`Refresh`]})]})}),(0,U.jsx)(Jg,{loading:n,error:t,rows:6,children:e?(0,U.jsxs)(`div`,{className:`space-y-6`,children:[(0,U.jsx)(j0,{metrics:e}),(0,U.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-3`,children:[(0,U.jsx)(w0,{cpuCores:e.cpu.cores,className:`lg:col-span-2`}),(0,U.jsx)(D0,{})]}),(0,U.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-2`,children:[(0,U.jsx)(M0,{processes:e.topProcesses}),(0,U.jsx)(Sy,{})]})]}):null}),(0,U.jsx)(N0,{open:o,onOpenChange:s,onFinished:l})]})}function X2({label:e,children:t}){return(0,U.jsxs)(`div`,{className:`grid grid-cols-[30%_70%] items-start gap-4 border-b py-3 last:border-b-0`,children:[(0,U.jsx)(`div`,{className:`text-sm font-medium`,children:e}),(0,U.jsx)(`div`,{className:`min-w-0`,children:t})]})}function Z2({open:e,onOpenChange:t,currentTotalMb:n,defaultSizeMb:r,onSave:i}){let[a,o]=(0,N.useState)(String(r)),[s,c]=(0,N.useState)(),[l,u]=(0,N.useState)(!1);return(0,N.useEffect)(()=>{e&&(o(String(r)),c(void 0))},[e,r]),(0,U.jsx)(Yg,{open:e,onOpenChange:e=>l?void 0:t(e),children:(0,U.jsxs)($g,{children:[(0,U.jsxs)(e_,{children:[(0,U.jsx)(n_,{children:`Edit swap size`}),(0,U.jsxs)(r_,{children:[`Current total swap: `,n>0?`${n} MB`:`none`,`. Enter the total swap size you want; the panel will set a single swap file of this size (replacing any existing swap).`]})]}),(0,U.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,U.jsx)(`label`,{className:`text-muted-foreground text-xs font-medium`,htmlFor:`swap-size`,children:`Swap size (MB) — /swapfile`}),(0,U.jsx)(Ng,{id:`swap-size`,type:`number`,min:0,value:a,onChange:e=>o(e.target.value),"aria-invalid":s?!0:void 0}),s?(0,U.jsx)(`p`,{className:`text-destructive text-xs`,children:s}):null]}),(0,U.jsxs)(t_,{children:[(0,U.jsx)(Y,{variant:`outline`,onClick:()=>t(!1),disabled:l,children:`Cancel`}),(0,U.jsx)(Y,{onClick:async()=>{let e=Number(a);if(a.trim()===``||!Number.isInteger(e)||e<0){c(`Enter a non-negative whole number of MB (0 disables swap).`);return}u(!0);try{await i(e),t(!1)}catch(e){c(e.message)}finally{u(!1)}},disabled:l,children:`Save`})]})]})})}function Q2(e){return e>=1024?`${(e/1024).toFixed(1)} GB`:`${Math.round(e)} MB`}function $2(){let{data:e,error:t,loading:n,reload:r}=j_(`/system/config`),[i,a]=(0,N.useState)(``),[o,s]=(0,N.useState)(``),[c,l]=(0,N.useState)({}),[u,d]=(0,N.useState)(!1),[f,p]=(0,N.useState)(!1);(0,N.useEffect)(()=>{e&&(a(e.hostname),s(e.timezone))},[e]);let m={};e&&i.trim()!==e.hostname&&(m.hostname=i.trim()),e&&o.trim()!==e.timezone&&(m.timezone=o.trim());let h=Object.keys(m).length>0,g=()=>{let e={};return i.trim()&&!/^[a-zA-Z0-9.-]+$/.test(i.trim())&&(e.hostname=`Letters, digits, dots and hyphens only.`),o.trim()===``&&(e.timezone=`Timezone is required.`),l(e),Object.keys(e).length===0};return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(a_,{title:`System configurations`,description:`View system information and adjust a few host-level settings.`,action:(0,U.jsx)(Y,{size:`sm`,onClick:()=>{if(!h||!g())return;d(!0);let e=D_.put(`/system/config`,m);Y_.promise(e,{loading:`Applying configuration…`,success:()=>(r(),`Configuration updated.`),error:e=>e.message}),e.finally(()=>d(!1))},disabled:!h||u,children:`Save changes`})}),(0,U.jsx)(Jg,{loading:n,error:t,rows:8,children:e?(0,U.jsxs)(`div`,{className:`space-y-8`,children:[(0,U.jsxs)(`section`,{children:[(0,U.jsx)(`h2`,{className:`mb-2 text-sm font-medium`,children:`System information`}),(0,U.jsx)(`div`,{className:`rounded-lg border`,children:(0,U.jsxs)(`div`,{className:`px-4`,children:[(0,U.jsx)(X2,{label:`Operating system`,children:e.os}),(0,U.jsx)(X2,{label:`Kernel`,children:e.kernel}),(0,U.jsx)(X2,{label:`Architecture`,children:e.architecture}),(0,U.jsx)(X2,{label:`Memory`,children:Q2(e.memoryTotalMb)}),(0,U.jsx)(X2,{label:`Swap`,children:(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,U.jsx)(`span`,{children:e.swap.totalMb>0?`${Q2(e.swap.usedMb)} / ${Q2(e.swap.totalMb)} (${e.swap.freeMb} MB free)`:`No swap configured`}),(0,U.jsx)(Y,{variant:`ghost`,size:`icon-sm`,onClick:()=>p(!0),"aria-label":`Edit swap size`,children:(0,U.jsx)(Er,{className:`size-4`})})]})})]})})]}),(0,U.jsxs)(`section`,{children:[(0,U.jsx)(`h2`,{className:`mb-2 text-sm font-medium`,children:`Configuration`}),(0,U.jsx)(`div`,{className:`rounded-lg border`,children:(0,U.jsxs)(`div`,{className:`px-4`,children:[(0,U.jsxs)(X2,{label:`Hostname`,children:[(0,U.jsx)(Ng,{value:i,onChange:e=>a(e.target.value),"aria-invalid":c.hostname?!0:void 0}),c.hostname?(0,U.jsx)(`p`,{className:`text-destructive mt-1 text-xs`,children:c.hostname}):null]}),(0,U.jsxs)(X2,{label:`Timezone`,children:[(0,U.jsx)(Ng,{value:o,onChange:e=>s(e.target.value),"aria-invalid":c.timezone?!0:void 0}),c.timezone?(0,U.jsx)(`p`,{className:`text-destructive mt-1 text-xs`,children:c.timezone}):null]})]})})]})]}):null}),(0,U.jsx)(Z2,{open:f,onOpenChange:p,currentTotalMb:e?.swap.totalMb??0,defaultSizeMb:e?.swap.totalMb??0,onSave:e=>{let t=D_.put(`/system/config`,{swapFileSizeMb:e});return Y_.promise(t,{loading:`Updating swap file…`,success:()=>(r(),`Swap file updated.`),error:e=>e.message}),t}})]})}function e4({label:e,children:t}){return(0,U.jsxs)(`div`,{className:`grid grid-cols-[30%_70%] items-start gap-4 border-b py-3 last:border-b-0`,children:[(0,U.jsx)(`div`,{className:`text-sm font-medium`,children:e}),(0,U.jsx)(`div`,{className:`min-w-0`,children:t})]})}function t4(){let{data:e,error:t,loading:n,reload:r}=j_(`/github/config`),[i,a]=(0,N.useState)(``),[o,s]=(0,N.useState)(``),[c,l]=(0,N.useState)(``),[u,d]=(0,N.useState)(!1),[f,p]=(0,N.useState)({}),[m,h]=(0,N.useState)(!1);(0,N.useEffect)(()=>{e&&(a(e.username),s(e.email),l(e.personalAccessToken),d(e.tokenSet))},[e]);let g={};e&&i.trim()!==e.username&&(g.username=i.trim()),e&&o.trim()!==e.email&&(g.email=o.trim()),e&&c.trim()!==e.personalAccessToken&&(g.personalAccessToken=c.trim());let _=Object.keys(g).length>0,v=()=>{let e={};return i.trim()===``&&(e.username=`Github username is required.`),o.trim()===``?e.email=`Email is required.`:/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o.trim())||(e.email=`Enter a valid email address.`),!u&&c.trim()===``&&(e.personalAccessToken=`Personal access token is required.`),p(e),Object.keys(e).length===0};return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(a_,{title:`Github configuration`,description:`Set the Github identity and credentials used by the panel.`,action:(0,U.jsx)(Y,{size:`sm`,onClick:()=>{if(!_||!v())return;h(!0);let e=D_.put(`/github/config`,g);Y_.promise(e,{loading:`Applying configuration…`,success:()=>(r(),`Configuration updated.`),error:e=>e.message}),e.finally(()=>h(!1))},disabled:!_||m,children:`Save changes`})}),(0,U.jsx)(Jg,{loading:n,error:t,rows:4,children:e?(0,U.jsxs)(`section`,{children:[(0,U.jsx)(`h2`,{className:`mb-2 text-sm font-medium`,children:`Configuration`}),(0,U.jsx)(`div`,{className:`rounded-lg border`,children:(0,U.jsxs)(`div`,{className:`px-4`,children:[(0,U.jsxs)(e4,{label:`Github username`,children:[(0,U.jsx)(Ng,{value:i,onChange:e=>a(e.target.value),"aria-invalid":f.username?!0:void 0}),f.username?(0,U.jsx)(`p`,{className:`text-destructive mt-1 text-xs`,children:f.username}):null]}),(0,U.jsxs)(e4,{label:`Email`,children:[(0,U.jsx)(Ng,{value:o,onChange:e=>s(e.target.value),"aria-invalid":f.email?!0:void 0}),f.email?(0,U.jsx)(`p`,{className:`text-destructive mt-1 text-xs`,children:f.email}):null]}),(0,U.jsxs)(e4,{label:`Personal access token`,children:[(0,U.jsx)(Ng,{type:`password`,value:c,onChange:e=>l(e.target.value),placeholder:u?`Already set — enter a new token to replace`:`ghp_…`,"aria-invalid":f.personalAccessToken?!0:void 0}),f.personalAccessToken?(0,U.jsx)(`p`,{className:`text-destructive mt-1 text-xs`,children:f.personalAccessToken}):null]})]})})]}):null})]})}var n4=[{value:`tcp`,label:`TCP`},{value:`udp`,label:`UDP`}];function r4(){let{data:e,error:t,loading:n,reload:r}=j_(`/firewall/status`),[i,a]=(0,N.useState)(``),[o,s]=(0,N.useState)(`tcp`),[c,l]=(0,N.useState)(!1),[u,d]=(0,N.useState)(null),[f,p]=(0,N.useState)(!1),[m,h]=(0,N.useState)(null),g=e;function _(e){e.preventDefault();let t=Number(i);if(!Number.isInteger(t)||t<1||t>65535){Y_.error(`Enter a port between 1 and 65535`);return}l(!0);let n=D_.post(`/firewall/rules`,{port:t,protocol:o});Y_.promise(n,{loading:`Opening ${t}/${o}…`,success:`${t}/${o} is now open`,error:e=>e.message||`Failed to open port`}),n.then(()=>{a(``),r()}).finally(()=>l(!1))}function v(e){d(e);let t=D_.delete(`/firewall/rules/${e}`);Y_.promise(t,{loading:`Removing rule…`,success:`Rule removed`,error:e=>e.message||`Failed to remove rule`}),t.then(()=>r()).finally(()=>d(null))}function y(){if(!g)return;p(!0);let e=D_.post(`/firewall/state`,{enabled:!g.active});Y_.promise(e,{loading:g.active?`Disabling firewall…`:`Enabling firewall…`,success:g.active?`Firewall disabled`:`Firewall enabled`,error:e=>e.message||`Failed to change firewall state`}),e.then(()=>r()).finally(()=>p(!1))}return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(a_,{title:`Firewall`,description:`Manage ufw rules to control inbound traffic on this server.`}),g&&!g.installed?(0,U.jsxs)(Ug,{variant:`warning`,className:`mb-8`,children:[(0,U.jsx)(Vr,{}),(0,U.jsx)(Wg,{children:`ufw is not installed`}),(0,U.jsx)(Gg,{children:`Install ufw on the server to manage firewall rules from here.`})]}):null,(0,U.jsxs)(m_,{title:`Open a port`,description:`Allow inbound traffic to a TCP or UDP port.`,action:g?.installed?(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsxs)(Fv,{variant:g.active?`default`:`secondary`,children:[(0,U.jsx)(g_,{tone:g.active?`running`:`stopped`}),g.active?`Active`:`Inactive`]}),(0,U.jsx)(Y,{variant:g.active?`outline`:`default`,size:`sm`,disabled:f,onClick:y,children:g.active?`Disable`:`Enable`})]}):null,children:[(0,U.jsxs)(`form`,{onSubmit:_,className:`flex flex-wrap items-end gap-3`,children:[(0,U.jsx)(`div`,{className:`w-40`,children:(0,U.jsx)(Fg,{id:`port`,label:`Port`,type:`number`,inputMode:`numeric`,min:1,max:65535,placeholder:`e.g. 3000`,value:i,onChange:e=>a(e.target.value)})}),(0,U.jsx)(`div`,{className:`w-32`,children:(0,U.jsx)(p_,{label:`Protocol`,options:n4,value:o,onValueChange:e=>s(e)})}),(0,U.jsxs)(Y,{type:`submit`,disabled:c,children:[(0,U.jsx)(Or,{}),`Open port`]})]}),g?.installed&&!g.active?(0,U.jsx)(`p`,{className:`text-muted-foreground mt-2 text-xs`,children:`The firewall is inactive — rules are recorded but not enforced until ufw is enabled.`}):null]}),(0,U.jsx)(m_,{title:`Rules`,description:`Ports currently allowed through the firewall.`,children:(0,U.jsx)(Jg,{loading:n,error:t,children:g&&g.rules.length>0?(0,U.jsx)(`div`,{className:`rounded-lg border`,children:g.rules.map(e=>(0,U.jsx)(Vg,{leading:(0,U.jsx)(Vr,{className:`size-4`}),title:e.to,subtitle:`${e.action} · from ${e.from}`,trailing:(0,U.jsxs)(Y,{variant:`ghost`,size:`sm`,disabled:u===e.number,onClick:()=>h(e),children:[(0,U.jsx)(Kr,{}),`Remove`]})},e.number))}):(0,U.jsx)(jg,{icon:Vr,title:`No rules yet`,description:`Open a port above to add your first firewall rule.`})})}),(0,U.jsx)(_g,{open:m!==null,onOpenChange:e=>{e||h(null)},children:(0,U.jsxs)(xg,{children:[(0,U.jsxs)(Sg,{children:[(0,U.jsx)(wg,{children:`Remove firewall rule?`}),(0,U.jsxs)(Tg,{children:[`This will delete the rule for`,` `,(0,U.jsx)(`span`,{className:`font-medium text-foreground`,children:m?.to}),` (`,m?.action,`). The port will no longer be allowed through the firewall.`]})]}),(0,U.jsxs)(Cg,{children:[(0,U.jsx)(Dg,{children:`Cancel`}),(0,U.jsx)(Eg,{variant:`destructive`,disabled:u!==null,onClick:()=>{m&&v(m.number)},children:`Remove rule`})]})]})})]})}function i4(){return(0,U.jsxs)(Lt,{children:[(0,U.jsx)(Ft,{path:`/login`,element:(0,U.jsx)(Tv,{})}),(0,U.jsx)(Ft,{element:(0,U.jsx)(wv,{}),children:(0,U.jsxs)(Ft,{element:(0,U.jsx)(M_,{}),children:[(0,U.jsx)(Ft,{path:`/`,element:(0,U.jsx)(Y2,{})}),(0,U.jsx)(Ft,{path:`/domains`,element:(0,U.jsx)(Q0,{})}),(0,U.jsx)(Ft,{path:`/websites`,element:(0,U.jsx)(P2,{})}),(0,U.jsx)(Ft,{path:`/websites/:name`,element:(0,U.jsx)(N2,{})}),(0,U.jsx)(Ft,{path:`/databases`,element:(0,U.jsx)(_y,{})}),(0,U.jsx)(Ft,{path:`/databases/:name`,element:(0,U.jsx)(ty,{})}),(0,U.jsx)(Ft,{path:`/firewall`,element:(0,U.jsx)(r4,{})}),(0,U.jsx)(Ft,{path:`/logs`,element:(0,U.jsx)(G2,{})}),(0,U.jsx)(Ft,{path:`/instances`,element:(0,U.jsx)(B2,{})}),(0,U.jsx)(Ft,{path:`/dependencies`,element:(0,U.jsx)(K2,{})}),(0,U.jsx)(Ft,{path:`/system-config`,element:(0,U.jsx)($2,{})}),(0,U.jsx)(Ft,{path:`/github-config`,element:(0,U.jsx)(t4,{})})]})}),(0,U.jsx)(Ft,{path:`*`,element:(0,U.jsx)(Nt,{to:`/`,replace:!0})})]})}var a4=(e,t,n,r,i,a,o,s)=>{let c=document.documentElement,l=[`light`,`dark`];function u(t){(Array.isArray(e)?e:[e]).forEach(e=>{let n=e===`class`,r=n&&a?i.map(e=>a[e]||e):i;n?(c.classList.remove(...r),c.classList.add(a&&a[t]?a[t]:t)):c.setAttribute(e,t)}),d(t)}function d(e){s&&l.includes(e)&&(c.style.colorScheme=e)}function f(){return window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}if(r)u(r);else try{let e=localStorage.getItem(t)||n;u(o&&e===`system`?f():e)}catch{}},o4=N.createContext(void 0),s4={setTheme:e=>{},themes:[]},c4=()=>N.useContext(o4)??s4;N.memo(({forcedTheme:e,storageKey:t,attribute:n,enableSystem:r,enableColorScheme:i,defaultTheme:a,value:o,themes:s,nonce:c,scriptProps:l})=>{let u=JSON.stringify([n,t,a,e,s,o,r,i]).slice(1,-1);return N.createElement(`script`,{...l,suppressHydrationWarning:!0,nonce:typeof window>`u`?c:``,dangerouslySetInnerHTML:{__html:`(${a4.toString()})(${u})`}})});var l4=({...e})=>{let{theme:t=`system`}=c4();return(0,U.jsx)(uv,{theme:t,className:`toaster group`,icons:{success:(0,U.jsx)(er,{className:`size-4`}),info:(0,U.jsx)(mr,{className:`size-4`}),warning:(0,U.jsx)(qr,{className:`size-4`}),error:(0,U.jsx)(Cr,{className:`size-4`}),loading:(0,U.jsx)(_r,{className:`size-4 animate-spin`})},style:{"--normal-bg":`var(--popover)`,"--normal-text":`var(--popover-foreground)`,"--normal-border":`var(--border)`,"--border-radius":`var(--radius)`},toastOptions:{classNames:{toast:`cn-toast`}},...e})};function u4(){return(0,U.jsx)(x_,{children:(0,U.jsxs)(Ig,{children:[(0,U.jsx)(Tn,{children:(0,U.jsx)(i4,{})}),(0,U.jsx)(l4,{position:`bottom-center`})]})})}(0,Xr.createRoot)(document.getElementById(`root`)).render((0,U.jsx)(N.StrictMode,{children:(0,U.jsx)(u4,{})}));
package/client/index.html CHANGED
@@ -5,7 +5,7 @@
5
5
  <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>easy-vps</title>
8
- <script type="module" crossorigin src="/assets/index-Cl52Iar_.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-GlAzMH3R.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="/assets/index-DxnZ8kWT.css">
10
10
  </head>
11
11
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easy-vps",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "Install dependencies, point domains, deploy apps and run Postgres on a VPS from one UI",
5
5
  "keywords": [
6
6
  "easy-vps",