@usex/mikrotik-mcp 3.5.0 → 3.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +4027 -2098
- package/dist/index.js +4023 -2094
- package/dist/ui/observability.html +2 -2
- package/package.json +1 -1
- package/schemas/README.md +1 -1
- package/schemas/tool-catalog.json +1539 -159
- package/schemas/tools/add_dhcp_client.json +33 -0
- package/schemas/tools/apply_traffic_shaping.json +48 -0
- package/schemas/tools/audit_certificate_expiry.json +16 -0
- package/schemas/tools/audit_firewall_hardening.json +7 -0
- package/schemas/tools/build_guest_hotspot.json +48 -0
- package/schemas/tools/build_wireguard_mesh.json +79 -0
- package/schemas/tools/design_network_segment.json +65 -0
- package/schemas/tools/force_cloud_update.json +7 -0
- package/schemas/tools/forecast_link_saturation.json +23 -0
- package/schemas/tools/forward_port.json +45 -0
- package/schemas/tools/generate_hotspot_vouchers.json +33 -0
- package/schemas/tools/get_dhcp_client.json +13 -0
- package/schemas/tools/get_ip_cloud.json +7 -0
- package/schemas/tools/harden_firewall.json +104 -0
- package/schemas/tools/list_dhcp_clients.json +12 -0
- package/schemas/tools/onboard_wireguard_user.json +39 -0
- package/schemas/tools/remove_dhcp_client.json +12 -0
- package/schemas/tools/remove_firewall_hardening.json +7 -0
- package/schemas/tools/remove_threat_feed.json +13 -0
- package/schemas/tools/remove_time_policy.json +13 -0
- package/schemas/tools/renew_dhcp_client.json +17 -0
- package/schemas/tools/request_letsencrypt_certificate.json +13 -0
- package/schemas/tools/revoke_wireguard_user.json +13 -0
- package/schemas/tools/run_failover_drill.json +33 -0
- package/schemas/tools/set_dhcp_client.json +24 -0
- package/schemas/tools/set_ip_cloud.json +16 -0
- package/schemas/tools/set_ip_cloud_advanced.json +13 -0
- package/schemas/tools/set_time_policy.json +47 -0
- package/schemas/tools/setup_port_knock.json +39 -0
- package/schemas/tools/setup_wan_failover.json +36 -0
- package/schemas/tools/setup_wan_loadbalance.json +32 -0
- package/schemas/tools/subscribe_threat_feed.json +37 -0
- package/schemas/tools/test_ssh_from_device.json +28 -0
- package/schemas/tools/test_ssh_to_device.json +7 -0
- package/schemas/tools/test_ssh_to_host.json +38 -0
- package/schemas/tools/tune_wifi_channel.json +23 -0
|
@@ -68,7 +68,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
68
68
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function xV(e,t){if(e){if(typeof e==`string`)return SV(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)?SV(e,t):void 0}}function SV(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 CV(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 wV(e){if(Array.isArray(e))return e}function TV(e,t){if(e==null)return{};var n,r,i=EV(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 EV(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 DV(){return DV=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},DV.apply(null,arguments)}function OV(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 kV(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?OV(Object(n),!0).forEach(function(t){AV(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):OV(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function AV(e,t,n){return(t=jV(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function jV(e){var t=MV(e,`string`);return typeof t==`symbol`?t:t+``}function MV(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 NV={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:Qb.axis};function PV(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=kV(kV(kV({},c),M_(s)),{},{fill:`none`});if(a===`top`||a===`bottom`){var u=+(a===`top`&&!o||a===`bottom`&&o);l=kV(kV({},l),{},{x1:t,y1:n+u*i,x2:t+r,y2:n+u*i})}else{var d=+(a===`left`&&!o||a===`right`&&o);l=kV(kV({},l),{},{x1:t+d*r,y1:n,x2:t+d*r,y2:n+i})}return v.createElement(`line`,DV({},l,{className:Nc(`recharts-cartesian-axis-line`,Ic(s,`className`))}))}function FV(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=_;break}return{line:{x1:l,y1:d,x2:u,y2:f},tick:{x:p,y:m}}}function IV(e,t){switch(e){case`left`:return t?`start`:`end`;case`right`:return t?`end`:`start`;default:return`middle`}}function LV(e,t){switch(e){case`left`:case`right`:return`middle`;case`top`:return t?`start`:`end`;default:return t?`end`:`start`}}function RV(e){var t=e.option,n=e.tickProps,r=e.value,i,a=Nc(n.className,`recharts-cartesian-axis-tick-value`);if(v.isValidElement(t))i=v.cloneElement(t,kV(kV({},n),{},{className:a}));else if(typeof t==`function`)i=t(kV(kV({},n),{},{className:a}));else{var o=`recharts-cartesian-axis-tick-value`;typeof t!=`boolean`&&(o=Nc(o,sI(t))),i=v.createElement(BF,DV({},n,{className:o}),r)}return i}function zV(e){var t=e.ticks,n=e.axisType,r=e.axisId,i=$u();return(0,v.useEffect)(()=>r==null||n==null?el:(i(hV({ticks:t.map(e=>({value:e.value,coordinate:e.coordinate,offset:e.offset,index:e.index})),axisId:r,axisType:n})),()=>{i(gV({axisId:r,axisType:n}))}),[i,t,r,n]),null}var BV=(0,v.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,y=e.tickMargin,b=e.fontSize,x=e.letterSpacing,S=e.getTicksConfig,C=e.events,w=e.axisType,T=e.axisId,E=dV(kV(kV({},S),{},{ticks:r}),b,x),D=M_(S),O=N_(i),k=kF(D.textAnchor)?D.textAnchor:IV(d,f),A=LV(d,f),j={};typeof a==`object`&&(j=a);var M=kV(kV({},D),{},{fill:`none`},j),N=E.map(e=>kV({entry:e},FV(e,p,m,h,g,d,_,f,y))),P=N.map(e=>{var t=e.entry,n=e.line;return v.createElement(mP,{className:`recharts-cartesian-axis-tick`,key:`tick-${t.value}-${t.coordinate}-${t.tickCoord}`},a&&v.createElement(`line`,DV({},M,n,{className:Nc(`recharts-cartesian-axis-tick-line`,Ic(a,`className`))})))}),F=N.map((e,t)=>{var n=e.entry,r=e.tick,a=kV(kV({},kV(kV(kV(kV({verticalAnchor:A},D),{},{textAnchor:k,stroke:`none`,fill:o},r),{},{index:t,payload:n,visibleTicksCount:E.length,tickFormatter:s,padding:l},u),{},{angle:u?.angle??D.angle??0})),O);return v.createElement(mP,DV({className:`recharts-cartesian-axis-tick-label`,key:`tick-label-${n.value}-${n.coordinate}-${n.tickCoord}`},O_(C,n,t)),i&&v.createElement(RV,{option:i,tickProps:a,value:`${typeof s==`function`?s(n.value,t):n.value}${c||``}`}))});return v.createElement(`g`,{className:`recharts-cartesian-axis-ticks recharts-${w}-ticks`},v.createElement(zV,{ticks:E,axisId:T,axisType:w}),F.length>0&&v.createElement(lN,{zIndex:Qb.label},v.createElement(`g`,{className:`recharts-cartesian-axis-tick-labels recharts-${w}-tick-labels`,ref:t},F)),P.length>0&&v.createElement(`g`,{className:`recharts-cartesian-axis-tick-lines recharts-${w}-tick-lines`},P))}),VV=(0,v.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=TV(e,vV),d=yV((0,v.useState)(``),2),f=d[0],p=d[1],m=yV((0,v.useState)(``),2),h=m[0],g=m[1],_=(0,v.useRef)(null);(0,v.useImperativeHandle)(t,()=>({getCalculatedWidth:()=>fV({ticks:_.current,label:e.labelRef?.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin})}));var y=(0,v.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:v.createElement(lN,{zIndex:e.zIndex},v.createElement(mP,{className:Nc(`recharts-cartesian-axis`,a)},v.createElement(PV,{x:e.x,y:e.y,width:r,height:i,orientation:e.orientation,mirror:e.mirror,axisLine:n,otherSvgProps:M_(e)}),v.createElement(BV,{ref:y,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}),v.createElement(TR,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},v.createElement(zR,{label:e.label,labelRef:e.labelRef}),e.children)))}),HV=v.forwardRef((e,t)=>{var n=mv(e,NV);return v.createElement(VV,DV({},n,{ref:t}))});HV.displayName=`CartesianAxis`;var UV=[`x1`,`y1`,`x2`,`y2`,`key`],WV=[`offset`],GV=[`xAxisId`,`yAxisId`],KV=[`xAxisId`,`yAxisId`];function qV(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 JV(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?qV(Object(n),!0).forEach(function(t){YV(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qV(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function YV(e,t,n){return(t=XV(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function XV(e){var t=ZV(e,`string`);return typeof t==`symbol`?t:t+``}function ZV(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 QV(){return QV=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},QV.apply(null,arguments)}function $V(e,t){if(e==null)return{};var n,r,i=eH(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 eH(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 tH=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 v.createElement(`rect`,{x:r,y:i,ry:s,width:a,height:o,stroke:`none`,fill:t,fillOpacity:n,className:`recharts-cartesian-grid-bg`})};function nH(e){var t=e.option,n=e.lineItemProps,r;if(v.isValidElement(t))r=v.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=M_($V(n,UV))??{};l.offset;var u=$V(l,WV);r=v.createElement(`line`,QV({},u,{x1:i,y1:a,x2:o,y2:s,fill:`none`,key:c}))}return r}function rH(e){var t=e.x,n=e.width,r=e.horizontal,i=r===void 0?!0:r,a=e.horizontalPoints;if(!i||!a||!a.length)return null;e.xAxisId,e.yAxisId;var o=$V(e,GV),s=a.map((e,r)=>{var a=JV(JV({},o),{},{x1:t,y1:e,x2:t+n,y2:e,key:`line-${r}`,index:r});return v.createElement(nH,{key:`line-${r}`,option:i,lineItemProps:a})});return v.createElement(`g`,{className:`recharts-cartesian-grid-horizontal`},s)}function iH(e){var t=e.y,n=e.height,r=e.vertical,i=r===void 0?!0:r,a=e.verticalPoints;if(!i||!a||!a.length)return null;e.xAxisId,e.yAxisId;var o=$V(e,KV),s=a.map((e,r)=>{var a=JV(JV({},o),{},{x1:e,y1:t,x2:e,y2:t+n,key:`line-${r}`,index:r});return v.createElement(nH,{option:i,lineItemProps:a,key:`line-${r}`})});return v.createElement(`g`,{className:`recharts-cartesian-grid-vertical`},s)}function aH(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 v.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 v.createElement(`g`,{className:`recharts-cartesian-gridstripes-horizontal`},u)}function oH(e){var t=e.vertical,n=t===void 0?!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 v.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 v.createElement(`g`,{className:`recharts-cartesian-gridstripes-vertical`},d)}var sH=(e,t)=>{var n=e.xAxis,r=e.width,i=e.height,a=e.offset;return kh(dV(JV(JV(JV({},NV),n),{},{ticks:Ah(n,!0),viewBox:{x:0,y:0,width:r,height:i}})),a.left,a.left+a.width,t)},cH=(e,t)=>{var n=e.yAxis,r=e.width,i=e.height,a=e.offset;return kh(dV(JV(JV(JV({},NV),n),{},{ticks:Ah(n,!0),viewBox:{x:0,y:0,width:r,height:i}})),a.top,a.top+a.height,t)},lH={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:`#ccc`,fill:`none`,verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:Qb.grid};function uH(e){var t=r_(),n=i_(),r=n_(),i=JV(JV({},mv(e,lH)),{},{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=gg(),h=Z(e=>Pk(e,`xAxis`,a,m)),g=Z(e=>Pk(e,`yAxis`,o,m));if(!bh(l)||!bh(u)||!X(s)||!X(c))return null;var _=i.verticalCoordinatesGenerator||sH,y=i.horizontalCoordinatesGenerator||cH,b=i.horizontalPoints,x=i.verticalPoints;if((!b||!b.length)&&typeof y==`function`){var S=f&&f.length,C=y({yAxis:g?JV(JV({},g),{},{ticks:S?f:g.ticks}):void 0,width:t??l,height:n??u,offset:r},S?!0:d);Cg(Array.isArray(C),`horizontalCoordinatesGenerator should return Array but instead it returned [${typeof C}]`),Array.isArray(C)&&(b=C)}if((!x||!x.length)&&typeof _==`function`){var w=p&&p.length,T=_({xAxis:h?JV(JV({},h),{},{ticks:w?p:h.ticks}):void 0,width:t??l,height:n??u,offset:r},w?!0:d);Cg(Array.isArray(T),`verticalCoordinatesGenerator should return Array but instead it returned [${typeof T}]`),Array.isArray(T)&&(x=T)}return v.createElement(lN,{zIndex:i.zIndex},v.createElement(`g`,{className:`recharts-cartesian-grid`},v.createElement(tH,{fill:i.fill,fillOpacity:i.fillOpacity,x:i.x,y:i.y,width:i.width,height:i.height,ry:i.ry}),v.createElement(aH,QV({},i,{horizontalPoints:b})),v.createElement(oH,QV({},i,{verticalPoints:x})),v.createElement(rH,QV({},i,{offset:r,horizontalPoints:b,xAxis:h,yAxis:g})),v.createElement(iH,QV({},i,{offset:r,verticalPoints:x,xAxis:h,yAxis:g}))))}uH.displayName=`CartesianGrid`;var dH=[`points`];function fH(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 pH(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?fH(Object(n),!0).forEach(function(t){mH(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fH(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function mH(e,t,n){return(t=hH(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function hH(e){var t=gH(e,`string`);return typeof t==`symbol`?t:t+``}function gH(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 _H(){return _H=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},_H.apply(null,arguments)}function vH(e,t){if(e==null)return{};var n,r,i=yH(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 yH(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 bH(e){var t=e.option,n=e.dotProps,r=e.className;if((0,v.isValidElement)(t))return(0,v.cloneElement)(t,n);if(typeof t==`function`)return t(n);var i=Nc(r,typeof t==`boolean`?``:t.className),a=n??{};a.points;var o=vH(a,dH);return v.createElement(gP,_H({},o,{className:i}))}function xH(e,t){return e==null?!1:t?!0:e.length===1}function SH(e){var t=e.points,n=e.dot,r=e.className,i=e.dotClassName,a=e.dataKey,o=e.baseProps,s=e.needClip,c=e.clipPathId,l=e.zIndex,u=l===void 0?Qb.scatter:l;if(!xH(t,n))return null;var d=JI(n),f=X_(n),p=t.map((e,r)=>{var s=pH(pH(pH({r:3},o),f),{},{index:r,cx:e.x??void 0,cy:e.y??void 0,dataKey:a,value:e.value,payload:e.payload,points:t});return v.createElement(bH,{key:`dot-${r}`,option:n,dotProps:s,className:i})}),m={};return s&&c!=null&&(m.clipPath=`url(#clipPath-${d?``:`dots-`}${c})`),v.createElement(lN,{zIndex:u},v.createElement(mP,_H({className:r},m),p))}function CH(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 wH(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?CH(Object(n),!0).forEach(function(t){TH(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):CH(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function TH(e,t,n){return(t=EH(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function EH(e){var t=DH(e,`string`);return typeof t==`symbol`?t:t+``}function DH(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 OH=xp({name:`cartesianAxis`,initialState:{xAxis:{},yAxis:{},zAxis:{}},reducers:{addXAxis:{reducer(e,t){e.xAxis[t.payload.id]=UA(t.payload)},prepare:op()},replaceXAxis:{reducer(e,t){var n=t.payload,r=n.prev,i=n.next;e.xAxis[r.id]!==void 0&&(r.id!==i.id&&delete e.xAxis[r.id],e.xAxis[i.id]=UA(i))},prepare:op()},removeXAxis:{reducer(e,t){delete e.xAxis[t.payload.id]},prepare:op()},addYAxis:{reducer(e,t){e.yAxis[t.payload.id]=UA(t.payload)},prepare:op()},replaceYAxis:{reducer(e,t){var n=t.payload,r=n.prev,i=n.next;e.yAxis[r.id]!==void 0&&(r.id!==i.id&&delete e.yAxis[r.id],e.yAxis[i.id]=UA(i))},prepare:op()},removeYAxis:{reducer(e,t){delete e.yAxis[t.payload.id]},prepare:op()},addZAxis:{reducer(e,t){e.zAxis[t.payload.id]=UA(t.payload)},prepare:op()},replaceZAxis:{reducer(e,t){var n=t.payload,r=n.prev,i=n.next;e.zAxis[r.id]!==void 0&&(r.id!==i.id&&delete e.zAxis[r.id],e.zAxis[i.id]=UA(i))},prepare:op()},removeZAxis:{reducer(e,t){delete e.zAxis[t.payload.id]},prepare:op()},updateYAxisWidth(e,t){var n=t.payload,r=n.id,i=n.width,a=e.yAxis[r];if(a){var o=a.widthHistory||[];if(o.length===3&&o[0]===o[2]&&i===o[1]&&i!==a.width&&Math.abs(i-(o[0]??0))<=1)return;var s=[...o,i].slice(-3);e.yAxis[r]=wH(wH({},a),{},{width:i,widthHistory:s})}}}}),kH=OH.actions,AH=kH.addXAxis,jH=kH.replaceXAxis,MH=kH.removeXAxis,NH=kH.addYAxis,PH=kH.replaceYAxis,FH=kH.removeYAxis;kH.addZAxis,kH.replaceZAxis,kH.removeZAxis;var IH=kH.updateYAxisWidth,LH=OH.reducer,RH=Q([Q([fg],e=>({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),Jh,Yh],(e,t,n)=>{if(!(!e||t==null||n==null))return{x:e.left,y:e.top,width:Math.max(0,t-e.left-e.right),height:Math.max(0,n-e.top-e.bottom)}}),zH=()=>Z(RH),BH=()=>Z(dM);function VH(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 HH(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?VH(Object(n),!0).forEach(function(t){UH(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):VH(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function UH(e,t,n){return(t=WH(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function WH(e){var t=GH(e,`string`);return typeof t==`symbol`?t:t+``}function GH(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 KH=e=>{var t=e.point,n=e.childIndex,r=e.mainColor,i=e.activeDot,a=e.dataKey,o=e.clipPath;if(i===!1||t.x==null||t.y==null)return null;var s=HH(HH(HH({},{index:n,dataKey:a,cx:t.x,cy:t.y,r:4,fill:r??`none`,strokeWidth:2,stroke:`#fff`,payload:t.payload,value:t.value}),N_(i)),E_(i)),c=(0,v.isValidElement)(i)?(0,v.cloneElement)(i,s):typeof i==`function`?i(s):v.createElement(gP,s);return v.createElement(mP,{className:`recharts-active-dot`,clipPath:o},c)};function qH(e){var t=e.points,n=e.mainColor,r=e.activeDot,i=e.itemDataKey,a=e.clipPath,o=e.zIndex,s=o===void 0?Qb.activeDot:o,c=Z(iM),l=BH();if(t==null||l==null)return null;var u=t.find(e=>l.includes(e.payload));return Zc(u)?null:v.createElement(lN,{zIndex:s},v.createElement(KH,{point:u,childIndex:Number(c),mainColor:n,dataKey:i,activeDot:r,clipPath:a}))}function JH(e,t){var n=Z(t=>ID(t,e)),r=Z(e=>zD(e,t)),i=n?.allowDataOverflow??PD.allowDataOverflow,a=r?.allowDataOverflow??LD.allowDataOverflow;return{needClip:i||a,needClipX:i,needClipY:a}}function YH(e){var t=e.xAxisId,n=e.yAxisId,r=e.clipPathId,i=zH(),a=JH(t,n),o=a.needClipX,s=a.needClipY,c=a.needClip,l=Z(e=>lk(e,t,!1)),u=Z(e=>uk(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,y=s&&u?Math.abs(u[1]-u[0]):m*2;return v.createElement(`clipPath`,{id:`clipPath-${r}`},v.createElement(`rect`,{x:h,y:g,width:_,height:y}))}function XH(e,t){return e.graphicalItems.cartesianItems.find(e=>e.id===t)?.xAxisId??0}function ZH(e,t){return e.graphicalItems.cartesianItems.find(e=>e.id===t)?.yAxisId??0}var QH=(e,t,n)=>zk(e,`xAxis`,XH(e,t),n),$H=(e,t,n)=>Rk(e,`xAxis`,XH(e,t),n),eU=(e,t,n)=>zk(e,`yAxis`,ZH(e,t),n),tU=(e,t,n)=>Rk(e,`yAxis`,ZH(e,t),n),nU=Q([a_,QH,eU,$H,tU],(e,t,n,r,i)=>Oh(e,`xAxis`)?Uh(t,r,!1):Uh(n,i,!1)),rU=Q([qD,(e,t)=>t],(e,t)=>e.filter(e=>e.type===`area`).find(e=>e.id===t)),iU=e=>Oh(a_(e),`xAxis`)?`yAxis`:`xAxis`,aU=(e,t)=>iU(e)===`yAxis`?ZH(e,t):XH(e,t),oU=Q([a_,QH,eU,$H,tU,Q([rU,(e,t,n)=>yO(e,iU(e),aU(e,t),n)],(e,t)=>{if(!(e==null||t==null)){var n=e.stackId,r=Cx(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]])}}}),db,nU,rU,Zb],(e,t,n,r,i,a,o,s,c,l)=>{var u=o.chartData,d=o.dataStartIndex,f=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 p=c.data,m=p&&p.length>0?p:u?.slice(d,f+1);if(m!=null)return aW({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataStartIndex:d,areaSettings:c,stackedData:a,displayedData:m,chartBaseValue:l,bandSize:s})}});function sU(e){var t=N_(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 cU=o((e=>{var t=d();t.useSyncExternalStore,t.useRef,t.useEffect,t.useMemo,t.useDebugValue}));o(((e,t)=>{t.exports=cU()}))();function lU(e){e()}function uU(){let e=null,t=null;return{clear(){e=null,t=null},notify(){lU(()=>{let t=e;for(;t;)t.callback(),t=t.next})},get(){let t=[],n=e;for(;n;)t.push(n),n=n.next;return t},subscribe(n){let r=!0,i=t={callback:n,next:null,prev:t};return i.prev?i.prev.next=i:e=i,function(){!r||e===null||(r=!1,i.next?i.next.prev=i.prev:t=i.prev,i.prev?i.prev.next=i.next:e=i.next)}}}}var dU={notify(){},get:()=>[]};function fU(e,t){let n,r=dU,i=0,a=!1;function o(e){u();let t=r.subscribe(e),n=!1;return()=>{n||(n=!0,t(),d())}}function s(){r.notify()}function c(){m.onStateChange&&m.onStateChange()}function l(){return a}function u(){i++,n||(n=t?t.addNestedSub(c):e.subscribe(c),r=uU())}function d(){i--,n&&i===0&&(n(),n=void 0,r.clear(),r=dU)}function f(){a||(a=!0,u())}function p(){a&&(a=!1,d())}let m={addNestedSub:o,notifyNestedSubs:s,handleChangeWrapper:c,isSubscribed:l,trySubscribe:f,tryUnsubscribe:p,getListeners:()=>r};return m}var pU=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,mU=typeof navigator<`u`&&navigator.product===`ReactNative`,hU=pU||mU?v.useLayoutEffect:v.useEffect;function gU(e,t){return e===t?e!==0||t!==0||1/e==1/t:e!==e&&t!==t}function _U(e,t){if(gU(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!gU(e[n[r]],t[n[r]]))return!1;return!0}var vU=Symbol.for(`react-redux-context`),yU=typeof globalThis<`u`?globalThis:{};function bU(){if(!v.createContext)return{};let e=yU[vU]??=new Map,t=e.get(v.createContext);return t||(t=v.createContext(null),e.set(v.createContext,t)),t}var xU=bU();function SU(e){let{children:t,context:n,serverState:r,store:i}=e,a=v.useMemo(()=>({store:i,subscription:fU(i),getServerState:r?()=>r:void 0}),[i,r]),o=v.useMemo(()=>i.getState(),[i]);hU(()=>{let{subscription:e}=a;return e.onStateChange=e.notifyNestedSubs,e.trySubscribe(),o!==i.getState()&&e.notifyNestedSubs(),()=>{e.tryUnsubscribe(),e.onStateChange=void 0}},[a,o]);let s=n||xU;return v.createElement(s.Provider,{value:a},t)}var CU=SU,wU=new Set([`axisLine`,`tickLine`,`activeBar`,`activeDot`,`activeLabel`,`activeShape`,`allowEscapeViewBox`,`background`,`cursor`,`dot`,`label`,`line`,`margin`,`padding`,`position`,`shape`,`style`,`tick`,`wrapperStyle`,`radius`,`throttledEvents`]);function TU(e,t){return e==null&&t==null?!0:typeof e==`number`&&typeof t==`number`?e===t||e!==e&&t!==t:e===t}function EU(e,t){for(var n of new Set([...Object.keys(e),...Object.keys(t)]))if(wU.has(n)){if(e[n]==null&&t[n]==null)continue;if(!_U(e[n],t[n]))return!1}else if(!TU(e[n],t[n]))return!1;return!0}var DU=[`animationElapsedTime`,`isAnimating`,`isEntrance`,`layout`,`isRange`,`stroke`,`connectNulls`],OU=[`id`,`baseLine`];function kU(){return kU=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},kU.apply(null,arguments)}function AU(e,t){if(e==null)return{};var n,r,i=jU(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 jU(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 MU(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(!yh(a)||!yh(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)?v.createElement(`rect`,{x:a<o?a:a-s,y:0,width:s,height:Math.floor(c+(i?parseInt(`${i}`,10):1))}):null}function NU(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(!yh(a)||!yh(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)?v.createElement(`rect`,{x:0,y:a<o?a:a-s,width:c+(i?parseInt(`${i}`,10):1),height:Math.floor(s)}):null}function PU(e){var t=e.alpha,n=e.layout,r=e.points,i=e.baseLine,a=e.strokeWidth;return n===`vertical`?v.createElement(NU,{alpha:t,points:r,baseLine:i,strokeWidth:a}):v.createElement(MU,{alpha:t,points:r,baseLine:i,strokeWidth:a})}function FU(e){var t=e.animationElapsedTime,n=t===void 0?1:t,r=e.isAnimating,i=r===void 0?!1:r,a=e.isEntrance,o=a===void 0?!1:a,s=e.layout,c=e.isRange,l=e.stroke,u=e.connectNulls,d=AU(e,DU),f=s===`vertical`?`vertical`:`horizontal`,p=u??!1,m=qL(),h=d.id,g=d.baseLine,_=M_(AU(d,OU)),y=v.createElement(J_,kU({},d,{id:h,baseLine:g,connectNulls:p,stroke:`none`,className:`recharts-area-area`,layout:f})),b=l!==`none`&&v.createElement(J_,kU({},_,{className:`recharts-area-curve`,layout:f,type:d.type,connectNulls:p,fill:`none`,stroke:l,points:d.points})),x=l!==`none`&&c&&Array.isArray(g)&&v.createElement(J_,kU({},_,{className:`recharts-area-curve`,layout:f,type:d.type,connectNulls:p,fill:`none`,stroke:l,points:g}));return o&&(i||n<1)?v.createElement(mP,null,v.createElement(`defs`,null,v.createElement(`clipPath`,{id:m},v.createElement(PU,{alpha:n,points:d.points??[],baseLine:g,layout:f,strokeWidth:d.strokeWidth}))),v.createElement(mP,{clipPath:`url(#${m})`},y,b,x)):v.createElement(v.Fragment,null,y,b,x)}var IU=[`id`],LU=[`activeDot`,`animationBegin`,`animationDuration`,`animationEasing`,`connectNulls`,`dot`,`fill`,`fillOpacity`,`hide`,`isAnimationActive`,`legendType`,`stroke`,`xAxisId`,`yAxisId`];function RU(){return RU=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},RU.apply(null,arguments)}function zU(e,t){if(e==null)return{};var n,r,i=BU(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 BU(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 VU(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 HU(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?VU(Object(n),!0).forEach(function(t){UU(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):VU(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function UU(e,t,n){return(t=WU(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function WU(e){var t=GU(e,`string`);return typeof t==`symbol`?t:t+``}function GU(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 KU={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:`ease`,animationMatchBy:wL,animationInterpolateFn:(e,t)=>e==null?[]:t===1?e.flatMap(e=>e.status===`removed`?[]:[e.next]):e.flatMap(e=>e.status===`matched`?[HU(HU({},e.next),{},{x:Yc(e.prev.x,e.next.x,t),y:Yc(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:FU,xAxisId:0,yAxisId:0,zIndex:Qb.area};function qU(e,t){return e&&e!==`none`?e:t}var JU=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:qU(r,i),value:Gh(n,t),payload:e}]},YU=v.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.tooltipType,u=e.id,d={dataDefinedOnItem:n,getPosition:el,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:Gh(o,t),hide:s,type:l,color:qU(r,a),unit:c,graphicalItemId:u}};return v.createElement(lL,{tooltipEntrySettings:d})});function XU(e){var t=e.clipPathId,n=e.points,r=e.props,i=r.needClip,a=r.dot,o=r.dataKey,s=M_(r);return v.createElement(SH,{points:n,dot:a,className:`recharts-area-dots`,dotClassName:`recharts-area-dot`,dataKey:o,baseProps:s,needClip:i,clipPathId:t})}function ZU(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 HU(HU({},t),{},{value:e.value,payload:e.payload,parentViewBox:void 0,viewBox:t,fill:void 0})});return v.createElement(qR,{value:t?r:void 0},n)}function QU(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=zU(a,IU),_=HU(HU({},Y_(g)),{},{id:h,points:t,connectNulls:f,type:u,baseLine:n,layout:l,stroke:d,isRange:p,animationElapsedTime:o,isAnimating:s,isEntrance:c});return v.createElement(v.Fragment,null,t?.length>1&&v.createElement(mP,{clipPath:r?`url(#clipPath-${i})`:void 0},v.createElement(aL,{option:m,DefaultShape:KU.shape,shapeProps:_})),v.createElement(XU,{points:t,props:g,clipPathId:i}))}function $U(e,t,n){return X(e)?Yc(X(t)?t:void 0,e,n):Zc(e)||Hc(e)?Yc(X(t)?t:void 0,0,n):e}function eW(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,v.useMemo)(()=>({points:o,baseLine:s}),[o,s]),h=ML(m,a),g=s_(),_=zL(r.onAnimationStart,r.onAnimationEnd),y=_.isAnimating,b=_.handleAnimationStart,x=_.handleAnimationEnd,S=h.startValue;if(g==null)return null;var C=Array.isArray(s)&&Array.isArray(S)?jL(S,s,f):Array.isArray(s)?jL(null,s,f):null;return v.createElement(BL,{animationInput:m,animationIdPrefix:`recharts-area-`,items:o,previousItemsRef:i,isAnimationActive:c,animationBegin:l,animationDuration:u,animationEasing:d,onAnimationStart:b,onAnimationEnd:x,animationInterpolateFn:p,animationMatchBy:f,layout:g},(e,i,a)=>{var c=i===1?s:Array.isArray(s)?p(C,i,g):a?s:$U(s,S,i);return h.syncStepValue(c,i),v.createElement(ZU,{showLabels:!y,points:o},r.children,v.createElement(QU,{points:e,baseLine:c,needClip:t,clipPathId:n,props:r,animationElapsedTime:i,isAnimating:y||i<1,isEntrance:a}),v.createElement($R,{label:r.label}))})}function tW(e){var t=e.needClip,n=e.clipPathId,r=e.props,i=(0,v.useRef)(null),a=(0,v.useRef)();return v.createElement(eW,{needClip:t,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:a})}var nW=class extends v.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=Nc(`recharts-area`,i),g=f,_=sU(n),y=_.r,b=_.strokeWidth,x=JI(n),S=y*2+b,C=s?`url(#clipPath-${x?``:`dots-`}${g})`:void 0;return v.createElement(lN,{zIndex:m},v.createElement(mP,{className:h},s&&v.createElement(`defs`,null,v.createElement(YH,{clipPathId:g,xAxisId:c,yAxisId:l}),!x&&v.createElement(`clipPath`,{id:`clipPath-dots-${g}`},v.createElement(`rect`,{x:o-S/2,y:a-S/2,width:u+S,height:d+S}))),v.createElement(tW,{needClip:s,clipPathId:g,props:this.props})),v.createElement(qH,{points:r,mainColor:qU(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:C}),this.props.isRange&&Array.isArray(p)&&v.createElement(qH,{points:p,mainColor:qU(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:C}))}};function rW(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=zU(e,LU),g=o_(),_=OM(),y=JH(p,m).needClip,b=gg(),x=Z(t=>oU(t,e.id,b))??{},S=x.points,C=x.isRange,w=x.baseLine,T=zH();if(g!==`horizontal`&&g!==`vertical`||T==null||_!==`AreaChart`&&_!==`ComposedChart`)return null;var E=T.height,D=T.width,O=T.x,k=T.y;return!S||!S.length?null:v.createElement(nW,RU({},h,{activeDot:t,animationBegin:n,animationDuration:r,animationEasing:i,baseLine:w,connectNulls:a,dot:o,fill:s,fillOpacity:c,height:E,hide:l,layout:g,isAnimationActive:u,isRange:C,legendType:d,needClip:y,points:S,stroke:f,width:D,left:O,top:k,xAxisId:p,yAxisId:m}))}var iW=(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 aW(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=a&&a.length,g=iW(o,s,r,c,l),_=o===`horizontal`,v=!1,y=u.map((e,t)=>{var r;if(h)r=a[d+t];else{var o=Eh(e,i);Array.isArray(o)?(r=o,v=!0):r=[g,o]}var s=r?.[1]??null,u=s==null||h&&!n&&Eh(e,i)==null;return _?{x:Fh({axis:c,ticks:f,bandSize:m,entry:e,index:t}),y:u?null:l.scale.map(s)??null,value:r,payload:e}:{x:u?null:c.scale.map(s)??null,y:Fh({axis:l,ticks:p,bandSize:m,entry:e,index:t}),value:r,payload:e}});return{points:y,baseLine:(h||v?y.map(e=>{var t=Array.isArray(e.value)?e.value[0]:null;return _?{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}}):_?l.scale.map(g):c.scale.map(g))??0,isRange:v}}function oW(e){var t=mv(e,KU),n=gg();return v.createElement(XL,{id:t.id,type:`area`},e=>v.createElement(v.Fragment,null,v.createElement(gL,{legendPayload:JU(t)}),v.createElement(YU,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:e}),v.createElement(oR,{type:`area`,id:e,data:t.data,dataKey:t.dataKey,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,stackId:Ph(t.stackId),hide:t.hide,barSize:void 0,baseValue:t.baseValue,isPanorama:n,connectNulls:t.connectNulls}),v.createElement(rW,RU({},t,{id:e}))))}var sW=v.memo(oW,EU);sW.displayName=`Area`;var cW=[`domain`,`range`],lW=[`domain`,`range`];function uW(e,t){if(e==null)return{};var n,r,i=dW(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 dW(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 fW(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 pW(e,t){if(e===t)return!0;var n=e.domain,r=e.range,i=uW(e,cW),a=t.domain,o=t.range,s=uW(t,lW);return!fW(n,a)||!fW(r,o)?!1:EU(i,s)}var mW=[`type`],hW=[`dangerouslySetInnerHTML`,`ticks`,`scale`],gW=[`id`,`scale`];function _W(){return _W=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},_W.apply(null,arguments)}function vW(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 yW(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?vW(Object(n),!0).forEach(function(t){bW(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vW(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function bW(e,t,n){return(t=xW(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function xW(e){var t=SW(e,`string`);return typeof t==`symbol`?t:t+``}function SW(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 CW(e,t){if(e==null)return{};var n,r,i=wW(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 wW(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 TW(e){var t=$u(),n=(0,v.useRef)(null),r=s_(),i=e.type,a=CW(e,mW),o=nx(r,`xAxis`,i),s=(0,v.useMemo)(()=>{if(o!=null)return yW(yW({},a),{},{type:o})},[a,o]);return(0,v.useLayoutEffect)(()=>{s!=null&&(n.current===null?t(AH(s)):n.current!==s&&t(jH({prev:n.current,next:s})),n.current=s)},[s,t]),(0,v.useLayoutEffect)(()=>()=>{n.current&&=(t(MH(n.current)),null)},[t]),null}var EW=e=>{var t=e.xAxisId,n=e.className,r=Z(mg),i=gg(),a=`xAxis`,o=Z(e=>Ik(e,a,t,i)),s=Z(e=>wk(e,t)),c=Z(e=>kk(e,t)),l=Z(e=>FD(e,t));if(s==null||c==null||l==null)return null;e.dangerouslySetInnerHTML,e.ticks,e.scale;var u=CW(e,hW);l.id,l.scale;var d=CW(l,gW);return v.createElement(HV,_W({},u,d,{x:c.x,y:c.y,width:s.width,height:s.height,className:Nc(`recharts-${a} ${a}`,n),viewBox:r,ticks:o,axisType:a,axisId:t}))},DW={allowDataOverflow:PD.allowDataOverflow,allowDecimals:PD.allowDecimals,allowDuplicatedCategory:PD.allowDuplicatedCategory,angle:PD.angle,axisLine:NV.axisLine,height:PD.height,hide:!1,includeHidden:PD.includeHidden,interval:PD.interval,label:!1,minTickGap:PD.minTickGap,mirror:PD.mirror,orientation:PD.orientation,padding:PD.padding,reversed:PD.reversed,scale:PD.scale,tick:PD.tick,tickCount:PD.tickCount,tickLine:NV.tickLine,tickSize:NV.tickSize,type:PD.type,niceTicks:PD.niceTicks,xAxisId:0},OW=v.memo(e=>{var t=mv(e,DW);return v.createElement(v.Fragment,null,v.createElement(TW,{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}),v.createElement(EW,t))},pW);OW.displayName=`XAxis`;var kW=[`type`],AW=[`dangerouslySetInnerHTML`,`ticks`,`scale`],jW=[`id`,`scale`];function MW(){return MW=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},MW.apply(null,arguments)}function NW(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 PW(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?NW(Object(n),!0).forEach(function(t){FW(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):NW(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function FW(e,t,n){return(t=IW(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function IW(e){var t=LW(e,`string`);return typeof t==`symbol`?t:t+``}function LW(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 RW(e,t){if(e==null)return{};var n,r,i=zW(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 zW(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 BW(e){var t=$u(),n=(0,v.useRef)(null),r=s_(),i=e.type,a=RW(e,kW),o=nx(r,`yAxis`,i),s=(0,v.useMemo)(()=>{if(o!=null)return PW(PW({},a),{},{type:o})},[o,a]);return(0,v.useLayoutEffect)(()=>{s!=null&&(n.current===null?t(NH(s)):n.current!==s&&t(PH({prev:n.current,next:s})),n.current=s)},[s,t]),(0,v.useLayoutEffect)(()=>()=>{n.current&&=(t(FH(n.current)),null)},[t]),null}function VW(e){var t=e.yAxisId,n=e.className,r=e.width,i=e.label,a=(0,v.useRef)(null),o=(0,v.useRef)(null),s=Z(mg),c=gg(),l=$u(),u=`yAxis`,d=Z(e=>jk(e,t)),f=Z(e=>Ak(e,t)),p=Z(e=>Ik(e,u,t,c)),m=Z(e=>RD(e,t));if((0,v.useLayoutEffect)(()=>{if(!(r!==`auto`||!d||AR(i)||(0,v.isValidElement)(i)||m==null)){var e=a.current;if(e){var n=e.getCalculatedWidth();Math.round(d.width)!==Math.round(n)&&l(IH({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=RW(e,AW);m.id,m.scale;var g=RW(m,jW);return v.createElement(HV,MW({},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:Nc(`recharts-${u} ${u}`,n),viewBox:s,ticks:p,axisType:u,axisId:t}))}var HW={allowDataOverflow:LD.allowDataOverflow,allowDecimals:LD.allowDecimals,allowDuplicatedCategory:LD.allowDuplicatedCategory,angle:LD.angle,axisLine:NV.axisLine,hide:!1,includeHidden:LD.includeHidden,interval:LD.interval,label:!1,minTickGap:LD.minTickGap,mirror:LD.mirror,orientation:LD.orientation,padding:LD.padding,reversed:LD.reversed,scale:LD.scale,tick:LD.tick,tickCount:LD.tickCount,tickLine:NV.tickLine,tickSize:NV.tickSize,type:LD.type,niceTicks:LD.niceTicks,width:LD.width,yAxisId:0},UW=v.memo(e=>{var t=mv(e,HW);return v.createElement(v.Fragment,null,v.createElement(BW,{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}),v.createElement(VW,t))},pW);UW.displayName=`YAxis`;var WW=Q([(e,t)=>t,a_,bx,kx,Zj,$j,MM,fg],WM);function GW(e){return`getBBox`in e.currentTarget&&typeof e.currentTarget.getBBox==`function`}function KW(e){var t=e.currentTarget.getBoundingClientRect(),n,r;if(GW(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 qW=$f(`mouseClick`),JW=sm();JW.startListening({actionCreator:qW,effect:(e,t)=>{var n=e.payload,r=WW(t.getState(),KW(n));r?.activeIndex!=null&&t.dispatch(nj({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var YW=$f(`mouseMove`),XW=sm(),ZW=null,QW=null,$W=null;XW.startListening({actionCreator:YW,effect:(e,t)=>{var n=e.payload,r=t.getState().eventSettings,i=r.throttleDelay,a=r.throttledEvents,o=a===`all`||a?.includes(`mousemove`);ZW!==null&&(cancelAnimationFrame(ZW),ZW=null),QW!==null&&(typeof i!=`number`||!o)&&(clearTimeout(QW),QW=null),$W=KW(n);var s=()=>{var e=t.getState(),n=Wk(e,e.tooltip.settings.shared);if(!$W){ZW=null,QW=null;return}if(n===`axis`){var r=WW(e,$W);r?.activeIndex==null?t.dispatch($A()):t.dispatch(tj({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}ZW=null,QW=null};if(!o){s();return}i===`raf`?ZW=requestAnimationFrame(s):typeof i==`number`&&QW===null&&(QW=setTimeout(s,i))}});function eG(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 tG=xp({name:`referenceElements`,initialState:{dots:[],areas:[],lines:[]},reducers:{addDot:(e,t)=>{e.dots.push(t.payload)},removeDot:(e,t)=>{var n=Nf(e).dots.findIndex(e=>e===t.payload);n!==-1&&e.dots.splice(n,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var n=Nf(e).areas.findIndex(e=>e===t.payload);n!==-1&&e.areas.splice(n,1)},addLine:(e,t)=>{e.lines.push(UA(t.payload))},removeLine:(e,t)=>{var n=Nf(e).lines.findIndex(e=>e===t.payload);n!==-1&&e.lines.splice(n,1)}}}),nG=tG.actions;nG.addDot,nG.removeDot,nG.addArea,nG.removeArea,nG.addLine,nG.removeLine;var rG=tG.reducer,iG={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},aG=xp({name:`brush`,initialState:iG,reducers:{setBrushSettings(e,t){return t.payload==null?iG:t.payload}}});aG.actions.setBrushSettings;var oG=aG.reducer,sG={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},cG=xp({name:`rootProps`,initialState:sG,reducers:{updateOptions:(e,t)=>{e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=t.payload.barGap??sG.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}}}),lG=cG.reducer,uG=cG.actions.updateOptions,dG=xp({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)}}),fG=dG.actions.updatePolarOptions,pG=dG.reducer,mG=$f(`keyDown`),hG=$f(`focus`),gG=$f(`blur`),_G=sm(),vG=null,yG=null,bG=null;_G.startListening({actionCreator:mG,effect:(e,t)=>{bG=e.payload,vG!==null&&(cancelAnimationFrame(vG),vG=null);var n=t.getState().eventSettings,r=n.throttleDelay,i=n.throttledEvents,a=i===`all`||i.includes(`keydown`);yG!==null&&(typeof r!=`number`||!a)&&(clearTimeout(yG),yG=null);var o=()=>{try{var e=t.getState();if(e.rootProps.accessibilityLayer===!1)return;var n=e.tooltip.keyboardInteraction,r=bG;if(r!==`ArrowRight`&&r!==`ArrowLeft`&&r!==`Enter`)return;var i=_j(n,zj(e),gO(e),Jj(e)),a=i==null?-1:Number(i),o=!Number.isFinite(a)||a<0,s=$j(e),c=zj(e),l=Wk(e,e.tooltip.settings.shared);if(r===`Enter`){if(o)return;var u=LM(e,l,`hover`,String(n.index));t.dispatch(ij({active:!n.active,activeIndex:n.index,activeCoordinate:u}));return}var d=Bk(e)===`left-to-right`?1:-1,f=r===`ArrowRight`?1:-1,p;if(o){var m=gO(e),h=Jj(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(_j(_(v),c,m,h)!=null){p=v;break}}else for(var y=c.length-1;y>=0;y--)if(_j(_(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=LM(e,l,`hover`,String(p));t.dispatch(ij({active:!0,activeIndex:p.toString(),activeCoordinate:x}))}finally{vG=null,yG=null}};if(!a){o();return}r===`raf`?vG=requestAnimationFrame(o):typeof r==`number`&&yG===null&&(o(),bG=null,yG=setTimeout(()=>{bG?o():(yG=null,vG=null)},r))}}),_G.startListening({actionCreator:hG,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=LM(n,Wk(n,n.tooltip.settings.shared),`hover`,String(i));t.dispatch(ij({active:!0,activeIndex:i,activeCoordinate:a}))}}}}),_G.startListening({actionCreator:gG,effect:(e,t)=>{var n=t.getState();if(n.rootProps.accessibilityLayer!==!1){var r=n.tooltip.keyboardInteraction;r.active&&t.dispatch(ij({active:!1,activeIndex:r.index,activeCoordinate:r.coordinate}))}}});function xG(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 SG=$f(`externalEvent`),CG=sm(),wG=new Map,TG=new Map,EG=new Map;CG.startListening({actionCreator:SG,effect:(e,t)=>{var n=e.payload,r=n.handler,i=n.reactEvent;if(r!=null){var a=i.type,o=xG(i);EG.set(a,{handler:r,reactEvent:o});var s=wG.get(a);s!==void 0&&(cancelAnimationFrame(s),wG.delete(a));var c=t.getState().eventSettings,l=c.throttleDelay,u=c.throttledEvents,d=u===`all`||u?.includes(a),f=TG.get(a);f!==void 0&&(typeof l!=`number`||!d)&&(clearTimeout(f),TG.delete(a));var p=()=>{var e=EG.get(a);try{if(!e)return;var n=e.handler,r=e.reactEvent,i=t.getState(),o={activeCoordinate:lM(i),activeDataKey:oM(i),activeIndex:iM(i),activeLabel:aM(i),activeTooltipIndex:iM(i),isTooltipActive:uM(i)};n&&n(o,r)}finally{wG.delete(a),TG.delete(a),EG.delete(a)}};if(!d){p();return}if(l===`raf`){var m=requestAnimationFrame(p);wG.set(a,m)}else if(typeof l==`number`){if(!TG.has(a)){p();var h=setTimeout(p,l);TG.set(a,h)}}else p()}}});var DG=Q([Q([xj],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)}}}),OG=$f(`touchMove`),kG=sm(),AG=null,jG=null,MG=null,NG=null;kG.startListening({actionCreator:OG,effect:(e,t)=>{var n=e.payload;if(!(n.touches==null||n.touches.length===0)){NG=xG(n);var r=t.getState().eventSettings,i=r.throttleDelay,a=r.throttledEvents,o=a===`all`||a.includes(`touchmove`);AG!==null&&(cancelAnimationFrame(AG),AG=null),jG!==null&&(typeof i!=`number`||!o)&&(clearTimeout(jG),jG=null),MG=Array.from(n.touches).map(e=>KW({clientX:e.clientX,clientY:e.clientY,currentTarget:n.currentTarget}));var s=()=>{if(NG!=null){var e=t.getState(),n=Wk(e,e.tooltip.settings.shared);if(n===`axis`){var r=MG?.[0];if(r==null){AG=null,jG=null;return}var i=WW(e,r);i?.activeIndex!=null&&t.dispatch(tj({activeIndex:i.activeIndex,activeDataKey:void 0,activeCoordinate:i.activeCoordinate}))}else if(n===`item`){var a=NG.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(eg),c=o.getAttribute(`data-recharts-item-id`)??void 0,l=Fj(e).find(e=>e.id===c);if(s==null||l==null||c==null)return;var u=l.dataKey,d=DG(e,s,c);t.dispatch(ZA({activeDataKey:u,activeIndex:s,activeCoordinate:d,activeGraphicalItemId:c}))}AG=null,jG=null}};if(!o){s();return}i===`raf`?AG=requestAnimationFrame(s):typeof i==`number`&&jG===null&&(s(),NG=null,jG=setTimeout(()=>{NG?s():(jG=null,AG=null)},i))}}});var PG=xp({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))}}}),FG=PG.actions;FG.addErrorBar,FG.replaceErrorBar,FG.removeErrorBar;var IG=PG.reducer,LG={throttleDelay:`raf`,throttledEvents:[`mousemove`,`touchmove`,`pointermove`,`scroll`,`wheel`]},RG=xp({name:`eventSettings`,initialState:LG,reducers:{setEventSettings:(e,t)=>{t.payload.throttleDelay!=null&&(e.throttleDelay=t.payload.throttleDelay),t.payload.throttledEvents!=null&&(e.throttledEvents=UA(t.payload.throttledEvents))}}}),zG=RG.actions.setEventSettings,BG=RG.reducer,VG=ud({brush:oG,cartesianAxis:LH,chartData:PN,errorBars:IG,eventSettings:BG,graphicalItems:aR,layout:hm,legend:hL,options:DN,polarAxis:GF,polarOptions:pG,referenceElements:rG,renderedTicks:_V,rootProps:lG,tooltip:aj,zIndex:sN}),HG=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:`Chart`;return dp({reducer:VG,preloadedState:e,middleware:e=>e({serializableCheck:!1,immutableCheck:![`commonjs`,`es6`,`production`].includes(`es6`)}).concat([JW.middleware,XW.middleware,_G.middleware,CG.middleware,kG.middleware]),enhancers:e=>{var t=e;return typeof e==`function`&&(t=e()),t.concat(lp({type:`raf`}))},devTools:Cl.devToolsEnabled&&{serialize:{replacer:eG},name:`recharts-${t}`}})};function UG(e){var t=e.preloadedState,n=e.children,r=e.reduxStoreName,i=gg(),a=(0,v.useRef)(null);if(i)return n;a.current??=HG(t,r);var o=Xu;return v.createElement(CU,{context:o,store:a.current},n)}var WG=e=>{var t=e.chartData,n=$u(),r=gg();return(0,v.useEffect)(()=>r?()=>{}:(n(MN(t)),()=>{n(MN(void 0))}),[t,n,r]),null};function GG(e){var t=e.layout,n=e.margin,r=$u(),i=gg();return(0,v.useEffect)(()=>{i||(r(fm(t)),r(dm(n)))},[r,i,t,n]),null}var KG=(0,v.memo)(GG,EU);function qG(e){var t=$u();return(0,v.useEffect)(()=>{t(uG(e))},[t,e]),null}var JG=(0,v.memo)(e=>{var t=$u();return(0,v.useEffect)(()=>{t(zG(e))},[t,e]),null},EU);function YG(e){var t=$u();return(0,v.useEffect)(()=>{t(fG(e))},[t,e]),null}var XG=[`children`,`width`,`height`,`viewBox`,`className`,`style`,`title`,`desc`];function ZG(){return ZG=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},ZG.apply(null,arguments)}function QG(e,t){if(e==null)return{};var n,r,i=$G(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 $G(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 eK=(0,v.forwardRef)((e,t)=>{var n=e.children,r=e.width,i=e.height,a=e.viewBox,o=e.className,s=e.style,c=e.title,l=e.desc,u=QG(e,XG),d=a||{width:r,height:i,x:0,y:0},f=Nc(`recharts-surface`,o);return v.createElement(`svg`,ZG({},Y_(u),{className:f,width:r,height:i,style:s,viewBox:`${d.x} ${d.y} ${d.width} ${d.height}`,ref:t}),v.createElement(`title`,null,c),v.createElement(`desc`,null,l),n)});function tK(e){var t=e.zIndex,n=e.isPanorama,r=(0,v.useRef)(null),i=$u();return(0,v.useLayoutEffect)(()=>(r.current&&i(aN({zIndex:t,element:r.current,isPanorama:n})),()=>{i(oN({zIndex:t,isPanorama:n}))}),[i,t,n]),v.createElement(`g`,{tabIndex:-1,ref:r,className:`recharts-zIndex-layer_${t}`})}function nK(e){var t=e.children,n=e.isPanorama,r=Z(KM);if(!r||r.length===0)return t;var i=r.filter(e=>e<0),a=r.filter(e=>e>0);return v.createElement(v.Fragment,null,i.map(e=>v.createElement(tK,{key:e,zIndex:e,isPanorama:n})),t,a.map(e=>v.createElement(tK,{key:e,zIndex:e,isPanorama:n})))}var rK=[`children`];function iK(e,t){if(e==null)return{};var n,r,i=aK(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 aK(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 oK(){return oK=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},oK.apply(null,arguments)}var sK={width:`100%`,height:`100%`,display:`block`},cK=(0,v.forwardRef)((e,t)=>{var n=r_(),r=i_(),i=f_();if(!bh(n)||!bh(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),v.createElement(eK,oK({},o,{title:s,desc:c,role:u,tabIndex:l,width:n,height:r,style:sK,ref:t}),a)}),lK=e=>{var t=e.children,n=Z(vg);if(!n)return null;var r=n.width,i=n.height,a=n.y,o=n.x;return v.createElement(eK,{width:r,height:i,x:o,y:a},t)},uK=(0,v.forwardRef)((e,t)=>{var n=e.children,r=iK(e,rK);return gg()?v.createElement(lK,null,v.createElement(nK,{isPanorama:!0},n)):v.createElement(cK,oK({ref:t},r),v.createElement(nK,{isPanorama:!1},n))});function dK(e,t){return gK(e)||hK(e,t)||pK(e,t)||fK()}function fK(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
69
69
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function pK(e,t){if(e){if(typeof e==`string`)return mK(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)?mK(e,t):void 0}}function mK(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 hK(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 gK(e){if(Array.isArray(e))return e}function _K(){var e=$u(),t=dK((0,v.useState)(null),2),n=t[0],r=t[1],i=Z(Xh);return(0,v.useEffect)(()=>{if(n!=null){var t=n.getBoundingClientRect().width/n.offsetWidth;yh(t)&&t!==i&&e(mm(t))}},[n,e,i]),r}var vK=(0,v.createContext)(null);function yK(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 bK(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?yK(Object(n),!0).forEach(function(t){xK(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yK(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function xK(e,t,n){return(t=SK(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function SK(e){var t=CK(e,`string`);return typeof t==`symbol`?t:t+``}function CK(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 wK(){return wK=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},wK.apply(null,arguments)}function TK(e,t){return AK(e)||kK(e,t)||DK(e,t)||EK()}function EK(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
70
70
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function DK(e,t){if(e){if(typeof e==`string`)return OK(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)?OK(e,t):void 0}}function OK(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 kK(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 AK(e){if(Array.isArray(e))return e}var jK=()=>(GN(),null);function MK(e){if(typeof e==`number`)return e;if(typeof e==`string`){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var NK=(0,v.forwardRef)((e,t)=>{var n=(0,v.useRef)(null),r=TK((0,v.useState)({containerWidth:MK(e.style?.width),containerHeight:MK(e.style?.height)}),2),i=r[0],a=r[1],o=(0,v.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,v.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,v.useEffect)(()=>()=>{n.current?.disconnect()},[o]),v.createElement(v.Fragment,null,v.createElement(d_,{width:i.containerWidth,height:i.containerHeight}),v.createElement(`div`,wK({ref:s},e)))}),PK=(0,v.forwardRef)((e,t)=>{var n=e.width,r=e.height,i=TK((0,v.useState)({containerWidth:MK(n),containerHeight:MK(r)}),2),a=i[0],o=i[1],s=(0,v.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,v.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 v.createElement(v.Fragment,null,v.createElement(d_,{width:a.containerWidth,height:a.containerHeight}),v.createElement(`div`,wK({ref:c},e)))}),FK=(0,v.forwardRef)((e,t)=>{var n=e.width,r=e.height;return v.createElement(v.Fragment,null,v.createElement(d_,{width:n,height:r}),v.createElement(`div`,wK({ref:t},e)))}),IK=(0,v.forwardRef)((e,t)=>{var n=e.width,r=e.height;return typeof n==`string`||typeof r==`string`?v.createElement(PK,wK({},e,{ref:t})):typeof n==`number`&&typeof r==`number`?v.createElement(FK,wK({},e,{width:n,height:r,ref:t})):v.createElement(v.Fragment,null,v.createElement(d_,{width:n,height:r}),v.createElement(`div`,wK({ref:t},e)))});function LK(e){return e?NK:IK}var RK=(0,v.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,y=e.responsive,b=e.dispatchTouchEvents,x=b===void 0?!0:b,S=(0,v.useRef)(null),C=$u(),w=TK((0,v.useState)(null),2),T=w[0],E=w[1],D=TK((0,v.useState)(null),2),O=D[0],k=D[1],A=_K(),j=Xg(),M=j?.width>0?j.width:_,N=j?.height>0?j.height:i,P=(0,v.useCallback)(e=>{A(e),typeof t==`function`&&t(e),E(e),k(e),e!=null&&(S.current=e)},[A,t,E,k]),F=(0,v.useCallback)(e=>{C(qW(e)),C(SG({handler:a,reactEvent:e}))},[C,a]),I=(0,v.useCallback)(e=>{C(YW(e)),C(SG({handler:l,reactEvent:e}))},[C,l]),L=(0,v.useCallback)(e=>{C($A()),C(SG({handler:u,reactEvent:e}))},[C,u]),ee=(0,v.useCallback)(e=>{C(YW(e)),C(SG({handler:d,reactEvent:e}))},[C,d]),te=(0,v.useCallback)(()=>{C(hG())},[C]),R=(0,v.useCallback)(()=>{C(gG())},[C]),z=(0,v.useCallback)(e=>{C(mG(e.key))},[C]),B=(0,v.useCallback)(e=>{C(SG({handler:o,reactEvent:e}))},[C,o]),V=(0,v.useCallback)(e=>{C(SG({handler:s,reactEvent:e}))},[C,s]),H=(0,v.useCallback)(e=>{C(SG({handler:c,reactEvent:e}))},[C,c]),ne=(0,v.useCallback)(e=>{C(SG({handler:f,reactEvent:e}))},[C,f]),re=(0,v.useCallback)(e=>{C(SG({handler:h,reactEvent:e}))},[C,h]),ie=(0,v.useCallback)(e=>{x&&C(OG(e)),C(SG({handler:m,reactEvent:e}))},[C,x,m]),ae=(0,v.useCallback)(e=>{C(SG({handler:p,reactEvent:e}))},[C,p]),oe=LK(y);return v.createElement(yN.Provider,{value:T},v.createElement(vK.Provider,{value:O},v.createElement(oe,{width:M??g?.width,height:N??g?.height,className:Nc(`recharts-wrapper`,r),style:bK({position:`relative`,cursor:`default`,width:M,height:N},g),onClick:F,onContextMenu:B,onDoubleClick:V,onFocus:te,onBlur:R,onKeyDown:z,onMouseDown:H,onMouseEnter:I,onMouseLeave:L,onMouseMove:ee,onMouseUp:ne,onTouchEnd:ae,onTouchMove:ie,onTouchStart:re,ref:P},v.createElement(jK,null),n)))});function zK(e,t){return WK(e)||UK(e,t)||VK(e,t)||BK()}function BK(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
71
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function VK(e,t){if(e){if(typeof e==`string`)return HK(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)?HK(e,t):void 0}}function HK(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 UK(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 WK(e){if(Array.isArray(e))return e}var GK=(0,v.createContext)(void 0),KK=e=>{var t=e.children,n=zK((0,v.useState)(`${Kc(`recharts`)}-clip`),1)[0],r=zH();if(r==null)return null;var i=r.x,a=r.y,o=r.width,s=r.height;return v.createElement(GK.Provider,{value:n},v.createElement(`defs`,null,v.createElement(`clipPath`,{id:n},v.createElement(`rect`,{x:i,y:a,height:s,width:o}))),t)},qK=[`width`,`height`,`responsive`,`children`,`className`,`style`,`compact`,`title`,`desc`];function JK(e,t){if(e==null)return{};var n,r,i=YK(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 YK(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 XK=(0,v.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=M_(JK(e,qK));return c?v.createElement(v.Fragment,null,v.createElement(d_,{width:n,height:r}),v.createElement(uK,{otherAttributes:d,title:l,desc:u},a)):v.createElement(RK,{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},v.createElement(uK,{otherAttributes:d,title:l,desc:u,ref:t},v.createElement(KK,null,a)))}),ZK=[`layout`];function QK(){return QK=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},QK.apply(null,arguments)}function $K(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 tq(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 nq(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?tq(Object(n),!0).forEach(function(t){rq(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tq(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function rq(e,t,n){return(t=iq(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function iq(e){var t=aq(e,`string`);return typeof t==`symbol`?t:t+``}function aq(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 oq=nq({accessibilityLayer:!0,stackOffset:`none`,barCategoryGap:`10%`,barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:`index`,layout:`radial`,responsive:!1,cx:`50%`,cy:`50%`,innerRadius:0,outerRadius:`80%`},LG),sq=(0,v.forwardRef)(function(e,t){var n=mv(e.categoricalChartProps,oq),r=n.layout,i=$K(n,ZK),a=e.chartName,o={chartName:a,defaultTooltipEventType:e.defaultTooltipEventType,validateTooltipEventTypes:e.validateTooltipEventTypes,tooltipPayloadSearcher:e.tooltipPayloadSearcher,eventEmitter:void 0};return v.createElement(UG,{preloadedState:{options:o},reduxStoreName:n.id??a},v.createElement(WG,{chartData:n.data}),v.createElement(KG,{layout:r,margin:n.margin}),v.createElement(JG,{throttleDelay:n.throttleDelay,throttledEvents:n.throttledEvents}),v.createElement(qG,{baseValue:void 0,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}),v.createElement(YG,{cx:n.cx,cy:n.cy,startAngle:n.startAngle,endAngle:n.endAngle,innerRadius:n.innerRadius,outerRadius:n.outerRadius}),v.createElement(XK,QK({},i,{ref:t})))});function cq(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 lq(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?cq(Object(n),!0).forEach(function(t){uq(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):cq(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function uq(e,t,n){return(t=dq(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function dq(e){var t=fq(e,`string`);return typeof t==`symbol`?t:t+``}function fq(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 pq=[`item`],mq=lq(lq({},oq),{},{layout:`centric`,startAngle:0,endAngle:360}),hq=(0,v.forwardRef)((e,t)=>{var n=mv(e,mq);return v.createElement(sq,{chartName:`PieChart`,defaultTooltipEventType:`item`,validateTooltipEventTypes:pq,tooltipPayloadSearcher:TN,categoricalChartProps:n,ref:t})});function gq(){return gq=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},gq.apply(null,arguments)}function _q(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 vq(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?_q(Object(n),!0).forEach(function(t){yq(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_q(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function yq(e,t,n){return(t=bq(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function bq(e){var t=xq(e,`string`);return typeof t==`symbol`?t:t+``}function xq(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 Sq=vq({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`},LG),Cq=(0,v.forwardRef)(function(e,t){var n=mv(e.categoricalChartProps,Sq),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 v.createElement(UG,{preloadedState:{options:c},reduxStoreName:s.id??r},v.createElement(WG,{chartData:s.data}),v.createElement(KG,{layout:n.layout,margin:n.margin}),v.createElement(JG,{throttleDelay:n.throttleDelay,throttledEvents:n.throttledEvents}),v.createElement(qG,{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}),v.createElement(XK,gq({},n,{ref:t})))}),wq=[`axis`],Tq=(0,v.forwardRef)((e,t)=>v.createElement(Cq,{chartName:`AreaChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:wq,tooltipPayloadSearcher:TN,categoricalChartProps:e,ref:t}));function Eq(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 Dq(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Eq(Object(n),!0).forEach(function(t){Oq(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Eq(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Oq(e,t,n){return(t=kq(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function kq(e){var t=Aq(e,`string`);return typeof t==`symbol`?t:t+``}function Aq(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 jq=[`axis`,`item`],Mq=Dq(Dq({},oq),{},{layout:`radial`,startAngle:0,endAngle:360}),Nq=(0,v.forwardRef)((e,t)=>{var n=mv(e,Mq);return v.createElement(sq,{chartName:`RadialBarChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:jq,tooltipPayloadSearcher:TN,categoricalChartProps:n,ref:t})}),Pq=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),$=o(((e,t)=>{t.exports=Pq()}))(),Fq=e=>new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`});function Iq({active:e,payload:t,label:n,unit:r}){return!e||!t?.length?null:(0,$.jsxs)(`div`,{className:`chart-tip`,children:[n!=null&&(0,$.jsx)(`div`,{className:`chart-tip__label`,children:n}),t.map((e,t)=>(0,$.jsxs)(`div`,{className:`chart-tip__row`,children:[(0,$.jsx)(`span`,{className:`chart-tip__dot`,style:{background:e.color}}),(0,$.jsx)(`span`,{className:`chart-tip__name`,children:e.name??e.dataKey}),(0,$.jsxs)(`span`,{className:`chart-tip__val`,children:[typeof e.value==`number`?e.value.toLocaleString():e.value,r??``]})]},t))]})}var Lq=`color-mix(in srgb, var(--mt-border) 80%, transparent)`,Rq={fill:`var(--mt-text-faint)`,fontSize:10,fontFamily:`var(--mt-mono)`};function zq({series:e}){return(0,$.jsx)(`div`,{className:`chart`,style:{height:200},children:(0,$.jsx)(Qg,{width:`100%`,height:`100%`,children:(0,$.jsxs)(Tq,{data:e,margin:{top:8,right:8,left:-18,bottom:0},children:[(0,$.jsxs)(`defs`,{children:[(0,$.jsxs)(`linearGradient`,{id:`fillOk`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,$.jsx)(`stop`,{offset:`0%`,stopColor:`var(--page-accent)`,stopOpacity:.5}),(0,$.jsx)(`stop`,{offset:`100%`,stopColor:`var(--page-accent)`,stopOpacity:.04})]}),(0,$.jsxs)(`linearGradient`,{id:`fillErr`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,$.jsx)(`stop`,{offset:`0%`,stopColor:`var(--mt-bad)`,stopOpacity:.55}),(0,$.jsx)(`stop`,{offset:`100%`,stopColor:`var(--mt-bad)`,stopOpacity:.05})]})]}),(0,$.jsx)(uH,{vertical:!1,stroke:Lq,strokeDasharray:`3 3`}),(0,$.jsx)(OW,{dataKey:`t`,tickFormatter:Fq,tick:Rq,tickLine:!1,axisLine:!1,minTickGap:48}),(0,$.jsx)(UW,{tick:Rq,tickLine:!1,axisLine:!1,width:34,allowDecimals:!1}),(0,$.jsx)(cP,{cursor:{stroke:Lq},content:({active:e,payload:t,label:n})=>(0,$.jsx)(Iq,{active:e,payload:t,label:typeof n==`number`?Fq(n):n})}),(0,$.jsx)(sW,{type:`monotone`,dataKey:`ok`,name:`ok`,stackId:`1`,stroke:`var(--page-accent)`,fill:`url(#fillOk)`,strokeWidth:2,isAnimationActive:!1}),(0,$.jsx)(sW,{type:`monotone`,dataKey:`error`,name:`error`,stackId:`1`,stroke:`var(--mt-bad)`,fill:`url(#fillErr)`,strokeWidth:2,isAnimationActive:!1})]})})})}function Bq({segments:e,centerLabel:t=`calls`}){let n=e.filter(e=>e.value>0),r=e.reduce((e,t)=>e+t.value,0);return(0,$.jsxs)(`div`,{className:`chart chart--donut`,children:[(0,$.jsx)(`div`,{className:`chart-donut__svg`,children:(0,$.jsx)(Qg,{width:`100%`,height:180,children:(0,$.jsxs)(hq,{children:[(0,$.jsx)(cP,{content:({active:e,payload:t})=>(0,$.jsx)(Iq,{active:e,payload:t})}),(0,$.jsx)(Mz,{data:n,dataKey:`value`,nameKey:`label`,innerRadius:58,outerRadius:80,paddingAngle:2,strokeWidth:0,isAnimationActive:!1,children:n.map(e=>(0,$.jsx)(lP,{fill:e.color},e.label))}),(0,$.jsx)(`text`,{x:`50%`,y:`47%`,textAnchor:`middle`,fill:`var(--mt-text)`,fontSize:22,fontWeight:600,children:r.toLocaleString()}),(0,$.jsx)(`text`,{x:`50%`,y:`59%`,textAnchor:`middle`,fill:`var(--mt-text-dim)`,fontSize:10,children:t})]})})}),(0,$.jsx)(`div`,{className:`chart-legend`,children:n.map(e=>(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`i`,{style:{background:e.color}}),e.label,` `,(0,$.jsx)(`b`,{children:e.value})]},e.label))})]})}function Vq({values:e,color:t,unit:n,maxValue:r}){let i=e.filter(e=>e!=null);if(i.length===0)return(0,$.jsx)(`div`,{className:`spark spark--empty`,children:`no samples yet`});let a=e.map((e,t)=>({i:t,v:e})),o=i[i.length-1],s=`ma-${t.replace(/[^a-z0-9]/gi,``)}`;return(0,$.jsxs)(`div`,{className:`chart chart--spark`,children:[(0,$.jsxs)(`span`,{className:`chart-spark__last`,style:{color:t},children:[o.toFixed(n===`%`?0:1),n??``]}),(0,$.jsx)(Qg,{width:`100%`,height:46,children:(0,$.jsxs)(Tq,{data:a,margin:{top:4,right:2,left:2,bottom:0},children:[(0,$.jsx)(`defs`,{children:(0,$.jsxs)(`linearGradient`,{id:s,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,$.jsx)(`stop`,{offset:`0%`,stopColor:t,stopOpacity:.35}),(0,$.jsx)(`stop`,{offset:`100%`,stopColor:t,stopOpacity:0})]})}),(0,$.jsx)(UW,{hide:!0,domain:[0,r??`dataMax`]}),(0,$.jsx)(cP,{cursor:{stroke:Lq},content:({active:e,payload:r})=>(0,$.jsx)(Iq,{active:e,payload:r?.map(e=>({...e,name:`value`,color:t})),unit:n})}),(0,$.jsx)(sW,{type:`monotone`,dataKey:`v`,stroke:t,fill:`url(#${s})`,strokeWidth:1.7,connectNulls:!1,isAnimationActive:!1,dot:!1})]})})]})}function Hq({value:e,label:t,color:n}){let r=e!=null,i=r?Math.max(0,Math.min(100,e)):0;return(0,$.jsxs)(`div`,{className:`gauge`,children:[(0,$.jsxs)(`div`,{className:`gauge__radial`,children:[(0,$.jsx)(Qg,{width:72,height:72,children:(0,$.jsxs)(Nq,{data:[{name:t,value:i,fill:n}],innerRadius:`72%`,outerRadius:`100%`,startAngle:90,endAngle:-270,barSize:7,children:[(0,$.jsx)(kI,{type:`number`,domain:[0,100],tick:!1,axisLine:!1}),(0,$.jsx)(JB,{dataKey:`value`,cornerRadius:4,background:{fill:`var(--mt-surface-2)`},isAnimationActive:!1})]})}),(0,$.jsx)(`span`,{className:`gauge__pct`,style:{color:r?`var(--mt-text)`:`var(--mt-text-faint)`},children:r?`${Math.round(i)}%`:`n/a`})]}),(0,$.jsx)(`span`,{className:`gauge__label`,children:t})]})}function Uq(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Wq(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function Gq({onRestored:e}){let[t,n]=(0,v.useState)(null),[r,i]=(0,v.useState)(null),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(null),[l,u]=(0,v.useState)(null),[d,f]=(0,v.useState)(null),[p,m]=(0,v.useState)(null),h=(0,v.useCallback)(()=>{uc(`/api/config/history`).then(n).catch(()=>n({versions:[],bytes:0,retention:50}))},[]);(0,v.useEffect)(()=>h(),[h]);let g=(e,t)=>dc(e,t).catch(()=>({error:`request failed`})),_=async()=>{let e=(p??``).trim();m(null);let t=await g(`/api/config/history/checkpoint`,{label:e||void 0});i(t.ok?`Checkpoint saved${e?` · “${e}”`:``}`:`Failed: ${t.error}`),t.ok&&h()},y=async e=>{if(s===e){c(null),u(null);return}c(e),u(null),u(await uc(`/api/config/history/diff?id=${encodeURIComponent(e)}`).catch(()=>null))},b=async t=>{f(null),o(!0);let n=await g(`/api/config/history/restore`,{id:t});o(!1),i(n.ok?`Restored ${t}${n.persisted===!1?` (applied live, not persisted)`:``}`:`Restore failed: ${n.error}`),n.ok&&(h(),e())},x=async e=>{let t=await g(`/api/config/history/delete`,{id:e});i(t.ok?`Version deleted`:`Failed: ${t.error}`),t.ok&&h()};return t?(0,$.jsxs)($.Fragment,{children:[r&&(0,$.jsx)(`div`,{className:`cfg-msg`,children:r}),(0,$.jsxs)(`div`,{className:`toolbar`,style:{marginBottom:14},children:[p===null?(0,$.jsx)(`button`,{className:`btn is-active`,onClick:()=>m(``),children:`★ Save checkpoint`}):(0,$.jsxs)(`span`,{className:`cfgver-cp`,children:[(0,$.jsx)(`input`,{className:`backup-path-input`,autoFocus:!0,placeholder:`checkpoint name (e.g. pre-upgrade)`,value:p,onChange:e=>m(e.target.value),onKeyDown:e=>{e.key===`Enter`&&_(),e.key===`Escape`&&m(null)}}),(0,$.jsx)(`button`,{className:`topo-btn cfg-save`,onClick:()=>void _(),children:`Save`}),(0,$.jsx)(`button`,{className:`topo-btn`,onClick:()=>m(null),children:`Cancel`})]}),(0,$.jsx)(`span`,{style:{flex:1}}),(0,$.jsxs)(`span`,{className:`muted`,children:[t.versions.length,` versions · `,Uq(t.bytes),` · auto-keep `,t.retention]})]}),t.versions.length===0?(0,$.jsx)(`div`,{className:`muted`,children:`No versions yet — they appear here after each config change.`}):(0,$.jsx)(`ol`,{className:`cfgver`,children:t.versions.map((e,t)=>{let n=e.drift.added+e.drift.removed;return(0,$.jsxs)(`li`,{className:`cfgver__row${t===0?` is-head`:``}`,children:[(0,$.jsx)(`span`,{className:`cfgver__dot`,"aria-hidden":`true`}),(0,$.jsxs)(`div`,{className:`cfgver__main`,children:[(0,$.jsxs)(`div`,{className:`cfgver__line`,children:[(0,$.jsx)(`span`,{className:`cfgver__kind cfgver__kind--${e.kind}`,children:e.kind===`checkpoint`?`★ checkpoint`:`auto`}),e.label&&(0,$.jsx)(`span`,{className:`cfgver__label`,children:e.label}),(0,$.jsx)(`span`,{className:`cfgver__time`,children:Wq(e.ts)}),t===0?(0,$.jsx)(`span`,{className:`cfgver__cur`,children:`latest`}):n===0?(0,$.jsx)(`span`,{className:`cfgver__same`,children:`identical to current`}):(0,$.jsxs)(`span`,{className:`cfgver__drift`,children:[(0,$.jsxs)(`span`,{className:`add`,children:[`+`,e.drift.added]}),(0,$.jsxs)(`span`,{className:`rem`,children:[`−`,e.drift.removed]}),(0,$.jsx)(`span`,{className:`muted`,children:` vs current`})]})]}),s===e.id&&(0,$.jsx)(`div`,{className:`cfgver__diff`,children:l?l.unified.trim()?(0,$.jsx)(`pre`,{className:`body diff`,children:l.unified}):(0,$.jsx)(`span`,{className:`muted`,children:`No differences from the current config.`}):(0,$.jsx)(`span`,{className:`muted`,children:`computing diff…`})})]}),(0,$.jsxs)(`div`,{className:`cfgver__actions`,children:[(0,$.jsx)(`button`,{className:`topo-btn`,onClick:()=>void y(e.id),children:s===e.id?`Hide`:`Diff`}),d===e.id?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`button`,{className:`topo-btn cfg-save`,disabled:a,onClick:()=>void b(e.id),children:`Confirm restore`}),(0,$.jsx)(`button`,{className:`topo-btn`,onClick:()=>f(null),children:`Cancel`})]}):(0,$.jsx)(`button`,{className:`topo-btn`,disabled:t===0,title:t===0?`This is the current config`:`Restore this version`,onClick:()=>f(e.id),children:`Restore`}),e.kind===`checkpoint`&&(0,$.jsx)(`button`,{className:`topo-btn cfgver__del`,title:`Delete`,onClick:()=>void x(e.id),children:`✕`})]})]},e.id)})})]}):(0,$.jsx)(`div`,{className:`muted`,children:`loading history…`})}function Kq(e){if(!e)return[];let t=[],n=e=>e?Array.isArray(e.enum)?`enum`:e.type===`array`?`array<${n(e.items)}>`:Array.isArray(e.type)?e.type.join(` | `):e.type??(e.properties?`object`:`any`):`any`,r=(e,i,a,o)=>{let s=e.properties??{};for(let[e,c]of Object.entries(s)){let s=i?`${i}.${e}`:e,l=a||e;t.push({path:s,section:l,type:n(c),def:c.default===void 0?void 0:JSON.stringify(c.default),desc:c.description,enumv:Array.isArray(c.enum)?c.enum:void 0,required:o.has(e)}),c.properties&&r(c,s,l,new Set(c.required??[]));let u=c.additionalProperties;u?.properties&&r(u,`${s}.<name>`,l,new Set(u.required??[]));let d=c.items;d?.properties&&r(d,`${s}[]`,l,new Set(d.required??[]))}};return r(e,``,``,new Set(e.required??[])),t}function qq(){let[e,t]=(0,v.useState)(null),[n,r]=(0,v.useState)(``);(0,v.useEffect)(()=>{uc(`/api/config-schema`).then(t).catch(()=>{})},[]);let i=(0,v.useMemo)(()=>Kq(e),[e]),a=n.trim().toLowerCase(),o=a?i.filter(e=>e.path.toLowerCase().includes(a)||(e.desc??``).toLowerCase().includes(a)):i,s=(0,v.useMemo)(()=>{let e=new Map;for(let t of o){let n=e.get(t.section)??[];n.push(t),e.set(t.section,n)}return[...e.entries()]},[o]);return e?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`toolbar`,style:{marginBottom:12},children:[(0,$.jsx)(`input`,{className:`backup-path-input`,style:{width:`min(360px, 60vw)`},placeholder:`Search fields & descriptions…`,value:n,onChange:e=>r(e.target.value)}),(0,$.jsx)(`span`,{style:{flex:1}}),(0,$.jsxs)(`span`,{className:`muted`,children:[o.length,` options`]})]}),s.length===0?(0,$.jsxs)(`div`,{className:`muted`,children:[`No fields match “`,n,`”.`]}):(0,$.jsx)(`div`,{className:`fguide`,children:s.map(([e,t])=>(0,$.jsxs)(`div`,{className:`fguide__sec`,children:[(0,$.jsx)(`h4`,{className:`fguide__sechd`,children:e}),(0,$.jsx)(`div`,{className:`fguide__list`,children:t.map(e=>(0,$.jsxs)(`div`,{className:`fguide__item`,children:[(0,$.jsxs)(`div`,{className:`fguide__top`,children:[(0,$.jsx)(`code`,{className:`fguide__path`,children:e.path}),(0,$.jsx)(`span`,{className:`fguide__type`,children:e.type}),e.required&&(0,$.jsx)(`span`,{className:`fguide__req`,children:`required`}),e.def!==void 0&&(0,$.jsxs)(`span`,{className:`fguide__def`,children:[`default `,(0,$.jsx)(`code`,{children:e.def})]})]}),e.desc&&(0,$.jsx)(`p`,{className:`fguide__desc`,children:e.desc}),e.enumv&&(0,$.jsx)(`div`,{className:`fguide__enum`,children:e.enumv.map(e=>(0,$.jsx)(`code`,{children:e},e))})]},e.path))})]},e))})]}):(0,$.jsx)(`div`,{className:`muted`,children:`loading schema…`})}function Jq({type:e=`default`,size:t=`md`,ghost:n=!1,loading:r=!1,icon:i,className:a=``,children:o,disabled:s,...c}){return(0,$.jsxs)(`button`,{type:`button`,className:[`geist-btn`,`geist-btn--${e}`,`geist-btn--${t}`,n?`geist-btn--ghost`:``,r?`is-loading`:``,a].filter(Boolean).join(` `),disabled:s||r,...c,children:[r?(0,$.jsx)(Qq,{small:!0}):i&&(0,$.jsx)(`span`,{className:`geist-btn__icon`,children:i}),o!=null&&(0,$.jsx)(`span`,{className:`geist-btn__label`,children:o})]})}function Yq({type:e=`default`,label:t,children:n,className:r=``}){let i=t===!1?null:t??e;return(0,$.jsxs)(`div`,{className:`geist-note geist-note--${e} ${r}`.trim(),role:`note`,children:[i!=null&&(0,$.jsxs)(`b`,{className:`geist-note__label`,children:[i,`:`]}),` `,n]})}function Xq({type:e=`default`,children:t,className:n=``}){return(0,$.jsx)(`span`,{className:`geist-badge geist-badge--${e} ${n}`.trim(),children:t})}function Zq({type:e=`default`,pulse:t=!1,color:n,className:r=``}){return(0,$.jsx)(`span`,{className:`geist-dot geist-dot--${e}${t?` is-pulse`:``} ${r}`.trim(),style:n?{background:n}:void 0})}function Qq({small:e=!1}){return(0,$.jsx)(`span`,{className:`geist-spinner${e?` geist-spinner--sm`:``}`,"aria-label":`loading`,children:Array.from({length:12},(e,t)=>(0,$.jsx)(`span`,{style:{transform:`rotate(${t*30}deg)`,animationDelay:`${-1.1+t*.1}s`}},t))})}Li.registerPlugin(Y);var $q=e=>e<1?`<1ms`:e<1e3?`${Math.round(e)}ms`:`${(e/1e3).toFixed(2)}s`;function eJ(e){let t=[`B`,`KiB`,`MiB`,`GiB`],n=0,r=e;for(;r>=1024&&n<t.length-1;)r/=1024,n++;return`${r.toFixed(+!!n)} ${t[n]}`}var tJ=e=>new Date(e).toLocaleTimeString(),nJ=e=>e.toLocaleString(),rJ=e=>e==null?`?`:typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?String(e):JSON.stringify(e),iJ={READ:`#d4d4d8`,WRITE:`#a1a1aa`,WRITE_IDEMPOTENT:`#e4e4e7`,DESTRUCTIVE:`#f87171`,DANGEROUS:`#ef4444`},aJ=[[`5m`,3e5],[`15m`,9e5],[`1h`,36e5],[`6h`,216e5],[`24h`,864e5]],oJ=500;function sJ({title:e,extra:t,children:n,className:r}){return(0,$.jsxs)(`div`,{className:`panel${r?` ${r}`:``}`,children:[e!=null&&(0,$.jsxs)(`div`,{className:`sheet__hd`,style:{marginBottom:12},children:[(0,$.jsx)(`h2`,{style:{margin:0},children:e}),t!=null&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{style:{flex:1}}),t]})]}),n]})}function cJ({k:e,v:t,sub:n,cls:r}){return(0,$.jsxs)(`div`,{className:`stat${r?` ${r}`:``}`,children:[(0,$.jsx)(`p`,{className:`k`,children:e}),(0,$.jsxs)(`div`,{className:`v`,children:[t,n!=null&&(0,$.jsxs)(`small`,{children:[` `,n]})]})]})}function lJ({rows:e}){let t=Math.max(1,...e.map(e=>e.value));return(0,$.jsx)(`div`,{className:`hbar`,children:e.map(e=>(0,$.jsxs)(`div`,{className:`hbar__row`,children:[(0,$.jsx)(`span`,{className:`hbar__label`,title:e.label,children:e.label}),(0,$.jsx)(`div`,{className:`hbar__track`,children:(0,$.jsx)(`div`,{className:`hbar__fill`,style:{width:`${e.value/t*100}%`,background:e.color}})}),(0,$.jsx)(`span`,{className:`hbar__val`,children:e.sub??String(e.value)})]},e.label))})}function uJ(e){return e.reachable===!0?{label:`online`,color:`#d4d4d8`}:e.reachable===!1?{label:`offline`,color:`#f87171`}:{label:`checking…`,color:`#71717a`}}function dJ(e){let t=0;for(let n=0;n<e.length;n++)t=Math.imul(t,31)+e.charCodeAt(n)>>>0;return`hsl(${t%360} 70% 62%)`}function fJ(e,t,n,r){let i=1-r;return{x:i*i*e.x+2*i*r*t.x+r*r*n.x,y:i*i*e.y+2*i*r*t.y+r*r*n.y}}function pJ(e,t,n,r){let i=1-r,a=2*i*(t.x-e.x)+2*r*(n.x-t.x),o=2*i*(t.y-e.y)+2*r*(n.y-t.y);return Math.atan2(o,a)*180/Math.PI}var mJ=`#e4e4e7`,hJ=`#d4d4d8`,gJ=70,_J=Math.floor((2*gJ-24)/6.2),vJ=e=>e.length>_J?`${e.slice(0,_J-1)}…`:e,yJ=e=>Math.max(23,Math.min(gJ,e.length*3.1+12));function bJ({payload:e,pulses:t}){let n=e.devices,r=Math.max(1,n.length),i=n.map(e=>{let t=vJ(e.name);return{d:e,label:t,r:yJ(t)}}),a=Math.max(23,...i.map(e=>e.r)),o=r>1?(a+18)/Math.sin(Math.PI/r):0,s=Math.max(110+a,o,120),c=a+60,l=Math.max(700,Math.round((s+a+40)*2)),u=Math.round((s+c)*2),d=l/2,f=u/2,p={x:d,y:f},m=i.map((e,t)=>{let n=t/r*Math.PI*2-Math.PI/2+(r%2==0?Math.PI/r:0);return{...e,i:t,x:d+s*Math.cos(n),y:f+s*Math.sin(n)}});return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`svg`,{className:`conn`,viewBox:`0 0 ${l} ${u}`,width:`100%`,height:u,preserveAspectRatio:`xMidYMid meet`,children:[(0,$.jsxs)(`defs`,{children:[(0,$.jsxs)(`radialGradient`,{id:`conn-hub`,cx:`0.5`,cy:`0.34`,r:`0.75`,children:[(0,$.jsx)(`stop`,{offset:`0`,stopColor:`#fafafa`}),(0,$.jsx)(`stop`,{offset:`0.6`,stopColor:`#d4d4d8`}),(0,$.jsx)(`stop`,{offset:`1`,stopColor:`#a1a1aa`})]}),(0,$.jsxs)(`radialGradient`,{id:`conn-orb`,cx:`0.5`,cy:`0.32`,r:`0.85`,children:[(0,$.jsx)(`stop`,{offset:`0`,stopColor:`#27272a`}),(0,$.jsx)(`stop`,{offset:`1`,stopColor:`#18181b`})]}),(0,$.jsxs)(`radialGradient`,{id:`conn-burst`,cx:`0.5`,cy:`0.5`,r:`0.5`,children:[(0,$.jsx)(`stop`,{offset:`0`,stopColor:`#fafafa`}),(0,$.jsx)(`stop`,{offset:`0.5`,stopColor:`#e4e4e7`}),(0,$.jsx)(`stop`,{offset:`1`,stopColor:`#a1a1aa`,stopOpacity:`0`})]})]}),[.5,.78,1].map((e,t)=>(0,$.jsx)(`circle`,{className:`conn-grid`,cx:d,cy:f,r:s*e},`g-${t}`)),[0,1,2].map(e=>(0,$.jsx)(`circle`,{className:`conn-sonar`,cx:d,cy:f,style:{animationDelay:`${e*1.1}s`}},`s-${e}`)),m.map(({d:e,i:n,x:r,y:i})=>{let a=uJ(e.status),o=e.status.reachable===!0,s=e.status.reachable==null,c={x:r,y:i},l=(d+r)/2,u=(f+i)/2,m=r-d,h=i-f,g=Math.hypot(m,h)||1,_=-h/g,v=m/g,y={x:l+_*16,y:u+v*16},b={x:l-_*16,y:u-v*16},x=`M${d},${f} Q${y.x.toFixed(1)},${y.y.toFixed(1)} ${r.toFixed(1)},${i.toFixed(1)}`,S=`M${d},${f} Q${b.x.toFixed(1)},${b.y.toFixed(1)} ${r.toFixed(1)},${i.toFixed(1)}`,C=`M${d},${f} Q${l.toFixed(1)},${u.toFixed(1)} ${r.toFixed(1)},${i.toFixed(1)}`,w=fJ(p,y,c,.52),T=pJ(p,y,c,.52),E=fJ(p,b,c,.48),D=pJ(p,b,c,.48)+180,O=t[e.name]??0;return(0,$.jsxs)(`g`,{children:[(0,$.jsx)(`path`,{id:`conn-cmd-${n}`,className:`conn-link`,d:x,stroke:o?mJ:a.color,strokeOpacity:o?.5:.32,strokeDasharray:s?`2 8`:o?void 0:`6 7`}),(0,$.jsx)(`path`,{id:`conn-res-${n}`,className:`conn-link`,d:S,stroke:o?hJ:a.color,strokeOpacity:o?.5:.18,strokeDasharray:o?void 0:`6 7`}),o&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`path`,{className:`conn-flow`,d:x,stroke:mJ}),(0,$.jsx)(`circle`,{className:`conn-packet`,r:3.2,fill:mJ,children:(0,$.jsx)(`animateMotion`,{dur:`2.6s`,repeatCount:`indefinite`,calcMode:`linear`,children:(0,$.jsx)(`mpath`,{href:`#conn-cmd-${n}`})})}),(0,$.jsx)(`rect`,{className:`conn-packet`,x:-2.6,y:-2.6,width:5.2,height:5.2,fill:hJ,transform:`rotate(45)`,children:(0,$.jsx)(`animateMotion`,{dur:`2.6s`,begin:`0.9s`,repeatCount:`indefinite`,calcMode:`linear`,keyPoints:`1;0`,keyTimes:`0;1`,children:(0,$.jsx)(`mpath`,{href:`#conn-res-${n}`})})}),(0,$.jsx)(`path`,{className:`conn-chevron`,d:`M-4,-3 L4,0 L-4,3`,stroke:mJ,transform:`translate(${w.x.toFixed(1)},${w.y.toFixed(1)}) rotate(${T.toFixed(1)})`}),(0,$.jsx)(`path`,{className:`conn-chevron`,d:`M-4,-3 L4,0 L-4,3`,stroke:hJ,transform:`translate(${E.x.toFixed(1)},${E.y.toFixed(1)}) rotate(${D.toFixed(1)})`})]}),O>0&&(0,$.jsx)(`g`,{children:(0,$.jsxs)(`circle`,{r:6,fill:`url(#conn-burst)`,children:[(0,$.jsx)(`animateMotion`,{dur:`1.1s`,repeatCount:`1`,calcMode:`linear`,keyPoints:`0;1;0`,keyTimes:`0;0.5;1`,path:C}),(0,$.jsx)(`animate`,{attributeName:`opacity`,values:`0;1;1;0`,keyTimes:`0;0.1;0.85;1`,dur:`1.1s`,repeatCount:`1`,fill:`freeze`})]})},`burst-${e.name}-${O}`)]},`l-${e.name}`)}),(0,$.jsx)(`circle`,{className:`conn-hub-glow`,cx:d,cy:f,r:42}),(0,$.jsx)(`circle`,{className:`conn-hub-ring`,cx:d,cy:f,r:37}),(0,$.jsx)(`circle`,{cx:d,cy:f,r:29,fill:`url(#conn-hub)`,stroke:`#71717a`,strokeWidth:1.5}),(0,$.jsx)(`text`,{x:d,y:f-4,textAnchor:`middle`,fill:`#09090b`,fontSize:12,fontWeight:700,children:`LLM`}),(0,$.jsx)(`text`,{x:d,y:f+8,textAnchor:`middle`,fill:`#3f3f46`,fontSize:8,fontWeight:600,children:`⇄ MCP`}),(0,$.jsx)(`text`,{x:d,y:f+18,textAnchor:`middle`,fill:`#3f3f46`,fontSize:7.5,fontWeight:600,children:`server`}),m.map(({d:e,x:t,y:n,r,label:i})=>{let a=uJ(e.status),o=e.status.reachable===!0,s=o?`${e.status.latencyMs??`?`} ms`:a.label,c=dJ(e.name);return(0,$.jsxs)(`g`,{className:`conn-node`,children:[o&&(0,$.jsx)(`circle`,{className:`conn-node-halo`,cx:t,cy:n,r:r+1,stroke:c}),(0,$.jsx)(`circle`,{cx:t,cy:n,r,fill:`url(#conn-orb)`}),(0,$.jsx)(`circle`,{cx:t,cy:n,r,fill:c,opacity:.16}),(0,$.jsx)(`circle`,{cx:t,cy:n,r,fill:`none`,stroke:c,strokeWidth:2.5}),(0,$.jsx)(`circle`,{className:o?`conn-blink`:void 0,cx:t+r*.7,cy:n-r*.7,r:4.5,fill:a.color,stroke:`#0a121b`,strokeWidth:1.5}),(0,$.jsx)(`text`,{x:t,y:n+3.5,textAnchor:`middle`,fill:`#fafafa`,fontSize:10,fontWeight:600,children:i}),(0,$.jsx)(`text`,{x:t,y:n+r+14,textAnchor:`middle`,fill:`#a1a1aa`,fontSize:9,children:e.address??e.host}),(0,$.jsx)(`text`,{x:t,y:n+r+26,textAnchor:`middle`,fill:a.color,fontSize:9,fontWeight:600,children:s})]},`n-${e.name}`)})]}),(0,$.jsxs)(`div`,{className:`conn-legend`,children:[(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`i`,{style:{background:mJ}}),` command · LLM → device`]}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`i`,{style:{background:hJ}}),` response · device → LLM`]}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`i`,{style:{background:`#e4e4e7`}}),` live call (round-trip)`]})]})]})}function xJ({d:e}){let t=uJ(e.status),n=e.status.reachable===!0?`${t.label} · ${e.status.latencyMs??`?`}ms${e.status.version?` · v${e.status.version}`:``}`:e.status.reachable===!1?`${t.label}${e.status.error?` · ${e.status.error}`:``}`:t.label,r=dJ(e.name);return(0,$.jsxs)(`div`,{className:`card dev-card`,style:{borderLeft:`3px solid ${r}`},children:[(0,$.jsxs)(`div`,{className:`dev-card__top`,children:[(0,$.jsx)(`span`,{className:`dot`,style:{background:r},title:`device colour`}),(0,$.jsx)(`span`,{className:`dev-card__name`,children:e.name}),e.isDefault&&(0,$.jsx)(Xq,{type:`accent`,children:`default`}),(0,$.jsx)(`span`,{className:`dot dot--status`,style:{background:t.color},title:t.label}),(0,$.jsx)(`span`,{style:{flex:1}}),(0,$.jsx)(`span`,{className:`chip`,children:e.authMode})]}),(0,$.jsxs)(`div`,{className:`dev-card__meta`,children:[(0,$.jsx)(`span`,{children:e.mac?`mac`:`host`}),(0,$.jsx)(`b`,{children:e.address??`${e.host}:${e.port}`}),(0,$.jsx)(`span`,{children:`user`}),(0,$.jsx)(`b`,{children:e.username}),(0,$.jsx)(`span`,{children:`status`}),(0,$.jsx)(`b`,{style:{color:t.color},children:n}),(0,$.jsx)(`span`,{children:`activity`}),(0,$.jsxs)(`b`,{children:[e.activity.calls,` calls · `,e.activity.errors,` err`,e.activity.avgMs?` · ${$q(e.activity.avgMs)} avg`:``]}),e.description&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:`note`}),(0,$.jsx)(`b`,{children:e.description})]})]})]})}var SJ=e=>e==null?`?`:eJ(e);function CJ({d:e}){let t=e.status,n=e.history??[];return t.reachable===!0||n.length>0?(0,$.jsxs)(`div`,{className:`card health-card`,children:[(0,$.jsxs)(`div`,{className:`health-card__hd`,children:[(0,$.jsx)(Zq,{color:uJ(t).color}),(0,$.jsx)(`span`,{className:`dev-card__name`,children:e.name}),e.isDefault&&(0,$.jsx)(Xq,{type:`accent`,children:`default`}),(0,$.jsx)(`span`,{style:{flex:1}}),(0,$.jsx)(Xq,{type:t.version?`success`:`default`,children:t.version?`v${t.version}`:`—`})]}),(0,$.jsxs)(`div`,{className:`health-card__sub muted`,children:[t.boardName??`router`,t.architecture?` · ${t.architecture}`:``,t.cpuCount?` · ${t.cpuCount} cpu`:``,t.uptime?` · up ${t.uptime}`:``]}),(0,$.jsxs)(`div`,{className:`health-card__gauges`,children:[(0,$.jsx)(Hq,{value:t.cpuLoad,label:`CPU`,color:`#ededed`}),(0,$.jsx)(Hq,{value:t.memUsedPct,label:`MEM`,color:`#bdbdc4`}),(0,$.jsx)(Hq,{value:t.hddUsedPct,label:`DISK`,color:`#8a8a92`})]}),(0,$.jsxs)(`div`,{className:`health-card__charts`,children:[(0,$.jsxs)(`div`,{className:`health-chart`,children:[(0,$.jsx)(`span`,{className:`health-chart__k`,children:`CPU load`}),(0,$.jsx)(Vq,{values:n.map(e=>e.cpuLoad),color:`#ededed`,maxValue:100,unit:`%`})]}),(0,$.jsxs)(`div`,{className:`health-chart`,children:[(0,$.jsx)(`span`,{className:`health-chart__k`,children:`Memory used`}),(0,$.jsx)(Vq,{values:n.map(e=>e.memUsedPct),color:`#bdbdc4`,maxValue:100,unit:`%`})]}),(0,$.jsxs)(`div`,{className:`health-chart`,children:[(0,$.jsx)(`span`,{className:`health-chart__k`,children:`Probe latency`}),(0,$.jsx)(Vq,{values:n.map(e=>e.latencyMs),color:`#bdbdc4`,unit:`ms`})]})]}),(0,$.jsxs)(`div`,{className:`health-card__foot muted`,children:[`RAM `,SJ(t.totalMemory&&t.freeMemory?t.totalMemory-t.freeMemory:void 0),` /`,` `,SJ(t.totalMemory),` · free disk `,SJ(t.freeHdd)]})]}):(0,$.jsxs)(`div`,{className:`card health-card health-card--na`,children:[(0,$.jsxs)(`div`,{className:`health-card__hd`,children:[(0,$.jsx)(Zq,{color:uJ(t).color}),(0,$.jsx)(`span`,{className:`dev-card__name`,children:e.name}),e.isDefault&&(0,$.jsx)(Xq,{type:`accent`,children:`default`})]}),(0,$.jsx)(`p`,{className:`muted`,style:{margin:0},children:t.reachable===!1?`Offline — ${t.error??`unreachable`}`:e.mac?`Waiting for the first MAC-Telnet probe (these run every few minutes to avoid contending with tool calls)…`:`Waiting for the first health probe…`})]})}function wJ(e,t){let n=(0,v.useRef)(e),r=(0,v.useRef)(t);n.current=e,r.current=t,(0,v.useEffect)(()=>{let e=!1,t=null,i=null,a=()=>{e||(i=new EventSource(lc(`/api/sse`)),i.addEventListener(`hello`,()=>r.current(`sse`)),i.addEventListener(`tool`,e=>{try{n.current(JSON.parse(e.data))}catch{}}),i.onerror=()=>{i&&i.readyState===EventSource.CONNECTING&&r.current(`off`)})},o=()=>{if(e)return;let i=location.protocol===`https:`?`wss`:`ws`;t=new WebSocket(lc(`${i}://${location.host}/api/stream`));let s=!1;t.onopen=()=>{s=!0,r.current(`ws`)},t.onerror=()=>t?.close(),t.onmessage=e=>{try{let t=JSON.parse(e.data);t.type===`event`&&t.event&&n.current(t.event)}catch{}},t.onclose=()=>{e||(r.current(`off`),s?setTimeout(o,2e3):a())}};return o(),()=>{e=!0,t?.close(),i?.close()}},[])}function TJ(e){(0,v.useLayoutEffect)(()=>{let t=e.current;if(!t||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;document.documentElement.classList.add(`js-motion`);let n=new WeakSet,r=e=>{n.has(e)||(n.add(e),Li.set(e,{opacity:0,y:26}),Y.create({trigger:e,start:`top 90%`,once:!0,onEnter:()=>Li.to(e,{opacity:1,y:0,duration:.7,ease:`power3.out`})}))},i=e=>{for(let t of e.querySelectorAll(`.reveal`))r(t)};i(t);let a=new MutationObserver(e=>{for(let t of e)for(let e of t.addedNodes)e instanceof Element&&(e.matches(`.reveal`)&&r(e),i(e))});a.observe(t,{childList:!0,subtree:!0});let o=setInterval(()=>Y.refresh(),1200),s=setTimeout(()=>clearInterval(o),7e3);return()=>{a.disconnect(),clearInterval(o),clearTimeout(s);for(let e of Y.getAll())e.kill();document.documentElement.classList.remove(`js-motion`)}},[e])}function EJ(e){let t=new Set,n=new Set,r=e=>{if(!e||typeof e!=`object`)return;let i=e;if(i.properties&&typeof i.properties==`object`)for(let e of Object.keys(i.properties))t.add(e),r(i.properties[e]);if(Array.isArray(i.enum))for(let e of i.enum)typeof e==`string`&&n.add(e);for(let e of[`items`,`additionalProperties`,`anyOf`,`oneOf`,`allOf`]){let t=i[e];Array.isArray(t)?t.forEach(r):t&&typeof t==`object`&&r(t)}for(let e of[`$defs`,`definitions`,`patternProperties`]){let t=i[e];if(t&&typeof t==`object`)for(let e of Object.values(t))r(e)}};return r(e),{keys:[...t].sort(),enums:[...n.add(`true`).add(`false`)].sort()}}function DJ(e,t){let n=t;for(;n>0&&/[A-Za-z0-9_.-]/.test(e[n-1]);)n--;let r=e.slice(n,t),i=n-1;for(;i>=0&&/\s/.test(e[i]);)i--;return{word:r,start:n,isValue:e[i]===`:`}}var OJ=[[`revert in 30s`,3e4],[`revert in 60s`,6e4],[`revert in 2m`,12e4],[`no auto-revert`,0]];function kJ({initial:e,onClose:t,onReload:n}){let[r,i]=(0,v.useState)(()=>JSON.stringify(e,null,2)),[a,o]=(0,v.useState)({keys:[],enums:[]}),[s,c]=(0,v.useState)([]),[l,u]=(0,v.useState)(null),[d,f]=(0,v.useState)(null),[p,m]=(0,v.useState)({}),[h,g]=(0,v.useState)(null),[_,y]=(0,v.useState)(null),[b,x]=(0,v.useState)(0),[S,C]=(0,v.useState)(6e4),[w,T]=(0,v.useState)(null),E=(0,v.useRef)(null),D=(0,v.useRef)(null),O=(0,v.useRef)(null),k=(0,v.useRef)(null);(0,v.useEffect)(()=>{uc(`/api/config-schema`).then(e=>o(EJ(e))).catch(()=>{})},[]),(0,v.useEffect)(()=>{D.current!=null&&E.current&&(E.current.selectionStart=E.current.selectionEnd=D.current,D.current=null)}),(0,v.useEffect)(()=>{let e=setTimeout(()=>{let e;try{e=JSON.parse(r)}catch(e){u(e instanceof Error?e.message:String(e)),c([]);return}u(null),dc(`/api/config/validate`,e).then(e=>c(e.errors??[])).catch(()=>{})},350);return()=>clearTimeout(e)},[r]),(0,v.useEffect)(()=>{if(!_||b<=0)return;let e=setInterval(()=>x(e=>Math.max(0,e-1)),1e3);return()=>clearInterval(e)},[_,b]),(0,v.useEffect)(()=>{_&&b===0&&(_.rollbackMs??0)>0&&(T(`Auto-reverted — changes were not confirmed in time.`),y(null),n())},[_,b,n]);let A=!l&&s.length===0,j=e=>{let{word:t,start:n,isValue:r}=DJ(e.value,e.selectionStart);if(t.length<1){f(null);return}let i=(r?a.enums:a.keys).filter(e=>e.startsWith(t)&&e!==t).slice(0,8);if(!i.length){f(null);return}let o=e.value.slice(0,e.selectionStart).split(`
|
|
71
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function VK(e,t){if(e){if(typeof e==`string`)return HK(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)?HK(e,t):void 0}}function HK(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 UK(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 WK(e){if(Array.isArray(e))return e}var GK=(0,v.createContext)(void 0),KK=e=>{var t=e.children,n=zK((0,v.useState)(`${Kc(`recharts`)}-clip`),1)[0],r=zH();if(r==null)return null;var i=r.x,a=r.y,o=r.width,s=r.height;return v.createElement(GK.Provider,{value:n},v.createElement(`defs`,null,v.createElement(`clipPath`,{id:n},v.createElement(`rect`,{x:i,y:a,height:s,width:o}))),t)},qK=[`width`,`height`,`responsive`,`children`,`className`,`style`,`compact`,`title`,`desc`];function JK(e,t){if(e==null)return{};var n,r,i=YK(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 YK(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 XK=(0,v.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=M_(JK(e,qK));return c?v.createElement(v.Fragment,null,v.createElement(d_,{width:n,height:r}),v.createElement(uK,{otherAttributes:d,title:l,desc:u},a)):v.createElement(RK,{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},v.createElement(uK,{otherAttributes:d,title:l,desc:u,ref:t},v.createElement(KK,null,a)))}),ZK=[`layout`];function QK(){return QK=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},QK.apply(null,arguments)}function $K(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 tq(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 nq(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?tq(Object(n),!0).forEach(function(t){rq(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tq(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function rq(e,t,n){return(t=iq(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function iq(e){var t=aq(e,`string`);return typeof t==`symbol`?t:t+``}function aq(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 oq=nq({accessibilityLayer:!0,stackOffset:`none`,barCategoryGap:`10%`,barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:`index`,layout:`radial`,responsive:!1,cx:`50%`,cy:`50%`,innerRadius:0,outerRadius:`80%`},LG),sq=(0,v.forwardRef)(function(e,t){var n=mv(e.categoricalChartProps,oq),r=n.layout,i=$K(n,ZK),a=e.chartName,o={chartName:a,defaultTooltipEventType:e.defaultTooltipEventType,validateTooltipEventTypes:e.validateTooltipEventTypes,tooltipPayloadSearcher:e.tooltipPayloadSearcher,eventEmitter:void 0};return v.createElement(UG,{preloadedState:{options:o},reduxStoreName:n.id??a},v.createElement(WG,{chartData:n.data}),v.createElement(KG,{layout:r,margin:n.margin}),v.createElement(JG,{throttleDelay:n.throttleDelay,throttledEvents:n.throttledEvents}),v.createElement(qG,{baseValue:void 0,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}),v.createElement(YG,{cx:n.cx,cy:n.cy,startAngle:n.startAngle,endAngle:n.endAngle,innerRadius:n.innerRadius,outerRadius:n.outerRadius}),v.createElement(XK,QK({},i,{ref:t})))});function cq(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 lq(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?cq(Object(n),!0).forEach(function(t){uq(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):cq(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function uq(e,t,n){return(t=dq(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function dq(e){var t=fq(e,`string`);return typeof t==`symbol`?t:t+``}function fq(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 pq=[`item`],mq=lq(lq({},oq),{},{layout:`centric`,startAngle:0,endAngle:360}),hq=(0,v.forwardRef)((e,t)=>{var n=mv(e,mq);return v.createElement(sq,{chartName:`PieChart`,defaultTooltipEventType:`item`,validateTooltipEventTypes:pq,tooltipPayloadSearcher:TN,categoricalChartProps:n,ref:t})});function gq(){return gq=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},gq.apply(null,arguments)}function _q(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 vq(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?_q(Object(n),!0).forEach(function(t){yq(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_q(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function yq(e,t,n){return(t=bq(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function bq(e){var t=xq(e,`string`);return typeof t==`symbol`?t:t+``}function xq(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 Sq=vq({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`},LG),Cq=(0,v.forwardRef)(function(e,t){var n=mv(e.categoricalChartProps,Sq),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 v.createElement(UG,{preloadedState:{options:c},reduxStoreName:s.id??r},v.createElement(WG,{chartData:s.data}),v.createElement(KG,{layout:n.layout,margin:n.margin}),v.createElement(JG,{throttleDelay:n.throttleDelay,throttledEvents:n.throttledEvents}),v.createElement(qG,{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}),v.createElement(XK,gq({},n,{ref:t})))}),wq=[`axis`],Tq=(0,v.forwardRef)((e,t)=>v.createElement(Cq,{chartName:`AreaChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:wq,tooltipPayloadSearcher:TN,categoricalChartProps:e,ref:t}));function Eq(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 Dq(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Eq(Object(n),!0).forEach(function(t){Oq(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Eq(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Oq(e,t,n){return(t=kq(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function kq(e){var t=Aq(e,`string`);return typeof t==`symbol`?t:t+``}function Aq(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 jq=[`axis`,`item`],Mq=Dq(Dq({},oq),{},{layout:`radial`,startAngle:0,endAngle:360}),Nq=(0,v.forwardRef)((e,t)=>{var n=mv(e,Mq);return v.createElement(sq,{chartName:`RadialBarChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:jq,tooltipPayloadSearcher:TN,categoricalChartProps:n,ref:t})}),Pq=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),$=o(((e,t)=>{t.exports=Pq()}))(),Fq=e=>new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`,hour12:!1});function Iq({active:e,payload:t,label:n,unit:r}){return!e||!t?.length?null:(0,$.jsxs)(`div`,{className:`chart-tip`,children:[n!=null&&(0,$.jsx)(`div`,{className:`chart-tip__label`,children:n}),t.map((e,t)=>(0,$.jsxs)(`div`,{className:`chart-tip__row`,children:[(0,$.jsx)(`span`,{className:`chart-tip__dot`,style:{background:e.color}}),(0,$.jsx)(`span`,{className:`chart-tip__name`,children:e.name??e.dataKey}),(0,$.jsxs)(`span`,{className:`chart-tip__val`,children:[typeof e.value==`number`?e.value.toLocaleString():e.value,r??``]})]},t))]})}var Lq=`color-mix(in srgb, var(--mt-border) 80%, transparent)`,Rq={fill:`var(--mt-text-faint)`,fontSize:10,fontFamily:`var(--mt-mono)`};function zq({series:e}){return(0,$.jsx)(`div`,{className:`chart`,style:{height:200},children:(0,$.jsx)(Qg,{width:`100%`,height:`100%`,children:(0,$.jsxs)(Tq,{data:e,margin:{top:8,right:8,left:-18,bottom:0},children:[(0,$.jsxs)(`defs`,{children:[(0,$.jsxs)(`linearGradient`,{id:`fillOk`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,$.jsx)(`stop`,{offset:`0%`,stopColor:`var(--page-accent)`,stopOpacity:.5}),(0,$.jsx)(`stop`,{offset:`100%`,stopColor:`var(--page-accent)`,stopOpacity:.04})]}),(0,$.jsxs)(`linearGradient`,{id:`fillErr`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,$.jsx)(`stop`,{offset:`0%`,stopColor:`var(--mt-bad)`,stopOpacity:.55}),(0,$.jsx)(`stop`,{offset:`100%`,stopColor:`var(--mt-bad)`,stopOpacity:.05})]})]}),(0,$.jsx)(uH,{vertical:!1,stroke:Lq,strokeDasharray:`3 3`}),(0,$.jsx)(OW,{dataKey:`t`,tickFormatter:Fq,tick:Rq,tickLine:!1,axisLine:!1,minTickGap:48}),(0,$.jsx)(UW,{tick:Rq,tickLine:!1,axisLine:!1,width:34,allowDecimals:!1}),(0,$.jsx)(cP,{cursor:{stroke:Lq},content:({active:e,payload:t,label:n})=>(0,$.jsx)(Iq,{active:e,payload:t,label:typeof n==`number`?Fq(n):n})}),(0,$.jsx)(sW,{type:`monotone`,dataKey:`ok`,name:`ok`,stackId:`1`,stroke:`var(--page-accent)`,fill:`url(#fillOk)`,strokeWidth:2,isAnimationActive:!1}),(0,$.jsx)(sW,{type:`monotone`,dataKey:`error`,name:`error`,stackId:`1`,stroke:`var(--mt-bad)`,fill:`url(#fillErr)`,strokeWidth:2,isAnimationActive:!1})]})})})}function Bq({segments:e,centerLabel:t=`calls`}){let n=e.filter(e=>e.value>0),r=e.reduce((e,t)=>e+t.value,0);return(0,$.jsxs)(`div`,{className:`chart chart--donut`,children:[(0,$.jsx)(`div`,{className:`chart-donut__svg`,children:(0,$.jsx)(Qg,{width:`100%`,height:180,children:(0,$.jsxs)(hq,{children:[(0,$.jsx)(cP,{content:({active:e,payload:t})=>(0,$.jsx)(Iq,{active:e,payload:t})}),(0,$.jsx)(Mz,{data:n,dataKey:`value`,nameKey:`label`,innerRadius:58,outerRadius:80,paddingAngle:2,strokeWidth:0,isAnimationActive:!1,children:n.map(e=>(0,$.jsx)(lP,{fill:e.color},e.label))}),(0,$.jsx)(`text`,{x:`50%`,y:`47%`,textAnchor:`middle`,fill:`var(--mt-text)`,fontSize:22,fontWeight:600,children:r.toLocaleString()}),(0,$.jsx)(`text`,{x:`50%`,y:`59%`,textAnchor:`middle`,fill:`var(--mt-text-dim)`,fontSize:10,children:t})]})})}),(0,$.jsx)(`div`,{className:`chart-legend`,children:n.map(e=>(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`i`,{style:{background:e.color}}),e.label,` `,(0,$.jsx)(`b`,{children:e.value})]},e.label))})]})}function Vq({values:e,color:t,unit:n,maxValue:r}){let i=e.filter(e=>e!=null);if(i.length===0)return(0,$.jsx)(`div`,{className:`spark spark--empty`,children:`no samples yet`});let a=e.map((e,t)=>({i:t,v:e})),o=i[i.length-1],s=`ma-${t.replace(/[^a-z0-9]/gi,``)}`;return(0,$.jsxs)(`div`,{className:`chart chart--spark`,children:[(0,$.jsxs)(`span`,{className:`chart-spark__last`,style:{color:t},children:[o.toFixed(n===`%`?0:1),n??``]}),(0,$.jsx)(Qg,{width:`100%`,height:46,children:(0,$.jsxs)(Tq,{data:a,margin:{top:4,right:2,left:2,bottom:0},children:[(0,$.jsx)(`defs`,{children:(0,$.jsxs)(`linearGradient`,{id:s,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,$.jsx)(`stop`,{offset:`0%`,stopColor:t,stopOpacity:.35}),(0,$.jsx)(`stop`,{offset:`100%`,stopColor:t,stopOpacity:0})]})}),(0,$.jsx)(UW,{hide:!0,domain:[0,r??`dataMax`]}),(0,$.jsx)(cP,{cursor:{stroke:Lq},content:({active:e,payload:r})=>(0,$.jsx)(Iq,{active:e,payload:r?.map(e=>({...e,name:`value`,color:t})),unit:n})}),(0,$.jsx)(sW,{type:`monotone`,dataKey:`v`,stroke:t,fill:`url(#${s})`,strokeWidth:1.7,connectNulls:!1,isAnimationActive:!1,dot:!1})]})})]})}function Hq({value:e,label:t,color:n}){let r=e!=null,i=r?Math.max(0,Math.min(100,e)):0;return(0,$.jsxs)(`div`,{className:`gauge`,children:[(0,$.jsxs)(`div`,{className:`gauge__radial`,children:[(0,$.jsx)(Qg,{width:72,height:72,children:(0,$.jsxs)(Nq,{data:[{name:t,value:i,fill:n}],innerRadius:`72%`,outerRadius:`100%`,startAngle:90,endAngle:-270,barSize:7,children:[(0,$.jsx)(kI,{type:`number`,domain:[0,100],tick:!1,axisLine:!1}),(0,$.jsx)(JB,{dataKey:`value`,cornerRadius:4,background:{fill:`var(--mt-surface-2)`},isAnimationActive:!1})]})}),(0,$.jsx)(`span`,{className:`gauge__pct`,style:{color:r?`var(--mt-text)`:`var(--mt-text-faint)`},children:r?`${Math.round(i)}%`:`n/a`})]}),(0,$.jsx)(`span`,{className:`gauge__label`,children:t})]})}function Uq(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Wq(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,hour12:!1})}function Gq({onRestored:e}){let[t,n]=(0,v.useState)(null),[r,i]=(0,v.useState)(null),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(null),[l,u]=(0,v.useState)(null),[d,f]=(0,v.useState)(null),[p,m]=(0,v.useState)(null),h=(0,v.useCallback)(()=>{uc(`/api/config/history`).then(n).catch(()=>n({versions:[],bytes:0,retention:50}))},[]);(0,v.useEffect)(()=>h(),[h]);let g=(e,t)=>dc(e,t).catch(()=>({error:`request failed`})),_=async()=>{let e=(p??``).trim();m(null);let t=await g(`/api/config/history/checkpoint`,{label:e||void 0});i(t.ok?`Checkpoint saved${e?` · “${e}”`:``}`:`Failed: ${t.error}`),t.ok&&h()},y=async e=>{if(s===e){c(null),u(null);return}c(e),u(null),u(await uc(`/api/config/history/diff?id=${encodeURIComponent(e)}`).catch(()=>null))},b=async t=>{f(null),o(!0);let n=await g(`/api/config/history/restore`,{id:t});o(!1),i(n.ok?`Restored ${t}${n.persisted===!1?` (applied live, not persisted)`:``}`:`Restore failed: ${n.error}`),n.ok&&(h(),e())},x=async e=>{let t=await g(`/api/config/history/delete`,{id:e});i(t.ok?`Version deleted`:`Failed: ${t.error}`),t.ok&&h()};return t?(0,$.jsxs)($.Fragment,{children:[r&&(0,$.jsx)(`div`,{className:`cfg-msg`,children:r}),(0,$.jsxs)(`div`,{className:`toolbar`,style:{marginBottom:14},children:[p===null?(0,$.jsx)(`button`,{className:`btn is-active`,onClick:()=>m(``),children:`★ Save checkpoint`}):(0,$.jsxs)(`span`,{className:`cfgver-cp`,children:[(0,$.jsx)(`input`,{className:`backup-path-input`,autoFocus:!0,placeholder:`checkpoint name (e.g. pre-upgrade)`,value:p,onChange:e=>m(e.target.value),onKeyDown:e=>{e.key===`Enter`&&_(),e.key===`Escape`&&m(null)}}),(0,$.jsx)(`button`,{className:`topo-btn cfg-save`,onClick:()=>void _(),children:`Save`}),(0,$.jsx)(`button`,{className:`topo-btn`,onClick:()=>m(null),children:`Cancel`})]}),(0,$.jsx)(`span`,{style:{flex:1}}),(0,$.jsxs)(`span`,{className:`muted`,children:[t.versions.length,` versions · `,Uq(t.bytes),` · auto-keep `,t.retention]})]}),t.versions.length===0?(0,$.jsx)(`div`,{className:`muted`,children:`No versions yet — they appear here after each config change.`}):(0,$.jsx)(`ol`,{className:`cfgver`,children:t.versions.map((e,t)=>{let n=e.drift.added+e.drift.removed;return(0,$.jsxs)(`li`,{className:`cfgver__row${t===0?` is-head`:``}`,children:[(0,$.jsx)(`span`,{className:`cfgver__dot`,"aria-hidden":`true`}),(0,$.jsxs)(`div`,{className:`cfgver__main`,children:[(0,$.jsxs)(`div`,{className:`cfgver__line`,children:[(0,$.jsx)(`span`,{className:`cfgver__kind cfgver__kind--${e.kind}`,children:e.kind===`checkpoint`?`★ checkpoint`:`auto`}),e.label&&(0,$.jsx)(`span`,{className:`cfgver__label`,children:e.label}),(0,$.jsx)(`span`,{className:`cfgver__time`,children:Wq(e.ts)}),t===0?(0,$.jsx)(`span`,{className:`cfgver__cur`,children:`latest`}):n===0?(0,$.jsx)(`span`,{className:`cfgver__same`,children:`identical to current`}):(0,$.jsxs)(`span`,{className:`cfgver__drift`,children:[(0,$.jsxs)(`span`,{className:`add`,children:[`+`,e.drift.added]}),(0,$.jsxs)(`span`,{className:`rem`,children:[`−`,e.drift.removed]}),(0,$.jsx)(`span`,{className:`muted`,children:` vs current`})]})]}),s===e.id&&(0,$.jsx)(`div`,{className:`cfgver__diff`,children:l?l.unified.trim()?(0,$.jsx)(`pre`,{className:`body diff`,children:l.unified}):(0,$.jsx)(`span`,{className:`muted`,children:`No differences from the current config.`}):(0,$.jsx)(`span`,{className:`muted`,children:`computing diff…`})})]}),(0,$.jsxs)(`div`,{className:`cfgver__actions`,children:[(0,$.jsx)(`button`,{className:`topo-btn`,onClick:()=>void y(e.id),children:s===e.id?`Hide`:`Diff`}),d===e.id?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`button`,{className:`topo-btn cfg-save`,disabled:a,onClick:()=>void b(e.id),children:`Confirm restore`}),(0,$.jsx)(`button`,{className:`topo-btn`,onClick:()=>f(null),children:`Cancel`})]}):(0,$.jsx)(`button`,{className:`topo-btn`,disabled:t===0,title:t===0?`This is the current config`:`Restore this version`,onClick:()=>f(e.id),children:`Restore`}),e.kind===`checkpoint`&&(0,$.jsx)(`button`,{className:`topo-btn cfgver__del`,title:`Delete`,onClick:()=>void x(e.id),children:`✕`})]})]},e.id)})})]}):(0,$.jsx)(`div`,{className:`muted`,children:`loading history…`})}function Kq(e){if(!e)return[];let t=[],n=e=>e?Array.isArray(e.enum)?`enum`:e.type===`array`?`array<${n(e.items)}>`:Array.isArray(e.type)?e.type.join(` | `):e.type??(e.properties?`object`:`any`):`any`,r=(e,i,a,o)=>{let s=e.properties??{};for(let[e,c]of Object.entries(s)){let s=i?`${i}.${e}`:e,l=a||e;t.push({path:s,section:l,type:n(c),def:c.default===void 0?void 0:JSON.stringify(c.default),desc:c.description,enumv:Array.isArray(c.enum)?c.enum:void 0,required:o.has(e)}),c.properties&&r(c,s,l,new Set(c.required??[]));let u=c.additionalProperties;u?.properties&&r(u,`${s}.<name>`,l,new Set(u.required??[]));let d=c.items;d?.properties&&r(d,`${s}[]`,l,new Set(d.required??[]))}};return r(e,``,``,new Set(e.required??[])),t}function qq(){let[e,t]=(0,v.useState)(null),[n,r]=(0,v.useState)(``);(0,v.useEffect)(()=>{uc(`/api/config-schema`).then(t).catch(()=>{})},[]);let i=(0,v.useMemo)(()=>Kq(e),[e]),a=n.trim().toLowerCase(),o=a?i.filter(e=>e.path.toLowerCase().includes(a)||(e.desc??``).toLowerCase().includes(a)):i,s=(0,v.useMemo)(()=>{let e=new Map;for(let t of o){let n=e.get(t.section)??[];n.push(t),e.set(t.section,n)}return[...e.entries()]},[o]);return e?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`toolbar`,style:{marginBottom:12},children:[(0,$.jsx)(`input`,{className:`backup-path-input`,style:{width:`min(360px, 60vw)`},placeholder:`Search fields & descriptions…`,value:n,onChange:e=>r(e.target.value)}),(0,$.jsx)(`span`,{style:{flex:1}}),(0,$.jsxs)(`span`,{className:`muted`,children:[o.length,` options`]})]}),s.length===0?(0,$.jsxs)(`div`,{className:`muted`,children:[`No fields match “`,n,`”.`]}):(0,$.jsx)(`div`,{className:`fguide`,children:s.map(([e,t])=>(0,$.jsxs)(`div`,{className:`fguide__sec`,children:[(0,$.jsx)(`h4`,{className:`fguide__sechd`,children:e}),(0,$.jsx)(`div`,{className:`fguide__list`,children:t.map(e=>(0,$.jsxs)(`div`,{className:`fguide__item`,children:[(0,$.jsxs)(`div`,{className:`fguide__top`,children:[(0,$.jsx)(`code`,{className:`fguide__path`,children:e.path}),(0,$.jsx)(`span`,{className:`fguide__type`,children:e.type}),e.required&&(0,$.jsx)(`span`,{className:`fguide__req`,children:`required`}),e.def!==void 0&&(0,$.jsxs)(`span`,{className:`fguide__def`,children:[`default `,(0,$.jsx)(`code`,{children:e.def})]})]}),e.desc&&(0,$.jsx)(`p`,{className:`fguide__desc`,children:e.desc}),e.enumv&&(0,$.jsx)(`div`,{className:`fguide__enum`,children:e.enumv.map(e=>(0,$.jsx)(`code`,{children:e},e))})]},e.path))})]},e))})]}):(0,$.jsx)(`div`,{className:`muted`,children:`loading schema…`})}function Jq({type:e=`default`,size:t=`md`,ghost:n=!1,loading:r=!1,icon:i,className:a=``,children:o,disabled:s,...c}){return(0,$.jsxs)(`button`,{type:`button`,className:[`geist-btn`,`geist-btn--${e}`,`geist-btn--${t}`,n?`geist-btn--ghost`:``,r?`is-loading`:``,a].filter(Boolean).join(` `),disabled:s||r,...c,children:[r?(0,$.jsx)(Qq,{small:!0}):i&&(0,$.jsx)(`span`,{className:`geist-btn__icon`,children:i}),o!=null&&(0,$.jsx)(`span`,{className:`geist-btn__label`,children:o})]})}function Yq({type:e=`default`,label:t,children:n,className:r=``}){let i=t===!1?null:t??e;return(0,$.jsxs)(`div`,{className:`geist-note geist-note--${e} ${r}`.trim(),role:`note`,children:[i!=null&&(0,$.jsxs)(`b`,{className:`geist-note__label`,children:[i,`:`]}),` `,n]})}function Xq({type:e=`default`,children:t,className:n=``}){return(0,$.jsx)(`span`,{className:`geist-badge geist-badge--${e} ${n}`.trim(),children:t})}function Zq({type:e=`default`,pulse:t=!1,color:n,className:r=``}){return(0,$.jsx)(`span`,{className:`geist-dot geist-dot--${e}${t?` is-pulse`:``} ${r}`.trim(),style:n?{background:n}:void 0})}function Qq({small:e=!1}){return(0,$.jsx)(`span`,{className:`geist-spinner${e?` geist-spinner--sm`:``}`,"aria-label":`loading`,children:Array.from({length:12},(e,t)=>(0,$.jsx)(`span`,{style:{transform:`rotate(${t*30}deg)`,animationDelay:`${-1.1+t*.1}s`}},t))})}Li.registerPlugin(Y);var $q=e=>e<1?`<1ms`:e<1e3?`${Math.round(e)}ms`:`${(e/1e3).toFixed(2)}s`;function eJ(e){let t=[`B`,`KiB`,`MiB`,`GiB`],n=0,r=e;for(;r>=1024&&n<t.length-1;)r/=1024,n++;return`${r.toFixed(+!!n)} ${t[n]}`}var tJ=e=>new Date(e).toLocaleTimeString(void 0,{hour12:!1}),nJ=e=>e.toLocaleString(),rJ=e=>e==null?`?`:typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?String(e):JSON.stringify(e),iJ={READ:`#d4d4d8`,WRITE:`#a1a1aa`,WRITE_IDEMPOTENT:`#e4e4e7`,DESTRUCTIVE:`#f87171`,DANGEROUS:`#ef4444`},aJ=[[`5m`,3e5],[`15m`,9e5],[`1h`,36e5],[`6h`,216e5],[`24h`,864e5]],oJ=500;function sJ({title:e,extra:t,children:n,className:r}){return(0,$.jsxs)(`div`,{className:`panel${r?` ${r}`:``}`,children:[e!=null&&(0,$.jsxs)(`div`,{className:`sheet__hd`,style:{marginBottom:12},children:[(0,$.jsx)(`h2`,{style:{margin:0},children:e}),t!=null&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{style:{flex:1}}),t]})]}),n]})}function cJ({k:e,v:t,sub:n,cls:r}){return(0,$.jsxs)(`div`,{className:`stat${r?` ${r}`:``}`,children:[(0,$.jsx)(`p`,{className:`k`,children:e}),(0,$.jsxs)(`div`,{className:`v`,children:[t,n!=null&&(0,$.jsxs)(`small`,{children:[` `,n]})]})]})}function lJ({rows:e}){let t=Math.max(1,...e.map(e=>e.value));return(0,$.jsx)(`div`,{className:`hbar`,children:e.map(e=>(0,$.jsxs)(`div`,{className:`hbar__row`,children:[(0,$.jsx)(`span`,{className:`hbar__label`,title:e.label,children:e.label}),(0,$.jsx)(`div`,{className:`hbar__track`,children:(0,$.jsx)(`div`,{className:`hbar__fill`,style:{width:`${e.value/t*100}%`,background:e.color}})}),(0,$.jsx)(`span`,{className:`hbar__val`,children:e.sub??String(e.value)})]},e.label))})}function uJ(e){return e.reachable===!0?{label:`online`,color:`#d4d4d8`}:e.reachable===!1?{label:`offline`,color:`#f87171`}:{label:`checking…`,color:`#71717a`}}function dJ(e){let t=0;for(let n=0;n<e.length;n++)t=Math.imul(t,31)+e.charCodeAt(n)>>>0;return`hsl(${t%360} 70% 62%)`}function fJ(e,t,n,r){let i=1-r;return{x:i*i*e.x+2*i*r*t.x+r*r*n.x,y:i*i*e.y+2*i*r*t.y+r*r*n.y}}function pJ(e,t,n,r){let i=1-r,a=2*i*(t.x-e.x)+2*r*(n.x-t.x),o=2*i*(t.y-e.y)+2*r*(n.y-t.y);return Math.atan2(o,a)*180/Math.PI}var mJ=`#e4e4e7`,hJ=`#d4d4d8`,gJ=70,_J=Math.floor((2*gJ-24)/6.2),vJ=e=>e.length>_J?`${e.slice(0,_J-1)}…`:e,yJ=e=>Math.max(23,Math.min(gJ,e.length*3.1+12));function bJ({payload:e,pulses:t}){let n=e.devices,r=Math.max(1,n.length),i=n.map(e=>{let t=vJ(e.name);return{d:e,label:t,r:yJ(t)}}),a=Math.max(23,...i.map(e=>e.r)),o=r>1?(a+18)/Math.sin(Math.PI/r):0,s=Math.max(110+a,o,120),c=a+60,l=Math.max(700,Math.round((s+a+40)*2)),u=Math.round((s+c)*2),d=l/2,f=u/2,p={x:d,y:f},m=i.map((e,t)=>{let n=t/r*Math.PI*2-Math.PI/2+(r%2==0?Math.PI/r:0);return{...e,i:t,x:d+s*Math.cos(n),y:f+s*Math.sin(n)}});return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`svg`,{className:`conn`,viewBox:`0 0 ${l} ${u}`,width:`100%`,height:u,preserveAspectRatio:`xMidYMid meet`,children:[(0,$.jsxs)(`defs`,{children:[(0,$.jsxs)(`radialGradient`,{id:`conn-hub`,cx:`0.5`,cy:`0.34`,r:`0.75`,children:[(0,$.jsx)(`stop`,{offset:`0`,stopColor:`#fafafa`}),(0,$.jsx)(`stop`,{offset:`0.6`,stopColor:`#d4d4d8`}),(0,$.jsx)(`stop`,{offset:`1`,stopColor:`#a1a1aa`})]}),(0,$.jsxs)(`radialGradient`,{id:`conn-orb`,cx:`0.5`,cy:`0.32`,r:`0.85`,children:[(0,$.jsx)(`stop`,{offset:`0`,stopColor:`#27272a`}),(0,$.jsx)(`stop`,{offset:`1`,stopColor:`#18181b`})]}),(0,$.jsxs)(`radialGradient`,{id:`conn-burst`,cx:`0.5`,cy:`0.5`,r:`0.5`,children:[(0,$.jsx)(`stop`,{offset:`0`,stopColor:`#fafafa`}),(0,$.jsx)(`stop`,{offset:`0.5`,stopColor:`#e4e4e7`}),(0,$.jsx)(`stop`,{offset:`1`,stopColor:`#a1a1aa`,stopOpacity:`0`})]})]}),[.5,.78,1].map((e,t)=>(0,$.jsx)(`circle`,{className:`conn-grid`,cx:d,cy:f,r:s*e},`g-${t}`)),[0,1,2].map(e=>(0,$.jsx)(`circle`,{className:`conn-sonar`,cx:d,cy:f,style:{animationDelay:`${e*1.1}s`}},`s-${e}`)),m.map(({d:e,i:n,x:r,y:i})=>{let a=uJ(e.status),o=e.status.reachable===!0,s=e.status.reachable==null,c={x:r,y:i},l=(d+r)/2,u=(f+i)/2,m=r-d,h=i-f,g=Math.hypot(m,h)||1,_=-h/g,v=m/g,y={x:l+_*16,y:u+v*16},b={x:l-_*16,y:u-v*16},x=`M${d},${f} Q${y.x.toFixed(1)},${y.y.toFixed(1)} ${r.toFixed(1)},${i.toFixed(1)}`,S=`M${d},${f} Q${b.x.toFixed(1)},${b.y.toFixed(1)} ${r.toFixed(1)},${i.toFixed(1)}`,C=`M${d},${f} Q${l.toFixed(1)},${u.toFixed(1)} ${r.toFixed(1)},${i.toFixed(1)}`,w=fJ(p,y,c,.52),T=pJ(p,y,c,.52),E=fJ(p,b,c,.48),D=pJ(p,b,c,.48)+180,O=t[e.name]??0;return(0,$.jsxs)(`g`,{children:[(0,$.jsx)(`path`,{id:`conn-cmd-${n}`,className:`conn-link`,d:x,stroke:o?mJ:a.color,strokeOpacity:o?.5:.32,strokeDasharray:s?`2 8`:o?void 0:`6 7`}),(0,$.jsx)(`path`,{id:`conn-res-${n}`,className:`conn-link`,d:S,stroke:o?hJ:a.color,strokeOpacity:o?.5:.18,strokeDasharray:o?void 0:`6 7`}),o&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`path`,{className:`conn-flow`,d:x,stroke:mJ}),(0,$.jsx)(`circle`,{className:`conn-packet`,r:3.2,fill:mJ,children:(0,$.jsx)(`animateMotion`,{dur:`2.6s`,repeatCount:`indefinite`,calcMode:`linear`,children:(0,$.jsx)(`mpath`,{href:`#conn-cmd-${n}`})})}),(0,$.jsx)(`rect`,{className:`conn-packet`,x:-2.6,y:-2.6,width:5.2,height:5.2,fill:hJ,transform:`rotate(45)`,children:(0,$.jsx)(`animateMotion`,{dur:`2.6s`,begin:`0.9s`,repeatCount:`indefinite`,calcMode:`linear`,keyPoints:`1;0`,keyTimes:`0;1`,children:(0,$.jsx)(`mpath`,{href:`#conn-res-${n}`})})}),(0,$.jsx)(`path`,{className:`conn-chevron`,d:`M-4,-3 L4,0 L-4,3`,stroke:mJ,transform:`translate(${w.x.toFixed(1)},${w.y.toFixed(1)}) rotate(${T.toFixed(1)})`}),(0,$.jsx)(`path`,{className:`conn-chevron`,d:`M-4,-3 L4,0 L-4,3`,stroke:hJ,transform:`translate(${E.x.toFixed(1)},${E.y.toFixed(1)}) rotate(${D.toFixed(1)})`})]}),O>0&&(0,$.jsx)(`g`,{children:(0,$.jsxs)(`circle`,{r:6,fill:`url(#conn-burst)`,children:[(0,$.jsx)(`animateMotion`,{dur:`1.1s`,repeatCount:`1`,calcMode:`linear`,keyPoints:`0;1;0`,keyTimes:`0;0.5;1`,path:C}),(0,$.jsx)(`animate`,{attributeName:`opacity`,values:`0;1;1;0`,keyTimes:`0;0.1;0.85;1`,dur:`1.1s`,repeatCount:`1`,fill:`freeze`})]})},`burst-${e.name}-${O}`)]},`l-${e.name}`)}),(0,$.jsx)(`circle`,{className:`conn-hub-glow`,cx:d,cy:f,r:42}),(0,$.jsx)(`circle`,{className:`conn-hub-ring`,cx:d,cy:f,r:37}),(0,$.jsx)(`circle`,{cx:d,cy:f,r:29,fill:`url(#conn-hub)`,stroke:`#71717a`,strokeWidth:1.5}),(0,$.jsx)(`text`,{x:d,y:f-4,textAnchor:`middle`,fill:`#09090b`,fontSize:12,fontWeight:700,children:`LLM`}),(0,$.jsx)(`text`,{x:d,y:f+8,textAnchor:`middle`,fill:`#3f3f46`,fontSize:8,fontWeight:600,children:`⇄ MCP`}),(0,$.jsx)(`text`,{x:d,y:f+18,textAnchor:`middle`,fill:`#3f3f46`,fontSize:7.5,fontWeight:600,children:`server`}),m.map(({d:e,x:t,y:n,r,label:i})=>{let a=uJ(e.status),o=e.status.reachable===!0,s=o?`${e.status.latencyMs??`?`} ms`:a.label,c=dJ(e.name);return(0,$.jsxs)(`g`,{className:`conn-node`,children:[o&&(0,$.jsx)(`circle`,{className:`conn-node-halo`,cx:t,cy:n,r:r+1,stroke:c}),(0,$.jsx)(`circle`,{cx:t,cy:n,r,fill:`url(#conn-orb)`}),(0,$.jsx)(`circle`,{cx:t,cy:n,r,fill:c,opacity:.16}),(0,$.jsx)(`circle`,{cx:t,cy:n,r,fill:`none`,stroke:c,strokeWidth:2.5}),(0,$.jsx)(`circle`,{className:o?`conn-blink`:void 0,cx:t+r*.7,cy:n-r*.7,r:4.5,fill:a.color,stroke:`#0a121b`,strokeWidth:1.5}),(0,$.jsx)(`text`,{x:t,y:n+3.5,textAnchor:`middle`,fill:`#fafafa`,fontSize:10,fontWeight:600,children:i}),(0,$.jsx)(`text`,{x:t,y:n+r+14,textAnchor:`middle`,fill:`#a1a1aa`,fontSize:9,children:e.address??e.host}),(0,$.jsx)(`text`,{x:t,y:n+r+26,textAnchor:`middle`,fill:a.color,fontSize:9,fontWeight:600,children:s})]},`n-${e.name}`)})]}),(0,$.jsxs)(`div`,{className:`conn-legend`,children:[(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`i`,{style:{background:mJ}}),` command · LLM → device`]}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`i`,{style:{background:hJ}}),` response · device → LLM`]}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`i`,{style:{background:`#e4e4e7`}}),` live call (round-trip)`]})]})]})}function xJ({d:e}){let t=uJ(e.status),n=e.status.reachable===!0?`${t.label} · ${e.status.latencyMs??`?`}ms${e.status.version?` · v${e.status.version}`:``}`:e.status.reachable===!1?`${t.label}${e.status.error?` · ${e.status.error}`:``}`:t.label,r=dJ(e.name);return(0,$.jsxs)(`div`,{className:`card dev-card`,style:{borderLeft:`3px solid ${r}`},children:[(0,$.jsxs)(`div`,{className:`dev-card__top`,children:[(0,$.jsx)(`span`,{className:`dot`,style:{background:r},title:`device colour`}),(0,$.jsx)(`span`,{className:`dev-card__name`,children:e.name}),e.isDefault&&(0,$.jsx)(Xq,{type:`accent`,children:`default`}),(0,$.jsx)(`span`,{className:`dot dot--status`,style:{background:t.color},title:t.label}),(0,$.jsx)(`span`,{style:{flex:1}}),(0,$.jsx)(`span`,{className:`chip`,children:e.authMode})]}),(0,$.jsxs)(`div`,{className:`dev-card__meta`,children:[(0,$.jsx)(`span`,{children:e.mac?`mac`:`host`}),(0,$.jsx)(`b`,{children:e.address??`${e.host}:${e.port}`}),(0,$.jsx)(`span`,{children:`user`}),(0,$.jsx)(`b`,{children:e.username}),(0,$.jsx)(`span`,{children:`status`}),(0,$.jsx)(`b`,{style:{color:t.color},children:n}),(0,$.jsx)(`span`,{children:`activity`}),(0,$.jsxs)(`b`,{children:[e.activity.calls,` calls · `,e.activity.errors,` err`,e.activity.avgMs?` · ${$q(e.activity.avgMs)} avg`:``]}),e.description&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:`note`}),(0,$.jsx)(`b`,{children:e.description})]})]})]})}var SJ=e=>e==null?`?`:eJ(e);function CJ({d:e}){let t=e.status,n=e.history??[];return t.reachable===!0||n.length>0?(0,$.jsxs)(`div`,{className:`card health-card`,children:[(0,$.jsxs)(`div`,{className:`health-card__hd`,children:[(0,$.jsx)(Zq,{color:uJ(t).color}),(0,$.jsx)(`span`,{className:`dev-card__name`,children:e.name}),e.isDefault&&(0,$.jsx)(Xq,{type:`accent`,children:`default`}),(0,$.jsx)(`span`,{style:{flex:1}}),(0,$.jsx)(Xq,{type:t.version?`success`:`default`,children:t.version?`v${t.version}`:`—`})]}),(0,$.jsxs)(`div`,{className:`health-card__sub muted`,children:[t.boardName??`router`,t.architecture?` · ${t.architecture}`:``,t.cpuCount?` · ${t.cpuCount} cpu`:``,t.uptime?` · up ${t.uptime}`:``]}),(0,$.jsxs)(`div`,{className:`health-card__gauges`,children:[(0,$.jsx)(Hq,{value:t.cpuLoad,label:`CPU`,color:`#ededed`}),(0,$.jsx)(Hq,{value:t.memUsedPct,label:`MEM`,color:`#bdbdc4`}),(0,$.jsx)(Hq,{value:t.hddUsedPct,label:`DISK`,color:`#8a8a92`})]}),(0,$.jsxs)(`div`,{className:`health-card__charts`,children:[(0,$.jsxs)(`div`,{className:`health-chart`,children:[(0,$.jsx)(`span`,{className:`health-chart__k`,children:`CPU load`}),(0,$.jsx)(Vq,{values:n.map(e=>e.cpuLoad),color:`#ededed`,maxValue:100,unit:`%`})]}),(0,$.jsxs)(`div`,{className:`health-chart`,children:[(0,$.jsx)(`span`,{className:`health-chart__k`,children:`Memory used`}),(0,$.jsx)(Vq,{values:n.map(e=>e.memUsedPct),color:`#bdbdc4`,maxValue:100,unit:`%`})]}),(0,$.jsxs)(`div`,{className:`health-chart`,children:[(0,$.jsx)(`span`,{className:`health-chart__k`,children:`Probe latency`}),(0,$.jsx)(Vq,{values:n.map(e=>e.latencyMs),color:`#bdbdc4`,unit:`ms`})]})]}),(0,$.jsxs)(`div`,{className:`health-card__foot muted`,children:[`RAM `,SJ(t.totalMemory&&t.freeMemory?t.totalMemory-t.freeMemory:void 0),` /`,` `,SJ(t.totalMemory),` · free disk `,SJ(t.freeHdd)]})]}):(0,$.jsxs)(`div`,{className:`card health-card health-card--na`,children:[(0,$.jsxs)(`div`,{className:`health-card__hd`,children:[(0,$.jsx)(Zq,{color:uJ(t).color}),(0,$.jsx)(`span`,{className:`dev-card__name`,children:e.name}),e.isDefault&&(0,$.jsx)(Xq,{type:`accent`,children:`default`})]}),(0,$.jsx)(`p`,{className:`muted`,style:{margin:0},children:t.reachable===!1?`Offline — ${t.error??`unreachable`}`:e.mac?`Waiting for the first MAC-Telnet probe (these run every few minutes to avoid contending with tool calls)…`:`Waiting for the first health probe…`})]})}function wJ(e,t){let n=(0,v.useRef)(e),r=(0,v.useRef)(t);n.current=e,r.current=t,(0,v.useEffect)(()=>{let e=!1,t=null,i=null,a=()=>{e||(i=new EventSource(lc(`/api/sse`)),i.addEventListener(`hello`,()=>r.current(`sse`)),i.addEventListener(`tool`,e=>{try{n.current(JSON.parse(e.data))}catch{}}),i.onerror=()=>{i&&i.readyState===EventSource.CONNECTING&&r.current(`off`)})},o=()=>{if(e)return;let i=location.protocol===`https:`?`wss`:`ws`;t=new WebSocket(lc(`${i}://${location.host}/api/stream`));let s=!1;t.onopen=()=>{s=!0,r.current(`ws`)},t.onerror=()=>t?.close(),t.onmessage=e=>{try{let t=JSON.parse(e.data);t.type===`event`&&t.event&&n.current(t.event)}catch{}},t.onclose=()=>{e||(r.current(`off`),s?setTimeout(o,2e3):a())}};return o(),()=>{e=!0,t?.close(),i?.close()}},[])}function TJ(e){(0,v.useLayoutEffect)(()=>{let t=e.current;if(!t||window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;document.documentElement.classList.add(`js-motion`);let n=new WeakSet,r=e=>{n.has(e)||(n.add(e),Li.set(e,{opacity:0,y:26}),Y.create({trigger:e,start:`top 90%`,once:!0,onEnter:()=>Li.to(e,{opacity:1,y:0,duration:.7,ease:`power3.out`})}))},i=e=>{for(let t of e.querySelectorAll(`.reveal`))r(t)};i(t);let a=new MutationObserver(e=>{for(let t of e)for(let e of t.addedNodes)e instanceof Element&&(e.matches(`.reveal`)&&r(e),i(e))});a.observe(t,{childList:!0,subtree:!0});let o=setInterval(()=>Y.refresh(),1200),s=setTimeout(()=>clearInterval(o),7e3);return()=>{a.disconnect(),clearInterval(o),clearTimeout(s);for(let e of Y.getAll())e.kill();document.documentElement.classList.remove(`js-motion`)}},[e])}function EJ(e){let t=new Set,n=new Set,r=e=>{if(!e||typeof e!=`object`)return;let i=e;if(i.properties&&typeof i.properties==`object`)for(let e of Object.keys(i.properties))t.add(e),r(i.properties[e]);if(Array.isArray(i.enum))for(let e of i.enum)typeof e==`string`&&n.add(e);for(let e of[`items`,`additionalProperties`,`anyOf`,`oneOf`,`allOf`]){let t=i[e];Array.isArray(t)?t.forEach(r):t&&typeof t==`object`&&r(t)}for(let e of[`$defs`,`definitions`,`patternProperties`]){let t=i[e];if(t&&typeof t==`object`)for(let e of Object.values(t))r(e)}};return r(e),{keys:[...t].sort(),enums:[...n.add(`true`).add(`false`)].sort()}}function DJ(e,t){let n=t;for(;n>0&&/[A-Za-z0-9_.-]/.test(e[n-1]);)n--;let r=e.slice(n,t),i=n-1;for(;i>=0&&/\s/.test(e[i]);)i--;return{word:r,start:n,isValue:e[i]===`:`}}var OJ=[[`revert in 30s`,3e4],[`revert in 60s`,6e4],[`revert in 2m`,12e4],[`no auto-revert`,0]];function kJ({initial:e,onClose:t,onReload:n}){let[r,i]=(0,v.useState)(()=>JSON.stringify(e,null,2)),[a,o]=(0,v.useState)({keys:[],enums:[]}),[s,c]=(0,v.useState)([]),[l,u]=(0,v.useState)(null),[d,f]=(0,v.useState)(null),[p,m]=(0,v.useState)({}),[h,g]=(0,v.useState)(null),[_,y]=(0,v.useState)(null),[b,x]=(0,v.useState)(0),[S,C]=(0,v.useState)(6e4),[w,T]=(0,v.useState)(null),E=(0,v.useRef)(null),D=(0,v.useRef)(null),O=(0,v.useRef)(null),k=(0,v.useRef)(null);(0,v.useEffect)(()=>{uc(`/api/config-schema`).then(e=>o(EJ(e))).catch(()=>{})},[]),(0,v.useEffect)(()=>{D.current!=null&&E.current&&(E.current.selectionStart=E.current.selectionEnd=D.current,D.current=null)}),(0,v.useEffect)(()=>{let e=setTimeout(()=>{let e;try{e=JSON.parse(r)}catch(e){u(e instanceof Error?e.message:String(e)),c([]);return}u(null),dc(`/api/config/validate`,e).then(e=>c(e.errors??[])).catch(()=>{})},350);return()=>clearTimeout(e)},[r]),(0,v.useEffect)(()=>{if(!_||b<=0)return;let e=setInterval(()=>x(e=>Math.max(0,e-1)),1e3);return()=>clearInterval(e)},[_,b]),(0,v.useEffect)(()=>{_&&b===0&&(_.rollbackMs??0)>0&&(T(`Auto-reverted — changes were not confirmed in time.`),y(null),n())},[_,b,n]);let A=!l&&s.length===0,j=e=>{let{word:t,start:n,isValue:r}=DJ(e.value,e.selectionStart);if(t.length<1){f(null);return}let i=(r?a.enums:a.keys).filter(e=>e.startsWith(t)&&e!==t).slice(0,8);if(!i.length){f(null);return}let o=e.value.slice(0,e.selectionStart).split(`
|
|
72
72
|
`),s=o[o.length-1].length,c=Math.min(12+s*7.22-e.scrollLeft,e.clientWidth-160),l=10+o.length*18-e.scrollTop+4;f({items:i,index:0,start:n,x:Math.max(4,c),y:l})},M=e=>{let t=E.current;if(!t||!d)return;let n=r.slice(0,d.start)+e+r.slice(t.selectionStart);D.current=d.start+e.length,i(n),f(null)},N=e=>{if(!d){e.key===` `&&e.ctrlKey&&(e.preventDefault(),j(e.currentTarget));return}e.key===`ArrowDown`?(e.preventDefault(),f({...d,index:(d.index+1)%d.items.length})):e.key===`ArrowUp`?(e.preventDefault(),f({...d,index:(d.index-1+d.items.length)%d.items.length})):e.key===`Enter`||e.key===`Tab`?(e.preventDefault(),M(d.items[d.index])):e.key===`Escape`&&f(null)},P=()=>{try{return JSON.parse(r)}catch{return null}},F=async()=>{let e=P();if(!e?.devices)return;T(`Testing devices…`);let t={};for(let[n,r]of Object.entries(e.devices)){let e=await dc(`/api/config/test-device`,{name:n,config:r}).catch(()=>({ok:!1}));t[n]=e.ok&&e.status?.reachable===!0?{ok:!0,label:`${Math.round(e.status.latencyMs??0)}ms · ${e.status.identity??`ok`}`}:{ok:!1,label:e.status?.error??e.errors?.[0]?.message??`unreachable`},m({...t})}T(null)},I=async()=>{let e=P();e!=null&&g(await dc(`/api/config/preview`,e))},L=async()=>{let e=P();if(e==null)return;T(`Saving…`);let t=await dc(`/api/config`,{config:e,rollbackMs:S});if(T(null),g(null),!t.ok){c(t.errors??[{path:`(root)`,message:`save rejected`}]);return}y(t),x(Math.round((t.rollbackMs??0)/1e3))},ee=async()=>{_?.pendingId&&(await dc(`/api/config/keep`,{pendingId:_.pendingId}),y(null),T(`Changes kept.`),n())},te=async()=>{_?.pendingId&&(await dc(`/api/config/rollback`,{pendingId:_.pendingId}),y(null),T(`Reverted to the previous config.`),n())},R=r.split(`
|
|
73
73
|
`).length;return(0,$.jsxs)(`div`,{className:`cfgstudio`,children:[(0,$.jsxs)(`div`,{className:`cfg-toolbar`,children:[(0,$.jsx)(`span`,{className:`cfg-status ${A?`is-ok`:`is-bad`}`,children:l?`invalid JSON`:s.length?`${s.length} schema issue(s)`:`valid ✓`}),(0,$.jsx)(`span`,{style:{flex:1}}),(0,$.jsx)(`button`,{className:`topo-btn`,onClick:()=>void F(),children:`Test devices`}),(0,$.jsx)(`button`,{className:`topo-btn`,onClick:()=>void I(),disabled:!A,children:`Preview diff`}),(0,$.jsx)(`select`,{className:`cfg-select`,value:S,onChange:e=>C(Number(e.target.value)),title:`Auto-revert window`,children:OJ.map(([e,t])=>(0,$.jsx)(`option`,{value:t,children:e},t))}),(0,$.jsx)(`button`,{className:`topo-btn cfg-save`,onClick:()=>void L(),disabled:!A||!!_,children:`Save`}),(0,$.jsx)(`button`,{className:`topo-btn`,onClick:t,children:`Close`})]}),w&&(0,$.jsx)(`div`,{className:`cfg-msg`,children:w}),_&&(0,$.jsxs)(`div`,{className:`cfg-banner`,children:[(0,$.jsx)(`strong`,{children:`Applied.`}),` `,(_.rollbackMs??0)>0?(0,$.jsxs)($.Fragment,{children:[`Reverting in `,(0,$.jsxs)(`span`,{className:`cfg-count`,children:[b,`s`]}),` unless you keep it.`]}):(0,$.jsx)($.Fragment,{children:`Saved without an auto-revert window.`}),_.devicesChanged&&(0,$.jsxs)(`span`,{className:`cfg-warn`,children:[` `,`· device list changed — reconnect the MCP client to expose it to the model`]}),(0,$.jsx)(`span`,{style:{flex:1}}),(0,$.jsx)(`button`,{className:`topo-btn cfg-save`,onClick:()=>void ee(),children:`Keep changes`}),(0,$.jsx)(`button`,{className:`topo-btn`,onClick:()=>void te(),children:`Revert now`})]}),(0,$.jsxs)(`div`,{className:`cfg-editor`,children:[(0,$.jsx)(`pre`,{className:`cfg-gutter`,"aria-hidden":`true`,ref:k,children:Array.from({length:R},(e,t)=>t+1).join(`
|
|
74
74
|
`)}),(0,$.jsxs)(`div`,{className:`cfg-ta-wrap`,children:[(0,$.jsxs)(`pre`,{className:`cfg-hl`,"aria-hidden":`true`,ref:O,children:[PJ(r),`
|
|
@@ -77,7 +77,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
77
77
|
`).map((e,t)=>(0,$.jsx)(`div`,{className:e.startsWith(`+`)?`d-add`:e.startsWith(`-`)?`d-del`:e.startsWith(`@@`)?`d-hunk`:``,children:e||` `},t))})}),o&&(0,$.jsx)(sJ,{title:`Snapshot · ${o.label??o.id}`,className:`reveal`,extra:(0,$.jsx)(Jq,{type:`secondary`,size:`sm`,onClick:()=>s(null),children:`✕ Close`}),children:(0,$.jsx)(`pre`,{className:`body`,style:{maxHeight:460},children:o.body||`(empty)`})})]})}var BJ={add:`+`,set:`~`,remove:`−`,enable:`▲`,disable:`▽`,move:`⇅`};function VJ(){let[e,t]=(0,v.useState)(``),[n,r]=(0,v.useState)(null),[i,a]=(0,v.useState)(null),[o,s]=(0,v.useState)(!1),c=async()=>{s(!0),a(null);let t=await dc(`/api/plan`,{script:e}).catch(()=>({error:`request failed`}));if(s(!1),t.error||!t.plan){a(t.error??`no plan produced`),r(null);return}r({plan:t.plan,text:t.text??``})},l=n?.plan.grade??``,u=l===`critical`||l===`high`;return(0,$.jsxs)(`section`,{className:`view`,children:[(0,$.jsxs)(sJ,{title:`Change plan — dry-run`,className:`reveal`,extra:(0,$.jsx)(`span`,{className:`muted`,children:`terraform-style preview · pure analysis, never touches a device`}),children:[(0,$.jsx)(`textarea`,{className:`plan-input`,spellCheck:!1,placeholder:`Paste intended RouterOS commands, one per line, e.g.
|
|
78
78
|
/ip firewall filter add chain=input action=drop in-interface=WAN
|
|
79
79
|
/ip address add address=10.0.0.1/24 interface=ether1
|
|
80
|
-
/ip address remove [find address=192.168.88.1/24]`,value:e,onChange:e=>t(e.target.value)}),(0,$.jsxs)(`div`,{className:`toolbar`,style:{marginTop:10},children:[(0,$.jsx)(`button`,{className:`btn is-active`,onClick:()=>void c(),disabled:o||!e.trim(),children:o?`Planning…`:`▸ Plan`}),i&&(0,$.jsx)(`span`,{className:`cfg-err`,children:i})]})]}),n&&(0,$.jsxs)(sJ,{title:`Plan`,className:`reveal`,extra:(0,$.jsxs)(`span`,{className:`cfg-status ${u?`is-bad`:`is-ok`}`,children:[`risk `,n.plan.riskScore,` · `,l]}),children:[(0,$.jsxs)(`div`,{className:`legend`,style:{marginTop:0},children:[(0,$.jsxs)(`span`,{children:[`+`,n.plan.counts.add,` to add`]}),(0,$.jsxs)(`span`,{children:[`~`,n.plan.counts.modify,` to modify`]}),(0,$.jsxs)(`span`,{children:[`-`,n.plan.counts.remove,` to remove`]}),n.plan.reordered&&(0,$.jsx)(`span`,{children:`· reordered into a safe sequence`})]}),n.plan.warnings.length>0&&(0,$.jsx)(`div`,{className:`cfg-errors`,style:{margin:`10px 0`},children:n.plan.warnings.map((e,t)=>(0,$.jsxs)(`div`,{className:`cfg-err`,style:{color:`var(--mt-warn)`},children:[`⚠ `,e]},t))}),(0,$.jsx)(`div`,{className:`plan-steps`,children:n.plan.steps.map(e=>(0,$.jsxs)(`div`,{className:`plan-step risk-${e.risk}`,children:[(0,$.jsx)(`span`,{className:`plan-op`,children:BJ[e.op]??`•`}),(0,$.jsx)(`code`,{children:e.command}),e.lockoutRisk&&(0,$.jsx)(`span`,{className:`plan-lock`,children:`⚠ lock-out`}),(0,$.jsx)(`span`,{className:`plan-risk`,children:e.risk})]},e.index))})]})]})}function HJ(){let[e,t]=(0,v.useState)(null),[n,r]=(0,v.useState)(null),[i,a]=(0,v.useState)(null),[o,s]=(0,v.useState)(null),c=(0,v.useCallback)(()=>{uc(`/api/s3/list`).then(t).catch(()=>t({configured:!1,objects:[]}))},[]);(0,v.useEffect)(()=>c(),[c]);let l=e=>{uc(`/api/s3/presign?key=${encodeURIComponent(e)}`).then(e=>{e.url?window.open(e.url,`_blank`,`noopener`):s(`could not generate download link`)}).catch(()=>s(`could not generate download link`))},u=async e=>{a(e);let t=await dc(`/api/s3/delete`,{key:e}).catch(()=>({error:`request failed`}));a(null),r(null),t.ok?(s(`Deleted ${e}`),c()):s(t.error??`delete failed`)};return e?e.configured?(0,$.jsx)(`section`,{className:`view`,children:(0,$.jsxs)(sJ,{title:`S3 backups`,className:`reveal`,extra:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`span`,{className:`muted`,children:[e.target,` · `,e.objects.length,` object`,e.objects.length===1?``:`s`,e.truncated?` (truncated)`:``]}),(0,$.jsx)(`button`,{className:`btn`,onClick:c,style:{marginLeft:10},children:`↻ Refresh`})]}),children:[o&&(0,$.jsx)(`div`,{className:`cfg-msg`,children:o}),e.objects.length===0?(0,$.jsxs)(`div`,{className:`muted`,style:{padding:12},children:[`No objects in the bucket. Upload one with the `,(0,$.jsx)(`code`,{children:`upload_backup_to_s3`}),` tool.`]}):(0,$.jsx)(`div`,{className:`feedwrap`,children:(0,$.jsxs)(`table`,{className:`feed`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{children:`key`}),(0,$.jsx)(`th`,{className:`num`,children:`size`}),(0,$.jsx)(`th`,{children:`modified`}),(0,$.jsx)(`th`,{style:{width:200},children:`actions`})]})}),(0,$.jsx)(`tbody`,{children:e.objects.map(e=>(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`td`,{children:e.key}),(0,$.jsx)(`td`,{className:`num`,children:eJ(e.size)}),(0,$.jsx)(`td`,{children:e.lastModified?new Date(e.lastModified).toLocaleString():`—`}),(0,$.jsxs)(`td`,{onClick:e=>e.stopPropagation(),children:[(0,$.jsx)(`button`,{className:`btn`,onClick:()=>l(e.key),children:`⤓ Download`}),` `,n===e.key?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`button`,{className:`btn btn-danger`,disabled:i===e.key,onClick:()=>void u(e.key),children:`✓ Confirm`}),` `,(0,$.jsx)(`button`,{className:`btn`,onClick:()=>r(null),children:`Cancel`})]}):(0,$.jsx)(`button`,{className:`btn`,onClick:()=>r(e.key),children:`🗑 Delete`})]})]},e.key))})]})})]})}):(0,$.jsxs)(`div`,{className:`feed-empty`,children:[(0,$.jsx)(`div`,{className:`feed-empty__icon`,children:`☁️`}),(0,$.jsx)(`p`,{className:`feed-empty__title`,children:`S3 is not configured`}),(0,$.jsxs)(`p`,{className:`feed-empty__sub`,children:[`Add an `,(0,$.jsx)(`code`,{children:`s3`}),` block (bucket + credentials) to your config to manage backup objects here.`]})]}):(0,$.jsx)(`div`,{className:`muted`,children:`loading S3 objects…`})}function UJ(){let[e,t]=(0,v.useState)(null),[n,r]=(0,v.useState)(null),[i,a]=(0,v.useState)(!1),[o,s]=(0,v.useState)(null),[c,l]=(0,v.useState)(null),[u,d]=(0,v.useState)(null),[f,p]=(0,v.useState)(``),[m,h]=(0,v.useState)(null),[g,_]=(0,v.useState)(null),y=(0,v.useRef)(null),b=(0,v.useCallback)(()=>{uc(`/api/backups`).then(e=>{t(e),p(t=>t||e.devices[0]||``)}).catch(()=>t({dir:``,devices:[],backups:[]}))},[]);(0,v.useEffect)(()=>b(),[b]);let x=(e,t)=>dc(e,t).catch(()=>({error:`request failed`})),S=async()=>{a(!0),r(`Capturing /export…`);let e=await dc(`/api/backups/create`,{device:f||void 0}).catch(()=>({error:`request failed`}));a(!1),r(e.ok?`Created ${e.name} (${e.bytes} bytes)`:`Create failed: ${e.error}`),e.ok&&b()},C=async e=>{let t=await e.text(),n=await x(`/api/backups/upload`,{name:e.name,content:t});r(n.ok?`Uploaded ${n.name}`:`Upload failed: ${n.error}`),n.ok&&b()},w=async e=>{s(null);let t=await x(`/api/backups/delete`,{name:e});r(t.ok?`Deleted ${e}`:`Delete failed: ${t.error}`),t.ok&&b()},T=async()=>{if(!u)return;let{name:e,value:t}=u;if(d(null),!t||t===e)return;let n=await x(`/api/backups/rename`,{name:e,new_name:t});r(n.ok?`Renamed to ${n.name}`:`Rename failed: ${n.error}`),n.ok&&b()},E=async e=>{if(!c)return;a(!0),r(e?`Restoring in Safe Mode…`:`Dry-run restore in Safe Mode…`);let t=await dc(`/api/backups/restore`,{name:c,device:f||void 0,confirm:e}).catch(()=>({ok:!1,message:`request failed`}));a(!1),r(t.ok?t.committed?`Restored ${c} → ${f}: ${t.message}`:`Dry-run OK (${t.applied} cmds, rolled back). Click “Restore (commit)” to apply for real.`:`Restore failed: ${t.message}`),t.ok&&e&&l(null)},D=e=>{uc(`/api/backups/get?name=${encodeURIComponent(e)}`).then(h).catch(()=>{})},O=async()=>{if(g===null)return;let t=g.trim();if(!t||t===e?.dir){_(null);return}a(!0);let n=await dc(`/api/backups/dir`,{dir:t}).catch(()=>({error:`request failed`}));a(!1),_(null),n.ok?r(n.persisted?`Backup path saved → ${n.dir}`:n.warning??`Path applied → ${n.dir}`):r(`Path change failed: ${n.error}`),n.ok&&b()};return e?(0,$.jsxs)(`section`,{className:`view`,children:[(0,$.jsxs)(sJ,{title:`Local backup vault`,className:`reveal`,extra:g===null?(0,$.jsxs)(`span`,{className:`muted backup-path`,children:[(0,$.jsx)(`span`,{title:e.dir,children:e.dir}),(0,$.jsx)(`button`,{className:`linkish`,title:`Change backup directory`,onClick:()=>_(e.dir),children:`✎ edit path`})]}):(0,$.jsxs)(`span`,{className:`backup-path`,children:[(0,$.jsx)(`input`,{className:`backup-path-input`,value:g,autoFocus:!0,spellCheck:!1,placeholder:`~/.mikrotik-mcp/backups`,onChange:e=>_(e.target.value),onKeyDown:e=>{e.key===`Enter`&&O(),e.key===`Escape`&&_(null)}}),(0,$.jsx)(`button`,{className:`topo-btn cfg-save`,onClick:()=>void O(),disabled:i,children:`Save path`}),(0,$.jsx)(`button`,{className:`topo-btn`,onClick:()=>_(null),children:`Cancel`})]}),children:[n&&(0,$.jsx)(`div`,{className:`cfg-msg`,children:n}),(0,$.jsxs)(`div`,{className:`toolbar`,style:{marginBottom:12},children:[(0,$.jsxs)(`select`,{className:`btn`,value:f,onChange:e=>p(e.target.value),children:[e.devices.length===0&&(0,$.jsx)(`option`,{value:``,children:`no devices`}),e.devices.map(e=>(0,$.jsx)(`option`,{value:e,children:e},e))]}),(0,$.jsx)(`button`,{className:`btn is-active`,onClick:()=>void S(),disabled:i||!f,children:`⤓ Create backup`}),(0,$.jsx)(`button`,{className:`btn`,onClick:()=>y.current?.click(),children:`⤒ Upload .rsc`}),(0,$.jsx)(`input`,{ref:y,type:`file`,accept:`.rsc,text/plain`,style:{display:`none`},onChange:e=>{let t=e.target.files?.[0];t&&C(t),e.currentTarget.value=``}}),(0,$.jsx)(`button`,{className:`btn`,onClick:b,children:`↻ Refresh`})]}),c&&(0,$.jsxs)(`div`,{className:`cfg-banner`,style:{marginBottom:12},children:[(0,$.jsxs)(`strong`,{children:[`Restore `,c]}),` onto`,` `,(0,$.jsx)(`select`,{className:`cfg-select`,value:f,onChange:e=>p(e.target.value),children:e.devices.map(e=>(0,$.jsx)(`option`,{value:e,children:e},e))}),` `,`via Safe Mode (auto-reverts on lock-out).`,(0,$.jsx)(`span`,{style:{flex:1}}),(0,$.jsx)(`button`,{className:`topo-btn`,onClick:()=>void E(!1),disabled:i,children:`Dry-run`}),(0,$.jsx)(`button`,{className:`topo-btn cfg-save`,onClick:()=>void E(!0),disabled:i,children:`Restore (commit)`}),(0,$.jsx)(`button`,{className:`topo-btn`,onClick:()=>l(null),children:`Cancel`})]}),e.backups.length===0?(0,$.jsx)(`div`,{className:`muted`,style:{padding:12},children:"No backups yet. Click “Create backup” to capture this device’s config, or upload a `.rsc`."}):(0,$.jsx)(`div`,{className:`feedwrap`,children:(0,$.jsxs)(`table`,{className:`feed`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{children:`name`}),(0,$.jsx)(`th`,{children:`device`}),(0,$.jsx)(`th`,{className:`num`,children:`size`}),(0,$.jsx)(`th`,{children:`captured`}),(0,$.jsx)(`th`,{style:{width:280},children:`actions`})]})}),(0,$.jsx)(`tbody`,{children:e.backups.map(e=>(0,$.jsxs)(`tr`,{className:m?.name===e.name?`is-selected`:void 0,children:[(0,$.jsx)(`td`,{children:e.name}),(0,$.jsx)(`td`,{children:e.device??`—`}),(0,$.jsx)(`td`,{className:`num`,children:eJ(e.bytes)}),(0,$.jsx)(`td`,{children:new Date(e.modified).toLocaleString()}),(0,$.jsxs)(`td`,{onClick:e=>e.stopPropagation(),children:[(0,$.jsx)(`button`,{className:`btn`,onClick:()=>D(e.name),children:`view`}),` `,(0,$.jsx)(`a`,{className:`btn`,href:lc(`/api/backups/raw?name=${encodeURIComponent(e.name)}`),download:e.name,children:`⤓`}),` `,u?.name===e.name?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`input`,{className:`search`,style:{display:`inline-block`,width:150},value:u.value,autoFocus:!0,onChange:t=>d({name:e.name,value:t.target.value}),onKeyDown:e=>e.key===`Enter`&&void T()}),` `,(0,$.jsx)(`button`,{className:`btn cfg-save`,onClick:()=>void T(),children:`✓`}),` `,(0,$.jsx)(`button`,{className:`btn`,onClick:()=>d(null),children:`✕`}),` `]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`button`,{className:`btn`,onClick:()=>d({name:e.name,value:e.name}),children:`rename`}),` `,(0,$.jsx)(`button`,{className:`btn cfg-save`,onClick:()=>l(e.name),children:`restore`}),` `]}),o===e.name?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`button`,{className:`btn btn-danger`,onClick:()=>void w(e.name),children:`✓`}),` `,(0,$.jsx)(`button`,{className:`btn`,onClick:()=>s(null),children:`✕`})]}):(0,$.jsx)(`button`,{className:`btn`,onClick:()=>s(e.name),children:`🗑`})]})]},e.name))})]})})]}),m&&(0,$.jsx)(sJ,{title:`Backup · ${m.name}`,className:`reveal`,extra:(0,$.jsx)(Jq,{type:`secondary`,size:`sm`,onClick:()=>h(null),children:`✕ Close`}),children:(0,$.jsx)(`pre`,{className:`body`,style:{maxHeight:460},children:m.content||`(empty)`})})]}):(0,$.jsx)(`div`,{className:`muted`,children:`loading backups…`})}function WJ(){return(0,$.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,$.jsx)(`rect`,{x:`9`,y:`9`,width:`11`,height:`11`,rx:`2`}),(0,$.jsx)(`path`,{d:`M6 15H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v1`})]})}function GJ({text:e,label:t=`Copy`,className:n=`btn`,icon:r=!1,title:i}){let[a,o]=(0,v.useState)(!1),s=(0,v.useRef)(null);return(0,v.useEffect)(()=>()=>void(s.current&&clearTimeout(s.current)),[]),(0,$.jsxs)(`button`,{type:`button`,className:`copybtn ${n}${r?` copybtn--icon`:``}${a?` is-copied`:``}`,onClick:()=>{navigator.clipboard?.writeText(e).then(()=>{o(!0),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>o(!1),1400)},()=>{})},title:i??`Copy to clipboard`,"aria-label":i??`Copy to clipboard`,children:[r?(0,$.jsx)(WJ,{}):t,(0,$.jsx)(`span`,{className:`copybtn__tip`,role:`status`,"aria-live":`polite`,children:`Copied!`})]})}function KJ({event:e,onClose:t}){return(0,$.jsx)(`div`,{className:`overlay`,onClick:e=>e.target===e.currentTarget&&t(),children:(0,$.jsxs)(`div`,{className:`sheet`,children:[(0,$.jsxs)(`div`,{className:`sheet__hd`,children:[(0,$.jsx)(`span`,{className:`risk risk-${e.risk}`,children:e.risk}),(0,$.jsxs)(`h3`,{className:`sheet__tool`,children:[e.tool,(0,$.jsx)(GJ,{text:e.tool,className:`iconbtn`,icon:!0,title:`Copy tool name`})]}),(0,$.jsx)(`span`,{style:{flex:1}}),(0,$.jsx)(Jq,{type:`secondary`,size:`sm`,onClick:t,children:`✕ Close`})]}),(0,$.jsxs)(`div`,{className:`kv__body`,children:[(0,$.jsx)(`div`,{className:`kv__k`,children:`title`}),(0,$.jsx)(`div`,{className:`kv__v`,children:e.title}),(0,$.jsx)(`div`,{className:`kv__k`,children:`time`}),(0,$.jsx)(`div`,{className:`kv__v`,children:new Date(e.ts).toLocaleString()}),(0,$.jsx)(`div`,{className:`kv__k`,children:`device`}),(0,$.jsx)(`div`,{className:`kv__v`,children:e.device??`—`}),(0,$.jsx)(`div`,{className:`kv__k`,children:`transport`}),(0,$.jsx)(`div`,{className:`kv__v`,children:e.transport??`—`}),(0,$.jsx)(`div`,{className:`kv__k`,children:`duration`}),(0,$.jsx)(`div`,{className:`kv__v`,children:$q(e.durationMs)}),(0,$.jsx)(`div`,{className:`kv__k`,children:`status`}),(0,$.jsx)(`div`,{className:`kv__v`,children:(0,$.jsx)(`span`,{className:e.isError?`status-err`:`status-ok`,children:e.isError?`error`:`ok`})}),(0,$.jsx)(`div`,{className:`kv__k`,children:`output size`}),(0,$.jsxs)(`div`,{className:`kv__v`,children:[eJ(e.outputBytes),e.truncated?` (truncated)`:``]}),(0,$.jsx)(`div`,{className:`kv__k`,children:`structured`}),(0,$.jsx)(`div`,{className:`kv__v`,children:e.hasStructured?`yes (renders an MCP App view)`:`no`})]}),e.error&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`h2`,{className:`muted`,children:`ERROR`}),(0,$.jsx)(`pre`,{className:`body`,style:{color:`var(--mt-bad)`},children:e.error})]}),(0,$.jsxs)(`div`,{className:`sheet__hd`,children:[(0,$.jsx)(`h2`,{className:`muted`,style:{margin:0},children:`INPUT`}),(0,$.jsx)(`span`,{style:{flex:1}}),(0,$.jsx)(GJ,{text:e.input,title:`Copy input JSON`})]}),e.input?(0,$.jsx)(RJ,{value:e.input}):(0,$.jsx)(`pre`,{className:`body`,children:`—`}),(0,$.jsxs)(`div`,{className:`sheet__hd`,children:[(0,$.jsx)(`h2`,{className:`muted`,style:{margin:0},children:`OUTPUT`}),(0,$.jsx)(`span`,{style:{flex:1}}),(0,$.jsx)(GJ,{text:e.output,title:`Copy output`})]}),(0,$.jsx)(`pre`,{className:`body`,children:e.output||`—`})]})})}function qJ(e,t,n){let r=URL.createObjectURL(new Blob([t],{type:`${n};charset=utf-8`})),i=document.createElement(`a`);i.href=r,i.download=e,document.body.append(i),i.click(),i.remove(),URL.revokeObjectURL(r)}var JJ=[{id:`overview`,label:`Overview`,sub:`Calls, latency & risk at a glance`},{id:`devices`,label:`Devices`,sub:`Connectivity radar & system health`},{id:`topology`,label:`Topology`,sub:`Layer-2 neighbours via MNDP / CDP / LLDP`},{id:`packets`,label:`Packets`,sub:`Live TZSP capture & decode`},{id:`snapshots`,label:`Snapshots`,sub:`Config history & time-travel diff`},{id:`plan`,label:`Change Plan`,sub:`Dry-run intended RouterOS commands`},{id:`s3`,label:`S3 Backups`,sub:`List, download & delete S3 backup objects`},{id:`backups`,label:`Backups`,sub:`Local config vault — create, restore, manage`},{id:`config`,label:`Config`,sub:`Effective configuration & safe editor`},{id:`feed`,label:`Live Feed`,sub:`Every tool call, in real time`}],YJ=[`#ededed`,`#a1a1a1`],XJ={overview:YJ,devices:YJ,topology:YJ,packets:YJ,snapshots:YJ,plan:YJ,s3:YJ,backups:YJ,config:YJ,feed:YJ},ZJ={overview:{what:`A live pulse of all MCP tool activity: total calls, error rate, p50/p95 latency, the busiest tools, and a risk breakdown — over a time window you choose.`,tips:[`Change the time window (top-right) to zoom from the last 5 minutes out to 24 hours.`,`The risk donut splits calls by annotation: read · write · destructive · dangerous.`,`A rising error line usually points at one device or one tool — jump to Live Feed to see which.`]},devices:{what:`Every configured router with its live reachability (SSH or MAC-Telnet), latency, identity, and system health — CPU, memory and disk — refreshed continuously.`,tips:[`Each device gets a stable colour so you can track it across the connectivity radar.`,`Health (CPU/Mem/Disk) is probed periodically; MAC-Telnet devices are probed on a slower cadence.`,`Latency tiers are colour-coded green → amber → red; a grey node is currently unreachable.`]},topology:{what:`A Layer-2 map of neighbours each router discovers via MNDP / CDP / LLDP — the physical adjacency of your network, drawn live.`,tips:[`Solid nodes are configured devices; faint nodes are discovered-but-unmanaged neighbours.`,`Use “Add to config →” on an unmanaged neighbour to pre-fill it in the Config editor.`,`Drag to pan; the layout settles automatically as new neighbours arrive.`]},packets:{what:`Live packet capture streamed from a router over TZSP — decode headers in real time without leaving the dashboard.`,tips:[`Pick a device and start the capture; packets decode as they arrive.`,`Stop the capture when done — it frees the router-side sniffer.`,`Great for debugging a protocol issue alongside the Live Feed of tool calls.`]},snapshots:{what:`Point-in-time captures of a device’s full configuration (/export), stored locally so you can diff any two and see exactly what changed.`,tips:[`Capture a snapshot before a risky change, then diff after to audit the delta.`,`The diff is line-level: green added, red removed.`,`Snapshots are device config exports — for the dashboard’s OWN config history see the Config page.`]},plan:{what:`Dry-run the exact RouterOS commands a change would run before it touches a device — a change plan you can review and trust.`,tips:[`Paste or build intended commands to see them validated and ordered.`,`Nothing is sent to the device from here — it’s a preview.`,`Pair with Safe Mode (auto-revert) when you do apply for real.`]},s3:{what:`Browse, download, and delete backup objects in your configured S3-compatible bucket — your off-box archive of device backups and exports.`,tips:[`Filter by key prefix to find a device’s backups quickly.`,`Download fetches the object through a presigned URL; delete is permanent.`,`For host-side .rsc backups instead, use the Backups page.`]},backups:{what:`A local config vault on the MCP server: capture a device’s /export as a timestamped .rsc file, then download, upload, rename, restore (via Safe Mode), or delete it.`,tips:[`Restore offers a dry-run (applies then rolls back) before you commit for real.`,`Edit the vault path inline in the header — it’s saved to your config.`,`Filenames are stamped in the device’s local 24-hour clock.`]},config:{what:`View the effective configuration, edit it safely with schema-aware validation and auto-rollback, browse a full field guide, and travel through config version history.`,tips:[`Every successful apply is auto-saved to the version timeline — restore any point in time.`,`Save a named checkpoint before a big change for an easy, labelled rollback.`,`The Field Guide documents every config option, its type, and default — straight from the schema.`]},feed:{what:`Every tool call as it happens — tool, device, risk, duration, and success/error — with full request/response detail on click.`,tips:[`Filter by status to isolate failures, or by tool/device to follow one thread.`,`Click any row to open the full (secret-redacted) request and response.`,`Pause the stream when you want to inspect without rows shifting under you.`]}};function QJ({view:e}){let t=ZJ[e];return(0,$.jsxs)(`div`,{className:`pagehelp reveal`,role:`region`,"aria-label":`Page help`,children:[(0,$.jsx)(`div`,{className:`pagehelp__icon`,"aria-hidden":`true`,children:`?`}),(0,$.jsxs)(`div`,{className:`pagehelp__body`,children:[(0,$.jsx)(`p`,{className:`pagehelp__what`,children:t.what}),(0,$.jsx)(`ul`,{className:`pagehelp__tips`,children:t.tips.map((e,t)=>(0,$.jsx)(`li`,{children:e},t))})]})]})}function $J({name:e}){return(0,$.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.7`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:{overview:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`rect`,{x:`3`,y:`3`,width:`8`,height:`8`,rx:`1.6`}),(0,$.jsx)(`rect`,{x:`13`,y:`3`,width:`8`,height:`5`,rx:`1.6`}),(0,$.jsx)(`rect`,{x:`13`,y:`10`,width:`8`,height:`11`,rx:`1.6`}),(0,$.jsx)(`rect`,{x:`3`,y:`13`,width:`8`,height:`8`,rx:`1.6`})]}),devices:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`7`,rx:`2`}),(0,$.jsx)(`rect`,{x:`3`,y:`13`,width:`18`,height:`7`,rx:`2`}),(0,$.jsx)(`path`,{d:`M7 7.5h.01M7 16.5h.01`})]}),topology:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`circle`,{cx:`12`,cy:`5`,r:`2.4`}),(0,$.jsx)(`circle`,{cx:`5`,cy:`19`,r:`2.4`}),(0,$.jsx)(`circle`,{cx:`19`,cy:`19`,r:`2.4`}),(0,$.jsx)(`path`,{d:`M12 7.4 6.4 16.6M12 7.4 17.6 16.6`})]}),packets:(0,$.jsx)(`path`,{d:`M3 12h4l2-7 4 14 2-7h6`}),snapshots:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`path`,{d:`M12 3 3 7.5 12 12 21 7.5 12 3Z`}),(0,$.jsx)(`path`,{d:`M3 12 12 16.5 21 12`}),(0,$.jsx)(`path`,{d:`M3 16.5 12 21 21 16.5`})]}),plan:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`circle`,{cx:`6`,cy:`6`,r:`2.3`}),(0,$.jsx)(`circle`,{cx:`6`,cy:`18`,r:`2.3`}),(0,$.jsx)(`circle`,{cx:`18`,cy:`8`,r:`2.3`}),(0,$.jsx)(`path`,{d:`M6 8.3v7.4M8.3 6H13a3 3 0 0 1 3 3v0`})]}),s3:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`ellipse`,{cx:`12`,cy:`6`,rx:`7`,ry:`2.6`}),(0,$.jsx)(`path`,{d:`M5 6v12c0 1.5 3.1 2.6 7 2.6s7-1.1 7-2.6V6`}),(0,$.jsx)(`path`,{d:`M5 12c0 1.5 3.1 2.6 7 2.6s7-1.1 7-2.6`})]}),backups:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`path`,{d:`M3 6.5 5 3.5h14l2 3`}),(0,$.jsx)(`rect`,{x:`3`,y:`6.5`,width:`18`,height:`14`,rx:`2`}),(0,$.jsx)(`path`,{d:`M9.5 12h5`})]}),config:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`path`,{d:`M4 7h8M16 7h4M4 17h4M12 17h8`}),(0,$.jsx)(`circle`,{cx:`14`,cy:`7`,r:`2.2`}),(0,$.jsx)(`circle`,{cx:`10`,cy:`17`,r:`2.2`})]}),feed:(0,$.jsx)(`path`,{d:`M4 6h16M4 12h16M4 18h10`})}[e]})}function eY(){let[e,t]=(0,v.useState)(null),[n,r]=(0,v.useState)(null),[i,a]=(0,v.useState)(null),[o,s]=(0,v.useState)(null),[c,l]=(0,v.useState)(null),[u,d]=(0,v.useState)(!1),[f,p]=(0,v.useState)(null),[m,h]=(0,v.useState)([]),[g,_]=(0,v.useState)(36e5),[y,b]=(0,v.useState)(!1),[x,S]=(0,v.useState)(`off`),[C,w]=(0,v.useState)(null),[T,E]=(0,v.useState)(()=>new Set),[D,O]=(0,v.useState)({}),[k,A]=(0,v.useState)({tool:``,risk:``,device:``,status:``,q:``}),j=(0,v.useRef)(y);j.current=y;let M=(0,v.useRef)(null);TJ(M);let[N,P]=(0,v.useState)(`overview`),[F,I]=(0,v.useState)(()=>{try{let e=localStorage.getItem(`mt-help-open`);return new Set(e?JSON.parse(e):[])}catch{return new Set}}),L=e=>I(t=>{let n=new Set(t);n.has(e)?n.delete(e):n.add(e);try{localStorage.setItem(`mt-help-open`,JSON.stringify([...n]))}catch{}return n}),[ee,te]=(0,v.useState)(``),[R,z]=(0,v.useState)(`all`),B=(0,v.useMemo)(()=>{let e=i?.devices??[];return{online:e.filter(e=>e.status.reachable===!0).length,offline:e.filter(e=>e.status.reachable===!1).length,total:e.length}},[i]),V=(0,v.useMemo)(()=>{let e=i?.devices??[],t=ee.trim().toLowerCase();return e.filter(e=>!(R===`online`&&e.status.reachable!==!0||R===`offline`&&e.status.reachable!==!1||t&&!e.name.toLowerCase().includes(t)&&!(e.address??e.host??``).toLowerCase().includes(t)))},[i,ee,R]);wJ((0,v.useCallback)(e=>{if(j.current)return;h(t=>[e,...t].slice(0,oJ));let t=e.device;t&&O(e=>({...e,[t]:(e[t]??0)+1}))},[]),(0,v.useCallback)(e=>S(e),[])),(0,v.useEffect)(()=>{uc(`/api/events?limit=200`).then(e=>h(e.events)).catch(()=>{})},[]);let H=(0,v.useCallback)(()=>{uc(`/api/stats?window=${g}&buckets=60`).then(t).catch(()=>{})},[g]);(0,v.useEffect)(()=>{H();let e=()=>{H(),uc(`/api/meta`).then(r).catch(()=>{}),uc(`/api/devices`).then(a).catch(()=>{}),uc(`/api/topology`).then(s).catch(()=>{})};e();let t=setInterval(()=>{j.current||e()},4e3);return()=>clearInterval(t)},[H]),(0,v.useEffect)(()=>{let e=()=>void uc(`/api/config`).then(l).catch(()=>{});e();let t=setInterval(e,3e4);return()=>clearInterval(t)},[]),(0,v.useEffect)(()=>{let e=e=>{e.key===`Escape`&&w(null)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let ne=(0,v.useMemo)(()=>{let e=k.q.trim().toLowerCase();return m.filter(t=>!(k.tool&&t.tool!==k.tool||k.risk&&t.risk!==k.risk||k.device&&t.device!==k.device||k.status===`ok`&&t.isError||k.status===`error`&&!t.isError||e&&!t.tool.toLowerCase().includes(e)&&!t.input.toLowerCase().includes(e)&&!t.output.toLowerCase().includes(e)&&!(t.error??``).toLowerCase().includes(e))).sort((e,t)=>t.ts-e.ts)},[m,k]),re=!!(k.tool||k.risk||k.device||k.status||k.q),ie=(0,v.useMemo)(()=>m.filter(e=>e.isError),[m]),ae=(0,v.useMemo)(()=>({ok:m.length-ie.length,error:ie.length}),[m,ie]),oe=(0,v.useCallback)(async e=>{try{w(await uc(`/api/event/${encodeURIComponent(e.id)}`))}catch{w(e)}},[]),U=(0,v.useMemo)(()=>ne.slice(0,200),[ne]),se=(0,v.useMemo)(()=>U.map(e=>e.id),[U]),ce=se.length>0&&se.every(e=>T.has(e)),le=!ce&&se.some(e=>T.has(e)),ue=(0,v.useCallback)(e=>{E(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),de=(0,v.useCallback)(()=>{E(e=>{let t=new Set(e);if(se.length>0&&se.every(e=>t.has(e)))for(let e of se)t.delete(e);else for(let e of se)t.add(e);return t})},[se]),[fe,pe]=(0,v.useState)(!1),me=(0,v.useCallback)(async()=>{let e=[...T];if(e.length!==0)try{await fc({ids:e});let t=new Set(e);h(e=>e.filter(e=>!t.has(e.id))),E(new Set)}catch{}finally{pe(!1)}},[T]),he=e=>{if(e===`json`){qJ(`mcp-events.json`,JSON.stringify(ne,null,2),`application/json`);return}let t=[`ts`,`tool`,`risk`,`device`,`durationMs`,`isError`,`error`],n=e=>/[",\n]/.test(e)?`"${e.replace(/"/g,`""`)}"`:e,r=ne.map(e=>[new Date(e.ts).toISOString(),e.tool,e.risk,e.device??``,String(e.durationMs),String(e.isError),e.error??``].map(n).join(`,`)).join(`
|
|
80
|
+
/ip address remove [find address=192.168.88.1/24]`,value:e,onChange:e=>t(e.target.value)}),(0,$.jsxs)(`div`,{className:`toolbar`,style:{marginTop:10},children:[(0,$.jsx)(`button`,{className:`btn is-active`,onClick:()=>void c(),disabled:o||!e.trim(),children:o?`Planning…`:`▸ Plan`}),i&&(0,$.jsx)(`span`,{className:`cfg-err`,children:i})]})]}),n&&(0,$.jsxs)(sJ,{title:`Plan`,className:`reveal`,extra:(0,$.jsxs)(`span`,{className:`cfg-status ${u?`is-bad`:`is-ok`}`,children:[`risk `,n.plan.riskScore,` · `,l]}),children:[(0,$.jsxs)(`div`,{className:`legend`,style:{marginTop:0},children:[(0,$.jsxs)(`span`,{children:[`+`,n.plan.counts.add,` to add`]}),(0,$.jsxs)(`span`,{children:[`~`,n.plan.counts.modify,` to modify`]}),(0,$.jsxs)(`span`,{children:[`-`,n.plan.counts.remove,` to remove`]}),n.plan.reordered&&(0,$.jsx)(`span`,{children:`· reordered into a safe sequence`})]}),n.plan.warnings.length>0&&(0,$.jsx)(`div`,{className:`cfg-errors`,style:{margin:`10px 0`},children:n.plan.warnings.map((e,t)=>(0,$.jsxs)(`div`,{className:`cfg-err`,style:{color:`var(--mt-warn)`},children:[`⚠ `,e]},t))}),(0,$.jsx)(`div`,{className:`plan-steps`,children:n.plan.steps.map(e=>(0,$.jsxs)(`div`,{className:`plan-step risk-${e.risk}`,children:[(0,$.jsx)(`span`,{className:`plan-op`,children:BJ[e.op]??`•`}),(0,$.jsx)(`code`,{children:e.command}),e.lockoutRisk&&(0,$.jsx)(`span`,{className:`plan-lock`,children:`⚠ lock-out`}),(0,$.jsx)(`span`,{className:`plan-risk`,children:e.risk})]},e.index))})]})]})}function HJ(){let[e,t]=(0,v.useState)(null),[n,r]=(0,v.useState)(null),[i,a]=(0,v.useState)(null),[o,s]=(0,v.useState)(null),c=(0,v.useCallback)(()=>{uc(`/api/s3/list`).then(t).catch(()=>t({configured:!1,objects:[]}))},[]);(0,v.useEffect)(()=>c(),[c]);let l=e=>{uc(`/api/s3/presign?key=${encodeURIComponent(e)}`).then(e=>{e.url?window.open(e.url,`_blank`,`noopener`):s(`could not generate download link`)}).catch(()=>s(`could not generate download link`))},u=async e=>{a(e);let t=await dc(`/api/s3/delete`,{key:e}).catch(()=>({error:`request failed`}));a(null),r(null),t.ok?(s(`Deleted ${e}`),c()):s(t.error??`delete failed`)};return e?e.configured?(0,$.jsx)(`section`,{className:`view`,children:(0,$.jsxs)(sJ,{title:`S3 backups`,className:`reveal`,extra:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`span`,{className:`muted`,children:[e.target,` · `,e.objects.length,` object`,e.objects.length===1?``:`s`,e.truncated?` (truncated)`:``]}),(0,$.jsx)(`button`,{className:`btn`,onClick:c,style:{marginLeft:10},children:`↻ Refresh`})]}),children:[o&&(0,$.jsx)(`div`,{className:`cfg-msg`,children:o}),e.objects.length===0?(0,$.jsxs)(`div`,{className:`muted`,style:{padding:12},children:[`No objects in the bucket. Upload one with the `,(0,$.jsx)(`code`,{children:`upload_backup_to_s3`}),` tool.`]}):(0,$.jsx)(`div`,{className:`feedwrap`,children:(0,$.jsxs)(`table`,{className:`feed`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{children:`key`}),(0,$.jsx)(`th`,{className:`num`,children:`size`}),(0,$.jsx)(`th`,{children:`modified`}),(0,$.jsx)(`th`,{style:{width:200},children:`actions`})]})}),(0,$.jsx)(`tbody`,{children:e.objects.map(e=>(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`td`,{children:e.key}),(0,$.jsx)(`td`,{className:`num`,children:eJ(e.size)}),(0,$.jsx)(`td`,{children:e.lastModified?new Date(e.lastModified).toLocaleString(void 0,{hour12:!1}):`—`}),(0,$.jsxs)(`td`,{onClick:e=>e.stopPropagation(),children:[(0,$.jsx)(`button`,{className:`btn`,onClick:()=>l(e.key),children:`⤓ Download`}),` `,n===e.key?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`button`,{className:`btn btn-danger`,disabled:i===e.key,onClick:()=>void u(e.key),children:`✓ Confirm`}),` `,(0,$.jsx)(`button`,{className:`btn`,onClick:()=>r(null),children:`Cancel`})]}):(0,$.jsx)(`button`,{className:`btn`,onClick:()=>r(e.key),children:`🗑 Delete`})]})]},e.key))})]})})]})}):(0,$.jsxs)(`div`,{className:`feed-empty`,children:[(0,$.jsx)(`div`,{className:`feed-empty__icon`,children:`☁️`}),(0,$.jsx)(`p`,{className:`feed-empty__title`,children:`S3 is not configured`}),(0,$.jsxs)(`p`,{className:`feed-empty__sub`,children:[`Add an `,(0,$.jsx)(`code`,{children:`s3`}),` block (bucket + credentials) to your config to manage backup objects here.`]})]}):(0,$.jsx)(`div`,{className:`muted`,children:`loading S3 objects…`})}function UJ(){let[e,t]=(0,v.useState)(null),[n,r]=(0,v.useState)(null),[i,a]=(0,v.useState)(!1),[o,s]=(0,v.useState)(null),[c,l]=(0,v.useState)(null),[u,d]=(0,v.useState)(null),[f,p]=(0,v.useState)(``),[m,h]=(0,v.useState)(null),[g,_]=(0,v.useState)(null),y=(0,v.useRef)(null),b=(0,v.useCallback)(()=>{uc(`/api/backups`).then(e=>{t(e),p(t=>t||e.devices[0]||``)}).catch(()=>t({dir:``,devices:[],backups:[]}))},[]);(0,v.useEffect)(()=>b(),[b]);let x=(e,t)=>dc(e,t).catch(()=>({error:`request failed`})),S=async()=>{a(!0),r(`Capturing /export…`);let e=await dc(`/api/backups/create`,{device:f||void 0}).catch(()=>({error:`request failed`}));a(!1),r(e.ok?`Created ${e.name} (${e.bytes} bytes)`:`Create failed: ${e.error}`),e.ok&&b()},C=async e=>{let t=await e.text(),n=await x(`/api/backups/upload`,{name:e.name,content:t});r(n.ok?`Uploaded ${n.name}`:`Upload failed: ${n.error}`),n.ok&&b()},w=async e=>{s(null);let t=await x(`/api/backups/delete`,{name:e});r(t.ok?`Deleted ${e}`:`Delete failed: ${t.error}`),t.ok&&b()},T=async()=>{if(!u)return;let{name:e,value:t}=u;if(d(null),!t||t===e)return;let n=await x(`/api/backups/rename`,{name:e,new_name:t});r(n.ok?`Renamed to ${n.name}`:`Rename failed: ${n.error}`),n.ok&&b()},E=async e=>{if(!c)return;a(!0),r(e?`Restoring in Safe Mode…`:`Dry-run restore in Safe Mode…`);let t=await dc(`/api/backups/restore`,{name:c,device:f||void 0,confirm:e}).catch(()=>({ok:!1,message:`request failed`}));a(!1),r(t.ok?t.committed?`Restored ${c} → ${f}: ${t.message}`:`Dry-run OK (${t.applied} cmds, rolled back). Click “Restore (commit)” to apply for real.`:`Restore failed: ${t.message}`),t.ok&&e&&l(null)},D=e=>{uc(`/api/backups/get?name=${encodeURIComponent(e)}`).then(h).catch(()=>{})},O=async()=>{if(g===null)return;let t=g.trim();if(!t||t===e?.dir){_(null);return}a(!0);let n=await dc(`/api/backups/dir`,{dir:t}).catch(()=>({error:`request failed`}));a(!1),_(null),n.ok?r(n.persisted?`Backup path saved → ${n.dir}`:n.warning??`Path applied → ${n.dir}`):r(`Path change failed: ${n.error}`),n.ok&&b()};return e?(0,$.jsxs)(`section`,{className:`view`,children:[(0,$.jsxs)(sJ,{title:`Local backup vault`,className:`reveal`,extra:g===null?(0,$.jsxs)(`span`,{className:`muted backup-path`,children:[(0,$.jsx)(`span`,{title:e.dir,children:e.dir}),(0,$.jsx)(`button`,{className:`linkish`,title:`Change backup directory`,onClick:()=>_(e.dir),children:`✎ edit path`})]}):(0,$.jsxs)(`span`,{className:`backup-path`,children:[(0,$.jsx)(`input`,{className:`backup-path-input`,value:g,autoFocus:!0,spellCheck:!1,placeholder:`~/.mikrotik-mcp/backups`,onChange:e=>_(e.target.value),onKeyDown:e=>{e.key===`Enter`&&O(),e.key===`Escape`&&_(null)}}),(0,$.jsx)(`button`,{className:`topo-btn cfg-save`,onClick:()=>void O(),disabled:i,children:`Save path`}),(0,$.jsx)(`button`,{className:`topo-btn`,onClick:()=>_(null),children:`Cancel`})]}),children:[n&&(0,$.jsx)(`div`,{className:`cfg-msg`,children:n}),(0,$.jsxs)(`div`,{className:`toolbar`,style:{marginBottom:12},children:[(0,$.jsxs)(`select`,{className:`btn`,value:f,onChange:e=>p(e.target.value),children:[e.devices.length===0&&(0,$.jsx)(`option`,{value:``,children:`no devices`}),e.devices.map(e=>(0,$.jsx)(`option`,{value:e,children:e},e))]}),(0,$.jsx)(`button`,{className:`btn is-active`,onClick:()=>void S(),disabled:i||!f,children:`⤓ Create backup`}),(0,$.jsx)(`button`,{className:`btn`,onClick:()=>y.current?.click(),children:`⤒ Upload .rsc`}),(0,$.jsx)(`input`,{ref:y,type:`file`,accept:`.rsc,text/plain`,style:{display:`none`},onChange:e=>{let t=e.target.files?.[0];t&&C(t),e.currentTarget.value=``}}),(0,$.jsx)(`button`,{className:`btn`,onClick:b,children:`↻ Refresh`})]}),c&&(0,$.jsxs)(`div`,{className:`cfg-banner`,style:{marginBottom:12},children:[(0,$.jsxs)(`strong`,{children:[`Restore `,c]}),` onto`,` `,(0,$.jsx)(`select`,{className:`cfg-select`,value:f,onChange:e=>p(e.target.value),children:e.devices.map(e=>(0,$.jsx)(`option`,{value:e,children:e},e))}),` `,`via Safe Mode (auto-reverts on lock-out).`,(0,$.jsx)(`span`,{style:{flex:1}}),(0,$.jsx)(`button`,{className:`topo-btn`,onClick:()=>void E(!1),disabled:i,children:`Dry-run`}),(0,$.jsx)(`button`,{className:`topo-btn cfg-save`,onClick:()=>void E(!0),disabled:i,children:`Restore (commit)`}),(0,$.jsx)(`button`,{className:`topo-btn`,onClick:()=>l(null),children:`Cancel`})]}),e.backups.length===0?(0,$.jsx)(`div`,{className:`muted`,style:{padding:12},children:"No backups yet. Click “Create backup” to capture this device’s config, or upload a `.rsc`."}):(0,$.jsx)(`div`,{className:`feedwrap`,children:(0,$.jsxs)(`table`,{className:`feed`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{children:`name`}),(0,$.jsx)(`th`,{children:`device`}),(0,$.jsx)(`th`,{className:`num`,children:`size`}),(0,$.jsx)(`th`,{children:`captured`}),(0,$.jsx)(`th`,{style:{width:280},children:`actions`})]})}),(0,$.jsx)(`tbody`,{children:e.backups.map(e=>(0,$.jsxs)(`tr`,{className:m?.name===e.name?`is-selected`:void 0,children:[(0,$.jsx)(`td`,{children:e.name}),(0,$.jsx)(`td`,{children:e.device??`—`}),(0,$.jsx)(`td`,{className:`num`,children:eJ(e.bytes)}),(0,$.jsx)(`td`,{children:new Date(e.modified).toLocaleString(void 0,{hour12:!1})}),(0,$.jsxs)(`td`,{onClick:e=>e.stopPropagation(),children:[(0,$.jsx)(`button`,{className:`btn`,onClick:()=>D(e.name),children:`view`}),` `,(0,$.jsx)(`a`,{className:`btn`,href:lc(`/api/backups/raw?name=${encodeURIComponent(e.name)}`),download:e.name,children:`⤓`}),` `,u?.name===e.name?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`input`,{className:`search`,style:{display:`inline-block`,width:150},value:u.value,autoFocus:!0,onChange:t=>d({name:e.name,value:t.target.value}),onKeyDown:e=>e.key===`Enter`&&void T()}),` `,(0,$.jsx)(`button`,{className:`btn cfg-save`,onClick:()=>void T(),children:`✓`}),` `,(0,$.jsx)(`button`,{className:`btn`,onClick:()=>d(null),children:`✕`}),` `]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`button`,{className:`btn`,onClick:()=>d({name:e.name,value:e.name}),children:`rename`}),` `,(0,$.jsx)(`button`,{className:`btn cfg-save`,onClick:()=>l(e.name),children:`restore`}),` `]}),o===e.name?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`button`,{className:`btn btn-danger`,onClick:()=>void w(e.name),children:`✓`}),` `,(0,$.jsx)(`button`,{className:`btn`,onClick:()=>s(null),children:`✕`})]}):(0,$.jsx)(`button`,{className:`btn`,onClick:()=>s(e.name),children:`🗑`})]})]},e.name))})]})})]}),m&&(0,$.jsx)(sJ,{title:`Backup · ${m.name}`,className:`reveal`,extra:(0,$.jsx)(Jq,{type:`secondary`,size:`sm`,onClick:()=>h(null),children:`✕ Close`}),children:(0,$.jsx)(`pre`,{className:`body`,style:{maxHeight:460},children:m.content||`(empty)`})})]}):(0,$.jsx)(`div`,{className:`muted`,children:`loading backups…`})}function WJ(){return(0,$.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,$.jsx)(`rect`,{x:`9`,y:`9`,width:`11`,height:`11`,rx:`2`}),(0,$.jsx)(`path`,{d:`M6 15H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v1`})]})}function GJ({text:e,label:t=`Copy`,className:n=`btn`,icon:r=!1,title:i}){let[a,o]=(0,v.useState)(!1),s=(0,v.useRef)(null);return(0,v.useEffect)(()=>()=>void(s.current&&clearTimeout(s.current)),[]),(0,$.jsxs)(`button`,{type:`button`,className:`copybtn ${n}${r?` copybtn--icon`:``}${a?` is-copied`:``}`,onClick:()=>{navigator.clipboard?.writeText(e).then(()=>{o(!0),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>o(!1),1400)},()=>{})},title:i??`Copy to clipboard`,"aria-label":i??`Copy to clipboard`,children:[r?(0,$.jsx)(WJ,{}):t,(0,$.jsx)(`span`,{className:`copybtn__tip`,role:`status`,"aria-live":`polite`,children:`Copied!`})]})}function KJ({event:e,onClose:t}){return(0,$.jsx)(`div`,{className:`overlay`,onClick:e=>e.target===e.currentTarget&&t(),children:(0,$.jsxs)(`div`,{className:`sheet`,children:[(0,$.jsxs)(`div`,{className:`sheet__hd`,children:[(0,$.jsx)(`span`,{className:`risk risk-${e.risk}`,children:e.risk}),(0,$.jsxs)(`h3`,{className:`sheet__tool`,children:[e.tool,(0,$.jsx)(GJ,{text:e.tool,className:`iconbtn`,icon:!0,title:`Copy tool name`})]}),(0,$.jsx)(`span`,{style:{flex:1}}),(0,$.jsx)(Jq,{type:`secondary`,size:`sm`,onClick:t,children:`✕ Close`})]}),(0,$.jsxs)(`div`,{className:`kv__body`,children:[(0,$.jsx)(`div`,{className:`kv__k`,children:`title`}),(0,$.jsx)(`div`,{className:`kv__v`,children:e.title}),(0,$.jsx)(`div`,{className:`kv__k`,children:`time`}),(0,$.jsx)(`div`,{className:`kv__v`,children:new Date(e.ts).toLocaleString(void 0,{hour12:!1})}),(0,$.jsx)(`div`,{className:`kv__k`,children:`device`}),(0,$.jsx)(`div`,{className:`kv__v`,children:e.device??`—`}),(0,$.jsx)(`div`,{className:`kv__k`,children:`transport`}),(0,$.jsx)(`div`,{className:`kv__v`,children:e.transport??`—`}),(0,$.jsx)(`div`,{className:`kv__k`,children:`duration`}),(0,$.jsx)(`div`,{className:`kv__v`,children:$q(e.durationMs)}),(0,$.jsx)(`div`,{className:`kv__k`,children:`status`}),(0,$.jsx)(`div`,{className:`kv__v`,children:(0,$.jsx)(`span`,{className:e.isError?`status-err`:`status-ok`,children:e.isError?`error`:`ok`})}),(0,$.jsx)(`div`,{className:`kv__k`,children:`output size`}),(0,$.jsxs)(`div`,{className:`kv__v`,children:[eJ(e.outputBytes),e.truncated?` (truncated)`:``]}),(0,$.jsx)(`div`,{className:`kv__k`,children:`structured`}),(0,$.jsx)(`div`,{className:`kv__v`,children:e.hasStructured?`yes (renders an MCP App view)`:`no`})]}),e.error&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`h2`,{className:`muted`,children:`ERROR`}),(0,$.jsx)(`pre`,{className:`body`,style:{color:`var(--mt-bad)`},children:e.error})]}),(0,$.jsxs)(`div`,{className:`sheet__hd`,children:[(0,$.jsx)(`h2`,{className:`muted`,style:{margin:0},children:`INPUT`}),(0,$.jsx)(`span`,{style:{flex:1}}),(0,$.jsx)(GJ,{text:e.input,title:`Copy input JSON`})]}),e.input?(0,$.jsx)(RJ,{value:e.input}):(0,$.jsx)(`pre`,{className:`body`,children:`—`}),(0,$.jsxs)(`div`,{className:`sheet__hd`,children:[(0,$.jsx)(`h2`,{className:`muted`,style:{margin:0},children:`OUTPUT`}),(0,$.jsx)(`span`,{style:{flex:1}}),(0,$.jsx)(GJ,{text:e.output,title:`Copy output`})]}),(0,$.jsx)(`pre`,{className:`body`,children:e.output||`—`})]})})}function qJ(e,t,n){let r=URL.createObjectURL(new Blob([t],{type:`${n};charset=utf-8`})),i=document.createElement(`a`);i.href=r,i.download=e,document.body.append(i),i.click(),i.remove(),URL.revokeObjectURL(r)}var JJ=[{id:`overview`,label:`Overview`,sub:`Calls, latency & risk at a glance`},{id:`devices`,label:`Devices`,sub:`Connectivity radar & system health`},{id:`topology`,label:`Topology`,sub:`Layer-2 neighbours via MNDP / CDP / LLDP`},{id:`packets`,label:`Packets`,sub:`Live TZSP capture & decode`},{id:`snapshots`,label:`Snapshots`,sub:`Config history & time-travel diff`},{id:`plan`,label:`Change Plan`,sub:`Dry-run intended RouterOS commands`},{id:`s3`,label:`S3 Backups`,sub:`List, download & delete S3 backup objects`},{id:`backups`,label:`Backups`,sub:`Local config vault — create, restore, manage`},{id:`config`,label:`Config`,sub:`Effective configuration & safe editor`},{id:`feed`,label:`Live Feed`,sub:`Every tool call, in real time`}],YJ=[`#ededed`,`#a1a1a1`],XJ={overview:YJ,devices:YJ,topology:YJ,packets:YJ,snapshots:YJ,plan:YJ,s3:YJ,backups:YJ,config:YJ,feed:YJ},ZJ={overview:{what:`A live pulse of all MCP tool activity: total calls, error rate, p50/p95 latency, the busiest tools, and a risk breakdown — over a time window you choose.`,tips:[`Change the time window (top-right) to zoom from the last 5 minutes out to 24 hours.`,`The risk donut splits calls by annotation: read · write · destructive · dangerous.`,`A rising error line usually points at one device or one tool — jump to Live Feed to see which.`]},devices:{what:`Every configured router with its live reachability (SSH or MAC-Telnet), latency, identity, and system health — CPU, memory and disk — refreshed continuously.`,tips:[`Each device gets a stable colour so you can track it across the connectivity radar.`,`Health (CPU/Mem/Disk) is probed periodically; MAC-Telnet devices are probed on a slower cadence.`,`Latency tiers are colour-coded green → amber → red; a grey node is currently unreachable.`]},topology:{what:`A Layer-2 map of neighbours each router discovers via MNDP / CDP / LLDP — the physical adjacency of your network, drawn live.`,tips:[`Solid nodes are configured devices; faint nodes are discovered-but-unmanaged neighbours.`,`Use “Add to config →” on an unmanaged neighbour to pre-fill it in the Config editor.`,`Drag to pan; the layout settles automatically as new neighbours arrive.`]},packets:{what:`Live packet capture streamed from a router over TZSP — decode headers in real time without leaving the dashboard.`,tips:[`Pick a device and start the capture; packets decode as they arrive.`,`Stop the capture when done — it frees the router-side sniffer.`,`Great for debugging a protocol issue alongside the Live Feed of tool calls.`]},snapshots:{what:`Point-in-time captures of a device’s full configuration (/export), stored locally so you can diff any two and see exactly what changed.`,tips:[`Capture a snapshot before a risky change, then diff after to audit the delta.`,`The diff is line-level: green added, red removed.`,`Snapshots are device config exports — for the dashboard’s OWN config history see the Config page.`]},plan:{what:`Dry-run the exact RouterOS commands a change would run before it touches a device — a change plan you can review and trust.`,tips:[`Paste or build intended commands to see them validated and ordered.`,`Nothing is sent to the device from here — it’s a preview.`,`Pair with Safe Mode (auto-revert) when you do apply for real.`]},s3:{what:`Browse, download, and delete backup objects in your configured S3-compatible bucket — your off-box archive of device backups and exports.`,tips:[`Filter by key prefix to find a device’s backups quickly.`,`Download fetches the object through a presigned URL; delete is permanent.`,`For host-side .rsc backups instead, use the Backups page.`]},backups:{what:`A local config vault on the MCP server: capture a device’s /export as a timestamped .rsc file, then download, upload, rename, restore (via Safe Mode), or delete it.`,tips:[`Restore offers a dry-run (applies then rolls back) before you commit for real.`,`Edit the vault path inline in the header — it’s saved to your config.`,`Filenames are stamped in the device’s local 24-hour clock.`]},config:{what:`View the effective configuration, edit it safely with schema-aware validation and auto-rollback, browse a full field guide, and travel through config version history.`,tips:[`Every successful apply is auto-saved to the version timeline — restore any point in time.`,`Save a named checkpoint before a big change for an easy, labelled rollback.`,`The Field Guide documents every config option, its type, and default — straight from the schema.`]},feed:{what:`Every tool call as it happens — tool, device, risk, duration, and success/error — with full request/response detail on click.`,tips:[`Filter by status to isolate failures, or by tool/device to follow one thread.`,`Click any row to open the full (secret-redacted) request and response.`,`Pause the stream when you want to inspect without rows shifting under you.`]}};function QJ({view:e}){let t=ZJ[e];return(0,$.jsxs)(`div`,{className:`pagehelp reveal`,role:`region`,"aria-label":`Page help`,children:[(0,$.jsx)(`div`,{className:`pagehelp__icon`,"aria-hidden":`true`,children:`?`}),(0,$.jsxs)(`div`,{className:`pagehelp__body`,children:[(0,$.jsx)(`p`,{className:`pagehelp__what`,children:t.what}),(0,$.jsx)(`ul`,{className:`pagehelp__tips`,children:t.tips.map((e,t)=>(0,$.jsx)(`li`,{children:e},t))})]})]})}function $J({name:e}){return(0,$.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.7`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:{overview:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`rect`,{x:`3`,y:`3`,width:`8`,height:`8`,rx:`1.6`}),(0,$.jsx)(`rect`,{x:`13`,y:`3`,width:`8`,height:`5`,rx:`1.6`}),(0,$.jsx)(`rect`,{x:`13`,y:`10`,width:`8`,height:`11`,rx:`1.6`}),(0,$.jsx)(`rect`,{x:`3`,y:`13`,width:`8`,height:`8`,rx:`1.6`})]}),devices:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`7`,rx:`2`}),(0,$.jsx)(`rect`,{x:`3`,y:`13`,width:`18`,height:`7`,rx:`2`}),(0,$.jsx)(`path`,{d:`M7 7.5h.01M7 16.5h.01`})]}),topology:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`circle`,{cx:`12`,cy:`5`,r:`2.4`}),(0,$.jsx)(`circle`,{cx:`5`,cy:`19`,r:`2.4`}),(0,$.jsx)(`circle`,{cx:`19`,cy:`19`,r:`2.4`}),(0,$.jsx)(`path`,{d:`M12 7.4 6.4 16.6M12 7.4 17.6 16.6`})]}),packets:(0,$.jsx)(`path`,{d:`M3 12h4l2-7 4 14 2-7h6`}),snapshots:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`path`,{d:`M12 3 3 7.5 12 12 21 7.5 12 3Z`}),(0,$.jsx)(`path`,{d:`M3 12 12 16.5 21 12`}),(0,$.jsx)(`path`,{d:`M3 16.5 12 21 21 16.5`})]}),plan:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`circle`,{cx:`6`,cy:`6`,r:`2.3`}),(0,$.jsx)(`circle`,{cx:`6`,cy:`18`,r:`2.3`}),(0,$.jsx)(`circle`,{cx:`18`,cy:`8`,r:`2.3`}),(0,$.jsx)(`path`,{d:`M6 8.3v7.4M8.3 6H13a3 3 0 0 1 3 3v0`})]}),s3:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`ellipse`,{cx:`12`,cy:`6`,rx:`7`,ry:`2.6`}),(0,$.jsx)(`path`,{d:`M5 6v12c0 1.5 3.1 2.6 7 2.6s7-1.1 7-2.6V6`}),(0,$.jsx)(`path`,{d:`M5 12c0 1.5 3.1 2.6 7 2.6s7-1.1 7-2.6`})]}),backups:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`path`,{d:`M3 6.5 5 3.5h14l2 3`}),(0,$.jsx)(`rect`,{x:`3`,y:`6.5`,width:`18`,height:`14`,rx:`2`}),(0,$.jsx)(`path`,{d:`M9.5 12h5`})]}),config:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`path`,{d:`M4 7h8M16 7h4M4 17h4M12 17h8`}),(0,$.jsx)(`circle`,{cx:`14`,cy:`7`,r:`2.2`}),(0,$.jsx)(`circle`,{cx:`10`,cy:`17`,r:`2.2`})]}),feed:(0,$.jsx)(`path`,{d:`M4 6h16M4 12h16M4 18h10`})}[e]})}function eY(){let[e,t]=(0,v.useState)(null),[n,r]=(0,v.useState)(null),[i,a]=(0,v.useState)(null),[o,s]=(0,v.useState)(null),[c,l]=(0,v.useState)(null),[u,d]=(0,v.useState)(!1),[f,p]=(0,v.useState)(null),[m,h]=(0,v.useState)([]),[g,_]=(0,v.useState)(36e5),[y,b]=(0,v.useState)(!1),[x,S]=(0,v.useState)(`off`),[C,w]=(0,v.useState)(null),[T,E]=(0,v.useState)(()=>new Set),[D,O]=(0,v.useState)({}),[k,A]=(0,v.useState)({tool:``,risk:``,device:``,status:``,q:``}),j=(0,v.useRef)(y);j.current=y;let M=(0,v.useRef)(null);TJ(M);let[N,P]=(0,v.useState)(`overview`),[F,I]=(0,v.useState)(()=>{try{let e=localStorage.getItem(`mt-help-open`);return new Set(e?JSON.parse(e):[])}catch{return new Set}}),L=e=>I(t=>{let n=new Set(t);n.has(e)?n.delete(e):n.add(e);try{localStorage.setItem(`mt-help-open`,JSON.stringify([...n]))}catch{}return n}),[ee,te]=(0,v.useState)(``),[R,z]=(0,v.useState)(`all`),B=(0,v.useMemo)(()=>{let e=i?.devices??[];return{online:e.filter(e=>e.status.reachable===!0).length,offline:e.filter(e=>e.status.reachable===!1).length,total:e.length}},[i]),V=(0,v.useMemo)(()=>{let e=i?.devices??[],t=ee.trim().toLowerCase();return e.filter(e=>!(R===`online`&&e.status.reachable!==!0||R===`offline`&&e.status.reachable!==!1||t&&!e.name.toLowerCase().includes(t)&&!(e.address??e.host??``).toLowerCase().includes(t)))},[i,ee,R]);wJ((0,v.useCallback)(e=>{if(j.current)return;h(t=>[e,...t].slice(0,oJ));let t=e.device;t&&O(e=>({...e,[t]:(e[t]??0)+1}))},[]),(0,v.useCallback)(e=>S(e),[])),(0,v.useEffect)(()=>{uc(`/api/events?limit=200`).then(e=>h(e.events)).catch(()=>{})},[]);let H=(0,v.useCallback)(()=>{uc(`/api/stats?window=${g}&buckets=60`).then(t).catch(()=>{})},[g]);(0,v.useEffect)(()=>{H();let e=()=>{H(),uc(`/api/meta`).then(r).catch(()=>{}),uc(`/api/devices`).then(a).catch(()=>{}),uc(`/api/topology`).then(s).catch(()=>{})};e();let t=setInterval(()=>{j.current||e()},4e3);return()=>clearInterval(t)},[H]),(0,v.useEffect)(()=>{let e=()=>void uc(`/api/config`).then(l).catch(()=>{});e();let t=setInterval(e,3e4);return()=>clearInterval(t)},[]),(0,v.useEffect)(()=>{let e=e=>{e.key===`Escape`&&w(null)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let ne=(0,v.useMemo)(()=>{let e=k.q.trim().toLowerCase();return m.filter(t=>!(k.tool&&t.tool!==k.tool||k.risk&&t.risk!==k.risk||k.device&&t.device!==k.device||k.status===`ok`&&t.isError||k.status===`error`&&!t.isError||e&&!t.tool.toLowerCase().includes(e)&&!t.input.toLowerCase().includes(e)&&!t.output.toLowerCase().includes(e)&&!(t.error??``).toLowerCase().includes(e))).sort((e,t)=>t.ts-e.ts)},[m,k]),re=!!(k.tool||k.risk||k.device||k.status||k.q),ie=(0,v.useMemo)(()=>m.filter(e=>e.isError),[m]),ae=(0,v.useMemo)(()=>({ok:m.length-ie.length,error:ie.length}),[m,ie]),oe=(0,v.useCallback)(async e=>{try{w(await uc(`/api/event/${encodeURIComponent(e.id)}`))}catch{w(e)}},[]),U=(0,v.useMemo)(()=>ne.slice(0,200),[ne]),se=(0,v.useMemo)(()=>U.map(e=>e.id),[U]),ce=se.length>0&&se.every(e=>T.has(e)),le=!ce&&se.some(e=>T.has(e)),ue=(0,v.useCallback)(e=>{E(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),de=(0,v.useCallback)(()=>{E(e=>{let t=new Set(e);if(se.length>0&&se.every(e=>t.has(e)))for(let e of se)t.delete(e);else for(let e of se)t.add(e);return t})},[se]),[fe,pe]=(0,v.useState)(!1),me=(0,v.useCallback)(async()=>{let e=[...T];if(e.length!==0)try{await fc({ids:e});let t=new Set(e);h(e=>e.filter(e=>!t.has(e.id))),E(new Set)}catch{}finally{pe(!1)}},[T]),he=e=>{if(e===`json`){qJ(`mcp-events.json`,JSON.stringify(ne,null,2),`application/json`);return}let t=[`ts`,`tool`,`risk`,`device`,`durationMs`,`isError`,`error`],n=e=>/[",\n]/.test(e)?`"${e.replace(/"/g,`""`)}"`:e,r=ne.map(e=>[new Date(e.ts).toISOString(),e.tool,e.risk,e.device??``,String(e.durationMs),String(e.isError),e.error??``].map(n).join(`,`)).join(`
|
|
81
81
|
`);qJ(`mcp-events.csv`,`${t.join(`,`)}\n${r}\n`,`text/csv`)},ge=e?e.errorRate>=.2?`is-bad`:e.errorRate>=.05?`is-warn`:`is-good`:``,_e=c?.mcp??{},ve=c?.dashboard??{},ye=(e,t,n)=>(0,$.jsxs)(`select`,{className:`btn`,value:k[e],onChange:t=>A(n=>({...n,[e]:t.target.value})),children:[(0,$.jsx)(`option`,{value:``,children:t}),n.map(e=>(0,$.jsx)(`option`,{value:e,children:e},e))]}),be=JJ.find(e=>e.id===N)??JJ[0];return(0,$.jsxs)(`div`,{className:`shell`,ref:M,"data-view":N,style:{"--page-accent":XJ[N][0],"--page-accent-2":XJ[N][1]},children:[(0,$.jsxs)(`aside`,{className:`nav`,children:[(0,$.jsxs)(`div`,{className:`nav__brand`,children:[(0,$.jsx)(`div`,{className:`nav__mark`,children:(0,$.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,"aria-hidden":`true`,children:(0,$.jsxs)(`g`,{stroke:`#18181b`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,$.jsx)(`path`,{d:`M12 12 L4 5 M12 12 L20 5 M12 12 L12 20`}),(0,$.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`,fill:`#18181b`,stroke:`none`}),(0,$.jsx)(`circle`,{cx:`4`,cy:`5`,r:`1.9`,fill:`#18181b`,stroke:`none`}),(0,$.jsx)(`circle`,{cx:`20`,cy:`5`,r:`1.9`,fill:`#18181b`,stroke:`none`}),(0,$.jsx)(`circle`,{cx:`12`,cy:`20`,r:`1.9`,fill:`#18181b`,stroke:`none`})]})})}),(0,$.jsxs)(`div`,{className:`nav__brandtext`,children:[(0,$.jsx)(`b`,{children:`MikroTik MCP`}),(0,$.jsx)(`small`,{children:`Observability`})]})]}),(0,$.jsx)(`nav`,{className:`nav__items`,children:JJ.map(e=>(0,$.jsxs)(`button`,{className:`nav__item${N===e.id?` is-active`:``}`,onClick:()=>P(e.id),children:[(0,$.jsx)($J,{name:e.id}),(0,$.jsx)(`span`,{children:e.label}),e.id===`feed`&&m.length>0&&(0,$.jsx)(`span`,{className:`nav__badge`,children:m.length>999?`999+`:m.length})]},e.id))}),(0,$.jsxs)(`div`,{className:`nav__foot`,children:[(0,$.jsxs)(`span`,{className:`hero__live${x===`off`?``:` is-on`}`,title:`Live transport: WebSocket (preferred) or SSE fallback`,children:[(0,$.jsx)(`span`,{className:`dot`}),x===`off`?`offline`:`live · ${x}`]}),(0,$.jsx)(`small`,{className:`muted`,children:n?`${nJ(n.total)} events · ${n.transport}`:`connecting…`})]})]}),(0,$.jsxs)(`main`,{className:`main`,"data-view":N,children:[(0,$.jsxs)(`header`,{className:`topline reveal`,children:[(0,$.jsxs)(`div`,{className:`topline__txt`,children:[(0,$.jsx)(`h1`,{children:be.label}),(0,$.jsx)(`small`,{children:be.sub})]}),(0,$.jsx)(`span`,{className:`topline__spacer`}),N===`overview`&&(0,$.jsx)(`select`,{className:`btn`,value:g,onChange:e=>_(Number(e.target.value)),title:`Stats time window`,children:aJ.map(([e,t])=>(0,$.jsxs)(`option`,{value:t,children:[`window: `,e]},t))}),(0,$.jsxs)(`button`,{className:`help-toggle${F.has(N)?` is-on`:``}`,onClick:()=>L(N),"aria-expanded":F.has(N),title:`About this page`,children:[(0,$.jsx)(`span`,{className:`help-toggle__q`,"aria-hidden":`true`,children:`?`}),`Help`]})]}),F.has(N)&&(0,$.jsx)(QJ,{view:N}),N===`overview`&&(0,$.jsxs)(`section`,{className:`view`,children:[(0,$.jsx)(`div`,{className:`cards reveal`,children:e?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(cJ,{k:`Calls (window)`,v:nJ(e.total)}),(0,$.jsx)(cJ,{k:`Calls / min`,v:e.callsPerMin.toFixed(1)}),(0,$.jsx)(cJ,{k:`Error rate`,v:`${(e.errorRate*100).toFixed(1)}%`,sub:`${e.errors} err`,cls:ge}),(0,$.jsx)(cJ,{k:`Avg latency`,v:$q(e.latency.avg)}),(0,$.jsx)(cJ,{k:`p95 latency`,v:$q(e.latency.p95)}),(0,$.jsx)(cJ,{k:`p99 latency`,v:$q(e.latency.p99)}),(0,$.jsx)(cJ,{k:`Distinct tools`,v:nJ(e.distinctTools)}),(0,$.jsx)(cJ,{k:`Output volume`,v:eJ(e.outputBytes)})]}):(0,$.jsxs)(`div`,{className:`stat`,children:[(0,$.jsx)(`p`,{className:`k`,children:`Loading…`}),(0,$.jsx)(`div`,{className:`v`,children:`—`})]})}),(0,$.jsxs)(`div`,{className:`bento reveal`,children:[(0,$.jsx)(sJ,{title:`Calls over time`,className:`b-series`,children:e?(0,$.jsx)(zq,{series:e.series}):(0,$.jsx)(`div`,{className:`muted`,children:`no data`})}),e&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(sJ,{title:`By risk`,className:`b-risk`,children:(0,$.jsx)(Bq,{segments:Object.keys(e.byRisk).map(t=>({label:t,value:e.byRisk[t],color:iJ[t]}))})}),(0,$.jsx)(sJ,{title:`Top tools`,className:`b-tools`,children:(0,$.jsx)(lJ,{rows:e.byTool.map(e=>({label:e.tool,value:e.count,sub:`${e.count}× · ${$q(e.p95Ms)} p95${e.errors?` · ${e.errors} err`:``}`,color:e.errors?`var(--mt-bad)`:void 0}))})}),(0,$.jsx)(sJ,{title:`Status`,className:`b-status`,children:(0,$.jsx)(Bq,{centerLabel:`calls`,segments:[{label:`ok`,value:ae.ok,color:`#a1a1a1`},{label:`error`,value:ae.error,color:`#ff5c5c`}]})}),(0,$.jsx)(sJ,{title:`By device`,className:`b-device`,children:e.byDevice.length?(0,$.jsx)(lJ,{rows:e.byDevice.map(e=>({label:e.device,value:e.count}))}):(0,$.jsx)(`div`,{className:`muted`,children:`single device`})}),(0,$.jsx)(sJ,{title:`Recent errors`,className:`b-errors`,children:ie.length?(0,$.jsx)(`div`,{className:`hbar`,children:ie.slice(0,8).map(e=>(0,$.jsxs)(`div`,{className:`hbar__row conn-errrow`,style:{gridTemplateColumns:`auto 1fr`},onClick:()=>void oe(e),children:[(0,$.jsx)(`span`,{className:`muted`,children:tJ(e.ts)}),(0,$.jsxs)(`span`,{style:{color:`var(--mt-bad)`,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`,minWidth:0},title:e.error??e.output,children:[e.tool,`: `,e.error??e.output??`error`]})]},e.id))}):(0,$.jsx)(`div`,{className:`muted`,children:`no errors 🎉`})})]})]})]}),N===`devices`&&(i&&i.devices.length>0?(0,$.jsxs)(`section`,{className:`view`,children:[(0,$.jsxs)(`div`,{className:`dev-toolbar reveal`,children:[(0,$.jsx)(`input`,{className:`search`,type:`search`,placeholder:`Search devices by name or address…`,value:ee,onChange:e=>te(e.target.value),style:{flex:1,minWidth:180}}),(0,$.jsx)(`div`,{className:`dev-filters`,children:[`all`,`online`,`offline`].map(e=>(0,$.jsx)(`button`,{className:`dev-fbtn${R===e?` is-active`:``}`,onClick:()=>z(e),children:e===`all`?`All ${B.total}`:e===`online`?`Online ${B.online}`:`Offline ${B.offline}`},e))}),(0,$.jsxs)(`span`,{className:`muted`,children:[V.length,`/`,B.total,` shown`]})]}),(0,$.jsxs)(`details`,{className:`dev-collapse reveal`,open:B.total<=8,children:[(0,$.jsxs)(`summary`,{children:[`Connectivity radar`,(0,$.jsxs)(`span`,{className:`muted`,children:[` `,`· `,B.online,` online · `,B.offline,` offline ·`,` `,B.total,` total`]})]}),(0,$.jsx)(bJ,{payload:i,pulses:D})]}),V.length===0?(0,$.jsxs)(`div`,{className:`feed-empty reveal`,children:[(0,$.jsx)(`div`,{className:`feed-empty__icon`,children:`🔍`}),(0,$.jsx)(`p`,{className:`feed-empty__title`,children:`No devices match`}),(0,$.jsx)(`p`,{className:`feed-empty__sub`,children:`Try a different search or status filter.`})]}):(0,$.jsx)(`div`,{className:`dev-grid-wide reveal`,children:V.map(e=>(0,$.jsx)(xJ,{d:e},e.name))}),V.length>0&&(0,$.jsx)(sJ,{title:`Device system health`,className:`reveal`,extra:(0,$.jsx)(`span`,{className:`muted`,children:`CPU · memory · disk · latency · live probe`}),children:(0,$.jsx)(`div`,{className:`health-grid`,children:V.map(e=>(0,$.jsx)(CJ,{d:e},e.name))})})]}):(0,$.jsxs)(`div`,{className:`feed-empty`,children:[(0,$.jsx)(`div`,{className:`feed-empty__icon`,children:`🖧`}),(0,$.jsx)(`p`,{className:`feed-empty__title`,children:`No devices configured`}),(0,$.jsx)(Yq,{type:`secondary`,label:`Tip`,children:`Add a device to your config to see connectivity and system health here.`})]})),N===`topology`&&(o&&o.nodes.length>0?(0,$.jsx)(`section`,{className:`view`,children:(0,$.jsx)(sJ,{title:`Network topology`,className:`reveal`,extra:(0,$.jsx)(`span`,{className:`muted`,children:`Layer-2 neighbours via MNDP/CDP/LLDP · click a neighbour to onboard it`}),children:(0,$.jsx)(jJ,{topo:o,onOnboard:(e,t)=>{p({name:e,body:t}),d(!0),P(`config`)}})})}):(0,$.jsxs)(`div`,{className:`feed-empty`,children:[(0,$.jsx)(`div`,{className:`feed-empty__icon`,children:`🛰️`}),(0,$.jsx)(`p`,{className:`feed-empty__title`,children:`No neighbours discovered yet`}),(0,$.jsx)(`p`,{className:`feed-empty__sub`,children:`Layer-2 neighbours (MNDP / CDP / LLDP) appear here as the device reports them.`})]})),N===`packets`&&(0,$.jsx)(`section`,{className:`view`,children:(0,$.jsx)(sJ,{title:`Packet capture`,className:`reveal`,extra:(0,$.jsx)(`span`,{className:`muted`,children:`live TZSP decode · /tool sniffer streaming`}),children:(0,$.jsx)(LJ,{})})}),N===`snapshots`&&(0,$.jsx)(zJ,{}),N===`plan`&&(0,$.jsx)(VJ,{}),N===`s3`&&(0,$.jsx)(HJ,{}),N===`backups`&&(0,$.jsx)(UJ,{}),N===`config`&&(c?(0,$.jsxs)(`section`,{className:`view`,children:[(0,$.jsx)(sJ,{title:`Configuration`,className:`reveal`,extra:(0,$.jsx)(`button`,{className:`btn`,onClick:()=>d(e=>!e),title:`Edit the config JSON with autocomplete, validation and safe-apply`,children:u?`View`:`✎ Edit config`}),children:u?(0,$.jsx)(kJ,{initial:f?{...c,devices:{...c.devices,[f.name]:f.body}}:c,onClose:()=>{d(!1),p(null)},onReload:()=>{p(null),uc(`/api/config`).then(l).catch(()=>{})}},f?`seed-${f.name}`:`config`):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`legend`,style:{margin:`0 0 10px`},children:[(0,$.jsxs)(`span`,{children:[`transport: `,rJ(_e.transport)]}),(0,$.jsxs)(`span`,{children:[`read-only: `,c.readOnly?`yes`:`no`]}),(0,$.jsxs)(`span`,{children:[`dashboard: `,rJ(ve.host),`:`,rJ(ve.port)]}),(0,$.jsxs)(`span`,{children:[`capture: `,ve.captureBody?`on`:`off`]}),(0,$.jsxs)(`span`,{children:[`s3: `,c.s3?`configured`:`off`]})]}),(0,$.jsxs)(`details`,{className:`cfg`,children:[(0,$.jsx)(`summary`,{children:`Full effective configuration (secrets redacted)`}),(0,$.jsx)(RJ,{value:c,maxHeight:340})]})]})}),(0,$.jsx)(sJ,{title:`Version history`,className:`reveal`,extra:(0,$.jsx)(`span`,{className:`muted`,children:`point-in-time snapshots · diff & restore`}),children:(0,$.jsx)(Gq,{onRestored:()=>void uc(`/api/config`).then(l).catch(()=>{})})}),(0,$.jsx)(sJ,{title:`Field guide`,className:`reveal`,extra:(0,$.jsx)(`span`,{className:`muted`,children:`every config option, documented from the schema`}),children:(0,$.jsx)(qq,{})})]}):(0,$.jsxs)(`div`,{className:`feed-empty`,children:[(0,$.jsx)(Qq,{}),(0,$.jsx)(`p`,{className:`feed-empty__title`,children:`Loading configuration…`})]})),N===`feed`&&(0,$.jsxs)(`div`,{className:`panel reveal`,children:[(0,$.jsxs)(`div`,{className:`sheet__hd`,style:{marginBottom:12},children:[(0,$.jsx)(`h2`,{style:{margin:0},children:`Live tool calls`}),(0,$.jsx)(`span`,{style:{flex:1}}),(0,$.jsxs)(`span`,{className:`muted`,children:[ne.length,` shown · `,m.length,` buffered`]})]}),(0,$.jsxs)(`div`,{className:`toolbar`,style:{marginBottom:12},children:[(0,$.jsx)(`div`,{className:`grow`,style:{flex:1,minWidth:180},children:(0,$.jsx)(`input`,{className:`search`,type:`search`,placeholder:`Search tool / input / output / error…`,value:k.q,onChange:e=>A(t=>({...t,q:e.target.value}))})}),ye(`tool`,`all tools`,n?.tools??[]),ye(`risk`,`all risk`,[`READ`,`WRITE`,`WRITE_IDEMPOTENT`,`DESTRUCTIVE`,`DANGEROUS`]),ye(`device`,`all devices`,n?.devices??[]),ye(`status`,`all status`,[`ok`,`error`]),(0,$.jsx)(`button`,{className:`btn${y?` is-active`:``}`,onClick:()=>b(e=>!e),children:y?`▶ Resume`:`⏸ Pause`}),(0,$.jsx)(`button`,{className:`btn`,onClick:()=>he(`csv`),children:`CSV`}),(0,$.jsx)(`button`,{className:`btn`,onClick:()=>he(`json`),children:`JSON`}),(0,$.jsx)(`button`,{className:`btn`,onClick:()=>A({tool:``,risk:``,device:``,status:``,q:``}),children:`Clear`}),fe&&T.size>0?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`button`,{className:`btn btn-danger`,onClick:()=>void me(),children:[`✓ Confirm delete (`,T.size,`)`]}),(0,$.jsx)(`button`,{className:`btn`,onClick:()=>pe(!1),children:`Cancel`})]}):(0,$.jsxs)(`button`,{className:`btn`,disabled:T.size===0,onClick:()=>pe(!0),title:`Delete the selected rows`,children:[`🗑 Delete`,T.size>0?` (${T.size})`:``]})]}),ne.length===0?re?(0,$.jsxs)(`div`,{className:`feed-empty`,children:[(0,$.jsx)(`div`,{className:`feed-empty__icon`,children:`🔍`}),(0,$.jsx)(`p`,{className:`feed-empty__title`,children:`No calls match your filters`}),(0,$.jsxs)(`p`,{className:`feed-empty__sub`,children:[m.length,` call`,m.length===1?``:`s`,` buffered — try widening the search or the risk / device / status filters.`]}),(0,$.jsx)(`button`,{className:`btn`,onClick:()=>A({tool:``,risk:``,device:``,status:``,q:``}),children:`Clear filters`})]}):(0,$.jsxs)(`div`,{className:`feed-empty`,children:[(0,$.jsx)(`div`,{className:`feed-empty__pulse${x===`off`?``:` is-on`}`}),(0,$.jsx)(`p`,{className:`feed-empty__title`,children:x===`off`?`Not connected`:`Listening for tool calls…`}),(0,$.jsx)(`p`,{className:`feed-empty__sub`,children:x===`off`?`The live stream is offline — it will reconnect automatically.`:`Tool calls the LLM makes against this server stream in here in real time.`})]}):(0,$.jsx)(`div`,{className:`feedwrap`,children:(0,$.jsxs)(`table`,{className:`feed`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{style:{width:28},children:(0,$.jsx)(`input`,{type:`checkbox`,"aria-label":`Select all shown rows`,checked:ce,ref:e=>{e&&(e.indeterminate=le)},onChange:de})}),(0,$.jsx)(`th`,{children:`time`}),(0,$.jsx)(`th`,{children:`tool`}),(0,$.jsx)(`th`,{children:`risk`}),(0,$.jsx)(`th`,{children:`device`}),(0,$.jsx)(`th`,{className:`num`,children:`dur`}),(0,$.jsx)(`th`,{children:`status`}),(0,$.jsx)(`th`,{children:`output`})]})}),(0,$.jsx)(`tbody`,{children:U.map(e=>(0,$.jsxs)(`tr`,{className:`${e.isError?`is-err`:``}${T.has(e.id)?` is-selected`:``}`.trim()||void 0,onClick:()=>void oe(e),children:[(0,$.jsx)(`td`,{onClick:e=>e.stopPropagation(),children:(0,$.jsx)(`input`,{type:`checkbox`,"aria-label":`Select row`,checked:T.has(e.id),onChange:()=>ue(e.id)})}),(0,$.jsx)(`td`,{children:tJ(e.ts)}),(0,$.jsx)(`td`,{children:e.tool}),(0,$.jsx)(`td`,{children:(0,$.jsx)(`span`,{className:`risk risk-${e.risk}`,children:e.risk.replace(`WRITE_IDEMPOTENT`,`WRITE·I`)})}),(0,$.jsx)(`td`,{children:e.device??`—`}),(0,$.jsx)(`td`,{className:`num`,children:$q(e.durationMs)}),(0,$.jsx)(`td`,{children:(0,$.jsx)(`span`,{className:e.isError?`status-err`:`status-ok`,children:e.isError?`error`:`ok`})}),(0,$.jsx)(`td`,{className:`preview`,children:e.isError?e.error??`error`:e.output||`—`})]},e.id))})]})})]})]}),C&&(0,$.jsx)(KJ,{event:C,onClose:()=>w(null)})]})}var tY=document.getElementById(`root`);tY&&(0,y.createRoot)(tY).render((0,$.jsx)(eY,{}));
|
|
82
82
|
</script>
|
|
83
83
|
<style>
|
package/package.json
CHANGED
package/schemas/README.md
CHANGED
|
@@ -7,7 +7,7 @@ edit by hand — regenerate instead.
|
|
|
7
7
|
| File | Contents |
|
|
8
8
|
| -------------------- | ------------------------------------------------------------------------------------------ |
|
|
9
9
|
| `config.schema.json` | The runtime configuration object (env vars / CLI flags). |
|
|
10
|
-
| `tool-catalog.json` | Every one of the
|
|
10
|
+
| `tool-catalog.json` | Every one of the 706 tools: `name`, `risk`, `title`, `description`, and input JSON Schema. |
|
|
11
11
|
| `tools/<name>.json` | The input JSON Schema for a single tool. |
|
|
12
12
|
|
|
13
13
|
`risk` is derived from the MCP tool annotations:
|