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