@flesler/cursor-canvas-web 1.3.0 → 1.4.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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),p=require("@mantine/core"),m=require("react"),k=require("./host-tokens-Lz69pkRj.cjs"),D=require("@mantine/charts"),w={success:"#1F8A65",danger:"#CF2D56",warning:"#E8A33D",info:"#2E79B5",neutral:"#8888A8",added:"#1F8A65",deleted:"#CF2D56",renamed:"#5A6CC0"},ne={success:"green",danger:"red",warning:"orange",info:"blue",neutral:"gray",added:"green",deleted:"red",renamed:"indigo"};function y(){const t=p.useComputedColorScheme("light")==="dark"?"dark":"light";return k.resolveThemeForColorScheme(t)}const re={verticalAlign:"bottom",align:"center"},oe={legend:{justifyContent:"center"}};function G(){const t=y().chart.sequence;return(n,o)=>n?w[n]:t[o%t.length]}function se(){const t=y().text.primary;return{textColor:t,barLabelColor:t}}function ae(e,t){return e.map((n,o)=>{const a={category:n};for(const s of t)a[s.name]=s.data[o]??0;return a})}function ie(e,t){return e.map((n,o)=>({name:n.name,color:t(n.tone,o)}))}function le(e,t){return n=>`${t??""}${n}${e??""}`}function xe(e,t){if(e!=null&&e.length)return e.map(n=>({...t?{x:n.value}:{y:n.value},label:n.label,color:n.tone?w[n.tone]:w.neutral}))}const ye=new Set(["log","symlog","pow","sqrt"]);function ge(e){const{scale:t}=e;return typeof t!="string"||!ye.has(t)?e:{...e,type:e.type??"number",allowDataOverflow:e.allowDataOverflow??!0,allowDecimals:e.allowDecimals??!0,domain:e.domain??[1,"dataMax"]}}function ce(e){const t=xe(e.referenceLines,!!e.horizontal);let n;if(!e.stacked&&!e.normalized){const s=e.beginAtZero!==!1;n=[e.yMin??(s?0:"auto"),e.yMax??"auto"]}const o=e.valueAxis?ge(e.valueAxis):void 0;if(!n&&!o)return{referenceLines:t};const a={...n&&{domain:n},...o};return e.horizontal?{xAxisProps:a,referenceLines:t}:{yAxisProps:a,referenceLines:t}}function me(e,t,n){return e!==void 0?e:t.length===1&&n.length<=8}const Q=14;function be(e){return e.length<=Q?e:`${e.slice(0,Q-1)}…`}function je(e){var s;const t=typeof e.x=="number"?e.x:Number(e.x)||0,n=typeof e.y=="number"?e.y:Number(e.y)||0,o=String(((s=e.payload)==null?void 0:s.value)??""),a=be(o);return r.jsx("g",{transform:`translate(${t},${n})`,children:r.jsxs("text",{x:-10,y:0,dy:4,textAnchor:"end",fill:"currentColor",fontSize:12,children:[r.jsx("title",{children:o}),a]})})}function ve(e){return{fontWeight:700,fill:e}}function Se(){return{yAxisProps:{tick:je,width:96},barChartProps:{margin:{right:32}}}}function ke(){return{barChartProps:{margin:{top:22}}}}function Ce({categories:e,series:t,height:n=240,fill:o,valueSuffix:a,valuePrefix:s,showValues:c,showHoverGuide:f=!0,beginAtZero:d,yMin:l,yMax:u,referenceLines:g,style:j,extra:h,smooth:C}){const T=(h==null?void 0:h.smooth)??C,L=G(),P=se(),M=ae(e,t),E=ie(t,L),v=!!(o&&(h!=null&&h.stacked)),F=ce({beginAtZero:d,yMin:l,yMax:u,referenceLines:g,horizontal:!1,stacked:v,valueAxis:h==null?void 0:h.valueAxis}),A={h:n,data:M,dataKey:"category",series:E,curveType:T?"monotone":"linear",withLegend:t.length>1,legendProps:re,valueFormatter:le(a,s),withPointLabels:c??e.length<=20,tooltipProps:f?void 0:{cursor:!1},styles:{...oe,legendItemName:{color:P.textColor}},...F,style:j};return o?r.jsx(D.AreaChart,{...A,type:v?"stacked":"default"}):r.jsx(D.LineChart,{...A})}function we({categories:e,series:t,height:n=240,stacked:o,horizontal:a,normalized:s,valueSuffix:c,valuePrefix:f,showValues:d,beginAtZero:l,yMin:u,yMax:g,referenceLines:j,style:h,extra:C}){const T=G(),L=se(),P=ae(e,t),M=s?"percent":o?"stacked":"default",E=ce({beginAtZero:l,yMin:u,yMax:g,referenceLines:j,horizontal:a,stacked:o,normalized:s,valueAxis:C==null?void 0:C.valueAxis}),v=!o&&!s&&me(d,t,e);return r.jsx(D.BarChart,{h:n,data:P,dataKey:"category",series:ie(t,T),type:M,orientation:a?"vertical":"horizontal",withLegend:t.length>1,legendProps:re,valueFormatter:le(c,f),withBarValueLabel:v,...v?{valueLabelProps:ve(L.barLabelColor)}:{},...a?Se():v?ke():{},styles:{...oe,legendItemName:{color:L.textColor}},...E,style:h})}const Te=180,Le=540;function Pe(e,t){if(t<=0)return"0%";const n=e/t*100;return n<10&&Math.abs(n-Math.round(n))>.05?`${n.toFixed(1)}%`:`${Math.round(n)}%`}function Ae(e){return Math.max(28,Math.round(e*.22))}function Me(e){return e.map(t=>({dataKey:t.name,value:t.name,color:t.color,type:"circle"}))}function Be(e,t){return e.map(n=>({name:n.name,color:n.color,label:`${n.name} ${Pe(n.value,t)}`}))}function De({total:e,family:t,primary:n,subtitle:o}){return r.jsxs("text",{x:"50%",y:"50%",textAnchor:"middle",dominantBaseline:"central",fontFamily:t,children:[r.jsx("tspan",{x:"50%",dy:"-0.4em",fontSize:20,fontWeight:600,fill:n,children:e}),r.jsx("tspan",{x:"50%",dy:"1.55em",fontSize:16,fontWeight:500,fill:o,children:"Total"})]})}function Ee({data:e,size:t=200,donut:n,style:o}){const[a,s]=m.useState(null),c=y(),f=G(),d=e.map((h,C)=>({name:h.label,value:h.value,color:f(h.tone,C)})),l=d.reduce((h,C)=>h+C.value,0),u={startAngle:Te,endAngle:Le},g=h=>({opacity:a===null||a===h?1:.35}),j=n?r.jsx(D.DonutChart,{data:d,size:t,thickness:Ae(t),withTooltip:!0,cellProps:h=>g(h.name),...u,children:r.jsx(De,{total:l,family:c.typography.fontFamily,primary:c.text.primary,subtitle:c.text.secondary})}):r.jsx(D.PieChart,{data:d,size:t,withTooltip:!0,withLabelsLine:!1,cellProps:h=>g(h.name),...u});return r.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",alignItems:"center",...o},children:[r.jsx("div",{style:{width:"100%",height:t,minHeight:t,display:"flex",alignItems:"center",justifyContent:"center"},children:j}),r.jsx(D.ChartLegend,{payload:Me(d),series:Be(d,l),legendPosition:"bottom",centered:!0,onHighlight:s,mt:"sm",w:"100%",styles:{legend:{justifyContent:"center",gap:12,color:c.text.primary},legendItemName:{color:c.text.primary}}})]})}function Fe(e){const{nodes:t,edges:n,direction:o="vertical",nodeWidth:a=160,nodeHeight:s=40,rankGap:c=64,nodeGap:f=48,padding:d=24}=e,l=t.map(i=>i.id),u=new Set(l),g=new Map;for(const i of l)g.set(i,[]);for(const i of n)u.has(i.from)&&u.has(i.to)&&g.get(i.from).push(i.to);const j=0,h=1,C=2,T=new Map(l.map(i=>[i,j])),L=new Set,P=(i,x)=>`${i}\0${x}`,M=i=>{T.set(i,h);for(const x of g.get(i)??[]){const b=T.get(x);b===h?L.add(P(i,x)):b===j&&M(x)}T.set(i,C)};for(const i of l)T.get(i)===j&&M(i);const E=n.filter(i=>u.has(i.from)&&u.has(i.to)&&!L.has(P(i.from,i.to))),v=new Map(l.map(i=>[i,0])),F=new Map(l.map(i=>[i,[]]));for(const i of E)F.get(i.from).push(i.to),v.set(i.to,(v.get(i.to)??0)+1);const A=new Map(l.map(i=>[i,0])),N=l.filter(i=>(v.get(i)??0)===0);for(;N.length>0;){const i=N.shift(),x=A.get(i);for(const b of F.get(i))A.set(b,Math.max(A.get(b),x+1)),v.set(b,v.get(b)-1),v.get(b)===0&&N.push(b)}const B=new Map;for(const i of l){const x=A.get(i);B.has(x)||B.set(x,[]),B.get(x).push(i)}const I=[...B.keys()].sort((i,x)=>i-x),S=o==="vertical",$=i=>i*(S?a:s)+Math.max(0,i-1)*f,q=Math.max(0,...I.map(i=>$(B.get(i).length))),R=new Map,K=[];I.forEach((i,x)=>{const b=B.get(i),z=$(b.length),_=d+(q-z)/2,H=d+x*((S?s:a)+c);b.forEach((U,Z)=>{const J=_+Z*((S?a:s)+f),he=S?J:H,pe=S?H:J;R.set(U,{id:U,x:he,y:pe,rank:i,order:Z})}),K.push({rank:i,x:S?_:H,y:S?H:_,width:S?z:a,height:S?s:z,nodeIds:b})});const V=(i,x)=>i?S?{x:i.x+a/2,y:x==="source"?i.y+s:i.y}:{x:x==="source"?i.x+a:i.x,y:i.y+s/2}:{x:0,y:0},fe=n.filter(i=>u.has(i.from)&&u.has(i.to)).map(i=>{const x=V(R.get(i.from),"source"),b=V(R.get(i.to),"target");return{from:i.from,to:i.to,sourceX:x.x,sourceY:x.y,targetX:b.x,targetY:b.y,isBackEdge:L.has(P(i.from,i.to))}}),X=d*2+I.length*(S?s:a)+Math.max(0,I.length-1)*c,Y=d*2+q;return{nodes:[...R.values()],edges:fe,ranks:K,direction:o,width:S?Y:X,height:S?X:Y}}function Ie({additions:e=0,deletions:t=0,style:n}){return e===0&&t===0?null:r.jsxs("span",{style:{display:"inline-flex",gap:8,fontVariantNumeric:"tabular-nums",fontSize:12,fontWeight:600,...n},children:[e>0&&r.jsxs("span",{style:{color:w.added},children:["+",e]}),t>0&&r.jsxs("span",{style:{color:w.deleted},children:["-",t]})]})}const Re={added:"+",removed:"-",unchanged:" "};function He({lines:e,showLineNumbers:t=!0,coloredLineNumbers:n=!0,showAccentStrip:o=!0,style:a}){const s=y(),c=l=>l==="added"?s.diff.insertedLine:l==="removed"?s.diff.removedLine:"transparent",f=l=>l==="added"?s.diff.stripAdded:l==="removed"?s.diff.stripRemoved:"transparent",d=l=>n&&l==="added"?w.added:n&&l==="removed"?w.deleted:s.text.tertiary;return r.jsx("div",{style:{fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, "Cascadia Code", monospace',fontSize:12.5,lineHeight:"18px",color:s.text.primary,overflowX:"auto",...a},children:e.map((l,u)=>r.jsxs("div",{style:{display:"flex",alignItems:"stretch",background:c(l.type),borderLeft:o?`3px solid ${f(l.type)}`:void 0},children:[t&&r.jsx("span",{style:{flex:"0 0 auto",width:40,textAlign:"right",paddingRight:10,userSelect:"none",color:d(l.type)},children:l.lineNumber??""}),r.jsx("span",{style:{flex:"0 0 auto",width:14,textAlign:"center",userSelect:"none",color:d(l.type)},children:Re[l.type]}),r.jsx("pre",{style:{margin:0,padding:"0 8px",whiteSpace:"pre",fontFamily:"inherit"},children:l.content})]},u))})}function Ne({status:e}){const t=y(),n=e==="completed"?w.success:e==="in_progress"?t.accent.primary:e==="cancelled"?w.danger:t.text.tertiary;return r.jsxs("svg",{width:14,height:14,viewBox:"0 0 14 14",fill:"none",style:{flex:"0 0 auto",marginTop:3},"aria-hidden":!0,children:[r.jsx("circle",{cx:7,cy:7,r:6,stroke:n,strokeWidth:1.4}),e==="completed"&&r.jsx("path",{d:"M4 7.2l2 2 4-4.4",stroke:n,strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round"}),e==="in_progress"&&r.jsx("circle",{cx:7,cy:7,r:3,fill:n}),e==="cancelled"&&r.jsx("path",{d:"M4.8 4.8l4.4 4.4M9.2 4.8l-4.4 4.4",stroke:n,strokeWidth:1.4,strokeLinecap:"round"})]})}function de({todos:e,dimmedTodoIds:t,onTodoClick:n,style:o}){const a=y();return e.length===0?null:r.jsx("div",{style:{display:"flex",flexDirection:"column",...o},children:e.map(s=>{const c=t==null?void 0:t.has(s.id);return r.jsxs("button",{type:"button",onClick:()=>n==null?void 0:n(s),style:{display:"flex",gap:8,alignItems:"flex-start",width:"100%",textAlign:"left",padding:"4px 6px",background:"transparent",border:"none",cursor:n?"pointer":"default",color:a.text.primary,fontSize:14,lineHeight:"20px",opacity:c?.45:1},children:[r.jsx(Ne,{status:s.status}),r.jsx("span",{style:{textDecoration:s.status==="cancelled"?"line-through":void 0,color:s.status==="cancelled"?a.text.tertiary:void 0},children:s.content})]},s.id)})})}function ze({todos:e,dimmedTodoIds:t,defaultExpanded:n=!1,onTodoClick:o,style:a}){const s=y(),[c,f]=m.useState(n);if(e.length===0)return null;const d=e.filter(l=>l.status==="completed").length;return r.jsxs("div",{style:{border:`1px solid ${s.stroke.primary}`,borderRadius:6,overflow:"hidden",...a},children:[r.jsxs("button",{type:"button",onClick:()=>f(l=>!l),style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"6px 10px",background:s.fill.secondary,border:"none",cursor:"pointer",color:s.text.secondary,fontSize:12,fontWeight:600},children:[r.jsx("svg",{width:12,height:12,viewBox:"0 0 12 12",fill:"none",style:{transform:c?"rotate(90deg)":"none",transition:"transform 120ms"},"aria-hidden":!0,children:r.jsx("path",{d:"M4 2.5L8 6l-4 3.5",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round"})}),r.jsx("span",{children:"Todos"}),r.jsx("span",{style:{flex:1}}),r.jsxs("span",{children:[d," of ",e.length," Done"]})]}),c&&r.jsx("div",{style:{padding:6},children:r.jsx(de,{todos:e,dimmedTodoIds:t,onTodoClick:o})})]})}function _e(e,t){const n=`canvas:${e}`,[o,a]=m.useState(()=>{if(typeof localStorage>"u")return t;try{const c=localStorage.getItem(n);return c===null?t:JSON.parse(c)}catch{return t}}),s=m.useCallback(c=>{a(f=>{const d=typeof c=="function"?c(f):c;try{localStorage==null||localStorage.setItem(n,JSON.stringify(d))}catch{}return d})},[n]);return[o,s]}function Ge(){return m.useCallback(e=>{},[])}function Oe(e,t){return{...e,...t}}function O(e,t,n){const o=e.typography[t];return{fontFamily:e.typography.fontFamily,fontSize:o.fontSize,lineHeight:o.lineHeight,fontWeight:o.fontWeight,color:e.text.primary,margin:0,...n}}function We({children:e,style:t}){const n=y();return r.jsx(p.Title,{order:1,style:O(n,"h1",t),children:e})}function $e({children:e,style:t}){const n=y();return r.jsx(p.Title,{order:2,style:O(n,"h2",t),children:e})}function qe({children:e,style:t}){const n=y();return r.jsx(p.Title,{order:3,style:O(n,"h3",t),children:e})}const Ke={normal:400,medium:500,semibold:600,bold:700},ee=m.createContext(!1);function Ve({children:e,tone:t="primary",size:n="body",as:o="p",weight:a="normal",italic:s,truncate:c,style:f}){const d=y(),u=m.useContext(ee)&&o==="p"?"span":o,g=o==="p";return r.jsx(ee.Provider,{value:!0,children:r.jsx(p.Text,{component:u,size:n==="small"?"xs":"sm",fw:Ke[a],c:t==="primary"?void 0:d.text[t],truncate:c,style:{fontStyle:s?"italic":void 0,...t==="primary"?{color:d.text.primary}:void 0,...g&&u==="span"?{display:"block"}:void 0,fontFamily:d.typography.fontFamily,...f},children:e})})}function Xe({children:e,style:t}){const n=y();return r.jsx("code",{style:{fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, "Cascadia Code", monospace',fontSize:"0.92em",color:n.text.primary,background:n.fill.secondary,borderRadius:n.radius.sm,padding:"1px 4px",...t},children:e})}function Ye({children:e,href:t,style:n}){const o=y();return r.jsx("a",{href:t,target:"_blank",rel:"noreferrer",style:{color:o.text.link,...n},children:e})}function Ue({children:e,gap:t,style:n}){return r.jsx(p.Stack,{gap:t,style:n,children:e})}const te={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch","space-between":"space-between"};function Ze({children:e,gap:t,align:n="center",justify:o="start",wrap:a=!1,style:s}){return r.jsx(p.Group,{gap:t,align:te[n],justify:te[o],wrap:a?"wrap":"nowrap",style:s,children:e})}function Je(){return r.jsx("div",{style:{flex:1}})}function Qe({children:e,columns:t,gap:n=16,align:o,style:a}){const s=typeof t=="number"?`repeat(${t}, minmax(0, 1fr))`:t;return r.jsx("div",{style:{display:"grid",gridTemplateColumns:s,gap:n,alignItems:o,...a},children:e})}function et({style:e}){return r.jsx(p.Divider,{style:e})}const W=m.createContext({collapsible:!1,open:!0,toggle:()=>{}});function tt({children:e,variant:t="default",collapsible:n=!1,defaultOpen:o=!0,open:a,onOpenChange:s,style:c}){const f=y(),[d,l]=m.useState(o),u=a??d,g=m.useCallback(()=>{const j=!u;a===void 0&&l(j),s==null||s(j)},[u,a,s]);return r.jsx(p.Card,{withBorder:t!=="borderless",radius:f.radius.md,padding:0,style:{background:f.bg.elevated,borderColor:f.stroke.secondary,...c},children:r.jsx(W.Provider,{value:{collapsible:n,open:u,toggle:g},children:e})})}function nt({children:e,trailing:t,style:n}){const o=y(),{collapsible:a,open:s,toggle:c}=m.useContext(W);return r.jsxs("div",{onClick:a?c:void 0,style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,padding:"8px 14px",borderBottom:`1px solid ${o.stroke.secondary}`,fontSize:o.typography.small.fontSize,fontWeight:o.typography.h3.fontWeight,color:o.text.primary,fontFamily:o.typography.fontFamily,cursor:a?"pointer":void 0,userSelect:a?"none":void 0,...n},children:[r.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[a&&r.jsx(ue,{expanded:s}),e]}),t!=null&&r.jsx("span",{children:t})]})}function rt({children:e,style:t}){const{collapsible:n,open:o}=m.useContext(W);return n&&!o?null:r.jsx("div",{style:{padding:14,...t},children:e})}function ue({expanded:e}){return r.jsx("svg",{width:12,height:12,viewBox:"0 0 12 12",fill:"none",style:{transform:e?"rotate(90deg)":"none",transition:"transform 120ms"},"aria-hidden":!0,children:r.jsx("path",{d:"M4 2.5L8 6l-4 3.5",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round"})})}function ot({value:e,label:t,tone:n,style:o}){const a=y();return r.jsxs("div",{style:o,children:[r.jsx(p.Text,{fz:22,fw:700,lh:1.2,style:{color:n?w[n]:a.text.primary,fontFamily:a.typography.fontFamily},children:e}),r.jsx(p.Text,{fz:12,style:{color:a.text.tertiary,fontFamily:a.typography.fontFamily},children:t})]})}function st({children:e,active:t,tone:n="neutral",size:o="md",leadingContent:a,keyboardHint:s,title:c,style:f,onClick:d}){return r.jsx(p.Badge,{color:ne[n],variant:t?"filled":"light",size:o==="sm"?"sm":"md",leftSection:a,rightSection:s,title:c,onClick:d,style:{cursor:d?"pointer":void 0,textTransform:"none",...f},children:e})}function at({children:e,tone:t="neutral",title:n,icon:o,style:a}){return r.jsx(p.Alert,{color:ne[t],title:n,icon:o,variant:"light",style:a,children:e})}const it={success:"rgba(31,138,101,0.12)",danger:"rgba(207,45,86,0.12)",warning:"rgba(232,163,61,0.14)",info:"rgba(46,121,181,0.12)",neutral:"rgba(136,136,168,0.12)"};function lt({headers:e,rows:t,columnAlign:n,rowTone:o,framed:a=!0,striped:s,stickyHeader:c,style:f,emptyMessage:d}){return r.jsxs(p.Table,{withTableBorder:a,withColumnBorders:!1,striped:s,stickyHeader:c,highlightOnHover:!0,style:f,children:[r.jsx(p.Table.Thead,{children:r.jsx(p.Table.Tr,{children:e.map((l,u)=>r.jsx(p.Table.Th,{ta:(n==null?void 0:n[u])??"left",children:l},u))})}),r.jsx(p.Table.Tbody,{children:t.length===0?r.jsx(p.Table.Tr,{children:r.jsx(p.Table.Td,{colSpan:e.length,ta:"center",c:"dimmed",children:d??"No data"})}):t.map((l,u)=>{const g=o==null?void 0:o[u];return r.jsx(p.Table.Tr,{style:g?{background:it[g]}:void 0,children:e.map((j,h)=>r.jsx(p.Table.Td,{ta:(n==null?void 0:n[h])??"left",children:l[h]},h))},u)})})]})}const ct={primary:"filled",secondary:"default",ghost:"subtle"};function dt({children:e,variant:t="secondary",disabled:n,type:o="button",style:a,onClick:s}){return r.jsx(p.Button,{variant:ct[t],color:t==="primary"?"accent":void 0,size:"xs",disabled:n,type:o,onClick:s,style:a,children:e})}function ut({children:e,onClick:t,disabled:n,title:o,variant:a="default",size:s="md",style:c}){return r.jsx(p.ActionIcon,{variant:a==="circle"?"light":"subtle",radius:a==="circle"?"xl":"sm",size:s==="sm"?"sm":"md",color:"gray",disabled:n,title:o,"aria-label":o,onClick:t,style:c,children:e})}function ft({value:e,onChange:t,options:n,placeholder:o,disabled:a,style:s}){return r.jsx(p.Select,{value:e,data:n,placeholder:o,disabled:a,allowDeselect:!1,onChange:c=>{c!==null&&(t==null||t(c))},style:s})}function ht({checked:e,onChange:t,disabled:n,label:o,style:a}){return r.jsx(p.Checkbox,{checked:e,disabled:n,label:o,onChange:s=>t==null?void 0:t(s.currentTarget.checked),style:a})}function pt({checked:e,onChange:t,disabled:n,size:o="sm",style:a}){return r.jsx(p.Switch,{checked:e,disabled:n,size:o==="sm"?"sm":"md",onChange:s=>t==null?void 0:t(s.currentTarget.checked),style:a})}function xt({value:e,onChange:t,placeholder:n,disabled:o,type:a,style:s}){return r.jsx(p.TextInput,{value:e,placeholder:n,disabled:o,type:a,onChange:c=>t==null?void 0:t(c.currentTarget.value),style:s})}function yt({value:e,onChange:t,placeholder:n,disabled:o,rows:a=3,style:s}){return r.jsx(p.Textarea,{value:e,placeholder:n,disabled:o,autosize:!0,minRows:a,onChange:c=>t==null?void 0:t(c.currentTarget.value),style:s})}function gt({color:e,style:t}){const n=y();return r.jsx("span",{style:{display:"inline-block",width:14,height:14,borderRadius:4,background:n.category[e],flex:"0 0 auto",...t}})}function mt({segments:e,total:t,topLeftLabel:n,topRightLabel:o,style:a}){const s=y(),c=t>0?t:1,f=e.reduce((l,u)=>l+(Number.isFinite(u.value)&&u.value>0?u.value:0),0),d=Math.max(0,c-f);return r.jsxs("div",{style:a,children:[(n!=null||o!=null)&&r.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:12,color:s.text.secondary,marginBottom:6},children:[r.jsx("span",{children:n}),r.jsx("span",{children:o})]}),r.jsxs("div",{style:{display:"flex",gap:2,height:8},children:[e.map((l,u)=>{const g=Number.isFinite(l.value)&&l.value>0?l.value:0,j=s.category[l.color??k.usageColorSequence[u%k.usageColorSequence.length]];return r.jsx("div",{style:{width:`${g/c*100}%`,background:j,borderRadius:3}},l.id)}),d>0&&r.jsx("div",{style:{width:`${d/c*100}%`,background:s.fill.tertiary,borderRadius:3}})]})]})}function bt({title:e,leading:t,count:n,trailing:o,children:a,defaultOpen:s=!1,style:c}){const f=y(),[d,l]=m.useState(s);return r.jsxs("div",{style:c,children:[r.jsxs("div",{onClick:()=>l(u=>!u),style:{display:"flex",alignItems:"center",gap:6,padding:"4px 0",cursor:"pointer",userSelect:"none",color:f.text.primary,fontSize:14},children:[r.jsx(ue,{expanded:d}),t,r.jsx("span",{style:{fontWeight:500},children:e}),n!=null&&r.jsx("span",{style:{color:f.text.tertiary,fontSize:12},children:n}),r.jsx("span",{style:{flex:1}}),o!=null&&r.jsx("span",{style:{color:f.text.tertiary},children:o})]}),d&&r.jsx("div",{style:{paddingLeft:18,paddingBottom:4},children:a})]})}Object.defineProperty(exports,"useEffect",{enumerable:!0,get:()=>m.useEffect});Object.defineProperty(exports,"useMemo",{enumerable:!0,get:()=>m.useMemo});Object.defineProperty(exports,"useRef",{enumerable:!0,get:()=>m.useRef});Object.defineProperty(exports,"useState",{enumerable:!0,get:()=>m.useState});exports.canvasPaletteDark=k.canvasPaletteDark;exports.canvasPaletteGrokDark=k.canvasPaletteGrokDark;exports.canvasPaletteGrokLight=k.canvasPaletteGrokLight;exports.canvasPaletteLight=k.canvasPaletteLight;exports.canvasTokens=k.canvasTokens;exports.canvasTokensLight=k.canvasTokensLight;exports.categoryPaletteDark=k.categoryPaletteDark;exports.categoryPaletteLight=k.categoryPaletteLight;exports.colorPalette=k.colorPalette;exports.usageColorSequence=k.usageColorSequence;exports.BarChart=we;exports.Button=dt;exports.Callout=at;exports.Card=tt;exports.CardBody=rt;exports.CardHeader=nt;exports.Checkbox=ht;exports.Code=Xe;exports.CollapsibleSection=bt;exports.DiffStats=Ie;exports.DiffView=He;exports.Divider=et;exports.Grid=Qe;exports.H1=We;exports.H2=$e;exports.H3=qe;exports.IconButton=ut;exports.LineChart=Ce;exports.Link=Ye;exports.PieChart=Ee;exports.Pill=st;exports.Row=Ze;exports.Select=ft;exports.Spacer=Je;exports.Stack=Ue;exports.Stat=ot;exports.Swatch=gt;exports.Table=lt;exports.Text=Ve;exports.TextArea=yt;exports.TextInput=xt;exports.TodoList=de;exports.TodoListCard=ze;exports.Toggle=pt;exports.UsageBar=mt;exports.computeDAGLayout=Fe;exports.mergeStyle=Oe;exports.useCanvasAction=Ge;exports.useCanvasState=_e;exports.useHostTheme=y;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),p=require("@mantine/core"),m=require("react"),k=require("./host-tokens-Lz69pkRj.cjs"),E=require("@mantine/charts"),T={success:"#1F8A65",danger:"#CF2D56",warning:"#E8A33D",info:"#2E79B5",neutral:"#8888A8",added:"#1F8A65",deleted:"#CF2D56",renamed:"#5A6CC0"},te={success:"green",danger:"red",warning:"orange",info:"blue",neutral:"gray",added:"green",deleted:"red",renamed:"indigo"};function g(){const e=p.useComputedColorScheme("light")==="dark"?"dark":"light";return k.resolveThemeForColorScheme(e)}const ne={verticalAlign:"bottom",align:"center"},re={legend:{justifyContent:"center"}};function G(){const e=g().chart.sequence;return(n,o)=>n?T[n]:e[o%e.length]}function oe(){const e=g().text.primary;return{textColor:e,barLabelColor:e}}function se(t,e){return t.map((n,o)=>{const s={category:n};for(const a of e)s[a.name]=a.data[o]??0;return s})}function ae(t,e){return t.map((n,o)=>({name:n.name,color:e(n.tone,o)}))}function ie(t,e){return n=>`${e??""}${n}${t??""}`}function ye(t,e){if(t!=null&&t.length)return t.map(n=>({...e?{x:n.value}:{y:n.value},label:n.label,color:n.tone?T[n.tone]:T.neutral}))}const ge=new Set(["log","symlog","pow","sqrt"]);function xe(t){const{scale:e}=t;return typeof e!="string"||!ge.has(e)?t:{...t,type:t.type??"number",allowDataOverflow:t.allowDataOverflow??!0,allowDecimals:t.allowDecimals??!0,domain:t.domain??[1,"dataMax"]}}function le(t){const e=ye(t.referenceLines,!!t.horizontal);let n;if(!t.stacked&&!t.normalized){const a=t.beginAtZero!==!1;n=[t.yMin??(a?0:"auto"),t.yMax??"auto"]}const o=t.valueAxis?xe(t.valueAxis):void 0;if(!n&&!o)return{referenceLines:e};const s={...n&&{domain:n},...o};return t.horizontal?{xAxisProps:s,referenceLines:e}:{yAxisProps:s,referenceLines:e}}function me(t,e,n){return t!==void 0?t:e.length===1&&n.length<=8}function be(t,e,n){return e.length!==1||e[0].tone?t:t.map((o,s)=>({...o,color:n(void 0,s)}))}const je=96,ve=6.5;function Se(t,e){return t.length<=e?t:`${t.slice(0,e-1)}…`}function Ce(t,e){var l;const n=typeof e.x=="number"?e.x:Number(e.x)||0,o=typeof e.y=="number"?e.y:Number(e.y)||0,s=String(((l=e.payload)==null?void 0:l.value)??""),a=Se(s,t);return r.jsx("g",{transform:`translate(${n},${o})`,children:r.jsxs("text",{x:-10,y:0,dy:4,textAnchor:"end",fill:"currentColor",fontSize:12,children:[r.jsx("title",{children:s}),a]})})}function ce(t){return{fontWeight:700,fill:t}}function ke(t){return{...ce(t),position:"right"}}function Te(t=je,e=!1){const n=Math.floor(t/ve);return{yAxisProps:{tick:o=>Ce(n,o),width:t},barChartProps:{margin:{right:e?48:32}},gridAxis:"y"}}function we(){return{barChartProps:{margin:{top:22}}}}function Le({categories:t,series:e,height:n=240,fill:o,valueSuffix:s,valuePrefix:a,showValues:l,showHoverGuide:f=!0,beginAtZero:u,yMin:c,yMax:d,referenceLines:x,style:j,extra:h,smooth:v}){const w=(h==null?void 0:h.smooth)??v,L=G(),P=oe(),B=se(t,e),I=ae(e,L),S=!!(o&&(h!=null&&h.stacked)),A=le({beginAtZero:u,yMin:c,yMax:d,referenceLines:x,horizontal:!1,stacked:S,valueAxis:h==null?void 0:h.valueAxis}),M={h:n,data:B,dataKey:"category",series:I,curveType:w?"monotone":"linear",withLegend:e.length>1,legendProps:ne,valueFormatter:ie(s,a),withPointLabels:l??t.length<=20,tooltipProps:f?void 0:{cursor:!1},styles:{...re,legendItemName:{color:P.textColor}},...A,style:j};return o?r.jsx(E.AreaChart,{...M,type:S?"stacked":"default"}):r.jsx(E.LineChart,{...M})}function Pe({categories:t,series:e,height:n=240,stacked:o,horizontal:s,normalized:a,valueSuffix:l,valuePrefix:f,showValues:u,beginAtZero:c,yMin:d,yMax:x,referenceLines:j,style:h,extra:v}){var A;const w=G(),L=oe(),P=be(se(t,e),e,w),B=a?"percent":o?"stacked":"default",I=le({beginAtZero:c,yMin:d,yMax:x,referenceLines:j,horizontal:s,stacked:o,normalized:a,valueAxis:v==null?void 0:v.valueAxis}),S=!o&&!a&&me(u,e,t);return r.jsx(E.BarChart,{h:n,data:P,dataKey:"category",series:ae(e,w),type:B,orientation:s?"vertical":"horizontal",withLegend:e.length>1,legendProps:ne,valueFormatter:ie(l,f),withBarValueLabel:S,...S?{valueLabelProps:s?ke(L.barLabelColor):ce(L.barLabelColor)}:{},...s?Te((A=v==null?void 0:v.categoryAxis)==null?void 0:A.width,S):S?we():{},styles:{...re,legendItemName:{color:L.textColor}},...I,style:h})}const Ae=180,Me=540;function Be(t,e){if(e<=0)return"0%";const n=t/e*100;return n<10&&Math.abs(n-Math.round(n))>.05?`${n.toFixed(1)}%`:`${Math.round(n)}%`}function De(t){return Math.max(28,Math.round(t*.22))}function Ee(t){return t.map(e=>({dataKey:e.name,value:e.name,color:e.color,type:"circle"}))}function Ie(t,e){return t.map(n=>({name:n.name,color:n.color,label:`${n.name} ${Be(n.value,e)}`}))}function Fe({total:t,family:e,primary:n,subtitle:o}){return r.jsxs("text",{x:"50%",y:"50%",textAnchor:"middle",dominantBaseline:"central",fontFamily:e,children:[r.jsx("tspan",{x:"50%",dy:"-0.4em",fontSize:20,fontWeight:600,fill:n,children:t}),r.jsx("tspan",{x:"50%",dy:"1.55em",fontSize:16,fontWeight:500,fill:o,children:"Total"})]})}function He({data:t,size:e=200,donut:n,style:o}){const[s,a]=m.useState(null),l=g(),f=G(),u=t.map((h,v)=>({name:h.label,value:h.value,color:f(h.tone,v)})),c=u.reduce((h,v)=>h+v.value,0),d={startAngle:Ae,endAngle:Me},x=h=>({opacity:s===null||s===h?1:.35}),j=n?r.jsx(E.DonutChart,{data:u,size:e,thickness:De(e),withTooltip:!0,cellProps:h=>x(h.name),...d,children:r.jsx(Fe,{total:c,family:l.typography.fontFamily,primary:l.text.primary,subtitle:l.text.secondary})}):r.jsx(E.PieChart,{data:u,size:e,withTooltip:!0,withLabelsLine:!1,cellProps:h=>x(h.name),...d});return r.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",alignItems:"center",...o},children:[r.jsx("div",{style:{width:"100%",height:e,minHeight:e,display:"flex",alignItems:"center",justifyContent:"center"},children:j}),r.jsx(E.ChartLegend,{payload:Ee(u),series:Ie(u,c),legendPosition:"bottom",centered:!0,onHighlight:a,mt:"sm",w:"100%",styles:{legend:{justifyContent:"center",gap:12,color:l.text.primary},legendItemName:{color:l.text.primary}}})]})}function Re(t){const{nodes:e,edges:n,direction:o="vertical",nodeWidth:s=160,nodeHeight:a=40,rankGap:l=64,nodeGap:f=48,padding:u=24}=t,c=e.map(i=>i.id),d=new Set(c),x=new Map;for(const i of c)x.set(i,[]);for(const i of n)d.has(i.from)&&d.has(i.to)&&x.get(i.from).push(i.to);const j=0,h=1,v=2,w=new Map(c.map(i=>[i,j])),L=new Set,P=(i,y)=>`${i}\0${y}`,B=i=>{w.set(i,h);for(const y of x.get(i)??[]){const b=w.get(y);b===h?L.add(P(i,y)):b===j&&B(y)}w.set(i,v)};for(const i of c)w.get(i)===j&&B(i);const I=n.filter(i=>d.has(i.from)&&d.has(i.to)&&!L.has(P(i.from,i.to))),S=new Map(c.map(i=>[i,0])),A=new Map(c.map(i=>[i,[]]));for(const i of I)A.get(i.from).push(i.to),S.set(i.to,(S.get(i.to)??0)+1);const M=new Map(c.map(i=>[i,0])),N=c.filter(i=>(S.get(i)??0)===0);for(;N.length>0;){const i=N.shift(),y=M.get(i);for(const b of A.get(i))M.set(b,Math.max(M.get(b),y+1)),S.set(b,S.get(b)-1),S.get(b)===0&&N.push(b)}const D=new Map;for(const i of c){const y=M.get(i);D.has(y)||D.set(y,[]),D.get(y).push(i)}const F=[...D.keys()].sort((i,y)=>i-y),C=o==="vertical",$=i=>i*(C?s:a)+Math.max(0,i-1)*f,q=Math.max(0,...F.map(i=>$(D.get(i).length))),H=new Map,V=[];F.forEach((i,y)=>{const b=D.get(i),_=$(b.length),z=u+(q-_)/2,R=u+y*((C?a:s)+l);b.forEach((U,Z)=>{const J=z+Z*((C?s:a)+f),he=C?J:R,pe=C?R:J;H.set(U,{id:U,x:he,y:pe,rank:i,order:Z})}),V.push({rank:i,x:C?z:R,y:C?R:z,width:C?_:s,height:C?a:_,nodeIds:b})});const K=(i,y)=>i?C?{x:i.x+s/2,y:y==="source"?i.y+a:i.y}:{x:y==="source"?i.x+s:i.x,y:i.y+a/2}:{x:0,y:0},fe=n.filter(i=>d.has(i.from)&&d.has(i.to)).map(i=>{const y=K(H.get(i.from),"source"),b=K(H.get(i.to),"target");return{from:i.from,to:i.to,sourceX:y.x,sourceY:y.y,targetX:b.x,targetY:b.y,isBackEdge:L.has(P(i.from,i.to))}}),X=u*2+F.length*(C?a:s)+Math.max(0,F.length-1)*l,Y=u*2+q;return{nodes:[...H.values()],edges:fe,ranks:V,direction:o,width:C?Y:X,height:C?X:Y}}function Ne({additions:t=0,deletions:e=0,style:n}){return t===0&&e===0?null:r.jsxs("span",{style:{display:"inline-flex",gap:8,fontVariantNumeric:"tabular-nums",fontSize:12,fontWeight:600,...n},children:[t>0&&r.jsxs("span",{style:{color:T.added},children:["+",t]}),e>0&&r.jsxs("span",{style:{color:T.deleted},children:["-",e]})]})}const _e={added:"+",removed:"-",unchanged:" "};function ze({lines:t,showLineNumbers:e=!0,coloredLineNumbers:n=!0,showAccentStrip:o=!0,style:s}){const a=g(),l=c=>c==="added"?a.diff.insertedLine:c==="removed"?a.diff.removedLine:"transparent",f=c=>c==="added"?a.diff.stripAdded:c==="removed"?a.diff.stripRemoved:"transparent",u=c=>n&&c==="added"?T.added:n&&c==="removed"?T.deleted:a.text.tertiary;return r.jsx("div",{style:{fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, "Cascadia Code", monospace',fontSize:12.5,lineHeight:"18px",color:a.text.primary,overflowX:"auto",...s},children:t.map((c,d)=>r.jsxs("div",{style:{display:"flex",alignItems:"stretch",background:l(c.type),borderLeft:o?`3px solid ${f(c.type)}`:void 0},children:[e&&r.jsx("span",{style:{flex:"0 0 auto",width:40,textAlign:"right",paddingRight:10,userSelect:"none",color:u(c.type)},children:c.lineNumber??""}),r.jsx("span",{style:{flex:"0 0 auto",width:14,textAlign:"center",userSelect:"none",color:u(c.type)},children:_e[c.type]}),r.jsx("pre",{style:{margin:0,padding:"0 8px",whiteSpace:"pre",fontFamily:"inherit"},children:c.content})]},d))})}function Ge({status:t}){const e=g(),n=t==="completed"?T.success:t==="in_progress"?e.accent.primary:t==="cancelled"?T.danger:e.text.tertiary;return r.jsxs("svg",{width:14,height:14,viewBox:"0 0 14 14",fill:"none",style:{flex:"0 0 auto",marginTop:3},"aria-hidden":!0,children:[r.jsx("circle",{cx:7,cy:7,r:6,stroke:n,strokeWidth:1.4}),t==="completed"&&r.jsx("path",{d:"M4 7.2l2 2 4-4.4",stroke:n,strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round"}),t==="in_progress"&&r.jsx("circle",{cx:7,cy:7,r:3,fill:n}),t==="cancelled"&&r.jsx("path",{d:"M4.8 4.8l4.4 4.4M9.2 4.8l-4.4 4.4",stroke:n,strokeWidth:1.4,strokeLinecap:"round"})]})}function ue({todos:t,dimmedTodoIds:e,onTodoClick:n,style:o}){const s=g();return t.length===0?null:r.jsx("div",{style:{display:"flex",flexDirection:"column",...o},children:t.map(a=>{const l=e==null?void 0:e.has(a.id);return r.jsxs("button",{type:"button",onClick:()=>n==null?void 0:n(a),style:{display:"flex",gap:8,alignItems:"flex-start",width:"100%",textAlign:"left",padding:"4px 6px",background:"transparent",border:"none",cursor:n?"pointer":"default",color:s.text.primary,fontSize:14,lineHeight:"20px",opacity:l?.45:1},children:[r.jsx(Ge,{status:a.status}),r.jsx("span",{style:{textDecoration:a.status==="cancelled"?"line-through":void 0,color:a.status==="cancelled"?s.text.tertiary:void 0},children:a.content})]},a.id)})})}function Oe({todos:t,dimmedTodoIds:e,defaultExpanded:n=!1,onTodoClick:o,style:s}){const a=g(),[l,f]=m.useState(n);if(t.length===0)return null;const u=t.filter(c=>c.status==="completed").length;return r.jsxs("div",{style:{border:`1px solid ${a.stroke.primary}`,borderRadius:6,overflow:"hidden",...s},children:[r.jsxs("button",{type:"button",onClick:()=>f(c=>!c),style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"6px 10px",background:a.fill.secondary,border:"none",cursor:"pointer",color:a.text.secondary,fontSize:12,fontWeight:600},children:[r.jsx("svg",{width:12,height:12,viewBox:"0 0 12 12",fill:"none",style:{transform:l?"rotate(90deg)":"none",transition:"transform 120ms"},"aria-hidden":!0,children:r.jsx("path",{d:"M4 2.5L8 6l-4 3.5",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round"})}),r.jsx("span",{children:"Todos"}),r.jsx("span",{style:{flex:1}}),r.jsxs("span",{children:[u," of ",t.length," Done"]})]}),l&&r.jsx("div",{style:{padding:6},children:r.jsx(ue,{todos:t,dimmedTodoIds:e,onTodoClick:o})})]})}function We(t,e){const n=`canvas:${t}`,[o,s]=m.useState(()=>{if(typeof localStorage>"u")return e;try{const l=localStorage.getItem(n);return l===null?e:JSON.parse(l)}catch{return e}}),a=m.useCallback(l=>{s(f=>{const u=typeof l=="function"?l(f):l;try{localStorage==null||localStorage.setItem(n,JSON.stringify(u))}catch{}return u})},[n]);return[o,a]}function $e(){return m.useCallback(t=>{},[])}function qe(t,e){return{...t,...e}}function O(t,e,n){const o=t.typography[e];return{fontFamily:t.typography.fontFamily,fontSize:o.fontSize,lineHeight:o.lineHeight,fontWeight:o.fontWeight,color:t.text.primary,margin:0,...n}}function Ve({children:t,style:e}){const n=g();return r.jsx(p.Title,{order:1,style:O(n,"h1",e),children:t})}function Ke({children:t,style:e}){const n=g();return r.jsx(p.Title,{order:2,style:O(n,"h2",e),children:t})}function Xe({children:t,style:e}){const n=g();return r.jsx(p.Title,{order:3,style:O(n,"h3",e),children:t})}const Ye={normal:400,medium:500,semibold:600,bold:700},Q=m.createContext(!1);function Ue({children:t,tone:e="primary",size:n="body",as:o="p",weight:s="normal",italic:a,truncate:l,style:f}){const u=g(),d=m.useContext(Q)&&o==="p"?"span":o,x=o==="p";return r.jsx(Q.Provider,{value:!0,children:r.jsx(p.Text,{component:d,size:n==="small"?"xs":"sm",fw:Ye[s],c:e==="primary"?void 0:u.text[e],truncate:l,style:{fontStyle:a?"italic":void 0,...e==="primary"?{color:u.text.primary}:void 0,...x&&d==="span"?{display:"block"}:void 0,fontFamily:u.typography.fontFamily,...f},children:t})})}function Ze({children:t,style:e}){const n=g();return r.jsx("code",{style:{fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, "Cascadia Code", monospace',fontSize:"0.92em",color:n.text.primary,background:n.fill.secondary,borderRadius:n.radius.sm,padding:"1px 4px",...e},children:t})}function Je({children:t,href:e,style:n}){const o=g();return r.jsx("a",{href:e,target:"_blank",rel:"noreferrer",style:{color:o.text.link,...n},children:t})}function Qe({children:t,gap:e,style:n}){return r.jsx(p.Stack,{gap:e,style:n,children:t})}const ee={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch","space-between":"space-between"};function et({children:t,gap:e,align:n="center",justify:o="start",wrap:s=!1,style:a}){return r.jsx(p.Group,{gap:e,align:ee[n],justify:ee[o],wrap:s?"wrap":"nowrap",style:a,children:t})}function tt(){return r.jsx("div",{style:{flex:1}})}function nt({children:t,columns:e,gap:n=16,align:o,style:s}){const a=typeof e=="number"?`repeat(${e}, minmax(0, 1fr))`:e;return r.jsx("div",{style:{display:"grid",gridTemplateColumns:a,gap:n,alignItems:o,...s},children:t})}function rt({style:t}){return r.jsx(p.Divider,{style:t})}const W=m.createContext({collapsible:!1,open:!0,toggle:()=>{}});function ot({children:t,variant:e="default",collapsible:n=!1,defaultOpen:o=!0,open:s,onOpenChange:a,style:l}){const f=g(),[u,c]=m.useState(o),d=s??u,x=m.useCallback(()=>{const j=!d;s===void 0&&c(j),a==null||a(j)},[d,s,a]);return r.jsx(p.Card,{withBorder:e!=="borderless",radius:f.radius.md,padding:0,style:{background:f.bg.elevated,borderColor:f.stroke.secondary,...l},children:r.jsx(W.Provider,{value:{collapsible:n,open:d,toggle:x},children:t})})}function st({children:t,trailing:e,style:n}){const o=g(),{collapsible:s,open:a,toggle:l}=m.useContext(W);return r.jsxs("div",{onClick:s?l:void 0,style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,padding:"8px 14px",borderBottom:`1px solid ${o.stroke.secondary}`,fontSize:o.typography.small.fontSize,fontWeight:o.typography.h3.fontWeight,color:o.text.primary,fontFamily:o.typography.fontFamily,cursor:s?"pointer":void 0,userSelect:s?"none":void 0,...n},children:[r.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[s&&r.jsx(de,{expanded:a}),t]}),e!=null&&r.jsx("span",{children:e})]})}function at({children:t,style:e}){const{collapsible:n,open:o}=m.useContext(W);return n&&!o?null:r.jsx("div",{style:{padding:14,...e},children:t})}function de({expanded:t}){return r.jsx("svg",{width:12,height:12,viewBox:"0 0 12 12",fill:"none",style:{transform:t?"rotate(90deg)":"none",transition:"transform 120ms"},"aria-hidden":!0,children:r.jsx("path",{d:"M4 2.5L8 6l-4 3.5",stroke:"currentColor",strokeWidth:1.4,strokeLinecap:"round",strokeLinejoin:"round"})})}function it({value:t,label:e,tone:n,style:o}){const s=g();return r.jsxs("div",{style:o,children:[r.jsx(p.Text,{fz:22,fw:700,lh:1.2,style:{color:n?T[n]:s.text.primary,fontFamily:s.typography.fontFamily},children:t}),r.jsx(p.Text,{fz:12,style:{color:s.text.tertiary,fontFamily:s.typography.fontFamily},children:e})]})}function lt({children:t,active:e,tone:n="neutral",size:o="md",leadingContent:s,keyboardHint:a,title:l,style:f,onClick:u}){return r.jsx(p.Badge,{color:te[n],variant:e?"filled":"light",size:o==="sm"?"sm":"md",leftSection:s,rightSection:a,title:l,onClick:u,style:{cursor:u?"pointer":void 0,textTransform:"none",...f},children:t})}function ct({children:t,tone:e="neutral",title:n,icon:o,style:s}){return r.jsx(p.Alert,{color:te[e],title:n,icon:o,variant:"light",style:s,children:t})}const ut={success:"rgba(31,138,101,0.12)",danger:"rgba(207,45,86,0.12)",warning:"rgba(232,163,61,0.14)",info:"rgba(46,121,181,0.12)",neutral:"rgba(136,136,168,0.12)"};function dt({headers:t,rows:e,columnAlign:n,rowTone:o,framed:s=!0,striped:a,stickyHeader:l,style:f,emptyMessage:u}){return r.jsxs(p.Table,{withTableBorder:s,withColumnBorders:!1,striped:a,stickyHeader:l,highlightOnHover:!0,style:f,children:[r.jsx(p.Table.Thead,{children:r.jsx(p.Table.Tr,{children:t.map((c,d)=>r.jsx(p.Table.Th,{ta:(n==null?void 0:n[d])??"left",children:c},d))})}),r.jsx(p.Table.Tbody,{children:e.length===0?r.jsx(p.Table.Tr,{children:r.jsx(p.Table.Td,{colSpan:t.length,ta:"center",c:"dimmed",children:u??"No data"})}):e.map((c,d)=>{const x=o==null?void 0:o[d];return r.jsx(p.Table.Tr,{style:x?{background:ut[x]}:void 0,children:t.map((j,h)=>r.jsx(p.Table.Td,{ta:(n==null?void 0:n[h])??"left",children:c[h]},h))},d)})})]})}const ft={primary:"filled",secondary:"default",ghost:"subtle"};function ht({children:t,variant:e="secondary",disabled:n,type:o="button",style:s,onClick:a}){return r.jsx(p.Button,{variant:ft[e],color:e==="primary"?"accent":void 0,size:"xs",disabled:n,type:o,onClick:a,style:s,children:t})}function pt({children:t,onClick:e,disabled:n,title:o,variant:s="default",size:a="md",style:l}){return r.jsx(p.ActionIcon,{variant:s==="circle"?"light":"subtle",radius:s==="circle"?"xl":"sm",size:a==="sm"?"sm":"md",color:"gray",disabled:n,title:o,"aria-label":o,onClick:e,style:l,children:t})}function yt({value:t,onChange:e,options:n,placeholder:o,disabled:s,style:a}){return r.jsx(p.Select,{value:t,data:n,placeholder:o,disabled:s,allowDeselect:!1,onChange:l=>{l!==null&&(e==null||e(l))},style:a})}function gt({checked:t,onChange:e,disabled:n,label:o,style:s}){return r.jsx(p.Checkbox,{checked:t,disabled:n,label:o,onChange:a=>e==null?void 0:e(a.currentTarget.checked),style:s})}function xt({checked:t,onChange:e,disabled:n,size:o="sm",style:s}){return r.jsx(p.Switch,{checked:t,disabled:n,size:o==="sm"?"sm":"md",onChange:a=>e==null?void 0:e(a.currentTarget.checked),style:s})}function mt({value:t,onChange:e,placeholder:n,disabled:o,type:s,style:a}){return r.jsx(p.TextInput,{value:t,placeholder:n,disabled:o,type:s,onChange:l=>e==null?void 0:e(l.currentTarget.value),style:a})}function bt({value:t,onChange:e,placeholder:n,disabled:o,rows:s=3,style:a}){return r.jsx(p.Textarea,{value:t,placeholder:n,disabled:o,autosize:!0,minRows:s,onChange:l=>e==null?void 0:e(l.currentTarget.value),style:a})}function jt({color:t,style:e}){const n=g();return r.jsx("span",{style:{display:"inline-block",width:14,height:14,borderRadius:4,background:n.category[t],flex:"0 0 auto",...e}})}function vt({segments:t,total:e,topLeftLabel:n,topRightLabel:o,style:s}){const a=g(),l=e>0?e:1,f=t.reduce((c,d)=>c+(Number.isFinite(d.value)&&d.value>0?d.value:0),0),u=Math.max(0,l-f);return r.jsxs("div",{style:s,children:[(n!=null||o!=null)&&r.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:12,color:a.text.secondary,marginBottom:6},children:[r.jsx("span",{children:n}),r.jsx("span",{children:o})]}),r.jsxs("div",{style:{display:"flex",gap:2,height:8},children:[t.map((c,d)=>{const x=Number.isFinite(c.value)&&c.value>0?c.value:0,j=a.category[c.color??k.usageColorSequence[d%k.usageColorSequence.length]];return r.jsx("div",{style:{width:`${x/l*100}%`,background:j,borderRadius:3}},c.id)}),u>0&&r.jsx("div",{style:{width:`${u/l*100}%`,background:a.fill.tertiary,borderRadius:3}})]})]})}function St({title:t,leading:e,count:n,trailing:o,children:s,defaultOpen:a=!1,style:l}){const f=g(),[u,c]=m.useState(a);return r.jsxs("div",{style:l,children:[r.jsxs("div",{onClick:()=>c(d=>!d),style:{display:"flex",alignItems:"center",gap:6,padding:"4px 0",cursor:"pointer",userSelect:"none",color:f.text.primary,fontSize:14},children:[r.jsx(de,{expanded:u}),e,r.jsx("span",{style:{fontWeight:500},children:t}),n!=null&&r.jsx("span",{style:{color:f.text.tertiary,fontSize:12},children:n}),r.jsx("span",{style:{flex:1}}),o!=null&&r.jsx("span",{style:{color:f.text.tertiary},children:o})]}),u&&r.jsx("div",{style:{paddingLeft:18,paddingBottom:4},children:s})]})}Object.defineProperty(exports,"useEffect",{enumerable:!0,get:()=>m.useEffect});Object.defineProperty(exports,"useMemo",{enumerable:!0,get:()=>m.useMemo});Object.defineProperty(exports,"useRef",{enumerable:!0,get:()=>m.useRef});Object.defineProperty(exports,"useState",{enumerable:!0,get:()=>m.useState});exports.canvasPaletteDark=k.canvasPaletteDark;exports.canvasPaletteGrokDark=k.canvasPaletteGrokDark;exports.canvasPaletteGrokLight=k.canvasPaletteGrokLight;exports.canvasPaletteLight=k.canvasPaletteLight;exports.canvasTokens=k.canvasTokens;exports.canvasTokensLight=k.canvasTokensLight;exports.categoryPaletteDark=k.categoryPaletteDark;exports.categoryPaletteLight=k.categoryPaletteLight;exports.colorPalette=k.colorPalette;exports.usageColorSequence=k.usageColorSequence;exports.BarChart=Pe;exports.Button=ht;exports.Callout=ct;exports.Card=ot;exports.CardBody=at;exports.CardHeader=st;exports.Checkbox=gt;exports.Code=Ze;exports.CollapsibleSection=St;exports.DiffStats=Ne;exports.DiffView=ze;exports.Divider=rt;exports.Grid=nt;exports.H1=Ve;exports.H2=Ke;exports.H3=Xe;exports.IconButton=pt;exports.LineChart=Le;exports.Link=Je;exports.PieChart=He;exports.Pill=lt;exports.Row=et;exports.Select=yt;exports.Spacer=tt;exports.Stack=Qe;exports.Stat=it;exports.Swatch=jt;exports.Table=dt;exports.Text=Ue;exports.TextArea=bt;exports.TextInput=mt;exports.TodoList=ue;exports.TodoListCard=Oe;exports.Toggle=xt;exports.UsageBar=vt;exports.computeDAGLayout=Re;exports.mergeStyle=qe;exports.useCanvasAction=$e;exports.useCanvasState=We;exports.useHostTheme=g;