@miravo/cli-linux-x64 0.9.0 → 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.
- package/console-dist/assets/AnimatePresence-BZCmb1bq.js +9 -0
- package/console-dist/assets/{activity-Cy_niK56.js → activity-Cn48I9qe.js} +1 -1
- package/console-dist/assets/api-DybIIqOe.js +1 -0
- package/console-dist/assets/api-kPM52mb-.js +1 -0
- package/console-dist/assets/asset-detail-tmOrYE8x.js +1 -0
- package/console-dist/assets/{auth-screen-backdrop-CgwRhIbi.js → auth-screen-backdrop-hcEYy3K4.js} +1 -1
- package/console-dist/assets/badge-D4jktT8T.js +1 -0
- package/console-dist/assets/catalog-DN-klsod.js +1 -0
- package/console-dist/assets/catalog-M-k7Y9Sp.js +1 -0
- package/console-dist/assets/catalog-source-2aT9qob-.js +1 -0
- package/console-dist/assets/catalog-template-icons-C7KJdJJX.js +1 -0
- package/console-dist/assets/checkbox-AaJhjtZk.js +1 -0
- package/console-dist/assets/chevron-down-CAk5w9Wt.js +1 -0
- package/console-dist/assets/chevron-right-BfZjrUWh.js +1 -0
- package/console-dist/assets/circle-x-CGcRflg7.js +1 -0
- package/console-dist/assets/combobox-BFEY6lgO.js +1 -0
- package/console-dist/assets/control-CD9UoTvu.js +1 -0
- package/console-dist/assets/control-DHa2-a2v.js +1 -0
- package/console-dist/assets/copy-button-DHm7RGJ5.js +1 -0
- package/console-dist/assets/dialog-Di9Bs0FH.js +1 -0
- package/console-dist/assets/{download-DmUZKo9N.js → download-B9e1wNK4.js} +1 -1
- package/console-dist/assets/events-D19CzgoQ.js +1 -0
- package/console-dist/assets/events-DmftG8n5.js +1 -0
- package/console-dist/assets/export-tab-ouFgYEU_.js +1 -0
- package/console-dist/assets/factory-CT2VYi0n.js +1 -0
- package/console-dist/assets/factory-DSrBtcG2.js +1 -0
- package/console-dist/assets/{format-6q8Tnwmn.js → format-OUFL_tef.js} +1 -1
- package/console-dist/assets/{get-error-message-BowDodwy.js → get-error-message-eGdenTLv.js} +1 -1
- package/console-dist/assets/index-DuJJSpJp.js +12 -0
- package/console-dist/assets/index-iEV9hU2I.css +2 -0
- package/console-dist/assets/integration-api-Bg7D1eQc.js +2 -0
- package/console-dist/assets/integration-targets-BehiqWyT.js +1 -0
- package/console-dist/assets/integrations-DWW9HjH0.js +1 -0
- package/console-dist/assets/integrations-DoXNrzD5.js +1 -0
- package/console-dist/assets/{label-DTHSKF2S.js → label-DWyy9MeT.js} +1 -1
- package/console-dist/assets/local-flag-CPAqDO-L.js +1 -0
- package/console-dist/assets/{login-O9dnrHI9.js → login-BZKYK0yZ.js} +1 -1
- package/console-dist/assets/models-CrDBHBV5.js +1 -0
- package/console-dist/assets/models-jBVcY8Xd.js +1 -0
- package/console-dist/assets/{not-found-Dw4OTZHH.js → not-found-BqVny4Md.js} +1 -1
- package/console-dist/assets/play-TTg_EXSa.js +1 -0
- package/console-dist/assets/plus-BbVbvFTe.js +1 -0
- package/console-dist/assets/protocol-card-B2SpAJKe.js +1 -0
- package/console-dist/assets/{query-fetch-error-ytmF7SP9.js → query-fetch-error-C2Ec4RQS.js} +1 -1
- package/console-dist/assets/radio-DRkzblxj.js +1 -0
- package/console-dist/assets/rocket-807Pf7C1.js +1 -0
- package/console-dist/assets/select-Bg6PPro0.js +1 -0
- package/console-dist/assets/{select-display-items-BEVMAho-.js → select-display-items-D-L3PesO.js} +1 -1
- package/console-dist/assets/server-CS2Tw__K.js +1 -0
- package/console-dist/assets/source-host-miravo-D_AecPVc.js +1 -0
- package/console-dist/assets/tabs-bI9sskHy.js +1 -0
- package/console-dist/assets/tags-B7e7VYVW.js +1 -0
- package/console-dist/assets/tags-DJJKQRZZ.js +4 -0
- package/console-dist/assets/{transition-nav-link-Crj9XTbK.js → transition-nav-link-cn4KZD6W.js} +1 -1
- package/console-dist/assets/trash-2-BJ-1df0F.js +1 -0
- package/console-dist/assets/{triangle-alert-BXrJNk3g.js → triangle-alert-D1AraFcP.js} +1 -1
- package/console-dist/assets/use-engine-command-mutation-DMkQxmt9.js +1 -0
- package/console-dist/assets/use-transition-navigate-BiV2QCcA.js +2 -0
- package/console-dist/assets/validation-q38DYDwu.js +1 -0
- package/console-dist/assets/vendor-ui-D8j69UH4.js +1 -0
- package/console-dist/index.html +55 -50
- package/miravo +2 -2
- package/package.json +1 -1
- package/console-dist/assets/AnimatePresence-CPmH1DMY.js +0 -9
- package/console-dist/assets/api-0DOQsu1W.js +0 -1
- package/console-dist/assets/api-DdyA1QMC.js +0 -1
- package/console-dist/assets/arrow-right-BjBb4z7g.js +0 -1
- package/console-dist/assets/arrow-up-down-C1oJAmrw.js +0 -1
- package/console-dist/assets/asset-detail-D-coMgED.js +0 -1
- package/console-dist/assets/badge-DuuEINVl.js +0 -1
- package/console-dist/assets/catalog-Ca9rhNLN.js +0 -1
- package/console-dist/assets/catalog-CdbAE0Ki.js +0 -1
- package/console-dist/assets/catalog-source-CPFWtBJF.js +0 -1
- package/console-dist/assets/catalog-template-icons-aec8m5-A.js +0 -1
- package/console-dist/assets/checkbox-BL44aFel.js +0 -1
- package/console-dist/assets/circle-question-mark-CJvcT6V6.js +0 -1
- package/console-dist/assets/combobox-B5iFVe7N.js +0 -1
- package/console-dist/assets/control-CtvncuAA.js +0 -1
- package/console-dist/assets/control-DYdEZmP0.js +0 -1
- package/console-dist/assets/copy-button-RVCJ3aqM.js +0 -1
- package/console-dist/assets/dropdown-menu-82O7jPU6.js +0 -1
- package/console-dist/assets/events-Bp3BqWYo.js +0 -1
- package/console-dist/assets/events-D5uZ2cwr.js +0 -1
- package/console-dist/assets/fleet-CBXZ0Xts.js +0 -1
- package/console-dist/assets/fleet-CRB8-QDg.js +0 -1
- package/console-dist/assets/index-BPmjm3uU.css +0 -2
- package/console-dist/assets/index-Chh5Cd8X.js +0 -12
- package/console-dist/assets/integration-targets-ChYQ8POe.js +0 -1
- package/console-dist/assets/integrations-BrZWbG5Q.js +0 -1
- package/console-dist/assets/integrations-D4x6ee5M.js +0 -1
- package/console-dist/assets/layers-1figUpjG.js +0 -1
- package/console-dist/assets/models-BDeOqKQk.js +0 -1
- package/console-dist/assets/models-CgWCVmnx.js +0 -1
- package/console-dist/assets/proxy-Be4WzmcS.js +0 -1
- package/console-dist/assets/select-Cg2u0NQI.js +0 -1
- package/console-dist/assets/shallow-Cin0mLuv.js +0 -1
- package/console-dist/assets/spawn-protocol-scope-picker-DDi-hZwj.js +0 -1
- package/console-dist/assets/tabs-BJs5Kci7.js +0 -1
- package/console-dist/assets/tags-CcmWc8Xj.js +0 -1
- package/console-dist/assets/tags-DnyhyxDB.js +0 -4
- package/console-dist/assets/tooltip-D1ydB4g3.js +0 -1
- package/console-dist/assets/use-engine-command-mutation-OZ8_Roso.js +0 -1
- package/console-dist/assets/use-integration-stream-CFkuEB9r.js +0 -2
- package/console-dist/assets/use-transition-navigate-BBXUEW59.js +0 -2
- package/console-dist/assets/validation-BvXCKp12.js +0 -1
- package/console-dist/assets/vendor-ui-CWUk2ulb.js +0 -1
- /package/console-dist/assets/{chunk-OE4NN4TA-DBWZidbW.js → chunk-OE4NN4TA-Q4iNR9l9.js} +0 -0
- /package/console-dist/assets/{dist-xY0pK9Wy.js → dist-CtuJWBnP.js} +0 -0
- /package/console-dist/assets/{runtime-link-D-uJbw97.js → runtime-link-ChF8TM68.js} +0 -0
- /package/console-dist/assets/{transition-types-CPlGtM8w.js → transition-types-049V0Kr0.js} +0 -0
- /package/console-dist/assets/{utils-XFKvwlFT.js → utils-BO2u-wC_.js} +0 -0
- /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,B as o,D as s,G as c,J as l,K as u,O as d,Q as f,U as p,X as ee,Y as m,Z as h,at as g,et as _,it as te,nt as v,q as y,rt as b,tt as x}from"./api-DdyA1QMC.js";import{D as ne}from"./format-6q8Tnwmn.js";import{n as S,t as C}from"./utils-XFKvwlFT.js";var re=S(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),ie=S(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),ae=S(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),oe=S(`radio`,[[`path`,{d:`M16.247 7.761a6 6 0 0 1 0 8.478`,key:`1fwjs5`}],[`path`,{d:`M19.075 4.933a10 10 0 0 1 0 14.134`,key:`ehdyv1`}],[`path`,{d:`M4.925 19.067a10 10 0 0 1 0-14.134`,key:`1q22gi`}],[`path`,{d:`M7.753 16.239a6 6 0 0 1 0-8.478`,key:`r2q7qm`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}]]),w=class extends c{column;constructor(e,t,n,r){super(`Invalid expression "${e}" at column ${t}: ${n}`,r),this.name=`ExpressionSyntaxError`,this.column=t}},T={min:{min:2,max:1/0,usage:`min(a, b, ...) takes at least 2 arguments`},max:{min:2,max:1/0,usage:`max(a, b, ...) takes at least 2 arguments`},clamp:{min:3,max:3,usage:`clamp(x, lo, hi) takes exactly 3 arguments`}},se=[`param`,`port`,`prev`],ce=/[A-Za-z_]/,E=/[A-Za-z0-9_]/,D=/[0-9]/,le=new Set([`+`,`-`,`*`,`/`,`(`,`)`,`,`]);function ue(e){return Object.hasOwn(T,e)}function O(e,t,n){let r=t;for(;r<e.length&&n.test(e.charAt(r));)r++;return r}function de(e){let t=[],n=0;for(;n<e.length;){let r=e.charAt(n),i=n+1;if(/\s/.test(r))n++;else if(D.test(r)||r===`.`&&D.test(e.charAt(n+1))){let r=O(e,n,D);e.charAt(r)===`.`&&(r=O(e,r+1,D)),t.push({type:`number`,value:Number(e.slice(n,r)),column:i}),n=r}else if(ce.test(r)){let r=O(e,n,E);t.push({type:`ident`,value:e.slice(n,r),column:i}),n=r}else if(r===`$`){let r=O(e,n+1,E),a=e.slice(n+1,r);if(!se.includes(a))throw new w(e,i,`unknown reference prefix "$${a}".`,`Use $param.NAME, $port.NAME or $prev.NAME, or a bare member name for the current tick.`);let o=r+1;if(e.charAt(r)!==`.`||!ce.test(e.charAt(o)))throw new w(e,i,`"$${a}" must be followed by ".NAME".`,`Write $${a}.NAME with a name of letters, digits and underscores, e.g. $${a}.rated_rpm.`);let s=O(e,o,E);t.push({type:`ref`,prefix:a,value:e.slice(o,s),column:i}),n=s}else if(le.has(r))t.push({type:`punct`,value:r,column:i}),n++;else throw new w(e,i,`unexpected character "${r}".`,`Use only numbers, + - * /, parentheses, min/max/clamp, and references ($param.X, $port.X, $prev.X, or a member name).`)}return t.push({type:`end`,column:e.length+1}),t}var fe=class{pos=0;source;tokens;constructor(e,t){this.source=e,this.tokens=t}parse(){let e=this.parseExpr(),t=this.peek();if(t.type!==`end`)throw this.error(t,`unexpected ${pe(t)} after a complete expression.`,`Remove the trailing input, or join the parts with an operator (+ - * /).`);return e}peek(){return this.tokens[this.pos]}next(){let e=this.peek();return e.type!==`end`&&this.pos++,e}isPunct(e){let t=this.peek();return t.type===`punct`&&t.value===e}error(e,t,n){return new w(this.source,e.column,t,n)}expect(e,t){let n=this.peek();if(n.type===`punct`&&n.value===e){this.pos++;return}throw this.error(n,`expected "${e}" but found ${pe(n)}.`,t)}parseExpr(){let e=this.parseTerm();for(;this.isPunct(`+`)||this.isPunct(`-`);)e={kind:`binary`,op:this.next().value,left:e,right:this.parseTerm()};return e}parseTerm(){let e=this.parseUnary();for(;this.isPunct(`*`)||this.isPunct(`/`);)e={kind:`binary`,op:this.next().value,left:e,right:this.parseUnary()};return e}parseUnary(){return this.isPunct(`-`)||this.isPunct(`+`)?{kind:`unary`,op:this.next().value,operand:this.parseUnary()}:this.parsePrimary()}parsePrimary(){let e=this.next();switch(e.type){case`number`:return{kind:`number`,value:e.value};case`ref`:return this.referenceNode(e.prefix,e.value);case`ident`:return this.isPunct(`(`)?this.parseCall(e):{kind:`member`,name:e.value};case`punct`:if(e.value===`(`){let e=this.parseExpr();return this.expect(`)`,`Add the missing closing parenthesis.`),e}throw this.error(e,`unexpected "${e.value}" where a value was expected.`,`Put a number, a reference, a function call or a parenthesized expression here.`);case`end`:throw this.error(e,`expression ended where a value was expected.`,`Complete the expression, e.g. remove the trailing operator.`);default:return e}}referenceNode(e,t){switch(e){case`param`:return{kind:`param`,name:t};case`port`:return{kind:`port`,name:t};default:return{kind:`previous`,name:t}}}parseCall(e){let t=e.value;if(!ue(t))throw this.error(e,`unknown function "${t}".`,`Supported functions: ${Object.keys(T).join(`, `)}. A member name cannot be followed by "(".`);this.next();let n=[this.parseExpr()];for(;this.isPunct(`,`);)this.next(),n.push(this.parseExpr());this.expect(`)`,`Close the ${t}(...) call with ")" and separate arguments with ",".`);let r=T[t];if(n.length<r.min||n.length>r.max)throw this.error(e,`${t}() called with ${n.length} argument${n.length===1?``:`s`}.`,`${r.usage}.`);return{kind:`call`,fn:t,args:n}}};function pe(e){switch(e.type){case`number`:return`number ${e.value}`;case`ident`:return`name "${e.value}"`;case`ref`:return`reference "$${e.prefix}.${e.value}"`;case`punct`:return`"${e.value}"`;case`end`:return`end of expression`;default:return String(e)}}function k(e){return new fe(e,de(e)).parse()}function me(e){let t=new Set,n=new Set,r=new Set,i=new Set,a=e=>{switch(e.kind){case`number`:return;case`member`:t.add(e.name);return;case`previous`:n.add(e.name);return;case`param`:r.add(e.name);return;case`port`:i.add(e.name);return;case`unary`:a(e.operand);return;case`binary`:a(e.left),a(e.right);return;case`call`:for(let t of e.args)a(t);return;default:}};return a(e),{members:t,previousMembers:n,params:r,ports:i}}var he=`%.ACH.A.Hz.L.L/h.L/min.L/s.N.Pa.V.bar.cfm.count.count/m3.degC.h.kN.kVA.kW.kWh.m.m/s.m3.m3/h.min.mm.mm/min.mm/s.ppm.pu.rpm.s`.split(`.`),A=m(he);new Set(he);function j(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ge(e){if(typeof e==`string`)return p.exec(e)?.[1]}function _e(e){try{let t=me(k(e)),n=[...t.members,...[...t.previousMembers].map(e=>`$prev.${e}`),...[...t.ports].map(e=>`$port.${e}`)];return n.length>0?`"${e}" references ${n.join(`, `)}, but coefficient fields are evaluated once per asset and may only use numbers and $param.X. Fix: use the "expression" generator for member, $prev or $port references, or replace them with $param.X.`:void 0}catch(e){if(e instanceof w)return`${e.message} Fix: ${e.fix}`;throw e}}function ve(e,t,n){if(!j(e)||e.type!==`weighted-sum`)return;let r=e.terms;if(Array.isArray(r))for(let e=0;e<r.length;e++){let i=r[e];j(i)&&n(i,[...t,`terms`,e])}}function ye(e,t,n){if(!j(e))return;let r=[...t,`member`],i=[...t,`previous_member`],a=[...t,`param`],o=[...t,`port`],s=[...t,`generator`];typeof e.member==`string`&&n.onMember?.(e.member,r),typeof e.previous_member==`string`&&n.onPreviousMember?.(e.previous_member,i),typeof e.param==`string`&&n.onParam?.(e.param,a),typeof e.port==`string`&&n.onPort?.(e.port,o),`generator`in e&&n.onGenerator?.(e.generator,s)}function be(e,t,n,r,i){return{onMember:e,onPreviousMember:t,onParam:n,onPort:r,onGenerator:i}}function xe(e,t,n,r,i,a,o){ye(e,t,be(n,r,i,a,o))}var M=`Must be 1-64 chars and contain only letters, numbers, underscores, or hyphens.`;m([`float`,`int`,`string`,`bool`]);var Se=l(`type`,[a({type:h(`float`),default:f().finite(),min:f().finite().optional(),max:f().finite().optional(),unit:A.optional()}),a({type:h(`int`),default:f().int().safe(),min:f().int().safe().optional(),max:f().int().safe().optional(),unit:A.optional()}),a({type:h(`string`),default:x(),unit:A.optional()}),a({type:h(`bool`),default:y(),unit:A.optional()})]),Ce=a({default:f().finite(),unit:A.optional(),description:x().optional()}).strict(),N=b([a({member:x()}).strict(),a({previous_member:x()}).strict(),a({param:x()}).strict(),a({port:x()}).strict(),a({generator:ee(()=>qe)}).strict()]),P=x().superRefine((e,t)=>{let n=_e(e);n!==void 0&&t.addIssue({code:g.custom,message:n})}),F=b([f(),P]),we=b([f().finite(),P]),Te={initial_value:F.default(0),gain:F.default(1),bias:F.default(0),min:f().nullable().default(null),max:f().nullable().default(null),input:N},Ee=a({type:h(`sine`),center:F,amplitude:f().positive(),period:f().positive()}).strict(),De=a({type:h(`random-walk`),min:f(),max:f(),step:f().positive()}).strict(),Oe=a({type:h(`noise`),center:F,stddev:f().positive()}).strict(),ke=a({type:h(`step`),values:u(f()).min(1),interval:f().positive()}).strict(),Ae=a({type:h(`correlated`),source:x().regex(o,M),factor:we,offset:we,power:f().int().positive().optional()}).strict(),je=a({from:x(),to:x(),rate_per_hour:f().finite().nonnegative().optional(),on:x().optional()}).strict(),I=a({type:h(`state-machine`),states:u(x()).min(1),initial:x(),transitions:u(je).min(1)}).strict();function L(e,t){let n=new Set(e.states);n.has(e.initial)||t.addIssue({code:g.custom,path:[`initial`],message:`State machine initial state "${e.initial}" is not in states. Fix: Set initial to one of: ${e.states.join(`, `)}.`});for(let r=0;r<e.transitions.length;r++){let i=e.transitions[r];i&&(n.has(i.from)||t.addIssue({code:g.custom,path:[`transitions`,r,`from`],message:`State machine transition from "${i.from}" references a state that is not in states. Fix: Add "${i.from}" to states or change transition.from to one of: ${e.states.join(`, `)}.`}),n.has(i.to)||t.addIssue({code:g.custom,path:[`transitions`,r,`to`],message:`State machine transition to "${i.to}" references a state that is not in states. Fix: Add "${i.to}" to states or change transition.to to one of: ${e.states.join(`, `)}.`}))}}I.superRefine(L);var Me=a({type:h(`ramp`),start_value:f().default(0),rate:f(),duration:f().nonnegative(),start_time:f().default(0),min:f().nullable().default(null),max:f().nullable().default(null)}).strict(),R=a({type:h(`mean-reverting-noise`),mean:F,tau:f().positive(),sigma:f().positive(),initial_value:f().optional(),min:f().nullable().default(null),max:f().nullable().default(null)}).strict(),Ne=a({time:f().nonnegative(),value:f()}),z=a({type:h(`timetable`),points:u(Ne).min(2),repeat:y().default(!1),interpolation:m([`linear`,`step`]).default(`linear`)}).strict(),B=a({type:h(`waveform`),shape:m([`sawtooth`,`triangle`,`square`,`pulse`]),center:F,amplitude:f().positive(),period:f().positive(),duty_cycle:f().min(0).max(1).default(.5)}).strict(),Pe=a({type:h(`chirp`),center:F,amplitude:f().positive(),start_freq_hz:f().positive(),end_freq_hz:f().positive(),sweep_duration:f().positive(),sweep:m([`linear`,`exponential`]).default(`linear`),repeat:y().default(!0)}).strict(),V=a({type:h(`impulse`),baseline:f().default(0),amplitude:f(),rate_per_hour:f().finite().nonnegative().optional(),interval:f().positive().optional(),decay:f().min(0).max(1).optional(),duration_s:f().finite().positive().default(1)}).strict();function H(e,t){e.rate_per_hour===void 0&&e.interval===void 0&&t.addIssue({code:g.custom,path:[`rate_per_hour`],message:`Impulse generator requires either rate_per_hour or interval. Fix: Add rate_per_hour: 36 or interval: 60 (simulated seconds between triggers).`}),e.rate_per_hour!==void 0&&e.interval!==void 0&&t.addIssue({code:g.custom,path:[`interval`],message:`Impulse generator cannot have both rate_per_hour and interval. Fix: Remove one: use rate_per_hour for random triggers, or interval for periodic triggers.`})}V.superRefine(H);var Fe=a({type:h(`first-order-lag`),tau:f().positive(),...Te}).strict(),Ie=a({type:h(`integrator`),initial_value:F.default(0),gain:F.default(1),bias_rate:f().default(0),min:f().default(-1/0),max:f().default(1/0),wrap:y().default(!1),wrap_at:f().nullable().default(null),input:N}).strict(),Le=a({type:h(`transport-delay`),delay:b([f().nonnegative(),P]),initial_value:f().optional(),interpolation:m([`linear`,`zoh`]).default(`linear`),input:N}).strict(),Re=a({type:h(`slew-rate-limiter`),rate_up:f().positive(),rate_down:f().positive().optional(),initial_value:F.default(0),min:f().nullable().default(null),max:f().nullable().default(null),input:N}).strict(),ze=a({type:h(`second-order`),natural_freq_hz:f().positive(),damping_ratio:f().positive(),initial_velocity:f().default(0),...Te,min:F.nullable().default(null),max:F.nullable().default(null)}).strict(),Be=a({type:h(`hysteresis-relay`),on_threshold:F,off_threshold:F,output_on:b([f(),x()]).default(1),output_off:b([f(),x()]).default(0),initial_state:m([`on`,`off`]).default(`off`),mode:m([`rising`,`falling`]).default(`rising`),input:N}).strict(),Ve=a({weight:F.default(1),input:N}),He=a({type:h(`weighted-sum`),bias:F.default(0),terms:u(Ve).min(1),min:F.nullable().default(null),max:F.nullable().default(null)}).strict(),Ue=a({type:h(`expression`),expression:x().min(1),min:F.nullable().default(null),max:F.nullable().default(null)}).strict();function We(e,t){try{k(e.expression)}catch(e){if(!(e instanceof w))throw e;t.addIssue({code:g.custom,path:[`expression`],message:`${e.message} Fix: ${e.fix}`})}}var Ge=a({type:h(`gate`),enabled_member:x().regex(o,M),input:N,disabled_value:b([f(),x(),y()])}).strict(),Ke=l(`type`,[Ee,De,Oe,ke,Ae,I,Me,R,z,B,Pe,V]).superRefine((e,t)=>{e.type===`state-machine`&&L(e,t),e.type===`impulse`&&H(e,t)}),qe=l(`type`,[Ee,De,Oe,ke,Ae,I,Me,R,z,B,Pe,V,a({type:h(`health-dependent`),stages:_(x(),Ke)}).strict(),Fe,Ie,Le,Re,ze,Be,He,Ue,Ge]).superRefine((e,t)=>{e.type===`state-machine`&&L(e,t),e.type===`impulse`&&H(e,t),e.type===`expression`&&We(e,t)}),Je=a({multiplier:f().finite().optional(),offset:f().finite().optional()}).strict(),Ye=a({scrap_rate_add:f().finite().nonnegative().optional(),name:x().min(1),duration_hours:v([f().nonnegative(),f().nonnegative()]).refine(([e,t])=>e<=t,{message:`duration_hours max must be greater than or equal to min.`}),effects:_(x(),Je)}),Xe=a({interval_hours:f().finite().positive(),restores_to:x().optional()}).strict(),Ze=a({running_member:x().optional(),stages:u(Ye).min(1),maintenance:Xe.optional()}).superRefine((e,t)=>{let n=new Set;for(let r=0;r<e.stages.length;r++){let i=e.stages[r];i&&(n.has(i.name)&&t.addIssue({code:g.custom,path:[`stages`,r,`name`],message:`Lifecycle stage names must be unique. Duplicate "${i.name}". Fix: Rename one stage so each lifecycle stage has a unique name.`}),n.add(i.name))}let r=e.maintenance?.restores_to;r!==void 0&&!n.has(r)&&t.addIssue({code:g.custom,path:[`maintenance`,`restores_to`],message:`Lifecycle maintenance restores_to "${r}" is not a lifecycle stage. Fix: use one of [${[...n].join(`, `)}].`})}),Qe=a({multiplier:f().finite().optional(),offset:f().finite().optional(),spike:f().finite().optional(),quality:m([`uncertain`,`bad`]).optional(),duration_s:f().finite().positive().optional(),onset_s:f().finite().positive().optional(),recovery_s:f().finite().positive().optional()}).strict(),$e=a({condition:x().optional(),lifecycle_stage:x().optional(),rate_per_hour:f().finite().nonnegative()}).strict(),et=a({duration_s:f().finite().positive(),effects:_(x(),a({multiplier:f().finite().optional(),offset:f().finite().optional()}).strict()).refine(e=>Object.keys(e).length>0,{message:`Precursor effects must target at least one member.`})}).strict(),tt=a({production_effect:b([h(`stop`),a({derate:f().finite().positive().max(1)}).strict(),a({scrap:f().finite().min(0).max(1)}).strict()]).optional(),name:x().regex(o,M),trigger:$e,effects:_(x(),b([Qe,x()])),precursor:et.optional()}).strict();a({path:x().min(1),name:x().min(1),description:x().optional(),memberCount:f().int().nonnegative(),methodCount:f().int().nonnegative(),faultCount:f().int().nonnegative(),hasLifecycle:y(),lifecycleStageCount:f().int().nonnegative()}),a({path:x().min(1),id:x().min(1),name:x().min(1),description:x().optional(),areaCount:f().int().nonnegative(),assetAssignmentCount:f().int().nonnegative(),uniqueModelCount:f().int().nonnegative(),modelNames:u(x().min(1)),totalAssetCount:f().int().nonnegative()});var nt=a({severity:m([`error`,`warning`]),message:x(),fix:x(),file:x().optional(),line:f().int().positive().optional()});a({valid:y(),templatePath:x(),issues:u(nt)});var rt=x().min(1).max(128).regex(/^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/),U=m([`Boolean`,`Int32`,`UInt16`,`UInt32`,`Double`,`Float`,`String`]);m([`variable`,`property`]);var it=m([`read`,`readwrite`,`write`]),at=m([`>`,`>=`,`<`,`<=`,`==`,`!=`]),ot=`Must be 1-64 chars and contain only letters, numbers, underscores, or hyphens.`,st=l(`type`,[a({type:h(`threshold`),member:x().regex(o,ot),operator:at,threshold:f().finite()}).strict(),a({type:h(`lifecycle-stage`)}).strict(),a({type:h(`health-state`)}).strict(),a({type:h(`fault-active`)}).strict(),a({type:h(`fault-count`)}).strict(),a({type:h(`active-fault-code`),fallback:x().default(``)}).strict(),a({type:h(`availability-state`),member:x().regex(o,ot),operator:at.default(`>`),threshold:f().finite().default(0),running_state:x().default(`running`),stopped_state:x().default(`stopped`),faulted_state:x().default(`faulted`)}).strict()]),W=`Must be 1-64 chars and contain only letters, numbers, underscores, or hyphens.`,G=u(x().min(1)).min(1),ct=a({data_type:U,unit:A.optional(),description:x().optional(),enum_values:G.optional()}).strict(),lt=b([a({member:x().regex(o,W),value:b([f(),x(),y()])}).strict(),a({member:x().regex(o,W),argument:x().regex(o,W)}).strict()]),ut=a({type:h(`set-members`),writes:u(lt).min(1)}).strict(),dt=b([a({parameter:x().regex(o,W),value:f().finite()}).strict(),a({parameter:x().regex(o,W),argument:x().regex(o,W)}).strict()]),ft=l(`type`,[ut,a({type:h(`set-parameters`),writes:u(dt).min(1)}).strict(),a({type:h(`clear-faults`)}).strict(),a({type:h(`reset-lifecycle`),stage:x().min(1).optional(),clear_faults:y().optional()}).strict()]),pt=a({description:x().optional(),input_arguments:_(x().regex(o,W),ct).optional(),output_arguments:_(x().regex(o,W),ct).optional(),runtime:ft.optional()}).strict(),mt=_(x().regex(o,W),pt);function K(e){return e===`Double`||e===`Float`||e===`Int32`||e===`UInt16`||e===`UInt32`}function ht(e){return e===`Int32`||e===`UInt16`||e===`UInt32`}function q(e,t){switch(t){case`Boolean`:return typeof e==`boolean`;case`String`:return typeof e==`string`;case`Double`:case`Float`:return typeof e==`number`&&Number.isFinite(e);case`Int32`:return typeof e==`number`&&Number.isSafeInteger(e)&&e>=-2147483648&&e<=2147483647;case`UInt16`:return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0&&e<=65535;case`UInt32`:return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0&&e<=4294967295;default:return!1}}function gt(e,t,n){e.unit!==void 0&&(e.data_type===`Boolean`||e.data_type===`String`)&&t.addIssue({code:g.custom,path:[...n,`unit`],message:`Members with data_type "${e.data_type}" must not declare engineering units. Fix: remove the unit or use a numeric data_type.`}),e.enum_values&&e.data_type!==`String`&&t.addIssue({code:g.custom,path:[...n,`enum_values`],message:`enum_values is only valid for String members. Fix: remove enum_values or change data_type to "String".`})}function J(e,t,n,r,i){if(j(e)&&typeof e.type==`string`)switch(e.type){case`correlated`:typeof e.source==`string`&&n.push({member:e.source,path:[...t,`source`],previousTick:!1}),X(e.factor,[...t,`factor`],r),X(e.offset,[...t,`offset`],r);return;case`sine`:case`noise`:case`waveform`:case`chirp`:X(e.center,[...t,`center`],r);return;case`mean-reverting-noise`:X(e.mean,[...t,`mean`],r);return;case`second-order`:X(e.initial_value,[...t,`initial_value`],r),X(e.min,[...t,`min`],r),X(e.max,[...t,`max`],r),X(e.gain,[...t,`gain`],r),X(e.bias,[...t,`bias`],r),Y(e.input,[...t,`input`],n,r,i);return;case`first-order-lag`:X(e.initial_value,[...t,`initial_value`],r),X(e.gain,[...t,`gain`],r),X(e.bias,[...t,`bias`],r),Y(e.input,[...t,`input`],n,r,i);return;case`transport-delay`:X(e.delay,[...t,`delay`],r),Y(e.input,[...t,`input`],n,r,i);return;case`integrator`:X(e.initial_value,[...t,`initial_value`],r),X(e.gain,[...t,`gain`],r),Y(e.input,[...t,`input`],n,r,i);return;case`slew-rate-limiter`:X(e.initial_value,[...t,`initial_value`],r),Y(e.input,[...t,`input`],n,r,i);return;case`hysteresis-relay`:X(e.on_threshold,[...t,`on_threshold`],r),X(e.off_threshold,[...t,`off_threshold`],r),Y(e.input,[...t,`input`],n,r,i);return;case`weighted-sum`:X(e.bias,[...t,`bias`],r),X(e.min,[...t,`min`],r),X(e.max,[...t,`max`],r),ve(e,t,(e,t)=>{X(e.weight,[...t,`weight`],r),Y(e.input,[...t,`input`],n,r,i)});return;case`expression`:{X(e.min,[...t,`min`],r),X(e.max,[...t,`max`],r);let a=typeof e.expression==`string`?_t(e.expression):void 0;if(!a)return;let o=[...t,`expression`];for(let e of a.members)n.push({member:e,path:o,previousTick:!1});for(let e of a.previousMembers)n.push({member:e,path:o,previousTick:!0});for(let e of a.params)r.push({param:e,path:o});for(let e of a.ports)i.push({port:e,path:o});return}case`gate`:n.push({member:String(e.enabled_member),path:[...t,`enabled_member`],previousTick:!1}),Y(e.input,[...t,`input`],n,r,i);return;case`health-dependent`:{let a=e.stages;if(!j(a))return;for(let[e,o]of Object.entries(a))J(o,[...t,`stages`,e],n,r,i);return}default:return}}function Y(e,t,n,r,i){xe(e,t,(e,t)=>n.push({member:e,path:t,previousTick:!1}),(e,t)=>n.push({member:e,path:t,previousTick:!0}),(e,t)=>r.push({param:e,path:t}),(e,t)=>i.push({port:e,path:t}),(e,t)=>J(e,t,n,r,i))}function X(e,t,n){if(typeof e!=`string`)return;let r=_t(e);if(r)for(let e of r.params)n.push({param:e,path:t})}function _t(e){try{return me(k(e))}catch(e){if(e instanceof w)return;throw e}}function vt(e,t,n){if(!j(e))return;let r=e.type;(r===`threshold`||r===`availability-state`)&&typeof e.member==`string`&&n.push({member:e.member,path:[...t,`member`],previousTick:!1})}function Z(e,t,n){if(!j(e))return;let r=e.type;if(typeof r!=`string`)return;if(r===`integrator`&&e.wrap===!0&&(typeof e.wrap_at!=`number`||!Number.isFinite(e.wrap_at)||e.wrap_at<=0)&&n.addIssue({code:g.custom,path:[...t,`wrap_at`],message:`wrap_at must be a finite number greater than 0 when wrap is true. Fix: Set wrap_at to a positive number, or set wrap to false.`}),r===`health-dependent`){let r=e.stages;if(j(r))for(let[e,i]of Object.entries(r))Z(i,[...t,`stages`,e],n)}function i(e,t){!j(e)||!(`generator`in e)||Z(e.generator,[...t,`generator`],n)}i(e.input,[...t,`input`]),ve(e,t,(e,t)=>{i(e.input,[...t,`input`])})}function yt(e){switch(e){case`Boolean`:return!1;case`String`:return``;case`Double`:case`Float`:case`Int32`:case`UInt16`:case`UInt32`:return 0;default:return 0}}var bt=u(l(`type`,[a({type:h(`white_noise`),strength:f().min(0).max(1),scale:f().positive().optional()}).strict(),a({type:h(`drift`),tau:f().positive(),sigma:f().min(0).max(1),scale:f().positive().optional()}).strict(),a({type:h(`outlier`),probability:f().min(0).max(1),magnitude:f().positive(),scale:f().positive().optional()}).strict(),a({type:h(`gap`),probability:f().min(0).max(1),duration:f().int().positive().default(10)}).strict(),a({type:h(`noise_burst`),probability:f().min(0).max(1),duration:f().int().positive().default(5),strength:f().min(0).max(1),scale:f().positive().optional()}).strict(),a({type:h(`quantize`),resolution:f().positive().optional(),bits:f().int().min(8).max(24).optional()}).strict(),a({type:h(`deadband`),absolute:f().positive().optional(),percent:f().positive().max(100).optional()}).strict(),a({type:h(`stuck`),probability:f().min(0).max(1),duration_s:b([f().positive(),v([f().positive(),f().positive()])]),quality:m([`good`,`uncertain`]).default(`good`)}).strict()])).min(1).optional(),xt={white_noise:0,drift:0,outlier:0,noise_burst:0,quantize:1,deadband:2,stuck:2};function St(e,t,n){let r=[],i=0,a=``;return e.forEach((e,o)=>{let s=e=>{r.push({index:o,message:e})};e.type===`quantize`?(e.resolution===void 0==(e.bits===void 0)&&s(`Member "${n}" quantize needs exactly one of resolution or bits. Fix: use "quantize: { resolution: 0.1 }" or "quantize: { bits: 12 }".`),e.bits!==void 0&&!t&&s(`Member "${n}" quantize uses bits but has no eu_range. Fix: add eu_range: [min, max] to the member, or use resolution: <number>.`)):e.type===`deadband`?(e.absolute===void 0==(e.percent===void 0)&&s(`Member "${n}" deadband needs exactly one of absolute or percent. Fix: use "deadband: { absolute: 0.5 }" or "deadband: { percent: 1 }".`),e.percent!==void 0&&!t&&s(`Member "${n}" deadband uses percent but has no eu_range. Fix: add eu_range: [min, max] to the member, or use absolute: <number>.`)):e.type===`stuck`&&Array.isArray(e.duration_s)&&e.duration_s[0]>e.duration_s[1]&&s(`Member "${n}" stuck duration_s [${e.duration_s[0]}, ${e.duration_s[1]}] has min > max. Fix: swap the values.`);let c=xt[e.type];c!==void 0&&(c<i?s(`Member "${n}" declares "${e.type}" after "${a}". Fix: order effects as white_noise/drift/outlier/noise_burst, then quantize, then deadband/stuck.`):c>i&&(i=c,a=e.type))}),r}var Q=`Must be 1-64 chars and contain only letters, numbers, underscores, or hyphens.`,Ct=new Set([`enterprise`,`site`,`area`,`line`,`prefix`]),wt=x().regex(p,`Must be a $param.X parameter reference`),Tt=b([f(),x(),y()]),Et=a({name:x().regex(o,Q),description:x().optional(),namespace:x().optional()}).strict(),Dt=l(`kind`,[a({kind:h(`variable`),data_type:U,access:it,unit:A.optional(),enum_values:G.optional(),eu_range:v([f(),f()]).refine(([e,t])=>e<=t,{message:`eu_range[0] (min) must be <= eu_range[1] (max).`}).optional(),generator:qe.optional(),binding:st.optional(),default:Tt.optional(),observation_effects:bt}).strict(),a({kind:h(`property`),data_type:U,access:it,unit:A.optional(),enum_values:G.optional(),default:b([Tt,wt]).optional()}).strict()]);function Ot(e){return _(x().regex(o,Q),Dt).refine(e=>Object.keys(e).length>=1,{message:`Members map must have at least 1 member.`}).refine(t=>Object.keys(t).length<=e,{message:`Members map must have at most ${e} members.`}).refine(e=>!Object.keys(e).some(e=>Ct.has(e)),{message:`Member names cannot use reserved env keys: enterprise/site/area/line/prefix`})}function kt(e={}){let t=Ot(e.maxMembersPerModel??1e3);return a({schema_version:h(`2`),model:Et,parameters:_(x(),Se).optional(),inputs:_(x().regex(o,Q),Ce).optional(),members:t,methods:mt.optional(),lifecycle:Ze.optional(),faults:u(tt).optional()}).strict().superRefine((e,t)=>{let n=Object.keys(e.members),r=new Map;for(let e=0;e<n.length;e++){let t=n[e];t!==void 0&&r.set(t,e)}let i=e.lifecycle?.running_member;i!==void 0&&e.members[i]?.data_type!==`Boolean`&&t.addIssue({code:g.custom,path:[`lifecycle`,`running_member`],message:`Lifecycle running_member "${i}" must name a Boolean member of this model. Fix: define that Boolean member or change running_member.`});let a=new Set(Object.keys(e.parameters??{})),o=new Set(Object.entries(e.parameters??{}).filter(([,e])=>e.type===`float`||e.type===`int`).map(([e])=>e)),s=new Set(Object.keys(e.inputs??{}));for(let e of s){let n;if(r.has(e))n=`member`;else if(a.has(e))n=`parameter`;else continue;t.addIssue({code:g.custom,path:[`inputs`,e],message:`Input port "${e}" has the same name as a ${n}. Fix: Rename the port (for example "${e}_in") so port, member and parameter names stay distinct.`})}for(let i=0;i<n.length;i++){let c=n[i];if(c===void 0)continue;let l=e.members[c];if(!l||(gt(l,t,[`members`,c]),l.kind===`variable`&&l.generator!==void 0&&l.binding!==void 0&&t.addIssue({code:g.custom,path:[`members`,c,`binding`],message:`Variable members cannot define both "generator" and "binding". Fix: keep one source of value generation.`}),l.kind===`variable`&&l.binding!==void 0&&l.access!==`read`&&t.addIssue({code:g.custom,path:[`members`,c,`access`],message:`Variable members with a "binding" must use access "read". Fix: change access to "read" or remove the binding.`}),l.kind!==`variable`||!l.generator&&!l.binding))continue;let u=[],d=[],f=[],p=[`members`,c,`generator`];if(l.generator&&J(l.generator,p,u,d,f),l.binding&&vt(l.binding,[`members`,c,`binding`],u),l.generator&&(Z(l.generator,p,t),l.generator.type===`gate`)){let n=e.members[l.generator.enabled_member];n&&n.data_type!==`Boolean`&&t.addIssue({code:g.custom,path:[`members`,c,`generator`,`enabled_member`],message:`Gate generator for "${c}" references "${l.generator.enabled_member}", but "${l.generator.enabled_member}" is not Boolean. Fix: use a Boolean command/state member for enabled_member.`}),q(l.generator.disabled_value,l.data_type)||t.addIssue({code:g.custom,path:[`members`,c,`generator`,`disabled_value`],message:`Gate generator disabled_value for "${c}" does not match data_type "${l.data_type}". Fix: use a compatible disabled_value literal.`})}for(let e of u){let n=r.get(e.member);if(n===void 0){t.addIssue({code:g.custom,path:[...e.path],message:`Member "${c}" references member "${e.member}", but "${e.member}" is not defined. Fix: Define "${e.member}" in members, or change the reference to a parameter.`});continue}!e.previousTick&&n>=i&&t.addIssue({code:g.custom,path:[...e.path],message:`Member "${c}" references member "${e.member}" which is defined later (or is itself). Members are evaluated in declaration order. Fix: Move "${e.member}" above "${c}".`})}for(let e of f)s.has(e.port)||t.addIssue({code:g.custom,path:[...e.path],message:`Member "${c}" reads input port "${e.port}", but "${e.port}" is not declared. Fix: Declare it under inputs (for example inputs: { ${e.port}: { default: 0 } }), or use { member: ... } / { param: ... }.`});for(let n of d)a.has(n.param)?o.has(n.param)||t.addIssue({code:g.custom,path:[...n.path],message:`Member "${c}" references parameter "${n.param}" in a numeric position, but "${n.param}" has type "${e.parameters?.[n.param]?.type}". Only float and int parameters can be used as generator coefficients or inputs. Fix: Change "${n.param}" to type "float" or "int".`}):t.addIssue({code:g.custom,path:[...n.path],message:`Member "${c}" references parameter "${n.param}", but "${n.param}" is not defined. Fix: Define "${n.param}" under parameters, or replace "$param.${n.param}" with a literal value.`});if(l.binding)switch(l.binding.type){case`threshold`:l.data_type!==`Boolean`&&t.addIssue({code:g.custom,path:[`members`,c,`data_type`],message:`Members using binding.type "threshold" must use data_type "Boolean". Fix: change data_type to "Boolean".`}),At(c,l.binding.member,e,t,[`members`,c,`binding`,`member`]);break;case`availability-state`:l.data_type!==`String`&&t.addIssue({code:g.custom,path:[`members`,c,`data_type`],message:`Members using binding.type "availability-state" must use data_type "String". Fix: change data_type to "String".`}),At(c,l.binding.member,e,t,[`members`,c,`binding`,`member`]);break;case`lifecycle-stage`:case`health-state`:case`active-fault-code`:l.data_type!==`String`&&t.addIssue({code:g.custom,path:[`members`,c,`data_type`],message:`Members using binding.type "${l.binding.type}" must use data_type "String". Fix: change data_type to "String".`});break;case`fault-active`:l.data_type!==`Boolean`&&t.addIssue({code:g.custom,path:[`members`,c,`data_type`],message:`Members using binding.type "fault-active" must use data_type "Boolean". Fix: change data_type to "Boolean".`});break;case`fault-count`:l.data_type!==`Int32`&&l.data_type!==`UInt16`&&l.data_type!==`UInt32`&&t.addIssue({code:g.custom,path:[`members`,c,`data_type`],message:`Members using binding.type "fault-count" must use an integer data_type (Int32, UInt16, or UInt32). Fix: change data_type to an integer type.`});break;default:l.binding}if(l.kind===`variable`&&l.observation_effects){K(l.data_type)||t.addIssue({code:g.custom,path:[`members`,c,`observation_effects`],message:`Observation effects on "${c}" require a numeric data_type (Double, Float, Int32, UInt16, or UInt32). Member has data_type "${l.data_type}", which cannot be degraded by noise, gaps, or drift. Fix: remove observation_effects, or change data_type to a numeric type.`}),l.access!==`read`&&t.addIssue({code:g.custom,path:[`members`,c,`observation_effects`],message:`Observation effects on "${c}" require access "read". Observation effects corrupt values — they must not be applied to command targets or setpoints. Fix: change access to "read" or remove observation_effects.`});for(let e=0;e<l.observation_effects.length;e++){let n=l.observation_effects[e];n&&(n.type===`white_noise`||n.type===`drift`||n.type===`outlier`||n.type===`noise_burst`)&&!(`scale`in n&&n.scale!==void 0)&&!l.eu_range&&t.addIssue({code:g.custom,path:[`members`,c,`observation_effects`,e],message:`Member "${c}" uses relative observation effect "${n.type}" but has no eu_range and no explicit scale. Fix: add eu_range: [min, max] to the member, or add scale: <number> to the effect.`})}for(let e of St(l.observation_effects,l.eu_range,c))t.addIssue({code:g.custom,path:[`members`,c,`observation_effects`,e.index],message:e.message})}}function c(n,i,a){if(!r.has(n)){t.addIssue({code:g.custom,path:[...i],message:`${a} has effect on "${n}", but "${n}" is not a defined member. Fix: Change "${n}" to a valid member name.`});return}let o=e.members[n];o&&o.kind!==`variable`&&t.addIssue({code:g.custom,path:[...i],message:`${a} has effect on "${n}", but "${n}" is a property (kind: "property"). Effects can only target variable members.`})}if(e.lifecycle){let t=[`lifecycle`,`stages`];for(let n of e.lifecycle.stages)for(let e of Object.keys(n.effects))c(e,t,`Lifecycle stage "${n.name}"`)}if(e.faults){let n=new Set;for(let r=0;r<e.faults.length;r++){let i=e.faults[r];if(!i)continue;n.has(i.name)&&t.addIssue({code:g.custom,path:[`faults`,r,`name`],message:`Fault names must be unique. Duplicate "${i.name}". Fix: Rename one fault so each fault has a unique name.`}),n.add(i.name);let a=[`faults`,r,`effects`];for(let e of Object.keys(i.effects))c(e,a,`Fault "${i.name}"`);for(let e of Object.keys(i.precursor?.effects??{}))c(e,[`faults`,r,`precursor`,`effects`],`Fault "${i.name}" precursor`)}}for(let r of n){let n=e.members[r];if(!n||n.kind!==`property`||typeof n.default!=`string`)continue;let i=ge(n.default);i!==void 0&&!a.has(i)&&t.addIssue({code:g.custom,path:[`members`,r,`default`],message:`Property "${r}" default references parameter "${i}", but "${i}" is not defined. Fix: Define "${i}" under parameters, or use a literal value.`})}if(e.methods)for(let[n,r]of Object.entries(e.methods))jt(n,r.input_arguments,t,[`methods`,n,`input_arguments`]),jt(n,r.output_arguments,t,[`methods`,n,`output_arguments`]),Mt(n,r,e,t,[`methods`,n,`runtime`])})}function At(e,t,n,r,i){let a=n.members[t];a&&(K(a.data_type)||r.addIssue({code:g.custom,path:[...i],message:`Member "${e}" binding references "${t}", but "${t}" is not numeric. Fix: bind to a numeric member or change the source member data_type.`}))}function jt(e,t,n,r){if(t)for(let[i,a]of Object.entries(t))a.unit!==void 0&&(a.data_type===`Boolean`||a.data_type===`String`)&&n.addIssue({code:g.custom,path:[...r,i,`unit`],message:`Method "${e}" argument "${i}" uses data_type "${a.data_type}" and must not declare an engineering unit. Fix: remove the unit or use a numeric data_type.`}),a.enum_values&&a.data_type!==`String`&&n.addIssue({code:g.custom,path:[...r,i,`enum_values`],message:`Method "${e}" argument "${i}" can only use enum_values with data_type "String". Fix: remove enum_values or change the data_type.`})}function Mt(e,t,n,r,i){let a=t.runtime;if(a)switch(a.type){case`clear-faults`:return;case`reset-lifecycle`:{if(!n.lifecycle){r.addIssue({code:g.custom,path:[...i],message:`Method "${e}" uses runtime "reset-lifecycle" but the model has no lifecycle. Fix: add a lifecycle block or remove the method.`});return}let t=n.lifecycle.stages.map(e=>e.name);a.stage!==void 0&&!t.includes(a.stage)&&r.addIssue({code:g.custom,path:[...i,`stage`],message:`Method "${e}" stage "${a.stage}" is not a lifecycle stage. Fix: use one of [${t.join(`, `)}].`});return}case`set-parameters`:for(let o=0;o<a.writes.length;o++){let s=a.writes[o];if(!s)continue;let c=[...i,`writes`,o],l=n.parameters?.[s.parameter];if(!l){r.addIssue({code:g.custom,path:[...c,`parameter`],message:`Method "${e}" runtime targets parameter "${s.parameter}", but "${s.parameter}" is not defined. Fix: target a declared parameter.`});continue}if(l.type!==`float`&&l.type!==`int`){r.addIssue({code:g.custom,path:[...c,`parameter`],message:`Method "${e}" runtime targets parameter "${s.parameter}" of type "${l.type}". Fix: use set-parameters only with float or int parameters.`});continue}if(`argument`in s){let n=t.input_arguments?.[s.argument];if(!n){r.addIssue({code:g.custom,path:[...c,`argument`],message:`Method "${e}" runtime references input argument "${s.argument}", but that argument is not defined. Fix: declare the input argument or use a literal value.`});continue}K(n.data_type)||r.addIssue({code:g.custom,path:[...c,`argument`],message:`Method "${e}" runtime argument "${s.argument}" must be numeric to write parameter "${s.parameter}". Fix: use Double, Float, Int32, UInt16, or UInt32.`}),l.type===`int`&&!ht(n.data_type)&&r.addIssue({code:g.custom,path:[...c,`argument`],message:`Method "${e}" runtime argument "${s.argument}" uses data_type "${n.data_type}" but parameter "${s.parameter}" is type "int". Fix: use Int32, UInt16, or UInt32 so runtime writes stay integer-safe.`});continue}l.type===`int`&&!Number.isSafeInteger(s.value)&&r.addIssue({code:g.custom,path:[...c,`value`],message:`Method "${e}" runtime literal for integer parameter "${s.parameter}" must be a safe integer. Fix: use a whole-number literal.`})}return;case`set-members`:for(let o=0;o<a.writes.length;o++){let s=a.writes[o];if(!s)continue;let c=[...i,`writes`,o],l=n.members[s.member];if(!l){r.addIssue({code:g.custom,path:[...c,`member`],message:`Method "${e}" runtime targets member "${s.member}", but "${s.member}" is not defined. Fix: target a declared member.`});continue}if(l.kind!==`variable`&&r.addIssue({code:g.custom,path:[...c,`member`],message:`Method "${e}" runtime targets "${s.member}", but "${s.member}" is a property. Fix: target a writable variable member.`}),l.access!==`readwrite`&&l.access!==`write`&&r.addIssue({code:g.custom,path:[...c,`member`],message:`Method "${e}" runtime targets "${s.member}", but "${s.member}" is not writable. Fix: set access to "readwrite" or "write".`}),l.kind===`variable`&&l.binding&&r.addIssue({code:g.custom,path:[...c,`member`],message:`Method "${e}" runtime targets "${s.member}", but bound members are computed at runtime. Fix: write to a command/setpoint member without a binding.`}),`argument`in s){let n=t.input_arguments?.[s.argument];if(!n){r.addIssue({code:g.custom,path:[...c,`argument`],message:`Method "${e}" runtime references input argument "${s.argument}", but that argument is not defined. Fix: declare the input argument or use a literal value.`});continue}if(q(yt(n.data_type),l.data_type)||r.addIssue({code:g.custom,path:[...c,`argument`],message:`Method "${e}" runtime argument "${s.argument}" uses data_type "${n.data_type}" which does not match target member "${s.member}" data_type "${l.data_type}". Fix: align the argument and target member data types.`}),n.enum_values&&l.enum_values){let t=n.enum_values.filter(e=>!l.enum_values?.includes(e));t.length>0&&r.addIssue({code:g.custom,path:[...c,`argument`],message:`Method "${e}" runtime argument "${s.argument}" allows values [${t.join(`, `)}] that are not valid for target member "${s.member}". Fix: align enum_values between the argument and target member.`})}continue}q(s.value,l.data_type)||r.addIssue({code:g.custom,path:[...c,`value`],message:`Method "${e}" runtime literal for "${s.member}" does not match data_type "${l.data_type}". Fix: use a compatible literal value.`}),l.enum_values&&typeof s.value==`string`&&!l.enum_values.includes(s.value)&&r.addIssue({code:g.custom,path:[...c,`value`],message:`Method "${e}" runtime literal "${s.value}" is not allowed for member "${s.member}". Fix: use one of [${l.enum_values.join(`, `)}].`})}return;default:}}kt();var Nt=b([f().finite(),x(),y()]),Pt=x().regex(/^[a-f0-9]{64}$/),Ft=a({id:x().min(1),model:x().min(1),browsePath:u(x().min(1)).min(1),parameters:_(x(),Nt),lifecycleStage:x().min(1),operatingHours:f().finite().nonnegative(),activeFaults:u(x().min(1)),templateRunId:f().int().positive().optional(),protocolScope:u(d).min(1).optional(),inputBindings:_(x(),s).optional(),observationState:_(x(),_(x(),te())).optional().default({}),lifecycleState:a({stageStartHours:f().finite().nonnegative().optional(),lastMaintenanceHours:f().finite().nonnegative().optional()}).optional(),faultState:_(x(),a({remaining:f().finite(),pendingSample:y(),elapsed:f().finite(),recovering:y(),recoveryElapsed:f().finite(),recoverySeconds:f().finite(),precursor:y().optional(),precursorElapsed:f().finite().optional()})).optional().default({})}),It=a({templateRunId:f().int().positive(),templateName:x().min(1),templatePath:x(),entryHash:Pt.optional()}),Lt=a({name:x().min(1),enabled:y(),config:_(x(),te())});a({version:h(2),savedAt:x().min(1),factoryName:rt,models:u(x().min(1)),assets:u(Ft),templateRuns:u(It),adapters:u(Lt).default([])});var $=e();function Rt({className:e,orientation:t=`horizontal`,...n}){return(0,$.jsx)(r,{"data-slot":`tabs`,"data-orientation":t,className:C(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var zt=ne(`group/tabs-list inline-flex w-fit items-center justify-center rounded-[var(--miravo-radius-stadium-sm)] p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-0 border-b border-border/50 bg-transparent p-0 shadow-none group-data-horizontal/tabs:h-auto group-data-horizontal/tabs:min-h-8`}},defaultVariants:{variant:`default`}});function Bt({className:e,variant:n=`default`,...r}){return(0,$.jsx)(t,{"data-slot":`tabs-list`,"data-variant":n,className:C(zt({variant:n}),e),...r})}function Vt({className:e,...t}){return(0,$.jsx)(i,{"data-slot":`tabs-trigger`,className:C(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-[var(--miravo-radius-tight)] border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-muted-foreground transition-[color,box-shadow,transform] duration-200 ease-out group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:font-heading group-data-[variant=line]/tabs-list:tracking-tight group-data-[variant=line]/tabs-list:text-sm group-data-[variant=line]/tabs-list:text-muted-foreground group-data-[variant=line]/tabs-list:hover:text-foreground group-data-[variant=line]/tabs-list:data-active:font-semibold group-data-[variant=line]/tabs-list:data-active:text-foreground`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent group-data-[variant=line]/tabs-list:data-active:border-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`group-data-[variant=line]/tabs-list:rounded-none group-data-[variant=line]/tabs-list:px-3 group-data-[variant=line]/tabs-list:py-2`,`data-active:bg-background data-active:text-foreground data-active:border-input data-active:bg-input/30 data-active:text-foreground`,`after:pointer-events-none after:absolute after:bg-foreground after:opacity-0 after:transition-[opacity,transform] after:duration-300 after:ease-out group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5`,`group-data-[variant=line]/tabs-list:after:bg-primary group-data-horizontal/tabs:group-data-[variant=line]/tabs-list:after:bottom-0 group-data-horizontal/tabs:group-data-[variant=line]/tabs-list:after:h-[2px] group-data-horizontal/tabs:group-data-[variant=line]/tabs-list:after:rounded-sm group-data-[variant=line]/tabs-list:data-active:after:opacity-100 group-data-horizontal/tabs:group-data-[variant=line]/tabs-list:data-active:after:shadow-[0_0_14px_-3px_color-mix(in_srgb,var(--primary)_50%,transparent)]`,e),...t})}function Ht({className:e,...t}){return(0,$.jsx)(n,{"data-slot":`tabs-content`,className:C(`flex-1 text-sm outline-none py-2`,e),...t})}export{oe as a,re as c,Vt as i,Ht as n,ae as o,Bt as r,ie as s,Rt as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./tags-DnyhyxDB.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,ct as i,o as a,v as o,vt as s}from"./api-DdyA1QMC.js";import{i as c,t as l}from"./query-fetch-error-ytmF7SP9.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-RVCJ3aqM.js";import{C as x,S,T as C,b as ee,c as w,d as T,s as te,y as ne}from"./format-6q8Tnwmn.js";import{n as E,t as re}from"./utils-XFKvwlFT.js";import{t as D}from"./arrow-up-down-C1oJAmrw.js";import{c as O,i as k,l as ie,n as A,s as j,t as M}from"./select-Cg2u0NQI.js";import{a as ae,n as N,r as P}from"./integration-targets-ChYQ8POe.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-BowDodwy.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-B5iFVe7N.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=E(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),Ee=E(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),De=E(`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=E(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),ke=E(`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=E(`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=E(`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,asset:a.asset,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,asset:e.asset,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,selectedAsset: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}))],[]),te=(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 Integration`}),(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:`Integration`}),(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)(O,{placeholder:`Select integration`})}),(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. smart_factory_cnc_001`,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:te,children:[(0,X.jsx)(j,{className:`w-full text-sm`,children:(0,X.jsx)(O,{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,asset:t,model:n,member:r,enabledProtocols:i,hasFilters:a,memberSearchRef:o,onProtocolChange:s,onAssetChange:c,onModelChange:l,onMemberChange:u,onClearFilters:d,onAssetSearch:f,onModelSearch:p,filteredAssetOptions: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)(O,{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:w(t)}:null,onValueChange:e=>c(e?.value??``),isItemEqualToValue:(e,t)=>e?.value===t?.value,onInputValueChange:f,children:[(0,X.jsx)(H,{placeholder:`All assets`,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:w(e)},children:[(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:`${te(e)} (${e})`,children:w(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 assets found`})]})})]}),(0,X.jsxs)(ve,{value:n?{value:n,label:T(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:T(e)},children:[(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:T(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)(D,{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:`/asset/${e.asset}`,className:`inline-flex items-center gap-1 text-primary underline-offset-4 hover:underline`,"aria-label":`Open asset`}),children:[`View asset`,(0,X.jsx)(Ae,{className:`size-3`})]}),(0,X.jsx)(I,{side:`top`,children:`Open asset`})]})]})]})}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:`asset`,header:({column:e})=>(0,X.jsxs)(`button`,{type:`button`,className:`inline-flex items-center`,onClick:e.getToggleSortingHandler(),children:[`Asset`,(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(`asset`,d.withDefault(``)),[v,y]=u(`model`,d.withDefault(``)),[b,S]=u(`member`,d.withDefault(``)),[C,w]=u(`perPage`,f.withDefault(Xe)),T=Qe(C),te=i(e=>e.assetCount),E=c({queryKey:o.tags.manifest(te),queryFn:()=>a(`/manifest`,r.manifest),placeholderData:s}),D=E.data??null,N=E.isError,P=E.isPending&&!D&&!N,F=he(E.error,`Failed to fetch manifest.`),I=D?.tags??[],L=D?.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.asset,(e.get(t.asset)??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.asset!==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])=>ne(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=[`asset`,`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.asset,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&&!D?(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 E.refetch(),isRetrying:E.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&&D?(0,X.jsx)(l,{message:`${F} Showing cached tags.`,onRetry:()=>void E.refetch(),isRetrying:E.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...`:`${D?.summary?.totalAssets??0} assets · ${L.length} protocols`})]}),(0,X.jsxs)(me,{children:[(0,X.jsxs)(pe,{render:(0,X.jsx)(x,{variant:`outline`,size:`sm`,className:re(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:re(`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 Integration…`]})]})})]})]}),(0,X.jsx)(Ge,{protocol:m,asset:g,model:v,member:b,enabledProtocols:L,hasFilters:Me,memberSearchRef:n,onProtocolChange:Fe,onAssetChange:Ie,onModelChange:Le,onMemberChange:J,onClearFilters:Ne,onAssetSearch:Re,onModelSearch:Z,filteredAssetOptions: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`,{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 a factory 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)(O,{})}),(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,selectedAsset: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,ct as i,d as a,n as o,y as s}from"./api-DdyA1QMC.js";import{l as c}from"./copy-button-RVCJ3aqM.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`,`removeAsset`,`loadTemplate`,`unloadTemplateRun`,`resetFactory`,`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}=i.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?i.getState().replaceRuntime(e.runtime,{allowSameRevision:!0,allowRevisionRewind:!0}):i.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(i.getState().connectionState)}catch(e){w(e);return}t(!0),a(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(i.getState().connectionState)}catch(e){throw w(e),e}t(!0);try{let t=await a(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{g as a,p as c,x as i,v as n,y as o,_ 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,M as i,S as a,T as o,W as s,f as c,m as l,p as u,t as d,v as f,w as ee,z as p}from"./api-DdyA1QMC.js";import{s as m}from"./query-fetch-error-ytmF7SP9.js";import{t as h,u as g}from"./proxy-Be4WzmcS.js";import{t as _}from"./AnimatePresence-CPmH1DMY.js";import{a as te,i as ne,l as v,n as re,o as y,r as ie,s as ae,t as b}from"./copy-button-RVCJ3aqM.js";import{C as x,E as S,S as C,T as w}from"./format-6q8Tnwmn.js";import{n as T,t as E}from"./utils-XFKvwlFT.js";import{a as D,c as O,i as k,l as A,n as j,o as M,r as N,s as oe,t as P}from"./select-Cg2u0NQI.js";import{i as F,n as se,r as I,t as L}from"./integration-targets-ChYQ8POe.js";import{a as R,c as z,o as B,s as V}from"./tabs-BJs5Kci7.js";import{t as H}from"./circle-question-mark-CJvcT6V6.js";import{i as U,n as W,r as ce,t as le}from"./checkbox-BL44aFel.js";import{t as ue}from"./triangle-alert-BXrJNk3g.js";import{i as G,n as de,t as fe}from"./tooltip-D1ydB4g3.js";import{t as pe}from"./badge-DuuEINVl.js";import{t as K}from"./label-DTHSKF2S.js";import{n as me,t as he}from"./get-error-message-BowDodwy.js";var ge=T(`ban`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}]]),_e=T(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),ve=T(`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`}]]),ye=T(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),be=T(`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`}]]),xe=T(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),Se=T(`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`}]]),Ce=T(`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`}]]),we=T(`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`}]]),Te=T(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Ee=T(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),De=T(`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:E(`animate-pulse rounded-[var(--miravo-radius-tight)] bg-muted`,e),...t})}var Oe=[`devices`,`models`,`assets`],ke=[`assets`,`models`,`devices`],Ae={label:`Alias policy`,value:`Miravo hyphens, LE underscores`},je=[{label:`Protocol`,value:`Template defaults`},Ae],Me={devices:`DeviceHub devices`,models:`Digital Twins models`,assets:`Digital Twins instances`},Ne={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 integration.`,cleanup:`Remove Digital Twins model definitions created by Miravo.`},assets:{apply:`Digital Twins instances bound to DeviceHub devices.`,cleanup:`Remove Digital Twins instances deployed for this target.`}},Pe=`Miravo calls this API.`;function Fe(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 Ie(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 Le(e){let t=e?.trim().toLowerCase();if(t)return i(t)}var Re={assets:`models`};function ze(e,t){let n=new Set(e);if(n.has(t)){n.delete(t);for(let[e,r]of Object.entries(Re))r===t&&n.delete(e)}else{n.add(t);let e=Re[t];e&&n.add(e)}return n}var Be=[{value:`fail`,title:`Fail if unmanaged exists`,hint:`Stop if the target has unmanaged resources.`},{value:`skip`,title:`Skip unmanaged resources`,hint:`Only update resources managed by Miravo.`}];function Ve({open:e,onOpenChange:t,isApply:n,scopeOptions:r,scope:i,onToggleScope:a,ifUnmanaged:o,onIfUnmanagedChange:s}){let c=(0,q.useId)(),l=`if-unmanaged-${c}`;return(0,J.jsxs)(J.Fragment,{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:()=>t(!e),"aria-expanded":e,children:[`Advanced`,(0,J.jsx)(A,{className:E(`size-3.5 shrink-0 text-muted-foreground transition-transform ease-out group-hover:text-foreground/80`,e?`duration-500 rotate-180 text-foreground/80`:`duration-280`),"aria-hidden":!0})]}),(0,J.jsxs)(h.div,{initial:!1,animate:{maxHeight:e?520:0,opacity:+!!e},transition:{maxHeight:{duration:e?.52:.28,ease:e?[.16,1,.3,1]:[.4,0,.2,1]},opacity:{duration:e?.42:.24,ease:e?[.16,1,.3,1]:[.4,0,.2,1]}},className:E(`overflow-hidden`,!e&&`pointer-events-none`),"aria-hidden":!e,inert:!e,children:[(0,J.jsx)(`div`,{className:`flex flex-col gap-1 pt-px`,children:r.map(e=>{let t=Object.entries(Re).find(([t,n])=>n===e)?.[0],r=t!==void 0&&i.has(t),o=n?Ne[e].apply:Ne[e].cleanup;return(0,J.jsxs)(K,{htmlFor:`scope-${e}`,className:E(`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`,r?`opacity-95`:`hover:bg-muted/25`),children:[(0,J.jsx)(`span`,{className:`pt-0.5`,children:(0,J.jsx)(le,{id:`scope-${e}`,checked:i.has(e),disabled:r,onCheckedChange:()=>a(e)})}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1 leading-snug`,children:[(0,J.jsx)(`span`,{className:`font-medium text-foreground`,children:Me[e]}),(0,J.jsx)(`span`,{className:`mt-0.5 block text-[11px] font-normal leading-tight text-muted-foreground`,children:o})]}),r?(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)})}),n&&(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:`${c}-legend`,className:`text-[11px] font-medium uppercase tracking-wide text-foreground/80`,children:`Collision policy`}),(0,J.jsx)(`div`,{role:`radiogroup`,"aria-labelledby":`${c}-legend`,className:`flex flex-col gap-1`,children:Be.map(e=>(0,J.jsxs)(K,{htmlFor:`if-unmanaged-${e.value}`,className:E(`flex cursor-pointer items-start gap-2 rounded-[var(--miravo-radius-tight)] border px-2.5 py-2 text-[11px] transition-colors`,o===e.value?`border-primary/45 bg-primary/8`:`border-border/40 bg-muted/10 hover:bg-muted/25`),children:[(0,J.jsx)(`input`,{id:`if-unmanaged-${e.value}`,type:`radio`,name:l,value:e.value,checked:o===e.value,onChange:()=>s(e.value),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:e.title}),(0,J.jsx)(`span`,{className:`mt-px block text-[11px] leading-tight text-foreground/74`,children:e.hint})]})]},e.value))})]})]})]})}var He=[`modbus`,`opcua`,`mqtt`],Ue={modbus:`Modbus`,opcua:`OPC UA`,mqtt:`MQTT`};function We(e){return e===``?null:!/^\d+$/.test(e)||!s(Number(e))?`Use a port from 1 to 65535.`:null}function Ge(e){return Object.fromEntries(Object.entries(e??{}).map(([e,t])=>[e,String(t)]))}function Ke(e,t,n){let r={...e};for(let e of n){let n=(t[e]??``).trim();if(We(n))return null;n===``?delete r[e]:r[e]=Number(n)}return r}function qe({open:e,onOpenChange:t,protocols:n,values:r,onChange:i,hint:a}){let o=(0,q.useId)();return(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`button`,{type:`button`,onClick:()=>t(!e),"aria-expanded":e,className:`flex w-full items-center gap-1 text-left text-[11px] font-medium text-muted-foreground hover:text-foreground`,children:[(0,J.jsx)(A,{className:E(`size-3 transition-transform`,!e&&`-rotate-90`),"aria-hidden":!0}),`Miravo ports remapped (Docker)?`]}),e?(0,J.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[(0,J.jsx)(`p`,{className:`text-[11px] leading-snug text-muted-foreground`,children:a}),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-3`,children:n.map(e=>{let t=r[e]??``,n=We(t.trim());return(0,J.jsxs)(`div`,{className:`w-24 space-y-1`,children:[(0,J.jsx)(K,{htmlFor:`${o}-${e}`,className:`text-[11px] text-muted-foreground`,children:Ue[e]}),(0,J.jsx)(C,{id:`${o}-${e}`,inputMode:`numeric`,placeholder:String(p[e]),value:t,"aria-invalid":n!==null,onChange:t=>i({...r,[e]:t.currentTarget.value}),className:`h-8 font-mono text-[12px]`}),n?(0,J.jsx)(`p`,{className:`text-[10px] text-destructive`,children:n}):null]},e)})})]}):null]})}function Je(e){return e.replace(/-/g,`_`)}function Ye({targetId:e,model:t,protocol:n,result:r}){return{targetId:e,model:t,protocol:n,scope:r.scope,deviceName:r.deviceName,ifUnmanaged:r.ifUnmanaged,exposedPorts:r.exposedPorts}}function Xe({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,exposedPorts:n.exposedPorts}}function Ze({targetId:e,template:t,allManaged:n,result:r}){return{targetId:e,...n?{allManaged:!0}:{template:t},scope:r.scope}}var X=`Source host (Miravo)`,Qe=`Address Litmus Edge uses to reach your running Miravo factory.`;function $e({open:e,onOpenChange:t,type:n,label:r,targetLabel:i,hostname:a,sourceHostname:o,exposedPorts:s,protocols:c=He,onConfirm:l,defaultDeviceName:u,defaultNamePrefix:d,metadata:f=[],applyPreview:ee,cleanupPreview:p}){let m=n===`apply`?Oe:ke,[h,g]=(0,q.useState)(new Set(m)),[_,v]=(0,q.useState)(!1),[y,b]=(0,q.useState)(!1),[S,w]=(0,q.useState)(``),[T,D]=(0,q.useState)(null),[O,k]=(0,q.useState)(``),[A,j]=(0,q.useState)(null),[M,N]=(0,q.useState)(`fail`),[oe,P]=(0,q.useState)(!1),[F,se]=(0,q.useState)({}),I=(0,q.useId)(),L=(0,q.useId)(),R=n===`apply`,z=Le(d),B=R&&u!==void 0&&u!==``,V=R&&!B&&z!==void 0,H=(S.trim()===``?u??``:S.trim().toLowerCase()).trim(),U=(O.trim()===``?z??``:O.trim().toLowerCase()).trim(),W=H?Je(H):``;(0,q.useEffect)(()=>{e&&(g(new Set(m)),v(!1),D(null),j(null),w(B?u??``:``),k(V?z??``:``),N(`fail`),b(!1),se(Ge(s)),P(Object.keys(s??{}).length>0))},[e,s,m,B,u,V,z]);let ue=e=>{g(t=>ze(t,e))},G=R?ee:p,de=()=>{let e=fe();if(!e||!R)return e;let t=Ke(s,F,c);return t?{...e,exposedPorts:t}:(P(!0),null)},fe=()=>{let e=m.filter(e=>h.has(e));if(e.length===0)return null;if(B){let t=H,n=Fe(t);return n?(D(n),null):(D(null),j(null),{scope:e,deviceName:t,ifUnmanaged:M})}if(V){let t=U,n=Ie(t);return n?(j(n),null):(j(null),{scope:e,namePrefix:t,ifUnmanaged:M})}return{scope:e,ifUnmanaged:M}},pe=e=>{G?.onPreview(e),t(!1)};return(0,J.jsx)(re,{open:e,onOpenChange:t,children:(0,J.jsxs)(ie,{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)(ae,{className:`flex items-center gap-2 text-sm font-semibold leading-snug`,children:[R?(0,J.jsx)(ce,{className:`size-3.5 shrink-0 text-primary`,"aria-hidden":!0}):(0,J.jsx)(De,{className:`size-3.5 shrink-0 text-destructive`,"aria-hidden":!0}),R?`Apply to Litmus Edge`:`Clean up Litmus Edge`]}),(0,J.jsx)(ne,{className:`sr-only`,children:R?`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.jsx)(Z,{label:R?`Resource`:`Target`,children:r}),(0,J.jsx)(Z,{label:`Target`,children:i}),(0,J.jsx)(Z,{label:`Litmus Edge API`,help:Pe,mono:!0,children:a}),(0,J.jsx)(Z,{label:X,help:Qe,mono:!0,children:o}),R?(0,J.jsx)(`div`,{className:`border-b border-border/35 py-2.5`,children:(0,J.jsx)(qe,{open:oe,onOpenChange:P,protocols:c,values:F,onChange:se,hint:`Enter the host port Litmus Edge should dial. Leave blank to use Miravo's own port. Saved for this target.`})}):null,B&&H?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Z,{label:`Miravo asset ID`,mono:!0,children:H}),(0,J.jsx)(Z,{label:`Litmus Edge alias`,mono:!0,children:W})]}):null,f.map(e=>(0,J.jsx)(Z,{label:e.label,children:e.value},`${e.label}:${e.value}`))]})}),G?(0,J.jsxs)(K,{className:E(`flex cursor-pointer items-center gap-2.5 text-[11px] font-medium leading-snug`,G.disabled&&`pointer-events-none opacity-50`),children:[(0,J.jsx)(`span`,{className:`flex shrink-0 items-center`,children:(0,J.jsx)(le,{checked:y,onCheckedChange:e=>b(e===!0),disabled:G.disabled})}),(0,J.jsx)(`span`,{className:`min-w-0 flex-1 leading-snug`,children:R?`Dry run only — preview the plan without deploying`:`Dry run only — preview the plan without removing resources`})]}):null,B?(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,J.jsx)(K,{htmlFor:I,className:`text-[11px] font-medium`,children:`Miravo asset ID`}),(0,J.jsx)(C,{id:I,value:S,maxLength:120,onChange:e=>{let t=e.target.value;w(t),D(Fe((t.trim()===``?u??``:t.trim().toLowerCase()).trim()))},placeholder:u,autoComplete:`off`,spellCheck:!1,className:E(`h-9 min-w-0 font-mono text-xs`,T&&`border-destructive`),"aria-invalid":T!=null,"aria-describedby":`${I}-hint`}),(0,J.jsx)(`p`,{id:`${I}-hint`,className:`min-w-0 wrap-break-word text-[11px] leading-snug text-foreground/76`,children:`Same asset ID on a later run updates this asset; hyphens stay in Miravo.`}),W?(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:[H,` -> `,W]})]}):null,T?(0,J.jsx)(`p`,{className:`text-[11px] text-destructive`,children:T}):null]}):null,V?(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,J.jsx)(K,{htmlFor:L,className:`text-[11px] font-medium`,children:`Name prefix`}),(0,J.jsx)(C,{id:L,value:O,maxLength:120,onChange:e=>{let t=e.target.value;k(t),j(Ie((t.trim()===``?z??``:t.trim().toLowerCase()).trim()))},placeholder:z,autoComplete:`off`,spellCheck:!1,className:E(`h-9 min-w-0 font-mono text-xs`,A&&`border-destructive`),"aria-invalid":A!=null,"aria-describedby":`${L}-hint`}),(0,J.jsxs)(`p`,{id:`${L}-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:[U||z,`-pump-001 ->`,` `,Je(`${U||z}-pump-001`)]})]}),A?(0,J.jsx)(`p`,{className:`text-[11px] text-destructive`,children:A}):null]}):null,(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsx)(Ve,{open:_,onOpenChange:v,isApply:R,scopeOptions:m,scope:h,onToggleScope:ue,ifUnmanaged:M,onIfUnmanagedChange:N}),h.size===0&&!(y&&G)?(0,J.jsx)(`p`,{className:`text-[11px] text-destructive`,children:`Select at least one scope or reopen to reset.`}):null]})]})}),(0,J.jsxs)(te,{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)(x,{type:`button`,variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,J.jsx)(x,{type:`button`,variant:R||y&&p?`default`:`destructive`,onClick:()=>{let e=de();if(e){if(y&&G){pe(e);return}l(e)}},disabled:y&&G?G.disabled||G.planLoading:h.size===0,children:R?y&&ee?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(we,{className:`size-3`,"aria-hidden":!0}),`Preview changes`]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(ce,{className:`size-3`,"aria-hidden":!0}),`Apply`]}):y&&p?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(we,{className:`size-3`,"aria-hidden":!0}),`Preview changes`]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(De,{className:`size-3`,"aria-hidden":!0}),`Clean up`]})})]})]})})}function Z({label:e,help:t,mono:n=!1,children:r}){return(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:[t?(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:e}),(0,J.jsxs)(fe,{children:[(0,J.jsx)(G,{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 ${e}`,children:(0,J.jsx)(H,{className:`size-3`,"aria-hidden":!0})}),(0,J.jsx)(de,{side:`top`,align:`start`,className:`max-w-xs text-left`,children:t})]})]})}):(0,J.jsx)(`dt`,{className:`min-w-0 pt-px text-[11px] font-medium text-muted-foreground`,children:e}),n?(0,J.jsx)(`dd`,{className:`min-w-0 break-all font-mono text-[11px] leading-normal text-foreground/90`,children:r}):(0,J.jsx)(`dd`,{className:`min-w-0 wrap-break-word font-medium text-foreground`,children:r})]})}var et={initial:{scale:0,opacity:0},animate:{scale:1,opacity:1,originY:0},exit:{scale:0,opacity:0},transition:{type:`spring`,stiffness:350,damping:40}},tt={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 nt({children:e,variant:t=`default`}){let n=t===`default`;return(0,J.jsx)(h.div,{...n?et:tt,layout:n,className:`mx-auto w-full`,children:e})}var rt=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:E(`flex flex-col items-center gap-4`,t),...r,children:(0,J.jsx)(_,{children:s.map(e=>(0,J.jsx)(nt,{children:e},e.key))})})});rt.displayName=`AnimatedList`;function it({type:e,errorMessage:t,className:n}){return null}var at=`text-destructive hover:bg-destructive/25 hover:text-foreground`,ot={device:`Devices`,tags:`Tags`,model:`Models`,asset:`Assets`,"param-sync":`Parameters`};function st(e){return ot[e]??e}function ct(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 lt(e){return e===`noop`?`no-op`:e}function ut({status:e}){switch(e){case`success`:return(0,J.jsx)(z,{className:`size-3.5 shrink-0 text-success`});case`failed`:return(0,J.jsx)(V,{className:`size-3.5 shrink-0 text-destructive`});case`pending`:return(0,J.jsx)(B,{className:`size-3.5 shrink-0 animate-spin text-primary/90`})}}function dt({status:e}){switch(e){case`done`:return(0,J.jsx)(z,{className:`size-3.5 text-success`});case`active`:return(0,J.jsx)(B,{className:`size-3.5 animate-spin text-primary`});case`pending`:return(0,J.jsx)(ye,{className:`size-3.5 text-foreground/55`})}}function ft({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:E(`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)(ut,{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:E(`inline-flex rounded-[var(--miravo-radius-tight)] px-1.5 py-0.5 text-[9px] font-medium uppercase tracking-wider`,ct(e.action)),children:lt(e.action)}),e.error&&(0,J.jsx)(A,{className:E(`size-3 text-foreground/75 transition-transform`,t&&`rotate-180`)})]}),(0,J.jsx)(_,{initial:!1,children:t&&e.error&&(0,J.jsxs)(h.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)(b,{value:e.error,label:`Copy error`,className:E(at,`shrink-0`)})]}),(0,J.jsx)(it,{type:`apply`,errorMessage:e.error,className:`mb-1 mt-2.5 w-full min-w-0`})]})})]})}function pt({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:E(`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)(dt,{status:e.status}),(0,J.jsx)(`span`,{className:`text-xs font-medium tracking-wide text-foreground`,children:st(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)(z,{className:`size-3 text-success`}),a&&(0,J.jsx)(A,{className:E(`size-3 text-foreground/75 transition-transform`,!t&&`-rotate-90`),"aria-hidden":!0})]})]}),(0,J.jsx)(_,{initial:!1,children:a&&t&&(0,J.jsx)(h.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)(g.Provider,{value:null,children:e.resources.map((e,t)=>(0,J.jsx)(nt,{variant:`subtle`,children:(0,J.jsx)(ft,{entry:e})},`${e.name}-${t}`))})})})})]})}function mt({operation:e}){let t=e.status===`complete`,n=e.status===`cancelled`,r=e.failed>0,i=e.totalPlanned>0?Math.min(100,gt(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)(h.div,{"aria-hidden":`true`,className:E(`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 ht(e){return e.duration==null?(Date.now()-e.startedAt)/1e3:e.duration/1e3}function gt(e){let t=e.applied+e.failed;return e.totalPlanned>0?Math.min(t,e.totalPlanned):t}function _t(e,t){let n=e.label;return t?.length?t.find(e=>e.id===n)?.name??n:n}var vt={complete:{Icon:z,className:`size-4 text-success`},partial:{Icon:ve,className:`size-4 text-warning`},cancelled:{Icon:ge,className:`size-4 text-foreground/65`},error:{Icon:V,className:`size-4 text-destructive`},running:{Icon:B,className:`size-4 animate-spin text-warning`}};function yt({icon:e,className:t}){return(0,J.jsx)(h.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 bt({operation:e,sourceLabel:t,isAllExpanded:n,onToggleAll:r}){let i=ht(e),a=gt(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=vt[u];return(0,J.jsxs)(`div`,{className:E(`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)(_,{mode:`wait`,initial:!1,children:(0,J.jsx)(yt,{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.targetLabel}`})]})]}),(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)(pe,{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)(_,{mode:`popLayout`,initial:!1,children:(0,J.jsx)(h.span,{initial:{opacity:0,y:-6},animate:{opacity:1,y:0},exit:{opacity:0,y:6},transition:{type:`spring`,stiffness:500,damping:35},className:`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)(_,{initial:!1,children:e.failed>0&&(0,J.jsx)(h.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)(pe,{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)(xe,{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)(_e,{className:E(`size-3.5 transition-transform duration-300`,!n&&`opacity-70 scale-y-[-1]`)})})})]})]}),(0,J.jsx)(mt,{operation:e})]})]})}function xt(e){return e?e.closest(`[data-edge-op-scroll]`)??e.closest(`.overflow-y-auto`):null}var St=350;function Ct(e){e?.scrollIntoView({block:`end`,behavior:`auto`,inline:`nearest`})}function wt(e){let t=()=>Ct(e);t(),requestAnimationFrame(t),requestAnimationFrame(()=>requestAnimationFrame(t)),window.setTimeout(t,0),window.setTimeout(t,48),window.setTimeout(t,120)}function Tt({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:E(`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)(U,{className:`mt-0.5 size-3.5 shrink-0 text-primary`,"aria-hidden":!0}):(0,J.jsx)(ve,{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 Et({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)(()=>_t(e,t),[e,t]);(0,q.useLayoutEffect)(()=>{let e=xt(r.current);if(!e)return;let t=()=>{a.current=e.scrollHeight-e.scrollTop-e.clientHeight<St};return e.addEventListener(`scroll`,t,{passive:!0}),t(),()=>{e.removeEventListener(`scroll`,t)}},[]),(0,q.useLayoutEffect)(()=>{if(e.status===`running`){a.current&&Ct(i.current),s.current=!0;return}s.current&&=(wt(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&&Ct(i.current)})});return s.observe(t),a.current&&Ct(i.current),()=>{s.disconnect(),cancelAnimationFrame(n)}},[e.status]);let d=e.phases.length>0,f=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)(bt,{operation:e,sourceLabel:u,isAllExpanded:f,onToggleAll:d?()=>{l(f?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)(pt,{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)(_,{initial:!1,children:e.error&&e.retryPending&&(0,J.jsxs)(h.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)(B,{className:`size-4 shrink-0 animate-spin`}),(0,J.jsx)(`span`,{className:`truncate`,children:e.error})]})}),(0,J.jsx)(_,{initial:!1,children:e.error&&e.status===`error`&&(0,J.jsxs)(h.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)(b,{value:e.error,label:`Copy error`,className:E(at,`shrink-0`)})]}),(0,J.jsx)(it,{type:e.type,errorMessage:e.error,className:`mt-3 w-full min-w-0`})]})}),n&&n.length>0?(0,J.jsx)(Tt,{logs:n}):null,(0,J.jsx)(`div`,{ref:i,className:`h-px w-full shrink-0`,"aria-hidden":!0})]})}function Dt({format:e,kind:t}){return e===`source-yaml`?t===`model`?`Raw asset model definition. Edit locally, version-control, or use as input for the CLI.`:`Raw factory 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 Litmus Edge UI.`:`Litmus Edge template JSON (DeviceHub devices + Digital Twins). Import directly via the Litmus Edge UI.`:`Select a format to download.`}function Ot({children:e,className:t}){return(0,J.jsx)(`div`,{className:E(`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 kt({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)(h.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)(Ot,{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)(R,{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)(x,{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)(w,{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 At={...Object.fromEntries(F.map(e=>[e.id,e.exportLabel])),"source-yaml":`Source YAML`};function jt(e){return e==null||e===``?`Select integration`:typeof e==`string`?At[e]??e:`Select integration`}function Mt(e){return F.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:E(`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)(K,{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 Nt({open:e,editing:t,integrationId:n,form:r,showToken:i,saving:a,testing:o,canTestConnection:s,onOpenChange:c,onIntegrationChange:l,onFormChange:u,onShowTokenChange:d,onSave:f,onTestConnection:ee,onCancelInFlight:p}){let m=n===I.id,h=t?`Edit Target`:`Add Target`,g=t?`Update the deployment connection.`:`Add the target used for integration deploys.`,_=t?`Leave empty to keep the current token.`:`Required for the first save and connection test.`;return(0,J.jsx)(re,{open:e,onOpenChange:e=>{e||p(),c(e)},children:(0,J.jsxs)(ie,{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)(y,{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)(ae,{className:`text-base tracking-tight`,children:h}),(0,J.jsx)(ne,{className:`max-w-xl text-sm leading-relaxed`,children:g})]}),(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:`Integration`,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:Mt(n)})}):(0,J.jsx)(Q,{label:`Integration`,children:(0,J.jsxs)(P,{value:n,onValueChange:e=>l(e),children:[(0,J.jsx)(oe,{className:`h-9 w-full text-sm data-placeholder:text-muted-foreground/55`,"aria-label":`Integration type`,children:(0,J.jsx)(O,{placeholder:`Select integration`,children:e=>jt(e)})}),(0,J.jsxs)(j,{children:[(0,J.jsxs)(N,{children:[(0,J.jsx)(D,{children:`Available`}),L.map(e=>(0,J.jsx)(k,{value:e.id,children:e.label},e.id))]}),(0,J.jsx)(M,{}),(0,J.jsxs)(N,{children:[(0,J.jsx)(D,{children:`Coming soon`}),se.map(e=>(0,J.jsx)(k,{value:e.id,children:e.label},e.id))]})]})]})}),m?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Q,{id:`env-label`,label:`Label`,children:(0,J.jsx)(C,{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)(C,{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)(fe,{children:[(0,J.jsx)(G,{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)(H,{className:`size-3`,"aria-hidden":!0})}),(0,J.jsx)(de,{side:`top`,align:`start`,className:`max-w-xs text-left`,children:Qe})]}),children:(0,J.jsx)(C,{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)(fe,{children:[(0,J.jsx)(G,{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)(H,{className:`size-3`,"aria-hidden":!0})}),(0,J.jsx)(de,{side:`top`,align:`start`,className:`max-w-xs text-left`,children:_})]}),children:(0,J.jsxs)(`div`,{className:`relative`,children:[(0,J.jsx)(C,{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)(Se,{className:`size-3.5`,"aria-hidden":!0}):(0,J.jsx)(Ce,{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:[Mt(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&&m?`Checking connection to Litmus Edge…`:``}),(0,J.jsxs)(te,{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)(x,{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:ee,children:o?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(B,{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)(x,{variant:`outline`,size:`lg`,className:`w-full sm:w-auto`,onClick:()=>{p(),c(!1)},disabled:a,children:`Cancel`}),(0,J.jsx)(x,{size:`lg`,className:`w-full sm:w-auto`,onClick:f,disabled:a||!m,children:a?`Saving...`:t?`Save Target`:`Add Target`})]})]})]})})}var Pt=`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 Ft({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:E(`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)(Te,{className:`inline size-3`}),` Add target`]})]}):(0,J.jsxs)(P,{value:t,onValueChange:e=>e&&n(e),disabled:i,children:[(0,J.jsx)(oe,{size:r,className:E(`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:Pt,"aria-hidden":!0,children:(0,J.jsx)(W,{className:`size-3.5`})}),(0,J.jsx)(O,{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)(j,{className:`rounded-[var(--miravo-radius-stadium-sm)] p-1.5`,children:e.map(e=>(0,J.jsxs)(k,{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:Pt,"aria-hidden":!0,children:(0,J.jsx)(W,{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 It(){return(await u(`/integrations/le/targets`,a.integrationTargets)).targets}function Lt(e){return u(`/integrations/le/targets`,a.integrationTargetCreate,{body:e})}function Rt(e,t){return u(`/integrations/le/targets/${e}`,a.integrationTargetById,{body:t})}function zt(e){return u(`/integrations/le/targets/${e}`,a.integrationTargetDelete)}function Bt(e,t){return u(`/integrations/le/targets/test`,a.integrationConnectionTest,{body:e,init:{signal:t?.signal}})}function Vt(e,t){return u(`/integrations/le/plan`,a.integrationPlan,{body:e,init:{signal:t?.signal}})}function Ht(e,t){return u(`/integrations/le/cleanup/plan`,a.integrationCleanupPlan,{body:e,init:{signal:t?.signal}})}function Ut(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 u(n?`/integrations/le/operations?${n}`:`/integrations/le/operations`,a.integrationOperations)}async function Wt(e){try{return await u(`/integrations/le/operations/${e}/cancel`,a.integrationOperationCancel),!0}catch(e){if(r.is(e)&&e.status===404)return!1;throw e}}function Gt(e,t,n){return qt(`/integrations/le/apply/stream`,a.integrationApplyStream,e,t,n)}function Kt(e,t,n){return qt(`/integrations/le/cleanup/stream`,a.integrationCleanupStream,e,t,n)}function qt(e,t,n,i,a){let s=new AbortController;return(async()=>{try{let a=t.body.safeParse(n);if(!a.success)throw Error(`Invalid request for ${t.method} ${t.path}: ${a.error.message}`);let u=await fetch(l(d,e),{method:t.method,headers:{"content-type":`application/json`},credentials:`include`,body:JSON.stringify(a.data),signal:s.signal});if(u.status===401&&t.auth===`required`)throw c(),Error(`Session expired`);if(!u.ok){let e=`HTTP ${u.status}`;try{let e=await u.json(),t=ee.safeParse(e);if(t.success)throw new r({code:t.data.code,status:u.status,message:t.data.message,hint:t.data.hint})}catch(e){if(e instanceof r)throw e}throw Error(e)}if(!u.body)throw Error(`No response body`);let f=u.body.getReader(),p=new TextDecoder,m=``,h=``,g=``,_=!1;for(;;){let{done:e,value:t}=await f.read();if(e)break;m+=p.decode(t,{stream:!0});let n=m.split(`
|
|
2
|
-
`);m=n.pop()??``;for(let e of n)if(e.startsWith(`event: `))h=e.slice(7).trim();else if(e.startsWith(`data: `))g=e.slice(6);else if(e===``&&h&&g){let e=!1;try{let t=JSON.parse(g),n=o.safeParse({event:h,data:t});n.success&&((n.data.event===`complete`||n.data.event===`cancelled`||n.data.event===`error`)&&(_=!0,e=!0),i(n.data))}catch{}if(h=``,g=``,e){await f.cancel();return}}}if(!_&&!s.signal.aborted)throw Error(`Connection to server was lost unexpectedly`)}catch(e){if(s.signal.aborted)return;a(e instanceof Error?e:Error(String(e)))}})(),s}function Jt(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 Yt(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 Xt(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(`factory not found`))return{message:`That target was removed. Close the dialog and refresh the list.`};if(n.includes(`unsupported integration`)&&n.includes(`connection`))return{message:`This integration 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:Zt(t,200)}}function Zt(e,t){let n=e.replace(/\s+/g,` `).trim();return n.length<=t?n:`${n.slice(0,t-1)}…`}function Qt(e){if(e.connected){let t=e.litmusEdgeVersion?` Litmus Edge v${e.litmusEdgeVersion}.`:``;if(e.warning){v.warning(`Connected to ${e.hostname}.${t}`,{description:e.warning});return}v.success(`Connected to ${e.hostname}.${t}`);return}let{message:t,description:n}=Xt(e.error);v.error(t,n?{description:n}:void 0)}function $t(e){let{message:t,description:n}=Xt(e instanceof Error?e.message:String(e));v.error(t,n?{description:n}:void 0)}function en(e){return!!(typeof DOMException<`u`&&e instanceof DOMException&&e.name===`AbortError`||e instanceof Error&&(e.name===`AbortError`||/aborted/i.test(e.message)))}function tn(){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{Qt(await Bt(e,{signal:r.signal}))}catch(e){if(en(e))return;$t(e)}finally{n.current===r&&(n.current=null),t(!1)}},[]),cancelInFlight:r}}function nn(e){return e instanceof DOMException&&e.name===`AbortError`||e instanceof Error&&e.name===`AbortError`}function rn(e){return e.map(e=>e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)).join(`, `)}function an({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)(be,{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)(x,{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)(w,{className:`size-4`,"aria-hidden":!0})})]})]})})}var on={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 sn({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 cn({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 ln({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)(an,{onCloseTable:t,planKind:n}),(0,J.jsx)(sn,{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)(be,{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 template — nothing would be deleted.`:`This template 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)(an,{onCloseTable:t,planKind:n}),(0,J.jsx)(sn,{plan:e,planKind:n}),(0,J.jsx)(cn,{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:E(`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)(pe,{variant:`outline`,className:E(`border px-1.5 py-0 font-mono text-[10px] uppercase tracking-wide`,on[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:rn(e.scope)})]})]})]})}var un=[`s1`,`s2`,`s3`,`s4`];function dn(){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:un.map((e,t)=>(0,J.jsxs)(`tr`,{className:E(`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 fn({stream:e,className:t}){let n=Jt(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:E(`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)(S,{className:`size-3 shrink-0 opacity-95`,strokeWidth:2.5,"aria-hidden":!0}):a?(0,J.jsx)(ge,{className:`size-3 shrink-0 opacity-95`,"aria-hidden":!0}):i?(0,J.jsx)(ue,{className:`size-3 shrink-0 opacity-95`,"aria-hidden":!0}):(0,J.jsx)(B,{className:`size-3 shrink-0 animate-spin`,"aria-hidden":!0}),n]})}var pn={status:`idle`,operation:null,error:null,logs:[],cancelRequested:!1},mn=200;function hn(){let[e,t]=(0,q.useState)(pn),n=(0,q.useRef)(null),r=(0,q.useRef)(0),i=m(),a=(0,q.useRef)(0),o=(0,q.useCallback)(e=>{let n=me(e,`Integration operation failed.`),r=he(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}))},[]),s=(0,q.useCallback)(e=>{switch(e.event){case`accepted`:gn(e.data,t);break;case`log`:vn({...e.data,id:`log-${r.current++}`},t);break;case`started`:yn(e.data,t);break;case`phase`:bn(e.data,t);break;case`resource`:xn(e.data,t);break;case`complete`:Sn(e.data,t);break;case`cancelled`:wn(e.data,t);break;case`retrying`:Tn(e.data,t);break;case`error`:o(Error(e.data.message));break}},[o]),c=(0,q.useCallback)(e=>{let c=++a.current;n.current?.abort(),r.current=0,t({status:`running`,operation:null,error:null,logs:[],cancelRequested:!1}),n.current=Gt(e,e=>{a.current===c&&(s(e),En(e)&&(i.invalidateQueries({queryKey:f.integrations.targets()}),n.current?.abort(),n.current=null))},e=>{a.current===c&&(n.current=null,o(e))})},[s,o,i]),l=(0,q.useCallback)(e=>{let i=++a.current;n.current?.abort(),r.current=0,t({status:`running`,operation:null,error:null,logs:[],cancelRequested:!1}),n.current=Kt(e,e=>{a.current===i&&(s(e),En(e)&&(n.current?.abort(),n.current=null))},e=>{a.current===i&&(n.current=null,o(e))})},[s,o]),u=(0,q.useCallback)(()=>{a.current++,n.current?.abort(),n.current=null,t(pn)},[]),d=(0,q.useCallback)(async()=>{let n=e.operation?.operationId;if(!(!n||e.status!==`running`||e.cancelRequested)){t(e=>Cn(e,n));try{await Wt(n)||o(Error(`Operation finished before cancellation was accepted.`))}catch(e){o(e instanceof Error?e:Error(`Cancellation failed.`))}}},[e.operation?.operationId,e.status,e.cancelRequested,o]);return(0,q.useEffect)(()=>()=>{a.current++,n.current?.abort(),n.current=null},[]),{...e,startApply:c,startCleanup:l,reset:u,cancel:d}}function gn(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`),targetLabel:e.targetId??`Resolving target`,totalPlanned:0,phases:[],applied:0,failed:0,status:`running`,startedAt:Date.now()}}))}function _n(e){return(e.template??e.model)||(e.type===`cleanup`?`All managed resources`:`unknown`)}function vn(e,t){t(t=>({...t,logs:[...t.logs,e].slice(-mn)}))}function yn(e,t){t(t=>({...t,status:`running`,cancelRequested:!1,error:null,operation:{operationId:e.operationId,type:e.type,label:_n(e),targetLabel:e.targetLabel,totalPlanned:e.totalPlanned,phases:[],applied:0,failed:0,status:`running`,startedAt:Date.now(),attempt:e.attempt,maxAttempts:e.maxAttempts}}))}function bn(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 xn(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 wn(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 Tn(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 En(e){return e.event===`complete`||e.event===`cancelled`||e.event===`error`}export{Ke as A,Qe as C,Ze as D,Xe as E,Te as F,we as I,Ce as L,je as M,De as N,qe as O,Ee as P,ye as R,$e as S,Ye as T,kt as _,nn as a,Et as b,Lt as c,It as d,Ht as f,Nt as g,Ft as h,dn as i,Ae as j,He as k,zt as l,Rt as m,fn as n,tn as o,Vt as p,ln as r,Yt as s,hn as t,Ut as u,Ot as v,X as w,it as x,Dt as y};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/fleet-CBXZ0Xts.js","assets/fleet-CRB8-QDg.js","assets/rolldown-runtime-COnpUsM8.js","assets/chunk-OE4NN4TA-DBWZidbW.js","assets/vendor-charts-95ykyDlI.js","assets/api-DdyA1QMC.js","assets/vendor-ui-CWUk2ulb.js","assets/format-6q8Tnwmn.js","assets/utils-XFKvwlFT.js","assets/arrow-right-BjBb4z7g.js","assets/arrow-up-down-C1oJAmrw.js","assets/select-Cg2u0NQI.js","assets/circle-question-mark-CJvcT6V6.js","assets/dist-xY0pK9Wy.js","assets/shallow-Cin0mLuv.js","assets/badge-DuuEINVl.js","assets/combobox-B5iFVe7N.js","assets/select-display-items-BEVMAho-.js","assets/tooltip-D1ydB4g3.js","assets/transition-types-CPlGtM8w.js","assets/catalog-CdbAE0Ki.js","assets/catalog-Ca9rhNLN.js","assets/query-fetch-error-ytmF7SP9.js","assets/AnimatePresence-CPmH1DMY.js","assets/proxy-Be4WzmcS.js","assets/use-integration-stream-CFkuEB9r.js","assets/integration-targets-ChYQ8POe.js","assets/tabs-BJs5Kci7.js","assets/copy-button-RVCJ3aqM.js","assets/checkbox-BL44aFel.js","assets/triangle-alert-BXrJNk3g.js","assets/label-DTHSKF2S.js","assets/get-error-message-BowDodwy.js","assets/catalog-template-icons-aec8m5-A.js","assets/catalog-source-CPFWtBJF.js","assets/download-DmUZKo9N.js","assets/use-engine-command-mutation-OZ8_Roso.js","assets/runtime-link-D-uJbw97.js","assets/models-CgWCVmnx.js","assets/models-BDeOqKQk.js","assets/activity-Cy_niK56.js","assets/spawn-protocol-scope-picker-DDi-hZwj.js","assets/events-D5uZ2cwr.js","assets/events-Bp3BqWYo.js","assets/auth-screen-backdrop-CgwRhIbi.js","assets/control-DYdEZmP0.js","assets/control-CtvncuAA.js","assets/validation-BvXCKp12.js","assets/layers-1figUpjG.js","assets/transition-nav-link-Crj9XTbK.js","assets/tags-CcmWc8Xj.js","assets/tags-DnyhyxDB.js","assets/vendor-table-BAHQgdwg.js","assets/dropdown-menu-82O7jPU6.js","assets/integrations-D4x6ee5M.js","assets/integrations-BrZWbG5Q.js","assets/asset-detail-D-coMgED.js","assets/login-O9dnrHI9.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-CBXZ0Xts.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-CdbAE0Ki.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-CgWCVmnx.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-D5uZ2cwr.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-DYdEZmP0.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-CcmWc8Xj.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===`/integrations`,load:()=>r(()=>import(`./integrations-D4x6ee5M.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(`/asset/`),load:()=>r(()=>import(`./asset-detail-D-coMgED.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-O9dnrHI9.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{$ as n,N as r,Q as i,k as a,tt as o}from"./api-DdyA1QMC.js";import{l as s}from"./copy-button-RVCJ3aqM.js";import{n as c,t as l}from"./utils-XFKvwlFT.js";import"./tabs-BJs5Kci7.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=n({multiplier:i({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=n({model:o().min(1,`Model is required.`),count:i({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.`),assetName:m(),assetPrefix:m(),protocolScope:a.optional()}),_=n({assetId:o().min(1,`Asset is required.`),fault:o().min(1,`Fault name is required.`)}),v=n({assetId:o().min(1,`Asset 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};
|