@malloy-publisher/app 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.html CHANGED
@@ -16,7 +16,7 @@ SPDX-License-Identifier: MIT
16
16
  href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap"
17
17
  />
18
18
  <title>Malloy Publisher</title>
19
- <script type="module" crossorigin src="/assets/index-DKvKsj6c.js"></script>
19
+ <script type="module" crossorigin src="/assets/index-DycyDIlK.js"></script>
20
20
  <link rel="stylesheet" crossorigin href="/assets/index-DUqldpo0.css">
21
21
  </head>
22
22
  <body>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@malloy-publisher/app",
3
3
  "description": "Malloy Publisher Console (the built-in web UI)",
4
- "version": "0.4.0",
4
+ "version": "0.5.0",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs.js",
7
7
  "module": "dist/index.es.js",
@@ -41,7 +41,7 @@
41
41
  "test:playwright:headed": "bunx playwright test --config=playwright.config.ts --headed"
42
42
  },
43
43
  "dependencies": {
44
- "@malloy-publisher/sdk": "^0.4.0",
44
+ "@malloy-publisher/sdk": "^0.5.0",
45
45
  "@mui/icons-material": "^7.0.2",
46
46
  "@mui/material": "^7.0.2",
47
47
  "@tanstack/react-query": "^5.59.16",
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index.es-D0L4_L8o.js","assets/index-DKvKsj6c.js","assets/index-DUqldpo0.css","assets/ToggleButtonGroup-CoIPitu6.js"])))=>i.map(i=>d[i]);
2
- import{c as W,j as a,J as f,r as x,a1 as v,H as b,K as $,a2 as k,N as i,a3 as m,a4 as y,a5 as _,a6 as F,a7 as j,a8 as N,a9 as L,aa as R,a0 as U,ab as D,L as I,U as S,ac as T,ad as M,ae as O,T as g,af as h,ag as w}from"./index-DKvKsj6c.js";const z=W(a.jsx("path",{d:"m14.06 9.02.92.92L5.92 19H5v-.92zM17.66 3c-.25 0-.51.1-.7.29l-1.83 1.83 3.75 3.75 1.83-1.83c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.2-.2-.45-.29-.71-.29m-3.6 3.19L3 17.25V21h3.75L17.81 9.94z"}));function E(e,s){const n=f();return x.useCallback((t,r)=>{const l=new URLSearchParams(t.givens).toString(),c=encodeURIComponent(e),d=encodeURIComponent(s),o=encodeURIComponent(t.dashboard);n(`/${c}/${d}/dashboards/${o}`+(l?`?${l}`:""),r)},[n,e,s])}function A({environmentName:e,packageName:s,dashboardName:n}){const{params:t,onGivensChange:r}=v(),l=E(e,s),c=b(),{pathname:d}=$(),o=x.useMemo(()=>k({environmentName:e,packageName:s,dashboardName:n}),[e,s,n]);return x.useEffect(()=>{const p=()=>void N(()=>import("./index.es-D0L4_L8o.js"),__vite__mapDeps([0,1,2,3])),u=window.requestIdleCallback;if(u){const P=u(p);return()=>window.cancelIdleCallback?.(P)}const C=setTimeout(p,1500);return()=>clearTimeout(C)},[]),a.jsxs(i,{sx:{p:3,maxWidth:1600,mx:"auto"},children:[a.jsx(m,{label:s,href:`/${e}/${s}`,onClick:()=>c(`/${e}/${s}`)}),a.jsx(y,{children:a.jsx(_,{label:"Edit",icon:a.jsx(z,{}),onClick:()=>c(`${d.replace(/\/$/,"")}/edit`)})}),a.jsx(F,{resourceUri:j({environmentName:e,packageName:s}),dashboard:n,givens:t,onGivensChange:r,onNavigate:l,onEvent:o,maxResultSize:1024*1024})]})}const q=L.lazy(()=>N(()=>import("./index.es-D0L4_L8o.js"),__vite__mapDeps([0,1,2,3])).then(e=>({default:e.DashboardEditor})));function V({environmentName:e,packageName:s,dashboardName:n}){const t=b(),{pathname:r}=$(),l=r.replace(/\/edit\/?$/,""),c=x.useMemo(()=>k({environmentName:e,packageName:s,dashboardName:n}),[e,s,n]);return a.jsxs(i,{sx:{p:3,maxWidth:1600,mx:"auto"},children:[a.jsx(m,{label:s,href:`/${e}/${s}`,onClick:()=>t(`/${e}/${s}`)}),a.jsx(x.Suspense,{fallback:a.jsxs(R,{sx:{gap:2},children:[a.jsx(y,{}),a.jsx(U,{text:"Opening the builder…"})]}),children:a.jsx(q,{environmentName:e,packageName:s,dashboardName:n,onExit:()=>t(l),onEvent:c})})]})}function B({environmentName:e,packageName:s,notebookPath:n}){const{params:t,onGivensChange:r}=v(),l=E(e,s),c=f();return a.jsxs(i,{sx:{p:3,maxWidth:1200,mx:"auto"},children:[a.jsx(m,{label:s,href:`/${e}/${s}`,onClick:d=>c(`/${e}/${s}`,d)}),a.jsx(D,{resourceUri:j({environmentName:e,packageName:s,modelPath:n}),maxResultSize:1024*1024,givens:t,onGivensChange:r,onNavigate:c,onDrillNavigate:l})]})}function H(){const e=I(),s=e["*"],{server:n}=S(),t=f();if(!e.environmentName)return a.jsx("div",{children:a.jsx("h2",{children:"Missing environment name"})});if(!e.packageName)return a.jsx("div",{children:a.jsx("h2",{children:"Missing package name"})});const r={p:3,maxWidth:1200,mx:"auto"};if(s?.startsWith("dashboards/")&&!s.endsWith(".malloy")&&!s.endsWith(".malloynb")){const o=s.slice(11);return o.endsWith("/edit")?a.jsx(V,{environmentName:e.environmentName,packageName:e.packageName,dashboardName:o.slice(0,-5)}):a.jsx(A,{environmentName:e.environmentName,packageName:e.packageName,dashboardName:o})}if(s?.startsWith("data-apps/")&&!s.endsWith(".malloy")&&!s.endsWith(".malloynb")){const o=s.slice(10),p=j({environmentName:e.environmentName,packageName:e.packageName,modelPath:o});return a.jsxs(i,{sx:r,children:[a.jsx(m,{label:e.packageName,href:`/${e.environmentName}/${e.packageName}`,onClick:u=>t(`/${e.environmentName}/${e.packageName}`,u)}),a.jsx(T,{resourceUri:p})]})}const l=j({environmentName:e.environmentName,packageName:e.packageName,modelPath:s});if(s?.endsWith(".malloy"))return a.jsxs(i,{sx:r,children:[a.jsx(m,{label:e.packageName,href:`/${e.environmentName}/${e.packageName}`,onClick:o=>t(`/${e.environmentName}/${e.packageName}`,o)}),a.jsx(M,{resourceUri:l,runOnDemand:!0,maxResultSize:512*1024})]});if(s?.endsWith(".malloynb"))return a.jsx(B,{environmentName:e.environmentName,packageName:e.packageName,notebookPath:s});const c=/\.[^./]+$/.test(s??""),d=O({server:n,environmentName:e.environmentName,packageName:e.packageName,path:s??""});return a.jsxs(i,{sx:r,children:[a.jsx(m,{label:e.packageName,href:`/${e.environmentName}/${e.packageName}`,onClick:o=>t(`/${e.environmentName}/${e.packageName}`,o)}),a.jsx(g,{variant:"h6",sx:{fontWeight:600},children:"Nothing to open at this path"}),a.jsxs(g,{variant:"body2",color:"text.secondary",sx:{mt:1},children:[a.jsx(i,{component:"span",sx:{fontFamily:h},children:s})," ","does not name a"," ",a.jsx(i,{component:"span",sx:{fontFamily:h},children:".malloy"})," ","or"," ",a.jsx(i,{component:"span",sx:{fontFamily:h},children:".malloynb"})," ","file in package"," ",a.jsx(i,{component:"span",sx:{fontFamily:h},children:e.packageName}),". This address opens"," ",a.jsx(i,{component:"span",sx:{fontFamily:h},children:".malloy"})," ","and"," ",a.jsx(i,{component:"span",sx:{fontFamily:h},children:".malloynb"})," ","files."]}),c&&a.jsxs(g,{variant:"body2",color:"text.secondary",sx:{mt:1},children:["A file from the package's"," ",a.jsx(i,{component:"span",sx:{fontFamily:h},children:"public/"})," ","directory is served at ",a.jsx(w,{href:d,children:d}),"."]}),a.jsx(g,{variant:"body2",color:"text.secondary",sx:{mt:1},children:"The package lists its models, notebooks, and data apps."})]})}export{H as default};
@@ -1 +0,0 @@
1
- import{L as r,J as t,j as e,a7 as c,ah as o}from"./index-DKvKsj6c.js";function h(){const{environmentName:a,packageName:s}=r(),n=t();if(a)if(s){const i=c({environmentName:a,packageName:s});return e.jsx(o,{onClickPackageFile:n,resourceUri:i})}else return e.jsx("div",{children:e.jsx("h2",{children:"Missing package name"})});else return e.jsx("div",{children:e.jsx("h2",{children:"Missing environment name"})})}export{h as default};
@@ -1,116 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DTfS9vNi.js","assets/index-DKvKsj6c.js","assets/index-DUqldpo0.css","assets/index-w_0OQJgZ.js"])))=>i.map(i=>d[i]);
2
- import{j,N as oe,r as p,az as ce,F as ue,n as he,aA as me,ao as be,aB as H,a8 as U,aC as ye,aD as fe,aE as pe,aF as ge,aG as ae}from"./index-DKvKsj6c.js";const v="publisher-drill";function ve(e,r){const t=new Set;let o;try{o=e.getMetadata()?.getAllFields()??[]}catch{return t}const l=new Set;for(const a of o)!a||r(a)||a.tag?.tag("hidden")===void 0&&l.add(a.tag?.text("label")??a.name);for(const a of o){if(!a||!r(a))continue;const n=a.tag?.text("label")??a.name;l.has(n)||t.add(n)}return t}function B(e){const r=/^\s*(\d+)/.exec(e.style?.gridColumn??"");return r?r[1]:void 0}function we(e,r){if(r.size!==0)for(const t of e.querySelectorAll(".malloy-table")){const o=n=>n.closest(".malloy-table")===t,l=new Set;for(const n of t.querySelectorAll(".column-cell.th")){if(!o(n))continue;const i=(n.textContent??"").replace(/\u200b/g,"").trim(),f=B(n);f&&r.has(i)&&l.add(f)}if(l.size===0)continue;const a=new Set;for(const n of t.querySelectorAll(`.${v}[tabindex="0"]`)){if(!o(n))continue;const i=B(n);i&&(a.has(i)?n.tabIndex=-1:a.add(i))}for(const n of t.querySelectorAll(".column-cell.td")){if(!o(n))continue;const i=B(n),f=!n.querySelector(".value-null")&&(n.textContent??"").trim()!=="";if(i&&f&&l.has(i)&&!n.querySelector(".malloy-table")){if(n.classList.add(v),n.tabIndex===0)a.add(i);else{const m=a.has(i);m||a.add(i),n.tabIndex=m?-1:0}n.setAttribute("role","button")}}}}function ke(e){const r=e.closest(".malloy-table"),t=B(e);return!r||!t?[]:Array.from(r.querySelectorAll(`.${v}`)).filter(o=>o.closest(".malloy-table")===r&&B(o)===t)}function ne(e,r){const t=ke(e),o=t.indexOf(e);if(o===-1)return;const l=r==="first"?t[0]:r==="last"?t[t.length-1]:t[Math.min(Math.max(o+r,0),t.length-1)];if(l){for(const a of t)a.tabIndex=a===l?0:-1;return l}}function xe(e){return{background:e.dashboardRoot,tableBackground:e.tableBackground,tableHeaderColor:e.tableHeader,tableBodyColor:e.tableBody,tableBorder:e.border,tablePinnedBackground:e.tableHeaderBackground,tablePinnedBorder:e.pinnedBorder,tableFontSize:`${e.font.size}px`,fontFamily:e.font.family,mapColor:e.mapColor}}function Ce(e){const{foreground:r,axisFaint:t,font:o}=e,l={background:e.background,font:o.family,title:{color:r,font:o.family},axis:{labelColor:r,titleColor:r,domainColor:t,tickColor:t,gridColor:t,labelFont:o.family,titleFont:o.family},legend:{labelColor:r,titleColor:r,labelFont:o.family,titleFont:o.family},header:{labelColor:r,titleColor:r},range:{category:e.series}};return a=>l}function Ee(e){if(!e)return;const r=e.tag("theme");if(!r)return;const t={},o=r.tag("palette");if(o){const a={},n=o.textArray("series");n&&n.length>0&&(a.series=n);for(const i of ce){const f=o.tag(i);if(!f)continue;const m={},w=f.text("light"),E=f.text("dark");w&&(m.light=w),E&&(m.dark=E),Object.keys(m).length>0&&(a[i]=m)}Object.keys(a).length>0&&(t.palette=a)}const l=r.tag("font");if(l){const a={},n=l.text("family");n&&(a.family=n);const i=l.numeric("size");typeof i=="number"&&Number.isFinite(i)&&(a.size=i),Object.keys(a).length>0&&(t.font=a)}return Object.keys(t).length>0?t:void 0}const Ae=async(e,r)=>{if(typeof window>"u")throw new Error("MalloyRenderer can only be used in browser environment");const{MalloyRenderer:t}=await U(async()=>{const{MalloyRenderer:o}=await import("./index-DSoCUF-f.js");return{MalloyRenderer:o}},[]);return new t({onClick:r,vegaConfigOverride:Ce(e),theme:xe(e),onError:o=>{console.error("Error rendering visualization:",typeof o,o)}}).createViz()};typeof window<"u"&&U(()=>import("./index-DSoCUF-f.js"),[]);async function Se(e){if(!e||typeof e!="object")return;const r=e,t=[...Array.isArray(r.model_annotations)?r.model_annotations:[],...Array.isArray(r.source_annotations)?r.source_annotations:[],...Array.isArray(r.annotations)?r.annotations:[]].map(l=>typeof l?.value=="string"?l.value:void 0).filter(l=>!!l);if(t.length===0)return;let o;try{({parseAnnotation:o}=await U(()=>import("./index-DTfS9vNi.js").then(l=>l.i),__vite__mapDeps([0,1,2,3])))}catch{return}try{const{tag:l}=o(t);return Ee(l)}catch(l){console.warn("Failed to parse # theme.* annotations; chart will render with the shell theme.",{error:l,lines:t});return}}function _e(e,r,t){const o=ye(r,t);for(const[l,a]of Object.entries(o))e.style.setProperty(l,a)}const Re=`
3
- /* Card geometry, through the renderer's OWN theme vars rather than over the top
4
- of them. It declares --malloy-theme--dashboard-* on .malloy-render itself and
5
- passes each through to the --malloy-render--* the card CSS reads, so a value
6
- inherited from our wrapper loses to that declaration however early it is set:
7
- this has to be a rule on the same element, at higher specificity. Doubling the
8
- class does that, and then no !important is needed — which matters, because
9
- !important here also lands on .dashboard-item-borderless and repaints a card
10
- the author asked to have no card. */
11
- .malloy-render.malloy-render {
12
- --malloy-theme--dashboard-card-radius: var(--publisher-dashboard-card-radius);
13
- --malloy-theme--dashboard-card-padding: var(--publisher-dashboard-card-padding);
14
- }
15
- /* dashboard.css hardcodes background: #f7f9fc on .malloy-dashboard
16
- and .dashboard-row-header, which would paint light grey in dark
17
- mode and also bleed an operator-picked palette.background across
18
- the panel chrome in light. Both surfaces use
19
- --malloy-render--background here, which buildMalloyExplicitTheme
20
- wires to dashboardRoot: a mode-keyed neutral that stays decoupled
21
- from palette.background (the chart canvas) on purpose. Selectors
22
- are duplicated at higher specificity to beat the renderer s own
23
- scoped rules. */
24
- .malloy-render .malloy-dashboard,
25
- .malloy-render.malloy-render .malloy-dashboard,
26
- div.malloy-render .malloy-dashboard {
27
- /* --publisher-dashboard-root is set on the outer Publisher wrapper
28
- (see buildTableCssVars) and stays decoupled from
29
- --malloy-render--background, which gets shadowed inside the
30
- renderer when a theme.background annotation is present. The
31
- dedicated var means the panel between tiles always paints the
32
- operator neutral dashboardRoot regardless of annotations. */
33
- background: var(--publisher-dashboard-root) !important;
34
- background-color: var(--publisher-dashboard-root) !important;
35
- color: var(--malloy-render--table-body-color) !important;
36
- }
37
- .malloy-render .malloy-dashboard .dashboard-row,
38
- .malloy-render .malloy-dashboard .dashboard-row-body,
39
- .malloy-render .malloy-dashboard .dashboard-row-header,
40
- .malloy-render.malloy-render .malloy-dashboard .dashboard-row-header,
41
- div.malloy-render .malloy-dashboard .dashboard-row-header {
42
- /* Belt + suspenders: dashboard.css hardcodes .dashboard-row-header
43
- to #f7f9fc, and row / row-body have no explicit background but
44
- get caught in any annotation-driven inline writes. Force all of
45
- them to the neutral panel colour. */
46
- background: var(--publisher-dashboard-root) !important;
47
- background-color: var(--publisher-dashboard-root) !important;
48
- }
49
- .malloy-render .malloy-dashboard .dashboard-item:not(.dashboard-item-borderless) {
50
- /* Tile padding around each chart / table. Uses our custom
51
- --malloy-render--tile-background so the operator can theme the
52
- tile separately from the table header row (which paints from
53
- --malloy-render--table-pinned-background below).
54
-
55
- A flat bordered card rather than the renderer's shadow ring, which is what
56
- makes it match the composite tile's Paper. :not(borderless) because
57
- # borderless asks for no card at all, and an !important background and
58
- border drew one anyway. */
59
- background: var(--malloy-render--tile-background) !important;
60
- color: var(--malloy-render--table-body-color) !important;
61
- box-shadow: none !important;
62
- border: var(--malloy-render--table-border) !important;
63
- }
64
- .malloy-render .malloy-dashboard .dashboard-row-header-separator {
65
- background: var(--malloy-render--table-border) !important;
66
- }
67
- .malloy-render .malloy-table .th.column-cell {
68
- /* Non-pinned tables have no header background in the renderer's
69
- own CSS (only pinned scrolled tables paint the pinned-header
70
- with this var). Force the same value here so every table has a
71
- visible header band reflecting the operator's choice. */
72
- background: var(--malloy-render--table-pinned-background) !important;
73
- }
74
- .malloy-render .dashboard-item-title,
75
- .malloy-render .dashboard-dimension-name {
76
- color: var(--malloy-render--label-color) !important;
77
- }
78
- .malloy-render .dashboard-item-value,
79
- .malloy-render .dashboard-item-value-measure,
80
- .malloy-render .dashboard-dimension-value {
81
- color: var(--malloy-render--value-color) !important;
82
- }
83
- .malloy-render .malloy-table,
84
- .malloy-render .malloy-list {
85
- color: var(--malloy-render--table-body-color) !important;
86
- }
87
- .malloy-render .column-cell.th,
88
- .malloy-render .cell-content.header {
89
- color: var(--malloy-render--table-header-color) !important;
90
- }
91
- /* A cell whose column declares a "# drill" this surface can honor, marked
92
- by markDrillableCells. Ordinary text with a pointer cursor until hovered,
93
- then it reads as a link: the same affordance Malloyyo gives the same tag,
94
- and the only thing that tells a reader a cell navigates. Kept off the
95
- resting state deliberately: a column painted blue competes with the data.
96
- (No backticks in here: this is inside a template literal.) */
97
- .malloy-render .${v} {
98
- cursor: pointer;
99
- }
100
- .malloy-render .${v}:hover > .cell-content {
101
- color: var(--publisher-drill-link) !important;
102
- text-decoration: underline;
103
- }
104
- /* Keyboard focus reads the same as hover, plus a ring: a hover colour is not
105
- something a keyboard user can produce, and a focus ring is not something a
106
- mouse user sees. focus-visible rather than focus, so a click does not leave a
107
- ring behind it. (No backticks in here: this is inside a template literal.) */
108
- .malloy-render .${v}:focus-visible {
109
- outline: 2px solid var(--publisher-drill-link);
110
- outline-offset: -2px;
111
- }
112
- .malloy-render .${v}:focus-visible > .cell-content {
113
- color: var(--publisher-drill-link) !important;
114
- text-decoration: underline;
115
- }
116
- `,le="publisher-malloy-renderer-overrides";function ze(){if(typeof document>"u"||document.getElementById(le))return;const e=document.createElement("style");e.id=le,e.textContent=Re,document.head.appendChild(e)}function Fe({result:e,height:r,drill:t,onSizeChange:o,onSizing:l}){const a=p.useRef(null),n=p.useRef(t);n.current=t;const i=p.useCallback(c=>{n.current?.onClick(c)},[]),f=t!==void 0,m=p.useRef(!1),w=p.useRef(null),E=p.useRef(0),{theme:J,layers:G,mode:K}=ue(),W=he().shape.borderRadius,X=p.useMemo(()=>({radius:`${W}px`,padding:`${me}px`}),[W]);return p.useEffect(()=>()=>{E.current+=1;const c=w.current;c?.viz.remove(),c?.node.remove(),w.current=null},[]),p.useLayoutEffect(()=>{if(!a.current||!e)return;ze();const c=a.current,se=E.current+=1;let I=!1;const N=()=>!I&&se===E.current;let d,b,T=null,q=0,L=null,$=null,P=null,F=null,O=null,M=null,Y=null,Q=0,A=null;m.current=!1;let g,S;const V=k=>{if(I||!k.firstElementChild||H(g,S)==="container")return;const D=fe(g,S);if(m.current&&!D)return;const x=pe(k,ae(g));x>0&&(m.current=!0,o&&x!==Q&&(Q=x,o(x)));const _=ge(k,ae(g));D&&_&&Y!==_&&(Y=_,M?.disconnect(),M=new ResizeObserver(()=>V(k)),M.observe(_))};return(async()=>{let k;try{k=JSON.parse(e)}catch(y){console.error("Error parsing visualization result:",y);return}const D=await Se(k),x=D?be([...G,D],K):J;if(!N())return;try{b=await Ae(x,i)}catch(y){console.error("Failed to create renderer:",y);return}if(!N()){b.remove(),b=void 0;return}const _=w.current;d=document.createElement("div"),d.style.width="100%",d.style.height="100%",_e(d,x,X),c.childElementCount>0&&(c.style.position="relative",d.style.position="absolute",d.style.inset="0",d.style.visibility="hidden"),c.appendChild(d);const h=d;F=new MutationObserver(()=>{O&&clearTimeout(O),O=setTimeout(()=>{V(h),m.current&&F?.disconnect()},100)}),F.observe(d,{childList:!0,subtree:!0,attributes:!0});const ie=b;let Z=!1;const ee=()=>{if(!(Z||!N())){Z=!0,A&&(clearTimeout(A),A=null),_?.viz.remove();for(const y of Array.from(c.children))y!==h&&c.removeChild(y);h.style.position="",h.style.inset="",h.style.visibility="",c.style.position="",w.current={viz:ie,node:h},V(h)}};try{b.setResult(k);try{const C=b.getMetadata(),R=C?.getRootField();g=R?.renderAs(),S=R?C?.getPluginsForField(R.key)?.[0]?.sizingStrategy:void 0}catch{g=void 0,S=void 0}l?.(H(g,S)),d.dataset.malloyRenderAs=g??"unknown",d.dataset.malloySizing=H(g,S),b.render(d);const y=n.current;try{if(y){const C=ve(b,y.canDrill),R=()=>{try{we(h,C)}catch(s){console.warn("Drill affordance skipped:",s)}};R();const re=s=>{const u=s.querySelector(".cell-content")??s,z=u.getBoundingClientRect();u.dispatchEvent(new MouseEvent("click",{bubbles:!0,cancelable:!0,view:u.ownerDocument.defaultView,clientX:Math.round(z.left+z.width/2),clientY:Math.round(z.bottom)}))},te=s=>s.target?.closest?.(`.${v}`)??null,de=(s,u)=>{ne(s,u)?.focus()};L=s=>{const u=te(s);if(!u)return;const z=s.key==="ArrowDown"?1:s.key==="ArrowUp"?-1:s.key==="Home"?"first":s.key==="End"?"last":void 0;if(z!==void 0){s.preventDefault(),de(u,z);return}s.key==="Enter"?(s.preventDefault(),re(u)):s.key===" "&&s.preventDefault()},$=s=>{if(s.key!==" ")return;const u=te(s);u&&(s.preventDefault(),re(u))},P=s=>{const u=s.target?.closest?.(`.${v}`);u&&ne(u,0)},h.addEventListener("keydown",L),h.addEventListener("keyup",$),h.addEventListener("focusin",P),C.size>0&&typeof MutationObserver<"u"&&(T=new MutationObserver(()=>{cancelAnimationFrame(q),q=requestAnimationFrame(R)}),T.observe(h,{childList:!0,subtree:!0}))}}catch(C){console.warn("Drill affordance skipped:",C)}b.onReady(ee),A=setTimeout(ee,1e4)}catch(y){console.error("Error rendering visualization:",y),F?.disconnect(),M?.disconnect(),T?.disconnect(),b.remove(),b=void 0,h.parentNode===c&&c.removeChild(h)}})(),()=>{I=!0,F?.disconnect(),M?.disconnect(),O&&clearTimeout(O),A&&clearTimeout(A),d&&w.current?.node!==d&&(L&&d.removeEventListener("keydown",L),$&&d.removeEventListener("keyup",$),P&&d.removeEventListener("focusin",P),T?.disconnect(),cancelAnimationFrame(q),b?.remove(),d.parentNode===c&&c.removeChild(d),c.style.position="")}},[e,i,f,o,l,J,G,K,X]),j.jsx("div",{ref:a,style:{width:"100%",height:r?`${r}px`:"400px"}})}function Oe(e){return typeof window>"u"?j.jsx(oe,{sx:{width:"100%",height:e.height?`${e.height}px`:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"text.secondary"},children:"Loading..."}):j.jsx(p.Suspense,{fallback:j.jsx(oe,{sx:{width:"100%",height:e.height?`${e.height}px`:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"text.secondary"},children:"Loading visualization..."}),children:j.jsx(Fe,{...e})})}const De=Object.freeze(Object.defineProperty({__proto__:null,default:Oe},Symbol.toStringTag,{value:"Module"}));export{v as D,Oe as R,Ce as a,xe as b,De as c,ve as d,we as m,Ee as r};