@synnaxlabs/pluto 0.16.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Keyboard-79lsaV0f.cjs → Keyboard-Jopa0ImN.cjs} +2 -2
- package/dist/{Keyboard-79lsaV0f.cjs.map → Keyboard-Jopa0ImN.cjs.map} +1 -1
- package/dist/{Keyboard-SVZgM51r.js → Keyboard-kcohZ0JP.js} +2 -2
- package/dist/{Keyboard-SVZgM51r.js.map → Keyboard-kcohZ0JP.js.map} +1 -1
- package/dist/{Link-PQmsc2rv.js → Link-4oN98LnE.js} +2 -2
- package/dist/{Link-PQmsc2rv.js.map → Link-4oN98LnE.js.map} +1 -1
- package/dist/{Link-z0ioMNDX.cjs → Link-5t5MufKE.cjs} +2 -2
- package/dist/{Link-z0ioMNDX.cjs.map → Link-5t5MufKE.cjs.map} +1 -1
- package/dist/{Toggle-wVZJoVtX.cjs → Toggle-qW_TcIDh.cjs} +13 -13
- package/dist/{Toggle-wVZJoVtX.cjs.map → Toggle-qW_TcIDh.cjs.map} +1 -1
- package/dist/{Toggle-3mGeA8rE.js → Toggle-zmqGwWeq.js} +39 -37
- package/dist/{Toggle-3mGeA8rE.js.map → Toggle-zmqGwWeq.js.map} +1 -1
- package/dist/button.cjs +1 -1
- package/dist/button.js +1 -1
- package/dist/color.cjs +1 -1
- package/dist/color.js +1 -1
- package/dist/dropdown.cjs +1 -1
- package/dist/dropdown.js +1 -1
- package/dist/{external-jrFYN1k7.js → external-1WVrscEc.js} +2 -2
- package/dist/{external-jrFYN1k7.js.map → external-1WVrscEc.js.map} +1 -1
- package/dist/{external-V5Rc7RD4.cjs → external-6DXc9G-d.cjs} +2 -2
- package/dist/{external-V5Rc7RD4.cjs.map → external-6DXc9G-d.cjs.map} +1 -1
- package/dist/{external-j1RQBbSY.js → external-7FFXJt69.js} +2 -2
- package/dist/external-7FFXJt69.js.map +1 -0
- package/dist/{external-CRkuAd6C.cjs → external-A4JYxI--.cjs} +2 -2
- package/dist/external-A4JYxI--.cjs.map +1 -0
- package/dist/{external-1scdpCD9.js → external-D_-pAYEQ.js} +3 -3
- package/dist/{external-1scdpCD9.js.map → external-D_-pAYEQ.js.map} +1 -1
- package/dist/{external-FtteEuf4.js → external-K7wZqIN6.js} +2 -2
- package/dist/{external-FtteEuf4.js.map → external-K7wZqIN6.js.map} +1 -1
- package/dist/{external-WdZmpbBs.cjs → external-KoFBpSsV.cjs} +2 -2
- package/dist/{external-WdZmpbBs.cjs.map → external-KoFBpSsV.cjs.map} +1 -1
- package/dist/{external-PuMpEjUQ.cjs → external-Mc8M8Xzl.cjs} +2 -2
- package/dist/{external-PuMpEjUQ.cjs.map → external-Mc8M8Xzl.cjs.map} +1 -1
- package/dist/{external-QpYuwpfo.js → external-P6hmttIX.js} +2 -2
- package/dist/{external-QpYuwpfo.js.map → external-P6hmttIX.js.map} +1 -1
- package/dist/{external-hclXaeBH.cjs → external-RsG62zSr.cjs} +2 -2
- package/dist/{external-hclXaeBH.cjs.map → external-RsG62zSr.cjs.map} +1 -1
- package/dist/{external-LDAF36fG.js → external-Sip1coAq.js} +3 -3
- package/dist/{external-LDAF36fG.js.map → external-Sip1coAq.js.map} +1 -1
- package/dist/{external-qFz2sVjt.cjs → external-UezDJS5P.cjs} +2 -2
- package/dist/{external-qFz2sVjt.cjs.map → external-UezDJS5P.cjs.map} +1 -1
- package/dist/{external-bw_0NdEr.js → external-dD3TNRhO.js} +3 -3
- package/dist/{external-bw_0NdEr.js.map → external-dD3TNRhO.js.map} +1 -1
- package/dist/{external-iZdy0KqS.cjs → external-dFd3d4ZY.cjs} +2 -2
- package/dist/{external-iZdy0KqS.cjs.map → external-dFd3d4ZY.cjs.map} +1 -1
- package/dist/{external-7CL_DLHQ.cjs → external-er-l9iZA.cjs} +2 -2
- package/dist/{external-7CL_DLHQ.cjs.map → external-er-l9iZA.cjs.map} +1 -1
- package/dist/{external-f3-E2t1n.js → external-luTLo-w7.js} +2 -2
- package/dist/{external-f3-E2t1n.js.map → external-luTLo-w7.js.map} +1 -1
- package/dist/{external-ogG2kUq2.cjs → external-n4UdyJ7i.cjs} +2 -2
- package/dist/{external-ogG2kUq2.cjs.map → external-n4UdyJ7i.cjs.map} +1 -1
- package/dist/{external-mgTxEe4K.js → external-rZ3m5Z0a.js} +2 -2
- package/dist/{external-mgTxEe4K.js.map → external-rZ3m5Z0a.js.map} +1 -1
- package/dist/external-vjJtYX9R.cjs +2 -0
- package/dist/external-vjJtYX9R.cjs.map +1 -0
- package/dist/{external-194aFdnj.js → external-wMjPMnSO.js} +3 -3
- package/dist/{external-194aFdnj.js.map → external-wMjPMnSO.js.map} +1 -1
- package/dist/{external-jcvqdb1Z.cjs → external-y6ws_3c6.cjs} +2 -2
- package/dist/{external-jcvqdb1Z.cjs.map → external-y6ws_3c6.cjs.map} +1 -1
- package/dist/{external-HTq0VBUW.js → external-zoOMJkop.js} +3 -3
- package/dist/external-zoOMJkop.js.map +1 -0
- package/dist/header.cjs +1 -1
- package/dist/header.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +800 -799
- package/dist/index.js.map +1 -1
- package/dist/input.cjs +1 -1
- package/dist/input.js +1 -1
- package/dist/list.cjs +1 -1
- package/dist/list.js +1 -1
- package/dist/menu.cjs +1 -1
- package/dist/menu.js +1 -1
- package/dist/select/Multiple.d.ts +2 -2
- package/dist/select/Select.spec.d.ts +9 -0
- package/dist/select/Single.d.ts +2 -2
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.js +1 -1
- package/dist/text.cjs +1 -1
- package/dist/text.js +2 -2
- package/dist/theming.cjs +1 -1
- package/dist/theming.js +2 -2
- package/dist/tree.cjs +1 -1
- package/dist/tree.js +1 -1
- package/dist/triggers.cjs +1 -1
- package/dist/triggers.js +1 -1
- package/package.json +6 -6
- package/dist/external-CRkuAd6C.cjs.map +0 -1
- package/dist/external-HTq0VBUW.js.map +0 -1
- package/dist/external-VwYNFmdb.cjs +0 -2
- package/dist/external-VwYNFmdb.cjs.map +0 -1
- package/dist/external-j1RQBbSY.js.map +0 -1
- package/dist/select/SelectA.spec.d.ts +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var Nn=Object.defineProperty;var _n=(e,t,s)=>t in e?Nn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var ue=(e,t,s)=>(_n(e,typeof t!="symbol"?t+"":t,s),s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./jsx-runtime-evvPGacs.cjs"),d=require("react"),a=require("./Toggle-wVZJoVtX.cjs"),l=require("./css-JWFtNl10.cjs"),ze=require("./external-qFz2sVjt.cjs"),N=require("./Center-Q-fgAb96.cjs"),G=require("./aggregator-6_J8kSSO.cjs"),f=require("./table-aFLsOP3H.cjs"),pt=require("./external-V5Rc7RD4.cjs"),mt=require("./external-7CL_DLHQ.cjs");require("react-hook-form");const ne=require("./external-ogG2kUq2.cjs"),Bn=require("react-dom"),Re=require("./external-jcvqdb1Z.cjs"),Dn=require("./external-XAgspAbl.cjs"),zn=require("./external-VwYNFmdb.cjs"),Jt=require("./color-1ICp12GL.cjs"),H=require("./external-hclXaeBH.cjs"),On=require("./external-WdZmpbBs.cjs"),X=require("./external-iZdy0KqS.cjs"),Vn=require("./external-CRkuAd6C.cjs"),An=require("./external-PuMpEjUQ.cjs"),In=require("./Video-EPTOwGIB.cjs"),Zn=require("zod"),Fn=({variant:e,...t})=>n.jsxRuntimeExports.jsx(a.u0.Circle,{color:a.variantColors[e],...t}),Yn=Object.freeze(Object.defineProperty({__proto__:null,Aggregator:a.Aggregator,Circle:Fn,Text:a.Text$2,VARIANTS:G.VARIANTS,specZ:G.specZ$1,useAggregator:a.useAggregator,useContext:a.useContext$2,useNotifications:a.useNotifications,variantZ:G.variantZ},Symbol.toStringTag,{value:"Module"})),Gn=Object.freeze(Object.defineProperty({__proto__:null,Config:a.Config,Context:a.Context,Dialog:a.Dialog$1,chooseLocation:a.chooseLocation,formatTip:a.formatTip,useConfig:a.useConfig,wrap:a.wrap},Symbol.toStringTag,{value:"Module"})),Ie=e=>e.preventDefault(),We=d.forwardRef(({location:e,style:t,size:s,className:o,children:r,onDragStart:i,sizeUnits:c="px",showHandle:u=!0,...x},m)=>{const p=l.location.construct(e),j=l.location.direction(p),h=l.direction$1.dimension(j);return n.jsxRuntimeExports.jsxs("div",{className:l.CSS(l.CSS.B("resize"),l.CSS.loc(p),l.CSS.dir(j),o),style:{[h]:`${s}${c}`,...t},ref:m,...x,children:[r,u&&n.jsxRuntimeExports.jsx("div",{draggable:!0,className:l.CSS(l.CSS.BE("resize","handle"),l.CSS.bordered(l.location.swap(p))),onDragStart:i,onDrag:Ie,onDragEnd:Ie})]})});We.displayName="Resize.Core";const jt=({onResize:e,count:t,initialSizes:s=[],minSize:o=100,direction:r="x"})=>{const i=d.useRef(null),[c,u]=d.useState({sizeDistribution:Hn(s,t),root:null}),x=d.useCallback((j,h,g)=>{if(i.current==null)return;const E=l.box$1.dim(l.box$1.construct(i.current),r);u(b=>st(b,E,j,o,h,g))},[o,u,r]);d.useEffect(()=>e==null?void 0:e(c.sizeDistribution),[c.sizeDistribution,e]);const m=d.useCallback((j,h)=>{j.preventDefault();const g=r==="x"?"clientX":"clientY",E=S=>x(h,S[g]),b=()=>{u(S=>({...S,root:null})),document.removeEventListener("mousemove",E)};u(S=>({...S,root:j[g]})),document.addEventListener("mousemove",E),document.addEventListener("mouseup",b,{once:!0})},[u,r,st]);return{setSize:d.useCallback((j,h)=>x(j,void 0,h),[st]),props:{direction:r,sizeDistribution:c.sizeDistribution,onDragHandle:m,ref:i}}},Xe=d.forwardRef(({direction:e="x",children:t,sizeDistribution:s,onDragHandle:o,className:r,...i},c)=>{const u=l.direction$1.construct(e),x=d.Children.toArray(t);return n.jsxRuntimeExports.jsx(N.Space,{...i,ref:c,direction:u,className:l.CSS(l.CSS.B("resize-multiple"),r),empty:!0,grow:!0,children:x.map((m,p)=>n.jsxRuntimeExports.jsx(We,{onDragStart:j=>o(j,p),location:l.direction$1.location(u),size:s[p]*100,sizeUnits:"%",showHandle:p!==x.length-1,children:m},p))})});Xe.displayName="Resize.Multiple";const Hn=(e,t)=>{const s=e.reduce((r,i)=>r+i,0),o=t-e.length;if(o<=0)return e.slice(0,t).map(r=>r/s);if(e.every(r=>r<=1)){const r=1-s;return[...e,...Array(o).fill(r/o)]}return e.map(()=>1/t)},st=(e,t,s,o,r,i)=>{const c=Qt(e,t,s,r,i),[u,x]=qn(e.sizeDistribution,s,c,o/t),m=x?r??null:e.root;return{...e,sizeDistribution:u,root:m}},Qt=(e,t,s,o,r)=>{let i;if(r!=null)r>1&&(r=r/t),i=r-e.sizeDistribution[s];else if(o!=null){if(e.root===null)throw new Error("resize root is null during handle drag");i=(o-e.root)/t}else throw new Error("must provide either a MouseEvent or a targetSize");return i},qn=(e,t,s,o)=>{let r=t;for(;r>0&&e[r]+s<=o;)r--;const i=e[r]+s,c=Un(r,e,o,s),u=e[c]-s;return i<o||u<o?[e,!1]:[e.map((x,m)=>m===r?i:m===c?u:x),!0]},Un=(e,t,s,o)=>(e===t.length-1?Xn:Wn)(e,t,s,o),Wn=(e,t,s,o)=>{let r=e+1;for(;r<t.length-1&&t[r]-o<=s;)r++;return r},Xn=(e,t,s,o)=>{let r=e-1;for(;r>0&&t[r]-o<=s;)r--;return r},Ke=({onMove:e,onStart:t,onEnd:s})=>d.useCallback(o=>{o.preventDefault();const r=l.xy.construct(o),i=a.mouseKey(o.button);t==null||t(r,i,o);const c=x=>{if(x.buttons===0)return u(x);const m=l.xy.construct(x);e==null||e(l.box$1.construct(r,m),i,x)};window.addEventListener("mousemove",c);const u=x=>{window.removeEventListener("mousemove",c);const m=l.xy.construct(x);s==null||s(l.box$1.construct(r,m),i,x)};window.addEventListener("mouseup",u,{once:!0})},[e,t,s]),nt=2,es=({onCollapse:e,onResize:t,location:s="left",minSize:o=100,maxSize:r=1/0,initialSize:i=200,collapseThreshold:c=1/0,className:u,...x})=>{const[m,p]=d.useState(l.clamp(i,o,r)),j=d.useRef(null),h=l.location.construct(s),g=d.useCallback(C=>{if(j.current===null)return 0;const R=l.box$1.dim(C,l.location.direction(h),!0)*(1-2*Number(["bottom","right"].includes(h))),w=j.current+R,$=l.clamp(w,o,r);return($-w)/o>c?nt:$},[h,o,r,c]),E=d.useRef(null),b=d.useCallback(C=>{const R=g(C);p(R),E.current!=null&&(t==null||t(R,l.box$1.construct(E.current)))},[t,g]),S=d.useCallback(()=>p(C=>(j.current=C,C)),[p]),y=d.useCallback(C=>g(C)===nt&&(e==null?void 0:e()),[e,g]);d.useEffect(()=>p(C=>{const R=l.clamp(C,o,r);return j.current=R,R}),[o,r]);const v=Ke({onMove:b,onStart:S,onEnd:y});return n.jsxRuntimeExports.jsx(We,{ref:E,location:h,size:m,onDragStart:v,className:l.clsx(u,l.CSS.expanded(m!==nt)),...x})},Kn=Object.freeze(Object.defineProperty({__proto__:null,Core:We,Multiple:Xe,Single:es,calculateDiffPercentage:Qt,useMultiple:jt},Symbol.toStringTag,{value:"Module"})),Oe="y",_t=28,Jn=32,Qn=40,eo=.5,to=({data:e,...t})=>{const{setSize:s,props:{sizeDistribution:o,ref:r,...i}}=jt({direction:Oe,count:e.length,minSize:_t}),c=u=>{if(r.current==null)return;const x=l.box$1.dim(l.box$1.construct(r.current),Oe);o[u]<Qn/x?s(u,e[u].initialSize??eo):s(u,_t+1)};return n.jsxRuntimeExports.jsx(Xe,{empty:!0,className:l.CSS.B("accordion"),sizeDistribution:o,ref:r,...t,...i,children:e.map((u,x)=>d.createElement(oo,{...u,key:u.key,index:x,direction:Oe,onExpand:c,parent:r,size:o[x]}))})},so=n.jsxRuntimeExports.jsx(a.u0.Caret.Down,{"aria-label":"contract"}),no=n.jsxRuntimeExports.jsx(a.u0.Caret.Right,{"aria-label":"expand"}),oo=({index:e,name:t,content:s,actions:o,size:r,parent:i,onExpand:c})=>{let u=!0;if(i.current!=null){const m=l.box$1.dim(l.box$1.construct(i.current),Oe);u=r*m>Jn}const x=u?so:no;return n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsxs(ze.Header,{level:"p",className:l.CSS.expanded(u),empty:!0,children:[n.jsxRuntimeExports.jsx(ze.ButtonTitle,{startIcon:x,onClick:()=>c(e),children:t}),o!=null&&n.jsxRuntimeExports.jsx(ze.Actions,{children:o})]}),s]})},ro=Object.freeze(Object.defineProperty({__proto__:null,Accordion:to},Symbol.toStringTag,{value:"Module"})),te="channel",Bt=(e,t)=>{if(t.current==null)return{display:"none"};const s={},o=l.box$1.construct(t.current.parentElement),r=l.box$1.construct(t.current);return e.x>.8?s.right=`${(1-e.x)*l.box$1.width(o)-l.box$1.width(r)}px`:e.x<.2?s.left=`${e.x*l.box$1.width(o)}px`:s.left=`${e.x*100}%`,e.y>.8?s.bottom=`${(1-e.y)*l.box$1.height(o)-l.box$1.height(r)}px`:e.y<.2?s.top=`${e.y*l.box$1.height(o)}px`:s.top=`${e.y*100}%`,s},ts=d.memo(({className:e,value:t,onChange:s,style:o,draggable:r=!0,...i})=>{const[c,u]=G.usePurePassthrough({value:t,onChange:s,initial:l.xy.construct(.1,.01)}),x=d.useRef(c),m=a.useSyncedRef(!r),p=d.useRef(null),[j,h]=d.useState({});c!==null&&(o={...o,...j});const g=d.useCallback(S=>{p.current=S,h(Bt(l.xy.construct(c),p))},[]),E=d.useCallback(S=>{var $;if((($=p.current)==null?void 0:$.parentElement)==null)return x.current;const y=l.box$1.construct(p.current.parentElement),v=l.box$1.reRoot(l.box$1.DECIMAL,l.location.TOP_LEFT),C=l.scale.XY.scale(y).scale(v),R=C.box(l.box$1.construct(p.current));return l.scale.XY.clamp(l.box$1.construct(l.box$1.topLeft(v),{width:l.box$1.width(v)-l.box$1.width(R),height:l.box$1.height(v)-l.box$1.height(R)})).pos(l.xy.translate(l.xy.construct(x.current),l.box$1.signedDims(C.box(S))))},[]),b=Ke({onMove:d.useCallback(S=>{if(m.current)return;const y=E(S);h(Bt(l.xy.construct(y),p))},[u]),onEnd:d.useCallback(S=>{m.current||(x.current=E(S))},[])});return n.jsxRuntimeExports.jsx(N.Space,{className:l.CSS(e,l.CSS.B("legend")),bordered:!0,rounded:!0,style:o,onDragStart:b,draggable:r,ref:g,...i,onDrag:Ie,onDragEnd:Ie,empty:!0})});ts.displayName="Legend.Container";const ss=({data:e=[],onEntryChange:t,position:s,onPositionChange:o,...r})=>{const[i,c]=d.useState(!1);return e.length===0?null:n.jsxRuntimeExports.jsx(ts,{...r,draggable:!i,value:s,onChange:o,children:e.sort((u,x)=>u.label.localeCompare(x.label)).map(({key:u,color:x,label:m})=>n.jsxRuntimeExports.jsxs(N.Space,{style:{cursor:"pointer"},direction:"x",align:"center",children:[n.jsxRuntimeExports.jsx(pt.Swatch,{value:x,onChange:p=>t==null?void 0:t({key:u,color:p,label:m}),onVisibleChange:c,draggable:!1,size:"small"}),n.jsxRuntimeExports.jsx(a.MaybeEditable,{level:"small",value:m,onChange:p=>t==null?void 0:t({key:u,color:x,label:p}),noWrap:!0})]},u))})},lo={region:l.box$1.ZERO,dpr:1,os:l.external$1.getOS()},io={gl:null,lower2d:null,upper2d:null,bootstrapped:!1},co=a.wrap$1(f.Canvas.TYPE,({children:e,resizeDebounce:t=100,className:s,aetherKey:o,...r})=>{const[{path:i},{bootstrapped:c},u]=a.use$3({aetherKey:o,type:f.Canvas.TYPE,schema:f.canvasStateZ,initialState:lo}),x=d.useRef({...io}),m=d.useCallback(h=>{x.current.bootstrapped&&u(()=>({bootstrapped:!0,region:h,dpr:window.devicePixelRatio,os:l.external$1.getOS({default:"Windows"})}))},[u]),p=a.useResize(m,{debounce:t}),j=d.useCallback(h=>{if(p(h),h==null)return;h.className.includes("gl")?x.current.gl=h:h.className.includes("upper2d")?x.current.upper2d=h:x.current.lower2d=h;const{gl:g,lower2d:E,upper2d:b,bootstrapped:S}=x.current;if(g==null||E==null||b==null||S)return;x.current.bootstrapped=!0;const y=g.transferControlToOffscreen(),v=b.transferControlToOffscreen(),C=E.transferControlToOffscreen();u({glCanvas:y,upper2dCanvas:v,lower2dCanvas:C,bootstrap:!0,bootstrapped:!1,region:l.box$1.construct(g),dpr:window.devicePixelRatio,os:l.external$1.getOS({default:"Windows"})},[y,v,C])},[u]);return n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx("canvas",{ref:j,className:l.CSS(l.CSS.BM("canvas","lower2d"),s),...r}),n.jsxRuntimeExports.jsx("canvas",{ref:j,className:l.CSS(l.CSS.BM("canvas","gl"),s),...r}),n.jsxRuntimeExports.jsx("canvas",{ref:j,className:l.CSS(l.CSS.BM("canvas","upper2d"),s),...r}),n.jsxRuntimeExports.jsx(a.Composite,{path:i,children:c&&e})]})}),ft=e=>a.useResize(d.useCallback((t,s)=>{const o=document.querySelector(".pluto-canvas--lower2d");if(o==null)return;const r=l.box$1.construct(o);t=l.scale.XY.translate(l.xy.scale(l.box$1.topLeft(r),-1)).box(t),e(t,s)},[e])),ao=Object.freeze(Object.defineProperty({__proto__:null,Canvas:co,useRegion:ft},Symbol.toStringTag,{value:"Module"})),ns=d.createContext(null),de=e=>{const t=d.useContext(ns);if(t==null)throw new Error(`Cannot to use ${e} as a non-child of LinePlot.`);return t},os=e=>{const t=de("Viewport"),{addViewportHandler:s}=t;d.useEffect(()=>s(e),[s,e])},ht=(e,t)=>{const{setAxis:s,removeAxis:o}=de(t),{key:r}=e;return a.useEffectCompare(()=>(l.location.outer.parse(e.loc),s(e),()=>o(e.key)),([u],[x])=>l.external.equal(u,x),[e]),{gridArea:l.direction$1.swap(l.location.direction(e.loc))==="x"?`axis-start-${r} / plot-start / axis-end-${r} / plot-end`:`plot-start / axis-start-${r} / plot-end / axis-end-${r}`}},rs=a.wrap$1("LinePlot",({aetherKey:e,style:t,resizeDebounce:s=0,clearOverscan:o,children:r,hold:i,...c})=>{const[u,x,m]=a.useCombinedStateAndRef([]),p=a.useMemoDeepEqualProps({clearOverscan:o,hold:i}),[{path:j},{grid:h},g]=a.use$3({aetherKey:e,type:f.LinePlot.TYPE,schema:f.linePlotStateZ,initialState:{container:l.box$1.ZERO,viewport:l.box$1.DECIMAL,grid:[],...p}});d.useEffect(()=>g(P=>({...P,...p})),[p]);const E=d.useRef(new Map),b=d.useCallback(P=>(E.current.set(P,null),()=>E.current.delete(P)),[E]),S=d.useCallback(P=>{const{mode:O,box:z,stage:L}=P;(O==="pan"&&L!=="start"||O==="zoom"||O==="zoomReset"&&L==="start")&&g(M=>({...M,viewport:z})),E.current.forEach((M,V)=>V(P))},[g]),y=d.useCallback(P=>g(O=>({...O,container:P})),[g]),v=ft(y),C=d.useCallback(P=>g(O=>({...O,grid:[...O.grid.filter(({key:z})=>z!==P.key),P]})),[g]),R=d.useCallback(P=>g(O=>({...O,grid:O.grid.filter(({key:z})=>z!==P)})),[g]),w=d.useCallback(P=>{x(O=>[...O.filter(({key:z})=>z!==P.key),P])},[x,S]),$=d.useCallback(P=>x(O=>O.filter(({key:z})=>z!==P)),[w]),_=uo(h),B=d.useMemo(()=>({lines:u,setAxis:C,removeAxis:R,setLine:w,removeLine:$,setViewport:S,addViewportHandler:b}),[u,C,R,w,$,S,b]);return n.jsxRuntimeExports.jsx("div",{className:l.CSS.B("line-plot"),style:{...t,..._},ref:v,...c,children:n.jsxRuntimeExports.jsx(ns.Provider,{value:B,children:n.jsxRuntimeExports.jsx(a.Composite,{path:j,children:r})})})}),uo=e=>{const t=l.CSS.newGridBuilder();return f.filterGridPositions("top",e).forEach(({key:s,size:o})=>t.addRow(`axis-start-${s}`,`axis-end-${s}`,o)),t.addRow("plot-start","plot-end","minmax(0, 1fr)"),f.filterGridPositions("bottom",e).forEach(({key:s,size:o})=>t.addRow(`axis-start-${s}`,`axis-end-${s}`,o)),f.filterGridPositions("left",e).forEach(({key:s,size:o})=>t.addColumn(`axis-start-${s}`,`axis-end-${s}`,o)),t.addColumn("plot-start","plot-end","minmax(0, 1fr)"),f.filterGridPositions("right",e).forEach(({key:s,size:o})=>t.addColumn(`axis-start-${s}`,`axis-end-${s}`,o)),t.build()},ls=({className:e,style:t,onLineChange:s,...o})=>{const{lines:r}=de("Legend");return de("Legend"),n.jsxRuntimeExports.jsx(ss,{data:r,onEntryChange:s,...o})},is=a.wrap$1("Line",({aetherKey:e,...t})=>{const[,,s]=a.use$3({aetherKey:e,type:f.Line.TYPE,schema:f.stateZ,initialState:t}),o=a.useMemoDeepEqualProps(t);return d.useLayoutEffect(()=>s(o),[o]),null}),xo=Object.freeze(Object.defineProperty({__proto__:null,Line:is},Symbol.toStringTag,{value:"Module"})),gt=a.wrap$1("Line",({aetherKey:e,color:t,label:s="",...o})=>{const{setLine:r,removeLine:i}=de("Line");return d.useEffect(()=>(r({key:e,color:t,label:s}),()=>i(e)),[s,t]),n.jsxRuntimeExports.jsx(is,{aetherKey:e,color:t,label:s,...o})}),cs=({level:e="h2",...t})=>{const s=a.useUniqueKey(),o=a.useTypography(e),r=ht({key:s,size:(o.lineHeight+2)*o.baseSize,loc:"top",order:"first"},"Title");return n.jsxRuntimeExports.jsx(N.Space,{justify:"center",align:"center",style:r,children:n.jsxRuntimeExports.jsx(a.MaybeEditable,{...t,level:e})})},po={select:"pointer",zoom:"crosshair",pan:"grab",zoomReset:"crosshair",click:"pointer"},Et=d.forwardRef(({className:e,mode:t,maskBox:s,children:o,style:r,...i},c)=>n.jsxRuntimeExports.jsxs("div",{ref:c,className:l.CSS(l.CSS.noSelect,l.CSS.BE("viewport-mask","container"),e),style:{cursor:po[t],...r},...i,children:[n.jsxRuntimeExports.jsx("div",{style:{...l.box$1.css(s),display:l.box$1.isZero(s)?"none":"block"},className:l.CSS.BE("viewport-mask","selection")}),o]}));Et.displayName="ZoomPanMask";const mo=["zoom","pan","select","zoomReset"],Ve=[...mo,"click"],as=["zoom","select"],Ae={defaultMode:"zoom",zoom:[["MouseLeft"]],zoomReset:[["MouseLeft","Control"]],pan:[["MouseLeft","Shift"]],select:[["MouseLeft","Alt"]]},us={defaultMode:"pan",pan:[["MouseLeft"]],zoom:[["MouseLeft","Shift"]],zoomReset:[["MouseLeft","Control"]],select:[["MouseLeft","Alt"]]},xs={defaultMode:"select",select:[["MouseLeft"]],pan:[["MouseLeft","Shift"]],zoom:[["MouseLeft","Alt"]],zoomReset:[["MouseLeft","Control"]]},St={zoom:Ae,pan:us,select:xs,zoomReset:Ae,click:Ae},jo=e=>{const t=Object.entries(e);return Object.fromEntries(t.map(([s,o])=>s==="defaultMode"?[s,o]:[s,o.map(r=>r.filter(i=>i!=="MouseLeft")).filter(r=>r.length>0)]))},fo=l.box$1.construct(0,0,1,1,l.location.TOP_LEFT),ho={width:30,height:50},ds=({onChange:e,triggers:t,initial:s=fo,threshold:o=ho})=>{const r=(t==null?void 0:t.defaultMode)??"zoom",[i,c]=d.useState(l.box$1.ZERO),[u,x]=d.useState(r),[m,p]=a.useStateRef(s),j=d.useRef(null),h=l.dimensions.construct(o);d.useEffect(()=>p(s),[s]),d.useEffect(()=>x(r),[r]);const[g,E,b,S]=a.useMemoCompare(()=>{const R={...St[r],...t},w=a.flattenConfig(R),$=jo(R);return[R,w,$,a.flattenConfig($)]},a.compareModeConfigs,[t]),y=d.useCallback(({box:R,triggers:w,stage:$,cursor:_})=>{if(j.current==null)return;const B=a.determineMode(g,w),P=l.box$1.construct(j.current);if(B==null)return;if(B==="zoomReset")return c(l.box$1.ZERO),e==null||e({box:l.box$1.DECIMAL,mode:B,stage:$,cursor:_}),p(l.box$1.DECIMAL);if($==="end"){if(l.box$1.width(R)<5&&l.box$1.height(R)<5){B==="zoom"&&c(l.box$1.ZERO),e==null||e({box:m.current,mode:"click",stage:$,cursor:_});return}return p(z=>{if(B==="pan"){const M=Dt(R,z,P);return M===null?z:(e==null||e({box:M,mode:B,stage:$,cursor:_}),M)}const L=v(R,z,P);return L===null?z:(e==null||e({box:L,mode:B,stage:$,cursor:_}),B==="zoom"?(c(l.box$1.ZERO),L):z)})}if(as.includes(B))return l.box$1.height(R)<5&&l.box$1.width(R)<5?void 0:c(l.scale.XY.scale(P).clamp(P).translate({x:-l.box$1.left(P),y:-l.box$1.top(P)}).box(zt(h,R,P)));c(z=>l.box$1.isZero(z)?z:l.box$1.ZERO);const O=Dt(R,m.current,P);e==null||e({box:O,mode:B,stage:$,cursor:_})},[c,x,e,g,o.height,o.width,p,j]),v=d.useCallback((R,w,$)=>ps(w,$).box(zt(h,R,$)),[o]);mt.useDrag({bound:j,onDrag:y,triggers:E,loose:!0});const C=d.useCallback(({triggers:R,stage:w})=>{if(w==="end")return x(r);const $=a.determineMode(b,R);$!=null&&x($)},[b,r,e]);return a.use$2({triggers:S,callback:C,region:j}),{maskBox:i,ref:j,mode:u}},ps=(e,t)=>l.scale.XY.scale(t).clamp(t).scale(e),Dt=(e,t,s)=>{let o=l.box$1.signedDims(ps(t,s).box(e));return o={signedWidth:-o.signedWidth,signedHeight:-o.signedHeight},l.scale.XY.translate(l.xy.construct(o)).box(t)},zt=(e,t,s)=>l.box$1.height(t)<=e.height?l.box$1.construct(l.box$1.left(t),l.box$1.top(s),l.box$1.width(t),l.box$1.height(s)):l.box$1.width(t)<=e.width?l.box$1.construct(l.box$1.left(s),l.box$1.top(t),l.box$1.width(s),l.box$1.height(t)):t,ms=e=>n.jsxRuntimeExports.jsx(a.Icon,{className:l.CSS.BE("select","clear"),variant:"outlined",...e,children:n.jsxRuntimeExports.jsx(a.u0.Close,{"aria-label":"clear"})}),Ze=({children:e="",size:t="medium",variant:s="filled",color:o,icon:r,onClose:i,className:c,onDragStart:u,...x})=>{const m=l.cssString(o);r==null&&o!=null&&(r=n.jsxRuntimeExports.jsx(a.u0.Circle,{fill:m}));const p=i==null?void 0:n.jsxRuntimeExports.jsx(a.Icon,{"aria-label":"close",size:t,className:l.CSS.BE("tag","close"),onClick:j=>{j.stopPropagation(),i()},children:n.jsxRuntimeExports.jsx(a.u0.Close,{})});return n.jsxRuntimeExports.jsx(a.WithIcon,{startIcon:r,endIcon:p,className:l.CSS(c,l.CSS.B("tag"),i!=null&&l.CSS.BM("tag","closeable")),level:G.ComponentSizeLevels[t],noWrap:!0,align:"center",onDragStart:u,...x,children:e})},go=Object.freeze(Object.defineProperty({__proto__:null,Tag:Ze},Symbol.toStringTag,{value:"Module"})),Rt=({onChange:e,value:t,location:s,className:o,data:r,columns:i=[],tagKey:c="key",emptyContent:u,searcher:x,renderTag:m,placeholder:p,onTagDragStart:j,allowMultiple:h,allowNone:g,replaceOnSingle:E,onTagDragEnd:b,style:S,...y})=>{const{visible:v,open:C,close:R}=a.use$1(),[w,$]=d.useState([]),[_,B]=d.useState(!1),P=x!=null;a.useAsyncEffect(async()=>{B(!0),a.selectValueIsZero(t)&&$([]);const L=w.map(Q=>Q.key),M=l.toArray(t);if(l.compare.unorderedPrimitiveArrays(L,M)===l.compare.EQUAL)return;let V=[];if(P)try{V=await x.retrieve(M)}finally{B(!1)}else r!=null&&(V=r.filter(Q=>M.includes(Q.key)));$(V)},[x,P,t,r]);const O=d.useCallback((L,M)=>{$(M.entries),e(L,M)},[e]),z=d.useMemo(()=>P?a.Search:Re.Filter,[P]);return n.jsxRuntimeExports.jsx(a.Core,{close:R,open:C,data:r,emtpyContent:u,visible:v,value:t,onChange:O,allowNone:g,replaceOnSingle:E,columns:i,allowMultiple:!0,children:n.jsxRuntimeExports.jsx(z,{searcher:x,children:({onChange:L,value:M})=>n.jsxRuntimeExports.jsx(Eo,{value:M,selectedKeys:t,className:o,onChange:L,loading:_,selected:w,onFocus:C,tagKey:c,visible:v,renderTag:m,placeholder:p,onTagDragStart:j,onTagDragEnd:b,style:S})})})},Eo=({selectedKeys:e,loading:t,selected:s,onChange:o,onFocus:r,visible:i,tagKey:c,renderTag:u=a.componentRenderProp(js),placeholder:x="Select...",onTagDragStart:m,onTagDragEnd:p,value:j,className:h,...g})=>{const{onSelect:E,clear:b}=a.useSelectionUtils(),S=d.useRef(null);d.useLayoutEffect(()=>{var R;i&&((R=S.current)==null||R.focus())},[i,s]);const y=R=>{i||o(""),r==null||r()},v=R=>{i||r==null||r()},C=()=>{i||o("")};return n.jsxRuntimeExports.jsxs(a.Text$1,{ref:S,className:l.CSS(l.CSS.BE("select-multiple","input"),l.CSS.visible(i),h),onBlur:C,placeholder:x,value:j,onChange:o,onFocus:y,autoComplete:"off",autoCapitalize:"off",autoCorrect:"off",onClick:v,...g,children:[n.jsxRuntimeExports.jsx(N.Space,{direction:"x",className:l.CSS.BE("select-multiple","tags"),align:"center",grow:!0,children:l.toArray(e).map((R,w)=>{const $=s[w];return u({key:R,entryKey:R,tagKey:c,loading:t,entry:$,onClose:()=>E==null?void 0:E(R),onDragStart:_=>m==null?void 0:m(_,R),onDragEnd:_=>p==null?void 0:p(_,R)})})}),n.jsxRuntimeExports.jsx(ms,{onClick:b})]})},js=({entryKey:e,tagKey:t,entry:s,loading:o,...r})=>{let i=e;return s!=null&&(i=typeof t=="function"?t(s):s[t]),d.createElement(Ze,{size:"small",variant:"outlined",className:l.CSS(s==null&&!o&&l.CSS.BEM("select-multiple","tag","invalid")),draggable:!0,...r,key:e.toString()},l.convertRenderV(i))},fs=({onChange:e,value:t,tagKey:s="key",columns:o=[],data:r,emptyContent:i,inputProps:c,allowNone:u,searcher:x,className:m,variant:p,hideColumnHeader:j=!1,disabled:h,...g})=>{const{visible:E,open:b,close:S}=a.use$1(),[y,v]=d.useState(null),C=x!=null;a.useAsyncEffect(async()=>{if((y==null?void 0:y.key)===t)return;if(a.selectValueIsZero(t))return v(null);let $=null;if(C){const[_]=await x.retrieve([t]);$=_??null}else r!=null&&($=r.find(_=>_.key===t)??null);v($)},[x,t]);const R=d.useCallback(($,_)=>{v($==null?null:_.entries[0]),S(),e($,_)},[e,u]),w=d.useMemo(()=>C?a.Search:Re.Filter,[C]);return n.jsxRuntimeExports.jsx(a.Core,{close:S,open:b,data:r,emtpyContent:i,allowMultiple:!1,visible:E,value:t,hideColumnHeader:j,onChange:R,allowNone:u,columns:o,children:n.jsxRuntimeExports.jsx(w,{searcher:x,children:({onChange:$})=>n.jsxRuntimeExports.jsx(So,{variant:p,onChange:$,onFocus:b,selected:y,tagKey:s,visible:E,allowNone:u,className:m,disabled:h})})})},So=({tagKey:e,selected:t,visible:s,onChange:o,onFocus:r,allowNone:i=!0,debounceSearch:c=250,placeholder:u="Select...",className:x,...m})=>{const{clear:p}=a.useSelectionContext(),[j,h]=d.useState("");d.useEffect(()=>{if(!s){if(l.primitiveIsZero(t==null?void 0:t.key))return h("");if(t!=null)return h(typeof e=="function"?e(t).toString():(t==null?void 0:t[e]).toString())}},[t,s,e]);const g=y=>{o(y),h(y)},E=y=>{h(""),r==null||r()},b=y=>{s||(y.preventDefault(),r==null||r())},S=()=>{h(""),p==null||p()};return n.jsxRuntimeExports.jsx(a.Text$1,{className:l.CSS(l.CSS.BE("select","input"),x),value:j,onChange:g,onFocus:E,style:{flexGrow:1},onClick:b,placeholder:u,...m,children:i&&n.jsxRuntimeExports.jsx(ms,{onClick:S})})},Ro=[{key:"x",icon:n.jsxRuntimeExports.jsx(a.u0.Arrow.Right,{})},{key:"y",icon:n.jsxRuntimeExports.jsx(a.u0.Arrow.Down,{})}],bo=({key:e,entry:t,onClick:s,selected:o})=>n.jsxRuntimeExports.jsx(a.Icon,{variant:o?"filled":"outlined",onClick:s,children:t.icon},e),yo=({children:e=bo,allowMultiple:t=!1,...s})=>n.jsxRuntimeExports.jsx(ne.Button,{...s,data:Ro,children:e}),Co=l.DataType.ALL.filter(e=>e!==l.DataType.UNKNOWN).map(e=>({key:e.toString(),name:l.Case.capitalize(e.toString())})),vo=[{key:"name",name:"Name"}],wo=e=>n.jsxRuntimeExports.jsx(ne.DropdownButton,{...e,data:Co,columns:vo,tagKey:"name"}),$o=Object.freeze(Object.defineProperty({__proto__:null,BaseButton:ne.BaseButton,Button:ne.Button,DataType:wo,Direction:yo,DropdownButton:ne.DropdownButton,Multiple:Rt,MultipleTag:js,Single:fs,defaultButton:ne.defaultButton},Symbol.toStringTag,{value:"Module"})),To=({mode:e,triggers:t})=>n.jsxRuntimeExports.jsxs(N.Space,{direction:"x",align:"center",children:[n.jsxRuntimeExports.jsx(a.Text,{level:"small",children:l.Case.capitalize(e)}),n.jsxRuntimeExports.jsx(mt.Text,{trigger:t[0],level:"small"})]}),Po={zoom:n.jsxRuntimeExports.jsx(a.u0.Zoom,{}),pan:n.jsxRuntimeExports.jsx(a.u0.Pan,{}),select:n.jsxRuntimeExports.jsx(a.u0.Selection,{}),zoomReset:n.jsxRuntimeExports.jsx(a.u0.Expand,{}),click:n.jsxRuntimeExports.jsx(a.u0.Bolt,{})},ko=({triggers:e,disable:t=["zoomReset","click"],...s})=>{const o=Object.entries(e).filter(([r])=>!t.includes(r)&&Ve.includes(r)).map(([r,i])=>({key:r,icon:Po[r],tooltip:n.jsxRuntimeExports.jsx(To,{mode:r,triggers:i})})).sort((r,i)=>Ve.indexOf(r.key)-Ve.indexOf(i.key));return n.jsxRuntimeExports.jsx(ne.Button,{...s,data:o,entryRenderKey:"icon",children:({title:r,entry:i,...c})=>d.createElement(a.Icon,{...c,key:i.key,variant:c.selected?"filled":"text",size:"medium",tooltip:i.tooltip,tooltipLocation:{x:"right",y:"top"}},i.icon)})},Lo=Object.freeze(Object.defineProperty({__proto__:null,DEFAULT_TRIGGERS:St,MASK_MODES:as,MODES:Ve,Mask:Et,PAN_DEFAULT_TRIGGERS:us,SELECT_DEFAULT_TRIGGERS:xs,SelectMode:ko,ZOOM_DEFAULT_TRIGGERS:Ae,use:ds},Symbol.toStringTag,{value:"Module"})),hs=e=>e==null?null:document.querySelectorAll(".pluto-line-plot__viewport")[0]??null,gs=({children:e,initial:t=l.box$1.DECIMAL,onChange:s,...o})=>{const{setViewport:r}=de("Viewport");d.useLayoutEffect(()=>{r({box:t,mode:"zoom",cursor:l.xy.ZERO,stage:"start"})},[r,t]);const i=d.useCallback(u=>{r(u),s==null||s(u)},[s,r]),c=ds({onChange:i,initial:t,...o});return n.jsxRuntimeExports.jsx(Et,{className:l.CSS.BE("line-plot","viewport"),...c,children:e})},bt=e=>{const t=e==="x"?"bottom":"left",s=e==="x"?f.XAxis.TYPE:f.YAxis.TYPE,o=`${e}-axis`;return a.wrap$1(s,({aetherKey:r,children:i,resizeDebounce:c=0,location:u=t,label:x="",labelLevel:m="small",labelDirection:p=e,onLabelChange:j,color:h,labelSize:g,showGrid:E,type:b,bounds:S,className:y,tickSpacing:v,autoBounds:C,autoBoundUpdateInterval:R,onAutoBoundsChange:w,style:$,..._})=>{const B=((x==null?void 0:x.length)??0)>0,P=a.useMemoDeepEqualProps({location:u,showGrid:E,type:b,bounds:S,label:x,labelDirection:p,tickSpacing:v,autoBounds:C,autoBoundUpdateInterval:R}),[{path:O},{size:z,labelSize:L,...M},V]=a.use$3({aetherKey:r,type:s,schema:f.coreAxisStateZ,initialState:P});d.useEffect(()=>V(ae=>({...ae,...P})),[P]),d.useEffect(()=>{const{lower:ae,upper:K}=f.parseAutoBounds(M.autoBounds);M.bounds!=null&&(ae&&(S==null?void 0:S.lower)!==M.bounds.lower||K&&(S==null?void 0:S.upper)!==M.bounds.upper)&&(w==null||w(M.bounds))},[M.autoBounds,M.bounds]);const Q=ht({loc:u,key:r,size:z+L,order:"last"},"XAxis"),re=a.useTypography(m).toString(),he=d.useRef(0);return d.useEffect(()=>{if(e==="y"){if(x==null)return;let K=G.dimensions(x,re)[l.direction$1.dimension(l.direction$1.construct(p))];K>0&&(K+=6),V(ge=>({...ge,labelSize:K}))}else{const K=G.dimensions(x,re).height+12,ge=he.current;f.withinSizeThreshold(ge,K)||(he.current=K,V(Be=>({...Be,labelSize:K})))}},[x,p,re]),n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx(N.Space,{className:l.CSS(y,l.CSS.B("axis"),l.CSS.B(o),l.CSS.loc(u)),style:{...$,...Q},align:"center",justify:e==="x"?"end":"start",direction:l.direction$1.swap(e),..._,children:B&&n.jsxRuntimeExports.jsx(a.MaybeEditable,{className:l.CSS(l.CSS.BE("axis","label"),l.CSS.dir(p)),value:x,onChange:j,level:m})}),n.jsxRuntimeExports.jsx(a.Composite,{path:O,children:i})]})})},Es=bt("x"),Ss=bt("y"),Mo=Object.freeze(Object.defineProperty({__proto__:null,Legend:ls,Line:gt,LinePlot:rs,Title:cs,Viewport:gs,XAxis:Es,YAxis:Ss,axisFactory:bt,selectViewportEl:hs,useContext:de,useGridPosition:ht,useViewport:os},Symbol.toStringTag,{value:"Module"})),No=a.wrap$1("Tooltip",({aetherKey:e})=>{const[,,t]=a.use$3({aetherKey:e,type:f.Tooltip.TYPE,schema:f.tooltipStateZ,initialState:{position:null}}),s=d.useRef(null),o=d.useCallback(i=>t({position:l.xy.construct(i)}),[t]),r=d.useCallback(()=>t({position:null}),[t]);return d.useEffect(()=>{if(s.current===null)return;const i=s.current.parentElement;if(i!=null)return i.addEventListener("mousemove",o),i.addEventListener("mouseleave",r),()=>{i.removeEventListener("mousemove",o),i.removeEventListener("mouseleave",r)}},[o]),n.jsxRuntimeExports.jsx("span",{ref:s})}),Rs={defaultMode:"empty",one:[["1"]],two:[["2"]],clear:[["Shift"]],empty:[[]]},_o=a.flattenConfig(Rs),bs=a.wrap$1("Measure",({aetherKey:e})=>{const[,,t]=a.use$3({aetherKey:e,type:f.Measure.TYPE,schema:f.measureStateZ,initialState:{hover:null,one:null,two:null}}),s=d.useRef(null),o=a.useHeldRef({triggers:_o,loose:!0}),r=d.useCallback(({mode:u,cursor:x})=>{if(u==="click"){const m=a.determineMode(Rs,o.current.triggers,!0);if(["one","two"].includes(m))return t(p=>({...p,[m]:x}));t(m==="clear"?p=>({...p,one:null,two:null}):p=>({...p,one:p.one??x,two:p.one!==null?x:p.two}))}},[t,o]);os(r);const i=d.useCallback(u=>t(x=>({...x,hover:l.xy.construct(u)})),[t]),c=d.useCallback(()=>{t(u=>({...u,hover:null}))},[t]);return d.useEffect(()=>{if(s.current===null)return;const u=s.current.parentElement;if(u!=null)return u.addEventListener("mousemove",i),u.addEventListener("mouseleave",c),()=>{u.removeEventListener("mousemove",i),u.removeEventListener("mouseleave",c)}},[r]),n.jsxRuntimeExports.jsx("span",{ref:s})}),Bo=Object.freeze(Object.defineProperty({__proto__:null,Measure:bs},Symbol.toStringTag,{value:"Module"})),yt=a.wrap$1("Rule",({aetherKey:e,label:t,position:s,onLabelChange:o,onPositionChange:r,units:i="",color:c,lineWidth:u,lineDash:x})=>{const[m,p]=G.usePurePassthrough({value:t,onChange:o,initial:""}),[,{position:j,pixelPosition:h},g]=a.use$3({aetherKey:e,type:f.Rule.TYPE,schema:f.ruleStateZ,initialState:{color:c,dragging:!1,position:s,lineWidth:u,lineDash:x}});d.useEffect(()=>{if(j==null)return;if(s==null)return r==null?void 0:r(j);const R=l.bounds.construct(j+.01,j-.01);s!=null&&!l.bounds.contains(R,s)&&(r==null||r(Math.trunc(j*100)/100))},[j]);const E=d.useRef(h);h!==E.current&&(E.current=h);const b=d.useRef(h);d.useEffect(()=>{g(R=>({...R,position:s,color:c,lineWidth:u,lineDash:x}))},[s,c,u,x]);const S=Ke({onStart:d.useCallback(()=>{g(R=>({...R,dragging:!0})),b.current=E.current},[]),onMove:R=>{g(w=>({...w,pixelPosition:(b.current??0)+l.box$1.signedHeight(R)}))},onEnd:d.useCallback(()=>{g(R=>({...R,dragging:!1})),b.current=h},[])}),y=d.useRef(null);if(j==null||h==null)return null;const v=hs(y==null?void 0:y.current),C=n.jsxRuntimeExports.jsxs("div",{ref:y,className:l.CSS.B("rule"),style:{top:`calc(${h}px - 0.5rem)`},children:[n.jsxRuntimeExports.jsx("div",{className:l.CSS.BE("rule","drag-handle"),onDragStart:S,draggable:!0}),n.jsxRuntimeExports.jsxs(N.Space,{direction:"x",align:"center",style:{marginLeft:"2rem"},children:[n.jsxRuntimeExports.jsx(a.Editable,{level:"p",value:m,onChange:p}),n.jsxRuntimeExports.jsx(a.Text,{level:"p",style:{padding:"0.25rem 0",width:"fit-content"},children:`${j.toFixed(2)} ${i}`})]})]});return v==null?C:Bn.createPortal(C,v)}),Do=Object.freeze(Object.defineProperty({__proto__:null,Rule:yt},Symbol.toStringTag,{value:"Module"})),ys=a.canDropOfType(te),zo=({lines:e,axes:t,showTitle:s=!0,title:o="",onTitleChange:r,showLegend:i=!0,titleLevel:c="h4",onLineChange:u,onRuleChange:x,onAxisChannelDrop:m,onAxisChange:p,rules:j,enableTooltip:h=!0,enableMeasure:g=!1,initialViewport:E=l.box$1.DECIMAL,onViewportChange:b,viewportTriggers:S,...y})=>{const v=t.filter(({location:C})=>l.location.isY(C));return n.jsxRuntimeExports.jsxs(rs,{...y,children:[v.map((C,R)=>{const w=e.filter(B=>B.axes.x===C.key),$=t.filter(({location:B})=>l.location.isX(B)),_=j==null?void 0:j.filter(B=>[...$.map(({key:P})=>P),C.key].includes(B.axis));return n.jsxRuntimeExports.jsx(Oo,{axis:C,index:R,lines:w,yAxes:$,rules:_,onAxisChannelDrop:m,onAxisChange:p},C.key)}),i&&n.jsxRuntimeExports.jsx(ls,{onLineChange:u}),s&&n.jsxRuntimeExports.jsx(cs,{value:o,onChange:r,level:c}),n.jsxRuntimeExports.jsxs(gs,{initial:E,onChange:b,triggers:S,children:[h&&n.jsxRuntimeExports.jsx(No,{}),g&&n.jsxRuntimeExports.jsx(bs,{})]})]})},Oo=({yAxes:e,lines:t,index:s,rules:o,onRuleChange:r,onAxisChannelDrop:i,onAxisChange:c,axis:{location:u,key:x,showGrid:m,...p}})=>{const j=a.useDrop({type:"Channel.LinePlot.XAxis",canDrop:ys,onDrop:d.useCallback(({items:g})=>{const E=a.filterByType(te,g);return i==null||i(x,E.map(({key:b})=>b)),E},[x,i])}),h=o==null?void 0:o.filter(g=>g.axis===x);return n.jsxRuntimeExports.jsxs(Es,{...p,...j,location:u,showGrid:m??s===0,className:l.CSS(l.CSS.dropRegion(a.canDropOfType(te)(a.useDraggingState()))),onAutoBoundsChange:g=>c==null?void 0:c({key:x,bounds:g}),children:[e.map((g,E)=>{const b=t.filter(y=>y.axes.y===g.key),S=o==null?void 0:o.filter(y=>y.axis===g.key);return n.jsxRuntimeExports.jsx(Ao,{axis:{...g,showGrid:m??(s===0&&E===0)},lines:b,rules:S,onRuleChange:r,onAxisChannelDrop:i,onAxisChange:c},g.key)}),h==null?void 0:h.map(g=>d.createElement(yt,{aetherKey:g.key,...g,key:g.key,onLabelChange:E=>r==null?void 0:r({key:g.key,label:E}),onPositionChange:E=>r==null?void 0:r({key:g.key,position:E})}))]})},Vo=({channels:{x:e,y:t}})=>`${e??0}-${t}`,Ao=({lines:e,rules:t,onRuleChange:s,onAxisChannelDrop:o,onAxisChange:r,axis:{key:i,location:c,...u}})=>{const x=a.useDrop({type:"Channel.LinePlot.YAxis",canDrop:ys,onDrop:d.useCallback(({items:p})=>{const j=a.filterByType(te,p);return o==null||o(i,j.map(({key:h})=>h)),j},[i,o])}),m=a.useDraggingState();return n.jsxRuntimeExports.jsxs(Ss,{...u,...x,location:c,className:l.CSS(l.CSS.dropRegion(a.canDropOfType(te)(m))),onAutoBoundsChange:p=>r==null?void 0:r({key:i,bounds:p}),children:[e.map(p=>n.jsxRuntimeExports.jsx(Io,{line:p},Vo(p))),t==null?void 0:t.map(p=>d.createElement(yt,{aetherKey:p.key,...p,key:p.key,onLabelChange:j=>s==null?void 0:s({key:p.key,label:j}),onPositionChange:j=>s==null?void 0:s({key:p.key,position:j})}))]})},Io=({line:e})=>e.variant==="static"?n.jsxRuntimeExports.jsx(Fo,{line:e}):n.jsxRuntimeExports.jsx(Zo,{line:e}),Zo=({line:{key:e,timeSpan:t,channels:{x:s,y:o},...r}})=>{const i=f.streamChannelData({timeSpan:t,channel:o}),c=s!=null&&s!==0,u=f.streamChannelData({timeSpan:t,channel:c?s:o,index:!c});return n.jsxRuntimeExports.jsx(gt,{aetherKey:e,y:i,x:u,...r})},Fo=({line:{timeRange:e,key:t,channels:{x:s,y:o},...r}})=>{const i=f.channelData({timeRange:e,channel:o}),c=s!=null&&s!==0,u=f.channelData({timeRange:e,channel:c?s:o,index:!c});return n.jsxRuntimeExports.jsx(gt,{aetherKey:t,y:i,x:u,...r})},Ct=d.createContext(f.ZERO_CONTEXT_VALUE),Le=()=>d.useContext(Ct).synnax,Yo=()=>d.useContext(Ct).state,Ot={connected:"success",connecting:"info",disconnected:"info",failed:"error"},Cs=a.wrap$1(f.Provider.TYPE,({aetherKey:e,connParams:t,children:s})=>{const[o,r,i]=a.useCombinedStateAndRef(f.ZERO_CONTEXT_VALUE),[{path:c},,u]=a.use$3({aetherKey:e,type:f.Provider.TYPE,schema:f.Provider.stateZ,initialState:{props:t??null,state:null}}),x=a.useAggregator(),m=d.useCallback(p=>{i.current.state.status!==p.status&&x({variant:Ot[p.status],message:p.message??l.Case.capitalize(p.status)}),r(j=>({...j,state:p}))},[x]);return a.useAsyncEffect(async()=>{if(o.synnax!=null&&o.synnax.close(),t==null)return r(f.ZERO_CONTEXT_VALUE);const p=new G.Zb({...t,connectivityPollFrequency:G.Le.seconds(5)}),j=await p.connectivity.check();return r({synnax:p,state:j}),x({variant:Ot[j.status],message:j.message??j.status.toUpperCase()}),p.connectivity.onChange(m),u({props:t,state:j}),()=>{p.close(),r(f.ZERO_CONTEXT_VALUE),u({props:null,state:null})}},[t,m]),n.jsxRuntimeExports.jsx(Ct.Provider,{value:o,children:n.jsxRuntimeExports.jsx(a.Composite,{path:c,children:s})})}),Go=Object.freeze(Object.defineProperty({__proto__:null,Provider:Cs,use:Le,useConnectionState:Yo},Symbol.toStringTag,{value:"Module"})),be=d.createContext({aliases:{},getName:async()=>await Promise.resolve(void 0),setAlias:null}),vs=()=>d.useContext(be),ws=e=>{const{aliases:t}=d.useContext(be);return t[e]??null},Je=()=>{const{aliases:e}=d.useContext(be);return e},vt=(e,t="")=>{const{getName:s}=d.useContext(be),[o,r]=d.useState(t);return a.useAsyncEffect(async()=>{const i=await s(e);i!=null&&r(i)},[e,s]),o},wt=()=>{const{activeRange:e}=d.useContext(be);return e??void 0},$s=({activeRange:e,children:t})=>{const s=Le(),[o,r]=d.useState({}),i=d.useCallback(x=>{r(m=>{const p={...m};return x.forEach(({variant:j,key:h,value:g})=>{const E=Number(h.split("---")[1]);j==="delete"?delete p[E]:p[g.channel]=g.alias}),p})},[r]),c=d.useCallback(async(x,m)=>{if(s==null||e==null)return;await(await s.ranges.retrieve(e)).setAlias(x,m)},[s,e]),u=d.useCallback(async x=>{if(s==null||x===0)return;const m=o[x];return m??(await s.channels.retrieve(x)).name},[o,s]);return a.useAsyncEffect(async()=>{if(s==null||e==null){r({});return}const x=await s.ranges.retrieve(e),m=await x.listAliases();r(m);const p=await x.openAliasTracker(),j=p.onChange(i);return()=>{j(),p.close()}},[s,e]),n.jsxRuntimeExports.jsx(be.Provider,{value:{aliases:o,activeRange:e,setAlias:e!=null?c:null,getName:u},children:t})},Ho=({channelKey:e,value:t,shadow:s,className:o,...r})=>{const[i,c]=d.useState(!1),{setAlias:u}=vs(),x=ws(e),m=vt(e);let p=n.jsxRuntimeExports.jsx(a.u0.Rename,{});i?p=n.jsxRuntimeExports.jsx(a.u0.Loading,{}):x===t&&(p=n.jsxRuntimeExports.jsx(a.u0.Check,{}));const j=u!=null&&!i&&x!==t&&e!==0,h=()=>{j&&(async()=>(c(!0),await u(e,t),c(!1)))()},g=()=>{var b;x!=null&&((b=r.onChange)==null||b.call(r,x))},E=()=>e===0?n.jsxRuntimeExports.jsx(a.Text,{level:"small",children:"Select a channel to enable alias syncing with this label"}):u==null?n.jsxRuntimeExports.jsx(a.Text,{level:"small",children:"Select a range to enable alias syncing with this label"}):t.length===0?n.jsxRuntimeExports.jsx(a.Text,{level:"small",children:"Enter a value to enable alias syncing with this label"}):x===t?n.jsxRuntimeExports.jsx(a.Text,{level:"small",children:"Alias synced with this label"}):n.jsxRuntimeExports.jsxs(a.Text,{level:"small",children:["Sync alias for ",m," with this label"]});return n.jsxRuntimeExports.jsxs(a.Text$1,{value:t,...r,children:[j&&n.jsxRuntimeExports.jsx(a.Icon,{onClick:g,tooltip:n.jsxRuntimeExports.jsxs(a.Text,{level:"small",children:["Set ",m," as label"]}),tooltipLocation:{y:"top"},variant:"outlined",children:n.jsxRuntimeExports.jsx(a.u0.Sync,{})}),n.jsxRuntimeExports.jsx(a.Icon,{onClick:h,disabled:!j,tooltip:n.jsxRuntimeExports.jsx(E,{}),tooltipLocation:{y:"top"},variant:"outlined",children:p})]})},Vt=[{key:"name",name:"Name"},{key:"alias",name:"Alias"},{key:"rate",name:"Rate"},{key:"dataType",name:"Data Type"},{key:"index",name:"Index"},{key:"key",name:"Key"},{key:"isIndex",name:"Is Index"}],Fe=({items:e},t)=>{const s=a.filterByType(te,e);return s.length>0&&!s.every(o=>t.includes(o.key))},Ts=["name","alias"],Ps=e=>{const t=Je();return d.useMemo(()=>e.length===0?Vt:Vt.filter(s=>e.includes(s.key)),[e,t])},qo=({columns:e=Ts,onChange:t,className:s,value:o,...r})=>{const i=Le(),c=Je(),u=Ps(e),x=wt(),m=d.useMemo(()=>i==null?void 0:i.channels.newSearcherUnderRange(x),[i,x]),p=i!=null?void 0:n.jsxRuntimeExports.jsx(a.Text$2.Centered,{variant:"error",level:"h4",style:{height:150},children:"No client available"}),{startDrag:j,onDragEnd:h,...g}=a.useDragAndDrop({type:"Channel.SelectMultiple",canDrop:d.useCallback(v=>Fe(v,l.toArray(o)),[o]),onDrop:d.useCallback(({items:v})=>{const C=a.filterByType(te,v);if(C.length===0)return[];const R=l.unique([...l.toArray(o),...C.map(w=>w.key)]);return t(R,{clickedIndex:null,clicked:null,entries:[]}),C},[t,o])}),E=a.useDraggingState(),b=d.useCallback(({dropped:v})=>{t(l.toArray(o).filter(C=>!v.some(R=>R.key===C)),{clickedIndex:null,clicked:null,entries:[]})},[t,o]),S=d.useCallback((v,C)=>j([{key:C,type:te}],b),[j,b]),y=d.useCallback(v=>c[v.key]??v.name,[c]);return n.jsxRuntimeExports.jsx(Rt,{className:l.CSS(s,l.CSS.dropRegion(Fe(E,l.toArray(o)))),value:o,onTagDragStart:S,onTagDragEnd:h,searcher:m,onChange:t,columns:u,emptyContent:p,tagKey:y,...g,...r})},ke=({columns:e=Ts,onChange:t,value:s,className:o,data:r,...i})=>{const c=Le(),u=Je(),x=Ps(e),m=wt(),p=d.useMemo(()=>{if(!(r!=null&&r.length>0))return c==null?void 0:c.channels.newSearcherUnderRange(m)},[c,m,r==null?void 0:r.length]),j=c!=null?void 0:n.jsxRuntimeExports.jsx(a.Text$2.Centered,{variant:"error",level:"h4",style:{height:150},children:"No client available"}),h=d.useId(),g=d.useMemo(()=>({key:h,type:"Channel.SelectMultiple"}),[h]),{startDrag:E,onDragEnd:b,...S}=a.useDragAndDrop({type:"Channel.SelectSingle",canDrop:d.useCallback(R=>Fe(R,l.nullToArr(s)),[s]),onDrop:d.useCallback(({items:R})=>{const w=a.filterByType(te,R);return w.length===0?[]:(t(w[0].key,{clickedIndex:null,clicked:null,entries:[]}),w)},[g,t])}),y=a.useDraggingState(),v=d.useCallback(()=>s!=null&&E([{type:te,key:s}]),[E,s]),C=d.useCallback(R=>u[R.key]??R.name,[u]);return n.jsxRuntimeExports.jsx(fs,{data:r,className:l.CSS(o,l.CSS.dropRegion(Fe(y,l.nullToArr(s)))),value:s,onDragStart:v,onDragEnd:b,onChange:t,searcher:p,columns:x,emptyContent:j,tagKey:C,...S,...i})},Uo=Object.freeze(Object.defineProperty({__proto__:null,AliasInput:Ho,AliasProvider:$s,LinePlot:zo,SelectMultiple:qo,SelectSingle:ke,useActiveRange:wt,useAlias:ws,useAliases:Je,useContext:vs,useName:vt},Symbol.toStringTag,{value:"Module"})),Ye=d.memo(e=>{const{onResize:t,...s}=e,{root:{tabs:o,direction:r,first:i,last:c,key:u,size:x},emptyContent:m,...p}=s,j=d.useCallback(([E])=>t(u,E),[t]),{props:h}=jt({direction:r,onResize:j,count:2,initialSizes:x!=null?[x]:void 0});let g;return o!==void 0?g=n.jsxRuntimeExports.jsx(ks,{emptyContent:m,...s}):i!=null&&c!=null?g=n.jsxRuntimeExports.jsxs(Xe,{align:"stretch",className:l.CSS.BE("mosaic","resize"),...h,children:[n.jsxRuntimeExports.jsx(Ye,{...p,root:i,onResize:t},i.key),n.jsxRuntimeExports.jsx(Ye,{...p,root:c,onResize:t},c.key)]}):(g=null,console.warn("Mosaic tree is malformed")),u===1?n.jsxRuntimeExports.jsx(a.Provider$2,{children:g}):g});Ye.displayName="Mosaic";const Ge="pluto-mosaic-tab-drop",$t="pluto-mosaic-tab-create",Wo=(e,t)=>{const s=a.filterByType(Ge,t).map(i=>i.key),o=e.filter(i=>!s.includes(i.tabKey)).length>0;return a.filterByType($t,t).length>0||s.length>0&&(o||e.length===0)},ks=d.memo(({root:e,onDrop:t,onCreate:s,...o})=>{const{key:r,tabs:i}=e,[c,u]=d.useState(null),x=d.useCallback(({items:S})=>Wo(i,S),[i]),m=d.useCallback(({items:S,event:y})=>{u(null);const v=a.filterByType(Ge,S),C=i.length===0?"center":It(At(y));if(v.length>0){const w=v.map(({key:$})=>$)[0];t(r,w,C)}const R=a.filterByType($t,S);if(R.length>0){const w=R.map(({key:$})=>$);s==null||s(r,C,w)}return v},[t,i.length]),p=d.useCallback(({event:S})=>{const y=i.length===0?"center":It(At(S));u(y)},[i.length]),{startDrag:j,...h}=a.useDragAndDrop({type:"Mosaic",canDrop:x,onDrop:m,onDragOver:p}),g=d.useCallback(()=>u(null),[]),E=d.useCallback((S,{tabKey:y})=>j([{key:y,type:Ge}]),[j]),b=d.useCallback(()=>s==null?void 0:s(r,"center"),[r]);return n.jsxRuntimeExports.jsxs("div",{className:l.CSS.BE("mosaic","leaf"),children:[n.jsxRuntimeExports.jsx(X.Tabs,{tabs:i,onDragLeave:g,selected:e.selected,onDragStart:E,onCreate:b,...o,...h}),c!=null&&n.jsxRuntimeExports.jsx("div",{className:l.CSS.BE("mosaic","mask"),style:Xo[c]})]})});ks.displayName="MosaicTabLeaf";const Xo={top:{left:"0%",top:"0%",width:"100%",height:"50%"},bottom:{left:"0%",top:"50%",width:"100%",height:"50%"},left:{left:"0%",top:"0%",width:"50%",height:"100%"},right:{left:"50%",top:"0%",width:"50%",height:"100%"},center:{left:"0%",top:"0%",width:"100%",height:"100%"}},At=e=>{const t=e.currentTarget.getBoundingClientRect(),s=e.clientX-t.left,o=e.clientY-t.top;return o<24?{px:.5,py:.5}:{px:s/t.width,py:o/t.height}},Ko=e=>e,Jo=e=>1-e,It=({px:e,py:t})=>{if(e>.33&&e<.66&&t>.33&&t<.66)return"center";const[s,o]=[Ko(e),Jo(e)];if(t>s&&t>o)return"bottom";if(t<s&&t<o)return"top";if(t>s&&t<o)return"left";if(t<s&&t>o)return"right";throw new Error("[bug] - invalid insert position")},Tt=new Error("Tab not found"),Qo=new Error("Invalid Mosaic"),Ls=(e,t,s="center",o)=>{var x;if(e=me(e),o===void 0)return ct(e,t);const r=Ds(e,o);if(s==="center")return(x=r.tabs)==null||x.push(t),r.selected=t.tabKey,e;if(r.tabs==null||r.tabs.length===0)return e;const[i,c,u]=sr(s);if(r.direction=u,r[i]={key:0,tabs:[t],selected:t.tabKey},r[c]={key:0,tabs:r.tabs,selected:r.selected},r.first==null||r.last==null)throw Qo;return r.first.key=r.key*2,r.last.key=r.key*2+1,r.tabs=void 0,r.size=void 0,r.selected=void 0,e},ct=(e,t)=>(e=me(e),e.tabs!=null?(e.tabs.push(t),e.selected=t.tabKey,e):(e.first!=null?e.first=ct(e.first,t):e.last!=null&&(e.last=ct(e.last,t)),e)),He=e=>{e=me(e);const t=[];if(e.tabs!=null&&(e.selected=X.resetSelection(e.selected,e.tabs),e.selected!=null&&t.push(e.selected)),e.first!=null){const[s,o]=He(e.first);e.first=s,t.push(...o)}if(e.last!=null){const[s,o]=He(e.last);e.last=s,t.push(...o)}return[e,t]},Pt=(e,t)=>{var i;e=me(e);const[,s]=Se(e,t);if(s==null)return[e,null];s.tabs=(i=s.tabs)==null?void 0:i.filter(c=>c.tabKey!==t),s.selected=X.resetSelection(s.selected,s.tabs);const o=tr(e),r=s.selected??qe(o);return[o,r]},qe=e=>e.selected!=null?e.selected:e.first!=null?qe(e.first):e.last!=null?qe(e.last):null,Ms=(e,t)=>{e=me(e);const[s,o]=Se(e,t);if(s==null||o==null)throw Tt;return o.selected=t,e},Ns=(e,t,s,o)=>{e=me(e);const[r,i]=Se(e,t);if(r==null||i==null)throw Tt;const[c,u]=Pt(e,t);return[Ls(c,r,s,o),u]},_s=(e,t,s)=>{const o=Ue(e,t);if(o==null)throw new Error("Node not found");return o.size=s,e},Bs=(e,t,s)=>{e=me(e);const[,o]=Se(e,t);if((o==null?void 0:o.tabs)==null)throw Tt;return o.tabs=X.rename(t,s,(o==null?void 0:o.tabs)??[]),e},er=e=>e.tabs!=null?e.tabs.length===0:e.first==null&&e.last==null,Ds=(e,t)=>{const s=Ue(e,t);if(s!=null)return s;const o=Math.floor(t/2);return o===0?e:Ds(e,o)},tr=e=>{let t=!0;for(;t;)[e,t]=at(e);return e},at=e=>{if(e.first==null||e.last==null)return[e,!1];if(Ft(e.first))return[Zt(e.last,!0),!0];if(Ft(e.last))return[Zt(e.first,!1),!0];let[t,s]=[!1,!1];return[e.first,t]=at(e.first),[e.last,s]=at(e.last),[e,t||s]},Zt=(e,t)=>(e.size=void 0,e.key=(e.key-Number(t))/2,e),Ft=e=>e.first==null&&e.last==null&&(e.tabs==null||e.tabs.length===0),Se=(e,t)=>{if(e.tabs!=null){const c=e.tabs.find(u=>u.tabKey===t);if(c!=null)return[c,e]}if(e.first==null||e.last==null)return[void 0,void 0];const[s,o]=Se(e.first,t);if(s!=null&&o!=null)return[s,o];const[r,i]=Se(e.last,t);return[r,i]},Ue=(e,t)=>{if(e.key===t)return e;if(e.first==null||e.last==null)return;const s=Ue(e.first,t);return s??Ue(e.last,t)},sr=e=>{switch(e){case"top":return["first","last","y"];case"left":return["first","last","x"];case"bottom":return["last","first","y"];case"right":return["last","first","x"];case"center":throw new Error("cannot split a center placed tab")}},me=e=>l.external.copy(e),nr=({allowRename:e=!1,initialTree:t})=>{const[s,o]=d.useState(t);return d.useEffect(()=>o(He(t)[0]),[t]),{root:s,onDrop:(m,p,j)=>o(h=>Ns(h,p,j,m)[0]),onClose:m=>o(p=>Pt(p,m)[0]),onSelect:m=>o(p=>Ms(p,m)),onResize:(m,p)=>o(j=>_s(j,m,p)),onRename:e?(m,p)=>o(j=>Bs(j,m,p)):void 0}},or=Object.freeze(Object.defineProperty({__proto__:null,HAUL_CREATE_TYPE:$t,HAUL_DROP_TYPE:Ge,Mosaic:Ye,autoSelectTabs:He,findSelected:qe,insertTab:Ls,isEmpty:er,moveTab:Ns,removeTab:Pt,renameTab:Bs,resizeNode:_s,selectTab:Ms,use:nr},Symbol.toStringTag,{value:"Module"})),kt=({aetherKey:e})=>{const[,{region:t},s]=a.use$3({aetherKey:e,type:f.Eraser$1.TYPE,schema:f.eraserStateZ,initialState:{region:l.box$1.ZERO,enabled:!0}}),o=a.useSyncedRef(t),r=d.useCallback(c=>{l.box$1.equals(c,o.current)||s(u=>({...u,region:c}))},[s]);return{setEnabled:d.useCallback(c=>s(u=>({...u,enabled:c})),[s]),erase:r}},rr=a.wrap$1(f.Eraser$1.TYPE,({aetherKey:e,children:t})=>{const{erase:s}=kt({aetherKey:e}),o=a.useResize(s);return n.jsxRuntimeExports.jsx("div",{ref:o,className:l.CSS(l.CSS.inheritDims()),children:t})}),lr=Object.freeze(Object.defineProperty({__proto__:null,Eraser:rr,use:kt},Symbol.toStringTag,{value:"Module"})),ir=({items:e,initialKey:t})=>{const[s,o]=d.useState(t),r=c=>o(c===s?void 0:c),i=e.find(c=>c.key===s);return{onSelect:r,activeItem:i}},cr=a.wrap$1("Nav.Drawer",({aetherKey:e,activeItem:t,children:s,onSelect:o,location:r="left",collapseThreshold:i=.65,className:c,onResize:u,...x})=>{const m=l.location.direction(r),p=d.useCallback(()=>t!=null&&(o==null?void 0:o(t.key)),[o,t==null?void 0:t.key]),{erase:j,setEnabled:h}=kt({aetherKey:e}),g=d.useCallback((S,y)=>{u==null||u(S,y),j(y)},[u,j]);if(d.useLayoutEffect(()=>{h(t!=null)},[t,h]),t==null)return null;const{content:E,...b}=t;return n.jsxRuntimeExports.jsx(es,{className:l.CSS(l.CSS.BE("navdrawer","content"),l.CSS.dir(m),c),collapseThreshold:i,onCollapse:p,location:r,onResize:g,...b,...x,children:t.content})}),ar=({location:e="left",size:t="9rem",className:s,style:o,...r})=>{const i=l.location.construct(e),c=l.location.direction(i),u=l.direction$1.swap(c);return n.jsxRuntimeExports.jsx(N.Space,{className:l.CSS(l.CSS.B("navbar"),l.CSS.bordered(l.location.swap(i)),l.CSS.dir(u),l.CSS.loc(i),s),direction:u,style:{[l.direction$1.dimension(c)]:t,...o},align:"center",empty:!0,...r})},Me=e=>({bordered:t=!1,className:s,...o})=>n.jsxRuntimeExports.jsx(N.Space,{className:l.CSS(l.CSS.BE("navbar","content"),e==="absolute-center"?l.CSS.M(e):l.CSS.align(e),e!==""&&t&&l.CSS.bordered(e),s),align:"center",...o}),zs=Me("start");zs.displayName="NavbarStart";const Os=Me("end");Os.displayName="NavbarEnd";const Vs=Me("center");Vs.displayName="NavbarCenter";const As=Me("");As.displayName="NavbarContent";const Is=Me("absolute-center");Is.displayName="NavbarAbsoluteCenter";const ye=ar;ye.Start=zs;ye.Center=Vs;ye.End=Os;ye.AbsoluteCenter=Is;ye.Content=As;const ur=Object.freeze(Object.defineProperty({__proto__:null,Bar:ye,Drawer:cr,useDrawer:ir},Symbol.toStringTag,{value:"Module"})),ot={Close:n.jsxRuntimeExports.jsxs("svg",{width:"124",height:"124",viewBox:"0 0 124 124",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsxRuntimeExports.jsx("rect",{x:"26.8701",y:"88.3883",width:"87",height:"11",transform:"rotate(-45 26.8701 88.3883)",fill:"#7E0508"}),n.jsxRuntimeExports.jsx("rect",{x:"26.8701",y:"34.6482",width:"11",height:"87",transform:"rotate(-45 26.8701 34.6482)",fill:"#7E0508"})]}),Minimize:n.jsxRuntimeExports.jsx("svg",{width:"87",height:"11",viewBox:"0 0 87 11",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:n.jsxRuntimeExports.jsx("rect",{x:"15",width:"60",height:"11",fill:"#985712"})}),Maximize:n.jsxRuntimeExports.jsxs("svg",{width:"143",height:"143",viewBox:"0 0 143 143",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsxRuntimeExports.jsx("path",{d:"M108.242 32.8833C108.797 32.8817 109.247 33.3317 109.245 33.8862L109.092 87.5891C109.09 88.4786 108.014 88.9223 107.385 88.2933L53.8351 34.7432C53.2061 34.1142 53.6499 33.0387 54.5394 33.0361L108.242 32.8833Z",fill:"#0B650D"}),n.jsxRuntimeExports.jsx("path",{d:"M33.8862 109.245C33.3317 109.247 32.8818 108.797 32.8833 108.242L33.0361 54.5394C33.0387 53.6499 34.1142 53.2061 34.7432 53.8351L88.2934 107.385C88.9223 108.014 88.4786 109.09 87.5891 109.092L33.8862 109.245Z",fill:"#0B650D"})]})},xr=({disabled:e=[],className:t,focused:s=!0,onMinimize:o,onMaximize:r,onFullscreen:i,onClose:c,...u})=>n.jsxRuntimeExports.jsxs(N.Space,{size:1.5,direction:"x",className:l.CSS(l.CSS.B("macos-controls"),!s&&l.CSS.BM("macos-controls","blurred"),t),...u,children:[n.jsxRuntimeExports.jsx(rt,{onClick:c,className:l.CSS.BM("macos-control","close"),disabled:e.includes("close"),children:ot.Close}),n.jsxRuntimeExports.jsx(rt,{onClick:o,className:l.CSS.BM("macos-control","minimize"),disabled:e.includes("minimize"),children:ot.Minimize}),n.jsxRuntimeExports.jsx(rt,{onClick:i,className:l.CSS.BM("macos-control","maximize"),disabled:e.includes("maximize"),children:ot.Maximize})]}),rt=({className:e,...t})=>n.jsxRuntimeExports.jsx("button",{className:l.CSS(l.CSS.B("macos-control"),e),tabIndex:-1,size:"",...t}),lt=({disabled:e=[],onMinimize:t,onMaximize:s,onClose:o,onFullscreen:r,...i})=>n.jsxRuntimeExports.jsxs(N.Pack,{...i,children:[n.jsxRuntimeExports.jsx(it,{className:l.CSS.BM("windows-control","minimize"),onClick:t,disabled:e.includes("minimize"),children:n.jsxRuntimeExports.jsx(a.u0.Subtract,{})}),n.jsxRuntimeExports.jsx(it,{className:l.CSS.BM("windows-control","maximize"),onClick:s,disabled:e.includes("maximize"),children:n.jsxRuntimeExports.jsx(a.u0.Box,{})}),n.jsxRuntimeExports.jsx(it,{onClick:o,className:l.CSS.BM("windows-control","close"),disabled:e.includes("close"),children:n.jsxRuntimeExports.jsx(a.u0.Close,{})})]}),it=({disabled:e=!1,className:t,...s})=>e?null:n.jsxRuntimeExports.jsx(a.Icon,{className:l.CSS(l.CSS.B("windows-control"),t),tabIndex:-1,...s}),Zs=e=>l.external$1.getOS(e),dr={MacOS:xr,Windows:lt,Linux:lt,Docker:lt},pr="Windows",mr=({forceOS:e,visibleIfOS:t,...s})=>{const o=Zs({force:e,default:pr}),r=dr[o];return t!=null&&t!==o?null:n.jsxRuntimeExports.jsx(r,{...s})},jr=Object.freeze(Object.defineProperty({__proto__:null,Controls:mr,use:Zs},Symbol.toStringTag,{value:"Module"}));var ee;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(ee||(ee={}));function fr({color:e,dimensions:t,lineWidth:s}){return d.createElement("path",{stroke:e,strokeWidth:s,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function hr({color:e,radius:t}){return d.createElement("circle",{cx:t,cy:t,r:t,fill:e})}const gr={[ee.Dots]:"#91919a",[ee.Lines]:"#eee",[ee.Cross]:"#e2e2e2"},Er={[ee.Dots]:1,[ee.Lines]:1,[ee.Cross]:6},Sr=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Fs({id:e,variant:t=ee.Dots,gap:s=20,size:o,lineWidth:r=1,offset:i=2,color:c,style:u,className:x}){const m=d.useRef(null),{transform:p,patternId:j}=f.useStore(Sr,f.shallow$1),h=c||gr[t],g=o||Er[t],E=t===ee.Dots,b=t===ee.Cross,S=Array.isArray(s)?s:[s,s],y=[S[0]*p[2]||1,S[1]*p[2]||1],v=g*p[2],C=b?[v,v]:y,R=E?[v/i,v/i]:[C[0]/i,C[1]/i];return d.createElement("svg",{className:f.cc(["react-flow__background",x]),style:{...u,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:m,"data-testid":"rf__background"},d.createElement("pattern",{id:j+e,x:p[0]%y[0],y:p[1]%y[1],width:y[0],height:y[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${R[0]},-${R[1]})`},E?d.createElement(hr,{color:h,radius:v/i}):d.createElement(fr,{dimensions:C,color:h,lineWidth:r})),d.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${j+e})`}))}Fs.displayName="Background";var Rr=d.memo(Fs);const Yt=({sourcePos:e,targetPos:t,next:s,prev:o})=>{const r=Pe(e,...s);return l.xy.distance(r,t)<1?!0:(console.warn("Connector is out of sync with target"),console.log("Theoretical target",r),console.log("Actual target",t),console.log("Segments",s),console.log("Prev segments",o),!1)},Gt=({sourceStumpTip:e,sourceOrientation:t,sourceBox:s,targetStumpTip:o,targetOrientation:r,targetBox:i})=>{if(!br({sourcePos:e,sourceOrientation:t,targetPos:o}))return;const c=l.direction$1.construct(t),u=l.direction$1.swap(c);let x=xe(u,o[u]-e[u]);const m=l.box$1.loc(s,x);if(l.location.swap(t)===r){const p=l.box$1.loc(i,l.location.swap(x));Math.abs(m-p)<J&&(x=l.location.swap(x))}return{direction:u,length:m-e[u]+pe(x,J)}},Pe=(e,...t)=>{let s=e;for(const o of t)s=l.xy.translate(s,o.direction,o.length);return s},Ys=(e,t,s,o)=>{try{let r=e;const i=[e,...t.map(h=>(r=l.xy.translate(r,h.direction,h.length),r))];if(!o)return i;const c=t[0],u=xe(c.direction,c.length),x=Ht(u);i[0]=l.xy.translate(i[0],{[c.direction]:-1*x*4*s,[l.direction$1.swap(c.direction)]:0});const m=t[t.length-1],p=xe(m.direction,m.length),j=Ht(p);return i[i.length-1]=l.xy.translate(i[i.length-1],{[m.direction]:j*4*s,[l.direction$1.swap(m.direction)]:0}),i}catch{return[]}},J=10,Ht=e=>e==="top"||e==="left"?-1:1,pe=(e,t)=>e==="top"||e==="left"?-t:t,xe=(e,t)=>e==="x"?t>0?"right":"left":t>0?"bottom":"top",ie=e=>xe(e.direction,e.length),br=({sourcePos:e,targetPos:t,sourceOrientation:s})=>{const o=l.direction$1.construct(s),r=t[o]-e[o];return pe(s,r)<0},De=e=>({direction:l.direction$1.construct(e),length:pe(e,J)}),qt={top:De("top"),bottom:De("bottom"),left:De("left"),right:De("right")},yr=4,Cr=.25,Qe=e=>ut(vr(ut(e))),vr=e=>{const t=[...e],s=e.findIndex((o,r)=>{const i=Math.abs(o.length);if(i<yr){if(i<Cr)return!0;if(r===0||r===e.length-1||e.length<=3)return!1;if(r+2<e.length){const c=t[r+2];if(c.direction!==o.direction)return!1;t[r+2]={...c,length:c.length+o.length}}else{const c=t[r-2];if(c.direction!==o.direction)return!1;t[r-2]={...c,length:c.length+o.length}}return!0}return!1});return s!==-1&&t.splice(s,1),t},ut=e=>{const t=[...e];return e.findIndex((o,r)=>{const i=t[r-1];if(r===0||o.direction!==i.direction)return!1;if(r===1){const c=r-1,u=r,x=ie(i),m=ie(o);if(x===m)return t[r-1]={direction:t[r-1].direction,length:t[r-1].length+t[r].length},t.splice(r,1),!0;if(Math.abs(i.length)===J)return!1;const p=pe(x,J),j=t[c].length-p,h=t[u].length+j;return Math.abs(h)<J?!1:(t[c]={...t[c],length:p},t[u]={...t[u],length:h},!0)}if(r===e.length-1){const c=r,u=r-1,x=ie(o),m=ie(i);if(x===m)return t[r-1]={direction:t[r-1].direction,length:t[r-1].length+t[r].length},t.splice(r,1),!0;if(Math.abs(o.length)===J)return!1;const p=pe(x,J),j=t[c].length-p,h=t[u].length+j;return Math.abs(h)<J?!1:(t[c]={...t[c],length:p},t[u]={...t[u],length:h},!0)}return t[r-1]={direction:t[r-1].direction,length:t[r-1].length+t[r].length},t.splice(r,1),!0})!==-1?ut(t):t},Ee=e=>Qe(wr(e)),wr=({sourceBox:e,targetBox:t,sourcePos:s,targetPos:o,targetOrientation:r,sourceOrientation:i})=>{let c=i,u=r,x={...qt[i]},m=Pe(s,x);const p={...qt[r]};let j=Pe(o,p);const h=[x],g=Gt({sourceStumpTip:m,sourceOrientation:i,sourceBox:e,targetStumpTip:j,targetOrientation:r,targetBox:t});g!=null&&(h.push(g),m=Pe(m,g),c=ie(g),x=g);const E=Gt({sourceStumpTip:j,sourceOrientation:u,sourceBox:t,targetStumpTip:m,targetOrientation:c,targetBox:e});E!=null&&(j=Pe(j,E),u=xe(E.direction,E.length));const b=()=>{E!=null&&(E.length*=-1,h.push(E)),p.length*=-1,h.push(p)};if(l.location.swap(c)===r){const w=l.direction$1.construct(c),$=(j[w]-m[w])/2;h.push({direction:w,length:$});const _=l.direction$1.swap(w);return h.push({direction:_,length:j[_]-m[_]}),h.push({direction:w,length:$}),b(),h}const S=j[x.direction]-m[x.direction];let y=l.direction$1.swap(x.direction);const v=m[y]-j[y];let C;xe(x.direction,S)===c&&xe(y,v)===u?C={direction:x.direction,length:S}:(C={direction:y,length:j[y]-m[y]},y=l.direction$1.swap(y)),h.push(C);const R={direction:y,length:j[y]-m[y]};return h.push(R),b(),h},$r=e=>Qe(Tr(e)),Tr=({segments:e,index:t,magnitude:s})=>{const o=[...e],r=o[t],i=l.direction$1.swap(r.direction),c=ie(r);if(t===0){o.unshift({direction:i,length:s});const u=pe(c,J);o.unshift({direction:r.direction,length:u}),t+=2,o[t]={...o[t],length:o[t].length-u}}else o[t-1]={direction:o[t-1].direction,length:o[t-1].length+s};if(t===o.length-1){o.push({direction:i,length:-s});const u=pe(c,J);o.push({direction:r.direction,length:u}),o[t]={...o[t],length:o[t].length-u}}else o[t+1]={direction:o[t+1].direction,length:o[t+1].length-s};return o},Pr=(e,t)=>{for(let s=e.length-1;s>=0;s--)if(t(e[s],s))return s;return-1},kr=(e,t,s=!1,...o)=>{const r=(i,c)=>!o.includes(c)&&t(i,c);return s?Pr(e,r):e.findIndex(r)},Lr=({delta:e,segments:t})=>Qe(Gs(e,t,!1)),Mr=({delta:e,segments:t})=>Qe(Gs(e,t,!0)),Gs=(e,t,s)=>{let o=[...t];return e.x!==0&&(o=Wt("x",e,o,s)),e.y!==0&&(o=Wt("y",e,o,s)),o},Ut=(e,t,s)=>{if(t.direction!==e)return!1;const o={...t,length:t.length-s[e]},r=ie(t),i=ie(o);return Math.abs(o.length)>J&&r===i},Wt=(e,t,s,o)=>{const r=l.direction$1.swap(e),i=o?s.length-1:0,c=s[i];if(Ut(e,c,t))return s[i]={...c,length:c.length-t[e]},s;const u=o?0:s.length-1,m=kr(s,j=>j.direction===e,o,i);if(m===u){const j=s[u];return Ut(e,j,t)?(s[u]={...j,length:j.length-t[e]},s):(c.direction===e?s[i]={...c,length:c.length-t[e]}:s[u]={...j,length:j.length-t[e]},s)}if(m===-1)return s.length===1?s[0].direction===e?[{direction:e,length:s[0].length-t[e]}]:[{direction:r,length:s[0].length/2},{direction:e,length:-t[e]},{direction:r,length:s[0].length/2}]:c.direction===e?(s[i]={...c,length:c.length-t[e]},s):[{direction:r,length:s[0].length},{direction:e,length:-t[e]},...s.slice(1)];const p=s[m];return s[m]={...p,length:p.length-t[e]},s},Lt=e=>{const t=document.querySelector(`[data-id="${e}"]`);if(t==null)throw new Error(`[pid] - cannot find node with key: ${e}`);return t},U=(e,t)=>{const s=Lt(t),o=e.getNodes().find(r=>r.id===t);if(o==null)throw new Error(`[pid] - cannot find node with key: ${t}`);return l.box$1.construct(o.position,l.box$1.dims(l.box$1.construct(s)))},Nr=(e,t)=>et.fromFlow(e,t);class Hs{constructor(t,s){ue(this,"node_",null);ue(this,"position");ue(this,"orientation");this.position=t,this.orientation=s}set node(t){this.node_=t}get node(){if(this.node_==null)throw new Error("[pid] - handle has no node");return this.node_}get absolutePosition(){return l.xy.translate(l.box$1.topLeft(this.node.box),this.position)}}class et{constructor(t,s,o){ue(this,"key");ue(this,"box");ue(this,"handles");this.key=t,this.box=s,this.handles=o,o.forEach(r=>r.node=this)}static fromFlow(t,s){const o=U(s,t),r=Lt(t),i=r.getElementsByClassName("react-flow__handle"),c=l.box$1.construct(r),u=Array.from(i).map(x=>{const m=l.box$1.center(l.box$1.construct(x)),p=l.xy.translation(l.box$1.topLeft(c),m),j=x.className.match(/react-flow__handle-(\w+)/);if(j==null)throw new Error("[pid] - cannot find handle orientation");const h=l.location.construct(j[0]);return new Hs(p,h)});return new et(t,o,u)}}const _r=({fromX:e,fromY:t,toX:s,toY:o,fromPosition:r,toPosition:i,fromNode:c,connectionLineStyle:u,connectionStatus:x})=>{const m=document.querySelector(".react-flow__handle-connecting"),p=m==null?void 0:m.className.match(/react-flow__handle-(\w+)/);if(p!=null){const E=l.location.outer.safeParse(p[1]);E.success&&(i=E.data)}const j=Ee({sourcePos:l.xy.construct(e,t),targetPos:l.xy.construct(s,o),sourceOrientation:r,targetOrientation:i,sourceBox:U(f.useReactFlow(),(c==null?void 0:c.id)??""),targetBox:U(f.useReactFlow(),(c==null?void 0:c.id)??"")}),h=f.useReactFlow(),g=Ys(l.xy.construct(e,t),j,h.getZoom(),!1);return n.jsxRuntimeExports.jsx(f.BaseEdge,{path:qs(g),style:{...u,stroke:l.cssString(x==="invalid"?"var(--pluto-error-z)":"var(--pluto-gray-l9)"),strokeWidth:2,fill:"none"}})},Br=({id:e,source:t,target:s,sourcePosition:o,targetHandleId:r,targetPosition:i,style:c,segments:u=[],onSegmentsChange:x,color:m="var(--pluto-gray-l9)",selected:p=!1,...j})=>{const h=l.xy.construct(j.sourceX,j.sourceY),g=d.useRef(h),E=l.xy.equals(h,g.current),b=l.xy.construct(j.targetX,j.targetY),S=d.useRef(b),y=l.xy.equals(b,S.current),v=f.useReactFlow(),[C,R,w]=a.useCombinedStateAndRef(()=>u.length>0?u:Ee({sourcePos:h,targetPos:b,sourceOrientation:o,targetOrientation:i,sourceBox:U(v,t),targetBox:U(v,s)})),$=d.useRef(i),_=d.useRef(o),B=a.useDebouncedCallback(x,100,[x]);if(!E||!y){let L=C;const M=l.xy.translation(g.current,h),V=l.xy.translation(b,S.current);l.xy.equals(M,l.xy.scale(V,-1),.001)?(g.current=h,S.current=b):(E?y||(L=Mr({delta:V,segments:L}),$.current!==i&&($.current=i,L=Ee({sourcePos:h,targetPos:b,sourceOrientation:o,targetOrientation:i,sourceBox:U(v,t),targetBox:U(v,s)})),Yt({sourcePos:h,targetPos:b,next:L,prev:C})||(L=Ee({sourcePos:h,targetPos:b,sourceOrientation:o,targetOrientation:i,sourceBox:U(v,t),targetBox:U(v,s)})),S.current=b):(L=Lr({delta:M,segments:L}),_.current!==o&&(_.current=o,L=Ee({sourcePos:h,targetPos:b,sourceOrientation:o,targetOrientation:i,sourceBox:U(v,t),targetBox:U(v,s)})),Yt({sourcePos:h,targetPos:b,next:L,prev:C})||(L=Ee({sourcePos:h,targetPos:b,sourceOrientation:o,targetOrientation:i,sourceBox:U(v,t),targetBox:U(v,s)})),g.current=h),B(L),R(L))}const P=d.useRef(null),O=Ke({onStart:d.useCallback((L,M,V)=>{P.current={index:Number(V.currentTarget.id.split("-")[1]),segments:[...w.current]}},[]),onMove:d.useCallback(L=>{if(P.current==null)return;const M=$r({segments:P.current.segments,index:P.current.index,magnitude:l.box$1.dim(L,l.direction$1.swap(P.current.segments[P.current.index].direction),!0)/v.getZoom()});R(M)},[]),onEnd:d.useCallback(()=>x(w.current),[x])}),z=Ys(h,C,v.getZoom(),!0);return n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx(f.BaseEdge,{path:qs(z),style:{...c,stroke:l.cssString(m)},...j}),p&&Dr(z).map((L,M)=>{const V=C[M].direction,Q=l.direction$1.swap(V),re={[l.direction$1.dimension(V)]:"18px",[l.direction$1.dimension(Q)]:"4px"},he={[V]:L[V]-9,[Q]:L[Q]-2};return n.jsxRuntimeExports.jsxs(d.Fragment,{children:[n.jsxRuntimeExports.jsx("rect",{className:l.CSS.BE("diagram-edge-handle","background"),fill:"var(--pluto-gray-l0)",stroke:"var(--pluto-primary-z)",...re,...he,rx:"2px",ry:"2px"}),n.jsxRuntimeExports.jsx("foreignObject",{x:L.x-9,y:L.y-9,width:"18px",height:"18px",children:n.jsxRuntimeExports.jsx("div",{id:`handle-${M}`,className:l.CSS(l.CSS.BE("diagram-edge-handle","dragger"),l.CSS.dir(V)),draggable:!0,onDragStart:O})})]},M)})]})},qs=e=>{let t="";const o=e.length+-1;for(let r=0;r<o;r++){const i=e[r%e.length],c=e[(r+1)%e.length],u=Math.min(6/Math.hypot(c.x-i.x,c.y-i.y),.5);r>0&&(t+=`Q${i.x},${i.y} ${i.x*(1-u)+c.x*u},${i.y*(1-u)+c.y*u}`),r===0?t+=`M${i.x},${i.y}`:r===0&&(t+=`M${i.x*(1-u)+c.x*u},${i.y*(1-u)+c.y*u}`),r===o-1?t+=`L${c.x},${c.y}`:r<o-1&&(t+=`L${i.x*u+c.x*(1-u)},${i.y*u+c.y*(1-u)}`)}return t},Dr=e=>e.slice(1).map((t,s)=>{const o=e[s];return l.xy.construct((t.x+o.x)/2,(t.y+o.y)/2)}),zr=({initialNodes:e,initialEdges:t,allowEdit:s=!0,initialViewport:o={position:l.xy.ZERO,zoom:1}})=>{const[r,i]=d.useState(s),[c,u]=d.useState(e),[x,m]=d.useState(t),[p,j]=d.useState(o);return{viewport:p,onViewportChange:j,edges:x,nodes:c,onNodesChange:u,onEdgesChange:m,editable:r,onEditableChange:i}},Or=e=>e.source!==e.target,Vr={nodesDraggable:!0,nodesConnectable:!0,elementsSelectable:!0,zoomOnDoubleClick:!1},Ar={connectionRadius:0,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,panOnDrag:!1,panOnScroll:!1,zoomOnScroll:!1,zoomOnDoubleClick:!1,zoomOnPinch:!1,edgesFocusable:!1,edgesUpdatable:!1,nodesFocusable:!1,edgeUpdaterRadius:0},Us={padding:0,maxZoom:1,minZoom:.5},Ir={hideAttribution:!0},Ws=d.createContext({editable:!0,onEditableChange:()=>{},registerNodeRenderer:()=>{}}),tt=()=>d.useContext(Ws),Xs=d.memo(({children:e})=>{const{registerNodeRenderer:t}=tt();return d.useEffect(()=>t(e),[t,e]),null});Xs.displayName="NodeRenderer";const Zr=a.wrap$1(f.Diagram$1.TYPE,({aetherKey:e,children:t,onNodesChange:s,onEdgesChange:o,nodes:r,edges:i,onEditableChange:c,editable:u,viewport:x,triggers:m,onViewportChange:p,...j})=>{const[{path:h},,g]=a.use$3({aetherKey:e,type:f.Diagram$1.TYPE,schema:f.diagramStateZ,initialState:{position:x.position,region:l.box$1.ZERO,zoom:x.zoom}}),E=a.use().colors.gray.l9.hex,b=a.useMemoCompare(()=>m??St.zoom,a.compareModeConfigs,[m]),{fitView:S}=f.useReactFlow(),y=ft(d.useCallback(D=>{g(A=>({...A,region:D}))},[g])),v=d.useRef(null),C=d.useCallback(D=>{const A=v.current;A!=null&&A.x===D.x&&A.y===D.y&&A.zoom===D.zoom||(v.current=D,g(q=>({...q,position:D,zoom:D.zoom})),p(f.translateViewportBackward(D)))},[g,p]);f.useOnViewportChange({onStart:C,onChange:C,onEnd:C});const[R,w]=d.useState(()=>()=>null),$=d.useCallback(D=>w(()=>D),[]),_=d.useMemo(()=>({custom:({id:D,xPos:A,yPos:q,selected:Te})=>R({symbolKey:D,position:{x:A,y:q},selected:Te})}),[R]),B=d.useRef(i),P=d.useMemo(()=>(B.current=i,f.translateEdgesForward(i)),[i]),O=d.useRef(r),z=d.useMemo(()=>(O.current=r,f.translateNodesForward(r)),[r]),L=d.useCallback(D=>s(f.nodeConverter(O.current,A=>f.applyNodeChanges(D,A))),[s]),M=d.useCallback(D=>o(f.edgeConverter(B.current,A=>f.applyEdgeChanges(D,A),E)),[o,E]),V=d.useCallback((D,A)=>o(f.edgeConverter(B.current,q=>f.updateEdge(D,A,q),E)),[]),Q=d.useCallback(D=>{o(f.edgeConverter(B.current,A=>f.addEdge(D,A),E))},[o,E]),re=d.useCallback((D,A)=>{const q=[...B.current],Te=q.findIndex(Mn=>Mn.key===D);Te!==-1&&(q[Te]={...q[Te],segments:A},B.current=q,o(q))},[o]),he=u?Vr:Ar,ae=d.useMemo(()=>({default:D=>n.jsxRuntimeExports.jsx(Br,{...D,segments:D.data.segments,color:D.data.color,onSegmentsChange:d.useCallback(A=>re(D.id,A),[D.id])},D.id)}),[re]),K=d.useRef(null);a.use$2({triggers:b.zoomReset,callback:d.useCallback(({stage:D,cursor:A})=>{const q=K.current;q==null||D!=="start"||!l.box$1.contains(q,A)||S()},[S])});const ge=a.purgeMouse(b.select)[0]??null,Be=a.purgeMouse(b.pan)[0]??null,Pn=a.purgeMouse(b.zoom)[0]??null,kn={selectionOnDrag:ge==null,panOnDrag:Be==null,selectionKeyCode:ge,panActivationKeyCode:Be,zoomActivationKeyCode:Pn},Ln=a.useCombinedRefs(K,y);return n.jsxRuntimeExports.jsx(Ws.Provider,{value:{editable:u,onEditableChange:c,registerNodeRenderer:$},children:n.jsxRuntimeExports.jsx(a.Composite,{path:h,children:n.jsxRuntimeExports.jsx(f.ReactFlow,{...kn,className:l.CSS(l.CSS.B("diagram"),l.CSS.editable(u)),nodes:z,edges:P,nodeTypes:_,edgeTypes:ae,ref:Ln,fitView:!0,onNodesChange:L,onEdgesChange:M,onConnect:Q,onEdgeUpdate:V,defaultViewport:f.translateViewportForward(x),connectionLineComponent:_r,elevateEdgesOnSelect:!0,minZoom:.5,maxZoom:1.2,isValidConnection:Or,connectionMode:f.ConnectionMode.Loose,snapGrid:[3,3],fitViewOptions:Us,selectionMode:f.SelectionMode.Partial,proOptions:Ir,...j,style:{[l.CSS.var("diagram-zoom")]:x.zoom,...j.style},...he,children:t})})})}),Fr=()=>{const{editable:e}=tt();return e?n.jsxRuntimeExports.jsx(Rr,{}):null},Yr=({children:e,...t})=>n.jsxRuntimeExports.jsx(N.Pack,{direction:"y",className:l.CSS.BE("diagram","controls"),...t,children:e}),Gr=({onClick:e,...t})=>{const{editable:s,onEditableChange:o}=tt();return n.jsxRuntimeExports.jsx(a.ToggleIcon,{onChange:()=>o(!s),value:s,uncheckedVariant:"outlined",checkedVariant:"filled",tooltipLocation:l.location.RIGHT_CENTER,tooltip:s?n.jsxRuntimeExports.jsx(a.Text,{level:"small",children:"Disable edit mode"}):n.jsxRuntimeExports.jsx(a.Text,{level:"small",children:"Enable edit mode"}),...t,children:s?n.jsxRuntimeExports.jsx(a.u0.EditOff,{}):n.jsxRuntimeExports.jsx(a.u0.Edit,{})})},Hr=({onClick:e,...t})=>{const{fitView:s}=f.useReactFlow();return n.jsxRuntimeExports.jsx(a.Icon,{onClick:o=>{s(Us),e==null||e(o)},tooltip:n.jsxRuntimeExports.jsx(a.Text,{level:"small",children:"Fit view to contents"}),tooltipLocation:l.location.RIGHT_CENTER,variant:"outlined",...t,children:n.jsxRuntimeExports.jsx(a.u0.Expand,{})})},qr=e=>n.jsxRuntimeExports.jsx(f.ReactFlowProvider,{children:n.jsxRuntimeExports.jsx(Zr,{...e})}),Ur=(e,t="x")=>{if(e.length===0)return[];const s=l.location.construct(t),o=l.location.swap(s);return e.sort((r,i)=>l.box$1.loc(r.box,s)-l.box$1.loc(i.box,s)),e.forEach((r,i)=>{if(i===0)return;const u=e[i-1].handles.find(g=>g.orientation===o),x=r.handles.find(g=>g.orientation===s);if(u==null||x==null)return;const m=u.absolutePosition,p=x.absolutePosition,j=l.xy.set(l.xy.translation(p,m),t,0),h=l.xy.translate(l.box$1.topLeft(r.box),j);r.box=l.box$1.construct(h,l.box$1.dims(r.box))}),e},Wr=Object.freeze(Object.defineProperty({__proto__:null,Background:Fr,Controls:Yr,Diagram:qr,FitViewControl:Hr,HandleLayout:Hs,NodeLayout:et,NodeRenderer:Xs,ToggleEditControl:Gr,alignNodes:Ur,selectNode:Lt,selectNodeBox:U,selectNodeLayout:Nr,use:zr,useContext:tt},Symbol.toStringTag,{value:"Module"})),Xr=({aetherKey:e,...t})=>a.use$3({aetherKey:e,type:f.Table.TYPE,schema:f.tableStateZ,initialState:t}),Kr=a.wrap$1(f.Table.TYPE,({aetherKey:e,numColumns:t,children:s,className:o,...r})=>{const[{path:i},,c]=a.use$3({aetherKey:e,type:f.Table.TYPE,schema:f.tableStateZ,initialState:{region:l.box$1.ZERO,widths:Array(t).fill(0)}}),u=d.useCallback(p=>c(j=>({...j,region:p})),[c]),x=d.useCallback((p,j)=>c(h=>({...h,widths:h.widths.map((g,E)=>E===p?j:g)})),[c]),m=a.useResize(u);return n.jsxRuntimeExports.jsx("table",{ref:m,className:l.CSS(l.CSS.B("table"),o),...r,children:n.jsxRuntimeExports.jsxs("tbody",{children:[n.jsxRuntimeExports.jsx(a.Composite,{path:i,children:s}),n.jsxRuntimeExports.jsx("tr",{className:l.CSS.BE("table","virtual-row"),children:Array(t).fill(0).map((p,j)=>n.jsxRuntimeExports.jsx(Jr,{index:j,onResize:x},j))})]})})}),Jr=({onResize:e,index:t})=>{const s=d.useCallback(r=>e(t,l.box$1.width(r)),[e,t]),o=a.useResize(s);return n.jsxRuntimeExports.jsx("td",{ref:o,className:l.CSS.BE("table","virtual-cell")})},Qr=["y"],el=a.wrap$1(f.TR.TYPE,({aetherKey:e,children:t})=>{const[{path:s},,o]=a.use$3({aetherKey:e,type:f.TR.TYPE,schema:f.trStateZ,initialState:{height:0}}),r=d.useCallback(c=>o(u=>({...u,height:l.box$1.height(c)})),[o]),i=a.useResize(r,{triggers:Qr});return n.jsxRuntimeExports.jsx("tr",{ref:i,children:n.jsxRuntimeExports.jsx(a.Composite,{path:s,children:t})})}),tl=a.wrap$1(f.StringTD.TYPE,({aetherKey:e,telem:t})=>(a.use$3({aetherKey:e,type:f.StringTD.TYPE,schema:f.stringTDStateZ,initialState:{stringSource:t}}),n.jsxRuntimeExports.jsx("td",{style:{height:20}}))),sl=Object.freeze(Object.defineProperty({__proto__:null,StringTD:tl,TR:el,Table:Kr,use:Xr},Symbol.toStringTag,{value:"Module"})),nl=({onChange:e,className:t,onSelect:s,...o})=>n.jsxRuntimeExports.jsx("td",{className:l.CSS(l.CSS.BE("table","label")),onDoubleClick:s,children:n.jsxRuntimeExports.jsx(a.Editable,{...o,onChange:r=>{e({...o,value:r})}})}),ol=({value:e,onChange:t})=>n.jsxRuntimeExports.jsx("h1",{children:"Hello"}),Ks=e=>({value:"Label",level:"p"}),xt={type:"label",title:"Label",initialProps:Ks,Cell:nl,Form:ol},rl={[xt.type]:xt},ll=Object.freeze(Object.defineProperty({__proto__:null,LabelSpec:xt,REGISTRY:rl,initialProps:Ks},Symbol.toStringTag,{value:"Module"})),il=f.Value.z.omit({font:!0}).partial({color:!0}).extend({level:G.levelZ.optional()}),Js=({aetherKey:e,box:t,telem:s,color:o,precision:r,minWidth:i,level:c="small"})=>{const u=a.useMemoDeepEqualProps({box:t,telem:s,color:o,precision:r,level:c,minWidth:i}),[,x,m]=a.use$3({aetherKey:e,type:f.Value.TYPE,schema:f.Value.z,initialState:u});return d.useLayoutEffect(()=>m(p=>({...p,...u})),[u]),{width:x.width??x.minWidth}},cl=Object.freeze(Object.defineProperty({__proto__:null,corePropsZ:il,use:Js},Symbol.toStringTag,{value:"Module"})),al=({value:e,onChange:t})=>{const{inner:s,outer:o}=e,r=i=>()=>t({...e,...i});return n.jsxRuntimeExports.jsxs(N.Space,{className:l.CSS.B("orientation-control"),align:"center",justify:"center",size:.5,children:[n.jsxRuntimeExports.jsx(le,{selected:o==="top",onClick:r({outer:"top"})}),n.jsxRuntimeExports.jsxs(N.Space,{direction:"x",align:"center",justify:"center",size:.5,children:[n.jsxRuntimeExports.jsx(le,{selected:o==="left",onClick:r({outer:"left"})}),n.jsxRuntimeExports.jsxs(N.Space,{className:l.CSS.B("value"),direction:"y",align:"center",justify:"center",empty:!0,children:[n.jsxRuntimeExports.jsx(le,{className:l.CSS(l.CSS.dir("y")),selected:s==="top",onClick:r({inner:"top"})}),n.jsxRuntimeExports.jsxs(N.Space,{direction:"x",align:"center",justify:"center",children:[n.jsxRuntimeExports.jsx(le,{selected:s==="left",onClick:r({inner:"left"})}),n.jsxRuntimeExports.jsx(le,{selected:s==="right",onClick:r({inner:"right"})})]}),n.jsxRuntimeExports.jsx(le,{className:l.CSS(l.CSS.dir("y")),selected:s==="bottom",onClick:r({inner:"bottom"})})]}),n.jsxRuntimeExports.jsx(le,{selected:o==="right",onClick:r({outer:"right"})})]}),n.jsxRuntimeExports.jsx(le,{selected:o==="bottom",onClick:r({outer:"bottom"})})]})},le=({selected:e,className:t,...s})=>n.jsxRuntimeExports.jsx(a.Icon,{variant:"text",className:l.CSS(t,l.CSS.selected(e)),...s,children:n.jsxRuntimeExports.jsx("div",{className:"symbol"})}),Mt=[{tabKey:"style",name:"Style"},{tabKey:"control",name:"Control"}],oe=({className:e,direction:t,...s})=>n.jsxRuntimeExports.jsx(N.Space,{direction:t,align:"stretch",className:l.CSS(l.CSS.B("symbol-form"),e),size:t==="x"?"large":"medium",...s}),Ce=({value:e,onChange:t})=>{var s;return n.jsxRuntimeExports.jsx(H.Item,{label:"Orientation",children:n.jsxRuntimeExports.jsx(al,{value:{inner:e.orientation??"top",outer:((s=e.label)==null?void 0:s.orientation)??"top"},onChange:o=>t({orientation:o.inner,label:{...e.label,orientation:o.outer}})})})},ve=({value:{label:e},onChange:t})=>n.jsxRuntimeExports.jsxs(N.Space,{direction:"x",children:[n.jsxRuntimeExports.jsx(H.Item,{label:"Label",grow:!0,children:n.jsxRuntimeExports.jsx(a.Text$1,{value:(e==null?void 0:e.label)??"",onChange:s=>t({label:{...e,label:s}})})}),n.jsxRuntimeExports.jsx(H.Item,{label:"Label Size",children:n.jsxRuntimeExports.jsx(ne.SelectLevel,{value:(e==null?void 0:e.level)??"p",onChange:s=>t({label:{...e,level:s}})})})]}),Ne=({value:e,onChange:t})=>n.jsxRuntimeExports.jsx(H.Item,{label:"Color",align:"start",children:n.jsxRuntimeExports.jsx(pt.Swatch,{value:e.color??l.ZERO.setAlpha(1).rgba255,onChange:s=>t({color:s.rgba255})})}),Qs=({value:e,onChange:t})=>{var x,m;const s=f.sourcePipelinePropsZ.parse((x=e.source)==null?void 0:x.props),o=f.sinkPipelinePropsZ.parse((m=e.sink)==null?void 0:m.props),r=f.streamChannelValuePropsZ.parse(s.segments.valueStream.props),i=f.setChannelValuePropsZ.parse(o.segments.setter.props),c=p=>{p=p??0;const j=f.sourcePipeline("boolean",{connections:[{from:"valueStream",to:"threshold"}],segments:{valueStream:f.streamChannelValue({channel:p}),threshold:f.withinBounds({trueBound:{lower:.9,upper:1.1}})},outlet:"threshold"});t({...e,source:j})},u=p=>{p=p??0;const j=f.sinkPipeline("boolean",{connections:[{from:"setpoint",to:"setter"}],segments:{setter:f.setChannelValue({channel:p}),setpoint:f.setpoint({truthy:1,falsy:0})},inlet:"setpoint"}),h=f.authoritySource({channel:p}),g=f.acquireChannelControl({channel:p,authority:255});t({...e,sink:j,control:{...e.control,showChip:!0,chip:{sink:g,source:h},showIndicator:!0,indicator:{statusSource:h}}})};return n.jsxRuntimeExports.jsxs(oe,{direction:"y",children:[n.jsxRuntimeExports.jsx(H.Item,{label:"Input Channel",children:n.jsxRuntimeExports.jsx(ke,{value:r.channel,onChange:c})}),n.jsxRuntimeExports.jsx(H.Item,{label:"Output Channel",children:n.jsxRuntimeExports.jsx(ke,{value:i.channel,onChange:u})})]})},we=({value:e,onChange:t})=>{const s=d.useCallback(({tabKey:r})=>{switch(r){case"control":return n.jsxRuntimeExports.jsx(Qs,{value:e,onChange:t});default:return n.jsxRuntimeExports.jsxs(oe,{direction:"x",align:"stretch",children:[n.jsxRuntimeExports.jsxs(N.Space,{direction:"y",grow:!0,children:[n.jsxRuntimeExports.jsx(ve,{value:e,onChange:t}),n.jsxRuntimeExports.jsx(Ne,{value:e,onChange:t})]}),n.jsxRuntimeExports.jsx(Ce,{value:e,onChange:t})]})}},[e,t]),o=X.useStatic({tabs:Mt,content:s});return n.jsxRuntimeExports.jsx(X.Tabs,{...o})},ul=({value:e,onChange:t})=>{const s=d.useCallback(({tabKey:r})=>{switch(r){case"control":return n.jsxRuntimeExports.jsx(Qs,{value:e,onChange:t});default:return n.jsxRuntimeExports.jsxs(oe,{direction:"x",align:"stretch",children:[n.jsxRuntimeExports.jsxs(N.Space,{direction:"y",grow:!0,children:[n.jsxRuntimeExports.jsx(ve,{value:e,onChange:t}),n.jsxRuntimeExports.jsxs(N.Space,{direction:"x",children:[n.jsxRuntimeExports.jsx(Ne,{value:e,onChange:t}),n.jsxRuntimeExports.jsx(H.Item,{label:"Normally Open",children:n.jsxRuntimeExports.jsx(a.Switch$1,{value:e.normallyOpen??!1,onChange:i=>t({...e,normallyOpen:i})})})]})]}),n.jsxRuntimeExports.jsx(Ce,{value:e,onChange:t})]})}},[e,t]),o=X.useStatic({tabs:Mt,content:s});return n.jsxRuntimeExports.jsx(X.Tabs,{...o})},se=({value:e,onChange:t})=>n.jsxRuntimeExports.jsxs(oe,{direction:"x",children:[n.jsxRuntimeExports.jsxs(N.Space,{direction:"y",grow:!0,children:[n.jsxRuntimeExports.jsx(ve,{value:e,onChange:t}),n.jsxRuntimeExports.jsx(Ne,{value:e,onChange:t})]}),n.jsxRuntimeExports.jsx(Ce,{value:e,onChange:t})]}),Xt={y:2,x:.25},Kt={lower:0,upper:2e3},xl=({value:e,onChange:t})=>{var o,r;const s=i=>{t({...e,dimensions:{width:100,height:200,...e.dimensions,...i}})};return n.jsxRuntimeExports.jsxs(oe,{direction:"x",children:[n.jsxRuntimeExports.jsxs(N.Space,{direction:"y",children:[n.jsxRuntimeExports.jsx(ve,{value:e,onChange:t}),n.jsxRuntimeExports.jsxs(N.Space,{direction:"x",children:[n.jsxRuntimeExports.jsx(Ne,{value:e,onChange:t}),n.jsxRuntimeExports.jsx(H.Item,{label:"Width",children:n.jsxRuntimeExports.jsx(a.Numeric,{value:((o=e.dimensions)==null?void 0:o.width)??200,dragScale:Xt,bounds:Kt,onChange:i=>s({width:i})})}),n.jsxRuntimeExports.jsx(H.Item,{label:"Height",children:n.jsxRuntimeExports.jsx(a.Numeric,{value:((r=e.dimensions)==null?void 0:r.height)??200,dragScale:Xt,bounds:Kt,onChange:i=>s({height:i})})})]})]}),n.jsxRuntimeExports.jsx(Ce,{value:e,onChange:t})]})},dl=[{tabKey:"style",name:"Style"},{tabKey:"telemetry",name:"Telemetry"}],pl=({value:e,onChange:t})=>{var x;const s=f.sourcePipelinePropsZ.parse((x=e.telem)==null?void 0:x.props),o=f.streamChannelValuePropsZ.parse(s.segments.valueStream.props),r=f.stringifyNumberProps.parse(s.segments.stringifier.props),i=m=>{const p=f.sourcePipeline("string",{connections:[{from:"valueStream",to:"stringifier"}],segments:{valueStream:f.streamChannelValue({channel:m??0}),stringifier:f.stringifyNumber({precision:r.precision??2})},outlet:"stringifier"});t({...e,telem:p})},c=m=>{const p=f.sourcePipeline("string",{connections:[{from:"valueStream",to:"stringifier"}],segments:{valueStream:f.streamChannelValue({channel:o.channel}),stringifier:f.stringifyNumber({precision:m})},outlet:"stringifier"});t({...e,telem:p})},u=vt(o.channel);return d.useEffect(()=>{t({...e,tooltip:[u]})},[u]),n.jsxRuntimeExports.jsxs(oe,{direction:"y",children:[n.jsxRuntimeExports.jsx(H.Item,{label:"Input Channel",children:n.jsxRuntimeExports.jsx(ke,{value:o.channel,onChange:i})}),n.jsxRuntimeExports.jsx(H.Item,{label:"Percision",align:"start",children:n.jsxRuntimeExports.jsx(a.Numeric,{value:r.precision??2,bounds:{lower:0,upper:10},onChange:c})})]})},ml=({value:e,onChange:t})=>{const s=d.useCallback(({tabKey:r})=>{switch(r){case"telemetry":return n.jsxRuntimeExports.jsx(pl,{value:e,onChange:t});default:return n.jsxRuntimeExports.jsxs(oe,{direction:"x",children:[n.jsxRuntimeExports.jsxs(N.Space,{direction:"y",grow:!0,children:[n.jsxRuntimeExports.jsx(ve,{value:e,onChange:t}),n.jsxRuntimeExports.jsxs(N.Space,{direction:"x",children:[n.jsxRuntimeExports.jsx(Ne,{value:e,onChange:t}),n.jsxRuntimeExports.jsx(H.Item,{label:"Units",align:"start",children:n.jsxRuntimeExports.jsx(a.Text$1,{value:e.units??"",onChange:i=>t({...e,units:i})})})]})]}),n.jsxRuntimeExports.jsx(Ce,{value:e,onChange:t})]})}},[e,t]),o=X.useStatic({tabs:dl,content:s});return n.jsxRuntimeExports.jsx(X.Tabs,{...o})},jl=({value:e,onChange:t})=>{var i;const s=f.sinkPipelinePropsZ.parse((i=e.sink)==null?void 0:i.props),o=f.setChannelValuePropsZ.parse(s.segments.setter.props),r=c=>{const u=f.sinkPipeline("boolean",{connections:[{from:"setpoint",to:"setter"}],segments:{setter:f.setChannelValue({channel:c}),setpoint:f.setpoint({truthy:1,falsy:0})},inlet:"setpoint"}),x=f.authoritySource({channel:c}),m=f.acquireChannelControl({channel:c,authority:255});t({...e,sink:u,control:{...e.control,showChip:!0,chip:{sink:m,source:x},showIndicator:!0,indicator:{statusSource:x}}})};return n.jsxRuntimeExports.jsx(oe,{direction:"y",children:n.jsxRuntimeExports.jsx(H.Item,{label:"Output Channel",children:n.jsxRuntimeExports.jsx(ke,{value:o.channel,onChange:r})})})},fl=({value:e,onChange:t})=>{const s=d.useCallback(({tabKey:r})=>{switch(r){case"control":return n.jsxRuntimeExports.jsx(jl,{value:e,onChange:t});default:return n.jsxRuntimeExports.jsxs(oe,{direction:"x",align:"stretch",children:[n.jsxRuntimeExports.jsx(N.Space,{direction:"y",grow:!0,children:n.jsxRuntimeExports.jsx(ve,{value:e,onChange:t})}),n.jsxRuntimeExports.jsx(Ce,{value:e,onChange:t})]})}},[e,t]),o=X.useStatic({tabs:Mt,content:s});return n.jsxRuntimeExports.jsx(X.Tabs,{...o})},en=d.createContext({needsControlOf:[]}),tn=()=>d.useContext(en),hl=a.wrap$1(f.Controller$1.TYPE,({aetherKey:e,children:t,onStatusChange:s,...o})=>{const r=a.useMemoDeepEqualProps(o),[{path:i},{status:c,needsControlOf:u},x]=a.use$3({aetherKey:e,type:f.Controller$1.TYPE,schema:f.controllerStateZ,initialState:r});return d.useEffect(()=>{c!=null&&(s==null||s(c))},[c,s]),d.useEffect(()=>{x(m=>({...m,...r}))},[r,x]),d.useEffect(()=>()=>s==null?void 0:s("released"),[]),n.jsxRuntimeExports.jsxs(en.Provider,{value:{needsControlOf:u},children:[n.jsxRuntimeExports.jsx(a.Composite,{path:i,children:t}),";"]})}),sn=a.wrap$1(f.StateProvider.TYPE,({aetherKey:e,children:t})=>{const[{path:s}]=a.use$3({aetherKey:e,type:f.StateProvider.TYPE,schema:f.stateProviderStateZ,initialState:{}});return n.jsxRuntimeExports.jsx(a.Composite,{path:s,children:t})}),nn=a.wrap$1(f.Indicator.TYPE,({aetherKey:e,colorSource:t,statusSource:s})=>{var x;const o=a.useMemoDeepEqualProps({colorSource:t,statusSource:s}),[,{color:r,status:i},c]=a.use$3({aetherKey:e,type:f.Indicator.TYPE,initialState:{...o,status:{key:"no_chip",variant:"warning",message:"No chip connected.",time:l.TimeStamp.now()}},schema:f.indicatorStateZ});d.useEffect(()=>{c(m=>({...m,...o}))},[o,c]);let u;return((x=i.data)==null?void 0:x.color)!=null?u=l.Color.z.parse(i.data.color):r!=null&&!r.isZero?u=r:u="var(--pluto-gray-l8)",n.jsxRuntimeExports.jsxs(a.Dialog$1,{location:{x:"center",y:"right"},children:[n.jsxRuntimeExports.jsx(a.Text,{level:"p",children:i.message}),n.jsxRuntimeExports.jsx("div",{className:l.CSS.B("indicator"),style:{backgroundColor:l.cssString(u),flexGrow:1}})]})}),gl=e=>{var t,s;switch(e.variant){case"disabled":return((t=e.data)==null?void 0:t.valid)===!0?{message:"Uncontrolled. Click to take control.",chipColor:"var(--pluto-gray-l10)"}:{message:"No channel connected",chipColor:"var(--pluto-gray-l5)",disabled:!0};case"error":return{message:"Not controlled by you. Click to take absolute control.",chipColor:"var(--pluto-error-z)"};case"success":return((s=e.data)==null?void 0:s.authority)===G.v0.Authority.ABSOLUTE.valueOf()?{message:"You have absolute control. Click to release.",chipColor:"var(--pluto-secondary-z)",buttonStyle:{background:"var(--pluto-secondary-z-30)"}}:{message:"You're in control. Release P&ID to release control.",chipColor:"var(--pluto-primary-z)"};default:return{message:"Unexpected status.",chipColor:"var(--pluto-error-z)"}}},on=a.wrap$1("Chip",({aetherKey:e,source:t,sink:s,className:o,...r})=>{const i=a.useMemoDeepEqualProps({source:t,sink:s}),[,{status:c},u]=a.use$3({aetherKey:e,type:f.Chip.TYPE,schema:f.chipStateZ,initialState:{triggered:!1,...i,status:{key:"no_chip",variant:"disabled",message:"No chip connected.",time:l.TimeStamp.now()}}});d.useEffect(()=>{u(g=>({...g,...i}))},[i,u]);const x=d.useCallback(()=>u(g=>({...g,triggered:!g.triggered})),[u]),{message:m,chipColor:p,buttonStyle:j,disabled:h}=gl(c);return n.jsxRuntimeExports.jsx(a.Icon,{variant:"text",className:l.CSS(l.CSS.B("control-chip"),o),disabled:h,onClick:x,tooltip:n.jsxRuntimeExports.jsx(a.Text,{level:"small",children:m}),style:j,...r,children:n.jsxRuntimeExports.jsx(a.u0.Circle,{color:p})})}),El=a.wrap$1(f.Legend.TYPE,({aetherKey:e,...t})=>{const{needsControlOf:s}=tn(),[,{states:o},r]=a.use$3({aetherKey:e,type:f.Legend.TYPE,schema:f.legendStateZ,initialState:{states:[],needsControlOf:s}});d.useEffect(()=>{r(u=>({...u,needsControlOf:s}))},[s]);const c=l.unique(o.map(u=>u.subject.key)).map(u=>{const x=o.find(m=>m.subject.key===u);if(x==null)throw new G.Bn("Legend subject not found");return{key:x.subject.key,label:x.subject.name,color:x.subjectColor}});return n.jsxRuntimeExports.jsx(ss,{data:c,...t})}),Sl=Object.freeze(Object.defineProperty({__proto__:null,Chip:on,Controller:hl,Indicator:nn,Legend:El,StateProvider:sn,useContext:tn},Symbol.toStringTag,{value:"Module"})),Rl=({aetherKey:e,sink:t})=>{const s=a.useMemoDeepEqualProps({sink:t}),[,,o]=a.use$3({aetherKey:e,type:f.Button.TYPE,schema:f.buttonStateZ,initialState:{trigger:0,sink:t}});return d.useEffect(()=>{o(i=>({...i,...s}))},[s]),{click:d.useCallback(()=>{o(i=>({...i,trigger:i.trigger+1}))},[o])}},I=d.forwardRef(({label:e="",onChange:t,level:s="p",children:o,orientation:r="top",style:i,className:c,...u},x)=>n.jsxRuntimeExports.jsxs(N.Space,{style:{marginRight:r==="right"?1:0,marginTop:r==="top"?1:0,...i},size:2/3,direction:r,ref:x,className:l.CSS(l.CSS.B("symbol"),c),align:"center",justify:"center",...u,children:[e.length>0&&n.jsxRuntimeExports.jsx(a.Editable,{className:l.CSS.BE("symbol","label"),value:e,onChange:d.useCallback(m=>t({label:{label:m,level:s,orientation:r}}),[t,s]),level:s}),o]}));I.displayName="Labeled";const k=e=>n.jsxRuntimeExports.jsx("path",{vectorEffect:"non-scaling-stroke",...e}),bl=e=>n.jsxRuntimeExports.jsx("rect",{vectorEffect:"non-scaling-stroke",...e}),yl=e=>n.jsxRuntimeExports.jsx("circle",{vectorEffect:"non-scaling-stroke",...e}),dt=e=>n.jsxRuntimeExports.jsx("line",{vectorEffect:"non-scaling-stroke",...e}),Cl={left:{left:f.Position.Left,right:f.Position.Right,top:f.Position.Top,bottom:f.Position.Bottom},right:{left:f.Position.Right,right:f.Position.Left,top:f.Position.Bottom,bottom:f.Position.Top},top:{left:f.Position.Bottom,right:f.Position.Top,top:f.Position.Left,bottom:f.Position.Right},bottom:{left:f.Position.Top,right:f.Position.Bottom,top:f.Position.Right,bottom:f.Position.Left}},vl=(e,t)=>Cl[t][e],wl=(e,t,s)=>s==="left"?{top:e,left:t}:s==="right"?{top:100-e,left:100-t}:s==="top"?{top:100-t,left:e}:{top:t,left:100-e},Z=({children:e,orientation:t})=>{let s;try{s=f.useUpdateNodeInternals()}catch{return n.jsxRuntimeExports.jsx(n.jsxRuntimeExports.Fragment,{})}const o=d.useRef(null),r=d.useRef(!0);return d.useEffect(()=>{if(o.current==null)return;if(r.current){r.current=!1;return}const i=o.current.closest(".react-flow__node"),c=i==null?void 0:i.getAttribute("data-id");c!=null&&(s==null||s(c))},[t]),n.jsxRuntimeExports.jsx(n.jsxRuntimeExports.Fragment,{children:e})},T=({location:e,orientation:t,left:s,top:o,...r})=>{const i=wl(o,s,t);return n.jsxRuntimeExports.jsx(f.Handle$1,{position:vl(e,t),...r,type:"source",onClick:c=>c.stopPropagation(),className:(l.CSS.B("handle"),l.CSS.BE("handle",r.id)),style:{left:`${i.left}%`,top:`${i.top}%`}})},$e=({className:e,enabled:t=!1,triggered:s=!1,color:o,orientation:r="left",...i})=>n.jsxRuntimeExports.jsx("button",{className:l.CSS(l.CSS.B("symbol-primitive"),l.CSS.B("symbol-primitive-toggle"),r!=null&&l.CSS.loc(r),t&&l.CSS.M("enabled"),s&&l.CSS.M("triggered"),e),...i}),W=({className:e,orientation:t="left",...s})=>n.jsxRuntimeExports.jsx("div",{className:l.CSS(l.CSS.B("symbol-primitive"),e),...s}),$l=.8,Y=({dimensions:e,orientation:t="left",children:s,className:o,color:r,style:i={},scale:c=1,...u})=>{e=l.direction$1.construct(t)==="y"?l.dimensions.swap(e):e;const m=l.cssString(r);return r!=null&&(i[l.CSS.var("symbol-color")]=new l.Color(r).rgbString),n.jsxRuntimeExports.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:l.dimensions.svgViewBox(e),className:l.CSS(l.CSS.loc(t),o),fill:m,stroke:m,...u,style:{aspectRatio:`${e.width} / ${e.height}`,width:l.dimensions.scale(e,c*$l).width,...i},children:n.jsxRuntimeExports.jsx("g",{children:s})})},rn=({className:e,orientation:t,scale:s,color:o,...r})=>n.jsxRuntimeExports.jsxs($e,{...r,orientation:t,className:l.CSS(l.CSS.B("four-way-valve"),e),children:[n.jsxRuntimeExports.jsxs(Z,{orientation:t,children:[n.jsxRuntimeExports.jsx(T,{location:"left",orientation:"left",left:0,top:50,id:"1"}),n.jsxRuntimeExports.jsx(T,{location:"right",orientation:"left",left:100,top:50,id:"2"}),n.jsxRuntimeExports.jsx(T,{location:"top",orientation:"left",left:50,top:0,id:"3"}),n.jsxRuntimeExports.jsx(T,{location:"bottom",orientation:"left",left:50,top:100,id:"4"})]}),n.jsxRuntimeExports.jsxs(Y,{dimensions:{width:87,height:87},color:o,scale:s,children:[n.jsxRuntimeExports.jsx(k,{d:"M43.5 43.5L6.35453 24.7035C4.35901 23.6937 2 25.1438 2 27.3803V59.6197C2 61.8562 4.35901 63.3063 6.35453 62.2965L43.5 43.5ZM43.5 43.5L80.6455 24.7035C82.641 23.6937 85 25.1438 85 27.3803V59.6197C85 61.8562 82.641 63.3063 80.6455 62.2965L43.5 43.5Z"}),n.jsxRuntimeExports.jsx(k,{d:"M43.5 43.5L24.7035 80.6455C23.6937 82.641 25.1438 85 27.3803 85H59.6197C61.8562 85 63.3063 82.641 62.2965 80.6455L43.5 43.5ZM43.5 43.5L24.7035 6.35453C23.6937 4.35901 25.1438 2 27.3803 2H59.6197C61.8562 2 63.3063 4.35901 62.2965 6.35453L43.5 43.5Z"})]})]}),ln=({color:e,orientation:t="left",scale:s,...o})=>n.jsxRuntimeExports.jsxs($e,{...o,className:l.CSS(l.CSS.B("three-way-valve")),orientation:t,children:[n.jsxRuntimeExports.jsxs(Z,{orientation:t,children:[n.jsxRuntimeExports.jsx(T,{location:"bottom",orientation:t,left:50,top:100,id:"1"}),n.jsxRuntimeExports.jsx(T,{location:"left",orientation:t,left:0,top:33,id:"2"}),n.jsxRuntimeExports.jsx(T,{location:"right",orientation:t,left:100,top:33,id:"3"})]}),n.jsxRuntimeExports.jsxs(Y,{dimensions:{width:87,height:64},color:e,orientation:t,scale:s,children:[n.jsxRuntimeExports.jsx(k,{d:"M43.5 21L6.35453 2.20349C4.35901 1.19372 2 2.64384 2 4.88029V37.1197C2 39.3562 4.35901 40.8063 6.35453 39.7965L43.5 21ZM43.5 21L80.6455 2.20349C82.641 1.19372 85 2.64384 85 4.8803V37.1197C85 39.3562 82.641 40.8063 80.6455 39.7965L43.5 21Z"}),n.jsxRuntimeExports.jsx(k,{d:"M44.3923 22.3611C44.0222 21.6298 42.9778 21.6298 42.6077 22.3611L24.7035 57.7433C23.6937 59.7388 25.1438 62.0978 27.3803 62.0978L59.6197 62.0978C61.8562 62.0978 63.3063 59.7388 62.2965 57.7433L44.3923 22.3611Z"})]})]}),cn=({orientation:e="left",color:t,scale:s,...o})=>n.jsxRuntimeExports.jsxs($e,{...o,children:[n.jsxRuntimeExports.jsxs(Z,{orientation:e,children:[n.jsxRuntimeExports.jsx(T,{location:"left",orientation:e,left:0,top:50,id:"1"}),n.jsxRuntimeExports.jsx(T,{location:"right",orientation:e,left:100,top:50,id:"2"})]}),n.jsxRuntimeExports.jsx(Y,{dimensions:{width:87,height:42},color:t,orientation:e,scale:s,children:n.jsxRuntimeExports.jsx(k,{d:"M43.5 21L6.35453 2.20349C4.35901 1.19372 2 2.64384 2 4.88029V37.1197C2 39.3562 4.35901 40.8063 6.35453 39.7965L43.5 21ZM43.5 21L80.6455 2.20349C82.641 1.19372 85 2.64384 85 4.8803V37.1197C85 39.3562 82.641 40.8063 80.6455 39.7965L43.5 21Z"})})]}),an=({className:e,color:t,orientation:s="left",normallyOpen:o=!1,scale:r,...i})=>n.jsxRuntimeExports.jsxs($e,{className:l.CSS(l.CSS.B("solenoid-valve"),o&&l.CSS.M("normally-open"),e),...i,children:[n.jsxRuntimeExports.jsxs(Z,{orientation:s,children:[n.jsxRuntimeExports.jsx(T,{location:"left",orientation:s,left:1,top:69,id:"1"}),n.jsxRuntimeExports.jsx(T,{location:"right",orientation:s,left:99,top:69,id:"2"})]}),n.jsxRuntimeExports.jsxs(Y,{dimensions:{width:87,height:69},color:t,orientation:s,scale:r,children:[n.jsxRuntimeExports.jsx(k,{className:l.CSS.B("body"),d:"M43.5 48L6.35453 29.2035C4.35901 28.1937 2 29.6438 2 31.8803V64.1197C2 66.3562 4.35901 67.8063 6.35453 66.7965L43.5 48ZM43.5 48L80.6455 29.2035C82.641 28.1937 85 29.6438 85 31.8803V64.1197C85 66.3562 82.641 67.8063 80.6455 66.7965L43.5 48Z"}),n.jsxRuntimeExports.jsx(k,{d:"M43.5 47L43.5 24.6177"}),n.jsxRuntimeExports.jsx(bl,{x:"29",y:"2",width:"29",height:"22.5333",rx:"1"})]})]}),un=({className:e,orientation:t="left",color:s,scale:o,...r})=>n.jsxRuntimeExports.jsxs(W,{orientation:t,className:l.CSS(l.CSS.B("relief-valve"),e),...r,children:[n.jsxRuntimeExports.jsxs(Z,{orientation:t,children:[n.jsxRuntimeExports.jsx(T,{location:"left",orientation:t,left:1,top:66,id:"1"}),n.jsxRuntimeExports.jsx(T,{location:"right",orientation:t,left:99,top:66,id:"2"})]}),n.jsxRuntimeExports.jsxs(Y,{dimensions:{width:87,height:58},color:s,orientation:t,scale:o,children:[n.jsxRuntimeExports.jsx(k,{d:"M43.5 37L6.35453 18.2035C4.35901 17.1937 2 18.6438 2 20.8803V53.1197C2 55.3562 4.35901 56.8063 6.35453 55.7965L43.5 37ZM43.5 37L80.6455 18.2035C82.641 17.1937 85 18.6438 85 20.8803V53.1197C85 55.3562 82.641 56.8063 80.6455 55.7965L43.5 37Z"}),n.jsxRuntimeExports.jsx(k,{d:"M43.5 2L43.5 38",strokeLinecap:"round"}),n.jsxRuntimeExports.jsx(k,{d:"M31.8011 14.0802L55.1773 4.29611",strokeLinecap:"round"}),n.jsxRuntimeExports.jsx(k,{d:"M31.8011 20.0802L55.1773 10.2961",strokeLinecap:"round"}),n.jsxRuntimeExports.jsx(k,{d:"M31.8011 26.0802L55.1773 16.2961",strokeLinecap:"round"})]})]}),xn=({className:e,orientation:t="left",color:s,scale:o,...r})=>n.jsxRuntimeExports.jsxs(W,{orientation:t,className:l.CSS(l.CSS.B("check-valve"),e),...r,children:[n.jsxRuntimeExports.jsxs(Z,{orientation:t,children:[n.jsxRuntimeExports.jsx(T,{location:"left",orientation:t,left:1,top:50,id:"1"}),n.jsxRuntimeExports.jsx(T,{location:"right",orientation:t,left:99,top:50,id:"2"})]}),n.jsxRuntimeExports.jsxs(Y,{dimensions:{width:45,height:43},color:s,orientation:t,scale:o,children:[n.jsxRuntimeExports.jsx(k,{d:"M43 2L43 40",strokeLinecap:"round"}),n.jsxRuntimeExports.jsx(k,{d:"M41.6607 21.8946C42.3917 21.5238 42.3906 20.4794 41.6589 20.1101L6.25889 2.2412C4.26237 1.23341 1.90481 2.68589 1.90704 4.92235L1.93925 37.1617C1.94148 39.3982 4.30194 40.846 6.29644 39.8342L41.6607 21.8946Z"})]})]}),dn=({color:e,className:t,orientation:s="left",scale:o,...r})=>n.jsxRuntimeExports.jsxs($e,{...r,orientation:s,className:l.CSS(l.CSS.B("angled-valve"),t),children:[n.jsxRuntimeExports.jsxs(Z,{orientation:s,children:[n.jsxRuntimeExports.jsx(T,{location:"bottom",orientation:s,left:33,top:100,id:"1"}),n.jsxRuntimeExports.jsx(T,{location:"right",orientation:s,left:100,top:35,id:"2"})]}),n.jsxRuntimeExports.jsxs(Y,{dimensions:{width:64,height:64},color:e,orientation:s,scale:o,children:[n.jsxRuntimeExports.jsx(k,{d:"M22.3611 20.1077C21.6298 20.4778 21.6298 21.5222 22.3611 21.8923L57.7433 39.7965C59.7388 40.8063 62.0978 39.3562 62.0978 37.1197L62.0978 4.88029C62.0978 2.64384 59.7388 1.19372 57.7433 2.2035L22.3611 20.1077Z"}),n.jsxRuntimeExports.jsx(k,{d:"M21.8923 22.3611C21.5222 21.6298 20.4778 21.6298 20.1077 22.3611L2.20349 57.7433C1.19372 59.7388 2.64384 62.0978 4.8803 62.0978L37.1197 62.0978C39.3562 62.0978 40.8063 59.7388 39.7965 57.7433L21.8923 22.3611Z"}),n.jsxRuntimeExports.jsx(k,{d:"M24.3461 18.5709L21.7484 19.88C20.9998 20.2572 20.3887 20.8601 20.0012 21.6035L19.3383 22.8756"})]})]}),pn=({color:e,className:t,orientation:s="left",scale:o,...r})=>n.jsxRuntimeExports.jsxs($e,{...r,className:l.CSS(l.CSS.B("pump"),t),orientation:s,children:[n.jsxRuntimeExports.jsxs(Z,{orientation:s,children:[n.jsxRuntimeExports.jsx(T,{location:"left",orientation:s,left:1,top:39,id:"1"}),n.jsxRuntimeExports.jsx(T,{location:"right",orientation:s,left:95,top:3,id:"2"})]}),n.jsxRuntimeExports.jsxs(Y,{dimensions:{width:68,height:61},color:e,orientation:s,scale:o,children:[n.jsxRuntimeExports.jsx(yl,{cx:"35",cy:"25",r:"23"}),n.jsxRuntimeExports.jsx(k,{d:"M50 41.5L56.7186 50.8314C57.6711 52.1544 56.7257 54 55.0955 54H14.9045C13.2743 54 12.3289 52.1544 13.2814 50.8314L20 41.5"}),n.jsxRuntimeExports.jsx(dt,{x1:"35",y1:"2",x2:"65.0167",y2:"2"}),n.jsxRuntimeExports.jsx(dt,{x1:"1",y1:"24",x2:"35",y2:"24"})]})]}),mn=({className:e,color:t,orientation:s="left",scale:o,...r})=>{const i=l.cssString(t);return n.jsxRuntimeExports.jsxs(W,{...r,className:l.CSS(l.CSS.B("symbol"),e),children:[n.jsxRuntimeExports.jsx(Z,{orientation:s,children:n.jsxRuntimeExports.jsx(T,{location:"left",orientation:s,left:2,top:50,id:"1"})}),n.jsxRuntimeExports.jsxs(Y,{dimensions:{width:40,height:48},color:t,orientation:s,scale:o,children:[n.jsxRuntimeExports.jsx(k,{d:"M24 24C24 35.1852 15.2546 44.4725 3.87626 45.8297C2.90571 45.9455 2 45.1407 2 44V4C2 2.85926 2.90571 2.0545 3.87626 2.17027C15.2546 3.52755 24 12.8148 24 24Z"}),n.jsxRuntimeExports.jsx(k,{d:"M37.9706 23.2076C38.4906 23.6079 38.4906 24.3921 37.9706 24.7924L33.86 27.9568C33.2024 28.463 32.25 27.9942 32.25 27.1644V20.8356C32.25 20.0058 33.2024 19.537 33.86 20.0432L37.9706 23.2076Z",fill:i}),n.jsxRuntimeExports.jsx(k,{d:"M33 24H3",strokeLinecap:"round"})]})]})},jn=({className:e,orientation:t="left",color:s,scale:o,...r})=>n.jsxRuntimeExports.jsxs(W,{className:l.CSS(l.CSS.B("cap"),e),...r,children:[n.jsxRuntimeExports.jsx(Z,{orientation:t,children:n.jsxRuntimeExports.jsx(T,{location:"left",orientation:t,left:0,top:50,id:"1"})}),n.jsxRuntimeExports.jsx(Y,{color:s,dimensions:{width:26,height:48},orientation:t,scale:o,children:n.jsxRuntimeExports.jsx(k,{d:"M24 24C24 35.1852 15.2546 44.4725 3.87626 45.8297C2.90571 45.9455 2 45.1407 2 44V4C2 2.85926 2.90571 2.0545 3.87626 2.17027C15.2546 3.52755 24 12.8148 24 24Z"})})]}),fn=({className:e,orientation:t="left",color:s,scale:o,...r})=>n.jsxRuntimeExports.jsxs(W,{className:l.CSS(l.CSS.B("manual-valve"),e),...r,children:[n.jsxRuntimeExports.jsxs(Z,{orientation:t,children:[n.jsxRuntimeExports.jsx(T,{location:"left",orientation:t,left:1,top:58,id:"1"}),n.jsxRuntimeExports.jsx(T,{location:"right",orientation:t,left:99,top:58,id:"2"})]}),n.jsxRuntimeExports.jsxs(Y,{dimensions:{width:87,height:48},color:s,orientation:t,scale:o,children:[n.jsxRuntimeExports.jsx(dt,{x1:"43.5",y1:"27",x2:"43.5",y2:"1"}),n.jsxRuntimeExports.jsx(k,{d:"M19.64 2L66.68 2",strokeLinecap:"round"}),n.jsxRuntimeExports.jsx(k,{d:"M43.5 27L6.35453 8.20349C4.35901 7.19372 2 8.64384 2 10.8803V43.1197C2 45.3562 4.35901 46.8063 6.35453 45.7965L43.5 27ZM43.5 27L80.6455 8.20349C82.641 7.19372 85 8.64384 85 10.8803V43.1197C85 45.3562 82.641 46.8063 80.6455 45.7965L43.5 27Z"})]})]}),hn=({className:e,orientation:t="left",color:s,scale:o,...r})=>n.jsxRuntimeExports.jsxs(W,{className:l.CSS(l.CSS.B("filter"),e),...r,children:[n.jsxRuntimeExports.jsxs(Z,{orientation:t,children:[n.jsxRuntimeExports.jsx(T,{location:"left",orientation:t,left:2,top:50,id:"1"}),n.jsxRuntimeExports.jsx(T,{location:"right",orientation:t,left:98,top:50,id:"2"})]}),n.jsxRuntimeExports.jsx(Y,{dimensions:{width:52,height:34},orientation:t,color:s,scale:o,children:n.jsxRuntimeExports.jsx(k,{d:"M6 17L24.8 2.9C25.5111 2.36667 26.4889 2.36667 27.2 2.9L46 17M6 17L24.8 31.1C25.5111 31.6333 26.4889 31.6333 27.2 31.1L46 17M6 17H1M46 17H51"})})]}),Tl=e=>typeof e=="number"?{topLeft:l.xy.construct(e),topRight:l.xy.construct(e),bottomLeft:l.xy.construct(e),bottomRight:l.xy.construct(e)}:"x"in e?{topLeft:e,topRight:e,bottomLeft:e,bottomRight:e}:typeof e.bottomLeft=="number"?{topLeft:l.xy.construct(e.topLeft),topRight:l.xy.construct(e.topRight),bottomLeft:l.xy.construct(e.bottomLeft),bottomRight:l.xy.construct(e.bottomRight)}:e,Pl=e=>{const{topLeft:t,topRight:s,bottomLeft:o,bottomRight:r}=e;return`${t.x}% ${s.x}% ${r.x}% ${o.x}% / ${t.y}% ${s.y}% ${r.y}% ${o.y}%`},kl={width:40,height:80},Ll={x:50,y:10},gn=({className:e,dimensions:t=kl,borderRadius:s=Ll,color:o,onResize:r,...i})=>{const c=Tl(s),u=a.use();return n.jsxRuntimeExports.jsx(W,{className:l.CSS(e,l.CSS.B("tank")),style:{...t,borderRadius:Pl(c),borderColor:l.cssString(o??u.colors.gray.l9)},...i,children:n.jsxRuntimeExports.jsxs(Z,{children:[n.jsxRuntimeExports.jsx(T,{location:"top",orientation:"left",left:50,top:0,id:"1"}),n.jsxRuntimeExports.jsx(T,{location:"top",orientation:"left",left:-.5,top:c.topLeft.y-1,id:"2"}),n.jsxRuntimeExports.jsx(T,{location:"top",orientation:"left",left:101,top:c.topRight.y-1,id:"3"}),n.jsxRuntimeExports.jsx(T,{location:"bottom",orientation:"left",left:50,top:100,id:"4"}),n.jsxRuntimeExports.jsx(T,{location:"bottom",orientation:"left",left:-.5,top:100-c.bottomLeft.y+1,id:"5"}),n.jsxRuntimeExports.jsx(T,{location:"bottom",orientation:"left",left:101,top:100-c.bottomRight.y+1,id:"6"}),n.jsxRuntimeExports.jsx(T,{location:"left",orientation:"left",left:-.5,top:50,id:"7"}),n.jsxRuntimeExports.jsx(T,{location:"right",orientation:"left",left:101,top:50,id:"8"})]})})},En=({className:e,orientation:t="left",color:s,scale:o,...r})=>n.jsxRuntimeExports.jsxs(W,{className:l.CSS(e,l.CSS.B("regulator")),...r,children:[n.jsxRuntimeExports.jsxs(Z,{orientation:t,children:[n.jsxRuntimeExports.jsx(T,{location:"left",orientation:t,left:0,top:66,id:"1"}),n.jsxRuntimeExports.jsx(T,{location:"right",orientation:t,left:100,top:66,id:"2"})]}),n.jsxRuntimeExports.jsxs(Y,{dimensions:{width:84,height:58},orientation:t,color:s,scale:o,children:[n.jsxRuntimeExports.jsx(k,{d:"M42 36.5L5.41845 16.8709C3.41989 15.7985 1 17.2463 1 19.5144V53.4856C1 55.7537 3.4199 57.2015 5.41846 56.1291L42 36.5ZM42 36.5L78.5815 16.8709C80.5801 15.7985 83 17.2463 83 19.5144V53.4856C83 55.7537 80.5801 57.2015 78.5815 56.1291L42 36.5Z"}),n.jsxRuntimeExports.jsx(k,{d:"M40 1.5H27.1522C24.8526 1.5 23.4081 3.9809 24.5432 5.98082L41.1303 35.2058C41.6373 36.099 43 35.7392 43 34.7122V4.5C43 2.84315 41.6569 1.5 40 1.5Z"})]})]}),Sn=({className:e,orientation:t="left",scale:s,color:o,...r})=>n.jsxRuntimeExports.jsxs(W,{className:l.CSS(l.CSS.B("orifice"),e),...r,children:[n.jsxRuntimeExports.jsxs(Z,{orientation:t,children:[n.jsxRuntimeExports.jsx(T,{location:"left",orientation:t,left:0,top:50,id:"1"}),n.jsxRuntimeExports.jsx(T,{location:"right",orientation:t,left:100,top:50,id:"2"})]}),n.jsxRuntimeExports.jsxs(Y,{dimensions:{width:70,height:34},orientation:t,color:o,scale:s,children:[n.jsxRuntimeExports.jsx(k,{d:"M2 2.5C27.451 21.3469 60.0915 12.0132 68 2.5",strokeLinecap:"round"}),n.jsxRuntimeExports.jsx(k,{d:"M2 32.5C27.451 13.6531 60.0915 22.9868 68 32.5",strokeLinecap:"round"})]})]}),Rn=({className:e,orientation:t="left",color:s,scale:o,...r})=>n.jsxRuntimeExports.jsxs(W,{className:l.CSS(l.CSS.B("needle-valve"),e),...r,children:[n.jsxRuntimeExports.jsxs(Z,{orientation:t,children:[n.jsxRuntimeExports.jsx(T,{location:"left",orientation:t,left:1,top:50,id:"1"}),n.jsxRuntimeExports.jsx(T,{location:"right",orientation:t,left:99,top:50,id:"2"})]}),n.jsxRuntimeExports.jsxs(Y,{dimensions:{width:87,height:42},orientation:t,color:s,scale:o,children:[n.jsxRuntimeExports.jsx(k,{d:"M43.0152 21.5391L38.237 2.62245C38.1573 2.30658 38.396 2 38.7218 2L48.2782 2C48.604 2 48.8427 2.30658 48.763 2.62245L43.9848 21.5391C43.8576 22.0425 43.1424 22.0425 43.0152 21.5391Z",fill:l.cssString(s)}),n.jsxRuntimeExports.jsx(k,{d:"M43.5 21.5L6.35453 2.70349C4.35901 1.69372 2 3.14384 2 5.38029V37.6197C2 39.8562 4.35901 41.3063 6.35453 40.2965L43.5 21.5ZM43.5 21.5L80.6455 2.70349C82.641 1.69372 85 3.14384 85 5.3803V37.6197C85 39.8562 82.641 41.3063 80.6455 40.2965L43.5 21.5Z"})]})]}),bn=({className:e,orientation:t="left",color:s,scale:o,...r})=>n.jsxRuntimeExports.jsxs(W,{orientation:t,className:l.CSS(l.CSS.B("angled-relief-valve"),e),...r,children:[n.jsxRuntimeExports.jsxs(Z,{children:[n.jsxRuntimeExports.jsx(T,{location:"bottom",orientation:t,left:33,top:100,id:"1"}),n.jsxRuntimeExports.jsx(T,{location:"right",orientation:t,left:100,top:45,id:"2"})]}),n.jsxRuntimeExports.jsxs(Y,{dimensions:{width:64,height:79},orientation:t,color:s,scale:o,children:[n.jsxRuntimeExports.jsx(k,{d:"M20.75 2L20.75 38",strokeLinecap:"round"}),n.jsxRuntimeExports.jsx(k,{d:"M9.05106 14.0802L32.4273 4.29611",strokeLinecap:"round"}),n.jsxRuntimeExports.jsx(k,{d:"M9.05106 20.0802L32.4273 10.2961",strokeLinecap:"round"}),n.jsxRuntimeExports.jsx(k,{d:"M9.05106 26.0802L32.4273 16.2961",strokeLinecap:"round"}),n.jsxRuntimeExports.jsx(k,{d:"M22.3611 35.1077C21.6298 35.4778 21.6298 36.5222 22.3611 36.8923L57.7433 54.7965C59.7388 55.8063 62.0978 54.3562 62.0978 52.1197L62.0978 19.8803C62.0978 17.6438 59.7388 16.1937 57.7433 17.2035L22.3611 35.1077Z"}),n.jsxRuntimeExports.jsx(k,{d:"M21.8923 37.3611C21.5222 36.6298 20.4778 36.6298 20.1077 37.3611L2.20349 72.7433C1.19372 74.7388 2.64384 77.0978 4.8803 77.0978H37.1197C39.3562 77.0978 40.8063 74.7388 39.7965 72.7433L21.8923 37.3611Z"}),n.jsxRuntimeExports.jsx(k,{d:"M24.3461 33.5709L21.7484 34.88C20.9998 35.2572 20.3887 35.8601 20.0012 36.6035L19.3383 37.8756"})]})]}),yn=({className:e,color:t,dimensions:s,orientation:o,units:r="psi",children:i,...c})=>{const u=l.cssString(t),x=a.use();let m="var(--pluto-gray-l0)";return t!=null&&(m=l.cssString(new l.Color(t).pickByContrast(x.colors.gray.l0,x.colors.gray.l9))),n.jsxRuntimeExports.jsxs(W,{className:l.CSS(l.CSS.B("value"),e),...c,style:{borderColor:u,height:s==null?void 0:s.height,width:"100%"},children:[n.jsxRuntimeExports.jsx("div",{className:l.CSS.BE("value","content"),style:{flexGrow:1,minWidth:s==null?void 0:s.width,inlineSize:80},children:i}),n.jsxRuntimeExports.jsxs(Z,{orientation:o,children:[n.jsxRuntimeExports.jsx(T,{location:"left",orientation:"left",left:-2,top:50,id:"1"}),n.jsxRuntimeExports.jsx(T,{location:"right",orientation:"left",left:102,top:50,id:"2"}),n.jsxRuntimeExports.jsx(T,{location:"top",orientation:"left",left:50,top:-2,id:"3"}),n.jsxRuntimeExports.jsx(T,{location:"bottom",orientation:"left",left:50,top:102,id:"4"})]}),n.jsxRuntimeExports.jsx("div",{className:l.CSS.BE("value","units"),style:{background:u},children:n.jsxRuntimeExports.jsx(a.Text,{level:"small",color:m,children:r})})]})},Cn=({triggered:e,enabled:t=!1,color:s,onClick:o,orientation:r="left"})=>n.jsxRuntimeExports.jsxs(W,{orientation:r,children:[n.jsxRuntimeExports.jsx(a.Switch$1,{value:t,onClick:o,onChange:()=>{}}),n.jsxRuntimeExports.jsxs(Z,{orientation:r,children:[n.jsxRuntimeExports.jsx(T,{location:"left",orientation:r,left:0,top:50,id:"1"}),n.jsxRuntimeExports.jsx(T,{location:"right",orientation:r,left:100,top:50,id:"2"})]})]}),vn=({onClick:e,orientation:t="left",label:s=""})=>n.jsxRuntimeExports.jsxs(W,{orientation:t,children:[n.jsxRuntimeExports.jsx(a.Button,{onClick:e,children:s}),n.jsxRuntimeExports.jsxs(Z,{orientation:t,children:[n.jsxRuntimeExports.jsx(T,{location:"left",orientation:t,left:0,top:50,id:"1"}),n.jsxRuntimeExports.jsx(T,{location:"right",orientation:t,left:100,top:50,id:"2"}),n.jsxRuntimeExports.jsx(T,{location:"top",orientation:t,left:50,top:0,id:"3"}),n.jsxRuntimeExports.jsx(T,{location:"bottom",orientation:t,left:50,top:100,id:"4"})]})]}),je=({aetherKey:e,source:t,sink:s})=>{const o=a.useMemoDeepEqualProps({source:t,sink:s}),[,{triggered:r,enabled:i},c]=a.use$3({aetherKey:e,type:f.Toggle.TYPE,schema:f.toggleStateZ,initialState:{triggered:!1,enabled:!1,...o}});return d.useEffect(()=>{c(x=>({...x,...o}))},[o,c]),{toggle:d.useCallback(()=>c(x=>({...x,triggered:!x.triggered})),[c]),triggered:r,enabled:i}},wn=e=>l.direction$1.construct(e)==="x"?l.location.swap(e):e,Ml=e=>l.direction$1.construct(e)==="y"?l.location.swap(e):e,ce=({showChip:e=!0,showIndicator:t=!0,indicator:s,orientation:o="left",chip:r,children:i,...c})=>n.jsxRuntimeExports.jsxs(N.Space,{direction:l.location.rotate90(o),align:"center",justify:"center",empty:!0,...c,children:[n.jsxRuntimeExports.jsxs(N.Space,{direction:l.direction$1.construct(o),align:"center",className:l.CSS(l.CSS.B("control-state")),size:"small",children:[e&&n.jsxRuntimeExports.jsx(on,{size:"small",...r}),t&&n.jsxRuntimeExports.jsx(nn,{...s})]}),i]}),Nl=a.wrap$1("ThreeWayValve",({aetherKey:e,label:t,onChange:s,control:o,source:r,sink:i,orientation:c="left",color:u})=>{const{enabled:x,triggered:m,toggle:p}=je({aetherKey:e,source:r,sink:i});return n.jsxRuntimeExports.jsx(I,{...t,onChange:s,children:n.jsxRuntimeExports.jsx(ce,{...o,orientation:wn(c),children:n.jsxRuntimeExports.jsx(ln,{enabled:x,triggered:m,onClick:p,orientation:c,color:u})})})}),_l=e=>n.jsxRuntimeExports.jsx(ln,{...e}),Bl=a.wrap$1("Valve",({control:e,aetherKey:t,label:s,onChange:o,source:r,sink:i,orientation:c,color:u})=>{const{enabled:x,triggered:m,toggle:p}=je({aetherKey:t,source:r,sink:i});return n.jsxRuntimeExports.jsx(I,{...s,onChange:o,children:n.jsxRuntimeExports.jsx(ce,{...e,orientation:c,children:n.jsxRuntimeExports.jsx(cn,{enabled:x,triggered:m,onClick:p,orientation:c,color:u})})})}),Dl=e=>n.jsxRuntimeExports.jsx(cn,{...e}),zl=a.wrap$1("SolenoidValve",({aetherKey:e,label:t,onChange:s,orientation:o="left",normallyOpen:r,color:i,source:c,sink:u,control:x})=>{const{enabled:m,triggered:p,toggle:j}=je({aetherKey:e,source:c,sink:u});return n.jsxRuntimeExports.jsx(I,{...t,onChange:s,children:n.jsxRuntimeExports.jsx(ce,{...x,orientation:Ml(o),children:n.jsxRuntimeExports.jsx(an,{enabled:m,triggered:p,onClick:j,orientation:o,color:i,normallyOpen:r})})})}),Ol=e=>n.jsxRuntimeExports.jsx(an,{...e}),Vl=a.wrap$1("FourWayValve",({aetherKey:e,control:t,label:s,onChange:o,orientation:r,color:i,source:c,sink:u})=>{const{enabled:x,triggered:m,toggle:p}=je({aetherKey:e,source:c,sink:u});return n.jsxRuntimeExports.jsx(I,{...s,onChange:o,children:n.jsxRuntimeExports.jsx(ce,{...t,orientation:r,children:n.jsxRuntimeExports.jsx(rn,{enabled:x,triggered:m,onClick:p,orientation:r,color:i})})})}),Al=e=>n.jsxRuntimeExports.jsx(rn,{...e}),Il=a.wrap$1("AngleValve",({aetherKey:e,label:t,control:s,onChange:o,orientation:r="left",color:i,source:c,sink:u})=>{const{enabled:x,triggered:m,toggle:p}=je({aetherKey:e,source:c,sink:u});return n.jsxRuntimeExports.jsx(I,{...t,onChange:o,children:n.jsxRuntimeExports.jsx(ce,{...s,orientation:wn(r),children:n.jsxRuntimeExports.jsx(dn,{enabled:x,triggered:m,onClick:p,orientation:r,color:i})})})}),Zl=e=>n.jsxRuntimeExports.jsx(dn,{...e}),Fl=a.wrap$1("Pump",({aetherKey:e,label:t,control:s,onChange:o,orientation:r,color:i,source:c,sink:u})=>{const{enabled:x,triggered:m,toggle:p}=je({aetherKey:e,source:c,sink:u});return n.jsxRuntimeExports.jsx(I,{...t,onChange:o,children:n.jsxRuntimeExports.jsx(ce,{...s,orientation:r,children:n.jsxRuntimeExports.jsx(pn,{enabled:x,triggered:m,onClick:p,orientation:r,color:i})})})}),Yl=e=>n.jsxRuntimeExports.jsx(pn,{...e}),Gl=a.wrap$1("Tank",({label:e,onChange:t,orientation:s,color:o,dimensions:r,borderRadius:i})=>n.jsxRuntimeExports.jsx(I,{...e,onChange:t,children:n.jsxRuntimeExports.jsx(gn,{onResize:c=>t({dimensions:c}),orientation:s,color:o,dimensions:r,borderRadius:i})})),Hl=e=>n.jsxRuntimeExports.jsx(gn,{...e,dimensions:{width:25,height:50}}),ql=({label:e,onChange:t,orientation:s,color:o})=>n.jsxRuntimeExports.jsx(I,{...e,onChange:t,children:n.jsxRuntimeExports.jsx(un,{orientation:s,color:o})}),Ul=e=>n.jsxRuntimeExports.jsx(un,{...e}),Wl=({label:e,onChange:t,orientation:s,color:o})=>n.jsxRuntimeExports.jsx(I,{...e,onChange:t,children:n.jsxRuntimeExports.jsx(En,{orientation:s,color:o})}),Xl=e=>n.jsxRuntimeExports.jsx(En,{...e}),Kl=({label:e,onChange:t,orientation:s,color:o})=>n.jsxRuntimeExports.jsx(I,{...e,onChange:t,children:n.jsxRuntimeExports.jsx(mn,{orientation:s,color:o})}),Jl=e=>n.jsxRuntimeExports.jsx(mn,{...e}),Ql=({label:e,onChange:t,orientation:s,color:o})=>n.jsxRuntimeExports.jsx(I,{...e,onChange:t,children:n.jsxRuntimeExports.jsx(jn,{orientation:s,color:o})}),ei=e=>n.jsxRuntimeExports.jsx(jn,{...e}),ti=({label:e,onChange:t,orientation:s,color:o})=>n.jsxRuntimeExports.jsx(I,{...e,onChange:t,children:n.jsxRuntimeExports.jsx(fn,{orientation:s,color:o})}),si=e=>n.jsxRuntimeExports.jsx(fn,{...e}),ni=({label:e,onChange:t,orientation:s,color:o})=>n.jsxRuntimeExports.jsx(I,{...e,onChange:t,children:n.jsxRuntimeExports.jsx(hn,{orientation:s,color:o})}),oi=e=>n.jsxRuntimeExports.jsx(hn,{...e}),ri=({label:e,onChange:t,orientation:s,color:o})=>n.jsxRuntimeExports.jsx(I,{...e,onChange:t,children:n.jsxRuntimeExports.jsx(Rn,{orientation:s,color:o})}),li=e=>n.jsxRuntimeExports.jsx(Rn,{...e}),ii=({label:e,onChange:t,orientation:s,color:o})=>n.jsxRuntimeExports.jsx(I,{...e,onChange:t,children:n.jsxRuntimeExports.jsx(xn,{orientation:s,color:o})}),ci=e=>n.jsxRuntimeExports.jsx(xn,{...e}),ai=({label:e,onChange:t,orientation:s,color:o})=>n.jsxRuntimeExports.jsx(I,{...e,onChange:t,children:n.jsxRuntimeExports.jsx(Sn,{orientation:s,color:o})}),ui=e=>n.jsxRuntimeExports.jsx(Sn,{...e}),xi=({label:e,onChange:t,orientation:s,color:o})=>n.jsxRuntimeExports.jsx(I,{...e,onChange:t,children:n.jsxRuntimeExports.jsx(bn,{orientation:s,color:o})}),di=e=>n.jsxRuntimeExports.jsx(bn,{...e}),pi=a.wrap$1("Value",({aetherKey:e,label:t,level:s="p",position:o,className:r,textColor:i,color:c,telem:u,units:x,onChange:m,tooltip:p})=>{const j=a.useTypography(s),[h,g]=d.useState({outerBox:l.box$1.ZERO,labelBox:l.box$1.ZERO}),E=(j.lineHeight+.5)*j.baseSize+2,b=a.useResize(C=>{const R=document.querySelector(`.react-flow__node[data-id="${e}"] .pluto-symbol__label`);let w={...l.box$1.ZERO};R!=null&&(w=l.box$1.construct(R),w=l.box$1.resize(w,{width:l.box$1.width(w),height:l.box$1.height(w)})),g({outerBox:C,labelBox:w})},{}),S=f.useViewport().zoom,y=ji({labelOrientation:(t==null?void 0:t.orientation)??"top",zoom:S,valueBoxHeight:E,position:o,...h}),{width:v}=Js({aetherKey:e,color:i,level:s,box:y,telem:u,minWidth:60});return n.jsxRuntimeExports.jsxs(a.Dialog$1,{location:{y:"top"},hide:p==null||p.length===0,children:[n.jsxRuntimeExports.jsx(N.Space,{direction:"y",children:p==null?void 0:p.map((C,R)=>n.jsxRuntimeExports.jsx(a.Text,{level:"small",children:C},R))}),n.jsxRuntimeExports.jsx(I,{className:l.CSS(r,l.CSS.B("value-labeled")),ref:b,onChange:m,...t,children:n.jsxRuntimeExports.jsx(yn,{color:c,dimensions:{height:E,width:v},units:x})})]})}),mi=.9,ji=({labelOrientation:e,zoom:t,outerBox:s,labelBox:o,valueBoxHeight:r,position:i})=>{const c=l.xy.scale(l.box$1.dims(o),1/(mi*t));return l.direction$1.construct(e)==="x"&&(i=l.xy.translateY(i,Math.max((c.y-r)/2-1,0))),e==="left"&&(i=l.xy.translateX(i,c.x+4)),e==="top"&&(i=l.xy.translateY(i,c.y+4)),l.box$1.construct(i.x,i.y,l.box$1.width(s),r)},fi=({color:e})=>n.jsxRuntimeExports.jsx(yn,{color:e,dimensions:{width:60,height:25},units:"psi",children:n.jsxRuntimeExports.jsx(a.Text,{level:"p",children:"50.00"})}),hi=a.wrap$1("Switch",({aetherKey:e,label:t,control:s,onChange:o,orientation:r,color:i,source:c,sink:u})=>{const{enabled:x,triggered:m,toggle:p}=je({aetherKey:e,source:c,sink:u});return n.jsxRuntimeExports.jsx(I,{...t,onChange:o,children:n.jsxRuntimeExports.jsx(ce,{...s,orientation:r,children:n.jsxRuntimeExports.jsx(Cn,{enabled:x,triggered:m,onClick:p,orientation:r,color:i})})})}),gi=e=>n.jsxRuntimeExports.jsx(Cn,{...e}),Ei=a.wrap$1("Button",({aetherKey:e,label:t,orientation:s,sink:o,control:r})=>{const{click:i}=Rl({aetherKey:e,sink:o});return n.jsxRuntimeExports.jsx(ce,{...r,className:l.CSS.B("symbol"),orientation:s,children:n.jsxRuntimeExports.jsx(vn,{label:t==null?void 0:t.label,onClick:i})})}),Si=({label:e,...t})=>n.jsxRuntimeExports.jsx(vn,{label:"Button",...t}),F=4,Ri=2,bi=["threeWayValve","valve","solenoidValve","fourWayValve","angledValve","pump","tank","reliefValve","regulator","burstDisc","cap","manualValve","filter","needleValve","checkValve","orifice","angledReliefValve","value","button","switch"];Zn.z.enum(bi);const fe={source:f.sourcePipeline("boolean",{connections:[{from:"valueStream",to:"threshold"}],segments:{valueStream:f.streamChannelValue({channel:0}),threshold:f.withinBounds({trueBound:{lower:.9,upper:1.1}})},outlet:"threshold"}),sink:f.sinkPipeline("boolean",{connections:[{from:"setpoint",to:"setter"}],segments:{setter:f.setChannelValue({channel:0}),setpoint:f.setpoint({truthy:1,falsy:0})},inlet:"setpoint"})},yi={name:"Three Way Valve",variant:"threeWayValve",Form:we,Symbol:Nl,defaultProps:e=>({color:e.colors.gray.l9.rgba255,label:{label:"Three Way Valve",level:"p",orientation:"top"},...fe,orientation:"left"}),Preview:_l,zIndex:F},Ci={name:"Valve",variant:"valve",Form:we,Symbol:Bl,defaultProps:e=>({color:e.colors.gray.l9.rgba255,label:{label:"Valve",level:"p",orientation:"top"},orientation:"left",...fe}),Preview:Dl,zIndex:F},vi={name:"Solenoid Valve",variant:"solenoidValve",Form:ul,Symbol:zl,defaultProps:e=>({color:e.colors.gray.l9.rgba255,label:{label:"Solenoid Valve",level:"p",orientation:"top"},orientation:"left",...fe}),Preview:Ol,zIndex:F},wi={name:"Four Way Valve",variant:"fourWayValve",Form:we,Symbol:Vl,defaultProps:e=>({color:e.colors.gray.l9.rgba255,label:{label:"Four Way Valve",level:"p",orientation:"top"},orientation:"left",...fe}),Preview:Al,zIndex:F},$i={name:"Angled Valve",variant:"angledValve",Form:we,Symbol:Il,defaultProps:e=>({color:e.colors.gray.l9.rgba255,label:{label:"Angled Valve",level:"p",orientation:"top"},orientation:"left",...fe}),Preview:Zl,zIndex:F},Ti={name:"Pump",variant:"pump",Form:we,Symbol:Fl,defaultProps:e=>({color:e.colors.gray.l9.rgba255,label:{label:"Pump",level:"p",orientation:"top"},orientation:"left",...fe}),Preview:Yl,zIndex:F},Pi={name:"Tank",variant:"tank",Form:xl,Symbol:Gl,defaultProps:e=>({color:e.colors.gray.l9.rgba255,label:{label:"Tank",level:"p",orientation:"top"},dimensions:{width:100,height:200},orientation:"left"}),Preview:Hl,zIndex:Ri},ki={name:"Relief Valve",variant:"reliefValve",Form:se,Symbol:ql,defaultProps:e=>({color:e.colors.gray.l9.rgba255,label:{label:"Relief Valve",level:"p",orientation:"top"},orientation:"left"}),Preview:Ul,zIndex:F},Li={name:"Regulator",variant:"regulator",Form:se,Symbol:Wl,defaultProps:e=>({color:e.colors.gray.l9.rgba255,label:{label:"Regulator",level:"p",orientation:"top"},orientation:"left"}),Preview:Xl,zIndex:F},Mi={name:"Burst Disc",variant:"burstDisc",Form:se,Symbol:Kl,defaultProps:e=>({color:e.colors.gray.l9.rgba255,label:{label:"Burst Disc",level:"p",orientation:"top"},orientation:"left"}),Preview:Jl,zIndex:F},Ni={name:"Cap",variant:"cap",Form:se,Symbol:Ql,defaultProps:e=>({color:e.colors.gray.l9.rgba255,label:{label:"Cap",level:"p",orientation:"top"},orientation:"left"}),Preview:ei,zIndex:F},_i={name:"Manual Valve",variant:"manualValve",Form:se,Symbol:ti,defaultProps:e=>({color:e.colors.gray.l9.rgba255,label:{label:"Manual Valve",level:"p",orientation:"top"},orientation:"left"}),Preview:si,zIndex:F},Bi={name:"Filter",variant:"filter",Form:se,Symbol:ni,defaultProps:e=>({color:e.colors.gray.l9.rgba255,label:{label:"Filter",level:"p",orientation:"top"},orientation:"left"}),Preview:oi,zIndex:F},Di={name:"Needle Valve",variant:"needleValve",Form:se,Symbol:ri,defaultProps:e=>({color:e.colors.gray.l9.rgba255,label:{label:"Needle Valve",level:"p"},orientation:"left"}),Preview:li,zIndex:F},zi={name:"Check Valve",variant:"checkValve",Form:se,Symbol:ii,defaultProps:e=>({color:e.colors.gray.l9.rgba255,label:{label:"Check Valve",level:"p",orientation:"top"},orientation:"left"}),Preview:ci,zIndex:F},Oi={name:"Orifice",variant:"orifice",Form:se,Symbol:ai,defaultProps:e=>({color:e.colors.gray.l9.rgba255,label:{label:"Orifice",level:"p",orientation:"top"},orientation:"left"}),Preview:ui,zIndex:F},Vi={name:"Angled Relief Valve",variant:"angledReliefValve",Form:se,Symbol:xi,defaultProps:e=>({color:e.colors.gray.l9.rgba255,label:{label:"Angled Relief Valve",level:"p",orientation:"top"},orientation:"left"}),Preview:di,zIndex:F},Ai={name:"Value",variant:"value",Form:ml,Symbol:pi,Preview:fi,defaultProps:e=>({color:e.colors.gray.l9.rgba255,level:"h5",label:{label:"Value",level:"p",orientation:"top"},orientation:"left",telem:f.sourcePipeline("string",{connections:[{from:"valueStream",to:"stringifier"}],segments:{valueStream:f.streamChannelValue({channel:0}),stringifier:f.stringifyNumber({precision:2})},outlet:"stringifier"})}),zIndex:F},Ii={name:"Button",variant:"button",Symbol:Ei,Form:fl,Preview:Si,defaultProps:e=>({label:{label:"Button",level:"p",orientation:"top"},orientation:"left",sink:f.sinkPipeline("boolean",{connections:[{from:"setpoint",to:"setter"}],segments:{setter:f.setChannelValue({channel:0}),setpoint:f.setpoint({truthy:1,falsy:0})},inlet:"setpoint"})}),zIndex:F},Zi={name:"Switch",variant:"switch",Symbol:hi,Preview:gi,Form:we,defaultProps:e=>({label:{label:"Switch",level:"p",orientation:"top"},orientation:"left",...fe}),zIndex:F},Fi={value:Ai,threeWayValve:yi,valve:Ci,solenoidValve:vi,fourWayValve:wi,angledValve:$i,pump:Ti,tank:Pi,reliefValve:ki,regulator:Li,burstDisc:Mi,cap:Ni,manualValve:_i,filter:Bi,needleValve:Di,checkValve:zi,orifice:Oi,angledReliefValve:Vi,button:Ii,switch:Zi},Yi=Object.freeze(Object.defineProperty({__proto__:null,SYMBOLS:Fi},Symbol.toStringTag,{value:"Module"}));d.createContext({instrumentation:G.C.NOOP});const Gi=a.wrap$1(f.Provider$1.TYPE,({aetherKey:e,children:t,...s})=>{const o=a.useMemoDeepEqualProps(s),[{path:r},,i]=a.use$3({aetherKey:e,type:f.Provider$1.TYPE,schema:f.providerStateZ,initialState:o});return d.useEffect(()=>{i(o)},[o,i]),n.jsxRuntimeExports.jsx(a.Composite,{path:r,children:t})}),Hi="data:video/mp2t;base64,Ly8gQ29weXJpZ2h0IDIwMjMgU3lubmF4IExhYnMsIEluYy4KLy8KLy8gVXNlIG9mIHRoaXMgc29mdHdhcmUgaXMgZ292ZXJuZWQgYnkgdGhlIEJ1c2luZXNzIFNvdXJjZSBMaWNlbnNlIGluY2x1ZGVkIGluIHRoZSBmaWxlCi8vIGxpY2Vuc2VzL0JTTC50eHQuCi8vCi8vIEFzIG9mIHRoZSBDaGFuZ2UgRGF0ZSBzcGVjaWZpZWQgaW4gdGhhdCBmaWxlLCBpbiBhY2NvcmRhbmNlIHdpdGggdGhlIEJ1c2luZXNzIFNvdXJjZQovLyBMaWNlbnNlLCB1c2Ugb2YgdGhpcyBzb2Z0d2FyZSB3aWxsIGJlIGdvdmVybmVkIGJ5IHRoZSBBcGFjaGUgTGljZW5zZSwgVmVyc2lvbiAyLjAsCi8vIGluY2x1ZGVkIGluIHRoZSBmaWxlIGxpY2Vuc2VzL0FQTC50eHQuCgppbXBvcnQgeyBwbHV0byB9IGZyb20gIkAvcGx1dG8vYWV0aGVyIjsKCnBsdXRvLnJlbmRlcigpOwo=",$n=a.wrap$1(f.BaseProvider.TYPE,({children:e,aetherKey:t})=>{const[{path:s}]=a.use$3({aetherKey:t,type:f.BaseProvider.TYPE,schema:f.providerStateZ$1,initialState:{}});return n.jsxRuntimeExports.jsx(a.Composite,{path:s,children:e})}),qi=Object.freeze(Object.defineProperty({__proto__:null,Provider:$n},Symbol.toStringTag,{value:"Module"})),Ui=({children:e,connParams:t,workerEnabled:s=!0,workerURL:o,theme:r,toggleTheme:i,setTheme:c,tooltip:u,triggers:x,alamos:m,haul:p,channelAlias:j})=>n.jsxRuntimeExports.jsx(a.Provider$1,{...x,children:n.jsxRuntimeExports.jsx(a.Config,{...u,children:n.jsxRuntimeExports.jsx(a.Provider$2,{...p,children:n.jsxRuntimeExports.jsx(a.Provider$3,{url:o??Hi,enabled:s,children:n.jsxRuntimeExports.jsx(a.Provider$4,{workerKey:"vis",children:n.jsxRuntimeExports.jsx(Gi,{...m,children:n.jsxRuntimeExports.jsx(a.Aggregator,{children:n.jsxRuntimeExports.jsx(Cs,{connParams:t,children:n.jsxRuntimeExports.jsx($s,{...j,children:n.jsxRuntimeExports.jsx($n,{children:n.jsxRuntimeExports.jsx(a.Provider,{theme:r,toggleTheme:i,setTheme:c,children:n.jsxRuntimeExports.jsx(sn,{children:e})})})})})})})})})})})}),Wi=Object.freeze(Object.defineProperty({__proto__:null,Provider:Ui},Symbol.toStringTag,{value:"Module"})),Xi=({timeRange:e})=>{const t=new l.TimeStamp(e.start),s=t.isToday?"time":"dateTime",o=new l.TimeStamp(e.end),r=o.equals(l.TimeStamp.MAX),i=o.span(t)<l.TimeSpan.DAY?"time":"dateTime";return n.jsxRuntimeExports.jsxs(N.Space,{direction:"x",size:"small",className:l.CSS(l.CSS.B("time-range-chip")),align:"center",children:[t.isToday&&n.jsxRuntimeExports.jsx(a.Text,{level:"p",shade:7,weight:450,children:"Today"}),n.jsxRuntimeExports.jsx(a.DateTime,{level:"p",displayTZ:"local",format:s,shade:7,weight:450,children:t}),n.jsxRuntimeExports.jsx(a.u0.Arrow.Right,{color:"var(--pluto-text-color)"}),r?n.jsxRuntimeExports.jsx(a.Text,{level:"p",children:"Now"}):n.jsxRuntimeExports.jsx(a.DateTime,{level:"p",displayTZ:"local",format:i,shade:7,weight:450,children:o})]})},Ki=[{key:"color",name:"Color",width:50,render:e=>n.jsxRuntimeExports.jsx(a.u0.Circle,{style:{fontSize:10,marginLeft:10,marginRight:30},color:e.entry.color})},{key:"name",name:"Name"}],Ji=e=>{const t=Le();return n.jsxRuntimeExports.jsx(Rt,{...e,searcher:t==null?void 0:t.labels,columns:Ki,renderTag:s=>s.entry==null?n.jsxRuntimeExports.jsx(Ze,{color:"gray",children:s.entryKey}):n.jsxRuntimeExports.jsx(Ze,{color:s.entry.color,children:s.entry.name})})},Qi=Object.freeze(Object.defineProperty({__proto__:null,SelectLabels:Ji,TimeRangeChip:Xi},Symbol.toStringTag,{value:"Module"})),ec=({value:e})=>n.jsxRuntimeExports.jsx("div",{className:l.CSS.B("progress"),children:n.jsxRuntimeExports.jsx("div",{className:l.CSS.B("progress-bar"),style:{width:`${e}%`}})}),tc=Object.freeze(Object.defineProperty({__proto__:null,Progress:ec},Symbol.toStringTag,{value:"Module"})),Tn=({path:e,allowNull:t=!1})=>{const{bind:s,get:o,set:r}=_e(),[i,c]=d.useState(o(e,t));if(d.useLayoutEffect(()=>(c(o(e,t)),s(e,c,!1)),[e,s,c]),i==null&&!t)throw new Error("Field state is null");return{onChange:d.useCallback(u=>r(e,u),[e,r]),...i}},sc=(e,t)=>{const s=_e();d.useLayoutEffect(()=>s.bind(e,o=>t(o,s),!1),[e,s])},nc=({path:e,allowNull:t=!1})=>{const{bind:s,get:o}=_e(),[r,i]=d.useState(o(e,t));if(d.useLayoutEffect(()=>(i(o(e,t)),s(e,c=>i({...c,value:l.shallowCopy(c.value)}),!0)),[e,s,o]),r==null&&!t)throw new Error("Field state is null");return(r==null?void 0:r.value)??null},oc=({path:e,updateOnChildren:t=!1})=>{const{bind:s,get:o,set:r}=_e(),[i,c]=d.useState(o(e,!1).value);d.useLayoutEffect(()=>(c(o(e,!1).value),s(e,m=>c(l.shallowCopy(m.value)),t)),[e,s,o,c]);const u=d.useCallback(m=>{const p=l.shallowCopy(o(e,!1).value);p.push(...l.toArray(m)),r(e,p)},[e,o,r]),x=d.useCallback(m=>{const p=l.shallowCopy(o(e,!1).value);l.toArray(m).sort((h,g)=>g-h).forEach(h=>p.splice(h,1)),r(e,p)},[e,i,o]);return{value:i,push:u,remove:x}},rc=a.componentRenderProp(a.Text$1),lc=({path:e,children:t=rc,label:s,padHelpText:o=!0,visible:r=!0,...i})=>{const c=Tn({path:e});if(e==null||e.length===0)throw new Error("Path is required");if(s==null&&(s=l.Case.capitalize(l.external.element(e,-1))),r=typeof r=="function"?r(c):r,!r)return null;const u=c.touched?c.status.message:"";return n.jsxRuntimeExports.jsx(H.Item,{padHelpText:o,helpText:u,label:s,...i,children:t(c)})},Nt=d.createContext({bind:()=>()=>{},set:()=>{},get:()=>({value:void 0,status:{key:"",variant:"success",message:""},touched:!1}),validate:()=>!1,value:()=>({}),has:()=>!1}),_e=()=>d.useContext(Nt),ic=e=>({key:e,variant:"success",message:""}),cc=({initialValues:e,schema:t})=>{const s=d.useRef({state:e,status:new Map,touched:new Set,listeners:new Map,parentListeners:new Map}),o=a.useSyncedRef(t),r=d.useCallback((m,p,j)=>{var b;const{parentListeners:h,listeners:g}=s.current,E=j?h:g;return E.has(m)||E.set(m,new Set),(b=E.get(m))==null||b.add(p),()=>{var S;return(S=E.get(m))==null?void 0:S.delete(p)}},[]),i=d.useCallback((m,p)=>{const{state:j,status:h,touched:g}=s.current,E=l.external.get(j,m,p);return E==null?null:{value:E,status:h.get(m)??ic(m),touched:g.has(m)}},[]),c=d.useCallback(m=>{const{state:p,status:j,listeners:h}=s.current;console.log(p);const g=o.current.safeParse(p);if(console.log(g.success),g.success){const b=Array.from(j.keys());return j.clear(),b.forEach(S=>{var v;const y=i(S,!0);y!=null&&((v=h.get(S))==null||v.forEach(C=>C(y)))}),!0}const E=new Set(g.error.issues.map(b=>b.path.join(".")));return g.error.issues.forEach(b=>{var v;const S=b.path.join(".");j.set(S,{key:S,variant:"error",message:b.message});const y=i(S,!1);(v=h.get(S))==null||v.forEach(C=>C(y))}),j.forEach((b,S)=>{var y;if(!E.has(S)){j.delete(S);const v=i(S,!1);(y=h.get(S))==null||y.forEach(C=>C(v))}}),!1},[]),u=d.useCallback((m,p)=>{var b;const{state:j,touched:h,listeners:g,parentListeners:E}=s.current;h.add(m),l.external.set(j,m,p),c(),(b=g.get(m))==null||b.forEach(S=>S(i(m,!1))),E.forEach((S,y)=>{m.startsWith(y)&&S.forEach(v=>v(i(y,!1)))})},[]),x=d.useCallback(m=>{const{state:p}=s.current;return l.external.has(p,m)},[]);return d.useMemo(()=>({bind:r,set:u,get:i,validate:c,value:()=>s.current.state,has:x}),[r,u,i,c])},ac=e=>n.jsxRuntimeExports.jsx(Nt.Provider,{value:e,children:e.children}),uc=Object.freeze(Object.defineProperty({__proto__:null,Context:Nt,Field:lc,Form:ac,use:cc,useChildFieldValues:nc,useContext:_e,useField:Tn,useFieldArray:oc,useFieldListener:sc},Symbol.toStringTag,{value:"Module"}));exports.Aether=a.main;exports.Divider=a.Divider$1;exports.Dropdown=a.Dropdown;exports.Haul=a.Haul;exports.Worker=a.Context$1;exports.compareArrayDeps=a.compareArrayDeps;exports.componentRenderProp=a.componentRenderProp;exports.isRenderProp=a.isRenderProp;exports.useAsyncEffect=a.useAsyncEffect;exports.useClickOutside=a.useClickOutside;exports.useCombinedRefs=a.useCombinedRefs;exports.useCombinedStateAndRef=a.useCombinedStateAndRef;exports.useDebouncedCallback=a.useDebouncedCallback;exports.useEffectCompare=a.useEffectCompare;exports.useMemoCompare=a.useMemoCompare;exports.useMemoDeepEqualProps=a.useMemoDeepEqualProps;exports.usePrevious=a.usePrevious;exports.useResize=a.useResize;exports.useStateRef=a.useStateRef;exports.useSyncedRef=a.useSyncedRef;exports.useTransforms=a.useTransforms;exports.CSS=l.CSS;exports.newBEM=l.newBEM;exports.Header=ze.external;exports.Generic=N.Generic;exports.state=G.state;exports.telem=f.external;exports.Color=pt.external;exports.Triggers=mt.external;exports.Text=ne.external;exports.List=Re.external;exports.createFilterTransform=Re.createFilterTransform;exports.fuseFilter=Re.fuseFilter;exports.proxyMemo=Re.proxyMemo;exports.Align=Dn.external;exports.Button=zn.external;exports.createHexOpacityVariants=Jt.createHexOpacityVariants;exports.unitProperty=Jt.unitProperty;exports.Input=H.external;exports.Menu=On.external;exports.Tabs=X.external;exports.Theming=Vn.external;exports.Tree=An.external;exports.Video=In.Video;exports.Accordion=ro;exports.Canvas=ao;exports.Channel=Uo;exports.Control=Sl;exports.Diagram=Wr;exports.Eraser=lr;exports.Form=uc;exports.Line=xo;exports.LinePlot=Mo;exports.Measure=Bo;exports.Mosaic=or;exports.Nav=ur;exports.OS=jr;exports.PID=Yi;exports.Pluto=Wi;exports.Progress=tc;exports.Ranger=Qi;exports.Resize=Kn;exports.Rule=Do;exports.Select=$o;exports.Status=Yn;exports.Synnax=Go;exports.Table=sl;exports.TableCell=ll;exports.Tag=go;exports.Telem=qi;exports.Tooltip=Gn;exports.Value=cl;exports.Viewport=Lo;
|
|
1
|
+
"use strict";var Nn=Object.defineProperty;var _n=(e,t,s)=>t in e?Nn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var ue=(e,t,s)=>(_n(e,typeof t!="symbol"?t+"":t,s),s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./jsx-runtime-evvPGacs.cjs"),d=require("react"),a=require("./Toggle-qW_TcIDh.cjs"),l=require("./css-JWFtNl10.cjs"),ze=require("./external-UezDJS5P.cjs"),N=require("./Center-Q-fgAb96.cjs"),G=require("./aggregator-6_J8kSSO.cjs"),f=require("./table-aFLsOP3H.cjs"),pt=require("./external-6DXc9G-d.cjs"),mt=require("./external-er-l9iZA.cjs");require("react-hook-form");const ne=require("./external-n4UdyJ7i.cjs"),Bn=require("react-dom"),Re=require("./external-y6ws_3c6.cjs"),Dn=require("./external-XAgspAbl.cjs"),zn=require("./external-vjJtYX9R.cjs"),Jt=require("./color-1ICp12GL.cjs"),H=require("./external-RsG62zSr.cjs"),On=require("./external-KoFBpSsV.cjs"),X=require("./external-dFd3d4ZY.cjs"),Vn=require("./external-A4JYxI--.cjs"),An=require("./external-Mc8M8Xzl.cjs"),In=require("./Video-EPTOwGIB.cjs"),Zn=require("zod"),Fn=({variant:e,...t})=>n.jsxRuntimeExports.jsx(a.u0.Circle,{color:a.variantColors[e],...t}),Yn=Object.freeze(Object.defineProperty({__proto__:null,Aggregator:a.Aggregator,Circle:Fn,Text:a.Text$2,VARIANTS:G.VARIANTS,specZ:G.specZ$1,useAggregator:a.useAggregator,useContext:a.useContext$2,useNotifications:a.useNotifications,variantZ:G.variantZ},Symbol.toStringTag,{value:"Module"})),Gn=Object.freeze(Object.defineProperty({__proto__:null,Config:a.Config,Context:a.Context,Dialog:a.Dialog$1,chooseLocation:a.chooseLocation,formatTip:a.formatTip,useConfig:a.useConfig,wrap:a.wrap},Symbol.toStringTag,{value:"Module"})),Ie=e=>e.preventDefault(),We=d.forwardRef(({location:e,style:t,size:s,className:o,children:r,onDragStart:i,sizeUnits:c="px",showHandle:u=!0,...x},m)=>{const p=l.location.construct(e),j=l.location.direction(p),h=l.direction$1.dimension(j);return n.jsxRuntimeExports.jsxs("div",{className:l.CSS(l.CSS.B("resize"),l.CSS.loc(p),l.CSS.dir(j),o),style:{[h]:`${s}${c}`,...t},ref:m,...x,children:[r,u&&n.jsxRuntimeExports.jsx("div",{draggable:!0,className:l.CSS(l.CSS.BE("resize","handle"),l.CSS.bordered(l.location.swap(p))),onDragStart:i,onDrag:Ie,onDragEnd:Ie})]})});We.displayName="Resize.Core";const jt=({onResize:e,count:t,initialSizes:s=[],minSize:o=100,direction:r="x"})=>{const i=d.useRef(null),[c,u]=d.useState({sizeDistribution:Hn(s,t),root:null}),x=d.useCallback((j,h,g)=>{if(i.current==null)return;const E=l.box$1.dim(l.box$1.construct(i.current),r);u(b=>st(b,E,j,o,h,g))},[o,u,r]);d.useEffect(()=>e==null?void 0:e(c.sizeDistribution),[c.sizeDistribution,e]);const m=d.useCallback((j,h)=>{j.preventDefault();const g=r==="x"?"clientX":"clientY",E=S=>x(h,S[g]),b=()=>{u(S=>({...S,root:null})),document.removeEventListener("mousemove",E)};u(S=>({...S,root:j[g]})),document.addEventListener("mousemove",E),document.addEventListener("mouseup",b,{once:!0})},[u,r,st]);return{setSize:d.useCallback((j,h)=>x(j,void 0,h),[st]),props:{direction:r,sizeDistribution:c.sizeDistribution,onDragHandle:m,ref:i}}},Xe=d.forwardRef(({direction:e="x",children:t,sizeDistribution:s,onDragHandle:o,className:r,...i},c)=>{const u=l.direction$1.construct(e),x=d.Children.toArray(t);return n.jsxRuntimeExports.jsx(N.Space,{...i,ref:c,direction:u,className:l.CSS(l.CSS.B("resize-multiple"),r),empty:!0,grow:!0,children:x.map((m,p)=>n.jsxRuntimeExports.jsx(We,{onDragStart:j=>o(j,p),location:l.direction$1.location(u),size:s[p]*100,sizeUnits:"%",showHandle:p!==x.length-1,children:m},p))})});Xe.displayName="Resize.Multiple";const Hn=(e,t)=>{const s=e.reduce((r,i)=>r+i,0),o=t-e.length;if(o<=0)return e.slice(0,t).map(r=>r/s);if(e.every(r=>r<=1)){const r=1-s;return[...e,...Array(o).fill(r/o)]}return e.map(()=>1/t)},st=(e,t,s,o,r,i)=>{const c=Qt(e,t,s,r,i),[u,x]=Un(e.sizeDistribution,s,c,o/t),m=x?r??null:e.root;return{...e,sizeDistribution:u,root:m}},Qt=(e,t,s,o,r)=>{let i;if(r!=null)r>1&&(r=r/t),i=r-e.sizeDistribution[s];else if(o!=null){if(e.root===null)throw new Error("resize root is null during handle drag");i=(o-e.root)/t}else throw new Error("must provide either a MouseEvent or a targetSize");return i},Un=(e,t,s,o)=>{let r=t;for(;r>0&&e[r]+s<=o;)r--;const i=e[r]+s,c=qn(r,e,o,s),u=e[c]-s;return i<o||u<o?[e,!1]:[e.map((x,m)=>m===r?i:m===c?u:x),!0]},qn=(e,t,s,o)=>(e===t.length-1?Xn:Wn)(e,t,s,o),Wn=(e,t,s,o)=>{let r=e+1;for(;r<t.length-1&&t[r]-o<=s;)r++;return r},Xn=(e,t,s,o)=>{let r=e-1;for(;r>0&&t[r]-o<=s;)r--;return r},Ke=({onMove:e,onStart:t,onEnd:s})=>d.useCallback(o=>{o.preventDefault();const r=l.xy.construct(o),i=a.mouseKey(o.button);t==null||t(r,i,o);const c=x=>{if(x.buttons===0)return u(x);const m=l.xy.construct(x);e==null||e(l.box$1.construct(r,m),i,x)};window.addEventListener("mousemove",c);const u=x=>{window.removeEventListener("mousemove",c);const m=l.xy.construct(x);s==null||s(l.box$1.construct(r,m),i,x)};window.addEventListener("mouseup",u,{once:!0})},[e,t,s]),nt=2,es=({onCollapse:e,onResize:t,location:s="left",minSize:o=100,maxSize:r=1/0,initialSize:i=200,collapseThreshold:c=1/0,className:u,...x})=>{const[m,p]=d.useState(l.clamp(i,o,r)),j=d.useRef(null),h=l.location.construct(s),g=d.useCallback(C=>{if(j.current===null)return 0;const R=l.box$1.dim(C,l.location.direction(h),!0)*(1-2*Number(["bottom","right"].includes(h))),w=j.current+R,$=l.clamp(w,o,r);return($-w)/o>c?nt:$},[h,o,r,c]),E=d.useRef(null),b=d.useCallback(C=>{const R=g(C);p(R),E.current!=null&&(t==null||t(R,l.box$1.construct(E.current)))},[t,g]),S=d.useCallback(()=>p(C=>(j.current=C,C)),[p]),y=d.useCallback(C=>g(C)===nt&&(e==null?void 0:e()),[e,g]);d.useEffect(()=>p(C=>{const R=l.clamp(C,o,r);return j.current=R,R}),[o,r]);const v=Ke({onMove:b,onStart:S,onEnd:y});return n.jsxRuntimeExports.jsx(We,{ref:E,location:h,size:m,onDragStart:v,className:l.clsx(u,l.CSS.expanded(m!==nt)),...x})},Kn=Object.freeze(Object.defineProperty({__proto__:null,Core:We,Multiple:Xe,Single:es,calculateDiffPercentage:Qt,useMultiple:jt},Symbol.toStringTag,{value:"Module"})),Oe="y",_t=28,Jn=32,Qn=40,eo=.5,to=({data:e,...t})=>{const{setSize:s,props:{sizeDistribution:o,ref:r,...i}}=jt({direction:Oe,count:e.length,minSize:_t}),c=u=>{if(r.current==null)return;const x=l.box$1.dim(l.box$1.construct(r.current),Oe);o[u]<Qn/x?s(u,e[u].initialSize??eo):s(u,_t+1)};return n.jsxRuntimeExports.jsx(Xe,{empty:!0,className:l.CSS.B("accordion"),sizeDistribution:o,ref:r,...t,...i,children:e.map((u,x)=>d.createElement(oo,{...u,key:u.key,index:x,direction:Oe,onExpand:c,parent:r,size:o[x]}))})},so=n.jsxRuntimeExports.jsx(a.u0.Caret.Down,{"aria-label":"contract"}),no=n.jsxRuntimeExports.jsx(a.u0.Caret.Right,{"aria-label":"expand"}),oo=({index:e,name:t,content:s,actions:o,size:r,parent:i,onExpand:c})=>{let u=!0;if(i.current!=null){const m=l.box$1.dim(l.box$1.construct(i.current),Oe);u=r*m>Jn}const x=u?so:no;return n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsxs(ze.Header,{level:"p",className:l.CSS.expanded(u),empty:!0,children:[n.jsxRuntimeExports.jsx(ze.ButtonTitle,{startIcon:x,onClick:()=>c(e),children:t}),o!=null&&n.jsxRuntimeExports.jsx(ze.Actions,{children:o})]}),s]})},ro=Object.freeze(Object.defineProperty({__proto__:null,Accordion:to},Symbol.toStringTag,{value:"Module"})),te="channel",Bt=(e,t)=>{if(t.current==null)return{display:"none"};const s={},o=l.box$1.construct(t.current.parentElement),r=l.box$1.construct(t.current);return e.x>.8?s.right=`${(1-e.x)*l.box$1.width(o)-l.box$1.width(r)}px`:e.x<.2?s.left=`${e.x*l.box$1.width(o)}px`:s.left=`${e.x*100}%`,e.y>.8?s.bottom=`${(1-e.y)*l.box$1.height(o)-l.box$1.height(r)}px`:e.y<.2?s.top=`${e.y*l.box$1.height(o)}px`:s.top=`${e.y*100}%`,s},ts=d.memo(({className:e,value:t,onChange:s,style:o,draggable:r=!0,...i})=>{const[c,u]=G.usePurePassthrough({value:t,onChange:s,initial:l.xy.construct(.1,.01)}),x=d.useRef(c),m=a.useSyncedRef(!r),p=d.useRef(null),[j,h]=d.useState({});c!==null&&(o={...o,...j});const g=d.useCallback(S=>{p.current=S,h(Bt(l.xy.construct(c),p))},[]),E=d.useCallback(S=>{var $;if((($=p.current)==null?void 0:$.parentElement)==null)return x.current;const y=l.box$1.construct(p.current.parentElement),v=l.box$1.reRoot(l.box$1.DECIMAL,l.location.TOP_LEFT),C=l.scale.XY.scale(y).scale(v),R=C.box(l.box$1.construct(p.current));return l.scale.XY.clamp(l.box$1.construct(l.box$1.topLeft(v),{width:l.box$1.width(v)-l.box$1.width(R),height:l.box$1.height(v)-l.box$1.height(R)})).pos(l.xy.translate(l.xy.construct(x.current),l.box$1.signedDims(C.box(S))))},[]),b=Ke({onMove:d.useCallback(S=>{if(m.current)return;const y=E(S);h(Bt(l.xy.construct(y),p))},[u]),onEnd:d.useCallback(S=>{m.current||(x.current=E(S))},[])});return n.jsxRuntimeExports.jsx(N.Space,{className:l.CSS(e,l.CSS.B("legend")),bordered:!0,rounded:!0,style:o,onDragStart:b,draggable:r,ref:g,...i,onDrag:Ie,onDragEnd:Ie,empty:!0})});ts.displayName="Legend.Container";const ss=({data:e=[],onEntryChange:t,position:s,onPositionChange:o,...r})=>{const[i,c]=d.useState(!1);return e.length===0?null:n.jsxRuntimeExports.jsx(ts,{...r,draggable:!i,value:s,onChange:o,children:e.sort((u,x)=>u.label.localeCompare(x.label)).map(({key:u,color:x,label:m})=>n.jsxRuntimeExports.jsxs(N.Space,{style:{cursor:"pointer"},direction:"x",align:"center",children:[n.jsxRuntimeExports.jsx(pt.Swatch,{value:x,onChange:p=>t==null?void 0:t({key:u,color:p,label:m}),onVisibleChange:c,draggable:!1,size:"small"}),n.jsxRuntimeExports.jsx(a.MaybeEditable,{level:"small",value:m,onChange:p=>t==null?void 0:t({key:u,color:x,label:p}),noWrap:!0})]},u))})},lo={region:l.box$1.ZERO,dpr:1,os:l.external$1.getOS()},io={gl:null,lower2d:null,upper2d:null,bootstrapped:!1},co=a.wrap$1(f.Canvas.TYPE,({children:e,resizeDebounce:t=100,className:s,aetherKey:o,...r})=>{const[{path:i},{bootstrapped:c},u]=a.use$3({aetherKey:o,type:f.Canvas.TYPE,schema:f.canvasStateZ,initialState:lo}),x=d.useRef({...io}),m=d.useCallback(h=>{x.current.bootstrapped&&u(()=>({bootstrapped:!0,region:h,dpr:window.devicePixelRatio,os:l.external$1.getOS({default:"Windows"})}))},[u]),p=a.useResize(m,{debounce:t}),j=d.useCallback(h=>{if(p(h),h==null)return;h.className.includes("gl")?x.current.gl=h:h.className.includes("upper2d")?x.current.upper2d=h:x.current.lower2d=h;const{gl:g,lower2d:E,upper2d:b,bootstrapped:S}=x.current;if(g==null||E==null||b==null||S)return;x.current.bootstrapped=!0;const y=g.transferControlToOffscreen(),v=b.transferControlToOffscreen(),C=E.transferControlToOffscreen();u({glCanvas:y,upper2dCanvas:v,lower2dCanvas:C,bootstrap:!0,bootstrapped:!1,region:l.box$1.construct(g),dpr:window.devicePixelRatio,os:l.external$1.getOS({default:"Windows"})},[y,v,C])},[u]);return n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx("canvas",{ref:j,className:l.CSS(l.CSS.BM("canvas","lower2d"),s),...r}),n.jsxRuntimeExports.jsx("canvas",{ref:j,className:l.CSS(l.CSS.BM("canvas","gl"),s),...r}),n.jsxRuntimeExports.jsx("canvas",{ref:j,className:l.CSS(l.CSS.BM("canvas","upper2d"),s),...r}),n.jsxRuntimeExports.jsx(a.Composite,{path:i,children:c&&e})]})}),ft=e=>a.useResize(d.useCallback((t,s)=>{const o=document.querySelector(".pluto-canvas--lower2d");if(o==null)return;const r=l.box$1.construct(o);t=l.scale.XY.translate(l.xy.scale(l.box$1.topLeft(r),-1)).box(t),e(t,s)},[e])),ao=Object.freeze(Object.defineProperty({__proto__:null,Canvas:co,useRegion:ft},Symbol.toStringTag,{value:"Module"})),ns=d.createContext(null),de=e=>{const t=d.useContext(ns);if(t==null)throw new Error(`Cannot to use ${e} as a non-child of LinePlot.`);return t},os=e=>{const t=de("Viewport"),{addViewportHandler:s}=t;d.useEffect(()=>s(e),[s,e])},ht=(e,t)=>{const{setAxis:s,removeAxis:o}=de(t),{key:r}=e;return a.useEffectCompare(()=>(l.location.outer.parse(e.loc),s(e),()=>o(e.key)),([u],[x])=>l.external.equal(u,x),[e]),{gridArea:l.direction$1.swap(l.location.direction(e.loc))==="x"?`axis-start-${r} / plot-start / axis-end-${r} / plot-end`:`plot-start / axis-start-${r} / plot-end / axis-end-${r}`}},rs=a.wrap$1("LinePlot",({aetherKey:e,style:t,resizeDebounce:s=0,clearOverscan:o,children:r,hold:i,...c})=>{const[u,x,m]=a.useCombinedStateAndRef([]),p=a.useMemoDeepEqualProps({clearOverscan:o,hold:i}),[{path:j},{grid:h},g]=a.use$3({aetherKey:e,type:f.LinePlot.TYPE,schema:f.linePlotStateZ,initialState:{container:l.box$1.ZERO,viewport:l.box$1.DECIMAL,grid:[],...p}});d.useEffect(()=>g(P=>({...P,...p})),[p]);const E=d.useRef(new Map),b=d.useCallback(P=>(E.current.set(P,null),()=>E.current.delete(P)),[E]),S=d.useCallback(P=>{const{mode:O,box:z,stage:L}=P;(O==="pan"&&L!=="start"||O==="zoom"||O==="zoomReset"&&L==="start")&&g(M=>({...M,viewport:z})),E.current.forEach((M,V)=>V(P))},[g]),y=d.useCallback(P=>g(O=>({...O,container:P})),[g]),v=ft(y),C=d.useCallback(P=>g(O=>({...O,grid:[...O.grid.filter(({key:z})=>z!==P.key),P]})),[g]),R=d.useCallback(P=>g(O=>({...O,grid:O.grid.filter(({key:z})=>z!==P)})),[g]),w=d.useCallback(P=>{x(O=>[...O.filter(({key:z})=>z!==P.key),P])},[x,S]),$=d.useCallback(P=>x(O=>O.filter(({key:z})=>z!==P)),[w]),_=uo(h),B=d.useMemo(()=>({lines:u,setAxis:C,removeAxis:R,setLine:w,removeLine:$,setViewport:S,addViewportHandler:b}),[u,C,R,w,$,S,b]);return n.jsxRuntimeExports.jsx("div",{className:l.CSS.B("line-plot"),style:{...t,..._},ref:v,...c,children:n.jsxRuntimeExports.jsx(ns.Provider,{value:B,children:n.jsxRuntimeExports.jsx(a.Composite,{path:j,children:r})})})}),uo=e=>{const t=l.CSS.newGridBuilder();return f.filterGridPositions("top",e).forEach(({key:s,size:o})=>t.addRow(`axis-start-${s}`,`axis-end-${s}`,o)),t.addRow("plot-start","plot-end","minmax(0, 1fr)"),f.filterGridPositions("bottom",e).forEach(({key:s,size:o})=>t.addRow(`axis-start-${s}`,`axis-end-${s}`,o)),f.filterGridPositions("left",e).forEach(({key:s,size:o})=>t.addColumn(`axis-start-${s}`,`axis-end-${s}`,o)),t.addColumn("plot-start","plot-end","minmax(0, 1fr)"),f.filterGridPositions("right",e).forEach(({key:s,size:o})=>t.addColumn(`axis-start-${s}`,`axis-end-${s}`,o)),t.build()},ls=({className:e,style:t,onLineChange:s,...o})=>{const{lines:r}=de("Legend");return de("Legend"),n.jsxRuntimeExports.jsx(ss,{data:r,onEntryChange:s,...o})},is=a.wrap$1("Line",({aetherKey:e,...t})=>{const[,,s]=a.use$3({aetherKey:e,type:f.Line.TYPE,schema:f.stateZ,initialState:t}),o=a.useMemoDeepEqualProps(t);return d.useLayoutEffect(()=>s(o),[o]),null}),xo=Object.freeze(Object.defineProperty({__proto__:null,Line:is},Symbol.toStringTag,{value:"Module"})),gt=a.wrap$1("Line",({aetherKey:e,color:t,label:s="",...o})=>{const{setLine:r,removeLine:i}=de("Line");return d.useEffect(()=>(r({key:e,color:t,label:s}),()=>i(e)),[s,t]),n.jsxRuntimeExports.jsx(is,{aetherKey:e,color:t,label:s,...o})}),cs=({level:e="h2",...t})=>{const s=a.useUniqueKey(),o=a.useTypography(e),r=ht({key:s,size:(o.lineHeight+2)*o.baseSize,loc:"top",order:"first"},"Title");return n.jsxRuntimeExports.jsx(N.Space,{justify:"center",align:"center",style:r,children:n.jsxRuntimeExports.jsx(a.MaybeEditable,{...t,level:e})})},po={select:"pointer",zoom:"crosshair",pan:"grab",zoomReset:"crosshair",click:"pointer"},Et=d.forwardRef(({className:e,mode:t,maskBox:s,children:o,style:r,...i},c)=>n.jsxRuntimeExports.jsxs("div",{ref:c,className:l.CSS(l.CSS.noSelect,l.CSS.BE("viewport-mask","container"),e),style:{cursor:po[t],...r},...i,children:[n.jsxRuntimeExports.jsx("div",{style:{...l.box$1.css(s),display:l.box$1.isZero(s)?"none":"block"},className:l.CSS.BE("viewport-mask","selection")}),o]}));Et.displayName="ZoomPanMask";const mo=["zoom","pan","select","zoomReset"],Ve=[...mo,"click"],as=["zoom","select"],Ae={defaultMode:"zoom",zoom:[["MouseLeft"]],zoomReset:[["MouseLeft","Control"]],pan:[["MouseLeft","Shift"]],select:[["MouseLeft","Alt"]]},us={defaultMode:"pan",pan:[["MouseLeft"]],zoom:[["MouseLeft","Shift"]],zoomReset:[["MouseLeft","Control"]],select:[["MouseLeft","Alt"]]},xs={defaultMode:"select",select:[["MouseLeft"]],pan:[["MouseLeft","Shift"]],zoom:[["MouseLeft","Alt"]],zoomReset:[["MouseLeft","Control"]]},St={zoom:Ae,pan:us,select:xs,zoomReset:Ae,click:Ae},jo=e=>{const t=Object.entries(e);return Object.fromEntries(t.map(([s,o])=>s==="defaultMode"?[s,o]:[s,o.map(r=>r.filter(i=>i!=="MouseLeft")).filter(r=>r.length>0)]))},fo=l.box$1.construct(0,0,1,1,l.location.TOP_LEFT),ho={width:30,height:50},ds=({onChange:e,triggers:t,initial:s=fo,threshold:o=ho})=>{const r=(t==null?void 0:t.defaultMode)??"zoom",[i,c]=d.useState(l.box$1.ZERO),[u,x]=d.useState(r),[m,p]=a.useStateRef(s),j=d.useRef(null),h=l.dimensions.construct(o);d.useEffect(()=>p(s),[s]),d.useEffect(()=>x(r),[r]);const[g,E,b,S]=a.useMemoCompare(()=>{const R={...St[r],...t},w=a.flattenConfig(R),$=jo(R);return[R,w,$,a.flattenConfig($)]},a.compareModeConfigs,[t]),y=d.useCallback(({box:R,triggers:w,stage:$,cursor:_})=>{if(j.current==null)return;const B=a.determineMode(g,w),P=l.box$1.construct(j.current);if(B==null)return;if(B==="zoomReset")return c(l.box$1.ZERO),e==null||e({box:l.box$1.DECIMAL,mode:B,stage:$,cursor:_}),p(l.box$1.DECIMAL);if($==="end"){if(l.box$1.width(R)<5&&l.box$1.height(R)<5){B==="zoom"&&c(l.box$1.ZERO),e==null||e({box:m.current,mode:"click",stage:$,cursor:_});return}return p(z=>{if(B==="pan"){const M=Dt(R,z,P);return M===null?z:(e==null||e({box:M,mode:B,stage:$,cursor:_}),M)}const L=v(R,z,P);return L===null?z:(e==null||e({box:L,mode:B,stage:$,cursor:_}),B==="zoom"?(c(l.box$1.ZERO),L):z)})}if(as.includes(B))return l.box$1.height(R)<5&&l.box$1.width(R)<5?void 0:c(l.scale.XY.scale(P).clamp(P).translate({x:-l.box$1.left(P),y:-l.box$1.top(P)}).box(zt(h,R,P)));c(z=>l.box$1.isZero(z)?z:l.box$1.ZERO);const O=Dt(R,m.current,P);e==null||e({box:O,mode:B,stage:$,cursor:_})},[c,x,e,g,o.height,o.width,p,j]),v=d.useCallback((R,w,$)=>ps(w,$).box(zt(h,R,$)),[o]);mt.useDrag({bound:j,onDrag:y,triggers:E,loose:!0});const C=d.useCallback(({triggers:R,stage:w})=>{if(w==="end")return x(r);const $=a.determineMode(b,R);$!=null&&x($)},[b,r,e]);return a.use$2({triggers:S,callback:C,region:j}),{maskBox:i,ref:j,mode:u}},ps=(e,t)=>l.scale.XY.scale(t).clamp(t).scale(e),Dt=(e,t,s)=>{let o=l.box$1.signedDims(ps(t,s).box(e));return o={signedWidth:-o.signedWidth,signedHeight:-o.signedHeight},l.scale.XY.translate(l.xy.construct(o)).box(t)},zt=(e,t,s)=>l.box$1.height(t)<=e.height?l.box$1.construct(l.box$1.left(t),l.box$1.top(s),l.box$1.width(t),l.box$1.height(s)):l.box$1.width(t)<=e.width?l.box$1.construct(l.box$1.left(s),l.box$1.top(t),l.box$1.width(s),l.box$1.height(t)):t,ms=e=>n.jsxRuntimeExports.jsx(a.Icon,{className:l.CSS.BE("select","clear"),variant:"outlined",...e,children:n.jsxRuntimeExports.jsx(a.u0.Close,{"aria-label":"clear"})}),Ze=({children:e="",size:t="medium",variant:s="filled",color:o,icon:r,onClose:i,className:c,onDragStart:u,...x})=>{const m=l.cssString(o);r==null&&o!=null&&(r=n.jsxRuntimeExports.jsx(a.u0.Circle,{fill:m}));const p=i==null?void 0:n.jsxRuntimeExports.jsx(a.Icon,{"aria-label":"close",size:t,className:l.CSS.BE("tag","close"),onClick:j=>{j.stopPropagation(),i()},children:n.jsxRuntimeExports.jsx(a.u0.Close,{})});return n.jsxRuntimeExports.jsx(a.WithIcon,{startIcon:r,endIcon:p,className:l.CSS(c,l.CSS.B("tag"),i!=null&&l.CSS.BM("tag","closeable")),level:G.ComponentSizeLevels[t],noWrap:!0,align:"center",onDragStart:u,...x,children:e})},go=Object.freeze(Object.defineProperty({__proto__:null,Tag:Ze},Symbol.toStringTag,{value:"Module"})),Rt=({onChange:e,value:t,location:s,className:o,data:r,columns:i=[],tagKey:c="key",emptyContent:u,searcher:x,renderTag:m,placeholder:p,onTagDragStart:j,allowMultiple:h,allowNone:g,replaceOnSingle:E,onTagDragEnd:b,style:S,...y})=>{const{visible:v,open:C,close:R}=a.use$1(),[w,$]=d.useState([]),[_,B]=d.useState(!1),P=x!=null;a.useAsyncEffect(async()=>{B(!0),a.selectValueIsZero(t)&&$([]);const L=w.map(Q=>Q.key),M=l.toArray(t);if(l.compare.unorderedPrimitiveArrays(L,M)===l.compare.EQUAL)return;let V=[];if(P)try{V=await x.retrieve(M)}finally{B(!1)}else r!=null&&(V=r.filter(Q=>M.includes(Q.key)));$(V)},[x,P,t,r]);const O=d.useCallback((L,M)=>{$(M.entries),e(L,M)},[e]),z=d.useMemo(()=>P?a.Search:Re.Filter,[P]);return n.jsxRuntimeExports.jsx(a.Core,{close:R,open:C,data:r,emtpyContent:u,visible:v,value:t,onChange:O,allowNone:g,replaceOnSingle:E,columns:i,allowMultiple:!0,children:n.jsxRuntimeExports.jsx(z,{searcher:x,children:({onChange:L,value:M})=>n.jsxRuntimeExports.jsx(Eo,{value:M,selectedKeys:t,className:o,onChange:L,loading:_,selected:w,onFocus:C,tagKey:c,visible:v,renderTag:m,placeholder:p,onTagDragStart:j,onTagDragEnd:b,style:S})})})},Eo=({selectedKeys:e,loading:t,selected:s,onChange:o,onFocus:r,visible:i,tagKey:c,renderTag:u=a.componentRenderProp(js),placeholder:x="Select...",onTagDragStart:m,onTagDragEnd:p,value:j,className:h,...g})=>{const{onSelect:E,clear:b}=a.useSelectionUtils(),S=d.useRef(null);d.useLayoutEffect(()=>{var R;i&&((R=S.current)==null||R.focus())},[i,s]);const y=R=>{i||o(""),r==null||r()},v=R=>{i||r==null||r()},C=()=>{i||o("")};return n.jsxRuntimeExports.jsxs(a.Text$1,{ref:S,className:l.CSS(l.CSS.BE("select-multiple","input"),l.CSS.visible(i),h),onBlur:C,placeholder:x,value:j,onChange:o,onFocus:y,autoComplete:"off",autoCapitalize:"off",autoCorrect:"off",onClick:v,...g,children:[n.jsxRuntimeExports.jsx(N.Space,{direction:"x",className:l.CSS.BE("select-multiple","tags"),align:"center",grow:!0,children:l.toArray(e).map((R,w)=>{const $=s[w];return u({key:R,entryKey:R,tagKey:c,loading:t,entry:$,onClose:()=>E==null?void 0:E(R),onDragStart:_=>m==null?void 0:m(_,R),onDragEnd:_=>p==null?void 0:p(_,R)})})}),n.jsxRuntimeExports.jsx(ms,{onClick:b})]})},js=({entryKey:e,tagKey:t,entry:s,loading:o,...r})=>{let i=e;return s!=null&&(i=typeof t=="function"?t(s):s[t]),d.createElement(Ze,{size:"small",variant:"outlined",className:l.CSS(s==null&&!o&&l.CSS.BEM("select-multiple","tag","invalid")),draggable:!0,...r,key:e.toString()},l.convertRenderV(i))},fs=({onChange:e,value:t,tagKey:s="key",columns:o=[],data:r,emptyContent:i,inputProps:c,allowNone:u,searcher:x,className:m,variant:p,hideColumnHeader:j=!1,disabled:h,...g})=>{const{visible:E,open:b,close:S}=a.use$1(),[y,v]=d.useState(null),C=x!=null;a.useAsyncEffect(async()=>{if((y==null?void 0:y.key)===t)return;if(a.selectValueIsZero(t))return v(null);let $=null;if(C){const[_]=await x.retrieve([t]);$=_??null}else r!=null&&($=r.find(_=>_.key===t)??null);v($)},[x,t]);const R=d.useCallback(($,_)=>{v($==null?null:_.entries[0]),S(),e($,_)},[e,u]),w=d.useMemo(()=>C?a.Search:Re.Filter,[C]);return n.jsxRuntimeExports.jsx(a.Core,{close:S,open:b,data:r,emtpyContent:i,allowMultiple:!1,visible:E,value:t,hideColumnHeader:j,onChange:R,allowNone:u,columns:o,...g,children:n.jsxRuntimeExports.jsx(w,{searcher:x,children:({onChange:$})=>n.jsxRuntimeExports.jsx(So,{variant:p,onChange:$,onFocus:b,selected:y,tagKey:s,visible:E,allowNone:u,className:m,disabled:h})})})},So=({tagKey:e,selected:t,visible:s,onChange:o,onFocus:r,allowNone:i=!0,debounceSearch:c=250,placeholder:u="Select...",className:x,...m})=>{const{clear:p}=a.useSelectionUtils(),[j,h]=d.useState("");d.useEffect(()=>{if(!s){if(l.primitiveIsZero(t==null?void 0:t.key))return h("");if(t!=null)return h(typeof e=="function"?e(t).toString():(t==null?void 0:t[e]).toString())}},[t,s,e]);const g=y=>{o(y),h(y)},E=y=>{h(""),r==null||r()},b=y=>{s||(y.preventDefault(),r==null||r())},S=()=>{h(""),p==null||p()};return n.jsxRuntimeExports.jsx(a.Text$1,{className:l.CSS(l.CSS.BE("select","input"),x),value:j,onChange:g,onFocus:E,style:{flexGrow:1},onClick:b,placeholder:u,...m,children:i&&n.jsxRuntimeExports.jsx(ms,{onClick:S})})},Ro=[{key:"x",icon:n.jsxRuntimeExports.jsx(a.u0.Arrow.Right,{})},{key:"y",icon:n.jsxRuntimeExports.jsx(a.u0.Arrow.Down,{})}],bo=({key:e,entry:t,onClick:s,selected:o})=>n.jsxRuntimeExports.jsx(a.Icon,{variant:o?"filled":"outlined",onClick:s,children:t.icon},e),yo=({children:e=bo,allowMultiple:t=!1,...s})=>n.jsxRuntimeExports.jsx(ne.Button,{...s,data:Ro,children:e}),Co=l.DataType.ALL.filter(e=>e!==l.DataType.UNKNOWN).map(e=>({key:e.toString(),name:l.Case.capitalize(e.toString())})),vo=[{key:"name",name:"Name"}],wo=e=>n.jsxRuntimeExports.jsx(ne.DropdownButton,{...e,data:Co,columns:vo,tagKey:"name"}),$o=Object.freeze(Object.defineProperty({__proto__:null,BaseButton:ne.BaseButton,Button:ne.Button,DataType:wo,Direction:yo,DropdownButton:ne.DropdownButton,Multiple:Rt,MultipleTag:js,Single:fs,defaultButton:ne.defaultButton},Symbol.toStringTag,{value:"Module"})),To=({mode:e,triggers:t})=>n.jsxRuntimeExports.jsxs(N.Space,{direction:"x",align:"center",children:[n.jsxRuntimeExports.jsx(a.Text,{level:"small",children:l.Case.capitalize(e)}),n.jsxRuntimeExports.jsx(mt.Text,{trigger:t[0],level:"small"})]}),Po={zoom:n.jsxRuntimeExports.jsx(a.u0.Zoom,{}),pan:n.jsxRuntimeExports.jsx(a.u0.Pan,{}),select:n.jsxRuntimeExports.jsx(a.u0.Selection,{}),zoomReset:n.jsxRuntimeExports.jsx(a.u0.Expand,{}),click:n.jsxRuntimeExports.jsx(a.u0.Bolt,{})},ko=({triggers:e,disable:t=["zoomReset","click"],...s})=>{const o=Object.entries(e).filter(([r])=>!t.includes(r)&&Ve.includes(r)).map(([r,i])=>({key:r,icon:Po[r],tooltip:n.jsxRuntimeExports.jsx(To,{mode:r,triggers:i})})).sort((r,i)=>Ve.indexOf(r.key)-Ve.indexOf(i.key));return n.jsxRuntimeExports.jsx(ne.Button,{...s,data:o,entryRenderKey:"icon",children:({title:r,entry:i,...c})=>d.createElement(a.Icon,{...c,key:i.key,variant:c.selected?"filled":"text",size:"medium",tooltip:i.tooltip,tooltipLocation:{x:"right",y:"top"}},i.icon)})},Lo=Object.freeze(Object.defineProperty({__proto__:null,DEFAULT_TRIGGERS:St,MASK_MODES:as,MODES:Ve,Mask:Et,PAN_DEFAULT_TRIGGERS:us,SELECT_DEFAULT_TRIGGERS:xs,SelectMode:ko,ZOOM_DEFAULT_TRIGGERS:Ae,use:ds},Symbol.toStringTag,{value:"Module"})),hs=e=>e==null?null:document.querySelectorAll(".pluto-line-plot__viewport")[0]??null,gs=({children:e,initial:t=l.box$1.DECIMAL,onChange:s,...o})=>{const{setViewport:r}=de("Viewport");d.useLayoutEffect(()=>{r({box:t,mode:"zoom",cursor:l.xy.ZERO,stage:"start"})},[r,t]);const i=d.useCallback(u=>{r(u),s==null||s(u)},[s,r]),c=ds({onChange:i,initial:t,...o});return n.jsxRuntimeExports.jsx(Et,{className:l.CSS.BE("line-plot","viewport"),...c,children:e})},bt=e=>{const t=e==="x"?"bottom":"left",s=e==="x"?f.XAxis.TYPE:f.YAxis.TYPE,o=`${e}-axis`;return a.wrap$1(s,({aetherKey:r,children:i,resizeDebounce:c=0,location:u=t,label:x="",labelLevel:m="small",labelDirection:p=e,onLabelChange:j,color:h,labelSize:g,showGrid:E,type:b,bounds:S,className:y,tickSpacing:v,autoBounds:C,autoBoundUpdateInterval:R,onAutoBoundsChange:w,style:$,..._})=>{const B=((x==null?void 0:x.length)??0)>0,P=a.useMemoDeepEqualProps({location:u,showGrid:E,type:b,bounds:S,label:x,labelDirection:p,tickSpacing:v,autoBounds:C,autoBoundUpdateInterval:R}),[{path:O},{size:z,labelSize:L,...M},V]=a.use$3({aetherKey:r,type:s,schema:f.coreAxisStateZ,initialState:P});d.useEffect(()=>V(ae=>({...ae,...P})),[P]),d.useEffect(()=>{const{lower:ae,upper:K}=f.parseAutoBounds(M.autoBounds);M.bounds!=null&&(ae&&(S==null?void 0:S.lower)!==M.bounds.lower||K&&(S==null?void 0:S.upper)!==M.bounds.upper)&&(w==null||w(M.bounds))},[M.autoBounds,M.bounds]);const Q=ht({loc:u,key:r,size:z+L,order:"last"},"XAxis"),re=a.useTypography(m).toString(),he=d.useRef(0);return d.useEffect(()=>{if(e==="y"){if(x==null)return;let K=G.dimensions(x,re)[l.direction$1.dimension(l.direction$1.construct(p))];K>0&&(K+=6),V(ge=>({...ge,labelSize:K}))}else{const K=G.dimensions(x,re).height+12,ge=he.current;f.withinSizeThreshold(ge,K)||(he.current=K,V(Be=>({...Be,labelSize:K})))}},[x,p,re]),n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx(N.Space,{className:l.CSS(y,l.CSS.B("axis"),l.CSS.B(o),l.CSS.loc(u)),style:{...$,...Q},align:"center",justify:e==="x"?"end":"start",direction:l.direction$1.swap(e),..._,children:B&&n.jsxRuntimeExports.jsx(a.MaybeEditable,{className:l.CSS(l.CSS.BE("axis","label"),l.CSS.dir(p)),value:x,onChange:j,level:m})}),n.jsxRuntimeExports.jsx(a.Composite,{path:O,children:i})]})})},Es=bt("x"),Ss=bt("y"),Mo=Object.freeze(Object.defineProperty({__proto__:null,Legend:ls,Line:gt,LinePlot:rs,Title:cs,Viewport:gs,XAxis:Es,YAxis:Ss,axisFactory:bt,selectViewportEl:hs,useContext:de,useGridPosition:ht,useViewport:os},Symbol.toStringTag,{value:"Module"})),No=a.wrap$1("Tooltip",({aetherKey:e})=>{const[,,t]=a.use$3({aetherKey:e,type:f.Tooltip.TYPE,schema:f.tooltipStateZ,initialState:{position:null}}),s=d.useRef(null),o=d.useCallback(i=>t({position:l.xy.construct(i)}),[t]),r=d.useCallback(()=>t({position:null}),[t]);return d.useEffect(()=>{if(s.current===null)return;const i=s.current.parentElement;if(i!=null)return i.addEventListener("mousemove",o),i.addEventListener("mouseleave",r),()=>{i.removeEventListener("mousemove",o),i.removeEventListener("mouseleave",r)}},[o]),n.jsxRuntimeExports.jsx("span",{ref:s})}),Rs={defaultMode:"empty",one:[["1"]],two:[["2"]],clear:[["Shift"]],empty:[[]]},_o=a.flattenConfig(Rs),bs=a.wrap$1("Measure",({aetherKey:e})=>{const[,,t]=a.use$3({aetherKey:e,type:f.Measure.TYPE,schema:f.measureStateZ,initialState:{hover:null,one:null,two:null}}),s=d.useRef(null),o=a.useHeldRef({triggers:_o,loose:!0}),r=d.useCallback(({mode:u,cursor:x})=>{if(u==="click"){const m=a.determineMode(Rs,o.current.triggers,!0);if(["one","two"].includes(m))return t(p=>({...p,[m]:x}));t(m==="clear"?p=>({...p,one:null,two:null}):p=>({...p,one:p.one??x,two:p.one!==null?x:p.two}))}},[t,o]);os(r);const i=d.useCallback(u=>t(x=>({...x,hover:l.xy.construct(u)})),[t]),c=d.useCallback(()=>{t(u=>({...u,hover:null}))},[t]);return d.useEffect(()=>{if(s.current===null)return;const u=s.current.parentElement;if(u!=null)return u.addEventListener("mousemove",i),u.addEventListener("mouseleave",c),()=>{u.removeEventListener("mousemove",i),u.removeEventListener("mouseleave",c)}},[r]),n.jsxRuntimeExports.jsx("span",{ref:s})}),Bo=Object.freeze(Object.defineProperty({__proto__:null,Measure:bs},Symbol.toStringTag,{value:"Module"})),yt=a.wrap$1("Rule",({aetherKey:e,label:t,position:s,onLabelChange:o,onPositionChange:r,units:i="",color:c,lineWidth:u,lineDash:x})=>{const[m,p]=G.usePurePassthrough({value:t,onChange:o,initial:""}),[,{position:j,pixelPosition:h},g]=a.use$3({aetherKey:e,type:f.Rule.TYPE,schema:f.ruleStateZ,initialState:{color:c,dragging:!1,position:s,lineWidth:u,lineDash:x}});d.useEffect(()=>{if(j==null)return;if(s==null)return r==null?void 0:r(j);const R=l.bounds.construct(j+.01,j-.01);s!=null&&!l.bounds.contains(R,s)&&(r==null||r(Math.trunc(j*100)/100))},[j]);const E=d.useRef(h);h!==E.current&&(E.current=h);const b=d.useRef(h);d.useEffect(()=>{g(R=>({...R,position:s,color:c,lineWidth:u,lineDash:x}))},[s,c,u,x]);const S=Ke({onStart:d.useCallback(()=>{g(R=>({...R,dragging:!0})),b.current=E.current},[]),onMove:R=>{g(w=>({...w,pixelPosition:(b.current??0)+l.box$1.signedHeight(R)}))},onEnd:d.useCallback(()=>{g(R=>({...R,dragging:!1})),b.current=h},[])}),y=d.useRef(null);if(j==null||h==null)return null;const v=hs(y==null?void 0:y.current),C=n.jsxRuntimeExports.jsxs("div",{ref:y,className:l.CSS.B("rule"),style:{top:`calc(${h}px - 0.5rem)`},children:[n.jsxRuntimeExports.jsx("div",{className:l.CSS.BE("rule","drag-handle"),onDragStart:S,draggable:!0}),n.jsxRuntimeExports.jsxs(N.Space,{direction:"x",align:"center",style:{marginLeft:"2rem"},children:[n.jsxRuntimeExports.jsx(a.Editable,{level:"p",value:m,onChange:p}),n.jsxRuntimeExports.jsx(a.Text,{level:"p",style:{padding:"0.25rem 0",width:"fit-content"},children:`${j.toFixed(2)} ${i}`})]})]});return v==null?C:Bn.createPortal(C,v)}),Do=Object.freeze(Object.defineProperty({__proto__:null,Rule:yt},Symbol.toStringTag,{value:"Module"})),ys=a.canDropOfType(te),zo=({lines:e,axes:t,showTitle:s=!0,title:o="",onTitleChange:r,showLegend:i=!0,titleLevel:c="h4",onLineChange:u,onRuleChange:x,onAxisChannelDrop:m,onAxisChange:p,rules:j,enableTooltip:h=!0,enableMeasure:g=!1,initialViewport:E=l.box$1.DECIMAL,onViewportChange:b,viewportTriggers:S,...y})=>{const v=t.filter(({location:C})=>l.location.isY(C));return n.jsxRuntimeExports.jsxs(rs,{...y,children:[v.map((C,R)=>{const w=e.filter(B=>B.axes.x===C.key),$=t.filter(({location:B})=>l.location.isX(B)),_=j==null?void 0:j.filter(B=>[...$.map(({key:P})=>P),C.key].includes(B.axis));return n.jsxRuntimeExports.jsx(Oo,{axis:C,index:R,lines:w,yAxes:$,rules:_,onAxisChannelDrop:m,onAxisChange:p},C.key)}),i&&n.jsxRuntimeExports.jsx(ls,{onLineChange:u}),s&&n.jsxRuntimeExports.jsx(cs,{value:o,onChange:r,level:c}),n.jsxRuntimeExports.jsxs(gs,{initial:E,onChange:b,triggers:S,children:[h&&n.jsxRuntimeExports.jsx(No,{}),g&&n.jsxRuntimeExports.jsx(bs,{})]})]})},Oo=({yAxes:e,lines:t,index:s,rules:o,onRuleChange:r,onAxisChannelDrop:i,onAxisChange:c,axis:{location:u,key:x,showGrid:m,...p}})=>{const j=a.useDrop({type:"Channel.LinePlot.XAxis",canDrop:ys,onDrop:d.useCallback(({items:g})=>{const E=a.filterByType(te,g);return i==null||i(x,E.map(({key:b})=>b)),E},[x,i])}),h=o==null?void 0:o.filter(g=>g.axis===x);return n.jsxRuntimeExports.jsxs(Es,{...p,...j,location:u,showGrid:m??s===0,className:l.CSS(l.CSS.dropRegion(a.canDropOfType(te)(a.useDraggingState()))),onAutoBoundsChange:g=>c==null?void 0:c({key:x,bounds:g}),children:[e.map((g,E)=>{const b=t.filter(y=>y.axes.y===g.key),S=o==null?void 0:o.filter(y=>y.axis===g.key);return n.jsxRuntimeExports.jsx(Ao,{axis:{...g,showGrid:m??(s===0&&E===0)},lines:b,rules:S,onRuleChange:r,onAxisChannelDrop:i,onAxisChange:c},g.key)}),h==null?void 0:h.map(g=>d.createElement(yt,{aetherKey:g.key,...g,key:g.key,onLabelChange:E=>r==null?void 0:r({key:g.key,label:E}),onPositionChange:E=>r==null?void 0:r({key:g.key,position:E})}))]})},Vo=({channels:{x:e,y:t}})=>`${e??0}-${t}`,Ao=({lines:e,rules:t,onRuleChange:s,onAxisChannelDrop:o,onAxisChange:r,axis:{key:i,location:c,...u}})=>{const x=a.useDrop({type:"Channel.LinePlot.YAxis",canDrop:ys,onDrop:d.useCallback(({items:p})=>{const j=a.filterByType(te,p);return o==null||o(i,j.map(({key:h})=>h)),j},[i,o])}),m=a.useDraggingState();return n.jsxRuntimeExports.jsxs(Ss,{...u,...x,location:c,className:l.CSS(l.CSS.dropRegion(a.canDropOfType(te)(m))),onAutoBoundsChange:p=>r==null?void 0:r({key:i,bounds:p}),children:[e.map(p=>n.jsxRuntimeExports.jsx(Io,{line:p},Vo(p))),t==null?void 0:t.map(p=>d.createElement(yt,{aetherKey:p.key,...p,key:p.key,onLabelChange:j=>s==null?void 0:s({key:p.key,label:j}),onPositionChange:j=>s==null?void 0:s({key:p.key,position:j})}))]})},Io=({line:e})=>e.variant==="static"?n.jsxRuntimeExports.jsx(Fo,{line:e}):n.jsxRuntimeExports.jsx(Zo,{line:e}),Zo=({line:{key:e,timeSpan:t,channels:{x:s,y:o},...r}})=>{const i=f.streamChannelData({timeSpan:t,channel:o}),c=s!=null&&s!==0,u=f.streamChannelData({timeSpan:t,channel:c?s:o,index:!c});return n.jsxRuntimeExports.jsx(gt,{aetherKey:e,y:i,x:u,...r})},Fo=({line:{timeRange:e,key:t,channels:{x:s,y:o},...r}})=>{const i=f.channelData({timeRange:e,channel:o}),c=s!=null&&s!==0,u=f.channelData({timeRange:e,channel:c?s:o,index:!c});return n.jsxRuntimeExports.jsx(gt,{aetherKey:t,y:i,x:u,...r})},Ct=d.createContext(f.ZERO_CONTEXT_VALUE),Le=()=>d.useContext(Ct).synnax,Yo=()=>d.useContext(Ct).state,Ot={connected:"success",connecting:"info",disconnected:"info",failed:"error"},Cs=a.wrap$1(f.Provider.TYPE,({aetherKey:e,connParams:t,children:s})=>{const[o,r,i]=a.useCombinedStateAndRef(f.ZERO_CONTEXT_VALUE),[{path:c},,u]=a.use$3({aetherKey:e,type:f.Provider.TYPE,schema:f.Provider.stateZ,initialState:{props:t??null,state:null}}),x=a.useAggregator(),m=d.useCallback(p=>{i.current.state.status!==p.status&&x({variant:Ot[p.status],message:p.message??l.Case.capitalize(p.status)}),r(j=>({...j,state:p}))},[x]);return a.useAsyncEffect(async()=>{if(o.synnax!=null&&o.synnax.close(),t==null)return r(f.ZERO_CONTEXT_VALUE);const p=new G.Zb({...t,connectivityPollFrequency:G.Le.seconds(5)}),j=await p.connectivity.check();return r({synnax:p,state:j}),x({variant:Ot[j.status],message:j.message??j.status.toUpperCase()}),p.connectivity.onChange(m),u({props:t,state:j}),()=>{p.close(),r(f.ZERO_CONTEXT_VALUE),u({props:null,state:null})}},[t,m]),n.jsxRuntimeExports.jsx(Ct.Provider,{value:o,children:n.jsxRuntimeExports.jsx(a.Composite,{path:c,children:s})})}),Go=Object.freeze(Object.defineProperty({__proto__:null,Provider:Cs,use:Le,useConnectionState:Yo},Symbol.toStringTag,{value:"Module"})),be=d.createContext({aliases:{},getName:async()=>await Promise.resolve(void 0),setAlias:null}),vs=()=>d.useContext(be),ws=e=>{const{aliases:t}=d.useContext(be);return t[e]??null},Je=()=>{const{aliases:e}=d.useContext(be);return e},vt=(e,t="")=>{const{getName:s}=d.useContext(be),[o,r]=d.useState(t);return a.useAsyncEffect(async()=>{const i=await s(e);i!=null&&r(i)},[e,s]),o},wt=()=>{const{activeRange:e}=d.useContext(be);return e??void 0},$s=({activeRange:e,children:t})=>{const s=Le(),[o,r]=d.useState({}),i=d.useCallback(x=>{r(m=>{const p={...m};return x.forEach(({variant:j,key:h,value:g})=>{const E=Number(h.split("---")[1]);j==="delete"?delete p[E]:p[g.channel]=g.alias}),p})},[r]),c=d.useCallback(async(x,m)=>{if(s==null||e==null)return;await(await s.ranges.retrieve(e)).setAlias(x,m)},[s,e]),u=d.useCallback(async x=>{if(s==null||x===0)return;const m=o[x];return m??(await s.channels.retrieve(x)).name},[o,s]);return a.useAsyncEffect(async()=>{if(s==null||e==null){r({});return}const x=await s.ranges.retrieve(e),m=await x.listAliases();r(m);const p=await x.openAliasTracker(),j=p.onChange(i);return()=>{j(),p.close()}},[s,e]),n.jsxRuntimeExports.jsx(be.Provider,{value:{aliases:o,activeRange:e,setAlias:e!=null?c:null,getName:u},children:t})},Ho=({channelKey:e,value:t,shadow:s,className:o,...r})=>{const[i,c]=d.useState(!1),{setAlias:u}=vs(),x=ws(e),m=vt(e);let p=n.jsxRuntimeExports.jsx(a.u0.Rename,{});i?p=n.jsxRuntimeExports.jsx(a.u0.Loading,{}):x===t&&(p=n.jsxRuntimeExports.jsx(a.u0.Check,{}));const j=u!=null&&!i&&x!==t&&e!==0,h=()=>{j&&(async()=>(c(!0),await u(e,t),c(!1)))()},g=()=>{var b;x!=null&&((b=r.onChange)==null||b.call(r,x))},E=()=>e===0?n.jsxRuntimeExports.jsx(a.Text,{level:"small",children:"Select a channel to enable alias syncing with this label"}):u==null?n.jsxRuntimeExports.jsx(a.Text,{level:"small",children:"Select a range to enable alias syncing with this label"}):t.length===0?n.jsxRuntimeExports.jsx(a.Text,{level:"small",children:"Enter a value to enable alias syncing with this label"}):x===t?n.jsxRuntimeExports.jsx(a.Text,{level:"small",children:"Alias synced with this label"}):n.jsxRuntimeExports.jsxs(a.Text,{level:"small",children:["Sync alias for ",m," with this label"]});return n.jsxRuntimeExports.jsxs(a.Text$1,{value:t,...r,children:[j&&n.jsxRuntimeExports.jsx(a.Icon,{onClick:g,tooltip:n.jsxRuntimeExports.jsxs(a.Text,{level:"small",children:["Set ",m," as label"]}),tooltipLocation:{y:"top"},variant:"outlined",children:n.jsxRuntimeExports.jsx(a.u0.Sync,{})}),n.jsxRuntimeExports.jsx(a.Icon,{onClick:h,disabled:!j,tooltip:n.jsxRuntimeExports.jsx(E,{}),tooltipLocation:{y:"top"},variant:"outlined",children:p})]})},Vt=[{key:"name",name:"Name"},{key:"alias",name:"Alias"},{key:"rate",name:"Rate"},{key:"dataType",name:"Data Type"},{key:"index",name:"Index"},{key:"key",name:"Key"},{key:"isIndex",name:"Is Index"}],Fe=({items:e},t)=>{const s=a.filterByType(te,e);return s.length>0&&!s.every(o=>t.includes(o.key))},Ts=["name","alias"],Ps=e=>{const t=Je();return d.useMemo(()=>e.length===0?Vt:Vt.filter(s=>e.includes(s.key)),[e,t])},Uo=({columns:e=Ts,onChange:t,className:s,value:o,...r})=>{const i=Le(),c=Je(),u=Ps(e),x=wt(),m=d.useMemo(()=>i==null?void 0:i.channels.newSearcherUnderRange(x),[i,x]),p=i!=null?void 0:n.jsxRuntimeExports.jsx(a.Text$2.Centered,{variant:"error",level:"h4",style:{height:150},children:"No client available"}),{startDrag:j,onDragEnd:h,...g}=a.useDragAndDrop({type:"Channel.SelectMultiple",canDrop:d.useCallback(v=>Fe(v,l.toArray(o)),[o]),onDrop:d.useCallback(({items:v})=>{const C=a.filterByType(te,v);if(C.length===0)return[];const R=l.unique([...l.toArray(o),...C.map(w=>w.key)]);return t(R,{clickedIndex:null,clicked:null,entries:[]}),C},[t,o])}),E=a.useDraggingState(),b=d.useCallback(({dropped:v})=>{t(l.toArray(o).filter(C=>!v.some(R=>R.key===C)),{clickedIndex:null,clicked:null,entries:[]})},[t,o]),S=d.useCallback((v,C)=>j([{key:C,type:te}],b),[j,b]),y=d.useCallback(v=>c[v.key]??v.name,[c]);return n.jsxRuntimeExports.jsx(Rt,{className:l.CSS(s,l.CSS.dropRegion(Fe(E,l.toArray(o)))),value:o,onTagDragStart:S,onTagDragEnd:h,searcher:m,onChange:t,columns:u,emptyContent:p,tagKey:y,...g,...r})},ke=({columns:e=Ts,onChange:t,value:s,className:o,data:r,...i})=>{const c=Le(),u=Je(),x=Ps(e),m=wt(),p=d.useMemo(()=>{if(!(r!=null&&r.length>0))return c==null?void 0:c.channels.newSearcherUnderRange(m)},[c,m,r==null?void 0:r.length]),j=c!=null?void 0:n.jsxRuntimeExports.jsx(a.Text$2.Centered,{variant:"error",level:"h4",style:{height:150},children:"No client available"}),h=d.useId(),g=d.useMemo(()=>({key:h,type:"Channel.SelectMultiple"}),[h]),{startDrag:E,onDragEnd:b,...S}=a.useDragAndDrop({type:"Channel.SelectSingle",canDrop:d.useCallback(R=>Fe(R,l.nullToArr(s)),[s]),onDrop:d.useCallback(({items:R})=>{const w=a.filterByType(te,R);return w.length===0?[]:(t(w[0].key,{clickedIndex:null,clicked:null,entries:[]}),w)},[g,t])}),y=a.useDraggingState(),v=d.useCallback(()=>s!=null&&E([{type:te,key:s}]),[E,s]),C=d.useCallback(R=>u[R.key]??R.name,[u]);return n.jsxRuntimeExports.jsx(fs,{data:r,className:l.CSS(o,l.CSS.dropRegion(Fe(y,l.nullToArr(s)))),value:s,onDragStart:v,onDragEnd:b,onChange:t,searcher:p,columns:x,emptyContent:j,tagKey:C,...S,...i})},qo=Object.freeze(Object.defineProperty({__proto__:null,AliasInput:Ho,AliasProvider:$s,LinePlot:zo,SelectMultiple:Uo,SelectSingle:ke,useActiveRange:wt,useAlias:ws,useAliases:Je,useContext:vs,useName:vt},Symbol.toStringTag,{value:"Module"})),Ye=d.memo(e=>{const{onResize:t,...s}=e,{root:{tabs:o,direction:r,first:i,last:c,key:u,size:x},emptyContent:m,...p}=s,j=d.useCallback(([E])=>t(u,E),[t]),{props:h}=jt({direction:r,onResize:j,count:2,initialSizes:x!=null?[x]:void 0});let g;return o!==void 0?g=n.jsxRuntimeExports.jsx(ks,{emptyContent:m,...s}):i!=null&&c!=null?g=n.jsxRuntimeExports.jsxs(Xe,{align:"stretch",className:l.CSS.BE("mosaic","resize"),...h,children:[n.jsxRuntimeExports.jsx(Ye,{...p,root:i,onResize:t},i.key),n.jsxRuntimeExports.jsx(Ye,{...p,root:c,onResize:t},c.key)]}):(g=null,console.warn("Mosaic tree is malformed")),u===1?n.jsxRuntimeExports.jsx(a.Provider$2,{children:g}):g});Ye.displayName="Mosaic";const Ge="pluto-mosaic-tab-drop",$t="pluto-mosaic-tab-create",Wo=(e,t)=>{const s=a.filterByType(Ge,t).map(i=>i.key),o=e.filter(i=>!s.includes(i.tabKey)).length>0;return a.filterByType($t,t).length>0||s.length>0&&(o||e.length===0)},ks=d.memo(({root:e,onDrop:t,onCreate:s,...o})=>{const{key:r,tabs:i}=e,[c,u]=d.useState(null),x=d.useCallback(({items:S})=>Wo(i,S),[i]),m=d.useCallback(({items:S,event:y})=>{u(null);const v=a.filterByType(Ge,S),C=i.length===0?"center":It(At(y));if(v.length>0){const w=v.map(({key:$})=>$)[0];t(r,w,C)}const R=a.filterByType($t,S);if(R.length>0){const w=R.map(({key:$})=>$);s==null||s(r,C,w)}return v},[t,i.length]),p=d.useCallback(({event:S})=>{const y=i.length===0?"center":It(At(S));u(y)},[i.length]),{startDrag:j,...h}=a.useDragAndDrop({type:"Mosaic",canDrop:x,onDrop:m,onDragOver:p}),g=d.useCallback(()=>u(null),[]),E=d.useCallback((S,{tabKey:y})=>j([{key:y,type:Ge}]),[j]),b=d.useCallback(()=>s==null?void 0:s(r,"center"),[r]);return n.jsxRuntimeExports.jsxs("div",{className:l.CSS.BE("mosaic","leaf"),children:[n.jsxRuntimeExports.jsx(X.Tabs,{tabs:i,onDragLeave:g,selected:e.selected,onDragStart:E,onCreate:b,...o,...h}),c!=null&&n.jsxRuntimeExports.jsx("div",{className:l.CSS.BE("mosaic","mask"),style:Xo[c]})]})});ks.displayName="MosaicTabLeaf";const Xo={top:{left:"0%",top:"0%",width:"100%",height:"50%"},bottom:{left:"0%",top:"50%",width:"100%",height:"50%"},left:{left:"0%",top:"0%",width:"50%",height:"100%"},right:{left:"50%",top:"0%",width:"50%",height:"100%"},center:{left:"0%",top:"0%",width:"100%",height:"100%"}},At=e=>{const t=e.currentTarget.getBoundingClientRect(),s=e.clientX-t.left,o=e.clientY-t.top;return o<24?{px:.5,py:.5}:{px:s/t.width,py:o/t.height}},Ko=e=>e,Jo=e=>1-e,It=({px:e,py:t})=>{if(e>.33&&e<.66&&t>.33&&t<.66)return"center";const[s,o]=[Ko(e),Jo(e)];if(t>s&&t>o)return"bottom";if(t<s&&t<o)return"top";if(t>s&&t<o)return"left";if(t<s&&t>o)return"right";throw new Error("[bug] - invalid insert position")},Tt=new Error("Tab not found"),Qo=new Error("Invalid Mosaic"),Ls=(e,t,s="center",o)=>{var x;if(e=me(e),o===void 0)return ct(e,t);const r=Ds(e,o);if(s==="center")return(x=r.tabs)==null||x.push(t),r.selected=t.tabKey,e;if(r.tabs==null||r.tabs.length===0)return e;const[i,c,u]=sr(s);if(r.direction=u,r[i]={key:0,tabs:[t],selected:t.tabKey},r[c]={key:0,tabs:r.tabs,selected:r.selected},r.first==null||r.last==null)throw Qo;return r.first.key=r.key*2,r.last.key=r.key*2+1,r.tabs=void 0,r.size=void 0,r.selected=void 0,e},ct=(e,t)=>(e=me(e),e.tabs!=null?(e.tabs.push(t),e.selected=t.tabKey,e):(e.first!=null?e.first=ct(e.first,t):e.last!=null&&(e.last=ct(e.last,t)),e)),He=e=>{e=me(e);const t=[];if(e.tabs!=null&&(e.selected=X.resetSelection(e.selected,e.tabs),e.selected!=null&&t.push(e.selected)),e.first!=null){const[s,o]=He(e.first);e.first=s,t.push(...o)}if(e.last!=null){const[s,o]=He(e.last);e.last=s,t.push(...o)}return[e,t]},Pt=(e,t)=>{var i;e=me(e);const[,s]=Se(e,t);if(s==null)return[e,null];s.tabs=(i=s.tabs)==null?void 0:i.filter(c=>c.tabKey!==t),s.selected=X.resetSelection(s.selected,s.tabs);const o=tr(e),r=s.selected??Ue(o);return[o,r]},Ue=e=>e.selected!=null?e.selected:e.first!=null?Ue(e.first):e.last!=null?Ue(e.last):null,Ms=(e,t)=>{e=me(e);const[s,o]=Se(e,t);if(s==null||o==null)throw Tt;return o.selected=t,e},Ns=(e,t,s,o)=>{e=me(e);const[r,i]=Se(e,t);if(r==null||i==null)throw Tt;const[c,u]=Pt(e,t);return[Ls(c,r,s,o),u]},_s=(e,t,s)=>{const o=qe(e,t);if(o==null)throw new Error("Node not found");return o.size=s,e},Bs=(e,t,s)=>{e=me(e);const[,o]=Se(e,t);if((o==null?void 0:o.tabs)==null)throw Tt;return o.tabs=X.rename(t,s,(o==null?void 0:o.tabs)??[]),e},er=e=>e.tabs!=null?e.tabs.length===0:e.first==null&&e.last==null,Ds=(e,t)=>{const s=qe(e,t);if(s!=null)return s;const o=Math.floor(t/2);return o===0?e:Ds(e,o)},tr=e=>{let t=!0;for(;t;)[e,t]=at(e);return e},at=e=>{if(e.first==null||e.last==null)return[e,!1];if(Ft(e.first))return[Zt(e.last,!0),!0];if(Ft(e.last))return[Zt(e.first,!1),!0];let[t,s]=[!1,!1];return[e.first,t]=at(e.first),[e.last,s]=at(e.last),[e,t||s]},Zt=(e,t)=>(e.size=void 0,e.key=(e.key-Number(t))/2,e),Ft=e=>e.first==null&&e.last==null&&(e.tabs==null||e.tabs.length===0),Se=(e,t)=>{if(e.tabs!=null){const c=e.tabs.find(u=>u.tabKey===t);if(c!=null)return[c,e]}if(e.first==null||e.last==null)return[void 0,void 0];const[s,o]=Se(e.first,t);if(s!=null&&o!=null)return[s,o];const[r,i]=Se(e.last,t);return[r,i]},qe=(e,t)=>{if(e.key===t)return e;if(e.first==null||e.last==null)return;const s=qe(e.first,t);return s??qe(e.last,t)},sr=e=>{switch(e){case"top":return["first","last","y"];case"left":return["first","last","x"];case"bottom":return["last","first","y"];case"right":return["last","first","x"];case"center":throw new Error("cannot split a center placed tab")}},me=e=>l.external.copy(e),nr=({allowRename:e=!1,initialTree:t})=>{const[s,o]=d.useState(t);return d.useEffect(()=>o(He(t)[0]),[t]),{root:s,onDrop:(m,p,j)=>o(h=>Ns(h,p,j,m)[0]),onClose:m=>o(p=>Pt(p,m)[0]),onSelect:m=>o(p=>Ms(p,m)),onResize:(m,p)=>o(j=>_s(j,m,p)),onRename:e?(m,p)=>o(j=>Bs(j,m,p)):void 0}},or=Object.freeze(Object.defineProperty({__proto__:null,HAUL_CREATE_TYPE:$t,HAUL_DROP_TYPE:Ge,Mosaic:Ye,autoSelectTabs:He,findSelected:Ue,insertTab:Ls,isEmpty:er,moveTab:Ns,removeTab:Pt,renameTab:Bs,resizeNode:_s,selectTab:Ms,use:nr},Symbol.toStringTag,{value:"Module"})),kt=({aetherKey:e})=>{const[,{region:t},s]=a.use$3({aetherKey:e,type:f.Eraser$1.TYPE,schema:f.eraserStateZ,initialState:{region:l.box$1.ZERO,enabled:!0}}),o=a.useSyncedRef(t),r=d.useCallback(c=>{l.box$1.equals(c,o.current)||s(u=>({...u,region:c}))},[s]);return{setEnabled:d.useCallback(c=>s(u=>({...u,enabled:c})),[s]),erase:r}},rr=a.wrap$1(f.Eraser$1.TYPE,({aetherKey:e,children:t})=>{const{erase:s}=kt({aetherKey:e}),o=a.useResize(s);return n.jsxRuntimeExports.jsx("div",{ref:o,className:l.CSS(l.CSS.inheritDims()),children:t})}),lr=Object.freeze(Object.defineProperty({__proto__:null,Eraser:rr,use:kt},Symbol.toStringTag,{value:"Module"})),ir=({items:e,initialKey:t})=>{const[s,o]=d.useState(t),r=c=>o(c===s?void 0:c),i=e.find(c=>c.key===s);return{onSelect:r,activeItem:i}},cr=a.wrap$1("Nav.Drawer",({aetherKey:e,activeItem:t,children:s,onSelect:o,location:r="left",collapseThreshold:i=.65,className:c,onResize:u,...x})=>{const m=l.location.direction(r),p=d.useCallback(()=>t!=null&&(o==null?void 0:o(t.key)),[o,t==null?void 0:t.key]),{erase:j,setEnabled:h}=kt({aetherKey:e}),g=d.useCallback((S,y)=>{u==null||u(S,y),j(y)},[u,j]);if(d.useLayoutEffect(()=>{h(t!=null)},[t,h]),t==null)return null;const{content:E,...b}=t;return n.jsxRuntimeExports.jsx(es,{className:l.CSS(l.CSS.BE("navdrawer","content"),l.CSS.dir(m),c),collapseThreshold:i,onCollapse:p,location:r,onResize:g,...b,...x,children:t.content})}),ar=({location:e="left",size:t="9rem",className:s,style:o,...r})=>{const i=l.location.construct(e),c=l.location.direction(i),u=l.direction$1.swap(c);return n.jsxRuntimeExports.jsx(N.Space,{className:l.CSS(l.CSS.B("navbar"),l.CSS.bordered(l.location.swap(i)),l.CSS.dir(u),l.CSS.loc(i),s),direction:u,style:{[l.direction$1.dimension(c)]:t,...o},align:"center",empty:!0,...r})},Me=e=>({bordered:t=!1,className:s,...o})=>n.jsxRuntimeExports.jsx(N.Space,{className:l.CSS(l.CSS.BE("navbar","content"),e==="absolute-center"?l.CSS.M(e):l.CSS.align(e),e!==""&&t&&l.CSS.bordered(e),s),align:"center",...o}),zs=Me("start");zs.displayName="NavbarStart";const Os=Me("end");Os.displayName="NavbarEnd";const Vs=Me("center");Vs.displayName="NavbarCenter";const As=Me("");As.displayName="NavbarContent";const Is=Me("absolute-center");Is.displayName="NavbarAbsoluteCenter";const ye=ar;ye.Start=zs;ye.Center=Vs;ye.End=Os;ye.AbsoluteCenter=Is;ye.Content=As;const ur=Object.freeze(Object.defineProperty({__proto__:null,Bar:ye,Drawer:cr,useDrawer:ir},Symbol.toStringTag,{value:"Module"})),ot={Close:n.jsxRuntimeExports.jsxs("svg",{width:"124",height:"124",viewBox:"0 0 124 124",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsxRuntimeExports.jsx("rect",{x:"26.8701",y:"88.3883",width:"87",height:"11",transform:"rotate(-45 26.8701 88.3883)",fill:"#7E0508"}),n.jsxRuntimeExports.jsx("rect",{x:"26.8701",y:"34.6482",width:"11",height:"87",transform:"rotate(-45 26.8701 34.6482)",fill:"#7E0508"})]}),Minimize:n.jsxRuntimeExports.jsx("svg",{width:"87",height:"11",viewBox:"0 0 87 11",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:n.jsxRuntimeExports.jsx("rect",{x:"15",width:"60",height:"11",fill:"#985712"})}),Maximize:n.jsxRuntimeExports.jsxs("svg",{width:"143",height:"143",viewBox:"0 0 143 143",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n.jsxRuntimeExports.jsx("path",{d:"M108.242 32.8833C108.797 32.8817 109.247 33.3317 109.245 33.8862L109.092 87.5891C109.09 88.4786 108.014 88.9223 107.385 88.2933L53.8351 34.7432C53.2061 34.1142 53.6499 33.0387 54.5394 33.0361L108.242 32.8833Z",fill:"#0B650D"}),n.jsxRuntimeExports.jsx("path",{d:"M33.8862 109.245C33.3317 109.247 32.8818 108.797 32.8833 108.242L33.0361 54.5394C33.0387 53.6499 34.1142 53.2061 34.7432 53.8351L88.2934 107.385C88.9223 108.014 88.4786 109.09 87.5891 109.092L33.8862 109.245Z",fill:"#0B650D"})]})},xr=({disabled:e=[],className:t,focused:s=!0,onMinimize:o,onMaximize:r,onFullscreen:i,onClose:c,...u})=>n.jsxRuntimeExports.jsxs(N.Space,{size:1.5,direction:"x",className:l.CSS(l.CSS.B("macos-controls"),!s&&l.CSS.BM("macos-controls","blurred"),t),...u,children:[n.jsxRuntimeExports.jsx(rt,{onClick:c,className:l.CSS.BM("macos-control","close"),disabled:e.includes("close"),children:ot.Close}),n.jsxRuntimeExports.jsx(rt,{onClick:o,className:l.CSS.BM("macos-control","minimize"),disabled:e.includes("minimize"),children:ot.Minimize}),n.jsxRuntimeExports.jsx(rt,{onClick:i,className:l.CSS.BM("macos-control","maximize"),disabled:e.includes("maximize"),children:ot.Maximize})]}),rt=({className:e,...t})=>n.jsxRuntimeExports.jsx("button",{className:l.CSS(l.CSS.B("macos-control"),e),tabIndex:-1,size:"",...t}),lt=({disabled:e=[],onMinimize:t,onMaximize:s,onClose:o,onFullscreen:r,...i})=>n.jsxRuntimeExports.jsxs(N.Pack,{...i,children:[n.jsxRuntimeExports.jsx(it,{className:l.CSS.BM("windows-control","minimize"),onClick:t,disabled:e.includes("minimize"),children:n.jsxRuntimeExports.jsx(a.u0.Subtract,{})}),n.jsxRuntimeExports.jsx(it,{className:l.CSS.BM("windows-control","maximize"),onClick:s,disabled:e.includes("maximize"),children:n.jsxRuntimeExports.jsx(a.u0.Box,{})}),n.jsxRuntimeExports.jsx(it,{onClick:o,className:l.CSS.BM("windows-control","close"),disabled:e.includes("close"),children:n.jsxRuntimeExports.jsx(a.u0.Close,{})})]}),it=({disabled:e=!1,className:t,...s})=>e?null:n.jsxRuntimeExports.jsx(a.Icon,{className:l.CSS(l.CSS.B("windows-control"),t),tabIndex:-1,...s}),Zs=e=>l.external$1.getOS(e),dr={MacOS:xr,Windows:lt,Linux:lt,Docker:lt},pr="Windows",mr=({forceOS:e,visibleIfOS:t,...s})=>{const o=Zs({force:e,default:pr}),r=dr[o];return t!=null&&t!==o?null:n.jsxRuntimeExports.jsx(r,{...s})},jr=Object.freeze(Object.defineProperty({__proto__:null,Controls:mr,use:Zs},Symbol.toStringTag,{value:"Module"}));var ee;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(ee||(ee={}));function fr({color:e,dimensions:t,lineWidth:s}){return d.createElement("path",{stroke:e,strokeWidth:s,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function hr({color:e,radius:t}){return d.createElement("circle",{cx:t,cy:t,r:t,fill:e})}const gr={[ee.Dots]:"#91919a",[ee.Lines]:"#eee",[ee.Cross]:"#e2e2e2"},Er={[ee.Dots]:1,[ee.Lines]:1,[ee.Cross]:6},Sr=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Fs({id:e,variant:t=ee.Dots,gap:s=20,size:o,lineWidth:r=1,offset:i=2,color:c,style:u,className:x}){const m=d.useRef(null),{transform:p,patternId:j}=f.useStore(Sr,f.shallow$1),h=c||gr[t],g=o||Er[t],E=t===ee.Dots,b=t===ee.Cross,S=Array.isArray(s)?s:[s,s],y=[S[0]*p[2]||1,S[1]*p[2]||1],v=g*p[2],C=b?[v,v]:y,R=E?[v/i,v/i]:[C[0]/i,C[1]/i];return d.createElement("svg",{className:f.cc(["react-flow__background",x]),style:{...u,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:m,"data-testid":"rf__background"},d.createElement("pattern",{id:j+e,x:p[0]%y[0],y:p[1]%y[1],width:y[0],height:y[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${R[0]},-${R[1]})`},E?d.createElement(hr,{color:h,radius:v/i}):d.createElement(fr,{dimensions:C,color:h,lineWidth:r})),d.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${j+e})`}))}Fs.displayName="Background";var Rr=d.memo(Fs);const Yt=({sourcePos:e,targetPos:t,next:s,prev:o})=>{const r=Pe(e,...s);return l.xy.distance(r,t)<1?!0:(console.warn("Connector is out of sync with target"),console.log("Theoretical target",r),console.log("Actual target",t),console.log("Segments",s),console.log("Prev segments",o),!1)},Gt=({sourceStumpTip:e,sourceOrientation:t,sourceBox:s,targetStumpTip:o,targetOrientation:r,targetBox:i})=>{if(!br({sourcePos:e,sourceOrientation:t,targetPos:o}))return;const c=l.direction$1.construct(t),u=l.direction$1.swap(c);let x=xe(u,o[u]-e[u]);const m=l.box$1.loc(s,x);if(l.location.swap(t)===r){const p=l.box$1.loc(i,l.location.swap(x));Math.abs(m-p)<J&&(x=l.location.swap(x))}return{direction:u,length:m-e[u]+pe(x,J)}},Pe=(e,...t)=>{let s=e;for(const o of t)s=l.xy.translate(s,o.direction,o.length);return s},Ys=(e,t,s,o)=>{try{let r=e;const i=[e,...t.map(h=>(r=l.xy.translate(r,h.direction,h.length),r))];if(!o)return i;const c=t[0],u=xe(c.direction,c.length),x=Ht(u);i[0]=l.xy.translate(i[0],{[c.direction]:-1*x*4*s,[l.direction$1.swap(c.direction)]:0});const m=t[t.length-1],p=xe(m.direction,m.length),j=Ht(p);return i[i.length-1]=l.xy.translate(i[i.length-1],{[m.direction]:j*4*s,[l.direction$1.swap(m.direction)]:0}),i}catch{return[]}},J=10,Ht=e=>e==="top"||e==="left"?-1:1,pe=(e,t)=>e==="top"||e==="left"?-t:t,xe=(e,t)=>e==="x"?t>0?"right":"left":t>0?"bottom":"top",ie=e=>xe(e.direction,e.length),br=({sourcePos:e,targetPos:t,sourceOrientation:s})=>{const o=l.direction$1.construct(s),r=t[o]-e[o];return pe(s,r)<0},De=e=>({direction:l.direction$1.construct(e),length:pe(e,J)}),Ut={top:De("top"),bottom:De("bottom"),left:De("left"),right:De("right")},yr=4,Cr=.25,Qe=e=>ut(vr(ut(e))),vr=e=>{const t=[...e],s=e.findIndex((o,r)=>{const i=Math.abs(o.length);if(i<yr){if(i<Cr)return!0;if(r===0||r===e.length-1||e.length<=3)return!1;if(r+2<e.length){const c=t[r+2];if(c.direction!==o.direction)return!1;t[r+2]={...c,length:c.length+o.length}}else{const c=t[r-2];if(c.direction!==o.direction)return!1;t[r-2]={...c,length:c.length+o.length}}return!0}return!1});return s!==-1&&t.splice(s,1),t},ut=e=>{const t=[...e];return e.findIndex((o,r)=>{const i=t[r-1];if(r===0||o.direction!==i.direction)return!1;if(r===1){const c=r-1,u=r,x=ie(i),m=ie(o);if(x===m)return t[r-1]={direction:t[r-1].direction,length:t[r-1].length+t[r].length},t.splice(r,1),!0;if(Math.abs(i.length)===J)return!1;const p=pe(x,J),j=t[c].length-p,h=t[u].length+j;return Math.abs(h)<J?!1:(t[c]={...t[c],length:p},t[u]={...t[u],length:h},!0)}if(r===e.length-1){const c=r,u=r-1,x=ie(o),m=ie(i);if(x===m)return t[r-1]={direction:t[r-1].direction,length:t[r-1].length+t[r].length},t.splice(r,1),!0;if(Math.abs(o.length)===J)return!1;const p=pe(x,J),j=t[c].length-p,h=t[u].length+j;return Math.abs(h)<J?!1:(t[c]={...t[c],length:p},t[u]={...t[u],length:h},!0)}return t[r-1]={direction:t[r-1].direction,length:t[r-1].length+t[r].length},t.splice(r,1),!0})!==-1?ut(t):t},Ee=e=>Qe(wr(e)),wr=({sourceBox:e,targetBox:t,sourcePos:s,targetPos:o,targetOrientation:r,sourceOrientation:i})=>{let c=i,u=r,x={...Ut[i]},m=Pe(s,x);const p={...Ut[r]};let j=Pe(o,p);const h=[x],g=Gt({sourceStumpTip:m,sourceOrientation:i,sourceBox:e,targetStumpTip:j,targetOrientation:r,targetBox:t});g!=null&&(h.push(g),m=Pe(m,g),c=ie(g),x=g);const E=Gt({sourceStumpTip:j,sourceOrientation:u,sourceBox:t,targetStumpTip:m,targetOrientation:c,targetBox:e});E!=null&&(j=Pe(j,E),u=xe(E.direction,E.length));const b=()=>{E!=null&&(E.length*=-1,h.push(E)),p.length*=-1,h.push(p)};if(l.location.swap(c)===r){const w=l.direction$1.construct(c),$=(j[w]-m[w])/2;h.push({direction:w,length:$});const _=l.direction$1.swap(w);return h.push({direction:_,length:j[_]-m[_]}),h.push({direction:w,length:$}),b(),h}const S=j[x.direction]-m[x.direction];let y=l.direction$1.swap(x.direction);const v=m[y]-j[y];let C;xe(x.direction,S)===c&&xe(y,v)===u?C={direction:x.direction,length:S}:(C={direction:y,length:j[y]-m[y]},y=l.direction$1.swap(y)),h.push(C);const R={direction:y,length:j[y]-m[y]};return h.push(R),b(),h},$r=e=>Qe(Tr(e)),Tr=({segments:e,index:t,magnitude:s})=>{const o=[...e],r=o[t],i=l.direction$1.swap(r.direction),c=ie(r);if(t===0){o.unshift({direction:i,length:s});const u=pe(c,J);o.unshift({direction:r.direction,length:u}),t+=2,o[t]={...o[t],length:o[t].length-u}}else o[t-1]={direction:o[t-1].direction,length:o[t-1].length+s};if(t===o.length-1){o.push({direction:i,length:-s});const u=pe(c,J);o.push({direction:r.direction,length:u}),o[t]={...o[t],length:o[t].length-u}}else o[t+1]={direction:o[t+1].direction,length:o[t+1].length-s};return o},Pr=(e,t)=>{for(let s=e.length-1;s>=0;s--)if(t(e[s],s))return s;return-1},kr=(e,t,s=!1,...o)=>{const r=(i,c)=>!o.includes(c)&&t(i,c);return s?Pr(e,r):e.findIndex(r)},Lr=({delta:e,segments:t})=>Qe(Gs(e,t,!1)),Mr=({delta:e,segments:t})=>Qe(Gs(e,t,!0)),Gs=(e,t,s)=>{let o=[...t];return e.x!==0&&(o=Wt("x",e,o,s)),e.y!==0&&(o=Wt("y",e,o,s)),o},qt=(e,t,s)=>{if(t.direction!==e)return!1;const o={...t,length:t.length-s[e]},r=ie(t),i=ie(o);return Math.abs(o.length)>J&&r===i},Wt=(e,t,s,o)=>{const r=l.direction$1.swap(e),i=o?s.length-1:0,c=s[i];if(qt(e,c,t))return s[i]={...c,length:c.length-t[e]},s;const u=o?0:s.length-1,m=kr(s,j=>j.direction===e,o,i);if(m===u){const j=s[u];return qt(e,j,t)?(s[u]={...j,length:j.length-t[e]},s):(c.direction===e?s[i]={...c,length:c.length-t[e]}:s[u]={...j,length:j.length-t[e]},s)}if(m===-1)return s.length===1?s[0].direction===e?[{direction:e,length:s[0].length-t[e]}]:[{direction:r,length:s[0].length/2},{direction:e,length:-t[e]},{direction:r,length:s[0].length/2}]:c.direction===e?(s[i]={...c,length:c.length-t[e]},s):[{direction:r,length:s[0].length},{direction:e,length:-t[e]},...s.slice(1)];const p=s[m];return s[m]={...p,length:p.length-t[e]},s},Lt=e=>{const t=document.querySelector(`[data-id="${e}"]`);if(t==null)throw new Error(`[pid] - cannot find node with key: ${e}`);return t},q=(e,t)=>{const s=Lt(t),o=e.getNodes().find(r=>r.id===t);if(o==null)throw new Error(`[pid] - cannot find node with key: ${t}`);return l.box$1.construct(o.position,l.box$1.dims(l.box$1.construct(s)))},Nr=(e,t)=>et.fromFlow(e,t);class Hs{constructor(t,s){ue(this,"node_",null);ue(this,"position");ue(this,"orientation");this.position=t,this.orientation=s}set node(t){this.node_=t}get node(){if(this.node_==null)throw new Error("[pid] - handle has no node");return this.node_}get absolutePosition(){return l.xy.translate(l.box$1.topLeft(this.node.box),this.position)}}class et{constructor(t,s,o){ue(this,"key");ue(this,"box");ue(this,"handles");this.key=t,this.box=s,this.handles=o,o.forEach(r=>r.node=this)}static fromFlow(t,s){const o=q(s,t),r=Lt(t),i=r.getElementsByClassName("react-flow__handle"),c=l.box$1.construct(r),u=Array.from(i).map(x=>{const m=l.box$1.center(l.box$1.construct(x)),p=l.xy.translation(l.box$1.topLeft(c),m),j=x.className.match(/react-flow__handle-(\w+)/);if(j==null)throw new Error("[pid] - cannot find handle orientation");const h=l.location.construct(j[0]);return new Hs(p,h)});return new et(t,o,u)}}const _r=({fromX:e,fromY:t,toX:s,toY:o,fromPosition:r,toPosition:i,fromNode:c,connectionLineStyle:u,connectionStatus:x})=>{const m=document.querySelector(".react-flow__handle-connecting"),p=m==null?void 0:m.className.match(/react-flow__handle-(\w+)/);if(p!=null){const E=l.location.outer.safeParse(p[1]);E.success&&(i=E.data)}const j=Ee({sourcePos:l.xy.construct(e,t),targetPos:l.xy.construct(s,o),sourceOrientation:r,targetOrientation:i,sourceBox:q(f.useReactFlow(),(c==null?void 0:c.id)??""),targetBox:q(f.useReactFlow(),(c==null?void 0:c.id)??"")}),h=f.useReactFlow(),g=Ys(l.xy.construct(e,t),j,h.getZoom(),!1);return n.jsxRuntimeExports.jsx(f.BaseEdge,{path:Us(g),style:{...u,stroke:l.cssString(x==="invalid"?"var(--pluto-error-z)":"var(--pluto-gray-l9)"),strokeWidth:2,fill:"none"}})},Br=({id:e,source:t,target:s,sourcePosition:o,targetHandleId:r,targetPosition:i,style:c,segments:u=[],onSegmentsChange:x,color:m="var(--pluto-gray-l9)",selected:p=!1,...j})=>{const h=l.xy.construct(j.sourceX,j.sourceY),g=d.useRef(h),E=l.xy.equals(h,g.current),b=l.xy.construct(j.targetX,j.targetY),S=d.useRef(b),y=l.xy.equals(b,S.current),v=f.useReactFlow(),[C,R,w]=a.useCombinedStateAndRef(()=>u.length>0?u:Ee({sourcePos:h,targetPos:b,sourceOrientation:o,targetOrientation:i,sourceBox:q(v,t),targetBox:q(v,s)})),$=d.useRef(i),_=d.useRef(o),B=a.useDebouncedCallback(x,100,[x]);if(!E||!y){let L=C;const M=l.xy.translation(g.current,h),V=l.xy.translation(b,S.current);l.xy.equals(M,l.xy.scale(V,-1),.001)?(g.current=h,S.current=b):(E?y||(L=Mr({delta:V,segments:L}),$.current!==i&&($.current=i,L=Ee({sourcePos:h,targetPos:b,sourceOrientation:o,targetOrientation:i,sourceBox:q(v,t),targetBox:q(v,s)})),Yt({sourcePos:h,targetPos:b,next:L,prev:C})||(L=Ee({sourcePos:h,targetPos:b,sourceOrientation:o,targetOrientation:i,sourceBox:q(v,t),targetBox:q(v,s)})),S.current=b):(L=Lr({delta:M,segments:L}),_.current!==o&&(_.current=o,L=Ee({sourcePos:h,targetPos:b,sourceOrientation:o,targetOrientation:i,sourceBox:q(v,t),targetBox:q(v,s)})),Yt({sourcePos:h,targetPos:b,next:L,prev:C})||(L=Ee({sourcePos:h,targetPos:b,sourceOrientation:o,targetOrientation:i,sourceBox:q(v,t),targetBox:q(v,s)})),g.current=h),B(L),R(L))}const P=d.useRef(null),O=Ke({onStart:d.useCallback((L,M,V)=>{P.current={index:Number(V.currentTarget.id.split("-")[1]),segments:[...w.current]}},[]),onMove:d.useCallback(L=>{if(P.current==null)return;const M=$r({segments:P.current.segments,index:P.current.index,magnitude:l.box$1.dim(L,l.direction$1.swap(P.current.segments[P.current.index].direction),!0)/v.getZoom()});R(M)},[]),onEnd:d.useCallback(()=>x(w.current),[x])}),z=Ys(h,C,v.getZoom(),!0);return n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx(f.BaseEdge,{path:Us(z),style:{...c,stroke:l.cssString(m)},...j}),p&&Dr(z).map((L,M)=>{const V=C[M].direction,Q=l.direction$1.swap(V),re={[l.direction$1.dimension(V)]:"18px",[l.direction$1.dimension(Q)]:"4px"},he={[V]:L[V]-9,[Q]:L[Q]-2};return n.jsxRuntimeExports.jsxs(d.Fragment,{children:[n.jsxRuntimeExports.jsx("rect",{className:l.CSS.BE("diagram-edge-handle","background"),fill:"var(--pluto-gray-l0)",stroke:"var(--pluto-primary-z)",...re,...he,rx:"2px",ry:"2px"}),n.jsxRuntimeExports.jsx("foreignObject",{x:L.x-9,y:L.y-9,width:"18px",height:"18px",children:n.jsxRuntimeExports.jsx("div",{id:`handle-${M}`,className:l.CSS(l.CSS.BE("diagram-edge-handle","dragger"),l.CSS.dir(V)),draggable:!0,onDragStart:O})})]},M)})]})},Us=e=>{let t="";const o=e.length+-1;for(let r=0;r<o;r++){const i=e[r%e.length],c=e[(r+1)%e.length],u=Math.min(6/Math.hypot(c.x-i.x,c.y-i.y),.5);r>0&&(t+=`Q${i.x},${i.y} ${i.x*(1-u)+c.x*u},${i.y*(1-u)+c.y*u}`),r===0?t+=`M${i.x},${i.y}`:r===0&&(t+=`M${i.x*(1-u)+c.x*u},${i.y*(1-u)+c.y*u}`),r===o-1?t+=`L${c.x},${c.y}`:r<o-1&&(t+=`L${i.x*u+c.x*(1-u)},${i.y*u+c.y*(1-u)}`)}return t},Dr=e=>e.slice(1).map((t,s)=>{const o=e[s];return l.xy.construct((t.x+o.x)/2,(t.y+o.y)/2)}),zr=({initialNodes:e,initialEdges:t,allowEdit:s=!0,initialViewport:o={position:l.xy.ZERO,zoom:1}})=>{const[r,i]=d.useState(s),[c,u]=d.useState(e),[x,m]=d.useState(t),[p,j]=d.useState(o);return{viewport:p,onViewportChange:j,edges:x,nodes:c,onNodesChange:u,onEdgesChange:m,editable:r,onEditableChange:i}},Or=e=>e.source!==e.target,Vr={nodesDraggable:!0,nodesConnectable:!0,elementsSelectable:!0,zoomOnDoubleClick:!1},Ar={connectionRadius:0,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,panOnDrag:!1,panOnScroll:!1,zoomOnScroll:!1,zoomOnDoubleClick:!1,zoomOnPinch:!1,edgesFocusable:!1,edgesUpdatable:!1,nodesFocusable:!1,edgeUpdaterRadius:0},qs={padding:0,maxZoom:1,minZoom:.5},Ir={hideAttribution:!0},Ws=d.createContext({editable:!0,onEditableChange:()=>{},registerNodeRenderer:()=>{}}),tt=()=>d.useContext(Ws),Xs=d.memo(({children:e})=>{const{registerNodeRenderer:t}=tt();return d.useEffect(()=>t(e),[t,e]),null});Xs.displayName="NodeRenderer";const Zr=a.wrap$1(f.Diagram$1.TYPE,({aetherKey:e,children:t,onNodesChange:s,onEdgesChange:o,nodes:r,edges:i,onEditableChange:c,editable:u,viewport:x,triggers:m,onViewportChange:p,...j})=>{const[{path:h},,g]=a.use$3({aetherKey:e,type:f.Diagram$1.TYPE,schema:f.diagramStateZ,initialState:{position:x.position,region:l.box$1.ZERO,zoom:x.zoom}}),E=a.use().colors.gray.l9.hex,b=a.useMemoCompare(()=>m??St.zoom,a.compareModeConfigs,[m]),{fitView:S}=f.useReactFlow(),y=ft(d.useCallback(D=>{g(A=>({...A,region:D}))},[g])),v=d.useRef(null),C=d.useCallback(D=>{const A=v.current;A!=null&&A.x===D.x&&A.y===D.y&&A.zoom===D.zoom||(v.current=D,g(U=>({...U,position:D,zoom:D.zoom})),p(f.translateViewportBackward(D)))},[g,p]);f.useOnViewportChange({onStart:C,onChange:C,onEnd:C});const[R,w]=d.useState(()=>()=>null),$=d.useCallback(D=>w(()=>D),[]),_=d.useMemo(()=>({custom:({id:D,xPos:A,yPos:U,selected:Te})=>R({symbolKey:D,position:{x:A,y:U},selected:Te})}),[R]),B=d.useRef(i),P=d.useMemo(()=>(B.current=i,f.translateEdgesForward(i)),[i]),O=d.useRef(r),z=d.useMemo(()=>(O.current=r,f.translateNodesForward(r)),[r]),L=d.useCallback(D=>s(f.nodeConverter(O.current,A=>f.applyNodeChanges(D,A))),[s]),M=d.useCallback(D=>o(f.edgeConverter(B.current,A=>f.applyEdgeChanges(D,A),E)),[o,E]),V=d.useCallback((D,A)=>o(f.edgeConverter(B.current,U=>f.updateEdge(D,A,U),E)),[]),Q=d.useCallback(D=>{o(f.edgeConverter(B.current,A=>f.addEdge(D,A),E))},[o,E]),re=d.useCallback((D,A)=>{const U=[...B.current],Te=U.findIndex(Mn=>Mn.key===D);Te!==-1&&(U[Te]={...U[Te],segments:A},B.current=U,o(U))},[o]),he=u?Vr:Ar,ae=d.useMemo(()=>({default:D=>n.jsxRuntimeExports.jsx(Br,{...D,segments:D.data.segments,color:D.data.color,onSegmentsChange:d.useCallback(A=>re(D.id,A),[D.id])},D.id)}),[re]),K=d.useRef(null);a.use$2({triggers:b.zoomReset,callback:d.useCallback(({stage:D,cursor:A})=>{const U=K.current;U==null||D!=="start"||!l.box$1.contains(U,A)||S()},[S])});const ge=a.purgeMouse(b.select)[0]??null,Be=a.purgeMouse(b.pan)[0]??null,Pn=a.purgeMouse(b.zoom)[0]??null,kn={selectionOnDrag:ge==null,panOnDrag:Be==null,selectionKeyCode:ge,panActivationKeyCode:Be,zoomActivationKeyCode:Pn},Ln=a.useCombinedRefs(K,y);return n.jsxRuntimeExports.jsx(Ws.Provider,{value:{editable:u,onEditableChange:c,registerNodeRenderer:$},children:n.jsxRuntimeExports.jsx(a.Composite,{path:h,children:n.jsxRuntimeExports.jsx(f.ReactFlow,{...kn,className:l.CSS(l.CSS.B("diagram"),l.CSS.editable(u)),nodes:z,edges:P,nodeTypes:_,edgeTypes:ae,ref:Ln,fitView:!0,onNodesChange:L,onEdgesChange:M,onConnect:Q,onEdgeUpdate:V,defaultViewport:f.translateViewportForward(x),connectionLineComponent:_r,elevateEdgesOnSelect:!0,minZoom:.5,maxZoom:1.2,isValidConnection:Or,connectionMode:f.ConnectionMode.Loose,snapGrid:[3,3],fitViewOptions:qs,selectionMode:f.SelectionMode.Partial,proOptions:Ir,...j,style:{[l.CSS.var("diagram-zoom")]:x.zoom,...j.style},...he,children:t})})})}),Fr=()=>{const{editable:e}=tt();return e?n.jsxRuntimeExports.jsx(Rr,{}):null},Yr=({children:e,...t})=>n.jsxRuntimeExports.jsx(N.Pack,{direction:"y",className:l.CSS.BE("diagram","controls"),...t,children:e}),Gr=({onClick:e,...t})=>{const{editable:s,onEditableChange:o}=tt();return n.jsxRuntimeExports.jsx(a.ToggleIcon,{onChange:()=>o(!s),value:s,uncheckedVariant:"outlined",checkedVariant:"filled",tooltipLocation:l.location.RIGHT_CENTER,tooltip:s?n.jsxRuntimeExports.jsx(a.Text,{level:"small",children:"Disable edit mode"}):n.jsxRuntimeExports.jsx(a.Text,{level:"small",children:"Enable edit mode"}),...t,children:s?n.jsxRuntimeExports.jsx(a.u0.EditOff,{}):n.jsxRuntimeExports.jsx(a.u0.Edit,{})})},Hr=({onClick:e,...t})=>{const{fitView:s}=f.useReactFlow();return n.jsxRuntimeExports.jsx(a.Icon,{onClick:o=>{s(qs),e==null||e(o)},tooltip:n.jsxRuntimeExports.jsx(a.Text,{level:"small",children:"Fit view to contents"}),tooltipLocation:l.location.RIGHT_CENTER,variant:"outlined",...t,children:n.jsxRuntimeExports.jsx(a.u0.Expand,{})})},Ur=e=>n.jsxRuntimeExports.jsx(f.ReactFlowProvider,{children:n.jsxRuntimeExports.jsx(Zr,{...e})}),qr=(e,t="x")=>{if(e.length===0)return[];const s=l.location.construct(t),o=l.location.swap(s);return e.sort((r,i)=>l.box$1.loc(r.box,s)-l.box$1.loc(i.box,s)),e.forEach((r,i)=>{if(i===0)return;const u=e[i-1].handles.find(g=>g.orientation===o),x=r.handles.find(g=>g.orientation===s);if(u==null||x==null)return;const m=u.absolutePosition,p=x.absolutePosition,j=l.xy.set(l.xy.translation(p,m),t,0),h=l.xy.translate(l.box$1.topLeft(r.box),j);r.box=l.box$1.construct(h,l.box$1.dims(r.box))}),e},Wr=Object.freeze(Object.defineProperty({__proto__:null,Background:Fr,Controls:Yr,Diagram:Ur,FitViewControl:Hr,HandleLayout:Hs,NodeLayout:et,NodeRenderer:Xs,ToggleEditControl:Gr,alignNodes:qr,selectNode:Lt,selectNodeBox:q,selectNodeLayout:Nr,use:zr,useContext:tt},Symbol.toStringTag,{value:"Module"})),Xr=({aetherKey:e,...t})=>a.use$3({aetherKey:e,type:f.Table.TYPE,schema:f.tableStateZ,initialState:t}),Kr=a.wrap$1(f.Table.TYPE,({aetherKey:e,numColumns:t,children:s,className:o,...r})=>{const[{path:i},,c]=a.use$3({aetherKey:e,type:f.Table.TYPE,schema:f.tableStateZ,initialState:{region:l.box$1.ZERO,widths:Array(t).fill(0)}}),u=d.useCallback(p=>c(j=>({...j,region:p})),[c]),x=d.useCallback((p,j)=>c(h=>({...h,widths:h.widths.map((g,E)=>E===p?j:g)})),[c]),m=a.useResize(u);return n.jsxRuntimeExports.jsx("table",{ref:m,className:l.CSS(l.CSS.B("table"),o),...r,children:n.jsxRuntimeExports.jsxs("tbody",{children:[n.jsxRuntimeExports.jsx(a.Composite,{path:i,children:s}),n.jsxRuntimeExports.jsx("tr",{className:l.CSS.BE("table","virtual-row"),children:Array(t).fill(0).map((p,j)=>n.jsxRuntimeExports.jsx(Jr,{index:j,onResize:x},j))})]})})}),Jr=({onResize:e,index:t})=>{const s=d.useCallback(r=>e(t,l.box$1.width(r)),[e,t]),o=a.useResize(s);return n.jsxRuntimeExports.jsx("td",{ref:o,className:l.CSS.BE("table","virtual-cell")})},Qr=["y"],el=a.wrap$1(f.TR.TYPE,({aetherKey:e,children:t})=>{const[{path:s},,o]=a.use$3({aetherKey:e,type:f.TR.TYPE,schema:f.trStateZ,initialState:{height:0}}),r=d.useCallback(c=>o(u=>({...u,height:l.box$1.height(c)})),[o]),i=a.useResize(r,{triggers:Qr});return n.jsxRuntimeExports.jsx("tr",{ref:i,children:n.jsxRuntimeExports.jsx(a.Composite,{path:s,children:t})})}),tl=a.wrap$1(f.StringTD.TYPE,({aetherKey:e,telem:t})=>(a.use$3({aetherKey:e,type:f.StringTD.TYPE,schema:f.stringTDStateZ,initialState:{stringSource:t}}),n.jsxRuntimeExports.jsx("td",{style:{height:20}}))),sl=Object.freeze(Object.defineProperty({__proto__:null,StringTD:tl,TR:el,Table:Kr,use:Xr},Symbol.toStringTag,{value:"Module"})),nl=({onChange:e,className:t,onSelect:s,...o})=>n.jsxRuntimeExports.jsx("td",{className:l.CSS(l.CSS.BE("table","label")),onDoubleClick:s,children:n.jsxRuntimeExports.jsx(a.Editable,{...o,onChange:r=>{e({...o,value:r})}})}),ol=({value:e,onChange:t})=>n.jsxRuntimeExports.jsx("h1",{children:"Hello"}),Ks=e=>({value:"Label",level:"p"}),xt={type:"label",title:"Label",initialProps:Ks,Cell:nl,Form:ol},rl={[xt.type]:xt},ll=Object.freeze(Object.defineProperty({__proto__:null,LabelSpec:xt,REGISTRY:rl,initialProps:Ks},Symbol.toStringTag,{value:"Module"})),il=f.Value.z.omit({font:!0}).partial({color:!0}).extend({level:G.levelZ.optional()}),Js=({aetherKey:e,box:t,telem:s,color:o,precision:r,minWidth:i,level:c="small"})=>{const u=a.useMemoDeepEqualProps({box:t,telem:s,color:o,precision:r,level:c,minWidth:i}),[,x,m]=a.use$3({aetherKey:e,type:f.Value.TYPE,schema:f.Value.z,initialState:u});return d.useLayoutEffect(()=>m(p=>({...p,...u})),[u]),{width:x.width??x.minWidth}},cl=Object.freeze(Object.defineProperty({__proto__:null,corePropsZ:il,use:Js},Symbol.toStringTag,{value:"Module"})),al=({value:e,onChange:t})=>{const{inner:s,outer:o}=e,r=i=>()=>t({...e,...i});return n.jsxRuntimeExports.jsxs(N.Space,{className:l.CSS.B("orientation-control"),align:"center",justify:"center",size:.5,children:[n.jsxRuntimeExports.jsx(le,{selected:o==="top",onClick:r({outer:"top"})}),n.jsxRuntimeExports.jsxs(N.Space,{direction:"x",align:"center",justify:"center",size:.5,children:[n.jsxRuntimeExports.jsx(le,{selected:o==="left",onClick:r({outer:"left"})}),n.jsxRuntimeExports.jsxs(N.Space,{className:l.CSS.B("value"),direction:"y",align:"center",justify:"center",empty:!0,children:[n.jsxRuntimeExports.jsx(le,{className:l.CSS(l.CSS.dir("y")),selected:s==="top",onClick:r({inner:"top"})}),n.jsxRuntimeExports.jsxs(N.Space,{direction:"x",align:"center",justify:"center",children:[n.jsxRuntimeExports.jsx(le,{selected:s==="left",onClick:r({inner:"left"})}),n.jsxRuntimeExports.jsx(le,{selected:s==="right",onClick:r({inner:"right"})})]}),n.jsxRuntimeExports.jsx(le,{className:l.CSS(l.CSS.dir("y")),selected:s==="bottom",onClick:r({inner:"bottom"})})]}),n.jsxRuntimeExports.jsx(le,{selected:o==="right",onClick:r({outer:"right"})})]}),n.jsxRuntimeExports.jsx(le,{selected:o==="bottom",onClick:r({outer:"bottom"})})]})},le=({selected:e,className:t,...s})=>n.jsxRuntimeExports.jsx(a.Icon,{variant:"text",className:l.CSS(t,l.CSS.selected(e)),...s,children:n.jsxRuntimeExports.jsx("div",{className:"symbol"})}),Mt=[{tabKey:"style",name:"Style"},{tabKey:"control",name:"Control"}],oe=({className:e,direction:t,...s})=>n.jsxRuntimeExports.jsx(N.Space,{direction:t,align:"stretch",className:l.CSS(l.CSS.B("symbol-form"),e),size:t==="x"?"large":"medium",...s}),Ce=({value:e,onChange:t})=>{var s;return n.jsxRuntimeExports.jsx(H.Item,{label:"Orientation",children:n.jsxRuntimeExports.jsx(al,{value:{inner:e.orientation??"top",outer:((s=e.label)==null?void 0:s.orientation)??"top"},onChange:o=>t({orientation:o.inner,label:{...e.label,orientation:o.outer}})})})},ve=({value:{label:e},onChange:t})=>n.jsxRuntimeExports.jsxs(N.Space,{direction:"x",children:[n.jsxRuntimeExports.jsx(H.Item,{label:"Label",grow:!0,children:n.jsxRuntimeExports.jsx(a.Text$1,{value:(e==null?void 0:e.label)??"",onChange:s=>t({label:{...e,label:s}})})}),n.jsxRuntimeExports.jsx(H.Item,{label:"Label Size",children:n.jsxRuntimeExports.jsx(ne.SelectLevel,{value:(e==null?void 0:e.level)??"p",onChange:s=>t({label:{...e,level:s}})})})]}),Ne=({value:e,onChange:t})=>n.jsxRuntimeExports.jsx(H.Item,{label:"Color",align:"start",children:n.jsxRuntimeExports.jsx(pt.Swatch,{value:e.color??l.ZERO.setAlpha(1).rgba255,onChange:s=>t({color:s.rgba255})})}),Qs=({value:e,onChange:t})=>{var x,m;const s=f.sourcePipelinePropsZ.parse((x=e.source)==null?void 0:x.props),o=f.sinkPipelinePropsZ.parse((m=e.sink)==null?void 0:m.props),r=f.streamChannelValuePropsZ.parse(s.segments.valueStream.props),i=f.setChannelValuePropsZ.parse(o.segments.setter.props),c=p=>{p=p??0;const j=f.sourcePipeline("boolean",{connections:[{from:"valueStream",to:"threshold"}],segments:{valueStream:f.streamChannelValue({channel:p}),threshold:f.withinBounds({trueBound:{lower:.9,upper:1.1}})},outlet:"threshold"});t({...e,source:j})},u=p=>{p=p??0;const j=f.sinkPipeline("boolean",{connections:[{from:"setpoint",to:"setter"}],segments:{setter:f.setChannelValue({channel:p}),setpoint:f.setpoint({truthy:1,falsy:0})},inlet:"setpoint"}),h=f.authoritySource({channel:p}),g=f.acquireChannelControl({channel:p,authority:255});t({...e,sink:j,control:{...e.control,showChip:!0,chip:{sink:g,source:h},showIndicator:!0,indicator:{statusSource:h}}})};return n.jsxRuntimeExports.jsxs(oe,{direction:"y",children:[n.jsxRuntimeExports.jsx(H.Item,{label:"Input Channel",children:n.jsxRuntimeExports.jsx(ke,{value:r.channel,onChange:c})}),n.jsxRuntimeExports.jsx(H.Item,{label:"Output Channel",children:n.jsxRuntimeExports.jsx(ke,{value:i.channel,onChange:u})})]})},we=({value:e,onChange:t})=>{const s=d.useCallback(({tabKey:r})=>{switch(r){case"control":return n.jsxRuntimeExports.jsx(Qs,{value:e,onChange:t});default:return n.jsxRuntimeExports.jsxs(oe,{direction:"x",align:"stretch",children:[n.jsxRuntimeExports.jsxs(N.Space,{direction:"y",grow:!0,children:[n.jsxRuntimeExports.jsx(ve,{value:e,onChange:t}),n.jsxRuntimeExports.jsx(Ne,{value:e,onChange:t})]}),n.jsxRuntimeExports.jsx(Ce,{value:e,onChange:t})]})}},[e,t]),o=X.useStatic({tabs:Mt,content:s});return n.jsxRuntimeExports.jsx(X.Tabs,{...o})},ul=({value:e,onChange:t})=>{const s=d.useCallback(({tabKey:r})=>{switch(r){case"control":return n.jsxRuntimeExports.jsx(Qs,{value:e,onChange:t});default:return n.jsxRuntimeExports.jsxs(oe,{direction:"x",align:"stretch",children:[n.jsxRuntimeExports.jsxs(N.Space,{direction:"y",grow:!0,children:[n.jsxRuntimeExports.jsx(ve,{value:e,onChange:t}),n.jsxRuntimeExports.jsxs(N.Space,{direction:"x",children:[n.jsxRuntimeExports.jsx(Ne,{value:e,onChange:t}),n.jsxRuntimeExports.jsx(H.Item,{label:"Normally Open",children:n.jsxRuntimeExports.jsx(a.Switch$1,{value:e.normallyOpen??!1,onChange:i=>t({...e,normallyOpen:i})})})]})]}),n.jsxRuntimeExports.jsx(Ce,{value:e,onChange:t})]})}},[e,t]),o=X.useStatic({tabs:Mt,content:s});return n.jsxRuntimeExports.jsx(X.Tabs,{...o})},se=({value:e,onChange:t})=>n.jsxRuntimeExports.jsxs(oe,{direction:"x",children:[n.jsxRuntimeExports.jsxs(N.Space,{direction:"y",grow:!0,children:[n.jsxRuntimeExports.jsx(ve,{value:e,onChange:t}),n.jsxRuntimeExports.jsx(Ne,{value:e,onChange:t})]}),n.jsxRuntimeExports.jsx(Ce,{value:e,onChange:t})]}),Xt={y:2,x:.25},Kt={lower:0,upper:2e3},xl=({value:e,onChange:t})=>{var o,r;const s=i=>{t({...e,dimensions:{width:100,height:200,...e.dimensions,...i}})};return n.jsxRuntimeExports.jsxs(oe,{direction:"x",children:[n.jsxRuntimeExports.jsxs(N.Space,{direction:"y",children:[n.jsxRuntimeExports.jsx(ve,{value:e,onChange:t}),n.jsxRuntimeExports.jsxs(N.Space,{direction:"x",children:[n.jsxRuntimeExports.jsx(Ne,{value:e,onChange:t}),n.jsxRuntimeExports.jsx(H.Item,{label:"Width",children:n.jsxRuntimeExports.jsx(a.Numeric,{value:((o=e.dimensions)==null?void 0:o.width)??200,dragScale:Xt,bounds:Kt,onChange:i=>s({width:i})})}),n.jsxRuntimeExports.jsx(H.Item,{label:"Height",children:n.jsxRuntimeExports.jsx(a.Numeric,{value:((r=e.dimensions)==null?void 0:r.height)??200,dragScale:Xt,bounds:Kt,onChange:i=>s({height:i})})})]})]}),n.jsxRuntimeExports.jsx(Ce,{value:e,onChange:t})]})},dl=[{tabKey:"style",name:"Style"},{tabKey:"telemetry",name:"Telemetry"}],pl=({value:e,onChange:t})=>{var x;const s=f.sourcePipelinePropsZ.parse((x=e.telem)==null?void 0:x.props),o=f.streamChannelValuePropsZ.parse(s.segments.valueStream.props),r=f.stringifyNumberProps.parse(s.segments.stringifier.props),i=m=>{const p=f.sourcePipeline("string",{connections:[{from:"valueStream",to:"stringifier"}],segments:{valueStream:f.streamChannelValue({channel:m??0}),stringifier:f.stringifyNumber({precision:r.precision??2})},outlet:"stringifier"});t({...e,telem:p})},c=m=>{const p=f.sourcePipeline("string",{connections:[{from:"valueStream",to:"stringifier"}],segments:{valueStream:f.streamChannelValue({channel:o.channel}),stringifier:f.stringifyNumber({precision:m})},outlet:"stringifier"});t({...e,telem:p})},u=vt(o.channel);return d.useEffect(()=>{t({...e,tooltip:[u]})},[u]),n.jsxRuntimeExports.jsxs(oe,{direction:"y",children:[n.jsxRuntimeExports.jsx(H.Item,{label:"Input Channel",children:n.jsxRuntimeExports.jsx(ke,{value:o.channel,onChange:i})}),n.jsxRuntimeExports.jsx(H.Item,{label:"Percision",align:"start",children:n.jsxRuntimeExports.jsx(a.Numeric,{value:r.precision??2,bounds:{lower:0,upper:10},onChange:c})})]})},ml=({value:e,onChange:t})=>{const s=d.useCallback(({tabKey:r})=>{switch(r){case"telemetry":return n.jsxRuntimeExports.jsx(pl,{value:e,onChange:t});default:return n.jsxRuntimeExports.jsxs(oe,{direction:"x",children:[n.jsxRuntimeExports.jsxs(N.Space,{direction:"y",grow:!0,children:[n.jsxRuntimeExports.jsx(ve,{value:e,onChange:t}),n.jsxRuntimeExports.jsxs(N.Space,{direction:"x",children:[n.jsxRuntimeExports.jsx(Ne,{value:e,onChange:t}),n.jsxRuntimeExports.jsx(H.Item,{label:"Units",align:"start",children:n.jsxRuntimeExports.jsx(a.Text$1,{value:e.units??"",onChange:i=>t({...e,units:i})})})]})]}),n.jsxRuntimeExports.jsx(Ce,{value:e,onChange:t})]})}},[e,t]),o=X.useStatic({tabs:dl,content:s});return n.jsxRuntimeExports.jsx(X.Tabs,{...o})},jl=({value:e,onChange:t})=>{var i;const s=f.sinkPipelinePropsZ.parse((i=e.sink)==null?void 0:i.props),o=f.setChannelValuePropsZ.parse(s.segments.setter.props),r=c=>{const u=f.sinkPipeline("boolean",{connections:[{from:"setpoint",to:"setter"}],segments:{setter:f.setChannelValue({channel:c}),setpoint:f.setpoint({truthy:1,falsy:0})},inlet:"setpoint"}),x=f.authoritySource({channel:c}),m=f.acquireChannelControl({channel:c,authority:255});t({...e,sink:u,control:{...e.control,showChip:!0,chip:{sink:m,source:x},showIndicator:!0,indicator:{statusSource:x}}})};return n.jsxRuntimeExports.jsx(oe,{direction:"y",children:n.jsxRuntimeExports.jsx(H.Item,{label:"Output Channel",children:n.jsxRuntimeExports.jsx(ke,{value:o.channel,onChange:r})})})},fl=({value:e,onChange:t})=>{const s=d.useCallback(({tabKey:r})=>{switch(r){case"control":return n.jsxRuntimeExports.jsx(jl,{value:e,onChange:t});default:return n.jsxRuntimeExports.jsxs(oe,{direction:"x",align:"stretch",children:[n.jsxRuntimeExports.jsx(N.Space,{direction:"y",grow:!0,children:n.jsxRuntimeExports.jsx(ve,{value:e,onChange:t})}),n.jsxRuntimeExports.jsx(Ce,{value:e,onChange:t})]})}},[e,t]),o=X.useStatic({tabs:Mt,content:s});return n.jsxRuntimeExports.jsx(X.Tabs,{...o})},en=d.createContext({needsControlOf:[]}),tn=()=>d.useContext(en),hl=a.wrap$1(f.Controller$1.TYPE,({aetherKey:e,children:t,onStatusChange:s,...o})=>{const r=a.useMemoDeepEqualProps(o),[{path:i},{status:c,needsControlOf:u},x]=a.use$3({aetherKey:e,type:f.Controller$1.TYPE,schema:f.controllerStateZ,initialState:r});return d.useEffect(()=>{c!=null&&(s==null||s(c))},[c,s]),d.useEffect(()=>{x(m=>({...m,...r}))},[r,x]),d.useEffect(()=>()=>s==null?void 0:s("released"),[]),n.jsxRuntimeExports.jsxs(en.Provider,{value:{needsControlOf:u},children:[n.jsxRuntimeExports.jsx(a.Composite,{path:i,children:t}),";"]})}),sn=a.wrap$1(f.StateProvider.TYPE,({aetherKey:e,children:t})=>{const[{path:s}]=a.use$3({aetherKey:e,type:f.StateProvider.TYPE,schema:f.stateProviderStateZ,initialState:{}});return n.jsxRuntimeExports.jsx(a.Composite,{path:s,children:t})}),nn=a.wrap$1(f.Indicator.TYPE,({aetherKey:e,colorSource:t,statusSource:s})=>{var x;const o=a.useMemoDeepEqualProps({colorSource:t,statusSource:s}),[,{color:r,status:i},c]=a.use$3({aetherKey:e,type:f.Indicator.TYPE,initialState:{...o,status:{key:"no_chip",variant:"warning",message:"No chip connected.",time:l.TimeStamp.now()}},schema:f.indicatorStateZ});d.useEffect(()=>{c(m=>({...m,...o}))},[o,c]);let u;return((x=i.data)==null?void 0:x.color)!=null?u=l.Color.z.parse(i.data.color):r!=null&&!r.isZero?u=r:u="var(--pluto-gray-l8)",n.jsxRuntimeExports.jsxs(a.Dialog$1,{location:{x:"center",y:"right"},children:[n.jsxRuntimeExports.jsx(a.Text,{level:"p",children:i.message}),n.jsxRuntimeExports.jsx("div",{className:l.CSS.B("indicator"),style:{backgroundColor:l.cssString(u),flexGrow:1}})]})}),gl=e=>{var t,s;switch(e.variant){case"disabled":return((t=e.data)==null?void 0:t.valid)===!0?{message:"Uncontrolled. Click to take control.",chipColor:"var(--pluto-gray-l10)"}:{message:"No channel connected",chipColor:"var(--pluto-gray-l5)",disabled:!0};case"error":return{message:"Not controlled by you. Click to take absolute control.",chipColor:"var(--pluto-error-z)"};case"success":return((s=e.data)==null?void 0:s.authority)===G.v0.Authority.ABSOLUTE.valueOf()?{message:"You have absolute control. Click to release.",chipColor:"var(--pluto-secondary-z)",buttonStyle:{background:"var(--pluto-secondary-z-30)"}}:{message:"You're in control. Release P&ID to release control.",chipColor:"var(--pluto-primary-z)"};default:return{message:"Unexpected status.",chipColor:"var(--pluto-error-z)"}}},on=a.wrap$1("Chip",({aetherKey:e,source:t,sink:s,className:o,...r})=>{const i=a.useMemoDeepEqualProps({source:t,sink:s}),[,{status:c},u]=a.use$3({aetherKey:e,type:f.Chip.TYPE,schema:f.chipStateZ,initialState:{triggered:!1,...i,status:{key:"no_chip",variant:"disabled",message:"No chip connected.",time:l.TimeStamp.now()}}});d.useEffect(()=>{u(g=>({...g,...i}))},[i,u]);const x=d.useCallback(()=>u(g=>({...g,triggered:!g.triggered})),[u]),{message:m,chipColor:p,buttonStyle:j,disabled:h}=gl(c);return n.jsxRuntimeExports.jsx(a.Icon,{variant:"text",className:l.CSS(l.CSS.B("control-chip"),o),disabled:h,onClick:x,tooltip:n.jsxRuntimeExports.jsx(a.Text,{level:"small",children:m}),style:j,...r,children:n.jsxRuntimeExports.jsx(a.u0.Circle,{color:p})})}),El=a.wrap$1(f.Legend.TYPE,({aetherKey:e,...t})=>{const{needsControlOf:s}=tn(),[,{states:o},r]=a.use$3({aetherKey:e,type:f.Legend.TYPE,schema:f.legendStateZ,initialState:{states:[],needsControlOf:s}});d.useEffect(()=>{r(u=>({...u,needsControlOf:s}))},[s]);const c=l.unique(o.map(u=>u.subject.key)).map(u=>{const x=o.find(m=>m.subject.key===u);if(x==null)throw new G.Bn("Legend subject not found");return{key:x.subject.key,label:x.subject.name,color:x.subjectColor}});return n.jsxRuntimeExports.jsx(ss,{data:c,...t})}),Sl=Object.freeze(Object.defineProperty({__proto__:null,Chip:on,Controller:hl,Indicator:nn,Legend:El,StateProvider:sn,useContext:tn},Symbol.toStringTag,{value:"Module"})),Rl=({aetherKey:e,sink:t})=>{const s=a.useMemoDeepEqualProps({sink:t}),[,,o]=a.use$3({aetherKey:e,type:f.Button.TYPE,schema:f.buttonStateZ,initialState:{trigger:0,sink:t}});return d.useEffect(()=>{o(i=>({...i,...s}))},[s]),{click:d.useCallback(()=>{o(i=>({...i,trigger:i.trigger+1}))},[o])}},I=d.forwardRef(({label:e="",onChange:t,level:s="p",children:o,orientation:r="top",style:i,className:c,...u},x)=>n.jsxRuntimeExports.jsxs(N.Space,{style:{marginRight:r==="right"?1:0,marginTop:r==="top"?1:0,...i},size:2/3,direction:r,ref:x,className:l.CSS(l.CSS.B("symbol"),c),align:"center",justify:"center",...u,children:[e.length>0&&n.jsxRuntimeExports.jsx(a.Editable,{className:l.CSS.BE("symbol","label"),value:e,onChange:d.useCallback(m=>t({label:{label:m,level:s,orientation:r}}),[t,s]),level:s}),o]}));I.displayName="Labeled";const k=e=>n.jsxRuntimeExports.jsx("path",{vectorEffect:"non-scaling-stroke",...e}),bl=e=>n.jsxRuntimeExports.jsx("rect",{vectorEffect:"non-scaling-stroke",...e}),yl=e=>n.jsxRuntimeExports.jsx("circle",{vectorEffect:"non-scaling-stroke",...e}),dt=e=>n.jsxRuntimeExports.jsx("line",{vectorEffect:"non-scaling-stroke",...e}),Cl={left:{left:f.Position.Left,right:f.Position.Right,top:f.Position.Top,bottom:f.Position.Bottom},right:{left:f.Position.Right,right:f.Position.Left,top:f.Position.Bottom,bottom:f.Position.Top},top:{left:f.Position.Bottom,right:f.Position.Top,top:f.Position.Left,bottom:f.Position.Right},bottom:{left:f.Position.Top,right:f.Position.Bottom,top:f.Position.Right,bottom:f.Position.Left}},vl=(e,t)=>Cl[t][e],wl=(e,t,s)=>s==="left"?{top:e,left:t}:s==="right"?{top:100-e,left:100-t}:s==="top"?{top:100-t,left:e}:{top:t,left:100-e},Z=({children:e,orientation:t})=>{let s;try{s=f.useUpdateNodeInternals()}catch{return n.jsxRuntimeExports.jsx(n.jsxRuntimeExports.Fragment,{})}const o=d.useRef(null),r=d.useRef(!0);return d.useEffect(()=>{if(o.current==null)return;if(r.current){r.current=!1;return}const i=o.current.closest(".react-flow__node"),c=i==null?void 0:i.getAttribute("data-id");c!=null&&(s==null||s(c))},[t]),n.jsxRuntimeExports.jsx(n.jsxRuntimeExports.Fragment,{children:e})},T=({location:e,orientation:t,left:s,top:o,...r})=>{const i=wl(o,s,t);return n.jsxRuntimeExports.jsx(f.Handle$1,{position:vl(e,t),...r,type:"source",onClick:c=>c.stopPropagation(),className:(l.CSS.B("handle"),l.CSS.BE("handle",r.id)),style:{left:`${i.left}%`,top:`${i.top}%`}})},$e=({className:e,enabled:t=!1,triggered:s=!1,color:o,orientation:r="left",...i})=>n.jsxRuntimeExports.jsx("button",{className:l.CSS(l.CSS.B("symbol-primitive"),l.CSS.B("symbol-primitive-toggle"),r!=null&&l.CSS.loc(r),t&&l.CSS.M("enabled"),s&&l.CSS.M("triggered"),e),...i}),W=({className:e,orientation:t="left",...s})=>n.jsxRuntimeExports.jsx("div",{className:l.CSS(l.CSS.B("symbol-primitive"),e),...s}),$l=.8,Y=({dimensions:e,orientation:t="left",children:s,className:o,color:r,style:i={},scale:c=1,...u})=>{e=l.direction$1.construct(t)==="y"?l.dimensions.swap(e):e;const m=l.cssString(r);return r!=null&&(i[l.CSS.var("symbol-color")]=new l.Color(r).rgbString),n.jsxRuntimeExports.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:l.dimensions.svgViewBox(e),className:l.CSS(l.CSS.loc(t),o),fill:m,stroke:m,...u,style:{aspectRatio:`${e.width} / ${e.height}`,width:l.dimensions.scale(e,c*$l).width,...i},children:n.jsxRuntimeExports.jsx("g",{children:s})})},rn=({className:e,orientation:t,scale:s,color:o,...r})=>n.jsxRuntimeExports.jsxs($e,{...r,orientation:t,className:l.CSS(l.CSS.B("four-way-valve"),e),children:[n.jsxRuntimeExports.jsxs(Z,{orientation:t,children:[n.jsxRuntimeExports.jsx(T,{location:"left",orientation:"left",left:0,top:50,id:"1"}),n.jsxRuntimeExports.jsx(T,{location:"right",orientation:"left",left:100,top:50,id:"2"}),n.jsxRuntimeExports.jsx(T,{location:"top",orientation:"left",left:50,top:0,id:"3"}),n.jsxRuntimeExports.jsx(T,{location:"bottom",orientation:"left",left:50,top:100,id:"4"})]}),n.jsxRuntimeExports.jsxs(Y,{dimensions:{width:87,height:87},color:o,scale:s,children:[n.jsxRuntimeExports.jsx(k,{d:"M43.5 43.5L6.35453 24.7035C4.35901 23.6937 2 25.1438 2 27.3803V59.6197C2 61.8562 4.35901 63.3063 6.35453 62.2965L43.5 43.5ZM43.5 43.5L80.6455 24.7035C82.641 23.6937 85 25.1438 85 27.3803V59.6197C85 61.8562 82.641 63.3063 80.6455 62.2965L43.5 43.5Z"}),n.jsxRuntimeExports.jsx(k,{d:"M43.5 43.5L24.7035 80.6455C23.6937 82.641 25.1438 85 27.3803 85H59.6197C61.8562 85 63.3063 82.641 62.2965 80.6455L43.5 43.5ZM43.5 43.5L24.7035 6.35453C23.6937 4.35901 25.1438 2 27.3803 2H59.6197C61.8562 2 63.3063 4.35901 62.2965 6.35453L43.5 43.5Z"})]})]}),ln=({color:e,orientation:t="left",scale:s,...o})=>n.jsxRuntimeExports.jsxs($e,{...o,className:l.CSS(l.CSS.B("three-way-valve")),orientation:t,children:[n.jsxRuntimeExports.jsxs(Z,{orientation:t,children:[n.jsxRuntimeExports.jsx(T,{location:"bottom",orientation:t,left:50,top:100,id:"1"}),n.jsxRuntimeExports.jsx(T,{location:"left",orientation:t,left:0,top:33,id:"2"}),n.jsxRuntimeExports.jsx(T,{location:"right",orientation:t,left:100,top:33,id:"3"})]}),n.jsxRuntimeExports.jsxs(Y,{dimensions:{width:87,height:64},color:e,orientation:t,scale:s,children:[n.jsxRuntimeExports.jsx(k,{d:"M43.5 21L6.35453 2.20349C4.35901 1.19372 2 2.64384 2 4.88029V37.1197C2 39.3562 4.35901 40.8063 6.35453 39.7965L43.5 21ZM43.5 21L80.6455 2.20349C82.641 1.19372 85 2.64384 85 4.8803V37.1197C85 39.3562 82.641 40.8063 80.6455 39.7965L43.5 21Z"}),n.jsxRuntimeExports.jsx(k,{d:"M44.3923 22.3611C44.0222 21.6298 42.9778 21.6298 42.6077 22.3611L24.7035 57.7433C23.6937 59.7388 25.1438 62.0978 27.3803 62.0978L59.6197 62.0978C61.8562 62.0978 63.3063 59.7388 62.2965 57.7433L44.3923 22.3611Z"})]})]}),cn=({orientation:e="left",color:t,scale:s,...o})=>n.jsxRuntimeExports.jsxs($e,{...o,children:[n.jsxRuntimeExports.jsxs(Z,{orientation:e,children:[n.jsxRuntimeExports.jsx(T,{location:"left",orientation:e,left:0,top:50,id:"1"}),n.jsxRuntimeExports.jsx(T,{location:"right",orientation:e,left:100,top:50,id:"2"})]}),n.jsxRuntimeExports.jsx(Y,{dimensions:{width:87,height:42},color:t,orientation:e,scale:s,children:n.jsxRuntimeExports.jsx(k,{d:"M43.5 21L6.35453 2.20349C4.35901 1.19372 2 2.64384 2 4.88029V37.1197C2 39.3562 4.35901 40.8063 6.35453 39.7965L43.5 21ZM43.5 21L80.6455 2.20349C82.641 1.19372 85 2.64384 85 4.8803V37.1197C85 39.3562 82.641 40.8063 80.6455 39.7965L43.5 21Z"})})]}),an=({className:e,color:t,orientation:s="left",normallyOpen:o=!1,scale:r,...i})=>n.jsxRuntimeExports.jsxs($e,{className:l.CSS(l.CSS.B("solenoid-valve"),o&&l.CSS.M("normally-open"),e),...i,children:[n.jsxRuntimeExports.jsxs(Z,{orientation:s,children:[n.jsxRuntimeExports.jsx(T,{location:"left",orientation:s,left:1,top:69,id:"1"}),n.jsxRuntimeExports.jsx(T,{location:"right",orientation:s,left:99,top:69,id:"2"})]}),n.jsxRuntimeExports.jsxs(Y,{dimensions:{width:87,height:69},color:t,orientation:s,scale:r,children:[n.jsxRuntimeExports.jsx(k,{className:l.CSS.B("body"),d:"M43.5 48L6.35453 29.2035C4.35901 28.1937 2 29.6438 2 31.8803V64.1197C2 66.3562 4.35901 67.8063 6.35453 66.7965L43.5 48ZM43.5 48L80.6455 29.2035C82.641 28.1937 85 29.6438 85 31.8803V64.1197C85 66.3562 82.641 67.8063 80.6455 66.7965L43.5 48Z"}),n.jsxRuntimeExports.jsx(k,{d:"M43.5 47L43.5 24.6177"}),n.jsxRuntimeExports.jsx(bl,{x:"29",y:"2",width:"29",height:"22.5333",rx:"1"})]})]}),un=({className:e,orientation:t="left",color:s,scale:o,...r})=>n.jsxRuntimeExports.jsxs(W,{orientation:t,className:l.CSS(l.CSS.B("relief-valve"),e),...r,children:[n.jsxRuntimeExports.jsxs(Z,{orientation:t,children:[n.jsxRuntimeExports.jsx(T,{location:"left",orientation:t,left:1,top:66,id:"1"}),n.jsxRuntimeExports.jsx(T,{location:"right",orientation:t,left:99,top:66,id:"2"})]}),n.jsxRuntimeExports.jsxs(Y,{dimensions:{width:87,height:58},color:s,orientation:t,scale:o,children:[n.jsxRuntimeExports.jsx(k,{d:"M43.5 37L6.35453 18.2035C4.35901 17.1937 2 18.6438 2 20.8803V53.1197C2 55.3562 4.35901 56.8063 6.35453 55.7965L43.5 37ZM43.5 37L80.6455 18.2035C82.641 17.1937 85 18.6438 85 20.8803V53.1197C85 55.3562 82.641 56.8063 80.6455 55.7965L43.5 37Z"}),n.jsxRuntimeExports.jsx(k,{d:"M43.5 2L43.5 38",strokeLinecap:"round"}),n.jsxRuntimeExports.jsx(k,{d:"M31.8011 14.0802L55.1773 4.29611",strokeLinecap:"round"}),n.jsxRuntimeExports.jsx(k,{d:"M31.8011 20.0802L55.1773 10.2961",strokeLinecap:"round"}),n.jsxRuntimeExports.jsx(k,{d:"M31.8011 26.0802L55.1773 16.2961",strokeLinecap:"round"})]})]}),xn=({className:e,orientation:t="left",color:s,scale:o,...r})=>n.jsxRuntimeExports.jsxs(W,{orientation:t,className:l.CSS(l.CSS.B("check-valve"),e),...r,children:[n.jsxRuntimeExports.jsxs(Z,{orientation:t,children:[n.jsxRuntimeExports.jsx(T,{location:"left",orientation:t,left:1,top:50,id:"1"}),n.jsxRuntimeExports.jsx(T,{location:"right",orientation:t,left:99,top:50,id:"2"})]}),n.jsxRuntimeExports.jsxs(Y,{dimensions:{width:45,height:43},color:s,orientation:t,scale:o,children:[n.jsxRuntimeExports.jsx(k,{d:"M43 2L43 40",strokeLinecap:"round"}),n.jsxRuntimeExports.jsx(k,{d:"M41.6607 21.8946C42.3917 21.5238 42.3906 20.4794 41.6589 20.1101L6.25889 2.2412C4.26237 1.23341 1.90481 2.68589 1.90704 4.92235L1.93925 37.1617C1.94148 39.3982 4.30194 40.846 6.29644 39.8342L41.6607 21.8946Z"})]})]}),dn=({color:e,className:t,orientation:s="left",scale:o,...r})=>n.jsxRuntimeExports.jsxs($e,{...r,orientation:s,className:l.CSS(l.CSS.B("angled-valve"),t),children:[n.jsxRuntimeExports.jsxs(Z,{orientation:s,children:[n.jsxRuntimeExports.jsx(T,{location:"bottom",orientation:s,left:33,top:100,id:"1"}),n.jsxRuntimeExports.jsx(T,{location:"right",orientation:s,left:100,top:35,id:"2"})]}),n.jsxRuntimeExports.jsxs(Y,{dimensions:{width:64,height:64},color:e,orientation:s,scale:o,children:[n.jsxRuntimeExports.jsx(k,{d:"M22.3611 20.1077C21.6298 20.4778 21.6298 21.5222 22.3611 21.8923L57.7433 39.7965C59.7388 40.8063 62.0978 39.3562 62.0978 37.1197L62.0978 4.88029C62.0978 2.64384 59.7388 1.19372 57.7433 2.2035L22.3611 20.1077Z"}),n.jsxRuntimeExports.jsx(k,{d:"M21.8923 22.3611C21.5222 21.6298 20.4778 21.6298 20.1077 22.3611L2.20349 57.7433C1.19372 59.7388 2.64384 62.0978 4.8803 62.0978L37.1197 62.0978C39.3562 62.0978 40.8063 59.7388 39.7965 57.7433L21.8923 22.3611Z"}),n.jsxRuntimeExports.jsx(k,{d:"M24.3461 18.5709L21.7484 19.88C20.9998 20.2572 20.3887 20.8601 20.0012 21.6035L19.3383 22.8756"})]})]}),pn=({color:e,className:t,orientation:s="left",scale:o,...r})=>n.jsxRuntimeExports.jsxs($e,{...r,className:l.CSS(l.CSS.B("pump"),t),orientation:s,children:[n.jsxRuntimeExports.jsxs(Z,{orientation:s,children:[n.jsxRuntimeExports.jsx(T,{location:"left",orientation:s,left:1,top:39,id:"1"}),n.jsxRuntimeExports.jsx(T,{location:"right",orientation:s,left:95,top:3,id:"2"})]}),n.jsxRuntimeExports.jsxs(Y,{dimensions:{width:68,height:61},color:e,orientation:s,scale:o,children:[n.jsxRuntimeExports.jsx(yl,{cx:"35",cy:"25",r:"23"}),n.jsxRuntimeExports.jsx(k,{d:"M50 41.5L56.7186 50.8314C57.6711 52.1544 56.7257 54 55.0955 54H14.9045C13.2743 54 12.3289 52.1544 13.2814 50.8314L20 41.5"}),n.jsxRuntimeExports.jsx(dt,{x1:"35",y1:"2",x2:"65.0167",y2:"2"}),n.jsxRuntimeExports.jsx(dt,{x1:"1",y1:"24",x2:"35",y2:"24"})]})]}),mn=({className:e,color:t,orientation:s="left",scale:o,...r})=>{const i=l.cssString(t);return n.jsxRuntimeExports.jsxs(W,{...r,className:l.CSS(l.CSS.B("symbol"),e),children:[n.jsxRuntimeExports.jsx(Z,{orientation:s,children:n.jsxRuntimeExports.jsx(T,{location:"left",orientation:s,left:2,top:50,id:"1"})}),n.jsxRuntimeExports.jsxs(Y,{dimensions:{width:40,height:48},color:t,orientation:s,scale:o,children:[n.jsxRuntimeExports.jsx(k,{d:"M24 24C24 35.1852 15.2546 44.4725 3.87626 45.8297C2.90571 45.9455 2 45.1407 2 44V4C2 2.85926 2.90571 2.0545 3.87626 2.17027C15.2546 3.52755 24 12.8148 24 24Z"}),n.jsxRuntimeExports.jsx(k,{d:"M37.9706 23.2076C38.4906 23.6079 38.4906 24.3921 37.9706 24.7924L33.86 27.9568C33.2024 28.463 32.25 27.9942 32.25 27.1644V20.8356C32.25 20.0058 33.2024 19.537 33.86 20.0432L37.9706 23.2076Z",fill:i}),n.jsxRuntimeExports.jsx(k,{d:"M33 24H3",strokeLinecap:"round"})]})]})},jn=({className:e,orientation:t="left",color:s,scale:o,...r})=>n.jsxRuntimeExports.jsxs(W,{className:l.CSS(l.CSS.B("cap"),e),...r,children:[n.jsxRuntimeExports.jsx(Z,{orientation:t,children:n.jsxRuntimeExports.jsx(T,{location:"left",orientation:t,left:0,top:50,id:"1"})}),n.jsxRuntimeExports.jsx(Y,{color:s,dimensions:{width:26,height:48},orientation:t,scale:o,children:n.jsxRuntimeExports.jsx(k,{d:"M24 24C24 35.1852 15.2546 44.4725 3.87626 45.8297C2.90571 45.9455 2 45.1407 2 44V4C2 2.85926 2.90571 2.0545 3.87626 2.17027C15.2546 3.52755 24 12.8148 24 24Z"})})]}),fn=({className:e,orientation:t="left",color:s,scale:o,...r})=>n.jsxRuntimeExports.jsxs(W,{className:l.CSS(l.CSS.B("manual-valve"),e),...r,children:[n.jsxRuntimeExports.jsxs(Z,{orientation:t,children:[n.jsxRuntimeExports.jsx(T,{location:"left",orientation:t,left:1,top:58,id:"1"}),n.jsxRuntimeExports.jsx(T,{location:"right",orientation:t,left:99,top:58,id:"2"})]}),n.jsxRuntimeExports.jsxs(Y,{dimensions:{width:87,height:48},color:s,orientation:t,scale:o,children:[n.jsxRuntimeExports.jsx(dt,{x1:"43.5",y1:"27",x2:"43.5",y2:"1"}),n.jsxRuntimeExports.jsx(k,{d:"M19.64 2L66.68 2",strokeLinecap:"round"}),n.jsxRuntimeExports.jsx(k,{d:"M43.5 27L6.35453 8.20349C4.35901 7.19372 2 8.64384 2 10.8803V43.1197C2 45.3562 4.35901 46.8063 6.35453 45.7965L43.5 27ZM43.5 27L80.6455 8.20349C82.641 7.19372 85 8.64384 85 10.8803V43.1197C85 45.3562 82.641 46.8063 80.6455 45.7965L43.5 27Z"})]})]}),hn=({className:e,orientation:t="left",color:s,scale:o,...r})=>n.jsxRuntimeExports.jsxs(W,{className:l.CSS(l.CSS.B("filter"),e),...r,children:[n.jsxRuntimeExports.jsxs(Z,{orientation:t,children:[n.jsxRuntimeExports.jsx(T,{location:"left",orientation:t,left:2,top:50,id:"1"}),n.jsxRuntimeExports.jsx(T,{location:"right",orientation:t,left:98,top:50,id:"2"})]}),n.jsxRuntimeExports.jsx(Y,{dimensions:{width:52,height:34},orientation:t,color:s,scale:o,children:n.jsxRuntimeExports.jsx(k,{d:"M6 17L24.8 2.9C25.5111 2.36667 26.4889 2.36667 27.2 2.9L46 17M6 17L24.8 31.1C25.5111 31.6333 26.4889 31.6333 27.2 31.1L46 17M6 17H1M46 17H51"})})]}),Tl=e=>typeof e=="number"?{topLeft:l.xy.construct(e),topRight:l.xy.construct(e),bottomLeft:l.xy.construct(e),bottomRight:l.xy.construct(e)}:"x"in e?{topLeft:e,topRight:e,bottomLeft:e,bottomRight:e}:typeof e.bottomLeft=="number"?{topLeft:l.xy.construct(e.topLeft),topRight:l.xy.construct(e.topRight),bottomLeft:l.xy.construct(e.bottomLeft),bottomRight:l.xy.construct(e.bottomRight)}:e,Pl=e=>{const{topLeft:t,topRight:s,bottomLeft:o,bottomRight:r}=e;return`${t.x}% ${s.x}% ${r.x}% ${o.x}% / ${t.y}% ${s.y}% ${r.y}% ${o.y}%`},kl={width:40,height:80},Ll={x:50,y:10},gn=({className:e,dimensions:t=kl,borderRadius:s=Ll,color:o,onResize:r,...i})=>{const c=Tl(s),u=a.use();return n.jsxRuntimeExports.jsx(W,{className:l.CSS(e,l.CSS.B("tank")),style:{...t,borderRadius:Pl(c),borderColor:l.cssString(o??u.colors.gray.l9)},...i,children:n.jsxRuntimeExports.jsxs(Z,{children:[n.jsxRuntimeExports.jsx(T,{location:"top",orientation:"left",left:50,top:0,id:"1"}),n.jsxRuntimeExports.jsx(T,{location:"top",orientation:"left",left:-.5,top:c.topLeft.y-1,id:"2"}),n.jsxRuntimeExports.jsx(T,{location:"top",orientation:"left",left:101,top:c.topRight.y-1,id:"3"}),n.jsxRuntimeExports.jsx(T,{location:"bottom",orientation:"left",left:50,top:100,id:"4"}),n.jsxRuntimeExports.jsx(T,{location:"bottom",orientation:"left",left:-.5,top:100-c.bottomLeft.y+1,id:"5"}),n.jsxRuntimeExports.jsx(T,{location:"bottom",orientation:"left",left:101,top:100-c.bottomRight.y+1,id:"6"}),n.jsxRuntimeExports.jsx(T,{location:"left",orientation:"left",left:-.5,top:50,id:"7"}),n.jsxRuntimeExports.jsx(T,{location:"right",orientation:"left",left:101,top:50,id:"8"})]})})},En=({className:e,orientation:t="left",color:s,scale:o,...r})=>n.jsxRuntimeExports.jsxs(W,{className:l.CSS(e,l.CSS.B("regulator")),...r,children:[n.jsxRuntimeExports.jsxs(Z,{orientation:t,children:[n.jsxRuntimeExports.jsx(T,{location:"left",orientation:t,left:0,top:66,id:"1"}),n.jsxRuntimeExports.jsx(T,{location:"right",orientation:t,left:100,top:66,id:"2"})]}),n.jsxRuntimeExports.jsxs(Y,{dimensions:{width:84,height:58},orientation:t,color:s,scale:o,children:[n.jsxRuntimeExports.jsx(k,{d:"M42 36.5L5.41845 16.8709C3.41989 15.7985 1 17.2463 1 19.5144V53.4856C1 55.7537 3.4199 57.2015 5.41846 56.1291L42 36.5ZM42 36.5L78.5815 16.8709C80.5801 15.7985 83 17.2463 83 19.5144V53.4856C83 55.7537 80.5801 57.2015 78.5815 56.1291L42 36.5Z"}),n.jsxRuntimeExports.jsx(k,{d:"M40 1.5H27.1522C24.8526 1.5 23.4081 3.9809 24.5432 5.98082L41.1303 35.2058C41.6373 36.099 43 35.7392 43 34.7122V4.5C43 2.84315 41.6569 1.5 40 1.5Z"})]})]}),Sn=({className:e,orientation:t="left",scale:s,color:o,...r})=>n.jsxRuntimeExports.jsxs(W,{className:l.CSS(l.CSS.B("orifice"),e),...r,children:[n.jsxRuntimeExports.jsxs(Z,{orientation:t,children:[n.jsxRuntimeExports.jsx(T,{location:"left",orientation:t,left:0,top:50,id:"1"}),n.jsxRuntimeExports.jsx(T,{location:"right",orientation:t,left:100,top:50,id:"2"})]}),n.jsxRuntimeExports.jsxs(Y,{dimensions:{width:70,height:34},orientation:t,color:o,scale:s,children:[n.jsxRuntimeExports.jsx(k,{d:"M2 2.5C27.451 21.3469 60.0915 12.0132 68 2.5",strokeLinecap:"round"}),n.jsxRuntimeExports.jsx(k,{d:"M2 32.5C27.451 13.6531 60.0915 22.9868 68 32.5",strokeLinecap:"round"})]})]}),Rn=({className:e,orientation:t="left",color:s,scale:o,...r})=>n.jsxRuntimeExports.jsxs(W,{className:l.CSS(l.CSS.B("needle-valve"),e),...r,children:[n.jsxRuntimeExports.jsxs(Z,{orientation:t,children:[n.jsxRuntimeExports.jsx(T,{location:"left",orientation:t,left:1,top:50,id:"1"}),n.jsxRuntimeExports.jsx(T,{location:"right",orientation:t,left:99,top:50,id:"2"})]}),n.jsxRuntimeExports.jsxs(Y,{dimensions:{width:87,height:42},orientation:t,color:s,scale:o,children:[n.jsxRuntimeExports.jsx(k,{d:"M43.0152 21.5391L38.237 2.62245C38.1573 2.30658 38.396 2 38.7218 2L48.2782 2C48.604 2 48.8427 2.30658 48.763 2.62245L43.9848 21.5391C43.8576 22.0425 43.1424 22.0425 43.0152 21.5391Z",fill:l.cssString(s)}),n.jsxRuntimeExports.jsx(k,{d:"M43.5 21.5L6.35453 2.70349C4.35901 1.69372 2 3.14384 2 5.38029V37.6197C2 39.8562 4.35901 41.3063 6.35453 40.2965L43.5 21.5ZM43.5 21.5L80.6455 2.70349C82.641 1.69372 85 3.14384 85 5.3803V37.6197C85 39.8562 82.641 41.3063 80.6455 40.2965L43.5 21.5Z"})]})]}),bn=({className:e,orientation:t="left",color:s,scale:o,...r})=>n.jsxRuntimeExports.jsxs(W,{orientation:t,className:l.CSS(l.CSS.B("angled-relief-valve"),e),...r,children:[n.jsxRuntimeExports.jsxs(Z,{children:[n.jsxRuntimeExports.jsx(T,{location:"bottom",orientation:t,left:33,top:100,id:"1"}),n.jsxRuntimeExports.jsx(T,{location:"right",orientation:t,left:100,top:45,id:"2"})]}),n.jsxRuntimeExports.jsxs(Y,{dimensions:{width:64,height:79},orientation:t,color:s,scale:o,children:[n.jsxRuntimeExports.jsx(k,{d:"M20.75 2L20.75 38",strokeLinecap:"round"}),n.jsxRuntimeExports.jsx(k,{d:"M9.05106 14.0802L32.4273 4.29611",strokeLinecap:"round"}),n.jsxRuntimeExports.jsx(k,{d:"M9.05106 20.0802L32.4273 10.2961",strokeLinecap:"round"}),n.jsxRuntimeExports.jsx(k,{d:"M9.05106 26.0802L32.4273 16.2961",strokeLinecap:"round"}),n.jsxRuntimeExports.jsx(k,{d:"M22.3611 35.1077C21.6298 35.4778 21.6298 36.5222 22.3611 36.8923L57.7433 54.7965C59.7388 55.8063 62.0978 54.3562 62.0978 52.1197L62.0978 19.8803C62.0978 17.6438 59.7388 16.1937 57.7433 17.2035L22.3611 35.1077Z"}),n.jsxRuntimeExports.jsx(k,{d:"M21.8923 37.3611C21.5222 36.6298 20.4778 36.6298 20.1077 37.3611L2.20349 72.7433C1.19372 74.7388 2.64384 77.0978 4.8803 77.0978H37.1197C39.3562 77.0978 40.8063 74.7388 39.7965 72.7433L21.8923 37.3611Z"}),n.jsxRuntimeExports.jsx(k,{d:"M24.3461 33.5709L21.7484 34.88C20.9998 35.2572 20.3887 35.8601 20.0012 36.6035L19.3383 37.8756"})]})]}),yn=({className:e,color:t,dimensions:s,orientation:o,units:r="psi",children:i,...c})=>{const u=l.cssString(t),x=a.use();let m="var(--pluto-gray-l0)";return t!=null&&(m=l.cssString(new l.Color(t).pickByContrast(x.colors.gray.l0,x.colors.gray.l9))),n.jsxRuntimeExports.jsxs(W,{className:l.CSS(l.CSS.B("value"),e),...c,style:{borderColor:u,height:s==null?void 0:s.height,width:"100%"},children:[n.jsxRuntimeExports.jsx("div",{className:l.CSS.BE("value","content"),style:{flexGrow:1,minWidth:s==null?void 0:s.width,inlineSize:80},children:i}),n.jsxRuntimeExports.jsxs(Z,{orientation:o,children:[n.jsxRuntimeExports.jsx(T,{location:"left",orientation:"left",left:-2,top:50,id:"1"}),n.jsxRuntimeExports.jsx(T,{location:"right",orientation:"left",left:102,top:50,id:"2"}),n.jsxRuntimeExports.jsx(T,{location:"top",orientation:"left",left:50,top:-2,id:"3"}),n.jsxRuntimeExports.jsx(T,{location:"bottom",orientation:"left",left:50,top:102,id:"4"})]}),n.jsxRuntimeExports.jsx("div",{className:l.CSS.BE("value","units"),style:{background:u},children:n.jsxRuntimeExports.jsx(a.Text,{level:"small",color:m,children:r})})]})},Cn=({triggered:e,enabled:t=!1,color:s,onClick:o,orientation:r="left"})=>n.jsxRuntimeExports.jsxs(W,{orientation:r,children:[n.jsxRuntimeExports.jsx(a.Switch$1,{value:t,onClick:o,onChange:()=>{}}),n.jsxRuntimeExports.jsxs(Z,{orientation:r,children:[n.jsxRuntimeExports.jsx(T,{location:"left",orientation:r,left:0,top:50,id:"1"}),n.jsxRuntimeExports.jsx(T,{location:"right",orientation:r,left:100,top:50,id:"2"})]})]}),vn=({onClick:e,orientation:t="left",label:s=""})=>n.jsxRuntimeExports.jsxs(W,{orientation:t,children:[n.jsxRuntimeExports.jsx(a.Button,{onClick:e,children:s}),n.jsxRuntimeExports.jsxs(Z,{orientation:t,children:[n.jsxRuntimeExports.jsx(T,{location:"left",orientation:t,left:0,top:50,id:"1"}),n.jsxRuntimeExports.jsx(T,{location:"right",orientation:t,left:100,top:50,id:"2"}),n.jsxRuntimeExports.jsx(T,{location:"top",orientation:t,left:50,top:0,id:"3"}),n.jsxRuntimeExports.jsx(T,{location:"bottom",orientation:t,left:50,top:100,id:"4"})]})]}),je=({aetherKey:e,source:t,sink:s})=>{const o=a.useMemoDeepEqualProps({source:t,sink:s}),[,{triggered:r,enabled:i},c]=a.use$3({aetherKey:e,type:f.Toggle.TYPE,schema:f.toggleStateZ,initialState:{triggered:!1,enabled:!1,...o}});return d.useEffect(()=>{c(x=>({...x,...o}))},[o,c]),{toggle:d.useCallback(()=>c(x=>({...x,triggered:!x.triggered})),[c]),triggered:r,enabled:i}},wn=e=>l.direction$1.construct(e)==="x"?l.location.swap(e):e,Ml=e=>l.direction$1.construct(e)==="y"?l.location.swap(e):e,ce=({showChip:e=!0,showIndicator:t=!0,indicator:s,orientation:o="left",chip:r,children:i,...c})=>n.jsxRuntimeExports.jsxs(N.Space,{direction:l.location.rotate90(o),align:"center",justify:"center",empty:!0,...c,children:[n.jsxRuntimeExports.jsxs(N.Space,{direction:l.direction$1.construct(o),align:"center",className:l.CSS(l.CSS.B("control-state")),size:"small",children:[e&&n.jsxRuntimeExports.jsx(on,{size:"small",...r}),t&&n.jsxRuntimeExports.jsx(nn,{...s})]}),i]}),Nl=a.wrap$1("ThreeWayValve",({aetherKey:e,label:t,onChange:s,control:o,source:r,sink:i,orientation:c="left",color:u})=>{const{enabled:x,triggered:m,toggle:p}=je({aetherKey:e,source:r,sink:i});return n.jsxRuntimeExports.jsx(I,{...t,onChange:s,children:n.jsxRuntimeExports.jsx(ce,{...o,orientation:wn(c),children:n.jsxRuntimeExports.jsx(ln,{enabled:x,triggered:m,onClick:p,orientation:c,color:u})})})}),_l=e=>n.jsxRuntimeExports.jsx(ln,{...e}),Bl=a.wrap$1("Valve",({control:e,aetherKey:t,label:s,onChange:o,source:r,sink:i,orientation:c,color:u})=>{const{enabled:x,triggered:m,toggle:p}=je({aetherKey:t,source:r,sink:i});return n.jsxRuntimeExports.jsx(I,{...s,onChange:o,children:n.jsxRuntimeExports.jsx(ce,{...e,orientation:c,children:n.jsxRuntimeExports.jsx(cn,{enabled:x,triggered:m,onClick:p,orientation:c,color:u})})})}),Dl=e=>n.jsxRuntimeExports.jsx(cn,{...e}),zl=a.wrap$1("SolenoidValve",({aetherKey:e,label:t,onChange:s,orientation:o="left",normallyOpen:r,color:i,source:c,sink:u,control:x})=>{const{enabled:m,triggered:p,toggle:j}=je({aetherKey:e,source:c,sink:u});return n.jsxRuntimeExports.jsx(I,{...t,onChange:s,children:n.jsxRuntimeExports.jsx(ce,{...x,orientation:Ml(o),children:n.jsxRuntimeExports.jsx(an,{enabled:m,triggered:p,onClick:j,orientation:o,color:i,normallyOpen:r})})})}),Ol=e=>n.jsxRuntimeExports.jsx(an,{...e}),Vl=a.wrap$1("FourWayValve",({aetherKey:e,control:t,label:s,onChange:o,orientation:r,color:i,source:c,sink:u})=>{const{enabled:x,triggered:m,toggle:p}=je({aetherKey:e,source:c,sink:u});return n.jsxRuntimeExports.jsx(I,{...s,onChange:o,children:n.jsxRuntimeExports.jsx(ce,{...t,orientation:r,children:n.jsxRuntimeExports.jsx(rn,{enabled:x,triggered:m,onClick:p,orientation:r,color:i})})})}),Al=e=>n.jsxRuntimeExports.jsx(rn,{...e}),Il=a.wrap$1("AngleValve",({aetherKey:e,label:t,control:s,onChange:o,orientation:r="left",color:i,source:c,sink:u})=>{const{enabled:x,triggered:m,toggle:p}=je({aetherKey:e,source:c,sink:u});return n.jsxRuntimeExports.jsx(I,{...t,onChange:o,children:n.jsxRuntimeExports.jsx(ce,{...s,orientation:wn(r),children:n.jsxRuntimeExports.jsx(dn,{enabled:x,triggered:m,onClick:p,orientation:r,color:i})})})}),Zl=e=>n.jsxRuntimeExports.jsx(dn,{...e}),Fl=a.wrap$1("Pump",({aetherKey:e,label:t,control:s,onChange:o,orientation:r,color:i,source:c,sink:u})=>{const{enabled:x,triggered:m,toggle:p}=je({aetherKey:e,source:c,sink:u});return n.jsxRuntimeExports.jsx(I,{...t,onChange:o,children:n.jsxRuntimeExports.jsx(ce,{...s,orientation:r,children:n.jsxRuntimeExports.jsx(pn,{enabled:x,triggered:m,onClick:p,orientation:r,color:i})})})}),Yl=e=>n.jsxRuntimeExports.jsx(pn,{...e}),Gl=a.wrap$1("Tank",({label:e,onChange:t,orientation:s,color:o,dimensions:r,borderRadius:i})=>n.jsxRuntimeExports.jsx(I,{...e,onChange:t,children:n.jsxRuntimeExports.jsx(gn,{onResize:c=>t({dimensions:c}),orientation:s,color:o,dimensions:r,borderRadius:i})})),Hl=e=>n.jsxRuntimeExports.jsx(gn,{...e,dimensions:{width:25,height:50}}),Ul=({label:e,onChange:t,orientation:s,color:o})=>n.jsxRuntimeExports.jsx(I,{...e,onChange:t,children:n.jsxRuntimeExports.jsx(un,{orientation:s,color:o})}),ql=e=>n.jsxRuntimeExports.jsx(un,{...e}),Wl=({label:e,onChange:t,orientation:s,color:o})=>n.jsxRuntimeExports.jsx(I,{...e,onChange:t,children:n.jsxRuntimeExports.jsx(En,{orientation:s,color:o})}),Xl=e=>n.jsxRuntimeExports.jsx(En,{...e}),Kl=({label:e,onChange:t,orientation:s,color:o})=>n.jsxRuntimeExports.jsx(I,{...e,onChange:t,children:n.jsxRuntimeExports.jsx(mn,{orientation:s,color:o})}),Jl=e=>n.jsxRuntimeExports.jsx(mn,{...e}),Ql=({label:e,onChange:t,orientation:s,color:o})=>n.jsxRuntimeExports.jsx(I,{...e,onChange:t,children:n.jsxRuntimeExports.jsx(jn,{orientation:s,color:o})}),ei=e=>n.jsxRuntimeExports.jsx(jn,{...e}),ti=({label:e,onChange:t,orientation:s,color:o})=>n.jsxRuntimeExports.jsx(I,{...e,onChange:t,children:n.jsxRuntimeExports.jsx(fn,{orientation:s,color:o})}),si=e=>n.jsxRuntimeExports.jsx(fn,{...e}),ni=({label:e,onChange:t,orientation:s,color:o})=>n.jsxRuntimeExports.jsx(I,{...e,onChange:t,children:n.jsxRuntimeExports.jsx(hn,{orientation:s,color:o})}),oi=e=>n.jsxRuntimeExports.jsx(hn,{...e}),ri=({label:e,onChange:t,orientation:s,color:o})=>n.jsxRuntimeExports.jsx(I,{...e,onChange:t,children:n.jsxRuntimeExports.jsx(Rn,{orientation:s,color:o})}),li=e=>n.jsxRuntimeExports.jsx(Rn,{...e}),ii=({label:e,onChange:t,orientation:s,color:o})=>n.jsxRuntimeExports.jsx(I,{...e,onChange:t,children:n.jsxRuntimeExports.jsx(xn,{orientation:s,color:o})}),ci=e=>n.jsxRuntimeExports.jsx(xn,{...e}),ai=({label:e,onChange:t,orientation:s,color:o})=>n.jsxRuntimeExports.jsx(I,{...e,onChange:t,children:n.jsxRuntimeExports.jsx(Sn,{orientation:s,color:o})}),ui=e=>n.jsxRuntimeExports.jsx(Sn,{...e}),xi=({label:e,onChange:t,orientation:s,color:o})=>n.jsxRuntimeExports.jsx(I,{...e,onChange:t,children:n.jsxRuntimeExports.jsx(bn,{orientation:s,color:o})}),di=e=>n.jsxRuntimeExports.jsx(bn,{...e}),pi=a.wrap$1("Value",({aetherKey:e,label:t,level:s="p",position:o,className:r,textColor:i,color:c,telem:u,units:x,onChange:m,tooltip:p})=>{const j=a.useTypography(s),[h,g]=d.useState({outerBox:l.box$1.ZERO,labelBox:l.box$1.ZERO}),E=(j.lineHeight+.5)*j.baseSize+2,b=a.useResize(C=>{const R=document.querySelector(`.react-flow__node[data-id="${e}"] .pluto-symbol__label`);let w={...l.box$1.ZERO};R!=null&&(w=l.box$1.construct(R),w=l.box$1.resize(w,{width:l.box$1.width(w),height:l.box$1.height(w)})),g({outerBox:C,labelBox:w})},{}),S=f.useViewport().zoom,y=ji({labelOrientation:(t==null?void 0:t.orientation)??"top",zoom:S,valueBoxHeight:E,position:o,...h}),{width:v}=Js({aetherKey:e,color:i,level:s,box:y,telem:u,minWidth:60});return n.jsxRuntimeExports.jsxs(a.Dialog$1,{location:{y:"top"},hide:p==null||p.length===0,children:[n.jsxRuntimeExports.jsx(N.Space,{direction:"y",children:p==null?void 0:p.map((C,R)=>n.jsxRuntimeExports.jsx(a.Text,{level:"small",children:C},R))}),n.jsxRuntimeExports.jsx(I,{className:l.CSS(r,l.CSS.B("value-labeled")),ref:b,onChange:m,...t,children:n.jsxRuntimeExports.jsx(yn,{color:c,dimensions:{height:E,width:v},units:x})})]})}),mi=.9,ji=({labelOrientation:e,zoom:t,outerBox:s,labelBox:o,valueBoxHeight:r,position:i})=>{const c=l.xy.scale(l.box$1.dims(o),1/(mi*t));return l.direction$1.construct(e)==="x"&&(i=l.xy.translateY(i,Math.max((c.y-r)/2-1,0))),e==="left"&&(i=l.xy.translateX(i,c.x+4)),e==="top"&&(i=l.xy.translateY(i,c.y+4)),l.box$1.construct(i.x,i.y,l.box$1.width(s),r)},fi=({color:e})=>n.jsxRuntimeExports.jsx(yn,{color:e,dimensions:{width:60,height:25},units:"psi",children:n.jsxRuntimeExports.jsx(a.Text,{level:"p",children:"50.00"})}),hi=a.wrap$1("Switch",({aetherKey:e,label:t,control:s,onChange:o,orientation:r,color:i,source:c,sink:u})=>{const{enabled:x,triggered:m,toggle:p}=je({aetherKey:e,source:c,sink:u});return n.jsxRuntimeExports.jsx(I,{...t,onChange:o,children:n.jsxRuntimeExports.jsx(ce,{...s,orientation:r,children:n.jsxRuntimeExports.jsx(Cn,{enabled:x,triggered:m,onClick:p,orientation:r,color:i})})})}),gi=e=>n.jsxRuntimeExports.jsx(Cn,{...e}),Ei=a.wrap$1("Button",({aetherKey:e,label:t,orientation:s,sink:o,control:r})=>{const{click:i}=Rl({aetherKey:e,sink:o});return n.jsxRuntimeExports.jsx(ce,{...r,className:l.CSS.B("symbol"),orientation:s,children:n.jsxRuntimeExports.jsx(vn,{label:t==null?void 0:t.label,onClick:i})})}),Si=({label:e,...t})=>n.jsxRuntimeExports.jsx(vn,{label:"Button",...t}),F=4,Ri=2,bi=["threeWayValve","valve","solenoidValve","fourWayValve","angledValve","pump","tank","reliefValve","regulator","burstDisc","cap","manualValve","filter","needleValve","checkValve","orifice","angledReliefValve","value","button","switch"];Zn.z.enum(bi);const fe={source:f.sourcePipeline("boolean",{connections:[{from:"valueStream",to:"threshold"}],segments:{valueStream:f.streamChannelValue({channel:0}),threshold:f.withinBounds({trueBound:{lower:.9,upper:1.1}})},outlet:"threshold"}),sink:f.sinkPipeline("boolean",{connections:[{from:"setpoint",to:"setter"}],segments:{setter:f.setChannelValue({channel:0}),setpoint:f.setpoint({truthy:1,falsy:0})},inlet:"setpoint"})},yi={name:"Three Way Valve",variant:"threeWayValve",Form:we,Symbol:Nl,defaultProps:e=>({color:e.colors.gray.l9.rgba255,label:{label:"Three Way Valve",level:"p",orientation:"top"},...fe,orientation:"left"}),Preview:_l,zIndex:F},Ci={name:"Valve",variant:"valve",Form:we,Symbol:Bl,defaultProps:e=>({color:e.colors.gray.l9.rgba255,label:{label:"Valve",level:"p",orientation:"top"},orientation:"left",...fe}),Preview:Dl,zIndex:F},vi={name:"Solenoid Valve",variant:"solenoidValve",Form:ul,Symbol:zl,defaultProps:e=>({color:e.colors.gray.l9.rgba255,label:{label:"Solenoid Valve",level:"p",orientation:"top"},orientation:"left",...fe}),Preview:Ol,zIndex:F},wi={name:"Four Way Valve",variant:"fourWayValve",Form:we,Symbol:Vl,defaultProps:e=>({color:e.colors.gray.l9.rgba255,label:{label:"Four Way Valve",level:"p",orientation:"top"},orientation:"left",...fe}),Preview:Al,zIndex:F},$i={name:"Angled Valve",variant:"angledValve",Form:we,Symbol:Il,defaultProps:e=>({color:e.colors.gray.l9.rgba255,label:{label:"Angled Valve",level:"p",orientation:"top"},orientation:"left",...fe}),Preview:Zl,zIndex:F},Ti={name:"Pump",variant:"pump",Form:we,Symbol:Fl,defaultProps:e=>({color:e.colors.gray.l9.rgba255,label:{label:"Pump",level:"p",orientation:"top"},orientation:"left",...fe}),Preview:Yl,zIndex:F},Pi={name:"Tank",variant:"tank",Form:xl,Symbol:Gl,defaultProps:e=>({color:e.colors.gray.l9.rgba255,label:{label:"Tank",level:"p",orientation:"top"},dimensions:{width:100,height:200},orientation:"left"}),Preview:Hl,zIndex:Ri},ki={name:"Relief Valve",variant:"reliefValve",Form:se,Symbol:Ul,defaultProps:e=>({color:e.colors.gray.l9.rgba255,label:{label:"Relief Valve",level:"p",orientation:"top"},orientation:"left"}),Preview:ql,zIndex:F},Li={name:"Regulator",variant:"regulator",Form:se,Symbol:Wl,defaultProps:e=>({color:e.colors.gray.l9.rgba255,label:{label:"Regulator",level:"p",orientation:"top"},orientation:"left"}),Preview:Xl,zIndex:F},Mi={name:"Burst Disc",variant:"burstDisc",Form:se,Symbol:Kl,defaultProps:e=>({color:e.colors.gray.l9.rgba255,label:{label:"Burst Disc",level:"p",orientation:"top"},orientation:"left"}),Preview:Jl,zIndex:F},Ni={name:"Cap",variant:"cap",Form:se,Symbol:Ql,defaultProps:e=>({color:e.colors.gray.l9.rgba255,label:{label:"Cap",level:"p",orientation:"top"},orientation:"left"}),Preview:ei,zIndex:F},_i={name:"Manual Valve",variant:"manualValve",Form:se,Symbol:ti,defaultProps:e=>({color:e.colors.gray.l9.rgba255,label:{label:"Manual Valve",level:"p",orientation:"top"},orientation:"left"}),Preview:si,zIndex:F},Bi={name:"Filter",variant:"filter",Form:se,Symbol:ni,defaultProps:e=>({color:e.colors.gray.l9.rgba255,label:{label:"Filter",level:"p",orientation:"top"},orientation:"left"}),Preview:oi,zIndex:F},Di={name:"Needle Valve",variant:"needleValve",Form:se,Symbol:ri,defaultProps:e=>({color:e.colors.gray.l9.rgba255,label:{label:"Needle Valve",level:"p"},orientation:"left"}),Preview:li,zIndex:F},zi={name:"Check Valve",variant:"checkValve",Form:se,Symbol:ii,defaultProps:e=>({color:e.colors.gray.l9.rgba255,label:{label:"Check Valve",level:"p",orientation:"top"},orientation:"left"}),Preview:ci,zIndex:F},Oi={name:"Orifice",variant:"orifice",Form:se,Symbol:ai,defaultProps:e=>({color:e.colors.gray.l9.rgba255,label:{label:"Orifice",level:"p",orientation:"top"},orientation:"left"}),Preview:ui,zIndex:F},Vi={name:"Angled Relief Valve",variant:"angledReliefValve",Form:se,Symbol:xi,defaultProps:e=>({color:e.colors.gray.l9.rgba255,label:{label:"Angled Relief Valve",level:"p",orientation:"top"},orientation:"left"}),Preview:di,zIndex:F},Ai={name:"Value",variant:"value",Form:ml,Symbol:pi,Preview:fi,defaultProps:e=>({color:e.colors.gray.l9.rgba255,level:"h5",label:{label:"Value",level:"p",orientation:"top"},orientation:"left",telem:f.sourcePipeline("string",{connections:[{from:"valueStream",to:"stringifier"}],segments:{valueStream:f.streamChannelValue({channel:0}),stringifier:f.stringifyNumber({precision:2})},outlet:"stringifier"})}),zIndex:F},Ii={name:"Button",variant:"button",Symbol:Ei,Form:fl,Preview:Si,defaultProps:e=>({label:{label:"Button",level:"p",orientation:"top"},orientation:"left",sink:f.sinkPipeline("boolean",{connections:[{from:"setpoint",to:"setter"}],segments:{setter:f.setChannelValue({channel:0}),setpoint:f.setpoint({truthy:1,falsy:0})},inlet:"setpoint"})}),zIndex:F},Zi={name:"Switch",variant:"switch",Symbol:hi,Preview:gi,Form:we,defaultProps:e=>({label:{label:"Switch",level:"p",orientation:"top"},orientation:"left",...fe}),zIndex:F},Fi={value:Ai,threeWayValve:yi,valve:Ci,solenoidValve:vi,fourWayValve:wi,angledValve:$i,pump:Ti,tank:Pi,reliefValve:ki,regulator:Li,burstDisc:Mi,cap:Ni,manualValve:_i,filter:Bi,needleValve:Di,checkValve:zi,orifice:Oi,angledReliefValve:Vi,button:Ii,switch:Zi},Yi=Object.freeze(Object.defineProperty({__proto__:null,SYMBOLS:Fi},Symbol.toStringTag,{value:"Module"}));d.createContext({instrumentation:G.C.NOOP});const Gi=a.wrap$1(f.Provider$1.TYPE,({aetherKey:e,children:t,...s})=>{const o=a.useMemoDeepEqualProps(s),[{path:r},,i]=a.use$3({aetherKey:e,type:f.Provider$1.TYPE,schema:f.providerStateZ,initialState:o});return d.useEffect(()=>{i(o)},[o,i]),n.jsxRuntimeExports.jsx(a.Composite,{path:r,children:t})}),Hi="data:video/mp2t;base64,Ly8gQ29weXJpZ2h0IDIwMjMgU3lubmF4IExhYnMsIEluYy4KLy8KLy8gVXNlIG9mIHRoaXMgc29mdHdhcmUgaXMgZ292ZXJuZWQgYnkgdGhlIEJ1c2luZXNzIFNvdXJjZSBMaWNlbnNlIGluY2x1ZGVkIGluIHRoZSBmaWxlCi8vIGxpY2Vuc2VzL0JTTC50eHQuCi8vCi8vIEFzIG9mIHRoZSBDaGFuZ2UgRGF0ZSBzcGVjaWZpZWQgaW4gdGhhdCBmaWxlLCBpbiBhY2NvcmRhbmNlIHdpdGggdGhlIEJ1c2luZXNzIFNvdXJjZQovLyBMaWNlbnNlLCB1c2Ugb2YgdGhpcyBzb2Z0d2FyZSB3aWxsIGJlIGdvdmVybmVkIGJ5IHRoZSBBcGFjaGUgTGljZW5zZSwgVmVyc2lvbiAyLjAsCi8vIGluY2x1ZGVkIGluIHRoZSBmaWxlIGxpY2Vuc2VzL0FQTC50eHQuCgppbXBvcnQgeyBwbHV0byB9IGZyb20gIkAvcGx1dG8vYWV0aGVyIjsKCnBsdXRvLnJlbmRlcigpOwo=",$n=a.wrap$1(f.BaseProvider.TYPE,({children:e,aetherKey:t})=>{const[{path:s}]=a.use$3({aetherKey:t,type:f.BaseProvider.TYPE,schema:f.providerStateZ$1,initialState:{}});return n.jsxRuntimeExports.jsx(a.Composite,{path:s,children:e})}),Ui=Object.freeze(Object.defineProperty({__proto__:null,Provider:$n},Symbol.toStringTag,{value:"Module"})),qi=({children:e,connParams:t,workerEnabled:s=!0,workerURL:o,theme:r,toggleTheme:i,setTheme:c,tooltip:u,triggers:x,alamos:m,haul:p,channelAlias:j})=>n.jsxRuntimeExports.jsx(a.Provider$1,{...x,children:n.jsxRuntimeExports.jsx(a.Config,{...u,children:n.jsxRuntimeExports.jsx(a.Provider$2,{...p,children:n.jsxRuntimeExports.jsx(a.Provider$3,{url:o??Hi,enabled:s,children:n.jsxRuntimeExports.jsx(a.Provider$4,{workerKey:"vis",children:n.jsxRuntimeExports.jsx(Gi,{...m,children:n.jsxRuntimeExports.jsx(a.Aggregator,{children:n.jsxRuntimeExports.jsx(Cs,{connParams:t,children:n.jsxRuntimeExports.jsx($s,{...j,children:n.jsxRuntimeExports.jsx($n,{children:n.jsxRuntimeExports.jsx(a.Provider,{theme:r,toggleTheme:i,setTheme:c,children:n.jsxRuntimeExports.jsx(sn,{children:e})})})})})})})})})})})}),Wi=Object.freeze(Object.defineProperty({__proto__:null,Provider:qi},Symbol.toStringTag,{value:"Module"})),Xi=({timeRange:e})=>{const t=new l.TimeStamp(e.start),s=t.isToday?"time":"dateTime",o=new l.TimeStamp(e.end),r=o.equals(l.TimeStamp.MAX),i=o.span(t)<l.TimeSpan.DAY?"time":"dateTime";return n.jsxRuntimeExports.jsxs(N.Space,{direction:"x",size:"small",className:l.CSS(l.CSS.B("time-range-chip")),align:"center",children:[t.isToday&&n.jsxRuntimeExports.jsx(a.Text,{level:"p",shade:7,weight:450,children:"Today"}),n.jsxRuntimeExports.jsx(a.DateTime,{level:"p",displayTZ:"local",format:s,shade:7,weight:450,children:t}),n.jsxRuntimeExports.jsx(a.u0.Arrow.Right,{color:"var(--pluto-text-color)"}),r?n.jsxRuntimeExports.jsx(a.Text,{level:"p",children:"Now"}):n.jsxRuntimeExports.jsx(a.DateTime,{level:"p",displayTZ:"local",format:i,shade:7,weight:450,children:o})]})},Ki=[{key:"color",name:"Color",width:50,render:e=>n.jsxRuntimeExports.jsx(a.u0.Circle,{style:{fontSize:10,marginLeft:10,marginRight:30},color:e.entry.color})},{key:"name",name:"Name"}],Ji=e=>{const t=Le();return n.jsxRuntimeExports.jsx(Rt,{...e,searcher:t==null?void 0:t.labels,columns:Ki,renderTag:s=>s.entry==null?n.jsxRuntimeExports.jsx(Ze,{color:"gray",children:s.entryKey}):n.jsxRuntimeExports.jsx(Ze,{color:s.entry.color,children:s.entry.name})})},Qi=Object.freeze(Object.defineProperty({__proto__:null,SelectLabels:Ji,TimeRangeChip:Xi},Symbol.toStringTag,{value:"Module"})),ec=({value:e})=>n.jsxRuntimeExports.jsx("div",{className:l.CSS.B("progress"),children:n.jsxRuntimeExports.jsx("div",{className:l.CSS.B("progress-bar"),style:{width:`${e}%`}})}),tc=Object.freeze(Object.defineProperty({__proto__:null,Progress:ec},Symbol.toStringTag,{value:"Module"})),Tn=({path:e,allowNull:t=!1})=>{const{bind:s,get:o,set:r}=_e(),[i,c]=d.useState(o(e,t));if(d.useLayoutEffect(()=>(c(o(e,t)),s(e,c,!1)),[e,s,c]),i==null&&!t)throw new Error("Field state is null");return{onChange:d.useCallback(u=>r(e,u),[e,r]),...i}},sc=(e,t)=>{const s=_e();d.useLayoutEffect(()=>s.bind(e,o=>t(o,s),!1),[e,s])},nc=({path:e,allowNull:t=!1})=>{const{bind:s,get:o}=_e(),[r,i]=d.useState(o(e,t));if(d.useLayoutEffect(()=>(i(o(e,t)),s(e,c=>i({...c,value:l.shallowCopy(c.value)}),!0)),[e,s,o]),r==null&&!t)throw new Error("Field state is null");return(r==null?void 0:r.value)??null},oc=({path:e,updateOnChildren:t=!1})=>{const{bind:s,get:o,set:r}=_e(),[i,c]=d.useState(o(e,!1).value);d.useLayoutEffect(()=>(c(o(e,!1).value),s(e,m=>c(l.shallowCopy(m.value)),t)),[e,s,o,c]);const u=d.useCallback(m=>{const p=l.shallowCopy(o(e,!1).value);p.push(...l.toArray(m)),r(e,p)},[e,o,r]),x=d.useCallback(m=>{const p=l.shallowCopy(o(e,!1).value);l.toArray(m).sort((h,g)=>g-h).forEach(h=>p.splice(h,1)),r(e,p)},[e,i,o]);return{value:i,push:u,remove:x}},rc=a.componentRenderProp(a.Text$1),lc=({path:e,children:t=rc,label:s,padHelpText:o=!0,visible:r=!0,...i})=>{const c=Tn({path:e});if(e==null||e.length===0)throw new Error("Path is required");if(s==null&&(s=l.Case.capitalize(l.external.element(e,-1))),r=typeof r=="function"?r(c):r,!r)return null;const u=c.touched?c.status.message:"";return n.jsxRuntimeExports.jsx(H.Item,{padHelpText:o,helpText:u,label:s,...i,children:t(c)})},Nt=d.createContext({bind:()=>()=>{},set:()=>{},get:()=>({value:void 0,status:{key:"",variant:"success",message:""},touched:!1}),validate:()=>!1,value:()=>({}),has:()=>!1}),_e=()=>d.useContext(Nt),ic=e=>({key:e,variant:"success",message:""}),cc=({initialValues:e,schema:t})=>{const s=d.useRef({state:e,status:new Map,touched:new Set,listeners:new Map,parentListeners:new Map}),o=a.useSyncedRef(t),r=d.useCallback((m,p,j)=>{var b;const{parentListeners:h,listeners:g}=s.current,E=j?h:g;return E.has(m)||E.set(m,new Set),(b=E.get(m))==null||b.add(p),()=>{var S;return(S=E.get(m))==null?void 0:S.delete(p)}},[]),i=d.useCallback((m,p)=>{const{state:j,status:h,touched:g}=s.current,E=l.external.get(j,m,p);return E==null?null:{value:E,status:h.get(m)??ic(m),touched:g.has(m)}},[]),c=d.useCallback(m=>{const{state:p,status:j,listeners:h}=s.current;console.log(p);const g=o.current.safeParse(p);if(console.log(g.success),g.success){const b=Array.from(j.keys());return j.clear(),b.forEach(S=>{var v;const y=i(S,!0);y!=null&&((v=h.get(S))==null||v.forEach(C=>C(y)))}),!0}const E=new Set(g.error.issues.map(b=>b.path.join(".")));return g.error.issues.forEach(b=>{var v;const S=b.path.join(".");j.set(S,{key:S,variant:"error",message:b.message});const y=i(S,!1);(v=h.get(S))==null||v.forEach(C=>C(y))}),j.forEach((b,S)=>{var y;if(!E.has(S)){j.delete(S);const v=i(S,!1);(y=h.get(S))==null||y.forEach(C=>C(v))}}),!1},[]),u=d.useCallback((m,p)=>{var b;const{state:j,touched:h,listeners:g,parentListeners:E}=s.current;h.add(m),l.external.set(j,m,p),c(),(b=g.get(m))==null||b.forEach(S=>S(i(m,!1))),E.forEach((S,y)=>{m.startsWith(y)&&S.forEach(v=>v(i(y,!1)))})},[]),x=d.useCallback(m=>{const{state:p}=s.current;return l.external.has(p,m)},[]);return d.useMemo(()=>({bind:r,set:u,get:i,validate:c,value:()=>s.current.state,has:x}),[r,u,i,c])},ac=e=>n.jsxRuntimeExports.jsx(Nt.Provider,{value:e,children:e.children}),uc=Object.freeze(Object.defineProperty({__proto__:null,Context:Nt,Field:lc,Form:ac,use:cc,useChildFieldValues:nc,useContext:_e,useField:Tn,useFieldArray:oc,useFieldListener:sc},Symbol.toStringTag,{value:"Module"}));exports.Aether=a.main;exports.Divider=a.Divider$1;exports.Dropdown=a.Dropdown;exports.Haul=a.Haul;exports.Worker=a.Context$1;exports.compareArrayDeps=a.compareArrayDeps;exports.componentRenderProp=a.componentRenderProp;exports.isRenderProp=a.isRenderProp;exports.useAsyncEffect=a.useAsyncEffect;exports.useClickOutside=a.useClickOutside;exports.useCombinedRefs=a.useCombinedRefs;exports.useCombinedStateAndRef=a.useCombinedStateAndRef;exports.useDebouncedCallback=a.useDebouncedCallback;exports.useEffectCompare=a.useEffectCompare;exports.useMemoCompare=a.useMemoCompare;exports.useMemoDeepEqualProps=a.useMemoDeepEqualProps;exports.usePrevious=a.usePrevious;exports.useResize=a.useResize;exports.useStateRef=a.useStateRef;exports.useSyncedRef=a.useSyncedRef;exports.useTransforms=a.useTransforms;exports.CSS=l.CSS;exports.newBEM=l.newBEM;exports.Header=ze.external;exports.Generic=N.Generic;exports.state=G.state;exports.telem=f.external;exports.Color=pt.external;exports.Triggers=mt.external;exports.Text=ne.external;exports.List=Re.external;exports.createFilterTransform=Re.createFilterTransform;exports.fuseFilter=Re.fuseFilter;exports.proxyMemo=Re.proxyMemo;exports.Align=Dn.external;exports.Button=zn.external;exports.createHexOpacityVariants=Jt.createHexOpacityVariants;exports.unitProperty=Jt.unitProperty;exports.Input=H.external;exports.Menu=On.external;exports.Tabs=X.external;exports.Theming=Vn.external;exports.Tree=An.external;exports.Video=In.Video;exports.Accordion=ro;exports.Canvas=ao;exports.Channel=qo;exports.Control=Sl;exports.Diagram=Wr;exports.Eraser=lr;exports.Form=uc;exports.Line=xo;exports.LinePlot=Mo;exports.Measure=Bo;exports.Mosaic=or;exports.Nav=ur;exports.OS=jr;exports.PID=Yi;exports.Pluto=Wi;exports.Progress=tc;exports.Ranger=Qi;exports.Resize=Kn;exports.Rule=Do;exports.Select=$o;exports.Status=Yn;exports.Synnax=Go;exports.Table=sl;exports.TableCell=ll;exports.Tag=go;exports.Telem=Ui;exports.Tooltip=Gn;exports.Value=cl;exports.Viewport=Lo;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|