@miravo/cli-linux-x64 0.6.2 → 0.6.5
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/console-dist/assets/api-BjnU1LXi.js +1 -0
- package/console-dist/assets/catalog-BGQVa6B3.js +1 -0
- package/console-dist/assets/catalog-DEAID15Z.js +1 -0
- package/console-dist/assets/control-B_Mo9qMu.js +1 -0
- package/console-dist/assets/control-ahMsWPz4.js +1 -0
- package/console-dist/assets/copy-button-DYqJP5N8.js +1 -0
- package/console-dist/assets/{deploy-tab-zi4NXsfj.js → deploy-tab-BRET5egR.js} +1 -1
- package/console-dist/assets/{events-CfrhnDG_.js → events-B2IxlA63.js} +1 -1
- package/console-dist/assets/events-rhPd7QcZ.js +1 -0
- package/console-dist/assets/{fleet-CcdFCWOI.js → fleet-CF_yW3Xe.js} +1 -1
- package/console-dist/assets/fleet-DbMmYTAW.js +1 -0
- package/console-dist/assets/{get-error-message-DhCjoSSJ.js → get-error-message-BzBOywwk.js} +1 -1
- package/console-dist/assets/{index-DVW3M0iW.js → index-JB69yOxP.js} +3 -3
- package/console-dist/assets/{instance-detail-bpv-KYmO.js → instance-detail-4eUBkrXG.js} +1 -1
- package/console-dist/assets/{login-DV1Fd0nK.js → login-B7ZXWxuU.js} +2 -2
- package/console-dist/assets/models-BUJkHhCT.js +1 -0
- package/console-dist/assets/{models-BbWAxRFR.js → models-DeByQ5rq.js} +1 -1
- package/console-dist/assets/platforms-Caq2eqh-.js +1 -0
- package/console-dist/assets/{platforms-Dq6BGck6.js → platforms-DjGsPZpq.js} +1 -1
- package/console-dist/assets/route-preload-DZpMivUv.js +2 -0
- package/console-dist/assets/{tags-DZpOeuyx.js → tags-CL_-O-ZZ.js} +1 -1
- package/console-dist/assets/tags-DEKAj0l-.js +1 -0
- package/console-dist/assets/{transition-nav-link-B89fDRXR.js → transition-nav-link-99H9mlJO.js} +1 -1
- package/console-dist/assets/{use-engine-command-mutation-DTvKLMBg.js → use-engine-command-mutation--eob_QrP.js} +1 -1
- package/console-dist/assets/{use-platform-stream-BZTQlkbS.js → use-platform-stream-ScJV0xv8.js} +1 -1
- package/console-dist/assets/{use-transition-navigate-CG8tHeYN.js → use-transition-navigate-Dp3qkQ87.js} +1 -1
- package/console-dist/assets/{validation-CyzCfw_2.js → validation-BTuAJAb2.js} +1 -1
- package/console-dist/index.html +18 -18
- package/miravo +0 -0
- package/nodesets/.ignore +1 -0
- package/nodesets/1.02/FTNIR.NodeSet2.xml +819 -0
- package/nodesets/1.02/Opc.Ua.Adi.NodeSet2.xml +8301 -0
- package/nodesets/1.02/Opc.Ua.Di.NodeSet2.xml +1785 -0
- package/nodesets/Opc.ISA95.NodeSet2.xml +3589 -0
- package/nodesets/Opc.Ua.AMB.NodeSet2.xml +1395 -0
- package/nodesets/Opc.Ua.Adi.NodeSet2.xml +8301 -0
- package/nodesets/Opc.Ua.Adi.Types.xsd +104 -0
- package/nodesets/Opc.Ua.AutoID.NodeSet2.xml +6062 -0
- package/nodesets/Opc.Ua.CNC.NodeSet.xml +15875 -0
- package/nodesets/Opc.Ua.CommercialKitchenEquipment.NodeSet2.xml +12096 -0
- package/nodesets/Opc.Ua.Di.NodeSet2.xml +6042 -0
- package/nodesets/Opc.Ua.Di.Types.xsd +161 -0
- package/nodesets/Opc.Ua.Eumabois.Nodeset2.xml +2483 -0
- package/nodesets/Opc.Ua.Gds.NodeSet2.xml +8282 -0
- package/nodesets/Opc.Ua.Glass.NodeSet2.xml +5100 -0
- package/nodesets/Opc.Ua.IA.NodeSet2.xml +1782 -0
- package/nodesets/Opc.Ua.IOLink.NodeSet2.xml +4374 -0
- package/nodesets/Opc.Ua.IOLinkIODD.NodeSet2.xml +139 -0
- package/nodesets/Opc.Ua.IRDI.NodeSet2.xml +2243 -0
- package/nodesets/Opc.Ua.Ijt.Base.NodeSet2.xml +19459 -0
- package/nodesets/Opc.Ua.Ijt.Tightening.NodeSet2.xml +883 -0
- package/nodesets/Opc.Ua.LADS.NodeSet2.xml +7086 -0
- package/nodesets/Opc.Ua.MachineTool.NodeSet2.xml +7884 -0
- package/nodesets/Opc.Ua.MachineVision.NodeSet2.xml +17324 -0
- package/nodesets/Opc.Ua.Machinery.Jobs.Nodeset2.xml +1249 -0
- package/nodesets/Opc.Ua.Machinery.NodeSet2.xml +2099 -0
- package/nodesets/Opc.Ua.Machinery.ProcessValues.NodeSet2.xml +1858 -0
- package/nodesets/Opc.Ua.Machinery_Result.NodeSet2.xml +2640 -0
- package/nodesets/Opc.Ua.MetalForming.NodeSet2.xml +1577 -0
- package/nodesets/Opc.Ua.NodeSet2.xml +81975 -0
- package/nodesets/Opc.Ua.PADIM.NodeSet2.xml +14131 -0
- package/nodesets/Opc.Ua.PackML.NodeSet2.xml +3030 -0
- package/nodesets/Opc.Ua.Robotics.NodeSet2.xml +7409 -0
- package/nodesets/Opc.Ua.Scales.NodeSet2.xml +15817 -0
- package/nodesets/Opc.Ua.Types.bsd +3499 -0
- package/nodesets/Opc.Ua.Weihenstephan.NodeSet2.xml +821 -0
- package/nodesets/Opc.Ua.Woodworking.NodeSet2.xml +17831 -0
- package/nodesets/UANodeSet.xsd +497 -0
- package/nodesets/opc.ua.isa95-jobcontrol.nodeset2.xml +4594 -0
- package/package.json +3 -2
- package/console-dist/assets/api-Bef9FEIU.js +0 -1
- package/console-dist/assets/catalog-BKhsnMBa.js +0 -1
- package/console-dist/assets/catalog-Ia1pbi0U.js +0 -1
- package/console-dist/assets/control-M9POk7sD.js +0 -1
- package/console-dist/assets/control-xSKU0dgF.js +0 -1
- package/console-dist/assets/copy-button-BK3jqKBZ.js +0 -1
- package/console-dist/assets/events-BRekhc6s.js +0 -1
- package/console-dist/assets/fleet-Bk6J6tiE.js +0 -1
- package/console-dist/assets/models-BOPuZsyi.js +0 -1
- package/console-dist/assets/platforms-H2Z4z-EX.js +0 -1
- package/console-dist/assets/route-preload-CMl-AryU.js +0 -2
- package/console-dist/assets/tags-nAOAgZzI.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{a as t,i as n,n as r,r as i,s as a,t as o}from"./vendor-charts-CAZdaPlq.js";import{at as s}from"./vendor-ui-mizMYESS.js";import{_ as c,a as l}from"./api-Bef9FEIU.js";import{a as u,n as d,r as f,t as p}from"./get-error-message-DhCjoSSJ.js";import{t as m}from"./proxy-CgM57W61.js";import{i as ee,r as te}from"./dist-jROhexoH.js";import{c as ne,l as re}from"./chunk-OE4NN4TA-m2UhO8Q2.js";import{a as h,i as g,n as _,r as v,s as y,t as b}from"./copy-button-BK3jqKBZ.js";import{n as x,t as S}from"./createLucideIcon-Yddw9eHa.js";import{i as C,n as w,t as T}from"./tooltip-TtanriwA.js";import{C as E,E as D,S as O,c as k,d as ie,g as A,l as j,m as M,n as N,p as P,t as ae,u as F,v as I,y as oe}from"./input-BCiRHEmc.js";import{r as L}from"./engine-store-BUO-9Dsh.js";import{t as se}from"./activity-DP0Us3HU.js";import{a as ce,c as le,i as ue,n as de,o as R,r as fe,s as z,t as pe}from"./tabs-BgPF8MSY.js";import{c as me,l as he,o as ge,s as B}from"./validation-CyzCfw_2.js";import{a as _e,c as V,o as ve,t as ye}from"./use-engine-command-mutation-DTvKLMBg.js";import{t as H}from"./triangle-alert-DPtblpQC.js";import{t as U}from"./badge-tnWgSITj.js";import{t as be}from"./query-keys-Co1J4HmV.js";import{t as xe}from"./transition-types-CMW7IObN.js";import{n as Se}from"./auth-screen-backdrop-OrOL41MR.js";var W=S(`layers-2`,[[`path`,{d:`M13 13.74a2 2 0 0 1-2 0L2.5 8.87a1 1 0 0 1 0-1.74L11 2.26a2 2 0 0 1 2 0l8.5 4.87a1 1 0 0 1 0 1.74z`,key:`15q6uc`}],[`path`,{d:`m20 14.285 1.5.845a1 1 0 0 1 0 1.74L13 21.74a2 2 0 0 1-2 0l-8.5-4.87a1 1 0 0 1 0-1.74l1.5-.845`,key:`byia6g`}]]),Ce=S(`signal`,[[`path`,{d:`M2 20h.01`,key:`4haj6o`}],[`path`,{d:`M7 20v-4`,key:`j294jx`}],[`path`,{d:`M12 20v-8`,key:`i3yub9`}],[`path`,{d:`M17 20V8`,key:`1tkaf5`}],[`path`,{d:`M22 4v16`,key:`sih9yq`}]]),we=S(`timer`,[[`line`,{x1:`10`,x2:`14`,y1:`2`,y2:`2`,key:`14vaq8`}],[`line`,{x1:`12`,x2:`15`,y1:`14`,y2:`11`,key:`17fdiu`}],[`circle`,{cx:`12`,cy:`14`,r:`8`,key:`1e1u0o`}]]),G=e(a(),1),K=s(),q=`bg-transparent bg-transparent`,J=`blueprint-title text-foreground`;function Te(e,t){return t.includes(`rpm`)||t.includes(`speed`)?`e.g. 2500`:t.includes(`temp`)?`e.g. 70.0`:t.includes(`pressure`)?`e.g. 4.5`:e===`Boolean`?`true / false`:e===`String`?`value`:`e.g. 100`}function Ee({detail:e,methodArgs:t,setMethodArgs:n,onInvoke:r,isPending:i=!1,pendingMethod:a=null}){let o=Object.entries(e.methods);if(o.length===0)return null;let s=o.filter(([,e])=>e.inputArguments.length===0),c=o.filter(([,e])=>e.inputArguments.length>0);return(0,K.jsxs)(`div`,{id:`commands`,className:`flex min-w-0 flex-col gap-3 p-4`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,K.jsx)(`h2`,{className:J,children:`Commands`}),(0,K.jsx)(`p`,{className:`text-[10px] text-muted-foreground/75`,children:`Executable methods on this asset`})]}),s.length>0&&(0,K.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:s.map(([e,t])=>{let n=a===e&&i,o=n?R:V;return t.description?(0,K.jsxs)(T,{children:[(0,K.jsx)(C,{render:(0,K.jsxs)(N,{size:`sm`,variant:`outline`,disabled:i,title:e,className:x(`h-8 gap-1.5 font-mono text-xs`,q),onClick:()=>r(e),children:[(0,K.jsx)(o,{className:x(`size-3`,n&&`animate-spin`),"aria-hidden":!0}),P(e)]})}),(0,K.jsx)(w,{side:`bottom`,className:`max-w-xs`,children:t.description})]},e):(0,K.jsxs)(N,{size:`sm`,variant:`outline`,disabled:i,title:e,className:x(`h-8 gap-1.5 font-mono text-xs`,q),onClick:()=>r(e),children:[(0,K.jsx)(o,{className:x(`size-3`,n&&`animate-spin`),"aria-hidden":!0}),P(e)]},e)})}),c.length>0&&s.length>0&&(0,K.jsx)(B,{className:`bg-border/60`}),c.map(([e,o])=>{let s=a===e&&i;return(0,K.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`p`,{title:e,className:`font-mono text-sm font-medium`,children:P(e)}),o.description&&(0,K.jsx)(`p`,{className:`mt-0.5 text-[10px] text-muted-foreground`,children:o.description})]}),(0,K.jsxs)(N,{size:`sm`,variant:`default`,disabled:i,className:`shrink-0`,onClick:()=>r(e),children:[s?(0,K.jsx)(R,{className:`mr-1 size-3 animate-spin`,"aria-hidden":!0}):(0,K.jsx)(V,{className:`mr-1 size-3`,"aria-hidden":!0}),`Execute`]})]}),(0,K.jsx)(`div`,{className:`mt-3 flex flex-col gap-1.5 border-t border-border/50 pt-3`,children:o.inputArguments.map(r=>(0,K.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,K.jsx)(`span`,{title:r.name,className:`w-28 shrink-0 truncate pt-1.5 font-mono text-[10px] leading-tight text-muted-foreground`,children:P(r.name)}),(0,K.jsx)(ae,{className:`h-7 flex-1 font-mono text-xs`,placeholder:Te(r.dataType,r.name),value:t[e]?.[r.name]??``,onChange:t=>n(n=>({...n,[e]:{...n[e],[r.name]:t.target.value}}))})]},r.name))})]},e)})]})}function De({activeFaults:e,availableFaults:t,onTriggerFault:n,onClearFault:r}){let i=e.length>0,[a,o]=(0,G.useState)(null);return(0,K.jsxs)(`div`,{id:`faults`,className:`flex min-w-0 flex-col gap-3 p-4`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,K.jsx)(`h2`,{className:J,children:`Alarms`}),(0,K.jsx)(`p`,{className:`text-[10px] text-muted-foreground/75`,children:`Active faults and injectable failure modes (environment)`})]}),i?(0,K.jsx)(`div`,{className:`flex flex-col gap-2`,children:e.map(e=>(0,K.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-[var(--miravo-radius-tight)] border border-destructive/30 bg-transparent py-2.5 pl-3 pr-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(H,{className:`size-4 shrink-0 text-destructive`}),(0,K.jsx)(`span`,{title:e,className:`font-mono text-sm font-medium text-destructive`,children:P(e)})]}),(0,K.jsxs)(N,{size:`sm`,variant:`outline`,className:x(`h-8 shrink-0 gap-1 border-destructive/30 px-2.5 font-mono text-[0.75rem] text-destructive shadow-none`,`hover:border-destructive/45 hover:bg-destructive/5 hover:text-destructive`,`focus-visible:border-destructive/40 focus-visible:ring-destructive/20`,q),onClick:()=>r(e),children:[(0,K.jsx)(z,{className:`size-3.5`,"aria-hidden":!0}),`Clear`]})]},e))}):(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,K.jsx)(le,{className:`size-4 text-success`}),`All clear — no active faults`]}),t.length>0&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(B,{className:`bg-border/60`}),(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`p`,{className:x(J,`mb-2`),children:[`Inject fault`,(0,K.jsxs)(U,{variant:`secondary`,className:`ml-2 text-[10px]`,children:[t.filter(t=>!e.includes(t)).length,` available`]})]}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.filter(t=>!e.includes(t)).map(e=>(0,K.jsx)(N,{size:`sm`,variant:`outline`,title:e,className:x(`h-7 font-mono text-[10px]`,q),onClick:()=>o(e),children:P(e)},e))})]})]}),(0,K.jsx)(_,{open:a!==null,onOpenChange:e=>{e||o(null)},children:(0,K.jsxs)(v,{children:[(0,K.jsx)(y,{className:`font-heading text-lg font-semibold tracking-tight`,children:`Inject fault?`}),(0,K.jsxs)(g,{className:`text-sm text-muted-foreground`,children:[`This asserts`,` `,(0,K.jsx)(`span`,{title:a??void 0,className:`font-mono text-foreground`,children:a?P(a):``}),` `,`on the running environment. Downstream consumers will see the fault immediately. Clear it from the active list when you're done.`]}),(0,K.jsxs)(h,{children:[(0,K.jsx)(N,{variant:`outline`,onClick:()=>o(null),children:`Cancel`}),(0,K.jsxs)(N,{variant:`destructive`,onClick:()=>{a&&n(a),o(null)},children:[(0,K.jsx)(H,{className:`mr-1 size-3.5`,"aria-hidden":!0}),`Inject fault`]})]})]})})]})}function Oe({detail:e,tick:t,activeFaults:n,memberValues:r,onBack:i}){let a=n.length,o=e.isQuarantined,s=`OK`,c=`ok`;a>0?(s=`FAULT`,c=`bad`):o&&(s=`QRTN`,c=`warn`);let l=0;if(r)for(let e of r.values())e.quality!==`good`&&l++;let u=Object.keys(e.members).length,d=r?.get(`availability_state`)?.value,f=e.members.availability_state?.value,p=typeof d==`string`?d:typeof f==`string`?f:`unknown`,m=p===`running`?{dot:`bg-success`,pulse:`bg-success/60`,animate:!0}:p===`faulted`?{dot:`bg-destructive`,pulse:`bg-destructive/60`,animate:!0}:p===`stopped`?{dot:`bg-warning`,pulse:`bg-warning/60`,animate:!0}:{dot:`bg-muted-foreground/60`,pulse:`bg-muted-foreground/50`,animate:!1},ee=p===`running`?`Availability state is running — the asset is available and in service.`:p===`faulted`?`Availability state is faulted — the asset is unavailable because a fault is active.`:p===`stopped`?`Availability state is stopped — the asset is available but not running.`:`Availability state is not available for this asset yet.`;return(0,K.jsxs)(`header`,{className:x(ve,`flex w-full min-w-0 flex-col`),children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-3 px-5 py-4 sm:flex-row sm:items-start sm:justify-between sm:gap-4`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1 text-[10px] font-medium uppercase tracking-wider text-muted-foreground`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:i,className:`transition-colors hover:text-foreground`,children:`Fleet`}),(0,K.jsx)(`span`,{"aria-hidden":!0,children:`/`}),(0,K.jsx)(`span`,{className:`truncate`,children:A(e.assetType)})]}),(0,K.jsx)(G.ViewTransition,{name:`instance-${e.id}`,default:`none`,children:(0,K.jsx)(`h1`,{className:`font-heading mt-1 text-2xl font-semibold uppercase leading-tight tracking-wide`,children:M(e.id)})}),(0,K.jsxs)(`div`,{className:`mt-1.5 flex min-w-0 items-center gap-1.5`,children:[(0,K.jsx)(`p`,{className:`m-0 min-w-0 flex-1 font-mono text-[10px] leading-tight tracking-tight text-muted-foreground`,children:(0,K.jsx)(`span`,{className:`break-all`,children:e.browsePath.join(` / `)})}),(0,K.jsx)(`span`,{className:`inline-flex shrink-0`,children:(0,K.jsx)(b,{value:ie(e.browsePath),label:`Copy Topic / UNS path`})})]})]}),(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 self-end font-mono text-xs sm:self-start`,children:[(0,K.jsx)(ce,{className:`size-3.5 animate-pulse text-primary`,"aria-hidden":!0}),(0,K.jsx)(`span`,{className:`font-medium text-primary`,children:`LIVE`}),(0,K.jsxs)(`span`,{className:`tabular-nums text-muted-foreground`,children:[`t=`,t]}),(0,K.jsxs)(T,{children:[(0,K.jsx)(C,{render:(0,K.jsx)(`span`,{className:`inline-flex size-3.5 items-center justify-center outline-none focus-visible:ring-2 focus-visible:ring-ring`}),children:(0,K.jsxs)(`span`,{"aria-hidden":!0,className:`relative flex size-1.5 shrink-0 items-center justify-center`,children:[(0,K.jsx)(`span`,{className:x(`relative inline-flex size-1.5 rounded-full`,m.dot)}),m.animate&&(0,K.jsx)(`span`,{className:x(`absolute inline-flex size-2.5 animate-ping rounded-full opacity-75`,m.pulse)})]})}),(0,K.jsx)(w,{side:`top`,align:`end`,children:(0,K.jsxs)(`span`,{className:`block max-w-[16rem] text-[11px] leading-snug`,children:[(0,K.jsx)(`span`,{className:`font-medium uppercase tracking-[0.08em]`,children:`Availability`}),` `,(0,K.jsxs)(`span`,{className:`text-muted-foreground`,children:[`— `,ee]})]})})]})]})]}),(0,K.jsxs)(`fieldset`,{"aria-label":`Instance status`,className:`m-0 flex flex-col border-0 border-t border-border/50 p-0`,children:[(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-px bg-transparent`,children:[(0,K.jsx)(Y,{variant:`primary`,icon:se,label:`Health`,value:s,tone:c,tooltip:`Rolls up active faults and quarantine into a single status — OK when nothing is asserted, FAULT when any fault is active, QRTN when the asset is excluded from the running fleet.`}),(0,K.jsx)(Y,{variant:`primary`,icon:H,label:`Active faults`,labelCompact:`Faults`,value:String(a),tone:a>0?`bad`:`neutral`,tooltip:`Fault codes currently asserted on this asset. Clear or inject faults from the Alarms section below.`})]}),(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-px border-t border-border/50 bg-transparent sm:grid-cols-4`,children:[(0,K.jsx)(Y,{variant:`compact`,icon:W,label:`Lifecycle`,labelCompact:`Life`,value:P(e.lifecycleStage),tone:D(e.lifecycleStage),tooltip:`Where this asset sits in its operational lifecycle (e.g. commissioning, operating, maintenance, retired).`}),(0,K.jsx)(Y,{variant:`compact`,icon:he,label:`Tags`,value:String(u),tone:`neutral`,tooltip:`Total members exposed by this asset — process variables, state flags, counters, commands, and reference fields combined.`}),(0,K.jsx)(Y,{variant:`compact`,icon:Ce,label:`Bad quality`,value:String(l),tone:l>0?`warn`:`neutral`,tooltip:`Members whose quality stamp is anything other than good (uncertain or bad). A healthy asset reads 0.`}),(0,K.jsx)(Y,{variant:`compact`,icon:we,label:`Operating age`,value:oe(e.operatingHours),tone:`neutral`,tooltip:`Total operating age on this asset, including any environment-seeded starting hours plus simulated runtime elapsed in this session.`})]})]})]})}function Y({icon:e,label:t,labelCompact:n,value:r,suffix:i,tone:a,variant:o=`compact`,tooltip:s}){let c=o===`primary`;return(0,K.jsxs)(`div`,{className:x(`relative flex min-w-0 flex-col justify-center`,c?`min-h-20 gap-1.5 px-4 py-4 sm:min-h-24 sm:px-6 sm:py-5 lg:min-h-28 lg:px-8`:`min-h-12 gap-1 px-3 py-2.5 sm:min-h-13 sm:px-4 lg:min-h-14 lg:px-5`),children:[(0,K.jsx)(`div`,{className:`flex min-h-0 min-w-0 items-center gap-2`,children:(0,K.jsxs)(T,{children:[(0,K.jsxs)(C,{className:`flex min-h-0 min-w-0 flex-1 cursor-default items-center gap-2 text-left`,render:(0,K.jsx)(`div`,{}),children:[(0,K.jsx)(e,{className:x(`shrink-0 text-muted-foreground`,c?`size-4`:`size-3.5`),"aria-hidden":!0}),(0,K.jsxs)(`span`,{className:x(`min-w-0 flex-1 font-medium tracking-wide text-muted-foreground uppercase 2xl:tracking-wider`,c?`text-[11px] leading-snug sm:text-[12px]`:`text-[9px] leading-snug sm:text-[10px]`),children:[(0,K.jsx)(`span`,{className:`block wrap-break-word 2xl:hidden`,children:n??t}),(0,K.jsx)(`span`,{className:`hidden wrap-break-word 2xl:block`,children:t})]})]}),(0,K.jsx)(w,{side:`top`,align:`start`,sideOffset:6,className:`max-w-xs`,children:(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsx)(`span`,{className:`font-medium text-foreground`,children:t}),(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:s??t})]})})]})}),(0,K.jsxs)(`p`,{className:x(`min-w-0 wrap-break-word font-mono font-semibold leading-tight tracking-tight tabular-nums`,c?`text-2xl sm:text-3xl lg:text-4xl`:`text-base lg:text-lg`,a===`ok`&&`text-success`,a===`warn`&&`text-warning`,a===`bad`&&`text-destructive`,a===`neutral`&&`text-foreground`),children:[r,i?(0,K.jsx)(`span`,{className:x(`ml-0.5 font-medium text-muted-foreground`,c?`text-base lg:text-lg`:`text-xs lg:text-sm`),children:i}):null]})]})}function X({title:e,subtitle:t,children:n,className:r,id:i}){return(0,K.jsxs)(`section`,{id:i,className:x(_e,r),children:[(0,K.jsxs)(`div`,{className:`border-b border-border/60 px-4 py-3`,children:[(0,K.jsx)(`h2`,{className:`blueprint-title text-foreground`,children:e}),t?(0,K.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:t}):null]}),(0,K.jsx)(`div`,{className:`overflow-hidden p-0`,children:n})]})}function Z({className:e,counters:t,memberValues:n}){return(0,K.jsx)(X,{title:`Counters`,subtitle:`Totals, hours, and accumulators`,className:e,children:(0,K.jsx)(`div`,{className:`flex flex-col gap-2 p-4`,children:t.map(([e,t])=>{let r=n?.get(e),i=r?r.value:t.value;return(0,K.jsxs)(`div`,{className:`flex items-center justify-between rounded-[var(--miravo-radius-tight)] border border-border/60 bg-transparent px-3 py-2`,children:[(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:O(e)}),(0,K.jsxs)(`span`,{className:`blueprint-stat text-sm font-medium`,children:[typeof i==`number`?I(i):String(i),t.meta.unit&&(0,K.jsx)(`span`,{className:`ml-1 text-[10px] text-muted-foreground`,children:E(t.meta.unit)})]})]},e)})})})}function Q({className:e,detail:t,referenceMembers:n,memberValues:r}){let i=Object.keys(t.parameters).length>0,a=n.length>0;return!i&&!a?null:(0,K.jsx)(X,{title:`Nameplate & configuration`,subtitle:`Design parameters, identity, and reference values`,className:e,children:(0,K.jsxs)(`div`,{className:`flex flex-col gap-4 p-4`,children:[i&&(0,K.jsx)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-3`,children:Object.entries(t.parameters).map(([e,t])=>(0,K.jsxs)(`div`,{className:`flex flex-col gap-0.5 py-1.5`,children:[(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:O(e)}),(0,K.jsxs)(`span`,{className:`font-mono text-sm font-medium`,children:[typeof t.value==`number`?I(t.value):String(t.value),t.unit&&(0,K.jsx)(`span`,{className:`ml-1 text-[10px] text-muted-foreground`,children:E(t.unit)})]})]},e))}),a&&(0,K.jsx)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-3`,children:n.map(([e,t])=>{let n=r?.get(e),i=n?n.value:t.value;return(0,K.jsxs)(`div`,{className:`flex flex-col gap-0.5 rounded-[var(--miravo-radius-tight)] border border-border/60 bg-transparent p-2`,children:[(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:O(e)}),(0,K.jsxs)(`span`,{className:`font-mono text-sm font-medium`,children:[typeof i==`number`?I(i):String(i),t.meta.unit&&(0,K.jsx)(`span`,{className:`ml-1 text-[10px] text-muted-foreground`,children:E(t.meta.unit)})]})]},e)})})]})})}var ke=new Set([`pu`,`h`]),Ae=[`_reference`,`_baseline`,`_setpoint`,`_command`],$=`var(--color-primary)`,je=`var(--color-background)`;function Me(e){return Object.entries(e.members).filter(([e,t])=>t.meta.kind===`variable`&&t.meta.access===`read`&&t.meta.dataType===`Double`&&t.meta.euRange!==null&&!ke.has(t.meta.unit??``)&&!Ae.some(t=>e.endsWith(t)))}function Ne(e){if(e.length<3)return!1;let t=e[0]?.value??0;return e.some(e=>Math.abs(e.value-t)>.001)}function Pe({data:e,chartHeight:a=34}){let s=(0,G.useId)(),[c,l]=(0,G.useState)(null),u=e.map(e=>e.value),d=Math.min(...u),f=Math.max(...u);return(0,K.jsxs)(`div`,{className:`flex min-h-0 w-full flex-col overflow-hidden`,style:{height:a+14},children:[(0,K.jsx)(`div`,{style:{height:a,width:`100%`},children:(0,K.jsx)(n,{width:`100%`,height:a,children:(0,K.jsxs)(o,{data:e,margin:{top:2,right:2,bottom:2,left:0},onMouseMove:e=>{let t=e?.activePayload?.[0]?.value;typeof t==`number`&&l(t)},onMouseLeave:()=>l(null),children:[(0,K.jsx)(`defs`,{children:(0,K.jsxs)(`linearGradient`,{id:s,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,K.jsx)(`stop`,{offset:`0%`,stopColor:$,stopOpacity:.3}),(0,K.jsx)(`stop`,{offset:`100%`,stopColor:$,stopOpacity:0})]})}),(0,K.jsx)(r,{domain:[`auto`,`auto`],hide:!0}),(0,K.jsx)(t,{content:()=>null,cursor:!1}),(0,K.jsx)(i,{type:`monotone`,dataKey:`value`,stroke:$,strokeWidth:1.5,fill:`url(#${s})`,isAnimationActive:!1,dot:!1,activeDot:{r:3,fill:$,stroke:je,strokeWidth:1}})]})})}),(0,K.jsx)(`span`,{className:`text-[10px] leading-none tabular-nums text-muted-foreground`,children:c===null?(0,K.jsxs)(K.Fragment,{children:[I(d),`–`,I(f)]}):(0,K.jsx)(`span`,{className:`font-medium text-primary`,children:I(c)})})]})}function Fe({detail:e,processVariables:t,memberValues:n,historyRef:r,showQuality:i}){let a=(0,G.useMemo)(()=>[...t].sort(([e],[t])=>{let n=r.current.get(e)??[],i=r.current.get(t)??[],a=n.length>2&&Ne(n);return a===(i.length>2&&Ne(i))?0:a?-1:1}),[t,n,r]);return t.length===0?(0,K.jsx)(X,{title:`Process`,subtitle:`No continuous analog readings defined for this asset`,className:`opacity-90`,children:(0,K.jsx)(`p`,{className:`px-4 py-6 text-center text-sm text-muted-foreground`,children:`This asset exposes no continuous process variables. Discrete states, flags, and commands are available in the Tags section below.`})}):(0,K.jsx)(X,{title:`Process`,subtitle:`Live tag readings — trend is ~2 min at 1 Hz`,children:(0,K.jsx)(`ul`,{className:`divide-y divide-border/40`,children:a.map(([t,a])=>{let o=n?.get(t),s=o?o.value:a.value,c=o?o.quality:a.quality,l=r.current.get(t)??[],u=F(e.browsePath,t),d=l.length>2&&Ne(l),f=E(a.meta.unit),p=O(t);return(0,K.jsxs)(m.li,{layout:!0,transition:{duration:.32,ease:[.22,1,.36,1]},className:`flex flex-col gap-2.5 bg-background px-4 py-3 sm:flex-row sm:items-center sm:gap-5 sm:py-3.5`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1 sm:w-44 sm:shrink-0`,children:[(0,K.jsxs)(T,{children:[(0,K.jsx)(C,{className:`min-w-0 flex-1 cursor-default truncate text-left text-[11px] font-medium uppercase tracking-[var(--miravo-tracking-eyebrow)] text-muted-foreground`,render:(0,K.jsx)(`span`,{}),children:p}),(0,K.jsx)(w,{side:`top`,align:`start`,className:`max-w-xs`,children:p})]}),(0,K.jsx)(b,{value:u,label:`Copy Topic / UNS path`})]}),(0,K.jsxs)(`div`,{className:`relative h-[56px] min-w-0 flex-1`,children:[(0,K.jsx)(`div`,{"aria-hidden":!0,className:`absolute inset-x-0 top-1/2 h-px -translate-y-1/2 bg-border/30`}),d?(0,K.jsx)(Pe,{data:l,chartHeight:42}):(0,K.jsx)(`p`,{className:`flex h-full items-center text-[10px] uppercase tracking-widest text-muted-foreground`,children:l.length<=2?`Collecting trend…`:`No change (last 2 min)`})]}),(0,K.jsxs)(`div`,{className:`flex items-baseline gap-2 sm:min-w-36 sm:shrink-0 sm:justify-end`,children:[(0,K.jsx)(`span`,{className:`blueprint-stat text-2xl font-semibold leading-none tabular-nums text-foreground`,children:typeof s==`number`?I(s):String(s)}),f&&(0,K.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:f}),i&&c!==`good`&&(0,K.jsx)(U,{variant:c===`uncertain`?`secondary`:`destructive`,className:`shrink-0 text-[10px]`,children:c})]})]},t)})})})}function Ie({name:e,value:t,dataType:n,unit:r,access:i}){let a=O(e),o=i===`readwrite`;if(n===`Boolean`||typeof t==`boolean`||r===`pu`&&(t===0||t===1)){let n=t===!0||t===`true`||t===1,r=e.includes(`fault`);return(0,K.jsxs)(`div`,{className:`flex min-h-9 min-w-0 items-center justify-between gap-2 rounded-[var(--miravo-radius-tight)] border px-2 py-1 ${r&&n?`border-destructive/30 bg-transparent`:``}`,children:[(0,K.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-left text-[10px] leading-snug text-muted-foreground`,children:[a,o&&(0,K.jsx)(`span`,{className:`ml-1 text-[8px] text-primary`,children:`CMD`})]}),(0,K.jsx)(`span`,{className:`shrink-0 font-mono text-xs font-medium tabular-nums ${r&&n?`text-destructive`:n?`text-success`:`text-muted-foreground`}`,children:n?`ON`:`OFF`})]})}if(n===`String`){let n=String(t),r=n===`none`||n===``,i=k.has(n)||e.includes(`fault_code`)&&!r,o=!i&&j.has(n);return(0,K.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-col justify-center gap-1 rounded-[var(--miravo-radius-tight)] border px-2 py-2 ${i?`border-destructive/30 bg-transparent`:o?`border-warning/30 bg-warning/5`:``}`,children:[(0,K.jsx)(`span`,{className:`wrap-break-word text-[10px] leading-tight text-muted-foreground`,children:a}),r?(0,K.jsx)(`span`,{className:`wrap-break-word font-mono text-sm font-medium leading-snug text-muted-foreground`,children:`—`}):(0,K.jsx)(`span`,{title:n,className:`wrap-break-word font-mono text-sm font-medium leading-snug ${i?`text-destructive`:o?`text-warning`:`text-foreground`}`,children:P(n)})]})}return(0,K.jsxs)(`div`,{className:`flex min-h-9 min-w-0 items-center justify-between gap-2 rounded-[var(--miravo-radius-tight)] border px-2 py-1`,children:[(0,K.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-left text-[10px] leading-snug text-muted-foreground`,children:[a,o&&(0,K.jsx)(`span`,{className:`ml-1 text-[8px] text-primary`,children:`CMD`})]}),(0,K.jsxs)(`span`,{className:`shrink-0 text-right font-mono text-xs font-medium tabular-nums`,children:[typeof t==`number`?I(t):String(t),r&&(0,K.jsx)(`span`,{className:`ml-1 text-[10px] text-muted-foreground`,children:E(r)})]})]})}function Le(e){return[...e].sort((e,t)=>{let n=e[1].meta.access===`readwrite`;return n===(t[1].meta.access===`readwrite`)?e[0].localeCompare(t[0]):n?-1:1})}function Re({stringEnumMembers:e,nonStringOperationalMembers:t,memberValues:n,className:r}){let i=(0,G.useMemo)(()=>Le(e),[e]),a=(0,G.useMemo)(()=>Le(t),[t]),o=`grid min-w-0 gap-2 [grid-template-columns:repeat(auto-fill,minmax(min(100%,12.5rem),1fr))]`;return(0,K.jsx)(X,{title:`Tags`,subtitle:`Mode, status flags, and control tags`,className:r,children:(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-5 p-4`,children:[i.length>0&&(0,K.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[a.length>0&&(0,K.jsx)(`h3`,{className:`blueprint-title text-muted-foreground`,children:`States`}),(0,K.jsx)(`div`,{className:o,children:i.map(([e,t])=>{let r=n?.get(e);return(0,K.jsx)(Ie,{name:e,value:r?r.value:t.value,dataType:t.meta.dataType,unit:t.meta.unit,access:t.meta.access},e)})})]}),a.length>0&&(0,K.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[i.length>0&&(0,K.jsx)(`h3`,{className:`blueprint-title text-muted-foreground`,children:`Flags & commands`}),(0,K.jsx)(`div`,{className:o,children:a.map(([e,t])=>{let r=n?.get(e);return(0,K.jsx)(Ie,{name:e,value:r?r.value:t.value,dataType:t.meta.dataType,unit:t.meta.unit,access:t.meta.access},e)})})]})]})})}var ze=120,Be=`gap-4 sm:gap-5 lg:gap-x-6 lg:gap-y-5 xl:gap-x-8`,Ve=`instance-detail-page relative isolate mx-auto flex min-h-full w-full max-w-screen-2xl flex-col gap-6 p-4 sm:gap-8 sm:p-6`;function He(e){return e instanceof Error&&`code`in e&&e.code===`NOT_FOUND`?!0:e instanceof Error&&/^404\b/.test(e.message.trim())}function Ue(){let{id:e}=re(),t=ne(),n=(0,G.useCallback)(()=>{(0,G.startTransition)(()=>{(0,G.addTransitionType)(xe),t(`/`)})},[t]),[r,i]=(0,G.useState)({}),[a,o]=(0,G.useState)(null),[s,h]=(0,G.useState)(!1),[g,_]=ee(`tab`,te([`hmi`,`operate`,`data`,`operations`]).withDefault(`hmi`)),v=g===`data`||g===`operations`?`operate`:g,y=ye();(0,G.useEffect)(()=>{y.isPending||o(null)},[y.isPending]),(0,G.useEffect)(()=>{(g===`data`||g===`operations`)&&_(`operate`)},[g,_]);let b=(0,G.useCallback)(e=>{_(`operate`),requestAnimationFrame(()=>{requestAnimationFrame(()=>{document.getElementById(e)?.scrollIntoView({behavior:`smooth`,block:`start`})})})},[_]);(0,G.useEffect)(()=>{let e=null,t=!1,r=()=>{t=!1,e&&=(clearTimeout(e),null)},i=i=>{if(i.metaKey||i.ctrlKey||i.altKey)return;let a=i.target;if(a){let e=a.tagName;if(e===`INPUT`||e===`TEXTAREA`||e===`SELECT`||a.isContentEditable)return}if(t){i.key===`f`?(b(`faults`),i.preventDefault()):i.key===`c`&&(b(`commands`),i.preventDefault()),r();return}if(i.key===`g`){t=!0,e=setTimeout(r,1200);return}i.key===`b`&&!i.shiftKey?(n(),i.preventDefault()):i.key===`?`&&(h(!0),i.preventDefault())};return window.addEventListener(`keydown`,i),()=>{window.removeEventListener(`keydown`,i),r()}},[n,b]);let S=u({queryKey:be.instances.detail(e??``),queryFn:()=>l(`/instances/${e}`,c.instanceDetail),enabled:e!==void 0}),C=(0,G.useDeferredValue)(S.data??null),w=S.isError,T=L(e=>e.memberValues),E=(0,G.useMemo)(()=>e?T.get(e):void 0,[T,e]),D=L(e=>e.models),O=L(e=>e.instances),k=(0,G.useMemo)(()=>O.find(t=>t.id===e),[O,e]),ie=(0,G.useMemo)(()=>k?.activeFaults??[],[k]),A=(0,G.useRef)(new Map),j=L(e=>e.tick);(0,G.useEffect)(()=>{if(!E||!e)return;let t=A.current;for(let[e,n]of E){if(typeof n.value!=`number`)continue;let r=t.get(e);r||(r=[],t.set(e,r)),(r.length===0||r[r.length-1]?.tick!==j)&&(r.push({value:n.value,tick:j}),r.length>ze&&r.shift())}},[E,j,e]);let M=(0,G.useMemo)(()=>C?Me(C):[],[C]),P=(0,G.useMemo)(()=>{if(!C)return{operational:[],counters:[],reference:[]};let e=new Set(M.map(([e])=>e)),t=Object.entries(C.members).filter(([t])=>!e.has(t)),n=[],r=[],i=[];for(let e of t){let[,t]=e,a=t.meta.dataType,o=t.meta.kind,s=t.meta.unit,c=s===`pu`&&t.meta.euRange?.[0]===0&&t.meta.euRange?.[1]===1;o===`property`?i.push(e):a===`Boolean`||a===`String`||c?n.push(e):s===`count`||a===`UInt16`||a===`UInt32`?r.push(e):t.meta.access===`readwrite`||Ae.some(t=>e[0].endsWith(t))?n.push(e):s===`pu`||s===`h`?r.push(e):i.push(e)}return{operational:n,counters:r,reference:i}},[C,M]),ae=(0,G.useMemo)(()=>C?D.find(e=>e.name===C.assetType)?.faultNames??[]:[],[C,D]),F=ie??C?.activeFaults??[],I=(0,G.useMemo)(()=>{if(!E)return F.length>0;for(let[,e]of E)if(e.quality!==`good`)return!0;return!1},[E,F.length]),oe=(0,G.useMemo)(()=>P.operational.filter(([,e])=>e.meta.dataType===`String`),[P.operational]),se=(0,G.useMemo)(()=>P.operational.filter(([,e])=>e.meta.dataType!==`String`),[P.operational]),ce=t=>{if(!e)return;let n={},i=C?.methods[t];if(i)for(let e of i.inputArguments){let i=r[t]?.[e.name]??``,a=ge(e.name,i,e.dataType);if(!a)return;n[e.name]=a.value}o(t),y.mutateAsync({type:`invokeMethod`,instanceId:e,method:t,arguments:n}).then(async()=>{await S.refetch()}).catch(()=>{})},le=t=>{e&&y.mutate({type:`triggerFault`,instanceId:e,fault:t})},R=t=>{e&&y.mutate({type:`clearFault`,instanceId:e,fault:t})};if(!C)return w?He(S.error)?(0,K.jsx)(Se,{className:`min-h-full`,children:(0,K.jsx)(`div`,{className:`flex min-h-[40vh] items-center justify-center p-6 sm:p-12`,children:(0,K.jsx)(`div`,{className:`w-full max-w-md`,children:(0,K.jsxs)(f,{eyebrow:`Instance lookup`,stamp:`404`,title:`Instance not found`,detail:e??`Unknown instance id`,detailLabel:`Requested instance`,primaryLabel:`Back to Fleet`,onPrimary:n,children:[(0,K.jsx)(`p`,{children:`The requested asset is no longer in the running fleet or the URL is wrong.`}),(0,K.jsx)(`p`,{children:`Return to Fleet and pick a live instance from the current environment.`})]})})})}):(0,K.jsx)(Se,{className:`min-h-full`,children:(0,K.jsxs)(`div`,{className:`flex min-h-[40vh] flex-col items-center justify-center gap-4 p-6 sm:p-12`,children:[(0,K.jsx)(`div`,{className:`w-full max-w-md`,children:(0,K.jsx)(d,{message:p(S.error,`Could not load instance.`),onRetry:()=>void S.refetch(),isRetrying:S.isFetching})}),(0,K.jsx)(N,{variant:`outline`,size:`sm`,onClick:n,children:`Back to Fleet`})]})}):k?(0,K.jsx)(`div`,{className:Ve,children:(0,K.jsx)(Oe,{detail:{id:k.id,assetType:k.model,browsePath:k.browsePath,lifecycleStage:k.lifecycleStage,operatingHours:k.operatingHours,activeFaults:k.activeFaults,isQuarantined:k.isQuarantined,parameters:{},members:{},methods:{}},tick:j,activeFaults:F,memberValues:E,onBack:n})}):null;let z=P.operational.length>0,B=P.counters.length>0,V=P.reference.length>0||Object.keys(C.parameters).length>0,ve=z||B||V,H=Object.keys(C.methods).length>0,U=z&&!B&&!V,W=z&&B&&V;return(0,K.jsxs)(`div`,{className:Ve,children:[(0,K.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 -z-10 hidden select-none overflow-hidden md:block`,children:(0,K.jsx)(`span`,{className:`absolute -top-2 left-0 whitespace-nowrap uppercase leading-none opacity-35 blur-[2px]`,style:{fontFamily:`var(--miravo-font-heading)`,fontSize:`clamp(5rem, 14vw, 12rem)`,fontWeight:`var(--miravo-weight-medium)`,letterSpacing:`var(--miravo-tracking-heading)`,color:`var(--miravo-ghost)`},children:C.assetType.replace(/_/g,` `)})}),(0,K.jsx)(Oe,{detail:C,tick:j,activeFaults:F,memberValues:E,onBack:n}),(0,K.jsx)(G.ViewTransition,{enter:`fade-in`,default:`none`,children:(0,K.jsxs)(pe,{value:v,onValueChange:e=>{_(e)},className:`min-h-0 flex-1`,children:[(0,K.jsx)(`div`,{className:`shrink-0 overflow-x-auto`,children:(0,K.jsxs)(fe,{variant:`line`,className:`h-10! min-w-max gap-0.5`,children:[(0,K.jsxs)(ue,{value:`hmi`,className:`gap-1.5 px-3 text-sm`,children:[(0,K.jsx)(he,{className:`size-3.5 shrink-0`}),`HMI`]}),(0,K.jsxs)(ue,{value:`operate`,className:`gap-1.5 px-3 text-sm`,children:[(0,K.jsx)(me,{className:`size-3.5 shrink-0`}),`Operate`]})]})}),(0,K.jsx)(de,{value:`hmi`,className:`flex-1 py-2`,children:(0,K.jsx)(m.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.15,ease:`easeOut`},children:(0,K.jsx)(Fe,{detail:C,processVariables:M,memberValues:E,historyRef:A,showQuality:I})},`hmi`)}),(0,K.jsx)(de,{value:`operate`,className:`flex-1 py-2`,children:(0,K.jsxs)(m.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.15,ease:`easeOut`},className:`flex min-w-0 flex-col gap-4`,children:[ve&&(0,K.jsxs)(`section`,{"aria-label":`Data`,className:x(`grid min-w-0 grid-cols-1`,Be,W&&`lg:grid-cols-2 lg:grid-rows-[auto_auto] lg:items-start`,!W&&z&&(B||V)&&`lg:grid-cols-2 lg:items-start`),children:[z&&(0,K.jsx)(Re,{stringEnumMembers:oe,nonStringOperationalMembers:se,memberValues:E,className:x(`min-h-0 min-w-0 self-stretch`,U&&`lg:col-span-2`,W&&`lg:row-span-2`)}),!z&&B&&V&&(0,K.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-col gap-6 lg:col-span-2`,children:[(0,K.jsx)(Z,{counters:P.counters,memberValues:E}),(0,K.jsx)(Q,{detail:C,referenceMembers:P.reference,memberValues:E})]}),!z&&B&&!V&&(0,K.jsx)(Z,{className:`lg:col-span-2`,counters:P.counters,memberValues:E}),!z&&!B&&V&&(0,K.jsx)(Q,{className:`lg:col-span-2`,detail:C,referenceMembers:P.reference,memberValues:E}),z&&B&&(0,K.jsx)(Z,{className:`min-h-0 min-w-0 self-stretch lg:col-start-2 lg:row-start-1`,counters:P.counters,memberValues:E}),z&&V&&(0,K.jsx)(Q,{className:x(`min-h-0 min-w-0 self-stretch lg:col-start-2`,W?`lg:row-start-2`:`lg:row-start-1`),detail:C,referenceMembers:P.reference,memberValues:E})]}),(0,K.jsxs)(`section`,{"aria-label":`Operations`,className:x(_e,`grid grid-cols-1`,H&&`lg:grid-cols-2`),children:[(0,K.jsx)(De,{activeFaults:F,availableFaults:ae,onTriggerFault:le,onClearFault:R}),H&&(0,K.jsx)(`div`,{className:`border-t border-border/50 lg:border-l lg:border-t-0`,children:(0,K.jsx)(Ee,{detail:C,methodArgs:r,setMethodArgs:i,onInvoke:ce,isPending:y.isPending,pendingMethod:a})})]})]},`operate`)})]})}),(0,K.jsx)(We,{open:s,onOpenChange:h})]})}function We({open:e,onOpenChange:t}){return(0,K.jsx)(_,{open:e,onOpenChange:t,children:(0,K.jsxs)(v,{children:[(0,K.jsx)(y,{className:`font-heading text-lg font-semibold tracking-tight`,children:`Keyboard shortcuts`}),(0,K.jsx)(g,{className:`text-sm text-muted-foreground`,children:`Navigate this instance without leaving the keyboard.`}),(0,K.jsx)(`ul`,{className:`flex flex-col gap-2 pt-1`,children:[{keys:[`g`,`f`],label:`Jump to Alarms`},{keys:[`g`,`c`],label:`Jump to Commands`},{keys:[`b`],label:`Back to Fleet`},{keys:[`?`],label:`Show this sheet`}].map(e=>(0,K.jsxs)(`li`,{className:`flex items-center justify-between gap-4`,children:[(0,K.jsx)(`span`,{className:`text-sm text-foreground`,children:e.label}),(0,K.jsx)(`span`,{className:`flex items-center gap-1`,children:e.keys.map((t,n)=>(0,K.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(`kbd`,{className:`rounded-[var(--miravo-radius-tight)] border border-border bg-muted/40 px-1.5 py-0.5 font-mono text-[11px] font-medium text-foreground`,children:t}),n<e.keys.length-1&&(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:`then`})]},`${e.label}-${t}`))})]},e.label))})]})})}export{Ue as InstanceDetailPage};
|
|
1
|
+
import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{a as t,i as n,n as r,r as i,s as a,t as o}from"./vendor-charts-CAZdaPlq.js";import{at as s}from"./vendor-ui-mizMYESS.js";import{_ as c,a as l}from"./api-BjnU1LXi.js";import{a as u,n as d,r as f,t as p}from"./get-error-message-BzBOywwk.js";import{t as m}from"./proxy-CgM57W61.js";import{i as ee,r as te}from"./dist-jROhexoH.js";import{c as ne,l as re}from"./chunk-OE4NN4TA-m2UhO8Q2.js";import{a as h,i as g,n as _,r as v,s as y,t as b}from"./copy-button-DYqJP5N8.js";import{n as x,t as S}from"./createLucideIcon-Yddw9eHa.js";import{i as C,n as w,t as T}from"./tooltip-TtanriwA.js";import{C as E,E as D,S as O,c as k,d as ie,g as A,l as j,m as M,n as N,p as P,t as ae,u as F,v as I,y as oe}from"./input-BCiRHEmc.js";import{r as L}from"./engine-store-BUO-9Dsh.js";import{t as se}from"./activity-DP0Us3HU.js";import{a as ce,c as le,i as ue,n as de,o as R,r as fe,s as z,t as pe}from"./tabs-BgPF8MSY.js";import{c as me,l as he,o as ge,s as B}from"./validation-BTuAJAb2.js";import{a as _e,c as V,o as ve,t as ye}from"./use-engine-command-mutation--eob_QrP.js";import{t as H}from"./triangle-alert-DPtblpQC.js";import{t as U}from"./badge-tnWgSITj.js";import{t as be}from"./query-keys-Co1J4HmV.js";import{t as xe}from"./transition-types-CMW7IObN.js";import{n as Se}from"./auth-screen-backdrop-OrOL41MR.js";var W=S(`layers-2`,[[`path`,{d:`M13 13.74a2 2 0 0 1-2 0L2.5 8.87a1 1 0 0 1 0-1.74L11 2.26a2 2 0 0 1 2 0l8.5 4.87a1 1 0 0 1 0 1.74z`,key:`15q6uc`}],[`path`,{d:`m20 14.285 1.5.845a1 1 0 0 1 0 1.74L13 21.74a2 2 0 0 1-2 0l-8.5-4.87a1 1 0 0 1 0-1.74l1.5-.845`,key:`byia6g`}]]),Ce=S(`signal`,[[`path`,{d:`M2 20h.01`,key:`4haj6o`}],[`path`,{d:`M7 20v-4`,key:`j294jx`}],[`path`,{d:`M12 20v-8`,key:`i3yub9`}],[`path`,{d:`M17 20V8`,key:`1tkaf5`}],[`path`,{d:`M22 4v16`,key:`sih9yq`}]]),we=S(`timer`,[[`line`,{x1:`10`,x2:`14`,y1:`2`,y2:`2`,key:`14vaq8`}],[`line`,{x1:`12`,x2:`15`,y1:`14`,y2:`11`,key:`17fdiu`}],[`circle`,{cx:`12`,cy:`14`,r:`8`,key:`1e1u0o`}]]),G=e(a(),1),K=s(),q=`bg-transparent bg-transparent`,J=`blueprint-title text-foreground`;function Te(e,t){return t.includes(`rpm`)||t.includes(`speed`)?`e.g. 2500`:t.includes(`temp`)?`e.g. 70.0`:t.includes(`pressure`)?`e.g. 4.5`:e===`Boolean`?`true / false`:e===`String`?`value`:`e.g. 100`}function Ee({detail:e,methodArgs:t,setMethodArgs:n,onInvoke:r,isPending:i=!1,pendingMethod:a=null}){let o=Object.entries(e.methods);if(o.length===0)return null;let s=o.filter(([,e])=>e.inputArguments.length===0),c=o.filter(([,e])=>e.inputArguments.length>0);return(0,K.jsxs)(`div`,{id:`commands`,className:`flex min-w-0 flex-col gap-3 p-4`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,K.jsx)(`h2`,{className:J,children:`Commands`}),(0,K.jsx)(`p`,{className:`text-[10px] text-muted-foreground/75`,children:`Executable methods on this asset`})]}),s.length>0&&(0,K.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:s.map(([e,t])=>{let n=a===e&&i,o=n?R:V;return t.description?(0,K.jsxs)(T,{children:[(0,K.jsx)(C,{render:(0,K.jsxs)(N,{size:`sm`,variant:`outline`,disabled:i,title:e,className:x(`h-8 gap-1.5 font-mono text-xs`,q),onClick:()=>r(e),children:[(0,K.jsx)(o,{className:x(`size-3`,n&&`animate-spin`),"aria-hidden":!0}),P(e)]})}),(0,K.jsx)(w,{side:`bottom`,className:`max-w-xs`,children:t.description})]},e):(0,K.jsxs)(N,{size:`sm`,variant:`outline`,disabled:i,title:e,className:x(`h-8 gap-1.5 font-mono text-xs`,q),onClick:()=>r(e),children:[(0,K.jsx)(o,{className:x(`size-3`,n&&`animate-spin`),"aria-hidden":!0}),P(e)]},e)})}),c.length>0&&s.length>0&&(0,K.jsx)(B,{className:`bg-border/60`}),c.map(([e,o])=>{let s=a===e&&i;return(0,K.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`p`,{title:e,className:`font-mono text-sm font-medium`,children:P(e)}),o.description&&(0,K.jsx)(`p`,{className:`mt-0.5 text-[10px] text-muted-foreground`,children:o.description})]}),(0,K.jsxs)(N,{size:`sm`,variant:`default`,disabled:i,className:`shrink-0`,onClick:()=>r(e),children:[s?(0,K.jsx)(R,{className:`mr-1 size-3 animate-spin`,"aria-hidden":!0}):(0,K.jsx)(V,{className:`mr-1 size-3`,"aria-hidden":!0}),`Execute`]})]}),(0,K.jsx)(`div`,{className:`mt-3 flex flex-col gap-1.5 border-t border-border/50 pt-3`,children:o.inputArguments.map(r=>(0,K.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,K.jsx)(`span`,{title:r.name,className:`w-28 shrink-0 truncate pt-1.5 font-mono text-[10px] leading-tight text-muted-foreground`,children:P(r.name)}),(0,K.jsx)(ae,{className:`h-7 flex-1 font-mono text-xs`,placeholder:Te(r.dataType,r.name),value:t[e]?.[r.name]??``,onChange:t=>n(n=>({...n,[e]:{...n[e],[r.name]:t.target.value}}))})]},r.name))})]},e)})]})}function De({activeFaults:e,availableFaults:t,onTriggerFault:n,onClearFault:r}){let i=e.length>0,[a,o]=(0,G.useState)(null);return(0,K.jsxs)(`div`,{id:`faults`,className:`flex min-w-0 flex-col gap-3 p-4`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,K.jsx)(`h2`,{className:J,children:`Alarms`}),(0,K.jsx)(`p`,{className:`text-[10px] text-muted-foreground/75`,children:`Active faults and injectable failure modes (environment)`})]}),i?(0,K.jsx)(`div`,{className:`flex flex-col gap-2`,children:e.map(e=>(0,K.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-[var(--miravo-radius-tight)] border border-destructive/30 bg-transparent py-2.5 pl-3 pr-2 sm:flex-row sm:items-center sm:justify-between`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(H,{className:`size-4 shrink-0 text-destructive`}),(0,K.jsx)(`span`,{title:e,className:`font-mono text-sm font-medium text-destructive`,children:P(e)})]}),(0,K.jsxs)(N,{size:`sm`,variant:`outline`,className:x(`h-8 shrink-0 gap-1 border-destructive/30 px-2.5 font-mono text-[0.75rem] text-destructive shadow-none`,`hover:border-destructive/45 hover:bg-destructive/5 hover:text-destructive`,`focus-visible:border-destructive/40 focus-visible:ring-destructive/20`,q),onClick:()=>r(e),children:[(0,K.jsx)(z,{className:`size-3.5`,"aria-hidden":!0}),`Clear`]})]},e))}):(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,K.jsx)(le,{className:`size-4 text-success`}),`All clear — no active faults`]}),t.length>0&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(B,{className:`bg-border/60`}),(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`p`,{className:x(J,`mb-2`),children:[`Inject fault`,(0,K.jsxs)(U,{variant:`secondary`,className:`ml-2 text-[10px]`,children:[t.filter(t=>!e.includes(t)).length,` available`]})]}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.filter(t=>!e.includes(t)).map(e=>(0,K.jsx)(N,{size:`sm`,variant:`outline`,title:e,className:x(`h-7 font-mono text-[10px]`,q),onClick:()=>o(e),children:P(e)},e))})]})]}),(0,K.jsx)(_,{open:a!==null,onOpenChange:e=>{e||o(null)},children:(0,K.jsxs)(v,{children:[(0,K.jsx)(y,{className:`font-heading text-lg font-semibold tracking-tight`,children:`Inject fault?`}),(0,K.jsxs)(g,{className:`text-sm text-muted-foreground`,children:[`This asserts`,` `,(0,K.jsx)(`span`,{title:a??void 0,className:`font-mono text-foreground`,children:a?P(a):``}),` `,`on the running environment. Downstream consumers will see the fault immediately. Clear it from the active list when you're done.`]}),(0,K.jsxs)(h,{children:[(0,K.jsx)(N,{variant:`outline`,onClick:()=>o(null),children:`Cancel`}),(0,K.jsxs)(N,{variant:`destructive`,onClick:()=>{a&&n(a),o(null)},children:[(0,K.jsx)(H,{className:`mr-1 size-3.5`,"aria-hidden":!0}),`Inject fault`]})]})]})})]})}function Oe({detail:e,tick:t,activeFaults:n,memberValues:r,onBack:i}){let a=n.length,o=e.isQuarantined,s=`OK`,c=`ok`;a>0?(s=`FAULT`,c=`bad`):o&&(s=`QRTN`,c=`warn`);let l=0;if(r)for(let e of r.values())e.quality!==`good`&&l++;let u=Object.keys(e.members).length,d=r?.get(`availability_state`)?.value,f=e.members.availability_state?.value,p=typeof d==`string`?d:typeof f==`string`?f:`unknown`,m=p===`running`?{dot:`bg-success`,pulse:`bg-success/60`,animate:!0}:p===`faulted`?{dot:`bg-destructive`,pulse:`bg-destructive/60`,animate:!0}:p===`stopped`?{dot:`bg-warning`,pulse:`bg-warning/60`,animate:!0}:{dot:`bg-muted-foreground/60`,pulse:`bg-muted-foreground/50`,animate:!1},ee=p===`running`?`Availability state is running — the asset is available and in service.`:p===`faulted`?`Availability state is faulted — the asset is unavailable because a fault is active.`:p===`stopped`?`Availability state is stopped — the asset is available but not running.`:`Availability state is not available for this asset yet.`;return(0,K.jsxs)(`header`,{className:x(ve,`flex w-full min-w-0 flex-col`),children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-3 px-5 py-4 sm:flex-row sm:items-start sm:justify-between sm:gap-4`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1 text-[10px] font-medium uppercase tracking-wider text-muted-foreground`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:i,className:`transition-colors hover:text-foreground`,children:`Fleet`}),(0,K.jsx)(`span`,{"aria-hidden":!0,children:`/`}),(0,K.jsx)(`span`,{className:`truncate`,children:A(e.assetType)})]}),(0,K.jsx)(G.ViewTransition,{name:`instance-${e.id}`,default:`none`,children:(0,K.jsx)(`h1`,{className:`font-heading mt-1 text-2xl font-semibold uppercase leading-tight tracking-wide`,children:M(e.id)})}),(0,K.jsxs)(`div`,{className:`mt-1.5 flex min-w-0 items-center gap-1.5`,children:[(0,K.jsx)(`p`,{className:`m-0 min-w-0 flex-1 font-mono text-[10px] leading-tight tracking-tight text-muted-foreground`,children:(0,K.jsx)(`span`,{className:`break-all`,children:e.browsePath.join(` / `)})}),(0,K.jsx)(`span`,{className:`inline-flex shrink-0`,children:(0,K.jsx)(b,{value:ie(e.browsePath),label:`Copy Topic / UNS path`})})]})]}),(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 self-end font-mono text-xs sm:self-start`,children:[(0,K.jsx)(ce,{className:`size-3.5 animate-pulse text-primary`,"aria-hidden":!0}),(0,K.jsx)(`span`,{className:`font-medium text-primary`,children:`LIVE`}),(0,K.jsxs)(`span`,{className:`tabular-nums text-muted-foreground`,children:[`t=`,t]}),(0,K.jsxs)(T,{children:[(0,K.jsx)(C,{render:(0,K.jsx)(`span`,{className:`inline-flex size-3.5 items-center justify-center outline-none focus-visible:ring-2 focus-visible:ring-ring`}),children:(0,K.jsxs)(`span`,{"aria-hidden":!0,className:`relative flex size-1.5 shrink-0 items-center justify-center`,children:[(0,K.jsx)(`span`,{className:x(`relative inline-flex size-1.5 rounded-full`,m.dot)}),m.animate&&(0,K.jsx)(`span`,{className:x(`absolute inline-flex size-2.5 animate-ping rounded-full opacity-75`,m.pulse)})]})}),(0,K.jsx)(w,{side:`top`,align:`end`,children:(0,K.jsxs)(`span`,{className:`block max-w-[16rem] text-[11px] leading-snug`,children:[(0,K.jsx)(`span`,{className:`font-medium uppercase tracking-[0.08em]`,children:`Availability`}),` `,(0,K.jsxs)(`span`,{className:`text-muted-foreground`,children:[`— `,ee]})]})})]})]})]}),(0,K.jsxs)(`fieldset`,{"aria-label":`Instance status`,className:`m-0 flex flex-col border-0 border-t border-border/50 p-0`,children:[(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-px bg-transparent`,children:[(0,K.jsx)(Y,{variant:`primary`,icon:se,label:`Health`,value:s,tone:c,tooltip:`Rolls up active faults and quarantine into a single status — OK when nothing is asserted, FAULT when any fault is active, QRTN when the asset is excluded from the running fleet.`}),(0,K.jsx)(Y,{variant:`primary`,icon:H,label:`Active faults`,labelCompact:`Faults`,value:String(a),tone:a>0?`bad`:`neutral`,tooltip:`Fault codes currently asserted on this asset. Clear or inject faults from the Alarms section below.`})]}),(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-px border-t border-border/50 bg-transparent sm:grid-cols-4`,children:[(0,K.jsx)(Y,{variant:`compact`,icon:W,label:`Lifecycle`,labelCompact:`Life`,value:P(e.lifecycleStage),tone:D(e.lifecycleStage),tooltip:`Where this asset sits in its operational lifecycle (e.g. commissioning, operating, maintenance, retired).`}),(0,K.jsx)(Y,{variant:`compact`,icon:he,label:`Tags`,value:String(u),tone:`neutral`,tooltip:`Total members exposed by this asset — process variables, state flags, counters, commands, and reference fields combined.`}),(0,K.jsx)(Y,{variant:`compact`,icon:Ce,label:`Bad quality`,value:String(l),tone:l>0?`warn`:`neutral`,tooltip:`Members whose quality stamp is anything other than good (uncertain or bad). A healthy asset reads 0.`}),(0,K.jsx)(Y,{variant:`compact`,icon:we,label:`Operating age`,value:oe(e.operatingHours),tone:`neutral`,tooltip:`Total operating age on this asset, including any environment-seeded starting hours plus simulated runtime elapsed in this session.`})]})]})]})}function Y({icon:e,label:t,labelCompact:n,value:r,suffix:i,tone:a,variant:o=`compact`,tooltip:s}){let c=o===`primary`;return(0,K.jsxs)(`div`,{className:x(`relative flex min-w-0 flex-col justify-center`,c?`min-h-20 gap-1.5 px-4 py-4 sm:min-h-24 sm:px-6 sm:py-5 lg:min-h-28 lg:px-8`:`min-h-12 gap-1 px-3 py-2.5 sm:min-h-13 sm:px-4 lg:min-h-14 lg:px-5`),children:[(0,K.jsx)(`div`,{className:`flex min-h-0 min-w-0 items-center gap-2`,children:(0,K.jsxs)(T,{children:[(0,K.jsxs)(C,{className:`flex min-h-0 min-w-0 flex-1 cursor-default items-center gap-2 text-left`,render:(0,K.jsx)(`div`,{}),children:[(0,K.jsx)(e,{className:x(`shrink-0 text-muted-foreground`,c?`size-4`:`size-3.5`),"aria-hidden":!0}),(0,K.jsxs)(`span`,{className:x(`min-w-0 flex-1 font-medium tracking-wide text-muted-foreground uppercase 2xl:tracking-wider`,c?`text-[11px] leading-snug sm:text-[12px]`:`text-[9px] leading-snug sm:text-[10px]`),children:[(0,K.jsx)(`span`,{className:`block wrap-break-word 2xl:hidden`,children:n??t}),(0,K.jsx)(`span`,{className:`hidden wrap-break-word 2xl:block`,children:t})]})]}),(0,K.jsx)(w,{side:`top`,align:`start`,sideOffset:6,className:`max-w-xs`,children:(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsx)(`span`,{className:`font-medium text-foreground`,children:t}),(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:s??t})]})})]})}),(0,K.jsxs)(`p`,{className:x(`min-w-0 wrap-break-word font-mono font-semibold leading-tight tracking-tight tabular-nums`,c?`text-2xl sm:text-3xl lg:text-4xl`:`text-base lg:text-lg`,a===`ok`&&`text-success`,a===`warn`&&`text-warning`,a===`bad`&&`text-destructive`,a===`neutral`&&`text-foreground`),children:[r,i?(0,K.jsx)(`span`,{className:x(`ml-0.5 font-medium text-muted-foreground`,c?`text-base lg:text-lg`:`text-xs lg:text-sm`),children:i}):null]})]})}function X({title:e,subtitle:t,children:n,className:r,id:i}){return(0,K.jsxs)(`section`,{id:i,className:x(_e,r),children:[(0,K.jsxs)(`div`,{className:`border-b border-border/60 px-4 py-3`,children:[(0,K.jsx)(`h2`,{className:`blueprint-title text-foreground`,children:e}),t?(0,K.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:t}):null]}),(0,K.jsx)(`div`,{className:`overflow-hidden p-0`,children:n})]})}function Z({className:e,counters:t,memberValues:n}){return(0,K.jsx)(X,{title:`Counters`,subtitle:`Totals, hours, and accumulators`,className:e,children:(0,K.jsx)(`div`,{className:`flex flex-col gap-2 p-4`,children:t.map(([e,t])=>{let r=n?.get(e),i=r?r.value:t.value;return(0,K.jsxs)(`div`,{className:`flex items-center justify-between rounded-[var(--miravo-radius-tight)] border border-border/60 bg-transparent px-3 py-2`,children:[(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:O(e)}),(0,K.jsxs)(`span`,{className:`blueprint-stat text-sm font-medium`,children:[typeof i==`number`?I(i):String(i),t.meta.unit&&(0,K.jsx)(`span`,{className:`ml-1 text-[10px] text-muted-foreground`,children:E(t.meta.unit)})]})]},e)})})})}function Q({className:e,detail:t,referenceMembers:n,memberValues:r}){let i=Object.keys(t.parameters).length>0,a=n.length>0;return!i&&!a?null:(0,K.jsx)(X,{title:`Nameplate & configuration`,subtitle:`Design parameters, identity, and reference values`,className:e,children:(0,K.jsxs)(`div`,{className:`flex flex-col gap-4 p-4`,children:[i&&(0,K.jsx)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-3`,children:Object.entries(t.parameters).map(([e,t])=>(0,K.jsxs)(`div`,{className:`flex flex-col gap-0.5 py-1.5`,children:[(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:O(e)}),(0,K.jsxs)(`span`,{className:`font-mono text-sm font-medium`,children:[typeof t.value==`number`?I(t.value):String(t.value),t.unit&&(0,K.jsx)(`span`,{className:`ml-1 text-[10px] text-muted-foreground`,children:E(t.unit)})]})]},e))}),a&&(0,K.jsx)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-3`,children:n.map(([e,t])=>{let n=r?.get(e),i=n?n.value:t.value;return(0,K.jsxs)(`div`,{className:`flex flex-col gap-0.5 rounded-[var(--miravo-radius-tight)] border border-border/60 bg-transparent p-2`,children:[(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:O(e)}),(0,K.jsxs)(`span`,{className:`font-mono text-sm font-medium`,children:[typeof i==`number`?I(i):String(i),t.meta.unit&&(0,K.jsx)(`span`,{className:`ml-1 text-[10px] text-muted-foreground`,children:E(t.meta.unit)})]})]},e)})})]})})}var ke=new Set([`pu`,`h`]),Ae=[`_reference`,`_baseline`,`_setpoint`,`_command`],$=`var(--color-primary)`,je=`var(--color-background)`;function Me(e){return Object.entries(e.members).filter(([e,t])=>t.meta.kind===`variable`&&t.meta.access===`read`&&t.meta.dataType===`Double`&&t.meta.euRange!==null&&!ke.has(t.meta.unit??``)&&!Ae.some(t=>e.endsWith(t)))}function Ne(e){if(e.length<3)return!1;let t=e[0]?.value??0;return e.some(e=>Math.abs(e.value-t)>.001)}function Pe({data:e,chartHeight:a=34}){let s=(0,G.useId)(),[c,l]=(0,G.useState)(null),u=e.map(e=>e.value),d=Math.min(...u),f=Math.max(...u);return(0,K.jsxs)(`div`,{className:`flex min-h-0 w-full flex-col overflow-hidden`,style:{height:a+14},children:[(0,K.jsx)(`div`,{style:{height:a,width:`100%`},children:(0,K.jsx)(n,{width:`100%`,height:a,children:(0,K.jsxs)(o,{data:e,margin:{top:2,right:2,bottom:2,left:0},onMouseMove:e=>{let t=e?.activePayload?.[0]?.value;typeof t==`number`&&l(t)},onMouseLeave:()=>l(null),children:[(0,K.jsx)(`defs`,{children:(0,K.jsxs)(`linearGradient`,{id:s,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,K.jsx)(`stop`,{offset:`0%`,stopColor:$,stopOpacity:.3}),(0,K.jsx)(`stop`,{offset:`100%`,stopColor:$,stopOpacity:0})]})}),(0,K.jsx)(r,{domain:[`auto`,`auto`],hide:!0}),(0,K.jsx)(t,{content:()=>null,cursor:!1}),(0,K.jsx)(i,{type:`monotone`,dataKey:`value`,stroke:$,strokeWidth:1.5,fill:`url(#${s})`,isAnimationActive:!1,dot:!1,activeDot:{r:3,fill:$,stroke:je,strokeWidth:1}})]})})}),(0,K.jsx)(`span`,{className:`text-[10px] leading-none tabular-nums text-muted-foreground`,children:c===null?(0,K.jsxs)(K.Fragment,{children:[I(d),`–`,I(f)]}):(0,K.jsx)(`span`,{className:`font-medium text-primary`,children:I(c)})})]})}function Fe({detail:e,processVariables:t,memberValues:n,historyRef:r,showQuality:i}){let a=(0,G.useMemo)(()=>[...t].sort(([e],[t])=>{let n=r.current.get(e)??[],i=r.current.get(t)??[],a=n.length>2&&Ne(n);return a===(i.length>2&&Ne(i))?0:a?-1:1}),[t,n,r]);return t.length===0?(0,K.jsx)(X,{title:`Process`,subtitle:`No continuous analog readings defined for this asset`,className:`opacity-90`,children:(0,K.jsx)(`p`,{className:`px-4 py-6 text-center text-sm text-muted-foreground`,children:`This asset exposes no continuous process variables. Discrete states, flags, and commands are available in the Tags section below.`})}):(0,K.jsx)(X,{title:`Process`,subtitle:`Live tag readings — trend is ~2 min at 1 Hz`,children:(0,K.jsx)(`ul`,{className:`divide-y divide-border/40`,children:a.map(([t,a])=>{let o=n?.get(t),s=o?o.value:a.value,c=o?o.quality:a.quality,l=r.current.get(t)??[],u=F(e.browsePath,t),d=l.length>2&&Ne(l),f=E(a.meta.unit),p=O(t);return(0,K.jsxs)(m.li,{layout:!0,transition:{duration:.32,ease:[.22,1,.36,1]},className:`flex flex-col gap-2.5 bg-background px-4 py-3 sm:flex-row sm:items-center sm:gap-5 sm:py-3.5`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1 sm:w-44 sm:shrink-0`,children:[(0,K.jsxs)(T,{children:[(0,K.jsx)(C,{className:`min-w-0 flex-1 cursor-default truncate text-left text-[11px] font-medium uppercase tracking-[var(--miravo-tracking-eyebrow)] text-muted-foreground`,render:(0,K.jsx)(`span`,{}),children:p}),(0,K.jsx)(w,{side:`top`,align:`start`,className:`max-w-xs`,children:p})]}),(0,K.jsx)(b,{value:u,label:`Copy Topic / UNS path`})]}),(0,K.jsxs)(`div`,{className:`relative h-[56px] min-w-0 flex-1`,children:[(0,K.jsx)(`div`,{"aria-hidden":!0,className:`absolute inset-x-0 top-1/2 h-px -translate-y-1/2 bg-border/30`}),d?(0,K.jsx)(Pe,{data:l,chartHeight:42}):(0,K.jsx)(`p`,{className:`flex h-full items-center text-[10px] uppercase tracking-widest text-muted-foreground`,children:l.length<=2?`Collecting trend…`:`No change (last 2 min)`})]}),(0,K.jsxs)(`div`,{className:`flex items-baseline gap-2 sm:min-w-36 sm:shrink-0 sm:justify-end`,children:[(0,K.jsx)(`span`,{className:`blueprint-stat text-2xl font-semibold leading-none tabular-nums text-foreground`,children:typeof s==`number`?I(s):String(s)}),f&&(0,K.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:f}),i&&c!==`good`&&(0,K.jsx)(U,{variant:c===`uncertain`?`secondary`:`destructive`,className:`shrink-0 text-[10px]`,children:c})]})]},t)})})})}function Ie({name:e,value:t,dataType:n,unit:r,access:i}){let a=O(e),o=i===`readwrite`;if(n===`Boolean`||typeof t==`boolean`||r===`pu`&&(t===0||t===1)){let n=t===!0||t===`true`||t===1,r=e.includes(`fault`);return(0,K.jsxs)(`div`,{className:`flex min-h-9 min-w-0 items-center justify-between gap-2 rounded-[var(--miravo-radius-tight)] border px-2 py-1 ${r&&n?`border-destructive/30 bg-transparent`:``}`,children:[(0,K.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-left text-[10px] leading-snug text-muted-foreground`,children:[a,o&&(0,K.jsx)(`span`,{className:`ml-1 text-[8px] text-primary`,children:`CMD`})]}),(0,K.jsx)(`span`,{className:`shrink-0 font-mono text-xs font-medium tabular-nums ${r&&n?`text-destructive`:n?`text-success`:`text-muted-foreground`}`,children:n?`ON`:`OFF`})]})}if(n===`String`){let n=String(t),r=n===`none`||n===``,i=k.has(n)||e.includes(`fault_code`)&&!r,o=!i&&j.has(n);return(0,K.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-col justify-center gap-1 rounded-[var(--miravo-radius-tight)] border px-2 py-2 ${i?`border-destructive/30 bg-transparent`:o?`border-warning/30 bg-warning/5`:``}`,children:[(0,K.jsx)(`span`,{className:`wrap-break-word text-[10px] leading-tight text-muted-foreground`,children:a}),r?(0,K.jsx)(`span`,{className:`wrap-break-word font-mono text-sm font-medium leading-snug text-muted-foreground`,children:`—`}):(0,K.jsx)(`span`,{title:n,className:`wrap-break-word font-mono text-sm font-medium leading-snug ${i?`text-destructive`:o?`text-warning`:`text-foreground`}`,children:P(n)})]})}return(0,K.jsxs)(`div`,{className:`flex min-h-9 min-w-0 items-center justify-between gap-2 rounded-[var(--miravo-radius-tight)] border px-2 py-1`,children:[(0,K.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-left text-[10px] leading-snug text-muted-foreground`,children:[a,o&&(0,K.jsx)(`span`,{className:`ml-1 text-[8px] text-primary`,children:`CMD`})]}),(0,K.jsxs)(`span`,{className:`shrink-0 text-right font-mono text-xs font-medium tabular-nums`,children:[typeof t==`number`?I(t):String(t),r&&(0,K.jsx)(`span`,{className:`ml-1 text-[10px] text-muted-foreground`,children:E(r)})]})]})}function Le(e){return[...e].sort((e,t)=>{let n=e[1].meta.access===`readwrite`;return n===(t[1].meta.access===`readwrite`)?e[0].localeCompare(t[0]):n?-1:1})}function Re({stringEnumMembers:e,nonStringOperationalMembers:t,memberValues:n,className:r}){let i=(0,G.useMemo)(()=>Le(e),[e]),a=(0,G.useMemo)(()=>Le(t),[t]),o=`grid min-w-0 gap-2 [grid-template-columns:repeat(auto-fill,minmax(min(100%,12.5rem),1fr))]`;return(0,K.jsx)(X,{title:`Tags`,subtitle:`Mode, status flags, and control tags`,className:r,children:(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-5 p-4`,children:[i.length>0&&(0,K.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[a.length>0&&(0,K.jsx)(`h3`,{className:`blueprint-title text-muted-foreground`,children:`States`}),(0,K.jsx)(`div`,{className:o,children:i.map(([e,t])=>{let r=n?.get(e);return(0,K.jsx)(Ie,{name:e,value:r?r.value:t.value,dataType:t.meta.dataType,unit:t.meta.unit,access:t.meta.access},e)})})]}),a.length>0&&(0,K.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[i.length>0&&(0,K.jsx)(`h3`,{className:`blueprint-title text-muted-foreground`,children:`Flags & commands`}),(0,K.jsx)(`div`,{className:o,children:a.map(([e,t])=>{let r=n?.get(e);return(0,K.jsx)(Ie,{name:e,value:r?r.value:t.value,dataType:t.meta.dataType,unit:t.meta.unit,access:t.meta.access},e)})})]})]})})}var ze=120,Be=`gap-4 sm:gap-5 lg:gap-x-6 lg:gap-y-5 xl:gap-x-8`,Ve=`instance-detail-page relative isolate mx-auto flex min-h-full w-full max-w-screen-2xl flex-col gap-6 p-4 sm:gap-8 sm:p-6`;function He(e){return e instanceof Error&&`code`in e&&e.code===`NOT_FOUND`?!0:e instanceof Error&&/^404\b/.test(e.message.trim())}function Ue(){let{id:e}=re(),t=ne(),n=(0,G.useCallback)(()=>{(0,G.startTransition)(()=>{(0,G.addTransitionType)(xe),t(`/`)})},[t]),[r,i]=(0,G.useState)({}),[a,o]=(0,G.useState)(null),[s,h]=(0,G.useState)(!1),[g,_]=ee(`tab`,te([`hmi`,`operate`,`data`,`operations`]).withDefault(`hmi`)),v=g===`data`||g===`operations`?`operate`:g,y=ye();(0,G.useEffect)(()=>{y.isPending||o(null)},[y.isPending]),(0,G.useEffect)(()=>{(g===`data`||g===`operations`)&&_(`operate`)},[g,_]);let b=(0,G.useCallback)(e=>{_(`operate`),requestAnimationFrame(()=>{requestAnimationFrame(()=>{document.getElementById(e)?.scrollIntoView({behavior:`smooth`,block:`start`})})})},[_]);(0,G.useEffect)(()=>{let e=null,t=!1,r=()=>{t=!1,e&&=(clearTimeout(e),null)},i=i=>{if(i.metaKey||i.ctrlKey||i.altKey)return;let a=i.target;if(a){let e=a.tagName;if(e===`INPUT`||e===`TEXTAREA`||e===`SELECT`||a.isContentEditable)return}if(t){i.key===`f`?(b(`faults`),i.preventDefault()):i.key===`c`&&(b(`commands`),i.preventDefault()),r();return}if(i.key===`g`){t=!0,e=setTimeout(r,1200);return}i.key===`b`&&!i.shiftKey?(n(),i.preventDefault()):i.key===`?`&&(h(!0),i.preventDefault())};return window.addEventListener(`keydown`,i),()=>{window.removeEventListener(`keydown`,i),r()}},[n,b]);let S=u({queryKey:be.instances.detail(e??``),queryFn:()=>l(`/instances/${e}`,c.instanceDetail),enabled:e!==void 0}),C=(0,G.useDeferredValue)(S.data??null),w=S.isError,T=L(e=>e.memberValues),E=(0,G.useMemo)(()=>e?T.get(e):void 0,[T,e]),D=L(e=>e.models),O=L(e=>e.instances),k=(0,G.useMemo)(()=>O.find(t=>t.id===e),[O,e]),ie=(0,G.useMemo)(()=>k?.activeFaults??[],[k]),A=(0,G.useRef)(new Map),j=L(e=>e.tick);(0,G.useEffect)(()=>{if(!E||!e)return;let t=A.current;for(let[e,n]of E){if(typeof n.value!=`number`)continue;let r=t.get(e);r||(r=[],t.set(e,r)),(r.length===0||r[r.length-1]?.tick!==j)&&(r.push({value:n.value,tick:j}),r.length>ze&&r.shift())}},[E,j,e]);let M=(0,G.useMemo)(()=>C?Me(C):[],[C]),P=(0,G.useMemo)(()=>{if(!C)return{operational:[],counters:[],reference:[]};let e=new Set(M.map(([e])=>e)),t=Object.entries(C.members).filter(([t])=>!e.has(t)),n=[],r=[],i=[];for(let e of t){let[,t]=e,a=t.meta.dataType,o=t.meta.kind,s=t.meta.unit,c=s===`pu`&&t.meta.euRange?.[0]===0&&t.meta.euRange?.[1]===1;o===`property`?i.push(e):a===`Boolean`||a===`String`||c?n.push(e):s===`count`||a===`UInt16`||a===`UInt32`?r.push(e):t.meta.access===`readwrite`||Ae.some(t=>e[0].endsWith(t))?n.push(e):s===`pu`||s===`h`?r.push(e):i.push(e)}return{operational:n,counters:r,reference:i}},[C,M]),ae=(0,G.useMemo)(()=>C?D.find(e=>e.name===C.assetType)?.faultNames??[]:[],[C,D]),F=ie??C?.activeFaults??[],I=(0,G.useMemo)(()=>{if(!E)return F.length>0;for(let[,e]of E)if(e.quality!==`good`)return!0;return!1},[E,F.length]),oe=(0,G.useMemo)(()=>P.operational.filter(([,e])=>e.meta.dataType===`String`),[P.operational]),se=(0,G.useMemo)(()=>P.operational.filter(([,e])=>e.meta.dataType!==`String`),[P.operational]),ce=t=>{if(!e)return;let n={},i=C?.methods[t];if(i)for(let e of i.inputArguments){let i=r[t]?.[e.name]??``,a=ge(e.name,i,e.dataType);if(!a)return;n[e.name]=a.value}o(t),y.mutateAsync({type:`invokeMethod`,instanceId:e,method:t,arguments:n}).then(async()=>{await S.refetch()}).catch(()=>{})},le=t=>{e&&y.mutate({type:`triggerFault`,instanceId:e,fault:t})},R=t=>{e&&y.mutate({type:`clearFault`,instanceId:e,fault:t})};if(!C)return w?He(S.error)?(0,K.jsx)(Se,{className:`min-h-full`,children:(0,K.jsx)(`div`,{className:`flex min-h-[40vh] items-center justify-center p-6 sm:p-12`,children:(0,K.jsx)(`div`,{className:`w-full max-w-md`,children:(0,K.jsxs)(f,{eyebrow:`Instance lookup`,stamp:`404`,title:`Instance not found`,detail:e??`Unknown instance id`,detailLabel:`Requested instance`,primaryLabel:`Back to Fleet`,onPrimary:n,children:[(0,K.jsx)(`p`,{children:`The requested asset is no longer in the running fleet or the URL is wrong.`}),(0,K.jsx)(`p`,{children:`Return to Fleet and pick a live instance from the current environment.`})]})})})}):(0,K.jsx)(Se,{className:`min-h-full`,children:(0,K.jsxs)(`div`,{className:`flex min-h-[40vh] flex-col items-center justify-center gap-4 p-6 sm:p-12`,children:[(0,K.jsx)(`div`,{className:`w-full max-w-md`,children:(0,K.jsx)(d,{message:p(S.error,`Could not load instance.`),onRetry:()=>void S.refetch(),isRetrying:S.isFetching})}),(0,K.jsx)(N,{variant:`outline`,size:`sm`,onClick:n,children:`Back to Fleet`})]})}):k?(0,K.jsx)(`div`,{className:Ve,children:(0,K.jsx)(Oe,{detail:{id:k.id,assetType:k.model,browsePath:k.browsePath,lifecycleStage:k.lifecycleStage,operatingHours:k.operatingHours,activeFaults:k.activeFaults,isQuarantined:k.isQuarantined,parameters:{},members:{},methods:{}},tick:j,activeFaults:F,memberValues:E,onBack:n})}):null;let z=P.operational.length>0,B=P.counters.length>0,V=P.reference.length>0||Object.keys(C.parameters).length>0,ve=z||B||V,H=Object.keys(C.methods).length>0,U=z&&!B&&!V,W=z&&B&&V;return(0,K.jsxs)(`div`,{className:Ve,children:[(0,K.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 -z-10 hidden select-none overflow-hidden md:block`,children:(0,K.jsx)(`span`,{className:`absolute -top-2 left-0 whitespace-nowrap uppercase leading-none opacity-35 blur-[2px]`,style:{fontFamily:`var(--miravo-font-heading)`,fontSize:`clamp(5rem, 14vw, 12rem)`,fontWeight:`var(--miravo-weight-medium)`,letterSpacing:`var(--miravo-tracking-heading)`,color:`var(--miravo-ghost)`},children:C.assetType.replace(/_/g,` `)})}),(0,K.jsx)(Oe,{detail:C,tick:j,activeFaults:F,memberValues:E,onBack:n}),(0,K.jsx)(G.ViewTransition,{enter:`fade-in`,default:`none`,children:(0,K.jsxs)(pe,{value:v,onValueChange:e=>{_(e)},className:`min-h-0 flex-1`,children:[(0,K.jsx)(`div`,{className:`shrink-0 overflow-x-auto`,children:(0,K.jsxs)(fe,{variant:`line`,className:`h-10! min-w-max gap-0.5`,children:[(0,K.jsxs)(ue,{value:`hmi`,className:`gap-1.5 px-3 text-sm`,children:[(0,K.jsx)(he,{className:`size-3.5 shrink-0`}),`HMI`]}),(0,K.jsxs)(ue,{value:`operate`,className:`gap-1.5 px-3 text-sm`,children:[(0,K.jsx)(me,{className:`size-3.5 shrink-0`}),`Operate`]})]})}),(0,K.jsx)(de,{value:`hmi`,className:`flex-1 py-2`,children:(0,K.jsx)(m.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.15,ease:`easeOut`},children:(0,K.jsx)(Fe,{detail:C,processVariables:M,memberValues:E,historyRef:A,showQuality:I})},`hmi`)}),(0,K.jsx)(de,{value:`operate`,className:`flex-1 py-2`,children:(0,K.jsxs)(m.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.15,ease:`easeOut`},className:`flex min-w-0 flex-col gap-4`,children:[ve&&(0,K.jsxs)(`section`,{"aria-label":`Data`,className:x(`grid min-w-0 grid-cols-1`,Be,W&&`lg:grid-cols-2 lg:grid-rows-[auto_auto] lg:items-start`,!W&&z&&(B||V)&&`lg:grid-cols-2 lg:items-start`),children:[z&&(0,K.jsx)(Re,{stringEnumMembers:oe,nonStringOperationalMembers:se,memberValues:E,className:x(`min-h-0 min-w-0 self-stretch`,U&&`lg:col-span-2`,W&&`lg:row-span-2`)}),!z&&B&&V&&(0,K.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-col gap-6 lg:col-span-2`,children:[(0,K.jsx)(Z,{counters:P.counters,memberValues:E}),(0,K.jsx)(Q,{detail:C,referenceMembers:P.reference,memberValues:E})]}),!z&&B&&!V&&(0,K.jsx)(Z,{className:`lg:col-span-2`,counters:P.counters,memberValues:E}),!z&&!B&&V&&(0,K.jsx)(Q,{className:`lg:col-span-2`,detail:C,referenceMembers:P.reference,memberValues:E}),z&&B&&(0,K.jsx)(Z,{className:`min-h-0 min-w-0 self-stretch lg:col-start-2 lg:row-start-1`,counters:P.counters,memberValues:E}),z&&V&&(0,K.jsx)(Q,{className:x(`min-h-0 min-w-0 self-stretch lg:col-start-2`,W?`lg:row-start-2`:`lg:row-start-1`),detail:C,referenceMembers:P.reference,memberValues:E})]}),(0,K.jsxs)(`section`,{"aria-label":`Operations`,className:x(_e,`grid grid-cols-1`,H&&`lg:grid-cols-2`),children:[(0,K.jsx)(De,{activeFaults:F,availableFaults:ae,onTriggerFault:le,onClearFault:R}),H&&(0,K.jsx)(`div`,{className:`border-t border-border/50 lg:border-l lg:border-t-0`,children:(0,K.jsx)(Ee,{detail:C,methodArgs:r,setMethodArgs:i,onInvoke:ce,isPending:y.isPending,pendingMethod:a})})]})]},`operate`)})]})}),(0,K.jsx)(We,{open:s,onOpenChange:h})]})}function We({open:e,onOpenChange:t}){return(0,K.jsx)(_,{open:e,onOpenChange:t,children:(0,K.jsxs)(v,{children:[(0,K.jsx)(y,{className:`font-heading text-lg font-semibold tracking-tight`,children:`Keyboard shortcuts`}),(0,K.jsx)(g,{className:`text-sm text-muted-foreground`,children:`Navigate this instance without leaving the keyboard.`}),(0,K.jsx)(`ul`,{className:`flex flex-col gap-2 pt-1`,children:[{keys:[`g`,`f`],label:`Jump to Alarms`},{keys:[`g`,`c`],label:`Jump to Commands`},{keys:[`b`],label:`Back to Fleet`},{keys:[`?`],label:`Show this sheet`}].map(e=>(0,K.jsxs)(`li`,{className:`flex items-center justify-between gap-4`,children:[(0,K.jsx)(`span`,{className:`text-sm text-foreground`,children:e.label}),(0,K.jsx)(`span`,{className:`flex items-center gap-1`,children:e.keys.map((t,n)=>(0,K.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(`kbd`,{className:`rounded-[var(--miravo-radius-tight)] border border-border bg-muted/40 px-1.5 py-0.5 font-mono text-[11px] font-medium text-foreground`,children:t}),n<e.keys.length-1&&(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:`then`})]},`${e.label}-${t}`))})]},e.label))})]})})}export{Ue as InstanceDetailPage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{s as t}from"./vendor-charts-CAZdaPlq.js";import{at as n}from"./vendor-ui-mizMYESS.js";import{c as r,g as i,r as a}from"./api-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{s as t}from"./vendor-charts-CAZdaPlq.js";import{at as n}from"./vendor-ui-mizMYESS.js";import{c as r,g as i,r as a}from"./api-BjnU1LXi.js";import{t as o}from"./use-transition-navigate-Dp3qkQ87.js";import{t as s}from"./transition-nav-link-99H9mlJO.js";var c=e(t(),1),l=n(),u=`
|
|
2
2
|
@keyframes readout-appear {
|
|
3
3
|
from { opacity: 0; transform: translateY(8px) scale(0.95); }
|
|
4
4
|
to { opacity: 1; transform: translateY(0) scale(1); }
|
|
@@ -129,4 +129,4 @@ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{s as t}from"./vendor-c
|
|
|
129
129
|
color: var(--foreground);
|
|
130
130
|
text-decoration-color: var(--tooltip-border);
|
|
131
131
|
}
|
|
132
|
-
`;function d(e,t){return`color-mix(in srgb, ${e} ${t*100}%, transparent)`}function f({label:e,forId:t,children:n}){return(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{htmlFor:t,style:{fontFamily:`var(--font-mono)`,fontSize:`0.6rem`,color:`var(--muted-foreground)`,display:`block`,marginBottom:`0.5rem`},children:e}),n]})}function p({message:e}){return(0,l.jsx)(`p`,{style:{fontSize:`0.82rem`,color:`var(--destructive)`,textAlign:`center`,padding:`0.55rem 0.9rem`,background:`color-mix(in srgb, var(--destructive) 6%, transparent)`,border:`1px solid color-mix(in srgb, var(--destructive) 12%, transparent)`,borderRadius:4,margin:`0 0 1rem`},children:e})}function m({onChangePassword:e}){let t=o(),[n,a]=(0,c.useState)(``),[s,u]=(0,c.useState)(``),[d,m]=(0,c.useState)(``),[h,g]=(0,c.useState)(!1);async function _(a){a.preventDefault(),m(``),g(!0);try{(await r(n,s)).changePassword?e():(i.removeQueries({queryKey:[`bootstrap`]}),t(`/`,{replace:!0}))}catch(e){m(e instanceof Error?e.message:`Login failed`)}finally{g(!1)}}return(0,l.jsxs)(`form`,{onSubmit:_,children:[(0,l.jsxs)(`div`,{style:{marginBottom:`2rem`},children:[(0,l.jsx)(`div`,{style:{fontFamily:`var(--font-mono)`,fontSize:`0.52rem`,color:`var(--tooltip-border)`,marginBottom:`0.7rem`},children:`SYS.AUTH — OPERATOR LOGIN`}),(0,l.jsx)(`h1`,{style:{fontFamily:`var(--font-heading)`,fontSize:`1.5rem`,fontWeight:800,color:`var(--foreground)`,letterSpacing:`-0.035em`,lineHeight:1.15,margin:0},children:`Log in`}),(0,l.jsx)(`p`,{style:{fontSize:`0.82rem`,color:`var(--muted-foreground)`,marginTop:`0.4rem`,lineHeight:1.5},children:`Authenticate to access the control console`})]}),d&&(0,l.jsx)(p,{message:d}),(0,l.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`1.15rem`},children:[(0,l.jsx)(f,{label:`Username`,forId:`username`,children:(0,l.jsx)(`input`,{id:`username`,type:`text`,className:`miravo-input`,autoComplete:`username`,required:!0,value:n,onChange:e=>a(e.target.value)})}),(0,l.jsx)(f,{label:`Password`,forId:`password`,children:(0,l.jsx)(`input`,{id:`password`,type:`password`,className:`miravo-input`,autoComplete:`current-password`,required:!0,value:s,onChange:e=>u(e.target.value)})}),(0,l.jsx)(`button`,{type:`submit`,className:`miravo-btn`,disabled:h,style:{marginTop:`0.5rem`},children:`Log in`})]})]})}function h(){let e=o(),[t,n]=(0,c.useState)(``),[r,s]=(0,c.useState)(``),[u,d]=(0,c.useState)(``),[m,h]=(0,c.useState)(!1);async function g(n){if(n.preventDefault(),d(``),t!==r){d(`Passwords do not match`);return}if(t.length<6){d(`Password must be at least 6 characters`);return}h(!0);try{await a(`admin`,t),i.removeQueries({queryKey:[`bootstrap`]}),e(`/`,{replace:!0})}catch(e){d(e instanceof Error?e.message:`Password change failed`)}finally{h(!1)}}return(0,l.jsxs)(`form`,{onSubmit:g,children:[(0,l.jsxs)(`div`,{style:{marginBottom:`2rem`},children:[(0,l.jsx)(`div`,{style:{fontFamily:`var(--font-mono)`,fontSize:`0.52rem`,color:`var(--tooltip-border)`,marginBottom:`0.7rem`},children:`SYS.AUTH — PASSWORD RESET`}),(0,l.jsx)(`h1`,{style:{fontFamily:`var(--font-heading)`,fontSize:`1.5rem`,fontWeight:800,color:`var(--foreground)`,letterSpacing:`-0.035em`,lineHeight:1.15,margin:0},children:`Update password`}),(0,l.jsxs)(`p`,{style:{fontSize:`0.82rem`,color:`var(--muted-foreground)`,marginTop:`0.4rem`,lineHeight:1.5},children:[`Default password detected.`,` `,(0,l.jsx)(`span`,{style:{color:`var(--warning)`},children:`Please set a new one.`})]})]}),u&&(0,l.jsx)(p,{message:u}),(0,l.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`1.1rem`},children:[(0,l.jsx)(f,{label:`New password`,forId:`new-password`,children:(0,l.jsx)(`input`,{id:`new-password`,type:`password`,className:`miravo-input`,autoComplete:`new-password`,required:!0,minLength:6,value:t,onChange:e=>n(e.target.value)})}),(0,l.jsx)(f,{label:`Confirm password`,forId:`confirm-password`,children:(0,l.jsx)(`input`,{id:`confirm-password`,type:`password`,className:`miravo-input`,autoComplete:`new-password`,required:!0,minLength:6,value:r,onChange:e=>s(e.target.value)})}),(0,l.jsx)(`button`,{type:`submit`,className:`miravo-btn`,disabled:m,style:{marginTop:`0.4rem`},children:`Set password`}),(0,l.jsx)(`div`,{style:{textAlign:`center`,marginTop:`0.15rem`},children:(0,l.jsx)(`button`,{type:`button`,className:`miravo-btn-ghost`,onClick:()=>{i.removeQueries({queryKey:[`bootstrap`]}),e(`/`,{replace:!0})},children:`Skip for now`})})]})]})}function g(){let e=(0,c.useRef)(null);return(0,c.useEffect)(()=>{let t=e.current;if(!t)return;let n=t.getContext(`2d`);if(!n)return;let r=t,i=n,a=getComputedStyle(document.documentElement).getPropertyValue(`--primary`).trim(),o=window.devicePixelRatio||1,s=0,c=0,l=0,u=!0,f=0,p=[],m=[],h=[];function g(){p=[],m=[],h=[];let e=Math.max(15,Math.floor(s*c/35e3));for(let t=0;t<e;t++)p.push({x:0,y:0,bx:25+Math.random()*(s-50),by:25+Math.random()*(c-50),r:1+Math.random()*1.2,phase:Math.random()*Math.PI*2});for(let e=0;e<p.length;e++)for(let t=e+1;t<p.length;t++){let n=p[e],r=p[t];!n||!r||Math.hypot(n.bx-r.bx,n.by-r.by)<160&&Math.random()>.5&&m.push({from:e,to:t})}}function _(){s=r.offsetWidth,c=r.offsetHeight,r.width=s*o,r.height=c*o,i.setTransform(o,0,0,o,0,0),g()}function v(){if(!u){f=requestAnimationFrame(v);return}l+=.016,i.clearRect(0,0,s,c);for(let e of p)e.x=e.bx+Math.sin(l*.15+e.phase)*5,e.y=e.by+Math.cos(l*.1+e.phase*1.3)*4;let e=new Set;for(let t of h)e.add(`${t.conn.from}-${t.conn.to}`);for(let t of m){let n=p[t.from],r=p[t.to];!n||!r||(i.beginPath(),i.moveTo(n.x,n.y),i.lineTo(r.x,r.y),i.strokeStyle=e.has(`${t.from}-${t.to}`)?d(a,.04):d(a,.012),i.lineWidth=.5,i.stroke())}for(let e of p){let t=.6+Math.sin(l*.4+e.phase)*.4;i.beginPath(),i.arc(e.x,e.y,e.r,0,Math.PI*2),i.fillStyle=d(a,.08*t),i.fill()}if(Math.random()<.03&&m.length&&h.length<10){let e=m[Math.floor(Math.random()*m.length)];e&&h.push({conn:e,t:0,speed:.002+Math.random()*.003,alpha:.25+Math.random()*.35,size:1+Math.random()*1})}for(let e=h.length-1;e>=0;e--){let t=h[e];if(!t)continue;if(t.t+=t.speed,t.t>=1){h.splice(e,1);continue}let n=p[t.conn.from],r=p[t.conn.to];if(!n||!r)continue;let o=n.x+(r.x-n.x)*t.t,s=n.y+(r.y-n.y)*t.t;i.beginPath(),i.arc(o,s,t.size,0,Math.PI*2),i.fillStyle=d(a,t.alpha*.35),i.fill()}f=requestAnimationFrame(v)}let y=()=>{u=!document.hidden},b,x=()=>{window.clearTimeout(b),b=window.setTimeout(_,250)};return document.addEventListener(`visibilitychange`,y),window.addEventListener(`resize`,x),_(),v(),()=>{cancelAnimationFrame(f),window.clearTimeout(b),document.removeEventListener(`visibilitychange`,y),window.removeEventListener(`resize`,x)}},[]),(0,l.jsx)(`canvas`,{ref:e,style:{position:`absolute`,inset:0,width:`100%`,height:`100%`}})}var _=[{path:`pump-001/temp`,base:87.3,range:5,decimals:1,unit:`°C`,style:{left:`6%`,top:`18%`},delay:`1.4s`},{path:`comp/pressure`,base:4.21,range:.5,decimals:2,unit:`bar`,style:{right:`5%`,top:`12%`},delay:`1.7s`},{path:`motor/vibration`,base:2.14,range:.3,decimals:2,unit:`mm/s`,style:{left:`4%`,bottom:`18%`},delay:`2.0s`},{path:`gen/power`,base:482,range:20,decimals:0,unit:`kW`,style:{right:`4%`,bottom:`17%`},delay:`2.3s`},{path:`boiler/temp`,base:312,range:8,decimals:0,unit:`°C`,style:{left:`22%`,top:`8%`},delay:`2.6s`},{path:`turb/rpm`,base:1480,range:30,decimals:0,unit:`rpm`,style:{left:0,right:0,marginLeft:`auto`,marginRight:`auto`,width:`max-content`,bottom:`10%`},delay:`2.9s`}];function v(){let[e,t]=(0,c.useState)(()=>_.map(e=>({...e,displayValue:(e.base+(Math.random()-.5)*e.range).toFixed(e.decimals),flash:!1})));return(0,c.useEffect)(()=>{let e={id:void 0},n=window.setInterval(()=>{t(e=>e.map(e=>({...e,displayValue:(e.base+(Math.random()-.5)*e.range).toFixed(e.decimals),flash:!0}))),window.clearTimeout(e.id),e.id=window.setTimeout(()=>{t(e=>e.map(e=>({...e,flash:!1})))},400)},2200);return()=>{window.clearInterval(n),window.clearTimeout(e.id)}},[]),(0,l.jsx)(`div`,{style:{position:`absolute`,inset:0,zIndex:3,pointerEvents:`none`},children:e.map(e=>(0,l.jsxs)(`div`,{style:{position:`absolute`,...e.style,display:`flex`,alignItems:`center`,gap:`0.45rem`,padding:`0.32rem 0.7rem`,background:`color-mix(in srgb, var(--background) 70%, transparent)`,backdropFilter:`blur(6px)`,WebkitBackdropFilter:`blur(6px)`,border:`1px solid color-mix(in srgb, var(--primary) 8%, transparent)`,borderRadius:4,fontFamily:`var(--font-mono)`,fontSize:`0.61rem`,letterSpacing:`0.02em`,opacity:0,animation:`readout-appear 0.6s cubic-bezier(0.22,1,0.36,1) ${e.delay} forwards`},children:[(0,l.jsx)(`span`,{style:{width:4,height:4,borderRadius:`50%`,background:`var(--primary)`,boxShadow:`0 0 3px color-mix(in srgb, var(--primary) 18%, transparent)`,animation:`dot-pulse 2.5s ease-in-out infinite`,flexShrink:0,display:`block`}}),(0,l.jsx)(`span`,{style:{color:`var(--tooltip-border)`},children:e.path}),(0,l.jsx)(`span`,{style:{color:e.flash?`#f5c542`:`var(--primary)`,fontWeight:600,minWidth:`3em`,textAlign:`right`,transition:`color 0.4s`},children:e.displayValue}),(0,l.jsx)(`span`,{style:{color:`var(--tooltip-border)`,fontSize:`0.54rem`},children:e.unit})]},e.path))})}var y=`miravo start --template smart-factory`,b=6,x=[{id:`sf`,indent:``,label:`site`,text:`smart-factory`},{id:`l1`,indent:` `,label:`area`,text:`line-1`},{id:`p001`,indent:` `,label:`cell`,text:`pump-001`},{id:`p001-t`,indent:` `,text:`temperature`,value:{base:87.3,range:5,decimals:1,unit:`°C`},protocol:`mqtt`},{id:`p001-p`,indent:` `,text:`pressure`,value:{base:4.21,range:.5,decimals:2,unit:`bar`},protocol:`opcua`},{id:`p001-v`,indent:` `,text:`vibration`,value:{base:2.14,range:.3,decimals:2,unit:`mm/s`},protocol:`modbus`},{id:`b002`,indent:` `,label:`cell`,text:`boiler-002`},{id:`b002-t`,indent:` `,text:`temperature`,value:{base:312,range:8,decimals:0,unit:`°C`},protocol:`mqtt`},{id:`c003`,indent:` `,label:`cell`,text:`comp-003`},{id:`c003-r`,indent:` `,text:`rpm`,value:{base:1480,range:30,decimals:0,unit:`rpm`},protocol:`modbus`},{id:`l2`,indent:` `,label:`area`,text:`line-2`},{id:`t004`,indent:` `,label:`cell`,text:`tank-004`},{id:`t004-l`,indent:` `,text:`level`,value:{base:72.1,range:5,decimals:1,unit:`%`},protocol:`mqtt`},{id:`m005`,indent:` `,label:`cell`,text:`motor-005`},{id:`m005-c`,indent:` `,text:`current`,value:{base:12.4,range:1.5,decimals:1,unit:`A`},protocol:`opcua`}],S=14,C=x.flatMap((e,t)=>e.value?[t]:[]),w=4+x.length,T=.66,E=1.85,D=2.1+w*T*E+1.15*T,O=[{assetId:`p001`,name:`cavitation`,event:`fault:cavitation on pump-001 — pressure drop`,resolve:`fault:resolved on pump-001 — nominal`,overrides:[{tagId:`p001-t`,base:95.2,range:3},{tagId:`p001-p`,base:1.83,range:.3},{tagId:`p001-v`,base:8.71,range:1.5}]},{assetId:`c003`,name:`bearing-wear`,event:`lifecycle:degraded on comp-003 — rpm declining`,resolve:`lifecycle:restored on comp-003 — nominal`,overrides:[{tagId:`c003-r`,base:924,range:40}]},{assetId:`m005`,name:`overcurrent`,event:`fault:overcurrent on motor-005 — current spike`,resolve:`fault:resolved on motor-005 — nominal`,overrides:[{tagId:`m005-c`,base:24.8,range:3}]}],k=new Map(x.map((e,t)=>[e.id,t]));function A(){let[e,t]=(0,c.useState)(0),[n,r]=(0,c.useState)(0),[i,a]=(0,c.useState)(()=>x.map(e=>e.value?(e.value.base+(Math.random()-.5)*e.value.range).toFixed(e.value.decimals):``)),[o,s]=(0,c.useState)(new Set),[u,d]=(0,c.useState)(null),[f,p]=(0,c.useState)(`+231 tags streaming`),m=(0,c.useRef)(new Set);(0,c.useEffect)(()=>{let e={timers:[],typeInt:0,liveInt:0,flashT:0},n=(t,n)=>{e.timers.push(window.setTimeout(t,n))},i=0;return n(()=>{e.typeInt=window.setInterval(()=>{if(i++,t(i),i>=37){window.clearInterval(e.typeInt),n(()=>r(1),400),n(()=>r(2),750),n(()=>r(3),1150);for(let e=0;e<x.length;e++)n(()=>r(4+e),1300+e*110);let t=1300+x.length*110+250;n(()=>r(w),t),n(()=>{e.liveInt=window.setInterval(()=>{let t=2+Math.floor(Math.random()*2),n=[...C.filter(e=>!m.current.has(e))].sort(()=>Math.random()-.5).slice(0,t),r=new Set(n);a(e=>{let t=[...e];for(let e of r){let n=x[e]?.value;n&&(t[e]=(n.base+(Math.random()-.5)*n.range).toFixed(n.decimals))}return t}),s(r),window.clearTimeout(e.flashT),e.flashT=window.setTimeout(()=>s(new Set),350)},1600);let t=0,r=()=>{let e=O[t%O.length];if(!e)return;let i=new Set(e.overrides.map(e=>k.get(e.tagId)).filter(e=>e!==void 0));m.current=i,d({assetId:e.assetId,name:e.name,indices:i}),p(e.event),a(t=>{let n=[...t];for(let t of e.overrides){let e=k.get(t.tagId);if(e!==void 0){let r=x[e];n[e]=(t.base+(Math.random()-.5)*t.range).toFixed(r?.value?.decimals??1)}}return n}),n(()=>{m.current=new Set,d(null),p(e.resolve),a(t=>{let n=[...t];for(let t of e.overrides){let e=k.get(t.tagId);if(e!==void 0){let t=x[e];t?.value&&(n[e]=(t.value.base+(Math.random()-.5)*t.value.range).toFixed(t.value.decimals))}}return n}),n(()=>{p(`+231 tags streaming`),t++,n(r,8e3)},4e3)},1e4)};n(r,8e3)},t+500)}},32)},200),()=>{for(let t of e.timers)window.clearTimeout(t);window.clearInterval(e.typeInt),window.clearInterval(e.liveInt),window.clearTimeout(e.flashT)}},[]);let h=y.slice(0,Math.min(e,b)),g=e>b?y.slice(b,e):``;return(0,l.jsx)(`div`,{style:{position:`absolute`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,zIndex:5,pointerEvents:`none`},children:(0,l.jsxs)(`div`,{style:{border:`1px solid color-mix(in srgb, var(--primary) 10%, transparent)`,borderRadius:4,boxShadow:`none`,overflow:`hidden`,width:540},children:[(0,l.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,padding:`0.5rem 0.85rem`,background:`color-mix(in srgb, var(--sidebar) 50%, transparent)`,backdropFilter:`blur(8px)`,WebkitBackdropFilter:`blur(8px)`,borderBottom:`1px solid color-mix(in srgb, var(--primary) 6%, transparent)`},children:[(0,l.jsx)(`span`,{style:{width:7,height:7,borderRadius:`50%`,background:`#ff5f57`,opacity:.5}}),(0,l.jsx)(`span`,{style:{width:7,height:7,borderRadius:`50%`,background:`#febc2e`,opacity:.5}}),(0,l.jsx)(`span`,{style:{width:7,height:7,borderRadius:`50%`,background:`#28c840`,opacity:.5}}),(0,l.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,fontSize:`0.5rem`,color:`var(--tooltip-foreground)`,marginLeft:`auto`,letterSpacing:`0.04em`,opacity:.5},children:`Build realistic industrial environments`})]}),(0,l.jsxs)(`div`,{style:{height:`min(${D}rem, calc(100vh - 11rem))`,overflowY:`auto`,overflowX:`hidden`,background:`color-mix(in srgb, var(--card) 60%, transparent)`,padding:`1rem 1.25rem 1.1rem`,fontFamily:`var(--font-mono)`,fontSize:`${T}rem`,lineHeight:E,whiteSpace:`pre`},children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`span`,{style:{color:`var(--muted-foreground)`},children:`$ `}),(0,l.jsx)(`span`,{style:{color:`var(--primary)`},children:h}),(0,l.jsx)(`span`,{style:{color:`var(--foreground)`,opacity:.9},children:g}),e>0&&e<37&&(0,l.jsx)(`span`,{style:{display:`inline-block`,width:5,height:10,background:`var(--primary)`,verticalAlign:`text-bottom`,marginLeft:1,animation:`cursor-blink 1s step-end infinite`}})]}),n>=1&&(0,l.jsxs)(`div`,{style:{opacity:0,animation:`terminal-line 0.4s ease forwards`},children:[(0,l.jsx)(`span`,{style:{color:`var(--primary)`},children:`✓`}),(0,l.jsx)(`span`,{style:{color:`var(--tooltip-foreground)`},children:` Loaded `}),(0,l.jsx)(`span`,{style:{color:`var(--primary)`},children:`smart-factory`}),(0,l.jsx)(`span`,{style:{color:`var(--muted-foreground)`},children:` — 10 assets · 240 tags`})]}),n>=2&&(0,l.jsxs)(`div`,{style:{opacity:0,animation:`terminal-line 0.4s ease 0.05s forwards`},children:[(0,l.jsx)(`span`,{style:{color:`var(--primary)`},children:`✓`}),(0,l.jsx)(`span`,{style:{color:`var(--tooltip-foreground)`},children:` Protocols `}),(0,l.jsx)(`span`,{style:{color:`var(--muted-foreground)`},children:`mqtt :1883 · opcua :4840 · modbus :502`})]}),n>=3&&(0,l.jsx)(`div`,{style:{opacity:0,animation:`terminal-line 0.3s ease forwards`,marginTop:`0.6em`}}),x.map((e,t)=>{if(n<4+t)return null;let r=!!e.value;return(0,l.jsxs)(`div`,{style:{opacity:0,animation:`tree-line 0.3s ease forwards`},children:[(0,l.jsx)(`span`,{style:{color:`var(--tooltip-border)`},children:e.indent}),r&&e.value?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`span`,{style:{color:`var(--muted-foreground)`},children:e.text.padEnd(S)}),(0,l.jsx)(`span`,{style:{color:u?.indices.has(t)?`var(--destructive)`:o.has(t)?`var(--primary)`:`var(--foreground)`,transition:`color 0.3s`},children:(i[t]??``).padStart(7)}),(0,l.jsx)(`span`,{style:{color:`var(--tooltip-border)`},children:` ${e.value.unit.padEnd(5)}`}),e.protocol&&(0,l.jsx)(`span`,{style:{color:`var(--tooltip-border)`},children:e.protocol})]}):(0,l.jsxs)(l.Fragment,{children:[e.label&&(0,l.jsx)(`span`,{style:{color:`var(--tooltip-border)`},children:`${e.label}: `}),(0,l.jsx)(`span`,{style:{color:`var(--tooltip-foreground)`},children:e.text}),e.label===`cell`&&u?.assetId===e.id&&(0,l.jsxs)(`span`,{style:{marginLeft:`0.8em`,color:`var(--destructive)`,fontSize:`0.9em`},children:[`— `,u.name]})]})]},e.id)}),n>=w&&(0,l.jsx)(`div`,{style:{opacity:0,animation:`terminal-line 0.4s ease forwards`,marginTop:`0.55em`,textAlign:`right`},children:(0,l.jsx)(`span`,{style:{color:f.includes(`resolved`)||f.includes(`restored`)||f.includes(`fault:`)||f.includes(`lifecycle:`)?`var(--muted-foreground)`:`var(--tooltip-border)`,transition:`color 0.4s`},children:f})})]})]})})}function j(){let[e,t]=(0,c.useState)(!1);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`style`,{children:u}),(0,l.jsxs)(`div`,{className:`login-page`,children:[(0,l.jsxs)(`div`,{style:{background:`var(--background)`,backgroundImage:`radial-gradient(circle, color-mix(in srgb, var(--primary) 2.2%, transparent) 1px, transparent 1px)`,backgroundSize:`70px 70px`,display:`flex`,flexDirection:`column`,position:`relative`,overflow:`hidden`},children:[(0,l.jsx)(`div`,{style:{position:`absolute`,bottom:-80,right:-80,width:400,height:400,background:`radial-gradient(circle, color-mix(in srgb, var(--primary) 3.5%, transparent) 0%, transparent 65%)`,pointerEvents:`none`}}),(0,l.jsxs)(`div`,{className:`login-topbar`,style:{padding:`1.25rem 2rem`,borderBottom:`1px solid var(--secondary)`,zIndex:1,display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:[(0,l.jsxs)(s,{to:`/`,style:{display:`inline-flex`,alignItems:`center`,gap:`0.6rem`,textDecoration:`none`},children:[(0,l.jsx)(`img`,{src:`/miravo-logo.webp`,alt:`Miravo`,loading:`lazy`,decoding:`async`,style:{width:24,height:24,objectFit:`contain`}}),(0,l.jsx)(`span`,{style:{fontFamily:`var(--font-heading)`,fontSize:`0.95rem`,fontWeight:700,color:`var(--foreground)`,letterSpacing:`-0.02em`},children:`Miravo`}),(0,l.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,fontSize:`0.52rem`,fontWeight:600,color:`var(--primary)`,background:`color-mix(in srgb, var(--primary) 6%, transparent)`,border:`1px solid color-mix(in srgb, var(--primary) 14%, transparent)`,padding:`0.15rem 0.5rem`,borderRadius:4,lineHeight:1,display:`inline-flex`,alignItems:`center`},children:`Console`})]}),(0,l.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`0.4rem`,fontFamily:`var(--font-mono)`,fontSize:`0.5rem`,color:`var(--tooltip-border)`},children:[(0,l.jsx)(`span`,{style:{width:5,height:5,borderRadius:`50%`,background:`var(--primary)`,display:`block`,animation:`status-blink 3s ease-in-out infinite`}}),`System active`]})]}),(0,l.jsx)(`div`,{className:`login-form-area`,style:{flex:1,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`2.5rem 2rem`,zIndex:1},children:(0,l.jsx)(`div`,{style:{width:`100%`,maxWidth:370},children:(0,l.jsxs)(`div`,{className:`login-card`,style:{position:`relative`,background:`var(--card)`,border:`1px solid color-mix(in srgb, var(--secondary) 80%, transparent)`,borderRadius:4,overflow:`hidden`,padding:`2.25rem`},children:[(0,l.jsx)(`div`,{style:{position:`absolute`,top:0,left:14,right:14,height:1,background:`linear-gradient(90deg, transparent, color-mix(in srgb, var(--primary) 35%, transparent) 20%, color-mix(in srgb, var(--primary) 35%, transparent) 80%, transparent)`}}),e?(0,l.jsx)(h,{}):(0,l.jsx)(m,{onChangePassword:()=>t(!0)})]})})}),(0,l.jsxs)(`div`,{className:`login-footer`,style:{padding:`0.9rem 2rem`,borderTop:`1px solid var(--secondary)`,display:`flex`,justifyContent:`space-between`,alignItems:`center`,zIndex:1},children:[(0,l.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,fontSize:`0.6rem`,color:`var(--tooltip-border)`,letterSpacing:`0.04em`},children:`Miravo Console`}),(0,l.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,fontSize:`0.6rem`,color:`var(--tooltip-border)`,letterSpacing:`0.04em`},children:`© 2026`})]})]}),(0,l.jsxs)(`div`,{className:`login-left`,style:{position:`relative`,background:`var(--background)`,overflow:`hidden`,borderRight:`1px solid color-mix(in srgb, var(--primary) 8%, transparent)`},children:[(0,l.jsx)(`div`,{style:{position:`absolute`,inset:0,zIndex:9999,pointerEvents:`none`,opacity:.025,backgroundImage:`url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E")`,backgroundSize:`200px 200px`}}),(0,l.jsx)(g,{}),(0,l.jsx)(`div`,{style:{position:`absolute`,inset:0,zIndex:1,background:`radial-gradient(ellipse 75% 70% at 50% 50%, transparent 40%, color-mix(in srgb, var(--background) 55%, transparent) 100%)`,pointerEvents:`none`}}),(0,l.jsx)(`div`,{style:{position:`absolute`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,width:700,height:500,background:`radial-gradient(ellipse at center, color-mix(in srgb, var(--primary) 1.8%, transparent) 0%, transparent 65%)`,pointerEvents:`none`,zIndex:2,animation:`login-glow-pulse 8s ease-in-out infinite alternate`}}),(0,l.jsx)(v,{}),(0,l.jsx)(A,{}),(0,l.jsxs)(`div`,{style:{position:`absolute`,top:`1.2rem`,right:`1.2rem`,zIndex:10,display:`flex`,alignItems:`center`,gap:`0.4rem`,padding:`0.3rem 0.65rem`,background:`color-mix(in srgb, var(--background) 65%, transparent)`,backdropFilter:`blur(6px)`,WebkitBackdropFilter:`blur(6px)`,border:`1px solid color-mix(in srgb, var(--primary) 10%, transparent)`,borderRadius:4,fontFamily:`var(--font-mono)`,fontSize:`0.5rem`,color:`var(--muted-foreground)`,pointerEvents:`none`},children:[(0,l.jsx)(`span`,{style:{width:5,height:5,borderRadius:`50%`,background:`var(--primary)`,display:`block`,animation:`live-dot 2s ease-in-out infinite`}}),`Live topology`]})]})]})]})}export{j as LoginPage};
|
|
132
|
+
`;function d(e,t){return`color-mix(in srgb, ${e} ${t*100}%, transparent)`}function f({label:e,forId:t,children:n}){return(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{htmlFor:t,style:{fontFamily:`var(--font-mono)`,fontSize:`0.6rem`,color:`var(--muted-foreground)`,display:`block`,marginBottom:`0.5rem`},children:e}),n]})}function p({message:e}){return(0,l.jsx)(`p`,{style:{fontSize:`0.82rem`,color:`var(--destructive)`,textAlign:`center`,padding:`0.55rem 0.9rem`,background:`color-mix(in srgb, var(--destructive) 6%, transparent)`,border:`1px solid color-mix(in srgb, var(--destructive) 12%, transparent)`,borderRadius:4,margin:`0 0 1rem`},children:e})}function m({onChangePassword:e}){let t=o(),[n,a]=(0,c.useState)(``),[s,u]=(0,c.useState)(``),[d,m]=(0,c.useState)(``),[h,g]=(0,c.useState)(!1);async function _(a){a.preventDefault(),m(``),g(!0);try{(await r(n,s)).changePassword?e():(i.removeQueries({queryKey:[`bootstrap`]}),t(`/`,{replace:!0}))}catch(e){m(e instanceof Error?e.message:`Login failed`)}finally{g(!1)}}return(0,l.jsxs)(`form`,{onSubmit:_,children:[(0,l.jsxs)(`div`,{style:{marginBottom:`2rem`},children:[(0,l.jsx)(`div`,{style:{fontFamily:`var(--font-mono)`,fontSize:`0.52rem`,color:`var(--tooltip-border)`,marginBottom:`0.7rem`},children:`SYS.AUTH — OPERATOR LOGIN`}),(0,l.jsx)(`h1`,{style:{fontFamily:`var(--font-heading)`,fontSize:`1.5rem`,fontWeight:800,color:`var(--foreground)`,letterSpacing:`-0.035em`,lineHeight:1.15,margin:0},children:`Log in`}),(0,l.jsx)(`p`,{style:{fontSize:`0.82rem`,color:`var(--muted-foreground)`,marginTop:`0.4rem`,lineHeight:1.5},children:`Authenticate to access the control console`})]}),d&&(0,l.jsx)(p,{message:d}),(0,l.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`1.15rem`},children:[(0,l.jsx)(f,{label:`Username`,forId:`username`,children:(0,l.jsx)(`input`,{id:`username`,type:`text`,className:`miravo-input`,autoComplete:`username`,required:!0,value:n,onChange:e=>a(e.target.value)})}),(0,l.jsx)(f,{label:`Password`,forId:`password`,children:(0,l.jsx)(`input`,{id:`password`,type:`password`,className:`miravo-input`,autoComplete:`current-password`,required:!0,value:s,onChange:e=>u(e.target.value)})}),(0,l.jsx)(`button`,{type:`submit`,className:`miravo-btn`,disabled:h,style:{marginTop:`0.5rem`},children:`Log in`})]})]})}function h(){let e=o(),[t,n]=(0,c.useState)(``),[r,s]=(0,c.useState)(``),[u,d]=(0,c.useState)(``),[m,h]=(0,c.useState)(!1);async function g(n){if(n.preventDefault(),d(``),t!==r){d(`Passwords do not match`);return}if(t.length<6){d(`Password must be at least 6 characters`);return}h(!0);try{await a(`admin`,t),i.removeQueries({queryKey:[`bootstrap`]}),e(`/`,{replace:!0})}catch(e){d(e instanceof Error?e.message:`Password change failed`)}finally{h(!1)}}return(0,l.jsxs)(`form`,{onSubmit:g,children:[(0,l.jsxs)(`div`,{style:{marginBottom:`2rem`},children:[(0,l.jsx)(`div`,{style:{fontFamily:`var(--font-mono)`,fontSize:`0.52rem`,color:`var(--tooltip-border)`,marginBottom:`0.7rem`},children:`SYS.AUTH — PASSWORD RESET`}),(0,l.jsx)(`h1`,{style:{fontFamily:`var(--font-heading)`,fontSize:`1.5rem`,fontWeight:800,color:`var(--foreground)`,letterSpacing:`-0.035em`,lineHeight:1.15,margin:0},children:`Update password`}),(0,l.jsxs)(`p`,{style:{fontSize:`0.82rem`,color:`var(--muted-foreground)`,marginTop:`0.4rem`,lineHeight:1.5},children:[`Default password detected.`,` `,(0,l.jsx)(`span`,{style:{color:`var(--warning)`},children:`Please set a new one.`})]})]}),u&&(0,l.jsx)(p,{message:u}),(0,l.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`1.1rem`},children:[(0,l.jsx)(f,{label:`New password`,forId:`new-password`,children:(0,l.jsx)(`input`,{id:`new-password`,type:`password`,className:`miravo-input`,autoComplete:`new-password`,required:!0,minLength:6,value:t,onChange:e=>n(e.target.value)})}),(0,l.jsx)(f,{label:`Confirm password`,forId:`confirm-password`,children:(0,l.jsx)(`input`,{id:`confirm-password`,type:`password`,className:`miravo-input`,autoComplete:`new-password`,required:!0,minLength:6,value:r,onChange:e=>s(e.target.value)})}),(0,l.jsx)(`button`,{type:`submit`,className:`miravo-btn`,disabled:m,style:{marginTop:`0.4rem`},children:`Set password`}),(0,l.jsx)(`div`,{style:{textAlign:`center`,marginTop:`0.15rem`},children:(0,l.jsx)(`button`,{type:`button`,className:`miravo-btn-ghost`,onClick:()=>{i.removeQueries({queryKey:[`bootstrap`]}),e(`/`,{replace:!0})},children:`Skip for now`})})]})]})}function g(){let e=(0,c.useRef)(null);return(0,c.useEffect)(()=>{let t=e.current;if(!t)return;let n=t.getContext(`2d`);if(!n)return;let r=t,i=n,a=getComputedStyle(document.documentElement).getPropertyValue(`--primary`).trim(),o=window.devicePixelRatio||1,s=0,c=0,l=0,u=!0,f=0,p=[],m=[],h=[];function g(){p=[],m=[],h=[];let e=Math.max(15,Math.floor(s*c/35e3));for(let t=0;t<e;t++)p.push({x:0,y:0,bx:25+Math.random()*(s-50),by:25+Math.random()*(c-50),r:1+Math.random()*1.2,phase:Math.random()*Math.PI*2});for(let e=0;e<p.length;e++)for(let t=e+1;t<p.length;t++){let n=p[e],r=p[t];!n||!r||Math.hypot(n.bx-r.bx,n.by-r.by)<160&&Math.random()>.5&&m.push({from:e,to:t})}}function _(){s=r.offsetWidth,c=r.offsetHeight,r.width=s*o,r.height=c*o,i.setTransform(o,0,0,o,0,0),g()}function v(){if(!u){f=requestAnimationFrame(v);return}l+=.016,i.clearRect(0,0,s,c);for(let e of p)e.x=e.bx+Math.sin(l*.15+e.phase)*5,e.y=e.by+Math.cos(l*.1+e.phase*1.3)*4;let e=new Set;for(let t of h)e.add(`${t.conn.from}-${t.conn.to}`);for(let t of m){let n=p[t.from],r=p[t.to];!n||!r||(i.beginPath(),i.moveTo(n.x,n.y),i.lineTo(r.x,r.y),i.strokeStyle=e.has(`${t.from}-${t.to}`)?d(a,.04):d(a,.012),i.lineWidth=.5,i.stroke())}for(let e of p){let t=.6+Math.sin(l*.4+e.phase)*.4;i.beginPath(),i.arc(e.x,e.y,e.r,0,Math.PI*2),i.fillStyle=d(a,.08*t),i.fill()}if(Math.random()<.03&&m.length&&h.length<10){let e=m[Math.floor(Math.random()*m.length)];e&&h.push({conn:e,t:0,speed:.002+Math.random()*.003,alpha:.25+Math.random()*.35,size:1+Math.random()*1})}for(let e=h.length-1;e>=0;e--){let t=h[e];if(!t)continue;if(t.t+=t.speed,t.t>=1){h.splice(e,1);continue}let n=p[t.conn.from],r=p[t.conn.to];if(!n||!r)continue;let o=n.x+(r.x-n.x)*t.t,s=n.y+(r.y-n.y)*t.t;i.beginPath(),i.arc(o,s,t.size,0,Math.PI*2),i.fillStyle=d(a,t.alpha*.35),i.fill()}f=requestAnimationFrame(v)}let y=()=>{u=!document.hidden},b,x=()=>{window.clearTimeout(b),b=window.setTimeout(_,250)};return document.addEventListener(`visibilitychange`,y),window.addEventListener(`resize`,x),_(),v(),()=>{cancelAnimationFrame(f),window.clearTimeout(b),document.removeEventListener(`visibilitychange`,y),window.removeEventListener(`resize`,x)}},[]),(0,l.jsx)(`canvas`,{ref:e,style:{position:`absolute`,inset:0,width:`100%`,height:`100%`}})}var _=[{path:`pump-001/temp`,base:87.3,range:5,decimals:1,unit:`°C`,style:{left:`6%`,top:`18%`},delay:`1.4s`},{path:`comp/pressure`,base:4.21,range:.5,decimals:2,unit:`bar`,style:{right:`5%`,top:`12%`},delay:`1.7s`},{path:`motor/vibration`,base:2.14,range:.3,decimals:2,unit:`mm/s`,style:{left:`4%`,bottom:`18%`},delay:`2.0s`},{path:`gen/power`,base:482,range:20,decimals:0,unit:`kW`,style:{right:`4%`,bottom:`17%`},delay:`2.3s`},{path:`boiler/temp`,base:312,range:8,decimals:0,unit:`°C`,style:{left:`22%`,top:`8%`},delay:`2.6s`},{path:`turb/rpm`,base:1480,range:30,decimals:0,unit:`rpm`,style:{left:0,right:0,marginLeft:`auto`,marginRight:`auto`,width:`max-content`,bottom:`10%`},delay:`2.9s`}];function v(){let[e,t]=(0,c.useState)(()=>_.map(e=>({...e,displayValue:(e.base+(Math.random()-.5)*e.range).toFixed(e.decimals),flash:!1})));return(0,c.useEffect)(()=>{let e={id:void 0},n=window.setInterval(()=>{t(e=>e.map(e=>({...e,displayValue:(e.base+(Math.random()-.5)*e.range).toFixed(e.decimals),flash:!0}))),window.clearTimeout(e.id),e.id=window.setTimeout(()=>{t(e=>e.map(e=>({...e,flash:!1})))},400)},2200);return()=>{window.clearInterval(n),window.clearTimeout(e.id)}},[]),(0,l.jsx)(`div`,{style:{position:`absolute`,inset:0,zIndex:3,pointerEvents:`none`},children:e.map(e=>(0,l.jsxs)(`div`,{style:{position:`absolute`,...e.style,display:`flex`,alignItems:`center`,gap:`0.45rem`,padding:`0.32rem 0.7rem`,background:`color-mix(in srgb, var(--background) 70%, transparent)`,backdropFilter:`blur(6px)`,WebkitBackdropFilter:`blur(6px)`,border:`1px solid color-mix(in srgb, var(--primary) 8%, transparent)`,borderRadius:4,fontFamily:`var(--font-mono)`,fontSize:`0.61rem`,letterSpacing:`0.02em`,opacity:0,animation:`readout-appear 0.6s cubic-bezier(0.22,1,0.36,1) ${e.delay} forwards`},children:[(0,l.jsx)(`span`,{style:{width:4,height:4,borderRadius:`50%`,background:`var(--primary)`,boxShadow:`0 0 3px color-mix(in srgb, var(--primary) 18%, transparent)`,animation:`dot-pulse 2.5s ease-in-out infinite`,flexShrink:0,display:`block`}}),(0,l.jsx)(`span`,{style:{color:`var(--tooltip-border)`},children:e.path}),(0,l.jsx)(`span`,{style:{color:e.flash?`#f5c542`:`var(--primary)`,fontWeight:600,minWidth:`3em`,textAlign:`right`,transition:`color 0.4s`},children:e.displayValue}),(0,l.jsx)(`span`,{style:{color:`var(--tooltip-border)`,fontSize:`0.54rem`},children:e.unit})]},e.path))})}var y=`miravo start --template smart-factory`,b=6,x=[{id:`sf`,indent:``,label:`site`,text:`smart-factory`},{id:`l1`,indent:` `,label:`area`,text:`line-1`},{id:`p001`,indent:` `,label:`cell`,text:`pump-001`},{id:`p001-t`,indent:` `,text:`temperature`,value:{base:87.3,range:5,decimals:1,unit:`°C`},protocol:`mqtt`},{id:`p001-p`,indent:` `,text:`pressure`,value:{base:4.21,range:.5,decimals:2,unit:`bar`},protocol:`opcua`},{id:`p001-v`,indent:` `,text:`vibration`,value:{base:2.14,range:.3,decimals:2,unit:`mm/s`},protocol:`modbus`},{id:`b002`,indent:` `,label:`cell`,text:`boiler-002`},{id:`b002-t`,indent:` `,text:`temperature`,value:{base:312,range:8,decimals:0,unit:`°C`},protocol:`mqtt`},{id:`c003`,indent:` `,label:`cell`,text:`comp-003`},{id:`c003-r`,indent:` `,text:`rpm`,value:{base:1480,range:30,decimals:0,unit:`rpm`},protocol:`modbus`},{id:`l2`,indent:` `,label:`area`,text:`line-2`},{id:`t004`,indent:` `,label:`cell`,text:`tank-004`},{id:`t004-l`,indent:` `,text:`level`,value:{base:72.1,range:5,decimals:1,unit:`%`},protocol:`mqtt`},{id:`m005`,indent:` `,label:`cell`,text:`motor-005`},{id:`m005-c`,indent:` `,text:`current`,value:{base:12.4,range:1.5,decimals:1,unit:`A`},protocol:`opcua`}],S=14,C=x.flatMap((e,t)=>e.value?[t]:[]),w=4+x.length,T=.66,E=1.85,D=2.1+w*T*E+1.15*T,O=[{assetId:`p001`,name:`cavitation`,event:`fault:cavitation on pump-001 — pressure drop`,resolve:`fault:resolved on pump-001 — nominal`,overrides:[{tagId:`p001-t`,base:95.2,range:3},{tagId:`p001-p`,base:1.83,range:.3},{tagId:`p001-v`,base:8.71,range:1.5}]},{assetId:`c003`,name:`bearing-wear`,event:`lifecycle:degraded on comp-003 — rpm declining`,resolve:`lifecycle:restored on comp-003 — nominal`,overrides:[{tagId:`c003-r`,base:924,range:40}]},{assetId:`m005`,name:`overcurrent`,event:`fault:overcurrent on motor-005 — current spike`,resolve:`fault:resolved on motor-005 — nominal`,overrides:[{tagId:`m005-c`,base:24.8,range:3}]}],k=new Map(x.map((e,t)=>[e.id,t]));function A(){let[e,t]=(0,c.useState)(0),[n,r]=(0,c.useState)(0),[i,a]=(0,c.useState)(()=>x.map(e=>e.value?(e.value.base+(Math.random()-.5)*e.value.range).toFixed(e.value.decimals):``)),[o,s]=(0,c.useState)(new Set),[u,d]=(0,c.useState)(null),[f,p]=(0,c.useState)(`+231 tags streaming`),m=(0,c.useRef)(new Set);(0,c.useEffect)(()=>{let e={timers:[],typeInt:0,liveInt:0,flashT:0},n=(t,n)=>{e.timers.push(window.setTimeout(t,n))},i=0;return n(()=>{e.typeInt=window.setInterval(()=>{if(i++,t(i),i>=37){window.clearInterval(e.typeInt),n(()=>r(1),400),n(()=>r(2),750),n(()=>r(3),1150);for(let e=0;e<x.length;e++)n(()=>r(4+e),1300+e*110);let t=1300+x.length*110+250;n(()=>r(w),t),n(()=>{e.liveInt=window.setInterval(()=>{let t=2+Math.floor(Math.random()*2),n=[...C.filter(e=>!m.current.has(e))].sort(()=>Math.random()-.5).slice(0,t),r=new Set(n);a(e=>{let t=[...e];for(let e of r){let n=x[e]?.value;n&&(t[e]=(n.base+(Math.random()-.5)*n.range).toFixed(n.decimals))}return t}),s(r),window.clearTimeout(e.flashT),e.flashT=window.setTimeout(()=>s(new Set),350)},1600);let t=0,r=()=>{let e=O[t%O.length];if(!e)return;let i=new Set(e.overrides.map(e=>k.get(e.tagId)).filter(e=>e!==void 0));m.current=i,d({assetId:e.assetId,name:e.name,indices:i}),p(e.event),a(t=>{let n=[...t];for(let t of e.overrides){let e=k.get(t.tagId);if(e!==void 0){let r=x[e];n[e]=(t.base+(Math.random()-.5)*t.range).toFixed(r?.value?.decimals??1)}}return n}),n(()=>{m.current=new Set,d(null),p(e.resolve),a(t=>{let n=[...t];for(let t of e.overrides){let e=k.get(t.tagId);if(e!==void 0){let t=x[e];t?.value&&(n[e]=(t.value.base+(Math.random()-.5)*t.value.range).toFixed(t.value.decimals))}}return n}),n(()=>{p(`+231 tags streaming`),t++,n(r,8e3)},4e3)},1e4)};n(r,8e3)},t+500)}},32)},200),()=>{for(let t of e.timers)window.clearTimeout(t);window.clearInterval(e.typeInt),window.clearInterval(e.liveInt),window.clearTimeout(e.flashT)}},[]);let h=y.slice(0,Math.min(e,b)),g=e>b?y.slice(b,e):``;return(0,l.jsx)(`div`,{style:{position:`absolute`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,zIndex:5,pointerEvents:`none`},children:(0,l.jsxs)(`div`,{style:{border:`1px solid color-mix(in srgb, var(--primary) 10%, transparent)`,borderRadius:4,boxShadow:`none`,overflow:`hidden`,width:540},children:[(0,l.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,padding:`0.5rem 0.85rem`,background:`color-mix(in srgb, var(--sidebar) 50%, transparent)`,backdropFilter:`blur(8px)`,WebkitBackdropFilter:`blur(8px)`,borderBottom:`1px solid color-mix(in srgb, var(--primary) 6%, transparent)`},children:[(0,l.jsx)(`span`,{style:{width:7,height:7,borderRadius:`50%`,background:`#ff5f57`,opacity:.5}}),(0,l.jsx)(`span`,{style:{width:7,height:7,borderRadius:`50%`,background:`#febc2e`,opacity:.5}}),(0,l.jsx)(`span`,{style:{width:7,height:7,borderRadius:`50%`,background:`#28c840`,opacity:.5}}),(0,l.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,fontSize:`0.5rem`,color:`var(--tooltip-foreground)`,marginLeft:`auto`,letterSpacing:`0.04em`,opacity:.5},children:`Build realistic industrial environments`})]}),(0,l.jsxs)(`div`,{style:{height:`min(${D}rem, calc(100vh - 11rem))`,overflowY:`auto`,overflowX:`hidden`,background:`color-mix(in srgb, var(--card) 60%, transparent)`,padding:`1rem 1.25rem 1.1rem`,fontFamily:`var(--font-mono)`,fontSize:`${T}rem`,lineHeight:E,whiteSpace:`pre`},children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`span`,{style:{color:`var(--muted-foreground)`},children:`$ `}),(0,l.jsx)(`span`,{style:{color:`var(--primary)`},children:h}),(0,l.jsx)(`span`,{style:{color:`var(--foreground)`,opacity:.9},children:g}),e>0&&e<37&&(0,l.jsx)(`span`,{style:{display:`inline-block`,width:5,height:10,background:`var(--primary)`,verticalAlign:`text-bottom`,marginLeft:1,animation:`cursor-blink 1s step-end infinite`}})]}),n>=1&&(0,l.jsxs)(`div`,{style:{opacity:0,animation:`terminal-line 0.4s ease forwards`},children:[(0,l.jsx)(`span`,{style:{color:`var(--primary)`},children:`✓`}),(0,l.jsx)(`span`,{style:{color:`var(--tooltip-foreground)`},children:` Loaded `}),(0,l.jsx)(`span`,{style:{color:`var(--primary)`},children:`smart-factory`}),(0,l.jsx)(`span`,{style:{color:`var(--muted-foreground)`},children:` — 10 assets · 240 tags`})]}),n>=2&&(0,l.jsxs)(`div`,{style:{opacity:0,animation:`terminal-line 0.4s ease 0.05s forwards`},children:[(0,l.jsx)(`span`,{style:{color:`var(--primary)`},children:`✓`}),(0,l.jsx)(`span`,{style:{color:`var(--tooltip-foreground)`},children:` Protocols `}),(0,l.jsx)(`span`,{style:{color:`var(--muted-foreground)`},children:`mqtt :1883 · opcua :4840 · modbus :1502`})]}),n>=3&&(0,l.jsx)(`div`,{style:{opacity:0,animation:`terminal-line 0.3s ease forwards`,marginTop:`0.6em`}}),x.map((e,t)=>{if(n<4+t)return null;let r=!!e.value;return(0,l.jsxs)(`div`,{style:{opacity:0,animation:`tree-line 0.3s ease forwards`},children:[(0,l.jsx)(`span`,{style:{color:`var(--tooltip-border)`},children:e.indent}),r&&e.value?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`span`,{style:{color:`var(--muted-foreground)`},children:e.text.padEnd(S)}),(0,l.jsx)(`span`,{style:{color:u?.indices.has(t)?`var(--destructive)`:o.has(t)?`var(--primary)`:`var(--foreground)`,transition:`color 0.3s`},children:(i[t]??``).padStart(7)}),(0,l.jsx)(`span`,{style:{color:`var(--tooltip-border)`},children:` ${e.value.unit.padEnd(5)}`}),e.protocol&&(0,l.jsx)(`span`,{style:{color:`var(--tooltip-border)`},children:e.protocol})]}):(0,l.jsxs)(l.Fragment,{children:[e.label&&(0,l.jsx)(`span`,{style:{color:`var(--tooltip-border)`},children:`${e.label}: `}),(0,l.jsx)(`span`,{style:{color:`var(--tooltip-foreground)`},children:e.text}),e.label===`cell`&&u?.assetId===e.id&&(0,l.jsxs)(`span`,{style:{marginLeft:`0.8em`,color:`var(--destructive)`,fontSize:`0.9em`},children:[`— `,u.name]})]})]},e.id)}),n>=w&&(0,l.jsx)(`div`,{style:{opacity:0,animation:`terminal-line 0.4s ease forwards`,marginTop:`0.55em`,textAlign:`right`},children:(0,l.jsx)(`span`,{style:{color:f.includes(`resolved`)||f.includes(`restored`)||f.includes(`fault:`)||f.includes(`lifecycle:`)?`var(--muted-foreground)`:`var(--tooltip-border)`,transition:`color 0.4s`},children:f})})]})]})})}function j(){let[e,t]=(0,c.useState)(!1);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`style`,{children:u}),(0,l.jsxs)(`div`,{className:`login-page`,children:[(0,l.jsxs)(`div`,{style:{background:`var(--background)`,backgroundImage:`radial-gradient(circle, color-mix(in srgb, var(--primary) 2.2%, transparent) 1px, transparent 1px)`,backgroundSize:`70px 70px`,display:`flex`,flexDirection:`column`,position:`relative`,overflow:`hidden`},children:[(0,l.jsx)(`div`,{style:{position:`absolute`,bottom:-80,right:-80,width:400,height:400,background:`radial-gradient(circle, color-mix(in srgb, var(--primary) 3.5%, transparent) 0%, transparent 65%)`,pointerEvents:`none`}}),(0,l.jsxs)(`div`,{className:`login-topbar`,style:{padding:`1.25rem 2rem`,borderBottom:`1px solid var(--secondary)`,zIndex:1,display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:[(0,l.jsxs)(s,{to:`/`,style:{display:`inline-flex`,alignItems:`center`,gap:`0.6rem`,textDecoration:`none`},children:[(0,l.jsx)(`img`,{src:`/miravo-logo.webp`,alt:`Miravo`,loading:`lazy`,decoding:`async`,style:{width:24,height:24,objectFit:`contain`}}),(0,l.jsx)(`span`,{style:{fontFamily:`var(--font-heading)`,fontSize:`0.95rem`,fontWeight:700,color:`var(--foreground)`,letterSpacing:`-0.02em`},children:`Miravo`}),(0,l.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,fontSize:`0.52rem`,fontWeight:600,color:`var(--primary)`,background:`color-mix(in srgb, var(--primary) 6%, transparent)`,border:`1px solid color-mix(in srgb, var(--primary) 14%, transparent)`,padding:`0.15rem 0.5rem`,borderRadius:4,lineHeight:1,display:`inline-flex`,alignItems:`center`},children:`Console`})]}),(0,l.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`0.4rem`,fontFamily:`var(--font-mono)`,fontSize:`0.5rem`,color:`var(--tooltip-border)`},children:[(0,l.jsx)(`span`,{style:{width:5,height:5,borderRadius:`50%`,background:`var(--primary)`,display:`block`,animation:`status-blink 3s ease-in-out infinite`}}),`System active`]})]}),(0,l.jsx)(`div`,{className:`login-form-area`,style:{flex:1,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`2.5rem 2rem`,zIndex:1},children:(0,l.jsx)(`div`,{style:{width:`100%`,maxWidth:370},children:(0,l.jsxs)(`div`,{className:`login-card`,style:{position:`relative`,background:`var(--card)`,border:`1px solid color-mix(in srgb, var(--secondary) 80%, transparent)`,borderRadius:4,overflow:`hidden`,padding:`2.25rem`},children:[(0,l.jsx)(`div`,{style:{position:`absolute`,top:0,left:14,right:14,height:1,background:`linear-gradient(90deg, transparent, color-mix(in srgb, var(--primary) 35%, transparent) 20%, color-mix(in srgb, var(--primary) 35%, transparent) 80%, transparent)`}}),e?(0,l.jsx)(h,{}):(0,l.jsx)(m,{onChangePassword:()=>t(!0)})]})})}),(0,l.jsxs)(`div`,{className:`login-footer`,style:{padding:`0.9rem 2rem`,borderTop:`1px solid var(--secondary)`,display:`flex`,justifyContent:`space-between`,alignItems:`center`,zIndex:1},children:[(0,l.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,fontSize:`0.6rem`,color:`var(--tooltip-border)`,letterSpacing:`0.04em`},children:`Miravo Console`}),(0,l.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,fontSize:`0.6rem`,color:`var(--tooltip-border)`,letterSpacing:`0.04em`},children:`© 2026`})]})]}),(0,l.jsxs)(`div`,{className:`login-left`,style:{position:`relative`,background:`var(--background)`,overflow:`hidden`,borderRight:`1px solid color-mix(in srgb, var(--primary) 8%, transparent)`},children:[(0,l.jsx)(`div`,{style:{position:`absolute`,inset:0,zIndex:9999,pointerEvents:`none`,opacity:.025,backgroundImage:`url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E")`,backgroundSize:`200px 200px`}}),(0,l.jsx)(g,{}),(0,l.jsx)(`div`,{style:{position:`absolute`,inset:0,zIndex:1,background:`radial-gradient(ellipse 75% 70% at 50% 50%, transparent 40%, color-mix(in srgb, var(--background) 55%, transparent) 100%)`,pointerEvents:`none`}}),(0,l.jsx)(`div`,{style:{position:`absolute`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,width:700,height:500,background:`radial-gradient(ellipse at center, color-mix(in srgb, var(--primary) 1.8%, transparent) 0%, transparent 65%)`,pointerEvents:`none`,zIndex:2,animation:`login-glow-pulse 8s ease-in-out infinite alternate`}}),(0,l.jsx)(v,{}),(0,l.jsx)(A,{}),(0,l.jsxs)(`div`,{style:{position:`absolute`,top:`1.2rem`,right:`1.2rem`,zIndex:10,display:`flex`,alignItems:`center`,gap:`0.4rem`,padding:`0.3rem 0.65rem`,background:`color-mix(in srgb, var(--background) 65%, transparent)`,backdropFilter:`blur(6px)`,WebkitBackdropFilter:`blur(6px)`,border:`1px solid color-mix(in srgb, var(--primary) 10%, transparent)`,borderRadius:4,fontFamily:`var(--font-mono)`,fontSize:`0.5rem`,color:`var(--muted-foreground)`,pointerEvents:`none`},children:[(0,l.jsx)(`span`,{style:{width:5,height:5,borderRadius:`50%`,background:`var(--primary)`,display:`block`,animation:`live-dot 2s ease-in-out infinite`}}),`Live topology`]})]})]})]})}export{j as LoginPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./models-DeByQ5rq.js";export{e as ModelsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{s as t}from"./vendor-charts-CAZdaPlq.js";import{at as n}from"./vendor-ui-mizMYESS.js";import{_ as r,a as i}from"./api-Bef9FEIU.js";import{a,n as o,t as s}from"./get-error-message-DhCjoSSJ.js";import{t as c}from"./proxy-CgM57W61.js";import{t as l}from"./AnimatePresence-CVhkybDC.js";import{a as u,i as d,n as f,o as p,r as m,s as h}from"./copy-button-BK3jqKBZ.js";import{n as g,t as _}from"./createLucideIcon-Yddw9eHa.js";import{S as v,g as y,h as b,n as x,p as S,t as C}from"./input-BCiRHEmc.js";import{t as w}from"./activity-DP0Us3HU.js";import{C as T,n as E,t as D,w as O}from"./use-platform-stream-BZTQlkbS.js";import{l as k}from"./select-4wihIkEE.js";import{i as A,n as j,r as M,t as N}from"./tabs-BgPF8MSY.js";import{n as ee}from"./checkbox-Xly18Uyz.js";import{a as P,c as F,i as I,l as L,n as R,o as z,r as B,s as V,t as H}from"./deploy-tab-zi4NXsfj.js";import{c as U,n as te,r as ne,s as re,t as ie}from"./use-engine-command-mutation-DTvKLMBg.js";import{t as W}from"./triangle-alert-DPtblpQC.js";import{t as G}from"./badge-tnWgSITj.js";import{t as K}from"./query-keys-Co1J4HmV.js";var q=_(`box`,[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]),J=_(`cog`,[[`path`,{d:`M11 10.27 7 3.34`,key:`16pf9h`}],[`path`,{d:`m11 13.73-4 6.93`,key:`794ttg`}],[`path`,{d:`M12 22v-2`,key:`1osdcq`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M14 12h8`,key:`4f43i9`}],[`path`,{d:`m17 20.66-1-1.73`,key:`eq3orb`}],[`path`,{d:`m17 3.34-1 1.73`,key:`2wel8s`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`m20.66 17-1.73-1`,key:`sg0v6f`}],[`path`,{d:`m20.66 7-1.73 1`,key:`1ow05n`}],[`path`,{d:`m3.34 17 1.73-1`,key:`nuk764`}],[`path`,{d:`m3.34 7 1.73 1`,key:`1ulond`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`circle`,{cx:`12`,cy:`12`,r:`8`,key:`46899m`}]]),ae=_(`heart-pulse`,[[`path`,{d:`M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5`,key:`mvr1a0`}],[`path`,{d:`M3.22 13H9.5l.5-1 2 4.5 2-7 1.5 3.5h5.27`,key:`auskq0`}]]),oe=_(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),se=_(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),Y=e(t(),1),X=n(),ce=new Set([`fault_active`,`fault_count`,`active_fault_code`,`lifecycle_stage`,`health_state`,`availability_state`]);function le(e){let t=[],n=[],r=[],i=[];for(let[a,o]of Object.entries(e)){let e={name:a,kind:o.kind,dataType:o.dataType,access:o.access,unit:o.unit,euRange:o.euRange};ce.has(a)?i.push(e):o.kind===`property`?t.push(e):o.access===`readwrite`?n.push(e):r.push(e)}let a=[];return t.length>0&&a.push({key:`nameplate`,label:`Nameplate`,icon:(0,X.jsx)(V,{className:`size-3`}),members:t,accentClass:`text-muted-foreground`}),n.length>0&&a.push({key:`commands`,label:`Commands`,icon:(0,X.jsx)(oe,{className:`size-3`}),members:n,accentClass:`text-info`}),r.length>0&&a.push({key:`process`,label:`Process Tags`,icon:(0,X.jsx)(w,{className:`size-3`}),members:r,accentClass:`text-primary`}),i.length>0&&a.push({key:`health`,label:`Health & Status`,icon:(0,X.jsx)(ae,{className:`size-3`}),members:i,accentClass:`text-success`}),a}function ue({modelName:e,onClose:t}){let[n,l]=(0,Y.useState)(new Set([`nameplate`,`process`])),u=a({queryKey:K.catalog.modelSchema(e??``),queryFn:()=>i(`/catalog/models/${e}`,r.catalogModelDetail),enabled:e!==null}),d=u.data,f=u.isPending&&!d,p=u.isError,m=s(u.error,`Failed to load model.`);(0,Y.useEffect)(()=>{e&&l(new Set([`nameplate`,`process`]))},[e]);let h=(0,Y.useMemo)(()=>d?le(d.members):[],[d]),g=(0,Y.useCallback)(e=>{l(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),_=D(),b=d?Object.keys(d.members).length:0,x=d?Object.keys(d.methods).length:0;return(0,X.jsx)(R,{open:e!==null,onOpenChange:e=>{e||(_.reset(),t())},children:(0,X.jsx)(B,{side:`right`,className:`flex w-full flex-col gap-4 touch-manipulation`,children:f?null:p&&!d?(0,X.jsx)(`div`,{className:`flex flex-1 flex-col justify-center px-2`,children:(0,X.jsx)(o,{message:m,onRetry:()=>void u.refetch(),isRetrying:u.isFetching})}):d?(0,X.jsxs)(c.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.18},className:`flex min-h-0 flex-1 flex-col gap-4`,children:[(0,X.jsxs)(P,{className:`gap-1 pb-0 pe-12`,children:[(0,X.jsx)(z,{className:`font-heading text-base uppercase tracking-wide`,children:y(d.name)}),d.description&&(0,X.jsx)(I,{className:`text-xs leading-relaxed text-foreground/88`,children:d.description}),(0,X.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,X.jsxs)(G,{variant:`outline`,className:`font-mono text-xs`,children:[b,` members`]}),(0,X.jsxs)(G,{variant:`outline`,className:`font-mono text-xs`,children:[x,` methods`]}),(0,X.jsxs)(G,{variant:`outline`,className:`font-mono text-xs`,children:[d.faults.length,` faults`]}),d.lifecycle&&(0,X.jsxs)(G,{variant:`outline`,className:`font-mono text-xs text-primary`,children:[d.lifecycle.stages.length,`-stage lifecycle`]}),(0,X.jsx)(E,{stream:_})]})]}),(0,X.jsxs)(N,{defaultValue:`overview`,className:`flex min-h-0 flex-1 flex-col gap-1 pt-0`,children:[(0,X.jsxs)(M,{variant:`line`,className:`h-8! shrink-0 gap-0.5 border-b-border/60 px-2 py-0.5`,children:[(0,X.jsx)(A,{value:`overview`,className:`min-h-10 px-2 py-1 text-xs text-foreground/82 after:bottom-[-3px] data-active:text-foreground sm:min-h-0 sm:px-2.5 sm:py-1`,children:`Overview`}),(0,X.jsx)(A,{value:`deploy`,className:`min-h-10 px-2 py-1 text-xs text-foreground/82 after:bottom-[-3px] data-active:text-foreground sm:min-h-0 sm:px-2.5 sm:py-1`,children:`Deploy`})]}),(0,X.jsx)(j,{value:`overview`,keepMounted:!0,className:`flex min-h-0 flex-1 flex-col`,children:(0,X.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col px-3 pt-0`,children:(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto pr-2`,children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5 pb-1 pt-0.5`,children:[h.map(e=>(0,X.jsx)(Z,{sectionKey:e.key,label:e.label,count:e.members.length,icon:e.icon,accentClass:e.accentClass,expanded:n.has(e.key),onToggle:g,children:(0,X.jsx)(`div`,{className:`flex flex-col gap-1`,children:e.members.map(e=>(0,X.jsx)(de,{member:e},e.name))})},e.key)),d.faults.length>0&&(0,X.jsx)(Z,{sectionKey:`faults`,label:`Faults`,count:d.faults.length,icon:(0,X.jsx)(W,{className:`size-3`}),accentClass:`text-warning`,expanded:n.has(`faults`),onToggle:g,children:(0,X.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:d.faults.map(e=>(0,X.jsx)(G,{variant:`secondary`,className:`text-[10px] text-warning`,children:v(e)},e))})}),d.lifecycle&&(0,X.jsx)(Z,{sectionKey:`lifecycle`,label:`Lifecycle`,count:d.lifecycle.stages.length,icon:(0,X.jsx)(J,{className:`size-3`}),accentClass:`text-primary`,expanded:n.has(`lifecycle`),onToggle:g,children:(0,X.jsx)(fe,{lifecycle:d.lifecycle})}),x>0&&(0,X.jsx)(Z,{sectionKey:`methods`,label:`Methods`,count:x,icon:(0,X.jsx)(se,{className:`size-3`}),accentClass:`text-info`,expanded:n.has(`methods`),onToggle:g,children:(0,X.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:Object.entries(d.methods).map(([e,t])=>(0,X.jsx)(pe,{name:e,method:t},e))})})]})})})}),(0,X.jsx)(j,{value:`deploy`,keepMounted:!0,className:`flex min-h-0 flex-1 flex-col`,children:(0,X.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col px-3 pt-0`,children:(0,X.jsx)(H,{kind:`model`,id:d.name,displayName:y(d.name),yamlPath:`/catalog/models/${d.name}/yaml`,yamlFilename:`${d.name}.twin.yaml`,stream:_})})})]})]},d.name):(0,X.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-sm text-muted-foreground`,children:`Model not found`})})})}function Z({sectionKey:e,label:t,count:n,icon:r,accentClass:i,expanded:a,onToggle:o,children:s}){return(0,X.jsxs)(`div`,{className:`rounded-[var(--miravo-radius-tight)] border border-border/50`,children:[(0,X.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-1.5 px-2.5 py-1.5 text-left text-xs font-medium transition-colors hover:bg-muted/30`,onClick:()=>o(e),children:[(0,X.jsx)(`span`,{className:i,children:r}),(0,X.jsx)(`span`,{className:`uppercase tracking-wider`,children:t}),(0,X.jsx)(G,{variant:`secondary`,className:`ml-auto text-[10px]`,children:n}),(0,X.jsx)(k,{className:`size-3 text-muted-foreground transition-transform ${a?`rotate-180`:``}`})]}),(0,X.jsx)(l,{initial:!1,children:a&&(0,X.jsx)(c.div,{initial:{height:0,opacity:0},animate:{height:`auto`,opacity:1},exit:{height:0,opacity:0},transition:{duration:.2,ease:`easeOut`},className:`overflow-hidden`,children:(0,X.jsx)(`div`,{className:`border-t px-2.5 py-1.5`,children:s})},`content`)})]})}function de({member:e}){return(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-0.5 py-0.5 text-xs`,children:[(0,X.jsx)(`span`,{title:e.name,className:`min-w-0 truncate font-mono text-foreground`,children:S(e.name)}),(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:e.dataType}),e.unit&&(0,X.jsx)(G,{variant:`outline`,className:`px-1 py-0 text-[10px]`,children:e.unit}),e.euRange&&(0,X.jsxs)(`span`,{className:`ml-auto font-mono text-xs text-muted-foreground`,children:[`[`,e.euRange[0],`–`,e.euRange[1],`]`]})]})}var Q={healthy:`bg-success`,normal:`bg-success`,degraded:`bg-warning`,critical:`bg-destructive`,failed:`bg-destructive`};function fe({lifecycle:e}){let t=e.stages.length;return(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsx)(`div`,{className:`flex h-2.5 w-full overflow-hidden rounded-full bg-muted`,children:e.stages.map((e,n)=>(0,X.jsx)(`div`,{className:`transition-[background-color] ${Q[e]??`bg-chart-1`} ${n===0?`rounded-l-full`:``} ${n===t-1?`rounded-r-full`:``}`,style:{width:`${100/t}%`}},`${e}-${n}`))}),(0,X.jsx)(`div`,{className:`flex items-center gap-3`,children:e.stages.map((e,t)=>(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs`,children:[(0,X.jsx)(`span`,{className:`size-2 rounded-full ${Q[e]??`bg-chart-1`}`}),(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:v(e)})]},`${e}-${t}`))}),(0,X.jsxs)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:[`~`,b(e.totalHours),` total hours`]})]})}function pe({name:e,method:t}){return(0,X.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`font-mono text-xs text-foreground`,children:e}),t.inputArguments.length>0&&(0,X.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`(`,t.inputArguments.map(e=>`${e.name}: ${e.dataType}`).join(`, `),`)`]})]}),t.description&&(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t.description})]})}function me(){let[e,t]=(0,Y.useState)(``),[n,_]=(0,Y.useState)({}),[v,b]=(0,Y.useState)(null),[S,w]=(0,Y.useState)(null),[T,E]=(0,Y.useState)(null),D=(0,Y.useRef)(null),O=ie();(0,Y.useEffect)(()=>{let e=e=>{if(e.key!==`/`||e.metaKey||e.ctrlKey||e.altKey)return;let t=e.target.tagName;t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||(e.preventDefault(),D.current?.focus())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let k=a({queryKey:K.catalog.models(),queryFn:()=>i(`/catalog/models`,r.catalogModels)}),A=k.data??[],j=k.isPending&&!k.data,M=k.isError&&!k.data,N=k.isError&&!!k.data,P=s(k.error,`Failed to load models.`),I=e=>n[e]??1,L=(0,Y.useCallback)((e,t)=>{_(n=>({...n,[e]:Math.max(1,Math.min(10,t))}))},[]),R=(0,Y.useCallback)(e=>{E(e)},[]),z=(0,Y.useCallback)(e=>{w(e)},[]),B=async e=>{b(e);try{return await O.mutateAsync({type:`spawn`,model:e,count:I(e)}),!0}catch{return!1}finally{b(null)}},V=e?A.filter(t=>t.name.toLowerCase().includes(e.toLowerCase())||(t.description?.toLowerCase().includes(e.toLowerCase())??!1)):A;return(0,X.jsxs)(`div`,{className:`@container/models mx-auto flex w-full max-w-screen-2xl flex-col gap-5 p-4 sm:gap-6 sm:p-6`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,X.jsx)(`h1`,{className:`font-heading text-2xl font-semibold tracking-tight`,children:`Asset Model Library`}),(0,X.jsx)(G,{variant:`outline`,className:`text-xs`,children:M?(0,X.jsx)(`span`,{className:`text-destructive`,children:`Unavailable`}):j&&A.length===0?(0,X.jsx)(X.Fragment,{children:`Loading...`}):(0,X.jsxs)(X.Fragment,{children:[A.length,` built-in`]})})]}),(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Canonical twin models with realistic physics, lifecycle degradation, and fault modes. Inspect to explore schema, copy YAML, or export.`})]}),M&&(0,X.jsx)(o,{message:P,onRetry:()=>void k.refetch(),isRetrying:k.isFetching}),N&&(0,X.jsx)(o,{message:`${P} Showing cached models.`,onRetry:()=>void k.refetch(),isRetrying:k.isFetching}),!M&&A.length>6&&(0,X.jsxs)(`div`,{className:`relative max-w-xs`,children:[(0,X.jsx)(F,{className:`absolute left-2.5 top-2.5 size-4 text-muted-foreground`}),(0,X.jsx)(C,{ref:D,placeholder:`Filter models...`,value:e,onChange:e=>t(e.target.value),className:`pl-9 pr-7`}),!e&&(0,X.jsx)(`kbd`,{className:`pointer-events-none absolute top-1/2 right-2 -translate-y-1/2 rounded-[var(--miravo-radius-tight)] border border-border bg-muted px-1 font-mono text-[10px] text-muted-foreground`,children:`/`})]}),(0,X.jsx)(`div`,{className:`grid grid-cols-1 gap-4 @[720px]/models:grid-cols-2 @[1120px]/models:grid-cols-3`,"aria-busy":j&&!M,children:M?null:(0,X.jsxs)(X.Fragment,{children:[j&&A.length===0&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`h-44 animate-pulse rounded-[var(--miravo-radius-stadium-sm)] border border-border/50 bg-card/30`}),(0,X.jsx)(`div`,{className:`h-44 animate-pulse rounded-[var(--miravo-radius-stadium-sm)] border border-border/50 bg-card/30`}),(0,X.jsx)(`div`,{className:`h-44 animate-pulse rounded-[var(--miravo-radius-stadium-sm)] border border-border/50 bg-card/30`}),(0,X.jsx)(`div`,{className:`h-44 animate-pulse rounded-[var(--miravo-radius-stadium-sm)] border border-border/50 bg-card/30`}),(0,X.jsx)(`div`,{className:`h-44 animate-pulse rounded-[var(--miravo-radius-stadium-sm)] border border-border/50 bg-card/30`}),(0,X.jsx)(`div`,{className:`h-44 animate-pulse rounded-[var(--miravo-radius-stadium-sm)] border border-border/50 bg-card/30`})]}),(0,X.jsx)(l,{children:V.map((e,t)=>(0,X.jsx)(c.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,scale:.96,transition:{duration:.15}},transition:{type:`spring`,stiffness:380,damping:30,delay:t*.04},className:`grid`,children:(0,X.jsx)(he,{model:e,count:I(e.name),spawning:v===e.name,onCountChange:L,onInspect:R,onSpawn:z})},e.name))}),V.length===0&&A.length>0&&(0,X.jsxs)(`p`,{className:`col-span-full py-8 text-center text-sm text-muted-foreground`,children:[`No models match “`,e,`”`]})]})}),A.length>0&&(0,X.jsx)(`div`,{className:g(ne,`p-0`),children:(0,X.jsx)(`div`,{className:`community-teaser relative overflow-hidden rounded-[inherit]`,children:(0,X.jsx)(`div`,{className:`relative z-10 mx-auto max-w-3xl px-5 py-10 sm:px-10 sm:py-12`,children:(0,X.jsxs)(`div`,{className:`grid items-center gap-10 lg:grid-cols-[minmax(0,1fr)_minmax(0,17rem)]`,children:[(0,X.jsxs)(`div`,{className:`order-2 flex min-w-0 flex-col gap-4 lg:order-1`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-3 gap-y-1`,children:[(0,X.jsx)(`p`,{className:`blueprint-title text-primary`,children:`Future channel`}),(0,X.jsx)(`span`,{className:`blueprint-stat text-[10px] text-muted-foreground`,children:`MIRAVO_REGISTRY · NOT_CONNECTED`})]}),(0,X.jsx)(`h2`,{className:`font-heading text-xl font-semibold tracking-tight sm:text-2xl`,children:`Community Models`}),(0,X.jsx)(`p`,{className:`max-w-xl text-sm leading-relaxed text-muted-foreground`,children:`Publish your custom twin models to the Miravo registry. Discover equipment models from other engineers, fork them, and adapt parameters for your use case.`}),(0,X.jsx)(`div`,{children:(0,X.jsx)(G,{variant:`outline`,className:`community-teaser-soon border-primary/35 bg-primary/5 text-[10px] text-primary`,children:`Coming Soon`})})]}),(0,X.jsx)(`div`,{className:`order-1 flex justify-center lg:order-2 lg:justify-end`,children:(0,X.jsxs)(`div`,{className:`community-teaser-module relative flex w-full max-w-[14rem] flex-col items-center justify-center gap-3 border border-primary/15 bg-muted/15 py-8 sm:max-w-[15.5rem] sm:py-10`,"aria-hidden":!0,children:[(0,X.jsx)(`div`,{className:`community-teaser-icon-ring relative z-[1] flex size-[4.25rem] items-center justify-center rounded-[var(--miravo-radius-tight)] border border-primary/35 bg-gradient-to-br from-primary/18 to-primary/5`,children:(0,X.jsx)(ee,{className:`size-9 text-primary`,"aria-hidden":!0})}),(0,X.jsx)(`span`,{className:`blueprint-stat relative z-[1] text-[9px] tracking-[0.18em] text-muted-foreground`,children:`AWAITING SIGNAL`}),(0,X.jsx)(`span`,{className:`blueprint-stat relative z-[1] text-[9px] text-muted-foreground`,children:`Uplink idle`})]})})]})})})}),(0,X.jsx)(f,{open:S!==null,onOpenChange:e=>{e||w(null)},children:(0,X.jsxs)(m,{children:[(0,X.jsxs)(p,{children:[(0,X.jsx)(h,{children:`Spawn instances?`}),(0,X.jsx)(d,{children:S!==null&&(0,X.jsxs)(X.Fragment,{children:[`This spawns `,I(S),` instance`,I(S)===1?``:`s`,` of`,` `,(0,X.jsx)(`span`,{className:`font-medium text-foreground`,children:y(S)}),` `,`into the running environment.`]})})]}),(0,X.jsxs)(u,{children:[(0,X.jsx)(x,{variant:`outline`,disabled:v!==null,onClick:()=>w(null),children:`Cancel`}),(0,X.jsx)(x,{disabled:v!==null||S===null,onClick:async()=>{S!==null&&await B(S)&&w(null)},children:v===S?`Spawning...`:`Spawn`})]})]})}),(0,X.jsx)(ue,{modelName:T,onClose:()=>E(null)})]})}var he=(0,Y.memo)(function({model:e,count:t,spawning:n,onCountChange:r,onInspect:i,onSpawn:a}){return(0,X.jsxs)(`div`,{className:g(re,`flex flex-col gap-4 p-5`),children:[(0,X.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,X.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-[var(--miravo-radius-stadium-sm)] bg-primary/10 text-primary`,children:(0,X.jsx)(q,{className:`size-4`})}),(0,X.jsxs)(`div`,{className:`min-w-0 flex flex-col gap-0.5`,children:[(0,X.jsx)(`span`,{className:`font-heading text-sm font-semibold uppercase tracking-wide`,children:y(e.name)}),e.description&&(0,X.jsx)(`span`,{className:`line-clamp-2 text-xs leading-relaxed text-muted-foreground`,children:e.description})]})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 font-mono text-[11px] text-muted-foreground`,children:[(0,X.jsx)($,{label:`mbr`,value:e.memberCount}),(0,X.jsx)($,{label:`mth`,value:e.methodCount}),(0,X.jsx)($,{label:`flt`,value:e.faultCount}),e.hasLifecycle&&(0,X.jsxs)(`span`,{className:`flex items-center gap-1 text-primary`,children:[(0,X.jsx)(`span`,{className:`text-[10px]`,children:`◈`}),(0,X.jsxs)(`span`,{children:[e.lifecycleStageCount,`-stage`]})]}),(0,X.jsx)(G,{variant:`secondary`,className:`ml-auto shrink-0 font-sans text-[10px] font-medium`,children:e.source})]}),(0,X.jsxs)(`div`,{className:`mt-auto flex items-center gap-2 border-t border-border/30 pt-3`,children:[(0,X.jsxs)(`div`,{className:`flex items-center rounded-[var(--miravo-radius-tight)] border bg-muted/30`,children:[(0,X.jsx)(x,{variant:`ghost`,size:`icon`,className:`size-7 rounded-none rounded-l-md`,disabled:t<=1,"aria-label":`Decrease count`,onClick:n=>{n.stopPropagation(),r(e.name,t-1)},children:(0,X.jsx)(L,{className:`size-3`})}),(0,X.jsx)(`span`,{className:`flex size-7 items-center justify-center border-x font-mono text-xs`,children:t}),(0,X.jsx)(x,{variant:`ghost`,size:`icon`,className:`size-7 rounded-none rounded-r-md`,disabled:t>=10,"aria-label":`Increase count`,onClick:n=>{n.stopPropagation(),r(e.name,t+1)},children:(0,X.jsx)(T,{className:`size-3`})})]}),(0,X.jsxs)(x,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>i(e.name),className:te,children:[(0,X.jsx)(O,{className:`size-3.5`,"aria-hidden":!0}),`Inspect`]}),(0,X.jsxs)(x,{size:`sm`,className:`ml-auto`,disabled:n,onClick:()=>a(e.name),children:[(0,X.jsx)(U,{className:`mr-1 size-3`}),n?`...`:`Spawn`]})]})]})});function $({label:e,value:t}){return(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`span`,{className:`text-foreground`,children:t}),` `,(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:e})]})}export{q as n,me as t};
|
|
1
|
+
import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{s as t}from"./vendor-charts-CAZdaPlq.js";import{at as n}from"./vendor-ui-mizMYESS.js";import{_ as r,a as i}from"./api-BjnU1LXi.js";import{a,n as o,t as s}from"./get-error-message-BzBOywwk.js";import{t as c}from"./proxy-CgM57W61.js";import{t as l}from"./AnimatePresence-CVhkybDC.js";import{a as u,i as d,n as f,o as p,r as m,s as h}from"./copy-button-DYqJP5N8.js";import{n as g,t as _}from"./createLucideIcon-Yddw9eHa.js";import{S as v,g as y,h as b,n as x,p as S,t as C}from"./input-BCiRHEmc.js";import{t as w}from"./activity-DP0Us3HU.js";import{C as T,n as E,t as D,w as O}from"./use-platform-stream-ScJV0xv8.js";import{l as k}from"./select-4wihIkEE.js";import{i as A,n as j,r as M,t as N}from"./tabs-BgPF8MSY.js";import{n as ee}from"./checkbox-Xly18Uyz.js";import{a as P,c as F,i as I,l as L,n as R,o as z,r as B,s as V,t as H}from"./deploy-tab-BRET5egR.js";import{c as U,n as te,r as ne,s as re,t as ie}from"./use-engine-command-mutation--eob_QrP.js";import{t as W}from"./triangle-alert-DPtblpQC.js";import{t as G}from"./badge-tnWgSITj.js";import{t as K}from"./query-keys-Co1J4HmV.js";var q=_(`box`,[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]),J=_(`cog`,[[`path`,{d:`M11 10.27 7 3.34`,key:`16pf9h`}],[`path`,{d:`m11 13.73-4 6.93`,key:`794ttg`}],[`path`,{d:`M12 22v-2`,key:`1osdcq`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M14 12h8`,key:`4f43i9`}],[`path`,{d:`m17 20.66-1-1.73`,key:`eq3orb`}],[`path`,{d:`m17 3.34-1 1.73`,key:`2wel8s`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`m20.66 17-1.73-1`,key:`sg0v6f`}],[`path`,{d:`m20.66 7-1.73 1`,key:`1ow05n`}],[`path`,{d:`m3.34 17 1.73-1`,key:`nuk764`}],[`path`,{d:`m3.34 7 1.73 1`,key:`1ulond`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`circle`,{cx:`12`,cy:`12`,r:`8`,key:`46899m`}]]),ae=_(`heart-pulse`,[[`path`,{d:`M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5`,key:`mvr1a0`}],[`path`,{d:`M3.22 13H9.5l.5-1 2 4.5 2-7 1.5 3.5h5.27`,key:`auskq0`}]]),oe=_(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),se=_(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),Y=e(t(),1),X=n(),ce=new Set([`fault_active`,`fault_count`,`active_fault_code`,`lifecycle_stage`,`health_state`,`availability_state`]);function le(e){let t=[],n=[],r=[],i=[];for(let[a,o]of Object.entries(e)){let e={name:a,kind:o.kind,dataType:o.dataType,access:o.access,unit:o.unit,euRange:o.euRange};ce.has(a)?i.push(e):o.kind===`property`?t.push(e):o.access===`readwrite`?n.push(e):r.push(e)}let a=[];return t.length>0&&a.push({key:`nameplate`,label:`Nameplate`,icon:(0,X.jsx)(V,{className:`size-3`}),members:t,accentClass:`text-muted-foreground`}),n.length>0&&a.push({key:`commands`,label:`Commands`,icon:(0,X.jsx)(oe,{className:`size-3`}),members:n,accentClass:`text-info`}),r.length>0&&a.push({key:`process`,label:`Process Tags`,icon:(0,X.jsx)(w,{className:`size-3`}),members:r,accentClass:`text-primary`}),i.length>0&&a.push({key:`health`,label:`Health & Status`,icon:(0,X.jsx)(ae,{className:`size-3`}),members:i,accentClass:`text-success`}),a}function ue({modelName:e,onClose:t}){let[n,l]=(0,Y.useState)(new Set([`nameplate`,`process`])),u=a({queryKey:K.catalog.modelSchema(e??``),queryFn:()=>i(`/catalog/models/${e}`,r.catalogModelDetail),enabled:e!==null}),d=u.data,f=u.isPending&&!d,p=u.isError,m=s(u.error,`Failed to load model.`);(0,Y.useEffect)(()=>{e&&l(new Set([`nameplate`,`process`]))},[e]);let h=(0,Y.useMemo)(()=>d?le(d.members):[],[d]),g=(0,Y.useCallback)(e=>{l(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),_=D(),b=d?Object.keys(d.members).length:0,x=d?Object.keys(d.methods).length:0;return(0,X.jsx)(R,{open:e!==null,onOpenChange:e=>{e||(_.reset(),t())},children:(0,X.jsx)(B,{side:`right`,className:`flex w-full flex-col gap-4 touch-manipulation`,children:f?null:p&&!d?(0,X.jsx)(`div`,{className:`flex flex-1 flex-col justify-center px-2`,children:(0,X.jsx)(o,{message:m,onRetry:()=>void u.refetch(),isRetrying:u.isFetching})}):d?(0,X.jsxs)(c.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.18},className:`flex min-h-0 flex-1 flex-col gap-4`,children:[(0,X.jsxs)(P,{className:`gap-1 pb-0 pe-12`,children:[(0,X.jsx)(z,{className:`font-heading text-base uppercase tracking-wide`,children:y(d.name)}),d.description&&(0,X.jsx)(I,{className:`text-xs leading-relaxed text-foreground/88`,children:d.description}),(0,X.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,X.jsxs)(G,{variant:`outline`,className:`font-mono text-xs`,children:[b,` members`]}),(0,X.jsxs)(G,{variant:`outline`,className:`font-mono text-xs`,children:[x,` methods`]}),(0,X.jsxs)(G,{variant:`outline`,className:`font-mono text-xs`,children:[d.faults.length,` faults`]}),d.lifecycle&&(0,X.jsxs)(G,{variant:`outline`,className:`font-mono text-xs text-primary`,children:[d.lifecycle.stages.length,`-stage lifecycle`]}),(0,X.jsx)(E,{stream:_})]})]}),(0,X.jsxs)(N,{defaultValue:`overview`,className:`flex min-h-0 flex-1 flex-col gap-1 pt-0`,children:[(0,X.jsxs)(M,{variant:`line`,className:`h-8! shrink-0 gap-0.5 border-b-border/60 px-2 py-0.5`,children:[(0,X.jsx)(A,{value:`overview`,className:`min-h-10 px-2 py-1 text-xs text-foreground/82 after:bottom-[-3px] data-active:text-foreground sm:min-h-0 sm:px-2.5 sm:py-1`,children:`Overview`}),(0,X.jsx)(A,{value:`deploy`,className:`min-h-10 px-2 py-1 text-xs text-foreground/82 after:bottom-[-3px] data-active:text-foreground sm:min-h-0 sm:px-2.5 sm:py-1`,children:`Deploy`})]}),(0,X.jsx)(j,{value:`overview`,keepMounted:!0,className:`flex min-h-0 flex-1 flex-col`,children:(0,X.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col px-3 pt-0`,children:(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto pr-2`,children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5 pb-1 pt-0.5`,children:[h.map(e=>(0,X.jsx)(Z,{sectionKey:e.key,label:e.label,count:e.members.length,icon:e.icon,accentClass:e.accentClass,expanded:n.has(e.key),onToggle:g,children:(0,X.jsx)(`div`,{className:`flex flex-col gap-1`,children:e.members.map(e=>(0,X.jsx)(de,{member:e},e.name))})},e.key)),d.faults.length>0&&(0,X.jsx)(Z,{sectionKey:`faults`,label:`Faults`,count:d.faults.length,icon:(0,X.jsx)(W,{className:`size-3`}),accentClass:`text-warning`,expanded:n.has(`faults`),onToggle:g,children:(0,X.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:d.faults.map(e=>(0,X.jsx)(G,{variant:`secondary`,className:`text-[10px] text-warning`,children:v(e)},e))})}),d.lifecycle&&(0,X.jsx)(Z,{sectionKey:`lifecycle`,label:`Lifecycle`,count:d.lifecycle.stages.length,icon:(0,X.jsx)(J,{className:`size-3`}),accentClass:`text-primary`,expanded:n.has(`lifecycle`),onToggle:g,children:(0,X.jsx)(fe,{lifecycle:d.lifecycle})}),x>0&&(0,X.jsx)(Z,{sectionKey:`methods`,label:`Methods`,count:x,icon:(0,X.jsx)(se,{className:`size-3`}),accentClass:`text-info`,expanded:n.has(`methods`),onToggle:g,children:(0,X.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:Object.entries(d.methods).map(([e,t])=>(0,X.jsx)(pe,{name:e,method:t},e))})})]})})})}),(0,X.jsx)(j,{value:`deploy`,keepMounted:!0,className:`flex min-h-0 flex-1 flex-col`,children:(0,X.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col px-3 pt-0`,children:(0,X.jsx)(H,{kind:`model`,id:d.name,displayName:y(d.name),yamlPath:`/catalog/models/${d.name}/yaml`,yamlFilename:`${d.name}.twin.yaml`,stream:_})})})]})]},d.name):(0,X.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-sm text-muted-foreground`,children:`Model not found`})})})}function Z({sectionKey:e,label:t,count:n,icon:r,accentClass:i,expanded:a,onToggle:o,children:s}){return(0,X.jsxs)(`div`,{className:`rounded-[var(--miravo-radius-tight)] border border-border/50`,children:[(0,X.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-1.5 px-2.5 py-1.5 text-left text-xs font-medium transition-colors hover:bg-muted/30`,onClick:()=>o(e),children:[(0,X.jsx)(`span`,{className:i,children:r}),(0,X.jsx)(`span`,{className:`uppercase tracking-wider`,children:t}),(0,X.jsx)(G,{variant:`secondary`,className:`ml-auto text-[10px]`,children:n}),(0,X.jsx)(k,{className:`size-3 text-muted-foreground transition-transform ${a?`rotate-180`:``}`})]}),(0,X.jsx)(l,{initial:!1,children:a&&(0,X.jsx)(c.div,{initial:{height:0,opacity:0},animate:{height:`auto`,opacity:1},exit:{height:0,opacity:0},transition:{duration:.2,ease:`easeOut`},className:`overflow-hidden`,children:(0,X.jsx)(`div`,{className:`border-t px-2.5 py-1.5`,children:s})},`content`)})]})}function de({member:e}){return(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-0.5 py-0.5 text-xs`,children:[(0,X.jsx)(`span`,{title:e.name,className:`min-w-0 truncate font-mono text-foreground`,children:S(e.name)}),(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:e.dataType}),e.unit&&(0,X.jsx)(G,{variant:`outline`,className:`px-1 py-0 text-[10px]`,children:e.unit}),e.euRange&&(0,X.jsxs)(`span`,{className:`ml-auto font-mono text-xs text-muted-foreground`,children:[`[`,e.euRange[0],`–`,e.euRange[1],`]`]})]})}var Q={healthy:`bg-success`,normal:`bg-success`,degraded:`bg-warning`,critical:`bg-destructive`,failed:`bg-destructive`};function fe({lifecycle:e}){let t=e.stages.length;return(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsx)(`div`,{className:`flex h-2.5 w-full overflow-hidden rounded-full bg-muted`,children:e.stages.map((e,n)=>(0,X.jsx)(`div`,{className:`transition-[background-color] ${Q[e]??`bg-chart-1`} ${n===0?`rounded-l-full`:``} ${n===t-1?`rounded-r-full`:``}`,style:{width:`${100/t}%`}},`${e}-${n}`))}),(0,X.jsx)(`div`,{className:`flex items-center gap-3`,children:e.stages.map((e,t)=>(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs`,children:[(0,X.jsx)(`span`,{className:`size-2 rounded-full ${Q[e]??`bg-chart-1`}`}),(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:v(e)})]},`${e}-${t}`))}),(0,X.jsxs)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:[`~`,b(e.totalHours),` total hours`]})]})}function pe({name:e,method:t}){return(0,X.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`font-mono text-xs text-foreground`,children:e}),t.inputArguments.length>0&&(0,X.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`(`,t.inputArguments.map(e=>`${e.name}: ${e.dataType}`).join(`, `),`)`]})]}),t.description&&(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t.description})]})}function me(){let[e,t]=(0,Y.useState)(``),[n,_]=(0,Y.useState)({}),[v,b]=(0,Y.useState)(null),[S,w]=(0,Y.useState)(null),[T,E]=(0,Y.useState)(null),D=(0,Y.useRef)(null),O=ie();(0,Y.useEffect)(()=>{let e=e=>{if(e.key!==`/`||e.metaKey||e.ctrlKey||e.altKey)return;let t=e.target.tagName;t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||(e.preventDefault(),D.current?.focus())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let k=a({queryKey:K.catalog.models(),queryFn:()=>i(`/catalog/models`,r.catalogModels)}),A=k.data??[],j=k.isPending&&!k.data,M=k.isError&&!k.data,N=k.isError&&!!k.data,P=s(k.error,`Failed to load models.`),I=e=>n[e]??1,L=(0,Y.useCallback)((e,t)=>{_(n=>({...n,[e]:Math.max(1,Math.min(10,t))}))},[]),R=(0,Y.useCallback)(e=>{E(e)},[]),z=(0,Y.useCallback)(e=>{w(e)},[]),B=async e=>{b(e);try{return await O.mutateAsync({type:`spawn`,model:e,count:I(e)}),!0}catch{return!1}finally{b(null)}},V=e?A.filter(t=>t.name.toLowerCase().includes(e.toLowerCase())||(t.description?.toLowerCase().includes(e.toLowerCase())??!1)):A;return(0,X.jsxs)(`div`,{className:`@container/models mx-auto flex w-full max-w-screen-2xl flex-col gap-5 p-4 sm:gap-6 sm:p-6`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,X.jsx)(`h1`,{className:`font-heading text-2xl font-semibold tracking-tight`,children:`Asset Model Library`}),(0,X.jsx)(G,{variant:`outline`,className:`text-xs`,children:M?(0,X.jsx)(`span`,{className:`text-destructive`,children:`Unavailable`}):j&&A.length===0?(0,X.jsx)(X.Fragment,{children:`Loading...`}):(0,X.jsxs)(X.Fragment,{children:[A.length,` built-in`]})})]}),(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Canonical twin models with realistic physics, lifecycle degradation, and fault modes. Inspect to explore schema, copy YAML, or export.`})]}),M&&(0,X.jsx)(o,{message:P,onRetry:()=>void k.refetch(),isRetrying:k.isFetching}),N&&(0,X.jsx)(o,{message:`${P} Showing cached models.`,onRetry:()=>void k.refetch(),isRetrying:k.isFetching}),!M&&A.length>6&&(0,X.jsxs)(`div`,{className:`relative max-w-xs`,children:[(0,X.jsx)(F,{className:`absolute left-2.5 top-2.5 size-4 text-muted-foreground`}),(0,X.jsx)(C,{ref:D,placeholder:`Filter models...`,value:e,onChange:e=>t(e.target.value),className:`pl-9 pr-7`}),!e&&(0,X.jsx)(`kbd`,{className:`pointer-events-none absolute top-1/2 right-2 -translate-y-1/2 rounded-[var(--miravo-radius-tight)] border border-border bg-muted px-1 font-mono text-[10px] text-muted-foreground`,children:`/`})]}),(0,X.jsx)(`div`,{className:`grid grid-cols-1 gap-4 @[720px]/models:grid-cols-2 @[1120px]/models:grid-cols-3`,"aria-busy":j&&!M,children:M?null:(0,X.jsxs)(X.Fragment,{children:[j&&A.length===0&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`h-44 animate-pulse rounded-[var(--miravo-radius-stadium-sm)] border border-border/50 bg-card/30`}),(0,X.jsx)(`div`,{className:`h-44 animate-pulse rounded-[var(--miravo-radius-stadium-sm)] border border-border/50 bg-card/30`}),(0,X.jsx)(`div`,{className:`h-44 animate-pulse rounded-[var(--miravo-radius-stadium-sm)] border border-border/50 bg-card/30`}),(0,X.jsx)(`div`,{className:`h-44 animate-pulse rounded-[var(--miravo-radius-stadium-sm)] border border-border/50 bg-card/30`}),(0,X.jsx)(`div`,{className:`h-44 animate-pulse rounded-[var(--miravo-radius-stadium-sm)] border border-border/50 bg-card/30`}),(0,X.jsx)(`div`,{className:`h-44 animate-pulse rounded-[var(--miravo-radius-stadium-sm)] border border-border/50 bg-card/30`})]}),(0,X.jsx)(l,{children:V.map((e,t)=>(0,X.jsx)(c.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,scale:.96,transition:{duration:.15}},transition:{type:`spring`,stiffness:380,damping:30,delay:t*.04},className:`grid`,children:(0,X.jsx)(he,{model:e,count:I(e.name),spawning:v===e.name,onCountChange:L,onInspect:R,onSpawn:z})},e.name))}),V.length===0&&A.length>0&&(0,X.jsxs)(`p`,{className:`col-span-full py-8 text-center text-sm text-muted-foreground`,children:[`No models match “`,e,`”`]})]})}),A.length>0&&(0,X.jsx)(`div`,{className:g(ne,`p-0`),children:(0,X.jsx)(`div`,{className:`community-teaser relative overflow-hidden rounded-[inherit]`,children:(0,X.jsx)(`div`,{className:`relative z-10 mx-auto max-w-3xl px-5 py-10 sm:px-10 sm:py-12`,children:(0,X.jsxs)(`div`,{className:`grid items-center gap-10 lg:grid-cols-[minmax(0,1fr)_minmax(0,17rem)]`,children:[(0,X.jsxs)(`div`,{className:`order-2 flex min-w-0 flex-col gap-4 lg:order-1`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-3 gap-y-1`,children:[(0,X.jsx)(`p`,{className:`blueprint-title text-primary`,children:`Future channel`}),(0,X.jsx)(`span`,{className:`blueprint-stat text-[10px] text-muted-foreground`,children:`MIRAVO_REGISTRY · NOT_CONNECTED`})]}),(0,X.jsx)(`h2`,{className:`font-heading text-xl font-semibold tracking-tight sm:text-2xl`,children:`Community Models`}),(0,X.jsx)(`p`,{className:`max-w-xl text-sm leading-relaxed text-muted-foreground`,children:`Publish your custom twin models to the Miravo registry. Discover equipment models from other engineers, fork them, and adapt parameters for your use case.`}),(0,X.jsx)(`div`,{children:(0,X.jsx)(G,{variant:`outline`,className:`community-teaser-soon border-primary/35 bg-primary/5 text-[10px] text-primary`,children:`Coming Soon`})})]}),(0,X.jsx)(`div`,{className:`order-1 flex justify-center lg:order-2 lg:justify-end`,children:(0,X.jsxs)(`div`,{className:`community-teaser-module relative flex w-full max-w-[14rem] flex-col items-center justify-center gap-3 border border-primary/15 bg-muted/15 py-8 sm:max-w-[15.5rem] sm:py-10`,"aria-hidden":!0,children:[(0,X.jsx)(`div`,{className:`community-teaser-icon-ring relative z-[1] flex size-[4.25rem] items-center justify-center rounded-[var(--miravo-radius-tight)] border border-primary/35 bg-gradient-to-br from-primary/18 to-primary/5`,children:(0,X.jsx)(ee,{className:`size-9 text-primary`,"aria-hidden":!0})}),(0,X.jsx)(`span`,{className:`blueprint-stat relative z-[1] text-[9px] tracking-[0.18em] text-muted-foreground`,children:`AWAITING SIGNAL`}),(0,X.jsx)(`span`,{className:`blueprint-stat relative z-[1] text-[9px] text-muted-foreground`,children:`Uplink idle`})]})})]})})})}),(0,X.jsx)(f,{open:S!==null,onOpenChange:e=>{e||w(null)},children:(0,X.jsxs)(m,{children:[(0,X.jsxs)(p,{children:[(0,X.jsx)(h,{children:`Spawn instances?`}),(0,X.jsx)(d,{children:S!==null&&(0,X.jsxs)(X.Fragment,{children:[`This spawns `,I(S),` instance`,I(S)===1?``:`s`,` of`,` `,(0,X.jsx)(`span`,{className:`font-medium text-foreground`,children:y(S)}),` `,`into the running environment.`]})})]}),(0,X.jsxs)(u,{children:[(0,X.jsx)(x,{variant:`outline`,disabled:v!==null,onClick:()=>w(null),children:`Cancel`}),(0,X.jsx)(x,{disabled:v!==null||S===null,onClick:async()=>{S!==null&&await B(S)&&w(null)},children:v===S?`Spawning...`:`Spawn`})]})]})}),(0,X.jsx)(ue,{modelName:T,onClose:()=>E(null)})]})}var he=(0,Y.memo)(function({model:e,count:t,spawning:n,onCountChange:r,onInspect:i,onSpawn:a}){return(0,X.jsxs)(`div`,{className:g(re,`flex flex-col gap-4 p-5`),children:[(0,X.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,X.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-[var(--miravo-radius-stadium-sm)] bg-primary/10 text-primary`,children:(0,X.jsx)(q,{className:`size-4`})}),(0,X.jsxs)(`div`,{className:`min-w-0 flex flex-col gap-0.5`,children:[(0,X.jsx)(`span`,{className:`font-heading text-sm font-semibold uppercase tracking-wide`,children:y(e.name)}),e.description&&(0,X.jsx)(`span`,{className:`line-clamp-2 text-xs leading-relaxed text-muted-foreground`,children:e.description})]})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 font-mono text-[11px] text-muted-foreground`,children:[(0,X.jsx)($,{label:`mbr`,value:e.memberCount}),(0,X.jsx)($,{label:`mth`,value:e.methodCount}),(0,X.jsx)($,{label:`flt`,value:e.faultCount}),e.hasLifecycle&&(0,X.jsxs)(`span`,{className:`flex items-center gap-1 text-primary`,children:[(0,X.jsx)(`span`,{className:`text-[10px]`,children:`◈`}),(0,X.jsxs)(`span`,{children:[e.lifecycleStageCount,`-stage`]})]}),(0,X.jsx)(G,{variant:`secondary`,className:`ml-auto shrink-0 font-sans text-[10px] font-medium`,children:e.source})]}),(0,X.jsxs)(`div`,{className:`mt-auto flex items-center gap-2 border-t border-border/30 pt-3`,children:[(0,X.jsxs)(`div`,{className:`flex items-center rounded-[var(--miravo-radius-tight)] border bg-muted/30`,children:[(0,X.jsx)(x,{variant:`ghost`,size:`icon`,className:`size-7 rounded-none rounded-l-md`,disabled:t<=1,"aria-label":`Decrease count`,onClick:n=>{n.stopPropagation(),r(e.name,t-1)},children:(0,X.jsx)(L,{className:`size-3`})}),(0,X.jsx)(`span`,{className:`flex size-7 items-center justify-center border-x font-mono text-xs`,children:t}),(0,X.jsx)(x,{variant:`ghost`,size:`icon`,className:`size-7 rounded-none rounded-r-md`,disabled:t>=10,"aria-label":`Increase count`,onClick:n=>{n.stopPropagation(),r(e.name,t+1)},children:(0,X.jsx)(T,{className:`size-3`})})]}),(0,X.jsxs)(x,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>i(e.name),className:te,children:[(0,X.jsx)(O,{className:`size-3.5`,"aria-hidden":!0}),`Inspect`]}),(0,X.jsxs)(x,{size:`sm`,className:`ml-auto`,disabled:n,onClick:()=>a(e.name),children:[(0,X.jsx)(U,{className:`mr-1 size-3`}),n?`...`:`Spawn`]})]})]})});function $({label:e,value:t}){return(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`span`,{className:`text-foreground`,children:t}),` `,(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:e})]})}export{q as n,me as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./platforms-DjGsPZpq.js";export{e as PlatformsPage};
|