@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.
Files changed (68) hide show
  1. package/console-dist/assets/api-0DOQsu1W.js +1 -0
  2. package/console-dist/assets/api-DdyA1QMC.js +1 -0
  3. package/console-dist/assets/asset-detail-D-coMgED.js +1 -0
  4. package/console-dist/assets/{badge-i00PiRCo.js → badge-DuuEINVl.js} +1 -1
  5. package/console-dist/assets/catalog-Ca9rhNLN.js +1 -0
  6. package/console-dist/assets/catalog-CdbAE0Ki.js +1 -0
  7. package/console-dist/assets/catalog-source-CPFWtBJF.js +1 -0
  8. package/console-dist/assets/catalog-template-icons-aec8m5-A.js +1 -0
  9. package/console-dist/assets/{checkbox-C84IyqEB.js → checkbox-BL44aFel.js} +1 -1
  10. package/console-dist/assets/{combobox-BJecIYHE.js → combobox-B5iFVe7N.js} +1 -1
  11. package/console-dist/assets/control-CtvncuAA.js +1 -0
  12. package/console-dist/assets/control-DYdEZmP0.js +1 -0
  13. package/console-dist/assets/{copy-button-DnGsXbVV.js → copy-button-RVCJ3aqM.js} +1 -1
  14. package/console-dist/assets/events-Bp3BqWYo.js +1 -0
  15. package/console-dist/assets/events-D5uZ2cwr.js +1 -0
  16. package/console-dist/assets/fleet-CBXZ0Xts.js +1 -0
  17. package/console-dist/assets/fleet-CRB8-QDg.js +1 -0
  18. package/console-dist/assets/{format-B9CcV2dj.js → format-6q8Tnwmn.js} +1 -1
  19. package/console-dist/assets/{get-error-message-CFs0lSQP.js → get-error-message-BowDodwy.js} +1 -1
  20. package/console-dist/assets/index-BPmjm3uU.css +2 -0
  21. package/console-dist/assets/index-Chh5Cd8X.js +12 -0
  22. package/console-dist/assets/integrations-BrZWbG5Q.js +1 -0
  23. package/console-dist/assets/integrations-D4x6ee5M.js +1 -0
  24. package/console-dist/assets/{login-CtfweHfy.js → login-O9dnrHI9.js} +2 -2
  25. package/console-dist/assets/models-BDeOqKQk.js +1 -0
  26. package/console-dist/assets/models-CgWCVmnx.js +1 -0
  27. package/console-dist/assets/{query-fetch-error-2yqCNP9X.js → query-fetch-error-ytmF7SP9.js} +1 -1
  28. package/console-dist/assets/{select-CMOnuEoT.js → select-Cg2u0NQI.js} +1 -1
  29. package/console-dist/assets/{select-display-items-Bqb6Sbg6.js → select-display-items-BEVMAho-.js} +1 -1
  30. package/console-dist/assets/{spawn-protocol-scope-picker-DUXJ8giB.js → spawn-protocol-scope-picker-DDi-hZwj.js} +1 -1
  31. package/console-dist/assets/tabs-BJs5Kci7.js +1 -0
  32. package/console-dist/assets/tags-CcmWc8Xj.js +1 -0
  33. package/console-dist/assets/tags-DnyhyxDB.js +4 -0
  34. package/console-dist/assets/{transition-nav-link-CDSeWWsP.js → transition-nav-link-Crj9XTbK.js} +1 -1
  35. package/console-dist/assets/use-engine-command-mutation-OZ8_Roso.js +1 -0
  36. package/console-dist/assets/use-integration-stream-CFkuEB9r.js +2 -0
  37. package/console-dist/assets/use-transition-navigate-BBXUEW59.js +2 -0
  38. package/console-dist/assets/validation-BvXCKp12.js +1 -0
  39. package/console-dist/index.html +29 -29
  40. package/miravo +2 -2
  41. package/package.json +1 -1
  42. package/console-dist/assets/api-5BZroqlO.js +0 -1
  43. package/console-dist/assets/api-BwgmLQCC.js +0 -1
  44. package/console-dist/assets/catalog-B477tO5a.js +0 -1
  45. package/console-dist/assets/catalog-BRYmHbXV.js +0 -1
  46. package/console-dist/assets/catalog-source-DL6GXE84.js +0 -1
  47. package/console-dist/assets/catalog-template-icons-3S8RvUxD.js +0 -1
  48. package/console-dist/assets/control-Dc6xLiUf.js +0 -1
  49. package/console-dist/assets/control-HqgjVMLG.js +0 -1
  50. package/console-dist/assets/events-BvwhACji.js +0 -1
  51. package/console-dist/assets/events-przfMV9x.js +0 -1
  52. package/console-dist/assets/fleet-C2Ipwzu5.js +0 -1
  53. package/console-dist/assets/fleet-D3Y6h1O_.js +0 -1
  54. package/console-dist/assets/index-AfBFCD9D.js +0 -12
  55. package/console-dist/assets/index-DmjK3skd.css +0 -2
  56. package/console-dist/assets/instance-detail-CQ6RO9hI.js +0 -1
  57. package/console-dist/assets/models-C57soXUz.js +0 -1
  58. package/console-dist/assets/models-CX3jQBRk.js +0 -1
  59. package/console-dist/assets/platforms-DMUEIKyH.js +0 -1
  60. package/console-dist/assets/platforms-nMtu3Mg5.js +0 -1
  61. package/console-dist/assets/tabs-D64chVAn.js +0 -1
  62. package/console-dist/assets/tags-BbNGPS4O.js +0 -1
  63. package/console-dist/assets/tags-Cl6Nj2-E.js +0 -4
  64. package/console-dist/assets/use-engine-command-mutation-CIly3RgV.js +0 -1
  65. package/console-dist/assets/use-platform-stream-BBDJCrNY.js +0 -2
  66. package/console-dist/assets/use-transition-navigate-Bxh77tVE.js +0 -2
  67. package/console-dist/assets/validation-Bt4EQDja.js +0 -1
  68. /package/console-dist/assets/{platform-targets-BIQ1lKOg.js → integration-targets-ChYQ8POe.js} +0 -0
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{at as n}from"./vendor-ui-CWUk2ulb.js";import{S as r,dt as i,ft as a,o,ut as s,v as c,y as l}from"./api-DdyA1QMC.js";import{a as u,c as d,i as f,r as p,t as m}from"./query-fetch-error-ytmF7SP9.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 ee,o as C,r as te,s as w,t as T}from"./copy-button-RVCJ3aqM.js";import{C as E,S as D,T as O,d as k,h as A,o as j,w as M}from"./format-6q8Tnwmn.js";import{n as N,t as P}from"./utils-XFKvwlFT.js";import{t as F}from"./activity-Cy_niK56.js";import{t as I}from"./arrow-right-BjBb4z7g.js";import{D as L,E as R,F as z,I as B,M as ne,N as V,P as re,S as ie,_ as ae,a as oe,b as H,c as U,d as se,f as ce,g as le,h as ue,i as de,l as fe,m as pe,n as me,o as he,p as ge,r as _e,s as ve,t as ye,u as be,v as xe,x as Se}from"./use-integration-stream-CFkuEB9r.js";import{n as Ce,t as we}from"./catalog-template-icons-aec8m5-A.js";import{c as Te,i as W,l as Ee,n as De,s as Oe,t as ke}from"./select-Cg2u0NQI.js";import{a as Ae,i as je,r as G}from"./integration-targets-ChYQ8POe.js";import{c as Me,i as Ne,n as Pe,o as Fe,r as Ie,s as Le,t as Re}from"./tabs-BJs5Kci7.js";import{i as ze,n as K,r as Be,t as Ve}from"./checkbox-BL44aFel.js";import{t as He}from"./layers-1figUpjG.js";import{t as Ue}from"./triangle-alert-BXrJNk3g.js";import{i as We,n as Ge,t as Ke}from"./tooltip-D1ydB4g3.js";import{t as qe}from"./badge-DuuEINVl.js";import{a as Je,i as Ye,n as Xe,o as Ze,r as Qe,s as $e,t as et}from"./dropdown-menu-82O7jPU6.js";import{t as tt}from"./label-DTHSKF2S.js";import{n as q,t as nt}from"./get-error-message-BowDodwy.js";var rt=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:a()})}getOptimisticResult(e){return e.behavior=a(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:a,isRefetching:o,isError:c,isRefetchError:l}=r,u=n.fetchMeta?.fetchMore?.direction,d=c&&u===`forward`,f=a&&u===`forward`,p=c&&u===`backward`,m=a&&u===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:s(t,n.data),hasPreviousPage:i(t,n.data),isFetchNextPageError:d,isFetchingNextPage:f,isFetchPreviousPageError:p,isFetchingPreviousPage:m,isRefetchError:l&&!d&&!p,isRefetching:o&&!f&&!m}}};function it(e,t){return u(e,rt,t)}var at=N(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]),ot=N(`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`}]]),st=N(`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`}]]),ct=N(`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`}]]),J=e(t(),1),Y=n(),lt=`rounded-(--miravo-radius-stadium-sm) border border-dashed border-border/55 bg-muted/10`;function ut(){return(0,Y.jsx)(`p`,{className:`mt-2 text-pretty text-sm leading-relaxed text-muted-foreground`,children:`Add a target to get started.`})}function dt({onClick:e}){return(0,Y.jsxs)(E,{type:`button`,size:`sm`,className:`h-7 shrink-0 gap-1.5 text-xs`,onClick:e,children:[(0,Y.jsx)(z,{className:`size-3.5`,"aria-hidden":!0}),`Add Target`]})}function ft({titleId:e,frameIcon:t,description:n,children:r}){return(0,Y.jsx)(`section`,{"aria-labelledby":e,className:lt,children:(0,Y.jsxs)(`div`,{className:`flex flex-col items-center gap-4 px-4 py-10 text-center`,children:[(0,Y.jsx)(`div`,{className:`flex size-12 items-center justify-center rounded-(--miravo-radius-stadium-sm) border border-dashed border-border/50`,children:t}),(0,Y.jsxs)(`div`,{className:`max-w-sm`,children:[(0,Y.jsx)(`h2`,{id:e,className:`font-heading text-sm font-semibold tracking-tight text-foreground`,children:`No targets yet`}),n]}),r]})})}function pt({stream:e,onReset:t,catalogTemplates:n}){if(!e.operation&&e.status!==`running`)return null;let{title:r,subtitle:i}=ve(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,Y.jsx)(ae,{title:r,subtitle:i,canDismiss:!s,footerAction:s&&e.operation?.operationId?(0,Y.jsx)(`div`,{className:`ml-auto shrink-0`,children:(0,Y.jsx)(`button`,{type:`button`,onClick:u,disabled:l,"aria-busy":l,className:P(M({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,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Fe,{className:`size-3.5 shrink-0 animate-spin text-muted-foreground`,"aria-hidden":!0}),(0,Y.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,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(O,{className:`size-3.5 shrink-0 text-foreground/65 group-hover:text-destructive`,"aria-hidden":!0}),(0,Y.jsx)(h.span,{animate:{opacity:[1,.88,1]},transition:{duration:2.2,repeat:1/0,ease:`easeInOut`},children:`Cancel`})]})})}):c?(0,Y.jsxs)(`div`,{className:`flex w-full flex-col gap-1.5`,children:[(0,Y.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,Y.jsxs)(y,{to:`/integrations?tab=activity`,className:P(M({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,Y.jsx)(F,{className:`size-3 shrink-0 text-foreground/70 group-hover:text-primary`,"aria-hidden":!0}),`View full activity`,(0,Y.jsx)(Ae,{className:`size-2.5 shrink-0 text-foreground/50 group-hover:text-primary`,"aria-hidden":!0})]}),(0,Y.jsx)(`div`,{className:`flex shrink-0 items-center`,children:(0,Y.jsx)(E,{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,Y.jsx)(Se,{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,Y.jsx)(H,{operation:e.operation,catalogTemplates:n,logs:e.logs}):(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2 py-1`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(Fe,{className:`size-3.5 animate-spin text-primary`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`text-xs text-foreground/78`,children:`Connecting to Litmus Edge…`})]}),(0,Y.jsx)(`div`,{className:`h-1 w-full overflow-hidden rounded-full bg-muted/55`,children:(0,Y.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 mt=`miravo:integrations:recent-template-ids`,ht=8,gt=`miravo:integrations:last-target-id`;function X(){if(typeof window>`u`)return[];try{let e=window.localStorage.getItem(mt),t=e?JSON.parse(e):[];return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}function _t(e){if(typeof window>`u`)return;let t=[e,...X().filter(t=>t!==e)].slice(0,ht);try{window.localStorage.setItem(mt,JSON.stringify(t))}catch{}}function vt(){if(!(typeof window>`u`))try{return window.localStorage.getItem(gt)??void 0}catch{return}}function yt(e){if(!(typeof window>`u`))try{window.localStorage.setItem(gt,e)}catch{}}var bt=50;function xt({open:e,type:t,targetLabel:n,targetHostname:r,templates:i,templatesLoading:a,templatesError:o,onRetryTemplates:s,onOpenChange:c,onSelect:l}){let[u,d]=(0,J.useState)(``),[f,p]=(0,J.useState)(X),m=(0,J.useDeferredValue)(u);(0,J.useEffect)(()=>{e&&(d(``),p(X()))},[e]);let h=(0,J.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,bt),total:n.length,recentRank:t}},[i,m,f]),g=t===`apply`?`Apply template`:`Cleanup template`,_=e=>{_t(e.id),l(e)};return(0,Y.jsx)(ee,{open:e,onOpenChange:c,children:(0,Y.jsxs)(te,{className:`flex max-h-[82vh] min-h-0 flex-col gap-0 overflow-hidden p-0 sm:max-w-xl`,children:[(0,Y.jsxs)(`div`,{className:`shrink-0 border-b border-border/60 px-5 pb-3 pt-5`,children:[(0,Y.jsx)(w,{className:`text-sm font-semibold`,children:g}),(0,Y.jsxs)(x,{className:`mt-1 text-xs`,children:[n,` / `,r]})]}),(0,Y.jsx)(`div`,{className:`shrink-0 border-b border-border/45 px-5 py-3`,children:(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsx)(re,{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,Y.jsx)(D,{value:u,onChange:e=>d(e.currentTarget.value),className:`h-9 pl-8`,placeholder:`Search templates`,autoFocus:!0})]})}),(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-3 py-3`,children:a&&i.length===0?(0,Y.jsx)(`div`,{className:`rounded-[var(--miravo-radius-tight)] border border-border/50 px-3 py-2 text-xs text-muted-foreground`,children:`Loading templates...`}):o&&i.length===0?(0,Y.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,Y.jsx)(`span`,{children:`Could not load templates.`}),(0,Y.jsx)(E,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 text-warning hover:text-warning`,onClick:s,children:`Retry`})]}):h.items.length===0?(0,Y.jsx)(`div`,{className:`rounded-[var(--miravo-radius-tight)] border border-border/50 px-3 py-2 text-xs text-muted-foreground`,children:`No matching templates.`}):(0,Y.jsx)(`div`,{className:`flex flex-col gap-1`,children:h.items.map(e=>{let t=h.recentRank.has(e.id);return(0,Y.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,Y.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,Y.jsx)(we,{id:e.id,className:`size-3.5`})}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`truncate font-medium text-foreground`,children:e.name}),t?(0,Y.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,Y.jsxs)(`span`,{className:`mt-0.5 block truncate font-mono text-[11px] text-muted-foreground`,children:[e.id,` / `,e.assetCount,` assets`]})]})]},e.id)})})}),h.total>h.items.length?(0,Y.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 St({targets:e,stream:t}){let[n,i]=(0,J.useState)(`apply`),[a,s]=(0,J.useState)(``),[l,u]=(0,J.useState)(``),[d,p]=(0,J.useState)(!1),[g,_]=(0,J.useState)(null),[v,y]=(0,J.useState)(!1),[b,x]=(0,J.useState)(!1),[ee,C]=(0,J.useState)(!1),[te]=(0,J.useState)(vt),w=(0,J.useRef)(0),T=(0,J.useRef)(null),D=t.status===`running`,k=n===`apply`,A=f({queryKey:c.catalog.templates(),queryFn:()=>o(`/catalog/templates`,r.catalogTemplates)}),j=A.data??[],M=j.find(e=>e.id===l),N=e.find(e=>e.id===a),F=k?!!a&&!!l:!!a&&(d||!!l),I=(0,J.useCallback)(()=>{w.current+=1,T.current?.abort(),T.current=null,y(!1),_(null)},[]);(0,J.useEffect)(()=>{if(!(l||j.length===0||d))for(let e of X()){let t=j.find(t=>t.id===e);if(t){u(t.id);return}}},[l,j,d]);let z=(0,J.useCallback)(()=>{I(),S.message(`Preview cancelled`)},[I]),B=e=>{D||(i(e),I(),p(!1))},re=(0,J.useCallback)(async(e,n)=>{if(e===`apply`){if(!a||!l)return}else if(!a||!d&&!l)return;t.operation&&t.status!==`running`&&t.reset(),T.current?.abort(),w.current+=1;let r=w.current,i=new AbortController;T.current=i,y(!0),_(null);try{let t=e===`apply`?await ge(R({targetId:a,template:l,result:n}),{signal:i.signal}):await ce(L({targetId:a,template:l,allManaged:d,result:n}),{signal:i.signal});if(r!==w.current)return;_(t.plan)}catch(t){if(r!==w.current||oe(t))return;let n=q(t,e===`apply`?`Plan failed`:`Cleanup plan failed`),i=nt(t);S.error(n,i?{description:i}:void 0)}finally{r===w.current&&y(!1)}},[a,l,d,t]),ae=(0,J.useCallback)(e=>{x(!1),I(),yt(a),l&&_t(l),n===`apply`?t.startApply(R({targetId:a,template:l,result:e})):t.startCleanup(L({targetId:a,template:l,allManaged:d,result:e}))},[n,a,l,d,t,I]),H=!k&&d,U=F&&!D,se=k?Be:V,le=`Awaiting selection`;U&&(le=k?`Review apply`:`Review cleanup`);let fe=H?`All managed resources`:M?.name??`Select template`,pe=(0,Y.jsx)(He,{className:`size-3.5`,"aria-hidden":!0});H?pe=(0,Y.jsx)(V,{className:`size-3.5`,"aria-hidden":!0}):M&&(pe=(0,Y.jsx)(we,{id:M.id,className:`size-3.5`}));let he=k?`Provisions devices, tags, and Digital Twin models from the selected template on the selected target.`:`Removes Miravo-managed resources for this template from the selected target.`;H&&(he=`Removes all Miravo-managed resources from the target (ignores template scope).`);let ve=N?`${N.label} / ${fe}`:`Select target and template`;return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,Y.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,Y.jsxs)(`button`,{type:`button`,"aria-pressed":k,className:P(`relative flex items-center gap-1.5 rounded-[var(--miravo-radius-pill)] px-4 py-1.5 text-xs font-medium transition-colors`,k?`text-primary`:`text-muted-foreground hover:text-foreground`),onClick:()=>B(`apply`),disabled:D,children:[k&&(0,Y.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,Y.jsx)(ct,{className:`relative z-10 size-3.5`}),(0,Y.jsx)(`span`,{className:`relative z-10`,children:`Apply`})]}),(0,Y.jsxs)(`button`,{type:`button`,"aria-pressed":!k,className:P(`relative flex items-center gap-1.5 rounded-[var(--miravo-radius-pill)] px-4 py-1.5 text-xs font-medium transition-colors`,k?`text-muted-foreground hover:text-foreground`:`text-destructive`),onClick:()=>B(`cleanup`),disabled:D,children:[!k&&(0,Y.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,Y.jsx)(V,{className:`relative z-10 size-3.5`}),(0,Y.jsx)(`span`,{className:`relative z-10`,children:`Cleanup`})]})]}),(0,Y.jsx)(me,{stream:t})]}),(0,Y.jsx)(xe,{children:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3.5`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start gap-3 border-b border-border/25 pb-3`,children:[(0,Y.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,Y.jsx)(He,{className:`size-4 text-primary`,"aria-hidden":!0})}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`p`,{className:`font-heading text-[11px] font-semibold uppercase tracking-[0.12em] text-foreground`,children:`Litmus Edge`}),(0,Y.jsx)(`p`,{className:`mt-0.5 text-[11px] leading-relaxed text-muted-foreground`,children:he})]})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[(0,Y.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Y.jsx)(tt,{className:`font-heading text-[11px] font-medium uppercase tracking-[0.14em] text-muted-foreground`,children:`Target`}),(0,Y.jsx)(ue,{targets:e,value:a,onValueChange:e=>{s(e),yt(e),I()},preferredTargetId:te,disabled:D,size:`sm`,className:`min-w-0 w-full text-xs`})]}),(0,Y.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Y.jsx)(tt,{className:`font-heading text-[11px] font-medium uppercase tracking-[0.14em] text-muted-foreground`,children:`Template`}),A.isError&&!A.data&&(0,Y.jsx)(m,{message:q(A.error,`Failed to load templates.`),onRetry:()=>void A.refetch(),isRetrying:A.isFetching&&!A.isPending}),(0,Y.jsxs)(`button`,{type:`button`,disabled:H||D||!N,onClick:()=>C(!0),className:P(`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":`Template`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.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:pe}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium text-foreground`,children:fe})]}),(0,Y.jsx)(Ee,{className:`pointer-events-none size-4 shrink-0 text-muted-foreground`,"aria-hidden":!0})]})]})]}),(0,Y.jsxs)(`button`,{type:`button`,disabled:!U||v,onClick:()=>x(!0),className:P(`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,Y.jsx)(`span`,{className:`relative flex w-18 shrink-0 items-center justify-center bg-transparent`,"aria-hidden":!0,children:(0,Y.jsx)(se,{className:P(`relative size-5`,U?`text-primary`:`text-muted-foreground`)})}),(0,Y.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,Y.jsx)(`span`,{className:P(`font-heading text-[11px] font-semibold uppercase tracking-[0.18em]`,U?`text-primary`:`text-muted-foreground`),children:le}),(0,Y.jsx)(`span`,{className:P(`truncate font-mono text-[13px] leading-tight tracking-tight`,U?`text-foreground`:`text-muted-foreground`),children:ve})]}),(0,Y.jsx)(`span`,{className:P(`flex shrink-0 items-center pr-2.5 sm:pr-3`,U&&`pl-1`),children:(0,Y.jsx)(`span`,{className:P(`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,Y.jsx)(Ae,{className:`size-4`,strokeWidth:2.25})})})]}),!k&&(0,Y.jsx)(`div`,{className:`flex w-full min-w-0 flex-wrap items-center justify-end gap-2`,children:(0,Y.jsxs)(tt,{id:`all-managed-label`,htmlFor:`all-managed`,"aria-disabled":D,className:P(`inline-flex h-8 w-fit max-w-full cursor-pointer items-center gap-2 text-xs font-medium leading-none`,D&&`pointer-events-none opacity-40`),children:[(0,Y.jsx)(Ve,{id:`all-managed`,checked:d,onCheckedChange:e=>{p(e===!0),I()},disabled:D}),(0,Y.jsx)(`span`,{className:`shrink-0`,children:`Remove all Miravo managed resources`})]})})]})}),(v||g)&&!D&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[v&&(0,Y.jsx)(`div`,{className:`flex w-full min-w-0 flex-wrap items-center justify-end gap-2`,children:(0,Y.jsxs)(E,{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:z,children:[(0,Y.jsx)(O,{className:`size-3.5`,"aria-hidden":!0}),`Cancel preview`]})}),v&&(0,Y.jsx)(de,{}),g&&!v&&(0,Y.jsx)(_e,{plan:g,planKind:k?`apply`:`cleanup`,onCloseTable:I})]}),N&&ee?(0,Y.jsx)(xt,{open:!0,type:n,targetLabel:N.label,targetHostname:N.hostname,templates:j,templatesLoading:A.isPending&&A.data===void 0,templatesError:A.isError&&j.length===0,onRetryTemplates:()=>void A.refetch(),onOpenChange:C,onSelect:e=>{u(e.id),_t(e.id),p(!1),I(),k&&t.reset(),C(!1)}}):null,N&&(0,Y.jsx)(ie,{open:b,onOpenChange:x,type:n,label:H?`All managed resources`:M?.name??l,targetLabel:N.label,hostname:N.hostname,sourceHostname:N.sourceHostname,exposedPorts:N.exposedPorts,onConfirm:ae,defaultNamePrefix:k?l:void 0,metadata:ne,applyPreview:k?{onPreview:e=>void re(`apply`,e),planLoading:v,disabled:!a||!l||D}:void 0,cleanupPreview:k?void 0:{onPreview:e=>void re(`cleanup`,e),planLoading:v,disabled:!a||!d&&!l||D}})]})}function Ct(){return(0,Y.jsx)(`section`,{"aria-labelledby":`integrations-operation-log-empty-title`,className:lt,children:(0,Y.jsxs)(`div`,{className:`flex flex-col items-center gap-4 px-4 py-8 text-center sm:py-10`,children:[(0,Y.jsx)(`div`,{className:`flex size-12 items-center justify-center rounded-(--miravo-radius-stadium-sm) border border-dashed border-border/50`,children:(0,Y.jsx)(F,{className:`size-6 text-muted-foreground/45`,"aria-hidden":!0})}),(0,Y.jsxs)(`div`,{className:`max-w-sm`,children:[(0,Y.jsx)(`h2`,{id:`integrations-operation-log-empty-title`,className:`font-heading text-sm font-semibold tracking-tight text-foreground`,children:`No operations yet`}),(0,Y.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 wt(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 Tt(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:wt(e[0]?.completedAt??Date.now()),ops:e}))}function Z(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===`asset`?`One count per asset in this run.`:`Sets the device parameter to the bound DeviceHub device.`}var Et={devices:`Devices`,models:`DT models`,assets:`Digital Twin 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:Z(`device`,e),counts:e.resourceCounts.device},{key:`model`,title:`Digital Twin models`,subtitle:Z(`model`,e),counts:e.resourceCounts.model},{key:`asset`,title:`Assets`,subtitle:Z(`asset`,e),counts:e.resourceCounts.asset},{key:`param-sync`,title:`Parameter sync`,subtitle:Z(`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, assets)`: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.asset&&t.push(`Asset ${e.filters.asset}`),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,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-1.5`,children:[n.create>0&&(0,Y.jsx)(`span`,{className:Q.create,children:$(t,`create`,n.create)}),n.update>0&&(0,Y.jsx)(`span`,{className:Q.update,children:$(t,`update`,n.update)}),n.replace>0&&(0,Y.jsx)(`span`,{className:Q.replace,children:$(t,`replace`,n.replace)}),n.delete>0&&(0,Y.jsx)(`span`,{className:Q.delete,children:$(t,`delete`,n.delete)}),n.noop>0&&(0,Y.jsx)(`span`,{className:Q.noop,children:$(t,`noop`,n.noop)}),n.failed>0&&(0,Y.jsx)(`span`,{className:Q.failed,children:`${n.failed} failed`})]})}function jt(e){return e.resourceCounts.device.noop+e.resourceCounts.model.noop+e.resourceCounts.asset.noop+e.resourceCounts[`param-sync`].noop}function Mt({op:e}){let t=kt(e),n=jt(e);return(0,Y.jsxs)(`div`,{className:`rounded-[var(--miravo-radius-tight)] border border-border/50 bg-muted/25 px-3 py-2.5`,children:[(0,Y.jsx)(`p`,{className:`font-mono text-[10px] uppercase tracking-[0.16em] text-foreground/72`,children:`Run context`}),(0,Y.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,Y.jsx)(`dt`,{className:`text-foreground/70`,children:`Operation`}),(0,Y.jsx)(`dd`,{className:`font-medium capitalize text-foreground`,children:e.operationType}),(0,Y.jsx)(`dt`,{className:`text-foreground/70`,children:`Target host`}),(0,Y.jsx)(`dd`,{className:`break-all font-mono text-[11px] text-foreground`,children:e.hostname}),(0,Y.jsx)(`dt`,{className:`text-foreground/70`,children:`Scope`}),(0,Y.jsx)(`dd`,{className:`text-foreground`,children:Ot(e.scope)}),t&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`dt`,{className:`text-foreground/70`,children:`Filters`}),(0,Y.jsx)(`dd`,{className:`text-foreground`,children:t})]}),(0,Y.jsx)(`dt`,{className:`text-foreground/70`,children:`Duration`}),(0,Y.jsxs)(`dd`,{className:`tabular-nums text-foreground`,children:[(e.durationMs/1e3).toFixed(1),`s`]}),(0,Y.jsx)(`dt`,{className:`text-foreground/70`,children:`Outcome`}),(0,Y.jsxs)(`dd`,{className:`text-foreground`,children:[(0,Y.jsx)(`span`,{className:`tabular-nums`,children:e.successCount}),` steps succeeded`,n>0&&(0,Y.jsxs)(`span`,{className:`text-foreground/72`,children:[` `,`· `,(0,Y.jsx)(`span`,{className:`tabular-nums`,children:n}),` unchanged`]}),e.failedCount>0&&(0,Y.jsxs)(`span`,{className:`text-destructive`,children:[` `,`· `,(0,Y.jsx)(`span`,{className:`tabular-nums`,children:e.failedCount}),` failed`]}),e.blockedCount>0&&(0,Y.jsxs)(`span`,{className:`text-warning`,children:[` `,`· `,(0,Y.jsx)(`span`,{className:`tabular-nums`,children:e.blockedCount}),` blocked in plan`]})]})]})]})}function Nt({status:e}){switch(e){case`success`:return(0,Y.jsx)(Me,{className:`mt-px size-4 shrink-0 text-success`});case`failed`:return(0,Y.jsx)(Le,{className:`mt-px size-4 shrink-0 text-destructive`});case`partial`:case`blocked`:return(0,Y.jsx)(Ue,{className:`mt-px size-4 shrink-0 text-warning`});case`noop`:return(0,Y.jsx)(at,{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,Y.jsx)(`p`,{className:`py-1 text-sm text-foreground/75`,children:Ft(e)}):(0,Y.jsxs)(`div`,{className:`space-y-3 pt-1`,children:[(0,Y.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,Y.jsxs)(`div`,{className:`flex flex-col gap-2 px-3 py-2.5 sm:flex-row sm:items-start sm:gap-4`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 shrink-0 sm:w-[11.5rem]`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Y.jsx)(`span`,{className:`text-xs font-medium leading-snug text-foreground`,children:e.title}),(0,Y.jsxs)(Ke,{children:[(0,Y.jsx)(We,{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,Y.jsx)(ze,{className:`size-3.5`,"aria-hidden":!0})}),(0,Y.jsx)(Ge,{side:`top`,className:`max-w-xs text-left`,children:e.subtitle})]})]}),(0,Y.jsx)(`p`,{className:`mt-0.5 text-[11px] leading-snug text-foreground/72 sm:hidden`,children:e.subtitle})]}),(0,Y.jsx)(At,{row:e})]},e.key))}),e.blockedCount>0&&(0,Y.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,Y.jsx)(`span`,{className:`font-medium`,children:e.blockedCount}),` plan entries were blocked (skipped). Open a `,(0,Y.jsx)(`span`,{className:`font-medium`,children:`deploy preview`}),` before running to see block reasons.`]})]})}function Lt({operation:e}){let[t,n]=(0,J.useState)(!1);return(0,Y.jsxs)(`div`,{className:P(`overflow-hidden rounded-[var(--miravo-radius-stadium-sm)] border border-border/55`,`transition-colors duration-150`),children:[(0,Y.jsxs)(`button`,{type:`button`,"aria-expanded":t,onClick:()=>n(e=>!e),className:P(`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,Y.jsx)(Nt,{status:e.status}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Y.jsxs)(`p`,{className:`min-w-0 truncate text-sm`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-foreground`,children:k(e.templateId)}),(0,Y.jsx)(`span`,{className:`mx-1.5 text-foreground/50`,children:`→`}),(0,Y.jsx)(`span`,{className:`text-foreground/82`,children:e.targetLabel})]}),(0,Y.jsx)(`time`,{dateTime:new Date(e.completedAt).toISOString(),title:j(e.completedAt),className:`shrink-0 text-xs text-foreground/75`,children:A(e.completedAt)})]}),(0,Y.jsx)(`p`,{className:`text-xs text-foreground/78`,children:Pt(e)}),(e.failedCount>0||e.status===`failed`)&&(0,Y.jsx)(`p`,{className:`text-[11px] leading-snug text-foreground/72`,children:e.error??`The operation ended with an error.`})]}),(0,Y.jsx)(Ee,{className:P(`mt-0.5 size-3.5 shrink-0 text-foreground/55 transition-transform duration-150`,t&&`rotate-180`)})]}),(0,Y.jsx)(g,{initial:!1,children:t&&(0,Y.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,Y.jsxs)(`div`,{className:`space-y-3 border-t border-border/45 px-4 pb-3 pt-3`,children:[(0,Y.jsx)(Mt,{op:e}),e.error&&(0,Y.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,Y.jsx)(`div`,{className:`absolute top-1.5 right-1.5 z-10`,children:(0,Y.jsx)(T,{value:e.error,label:`Copy error`,className:`text-destructive hover:bg-destructive/25 hover:text-foreground`})}),(0,Y.jsx)(`p`,{className:`whitespace-normal break-words text-destructive [overflow-wrap:anywhere]`,children:e.error})]}),(0,Y.jsx)(It,{op:e})]})})})]})}function Rt({label:e}){return(0,Y.jsxs)(`div`,{className:`flex items-center gap-3 py-1`,children:[(0,Y.jsx)(`div`,{className:`h-px flex-1 bg-border/65`}),(0,Y.jsx)(`span`,{className:`text-xs font-medium text-foreground/78`,children:e}),(0,Y.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,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 border-b border-border/50 px-3 py-2`,children:[(0,Y.jsxs)(ke,{value:e.type||`_all`,onValueChange:e=>e&&i(e===`_all`?``:e),children:[(0,Y.jsx)(Oe,{size:`sm`,className:Ht,"aria-label":`Operation type`,children:(0,Y.jsx)(Te,{children:e=>Bt[e??`_all`]??Bt._all})}),(0,Y.jsxs)(De,{children:[(0,Y.jsx)(W,{value:`_all`,children:`All types`}),(0,Y.jsx)(W,{value:`apply`,children:`Apply`}),(0,Y.jsx)(W,{value:`cleanup`,children:`Cleanup`})]})]}),(0,Y.jsxs)(ke,{value:e.status||`_all`,onValueChange:e=>e&&a(e===`_all`?``:e),children:[(0,Y.jsx)(Oe,{size:`sm`,className:Ht,"aria-label":`Operation status`,children:(0,Y.jsx)(Te,{children:e=>Vt[e??`_all`]??Vt._all})}),(0,Y.jsxs)(De,{children:[(0,Y.jsx)(W,{value:`_all`,children:`All statuses`}),(0,Y.jsx)(W,{value:`success`,children:`Success`}),(0,Y.jsx)(W,{value:`partial`,children:`Partial`}),(0,Y.jsx)(W,{value:`failed`,children:`Failed`}),(0,Y.jsx)(W,{value:`blocked`,children:`Blocked`}),(0,Y.jsx)(W,{value:`noop`,children:`No-op`})]})]}),t.length>1&&(0,Y.jsxs)(ke,{value:e.target||`_all`,onValueChange:e=>e&&o(e===`_all`?``:e),children:[(0,Y.jsx)(Oe,{size:`sm`,className:Ht,"aria-label":`Target filter`,children:(0,Y.jsx)(Te,{children:e=>!e||e===`_all`?`All targets`:e})}),(0,Y.jsxs)(De,{children:[(0,Y.jsx)(W,{value:`_all`,children:`All targets`}),t.map(e=>(0,Y.jsx)(W,{value:e,children:e},e))]})]}),(0,Y.jsxs)(`div`,{className:`relative flex min-w-[140px] flex-1 items-center`,children:[(0,Y.jsx)(`input`,{ref:r,type:`search`,value:e.search,onChange:e=>s(e.target.value),placeholder:`Search template or target…`,"aria-describedby":`ops-search-shortcut`,className:P(`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,Y.jsx)(`span`,{id:`ops-search-shortcut`,className:`sr-only`,children:`Press slash to focus search`}),!e.search&&(0,Y.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,Y.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,Y.jsx)(O,{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,J.useState)(!1),[f,m]=(0,J.useState)(zt),_=(0,J.useRef)(null);(0,J.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,J.useMemo)(()=>{let t=new Set;for(let n of e){let e=n.targetLabel;t.add(e)}return[...t].sort()},[e]),b=(0,J.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)||k(t.templateId).toLowerCase().includes(e)||n.toLowerCase().includes(e)})}return t},[e,f]),x=f.type!==``||f.status!==``||f.target!==``||f.search!==``,ee=(0,J.useMemo)(()=>Tt(b),[b]);return(0,Y.jsxs)(`div`,{className:`flex h-full flex-col rounded-[var(--miravo-radius-stadium-sm)] border border-border/55`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border/50 px-3.5 py-2.5`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:`Operation log`}),e.length>0&&(0,Y.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,Y.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,Y.jsx)(p,{className:P(`size-3.5`,u&&`animate-spin`),"aria-hidden":!0})})]}),(0,Y.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,Y.jsxs)(`div`,{className:`flex flex-1 min-h-0 flex-col gap-2 overflow-y-auto overscroll-y-contain p-3`,children:[r&&(0,Y.jsxs)(`p`,{className:`py-2 text-xs text-destructive`,children:[`✕ `,r.message]}),n&&e.length===0&&!r&&(0,Y.jsx)(`p`,{className:`py-4 text-sm text-foreground/75`,children:`Loading…`}),!n&&e.length===0&&!r&&(0,Y.jsx)(Ct,{}),!n&&e.length>0&&b.length===0&&(0,Y.jsxs)(`p`,{className:`py-6 text-center text-sm text-foreground/75`,children:[`No operations match your filters.`,` `,(0,Y.jsx)(`button`,{type:`button`,onClick:()=>m(zt),className:`text-primary hover:underline`,children:`Clear filters`})]}),x&&b.length>0&&b.length!==e.length&&(0,Y.jsxs)(`p`,{className:`text-xs text-foreground/75`,children:[`Showing`,` `,(0,Y.jsx)(`span`,{className:`font-medium tabular-nums text-foreground`,children:b.length}),` of`,` `,(0,Y.jsx)(`span`,{className:`tabular-nums`,children:e.length}),` loaded`]}),!x&&typeof t==`number`&&t>0&&e.length<t&&(0,Y.jsxs)(`p`,{className:`text-xs text-foreground/75`,children:[`Showing`,` `,(0,Y.jsx)(`span`,{className:`font-medium tabular-nums text-foreground`,children:e.length}),` `,`of `,(0,Y.jsx)(`span`,{className:`tabular-nums`,children:t}),`. Load more for older entries.`]}),(0,Y.jsx)(g,{initial:!1,children:ee.map(e=>(0,Y.jsxs)(h.div,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(Rt,{label:e.label}),(0,Y.jsx)(g,{initial:!1,children:e.ops.map(e=>(0,Y.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,Y.jsx)(Lt,{operation:e})},`${e.operationId}-${e.completedAt}`))})]},e.label))}),s?(0,Y.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,Y.jsxs)(`p`,{className:`text-xs text-destructive`,children:[`Could not load older entries: `,s.message]}),c?(0,Y.jsx)(E,{type:`button`,variant:`outline`,size:`sm`,onClick:c,children:`Retry`}):null]}):a&&l?(0,Y.jsx)(`div`,{className:`flex shrink-0 justify-center border-t border-border/50 pt-3 pb-1`,children:(0,Y.jsx)(E,{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,J.useState)(null);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{className:`absolute right-3 top-3 z-20`,children:(0,Y.jsxs)(et,{children:[(0,Y.jsx)($e,{render:(0,Y.jsx)(E,{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,Y.jsx)(ot,{className:`size-3.5`,"aria-hidden":!0})}),(0,Y.jsx)(Xe,{align:`end`,sideOffset:6,className:`min-w-56`,children:(0,Y.jsxs)(Qe,{children:[(0,Y.jsx)(Je,{className:`text-[10px] uppercase tracking-[0.14em]`,children:`Quick actions`}),(0,Y.jsx)(Ze,{className:`bg-border/60`}),(0,Y.jsxs)(Ye,{disabled:s,className:`h-9 gap-2 text-xs`,onClick:()=>l(`apply`),children:[(0,Y.jsx)(Be,{className:`size-3.5 shrink-0 text-primary`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:`Apply template...`})]}),(0,Y.jsxs)(Ye,{disabled:s,className:`h-9 gap-2 text-xs`,onClick:()=>l(`cleanup`),children:[(0,Y.jsx)(V,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:`Cleanup template...`})]}),(0,Y.jsx)(Ze,{className:`bg-border/60`}),(0,Y.jsxs)(Ye,{variant:`destructive`,className:`h-9 gap-2 text-xs`,onClick:()=>o({type:`cleanup`,target:e,allManaged:!0}),children:[(0,Y.jsx)(V,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:`Cleanup all managed`})]})]})})]})}),c?(0,Y.jsx)(xt,{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,J.useState)(!1),[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(!1),u=(0,J.useRef)(0),d=(0,J.useRef)(null),f=(0,J.useRef)(!1),p=n.status===`running`,m=(0,J.useCallback)(()=>{u.current+=1,f.current=!1,d.current?.abort(),d.current=null,l(!1),s(null)},[]);(0,J.useEffect)(()=>{e&&(m(),a(!0))},[e,m]),(0,J.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,J.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 ge(R({targetId:e.target.id,template:r,result:t}),{signal:a.signal})}else n=await ce(L({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||oe(t))return;let n=q(t,e.type===`apply`?`Plan failed`:`Cleanup plan failed`),r=nt(t);S.error(n,r?{description:r}:void 0)}finally{i===u.current&&(l(!1),f.current=!1)}},[e,n]),v=(0,J.useCallback)(t=>{if(e){if(a(!1),m(),r(null),e.type===`apply`){if(!e.templateId)return;n.startApply(R({targetId:e.target.id,template:e.templateId,result:t}));return}n.startCleanup(L({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,Y.jsxs)(Y.Fragment,{children:[e&&(0,Y.jsx)(ie,{open:i,onOpenChange:y,type:e.type,label:g,targetLabel:e.target.label,hostname:e.target.hostname,sourceHostname:e.target.sourceHostname,exposedPorts:e.target.exposedPorts,onConfirm:v,defaultNamePrefix:e.type===`apply`?e.templateId:void 0,metadata:ne,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,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsxs)(`div`,{className:`flex w-full min-w-0 flex-wrap items-center justify-between gap-2`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-[11px] text-muted-foreground`,children:[(0,Y.jsx)(B,{className:`size-3.5 shrink-0 text-primary`,"aria-hidden":!0}),(0,Y.jsxs)(`span`,{className:`truncate`,children:[`Preview for `,e.target.label,`: `,g]})]}),(0,Y.jsxs)(E,{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,Y.jsx)(O,{className:`size-3.5`,"aria-hidden":!0}),`Close preview`]})]}),c?(0,Y.jsx)(de,{}):o?(0,Y.jsx)(_e,{plan:o,planKind:e.type,onCloseTable:b}):null]}):null]})}function qt(e){return je.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,Y.jsx)(Me,{className:`size-3 text-success`});case`partial`:case`blocked`:return(0,Y.jsx)(Ue,{className:`size-3 text-warning`});case`noop`:return(0,Y.jsx)(at,{className:`size-3 text-muted-foreground`});case`failed`:return(0,Y.jsx)(Le,{className:`size-3 text-destructive`})}}function Xt({target:e,lastOp:t,onEdit:n,onDelete:r,quickActions:i}){return(0,Y.jsxs)(`div`,{className:`env-orbital relative overflow-hidden border`,style:{"--_status":Jt(t)},children:[i,(0,Y.jsx)(`div`,{className:`relative z-10 px-4 pt-3.5 pb-3 pr-12`,children:(0,Y.jsx)(`p`,{className:`font-heading text-[13px] font-semibold leading-tight tracking-tight text-foreground`,children:e.label})}),(0,Y.jsx)(`div`,{className:`relative z-10 px-4 py-0.5`,children:(0,Y.jsx)(`p`,{className:`font-mono text-xs tracking-tight text-muted-foreground`,children:e.hostname})}),(0,Y.jsxs)(`div`,{className:`relative z-10 mx-4 mb-3 flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate font-mono text-[11px] text-muted-foreground`,children:e.sourceHostname}),(0,Y.jsx)(`div`,{className:`env-orbital-path min-w-6 flex-1`}),(0,Y.jsx)(I,{className:`size-3 shrink-0 text-muted-foreground`})]}),(0,Y.jsxs)(`div`,{className:`relative z-10 flex items-center gap-2 border-t border-border/30 px-3 py-1.5`,children:[(0,Y.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5 rounded-full border border-border/40 px-2 py-0.5`,children:[(0,Y.jsx)(`span`,{className:`protocol-card-live-dot size-[5px]`}),(0,Y.jsx)(`span`,{className:`text-[11px] font-medium tracking-wide text-muted-foreground`,children:qt(e.integrationId)})]}),t&&(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 truncate text-[11px] text-muted-foreground`,children:[(0,Y.jsx)(Yt,{status:t.status}),t.operationType===`apply`?`Applied`:`Cleaned`,` `,(0,Y.jsx)(`time`,{dateTime:new Date(t.completedAt).toISOString(),title:j(t.completedAt),children:A(t.completedAt)})]}),(0,Y.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-0.5`,children:[(0,Y.jsx)(E,{variant:`ghost`,size:`icon-sm`,"aria-label":`Edit target`,onClick:n,children:(0,Y.jsx)(st,{className:`size-3`})}),(0,Y.jsx)(E,{variant:`ghost`,size:`icon-sm`,className:`text-destructive hover:text-destructive`,"aria-label":`Delete target`,onClick:r,children:(0,Y.jsx)(V,{className:`size-3`})})]})]})]})}function Zt({onClick:e}){return(0,Y.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,Y.jsx)(z,{className:`size-5 transition-transform group-hover:scale-110`}),(0,Y.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,J.useState)(!1),[u,d]=(0,J.useState)(null),[f,p]=(0,J.useState)(G.id),[m,_]=(0,J.useState)({label:``,hostname:``,apiToken:``,sourceHostname:``}),[v,y]=(0,J.useState)(!1),[T,D]=(0,J.useState)(!1),{testing:O,runTest:k,cancelInFlight:A}=he(),[j,M]=(0,J.useState)(null),[N,P]=(0,J.useState)(null),F=s.status===`running`,I=f===G.id&&m.hostname.trim().length>0&&m.sourceHostname.trim().length>0&&(u!==null||m.apiToken.trim().length>0),L=()=>{d(null),p(G.id),_({label:``,hostname:``,apiToken:``,sourceHostname:``}),D(!1),l(!0)},R=e=>{d(e.id),p(je.some(t=>t.id===e.integrationId)?e.integrationId:G.id),_({label:e.label,hostname:e.hostname,apiToken:``,sourceHostname:e.sourceHostname}),D(!1),l(!0)},B=async()=>{if(f!==G.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 pe(u,{integrationId:f,label:m.label,hostname:m.hostname,sourceHostname:m.sourceHostname,...m.apiToken?{apiToken:m.apiToken}:{}}),S.success(`Target updated.`)):(await U({...m,integrationId:f}),S.success(`Target added.`)),l(!1),t()}catch(e){S.error(q(e,`Failed to save target.`))}finally{y(!1)}};return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(`h2`,{className:`flex h-5 items-center text-xs font-medium leading-none uppercase tracking-wider text-muted-foreground`,children:`Integration Targets`}),e.length>0?(0,Y.jsx)(qe,{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,Y.jsxs)(E,{size:`sm`,className:`h-7 shrink-0 gap-1.5 text-xs`,onClick:L,children:[(0,Y.jsx)(z,{className:`size-3.5`}),` Add Target`]})]}),e.length===0?(0,Y.jsx)(ft,{titleId:`integrations-targets-empty-title`,frameIcon:(0,Y.jsx)(K,{className:`size-6 text-muted-foreground/45`,"aria-hidden":!0}),description:(0,Y.jsx)(ut,{}),children:(0,Y.jsx)(dt,{onClick:L})}):(0,Y.jsx)(`div`,{className:`grid grid-cols-1 gap-3 @2xl/main:grid-cols-2 @5xl/main:grid-cols-3`,children:(0,Y.jsxs)(g,{children:[e.map((e,t)=>(0,Y.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,Y.jsx)(Xt,{target:e,lastOp:n.get(e.id),onEdit:()=>R(e),onDelete:()=>M(e),quickActions:(0,Y.jsx)(Gt,{target:e,templates:r,templatesLoading:i,templatesError:a,isStreaming:F,onRetryTemplates:o,onSelect:P})})},e.id)),(0,Y.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,Y.jsx)(Zt,{onClick:L})},`add-card`)]})}),(0,Y.jsx)(Kt,{selection:N,templates:r,stream:s,onSelectionChange:P}),(0,Y.jsx)(le,{open:c,editing:u!==null,integrationId:f,form:m,showToken:T,saving:v,testing:O,canTestConnection:I,onOpenChange:l,onIntegrationChange:p,onFormChange:_,onShowTokenChange:D,onSave:()=>void B(),onTestConnection:()=>{I&&k({...u?{targetId:u}:{},hostname:m.hostname.trim(),sourceHostname:m.sourceHostname.trim(),...m.apiToken.trim()?{apiToken:m.apiToken.trim()}:{}})},onCancelInFlight:A}),(0,Y.jsx)(ee,{open:j!==null,onOpenChange:e=>!e&&M(null),children:(0,Y.jsxs)(te,{children:[(0,Y.jsxs)(C,{children:[(0,Y.jsx)(w,{children:`Remove Target`}),(0,Y.jsxs)(x,{children:[`Remove “`,j?.label,`”? This only deletes the saved credentials — it does not affect resources on the target integration.`]})]}),(0,Y.jsxs)(b,{children:[(0,Y.jsx)(E,{variant:`outline`,onClick:()=>M(null),children:`Cancel`}),(0,Y.jsx)(E,{variant:`destructive`,onClick:async()=>{if(!j)return;let e=j.id;M(null);try{await fe(e),S.success(`Target removed.`),t()}catch(e){S.error(q(e,`Failed to remove target.`))}},children:`Remove`})]})]})})]})}var $t=25;function en({status:e}){switch(e){case`success`:return(0,Y.jsx)(Me,{className:`size-3 text-success`});case`partial`:case`blocked`:return(0,Y.jsx)(Ue,{className:`size-3 text-warning`});case`noop`:return(0,Y.jsx)(at,{className:`size-3 text-muted-foreground`});case`failed`:return(0,Y.jsx)(Le,{className:`size-3 text-destructive`})}}function tn({targetCount:e,opCount:t,lastOp:n}){return(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground`,children:[(0,Y.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(K,{className:`size-3`}),(0,Y.jsx)(`span`,{className:`font-mono`,children:e}),` target`,e===1?``:`s`]}),(0,Y.jsx)(`span`,{className:`hidden h-3 w-px bg-border/40 sm:inline-block`}),(0,Y.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,Y.jsx)(g,{mode:`popLayout`,initial:!1,children:(0,Y.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,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:`hidden h-3 w-px bg-border/40 sm:inline-block`}),(0,Y.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(en,{status:n.status}),(0,Y.jsxs)(`span`,{children:[n.operationType===`apply`?`Applied`:`Cleaned`,` `,(0,Y.jsx)(`time`,{dateTime:new Date(n.completedAt).toISOString(),title:j(n.completedAt),children:A(n.completedAt)})]})]})]})]})}function nn(){let e=f({queryKey:c.integrations.targets(),queryFn:()=>se()}),t=e.data??[],n=it({queryKey:c.integrations.operationsList(),queryFn:({pageParam:e})=>be({limit:$t,offset:e}),initialPageParam:0,getNextPageParam:(e,t,n)=>e.hasMore&&e.operations.length>0?n+$t:void 0}),i=(0,J.useMemo)(()=>n.data?.pages.flatMap(e=>e.operations)??[],[n.data]),a=n.data?.pages[0]?.total??0,s=f({queryKey:c.catalog.templates(),queryFn:()=>o(`/catalog/templates`,r.catalogTemplates)}),u=s.data??[],d=ye(),p=(0,J.useRef)(d.status);(0,J.useEffect)(()=>{let e=p.current;p.current=d.status,e===`running`&&d.status===`complete`&&l.invalidateQueries({queryKey:c.integrations.operationsList()})},[d.status]);let y=(0,J.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,Y.jsx)(m,{message:q(e.error,`Could not load targets.`),onRetry:()=>void e.refetch(),isRetrying:e.isFetching&&!e.isPending}):t.length===0?(0,Y.jsx)(ft,{titleId:`integrations-operations-empty-title`,frameIcon:(0,Y.jsx)(K,{className:`size-6 text-muted-foreground/45`,"aria-hidden":!0}),description:(0,Y.jsx)(ut,{}),children:(0,Y.jsx)(dt,{onClick:()=>void x(`targets`)})}):(0,Y.jsx)(St,{targets:t,stream:d}),(0,Y.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,Y.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2`,children:[(0,Y.jsx)(`h1`,{className:`font-heading text-2xl font-semibold tracking-tight`,children:`Integrations`}),(0,Y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Connect Integrations as targets, then apply templates or run cleanup from Operations.`}),(0,Y.jsx)(tn,{targetCount:t.length,opCount:a,lastOp:i[0]})]}),(0,Y.jsxs)(Re,{value:b,onValueChange:e=>{x(e)},className:`flex-1 min-h-0`,children:[(0,Y.jsx)(`div`,{className:`shrink-0 overflow-x-auto`,children:(0,Y.jsxs)(Ie,{variant:`line`,className:`h-10! gap-0.5 min-w-max`,children:[(0,Y.jsxs)(Ne,{value:`targets`,className:`gap-1.5 px-3 text-sm`,children:[(0,Y.jsx)(K,{className:`size-3.5 shrink-0`}),`Targets`]}),(0,Y.jsxs)(Ne,{value:`operations`,className:`gap-1.5 px-3 text-sm`,children:[(0,Y.jsx)(Ce,{className:`size-3.5 shrink-0`}),`Operations`]}),(0,Y.jsxs)(Ne,{value:`activity`,className:`gap-1.5 px-3 text-sm`,children:[(0,Y.jsx)(F,{className:`size-3.5 shrink-0`}),`Activity`]})]})}),(0,Y.jsx)(Pe,{value:`targets`,className:`flex-1 py-2`,children:(0,Y.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,Y.jsx)(m,{message:q(e.error,`Failed to load targets.`),onRetry:()=>void e.refetch(),isRetrying:e.isFetching&&!e.isPending}):(0,Y.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,Y.jsx)(Pe,{value:`operations`,className:`flex-1 py-2`,children:(0,Y.jsx)(h.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.15,ease:`easeOut`},children:S},`operations`)}),(0,Y.jsx)(Pe,{value:`activity`,className:`flex flex-col flex-1 min-h-0 py-2`,children:(0,Y.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,Y.jsx)(Wt,{operations:i,totalKnown:a,isLoading:n.isPending&&!n.data,error:n.error,onRefresh:()=>void l.invalidateQueries({queryKey:c.integrations.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,Y.jsx)(g,{children:d.operation||d.status===`running`?(0,Y.jsx)(pt,{stream:d,onReset:d.reset,catalogTemplates:u}):null})]})}export{nn as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./integrations-BrZWbG5Q.js";export{e as IntegrationsPage};
@@ -1,4 +1,4 @@
1
- import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{at as n}from"./vendor-ui-CWUk2ulb.js";import{l as r,r as i,y as a}from"./api-5BZroqlO.js";import{t as o}from"./use-transition-navigate-Bxh77tVE.js";import{t as s}from"./transition-nav-link-CDSeWWsP.js";import{n as c}from"./get-error-message-CFs0lSQP.js";var l=e(t(),1),u=n(),d=`
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{at as n}from"./vendor-ui-CWUk2ulb.js";import{l as r,r as i,y as a}from"./api-DdyA1QMC.js";import{t as o}from"./use-transition-navigate-BBXUEW59.js";import{t as s}from"./transition-nav-link-Crj9XTbK.js";import{n as c}from"./get-error-message-BowDodwy.js";var l=e(t(),1),u=n(),d=`
2
2
  @keyframes readout-appear {
3
3
  from { opacity: 0; transform: translateY(8px) scale(0.95); }
4
4
  to { opacity: 1; transform: translateY(0) scale(1); }
@@ -133,4 +133,4 @@ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-c
133
133
  color: var(--foreground);
134
134
  text-decoration-color: var(--tooltip-border);
135
135
  }
136
- `;function f({label:e,forId:t,children:n}){return(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`label`,{htmlFor:t,style:{fontFamily:`var(--font-mono)`,fontSize:`0.72rem`,letterSpacing:`0.03em`,color:`var(--muted-foreground)`,display:`block`,marginBottom:`0.5rem`},children:e}),n]})}function p({message:e}){return(0,u.jsx)(`p`,{role:`alert`,style:{fontSize:`0.82rem`,color:`var(--destructive)`,textAlign:`center`,padding:`0.55rem 0.9rem`,background:`color-mix(in srgb, var(--destructive) 6%, transparent)`,border:`1px solid color-mix(in srgb, var(--destructive) 12%, transparent)`,borderRadius:4,margin:`0 0 1rem`},children:e})}function m({onChangePassword:e}){let t=o(),[n,i]=(0,l.useState)(``),[s,d]=(0,l.useState)(``),[m,h]=(0,l.useState)(``),[g,_]=(0,l.useState)(!1);async function v(i){i.preventDefault(),h(``),_(!0);try{(await r(n,s)).changePassword?e(n):(a.removeQueries({queryKey:[`bootstrap`]}),t(`/`,{replace:!0}))}catch(e){h(c(e,`Login failed`))}finally{_(!1)}}return(0,u.jsxs)(`form`,{onSubmit:v,children:[(0,u.jsx)(`div`,{style:{marginBottom:`2rem`},children:(0,u.jsx)(`h1`,{style:{fontFamily:`var(--font-heading)`,fontSize:`1.5rem`,fontWeight:800,color:`var(--foreground)`,letterSpacing:`-0.035em`,lineHeight:1.15,margin:0},children:`Log in`})}),m&&(0,u.jsx)(p,{message:m}),(0,u.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`1.15rem`},children:[(0,u.jsx)(f,{label:`Username`,forId:`username`,children:(0,u.jsx)(`input`,{id:`username`,type:`text`,className:`miravo-input`,autoComplete:`username`,required:!0,value:n,onChange:e=>i(e.target.value)})}),(0,u.jsx)(f,{label:`Password`,forId:`password`,children:(0,u.jsx)(`input`,{id:`password`,type:`password`,className:`miravo-input`,autoComplete:`current-password`,required:!0,value:s,onChange:e=>d(e.target.value)})}),(0,u.jsx)(`button`,{type:`submit`,className:`miravo-btn`,disabled:g,style:{marginTop:`0.5rem`},children:g?`Logging in…`:`Log in`})]})]})}function h({username:e}){let t=o(),[n,r]=(0,l.useState)(``),[s,d]=(0,l.useState)(``),[m,h]=(0,l.useState)(``),[g,_]=(0,l.useState)(!1);async function v(r){if(r.preventDefault(),h(``),n!==s){h(`Passwords do not match`);return}if(n.length<6){h(`Password must be at least 6 characters`);return}_(!0);try{await i(e,n),a.removeQueries({queryKey:[`bootstrap`]}),t(`/`,{replace:!0})}catch(e){h(c(e,`Password change failed`))}finally{_(!1)}}return(0,u.jsxs)(`form`,{onSubmit:v,children:[(0,u.jsxs)(`div`,{style:{marginBottom:`2rem`},children:[(0,u.jsx)(`h1`,{style:{fontFamily:`var(--font-heading)`,fontSize:`1.5rem`,fontWeight:800,color:`var(--foreground)`,letterSpacing:`-0.035em`,lineHeight:1.15,margin:0},children:`Update password`}),(0,u.jsxs)(`p`,{style:{fontSize:`0.82rem`,color:`var(--muted-foreground)`,marginTop:`0.4rem`,lineHeight:1.5},children:[`Default password detected.`,` `,(0,u.jsx)(`span`,{style:{color:`var(--warning)`},children:`Please set a new one.`})]})]}),m&&(0,u.jsx)(p,{message:m}),(0,u.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`1.1rem`},children:[(0,u.jsx)(f,{label:`New password`,forId:`new-password`,children:(0,u.jsx)(`input`,{id:`new-password`,type:`password`,className:`miravo-input`,autoComplete:`new-password`,required:!0,minLength:6,value:n,onChange:e=>r(e.target.value)})}),(0,u.jsx)(f,{label:`Confirm password`,forId:`confirm-password`,children:(0,u.jsx)(`input`,{id:`confirm-password`,type:`password`,className:`miravo-input`,autoComplete:`new-password`,required:!0,minLength:6,value:s,onChange:e=>d(e.target.value)})}),(0,u.jsx)(`button`,{type:`submit`,className:`miravo-btn`,disabled:g,style:{marginTop:`0.4rem`},children:g?`Setting password…`:`Set password`}),(0,u.jsx)(`div`,{style:{textAlign:`center`,marginTop:`0.15rem`},children:(0,u.jsx)(`button`,{type:`button`,className:`miravo-btn-ghost`,onClick:()=>{a.removeQueries({queryKey:[`bootstrap`]}),t(`/`,{replace:!0})},children:`Skip for now`})})]})]})}function g(){let e=(0,l.useRef)(null);return(0,l.useEffect)(()=>{let t=e.current;if(!t)return;let n=t.getContext(`2d`);if(!n)return;let r=t,i=n,a=getComputedStyle(document.documentElement).getPropertyValue(`--primary`).trim(),o=window.devicePixelRatio||1,s=0,c=0,l=0,u=0,d=[],f=[],p=[];function m(){d=[],f=[],p=[];let e=Math.max(15,Math.floor(s*c/35e3));for(let t=0;t<e;t++)d.push({x:0,y:0,bx:25+Math.random()*(s-50),by:25+Math.random()*(c-50),r:1+Math.random()*1.2,phase:Math.random()*Math.PI*2});for(let e=0;e<d.length;e++)for(let t=e+1;t<d.length;t++){let n=d[e],r=d[t];!n||!r||Math.hypot(n.bx-r.bx,n.by-r.by)<160&&Math.random()>.5&&f.push({from:e,to:t})}}function h(){s=r.offsetWidth,c=r.offsetHeight,r.width=s*o,r.height=c*o,i.setTransform(o,0,0,o,0,0),m()}function g(){l+=.016,i.clearRect(0,0,s,c);for(let e of d)e.x=e.bx+Math.sin(l*.15+e.phase)*5,e.y=e.by+Math.cos(l*.1+e.phase*1.3)*4;let e=new Set;for(let t of p)e.add(t.conn.from*256+t.conn.to);i.strokeStyle=a,i.lineWidth=.5;for(let t of f){let n=d[t.from],r=d[t.to];!n||!r||(i.globalAlpha=e.has(t.from*256+t.to)?.04:.012,i.beginPath(),i.moveTo(n.x,n.y),i.lineTo(r.x,r.y),i.stroke())}i.fillStyle=a;for(let e of d)i.globalAlpha=.08*(.6+Math.sin(l*.4+e.phase)*.4),i.beginPath(),i.arc(e.x,e.y,e.r,0,Math.PI*2),i.fill();if(Math.random()<.03&&f.length&&p.length<10){let e=f[Math.floor(Math.random()*f.length)];e&&p.push({conn:e,t:0,speed:.002+Math.random()*.003,alpha:.25+Math.random()*.35,size:1+Math.random()*1})}i.fillStyle=a;for(let e=p.length-1;e>=0;e--){let t=p[e];if(!t)continue;if(t.t+=t.speed,t.t>=1){p.splice(e,1);continue}let n=d[t.conn.from],r=d[t.conn.to];if(!n||!r)continue;let a=n.x+(r.x-n.x)*t.t,o=n.y+(r.y-n.y)*t.t;i.globalAlpha=t.alpha*.35,i.beginPath(),i.arc(a,o,t.size,0,Math.PI*2),i.fill()}i.globalAlpha=1,u=requestAnimationFrame(g)}let _=()=>{document.hidden?cancelAnimationFrame(u):u=requestAnimationFrame(g)},v,y=()=>{window.clearTimeout(v),v=window.setTimeout(h,250)};if(!window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return document.addEventListener(`visibilitychange`,_),window.addEventListener(`resize`,y),h(),g(),()=>{cancelAnimationFrame(u),window.clearTimeout(v),document.removeEventListener(`visibilitychange`,_),window.removeEventListener(`resize`,y)}},[]),(0,u.jsx)(`canvas`,{ref:e,style:{position:`absolute`,inset:0,width:`100%`,height:`100%`}})}var _=[{path:`pump-001/temp`,base:87.3,range:5,decimals:1,unit:`°C`,style:{left:`6%`,top:`18%`},delay:`1.4s`},{path:`comp/pressure`,base:4.21,range:.5,decimals:2,unit:`bar`,style:{right:`5%`,top:`12%`},delay:`1.7s`},{path:`motor/vibration`,base:2.14,range:.3,decimals:2,unit:`mm/s`,style:{left:`4%`,bottom:`18%`},delay:`2.0s`},{path:`gen/power`,base:482,range:20,decimals:0,unit:`kW`,style:{right:`4%`,bottom:`17%`},delay:`2.3s`},{path:`boiler/temp`,base:312,range:8,decimals:0,unit:`°C`,style:{left:`22%`,top:`8%`},delay:`2.6s`},{path:`turb/rpm`,base:1480,range:30,decimals:0,unit:`rpm`,style:{left:0,right:0,marginLeft:`auto`,marginRight:`auto`,width:`max-content`,bottom:`10%`},delay:`2.9s`}];function v(){let[e,t]=(0,l.useState)(()=>_.map(e=>({...e,displayValue:(e.base+(Math.random()-.5)*e.range).toFixed(e.decimals),flash:!1})));return(0,l.useEffect)(()=>{let e;function n(){document.hidden||(t(e=>e.map(e=>({...e,displayValue:(e.base+(Math.random()-.5)*e.range).toFixed(e.decimals),flash:!0}))),window.clearTimeout(e),e=window.setTimeout(()=>{t(e=>e.map(e=>({...e,flash:!1})))},400))}let r=window.setInterval(n,2200);return()=>{window.clearInterval(r),window.clearTimeout(e)}},[]),(0,u.jsx)(`div`,{style:{position:`absolute`,inset:0,zIndex:3,pointerEvents:`none`},children:e.map(e=>(0,u.jsxs)(`div`,{style:{position:`absolute`,...e.style,display:`flex`,alignItems:`center`,gap:`0.45rem`,padding:`0.32rem 0.7rem`,background:`color-mix(in srgb, var(--background) 70%, transparent)`,backdropFilter:`blur(6px)`,WebkitBackdropFilter:`blur(6px)`,border:`1px solid color-mix(in srgb, var(--primary) 8%, transparent)`,borderRadius:4,fontFamily:`var(--font-mono)`,fontSize:`0.61rem`,letterSpacing:`0.02em`,opacity:0,animation:`readout-appear 0.6s cubic-bezier(0.22,1,0.36,1) ${e.delay} forwards`},children:[(0,u.jsx)(`span`,{style:{width:4,height:4,borderRadius:`50%`,background:`var(--primary)`,boxShadow:`0 0 3px color-mix(in srgb, var(--primary) 18%, transparent)`,animation:`dot-pulse 2.5s ease-in-out infinite`,flexShrink:0,display:`block`}}),(0,u.jsx)(`span`,{style:{color:`var(--tooltip-border)`},children:e.path}),(0,u.jsx)(`span`,{style:{color:e.flash?`var(--warning)`:`var(--primary)`,fontWeight:600,minWidth:`3em`,textAlign:`right`,transition:`color 0.4s`},children:e.displayValue}),(0,u.jsx)(`span`,{style:{color:`var(--tooltip-border)`,fontSize:`0.54rem`},children:e.unit})]},e.path))})}var y=`miravo start --template smart-factory`,b=6,x=[{id:`sf`,indent:``,label:`site`,text:`smart-factory`},{id:`l1`,indent:` `,label:`area`,text:`line-1`},{id:`p001`,indent:` `,label:`cell`,text:`pump-001`},{id:`p001-t`,indent:` `,text:`temperature`,value:{base:87.3,range:5,decimals:1,unit:`°C`},protocol:`mqtt`},{id:`p001-p`,indent:` `,text:`pressure`,value:{base:4.21,range:.5,decimals:2,unit:`bar`},protocol:`opcua`},{id:`p001-v`,indent:` `,text:`vibration`,value:{base:2.14,range:.3,decimals:2,unit:`mm/s`},protocol:`modbus`},{id:`b002`,indent:` `,label:`cell`,text:`boiler-002`},{id:`b002-t`,indent:` `,text:`temperature`,value:{base:312,range:8,decimals:0,unit:`°C`},protocol:`mqtt`},{id:`c003`,indent:` `,label:`cell`,text:`comp-003`},{id:`c003-r`,indent:` `,text:`rpm`,value:{base:1480,range:30,decimals:0,unit:`rpm`},protocol:`modbus`},{id:`l2`,indent:` `,label:`area`,text:`line-2`},{id:`t004`,indent:` `,label:`cell`,text:`tank-004`},{id:`t004-l`,indent:` `,text:`level`,value:{base:72.1,range:5,decimals:1,unit:`%`},protocol:`mqtt`},{id:`m005`,indent:` `,label:`cell`,text:`motor-005`},{id:`m005-c`,indent:` `,text:`current`,value:{base:12.4,range:1.5,decimals:1,unit:`A`},protocol:`opcua`}],S=14,C=x.flatMap((e,t)=>e.value?[t]:[]),w=4+x.length,T=.66,E=1.85,D=2.1+w*T*E+1.15*T,O=[{assetId:`p001`,name:`cavitation`,event:`fault:cavitation on pump-001: pressure drop`,resolve:`fault:resolved on pump-001: nominal`,overrides:[{tagId:`p001-t`,base:95.2,range:3},{tagId:`p001-p`,base:1.83,range:.3},{tagId:`p001-v`,base:8.71,range:1.5}]},{assetId:`c003`,name:`bearing-wear`,event:`lifecycle:degraded on comp-003: rpm declining`,resolve:`lifecycle:restored on comp-003: nominal`,overrides:[{tagId:`c003-r`,base:924,range:40}]},{assetId:`m005`,name:`overcurrent`,event:`fault:overcurrent on motor-005: current spike`,resolve:`fault:resolved on motor-005: nominal`,overrides:[{tagId:`m005-c`,base:24.8,range:3}]}],k=new Map(x.map((e,t)=>[e.id,t]));function A(){let[e,t]=(0,l.useState)(0),[n,r]=(0,l.useState)(0),[i,a]=(0,l.useState)(()=>x.map(e=>e.value?(e.value.base+(Math.random()-.5)*e.value.range).toFixed(e.value.decimals):``)),[o,s]=(0,l.useState)(new Set),[c,d]=(0,l.useState)(null),[f,p]=(0,l.useState)(`+231 tags streaming`),m=(0,l.useRef)(new Set);(0,l.useEffect)(()=>{let e={timers:[],typeInt:0,liveInt:0,flashT:0},n=(t,n)=>{e.timers.push(window.setTimeout(t,n))},i=0;return n(()=>{e.typeInt=window.setInterval(()=>{if(i++,t(i),i>=37){window.clearInterval(e.typeInt),n(()=>r(1),400),n(()=>r(2),750),n(()=>r(3),1150);for(let e=0;e<x.length;e++)n(()=>r(4+e),1300+e*110);let t=1300+x.length*110+250;n(()=>r(w),t),n(()=>{e.liveInt=window.setInterval(()=>{let t=2+Math.floor(Math.random()*2),n=[...C.filter(e=>!m.current.has(e))].sort(()=>Math.random()-.5).slice(0,t),r=new Set(n);a(e=>{let t=[...e];for(let e of r){let n=x[e]?.value;n&&(t[e]=(n.base+(Math.random()-.5)*n.range).toFixed(n.decimals))}return t}),s(r),window.clearTimeout(e.flashT),e.flashT=window.setTimeout(()=>s(new Set),350)},1600);let t=0,r=()=>{let e=O[t%O.length];if(!e)return;let i=new Set(e.overrides.map(e=>k.get(e.tagId)).filter(e=>e!==void 0));m.current=i,d({assetId:e.assetId,name:e.name,indices:i}),p(e.event),a(t=>{let n=[...t];for(let t of e.overrides){let e=k.get(t.tagId);if(e!==void 0){let r=x[e];n[e]=(t.base+(Math.random()-.5)*t.range).toFixed(r?.value?.decimals??1)}}return n}),n(()=>{m.current=new Set,d(null),p(e.resolve),a(t=>{let n=[...t];for(let t of e.overrides){let e=k.get(t.tagId);if(e!==void 0){let t=x[e];t?.value&&(n[e]=(t.value.base+(Math.random()-.5)*t.value.range).toFixed(t.value.decimals))}}return n}),n(()=>{p(`+231 tags streaming`),t++,n(r,8e3)},4e3)},1e4)};n(r,8e3)},t+500)}},32)},200),()=>{for(let t of e.timers)window.clearTimeout(t);window.clearInterval(e.typeInt),window.clearInterval(e.liveInt),window.clearTimeout(e.flashT)}},[]);let h=y.slice(0,Math.min(e,b)),g=e>b?y.slice(b,e):``;return(0,u.jsx)(`div`,{style:{position:`absolute`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,zIndex:5,pointerEvents:`none`},children:(0,u.jsxs)(`div`,{style:{border:`1px solid color-mix(in srgb, var(--primary) 10%, transparent)`,borderRadius:4,boxShadow:`none`,overflow:`hidden`,width:540},children:[(0,u.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,padding:`0.5rem 0.85rem`,background:`color-mix(in srgb, var(--sidebar) 50%, transparent)`,backdropFilter:`blur(8px)`,WebkitBackdropFilter:`blur(8px)`,borderBottom:`1px solid color-mix(in srgb, var(--primary) 6%, transparent)`},children:[(0,u.jsx)(`span`,{style:{width:7,height:7,borderRadius:`50%`,background:`#ff5f57`,opacity:.5}}),(0,u.jsx)(`span`,{style:{width:7,height:7,borderRadius:`50%`,background:`#febc2e`,opacity:.5}}),(0,u.jsx)(`span`,{style:{width:7,height:7,borderRadius:`50%`,background:`#28c840`,opacity:.5}}),(0,u.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,fontSize:`0.5rem`,color:`var(--tooltip-foreground)`,marginLeft:`auto`,letterSpacing:`0.04em`,opacity:.5},children:`Build realistic industrial environments`})]}),(0,u.jsxs)(`div`,{style:{height:`min(${D}rem, calc(100vh - 11rem))`,overflowY:`auto`,overflowX:`hidden`,background:`color-mix(in srgb, var(--card) 60%, transparent)`,padding:`1rem 1.25rem 1.1rem`,fontFamily:`var(--font-mono)`,fontSize:`${T}rem`,lineHeight:E,whiteSpace:`pre`},children:[(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`span`,{style:{color:`var(--muted-foreground)`},children:`$ `}),(0,u.jsx)(`span`,{style:{color:`var(--primary)`},children:h}),(0,u.jsx)(`span`,{style:{color:`var(--foreground)`,opacity:.9},children:g}),e>0&&e<37&&(0,u.jsx)(`span`,{style:{display:`inline-block`,width:5,height:10,background:`var(--primary)`,verticalAlign:`text-bottom`,marginLeft:1,animation:`cursor-blink 1s step-end infinite`}})]}),n>=1&&(0,u.jsxs)(`div`,{style:{opacity:0,animation:`terminal-line 0.4s ease forwards`},children:[(0,u.jsx)(`span`,{style:{color:`var(--primary)`},children:`✓`}),(0,u.jsx)(`span`,{style:{color:`var(--tooltip-foreground)`},children:` Loaded `}),(0,u.jsx)(`span`,{style:{color:`var(--primary)`},children:`smart-factory`}),(0,u.jsx)(`span`,{style:{color:`var(--muted-foreground)`},children:` · 10 assets · 240 tags`})]}),n>=2&&(0,u.jsxs)(`div`,{style:{opacity:0,animation:`terminal-line 0.4s ease 0.05s forwards`},children:[(0,u.jsx)(`span`,{style:{color:`var(--primary)`},children:`✓`}),(0,u.jsx)(`span`,{style:{color:`var(--tooltip-foreground)`},children:` Protocols `}),(0,u.jsx)(`span`,{style:{color:`var(--muted-foreground)`},children:`mqtt :1883 · opcua :4840 · modbus :1502`})]}),n>=3&&(0,u.jsx)(`div`,{style:{opacity:0,animation:`terminal-line 0.3s ease forwards`,marginTop:`0.6em`}}),x.map((e,t)=>{if(n<4+t)return null;let r=!!e.value;return(0,u.jsxs)(`div`,{style:{opacity:0,animation:`tree-line 0.3s ease forwards`},children:[(0,u.jsx)(`span`,{style:{color:`var(--tooltip-border)`},children:e.indent}),r&&e.value?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`span`,{style:{color:`var(--muted-foreground)`},children:e.text.padEnd(S)}),(0,u.jsx)(`span`,{style:{color:c?.indices.has(t)?`var(--destructive)`:o.has(t)?`var(--primary)`:`var(--foreground)`,transition:`color 0.3s`},children:(i[t]??``).padStart(7)}),(0,u.jsx)(`span`,{style:{color:`var(--tooltip-border)`},children:` ${e.value.unit.padEnd(5)}`}),e.protocol&&(0,u.jsx)(`span`,{style:{color:`var(--tooltip-border)`},children:e.protocol})]}):(0,u.jsxs)(u.Fragment,{children:[e.label&&(0,u.jsx)(`span`,{style:{color:`var(--tooltip-border)`},children:`${e.label}: `}),(0,u.jsx)(`span`,{style:{color:`var(--tooltip-foreground)`},children:e.text}),e.label===`cell`&&c?.assetId===e.id&&(0,u.jsxs)(`span`,{style:{marginLeft:`0.8em`,color:`var(--destructive)`,fontSize:`0.9em`},children:[`: `,c.name]})]})]},e.id)}),n>=w&&(0,u.jsx)(`div`,{style:{opacity:0,animation:`terminal-line 0.4s ease forwards`,marginTop:`0.55em`,textAlign:`right`},children:(0,u.jsx)(`span`,{style:{color:f.includes(`resolved`)||f.includes(`restored`)||f.includes(`fault:`)||f.includes(`lifecycle:`)?`var(--muted-foreground)`:`var(--tooltip-border)`,transition:`color 0.4s`},children:f})})]})]})})}function j(){let[e,t]=(0,l.useState)(!1),[n,r]=(0,l.useState)(``);return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`style`,{children:d}),(0,u.jsxs)(`div`,{className:`login-page`,children:[(0,u.jsxs)(`div`,{className:`login-form-panel`,style:{background:`var(--background)`,backgroundImage:`radial-gradient(circle, color-mix(in srgb, var(--primary) 2.2%, transparent) 1px, transparent 1px)`,backgroundSize:`70px 70px`,display:`flex`,flexDirection:`column`,position:`relative`,overflow:`hidden`},children:[(0,u.jsx)(`div`,{style:{position:`absolute`,bottom:-80,right:-80,width:400,height:400,background:`radial-gradient(circle, color-mix(in srgb, var(--primary) 3.5%, transparent) 0%, transparent 65%)`,pointerEvents:`none`}}),(0,u.jsx)(`div`,{className:`login-header`,style:{padding:`1.25rem 2rem`,borderBottom:`1px solid var(--secondary)`,zIndex:1,display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:(0,u.jsxs)(s,{to:`/`,style:{display:`inline-flex`,alignItems:`center`,gap:`0.5rem`,textDecoration:`none`},children:[(0,u.jsx)(`span`,{style:{display:`flex`,width:32,height:32,flexShrink:0,alignItems:`center`,justifyContent:`center`},children:(0,u.jsx)(`img`,{src:`/miravo-logo.webp`,alt:``,width:28,height:28,loading:`eager`,decoding:`async`,style:{display:`block`,width:`100%`,height:`100%`,objectFit:`contain`,transform:`translateY(1.5px)`}})}),(0,u.jsx)(`span`,{style:{fontFamily:`var(--font-heading)`,fontSize:`1.25rem`,fontWeight:600,color:`var(--foreground)`,letterSpacing:`-0.025em`,lineHeight:1},children:`Miravo`}),(0,u.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,fontSize:`0.52rem`,fontWeight:600,color:`var(--primary)`,background:`color-mix(in srgb, var(--primary) 6%, transparent)`,border:`1px solid color-mix(in srgb, var(--primary) 14%, transparent)`,padding:`0.2rem 0.5rem`,borderRadius:4,lineHeight:1,display:`inline-flex`,alignItems:`center`,alignSelf:`center`},children:`Console`})]})}),(0,u.jsx)(`div`,{className:`login-form-area`,style:{flex:1,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`2.5rem 2rem`,zIndex:1},children:(0,u.jsx)(`div`,{style:{width:`100%`,maxWidth:370},children:(0,u.jsxs)(`div`,{className:`login-card`,style:{position:`relative`,background:`var(--card)`,border:`1px solid color-mix(in srgb, var(--secondary) 80%, transparent)`,borderRadius:4,overflow:`hidden`,padding:`2.25rem`},children:[(0,u.jsx)(`div`,{style:{position:`absolute`,top:0,left:14,right:14,height:1,background:`linear-gradient(90deg, transparent, color-mix(in srgb, var(--primary) 35%, transparent) 20%, color-mix(in srgb, var(--primary) 35%, transparent) 80%, transparent)`}}),e?(0,u.jsx)(h,{username:n}):(0,u.jsx)(m,{onChangePassword:e=>{r(e),t(!0)}})]})})}),(0,u.jsxs)(`div`,{className:`login-footer`,style:{padding:`0.9rem 2rem`,borderTop:`1px solid var(--secondary)`,display:`flex`,justifyContent:`space-between`,alignItems:`center`,zIndex:1},children:[(0,u.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,fontSize:`0.6rem`,color:`var(--tooltip-border)`,letterSpacing:`0.04em`},children:`Miravo Console`}),(0,u.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,fontSize:`0.6rem`,color:`var(--tooltip-border)`,letterSpacing:`0.04em`},children:`© 2026`})]})]}),(0,u.jsxs)(`div`,{className:`login-left`,style:{position:`relative`,background:`var(--background)`,overflow:`hidden`,borderRight:`1px solid color-mix(in srgb, var(--primary) 8%, transparent)`},children:[(0,u.jsx)(`div`,{style:{position:`absolute`,inset:0,zIndex:4,pointerEvents:`none`,opacity:.025,backgroundImage:`url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E")`,backgroundSize:`200px 200px`}}),(0,u.jsx)(g,{}),(0,u.jsx)(`div`,{style:{position:`absolute`,inset:0,zIndex:1,background:`radial-gradient(ellipse 75% 70% at 50% 50%, transparent 40%, color-mix(in srgb, var(--background) 55%, transparent) 100%)`,pointerEvents:`none`}}),(0,u.jsx)(`div`,{style:{position:`absolute`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,width:700,height:500,background:`radial-gradient(ellipse at center, color-mix(in srgb, var(--primary) 1.8%, transparent) 0%, transparent 65%)`,pointerEvents:`none`,zIndex:2,animation:`login-glow-pulse 8s ease-in-out infinite alternate`}}),(0,u.jsx)(v,{}),(0,u.jsx)(A,{})]})]})]})}export{j as LoginPage};
136
+ `;function f({label:e,forId:t,children:n}){return(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`label`,{htmlFor:t,style:{fontFamily:`var(--font-mono)`,fontSize:`0.72rem`,letterSpacing:`0.03em`,color:`var(--muted-foreground)`,display:`block`,marginBottom:`0.5rem`},children:e}),n]})}function p({message:e}){return(0,u.jsx)(`p`,{role:`alert`,style:{fontSize:`0.82rem`,color:`var(--destructive)`,textAlign:`center`,padding:`0.55rem 0.9rem`,background:`color-mix(in srgb, var(--destructive) 6%, transparent)`,border:`1px solid color-mix(in srgb, var(--destructive) 12%, transparent)`,borderRadius:4,margin:`0 0 1rem`},children:e})}function m({onChangePassword:e}){let t=o(),[n,i]=(0,l.useState)(``),[s,d]=(0,l.useState)(``),[m,h]=(0,l.useState)(``),[g,_]=(0,l.useState)(!1);async function v(i){i.preventDefault(),h(``),_(!0);try{(await r(n,s)).changePassword?e(n):(a.removeQueries({queryKey:[`bootstrap`]}),t(`/`,{replace:!0}))}catch(e){h(c(e,`Login failed`))}finally{_(!1)}}return(0,u.jsxs)(`form`,{onSubmit:v,children:[(0,u.jsx)(`div`,{style:{marginBottom:`2rem`},children:(0,u.jsx)(`h1`,{style:{fontFamily:`var(--font-heading)`,fontSize:`1.5rem`,fontWeight:800,color:`var(--foreground)`,letterSpacing:`-0.035em`,lineHeight:1.15,margin:0},children:`Log in`})}),m&&(0,u.jsx)(p,{message:m}),(0,u.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`1.15rem`},children:[(0,u.jsx)(f,{label:`Username`,forId:`username`,children:(0,u.jsx)(`input`,{id:`username`,type:`text`,className:`miravo-input`,autoComplete:`username`,required:!0,value:n,onChange:e=>i(e.target.value)})}),(0,u.jsx)(f,{label:`Password`,forId:`password`,children:(0,u.jsx)(`input`,{id:`password`,type:`password`,className:`miravo-input`,autoComplete:`current-password`,required:!0,value:s,onChange:e=>d(e.target.value)})}),(0,u.jsx)(`button`,{type:`submit`,className:`miravo-btn`,disabled:g,style:{marginTop:`0.5rem`},children:g?`Logging in…`:`Log in`})]})]})}function h({username:e}){let t=o(),[n,r]=(0,l.useState)(``),[s,d]=(0,l.useState)(``),[m,h]=(0,l.useState)(``),[g,_]=(0,l.useState)(!1);async function v(r){if(r.preventDefault(),h(``),n!==s){h(`Passwords do not match`);return}if(n.length<6){h(`Password must be at least 6 characters`);return}_(!0);try{await i(e,n),a.removeQueries({queryKey:[`bootstrap`]}),t(`/`,{replace:!0})}catch(e){h(c(e,`Password change failed`))}finally{_(!1)}}return(0,u.jsxs)(`form`,{onSubmit:v,children:[(0,u.jsxs)(`div`,{style:{marginBottom:`2rem`},children:[(0,u.jsx)(`h1`,{style:{fontFamily:`var(--font-heading)`,fontSize:`1.5rem`,fontWeight:800,color:`var(--foreground)`,letterSpacing:`-0.035em`,lineHeight:1.15,margin:0},children:`Update password`}),(0,u.jsxs)(`p`,{style:{fontSize:`0.82rem`,color:`var(--muted-foreground)`,marginTop:`0.4rem`,lineHeight:1.5},children:[`Default password detected.`,` `,(0,u.jsx)(`span`,{style:{color:`var(--warning)`},children:`Please set a new one.`})]})]}),m&&(0,u.jsx)(p,{message:m}),(0,u.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`1.1rem`},children:[(0,u.jsx)(f,{label:`New password`,forId:`new-password`,children:(0,u.jsx)(`input`,{id:`new-password`,type:`password`,className:`miravo-input`,autoComplete:`new-password`,required:!0,minLength:6,value:n,onChange:e=>r(e.target.value)})}),(0,u.jsx)(f,{label:`Confirm password`,forId:`confirm-password`,children:(0,u.jsx)(`input`,{id:`confirm-password`,type:`password`,className:`miravo-input`,autoComplete:`new-password`,required:!0,minLength:6,value:s,onChange:e=>d(e.target.value)})}),(0,u.jsx)(`button`,{type:`submit`,className:`miravo-btn`,disabled:g,style:{marginTop:`0.4rem`},children:g?`Setting password…`:`Set password`}),(0,u.jsx)(`div`,{style:{textAlign:`center`,marginTop:`0.15rem`},children:(0,u.jsx)(`button`,{type:`button`,className:`miravo-btn-ghost`,onClick:()=>{a.removeQueries({queryKey:[`bootstrap`]}),t(`/`,{replace:!0})},children:`Skip for now`})})]})]})}function g(){let e=(0,l.useRef)(null);return(0,l.useEffect)(()=>{let t=e.current;if(!t)return;let n=t.getContext(`2d`);if(!n)return;let r=t,i=n,a=getComputedStyle(document.documentElement).getPropertyValue(`--primary`).trim(),o=window.devicePixelRatio||1,s=0,c=0,l=0,u=0,d=[],f=[],p=[];function m(){d=[],f=[],p=[];let e=Math.max(15,Math.floor(s*c/35e3));for(let t=0;t<e;t++)d.push({x:0,y:0,bx:25+Math.random()*(s-50),by:25+Math.random()*(c-50),r:1+Math.random()*1.2,phase:Math.random()*Math.PI*2});for(let e=0;e<d.length;e++)for(let t=e+1;t<d.length;t++){let n=d[e],r=d[t];!n||!r||Math.hypot(n.bx-r.bx,n.by-r.by)<160&&Math.random()>.5&&f.push({from:e,to:t})}}function h(){s=r.offsetWidth,c=r.offsetHeight,r.width=s*o,r.height=c*o,i.setTransform(o,0,0,o,0,0),m()}function g(){l+=.016,i.clearRect(0,0,s,c);for(let e of d)e.x=e.bx+Math.sin(l*.15+e.phase)*5,e.y=e.by+Math.cos(l*.1+e.phase*1.3)*4;let e=new Set;for(let t of p)e.add(t.conn.from*256+t.conn.to);i.strokeStyle=a,i.lineWidth=.5;for(let t of f){let n=d[t.from],r=d[t.to];!n||!r||(i.globalAlpha=e.has(t.from*256+t.to)?.04:.012,i.beginPath(),i.moveTo(n.x,n.y),i.lineTo(r.x,r.y),i.stroke())}i.fillStyle=a;for(let e of d)i.globalAlpha=.08*(.6+Math.sin(l*.4+e.phase)*.4),i.beginPath(),i.arc(e.x,e.y,e.r,0,Math.PI*2),i.fill();if(Math.random()<.03&&f.length&&p.length<10){let e=f[Math.floor(Math.random()*f.length)];e&&p.push({conn:e,t:0,speed:.002+Math.random()*.003,alpha:.25+Math.random()*.35,size:1+Math.random()*1})}i.fillStyle=a;for(let e=p.length-1;e>=0;e--){let t=p[e];if(!t)continue;if(t.t+=t.speed,t.t>=1){p.splice(e,1);continue}let n=d[t.conn.from],r=d[t.conn.to];if(!n||!r)continue;let a=n.x+(r.x-n.x)*t.t,o=n.y+(r.y-n.y)*t.t;i.globalAlpha=t.alpha*.35,i.beginPath(),i.arc(a,o,t.size,0,Math.PI*2),i.fill()}i.globalAlpha=1,u=requestAnimationFrame(g)}let _=()=>{document.hidden?cancelAnimationFrame(u):u=requestAnimationFrame(g)},v,y=()=>{window.clearTimeout(v),v=window.setTimeout(h,250)};if(!window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return document.addEventListener(`visibilitychange`,_),window.addEventListener(`resize`,y),h(),g(),()=>{cancelAnimationFrame(u),window.clearTimeout(v),document.removeEventListener(`visibilitychange`,_),window.removeEventListener(`resize`,y)}},[]),(0,u.jsx)(`canvas`,{ref:e,style:{position:`absolute`,inset:0,width:`100%`,height:`100%`}})}var _=[{path:`pump-001/temp`,base:87.3,range:5,decimals:1,unit:`°C`,style:{left:`6%`,top:`18%`},delay:`1.4s`},{path:`comp/pressure`,base:4.21,range:.5,decimals:2,unit:`bar`,style:{right:`5%`,top:`12%`},delay:`1.7s`},{path:`motor/vibration`,base:2.14,range:.3,decimals:2,unit:`mm/s`,style:{left:`4%`,bottom:`18%`},delay:`2.0s`},{path:`gen/power`,base:482,range:20,decimals:0,unit:`kW`,style:{right:`4%`,bottom:`17%`},delay:`2.3s`},{path:`boiler/temp`,base:312,range:8,decimals:0,unit:`°C`,style:{left:`22%`,top:`8%`},delay:`2.6s`},{path:`turb/rpm`,base:1480,range:30,decimals:0,unit:`rpm`,style:{left:0,right:0,marginLeft:`auto`,marginRight:`auto`,width:`max-content`,bottom:`10%`},delay:`2.9s`}];function v(){let[e,t]=(0,l.useState)(()=>_.map(e=>({...e,displayValue:(e.base+(Math.random()-.5)*e.range).toFixed(e.decimals),flash:!1})));return(0,l.useEffect)(()=>{let e;function n(){document.hidden||(t(e=>e.map(e=>({...e,displayValue:(e.base+(Math.random()-.5)*e.range).toFixed(e.decimals),flash:!0}))),window.clearTimeout(e),e=window.setTimeout(()=>{t(e=>e.map(e=>({...e,flash:!1})))},400))}let r=window.setInterval(n,2200);return()=>{window.clearInterval(r),window.clearTimeout(e)}},[]),(0,u.jsx)(`div`,{style:{position:`absolute`,inset:0,zIndex:3,pointerEvents:`none`},children:e.map(e=>(0,u.jsxs)(`div`,{style:{position:`absolute`,...e.style,display:`flex`,alignItems:`center`,gap:`0.45rem`,padding:`0.32rem 0.7rem`,background:`color-mix(in srgb, var(--background) 70%, transparent)`,backdropFilter:`blur(6px)`,WebkitBackdropFilter:`blur(6px)`,border:`1px solid color-mix(in srgb, var(--primary) 8%, transparent)`,borderRadius:4,fontFamily:`var(--font-mono)`,fontSize:`0.61rem`,letterSpacing:`0.02em`,opacity:0,animation:`readout-appear 0.6s cubic-bezier(0.22,1,0.36,1) ${e.delay} forwards`},children:[(0,u.jsx)(`span`,{style:{width:4,height:4,borderRadius:`50%`,background:`var(--primary)`,boxShadow:`0 0 3px color-mix(in srgb, var(--primary) 18%, transparent)`,animation:`dot-pulse 2.5s ease-in-out infinite`,flexShrink:0,display:`block`}}),(0,u.jsx)(`span`,{style:{color:`var(--tooltip-border)`},children:e.path}),(0,u.jsx)(`span`,{style:{color:e.flash?`var(--warning)`:`var(--primary)`,fontWeight:600,minWidth:`3em`,textAlign:`right`,transition:`color 0.4s`},children:e.displayValue}),(0,u.jsx)(`span`,{style:{color:`var(--tooltip-border)`,fontSize:`0.54rem`},children:e.unit})]},e.path))})}var y=`miravo start --template smart-factory`,b=6,x=[{id:`sf`,indent:``,label:`site`,text:`smart-factory`},{id:`l1`,indent:` `,label:`area`,text:`line-1`},{id:`p001`,indent:` `,label:`cell`,text:`pump-001`},{id:`p001-t`,indent:` `,text:`temperature`,value:{base:87.3,range:5,decimals:1,unit:`°C`},protocol:`mqtt`},{id:`p001-p`,indent:` `,text:`pressure`,value:{base:4.21,range:.5,decimals:2,unit:`bar`},protocol:`opcua`},{id:`p001-v`,indent:` `,text:`vibration`,value:{base:2.14,range:.3,decimals:2,unit:`mm/s`},protocol:`modbus`},{id:`b002`,indent:` `,label:`cell`,text:`boiler-002`},{id:`b002-t`,indent:` `,text:`temperature`,value:{base:312,range:8,decimals:0,unit:`°C`},protocol:`mqtt`},{id:`c003`,indent:` `,label:`cell`,text:`comp-003`},{id:`c003-r`,indent:` `,text:`rpm`,value:{base:1480,range:30,decimals:0,unit:`rpm`},protocol:`modbus`},{id:`l2`,indent:` `,label:`area`,text:`line-2`},{id:`t004`,indent:` `,label:`cell`,text:`tank-004`},{id:`t004-l`,indent:` `,text:`level`,value:{base:72.1,range:5,decimals:1,unit:`%`},protocol:`mqtt`},{id:`m005`,indent:` `,label:`cell`,text:`motor-005`},{id:`m005-c`,indent:` `,text:`current`,value:{base:12.4,range:1.5,decimals:1,unit:`A`},protocol:`opcua`}],S=14,C=x.flatMap((e,t)=>e.value?[t]:[]),w=4+x.length,T=.66,E=1.85,D=2.1+w*T*E+1.15*T,O=[{assetId:`p001`,name:`cavitation`,event:`fault:cavitation on pump-001: pressure drop`,resolve:`fault:resolved on pump-001: nominal`,overrides:[{tagId:`p001-t`,base:95.2,range:3},{tagId:`p001-p`,base:1.83,range:.3},{tagId:`p001-v`,base:8.71,range:1.5}]},{assetId:`c003`,name:`bearing-wear`,event:`lifecycle:degraded on comp-003: rpm declining`,resolve:`lifecycle:restored on comp-003: nominal`,overrides:[{tagId:`c003-r`,base:924,range:40}]},{assetId:`m005`,name:`overcurrent`,event:`fault:overcurrent on motor-005: current spike`,resolve:`fault:resolved on motor-005: nominal`,overrides:[{tagId:`m005-c`,base:24.8,range:3}]}],k=new Map(x.map((e,t)=>[e.id,t]));function A(){let[e,t]=(0,l.useState)(0),[n,r]=(0,l.useState)(0),[i,a]=(0,l.useState)(()=>x.map(e=>e.value?(e.value.base+(Math.random()-.5)*e.value.range).toFixed(e.value.decimals):``)),[o,s]=(0,l.useState)(new Set),[c,d]=(0,l.useState)(null),[f,p]=(0,l.useState)(`+231 tags streaming`),m=(0,l.useRef)(new Set);(0,l.useEffect)(()=>{let e={timers:[],typeInt:0,liveInt:0,flashT:0},n=(t,n)=>{e.timers.push(window.setTimeout(t,n))},i=0;return n(()=>{e.typeInt=window.setInterval(()=>{if(i++,t(i),i>=37){window.clearInterval(e.typeInt),n(()=>r(1),400),n(()=>r(2),750),n(()=>r(3),1150);for(let e=0;e<x.length;e++)n(()=>r(4+e),1300+e*110);let t=1300+x.length*110+250;n(()=>r(w),t),n(()=>{e.liveInt=window.setInterval(()=>{let t=2+Math.floor(Math.random()*2),n=[...C.filter(e=>!m.current.has(e))].sort(()=>Math.random()-.5).slice(0,t),r=new Set(n);a(e=>{let t=[...e];for(let e of r){let n=x[e]?.value;n&&(t[e]=(n.base+(Math.random()-.5)*n.range).toFixed(n.decimals))}return t}),s(r),window.clearTimeout(e.flashT),e.flashT=window.setTimeout(()=>s(new Set),350)},1600);let t=0,r=()=>{let e=O[t%O.length];if(!e)return;let i=new Set(e.overrides.map(e=>k.get(e.tagId)).filter(e=>e!==void 0));m.current=i,d({assetId:e.assetId,name:e.name,indices:i}),p(e.event),a(t=>{let n=[...t];for(let t of e.overrides){let e=k.get(t.tagId);if(e!==void 0){let r=x[e];n[e]=(t.base+(Math.random()-.5)*t.range).toFixed(r?.value?.decimals??1)}}return n}),n(()=>{m.current=new Set,d(null),p(e.resolve),a(t=>{let n=[...t];for(let t of e.overrides){let e=k.get(t.tagId);if(e!==void 0){let t=x[e];t?.value&&(n[e]=(t.value.base+(Math.random()-.5)*t.value.range).toFixed(t.value.decimals))}}return n}),n(()=>{p(`+231 tags streaming`),t++,n(r,8e3)},4e3)},1e4)};n(r,8e3)},t+500)}},32)},200),()=>{for(let t of e.timers)window.clearTimeout(t);window.clearInterval(e.typeInt),window.clearInterval(e.liveInt),window.clearTimeout(e.flashT)}},[]);let h=y.slice(0,Math.min(e,b)),g=e>b?y.slice(b,e):``;return(0,u.jsx)(`div`,{style:{position:`absolute`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,zIndex:5,pointerEvents:`none`},children:(0,u.jsxs)(`div`,{style:{border:`1px solid color-mix(in srgb, var(--primary) 10%, transparent)`,borderRadius:4,boxShadow:`none`,overflow:`hidden`,width:540},children:[(0,u.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,padding:`0.5rem 0.85rem`,background:`color-mix(in srgb, var(--sidebar) 50%, transparent)`,backdropFilter:`blur(8px)`,WebkitBackdropFilter:`blur(8px)`,borderBottom:`1px solid color-mix(in srgb, var(--primary) 6%, transparent)`},children:[(0,u.jsx)(`span`,{style:{width:7,height:7,borderRadius:`50%`,background:`#ff5f57`,opacity:.5}}),(0,u.jsx)(`span`,{style:{width:7,height:7,borderRadius:`50%`,background:`#febc2e`,opacity:.5}}),(0,u.jsx)(`span`,{style:{width:7,height:7,borderRadius:`50%`,background:`#28c840`,opacity:.5}}),(0,u.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,fontSize:`0.5rem`,color:`var(--tooltip-foreground)`,marginLeft:`auto`,letterSpacing:`0.04em`,opacity:.5},children:`Factory simulator`})]}),(0,u.jsxs)(`div`,{style:{height:`min(${D}rem, calc(100vh - 11rem))`,overflowY:`auto`,overflowX:`hidden`,background:`color-mix(in srgb, var(--card) 60%, transparent)`,padding:`1rem 1.25rem 1.1rem`,fontFamily:`var(--font-mono)`,fontSize:`${T}rem`,lineHeight:E,whiteSpace:`pre`},children:[(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`span`,{style:{color:`var(--muted-foreground)`},children:`$ `}),(0,u.jsx)(`span`,{style:{color:`var(--primary)`},children:h}),(0,u.jsx)(`span`,{style:{color:`var(--foreground)`,opacity:.9},children:g}),e>0&&e<37&&(0,u.jsx)(`span`,{style:{display:`inline-block`,width:5,height:10,background:`var(--primary)`,verticalAlign:`text-bottom`,marginLeft:1,animation:`cursor-blink 1s step-end infinite`}})]}),n>=1&&(0,u.jsxs)(`div`,{style:{opacity:0,animation:`terminal-line 0.4s ease forwards`},children:[(0,u.jsx)(`span`,{style:{color:`var(--primary)`},children:`✓`}),(0,u.jsx)(`span`,{style:{color:`var(--tooltip-foreground)`},children:` Loaded `}),(0,u.jsx)(`span`,{style:{color:`var(--primary)`},children:`smart-factory`}),(0,u.jsx)(`span`,{style:{color:`var(--muted-foreground)`},children:` · 10 assets · 240 tags`})]}),n>=2&&(0,u.jsxs)(`div`,{style:{opacity:0,animation:`terminal-line 0.4s ease 0.05s forwards`},children:[(0,u.jsx)(`span`,{style:{color:`var(--primary)`},children:`✓`}),(0,u.jsx)(`span`,{style:{color:`var(--tooltip-foreground)`},children:` Protocols `}),(0,u.jsx)(`span`,{style:{color:`var(--muted-foreground)`},children:`mqtt :1883 · opcua :4840 · modbus :1502`})]}),n>=3&&(0,u.jsx)(`div`,{style:{opacity:0,animation:`terminal-line 0.3s ease forwards`,marginTop:`0.6em`}}),x.map((e,t)=>{if(n<4+t)return null;let r=!!e.value;return(0,u.jsxs)(`div`,{style:{opacity:0,animation:`tree-line 0.3s ease forwards`},children:[(0,u.jsx)(`span`,{style:{color:`var(--tooltip-border)`},children:e.indent}),r&&e.value?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`span`,{style:{color:`var(--muted-foreground)`},children:e.text.padEnd(S)}),(0,u.jsx)(`span`,{style:{color:c?.indices.has(t)?`var(--destructive)`:o.has(t)?`var(--primary)`:`var(--foreground)`,transition:`color 0.3s`},children:(i[t]??``).padStart(7)}),(0,u.jsx)(`span`,{style:{color:`var(--tooltip-border)`},children:` ${e.value.unit.padEnd(5)}`}),e.protocol&&(0,u.jsx)(`span`,{style:{color:`var(--tooltip-border)`},children:e.protocol})]}):(0,u.jsxs)(u.Fragment,{children:[e.label&&(0,u.jsx)(`span`,{style:{color:`var(--tooltip-border)`},children:`${e.label}: `}),(0,u.jsx)(`span`,{style:{color:`var(--tooltip-foreground)`},children:e.text}),e.label===`cell`&&c?.assetId===e.id&&(0,u.jsxs)(`span`,{style:{marginLeft:`0.8em`,color:`var(--destructive)`,fontSize:`0.9em`},children:[`: `,c.name]})]})]},e.id)}),n>=w&&(0,u.jsx)(`div`,{style:{opacity:0,animation:`terminal-line 0.4s ease forwards`,marginTop:`0.55em`,textAlign:`right`},children:(0,u.jsx)(`span`,{style:{color:f.includes(`resolved`)||f.includes(`restored`)||f.includes(`fault:`)||f.includes(`lifecycle:`)?`var(--muted-foreground)`:`var(--tooltip-border)`,transition:`color 0.4s`},children:f})})]})]})})}function j(){let[e,t]=(0,l.useState)(!1),[n,r]=(0,l.useState)(``);return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`style`,{children:d}),(0,u.jsxs)(`div`,{className:`login-page`,children:[(0,u.jsxs)(`div`,{className:`login-form-panel`,style:{background:`var(--background)`,backgroundImage:`radial-gradient(circle, color-mix(in srgb, var(--primary) 2.2%, transparent) 1px, transparent 1px)`,backgroundSize:`70px 70px`,display:`flex`,flexDirection:`column`,position:`relative`,overflow:`hidden`},children:[(0,u.jsx)(`div`,{style:{position:`absolute`,bottom:-80,right:-80,width:400,height:400,background:`radial-gradient(circle, color-mix(in srgb, var(--primary) 3.5%, transparent) 0%, transparent 65%)`,pointerEvents:`none`}}),(0,u.jsx)(`div`,{className:`login-header`,style:{padding:`1.25rem 2rem`,borderBottom:`1px solid var(--secondary)`,zIndex:1,display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:(0,u.jsxs)(s,{to:`/`,style:{display:`inline-flex`,alignItems:`center`,gap:`0.5rem`,textDecoration:`none`},children:[(0,u.jsx)(`span`,{style:{display:`flex`,width:32,height:32,flexShrink:0,alignItems:`center`,justifyContent:`center`},children:(0,u.jsx)(`img`,{src:`/miravo-logo.webp`,alt:``,width:28,height:28,loading:`eager`,decoding:`async`,style:{display:`block`,width:`100%`,height:`100%`,objectFit:`contain`,transform:`translateY(1.5px)`}})}),(0,u.jsx)(`span`,{style:{fontFamily:`var(--font-heading)`,fontSize:`1.25rem`,fontWeight:600,color:`var(--foreground)`,letterSpacing:`-0.025em`,lineHeight:1},children:`Miravo`}),(0,u.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,fontSize:`0.52rem`,fontWeight:600,color:`var(--primary)`,background:`color-mix(in srgb, var(--primary) 6%, transparent)`,border:`1px solid color-mix(in srgb, var(--primary) 14%, transparent)`,padding:`0.2rem 0.5rem`,borderRadius:4,lineHeight:1,display:`inline-flex`,alignItems:`center`,alignSelf:`center`},children:`Console`})]})}),(0,u.jsx)(`div`,{className:`login-form-area`,style:{flex:1,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`2.5rem 2rem`,zIndex:1},children:(0,u.jsx)(`div`,{style:{width:`100%`,maxWidth:370},children:(0,u.jsxs)(`div`,{className:`login-card`,style:{position:`relative`,background:`var(--card)`,border:`1px solid color-mix(in srgb, var(--secondary) 80%, transparent)`,borderRadius:4,overflow:`hidden`,padding:`2.25rem`},children:[(0,u.jsx)(`div`,{style:{position:`absolute`,top:0,left:14,right:14,height:1,background:`linear-gradient(90deg, transparent, color-mix(in srgb, var(--primary) 35%, transparent) 20%, color-mix(in srgb, var(--primary) 35%, transparent) 80%, transparent)`}}),e?(0,u.jsx)(h,{username:n}):(0,u.jsx)(m,{onChangePassword:e=>{r(e),t(!0)}})]})})}),(0,u.jsxs)(`div`,{className:`login-footer`,style:{padding:`0.9rem 2rem`,borderTop:`1px solid var(--secondary)`,display:`flex`,justifyContent:`space-between`,alignItems:`center`,zIndex:1},children:[(0,u.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,fontSize:`0.6rem`,color:`var(--tooltip-border)`,letterSpacing:`0.04em`},children:`Miravo Console`}),(0,u.jsx)(`span`,{style:{fontFamily:`var(--font-mono)`,fontSize:`0.6rem`,color:`var(--tooltip-border)`,letterSpacing:`0.04em`},children:`© 2026`})]})]}),(0,u.jsxs)(`div`,{className:`login-left`,style:{position:`relative`,background:`var(--background)`,overflow:`hidden`,borderRight:`1px solid color-mix(in srgb, var(--primary) 8%, transparent)`},children:[(0,u.jsx)(`div`,{style:{position:`absolute`,inset:0,zIndex:4,pointerEvents:`none`,opacity:.025,backgroundImage:`url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E")`,backgroundSize:`200px 200px`}}),(0,u.jsx)(g,{}),(0,u.jsx)(`div`,{style:{position:`absolute`,inset:0,zIndex:1,background:`radial-gradient(ellipse 75% 70% at 50% 50%, transparent 40%, color-mix(in srgb, var(--background) 55%, transparent) 100%)`,pointerEvents:`none`}}),(0,u.jsx)(`div`,{style:{position:`absolute`,top:`50%`,left:`50%`,transform:`translate(-50%, -50%)`,width:700,height:500,background:`radial-gradient(ellipse at center, color-mix(in srgb, var(--primary) 1.8%, transparent) 0%, transparent 65%)`,pointerEvents:`none`,zIndex:2,animation:`login-glow-pulse 8s ease-in-out infinite alternate`}}),(0,u.jsx)(v,{}),(0,u.jsx)(A,{})]})]})]})}export{j as LoginPage};
@@ -0,0 +1 @@
1
+ import{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,P as i,S as a,j as o,o as s,v as ee}from"./api-DdyA1QMC.js";import{i as te,t as c}from"./query-fetch-error-ytmF7SP9.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-RVCJ3aqM.js";import{C as m,S as h,_ as g,d as _,l as oe,u as v}from"./format-6q8Tnwmn.js";import{n as y,t as b}from"./utils-XFKvwlFT.js";import{t as x}from"./activity-Cy_niK56.js";import{F as S,L as C,P as se,n as w,t as T}from"./use-integration-stream-CFkuEB9r.js";import{l as E}from"./select-Cg2u0NQI.js";import{i as D,n as O,r as k,t as A}from"./tabs-BJs5Kci7.js";import{r as ce}from"./checkbox-BL44aFel.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-CPFWtBJF.js";import{a as de,c as fe,i as B,s as V,t as pe}from"./use-engine-command-mutation-OZ8_Roso.js";import{t as me}from"./triangle-alert-BXrJNk3g.js";import{t as H}from"./badge-DuuEINVl.js";import{t as he}from"./label-DTHSKF2S.js";import{n as ge}from"./get-error-message-BowDodwy.js";import{t as _e}from"./spawn-protocol-scope-picker-DDi-hZwj.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}.asset.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,fe=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?{assetName:a}:{},...o?{assetPrefix: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?o(J):``,Z=T.trim()||X,Q=C.trim()||(Z?r(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 asset 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}),fe&&(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(de,`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 asset 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 assets?`}),(0,K.jsx)(re,{children:x!==null&&(0,K.jsxs)(K.Fragment,{children:[`This spawns `,V(x),` asset`,V(x)===1?``:`s`,` of`,` `,(0,K.jsx)(`span`,{className:`font-medium text-foreground`,children:_(x)}),` `,`into the running factory. 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-asset-name`,className:`text-xs font-medium text-foreground`,children:`Exact asset ID`}),(0,K.jsx)(h,{id:`spawn-asset-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-asset-name-hint`}),(0,K.jsx)(`p`,{id:`spawn-asset-name-hint`,className:`min-w-0 wrap-break-word text-[11px] text-muted-foreground`,children:`Use exact name for one asset 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-asset-prefix`,className:`text-xs font-medium text-foreground`,children:`Generated prefix`}),(0,K.jsx)(h,{id:`spawn-asset-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-asset-prefix-hint`}),(0,K.jsxs)(`p`,{id:`spawn-asset-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)(fe,{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};
@@ -0,0 +1 @@
1
+ import{t as e}from"./models-BDeOqKQk.js";export{e as ModelsPage};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{at as n}from"./vendor-ui-CWUk2ulb.js";import{Ct as r,St as i,_t as a,bt as o,dt as s,ft as c,gt as l,ht as u,lt as d,pt as f,ut as p,vt as m,wt as h,xt as g,yt as _}from"./api-5BZroqlO.js";import{C as v}from"./format-B9CcV2dj.js";import{n as y,t as b}from"./utils-XFKvwlFT.js";var x=class extends h{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=s(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),C(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return w(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return w(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof a(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!_(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&T(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||a(this.options.enabled,this.#t)!==a(t.enabled,this.#t)||m(this.options.staleTime,this.#t)!==m(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||a(this.options.enabled,this.#t)!==a(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return D(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(u)),t}#g(){this.#b();let e=m(this.options.staleTime,this.#t);if(c.isServer()||this.#r.isStale||!f(e))return;let t=g(this.#r.dataUpdatedAt,e)+1;this.#d=i.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(c.isServer()||a(this.options.enabled,this.#t)===!1||!f(this.#p)||this.#p===0)&&(this.#f=i.setInterval(()=>{(this.options.refetchIntervalInBackground||r.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(i.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(i.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,o=this.#i,c=this.#a,u=e===n?this.#n:e.state,{state:f}=e,p={...f},m=!1,h;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&C(e,t),o=i&&T(e,n,t,r);(a||o)&&(p={...p,...d(f.data,e.options)}),t._optimisticResults===`isRestoring`&&(p.fetchStatus=`idle`)}let{error:g,errorUpdatedAt:_,status:v}=p;h=p.data;let y=!1;if(t.placeholderData!==void 0&&h===void 0&&v===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===c?.placeholderData?(e=i.data,y=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(v=`success`,h=l(i?.data,e,t),m=!0)}if(t.select&&h!==void 0&&!y)if(i&&h===o?.data&&t.select===this.#c)h=this.#l;else try{this.#c=t.select,h=t.select(h),h=l(i?.data,h,t),this.#l=h,this.#s=null}catch(e){this.#s=e}this.#s&&(g=this.#s,h=this.#l,_=Date.now(),v=`error`);let b=p.fetchStatus===`fetching`,x=v===`pending`,S=v===`error`,w=x&&b,D=h!==void 0,O={status:v,fetchStatus:p.fetchStatus,isPending:x,isSuccess:v===`success`,isError:S,isInitialLoading:w,isLoading:w,data:h,dataUpdatedAt:p.dataUpdatedAt,error:g,errorUpdatedAt:_,failureCount:p.fetchFailureCount,failureReason:p.fetchFailureReason,errorUpdateCount:p.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:p.dataUpdateCount>u.dataUpdateCount||p.errorUpdateCount>u.errorUpdateCount,isFetching:b,isRefetching:b&&!x,isLoadingError:S&&!D,isPaused:p.fetchStatus===`paused`,isPlaceholderData:m,isRefetchError:S&&D,isStale:E(e,t),refetch:this.refetch,promise:this.#o,isEnabled:a(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=O.data!==void 0,r=O.status===`error`&&!t,i=e=>{r?e.reject(O.error):t&&e.resolve(O.data)},a=()=>{i(this.#o=O.promise=s())},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||O.data!==o.value)&&a();break;case`rejected`:(!r||O.error!==o.reason)&&a();break}}return O}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!_(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){p.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function S(e,t){return a(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&t.retryOnMount===!1)}function C(e,t){return S(e,t)||e.state.data!==void 0&&w(e,t,t.refetchOnMount)}function w(e,t,n){if(a(t.enabled,e)!==!1&&m(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&E(e,t)}return!1}function T(e,t,n,r){return(e!==t||a(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&E(e,n)}function E(e,t){return a(t.enabled,e)!==!1&&e.isStaleByTime(m(t.staleTime,e))}function D(e,t){return!_(e.getCurrentResult(),t)}var O=e(t(),1),k=n(),A=O.createContext(void 0),j=e=>{let t=O.useContext(A);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},M=({client:e,children:t})=>(O.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,k.jsx)(A.Provider,{value:e,children:t})),N=O.createContext(!1),P=()=>O.useContext(N);N.Provider;function F(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var I=O.createContext(F()),L=()=>O.useContext(I),R=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?o(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},z=e=>{O.useEffect(()=>{e.clearReset()},[e])},B=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||o(n,[e.error,r])),V=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},H=(e,t)=>e.isLoading&&e.isFetching&&!t,U=(e,t)=>e?.suspense&&t.isPending,W=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function G(e,t,n){let r=P(),i=L(),a=j(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash);o._optimisticResults=r?`isRestoring`:`optimistic`,V(o),R(o,i,s),z(i);let l=!a.getQueryCache().get(o.queryHash),[d]=O.useState(()=>new t(a,o)),f=d.getOptimisticResult(o),m=!r&&e.subscribed!==!1;if(O.useSyncExternalStore(O.useCallback(e=>{let t=m?d.subscribe(p.batchCalls(e)):u;return d.updateResult(),t},[d,m]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),O.useEffect(()=>{d.setOptions(o)},[o,d]),U(o,f))throw W(o,d,i);if(B({result:f,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw f.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,f),o.experimental_prefetchInRender&&!c.isServer()&&H(f,r)&&(l?W(o,d,i):s?.promise)?.catch(u).finally(()=>{d.updateResult()}),o.notifyOnChangeProps?f:d.trackResult(f)}function K(e,t){return G(e,x,t)}var q=y(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]);function J({role:e=`status`,"aria-live":t=`polite`,"aria-atomic":n=!0,className:r,eyebrow:i,stamp:a,title:o,children:s,detailLabel:c=`Technical detail`,detail:l,primaryLabel:u,onPrimary:d,primaryIcon:f,primaryDisabled:p,primaryBusy:m,secondaryLabel:h,onSecondary:g}){return(0,k.jsx)(`div`,{role:e,"aria-live":t,"aria-atomic":n,className:b(`relative overflow-hidden rounded-[var(--miravo-radius-stadium-lg)] border border-primary/20 bg-transparent`,r),children:(0,k.jsx)(`div`,{className:`p-5 sm:p-6`,children:(0,k.jsxs)(`div`,{className:`min-w-0 space-y-4`,children:[(0,k.jsxs)(`div`,{className:`space-y-3`,children:[(0,k.jsx)(`p`,{className:`font-mono text-[0.65rem] uppercase tracking-[0.38em] text-muted-foreground`,children:i}),(0,k.jsxs)(`div`,{className:`flex items-end gap-3`,children:[(0,k.jsx)(`span`,{className:`font-heading text-3xl font-black leading-none tracking-[-0.06em] text-transparent [-webkit-text-stroke:1px_color-mix(in_srgb,var(--primary)_50%,transparent)] sm:text-4xl`,"aria-hidden":!0,children:a}),(0,k.jsx)(`div`,{className:`mb-1.5 h-px min-w-8 flex-1 bg-linear-to-r from-primary/55 to-transparent`})]}),(0,k.jsx)(`h2`,{className:`text-lg font-semibold tracking-[-0.03em] text-foreground sm:text-xl`,children:o}),s?(0,k.jsx)(`div`,{className:`space-y-2 text-sm leading-relaxed text-muted-foreground`,children:s}):null]}),(0,k.jsxs)(`div`,{className:`rounded-[var(--miravo-radius-stadium-sm)] border border-border/80 bg-background/55 p-4 backdrop-blur-sm`,children:[(0,k.jsx)(`div`,{className:`mb-2 font-mono text-[0.65rem] uppercase tracking-[0.28em] text-muted-foreground`,children:c}),(0,k.jsx)(`p`,{className:`wrap-break-word font-mono text-sm leading-relaxed text-primary`,children:l})]}),(0,k.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:flex-wrap`,children:[(0,k.jsxs)(v,{type:`button`,onClick:d,disabled:!!(p||m),"aria-busy":m,className:b(`inline-flex w-full items-center justify-center gap-2 rounded-[var(--miravo-radius-stadium-sm)] border border-foreground/15 bg-foreground px-4 py-2.5 font-medium text-background shadow-none transition hover:bg-foreground/90 sm:w-auto`,m&&`pointer-events-none opacity-90`),children:[f,u]}),h&&g?(0,k.jsx)(v,{type:`button`,variant:`ghost`,size:`sm`,className:`sm:self-center`,onClick:g,children:h}):null]})]})})})}function Y({message:e,onRetry:t,isRetrying:n}){return(0,k.jsxs)(J,{role:`alert`,eyebrow:`Data link fault`,stamp:`ERR`,title:`Couldn't reach Miravo`,detail:e,primaryLabel:`Retry request`,onPrimary:t,primaryBusy:!!n,primaryIcon:(0,k.jsx)(q,{className:b(`size-4 shrink-0`,n&&`animate-spin`),"aria-hidden":!0}),children:[(0,k.jsxs)(`p`,{children:[(0,k.jsx)(`span`,{className:`text-foreground`,children:`Most often:`}),` the Miravo admin server isn't running, or this browser can't reach it (wrong host, port, or firewall).`]}),(0,k.jsx)(`p`,{children:`Start or restart Miravo if needed, use the correct link to the Miravo Console, then try again.`})]})}export{G as a,x as c,K as i,J as n,M as o,q as r,j as s,Y as t};
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{at as n}from"./vendor-ui-CWUk2ulb.js";import{Ct as r,Dt as i,Et as a,Ot as o,St as s,Tt as c,_t as l,bt as u,gt as d,ht as f,mt as p,pt as m,wt as h,xt as g,yt as _}from"./api-DdyA1QMC.js";import{C as v}from"./format-6q8Tnwmn.js";import{n as y,t as b}from"./utils-XFKvwlFT.js";var x=class extends o{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=f(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),C(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return w(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return w(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof g(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!r(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let i=this.hasListeners();i&&T(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),i&&(this.#t!==n||g(this.options.enabled,this.#t)!==g(t.enabled,this.#t)||s(this.options.staleTime,this.#t)!==s(t.staleTime,this.#t))&&this.#g();let a=this.#_();i&&(this.#t!==n||g(this.options.enabled,this.#t)!==g(t.enabled,this.#t)||a!==this.#p)&&this.#v(a)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return D(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(_)),t}#g(){this.#b();let e=s(this.options.staleTime,this.#t);if(d.isServer()||this.#r.isStale||!l(e))return;let t=c(this.#r.dataUpdatedAt,e)+1;this.#d=a.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(d.isServer()||g(this.options.enabled,this.#t)===!1||!l(this.#p)||this.#p===0)&&(this.#f=a.setInterval(()=>{(this.options.refetchIntervalInBackground||i.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(a.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(a.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},d=!1,p;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&C(e,t),o=i&&T(e,n,t,r);(a||o)&&(l={...l,...m(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:h,errorUpdatedAt:_,status:v}=l;p=l.data;let y=!1;if(t.placeholderData!==void 0&&p===void 0&&v===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,y=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(v=`success`,p=u(i?.data,e,t),d=!0)}if(t.select&&p!==void 0&&!y)if(i&&p===a?.data&&t.select===this.#c)p=this.#l;else try{this.#c=t.select,p=t.select(p),p=u(i?.data,p,t),this.#l=p,this.#s=null}catch(e){this.#s=e}this.#s&&(h=this.#s,p=this.#l,_=Date.now(),v=`error`);let b=l.fetchStatus===`fetching`,x=v===`pending`,S=v===`error`,w=x&&b,D=p!==void 0,O={status:v,fetchStatus:l.fetchStatus,isPending:x,isSuccess:v===`success`,isError:S,isInitialLoading:w,isLoading:w,data:p,dataUpdatedAt:l.dataUpdatedAt,error:h,errorUpdatedAt:_,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:b,isRefetching:b&&!x,isLoadingError:S&&!D,isPaused:l.fetchStatus===`paused`,isPlaceholderData:d,isRefetchError:S&&D,isStale:E(e,t),refetch:this.refetch,promise:this.#o,isEnabled:g(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=O.data!==void 0,r=O.status===`error`&&!t,i=e=>{r?e.reject(O.error):t&&e.resolve(O.data)},a=()=>{i(this.#o=O.promise=f())},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||O.data!==o.value)&&a();break;case`rejected`:(!r||O.error!==o.reason)&&a();break}}return O}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!r(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){p.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function S(e,t){return g(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&t.retryOnMount===!1)}function C(e,t){return S(e,t)||e.state.data!==void 0&&w(e,t,t.refetchOnMount)}function w(e,t,n){if(g(t.enabled,e)!==!1&&s(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&E(e,t)}return!1}function T(e,t,n,r){return(e!==t||g(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&E(e,n)}function E(e,t){return g(t.enabled,e)!==!1&&e.isStaleByTime(s(t.staleTime,e))}function D(e,t){return!r(e.getCurrentResult(),t)}var O=e(t(),1),k=n(),A=O.createContext(void 0),j=e=>{let t=O.useContext(A);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},M=({client:e,children:t})=>(O.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,k.jsx)(A.Provider,{value:e,children:t})),N=O.createContext(!1),P=()=>O.useContext(N);N.Provider;function F(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var I=O.createContext(F()),L=()=>O.useContext(I),R=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?h(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},z=e=>{O.useEffect(()=>{e.clearReset()},[e])},B=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||h(n,[e.error,r])),V=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},H=(e,t)=>e.isLoading&&e.isFetching&&!t,U=(e,t)=>e?.suspense&&t.isPending,W=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function G(e,t,n){let r=P(),i=L(),a=j(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash);o._optimisticResults=r?`isRestoring`:`optimistic`,V(o),R(o,i,s),z(i);let c=!a.getQueryCache().get(o.queryHash),[l]=O.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),f=!r&&e.subscribed!==!1;if(O.useSyncExternalStore(O.useCallback(e=>{let t=f?l.subscribe(p.batchCalls(e)):_;return l.updateResult(),t},[l,f]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),O.useEffect(()=>{l.setOptions(o)},[o,l]),U(o,u))throw W(o,l,i);if(B({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,u),o.experimental_prefetchInRender&&!d.isServer()&&H(u,r)&&(c?W(o,l,i):s?.promise)?.catch(_).finally(()=>{l.updateResult()}),o.notifyOnChangeProps?u:l.trackResult(u)}function K(e,t){return G(e,x,t)}var q=y(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]);function J({role:e=`status`,"aria-live":t=`polite`,"aria-atomic":n=!0,className:r,eyebrow:i,stamp:a,title:o,children:s,detailLabel:c=`Technical detail`,detail:l,primaryLabel:u,onPrimary:d,primaryIcon:f,primaryDisabled:p,primaryBusy:m,secondaryLabel:h,onSecondary:g}){return(0,k.jsx)(`div`,{role:e,"aria-live":t,"aria-atomic":n,className:b(`relative overflow-hidden rounded-[var(--miravo-radius-stadium-lg)] border border-primary/20 bg-transparent`,r),children:(0,k.jsx)(`div`,{className:`p-5 sm:p-6`,children:(0,k.jsxs)(`div`,{className:`min-w-0 space-y-4`,children:[(0,k.jsxs)(`div`,{className:`space-y-3`,children:[(0,k.jsx)(`p`,{className:`font-mono text-[0.65rem] uppercase tracking-[0.38em] text-muted-foreground`,children:i}),(0,k.jsxs)(`div`,{className:`flex items-end gap-3`,children:[(0,k.jsx)(`span`,{className:`font-heading text-3xl font-black leading-none tracking-[-0.06em] text-transparent [-webkit-text-stroke:1px_color-mix(in_srgb,var(--primary)_50%,transparent)] sm:text-4xl`,"aria-hidden":!0,children:a}),(0,k.jsx)(`div`,{className:`mb-1.5 h-px min-w-8 flex-1 bg-linear-to-r from-primary/55 to-transparent`})]}),(0,k.jsx)(`h2`,{className:`text-lg font-semibold tracking-[-0.03em] text-foreground sm:text-xl`,children:o}),s?(0,k.jsx)(`div`,{className:`space-y-2 text-sm leading-relaxed text-muted-foreground`,children:s}):null]}),(0,k.jsxs)(`div`,{className:`rounded-[var(--miravo-radius-stadium-sm)] border border-border/80 bg-background/55 p-4 backdrop-blur-sm`,children:[(0,k.jsx)(`div`,{className:`mb-2 font-mono text-[0.65rem] uppercase tracking-[0.28em] text-muted-foreground`,children:c}),(0,k.jsx)(`p`,{className:`wrap-break-word font-mono text-sm leading-relaxed text-primary`,children:l})]}),(0,k.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:flex-wrap`,children:[(0,k.jsxs)(v,{type:`button`,onClick:d,disabled:!!(p||m),"aria-busy":m,className:b(`inline-flex w-full items-center justify-center gap-2 rounded-[var(--miravo-radius-stadium-sm)] border border-foreground/15 bg-foreground px-4 py-2.5 font-medium text-background shadow-none transition hover:bg-foreground/90 sm:w-auto`,m&&`pointer-events-none opacity-90`),children:[f,u]}),h&&g?(0,k.jsx)(v,{type:`button`,variant:`ghost`,size:`sm`,className:`sm:self-center`,onClick:g,children:h}):null]})]})})})}function Y({message:e,onRetry:t,isRetrying:n}){return(0,k.jsxs)(J,{role:`alert`,eyebrow:`Data link fault`,stamp:`ERR`,title:`Couldn't reach Miravo`,detail:e,primaryLabel:`Retry request`,onPrimary:t,primaryBusy:!!n,primaryIcon:(0,k.jsx)(q,{className:b(`size-4 shrink-0`,n&&`animate-spin`),"aria-hidden":!0}),children:[(0,k.jsxs)(`p`,{children:[(0,k.jsx)(`span`,{className:`text-foreground`,children:`Most often:`}),` the Miravo admin server isn't running, or this browser can't reach it (wrong host, port, or firewall).`]}),(0,k.jsx)(`p`,{children:`Start or restart Miravo if needed, use the correct link to the Miravo Console, then try again.`})]})}export{G as a,x as c,K as i,J as n,M as o,q as r,j as s,Y as t};
@@ -1 +1 @@
1
- import{C as e,D as t,E as n,S as r,T as i,_ as a,at as o,b as s,et as c,g as l,h as u,v as d,w as f,x as p,y as m}from"./vendor-ui-CWUk2ulb.js";import{E as h}from"./format-B9CcV2dj.js";import{n as g,t as _}from"./utils-XFKvwlFT.js";var v=g(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),y=o(),b=t;function x({className:e,...t}){return(0,y.jsx)(l,{"data-slot":`select-group`,className:_(`scroll-my-1 p-1`,e),...t})}function S({className:e,...t}){return(0,y.jsx)(i,{"data-slot":`select-value`,className:_(`flex flex-1 text-left`,e),...t})}function C({className:e,size:t=`default`,children:r,...i}){return(0,y.jsxs)(n,{"data-slot":`select-trigger`,"data-size":t,className:_(`flex w-fit min-w-0 items-center justify-between gap-1.5 rounded-[var(--miravo-radius-stadium-sm)] border border-input bg-input/30 px-2.5 text-xs whitespace-nowrap transition-colors outline-none select-none hover:bg-input/50 focus-visible:border-primary/35 focus-visible:ring-2 focus-visible:ring-primary/22 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[var(--miravo-radius-stadium-sm)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...i,children:[r,(0,y.jsx)(f,{render:(0,y.jsx)(v,{className:`pointer-events-none size-4 text-muted-foreground`})})]})}function w({className:t,children:n,side:i=`bottom`,sideOffset:a=6,align:o=`center`,alignOffset:c=0,alignItemWithTrigger:l=!1,...u}){return(0,y.jsx)(e,{children:(0,y.jsx)(r,{side:i,sideOffset:a,align:o,alignOffset:c,alignItemWithTrigger:l,className:`isolate z-50`,children:(0,y.jsx)(p,{"data-slot":`select-content`,"data-align-trigger":l,className:_(`relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-[var(--miravo-radius-tight)] bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:data-open:duration-0 motion-reduce:data-closed:duration-0`,t),...u,children:(0,y.jsx)(s,{children:n})})})})}function T({className:e,...t}){return(0,y.jsx)(u,{"data-slot":`select-label`,className:_(`px-2 py-1.5 text-xs text-muted-foreground`,e),...t})}var E=`relative flex w-full cursor-pointer items-center gap-1.5 rounded-[var(--miravo-radius-tight)] py-1 pr-8 pl-1.5 text-xs text-muted-foreground outline-hidden select-none data-[highlighted]:bg-sidebar-accent data-[highlighted]:text-sidebar-accent-foreground not-data-[variant=destructive]:data-[highlighted]:**:text-sidebar-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`;function D({className:e,children:t,...n}){return(0,y.jsxs)(m,{"data-slot":`select-item`,className:_(E,e),...n,children:[(0,y.jsx)(a,{"data-slot":`select-item-text`,className:`flex min-w-0 flex-1 gap-2 whitespace-nowrap`,children:t}),(0,y.jsx)(d,{render:(0,y.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`}),children:(0,y.jsx)(h,{className:`pointer-events-none`})})]})}function O({className:e,...t}){return(0,y.jsx)(c,{"data-slot":`select-separator`,className:_(`pointer-events-none -mx-1 my-1 h-px bg-border`,e),...t})}export{T as a,S as c,D as i,v as l,w as n,O as o,x as r,C as s,b as t};
1
+ import{C as e,D as t,E as n,S as r,T as i,_ as a,at as o,b as s,et as c,g as l,h as u,v as d,w as f,x as p,y as m}from"./vendor-ui-CWUk2ulb.js";import{E as h}from"./format-6q8Tnwmn.js";import{n as g,t as _}from"./utils-XFKvwlFT.js";var v=g(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),y=o(),b=t;function x({className:e,...t}){return(0,y.jsx)(l,{"data-slot":`select-group`,className:_(`scroll-my-1 p-1`,e),...t})}function S({className:e,...t}){return(0,y.jsx)(i,{"data-slot":`select-value`,className:_(`flex flex-1 text-left`,e),...t})}function C({className:e,size:t=`default`,children:r,...i}){return(0,y.jsxs)(n,{"data-slot":`select-trigger`,"data-size":t,className:_(`flex w-fit min-w-0 items-center justify-between gap-1.5 rounded-[var(--miravo-radius-stadium-sm)] border border-input bg-input/30 px-2.5 text-xs whitespace-nowrap transition-colors outline-none select-none hover:bg-input/50 focus-visible:border-primary/35 focus-visible:ring-2 focus-visible:ring-primary/22 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[var(--miravo-radius-stadium-sm)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...i,children:[r,(0,y.jsx)(f,{render:(0,y.jsx)(v,{className:`pointer-events-none size-4 text-muted-foreground`})})]})}function w({className:t,children:n,side:i=`bottom`,sideOffset:a=6,align:o=`center`,alignOffset:c=0,alignItemWithTrigger:l=!1,...u}){return(0,y.jsx)(e,{children:(0,y.jsx)(r,{side:i,sideOffset:a,align:o,alignOffset:c,alignItemWithTrigger:l,className:`isolate z-50`,children:(0,y.jsx)(p,{"data-slot":`select-content`,"data-align-trigger":l,className:_(`relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-[var(--miravo-radius-tight)] bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:data-open:animate-none motion-reduce:data-closed:animate-none motion-reduce:data-open:duration-0 motion-reduce:data-closed:duration-0`,t),...u,children:(0,y.jsx)(s,{children:n})})})})}function T({className:e,...t}){return(0,y.jsx)(u,{"data-slot":`select-label`,className:_(`px-2 py-1.5 text-xs text-muted-foreground`,e),...t})}var E=`relative flex w-full cursor-pointer items-center gap-1.5 rounded-[var(--miravo-radius-tight)] py-1 pr-8 pl-1.5 text-xs text-muted-foreground outline-hidden select-none data-[highlighted]:bg-sidebar-accent data-[highlighted]:text-sidebar-accent-foreground not-data-[variant=destructive]:data-[highlighted]:**:text-sidebar-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`;function D({className:e,children:t,...n}){return(0,y.jsxs)(m,{"data-slot":`select-item`,className:_(E,e),...n,children:[(0,y.jsx)(a,{"data-slot":`select-item-text`,className:`flex min-w-0 flex-1 gap-2 whitespace-nowrap`,children:t}),(0,y.jsx)(d,{render:(0,y.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`}),children:(0,y.jsx)(h,{className:`pointer-events-none`})})]})}function O({className:e,...t}){return(0,y.jsx)(c,{"data-slot":`select-separator`,className:_(`pointer-events-none -mx-1 my-1 h-px bg-border`,e),...t})}export{T as a,S as c,D as i,v as l,w as n,O as o,x as r,C as s,b as t};
@@ -1 +1 @@
1
- import{at as e}from"./vendor-ui-CWUk2ulb.js";import{t}from"./utils-XFKvwlFT.js";var n=e();function r({className:e,...r}){return(0,n.jsx)(`div`,{className:`relative w-full overflow-x-auto`,children:(0,n.jsx)(`table`,{"data-slot":`table`,className:t(`min-w-full caption-bottom text-sm`,e),...r})})}function i({className:e,...r}){return(0,n.jsx)(`thead`,{"data-slot":`table-header`,className:t(`[&_tr]:border-b`,e),...r})}function a({className:e,...r}){return(0,n.jsx)(`tbody`,{"data-slot":`table-body`,className:t(`[&_tr:last-child]:border-0`,e),...r})}function o({className:e,...r}){return(0,n.jsx)(`tr`,{"data-slot":`table-row`,className:t(`border-b transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground data-[state=selected]:bg-sidebar-accent data-[state=selected]:text-sidebar-accent-foreground`,e),...r})}function s({className:e,...r}){return(0,n.jsx)(`th`,{"data-slot":`table-head`,className:t(`h-10 px-1.5 text-left align-middle font-medium whitespace-nowrap text-foreground sm:px-2 [&:has([role=checkbox])]:pr-0`,e),...r})}function c({className:e,...r}){return(0,n.jsx)(`td`,{"data-slot":`table-cell`,className:t(`p-1.5 align-middle whitespace-nowrap sm:p-2 [&:has([role=checkbox])]:pr-0`,e),...r})}var l=[{value:`all`,label:`All events`},{value:`fault:triggered`,label:`Fault Triggered`},{value:`fault:cleared`,label:`Fault Cleared`},{value:`lifecycle:changed`,label:`Lifecycle Changed`},{value:`instance:created`,label:`Instance Created`},{value:`instance:removed`,label:`Instance Removed`},{value:`engine:state-changed`,label:`Engine State`},{value:`platform:resource`,label:`Platform Resource`},{value:`platform:operation`,label:`Platform Operation`}],u=[{value:`all`,label:`All status`},{value:`healthy`,label:`Healthy`},{value:`faulted`,label:`Faulted`},{value:`quarantined`,label:`Quarantined`}];export{c as a,o as c,a as i,u as n,s as o,r,i as s,l as t};
1
+ import{at as e}from"./vendor-ui-CWUk2ulb.js";import{t}from"./utils-XFKvwlFT.js";var n=e();function r({className:e,...r}){return(0,n.jsx)(`div`,{className:`relative w-full overflow-x-auto`,children:(0,n.jsx)(`table`,{"data-slot":`table`,className:t(`min-w-full caption-bottom text-sm`,e),...r})})}function i({className:e,...r}){return(0,n.jsx)(`thead`,{"data-slot":`table-header`,className:t(`[&_tr]:border-b`,e),...r})}function a({className:e,...r}){return(0,n.jsx)(`tbody`,{"data-slot":`table-body`,className:t(`[&_tr:last-child]:border-0`,e),...r})}function o({className:e,...r}){return(0,n.jsx)(`tr`,{"data-slot":`table-row`,className:t(`border-b transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground data-[state=selected]:bg-sidebar-accent data-[state=selected]:text-sidebar-accent-foreground`,e),...r})}function s({className:e,...r}){return(0,n.jsx)(`th`,{"data-slot":`table-head`,className:t(`h-10 px-1.5 text-left align-middle font-medium whitespace-nowrap text-foreground sm:px-2 [&:has([role=checkbox])]:pr-0`,e),...r})}function c({className:e,...r}){return(0,n.jsx)(`td`,{"data-slot":`table-cell`,className:t(`p-1.5 align-middle whitespace-nowrap sm:p-2 [&:has([role=checkbox])]:pr-0`,e),...r})}var l=[{value:`all`,label:`All events`},{value:`fault:triggered`,label:`Fault Triggered`},{value:`fault:cleared`,label:`Fault Cleared`},{value:`lifecycle:changed`,label:`Lifecycle Changed`},{value:`asset:maintenance`,label:`Maintenance`},{value:`asset:created`,label:`Asset Created`},{value:`asset:removed`,label:`Asset Removed`},{value:`engine:state-changed`,label:`Engine State`},{value:`integration:resource`,label:`Integration Resource`},{value:`integration:operation`,label:`Integration Operation`}],u=[{value:`all`,label:`All status`},{value:`healthy`,label:`Healthy`},{value:`faulted`,label:`Faulted`},{value:`quarantined`,label:`Quarantined`}];export{c as a,o as c,a as i,u as n,s as o,r,i as s,l as t};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{at as n}from"./vendor-ui-CWUk2ulb.js";import{t as r}from"./utils-XFKvwlFT.js";import{t as i}from"./checkbox-C84IyqEB.js";import{t as a}from"./label-DTHSKF2S.js";var o=e(t(),1),s=n(),c=[{value:`mqtt`,label:`MQTT`},{value:`opcua`,label:`OPC UA`},{value:`modbus`,label:`Modbus`}];function l({value:e,onChange:t,className:n}){let l=(0,o.useId)(),u=new Set(e);return(0,s.jsxs)(`fieldset`,{className:r(`min-w-0`,n),children:[(0,s.jsx)(`legend`,{className:`mb-2 text-xs font-medium text-foreground`,children:`Protocol exposure`}),(0,s.jsx)(`div`,{className:`grid min-w-0 gap-2 sm:grid-cols-3`,children:c.map(n=>(0,s.jsxs)(a,{htmlFor:`${l}-${n.value}`,className:`min-w-0 rounded-[var(--miravo-radius-tight)] border border-border/80 px-2.5 py-2 text-xs`,children:[(0,s.jsx)(i,{id:`${l}-${n.value}`,checked:u.has(n.value),onCheckedChange:r=>{let i=e.filter(e=>e!==n.value);r===!0&&i.push(n.value),t(i)}}),(0,s.jsx)(`span`,{children:n.label})]},n.value))}),(0,s.jsx)(`p`,{className:`mt-2 text-[11px] text-muted-foreground`,children:e.length>0?`${e.length} selected`:`Default: enabled adapters`})]})}export{l as t};
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{t as r}from"./utils-XFKvwlFT.js";import{t as i}from"./checkbox-BL44aFel.js";import{t as a}from"./label-DTHSKF2S.js";var o=e(t(),1),s=n(),c=[{value:`mqtt`,label:`MQTT`},{value:`opcua`,label:`OPC UA`},{value:`modbus`,label:`Modbus`}];function l({value:e,onChange:t,className:n}){let l=(0,o.useId)(),u=new Set(e);return(0,s.jsxs)(`fieldset`,{className:r(`min-w-0`,n),children:[(0,s.jsx)(`legend`,{className:`mb-2 text-xs font-medium text-foreground`,children:`Protocol exposure`}),(0,s.jsx)(`div`,{className:`grid min-w-0 gap-2 sm:grid-cols-3`,children:c.map(n=>(0,s.jsxs)(a,{htmlFor:`${l}-${n.value}`,className:`min-w-0 rounded-[var(--miravo-radius-tight)] border border-border/80 px-2.5 py-2 text-xs`,children:[(0,s.jsx)(i,{id:`${l}-${n.value}`,checked:u.has(n.value),onCheckedChange:r=>{let i=e.filter(e=>e!==n.value);r===!0&&i.push(n.value),t(i)}}),(0,s.jsx)(`span`,{children:n.label})]},n.value))}),(0,s.jsx)(`p`,{className:`mt-2 text-[11px] text-muted-foreground`,children:e.length>0?`${e.length} selected`:`Default: enabled adapters`})]})}export{l as t};
@@ -0,0 +1 @@
1
+ import{at as e,d as t,f as n,m as r,p as i}from"./vendor-ui-CWUk2ulb.js";import{$ as a,B as o,D as s,G as c,J as l,K as u,O as d,Q as f,U as p,X as ee,Y as m,Z as h,at as g,et as _,it as te,nt as v,q as y,rt as b,tt as x}from"./api-DdyA1QMC.js";import{D as ne}from"./format-6q8Tnwmn.js";import{n as S,t as C}from"./utils-XFKvwlFT.js";var re=S(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),ie=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`}]]),ae=S(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),oe=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`}]]),w=class extends c{column;constructor(e,t,n,r){super(`Invalid expression "${e}" at column ${t}: ${n}`,r),this.name=`ExpressionSyntaxError`,this.column=t}},T={min:{min:2,max:1/0,usage:`min(a, b, ...) takes at least 2 arguments`},max:{min:2,max:1/0,usage:`max(a, b, ...) takes at least 2 arguments`},clamp:{min:3,max:3,usage:`clamp(x, lo, hi) takes exactly 3 arguments`}},se=[`param`,`port`,`prev`],ce=/[A-Za-z_]/,E=/[A-Za-z0-9_]/,D=/[0-9]/,le=new Set([`+`,`-`,`*`,`/`,`(`,`)`,`,`]);function ue(e){return Object.hasOwn(T,e)}function O(e,t,n){let r=t;for(;r<e.length&&n.test(e.charAt(r));)r++;return r}function de(e){let t=[],n=0;for(;n<e.length;){let r=e.charAt(n),i=n+1;if(/\s/.test(r))n++;else if(D.test(r)||r===`.`&&D.test(e.charAt(n+1))){let r=O(e,n,D);e.charAt(r)===`.`&&(r=O(e,r+1,D)),t.push({type:`number`,value:Number(e.slice(n,r)),column:i}),n=r}else if(ce.test(r)){let r=O(e,n,E);t.push({type:`ident`,value:e.slice(n,r),column:i}),n=r}else if(r===`$`){let r=O(e,n+1,E),a=e.slice(n+1,r);if(!se.includes(a))throw new w(e,i,`unknown reference prefix "$${a}".`,`Use $param.NAME, $port.NAME or $prev.NAME, or a bare member name for the current tick.`);let o=r+1;if(e.charAt(r)!==`.`||!ce.test(e.charAt(o)))throw new w(e,i,`"$${a}" must be followed by ".NAME".`,`Write $${a}.NAME with a name of letters, digits and underscores, e.g. $${a}.rated_rpm.`);let s=O(e,o,E);t.push({type:`ref`,prefix:a,value:e.slice(o,s),column:i}),n=s}else if(le.has(r))t.push({type:`punct`,value:r,column:i}),n++;else throw new w(e,i,`unexpected character "${r}".`,`Use only numbers, + - * /, parentheses, min/max/clamp, and references ($param.X, $port.X, $prev.X, or a member name).`)}return t.push({type:`end`,column:e.length+1}),t}var fe=class{pos=0;source;tokens;constructor(e,t){this.source=e,this.tokens=t}parse(){let e=this.parseExpr(),t=this.peek();if(t.type!==`end`)throw this.error(t,`unexpected ${pe(t)} after a complete expression.`,`Remove the trailing input, or join the parts with an operator (+ - * /).`);return e}peek(){return this.tokens[this.pos]}next(){let e=this.peek();return e.type!==`end`&&this.pos++,e}isPunct(e){let t=this.peek();return t.type===`punct`&&t.value===e}error(e,t,n){return new w(this.source,e.column,t,n)}expect(e,t){let n=this.peek();if(n.type===`punct`&&n.value===e){this.pos++;return}throw this.error(n,`expected "${e}" but found ${pe(n)}.`,t)}parseExpr(){let e=this.parseTerm();for(;this.isPunct(`+`)||this.isPunct(`-`);)e={kind:`binary`,op:this.next().value,left:e,right:this.parseTerm()};return e}parseTerm(){let e=this.parseUnary();for(;this.isPunct(`*`)||this.isPunct(`/`);)e={kind:`binary`,op:this.next().value,left:e,right:this.parseUnary()};return e}parseUnary(){return this.isPunct(`-`)||this.isPunct(`+`)?{kind:`unary`,op:this.next().value,operand:this.parseUnary()}:this.parsePrimary()}parsePrimary(){let e=this.next();switch(e.type){case`number`:return{kind:`number`,value:e.value};case`ref`:return this.referenceNode(e.prefix,e.value);case`ident`:return this.isPunct(`(`)?this.parseCall(e):{kind:`member`,name:e.value};case`punct`:if(e.value===`(`){let e=this.parseExpr();return this.expect(`)`,`Add the missing closing parenthesis.`),e}throw this.error(e,`unexpected "${e.value}" where a value was expected.`,`Put a number, a reference, a function call or a parenthesized expression here.`);case`end`:throw this.error(e,`expression ended where a value was expected.`,`Complete the expression, e.g. remove the trailing operator.`);default:return e}}referenceNode(e,t){switch(e){case`param`:return{kind:`param`,name:t};case`port`:return{kind:`port`,name:t};default:return{kind:`previous`,name:t}}}parseCall(e){let t=e.value;if(!ue(t))throw this.error(e,`unknown function "${t}".`,`Supported functions: ${Object.keys(T).join(`, `)}. A member name cannot be followed by "(".`);this.next();let n=[this.parseExpr()];for(;this.isPunct(`,`);)this.next(),n.push(this.parseExpr());this.expect(`)`,`Close the ${t}(...) call with ")" and separate arguments with ",".`);let r=T[t];if(n.length<r.min||n.length>r.max)throw this.error(e,`${t}() called with ${n.length} argument${n.length===1?``:`s`}.`,`${r.usage}.`);return{kind:`call`,fn:t,args:n}}};function pe(e){switch(e.type){case`number`:return`number ${e.value}`;case`ident`:return`name "${e.value}"`;case`ref`:return`reference "$${e.prefix}.${e.value}"`;case`punct`:return`"${e.value}"`;case`end`:return`end of expression`;default:return String(e)}}function k(e){return new fe(e,de(e)).parse()}function me(e){let t=new Set,n=new Set,r=new Set,i=new Set,a=e=>{switch(e.kind){case`number`:return;case`member`:t.add(e.name);return;case`previous`:n.add(e.name);return;case`param`:r.add(e.name);return;case`port`:i.add(e.name);return;case`unary`:a(e.operand);return;case`binary`:a(e.left),a(e.right);return;case`call`:for(let t of e.args)a(t);return;default:}};return a(e),{members:t,previousMembers:n,params:r,ports:i}}var he=`%.ACH.A.Hz.L.L/h.L/min.L/s.N.Pa.V.bar.cfm.count.count/m3.degC.h.kN.kVA.kW.kWh.m.m/s.m3.m3/h.min.mm.mm/min.mm/s.ppm.pu.rpm.s`.split(`.`),A=m(he);new Set(he);function j(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ge(e){if(typeof e==`string`)return p.exec(e)?.[1]}function _e(e){try{let t=me(k(e)),n=[...t.members,...[...t.previousMembers].map(e=>`$prev.${e}`),...[...t.ports].map(e=>`$port.${e}`)];return n.length>0?`"${e}" references ${n.join(`, `)}, but coefficient fields are evaluated once per asset and may only use numbers and $param.X. Fix: use the "expression" generator for member, $prev or $port references, or replace them with $param.X.`:void 0}catch(e){if(e instanceof w)return`${e.message} Fix: ${e.fix}`;throw e}}function ve(e,t,n){if(!j(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];j(i)&&n(i,[...t,`terms`,e])}}function ye(e,t,n){if(!j(e))return;let r=[...t,`member`],i=[...t,`previous_member`],a=[...t,`param`],o=[...t,`port`],s=[...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),typeof e.port==`string`&&n.onPort?.(e.port,o),`generator`in e&&n.onGenerator?.(e.generator,s)}function be(e,t,n,r,i){return{onMember:e,onPreviousMember:t,onParam:n,onPort:r,onGenerator:i}}function xe(e,t,n,r,i,a,o){ye(e,t,be(n,r,i,a,o))}var M=`Must be 1-64 chars and contain only letters, numbers, underscores, or hyphens.`;m([`float`,`int`,`string`,`bool`]);var Se=l(`type`,[a({type:h(`float`),default:f().finite(),min:f().finite().optional(),max:f().finite().optional(),unit:A.optional()}),a({type:h(`int`),default:f().int().safe(),min:f().int().safe().optional(),max:f().int().safe().optional(),unit:A.optional()}),a({type:h(`string`),default:x(),unit:A.optional()}),a({type:h(`bool`),default:y(),unit:A.optional()})]),Ce=a({default:f().finite(),unit:A.optional(),description:x().optional()}).strict(),N=b([a({member:x()}).strict(),a({previous_member:x()}).strict(),a({param:x()}).strict(),a({port:x()}).strict(),a({generator:ee(()=>qe)}).strict()]),P=x().superRefine((e,t)=>{let n=_e(e);n!==void 0&&t.addIssue({code:g.custom,message:n})}),F=b([f(),P]),we=b([f().finite(),P]),Te={initial_value:F.default(0),gain:F.default(1),bias:F.default(0),min:f().nullable().default(null),max:f().nullable().default(null),input:N},Ee=a({type:h(`sine`),center:F,amplitude:f().positive(),period:f().positive()}).strict(),De=a({type:h(`random-walk`),min:f(),max:f(),step:f().positive()}).strict(),Oe=a({type:h(`noise`),center:F,stddev:f().positive()}).strict(),ke=a({type:h(`step`),values:u(f()).min(1),interval:f().positive()}).strict(),Ae=a({type:h(`correlated`),source:x().regex(o,M),factor:we,offset:we,power:f().int().positive().optional()}).strict(),je=a({from:x(),to:x(),rate_per_hour:f().finite().nonnegative().optional(),on:x().optional()}).strict(),I=a({type:h(`state-machine`),states:u(x()).min(1),initial:x(),transitions:u(je).min(1)}).strict();function L(e,t){let n=new Set(e.states);n.has(e.initial)||t.addIssue({code:g.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:g.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:g.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(`, `)}.`}))}}I.superRefine(L);var Me=a({type:h(`ramp`),start_value:f().default(0),rate:f(),duration:f().nonnegative(),start_time:f().default(0),min:f().nullable().default(null),max:f().nullable().default(null)}).strict(),R=a({type:h(`mean-reverting-noise`),mean:F,tau:f().positive(),sigma:f().positive(),initial_value:f().optional(),min:f().nullable().default(null),max:f().nullable().default(null)}).strict(),Ne=a({time:f().nonnegative(),value:f()}),z=a({type:h(`timetable`),points:u(Ne).min(2),repeat:y().default(!1),interpolation:m([`linear`,`step`]).default(`linear`)}).strict(),B=a({type:h(`waveform`),shape:m([`sawtooth`,`triangle`,`square`,`pulse`]),center:F,amplitude:f().positive(),period:f().positive(),duty_cycle:f().min(0).max(1).default(.5)}).strict(),Pe=a({type:h(`chirp`),center:F,amplitude:f().positive(),start_freq_hz:f().positive(),end_freq_hz:f().positive(),sweep_duration:f().positive(),sweep:m([`linear`,`exponential`]).default(`linear`),repeat:y().default(!0)}).strict(),V=a({type:h(`impulse`),baseline:f().default(0),amplitude:f(),rate_per_hour:f().finite().nonnegative().optional(),interval:f().positive().optional(),decay:f().min(0).max(1).optional(),duration_s:f().finite().positive().default(1)}).strict();function H(e,t){e.rate_per_hour===void 0&&e.interval===void 0&&t.addIssue({code:g.custom,path:[`rate_per_hour`],message:`Impulse generator requires either rate_per_hour or interval. Fix: Add rate_per_hour: 36 or interval: 60 (simulated seconds between triggers).`}),e.rate_per_hour!==void 0&&e.interval!==void 0&&t.addIssue({code:g.custom,path:[`interval`],message:`Impulse generator cannot have both rate_per_hour and interval. Fix: Remove one: use rate_per_hour for random triggers, or interval for periodic triggers.`})}V.superRefine(H);var Fe=a({type:h(`first-order-lag`),tau:f().positive(),...Te}).strict(),Ie=a({type:h(`integrator`),initial_value:F.default(0),gain:F.default(1),bias_rate:f().default(0),min:f().default(-1/0),max:f().default(1/0),wrap:y().default(!1),wrap_at:f().nullable().default(null),input:N}).strict(),Le=a({type:h(`transport-delay`),delay:b([f().nonnegative(),P]),initial_value:f().optional(),interpolation:m([`linear`,`zoh`]).default(`linear`),input:N}).strict(),Re=a({type:h(`slew-rate-limiter`),rate_up:f().positive(),rate_down:f().positive().optional(),initial_value:F.default(0),min:f().nullable().default(null),max:f().nullable().default(null),input:N}).strict(),ze=a({type:h(`second-order`),natural_freq_hz:f().positive(),damping_ratio:f().positive(),initial_velocity:f().default(0),...Te,min:F.nullable().default(null),max:F.nullable().default(null)}).strict(),Be=a({type:h(`hysteresis-relay`),on_threshold:F,off_threshold:F,output_on:b([f(),x()]).default(1),output_off:b([f(),x()]).default(0),initial_state:m([`on`,`off`]).default(`off`),mode:m([`rising`,`falling`]).default(`rising`),input:N}).strict(),Ve=a({weight:F.default(1),input:N}),He=a({type:h(`weighted-sum`),bias:F.default(0),terms:u(Ve).min(1),min:F.nullable().default(null),max:F.nullable().default(null)}).strict(),Ue=a({type:h(`expression`),expression:x().min(1),min:F.nullable().default(null),max:F.nullable().default(null)}).strict();function We(e,t){try{k(e.expression)}catch(e){if(!(e instanceof w))throw e;t.addIssue({code:g.custom,path:[`expression`],message:`${e.message} Fix: ${e.fix}`})}}var Ge=a({type:h(`gate`),enabled_member:x().regex(o,M),input:N,disabled_value:b([f(),x(),y()])}).strict(),Ke=l(`type`,[Ee,De,Oe,ke,Ae,I,Me,R,z,B,Pe,V]).superRefine((e,t)=>{e.type===`state-machine`&&L(e,t),e.type===`impulse`&&H(e,t)}),qe=l(`type`,[Ee,De,Oe,ke,Ae,I,Me,R,z,B,Pe,V,a({type:h(`health-dependent`),stages:_(x(),Ke)}).strict(),Fe,Ie,Le,Re,ze,Be,He,Ue,Ge]).superRefine((e,t)=>{e.type===`state-machine`&&L(e,t),e.type===`impulse`&&H(e,t),e.type===`expression`&&We(e,t)}),Je=a({multiplier:f().finite().optional(),offset:f().finite().optional()}).strict(),Ye=a({scrap_rate_add:f().finite().nonnegative().optional(),name:x().min(1),duration_hours:v([f().nonnegative(),f().nonnegative()]).refine(([e,t])=>e<=t,{message:`duration_hours max must be greater than or equal to min.`}),effects:_(x(),Je)}),Xe=a({interval_hours:f().finite().positive(),restores_to:x().optional()}).strict(),Ze=a({running_member:x().optional(),stages:u(Ye).min(1),maintenance:Xe.optional()}).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:g.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))}let r=e.maintenance?.restores_to;r!==void 0&&!n.has(r)&&t.addIssue({code:g.custom,path:[`maintenance`,`restores_to`],message:`Lifecycle maintenance restores_to "${r}" is not a lifecycle stage. Fix: use one of [${[...n].join(`, `)}].`})}),Qe=a({multiplier:f().finite().optional(),offset:f().finite().optional(),spike:f().finite().optional(),quality:m([`uncertain`,`bad`]).optional(),duration_s:f().finite().positive().optional(),onset_s:f().finite().positive().optional(),recovery_s:f().finite().positive().optional()}).strict(),$e=a({condition:x().optional(),lifecycle_stage:x().optional(),rate_per_hour:f().finite().nonnegative()}).strict(),et=a({duration_s:f().finite().positive(),effects:_(x(),a({multiplier:f().finite().optional(),offset:f().finite().optional()}).strict()).refine(e=>Object.keys(e).length>0,{message:`Precursor effects must target at least one member.`})}).strict(),tt=a({production_effect:b([h(`stop`),a({derate:f().finite().positive().max(1)}).strict(),a({scrap:f().finite().min(0).max(1)}).strict()]).optional(),name:x().regex(o,M),trigger:$e,effects:_(x(),b([Qe,x()])),precursor:et.optional()}).strict();a({path:x().min(1),name:x().min(1),description:x().optional(),memberCount:f().int().nonnegative(),methodCount:f().int().nonnegative(),faultCount:f().int().nonnegative(),hasLifecycle:y(),lifecycleStageCount:f().int().nonnegative()}),a({path:x().min(1),id:x().min(1),name:x().min(1),description:x().optional(),areaCount:f().int().nonnegative(),assetAssignmentCount:f().int().nonnegative(),uniqueModelCount:f().int().nonnegative(),modelNames:u(x().min(1)),totalAssetCount:f().int().nonnegative()});var nt=a({severity:m([`error`,`warning`]),message:x(),fix:x(),file:x().optional(),line:f().int().positive().optional()});a({valid:y(),templatePath:x(),issues:u(nt)});var rt=x().min(1).max(128).regex(/^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/),U=m([`Boolean`,`Int32`,`UInt16`,`UInt32`,`Double`,`Float`,`String`]);m([`variable`,`property`]);var it=m([`read`,`readwrite`,`write`]),at=m([`>`,`>=`,`<`,`<=`,`==`,`!=`]),ot=`Must be 1-64 chars and contain only letters, numbers, underscores, or hyphens.`,st=l(`type`,[a({type:h(`threshold`),member:x().regex(o,ot),operator:at,threshold:f().finite()}).strict(),a({type:h(`lifecycle-stage`)}).strict(),a({type:h(`health-state`)}).strict(),a({type:h(`fault-active`)}).strict(),a({type:h(`fault-count`)}).strict(),a({type:h(`active-fault-code`),fallback:x().default(``)}).strict(),a({type:h(`availability-state`),member:x().regex(o,ot),operator:at.default(`>`),threshold:f().finite().default(0),running_state:x().default(`running`),stopped_state:x().default(`stopped`),faulted_state:x().default(`faulted`)}).strict()]),W=`Must be 1-64 chars and contain only letters, numbers, underscores, or hyphens.`,G=u(x().min(1)).min(1),ct=a({data_type:U,unit:A.optional(),description:x().optional(),enum_values:G.optional()}).strict(),lt=b([a({member:x().regex(o,W),value:b([f(),x(),y()])}).strict(),a({member:x().regex(o,W),argument:x().regex(o,W)}).strict()]),ut=a({type:h(`set-members`),writes:u(lt).min(1)}).strict(),dt=b([a({parameter:x().regex(o,W),value:f().finite()}).strict(),a({parameter:x().regex(o,W),argument:x().regex(o,W)}).strict()]),ft=l(`type`,[ut,a({type:h(`set-parameters`),writes:u(dt).min(1)}).strict(),a({type:h(`clear-faults`)}).strict(),a({type:h(`reset-lifecycle`),stage:x().min(1).optional(),clear_faults:y().optional()}).strict()]),pt=a({description:x().optional(),input_arguments:_(x().regex(o,W),ct).optional(),output_arguments:_(x().regex(o,W),ct).optional(),runtime:ft.optional()}).strict(),mt=_(x().regex(o,W),pt);function K(e){return e===`Double`||e===`Float`||e===`Int32`||e===`UInt16`||e===`UInt32`}function ht(e){return e===`Int32`||e===`UInt16`||e===`UInt32`}function q(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 gt(e,t,n){e.unit!==void 0&&(e.data_type===`Boolean`||e.data_type===`String`)&&t.addIssue({code:g.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:g.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 J(e,t,n,r,i){if(j(e)&&typeof e.type==`string`)switch(e.type){case`correlated`:typeof e.source==`string`&&n.push({member:e.source,path:[...t,`source`],previousTick:!1}),X(e.factor,[...t,`factor`],r),X(e.offset,[...t,`offset`],r);return;case`sine`:case`noise`:case`waveform`:case`chirp`:X(e.center,[...t,`center`],r);return;case`mean-reverting-noise`:X(e.mean,[...t,`mean`],r);return;case`second-order`:X(e.initial_value,[...t,`initial_value`],r),X(e.min,[...t,`min`],r),X(e.max,[...t,`max`],r),X(e.gain,[...t,`gain`],r),X(e.bias,[...t,`bias`],r),Y(e.input,[...t,`input`],n,r,i);return;case`first-order-lag`:X(e.initial_value,[...t,`initial_value`],r),X(e.gain,[...t,`gain`],r),X(e.bias,[...t,`bias`],r),Y(e.input,[...t,`input`],n,r,i);return;case`transport-delay`:X(e.delay,[...t,`delay`],r),Y(e.input,[...t,`input`],n,r,i);return;case`integrator`:X(e.initial_value,[...t,`initial_value`],r),X(e.gain,[...t,`gain`],r),Y(e.input,[...t,`input`],n,r,i);return;case`slew-rate-limiter`:X(e.initial_value,[...t,`initial_value`],r),Y(e.input,[...t,`input`],n,r,i);return;case`hysteresis-relay`:X(e.on_threshold,[...t,`on_threshold`],r),X(e.off_threshold,[...t,`off_threshold`],r),Y(e.input,[...t,`input`],n,r,i);return;case`weighted-sum`:X(e.bias,[...t,`bias`],r),X(e.min,[...t,`min`],r),X(e.max,[...t,`max`],r),ve(e,t,(e,t)=>{X(e.weight,[...t,`weight`],r),Y(e.input,[...t,`input`],n,r,i)});return;case`expression`:{X(e.min,[...t,`min`],r),X(e.max,[...t,`max`],r);let a=typeof e.expression==`string`?_t(e.expression):void 0;if(!a)return;let o=[...t,`expression`];for(let e of a.members)n.push({member:e,path:o,previousTick:!1});for(let e of a.previousMembers)n.push({member:e,path:o,previousTick:!0});for(let e of a.params)r.push({param:e,path:o});for(let e of a.ports)i.push({port:e,path:o});return}case`gate`:n.push({member:String(e.enabled_member),path:[...t,`enabled_member`],previousTick:!1}),Y(e.input,[...t,`input`],n,r,i);return;case`health-dependent`:{let a=e.stages;if(!j(a))return;for(let[e,o]of Object.entries(a))J(o,[...t,`stages`,e],n,r,i);return}default:return}}function Y(e,t,n,r,i){xe(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)=>i.push({port:e,path:t}),(e,t)=>J(e,t,n,r,i))}function X(e,t,n){if(typeof e!=`string`)return;let r=_t(e);if(r)for(let e of r.params)n.push({param:e,path:t})}function _t(e){try{return me(k(e))}catch(e){if(e instanceof w)return;throw e}}function vt(e,t,n){if(!j(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 Z(e,t,n){if(!j(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:g.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(j(r))for(let[e,i]of Object.entries(r))Z(i,[...t,`stages`,e],n)}function i(e,t){!j(e)||!(`generator`in e)||Z(e.generator,[...t,`generator`],n)}i(e.input,[...t,`input`]),ve(e,t,(e,t)=>{i(e.input,[...t,`input`])})}function yt(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 bt=u(l(`type`,[a({type:h(`white_noise`),strength:f().min(0).max(1),scale:f().positive().optional()}).strict(),a({type:h(`drift`),tau:f().positive(),sigma:f().min(0).max(1),scale:f().positive().optional()}).strict(),a({type:h(`outlier`),probability:f().min(0).max(1),magnitude:f().positive(),scale:f().positive().optional()}).strict(),a({type:h(`gap`),probability:f().min(0).max(1),duration:f().int().positive().default(10)}).strict(),a({type:h(`noise_burst`),probability:f().min(0).max(1),duration:f().int().positive().default(5),strength:f().min(0).max(1),scale:f().positive().optional()}).strict(),a({type:h(`quantize`),resolution:f().positive().optional(),bits:f().int().min(8).max(24).optional()}).strict(),a({type:h(`deadband`),absolute:f().positive().optional(),percent:f().positive().max(100).optional()}).strict(),a({type:h(`stuck`),probability:f().min(0).max(1),duration_s:b([f().positive(),v([f().positive(),f().positive()])]),quality:m([`good`,`uncertain`]).default(`good`)}).strict()])).min(1).optional(),xt={white_noise:0,drift:0,outlier:0,noise_burst:0,quantize:1,deadband:2,stuck:2};function St(e,t,n){let r=[],i=0,a=``;return e.forEach((e,o)=>{let s=e=>{r.push({index:o,message:e})};e.type===`quantize`?(e.resolution===void 0==(e.bits===void 0)&&s(`Member "${n}" quantize needs exactly one of resolution or bits. Fix: use "quantize: { resolution: 0.1 }" or "quantize: { bits: 12 }".`),e.bits!==void 0&&!t&&s(`Member "${n}" quantize uses bits but has no eu_range. Fix: add eu_range: [min, max] to the member, or use resolution: <number>.`)):e.type===`deadband`?(e.absolute===void 0==(e.percent===void 0)&&s(`Member "${n}" deadband needs exactly one of absolute or percent. Fix: use "deadband: { absolute: 0.5 }" or "deadband: { percent: 1 }".`),e.percent!==void 0&&!t&&s(`Member "${n}" deadband uses percent but has no eu_range. Fix: add eu_range: [min, max] to the member, or use absolute: <number>.`)):e.type===`stuck`&&Array.isArray(e.duration_s)&&e.duration_s[0]>e.duration_s[1]&&s(`Member "${n}" stuck duration_s [${e.duration_s[0]}, ${e.duration_s[1]}] has min > max. Fix: swap the values.`);let c=xt[e.type];c!==void 0&&(c<i?s(`Member "${n}" declares "${e.type}" after "${a}". Fix: order effects as white_noise/drift/outlier/noise_burst, then quantize, then deadband/stuck.`):c>i&&(i=c,a=e.type))}),r}var Q=`Must be 1-64 chars and contain only letters, numbers, underscores, or hyphens.`,Ct=new Set([`enterprise`,`site`,`area`,`line`,`prefix`]),wt=x().regex(p,`Must be a $param.X parameter reference`),Tt=b([f(),x(),y()]),Et=a({name:x().regex(o,Q),description:x().optional(),namespace:x().optional()}).strict(),Dt=l(`kind`,[a({kind:h(`variable`),data_type:U,access:it,unit:A.optional(),enum_values:G.optional(),eu_range:v([f(),f()]).refine(([e,t])=>e<=t,{message:`eu_range[0] (min) must be <= eu_range[1] (max).`}).optional(),generator:qe.optional(),binding:st.optional(),default:Tt.optional(),observation_effects:bt}).strict(),a({kind:h(`property`),data_type:U,access:it,unit:A.optional(),enum_values:G.optional(),default:b([Tt,wt]).optional()}).strict()]);function Ot(e){return _(x().regex(o,Q),Dt).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=>Ct.has(e)),{message:`Member names cannot use reserved env keys: enterprise/site/area/line/prefix`})}function kt(e={}){let t=Ot(e.maxMembersPerModel??1e3);return a({schema_version:h(`2`),model:Et,parameters:_(x(),Se).optional(),inputs:_(x().regex(o,Q),Ce).optional(),members:t,methods:mt.optional(),lifecycle:Ze.optional(),faults:u(tt).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=e.lifecycle?.running_member;i!==void 0&&e.members[i]?.data_type!==`Boolean`&&t.addIssue({code:g.custom,path:[`lifecycle`,`running_member`],message:`Lifecycle running_member "${i}" must name a Boolean member of this model. Fix: define that Boolean member or change running_member.`});let a=new Set(Object.keys(e.parameters??{})),o=new Set(Object.entries(e.parameters??{}).filter(([,e])=>e.type===`float`||e.type===`int`).map(([e])=>e)),s=new Set(Object.keys(e.inputs??{}));for(let e of s){let n;if(r.has(e))n=`member`;else if(a.has(e))n=`parameter`;else continue;t.addIssue({code:g.custom,path:[`inputs`,e],message:`Input port "${e}" has the same name as a ${n}. Fix: Rename the port (for example "${e}_in") so port, member and parameter names stay distinct.`})}for(let i=0;i<n.length;i++){let c=n[i];if(c===void 0)continue;let l=e.members[c];if(!l||(gt(l,t,[`members`,c]),l.kind===`variable`&&l.generator!==void 0&&l.binding!==void 0&&t.addIssue({code:g.custom,path:[`members`,c,`binding`],message:`Variable members cannot define both "generator" and "binding". Fix: keep one source of value generation.`}),l.kind===`variable`&&l.binding!==void 0&&l.access!==`read`&&t.addIssue({code:g.custom,path:[`members`,c,`access`],message:`Variable members with a "binding" must use access "read". Fix: change access to "read" or remove the binding.`}),l.kind!==`variable`||!l.generator&&!l.binding))continue;let u=[],d=[],f=[],p=[`members`,c,`generator`];if(l.generator&&J(l.generator,p,u,d,f),l.binding&&vt(l.binding,[`members`,c,`binding`],u),l.generator&&(Z(l.generator,p,t),l.generator.type===`gate`)){let n=e.members[l.generator.enabled_member];n&&n.data_type!==`Boolean`&&t.addIssue({code:g.custom,path:[`members`,c,`generator`,`enabled_member`],message:`Gate generator for "${c}" references "${l.generator.enabled_member}", but "${l.generator.enabled_member}" is not Boolean. Fix: use a Boolean command/state member for enabled_member.`}),q(l.generator.disabled_value,l.data_type)||t.addIssue({code:g.custom,path:[`members`,c,`generator`,`disabled_value`],message:`Gate generator disabled_value for "${c}" does not match data_type "${l.data_type}". Fix: use a compatible disabled_value literal.`})}for(let e of u){let n=r.get(e.member);if(n===void 0){t.addIssue({code:g.custom,path:[...e.path],message:`Member "${c}" 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>=i&&t.addIssue({code:g.custom,path:[...e.path],message:`Member "${c}" references member "${e.member}" which is defined later (or is itself). Members are evaluated in declaration order. Fix: Move "${e.member}" above "${c}".`})}for(let e of f)s.has(e.port)||t.addIssue({code:g.custom,path:[...e.path],message:`Member "${c}" reads input port "${e.port}", but "${e.port}" is not declared. Fix: Declare it under inputs (for example inputs: { ${e.port}: { default: 0 } }), or use { member: ... } / { param: ... }.`});for(let n of d)a.has(n.param)?o.has(n.param)||t.addIssue({code:g.custom,path:[...n.path],message:`Member "${c}" 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:g.custom,path:[...n.path],message:`Member "${c}" 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(l.binding)switch(l.binding.type){case`threshold`:l.data_type!==`Boolean`&&t.addIssue({code:g.custom,path:[`members`,c,`data_type`],message:`Members using binding.type "threshold" must use data_type "Boolean". Fix: change data_type to "Boolean".`}),At(c,l.binding.member,e,t,[`members`,c,`binding`,`member`]);break;case`availability-state`:l.data_type!==`String`&&t.addIssue({code:g.custom,path:[`members`,c,`data_type`],message:`Members using binding.type "availability-state" must use data_type "String". Fix: change data_type to "String".`}),At(c,l.binding.member,e,t,[`members`,c,`binding`,`member`]);break;case`lifecycle-stage`:case`health-state`:case`active-fault-code`:l.data_type!==`String`&&t.addIssue({code:g.custom,path:[`members`,c,`data_type`],message:`Members using binding.type "${l.binding.type}" must use data_type "String". Fix: change data_type to "String".`});break;case`fault-active`:l.data_type!==`Boolean`&&t.addIssue({code:g.custom,path:[`members`,c,`data_type`],message:`Members using binding.type "fault-active" must use data_type "Boolean". Fix: change data_type to "Boolean".`});break;case`fault-count`:l.data_type!==`Int32`&&l.data_type!==`UInt16`&&l.data_type!==`UInt32`&&t.addIssue({code:g.custom,path:[`members`,c,`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:l.binding}if(l.kind===`variable`&&l.observation_effects){K(l.data_type)||t.addIssue({code:g.custom,path:[`members`,c,`observation_effects`],message:`Observation effects on "${c}" require a numeric data_type (Double, Float, Int32, UInt16, or UInt32). Member has data_type "${l.data_type}", which cannot be degraded by noise, gaps, or drift. Fix: remove observation_effects, or change data_type to a numeric type.`}),l.access!==`read`&&t.addIssue({code:g.custom,path:[`members`,c,`observation_effects`],message:`Observation effects on "${c}" 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<l.observation_effects.length;e++){let n=l.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)&&!l.eu_range&&t.addIssue({code:g.custom,path:[`members`,c,`observation_effects`,e],message:`Member "${c}" 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.`})}for(let e of St(l.observation_effects,l.eu_range,c))t.addIssue({code:g.custom,path:[`members`,c,`observation_effects`,e.index],message:e.message})}}function c(n,i,a){if(!r.has(n)){t.addIssue({code:g.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:g.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))c(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:g.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))c(e,a,`Fault "${i.name}"`);for(let e of Object.keys(i.precursor?.effects??{}))c(e,[`faults`,r,`precursor`,`effects`],`Fault "${i.name}" precursor`)}}for(let r of n){let n=e.members[r];if(!n||n.kind!==`property`||typeof n.default!=`string`)continue;let i=ge(n.default);i!==void 0&&!a.has(i)&&t.addIssue({code:g.custom,path:[`members`,r,`default`],message:`Property "${r}" default references parameter "${i}", but "${i}" is not defined. Fix: Define "${i}" under parameters, or use a literal value.`})}if(e.methods)for(let[n,r]of Object.entries(e.methods))jt(n,r.input_arguments,t,[`methods`,n,`input_arguments`]),jt(n,r.output_arguments,t,[`methods`,n,`output_arguments`]),Mt(n,r,e,t,[`methods`,n,`runtime`])})}function At(e,t,n,r,i){let a=n.members[t];a&&(K(a.data_type)||r.addIssue({code:g.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 jt(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:g.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:g.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 Mt(e,t,n,r,i){let a=t.runtime;if(a)switch(a.type){case`clear-faults`:return;case`reset-lifecycle`:{if(!n.lifecycle){r.addIssue({code:g.custom,path:[...i],message:`Method "${e}" uses runtime "reset-lifecycle" but the model has no lifecycle. Fix: add a lifecycle block or remove the method.`});return}let t=n.lifecycle.stages.map(e=>e.name);a.stage!==void 0&&!t.includes(a.stage)&&r.addIssue({code:g.custom,path:[...i,`stage`],message:`Method "${e}" stage "${a.stage}" is not a lifecycle stage. Fix: use one of [${t.join(`, `)}].`});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:g.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:g.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:g.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}K(n.data_type)||r.addIssue({code:g.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`&&!ht(n.data_type)&&r.addIssue({code:g.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:g.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:g.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:g.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:g.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:g.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:g.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(q(yt(n.data_type),l.data_type)||r.addIssue({code:g.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:g.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}q(s.value,l.data_type)||r.addIssue({code:g.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:g.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:}}kt();var Nt=b([f().finite(),x(),y()]),Pt=x().regex(/^[a-f0-9]{64}$/),Ft=a({id:x().min(1),model:x().min(1),browsePath:u(x().min(1)).min(1),parameters:_(x(),Nt),lifecycleStage:x().min(1),operatingHours:f().finite().nonnegative(),activeFaults:u(x().min(1)),templateRunId:f().int().positive().optional(),protocolScope:u(d).min(1).optional(),inputBindings:_(x(),s).optional(),observationState:_(x(),_(x(),te())).optional().default({}),lifecycleState:a({stageStartHours:f().finite().nonnegative().optional(),lastMaintenanceHours:f().finite().nonnegative().optional()}).optional(),faultState:_(x(),a({remaining:f().finite(),pendingSample:y(),elapsed:f().finite(),recovering:y(),recoveryElapsed:f().finite(),recoverySeconds:f().finite(),precursor:y().optional(),precursorElapsed:f().finite().optional()})).optional().default({})}),It=a({templateRunId:f().int().positive(),templateName:x().min(1),templatePath:x(),entryHash:Pt.optional()}),Lt=a({name:x().min(1),enabled:y(),config:_(x(),te())});a({version:h(2),savedAt:x().min(1),factoryName:rt,models:u(x().min(1)),assets:u(Ft),templateRuns:u(It),adapters:u(Lt).default([])});var $=e();function Rt({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 zt=ne(`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 Bt({className:e,variant:n=`default`,...r}){return(0,$.jsx)(t,{"data-slot":`tabs-list`,"data-variant":n,className:C(zt({variant:n}),e),...r})}function Vt({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 Ht({className:e,...t}){return(0,$.jsx)(n,{"data-slot":`tabs-content`,className:C(`flex-1 text-sm outline-none py-2`,e),...t})}export{oe as a,re as c,Vt as i,Ht as n,ae as o,Bt as r,ie as s,Rt as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./tags-DnyhyxDB.js";export{e as TagsPage};