@malloy-publisher/sdk 0.9.11 → 0.9.12

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,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("react/jsx-runtime"),S=require("../useCompiledDocument-B21sVbb4.cjs.js"),$=require("@mui/material"),k=require("react"),Se=require("../ServerProvider-BOgiW8MX.cjs.js"),ge=require("../text-entry-BJwltZiy.cjs.js"),Zu=require("react-dom"),Ju=require("@malloydata/malloy-tag"),Fl=require("@tanstack/react-query"),zl=S.createSvgIcon(m.jsx("path",{d:"M18.4 10.6C16.55 8.99 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16c1.05-3.19 4.05-5.5 7.6-5.5 1.95 0 3.73.72 5.12 1.88L13 16h9V7z"})),Wl=S.createSvgIcon(m.jsx("path",{d:"M12.5 8c-2.65 0-5.05.99-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8"})),Ii=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform),Xt=Ii?"⌘":"Ctrl+",Ia=e=>{if(!(e instanceof HTMLElement))return!1;if(e.isContentEditable)return!0;const t=e.tagName;return t==="INPUT"||t==="TEXTAREA"||t==="SELECT"},fi=e=>e instanceof Element&&e.closest('[role="dialog"], .MuiPopover-root, .MuiDialog-root')!==null;function ef(e){const t=k.useRef(e);k.useEffect(()=>{t.current=e});const[n,r]=k.useState(!1);k.useEffect(()=>{n&&(r(!1),t.current.save?.())},[n]),k.useEffect(()=>{const s=i=>{const o=t.current;if(o.paused)return;const a=Ii?i.metaKey:i.ctrlKey,c=i.key.toLowerCase();if(i.key==="Escape"){if(Ia(i.target)||fi(i.target))return;o.escape();return}if(Ia(i.target)){if(a&&c==="s"){if(i.preventDefault(),!o.save||fi(i.target))return;i.target.blur(),r(!0)}return}if(fi(i.target)){a&&c==="s"&&i.preventDefault();return}if(a&&c==="z"){i.preventDefault(),i.shiftKey?o.redo():o.undo();return}if(!Ii&&a&&c==="y"){i.preventDefault(),o.redo();return}if(a&&c==="s"){i.preventDefault(),o.save?.();return}o.nudge&&!a&&!i.altKey&&!i.shiftKey&&(i.key==="ArrowLeft"||i.key==="ArrowRight")&&(i.preventDefault(),o.nudge(i.key==="ArrowRight"?1:-1))};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[])}const mr=(e,t,n=Se.DEFAULT_UI)=>({height:n.size.control,minHeight:n.size.control,px:1.5,borderRadius:n.radius.control,boxShadow:"none",...n.type.control,"&:hover":{boxShadow:"none"},"& .MuiButton-startIcon":{mr:.5,"& svg":{fontSize:18}},"&.MuiButton-outlined":{borderColor:e,"&:hover":{borderColor:t}}}),Ts=(e=Se.DEFAULT_UI)=>({width:e.size.control,height:e.size.control,borderRadius:e.radius.control,"& svg":{fontSize:18}}),vr={height:20,alignSelf:"center",mx:.5,my:0},En=(e,t=Se.DEFAULT_UI)=>({height:t.size.control,boxSizing:"border-box",borderRadius:t.radius.control,border:`1px solid ${e}`,overflow:"hidden",bgcolor:"background.paper","& .MuiToggleButton-root":{border:"none",borderRadius:"0 !important",m:"0 !important",px:1.5,py:0,height:"100%",...t.type.control,color:"text.secondary","& + .MuiToggleButton-root":{borderLeft:`1px solid ${e}`},"&:hover":{bgcolor:"action.hover"},"&.Mui-selected, &.Mui-selected:hover":{bgcolor:"action.selected",color:"text.primary"}}}),Pi={package:"Saves to the package file",browser:"Saves in this browser",host:"Saves to the app this is embedded in"};function tf({canUndo:e,canRedo:t,onUndo:n,onRedo:r,dirty:s,saving:i,onSave:o,savesTo:a="package",saveLabel:c,saveButton:f,actions:d,onAddTile:l,onExit:u,layout:h,onLayoutChange:p}){const{theme:v}=Se.usePublisherTheme(),x=S.edgeColor(v.cardBorder),_=S.hoverEdgeColor(v.cardBorder,v.tileTitle);return m.jsxs($.Stack,{direction:"row","aria-label":"Builder actions",sx:{alignItems:"center",gap:.5,flexShrink:0,"& .MuiButton-root":{whiteSpace:"nowrap"}},children:[h&&p&&m.jsxs(m.Fragment,{children:[m.jsx($.Tooltip,{title:"Layout: tiles side by side, or one after another",children:m.jsxs($.ToggleButtonGroup,{size:"small",exclusive:!0,value:h,"aria-label":"Layout",onChange:(g,y)=>{y&&y!==h&&p(y)},sx:En(x,v.ui),children:[m.jsx($.ToggleButton,{value:"linear","aria-label":"Linear layout",children:"Linear"}),m.jsx($.ToggleButton,{value:"grid","aria-label":"Grid layout",children:"Grid"})]})}),m.jsx($.Divider,{orientation:"vertical",sx:vr})]}),l&&m.jsx($.Button,{variant:"outlined",startIcon:m.jsx(S.AddIcon,{}),onClick:l,"aria-label":"Add tile",sx:mr(x,_,v.ui),children:"Tile"}),l&&m.jsx($.Divider,{orientation:"vertical",sx:vr}),m.jsx($.Tooltip,{title:`Undo (${Xt}Z)`,children:m.jsx("span",{children:m.jsx($.IconButton,{"aria-label":"Undo",disabled:!e,onClick:n,sx:Ts(v.ui),children:m.jsx(Wl,{fontSize:"small"})})})}),m.jsx($.Tooltip,{title:`Redo (${Xt}⇧Z)`,children:m.jsx("span",{children:m.jsx($.IconButton,{"aria-label":"Redo",disabled:!t,onClick:r,sx:Ts(v.ui),children:m.jsx(zl,{fontSize:"small"})})})}),(d||o||u)&&m.jsx($.Divider,{orientation:"vertical",sx:vr}),d,o?m.jsx($.Tooltip,{title:s?`Save (${Xt}S) · ${c??Pi[a]}`:c??Pi[a],children:m.jsx("span",{children:m.jsx($.Button,{ref:f,variant:s?"contained":"outlined",disabled:!s||i,onClick:o,sx:{...mr(x,_,v.ui),minWidth:88},children:i?"Saving…":s?"Save":"Saved"})})}):null,o&&m.jsx($.Box,{component:"span","aria-live":"polite",sx:{position:"absolute",width:"1px",height:"1px",overflow:"hidden",clipPath:"inset(50%)",whiteSpace:"nowrap"},children:i?"Saving":s?"Unsaved changes":"All changes saved"}),u&&m.jsx(S.SecondaryButton,{label:"Close",icon:m.jsx(S.CheckIcon,{}),onClick:u})]})}const nf={line_chart:"Line",bar_chart:"Bar",big_value:"Big value",scatter_chart:"Scatter",shape_map:"Shape map",segment_map:"Segment map"};function Nl(e,t,n){const s=o=>{if(t!==o){if(o==="big_value")return e?.aggregateOnly===!0?void 0:"Needs a view with only totals (no group by)";if(o==="shape_map"||o==="segment_map")return e?.chart===o?void 0:"Needs a view that already carries a map chart"}};return[{value:"default",label:"From the view"},{value:"none",label:"Table"},...["line_chart","bar_chart","big_value","scatter_chart","shape_map","segment_map"].map(o=>{const a=s(o);return{value:o,label:nf[o],...a?{disabled:!0,reason:a}:{}}}),...t==="custom"?[{value:"custom",label:"As written"}]:[]]}function Pa(e){return e.description??S.readableName(e.name)}const rf={bar_chart:"a bar chart",line_chart:"a line chart",scatter_chart:"a scatter chart",shape_map:"a shape map",segment_map:"a segment map",big_value:"a big value",sparkline:"a sparkline"},Jr=(e,t)=>`${e}\0${t}`;function sf({open:e,document:t,catalog:n,columns:r,onClose:s,onAdd:i,onAddText:o,renderPreview:a}){const{theme:c}=Se.usePublisherTheme(),f=c.ui,d=S.edgeColor(c.cardBorder),l=k.useMemo(()=>n?.sources??[],[n]),[u,h]=k.useState(""),[p,v]=k.useState(),[x,_]=k.useState(""),[g,y]=k.useState("default"),w=k.useRef(null),b=k.useMemo(()=>{const M=new Set(t.sources.map(F=>F.base));return[...l].sort((F,H)=>Number(M.has(H.name))-Number(M.has(F.name)))},[l,t]),T=b.filter(M=>M.views.length>0),C=b.filter(M=>M.views.length===0),j=k.useMemo(()=>new Map(T.flatMap(M=>M.views.map(F=>[Jr(M.name,F.name),{source:M,view:F,key:Jr(M.name,F.name)}]))),[T]),D=k.useMemo(()=>T.map(M=>({key:M.name,label:M.name,...M.description?{detail:M.description}:{},entries:M.views.map(F=>({key:Jr(M.name,F.name),name:F.name,title:Pa(F),...F.chart?{chart:F.chart}:{}}))})),[T]),E=p===void 0?void 0:j.get(p);k.useEffect(()=>{if(!e)return;h(""),_(""),y("default");const M=T[0]?.views[0];v(M&&T[0]?Jr(T[0].name,M.name):void 0)},[e]);const R=E?[E.source.name,E.view.name].filter(M=>!ge.isBareName(M)).map(M=>`"${M}" is not a plain Malloy name, so a tile cannot be written for it.`)[0]:void 0,P=E!==void 0&&R===void 0,A=E?Pa(E.view):"",U=g!=="default"&&E?{chart:g,chartCarried:E.view.chart?[E.view.chart]:[]}:{},z=(M=E)=>{if(!M||![M.source.name,M.view.name].every(ge.isBareName))return;const F=M.key===E?.key;i({base:M.source.name,modelPath:M.source.modelPath,...M.source.exporters?{exporters:M.source.exporters}:{},view:M.view.name,...F&&x.trim()?{label:x.trim()}:{},...F?U:{},colspan:Math.ceil(r/2)})},q=E?Nl(E.view,g).filter(M=>M.value!=="custom"&&M.disabled!==!0):[];return m.jsx(S.AppDialog,{className:`${S.reportClasses.dialog} ${S.reportClasses.addTileDialog}`,open:e,onClose:s,maxWidth:"md",initialFocus:w,title:"Add a tile",description:"Pick a view from this package. You can change its title and chart now or later.",actions:m.jsxs(m.Fragment,{children:[m.jsx($.Button,{onClick:o,sx:{mr:"auto"},children:"Add text instead"}),m.jsx($.Button,{onClick:s,children:"Cancel"}),m.jsx($.Button,{variant:"contained",disabled:!P,onClick:()=>z(),children:"Add tile"})]}),children:m.jsxs($.Box,{sx:{mx:-3,mb:-1,borderTop:`1px solid ${d}`,borderBottom:`1px solid ${d}`,display:"grid",gridTemplateColumns:{xs:"1fr",md:"320px minmax(0, 1fr)"},height:{md:460}},children:[m.jsx($.Box,{sx:{display:"flex",flexDirection:"column",minHeight:0,borderRight:{md:`1px solid ${d}`},maxHeight:{xs:280,md:"none"}},children:m.jsx(S.ViewPicker,{groups:D,query:u,onQuery:h,picked:E?.key,onPick:M=>{v(M),y("default")},onTake:M=>z(j.get(M)),searchRef:w,empty:m.jsx($.Typography,{variant:"body2",sx:{color:c.tileTitle,p:2},children:n?"This package publishes no source with a view to put on a tile.":"The package's sources are still loading."}),footer:C.length>0&&m.jsxs($.Typography,{variant:"caption",component:"p",sx:{color:"text.secondary",px:2,pt:1.5},children:["Also in this package, with no views to show:"," ",C.map(M=>M.name).join(", "),"."]})})}),m.jsx($.Box,{sx:M=>({p:2.5,display:"flex",flexDirection:"column",gap:2,minHeight:0,overflowY:"auto",bgcolor:`color-mix(in srgb, ${M.palette.text.primary} 3%, ${M.palette.background.paper})`}),children:E?m.jsxs(m.Fragment,{children:[m.jsx($.Box,{"aria-label":"Preview",role:"region",sx:M=>({height:240,flex:"none",display:"flex",position:"relative",overflow:"hidden",borderRadius:f.radius.tile,border:`1px solid ${d}`,bgcolor:M.palette.background.paper,"&::after":{content:'""',position:"absolute",left:0,right:0,bottom:0,height:40,pointerEvents:"none",background:`linear-gradient(to bottom, transparent, ${M.palette.background.paper})`}}),children:a?m.jsx($.Box,{sx:{flex:1,minWidth:0,px:2,pt:1.5},children:a({base:E.source.name,modelPath:E.source.modelPath,view:E.view.name,label:x.trim()||A,...g!=="default"?U:{},givens:E.source.givens})}):m.jsxs($.Box,{sx:M=>({flex:1,border:`1px solid ${d}`,borderRadius:f.radius.tile,bgcolor:M.palette.background.paper,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:1,color:"text.secondary"}),children:[m.jsx(S.ChartGlyph,{chart:E.view.chart}),m.jsxs($.Typography,{variant:"body2",children:[E.source.name," → ",E.view.name]})]})}),m.jsx($.TextField,{size:"small",label:"Title",placeholder:A,value:x,onChange:M=>_(M.target.value),InputLabelProps:{shrink:!0},inputProps:{"aria-label":"Tile title"}}),m.jsxs($.Box,{children:[m.jsx($.Typography,{component:"div",sx:{...f.type.label,color:"text.secondary",mb:.75},children:"Chart"}),m.jsx($.ToggleButtonGroup,{size:"small",exclusive:!0,value:g,"aria-label":"Chart",onChange:(M,F)=>{F!==null&&y(F)},sx:{...En(d,f),"& .MuiToggleButton-root":{...En(d,f)["& .MuiToggleButton-root"],textTransform:"none"}},children:q.map(M=>m.jsx($.ToggleButton,{value:M.value,children:M.label},M.value))}),m.jsx($.Typography,{variant:"caption",component:"p",sx:{color:"text.secondary",mt:.75},children:E.view.chart?`The view declares ${rf[E.view.chart]??"a chart"}.`:"The view declares no chart, so it shows as a table."})]}),R&&m.jsx($.Typography,{variant:"body2",color:"error",children:R})]}):m.jsx($.Typography,{variant:"body2",sx:{color:"text.secondary",m:"auto"},children:"Pick a view to see it here."})})]})})}const Me=e=>e.kind==="text",le=e=>e.kind!=="text",Xn=e=>le(e)?e.label??e.name:e.name,Be=e=>Me(e)?`text.${e.name}`:`${e.source}.${e.name}`;function of(e,t,{modelPath:n,textHeld:r,widths:s,insertAt:i}){t.modelPath&&!r&&(e.imports=S.withSource(e,t.base,t.modelPath,n,t.exporters??[t.modelPath]));const o=Gl(e,t.base),a=Ri(e,o.name,t.view);e.tiles.splice(i??e.tiles.length,0,{name:a,source:o.name,declaration:{kind:"reference",from:t.view},...s?{colspan:t.colspan}:{},...t.label?{label:t.label}:{},...t.chart?{chart:t.chart}:{},...t.chartCarried?{chartCarried:t.chartCarried}:{}})}function Gl(e,t,{unscoped:n=!1}={}){const r=e.sources.find(a=>a.base===t&&(!n||!a.scopedBy?.length));if(r)return r;const s=new Set(e.sources.map(a=>a.name));let i=`${t}_tiles`;for(let a=2;s.has(i);a++)i=`${t}_tiles_${a}`;const o={name:i,base:t};return e.sources.push(o),o}function Ri(e,t,n){const r=new Set(e.tiles.filter(le).filter(i=>i.source===t).map(i=>i.name));let s=`${n}_tile`;for(let i=2;r.has(s);i++)s=`${n}_tile_${i}`;return s}function Es(e){switch(e.declaration.kind){case"inline":return"Its query is written in this file, and the builder does not copy a query's body.";case"opaque":return`Its query is ${e.declaration.why}, which the builder does not copy.`;default:return e.chart==="custom"?"Its chart line is one the builder does not write, so a copy would lose it.":void 0}}function af(e,t){const n=e.tiles[t];if(!n||!le(n)||Es(n)!==void 0)return;let r;if(n.declaration.kind==="reference"){const{break:s,...i}=structuredClone(n);r={...i,name:Ri(e,n.source,n.declaration.from)}}else{const i=e.sources.find(o=>o.name===n.source)??Gl(e,n.source,{unscoped:!0});r={name:Ri(e,i.name,n.name),source:i.name,declaration:{kind:"reference",from:n.name},...n.colspan!==void 0?{colspan:n.colspan}:{}}}return e.tiles.splice(t+1,0,r),t+1}const es="self";function lf({open:e,document:t,source:n,givenNames:r,dashboards:s,tileLabel:i,onClose:o,onApply:a}){const{theme:c}=Se.usePublisherTheme(),f=c.ui,[d,l]=k.useState([]);k.useEffect(()=>{if(!e||!n)return;const g=(t.drills??[]).filter(y=>y.source===n.name);l((n.dimensions??[]).map(y=>{const w=g.find(b=>b.name===y.name);return{name:y.name,expression:y.expression,to:w?.to??[],given:w?.given??""}}))},[e,n,t]);const u=(g,y)=>l(w=>w.map((b,T)=>{if(T!==g)return b;const C={...b};return y(C),C})),h=[es,...s.filter(g=>g!==es)],p=g=>g===es?"This report":g,v=()=>{n&&(a(d.filter(g=>g.to.length>0).map(g=>({source:n.name,name:g.name,expression:g.expression,to:g.to,...g.given?{given:g.given}:{}}))),o())},x=S.edgeColor(c.cardBorder),_=(g,y)=>u(g,w=>{y?w.to=w.lastTo?.length?w.lastTo:[es]:(w.lastTo=w.to,w.to=[])});return m.jsx(S.AppDialog,{className:`${S.reportClasses.dialog} ${S.reportClasses.clickableCellsDialog}`,open:e,onClose:o,title:"Clickable cells",description:m.jsxs(m.Fragment,{children:[i&&m.jsxs($.Box,{component:"span",sx:{fontWeight:f.type.label.fontWeight},children:[i," ·"," "]}),"A click on a cell sets a filter to its value, on this report or on the one it opens."]}),actions:m.jsxs(m.Fragment,{children:[m.jsx($.Button,{onClick:o,children:"Cancel"}),m.jsx($.Button,{variant:"contained",onClick:v,disabled:d.length===0,children:"Apply"})]}),children:d.length===0?m.jsx($.Typography,{variant:"body2",sx:{color:c.tileTitle,pt:1},children:n?m.jsxs(m.Fragment,{children:[m.jsx($.Box,{component:"code",children:n.name})," declares no dimensions of its own in this file. A click is a tag on the dimension's declaration, so a dimension the model declares is made clickable in the model; to make one clickable here, declare it in"," ",m.jsx($.Box,{component:"code",children:n.name})," and group by it."]}):"This tile's source is not declared in this file."}):m.jsx($.Box,{role:"list","aria-label":"Dimensions",children:d.map((g,y)=>{const w=g.to.length>0;return m.jsxs($.Box,{role:"listitem",sx:{display:"grid",gridTemplateColumns:{xs:"auto minmax(0, 1fr)",sm:"auto minmax(0, 0.9fr) minmax(0, 1.6fr)"},alignItems:"center",columnGap:1.5,rowGap:1,py:1.25,borderTop:y===0?"none":`1px solid ${x}`},children:[m.jsx($.Switch,{size:"small",checked:w,onChange:b=>_(y,b.target.checked),slotProps:{input:{"aria-label":`${g.name} is clickable`}}}),m.jsxs($.Box,{sx:{minWidth:0},children:[m.jsx($.Box,{sx:{...f.type.control,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:cf(g.name)}),m.jsxs($.Box,{title:g.expression,sx:{...f.type.code,color:"text.secondary",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:[g.name," is ",g.expression]})]}),w?m.jsxs($.Stack,{direction:"row",sx:{gridColumn:{xs:"1 / -1",sm:"auto"},alignItems:"center",gap:1,justifyContent:"flex-end",...f.type.control},children:[m.jsx($.Box,{component:"span",sx:{color:"text.secondary"},children:"Opens"}),m.jsx($.TextField,{select:!0,size:"small",value:g.to,inputProps:{"aria-label":`Where ${g.name} goes`},SelectProps:{multiple:!0,renderValue:b=>b.map(p).join(", ")},onChange:b=>u(y,T=>{const C=b.target.value,j=Array.isArray(C)?C:String(C).split(",").filter(Boolean);j.length===0&&(T.lastTo=T.to),T.to=j}),sx:{flex:"1 1 150px",minWidth:0,maxWidth:200},children:h.map(b=>m.jsxs($.MenuItem,{value:b,children:[m.jsx($.Checkbox,{size:"small",checked:g.to.includes(b),sx:{p:0,mr:1}}),m.jsx($.ListItemText,{primary:p(b)})]},b))}),m.jsx($.Box,{component:"span",sx:{color:"text.secondary"},children:"sets"}),m.jsxs($.TextField,{select:!0,size:"small",value:g.given,inputProps:{"aria-label":`Control ${g.name} sets`},SelectProps:{displayEmpty:!0,renderValue:b=>b===""?g.name:String(b)},onChange:b=>u(y,T=>{T.given=b.target.value}),sx:{flex:"1 1 120px",minWidth:0,maxWidth:170},children:[m.jsx($.MenuItem,{value:"",children:m.jsx($.ListItemText,{primary:g.name,secondary:"Named like the dimension"})}),r.map(b=>m.jsx($.MenuItem,{value:b,children:b},b))]})]}):m.jsx($.Typography,{variant:"body2",sx:{color:"text.secondary",textAlign:"right",display:{xs:"none",sm:"block"}},children:"Not clickable"})]},g.name)})})})}function cf(e){const t=e.replace(/_+/g," ").trim();return t.charAt(0).toUpperCase()+t.slice(1)}const df=S.createSvgIcon(m.jsx("path",{d:"M12 4c4.41 0 8 3.59 8 8s-3.59 8-8 8-8-3.59-8-8 3.59-8 8-8m0-2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 13-4-4h8z"})),uf=S.createSvgIcon(m.jsx("path",{d:"M11 7H2v2h9zm0 8H2v2h9zm5.34-4L12.8 7.46l1.41-1.41 2.12 2.12 4.24-4.24L22 5.34zm0 8-3.54-3.54 1.41-1.41 2.12 2.12 4.24-4.24L22 13.34z"})),ff=S.createSvgIcon(m.jsx("path",{d:"M19 4h-1V2h-2v2H8V2H6v2H5c-1.11 0-1.99.9-1.99 2L3 20c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2m0 16H5V10h14zm0-12H5V6h14zm-7 5h5v5h-5z"})),hf=S.createSvgIcon(m.jsx("path",{d:"M19.5 9.5c-1.03 0-1.9.62-2.29 1.5h-2.92c-.39-.88-1.26-1.5-2.29-1.5s-1.9.62-2.29 1.5H6.79c-.39-.88-1.26-1.5-2.29-1.5C3.12 9.5 2 10.62 2 12s1.12 2.5 2.5 2.5c1.03 0 1.9-.62 2.29-1.5h2.92c.39.88 1.26 1.5 2.29 1.5s1.9-.62 2.29-1.5h2.92c.39.88 1.26 1.5 2.29 1.5 1.38 0 2.5-1.12 2.5-2.5s-1.12-2.5-2.5-2.5"})),pf=S.createSvgIcon(m.jsx("path",{d:"M4 9h16v2H4zm0 4h10v2H4z"})),gf=S.createSvgIcon(m.jsx("path",{d:"M3 5v14h18V5zm5.33 12H5V7h3.33zm5.34 0h-3.33v-4h3.33zM19 17h-3.33v-4H19zm0-6h-8.67V7H19z"}));function mf(e,t=[]){const n=new Map;for(const i of e.tiles)for(const o of le(i)?i.filters??[]:[])n.set(o.given,(n.get(o.given)??0)+1);const r=[],s=new Set;for(const i of e.localGivens??[])s.add(i.name),r.push({name:i.name,...i.label===void 0?{}:{label:i.label},type:i.type,...i.suggest?{field:i.suggest.dimension}:{},origin:"dashboard",local:i,boundTiles:n.get(i.name)??0});for(const i of t)s.has(i.name)||(s.add(i.name),r.push({...i,origin:"model",boundTiles:n.get(i.name)??0}));for(const[i,o]of n)s.has(i)||r.push({name:i,origin:"model",boundTiles:o});return r}function Cs(e){if(!(e===void 0||e.startsWith("filter<")))return e==="string"||e==="boolean"?"=":">="}function vf(e){if(e)return/^filter<(.+)>$/.exec(e)?.[1]??e}function yr(e,t){const n=vf(e),r=t?.replace(/_type$/,"");if(!n||!r)return!0;const s=new Set(["date","timestamp"]);return s.has(n)?s.has(r):n===r}function Ai(e){switch(e?.replace(/_type$/,"")){case"string":return"text";case"number":return"a number";case"date":return"a date";case"timestamp":return"a timestamp";case"boolean":return"true or false";default:return e??"an unknown type"}}function yf(e){switch(e?.replace(/_type$/,"")){case"number":return"number";case"date":case"timestamp":return"date";default:return"select"}}const bf=[{op:"~",label:"matches"},{op:"=",label:"equals"},{op:">=",label:"at least"},{op:"<=",label:"at most"},{op:">",label:"more than"},{op:"<",label:"less than"}];function xf(e,t){const r=(e.split(".").at(-1)??"").split(/[^A-Za-z0-9]+/).filter(Boolean).join("_").toUpperCase()||"FILTER",s=/^[A-Z_]/.test(r)?r:`F_${r}`,i=ge.isStrictName(s)?s:`${s}_FILTER`,o=new Set(t);if(!o.has(i))return i;for(let a=2;;a++)if(!o.has(`${i}_${a}`))return`${i}_${a}`}const wf=[{kind:"select",label:"Pick one",hint:"A dropdown of the field's values"},{kind:"multiselect",label:"Pick several",hint:"The same, taking more than one"},{kind:"text",label:"Text",hint:"A box taking Malloy filter syntax"},{kind:"number",label:"Number range",hint:"A slider over the field's values"},{kind:"date",label:"On or after a date",hint:"A date picker; tiles keep rows on or after it"}];function Jn(e){const t=e.label.trim()||e.name,n=e.field;switch(e.kind){case"select":case"multiselect":return{name:e.name,type:"filter<string>",default:"f''",label:t,control:e.kind,...e.source?{suggest:{source:e.source,dimension:n}}:{}};case"text":return{name:e.name,type:"filter<string>",default:"f''",label:t};case"number":return{name:e.name,type:"filter<number>",default:"f''",label:t,...e.range?{rangeMin:e.range.min,rangeMax:e.range.max}:{}};case"date":return{name:e.name,type:"date",default:`@${e.dateDefault??new Date().toISOString().slice(0,10)}`,label:t}}}const Li=e=>le(e)&&e.declaration.kind!=="inherited"&&e.declaration.kind!=="opaque";function _f(e,t){return e.tiles.map(n=>{const r=(le(n)?n.filters??[]:[]).find(s=>s.given===t.name);return{include:r!==void 0,field:r?.field??t.field??t.name.toLowerCase(),...r?.op!==void 0?{op:r.op}:Cs(t.type)!==void 0?{op:Cs(t.type)}:{}}})}function kf(e,t,n){n.forEach((r,s)=>{const i=e.tiles[s];if(!i||!Li(i))return;const o=(i.filters??[]).filter(c=>c.given!==t),a=r.include?[...o,{field:r.field.trim()||t.toLowerCase(),given:t,...r.op&&r.op!=="~"?{op:r.op}:{}}]:o;a.length>0?i.filters=a:delete i.filters})}function Sf(e,t){const n=(e.localGivens??[]).filter(i=>i.name!==t.name),r=(e.localGivens??[]).findIndex(i=>i.name===t.name),s=[...n];s.splice(r>=0?r:s.length,0,t),e.localGivens=s}function $f(e,t){for(const r of e.tiles){if(!le(r))continue;const s=(r.filters??[]).filter(i=>i.given!==t);s.length>0?r.filters=s:delete r.filters}const n=(e.localGivens??[]).filter(r=>r.name!==t);n.length>0?e.localGivens=n:delete e.localGivens}const Bi=e=>e.charAt(0)+e.slice(1).toLowerCase().replace(/_/g," ");function Tf({open:e,document:t,control:n,available:r,takenNames:s=[],fieldsFor:i,onApply:o}){const a=k.useRef(n);e&&(a.current=n);const c=e?n:a.current,f=c!==void 0,[d,l]=k.useState({kind:"new"}),[u,h]=k.useState(""),[p,v]=k.useState("select"),[x,_]=k.useState(""),[g,y]=k.useState(""),[w,b]=k.useState([]),[T,C]=k.useState(!1),[j,D]=k.useState(!1),E=O=>t.sources.find(L=>L.name===O.source)?.base??O.source;k.useEffect(()=>{if(e)if(D(n!==void 0),n){l({kind:"existing",name:n.name}),h(n.label??"");const O=_f(t,n);b(O);const L=O.filter(I=>I.include),N=new Set(L.map(I=>I.field));y(N.size===1?L[0].field:n.field??""),C(N.size>1)}else l({kind:"new"}),h(""),v("select"),y(""),_(new Date().toISOString().slice(0,10)),b(t.tiles.map(O=>({include:Li(O),field:""}))),C(!1)},[e,n,t]);const R=k.useMemo(()=>[...(t.localGivens??[]).map(O=>O.name),...r.map(O=>O.name),...s],[t,r,s]),P=k.useMemo(()=>g.trim()?xf(g.trim(),R):"",[g,R]),A=d.kind==="existing"?n??r.find(O=>O.name===d.name):P?{name:P,type:Jn({name:P,label:u,kind:p,field:g}).type}:void 0,U=A?.type!==void 0&&!A.type.startsWith("filter<"),z=w.find(O=>O.include)?.op??Cs(A?.type),q=(O,L)=>{D(!0),b(N=>N.map((I,V)=>V===O?{...I,...L}:I))},M=O=>{D(!0),b(L=>L.map(N=>({...N,op:O})))},F=O=>{const L=Cs(O);b(N=>N.map(({op:I,...V})=>L?{...V,op:L}:V))},H=O=>{D(!0),l({kind:"existing",name:O.name}),y(O.field??""),F(O.type)},B=O=>{D(!0),v(O),F(Jn({name:"X",label:u,kind:O,field:g}).type)},W=t.tiles.map(Li),Q=W.filter(Boolean).length,J=w.filter((O,L)=>O.include&&W[L]).length,ee=t.tiles.filter((O,L)=>(w[L]?.include??!1)&&W[L]&&le(O)),te=ee.length>0?ee:t.tiles.filter((O,L)=>W[L]&&le(O)),Z=k.useMemo(()=>{const O=new Map;let L=!1;for(const N of te){const I=i?.(N);if(I){L=!0;for(const V of I)O.has(V.name)||O.set(V.name,V)}}return L?[...O.values()]:void 0},[w,t.tiles,i]),xe=(()=>{const O=g.trim();for(const L of ee){const N=i?.(L);if(!N||N.some(I=>I.name===O))return E(L)}return ee[0]?E(ee[0]):t.sources[0]?.base})(),Re=O=>{D(!0),b(L=>L.map((N,I)=>({...N,include:O&&W[I]})))},ue=k.useMemo(()=>T?w:w.map(O=>({...O,field:g})),[T,w,g]),we=O=>{for(const L of te){const N=i?.(L)?.find(I=>I.name===O.trim());if(N?.type)return N.type}},fe=O=>yr(A?.type,O.type),_e=(O,L)=>{if(O.trim()==="")return"Pick the field this filter compares.";const N=L?i?.(L):void 0;if(!N)return;const I=N.find(V=>V.name===O.trim());if(!I)return`Not a field of ${L?E(L):"the tiles' source"}.`;if(I.type&&!yr(A?.type,I.type))return`${O.trim()} is ${Ai(I.type)}; this filter compares ${Ai(A?.type?.replace(/^filter<(.+)>$/,"$1"))}.`},X=O=>{if(D(!0),y(O),f||d.kind!=="new")return;const L=we(O),N=Jn({name:"X",label:u,kind:p,field:O}).type;L&&!yr(N,L)&&B(yf(L))},Ue=O=>{const L=t.tiles[O];return L&&le(L)?L:void 0},he=ue.map((O,L)=>O.include&&W[L]?_e(O.field,Ue(L)):void 0),oe=he.every(O=>O===void 0),Ae=j?he:he.map(()=>{}),ze=j&&!T&&J>0?ee.map(O=>_e(g,O)).find(Boolean):void 0,pe=A!==void 0&&oe&&(d.kind==="existing"||g.trim()!==""&&P!==""),We=()=>{if(!(!A||!pe))if(d.kind==="new")o(A.name,ue,Jn({name:A.name,label:u.trim()||Bi(A.name),kind:p,field:g.trim(),...xe?{source:xe}:{},...x?{dateDefault:x}:{}}));else if(n?.origin==="dashboard"&&n.local){const O=u.trim(),L=O!==(n.local.label??"");o(A.name,ue,L?{...n.local,...O?{label:O}:{}}:void 0)}else o(A.name,ue)},He=f&&c.origin==="model";return{editing:f,shown:c,fromModel:He,source:d,setSource:l,label:u,setLabel:h,kind:p,dateDefault:x,setDateDefault:_,field:g,rows:w,setRows:b,perTile:T,setPerTile:C,newName:P,target:A,valueTyped:U,commonOp:z,setRow:q,setCommonOp:M,pickExisting:H,pickKind:B,bindable:W,bindableCount:Q,included:J,commonFields:Z,setAll:Re,accepts:fe,pickField:X,rowProblems:Ae,commonProblem:ze,canApply:pe,apply:We}}function Ra({value:e,onChange:t,fields:n,accepts:r,label:s,ariaLabel:i,error:o,helperText:a,disabled:c,autoFocus:f,placeholder:d,inputRef:l,sx:u}){const h=k.useMemo(()=>(n??[]).filter(v=>r?.(v)??!0).map(v=>v.name),[n,r]),p=k.useMemo(()=>new Map((n??[]).map(v=>[v.name,v.type])),[n]);return m.jsx($.Autocomplete,{freeSolo:!0,size:"small",options:h,inputValue:e,onInputChange:(v,x)=>t(x),value:e,onChange:(v,x)=>t(typeof x=="string"?x:""),disabled:c,disableClearable:!0,renderOption:(v,x)=>k.createElement("li",{...v,key:x},m.jsx(La,{type:p.get(x)}),m.jsx($.Typography,{variant:"body2",sx:{flex:1,ml:1},children:x})),renderInput:v=>m.jsx($.TextField,{...v,label:s,placeholder:d,autoFocus:f,...l?{inputRef:l}:{},error:o,helperText:a,InputLabelProps:{...v.InputLabelProps,shrink:!0},InputProps:{...v.InputProps,startAdornment:p.get(e.trim())?m.jsx($.Box,{sx:{display:"flex",ml:.5,mr:-.25},children:m.jsx(La,{type:p.get(e.trim())})}):void 0},inputProps:{...v.inputProps,"aria-label":i}}),sx:u})}const Ef=e=>e&&le(e)&&e.declaration.kind==="opaque"?{label:"Not bindable",reason:`Its body is ${e.declaration.why}, so a filter has no single place to go.`}:{label:"From the model",reason:"Declared on its source, which this report does not write."};function Cf({open:e,document:t,control:n,available:r,takenNames:s,fieldsFor:i,onClose:o,onApply:a,onRemove:c}){const{theme:f}=Se.usePublisherTheme(),d=f.ui,{editing:l,shown:u,fromModel:h,source:p,setSource:v,label:x,setLabel:_,kind:g,dateDefault:y,setDateDefault:w,field:b,rows:T,setRows:C,perTile:j,setPerTile:D,newName:E,target:R,valueTyped:P,commonOp:A,setRow:U,setCommonOp:z,pickExisting:q,pickKind:M,bindable:F,bindableCount:H,included:B,commonFields:W,setAll:Q,accepts:J,pickField:ee,rowProblems:te,commonProblem:Z,canApply:xe,apply:Re}=Tf({open:e,document:t,control:n,available:r,...s?{takenNames:s}:{},fieldsFor:i,onApply:a}),ue=k.useRef(null),we=S.edgeColor(f.cardBorder),fe=S.hoverEdgeColor(f.cardBorder,f.tileTitle),[_e,X]=k.useState(!1),[Ue,he]=k.useState(!1);k.useEffect(()=>{e?he(!0):X(!1)},[e]),k.useEffect(()=>{Ue&&(he(!1),X(l&&B<H))},[Ue]),k.useEffect(()=>{j&&X(!0)},[j]);const oe=W?.find(O=>O.name===b.trim())?.type,Ae=O=>{if(!oe)return;const L=Jn({name:"X",label:x,kind:O,field:b}).type;return yr(L,oe)?void 0:`${b.trim()} is ${Ai(oe)}, which this control cannot filter.`},ze=x.trim()||(E?Bi(E):"Filter"),pe=g==="number"?"Any":g==="date"?y?new Date(`${y}T00:00:00`).toLocaleDateString([],{month:"short",day:"numeric",year:"numeric"}):"Any":"All",We={...En(we,d),alignSelf:"flex-start","& .MuiToggleButton-root":{...En(we,d)["& .MuiToggleButton-root"],textTransform:"none"}},He=(O,L,N)=>m.jsx($.TextField,{select:!0,size:"small",label:"Compares",value:O??">=",onChange:I=>L(I.target.value),inputProps:{"aria-label":N},sx:{width:130},children:bf.filter(I=>I.op!=="~").map(I=>m.jsx($.MenuItem,{value:I.op,children:I.label},I.op))});return m.jsx(S.AppDialog,{className:`${S.reportClasses.dialog} ${S.reportClasses.filterDialog}`,open:e,onClose:o,...l?{}:{initialFocus:ue},title:l?u.label??u.name:"Add a filter",description:l?m.jsxs(m.Fragment,{children:[m.jsxs($.Box,{component:"span",sx:{fontFamily:d.font.mono},children:["$",u.name]}),h?" · declared in the model, so its label and options are set there":" · declared in this report"]}):"A filter on the page, and the tiles it filters.",actions:m.jsxs(m.Fragment,{children:[l&&m.jsx($.Button,{color:"error",startIcon:m.jsx(S.DeleteOutlineIcon,{}),onClick:()=>c(u.name),sx:O=>({mr:"auto",color:S.dangerTextColor(O)}),children:"Remove filter"}),m.jsx($.Button,{onClick:o,children:"Cancel"}),m.jsx($.Tooltip,{title:xe||R===void 0?"":"A ticked tile has no field, or names one its source does not have.",children:m.jsx("span",{children:m.jsx($.Button,{variant:"contained",onClick:Re,disabled:!xe,children:l?"Apply":"Add filter"})})})]}),children:m.jsxs($.Stack,{sx:{gap:2.5,pt:1},children:[!l&&r.length>0&&m.jsxs($.ToggleButtonGroup,{exclusive:!0,size:"small",value:p.kind,onChange:(O,L)=>{L==="new"?v({kind:"new"}):L==="existing"&&r[0]&&q(r[0])},"aria-label":"Where the filter comes from",sx:We,children:[m.jsx($.ToggleButton,{value:"new",children:"New in this report"}),m.jsx($.ToggleButton,{value:"existing",children:"From the model"})]}),!l&&p.kind==="existing"?m.jsx($.TextField,{select:!0,size:"small",label:"Filter",value:p.name,onChange:O=>{const L=r.find(N=>N.name===O.target.value);L&&q(L)},children:r.map(O=>m.jsxs($.MenuItem,{value:O.name,children:[O.label??O.name,m.jsxs($.Typography,{component:"span",variant:"caption",sx:{ml:1,opacity:.6},children:["$",O.name]})]},O.name))}):null,m.jsxs($.Box,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",sm:h?"1fr":"minmax(0, 1.4fr) minmax(0, 1fr)"},gap:1.5,alignItems:"start"},children:[!j&&m.jsx(Ra,{value:b,onChange:ee,fields:W,accepts:J,label:"Field",ariaLabel:"Field to filter",placeholder:"category",inputRef:ue,error:Z!==void 0,helperText:Z??(!l&&E?`Declared as $${E}`:void 0)}),!h&&m.jsx($.TextField,{size:"small",label:"Label",placeholder:E?Bi(E):"",value:x,onChange:O=>_(O.target.value),InputLabelProps:{shrink:!0},inputProps:{"aria-label":"Filter label"}})]}),P&&!j&&He(A,z,"Comparison"),!l&&p.kind==="new"&&m.jsxs($.Box,{children:[m.jsx(Aa,{children:"Control"}),m.jsx($.Box,{role:"radiogroup","aria-label":"Filter kind",sx:{display:"grid",gridTemplateColumns:{xs:"repeat(3, minmax(0, 1fr))",sm:"repeat(5, minmax(0, 1fr))"},gap:1},children:wf.map(O=>{const L=O.kind===g,N=Ae(O.kind);return m.jsx($.Tooltip,{title:N??O.hint,describeChild:!0,children:m.jsxs($.ButtonBase,{role:"radio","aria-checked":L,"aria-label":O.label,"aria-disabled":N!==void 0,onClick:()=>{N===void 0&&M(O.kind)},sx:I=>({flexDirection:"column",gap:.5,px:1,py:1.25,borderRadius:d.radius.tile,border:`1px solid ${L?f.accent:we}`,boxShadow:L?`0 0 0 1px ${f.accent}`:"none",bgcolor:L?`color-mix(in srgb, ${f.accent} 6%, ${I.palette.background.paper})`:I.palette.background.paper,color:L?f.accent:I.palette.text.secondary,opacity:N?.45:1,cursor:N?"default":"pointer",transition:`border-color ${S.MOTION_FAST}, background-color ${S.MOTION_FAST}`,"&:hover":N||L?{}:{borderColor:fe}}),children:[m.jsx(Df,{kind:O.kind}),m.jsx($.Box,{component:"span",sx:{...d.type.caption,fontWeight:L?600:500,color:L?f.accent:"text.primary",textAlign:"center"},children:Of[O.kind]})]})},O.kind)})}),g==="date"&&m.jsx($.TextField,{size:"small",type:"date",label:"Starts at",value:y,onChange:O=>w(O.target.value),InputLabelProps:{shrink:!0},sx:{mt:1.5,width:200}})]}),m.jsxs($.Box,{sx:{border:`1px solid ${we}`,borderRadius:d.radius.tile,overflow:"hidden"},children:[m.jsxs($.Stack,{direction:"row",sx:{alignItems:"center",gap:1.25,px:1.5,py:1},children:[m.jsx(gf,{"aria-hidden":!0,sx:{fontSize:18,color:"text.secondary"}}),m.jsxs($.Typography,{variant:"body2",sx:{flex:1,minWidth:0},children:[m.jsx($.Box,{component:"span",sx:{fontWeight:d.type.label.fontWeight},children:B===H&&H>0?`Applies to all ${B} tile${B===1?"":"s"}`:`Applies to ${B} of ${H} tile${H===1?"":"s"}`}),!j&&b.trim()!==""&&B>0&&m.jsxs($.Box,{component:"span",sx:{color:"text.secondary"},children:[" · each filters on ",m.jsx($.Box,{component:"span",sx:{...d.type.code},children:b.trim()})]})]}),!j&&m.jsx($.Button,{size:"small","aria-expanded":_e,onClick:()=>X(O=>!O),children:_e?"Done choosing":"Choose tiles"})]}),m.jsx($.Collapse,{in:_e,unmountOnExit:!0,children:m.jsxs($.Box,{sx:{borderTop:`1px solid ${we}`,px:.5,pb:1},children:[m.jsxs($.Stack,{direction:"row",sx:{alignItems:"center",gap:.5,pt:.5},children:[m.jsx($.Checkbox,{size:"small",checked:H>0&&B===H,indeterminate:B>0&&B<H,disabled:H===0,onChange:O=>Q(O.target.checked),inputProps:{"aria-label":"All tiles"}}),m.jsx($.Typography,{variant:"body2",sx:{flex:1,color:"text.secondary"},children:"All tiles"}),m.jsx($.Button,{size:"small",onClick:()=>{j||C(O=>O.map(L=>({...L,field:b}))),D(O=>!O)},children:j?"Same field for all":"Adjust per tile"})]}),m.jsx($.Stack,{sx:{gap:j?1:0},children:t.tiles.map((O,L)=>{if(!le(O))return null;const N=T[L],I=O.label??O.name,V=j?te[L]:void 0;return m.jsxs($.Stack,{direction:"row",sx:{gap:1,alignItems:j?"flex-start":"center",opacity:F[L]?1:.6},children:[m.jsx($.Checkbox,{size:"small",disabled:!F[L],checked:(N?.include??!1)&&F[L],inputProps:{"aria-label":`Filter ${I}`},onChange:G=>U(L,{include:G.target.checked})}),m.jsx($.Typography,{variant:"body2",sx:{flex:1,minWidth:0,pt:j?1:0},noWrap:!0,children:I}),F[L]?j&&m.jsxs(m.Fragment,{children:[P&&He(N?.op,G=>U(L,{op:G}),`Comparison for ${I}`),m.jsx(Ra,{value:N?.field??"",onChange:G=>U(L,{field:G}),fields:i?.(O),accepts:J,label:"Field",ariaLabel:`Field for ${I}`,disabled:!N?.include,error:V!==void 0,helperText:V,sx:{width:220,pr:1}})]}):m.jsx($.Typography,{variant:"caption",sx:{color:f.tileTitle,pr:1,maxWidth:260,textAlign:"right"},children:Ef(t.tiles[L]).reason})]},`${O.source}.${O.name}`)})})]})})]}),B===0&&m.jsx($.Typography,{variant:"caption",sx:{color:"warning.main",display:"block",mt:-1.5},children:"No tile is ticked, so this control will not appear on the report."}),!h&&m.jsxs($.Box,{children:[m.jsx(Aa,{children:"Preview"}),m.jsx($.Box,{sx:O=>({display:"flex",alignItems:"center",gap:1,p:1.5,borderRadius:d.radius.tile,bgcolor:O.palette.action.hover}),children:m.jsxs($.Box,{"aria-hidden":!0,sx:O=>({display:"inline-flex",alignItems:"center",gap:.75,height:30,px:1.25,borderRadius:d.radius.control,border:`1px solid ${we}`,bgcolor:O.palette.background.paper,...d.type.control}),children:[m.jsx($.Box,{component:"span",sx:{color:"text.secondary"},children:ze}),m.jsx($.Box,{component:"span",sx:{fontWeight:d.type.label.fontWeight},children:pe}),m.jsx(S.ExpandMoreIcon,{sx:{fontSize:16,color:"text.secondary"}})]})})]})]})})}function Aa({children:e}){const t=Se.usePublisherTheme().theme.ui;return m.jsx($.Typography,{component:"div",sx:{...t.type.label,color:"text.secondary",mb:.75},children:e})}const Of={select:"Pick one",multiselect:"Pick several",text:"Text",number:"Range",date:"Date"};function Df({kind:e}){const t={fontSize:22};switch(e){case"select":return m.jsx(df,{sx:t});case"multiselect":return m.jsx(uf,{sx:t});case"text":return m.jsx(pf,{sx:t});case"number":return m.jsx(hf,{sx:t});case"date":return m.jsx(ff,{sx:t})}}function La({type:e}){const t=e?.replace(/_type$/,""),n=t==="string"?"Abc":t==="number"?"#":t==="date"||t==="timestamp"?"Date":t==="boolean"?"T/F":void 0,r=Se.usePublisherTheme().theme.ui;return n?m.jsx($.Box,{component:"span","aria-hidden":!0,sx:s=>({fontFamily:r.font.mono,fontSize:10,fontWeight:r.type.label.fontWeight,color:s.palette.text.secondary,bgcolor:s.palette.action.hover,borderRadius:"4px",px:.5,py:.25,minWidth:22,textAlign:"center",flex:"none"}),children:n}):null}const Mf=S.createSvgIcon(m.jsx("path",{d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"}));function Vl(e,t,n,r){const[s,i]=k.useState(void 0);return k.useEffect(()=>{t&&e!==void 0&&i(structuredClone(e))},[t,e]),{draft:s,patch:d=>i(l=>{if(l===void 0)return l;const u=structuredClone(l);return d(u),u}),apply:d=>{if(s===void 0)return;const l=structuredClone(s);d(l),i(l),JSON.stringify(l)!==JSON.stringify(e)&&n(l)},close:()=>{s!==void 0&&e!==void 0&&JSON.stringify(s)!==JSON.stringify(e)&&n(s),r()},discard:()=>i(void 0)}}const jf=e=>e&&e.length===1?`This tile's chart line (${e[0]}) is not one the builder models, so its chart cannot be changed here.`:`This tile has ${e?.length??"several"} chart lines${e?` (${e.join(" and ")})`:""}, so its chart cannot be changed here.`,If="Declared on its source, so its chart is set in the model.";function Pf({anchor:e,tile:t,onClose:n,onCommit:r,onDrills:s,onDuplicate:i,duplicateBlocked:o,view:a}){const{theme:c}=Se.usePublisherTheme(),f=c.ui,{draft:d,apply:l,close:u}=Vl(t,e!==null,r,n),[h,p]=k.useState(void 0),v=d!==void 0&&le(d)?d:void 0,x=v!==void 0&&v.declaration.kind!=="inherited",_=R=>l(P=>{le(P)&&R(P)}),g=k.useRef(void 0),y=e!==null;k.useEffect(()=>{y?g.current=t&&le(t)?t.chart:void 0:p(void 0)},[y]);const w=v?.chart??"default",b=Nl(a,w),T=v?x?v.chart==="custom"?jf(v.chartLines):void 0:If:void 0,C=R=>_(P=>{const A=g.current;R===(A??"default")?(A===void 0?delete P.chart:P.chart=A,delete P.chartCarried):(P.chart=R,a?P.chartCarried=a.chart?[a.chart]:[]:delete P.chartCarried)}),j=x?s?void 0:"Its source declares no dimension a click could filter by.":void 0,D=R=>P=>p({kind:R,anchor:P.currentTarget}),E=(R,P,A)=>m.jsxs(m.Fragment,{children:[m.jsx($.ListItemText,{primary:R,...A?{secondary:A}:{},secondaryTypographyProps:{sx:{whiteSpace:"normal",maxWidth:240}}}),P&&m.jsx($.Typography,{variant:"body2",sx:{color:"text.secondary",ml:2},children:P})]});return m.jsxs(m.Fragment,{children:[m.jsxs($.Menu,{className:S.reportClasses.menu,open:e!==null&&d!==void 0,anchorEl:e,onClose:u,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},MenuListProps:{dense:!0,disabledItemsFocusable:!0,"aria-label":v?`${v.source} ${v.name}`:"Tile"},slotProps:{paper:{sx:{minWidth:240,mt:.5,borderRadius:f.radius.menu,border:`1px solid ${S.edgeColor(c.cardBorder)}`,boxShadow:f.shadow.menu}}},children:[v&&m.jsxs($.MenuItem,{"aria-haspopup":"menu","aria-expanded":h?.kind==="chart",disabled:T!==void 0,onClick:D("chart"),onKeyDown:R=>{R.key==="ArrowRight"&&T===void 0&&p({kind:"chart",anchor:R.currentTarget})},children:[E("Chart",T?void 0:b.find(R=>R.value===w)?.label,T),m.jsx(Mf,{fontSize:"small",sx:{ml:1,color:"text.secondary"}})]}),x&&m.jsx($.MenuItem,{"aria-haspopup":"dialog",disabled:j!==void 0,onClick:()=>{u(),s?.()},children:E("Clickable cells…",void 0,j)}),v&&i&&m.jsx($.MenuItem,{disabled:o!==void 0,onClick:()=>{u(),i()},children:E("Duplicate",void 0,o)}),v?.declaration.kind==="opaque"&&m.jsxs($.Typography,{variant:"body2",sx:{color:c.tileTitle,px:2,py:.75,maxWidth:260},children:["Its body is ",v.declaration.why,", so a filter has no single place to go."]}),v&&m.jsx($.Divider,{}),v&&m.jsxs($.Box,{"aria-hidden":!0,sx:{px:2,py:.5,...f.type.code,color:"text.secondary"},children:[v.source," → ",v.name]})]}),m.jsx($.Menu,{className:S.reportClasses.menu,open:h?.kind==="chart",anchorEl:h?.anchor??null,onClose:()=>p(void 0),anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"right"},MenuListProps:{dense:!0,disabledItemsFocusable:!0,"aria-label":"Chart",onKeyDown:R=>{R.key==="ArrowLeft"&&(R.preventDefault(),p(void 0))}},children:b.filter(R=>R.value!=="custom").map(R=>m.jsxs($.MenuItem,{role:"menuitemradio","aria-checked":R.value===w,disabled:R.disabled===!0,onClick:()=>{C(R.value),p(void 0)},children:[m.jsx($.ListItemText,{primary:R.label,...R.reason?{secondary:R.reason}:{}}),R.value===w&&m.jsx($.ListItemIcon,{sx:{minWidth:0,ml:2},children:m.jsx(S.CheckIcon,{fontSize:"small",sx:{color:c.accent}})})]},R.value))})]})}const kn=e=>e.label??S.tileTitle(`${e.source} -> ${e.name}`);function Rf({editor:e,catalog:t,columns:n,dashboards:r,bindings:s,tiles:i,drillSource:o,setDrillSource:a,exitDialog:c,renderViewPreview:f,takenGivenNames:d}){const{filterDialog:l,setFilterDialog:u}=s,{menu:h,setMenu:p}=i,[v,x]=k.useState(),_=h===void 0?void 0:e.document.tiles[h.index],g=_&&le(_)?_:void 0,y=(()=>{if(!g||!t)return;const w=e.document.sources.find(T=>T.name===g.source)?.base??g.source,b=g.declaration.kind==="reference"?g.declaration.from:g.name;return t.sources.find(T=>T.name===w)?.views.find(T=>T.name===b)})();return m.jsxs(m.Fragment,{children:[m.jsx(Cf,{open:l!==void 0,document:e.document,...l?.control?{control:l.control}:{},available:s.available,...d?{takenNames:d}:{},...t?{fieldsFor:s.fieldsFor}:{},onClose:()=>u(void 0),onApply:s.applyFilter,onRemove:s.dropControl}),m.jsx(Pf,{anchor:h?.anchor??null,tile:h===void 0?void 0:e.document.tiles[h.index],onClose:()=>p(void 0),onCommit:w=>{const b=h?.index;b!==void 0&&e.update(T=>{T.tiles[b]=w})},view:y,onDuplicate:()=>{h&&i.duplicate(h.index)},...g&&Es(g)!==void 0?{duplicateBlocked:Es(g)}:{},...(e.document.sources.find(w=>w.name===g?.source)?.dimensions?.length??0)>0?{onDrills:()=>{x(g?kn(g):void 0),a(g?.source)}}:{}}),m.jsx(lf,{open:o!==void 0,document:e.document,source:e.document.sources.find(w=>w.name===o),givenNames:s.controlList.map(w=>w.name),dashboards:r??[],...v?{tileLabel:v}:{},onClose:()=>a(void 0),onApply:w=>e.update(b=>{const C=[...(b.drills??[]).filter(j=>j.source!==o),...w];C.length===0?delete b.drills:b.drills=C})}),m.jsx(S.UnsavedChangesDialog,{...c}),m.jsx(sf,{open:i.addingTile,document:e.document,catalog:t,columns:n,onClose:i.closeAdd,onAdd:i.addTile,onAddText:i.addText,...f?{renderPreview:f}:{}})]})}var Af=Symbol.for("preact-signals");function Qs(){if(kt>1)kt--;else{var e,t=!1;for((function(){var s=Ds;for(Ds=void 0;s!==void 0;){var i=s.S;if(i.v===s.v)for(var o=i.t;o!==void 0;o=o.x)o.i===s.i&&(o.i=i.i);s=s.o}})();xr!==void 0;){var n=xr;for(xr=void 0,Os++;n!==void 0;){var r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&Hl(n))try{n.c()}catch(s){t||(e=s,t=!0)}n=r}}if(Os=0,kt--,t)throw e}}function Ee(e){if(kt>0)return e();Fi=++Lf,kt++;try{return e()}finally{Qs()}}var br,ye=void 0;function re(e){var t=ye,n=br;ye=void 0,br=void 0;try{return e()}finally{ye=t,br=n}}var xr=void 0,kt=0,Os=0,Lf=0,Fi=0,Ds=void 0,Ms=0;function Ul(e){if(ye!==void 0){var t=e.n;if(t===void 0||t.t!==ye)return t={i:0,S:e,p:ye.s,n:void 0,t:ye,e:void 0,x:void 0,r:t},ye.s!==void 0&&(ye.s.n=t),ye.s=t,e.n=t,32&ye.f&&e.S(t),t;if(t.i===-1)return t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=ye.s,t.n=void 0,ye.s.n=t,ye.s=t),t}}function Ze(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}Ze.prototype.brand=Af;Ze.prototype.h=function(){return!0};Ze.prototype.S=function(e){var t=this,n=this.t;n!==e&&e.e===void 0&&(e.x=n,this.t=e,n!==void 0?n.e=e:re(function(){var r;(r=t.W)==null||r.call(t)}))};Ze.prototype.U=function(e){var t=this;if(this.t!==void 0){var n=e.e,r=e.x;n!==void 0&&(n.x=r,e.e=void 0),r!==void 0&&(r.e=n,e.x=void 0),e===this.t&&(this.t=r,r===void 0&&re(function(){var s;(s=t.Z)==null||s.call(t)}))}};Ze.prototype.subscribe=function(e){var t=this;return dt(function(){var n=t.value;re(function(){return e(n)})},{name:"sub"})};Ze.prototype.valueOf=function(){return this.value};Ze.prototype.toString=function(){return this.value+""};Ze.prototype.toJSON=function(){return this.value};Ze.prototype.peek=function(){var e=this;return re(function(){return e.value})};Object.defineProperty(Ze.prototype,"value",{get:function(){var e=Ul(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(Os>100)throw new Error("Cycle detected");(function(n){kt!==0&&Os===0&&n.l!==Fi&&(n.l=Fi,Ds={S:n,v:n.v,i:n.i,o:Ds})})(this),this.v=e,this.i++,Ms++,kt++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{Qs()}}}});function Pn(e,t){return new Ze(e,t)}function Hl(e){for(var t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function ql(e){for(var t=e.s;t!==void 0;t=t.n){var n=t.S.n;if(n!==void 0&&(t.r=n),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function Kl(e){for(var t=e.s,n=void 0;t!==void 0;){var r=t.p;t.i===-1?(t.S.U(t),r!==void 0&&(r.n=t.n),t.n!==void 0&&(t.n.p=r)):n=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=r}e.s=n}function Jt(e,t){Ze.call(this,void 0,t),this.x=e,this.s=void 0,this.g=Ms-1,this.f=4}Jt.prototype=new Ze;Jt.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Ms))return!0;if(this.g=Ms,this.f|=1,this.i>0&&!Hl(this))return this.f&=-2,!0;var e=ye;try{ql(this),ye=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(n){this.v=n,this.f|=16,this.i++}return ye=e,Kl(this),this.f&=-2,!0};Jt.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var t=this.s;t!==void 0;t=t.n)t.S.S(t)}Ze.prototype.S.call(this,e)};Jt.prototype.U=function(e){if(this.t!==void 0&&(Ze.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(var t=this.s;t!==void 0;t=t.n)t.S.U(t)}};Jt.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;e!==void 0;e=e.x)e.t.N()}};Object.defineProperty(Jt.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=Ul(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function Ba(e,t){return new Jt(e,t)}function Yl(e){var t=e.m;if(e.m=void 0,typeof t=="function"){kt++;var n=ye;ye=void 0;try{t()}catch(r){throw e.f&=-2,e.f|=8,To(e),r}finally{ye=n,Qs()}}}function To(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Yl(e)}function Bf(e){if(ye!==this)throw new Error("Out-of-order effect");Kl(this),ye=e,this.f&=-2,8&this.f&&To(this),Qs()}function Rn(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,br&&br.push(this)}Rn.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var t=this.x();typeof t=="function"&&(this.m=t)}finally{e()}};Rn.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Yl(this),ql(this),kt++;var e=ye;return ye=this,Bf.bind(this,e)};Rn.prototype.N=function(){2&this.f||(this.f|=2,this.u=xr,xr=this)};Rn.prototype.d=function(){this.f|=8,1&this.f||To(this)};Rn.prototype.dispose=function(){this.d()};function dt(e,t){var n=new Rn(e,t);try{n.c()}catch(s){throw n.d(),s}var r=n.d.bind(n);return r[Symbol.dispose]=r,r}var Ff=Object.create,Eo=Object.defineProperty,zf=Object.defineProperties,Wf=Object.getOwnPropertyDescriptor,Nf=Object.getOwnPropertyDescriptors,Fa=Object.getOwnPropertySymbols,Gf=Object.prototype.hasOwnProperty,Vf=Object.prototype.propertyIsEnumerable,Uf=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),An=e=>{throw TypeError(e)},zi=(e,t,n)=>t in e?Eo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Hf=(e,t)=>{for(var n in t||(t={}))Gf.call(t,n)&&zi(e,n,t[n]);if(Fa)for(var n of Fa(t))Vf.call(t,n)&&zi(e,n,t[n]);return e},qf=(e,t)=>zf(e,Nf(t)),za=(e,t)=>Eo(e,"name",{value:t,configurable:!0}),Kf=e=>{var t;return[,,,Ff((t=void 0)!=null?t:null)]},Xl=["class","method","getter","setter","accessor","field","value","get","set"],er=e=>e!==void 0&&typeof e!="function"?An("Function expected"):e,Yf=(e,t,n,r,s)=>({kind:Xl[e],name:t,metadata:r,addInitializer:i=>n._?An("Already initialized"):s.push(er(i||null))}),Ql=(e,t)=>zi(t,Uf("metadata"),e[3]),Ft=(e,t,n,r)=>{for(var s=0,i=e[t>>1],o=i&&i.length;s<o;s++)t&1?i[s].call(n):r=i[s].call(n,r);return r},Ln=(e,t,n,r,s,i)=>{var o,a,c,f,d,l=t&7,u=!!(t&8),h=!!(t&16),p=l>3?e.length+1:l?u?1:2:0,v=Xl[l+5],x=l>3&&(e[p-1]=[]),_=e[p]||(e[p]=[]),g=l&&(!h&&!u&&(s=s.prototype),l<5&&(l>3||!h)&&Wf(l<4?s:{get[n](){return it(this,i)},set[n](w){return Mt(this,i,w)}},n));l?h&&l<4&&za(i,(l>2?"set ":l>1?"get ":"")+n):za(s,n);for(var y=r.length-1;y>=0;y--)f=Yf(l,n,c={},e[3],_),l&&(f.static=u,f.private=h,d=f.access={has:h?w=>Xf(s,w):w=>n in w},l^3&&(d.get=h?w=>(l^1?it:Qf)(w,s,l^4?i:g.get):w=>w[n]),l>2&&(d.set=h?(w,b)=>Mt(w,s,b,l^4?i:g.set):(w,b)=>w[n]=b)),a=(0,r[y])(l?l<4?h?i:g[v]:l>4?void 0:{get:g.get,set:g.set}:s,f),c._=1,l^4||a===void 0?er(a)&&(l>4?x.unshift(a):l?h?i=a:g[v]=a:s=a):typeof a!="object"||a===null?An("Object expected"):(er(o=a.get)&&(g.get=o),er(o=a.set)&&(g.set=o),er(o=a.init)&&x.unshift(o));return l||Ql(e,s),g&&Eo(s,n,g),h?l^4?i:g:s},Co=(e,t,n)=>t.has(e)||An("Cannot "+n),Xf=(e,t)=>Object(t)!==t?An('Cannot use the "in" operator on this value'):e.has(t),it=(e,t,n)=>(Co(e,t,"read from private field"),n?n.call(e):t.get(e)),tr=(e,t,n)=>t.has(e)?An("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Mt=(e,t,n,r)=>(Co(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),Qf=(e,t,n)=>(Co(e,t,"access private method"),n);function Wi(e,t){if(t){let n;return Ba(()=>{const r=e();return r&&n&&t(n,r)?n:(n=r,r)})}return Ba(e)}function ft(e,t){if(Object.is(e,t))return!0;if(e===null||t===null)return!1;if(typeof e=="function"&&typeof t=="function")return e===t;if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}if(Array.isArray(e))return!Array.isArray(t)||e.length!==t.length?!1:!e.some((r,s)=>!ft(r,t[s]));if(typeof e=="object"&&typeof t=="object"){const n=Object.keys(e),r=Object.keys(t);return n.length!==r.length?!1:!n.some(i=>!ft(e[i],t[i]))}return!1}function se({get:e},t){return{init(n){return Pn(n)},get(){return e.call(this).value},set(n){const r=e.call(this);r.peek()!==n&&(r.value=n)}}}function Oe(e,t){const n=new WeakMap;return function(){let r=n.get(this);return r||(r=Wi(e.bind(this)),n.set(this,r)),r.value}}function hi(e=!0){return function(t,n){n.addInitializer(function(){const r=n.kind==="field"?this:n.static?this:Object.getPrototypeOf(this),s=Object.getOwnPropertyDescriptor(r,n.name);s&&Object.defineProperty(r,n.name,qf(Hf({},s),{enumerable:e}))})}}function Lr(...e){const t=e.map(n=>dt(n));return()=>t.forEach(n=>n())}var Zl,Jl,ec,tc,nc,rc,Ye,Oo,pi,Ni,Gi,qe,Do,gi,sc,Vi,Mo,mi,Ui,Hi;rc=[se],nc=[se],tc=[se],ec=[hi()],Jl=[hi()],Zl=[hi()];var en=class{constructor(e,t=Object.is){this.defaultValue=e,this.equals=t,Ft(Ye,5,this),tr(this,qe),tr(this,Oo,Ft(Ye,8,this)),Ft(Ye,11,this),tr(this,Do,Ft(Ye,12,this)),Ft(Ye,15,this),tr(this,Mo,Ft(Ye,16,this)),Ft(Ye,19,this),this.reset=this.reset.bind(this),this.reset()}get current(){return it(this,qe,Ui)}get initial(){return it(this,qe,Ni)}get previous(){return it(this,qe,sc)}set current(e){const t=re(()=>it(this,qe,Ui));e&&t&&this.equals(t,e)||Ee(()=>{it(this,qe,Ni)||Mt(this,qe,e,Gi),Mt(this,qe,t,Vi),Mt(this,qe,e,Hi)})}reset(e=this.defaultValue){Ee(()=>{Mt(this,qe,void 0,Vi),Mt(this,qe,e,Gi),Mt(this,qe,e,Hi)})}};Ye=Kf();Oo=new WeakMap;qe=new WeakSet;Do=new WeakMap;Mo=new WeakMap;pi=Ln(Ye,20,"#initial",rc,qe,Oo),Ni=pi.get,Gi=pi.set;gi=Ln(Ye,20,"#previous",nc,qe,Do),sc=gi.get,Vi=gi.set;mi=Ln(Ye,20,"#current",tc,qe,Mo),Ui=mi.get,Hi=mi.set;Ln(Ye,2,"current",ec,en);Ln(Ye,2,"initial",Jl,en);Ln(Ye,2,"previous",Zl,en);Ql(Ye,en);function vi(e){return re(()=>{const t={};for(const n in e)t[n]=e[n];return t})}var zt,Zf=class{constructor(){tr(this,zt,new WeakMap)}get(e,t){var n;return e?(n=it(this,zt).get(e))==null?void 0:n.get(t):void 0}set(e,t,n){var r;if(e)return it(this,zt).has(e)||it(this,zt).set(e,new Map),(r=it(this,zt).get(e))==null?void 0:r.set(t,n)}clear(e){var t;return e?(t=it(this,zt).get(e))==null?void 0:t.clear():void 0}};zt=new WeakMap;var Jf=Object.create,ic=Object.defineProperty,eh=Object.getOwnPropertyDescriptor,Wa=Object.getOwnPropertySymbols,th=Object.prototype.hasOwnProperty,nh=Object.prototype.propertyIsEnumerable,oc=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),Zs=e=>{throw TypeError(e)},Na=Math.pow,qi=(e,t,n)=>t in e?ic(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,rh=(e,t)=>{for(var n in t||(t={}))th.call(t,n)&&qi(e,n,t[n]);if(Wa)for(var n of Wa(t))nh.call(t,n)&&qi(e,n,t[n]);return e},sh=e=>{var t;return[,,,Jf((t=e?.[oc("metadata")])!=null?t:null)]},ac=["class","method","getter","setter","accessor","field","value","get","set"],lc=e=>e!==void 0&&typeof e!="function"?Zs("Function expected"):e,ih=(e,t,n,r,s)=>({kind:ac[e],name:t,metadata:r,addInitializer:i=>n._?Zs("Already initialized"):s.push(lc(i||null))}),oh=(e,t)=>qi(t,oc("metadata"),e[3]),ah=(e,t,n,r)=>{for(var s=0,i=e[t>>1],o=i&&i.length;s<o;s++)i[s].call(n);return r},cc=(e,t,n,r,s,i)=>{for(var o,a,c,f,d=t&7,l=!1,u=!1,h=2,p=ac[d+5],v=e[h]||(e[h]=[]),x=(s=s.prototype,eh(s,n)),_=r.length-1;_>=0;_--)c=ih(d,n,a={},e[3],v),c.static=l,c.private=u,f=c.access={has:g=>n in g},f.get=g=>g[n],o=(0,r[_])(x[p],c),a._=1,lc(o)&&(x[p]=o);return x&&ic(s,n,x),s},dc=(e,t,n)=>t.has(e)||Zs("Cannot "+n),lh=(e,t,n)=>(dc(e,t,"read from private field"),t.get(e)),ch=(e,t,n)=>t.has(e)?Zs("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),dh=(e,t,n,r)=>(dc(e,t,"write to private field"),t.set(e,n),n),ot=class Ki{constructor(t,n){this.x=t,this.y=n}static delta(t,n){return new Ki(t.x-n.x,t.y-n.y)}static distance(t,n){return Math.hypot(t.x-n.x,t.y-n.y)}static equals(t,n){return t.x===n.x&&t.y===n.y}static from({x:t,y:n}){return new Ki(t,n)}},bt=class Wt{constructor(t,n,r,s){this.left=t,this.top=n,this.width=r,this.height=s,this.scale={x:1,y:1}}get inverseScale(){return{x:1/this.scale.x,y:1/this.scale.y}}translate(t,n){const{top:r,left:s,width:i,height:o,scale:a}=this,c=new Wt(s+t,r+n,i,o);return c.scale=rh({},a),c}get boundingRectangle(){const{width:t,height:n,left:r,top:s,right:i,bottom:o}=this;return{width:t,height:n,left:r,top:s,right:i,bottom:o}}get center(){const{left:t,top:n,right:r,bottom:s}=this;return new ot((t+r)/2,(n+s)/2)}get area(){const{width:t,height:n}=this;return t*n}equals(t){if(!(t instanceof Wt))return!1;const{left:n,top:r,width:s,height:i}=this;return n===t.left&&r===t.top&&s===t.width&&i===t.height}containsPoint(t){const{top:n,left:r,bottom:s,right:i}=this;return n<=t.y&&t.y<=s&&r<=t.x&&t.x<=i}intersectionArea(t){return t instanceof Wt?uh(this,t):0}intersectionRatio(t){const{area:n}=this,r=this.intersectionArea(t);return r/(t.area+n-r)}get bottom(){const{top:t,height:n}=this;return t+n}get right(){const{left:t,width:n}=this;return t+n}get aspectRatio(){const{width:t,height:n}=this;return t/n}get corners(){return[{x:this.left,y:this.top},{x:this.right,y:this.top},{x:this.left,y:this.bottom},{x:this.right,y:this.bottom}]}static from({top:t,left:n,width:r,height:s}){return new Wt(n,t,r,s)}static delta(t,n,r={x:"center",y:"center"}){const s=(i,o)=>{const a=r[o],c=o==="x"?i.left:i.top,f=o==="x"?i.width:i.height;return a=="start"?c:a=="end"?c+f:c+f/2};return ot.delta({x:s(t,"x"),y:s(t,"y")},{x:s(n,"x"),y:s(n,"y")})}static intersectionRatio(t,n){return Wt.from(t).intersectionRatio(Wt.from(n))}};function uh(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),s=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),o=s-r,a=i-n;return r<s&&n<i?o*a:0}var uc,fc,Yi,fs,Br,Js=class extends(Yi=en,fc=[Oe],uc=[Oe],Yi){constructor(t){const n=ot.from(t);super(n,(r,s)=>ot.equals(r,s)),ah(Br,5,this),ch(this,fs,0),this.velocity={x:0,y:0}}get delta(){return ot.delta(this.current,this.initial)}get direction(){const{current:t,previous:n}=this;if(!n)return null;const r={x:t.x-n.x,y:t.y-n.y};return!r.x&&!r.y?null:Math.abs(r.x)>Math.abs(r.y)?r.x>0?"right":"left":r.y>0?"down":"up"}get current(){return super.current}set current(t){const{current:n}=this,r=ot.from(t),s={x:r.x-n.x,y:r.y-n.y},i=Date.now(),o=i-lh(this,fs),a=c=>Math.round(c/o*100);Ee(()=>{dh(this,fs,i),this.velocity={x:a(s.x),y:a(s.y)},super.current=r})}reset(t=this.defaultValue){super.reset(ot.from(t)),this.velocity={x:0,y:0}}};Br=sh(Yi);fs=new WeakMap;cc(Br,2,"delta",fc,Js);cc(Br,2,"direction",uc,Js);oh(Br,Js);function Xi({x:e,y:t},n){const r=Math.abs(e),s=Math.abs(t);return typeof n=="number"?Math.sqrt(Na(r,2)+Na(s,2))>n:"x"in n&&"y"in n?r>n.x&&s>n.y:"x"in n?r>n.x:"y"in n?s>n.y:!1}var hc=(e=>(e.Horizontal="x",e.Vertical="y",e))(hc||{}),pc=Object.values(hc),fh=Object.create,jo=Object.defineProperty,hh=Object.defineProperties,ph=Object.getOwnPropertyDescriptor,gh=Object.getOwnPropertyDescriptors,js=Object.getOwnPropertySymbols,gc=Object.prototype.hasOwnProperty,mc=Object.prototype.propertyIsEnumerable,vc=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),Bn=e=>{throw TypeError(e)},Qi=(e,t,n)=>t in e?jo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Io=(e,t)=>{for(var n in t||(t={}))gc.call(t,n)&&Qi(e,n,t[n]);if(js)for(var n of js(t))mc.call(t,n)&&Qi(e,n,t[n]);return e},Po=(e,t)=>hh(e,gh(t)),Ga=(e,t)=>jo(e,"name",{value:t,configurable:!0}),yc=(e,t)=>{var n={};for(var r in e)gc.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&js)for(var r of js(e))t.indexOf(r)<0&&mc.call(e,r)&&(n[r]=e[r]);return n},Fn=e=>{var t;return[,,,fh((t=e?.[vc("metadata")])!=null?t:null)]},bc=["class","method","getter","setter","accessor","field","value","get","set"],nr=e=>e!==void 0&&typeof e!="function"?Bn("Function expected"):e,mh=(e,t,n,r,s)=>({kind:bc[e],name:t,metadata:r,addInitializer:i=>n._?Bn("Already initialized"):s.push(nr(i||null))}),tn=(e,t)=>Qi(t,vc("metadata"),e[3]),Y=(e,t,n,r)=>{for(var s=0,i=e[t>>1],o=i&&i.length;s<o;s++)t&1?i[s].call(n):r=i[s].call(n,r);return r},ie=(e,t,n,r,s,i)=>{var o,a,c,f,d,l=t&7,u=!!(t&8),h=!!(t&16),p=l>3?e.length+1:l?u?1:2:0,v=bc[l+5],x=l>3&&(e[p-1]=[]),_=e[p]||(e[p]=[]),g=l&&(!h&&!u&&(s=s.prototype),l<5&&(l>3||!h)&&ph(l<4?s:{get[n](){return Ce(this,i)},set[n](w){return rt(this,i,w)}},n));l?h&&l<4&&Ga(i,(l>2?"set ":l>1?"get ":"")+n):Ga(s,n);for(var y=r.length-1;y>=0;y--)f=mh(l,n,c={},e[3],_),l&&(f.static=u,f.private=h,d=f.access={has:h?w=>vh(s,w):w=>n in w},l^3&&(d.get=h?w=>(l^1?Ce:xc)(w,s,l^4?i:g.get):w=>w[n]),l>2&&(d.set=h?(w,b)=>rt(w,s,b,l^4?i:g.set):(w,b)=>w[n]=b)),a=(0,r[y])(l?l<4?h?i:g[v]:l>4?void 0:{get:g.get,set:g.set}:s,f),c._=1,l^4||a===void 0?nr(a)&&(l>4?x.unshift(a):l?h?i=a:g[v]=a:s=a):typeof a!="object"||a===null?Bn("Object expected"):(nr(o=a.get)&&(g.get=o),nr(o=a.set)&&(g.set=o),nr(o=a.init)&&x.unshift(o));return l||tn(e,s),g&&jo(s,n,g),h?l^4?i:g:s},Ro=(e,t,n)=>t.has(e)||Bn("Cannot "+n),vh=(e,t)=>Object(t)!==t?Bn('Cannot use the "in" operator on this value'):e.has(t),Ce=(e,t,n)=>(Ro(e,t,"read from private field"),n?n.call(e):t.get(e)),de=(e,t,n)=>t.has(e)?Bn("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),rt=(e,t,n,r)=>(Ro(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),xc=(e,t,n)=>(Ro(e,t,"access private method"),n);function wc(e,t){return{plugin:e,options:t}}function Fr(e){return t=>wc(e,t)}function Tr(e){return typeof e=="function"?{plugin:e,options:void 0}:e}var _c,Er,Ao,hs;_c=[se];var Ke=class{constructor(e,t){this.manager=e,this.options=t,de(this,Ao,Y(Er,8,this,!1)),Y(Er,11,this),de(this,hs,new Set)}enable(){this.disabled=!1}disable(){this.disabled=!0}isDisabled(){return re(()=>this.disabled)}configure(e){this.options=e}registerEffect(e){const t=dt(e.bind(this));return Ce(this,hs).add(t),t}destroy(){Ce(this,hs).forEach(e=>e())}static configure(e){return wc(this,e)}};Er=Fn(null);Ao=new WeakMap;hs=new WeakMap;ie(Er,4,"disabled",_c,Ke,Ao);tn(Er,Ke);var zr=class extends Ke{},ps,yi=class{constructor(e){this.manager=e,this.instances=new Map,de(this,ps,[])}get values(){return Array.from(this.instances.values())}set values(e){const t=e.map(Tr).reduce((r,s)=>{const i=r.find(({plugin:o})=>o===s.plugin);return i?(i.options=s.options,r):[...r,s]},[]),n=t.map(({plugin:r})=>r);for(const r of Ce(this,ps))if(!n.includes(r)){if(r.prototype instanceof zr)continue;this.unregister(r)}for(const{plugin:r,options:s}of t)this.register(r,s);rt(this,ps,n)}get(e){return this.instances.get(e)}register(e,t){const n=this.instances.get(e);if(n)return n.options!==t&&(n.options=t),n;const r=new e(this.manager,t);return this.instances.set(e,r),r}unregister(e){const t=this.instances.get(e);t&&(t.destroy(),this.instances.delete(e))}destroy(){for(const e of this.instances.values())e.destroy();this.instances.clear()}};ps=new WeakMap;function yh(e,t){return e.priority===t.priority?e.type===t.type?t.value-e.value:t.type-e.type:t.priority-e.priority}var ts=[],hn,pn,bh=class extends Ke{constructor(e){super(e),de(this,hn),de(this,pn),this.computeCollisions=this.computeCollisions.bind(this),rt(this,pn,Pn(ts)),this.destroy=Lr(()=>{const t=this.computeCollisions(),n=re(()=>this.manager.dragOperation.position.current);if(t!==ts){const r=Ce(this,hn);if(rt(this,hn,n),r&&n.x==r.x&&n.y==r.y)return}else rt(this,hn,void 0);Ce(this,pn).value=t},()=>{const{dragOperation:t}=this.manager;t.status.initialized&&this.forceUpdate()})}forceUpdate(e=!0){re(()=>{e?Ce(this,pn).value=this.computeCollisions():rt(this,hn,void 0)})}computeCollisions(e,t){const{registry:n,dragOperation:r}=this.manager,{source:s,shape:i,status:o}=r;if(!o.initialized||!i)return ts;const a=[],c=[];for(const f of e??n.droppables){if(f.disabled||s&&!f.accepts(s))continue;const d=t??f.collisionDetector;if(!d)continue;c.push(f),f.shape;const l=re(()=>d({droppable:f,dragOperation:r}));l&&(f.collisionPriority!=null&&(l.priority=f.collisionPriority),a.push(l))}return c.length===0?ts:(a.sort(yh),a)}get collisions(){return Ce(this,pn).value}};hn=new WeakMap;pn=new WeakMap;var kc,Sc,$c,Lo,Tc,ht,Bo,xn,Fo,zo;$c=[se],Sc=[se],kc=[se];var $t=class Nt{constructor(t,n){de(this,Bo,Y(ht,8,this)),Y(ht,11,this),de(this,xn),de(this,Fo,Y(ht,12,this)),Y(ht,15,this),de(this,zo,Y(ht,16,this)),Y(ht,19,this);const{effects:r,id:s,data:i={},disabled:o=!1,register:a=!0}=t;let c=s;rt(this,xn,Pn(s)),this.manager=n,this.data=i,this.disabled=o,this.effects=()=>{var f;return[()=>{const{id:d,manager:l}=this;if(d!==c)return c=d,l?.registry.register(this),()=>l?.registry.unregister(this)},...(f=r?.())!=null?f:[]]},this.register=this.register.bind(this),this.unregister=this.unregister.bind(this),this.destroy=this.destroy.bind(this),n&&a&&queueMicrotask(this.register)}get id(){var t,n;const r=Ce(this,xn).value;return(n=(t=Nt.pendingIdChanges)==null?void 0:t.get(this))!=null?n:r}set id(t){var n,r;const s=(r=(n=Nt.pendingIdChanges)==null?void 0:n.get(this))!=null?r:Ce(this,xn).peek();t!==s&&(Nt.pendingIdChanges||(Nt.pendingIdChanges=new Map,queueMicrotask(()=>{var i;return xc(i=Nt,Lo,Tc).call(i)})),Nt.pendingIdChanges.set(this,t))}register(){var t;return(t=this.manager)==null?void 0:t.registry.register(this)}unregister(){var t;(t=this.manager)==null||t.registry.unregister(this)}destroy(){var t;(t=this.manager)==null||t.registry.unregister(this)}};ht=Fn(null);Lo=new WeakSet;Tc=function(){const e=$t.pendingIdChanges;$t.pendingIdChanges=null,e&&Ee(()=>{for(const[t,n]of e)Ce(t,xn).value=n})};Bo=new WeakMap;xn=new WeakMap;Fo=new WeakMap;zo=new WeakMap;ie(ht,4,"manager",$c,$t,Bo);ie(ht,4,"data",Sc,$t,Fo);ie(ht,4,"disabled",kc,$t,zo);de($t,Lo);tn(ht,$t);$t.pendingIdChanges=null;var ei=$t,Va=class{constructor(){this.map=Pn(new Map),this.cleanupFunctions=new WeakMap,this.register=(e,t)=>{const n=this.map.peek(),r=n.get(e),s=()=>this.unregister(e,t);if(r===t)return s;if(r&&r.id===e){const a=this.cleanupFunctions.get(r);a?.(),this.cleanupFunctions.delete(r)}const i=new Map(n);for(const[a,c]of n)if(c===t&&a!==e){i.delete(a);break}i.set(e,t),this.map.value=i;const o=Lr(...t.effects());return this.cleanupFunctions.set(t,o),s},this.unregister=(e,t)=>{const n=this.map.peek();if(n.get(e)!==t)return;const r=this.cleanupFunctions.get(t);r?.(),this.cleanupFunctions.delete(t);const s=new Map(n);s.delete(e),this.map.value=s}}[Symbol.iterator](){return this.map.peek().values()}get value(){return this.map.value.values()}has(e){return this.map.value.has(e)}get(e){return this.map.value.get(e)}destroy(){for(const e of this){const t=this.cleanupFunctions.get(e);t?.(),e.destroy()}this.map.value=new Map}},Ec,Cc,Oc,Dc,Mc,jc,Zi,Xe,Wo,No,Go,xt=class extends(Zi=ei,jc=[se],Mc=[se],Dc=[se],Oc=[Oe],Cc=[Oe],Ec=[Oe],Zi){constructor(t,n){var r=t,{modifiers:s,type:i,sensors:o,plugins:a,effects:c}=r,f=yc(r,["modifiers","type","sensors","plugins","effects"]);super(Po(Io({},f),{effects:()=>{var d;return[...(d=c?.())!=null?d:[],()=>{const{manager:l,plugins:u}=this;if(!(!l||!u))for(const h of u){const{plugin:p}=Tr(h);l.registry.plugins.register(p)}}]}}),n),Y(Xe,5,this),de(this,Wo,Y(Xe,8,this)),Y(Xe,11,this),de(this,No,Y(Xe,12,this)),Y(Xe,15,this),de(this,Go,Y(Xe,16,this,this.isDragSource?"dragging":"idle")),Y(Xe,19,this),this.type=i,this.sensors=o,this.modifiers=s,this.alignment=f.alignment,this.plugins=a}pluginConfig(t){if(this.plugins)for(const n of this.plugins){const r=Tr(n);if(r.plugin===t)return r.options}}get isDropping(){return this.status==="dropping"&&this.isDragSource}get isDragging(){return this.status==="dragging"&&this.isDragSource}get isDragSource(){var t,n;return((n=(t=this.manager)==null?void 0:t.dragOperation.source)==null?void 0:n.id)===this.id}};Xe=Fn(Zi);Wo=new WeakMap;No=new WeakMap;Go=new WeakMap;ie(Xe,4,"type",jc,xt,Wo);ie(Xe,4,"modifiers",Mc,xt,No);ie(Xe,4,"status",Dc,xt,Go);ie(Xe,2,"isDropping",Oc,xt);ie(Xe,2,"isDragging",Cc,xt);ie(Xe,2,"isDragSource",Ec,xt);tn(Xe,xt);var Ic,Pc,Rc,Ac,Lc,Bc,Ji,Le,Vo,Uo,Ho,qo,Ko,wt=class extends(Ji=ei,Bc=[se],Lc=[se],Ac=[se],Rc=[se],Pc=[se],Ic=[Oe],Ji){constructor(t,n){var r=t,{accept:s,collisionDetector:i,collisionPriority:o,type:a}=r,c=yc(r,["accept","collisionDetector","collisionPriority","type"]);super(c,n),Y(Le,5,this),de(this,Vo,Y(Le,8,this)),Y(Le,11,this),de(this,Uo,Y(Le,12,this)),Y(Le,15,this),de(this,Ho,Y(Le,16,this)),Y(Le,19,this),de(this,qo,Y(Le,20,this)),Y(Le,23,this),de(this,Ko,Y(Le,24,this)),Y(Le,27,this),this.accept=s,this.collisionDetector=i,this.collisionPriority=o,this.type=a}accepts(t){const{accept:n}=this;return n?typeof n=="function"?n(t):t.type?Array.isArray(n)?n.includes(t.type):t.type===n:!1:!0}get isDropTarget(){var t,n;return((n=(t=this.manager)==null?void 0:t.dragOperation.target)==null?void 0:n.id)===this.id}};Le=Fn(Ji);Vo=new WeakMap;Uo=new WeakMap;Ho=new WeakMap;qo=new WeakMap;Ko=new WeakMap;ie(Le,4,"accept",Bc,wt,Vo);ie(Le,4,"type",Lc,wt,Uo);ie(Le,4,"collisionDetector",Ac,wt,Ho);ie(Le,4,"collisionPriority",Rc,wt,qo);ie(Le,4,"shape",Pc,wt,Ko);ie(Le,2,"isDropTarget",Ic,wt);tn(Le,wt);var xh=class{constructor(){this.registry=new Map}addEventListener(e,t){const{registry:n}=this,r=new Set(n.get(e));return r.add(t),n.set(e,r),()=>this.removeEventListener(e,t)}removeEventListener(e,t){const{registry:n}=this,r=new Set(n.get(e));r.delete(t),n.set(e,r)}dispatch(e,...t){const{registry:n}=this,r=n.get(e);if(r)for(const s of r)s(...t)}},wh=class extends xh{constructor(e){super(),this.manager=e}dispatch(e,t){const n=[t,this.manager];super.dispatch(e,...n)}};function gs(e,t=!0){let n=!1;return Po(Io({},e),{cancelable:t,get defaultPrevented(){return n},preventDefault(){t&&(n=!0)}})}var _h=class extends zr{constructor(e){super(e);const t=(r,s)=>r.map(({id:i})=>i).join("")===s.map(({id:i})=>i).join("");let n=[];this.destroy=Lr(()=>{const{dragOperation:r,collisionObserver:s}=e;r.status.initializing&&(n=[],s.enable())},()=>{const{collisionObserver:r,monitor:s}=e,{collisions:i}=r;if(r.isDisabled()||ei.pendingIdChanges)return;const o=gs({collisions:i});if(s.dispatch("collision",o),o.defaultPrevented||t(i,n))return;n=i;const[a]=i;re(()=>{var c;a?.id!==((c=e.dragOperation.target)==null?void 0:c.id)&&(r.disable(),e.actions.setDropTarget(a?.id).then(()=>{r.enable()}))})})}},zn=(e=>(e[e.Lowest=0]="Lowest",e[e.Low=1]="Low",e[e.Normal=2]="Normal",e[e.High=3]="High",e[e.Highest=4]="Highest",e))(zn||{}),Wn=(e=>(e[e.Collision=0]="Collision",e[e.ShapeIntersection=1]="ShapeIntersection",e[e.PointerIntersection=2]="PointerIntersection",e))(Wn||{}),Fc,zc,Wc,Nc,Gc,Vc,Uc,ct,Yo;Uc=[se],Vc=[Oe],Gc=[Oe],Nc=[Oe],Wc=[Oe],zc=[Oe],Fc=[Oe];var Et=class{constructor(){Y(ct,5,this),de(this,Yo,Y(ct,8,this,"idle")),Y(ct,11,this)}get current(){return this.value}get idle(){return this.value==="idle"}get initializing(){return this.value==="initializing"}get initialized(){const{value:e}=this;return e!=="idle"&&e!=="initialization-pending"}get dragging(){return this.value==="dragging"}get dropped(){return this.value==="dropped"}set(e){this.value=e}};ct=Fn(null);Yo=new WeakMap;ie(ct,4,"value",Uc,Et,Yo);ie(ct,2,"current",Vc,Et);ie(ct,2,"idle",Gc,Et);ie(ct,2,"initializing",Nc,Et);ie(ct,2,"initialized",Wc,Et);ie(ct,2,"dragging",zc,Et);ie(ct,2,"dropped",Fc,Et);tn(ct,Et);var kh=class{constructor(e){this.manager=e}setDragSource(e){const{dragOperation:t}=this.manager;t.sourceIdentifier=typeof e=="string"||typeof e=="number"?e:e.id}setDropTarget(e){return re(()=>{const{dragOperation:t}=this.manager,n=e??null;if(t.targetIdentifier===n)return Promise.resolve(!1);t.targetIdentifier=n;const r=gs({operation:t.snapshot()});return t.status.dragging&&this.manager.monitor.dispatch("dragover",r),this.manager.renderer.rendering.then(()=>r.defaultPrevented)})}start(e){return re(()=>{const{dragOperation:t}=this.manager;if(e.source!=null&&this.setDragSource(e.source),!t.source)throw new Error("Cannot start a drag operation without a drag source");if(!t.status.idle)throw new Error("Cannot start a drag operation while another is active");const r=new AbortController,{event:s,coordinates:i}=e;Ee(()=>{t.status.set("initialization-pending"),t.shape=null,t.canceled=!1,t.activatorEvent=s??null,t.position.reset(i)});const o=gs({operation:t.snapshot()});return this.manager.monitor.dispatch("beforedragstart",o),o.defaultPrevented?(t.reset(),r.abort(),r):(t.status.set("initializing"),t.controller=r,this.manager.renderer.rendering.then(()=>{if(r.signal.aborted)return;const{status:a}=t;a.current==="initializing"&&Ee(()=>{t.status.set("dragging"),this.manager.monitor.dispatch("dragstart",{nativeEvent:s,operation:t.snapshot(),cancelable:!1})})}),r)})}move(e){return re(()=>{var t,n;const{dragOperation:r}=this.manager,{status:s,controller:i}=r;if(!s.dragging||!i||i.signal.aborted)return;const o=gs({nativeEvent:e.event,operation:r.snapshot(),by:e.by,to:e.to},(t=e.cancelable)!=null?t:!0);((n=e.propagate)==null||n)&&this.manager.monitor.dispatch("dragmove",o),queueMicrotask(()=>{var a,c,f,d,l;if(o.defaultPrevented)return;const u=(l=e.to)!=null?l:{x:r.position.current.x+((c=(a=e.by)==null?void 0:a.x)!=null?c:0),y:r.position.current.y+((d=(f=e.by)==null?void 0:f.y)!=null?d:0)};r.position.current=u})})}stop(e={}){return re(()=>{var t,n;const{dragOperation:r}=this.manager,{controller:s}=r;if(!s||s.signal.aborted)return;let i;const o=()=>{const c={resume:()=>{},abort:()=>{}};return i=new Promise((f,d)=>{c.resume=f,c.abort=d}),c};s.abort();const a=()=>{this.manager.renderer.rendering.then(()=>{r.status.set("dropped");const c=re(()=>{var d;return((d=r.source)==null?void 0:d.status)==="dropping"}),f=()=>{r.controller===s&&(r.controller=void 0),r.reset()};if(c){const{source:d}=r,l=dt(()=>{d?.status==="idle"&&(l(),f())})}else this.manager.renderer.rendering.then(f)})};r.canceled=(t=e.canceled)!=null?t:!1,this.manager.monitor.dispatch("dragend",{nativeEvent:e.event,operation:r.snapshot(),canceled:(n=e.canceled)!=null?n:!1,suspend:o}),i?i.then(a).catch(()=>r.reset()):a()})}},Cn=class extends Ke{constructor(e,t){super(e,t),this.manager=e,this.options=t}},Sh=class extends AbortController{constructor(e,t){super(),this.constraints=e,this.onActivate=t,this.activated=!1;for(const n of e??[])n.controller=this}onEvent(e){var t;if(!this.activated)if((t=this.constraints)!=null&&t.length)for(const n of this.constraints)n.onEvent(e);else this.activate(e)}activate(e){this.activated||(this.activated=!0,this.onActivate(e))}abort(e){this.activated=!1,super.abort(e)}},ms,Hc=class{constructor(e){this.options=e,de(this,ms)}set controller(e){rt(this,ms,e),e.signal.addEventListener("abort",()=>this.abort())}activate(e){var t;(t=Ce(this,ms))==null||t.activate(e)}};ms=new WeakMap;var Ua=class extends Ke{constructor(e,t){super(e,t),this.manager=e,this.options=t}apply(e){return e.transform}},$h=class{constructor(e){this.draggables=new Va,this.droppables=new Va,this.plugins=new yi(e),this.sensors=new yi(e),this.modifiers=new yi(e)}register(e,t){if(e instanceof xt)return this.draggables.register(e.id,e);if(e instanceof wt)return this.droppables.register(e.id,e);if(e.prototype instanceof Ua)return this.modifiers.register(e,t);if(e.prototype instanceof Cn)return this.sensors.register(e,t);if(e.prototype instanceof Ke)return this.plugins.register(e,t);throw new Error("Invalid instance type")}unregister(e){if(e instanceof ei)return e instanceof xt?this.draggables.unregister(e.id,e):e instanceof wt?this.droppables.unregister(e.id,e):()=>{};if(e.prototype instanceof Ua)return this.modifiers.unregister(e);if(e.prototype instanceof Cn)return this.sensors.unregister(e);if(e.prototype instanceof Ke)return this.plugins.unregister(e);throw new Error("Invalid instance type")}destroy(){this.draggables.destroy(),this.droppables.destroy(),this.plugins.destroy(),this.sensors.destroy(),this.modifiers.destroy()}},qc,Kc,Yc,Xc,Qc,Zc,Jc,ed,td,rr,vs,gn,Te,Xo,Qo,Zo,Jo,ea,sr;td=[Oe],ed=[se],Jc=[se],Zc=[se],Qc=[se],Xc=[se],Yc=[Oe],Kc=[Oe],qc=[Oe];var mt=class{constructor(e){Y(Te,5,this),de(this,rr),de(this,vs),de(this,gn,new en(void 0,(t,n)=>t&&n?t.equals(n):t===n)),this.status=new Et,de(this,Xo,Y(Te,8,this,!1)),Y(Te,11,this),de(this,Qo,Y(Te,12,this,null)),Y(Te,15,this),de(this,Zo,Y(Te,16,this,null)),Y(Te,19,this),de(this,Jo,Y(Te,20,this,null)),Y(Te,23,this),de(this,ea,Y(Te,24,this,[])),Y(Te,27,this),this.position=new Js({x:0,y:0}),de(this,sr,{x:0,y:0}),rt(this,rr,e)}get shape(){const{current:e,initial:t,previous:n}=Ce(this,gn);return!e||!t?null:{current:e,initial:t,previous:n}}set shape(e){e?Ce(this,gn).current=e:Ce(this,gn).reset()}get source(){var e;const t=this.sourceIdentifier;if(t==null)return null;const n=Ce(this,rr).registry.draggables.get(t);return n&&rt(this,vs,n),(e=n??Ce(this,vs))!=null?e:null}get target(){var e;const t=this.targetIdentifier;return t!=null&&(e=Ce(this,rr).registry.droppables.get(t))!=null?e:null}get transform(){const{x:e,y:t}=this.position.delta;let n={x:e,y:t};for(const r of this.modifiers)n=r.apply(Po(Io({},this.snapshot()),{transform:n}));return rt(this,sr,n),n}snapshot(){return re(()=>({source:this.source,target:this.target,activatorEvent:this.activatorEvent,transform:Ce(this,sr),shape:this.shape?vi(this.shape):null,position:vi(this.position),status:vi(this.status),canceled:this.canceled}))}reset(){Ee(()=>{this.status.set("idle"),this.sourceIdentifier=null,this.targetIdentifier=null,Ce(this,gn).reset(),this.position.reset({x:0,y:0}),rt(this,sr,{x:0,y:0}),this.modifiers=[]})}};Te=Fn(null);rr=new WeakMap;vs=new WeakMap;gn=new WeakMap;Xo=new WeakMap;Qo=new WeakMap;Zo=new WeakMap;Jo=new WeakMap;ea=new WeakMap;sr=new WeakMap;ie(Te,2,"shape",td,mt);ie(Te,4,"canceled",ed,mt,Xo);ie(Te,4,"activatorEvent",Jc,mt,Qo);ie(Te,4,"sourceIdentifier",Zc,mt,Zo);ie(Te,4,"targetIdentifier",Qc,mt,Jo);ie(Te,4,"modifiers",Xc,mt,ea);ie(Te,2,"source",Yc,mt);ie(Te,2,"target",Kc,mt);ie(Te,2,"transform",qc,mt);tn(Te,mt);var Th={get rendering(){return Promise.resolve()}};function gt(e,t){return typeof e=="function"?e(t):e??t}var Eh=class{constructor(t){this.destroy=()=>{this.dragOperation.status.idle||this.actions.stop({canceled:!0}),this.dragOperation.modifiers.forEach(u=>u.destroy()),this.registry.destroy(),this.collisionObserver.destroy()};var n;const r=t??{},s=gt(r.plugins,[]),i=gt(r.sensors,[]),o=gt(r.modifiers,[]),a=(n=r.renderer)!=null?n:Th,c=new wh(this),f=new $h(this);this.registry=f,this.monitor=c,this.renderer=a,this.actions=new kh(this),this.dragOperation=new mt(this),this.collisionObserver=new bh(this),this.plugins=[_h,...s],this.modifiers=o,this.sensors=i;const{destroy:d}=this,l=Lr(()=>{var u,h,p;const v=re(()=>this.dragOperation.modifiers),x=this.modifiers;for(const _ of v)x.includes(_)||_.destroy();this.dragOperation.modifiers=(p=(h=(u=this.dragOperation.source)==null?void 0:u.modifiers)==null?void 0:h.map(_=>{const{plugin:g,options:y}=Tr(_);return new g(this,y)}))!=null?p:x});this.destroy=()=>{l(),d()}}get plugins(){return this.registry.plugins.values}set plugins(t){this.registry.plugins.values=t}get modifiers(){return this.registry.modifiers.values}set modifiers(t){this.registry.modifiers.values=t}get sensors(){return this.registry.sensors.values}set sensors(t){this.registry.sensors.values=t}},nd=e=>{throw TypeError(e)},ta=(e,t,n)=>t.has(e)||nd("Cannot "+n),K=(e,t,n)=>(ta(e,t,"read from private field"),t.get(e)),Je=(e,t,n)=>t.has(e)?nd("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),nt=(e,t,n,r)=>(ta(e,t,"write to private field"),t.set(e,n),n),rd=(e,t,n)=>(ta(e,t,"access private method"),n);function ti(e){return e?e instanceof KeyframeEffect?!0:"getKeyframes"in e&&typeof e.getKeyframes=="function":!1}function sd(e,t){const n=e.getAnimations();let r=null;for(const s of n){if(s.playState!=="running")continue;const{effect:i}=s,a=(ti(i)?i.getKeyframes():[]).filter(t);a.length>0&&(r=[a[a.length-1],s])}return r}function ni(e){const{width:t,height:n,top:r,left:s,bottom:i,right:o}=e.getBoundingClientRect();return{width:t,height:n,top:r,left:s,bottom:i,right:o}}function na(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Wr(e){return"nodeType"in e}function st(e){var t,n,r;return e?na(e)?e:Wr(e)?"defaultView"in e?(t=e.defaultView)!=null?t:window:(r=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?r:window:window:window}function ra(e){const{Document:t}=st(e);return e instanceof t||"nodeType"in e&&e.nodeType===Node.DOCUMENT_NODE}function At(e){return!e||na(e)?!1:e instanceof st(e).HTMLElement||"namespaceURI"in e&&typeof e.namespaceURI=="string"&&e.namespaceURI.endsWith("html")}function id(e){return e instanceof st(e).SVGElement||"namespaceURI"in e&&typeof e.namespaceURI=="string"&&e.namespaceURI.endsWith("svg")}function Nn(e){return e?na(e)?e.document:Wr(e)?ra(e)?e:At(e)||id(e)?e.ownerDocument:document:document:document}function Ch(e){var t,n,r,s;const{documentElement:i}=Nn(e),o=st(e).visualViewport,a=(t=o?.width)!=null?t:i.clientWidth,c=(n=o?.height)!=null?n:i.clientHeight,f=(r=o?.offsetTop)!=null?r:0,d=(s=o?.offsetLeft)!=null?s:0;return{top:f,left:d,right:d+a,bottom:f+c,width:a,height:c}}function Oh(e,t){if(Dh(e)&&e.open===!1)return!1;const{overflow:n,overflowX:r,overflowY:s}=getComputedStyle(e);return n==="visible"&&r==="visible"&&s==="visible"}function Dh(e){return e.tagName==="DETAILS"}function Cr(e,t=e.getBoundingClientRect(),n=0){var r,s,i,o,a;let c=t;const{ownerDocument:f}=e,d=(r=f.defaultView)!=null?r:window;let l=e.parentElement;for(;l&&l!==f.documentElement;){if(!Oh(l)){const y=l.getBoundingClientRect(),w=n*(y.bottom-y.top),b=n*(y.right-y.left),T=n*(y.bottom-y.top),C=n*(y.right-y.left);c={top:Math.max(c.top,y.top-w),right:Math.min(c.right,y.right+b),bottom:Math.min(c.bottom,y.bottom+T),left:Math.max(c.left,y.left-C),width:0,height:0},c.width=c.right-c.left,c.height=c.bottom-c.top}l=l.parentElement}const u=d.visualViewport,h=(s=u?.offsetTop)!=null?s:0,p=(i=u?.offsetLeft)!=null?i:0,v=(o=u?.width)!=null?o:d.innerWidth,x=(a=u?.height)!=null?a:d.innerHeight,_=n*x,g=n*v;return c={top:Math.max(c.top,h-_),right:Math.min(c.right,p+v+g),bottom:Math.min(c.bottom,h+x+_),left:Math.max(c.left,p-g),width:0,height:0},c.width=c.right-c.left,c.height=c.bottom-c.top,c.width<0&&(c.width=0),c.height<0&&(c.height=0),c}function On(e){return{x:e.clientX,y:e.clientY}}var od=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function eo(e=document,t=new Set){if(t.has(e))return[];t.add(e);const n=[e];for(const r of Array.from(e.querySelectorAll("iframe, frame")))try{const s=r.contentDocument;s&&!t.has(s)&&n.push(...eo(s,t))}catch{}try{const r=e.defaultView;if(r&&r!==window.top){const s=r.parent;s&&s.document&&s.document!==e&&n.push(...eo(s.document,t))}}catch{}return n}function sa(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function ad(){var e,t;const n=sa()?window.visualViewport:null;return{x:(e=n?.offsetLeft)!=null?e:0,y:(t=n?.offsetTop)!=null?t:0}}function ia(e){return!e||!Wr(e)?!1:e instanceof st(e).ShadowRoot}function Is(e){if(e&&Wr(e)){let t=e.getRootNode();if(ia(t))return t;if(t instanceof Document)return t}return Nn(e)}function oa(e){return e.matchMedia("(prefers-reduced-motion: reduce)").matches}function Mh(e){const t="input, textarea, select, canvas, [contenteditable]",n=e.cloneNode(!0),r=Array.from(e.querySelectorAll(t));return Array.from(n.querySelectorAll(t)).forEach((i,o)=>{const a=r[o];if(Ha(i)&&Ha(a)&&(i.type!=="file"&&(i.value=a.value),i.type==="radio"&&i.name&&(i.name=`Cloned__${i.name}`)),qa(i)&&qa(a)&&a.width>0&&a.height>0){const c=i.getContext("2d");c?.drawImage(a,0,0)}}),n}function Ha(e){return"value"in e}function qa(e){return e.tagName==="CANVAS"}function ld(e,{x:t,y:n}){const r=e.elementFromPoint(t,n);if(jh(r)){const{contentDocument:s}=r;if(s){const{left:i,top:o}=r.getBoundingClientRect();return ld(s,{x:t-i,y:n-o})}}return r}function jh(e){return e?.tagName==="IFRAME"}var to=new WeakMap;function Ih(e){return e.closest(`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("react/jsx-runtime"),S=require("../useCompiledDocument-XsQz85Ri.cjs.js"),$=require("@mui/material"),k=require("react"),Se=require("../ServerProvider-DKrBcXL7.cjs.js"),ge=require("../text-entry-BJwltZiy.cjs.js"),Zu=require("react-dom"),Ju=require("@malloydata/malloy-tag"),Fl=require("@tanstack/react-query"),zl=S.createSvgIcon(m.jsx("path",{d:"M18.4 10.6C16.55 8.99 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16c1.05-3.19 4.05-5.5 7.6-5.5 1.95 0 3.73.72 5.12 1.88L13 16h9V7z"})),Wl=S.createSvgIcon(m.jsx("path",{d:"M12.5 8c-2.65 0-5.05.99-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8"})),Ii=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform),Xt=Ii?"⌘":"Ctrl+",Ia=e=>{if(!(e instanceof HTMLElement))return!1;if(e.isContentEditable)return!0;const t=e.tagName;return t==="INPUT"||t==="TEXTAREA"||t==="SELECT"},fi=e=>e instanceof Element&&e.closest('[role="dialog"], .MuiPopover-root, .MuiDialog-root')!==null;function ef(e){const t=k.useRef(e);k.useEffect(()=>{t.current=e});const[n,r]=k.useState(!1);k.useEffect(()=>{n&&(r(!1),t.current.save?.())},[n]),k.useEffect(()=>{const s=i=>{const o=t.current;if(o.paused)return;const a=Ii?i.metaKey:i.ctrlKey,c=i.key.toLowerCase();if(i.key==="Escape"){if(Ia(i.target)||fi(i.target))return;o.escape();return}if(Ia(i.target)){if(a&&c==="s"){if(i.preventDefault(),!o.save||fi(i.target))return;i.target.blur(),r(!0)}return}if(fi(i.target)){a&&c==="s"&&i.preventDefault();return}if(a&&c==="z"){i.preventDefault(),i.shiftKey?o.redo():o.undo();return}if(!Ii&&a&&c==="y"){i.preventDefault(),o.redo();return}if(a&&c==="s"){i.preventDefault(),o.save?.();return}o.nudge&&!a&&!i.altKey&&!i.shiftKey&&(i.key==="ArrowLeft"||i.key==="ArrowRight")&&(i.preventDefault(),o.nudge(i.key==="ArrowRight"?1:-1))};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[])}const mr=(e,t,n=Se.DEFAULT_UI)=>({height:n.size.control,minHeight:n.size.control,px:1.5,borderRadius:n.radius.control,boxShadow:"none",...n.type.control,"&:hover":{boxShadow:"none"},"& .MuiButton-startIcon":{mr:.5,"& svg":{fontSize:18}},"&.MuiButton-outlined":{borderColor:e,"&:hover":{borderColor:t}}}),Ts=(e=Se.DEFAULT_UI)=>({width:e.size.control,height:e.size.control,borderRadius:e.radius.control,"& svg":{fontSize:18}}),vr={height:20,alignSelf:"center",mx:.5,my:0},En=(e,t=Se.DEFAULT_UI)=>({height:t.size.control,boxSizing:"border-box",borderRadius:t.radius.control,border:`1px solid ${e}`,overflow:"hidden",bgcolor:"background.paper","& .MuiToggleButton-root":{border:"none",borderRadius:"0 !important",m:"0 !important",px:1.5,py:0,height:"100%",...t.type.control,color:"text.secondary","& + .MuiToggleButton-root":{borderLeft:`1px solid ${e}`},"&:hover":{bgcolor:"action.hover"},"&.Mui-selected, &.Mui-selected:hover":{bgcolor:"action.selected",color:"text.primary"}}}),Pi={package:"Saves to the package file",browser:"Saves in this browser",host:"Saves to the app this is embedded in"};function tf({canUndo:e,canRedo:t,onUndo:n,onRedo:r,dirty:s,saving:i,onSave:o,savesTo:a="package",saveLabel:c,saveButton:f,actions:d,onAddTile:l,onExit:u,layout:h,onLayoutChange:p}){const{theme:v}=Se.usePublisherTheme(),x=S.edgeColor(v.cardBorder),_=S.hoverEdgeColor(v.cardBorder,v.tileTitle);return m.jsxs($.Stack,{direction:"row","aria-label":"Builder actions",sx:{alignItems:"center",gap:.5,flexShrink:0,"& .MuiButton-root":{whiteSpace:"nowrap"}},children:[h&&p&&m.jsxs(m.Fragment,{children:[m.jsx($.Tooltip,{title:"Layout: tiles side by side, or one after another",children:m.jsxs($.ToggleButtonGroup,{size:"small",exclusive:!0,value:h,"aria-label":"Layout",onChange:(g,y)=>{y&&y!==h&&p(y)},sx:En(x,v.ui),children:[m.jsx($.ToggleButton,{value:"linear","aria-label":"Linear layout",children:"Linear"}),m.jsx($.ToggleButton,{value:"grid","aria-label":"Grid layout",children:"Grid"})]})}),m.jsx($.Divider,{orientation:"vertical",sx:vr})]}),l&&m.jsx($.Button,{variant:"outlined",startIcon:m.jsx(S.AddIcon,{}),onClick:l,"aria-label":"Add tile",sx:mr(x,_,v.ui),children:"Tile"}),l&&m.jsx($.Divider,{orientation:"vertical",sx:vr}),m.jsx($.Tooltip,{title:`Undo (${Xt}Z)`,children:m.jsx("span",{children:m.jsx($.IconButton,{"aria-label":"Undo",disabled:!e,onClick:n,sx:Ts(v.ui),children:m.jsx(Wl,{fontSize:"small"})})})}),m.jsx($.Tooltip,{title:`Redo (${Xt}⇧Z)`,children:m.jsx("span",{children:m.jsx($.IconButton,{"aria-label":"Redo",disabled:!t,onClick:r,sx:Ts(v.ui),children:m.jsx(zl,{fontSize:"small"})})})}),(d||o||u)&&m.jsx($.Divider,{orientation:"vertical",sx:vr}),d,o?m.jsx($.Tooltip,{title:s?`Save (${Xt}S) · ${c??Pi[a]}`:c??Pi[a],children:m.jsx("span",{children:m.jsx($.Button,{ref:f,variant:s?"contained":"outlined",disabled:!s||i,onClick:o,sx:{...mr(x,_,v.ui),minWidth:88},children:i?"Saving…":s?"Save":"Saved"})})}):null,o&&m.jsx($.Box,{component:"span","aria-live":"polite",sx:{position:"absolute",width:"1px",height:"1px",overflow:"hidden",clipPath:"inset(50%)",whiteSpace:"nowrap"},children:i?"Saving":s?"Unsaved changes":"All changes saved"}),u&&m.jsx(S.SecondaryButton,{label:"Close",icon:m.jsx(S.CheckIcon,{}),onClick:u})]})}const nf={line_chart:"Line",bar_chart:"Bar",big_value:"Big value",scatter_chart:"Scatter",shape_map:"Shape map",segment_map:"Segment map"};function Nl(e,t,n){const s=o=>{if(t!==o){if(o==="big_value")return e?.aggregateOnly===!0?void 0:"Needs a view with only totals (no group by)";if(o==="shape_map"||o==="segment_map")return e?.chart===o?void 0:"Needs a view that already carries a map chart"}};return[{value:"default",label:"From the view"},{value:"none",label:"Table"},...["line_chart","bar_chart","big_value","scatter_chart","shape_map","segment_map"].map(o=>{const a=s(o);return{value:o,label:nf[o],...a?{disabled:!0,reason:a}:{}}}),...t==="custom"?[{value:"custom",label:"As written"}]:[]]}function Pa(e){return e.description??S.readableName(e.name)}const rf={bar_chart:"a bar chart",line_chart:"a line chart",scatter_chart:"a scatter chart",shape_map:"a shape map",segment_map:"a segment map",big_value:"a big value",sparkline:"a sparkline"},Jr=(e,t)=>`${e}\0${t}`;function sf({open:e,document:t,catalog:n,columns:r,onClose:s,onAdd:i,onAddText:o,renderPreview:a}){const{theme:c}=Se.usePublisherTheme(),f=c.ui,d=S.edgeColor(c.cardBorder),l=k.useMemo(()=>n?.sources??[],[n]),[u,h]=k.useState(""),[p,v]=k.useState(),[x,_]=k.useState(""),[g,y]=k.useState("default"),w=k.useRef(null),b=k.useMemo(()=>{const M=new Set(t.sources.map(F=>F.base));return[...l].sort((F,H)=>Number(M.has(H.name))-Number(M.has(F.name)))},[l,t]),T=b.filter(M=>M.views.length>0),C=b.filter(M=>M.views.length===0),j=k.useMemo(()=>new Map(T.flatMap(M=>M.views.map(F=>[Jr(M.name,F.name),{source:M,view:F,key:Jr(M.name,F.name)}]))),[T]),D=k.useMemo(()=>T.map(M=>({key:M.name,label:M.name,...M.description?{detail:M.description}:{},entries:M.views.map(F=>({key:Jr(M.name,F.name),name:F.name,title:Pa(F),...F.chart?{chart:F.chart}:{}}))})),[T]),E=p===void 0?void 0:j.get(p);k.useEffect(()=>{if(!e)return;h(""),_(""),y("default");const M=T[0]?.views[0];v(M&&T[0]?Jr(T[0].name,M.name):void 0)},[e]);const R=E?[E.source.name,E.view.name].filter(M=>!ge.isBareName(M)).map(M=>`"${M}" is not a plain Malloy name, so a tile cannot be written for it.`)[0]:void 0,P=E!==void 0&&R===void 0,A=E?Pa(E.view):"",U=g!=="default"&&E?{chart:g,chartCarried:E.view.chart?[E.view.chart]:[]}:{},z=(M=E)=>{if(!M||![M.source.name,M.view.name].every(ge.isBareName))return;const F=M.key===E?.key;i({base:M.source.name,modelPath:M.source.modelPath,...M.source.exporters?{exporters:M.source.exporters}:{},view:M.view.name,...F&&x.trim()?{label:x.trim()}:{},...F?U:{},colspan:Math.ceil(r/2)})},q=E?Nl(E.view,g).filter(M=>M.value!=="custom"&&M.disabled!==!0):[];return m.jsx(S.AppDialog,{className:`${S.reportClasses.dialog} ${S.reportClasses.addTileDialog}`,open:e,onClose:s,maxWidth:"md",initialFocus:w,title:"Add a tile",description:"Pick a view from this package. You can change its title and chart now or later.",actions:m.jsxs(m.Fragment,{children:[m.jsx($.Button,{onClick:o,sx:{mr:"auto"},children:"Add text instead"}),m.jsx($.Button,{onClick:s,children:"Cancel"}),m.jsx($.Button,{variant:"contained",disabled:!P,onClick:()=>z(),children:"Add tile"})]}),children:m.jsxs($.Box,{sx:{mx:-3,mb:-1,borderTop:`1px solid ${d}`,borderBottom:`1px solid ${d}`,display:"grid",gridTemplateColumns:{xs:"1fr",md:"320px minmax(0, 1fr)"},height:{md:460}},children:[m.jsx($.Box,{sx:{display:"flex",flexDirection:"column",minHeight:0,borderRight:{md:`1px solid ${d}`},maxHeight:{xs:280,md:"none"}},children:m.jsx(S.ViewPicker,{groups:D,query:u,onQuery:h,picked:E?.key,onPick:M=>{v(M),y("default")},onTake:M=>z(j.get(M)),searchRef:w,empty:m.jsx($.Typography,{variant:"body2",sx:{color:c.tileTitle,p:2},children:n?"This package publishes no source with a view to put on a tile.":"The package's sources are still loading."}),footer:C.length>0&&m.jsxs($.Typography,{variant:"caption",component:"p",sx:{color:"text.secondary",px:2,pt:1.5},children:["Also in this package, with no views to show:"," ",C.map(M=>M.name).join(", "),"."]})})}),m.jsx($.Box,{sx:M=>({p:2.5,display:"flex",flexDirection:"column",gap:2,minHeight:0,overflowY:"auto",bgcolor:`color-mix(in srgb, ${M.palette.text.primary} 3%, ${M.palette.background.paper})`}),children:E?m.jsxs(m.Fragment,{children:[m.jsx($.Box,{"aria-label":"Preview",role:"region",sx:M=>({height:240,flex:"none",display:"flex",position:"relative",overflow:"hidden",borderRadius:f.radius.tile,border:`1px solid ${d}`,bgcolor:M.palette.background.paper,"&::after":{content:'""',position:"absolute",left:0,right:0,bottom:0,height:40,pointerEvents:"none",background:`linear-gradient(to bottom, transparent, ${M.palette.background.paper})`}}),children:a?m.jsx($.Box,{sx:{flex:1,minWidth:0,px:2,pt:1.5},children:a({base:E.source.name,modelPath:E.source.modelPath,view:E.view.name,label:x.trim()||A,...g!=="default"?U:{},givens:E.source.givens})}):m.jsxs($.Box,{sx:M=>({flex:1,border:`1px solid ${d}`,borderRadius:f.radius.tile,bgcolor:M.palette.background.paper,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:1,color:"text.secondary"}),children:[m.jsx(S.ChartGlyph,{chart:E.view.chart}),m.jsxs($.Typography,{variant:"body2",children:[E.source.name," → ",E.view.name]})]})}),m.jsx($.TextField,{size:"small",label:"Title",placeholder:A,value:x,onChange:M=>_(M.target.value),InputLabelProps:{shrink:!0},inputProps:{"aria-label":"Tile title"}}),m.jsxs($.Box,{children:[m.jsx($.Typography,{component:"div",sx:{...f.type.label,color:"text.secondary",mb:.75},children:"Chart"}),m.jsx($.ToggleButtonGroup,{size:"small",exclusive:!0,value:g,"aria-label":"Chart",onChange:(M,F)=>{F!==null&&y(F)},sx:{...En(d,f),"& .MuiToggleButton-root":{...En(d,f)["& .MuiToggleButton-root"],textTransform:"none"}},children:q.map(M=>m.jsx($.ToggleButton,{value:M.value,children:M.label},M.value))}),m.jsx($.Typography,{variant:"caption",component:"p",sx:{color:"text.secondary",mt:.75},children:E.view.chart?`The view declares ${rf[E.view.chart]??"a chart"}.`:"The view declares no chart, so it shows as a table."})]}),R&&m.jsx($.Typography,{variant:"body2",color:"error",children:R})]}):m.jsx($.Typography,{variant:"body2",sx:{color:"text.secondary",m:"auto"},children:"Pick a view to see it here."})})]})})}const Me=e=>e.kind==="text",le=e=>e.kind!=="text",Xn=e=>le(e)?e.label??e.name:e.name,Be=e=>Me(e)?`text.${e.name}`:`${e.source}.${e.name}`;function of(e,t,{modelPath:n,textHeld:r,widths:s,insertAt:i}){t.modelPath&&!r&&(e.imports=S.withSource(e,t.base,t.modelPath,n,t.exporters??[t.modelPath]));const o=Gl(e,t.base),a=Ri(e,o.name,t.view);e.tiles.splice(i??e.tiles.length,0,{name:a,source:o.name,declaration:{kind:"reference",from:t.view},...s?{colspan:t.colspan}:{},...t.label?{label:t.label}:{},...t.chart?{chart:t.chart}:{},...t.chartCarried?{chartCarried:t.chartCarried}:{}})}function Gl(e,t,{unscoped:n=!1}={}){const r=e.sources.find(a=>a.base===t&&(!n||!a.scopedBy?.length));if(r)return r;const s=new Set(e.sources.map(a=>a.name));let i=`${t}_tiles`;for(let a=2;s.has(i);a++)i=`${t}_tiles_${a}`;const o={name:i,base:t};return e.sources.push(o),o}function Ri(e,t,n){const r=new Set(e.tiles.filter(le).filter(i=>i.source===t).map(i=>i.name));let s=`${n}_tile`;for(let i=2;r.has(s);i++)s=`${n}_tile_${i}`;return s}function Es(e){switch(e.declaration.kind){case"inline":return"Its query is written in this file, and the builder does not copy a query's body.";case"opaque":return`Its query is ${e.declaration.why}, which the builder does not copy.`;default:return e.chart==="custom"?"Its chart line is one the builder does not write, so a copy would lose it.":void 0}}function af(e,t){const n=e.tiles[t];if(!n||!le(n)||Es(n)!==void 0)return;let r;if(n.declaration.kind==="reference"){const{break:s,...i}=structuredClone(n);r={...i,name:Ri(e,n.source,n.declaration.from)}}else{const i=e.sources.find(o=>o.name===n.source)??Gl(e,n.source,{unscoped:!0});r={name:Ri(e,i.name,n.name),source:i.name,declaration:{kind:"reference",from:n.name},...n.colspan!==void 0?{colspan:n.colspan}:{}}}return e.tiles.splice(t+1,0,r),t+1}const es="self";function lf({open:e,document:t,source:n,givenNames:r,dashboards:s,tileLabel:i,onClose:o,onApply:a}){const{theme:c}=Se.usePublisherTheme(),f=c.ui,[d,l]=k.useState([]);k.useEffect(()=>{if(!e||!n)return;const g=(t.drills??[]).filter(y=>y.source===n.name);l((n.dimensions??[]).map(y=>{const w=g.find(b=>b.name===y.name);return{name:y.name,expression:y.expression,to:w?.to??[],given:w?.given??""}}))},[e,n,t]);const u=(g,y)=>l(w=>w.map((b,T)=>{if(T!==g)return b;const C={...b};return y(C),C})),h=[es,...s.filter(g=>g!==es)],p=g=>g===es?"This report":g,v=()=>{n&&(a(d.filter(g=>g.to.length>0).map(g=>({source:n.name,name:g.name,expression:g.expression,to:g.to,...g.given?{given:g.given}:{}}))),o())},x=S.edgeColor(c.cardBorder),_=(g,y)=>u(g,w=>{y?w.to=w.lastTo?.length?w.lastTo:[es]:(w.lastTo=w.to,w.to=[])});return m.jsx(S.AppDialog,{className:`${S.reportClasses.dialog} ${S.reportClasses.clickableCellsDialog}`,open:e,onClose:o,title:"Clickable cells",description:m.jsxs(m.Fragment,{children:[i&&m.jsxs($.Box,{component:"span",sx:{fontWeight:f.type.label.fontWeight},children:[i," ·"," "]}),"A click on a cell sets a filter to its value, on this report or on the one it opens."]}),actions:m.jsxs(m.Fragment,{children:[m.jsx($.Button,{onClick:o,children:"Cancel"}),m.jsx($.Button,{variant:"contained",onClick:v,disabled:d.length===0,children:"Apply"})]}),children:d.length===0?m.jsx($.Typography,{variant:"body2",sx:{color:c.tileTitle,pt:1},children:n?m.jsxs(m.Fragment,{children:[m.jsx($.Box,{component:"code",children:n.name})," declares no dimensions of its own in this file. A click is a tag on the dimension's declaration, so a dimension the model declares is made clickable in the model; to make one clickable here, declare it in"," ",m.jsx($.Box,{component:"code",children:n.name})," and group by it."]}):"This tile's source is not declared in this file."}):m.jsx($.Box,{role:"list","aria-label":"Dimensions",children:d.map((g,y)=>{const w=g.to.length>0;return m.jsxs($.Box,{role:"listitem",sx:{display:"grid",gridTemplateColumns:{xs:"auto minmax(0, 1fr)",sm:"auto minmax(0, 0.9fr) minmax(0, 1.6fr)"},alignItems:"center",columnGap:1.5,rowGap:1,py:1.25,borderTop:y===0?"none":`1px solid ${x}`},children:[m.jsx($.Switch,{size:"small",checked:w,onChange:b=>_(y,b.target.checked),slotProps:{input:{"aria-label":`${g.name} is clickable`}}}),m.jsxs($.Box,{sx:{minWidth:0},children:[m.jsx($.Box,{sx:{...f.type.control,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:cf(g.name)}),m.jsxs($.Box,{title:g.expression,sx:{...f.type.code,color:"text.secondary",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:[g.name," is ",g.expression]})]}),w?m.jsxs($.Stack,{direction:"row",sx:{gridColumn:{xs:"1 / -1",sm:"auto"},alignItems:"center",gap:1,justifyContent:"flex-end",...f.type.control},children:[m.jsx($.Box,{component:"span",sx:{color:"text.secondary"},children:"Opens"}),m.jsx($.TextField,{select:!0,size:"small",value:g.to,inputProps:{"aria-label":`Where ${g.name} goes`},SelectProps:{multiple:!0,renderValue:b=>b.map(p).join(", ")},onChange:b=>u(y,T=>{const C=b.target.value,j=Array.isArray(C)?C:String(C).split(",").filter(Boolean);j.length===0&&(T.lastTo=T.to),T.to=j}),sx:{flex:"1 1 150px",minWidth:0,maxWidth:200},children:h.map(b=>m.jsxs($.MenuItem,{value:b,children:[m.jsx($.Checkbox,{size:"small",checked:g.to.includes(b),sx:{p:0,mr:1}}),m.jsx($.ListItemText,{primary:p(b)})]},b))}),m.jsx($.Box,{component:"span",sx:{color:"text.secondary"},children:"sets"}),m.jsxs($.TextField,{select:!0,size:"small",value:g.given,inputProps:{"aria-label":`Control ${g.name} sets`},SelectProps:{displayEmpty:!0,renderValue:b=>b===""?g.name:String(b)},onChange:b=>u(y,T=>{T.given=b.target.value}),sx:{flex:"1 1 120px",minWidth:0,maxWidth:170},children:[m.jsx($.MenuItem,{value:"",children:m.jsx($.ListItemText,{primary:g.name,secondary:"Named like the dimension"})}),r.map(b=>m.jsx($.MenuItem,{value:b,children:b},b))]})]}):m.jsx($.Typography,{variant:"body2",sx:{color:"text.secondary",textAlign:"right",display:{xs:"none",sm:"block"}},children:"Not clickable"})]},g.name)})})})}function cf(e){const t=e.replace(/_+/g," ").trim();return t.charAt(0).toUpperCase()+t.slice(1)}const df=S.createSvgIcon(m.jsx("path",{d:"M12 4c4.41 0 8 3.59 8 8s-3.59 8-8 8-8-3.59-8-8 3.59-8 8-8m0-2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 13-4-4h8z"})),uf=S.createSvgIcon(m.jsx("path",{d:"M11 7H2v2h9zm0 8H2v2h9zm5.34-4L12.8 7.46l1.41-1.41 2.12 2.12 4.24-4.24L22 5.34zm0 8-3.54-3.54 1.41-1.41 2.12 2.12 4.24-4.24L22 13.34z"})),ff=S.createSvgIcon(m.jsx("path",{d:"M19 4h-1V2h-2v2H8V2H6v2H5c-1.11 0-1.99.9-1.99 2L3 20c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2m0 16H5V10h14zm0-12H5V6h14zm-7 5h5v5h-5z"})),hf=S.createSvgIcon(m.jsx("path",{d:"M19.5 9.5c-1.03 0-1.9.62-2.29 1.5h-2.92c-.39-.88-1.26-1.5-2.29-1.5s-1.9.62-2.29 1.5H6.79c-.39-.88-1.26-1.5-2.29-1.5C3.12 9.5 2 10.62 2 12s1.12 2.5 2.5 2.5c1.03 0 1.9-.62 2.29-1.5h2.92c.39.88 1.26 1.5 2.29 1.5s1.9-.62 2.29-1.5h2.92c.39.88 1.26 1.5 2.29 1.5 1.38 0 2.5-1.12 2.5-2.5s-1.12-2.5-2.5-2.5"})),pf=S.createSvgIcon(m.jsx("path",{d:"M4 9h16v2H4zm0 4h10v2H4z"})),gf=S.createSvgIcon(m.jsx("path",{d:"M3 5v14h18V5zm5.33 12H5V7h3.33zm5.34 0h-3.33v-4h3.33zM19 17h-3.33v-4H19zm0-6h-8.67V7H19z"}));function mf(e,t=[]){const n=new Map;for(const i of e.tiles)for(const o of le(i)?i.filters??[]:[])n.set(o.given,(n.get(o.given)??0)+1);const r=[],s=new Set;for(const i of e.localGivens??[])s.add(i.name),r.push({name:i.name,...i.label===void 0?{}:{label:i.label},type:i.type,...i.suggest?{field:i.suggest.dimension}:{},origin:"dashboard",local:i,boundTiles:n.get(i.name)??0});for(const i of t)s.has(i.name)||(s.add(i.name),r.push({...i,origin:"model",boundTiles:n.get(i.name)??0}));for(const[i,o]of n)s.has(i)||r.push({name:i,origin:"model",boundTiles:o});return r}function Cs(e){if(!(e===void 0||e.startsWith("filter<")))return e==="string"||e==="boolean"?"=":">="}function vf(e){if(e)return/^filter<(.+)>$/.exec(e)?.[1]??e}function yr(e,t){const n=vf(e),r=t?.replace(/_type$/,"");if(!n||!r)return!0;const s=new Set(["date","timestamp"]);return s.has(n)?s.has(r):n===r}function Ai(e){switch(e?.replace(/_type$/,"")){case"string":return"text";case"number":return"a number";case"date":return"a date";case"timestamp":return"a timestamp";case"boolean":return"true or false";default:return e??"an unknown type"}}function yf(e){switch(e?.replace(/_type$/,"")){case"number":return"number";case"date":case"timestamp":return"date";default:return"select"}}const bf=[{op:"~",label:"matches"},{op:"=",label:"equals"},{op:">=",label:"at least"},{op:"<=",label:"at most"},{op:">",label:"more than"},{op:"<",label:"less than"}];function xf(e,t){const r=(e.split(".").at(-1)??"").split(/[^A-Za-z0-9]+/).filter(Boolean).join("_").toUpperCase()||"FILTER",s=/^[A-Z_]/.test(r)?r:`F_${r}`,i=ge.isStrictName(s)?s:`${s}_FILTER`,o=new Set(t);if(!o.has(i))return i;for(let a=2;;a++)if(!o.has(`${i}_${a}`))return`${i}_${a}`}const wf=[{kind:"select",label:"Pick one",hint:"A dropdown of the field's values"},{kind:"multiselect",label:"Pick several",hint:"The same, taking more than one"},{kind:"text",label:"Text",hint:"A box taking Malloy filter syntax"},{kind:"number",label:"Number range",hint:"A slider over the field's values"},{kind:"date",label:"On or after a date",hint:"A date picker; tiles keep rows on or after it"}];function Jn(e){const t=e.label.trim()||e.name,n=e.field;switch(e.kind){case"select":case"multiselect":return{name:e.name,type:"filter<string>",default:"f''",label:t,control:e.kind,...e.source?{suggest:{source:e.source,dimension:n}}:{}};case"text":return{name:e.name,type:"filter<string>",default:"f''",label:t};case"number":return{name:e.name,type:"filter<number>",default:"f''",label:t,...e.range?{rangeMin:e.range.min,rangeMax:e.range.max}:{}};case"date":return{name:e.name,type:"date",default:`@${e.dateDefault??new Date().toISOString().slice(0,10)}`,label:t}}}const Li=e=>le(e)&&e.declaration.kind!=="inherited"&&e.declaration.kind!=="opaque";function _f(e,t){return e.tiles.map(n=>{const r=(le(n)?n.filters??[]:[]).find(s=>s.given===t.name);return{include:r!==void 0,field:r?.field??t.field??t.name.toLowerCase(),...r?.op!==void 0?{op:r.op}:Cs(t.type)!==void 0?{op:Cs(t.type)}:{}}})}function kf(e,t,n){n.forEach((r,s)=>{const i=e.tiles[s];if(!i||!Li(i))return;const o=(i.filters??[]).filter(c=>c.given!==t),a=r.include?[...o,{field:r.field.trim()||t.toLowerCase(),given:t,...r.op&&r.op!=="~"?{op:r.op}:{}}]:o;a.length>0?i.filters=a:delete i.filters})}function Sf(e,t){const n=(e.localGivens??[]).filter(i=>i.name!==t.name),r=(e.localGivens??[]).findIndex(i=>i.name===t.name),s=[...n];s.splice(r>=0?r:s.length,0,t),e.localGivens=s}function $f(e,t){for(const r of e.tiles){if(!le(r))continue;const s=(r.filters??[]).filter(i=>i.given!==t);s.length>0?r.filters=s:delete r.filters}const n=(e.localGivens??[]).filter(r=>r.name!==t);n.length>0?e.localGivens=n:delete e.localGivens}const Bi=e=>e.charAt(0)+e.slice(1).toLowerCase().replace(/_/g," ");function Tf({open:e,document:t,control:n,available:r,takenNames:s=[],fieldsFor:i,onApply:o}){const a=k.useRef(n);e&&(a.current=n);const c=e?n:a.current,f=c!==void 0,[d,l]=k.useState({kind:"new"}),[u,h]=k.useState(""),[p,v]=k.useState("select"),[x,_]=k.useState(""),[g,y]=k.useState(""),[w,b]=k.useState([]),[T,C]=k.useState(!1),[j,D]=k.useState(!1),E=O=>t.sources.find(L=>L.name===O.source)?.base??O.source;k.useEffect(()=>{if(e)if(D(n!==void 0),n){l({kind:"existing",name:n.name}),h(n.label??"");const O=_f(t,n);b(O);const L=O.filter(I=>I.include),N=new Set(L.map(I=>I.field));y(N.size===1?L[0].field:n.field??""),C(N.size>1)}else l({kind:"new"}),h(""),v("select"),y(""),_(new Date().toISOString().slice(0,10)),b(t.tiles.map(O=>({include:Li(O),field:""}))),C(!1)},[e,n,t]);const R=k.useMemo(()=>[...(t.localGivens??[]).map(O=>O.name),...r.map(O=>O.name),...s],[t,r,s]),P=k.useMemo(()=>g.trim()?xf(g.trim(),R):"",[g,R]),A=d.kind==="existing"?n??r.find(O=>O.name===d.name):P?{name:P,type:Jn({name:P,label:u,kind:p,field:g}).type}:void 0,U=A?.type!==void 0&&!A.type.startsWith("filter<"),z=w.find(O=>O.include)?.op??Cs(A?.type),q=(O,L)=>{D(!0),b(N=>N.map((I,V)=>V===O?{...I,...L}:I))},M=O=>{D(!0),b(L=>L.map(N=>({...N,op:O})))},F=O=>{const L=Cs(O);b(N=>N.map(({op:I,...V})=>L?{...V,op:L}:V))},H=O=>{D(!0),l({kind:"existing",name:O.name}),y(O.field??""),F(O.type)},B=O=>{D(!0),v(O),F(Jn({name:"X",label:u,kind:O,field:g}).type)},W=t.tiles.map(Li),Q=W.filter(Boolean).length,J=w.filter((O,L)=>O.include&&W[L]).length,ee=t.tiles.filter((O,L)=>(w[L]?.include??!1)&&W[L]&&le(O)),te=ee.length>0?ee:t.tiles.filter((O,L)=>W[L]&&le(O)),Z=k.useMemo(()=>{const O=new Map;let L=!1;for(const N of te){const I=i?.(N);if(I){L=!0;for(const V of I)O.has(V.name)||O.set(V.name,V)}}return L?[...O.values()]:void 0},[w,t.tiles,i]),xe=(()=>{const O=g.trim();for(const L of ee){const N=i?.(L);if(!N||N.some(I=>I.name===O))return E(L)}return ee[0]?E(ee[0]):t.sources[0]?.base})(),Re=O=>{D(!0),b(L=>L.map((N,I)=>({...N,include:O&&W[I]})))},ue=k.useMemo(()=>T?w:w.map(O=>({...O,field:g})),[T,w,g]),we=O=>{for(const L of te){const N=i?.(L)?.find(I=>I.name===O.trim());if(N?.type)return N.type}},fe=O=>yr(A?.type,O.type),_e=(O,L)=>{if(O.trim()==="")return"Pick the field this filter compares.";const N=L?i?.(L):void 0;if(!N)return;const I=N.find(V=>V.name===O.trim());if(!I)return`Not a field of ${L?E(L):"the tiles' source"}.`;if(I.type&&!yr(A?.type,I.type))return`${O.trim()} is ${Ai(I.type)}; this filter compares ${Ai(A?.type?.replace(/^filter<(.+)>$/,"$1"))}.`},X=O=>{if(D(!0),y(O),f||d.kind!=="new")return;const L=we(O),N=Jn({name:"X",label:u,kind:p,field:O}).type;L&&!yr(N,L)&&B(yf(L))},Ue=O=>{const L=t.tiles[O];return L&&le(L)?L:void 0},he=ue.map((O,L)=>O.include&&W[L]?_e(O.field,Ue(L)):void 0),oe=he.every(O=>O===void 0),Ae=j?he:he.map(()=>{}),ze=j&&!T&&J>0?ee.map(O=>_e(g,O)).find(Boolean):void 0,pe=A!==void 0&&oe&&(d.kind==="existing"||g.trim()!==""&&P!==""),We=()=>{if(!(!A||!pe))if(d.kind==="new")o(A.name,ue,Jn({name:A.name,label:u.trim()||Bi(A.name),kind:p,field:g.trim(),...xe?{source:xe}:{},...x?{dateDefault:x}:{}}));else if(n?.origin==="dashboard"&&n.local){const O=u.trim(),L=O!==(n.local.label??"");o(A.name,ue,L?{...n.local,...O?{label:O}:{}}:void 0)}else o(A.name,ue)},He=f&&c.origin==="model";return{editing:f,shown:c,fromModel:He,source:d,setSource:l,label:u,setLabel:h,kind:p,dateDefault:x,setDateDefault:_,field:g,rows:w,setRows:b,perTile:T,setPerTile:C,newName:P,target:A,valueTyped:U,commonOp:z,setRow:q,setCommonOp:M,pickExisting:H,pickKind:B,bindable:W,bindableCount:Q,included:J,commonFields:Z,setAll:Re,accepts:fe,pickField:X,rowProblems:Ae,commonProblem:ze,canApply:pe,apply:We}}function Ra({value:e,onChange:t,fields:n,accepts:r,label:s,ariaLabel:i,error:o,helperText:a,disabled:c,autoFocus:f,placeholder:d,inputRef:l,sx:u}){const h=k.useMemo(()=>(n??[]).filter(v=>r?.(v)??!0).map(v=>v.name),[n,r]),p=k.useMemo(()=>new Map((n??[]).map(v=>[v.name,v.type])),[n]);return m.jsx($.Autocomplete,{freeSolo:!0,size:"small",options:h,inputValue:e,onInputChange:(v,x)=>t(x),value:e,onChange:(v,x)=>t(typeof x=="string"?x:""),disabled:c,disableClearable:!0,renderOption:(v,x)=>k.createElement("li",{...v,key:x},m.jsx(La,{type:p.get(x)}),m.jsx($.Typography,{variant:"body2",sx:{flex:1,ml:1},children:x})),renderInput:v=>m.jsx($.TextField,{...v,label:s,placeholder:d,autoFocus:f,...l?{inputRef:l}:{},error:o,helperText:a,InputLabelProps:{...v.InputLabelProps,shrink:!0},InputProps:{...v.InputProps,startAdornment:p.get(e.trim())?m.jsx($.Box,{sx:{display:"flex",ml:.5,mr:-.25},children:m.jsx(La,{type:p.get(e.trim())})}):void 0},inputProps:{...v.inputProps,"aria-label":i}}),sx:u})}const Ef=e=>e&&le(e)&&e.declaration.kind==="opaque"?{label:"Not bindable",reason:`Its body is ${e.declaration.why}, so a filter has no single place to go.`}:{label:"From the model",reason:"Declared on its source, which this report does not write."};function Cf({open:e,document:t,control:n,available:r,takenNames:s,fieldsFor:i,onClose:o,onApply:a,onRemove:c}){const{theme:f}=Se.usePublisherTheme(),d=f.ui,{editing:l,shown:u,fromModel:h,source:p,setSource:v,label:x,setLabel:_,kind:g,dateDefault:y,setDateDefault:w,field:b,rows:T,setRows:C,perTile:j,setPerTile:D,newName:E,target:R,valueTyped:P,commonOp:A,setRow:U,setCommonOp:z,pickExisting:q,pickKind:M,bindable:F,bindableCount:H,included:B,commonFields:W,setAll:Q,accepts:J,pickField:ee,rowProblems:te,commonProblem:Z,canApply:xe,apply:Re}=Tf({open:e,document:t,control:n,available:r,...s?{takenNames:s}:{},fieldsFor:i,onApply:a}),ue=k.useRef(null),we=S.edgeColor(f.cardBorder),fe=S.hoverEdgeColor(f.cardBorder,f.tileTitle),[_e,X]=k.useState(!1),[Ue,he]=k.useState(!1);k.useEffect(()=>{e?he(!0):X(!1)},[e]),k.useEffect(()=>{Ue&&(he(!1),X(l&&B<H))},[Ue]),k.useEffect(()=>{j&&X(!0)},[j]);const oe=W?.find(O=>O.name===b.trim())?.type,Ae=O=>{if(!oe)return;const L=Jn({name:"X",label:x,kind:O,field:b}).type;return yr(L,oe)?void 0:`${b.trim()} is ${Ai(oe)}, which this control cannot filter.`},ze=x.trim()||(E?Bi(E):"Filter"),pe=g==="number"?"Any":g==="date"?y?new Date(`${y}T00:00:00`).toLocaleDateString([],{month:"short",day:"numeric",year:"numeric"}):"Any":"All",We={...En(we,d),alignSelf:"flex-start","& .MuiToggleButton-root":{...En(we,d)["& .MuiToggleButton-root"],textTransform:"none"}},He=(O,L,N)=>m.jsx($.TextField,{select:!0,size:"small",label:"Compares",value:O??">=",onChange:I=>L(I.target.value),inputProps:{"aria-label":N},sx:{width:130},children:bf.filter(I=>I.op!=="~").map(I=>m.jsx($.MenuItem,{value:I.op,children:I.label},I.op))});return m.jsx(S.AppDialog,{className:`${S.reportClasses.dialog} ${S.reportClasses.filterDialog}`,open:e,onClose:o,...l?{}:{initialFocus:ue},title:l?u.label??u.name:"Add a filter",description:l?m.jsxs(m.Fragment,{children:[m.jsxs($.Box,{component:"span",sx:{fontFamily:d.font.mono},children:["$",u.name]}),h?" · declared in the model, so its label and options are set there":" · declared in this report"]}):"A filter on the page, and the tiles it filters.",actions:m.jsxs(m.Fragment,{children:[l&&m.jsx($.Button,{color:"error",startIcon:m.jsx(S.DeleteOutlineIcon,{}),onClick:()=>c(u.name),sx:O=>({mr:"auto",color:S.dangerTextColor(O)}),children:"Remove filter"}),m.jsx($.Button,{onClick:o,children:"Cancel"}),m.jsx($.Tooltip,{title:xe||R===void 0?"":"A ticked tile has no field, or names one its source does not have.",children:m.jsx("span",{children:m.jsx($.Button,{variant:"contained",onClick:Re,disabled:!xe,children:l?"Apply":"Add filter"})})})]}),children:m.jsxs($.Stack,{sx:{gap:2.5,pt:1},children:[!l&&r.length>0&&m.jsxs($.ToggleButtonGroup,{exclusive:!0,size:"small",value:p.kind,onChange:(O,L)=>{L==="new"?v({kind:"new"}):L==="existing"&&r[0]&&q(r[0])},"aria-label":"Where the filter comes from",sx:We,children:[m.jsx($.ToggleButton,{value:"new",children:"New in this report"}),m.jsx($.ToggleButton,{value:"existing",children:"From the model"})]}),!l&&p.kind==="existing"?m.jsx($.TextField,{select:!0,size:"small",label:"Filter",value:p.name,onChange:O=>{const L=r.find(N=>N.name===O.target.value);L&&q(L)},children:r.map(O=>m.jsxs($.MenuItem,{value:O.name,children:[O.label??O.name,m.jsxs($.Typography,{component:"span",variant:"caption",sx:{ml:1,opacity:.6},children:["$",O.name]})]},O.name))}):null,m.jsxs($.Box,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",sm:h?"1fr":"minmax(0, 1.4fr) minmax(0, 1fr)"},gap:1.5,alignItems:"start"},children:[!j&&m.jsx(Ra,{value:b,onChange:ee,fields:W,accepts:J,label:"Field",ariaLabel:"Field to filter",placeholder:"category",inputRef:ue,error:Z!==void 0,helperText:Z??(!l&&E?`Declared as $${E}`:void 0)}),!h&&m.jsx($.TextField,{size:"small",label:"Label",placeholder:E?Bi(E):"",value:x,onChange:O=>_(O.target.value),InputLabelProps:{shrink:!0},inputProps:{"aria-label":"Filter label"}})]}),P&&!j&&He(A,z,"Comparison"),!l&&p.kind==="new"&&m.jsxs($.Box,{children:[m.jsx(Aa,{children:"Control"}),m.jsx($.Box,{role:"radiogroup","aria-label":"Filter kind",sx:{display:"grid",gridTemplateColumns:{xs:"repeat(3, minmax(0, 1fr))",sm:"repeat(5, minmax(0, 1fr))"},gap:1},children:wf.map(O=>{const L=O.kind===g,N=Ae(O.kind);return m.jsx($.Tooltip,{title:N??O.hint,describeChild:!0,children:m.jsxs($.ButtonBase,{role:"radio","aria-checked":L,"aria-label":O.label,"aria-disabled":N!==void 0,onClick:()=>{N===void 0&&M(O.kind)},sx:I=>({flexDirection:"column",gap:.5,px:1,py:1.25,borderRadius:d.radius.tile,border:`1px solid ${L?f.accent:we}`,boxShadow:L?`0 0 0 1px ${f.accent}`:"none",bgcolor:L?`color-mix(in srgb, ${f.accent} 6%, ${I.palette.background.paper})`:I.palette.background.paper,color:L?f.accent:I.palette.text.secondary,opacity:N?.45:1,cursor:N?"default":"pointer",transition:`border-color ${S.MOTION_FAST}, background-color ${S.MOTION_FAST}`,"&:hover":N||L?{}:{borderColor:fe}}),children:[m.jsx(Df,{kind:O.kind}),m.jsx($.Box,{component:"span",sx:{...d.type.caption,fontWeight:L?600:500,color:L?f.accent:"text.primary",textAlign:"center"},children:Of[O.kind]})]})},O.kind)})}),g==="date"&&m.jsx($.TextField,{size:"small",type:"date",label:"Starts at",value:y,onChange:O=>w(O.target.value),InputLabelProps:{shrink:!0},sx:{mt:1.5,width:200}})]}),m.jsxs($.Box,{sx:{border:`1px solid ${we}`,borderRadius:d.radius.tile,overflow:"hidden"},children:[m.jsxs($.Stack,{direction:"row",sx:{alignItems:"center",gap:1.25,px:1.5,py:1},children:[m.jsx(gf,{"aria-hidden":!0,sx:{fontSize:18,color:"text.secondary"}}),m.jsxs($.Typography,{variant:"body2",sx:{flex:1,minWidth:0},children:[m.jsx($.Box,{component:"span",sx:{fontWeight:d.type.label.fontWeight},children:B===H&&H>0?`Applies to all ${B} tile${B===1?"":"s"}`:`Applies to ${B} of ${H} tile${H===1?"":"s"}`}),!j&&b.trim()!==""&&B>0&&m.jsxs($.Box,{component:"span",sx:{color:"text.secondary"},children:[" · each filters on ",m.jsx($.Box,{component:"span",sx:{...d.type.code},children:b.trim()})]})]}),!j&&m.jsx($.Button,{size:"small","aria-expanded":_e,onClick:()=>X(O=>!O),children:_e?"Done choosing":"Choose tiles"})]}),m.jsx($.Collapse,{in:_e,unmountOnExit:!0,children:m.jsxs($.Box,{sx:{borderTop:`1px solid ${we}`,px:.5,pb:1},children:[m.jsxs($.Stack,{direction:"row",sx:{alignItems:"center",gap:.5,pt:.5},children:[m.jsx($.Checkbox,{size:"small",checked:H>0&&B===H,indeterminate:B>0&&B<H,disabled:H===0,onChange:O=>Q(O.target.checked),inputProps:{"aria-label":"All tiles"}}),m.jsx($.Typography,{variant:"body2",sx:{flex:1,color:"text.secondary"},children:"All tiles"}),m.jsx($.Button,{size:"small",onClick:()=>{j||C(O=>O.map(L=>({...L,field:b}))),D(O=>!O)},children:j?"Same field for all":"Adjust per tile"})]}),m.jsx($.Stack,{sx:{gap:j?1:0},children:t.tiles.map((O,L)=>{if(!le(O))return null;const N=T[L],I=O.label??O.name,V=j?te[L]:void 0;return m.jsxs($.Stack,{direction:"row",sx:{gap:1,alignItems:j?"flex-start":"center",opacity:F[L]?1:.6},children:[m.jsx($.Checkbox,{size:"small",disabled:!F[L],checked:(N?.include??!1)&&F[L],inputProps:{"aria-label":`Filter ${I}`},onChange:G=>U(L,{include:G.target.checked})}),m.jsx($.Typography,{variant:"body2",sx:{flex:1,minWidth:0,pt:j?1:0},noWrap:!0,children:I}),F[L]?j&&m.jsxs(m.Fragment,{children:[P&&He(N?.op,G=>U(L,{op:G}),`Comparison for ${I}`),m.jsx(Ra,{value:N?.field??"",onChange:G=>U(L,{field:G}),fields:i?.(O),accepts:J,label:"Field",ariaLabel:`Field for ${I}`,disabled:!N?.include,error:V!==void 0,helperText:V,sx:{width:220,pr:1}})]}):m.jsx($.Typography,{variant:"caption",sx:{color:f.tileTitle,pr:1,maxWidth:260,textAlign:"right"},children:Ef(t.tiles[L]).reason})]},`${O.source}.${O.name}`)})})]})})]}),B===0&&m.jsx($.Typography,{variant:"caption",sx:{color:"warning.main",display:"block",mt:-1.5},children:"No tile is ticked, so this control will not appear on the report."}),!h&&m.jsxs($.Box,{children:[m.jsx(Aa,{children:"Preview"}),m.jsx($.Box,{sx:O=>({display:"flex",alignItems:"center",gap:1,p:1.5,borderRadius:d.radius.tile,bgcolor:O.palette.action.hover}),children:m.jsxs($.Box,{"aria-hidden":!0,sx:O=>({display:"inline-flex",alignItems:"center",gap:.75,height:30,px:1.25,borderRadius:d.radius.control,border:`1px solid ${we}`,bgcolor:O.palette.background.paper,...d.type.control}),children:[m.jsx($.Box,{component:"span",sx:{color:"text.secondary"},children:ze}),m.jsx($.Box,{component:"span",sx:{fontWeight:d.type.label.fontWeight},children:pe}),m.jsx(S.ExpandMoreIcon,{sx:{fontSize:16,color:"text.secondary"}})]})})]})]})})}function Aa({children:e}){const t=Se.usePublisherTheme().theme.ui;return m.jsx($.Typography,{component:"div",sx:{...t.type.label,color:"text.secondary",mb:.75},children:e})}const Of={select:"Pick one",multiselect:"Pick several",text:"Text",number:"Range",date:"Date"};function Df({kind:e}){const t={fontSize:22};switch(e){case"select":return m.jsx(df,{sx:t});case"multiselect":return m.jsx(uf,{sx:t});case"text":return m.jsx(pf,{sx:t});case"number":return m.jsx(hf,{sx:t});case"date":return m.jsx(ff,{sx:t})}}function La({type:e}){const t=e?.replace(/_type$/,""),n=t==="string"?"Abc":t==="number"?"#":t==="date"||t==="timestamp"?"Date":t==="boolean"?"T/F":void 0,r=Se.usePublisherTheme().theme.ui;return n?m.jsx($.Box,{component:"span","aria-hidden":!0,sx:s=>({fontFamily:r.font.mono,fontSize:10,fontWeight:r.type.label.fontWeight,color:s.palette.text.secondary,bgcolor:s.palette.action.hover,borderRadius:"4px",px:.5,py:.25,minWidth:22,textAlign:"center",flex:"none"}),children:n}):null}const Mf=S.createSvgIcon(m.jsx("path",{d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"}));function Vl(e,t,n,r){const[s,i]=k.useState(void 0);return k.useEffect(()=>{t&&e!==void 0&&i(structuredClone(e))},[t,e]),{draft:s,patch:d=>i(l=>{if(l===void 0)return l;const u=structuredClone(l);return d(u),u}),apply:d=>{if(s===void 0)return;const l=structuredClone(s);d(l),i(l),JSON.stringify(l)!==JSON.stringify(e)&&n(l)},close:()=>{s!==void 0&&e!==void 0&&JSON.stringify(s)!==JSON.stringify(e)&&n(s),r()},discard:()=>i(void 0)}}const jf=e=>e&&e.length===1?`This tile's chart line (${e[0]}) is not one the builder models, so its chart cannot be changed here.`:`This tile has ${e?.length??"several"} chart lines${e?` (${e.join(" and ")})`:""}, so its chart cannot be changed here.`,If="Declared on its source, so its chart is set in the model.";function Pf({anchor:e,tile:t,onClose:n,onCommit:r,onDrills:s,onDuplicate:i,duplicateBlocked:o,view:a}){const{theme:c}=Se.usePublisherTheme(),f=c.ui,{draft:d,apply:l,close:u}=Vl(t,e!==null,r,n),[h,p]=k.useState(void 0),v=d!==void 0&&le(d)?d:void 0,x=v!==void 0&&v.declaration.kind!=="inherited",_=R=>l(P=>{le(P)&&R(P)}),g=k.useRef(void 0),y=e!==null;k.useEffect(()=>{y?g.current=t&&le(t)?t.chart:void 0:p(void 0)},[y]);const w=v?.chart??"default",b=Nl(a,w),T=v?x?v.chart==="custom"?jf(v.chartLines):void 0:If:void 0,C=R=>_(P=>{const A=g.current;R===(A??"default")?(A===void 0?delete P.chart:P.chart=A,delete P.chartCarried):(P.chart=R,a?P.chartCarried=a.chart?[a.chart]:[]:delete P.chartCarried)}),j=x?s?void 0:"Its source declares no dimension a click could filter by.":void 0,D=R=>P=>p({kind:R,anchor:P.currentTarget}),E=(R,P,A)=>m.jsxs(m.Fragment,{children:[m.jsx($.ListItemText,{primary:R,...A?{secondary:A}:{},secondaryTypographyProps:{sx:{whiteSpace:"normal",maxWidth:240}}}),P&&m.jsx($.Typography,{variant:"body2",sx:{color:"text.secondary",ml:2},children:P})]});return m.jsxs(m.Fragment,{children:[m.jsxs($.Menu,{className:S.reportClasses.menu,open:e!==null&&d!==void 0,anchorEl:e,onClose:u,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},MenuListProps:{dense:!0,disabledItemsFocusable:!0,"aria-label":v?`${v.source} ${v.name}`:"Tile"},slotProps:{paper:{sx:{minWidth:240,mt:.5,borderRadius:f.radius.menu,border:`1px solid ${S.edgeColor(c.cardBorder)}`,boxShadow:f.shadow.menu}}},children:[v&&m.jsxs($.MenuItem,{"aria-haspopup":"menu","aria-expanded":h?.kind==="chart",disabled:T!==void 0,onClick:D("chart"),onKeyDown:R=>{R.key==="ArrowRight"&&T===void 0&&p({kind:"chart",anchor:R.currentTarget})},children:[E("Chart",T?void 0:b.find(R=>R.value===w)?.label,T),m.jsx(Mf,{fontSize:"small",sx:{ml:1,color:"text.secondary"}})]}),x&&m.jsx($.MenuItem,{"aria-haspopup":"dialog",disabled:j!==void 0,onClick:()=>{u(),s?.()},children:E("Clickable cells…",void 0,j)}),v&&i&&m.jsx($.MenuItem,{disabled:o!==void 0,onClick:()=>{u(),i()},children:E("Duplicate",void 0,o)}),v?.declaration.kind==="opaque"&&m.jsxs($.Typography,{variant:"body2",sx:{color:c.tileTitle,px:2,py:.75,maxWidth:260},children:["Its body is ",v.declaration.why,", so a filter has no single place to go."]}),v&&m.jsx($.Divider,{}),v&&m.jsxs($.Box,{"aria-hidden":!0,sx:{px:2,py:.5,...f.type.code,color:"text.secondary"},children:[v.source," → ",v.name]})]}),m.jsx($.Menu,{className:S.reportClasses.menu,open:h?.kind==="chart",anchorEl:h?.anchor??null,onClose:()=>p(void 0),anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"right"},MenuListProps:{dense:!0,disabledItemsFocusable:!0,"aria-label":"Chart",onKeyDown:R=>{R.key==="ArrowLeft"&&(R.preventDefault(),p(void 0))}},children:b.filter(R=>R.value!=="custom").map(R=>m.jsxs($.MenuItem,{role:"menuitemradio","aria-checked":R.value===w,disabled:R.disabled===!0,onClick:()=>{C(R.value),p(void 0)},children:[m.jsx($.ListItemText,{primary:R.label,...R.reason?{secondary:R.reason}:{}}),R.value===w&&m.jsx($.ListItemIcon,{sx:{minWidth:0,ml:2},children:m.jsx(S.CheckIcon,{fontSize:"small",sx:{color:c.accent}})})]},R.value))})]})}const kn=e=>e.label??S.tileTitle(`${e.source} -> ${e.name}`);function Rf({editor:e,catalog:t,columns:n,dashboards:r,bindings:s,tiles:i,drillSource:o,setDrillSource:a,exitDialog:c,renderViewPreview:f,takenGivenNames:d}){const{filterDialog:l,setFilterDialog:u}=s,{menu:h,setMenu:p}=i,[v,x]=k.useState(),_=h===void 0?void 0:e.document.tiles[h.index],g=_&&le(_)?_:void 0,y=(()=>{if(!g||!t)return;const w=e.document.sources.find(T=>T.name===g.source)?.base??g.source,b=g.declaration.kind==="reference"?g.declaration.from:g.name;return t.sources.find(T=>T.name===w)?.views.find(T=>T.name===b)})();return m.jsxs(m.Fragment,{children:[m.jsx(Cf,{open:l!==void 0,document:e.document,...l?.control?{control:l.control}:{},available:s.available,...d?{takenNames:d}:{},...t?{fieldsFor:s.fieldsFor}:{},onClose:()=>u(void 0),onApply:s.applyFilter,onRemove:s.dropControl}),m.jsx(Pf,{anchor:h?.anchor??null,tile:h===void 0?void 0:e.document.tiles[h.index],onClose:()=>p(void 0),onCommit:w=>{const b=h?.index;b!==void 0&&e.update(T=>{T.tiles[b]=w})},view:y,onDuplicate:()=>{h&&i.duplicate(h.index)},...g&&Es(g)!==void 0?{duplicateBlocked:Es(g)}:{},...(e.document.sources.find(w=>w.name===g?.source)?.dimensions?.length??0)>0?{onDrills:()=>{x(g?kn(g):void 0),a(g?.source)}}:{}}),m.jsx(lf,{open:o!==void 0,document:e.document,source:e.document.sources.find(w=>w.name===o),givenNames:s.controlList.map(w=>w.name),dashboards:r??[],...v?{tileLabel:v}:{},onClose:()=>a(void 0),onApply:w=>e.update(b=>{const C=[...(b.drills??[]).filter(j=>j.source!==o),...w];C.length===0?delete b.drills:b.drills=C})}),m.jsx(S.UnsavedChangesDialog,{...c}),m.jsx(sf,{open:i.addingTile,document:e.document,catalog:t,columns:n,onClose:i.closeAdd,onAdd:i.addTile,onAddText:i.addText,...f?{renderPreview:f}:{}})]})}var Af=Symbol.for("preact-signals");function Qs(){if(kt>1)kt--;else{var e,t=!1;for((function(){var s=Ds;for(Ds=void 0;s!==void 0;){var i=s.S;if(i.v===s.v)for(var o=i.t;o!==void 0;o=o.x)o.i===s.i&&(o.i=i.i);s=s.o}})();xr!==void 0;){var n=xr;for(xr=void 0,Os++;n!==void 0;){var r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&Hl(n))try{n.c()}catch(s){t||(e=s,t=!0)}n=r}}if(Os=0,kt--,t)throw e}}function Ee(e){if(kt>0)return e();Fi=++Lf,kt++;try{return e()}finally{Qs()}}var br,ye=void 0;function re(e){var t=ye,n=br;ye=void 0,br=void 0;try{return e()}finally{ye=t,br=n}}var xr=void 0,kt=0,Os=0,Lf=0,Fi=0,Ds=void 0,Ms=0;function Ul(e){if(ye!==void 0){var t=e.n;if(t===void 0||t.t!==ye)return t={i:0,S:e,p:ye.s,n:void 0,t:ye,e:void 0,x:void 0,r:t},ye.s!==void 0&&(ye.s.n=t),ye.s=t,e.n=t,32&ye.f&&e.S(t),t;if(t.i===-1)return t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=ye.s,t.n=void 0,ye.s.n=t,ye.s=t),t}}function Ze(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}Ze.prototype.brand=Af;Ze.prototype.h=function(){return!0};Ze.prototype.S=function(e){var t=this,n=this.t;n!==e&&e.e===void 0&&(e.x=n,this.t=e,n!==void 0?n.e=e:re(function(){var r;(r=t.W)==null||r.call(t)}))};Ze.prototype.U=function(e){var t=this;if(this.t!==void 0){var n=e.e,r=e.x;n!==void 0&&(n.x=r,e.e=void 0),r!==void 0&&(r.e=n,e.x=void 0),e===this.t&&(this.t=r,r===void 0&&re(function(){var s;(s=t.Z)==null||s.call(t)}))}};Ze.prototype.subscribe=function(e){var t=this;return dt(function(){var n=t.value;re(function(){return e(n)})},{name:"sub"})};Ze.prototype.valueOf=function(){return this.value};Ze.prototype.toString=function(){return this.value+""};Ze.prototype.toJSON=function(){return this.value};Ze.prototype.peek=function(){var e=this;return re(function(){return e.value})};Object.defineProperty(Ze.prototype,"value",{get:function(){var e=Ul(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(Os>100)throw new Error("Cycle detected");(function(n){kt!==0&&Os===0&&n.l!==Fi&&(n.l=Fi,Ds={S:n,v:n.v,i:n.i,o:Ds})})(this),this.v=e,this.i++,Ms++,kt++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{Qs()}}}});function Pn(e,t){return new Ze(e,t)}function Hl(e){for(var t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function ql(e){for(var t=e.s;t!==void 0;t=t.n){var n=t.S.n;if(n!==void 0&&(t.r=n),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function Kl(e){for(var t=e.s,n=void 0;t!==void 0;){var r=t.p;t.i===-1?(t.S.U(t),r!==void 0&&(r.n=t.n),t.n!==void 0&&(t.n.p=r)):n=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=r}e.s=n}function Jt(e,t){Ze.call(this,void 0,t),this.x=e,this.s=void 0,this.g=Ms-1,this.f=4}Jt.prototype=new Ze;Jt.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Ms))return!0;if(this.g=Ms,this.f|=1,this.i>0&&!Hl(this))return this.f&=-2,!0;var e=ye;try{ql(this),ye=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(n){this.v=n,this.f|=16,this.i++}return ye=e,Kl(this),this.f&=-2,!0};Jt.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var t=this.s;t!==void 0;t=t.n)t.S.S(t)}Ze.prototype.S.call(this,e)};Jt.prototype.U=function(e){if(this.t!==void 0&&(Ze.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(var t=this.s;t!==void 0;t=t.n)t.S.U(t)}};Jt.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;e!==void 0;e=e.x)e.t.N()}};Object.defineProperty(Jt.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=Ul(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function Ba(e,t){return new Jt(e,t)}function Yl(e){var t=e.m;if(e.m=void 0,typeof t=="function"){kt++;var n=ye;ye=void 0;try{t()}catch(r){throw e.f&=-2,e.f|=8,To(e),r}finally{ye=n,Qs()}}}function To(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Yl(e)}function Bf(e){if(ye!==this)throw new Error("Out-of-order effect");Kl(this),ye=e,this.f&=-2,8&this.f&&To(this),Qs()}function Rn(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,br&&br.push(this)}Rn.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var t=this.x();typeof t=="function"&&(this.m=t)}finally{e()}};Rn.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Yl(this),ql(this),kt++;var e=ye;return ye=this,Bf.bind(this,e)};Rn.prototype.N=function(){2&this.f||(this.f|=2,this.u=xr,xr=this)};Rn.prototype.d=function(){this.f|=8,1&this.f||To(this)};Rn.prototype.dispose=function(){this.d()};function dt(e,t){var n=new Rn(e,t);try{n.c()}catch(s){throw n.d(),s}var r=n.d.bind(n);return r[Symbol.dispose]=r,r}var Ff=Object.create,Eo=Object.defineProperty,zf=Object.defineProperties,Wf=Object.getOwnPropertyDescriptor,Nf=Object.getOwnPropertyDescriptors,Fa=Object.getOwnPropertySymbols,Gf=Object.prototype.hasOwnProperty,Vf=Object.prototype.propertyIsEnumerable,Uf=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),An=e=>{throw TypeError(e)},zi=(e,t,n)=>t in e?Eo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Hf=(e,t)=>{for(var n in t||(t={}))Gf.call(t,n)&&zi(e,n,t[n]);if(Fa)for(var n of Fa(t))Vf.call(t,n)&&zi(e,n,t[n]);return e},qf=(e,t)=>zf(e,Nf(t)),za=(e,t)=>Eo(e,"name",{value:t,configurable:!0}),Kf=e=>{var t;return[,,,Ff((t=void 0)!=null?t:null)]},Xl=["class","method","getter","setter","accessor","field","value","get","set"],er=e=>e!==void 0&&typeof e!="function"?An("Function expected"):e,Yf=(e,t,n,r,s)=>({kind:Xl[e],name:t,metadata:r,addInitializer:i=>n._?An("Already initialized"):s.push(er(i||null))}),Ql=(e,t)=>zi(t,Uf("metadata"),e[3]),Ft=(e,t,n,r)=>{for(var s=0,i=e[t>>1],o=i&&i.length;s<o;s++)t&1?i[s].call(n):r=i[s].call(n,r);return r},Ln=(e,t,n,r,s,i)=>{var o,a,c,f,d,l=t&7,u=!!(t&8),h=!!(t&16),p=l>3?e.length+1:l?u?1:2:0,v=Xl[l+5],x=l>3&&(e[p-1]=[]),_=e[p]||(e[p]=[]),g=l&&(!h&&!u&&(s=s.prototype),l<5&&(l>3||!h)&&Wf(l<4?s:{get[n](){return it(this,i)},set[n](w){return Mt(this,i,w)}},n));l?h&&l<4&&za(i,(l>2?"set ":l>1?"get ":"")+n):za(s,n);for(var y=r.length-1;y>=0;y--)f=Yf(l,n,c={},e[3],_),l&&(f.static=u,f.private=h,d=f.access={has:h?w=>Xf(s,w):w=>n in w},l^3&&(d.get=h?w=>(l^1?it:Qf)(w,s,l^4?i:g.get):w=>w[n]),l>2&&(d.set=h?(w,b)=>Mt(w,s,b,l^4?i:g.set):(w,b)=>w[n]=b)),a=(0,r[y])(l?l<4?h?i:g[v]:l>4?void 0:{get:g.get,set:g.set}:s,f),c._=1,l^4||a===void 0?er(a)&&(l>4?x.unshift(a):l?h?i=a:g[v]=a:s=a):typeof a!="object"||a===null?An("Object expected"):(er(o=a.get)&&(g.get=o),er(o=a.set)&&(g.set=o),er(o=a.init)&&x.unshift(o));return l||Ql(e,s),g&&Eo(s,n,g),h?l^4?i:g:s},Co=(e,t,n)=>t.has(e)||An("Cannot "+n),Xf=(e,t)=>Object(t)!==t?An('Cannot use the "in" operator on this value'):e.has(t),it=(e,t,n)=>(Co(e,t,"read from private field"),n?n.call(e):t.get(e)),tr=(e,t,n)=>t.has(e)?An("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Mt=(e,t,n,r)=>(Co(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),Qf=(e,t,n)=>(Co(e,t,"access private method"),n);function Wi(e,t){if(t){let n;return Ba(()=>{const r=e();return r&&n&&t(n,r)?n:(n=r,r)})}return Ba(e)}function ft(e,t){if(Object.is(e,t))return!0;if(e===null||t===null)return!1;if(typeof e=="function"&&typeof t=="function")return e===t;if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}if(Array.isArray(e))return!Array.isArray(t)||e.length!==t.length?!1:!e.some((r,s)=>!ft(r,t[s]));if(typeof e=="object"&&typeof t=="object"){const n=Object.keys(e),r=Object.keys(t);return n.length!==r.length?!1:!n.some(i=>!ft(e[i],t[i]))}return!1}function se({get:e},t){return{init(n){return Pn(n)},get(){return e.call(this).value},set(n){const r=e.call(this);r.peek()!==n&&(r.value=n)}}}function Oe(e,t){const n=new WeakMap;return function(){let r=n.get(this);return r||(r=Wi(e.bind(this)),n.set(this,r)),r.value}}function hi(e=!0){return function(t,n){n.addInitializer(function(){const r=n.kind==="field"?this:n.static?this:Object.getPrototypeOf(this),s=Object.getOwnPropertyDescriptor(r,n.name);s&&Object.defineProperty(r,n.name,qf(Hf({},s),{enumerable:e}))})}}function Lr(...e){const t=e.map(n=>dt(n));return()=>t.forEach(n=>n())}var Zl,Jl,ec,tc,nc,rc,Ye,Oo,pi,Ni,Gi,qe,Do,gi,sc,Vi,Mo,mi,Ui,Hi;rc=[se],nc=[se],tc=[se],ec=[hi()],Jl=[hi()],Zl=[hi()];var en=class{constructor(e,t=Object.is){this.defaultValue=e,this.equals=t,Ft(Ye,5,this),tr(this,qe),tr(this,Oo,Ft(Ye,8,this)),Ft(Ye,11,this),tr(this,Do,Ft(Ye,12,this)),Ft(Ye,15,this),tr(this,Mo,Ft(Ye,16,this)),Ft(Ye,19,this),this.reset=this.reset.bind(this),this.reset()}get current(){return it(this,qe,Ui)}get initial(){return it(this,qe,Ni)}get previous(){return it(this,qe,sc)}set current(e){const t=re(()=>it(this,qe,Ui));e&&t&&this.equals(t,e)||Ee(()=>{it(this,qe,Ni)||Mt(this,qe,e,Gi),Mt(this,qe,t,Vi),Mt(this,qe,e,Hi)})}reset(e=this.defaultValue){Ee(()=>{Mt(this,qe,void 0,Vi),Mt(this,qe,e,Gi),Mt(this,qe,e,Hi)})}};Ye=Kf();Oo=new WeakMap;qe=new WeakSet;Do=new WeakMap;Mo=new WeakMap;pi=Ln(Ye,20,"#initial",rc,qe,Oo),Ni=pi.get,Gi=pi.set;gi=Ln(Ye,20,"#previous",nc,qe,Do),sc=gi.get,Vi=gi.set;mi=Ln(Ye,20,"#current",tc,qe,Mo),Ui=mi.get,Hi=mi.set;Ln(Ye,2,"current",ec,en);Ln(Ye,2,"initial",Jl,en);Ln(Ye,2,"previous",Zl,en);Ql(Ye,en);function vi(e){return re(()=>{const t={};for(const n in e)t[n]=e[n];return t})}var zt,Zf=class{constructor(){tr(this,zt,new WeakMap)}get(e,t){var n;return e?(n=it(this,zt).get(e))==null?void 0:n.get(t):void 0}set(e,t,n){var r;if(e)return it(this,zt).has(e)||it(this,zt).set(e,new Map),(r=it(this,zt).get(e))==null?void 0:r.set(t,n)}clear(e){var t;return e?(t=it(this,zt).get(e))==null?void 0:t.clear():void 0}};zt=new WeakMap;var Jf=Object.create,ic=Object.defineProperty,eh=Object.getOwnPropertyDescriptor,Wa=Object.getOwnPropertySymbols,th=Object.prototype.hasOwnProperty,nh=Object.prototype.propertyIsEnumerable,oc=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),Zs=e=>{throw TypeError(e)},Na=Math.pow,qi=(e,t,n)=>t in e?ic(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,rh=(e,t)=>{for(var n in t||(t={}))th.call(t,n)&&qi(e,n,t[n]);if(Wa)for(var n of Wa(t))nh.call(t,n)&&qi(e,n,t[n]);return e},sh=e=>{var t;return[,,,Jf((t=e?.[oc("metadata")])!=null?t:null)]},ac=["class","method","getter","setter","accessor","field","value","get","set"],lc=e=>e!==void 0&&typeof e!="function"?Zs("Function expected"):e,ih=(e,t,n,r,s)=>({kind:ac[e],name:t,metadata:r,addInitializer:i=>n._?Zs("Already initialized"):s.push(lc(i||null))}),oh=(e,t)=>qi(t,oc("metadata"),e[3]),ah=(e,t,n,r)=>{for(var s=0,i=e[t>>1],o=i&&i.length;s<o;s++)i[s].call(n);return r},cc=(e,t,n,r,s,i)=>{for(var o,a,c,f,d=t&7,l=!1,u=!1,h=2,p=ac[d+5],v=e[h]||(e[h]=[]),x=(s=s.prototype,eh(s,n)),_=r.length-1;_>=0;_--)c=ih(d,n,a={},e[3],v),c.static=l,c.private=u,f=c.access={has:g=>n in g},f.get=g=>g[n],o=(0,r[_])(x[p],c),a._=1,lc(o)&&(x[p]=o);return x&&ic(s,n,x),s},dc=(e,t,n)=>t.has(e)||Zs("Cannot "+n),lh=(e,t,n)=>(dc(e,t,"read from private field"),t.get(e)),ch=(e,t,n)=>t.has(e)?Zs("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),dh=(e,t,n,r)=>(dc(e,t,"write to private field"),t.set(e,n),n),ot=class Ki{constructor(t,n){this.x=t,this.y=n}static delta(t,n){return new Ki(t.x-n.x,t.y-n.y)}static distance(t,n){return Math.hypot(t.x-n.x,t.y-n.y)}static equals(t,n){return t.x===n.x&&t.y===n.y}static from({x:t,y:n}){return new Ki(t,n)}},bt=class Wt{constructor(t,n,r,s){this.left=t,this.top=n,this.width=r,this.height=s,this.scale={x:1,y:1}}get inverseScale(){return{x:1/this.scale.x,y:1/this.scale.y}}translate(t,n){const{top:r,left:s,width:i,height:o,scale:a}=this,c=new Wt(s+t,r+n,i,o);return c.scale=rh({},a),c}get boundingRectangle(){const{width:t,height:n,left:r,top:s,right:i,bottom:o}=this;return{width:t,height:n,left:r,top:s,right:i,bottom:o}}get center(){const{left:t,top:n,right:r,bottom:s}=this;return new ot((t+r)/2,(n+s)/2)}get area(){const{width:t,height:n}=this;return t*n}equals(t){if(!(t instanceof Wt))return!1;const{left:n,top:r,width:s,height:i}=this;return n===t.left&&r===t.top&&s===t.width&&i===t.height}containsPoint(t){const{top:n,left:r,bottom:s,right:i}=this;return n<=t.y&&t.y<=s&&r<=t.x&&t.x<=i}intersectionArea(t){return t instanceof Wt?uh(this,t):0}intersectionRatio(t){const{area:n}=this,r=this.intersectionArea(t);return r/(t.area+n-r)}get bottom(){const{top:t,height:n}=this;return t+n}get right(){const{left:t,width:n}=this;return t+n}get aspectRatio(){const{width:t,height:n}=this;return t/n}get corners(){return[{x:this.left,y:this.top},{x:this.right,y:this.top},{x:this.left,y:this.bottom},{x:this.right,y:this.bottom}]}static from({top:t,left:n,width:r,height:s}){return new Wt(n,t,r,s)}static delta(t,n,r={x:"center",y:"center"}){const s=(i,o)=>{const a=r[o],c=o==="x"?i.left:i.top,f=o==="x"?i.width:i.height;return a=="start"?c:a=="end"?c+f:c+f/2};return ot.delta({x:s(t,"x"),y:s(t,"y")},{x:s(n,"x"),y:s(n,"y")})}static intersectionRatio(t,n){return Wt.from(t).intersectionRatio(Wt.from(n))}};function uh(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),s=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),o=s-r,a=i-n;return r<s&&n<i?o*a:0}var uc,fc,Yi,fs,Br,Js=class extends(Yi=en,fc=[Oe],uc=[Oe],Yi){constructor(t){const n=ot.from(t);super(n,(r,s)=>ot.equals(r,s)),ah(Br,5,this),ch(this,fs,0),this.velocity={x:0,y:0}}get delta(){return ot.delta(this.current,this.initial)}get direction(){const{current:t,previous:n}=this;if(!n)return null;const r={x:t.x-n.x,y:t.y-n.y};return!r.x&&!r.y?null:Math.abs(r.x)>Math.abs(r.y)?r.x>0?"right":"left":r.y>0?"down":"up"}get current(){return super.current}set current(t){const{current:n}=this,r=ot.from(t),s={x:r.x-n.x,y:r.y-n.y},i=Date.now(),o=i-lh(this,fs),a=c=>Math.round(c/o*100);Ee(()=>{dh(this,fs,i),this.velocity={x:a(s.x),y:a(s.y)},super.current=r})}reset(t=this.defaultValue){super.reset(ot.from(t)),this.velocity={x:0,y:0}}};Br=sh(Yi);fs=new WeakMap;cc(Br,2,"delta",fc,Js);cc(Br,2,"direction",uc,Js);oh(Br,Js);function Xi({x:e,y:t},n){const r=Math.abs(e),s=Math.abs(t);return typeof n=="number"?Math.sqrt(Na(r,2)+Na(s,2))>n:"x"in n&&"y"in n?r>n.x&&s>n.y:"x"in n?r>n.x:"y"in n?s>n.y:!1}var hc=(e=>(e.Horizontal="x",e.Vertical="y",e))(hc||{}),pc=Object.values(hc),fh=Object.create,jo=Object.defineProperty,hh=Object.defineProperties,ph=Object.getOwnPropertyDescriptor,gh=Object.getOwnPropertyDescriptors,js=Object.getOwnPropertySymbols,gc=Object.prototype.hasOwnProperty,mc=Object.prototype.propertyIsEnumerable,vc=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),Bn=e=>{throw TypeError(e)},Qi=(e,t,n)=>t in e?jo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Io=(e,t)=>{for(var n in t||(t={}))gc.call(t,n)&&Qi(e,n,t[n]);if(js)for(var n of js(t))mc.call(t,n)&&Qi(e,n,t[n]);return e},Po=(e,t)=>hh(e,gh(t)),Ga=(e,t)=>jo(e,"name",{value:t,configurable:!0}),yc=(e,t)=>{var n={};for(var r in e)gc.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&js)for(var r of js(e))t.indexOf(r)<0&&mc.call(e,r)&&(n[r]=e[r]);return n},Fn=e=>{var t;return[,,,fh((t=e?.[vc("metadata")])!=null?t:null)]},bc=["class","method","getter","setter","accessor","field","value","get","set"],nr=e=>e!==void 0&&typeof e!="function"?Bn("Function expected"):e,mh=(e,t,n,r,s)=>({kind:bc[e],name:t,metadata:r,addInitializer:i=>n._?Bn("Already initialized"):s.push(nr(i||null))}),tn=(e,t)=>Qi(t,vc("metadata"),e[3]),Y=(e,t,n,r)=>{for(var s=0,i=e[t>>1],o=i&&i.length;s<o;s++)t&1?i[s].call(n):r=i[s].call(n,r);return r},ie=(e,t,n,r,s,i)=>{var o,a,c,f,d,l=t&7,u=!!(t&8),h=!!(t&16),p=l>3?e.length+1:l?u?1:2:0,v=bc[l+5],x=l>3&&(e[p-1]=[]),_=e[p]||(e[p]=[]),g=l&&(!h&&!u&&(s=s.prototype),l<5&&(l>3||!h)&&ph(l<4?s:{get[n](){return Ce(this,i)},set[n](w){return rt(this,i,w)}},n));l?h&&l<4&&Ga(i,(l>2?"set ":l>1?"get ":"")+n):Ga(s,n);for(var y=r.length-1;y>=0;y--)f=mh(l,n,c={},e[3],_),l&&(f.static=u,f.private=h,d=f.access={has:h?w=>vh(s,w):w=>n in w},l^3&&(d.get=h?w=>(l^1?Ce:xc)(w,s,l^4?i:g.get):w=>w[n]),l>2&&(d.set=h?(w,b)=>rt(w,s,b,l^4?i:g.set):(w,b)=>w[n]=b)),a=(0,r[y])(l?l<4?h?i:g[v]:l>4?void 0:{get:g.get,set:g.set}:s,f),c._=1,l^4||a===void 0?nr(a)&&(l>4?x.unshift(a):l?h?i=a:g[v]=a:s=a):typeof a!="object"||a===null?Bn("Object expected"):(nr(o=a.get)&&(g.get=o),nr(o=a.set)&&(g.set=o),nr(o=a.init)&&x.unshift(o));return l||tn(e,s),g&&jo(s,n,g),h?l^4?i:g:s},Ro=(e,t,n)=>t.has(e)||Bn("Cannot "+n),vh=(e,t)=>Object(t)!==t?Bn('Cannot use the "in" operator on this value'):e.has(t),Ce=(e,t,n)=>(Ro(e,t,"read from private field"),n?n.call(e):t.get(e)),de=(e,t,n)=>t.has(e)?Bn("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),rt=(e,t,n,r)=>(Ro(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),xc=(e,t,n)=>(Ro(e,t,"access private method"),n);function wc(e,t){return{plugin:e,options:t}}function Fr(e){return t=>wc(e,t)}function Tr(e){return typeof e=="function"?{plugin:e,options:void 0}:e}var _c,Er,Ao,hs;_c=[se];var Ke=class{constructor(e,t){this.manager=e,this.options=t,de(this,Ao,Y(Er,8,this,!1)),Y(Er,11,this),de(this,hs,new Set)}enable(){this.disabled=!1}disable(){this.disabled=!0}isDisabled(){return re(()=>this.disabled)}configure(e){this.options=e}registerEffect(e){const t=dt(e.bind(this));return Ce(this,hs).add(t),t}destroy(){Ce(this,hs).forEach(e=>e())}static configure(e){return wc(this,e)}};Er=Fn(null);Ao=new WeakMap;hs=new WeakMap;ie(Er,4,"disabled",_c,Ke,Ao);tn(Er,Ke);var zr=class extends Ke{},ps,yi=class{constructor(e){this.manager=e,this.instances=new Map,de(this,ps,[])}get values(){return Array.from(this.instances.values())}set values(e){const t=e.map(Tr).reduce((r,s)=>{const i=r.find(({plugin:o})=>o===s.plugin);return i?(i.options=s.options,r):[...r,s]},[]),n=t.map(({plugin:r})=>r);for(const r of Ce(this,ps))if(!n.includes(r)){if(r.prototype instanceof zr)continue;this.unregister(r)}for(const{plugin:r,options:s}of t)this.register(r,s);rt(this,ps,n)}get(e){return this.instances.get(e)}register(e,t){const n=this.instances.get(e);if(n)return n.options!==t&&(n.options=t),n;const r=new e(this.manager,t);return this.instances.set(e,r),r}unregister(e){const t=this.instances.get(e);t&&(t.destroy(),this.instances.delete(e))}destroy(){for(const e of this.instances.values())e.destroy();this.instances.clear()}};ps=new WeakMap;function yh(e,t){return e.priority===t.priority?e.type===t.type?t.value-e.value:t.type-e.type:t.priority-e.priority}var ts=[],hn,pn,bh=class extends Ke{constructor(e){super(e),de(this,hn),de(this,pn),this.computeCollisions=this.computeCollisions.bind(this),rt(this,pn,Pn(ts)),this.destroy=Lr(()=>{const t=this.computeCollisions(),n=re(()=>this.manager.dragOperation.position.current);if(t!==ts){const r=Ce(this,hn);if(rt(this,hn,n),r&&n.x==r.x&&n.y==r.y)return}else rt(this,hn,void 0);Ce(this,pn).value=t},()=>{const{dragOperation:t}=this.manager;t.status.initialized&&this.forceUpdate()})}forceUpdate(e=!0){re(()=>{e?Ce(this,pn).value=this.computeCollisions():rt(this,hn,void 0)})}computeCollisions(e,t){const{registry:n,dragOperation:r}=this.manager,{source:s,shape:i,status:o}=r;if(!o.initialized||!i)return ts;const a=[],c=[];for(const f of e??n.droppables){if(f.disabled||s&&!f.accepts(s))continue;const d=t??f.collisionDetector;if(!d)continue;c.push(f),f.shape;const l=re(()=>d({droppable:f,dragOperation:r}));l&&(f.collisionPriority!=null&&(l.priority=f.collisionPriority),a.push(l))}return c.length===0?ts:(a.sort(yh),a)}get collisions(){return Ce(this,pn).value}};hn=new WeakMap;pn=new WeakMap;var kc,Sc,$c,Lo,Tc,ht,Bo,xn,Fo,zo;$c=[se],Sc=[se],kc=[se];var $t=class Nt{constructor(t,n){de(this,Bo,Y(ht,8,this)),Y(ht,11,this),de(this,xn),de(this,Fo,Y(ht,12,this)),Y(ht,15,this),de(this,zo,Y(ht,16,this)),Y(ht,19,this);const{effects:r,id:s,data:i={},disabled:o=!1,register:a=!0}=t;let c=s;rt(this,xn,Pn(s)),this.manager=n,this.data=i,this.disabled=o,this.effects=()=>{var f;return[()=>{const{id:d,manager:l}=this;if(d!==c)return c=d,l?.registry.register(this),()=>l?.registry.unregister(this)},...(f=r?.())!=null?f:[]]},this.register=this.register.bind(this),this.unregister=this.unregister.bind(this),this.destroy=this.destroy.bind(this),n&&a&&queueMicrotask(this.register)}get id(){var t,n;const r=Ce(this,xn).value;return(n=(t=Nt.pendingIdChanges)==null?void 0:t.get(this))!=null?n:r}set id(t){var n,r;const s=(r=(n=Nt.pendingIdChanges)==null?void 0:n.get(this))!=null?r:Ce(this,xn).peek();t!==s&&(Nt.pendingIdChanges||(Nt.pendingIdChanges=new Map,queueMicrotask(()=>{var i;return xc(i=Nt,Lo,Tc).call(i)})),Nt.pendingIdChanges.set(this,t))}register(){var t;return(t=this.manager)==null?void 0:t.registry.register(this)}unregister(){var t;(t=this.manager)==null||t.registry.unregister(this)}destroy(){var t;(t=this.manager)==null||t.registry.unregister(this)}};ht=Fn(null);Lo=new WeakSet;Tc=function(){const e=$t.pendingIdChanges;$t.pendingIdChanges=null,e&&Ee(()=>{for(const[t,n]of e)Ce(t,xn).value=n})};Bo=new WeakMap;xn=new WeakMap;Fo=new WeakMap;zo=new WeakMap;ie(ht,4,"manager",$c,$t,Bo);ie(ht,4,"data",Sc,$t,Fo);ie(ht,4,"disabled",kc,$t,zo);de($t,Lo);tn(ht,$t);$t.pendingIdChanges=null;var ei=$t,Va=class{constructor(){this.map=Pn(new Map),this.cleanupFunctions=new WeakMap,this.register=(e,t)=>{const n=this.map.peek(),r=n.get(e),s=()=>this.unregister(e,t);if(r===t)return s;if(r&&r.id===e){const a=this.cleanupFunctions.get(r);a?.(),this.cleanupFunctions.delete(r)}const i=new Map(n);for(const[a,c]of n)if(c===t&&a!==e){i.delete(a);break}i.set(e,t),this.map.value=i;const o=Lr(...t.effects());return this.cleanupFunctions.set(t,o),s},this.unregister=(e,t)=>{const n=this.map.peek();if(n.get(e)!==t)return;const r=this.cleanupFunctions.get(t);r?.(),this.cleanupFunctions.delete(t);const s=new Map(n);s.delete(e),this.map.value=s}}[Symbol.iterator](){return this.map.peek().values()}get value(){return this.map.value.values()}has(e){return this.map.value.has(e)}get(e){return this.map.value.get(e)}destroy(){for(const e of this){const t=this.cleanupFunctions.get(e);t?.(),e.destroy()}this.map.value=new Map}},Ec,Cc,Oc,Dc,Mc,jc,Zi,Xe,Wo,No,Go,xt=class extends(Zi=ei,jc=[se],Mc=[se],Dc=[se],Oc=[Oe],Cc=[Oe],Ec=[Oe],Zi){constructor(t,n){var r=t,{modifiers:s,type:i,sensors:o,plugins:a,effects:c}=r,f=yc(r,["modifiers","type","sensors","plugins","effects"]);super(Po(Io({},f),{effects:()=>{var d;return[...(d=c?.())!=null?d:[],()=>{const{manager:l,plugins:u}=this;if(!(!l||!u))for(const h of u){const{plugin:p}=Tr(h);l.registry.plugins.register(p)}}]}}),n),Y(Xe,5,this),de(this,Wo,Y(Xe,8,this)),Y(Xe,11,this),de(this,No,Y(Xe,12,this)),Y(Xe,15,this),de(this,Go,Y(Xe,16,this,this.isDragSource?"dragging":"idle")),Y(Xe,19,this),this.type=i,this.sensors=o,this.modifiers=s,this.alignment=f.alignment,this.plugins=a}pluginConfig(t){if(this.plugins)for(const n of this.plugins){const r=Tr(n);if(r.plugin===t)return r.options}}get isDropping(){return this.status==="dropping"&&this.isDragSource}get isDragging(){return this.status==="dragging"&&this.isDragSource}get isDragSource(){var t,n;return((n=(t=this.manager)==null?void 0:t.dragOperation.source)==null?void 0:n.id)===this.id}};Xe=Fn(Zi);Wo=new WeakMap;No=new WeakMap;Go=new WeakMap;ie(Xe,4,"type",jc,xt,Wo);ie(Xe,4,"modifiers",Mc,xt,No);ie(Xe,4,"status",Dc,xt,Go);ie(Xe,2,"isDropping",Oc,xt);ie(Xe,2,"isDragging",Cc,xt);ie(Xe,2,"isDragSource",Ec,xt);tn(Xe,xt);var Ic,Pc,Rc,Ac,Lc,Bc,Ji,Le,Vo,Uo,Ho,qo,Ko,wt=class extends(Ji=ei,Bc=[se],Lc=[se],Ac=[se],Rc=[se],Pc=[se],Ic=[Oe],Ji){constructor(t,n){var r=t,{accept:s,collisionDetector:i,collisionPriority:o,type:a}=r,c=yc(r,["accept","collisionDetector","collisionPriority","type"]);super(c,n),Y(Le,5,this),de(this,Vo,Y(Le,8,this)),Y(Le,11,this),de(this,Uo,Y(Le,12,this)),Y(Le,15,this),de(this,Ho,Y(Le,16,this)),Y(Le,19,this),de(this,qo,Y(Le,20,this)),Y(Le,23,this),de(this,Ko,Y(Le,24,this)),Y(Le,27,this),this.accept=s,this.collisionDetector=i,this.collisionPriority=o,this.type=a}accepts(t){const{accept:n}=this;return n?typeof n=="function"?n(t):t.type?Array.isArray(n)?n.includes(t.type):t.type===n:!1:!0}get isDropTarget(){var t,n;return((n=(t=this.manager)==null?void 0:t.dragOperation.target)==null?void 0:n.id)===this.id}};Le=Fn(Ji);Vo=new WeakMap;Uo=new WeakMap;Ho=new WeakMap;qo=new WeakMap;Ko=new WeakMap;ie(Le,4,"accept",Bc,wt,Vo);ie(Le,4,"type",Lc,wt,Uo);ie(Le,4,"collisionDetector",Ac,wt,Ho);ie(Le,4,"collisionPriority",Rc,wt,qo);ie(Le,4,"shape",Pc,wt,Ko);ie(Le,2,"isDropTarget",Ic,wt);tn(Le,wt);var xh=class{constructor(){this.registry=new Map}addEventListener(e,t){const{registry:n}=this,r=new Set(n.get(e));return r.add(t),n.set(e,r),()=>this.removeEventListener(e,t)}removeEventListener(e,t){const{registry:n}=this,r=new Set(n.get(e));r.delete(t),n.set(e,r)}dispatch(e,...t){const{registry:n}=this,r=n.get(e);if(r)for(const s of r)s(...t)}},wh=class extends xh{constructor(e){super(),this.manager=e}dispatch(e,t){const n=[t,this.manager];super.dispatch(e,...n)}};function gs(e,t=!0){let n=!1;return Po(Io({},e),{cancelable:t,get defaultPrevented(){return n},preventDefault(){t&&(n=!0)}})}var _h=class extends zr{constructor(e){super(e);const t=(r,s)=>r.map(({id:i})=>i).join("")===s.map(({id:i})=>i).join("");let n=[];this.destroy=Lr(()=>{const{dragOperation:r,collisionObserver:s}=e;r.status.initializing&&(n=[],s.enable())},()=>{const{collisionObserver:r,monitor:s}=e,{collisions:i}=r;if(r.isDisabled()||ei.pendingIdChanges)return;const o=gs({collisions:i});if(s.dispatch("collision",o),o.defaultPrevented||t(i,n))return;n=i;const[a]=i;re(()=>{var c;a?.id!==((c=e.dragOperation.target)==null?void 0:c.id)&&(r.disable(),e.actions.setDropTarget(a?.id).then(()=>{r.enable()}))})})}},zn=(e=>(e[e.Lowest=0]="Lowest",e[e.Low=1]="Low",e[e.Normal=2]="Normal",e[e.High=3]="High",e[e.Highest=4]="Highest",e))(zn||{}),Wn=(e=>(e[e.Collision=0]="Collision",e[e.ShapeIntersection=1]="ShapeIntersection",e[e.PointerIntersection=2]="PointerIntersection",e))(Wn||{}),Fc,zc,Wc,Nc,Gc,Vc,Uc,ct,Yo;Uc=[se],Vc=[Oe],Gc=[Oe],Nc=[Oe],Wc=[Oe],zc=[Oe],Fc=[Oe];var Et=class{constructor(){Y(ct,5,this),de(this,Yo,Y(ct,8,this,"idle")),Y(ct,11,this)}get current(){return this.value}get idle(){return this.value==="idle"}get initializing(){return this.value==="initializing"}get initialized(){const{value:e}=this;return e!=="idle"&&e!=="initialization-pending"}get dragging(){return this.value==="dragging"}get dropped(){return this.value==="dropped"}set(e){this.value=e}};ct=Fn(null);Yo=new WeakMap;ie(ct,4,"value",Uc,Et,Yo);ie(ct,2,"current",Vc,Et);ie(ct,2,"idle",Gc,Et);ie(ct,2,"initializing",Nc,Et);ie(ct,2,"initialized",Wc,Et);ie(ct,2,"dragging",zc,Et);ie(ct,2,"dropped",Fc,Et);tn(ct,Et);var kh=class{constructor(e){this.manager=e}setDragSource(e){const{dragOperation:t}=this.manager;t.sourceIdentifier=typeof e=="string"||typeof e=="number"?e:e.id}setDropTarget(e){return re(()=>{const{dragOperation:t}=this.manager,n=e??null;if(t.targetIdentifier===n)return Promise.resolve(!1);t.targetIdentifier=n;const r=gs({operation:t.snapshot()});return t.status.dragging&&this.manager.monitor.dispatch("dragover",r),this.manager.renderer.rendering.then(()=>r.defaultPrevented)})}start(e){return re(()=>{const{dragOperation:t}=this.manager;if(e.source!=null&&this.setDragSource(e.source),!t.source)throw new Error("Cannot start a drag operation without a drag source");if(!t.status.idle)throw new Error("Cannot start a drag operation while another is active");const r=new AbortController,{event:s,coordinates:i}=e;Ee(()=>{t.status.set("initialization-pending"),t.shape=null,t.canceled=!1,t.activatorEvent=s??null,t.position.reset(i)});const o=gs({operation:t.snapshot()});return this.manager.monitor.dispatch("beforedragstart",o),o.defaultPrevented?(t.reset(),r.abort(),r):(t.status.set("initializing"),t.controller=r,this.manager.renderer.rendering.then(()=>{if(r.signal.aborted)return;const{status:a}=t;a.current==="initializing"&&Ee(()=>{t.status.set("dragging"),this.manager.monitor.dispatch("dragstart",{nativeEvent:s,operation:t.snapshot(),cancelable:!1})})}),r)})}move(e){return re(()=>{var t,n;const{dragOperation:r}=this.manager,{status:s,controller:i}=r;if(!s.dragging||!i||i.signal.aborted)return;const o=gs({nativeEvent:e.event,operation:r.snapshot(),by:e.by,to:e.to},(t=e.cancelable)!=null?t:!0);((n=e.propagate)==null||n)&&this.manager.monitor.dispatch("dragmove",o),queueMicrotask(()=>{var a,c,f,d,l;if(o.defaultPrevented)return;const u=(l=e.to)!=null?l:{x:r.position.current.x+((c=(a=e.by)==null?void 0:a.x)!=null?c:0),y:r.position.current.y+((d=(f=e.by)==null?void 0:f.y)!=null?d:0)};r.position.current=u})})}stop(e={}){return re(()=>{var t,n;const{dragOperation:r}=this.manager,{controller:s}=r;if(!s||s.signal.aborted)return;let i;const o=()=>{const c={resume:()=>{},abort:()=>{}};return i=new Promise((f,d)=>{c.resume=f,c.abort=d}),c};s.abort();const a=()=>{this.manager.renderer.rendering.then(()=>{r.status.set("dropped");const c=re(()=>{var d;return((d=r.source)==null?void 0:d.status)==="dropping"}),f=()=>{r.controller===s&&(r.controller=void 0),r.reset()};if(c){const{source:d}=r,l=dt(()=>{d?.status==="idle"&&(l(),f())})}else this.manager.renderer.rendering.then(f)})};r.canceled=(t=e.canceled)!=null?t:!1,this.manager.monitor.dispatch("dragend",{nativeEvent:e.event,operation:r.snapshot(),canceled:(n=e.canceled)!=null?n:!1,suspend:o}),i?i.then(a).catch(()=>r.reset()):a()})}},Cn=class extends Ke{constructor(e,t){super(e,t),this.manager=e,this.options=t}},Sh=class extends AbortController{constructor(e,t){super(),this.constraints=e,this.onActivate=t,this.activated=!1;for(const n of e??[])n.controller=this}onEvent(e){var t;if(!this.activated)if((t=this.constraints)!=null&&t.length)for(const n of this.constraints)n.onEvent(e);else this.activate(e)}activate(e){this.activated||(this.activated=!0,this.onActivate(e))}abort(e){this.activated=!1,super.abort(e)}},ms,Hc=class{constructor(e){this.options=e,de(this,ms)}set controller(e){rt(this,ms,e),e.signal.addEventListener("abort",()=>this.abort())}activate(e){var t;(t=Ce(this,ms))==null||t.activate(e)}};ms=new WeakMap;var Ua=class extends Ke{constructor(e,t){super(e,t),this.manager=e,this.options=t}apply(e){return e.transform}},$h=class{constructor(e){this.draggables=new Va,this.droppables=new Va,this.plugins=new yi(e),this.sensors=new yi(e),this.modifiers=new yi(e)}register(e,t){if(e instanceof xt)return this.draggables.register(e.id,e);if(e instanceof wt)return this.droppables.register(e.id,e);if(e.prototype instanceof Ua)return this.modifiers.register(e,t);if(e.prototype instanceof Cn)return this.sensors.register(e,t);if(e.prototype instanceof Ke)return this.plugins.register(e,t);throw new Error("Invalid instance type")}unregister(e){if(e instanceof ei)return e instanceof xt?this.draggables.unregister(e.id,e):e instanceof wt?this.droppables.unregister(e.id,e):()=>{};if(e.prototype instanceof Ua)return this.modifiers.unregister(e);if(e.prototype instanceof Cn)return this.sensors.unregister(e);if(e.prototype instanceof Ke)return this.plugins.unregister(e);throw new Error("Invalid instance type")}destroy(){this.draggables.destroy(),this.droppables.destroy(),this.plugins.destroy(),this.sensors.destroy(),this.modifiers.destroy()}},qc,Kc,Yc,Xc,Qc,Zc,Jc,ed,td,rr,vs,gn,Te,Xo,Qo,Zo,Jo,ea,sr;td=[Oe],ed=[se],Jc=[se],Zc=[se],Qc=[se],Xc=[se],Yc=[Oe],Kc=[Oe],qc=[Oe];var mt=class{constructor(e){Y(Te,5,this),de(this,rr),de(this,vs),de(this,gn,new en(void 0,(t,n)=>t&&n?t.equals(n):t===n)),this.status=new Et,de(this,Xo,Y(Te,8,this,!1)),Y(Te,11,this),de(this,Qo,Y(Te,12,this,null)),Y(Te,15,this),de(this,Zo,Y(Te,16,this,null)),Y(Te,19,this),de(this,Jo,Y(Te,20,this,null)),Y(Te,23,this),de(this,ea,Y(Te,24,this,[])),Y(Te,27,this),this.position=new Js({x:0,y:0}),de(this,sr,{x:0,y:0}),rt(this,rr,e)}get shape(){const{current:e,initial:t,previous:n}=Ce(this,gn);return!e||!t?null:{current:e,initial:t,previous:n}}set shape(e){e?Ce(this,gn).current=e:Ce(this,gn).reset()}get source(){var e;const t=this.sourceIdentifier;if(t==null)return null;const n=Ce(this,rr).registry.draggables.get(t);return n&&rt(this,vs,n),(e=n??Ce(this,vs))!=null?e:null}get target(){var e;const t=this.targetIdentifier;return t!=null&&(e=Ce(this,rr).registry.droppables.get(t))!=null?e:null}get transform(){const{x:e,y:t}=this.position.delta;let n={x:e,y:t};for(const r of this.modifiers)n=r.apply(Po(Io({},this.snapshot()),{transform:n}));return rt(this,sr,n),n}snapshot(){return re(()=>({source:this.source,target:this.target,activatorEvent:this.activatorEvent,transform:Ce(this,sr),shape:this.shape?vi(this.shape):null,position:vi(this.position),status:vi(this.status),canceled:this.canceled}))}reset(){Ee(()=>{this.status.set("idle"),this.sourceIdentifier=null,this.targetIdentifier=null,Ce(this,gn).reset(),this.position.reset({x:0,y:0}),rt(this,sr,{x:0,y:0}),this.modifiers=[]})}};Te=Fn(null);rr=new WeakMap;vs=new WeakMap;gn=new WeakMap;Xo=new WeakMap;Qo=new WeakMap;Zo=new WeakMap;Jo=new WeakMap;ea=new WeakMap;sr=new WeakMap;ie(Te,2,"shape",td,mt);ie(Te,4,"canceled",ed,mt,Xo);ie(Te,4,"activatorEvent",Jc,mt,Qo);ie(Te,4,"sourceIdentifier",Zc,mt,Zo);ie(Te,4,"targetIdentifier",Qc,mt,Jo);ie(Te,4,"modifiers",Xc,mt,ea);ie(Te,2,"source",Yc,mt);ie(Te,2,"target",Kc,mt);ie(Te,2,"transform",qc,mt);tn(Te,mt);var Th={get rendering(){return Promise.resolve()}};function gt(e,t){return typeof e=="function"?e(t):e??t}var Eh=class{constructor(t){this.destroy=()=>{this.dragOperation.status.idle||this.actions.stop({canceled:!0}),this.dragOperation.modifiers.forEach(u=>u.destroy()),this.registry.destroy(),this.collisionObserver.destroy()};var n;const r=t??{},s=gt(r.plugins,[]),i=gt(r.sensors,[]),o=gt(r.modifiers,[]),a=(n=r.renderer)!=null?n:Th,c=new wh(this),f=new $h(this);this.registry=f,this.monitor=c,this.renderer=a,this.actions=new kh(this),this.dragOperation=new mt(this),this.collisionObserver=new bh(this),this.plugins=[_h,...s],this.modifiers=o,this.sensors=i;const{destroy:d}=this,l=Lr(()=>{var u,h,p;const v=re(()=>this.dragOperation.modifiers),x=this.modifiers;for(const _ of v)x.includes(_)||_.destroy();this.dragOperation.modifiers=(p=(h=(u=this.dragOperation.source)==null?void 0:u.modifiers)==null?void 0:h.map(_=>{const{plugin:g,options:y}=Tr(_);return new g(this,y)}))!=null?p:x});this.destroy=()=>{l(),d()}}get plugins(){return this.registry.plugins.values}set plugins(t){this.registry.plugins.values=t}get modifiers(){return this.registry.modifiers.values}set modifiers(t){this.registry.modifiers.values=t}get sensors(){return this.registry.sensors.values}set sensors(t){this.registry.sensors.values=t}},nd=e=>{throw TypeError(e)},ta=(e,t,n)=>t.has(e)||nd("Cannot "+n),K=(e,t,n)=>(ta(e,t,"read from private field"),t.get(e)),Je=(e,t,n)=>t.has(e)?nd("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),nt=(e,t,n,r)=>(ta(e,t,"write to private field"),t.set(e,n),n),rd=(e,t,n)=>(ta(e,t,"access private method"),n);function ti(e){return e?e instanceof KeyframeEffect?!0:"getKeyframes"in e&&typeof e.getKeyframes=="function":!1}function sd(e,t){const n=e.getAnimations();let r=null;for(const s of n){if(s.playState!=="running")continue;const{effect:i}=s,a=(ti(i)?i.getKeyframes():[]).filter(t);a.length>0&&(r=[a[a.length-1],s])}return r}function ni(e){const{width:t,height:n,top:r,left:s,bottom:i,right:o}=e.getBoundingClientRect();return{width:t,height:n,top:r,left:s,bottom:i,right:o}}function na(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Wr(e){return"nodeType"in e}function st(e){var t,n,r;return e?na(e)?e:Wr(e)?"defaultView"in e?(t=e.defaultView)!=null?t:window:(r=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?r:window:window:window}function ra(e){const{Document:t}=st(e);return e instanceof t||"nodeType"in e&&e.nodeType===Node.DOCUMENT_NODE}function At(e){return!e||na(e)?!1:e instanceof st(e).HTMLElement||"namespaceURI"in e&&typeof e.namespaceURI=="string"&&e.namespaceURI.endsWith("html")}function id(e){return e instanceof st(e).SVGElement||"namespaceURI"in e&&typeof e.namespaceURI=="string"&&e.namespaceURI.endsWith("svg")}function Nn(e){return e?na(e)?e.document:Wr(e)?ra(e)?e:At(e)||id(e)?e.ownerDocument:document:document:document}function Ch(e){var t,n,r,s;const{documentElement:i}=Nn(e),o=st(e).visualViewport,a=(t=o?.width)!=null?t:i.clientWidth,c=(n=o?.height)!=null?n:i.clientHeight,f=(r=o?.offsetTop)!=null?r:0,d=(s=o?.offsetLeft)!=null?s:0;return{top:f,left:d,right:d+a,bottom:f+c,width:a,height:c}}function Oh(e,t){if(Dh(e)&&e.open===!1)return!1;const{overflow:n,overflowX:r,overflowY:s}=getComputedStyle(e);return n==="visible"&&r==="visible"&&s==="visible"}function Dh(e){return e.tagName==="DETAILS"}function Cr(e,t=e.getBoundingClientRect(),n=0){var r,s,i,o,a;let c=t;const{ownerDocument:f}=e,d=(r=f.defaultView)!=null?r:window;let l=e.parentElement;for(;l&&l!==f.documentElement;){if(!Oh(l)){const y=l.getBoundingClientRect(),w=n*(y.bottom-y.top),b=n*(y.right-y.left),T=n*(y.bottom-y.top),C=n*(y.right-y.left);c={top:Math.max(c.top,y.top-w),right:Math.min(c.right,y.right+b),bottom:Math.min(c.bottom,y.bottom+T),left:Math.max(c.left,y.left-C),width:0,height:0},c.width=c.right-c.left,c.height=c.bottom-c.top}l=l.parentElement}const u=d.visualViewport,h=(s=u?.offsetTop)!=null?s:0,p=(i=u?.offsetLeft)!=null?i:0,v=(o=u?.width)!=null?o:d.innerWidth,x=(a=u?.height)!=null?a:d.innerHeight,_=n*x,g=n*v;return c={top:Math.max(c.top,h-_),right:Math.min(c.right,p+v+g),bottom:Math.min(c.bottom,h+x+_),left:Math.max(c.left,p-g),width:0,height:0},c.width=c.right-c.left,c.height=c.bottom-c.top,c.width<0&&(c.width=0),c.height<0&&(c.height=0),c}function On(e){return{x:e.clientX,y:e.clientY}}var od=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function eo(e=document,t=new Set){if(t.has(e))return[];t.add(e);const n=[e];for(const r of Array.from(e.querySelectorAll("iframe, frame")))try{const s=r.contentDocument;s&&!t.has(s)&&n.push(...eo(s,t))}catch{}try{const r=e.defaultView;if(r&&r!==window.top){const s=r.parent;s&&s.document&&s.document!==e&&n.push(...eo(s.document,t))}}catch{}return n}function sa(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function ad(){var e,t;const n=sa()?window.visualViewport:null;return{x:(e=n?.offsetLeft)!=null?e:0,y:(t=n?.offsetTop)!=null?t:0}}function ia(e){return!e||!Wr(e)?!1:e instanceof st(e).ShadowRoot}function Is(e){if(e&&Wr(e)){let t=e.getRootNode();if(ia(t))return t;if(t instanceof Document)return t}return Nn(e)}function oa(e){return e.matchMedia("(prefers-reduced-motion: reduce)").matches}function Mh(e){const t="input, textarea, select, canvas, [contenteditable]",n=e.cloneNode(!0),r=Array.from(e.querySelectorAll(t));return Array.from(n.querySelectorAll(t)).forEach((i,o)=>{const a=r[o];if(Ha(i)&&Ha(a)&&(i.type!=="file"&&(i.value=a.value),i.type==="radio"&&i.name&&(i.name=`Cloned__${i.name}`)),qa(i)&&qa(a)&&a.width>0&&a.height>0){const c=i.getContext("2d");c?.drawImage(a,0,0)}}),n}function Ha(e){return"value"in e}function qa(e){return e.tagName==="CANVAS"}function ld(e,{x:t,y:n}){const r=e.elementFromPoint(t,n);if(jh(r)){const{contentDocument:s}=r;if(s){const{left:i,top:o}=r.getBoundingClientRect();return ld(s,{x:t-i,y:n-o})}}return r}function jh(e){return e?.tagName==="IFRAME"}var to=new WeakMap;function Ih(e){return e.closest(`
2
2
  input:not([disabled]),
3
3
  select:not([disabled]),
4
4
  textarea:not([disabled]),
@@ -1,9 +1,9 @@
1
1
  import { jsx as _, jsxs as R, Fragment as Re } from "react/jsx-runtime";
2
- import { g as pt, h as tn, i as _s, A as oi, S as oh, C as la, j as ca, r as st, V as ah, k as lh, n as ch, w as dh, M as Xe, E as da, o as uh, p as fh, t as hh, U as ph, q as Qt, s as gh, l as Ac, u as vh, v as mh, x as ua, y as En, z as kl, B as Fs, F as pn, P as yh, G as bh, T as Mc, H as Gn, I as xh, R as wh, J as Rc, K as _h, L as kh, N as ao, O as lo, Q as Sh, W as $h, X as fa, Y as Eh, Z as Th, _ as Oh, $ as Ch, a0 as Dh, a1 as Ht, a2 as Ph, a3 as Sl, a4 as ki, a5 as Ih, a6 as Ah, a7 as Mh, a8 as Rh, a9 as Lh, aa as zh, ab as Wh, ac as ha, ad as Fh, ae as Nh, af as Bh, ag as jh, ah as Gh, ai as Vh, aj as co, ak as $l, al as Hh, am as Uh, an as Kh, ao as qh, ap as Yh, aq as Xh, ar as Qh, as as Zh, at as Lc, au as zc, av as Wc, aw as Jh, ax as Fc, ay as ep, az as tp, aA as np, aB as rp, aC as ip, aD as sp, aE as op, aF as ap, aG as lp, aH as cp, aI as dp, aJ as up, aK as fp, aL as hp, aM as pp } from "../useCompiledDocument-7j5cBjQd.es.js";
3
- import { aN as Hx, aO as Ux, aP as Kx, aQ as qx, aR as Yx, aS as Xx, aT as Qx, aU as Zx, aV as Jx, aW as ew, aX as tw } from "../useCompiledDocument-7j5cBjQd.es.js";
2
+ import { g as pt, h as tn, i as _s, A as oi, S as oh, C as la, j as ca, r as st, V as ah, k as lh, n as ch, w as dh, M as Xe, E as da, o as uh, p as fh, t as hh, U as ph, q as Qt, s as gh, l as Ac, u as vh, v as mh, x as ua, y as En, z as kl, B as Fs, F as pn, P as yh, G as bh, T as Mc, H as Gn, I as xh, R as wh, J as Rc, K as _h, L as kh, N as ao, O as lo, Q as Sh, W as $h, X as fa, Y as Eh, Z as Th, _ as Oh, $ as Ch, a0 as Dh, a1 as Ht, a2 as Ph, a3 as Sl, a4 as ki, a5 as Ih, a6 as Ah, a7 as Mh, a8 as Rh, a9 as Lh, aa as zh, ab as Wh, ac as ha, ad as Fh, ae as Nh, af as Bh, ag as jh, ah as Gh, ai as Vh, aj as co, ak as $l, al as Hh, am as Uh, an as Kh, ao as qh, ap as Yh, aq as Xh, ar as Qh, as as Zh, at as Lc, au as zc, av as Wc, aw as Jh, ax as Fc, ay as ep, az as tp, aA as np, aB as rp, aC as ip, aD as sp, aE as op, aF as ap, aG as lp, aH as cp, aI as dp, aJ as up, aK as fp, aL as hp, aM as pp } from "../useCompiledDocument-Bf4RSfB6.es.js";
3
+ import { aN as Hx, aO as Ux, aP as Kx, aQ as qx, aR as Yx, aS as Xx, aT as Qx, aU as Zx, aV as Jx, aW as ew, aX as tw } from "../useCompiledDocument-Bf4RSfB6.es.js";
4
4
  import { Stack as lt, Tooltip as vt, ToggleButtonGroup as ks, ToggleButton as vn, Divider as Vn, Button as Oe, IconButton as Yn, Box as N, Typography as ve, TextField as Ut, Switch as gp, MenuItem as Et, Checkbox as uo, ListItemText as Qi, ButtonBase as Nc, Collapse as vp, Autocomplete as mp, Menu as Zi, ListItemIcon as yp, InputBase as Bc, SvgIcon as bp, Alert as ft, useMediaQuery as xp } from "@mui/material";
5
5
  import { useRef as H, useEffect as te, useState as W, useMemo as Y, createElement as wp, useLayoutEffect as Ji, useCallback as oe, useInsertionEffect as _p, createContext as jc, memo as kp, forwardRef as Sp, startTransition as $p, useImperativeHandle as Ep, useContext as Gc, useId as Tp } from "react";
6
- import { b8 as pa, b4 as Qe, b5 as ga } from "../ServerProvider-azXLkk1q.es.js";
6
+ import { b8 as pa, b4 as Qe, b5 as ga } from "../ServerProvider-RvKSbvnL.es.js";
7
7
  import { i as fo, a as Vc, m as Op, b as Cp, t as Dp, c as Hc, s as Pp, d as Ip, e as Uc, f as va, g as Ap, A as Mp, h as Rp, r as Lp, j as El, k as zp, l as ma } from "../text-entry-72YFLeNk.es.js";
8
8
  import { flushSync as Wp } from "react-dom";
9
9
  import { parseTag as Fp } from "@malloydata/malloy-tag";
@@ -541,6 +541,7 @@ export interface Connection {
541
541
  'trinoConnection'?: TrinoConnection;
542
542
  'databricksConnection'?: DatabricksConnection;
543
543
  'mysqlConnection'?: MysqlConnection;
544
+ 'sqlserverConnection'?: SqlserverConnection;
544
545
  'duckdbConnection'?: DuckdbConnection;
545
546
  'motherduckConnection'?: MotherDuckConnection;
546
547
  'ducklakeConnection'?: DucklakeConnection;
@@ -553,6 +554,7 @@ export declare const ConnectionTypeEnum: {
553
554
  readonly Trino: "trino";
554
555
  readonly Databricks: "databricks";
555
556
  readonly Mysql: "mysql";
557
+ readonly Sqlserver: "sqlserver";
556
558
  readonly Duckdb: "duckdb";
557
559
  readonly Motherduck: "motherduck";
558
560
  readonly Ducklake: "ducklake";
@@ -2330,7 +2332,7 @@ export interface RefusedSource {
2330
2332
  */
2331
2333
  'tier': RefusedSourceTierEnum;
2332
2334
  /**
2333
- * The bounded refusal reason. Only the compile-time reasons can appear here — `free_parameter`, `authorize`, the four that name where a given the build could not strip sits (`given_in_persisted_query`, `dynamic_projection`, `dynamic_join`, `dynamic_joined_where`), the three that name an unusable `partition=` (`partition_without_storage`, `partition_column_unknown`, `partition_column_not_public`), `merge_key_scope_unresolved` (a `merge_key=` whose caller scope cannot be expressed over the stored table\'s own columns), and `preaggregate_over_dynamic_source` (a rollup whose base is scoped by a given, which has no read-time re-application to put the term back) — those being the only reasons the two compile-time eligibility asserts this collection is computed from produce. `given_in_persisted_query` is raised by BOTH gates, for one condition: the BUILD would substitute a given\'s value, so the artifact holds one caller\'s slice. On colocated that is a build that runs and lies; on a storage destination the same placement also leaves nothing for the read to re-apply. A given in the source\'s extend block is neither — it is left out of the build and applied per caller at read — and is admitted on both tiers. `given` is retained for records that already carry it and is no longer produced. It was the storage tier\'s blanket refusal of any given reference, and the positional reasons above replaced it: where a given sits decides the outcome, so a single reason covering every placement can no longer be raised. `not_duckdb_portable` is decided against the post-build captured schema, which does not exist at compile time, and `public_surface_unknown` is raised by the build-time narrowing of a stored table to the source\'s public columns; both are listed only because they share the enum the runtime eligibility metric uses.
2335
+ * The bounded refusal reason. Only the compile-time reasons can appear here — `free_parameter`, `authorize`, the four that name where a given the build could not strip sits (`given_in_persisted_query`, `dynamic_projection`, `dynamic_join`, `dynamic_joined_where`), the three that name an unusable `partition=` (`partition_without_storage`, `partition_column_unknown`, `partition_column_not_public`), `merge_key_scope_unresolved` (a `merge_key=` whose caller scope cannot be expressed over the stored table\'s own columns), `preaggregate_over_dynamic_source` (a rollup whose base is scoped by a given, which has no read-time re-application to put the term back), and `read_only_dialect` (a colocated `#@ persist` on a source whose dialect cannot create tables; SQL Server today, whose connection reports `canPersist: false`) — those being the only reasons the two compile-time eligibility asserts this collection is computed from produce. `given_in_persisted_query` is raised by BOTH gates, for one condition: the BUILD would substitute a given\'s value, so the artifact holds one caller\'s slice. On colocated that is a build that runs and lies; on a storage destination the same placement also leaves nothing for the read to re-apply. A given in the source\'s extend block is neither — it is left out of the build and applied per caller at read — and is admitted on both tiers. `given` is retained for records that already carry it and is no longer produced. It was the storage tier\'s blanket refusal of any given reference, and the positional reasons above replaced it: where a given sits decides the outcome, so a single reason covering every placement can no longer be raised. `not_duckdb_portable` is decided against the post-build captured schema, which does not exist at compile time, and `public_surface_unknown` is raised by the build-time narrowing of a stored table to the source\'s public columns; both are listed only because they share the enum the runtime eligibility metric uses.
2334
2336
  */
2335
2337
  'reason': RefusedSourceReasonEnum;
2336
2338
  /**
@@ -2359,6 +2361,7 @@ export declare const RefusedSourceReasonEnum: {
2359
2361
  readonly Authorize: "authorize";
2360
2362
  readonly NotDuckdbPortable: "not_duckdb_portable";
2361
2363
  readonly PublicSurfaceUnknown: "public_surface_unknown";
2364
+ readonly ReadOnlyDialect: "read_only_dialect";
2362
2365
  };
2363
2366
  export type RefusedSourceReasonEnum = typeof RefusedSourceReasonEnum[keyof typeof RefusedSourceReasonEnum];
2364
2367
  /**
@@ -2915,6 +2918,47 @@ export interface SqlSource {
2915
2918
  'resource'?: string;
2916
2919
  'source'?: string;
2917
2920
  }
2921
+ /**
2922
+ * Microsoft SQL Server connection configuration: a SQL Server login over TCP. Field names are the connector\'s own (`@malloydata/db-sqlserver`), so a value here reaches the driver unchanged. The dialect is experimental upstream; Publisher accepts it on the model author\'s behalf, so a model needs no `##! experimental.dialect.sqlserver` pragma. The connection is read-only: a `#@ persist` on a SQL Server source is refused at load (see `RefusedSource.reason`).
2923
+ */
2924
+ export interface SqlserverConnection {
2925
+ /**
2926
+ * SQL Server host name or IP address
2927
+ */
2928
+ 'server'?: string;
2929
+ /**
2930
+ * TCP port; 1433 when omitted. Not used when `instanceName` is set.
2931
+ */
2932
+ 'port'?: number;
2933
+ /**
2934
+ * Name of the database to open
2935
+ */
2936
+ 'database'?: string;
2937
+ /**
2938
+ * SQL Server login name
2939
+ */
2940
+ 'user'?: string;
2941
+ /**
2942
+ * SQL Server login password
2943
+ */
2944
+ 'password'?: string;
2945
+ /**
2946
+ * Encrypt the connection with TLS. On when omitted, as the driver defaults it; a server that requires encryption refuses a connection with it off.
2947
+ */
2948
+ 'encrypt'?: boolean;
2949
+ /**
2950
+ * Accept a server certificate the client cannot verify, such as a self-signed one on a local or test server. Off when omitted. Leave it off for any server you do not control; a certificate the client cannot verify then fails the connection rather than being trusted.
2951
+ */
2952
+ 'trustServerCertificate'?: boolean;
2953
+ /**
2954
+ * The host name the server\'s certificate is issued to, when it is not `server` (a server reached by IP address, or through a tunnel). Checked against the certificate when `encrypt` is on and `trustServerCertificate` is off.
2955
+ */
2956
+ 'hostNameInCertificate'?: string;
2957
+ /**
2958
+ * A named instance, located through the SQL Browser service (UDP 1434); `port` is then not used.
2959
+ */
2960
+ 'instanceName'?: string;
2961
+ }
2918
2962
  /**
2919
2963
  * SSH bastion / jump-host config for reaching a database inside a private network via an SSH local port-forward. Authentication is public-key only.
2920
2964
  */
@@ -3192,6 +3236,7 @@ export interface UpdateConnectionRequest {
3192
3236
  'proxy'?: ConnectionProxy;
3193
3237
  'postgresConnection'?: PostgresConnection;
3194
3238
  'mysqlConnection'?: MysqlConnection;
3239
+ 'sqlserverConnection'?: SqlserverConnection;
3195
3240
  'bigqueryConnection'?: BigqueryConnection;
3196
3241
  'snowflakeConnection'?: SnowflakeConnection;
3197
3242
  'duckdbConnection'?: DuckdbConnection;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../ServerProvider-BOgiW8MX.cjs.js");exports.AgentsApi=e.AgentsApi;exports.AgentsApiAxiosParamCreator=e.AgentsApiAxiosParamCreator;exports.AgentsApiFactory=e.AgentsApiFactory;exports.AgentsApiFp=e.AgentsApiFp;exports.AttachedDatabaseTypeEnum=e.AttachedDatabaseTypeEnum;exports.AzureConnectionAuthTypeEnum=e.AzureConnectionAuthTypeEnum;exports.CompileProblemSeverityEnum=e.CompileProblemSeverityEnum;exports.CompileRequestScopeEnum=e.CompileRequestScopeEnum;exports.CompileResultStatusEnum=e.CompileResultStatusEnum;exports.CompiledDocumentKindEnum=e.CompiledDocumentKindEnum;exports.CompiledDocumentLayoutEnum=e.CompiledDocumentLayoutEnum;exports.Configuration=e.Configuration;exports.ConnectionProxyTypeEnum=e.ConnectionProxyTypeEnum;exports.ConnectionStatusStatusEnum=e.ConnectionStatusStatusEnum;exports.ConnectionTypeEnum=e.ConnectionTypeEnum;exports.ConnectionsApi=e.ConnectionsApi;exports.ConnectionsApiAxiosParamCreator=e.ConnectionsApiAxiosParamCreator;exports.ConnectionsApiFactory=e.ConnectionsApiFactory;exports.ConnectionsApiFp=e.ConnectionsApiFp;exports.ConnectionsTestApi=e.ConnectionsTestApi;exports.ConnectionsTestApiAxiosParamCreator=e.ConnectionsTestApiAxiosParamCreator;exports.ConnectionsTestApiFactory=e.ConnectionsTestApiFactory;exports.ConnectionsTestApiFp=e.ConnectionsTestApiFp;exports.DashboardManifestKindEnum=e.DashboardManifestKindEnum;exports.DashboardManifestLayoutEnum=e.DashboardManifestLayoutEnum;exports.DashboardTileKindEnum=e.DashboardTileKindEnum;exports.DashboardsApi=e.DashboardsApi;exports.DashboardsApiAxiosParamCreator=e.DashboardsApiAxiosParamCreator;exports.DashboardsApiFactory=e.DashboardsApiFactory;exports.DashboardsApiFp=e.DashboardsApiFp;exports.DataAppFitEnum=e.DataAppFitEnum;exports.DataAppsApi=e.DataAppsApi;exports.DataAppsApiAxiosParamCreator=e.DataAppsApiAxiosParamCreator;exports.DataAppsApiFactory=e.DataAppsApiFactory;exports.DataAppsApiFp=e.DataAppsApiFp;exports.DatabaseTypeEnum=e.DatabaseTypeEnum;exports.DatabasesApi=e.DatabasesApi;exports.DatabasesApiAxiosParamCreator=e.DatabasesApiAxiosParamCreator;exports.DatabasesApiFactory=e.DatabasesApiFactory;exports.DatabasesApiFp=e.DatabasesApiFp;exports.EnvironmentsApi=e.EnvironmentsApi;exports.EnvironmentsApiAxiosParamCreator=e.EnvironmentsApiAxiosParamCreator;exports.EnvironmentsApiFactory=e.EnvironmentsApiFactory;exports.EnvironmentsApiFp=e.EnvironmentsApiFp;exports.ExecuteNotebookCellBypassFiltersEnum=e.ExecuteNotebookCellBypassFiltersEnum;exports.FilterTypeEnum=e.FilterTypeEnum;exports.FreshnessFallbackEnum=e.FreshnessFallbackEnum;exports.GetAgentSkillsEnum=e.GetAgentSkillsEnum;exports.GivenControlEnum=e.GivenControlEnum;exports.LedgerEntryStrategyEnum=e.LedgerEntryStrategyEnum;exports.LogMessageSeverityEnum=e.LogMessageSeverityEnum;exports.ManifestEntryFreshnessFallbackEnum=e.ManifestEntryFreshnessFallbackEnum;exports.ManifestEntryOriginEnum=e.ManifestEntryOriginEnum;exports.ManifestEntryRefreshEnum=e.ManifestEntryRefreshEnum;exports.ManifestEntryUpstreamReuseEnum=e.ManifestEntryUpstreamReuseEnum;exports.MaterializationActionActionEnum=e.MaterializationActionActionEnum;exports.MaterializationStatus=e.MaterializationStatus;exports.MaterializationsApi=e.MaterializationsApi;exports.MaterializationsApiAxiosParamCreator=e.MaterializationsApiAxiosParamCreator;exports.MaterializationsApiFactory=e.MaterializationsApiFactory;exports.MaterializationsApiFp=e.MaterializationsApiFp;exports.ModelsApi=e.ModelsApi;exports.ModelsApiAxiosParamCreator=e.ModelsApiAxiosParamCreator;exports.ModelsApiFactory=e.ModelsApiFactory;exports.ModelsApiFp=e.ModelsApiFp;exports.NotebookCellKindEnum=e.NotebookCellKindEnum;exports.NotebookCellResultKindEnum=e.NotebookCellResultKindEnum;exports.NotebookCellResultTypeEnum=e.NotebookCellResultTypeEnum;exports.NotebookCellTypeEnum=e.NotebookCellTypeEnum;exports.NotebooksApi=e.NotebooksApi;exports.NotebooksApiAxiosParamCreator=e.NotebooksApiAxiosParamCreator;exports.NotebooksApiFactory=e.NotebooksApiFactory;exports.NotebooksApiFp=e.NotebooksApiFp;exports.PackageEmbeddingIndexReasonEnum=e.PackageEmbeddingIndexReasonEnum;exports.PackageEmbeddingIndexStageEnum=e.PackageEmbeddingIndexStageEnum;exports.PackageEmbeddingIndexStatusEnum=e.PackageEmbeddingIndexStatusEnum;exports.PackageManifestBindingStatusEnum=e.PackageManifestBindingStatusEnum;exports.PackageQueryableSourcesEnum=e.PackageQueryableSourcesEnum;exports.PackageScopeEnum=e.PackageScopeEnum;exports.PackageStorageServeBindingsInnerOriginEnum=e.PackageStorageServeBindingsInnerOriginEnum;exports.PackageWarningsInnerSeverityEnum=e.PackageWarningsInnerSeverityEnum;exports.PackagesApi=e.PackagesApi;exports.PackagesApiAxiosParamCreator=e.PackagesApiAxiosParamCreator;exports.PackagesApiFactory=e.PackagesApiFactory;exports.PackagesApiFp=e.PackagesApiFp;exports.PersistSourcePlanOriginEnum=e.PersistSourcePlanOriginEnum;exports.PostgresConnectionSslmodeEnum=e.PostgresConnectionSslmodeEnum;exports.PublisherApi=e.PublisherApi;exports.PublisherApiAxiosParamCreator=e.PublisherApiAxiosParamCreator;exports.PublisherApiFactory=e.PublisherApiFactory;exports.PublisherApiFp=e.PublisherApiFp;exports.QueryClass=e.QueryClass;exports.QueryResultQueryRowLimitSourceEnum=e.QueryResultQueryRowLimitSourceEnum;exports.QueryResultServedFromEnum=e.QueryResultServedFromEnum;exports.RawNotebookFormatEnum=e.RawNotebookFormatEnum;exports.Realization=e.Realization;exports.RefusedSourceReasonEnum=e.RefusedSourceReasonEnum;exports.RefusedSourceTierEnum=e.RefusedSourceTierEnum;exports.ReportCellsFormatEnum=e.ReportCellsFormatEnum;exports.ReportLayoutEnum=e.ReportLayoutEnum;exports.ReportManifestLayoutEnum=e.ReportManifestLayoutEnum;exports.ReportTileKindEnum=e.ReportTileKindEnum;exports.ReportsApi=e.ReportsApi;exports.ReportsApiAxiosParamCreator=e.ReportsApiAxiosParamCreator;exports.ReportsApiFactory=e.ReportsApiFactory;exports.ReportsApiFp=e.ReportsApiFp;exports.RunContextTriggerEnum=e.RunContextTriggerEnum;exports.S3ConnectionProviderEnum=e.S3ConnectionProviderEnum;exports.ServerProvider=e.ServerProvider;exports.ServerStatusOperationalStateEnum=e.ServerStatusOperationalStateEnum;exports.SkillOriginEnum=e.SkillOriginEnum;exports.SkillSummaryOriginEnum=e.SkillSummaryOriginEnum;exports.SkillsApi=e.SkillsApi;exports.SkillsApiAxiosParamCreator=e.SkillsApiAxiosParamCreator;exports.SkillsApiFactory=e.SkillsApiFactory;exports.SkillsApiFp=e.SkillsApiFp;exports.ThemeDefaultModeEnum=e.ThemeDefaultModeEnum;exports.WatchModeApi=e.WatchModeApi;exports.WatchModeApiAxiosParamCreator=e.WatchModeApiAxiosParamCreator;exports.WatchModeApiFactory=e.WatchModeApiFactory;exports.WatchModeApiFp=e.WatchModeApiFp;exports.globalQueryClient=e.globalQueryClient;exports.usePublisherTheme=e.usePublisherTheme;exports.useServer=e.useServer;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../ServerProvider-DKrBcXL7.cjs.js");exports.AgentsApi=e.AgentsApi;exports.AgentsApiAxiosParamCreator=e.AgentsApiAxiosParamCreator;exports.AgentsApiFactory=e.AgentsApiFactory;exports.AgentsApiFp=e.AgentsApiFp;exports.AttachedDatabaseTypeEnum=e.AttachedDatabaseTypeEnum;exports.AzureConnectionAuthTypeEnum=e.AzureConnectionAuthTypeEnum;exports.CompileProblemSeverityEnum=e.CompileProblemSeverityEnum;exports.CompileRequestScopeEnum=e.CompileRequestScopeEnum;exports.CompileResultStatusEnum=e.CompileResultStatusEnum;exports.CompiledDocumentKindEnum=e.CompiledDocumentKindEnum;exports.CompiledDocumentLayoutEnum=e.CompiledDocumentLayoutEnum;exports.Configuration=e.Configuration;exports.ConnectionProxyTypeEnum=e.ConnectionProxyTypeEnum;exports.ConnectionStatusStatusEnum=e.ConnectionStatusStatusEnum;exports.ConnectionTypeEnum=e.ConnectionTypeEnum;exports.ConnectionsApi=e.ConnectionsApi;exports.ConnectionsApiAxiosParamCreator=e.ConnectionsApiAxiosParamCreator;exports.ConnectionsApiFactory=e.ConnectionsApiFactory;exports.ConnectionsApiFp=e.ConnectionsApiFp;exports.ConnectionsTestApi=e.ConnectionsTestApi;exports.ConnectionsTestApiAxiosParamCreator=e.ConnectionsTestApiAxiosParamCreator;exports.ConnectionsTestApiFactory=e.ConnectionsTestApiFactory;exports.ConnectionsTestApiFp=e.ConnectionsTestApiFp;exports.DashboardManifestKindEnum=e.DashboardManifestKindEnum;exports.DashboardManifestLayoutEnum=e.DashboardManifestLayoutEnum;exports.DashboardTileKindEnum=e.DashboardTileKindEnum;exports.DashboardsApi=e.DashboardsApi;exports.DashboardsApiAxiosParamCreator=e.DashboardsApiAxiosParamCreator;exports.DashboardsApiFactory=e.DashboardsApiFactory;exports.DashboardsApiFp=e.DashboardsApiFp;exports.DataAppFitEnum=e.DataAppFitEnum;exports.DataAppsApi=e.DataAppsApi;exports.DataAppsApiAxiosParamCreator=e.DataAppsApiAxiosParamCreator;exports.DataAppsApiFactory=e.DataAppsApiFactory;exports.DataAppsApiFp=e.DataAppsApiFp;exports.DatabaseTypeEnum=e.DatabaseTypeEnum;exports.DatabasesApi=e.DatabasesApi;exports.DatabasesApiAxiosParamCreator=e.DatabasesApiAxiosParamCreator;exports.DatabasesApiFactory=e.DatabasesApiFactory;exports.DatabasesApiFp=e.DatabasesApiFp;exports.EnvironmentsApi=e.EnvironmentsApi;exports.EnvironmentsApiAxiosParamCreator=e.EnvironmentsApiAxiosParamCreator;exports.EnvironmentsApiFactory=e.EnvironmentsApiFactory;exports.EnvironmentsApiFp=e.EnvironmentsApiFp;exports.ExecuteNotebookCellBypassFiltersEnum=e.ExecuteNotebookCellBypassFiltersEnum;exports.FilterTypeEnum=e.FilterTypeEnum;exports.FreshnessFallbackEnum=e.FreshnessFallbackEnum;exports.GetAgentSkillsEnum=e.GetAgentSkillsEnum;exports.GivenControlEnum=e.GivenControlEnum;exports.LedgerEntryStrategyEnum=e.LedgerEntryStrategyEnum;exports.LogMessageSeverityEnum=e.LogMessageSeverityEnum;exports.ManifestEntryFreshnessFallbackEnum=e.ManifestEntryFreshnessFallbackEnum;exports.ManifestEntryOriginEnum=e.ManifestEntryOriginEnum;exports.ManifestEntryRefreshEnum=e.ManifestEntryRefreshEnum;exports.ManifestEntryUpstreamReuseEnum=e.ManifestEntryUpstreamReuseEnum;exports.MaterializationActionActionEnum=e.MaterializationActionActionEnum;exports.MaterializationStatus=e.MaterializationStatus;exports.MaterializationsApi=e.MaterializationsApi;exports.MaterializationsApiAxiosParamCreator=e.MaterializationsApiAxiosParamCreator;exports.MaterializationsApiFactory=e.MaterializationsApiFactory;exports.MaterializationsApiFp=e.MaterializationsApiFp;exports.ModelsApi=e.ModelsApi;exports.ModelsApiAxiosParamCreator=e.ModelsApiAxiosParamCreator;exports.ModelsApiFactory=e.ModelsApiFactory;exports.ModelsApiFp=e.ModelsApiFp;exports.NotebookCellKindEnum=e.NotebookCellKindEnum;exports.NotebookCellResultKindEnum=e.NotebookCellResultKindEnum;exports.NotebookCellResultTypeEnum=e.NotebookCellResultTypeEnum;exports.NotebookCellTypeEnum=e.NotebookCellTypeEnum;exports.NotebooksApi=e.NotebooksApi;exports.NotebooksApiAxiosParamCreator=e.NotebooksApiAxiosParamCreator;exports.NotebooksApiFactory=e.NotebooksApiFactory;exports.NotebooksApiFp=e.NotebooksApiFp;exports.PackageEmbeddingIndexReasonEnum=e.PackageEmbeddingIndexReasonEnum;exports.PackageEmbeddingIndexStageEnum=e.PackageEmbeddingIndexStageEnum;exports.PackageEmbeddingIndexStatusEnum=e.PackageEmbeddingIndexStatusEnum;exports.PackageManifestBindingStatusEnum=e.PackageManifestBindingStatusEnum;exports.PackageQueryableSourcesEnum=e.PackageQueryableSourcesEnum;exports.PackageScopeEnum=e.PackageScopeEnum;exports.PackageStorageServeBindingsInnerOriginEnum=e.PackageStorageServeBindingsInnerOriginEnum;exports.PackageWarningsInnerSeverityEnum=e.PackageWarningsInnerSeverityEnum;exports.PackagesApi=e.PackagesApi;exports.PackagesApiAxiosParamCreator=e.PackagesApiAxiosParamCreator;exports.PackagesApiFactory=e.PackagesApiFactory;exports.PackagesApiFp=e.PackagesApiFp;exports.PersistSourcePlanOriginEnum=e.PersistSourcePlanOriginEnum;exports.PostgresConnectionSslmodeEnum=e.PostgresConnectionSslmodeEnum;exports.PublisherApi=e.PublisherApi;exports.PublisherApiAxiosParamCreator=e.PublisherApiAxiosParamCreator;exports.PublisherApiFactory=e.PublisherApiFactory;exports.PublisherApiFp=e.PublisherApiFp;exports.QueryClass=e.QueryClass;exports.QueryResultQueryRowLimitSourceEnum=e.QueryResultQueryRowLimitSourceEnum;exports.QueryResultServedFromEnum=e.QueryResultServedFromEnum;exports.RawNotebookFormatEnum=e.RawNotebookFormatEnum;exports.Realization=e.Realization;exports.RefusedSourceReasonEnum=e.RefusedSourceReasonEnum;exports.RefusedSourceTierEnum=e.RefusedSourceTierEnum;exports.ReportCellsFormatEnum=e.ReportCellsFormatEnum;exports.ReportLayoutEnum=e.ReportLayoutEnum;exports.ReportManifestLayoutEnum=e.ReportManifestLayoutEnum;exports.ReportTileKindEnum=e.ReportTileKindEnum;exports.ReportsApi=e.ReportsApi;exports.ReportsApiAxiosParamCreator=e.ReportsApiAxiosParamCreator;exports.ReportsApiFactory=e.ReportsApiFactory;exports.ReportsApiFp=e.ReportsApiFp;exports.RunContextTriggerEnum=e.RunContextTriggerEnum;exports.S3ConnectionProviderEnum=e.S3ConnectionProviderEnum;exports.ServerProvider=e.ServerProvider;exports.ServerStatusOperationalStateEnum=e.ServerStatusOperationalStateEnum;exports.SkillOriginEnum=e.SkillOriginEnum;exports.SkillSummaryOriginEnum=e.SkillSummaryOriginEnum;exports.SkillsApi=e.SkillsApi;exports.SkillsApiAxiosParamCreator=e.SkillsApiAxiosParamCreator;exports.SkillsApiFactory=e.SkillsApiFactory;exports.SkillsApiFp=e.SkillsApiFp;exports.ThemeDefaultModeEnum=e.ThemeDefaultModeEnum;exports.WatchModeApi=e.WatchModeApi;exports.WatchModeApiAxiosParamCreator=e.WatchModeApiAxiosParamCreator;exports.WatchModeApiFactory=e.WatchModeApiFactory;exports.WatchModeApiFp=e.WatchModeApiFp;exports.globalQueryClient=e.globalQueryClient;exports.usePublisherTheme=e.usePublisherTheme;exports.useServer=e.useServer;
@@ -1,4 +1,4 @@
1
- import { A as e, a as i, b as o, c as n, d as t, e as r, C as p, f as u, g as m, h as A, i as l, j as E, k as c, l as y, m as C, n as d, o as b, p as F, q as g, r as P, s as S, t as k, u as M, D as R, v as h, w as x, x as D, y as T, z as v, B as f, E as N, F as z, G as L, H as K, I as O, J as Q, K as I, L as W, M as B, N as w, O as G, P as q, Q as U, R as j, S as H, T as J, U as V, V as X, W as Y, X as Z, Y as _, Z as $, _ as aa, $ as sa, a0 as ea, a1 as ia, a2 as oa, a3 as na, a4 as ta, a5 as ra, a6 as pa, a7 as ua, a8 as ma, a9 as Aa, aa as la, ab as Ea, ac as ca, ad as ya, ae as Ca, af as da, ag as ba, ah as Fa, ai as ga, aj as Pa, ak as Sa, al as ka, am as Ma, an as Ra, ao as ha, ap as xa, aq as Da, ar as Ta, as as va, at as fa, au as Na, av as za, aw as La, ax as Ka, ay as Oa, az as Qa, aA as Ia, aB as Wa, aC as Ba, aD as wa, aE as Ga, aF as qa, aG as Ua, aH as ja, aI as Ha, aJ as Ja, aK as Va, aL as Xa, aM as Ya, aN as Za, aO as _a, aP as $a, aQ as as, aR as ss, aS as es, aT as is, aU as os, aV as ns, aW as ts, aX as rs, aY as ps, aZ as us, a_ as ms, a$ as As, b0 as ls, b1 as Es, b2 as cs, b3 as ys, b4 as Cs, b5 as ds } from "../ServerProvider-azXLkk1q.es.js";
1
+ import { A as e, a as i, b as o, c as n, d as t, e as r, C as p, f as u, g as m, h as A, i as l, j as E, k as c, l as y, m as C, n as d, o as b, p as F, q as g, r as P, s as S, t as k, u as M, D as R, v as h, w as x, x as D, y as T, z as v, B as f, E as N, F as z, G as L, H as K, I as O, J as Q, K as I, L as W, M as B, N as w, O as G, P as q, Q as U, R as j, S as H, T as J, U as V, V as X, W as Y, X as Z, Y as _, Z as $, _ as aa, $ as sa, a0 as ea, a1 as ia, a2 as oa, a3 as na, a4 as ta, a5 as ra, a6 as pa, a7 as ua, a8 as ma, a9 as Aa, aa as la, ab as Ea, ac as ca, ad as ya, ae as Ca, af as da, ag as ba, ah as Fa, ai as ga, aj as Pa, ak as Sa, al as ka, am as Ma, an as Ra, ao as ha, ap as xa, aq as Da, ar as Ta, as as va, at as fa, au as Na, av as za, aw as La, ax as Ka, ay as Oa, az as Qa, aA as Ia, aB as Wa, aC as Ba, aD as wa, aE as Ga, aF as qa, aG as Ua, aH as ja, aI as Ha, aJ as Ja, aK as Va, aL as Xa, aM as Ya, aN as Za, aO as _a, aP as $a, aQ as as, aR as ss, aS as es, aT as is, aU as os, aV as ns, aW as ts, aX as rs, aY as ps, aZ as us, a_ as ms, a$ as As, b0 as ls, b1 as Es, b2 as cs, b3 as ys, b4 as Cs, b5 as ds } from "../ServerProvider-RvKSbvnL.es.js";
2
2
  export {
3
3
  e as AgentsApi,
4
4
  i as AgentsApiAxiosParamCreator,