@miravo/cli-linux-arm64-musl 0.8.1 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/console-dist/assets/api-0DOQsu1W.js +1 -0
- package/console-dist/assets/api-DdyA1QMC.js +1 -0
- package/console-dist/assets/asset-detail-D-coMgED.js +1 -0
- package/console-dist/assets/{badge-i00PiRCo.js → badge-DuuEINVl.js} +1 -1
- package/console-dist/assets/catalog-Ca9rhNLN.js +1 -0
- package/console-dist/assets/catalog-CdbAE0Ki.js +1 -0
- package/console-dist/assets/catalog-source-CPFWtBJF.js +1 -0
- package/console-dist/assets/catalog-template-icons-aec8m5-A.js +1 -0
- package/console-dist/assets/{checkbox-C84IyqEB.js → checkbox-BL44aFel.js} +1 -1
- package/console-dist/assets/{combobox-BJecIYHE.js → combobox-B5iFVe7N.js} +1 -1
- package/console-dist/assets/control-CtvncuAA.js +1 -0
- package/console-dist/assets/control-DYdEZmP0.js +1 -0
- package/console-dist/assets/{copy-button-DnGsXbVV.js → copy-button-RVCJ3aqM.js} +1 -1
- package/console-dist/assets/events-Bp3BqWYo.js +1 -0
- package/console-dist/assets/events-D5uZ2cwr.js +1 -0
- package/console-dist/assets/fleet-CBXZ0Xts.js +1 -0
- package/console-dist/assets/fleet-CRB8-QDg.js +1 -0
- package/console-dist/assets/{format-B9CcV2dj.js → format-6q8Tnwmn.js} +1 -1
- package/console-dist/assets/{get-error-message-CFs0lSQP.js → get-error-message-BowDodwy.js} +1 -1
- package/console-dist/assets/index-BPmjm3uU.css +2 -0
- package/console-dist/assets/index-Chh5Cd8X.js +12 -0
- package/console-dist/assets/integrations-BrZWbG5Q.js +1 -0
- package/console-dist/assets/integrations-D4x6ee5M.js +1 -0
- package/console-dist/assets/{login-CtfweHfy.js → login-O9dnrHI9.js} +2 -2
- package/console-dist/assets/models-BDeOqKQk.js +1 -0
- package/console-dist/assets/models-CgWCVmnx.js +1 -0
- package/console-dist/assets/{query-fetch-error-2yqCNP9X.js → query-fetch-error-ytmF7SP9.js} +1 -1
- package/console-dist/assets/{select-CMOnuEoT.js → select-Cg2u0NQI.js} +1 -1
- package/console-dist/assets/{select-display-items-Bqb6Sbg6.js → select-display-items-BEVMAho-.js} +1 -1
- package/console-dist/assets/{spawn-protocol-scope-picker-DUXJ8giB.js → spawn-protocol-scope-picker-DDi-hZwj.js} +1 -1
- package/console-dist/assets/tabs-BJs5Kci7.js +1 -0
- package/console-dist/assets/tags-CcmWc8Xj.js +1 -0
- package/console-dist/assets/tags-DnyhyxDB.js +4 -0
- package/console-dist/assets/{transition-nav-link-CDSeWWsP.js → transition-nav-link-Crj9XTbK.js} +1 -1
- package/console-dist/assets/use-engine-command-mutation-OZ8_Roso.js +1 -0
- package/console-dist/assets/use-integration-stream-CFkuEB9r.js +2 -0
- package/console-dist/assets/use-transition-navigate-BBXUEW59.js +2 -0
- package/console-dist/assets/validation-BvXCKp12.js +1 -0
- package/console-dist/index.html +29 -29
- package/miravo +2 -2
- package/package.json +1 -1
- package/console-dist/assets/api-5BZroqlO.js +0 -1
- package/console-dist/assets/api-BwgmLQCC.js +0 -1
- package/console-dist/assets/catalog-B477tO5a.js +0 -1
- package/console-dist/assets/catalog-BRYmHbXV.js +0 -1
- package/console-dist/assets/catalog-source-DL6GXE84.js +0 -1
- package/console-dist/assets/catalog-template-icons-3S8RvUxD.js +0 -1
- package/console-dist/assets/control-Dc6xLiUf.js +0 -1
- package/console-dist/assets/control-HqgjVMLG.js +0 -1
- package/console-dist/assets/events-BvwhACji.js +0 -1
- package/console-dist/assets/events-przfMV9x.js +0 -1
- package/console-dist/assets/fleet-C2Ipwzu5.js +0 -1
- package/console-dist/assets/fleet-D3Y6h1O_.js +0 -1
- package/console-dist/assets/index-AfBFCD9D.js +0 -12
- package/console-dist/assets/index-DmjK3skd.css +0 -2
- package/console-dist/assets/instance-detail-CQ6RO9hI.js +0 -1
- package/console-dist/assets/models-C57soXUz.js +0 -1
- package/console-dist/assets/models-CX3jQBRk.js +0 -1
- package/console-dist/assets/platforms-DMUEIKyH.js +0 -1
- package/console-dist/assets/platforms-nMtu3Mg5.js +0 -1
- package/console-dist/assets/tabs-D64chVAn.js +0 -1
- package/console-dist/assets/tags-BbNGPS4O.js +0 -1
- package/console-dist/assets/tags-Cl6Nj2-E.js +0 -4
- package/console-dist/assets/use-engine-command-mutation-CIly3RgV.js +0 -1
- package/console-dist/assets/use-platform-stream-BBDJCrNY.js +0 -2
- package/console-dist/assets/use-transition-navigate-Bxh77tVE.js +0 -2
- package/console-dist/assets/validation-Bt4EQDja.js +0 -1
- /package/console-dist/assets/{platform-targets-BIQ1lKOg.js → integration-targets-ChYQ8POe.js} +0 -0
|
@@ -1 +0,0 @@
|
|
|
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{A as r,N as i,S as a,k as o,o as s,v as ee}from"./api-5BZroqlO.js";import{i as te,t as c}from"./query-fetch-error-2yqCNP9X.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-BBDJCrNY.js";import{l as E}from"./select-CMOnuEoT.js";import{i as D,n as O,r as k,t as A}from"./tabs-D64chVAn.js";import{r as ce}from"./checkbox-C84IyqEB.js";import{a as j,c as M,d as le,i as N,l as P,n as F,o as I,r as ue,s as L,t as R,u as z}from"./catalog-source-DL6GXE84.js";import{c as de,n as B,r as fe,s as V,t as pe}from"./use-engine-command-mutation-CIly3RgV.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-CFs0lSQP.js";import{t as _e}from"./spawn-protocol-scope-picker-DUXJ8giB.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`}]]),ve=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`}]]),ye=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`}]]),be=y(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),W=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`}]]),G=e(t(),1),K=n(),q=new Set([`fault_active`,`fault_count`,`active_fault_code`,`lifecycle_stage`,`health_state`,`availability_state`]);function J(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};q.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,K.jsx)(z,{className:`size-3`}),members:t,accentClass:`text-muted-foreground`}),n.length>0&&a.push({key:`commands`,label:`Commands`,icon:(0,K.jsx)(be,{className:`size-3`}),members:n,accentClass:`text-info`}),r.length>0&&a.push({key:`process`,label:`Process Tags`,icon:(0,K.jsx)(x,{className:`size-3`}),members:r,accentClass:`text-primary`}),i.length>0&&a.push({key:`health`,label:`Health & Status`,icon:(0,K.jsx)(ye,{className:`size-3`}),members:i,accentClass:`text-success`}),a}function xe({modelName:e,onClose:t}){let[n,r]=(0,G.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,G.useEffect)(()=>{e&&r(new Set([`nameplate`,`process`]))},[e]);let ae=(0,G.useMemo)(()=>o?J(o.members):[],[o]),d=(0,G.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,K.jsx)(j,{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,K.jsx)(I,{side:`right`,showCloseButton:!p,className:`flex w-full flex-col gap-4 touch-manipulation`,children:u?null:ne&&!o?(0,K.jsx)(`div`,{className:`flex flex-1 flex-col justify-center px-2`,children:(0,K.jsx)(c,{message:re,onRetry:()=>void i.refetch(),isRetrying:i.isFetching})}):o?(0,K.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,K.jsxs)(M,{className:`gap-1 pb-0 pe-12`,children:[(0,K.jsx)(P,{className:`font-heading text-base uppercase tracking-wide`,children:_(o.name)}),o.description&&(0,K.jsx)(L,{className:`text-xs leading-relaxed text-foreground/88`,children:o.description}),(0,K.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,K.jsxs)(H,{variant:`outline`,className:`font-mono text-xs`,children:[m,` members`]}),(0,K.jsxs)(H,{variant:`outline`,className:`font-mono text-xs`,children:[h,` methods`]}),(0,K.jsxs)(H,{variant:`outline`,className:`font-mono text-xs`,children:[o.faults.length,` faults`]}),o.lifecycle&&(0,K.jsxs)(H,{variant:`outline`,className:`font-mono text-xs text-primary`,children:[o.lifecycle.stages.length,`-stage lifecycle`]}),(0,K.jsx)(w,{stream:f})]})]}),(0,K.jsxs)(A,{defaultValue:`overview`,className:`flex min-h-0 flex-1 flex-col gap-1 pt-0`,children:[(0,K.jsxs)(k,{variant:`line`,className:`h-8! shrink-0 gap-0.5 border-b-border/60 px-2 py-0.5`,children:[(0,K.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,K.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,K.jsx)(O,{value:`overview`,keepMounted:!0,className:`flex min-h-0 flex-1 flex-col`,children:(0,K.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col px-3 pt-0`,children:(0,K.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto pr-2`,children:(0,K.jsxs)(`div`,{className:`flex flex-col gap-1.5 pb-1 pt-0.5`,children:[ae.map(e=>(0,K.jsx)(Y,{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,K.jsx)(`div`,{className:`flex flex-col gap-1`,children:e.members.map(e=>(0,K.jsx)(X,{member:e},e.name))})},e.key)),o.faults.length>0&&(0,K.jsx)(Y,{sectionKey:`faults`,label:`Faults`,count:o.faults.length,icon:(0,K.jsx)(me,{className:`size-3`}),accentClass:`text-warning`,expanded:n.has(`faults`),onToggle:d,children:(0,K.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:o.faults.map(e=>(0,K.jsx)(H,{variant:`secondary`,className:`text-[10px] text-warning`,children:g(e)},e))})}),o.lifecycle&&(0,K.jsx)(Y,{sectionKey:`lifecycle`,label:`Lifecycle`,count:o.lifecycle.stages.length,icon:(0,K.jsx)(ve,{className:`size-3`}),accentClass:`text-primary`,expanded:n.has(`lifecycle`),onToggle:d,children:(0,K.jsx)(Q,{lifecycle:o.lifecycle})}),h>0&&(0,K.jsx)(Y,{sectionKey:`methods`,label:`Methods`,count:h,icon:(0,K.jsx)(W,{className:`size-3`}),accentClass:`text-info`,expanded:n.has(`methods`),onToggle:d,children:(0,K.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:Object.entries(o.methods).map(([e,t])=>(0,K.jsx)(Se,{name:e,method:t},e))})})]})})})}),(0,K.jsx)(O,{value:`deploy`,keepMounted:!0,className:`flex min-h-0 flex-1 flex-col`,children:(0,K.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col px-3 pt-0`,children:(0,K.jsx)(N,{kind:`model`,id:o.name,displayName:_(o.name),yamlPath:`/catalog/models/${o.name}/yaml`,yamlFilename:`${o.name}.twin.yaml`,stream:f})})})]})]},o.name):(0,K.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-sm text-muted-foreground`,children:`Model not found`})})})}function Y({sectionKey:e,label:t,count:n,icon:r,accentClass:i,expanded:a,onToggle:o,children:s}){return(0,K.jsxs)(`div`,{className:`rounded-[var(--miravo-radius-tight)] border border-border/50`,children:[(0,K.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,K.jsx)(`span`,{className:i,children:r}),(0,K.jsx)(`span`,{className:`uppercase tracking-wider`,children:t}),(0,K.jsx)(H,{variant:`secondary`,className:`ml-auto text-[10px]`,children:n}),(0,K.jsx)(E,{className:`size-3 text-muted-foreground transition-transform ${a?`rotate-180`:``}`})]}),(0,K.jsx)(u,{initial:!1,children:a&&(0,K.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,K.jsx)(`div`,{className:`border-t px-2.5 py-1.5`,children:s})},`content`)})]})}function X({member:e}){return(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-0.5 py-0.5 text-xs`,children:[(0,K.jsx)(`span`,{title:e.name,className:`min-w-0 truncate font-mono text-foreground`,children:oe(e.name)}),(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:e.dataType}),e.unit&&(0,K.jsx)(H,{variant:`outline`,className:`px-1 py-0 text-[10px]`,children:e.unit}),e.euRange&&(0,K.jsxs)(`span`,{className:`ml-auto font-mono text-xs text-muted-foreground`,children:[`[`,e.euRange[0],`–`,e.euRange[1],`]`]})]})}var Z={healthy:`bg-success`,normal:`bg-success`,degraded:`bg-warning`,critical:`bg-destructive`,failed:`bg-destructive`};function Q({lifecycle:e}){let t=e.stages.length;return(0,K.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,K.jsx)(`div`,{className:`flex h-2.5 w-full overflow-hidden rounded-full bg-muted`,children:e.stages.map((e,n)=>(0,K.jsx)(`div`,{className:`transition-[background-color] ${Z[e]??`bg-chart-1`} ${n===0?`rounded-l-full`:``} ${n===t-1?`rounded-r-full`:``}`,style:{width:`${100/t}%`}},`${e}-${n}`))}),(0,K.jsx)(`div`,{className:`flex items-center gap-3`,children:e.stages.map((e,t)=>(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs`,children:[(0,K.jsx)(`span`,{className:`size-2 rounded-full ${Z[e]??`bg-chart-1`}`}),(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:g(e)})]},`${e}-${t}`))}),(0,K.jsxs)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:[`~`,v(e.totalHours),` total hours`]})]})}function Se({name:e,method:t}){return(0,K.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`font-mono text-xs text-foreground`,children:e}),t.inputArguments.length>0&&(0,K.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`(`,t.inputArguments.map(e=>`${e.name}: ${e.dataType}`).join(`, `),`)`]})]}),t.description&&(0,K.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t.description})]})}var Ce=[`builtin`,`personal`];function we(){let[e,t]=(0,G.useState)(``),[n,ie]=(0,G.useState)(`all`),[g,oe]=(0,G.useState)({}),[v,y]=(0,G.useState)(null),[x,S]=(0,G.useState)(null),[C,w]=(0,G.useState)(``),[T,E]=(0,G.useState)(``),[D,O]=(0,G.useState)([]),[k,A]=(0,G.useState)(null),[j,M]=(0,G.useState)(null),[le,N]=(0,G.useState)(null),P=(0,G.useRef)(null),F=pe();(0,G.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(),P.current?.focus())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let I=te({queryKey:ee.catalog.models(),queryFn:()=>s(`/catalog/models`,a.catalogModels)}),L=I.data??[],R=I.isPending&&!I.data,z=I.isError&&!I.data,de=I.isError&&!!I.data,B=ge(I.error,`Failed to load models.`),V=e=>g[e]??1,me=(0,G.useCallback)((e,t)=>{oe(n=>({...n,[e]:Math.max(1,Math.min(10,t))}))},[]),U=(0,G.useCallback)(e=>{N(e)},[]),ve=(0,G.useCallback)(e=>{S(e),w(``),E(``),O([]),A(null),M(null)},[]),ye=async e=>{let t=i(C),n=i(T);if(t||n)return A(t),M(n),!1;let r=V(e),a=C.trim(),o=T.trim();y(e);try{return await F.mutateAsync({type:`spawn`,model:e,count:r,...a?{instanceName:a}:{},...o?{instancePrefix:o}:{},...D.length>0?{protocolScope:D}:{}}),!0}catch{return!1}finally{y(null)}},be=(0,G.useMemo)(()=>{let e={all:L.length};for(let t of Ce)e[t]=0;for(let t of L){let n=ue(t.source);e[n]=(e[n]??0)+1}return e},[L]),W=e.toLowerCase(),q=L.filter(e=>n===`all`||ue(e.source)===n).filter(e=>W?e.name.toLowerCase().includes(W)||(e.description?.toLowerCase().includes(W)??!1):!0),J=x,Y=J?V(J):1,X=J?r(J):``,Z=T.trim()||X,Q=C.trim()||(Z?o(Z,1):``);return(0,K.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,K.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,K.jsx)(`h1`,{className:`font-heading text-2xl font-semibold tracking-tight`,children:`Asset Model Library`}),(0,K.jsx)(H,{variant:`outline`,className:`text-xs`,children:z?(0,K.jsx)(`span`,{className:`text-destructive`,children:`Unavailable`}):R&&L.length===0?(0,K.jsx)(K.Fragment,{children:`Loading...`}):(0,K.jsxs)(K.Fragment,{children:[L.length,` models`]})})]}),(0,K.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.`})]}),z&&(0,K.jsx)(c,{message:B,onRetry:()=>void I.refetch(),isRetrying:I.isFetching}),de&&(0,K.jsx)(c,{message:`${B} Showing cached models.`,onRetry:()=>void I.refetch(),isRetrying:I.isFetching}),!z&&(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,K.jsxs)(`div`,{className:`relative max-w-xs flex-1 min-w-[14rem]`,children:[(0,K.jsx)(se,{className:`absolute left-2.5 top-2.5 size-4 text-muted-foreground`}),(0,K.jsx)(h,{ref:P,placeholder:`Filter models...`,value:e,onChange:e=>t(e.target.value),className:`pl-9 pr-7`}),!e&&(0,K.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,K.jsx)(Ee,{value:n,counts:be,onChange:ie})]}),(0,K.jsx)(`div`,{className:`grid grid-cols-1 gap-4 @[720px]/models:grid-cols-2 @[1120px]/models:grid-cols-3`,"aria-busy":R&&!z,children:z?null:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(u,{children:q.map((e,t)=>(0,K.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,K.jsx)(Te,{model:e,count:V(e.name),spawning:v===e.name,onCountChange:me,onInspect:U,onSpawn:ve})},e.name))}),q.length===0&&L.length>0&&(0,K.jsx)(`p`,{className:`col-span-full py-8 text-center text-sm text-muted-foreground`,children:`No models match the current filters.`})]})}),L.length>0&&(0,K.jsx)(`div`,{className:b(fe,`p-0`),children:(0,K.jsx)(`div`,{className:`community-teaser relative overflow-hidden rounded-[inherit]`,children:(0,K.jsx)(`div`,{className:`relative z-10 mx-auto max-w-3xl px-5 py-10 sm:px-10 sm:py-12`,children:(0,K.jsxs)(`div`,{className:`grid items-center gap-10 lg:grid-cols-[minmax(0,1fr)_minmax(0,17rem)]`,children:[(0,K.jsxs)(`div`,{className:`order-2 flex min-w-0 flex-col gap-4 lg:order-1`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-3 gap-y-1`,children:[(0,K.jsx)(`p`,{className:`blueprint-title text-primary`,children:`Future channel`}),(0,K.jsx)(`span`,{className:`blueprint-stat text-[10px] text-muted-foreground`,children:`MIRAVO_REGISTRY · NOT_CONNECTED`})]}),(0,K.jsx)(`h2`,{className:`font-heading text-xl font-semibold tracking-tight sm:text-2xl`,children:`Community Models`}),(0,K.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,K.jsx)(`div`,{children:(0,K.jsx)(H,{variant:`outline`,className:`community-teaser-soon border-primary/35 bg-primary/5 text-[10px] text-primary`,children:`Coming Soon`})})]}),(0,K.jsx)(`div`,{className:`order-1 flex justify-center lg:order-2 lg:justify-end`,children:(0,K.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,K.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,K.jsx)(ce,{className:`size-9 text-primary`,"aria-hidden":!0})}),(0,K.jsx)(`span`,{className:`blueprint-stat relative z-[1] text-[9px] tracking-[0.18em] text-muted-foreground`,children:`AWAITING SIGNAL`}),(0,K.jsx)(`span`,{className:`blueprint-stat relative z-[1] text-[9px] text-muted-foreground`,children:`Uplink idle`})]})})]})})})}),(0,K.jsx)(ae,{open:x!==null,onOpenChange:e=>{e||S(null)},children:(0,K.jsxs)(f,{className:`min-w-0 sm:max-w-md`,children:[(0,K.jsxs)(d,{children:[(0,K.jsx)(p,{children:`Spawn instances?`}),(0,K.jsx)(re,{children:x!==null&&(0,K.jsxs)(K.Fragment,{children:[`This spawns `,V(x),` instance`,V(x)===1?``:`s`,` of`,` `,(0,K.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,K.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,K.jsx)(he,{htmlFor:`spawn-instance-name`,className:`text-xs font-medium text-foreground`,children:`Exact instance ID`}),(0,K.jsx)(h,{id:`spawn-instance-name`,value:C,maxLength:120,onChange:e=>{let t=e.target.value;w(t),t&&(E(``),M(null)),A(i(t))},placeholder:Y===1?Q||`pump-001`:`Count must be 1`,disabled:Y!==1,className:b(`min-w-0 font-mono text-xs`,k&&`border-destructive`),"aria-invalid":k!=null,"aria-describedby":`spawn-instance-name-hint`}),(0,K.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.`}),k?(0,K.jsx)(`p`,{className:`text-[11px] text-destructive`,children:k}):null]}),(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,K.jsx)(he,{htmlFor:`spawn-instance-prefix`,className:`text-xs font-medium text-foreground`,children:`Generated prefix`}),(0,K.jsx)(h,{id:`spawn-instance-prefix`,value:T,maxLength:120,onChange:e=>{let t=e.target.value;E(t),t&&(w(``),A(null)),M(i(t))},placeholder:X||`pump`,className:b(`min-w-0 font-mono text-xs`,j&&`border-destructive`),"aria-invalid":j!=null,"aria-describedby":`spawn-instance-prefix-hint`}),(0,K.jsxs)(`p`,{id:`spawn-instance-prefix-hint`,className:`min-w-0 wrap-break-word text-[11px] text-muted-foreground`,children:[`Preview`,` `,(0,K.jsx)(`span`,{className:`break-all font-mono text-foreground`,children:Q||`${X}-001`})]}),j?(0,K.jsx)(`p`,{className:`text-[11px] text-destructive`,children:j}):null]}),(0,K.jsx)(_e,{value:D,onChange:O})]}),(0,K.jsxs)(ne,{children:[(0,K.jsx)(m,{variant:`outline`,disabled:v!==null,onClick:()=>S(null),children:`Cancel`}),(0,K.jsx)(m,{disabled:v!==null||x===null||k!=null||j!=null,onClick:async()=>{x!==null&&await ye(x)&&S(null)},children:v===x?`Spawning...`:`Spawn`})]})]})}),(0,K.jsx)(xe,{modelName:le,onClose:()=>N(null)})]})}var Te=(0,G.memo)(function({model:e,count:t,spawning:n,onCountChange:r,onInspect:i,onSpawn:a}){return(0,K.jsxs)(`div`,{className:b(V,`flex flex-col gap-4 p-5`),children:[(0,K.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,K.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,K.jsx)(U,{className:`size-4`})}),(0,K.jsxs)(`div`,{className:`min-w-0 flex flex-col gap-0.5`,children:[(0,K.jsx)(`span`,{className:`font-heading text-sm font-semibold uppercase tracking-wide`,children:_(e.name)}),e.description&&(0,K.jsx)(`span`,{className:`line-clamp-2 text-xs leading-relaxed text-muted-foreground`,children:e.description})]})]}),(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 font-mono text-[11px] text-muted-foreground`,children:[(0,K.jsx)($,{label:`mbr`,value:e.memberCount}),(0,K.jsx)($,{label:`mth`,value:e.methodCount}),(0,K.jsx)($,{label:`flt`,value:e.faultCount}),e.hasLifecycle&&(0,K.jsxs)(`span`,{className:`flex items-center gap-1 text-primary`,children:[(0,K.jsx)(`span`,{className:`text-[10px]`,children:`◈`}),(0,K.jsxs)(`span`,{children:[e.lifecycleStageCount,`-stage`]})]}),(0,K.jsx)(H,{variant:`outline`,className:b(`ml-auto shrink-0 font-sans text-[10px] font-medium uppercase tracking-wide`,R(e.source)),children:F(e.source)})]}),(0,K.jsxs)(`div`,{className:`mt-auto flex items-center gap-2 border-t border-border/30 pt-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center rounded-[var(--miravo-radius-tight)] border bg-muted/30`,children:[(0,K.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,K.jsx)(le,{className:`size-3`})}),(0,K.jsx)(`span`,{className:`flex size-7 items-center justify-center border-x font-mono text-xs`,children:t}),(0,K.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,K.jsx)(S,{className:`size-3`})})]}),(0,K.jsxs)(m,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>i(e.name),className:B,children:[(0,K.jsx)(C,{className:`size-3.5`,"aria-hidden":!0}),`Inspect`]}),(0,K.jsxs)(m,{size:`sm`,className:`ml-auto`,disabled:n,onClick:()=>a(e.name),children:[(0,K.jsx)(de,{className:`mr-1 size-3`}),n?`...`:`Spawn`]})]})]})});function $({label:e,value:t}){return(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`span`,{className:`text-foreground`,children:t}),` `,(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:e})]})}function Ee({value:e,counts:t,onChange:n}){return(0,K.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5`,role:`radiogroup`,"aria-label":`Filter by source`,children:[{id:`all`,label:`All`},...Ce.map(e=>({id:e,label:F(e)}))].map(r=>{let i=e===r.id,a=t[r.id]??0,o=r.id!==`all`&&a===0;return(0,K.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,K.jsx)(`input`,{type:`radio`,name:`models-source-filter`,value:r.id,checked:i,disabled:o,onChange:()=>n(r.id),className:`sr-only`}),(0,K.jsx)(`span`,{children:r.label}),(0,K.jsx)(`span`,{className:`font-mono text-[10px] text-foreground`,children:a})]},r.id)})})}export{U as n,we as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./platforms-nMtu3Mg5.js";export{e as PlatformsPage};
|
|
@@ -1 +0,0 @@
|
|
|
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,ct as i,o as a,ot as o,st as s,v as c,y as l}from"./api-5BZroqlO.js";import{a as u,c as d,i as f,r as p,t as m}from"./query-fetch-error-2yqCNP9X.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-BBDJCrNY.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-D64chVAn.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-CFs0lSQP.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:i()})}getOptimisticResult(e){return e.behavior=i(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:c,isRefetchError:l}=r,u=n.fetchMeta?.fetchMore?.direction,d=c&&u===`forward`,f=i&&u===`forward`,p=c&&u===`backward`,m=i&&u===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:o(t,n.data),hasPreviousPage:s(t,n.data),isFetchNextPageError:d,isFetchingNextPage:f,isFetchPreviousPageError:p,isFetchingPreviousPage:m,isRefetchError:l&&!d&&!p,isRefetching:a&&!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};
|
|
@@ -1 +0,0 @@
|
|
|
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,D as o,G as s,H as c,J as l,K as u,Q as d,R as f,U as p,V as m,W as h,X as g,Y as _,Z as v,et as y,q as b,tt as x}from"./api-5BZroqlO.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`}]]);_({path:v().min(1),name:v().min(1),description:v().optional(),memberCount:l().int().nonnegative(),methodCount:l().int().nonnegative(),faultCount:l().int().nonnegative(),hasLifecycle:p(),lifecycleStageCount:l().int().nonnegative()}),_({path:v().min(1),id:v().min(1),name:v().min(1),description:v().optional(),areaCount:l().int().nonnegative(),twinAssignmentCount:l().int().nonnegative(),uniqueModelCount:l().int().nonnegative(),modelNames:c(v().min(1)),totalTwinCount:l().int().nonnegative()});var ae=_({severity:s([`error`,`warning`]),message:v(),fix:v()});_({valid:p(),templatePath:v(),issues:c(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=s(w);new Set(w);var oe=v().min(1).max(128).regex(/^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/),E=s([`Boolean`,`Int32`,`UInt16`,`UInt32`,`Double`,`Float`,`String`]);s([`variable`,`property`]);var D=s([`read`,`readwrite`,`write`]),O=s([`>`,`>=`,`<`,`<=`,`==`,`!=`]),k=`Must be 1-64 chars and contain only letters, numbers, underscores, or hyphens.`,se=h(`type`,[_({type:b(`threshold`),member:v().regex(f,k),operator:O,threshold:l().finite()}).strict(),_({type:b(`lifecycle-stage`)}).strict(),_({type:b(`health-state`)}).strict(),_({type:b(`fault-active`)}).strict(),_({type:b(`fault-count`)}).strict(),_({type:b(`active-fault-code`),fallback:v().default(``)}).strict(),_({type:b(`availability-state`),member:v().regex(f,k),operator:O.default(`>`),threshold:l().finite().default(0),running_state:v().default(`running`),stopped_state:v().default(`stopped`),faulted_state:v().default(`faulted`)}).strict()]),A=`Must be 1-64 chars and contain only letters, numbers, underscores, or hyphens.`,j=c(v().min(1)).min(1),ce=_({data_type:E,unit:T.optional(),description:v().optional(),enum_values:j.optional()}).strict(),le=a([_({member:v().regex(f,A),value:a([l(),v(),p()])}).strict(),_({member:v().regex(f,A),argument:v().regex(f,A)}).strict()]),ue=_({type:b(`set-members`),writes:c(le).min(1)}).strict(),de=a([_({parameter:v().regex(f,A),value:l().finite()}).strict(),_({parameter:v().regex(f,A),argument:v().regex(f,A)}).strict()]),fe=h(`type`,[ue,_({type:b(`set-parameters`),writes:c(de).min(1)}).strict(),_({type:b(`clear-faults`)}).strict()]),pe=_({description:v().optional(),input_arguments:g(v().regex(f,A),ce).optional(),output_arguments:g(v().regex(f,A),ce).optional(),runtime:fe.optional()}).strict(),me=g(v().regex(f,A),pe);function M(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function N(e){if(typeof e==`string`)return m.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:x.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:x.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:x.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=c(h(`type`,[_({type:b(`white_noise`),strength:l().min(0).max(1),scale:l().positive().optional()}).strict(),_({type:b(`drift`),tau:l().positive(),sigma:l().min(0).max(1),scale:l().positive().optional()}).strict(),_({type:b(`outlier`),probability:l().min(0).max(1),magnitude:l().positive(),scale:l().positive().optional()}).strict(),_({type:b(`gap`),probability:l().min(0).max(1),duration:l().int().positive().default(10)}).strict(),_({type:b(`noise_burst`),probability:l().min(0).max(1),duration:l().int().positive().default(5),strength:l().min(0).max(1),scale:l().positive().optional()}).strict()])).min(1).optional(),V=`Must be 1-64 chars and contain only letters, numbers, underscores, or hyphens.`;s([`float`,`int`,`string`,`bool`]);var Ce=h(`type`,[_({type:b(`float`),default:l().finite(),min:l().finite().optional(),max:l().finite().optional(),unit:T.optional()}),_({type:b(`int`),default:l().int().safe(),min:l().int().safe().optional(),max:l().int().safe().optional(),unit:T.optional()}),_({type:b(`string`),default:v(),unit:T.optional()}),_({type:b(`bool`),default:p(),unit:T.optional()})]),H=a([_({member:v()}).strict(),_({previous_member:v()}).strict(),_({param:v()}).strict(),_({generator:u(()=>Ge)}).strict()]),U=v().regex(m,`Must be a $param.X parameter reference`),W=a([l(),U]),G=a([l().finite(),U]),K={initial_value:l().default(0),gain:W.default(1),bias:W.default(0),min:l().nullable().default(null),max:l().nullable().default(null),input:H},q=_({type:b(`sine`),center:W,amplitude:l().positive(),period:l().positive()}).strict(),we=_({type:b(`random-walk`),min:l(),max:l(),step:l().positive()}).strict(),Te=_({type:b(`noise`),center:W,stddev:l().positive()}).strict(),Ee=_({type:b(`step`),values:c(l()).min(1),interval:l().positive()}).strict(),De=_({type:b(`correlated`),source:v().regex(f,V),factor:G,offset:G,power:l().int().positive().optional()}).strict(),Oe=_({from:v(),to:v(),probability:l().min(0).max(1).optional(),on:v().optional()}).strict(),J=_({type:b(`state-machine`),states:c(v()).min(1),initial:v(),transitions:c(Oe).min(1)}).strict();function Y(e,t){let n=new Set(e.states);n.has(e.initial)||t.addIssue({code:x.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:x.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:x.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(`, `)}.`}))}}J.superRefine(Y);var ke=_({type:b(`ramp`),start_value:l().default(0),rate:l(),duration:l().nonnegative(),start_time:l().default(0),min:l().nullable().default(null),max:l().nullable().default(null)}).strict(),Ae=_({type:b(`mean-reverting-noise`),mean:W,tau:l().positive(),sigma:l().positive(),initial_value:l().optional(),min:l().nullable().default(null),max:l().nullable().default(null)}).strict(),je=_({time:l().nonnegative(),value:l()}),Me=_({type:b(`timetable`),points:c(je).min(2),repeat:p().default(!1),interpolation:s([`linear`,`step`]).default(`linear`)}).strict(),Ne=_({type:b(`waveform`),shape:s([`sawtooth`,`triangle`,`square`,`pulse`]),center:W,amplitude:l().positive(),period:l().positive(),duty_cycle:l().min(0).max(1).default(.5)}).strict(),Pe=_({type:b(`chirp`),center:W,amplitude:l().positive(),start_freq_hz:l().positive(),end_freq_hz:l().positive(),sweep_duration:l().positive(),sweep:s([`linear`,`exponential`]).default(`linear`),repeat:p().default(!0)}).strict(),X=_({type:b(`impulse`),baseline:l().default(0),amplitude:l(),probability:l().min(0).max(1).optional(),interval:l().positive().optional(),decay:l().min(0).max(1).optional(),duration:l().int().positive().default(1)}).strict();function Z(e,t){e.probability===void 0&&e.interval===void 0&&t.addIssue({code:x.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:x.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.`})}X.superRefine(Z);var Fe=_({type:b(`first-order-lag`),tau:l().positive(),...K}).strict(),Ie=_({type:b(`integrator`),initial_value:l().default(0),gain:l().default(1),bias_rate:l().default(0),min:l().default(-1/0),max:l().default(1/0),wrap:p().default(!1),wrap_at:l().nullable().default(null),input:H}).strict(),Le=_({type:b(`transport-delay`),delay:a([l().nonnegative(),U]),initial_value:l().default(0),interpolation:s([`linear`,`zoh`]).default(`linear`),input:H}).strict(),Re=_({type:b(`slew-rate-limiter`),rate_up:l().positive(),rate_down:l().positive().optional(),initial_value:l().default(0),min:l().nullable().default(null),max:l().nullable().default(null),input:H}).strict(),ze=_({type:b(`second-order`),natural_freq_hz:l().positive(),damping_ratio:l().positive(),initial_velocity:l().default(0),...K}).strict(),Be=_({type:b(`hysteresis-relay`),on_threshold:W,off_threshold:W,output_on:a([l(),v()]).default(1),output_off:a([l(),v()]).default(0),initial_state:s([`on`,`off`]).default(`off`),mode:s([`rising`,`falling`]).default(`rising`),input:H}).strict(),Ve=_({weight:W.default(1),input:H}),He=_({type:b(`weighted-sum`),bias:W.default(0),terms:c(Ve).min(1),min:l().nullable().default(null),max:l().nullable().default(null)}).strict(),Ue=_({type:b(`gate`),enabled_member:v().regex(f,V),input:H,disabled_value:a([l(),v(),p()])}).strict(),We=h(`type`,[q,we,Te,Ee,De,J,ke,Ae,Me,Ne,Pe,X]).superRefine((e,t)=>{e.type===`state-machine`&&Y(e,t),e.type===`impulse`&&Z(e,t)}),Ge=h(`type`,[q,we,Te,Ee,De,J,ke,Ae,Me,Ne,Pe,X,_({type:b(`health-dependent`),stages:g(v(),We)}).strict(),Fe,Ie,Le,Re,ze,Be,He,Ue]).superRefine((e,t)=>{e.type===`state-machine`&&Y(e,t),e.type===`impulse`&&Z(e,t)}),Ke=_({multiplier:l().finite().optional(),offset:l().finite().optional()}).strict(),qe=_({stages:c(_({name:v().min(1),duration_hours:d([l().nonnegative(),l().nonnegative()]).refine(([e,t])=>e<=t,{message:`duration_hours max must be greater than or equal to min.`}),effects:g(v(),Ke)})).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:x.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))}}),Je=_({multiplier:l().finite().optional(),offset:l().finite().optional(),spike:l().finite().optional(),duration_ticks:l().int().positive().optional(),onset_ticks:l().int().positive().optional(),recovery_ticks:l().int().positive().optional()}).strict(),Ye=_({condition:v().optional(),lifecycle_stage:v().optional(),probability:l().min(0).max(1)}),Xe=_({name:v().regex(f,V),trigger:Ye,effects:g(v(),a([Je,v()]))}),Ze=`Must be 1-64 chars and contain only letters, numbers, underscores, or hyphens.`,Qe=new Set([`enterprise`,`site`,`area`,`line`,`prefix`]),$e=v().regex(m,`Must be a $param.X parameter reference`),et=a([l(),v(),p()]),tt=_({name:v().regex(f,Ze),description:v().optional(),namespace:v().optional()}).strict(),nt=h(`kind`,[_({kind:b(`variable`),data_type:E,access:D,unit:T.optional(),enum_values:j.optional(),eu_range:d([l(),l()]).refine(([e,t])=>e<=t,{message:`eu_range[0] (min) must be <= eu_range[1] (max).`}).optional(),generator:Ge.optional(),binding:se.optional(),default:et.optional(),observation_effects:Se}).strict(),_({kind:b(`property`),data_type:E,access:D,unit:T.optional(),enum_values:j.optional(),default:a([et,$e]).optional()}).strict()]);function rt(e){return g(v().regex(f,Ze),nt).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=>Qe.has(e)),{message:`Member names cannot use reserved env keys: enterprise/site/area/line/prefix`})}function it(e={}){let t=rt(e.maxMembersPerModel??1e3);return _({schema_version:b(`2`),model:tt,parameters:g(v(),Ce).optional(),members:t,methods:me.optional(),lifecycle:qe.optional(),faults:c(Xe).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:x.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:x.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:x.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:x.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:x.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:x.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:x.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:x.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:x.custom,path:[`members`,s,`data_type`],message:`Members using binding.type "threshold" must use data_type "Boolean". Fix: change data_type to "Boolean".`}),at(s,c.binding.member,e,t,[`members`,s,`binding`,`member`]);break;case`availability-state`:c.data_type!==`String`&&t.addIssue({code:x.custom,path:[`members`,s,`data_type`],message:`Members using binding.type "availability-state" must use data_type "String". Fix: change data_type to "String".`}),at(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:x.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:x.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:x.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:x.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:x.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:x.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:x.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:x.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:x.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:x.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))Q(n,r.input_arguments,t,[`methods`,n,`input_arguments`]),Q(n,r.output_arguments,t,[`methods`,n,`output_arguments`]),ot(n,r,e,t,[`methods`,n,`runtime`])})}function at(e,t,n,r,i){let a=n.members[t];a&&(F(a.data_type)||r.addIssue({code:x.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 Q(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:x.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:x.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:x.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:x.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:x.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:x.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:x.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:x.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:x.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:x.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:x.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:x.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:x.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:x.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:x.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:x.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:x.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:}}it();var st=a([l().finite(),v(),p()]),ct=v().regex(/^[a-f0-9]{64}$/),lt=_({id:v().min(1),model:v().min(1),browsePath:c(v().min(1)).min(1),parameters:g(v(),st),lifecycleStage:v().min(1),operatingHours:l().finite().nonnegative(),activeFaults:c(v().min(1)),templateRunId:l().int().positive().optional(),protocolScope:c(o).min(1).optional(),observationState:g(v(),g(v(),y())).optional().default({}),faultState:g(v(),_({remaining:l().int(),elapsed:l().int(),recovering:p(),recoveryElapsed:l().int(),recoveryTicks:l().int()})).optional().default({})}),ut=_({templateRunId:l().int().positive(),templateName:v().min(1),templatePath:v(),entryHash:ct.optional()}),dt=_({name:v().min(1),enabled:p(),config:g(v(),y())});_({version:b(2),savedAt:v().min(1),environmentName:oe,models:c(v().min(1)),instances:c(lt),templateRuns:c(ut),adapters:c(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};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./tags-Cl6Nj2-E.js";export{e as TagsPage};
|
|
@@ -1,4 +0,0 @@
|
|
|
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,it as i,mt as a,o,v as s}from"./api-5BZroqlO.js";import{i as c,t as l}from"./query-fetch-error-2yqCNP9X.js";import{i as u,n as d,t as f}from"./dist-xY0pK9Wy.js";import{n as p}from"./chunk-OE4NN4TA-DBWZidbW.js";import{a as m,i as h,n as g,o as _,r as v,s as y,t as b}from"./copy-button-DnGsXbVV.js";import{C as x,S,T as C,b as ee,d as w,l as T,s as E,y as te}from"./format-B9CcV2dj.js";import{n as D,t as ne}from"./utils-XFKvwlFT.js";import{t as O}from"./arrow-up-down-C1oJAmrw.js";import{c as re,i as k,l as ie,n as A,s as j,t as M}from"./select-CMOnuEoT.js";import{a as ae,n as N,r as P}from"./platform-targets-BIQ1lKOg.js";import{t as oe}from"./download-DmUZKo9N.js";import{i as F,n as I,t as L}from"./tooltip-D1ydB4g3.js";import{n as se}from"./auth-screen-backdrop-CgwRhIbi.js";import{a as ce,i as le,n as ue,o as de,r as fe,s as pe,t as me}from"./dropdown-menu-82O7jPU6.js";import{t as R}from"./label-DTHSKF2S.js";import{n as he}from"./get-error-message-CFs0lSQP.js";import{a as z,i as B,n as V,o as ge,r as H,s as _e,t as ve}from"./combobox-BJecIYHE.js";import{a as ye,i as be,n as xe,o as Se,r as Ce,t as we}from"./vendor-table-BAHQgdwg.js";var Te=D(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),Ee=D(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),De=D(`braces`,[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]]),Oe=D(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),ke=D(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),Ae=D(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),je=D(`table-2`,[[`path`,{d:`M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18`,key:`gugj83`}]]),U=e(t(),1),W={mqtt:`MQTT Client`,opcua:`OPC UA Client Advanced`,modbus:`Modbus TCP`},G={Boolean:`bool`,Int32:`int32`,UInt16:`uint16`,UInt32:`uint32`,Float:`float32`,Double:`float64`,String:`string`},Me={float32:`float32`,int32:`int32`,uint32:`uint32`,uint16:`word`,boolean:`word`},Ne=`deviceId,deviceName,driverName,name,tagName,description,valueType,registerId,publishCoV,tagFormula,metaData,Retain,Qos,address,count,pollingInterval,endianness`;function K(e,t,n){let r=[Ne];for(let i of n){let n=W[i]??i;for(let a of e){let e=a.protocols[i];e&&r.push(q(i,{deviceName:t,driverName:n,memberName:a.member,browsePath:a.browsePath,dataType:a.dataType,protocolData:e,unit:a.unit,euRange:a.euRange,model:a.model,instance:a.instance,access:a.access}))}}return`${r.join(`
|
|
2
|
-
`)}\n`}function q(e,t){switch(e){case`mqtt`:return Pe(t);case`opcua`:return Fe(t);case`modbus`:return Ie(t);default:throw Error(`Unsupported LE export protocol: "${e}"`)}}function Pe(e){let t=typeof e.protocolData?.topic==`string`?e.protocolData.topic:`${e.browsePath}/${e.memberName}`;return[``,J(e.deviceName),J(e.driverName),J(t),J(e.memberName),``,`string`,``,`false`,``,Y(e),`Disable`,`0`,``,``,``,``].join(`,`)}function Fe(e){let t=typeof e.protocolData?.nodeId==`string`?e.protocolData.nodeId:`ns=1;s=${e.browsePath}/${e.memberName}`,n=G[e.dataType]??`string`;return[``,J(e.deviceName),J(e.driverName),J(t),J(e.memberName),``,n,``,`false`,``,Y(e),``,``,``,``,``,``].join(`,`)}function Ie(e){let t=Me[String(e.protocolData?.registerType??``)]??Le(e.dataType),n=e.protocolData?.address;return[``,J(e.deviceName),J(e.driverName),`H`,J(e.memberName),``,t,``,`false`,``,Y(e),``,``,typeof n==`number`?String(n):`0`,`1`,`1.0000000000`,`AB CD`].join(`,`)}function Le(e){switch(e){case`Double`:case`Float`:return`float32`;case`Int32`:return`int32`;case`UInt32`:return`uint32`;case`Boolean`:case`UInt16`:return`word`;default:return`float32`}}function J(e){return e.includes(`,`)||e.includes(`"`)||e.includes(`
|
|
3
|
-
`)?`"${e.replace(/"/g,`""`)}"`:e}function Y(e){let t={uns_path:e.browsePath?`${e.browsePath}/${e.memberName}`:e.memberName,model:e.model,instance:e.instance,access:e.access};return e.unit!=null&&(t.unit=e.unit),e.euRange!=null&&(t.eu_range_min=String(e.euRange[0]),t.eu_range_max=String(e.euRange[1])),J(JSON.stringify(t))}var X=n(),Re={mqtt:`MQTT`,opcua:`OPC UA`,modbus:`Modbus`},ze=[{id:P.id,label:P.label}];function Be({open:e,onOpenChange:t,tags:n,totalTags:r,enabledProtocols:i,selectedInstance:a}){let[o,s]=(0,U.useState)(`litmus-edge`),[c,l]=(0,U.useState)(``),[u,d]=(0,U.useState)(``),f=(0,U.useRef)(null),p=(0,U.useRef)(!1);(0,U.useEffect)(()=>{e&&!p.current&&(s(P.id),l(a??``),d(i[0]??``),setTimeout(()=>f.current?.focus(),80)),p.current=e},[e,i,a]);let b=c.trim()!==``&&u!==``,C=o===P.id?b:!1,ee=(0,U.useCallback)(()=>{if(o===P.id){let e=K(n,c.trim(),[u]),r=new Blob([e],{type:`text/csv`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`${c.trim()}-litmus-edge-tags.csv`,a.click(),URL.revokeObjectURL(i),t(!1)}},[o,c,n,u,t]),w=n.length<r,T=(0,U.useMemo)(()=>[...ze.map(e=>({value:e.id,label:e.label})),...N.map(e=>({value:e.id,label:e.label}))],[]),E=(0,U.useMemo)(()=>i.map(e=>({value:e,label:Re[e]??e.toUpperCase()})),[i]);return(0,X.jsx)(g,{open:e,onOpenChange:t,children:(0,X.jsxs)(v,{className:`sm:max-w-lg`,children:[(0,X.jsxs)(_,{children:[(0,X.jsx)(y,{children:`Export for Platform`}),(0,X.jsx)(h,{children:w?`Exporting ${n.length} of ${r} tags based on current table filters.`:`Exporting all ${n.length} tags. Use table filters to narrow scope.`})]}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-4 py-1`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsx)(R,{className:`text-sm`,children:`Platform`}),(0,X.jsxs)(M,{value:o,onValueChange:e=>e&&s(e),items:T,children:[(0,X.jsx)(j,{className:`w-full text-sm`,children:(0,X.jsx)(re,{placeholder:`Select platform`})}),(0,X.jsxs)(A,{children:[ze.map(e=>(0,X.jsx)(k,{value:e.id,children:e.label},e.id)),N.map(e=>(0,X.jsx)(k,{value:e.id,disabled:!0,children:e.label},e.id))]})]})]}),o===P.id&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsxs)(R,{htmlFor:`device-name`,className:`text-sm`,children:[`Device name `,(0,X.jsx)(`span`,{className:`text-destructive`,children:`*`})]}),(0,X.jsx)(S,{id:`device-name`,ref:f,placeholder:`e.g. DTW-FAB-PLC`,value:c,onChange:e=>l(e.target.value),onKeyDown:e=>e.key===`Enter`&&C&&ee(),className:`font-mono text-sm`})]}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsx)(R,{className:`text-sm`,children:`Protocol`}),(0,X.jsxs)(M,{value:u||void 0,onValueChange:e=>e&&d(e),items:E,children:[(0,X.jsx)(j,{className:`w-full text-sm`,children:(0,X.jsx)(re,{placeholder:`Select a protocol`})}),(0,X.jsx)(A,{children:i.map(e=>(0,X.jsx)(k,{value:e,children:Re[e]??e.toUpperCase()},e))})]})]})]})]}),(0,X.jsxs)(m,{children:[(0,X.jsx)(x,{variant:`outline`,size:`sm`,onClick:()=>t(!1),children:`Cancel`}),(0,X.jsxs)(x,{size:`sm`,className:`gap-1.5`,disabled:!C,onClick:ee,children:[(0,X.jsx)(oe,{className:`size-3.5`}),`Download CSV`]})]})]})})}var Ve=`border-border/70 bg-popover/98 font-body text-sm shadow-xl ring-1 ring-foreground/12 backdrop-blur-sm supports-backdrop-filter:bg-popover/90 p-1.5`,He=`px-2 pb-1 font-heading text-[9px] font-semibold tracking-[0.14em] text-muted-foreground uppercase`,Ue=`h-8 gap-1.5 border-border/80 bg-background/80 text-xs font-medium shadow-sm transition-colors hover:border-primary/35 hover:bg-accent/40`,We=`gap-2.5 rounded-[var(--miravo-radius-tight)] py-2 pl-2 pr-2 text-[13px] data-[highlighted]:bg-sidebar-accent data-[highlighted]:text-sidebar-accent-foreground`;function Ge({protocol:e,instance:t,model:n,member:r,enabledProtocols:i,hasFilters:a,memberSearchRef:o,onProtocolChange:s,onInstanceChange:c,onModelChange:l,onMemberChange:u,onClearFilters:d,onInstanceSearch:f,onModelSearch:p,filteredInstanceOptions:m,filteredModelOptions:h}){let g=(0,U.useMemo)(()=>[{value:`all`,label:`All protocols`},...i.map(e=>({value:e,label:e.toUpperCase()}))],[i]);return(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsxs)(M,{value:e||`all`,onValueChange:e=>s(!e||e===`all`?``:e),items:g,children:[(0,X.jsx)(j,{className:`h-8 w-[140px]`,"aria-label":`Protocol filter`,children:(0,X.jsx)(re,{placeholder:`All protocols`})}),(0,X.jsxs)(A,{alignItemWithTrigger:!1,align:`start`,children:[(0,X.jsx)(k,{value:`all`,children:`All protocols`}),i.map(e=>(0,X.jsx)(k,{value:e,children:e.toUpperCase()},e))]})]}),(0,X.jsxs)(ve,{value:t?{value:t,label:E(t)}:null,onValueChange:e=>c(e?.value??``),isItemEqualToValue:(e,t)=>e?.value===t?.value,onInputValueChange:f,children:[(0,X.jsx)(H,{placeholder:`All instances`,className:`h-8 w-[200px]`,showClear:!!t}),(0,X.jsx)(V,{children:(0,X.jsxs)(z,{children:[m.map(([e,t])=>(0,X.jsxs)(B,{value:{value:e,label:E(e)},children:[(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:`${T(e)} (${e})`,children:E(e)}),(0,X.jsxs)(`span`,{className:`shrink-0 tabular-nums text-muted-foreground`,children:[`(`,t,`)`]})]},e)),m.length===0&&(0,X.jsx)(`p`,{className:`py-2 text-center text-xs text-muted-foreground`,children:`No instances found`})]})})]}),(0,X.jsxs)(ve,{value:n?{value:n,label:w(n)}:null,onValueChange:e=>l(e?.value??``),isItemEqualToValue:(e,t)=>e?.value===t?.value,onInputValueChange:p,children:[(0,X.jsx)(H,{placeholder:`All models`,className:`h-8 w-[200px]`,showClear:!!n}),(0,X.jsx)(V,{children:(0,X.jsxs)(z,{children:[h.map(([e,t])=>(0,X.jsxs)(B,{value:{value:e,label:w(e)},children:[(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:w(e)}),(0,X.jsxs)(`span`,{className:`shrink-0 tabular-nums text-muted-foreground`,children:[`(`,t,`)`]})]},e)),h.length===0&&(0,X.jsx)(`p`,{className:`py-2 text-center text-xs text-muted-foreground`,children:`No models found`})]})})]}),(0,X.jsxs)(`div`,{className:`relative`,children:[(0,X.jsx)(S,{ref:o,placeholder:`Search member…`,className:`h-8 w-[160px] pr-7`,value:r,onChange:e=>u(e.target.value)}),!r&&(0,X.jsx)(`kbd`,{className:`pointer-events-none absolute top-1/2 right-2 -translate-y-1/2 rounded-[var(--miravo-radius-tight)] border border-border bg-muted px-1 font-mono text-[10px] text-muted-foreground`,children:`/`})]}),a&&(0,X.jsxs)(x,{variant:`ghost`,size:`sm`,className:`h-8 gap-1 text-xs`,onClick:d,children:[(0,X.jsx)(C,{className:`size-3`}),`Clear`]})]})}function Z({sorted:e}){return e===`asc`?(0,X.jsx)(Ee,{className:`ml-1 inline size-3`}):e===`desc`?(0,X.jsx)(Te,{className:`ml-1 inline size-3`}):(0,X.jsx)(O,{className:`ml-1 inline size-3 opacity-30`})}function Q(e,t=1,n=2){let r=e.split(`/`);return r.length<=t+n+1?e:[...r.slice(0,t),`...`,...r.slice(-n)].join(`/`)}function $({label:e,value:t,collapsible:n}){let r=n?Q(t):t;return(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`p`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground`,children:e}),(0,X.jsx)(b,{value:t,label:`Copy ${e}`,tooltipSide:`top`,render:({icon:e})=>(0,X.jsxs)(`button`,{type:`button`,className:`mt-0.5 flex items-start gap-1 font-mono text-xs hover:text-foreground`,children:[n?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`break-all lg:hidden`,children:r}),(0,X.jsx)(`span`,{className:`hidden break-all lg:inline`,children:t})]}):(0,X.jsx)(`span`,{className:`break-all`,children:t}),(0,X.jsx)(`span`,{className:`mt-0.5 shrink-0 text-muted-foreground`,children:e})]})})]})}function Ke({tag:e,enabledProtocols:t}){let n=`${e.browsePath}/${e.member}`,r=e.protocols.opcua,i=e.protocols.modbus,a=e.access===`readwrite`?`rw`:e.access;return(0,X.jsxs)(`div`,{className:`flex flex-col gap-3 text-xs`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-x-10 gap-y-2.5`,children:[(0,X.jsx)($,{label:`Topic / UNS`,value:n,collapsible:!0}),t.includes(`opcua`)&&typeof r?.nodeId==`string`&&(0,X.jsx)($,{label:`OPC UA NodeId`,value:r.nodeId,collapsible:!0}),t.includes(`modbus`)&&i?.address!=null&&(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`p`,{className:`text-[10px] uppercase tracking-wider text-muted-foreground`,children:`Modbus`}),(0,X.jsxs)(`p`,{className:`mt-0.5 font-mono`,children:[`addr=`,String(i.address),` regs=`,String(i.count),` `,String(i.registerType)]})]})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 text-muted-foreground`,children:[(0,X.jsxs)(L,{children:[(0,X.jsx)(F,{className:`font-mono`,render:(0,X.jsx)(`span`,{}),children:e.dataType}),(0,X.jsx)(I,{side:`top`,children:`Data type`})]}),e.unit&&(0,X.jsxs)(L,{children:[(0,X.jsx)(F,{className:`font-mono`,render:(0,X.jsx)(`span`,{}),children:e.unit}),(0,X.jsx)(I,{side:`top`,children:`Unit`})]}),(0,X.jsxs)(L,{children:[(0,X.jsx)(F,{className:`font-mono`,render:(0,X.jsx)(`span`,{}),children:a}),(0,X.jsx)(I,{side:`top`,children:`Access: r / w / rw`})]}),e.euRange&&(0,X.jsxs)(L,{children:[(0,X.jsxs)(F,{className:`font-mono`,render:(0,X.jsx)(`span`,{}),children:[`[`,e.euRange[0],`, `,e.euRange[1],`]`]}),(0,X.jsx)(I,{side:`top`,children:`EU range (min, max)`})]}),(0,X.jsxs)(L,{children:[(0,X.jsxs)(F,{render:(0,X.jsx)(p,{to:`/instance/${e.instance}`,className:`inline-flex items-center gap-1 text-primary underline-offset-4 hover:underline`,"aria-label":`Open instance`}),children:[`View instance`,(0,X.jsx)(Ae,{className:`size-3`})]}),(0,X.jsx)(I,{side:`top`,children:`Open instance`})]})]})]})}var qe=[{id:`expand`,meta:{cellClass:`!pl-2 !pr-0 w-0`},header:()=>(0,X.jsx)(`span`,{className:`sr-only`,children:`Expand row`}),enableSorting:!1,cell:({row:e})=>(0,X.jsx)(`button`,{type:`button`,className:`inline-flex size-5 items-center justify-center rounded-[var(--miravo-radius-tight)] text-muted-foreground hover:text-foreground`,"aria-label":e.getIsExpanded()?`Collapse row`:`Expand row`,"aria-expanded":e.getIsExpanded(),onClick:t=>{t.stopPropagation(),e.toggleExpanded()},children:(0,X.jsx)(ie,{className:`size-3.5 transition-transform ${e.getIsExpanded()?`rotate-0`:`-rotate-90`}`})})},{accessorKey:`instance`,header:({column:e})=>(0,X.jsxs)(`button`,{type:`button`,className:`inline-flex items-center`,onClick:e.getToggleSortingHandler(),children:[`Instance`,(0,X.jsx)(Z,{sorted:e.getIsSorted()})]}),cell:({getValue:e})=>(0,X.jsx)(`span`,{className:`block max-w-[18rem] truncate font-mono text-xs`,title:e(),children:e()})},{accessorKey:`member`,header:({column:e})=>(0,X.jsxs)(`button`,{type:`button`,className:`inline-flex items-center`,onClick:e.getToggleSortingHandler(),children:[`Member`,(0,X.jsx)(Z,{sorted:e.getIsSorted()})]}),cell:({getValue:e})=>(0,X.jsx)(`span`,{className:`block max-w-[20rem] truncate font-mono text-xs`,title:e(),children:e()})},{accessorKey:`model`,header:({column:e})=>(0,X.jsxs)(`button`,{type:`button`,className:`inline-flex items-center`,onClick:e.getToggleSortingHandler(),children:[`Model`,(0,X.jsx)(Z,{sorted:e.getIsSorted()})]}),cell:({getValue:e})=>(0,X.jsx)(`span`,{className:`block max-w-[18rem] truncate text-xs`,title:e(),children:e()})},{accessorKey:`dataType`,meta:{hideClass:`hidden lg:table-cell`},header:({column:e})=>(0,X.jsxs)(`button`,{type:`button`,className:`inline-flex items-center`,onClick:e.getToggleSortingHandler(),children:[`Type`,(0,X.jsx)(Z,{sorted:e.getIsSorted()})]}),cell:({getValue:e})=>(0,X.jsx)(`span`,{className:`font-mono text-xs`,children:e()})},{accessorKey:`unit`,meta:{hideClass:`hidden lg:table-cell`},header:`Unit`,enableSorting:!1,cell:({getValue:e})=>(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e()??`—`})},{accessorKey:`access`,meta:{hideClass:`hidden lg:table-cell`},header:`Access`,enableSorting:!1,cell:({getValue:e})=>{let t=e();return(0,X.jsx)(`span`,{className:`font-mono text-xs`,children:t===`readwrite`?`rw`:t})}}];function Je(e,t){let n=new Blob([e],{type:`text/csv`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=t,i.click(),URL.revokeObjectURL(r)}var Ye=[10,15,25,50,100],Xe=15,Ze=100;function Qe(e){return Ye.includes(e)?e:Xe}function $e(e){return/[",\r\n]/.test(e)?`"${e.replaceAll(`"`,`""`)}"`:e}function et(){let[e,t]=(0,U.useState)(!1),n=(0,U.useRef)(null);(0,U.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(),n.current?.focus())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let[m,h]=u(`protocol`,d.withDefault(``)),[g,_]=u(`instance`,d.withDefault(``)),[v,y]=u(`model`,d.withDefault(``)),[b,S]=u(`member`,d.withDefault(``)),[C,w]=u(`perPage`,f.withDefault(Xe)),T=Qe(C),E=i(e=>e.instanceCount),D=c({queryKey:s.tags.manifest(E),queryFn:()=>o(`/manifest`,r.manifest),placeholderData:a}),O=D.data??null,N=D.isError,P=D.isPending&&!O&&!N,F=he(D.error,`Failed to fetch manifest.`),I=O?.tags??[],L=O?.summary?.enabledProtocols??[],R=(0,U.useDeferredValue)(b),z=(0,U.useMemo)(()=>I.filter(e=>e.kind===`variable`),[I]),B=(0,U.useMemo)(()=>{let e=new Map;for(let t of z)e.set(t.instance,(e.get(t.instance)??0)+1);return[...e.entries()].sort((e,t)=>e[0].localeCompare(t[0]))},[z]),V=(0,U.useMemo)(()=>{let e=new Map;for(let t of z)e.set(t.model,(e.get(t.model)??0)+1);return[...e.entries()].sort((e,t)=>e[0].localeCompare(t[0]))},[z]),H=(0,U.useMemo)(()=>{let e=R.trim().toLowerCase();if(!m&&!g&&!v&&!e)return z;let t=[];for(let n of z)m&&n.protocols[m]==null||g&&n.instance!==g||v&&n.model!==v||e&&!n.member.toLowerCase().includes(e)||t.push(n);return t},[z,m,g,v,R]),[ve,Te]=(0,U.useState)([]),[Ee,Ae]=(0,U.useState)({}),[W,G]=(0,U.useState)(0),Me=m!==``||g!==``||v!==``||b!==``,Ne=(0,U.useCallback)(()=>{h(``),_(``),y(``),S(``),G(0)},[h,_,y,S]),K=xe({data:H,columns:qe,getCoreRowModel:Ce(),getSortedRowModel:Se(),getExpandedRowModel:be(),getRowCanExpand:()=>!0,getPaginationRowModel:ye(),onSortingChange:Te,onExpandedChange:Ae,onPaginationChange:e=>{let t=typeof e==`function`?e({pageIndex:W,pageSize:T}):e;G(t.pageIndex),w(t.pageSize)},state:{sorting:ve,expanded:Ee,pagination:{pageIndex:W,pageSize:T}}}),q=Math.ceil(H.length/T);(0,U.useEffect)(()=>{C!==T&&w(T)},[T,C,w]),(0,U.useEffect)(()=>{q>0&&W>=q&&G(q-1)},[q,W]);let Pe=(0,U.useCallback)(e=>{G(0),w(e)},[w]),Fe=(0,U.useCallback)(e=>{G(0),h(e)},[h]),Ie=(0,U.useCallback)(e=>{G(0),_(e)},[_]),Le=(0,U.useCallback)(e=>{G(0),y(e)},[y]),J=(0,U.useCallback)(e=>{G(0),S(e)},[S]),[Y,Re]=(0,U.useState)(``),[ze,Z]=(0,U.useState)(``),Q=(0,U.useDeferredValue)(Y),$=(0,U.useDeferredValue)(ze),et=(0,U.useMemo)(()=>(Q?B.filter(([e])=>te(e,Q)):B).slice(0,Ze),[B,Q]),tt=(0,U.useMemo)(()=>($?V.filter(([e])=>ee(e,$)):V).slice(0,Ze),[V,$]),nt=K.getRowModel().rows,rt=nt.length,it=rt===0||H.length===0?0:W*T+1,at=rt===0||H.length===0?0:W*T+rt,ot=q,st=H.length===0||ot===0?0:W+1,ct=(0,U.useCallback)(()=>{let e=m?[m]:L,t=[`instance`,`member`,`model`,`dataType`,`unit`,`access`,`browsePath`,...e.includes(`mqtt`)?[`mqtt_topic`]:[],...e.includes(`opcua`)?[`opcua_nodeId`]:[],...e.includes(`modbus`)?[`modbus_address`,`modbus_count`,`modbus_encoding`]:[]],n=H.map(t=>{let n=t.protocols.mqtt,r=t.protocols.opcua,i=t.protocols.modbus;return[t.instance,t.member,t.model,t.dataType,t.unit??``,t.access,t.browsePath,...e.includes(`mqtt`)?[String(n?.topic??``)]:[],...e.includes(`opcua`)?[String(r?.nodeId??``)]:[],...e.includes(`modbus`)?[String(i?.address??``),String(i?.count??``),String(i?.registerType??``)]:[]]});Je([t.map($e).join(`,`),...n.map(e=>e.map($e).join(`,`))].join(`
|
|
4
|
-
`),`miravo-tags.csv`)},[H,m,L]);return N&&!O?(0,X.jsx)(se,{className:`min-h-full`,children:(0,X.jsx)(`div`,{className:`flex min-h-[40vh] flex-col items-center justify-center p-6 sm:p-12`,children:(0,X.jsx)(`div`,{className:`w-full max-w-md`,children:(0,X.jsx)(l,{message:F,onRetry:()=>void D.refetch(),isRetrying:D.isFetching})})})}):(0,X.jsxs)(`div`,{className:`mx-auto flex w-full max-w-screen-2xl flex-col gap-5 p-4 sm:gap-6 sm:p-6`,children:[N&&O?(0,X.jsx)(l,{message:`${F} Showing cached tags.`,onRetry:()=>void D.refetch(),isRetrying:D.isFetching}):null,(0,X.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,X.jsx)(`h1`,{className:`font-heading text-2xl font-semibold tracking-tight`,children:`Tag Explorer`}),(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:P?`Loading tag manifest...`:`${O?.summary?.totalInstances??0} instances · ${L.length} protocols`})]}),(0,X.jsxs)(me,{children:[(0,X.jsxs)(pe,{render:(0,X.jsx)(x,{variant:`outline`,size:`sm`,className:ne(Ue,`px-3`)}),children:[(0,X.jsx)(oe,{className:`size-3.5 opacity-90`,"aria-hidden":!0}),`Export`,(0,X.jsx)(ie,{className:`size-3 opacity-60`,"aria-hidden":!0})]}),(0,X.jsx)(ue,{align:`end`,sideOffset:6,className:ne(`min-w-[13.5rem]`,Ve),children:(0,X.jsxs)(fe,{children:[(0,X.jsx)(ce,{className:He,children:`Export`}),(0,X.jsx)(de,{className:`bg-border/60`}),(0,X.jsxs)(le,{onClick:ct,className:We,children:[(0,X.jsx)(je,{className:`size-3.5 shrink-0 text-primary`,"aria-hidden":!0}),`Download CSV`]}),(0,X.jsxs)(le,{onClick:()=>t(!0),className:We,children:[(0,X.jsx)(De,{className:`size-3.5 shrink-0 text-primary`,"aria-hidden":!0}),`Export for Platform…`]})]})})]})]}),(0,X.jsx)(Ge,{protocol:m,instance:g,model:v,member:b,enabledProtocols:L,hasFilters:Me,memberSearchRef:n,onProtocolChange:Fe,onInstanceChange:Ie,onModelChange:Le,onMemberChange:J,onClearFilters:Ne,onInstanceSearch:Re,onModelSearch:Z,filteredInstanceOptions:et,filteredModelOptions:tt}),H.length!==z.length&&z.length>0&&(0,X.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Showing`,` `,(0,X.jsx)(`span`,{className:`font-medium tabular-nums text-foreground`,children:H.length}),` of`,` `,(0,X.jsx)(`span`,{className:`tabular-nums`,children:z.length}),` tags`]}),(0,X.jsx)(ge,{className:`min-w-0 py-0`,children:(0,X.jsx)(_e,{className:`p-0`,children:(0,X.jsx)(`div`,{className:`min-w-0 overflow-auto`,children:(0,X.jsxs)(`table`,{className:`w-full caption-bottom text-sm`,children:[(0,X.jsx)(`thead`,{className:`sticky top-0 z-10 border-b bg-background [&_tr]:border-b`,children:K.getHeaderGroups().map(e=>(0,X.jsx)(`tr`,{className:`border-b transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground`,children:e.headers.map(e=>{let t=e.column.columnDef.meta;return(0,X.jsx)(`th`,{className:`h-10 whitespace-nowrap px-1.5 text-left text-xs font-medium text-muted-foreground sm:px-4 ${t?.hideClass??``} ${t?.cellClass??``}`,children:e.isPlaceholder?null:we(e.column.columnDef.header,e.getContext())},e.id)})},e.id))}),(0,X.jsx)(`tbody`,{className:`[&_tr:last-child]:border-0`,children:P?null:nt.length>0?nt.map(e=>{let t=e.getIsExpanded(),n=e.getVisibleCells();return(0,X.jsxs)(U.Fragment,{children:[(0,X.jsx)(`tr`,{"aria-expanded":t,tabIndex:0,className:`cursor-pointer border-b transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:bg-sidebar-accent focus-visible:outline-none`,onClick:()=>e.toggleExpanded(),onKeyDown:t=>{t.key!==`Enter`&&t.key!==` `||(t.preventDefault(),e.toggleExpanded())},children:n.map(e=>{let t=e.column.columnDef.meta;return(0,X.jsx)(`td`,{className:`whitespace-nowrap px-1.5 py-1.5 text-left sm:px-4 ${t?.hideClass??``} ${t?.cellClass??``}`,children:we(e.column.columnDef.cell,e.getContext())},e.id)})}),t&&(0,X.jsx)(`tr`,{children:(0,X.jsx)(`td`,{colSpan:n.length,className:`p-0`,children:(0,X.jsx)(`div`,{className:`border-b`,children:(0,X.jsx)(`div`,{className:`px-1.5 py-3 pl-6 sm:px-4 sm:pl-10`,children:(0,X.jsx)(Ke,{tag:e.original,enabledProtocols:L})})})})})]},e.id)}):(0,X.jsx)(`tr`,{children:(0,X.jsx)(`td`,{colSpan:qe.length,className:`h-32 px-2 text-center sm:px-4`,children:z.length===0?(0,X.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[(0,X.jsx)(ke,{className:`size-8 text-muted-foreground`}),(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No tags available`}),(0,X.jsx)(p,{to:`/catalog`,className:`text-xs text-primary underline-offset-4 hover:underline`,children:`Start an environment from the Catalog to generate tags`})]}):(0,X.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`No matching tags.`,` `,(0,X.jsx)(`span`,{className:`text-xs`,children:`Try adjusting your filters.`})]})})})})]})})})}),(0,X.jsx)(`div`,{className:`px-3 py-2 text-xs text-muted-foreground`,children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between sm:gap-4`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3 sm:justify-start sm:gap-5`,children:[(0,X.jsxs)(`p`,{className:`min-w-0 leading-tight`,children:[(0,X.jsx)(`span`,{className:`font-medium tabular-nums text-foreground`,children:it===0?`0`:`${it}\u2013${at}`}),` `,(0,X.jsxs)(`span`,{className:`text-muted-foreground`,children:[`of `,H.length,` tags`]})]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 whitespace-nowrap`,children:[(0,X.jsxs)(M,{value:String(T),onValueChange:e=>e&&Pe(Number(e)),children:[(0,X.jsx)(j,{className:`h-8 w-[4.25rem]`,"aria-label":`Rows per page`,children:(0,X.jsx)(re,{})}),(0,X.jsx)(A,{children:Ye.map(e=>(0,X.jsx)(k,{value:String(e),children:e},e))})]}),(0,X.jsx)(`span`,{className:`hidden text-muted-foreground sm:inline`,children:`per page`})]})]}),(0,X.jsxs)(`nav`,{className:`flex items-center justify-center gap-2 border-border/60 border-t pt-2 sm:justify-end sm:border-0 sm:pt-0`,"aria-label":`Table pages`,children:[(0,X.jsx)(x,{variant:`outline`,size:`sm`,className:`h-8 w-8 shrink-0 p-0`,disabled:!K.getCanPreviousPage(),onClick:()=>K.previousPage(),"aria-label":`Previous page`,children:(0,X.jsx)(Oe,{className:`size-3.5`})}),(0,X.jsxs)(`span`,{className:`min-w-[5ch] text-center text-sm font-medium tabular-nums whitespace-nowrap text-foreground`,children:[st,` / `,ot]}),(0,X.jsx)(x,{variant:`outline`,size:`sm`,className:`h-8 w-8 shrink-0 p-0`,disabled:!K.getCanNextPage(),onClick:()=>K.nextPage(),"aria-label":`Next page`,children:(0,X.jsx)(ae,{className:`size-3.5`})})]})]})}),(0,X.jsx)(Be,{open:e,onOpenChange:t,tags:H,totalTags:I.length,enabledProtocols:L,selectedInstance:g||void 0})]})}export{et as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{C as n,c as r,d as i,it as a,n as o,y as s}from"./api-5BZroqlO.js";import{l as c}from"./copy-button-DnGsXbVV.js";import{n as l}from"./utils-XFKvwlFT.js";import{n as u,r as d,t as f}from"./runtime-link-D-uJbw97.js";var p=l(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),m=`group relative border border-solid border-border transition-colors hover:border-muted-foreground/25`,h=`group relative border border-solid border-border`,g=`blueprint-card ${m} overflow-hidden rounded-[var(--miravo-radius-stadium-sm)]`,_=`${h} w-full min-w-0 overflow-hidden rounded-[var(--miravo-radius-stadium-sm)] bg-transparent`,v=`${h} w-full min-w-0 overflow-hidden rounded-[var(--miravo-radius-stadium-sm)] bg-transparent`,y=`blueprint-card catalog-card-frame group relative border border-solid overflow-hidden rounded-[var(--miravo-radius-stadium-sm)]`,b=y,x=`border-border bg-muted/40 text-primary shadow-none hover:border-muted-foreground/30 hover:bg-muted/60 hover:text-primary focus-visible:border-ring border-border bg-muted/30 hover:border-muted-foreground/35 hover:bg-muted/45 [&_svg]:text-primary`,S=e(t(),1),C=new Set([`spawn`,`removeInstance`,`loadTemplate`,`unloadTemplateRun`,`resetEnvironment`,`enableAdapter`,`disableAdapter`]);function w(e){if(e instanceof f){c.error(`Command not sent`,{description:e.detail});return}if(e instanceof o){c.error(e.result.message,{description:e.result.error});return}if(n.is(e)){c.error(e.message,{description:e.hint});return}if(e instanceof TypeError){if(typeof navigator<`u`&&navigator.onLine===!1){c.error(`Command not sent`,{description:`This browser is offline — reconnect to the network and try again.`});return}let{connectionState:e}=a.getState(),t=d(e);if(t){c.error(`Command not sent`,{description:t});return}c.error(`Command failed`,{description:`Could not reach the Miravo server — it may have stopped or restarted.`});return}c.error(`Command failed`,{description:e instanceof Error?e.message:`Unknown error.`})}async function T(){try{let e=await r();s.setQueryData([`bootstrap`],e),e.authenticated?a.getState().replaceRuntime(e.runtime,{allowSameRevision:!0,allowRevisionRewind:!0}):a.getState().markUnauthenticated()}catch{}finally{s.invalidateQueries({queryKey:[`bootstrap`]})}}function E(){let[e,t]=(0,S.useState)(!1);return{mutate:(0,S.useCallback)(e=>{try{u(a.getState().connectionState)}catch(e){w(e);return}t(!0),i(e).then(t=>{if(c.success(t.message),C.has(e.type))return T()}).catch(w).finally(()=>{t(!1)})},[]),mutateAsync:(0,S.useCallback)(async e=>{try{u(a.getState().connectionState)}catch(e){throw w(e),e}t(!0);try{let t=await i(e);return c.success(t.message),C.has(e.type)&&await T(),t}catch(e){throw w(e),e}finally{t(!1)}},[]),isPending:e}}export{v as a,p as c,y as i,x as n,_ as o,g as r,b as s,E as t};
|
|
@@ -1,2 +0,0 @@
|
|
|
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{C as r,S as i,T as a,f as o,j as s,m as c,p as l,t as u,w as d}from"./api-5BZroqlO.js";import{t as f,u as p}from"./proxy-Be4WzmcS.js";import{t as m}from"./AnimatePresence-CPmH1DMY.js";import{a as h,i as g,l as _,n as v,o as ee,r as te,s as ne,t as y}from"./copy-button-DnGsXbVV.js";import{C as b,E as x,S,T as C}from"./format-B9CcV2dj.js";import{n as w,t as T}from"./utils-XFKvwlFT.js";import{a as E,c as re,i as D,l as ie,n as O,o as ae,r as oe,s as k,t as A}from"./select-CMOnuEoT.js";import{i as j,n as M,r as N,t as P}from"./platform-targets-BIQ1lKOg.js";import{a as se,c as F,o as I,s as L}from"./tabs-D64chVAn.js";import{t as ce}from"./circle-question-mark-CJvcT6V6.js";import{i as R,n as z,r as le,t as ue}from"./checkbox-C84IyqEB.js";import{t as B}from"./triangle-alert-BXrJNk3g.js";import{i as V,n as H,t as U}from"./tooltip-D1ydB4g3.js";import{t as W}from"./badge-i00PiRCo.js";import{t as G}from"./label-DTHSKF2S.js";import{n as de,t as fe}from"./get-error-message-CFs0lSQP.js";var pe=w(`ban`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}]]),K=w(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),me=w(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),he=w(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),ge=w(`clipboard-list`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`M12 11h4`,key:`1jrz19`}],[`path`,{d:`M12 16h4`,key:`n85exb`}],[`path`,{d:`M8 11h.01`,key:`1dfujw`}],[`path`,{d:`M8 16h.01`,key:`18s6g9`}]]),_e=w(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),ve=w(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),ye=w(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),be=w(`list-checks`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]),xe=w(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Se=w(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),Ce=w(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),q=e(t(),1),J=n();function Y({className:e,...t}){return(0,J.jsx)(`div`,{"data-slot":`skeleton`,className:T(`animate-pulse rounded-[var(--miravo-radius-tight)] bg-muted`,e),...t})}var we=[`devices`,`models`,`instances`],Te=[`instances`,`models`,`devices`],Ee={label:`Alias policy`,value:`Miravo hyphens, LE underscores`},De=[{label:`Protocol`,value:`Template defaults`},Ee],Oe={devices:`DeviceHub devices`,models:`Digital Twins models`,instances:`Digital Twins instances`},ke={devices:{apply:`DeviceHub device records and settings on Litmus Edge.`,cleanup:`Remove DeviceHub device records managed from Miravo.`},models:{apply:`Digital Twins model definitions synced to the platform.`,cleanup:`Remove Digital Twins model definitions created by Miravo.`},instances:{apply:`Digital Twins instances bound to DeviceHub devices.`,cleanup:`Remove Digital Twins instances deployed for this target.`}},Ae=`Miravo calls this API.`;function je(e){return e.length>120?`Use at most 120 characters.`:/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(e)?null:`Use lowercase letters, numbers, and hyphens only (e.g. motor-001).`}function Me(e){return e.length>120?`Use at most 120 characters.`:/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(e)?null:`Use lowercase letters, numbers, and hyphens only (e.g. env-a or line-1).`}function Ne(e){let t=e?.trim().toLowerCase();if(t)return s(t)}function Pe(e){return e.replace(/-/g,`_`)}function Fe({targetId:e,model:t,protocol:n,result:r}){return{targetId:e,model:t,protocol:n,scope:r.scope,deviceName:r.deviceName,ifUnmanaged:r.ifUnmanaged}}function Ie({targetId:e,template:t,result:n,protocol:r}){return{targetId:e,template:t,...r?{protocol:r}:{},scope:n.scope,namePrefix:n.namePrefix,ifUnmanaged:n.ifUnmanaged}}function Le({targetId:e,template:t,allManaged:n,result:r}){return{targetId:e,...n?{allManaged:!0}:{template:t},scope:r.scope}}var X=`Source host (Miravo)`,Re=`Address Litmus Edge uses to reach your running Miravo environment.`;function ze({open:e,onOpenChange:t,type:n,label:r,targetLabel:i,hostname:a,sourceHostname:o,onConfirm:s,defaultDeviceName:c,defaultNamePrefix:l,metadata:u=[],applyPreview:d,cleanupPreview:p}){let m=n===`apply`?we:Te,[_,ee]=(0,q.useState)(new Set(m)),[y,x]=(0,q.useState)(!1),[C,w]=(0,q.useState)(!1),[E,re]=(0,q.useState)(``),[D,O]=(0,q.useState)(null),[ae,oe]=(0,q.useState)(``),[k,A]=(0,q.useState)(null),[j,M]=(0,q.useState)(`fail`),N=(0,q.useId)(),P=(0,q.useId)(),se=(0,q.useId)(),F=`if-unmanaged-${se}`,I=n===`apply`,L=Ne(l),R=I&&c!==void 0&&c!==``,z=I&&!R&&L!==void 0,B=(E.trim()===``?c??``:E.trim().toLowerCase()).trim(),W=(ae.trim()===``?L??``:ae.trim().toLowerCase()).trim(),de=B?Pe(B):``;(0,q.useEffect)(()=>{e&&(ee(new Set(m)),x(!1),O(null),A(null),re(R?c??``:``),oe(z?L??``:``),M(`fail`),w(!1))},[e,m,R,c,z,L]);let fe={instances:`models`},pe=e=>{ee(t=>{let n=new Set(t);if(n.has(e)){n.delete(e);for(let[t,r]of Object.entries(fe))r===e&&n.delete(t)}else{n.add(e);let t=fe[e];t&&n.add(t)}return n})},K=I?d:p,me=()=>{let e=m.filter(e=>_.has(e));if(e.length===0)return null;if(R){let t=B,n=je(t);return n?(O(n),null):(O(null),A(null),{scope:e,deviceName:t,ifUnmanaged:j})}if(z){let t=W,n=Me(t);return n?(A(n),null):(A(null),{scope:e,namePrefix:t,ifUnmanaged:j})}return{scope:e,ifUnmanaged:j}},he=e=>{K?.onPreview(e),t(!1)};return(0,J.jsx)(v,{open:e,onOpenChange:t,children:(0,J.jsxs)(te,{showCloseButton:!0,className:`flex max-h-[90vh] min-h-0 flex-col gap-0 overflow-hidden p-0 sm:max-w-120`,children:[(0,J.jsxs)(`div`,{className:`shrink-0 border-b border-border/60 px-5 pb-3 pt-5`,children:[(0,J.jsxs)(ne,{className:`flex items-center gap-2 text-sm font-semibold leading-snug`,children:[I?(0,J.jsx)(le,{className:`size-3.5 shrink-0 text-primary`,"aria-hidden":!0}):(0,J.jsx)(Ce,{className:`size-3.5 shrink-0 text-destructive`,"aria-hidden":!0}),I?`Apply to Litmus Edge`:`Clean up Litmus Edge`]}),(0,J.jsx)(g,{className:`sr-only`,children:I?`Review connection details and scope before applying.`:`Review target and cleanup scope before confirming.`})]}),(0,J.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain px-5 pt-4 pb-3`,children:(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-5`,children:[(0,J.jsx)(`div`,{className:`text-xs leading-snug`,children:(0,J.jsxs)(`dl`,{className:`flex flex-col gap-0`,children:[(0,J.jsxs)(`div`,{className:`grid grid-cols-2 items-start gap-x-4 border-b border-border/35 py-2.5 first:pt-0`,children:[(0,J.jsx)(`dt`,{className:`min-w-0 pt-px text-[11px] font-medium text-muted-foreground`,children:I?`Resource`:`Target`}),(0,J.jsx)(`dd`,{className:`min-w-0 wrap-break-word font-medium text-foreground`,children:r})]}),(0,J.jsxs)(`div`,{className:`grid grid-cols-2 items-start gap-x-4 border-b border-border/35 py-2.5`,children:[(0,J.jsx)(`dt`,{className:`min-w-0 pt-px text-[11px] font-medium text-muted-foreground`,children:`Target`}),(0,J.jsx)(`dd`,{className:`min-w-0 wrap-break-word font-medium text-foreground`,children:i})]}),(0,J.jsxs)(`div`,{className:`grid grid-cols-2 items-start gap-x-4 border-b border-border/35 py-2.5`,children:[(0,J.jsx)(`dt`,{className:`min-w-0 pt-px`,children:(0,J.jsxs)(`span`,{className:`inline-flex max-w-full items-center gap-1`,children:[(0,J.jsx)(`span`,{className:`text-[11px] font-medium leading-snug text-muted-foreground`,children:`Litmus Edge API`}),(0,J.jsxs)(U,{children:[(0,J.jsx)(V,{type:`button`,className:`inline-flex size-5 shrink-0 items-center justify-center rounded-[var(--miravo-radius-tight)] text-muted-foreground hover:bg-muted hover:text-foreground`,"aria-label":`About Litmus Edge API`,children:(0,J.jsx)(ce,{className:`size-3`,"aria-hidden":!0})}),(0,J.jsx)(H,{side:`top`,align:`start`,className:`max-w-xs text-left`,children:Ae})]})]})}),(0,J.jsx)(`dd`,{className:`min-w-0`,children:(0,J.jsx)(`span`,{className:`break-all font-mono text-[11px] leading-normal text-foreground/90`,children:a})})]}),(0,J.jsxs)(`div`,{className:`grid grid-cols-2 items-start gap-x-4 border-b border-border/35 py-2.5`,children:[(0,J.jsx)(`dt`,{className:`min-w-0 pt-px`,children:(0,J.jsxs)(`span`,{className:`inline-flex max-w-full items-center gap-1`,children:[(0,J.jsx)(`span`,{className:`text-[11px] font-medium leading-snug text-muted-foreground`,children:X}),(0,J.jsxs)(U,{children:[(0,J.jsx)(V,{type:`button`,className:`inline-flex size-5 shrink-0 items-center justify-center rounded-[var(--miravo-radius-tight)] text-muted-foreground hover:bg-muted hover:text-foreground`,"aria-label":`About ${X}`,children:(0,J.jsx)(ce,{className:`size-3`,"aria-hidden":!0})}),(0,J.jsx)(H,{side:`top`,align:`start`,className:`max-w-xs text-left`,children:Re})]})]})}),(0,J.jsx)(`dd`,{className:`min-w-0`,children:(0,J.jsx)(`span`,{className:`break-all font-mono text-[11px] leading-normal text-foreground/90`,children:o})})]}),R&&B?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`grid grid-cols-2 items-start gap-x-4 border-b border-border/35 py-2.5`,children:[(0,J.jsx)(`dt`,{className:`min-w-0 pt-px text-[11px] font-medium text-muted-foreground`,children:`Miravo instance ID`}),(0,J.jsx)(`dd`,{className:`min-w-0 break-all font-mono text-[11px] leading-normal text-foreground/90`,children:B})]}),(0,J.jsxs)(`div`,{className:`grid grid-cols-2 items-start gap-x-4 border-b border-border/35 py-2.5`,children:[(0,J.jsx)(`dt`,{className:`min-w-0 pt-px text-[11px] font-medium text-muted-foreground`,children:`Litmus Edge alias`}),(0,J.jsx)(`dd`,{className:`min-w-0 break-all font-mono text-[11px] leading-normal text-foreground/90`,children:de})]})]}):null,u.map(e=>(0,J.jsxs)(`div`,{className:`grid grid-cols-2 items-start gap-x-4 border-b border-border/35 py-2.5`,children:[(0,J.jsx)(`dt`,{className:`min-w-0 pt-px text-[11px] font-medium text-muted-foreground`,children:e.label}),(0,J.jsx)(`dd`,{className:`min-w-0 wrap-break-word font-medium text-foreground`,children:e.value})]},`${e.label}:${e.value}`))]})}),K?(0,J.jsxs)(G,{className:T(`flex cursor-pointer items-center gap-2.5 text-[11px] font-medium leading-snug`,K.disabled&&`pointer-events-none opacity-50`),children:[(0,J.jsx)(`span`,{className:`flex shrink-0 items-center`,children:(0,J.jsx)(ue,{checked:C,onCheckedChange:e=>w(e===!0),disabled:K.disabled})}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 leading-snug`,children:I?`Dry run only — preview the plan without deploying`:`Dry run only — preview the plan without removing resources`})]}):null,R?(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,J.jsx)(G,{htmlFor:N,className:`text-[11px] font-medium`,children:`Miravo instance ID`}),(0,J.jsx)(S,{id:N,value:E,maxLength:120,onChange:e=>{let t=e.target.value;re(t),O(je((t.trim()===``?c??``:t.trim().toLowerCase()).trim()))},placeholder:c,autoComplete:`off`,spellCheck:!1,className:T(`h-9 min-w-0 font-mono text-xs`,D&&`border-destructive`),"aria-invalid":D!=null,"aria-describedby":`${N}-hint`}),(0,J.jsx)(`p`,{id:`${N}-hint`,className:`min-w-0 wrap-break-word text-[11px] leading-snug text-foreground/76`,children:`Same instance ID on a later run updates this asset; hyphens stay in Miravo.`}),de?(0,J.jsxs)(`p`,{className:`min-w-0 wrap-break-word text-[11px] leading-snug text-foreground/76`,children:[`LE alias`,` `,(0,J.jsxs)(`span`,{className:`break-all font-mono text-foreground`,children:[B,` -> `,de]})]}):null,D?(0,J.jsx)(`p`,{className:`text-[11px] text-destructive`,children:D}):null]}):null,z?(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,J.jsx)(G,{htmlFor:P,className:`text-[11px] font-medium`,children:`Name prefix`}),(0,J.jsx)(S,{id:P,value:ae,maxLength:120,onChange:e=>{let t=e.target.value;oe(t),A(Me((t.trim()===``?L??``:t.trim().toLowerCase()).trim()))},placeholder:L,autoComplete:`off`,spellCheck:!1,className:T(`h-9 min-w-0 font-mono text-xs`,k&&`border-destructive`),"aria-invalid":k!=null,"aria-describedby":`${P}-hint`}),(0,J.jsxs)(`p`,{id:`${P}-hint`,className:`min-w-0 wrap-break-word text-[11px] leading-snug text-foreground/76`,children:[`Generated aliases use this prefix. Example`,` `,(0,J.jsxs)(`span`,{className:`break-all font-mono text-foreground`,children:[W||L,`-pump-001 ->`,` `,Pe(`${W||L}-pump-001`)]})]}),k?(0,J.jsx)(`p`,{className:`text-[11px] text-destructive`,children:k}):null]}):null,(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsxs)(`button`,{type:`button`,className:`group flex w-full items-center justify-between gap-2 rounded-[var(--miravo-radius-tight)] bg-muted/40 px-2.5 py-2 text-left text-[11px] font-medium text-muted-foreground transition-colors hover:bg-muted/60 hover:text-foreground aria-expanded:bg-muted/55 aria-expanded:text-foreground`,onClick:()=>x(e=>!e),"aria-expanded":y,children:[`Advanced`,(0,J.jsx)(ie,{className:T(`size-3.5 shrink-0 text-muted-foreground transition-transform ease-out group-hover:text-foreground/80`,y?`duration-500 rotate-180 text-foreground/80`:`duration-280`),"aria-hidden":!0})]}),(0,J.jsxs)(f.div,{initial:!1,animate:{maxHeight:y?520:0,opacity:+!!y},transition:{maxHeight:{duration:y?.52:.28,ease:y?[.16,1,.3,1]:[.4,0,.2,1]},opacity:{duration:y?.42:.24,ease:y?[.16,1,.3,1]:[.4,0,.2,1]}},className:T(`overflow-hidden`,!y&&`pointer-events-none`),"aria-hidden":!y,inert:!y,children:[(0,J.jsx)(`div`,{className:`flex flex-col gap-1 pt-px`,children:m.map(e=>{let t=Object.entries(fe).find(([t,n])=>n===e)?.[0],n=t!==void 0&&_.has(t),r=I?ke[e].apply:ke[e].cleanup;return(0,J.jsxs)(G,{htmlFor:`scope-${e}`,className:T(`flex min-h-9 cursor-pointer items-start gap-2 rounded-[var(--miravo-radius-tight)] border border-border/40 bg-muted/10 px-2.5 py-1.5 text-[11px] transition-colors`,n?`opacity-95`:`hover:bg-muted/25`),children:[(0,J.jsx)(`span`,{className:`pt-0.5`,children:(0,J.jsx)(ue,{id:`scope-${e}`,checked:_.has(e),disabled:n,onCheckedChange:()=>pe(e)})}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1 leading-snug`,children:[(0,J.jsx)(`span`,{className:`font-medium text-foreground`,children:Oe[e]}),(0,J.jsx)(`span`,{className:`mt-0.5 block text-[11px] font-normal leading-tight text-muted-foreground`,children:r})]}),n?(0,J.jsx)(`span`,{className:`shrink-0 self-start rounded-[var(--miravo-radius-tight)] border border-primary/35 bg-primary/10 px-1.5 py-px text-[10px] font-semibold uppercase tracking-wide text-primary`,title:`Required when Digital Twins instances are selected (models must stay in scope).`,children:`Required`}):null]},e)})}),I&&(0,J.jsxs)(`div`,{className:`mt-2.5 space-y-1.5 border-t border-border/40 pt-2`,children:[(0,J.jsx)(`p`,{id:`${se}-legend`,className:`text-[11px] font-medium uppercase tracking-wide text-foreground/80`,children:`Collision policy`}),(0,J.jsxs)(`div`,{role:`radiogroup`,"aria-labelledby":`${se}-legend`,className:`flex flex-col gap-1`,children:[(0,J.jsxs)(G,{htmlFor:`if-unmanaged-fail`,className:T(`flex cursor-pointer items-start gap-2 rounded-[var(--miravo-radius-tight)] border px-2.5 py-2 text-[11px] transition-colors`,j===`fail`?`border-primary/45 bg-primary/8`:`border-border/40 bg-muted/10 hover:bg-muted/25`),children:[(0,J.jsx)(`input`,{id:`if-unmanaged-fail`,type:`radio`,name:F,value:`fail`,checked:j===`fail`,onChange:()=>M(`fail`),className:`mt-0.5 size-3.5 shrink-0 accent-primary`}),(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsx)(`span`,{className:`font-medium text-foreground`,children:`Fail if unmanaged exists`}),(0,J.jsx)(`span`,{className:`mt-px block text-[11px] leading-tight text-foreground/74`,children:`Stop if the target has unmanaged resources.`})]})]}),(0,J.jsxs)(G,{htmlFor:`if-unmanaged-skip`,className:T(`flex cursor-pointer items-start gap-2 rounded-[var(--miravo-radius-tight)] border px-2.5 py-2 text-[11px] transition-colors`,j===`skip`?`border-primary/45 bg-primary/8`:`border-border/40 bg-muted/10 hover:bg-muted/25`),children:[(0,J.jsx)(`input`,{id:`if-unmanaged-skip`,type:`radio`,name:F,value:`skip`,checked:j===`skip`,onChange:()=>M(`skip`),className:`mt-0.5 size-3.5 shrink-0 accent-primary`}),(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsx)(`span`,{className:`font-medium text-foreground`,children:`Skip unmanaged resources`}),(0,J.jsx)(`span`,{className:`mt-px block text-[11px] leading-tight text-foreground/74`,children:`Only update resources managed by Miravo.`})]})]})]})]})]}),_.size===0&&!(C&&K)?(0,J.jsx)(`p`,{className:`text-[11px] text-destructive`,children:`Select at least one scope or reopen to reset.`}):null]})]})}),(0,J.jsxs)(h,{className:`mx-0 mb-0 shrink-0 flex flex-col gap-2 border-t border-border/60 px-5 py-4 sm:flex-row sm:justify-end`,children:[(0,J.jsx)(b,{type:`button`,variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,J.jsx)(b,{type:`button`,variant:I||C&&p?`default`:`destructive`,onClick:()=>{let e=me();if(e){if(C&&K){he(e);return}s(e)}},disabled:C&&K?K.disabled||K.planLoading:_.size===0,children:I?C&&d?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(be,{className:`size-3`,"aria-hidden":!0}),`Preview changes`]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(le,{className:`size-3`,"aria-hidden":!0}),`Apply`]}):C&&p?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(be,{className:`size-3`,"aria-hidden":!0}),`Preview changes`]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Ce,{className:`size-3`,"aria-hidden":!0}),`Clean up`]})})]})]})})}var Be={initial:{scale:0,opacity:0},animate:{scale:1,opacity:1,originY:0},exit:{scale:0,opacity:0},transition:{type:`spring`,stiffness:350,damping:40}},Ve={initial:{opacity:0,y:6},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{type:`tween`,duration:.22,ease:[.16,1,.3,1]}};function He({children:e,variant:t=`default`}){let n=t===`default`;return(0,J.jsx)(f.div,{...n?Be:Ve,layout:n,className:`mx-auto w-full`,children:e})}var Ue=q.memo(({children:e,className:t,delay:n=1e3,...r})=>{let[i,a]=(0,q.useState)(0),o=(0,q.useMemo)(()=>q.Children.toArray(e),[e]);(0,q.useEffect)(()=>{let e=null;return i<o.length-1&&(e=setTimeout(()=>{a(e=>(e+1)%o.length)},n)),()=>{e!==null&&clearTimeout(e)}},[i,n,o.length]);let s=(0,q.useMemo)(()=>o.slice(0,i+1).reverse(),[i,o]);return(0,J.jsx)(`div`,{className:T(`flex flex-col items-center gap-4`,t),...r,children:(0,J.jsx)(m,{children:s.map(e=>(0,J.jsx)(He,{children:e},e.key))})})});Ue.displayName=`AnimatedList`;function We({type:e,errorMessage:t,className:n}){return null}var Ge=`text-destructive hover:bg-destructive/25 hover:text-foreground`,Ke={device:`Devices`,tags:`Tags`,model:`Models`,instance:`Instances`,"param-sync":`Parameters`};function qe(e){return Ke[e]??e}function Je(e){switch(e){case`create`:return`border border-success/30 bg-success/15 text-success`;case`update`:return`border border-chart-3/30 bg-chart-3/15 text-chart-3`;case`replace`:return`border border-warning/30 bg-warning/15 text-warning`;case`delete`:return`border border-destructive/30 bg-destructive/15 text-destructive`;case`noop`:return`border border-border/60 bg-muted/70 text-foreground/75`;default:return`border border-border/50 bg-muted/80 text-foreground/85`}}function Ye(e){return e===`noop`?`no-op`:e}function Xe({status:e}){switch(e){case`success`:return(0,J.jsx)(F,{className:`size-3.5 shrink-0 text-success`});case`failed`:return(0,J.jsx)(L,{className:`size-3.5 shrink-0 text-destructive`});case`pending`:return(0,J.jsx)(I,{className:`size-3.5 shrink-0 animate-spin text-primary/90`})}}function Ze({status:e}){switch(e){case`done`:return(0,J.jsx)(F,{className:`size-3.5 text-success`});case`active`:return(0,J.jsx)(I,{className:`size-3.5 animate-spin text-primary`});case`pending`:return(0,J.jsx)(he,{className:`size-3.5 text-foreground/55`})}}function Qe({entry:e}){let[t,n]=(0,q.useState)(!1);return(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,J.jsxs)(`button`,{type:`button`,className:T(`flex items-center gap-2 rounded-[var(--miravo-radius-tight)] px-2 py-1 text-left transition-colors`,e.error?`cursor-pointer hover:bg-muted/40`:`cursor-default`),onClick:()=>e.error&&n(!t),disabled:!e.error,children:[(0,J.jsx)(Xe,{status:e.status}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[11px] text-foreground`,children:e.name}),(0,J.jsx)(`span`,{className:T(`inline-flex rounded-[var(--miravo-radius-tight)] px-1.5 py-0.5 text-[9px] font-medium uppercase tracking-wider`,Je(e.action)),children:Ye(e.action)}),e.error&&(0,J.jsx)(ie,{className:T(`size-3 text-foreground/75 transition-transform`,t&&`rotate-180`)})]}),(0,J.jsx)(m,{initial:!1,children:t&&e.error&&(0,J.jsxs)(f.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:`auto`},exit:{opacity:0,height:0},transition:{duration:.18},className:`overflow-hidden`,children:[(0,J.jsxs)(`div`,{className:`mb-0 flex min-w-0 w-full items-center gap-1.5 rounded-[var(--miravo-radius-tight)] border border-destructive/40 bg-destructive/15 px-2.5 py-1.5 text-[10px] font-medium leading-relaxed`,children:[(0,J.jsx)(`p`,{className:`min-w-0 flex-1 text-left whitespace-normal break-words text-destructive [overflow-wrap:anywhere]`,children:e.error}),(0,J.jsx)(y,{value:e.error,label:`Copy error`,className:T(Ge,`shrink-0`)})]}),(0,J.jsx)(We,{type:`apply`,errorMessage:e.error,className:`mb-1 mt-2.5 w-full min-w-0`})]})})]})}function $e({phase:e,open:t,onOpenChange:n}){let r=e.resources.length,i=r===e.total,a=e.resources.length>0;return(0,J.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,J.jsxs)(`button`,{type:`button`,className:T(`flex w-full items-center gap-2 rounded-[var(--miravo-radius-tight)] px-1 py-1 text-left transition-colors`,a&&`hover:bg-muted/40`,!a&&`cursor-default`),disabled:!a,"aria-expanded":a?t:void 0,onClick:()=>a&&n(!t),children:[(0,J.jsx)(Ze,{status:e.status}),(0,J.jsx)(`span`,{className:`text-xs font-medium tracking-wide text-foreground`,children:qe(e.name)}),(0,J.jsxs)(`span`,{className:`font-mono text-[10px] text-foreground/70`,children:[r,`/`,e.total]}),(0,J.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1.5`,children:[i&&e.status===`done`&&(0,J.jsx)(F,{className:`size-3 text-success`}),a&&(0,J.jsx)(ie,{className:T(`size-3 text-foreground/75 transition-transform`,!t&&`-rotate-90`),"aria-hidden":!0})]})]}),(0,J.jsx)(m,{initial:!1,children:a&&t&&(0,J.jsx)(f.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:`auto`},exit:{opacity:0,height:0},transition:{duration:.25,ease:[.16,1,.3,1]},className:`overflow-hidden`,children:(0,J.jsx)(`div`,{className:`ml-2 flex min-w-0 flex-col border-l border-border/55 pl-2.5 pr-1.5 pb-1 pt-0.5`,children:(0,J.jsx)(p.Provider,{value:null,children:e.resources.map((e,t)=>(0,J.jsx)(He,{variant:`subtle`,children:(0,J.jsx)(Qe,{entry:e})},`${e.name}-${t}`))})})})})]})}function et({operation:e}){let t=e.status===`complete`,n=e.status===`cancelled`,r=e.failed>0,i=e.totalPlanned>0?Math.min(100,nt(e)/e.totalPlanned*100):0;return(0,J.jsx)(`div`,{className:`h-1 w-full overflow-hidden rounded-full bg-muted/55`,role:`progressbar`,"aria-valuenow":Math.round(i),"aria-valuemin":0,"aria-valuemax":100,"aria-label":`Operation progress`,children:(0,J.jsx)(f.div,{"aria-hidden":`true`,className:T(`h-full rounded-full transition-colors duration-500`,n?`bg-foreground/30`:t&&!r?`bg-success`:`bg-warning`),initial:{width:`0%`},animate:{width:`${i}%`},transition:{duration:.4,ease:[.25,.1,.25,1]}})})}function tt(e){return e.duration==null?(Date.now()-e.startedAt)/1e3:e.duration/1e3}function nt(e){let t=e.applied+e.failed;return e.totalPlanned>0?Math.min(t,e.totalPlanned):t}function rt(e,t){let n=e.label;return t?.length?t.find(e=>e.id===n)?.name??n:n}var it={complete:{Icon:F,className:`size-4 text-success`},partial:{Icon:me,className:`size-4 text-warning`},cancelled:{Icon:pe,className:`size-4 text-foreground/65`},error:{Icon:L,className:`size-4 text-destructive`},running:{Icon:I,className:`size-4 animate-spin text-warning`}};function at({icon:e,className:t}){return(0,J.jsx)(f.div,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:{type:`spring`,stiffness:500,damping:30},className:`shrink-0`,children:(0,J.jsx)(e,{className:t})})}function ot({operation:e,sourceLabel:t,isAllExpanded:n,onToggleAll:r}){let i=tt(e),a=nt(e),o=e.status===`complete`,s=e.status===`cancelled`,c=e.status===`error`,l=e.failed>0,u=o&&!l?`complete`:o&&l?`partial`:s?`cancelled`:c?`error`:`running`,d=it[u];return(0,J.jsxs)(`div`,{className:T(`sticky top-0 z-10 flex min-w-0 w-full flex-col gap-1.5 rounded-[var(--miravo-radius-stadium-sm)] border px-3 pt-2.5 pb-3.5 backdrop-blur-sm transition-colors duration-500`,o&&!l&&`border-success/30 bg-success/5`,o&&l&&`border-warning/30 bg-warning/5`,s&&`border-border/60 bg-muted/50`,c&&`border-destructive/30 bg-destructive/5`,!o&&!s&&!c&&`border-warning/20 bg-warning/5`),children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,J.jsx)(m,{mode:`wait`,initial:!1,children:(0,J.jsx)(at,{icon:d.Icon,className:d.className},u)}),(0,J.jsx)(`span`,{className:`text-xs font-medium leading-none text-foreground`,children:s?`Cancelled`:o?l?`Completed with errors`:`Complete`:c?`Failed`:e.retryPending?`Failed, retrying attempt ${e.attempt?e.attempt+1:2}/${e.maxAttempts} in ${e.retryDelayMs?e.retryDelayMs/1e3:3}s...`:e.attempt&&e.maxAttempts&&e.attempt>1?`Retrying attempt ${e.attempt}/${e.maxAttempts}...`:e.type===`apply`?`Applying...`:`Cleaning up...`}),(0,J.jsxs)(`span`,{className:`w-full min-w-0 text-[10px] leading-tight text-foreground/78`,children:[(0,J.jsx)(`span`,{className:`font-sans break-words`,children:t}),(0,J.jsx)(`span`,{className:`font-mono break-words`,children:` → ${e.environment}`})]})]}),(0,J.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,J.jsx)(W,{variant:`secondary`,className:`h-5 min-h-5 gap-0 overflow-hidden border border-border/50 bg-muted/70 px-1.5 !py-0 font-mono text-[10px] leading-none text-foreground shadow-sm [&>span]:inline-flex [&>span]:items-center`,children:(0,J.jsxs)(`span`,{className:`gap-1`,children:[(0,J.jsx)(m,{mode:`popLayout`,initial:!1,children:(0,J.jsx)(f.span,{initial:{opacity:0,y:-6},animate:{opacity:1,y:0},exit:{opacity:0,y:6},transition:{type:`spring`,stiffness:500,damping:35},className:`inline tabular-nums`,children:a},a)}),`/`,e.totalPlanned,(0,J.jsx)(`span`,{className:`text-foreground/72`,children:e.type===`apply`?`applied`:`deleted`})]})}),(0,J.jsx)(m,{initial:!1,children:e.failed>0&&(0,J.jsx)(f.div,{className:`inline-flex items-center`,initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},transition:{type:`spring`,stiffness:500,damping:30},children:(0,J.jsxs)(W,{variant:`destructive`,className:`h-5 min-h-5 gap-0 border border-destructive/35 bg-destructive/20 px-1.5 !py-0 font-mono text-[10px] font-semibold leading-none text-destructive`,children:[e.failed,` failed`]})})})]}),(0,J.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:[(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-mono text-[10px] leading-none text-foreground/75`,children:[(0,J.jsx)(_e,{className:`size-3 shrink-0 block text-foreground/65`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`tabular-nums leading-none`,children:typeof i==`number`?`${i.toFixed(1)}s`:`...`})]}),r&&(0,J.jsx)(`div`,{className:`flex items-center border-l border-border/40 pl-2`,children:(0,J.jsx)(`button`,{type:`button`,onClick:r,className:`flex size-4.5 items-center justify-center rounded-[var(--miravo-radius-tight)] text-foreground/55 transition-colors hover:bg-muted/60 hover:text-foreground`,"aria-label":n?`Collapse all phases`:`Expand all phases`,title:n?`Collapse all`:`Expand all`,children:(0,J.jsx)(K,{className:T(`size-3.5 transition-transform duration-300`,!n&&`opacity-70 scale-y-[-1]`)})})})]})]}),(0,J.jsx)(et,{operation:e})]})]})}function st(e){return e?e.closest(`[data-edge-op-scroll]`)??e.closest(`.overflow-y-auto`):null}var ct=350;function Z(e){e?.scrollIntoView({block:`end`,behavior:`auto`,inline:`nearest`})}function lt(e){let t=()=>Z(e);t(),requestAnimationFrame(t),requestAnimationFrame(()=>requestAnimationFrame(t)),window.setTimeout(t,0),window.setTimeout(t,48),window.setTimeout(t,120)}function ut({logs:e}){return e.length===0?null:(0,J.jsx)(`div`,{className:`flex min-w-0 flex-col gap-1.5 px-2 pb-2`,children:e.map(e=>(0,J.jsxs)(`div`,{className:T(`flex min-w-0 items-start gap-2 rounded-[var(--miravo-radius-tight)] border px-2.5 py-2 text-xs`,e.level===`error`?`border-destructive/35 bg-destructive/12 text-destructive`:e.level===`warn`?`border-warning/35 bg-warning/12 text-warning`:`border-primary/25 bg-primary/8 text-foreground/82`),children:[e.level===`info`?(0,J.jsx)(R,{className:`mt-0.5 size-3.5 shrink-0 text-primary`,"aria-hidden":!0}):(0,J.jsx)(me,{className:`mt-0.5 size-3.5 shrink-0`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`min-w-0 wrap-anywhere`,children:e.message})]},e.id))})}function dt({operation:e,catalogTemplates:t,logs:n}){let r=(0,q.useRef)(null),i=(0,q.useRef)(null),a=(0,q.useRef)(!0),o=(0,q.useRef)(e.status);o.current=e.status;let s=(0,q.useRef)(!1),[c,l]=(0,q.useState)(new Set),u=(0,q.useMemo)(()=>rt(e,t),[e,t]);(0,q.useLayoutEffect)(()=>{let e=st(r.current);if(!e)return;let t=()=>{a.current=e.scrollHeight-e.scrollTop-e.clientHeight<ct};return e.addEventListener(`scroll`,t,{passive:!0}),t(),()=>{e.removeEventListener(`scroll`,t)}},[]),(0,q.useLayoutEffect)(()=>{if(e.status===`running`){a.current&&Z(i.current),s.current=!0;return}s.current&&=(lt(i.current),!1)},[e.status,e.applied,e.failed,e.phases]),(0,q.useEffect)(()=>{if(e.status!==`running`)return;let t=r.current;if(!t)return;let n=0,s=new ResizeObserver(()=>{cancelAnimationFrame(n),n=requestAnimationFrame(()=>{o.current===`running`&&a.current&&Z(i.current)})});return s.observe(t),a.current&&Z(i.current),()=>{s.disconnect(),cancelAnimationFrame(n)}},[e.status]);let d=e.phases.length>0,p=c.size===0;return(0,J.jsxs)(`div`,{ref:r,className:`flex min-w-0 w-full flex-col gap-2`,children:[(0,J.jsx)(ot,{operation:e,sourceLabel:u,isAllExpanded:p,onToggleAll:d?()=>{l(p?new Set(e.phases.map(e=>e.name)):new Set)}:void 0}),(0,J.jsx)(`div`,{className:`flex flex-col gap-1 px-2 pt-2 pb-4`,children:e.phases.map(e=>(0,J.jsx)(`div`,{children:(0,J.jsx)($e,{phase:e,open:!c.has(e.name),onOpenChange:t=>{l(n=>{let r=new Set(n);return t?r.delete(e.name):r.add(e.name),r})}})},e.name))}),(0,J.jsx)(m,{initial:!1,children:e.error&&e.retryPending&&(0,J.jsxs)(f.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},className:`sticky bottom-2 z-20 mx-2 mt-auto mb-2 flex items-center gap-2 overflow-hidden rounded-[var(--miravo-radius-stadium-sm)] border border-destructive/40 bg-destructive/15 px-3 py-2 text-xs font-medium text-destructive shadow-md backdrop-blur-md`,children:[(0,J.jsx)(I,{className:`size-4 shrink-0 animate-spin`}),(0,J.jsx)(`span`,{className:`truncate`,children:e.error})]})}),(0,J.jsx)(m,{initial:!1,children:e.error&&e.status===`error`&&(0,J.jsxs)(f.div,{initial:{opacity:0,height:0,marginTop:0},animate:{opacity:1,height:`auto`,marginTop:8},exit:{opacity:0,height:0,marginTop:0},transition:{duration:.2},className:`mx-2 mb-4 flex min-w-0 flex-col gap-0 overflow-hidden rounded-[var(--miravo-radius-stadium-sm)] border border-destructive/40 bg-destructive/15 px-3 py-2 text-xs font-medium`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(`p`,{className:`min-w-0 flex-1 text-left wrap-anywhere text-destructive`,children:e.error}),(0,J.jsx)(y,{value:e.error,label:`Copy error`,className:T(Ge,`shrink-0`)})]}),(0,J.jsx)(We,{type:e.type,errorMessage:e.error,className:`mt-3 w-full min-w-0`})]})}),n&&n.length>0?(0,J.jsx)(ut,{logs:n}):null,(0,J.jsx)(`div`,{ref:i,className:`h-px w-full shrink-0`,"aria-hidden":!0})]})}function ft({format:e,kind:t}){return e===`source-yaml`?t===`model`?`Raw twin model definition. Edit locally, version-control, or use as input for the CLI.`:`Raw environment definition with topology and namespace. Edit, share, or apply via CLI.`:e===`litmus-edge`?t===`model`?`Litmus Edge Digital Twin JSON for manual import via the LE UI or GraphQL API.`:`Litmus Edge template JSON (DeviceHub devices + Digital Twins). Import directly via the Litmus Edge UI.`:`Select a format to download.`}function pt({children:e,className:t}){return(0,J.jsx)(`div`,{className:T(`max-h-[min(36rem,75vh)] min-h-0 overflow-y-auto rounded-[var(--miravo-radius-stadium-sm)] border border-border/60 p-4 sm:p-5`,t),children:e})}function mt({title:e,subtitle:t,footerAction:n,canDismiss:r=!0,onDismiss:i,children:a}){return(0,q.useEffect)(()=>{function e(e){e.key===`Escape`&&r&&i()}return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[r,i]),(0,J.jsx)(f.div,{initial:{opacity:0,y:24},animate:{opacity:1,y:0},exit:{opacity:0,y:16},transition:{type:`spring`,stiffness:380,damping:30},className:`pointer-events-none fixed bottom-4 left-4 right-4 z-[60] sm:left-auto sm:w-full sm:max-w-md`,children:(0,J.jsxs)(pt,{className:`pointer-events-auto flex flex-col overflow-hidden border-border/70 bg-background p-0 shadow-lg shadow-black/15 ring-1 ring-border/50 backdrop-blur-sm sm:p-0 bg-background shadow-black/50`,children:[(0,J.jsxs)(`div`,{className:`flex shrink-0 items-start gap-2 border-b border-border/45 p-2.5 pb-2 sm:p-3 sm:pb-2`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,J.jsx)(se,{className:`size-4 shrink-0 text-primary`,"aria-hidden":!0}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`p`,{className:`font-heading text-xs font-semibold tracking-tight text-foreground`,children:e}),t?(0,J.jsx)(`p`,{className:`text-[11px] leading-snug text-foreground/80`,children:t}):null]})]}),r?(0,J.jsx)(b,{type:`button`,variant:`ghost`,size:`icon-xs`,className:`shrink-0 text-foreground/70 hover:bg-muted/80 hover:text-foreground`,onClick:i,"aria-label":`Dismiss operation panel`,children:(0,J.jsx)(C,{className:`size-3.5`,"aria-hidden":!0})}):null]}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-2.5 pt-2.5 sm:px-3 sm:pt-3`,"data-edge-op-scroll":``,children:a}),n?(0,J.jsx)(`div`,{className:`flex w-full shrink-0 min-w-0 items-center gap-2 border-t border-border/40 bg-muted/15 p-2.5 sm:p-3`,children:n}):null]})})}var ht={...Object.fromEntries(j.map(e=>[e.id,e.exportLabel])),"source-yaml":`Source YAML`};function gt(e){return e==null||e===``?`Select platform`:typeof e==`string`?ht[e]??e:`Select platform`}function _t(e){return j.find(t=>t.id===e)?.label??e}function Q({id:e,label:t,hint:n,className:r,labelAdornment:i,children:a}){return(0,J.jsxs)(`div`,{className:T(`flex flex-col gap-2`,r),children:[(0,J.jsxs)(`div`,{className:`space-y-1`,children:[(0,J.jsxs)(`span`,{className:`inline-flex max-w-full items-center gap-1`,children:[(0,J.jsx)(G,{htmlFor:e,className:`text-[11px] font-medium text-foreground`,children:t}),i]}),n?(0,J.jsx)(`p`,{className:`text-[11px] leading-relaxed text-muted-foreground`,children:n}):null]}),a]})}function vt({open:e,editing:t,platformId:n,form:r,showToken:i,saving:a,testing:o,canTestConnection:s,onOpenChange:c,onPlatformChange:l,onFormChange:u,onShowTokenChange:d,onSave:f,onTestConnection:p,onCancelInFlight:m}){let _=n===N.id,y=t?`Edit Target`:`Add Target`,x=t?`Update the deployment connection.`:`Add the target used for platform deploys.`,C=t?`Leave empty to keep the current token.`:`Required for the first save and connection test.`;return(0,J.jsx)(v,{open:e,onOpenChange:e=>{e||m(),c(e)},children:(0,J.jsxs)(te,{showCloseButton:!0,className:`flex max-h-[min(84vh,38rem)] min-h-0 flex-col gap-0 overflow-hidden p-0 sm:max-w-[38rem]`,children:[(0,J.jsxs)(ee,{className:`shrink-0 border-b border-border/60 px-4 pb-3.5 pt-4 pr-12 sm:px-5 sm:pr-14`,children:[(0,J.jsx)(ne,{className:`text-base tracking-tight`,children:y}),(0,J.jsx)(g,{className:`max-w-xl text-sm leading-relaxed`,children:x})]}),(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-4 py-4 sm:px-5`,style:{scrollbarGutter:`stable`},children:(0,J.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[t?(0,J.jsx)(Q,{label:`Platform`,children:(0,J.jsx)(`div`,{className:`flex h-9 items-center rounded-[var(--miravo-radius-stadium-sm)] border border-input bg-input/30 px-3 text-sm text-foreground`,children:_t(n)})}):(0,J.jsx)(Q,{label:`Platform`,children:(0,J.jsxs)(A,{value:n,onValueChange:e=>l(e),children:[(0,J.jsx)(k,{className:`h-9 w-full text-sm data-placeholder:text-muted-foreground/55`,"aria-label":`Platform type`,children:(0,J.jsx)(re,{placeholder:`Select platform`,children:e=>gt(e)})}),(0,J.jsxs)(O,{children:[(0,J.jsxs)(oe,{children:[(0,J.jsx)(E,{children:`Available`}),P.map(e=>(0,J.jsx)(D,{value:e.id,children:e.label},e.id))]}),(0,J.jsx)(ae,{}),(0,J.jsxs)(oe,{children:[(0,J.jsx)(E,{children:`Coming soon`}),M.map(e=>(0,J.jsx)(D,{value:e.id,children:e.label},e.id))]})]})]})}),_?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Q,{id:`env-label`,label:`Label`,children:(0,J.jsx)(S,{id:`env-label`,placeholder:`Production`,value:r.label,onChange:e=>u({...r,label:e.currentTarget.value}),autoComplete:`off`,className:`h-9 placeholder:text-muted-foreground/55`})}),(0,J.jsx)(Q,{id:`env-hostname`,label:`Hostname`,children:(0,J.jsx)(S,{id:`env-hostname`,placeholder:`192.168.1.100`,value:r.hostname,onChange:e=>u({...r,hostname:e.currentTarget.value}),autoCapitalize:`none`,autoComplete:`off`,spellCheck:!1,className:`h-9 font-mono text-[13px] placeholder:text-muted-foreground/55`})}),(0,J.jsx)(Q,{id:`env-source`,label:X,labelAdornment:(0,J.jsxs)(U,{children:[(0,J.jsx)(V,{type:`button`,className:`inline-flex size-5 shrink-0 items-center justify-center rounded-[var(--miravo-radius-tight)] text-muted-foreground hover:bg-muted hover:text-foreground`,"aria-label":`About ${X}`,children:(0,J.jsx)(ce,{className:`size-3`,"aria-hidden":!0})}),(0,J.jsx)(H,{side:`top`,align:`start`,className:`max-w-xs text-left`,children:Re})]}),children:(0,J.jsx)(S,{id:`env-source`,placeholder:`host.docker.internal`,value:r.sourceHostname,onChange:e=>u({...r,sourceHostname:e.currentTarget.value}),autoCapitalize:`none`,autoComplete:`off`,spellCheck:!1,className:`h-9 font-mono text-[13px] placeholder:text-muted-foreground/55`})}),(0,J.jsx)(Q,{id:`env-token`,label:`API token`,labelAdornment:(0,J.jsxs)(U,{children:[(0,J.jsx)(V,{type:`button`,className:`inline-flex size-5 shrink-0 items-center justify-center rounded-[var(--miravo-radius-tight)] text-muted-foreground hover:bg-muted hover:text-foreground`,"aria-label":`About API token`,children:(0,J.jsx)(ce,{className:`size-3`,"aria-hidden":!0})}),(0,J.jsx)(H,{side:`top`,align:`start`,className:`max-w-xs text-left`,children:C})]}),children:(0,J.jsxs)(`div`,{className:`relative`,children:[(0,J.jsx)(S,{id:`env-token`,type:i?`text`:`password`,placeholder:t?`••••••••`:`Enter API token`,value:r.apiToken,onChange:e=>u({...r,apiToken:e.currentTarget.value}),autoCapitalize:`none`,autoComplete:`off`,spellCheck:!1,className:`h-9 pr-11 font-mono text-[13px] placeholder:text-muted-foreground/55`}),(0,J.jsx)(`button`,{type:`button`,onClick:()=>d(!i),"aria-label":i?`Hide token`:`Show token`,"aria-pressed":i,className:`absolute inset-y-0 right-0 flex w-11 items-center justify-center rounded-r-[var(--miravo-radius-stadium-sm)] text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,children:i?(0,J.jsx)(ve,{className:`size-3.5`,"aria-hidden":!0}):(0,J.jsx)(ye,{className:`size-3.5`,"aria-hidden":!0})})]})})]}):(0,J.jsxs)(`div`,{className:`rounded-[var(--miravo-radius-stadium-sm)] border border-dashed border-border/70 px-4 py-3 text-sm text-muted-foreground`,children:[_t(n),` setup is not available yet. Switch back to Litmus Edge to finish target setup now.`]})]})}),(0,J.jsx)(`span`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:o&&_?`Checking connection to Litmus Edge…`:``}),(0,J.jsxs)(h,{className:`mx-0 mb-0 shrink-0 flex-col gap-2 border-t border-border/60 bg-background px-4 py-3 sm:flex-row sm:justify-end sm:px-5`,children:[(0,J.jsx)(b,{type:`button`,variant:`outline`,size:`lg`,className:`w-full justify-center sm:mr-auto sm:w-auto`,disabled:a||o||!s,"aria-busy":o,onClick:p,children:o?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(I,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),`Testing connection`]}):`Test connection`}),(0,J.jsxs)(`div`,{className:`flex w-full flex-col gap-2 sm:w-auto sm:flex-row`,children:[(0,J.jsx)(b,{variant:`outline`,size:`lg`,className:`w-full sm:w-auto`,onClick:()=>{m(),c(!1)},disabled:a,children:`Cancel`}),(0,J.jsx)(b,{size:`lg`,className:`w-full sm:w-auto`,onClick:f,disabled:a||!_,children:a?`Saving...`:t?`Save Target`:`Add Target`})]})]})]})})}var yt=`flex size-7 shrink-0 items-center justify-center rounded-[var(--miravo-radius-stadium-sm)] border border-border/35 bg-muted/25 text-primary`;function bt({targets:e,value:t,onValueChange:n,size:r=`default`,disabled:i,loading:a=!1,className:o,preferredTargetId:s,onAddNew:c}){return(0,q.useEffect)(()=>{if(t||e.length===0)return;let r=(s?e.find(e=>e.id===s):void 0)??e[0];r&&n(r.id)},[t,e,s,n]),a?(0,J.jsx)(`div`,{className:T(`flex h-9 min-h-9 w-full items-center rounded-[var(--miravo-radius-stadium-sm)] border border-input bg-input/25 px-3 text-xs text-muted-foreground`,o),children:`Loading targets...`}):e.length===0&&c?(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 text-[11px] text-muted-foreground`,children:[(0,J.jsx)(`span`,{children:`No targets configured.`}),(0,J.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 text-primary hover:underline`,onClick:c,children:[(0,J.jsx)(xe,{className:`inline size-3`}),` Add target`]})]}):(0,J.jsxs)(A,{value:t,onValueChange:e=>e&&n(e),disabled:i,children:[(0,J.jsx)(k,{size:r,className:T(`w-full`,r===`sm`&&`h-9! min-h-9 py-0`,r===`default`&&`h-auto! min-h-9 py-2 **:data-[slot=select-value]:line-clamp-none`,o),children:(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,J.jsx)(`span`,{className:yt,"aria-hidden":!0,children:(0,J.jsx)(z,{className:`size-3.5`})}),(0,J.jsx)(re,{placeholder:`Select target`,className:`min-w-0 flex-1`,children:t=>{let n=e.find(e=>e.id===t);return n?r===`sm`?n.label:(0,J.jsxs)(`span`,{className:`flex flex-col gap-0.5`,children:[(0,J.jsx)(`span`,{className:`text-xs font-medium leading-tight`,children:n.label}),(0,J.jsx)(`span`,{className:`font-mono text-[11px] leading-none text-muted-foreground`,children:n.hostname})]}):`Select target`}})]})}),(0,J.jsx)(O,{className:`rounded-[var(--miravo-radius-stadium-sm)] p-1.5`,children:e.map(e=>(0,J.jsxs)(D,{value:e.id,className:`h-auto items-center gap-2 rounded-[var(--miravo-radius-stadium-sm)] py-2 pr-8 pl-2`,children:[(0,J.jsx)(`span`,{className:yt,"aria-hidden":!0,children:(0,J.jsx)(z,{className:`size-3.5`})}),(0,J.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5 text-left`,children:[(0,J.jsx)(`span`,{className:`truncate text-xs font-medium leading-tight text-foreground`,children:e.label}),(0,J.jsx)(`span`,{className:`truncate font-mono text-[11px] leading-none text-muted-foreground`,children:e.hostname})]})]},e.id))})]})}async function xt(){return(await l(`/platforms/le/targets`,i.platformTargets)).targets}function St(e){return l(`/platforms/le/targets`,i.platformTargetCreate,{body:e})}function Ct(e,t){return l(`/platforms/le/targets/${e}`,i.platformTargetById,{body:t})}function wt(e){return l(`/platforms/le/targets/${e}`,i.platformTargetDelete)}function Tt(e,t){return l(`/platforms/le/targets/test`,i.platformConnectionTest,{body:e,init:{signal:t?.signal}})}function Et(e,t){return l(`/platforms/le/plan`,i.platformPlan,{body:e,init:{signal:t?.signal}})}function Dt(e,t){return l(`/platforms/le/cleanup/plan`,i.platformCleanupPlan,{body:e,init:{signal:t?.signal}})}function Ot(e={}){let t=new URLSearchParams;e.type&&t.set(`type`,e.type),e.targetId&&t.set(`targetId`,e.targetId),typeof e.limit==`number`&&t.set(`limit`,String(e.limit)),typeof e.offset==`number`&&t.set(`offset`,String(e.offset));let n=t.toString();return l(n?`/platforms/le/operations?${n}`:`/platforms/le/operations`,i.platformOperations)}async function kt(e){try{return await l(`/platforms/le/operations/${e}/cancel`,i.platformOperationCancel),!0}catch(e){if(r.is(e)&&e.status===404)return!1;throw e}}function At(e,t,n){return Mt(`/platforms/le/apply/stream`,i.platformApplyStream,e,t,n)}function jt(e,t,n){return Mt(`/platforms/le/cleanup/stream`,i.platformCleanupStream,e,t,n)}function Mt(e,t,n,i,s){let l=new AbortController;return(async()=>{try{let s=t.body.safeParse(n);if(!s.success)throw Error(`Invalid request for ${t.method} ${t.path}: ${s.error.message}`);let f=await fetch(c(u,e),{method:t.method,headers:{"content-type":`application/json`},credentials:`include`,body:JSON.stringify(s.data),signal:l.signal});if(f.status===401&&t.auth===`required`)throw o(),Error(`Session expired`);if(!f.ok){let e=`HTTP ${f.status}`;try{let e=await f.json(),t=d.safeParse(e);if(t.success)throw new r({code:t.data.code,status:f.status,message:t.data.message,hint:t.data.hint})}catch(e){if(e instanceof r)throw e}throw Error(e)}if(!f.body)throw Error(`No response body`);let p=f.body.getReader(),m=new TextDecoder,h=``,g=``,_=``,v=!1;for(;;){let{done:e,value:t}=await p.read();if(e)break;h+=m.decode(t,{stream:!0});let n=h.split(`
|
|
2
|
-
`);h=n.pop()??``;for(let e of n)if(e.startsWith(`event: `))g=e.slice(7).trim();else if(e.startsWith(`data: `))_=e.slice(6);else if(e===``&&g&&_){let e=!1;try{let t=JSON.parse(_),n=a.safeParse({event:g,data:t});n.success&&((n.data.event===`complete`||n.data.event===`cancelled`||n.data.event===`error`)&&(v=!0,e=!0),i(n.data))}catch{}if(g=``,_=``,e){await p.cancel();return}}}if(!v&&!l.signal.aborted)throw Error(`Connection to server was lost unexpectedly`)}catch(e){if(l.signal.aborted)return;s(e instanceof Error?e:Error(String(e)))}})(),l}function Nt(e){return e.status===`running`?e.operation?e.operation.type===`apply`?`Apply`:`Cleanup`:`Connecting`:e.status===`error`?`Failed`:e.operation&&e.status===`complete`?e.operation.status===`cancelled`?`Cancelled`:`Complete`:null}function Pt(e){let t=e.operation,n=t?.type===`apply`?`apply`:`cleanup`;switch(e.status){case`running`:return{title:`Operation in progress`,subtitle:`Streaming ${n} steps to Litmus Edge`};case`complete`:return t?.status===`cancelled`?{title:`Operation cancelled`,subtitle:`Stopped — resources created so far remain in Litmus Edge.`}:{title:`Operation complete`,subtitle:n===`apply`?`Apply finished — review the summary below.`:`Cleanup finished — review the summary below.`};case`error`:return{title:`Operation failed`,subtitle:e.error??t?.error??`The operation ended with an error.`};default:return{title:`Operation`,subtitle:``}}}function Ft(e){let t=e.trim();if(t.length===0)return{message:`Connection test failed with no details from the server.`};let n=t.toLowerCase();if(t.includes(`timed out`))return{message:`Litmus Edge did not respond in time.`,description:`Check the hostname, VPN or firewall, and that the device is online.`};if(/\b401\b/.test(t)||/\b403\b/.test(t)||n.includes(`unauthorized`))return{message:`The API token was rejected.`,description:`Create or copy a valid token in Litmus Edge and paste it into the API token field.`};if(/\b404\b/.test(t)&&(n.includes(`sysinfo`)||n.includes(`/sysinfo/`)))return{message:`This Litmus Edge host or version does not expose the system info API.`,description:`Confirm the hostname and that Litmus Edge is running a build with GET /sysinfo/devinfo.`};if(n.includes(`econnrefused`)||n.includes(`connection refused`)||n.includes(`enotfound`)||n.includes(`getaddrinfo`)||n.includes(`failed`)&&n.includes(`fetch`))return{message:`Could not reach the Litmus Edge host.`,description:`Check the hostname or IP, TLS, and that this computer can reach the edge network.`};if(t.includes(`Session expired`))return{message:`Your session expired. Sign in again, then retry the connection test.`};if(n.includes(`environment not found`))return{message:`That target was removed. Close the dialog and refresh the list.`};if(n.includes(`unsupported platform`)&&n.includes(`connection`))return{message:`This platform type does not support connection tests yet.`,description:`Use Litmus Edge for remote apply and connection testing.`};if(n.includes(`invalid request body`)||n.includes(`api token is required`))return{message:`Some required fields are missing or invalid.`,description:`Fill in hostname, source host (Miravo), and API token (for new targets).`};let r=t.replace(/^LE\s+\S+\s+/i,``).trim();return{message:`Could not verify the connection to Litmus Edge.`,description:r.length>0&&r.length<=220?r:It(t,200)}}function It(e,t){let n=e.replace(/\s+/g,` `).trim();return n.length<=t?n:`${n.slice(0,t-1)}…`}function Lt(e){if(e.connected){let t=e.litmusEdgeVersion?` Litmus Edge v${e.litmusEdgeVersion}.`:``;if(e.warning){_.warning(`Connected to ${e.hostname}.${t}`,{description:e.warning});return}_.success(`Connected to ${e.hostname}.${t}`);return}let{message:t,description:n}=Ft(e.error);_.error(t,n?{description:n}:void 0)}function Rt(e){let{message:t,description:n}=Ft(e instanceof Error?e.message:String(e));_.error(t,n?{description:n}:void 0)}function zt(e){return!!(typeof DOMException<`u`&&e instanceof DOMException&&e.name===`AbortError`||e instanceof Error&&(e.name===`AbortError`||/aborted/i.test(e.message)))}function Bt(){let[e,t]=(0,q.useState)(!1),n=(0,q.useRef)(null),r=(0,q.useCallback)(()=>{n.current?.abort()},[]);return{testing:e,runTest:(0,q.useCallback)(async e=>{let r=new AbortController;n.current=r,t(!0);try{Lt(await Tt(e,{signal:r.signal}))}catch(e){if(zt(e))return;Rt(e)}finally{n.current===r&&(n.current=null),t(!1)}},[]),cancelInFlight:r}}function Vt(e){return e instanceof DOMException&&e.name===`AbortError`||e instanceof Error&&e.name===`AbortError`}function Ht(e){return e.map(e=>e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)).join(`, `)}function Ut({onCloseTable:e,planKind:t=`apply`}){return(0,J.jsx)(`div`,{className:`border-b border-border/40 px-3 py-3 sm:px-4`,children:(0,J.jsxs)(`div`,{className:`flex gap-3`,children:[(0,J.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-[var(--miravo-radius-stadium-sm)] border border-border/50 bg-muted/15`,children:(0,J.jsx)(ge,{className:`size-4 text-muted-foreground`,"aria-hidden":!0})}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start gap-1 pt-0.5 sm:gap-2`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-2`,children:[(0,J.jsx)(`p`,{className:`font-heading text-[11px] font-semibold uppercase tracking-[0.14em] text-foreground`,children:t===`cleanup`?`Expected removals`:`Expected changes`}),(0,J.jsx)(`span`,{className:`rounded-[var(--miravo-radius-tight)] border border-primary/25 bg-primary/5 px-1.5 py-px font-mono text-[9px] uppercase tracking-wider text-primary/90`,children:`Draft`})]}),(0,J.jsx)(`p`,{className:`mt-1.5 max-w-prose text-[10px] leading-relaxed text-muted-foreground`,children:t===`cleanup`?`Preview only — nothing runs until you confirm cleanup.`:`Preview only — nothing runs until you confirm deploy.`})]}),e&&(0,J.jsx)(b,{type:`button`,variant:`ghost`,size:`icon`,className:`size-8 shrink-0 text-muted-foreground hover:text-foreground`,onClick:e,"aria-label":`Close table`,children:(0,J.jsx)(C,{className:`size-4`,"aria-hidden":!0})})]})]})})}var Wt={create:`border-success/30 bg-success/12 text-success`,update:`border-info/30 bg-info/12 text-info`,replace:`border-chart-2/30 bg-chart-2/12 text-chart-2`,delete:`border-destructive/30 bg-destructive/12 text-destructive`,noop:`border-border/50 bg-muted/50 text-foreground/75`,blocked:`border-warning/30 bg-warning/12 text-warning`};function Gt({plan:e,planKind:t}){let n=t===`apply`&&e.sourceHostname!=null&&e.sourceHostname!==``;return(0,J.jsx)(`div`,{className:`border-b border-border/35 bg-muted/10 px-3 py-2 sm:px-4`,children:(0,J.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-[10px] leading-snug sm:flex-row sm:flex-wrap sm:items-baseline sm:gap-x-4 sm:gap-y-1`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5`,children:[(0,J.jsx)(`span`,{className:`shrink-0 font-mono text-[9px] uppercase tracking-wider text-muted-foreground/85`,children:`Target LE`}),(0,J.jsx)(`span`,{className:`font-mono text-foreground/90 wrap-anywhere`,children:e.targetHost})]}),n?(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5 sm:border-l sm:border-border/50 sm:pl-4`,children:[(0,J.jsx)(`span`,{className:`shrink-0 font-mono text-[9px] uppercase tracking-wider text-muted-foreground/85`,children:X}),(0,J.jsx)(`span`,{className:`font-mono text-foreground/90 wrap-anywhere`,children:e.sourceHostname})]}):null]})})}function Kt({entries:e}){let t=e.reduce((e,t)=>(e[t.action]++,e),{create:0,update:0,replace:0,delete:0,noop:0,blocked:0});return(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-border/35 px-3 py-2.5 sm:px-4`,children:[(0,J.jsx)(`span`,{className:`sr-only`,children:`Summary of planned actions`}),(0,J.jsx)(`span`,{className:`font-mono text-[9px] uppercase tracking-[0.18em] text-muted-foreground`,children:`Manifest`}),(0,J.jsx)(`span`,{className:`hidden h-3 w-px bg-border/60 sm:block`,"aria-hidden":!0}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-2`,children:[t.create>0&&(0,J.jsxs)(`span`,{className:`inline-flex items-center rounded-[var(--miravo-radius-tight)] border border-success/25 bg-success/10 px-2 py-0.5 font-mono text-[10px] tabular-nums text-success`,children:[`+`,t.create,` new`]}),t.update>0&&(0,J.jsxs)(`span`,{className:`inline-flex items-center rounded-[var(--miravo-radius-tight)] border border-info/25 bg-info/10 px-2 py-0.5 font-mono text-[10px] tabular-nums text-info`,children:[`~`,t.update,` update`]}),t.replace>0&&(0,J.jsxs)(`span`,{className:`inline-flex items-center rounded-[var(--miravo-radius-tight)] border border-chart-2/25 bg-chart-2/10 px-2 py-0.5 font-mono text-[10px] tabular-nums text-chart-2`,children:[`↺`,t.replace,` replace`]}),t.delete>0&&(0,J.jsxs)(`span`,{className:`inline-flex items-center rounded-[var(--miravo-radius-tight)] border border-destructive/25 bg-destructive/10 px-2 py-0.5 font-mono text-[10px] tabular-nums text-destructive`,children:[`−`,t.delete,` remove`]}),t.noop>0&&(0,J.jsxs)(`span`,{className:`inline-flex items-center rounded-[var(--miravo-radius-tight)] border border-border/50 bg-muted/50 px-2 py-0.5 font-mono text-[10px] tabular-nums text-foreground/75`,children:[`=`,t.noop,` unchanged`]}),t.blocked>0&&(0,J.jsxs)(`span`,{className:`inline-flex items-center rounded-[var(--miravo-radius-tight)] border border-warning/25 bg-warning/10 px-2 py-0.5 font-mono text-[10px] tabular-nums text-warning`,children:[t.blocked,` skipped`]})]})]})}function qt({plan:e,onCloseTable:t,planKind:n=`apply`}){return e.entries.length===0?(0,J.jsxs)(`div`,{className:`overflow-hidden rounded-[var(--miravo-radius-stadium-sm)] border border-dashed border-border/55`,children:[(0,J.jsx)(Ut,{onCloseTable:t,planKind:n}),(0,J.jsx)(Gt,{plan:e,planKind:n}),(0,J.jsxs)(`div`,{className:`flex flex-col items-center gap-3 px-4 py-10 text-center`,children:[(0,J.jsx)(`div`,{className:`flex size-12 items-center justify-center rounded-[var(--miravo-radius-stadium-sm)] border border-border/50`,children:(0,J.jsx)(ge,{className:`size-6 text-muted-foreground/45`,"aria-hidden":!0})}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`p`,{className:`font-heading text-sm font-semibold tracking-tight text-foreground`,children:n===`cleanup`?`Nothing to remove`:`Nothing to change`}),(0,J.jsx)(`p`,{className:`mx-auto mt-2 max-w-sm text-[11px] leading-relaxed text-muted-foreground`,children:n===`cleanup`?`No Miravo-managed resources matched this cleanup scope on the environment — nothing would be deleted.`:`This environment already matches what is on the target — no create or update steps.`})]})]})]}):(0,J.jsxs)(`div`,{className:`overflow-hidden rounded-[var(--miravo-radius-stadium-sm)] border border-border/45`,children:[(0,J.jsx)(Ut,{onCloseTable:t,planKind:n}),(0,J.jsx)(Gt,{plan:e,planKind:n}),(0,J.jsx)(Kt,{entries:e.entries}),(0,J.jsx)(`div`,{className:`overflow-x-auto`,children:(0,J.jsxs)(`table`,{className:`w-full min-w-lg text-xs`,children:[(0,J.jsx)(`caption`,{className:`sr-only`,children:n===`cleanup`?`Detailed list of planned cleanup actions in deletion order`:`Detailed list of create, update, and delete actions in deployment order`}),(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{className:`border-b border-border/45`,children:[(0,J.jsx)(`th`,{scope:`col`,className:`sticky top-0 z-10 bg-background px-3 py-2 text-left font-heading text-[9px] font-semibold uppercase tracking-[0.14em] text-muted-foreground sm:px-3.5`,children:`Action`}),(0,J.jsx)(`th`,{scope:`col`,className:`sticky top-0 z-10 bg-background px-3 py-2 text-left font-heading text-[9px] font-semibold uppercase tracking-[0.14em] text-muted-foreground sm:px-3.5`,children:`Type`}),(0,J.jsx)(`th`,{scope:`col`,className:`sticky top-0 z-10 bg-background px-3 py-2 text-left font-heading text-[9px] font-semibold uppercase tracking-[0.14em] text-muted-foreground sm:px-3.5`,children:`Name`}),(0,J.jsx)(`th`,{scope:`col`,className:`sticky top-0 z-10 hidden bg-background px-3 py-2 text-left font-heading text-[9px] font-semibold uppercase tracking-[0.14em] text-muted-foreground sm:table-cell sm:px-3.5`,children:`Protocol`}),(0,J.jsx)(`th`,{scope:`col`,className:`sticky top-0 z-10 hidden bg-background px-3 py-2 text-left font-heading text-[9px] font-semibold uppercase tracking-[0.14em] text-muted-foreground md:table-cell md:px-3.5`,children:`Detail`})]})}),(0,J.jsx)(`tbody`,{children:e.entries.map((e,t)=>(0,J.jsxs)(`tr`,{className:T(`border-b border-border/25 transition-colors`,t%2==1?`bg-muted/35`:`bg-transparent`,`hover:bg-primary/4`),children:[(0,J.jsx)(`td`,{className:`px-3 py-2 align-middle sm:px-3.5`,children:(0,J.jsx)(W,{variant:`outline`,className:T(`border px-1.5 py-0 font-mono text-[10px] uppercase tracking-wide`,Wt[e.action]),children:e.action})}),(0,J.jsx)(`td`,{className:`px-3 py-2 align-middle font-mono text-[11px] text-foreground sm:px-3.5`,children:e.resourceType}),(0,J.jsx)(`td`,{className:`max-w-[min(16rem,28vw)] truncate px-3 py-2 align-middle font-mono text-[11px] text-foreground sm:max-w-xs sm:px-3.5`,children:e.name}),(0,J.jsx)(`td`,{className:`hidden px-3 py-2 align-middle font-mono text-[11px] text-muted-foreground sm:table-cell sm:px-3.5`,children:e.protocol??`—`}),(0,J.jsx)(`td`,{className:`hidden max-w-xs truncate px-3 py-2 align-middle text-[11px] text-muted-foreground md:table-cell md:px-3.5`,children:e.blockReason??e.detail??`—`})]},`${e.action}-${e.resourceType}-${e.name}-${e.protocol??``}-${e.detail??e.blockReason??``}`))})]})}),(0,J.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-border/40 px-3 py-3 text-[10px] text-muted-foreground sm:flex-row sm:items-center sm:justify-between sm:gap-4 sm:px-4`,children:[(0,J.jsxs)(`span`,{children:[(0,J.jsx)(`span`,{className:`font-mono tabular-nums text-foreground/90`,children:e.entries.length}),` `,(0,J.jsxs)(`span`,{className:`text-muted-foreground/90`,children:[e.entries.length===1?`action`:`actions`,` queued`]})]}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 font-mono text-[10px] wrap-anywhere`,children:[(0,J.jsx)(`span`,{className:`shrink-0 text-[9px] uppercase tracking-wider text-muted-foreground/80`,children:`Scope`}),(0,J.jsx)(`span`,{className:`min-w-0 text-foreground/90`,children:Ht(e.scope)})]})]})]})}var Jt=[`s1`,`s2`,`s3`,`s4`];function Yt(){return(0,J.jsxs)(`div`,{className:`overflow-hidden rounded-[var(--miravo-radius-stadium-sm)] border border-border/45`,role:`status`,"aria-busy":`true`,"aria-live":`polite`,children:[(0,J.jsx)(`span`,{className:`sr-only`,children:`Loading plan preview`}),(0,J.jsx)(`div`,{className:`border-b border-border/40 px-3 py-3 sm:px-4`,children:(0,J.jsxs)(`div`,{className:`flex gap-3`,children:[(0,J.jsx)(Y,{className:`size-10 shrink-0 rounded-[var(--miravo-radius-stadium-sm)]`}),(0,J.jsx)(`div`,{className:`flex min-w-0 flex-1 items-start gap-1 pt-0.5 sm:gap-2`,children:(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-2`,children:[(0,J.jsx)(Y,{className:`h-3.5 w-40`}),(0,J.jsx)(Y,{className:`h-4 w-11 rounded-[var(--miravo-radius-tight)] border`})]}),(0,J.jsx)(Y,{className:`mt-1.5 h-3 max-w-prose`})]})})]})}),(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-border/35 px-3 py-2.5 sm:px-4`,children:[(0,J.jsx)(Y,{className:`h-2.5 w-14`}),(0,J.jsx)(Y,{className:`hidden h-3 w-px shrink-0 sm:block`}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-2`,children:[(0,J.jsx)(Y,{className:`h-5 w-18 rounded-[var(--miravo-radius-tight)]`}),(0,J.jsx)(Y,{className:`h-5 w-24 rounded-[var(--miravo-radius-tight)]`}),(0,J.jsx)(Y,{className:`h-5 w-20 rounded-[var(--miravo-radius-tight)]`})]})]}),(0,J.jsx)(`div`,{className:`overflow-x-auto`,children:(0,J.jsxs)(`table`,{className:`w-full min-w-lg text-xs`,"aria-hidden":!0,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{className:`border-b border-border/45`,children:[(0,J.jsx)(`th`,{scope:`col`,className:`sticky top-0 z-10 bg-background px-3 py-2 text-left sm:px-3.5`,children:(0,J.jsx)(Y,{className:`h-2.5 w-12`})}),(0,J.jsx)(`th`,{scope:`col`,className:`sticky top-0 z-10 bg-background px-3 py-2 text-left sm:px-3.5`,children:(0,J.jsx)(Y,{className:`h-2.5 w-9`})}),(0,J.jsx)(`th`,{scope:`col`,className:`sticky top-0 z-10 bg-background px-3 py-2 text-left sm:px-3.5`,children:(0,J.jsx)(Y,{className:`h-2.5 w-10`})}),(0,J.jsx)(`th`,{scope:`col`,className:`sticky top-0 z-10 hidden bg-background px-3 py-2 text-left sm:table-cell sm:px-3.5`,children:(0,J.jsx)(Y,{className:`h-2.5 w-14`})}),(0,J.jsx)(`th`,{scope:`col`,className:`sticky top-0 z-10 hidden bg-background px-3 py-2 text-left md:table-cell md:px-3.5`,children:(0,J.jsx)(Y,{className:`h-2.5 w-11`})})]})}),(0,J.jsx)(`tbody`,{children:Jt.map((e,t)=>(0,J.jsxs)(`tr`,{className:T(`border-b border-border/25 transition-colors`,t%2==1?`bg-muted/35`:`bg-transparent`,`hover:bg-primary/4`),children:[(0,J.jsx)(`td`,{className:`px-3 py-2 align-middle sm:px-3.5`,children:(0,J.jsx)(Y,{className:`h-5 w-13 rounded-[var(--miravo-radius-tight)]`})}),(0,J.jsx)(`td`,{className:`px-3 py-2 align-middle sm:px-3.5`,children:(0,J.jsx)(Y,{className:`h-3.5 w-16 font-mono`})}),(0,J.jsx)(`td`,{className:`max-w-[min(16rem,28vw)] px-3 py-2 align-middle sm:max-w-xs sm:px-3.5`,children:(0,J.jsx)(Y,{className:`h-3.5 w-full max-w-48 font-mono`})}),(0,J.jsx)(`td`,{className:`hidden px-3 py-2 align-middle sm:table-cell sm:px-3.5`,children:(0,J.jsx)(Y,{className:`h-3.5 w-10 font-mono`})}),(0,J.jsx)(`td`,{className:`hidden max-w-xs px-3 py-2 align-middle md:table-cell md:px-3.5`,children:(0,J.jsx)(Y,{className:`h-3.5 w-full max-w-40`})})]},e))})]})}),(0,J.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-border/40 px-3 py-3 text-[10px] text-muted-foreground sm:flex-row sm:items-center sm:justify-between sm:gap-4 sm:px-4`,children:[(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,J.jsx)(Y,{className:`inline-block h-3 w-6 rounded-[var(--miravo-radius-tight)]`}),(0,J.jsx)(Y,{className:`inline-block h-3 w-28`})]}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 font-mono text-[10px] wrap-anywhere`,children:[(0,J.jsx)(Y,{className:`h-2.5 w-8 shrink-0`}),(0,J.jsx)(Y,{className:`h-6 min-w-32 rounded-[var(--miravo-radius-tight)] border border-border/50 px-2 py-0.5`}),(0,J.jsx)(Y,{className:`h-1 w-1 shrink-0 rounded-full`}),(0,J.jsx)(Y,{className:`h-2.5 w-10 shrink-0`}),(0,J.jsx)(Y,{className:`h-3 min-w-16 max-w-56 flex-1`})]})]})]})}function Xt({stream:e,className:t}){let n=Nt(e);if(!n)return null;let r=e.status===`running`,i=e.status===`error`,a=e.status===`complete`&&e.operation?.status===`cancelled`,o=e.status===`complete`&&!a;return(0,J.jsxs)(`span`,{className:T(`inline-flex h-6 w-fit min-w-0 shrink-0 items-center justify-center gap-1 rounded-full border px-2 py-0`,`text-xs font-medium leading-none tracking-wide uppercase shadow-[inset_0_1px_0_0_rgba(255,255,255,0.05)]`,t,o&&`border-success/45 bg-success/[0.1] text-success`,a&&`border-muted-foreground/30 bg-muted/[0.1] text-muted-foreground shadow-none`,i&&`border-destructive/50 bg-destructive/[0.1] text-destructive shadow-none`,r&&`border-primary/40 bg-primary/[0.1] text-primary border-primary/35`),children:[o?(0,J.jsx)(x,{className:`size-3 shrink-0 opacity-95`,strokeWidth:2.5,"aria-hidden":!0}):a?(0,J.jsx)(pe,{className:`size-3 shrink-0 opacity-95`,"aria-hidden":!0}):i?(0,J.jsx)(B,{className:`size-3 shrink-0 opacity-95`,"aria-hidden":!0}):(0,J.jsx)(I,{className:`size-3 shrink-0 animate-spin`,"aria-hidden":!0}),n]})}var Zt={status:`idle`,operation:null,error:null,logs:[],cancelRequested:!1},Qt=200;function $t(){let[e,t]=(0,q.useState)(Zt),n=(0,q.useRef)(null),r=(0,q.useRef)(0),i=(0,q.useRef)(0),a=(0,q.useCallback)(e=>{let n=de(e,`Platform operation failed.`),r=fe(e),i=r?`${n} ${r}`:n;t(e=>({...e,status:`error`,cancelRequested:!1,error:i,operation:e.operation?{...e.operation,status:`error`,error:i}:null}))},[]),o=(0,q.useCallback)(e=>{switch(e.event){case`accepted`:en(e.data,t);break;case`log`:nn({...e.data,id:`log-${r.current++}`},t);break;case`started`:rn(e.data,t);break;case`phase`:an(e.data,t);break;case`resource`:on(e.data,t);break;case`complete`:sn(e.data,t);break;case`cancelled`:ln(e.data,t);break;case`retrying`:un(e.data,t);break;case`error`:a(Error(e.data.message));break}},[a]),s=(0,q.useCallback)(e=>{let s=++i.current;n.current?.abort(),r.current=0,t({status:`running`,operation:null,error:null,logs:[],cancelRequested:!1}),n.current=At(e,e=>{i.current===s&&(o(e),dn(e)&&(n.current?.abort(),n.current=null))},e=>{i.current===s&&(n.current=null,a(e))})},[o,a]),c=(0,q.useCallback)(e=>{let s=++i.current;n.current?.abort(),r.current=0,t({status:`running`,operation:null,error:null,logs:[],cancelRequested:!1}),n.current=jt(e,e=>{i.current===s&&(o(e),dn(e)&&(n.current?.abort(),n.current=null))},e=>{i.current===s&&(n.current=null,a(e))})},[o,a]),l=(0,q.useCallback)(()=>{i.current++,n.current?.abort(),n.current=null,t(Zt)},[]),u=(0,q.useCallback)(async()=>{let n=e.operation?.operationId;if(!(!n||e.status!==`running`||e.cancelRequested)){t(e=>cn(e,n));try{await kt(n)||a(Error(`Operation finished before cancellation was accepted.`))}catch(e){a(e instanceof Error?e:Error(`Cancellation failed.`))}}},[e.operation?.operationId,e.status,e.cancelRequested,a]);return(0,q.useEffect)(()=>()=>{i.current++,n.current?.abort(),n.current=null},[]),{...e,startApply:s,startCleanup:c,reset:l,cancel:u}}function en(e,t){t(t=>({...t,status:`running`,cancelRequested:!1,error:null,operation:{operationId:e.operationId,type:e.type,label:e.template??e.model??(e.type===`apply`?`Preparing apply`:`Preparing cleanup`),environment:e.targetId??`Resolving target`,totalPlanned:0,phases:[],applied:0,failed:0,status:`running`,startedAt:Date.now()}}))}function tn(e){return(e.template??e.model)||(e.type===`cleanup`?`All managed resources`:`unknown`)}function nn(e,t){t(t=>({...t,logs:[...t.logs,e].slice(-Qt)}))}function rn(e,t){t(t=>({...t,status:`running`,cancelRequested:!1,error:null,operation:{operationId:e.operationId,type:e.type,label:tn(e),environment:e.environment,totalPlanned:e.totalPlanned,phases:[],applied:0,failed:0,status:`running`,startedAt:Date.now(),attempt:e.attempt,maxAttempts:e.maxAttempts}}))}function an(e,t){t(t=>{if(!$(t,e.operationId))return t;let n=t.operation.phases.map(e=>e.status===`active`?{...e,status:`done`}:e),r=n.findIndex(t=>t.name===e.phase),i=r>=0?n.map((t,n)=>n===r?{...t,status:`active`,total:e.total}:t):[...n,{name:e.phase,total:e.total,resources:[],status:`active`}];return{...t,operation:{...t.operation,phases:i}}})}function on(e,t){t(t=>{if(!$(t,e.operationId))return t;let n={name:e.name,action:e.action,status:e.status,error:e.error},r=t.operation.phases.map(t=>t.name===e.phase&&t.status===`active`?{...t,resources:[...t.resources,n]}:t);return{...t,operation:{...t.operation,phases:r,applied:t.operation.applied+ +(e.status===`success`&&e.action!==`noop`),failed:t.operation.failed+ +(e.status===`failed`)}}})}function sn(e,t){t(t=>{if(!$(t,e.operationId))return t;let n=t.operation.phases.map(e=>e.status===`active`?{...e,status:`done`}:e);return{...t,status:`complete`,cancelRequested:!1,error:null,operation:{...t.operation,phases:n,applied:e.applied??e.deleted??0,failed:e.failed,duration:e.duration,status:`complete`}}})}function cn(e,t){return!$(e,t)||e.status!==`running`?e:{...e,cancelRequested:!0}}function ln(e,t){t(t=>{if(!$(t,e.operationId))return t;let n=t.operation.phases.map(e=>e.status===`active`?{...e,status:`done`}:e);return{...t,status:`complete`,cancelRequested:!1,error:null,operation:{...t.operation,phases:n,applied:e.applied??e.deleted??0,failed:e.failed,duration:e.duration,status:`cancelled`}}})}function un(e,t){t(t=>$(t,e.operationId)?{...t,status:`running`,cancelRequested:!1,error:null,operation:{...t.operation,status:`running`,retryPending:!0,retryDelayMs:e.delayMs,attempt:e.attempt,maxAttempts:e.maxAttempts,error:e.error,applied:0,failed:0,phases:[]}}:t)}function $(e,t){return e.operation?.operationId===t}function dn(e){return e.event===`complete`||e.event===`cancelled`||e.event===`error`}export{Ce as A,Re as C,Le as D,Ie as E,he as F,xe as M,be as N,Ee as O,ye as P,ze as S,Fe as T,mt as _,Vt as a,dt as b,St as c,xt as d,Dt as f,vt as g,bt as h,Yt as i,Se as j,De as k,wt as l,Ct as m,Xt as n,Bt as o,Et as p,qt as r,Pt as s,$t as t,Ot as u,pt as v,X as w,We as x,ft as y};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/fleet-D3Y6h1O_.js","assets/fleet-C2Ipwzu5.js","assets/rolldown-runtime-COnpUsM8.js","assets/chunk-OE4NN4TA-DBWZidbW.js","assets/vendor-charts-95ykyDlI.js","assets/api-5BZroqlO.js","assets/vendor-ui-CWUk2ulb.js","assets/format-B9CcV2dj.js","assets/utils-XFKvwlFT.js","assets/arrow-right-BjBb4z7g.js","assets/arrow-up-down-C1oJAmrw.js","assets/select-CMOnuEoT.js","assets/circle-question-mark-CJvcT6V6.js","assets/dist-xY0pK9Wy.js","assets/shallow-Cin0mLuv.js","assets/badge-i00PiRCo.js","assets/combobox-BJecIYHE.js","assets/select-display-items-Bqb6Sbg6.js","assets/tooltip-D1ydB4g3.js","assets/transition-types-CPlGtM8w.js","assets/catalog-BRYmHbXV.js","assets/catalog-B477tO5a.js","assets/query-fetch-error-2yqCNP9X.js","assets/AnimatePresence-CPmH1DMY.js","assets/proxy-Be4WzmcS.js","assets/use-platform-stream-BBDJCrNY.js","assets/platform-targets-BIQ1lKOg.js","assets/tabs-D64chVAn.js","assets/copy-button-DnGsXbVV.js","assets/checkbox-C84IyqEB.js","assets/triangle-alert-BXrJNk3g.js","assets/label-DTHSKF2S.js","assets/get-error-message-CFs0lSQP.js","assets/catalog-template-icons-3S8RvUxD.js","assets/catalog-source-DL6GXE84.js","assets/download-DmUZKo9N.js","assets/use-engine-command-mutation-CIly3RgV.js","assets/runtime-link-D-uJbw97.js","assets/models-C57soXUz.js","assets/models-CX3jQBRk.js","assets/activity-Cy_niK56.js","assets/spawn-protocol-scope-picker-DUXJ8giB.js","assets/events-BvwhACji.js","assets/events-przfMV9x.js","assets/auth-screen-backdrop-CgwRhIbi.js","assets/control-Dc6xLiUf.js","assets/control-HqgjVMLG.js","assets/validation-Bt4EQDja.js","assets/layers-1figUpjG.js","assets/transition-nav-link-CDSeWWsP.js","assets/tags-BbNGPS4O.js","assets/tags-Cl6Nj2-E.js","assets/vendor-table-BAHQgdwg.js","assets/dropdown-menu-82O7jPU6.js","assets/platforms-DMUEIKyH.js","assets/platforms-nMtu3Mg5.js","assets/instance-detail-CQ6RO9hI.js","assets/login-CtfweHfy.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{c as n,d as r}from"./chunk-OE4NN4TA-DBWZidbW.js";var i=e(t(),1),a=[{test:e=>e===`/`,load:()=>r(()=>import(`./fleet-D3Y6h1O_.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]))},{test:e=>e===`/catalog`,load:()=>r(()=>import(`./catalog-BRYmHbXV.js`),__vite__mapDeps([20,21,2,5,4,6,22,7,8,23,24,25,11,26,27,12,28,18,29,30,15,31,32,33,34,35,36,37]))},{test:e=>e===`/models`,load:()=>r(()=>import(`./models-C57soXUz.js`),__vite__mapDeps([38,39,2,5,4,6,22,7,8,23,24,40,25,11,26,27,12,28,18,29,30,15,31,32,34,35,36,37,41]))},{test:e=>e===`/events`,load:()=>r(()=>import(`./events-BvwhACji.js`),__vite__mapDeps([42,43,2,3,4,5,6,22,7,8,23,24,11,44,15,16,17,32,37,19]))},{test:e=>e===`/control`,load:()=>r(()=>import(`./control-Dc6xLiUf.js`),__vite__mapDeps([45,46,2,5,4,6,7,8,23,24,40,9,11,27,28,18,47,29,48,36,37,30,13,14,41,31,49,3,15,16]))},{test:e=>e===`/tags`,load:()=>r(()=>import(`./tags-BbNGPS4O.js`),__vite__mapDeps([50,51,2,3,4,5,6,22,7,8,52,10,11,26,28,18,35,13,44,16,53,31,32]))},{test:e=>e===`/platforms`,load:()=>r(()=>import(`./platforms-DMUEIKyH.js`),__vite__mapDeps([54,55,2,3,4,5,6,22,7,8,23,24,40,9,25,11,26,27,12,28,18,29,30,15,31,32,33,48,13,53]))},{test:e=>e.startsWith(`/instance/`),load:()=>r(()=>import(`./instance-detail-CQ6RO9hI.js`),__vite__mapDeps([56,2,3,4,5,6,22,7,8,24,40,27,28,18,47,36,37,30,13,44,15,32,19]))},{test:e=>e===`/login`,load:()=>r(()=>import(`./login-CtfweHfy.js`),__vite__mapDeps([57,2,5,4,6,49,3,32]))}],o=new Set;function s(e){if(!e.startsWith(`/`))return null;let t=e.indexOf(`?`),n=e.indexOf(`#`),r=t===-1?n===-1?e.length:n:n===-1?t:Math.min(t,n);return e.slice(0,r)}function c(e){let t=s(e);if(!t||o.has(t))return;let n=a.find(e=>e.test(t));n&&(o.add(t),n.load().catch(()=>{o.delete(t)}))}function l(){let e=n();return(0,i.useCallback)((t,n)=>{n?.preload!==!1&&c(t),(0,i.startTransition)(()=>{n?.transitionType&&(0,i.addTransitionType)(n.transitionType),e(t,{replace:n?.replace})})},[e])}export{c as n,l as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{at as e,et as t}from"./vendor-ui-CWUk2ulb.js";import{J as n,M as r,O as i,Y as a,Z as o}from"./api-5BZroqlO.js";import{l as s}from"./copy-button-DnGsXbVV.js";import{n as c,t as l}from"./utils-XFKvwlFT.js";import"./tabs-D64chVAn.js";var u=c(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),d=c(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),f=e();function p({className:e,orientation:n=`horizontal`,...r}){return(0,f.jsx)(t,{"data-slot":`separator`,orientation:n,className:l(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,e),...r})}function m(){return o().trim().optional().refine(e=>e===void 0||e===``||e.length<=120,{message:`Use at most 120 characters.`}).refine(e=>e===void 0||e===``||r(e)===null,{message:`Use letters, numbers, underscores, and hyphens only.`})}var h=a({multiplier:n({message:`Speed multiplier must be a number.`}).positive(`Speed multiplier must be positive.`).finite(`Speed multiplier must be finite.`).max(1e3,`Speed multiplier cannot exceed 1000.`)}),g=a({model:o().min(1,`Model is required.`),count:n({message:`Count must be a number.`}).int(`Count must be a whole number.`).positive(`Count must be at least 1.`).max(100,`Count cannot exceed 100.`),instanceName:m(),instancePrefix:m(),protocolScope:i.optional()}),_=a({instanceId:o().min(1,`Instance is required.`),fault:o().min(1,`Fault name is required.`)}),v=a({instanceId:o().min(1,`Instance is required.`)});function y(e,t,n){if(!t.trim())return s.error(`Argument "${e}" is required.`),null;switch(n){case`Double`:case`Float`:{let n=Number(t);return Number.isFinite(n)?{value:n}:(s.error(`"${e}" must be a valid number.`),null)}case`Int32`:case`UInt16`:case`UInt32`:{let r=Number(t);return!Number.isFinite(r)||!Number.isSafeInteger(r)?(s.error(`"${e}" must be a valid integer.`),null):(n===`UInt16`||n===`UInt32`)&&r<0?(s.error(`"${e}" must be non-negative.`),null):{value:r}}case`Boolean`:return t!==`true`&&t!==`false`?(s.error(`"${e}" must be "true" or "false".`),null):{value:t===`true`};case`String`:return{value:t};default:return{value:t}}}function b(e,t){let n=e.safeParse(t);return n.success?n.data:(s.error(n.error.issues[0]?.message??`Validation error.`),null)}export{b as a,d as c,g as i,u as l,v as n,y as o,h as r,p as s,_ as t};
|
/package/console-dist/assets/{platform-targets-BIQ1lKOg.js → integration-targets-ChYQ8POe.js}
RENAMED
|
File without changes
|