@miravo/cli-linux-x64 0.7.8 → 0.7.9
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-Bf6pFRhP.js +1 -0
- package/console-dist/assets/api-wyOH3ffs.js +1 -0
- package/console-dist/assets/{badge-eIn_7YrK.js → badge-i00PiRCo.js} +1 -1
- package/console-dist/assets/catalog-CTpesUtM.js +1 -0
- package/console-dist/assets/catalog-DqOwOydE.js +1 -0
- package/console-dist/assets/catalog-source-W3TI0pmx.js +1 -0
- package/console-dist/assets/{checkbox-C_4HRnS_.js → checkbox-C84IyqEB.js} +1 -1
- package/console-dist/assets/{combobox-BCaV1Wbo.js → combobox-BJecIYHE.js} +1 -1
- package/console-dist/assets/control-BLUTBbet.js +1 -0
- package/console-dist/assets/control-UqwbqlvO.js +1 -0
- package/console-dist/assets/{copy-button-BvU3RDZa.js → copy-button-DnGsXbVV.js} +1 -1
- package/console-dist/assets/events-BTqDmbVu.js +1 -0
- package/console-dist/assets/events-Z0rGFYfs.js +1 -0
- package/console-dist/assets/fleet-BNba_zGa.js +1 -0
- package/console-dist/assets/fleet-C20wXA8E.js +1 -0
- package/console-dist/assets/{format-CshN6yEB.js → format-B9CcV2dj.js} +1 -1
- package/console-dist/assets/{get-error-message-SEo0k4qf.js → get-error-message-yQcVJ-Ja.js} +1 -1
- package/console-dist/assets/index-B_Xu4s7C.js +12 -0
- package/console-dist/assets/instance-detail-STqgvf7K.js +1 -0
- package/console-dist/assets/{login-B6QpC1oU.js → login-BJaFYYGh.js} +2 -2
- package/console-dist/assets/models-2VnPNXiF.js +1 -0
- package/console-dist/assets/models-DhRo1Ytd.js +1 -0
- package/console-dist/assets/{not-found-D0nX2nrf.js → not-found-BbQLiHmm.js} +1 -1
- package/console-dist/assets/platforms-DbzXekvY.js +1 -0
- package/console-dist/assets/platforms-DrKstIAm.js +1 -0
- package/console-dist/assets/query-fetch-error-BqiDQT2r.js +1 -0
- package/console-dist/assets/{select-CmlY1M1a.js → select-CMOnuEoT.js} +1 -1
- package/console-dist/assets/tabs-CCixnxMe.js +1 -0
- package/console-dist/assets/tags-CNJIRrPw.js +1 -0
- package/console-dist/assets/tags-DAJ-rQYR.js +4 -0
- package/console-dist/assets/transition-nav-link-Bf02_OAE.js +1 -0
- package/console-dist/assets/use-engine-command-mutation-RvjgD8uv.js +1 -0
- package/console-dist/assets/use-platform-stream-BVf5gGJM.js +2 -0
- package/console-dist/assets/use-transition-navigate-DtyJz2Z1.js +2 -0
- package/console-dist/assets/validation-_QtRYqIT.js +1 -0
- package/console-dist/index.html +31 -33
- package/miravo +0 -0
- package/package.json +1 -1
- package/console-dist/assets/api-DGtW0Fh4.js +0 -1
- package/console-dist/assets/catalog-DDHh7IxX.js +0 -1
- package/console-dist/assets/catalog-DZz3a6vE.js +0 -1
- package/console-dist/assets/catalog-source-DT5WAB9u.js +0 -1
- package/console-dist/assets/control-Br_1NEB0.js +0 -1
- package/console-dist/assets/control-DmjNAhq5.js +0 -1
- package/console-dist/assets/engine-store-DMULdR_V.js +0 -1
- package/console-dist/assets/events-CJIyikQE.js +0 -1
- package/console-dist/assets/events-DMpCBVAp.js +0 -1
- package/console-dist/assets/fleet-BYJ4DFYn.js +0 -1
- package/console-dist/assets/fleet-pSpdGZnr.js +0 -1
- package/console-dist/assets/index-YW1mEMDX.js +0 -12
- package/console-dist/assets/instance-detail-CVOl1-Oc.js +0 -1
- package/console-dist/assets/models-DdNy8e5C.js +0 -1
- package/console-dist/assets/models-EaysA2Qw.js +0 -1
- package/console-dist/assets/platforms-BsyqlJKi.js +0 -1
- package/console-dist/assets/platforms-DFoAeG0R.js +0 -1
- package/console-dist/assets/query-fetch-error-C6Lt-RSI.js +0 -1
- package/console-dist/assets/route-preload-CbmrjLlI.js +0 -2
- package/console-dist/assets/tabs-4SeH2unv.js +0 -1
- package/console-dist/assets/tags-CNF5b2a7.js +0 -4
- package/console-dist/assets/tags-DH-gdxLz.js +0 -1
- package/console-dist/assets/transition-nav-link-CbbvCaF1.js +0 -1
- package/console-dist/assets/use-engine-command-mutation-BJnaKdCX.js +0 -1
- package/console-dist/assets/use-platform-stream-D2Hnc-qx.js +0 -2
- package/console-dist/assets/use-transition-navigate-DHgJJMdL.js +0 -1
- package/console-dist/assets/validation-CCol1kXN.js +0 -1
- /package/console-dist/assets/{auth-screen-backdrop-Cr8qBSXP.js → auth-screen-backdrop-CgwRhIbi.js} +0 -0
- /package/console-dist/assets/{dropdown-menu-CrPXVXpG.js → dropdown-menu-82O7jPU6.js} +0 -0
- /package/console-dist/assets/{label-CMBWxUhA.js → label-DTHSKF2S.js} +0 -0
- /package/console-dist/assets/{runtime-link-PMxeHxd6.js → runtime-link-D-uJbw97.js} +0 -0
- /package/console-dist/assets/{select-display-items-Bqb6Sbg6.js → select-display-items-y2L7MHmk.js} +0 -0
- /package/console-dist/assets/{transition-types-2i1blGlR.js → transition-types-CPlGtM8w.js} +0 -0
- /package/console-dist/assets/{vendor-table-BAHQgdwg.js → vendor-table-SVvT6QrW.js} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{a as t,c as n,i as r,n as i,o as a,r as o,t as s}from"./vendor-charts-95ykyDlI.js";import{at as c}from"./vendor-ui-CWUk2ulb.js";import{S as l,o as u,rt as d,v as f}from"./api-Bf6pFRhP.js";import{i as p,n as m,t as ee}from"./query-fetch-error-BqiDQT2r.js";import{t as h}from"./proxy-Be4WzmcS.js";import{i as te,r as ne}from"./dist-xY0pK9Wy.js";import{c as re,l as ie}from"./chunk-OE4NN4TA-DBWZidbW.js";import{a as g,i as _,n as v,r as y,s as b,t as x}from"./copy-button-DnGsXbVV.js";import{C as S,S as C,_ as w,a as T,c as E,d as D,i as O,l as ae,m as k,n as A,p as j,r as M,v as N,x as P}from"./format-B9CcV2dj.js";import{n as F,t as I}from"./utils-XFKvwlFT.js";import{t as oe}from"./activity-Cy_niK56.js";import{a as se,c as ce,i as le,n as ue,o as L,r as de,s as fe,t as pe}from"./tabs-CCixnxMe.js";import{c as me,l as he,o as ge,s as R}from"./validation-_QtRYqIT.js";import{a as _e,c as z,o as B,t as ve}from"./use-engine-command-mutation-RvjgD8uv.js";import{t as V}from"./triangle-alert-BXrJNk3g.js";import{i as H,n as U,t as W}from"./tooltip-D1ydB4g3.js";import{t as ye}from"./badge-i00PiRCo.js";import{t as be}from"./transition-types-CPlGtM8w.js";import{n as xe}from"./auth-screen-backdrop-CgwRhIbi.js";import{n as Se}from"./get-error-message-yQcVJ-Ja.js";var Ce=F(`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`}]]),we=F(`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`}]]),Te=F(`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(n(),1),K=c(),q=`bg-transparent bg-transparent`,J=`blueprint-title text-foreground`;function Ee(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 De({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?L:z;return t.description?(0,K.jsxs)(W,{children:[(0,K.jsx)(H,{render:(0,K.jsxs)(S,{size:`sm`,variant:`outline`,disabled:i,title:e,className:I(`h-8 gap-1.5 font-mono text-xs`,q),onClick:()=>r(e),children:[(0,K.jsx)(o,{className:I(`size-3`,n&&`animate-spin`),"aria-hidden":!0}),E(e)]})}),(0,K.jsx)(U,{side:`bottom`,className:`max-w-xs`,children:t.description})]},e):(0,K.jsxs)(S,{size:`sm`,variant:`outline`,disabled:i,title:e,className:I(`h-8 gap-1.5 font-mono text-xs`,q),onClick:()=>r(e),children:[(0,K.jsx)(o,{className:I(`size-3`,n&&`animate-spin`),"aria-hidden":!0}),E(e)]},e)})}),c.length>0&&s.length>0&&(0,K.jsx)(R,{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:E(e)}),o.description&&(0,K.jsx)(`p`,{className:`mt-0.5 text-[10px] text-muted-foreground`,children:o.description})]}),(0,K.jsxs)(S,{size:`sm`,variant:`default`,disabled:i,className:`shrink-0`,onClick:()=>r(e),children:[s?(0,K.jsx)(L,{className:`mr-1 size-3 animate-spin`,"aria-hidden":!0}):(0,K.jsx)(z,{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:E(r.name)}),(0,K.jsx)(C,{className:`h-7 flex-1 font-mono text-xs`,placeholder:Ee(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 Oe({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)(V,{className:`size-4 shrink-0 text-destructive`}),(0,K.jsx)(`span`,{title:e,className:`font-mono text-sm font-medium text-destructive`,children:E(e)})]}),(0,K.jsxs)(S,{size:`sm`,variant:`outline`,className:I(`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)(fe,{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)(ce,{className:`size-4 text-success`}),`All clear — no active faults`]}),t.length>0&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(R,{className:`bg-border/60`}),(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`p`,{className:I(J,`mb-2`),children:[`Inject fault`,(0,K.jsxs)(ye,{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)(S,{size:`sm`,variant:`outline`,title:e,className:I(`h-7 font-mono text-[10px]`,q),onClick:()=>o(e),children:E(e)},e))})]})]}),(0,K.jsx)(v,{open:a!==null,onOpenChange:e=>{e||o(null)},children:(0,K.jsxs)(y,{children:[(0,K.jsx)(b,{className:`font-heading text-lg font-semibold tracking-tight`,children:`Inject fault?`}),(0,K.jsxs)(_,{className:`text-sm text-muted-foreground`,children:[`This asserts`,` `,(0,K.jsx)(`span`,{title:a??void 0,className:`font-mono text-foreground`,children:a?E(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)(g,{children:[(0,K.jsx)(S,{variant:`outline`,onClick:()=>o(null),children:`Cancel`}),(0,K.jsxs)(S,{variant:`destructive`,onClick:()=>{a&&n(a),o(null)},children:[(0,K.jsx)(V,{className:`mr-1 size-3.5`,"aria-hidden":!0}),`Inject fault`]})]})]})})]})}function ke({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:I(B,`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:D(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:ae(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)(x,{value:T(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)(se,{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)(W,{children:[(0,K.jsx)(H,{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:I(`relative inline-flex size-1.5 rounded-full`,m.dot)}),m.animate&&(0,K.jsx)(`span`,{className:I(`absolute inline-flex size-2.5 animate-ping rounded-full opacity-75`,m.pulse)})]})}),(0,K.jsx)(U,{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:oe,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:V,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:Ce,label:`Lifecycle`,labelCompact:`Life`,value:E(e.lifecycleStage),tone:P(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:we,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:Te,label:`Operating age`,value:k(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:I(`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)(W,{children:[(0,K.jsxs)(H,{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:I(`shrink-0 text-muted-foreground`,c?`size-4`:`size-3.5`),"aria-hidden":!0}),(0,K.jsxs)(`span`,{className:I(`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)(U,{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:I(`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:I(`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:I(_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})]})}var Ae=new Set([`pu`,`h`]),je=[`_reference`,`_baseline`,`_setpoint`,`_command`],Z=`var(--color-primary)`,Me=`var(--color-background)`,Ne=60,Pe=1e-4;function Q(e,t,n){let r=e?.get(t);return{value:r?.value??n.value,quality:r?.quality??n.quality}}function Fe(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&&!Ae.has(t.meta.unit??``)&&!je.some(t=>e.endsWith(t)))}function Ie(e,t){if(e.length<2)return!1;let n=t-Ne,r;for(let t of e)if(!(t.tick<n)){if(r===void 0){r=t.value;continue}if(Math.abs(t.value-r)>Pe)return!0}return!1}function Le({data:e,chartHeight:n=34,live:c=!1}){let l=(0,G.useId)(),[u,d]=(0,G.useState)(null),f=1/0,p=-1/0;for(let t of e)t.value<f&&(f=t.value),t.value>p&&(p=t.value);let m=e[e.length-1];return(0,K.jsxs)(`div`,{className:`flex min-h-0 w-full flex-col overflow-hidden`,style:{height:n+14},children:[(0,K.jsx)(`div`,{style:{height:n,width:`100%`},children:(0,K.jsx)(t,{width:`100%`,height:n,children:(0,K.jsxs)(s,{data:e,margin:{top:3,right:4,bottom:2,left:0},onMouseMove:e=>{let t=e?.activePayload?.[0]?.value;typeof t==`number`&&d(t)},onMouseLeave:()=>d(null),children:[(0,K.jsx)(`defs`,{children:(0,K.jsxs)(`linearGradient`,{id:l,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,K.jsx)(`stop`,{offset:`0%`,stopColor:Z,stopOpacity:.32}),(0,K.jsx)(`stop`,{offset:`100%`,stopColor:Z,stopOpacity:0})]})}),(0,K.jsx)(i,{domain:[`auto`,`auto`],hide:!0}),(0,K.jsx)(a,{content:()=>null,cursor:!1}),(0,K.jsx)(o,{type:`monotone`,dataKey:`value`,stroke:Z,strokeWidth:1.5,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`url(#${l})`,isAnimationActive:!1,dot:!1,activeDot:{r:3,fill:Z,stroke:Me,strokeWidth:1}}),m?(0,K.jsx)(r,{x:m.tick,y:m.value,r:2.25,fill:Z,stroke:Me,strokeWidth:1.25,isFront:!0,ifOverflow:`extendDomain`}):null]})})}),(0,K.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[10px] leading-none tabular-nums text-muted-foreground`,children:[c?(0,K.jsxs)(`span`,{"aria-hidden":!0,className:`relative inline-flex size-1.5 shrink-0 items-center justify-center`,children:[(0,K.jsx)(`span`,{className:`absolute inline-flex size-2 animate-ping rounded-full bg-primary/50`}),(0,K.jsx)(`span`,{className:`relative inline-flex size-1.5 rounded-full bg-primary`})]}):null,u===null?(0,K.jsxs)(`span`,{children:[j(f),`–`,j(p)]}):(0,K.jsx)(`span`,{className:`font-medium text-primary`,children:j(u)})]})]})}function Re({detail:e,processVariables:t,memberValues:n,historyRef:r,tick:i,showQuality:a}){let{liveMap:o,orderedVariables:s}=(0,G.useMemo)(()=>{let e=new Map,n=[],a=[];for(let o of t){let t=Ie(r.current.get(o[0])??[],i);e.set(o[0],t),(t?n:a).push(o)}return{liveMap:e,orderedVariables:[...n,...a]}},[t,n,i,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:s.map(([t,i])=>{let{value:s,quality:c}=Q(n,t,i),l=r.current.get(t)??[],u=O(e.browsePath,t),d=o.get(t)??!1,f=l.length>=2,p=N(i.meta.unit),m=w(t);return(0,K.jsxs)(h.li,{layout:`position`,transition:{duration:.36,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)(W,{children:[(0,K.jsx)(H,{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:m}),(0,K.jsx)(U,{side:`top`,align:`start`,className:`max-w-xs`,children:m})]}),(0,K.jsx)(x,{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`}),f?(0,K.jsx)(Le,{data:l,chartHeight:42,live:d}):(0,K.jsx)(`p`,{className:`flex h-full items-center text-[10px] uppercase tracking-widest text-muted-foreground`,children:`Collecting trend…`})]}),(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`?j(s):String(s)}),p&&(0,K.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:p}),a&&c!==`good`&&(0,K.jsx)(ye,{variant:c===`uncertain`?`secondary`:`destructive`,className:`shrink-0 text-[10px]`,children:c})]})]},t)})})})}function ze({name:e,value:t,dataType:n,unit:r,access:i}){let a=w(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=A.has(n)||e.includes(`fault_code`)&&!r,o=!i&&M.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:E(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`?j(t):String(t),r&&(0,K.jsx)(`span`,{className:`ml-1 text-[10px] text-muted-foreground`,children:N(r)})]})]})}function Be(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 Ve({stringEnumMembers:e,nonStringOperationalMembers:t,memberValues:n,className:r}){let i=(0,G.useMemo)(()=>Be(e),[e]),a=(0,G.useMemo)(()=>Be(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{value:r}=Q(n,e,t);return(0,K.jsx)(ze,{name:e,value:r,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{value:r}=Q(n,e,t);return(0,K.jsx)(ze,{name:e,value:r,dataType:t.meta.dataType,unit:t.meta.unit,access:t.meta.access},e)})})]})]})})}function $({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{value:r}=Q(n,e,t);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:w(e)}),(0,K.jsxs)(`span`,{className:`blueprint-stat text-sm font-medium`,children:[typeof r==`number`?j(r):String(r),t.meta.unit&&(0,K.jsx)(`span`,{className:`ml-1 text-[10px] text-muted-foreground`,children:N(t.meta.unit)})]})]},e)})})})}function He({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:w(e)}),(0,K.jsxs)(`span`,{className:`font-mono text-sm font-medium`,children:[typeof t.value==`number`?j(t.value):String(t.value),t.unit&&(0,K.jsx)(`span`,{className:`ml-1 text-[10px] text-muted-foreground`,children:N(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{value:n}=Q(r,e,t);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:w(e)}),(0,K.jsxs)(`span`,{className:`font-mono text-sm font-medium`,children:[typeof n==`number`?j(n):String(n),t.meta.unit&&(0,K.jsx)(`span`,{className:`ml-1 text-[10px] text-muted-foreground`,children:N(t.meta.unit)})]})]},e)})})]})})}var Ue=120,We=`gap-4 sm:gap-5 lg:gap-x-6 lg:gap-y-5 xl:gap-x-8`,Ge=`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 Ke(e){return e instanceof Error&&`code`in e&&e.code===`NOT_FOUND`?!0:e instanceof Error&&/^404\b/.test(e.message.trim())}function qe(){let{id:e}=ie(),t=re(),n=(0,G.useCallback)(()=>{(0,G.startTransition)(()=>{(0,G.addTransitionType)(be),t(`/`)})},[t]),[r,i]=(0,G.useState)({}),[a,o]=(0,G.useState)(null),[s,c]=(0,G.useState)(!1),[g,_]=te(`tab`,ne([`hmi`,`operate`,`data`,`operations`]).withDefault(`hmi`)),v=g===`data`||g===`operations`?`operate`:g,y=ve();(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===`?`&&(c(!0),i.preventDefault())};return window.addEventListener(`keydown`,i),()=>{window.removeEventListener(`keydown`,i),r()}},[n,b]);let x=p({queryKey:f.instances.detail(e??``),queryFn:()=>u(`/instances/${e}`,l.instanceDetail),enabled:e!==void 0}),C=(0,G.useDeferredValue)(x.data??null),w=x.isError,T=d(t=>e?t.memberValues.get(e):void 0),E=d(e=>e.models),D=d(e=>e.instances),O=(0,G.useMemo)(()=>D.find(t=>t.id===e),[D,e]),ae=O?.activeFaults,k=(0,G.useRef)(new Map),A=d(e=>e.tick);(0,G.useEffect)(()=>{if(!T||!e)return;let t=k.current;for(let[e,n]of T){if(typeof n.value!=`number`)continue;let r=t.get(e)??[];if(r[r.length-1]?.tick===A)continue;let i=r.length>=Ue?r.slice(r.length-Ue+1):r;t.set(e,[...i,{value:n.value,tick:A}])}},[T,A,e]);let j=(0,G.useMemo)(()=>C?Fe(C):[],[C]),M=(0,G.useMemo)(()=>{if(!C)return{operational:[],counters:[],reference:[]};let e=new Set(j.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`||je.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,j]),N=(0,G.useMemo)(()=>C?E.find(e=>e.name===C.assetType)?.faultNames??[]:[],[C,E]),P=ae??C?.activeFaults??[],F=(0,G.useMemo)(()=>{if(!T)return P.length>0;for(let[,e]of T)if(e.quality!==`good`)return!0;return!1},[T,P.length]),oe=(0,G.useMemo)(()=>M.operational.filter(([,e])=>e.meta.dataType===`String`),[M.operational]),se=(0,G.useMemo)(()=>M.operational.filter(([,e])=>e.meta.dataType!==`String`),[M.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 x.refetch()}).catch(()=>{})},L=t=>{e&&y.mutateAsync({type:`triggerFault`,instanceId:e,fault:t}).then(async()=>{await x.refetch()}).catch(()=>{})},fe=t=>{e&&y.mutateAsync({type:`clearFault`,instanceId:e,fault:t}).then(async()=>{await x.refetch()}).catch(()=>{})};if(!C)return w?Ke(x.error)?(0,K.jsx)(xe,{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)(m,{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)(xe,{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)(ee,{message:Se(x.error,`Could not load instance.`),onRetry:()=>void x.refetch(),isRetrying:x.isFetching})}),(0,K.jsx)(S,{variant:`outline`,size:`sm`,onClick:n,children:`Back to Fleet`})]})}):O?(0,K.jsx)(`div`,{className:Ge,children:(0,K.jsx)(ke,{detail:{id:O.id,assetType:O.model,browsePath:O.browsePath,lifecycleStage:O.lifecycleStage,operatingHours:O.operatingHours,activeFaults:O.activeFaults,isQuarantined:O.isQuarantined,parameters:{},members:{},methods:{}},tick:A,activeFaults:P,memberValues:T,onBack:n})}):null;let R=M.operational.length>0,z=M.counters.length>0,B=M.reference.length>0||Object.keys(C.parameters).length>0,V=R||z||B,H=Object.keys(C.methods).length>0,U=R&&!z&&!B,W=R&&z&&B;return(0,K.jsxs)(`div`,{className:Ge,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)(ke,{detail:C,tick:A,activeFaults:P,memberValues:T,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)(de,{variant:`line`,className:`h-10! min-w-max gap-0.5`,children:[(0,K.jsxs)(le,{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)(le,{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)(ue,{value:`hmi`,className:`flex-1 py-2`,children:(0,K.jsx)(h.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.15,ease:`easeOut`},children:(0,K.jsx)(Re,{detail:C,processVariables:j,memberValues:T,historyRef:k,tick:A,showQuality:F})},`hmi`)}),(0,K.jsx)(ue,{value:`operate`,className:`flex-1 py-2`,children:(0,K.jsxs)(h.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:[V&&(0,K.jsxs)(`section`,{"aria-label":`Data`,className:I(`grid min-w-0 grid-cols-1`,We,W&&`lg:grid-cols-2 lg:grid-rows-[auto_auto] lg:items-start`,!W&&R&&(z||B)&&`lg:grid-cols-2 lg:items-start`),children:[R&&(0,K.jsx)(Ve,{stringEnumMembers:oe,nonStringOperationalMembers:se,memberValues:T,className:I(`min-h-0 min-w-0 self-stretch`,U&&`lg:col-span-2`,W&&`lg:row-span-2`)}),!R&&z&&B&&(0,K.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-col gap-6 lg:col-span-2`,children:[(0,K.jsx)($,{counters:M.counters,memberValues:T}),(0,K.jsx)(He,{detail:C,referenceMembers:M.reference,memberValues:T})]}),!R&&z&&!B&&(0,K.jsx)($,{className:`lg:col-span-2`,counters:M.counters,memberValues:T}),!R&&!z&&B&&(0,K.jsx)(He,{className:`lg:col-span-2`,detail:C,referenceMembers:M.reference,memberValues:T}),R&&z&&(0,K.jsx)($,{className:`min-h-0 min-w-0 self-stretch lg:col-start-2 lg:row-start-1`,counters:M.counters,memberValues:T}),R&&B&&(0,K.jsx)(He,{className:I(`min-h-0 min-w-0 self-stretch lg:col-start-2`,W?`lg:row-start-2`:`lg:row-start-1`),detail:C,referenceMembers:M.reference,memberValues:T})]}),(0,K.jsxs)(`section`,{"aria-label":`Operations`,className:I(_e,`grid grid-cols-1`,H&&`lg:grid-cols-2`),children:[(0,K.jsx)(Oe,{activeFaults:P,availableFaults:N,onTriggerFault:L,onClearFault:fe}),H&&(0,K.jsx)(`div`,{className:`border-t border-border/50 lg:border-l lg:border-t-0`,children:(0,K.jsx)(De,{detail:C,methodArgs:r,setMethodArgs:i,onInvoke:ce,isPending:y.isPending,pendingMethod:a})})]})]},`operate`)})]})}),(0,K.jsx)(Je,{open:s,onOpenChange:c})]})}function Je({open:e,onOpenChange:t}){return(0,K.jsx)(v,{open:e,onOpenChange:t,children:(0,K.jsxs)(y,{children:[(0,K.jsx)(b,{className:`font-heading text-lg font-semibold tracking-tight`,children:`Keyboard shortcuts`}),(0,K.jsx)(_,{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{qe as InstanceDetailPage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{at as n}from"./vendor-ui-CWUk2ulb.js";import{
|
|
1
|
+
import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{at as n}from"./vendor-ui-CWUk2ulb.js";import{l as r,r as i,y as a}from"./api-Bf6pFRhP.js";import{t as o}from"./use-transition-navigate-DtyJz2Z1.js";import{t as s}from"./transition-nav-link-Bf02_OAE.js";import{n as c}from"./get-error-message-yQcVJ-Ja.js";var l=e(t(),1),u=n(),d=`
|
|
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); }
|
|
@@ -133,4 +133,4 @@ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-c
|
|
|
133
133
|
color: var(--foreground);
|
|
134
134
|
text-decoration-color: var(--tooltip-border);
|
|
135
135
|
}
|
|
136
|
-
`;function f({label:e,forId:t,children:n}){return(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`label`,{htmlFor:t,style:{fontFamily:`var(--font-mono)`,fontSize:`0.72rem`,letterSpacing:`0.03em`,color:`var(--muted-foreground)`,display:`block`,marginBottom:`0.5rem`},children:e}),n]})}function p({message:e}){return(0,u.jsx)(`p`,{role:`alert`,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,r]=(0,l.useState)(``),[s,d]=(0,l.useState)(``),[m,h]=(0,l.useState)(``),[g,_]=(0,l.useState)(!1);async function v(r){r.preventDefault(),h(``),_(!0);try{(await i(n,s)).changePassword?e(n):(a.removeQueries({queryKey:[`bootstrap`]}),t(`/`,{replace:!0}))}catch(e){h(c(e,`Login failed`))}finally{_(!1)}}return(0,u.jsxs)(`form`,{onSubmit:v,children:[(0,u.jsx)(`div`,{style:{marginBottom:`2rem`},children:(0,u.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`})}),m&&(0,u.jsx)(p,{message:m}),(0,u.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`1.15rem`},children:[(0,u.jsx)(f,{label:`Username`,forId:`username`,children:(0,u.jsx)(`input`,{id:`username`,type:`text`,className:`miravo-input`,autoComplete:`username`,required:!0,value:n,onChange:e=>r(e.target.value)})}),(0,u.jsx)(f,{label:`Password`,forId:`password`,children:(0,u.jsx)(`input`,{id:`password`,type:`password`,className:`miravo-input`,autoComplete:`current-password`,required:!0,value:s,onChange:e=>d(e.target.value)})}),(0,u.jsx)(`button`,{type:`submit`,className:`miravo-btn`,disabled:g,style:{marginTop:`0.5rem`},children:g?`Logging in…`:`Log in`})]})]})}function h({username:e}){let t=o(),[n,i]=(0,l.useState)(``),[s,d]=(0,l.useState)(``),[m,h]=(0,l.useState)(``),[g,_]=(0,l.useState)(!1);async function v(i){if(i.preventDefault(),h(``),n!==s){h(`Passwords do not match`);return}if(n.length<6){h(`Password must be at least 6 characters`);return}_(!0);try{await r(e,n),a.removeQueries({queryKey:[`bootstrap`]}),t(`/`,{replace:!0})}catch(e){h(c(e,`Password change failed`))}finally{_(!1)}}return(0,u.jsxs)(`form`,{onSubmit:v,children:[(0,u.jsxs)(`div`,{style:{marginBottom:`2rem`},children:[(0,u.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,u.jsxs)(`p`,{style:{fontSize:`0.82rem`,color:`var(--muted-foreground)`,marginTop:`0.4rem`,lineHeight:1.5},children:[`Default password detected.`,` `,(0,u.jsx)(`span`,{style:{color:`var(--warning)`},children:`Please set a new one.`})]})]}),m&&(0,u.jsx)(p,{message:m}),(0,u.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`1.1rem`},children:[(0,u.jsx)(f,{label:`New password`,forId:`new-password`,children:(0,u.jsx)(`input`,{id:`new-password`,type:`password`,className:`miravo-input`,autoComplete:`new-password`,required:!0,minLength:6,value:n,onChange:e=>i(e.target.value)})}),(0,u.jsx)(f,{label:`Confirm password`,forId:`confirm-password`,children:(0,u.jsx)(`input`,{id:`confirm-password`,type:`password`,className:`miravo-input`,autoComplete:`new-password`,required:!0,minLength:6,value:s,onChange:e=>d(e.target.value)})}),(0,u.jsx)(`button`,{type:`submit`,className:`miravo-btn`,disabled:g,style:{marginTop:`0.4rem`},children:g?`Setting password…`:`Set password`}),(0,u.jsx)(`div`,{style:{textAlign:`center`,marginTop:`0.15rem`},children:(0,u.jsx)(`button`,{type:`button`,className:`miravo-btn-ghost`,onClick:()=>{a.removeQueries({queryKey:[`bootstrap`]}),t(`/`,{replace:!0})},children:`Skip for now`})})]})]})}function g(){let e=(0,l.useRef)(null);return(0,l.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,d=[],f=[],p=[];function m(){d=[],f=[],p=[];let e=Math.max(15,Math.floor(s*c/35e3));for(let t=0;t<e;t++)d.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<d.length;e++)for(let t=e+1;t<d.length;t++){let n=d[e],r=d[t];!n||!r||Math.hypot(n.bx-r.bx,n.by-r.by)<160&&Math.random()>.5&&f.push({from:e,to:t})}}function h(){s=r.offsetWidth,c=r.offsetHeight,r.width=s*o,r.height=c*o,i.setTransform(o,0,0,o,0,0),m()}function g(){l+=.016,i.clearRect(0,0,s,c);for(let e of d)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 p)e.add(t.conn.from*256+t.conn.to);i.strokeStyle=a,i.lineWidth=.5;for(let t of f){let n=d[t.from],r=d[t.to];!n||!r||(i.globalAlpha=e.has(t.from*256+t.to)?.04:.012,i.beginPath(),i.moveTo(n.x,n.y),i.lineTo(r.x,r.y),i.stroke())}i.fillStyle=a;for(let e of d)i.globalAlpha=.08*(.6+Math.sin(l*.4+e.phase)*.4),i.beginPath(),i.arc(e.x,e.y,e.r,0,Math.PI*2),i.fill();if(Math.random()<.03&&f.length&&p.length<10){let e=f[Math.floor(Math.random()*f.length)];e&&p.push({conn:e,t:0,speed:.002+Math.random()*.003,alpha:.25+Math.random()*.35,size:1+Math.random()*1})}i.fillStyle=a;for(let e=p.length-1;e>=0;e--){let t=p[e];if(!t)continue;if(t.t+=t.speed,t.t>=1){p.splice(e,1);continue}let n=d[t.conn.from],r=d[t.conn.to];if(!n||!r)continue;let a=n.x+(r.x-n.x)*t.t,o=n.y+(r.y-n.y)*t.t;i.globalAlpha=t.alpha*.35,i.beginPath(),i.arc(a,o,t.size,0,Math.PI*2),i.fill()}i.globalAlpha=1,u=requestAnimationFrame(g)}let _=()=>{document.hidden?cancelAnimationFrame(u):u=requestAnimationFrame(g)},v,y=()=>{window.clearTimeout(v),v=window.setTimeout(h,250)};if(!window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return document.addEventListener(`visibilitychange`,_),window.addEventListener(`resize`,y),h(),g(),()=>{cancelAnimationFrame(u),window.clearTimeout(v),document.removeEventListener(`visibilitychange`,_),window.removeEventListener(`resize`,y)}},[]),(0,u.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,l.useState)(()=>_.map(e=>({...e,displayValue:(e.base+(Math.random()-.5)*e.range).toFixed(e.decimals),flash:!1})));return(0,l.useEffect)(()=>{let e;function n(){document.hidden||(t(e=>e.map(e=>({...e,displayValue:(e.base+(Math.random()-.5)*e.range).toFixed(e.decimals),flash:!0}))),window.clearTimeout(e),e=window.setTimeout(()=>{t(e=>e.map(e=>({...e,flash:!1})))},400))}let r=window.setInterval(n,2200);return()=>{window.clearInterval(r),window.clearTimeout(e)}},[]),(0,u.jsx)(`div`,{style:{position:`absolute`,inset:0,zIndex:3,pointerEvents:`none`},children:e.map(e=>(0,u.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,u.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,u.jsx)(`span`,{style:{color:`var(--tooltip-border)`},children:e.path}),(0,u.jsx)(`span`,{style:{color:e.flash?`var(--warning)`:`var(--primary)`,fontWeight:600,minWidth:`3em`,textAlign:`right`,transition:`color 0.4s`},children:e.displayValue}),(0,u.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,l.useState)(0),[n,r]=(0,l.useState)(0),[i,a]=(0,l.useState)(()=>x.map(e=>e.value?(e.value.base+(Math.random()-.5)*e.value.range).toFixed(e.value.decimals):``)),[o,s]=(0,l.useState)(new Set),[c,d]=(0,l.useState)(null),[f,p]=(0,l.useState)(`+231 tags streaming`),m=(0,l.useRef)(new Set);(0,l.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,u.jsx)(`div`,{style:{position:`absolute`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,zIndex:5,pointerEvents:`none`},children:(0,u.jsxs)(`div`,{style:{border:`1px solid color-mix(in srgb, var(--primary) 10%, transparent)`,borderRadius:4,boxShadow:`none`,overflow:`hidden`,width:540},children:[(0,u.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,u.jsx)(`span`,{style:{width:7,height:7,borderRadius:`50%`,background:`#ff5f57`,opacity:.5}}),(0,u.jsx)(`span`,{style:{width:7,height:7,borderRadius:`50%`,background:`#febc2e`,opacity:.5}}),(0,u.jsx)(`span`,{style:{width:7,height:7,borderRadius:`50%`,background:`#28c840`,opacity:.5}}),(0,u.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,u.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,u.jsxs)(`div`,{children:[(0,u.jsx)(`span`,{style:{color:`var(--muted-foreground)`},children:`$ `}),(0,u.jsx)(`span`,{style:{color:`var(--primary)`},children:h}),(0,u.jsx)(`span`,{style:{color:`var(--foreground)`,opacity:.9},children:g}),e>0&&e<37&&(0,u.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,u.jsxs)(`div`,{style:{opacity:0,animation:`terminal-line 0.4s ease forwards`},children:[(0,u.jsx)(`span`,{style:{color:`var(--primary)`},children:`✓`}),(0,u.jsx)(`span`,{style:{color:`var(--tooltip-foreground)`},children:` Loaded `}),(0,u.jsx)(`span`,{style:{color:`var(--primary)`},children:`smart-factory`}),(0,u.jsx)(`span`,{style:{color:`var(--muted-foreground)`},children:` · 10 assets · 240 tags`})]}),n>=2&&(0,u.jsxs)(`div`,{style:{opacity:0,animation:`terminal-line 0.4s ease 0.05s forwards`},children:[(0,u.jsx)(`span`,{style:{color:`var(--primary)`},children:`✓`}),(0,u.jsx)(`span`,{style:{color:`var(--tooltip-foreground)`},children:` Protocols `}),(0,u.jsx)(`span`,{style:{color:`var(--muted-foreground)`},children:`mqtt :1883 · opcua :4840 · modbus :1502`})]}),n>=3&&(0,u.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,u.jsxs)(`div`,{style:{opacity:0,animation:`tree-line 0.3s ease forwards`},children:[(0,u.jsx)(`span`,{style:{color:`var(--tooltip-border)`},children:e.indent}),r&&e.value?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`span`,{style:{color:`var(--muted-foreground)`},children:e.text.padEnd(S)}),(0,u.jsx)(`span`,{style:{color:c?.indices.has(t)?`var(--destructive)`:o.has(t)?`var(--primary)`:`var(--foreground)`,transition:`color 0.3s`},children:(i[t]??``).padStart(7)}),(0,u.jsx)(`span`,{style:{color:`var(--tooltip-border)`},children:` ${e.value.unit.padEnd(5)}`}),e.protocol&&(0,u.jsx)(`span`,{style:{color:`var(--tooltip-border)`},children:e.protocol})]}):(0,u.jsxs)(u.Fragment,{children:[e.label&&(0,u.jsx)(`span`,{style:{color:`var(--tooltip-border)`},children:`${e.label}: `}),(0,u.jsx)(`span`,{style:{color:`var(--tooltip-foreground)`},children:e.text}),e.label===`cell`&&c?.assetId===e.id&&(0,u.jsxs)(`span`,{style:{marginLeft:`0.8em`,color:`var(--destructive)`,fontSize:`0.9em`},children:[`: `,c.name]})]})]},e.id)}),n>=w&&(0,u.jsx)(`div`,{style:{opacity:0,animation:`terminal-line 0.4s ease forwards`,marginTop:`0.55em`,textAlign:`right`},children:(0,u.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,l.useState)(!1),[n,r]=(0,l.useState)(``);return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`style`,{children:d}),(0,u.jsxs)(`div`,{className:`login-page`,children:[(0,u.jsxs)(`div`,{className:`login-form-panel`,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,u.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,u.jsx)(`div`,{className:`login-header`,style:{padding:`1.25rem 2rem`,borderBottom:`1px solid var(--secondary)`,zIndex:1,display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:(0,u.jsxs)(s,{to:`/`,style:{display:`inline-flex`,alignItems:`center`,gap:`0.5rem`,textDecoration:`none`},children:[(0,u.jsx)(`span`,{style:{display:`flex`,width:32,height:32,flexShrink:0,alignItems:`center`,justifyContent:`center`},children:(0,u.jsx)(`img`,{src:`/miravo-logo.webp`,alt:``,width:28,height:28,loading:`eager`,decoding:`async`,style:{display:`block`,width:`100%`,height:`100%`,objectFit:`contain`,transform:`translateY(1.5px)`}})}),(0,u.jsx)(`span`,{style:{fontFamily:`var(--font-heading)`,fontSize:`1.25rem`,fontWeight:600,color:`var(--foreground)`,letterSpacing:`-0.025em`,lineHeight:1},children:`Miravo`}),(0,u.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.2rem 0.5rem`,borderRadius:4,lineHeight:1,display:`inline-flex`,alignItems:`center`,alignSelf:`center`},children:`Console`})]})}),(0,u.jsx)(`div`,{className:`login-form-area`,style:{flex:1,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`2.5rem 2rem`,zIndex:1},children:(0,u.jsx)(`div`,{style:{width:`100%`,maxWidth:370},children:(0,u.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,u.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,u.jsx)(h,{username:n}):(0,u.jsx)(m,{onChangePassword:e=>{r(e),t(!0)}})]})})}),(0,u.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,u.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,fontSize:`0.6rem`,color:`var(--tooltip-border)`,letterSpacing:`0.04em`},children:`Miravo Console`}),(0,u.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,fontSize:`0.6rem`,color:`var(--tooltip-border)`,letterSpacing:`0.04em`},children:`© 2026`})]})]}),(0,u.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,u.jsx)(`div`,{style:{position:`absolute`,inset:0,zIndex:4,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,u.jsx)(g,{}),(0,u.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,u.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,u.jsx)(v,{}),(0,u.jsx)(A,{})]})]})]})}export{j as LoginPage};
|
|
136
|
+
`;function f({label:e,forId:t,children:n}){return(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`label`,{htmlFor:t,style:{fontFamily:`var(--font-mono)`,fontSize:`0.72rem`,letterSpacing:`0.03em`,color:`var(--muted-foreground)`,display:`block`,marginBottom:`0.5rem`},children:e}),n]})}function p({message:e}){return(0,u.jsx)(`p`,{role:`alert`,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,i]=(0,l.useState)(``),[s,d]=(0,l.useState)(``),[m,h]=(0,l.useState)(``),[g,_]=(0,l.useState)(!1);async function v(i){i.preventDefault(),h(``),_(!0);try{(await r(n,s)).changePassword?e(n):(a.removeQueries({queryKey:[`bootstrap`]}),t(`/`,{replace:!0}))}catch(e){h(c(e,`Login failed`))}finally{_(!1)}}return(0,u.jsxs)(`form`,{onSubmit:v,children:[(0,u.jsx)(`div`,{style:{marginBottom:`2rem`},children:(0,u.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`})}),m&&(0,u.jsx)(p,{message:m}),(0,u.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`1.15rem`},children:[(0,u.jsx)(f,{label:`Username`,forId:`username`,children:(0,u.jsx)(`input`,{id:`username`,type:`text`,className:`miravo-input`,autoComplete:`username`,required:!0,value:n,onChange:e=>i(e.target.value)})}),(0,u.jsx)(f,{label:`Password`,forId:`password`,children:(0,u.jsx)(`input`,{id:`password`,type:`password`,className:`miravo-input`,autoComplete:`current-password`,required:!0,value:s,onChange:e=>d(e.target.value)})}),(0,u.jsx)(`button`,{type:`submit`,className:`miravo-btn`,disabled:g,style:{marginTop:`0.5rem`},children:g?`Logging in…`:`Log in`})]})]})}function h({username:e}){let t=o(),[n,r]=(0,l.useState)(``),[s,d]=(0,l.useState)(``),[m,h]=(0,l.useState)(``),[g,_]=(0,l.useState)(!1);async function v(r){if(r.preventDefault(),h(``),n!==s){h(`Passwords do not match`);return}if(n.length<6){h(`Password must be at least 6 characters`);return}_(!0);try{await i(e,n),a.removeQueries({queryKey:[`bootstrap`]}),t(`/`,{replace:!0})}catch(e){h(c(e,`Password change failed`))}finally{_(!1)}}return(0,u.jsxs)(`form`,{onSubmit:v,children:[(0,u.jsxs)(`div`,{style:{marginBottom:`2rem`},children:[(0,u.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,u.jsxs)(`p`,{style:{fontSize:`0.82rem`,color:`var(--muted-foreground)`,marginTop:`0.4rem`,lineHeight:1.5},children:[`Default password detected.`,` `,(0,u.jsx)(`span`,{style:{color:`var(--warning)`},children:`Please set a new one.`})]})]}),m&&(0,u.jsx)(p,{message:m}),(0,u.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`1.1rem`},children:[(0,u.jsx)(f,{label:`New password`,forId:`new-password`,children:(0,u.jsx)(`input`,{id:`new-password`,type:`password`,className:`miravo-input`,autoComplete:`new-password`,required:!0,minLength:6,value:n,onChange:e=>r(e.target.value)})}),(0,u.jsx)(f,{label:`Confirm password`,forId:`confirm-password`,children:(0,u.jsx)(`input`,{id:`confirm-password`,type:`password`,className:`miravo-input`,autoComplete:`new-password`,required:!0,minLength:6,value:s,onChange:e=>d(e.target.value)})}),(0,u.jsx)(`button`,{type:`submit`,className:`miravo-btn`,disabled:g,style:{marginTop:`0.4rem`},children:g?`Setting password…`:`Set password`}),(0,u.jsx)(`div`,{style:{textAlign:`center`,marginTop:`0.15rem`},children:(0,u.jsx)(`button`,{type:`button`,className:`miravo-btn-ghost`,onClick:()=>{a.removeQueries({queryKey:[`bootstrap`]}),t(`/`,{replace:!0})},children:`Skip for now`})})]})]})}function g(){let e=(0,l.useRef)(null);return(0,l.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,d=[],f=[],p=[];function m(){d=[],f=[],p=[];let e=Math.max(15,Math.floor(s*c/35e3));for(let t=0;t<e;t++)d.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<d.length;e++)for(let t=e+1;t<d.length;t++){let n=d[e],r=d[t];!n||!r||Math.hypot(n.bx-r.bx,n.by-r.by)<160&&Math.random()>.5&&f.push({from:e,to:t})}}function h(){s=r.offsetWidth,c=r.offsetHeight,r.width=s*o,r.height=c*o,i.setTransform(o,0,0,o,0,0),m()}function g(){l+=.016,i.clearRect(0,0,s,c);for(let e of d)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 p)e.add(t.conn.from*256+t.conn.to);i.strokeStyle=a,i.lineWidth=.5;for(let t of f){let n=d[t.from],r=d[t.to];!n||!r||(i.globalAlpha=e.has(t.from*256+t.to)?.04:.012,i.beginPath(),i.moveTo(n.x,n.y),i.lineTo(r.x,r.y),i.stroke())}i.fillStyle=a;for(let e of d)i.globalAlpha=.08*(.6+Math.sin(l*.4+e.phase)*.4),i.beginPath(),i.arc(e.x,e.y,e.r,0,Math.PI*2),i.fill();if(Math.random()<.03&&f.length&&p.length<10){let e=f[Math.floor(Math.random()*f.length)];e&&p.push({conn:e,t:0,speed:.002+Math.random()*.003,alpha:.25+Math.random()*.35,size:1+Math.random()*1})}i.fillStyle=a;for(let e=p.length-1;e>=0;e--){let t=p[e];if(!t)continue;if(t.t+=t.speed,t.t>=1){p.splice(e,1);continue}let n=d[t.conn.from],r=d[t.conn.to];if(!n||!r)continue;let a=n.x+(r.x-n.x)*t.t,o=n.y+(r.y-n.y)*t.t;i.globalAlpha=t.alpha*.35,i.beginPath(),i.arc(a,o,t.size,0,Math.PI*2),i.fill()}i.globalAlpha=1,u=requestAnimationFrame(g)}let _=()=>{document.hidden?cancelAnimationFrame(u):u=requestAnimationFrame(g)},v,y=()=>{window.clearTimeout(v),v=window.setTimeout(h,250)};if(!window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return document.addEventListener(`visibilitychange`,_),window.addEventListener(`resize`,y),h(),g(),()=>{cancelAnimationFrame(u),window.clearTimeout(v),document.removeEventListener(`visibilitychange`,_),window.removeEventListener(`resize`,y)}},[]),(0,u.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,l.useState)(()=>_.map(e=>({...e,displayValue:(e.base+(Math.random()-.5)*e.range).toFixed(e.decimals),flash:!1})));return(0,l.useEffect)(()=>{let e;function n(){document.hidden||(t(e=>e.map(e=>({...e,displayValue:(e.base+(Math.random()-.5)*e.range).toFixed(e.decimals),flash:!0}))),window.clearTimeout(e),e=window.setTimeout(()=>{t(e=>e.map(e=>({...e,flash:!1})))},400))}let r=window.setInterval(n,2200);return()=>{window.clearInterval(r),window.clearTimeout(e)}},[]),(0,u.jsx)(`div`,{style:{position:`absolute`,inset:0,zIndex:3,pointerEvents:`none`},children:e.map(e=>(0,u.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,u.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,u.jsx)(`span`,{style:{color:`var(--tooltip-border)`},children:e.path}),(0,u.jsx)(`span`,{style:{color:e.flash?`var(--warning)`:`var(--primary)`,fontWeight:600,minWidth:`3em`,textAlign:`right`,transition:`color 0.4s`},children:e.displayValue}),(0,u.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,l.useState)(0),[n,r]=(0,l.useState)(0),[i,a]=(0,l.useState)(()=>x.map(e=>e.value?(e.value.base+(Math.random()-.5)*e.value.range).toFixed(e.value.decimals):``)),[o,s]=(0,l.useState)(new Set),[c,d]=(0,l.useState)(null),[f,p]=(0,l.useState)(`+231 tags streaming`),m=(0,l.useRef)(new Set);(0,l.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,u.jsx)(`div`,{style:{position:`absolute`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,zIndex:5,pointerEvents:`none`},children:(0,u.jsxs)(`div`,{style:{border:`1px solid color-mix(in srgb, var(--primary) 10%, transparent)`,borderRadius:4,boxShadow:`none`,overflow:`hidden`,width:540},children:[(0,u.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,u.jsx)(`span`,{style:{width:7,height:7,borderRadius:`50%`,background:`#ff5f57`,opacity:.5}}),(0,u.jsx)(`span`,{style:{width:7,height:7,borderRadius:`50%`,background:`#febc2e`,opacity:.5}}),(0,u.jsx)(`span`,{style:{width:7,height:7,borderRadius:`50%`,background:`#28c840`,opacity:.5}}),(0,u.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,u.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,u.jsxs)(`div`,{children:[(0,u.jsx)(`span`,{style:{color:`var(--muted-foreground)`},children:`$ `}),(0,u.jsx)(`span`,{style:{color:`var(--primary)`},children:h}),(0,u.jsx)(`span`,{style:{color:`var(--foreground)`,opacity:.9},children:g}),e>0&&e<37&&(0,u.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,u.jsxs)(`div`,{style:{opacity:0,animation:`terminal-line 0.4s ease forwards`},children:[(0,u.jsx)(`span`,{style:{color:`var(--primary)`},children:`✓`}),(0,u.jsx)(`span`,{style:{color:`var(--tooltip-foreground)`},children:` Loaded `}),(0,u.jsx)(`span`,{style:{color:`var(--primary)`},children:`smart-factory`}),(0,u.jsx)(`span`,{style:{color:`var(--muted-foreground)`},children:` · 10 assets · 240 tags`})]}),n>=2&&(0,u.jsxs)(`div`,{style:{opacity:0,animation:`terminal-line 0.4s ease 0.05s forwards`},children:[(0,u.jsx)(`span`,{style:{color:`var(--primary)`},children:`✓`}),(0,u.jsx)(`span`,{style:{color:`var(--tooltip-foreground)`},children:` Protocols `}),(0,u.jsx)(`span`,{style:{color:`var(--muted-foreground)`},children:`mqtt :1883 · opcua :4840 · modbus :1502`})]}),n>=3&&(0,u.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,u.jsxs)(`div`,{style:{opacity:0,animation:`tree-line 0.3s ease forwards`},children:[(0,u.jsx)(`span`,{style:{color:`var(--tooltip-border)`},children:e.indent}),r&&e.value?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`span`,{style:{color:`var(--muted-foreground)`},children:e.text.padEnd(S)}),(0,u.jsx)(`span`,{style:{color:c?.indices.has(t)?`var(--destructive)`:o.has(t)?`var(--primary)`:`var(--foreground)`,transition:`color 0.3s`},children:(i[t]??``).padStart(7)}),(0,u.jsx)(`span`,{style:{color:`var(--tooltip-border)`},children:` ${e.value.unit.padEnd(5)}`}),e.protocol&&(0,u.jsx)(`span`,{style:{color:`var(--tooltip-border)`},children:e.protocol})]}):(0,u.jsxs)(u.Fragment,{children:[e.label&&(0,u.jsx)(`span`,{style:{color:`var(--tooltip-border)`},children:`${e.label}: `}),(0,u.jsx)(`span`,{style:{color:`var(--tooltip-foreground)`},children:e.text}),e.label===`cell`&&c?.assetId===e.id&&(0,u.jsxs)(`span`,{style:{marginLeft:`0.8em`,color:`var(--destructive)`,fontSize:`0.9em`},children:[`: `,c.name]})]})]},e.id)}),n>=w&&(0,u.jsx)(`div`,{style:{opacity:0,animation:`terminal-line 0.4s ease forwards`,marginTop:`0.55em`,textAlign:`right`},children:(0,u.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,l.useState)(!1),[n,r]=(0,l.useState)(``);return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`style`,{children:d}),(0,u.jsxs)(`div`,{className:`login-page`,children:[(0,u.jsxs)(`div`,{className:`login-form-panel`,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,u.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,u.jsx)(`div`,{className:`login-header`,style:{padding:`1.25rem 2rem`,borderBottom:`1px solid var(--secondary)`,zIndex:1,display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:(0,u.jsxs)(s,{to:`/`,style:{display:`inline-flex`,alignItems:`center`,gap:`0.5rem`,textDecoration:`none`},children:[(0,u.jsx)(`span`,{style:{display:`flex`,width:32,height:32,flexShrink:0,alignItems:`center`,justifyContent:`center`},children:(0,u.jsx)(`img`,{src:`/miravo-logo.webp`,alt:``,width:28,height:28,loading:`eager`,decoding:`async`,style:{display:`block`,width:`100%`,height:`100%`,objectFit:`contain`,transform:`translateY(1.5px)`}})}),(0,u.jsx)(`span`,{style:{fontFamily:`var(--font-heading)`,fontSize:`1.25rem`,fontWeight:600,color:`var(--foreground)`,letterSpacing:`-0.025em`,lineHeight:1},children:`Miravo`}),(0,u.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.2rem 0.5rem`,borderRadius:4,lineHeight:1,display:`inline-flex`,alignItems:`center`,alignSelf:`center`},children:`Console`})]})}),(0,u.jsx)(`div`,{className:`login-form-area`,style:{flex:1,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`2.5rem 2rem`,zIndex:1},children:(0,u.jsx)(`div`,{style:{width:`100%`,maxWidth:370},children:(0,u.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,u.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,u.jsx)(h,{username:n}):(0,u.jsx)(m,{onChangePassword:e=>{r(e),t(!0)}})]})})}),(0,u.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,u.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,fontSize:`0.6rem`,color:`var(--tooltip-border)`,letterSpacing:`0.04em`},children:`Miravo Console`}),(0,u.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,fontSize:`0.6rem`,color:`var(--tooltip-border)`,letterSpacing:`0.04em`},children:`© 2026`})]})]}),(0,u.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,u.jsx)(`div`,{style:{position:`absolute`,inset:0,zIndex:4,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,u.jsx)(g,{}),(0,u.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,u.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,u.jsx)(v,{}),(0,u.jsx)(A,{})]})]})]})}export{j as LoginPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./models-DhRo1Ytd.js";export{e as ModelsPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{at as n}from"./vendor-ui-CWUk2ulb.js";import{M as r,O as i,S as a,k as o,o as s,v as ee}from"./api-Bf6pFRhP.js";import{i as te,t as c}from"./query-fetch-error-BqiDQT2r.js";import{t as l}from"./proxy-Be4WzmcS.js";import{t as u}from"./AnimatePresence-CPmH1DMY.js";import{a as ne,i as re,l as ie,n as ae,o as d,r as f,s as p}from"./copy-button-DnGsXbVV.js";import{C as m,S as h,_ as g,c as oe,d as _,u as v}from"./format-B9CcV2dj.js";import{n as y,t as b}from"./utils-XFKvwlFT.js";import{t as x}from"./activity-Cy_niK56.js";import{M as S,P as C,j as se,n as w,t as T}from"./use-platform-stream-BVf5gGJM.js";import{l as E}from"./select-CMOnuEoT.js";import{i as D,n as O,r as k,t as A}from"./tabs-CCixnxMe.js";import{r as ce}from"./checkbox-C84IyqEB.js";import{a as le,c as j,d as M,i as ue,l as N,n as P,o as F,r as I,s as L,t as de,u as R}from"./catalog-source-W3TI0pmx.js";import{c as z,n as B,r as fe,s as V,t as pe}from"./use-engine-command-mutation-RvjgD8uv.js";import{t as me}from"./triangle-alert-BXrJNk3g.js";import{t as H}from"./badge-i00PiRCo.js";import{t as he}from"./label-DTHSKF2S.js";import{n as ge}from"./get-error-message-yQcVJ-Ja.js";var U=y(`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`}]]),_e=y(`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`}]]),W=y(`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`}]]),G=y(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),K=y(`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`}]]),q=e(t(),1),J=n(),Y=new Set([`fault_active`,`fault_count`,`active_fault_code`,`lifecycle_stage`,`health_state`,`availability_state`]);function X(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};Y.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,J.jsx)(R,{className:`size-3`}),members:t,accentClass:`text-muted-foreground`}),n.length>0&&a.push({key:`commands`,label:`Commands`,icon:(0,J.jsx)(G,{className:`size-3`}),members:n,accentClass:`text-info`}),r.length>0&&a.push({key:`process`,label:`Process Tags`,icon:(0,J.jsx)(x,{className:`size-3`}),members:r,accentClass:`text-primary`}),i.length>0&&a.push({key:`health`,label:`Health & Status`,icon:(0,J.jsx)(W,{className:`size-3`}),members:i,accentClass:`text-success`}),a}function ve({modelName:e,onClose:t}){let[n,r]=(0,q.useState)(new Set([`nameplate`,`process`])),i=te({queryKey:ee.catalog.modelSchema(e??``),queryFn:()=>s(`/catalog/models/${e}`,a.catalogModelDetail),enabled:e!==null}),o=i.data,u=i.isPending&&!o,ne=i.isError,re=ge(i.error,`Failed to load model.`);(0,q.useEffect)(()=>{e&&r(new Set([`nameplate`,`process`]))},[e]);let ae=(0,q.useMemo)(()=>o?X(o.members):[],[o]),d=(0,q.useCallback)(e=>{r(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),f=T(),p=f.status===`running`,m=o?Object.keys(o.members).length:0,h=o?Object.keys(o.methods).length:0;return(0,J.jsx)(le,{open:e!==null,onOpenChange:e=>{if(!e){if(p){ie.message(`Deploy still running. Cancel it or wait before closing.`);return}f.reset(),t()}},children:(0,J.jsx)(F,{side:`right`,showCloseButton:!p,className:`flex w-full flex-col gap-4 touch-manipulation`,children:u?null:ne&&!o?(0,J.jsx)(`div`,{className:`flex flex-1 flex-col justify-center px-2`,children:(0,J.jsx)(c,{message:re,onRetry:()=>void i.refetch(),isRetrying:i.isFetching})}):o?(0,J.jsxs)(l.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.18},className:`flex min-h-0 flex-1 flex-col gap-4`,children:[(0,J.jsxs)(j,{className:`gap-1 pb-0 pe-12`,children:[(0,J.jsx)(N,{className:`font-heading text-base uppercase tracking-wide`,children:_(o.name)}),o.description&&(0,J.jsx)(L,{className:`text-xs leading-relaxed text-foreground/88`,children:o.description}),(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(H,{variant:`outline`,className:`font-mono text-xs`,children:[m,` members`]}),(0,J.jsxs)(H,{variant:`outline`,className:`font-mono text-xs`,children:[h,` methods`]}),(0,J.jsxs)(H,{variant:`outline`,className:`font-mono text-xs`,children:[o.faults.length,` faults`]}),o.lifecycle&&(0,J.jsxs)(H,{variant:`outline`,className:`font-mono text-xs text-primary`,children:[o.lifecycle.stages.length,`-stage lifecycle`]}),(0,J.jsx)(w,{stream:f})]})]}),(0,J.jsxs)(A,{defaultValue:`overview`,className:`flex min-h-0 flex-1 flex-col gap-1 pt-0`,children:[(0,J.jsxs)(k,{variant:`line`,className:`h-8! shrink-0 gap-0.5 border-b-border/60 px-2 py-0.5`,children:[(0,J.jsx)(D,{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,J.jsx)(D,{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,J.jsx)(O,{value:`overview`,keepMounted:!0,className:`flex min-h-0 flex-1 flex-col`,children:(0,J.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col px-3 pt-0`,children:(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto pr-2`,children:(0,J.jsxs)(`div`,{className:`flex flex-col gap-1.5 pb-1 pt-0.5`,children:[ae.map(e=>(0,J.jsx)(Z,{sectionKey:e.key,label:e.label,count:e.members.length,icon:e.icon,accentClass:e.accentClass,expanded:n.has(e.key),onToggle:d,children:(0,J.jsx)(`div`,{className:`flex flex-col gap-1`,children:e.members.map(e=>(0,J.jsx)(Q,{member:e},e.name))})},e.key)),o.faults.length>0&&(0,J.jsx)(Z,{sectionKey:`faults`,label:`Faults`,count:o.faults.length,icon:(0,J.jsx)(me,{className:`size-3`}),accentClass:`text-warning`,expanded:n.has(`faults`),onToggle:d,children:(0,J.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:o.faults.map(e=>(0,J.jsx)(H,{variant:`secondary`,className:`text-[10px] text-warning`,children:g(e)},e))})}),o.lifecycle&&(0,J.jsx)(Z,{sectionKey:`lifecycle`,label:`Lifecycle`,count:o.lifecycle.stages.length,icon:(0,J.jsx)(_e,{className:`size-3`}),accentClass:`text-primary`,expanded:n.has(`lifecycle`),onToggle:d,children:(0,J.jsx)(be,{lifecycle:o.lifecycle})}),h>0&&(0,J.jsx)(Z,{sectionKey:`methods`,label:`Methods`,count:h,icon:(0,J.jsx)(K,{className:`size-3`}),accentClass:`text-info`,expanded:n.has(`methods`),onToggle:d,children:(0,J.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:Object.entries(o.methods).map(([e,t])=>(0,J.jsx)(xe,{name:e,method:t},e))})})]})})})}),(0,J.jsx)(O,{value:`deploy`,keepMounted:!0,className:`flex min-h-0 flex-1 flex-col`,children:(0,J.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col px-3 pt-0`,children:(0,J.jsx)(ue,{kind:`model`,id:o.name,displayName:_(o.name),yamlPath:`/catalog/models/${o.name}/yaml`,yamlFilename:`${o.name}.twin.yaml`,stream:f})})})]})]},o.name):(0,J.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,J.jsxs)(`div`,{className:`rounded-[var(--miravo-radius-tight)] border border-border/50`,children:[(0,J.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,J.jsx)(`span`,{className:i,children:r}),(0,J.jsx)(`span`,{className:`uppercase tracking-wider`,children:t}),(0,J.jsx)(H,{variant:`secondary`,className:`ml-auto text-[10px]`,children:n}),(0,J.jsx)(E,{className:`size-3 text-muted-foreground transition-transform ${a?`rotate-180`:``}`})]}),(0,J.jsx)(u,{initial:!1,children:a&&(0,J.jsx)(l.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,J.jsx)(`div`,{className:`border-t px-2.5 py-1.5`,children:s})},`content`)})]})}function Q({member:e}){return(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-0.5 py-0.5 text-xs`,children:[(0,J.jsx)(`span`,{title:e.name,className:`min-w-0 truncate font-mono text-foreground`,children:oe(e.name)}),(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:e.dataType}),e.unit&&(0,J.jsx)(H,{variant:`outline`,className:`px-1 py-0 text-[10px]`,children:e.unit}),e.euRange&&(0,J.jsxs)(`span`,{className:`ml-auto font-mono text-xs text-muted-foreground`,children:[`[`,e.euRange[0],`–`,e.euRange[1],`]`]})]})}var ye={healthy:`bg-success`,normal:`bg-success`,degraded:`bg-warning`,critical:`bg-destructive`,failed:`bg-destructive`};function be({lifecycle:e}){let t=e.stages.length;return(0,J.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,J.jsx)(`div`,{className:`flex h-2.5 w-full overflow-hidden rounded-full bg-muted`,children:e.stages.map((e,n)=>(0,J.jsx)(`div`,{className:`transition-[background-color] ${ye[e]??`bg-chart-1`} ${n===0?`rounded-l-full`:``} ${n===t-1?`rounded-r-full`:``}`,style:{width:`${100/t}%`}},`${e}-${n}`))}),(0,J.jsx)(`div`,{className:`flex items-center gap-3`,children:e.stages.map((e,t)=>(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs`,children:[(0,J.jsx)(`span`,{className:`size-2 rounded-full ${ye[e]??`bg-chart-1`}`}),(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:g(e)})]},`${e}-${t}`))}),(0,J.jsxs)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:[`~`,v(e.totalHours),` total hours`]})]})}function xe({name:e,method:t}){return(0,J.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`font-mono text-xs text-foreground`,children:e}),t.inputArguments.length>0&&(0,J.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`(`,t.inputArguments.map(e=>`${e.name}: ${e.dataType}`).join(`, `),`)`]})]}),t.description&&(0,J.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t.description})]})}var Se=[`builtin`,`personal`];function Ce(){let[e,t]=(0,q.useState)(``),[n,ie]=(0,q.useState)(`all`),[g,oe]=(0,q.useState)({}),[v,y]=(0,q.useState)(null),[x,S]=(0,q.useState)(null),[C,w]=(0,q.useState)(``),[T,E]=(0,q.useState)(``),[D,O]=(0,q.useState)(null),[k,A]=(0,q.useState)(null),[le,j]=(0,q.useState)(null),M=(0,q.useRef)(null),ue=pe();(0,q.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(),M.current?.focus())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let N=te({queryKey:ee.catalog.models(),queryFn:()=>s(`/catalog/models`,a.catalogModels)}),P=N.data??[],F=N.isPending&&!N.data,L=N.isError&&!N.data,de=N.isError&&!!N.data,R=ge(N.error,`Failed to load models.`),z=e=>g[e]??1,B=(0,q.useCallback)((e,t)=>{oe(n=>({...n,[e]:Math.max(1,Math.min(10,t))}))},[]),V=(0,q.useCallback)(e=>{j(e)},[]),me=(0,q.useCallback)(e=>{S(e),w(``),E(``),O(null),A(null)},[]),U=async e=>{let t=r(C),n=r(T);if(t||n)return O(t),A(n),!1;let i=z(e),a=C.trim(),o=T.trim();y(e);try{return await ue.mutateAsync({type:`spawn`,model:e,count:i,...a?{instanceName:a}:{},...o?{instancePrefix:o}:{}}),!0}catch{return!1}finally{y(null)}},_e=(0,q.useMemo)(()=>{let e={all:P.length};for(let t of Se)e[t]=0;for(let t of P){let n=I(t.source);e[n]=(e[n]??0)+1}return e},[P]),W=e.toLowerCase(),G=P.filter(e=>n===`all`||I(e.source)===n).filter(e=>W?e.name.toLowerCase().includes(W)||(e.description?.toLowerCase().includes(W)??!1):!0),K=x,Y=K?z(K):1,X=K?o(K):``,Z=T.trim()||X,Q=C.trim()||(Z?i(Z,1):``);return(0,J.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,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,J.jsx)(`h1`,{className:`font-heading text-2xl font-semibold tracking-tight`,children:`Asset Model Library`}),(0,J.jsx)(H,{variant:`outline`,className:`text-xs`,children:L?(0,J.jsx)(`span`,{className:`text-destructive`,children:`Unavailable`}):F&&P.length===0?(0,J.jsx)(J.Fragment,{children:`Loading...`}):(0,J.jsxs)(J.Fragment,{children:[P.length,` models`]})})]}),(0,J.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.`})]}),L&&(0,J.jsx)(c,{message:R,onRetry:()=>void N.refetch(),isRetrying:N.isFetching}),de&&(0,J.jsx)(c,{message:`${R} Showing cached models.`,onRetry:()=>void N.refetch(),isRetrying:N.isFetching}),!L&&(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,J.jsxs)(`div`,{className:`relative max-w-xs flex-1 min-w-[14rem]`,children:[(0,J.jsx)(se,{className:`absolute left-2.5 top-2.5 size-4 text-muted-foreground`}),(0,J.jsx)(h,{ref:M,placeholder:`Filter models...`,value:e,onChange:e=>t(e.target.value),className:`pl-9 pr-7`}),!e&&(0,J.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,J.jsx)(Te,{value:n,counts:_e,onChange:ie})]}),(0,J.jsx)(`div`,{className:`grid grid-cols-1 gap-4 @[720px]/models:grid-cols-2 @[1120px]/models:grid-cols-3`,"aria-busy":F&&!L,children:L?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(u,{children:G.map((e,t)=>(0,J.jsx)(l.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,J.jsx)(we,{model:e,count:z(e.name),spawning:v===e.name,onCountChange:B,onInspect:V,onSpawn:me})},e.name))}),G.length===0&&P.length>0&&(0,J.jsx)(`p`,{className:`col-span-full py-8 text-center text-sm text-muted-foreground`,children:`No models match the current filters.`})]})}),P.length>0&&(0,J.jsx)(`div`,{className:b(fe,`p-0`),children:(0,J.jsx)(`div`,{className:`community-teaser relative overflow-hidden rounded-[inherit]`,children:(0,J.jsx)(`div`,{className:`relative z-10 mx-auto max-w-3xl px-5 py-10 sm:px-10 sm:py-12`,children:(0,J.jsxs)(`div`,{className:`grid items-center gap-10 lg:grid-cols-[minmax(0,1fr)_minmax(0,17rem)]`,children:[(0,J.jsxs)(`div`,{className:`order-2 flex min-w-0 flex-col gap-4 lg:order-1`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-3 gap-y-1`,children:[(0,J.jsx)(`p`,{className:`blueprint-title text-primary`,children:`Future channel`}),(0,J.jsx)(`span`,{className:`blueprint-stat text-[10px] text-muted-foreground`,children:`MIRAVO_REGISTRY · NOT_CONNECTED`})]}),(0,J.jsx)(`h2`,{className:`font-heading text-xl font-semibold tracking-tight sm:text-2xl`,children:`Community Models`}),(0,J.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,J.jsx)(`div`,{children:(0,J.jsx)(H,{variant:`outline`,className:`community-teaser-soon border-primary/35 bg-primary/5 text-[10px] text-primary`,children:`Coming Soon`})})]}),(0,J.jsx)(`div`,{className:`order-1 flex justify-center lg:order-2 lg:justify-end`,children:(0,J.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,J.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,J.jsx)(ce,{className:`size-9 text-primary`,"aria-hidden":!0})}),(0,J.jsx)(`span`,{className:`blueprint-stat relative z-[1] text-[9px] tracking-[0.18em] text-muted-foreground`,children:`AWAITING SIGNAL`}),(0,J.jsx)(`span`,{className:`blueprint-stat relative z-[1] text-[9px] text-muted-foreground`,children:`Uplink idle`})]})})]})})})}),(0,J.jsx)(ae,{open:x!==null,onOpenChange:e=>{e||S(null)},children:(0,J.jsxs)(f,{className:`min-w-0 sm:max-w-md`,children:[(0,J.jsxs)(d,{children:[(0,J.jsx)(p,{children:`Spawn instances?`}),(0,J.jsx)(re,{children:x!==null&&(0,J.jsxs)(J.Fragment,{children:[`This spawns `,z(x),` instance`,z(x)===1?``:`s`,` of`,` `,(0,J.jsx)(`span`,{className:`font-medium text-foreground`,children:_(x)}),` `,`into the running environment. Set exact ID or generated prefix below if you need custom naming.`]})})]}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,J.jsx)(he,{htmlFor:`spawn-instance-name`,className:`text-xs font-medium text-foreground`,children:`Exact instance ID`}),(0,J.jsx)(h,{id:`spawn-instance-name`,value:C,maxLength:120,onChange:e=>{let t=e.target.value;w(t),t&&(E(``),A(null)),O(r(t))},placeholder:Y===1?Q||`pump-001`:`Count must be 1`,disabled:Y!==1,className:b(`min-w-0 font-mono text-xs`,D&&`border-destructive`),"aria-invalid":D!=null,"aria-describedby":`spawn-instance-name-hint`}),(0,J.jsx)(`p`,{id:`spawn-instance-name-hint`,className:`min-w-0 wrap-break-word text-[11px] text-muted-foreground`,children:`Use exact name for one instance only.`}),D?(0,J.jsx)(`p`,{className:`text-[11px] text-destructive`,children:D}):null]}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,J.jsx)(he,{htmlFor:`spawn-instance-prefix`,className:`text-xs font-medium text-foreground`,children:`Generated prefix`}),(0,J.jsx)(h,{id:`spawn-instance-prefix`,value:T,maxLength:120,onChange:e=>{let t=e.target.value;E(t),t&&(w(``),O(null)),A(r(t))},placeholder:X||`pump`,className:b(`min-w-0 font-mono text-xs`,k&&`border-destructive`),"aria-invalid":k!=null,"aria-describedby":`spawn-instance-prefix-hint`}),(0,J.jsxs)(`p`,{id:`spawn-instance-prefix-hint`,className:`min-w-0 wrap-break-word text-[11px] text-muted-foreground`,children:[`Preview`,` `,(0,J.jsx)(`span`,{className:`break-all font-mono text-foreground`,children:Q||`${X}-001`})]}),k?(0,J.jsx)(`p`,{className:`text-[11px] text-destructive`,children:k}):null]})]}),(0,J.jsxs)(ne,{children:[(0,J.jsx)(m,{variant:`outline`,disabled:v!==null,onClick:()=>S(null),children:`Cancel`}),(0,J.jsx)(m,{disabled:v!==null||x===null||D!=null||k!=null,onClick:async()=>{x!==null&&await U(x)&&S(null)},children:v===x?`Spawning...`:`Spawn`})]})]})}),(0,J.jsx)(ve,{modelName:le,onClose:()=>j(null)})]})}var we=(0,q.memo)(function({model:e,count:t,spawning:n,onCountChange:r,onInspect:i,onSpawn:a}){return(0,J.jsxs)(`div`,{className:b(V,`flex flex-col gap-4 p-5`),children:[(0,J.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,J.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,J.jsx)(U,{className:`size-4`})}),(0,J.jsxs)(`div`,{className:`min-w-0 flex flex-col gap-0.5`,children:[(0,J.jsx)(`span`,{className:`font-heading text-sm font-semibold uppercase tracking-wide`,children:_(e.name)}),e.description&&(0,J.jsx)(`span`,{className:`line-clamp-2 text-xs leading-relaxed text-muted-foreground`,children:e.description})]})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 font-mono text-[11px] text-muted-foreground`,children:[(0,J.jsx)($,{label:`mbr`,value:e.memberCount}),(0,J.jsx)($,{label:`mth`,value:e.methodCount}),(0,J.jsx)($,{label:`flt`,value:e.faultCount}),e.hasLifecycle&&(0,J.jsxs)(`span`,{className:`flex items-center gap-1 text-primary`,children:[(0,J.jsx)(`span`,{className:`text-[10px]`,children:`◈`}),(0,J.jsxs)(`span`,{children:[e.lifecycleStageCount,`-stage`]})]}),(0,J.jsx)(H,{variant:`outline`,className:b(`ml-auto shrink-0 font-sans text-[10px] font-medium uppercase tracking-wide`,de(e.source)),children:P(e.source)})]}),(0,J.jsxs)(`div`,{className:`mt-auto flex items-center gap-2 border-t border-border/30 pt-3`,children:[(0,J.jsxs)(`div`,{className:`flex items-center rounded-[var(--miravo-radius-tight)] border bg-muted/30`,children:[(0,J.jsx)(m,{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,J.jsx)(M,{className:`size-3`})}),(0,J.jsx)(`span`,{className:`flex size-7 items-center justify-center border-x font-mono text-xs`,children:t}),(0,J.jsx)(m,{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,J.jsx)(S,{className:`size-3`})})]}),(0,J.jsxs)(m,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>i(e.name),className:B,children:[(0,J.jsx)(C,{className:`size-3.5`,"aria-hidden":!0}),`Inspect`]}),(0,J.jsxs)(m,{size:`sm`,className:`ml-auto`,disabled:n,onClick:()=>a(e.name),children:[(0,J.jsx)(z,{className:`mr-1 size-3`}),n?`...`:`Spawn`]})]})]})});function $({label:e,value:t}){return(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`span`,{className:`text-foreground`,children:t}),` `,(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:e})]})}function Te({value:e,counts:t,onChange:n}){return(0,J.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,role:`radiogroup`,"aria-label":`Filter by source`,children:[{id:`all`,label:`All`},...Se.map(e=>({id:e,label:P(e)}))].map(r=>{let i=e===r.id,a=t[r.id]??0,o=r.id!==`all`&&a===0;return(0,J.jsxs)(`label`,{className:b(`inline-flex h-7 items-center gap-1.5 rounded-[var(--miravo-radius-pill)] border px-3 text-xs font-medium transition-colors`,i?`border-primary/60 bg-primary/15 text-primary`:`border-border/60 bg-card/30 text-muted-foreground hover:border-border hover:bg-muted/40 hover:text-foreground`,o?`cursor-not-allowed opacity-40 hover:border-border/60 hover:bg-card/30 hover:text-muted-foreground`:`cursor-pointer`),children:[(0,J.jsx)(`input`,{type:`radio`,name:`models-source-filter`,value:r.id,checked:i,disabled:o,onChange:()=>n(r.id),className:`sr-only`}),(0,J.jsx)(`span`,{children:r.label}),(0,J.jsx)(`span`,{className:`font-mono text-[10px] text-foreground`,children:a})]},r.id)})})}export{U as n,Ce as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{at as e}from"./vendor-ui-CWUk2ulb.js";import{n as t,s as n}from"./chunk-OE4NN4TA-DBWZidbW.js";import{n as r}from"./utils-XFKvwlFT.js";import{t as i}from"./triangle-alert-BXrJNk3g.js";import{n as a}from"./auth-screen-backdrop-
|
|
1
|
+
import{at as e}from"./vendor-ui-CWUk2ulb.js";import{n as t,s as n}from"./chunk-OE4NN4TA-DBWZidbW.js";import{n as r}from"./utils-XFKvwlFT.js";import{t as i}from"./triangle-alert-BXrJNk3g.js";import{n as a}from"./auth-screen-backdrop-CgwRhIbi.js";var o=r(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),s=r(`house`,[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`r6nss1`}]]),c=e();function l(){let e=n();return(0,c.jsx)(a,{className:`min-h-full px-6 py-8 md:px-8`,children:(0,c.jsx)(`div`,{className:`mx-auto flex min-h-[calc(100svh-9rem)] max-w-3xl items-center justify-center`,children:(0,c.jsx)(`section`,{className:`relative w-full overflow-hidden rounded-[var(--miravo-radius-stadium-lg)] border border-primary/20 bg-transparent p-8 md:p-10`,children:(0,c.jsxs)(`div`,{className:`relative space-y-8`,children:[(0,c.jsxs)(`div`,{className:`space-y-4`,children:[(0,c.jsx)(`p`,{className:`font-mono text-xs uppercase tracking-[0.4em] text-muted-foreground`,children:`Fault code 404`}),(0,c.jsxs)(`div`,{className:`flex items-end gap-4`,children:[(0,c.jsx)(`span`,{className:`font-heading text-7xl font-black leading-none tracking-[-0.08em] text-transparent [-webkit-text-stroke:1px_color-mix(in_srgb,var(--primary)_55%,transparent)] md:text-9xl`,children:`404`}),(0,c.jsx)(`div`,{className:`mb-2 h-px flex-1 bg-linear-to-r from-primary/60 to-transparent`})]}),(0,c.jsxs)(`div`,{className:`max-w-2xl space-y-3`,children:[(0,c.jsx)(`h1`,{className:`text-4xl font-semibold tracking-[-0.04em] text-foreground md:text-5xl`,children:`Route not found in the control surface`}),(0,c.jsx)(`p`,{className:`max-w-xl text-base text-muted-foreground md:text-lg`,children:`This address does not map to an active console view.`})]})]}),(0,c.jsxs)(`div`,{className:`rounded-[var(--miravo-radius-stadium-sm)] border border-border/80 bg-background/55 p-5 backdrop-blur-sm`,children:[(0,c.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 font-mono text-[0.7rem] uppercase tracking-[0.28em] text-muted-foreground`,children:[(0,c.jsx)(i,{className:`size-3.5 text-primary`}),`Requested path`]}),(0,c.jsx)(`code`,{className:`block overflow-x-auto rounded-[var(--miravo-radius-stadium-sm)] border border-primary/15 bg-background/30 px-4 py-3 font-mono text-sm text-primary`,children:e.pathname})]}),(0,c.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,c.jsxs)(t,{to:`/`,className:`inline-flex items-center gap-2 rounded-[var(--miravo-radius-pill)] border border-foreground/15 bg-foreground px-4 py-2.5 font-medium text-background transition hover:bg-foreground/90`,children:[(0,c.jsx)(s,{className:`size-4`}),`Return to Fleet`]}),(0,c.jsxs)(t,{to:`/catalog`,className:`group inline-flex items-center gap-3 rounded-[var(--miravo-radius-pill)] border border-foreground/8 bg-background/20 px-3 py-2.5 text-foreground shadow-[inset_0_1px_0_color-mix(in_srgb,var(--foreground)_4%,transparent)] backdrop-blur-sm transition hover:border-primary/30 hover:bg-primary/8 hover:text-primary`,children:[(0,c.jsx)(`span`,{className:`inline-flex size-8 items-center justify-center rounded-[var(--miravo-radius-tight)] border border-foreground/8 bg-foreground/4 text-muted-foreground transition group-hover:border-primary/25 group-hover:bg-primary/12 group-hover:text-primary`,children:(0,c.jsx)(o,{className:`size-4`})}),(0,c.jsx)(`span`,{className:`font-medium tracking-[-0.01em]`,children:`Open Catalog`})]})]})]})})})})}export{l as NotFoundPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{at as n}from"./vendor-ui-CWUk2ulb.js";import{S as r,at as i,o as a,ot as o,st as s,v as c,y as l}from"./api-Bf6pFRhP.js";import{a as u,c as d,i as f,r as p,t as m}from"./query-fetch-error-BqiDQT2r.js";import{t as h}from"./proxy-Be4WzmcS.js";import{t as g}from"./AnimatePresence-CPmH1DMY.js";import{i as _,r as v}from"./dist-xY0pK9Wy.js";import{n as y}from"./chunk-OE4NN4TA-DBWZidbW.js";import{a as b,i as x,l as S,n as C,o as w,r as ee,s as T,t as E}from"./copy-button-DnGsXbVV.js";import{C as D,S as O,T as k,d as A,h as j,o as M,w as N}from"./format-B9CcV2dj.js";import{n as P,t as F}from"./utils-XFKvwlFT.js";import{t as I}from"./activity-Cy_niK56.js";import{t as L}from"./arrow-right-BjBb4z7g.js";import{A as R,D as z,E as B,M as V,N as te,S as ne,_ as re,a as ie,b as ae,c as H,d as U,f as oe,g as se,h as ce,i as le,j as ue,k as de,l as fe,m as W,n as pe,o as me,p as he,r as ge,s as _e,t as ve,u as ye,v as be,x as xe}from"./use-platform-stream-BVf5gGJM.js";import{n as Se,t as Ce}from"./catalog-template-icons-3S8RvUxD.js";import{c as we,i as G,l as Te,n as Ee,s as De,t as Oe}from"./select-CMOnuEoT.js";import{a as ke,i as Ae,r as K}from"./platform-targets-BIQ1lKOg.js";import{c as je,i as Me,n as Ne,o as Pe,r as Fe,s as Ie,t as Le}from"./tabs-CCixnxMe.js";import{i as Re,n as q,r as ze,t as Be}from"./checkbox-C84IyqEB.js";import{t as Ve}from"./layers-1figUpjG.js";import{t as He}from"./triangle-alert-BXrJNk3g.js";import{i as Ue,n as We,t as Ge}from"./tooltip-D1ydB4g3.js";import{t as Ke}from"./badge-i00PiRCo.js";import{a as qe,i as Je,n as Ye,o as Xe,r as Ze,s as Qe,t as $e}from"./dropdown-menu-82O7jPU6.js";import{t as et}from"./label-DTHSKF2S.js";import{n as J,t as tt}from"./get-error-message-yQcVJ-Ja.js";var nt=class extends d{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:s()})}getOptimisticResult(e){return e.behavior=s(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:a,isRefetching:s,isError:c,isRefetchError:l}=r,u=n.fetchMeta?.fetchMore?.direction,d=c&&u===`forward`,f=a&&u===`forward`,p=c&&u===`backward`,m=a&&u===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:i(t,n.data),hasPreviousPage:o(t,n.data),isFetchNextPageError:d,isFetchingNextPage:f,isFetchPreviousPageError:p,isFetchingPreviousPage:m,isRefetchError:l&&!d&&!p,isRefetching:s&&!f&&!m}}};function rt(e,t){return u(e,nt,t)}var it=P(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]),at=P(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),ot=P(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),st=P(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),Y=e(t(),1),X=n(),ct=`rounded-(--miravo-radius-stadium-sm) border border-dashed border-border/55 bg-muted/10`;function lt(){return(0,X.jsx)(`p`,{className:`mt-2 text-pretty text-sm leading-relaxed text-muted-foreground`,children:`Add a target to get started.`})}function ut({onClick:e}){return(0,X.jsxs)(D,{type:`button`,size:`sm`,className:`h-7 shrink-0 gap-1.5 text-xs`,onClick:e,children:[(0,X.jsx)(V,{className:`size-3.5`,"aria-hidden":!0}),`Add Target`]})}function dt({titleId:e,frameIcon:t,description:n,children:r}){return(0,X.jsx)(`section`,{"aria-labelledby":e,className:ct,children:(0,X.jsxs)(`div`,{className:`flex flex-col items-center gap-4 px-4 py-10 text-center`,children:[(0,X.jsx)(`div`,{className:`flex size-12 items-center justify-center rounded-(--miravo-radius-stadium-sm) border border-dashed border-border/50`,children:t}),(0,X.jsxs)(`div`,{className:`max-w-sm`,children:[(0,X.jsx)(`h2`,{id:e,className:`font-heading text-sm font-semibold tracking-tight text-foreground`,children:`No targets yet`}),n]}),r]})})}function ft({stream:e,onReset:t,catalogTemplates:n}){if(!e.operation&&e.status!==`running`)return null;let{title:r,subtitle:i}=_e(e),a=e.status===`complete`,o=e.status===`error`,s=e.status===`running`,c=a||o,l=e.cancelRequested;async function u(){await e.cancel().catch(()=>{})}return(0,X.jsx)(re,{title:r,subtitle:i,canDismiss:!s,footerAction:s&&e.operation?.operationId?(0,X.jsx)(`div`,{className:`ml-auto shrink-0`,children:(0,X.jsx)(`button`,{type:`button`,onClick:u,disabled:l,"aria-busy":l,className:F(N({variant:`outline`,size:`sm`}),`group h-8 gap-1.5 px-3 text-xs`,l?`cursor-not-allowed`:`hover:bg-destructive/12 hover:text-destructive hover:border-destructive/35`),children:l?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Pe,{className:`size-3.5 shrink-0 animate-spin text-muted-foreground`,"aria-hidden":!0}),(0,X.jsx)(h.span,{animate:{opacity:[1,.72,1]},transition:{duration:1.25,repeat:1/0,ease:`easeInOut`},className:`font-medium text-foreground`,children:`Cancelling…`})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(k,{className:`size-3.5 shrink-0 text-foreground/65 group-hover:text-destructive`,"aria-hidden":!0}),(0,X.jsx)(h.span,{animate:{opacity:[1,.88,1]},transition:{duration:2.2,repeat:1/0,ease:`easeInOut`},children:`Cancel`})]})})}):c?(0,X.jsxs)(`div`,{className:`flex w-full flex-col gap-1.5`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 w-full flex-1 flex-wrap items-center justify-between gap-x-3 gap-y-1`,children:[(0,X.jsxs)(y,{to:`/platforms?tab=activity`,className:F(N({variant:`ghost`,size:`xs`}),`group inline-flex h-6 shrink-0 items-center gap-1.5 px-2 text-[11px] font-medium text-foreground/80`,`hover:bg-primary/12 hover:text-primary`),children:[(0,X.jsx)(I,{className:`size-3 shrink-0 text-foreground/70 group-hover:text-primary`,"aria-hidden":!0}),`View full activity`,(0,X.jsx)(ke,{className:`size-2.5 shrink-0 text-foreground/50 group-hover:text-primary`,"aria-hidden":!0})]}),(0,X.jsx)(`div`,{className:`flex shrink-0 items-center`,children:(0,X.jsx)(D,{type:`button`,variant:`secondary`,size:`xs`,className:`h-6 px-2.5 text-[11px] font-medium`,onClick:t,children:`Close`})})]}),e.operation?.status===`cancelled`||o&&e.operation?(0,X.jsx)(xe,{type:e.operation.type,errorMessage:e.operation.error,className:`mt-2.5 w-full min-w-0`}):null]}):void 0,onDismiss:t,children:e.operation?(0,X.jsx)(ae,{operation:e.operation,catalogTemplates:n,logs:e.logs}):(0,X.jsxs)(`div`,{className:`flex flex-col gap-2 py-1`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(Pe,{className:`size-3.5 animate-spin text-primary`,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`text-xs text-foreground/78`,children:`Connecting to Litmus Edge…`})]}),(0,X.jsx)(`div`,{className:`h-1 w-full overflow-hidden rounded-full bg-muted/55`,children:(0,X.jsx)(h.div,{className:`h-full w-2/5 rounded-full bg-primary`,animate:{x:[`-100%`,`250%`]},transition:{duration:1.2,repeat:1/0,ease:`easeInOut`}})})]})})}var pt=`miravo:platforms:recent-template-ids`,mt=8,ht=`miravo:platforms:last-target-id`;function Z(){if(typeof window>`u`)return[];try{let e=window.localStorage.getItem(pt),t=e?JSON.parse(e):[];return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}function gt(e){if(typeof window>`u`)return;let t=[e,...Z().filter(t=>t!==e)].slice(0,mt);try{window.localStorage.setItem(pt,JSON.stringify(t))}catch{}}function _t(){if(!(typeof window>`u`))try{return window.localStorage.getItem(ht)??void 0}catch{return}}function vt(e){if(!(typeof window>`u`))try{window.localStorage.setItem(ht,e)}catch{}}var yt=50;function bt({open:e,type:t,targetLabel:n,targetHostname:r,templates:i,templatesLoading:a,templatesError:o,onRetryTemplates:s,onOpenChange:c,onSelect:l}){let[u,d]=(0,Y.useState)(``),[f,p]=(0,Y.useState)(Z),m=(0,Y.useDeferredValue)(u);(0,Y.useEffect)(()=>{e&&(d(``),p(Z()))},[e]);let h=(0,Y.useMemo)(()=>{let e=m.trim().toLowerCase(),t=new Map(f.map((e,t)=>[e,t])),n=[],r=new Set;for(let t of i){if(r.has(t.id))continue;r.add(t.id);let i=[t.name,t.id,t.category,t.description??``,t.models.join(` `)].join(` `).toLowerCase();e!==``&&!i.includes(e)||n.push(t)}return n.sort((e,n)=>{let r=t.get(e.id)??1/0,i=t.get(n.id)??1/0;return r===i?e.name.localeCompare(n.name):r-i}),{items:n.slice(0,yt),total:n.length,recentRank:t}},[i,m,f]),g=t===`apply`?`Apply environment`:`Cleanup environment`,_=e=>{gt(e.id),l(e)};return(0,X.jsx)(C,{open:e,onOpenChange:c,children:(0,X.jsxs)(ee,{className:`flex max-h-[82vh] min-h-0 flex-col gap-0 overflow-hidden p-0 sm:max-w-xl`,children:[(0,X.jsxs)(`div`,{className:`shrink-0 border-b border-border/60 px-5 pb-3 pt-5`,children:[(0,X.jsx)(T,{className:`text-sm font-semibold`,children:g}),(0,X.jsxs)(x,{className:`mt-1 text-xs`,children:[n,` / `,r]})]}),(0,X.jsx)(`div`,{className:`shrink-0 border-b border-border/45 px-5 py-3`,children:(0,X.jsxs)(`div`,{className:`relative`,children:[(0,X.jsx)(ue,{className:`pointer-events-none absolute left-2.5 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground`,"aria-hidden":!0}),(0,X.jsx)(O,{value:u,onChange:e=>d(e.currentTarget.value),className:`h-9 pl-8`,placeholder:`Search environments`,autoFocus:!0})]})}),(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-3 py-3`,children:a&&i.length===0?(0,X.jsx)(`div`,{className:`rounded-[var(--miravo-radius-tight)] border border-border/50 px-3 py-2 text-xs text-muted-foreground`,children:`Loading environments...`}):o&&i.length===0?(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-[var(--miravo-radius-tight)] border border-warning/25 bg-warning/5 px-3 py-2 text-xs text-warning`,children:[(0,X.jsx)(`span`,{children:`Could not load environments.`}),(0,X.jsx)(D,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 text-warning hover:text-warning`,onClick:s,children:`Retry`})]}):h.items.length===0?(0,X.jsx)(`div`,{className:`rounded-[var(--miravo-radius-tight)] border border-border/50 px-3 py-2 text-xs text-muted-foreground`,children:`No matching environments.`}):(0,X.jsx)(`div`,{className:`flex flex-col gap-1`,children:h.items.map(e=>{let t=h.recentRank.has(e.id);return(0,X.jsxs)(`button`,{type:`button`,className:`flex min-h-12 w-full min-w-0 items-center gap-2 rounded-[var(--miravo-radius-tight)] px-2 py-2 text-left text-xs transition-colors hover:bg-muted/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/70`,onClick:()=>_(e),children:[(0,X.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-[var(--miravo-radius-tight)] border border-border/35 bg-muted/25 text-primary`,children:(0,X.jsx)(Ce,{id:e.id,className:`size-3.5`})}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`truncate font-medium text-foreground`,children:e.name}),t?(0,X.jsx)(`span`,{className:`shrink-0 rounded-[var(--miravo-radius-tight)] border border-primary/25 bg-primary/8 px-1.5 py-px font-mono text-[9px] uppercase tracking-wider text-primary`,children:`Recent`}):null]}),(0,X.jsxs)(`span`,{className:`mt-0.5 block truncate font-mono text-[11px] text-muted-foreground`,children:[e.id,` / `,e.instanceCount,` instances`]})]})]},e.id)})})}),h.total>h.items.length?(0,X.jsxs)(`div`,{className:`shrink-0 border-t border-border/45 px-5 py-2 text-[11px] text-muted-foreground`,children:[`Showing `,h.items.length,` of `,h.total,`. Refine search.`]}):null]})})}function xt({targets:e,stream:t}){let[n,i]=(0,Y.useState)(`apply`),[o,s]=(0,Y.useState)(``),[l,u]=(0,Y.useState)(``),[d,p]=(0,Y.useState)(!1),[g,_]=(0,Y.useState)(null),[v,y]=(0,Y.useState)(!1),[b,x]=(0,Y.useState)(!1),[C,w]=(0,Y.useState)(!1),[ee]=(0,Y.useState)(_t),T=(0,Y.useRef)(0),E=(0,Y.useRef)(null),O=t.status===`running`,A=n===`apply`,j=f({queryKey:c.catalog.templates(),queryFn:()=>a(`/catalog/templates`,r.catalogTemplates)}),M=j.data??[],N=M.find(e=>e.id===l),P=e.find(e=>e.id===o),I=A?!!o&&!!l:!!o&&(d||!!l),L=(0,Y.useCallback)(()=>{T.current+=1,E.current?.abort(),E.current=null,y(!1),_(null)},[]);(0,Y.useEffect)(()=>{if(!(l||M.length===0||d))for(let e of Z()){let t=M.find(t=>t.id===e);if(t){u(t.id);return}}},[l,M,d]);let V=(0,Y.useCallback)(()=>{L(),S.message(`Preview cancelled`)},[L]),te=e=>{O||(i(e),L(),p(!1))},re=(0,Y.useCallback)(async(e,n)=>{if(e===`apply`){if(!o||!l)return}else if(!o||!d&&!l)return;t.operation&&t.status!==`running`&&t.reset(),E.current?.abort(),T.current+=1;let r=T.current,i=new AbortController;E.current=i,y(!0),_(null);try{let t=e===`apply`?await he(B({targetId:o,template:l,result:n}),{signal:i.signal}):await oe(z({targetId:o,template:l,allManaged:d,result:n}),{signal:i.signal});if(r!==T.current)return;_(t.plan)}catch(t){if(r!==T.current||ie(t))return;let n=J(t,e===`apply`?`Plan failed`:`Cleanup plan failed`),i=tt(t);S.error(n,i?{description:i}:void 0)}finally{r===T.current&&y(!1)}},[o,l,d,t]),ae=(0,Y.useCallback)(e=>{x(!1),L(),vt(o),l&>(l),n===`apply`?t.startApply(B({targetId:o,template:l,result:e})):t.startCleanup(z({targetId:o,template:l,allManaged:d,result:e}))},[n,o,l,d,t,L]),H=!A&&d,U=I&&!O,se=A?ze:R,ue=`Awaiting selection`;U&&(ue=A?`Review apply`:`Review cleanup`);let fe=H?`All managed resources`:N?.name??`Select environment`,W=(0,X.jsx)(Ve,{className:`size-3.5`,"aria-hidden":!0});H?W=(0,X.jsx)(R,{className:`size-3.5`,"aria-hidden":!0}):N&&(W=(0,X.jsx)(Ce,{id:N.id,className:`size-3.5`}));let me=A?`Provisions devices, tags, and Digital Twin models from the selected environment on the selected target.`:`Removes Miravo-managed resources for this environment from the selected target.`;H&&(me=`Removes all Miravo-managed resources from the target (ignores environment scope).`);let _e=P?`${P.label} / ${fe}`:`Select target and environment`;return(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,X.jsxs)(`div`,{role:`toolbar`,"aria-label":`Operation mode`,className:`inline-flex items-center gap-0.5 rounded-[var(--miravo-radius-pill)] border border-border/50 bg-muted/15 p-0.5`,children:[(0,X.jsxs)(`button`,{type:`button`,"aria-pressed":A,className:F(`relative flex items-center gap-1.5 rounded-[var(--miravo-radius-pill)] px-4 py-1.5 text-xs font-medium transition-colors`,A?`text-primary`:`text-muted-foreground hover:text-foreground`),onClick:()=>te(`apply`),disabled:O,children:[A&&(0,X.jsx)(h.span,{layoutId:`mode-pill`,className:`absolute inset-0 rounded-[var(--miravo-radius-pill)] bg-primary/15 shadow-sm`,transition:{type:`spring`,stiffness:500,damping:40}}),(0,X.jsx)(st,{className:`relative z-10 size-3.5`}),(0,X.jsx)(`span`,{className:`relative z-10`,children:`Apply`})]}),(0,X.jsxs)(`button`,{type:`button`,"aria-pressed":!A,className:F(`relative flex items-center gap-1.5 rounded-[var(--miravo-radius-pill)] px-4 py-1.5 text-xs font-medium transition-colors`,A?`text-muted-foreground hover:text-foreground`:`text-destructive`),onClick:()=>te(`cleanup`),disabled:O,children:[!A&&(0,X.jsx)(h.span,{layoutId:`mode-pill`,className:`absolute inset-0 rounded-[var(--miravo-radius-pill)] bg-destructive/15 shadow-sm`,transition:{type:`spring`,stiffness:500,damping:40}}),(0,X.jsx)(R,{className:`relative z-10 size-3.5`}),(0,X.jsx)(`span`,{className:`relative z-10`,children:`Cleanup`})]})]}),(0,X.jsx)(pe,{stream:t})]}),(0,X.jsx)(be,{children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-3.5`,children:[(0,X.jsxs)(`div`,{className:`flex items-start gap-3 border-b border-border/25 pb-3`,children:[(0,X.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-[var(--miravo-radius-stadium-sm)] border border-primary/25 bg-primary/9 shadow-[inset_0_1px_0_0_var(--miravo-inset-highlight)]`,children:(0,X.jsx)(Ve,{className:`size-4 text-primary`,"aria-hidden":!0})}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`p`,{className:`font-heading text-[11px] font-semibold uppercase tracking-[0.12em] text-foreground`,children:`Litmus Edge`}),(0,X.jsx)(`p`,{className:`mt-0.5 text-[11px] leading-relaxed text-muted-foreground`,children:me})]})]}),(0,X.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsx)(et,{className:`font-heading text-[11px] font-medium uppercase tracking-[0.14em] text-muted-foreground`,children:`Target`}),(0,X.jsx)(ce,{targets:e,value:o,onValueChange:e=>{s(e),vt(e),L()},preferredTargetId:ee,disabled:O,size:`sm`,className:`min-w-0 w-full text-xs`})]}),(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsx)(et,{className:`font-heading text-[11px] font-medium uppercase tracking-[0.14em] text-muted-foreground`,children:`Environment`}),j.isError&&!j.data&&(0,X.jsx)(m,{message:J(j.error,`Failed to load environments.`),onRetry:()=>void j.refetch(),isRetrying:j.isFetching&&!j.isPending}),(0,X.jsxs)(`button`,{type:`button`,disabled:H||O||!P,onClick:()=>w(!0),className:F(`flex h-9 min-h-9 w-full min-w-0 items-center justify-between gap-1.5 rounded-[var(--miravo-radius-stadium-sm)] border border-input bg-input/30 px-2.5 py-0 text-left text-xs outline-none transition-colors select-none`,`hover:bg-input/50 focus-visible:border-primary/35 focus-visible:ring-2 focus-visible:ring-primary/22`,`disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50`),"aria-label":`Environment`,children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`flex size-7 shrink-0 items-center justify-center rounded-[var(--miravo-radius-stadium-sm)] border border-border/35 bg-muted/25 text-primary`,children:W}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium text-foreground`,children:fe})]}),(0,X.jsx)(Te,{className:`pointer-events-none size-4 shrink-0 text-muted-foreground`,"aria-hidden":!0})]})]})]}),(0,X.jsxs)(`button`,{type:`button`,disabled:!U||v,onClick:()=>x(!0),className:F(`group flex w-full min-h-14 min-w-0 items-stretch overflow-hidden rounded-[var(--miravo-radius-stadium-lg)] text-left outline-none`,`transition-[border-color,box-shadow,background-color] duration-200 ease-out`,`focus-visible:ring-2 focus-visible:ring-ring/70 focus-visible:ring-offset-2 focus-visible:ring-offset-background`,`disabled:pointer-events-none disabled:opacity-55`,U?[`border-2 border-primary/40 bg-background`,`bg-linear-to-r from-primary/12 via-background to-background`,`shadow-[inset_0_1px_0_0_rgba(255,255,255,0.025)]`,`hover:border-primary/56 hover:shadow-[inset_0_1px_0_0_rgba(255,255,255,0.025),0_0_14px_-8px_color-mix(in_srgb,var(--primary)_18%,transparent),0_0_22px_-12px_color-mix(in_srgb,var(--primary)_8%,transparent)]`]:[`border border-dashed border-border/65 bg-muted/15`,`hover:bg-muted/22`]),children:[(0,X.jsx)(`span`,{className:`relative flex w-18 shrink-0 items-center justify-center bg-transparent`,"aria-hidden":!0,children:(0,X.jsx)(se,{className:F(`relative size-5`,U?`text-primary`:`text-muted-foreground`)})}),(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col justify-center gap-0.5 overflow-hidden px-3 py-2.5 sm:px-4`,children:[(0,X.jsx)(`span`,{className:F(`font-heading text-[11px] font-semibold uppercase tracking-[0.18em]`,U?`text-primary`:`text-muted-foreground`),children:ue}),(0,X.jsx)(`span`,{className:F(`truncate font-mono text-[13px] leading-tight tracking-tight`,U?`text-foreground`:`text-muted-foreground`),children:_e})]}),(0,X.jsx)(`span`,{className:F(`flex shrink-0 items-center pr-2.5 sm:pr-3`,U&&`pl-1`),children:(0,X.jsx)(`span`,{className:F(`flex size-9 items-center justify-center rounded-[var(--miravo-radius-stadium-sm)] border bg-transparent transition-[border-color,color] duration-200`,U?`border-primary/40 text-primary group-hover:border-primary/55`:`border-border/45 text-muted-foreground`),"aria-hidden":!0,children:(0,X.jsx)(ke,{className:`size-4`,strokeWidth:2.25})})})]}),!A&&(0,X.jsx)(`div`,{className:`flex w-full min-w-0 flex-wrap items-center justify-end gap-2`,children:(0,X.jsxs)(et,{id:`all-managed-label`,htmlFor:`all-managed`,"aria-disabled":O,className:F(`inline-flex h-8 w-fit max-w-full cursor-pointer items-center gap-2 text-xs font-medium leading-none`,O&&`pointer-events-none opacity-40`),children:[(0,X.jsx)(Be,{id:`all-managed`,checked:d,onCheckedChange:e=>{p(e===!0),L()},disabled:O}),(0,X.jsx)(`span`,{className:`shrink-0`,children:`Remove all Miravo managed resources`})]})})]})}),(v||g)&&!O&&(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[v&&(0,X.jsx)(`div`,{className:`flex w-full min-w-0 flex-wrap items-center justify-end gap-2`,children:(0,X.jsxs)(D,{type:`button`,variant:`ghost`,size:`sm`,className:`h-8 shrink-0 gap-1.5 px-2 text-xs text-muted-foreground hover:text-foreground`,onClick:V,children:[(0,X.jsx)(k,{className:`size-3.5`,"aria-hidden":!0}),`Cancel preview`]})}),v&&(0,X.jsx)(le,{}),g&&!v&&(0,X.jsx)(ge,{plan:g,planKind:A?`apply`:`cleanup`,onCloseTable:L})]}),P&&C?(0,X.jsx)(bt,{open:!0,type:n,targetLabel:P.label,targetHostname:P.hostname,templates:M,templatesLoading:j.isPending&&j.data===void 0,templatesError:j.isError&&M.length===0,onRetryTemplates:()=>void j.refetch(),onOpenChange:w,onSelect:e=>{u(e.id),gt(e.id),p(!1),L(),A&&t.reset(),w(!1)}}):null,P&&(0,X.jsx)(ne,{open:b,onOpenChange:x,type:n,label:H?`All managed resources`:N?.name??l,targetLabel:P.label,hostname:P.hostname,sourceHostname:P.sourceHostname,onConfirm:ae,defaultNamePrefix:A?l:void 0,metadata:de,applyPreview:A?{onPreview:e=>void re(`apply`,e),planLoading:v,disabled:!o||!l||O}:void 0,cleanupPreview:A?void 0:{onPreview:e=>void re(`cleanup`,e),planLoading:v,disabled:!o||!d&&!l||O}})]})}function St(){return(0,X.jsx)(`section`,{"aria-labelledby":`platforms-operation-log-empty-title`,className:ct,children:(0,X.jsxs)(`div`,{className:`flex flex-col items-center gap-4 px-4 py-8 text-center sm:py-10`,children:[(0,X.jsx)(`div`,{className:`flex size-12 items-center justify-center rounded-(--miravo-radius-stadium-sm) border border-dashed border-border/50`,children:(0,X.jsx)(I,{className:`size-6 text-muted-foreground/45`,"aria-hidden":!0})}),(0,X.jsxs)(`div`,{className:`max-w-sm`,children:[(0,X.jsx)(`h2`,{id:`platforms-operation-log-empty-title`,className:`font-heading text-sm font-semibold tracking-tight text-foreground`,children:`No operations yet`}),(0,X.jsx)(`p`,{className:`mt-2 text-pretty text-sm leading-relaxed text-muted-foreground`,children:`Run apply or cleanup from the Operations tab. Finished runs show up here with full detail.`})]})]})})}function Ct(e){let t=new Date(e),n=new Date,r=new Date(n);return r.setDate(n.getDate()-1),t.toDateString()===n.toDateString()?`Today`:t.toDateString()===r.toDateString()?`Yesterday`:t.toLocaleDateString(`en-US`,{weekday:`short`,month:`short`,day:`numeric`})}function wt(e){let t=new Map;for(let n of e){let e=new Date(n.completedAt).toDateString(),r=t.get(e);r?r.push(n):t.set(e,[n])}return Array.from(t.entries()).map(([,e])=>({label:Ct(e[0]?.completedAt??Date.now()),ops:e}))}function Tt(e,t){return e===`device`?t.operationType===`apply`?`Tag/register writes per device step—not a device count.`:`One count per device removed from DeviceHub.`:e===`model`?`One count per model in this run.`:e===`instance`?`One count per twin instance in this run.`:`Sets the device parameter to the bound DeviceHub device.`}var Et={devices:`Devices`,models:`DT models`,instances:`DT instances`},Q={create:`inline-flex items-center rounded-[var(--miravo-radius-tight)] border border-success/35 bg-success/12 px-1.5 py-0.5 font-mono text-[10px] tabular-nums text-success`,update:`inline-flex items-center rounded-[var(--miravo-radius-tight)] border border-primary/35 bg-primary/12 px-1.5 py-0.5 font-mono text-[10px] tabular-nums text-primary`,replace:`inline-flex items-center rounded-[var(--miravo-radius-tight)] border border-chart-2/35 bg-chart-2/12 px-1.5 py-0.5 font-mono text-[10px] tabular-nums text-chart-2`,delete:`inline-flex items-center rounded-[var(--miravo-radius-tight)] border border-destructive/35 bg-destructive/12 px-1.5 py-0.5 font-mono text-[10px] tabular-nums text-destructive`,noop:`inline-flex items-center rounded-[var(--miravo-radius-tight)] border border-border/55 bg-muted/55 px-1.5 py-0.5 font-mono text-[10px] tabular-nums text-foreground/78`,failed:`inline-flex items-center rounded-[var(--miravo-radius-tight)] border border-destructive/40 bg-destructive/18 px-1.5 py-0.5 font-mono text-[10px] font-semibold tabular-nums text-destructive`};function Dt(e){return[{key:`device`,title:`DeviceHub — protocol tags`,subtitle:Tt(`device`,e),counts:e.resourceCounts.device},{key:`model`,title:`Digital Twin models`,subtitle:Tt(`model`,e),counts:e.resourceCounts.model},{key:`instance`,title:`Twin instances`,subtitle:Tt(`instance`,e),counts:e.resourceCounts.instance},{key:`param-sync`,title:`Parameter sync`,subtitle:Tt(`param-sync`,e),counts:e.resourceCounts[`param-sync`]}].filter(e=>e.counts.total>0||e.counts.failed>0)}function Ot(e){return e.length===0?`Default (devices, models, instances)`:e.map(e=>Et[e]??e).join(` · `)}function kt(e){let t=[];return e.filters.area&&t.push(`Area ${e.filters.area}`),e.filters.line&&t.push(`Line ${e.filters.line}`),e.filters.instance&&t.push(`Instance ${e.filters.instance}`),t.length>0?t.join(` · `):null}function $(e,t,n){if(e===`device`)switch(t){case`create`:return`+${n} tags (new device)`;case`update`:return`${n} tags rewritten`;case`replace`:return`↻${n} tags (device replaced)`;case`delete`:return`−${n} removed`;case`noop`:return`=${n} unchanged`}switch(t){case`create`:return`+${n} created`;case`update`:return`${n} updated`;case`replace`:return`↻${n} replaced`;case`delete`:return`−${n} removed`;case`noop`:return`=${n} unchanged`}}function At({row:e}){let{key:t,counts:n}=e;return(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-1.5`,children:[n.create>0&&(0,X.jsx)(`span`,{className:Q.create,children:$(t,`create`,n.create)}),n.update>0&&(0,X.jsx)(`span`,{className:Q.update,children:$(t,`update`,n.update)}),n.replace>0&&(0,X.jsx)(`span`,{className:Q.replace,children:$(t,`replace`,n.replace)}),n.delete>0&&(0,X.jsx)(`span`,{className:Q.delete,children:$(t,`delete`,n.delete)}),n.noop>0&&(0,X.jsx)(`span`,{className:Q.noop,children:$(t,`noop`,n.noop)}),n.failed>0&&(0,X.jsx)(`span`,{className:Q.failed,children:`${n.failed} failed`})]})}function jt(e){return e.resourceCounts.device.noop+e.resourceCounts.model.noop+e.resourceCounts.instance.noop+e.resourceCounts[`param-sync`].noop}function Mt({op:e}){let t=kt(e),n=jt(e);return(0,X.jsxs)(`div`,{className:`rounded-[var(--miravo-radius-tight)] border border-border/50 bg-muted/25 px-3 py-2.5`,children:[(0,X.jsx)(`p`,{className:`font-mono text-[10px] uppercase tracking-[0.16em] text-foreground/72`,children:`Run context`}),(0,X.jsxs)(`dl`,{className:`mt-2 grid grid-cols-[minmax(0,7.5rem)_1fr] gap-x-3 gap-y-1.5 text-xs sm:grid-cols-[9rem_1fr]`,children:[(0,X.jsx)(`dt`,{className:`text-foreground/70`,children:`Operation`}),(0,X.jsx)(`dd`,{className:`font-medium capitalize text-foreground`,children:e.operationType}),(0,X.jsx)(`dt`,{className:`text-foreground/70`,children:`Target host`}),(0,X.jsx)(`dd`,{className:`break-all font-mono text-[11px] text-foreground`,children:e.hostname}),(0,X.jsx)(`dt`,{className:`text-foreground/70`,children:`Scope`}),(0,X.jsx)(`dd`,{className:`text-foreground`,children:Ot(e.scope)}),t&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`dt`,{className:`text-foreground/70`,children:`Filters`}),(0,X.jsx)(`dd`,{className:`text-foreground`,children:t})]}),(0,X.jsx)(`dt`,{className:`text-foreground/70`,children:`Duration`}),(0,X.jsxs)(`dd`,{className:`tabular-nums text-foreground`,children:[(e.durationMs/1e3).toFixed(1),`s`]}),(0,X.jsx)(`dt`,{className:`text-foreground/70`,children:`Outcome`}),(0,X.jsxs)(`dd`,{className:`text-foreground`,children:[(0,X.jsx)(`span`,{className:`tabular-nums`,children:e.successCount}),` steps succeeded`,n>0&&(0,X.jsxs)(`span`,{className:`text-foreground/72`,children:[` `,`· `,(0,X.jsx)(`span`,{className:`tabular-nums`,children:n}),` unchanged`]}),e.failedCount>0&&(0,X.jsxs)(`span`,{className:`text-destructive`,children:[` `,`· `,(0,X.jsx)(`span`,{className:`tabular-nums`,children:e.failedCount}),` failed`]}),e.blockedCount>0&&(0,X.jsxs)(`span`,{className:`text-warning`,children:[` `,`· `,(0,X.jsx)(`span`,{className:`tabular-nums`,children:e.blockedCount}),` blocked in plan`]})]})]})]})}function Nt({status:e}){switch(e){case`success`:return(0,X.jsx)(je,{className:`mt-px size-4 shrink-0 text-success`});case`failed`:return(0,X.jsx)(Ie,{className:`mt-px size-4 shrink-0 text-destructive`});case`partial`:case`blocked`:return(0,X.jsx)(He,{className:`mt-px size-4 shrink-0 text-warning`});case`noop`:return(0,X.jsx)(it,{className:`mt-px size-4 shrink-0 text-foreground/55`})}}function Pt(e){let t=e.operationType===`apply`?`Applied`:`Cleaned up`,n=`${(e.durationMs/1e3).toFixed(1)}s`,r=[];e.successCount>0&&r.push(`${e.successCount} resources`);let i=jt(e);return i>0&&r.push(`${i} unchanged`),e.failedCount>0&&r.push(`${e.failedCount} failed`),e.blockedCount>0&&r.push(`${e.blockedCount} blocked`),r.length===0?`${t} · no changes · ${n}`:`${t} · ${r.join(`, `)} · ${n}`}function Ft(e){return e.operationType===`cleanup`&&e.successCount===0&&e.failedCount===0&&e.blockedCount===0?`No Miravo-managed resources were found to clean up.`:e.failedCount>0&&e.blockedCount>0?`No per-phase counts — failures and blocked plan entries.`:e.failedCount>0?`No per-phase counts — run failed.`:e.blockedCount>0?`No per-phase counts — blocked plan entries.`:jt(e)>0?`No resources were mutated. Existing managed resources already matched the desired state.`:`No per-phase counts recorded.`}function It({op:e}){let t=Dt(e);return t.length===0?(0,X.jsx)(`p`,{className:`py-1 text-sm text-foreground/75`,children:Ft(e)}):(0,X.jsxs)(`div`,{className:`space-y-3 pt-1`,children:[(0,X.jsx)(`div`,{className:`flex flex-col divide-y divide-border/45 rounded-[var(--miravo-radius-tight)] border border-border/50`,children:t.map(e=>(0,X.jsxs)(`div`,{className:`flex flex-col gap-2 px-3 py-2.5 sm:flex-row sm:items-start sm:gap-4`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 shrink-0 sm:w-[11.5rem]`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,X.jsx)(`span`,{className:`text-xs font-medium leading-snug text-foreground`,children:e.title}),(0,X.jsxs)(Ge,{children:[(0,X.jsx)(Ue,{type:`button`,className:`inline-flex shrink-0 items-center justify-center rounded-[var(--miravo-radius-tight)] p-0.5 text-foreground/60 hover:bg-muted/50 hover:text-foreground`,"aria-label":`About ${e.title}`,children:(0,X.jsx)(Re,{className:`size-3.5`,"aria-hidden":!0})}),(0,X.jsx)(We,{side:`top`,className:`max-w-xs text-left`,children:e.subtitle})]})]}),(0,X.jsx)(`p`,{className:`mt-0.5 text-[11px] leading-snug text-foreground/72 sm:hidden`,children:e.subtitle})]}),(0,X.jsx)(At,{row:e})]},e.key))}),e.blockedCount>0&&(0,X.jsxs)(`p`,{className:`rounded-[var(--miravo-radius-tight)] border border-warning/20 bg-warning/5 px-2.5 py-1.5 text-[11px] text-warning`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:e.blockedCount}),` plan entries were blocked (skipped). Open a `,(0,X.jsx)(`span`,{className:`font-medium`,children:`deploy preview`}),` before running to see block reasons.`]})]})}function Lt({operation:e}){let[t,n]=(0,Y.useState)(!1);return(0,X.jsxs)(`div`,{className:F(`overflow-hidden rounded-[var(--miravo-radius-stadium-sm)] border border-border/55`,`transition-colors duration-150`),children:[(0,X.jsxs)(`button`,{type:`button`,"aria-expanded":t,onClick:()=>n(e=>!e),className:F(`flex w-full items-start gap-3 p-3.5 text-left`,`transition-colors duration-100`,`hover:bg-muted/25`,t&&`bg-muted/18`),children:[(0,X.jsx)(Nt,{status:e.status}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,X.jsxs)(`p`,{className:`min-w-0 truncate text-sm`,children:[(0,X.jsx)(`span`,{className:`font-medium text-foreground`,children:A(e.templateId)}),(0,X.jsx)(`span`,{className:`mx-1.5 text-foreground/50`,children:`→`}),(0,X.jsx)(`span`,{className:`text-foreground/82`,children:e.targetLabel})]}),(0,X.jsx)(`time`,{dateTime:new Date(e.completedAt).toISOString(),title:M(e.completedAt),className:`shrink-0 text-xs text-foreground/75`,children:j(e.completedAt)})]}),(0,X.jsx)(`p`,{className:`text-xs text-foreground/78`,children:Pt(e)}),(e.failedCount>0||e.status===`failed`)&&(0,X.jsx)(`p`,{className:`text-[11px] leading-snug text-foreground/72`,children:e.error??`The operation ended with an error.`})]}),(0,X.jsx)(Te,{className:F(`mt-0.5 size-3.5 shrink-0 text-foreground/55 transition-transform duration-150`,t&&`rotate-180`)})]}),(0,X.jsx)(g,{initial:!1,children:t&&(0,X.jsx)(h.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:`auto`},exit:{opacity:0,height:0},transition:{duration:.2,ease:`easeOut`},className:`overflow-hidden`,children:(0,X.jsxs)(`div`,{className:`space-y-3 border-t border-border/45 px-4 pb-3 pt-3`,children:[(0,X.jsx)(Mt,{op:e}),e.error&&(0,X.jsxs)(`div`,{className:`relative rounded-[var(--miravo-radius-tight)] border border-destructive/40 bg-destructive/15 px-3 py-2 pr-10 text-xs font-medium`,children:[(0,X.jsx)(`div`,{className:`absolute top-1.5 right-1.5 z-10`,children:(0,X.jsx)(E,{value:e.error,label:`Copy error`,className:`text-destructive hover:bg-destructive/25 hover:text-foreground`})}),(0,X.jsx)(`p`,{className:`whitespace-normal break-words text-destructive [overflow-wrap:anywhere]`,children:e.error})]}),(0,X.jsx)(It,{op:e})]})})})]})}function Rt({label:e}){return(0,X.jsxs)(`div`,{className:`flex items-center gap-3 py-1`,children:[(0,X.jsx)(`div`,{className:`h-px flex-1 bg-border/65`}),(0,X.jsx)(`span`,{className:`text-xs font-medium text-foreground/78`,children:e}),(0,X.jsx)(`div`,{className:`h-px flex-1 bg-border/65`})]})}var zt={type:``,status:``,target:``,search:``},Bt={_all:`All types`,apply:`Apply`,cleanup:`Cleanup`},Vt={_all:`All statuses`,success:`Success`,partial:`Partial`,failed:`Failed`,blocked:`Blocked`,noop:`No-op`},Ht=`h-7 min-h-7 gap-1.5 border-border/50 bg-transparent px-2 text-xs hover:bg-muted/30 focus:ring-0`;function Ut({filters:e,targetOptions:t,hasFilters:n,searchRef:r,onTypeChange:i,onStatusChange:a,onTargetChange:o,onSearchChange:s,onClear:c}){return(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 border-b border-border/50 px-3 py-2`,children:[(0,X.jsxs)(Oe,{value:e.type||`_all`,onValueChange:e=>e&&i(e===`_all`?``:e),children:[(0,X.jsx)(De,{size:`sm`,className:Ht,"aria-label":`Operation type`,children:(0,X.jsx)(we,{children:e=>Bt[e??`_all`]??Bt._all})}),(0,X.jsxs)(Ee,{children:[(0,X.jsx)(G,{value:`_all`,children:`All types`}),(0,X.jsx)(G,{value:`apply`,children:`Apply`}),(0,X.jsx)(G,{value:`cleanup`,children:`Cleanup`})]})]}),(0,X.jsxs)(Oe,{value:e.status||`_all`,onValueChange:e=>e&&a(e===`_all`?``:e),children:[(0,X.jsx)(De,{size:`sm`,className:Ht,"aria-label":`Operation status`,children:(0,X.jsx)(we,{children:e=>Vt[e??`_all`]??Vt._all})}),(0,X.jsxs)(Ee,{children:[(0,X.jsx)(G,{value:`_all`,children:`All statuses`}),(0,X.jsx)(G,{value:`success`,children:`Success`}),(0,X.jsx)(G,{value:`partial`,children:`Partial`}),(0,X.jsx)(G,{value:`failed`,children:`Failed`}),(0,X.jsx)(G,{value:`blocked`,children:`Blocked`}),(0,X.jsx)(G,{value:`noop`,children:`No-op`})]})]}),t.length>1&&(0,X.jsxs)(Oe,{value:e.target||`_all`,onValueChange:e=>e&&o(e===`_all`?``:e),children:[(0,X.jsx)(De,{size:`sm`,className:Ht,"aria-label":`Target filter`,children:(0,X.jsx)(we,{children:e=>!e||e===`_all`?`All targets`:e})}),(0,X.jsxs)(Ee,{children:[(0,X.jsx)(G,{value:`_all`,children:`All targets`}),t.map(e=>(0,X.jsx)(G,{value:e,children:e},e))]})]}),(0,X.jsxs)(`div`,{className:`relative flex min-w-[140px] flex-1 items-center`,children:[(0,X.jsx)(`input`,{ref:r,type:`search`,value:e.search,onChange:e=>s(e.target.value),placeholder:`Search environment or target…`,"aria-describedby":`ops-search-shortcut`,className:F(`h-7 w-full rounded-[var(--miravo-radius-tight)] border border-border/50 bg-transparent pl-2 pr-7 text-xs`,`placeholder:text-foreground/60 focus:outline-none focus:ring-1 focus:ring-ring/40`,e.search&&`pr-2`)}),(0,X.jsx)(`span`,{id:`ops-search-shortcut`,className:`sr-only`,children:`Press slash to focus search`}),!e.search&&(0,X.jsx)(`kbd`,{"aria-hidden":!0,className:`pointer-events-none absolute right-2 flex h-4 items-center rounded-[var(--miravo-radius-tight)] border border-border/60 bg-muted/50 px-1 font-mono text-[10px] text-foreground/65`,children:`/`})]}),n&&(0,X.jsxs)(`button`,{type:`button`,onClick:c,className:`flex h-7 items-center gap-1 rounded-[var(--miravo-radius-tight)] px-2 text-xs text-foreground/72 transition-colors hover:bg-muted/40 hover:text-foreground`,children:[(0,X.jsx)(k,{className:`size-3`}),`Clear`]})]})}function Wt({operations:e,totalKnown:t,isLoading:n,error:r,onRefresh:i,hasNextPage:a=!1,isFetchingNextPage:o=!1,loadMoreError:s=null,onRetryLoadMore:c,onLoadMore:l}){let[u,d]=(0,Y.useState)(!1),[f,m]=(0,Y.useState)(zt),_=(0,Y.useRef)(null);(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(),_.current?.focus())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let v=()=>{d(!0),i(),S.success(`Operations refreshed`),setTimeout(()=>d(!1),600)},y=(0,Y.useMemo)(()=>{let t=new Set;for(let n of e){let e=n.targetLabel;t.add(e)}return[...t].sort()},[e]),b=(0,Y.useMemo)(()=>{let t=e;if(f.type&&(t=t.filter(e=>e.operationType===f.type)),f.status&&(t=t.filter(e=>e.status===f.status)),f.target&&(t=t.filter(e=>e.targetLabel===f.target)),f.search){let e=f.search.toLowerCase();t=t.filter(t=>{let n=t.targetLabel;return t.templateId.toLowerCase().includes(e)||A(t.templateId).toLowerCase().includes(e)||n.toLowerCase().includes(e)})}return t},[e,f]),x=f.type!==``||f.status!==``||f.target!==``||f.search!==``,C=(0,Y.useMemo)(()=>wt(b),[b]);return(0,X.jsxs)(`div`,{className:`flex h-full flex-col rounded-[var(--miravo-radius-stadium-sm)] border border-border/55`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border/50 px-3.5 py-2.5`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:`Operation log`}),e.length>0&&(0,X.jsx)(`span`,{className:`font-mono text-xs tabular-nums text-foreground/75`,children:typeof t==`number`&&t>0&&e.length<t?`${e.length} / ${t}`:String(e.length)})]}),(0,X.jsx)(`button`,{type:`button`,onClick:v,disabled:u,"aria-label":`Refresh operation list`,className:`relative rounded-[var(--miravo-radius-tight)] p-1 text-foreground/70 transition-colors before:absolute before:inset-[-10px] before:content-[''] hover:bg-muted/50 hover:text-foreground disabled:pointer-events-none`,children:(0,X.jsx)(p,{className:F(`size-3.5`,u&&`animate-spin`),"aria-hidden":!0})})]}),(0,X.jsx)(Ut,{filters:f,targetOptions:y,hasFilters:x,searchRef:_,onTypeChange:e=>m(t=>({...t,type:e})),onStatusChange:e=>m(t=>({...t,status:e})),onTargetChange:e=>m(t=>({...t,target:e})),onSearchChange:e=>m(t=>({...t,search:e})),onClear:()=>m(zt)}),(0,X.jsxs)(`div`,{className:`flex flex-1 min-h-0 flex-col gap-2 overflow-y-auto overscroll-y-contain p-3`,children:[r&&(0,X.jsxs)(`p`,{className:`py-2 text-xs text-destructive`,children:[`✕ `,r.message]}),n&&e.length===0&&!r&&(0,X.jsx)(`p`,{className:`py-4 text-sm text-foreground/75`,children:`Loading…`}),!n&&e.length===0&&!r&&(0,X.jsx)(St,{}),!n&&e.length>0&&b.length===0&&(0,X.jsxs)(`p`,{className:`py-6 text-center text-sm text-foreground/75`,children:[`No operations match your filters.`,` `,(0,X.jsx)(`button`,{type:`button`,onClick:()=>m(zt),className:`text-primary hover:underline`,children:`Clear filters`})]}),x&&b.length>0&&b.length!==e.length&&(0,X.jsxs)(`p`,{className:`text-xs text-foreground/75`,children:[`Showing`,` `,(0,X.jsx)(`span`,{className:`font-medium tabular-nums text-foreground`,children:b.length}),` of`,` `,(0,X.jsx)(`span`,{className:`tabular-nums`,children:e.length}),` loaded`]}),!x&&typeof t==`number`&&t>0&&e.length<t&&(0,X.jsxs)(`p`,{className:`text-xs text-foreground/75`,children:[`Showing`,` `,(0,X.jsx)(`span`,{className:`font-medium tabular-nums text-foreground`,children:e.length}),` `,`of `,(0,X.jsx)(`span`,{className:`tabular-nums`,children:t}),`. Load more for older entries.`]}),(0,X.jsx)(g,{initial:!1,children:C.map(e=>(0,X.jsxs)(h.div,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(Rt,{label:e.label}),(0,X.jsx)(g,{initial:!1,children:e.ops.map(e=>(0,X.jsx)(h.div,{initial:b.length>40?!1:{opacity:0,x:-6},animate:{opacity:1,x:0},transition:{type:`spring`,stiffness:400,damping:35},children:(0,X.jsx)(Lt,{operation:e})},`${e.operationId}-${e.completedAt}`))})]},e.label))}),s?(0,X.jsxs)(`div`,{role:`alert`,className:`flex shrink-0 flex-col items-center gap-2 border-t border-border/50 pt-3 pb-1 text-center`,children:[(0,X.jsxs)(`p`,{className:`text-xs text-destructive`,children:[`Could not load older entries: `,s.message]}),c?(0,X.jsx)(D,{type:`button`,variant:`outline`,size:`sm`,onClick:c,children:`Retry`}):null]}):a&&l?(0,X.jsx)(`div`,{className:`flex shrink-0 justify-center border-t border-border/50 pt-3 pb-1`,children:(0,X.jsx)(D,{type:`button`,variant:`outline`,size:`sm`,className:`min-w-[7rem]`,disabled:o,"aria-busy":o,"aria-label":o?`Loading older operations`:`Load older operations`,onClick:l,children:o?`Loading…`:`Load more`})}):null]})]})}function Gt({target:e,templates:t,templatesLoading:n,templatesError:r,isStreaming:i,onRetryTemplates:a,onSelect:o}){let s=t.length===0&&!n&&!r,[c,l]=(0,Y.useState)(null);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`absolute right-3 top-3 z-20`,children:(0,X.jsxs)($e,{children:[(0,X.jsx)(Qe,{render:(0,X.jsx)(D,{type:`button`,variant:`ghost`,size:`icon-sm`,disabled:i,className:`border border-border/45 bg-background/70 text-muted-foreground shadow-[inset_0_1px_0_0_var(--miravo-inset-highlight)] hover:border-primary/30 hover:bg-muted/55 hover:text-foreground`,"aria-label":`Open quick actions for ${e.label}`}),children:(0,X.jsx)(at,{className:`size-3.5`,"aria-hidden":!0})}),(0,X.jsx)(Ye,{align:`end`,sideOffset:6,className:`min-w-56`,children:(0,X.jsxs)(Ze,{children:[(0,X.jsx)(qe,{className:`text-[10px] uppercase tracking-[0.14em]`,children:`Quick actions`}),(0,X.jsx)(Xe,{className:`bg-border/60`}),(0,X.jsxs)(Je,{disabled:s,className:`h-9 gap-2 text-xs`,onClick:()=>l(`apply`),children:[(0,X.jsx)(ze,{className:`size-3.5 shrink-0 text-primary`,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:`Apply environment...`})]}),(0,X.jsxs)(Je,{disabled:s,className:`h-9 gap-2 text-xs`,onClick:()=>l(`cleanup`),children:[(0,X.jsx)(R,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:`Cleanup environment...`})]}),(0,X.jsx)(Xe,{className:`bg-border/60`}),(0,X.jsxs)(Je,{variant:`destructive`,className:`h-9 gap-2 text-xs`,onClick:()=>o({type:`cleanup`,target:e,allManaged:!0}),children:[(0,X.jsx)(R,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:`Cleanup all managed`})]})]})})]})}),c?(0,X.jsx)(bt,{open:!0,type:c,targetLabel:e.label,targetHostname:e.hostname,templates:t,templatesLoading:n,templatesError:r,onRetryTemplates:a,onOpenChange:e=>{e||l(null)},onSelect:t=>{o({type:c,target:e,templateId:t.id}),l(null)}},c):null]})}function Kt({selection:e,templates:t,stream:n,onSelectionChange:r}){let[i,a]=(0,Y.useState)(!1),[o,s]=(0,Y.useState)(null),[c,l]=(0,Y.useState)(!1),u=(0,Y.useRef)(0),d=(0,Y.useRef)(null),f=(0,Y.useRef)(!1),p=n.status===`running`,m=(0,Y.useCallback)(()=>{u.current+=1,f.current=!1,d.current?.abort(),d.current=null,l(!1),s(null)},[]);(0,Y.useEffect)(()=>{e&&(m(),a(!0))},[e,m]),(0,Y.useEffect)(()=>()=>{u.current+=1,f.current=!1,d.current?.abort(),d.current=null},[]);let h=e?.templateId==null?void 0:t.find(t=>t.id===e.templateId)?.name??e.templateId,g=e?.type===`cleanup`&&e.allManaged?`All managed resources`:h??``,_=(0,Y.useCallback)(async t=>{if(!e)return;let r=e.templateId;if(e.type===`apply`&&!r||e.type===`cleanup`&&!e.allManaged&&!r)return;n.operation&&n.status!==`running`&&n.reset(),f.current=!0,d.current?.abort(),u.current+=1;let i=u.current,a=new AbortController;d.current=a,l(!0),s(null);try{let n;if(e.type===`apply`){if(!r)return;n=await he(B({targetId:e.target.id,template:r,result:t}),{signal:a.signal})}else n=await oe(z({targetId:e.target.id,template:r,allManaged:e.allManaged,result:t}),{signal:a.signal});if(i!==u.current)return;s(n.plan)}catch(t){if(i!==u.current||ie(t))return;let n=J(t,e.type===`apply`?`Plan failed`:`Cleanup plan failed`),r=tt(t);S.error(n,r?{description:r}:void 0)}finally{i===u.current&&(l(!1),f.current=!1)}},[e,n]),v=(0,Y.useCallback)(t=>{if(e){if(a(!1),m(),r(null),e.type===`apply`){if(!e.templateId)return;n.startApply(B({targetId:e.target.id,template:e.templateId,result:t}));return}n.startCleanup(z({targetId:e.target.id,template:e.templateId,allManaged:e.allManaged,result:t}))}},[e,n,m,r]),y=e=>{a(e),!(e||f.current)&&(m(),r(null))},b=()=>{m(),r(null)};return(0,X.jsxs)(X.Fragment,{children:[e&&(0,X.jsx)(ne,{open:i,onOpenChange:y,type:e.type,label:g,targetLabel:e.target.label,hostname:e.target.hostname,sourceHostname:e.target.sourceHostname,onConfirm:v,defaultNamePrefix:e.type===`apply`?e.templateId:void 0,metadata:de,applyPreview:e.type===`apply`?{onPreview:e=>void _(e),planLoading:c,disabled:!e.templateId||p}:void 0,cleanupPreview:e.type===`cleanup`?{onPreview:e=>void _(e),planLoading:c,disabled:!e.allManaged&&!e.templateId||p}:void 0}),(c||o)&&!p&&e?(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex w-full min-w-0 flex-wrap items-center justify-between gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-[11px] text-muted-foreground`,children:[(0,X.jsx)(te,{className:`size-3.5 shrink-0 text-primary`,"aria-hidden":!0}),(0,X.jsxs)(`span`,{className:`truncate`,children:[`Preview for `,e.target.label,`: `,g]})]}),(0,X.jsxs)(D,{type:`button`,variant:`ghost`,size:`sm`,className:`h-8 shrink-0 gap-1.5 px-2 text-xs text-muted-foreground hover:text-foreground`,onClick:b,children:[(0,X.jsx)(k,{className:`size-3.5`,"aria-hidden":!0}),`Close preview`]})]}),c?(0,X.jsx)(le,{}):o?(0,X.jsx)(ge,{plan:o,planKind:e.type,onCloseTable:b}):null]}):null]})}function qt(e){return Ae.find(t=>t.id===e)?.label??e}function Jt(e){if(!e)return`var(--tooltip-border)`;switch(e.status){case`success`:return`var(--success)`;case`partial`:case`blocked`:return`var(--warning)`;case`noop`:return`var(--muted-foreground)`;case`failed`:return`var(--destructive)`}}function Yt({status:e}){switch(e){case`success`:return(0,X.jsx)(je,{className:`size-3 text-success`});case`partial`:case`blocked`:return(0,X.jsx)(He,{className:`size-3 text-warning`});case`noop`:return(0,X.jsx)(it,{className:`size-3 text-muted-foreground`});case`failed`:return(0,X.jsx)(Ie,{className:`size-3 text-destructive`})}}function Xt({target:e,lastOp:t,onEdit:n,onDelete:r,quickActions:i}){return(0,X.jsxs)(`div`,{className:`env-orbital relative overflow-hidden border`,style:{"--_status":Jt(t)},children:[i,(0,X.jsx)(`div`,{className:`relative z-10 px-4 pt-3.5 pb-3 pr-12`,children:(0,X.jsx)(`p`,{className:`font-heading text-[13px] font-semibold leading-tight tracking-tight text-foreground`,children:e.label})}),(0,X.jsx)(`div`,{className:`relative z-10 px-4 py-0.5`,children:(0,X.jsx)(`p`,{className:`font-mono text-xs tracking-tight text-muted-foreground`,children:e.hostname})}),(0,X.jsxs)(`div`,{className:`relative z-10 mx-4 mb-3 flex items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`min-w-0 truncate font-mono text-[11px] text-muted-foreground`,children:e.sourceHostname}),(0,X.jsx)(`div`,{className:`env-orbital-path min-w-6 flex-1`}),(0,X.jsx)(L,{className:`size-3 shrink-0 text-muted-foreground`})]}),(0,X.jsxs)(`div`,{className:`relative z-10 flex items-center gap-2 border-t border-border/30 px-3 py-1.5`,children:[(0,X.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5 rounded-full border border-border/40 px-2 py-0.5`,children:[(0,X.jsx)(`span`,{className:`protocol-card-live-dot size-[5px]`}),(0,X.jsx)(`span`,{className:`text-[11px] font-medium tracking-wide text-muted-foreground`,children:qt(e.platformId)})]}),t&&(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 truncate text-[11px] text-muted-foreground`,children:[(0,X.jsx)(Yt,{status:t.status}),t.operationType===`apply`?`Applied`:`Cleaned`,` `,(0,X.jsx)(`time`,{dateTime:new Date(t.completedAt).toISOString(),title:M(t.completedAt),children:j(t.completedAt)})]}),(0,X.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-0.5`,children:[(0,X.jsx)(D,{variant:`ghost`,size:`icon-sm`,"aria-label":`Edit target`,onClick:n,children:(0,X.jsx)(ot,{className:`size-3`})}),(0,X.jsx)(D,{variant:`ghost`,size:`icon-sm`,className:`text-destructive hover:text-destructive`,"aria-label":`Delete target`,onClick:r,children:(0,X.jsx)(R,{className:`size-3`})})]})]})]})}function Zt({onClick:e}){return(0,X.jsxs)(`button`,{type:`button`,onClick:e,className:`env-orbital group h-full w-full flex flex-col items-center justify-center gap-2 border border-dashed py-10 text-muted-foreground transition-colors hover:border-primary/30 hover:text-primary`,style:{"--_status":`var(--tooltip-border)`},children:[(0,X.jsx)(V,{className:`size-5 transition-transform group-hover:scale-110`}),(0,X.jsx)(`span`,{className:`text-xs`,children:`Add Target`})]})}function Qt({targets:e,onMutate:t,lastOpByTarget:n,templates:r,templatesLoading:i,templatesError:a,onRetryTemplates:o,stream:s}){let[c,l]=(0,Y.useState)(!1),[u,d]=(0,Y.useState)(null),[f,p]=(0,Y.useState)(K.id),[m,_]=(0,Y.useState)({label:``,hostname:``,apiToken:``,sourceHostname:``}),[v,y]=(0,Y.useState)(!1),[E,O]=(0,Y.useState)(!1),{testing:k,runTest:A,cancelInFlight:j}=me(),[M,N]=(0,Y.useState)(null),[P,F]=(0,Y.useState)(null),I=s.status===`running`,L=f===K.id&&m.hostname.trim().length>0&&m.sourceHostname.trim().length>0&&(u!==null||m.apiToken.trim().length>0),R=()=>{d(null),p(K.id),_({label:``,hostname:``,apiToken:``,sourceHostname:``}),O(!1),l(!0)},z=e=>{d(e.id),p(Ae.some(t=>t.id===e.platformId)?e.platformId:K.id),_({label:e.label,hostname:e.hostname,apiToken:``,sourceHostname:e.sourceHostname}),O(!1),l(!0)},B=async()=>{if(f!==K.id){S.error(`${qt(f)} target setup is coming soon.`);return}if(!m.label||!m.hostname||!m.sourceHostname){S.error(`Label, hostname, and source host are required.`);return}if(!u&&!m.apiToken){S.error(`API token is required for new targets.`);return}y(!0);try{u?(await W(u,{platformId:f,label:m.label,hostname:m.hostname,sourceHostname:m.sourceHostname,...m.apiToken?{apiToken:m.apiToken}:{}}),S.success(`Target updated.`)):(await H({...m,platformId:f}),S.success(`Target added.`)),l(!1),t()}catch(e){S.error(J(e,`Failed to save target.`))}finally{y(!1)}};return(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)(`h2`,{className:`flex h-5 items-center text-xs font-medium leading-none uppercase tracking-wider text-muted-foreground`,children:`Platform Targets`}),e.length>0?(0,X.jsx)(Ke,{variant:`secondary`,className:`relative -top-px h-5 shrink-0 px-1.5 py-0 font-mono text-[10px] leading-none tabular-nums`,children:e.length}):null]}),(0,X.jsxs)(D,{size:`sm`,className:`h-7 shrink-0 gap-1.5 text-xs`,onClick:R,children:[(0,X.jsx)(V,{className:`size-3.5`}),` Add Target`]})]}),e.length===0?(0,X.jsx)(dt,{titleId:`platforms-targets-empty-title`,frameIcon:(0,X.jsx)(q,{className:`size-6 text-muted-foreground/45`,"aria-hidden":!0}),description:(0,X.jsx)(lt,{}),children:(0,X.jsx)(ut,{onClick:R})}):(0,X.jsx)(`div`,{className:`grid grid-cols-1 gap-3 @2xl/main:grid-cols-2 @5xl/main:grid-cols-3`,children:(0,X.jsxs)(g,{children:[e.map((e,t)=>(0,X.jsx)(h.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},children:(0,X.jsx)(Xt,{target:e,lastOp:n.get(e.id),onEdit:()=>z(e),onDelete:()=>N(e),quickActions:(0,X.jsx)(Gt,{target:e,templates:r,templatesLoading:i,templatesError:a,isStreaming:I,onRetryTemplates:o,onSelect:F})})},e.id)),(0,X.jsx)(h.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{type:`spring`,stiffness:380,damping:30,delay:e.length*.04},children:(0,X.jsx)(Zt,{onClick:R})},`add-card`)]})}),(0,X.jsx)(Kt,{selection:P,templates:r,stream:s,onSelectionChange:F}),(0,X.jsx)(se,{open:c,editing:u!==null,platformId:f,form:m,showToken:E,saving:v,testing:k,canTestConnection:L,onOpenChange:l,onPlatformChange:p,onFormChange:_,onShowTokenChange:O,onSave:()=>void B(),onTestConnection:()=>{L&&A({...u?{targetId:u}:{},hostname:m.hostname.trim(),sourceHostname:m.sourceHostname.trim(),...m.apiToken.trim()?{apiToken:m.apiToken.trim()}:{}})},onCancelInFlight:j}),(0,X.jsx)(C,{open:M!==null,onOpenChange:e=>!e&&N(null),children:(0,X.jsxs)(ee,{children:[(0,X.jsxs)(w,{children:[(0,X.jsx)(T,{children:`Remove Target`}),(0,X.jsxs)(x,{children:[`Remove “`,M?.label,`”? This only deletes the saved credentials — it does not affect resources on the target platform.`]})]}),(0,X.jsxs)(b,{children:[(0,X.jsx)(D,{variant:`outline`,onClick:()=>N(null),children:`Cancel`}),(0,X.jsx)(D,{variant:`destructive`,onClick:async()=>{if(!M)return;let e=M.id;N(null);try{await fe(e),S.success(`Target removed.`),t()}catch(e){S.error(J(e,`Failed to remove target.`))}},children:`Remove`})]})]})})]})}var $t=25;function en({status:e}){switch(e){case`success`:return(0,X.jsx)(je,{className:`size-3 text-success`});case`partial`:case`blocked`:return(0,X.jsx)(He,{className:`size-3 text-warning`});case`noop`:return(0,X.jsx)(it,{className:`size-3 text-muted-foreground`});case`failed`:return(0,X.jsx)(Ie,{className:`size-3 text-destructive`})}}function tn({targetCount:e,opCount:t,lastOp:n}){return(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground`,children:[(0,X.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(q,{className:`size-3`}),(0,X.jsx)(`span`,{className:`font-mono`,children:e}),` target`,e===1?``:`s`]}),(0,X.jsx)(`span`,{className:`hidden h-3 w-px bg-border/40 sm:inline-block`}),(0,X.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,X.jsx)(g,{mode:`popLayout`,initial:!1,children:(0,X.jsx)(h.span,{initial:{opacity:0,y:-6},animate:{opacity:1,y:0},exit:{opacity:0,y:6},transition:{type:`spring`,stiffness:500,damping:35},className:`font-mono tabular-nums`,children:t},t)}),` `,`operation`,t===1?``:`s`]}),n&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`hidden h-3 w-px bg-border/40 sm:inline-block`}),(0,X.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(en,{status:n.status}),(0,X.jsxs)(`span`,{children:[n.operationType===`apply`?`Applied`:`Cleaned`,` `,(0,X.jsx)(`time`,{dateTime:new Date(n.completedAt).toISOString(),title:M(n.completedAt),children:j(n.completedAt)})]})]})]})]})}function nn(){let e=f({queryKey:c.platforms.targets(),queryFn:()=>U()}),t=e.data??[],n=rt({queryKey:c.platforms.operationsList(),queryFn:({pageParam:e})=>ye({limit:$t,offset:e}),initialPageParam:0,getNextPageParam:(e,t,n)=>e.hasMore&&e.operations.length>0?n+$t:void 0}),i=(0,Y.useMemo)(()=>n.data?.pages.flatMap(e=>e.operations)??[],[n.data]),o=n.data?.pages[0]?.total??0,s=f({queryKey:c.catalog.templates(),queryFn:()=>a(`/catalog/templates`,r.catalogTemplates)}),u=s.data??[],d=ve(),p=(0,Y.useRef)(d.status);(0,Y.useEffect)(()=>{let e=p.current;p.current=d.status,e===`running`&&d.status===`complete`&&l.invalidateQueries({queryKey:c.platforms.operationsList()})},[d.status]);let y=(0,Y.useMemo)(()=>{let e=new Map;for(let t of i)e.has(t.targetId)||e.set(t.targetId,t);return e},[i]),[b,x]=_(`tab`,v([`targets`,`operations`,`activity`]).withDefault(`targets`)),S;return S=e.isPending&&e.data===void 0?null:e.isError&&e.data===void 0?(0,X.jsx)(m,{message:J(e.error,`Could not load targets.`),onRetry:()=>void e.refetch(),isRetrying:e.isFetching&&!e.isPending}):t.length===0?(0,X.jsx)(dt,{titleId:`platforms-operations-empty-title`,frameIcon:(0,X.jsx)(q,{className:`size-6 text-muted-foreground/45`,"aria-hidden":!0}),description:(0,X.jsx)(lt,{}),children:(0,X.jsx)(ut,{onClick:()=>void x(`targets`)})}):(0,X.jsx)(xt,{targets:t,stream:d}),(0,X.jsxs)(`div`,{className:`mx-auto flex h-full w-full min-w-0 max-w-screen-2xl flex-col gap-5 p-4 sm:gap-6 sm:p-6`,children:[(0,X.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2`,children:[(0,X.jsx)(`h1`,{className:`font-heading text-2xl font-semibold tracking-tight`,children:`Platforms`}),(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Connect Platforms as targets, then apply templates or run cleanup from Operations.`}),(0,X.jsx)(tn,{targetCount:t.length,opCount:o,lastOp:i[0]})]}),(0,X.jsxs)(Le,{value:b,onValueChange:e=>{x(e)},className:`flex-1 min-h-0`,children:[(0,X.jsx)(`div`,{className:`shrink-0 overflow-x-auto`,children:(0,X.jsxs)(Fe,{variant:`line`,className:`h-10! gap-0.5 min-w-max`,children:[(0,X.jsxs)(Me,{value:`targets`,className:`gap-1.5 px-3 text-sm`,children:[(0,X.jsx)(q,{className:`size-3.5 shrink-0`}),`Targets`]}),(0,X.jsxs)(Me,{value:`operations`,className:`gap-1.5 px-3 text-sm`,children:[(0,X.jsx)(Se,{className:`size-3.5 shrink-0`}),`Operations`]}),(0,X.jsxs)(Me,{value:`activity`,className:`gap-1.5 px-3 text-sm`,children:[(0,X.jsx)(I,{className:`size-3.5 shrink-0`}),`Activity`]})]})}),(0,X.jsx)(Ne,{value:`targets`,className:`flex-1 py-2`,children:(0,X.jsx)(h.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.15,ease:`easeOut`},children:e.isError&&e.data===void 0?(0,X.jsx)(m,{message:J(e.error,`Failed to load targets.`),onRetry:()=>void e.refetch(),isRetrying:e.isFetching&&!e.isPending}):(0,X.jsx)(Qt,{targets:t,onMutate:()=>void e.refetch(),lastOpByTarget:y,templates:u,templatesLoading:s.isPending&&s.data===void 0,templatesError:s.isError&&u.length===0,onRetryTemplates:()=>void s.refetch(),stream:d})},`targets`)}),(0,X.jsx)(Ne,{value:`operations`,className:`flex-1 py-2`,children:(0,X.jsx)(h.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.15,ease:`easeOut`},children:S},`operations`)}),(0,X.jsx)(Ne,{value:`activity`,className:`flex flex-col flex-1 min-h-0 py-2`,children:(0,X.jsx)(h.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.15,ease:`easeOut`},className:`flex flex-col flex-1 min-h-0`,children:(0,X.jsx)(Wt,{operations:i,totalKnown:o,isLoading:n.isPending&&!n.data,error:n.error,onRefresh:()=>void l.invalidateQueries({queryKey:c.platforms.operationsList()}),hasNextPage:n.hasNextPage,isFetchingNextPage:n.isFetchingNextPage,loadMoreError:n.isFetchNextPageError&&n.error instanceof Error?n.error:null,onRetryLoadMore:()=>void n.fetchNextPage(),onLoadMore:()=>void n.fetchNextPage()})},`activity`)})]}),(0,X.jsx)(g,{children:d.operation||d.status===`running`?(0,X.jsx)(ft,{stream:d,onReset:d.reset,catalogTemplates:u}):null})]})}export{nn as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./platforms-DbzXekvY.js";export{e as PlatformsPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{at as n}from"./vendor-ui-CWUk2ulb.js";import{Ct as r,St as i,_t as a,bt as o,ct as s,dt as c,ft as l,gt as u,ht as d,lt as f,mt as p,ut as m,vt as h,xt as g,yt as _}from"./api-Bf6pFRhP.js";import{C as v}from"./format-B9CcV2dj.js";import{n as y,t as b}from"./utils-XFKvwlFT.js";var x=class extends r{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=m(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),C(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return w(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return w(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof u(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!h(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&T(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||u(this.options.enabled,this.#t)!==u(t.enabled,this.#t)||a(this.options.staleTime,this.#t)!==a(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||u(this.options.enabled,this.#t)!==u(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return D(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(p)),t}#g(){this.#b();let e=a(this.options.staleTime,this.#t);if(c.isServer()||this.#r.isStale||!l(e))return;let t=o(this.#r.dataUpdatedAt,e)+1;this.#d=g.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(c.isServer()||u(this.options.enabled,this.#t)===!1||!l(this.#p)||this.#p===0)&&(this.#f=g.setInterval(()=>{(this.options.refetchIntervalInBackground||i.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(g.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(g.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,c=e===n?this.#n:e.state,{state:l}=e,f={...l},p=!1,h;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&C(e,t),o=i&&T(e,n,t,r);(a||o)&&(f={...f,...s(l.data,e.options)}),t._optimisticResults===`isRestoring`&&(f.fetchStatus=`idle`)}let{error:g,errorUpdatedAt:_,status:v}=f;h=f.data;let y=!1;if(t.placeholderData!==void 0&&h===void 0&&v===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,y=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(v=`success`,h=d(i?.data,e,t),p=!0)}if(t.select&&h!==void 0&&!y)if(i&&h===a?.data&&t.select===this.#c)h=this.#l;else try{this.#c=t.select,h=t.select(h),h=d(i?.data,h,t),this.#l=h,this.#s=null}catch(e){this.#s=e}this.#s&&(g=this.#s,h=this.#l,_=Date.now(),v=`error`);let b=f.fetchStatus===`fetching`,x=v===`pending`,S=v===`error`,w=x&&b,D=h!==void 0,O={status:v,fetchStatus:f.fetchStatus,isPending:x,isSuccess:v===`success`,isError:S,isInitialLoading:w,isLoading:w,data:h,dataUpdatedAt:f.dataUpdatedAt,error:g,errorUpdatedAt:_,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:f.dataUpdateCount>c.dataUpdateCount||f.errorUpdateCount>c.errorUpdateCount,isFetching:b,isRefetching:b&&!x,isLoadingError:S&&!D,isPaused:f.fetchStatus===`paused`,isPlaceholderData:p,isRefetchError:S&&D,isStale:E(e,t),refetch:this.refetch,promise:this.#o,isEnabled:u(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=O.data!==void 0,r=O.status===`error`&&!t,i=e=>{r?e.reject(O.error):t&&e.resolve(O.data)},a=()=>{i(this.#o=O.promise=m())},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||O.data!==o.value)&&a();break;case`rejected`:(!r||O.error!==o.reason)&&a();break}}return O}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!h(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){f.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function S(e,t){return u(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&t.retryOnMount===!1)}function C(e,t){return S(e,t)||e.state.data!==void 0&&w(e,t,t.refetchOnMount)}function w(e,t,n){if(u(t.enabled,e)!==!1&&a(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&E(e,t)}return!1}function T(e,t,n,r){return(e!==t||u(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&E(e,n)}function E(e,t){return u(t.enabled,e)!==!1&&e.isStaleByTime(a(t.staleTime,e))}function D(e,t){return!h(e.getCurrentResult(),t)}var O=e(t(),1),k=n(),A=O.createContext(void 0),j=e=>{let t=O.useContext(A);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},M=({client:e,children:t})=>(O.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,k.jsx)(A.Provider,{value:e,children:t})),N=O.createContext(!1),P=()=>O.useContext(N);N.Provider;function F(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var I=O.createContext(F()),L=()=>O.useContext(I),R=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?_(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},z=e=>{O.useEffect(()=>{e.clearReset()},[e])},B=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||_(n,[e.error,r])),V=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},H=(e,t)=>e.isLoading&&e.isFetching&&!t,U=(e,t)=>e?.suspense&&t.isPending,W=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function G(e,t,n){let r=P(),i=L(),a=j(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash);o._optimisticResults=r?`isRestoring`:`optimistic`,V(o),R(o,i,s),z(i);let l=!a.getQueryCache().get(o.queryHash),[u]=O.useState(()=>new t(a,o)),d=u.getOptimisticResult(o),m=!r&&e.subscribed!==!1;if(O.useSyncExternalStore(O.useCallback(e=>{let t=m?u.subscribe(f.batchCalls(e)):p;return u.updateResult(),t},[u,m]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),O.useEffect(()=>{u.setOptions(o)},[o,u]),U(o,d))throw W(o,u,i);if(B({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!c.isServer()&&H(d,r)&&(l?W(o,u,i):s?.promise)?.catch(p).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?d:u.trackResult(d)}function K(e,t){return G(e,x,t)}var q=y(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]);function J({role:e=`status`,"aria-live":t=`polite`,"aria-atomic":n=!0,className:r,eyebrow:i,stamp:a,title:o,children:s,detailLabel:c=`Technical detail`,detail:l,primaryLabel:u,onPrimary:d,primaryIcon:f,primaryDisabled:p,primaryBusy:m,secondaryLabel:h,onSecondary:g}){return(0,k.jsx)(`div`,{role:e,"aria-live":t,"aria-atomic":n,className:b(`relative overflow-hidden rounded-[var(--miravo-radius-stadium-lg)] border border-primary/20 bg-transparent`,r),children:(0,k.jsx)(`div`,{className:`p-5 sm:p-6`,children:(0,k.jsxs)(`div`,{className:`min-w-0 space-y-4`,children:[(0,k.jsxs)(`div`,{className:`space-y-3`,children:[(0,k.jsx)(`p`,{className:`font-mono text-[0.65rem] uppercase tracking-[0.38em] text-muted-foreground`,children:i}),(0,k.jsxs)(`div`,{className:`flex items-end gap-3`,children:[(0,k.jsx)(`span`,{className:`font-heading text-3xl font-black leading-none tracking-[-0.06em] text-transparent [-webkit-text-stroke:1px_color-mix(in_srgb,var(--primary)_50%,transparent)] sm:text-4xl`,"aria-hidden":!0,children:a}),(0,k.jsx)(`div`,{className:`mb-1.5 h-px min-w-8 flex-1 bg-linear-to-r from-primary/55 to-transparent`})]}),(0,k.jsx)(`h2`,{className:`text-lg font-semibold tracking-[-0.03em] text-foreground sm:text-xl`,children:o}),s?(0,k.jsx)(`div`,{className:`space-y-2 text-sm leading-relaxed text-muted-foreground`,children:s}):null]}),(0,k.jsxs)(`div`,{className:`rounded-[var(--miravo-radius-stadium-sm)] border border-border/80 bg-background/55 p-4 backdrop-blur-sm`,children:[(0,k.jsx)(`div`,{className:`mb-2 font-mono text-[0.65rem] uppercase tracking-[0.28em] text-muted-foreground`,children:c}),(0,k.jsx)(`p`,{className:`wrap-break-word font-mono text-sm leading-relaxed text-primary`,children:l})]}),(0,k.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:flex-wrap`,children:[(0,k.jsxs)(v,{type:`button`,onClick:d,disabled:!!(p||m),"aria-busy":m,className:b(`inline-flex w-full items-center justify-center gap-2 rounded-[var(--miravo-radius-stadium-sm)] border border-foreground/15 bg-foreground px-4 py-2.5 font-medium text-background shadow-none transition hover:bg-foreground/90 sm:w-auto`,m&&`pointer-events-none opacity-90`),children:[f,u]}),h&&g?(0,k.jsx)(v,{type:`button`,variant:`ghost`,size:`sm`,className:`sm:self-center`,onClick:g,children:h}):null]})]})})})}function Y({message:e,onRetry:t,isRetrying:n}){return(0,k.jsxs)(J,{role:`alert`,eyebrow:`Data link fault`,stamp:`ERR`,title:`Couldn't reach Miravo`,detail:e,primaryLabel:`Retry request`,onPrimary:t,primaryBusy:!!n,primaryIcon:(0,k.jsx)(q,{className:b(`size-4 shrink-0`,n&&`animate-spin`),"aria-hidden":!0}),children:[(0,k.jsxs)(`p`,{children:[(0,k.jsx)(`span`,{className:`text-foreground`,children:`Most often:`}),` the Miravo admin server isn't running, or this browser can't reach it (wrong host, port, or firewall).`]}),(0,k.jsx)(`p`,{children:`Start or restart Miravo if needed, use the correct link to the Miravo Console, then try again.`})]})}export{G as a,x as c,K as i,J as n,M as o,q as r,j as s,Y as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as e,D as t,E as n,S as r,T as i,_ as a,at as o,b as s,et as c,g as l,h as u,v as d,w as f,x as p,y as m}from"./vendor-ui-CWUk2ulb.js";import{
|
|
1
|
+
import{C as e,D as t,E as n,S as r,T as i,_ as a,at as o,b as s,et as c,g as l,h as u,v as d,w as f,x as p,y as m}from"./vendor-ui-CWUk2ulb.js";import{E as h}from"./format-B9CcV2dj.js";import{n as g,t as _}from"./utils-XFKvwlFT.js";var v=g(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),y=o(),b=t;function x({className:e,...t}){return(0,y.jsx)(l,{"data-slot":`select-group`,className:_(`scroll-my-1 p-1`,e),...t})}function S({className:e,...t}){return(0,y.jsx)(i,{"data-slot":`select-value`,className:_(`flex flex-1 text-left`,e),...t})}function C({className:e,size:t=`default`,children:r,...i}){return(0,y.jsxs)(n,{"data-slot":`select-trigger`,"data-size":t,className:_(`flex w-fit min-w-0 items-center justify-between gap-1.5 rounded-[var(--miravo-radius-stadium-sm)] border border-input bg-input/30 px-2.5 text-xs whitespace-nowrap transition-colors outline-none select-none hover:bg-input/50 focus-visible:border-primary/35 focus-visible:ring-2 focus-visible:ring-primary/22 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[var(--miravo-radius-stadium-sm)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...i,children:[r,(0,y.jsx)(f,{render:(0,y.jsx)(v,{className:`pointer-events-none size-4 text-muted-foreground`})})]})}function w({className:t,children:n,side:i=`bottom`,sideOffset:a=6,align:o=`center`,alignOffset:c=0,alignItemWithTrigger:l=!1,...u}){return(0,y.jsx)(e,{children:(0,y.jsx)(r,{side:i,sideOffset:a,align:o,alignOffset:c,alignItemWithTrigger:l,className:`isolate z-50`,children:(0,y.jsx)(p,{"data-slot":`select-content`,"data-align-trigger":l,className:_(`relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-[var(--miravo-radius-tight)] bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:data-open:duration-0 motion-reduce:data-closed:duration-0`,t),...u,children:(0,y.jsx)(s,{children:n})})})})}function T({className:e,...t}){return(0,y.jsx)(u,{"data-slot":`select-label`,className:_(`px-2 py-1.5 text-xs text-muted-foreground`,e),...t})}var E=`relative flex w-full cursor-pointer items-center gap-1.5 rounded-[var(--miravo-radius-tight)] py-1 pr-8 pl-1.5 text-xs text-muted-foreground outline-hidden select-none data-[highlighted]:bg-sidebar-accent data-[highlighted]:text-sidebar-accent-foreground not-data-[variant=destructive]:data-[highlighted]:**:text-sidebar-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`;function D({className:e,children:t,...n}){return(0,y.jsxs)(m,{"data-slot":`select-item`,className:_(E,e),...n,children:[(0,y.jsx)(a,{"data-slot":`select-item-text`,className:`flex min-w-0 flex-1 gap-2 whitespace-nowrap`,children:t}),(0,y.jsx)(d,{render:(0,y.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`}),children:(0,y.jsx)(h,{className:`pointer-events-none`})})]})}function O({className:e,...t}){return(0,y.jsx)(c,{"data-slot":`select-separator`,className:_(`pointer-events-none -mx-1 my-1 h-px bg-border`,e),...t})}export{T as a,S as c,D as i,v as l,w as n,O as o,x as r,C as s,b as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{at as e,d as t,f as n,m as r,p as i}from"./vendor-ui-CWUk2ulb.js";import{$ as a,B as o,E as s,G as c,H as l,J as u,K as d,L as f,Q as p,U as m,V as h,W as g,X as _,Y as v,Z as y,et as b,q as x}from"./api-Bf6pFRhP.js";import{D as ee}from"./format-B9CcV2dj.js";import{n as S,t as C}from"./utils-XFKvwlFT.js";var te=S(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),ne=S(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),re=S(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),ie=S(`radio`,[[`path`,{d:`M16.247 7.761a6 6 0 0 1 0 8.478`,key:`1fwjs5`}],[`path`,{d:`M19.075 4.933a10 10 0 0 1 0 14.134`,key:`ehdyv1`}],[`path`,{d:`M4.925 19.067a10 10 0 0 1 0-14.134`,key:`1q22gi`}],[`path`,{d:`M7.753 16.239a6 6 0 0 1 0-8.478`,key:`r2q7qm`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}]]);u({path:_().min(1),name:_().min(1),description:_().optional(),memberCount:x().int().nonnegative(),methodCount:x().int().nonnegative(),faultCount:x().int().nonnegative(),hasLifecycle:l(),lifecycleStageCount:x().int().nonnegative()}),u({path:_().min(1),id:_().min(1),name:_().min(1),description:_().optional(),areaCount:x().int().nonnegative(),twinAssignmentCount:x().int().nonnegative(),uniqueModelCount:x().int().nonnegative(),modelNames:h(_().min(1)),totalTwinCount:x().int().nonnegative()});var ae=u({severity:g([`error`,`warning`]),message:_(),fix:_()});u({valid:l(),templatePath:_(),issues:h(ae)});var w=`%.A.Hz.L.L/h.L/min.L/s.N.V.bar.cfm.count.degC.h.kN.kVA.kW.kWh.m.m/s.m3.m3/h.mm.mm/min.mm/s.ppm.pu.rpm.s`.split(`.`),T=g(w);new Set(w);var oe=_().min(1).max(128).regex(/^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/),E=g([`Boolean`,`Int32`,`UInt16`,`UInt32`,`Double`,`Float`,`String`]);g([`variable`,`property`]);var D=g([`read`,`readwrite`,`write`]),O=g([`>`,`>=`,`<`,`<=`,`==`,`!=`]),k=`Must be 1-64 chars and contain only letters, numbers, underscores, or hyphens.`,se=m(`type`,[u({type:d(`threshold`),member:_().regex(f,k),operator:O,threshold:x().finite()}).strict(),u({type:d(`lifecycle-stage`)}).strict(),u({type:d(`health-state`)}).strict(),u({type:d(`fault-active`)}).strict(),u({type:d(`fault-count`)}).strict(),u({type:d(`active-fault-code`),fallback:_().default(``)}).strict(),u({type:d(`availability-state`),member:_().regex(f,k),operator:O.default(`>`),threshold:x().finite().default(0),running_state:_().default(`running`),stopped_state:_().default(`stopped`),faulted_state:_().default(`faulted`)}).strict()]),A=`Must be 1-64 chars and contain only letters, numbers, underscores, or hyphens.`,j=h(_().min(1)).min(1),ce=u({data_type:E,unit:T.optional(),description:_().optional(),enum_values:j.optional()}).strict(),le=p([u({member:_().regex(f,A),value:p([x(),_(),l()])}).strict(),u({member:_().regex(f,A),argument:_().regex(f,A)}).strict()]),ue=u({type:d(`set-members`),writes:h(le).min(1)}).strict(),de=p([u({parameter:_().regex(f,A),value:x().finite()}).strict(),u({parameter:_().regex(f,A),argument:_().regex(f,A)}).strict()]),fe=m(`type`,[ue,u({type:d(`set-parameters`),writes:h(de).min(1)}).strict(),u({type:d(`clear-faults`)}).strict()]),pe=u({description:_().optional(),input_arguments:v(_().regex(f,A),ce).optional(),output_arguments:v(_().regex(f,A),ce).optional(),runtime:fe.optional()}).strict(),me=v(_().regex(f,A),pe);function M(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function N(e){if(typeof e==`string`)return o.exec(e)?.[1]}function P(e,t,n){if(!M(e)||e.type!==`weighted-sum`)return;let r=e.terms;if(Array.isArray(r))for(let e=0;e<r.length;e++){let i=r[e];M(i)&&n(i,[...t,`terms`,e])}}function he(e,t,n){if(!M(e))return;let r=[...t,`member`],i=[...t,`previous_member`],a=[...t,`param`],o=[...t,`generator`];typeof e.member==`string`&&n.onMember?.(e.member,r),typeof e.previous_member==`string`&&n.onPreviousMember?.(e.previous_member,i),typeof e.param==`string`&&n.onParam?.(e.param,a),`generator`in e&&n.onGenerator?.(e.generator,o)}function ge(e,t,n,r){return{onMember:e,onPreviousMember:t,onParam:n,onGenerator:r}}function _e(e,t,n,r,i,a){he(e,t,ge(n,r,i,a))}function F(e){return e===`Double`||e===`Float`||e===`Int32`||e===`UInt16`||e===`UInt32`}function ve(e){return e===`Int32`||e===`UInt16`||e===`UInt32`}function I(e,t){switch(t){case`Boolean`:return typeof e==`boolean`;case`String`:return typeof e==`string`;case`Double`:case`Float`:return typeof e==`number`&&Number.isFinite(e);case`Int32`:return typeof e==`number`&&Number.isSafeInteger(e)&&e>=-2147483648&&e<=2147483647;case`UInt16`:return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0&&e<=65535;case`UInt32`:return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0&&e<=4294967295;default:return!1}}function ye(e,t,n){e.unit!==void 0&&(e.data_type===`Boolean`||e.data_type===`String`)&&t.addIssue({code:b.custom,path:[...n,`unit`],message:`Members with data_type "${e.data_type}" must not declare engineering units. Fix: remove the unit or use a numeric data_type.`}),e.enum_values&&e.data_type!==`String`&&t.addIssue({code:b.custom,path:[...n,`enum_values`],message:`enum_values is only valid for String members. Fix: remove enum_values or change data_type to "String".`})}function L(e,t,n,r){if(M(e)&&typeof e.type==`string`)switch(e.type){case`correlated`:typeof e.source==`string`&&n.push({member:e.source,path:[...t,`source`],previousTick:!1}),z(e.factor,[...t,`factor`],r),z(e.offset,[...t,`offset`],r);return;case`sine`:case`noise`:case`waveform`:case`chirp`:z(e.center,[...t,`center`],r);return;case`mean-reverting-noise`:z(e.mean,[...t,`mean`],r);return;case`first-order-lag`:case`second-order`:z(e.gain,[...t,`gain`],r),z(e.bias,[...t,`bias`],r),R(e.input,[...t,`input`],n,r);return;case`transport-delay`:z(e.delay,[...t,`delay`],r),R(e.input,[...t,`input`],n,r);return;case`slew-rate-limiter`:case`integrator`:R(e.input,[...t,`input`],n,r);return;case`hysteresis-relay`:z(e.on_threshold,[...t,`on_threshold`],r),z(e.off_threshold,[...t,`off_threshold`],r),R(e.input,[...t,`input`],n,r);return;case`weighted-sum`:z(e.bias,[...t,`bias`],r),P(e,t,(e,t)=>{z(e.weight,[...t,`weight`],r),R(e.input,[...t,`input`],n,r)});return;case`gate`:n.push({member:String(e.enabled_member),path:[...t,`enabled_member`],previousTick:!1}),R(e.input,[...t,`input`],n,r);return;case`health-dependent`:{let i=e.stages;if(!M(i))return;for(let[e,a]of Object.entries(i))L(a,[...t,`stages`,e],n,r);return}default:return}}function R(e,t,n,r){_e(e,t,(e,t)=>n.push({member:e,path:t,previousTick:!1}),(e,t)=>n.push({member:e,path:t,previousTick:!0}),(e,t)=>r.push({param:e,path:t}),(e,t)=>L(e,t,n,r))}function z(e,t,n){let r=N(e);r!==void 0&&n.push({param:r,path:t})}function be(e,t,n){if(!M(e))return;let r=e.type;(r===`threshold`||r===`availability-state`)&&typeof e.member==`string`&&n.push({member:e.member,path:[...t,`member`],previousTick:!1})}function B(e,t,n){if(!M(e))return;let r=e.type;if(typeof r!=`string`)return;if(r===`integrator`&&e.wrap===!0&&(typeof e.wrap_at!=`number`||!Number.isFinite(e.wrap_at)||e.wrap_at<=0)&&n.addIssue({code:b.custom,path:[...t,`wrap_at`],message:`wrap_at must be a finite number greater than 0 when wrap is true. Fix: Set wrap_at to a positive number, or set wrap to false.`}),r===`health-dependent`){let r=e.stages;if(M(r))for(let[e,i]of Object.entries(r))B(i,[...t,`stages`,e],n)}function i(e,t){!M(e)||!(`generator`in e)||B(e.generator,[...t,`generator`],n)}i(e.input,[...t,`input`]),P(e,t,(e,t)=>{i(e.input,[...t,`input`])})}function xe(e){switch(e){case`Boolean`:return!1;case`String`:return``;case`Double`:case`Float`:case`Int32`:case`UInt16`:case`UInt32`:return 0;default:return 0}}var Se=h(m(`type`,[u({type:d(`white_noise`),strength:x().min(0).max(1),scale:x().positive().optional()}).strict(),u({type:d(`drift`),tau:x().positive(),sigma:x().min(0).max(1),scale:x().positive().optional()}).strict(),u({type:d(`outlier`),probability:x().min(0).max(1),magnitude:x().positive(),scale:x().positive().optional()}).strict(),u({type:d(`gap`),probability:x().min(0).max(1),duration:x().int().positive().default(10)}).strict(),u({type:d(`noise_burst`),probability:x().min(0).max(1),duration:x().int().positive().default(5),strength:x().min(0).max(1),scale:x().positive().optional()}).strict()])).min(1).optional(),V=`Must be 1-64 chars and contain only letters, numbers, underscores, or hyphens.`;g([`float`,`int`,`string`,`bool`]);var Ce=m(`type`,[u({type:d(`float`),default:x().finite(),min:x().finite().optional(),max:x().finite().optional(),unit:T.optional()}),u({type:d(`int`),default:x().int().safe(),min:x().int().safe().optional(),max:x().int().safe().optional(),unit:T.optional()}),u({type:d(`string`),default:_(),unit:T.optional()}),u({type:d(`bool`),default:l(),unit:T.optional()})]),H=p([u({member:_()}).strict(),u({previous_member:_()}).strict(),u({param:_()}).strict(),u({generator:c(()=>We)}).strict()]),U=_().regex(o,`Must be a $param.X parameter reference`),W=p([x(),U]),G=p([x().finite(),U]),K={initial_value:x().default(0),gain:W.default(1),bias:W.default(0),min:x().nullable().default(null),max:x().nullable().default(null),input:H},q=u({type:d(`sine`),center:W,amplitude:x().positive(),period:x().positive()}).strict(),J=u({type:d(`random-walk`),min:x(),max:x(),step:x().positive()}).strict(),we=u({type:d(`noise`),center:W,stddev:x().positive()}).strict(),Te=u({type:d(`step`),values:h(x()).min(1),interval:x().positive()}).strict(),Ee=u({type:d(`correlated`),source:_().regex(f,V),factor:G,offset:G,power:x().int().positive().optional()}).strict(),De=u({from:_(),to:_(),probability:x().min(0).max(1).optional(),on:_().optional()}).strict(),Y=u({type:d(`state-machine`),states:h(_()).min(1),initial:_(),transitions:h(De).min(1)}).strict();function X(e,t){let n=new Set(e.states);n.has(e.initial)||t.addIssue({code:b.custom,path:[`initial`],message:`State machine initial state "${e.initial}" is not in states. Fix: Set initial to one of: ${e.states.join(`, `)}.`});for(let r=0;r<e.transitions.length;r++){let i=e.transitions[r];i&&(n.has(i.from)||t.addIssue({code:b.custom,path:[`transitions`,r,`from`],message:`State machine transition from "${i.from}" references a state that is not in states. Fix: Add "${i.from}" to states or change transition.from to one of: ${e.states.join(`, `)}.`}),n.has(i.to)||t.addIssue({code:b.custom,path:[`transitions`,r,`to`],message:`State machine transition to "${i.to}" references a state that is not in states. Fix: Add "${i.to}" to states or change transition.to to one of: ${e.states.join(`, `)}.`}))}}Y.superRefine(X);var Oe=u({type:d(`ramp`),start_value:x().default(0),rate:x(),duration:x().nonnegative(),start_time:x().default(0),min:x().nullable().default(null),max:x().nullable().default(null)}).strict(),ke=u({type:d(`mean-reverting-noise`),mean:W,tau:x().positive(),sigma:x().positive(),initial_value:x().optional(),min:x().nullable().default(null),max:x().nullable().default(null)}).strict(),Ae=u({time:x().nonnegative(),value:x()}),je=u({type:d(`timetable`),points:h(Ae).min(2),repeat:l().default(!1),interpolation:g([`linear`,`step`]).default(`linear`)}).strict(),Me=u({type:d(`waveform`),shape:g([`sawtooth`,`triangle`,`square`,`pulse`]),center:W,amplitude:x().positive(),period:x().positive(),duty_cycle:x().min(0).max(1).default(.5)}).strict(),Ne=u({type:d(`chirp`),center:W,amplitude:x().positive(),start_freq_hz:x().positive(),end_freq_hz:x().positive(),sweep_duration:x().positive(),sweep:g([`linear`,`exponential`]).default(`linear`),repeat:l().default(!0)}).strict(),Z=u({type:d(`impulse`),baseline:x().default(0),amplitude:x(),probability:x().min(0).max(1).optional(),interval:x().positive().optional(),decay:x().min(0).max(1).optional(),duration:x().int().positive().default(1)}).strict();function Q(e,t){e.probability===void 0&&e.interval===void 0&&t.addIssue({code:b.custom,path:[`probability`],message:`Impulse generator requires either probability or interval. Fix: Add probability: 0.01 (per-tick chance) or interval: 60 (seconds between triggers).`}),e.probability!==void 0&&e.interval!==void 0&&t.addIssue({code:b.custom,path:[`interval`],message:`Impulse generator cannot have both probability and interval. Fix: Remove one: use probability for random triggers, or interval for periodic triggers.`})}Z.superRefine(Q);var Pe=u({type:d(`first-order-lag`),tau:x().positive(),...K}).strict(),Fe=u({type:d(`integrator`),initial_value:x().default(0),gain:x().default(1),bias_rate:x().default(0),min:x().default(-1/0),max:x().default(1/0),wrap:l().default(!1),wrap_at:x().nullable().default(null),input:H}).strict(),Ie=u({type:d(`transport-delay`),delay:p([x().nonnegative(),U]),initial_value:x().default(0),interpolation:g([`linear`,`zoh`]).default(`linear`),input:H}).strict(),Le=u({type:d(`slew-rate-limiter`),rate_up:x().positive(),rate_down:x().positive().optional(),initial_value:x().default(0),min:x().nullable().default(null),max:x().nullable().default(null),input:H}).strict(),Re=u({type:d(`second-order`),natural_freq_hz:x().positive(),damping_ratio:x().positive(),initial_velocity:x().default(0),...K}).strict(),ze=u({type:d(`hysteresis-relay`),on_threshold:W,off_threshold:W,output_on:p([x(),_()]).default(1),output_off:p([x(),_()]).default(0),initial_state:g([`on`,`off`]).default(`off`),mode:g([`rising`,`falling`]).default(`rising`),input:H}).strict(),Be=u({weight:W.default(1),input:H}),Ve=u({type:d(`weighted-sum`),bias:W.default(0),terms:h(Be).min(1),min:x().nullable().default(null),max:x().nullable().default(null)}).strict(),He=u({type:d(`gate`),enabled_member:_().regex(f,V),input:H,disabled_value:p([x(),_(),l()])}).strict(),Ue=m(`type`,[q,J,we,Te,Ee,Y,Oe,ke,je,Me,Ne,Z]).superRefine((e,t)=>{e.type===`state-machine`&&X(e,t),e.type===`impulse`&&Q(e,t)}),We=m(`type`,[q,J,we,Te,Ee,Y,Oe,ke,je,Me,Ne,Z,u({type:d(`health-dependent`),stages:v(_(),Ue)}).strict(),Pe,Fe,Ie,Le,Re,ze,Ve,He]).superRefine((e,t)=>{e.type===`state-machine`&&X(e,t),e.type===`impulse`&&Q(e,t)}),Ge=u({multiplier:x().finite().optional(),offset:x().finite().optional()}).strict(),Ke=u({stages:h(u({name:_().min(1),duration_hours:y([x().nonnegative(),x().nonnegative()]).refine(([e,t])=>e<=t,{message:`duration_hours max must be greater than or equal to min.`}),effects:v(_(),Ge)})).min(1)}).superRefine((e,t)=>{let n=new Set;for(let r=0;r<e.stages.length;r++){let i=e.stages[r];i&&(n.has(i.name)&&t.addIssue({code:b.custom,path:[`stages`,r,`name`],message:`Lifecycle stage names must be unique. Duplicate "${i.name}". Fix: Rename one stage so each lifecycle stage has a unique name.`}),n.add(i.name))}}),qe=u({multiplier:x().finite().optional(),offset:x().finite().optional(),spike:x().finite().optional(),duration_ticks:x().int().positive().optional(),onset_ticks:x().int().positive().optional(),recovery_ticks:x().int().positive().optional()}).strict(),Je=u({condition:_().optional(),lifecycle_stage:_().optional(),probability:x().min(0).max(1)}),Ye=u({name:_().regex(f,V),trigger:Je,effects:v(_(),p([qe,_()]))}),Xe=`Must be 1-64 chars and contain only letters, numbers, underscores, or hyphens.`,Ze=new Set([`enterprise`,`site`,`area`,`line`,`prefix`]),Qe=_().regex(o,`Must be a $param.X parameter reference`),$e=p([x(),_(),l()]),et=u({name:_().regex(f,Xe),description:_().optional(),namespace:_().optional()}).strict(),tt=m(`kind`,[u({kind:d(`variable`),data_type:E,access:D,unit:T.optional(),enum_values:j.optional(),eu_range:y([x(),x()]).refine(([e,t])=>e<=t,{message:`eu_range[0] (min) must be <= eu_range[1] (max).`}).optional(),generator:We.optional(),binding:se.optional(),default:$e.optional(),observation_effects:Se}).strict(),u({kind:d(`property`),data_type:E,access:D,unit:T.optional(),enum_values:j.optional(),default:p([$e,Qe]).optional()}).strict()]);function nt(e){return v(_().regex(f,Xe),tt).refine(e=>Object.keys(e).length>=1,{message:`Members map must have at least 1 member.`}).refine(t=>Object.keys(t).length<=e,{message:`Members map must have at most ${e} members.`}).refine(e=>!Object.keys(e).some(e=>Ze.has(e)),{message:`Member names cannot use reserved env keys: enterprise/site/area/line/prefix`})}function rt(e={}){let t=nt(e.maxMembersPerModel??1e3);return u({schema_version:d(`2`),model:et,parameters:v(_(),Ce).optional(),members:t,methods:me.optional(),lifecycle:Ke.optional(),faults:h(Ye).optional()}).strict().superRefine((e,t)=>{let n=Object.keys(e.members),r=new Map;for(let e=0;e<n.length;e++){let t=n[e];t!==void 0&&r.set(t,e)}let i=new Set(Object.keys(e.parameters??{})),a=new Set(Object.entries(e.parameters??{}).filter(([,e])=>e.type===`float`||e.type===`int`).map(([e])=>e));for(let o=0;o<n.length;o++){let s=n[o];if(s===void 0)continue;let c=e.members[s];if(!c||(ye(c,t,[`members`,s]),c.kind===`variable`&&c.generator!==void 0&&c.binding!==void 0&&t.addIssue({code:b.custom,path:[`members`,s,`binding`],message:`Variable members cannot define both "generator" and "binding". Fix: keep one source of value generation.`}),c.kind===`variable`&&c.binding!==void 0&&c.access!==`read`&&t.addIssue({code:b.custom,path:[`members`,s,`access`],message:`Variable members with a "binding" must use access "read". Fix: change access to "read" or remove the binding.`}),c.kind!==`variable`||!c.generator&&!c.binding))continue;let l=[],u=[],d=[`members`,s,`generator`];if(c.generator&&L(c.generator,d,l,u),c.binding&&be(c.binding,[`members`,s,`binding`],l),c.generator&&(B(c.generator,d,t),c.generator.type===`gate`)){let n=e.members[c.generator.enabled_member];n&&n.data_type!==`Boolean`&&t.addIssue({code:b.custom,path:[`members`,s,`generator`,`enabled_member`],message:`Gate generator for "${s}" references "${c.generator.enabled_member}", but "${c.generator.enabled_member}" is not Boolean. Fix: use a Boolean command/state member for enabled_member.`}),I(c.generator.disabled_value,c.data_type)||t.addIssue({code:b.custom,path:[`members`,s,`generator`,`disabled_value`],message:`Gate generator disabled_value for "${s}" does not match data_type "${c.data_type}". Fix: use a compatible disabled_value literal.`})}for(let e of l){let n=r.get(e.member);if(n===void 0){t.addIssue({code:b.custom,path:[...e.path],message:`Member "${s}" references member "${e.member}", but "${e.member}" is not defined. Fix: Define "${e.member}" in members, or change the reference to a parameter.`});continue}!e.previousTick&&n>=o&&t.addIssue({code:b.custom,path:[...e.path],message:`Member "${s}" references member "${e.member}" which is defined later (or is itself). Members are evaluated in declaration order. Fix: Move "${e.member}" above "${s}".`})}for(let n of u)i.has(n.param)?a.has(n.param)||t.addIssue({code:b.custom,path:[...n.path],message:`Member "${s}" references parameter "${n.param}" in a numeric position, but "${n.param}" has type "${e.parameters?.[n.param]?.type}". Only float and int parameters can be used as generator coefficients or inputs. Fix: Change "${n.param}" to type "float" or "int".`}):t.addIssue({code:b.custom,path:[...n.path],message:`Member "${s}" references parameter "${n.param}", but "${n.param}" is not defined. Fix: Define "${n.param}" under parameters, or replace "$param.${n.param}" with a literal value.`});if(c.binding)switch(c.binding.type){case`threshold`:c.data_type!==`Boolean`&&t.addIssue({code:b.custom,path:[`members`,s,`data_type`],message:`Members using binding.type "threshold" must use data_type "Boolean". Fix: change data_type to "Boolean".`}),it(s,c.binding.member,e,t,[`members`,s,`binding`,`member`]);break;case`availability-state`:c.data_type!==`String`&&t.addIssue({code:b.custom,path:[`members`,s,`data_type`],message:`Members using binding.type "availability-state" must use data_type "String". Fix: change data_type to "String".`}),it(s,c.binding.member,e,t,[`members`,s,`binding`,`member`]);break;case`lifecycle-stage`:case`health-state`:case`active-fault-code`:c.data_type!==`String`&&t.addIssue({code:b.custom,path:[`members`,s,`data_type`],message:`Members using binding.type "${c.binding.type}" must use data_type "String". Fix: change data_type to "String".`});break;case`fault-active`:c.data_type!==`Boolean`&&t.addIssue({code:b.custom,path:[`members`,s,`data_type`],message:`Members using binding.type "fault-active" must use data_type "Boolean". Fix: change data_type to "Boolean".`});break;case`fault-count`:c.data_type!==`Int32`&&c.data_type!==`UInt16`&&c.data_type!==`UInt32`&&t.addIssue({code:b.custom,path:[`members`,s,`data_type`],message:`Members using binding.type "fault-count" must use an integer data_type (Int32, UInt16, or UInt32). Fix: change data_type to an integer type.`});break;default:c.binding}if(c.kind===`variable`&&c.observation_effects){F(c.data_type)||t.addIssue({code:b.custom,path:[`members`,s,`observation_effects`],message:`Observation effects on "${s}" require a numeric data_type (Double, Float, Int32, UInt16, or UInt32). Member has data_type "${c.data_type}", which cannot be degraded by noise, gaps, or drift. Fix: remove observation_effects, or change data_type to a numeric type.`}),c.access!==`read`&&t.addIssue({code:b.custom,path:[`members`,s,`observation_effects`],message:`Observation effects on "${s}" require access "read". Observation effects corrupt values — they must not be applied to command targets or setpoints. Fix: change access to "read" or remove observation_effects.`});for(let e=0;e<c.observation_effects.length;e++){let n=c.observation_effects[e];n&&(n.type===`white_noise`||n.type===`drift`||n.type===`outlier`||n.type===`noise_burst`)&&!(`scale`in n&&n.scale!==void 0)&&!c.eu_range&&t.addIssue({code:b.custom,path:[`members`,s,`observation_effects`,e],message:`Member "${s}" uses relative observation effect "${n.type}" but has no eu_range and no explicit scale. Fix: add eu_range: [min, max] to the member, or add scale: <number> to the effect.`})}}}function o(n,i,a){if(!r.has(n)){t.addIssue({code:b.custom,path:[...i],message:`${a} has effect on "${n}", but "${n}" is not a defined member. Fix: Change "${n}" to a valid member name.`});return}let o=e.members[n];o&&o.kind!==`variable`&&t.addIssue({code:b.custom,path:[...i],message:`${a} has effect on "${n}", but "${n}" is a property (kind: "property"). Effects can only target variable members.`})}if(e.lifecycle){let t=[`lifecycle`,`stages`];for(let n of e.lifecycle.stages)for(let e of Object.keys(n.effects))o(e,t,`Lifecycle stage "${n.name}"`)}if(e.faults){let n=new Set;for(let r=0;r<e.faults.length;r++){let i=e.faults[r];if(!i)continue;n.has(i.name)&&t.addIssue({code:b.custom,path:[`faults`,r,`name`],message:`Fault names must be unique. Duplicate "${i.name}". Fix: Rename one fault so each fault has a unique name.`}),n.add(i.name);let a=[`faults`,r,`effects`];for(let e of Object.keys(i.effects))o(e,a,`Fault "${i.name}"`)}}for(let r of n){let n=e.members[r];if(!n||n.kind!==`property`||typeof n.default!=`string`)continue;let a=N(n.default);a!==void 0&&!i.has(a)&&t.addIssue({code:b.custom,path:[`members`,r,`default`],message:`Property "${r}" default references parameter "${a}", but "${a}" is not defined. Fix: Define "${a}" under parameters, or use a literal value.`})}if(e.methods)for(let[n,r]of Object.entries(e.methods))at(n,r.input_arguments,t,[`methods`,n,`input_arguments`]),at(n,r.output_arguments,t,[`methods`,n,`output_arguments`]),ot(n,r,e,t,[`methods`,n,`runtime`])})}function it(e,t,n,r,i){let a=n.members[t];a&&(F(a.data_type)||r.addIssue({code:b.custom,path:[...i],message:`Member "${e}" binding references "${t}", but "${t}" is not numeric. Fix: bind to a numeric member or change the source member data_type.`}))}function at(e,t,n,r){if(t)for(let[i,a]of Object.entries(t))a.unit!==void 0&&(a.data_type===`Boolean`||a.data_type===`String`)&&n.addIssue({code:b.custom,path:[...r,i,`unit`],message:`Method "${e}" argument "${i}" uses data_type "${a.data_type}" and must not declare an engineering unit. Fix: remove the unit or use a numeric data_type.`}),a.enum_values&&a.data_type!==`String`&&n.addIssue({code:b.custom,path:[...r,i,`enum_values`],message:`Method "${e}" argument "${i}" can only use enum_values with data_type "String". Fix: remove enum_values or change the data_type.`})}function ot(e,t,n,r,i){let a=t.runtime;if(a)switch(a.type){case`clear-faults`:return;case`set-parameters`:for(let o=0;o<a.writes.length;o++){let s=a.writes[o];if(!s)continue;let c=[...i,`writes`,o],l=n.parameters?.[s.parameter];if(!l){r.addIssue({code:b.custom,path:[...c,`parameter`],message:`Method "${e}" runtime targets parameter "${s.parameter}", but "${s.parameter}" is not defined. Fix: target a declared parameter.`});continue}if(l.type!==`float`&&l.type!==`int`){r.addIssue({code:b.custom,path:[...c,`parameter`],message:`Method "${e}" runtime targets parameter "${s.parameter}" of type "${l.type}". Fix: use set-parameters only with float or int parameters.`});continue}if(`argument`in s){let n=t.input_arguments?.[s.argument];if(!n){r.addIssue({code:b.custom,path:[...c,`argument`],message:`Method "${e}" runtime references input argument "${s.argument}", but that argument is not defined. Fix: declare the input argument or use a literal value.`});continue}F(n.data_type)||r.addIssue({code:b.custom,path:[...c,`argument`],message:`Method "${e}" runtime argument "${s.argument}" must be numeric to write parameter "${s.parameter}". Fix: use Double, Float, Int32, UInt16, or UInt32.`}),l.type===`int`&&!ve(n.data_type)&&r.addIssue({code:b.custom,path:[...c,`argument`],message:`Method "${e}" runtime argument "${s.argument}" uses data_type "${n.data_type}" but parameter "${s.parameter}" is type "int". Fix: use Int32, UInt16, or UInt32 so runtime writes stay integer-safe.`});continue}l.type===`int`&&!Number.isSafeInteger(s.value)&&r.addIssue({code:b.custom,path:[...c,`value`],message:`Method "${e}" runtime literal for integer parameter "${s.parameter}" must be a safe integer. Fix: use a whole-number literal.`})}return;case`set-members`:for(let o=0;o<a.writes.length;o++){let s=a.writes[o];if(!s)continue;let c=[...i,`writes`,o],l=n.members[s.member];if(!l){r.addIssue({code:b.custom,path:[...c,`member`],message:`Method "${e}" runtime targets member "${s.member}", but "${s.member}" is not defined. Fix: target a declared member.`});continue}if(l.kind!==`variable`&&r.addIssue({code:b.custom,path:[...c,`member`],message:`Method "${e}" runtime targets "${s.member}", but "${s.member}" is a property. Fix: target a writable variable member.`}),l.access!==`readwrite`&&l.access!==`write`&&r.addIssue({code:b.custom,path:[...c,`member`],message:`Method "${e}" runtime targets "${s.member}", but "${s.member}" is not writable. Fix: set access to "readwrite" or "write".`}),l.kind===`variable`&&l.binding&&r.addIssue({code:b.custom,path:[...c,`member`],message:`Method "${e}" runtime targets "${s.member}", but bound members are computed at runtime. Fix: write to a command/setpoint member without a binding.`}),`argument`in s){let n=t.input_arguments?.[s.argument];if(!n){r.addIssue({code:b.custom,path:[...c,`argument`],message:`Method "${e}" runtime references input argument "${s.argument}", but that argument is not defined. Fix: declare the input argument or use a literal value.`});continue}if(I(xe(n.data_type),l.data_type)||r.addIssue({code:b.custom,path:[...c,`argument`],message:`Method "${e}" runtime argument "${s.argument}" uses data_type "${n.data_type}" which does not match target member "${s.member}" data_type "${l.data_type}". Fix: align the argument and target member data types.`}),n.enum_values&&l.enum_values){let t=n.enum_values.filter(e=>!l.enum_values?.includes(e));t.length>0&&r.addIssue({code:b.custom,path:[...c,`argument`],message:`Method "${e}" runtime argument "${s.argument}" allows values [${t.join(`, `)}] that are not valid for target member "${s.member}". Fix: align enum_values between the argument and target member.`})}continue}I(s.value,l.data_type)||r.addIssue({code:b.custom,path:[...c,`value`],message:`Method "${e}" runtime literal for "${s.member}" does not match data_type "${l.data_type}". Fix: use a compatible literal value.`}),l.enum_values&&typeof s.value==`string`&&!l.enum_values.includes(s.value)&&r.addIssue({code:b.custom,path:[...c,`value`],message:`Method "${e}" runtime literal "${s.value}" is not allowed for member "${s.member}". Fix: use one of [${l.enum_values.join(`, `)}].`})}return;default:}}rt();var st=p([x().finite(),_(),l()]),ct=_().regex(/^[a-f0-9]{64}$/),lt=u({id:_().min(1),model:_().min(1),browsePath:h(_().min(1)).min(1),parameters:v(_(),st),lifecycleStage:_().min(1),operatingHours:x().finite().nonnegative(),activeFaults:h(_().min(1)),templateRunId:x().int().positive().optional(),protocolScope:h(s).min(1).optional(),observationState:v(_(),v(_(),a())).optional().default({}),faultState:v(_(),u({remaining:x().int(),elapsed:x().int(),recovering:l(),recoveryElapsed:x().int(),recoveryTicks:x().int()})).optional().default({})}),ut=u({templateRunId:x().int().positive(),templateName:_().min(1),templatePath:_(),entryHash:ct.optional()}),dt=u({name:_().min(1),enabled:l(),config:v(_(),a())});u({version:d(2),savedAt:_().min(1),environmentName:oe,models:h(_().min(1)),instances:h(lt),templateRuns:h(ut),adapters:h(dt).default([])});var $=e();function ft({className:e,orientation:t=`horizontal`,...n}){return(0,$.jsx)(r,{"data-slot":`tabs`,"data-orientation":t,className:C(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var pt=ee(`group/tabs-list inline-flex w-fit items-center justify-center rounded-[var(--miravo-radius-stadium-sm)] p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-0 border-b border-border/50 bg-transparent p-0 shadow-none group-data-horizontal/tabs:h-auto group-data-horizontal/tabs:min-h-8`}},defaultVariants:{variant:`default`}});function mt({className:e,variant:n=`default`,...r}){return(0,$.jsx)(t,{"data-slot":`tabs-list`,"data-variant":n,className:C(pt({variant:n}),e),...r})}function ht({className:e,...t}){return(0,$.jsx)(i,{"data-slot":`tabs-trigger`,className:C(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-[var(--miravo-radius-tight)] border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-muted-foreground transition-[color,box-shadow,transform] duration-200 ease-out group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:font-heading group-data-[variant=line]/tabs-list:tracking-tight group-data-[variant=line]/tabs-list:text-sm group-data-[variant=line]/tabs-list:text-muted-foreground group-data-[variant=line]/tabs-list:hover:text-foreground group-data-[variant=line]/tabs-list:data-active:font-semibold group-data-[variant=line]/tabs-list:data-active:text-foreground`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent group-data-[variant=line]/tabs-list:data-active:border-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`group-data-[variant=line]/tabs-list:rounded-none group-data-[variant=line]/tabs-list:px-3 group-data-[variant=line]/tabs-list:py-2`,`data-active:bg-background data-active:text-foreground data-active:border-input data-active:bg-input/30 data-active:text-foreground`,`after:pointer-events-none after:absolute after:bg-foreground after:opacity-0 after:transition-[opacity,transform] after:duration-300 after:ease-out group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5`,`group-data-[variant=line]/tabs-list:after:bg-primary group-data-horizontal/tabs:group-data-[variant=line]/tabs-list:after:bottom-0 group-data-horizontal/tabs:group-data-[variant=line]/tabs-list:after:h-[2px] group-data-horizontal/tabs:group-data-[variant=line]/tabs-list:after:rounded-sm group-data-[variant=line]/tabs-list:data-active:after:opacity-100 group-data-horizontal/tabs:group-data-[variant=line]/tabs-list:data-active:after:shadow-[0_0_14px_-3px_color-mix(in_srgb,var(--primary)_50%,transparent)]`,e),...t})}function gt({className:e,...t}){return(0,$.jsx)(n,{"data-slot":`tabs-content`,className:C(`flex-1 text-sm outline-none py-2`,e),...t})}export{ie as a,te as c,ht as i,gt as n,re as o,mt as r,ne as s,ft as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./tags-DAJ-rQYR.js";export{e as TagsPage};
|