@miravo/cli-linux-x64 0.10.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/console-dist/assets/{AnimatePresence-BZCmb1bq.js → AnimatePresence-BSSlw02V.js} +3 -3
  2. package/console-dist/assets/{activity-Cn48I9qe.js → activity-Cy_niK56.js} +1 -1
  3. package/console-dist/assets/{api-kPM52mb-.js → api-B2QJEzbS.js} +1 -1
  4. package/console-dist/assets/api-Vq4lny_H.js +1 -0
  5. package/console-dist/assets/arrow-up-right-CwPw_2U1.js +1 -0
  6. package/console-dist/assets/asset-detail-E-TllNHT.js +1 -0
  7. package/console-dist/assets/asset-detail-actions-jjbvaDES.js +1 -0
  8. package/console-dist/assets/asset-panel-DDziFlFl.js +1 -0
  9. package/console-dist/assets/{auth-screen-backdrop-hcEYy3K4.js → auth-screen-backdrop-CEykEbfF.js} +1 -1
  10. package/console-dist/assets/backup-power-BDMAO2bO.js +1 -0
  11. package/console-dist/assets/badge-Bk1DaL6C.js +1 -0
  12. package/console-dist/assets/boiler-CWAR1Nq2.js +1 -0
  13. package/console-dist/assets/by-path-VBqTBdlG.js +1 -0
  14. package/console-dist/assets/catalog-BlkPPAWE.js +1 -0
  15. package/console-dist/assets/catalog-CQopEu5C.js +1 -0
  16. package/console-dist/assets/{catalog-source-2aT9qob-.js → catalog-source-B4L5N-a1.js} +1 -1
  17. package/console-dist/assets/catalog-template-icons-BOSywIKV.js +1 -0
  18. package/console-dist/assets/check-B-yvIfMj.js +1 -0
  19. package/console-dist/assets/checkbox-DEAkDfFr.js +1 -0
  20. package/console-dist/assets/chevron-down-x70Pto6j.js +1 -0
  21. package/console-dist/assets/chevron-left-XHFooLn1.js +1 -0
  22. package/console-dist/assets/chevron-right-CMSQPSEo.js +1 -0
  23. package/console-dist/assets/chiller-BSx8eUMN.js +1 -0
  24. package/console-dist/assets/{circle-x-CGcRflg7.js → circle-x-_o0nl0Rg.js} +1 -1
  25. package/console-dist/assets/combobox-B8h0-NHs.js +1 -0
  26. package/console-dist/assets/commercial-building-CNvi6IZK.js +1 -0
  27. package/console-dist/assets/compressor-D63w6Ir2.js +1 -0
  28. package/console-dist/assets/console-panel-CMDoBJiO.js +1 -0
  29. package/console-dist/assets/control-CBviLxJB.js +1 -0
  30. package/console-dist/assets/control-jNqzZWa9.js +1 -0
  31. package/console-dist/assets/copy-button-CSUP1VjU.js +1 -0
  32. package/console-dist/assets/{dialog-Di9Bs0FH.js → dialog-B5PqrKVw.js} +1 -1
  33. package/console-dist/assets/district-heating-Cr4CrgCA.js +1 -0
  34. package/console-dist/assets/dom-Cm_OH5jc.js +1 -0
  35. package/console-dist/assets/{download-B9e1wNK4.js → download-i8CTJ7oi.js} +1 -1
  36. package/console-dist/assets/{local-flag-CPAqDO-L.js → dropdown-menu-B_MMNbTy.js} +1 -1
  37. package/console-dist/assets/events-D531_1EZ.js +1 -0
  38. package/console-dist/assets/events-RmbRTKFV.js +1 -0
  39. package/console-dist/assets/events-format-C5HTkIsC.js +1 -0
  40. package/console-dist/assets/export-tab-fZDO4r2u.js +1 -0
  41. package/console-dist/assets/factory-C2OucdpQ.js +1 -0
  42. package/console-dist/assets/factory-CgSIjU5V.js +1 -0
  43. package/console-dist/assets/factory-DLE12zAd.js +1 -0
  44. package/console-dist/assets/floor-page-D0mX5OuA.js +1 -0
  45. package/console-dist/assets/floor-page-E-0txA4z.css +1 -0
  46. package/console-dist/assets/format-Bx7DF-TB.js +1 -0
  47. package/console-dist/assets/genset-BRgqR1AT.js +1 -0
  48. package/console-dist/assets/{get-error-message-eGdenTLv.js → get-error-message-dM0BMfdP.js} +1 -1
  49. package/console-dist/assets/index-CrLa65Ur.css +2 -0
  50. package/console-dist/assets/index-CvuwOe37.js +12 -0
  51. package/console-dist/assets/{integration-api-Bg7D1eQc.js → integration-api-D2tA69Yb.js} +1 -1
  52. package/console-dist/assets/integrations-BLG4PT3c.js +1 -0
  53. package/console-dist/assets/integrations-iAjWxaDS.js +1 -0
  54. package/console-dist/assets/{label-DWyy9MeT.js → label-2sIXTEUK.js} +1 -1
  55. package/console-dist/assets/loader-circle-DjgHgHHl.js +1 -0
  56. package/console-dist/assets/{login-BZKYK0yZ.js → login-DpNKicxy.js} +1 -1
  57. package/console-dist/assets/minus-CaT9UaQx.js +1 -0
  58. package/console-dist/assets/model-schemas-3w38IPdc.js +1 -0
  59. package/console-dist/assets/models-CMN9Eppf.js +1 -0
  60. package/console-dist/assets/models-I_V8J5Y0.js +1 -0
  61. package/console-dist/assets/not-found-C4YVKP97.js +1 -0
  62. package/console-dist/assets/pause-CqW7v5Dc.js +1 -0
  63. package/console-dist/assets/pharma-cleanroom-ClJRwROz.js +1 -0
  64. package/console-dist/assets/play-kg50os4l.js +1 -0
  65. package/console-dist/assets/plus-Cl4Ay5Ry.js +1 -0
  66. package/console-dist/assets/protocol-card-ARSwIjkN.js +1 -0
  67. package/console-dist/assets/proxy-CWZabK8f.js +1 -0
  68. package/console-dist/assets/query-fetch-error-CWLZA2L5.js +1 -0
  69. package/console-dist/assets/{radio-DRkzblxj.js → radio-BxpVYiyS.js} +1 -1
  70. package/console-dist/assets/registry-Dau_GjK6.js +2 -0
  71. package/console-dist/assets/{rocket-807Pf7C1.js → rocket-KZ5oHK1G.js} +1 -1
  72. package/console-dist/assets/rtu-D-1lltcO.js +1 -0
  73. package/console-dist/assets/select-BWlrSYlA.js +1 -0
  74. package/console-dist/assets/{select-display-items-D-L3PesO.js → select-display-items-DN2G8DNG.js} +1 -1
  75. package/console-dist/assets/{server-CS2Tw__K.js → server-BVem_egD.js} +1 -1
  76. package/console-dist/assets/sliders-horizontal-BNKmYQgd.js +1 -0
  77. package/console-dist/assets/smart-factory-cem4tLAv.js +1 -0
  78. package/console-dist/assets/{source-host-miravo-D_AecPVc.js → source-host-miravo-B8eM2IHw.js} +1 -1
  79. package/console-dist/assets/stages-hidkaJPI.js +1 -0
  80. package/console-dist/assets/status-CZFZLqVk.js +1 -0
  81. package/console-dist/assets/tabs-BbQkzBZZ.js +1 -0
  82. package/console-dist/assets/tags-BBz30-eV.js +4 -0
  83. package/console-dist/assets/tags-K96jT8PY.js +1 -0
  84. package/console-dist/assets/tank-THHXGdzg.js +1 -0
  85. package/console-dist/assets/tooltip-B3vOB1Vu.js +1 -0
  86. package/console-dist/assets/{transition-nav-link-cn4KZD6W.js → transition-nav-link-B11-gXld.js} +1 -1
  87. package/console-dist/assets/{trash-2-BJ-1df0F.js → trash-2-BH9HDsZv.js} +1 -1
  88. package/console-dist/assets/{triangle-alert-D1AraFcP.js → triangle-alert-DoAwrRgk.js} +1 -1
  89. package/console-dist/assets/use-engine-command-mutation-CHqjOqfS.js +1 -0
  90. package/console-dist/assets/use-transition-navigate-B-nk4aWh.js +2 -0
  91. package/console-dist/assets/useQuery-M9KTdi7Q.js +1 -0
  92. package/console-dist/assets/validation-BkfmaBBi.js +1 -0
  93. package/console-dist/assets/water-treatment-CfVR0p0L.js +1 -0
  94. package/console-dist/index.html +68 -54
  95. package/miravo +2 -2
  96. package/package.json +1 -1
  97. package/console-dist/assets/api-DybIIqOe.js +0 -1
  98. package/console-dist/assets/asset-detail-tmOrYE8x.js +0 -1
  99. package/console-dist/assets/badge-D4jktT8T.js +0 -1
  100. package/console-dist/assets/catalog-DN-klsod.js +0 -1
  101. package/console-dist/assets/catalog-M-k7Y9Sp.js +0 -1
  102. package/console-dist/assets/catalog-template-icons-C7KJdJJX.js +0 -1
  103. package/console-dist/assets/checkbox-AaJhjtZk.js +0 -1
  104. package/console-dist/assets/chevron-down-CAk5w9Wt.js +0 -1
  105. package/console-dist/assets/chevron-right-BfZjrUWh.js +0 -1
  106. package/console-dist/assets/combobox-BFEY6lgO.js +0 -1
  107. package/console-dist/assets/control-CD9UoTvu.js +0 -1
  108. package/console-dist/assets/control-DHa2-a2v.js +0 -1
  109. package/console-dist/assets/copy-button-DHm7RGJ5.js +0 -1
  110. package/console-dist/assets/events-D19CzgoQ.js +0 -1
  111. package/console-dist/assets/events-DmftG8n5.js +0 -1
  112. package/console-dist/assets/export-tab-ouFgYEU_.js +0 -1
  113. package/console-dist/assets/factory-CT2VYi0n.js +0 -1
  114. package/console-dist/assets/factory-DSrBtcG2.js +0 -1
  115. package/console-dist/assets/format-OUFL_tef.js +0 -1
  116. package/console-dist/assets/index-DuJJSpJp.js +0 -12
  117. package/console-dist/assets/index-iEV9hU2I.css +0 -2
  118. package/console-dist/assets/integrations-DWW9HjH0.js +0 -1
  119. package/console-dist/assets/integrations-DoXNrzD5.js +0 -1
  120. package/console-dist/assets/models-CrDBHBV5.js +0 -1
  121. package/console-dist/assets/models-jBVcY8Xd.js +0 -1
  122. package/console-dist/assets/not-found-BqVny4Md.js +0 -1
  123. package/console-dist/assets/play-TTg_EXSa.js +0 -1
  124. package/console-dist/assets/plus-BbVbvFTe.js +0 -1
  125. package/console-dist/assets/protocol-card-B2SpAJKe.js +0 -1
  126. package/console-dist/assets/query-fetch-error-C2Ec4RQS.js +0 -1
  127. package/console-dist/assets/select-Bg6PPro0.js +0 -1
  128. package/console-dist/assets/tabs-bI9sskHy.js +0 -1
  129. package/console-dist/assets/tags-B7e7VYVW.js +0 -1
  130. package/console-dist/assets/tags-DJJKQRZZ.js +0 -4
  131. package/console-dist/assets/use-engine-command-mutation-DMkQxmt9.js +0 -1
  132. package/console-dist/assets/use-transition-navigate-BiV2QCcA.js +0 -2
  133. package/console-dist/assets/validation-q38DYDwu.js +0 -1
  134. /package/console-dist/assets/{chunk-OE4NN4TA-Q4iNR9l9.js → chunk-OE4NN4TA-DBWZidbW.js} +0 -0
  135. /package/console-dist/assets/{dist-CtuJWBnP.js → dist-xY0pK9Wy.js} +0 -0
  136. /package/console-dist/assets/{integration-targets-BehiqWyT.js → integration-targets-Byvdd3Or.js} +0 -0
  137. /package/console-dist/assets/{runtime-link-ChF8TM68.js → runtime-link-vBANRqcD.js} +0 -0
  138. /package/console-dist/assets/{transition-types-049V0Kr0.js → transition-types-BKZuWApE.js} +0 -0
  139. /package/console-dist/assets/{utils-BO2u-wC_.js → utils-XFKvwlFT.js} +0 -0
  140. /package/console-dist/assets/{vendor-table-Br-cHaxY.js → vendor-table-B0Z9e_sn.js} +0 -0
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{$ as n,J as r,Q as i,X as a,Y as o,Z as s,et as c,ot as ee,st as l}from"./vendor-ui-D8j69UH4.js";import{C as u,T as d}from"./format-OUFL_tef.js";import{t as f}from"./utils-BO2u-wC_.js";var p=e(t(),1),te=e(l(),1);function m(e){if(!e||typeof document>`u`)return;let t=document.head||document.getElementsByTagName(`head`)[0],n=document.createElement(`style`);n.type=`text/css`,t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}var ne=e=>{switch(e){case`success`:return _;case`info`:return y;case`warning`:return v;case`error`:return b;default:return null}},h=Array(12).fill(0),g=({visible:e,className:t})=>p.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},p.createElement(`div`,{className:`sonner-spinner`},h.map((e,t)=>p.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),_=p.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},p.createElement(`path`,{fillRule:`evenodd`,d:`M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z`,clipRule:`evenodd`})),v=p.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,height:`20`,width:`20`},p.createElement(`path`,{fillRule:`evenodd`,d:`M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z`,clipRule:`evenodd`})),y=p.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},p.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z`,clipRule:`evenodd`})),b=p.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},p.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z`,clipRule:`evenodd`})),x=p.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`},p.createElement(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),p.createElement(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})),S=()=>{let[e,t]=p.useState(document.hidden);return p.useEffect(()=>{let e=()=>{t(document.hidden)};return document.addEventListener(`visibilitychange`,e),()=>window.removeEventListener(`visibilitychange`,e)},[]),e},C=1,w=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{let{message:t,...n}=e,r=typeof e?.id==`number`||e.id?.length>0?e.id:C++,i=this.toasts.find(e=>e.id===r),a=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(r)&&this.dismissedToasts.delete(r),i?this.toasts=this.toasts.map(n=>n.id===r?(this.publish({...n,...e,id:r,title:t}),{...n,...e,id:r,dismissible:a,title:t}):n):this.addToast({title:t,...n,dismissible:a,id:r}),r},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(t=>t({id:e,dismiss:!0})))):this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:`error`}),this.success=(e,t)=>this.create({...t,type:`success`,message:e}),this.info=(e,t)=>this.create({...t,type:`info`,message:e}),this.warning=(e,t)=>this.create({...t,type:`warning`,message:e}),this.loading=(e,t)=>this.create({...t,type:`loading`,message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:`loading`,message:t.loading,description:typeof t.description==`function`?void 0:t.description}));let r=Promise.resolve(e instanceof Function?e():e),i=n!==void 0,a,o=r.then(async e=>{if(a=[`resolve`,e],p.isValidElement(e))i=!1,this.create({id:n,type:`default`,message:e});else if(E(e)&&!e.ok){i=!1;let r=typeof t.error==`function`?await t.error(`HTTP error! status: ${e.status}`):t.error,a=typeof t.description==`function`?await t.description(`HTTP error! status: ${e.status}`):t.description,o=typeof r==`object`&&!p.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(e instanceof Error){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!p.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(t.success!==void 0){i=!1;let r=typeof t.success==`function`?await t.success(e):t.success,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!p.isValidElement(r)?r:{message:r};this.create({id:n,type:`success`,description:a,...o})}}).catch(async e=>{if(a=[`reject`,e],t.error!==void 0){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!p.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}}).finally(()=>{i&&(this.dismiss(n),n=void 0),t.finally==null||t.finally.call(t)}),s=()=>new Promise((e,t)=>o.then(()=>a[0]===`reject`?t(a[1]):e(a[1])).catch(t));return typeof n!=`string`&&typeof n!=`number`?{unwrap:s}:Object.assign(n,{unwrap:s})},this.custom=(e,t)=>{let n=t?.id||C++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},T=(e,t)=>{let n=t?.id||C++;return w.addToast({title:e,...t,id:n}),n},E=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,D=Object.assign(T,{success:w.success,info:w.info,warning:w.warning,error:w.error,custom:w.custom,message:w.message,promise:w.promise,dismiss:w.dismiss,loading:w.loading},{getHistory:()=>w.toasts,getToasts:()=>w.getActiveToasts()});m(`[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}`);function O(e){return e.label!==void 0}var k=3,A=`24px`,j=`16px`,M=4e3,re=356,N=14,P=45,F=200;function I(...e){return e.filter(Boolean).join(` `)}function L(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}var ie=e=>{let{invert:t,toast:n,unstyled:r,interacting:i,setHeights:a,visibleToasts:o,heights:s,index:c,toasts:ee,expanded:l,removeToast:u,defaultRichColors:d,closeButton:f,style:te,cancelButtonStyle:m,actionButtonStyle:h,className:_=``,descriptionClassName:v=``,duration:y,position:b,gap:C,expandByDefault:w,classNames:T,icons:E,closeButtonAriaLabel:D=`Close toast`}=e,[k,A]=p.useState(null),[j,re]=p.useState(null),[N,ie]=p.useState(!1),[R,ae]=p.useState(!1),[z,B]=p.useState(!1),[V,oe]=p.useState(!1),[se,H]=p.useState(!1),[ce,U]=p.useState(0),[le,W]=p.useState(0),G=p.useRef(n.duration||y||M),ue=p.useRef(null),K=p.useRef(null),de=c===0,fe=c+1<=o,q=n.type,J=n.dismissible!==!1,pe=n.className||``,me=n.descriptionClassName||``,Y=p.useMemo(()=>s.findIndex(e=>e.toastId===n.id)||0,[s,n.id]),he=p.useMemo(()=>n.closeButton??f,[n.closeButton,f]),ge=p.useMemo(()=>n.duration||y||M,[n.duration,y]),X=p.useRef(0),Z=p.useRef(0),_e=p.useRef(0),Q=p.useRef(null),[ve,ye]=b.split(`-`),be=p.useMemo(()=>s.reduce((e,t,n)=>n>=Y?e:e+t.height,0),[s,Y]),xe=S(),Se=n.invert||t,Ce=q===`loading`;Z.current=p.useMemo(()=>Y*C+be,[Y,be]),p.useEffect(()=>{G.current=ge},[ge]),p.useEffect(()=>{ie(!0)},[]),p.useEffect(()=>{let e=K.current;if(e){let t=e.getBoundingClientRect().height;return W(t),a(e=>[{toastId:n.id,height:t,position:n.position},...e]),()=>a(e=>e.filter(e=>e.toastId!==n.id))}},[a,n.id]),p.useLayoutEffect(()=>{if(!N)return;let e=K.current,t=e.style.height;e.style.height=`auto`;let r=e.getBoundingClientRect().height;e.style.height=t,W(r),a(e=>e.find(e=>e.toastId===n.id)?e.map(e=>e.toastId===n.id?{...e,height:r}:e):[{toastId:n.id,height:r,position:n.position},...e])},[N,n.title,n.description,a,n.id,n.jsx,n.action,n.cancel]);let $=p.useCallback(()=>{ae(!0),U(Z.current),a(e=>e.filter(e=>e.toastId!==n.id)),setTimeout(()=>{u(n)},F)},[n,u,a,Z]);p.useEffect(()=>{if(n.promise&&q===`loading`||n.duration===1/0||n.type===`loading`)return;let e;return l||i||xe?(()=>{if(_e.current<X.current){let e=new Date().getTime()-X.current;G.current-=e}_e.current=new Date().getTime()})():G.current!==1/0&&(X.current=new Date().getTime(),e=setTimeout(()=>{n.onAutoClose==null||n.onAutoClose.call(n,n),$()},G.current)),()=>clearTimeout(e)},[l,i,n,q,xe,$]),p.useEffect(()=>{n.delete&&($(),n.onDismiss==null||n.onDismiss.call(n,n))},[$,n.delete]);function we(){return E?.loading?p.createElement(`div`,{className:I(T?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":q===`loading`},E.loading):p.createElement(g,{className:I(T?.loader,n?.classNames?.loader),visible:q===`loading`})}let Te=n.icon||E?.[q]||ne(q);return p.createElement(`li`,{tabIndex:0,ref:K,className:I(_,pe,T?.toast,n?.classNames?.toast,T?.default,T?.[q],n?.classNames?.[q]),"data-sonner-toast":``,"data-rich-colors":n.richColors??d,"data-styled":!(n.jsx||n.unstyled||r),"data-mounted":N,"data-promise":!!n.promise,"data-swiped":se,"data-removed":R,"data-visible":fe,"data-y-position":ve,"data-x-position":ye,"data-index":c,"data-front":de,"data-swiping":z,"data-dismissible":J,"data-type":q,"data-invert":Se,"data-swipe-out":V,"data-swipe-direction":j,"data-expanded":!!(l||w&&N),"data-testid":n.testId,style:{"--index":c,"--toasts-before":c,"--z-index":ee.length-c,"--offset":`${R?ce:Z.current}px`,"--initial-height":w?`auto`:`${le}px`,...te,...n.style},onDragEnd:()=>{B(!1),A(null),Q.current=null},onPointerDown:e=>{e.button!==2&&(Ce||!J||(ue.current=new Date,U(Z.current),e.target.setPointerCapture(e.pointerId),e.target.tagName!==`BUTTON`&&(B(!0),Q.current={x:e.clientX,y:e.clientY})))},onPointerUp:()=>{if(V||!J)return;Q.current=null;let e=Number(K.current?.style.getPropertyValue(`--swipe-amount-x`).replace(`px`,``)||0),t=Number(K.current?.style.getPropertyValue(`--swipe-amount-y`).replace(`px`,``)||0),r=new Date().getTime()-ue.current?.getTime(),i=k===`x`?e:t,a=Math.abs(i)/r;if(Math.abs(i)>=P||a>.11){U(Z.current),n.onDismiss==null||n.onDismiss.call(n,n),re(k===`x`?e>0?`right`:`left`:t>0?`down`:`up`),$(),oe(!0);return}else{var o,s;(o=K.current)==null||o.style.setProperty(`--swipe-amount-x`,`0px`),(s=K.current)==null||s.style.setProperty(`--swipe-amount-y`,`0px`)}H(!1),B(!1),A(null)},onPointerMove:t=>{var n,r;if(!Q.current||!J||window.getSelection()?.toString().length>0)return;let i=t.clientY-Q.current.y,a=t.clientX-Q.current.x,o=e.swipeDirections??L(b);!k&&(Math.abs(a)>1||Math.abs(i)>1)&&A(Math.abs(a)>Math.abs(i)?`x`:`y`);let s={x:0,y:0},c=e=>1/(1.5+Math.abs(e)/20);if(k===`y`){if(o.includes(`top`)||o.includes(`bottom`))if(o.includes(`top`)&&i<0||o.includes(`bottom`)&&i>0)s.y=i;else{let e=i*c(i);s.y=Math.abs(e)<Math.abs(i)?e:i}}else if(k===`x`&&(o.includes(`left`)||o.includes(`right`)))if(o.includes(`left`)&&a<0||o.includes(`right`)&&a>0)s.x=a;else{let e=a*c(a);s.x=Math.abs(e)<Math.abs(a)?e:a}(Math.abs(s.x)>0||Math.abs(s.y)>0)&&H(!0),(n=K.current)==null||n.style.setProperty(`--swipe-amount-x`,`${s.x}px`),(r=K.current)==null||r.style.setProperty(`--swipe-amount-y`,`${s.y}px`)}},he&&!n.jsx&&q!==`loading`?p.createElement(`button`,{"aria-label":D,"data-disabled":Ce,"data-close-button":!0,onClick:Ce||!J?()=>{}:()=>{$(),n.onDismiss==null||n.onDismiss.call(n,n)},className:I(T?.closeButton,n?.classNames?.closeButton)},E?.close??x):null,(q||n.icon||n.promise)&&n.icon!==null&&(E?.[q]!==null||n.icon)?p.createElement(`div`,{"data-icon":``,className:I(T?.icon,n?.classNames?.icon)},n.promise||n.type===`loading`&&!n.icon?n.icon||we():null,n.type===`loading`?null:Te):null,p.createElement(`div`,{"data-content":``,className:I(T?.content,n?.classNames?.content)},p.createElement(`div`,{"data-title":``,className:I(T?.title,n?.classNames?.title)},n.jsx?n.jsx:typeof n.title==`function`?n.title():n.title),n.description?p.createElement(`div`,{"data-description":``,className:I(v,me,T?.description,n?.classNames?.description)},typeof n.description==`function`?n.description():n.description):null),p.isValidElement(n.cancel)?n.cancel:n.cancel&&O(n.cancel)?p.createElement(`button`,{"data-button":!0,"data-cancel":!0,style:n.cancelButtonStyle||m,onClick:e=>{O(n.cancel)&&J&&(n.cancel.onClick==null||n.cancel.onClick.call(n.cancel,e),$())},className:I(T?.cancelButton,n?.classNames?.cancelButton)},n.cancel.label):null,p.isValidElement(n.action)?n.action:n.action&&O(n.action)?p.createElement(`button`,{"data-button":!0,"data-action":!0,style:n.actionButtonStyle||h,onClick:e=>{O(n.action)&&(n.action.onClick==null||n.action.onClick.call(n.action,e),!e.defaultPrevented&&$())},className:I(T?.actionButton,n?.classNames?.actionButton)},n.action.label):null)};function R(){if(typeof window>`u`||typeof document>`u`)return`ltr`;let e=document.documentElement.getAttribute(`dir`);return e===`auto`||!e?window.getComputedStyle(document.documentElement).direction:e}function ae(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?j:A;function o(e){[`top`,`right`,`bottom`,`left`].forEach(t=>{n[`${i}-${t}`]=typeof e==`number`?`${e}px`:e})}typeof e==`number`||typeof e==`string`?o(e):typeof e==`object`?[`top`,`right`,`bottom`,`left`].forEach(t=>{e[t]===void 0?n[`${i}-${t}`]=a:n[`${i}-${t}`]=typeof e[t]==`number`?`${e[t]}px`:e[t]}):o(a)}),n}var z=p.forwardRef(function(e,t){let{id:n,invert:r,position:i=`bottom-right`,hotkey:a=[`altKey`,`KeyT`],expand:o,closeButton:s,className:c,offset:ee,mobileOffset:l,theme:u=`light`,richColors:d,duration:f,style:m,visibleToasts:ne=k,toastOptions:h,dir:g=R(),gap:_=N,icons:v,containerAriaLabel:y=`Notifications`}=e,[b,x]=p.useState([]),S=p.useMemo(()=>n?b.filter(e=>e.toasterId===n):b.filter(e=>!e.toasterId),[b,n]),C=p.useMemo(()=>Array.from(new Set([i].concat(S.filter(e=>e.position).map(e=>e.position)))),[S,i]),[T,E]=p.useState([]),[D,O]=p.useState(!1),[A,j]=p.useState(!1),[M,P]=p.useState(u===`system`?typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:u),F=p.useRef(null),I=a.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),L=p.useRef(null),z=p.useRef(!1),B=p.useCallback(e=>{x(t=>(t.find(t=>t.id===e.id)?.delete||w.dismiss(e.id),t.filter(({id:t})=>t!==e.id)))},[]);return p.useEffect(()=>w.subscribe(e=>{if(e.dismiss){requestAnimationFrame(()=>{x(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))});return}setTimeout(()=>{te.flushSync(()=>{x(t=>{let n=t.findIndex(t=>t.id===e.id);return n===-1?[e,...t]:[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]})})})}),[b]),p.useEffect(()=>{if(u!==`system`){P(u);return}if(u===`system`&&(window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?P(`dark`):P(`light`)),typeof window>`u`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`);try{e.addEventListener(`change`,({matches:e})=>{P(e?`dark`:`light`)})}catch{e.addListener(({matches:e})=>{try{P(e?`dark`:`light`)}catch(e){console.error(e)}})}},[u]),p.useEffect(()=>{b.length<=1&&O(!1)},[b]),p.useEffect(()=>{let e=e=>{if(a.every(t=>e[t]||e.code===t)){var t;O(!0),(t=F.current)==null||t.focus()}e.code===`Escape`&&(document.activeElement===F.current||F.current?.contains(document.activeElement))&&O(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[a]),p.useEffect(()=>{if(F.current)return()=>{L.current&&(L.current.focus({preventScroll:!0}),L.current=null,z.current=!1)}},[F.current]),p.createElement(`section`,{ref:t,"aria-label":`${y} ${I}`,tabIndex:-1,"aria-live":`polite`,"aria-relevant":`additions text`,"aria-atomic":`false`,suppressHydrationWarning:!0},C.map((t,n)=>{let[i,a]=t.split(`-`);return S.length?p.createElement(`ol`,{key:t,dir:g===`auto`?R():g,tabIndex:-1,ref:F,className:c,"data-sonner-toaster":!0,"data-sonner-theme":M,"data-y-position":i,"data-x-position":a,style:{"--front-toast-height":`${T[0]?.height||0}px`,"--width":`${re}px`,"--gap":`${_}px`,...m,...ae(ee,l)},onBlur:e=>{z.current&&!e.currentTarget.contains(e.relatedTarget)&&(z.current=!1,L.current&&=(L.current.focus({preventScroll:!0}),null))},onFocus:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||z.current||(z.current=!0,L.current=e.relatedTarget)},onMouseEnter:()=>O(!0),onMouseMove:()=>O(!0),onMouseLeave:()=>{A||O(!1)},onDragEnd:()=>O(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||j(!0)},onPointerUp:()=>j(!1)},S.filter(e=>!e.position&&n===0||e.position===t).map((n,i)=>p.createElement(ie,{key:n.id,icons:v,index:i,toast:n,defaultRichColors:d,duration:h?.duration??f,className:h?.className,descriptionClassName:h?.descriptionClassName,invert:r,visibleToasts:ne,closeButton:h?.closeButton??s,interacting:A,position:t,style:h?.style,unstyled:h?.unstyled,classNames:h?.classNames,cancelButtonStyle:h?.cancelButtonStyle,actionButtonStyle:h?.actionButtonStyle,closeButtonAriaLabel:h?.closeButtonAriaLabel,removeToast:B,toasts:S.filter(e=>e.position==n.position),heights:T.filter(e=>e.position==n.position),setHeights:E,expandByDefault:o,gap:_,expanded:D,swipeDirections:e.swipeDirections}))):null}))}),B=ee();function V({...e}){return(0,B.jsx)(o,{"data-slot":`dialog`,...e})}function oe({...e}){return(0,B.jsx)(a,{"data-slot":`dialog-portal`,...e})}function se({className:e,...t}){return(0,B.jsx)(c,{"data-slot":`dialog-overlay`,className:f(`fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function H({className:e,children:t,showCloseButton:r=!0,...i}){return(0,B.jsxs)(oe,{children:[(0,B.jsx)(se,{}),(0,B.jsxs)(s,{"data-slot":`dialog-content`,className:f(`fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-[var(--miravo-radius-stadium-sm)] bg-background p-4 text-sm ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm 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),...i,children:[t,r&&(0,B.jsxs)(n,{"data-slot":`dialog-close`,render:(0,B.jsx)(u,{variant:`ghost`,className:`absolute top-2 right-2`,size:`icon-sm`}),children:[(0,B.jsx)(d,{}),(0,B.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function ce({className:e,...t}){return(0,B.jsx)(`div`,{"data-slot":`dialog-header`,className:f(`flex flex-col gap-2`,e),...t})}function U({className:e,showCloseButton:t=!1,children:r,...i}){return(0,B.jsxs)(`div`,{"data-slot":`dialog-footer`,className:f(`-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-[var(--miravo-radius-stadium-sm)] border-t p-4 sm:flex-row sm:justify-end`,e),...i,children:[r,t&&(0,B.jsx)(n,{render:(0,B.jsx)(u,{variant:`outline`}),children:`Close`})]})}function le({className:e,...t}){return(0,B.jsx)(r,{"data-slot":`dialog-title`,className:f(`text-base leading-none font-medium`,e),...t})}function W({className:e,...t}){return(0,B.jsx)(i,{"data-slot":`dialog-description`,className:f(`text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}export{ce as a,D as c,U as i,H as n,le as o,W as r,z as s,V as t};
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{$ as n,J as r,Q as i,X as a,Y as o,Z as s,et as c,ot as ee,st as l}from"./vendor-ui-D8j69UH4.js";import{C as u,T as d}from"./format-Bx7DF-TB.js";import{t as f}from"./utils-XFKvwlFT.js";var p=e(t(),1),te=e(l(),1);function m(e){if(!e||typeof document>`u`)return;let t=document.head||document.getElementsByTagName(`head`)[0],n=document.createElement(`style`);n.type=`text/css`,t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}var ne=e=>{switch(e){case`success`:return _;case`info`:return y;case`warning`:return v;case`error`:return b;default:return null}},h=Array(12).fill(0),g=({visible:e,className:t})=>p.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},p.createElement(`div`,{className:`sonner-spinner`},h.map((e,t)=>p.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),_=p.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},p.createElement(`path`,{fillRule:`evenodd`,d:`M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z`,clipRule:`evenodd`})),v=p.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,height:`20`,width:`20`},p.createElement(`path`,{fillRule:`evenodd`,d:`M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z`,clipRule:`evenodd`})),y=p.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},p.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z`,clipRule:`evenodd`})),b=p.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},p.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z`,clipRule:`evenodd`})),x=p.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`},p.createElement(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),p.createElement(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})),S=()=>{let[e,t]=p.useState(document.hidden);return p.useEffect(()=>{let e=()=>{t(document.hidden)};return document.addEventListener(`visibilitychange`,e),()=>window.removeEventListener(`visibilitychange`,e)},[]),e},C=1,w=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{let{message:t,...n}=e,r=typeof e?.id==`number`||e.id?.length>0?e.id:C++,i=this.toasts.find(e=>e.id===r),a=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(r)&&this.dismissedToasts.delete(r),i?this.toasts=this.toasts.map(n=>n.id===r?(this.publish({...n,...e,id:r,title:t}),{...n,...e,id:r,dismissible:a,title:t}):n):this.addToast({title:t,...n,dismissible:a,id:r}),r},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(t=>t({id:e,dismiss:!0})))):this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:`error`}),this.success=(e,t)=>this.create({...t,type:`success`,message:e}),this.info=(e,t)=>this.create({...t,type:`info`,message:e}),this.warning=(e,t)=>this.create({...t,type:`warning`,message:e}),this.loading=(e,t)=>this.create({...t,type:`loading`,message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:`loading`,message:t.loading,description:typeof t.description==`function`?void 0:t.description}));let r=Promise.resolve(e instanceof Function?e():e),i=n!==void 0,a,o=r.then(async e=>{if(a=[`resolve`,e],p.isValidElement(e))i=!1,this.create({id:n,type:`default`,message:e});else if(E(e)&&!e.ok){i=!1;let r=typeof t.error==`function`?await t.error(`HTTP error! status: ${e.status}`):t.error,a=typeof t.description==`function`?await t.description(`HTTP error! status: ${e.status}`):t.description,o=typeof r==`object`&&!p.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(e instanceof Error){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!p.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(t.success!==void 0){i=!1;let r=typeof t.success==`function`?await t.success(e):t.success,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!p.isValidElement(r)?r:{message:r};this.create({id:n,type:`success`,description:a,...o})}}).catch(async e=>{if(a=[`reject`,e],t.error!==void 0){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!p.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}}).finally(()=>{i&&(this.dismiss(n),n=void 0),t.finally==null||t.finally.call(t)}),s=()=>new Promise((e,t)=>o.then(()=>a[0]===`reject`?t(a[1]):e(a[1])).catch(t));return typeof n!=`string`&&typeof n!=`number`?{unwrap:s}:Object.assign(n,{unwrap:s})},this.custom=(e,t)=>{let n=t?.id||C++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},T=(e,t)=>{let n=t?.id||C++;return w.addToast({title:e,...t,id:n}),n},E=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,D=Object.assign(T,{success:w.success,info:w.info,warning:w.warning,error:w.error,custom:w.custom,message:w.message,promise:w.promise,dismiss:w.dismiss,loading:w.loading},{getHistory:()=>w.toasts,getToasts:()=>w.getActiveToasts()});m(`[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}`);function O(e){return e.label!==void 0}var k=3,A=`24px`,j=`16px`,M=4e3,re=356,N=14,P=45,F=200;function I(...e){return e.filter(Boolean).join(` `)}function L(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}var ie=e=>{let{invert:t,toast:n,unstyled:r,interacting:i,setHeights:a,visibleToasts:o,heights:s,index:c,toasts:ee,expanded:l,removeToast:u,defaultRichColors:d,closeButton:f,style:te,cancelButtonStyle:m,actionButtonStyle:h,className:_=``,descriptionClassName:v=``,duration:y,position:b,gap:C,expandByDefault:w,classNames:T,icons:E,closeButtonAriaLabel:D=`Close toast`}=e,[k,A]=p.useState(null),[j,re]=p.useState(null),[N,ie]=p.useState(!1),[R,ae]=p.useState(!1),[z,B]=p.useState(!1),[V,oe]=p.useState(!1),[se,H]=p.useState(!1),[ce,U]=p.useState(0),[le,W]=p.useState(0),G=p.useRef(n.duration||y||M),ue=p.useRef(null),K=p.useRef(null),de=c===0,fe=c+1<=o,q=n.type,J=n.dismissible!==!1,pe=n.className||``,me=n.descriptionClassName||``,Y=p.useMemo(()=>s.findIndex(e=>e.toastId===n.id)||0,[s,n.id]),he=p.useMemo(()=>n.closeButton??f,[n.closeButton,f]),ge=p.useMemo(()=>n.duration||y||M,[n.duration,y]),X=p.useRef(0),Z=p.useRef(0),_e=p.useRef(0),Q=p.useRef(null),[ve,ye]=b.split(`-`),be=p.useMemo(()=>s.reduce((e,t,n)=>n>=Y?e:e+t.height,0),[s,Y]),xe=S(),Se=n.invert||t,Ce=q===`loading`;Z.current=p.useMemo(()=>Y*C+be,[Y,be]),p.useEffect(()=>{G.current=ge},[ge]),p.useEffect(()=>{ie(!0)},[]),p.useEffect(()=>{let e=K.current;if(e){let t=e.getBoundingClientRect().height;return W(t),a(e=>[{toastId:n.id,height:t,position:n.position},...e]),()=>a(e=>e.filter(e=>e.toastId!==n.id))}},[a,n.id]),p.useLayoutEffect(()=>{if(!N)return;let e=K.current,t=e.style.height;e.style.height=`auto`;let r=e.getBoundingClientRect().height;e.style.height=t,W(r),a(e=>e.find(e=>e.toastId===n.id)?e.map(e=>e.toastId===n.id?{...e,height:r}:e):[{toastId:n.id,height:r,position:n.position},...e])},[N,n.title,n.description,a,n.id,n.jsx,n.action,n.cancel]);let $=p.useCallback(()=>{ae(!0),U(Z.current),a(e=>e.filter(e=>e.toastId!==n.id)),setTimeout(()=>{u(n)},F)},[n,u,a,Z]);p.useEffect(()=>{if(n.promise&&q===`loading`||n.duration===1/0||n.type===`loading`)return;let e;return l||i||xe?(()=>{if(_e.current<X.current){let e=new Date().getTime()-X.current;G.current-=e}_e.current=new Date().getTime()})():G.current!==1/0&&(X.current=new Date().getTime(),e=setTimeout(()=>{n.onAutoClose==null||n.onAutoClose.call(n,n),$()},G.current)),()=>clearTimeout(e)},[l,i,n,q,xe,$]),p.useEffect(()=>{n.delete&&($(),n.onDismiss==null||n.onDismiss.call(n,n))},[$,n.delete]);function we(){return E?.loading?p.createElement(`div`,{className:I(T?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":q===`loading`},E.loading):p.createElement(g,{className:I(T?.loader,n?.classNames?.loader),visible:q===`loading`})}let Te=n.icon||E?.[q]||ne(q);return p.createElement(`li`,{tabIndex:0,ref:K,className:I(_,pe,T?.toast,n?.classNames?.toast,T?.default,T?.[q],n?.classNames?.[q]),"data-sonner-toast":``,"data-rich-colors":n.richColors??d,"data-styled":!(n.jsx||n.unstyled||r),"data-mounted":N,"data-promise":!!n.promise,"data-swiped":se,"data-removed":R,"data-visible":fe,"data-y-position":ve,"data-x-position":ye,"data-index":c,"data-front":de,"data-swiping":z,"data-dismissible":J,"data-type":q,"data-invert":Se,"data-swipe-out":V,"data-swipe-direction":j,"data-expanded":!!(l||w&&N),"data-testid":n.testId,style:{"--index":c,"--toasts-before":c,"--z-index":ee.length-c,"--offset":`${R?ce:Z.current}px`,"--initial-height":w?`auto`:`${le}px`,...te,...n.style},onDragEnd:()=>{B(!1),A(null),Q.current=null},onPointerDown:e=>{e.button!==2&&(Ce||!J||(ue.current=new Date,U(Z.current),e.target.setPointerCapture(e.pointerId),e.target.tagName!==`BUTTON`&&(B(!0),Q.current={x:e.clientX,y:e.clientY})))},onPointerUp:()=>{if(V||!J)return;Q.current=null;let e=Number(K.current?.style.getPropertyValue(`--swipe-amount-x`).replace(`px`,``)||0),t=Number(K.current?.style.getPropertyValue(`--swipe-amount-y`).replace(`px`,``)||0),r=new Date().getTime()-ue.current?.getTime(),i=k===`x`?e:t,a=Math.abs(i)/r;if(Math.abs(i)>=P||a>.11){U(Z.current),n.onDismiss==null||n.onDismiss.call(n,n),re(k===`x`?e>0?`right`:`left`:t>0?`down`:`up`),$(),oe(!0);return}else{var o,s;(o=K.current)==null||o.style.setProperty(`--swipe-amount-x`,`0px`),(s=K.current)==null||s.style.setProperty(`--swipe-amount-y`,`0px`)}H(!1),B(!1),A(null)},onPointerMove:t=>{var n,r;if(!Q.current||!J||window.getSelection()?.toString().length>0)return;let i=t.clientY-Q.current.y,a=t.clientX-Q.current.x,o=e.swipeDirections??L(b);!k&&(Math.abs(a)>1||Math.abs(i)>1)&&A(Math.abs(a)>Math.abs(i)?`x`:`y`);let s={x:0,y:0},c=e=>1/(1.5+Math.abs(e)/20);if(k===`y`){if(o.includes(`top`)||o.includes(`bottom`))if(o.includes(`top`)&&i<0||o.includes(`bottom`)&&i>0)s.y=i;else{let e=i*c(i);s.y=Math.abs(e)<Math.abs(i)?e:i}}else if(k===`x`&&(o.includes(`left`)||o.includes(`right`)))if(o.includes(`left`)&&a<0||o.includes(`right`)&&a>0)s.x=a;else{let e=a*c(a);s.x=Math.abs(e)<Math.abs(a)?e:a}(Math.abs(s.x)>0||Math.abs(s.y)>0)&&H(!0),(n=K.current)==null||n.style.setProperty(`--swipe-amount-x`,`${s.x}px`),(r=K.current)==null||r.style.setProperty(`--swipe-amount-y`,`${s.y}px`)}},he&&!n.jsx&&q!==`loading`?p.createElement(`button`,{"aria-label":D,"data-disabled":Ce,"data-close-button":!0,onClick:Ce||!J?()=>{}:()=>{$(),n.onDismiss==null||n.onDismiss.call(n,n)},className:I(T?.closeButton,n?.classNames?.closeButton)},E?.close??x):null,(q||n.icon||n.promise)&&n.icon!==null&&(E?.[q]!==null||n.icon)?p.createElement(`div`,{"data-icon":``,className:I(T?.icon,n?.classNames?.icon)},n.promise||n.type===`loading`&&!n.icon?n.icon||we():null,n.type===`loading`?null:Te):null,p.createElement(`div`,{"data-content":``,className:I(T?.content,n?.classNames?.content)},p.createElement(`div`,{"data-title":``,className:I(T?.title,n?.classNames?.title)},n.jsx?n.jsx:typeof n.title==`function`?n.title():n.title),n.description?p.createElement(`div`,{"data-description":``,className:I(v,me,T?.description,n?.classNames?.description)},typeof n.description==`function`?n.description():n.description):null),p.isValidElement(n.cancel)?n.cancel:n.cancel&&O(n.cancel)?p.createElement(`button`,{"data-button":!0,"data-cancel":!0,style:n.cancelButtonStyle||m,onClick:e=>{O(n.cancel)&&J&&(n.cancel.onClick==null||n.cancel.onClick.call(n.cancel,e),$())},className:I(T?.cancelButton,n?.classNames?.cancelButton)},n.cancel.label):null,p.isValidElement(n.action)?n.action:n.action&&O(n.action)?p.createElement(`button`,{"data-button":!0,"data-action":!0,style:n.actionButtonStyle||h,onClick:e=>{O(n.action)&&(n.action.onClick==null||n.action.onClick.call(n.action,e),!e.defaultPrevented&&$())},className:I(T?.actionButton,n?.classNames?.actionButton)},n.action.label):null)};function R(){if(typeof window>`u`||typeof document>`u`)return`ltr`;let e=document.documentElement.getAttribute(`dir`);return e===`auto`||!e?window.getComputedStyle(document.documentElement).direction:e}function ae(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?j:A;function o(e){[`top`,`right`,`bottom`,`left`].forEach(t=>{n[`${i}-${t}`]=typeof e==`number`?`${e}px`:e})}typeof e==`number`||typeof e==`string`?o(e):typeof e==`object`?[`top`,`right`,`bottom`,`left`].forEach(t=>{e[t]===void 0?n[`${i}-${t}`]=a:n[`${i}-${t}`]=typeof e[t]==`number`?`${e[t]}px`:e[t]}):o(a)}),n}var z=p.forwardRef(function(e,t){let{id:n,invert:r,position:i=`bottom-right`,hotkey:a=[`altKey`,`KeyT`],expand:o,closeButton:s,className:c,offset:ee,mobileOffset:l,theme:u=`light`,richColors:d,duration:f,style:m,visibleToasts:ne=k,toastOptions:h,dir:g=R(),gap:_=N,icons:v,containerAriaLabel:y=`Notifications`}=e,[b,x]=p.useState([]),S=p.useMemo(()=>n?b.filter(e=>e.toasterId===n):b.filter(e=>!e.toasterId),[b,n]),C=p.useMemo(()=>Array.from(new Set([i].concat(S.filter(e=>e.position).map(e=>e.position)))),[S,i]),[T,E]=p.useState([]),[D,O]=p.useState(!1),[A,j]=p.useState(!1),[M,P]=p.useState(u===`system`?typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:u),F=p.useRef(null),I=a.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),L=p.useRef(null),z=p.useRef(!1),B=p.useCallback(e=>{x(t=>(t.find(t=>t.id===e.id)?.delete||w.dismiss(e.id),t.filter(({id:t})=>t!==e.id)))},[]);return p.useEffect(()=>w.subscribe(e=>{if(e.dismiss){requestAnimationFrame(()=>{x(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))});return}setTimeout(()=>{te.flushSync(()=>{x(t=>{let n=t.findIndex(t=>t.id===e.id);return n===-1?[e,...t]:[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]})})})}),[b]),p.useEffect(()=>{if(u!==`system`){P(u);return}if(u===`system`&&(window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?P(`dark`):P(`light`)),typeof window>`u`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`);try{e.addEventListener(`change`,({matches:e})=>{P(e?`dark`:`light`)})}catch{e.addListener(({matches:e})=>{try{P(e?`dark`:`light`)}catch(e){console.error(e)}})}},[u]),p.useEffect(()=>{b.length<=1&&O(!1)},[b]),p.useEffect(()=>{let e=e=>{if(a.every(t=>e[t]||e.code===t)){var t;O(!0),(t=F.current)==null||t.focus()}e.code===`Escape`&&(document.activeElement===F.current||F.current?.contains(document.activeElement))&&O(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[a]),p.useEffect(()=>{if(F.current)return()=>{L.current&&(L.current.focus({preventScroll:!0}),L.current=null,z.current=!1)}},[F.current]),p.createElement(`section`,{ref:t,"aria-label":`${y} ${I}`,tabIndex:-1,"aria-live":`polite`,"aria-relevant":`additions text`,"aria-atomic":`false`,suppressHydrationWarning:!0},C.map((t,n)=>{let[i,a]=t.split(`-`);return S.length?p.createElement(`ol`,{key:t,dir:g===`auto`?R():g,tabIndex:-1,ref:F,className:c,"data-sonner-toaster":!0,"data-sonner-theme":M,"data-y-position":i,"data-x-position":a,style:{"--front-toast-height":`${T[0]?.height||0}px`,"--width":`${re}px`,"--gap":`${_}px`,...m,...ae(ee,l)},onBlur:e=>{z.current&&!e.currentTarget.contains(e.relatedTarget)&&(z.current=!1,L.current&&=(L.current.focus({preventScroll:!0}),null))},onFocus:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||z.current||(z.current=!0,L.current=e.relatedTarget)},onMouseEnter:()=>O(!0),onMouseMove:()=>O(!0),onMouseLeave:()=>{A||O(!1)},onDragEnd:()=>O(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||j(!0)},onPointerUp:()=>j(!1)},S.filter(e=>!e.position&&n===0||e.position===t).map((n,i)=>p.createElement(ie,{key:n.id,icons:v,index:i,toast:n,defaultRichColors:d,duration:h?.duration??f,className:h?.className,descriptionClassName:h?.descriptionClassName,invert:r,visibleToasts:ne,closeButton:h?.closeButton??s,interacting:A,position:t,style:h?.style,unstyled:h?.unstyled,classNames:h?.classNames,cancelButtonStyle:h?.cancelButtonStyle,actionButtonStyle:h?.actionButtonStyle,closeButtonAriaLabel:h?.closeButtonAriaLabel,removeToast:B,toasts:S.filter(e=>e.position==n.position),heights:T.filter(e=>e.position==n.position),setHeights:E,expandByDefault:o,gap:_,expanded:D,swipeDirections:e.swipeDirections}))):null}))}),B=ee();function V({...e}){return(0,B.jsx)(o,{"data-slot":`dialog`,...e})}function oe({...e}){return(0,B.jsx)(a,{"data-slot":`dialog-portal`,...e})}function se({className:e,...t}){return(0,B.jsx)(c,{"data-slot":`dialog-overlay`,className:f(`fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function H({className:e,children:t,showCloseButton:r=!0,...i}){return(0,B.jsxs)(oe,{children:[(0,B.jsx)(se,{}),(0,B.jsxs)(s,{"data-slot":`dialog-content`,className:f(`fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-[var(--miravo-radius-stadium-sm)] bg-background p-4 text-sm ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm 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),...i,children:[t,r&&(0,B.jsxs)(n,{"data-slot":`dialog-close`,render:(0,B.jsx)(u,{variant:`ghost`,className:`absolute top-2 right-2`,size:`icon-sm`}),children:[(0,B.jsx)(d,{}),(0,B.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function ce({className:e,...t}){return(0,B.jsx)(`div`,{"data-slot":`dialog-header`,className:f(`flex flex-col gap-2`,e),...t})}function U({className:e,showCloseButton:t=!1,children:r,...i}){return(0,B.jsxs)(`div`,{"data-slot":`dialog-footer`,className:f(`-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-[var(--miravo-radius-stadium-sm)] border-t p-4 sm:flex-row sm:justify-end`,e),...i,children:[r,t&&(0,B.jsx)(n,{render:(0,B.jsx)(u,{variant:`outline`}),children:`Close`})]})}function le({className:e,...t}){return(0,B.jsx)(r,{"data-slot":`dialog-title`,className:f(`text-base leading-none font-medium`,e),...t})}function W({className:e,...t}){return(0,B.jsx)(i,{"data-slot":`dialog-description`,className:f(`text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}export{ce as a,D as c,U as i,H as n,le as o,W as r,z as s,V as t};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{ot as n}from"./vendor-ui-D8j69UH4.js";import{T as r,b as i,c as a,d as o,f as s,l as c,m as l,n as u,s as d}from"./dom-Cm_OH5jc.js";import{n as f,t as ee}from"./by-path-VBqTBdlG.js";import{A as p,B as m,C as te,D as h,E as g,F as _,H as v,L as y,P as b,V as x,X as ne,_ as re,a as S,b as ie,c as ae,g as C,h as oe,i as se,j as ce,k as le,n as ue,o as de,r as fe,s as pe,t as me,w as he,x as ge}from"./status-CZFZLqVk.js";import{i as _e,n as ve,r as ye,t as be}from"./tank-THHXGdzg.js";import{t as xe}from"./stages-hidkaJPI.js";import{a as Se,n as Ce,o as we,r as Te,t as Ee}from"./boiler-CWAR1Nq2.js";var De=[[`boilerA`,`hot-water-boiler`,`heat-plant`,`boilers`,0],[`boilerB`,`hot-water-boiler`,`heat-plant`,`boilers`,1],[`boilerC`,`hot-water-boiler`,`heat-plant`,`boilers`,2],[`primaryA`,`centrifugal-pump`,`heat-plant`,`primary-loop`,0],[`primaryB`,`centrifugal-pump`,`heat-plant`,`primary-loop`,1],[`accumulator`,`storage-tank`,`heat-plant`,`primary-loop`,0],[`networkA`,`centrifugal-pump`,`network`,`trunk-main`,0],[`networkB`,`centrifugal-pump`,`network`,`trunk-main`,1],[`hospital`,`heat-substation`,`customers`,`hospital`,0],[`university`,`heat-substation`,`customers`,`university`,0],[`residential`,`heat-substation`,`customers`,`residential`,0],[`office`,`heat-substation`,`customers`,`office-park`,0]],Oe=e=>ee(De,e);function ke(e){let t=(e,t,n)=>({key:e,assetId:e,name:t,kind:`utility`,area:n});return[t(e.boilerA,`Boiler 1 (lead)`,`Heat plant`),t(e.boilerB,`Boiler 2`,`Heat plant`),t(e.boilerC,`Boiler 3`,`Heat plant`),t(e.accumulator,`Thermal accumulator`,`Heat plant`),t(e.primaryA,`Primary pump A`,`Heat plant`),t(e.primaryB,`Primary pump B`,`Heat plant`),t(e.networkA,`Network pump A`,`Network`),t(e.networkB,`Network pump B`,`Network`),t(e.hospital,`Hospital substation`,`Customers`),t(e.university,`University substation`,`Customers`),t(e.residential,`Residential substation`,`Customers`),t(e.office,`Office park substation`,`Customers`)]}var Ae=3600/(4186*30*.97),je=8,Me=e=>Number(e.dataset.win)*37%101;function Ne(e){let{svg:t,P:n,feed:i}=e,o=(e,t)=>i.num(e,t),s=u(t,`[data-valve]`).map(e=>{let n=pe(e),r=e=>u(t,`[data-asset="${n}"] ${e}`),i=r(`[data-spin="sub"]`)[0];return{id:n,el:e,at:d(e.dataset.valve),rotor:i,rotorAt:ae(i?.dataset.at),rotorR:Number(i?.dataset.radius)||2,foul:r(`[data-foul]`)[0],act:r(`[data-act]`)[0],wins:r(`[data-win]`).sort((e,t)=>Me(e)-Me(t)),valve:0,rate:0,spin:0,lit:-1,heat:ge(te(t,n),3,2),ret:ae(e.dataset.ret)}}),c=new Map(s.map(e=>[e.id,e]));return{draw(t,c,l){let u=e.reducedMotion();for(let e of s){e.valve=re(e.valve,C(o(e.id,`control_valve_position`)/100),t,.6,u);let[s=0,d=0,f=0,ee=4]=e.at;if(a(e.el,`d`,r([s,d],[s,d],f,n)+r([s-1.6,d],[s+1.6,d],f+e.valve*ee,n)),e.rate=re(e.rate,o(e.id,`circulation_pump_speed`)/100*je,t,.8,u),u||(e.spin+=e.rate*t),e.rotor){let[t,i,o]=e.rotorAt,s=``;for(let a=0;a<3;a++){let c=e.spin+a*oe/3;s+=r([t,i],[t+Math.cos(c)*e.rotorR,i+Math.sin(c)*e.rotorR],o,n)}a(e.rotor,`d`,s)}e.foul&&(e.foul.style.opacity=l&&he(i,e.id,`hx_fouling`)?`0.85`:`0`);let p=l&&he(i,e.id,`valve_stuck`);a(e.act,`data-s`,p&&Math.sin(c*6)>0?`a`:null),e.heat.draw(l&&!u&&he(i,e.id,`low_delta_t`),c,n,e.ret);let m=Math.round(C(o(e.id,`occupancy_pu`))*e.wins.length);if(m!==e.lit){e.lit=m;for(let[t,n]of e.wins.entries())a(n,`data-on`,t<m?``:null)}}},bar(e){return c.has(e)?C(o(e,`heat_delivered_kw`)/i.param(e,`design_load_kw`,500)):void 0},flowPu(e){let t=i.param(e,`design_load_kw`,0)*Ae;return t>0?C(o(e,`primary_flow`)/t):0}}}var w=e=>e>.002?6+26*C(e*2):0,Pe=e=>{let{svg:t,feed:n,ids:r}=e,i=ie(t),a=fe(e,i),o=Ee(e,i),s=be(e),c=Ne(e),l=[a,o,s,c],u=se(e,e=>ue(n,e,`availability`)),d=de(e,{needle:e=>o.needle(e)??0,bar:e=>l.reduce((t,n)=>t??n.bar(e),void 0)??0,alertsHigh:()=>!0,ready:()=>!0}),f=()=>a.flowPu(r.primaryA)+a.flowPu(r.primaryB),ee=()=>a.flowPu(r.networkA)+a.flowPu(r.networkB),p=[r.boilerA,r.boilerB,r.boilerC],m=e=>{let t=p.filter(e=>o.circulating(e)).length;return o.circulating(e)?f()/t:0},te=new Map([[`hospital`,r.hospital],[`university`,r.university],[`residential`,r.residential],[`office`,r.office]]),h=S(e,({id:e})=>{switch(e){case`sup-1`:return w(m(r.boilerA));case`sup-2`:case`ret-2`:return w(m(r.boilerB));case`sup-3`:case`ret-3`:return w(m(r.boilerC));case`sup-23`:return w(m(r.boilerB)+m(r.boilerC));case`to-acc`:return w(f());case`ret-a`:case`suction-pa`:return w(a.flowPu(r.primaryA));case`ret-collect`:return w(f());case`ret-12`:return w(m(r.boilerA)+m(r.boilerB));case`ret-1`:return w(m(r.boilerA));case`ret-b`:case`suction-b`:return w(a.flowPu(r.primaryB));case`suction-a`:case`sup-a`:return w(a.flowPu(r.networkA));case`sup-b`:case`suction-nb`:return w(a.flowPu(r.networkB));case`acc-out`:case`trunk-sup`:case`trunk-ret`:return w(ee());default:{let t=te.get(e.slice(0,e.lastIndexOf(`-`)));return t?w(c.flowPu(t)):0}}});return{data(e){u.draw(e)},draw({sdt:e,t,introDone:n}){h.draw(e),d.draw(e,t);for(let r of l)r.draw(e,t,n)},resync(){},status:e=>me(n,e,`availability`)}},Fe=e(t(),1),Ie=11;function Le(e,t){let{k:n,P:r,S:i,L:a,slab:o,cyl:s}=e,{plan:c,floors:l,kind:u}=t,d=l*14+4,f=[],ee=e=>a(e,{tone:`faint`}),p=Array.from({length:l-1},(e,t)=>n.sideSeam(c,4+(t+1)*14,r,2)).join(``);f.push(i(n.slabOf(c,0,d,r,2,.6),{tone:u===`office`?`lo`:`mid`,inner:ee(p)})),f.push(a(n.planOutline(n.insetPlan(c,2),d,r,2),{tone:`lo`})),f.push(o({x:c.x+c.w*.2,y:c.y+c.d*.2,w:18,d:12,r:1},d,7,{tone:`mid`},2,.3)),f.push(s(c.x+c.w*.7,c.y+c.d*.35,4,d,9,{tone:`mid`},20));let m=[],te=0,h=(e,t,n)=>`<path class="bd-win" data-win="${te++}" d="M${e.toFixed(1)} ${(-(t+8)).toFixed(1)}H${(e+n).toFixed(1)}V${(-t).toFixed(1)}H${e.toFixed(1)}Z"/>`,g=u===`office`;for(let[t,i,a]of[[c.w,e.front(c.y+c.d),c.x],[c.d,n.sideMatrix([c.x+c.w,c.y+c.d],0,r,`right`),0]]){let e=Math.max(1,Math.floor((t-6)/Ie)),n=a+(t-e*Ie)/2,r=[];for(let t=0;t<l;t++){let i=7+t*14;if(g)r.push(h(n+1,i,e*Ie-2));else for(let t=0;t<e;t++)r.push(h(n+t*Ie+2,i,Ie-4))}m.push(`<g transform="${i}">${r.join(``)}</g>`)}f.push(...m);let _=c.x+c.w/2,v=c.y+c.d,y=(e,t,n,r,i,a=0)=>{let l=c.x+c.w/2+a;f.push(o({x:l-4.5,y:v,w:9,d:.6,r:.2},0,n-1,{tone:`lo`},2,0),...[-1,1].flatMap(r=>[s(l+r*(e-3)/2,v+t-1.2,1.7,0,.8,{tone:`lo`},14),s(l+r*(e-3)/2,v+t-1.2,i,.8,n-.8,{tone:`mid`},12)]),o({x:l-e/2,y:v,w:e,d:t,r:.5},n,1.4,{tone:r},2,.2))};if(u===`hospital`)f.push(o({x:_-6,y:v-1,w:12,d:1.2,r:.4},d-14,12,{tone:`lo`},2,0)),f.push(`<g transform="${e.front(v+.25)}"><path class="bd-cross" d="M${_-1.4} ${-(d-3.6)}H${_+1.4}V${-(d-6.6)}H${_+4.4}V${-(d-9.4)}H${_+1.4}V${-(d-12.4)}H${_-1.4}V${-(d-9.4)}H${_-4.4}V${-(d-6.6)}H${_-1.4}Z"/></g>`),y(24,8,12,`mid`,.9);else if(u===`university`)y(30,9,18,`mid`,1.8,-16);else if(u===`residential`)for(let e=1;e<l;e++)f.push(o({x:c.x+4,y:v,w:c.w-8,d:4,r:.4},4+e*14,1,{tone:`mid`},2,0));else y(20,7,14,`mid`,.9);return f.join(``)}var T=1.8,E=4,D=-14,O=[-5,5],k=[10,26],A=[26,k[0]],j=13,Re=17.5,ze=2.2,Be=-26,M=[[O[0],28,k[1]],[O[0],28,k[0]]],Ve={x:-16,y:-24,w:34,d:54,r:2};function He(e,t){let{k:n,G:r,P:i,at:a,S:o,L:s,D:c,slab:l,cyl:u,hmi:d,screws:f,faceRule:ee}=e,p=[];p.push(l({x:-14,y:-22,w:30,d:50,r:2},0,3,{tone:`lo`},3,.4)),p.push(f(n.corners({x:-14,y:-22,w:30,d:50},2.4),3)),p.push(l({x:-1.2,y:D-6,w:2.4,d:3,r:.4},3,36,{tone:`mid`},2,.2),l({x:-1.4,y:D-6,w:2.8,d:E-D+9,r:.4},36,2.6,{tone:`mid`},2,.2)),p.push(l({x:-10,y:D-3,w:20,d:3,r:.6},3,33,{tone:`mid`},2,.3));let te=[];for(let e=D+.8;e<E-.4;e+=.9)te.push(n.segment([9,e,6],[9,e,33],i));p.push(o(n.slabOf({x:-9,y:D,w:18,d:E-D,r:.4},5,29,i,2,.2),{tone:`lo`,inner:s(te.join(``),{tone:`faint`})}));let h=[[9.1,D+.4,6],[9.1,E-.4,6],[9.1,E-.4,33],[9.1,D+.4,33]].map(e=>a(e));p.push(`<path class="sf-grime" data-foul="" style="opacity:0" d="${n.pathOf(h,!0)}"/>`),p.push(l({x:-11,y:E,w:22,d:3.4,r:.6},3,35,{tone:`mid`},2,.3));let g=E+3.4;p.push(c([-10.4,10.4].flatMap(e=>[7,31].map(t=>a([e,g,t]))),{size:.5}));for(let e of O)for(let t of k){let n=r.frameAlong([e,g,t],[0,1,0]);p.push(o(r.disc(0,2.2,T+.2,n,i),{tone:`mid`}),o(r.disc(2.2,3,T+1.4,n,i),{tone:`mid`}))}let _=(e,t)=>[O[e],g+3,k[t]],[v,y]=M;p.push(m(e,[v,_(0,1)],T,`mid`,3,`heat`),m(e,[_(0,0),y],T,`mid`,3,`heatret`));for(let e of[v,y]){let t=r.frameAlong([e[0],e[1]-1.6,e[2]],[0,1,0]);p.push(o(r.disc(0,1.6,T+1.2,t,i),{tone:`mid`}))}let[b,,x]=v,ne=r.frameAlong([b,14,x],[0,1,0]);p.push(o(r.disc(0,1,T+1.4,ne,i),{tone:`mid`}),o(r.solidOf([[1,2.6],[2.6,3.6,1],[5.4,3.6,1],[7,2.6]],ne,i),{tone:`mid`}),o(r.disc(7,8,T+1.4,ne,i),{tone:`mid`}),u(b,18,1.2,x+3,4,{tone:`mid`,crease:`none`},12),u(b,18,4.4,x+7,2,{tone:`mid`},24),u(b,18,4.8,x+9,5,{tone:`mid`,crease:`lo`},28));let re=a([b+4.8,18,x+11.5]);p.push(`<path class="iso-line" data-tone="lit" data-valve="${b},21,${x+14},4" data-ret="${y[0]},${y[1]-4},${y[2]+2}" d=""/>`,`<circle class="sb-act" data-act="" cx="${re[0].toFixed(2)}" cy="${re[1].toFixed(2)}" r="0.6"/>`);let S=[O[1],g+14,k[1]],ie=(e,t)=>{let n=r.frameAlong([e,-30,t],[0,1,0]);return o(r.disc(0,1.2,T+2.6,n,i),{tone:`mid`})+o(r.disc(1.2,ze,T+1.4,n,i),{tone:`mid`})},ae=(e,t)=>u(e,Be,2.4,0,1,{tone:`lo`},18)+u(e,Be,.9,1,t-T-2.6,{tone:`mid`,crease:`none`},12)+u(e,Be,1.8,t-T-1.6,1,{tone:`mid`},16),C=-30+ze;return p.push(ie(j,A[0]),ie(j,A[1]),ae(j,A[1]),ae(Re,A[0]),l({x:j-1,y:Be-.9,w:Re-j+1.9,d:1.8,r:.3},A[0]-T-1.6,1,{tone:`mid`},2,0),m(e,[_(1,1),S,[j,S[1],A[0]],[j,C,A[0]]],T,`mid`,4,`heat`,[!0,!1]),m(e,[_(1,0),[O[1],g+16,k[0]],[j,g+16,k[0]],[j,C,A[1]]],T,`mid`,4,`heatret`,[!0,!1])),p.push(u(S[0],S[1],3.6,k[1]-3,6,{tone:`mid`},24)),p.push(u(S[0],S[1],3,k[1]+3,7,{tone:`mid`,crease:`lo`},24)),p.push(`<path class="iso-line" data-tone="lo" data-spin="sub" data-at="${S[0]},${S[1]},${k[1]+10}" data-radius="2.4" d=""/>`),p.push(l({x:-14,y:10,w:6,d:8,r:.6},3,22,{tone:`mid`},2,.3)),p.push(d(t,18,-13.6,-8.4,8,21)),p.push(ee(18,-13.6,4,5,2)),p.join(``)}var Ue=1e3,We={x:-380,y:-360,w:305,d:315,r:8},Ge={x:-60,y:-300,w:240,d:150,r:8},Ke={x:-380,y:-15,w:620,d:200,r:8},qe={x:-400,y:-380,w:660,d:585,r:16},Je=i([...l(qe,-21,-14),...l(We,-14,120),...l(Ge,-14,90),...l(Ke,-14,110)],Ue,620,{pad:22,azimuth:60}),Ye=[[-262,-335],[-262,-245],[-262,-155]],Xe=[-120,-255],Ze={r:34,h:118,windowX:6,panelX:40,nozzles:[{angle:180,z:80,r:3.4,role:`inlet`},{angle:0,z:80,r:3.4,role:`outlet`}]},Qe=[94,-130,0],N={primaryA:{c:[-255,-78],scale:1},primaryB:{c:[-130,-78],scale:1},networkA:{c:[0,-190],scale:1.15},networkB:{c:[135,-190],scale:1.15}},$e=[b[0]-Qe[0],b[1]-Qe[1],b[2]],et=[p[0]-Qe[0],p[1]-Qe[1],p[2]],tt=18,nt=(e,t,n,r,i)=>({key:e,skid:[t+n/2-tt,104],building:{kind:e,plan:{x:t-n/2,y:74-r,w:n,d:r,r:2},floors:i}}),rt=[nt(`hospital`,150,112,62,4),nt(`university`,-5,120,64,3),nt(`residential`,-158,68,56,5),nt(`office`,-300,92,58,4)],it=xe([...Ye.map((e,t)=>({key:`boiler${t}`,at:e,h:60})),{key:`accumulator`,at:Xe,h:Ze.h+12},...Object.entries(N).map(([e,t])=>({key:e,at:t.c,h:45})),...rt.flatMap(e=>[{key:`${e.key}-building`,at:[e.building.plan.x+e.building.plan.w/2,e.building.plan.y+e.building.plan.d/2],h:e.building.floors*14+4},{key:e.key,at:e.skid,h:40}])],Je),at=it.order,ot=it.slotDepths,st=it.depth,ct=(e,t)=>[e.c[0]+t[0]*e.scale,e.c[1]+t[1]*e.scale,t[2]*e.scale],P=(e,t,n,r)=>[t??e[0],n??e[1],r??e[2]],lt=e=>{let t=Ze.nozzles[e],[n,r,i]=t?ye(Ze,t):[0,0,0];return[Xe[0]+n,Xe[1]+r,i]},F=(Ye[0]?.[0]??0)+Se[0],I=(Ye[0]?.[0]??0)+Te[0],ut=Se[2],L=80,R=84,[dt=0,z=0,ft=0]=Ye.map(e=>e[1]),pt=lt(0),B=lt(1),{primaryA:V,primaryB:H,networkA:U,networkB:W}=N,G=e=>ct(e,[et[0],et[1],et[2]-3]),K=e=>ct(e,$e),mt=10,q=e=>P(K(e),K(e)[0]+mt*e.scale,null,null),ht=72,J=-106,gt=K(V)[2],Y=220,X=232,_t=3.2*N.networkA.scale,vt=100,yt=vt-18,bt=-40,xt=M[0][2],Z=M[1][2],Q=104+M[0][1]+30,St=Math.min(...rt.map(e=>e.skid[0]))+M[0][0]-14,Ct={z:10,flanged:!0,routes:[{id:`sup-1`,medium:`heat`,r:3.2,pts:[[F,dt,ut],[F,dt,L],[F,pt[1],L]]},{id:`sup-23`,medium:`heat`,r:3.2,reverse:!0,pts:[[F,pt[1],L],[F,z,L]]},{id:`sup-3`,medium:`heat`,r:3.2,reverse:!0,pts:[[F,z,L],[F,ft,L],[F,ft,ut]]},{id:`sup-2`,medium:`heat`,r:3.2,pts:[[F,z,ut],[F,z,L]]},{id:`to-acc`,medium:`heat`,r:3.4,pts:[[F,pt[1],L],pt]},{id:`ret-b`,medium:`heatret`,r:3.2,fromStub:!0,pts:[G(H),P(G(H),null,null,ht),P(G(V),null,null,ht)]},{id:`ret-a`,medium:`heatret`,r:3.2,fromStub:!0,pts:[G(V),P(G(V),null,null,ht)]},{id:`ret-collect`,medium:`heatret`,r:3.2,bend:6,pts:[P(G(V),null,null,ht),P(G(V),I,null,ht),P(G(V),I,null,R),[I,ft,R]]},{id:`ret-12`,medium:`heatret`,r:3.2,pts:[[I,ft,R],[I,z,R]]},{id:`ret-1`,medium:`heatret`,r:3.2,pts:[[I,z,R],[I,dt,R],[I,dt,ut]]},{id:`ret-2`,medium:`heatret`,r:3.2,pts:[[I,z,R],[I,z,ut]]},{id:`ret-3`,medium:`heatret`,r:3.2,pts:[[I,ft,R],[I,ft,ut]]},{id:`acc-out`,medium:`heat`,r:3.4,pts:[B,P(q(U),null,B[1],B[2])]},{id:`suction-nb`,medium:`heat`,r:3.4,pts:[P(q(U),null,B[1],B[2]),P(B,q(W)[0],null,null),P(q(W),null,B[1],null),q(W),K(W)]},{id:`suction-a`,medium:`heat`,r:3.4,pts:[P(q(U),null,B[1],B[2]),P(q(U),null,B[1],null),q(U),K(U)]},...rt.flatMap(e=>{let[t,n]=e.skid,r=[t+M[0][0],n+M[0][1],xt],i=[t+M[1][0],n+M[1][1],Z];return[{id:`${e.key}-sup`,medium:`heat`,r:1.8,pts:[P(r,null,Q,null),r]},{id:`${e.key}-ret`,medium:`heatret`,r:1.8,pts:[i,P(i,null,Q,null)]}]}),{id:`trunk-ret`,medium:`heatret`,r:3.6,blind:[!0,!1],pts:[[St,Q,Z],[X,Q,Z],[X,J,Z],[X,J,gt],P(q(H),null,J,null)]},{id:`suction-pa`,medium:`heatret`,r:3.6,pts:[P(q(H),null,J,null),P(q(V),null,J,null),q(V),K(V)]},{id:`sup-a`,medium:`heat`,r:_t,fromStub:!0,pts:[G(U),P(G(U),null,null,vt),P(G(W),null,null,vt)]},{id:`trunk-sup`,medium:`heat`,r:3.6,blind:[!1,!0],pts:[P(G(W),null,null,vt),[Y,G(U)[1],vt],[Y,G(U)[1],yt],[Y,bt,yt],[Y,bt,xt],[Y,Q,xt],[St,Q,xt]]},{id:`sup-b`,medium:`heat`,r:_t,fromStub:!0,pts:[G(W),P(G(W),null,null,vt)]},{id:`suction-b`,medium:`heatret`,r:3.2,pts:[K(H),q(H),P(q(H),null,J,null)]}],posts:[[Y,-130,3.6,yt],[Y,-70,3.6,yt],[Y,0,3.6,xt,0],[Y,80,3.6,xt,0],[X,-60,3.6,Z],[X,40,3.6,Z,0],[X,120,3.6,Z,0],...[150,50,-40].map(e=>[e,J,3.6,gt]),[-120,J,3.6,gt,0],...[-230,-80,75,140].map(e=>[e,Q,3.6,Z,0])]},$=n(),wt=(e,t)=>we(e,t,10),Tt=(e,t)=>_(e,t,`heatret`,!0),Et=(e,t)=>_(e,t,`heat`,!0),Dt=(e,t)=>_e(e,t,Ze),Ot=ve(Ze);function kt({id:e,spec:t,intro:n}){let r=s();return(0,$.jsx)(o,{html:(0,Fe.useMemo)(()=>Le(r,t),[r,t]),asset:e,intro:n})}function At({ids:e}){let t=s(),n=g(Ct,st),r=(0,Fe.useMemo)(()=>y(t,qe)+t.plinth(We)+t.plinth(Ge)+t.plinth(Ke),[t]),i=e=>(0,$.jsx)(o,{html:`${n.layers[e]??``}<g data-flows="${e}" data-depth="${e===0?-1e9:ot[e-1]??0}"></g>`,data:{pipes:``}},`pipes-${e}`),a=(e,t,n,r)=>(0,$.jsx)(h,{from:Qe,to:le(t.c),scale:t.scale,children:(0,$.jsx)(c,{id:e,plan:ce,intro:r,draw:n})}),l=[e.boilerA,e.boilerB,e.boilerC],u={hospital:e.hospital,university:e.university,residential:e.residential,office:e.office},d={accumulator:(0,$.jsx)(h,{to:le(Xe),children:(0,$.jsx)(c,{id:e.accumulator,plan:Ot,intro:5,draw:Dt})}),primaryA:a(e.primaryA,N.primaryA,Tt,6),primaryB:a(e.primaryB,N.primaryB,Tt,7),networkA:a(e.networkA,N.networkA,Et,8),networkB:a(e.networkB,N.networkB,Et,9)};for(let[e,t]of Ye.entries())d[`boiler${e}`]=(0,$.jsx)(h,{to:le(t),children:(0,$.jsx)(c,{id:l[e]??``,plan:Ce,intro:2+e,draw:wt})});for(let[e,t]of rt.entries()){let n=u[t.key];d[`${t.key}-building`]=(0,$.jsx)(kt,{id:n,spec:t.building,intro:10+e}),d[t.key]=(0,$.jsx)(h,{to:le(t.skid),children:(0,$.jsx)(c,{id:n,plan:Ve,intro:11+e,draw:He})})}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(o,{html:r,data:{plinth:``}}),i(0),at.flatMap((e,t)=>[(0,$.jsx)(`g`,{children:d[e.key]},e.key),i(t+1)])]})}var jt=x(Je),Mt=v(jt,Ct,st),Nt=ne({layout:{width:Ue,height:620,label:`Isometric model of the District Heating network: the heat plant with three gas boilers, the thermal accumulator and two primary pumps; the network pump house with two trunk pumps; and four customers (a hospital, a university, a residential block and an office park), each with its substation, joined by the supply and return trunk main. Every moving part follows live values from the running engine.`,kit:jt,flows:Mt.flows,joints:Mt.joints,Scene:At,compose:Pe},resolve:Oe,things:ke,caption:`heat plant · network · customers`,mismatch:`This floor expects the District Heating network: three boilers, the accumulator and two primary pumps, two network pumps, and the hospital, university, residential and office substations, by area and line.`,statusBasis:`availability`,Overview:f,tab:`Network`});export{Nt as heatingFloor};
@@ -0,0 +1 @@
1
+ import{a as e,r as t}from"./rolldown-runtime-COnpUsM8.js";import{c as n}from"./vendor-charts-95ykyDlI.js";import{ot as r}from"./vendor-ui-D8j69UH4.js";var i=e(n(),1),a=e=>{let t=(Math.round(e*10)/10).toFixed(1).replace(/\.0$/,``);return t===`-0`?`0`:t},o=e=>e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`),s=e=>Object.entries(e).filter(([,e])=>e!==void 0&&e!==!1).map(([e,t])=>` ${e}="${o(String(t))}"`).join(``);function c(e,{tone:t=`hi`,crease:n=`faint`,halo:r=!1,lit:i=!1,flat:a=!1,className:o,inner:c=``}={}){let l=[];return r&&l.push(`<path class="iso-halo" d="${e.fill}"/>`),l.push(`<path class="iso-fill" d="${e.fill}"/>`),a||(e.shades.forEach((e,t)=>{e&&l.push(`<path class="iso-shade" data-shade="${t}" d="${e}"/>`)}),l.push(`<path class="iso-top" d="${e.top}"/>`)),n!==`none`&&e.crease&&l.push(`<path class="iso-line iso-crease" data-tone="${n}" d="${e.crease}"/>`),n!==`none`&&e.bevel&&l.push(`<path class="iso-line iso-bevel" data-tone="${n}" d="${e.bevel}"/>`),c&&l.push(c),l.push(`<path class="iso-line iso-edge" data-tone="${t}" d="${e.outline}"/>`),`<g${s({class:o?`iso-solid ${o}`:`iso-solid`,"data-lit":i?``:void 0,"data-seamless":e.seamless?``:void 0})}>${l.join(``)}</g>`}function l(e,{tone:t=`lo`,dotted:n=!1,dashed:r=!1,flow:i=!1,className:a,free:o}={}){return e?`<path${s({class:a?`iso-line ${a}`:`iso-line`,"data-tone":t,"data-free":o===!0?``:o||void 0,"data-dotted":n?``:void 0,"data-dashed":r?``:void 0,"data-flow":i?``:void 0,d:e})}/>`:``}function u(e,{size:t=.5,tone:n=`mid`,pulse:r=!1}={}){return`<g class="iso-dots" data-tone="${n}">${e.map(([e,n,i],o)=>{let s=i!==void 0&&i<1?` fill-opacity="${Math.max(0,i).toFixed(2)}"`:``,c=r?` data-pulse="" style="--pulse-at:${o*137%1600}ms"`:``;return`<circle cx="${a(e)}" cy="${a(n)}" r="${t}"${s}${c}/>`}).join(``)}</g>`}function d(e,t={}){let n=new Map;for(let{d:t,alpha:r}of e){if(!t||!(r>.02))continue;let e=Math.min(1,Math.round(r*20)/20);n.set(e,(n.get(e)??``)+t)}return[...n].map(([e,n])=>e>=1?l(n,t):`<g opacity="${e.toFixed(2)}">${l(n,t)}</g>`).join(``)}var f=t({boxCorners:()=>R,cameraOf:()=>v,circleRing:()=>k,corners:()=>L,cylinder:()=>A,depthOf:()=>x,dotsSvg:()=>u,fadedSvg:()=>d,fitProjection:()=>q,haloOf:()=>H,insetPlan:()=>j,iso:()=>y,lineOnTop:()=>P,lineSvg:()=>l,onTop:()=>M,pathOf:()=>S,planOutline:()=>N,radialTicks:()=>V,ring:()=>I,roundedPlan:()=>C,segment:()=>F,sideArc:()=>te,sideMatrix:()=>K,sideRing:()=>B,sideSeam:()=>z,slabOf:()=>O,solidSvg:()=>c,translateAlong:()=>W}),p=45,m=30,h=4,g=Math.PI/180,_=Math.sqrt(1.6);function v({scale:e,azimuth:t=p,elevation:n=m}){let r=t*g,i=n*g;return{sinA:Math.sin(r),cosA:Math.cos(r),sinE:Math.sin(i),cosE:Math.cos(i),k:e*_}}function y([e,t,n],r){let{origin:i}=r,{sinA:a,cosA:o,sinE:s,cosE:c,k:l}=v(r);return[i[0]+(e*a-t*o)*l,i[1]+((e*o+t*a)*s-n*c)*l]}function b(e){let{sinA:t,cosA:n}=v(e);return[n,t]}function x([e,t,n],r){let{sinA:i,cosA:a,sinE:o,cosE:s}=v(r);return(e*a+t*i)*s+n*o}function S(e,t=!1){return e.length?e.map(([e,t],n)=>`${n?`L`:`M`}${a(e)} ${a(t)}`).join(``)+(t?`Z`:``):``}function C({x:e,y:t,w:n,d:r,r:i},a=8){let o=Math.max(0,Math.min(i,n/2,r/2)),s=[[e+n-o,t+o,-90],[e+n-o,t+r-o,0],[e+o,t+r-o,90],[e+o,t+o,180]],c=[];for(let[e,t,n]of s){let r=o>0?a:0;for(let i=0;i<=r;i++){let a=(n+(r?90*i/r:45))*g;c.push([e+o*Math.cos(a),t+o*Math.sin(a)])}}return c}function w(e){let t=0;for(let n=0;n<e.length;n++){let[r,i]=e[n],[a,o]=e[(n+1)%e.length];t+=r*o-a*i}return t/2}var T=e=>w(e)<0?[...e].reverse():[...e];function ee(e){let t=[...e].sort((e,t)=>e[0]-t[0]||e[1]-t[1]);if(t.length<3)return t;let n=(e,t,n)=>(t[0]-e[0])*(n[1]-e[1])-(t[1]-e[1])*(n[0]-e[0]),r=[];for(let e of t){for(;r.length>=2&&n(r[r.length-2],r[r.length-1],e)<=0;)r.pop();r.push(e)}let i=[];for(let e=t.length-1;e>=0;e--){let r=t[e];for(;i.length>=2&&n(i[i.length-2],i[i.length-1],r)<=0;)i.pop();i.push(r)}return[...r.slice(0,-1),...i.slice(0,-1)]}function E(e,t){let n=e.length,r=[],i=e.findIndex((t,r)=>t!==e[(r+n-1)%n]);if(i<0)return e[0]===t?[Array.from({length:n+1},(e,t)=>t%n)]:[];let a=null;for(let o=0;o<n;o++){let s=(i+o)%n;e[s]===t?(a||=[s],a.push((s+1)%n)):a&&=(r.push(a),null)}return a&&r.push(a),r}function D(e,t,n,r,i){let a=e.length,o=w(e)>0,[s,c]=b(r),{sinA:l,cosA:u}=v(r),d=e.map(([t,n],r)=>{let[i,s]=e[(r+1)%a],c=i-t,l=s-n,u=Math.hypot(c,l)||1;return o?[l/u,-c/u]:[-l/u,c/u]}),f=d.map(([e,t])=>e*s+t*c>1e-9),p=e.map(([e,i])=>y([e,i,t+n],r)),m=e.map(([e,n])=>y([e,n,t],r)),g=(e,t)=>e[t],_=[],x=[];for(let e of E(f,!1))_.push(S(e.map(e=>g(p,e))));for(let e of E(f,!0))x.push(S(e.map(e=>g(p,e)))),n>0&&_.push(S(e.map(e=>g(m,e))));if(n>0)for(let e=0;e<a;e++)f[(e+a-1)%a]!==f[e]&&_.push(S([g(p,e),g(m,e)]));let C=S(ee([...p,...m]),!0),D=Array.from({length:h},()=>[]);if(n>0){let[e,t]=[-l,u];for(let n=0;n<a;n++){if(!f[n])continue;let[r,i]=d[n],o=(r*e+i*t+1)/2,s=Math.min(h-1,Math.max(0,Math.floor(o*h))),c=(n+1)%a;D[s].push(S(T([g(p,n),g(p,c),g(m,c),g(m,n)]),!0))}}let O;if(i>0){let o=e.map(([e,t],n)=>{let[r,o]=d[(n+a-1)%a],[s,c]=d[n],l=r+s,u=o+c,f=Math.hypot(l,u)||1;return[e-l/f*i,t-u/f*i]}).map(([e,i])=>y([e,i,t+n],r));O=E(f,!0).map(e=>S([g(p,e[0]),...e.slice(1,-1).map(e=>g(o,e)),g(p,e[e.length-1])])).join(``)}return{fill:C,outline:_.join(``),crease:x.join(``),top:S(T(p),!0),shades:D.map(e=>e.join(``)),bevel:O}}function O(e,t,n,r,i=8,a=0){return D(C(e,i),t,n,r,a)}function k(e,t,n,r=40){return Array.from({length:r},(i,a)=>{let o=a/r*Math.PI*2;return[e+n*Math.cos(o),t+n*Math.sin(o)]})}function A(e,t,n,r,i,a,o=32,s=0){return D(k(e,t,n,o),r,i,a,s)}var j=({x:e,y:t,w:n,d:r,r:i},a)=>({x:e+a,y:t+a,w:n-a*2,d:r-a*2,r:Math.max(0,i-a)});function M(e,t,n,r=!1){return S(e.map(([e,r])=>y([e,r,t],n)),r)}var N=(e,t,n,r=8)=>M(C(e,r),t,n,!0),P=(e,t,n,r)=>M([e,t],n,r),F=(e,t,n)=>S([y(e,n),y(t,n)]),I=(e,t,n,r,i,a=40)=>M(k(e,t,n,a),r,i,!0);function L({x:e,y:t,w:n,d:r},i=0){return[[e+i,t+i],[e+n-i,t+i],[e+i,t+r-i],[e+n-i,t+r-i]]}function R({x:e,y:t,w:n,d:r},i,a){let o=[];for(let s of[e,e+n])for(let e of[t,t+r])for(let t of[i,a])o.push([s,e,t]);return o}function te(e,t,n,r,i,a=24){let[o,s]=b(i),c=Math.atan2(s,o),l=[];for(let o=0;o<=a;o++){let s=c-Math.PI/2+o/a*Math.PI;l.push(y([e+n*Math.cos(s),t+n*Math.sin(s),r],i))}return S(l)}function z(e,t,n,r=8){let i=C(e,r),a=i.length,o=w(i)>0,[s,c]=b(n);return E(i.map(([e,t],n)=>{let[r,l]=i[(n+1)%a],u=r-e,d=l-t,[f,p]=o?[d,-u]:[-d,u];return f*s+p*c>1e-9}),!0).map(e=>S(e.map(e=>{let[r,a]=i[e];return y([r,a,t],n)}))).join(``)}function B(e,t,n,r,i=20){let[a,o,s]=e,c=[];for(let e=0;e<i;e++){let l=e/i*Math.PI*2,u=t*Math.cos(l),d=t*Math.sin(l);c.push(y(n===`x`?[a,o+u,s+d]:[a+u,o,s+d],r))}return S(c,!0)}function V(e,t,n,r,i,a,o,s,c=0,l=Math.PI*2){let u=[],d=[],f=Math.abs(l-Math.PI*2)<1e-9?r:r+1;for(let p=0;p<f;p++){let f=c+p/r*l,m=p%i===0,h=n-(m?o[1]:o[0]),g=Math.sin(f),_=-Math.cos(f);(m?d:u).push(P([e+g*h,t+_*h],[e+g*n,t+_*n],a,s))}return{minor:u.join(``),major:d.join(``)}}var H=(e,t,n,r)=>O(e,t,n,r).fill;function ne(e,[t,n,r]){let i=y([0,0,0],e),a=y([t,n,r],e);return[a[0]-i[0],a[1]-i[1]]}var U=e=>Math.round(e*100)/100;function W(e,t){let[n,r]=ne(e,t);return`translate(${U(n)} ${U(r)})`}var G=e=>Math.round(e*1e3)/1e3,re=(e,t,n)=>`matrix(${G(e[0])} ${G(e[1])} ${G(t[0])} ${G(t[1])} ${G(n[0])} ${G(n[1])})`;function K(e,t,n,r){let i=y([e[0],e[1],t],n),a=e=>{let[t,r]=y(e,n);return[t-i[0],r-i[1]]},o=a([e[0]+1,e[1],t]),s=a([e[0],e[1]+1,t]),c=a([e[0],e[1],t+1]),l=[-c[0],-c[1]];return re(r===`left`?o:[-s[0],-s[1]],l,i)}function q(e,t,n,{pad:r=24,headroom:i=0,azimuth:a=p,elevation:o=m}={}){let s={origin:[0,0],scale:1,azimuth:a,elevation:o},c=e.map(e=>y(e,s)),l=c.map(([e])=>e),u=c.map(([,e])=>e),d=Math.min(...l),f=Math.max(...l),h=Math.min(...u),g=Math.max(...u),_=Math.min((t-r*2)/(f-d),(n-r*2-i)/(g-h));return{origin:[t/2-(d+f)/2*_,i+(n-i)/2-(h+g)/2*_],scale:_,azimuth:a,elevation:o}}var J=r(),Y=(0,i.createContext)(null),ie=Y.Provider;function X(){let e=(0,i.useContext)(Y);if(!e)throw Error(`Floor machines must render inside <FloorKitProvider value={kitFor(P)}>.`);return e}var Z=(0,i.memo)(function({html:e,asset:t,intro:n,className:r,data:a}){let o=(0,i.useMemo)(()=>({__html:e}),[e]),s={};for(let[e,t]of Object.entries(a??{}))s[`data-${e}`]=t;return(0,J.jsx)(`g`,{"data-asset":t,"data-intro":n,className:r,...s,dangerouslySetInnerHTML:o})});function ae({id:e,plan:t,intro:n,draw:r}){let a=X();return(0,J.jsx)(Z,{html:(0,i.useMemo)(()=>`<path class="iso-halo sf-contact" d="${H(j(t,2),0,.5,a.P)}"/><path class="sf-alarm" data-alarm="${e}" d="${H(t,0,1,a.P)}"/>${r(a,e)}`,[a,e,t,r]),asset:e,intro:n})}function oe(e){let t=X();return(0,i.useMemo)(()=>e(t),[t,e])}var se=`http://www.w3.org/2000/svg`;function ce(e,t){return e.querySelector(t)}function Q(e,t){return[...e.querySelectorAll(t)]}function le(e,t,n){e&&(n===null?e.hasAttribute(t)&&e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n))}function ue(e,t){e.style.opacity!==t&&(e.style.opacity=t);let n=Number(t)>0?``:`none`;e.style.display!==n&&(e.style.display=n)}var $=`data-rt`;function de(e,t,n){let r=document.createElementNS(se,e);for(let[e,n]of Object.entries(t))r.setAttribute(e,n);return r.setAttribute($,``),n?.append(r),r}var fe=e=>(e??``).split(`,`).map(Number);function pe(e,t,n){let r=null,i=1/0;for(let a of Q(e,`[data-asset]`)){let e=a.getBoundingClientRect(),o=e.width*e.height;e.width&&t>=e.left&&t<=e.right&&n>=e.top&&n<=e.bottom&&o<i&&(r=a.dataset.asset??null,i=o)}return r}export{C as A,y as C,N as D,S as E,O as F,W as I,u as L,K as M,B as N,V as O,z as P,l as R,j as S,P as T,L as _,ue as a,q as b,le as c,Z as d,X as f,k as g,v as h,pe as i,F as j,I as k,ae as l,R as m,Q as n,de as o,oe as p,$ as r,fe as s,ce as t,ie as u,A as v,f as w,H as x,x as y,c as z};
@@ -1 +1 @@
1
- import{n as e}from"./utils-BO2u-wC_.js";var t=e(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]);export{t};
1
+ import{n as e}from"./utils-XFKvwlFT.js";var t=e(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]);export{t};
@@ -1 +1 @@
1
- import{F as e,I as t,L as n,M as r,N as i,P as a,R as o,j as s,ot as c,tt as l}from"./vendor-ui-D8j69UH4.js";import{n as u,t as d}from"./utils-BO2u-wC_.js";var f=u(`arrow-up-down`,[[`path`,{d:`m21 16-4 4-4-4`,key:`f6ql7i`}],[`path`,{d:`M17 20V4`,key:`1ejh1v`}],[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}]]),p=c();function m({...e}){return(0,p.jsx)(r,{"data-slot":`dropdown-menu`,...e})}function h({...e}){return(0,p.jsx)(s,{"data-slot":`dropdown-menu-trigger`,...e})}function g({align:t=`start`,alignOffset:n=0,side:r=`bottom`,sideOffset:o=4,className:s,...c}){return(0,p.jsx)(a,{children:(0,p.jsx)(i,{className:`isolate z-50 outline-none`,align:t,alignOffset:n,side:r,sideOffset:o,children:(0,p.jsx)(e,{"data-slot":`dropdown-menu-content`,className:d(`z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-[var(--miravo-radius-stadium-sm)] bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95`,s),...c})})})}function _({...e}){return(0,p.jsx)(o,{"data-slot":`dropdown-menu-group`,...e})}function v({className:e,inset:t,...r}){return(0,p.jsx)(n,{"data-slot":`dropdown-menu-label`,"data-inset":t,className:d(`px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7`,e),...r})}function y({className:e,inset:n,variant:r=`default`,...i}){return(0,p.jsx)(t,{"data-slot":`dropdown-menu-item`,"data-inset":n,"data-variant":r,className:d(`group/dropdown-menu-item relative flex cursor-pointer items-center gap-1.5 rounded-[var(--miravo-radius-tight)] px-1.5 py-1 text-sm outline-hidden select-none data-[highlighted]:bg-sidebar-accent data-[highlighted]:text-sidebar-accent-foreground not-data-[variant=destructive]:data-[highlighted]:**:text-sidebar-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:data-[highlighted]:bg-destructive/10 data-[variant=destructive]:data-[highlighted]:text-destructive data-[variant=destructive]:data-[highlighted]:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive`,e),...i})}function b({className:e,...t}){return(0,p.jsx)(l,{"data-slot":`dropdown-menu-separator`,className:d(`-mx-1 my-1 h-px bg-border`,e),...t})}var x=`miravo:factory-getting-started:tags-visited`;function S(e){try{return localStorage.getItem(e)===`1`}catch{return!1}}function C(e){try{localStorage.setItem(e,`1`)}catch{}}export{g as a,v as c,f as d,m as i,b as l,S as n,_ as o,C as r,y as s,x as t,h as u};
1
+ import{F as e,I as t,L as n,M as r,N as i,P as a,R as o,j as s,ot as c,tt as l}from"./vendor-ui-D8j69UH4.js";import{n as u,t as d}from"./utils-XFKvwlFT.js";var f=u(`arrow-up-down`,[[`path`,{d:`m21 16-4 4-4-4`,key:`f6ql7i`}],[`path`,{d:`M17 20V4`,key:`1ejh1v`}],[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}]]),p=c();function m({...e}){return(0,p.jsx)(r,{"data-slot":`dropdown-menu`,...e})}function h({...e}){return(0,p.jsx)(s,{"data-slot":`dropdown-menu-trigger`,...e})}function g({align:t=`start`,alignOffset:n=0,side:r=`bottom`,sideOffset:o=4,className:s,...c}){return(0,p.jsx)(a,{children:(0,p.jsx)(i,{className:`isolate z-50 outline-none`,align:t,alignOffset:n,side:r,sideOffset:o,children:(0,p.jsx)(e,{"data-slot":`dropdown-menu-content`,className:d(`z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-[var(--miravo-radius-stadium-sm)] bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95`,s),...c})})})}function _({...e}){return(0,p.jsx)(o,{"data-slot":`dropdown-menu-group`,...e})}function v({className:e,inset:t,...r}){return(0,p.jsx)(n,{"data-slot":`dropdown-menu-label`,"data-inset":t,className:d(`px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7`,e),...r})}function y({className:e,inset:n,variant:r=`default`,...i}){return(0,p.jsx)(t,{"data-slot":`dropdown-menu-item`,"data-inset":n,"data-variant":r,className:d(`group/dropdown-menu-item relative flex cursor-pointer items-center gap-1.5 rounded-[var(--miravo-radius-tight)] px-1.5 py-1 text-sm outline-hidden select-none data-[highlighted]:bg-sidebar-accent data-[highlighted]:text-sidebar-accent-foreground not-data-[variant=destructive]:data-[highlighted]:**:text-sidebar-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:data-[highlighted]:bg-destructive/10 data-[variant=destructive]:data-[highlighted]:text-destructive data-[variant=destructive]:data-[highlighted]:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive`,e),...i})}function b({className:e,...t}){return(0,p.jsx)(l,{"data-slot":`dropdown-menu-separator`,className:d(`-mx-1 my-1 h-px bg-border`,e),...t})}export{v as a,f as c,y as i,g as n,b as o,_ as r,h as s,m as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./events-RmbRTKFV.js";export{e as EventsPage};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{ot as n}from"./vendor-ui-D8j69UH4.js";import{S as r,o as i,ot as a,v as o}from"./api-B2QJEzbS.js";import{f as s,t as c}from"./useQuery-M9KTdi7Q.js";import{t as l}from"./proxy-CWZabK8f.js";import{t as u}from"./AnimatePresence-BSSlw02V.js";import{u as d}from"./chunk-OE4NN4TA-DBWZidbW.js";import{C as f}from"./format-Bx7DF-TB.js";import{t as p}from"./query-fetch-error-CWLZA2L5.js";import{n as m,t as ee}from"./use-transition-navigate-B-nk4aWh.js";import{t as h}from"./badge-Bk1DaL6C.js";import{n as te}from"./transition-types-BKZuWApE.js";import{n as ne}from"./auth-screen-backdrop-CEykEbfF.js";import{n as g}from"./get-error-message-dM0BMfdP.js";import{r as re}from"./runtime-link-vBANRqcD.js";import{a as ie,i as ae,n as oe,o as se,r as ce,s as le,t as ue}from"./combobox-B8h0-NHs.js";import{c as de,i as _,n as fe,s as pe,t as v}from"./select-BWlrSYlA.js";import{a as y,c as b,i as x,o as S,r as me,s as he,t as ge}from"./select-display-items-DN2G8DNG.js";import{a as _e,c as ve,i as ye,n as be,o as xe,r as Se,s as Ce,t as C}from"./events-format-C5HTkIsC.js";var w=e(t(),1),T=n(),E=1500;function D(){let e=s(),[t]=d(),n=t.get(`type`)??`all`,D=t.get(`assetId`)??``,[O,k]=(0,w.useState)(n),[A,j]=(0,w.useState)(D),[M,we]=(0,w.useState)(!0),N=re(a(e=>e.connectionState))===null,P=a(e=>e.events.length),F=(0,w.useRef)(!1),I=a(e=>e.assets),Te=ee(),L=c({queryKey:o.events(O,A),queryFn:()=>i(C(O,A,null),r.events),refetchInterval:M&&N?E:!1,staleTime:5e3}),[Ee,R]=(0,w.useState)([]),[De,z]=(0,w.useState)(!1),[Oe,B]=(0,w.useState)(null),V=`${O}::${A}`,H=(0,w.useRef)(V);(0,w.useEffect)(()=>{V!==H.current&&(H.current=V,R([]),B(null),W(!1))},[V]),(0,w.useEffect)(()=>{k(e=>e===n?e:n)},[n]),(0,w.useEffect)(()=>{j(e=>e===D?e:D)},[D]);let[U,W]=(0,w.useState)(()=>(L.data?.events.length??0)>0),G=L.data?[L.data,...Ee]:[],K=G.flatMap(e=>e.events).filter(e=>!ve(e)),q=G[G.length-1],ke=q?.hasMore??!1;(0,w.useEffect)(()=>{K.length>0&&!U&&W(!0)},[K.length,U]);let J=(0,w.useRef)(P);(0,w.useEffect)(()=>{P!==J.current&&(J.current=P,M&&N?(e.invalidateQueries({queryKey:o.events(O,A)}),F.current=!1):M&&(F.current=!0))},[P,M,N,e,O,A]),(0,w.useEffect)(()=>{!M||!N||!F.current||(F.current=!1,e.invalidateQueries({queryKey:o.events(O,A)}))},[M,N,e,O,A]);let[Y,Ae]=(0,w.useState)(``),X=(0,w.useMemo)(()=>Y?I.filter(e=>e.id.toLowerCase().includes(Y.toLowerCase())):I,[I,Y]),Z=L.isPending&&!L.data&&!L.isError,je=M&&!Z&&!U&&K.length===0,Q=L.error??Oe,Me=L.isError&&!L.data,$=(0,w.useCallback)(()=>{L.refetch()},[L]),Ne=async()=>{if(q?.nextCursor){z(!0),B(null);try{let e=await i(C(O,A,q.nextCursor),r.events);R(t=>[...t,e])}catch(e){B(e instanceof Error?e:Error(g(e,`Failed to fetch events.`)))}finally{z(!1)}}};if(Me)return(0,T.jsx)(ne,{className:`min-h-full`,children:(0,T.jsx)(`div`,{className:`flex min-h-[40vh] flex-col items-center justify-center p-6 sm:p-12`,children:(0,T.jsx)(`div`,{className:`w-full max-w-md`,children:(0,T.jsx)(p,{message:g(Q,`Failed to fetch events.`),onRetry:$,isRetrying:L.isFetching})})})});let Pe=new Date;return(0,T.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:[Q&&K.length>0?(0,T.jsx)(p,{message:`${g(Q,`Failed to fetch events.`)} Showing cached events.`,onRetry:$,isRetrying:L.isFetching}):null,(0,T.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3 lg:flex-row lg:items-center lg:justify-between lg:gap-4`,children:[(0,T.jsxs)(`div`,{className:`min-w-0 flex flex-col gap-1`,children:[(0,T.jsx)(`h1`,{className:`font-heading text-2xl font-semibold tracking-tight`,children:`Event Log`}),(0,T.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Real-time event stream from the engine.`}),M&&!N?(0,T.jsx)(`p`,{className:`text-xs text-warning`,role:`status`,children:`Live refresh pauses until the Miravo link is live again.`}):null]}),(0,T.jsxs)(`div`,{className:`flex w-full min-w-0 flex-col gap-2 sm:flex-row sm:flex-nowrap sm:items-center sm:gap-2 lg:w-auto lg:max-w-full`,children:[(0,T.jsx)(`button`,{type:`button`,onClick:()=>we(e=>!e),className:`flex h-7 shrink-0 items-center self-start overflow-hidden rounded-[var(--miravo-radius-tight)] border border-border/40 px-2 py-1 text-xs transition-colors hover:bg-muted sm:self-auto`,children:(0,T.jsx)(u,{mode:`wait`,initial:!1,children:M?(0,T.jsxs)(l.span,{initial:{opacity:0,y:-6},animate:{opacity:1,y:0},exit:{opacity:0,y:6},transition:{type:`spring`,stiffness:500,damping:35},className:`flex items-center gap-1.5`,children:[(0,T.jsx)(`span`,{className:`size-1.5 animate-pulse rounded-full bg-success`}),(0,T.jsx)(`span`,{className:`font-medium text-success`,children:`LIVE`})]},`live`):(0,T.jsxs)(l.span,{initial:{opacity:0,y:-6},animate:{opacity:1,y:0},exit:{opacity:0,y:6},transition:{type:`spring`,stiffness:500,damping:35},className:`flex items-center gap-1.5`,children:[(0,T.jsx)(`span`,{className:`size-1.5 rounded-full bg-muted-foreground`}),(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:`Paused`})]},`paused`)})}),(0,T.jsx)(`div`,{className:`min-w-0 flex-1 lg:w-48 lg:flex-none`,children:(0,T.jsxs)(ue,{value:A||null,onValueChange:e=>{j(e??``)},onInputValueChange:Ae,children:[(0,T.jsx)(ce,{placeholder:`All assets`,className:`h-8 w-full min-w-0`,showClear:!!A}),(0,T.jsx)(oe,{children:(0,T.jsxs)(ie,{children:[X.map(e=>(0,T.jsx)(ae,{value:e.id,children:(0,T.jsx)(`span`,{className:`font-mono`,children:e.id})},e.id)),X.length===0&&(0,T.jsx)(`p`,{className:`py-2 text-center text-xs text-muted-foreground`,children:`No assets found`})]})})]})}),(0,T.jsx)(`div`,{className:`min-w-0 flex-1 lg:w-48 lg:flex-none`,children:(0,T.jsxs)(v,{value:O,onValueChange:e=>{k(e??`all`)},items:ge,children:[(0,T.jsx)(pe,{className:`w-full min-w-0 lg:w-48`,"aria-label":`Event type filter`,children:(0,T.jsx)(de,{placeholder:`Filter by type`})}),(0,T.jsxs)(fe,{alignItemWithTrigger:!1,align:`start`,children:[(0,T.jsx)(_,{value:`all`,children:`All events`}),(0,T.jsx)(_,{value:`fault:triggered`,children:`Fault Triggered`}),(0,T.jsx)(_,{value:`fault:cleared`,children:`Fault Cleared`}),(0,T.jsx)(_,{value:`lifecycle:changed`,children:`Lifecycle Changed`}),(0,T.jsx)(_,{value:`asset:maintenance`,children:`Maintenance`}),(0,T.jsx)(_,{value:`asset:created`,children:`Asset Created`}),(0,T.jsx)(_,{value:`asset:removed`,children:`Asset Removed`}),(0,T.jsx)(_,{value:`engine:state-changed`,children:`Engine State`})]})]})})]})]}),(0,T.jsx)(se,{className:`min-w-0 py-0`,children:(0,T.jsx)(le,{className:`p-0`,children:(0,T.jsxs)(me,{children:[(0,T.jsx)(he,{children:(0,T.jsxs)(b,{children:[(0,T.jsx)(S,{className:`hidden w-12 sm:table-cell`,children:`#`}),(0,T.jsx)(S,{children:`Type`}),(0,T.jsx)(S,{children:`Context`}),(0,T.jsx)(S,{children:`Details`}),(0,T.jsx)(S,{className:`hidden text-right md:table-cell`,children:`Cycle #`}),(0,T.jsx)(S,{className:`hidden text-right sm:table-cell`,children:`Wall Clock`})]})}),(0,T.jsxs)(x,{children:[K.map(e=>{let t=xe(e),n=Ce(e);return(0,T.jsxs)(b,{className:t?`transition-colors`:``,onMouseEnter:t?()=>m(`/asset/${t}`):void 0,children:[(0,T.jsx)(y,{className:`hidden font-mono text-xs text-muted-foreground sm:table-cell`,children:e.id}),(0,T.jsx)(y,{children:(0,T.jsx)(h,{variant:Se(e.type),className:`text-xs ${be(e.type)}`,children:e.type})}),(0,T.jsx)(y,{className:`font-mono text-xs`,children:t?(0,T.jsx)(`button`,{type:`button`,className:`rounded-[var(--miravo-radius-tight)] text-left text-primary outline-none underline-offset-4 hover:underline focus-visible:ring-2 focus-visible:ring-ring/70 focus-visible:ring-offset-2 focus-visible:ring-offset-background`,onFocus:()=>m(`/asset/${t}`),onClick:()=>Te(`/asset/${t}`,{transitionType:te}),children:n??t}):n??`—`}),(0,T.jsx)(y,{className:`max-w-xs truncate font-mono text-xs`,children:ye(e)||(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,T.jsx)(y,{className:`hidden text-right font-mono text-xs md:table-cell`,children:e.tick}),(0,T.jsx)(y,{className:`hidden text-right text-xs text-muted-foreground sm:table-cell`,children:_e(e.timestamp,Pe)})]},e.id)}),!Z&&K.length===0&&(0,T.jsx)(b,{children:(0,T.jsx)(y,{colSpan:6,className:`py-8 text-center text-muted-foreground`,children:je?`Listening for events…`:`No events`})})]})]})})}),ke&&(0,T.jsx)(`div`,{className:`flex justify-center border-t border-border/40 pt-4`,children:(0,T.jsx)(f,{variant:`outline`,size:`sm`,onClick:()=>void Ne(),disabled:De,children:`Load older events`})})]})}export{D as t};
@@ -0,0 +1 @@
1
+ import{g as e,t}from"./format-Bx7DF-TB.js";function n(e){return e.includes(`triggered`)?`destructive`:e.includes(`cleared`)||e.includes(`created`)?`default`:e.includes(`removed`)||e.includes(`lifecycle`)?`secondary`:(e.includes(`state-changed`),`outline`)}function r(e){return e.includes(`state-changed`)?`border-info/30 bg-info/20 text-info hover:bg-info/20`:``}function i(e){return e.type===`integration:operation`||e.type===`integration:resource`}function a(e,n){let r=new Date(e);return r.toDateString()===n.toDateString()?r.toLocaleTimeString(t):r.toLocaleString(t,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function o(e){if(`assetId`in e&&typeof e.assetId==`string`)return e.assetId}function s(e){return o(e)}function c(t){return`fault`in t?e(t.fault):`from`in t&&`to`in t?`${e(t.from)} \u2192 ${e(t.to)}`:``}function l(e,t,n){let r=new URLSearchParams;return r.set(`limit`,`50`),e!==`all`&&r.set(`type`,e),t&&r.set(`assetId`,t),n!==null&&r.set(`cursor`,String(n)),`/events?${r.toString()}`}export{a,i as c,c as i,r as n,o,n as r,s,l as t};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{$ as n,J as r,Q as i,X as a,Y as o,Z as s,et as c,ot as l}from"./vendor-ui-D8j69UH4.js";import{H as u,L as d,S as f,a as p,o as m,s as h}from"./api-B2QJEzbS.js";import{a as g,c as _,i as v,n as y,o as b,r as x,t as ee}from"./dialog-B5PqrKVw.js";import{C as S,S as C,T as w}from"./format-Bx7DF-TB.js";import{n as T,t as E}from"./utils-XFKvwlFT.js";import{t as D}from"./chevron-down-x70Pto6j.js";import{t as O}from"./download-i8CTJ7oi.js";import{n as k,t as A}from"./source-host-miravo-B8eM2IHw.js";import{t as j}from"./loader-circle-DjgHgHHl.js";import{t as M}from"./label-2sIXTEUK.js";import"./use-engine-command-mutation-CHqjOqfS.js";var N=T(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),P=l();function F({...e}){return(0,P.jsx)(o,{"data-slot":`sheet`,...e})}function I({...e}){return(0,P.jsx)(a,{"data-slot":`sheet-portal`,...e})}function L({className:e,...t}){return(0,P.jsx)(c,{"data-slot":`sheet-overlay`,className:E(`fixed inset-0 z-50 bg-black/10 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs`,e),...t})}function R({className:e,children:t,side:r=`right`,showCloseButton:i=!0,...a}){return(0,P.jsxs)(I,{children:[(0,P.jsx)(L,{}),(0,P.jsxs)(s,{"data-slot":`sheet-content`,"data-side":r,className:E(`fixed z-50 flex flex-col gap-4 bg-background bg-clip-padding text-sm shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-[calc(100vw-1rem)] data-[side=left]:max-w-md data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-[calc(100vw-1rem)] data-[side=right]:max-w-xl data-[side=right]:border-l data-[side=right]:pl-1 data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem]`,e),...a,children:[t,i&&(0,P.jsxs)(n,{"data-slot":`sheet-close`,render:(0,P.jsx)(S,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`}),children:[(0,P.jsx)(w,{}),(0,P.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function z({className:e,...t}){return(0,P.jsx)(`div`,{"data-slot":`sheet-header`,className:E(`flex flex-col gap-0.5 p-2`,e),...t})}function B({className:e,...t}){return(0,P.jsx)(r,{"data-slot":`sheet-title`,className:E(`text-base font-medium text-foreground`,e),...t})}function V({className:e,...t}){return(0,P.jsx)(i,{"data-slot":`sheet-description`,className:E(`text-sm text-muted-foreground`,e),...t})}var H=e(t(),1);function U({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 W({children:e,className:t}){return(0,P.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})}var G=[`modbus`,`opcua`,`mqtt`],K={modbus:`Modbus`,opcua:`OPC UA`,mqtt:`MQTT`};function q(e){return e===``?null:!/^\d+$/.test(e)||!u(Number(e))?`Use a port from 1 to 65535.`:null}function J(e){return Object.fromEntries(Object.entries(e??{}).map(([e,t])=>[e,String(t)]))}function Y(e,t,n){let r={...e};for(let e of n){let n=(t[e]??``).trim();if(q(n))return null;n===``?delete r[e]:r[e]=Number(n)}return r}function X({open:e,onOpenChange:t,protocols:n,values:r,onChange:i,hint:a}){let o=(0,H.useId)();return(0,P.jsxs)(`div`,{children:[(0,P.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,P.jsx)(D,{className:E(`size-3 transition-transform`,!e&&`-rotate-90`),"aria-hidden":!0}),`Miravo ports remapped (Docker)?`]}),e?(0,P.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[(0,P.jsx)(`p`,{className:`text-[11px] leading-snug text-muted-foreground`,children:a}),(0,P.jsx)(`div`,{className:`flex flex-wrap gap-3`,children:n.map(e=>{let t=r[e]??``,n=q(t.trim());return(0,P.jsxs)(`div`,{className:`w-24 space-y-1`,children:[(0,P.jsx)(M,{htmlFor:`${o}-${e}`,className:`text-[11px] text-muted-foreground`,children:K[e]}),(0,P.jsx)(C,{id:`${o}-${e}`,inputMode:`numeric`,placeholder:String(d[e]),value:t,"aria-invalid":n!==null,onChange:t=>i({...r,[e]:t.currentTarget.value}),className:`h-8 font-mono text-[12px]`}),n?(0,P.jsx)(`p`,{className:`text-[10px] text-destructive`,children:n}):null]},e)})})]}):null]})}var Z=`172.17.0.1`;async function Q(e){let t=await m(`/catalog/models/${encodeURIComponent(e)}/le-dt.json`,f.catalogModelLeDt);return JSON.stringify(t,null,2)}async function te(e,t={host:Z}){let n=f.catalogTemplateLeTemplateJson.query;if(!n)throw Error(`Missing query schema for ${f.catalogTemplateLeTemplateJson.method} ${f.catalogTemplateLeTemplateJson.path}`);let r=n.safeParse({host:t.host,protocol:t.protocol,modbusPort:t.exposedPorts?.modbus,opcuaPort:t.exposedPorts?.opcua,mqttPort:t.exposedPorts?.mqtt});if(!r.success)throw Error(`Invalid request for ${f.catalogTemplateLeTemplateJson.method} ${f.catalogTemplateLeTemplateJson.path}: ${r.error.message}`);return p(ne(e,r.data),f.catalogTemplateLeTemplateJson)}function ne(e,t){return`/catalog/templates/${encodeURIComponent(e)}/le-template.json${re(t)}`}function re(e){let t=new URLSearchParams;for(let[n,r]of Object.entries(e))r!==void 0&&r!==``&&t.set(n,String(r));return t.size>0?`?${t.toString()}`:``}function $(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,r.click(),URL.revokeObjectURL(n),_.success(`Exported ${t}`)}function ie({kind:e,id:t,yamlPath:n,yamlFilename:r}){let[i,a]=(0,H.useState)(!1),[o,s]=(0,H.useState)(Z),[c,l]=(0,H.useState)(!1),[u,d]=(0,H.useState)({}),[p,m]=(0,H.useState)(!1),w=(0,H.useCallback)(async()=>{try{let t=await h(n,e===`model`?f.catalogModelYaml:f.catalogTemplateYaml);$(new Blob([t],{type:`text/yaml`}),r)}catch{_.error(`Failed to export YAML`)}},[e,n,r]),T=(0,H.useCallback)(async()=>{try{let e=await Q(t);$(new Blob([e],{type:`application/json`}),`${t}.le-dt.json`)}catch{_.error(`Failed to export integration format`)}},[t]),E=(0,H.useCallback)(async(e,n)=>{try{let r=e.trim();return $(await te(t,{host:r.length>0?r:Z,exposedPorts:n}),`${t}.le-template.json`),!0}catch{return _.error(`Failed to export integration format`),!1}},[t]),D=(0,H.useCallback)(()=>{s(Z),d({}),l(!1),a(!0)},[]),N=(0,H.useCallback)(async()=>{let e=Y(void 0,u,G);if(!e){l(!0);return}m(!0);try{await E(o,e)&&a(!1)}finally{m(!1)}},[u,o,E]);return(0,P.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto pb-2`,children:[[{key:`source-yaml`,label:e===`model`?`Source YAML (.asset.yaml)`:`Source YAML (.miravo.yaml)`,onDownload:()=>void w()},{key:`litmus-edge`,label:e===`model`?`Litmus Edge Digital Twin (JSON)`:`Litmus Edge template (JSON)`,onDownload:e===`model`?()=>void T():D}].map(t=>(0,P.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-[var(--miravo-radius-stadium-sm)] border border-border/60 p-3`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,P.jsx)(`span`,{className:`text-xs font-medium text-foreground`,children:t.label}),(0,P.jsxs)(S,{variant:`outline`,size:`sm`,className:`h-8 shrink-0 gap-1.5 text-xs`,"aria-label":`Download ${t.label}`,onClick:t.onDownload,children:[(0,P.jsx)(O,{className:`size-3.5`,"aria-hidden":!0}),`Download`]})]}),(0,P.jsx)(`p`,{className:`text-[11px] leading-snug text-foreground/70`,children:(0,P.jsx)(U,{format:t.key,kind:e})})]},t.key)),(0,P.jsx)(ee,{open:i,onOpenChange:a,children:(0,P.jsxs)(y,{className:`sm:max-w-md`,children:[(0,P.jsxs)(g,{children:[(0,P.jsx)(b,{children:`Download Litmus Edge Template`}),(0,P.jsx)(x,{children:A})]}),(0,P.jsxs)(`div`,{className:`space-y-2 py-1`,children:[(0,P.jsx)(M,{htmlFor:`export-source-host`,children:k}),(0,P.jsx)(C,{id:`export-source-host`,value:o,onChange:e=>s(e.target.value),placeholder:Z,autoComplete:`off`,className:`font-mono text-sm`}),(0,P.jsxs)(`p`,{className:`text-[11px] leading-snug text-muted-foreground`,children:[`Use an IP or hostname reachable from Litmus Edge (e.g.`,` `,(0,P.jsx)(`span`,{className:`font-mono`,children:Z}),` for Docker bridge).`]}),(0,P.jsx)(X,{open:c,onOpenChange:l,protocols:G,values:u,onChange:d,hint:`Enter the host port Litmus Edge should dial. Leave blank to use Miravo's own port.`})]}),(0,P.jsxs)(v,{className:`gap-2 sm:gap-0`,children:[(0,P.jsx)(S,{type:`button`,variant:`outline`,onClick:()=>a(!1),disabled:p,children:`Cancel`}),(0,P.jsxs)(S,{type:`button`,className:`gap-1.5`,onClick:()=>void N(),disabled:p,"aria-busy":p,children:[p?(0,P.jsx)(j,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,P.jsx)(O,{className:`size-3.5`,"aria-hidden":!0}),`Download`]})]})]})})]})}export{J as a,R as c,B as d,N as f,Y as i,V as l,X as n,W as o,G as r,F as s,ie as t,z as u};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{c as t}from"./vendor-charts-95ykyDlI.js";import{ot as n}from"./vendor-ui-D8j69UH4.js";import{S as r,o as i,ot as a,v as o,y as s}from"./api-B2QJEzbS.js";import{f as c,t as l}from"./useQuery-M9KTdi7Q.js";import{t as u,u as d}from"./proxy-CWZabK8f.js";import{t as f}from"./AnimatePresence-BSSlw02V.js";import{i as p,n as m,r as h}from"./dist-xY0pK9Wy.js";import{n as g,s as _}from"./chunk-OE4NN4TA-DBWZidbW.js";import{a as v,i as y,n as b,o as ee,r as x,t as te}from"./dialog-B5PqrKVw.js";import{r as S,t as C}from"./protocol-card-ARSwIjkN.js";import{C as w,S as ne,T as re,c as T,d as E,g as D,h as O,l as k,m as A,p as j,s as M,u as N,v as ie,w as P,y as F}from"./format-Bx7DF-TB.js";import{n as I,t as L}from"./utils-XFKvwlFT.js";import{t as R}from"./activity-Cy_niK56.js";import{n as ae,r as oe,t as z}from"./server-BVem_egD.js";import{c as se,i as ce,n as le,s as ue,t as de}from"./dropdown-menu-B_MMNbTy.js";import{i as fe,n as pe,t as me}from"./catalog-template-icons-BOSywIKV.js";import{t as he}from"./chevron-down-x70Pto6j.js";import{t as ge}from"./chevron-right-CMSQPSEo.js";import{n as _e,t as ve}from"./circle-x-_o0nl0Rg.js";import{a as ye,c as be,i as xe,l as Se,o as Ce,p as we,s as Te,t as Ee,u as De}from"./integration-api-D2tA69Yb.js";import{t as Oe}from"./copy-button-CSUP1VjU.js";import{n as ke,r as Ae,t as je}from"./source-host-miravo-B8eM2IHw.js";import{t as Me}from"./factory-DLE12zAd.js";import{t as B}from"./loader-circle-DjgHgHHl.js";import{t as Ne}from"./plus-Cl4Ay5Ry.js";import{t as Pe}from"./radio-BxpVYiyS.js";import{t as Fe}from"./query-fetch-error-CWLZA2L5.js";import{t as Ie}from"./rocket-KZ5oHK1G.js";import{a as Le,f as Re,i as ze,n as Be,o as Ve,r as He}from"./export-tab-fZDO4r2u.js";import{t as Ue}from"./trash-2-BH9HDsZv.js";import{t as We}from"./triangle-alert-DoAwrRgk.js";import{i as V,n as H,t as U}from"./tooltip-B3vOB1Vu.js";import{n as Ge,t as Ke}from"./use-transition-navigate-B-nk4aWh.js";import{t as qe}from"./badge-Bk1DaL6C.js";import{n as Je}from"./transition-types-BKZuWApE.js";import{t as Ye}from"./label-2sIXTEUK.js";import{n as Xe,t as Ze}from"./get-error-message-dM0BMfdP.js";import{c as Qe,i as $e,o as et,t as tt}from"./use-engine-command-mutation-CHqjOqfS.js";import{i as nt,n as rt,r as it,t as at}from"./tabs-BbQkzBZZ.js";import{i as W,n as G,r as K,t as ot}from"./console-panel-CMDoBJiO.js";import{a as st,i as ct,n as lt,o as ut,r as dt,s as ft,t as pt}from"./combobox-B8h0-NHs.js";import{c as mt,i as q,n as ht,s as gt,t as _t}from"./select-BWlrSYlA.js";import{a as J,c as vt,i as yt,n as bt,o as xt,r as St,s as Ct}from"./select-display-items-DN2G8DNG.js";import{t as wt}from"./checkbox-DEAkDfFr.js";import{n as Tt,r as Et,t as Dt}from"./integration-targets-Byvdd3Or.js";import{n as Ot,t as kt}from"./registry-Dau_GjK6.js";var At=I(`ban`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}]]),jt=I(`book-open`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),Mt=I(`boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),Nt=I(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),Pt=I(`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`}]]),Ft=I(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),It=I(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),Lt=I(`component`,[[`path`,{d:`M15.536 11.293a1 1 0 0 0 0 1.414l2.376 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z`,key:`1uwlt4`}],[`path`,{d:`M2.297 11.293a1 1 0 0 0 0 1.414l2.377 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414L6.088 8.916a1 1 0 0 0-1.414 0z`,key:`10291m`}],[`path`,{d:`M8.916 17.912a1 1 0 0 0 0 1.415l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.415l-2.377-2.376a1 1 0 0 0-1.414 0z`,key:`1tqoq1`}],[`path`,{d:`M8.916 4.674a1 1 0 0 0 0 1.414l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z`,key:`1x6lto`}]]),Rt=I(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),zt=I(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),Bt=I(`plug-zap`,[[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m18 3-4 4h6l-4 4`,key:`16psg9`}]]),Vt=I(`plug`,[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`,key:`1xoxul`}],[`path`,{d:`M9 8V2`,key:`14iosj`}]]),Ht=I(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),Y=e(t(),1),X=n();function Z({className:e,...t}){return(0,X.jsx)(`div`,{"data-slot":`skeleton`,className:L(`animate-pulse rounded-[var(--miravo-radius-tight)] bg-muted`,e),...t})}var Ut=`https://miravo.dev/docs`;function Wt(){let{adapters:e,metrics:t}=a(S(e=>({adapters:e.availableAdapters,metrics:e.adapterMetrics}))),n=e.filter(e=>e.enabled&&!e.pending&&e.endpoint),r=e.filter(e=>!n.includes(e)),i=e=>t.find(t=>t.name===e)?.metrics.clients?.active??0,o=n.reduce((e,t)=>e+i(t.name),0);return(0,X.jsxs)(ot,{id:`connect`,icon:Bt,title:`Connect`,description:`Point a client here to read live values.`,aside:(0,X.jsxs)(W,{tone:o>0?`live`:n.length>0?`idle`:`off`,children:[(0,X.jsx)(`span`,{className:`mr-1.5 font-mono font-semibold tabular-nums text-foreground`,children:o}),(0,X.jsx)(K,{children:o===1?`client`:`clients`})]}),bodyClassName:`gap-2`,footer:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(g,{to:`/control`,className:G,children:[`Configure protocols`,(0,X.jsx)(oe,{className:`size-3`,"aria-hidden":!0})]}),(0,X.jsxs)(`a`,{href:`${Ut}/protocols`,target:`_blank`,rel:`noopener noreferrer`,className:L(G,`ml-auto`),children:[(0,X.jsx)(jt,{className:`size-3`,"aria-hidden":!0}),`Protocol docs`]})]}),children:[n.length===0&&(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No protocol is serving yet.`}),n.map(e=>{let t=i(e.name),n=C[e.name]??e.name;return(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1 rounded-[var(--miravo-radius-stadium-sm)] border border-muted-foreground/20 bg-background/40 px-3 py-2.5 transition-colors hover:border-muted-foreground/25`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`span`,{"aria-hidden":!0,className:L(`size-1.5 shrink-0 rounded-full`,t>0?`bg-success`:`bg-muted-foreground/55`)}),(0,X.jsx)(`span`,{className:`text-sm font-medium tracking-tight`,children:n}),(0,X.jsxs)(`span`,{className:`ml-auto font-mono text-[11px] text-muted-foreground`,children:[(0,X.jsx)(`span`,{className:t>0?`text-foreground`:void 0,children:t}),` `,`connected`]})]}),(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1 pl-3.5`,children:[(0,X.jsx)(`code`,{className:`min-w-0 truncate font-mono text-xs text-muted-foreground`,children:e.endpoint}),(0,X.jsx)(Oe,{value:e.endpoint??``,label:`Copy ${n} endpoint`})]})]},e.name)}),r.length>0&&(0,X.jsxs)(`p`,{className:`pt-1 text-xs text-muted-foreground`,children:[r.map(e=>C[e.name]??e.name).join(`, `),` `,r.length===1?`is`:`are`,` off.`]})]})}var Gt=[`devices`,`models`,`assets`],Kt=[`assets`,`models`,`devices`],qt={devices:`DeviceHub devices`,models:`Digital Twins models`,assets:`Digital Twins instances`},Jt={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.`}},Yt=`Miravo calls this API.`,Xt={assets:`models`};function Zt(e,t){let n=new Set(e);if(n.has(t)){n.delete(t);for(let[e,r]of Object.entries(Xt))r===t&&n.delete(e)}else{n.add(t);let e=Xt[t];e&&n.add(e)}return n}var Qt=[{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 $t({open:e,onOpenChange:t,isApply:n,scopeOptions:r,scope:i,onToggleScope:a,ifUnmanaged:o,onIfUnmanagedChange:s}){let c=(0,Y.useId)(),l=`if-unmanaged-${c}`;return(0,X.jsxs)(X.Fragment,{children:[(0,X.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,X.jsx)(he,{className:L(`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,X.jsxs)(u.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:L(`overflow-hidden`,!e&&`pointer-events-none`),"aria-hidden":!e,inert:!e,children:[(0,X.jsx)(`div`,{className:`flex flex-col gap-1 pt-px`,children:r.map(e=>{let t=Object.entries(Xt).find(([t,n])=>n===e)?.[0],r=t!==void 0&&i.has(t),o=n?Jt[e].apply:Jt[e].cleanup;return(0,X.jsxs)(Ye,{htmlFor:`scope-${e}`,className:L(`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,X.jsx)(`span`,{className:`pt-0.5`,children:(0,X.jsx)(wt,{id:`scope-${e}`,checked:i.has(e),disabled:r,onCheckedChange:()=>a(e)})}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1 leading-snug`,children:[(0,X.jsx)(`span`,{className:`font-medium text-foreground`,children:qt[e]}),(0,X.jsx)(`span`,{className:`mt-0.5 block text-[11px] font-normal leading-tight text-muted-foreground`,children:o})]}),r?(0,X.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,X.jsxs)(`div`,{className:`mt-2.5 space-y-1.5 border-t border-border/40 pt-2`,children:[(0,X.jsx)(`p`,{id:`${c}-legend`,className:`text-[11px] font-medium uppercase tracking-wide text-foreground/80`,children:`Collision policy`}),(0,X.jsx)(`div`,{role:`radiogroup`,"aria-labelledby":`${c}-legend`,className:`flex flex-col gap-1`,children:Qt.map(e=>(0,X.jsxs)(Ye,{htmlFor:`if-unmanaged-${e.value}`,className:L(`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,X.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,X.jsxs)(`span`,{className:`min-w-0`,children:[(0,X.jsx)(`span`,{className:`font-medium text-foreground`,children:e.title}),(0,X.jsx)(`span`,{className:`mt-px block text-[11px] leading-tight text-foreground/74`,children:e.hint})]})]},e.value))})]})]})]})}function en({label:e,help:t,mono:n=!1,children:r}){return(0,X.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,X.jsx)(`dt`,{className:`min-w-0 pt-px`,children:(0,X.jsxs)(`span`,{className:`inline-flex max-w-full items-center gap-1`,children:[(0,X.jsx)(`span`,{className:`text-[11px] font-medium leading-snug text-muted-foreground`,children:e}),(0,X.jsxs)(U,{children:[(0,X.jsx)(V,{type:`button`,className:`inline-flex size-5 shrink-0 items-center justify-center rounded-[var(--miravo-radius-tight)] text-muted-foreground hover:bg-muted hover:text-foreground`,"aria-label":`About ${e}`,children:(0,X.jsx)(we,{className:`size-3`,"aria-hidden":!0})}),(0,X.jsx)(H,{side:`top`,align:`start`,className:`max-w-xs text-left`,children:t})]})]})}):(0,X.jsx)(`dt`,{className:`min-w-0 pt-px text-[11px] font-medium text-muted-foreground`,children:e}),n?(0,X.jsx)(`dd`,{className:`min-w-0 break-all font-mono text-[11px] leading-normal text-foreground/90`,children:r}):(0,X.jsx)(`dd`,{className:`min-w-0 wrap-break-word font-medium text-foreground`,children:r})]})}function tn({targetId:e,subject:t,result:n}){return{targetId:e,...t.kind===`template`?{templateId:t.templateId}:{assetId:t.assetId,protocol:t.protocol},scope:n.scope,ifUnmanaged:n.ifUnmanaged,exposedPorts:n.exposedPorts}}function nn({targetId:e,subject:t,result:n}){return{targetId:e,...t.kind===`template`?{templateId:t.templateId}:{assetId:t.assetId},scope:n.scope}}var rn=/^\(?unchanged\)?$/i,an=/^device=(\S+)/;function on(e){let t=e.blockReason??e.detail;if(!(!t||rn.test(t)))return t.replace(/^\((.*)\)$/,`$1`)}function sn(e){let t=new Map;for(let n of e)n.resourceType===`param-sync`&&t.set(n.name,n);let n=[],r=new Set;for(let i of e){if(i.resourceType===`param-sync`)continue;let e=i.resourceType===`asset`?t.get(i.name):void 0;e&&r.add(i.name);let a=e!==void 0&&i.action===`noop`&&e.action!==`noop`;n.push({action:a?e.action:i.action,resourceType:i.resourceType,name:i.name,protocol:i.protocol,note:a?`device binding changes`:on(i),boundDevice:e?.detail?.match(an)?.[1]})}for(let[e,i]of t)r.has(e)||n.push({action:i.action,resourceType:`asset`,name:e,note:on(i),boundDevice:i.detail?.match(an)?.[1]});return n}function cn(e){let t=new Map;for(let n of e){let e=t.get(n.action);e?e.push(n):t.set(n.action,[n])}return t}function ln(e){return sn(e).filter(e=>e.action!==`noop`&&e.action!==`blocked`).length}var un={create:{label:`Create`,phrase:`to create`,dot:`bg-success`,text:`text-success`},update:{label:`Update`,phrase:`to update`,dot:`bg-info`,text:`text-info`},replace:{label:`Replace`,phrase:`to replace`,dot:`bg-chart-2`,text:`text-chart-2`},delete:{label:`Remove`,phrase:`to remove`,dot:`bg-destructive`,text:`text-destructive`},blocked:{label:`Skipped`,phrase:`skipped`,dot:`bg-warning`,text:`text-warning`},noop:{label:`Unchanged`,phrase:`unchanged`,dot:`bg-muted-foreground/40`,text:`text-muted-foreground`}},dn=[`create`,`update`,`replace`,`delete`,`noop`],fn=[`create`,`update`,`replace`,`delete`],pn=6,mn={device:[`device`,`devices`],model:[`twin model`,`twin models`],asset:[`twin instance`,`twin instances`]};function hn(e,[t,n]){return`${e} ${e===1?t:n}`}function gn(e){let t=new Map;for(let n of e){let e=t.get(n.resourceType);e?e.push(n):t.set(n.resourceType,[n])}return[...t]}function _n(e){return gn(e).map(([e,t])=>hn(t.length,mn[e])).join(` · `)}function vn(e){return`${e.action}-${e.resourceType}-${e.name}-${e.protocol??``}`}function yn(e){return e.map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(`, `)}function bn({groups:e}){return(0,X.jsx)(`div`,{"aria-hidden":!0,className:`flex h-1.5 w-full gap-0.5 overflow-hidden rounded-full`,children:[`blocked`,...dn].map(t=>{let n=e.get(t)?.length??0;return n>0?(0,X.jsx)(`span`,{className:L(`h-full rounded-full`,un[t].dot),style:{flexGrow:n}},t):null})})}function xn({entry:e}){let{note:t}=e;return(0,X.jsxs)(`li`,{className:`flex min-w-0 items-baseline gap-2 py-1`,children:[(0,X.jsx)(`span`,{className:`min-w-0 truncate font-mono text-[11.5px] text-foreground`,title:e.name,children:e.name}),e.protocol?(0,X.jsx)(`span`,{className:`shrink-0 rounded-[var(--miravo-radius-tight)] border border-border/60 px-1 font-mono text-[9.5px] uppercase text-muted-foreground`,children:e.protocol}):null,e.boundDevice?(0,X.jsxs)(`span`,{className:`shrink-0 font-mono text-[10.5px] text-muted-foreground`,title:`Device this twin instance reads from`,children:[`→ `,e.boundDevice]}):null,t?(0,X.jsx)(`span`,{className:`min-w-0 truncate text-[11px] text-muted-foreground`,title:t,children:t}):null]})}function Sn({action:e,entries:t,open:n,onToggle:r}){let i=un[e];return(0,X.jsxs)(`li`,{children:[(0,X.jsxs)(`button`,{type:`button`,onClick:r,"aria-expanded":n,className:`group flex w-full min-w-0 items-center gap-3 rounded-[var(--miravo-radius-tight)] px-2 py-2 text-left outline-none transition-colors hover:bg-muted/40 focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,X.jsx)(`span`,{"aria-hidden":!0,className:L(`size-2 shrink-0 rounded-full`,i.dot)}),(0,X.jsx)(`span`,{className:L(`w-20 shrink-0 text-sm font-medium`,e===`noop`?`text-muted-foreground`:`text-foreground`),children:i.label}),(0,X.jsx)(`span`,{className:L(`w-8 shrink-0 font-mono text-sm tabular-nums`,i.text),children:t.length}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-muted-foreground`,children:_n(t)}),(0,X.jsx)(ge,{"aria-hidden":!0,className:L(`size-3.5 shrink-0 text-muted-foreground transition-transform duration-200`,n&&`rotate-90`)})]}),n?(0,X.jsx)(`div`,{className:`mb-2 ml-[1.1rem] flex flex-col gap-2 border-l border-border/60 pt-1 pl-[1.9rem]`,children:gn(t).map(([e,t])=>(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`text-[10px] uppercase tracking-(--miravo-tracking-eyebrow) text-muted-foreground`,children:mn[e][1]}),(0,X.jsx)(`ul`,{children:t.map(e=>(0,X.jsx)(xn,{entry:e},vn(e)))})]},e))}):null]})}function Cn({entries:e}){return(0,X.jsxs)(`div`,{role:`note`,className:`rounded-[var(--miravo-radius-tight)] border border-warning/30 bg-warning/8 px-3 py-2.5`,children:[(0,X.jsxs)(`p`,{className:`flex items-center gap-2 text-xs font-medium text-warning`,children:[(0,X.jsx)(We,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),e.length,` `,e.length===1?`resource is`:`resources are`,` skipped`]}),(0,X.jsx)(`ul`,{className:`mt-1 pl-5.5`,children:e.map(e=>(0,X.jsx)(xn,{entry:e},vn(e)))})]})}function wn({groups:e,planKind:t}){let n=fn.filter(t=>(e.get(t)?.length??0)>0);return n.length===0?(0,X.jsx)(`p`,{className:`font-heading text-base font-semibold tracking-tight`,children:t===`cleanup`?`Nothing to remove`:`Nothing to change`}):(0,X.jsx)(`p`,{className:`font-heading text-base font-semibold tracking-tight`,children:n.map((t,n)=>(0,X.jsxs)(Y.Fragment,{children:[n>0?(0,X.jsx)(`span`,{className:`mx-1.5 font-normal text-muted-foreground/60`,children:`·`}):null,(0,X.jsx)(`span`,{className:L(`font-mono tabular-nums`,un[t].text),children:e.get(t)?.length}),` `,(0,X.jsx)(`span`,{className:`font-normal text-foreground/90`,children:un[t].phrase})]},t))})}function Tn({plan:e,planKind:t=`apply`}){let n=sn(e.entries),r=cn(n),i=fn.reduce((e,t)=>e+(r.get(t)?.length??0),0),[a,o]=(0,Y.useState)(()=>new Set(i<=pn?fn:[])),s=e=>o(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),c=r.get(`blocked`)??[],l=r.get(`noop`)?.length??0;return(0,X.jsxs)(`section`,{"aria-label":`Dry run`,className:`flex flex-col gap-3 rounded-[var(--miravo-radius-stadium-sm)] border border-border/60 bg-background/40 p-4`,children:[(0,X.jsx)(`div`,{className:`flex items-start justify-between gap-3`,children:(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,X.jsxs)(`p`,{className:`text-[10px] uppercase tracking-(--miravo-tracking-eyebrow) text-muted-foreground`,children:[t===`cleanup`?`Expected removals`:`Expected changes`,(0,X.jsx)(`span`,{className:`ml-2 normal-case tracking-normal text-muted-foreground/80`,children:`dry run · nothing runs until you confirm`})]}),(0,X.jsx)(wn,{groups:r,planKind:t}),(0,X.jsxs)(`p`,{className:`font-mono text-[11px] text-muted-foreground`,children:[l>0?`${l} already in place · `:``,yn(e.scope)]})]})}),n.length>0?(0,X.jsx)(bn,{groups:r}):null,c.length>0?(0,X.jsx)(Cn,{entries:c}):null,n.length>0?(0,X.jsx)(`ul`,{className:`-mx-2 flex flex-col`,children:dn.map(e=>{let t=r.get(e);return t?(0,X.jsx)(Sn,{action:e,entries:t,open:a.has(e),onToggle:()=>s(e)},e):null})}):(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t===`cleanup`?`No Miravo-managed resources matched this scope on the target.`:`The target already matches this template.`})]})}var En=[`a`,`b`,`c`];function Dn(){return(0,X.jsxs)(`div`,{role:`status`,"aria-busy":!0,"aria-label":`Loading dry run`,className:`flex flex-col gap-3 rounded-[var(--miravo-radius-stadium-sm)] border border-border/60 bg-background/40 p-4`,children:[(0,X.jsx)(Z,{className:`h-2.5 w-28`}),(0,X.jsx)(Z,{className:`h-5 w-56`}),(0,X.jsx)(Z,{className:`h-3 w-40`}),(0,X.jsx)(Z,{className:`h-1.5 w-full rounded-full`}),(0,X.jsx)(`div`,{className:`flex flex-col gap-2 pt-1`,children:En.map(e=>(0,X.jsx)(Z,{className:`h-7 w-full`},e))})]})}var On={modbus:`Modbus`,opcua:`OPC UA`,mqtt:`MQTT`},kn=He.map(e=>({value:e,label:On[e]}));function An({open:e,onOpenChange:t,action:n,subject:r,label:i,target:a,stream:s}){let c=n===`apply`,u=c?Gt:Kt,[d,f]=(0,Y.useState)(new Set(u)),[p,m]=(0,Y.useState)(`fail`),[h,g]=(0,Y.useState)(!1),[_,v]=(0,Y.useState)(Object.keys(a.exposedPorts??{}).length>0),[S,C]=(0,Y.useState)(Le(a.exposedPorts)),[ne,re]=(0,Y.useState)(r.kind===`asset`?r.protocol:He[0]??`modbus`),T=r.kind===`asset`?{kind:`asset`,assetId:r.assetId,protocol:ne}:r,E=r.kind===`asset`?[ne]:He,D=c?ze(a.exposedPorts,S,E):{},O=u.filter(e=>d.has(e)),k=O.length>0&&D!==null,A={scope:O,ifUnmanaged:p,...c&&D?{exposedPorts:D}:{}},j=tn({targetId:a.id,subject:T,result:A}),M=nn({targetId:a.id,subject:T,result:A}),N=l({queryKey:o.integrations.plan(n,JSON.stringify(c?j:M)),queryFn:({signal:e})=>c?be(j,{signal:e}):Te(M,{signal:e}),enabled:e&&k,retry:!1,gcTime:0}),ie=s.status===`running`,P=()=>{k&&(s.operation&&s.status!==`running`&&s.reset(),c?s.startApply(j):s.startCleanup(M),t(!1))},F=N.data?.plan,I=F?ln(F.entries):null,L;L=c?I===null?`Apply`:I===0?`Re-apply anyway`:`Apply ${I} ${I===1?`change`:`changes`}`:I?`Clean up ${I} ${I===1?`resource`:`resources`}`:`Clean up`;let R=N.error?[Xe(N.error,`Plan failed`),Ze(N.error)].filter(Boolean).join(`. `):null;return(0,X.jsx)(te,{open:e,onOpenChange:t,children:(0,X.jsxs)(b,{showCloseButton:!0,className:`flex max-h-[90vh] min-h-0 flex-col gap-0 overflow-hidden p-0 sm:max-w-3xl`,children:[(0,X.jsxs)(`div`,{className:`shrink-0 border-b border-border/60 px-5 pb-3 pt-5`,children:[(0,X.jsxs)(ee,{className:`flex items-center gap-2 text-sm font-semibold leading-snug`,children:[c?(0,X.jsx)(Ie,{className:`size-3.5 shrink-0 text-primary`,"aria-hidden":!0}):(0,X.jsx)(Ue,{className:`size-3.5 shrink-0 text-destructive`,"aria-hidden":!0}),c?`Apply`:`Clean up`,` `,i,` `,c?`to`:`from`,` `,a.label]}),(0,X.jsxs)(x,{className:`mt-1 font-mono text-[11px] text-muted-foreground`,children:[a.hostname,c?(0,X.jsx)(`span`,{className:`font-sans`,children:` · reaches Miravo at `}):null,c?a.sourceHostname:null]})]}),(0,X.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain px-5 pt-4 pb-3`,children:(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[c&&r.kind===`asset`?(0,X.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,X.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground`,children:`Protocol`}),(0,X.jsxs)(_t,{value:ne,onValueChange:e=>e&&re(e),items:kn,children:[(0,X.jsx)(gt,{size:`sm`,className:`w-32`,"aria-label":`Protocol`,children:(0,X.jsx)(mt,{})}),(0,X.jsx)(ht,{alignItemWithTrigger:!1,align:`start`,children:kn.map(e=>(0,X.jsx)(q,{value:e.value,children:e.label},e.value))})]})]}):null,k?R?(0,X.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-2 text-xs`,children:[(0,X.jsxs)(`p`,{className:`text-destructive`,children:[`Dry run failed: `,R]}),(0,X.jsx)(w,{size:`sm`,variant:`outline`,onClick:()=>void N.refetch(),children:`Retry dry run`})]}):F?(0,X.jsx)(Tn,{plan:F,planKind:n}):(0,X.jsx)(Dn,{}):(0,X.jsx)(`p`,{className:`text-[11px] text-destructive`,children:O.length===0?`Select at least one scope under Advanced.`:`Fix the invalid host port under Advanced.`}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)($t,{open:h,onOpenChange:g,isApply:c,scopeOptions:u,scope:d,onToggleScope:e=>f(t=>Zt(t,e)),ifUnmanaged:p,onIfUnmanagedChange:m}),h?(0,X.jsxs)(`dl`,{className:`flex flex-col gap-0 text-xs leading-snug`,children:[(0,X.jsx)(en,{label:`Litmus Edge API`,help:Yt,mono:!0,children:a.hostname}),(0,X.jsx)(en,{label:ke,help:je,mono:!0,children:a.sourceHostname}),c?(0,X.jsx)(`div`,{className:`border-b border-border/35 py-2.5`,children:(0,X.jsx)(Be,{open:_,onOpenChange:v,protocols:E,values:S,onChange:C,hint:`Enter the host port Litmus Edge should dial. Leave blank to use Miravo's own port. Saved for this target.`})}):null]}):null]})]})}),(0,X.jsxs)(y,{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,X.jsx)(w,{type:`button`,variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,X.jsxs)(w,{type:`button`,variant:c?`default`:`destructive`,onClick:P,disabled:!k||ie,children:[c?(0,X.jsx)(Ie,{className:`size-3`,"aria-hidden":!0}):(0,X.jsx)(Ue,{className:`size-3`,"aria-hidden":!0}),L]})]})]})})}function jn(e,t,n){let r=new Set,i=[];for(let a of e){if(a.targetId!==t||a.factoryName!==n)continue;let e=a.templateId===void 0?`asset`:`template`,o=a.templateId??a.assetId;if(o===void 0)continue;let s=`${e}:${o}`;r.has(s)||(r.add(s),a.operationType===`apply`?a.status===`success`||a.status===`partial`||a.status===`noop`?i.push({subjectId:o,kind:e,completedAt:a.completedAt}):r.delete(s):a.status!==`success`&&a.status!==`noop`&&r.delete(s))}return i}var Mn=500;function Nn(e){return e.kind===`template`?`template:${e.templateId}`:`asset:${e.assetId}`}function Pn(e,t){return`${Nn(e)}|${t}`}function Fn(e){return e.operationType===`apply`?e.status===`success`||e.status===`partial`||e.status===`noop`?`applied`:`failed`:e.status===`success`||e.status===`noop`?`none`:`failed`}function In(e,t){let n=new Map;for(let r of e){if(r.factoryName!==t)continue;let e=r.templateId===void 0?r.assetId===void 0?null:{kind:`asset`,assetId:r.assetId,protocol:`modbus`}:{kind:`template`,templateId:r.templateId};if(!e)continue;let i=Pn(e,r.targetId);n.has(i)||n.set(i,{status:Fn(r),operationType:r.operationType,targetId:r.targetId,targetLabel:r.targetLabel,completedAt:r.completedAt,error:r.error})}return n}function Ln(e,t){let n=0,r=0;for(let i of e.values())t!==void 0&&i.targetId!==t||(i.status===`applied`?n+=1:i.status===`failed`&&(r+=1));return{applied:n,failed:r}}function Rn(){let e=a(e=>e.factoryName),t=l({queryKey:o.integrations.operationsFactory(),queryFn:()=>ye({limit:Mn})});return{query:t,cells:(0,Y.useMemo)(()=>In(t.data?.operations??[],e),[t.data,e])}}var zn=5,Bn=`grid min-h-11 grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 gap-y-1 px-4 py-2 @lg/deploy:grid-cols-[minmax(0,1fr)_minmax(9rem,auto)_6.5rem]`;function Vn(e){return e.kind===`template`?e.templateId:e.assetId}function Hn({row:e}){return(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[e.subject.kind===`template`?(0,X.jsx)(me,{id:e.subject.templateId,className:`size-3.5 shrink-0 text-primary`}):(0,X.jsx)(Lt,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":!0}),(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,children:e.label}),e.detail?(0,X.jsx)(`div`,{className:`truncate font-mono text-[10px] text-muted-foreground`,children:e.detail}):null]})]})}function Un({cell:e,running:t}){if(t)return(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-xs text-primary`,children:[(0,X.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 animate-pulse rounded-full bg-primary`}),`Running…`]});if(!e||e.status===`none`)return(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,X.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 rounded-full border border-muted-foreground/60`}),`Not applied`]});let n=e.status===`applied`;return(0,X.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1.5 text-xs`,title:e.error??void 0,children:[(0,X.jsx)(`span`,{"aria-hidden":!0,className:L(`size-1.5 shrink-0 rounded-full`,n?`bg-success`:`bg-destructive`)}),(0,X.jsx)(`span`,{className:n?`text-foreground`:`text-destructive`,children:n?`Applied`:e.operationType===`cleanup`?`Clean up failed`:`Failed`}),(0,X.jsx)(`span`,{className:`font-mono text-[11px] text-muted-foreground`,children:A(e.completedAt)})]})}function Wn({row:e,target:t,cell:n,running:r,disabled:i,indent:a,onAction:o}){let s=`${e.label} on ${t.label}`,c=n?.status===`applied`||n?.status===`failed`;return(0,X.jsxs)(`li`,{className:L(Bn,`transition-colors hover:bg-muted/20`,a&&`pl-9`),children:[(0,X.jsx)(Hn,{row:e}),(0,X.jsxs)(`div`,{className:`col-start-1 row-start-2 @lg/deploy:col-start-auto @lg/deploy:row-start-auto`,children:[(0,X.jsx)(Un,{cell:n,running:r}),n?.status===`failed`&&n.error?(0,X.jsx)(`p`,{className:`mt-0.5 line-clamp-1 text-[11px] text-destructive/80`,children:n.error}):null]}),(0,X.jsxs)(`div`,{className:`col-start-2 row-span-2 row-start-1 flex items-center justify-end gap-1 @lg/deploy:col-start-auto @lg/deploy:row-span-1 @lg/deploy:row-start-auto`,children:[n?.status===`applied`?null:(0,X.jsx)(w,{size:`xs`,variant:`outline`,disabled:i,"aria-label":`${n?.status===`failed`?`Retry`:`Apply`} ${s}`,className:$e,onClick:()=>o(`apply`),children:n?.status===`failed`?`Retry`:`Apply`}),c?(0,X.jsxs)(de,{children:[(0,X.jsx)(ue,{render:(0,X.jsx)(w,{size:`icon-xs`,variant:`ghost`,disabled:i,"aria-label":`More actions for ${s}`,className:`text-muted-foreground hover:text-foreground`}),children:(0,X.jsx)(Rt,{"aria-hidden":!0})}),(0,X.jsxs)(le,{align:`end`,className:`min-w-40`,children:[(0,X.jsxs)(ce,{className:`gap-2 text-xs`,onClick:()=>o(`apply`),children:[(0,X.jsx)(Ht,{className:`size-3.5 text-muted-foreground`,"aria-hidden":!0}),`Re-apply`]}),(0,X.jsxs)(ce,{variant:`destructive`,className:`gap-2 text-xs`,onClick:()=>o(`cleanup`),children:[(0,X.jsx)(Ue,{className:`size-3.5`,"aria-hidden":!0}),`Clean up`]})]})]}):null]})]})}function Gn({target:e,running:t,disabled:n,onCleanup:r}){let i=a(e=>e.factoryName),s=jn(l({queryKey:o.integrations.operationsForTarget(e.id),queryFn:()=>xe(e.id)}).data??[],e.id,i).filter(e=>!t.has(e.subjectId));return s.length===0?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`li`,{className:`bg-muted/20 px-4 pt-2.5 pb-1.5`,children:[(0,X.jsx)(`p`,{className:`text-[10px] uppercase tracking-(--miravo-tracking-eyebrow) text-muted-foreground`,children:`No longer running`}),(0,X.jsxs)(`p`,{className:`mt-0.5 text-[11px] text-muted-foreground`,children:[`Still on `,e.label,` from an earlier apply. Clean up removes what Miravo created.`]})]}),s.map(t=>{let i=t.kind===`template`?{subject:{kind:`template`,templateId:t.subjectId},label:t.subjectId}:{subject:{kind:`asset`,assetId:t.subjectId,protocol:`modbus`},label:t.subjectId};return(0,X.jsxs)(`li`,{className:L(Bn,`bg-muted/20`),children:[(0,X.jsx)(Hn,{row:i}),(0,X.jsxs)(`span`,{className:`col-start-1 row-start-2 inline-flex items-center gap-1.5 text-xs text-muted-foreground @lg/deploy:col-start-auto @lg/deploy:row-start-auto`,children:[(0,X.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 rounded-full bg-muted-foreground/60`}),`Applied`,(0,X.jsx)(`span`,{className:`font-mono text-[11px]`,children:A(t.completedAt)})]}),(0,X.jsx)(`div`,{className:`col-start-2 row-span-2 row-start-1 flex justify-end @lg/deploy:col-start-auto @lg/deploy:row-span-1 @lg/deploy:row-start-auto`,children:(0,X.jsxs)(w,{size:`xs`,variant:`ghost`,disabled:n,"aria-label":`Clean up ${t.subjectId} on ${e.label}`,className:`text-muted-foreground hover:bg-destructive/12 hover:text-destructive`,onClick:()=>r(i),children:[(0,X.jsx)(Ue,{className:`size-3`,"aria-hidden":!0}),`Clean up`]})})]},`${t.kind}:${t.subjectId}`)})]})}function Kn(e,t){return t>0?`fault`:e>0?`live`:`off`}function qn({target:e,templates:t,assets:n,running:r,cells:i,stream:a,onAction:o}){let[s,c]=(0,Y.useState)(!1),{applied:l,failed:u}=Ln(i,e.id),d=a.status===`running`,f=t=>i.get(Pn(t.subject,e.id)),p=n.length>zn,m=n.filter(e=>f(e)?.status===`applied`).length,h=(t,n=!1)=>{let r=a.operation,i=d&&r?.label===Vn(t.subject)&&(r.targetLabel===e.label||r.targetLabel===e.id);return(0,X.jsx)(Wn,{row:t,target:e,cell:f(t),running:i,disabled:d,indent:n,onAction:n=>o(t,e,n)},`${t.subject.kind}:${t.label}`)};return(0,X.jsx)(ot,{icon:z,title:e.label,description:(0,X.jsx)(`span`,{className:`font-mono text-[11px]`,children:e.hostname}),aside:(0,X.jsxs)(W,{tone:Kn(l,u),children:[(0,X.jsx)(`span`,{className:`mr-1.5 font-mono font-semibold tabular-nums text-foreground`,children:l}),(0,X.jsx)(K,{children:`applied`}),u>0?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`mx-1.5 text-muted-foreground/60`,children:`·`}),(0,X.jsx)(`span`,{className:`mr-1.5 font-mono font-semibold tabular-nums text-destructive`,children:u}),(0,X.jsx)(K,{children:`failed`})]}):null]}),className:`@container/deploy`,bodyClassName:`p-0`,children:(0,X.jsxs)(`ul`,{className:`divide-y divide-border/50 py-1`,children:[t.length===0&&n.length===0?(0,X.jsx)(`li`,{className:`px-4 py-3 text-xs text-muted-foreground`,children:`Nothing is running. Load a template to send it to Litmus Edge.`}):null,t.map(e=>h(e)),p?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`li`,{className:Bn,children:[(0,X.jsxs)(`button`,{type:`button`,onClick:()=>c(e=>!e),"aria-expanded":s,className:`flex min-w-0 items-center gap-2 rounded-[var(--miravo-radius-tight)] text-sm font-medium outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,X.jsx)(ge,{className:L(`size-3.5 shrink-0 text-muted-foreground transition-transform`,s&&`rotate-90`),"aria-hidden":!0}),`Standalone assets`,(0,X.jsx)(`span`,{className:`font-mono text-[11px] text-muted-foreground`,children:n.length})]}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:m>0?`${m} applied`:`Not applied`})]}),s?n.map(e=>h(e,!0)):null]}):n.map(e=>h(e)),(0,X.jsx)(Gn,{target:e,running:r,disabled:d,onCleanup:t=>o(t,e,`cleanup`)})]})})}function Jn({targets:e,cells:t,stream:n}){let{templates:r,assets:i}=a(S(e=>({templates:e.templates,assets:e.assets}))),[o,s]=(0,Y.useState)(null);if(e.length===0)return(0,X.jsxs)(`div`,{className:`flex flex-col items-start gap-3 rounded-[var(--miravo-radius-stadium-sm)] border border-dashed border-border p-5`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium`,children:[(0,X.jsx)(z,{className:`size-4 text-muted-foreground`,"aria-hidden":!0}),`No Litmus Edge target yet`]}),(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Add a device with its hostname and an API token. Then apply templates and assets to it from here.`}),(0,X.jsxs)(g,{to:`/integrations`,className:P({size:`sm`}),children:[(0,X.jsx)(Ne,{className:`size-3.5`,"aria-hidden":!0}),`Add target`]})]});let c=new Set(r.flatMap(e=>e.assetIds)),l=r.map(e=>({subject:{kind:`template`,templateId:e.templateId},label:e.templateName,detail:e.templateId})),u=i.filter(e=>!c.has(e.id)).map(e=>({subject:{kind:`asset`,assetId:e.id,protocol:`modbus`},label:e.id})),d=new Set([...r.map(e=>e.templateId),...i.map(e=>e.id)]);return(0,X.jsxs)(`section`,{"aria-label":`Deployments`,className:L(`grid items-start gap-4`,e.length>1&&`@5xl/main:grid-cols-2`),children:[e.map(e=>(0,X.jsx)(qn,{target:e,templates:l,assets:u,running:d,cells:t,stream:n,onAction:(e,t,n)=>s({row:e,target:t,action:n})},e.id)),o?(0,X.jsx)(An,{open:!0,onOpenChange:e=>!e&&s(null),action:o.action,subject:o.row.subject,label:o.row.label,target:o.target,stream:n}):null]})}var Yn={status:`idle`,operation:null,error:null,logs:[],cancelRequested:!1},Xn=200;function Zn(){let[e,t]=(0,Y.useState)(Yn),n=(0,Y.useRef)(null),r=(0,Y.useRef)(0),i=c(),a=(0,Y.useRef)(0),s=(0,Y.useCallback)(e=>{let n=Xe(e,`Integration operation failed.`),r=Ze(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}))},[]),l=(0,Y.useCallback)(e=>{switch(e.event){case`accepted`:Qn(e.data,t);break;case`log`:er({...e.data,id:`log-${r.current++}`},t);break;case`started`:tr(e.data,t);break;case`phase`:nr(e.data,t);break;case`resource`:rr(e.data,t);break;case`complete`:ir(e.data,t);break;case`cancelled`:or(e.data,t);break;case`retrying`:sr(e.data,t);break;case`error`:s(Error(e.data.message));break}},[s]),u=(0,Y.useCallback)(e=>{let c=++a.current;n.current?.abort(),r.current=0,t({status:`running`,operation:null,error:null,logs:[],cancelRequested:!1}),n.current=Se(e,e=>{a.current===c&&(l(e),cr(e)&&(i.invalidateQueries({queryKey:o.integrations.targets()}),i.invalidateQueries({queryKey:o.integrations.operations()}),n.current?.abort(),n.current=null))},e=>{a.current===c&&(n.current=null,s(e))})},[l,s,i]),d=(0,Y.useCallback)(e=>{let c=++a.current;n.current?.abort(),r.current=0,t({status:`running`,operation:null,error:null,logs:[],cancelRequested:!1}),n.current=De(e,e=>{a.current===c&&(l(e),cr(e)&&(i.invalidateQueries({queryKey:o.integrations.operations()}),n.current?.abort(),n.current=null))},e=>{a.current===c&&(n.current=null,s(e))})},[l,s,i]),f=(0,Y.useCallback)(()=>{a.current++,n.current?.abort(),n.current=null,t(Yn)},[]),p=(0,Y.useCallback)(async()=>{let n=e.operation?.operationId;if(!(!n||e.status!==`running`||e.cancelRequested)){t(e=>ar(e,n));try{await Ee(n)||s(Error(`Operation finished before cancellation was accepted.`))}catch(e){s(e instanceof Error?e:Error(`Cancellation failed.`))}}},[e.operation?.operationId,e.status,e.cancelRequested,s]);return(0,Y.useEffect)(()=>()=>{a.current++,n.current?.abort(),n.current=null},[]),{...e,startApply:u,startCleanup:d,reset:f,cancel:p}}function Qn(e,t){t(t=>({...t,status:`running`,cancelRequested:!1,error:null,operation:{operationId:e.operationId,type:e.type,label:e.templateId??e.assetId??(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.templateId??e.assetId??`unknown`}function er(e,t){t(t=>({...t,logs:[...t.logs,e].slice(-Xn)}))}function tr(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 nr(e,t){t(t=>{if(!Q(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 rr(e,t){t(t=>{if(!Q(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 ir(e,t){t(t=>{if(!Q(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 ar(e,t){return!Q(e,t)||e.status!==`running`?e:{...e,cancelRequested:!0}}function or(e,t){t(t=>{if(!Q(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 sr(e,t){t(t=>Q(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 Q(e,t){return e.operation?.operationId===t}function cr(e){return e.event===`complete`||e.event===`cancelled`||e.event===`error`}var lr={initial:{scale:0,opacity:0},animate:{scale:1,opacity:1,originY:0},exit:{scale:0,opacity:0},transition:{type:`spring`,stiffness:350,damping:40}},ur={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 dr({children:e,variant:t=`default`}){let n=t===`default`;return(0,X.jsx)(u.div,{...n?lr:ur,layout:n,className:`mx-auto w-full`,children:e})}var fr=Y.memo(({children:e,className:t,delay:n=1e3,...r})=>{let[i,a]=(0,Y.useState)(0),o=(0,Y.useMemo)(()=>Y.Children.toArray(e),[e]);(0,Y.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,Y.useMemo)(()=>o.slice(0,i+1).reverse(),[i,o]);return(0,X.jsx)(`div`,{className:L(`flex flex-col items-center gap-4`,t),...r,children:(0,X.jsx)(f,{children:s.map(e=>(0,X.jsx)(dr,{children:e},e.key))})})});fr.displayName=`AnimatedList`;function pr({type:e,errorMessage:t,className:n}){return null}var mr=`text-destructive hover:bg-destructive/25 hover:text-foreground`,hr={device:`Devices`,tags:`Tags`,model:`Models`,asset:`Assets`,"param-sync":`Parameters`};function gr(e){return hr[e]??e}function _r(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 vr(e){return e===`noop`?`no-op`:e}function yr({status:e}){switch(e){case`success`:return(0,X.jsx)(_e,{className:`size-3.5 shrink-0 text-success`});case`failed`:return(0,X.jsx)(ve,{className:`size-3.5 shrink-0 text-destructive`});case`pending`:return(0,X.jsx)(B,{className:`size-3.5 shrink-0 animate-spin text-primary/90`})}}function br({status:e}){switch(e){case`done`:return(0,X.jsx)(_e,{className:`size-3.5 text-success`});case`active`:return(0,X.jsx)(B,{className:`size-3.5 animate-spin text-primary`});case`pending`:return(0,X.jsx)(Ft,{className:`size-3.5 text-foreground/55`})}}function xr({entry:e}){let[t,n]=(0,Y.useState)(!1);return(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,X.jsxs)(`button`,{type:`button`,className:L(`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,X.jsx)(yr,{status:e.status}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[11px] text-foreground`,children:e.name}),(0,X.jsx)(`span`,{className:L(`inline-flex rounded-[var(--miravo-radius-tight)] px-1.5 py-0.5 text-[9px] font-medium uppercase tracking-wider`,_r(e.action)),children:vr(e.action)}),e.error&&(0,X.jsx)(he,{className:L(`size-3 text-foreground/75 transition-transform`,t&&`rotate-180`)})]}),(0,X.jsx)(f,{initial:!1,children:t&&e.error&&(0,X.jsxs)(u.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:`auto`},exit:{opacity:0,height:0},transition:{duration:.18},className:`overflow-hidden`,children:[(0,X.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,X.jsx)(`p`,{className:`min-w-0 flex-1 text-left whitespace-normal break-words text-destructive [overflow-wrap:anywhere]`,children:e.error}),(0,X.jsx)(Oe,{value:e.error,label:`Copy error`,className:L(mr,`shrink-0`)})]}),(0,X.jsx)(pr,{type:`apply`,errorMessage:e.error,className:`mb-1 mt-2.5 w-full min-w-0`})]})})]})}function Sr({phase:e,open:t,onOpenChange:n}){let r=e.resources.length,i=r===e.total,a=e.resources.length>0;return(0,X.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,X.jsxs)(`button`,{type:`button`,className:L(`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,X.jsx)(br,{status:e.status}),(0,X.jsx)(`span`,{className:`text-xs font-medium tracking-wide text-foreground`,children:gr(e.name)}),(0,X.jsxs)(`span`,{className:`font-mono text-[10px] text-foreground/70`,children:[r,`/`,e.total]}),(0,X.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1.5`,children:[i&&e.status===`done`&&(0,X.jsx)(_e,{className:`size-3 text-success`}),a&&(0,X.jsx)(he,{className:L(`size-3 text-foreground/75 transition-transform`,!t&&`-rotate-90`),"aria-hidden":!0})]})]}),(0,X.jsx)(f,{initial:!1,children:a&&t&&(0,X.jsx)(u.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,X.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,X.jsx)(d.Provider,{value:null,children:e.resources.map((e,t)=>(0,X.jsx)(dr,{variant:`subtle`,children:(0,X.jsx)(xr,{entry:e})},`${e.name}-${t}`))})})})})]})}function Cr({operation:e}){let t=e.status===`complete`,n=e.status===`cancelled`,r=e.failed>0,i=e.totalPlanned>0?Math.min(100,Tr(e)/e.totalPlanned*100):0;return(0,X.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,X.jsx)(u.div,{"aria-hidden":`true`,className:L(`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 wr(e){return e.duration==null?(Date.now()-e.startedAt)/1e3:e.duration/1e3}function Tr(e){let t=e.applied+e.failed;return e.totalPlanned>0?Math.min(t,e.totalPlanned):t}var Er={complete:{Icon:_e,className:`size-4 text-success`},partial:{Icon:Pt,className:`size-4 text-warning`},cancelled:{Icon:At,className:`size-4 text-foreground/65`},error:{Icon:ve,className:`size-4 text-destructive`},running:{Icon:B,className:`size-4 animate-spin text-warning`}};function Dr({icon:e,className:t}){return(0,X.jsx)(u.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,X.jsx)(e,{className:t})})}function Or({operation:e,sourceLabel:t,isAllExpanded:n,onToggleAll:r}){let i=wr(e),a=Tr(e),o=e.status===`complete`,s=e.status===`cancelled`,c=e.status===`error`,l=e.failed>0,d=o&&!l?`complete`:o&&l?`partial`:s?`cancelled`:c?`error`:`running`,p=Er[d];return(0,X.jsxs)(`div`,{className:L(`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,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,X.jsx)(f,{mode:`wait`,initial:!1,children:(0,X.jsx)(Dr,{icon:p.Icon,className:p.className},d)}),(0,X.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,X.jsxs)(`span`,{className:`w-full min-w-0 text-[10px] leading-tight text-foreground/78`,children:[(0,X.jsx)(`span`,{className:`font-sans break-words`,children:t}),(0,X.jsx)(`span`,{className:`font-mono break-words`,children:` → ${e.targetLabel}`})]})]}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,X.jsx)(qe,{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,X.jsxs)(`span`,{className:`gap-1`,children:[(0,X.jsx)(f,{mode:`popLayout`,initial:!1,children:(0,X.jsx)(u.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,X.jsx)(`span`,{className:`text-foreground/72`,children:e.type===`apply`?`applied`:`deleted`})]})}),(0,X.jsx)(f,{initial:!1,children:e.failed>0&&(0,X.jsx)(u.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,X.jsxs)(qe,{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,X.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:[(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-mono text-[10px] leading-none text-foreground/75`,children:[(0,X.jsx)(It,{className:`size-3 shrink-0 block text-foreground/65`,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`tabular-nums leading-none`,children:typeof i==`number`?`${i.toFixed(1)}s`:`...`})]}),r&&(0,X.jsx)(`div`,{className:`flex items-center border-l border-border/40 pl-2`,children:(0,X.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,X.jsx)(Nt,{className:L(`size-3.5 transition-transform duration-300`,!n&&`opacity-70 scale-y-[-1]`)})})})]})]}),(0,X.jsx)(Cr,{operation:e})]})]})}function kr(e){return e?e.closest(`[data-edge-op-scroll]`)??e.closest(`.overflow-y-auto`):null}var Ar=350;function jr(e){e?.scrollIntoView({block:`end`,behavior:`auto`,inline:`nearest`})}function Mr(e){let t=()=>jr(e);t(),requestAnimationFrame(t),requestAnimationFrame(()=>requestAnimationFrame(t)),window.setTimeout(t,0),window.setTimeout(t,48),window.setTimeout(t,120)}function Nr({logs:e}){return e.length===0?null:(0,X.jsx)(`div`,{className:`flex min-w-0 flex-col gap-1.5 px-2 pb-2`,children:e.map(e=>(0,X.jsxs)(`div`,{className:L(`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,X.jsx)(ae,{className:`mt-0.5 size-3.5 shrink-0 text-primary`,"aria-hidden":!0}):(0,X.jsx)(Pt,{className:`mt-0.5 size-3.5 shrink-0`,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`min-w-0 wrap-anywhere`,children:e.message})]},e.id))})}function Pr({operation:e,logs:t}){let n=(0,Y.useRef)(null),r=(0,Y.useRef)(null),i=(0,Y.useRef)(!0),a=(0,Y.useRef)(e.status);a.current=e.status;let o=(0,Y.useRef)(!1),[s,c]=(0,Y.useState)(new Set),l=e.label;(0,Y.useLayoutEffect)(()=>{let e=kr(n.current);if(!e)return;let t=()=>{i.current=e.scrollHeight-e.scrollTop-e.clientHeight<Ar};return e.addEventListener(`scroll`,t,{passive:!0}),t(),()=>{e.removeEventListener(`scroll`,t)}},[]),(0,Y.useLayoutEffect)(()=>{if(e.status===`running`){i.current&&jr(r.current),o.current=!0;return}o.current&&=(Mr(r.current),!1)},[e.status,e.applied,e.failed,e.phases]),(0,Y.useEffect)(()=>{if(e.status!==`running`)return;let t=n.current;if(!t)return;let o=0,s=new ResizeObserver(()=>{cancelAnimationFrame(o),o=requestAnimationFrame(()=>{a.current===`running`&&i.current&&jr(r.current)})});return s.observe(t),i.current&&jr(r.current),()=>{s.disconnect(),cancelAnimationFrame(o)}},[e.status]);let d=e.phases.length>0,p=s.size===0;return(0,X.jsxs)(`div`,{ref:n,className:`flex min-w-0 w-full flex-col gap-2`,children:[(0,X.jsx)(Or,{operation:e,sourceLabel:l,isAllExpanded:p,onToggleAll:d?()=>{c(p?new Set(e.phases.map(e=>e.name)):new Set)}:void 0}),(0,X.jsx)(`div`,{className:`flex flex-col gap-1 px-2 pt-2 pb-4`,children:e.phases.map(e=>(0,X.jsx)(`div`,{children:(0,X.jsx)(Sr,{phase:e,open:!s.has(e.name),onOpenChange:t=>{c(n=>{let r=new Set(n);return t?r.delete(e.name):r.add(e.name),r})}})},e.name))}),(0,X.jsx)(f,{initial:!1,children:e.error&&e.retryPending&&(0,X.jsxs)(u.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,X.jsx)(B,{className:`size-4 shrink-0 animate-spin`}),(0,X.jsx)(`span`,{className:`truncate`,children:e.error})]})}),(0,X.jsx)(f,{initial:!1,children:e.error&&e.status===`error`&&(0,X.jsxs)(u.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,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)(`p`,{className:`min-w-0 flex-1 text-left wrap-anywhere text-destructive`,children:e.error}),(0,X.jsx)(Oe,{value:e.error,label:`Copy error`,className:L(mr,`shrink-0`)})]}),(0,X.jsx)(pr,{type:e.type,errorMessage:e.error,className:`mt-3 w-full min-w-0`})]})}),t&&t.length>0?(0,X.jsx)(Nr,{logs:t}):null,(0,X.jsx)(`div`,{ref:r,className:`h-px w-full shrink-0`,"aria-hidden":!0})]})}function Fr({title:e,subtitle:t,footerAction:n,canDismiss:r=!0,onDismiss:i,children:a}){return(0,Y.useEffect)(()=>{function e(e){e.key===`Escape`&&r&&i()}return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[r,i]),(0,X.jsx)(u.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,X.jsxs)(Ve,{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,X.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,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,X.jsx)(Pe,{className:`size-4 shrink-0 text-primary`,"aria-hidden":!0}),(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`p`,{className:`font-heading text-xs font-semibold tracking-tight text-foreground`,children:e}),t?(0,X.jsx)(`p`,{className:`text-[11px] leading-snug text-foreground/80`,children:t}):null]})]}),r?(0,X.jsx)(w,{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,X.jsx)(re,{className:`size-3.5`,"aria-hidden":!0})}):null]}),(0,X.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,X.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]})})}function Ir(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 Lr({stream:e,onReset:t}){if(!e.operation&&e.status!==`running`)return null;let{title:n,subtitle:r}=Ir(e),i=e.status===`complete`,a=e.status===`error`,o=e.status===`running`,s=i||a,c=e.cancelRequested;async function l(){await e.cancel().catch(()=>{})}return(0,X.jsx)(Fr,{title:n,subtitle:r,canDismiss:!o,footerAction:o&&e.operation?.operationId?(0,X.jsx)(`div`,{className:`ml-auto shrink-0`,children:(0,X.jsx)(`button`,{type:`button`,onClick:l,disabled:c,"aria-busy":c,className:L(P({variant:`outline`,size:`sm`}),`group h-8 gap-1.5 px-3 text-xs`,c?`cursor-not-allowed`:`hover:bg-destructive/12 hover:text-destructive hover:border-destructive/35`),children:c?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(B,{className:`size-3.5 shrink-0 animate-spin text-muted-foreground`,"aria-hidden":!0}),(0,X.jsx)(u.span,{animate:{opacity:[1,.72,1]},transition:{duration:1.25,repeat:1/0,ease:`easeInOut`},className:`font-medium text-foreground`,children:`Cancelling…`})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(re,{className:`size-3.5 shrink-0 text-foreground/65 group-hover:text-destructive`,"aria-hidden":!0}),(0,X.jsx)(u.span,{animate:{opacity:[1,.88,1]},transition:{duration:2.2,repeat:1/0,ease:`easeInOut`},children:`Cancel`})]})})}):s?(0,X.jsxs)(`div`,{className:`flex w-full flex-col gap-1.5`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 w-full flex-1 flex-wrap items-center justify-between gap-x-3 gap-y-1`,children:[(0,X.jsxs)(g,{to:`/integrations?tab=activity`,className:L(P({variant:`ghost`,size:`xs`}),`group inline-flex h-6 shrink-0 items-center gap-1.5 px-2 text-[11px] font-medium text-foreground/80`,`hover:bg-primary/12 hover:text-primary`),children:[(0,X.jsx)(R,{className:`size-3 shrink-0 text-foreground/70 group-hover:text-primary`,"aria-hidden":!0}),`View full activity`,(0,X.jsx)(ge,{className:`size-2.5 shrink-0 text-foreground/50 group-hover:text-primary`,"aria-hidden":!0})]}),(0,X.jsx)(`div`,{className:`flex shrink-0 items-center`,children:(0,X.jsx)(w,{type:`button`,variant:`secondary`,size:`xs`,className:`h-6 px-2.5 text-[11px] font-medium`,onClick:t,children:`Close`})})]}),e.operation?.status===`cancelled`||a&&e.operation?(0,X.jsx)(pr,{type:e.operation.type,errorMessage:e.operation.error,className:`mt-2.5 w-full min-w-0`}):null]}):void 0,onDismiss:t,children:e.operation?(0,X.jsx)(Pr,{operation:e.operation,logs:e.logs}):(0,X.jsxs)(`div`,{className:`flex flex-col gap-2 py-1`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(B,{className:`size-3.5 animate-spin text-primary`,"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`text-xs text-foreground/78`,children:`Connecting to Litmus Edge…`})]}),(0,X.jsx)(`div`,{className:`h-1 w-full overflow-hidden rounded-full bg-muted/55`,children:(0,X.jsx)(u.div,{className:`h-full w-2/5 rounded-full bg-primary`,animate:{x:[`-100%`,`250%`]},transition:{duration:1.2,repeat:1/0,ease:`easeInOut`}})})]})})}function Rr({targetCount:e,applied:t,failed:n,lastOp:r}){return(0,X.jsxs)(`header`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,X.jsx)(`div`,{"aria-hidden":!0,className:`flex size-9 shrink-0 items-center justify-center rounded-[var(--miravo-radius-tight)] border border-border/60 bg-background/70 text-primary`,children:(0,X.jsx)(z,{className:`size-4`})}),(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`h2`,{className:`font-heading text-lg font-semibold tracking-tight`,children:`Litmus Edge`}),(0,X.jsx)(`p`,{className:`mt-0.5 max-w-2xl text-pretty text-xs text-muted-foreground`,children:`Send running templates and assets to Litmus Edge devices: devices, tags and flows. Each change is planned before it runs, and clean up removes only what Miravo created.`})]})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsxs)(W,{tone:e>0?`live`:`off`,children:[(0,X.jsx)(`span`,{className:`mr-1.5 font-mono font-semibold tabular-nums text-foreground`,children:e}),(0,X.jsx)(K,{children:e===1?`target`:`targets`})]}),(0,X.jsxs)(W,{tone:t>0?`live`:`off`,children:[(0,X.jsx)(`span`,{className:`mr-1.5 font-mono font-semibold tabular-nums text-foreground`,children:t}),(0,X.jsx)(K,{children:`applied`})]}),n>0?(0,X.jsxs)(W,{tone:`fault`,children:[(0,X.jsx)(`span`,{className:`mr-1.5 font-mono font-semibold tabular-nums text-destructive`,children:n}),(0,X.jsx)(K,{children:`failed`})]}):null,r?(0,X.jsxs)(`span`,{className:`font-mono text-[11px] text-muted-foreground`,children:[`last run `,A(r.completedAt)]}):null,(0,X.jsx)(`span`,{"aria-hidden":!0,className:`h-3 w-px bg-border/60`}),(0,X.jsxs)(g,{to:`/integrations`,className:G+` text-xs text-muted-foreground`,children:[(0,X.jsx)(Re,{className:`size-3`,"aria-hidden":!0}),`Manage targets`]}),(0,X.jsxs)(g,{to:`/integrations?tab=activity`,className:G+` text-xs text-muted-foreground`,children:[(0,X.jsx)(R,{className:`size-3`,"aria-hidden":!0}),`Activity`]}),(0,X.jsxs)(`a`,{href:`${Ut}/integrations/litmus-edge`,target:`_blank`,rel:`noopener noreferrer`,className:G+` text-xs text-muted-foreground`,children:[(0,X.jsx)(jt,{className:`size-3`,"aria-hidden":!0}),`Docs`]})]})]})}function zr(){let e=Zn(),t=l({queryKey:o.integrations.targets(),queryFn:()=>Ce()}),{query:n,cells:r}=Rn(),i=t.data,a=n.data?.operations;if(!i||!a){let e=t.error??n.error;return e?(0,X.jsx)(Fe,{message:Xe(e,`Could not load Litmus Edge status.`),onRetry:()=>{t.refetch(),n.refetch()},isRetrying:t.isFetching||n.isFetching}):(0,X.jsx)(Z,{className:`h-64 w-full`})}let{applied:s,failed:c}=Ln(r),u=a[0];return(0,X.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,X.jsx)(Rr,{targetCount:i.length,applied:s,failed:c,lastOp:u}),(0,X.jsx)(Jn,{targets:i,cells:r,stream:e}),e.operation||e.status===`running`?(0,X.jsx)(Lr,{stream:e,onReset:e.reset}):null]})}function Br(){let e=l({queryKey:o.integrations.targets(),queryFn:()=>Ce()}),{cells:t}=Rn(),n=e.data?.length??0,{applied:r,failed:i}=Ln(t);return(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 font-mono text-[11px] text-muted-foreground`,children:[(0,X.jsx)(`span`,{"aria-hidden":!0,className:L(`size-1.5 shrink-0 rounded-full`,i>0?`bg-destructive`:r>0?`bg-success`:`bg-muted-foreground/50`)}),n===0?(0,X.jsx)(`span`,{className:`font-sans`,children:`No target yet`}):(0,X.jsxs)(`span`,{className:`truncate`,children:[n,` `,n===1?`target`:`targets`,` ·`,` `,(0,X.jsx)(`span`,{className:`text-foreground`,children:r}),` applied`,i>0?(0,X.jsxs)(`span`,{className:`text-destructive`,children:[` · `,i,` failed`]}):null]})]})}var Vr={"litmus-edge":{icon:z,Panel:zr,Summary:Br}};function Hr(e){return e?`/?tab=integrations&integration=${e}`:`/?tab=integrations`}function Ur(){return(0,X.jsxs)(ot,{icon:Vt,title:`Integrations`,description:`Send this factory to the platforms you build on.`,bodyClassName:`gap-1 px-2 py-2`,footer:(0,X.jsxs)(g,{to:Hr(),className:G,children:[`Open integrations`,(0,X.jsx)(oe,{className:`size-3`,"aria-hidden":!0})]}),children:[Dt.map(e=>{let{icon:t,Summary:n}=Vr[e.id];return(0,X.jsxs)(g,{to:Hr(e.id),className:`group flex min-w-0 items-center gap-3 rounded-[var(--miravo-radius-tight)] px-2 py-2 outline-none transition-colors hover:bg-muted/40 focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,X.jsx)(t,{className:`size-3.5 shrink-0 text-primary`,"aria-hidden":!0}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`div`,{className:`truncate text-sm font-medium`,children:e.label}),(0,X.jsx)(n,{})]}),(0,X.jsx)(ge,{className:`size-3.5 shrink-0 text-muted-foreground transition-transform group-hover:translate-x-0.5`,"aria-hidden":!0})]},e.id)}),(0,X.jsxs)(`p`,{className:`px-2 pt-1 pb-0.5 text-[11px] text-muted-foreground`,children:[`Coming soon: `,Tt.map(e=>e.label).join(`, `),`.`]})]})}function Wr(e){return s.prefetchQuery({queryKey:o.assets.detail(e),queryFn:()=>i(`/assets/${e}`,r.assetDetail),staleTime:2e3})}var Gr=`Commissioning → asset is running startup diagnostics. Operating → running normally. Decommissioning → winding down.`;function Kr(e,t,n,r){let i=n===`asc`?1:-1;return[...e].sort((e,n)=>{switch(t){case`id`:return e.id.localeCompare(n.id)*i;case`template`:return(r.get(e.id)??``).localeCompare(r.get(n.id)??``)*i;case`model`:return e.model.localeCompare(n.model)*i;case`lifecycle`:return e.lifecycleStage.localeCompare(n.lifecycleStage)*i;case`hours`:return(e.operatingHours-n.operatingHours)*i;case`faults`:return(e.activeFaults.length-n.activeFaults.length)*i;case`status`:{let t=e=>e.isQuarantined?2:+(e.activeFaults.length>0);return(t(e)-t(n))*i}default:return 0}})}function qr(e){return e.isQuarantined?`quarantined`:e.activeFaults.length>0?`faulted`:`healthy`}var Jr={healthy:{pip:`bg-success`,ring:`border-success/40 text-success`,label:`healthy`,help:`No active faults, not quarantined.`},faulted:{pip:`bg-warning`,ring:`border-warning/40 text-warning`,label:`faulted`,help:`One or more active faults; asset is still running.`},quarantined:{pip:`bg-destructive`,ring:`border-destructive/40 text-destructive`,label:`quarantined`,help:`Asset isolated from production flows pending review.`}};function Yr({state:e}){let t=Jr[e];return(0,X.jsxs)(U,{children:[(0,X.jsxs)(V,{render:(0,X.jsx)(`span`,{className:L(`inline-flex h-5 items-center gap-1.5 rounded-(--miravo-radius-pill) border bg-background/30 px-2 text-[11px] font-medium`,t.ring)}),children:[(0,X.jsx)(`span`,{"aria-hidden":!0,className:L(`size-1.5 shrink-0 rounded-full`,t.pip)}),(0,X.jsx)(`span`,{children:T(t.label)})]}),(0,X.jsx)(H,{side:`top`,children:t.help})]})}function $({label:e,sortKey:t,subtitle:n,tooltip:r,current:i,direction:a,onSort:o,className:s}){let c=i===t,l=c?a===`asc`?`ascending`:`descending`:`none`,u=(0,X.jsxs)(`button`,{type:`button`,className:`flex items-center gap-1 whitespace-nowrap rounded-(--miravo-radius-tight) text-left outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background`,onClick:()=>o(t),children:[(0,X.jsxs)(`span`,{className:`inline-flex items-baseline gap-1`,children:[(0,X.jsx)(`span`,{children:e}),n&&(0,X.jsx)(`span`,{className:`text-[10px] font-normal text-muted-foreground`,children:n})]}),(0,X.jsx)(se,{className:L(`size-3`,c?`text-foreground`:`text-muted-foreground`),"aria-hidden":!0}),(0,X.jsx)(`span`,{className:`sr-only`,children:c?`, sorted ${a===`asc`?`ascending`:`descending`}. Click to toggle.`:`, click to sort`})]});return(0,X.jsx)(xt,{className:s,"aria-sort":l,children:r?(0,X.jsxs)(U,{children:[(0,X.jsx)(V,{render:u}),(0,X.jsx)(H,{side:`top`,children:r})]}):u})}function Xr({title:e,body:t,action:n}){return(0,X.jsx)(vt,{children:(0,X.jsx)(J,{colSpan:8,className:`py-10`,children:(0,X.jsxs)(`div`,{className:`mx-auto flex max-w-sm flex-col items-center gap-2 text-center`,children:[(0,X.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:e}),(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t}),n&&(0,X.jsxs)(g,{to:n.href,className:`mt-1 inline-flex items-center gap-1 rounded-(--miravo-radius-tight) text-xs font-medium text-primary outline-none hover:underline focus-visible:ring-2 focus-visible:ring-ring`,children:[n.label,(0,X.jsx)(oe,{className:`size-3`,"aria-hidden":!0})]})]})})})}function Zr({assets:e,state:t,templateByAsset:n,sortKey:r,sortDir:i,onSort:a,onOpenAsset:o}){return(0,X.jsx)(ut,{className:`py-0`,children:(0,X.jsx)(ft,{className:`p-0 [&_thead_tr_th:last-child]:w-6 [&_thead_tr_th:last-child]:px-1 sm:[&_thead_tr_th:last-child]:w-8 sm:[&_thead_tr_th:last-child]:px-2 [&_tbody_tr_td:last-child]:px-1 sm:[&_tbody_tr_td:last-child]:px-2`,children:(0,X.jsxs)(St,{children:[(0,X.jsx)(Ct,{children:(0,X.jsxs)(vt,{children:[(0,X.jsx)($,{label:`Asset`,sortKey:`id`,current:r,direction:i,onSort:a}),(0,X.jsx)($,{label:`Template`,sortKey:`template`,current:r,direction:i,onSort:a,className:`hidden md:table-cell`}),(0,X.jsx)($,{label:`Model`,sortKey:`model`,current:r,direction:i,onSort:a,className:`hidden sm:table-cell`}),(0,X.jsx)($,{label:`Lifecycle`,sortKey:`lifecycle`,current:r,direction:i,onSort:a,tooltip:Gr}),(0,X.jsx)($,{label:`Operating age`,sortKey:`hours`,current:r,direction:i,onSort:a,tooltip:`Cumulative operating hours since the asset started running.`,className:`hidden text-right md:table-cell`}),(0,X.jsx)($,{label:`Faults`,sortKey:`faults`,current:r,direction:i,onSort:a,tooltip:`Count of active (uncleared) faults on this asset.`}),(0,X.jsx)($,{label:`Status`,sortKey:`status`,current:r,direction:i,onSort:a}),(0,X.jsx)(xt,{children:(0,X.jsx)(`span`,{className:`sr-only`,children:`Navigate to asset`})})]})}),(0,X.jsx)(yt,{children:t===`connecting`?(0,X.jsx)(Xr,{title:`Connecting to runtime`,body:`Live asset data will appear once the connection is up.`}):t===`empty`?(0,X.jsx)(Xr,{title:`No running assets`,body:`Start a factory from the Catalog to see assets.`,action:{label:`Open Catalog`,href:`/catalog`}}):e.length===0?(0,X.jsx)(Xr,{title:`No matches`,body:`Adjust filters or clear them to see all assets.`}):e.map(e=>{let t=qr(e),r=M(e.id);return(0,X.jsxs)(vt,{tabIndex:0,"aria-label":`Open asset ${r}`,className:L(`group cursor-pointer outline-none transition-colors`,`focus-visible:bg-sidebar-accent focus-visible:ring-2 focus-visible:ring-ring/70 focus-visible:ring-inset`),onClick:()=>o(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),o(e.id))},onMouseEnter:()=>{Ge(`/asset/${e.id}`),Wr(e.id)},onFocus:()=>{Ge(`/asset/${e.id}`),Wr(e.id)},children:[(0,X.jsx)(J,{className:`text-sm`,children:(0,X.jsx)(Y.ViewTransition,{name:`asset-${e.id}`,default:`none`,children:(0,X.jsx)(`span`,{className:`inline-flex max-w-full truncate rounded-(--miravo-radius-tight) text-left`,title:e.id,children:r})})}),(0,X.jsx)(J,{className:`hidden text-sm text-muted-foreground md:table-cell`,children:n.get(e.id)??`Standalone`}),(0,X.jsx)(J,{className:`hidden text-sm sm:table-cell`,children:N(e.model)}),(0,X.jsx)(J,{children:(0,X.jsx)(qe,{variant:`secondary`,className:`text-xs`,children:D(e.lifecycleStage)})}),(0,X.jsx)(J,{className:`hidden font-mono text-sm md:table-cell`,children:j(e.operatingHours)}),(0,X.jsx)(J,{children:e.activeFaults.length>0?(0,X.jsxs)(U,{children:[(0,X.jsx)(V,{render:(0,X.jsx)(`span`,{className:`inline-flex h-5 min-w-5 items-center justify-center rounded-(--miravo-radius-pill) bg-destructive/15 px-1.5 font-mono text-[11px] font-semibold tabular-nums text-destructive`}),children:e.activeFaults.length}),(0,X.jsxs)(H,{side:`top`,children:[e.activeFaults.slice(0,4).join(`, `),e.activeFaults.length>4&&` + ${e.activeFaults.length-4} more`]})]}):(0,X.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[(0,X.jsx)(`span`,{className:`sr-only`,children:`no faults`}),(0,X.jsx)(`span`,{"aria-hidden":!0,children:`—`})]})}),(0,X.jsx)(J,{children:(0,X.jsx)(Yr,{state:t})}),(0,X.jsx)(J,{children:(0,X.jsx)(oe,{className:`size-3.5 text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100`,"aria-hidden":!0})})]},e.id)})})]})})})}var Qr=`~all`,$r=`~standalone`;function ei(e){return e===``||e===`healthy`||e===`faulted`||e===`quarantined`}function ti(){let{assets:e,templates:t,connectionState:n}=a(S(e=>({assets:e.assets,templates:e.templates,connectionState:e.connectionState}))),[r,i]=p(`q`,m.withDefault(``)),[o,s]=p(`model`,m.withDefault(``)),[c,l]=p(`lifecycle`,m.withDefault(``)),[u,d]=p(`template`,m.withDefault(``)),[f,h]=p(`standalone`,m.withDefault(``)),g=f===`1`,[_,v]=p(`status`,m.withDefault(``)),y=ei(_)?_:``,[b,ee]=(0,Y.useState)(`id`),[x,te]=(0,Y.useState)(`asc`),C=(0,Y.useRef)(null),w=Ke(),[T,E]=(0,Y.useState)(``);(0,Y.useEffect)(()=>{let e=e=>{if(e.key!==`/`||e.metaKey||e.ctrlKey||e.altKey)return;let t=e.target.tagName;t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||(e.preventDefault(),C.current?.focus())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let O=(0,Y.useCallback)(e=>{e===b?te(e=>e===`asc`?`desc`:`asc`):(ee(e),te(`asc`))},[b]),k=(0,Y.useMemo)(()=>{let e=new Map;for(let n of t)for(let t of n.assetIds)e.set(t,n.templateName);return e},[t]),A=(0,Y.useMemo)(()=>[{value:Qr,label:`All templates`},{value:$r,label:`Standalone`},...t.map(e=>({value:e.templateId,label:e.templateName}))],[t]),j=(0,Y.useMemo)(()=>{let t=new Map;for(let n of e)t.set(n.model,(t.get(n.model)??0)+1);return[...t.entries()].sort((e,t)=>e[0].localeCompare(t[0]))},[e]),M=(0,Y.useMemo)(()=>[...new Set(e.map(e=>e.lifecycleStage))].sort(),[e]),P=(0,Y.useMemo)(()=>[{value:`all`,label:`All stages`},...M.map(e=>({value:e,label:D(e)}))],[M]),I=(0,Y.useMemo)(()=>T?j.filter(([e])=>F(e,T)):j,[j,T]),L=(0,Y.useMemo)(()=>o?{value:o,label:N(o)}:null,[o]),R=(0,Y.useMemo)(()=>{let n=e;if(g)n=n.filter(e=>!k.has(e.id));else if(u){let e=new Set(t.find(e=>e.templateId===u)?.assetIds);n=n.filter(t=>e.has(t.id))}return o&&(n=n.filter(e=>e.model===o)),c&&(n=n.filter(e=>e.lifecycleStage===c)),r&&(n=n.filter(e=>ie(e.id,r)||F(e.model,r))),y===`faulted`&&(n=n.filter(e=>e.activeFaults.length>0)),y===`quarantined`&&(n=n.filter(e=>e.isQuarantined)),y===`healthy`&&(n=n.filter(e=>e.activeFaults.length===0&&!e.isQuarantined)),Kr(n,b,x,k)},[e,t,k,u,g,r,y,o,c,b,x]),ae=y!==``||u!==``||g||o!==``||c!==``||r!==``,oe=(0,Y.useCallback)(()=>{i(``),v(``),d(``),h(``),s(``),l(``)},[i,v,d,h,s,l]),z=(0,Y.useCallback)(e=>{w(`/asset/${e}`,{transitionType:Je})},[w]),se=e.length>0?`rows`:n===`live`?`empty`:`connecting`;return(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[t.length>0&&(0,X.jsxs)(_t,{value:g?$r:u||Qr,onValueChange:e=>{h(e===$r?`1`:``),d(!e||e===Qr||e===$r?``:e)},items:A,children:[(0,X.jsx)(gt,{className:`h-8 w-44`,"aria-label":`Template filter`,children:(0,X.jsx)(mt,{placeholder:`All templates`})}),(0,X.jsx)(ht,{alignItemWithTrigger:!1,align:`start`,children:A.map(e=>(0,X.jsx)(q,{value:e.value,children:e.label},e.value))})]}),(0,X.jsxs)(pt,{value:L,onValueChange:e=>void s(e?.value??``),isItemEqualToValue:(e,t)=>e?.value===t?.value,onInputValueChange:E,children:[(0,X.jsx)(dt,{placeholder:`All models`,className:`h-8 w-48`,showClear:!!o}),(0,X.jsx)(lt,{children:(0,X.jsxs)(st,{children:[I.map(([e,t])=>(0,X.jsxs)(ct,{value:{value:e,label:N(e)},children:[(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:N(e)}),(0,X.jsxs)(`span`,{className:`shrink-0 tabular-nums text-muted-foreground`,children:[`(`,t,`)`]})]},e)),I.length===0&&(0,X.jsx)(`p`,{className:`py-2 text-center text-xs text-muted-foreground`,children:`No models found`})]})})]}),M.length>1&&(0,X.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,X.jsxs)(_t,{value:c||`all`,onValueChange:e=>void l(!e||e===`all`?``:e),items:P,children:[(0,X.jsx)(gt,{className:`h-8 w-36`,"aria-label":`Lifecycle stage`,children:(0,X.jsx)(mt,{placeholder:`All stages`})}),(0,X.jsxs)(ht,{alignItemWithTrigger:!1,align:`start`,children:[(0,X.jsx)(q,{value:`all`,children:`All stages`}),M.map(e=>(0,X.jsx)(q,{value:e,children:D(e)},e))]})]}),(0,X.jsxs)(U,{children:[(0,X.jsx)(V,{render:(0,X.jsx)(`button`,{type:`button`,"aria-label":`About lifecycle stages`,className:`flex size-6 items-center justify-center rounded-(--miravo-radius-tight) text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring`}),children:(0,X.jsx)(we,{className:`size-3.5`,"aria-hidden":!0})}),(0,X.jsx)(H,{side:`top`,children:`Commissioning → asset is running startup diagnostics. Operating → running normally. Decommissioning → winding down.`})]})]}),(0,X.jsxs)(_t,{value:y||`all`,onValueChange:e=>void v(!e||e===`all`?``:e),items:bt,children:[(0,X.jsx)(gt,{className:`h-8 w-32`,"aria-label":`Status filter`,children:(0,X.jsx)(mt,{placeholder:`All status`})}),(0,X.jsxs)(ht,{alignItemWithTrigger:!1,align:`start`,children:[(0,X.jsx)(q,{value:`all`,children:`All status`}),(0,X.jsx)(q,{value:`healthy`,children:`Healthy`}),(0,X.jsx)(q,{value:`faulted`,children:`Faulted`}),(0,X.jsx)(q,{value:`quarantined`,children:`Quarantined`})]})]}),(0,X.jsxs)(`div`,{className:`relative`,children:[(0,X.jsx)(ne,{ref:C,placeholder:`Search...`,value:r,onChange:e=>void i(e.target.value),"aria-label":`Search assets by id or model`,className:`h-8 w-40 pr-7 text-xs`}),!r&&(0,X.jsx)(`kbd`,{className:`pointer-events-none absolute top-1/2 right-2 -translate-y-1/2 rounded-(--miravo-radius-tight) border border-border bg-muted px-1 font-mono text-[10px] text-muted-foreground`,children:`/`})]}),ae&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`button`,{type:`button`,onClick:oe,className:`flex items-center gap-1 rounded-(--miravo-radius-tight) px-1 text-xs text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,X.jsx)(re,{className:`size-3`,"aria-hidden":!0}),`Clear`]}),(0,X.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,"aria-live":`polite`,children:[R.length,` of `,e.length]})]})]}),(0,X.jsx)(Zr,{assets:R,state:se,templateByAsset:k,sortKey:b,sortDir:x,onSort:O,onOpenAsset:z})]})}var ni={running:`live`,paused:`idle`,stopped:`fault`};function ri(){let{factoryName:e,engineState:t,seed:n,speed:r,bootTemplate:i}=a(S(e=>({factoryName:e.factoryName,engineState:e.engineState,seed:e.seed,speed:e.speedMultiplier,bootTemplate:e.bootTemplate})));return(0,X.jsxs)(`header`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,X.jsx)(`h1`,{className:`font-heading text-2xl font-semibold tracking-tight`,children:e&&!Qe(e)?O(e):`Factory`}),(0,X.jsx)(W,{tone:ni[t]??`off`,children:(0,X.jsx)(K,{children:t})})]}),(0,X.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 font-mono text-[11px] text-muted-foreground`,children:[e?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`span`,{children:[`id `,(0,X.jsx)(`span`,{className:`text-foreground`,children:e})]}),(0,X.jsx)(`span`,{"aria-hidden":!0,className:`h-3 w-px bg-border/60`})]}):null,(0,X.jsxs)(`span`,{children:[`seed `,(0,X.jsx)(`span`,{className:`text-foreground`,children:n??`-`})]}),(0,X.jsx)(`span`,{"aria-hidden":!0,className:`h-3 w-px bg-border/60`}),(0,X.jsxs)(`span`,{children:[(0,X.jsxs)(`span`,{className:`text-foreground`,children:[r,`×`]}),` speed`]}),i?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{"aria-hidden":!0,className:`h-3 w-px bg-border/60`}),(0,X.jsxs)(`span`,{children:[`booted with `,(0,X.jsx)(`span`,{className:`text-foreground`,children:i.name})]})]}):null]})]}),(0,X.jsxs)(g,{to:`/catalog`,className:P({size:`sm`}),children:[(0,X.jsx)(Ne,{className:`size-3.5`,"aria-hidden":!0}),`Load template`]})]})}var ii=Dt.map(e=>e.id),ai=`inline-flex h-8 shrink-0 items-center gap-2 rounded-[var(--miravo-radius-pill)] border px-3 text-xs outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring`;function oi(){let[e,t]=p(`integration`,h(ii).withDefault(Et.id)),{Panel:n}=Vr[e];return(0,X.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,X.jsxs)(`nav`,{"aria-label":`Integrations`,className:`flex flex-wrap gap-2`,children:[Dt.map(n=>{let{icon:r}=Vr[n.id],i=n.id===e;return(0,X.jsxs)(`button`,{type:`button`,"aria-pressed":i,onClick:()=>void t(n.id),className:L(ai,i?`border-primary/45 bg-primary/10 text-foreground`:`border-border/60 text-muted-foreground hover:border-muted-foreground/50 hover:text-foreground`),children:[(0,X.jsx)(r,{className:L(`size-3.5`,i&&`text-primary`),"aria-hidden":!0}),n.label]},n.id)}),Tt.map(e=>(0,X.jsxs)(`span`,{"aria-disabled":!0,className:L(ai,`cursor-default border-dashed border-border/60 text-muted-foreground/70`),children:[(0,X.jsx)(Vt,{className:`size-3.5`,"aria-hidden":!0}),e.label,(0,X.jsx)(`span`,{className:`text-[10px] uppercase tracking-[0.14em]`,children:`Soon`})]},e.id))]}),(0,X.jsx)(n,{})]})}function si(e={}){let t=new URLSearchParams({tab:`assets`});return e.template&&t.set(`template`,e.template),e.standalone&&t.set(`standalone`,`1`),e.model&&t.set(`model`,e.model),e.status&&t.set(`status`,e.status),`/?${t.toString()}`}var ci={healthy:`border-muted-foreground/25 bg-muted/40 text-foreground/90 hover:border-muted-foreground/50`,faulted:`border-destructive/40 bg-destructive/10 text-destructive hover:border-destructive/70`,quarantined:`border-warning/40 bg-warning/10 text-warning hover:border-warning/70`},li={healthy:`bg-success`,faulted:`bg-destructive`,quarantined:`bg-warning`};function ui({group:e,label:t,templateId:n}){let[r]=e.ids;return(0,X.jsxs)(g,{to:e.ids.length===1&&r?`/asset/${r}`:si({model:e.model,template:n}),title:e.ids.join(`, `),className:L(`inline-flex h-6 items-center gap-1.5 rounded-[var(--miravo-radius-tight)] border px-1.5 font-mono text-[11px] outline-none transition-colors hover:bg-muted/40 focus-visible:ring-2 focus-visible:ring-ring`,ci[e.health]),children:[(0,X.jsx)(`span`,{"aria-hidden":!0,className:L(`size-1.5 shrink-0 rounded-full`,li[e.health])}),t,e.ids.length>1&&(0,X.jsxs)(`span`,{className:`text-muted-foreground`,children:[`×`,e.ids.length]}),e.health!==`healthy`&&(0,X.jsxs)(`span`,{className:`sr-only`,children:[`, `,e.health]})]})}function di(e){return e.isQuarantined?`quarantined`:e.activeFaults.length>0?`faulted`:`healthy`}var fi=24;function pi(){let{assets:e,templates:t}=a(S(e=>({assets:e.assets,templates:e.templates}))),[n,r]=(0,Y.useState)(!1),i=new Set(t.flatMap(e=>e.assetIds)),o=e.filter(e=>!i.has(e.id));if(o.length===0)return null;let s=n?o:o.slice(0,fi);return(0,X.jsxs)(`section`,{"aria-label":`Standalone assets`,className:L(et,`flex flex-col gap-4 p-5`),children:[(0,X.jsxs)(`header`,{className:`flex items-start gap-3`,children:[(0,X.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-[var(--miravo-radius-stadium-sm)] bg-primary/10 text-primary`,children:(0,X.jsx)(Lt,{className:`size-5`,"aria-hidden":!0})}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,X.jsx)(`h2`,{className:`truncate font-heading text-sm font-semibold uppercase tracking-wide`,children:`Standalone assets`}),(0,X.jsx)(`span`,{className:`text-xs text-foreground/75`,children:`Spawned from a model, outside any template.`})]})]}),(0,X.jsxs)(`ul`,{className:`flex flex-wrap gap-1.5`,children:[s.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsx)(ui,{group:{model:e.model,ids:[e.id],health:di(e)},label:e.id})},e.id)),o.length>fi&&(0,X.jsx)(`li`,{children:(0,X.jsx)(w,{size:`xs`,variant:`ghost`,onClick:()=>r(e=>!e),children:n?`Show fewer`:`+${o.length-fi} more`})})]}),(0,X.jsxs)(`div`,{className:`mt-auto font-mono text-[11px] text-muted-foreground`,children:[(0,X.jsx)(`span`,{className:`text-foreground`,children:o.length}),` asset`,o.length===1?``:`s`]}),(0,X.jsxs)(`footer`,{className:`flex items-center gap-2 border-t border-border/30 pt-3`,children:[(0,X.jsxs)(g,{to:si({standalone:!0}),className:L(P({size:`sm`,variant:`outline`}),$e),children:[(0,X.jsx)(Mt,{className:`size-3.5`,"aria-hidden":!0}),`View assets`]}),(0,X.jsxs)(g,{to:`/models`,className:L(P({size:`sm`,variant:`ghost`}),`ml-auto text-muted-foreground`),children:[(0,X.jsx)(Ne,{className:`size-3.5`,"aria-hidden":!0}),`Spawn asset`]})]})]})}function mi({template:e,open:t,onOpenChange:n}){let r=tt(),[i,a]=(0,Y.useState)(!1);return(0,X.jsx)(te,{open:t,onOpenChange:n,children:(0,X.jsxs)(b,{children:[(0,X.jsxs)(v,{children:[(0,X.jsxs)(ee,{children:[`Unload `,e.templateName]}),(0,X.jsxs)(x,{children:[`Removes its `,e.assetIds.length,` asset`,e.assetIds.length===1?``:`s`,`. Standalone assets stay.`]})]}),(0,X.jsxs)(y,{children:[(0,X.jsx)(w,{variant:`outline`,onClick:()=>n(!1),disabled:i,children:`Cancel`}),(0,X.jsx)(w,{variant:`destructive`,disabled:i,onClick:async()=>{a(!0);try{await r.mutateAsync({type:`unloadTemplate`,templateId:e.templateId}),n(!1)}catch{}finally{a(!1)}},children:`Unload`})]})]})})}function hi({value:e,label:t}){return(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`span`,{className:`text-foreground`,children:e}),` `,t,e===1?``:`s`]})}function gi(e,t){let n=new Set(e.assetIds),r=new Set;for(let e of t)n.has(e.id)&&di(e)!==`healthy`&&r.add(N(e.model));return[...r]}function _i({template:e,highlighted:t=!1}){let{assets:n,engineState:s}=a(S(e=>({assets:e.assets,engineState:e.engineState}))),c=l({queryKey:o.catalog.templates(),queryFn:()=>i(`/catalog/templates`,r.catalogTemplates)}),[u,d]=(0,Y.useState)(!1),[f,p]=(0,Y.useState)(!1),m=c.data?.find(t=>t.id===e.templateId)?.description,h=new Set(e.assetIds),_=n.filter(e=>h.has(e.id)&&di(e)!==`healthy`).length,v=_>0?gi(e,n):[],y=e.areas.reduce((e,t)=>e+t.lines.length,0);return(0,X.jsxs)(`section`,{id:`template-${e.templateId}`,"aria-label":e.templateName,className:L(et,`flex scroll-mt-4 flex-col gap-4 p-5 transition-shadow`,t&&`ring-2 ring-ring`),children:[(0,X.jsxs)(`header`,{className:`flex items-start gap-3`,children:[(0,X.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-[var(--miravo-radius-stadium-sm)] bg-primary/10 text-primary`,children:(0,X.jsx)(me,{id:e.templateId,className:`size-5`})}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,X.jsx)(`h2`,{className:`truncate font-heading text-sm font-semibold uppercase tracking-wide`,children:e.templateName}),(0,X.jsx)(`span`,{className:`truncate font-mono text-[10px] text-muted-foreground`,children:e.templateId})]}),_>0?(0,X.jsxs)(W,{tone:`fault`,children:[(0,X.jsx)(`span`,{className:`font-mono font-semibold tabular-nums text-foreground`,children:_}),` `,(0,X.jsx)(K,{children:`faulted`})]}):(0,X.jsx)(W,{tone:s===`running`?`live`:`idle`,children:(0,X.jsx)(K,{children:s===`running`?`running`:`paused`})})]}),m?(0,X.jsx)(`p`,{className:`line-clamp-2 text-pretty text-xs leading-relaxed text-muted-foreground`,children:m}):null,(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 font-mono text-[11px] text-muted-foreground`,children:[(0,X.jsx)(hi,{value:e.areas.length,label:`area`}),(0,X.jsx)(hi,{value:y,label:`line`}),(0,X.jsx)(hi,{value:e.assetIds.length,label:`asset`}),(0,X.jsx)(hi,{value:e.models.length,label:`model`})]}),v.length>0?(0,X.jsxs)(g,{to:si({template:e.templateId,status:`faulted`}),className:`flex min-w-0 items-center gap-2 rounded-[var(--miravo-radius-tight)] border border-destructive/30 bg-destructive/8 px-2.5 py-1.5 text-xs text-destructive outline-none transition-colors hover:border-destructive/60 focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,X.jsx)(We,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),(0,X.jsxs)(`span`,{className:`min-w-0 truncate`,children:[(0,X.jsxs)(`span`,{className:`font-medium`,children:[_,` faulted:`]}),` `,v.join(`, `)]})]}):null,(0,X.jsxs)(`footer`,{className:`mt-auto flex items-center gap-2 border-t border-border/30 pt-3`,children:[(0,X.jsxs)(w,{type:`button`,size:`sm`,variant:`outline`,className:$e,onClick:()=>p(!0),children:[(0,X.jsx)(Ae,{className:`size-3.5`,"aria-hidden":!0}),`Inspect`]}),Ot(e.templateId)?(0,X.jsxs)(g,{to:kt(e.templateId),className:P({size:`sm`,variant:`ghost`}),children:[(0,X.jsx)(Me,{className:`size-3.5`,"aria-hidden":!0}),`Open floor`]}):null,(0,X.jsx)(w,{size:`sm`,variant:`ghost`,className:`ml-auto text-muted-foreground hover:bg-destructive/12 hover:text-destructive`,onClick:()=>d(!0),children:`Unload`})]}),(0,X.jsx)(mi,{template:e,open:u,onOpenChange:d}),(0,X.jsx)(pe,{templateId:f?e.templateId:null,onClose:()=>p(!1),actions:(0,X.jsxs)(g,{to:si({template:e.templateId}),className:P({size:`sm`,variant:`ghost`}),children:[(0,X.jsx)(Mt,{className:`size-3.5`,"aria-hidden":!0}),`View assets`]}),fallbackTitle:e.templateName})]})}var vi={success:`bg-success`,warning:`bg-warning`,destructive:`bg-destructive`,foreground:`bg-foreground/60`,primary:`bg-primary`},yi={success:`text-success`,warning:`text-warning`,destructive:`text-destructive`,foreground:`text-foreground`,primary:`text-primary`},bi={mqtt:`MQTT`,opcua:`OPC UA`,modbus:`Modbus`};function xi({label:e,pip:t,pulse:n}){return(0,X.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[t&&(n?(0,X.jsxs)(`span`,{"aria-hidden":!0,className:`relative flex size-1.5 shrink-0 items-center justify-center`,children:[(0,X.jsx)(`span`,{className:L(`absolute inline-flex h-full w-full animate-ping rounded-full opacity-75`,vi[t])}),(0,X.jsx)(`span`,{className:L(`relative inline-flex size-1.5 rounded-full`,vi[t])})]}):(0,X.jsx)(`span`,{"aria-hidden":!0,className:L(`size-1.5 shrink-0 rounded-full`,vi[t])})),(0,X.jsx)(`span`,{className:`truncate text-[10px] font-medium uppercase tracking-(--miravo-tracking-eyebrow) text-muted-foreground`,children:e})]})}function Si({children:e,tone:t=`foreground`,live:n}){return(0,X.jsx)(`span`,{...n?{role:`status`,"aria-live":`polite`}:{},className:L(`mt-1 block min-w-0 truncate font-mono text-2xl font-semibold tabular-nums leading-none transition-colors duration-300`,yi[t]),children:e})}function Ci({children:e}){return(0,X.jsx)(`span`,{className:`mt-1 min-w-0 truncate text-[10px] text-muted-foreground`,children:e})}function wi(e,t){return e===t?``:t}function Ti({statusFilter:e,onStatusFilter:t}){let{assets:n,tps:r,memberValueCount:i,availableAdapters:o,adapterMetrics:s}=a(S(e=>({assets:e.assets,tps:e.tps,memberValueCount:e.memberValueCount,availableAdapters:e.availableAdapters,adapterMetrics:e.adapterMetrics}))),c=(0,Y.useMemo)(()=>{let e=n.filter(e=>!e.isQuarantined&&e.activeFaults.length===0).length,t=n.filter(e=>!e.isQuarantined&&e.activeFaults.length>0).length,r=n.filter(e=>e.isQuarantined).length,i=n.length;return{healthy:e,faulted:t,quarantined:r,total:i,pct:i>0?Math.round(e/i*100):100,activeFaultCount:n.reduce((e,t)=>e+t.activeFaults.length,0),modelCount:new Set(n.map(e=>e.model)).size,affectedCount:new Set(n.filter(e=>e.activeFaults.length>0).map(e=>e.id)).size}},[n]),l=(0,Y.useMemo)(()=>{let e=o.filter(e=>e.enabled);return{enabled:e,totalMessages:e.reduce((e,t)=>e+(s.find(e=>e.name===t.name)?.metrics?.messagesPublished??0),0),totalErrors:e.reduce((e,t)=>e+(s.find(e=>e.name===t.name)?.metrics?.errorsCount??0),0),labels:e.map(e=>bi[e.name]??e.name)}},[o,s]),u=c.activeFaultCount>0,d=u?`destructive`:c.quarantined>0?`warning`:`success`,f=u?`faulted`:`healthy`;return(0,X.jsxs)(`section`,{"aria-label":`Asset status`,className:`grid w-full min-w-0 max-w-full grid-cols-2 overflow-hidden rounded-(--miravo-radius-stadium-sm) border *:border-border/40 *:odd:border-r *:nth-[-n+2]:border-b @2xl/main:grid-cols-4 @2xl/main:*:border-b-0 @2xl/main:*:not-last:border-r`,children:[(0,X.jsxs)(`button`,{type:`button`,onClick:()=>t(wi(e,f)),"aria-pressed":e===`healthy`||e===`faulted`,"aria-label":u?`Filter to faulted assets`:`Filter to healthy assets`,className:L(`flex min-w-0 flex-1 flex-col overflow-hidden px-4 py-3 text-left outline-none transition-colors duration-150`,`hover:bg-muted/40 focus-visible:bg-muted/40 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`,(e===`healthy`||e===`faulted`)&&`bg-muted/50`),children:[(0,X.jsx)(xi,{label:`Health`,pip:d}),(0,X.jsxs)(Si,{tone:u?`destructive`:`success`,children:[c.pct,`%`]}),(0,X.jsx)(Ci,{children:c.total===0?`No assets`:[`${c.total} asset${c.total===1?``:`s`}`,c.faulted>0&&`${c.faulted} faulted`,c.quarantined>0&&`${c.quarantined} quarantined`,`${c.modelCount} model${c.modelCount===1?``:`s`}`].filter(Boolean).join(` · `)})]}),(0,X.jsxs)(`button`,{type:`button`,onClick:()=>t(e===`faulted`?``:`faulted`),"aria-pressed":e===`faulted`,"aria-label":`Filter to faulted assets`,className:L(`flex min-w-0 flex-1 flex-col overflow-hidden px-4 py-3 text-left outline-none transition-colors duration-150`,`hover:bg-muted/40 focus-visible:bg-muted/40 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`,e===`faulted`&&`bg-muted/50`),children:[(0,X.jsx)(xi,{label:`Faults`,pip:u?`destructive`:`success`}),(0,X.jsx)(Si,{tone:u?`destructive`:`foreground`,live:!0,children:c.activeFaultCount}),(0,X.jsx)(Ci,{children:u?`${c.affectedCount} asset${c.affectedCount===1?``:`s`} affected`:`all clear`})]}),(0,X.jsxs)(U,{children:[(0,X.jsxs)(V,{render:(0,X.jsx)(g,{to:`/tags`,"aria-label":`Open tag stream`,className:`flex min-w-0 flex-1 flex-col overflow-hidden px-4 py-3 outline-none transition-colors duration-150 hover:bg-muted/40 focus-visible:bg-muted/40 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`}),children:[(0,X.jsx)(xi,{label:`Tags`,pip:`primary`,pulse:!0}),(0,X.jsx)(Si,{children:E(i)}),(0,X.jsxs)(Ci,{children:[(0,X.jsx)(`span`,{className:`font-mono tabular-nums`,children:r.toFixed(1)}),` tps · live`]})]}),(0,X.jsx)(H,{side:`bottom`,children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-0.5 text-[11px]`,children:[(0,X.jsx)(`span`,{children:`Live tags tracked across the fleet.`}),i>=1e6&&(0,X.jsxs)(`span`,{className:`font-mono tabular-nums text-muted-foreground`,children:[k(i),` tags`]}),(0,X.jsxs)(`span`,{className:`text-muted-foreground`,children:[`Updating at `,(0,X.jsx)(`span`,{className:`font-mono tabular-nums`,children:r.toFixed(1)}),` per second.`]})]})})]}),l.enabled.length>0&&(0,X.jsx)(Ei,{labels:l.labels,totalMessages:l.totalMessages,totalErrors:l.totalErrors,perAdapter:l.enabled.map(e=>({name:bi[e.name]??e.name,metrics:s.find(t=>t.name===e.name)?.metrics}))})]})}function Ei({labels:e,totalMessages:t,totalErrors:n,perAdapter:r}){return(0,X.jsxs)(U,{children:[(0,X.jsxs)(V,{render:(0,X.jsx)(g,{to:`/control`,"aria-label":`Open control — protocol adapters`,className:`flex min-w-0 flex-1 flex-col overflow-hidden px-4 py-3 outline-none transition-colors duration-150 hover:bg-muted/40 focus-visible:bg-muted/40 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`}),children:[(0,X.jsx)(xi,{label:`Protocol`,pip:`primary`,pulse:!0}),(0,X.jsx)(Si,{tone:n>0?`warning`:`foreground`,live:!0,children:E(t)}),(0,X.jsxs)(Ci,{children:[e.join(` · `),n>0&&` · ${n} error${n===1?``:`s`}`]})]}),(0,X.jsx)(H,{side:`bottom`,children:(0,X.jsxs)(`div`,{className:`flex flex-col gap-1 text-[11px]`,children:[(0,X.jsx)(`span`,{children:`Messages published since session start.`}),t>=1e6&&(0,X.jsxs)(`span`,{className:`font-mono tabular-nums text-muted-foreground`,children:[k(t),` total`]}),(0,X.jsx)(`div`,{className:`flex flex-col gap-0.5 border-t border-tooltip-border/60 pt-1`,children:r.map(e=>(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,X.jsxs)(`span`,{className:`font-mono tabular-nums`,children:[k(e.metrics?.messagesPublished??0),` msg`]}),e.metrics&&e.metrics.errorsCount>0&&(0,X.jsxs)(`span`,{className:`font-mono tabular-nums text-destructive`,children:[`· `,e.metrics.errorsCount,` err`]})]},e.name))})]})})]})}var Di=2500,Oi=[`overview`,`assets`,`integrations`];function ki({value:e}){return(0,X.jsx)(`span`,{className:`rounded-full bg-muted px-1.5 font-mono text-[10px] leading-4 tabular-nums text-muted-foreground`,children:e})}function Ai({children:e}){return(0,X.jsx)(u.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.15,ease:`easeOut`},children:e})}function ji(){return(0,X.jsxs)(`div`,{className:`flex flex-col items-start gap-3 rounded-[var(--miravo-radius-stadium-sm)] border border-dashed border-border p-5`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium`,children:[(0,X.jsx)(zt,{className:`size-4 text-muted-foreground`,"aria-hidden":!0}),`Nothing is running yet`]}),(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Load a template from the catalog. Its areas, lines and assets show up here, live.`}),(0,X.jsx)(g,{to:`/catalog`,className:P({size:`sm`}),children:`Open catalog`})]})}function Mi({highlight:e}){let{templates:t,assetCount:n}=a(S(e=>({templates:e.templates,assetCount:e.assets.length})));return(0,X.jsx)(`div`,{className:`@container/overview`,children:(0,X.jsxs)(`div`,{className:`grid items-start gap-5 @3xl/overview:grid-cols-[minmax(0,1fr)_20rem] @7xl/overview:grid-cols-[minmax(0,1fr)_22rem]`,children:[t.length===0&&n===0?(0,X.jsx)(ji,{}):(0,X.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(min(100%,22rem),1fr))] gap-4`,children:[t.map(t=>(0,X.jsx)(_i,{template:t,highlighted:t.templateId===e},t.templateId)),(0,X.jsx)(pi,{})]}),(0,X.jsxs)(`div`,{className:`grid min-w-0 gap-5 @xl/overview:grid-cols-2 @3xl/overview:sticky @3xl/overview:top-4 @3xl/overview:grid-cols-1`,children:[(0,X.jsx)(Wt,{}),(0,X.jsx)(Ur,{})]})]})})}function Ni(){let{hash:e}=_(),{templates:t,assetCount:n}=a(S(e=>({templates:e.templates,assetCount:e.assets.length}))),[r,i]=p(`tab`,h(Oi).withDefault(`overview`)),[o,s]=p(`highlight`,m.withDefault(``)),[c,l]=p(`status`,m.withDefault(``)),u=c===`healthy`||c===`faulted`||c===`quarantined`?c:``;(0,Y.useEffect)(()=>{if(!e)return;e===`#connect`&&i(null);let t=setTimeout(()=>{let t=document.getElementById(e.slice(1));t?.scrollIntoView({behavior:`smooth`,block:`start`}),t?.focus({preventScroll:!0})},50);return()=>clearTimeout(t)},[e,i]);let d=t.some(e=>e.templateId===o);return(0,Y.useEffect)(()=>{if(!o||!d)return;document.getElementById(`template-${o}`)?.scrollIntoView({behavior:`smooth`,block:`center`});let e=setTimeout(()=>void s(null,{history:`replace`}),Di);return()=>clearTimeout(e)},[o,d,s]),(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:[(0,X.jsx)(ri,{}),(0,X.jsx)(Ti,{statusFilter:u,onStatusFilter:e=>{l(e||null),e!==``&&i(`assets`)}}),(0,X.jsxs)(at,{value:r,onValueChange:e=>void i(e),children:[(0,X.jsx)(`div`,{className:`overflow-x-auto`,children:(0,X.jsxs)(it,{variant:`line`,className:`h-10! min-w-max gap-0.5`,children:[(0,X.jsxs)(nt,{value:`overview`,className:`gap-1.5 px-3 text-sm`,children:[(0,X.jsx)(fe,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),`Overview`,(0,X.jsx)(ki,{value:t.length})]}),(0,X.jsxs)(nt,{value:`assets`,className:`gap-1.5 px-3 text-sm`,children:[(0,X.jsx)(Mt,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),`Assets`,(0,X.jsx)(ki,{value:n})]}),(0,X.jsxs)(nt,{value:`integrations`,className:`gap-1.5 px-3 text-sm`,children:[(0,X.jsx)(Vt,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),`Integrations`]})]})}),(0,X.jsx)(rt,{value:`overview`,className:`py-2`,children:(0,X.jsx)(Ai,{children:(0,X.jsx)(Mi,{highlight:o})})}),(0,X.jsx)(rt,{value:`assets`,className:`py-2`,children:(0,X.jsx)(Ai,{children:(0,X.jsx)(ti,{})})}),(0,X.jsx)(rt,{value:`integrations`,className:`py-2`,children:(0,X.jsx)(Ai,{children:(0,X.jsx)(oi,{})})})]})]})}export{Ft as a,zt as i,Ut as n,Mt as o,Vt as r,jt as s,Ni as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./factory-C2OucdpQ.js";export{e as FactoryPage};
@@ -0,0 +1 @@
1
+ import{n as e}from"./utils-XFKvwlFT.js";var t=e(`factory`,[[`path`,{d:`M12 16h.01`,key:`1drbdi`}],[`path`,{d:`M16 16h.01`,key:`1f9h7w`}],[`path`,{d:`M3 19a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8.5a.5.5 0 0 0-.769-.422l-4.462 2.844A.5.5 0 0 1 15 10.5v-2a.5.5 0 0 0-.769-.422L9.77 10.922A.5.5 0 0 1 9 10.5V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2z`,key:`1iv0i2`}],[`path`,{d:`M8 16h.01`,key:`18s6g9`}]]);export{t};