@graphysdk/react-renderer 1.9.0-beta.1795452877881 → 1.9.0-beta.1795453565720

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.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./index.css');const s=require("./history-chords-XyQ4K9-0.cjs");let m=require("@graphysdk/viz-engine"),u=require("react"),i=require("react/jsx-runtime"),Y=require("zustand"),V=require("motion/react"),J=require("zustand/vanilla"),X=require("clsx");X=s.__toESM(X,1);var ye="_1a5iqpb0",Ge="_1a5iqpb1";var be="_1a5iqpb3",Te="_1a5iqpb4",xe="_1a5iqpb5";var Q=({errors:e})=>{const[t,...r]=e;return(0,i.jsxs)("div",{role:"alert",className:ye,children:[(0,i.jsx)("strong",{className:Ge,children:"This chart could not be rendered."}),t&&(0,i.jsx)(ee,{diagnostic:t}),r.length>0&&(0,i.jsx)("ul",{className:"_1a5iqpb2",children:r.map((n,o)=>(0,i.jsx)("li",{children:(0,i.jsx)(ee,{diagnostic:n})},`${n.code}-${o}`))})]})},ee=({diagnostic:e})=>(0,i.jsxs)("div",{className:be,children:[(0,i.jsx)("span",{className:Te,children:e.code}),(0,i.jsx)("p",{className:xe,children:e.message}),e.suggestion&&(0,i.jsx)("p",{className:"_1a5iqpb6",children:e.suggestion})]});function Ee(e=[],t=[]){return e.length===t.length&&e.every((r,n)=>Object.is(r,t[n]))}var ce=class extends u.Component{constructor(...e){super(...e),this.state={caughtDiagnostic:null}}static getDerivedStateFromError(e){return{caughtDiagnostic:(0,m.buildDiagnostic)(e)}}componentDidCatch(e,t){const r=(0,m.buildDiagnostic)(e);s.logDiagnostics([r]),this.props.onError?.([r]),console.error("Chart render component stack:",t.componentStack)}componentDidUpdate(e){this.state.caughtDiagnostic&&!Ee(e.resetKeys,this.props.resetKeys)&&this.setState({caughtDiagnostic:null})}render(){const{caughtDiagnostic:e}=this.state;if(e)return(0,i.jsx)(Q,{errors:[e]});const{forcedErrors:t,children:r}=this.props;return t&&t.length>0?(0,i.jsx)(Q,{errors:t}):r}},le=e=>typeof e=="object"&&"geom"in e&&"render"in e,ue=e=>{const t=(0,m.resolveDefinition)(e);return t instanceof m.Geom?t:null},de=(e,t)=>{const r=e.filter(n=>Re(n,t));return r.length===e.length?e:r},Re=(e,t)=>e.kind==="annotation"?(0,m.findAnnotation)(t.annotations,e.id)!==null:e.kind==="observations"||e.kind==="layer"&&e.layerId!==void 0?(0,m.findLayerById)(t.layers,e.layerId)!==void 0:!0,te=[],Pe=()=>(0,J.createStore)(e=>({selection:te,setSelection:t=>e(r=>Ce(r.selection,t)?r:{selection:t}),clearSelection:()=>e(t=>t.selection.length===0?t:{selection:te})})),Ce=(e,t)=>e===t?!0:e.length!==t.length?!1:e.every((r,n)=>{const o=t[n];return o!==void 0&&(0,m.areEditTargetsEqual)(r,o)}),Ie=5,Ne=e=>{if(!s.IS_DEV)return{emit:()=>{},subscribe:()=>De,getLastTrigger:()=>null,getLastCompile:()=>null,getCacheStats:()=>e.getCacheStats()};const t=new Set;let r=null;return{emit:n=>{const o=e.getLastCompile();if(o){r=n;for(const c of t)c(n,o)}},subscribe:n=>(t.add(n),()=>{t.delete(n)}),getLastTrigger:()=>r,getLastCompile:()=>e.getLastCompile(),getCacheStats:()=>e.getCacheStats()}},je=()=>(0,J.createStore)(e=>({lastCompile:null,history:[],nextId:1,lastSnapshot:null,recordCompile:(t,r)=>e(n=>{if(n.lastSnapshot===r)return n;const o={id:n.nextId,label:we(t),stages:r.stages,stageDurationsMs:r.stageDurationsMs,durationMs:r.durationMs};return{lastCompile:o,history:Le(n.history,o,Ie),nextId:n.nextId+1,lastSnapshot:r}})})),De=()=>{},we=e=>{switch(e.kind){case"init":return"init";case"spec":return"spec change";case"data":return"data change";case"command":return e.command.metadata.description}},Le=(e,t,r)=>{const n=e.length>=r?e.length-(r-1):0;return[...e.slice(n),t]};function re(e){const t=e.filter(le),r=new Set([...Object.keys(s.BUILT_IN_GEOM_RENDERERS),...t.map(d=>d.geom)]),n=[],o=new Set;for(const d of e){const h=ue(d);h===null||r.has(h.type)||o.has(h.type)||(o.add(h.type),n.push({kind:"userInput",severity:"error",code:"MISSING_GEOM_RENDERER",message:`Custom geom '${h.type}' is registered but has no renderer.`,context:{requested:h.type,kind:"geom-renderer"},suggestion:`Add a render half for it: \`defineGeomRenderer(${h.type}Geom, { coord, render })\`, then include it in \`plugins\`.`}))}const c=new Map;for(const d of t){if("definition"in d)continue;const h=`${d.geom}|${d.coord}`,f=c.get(h);f?f.count+=1:c.set(h,{geom:d.geom,coord:d.coord,count:1})}const l=[];for(const{geom:d,coord:h,count:f}of c.values())f<2||l.push({kind:"userInput",severity:"warning",code:"DUPLICATE_REGISTERED_TYPE",message:`Multiple render-only overrides register ('${d}', '${h}') (${f} entries); the last in the array wins.`,context:{requested:`${d}@${h}`,kind:"geom-renderer"},suggestion:`Keep a single render-only override for ('${d}', '${h}').`});return l.push(...Be(e)),{errors:n,warnings:l}}function _e(e,t){const{coordSystem:r,layers:n}=e,o=new Set,c=[];for(const l of n)t(l.geom,r.type)!==null||o.has(l.geom)||(o.add(l.geom),c.push({kind:"userInput",severity:"warning",code:"MISSING_GEOM_RENDERER",message:`No renderer for geom '${l.geom}' under ${r.type} coords; the layer is not painted.`,context:{requested:l.geom,kind:"geom-renderer"},suggestion:`Register a renderer for ('${l.geom}', '${r.type}') via \`defineGeomRenderer\`.`}));return c}function ke(e,t){const{coordSystem:r,layers:n}=e,o=new Set,c=[];for(const l of n){if(l.interactive===!1||l.spatialKind!=="renderHitTest"||o.has(l.geom))continue;const d=t(l.geom,r.type);d===null||d.hitTest||s.isLiveRender(d)||(o.add(l.geom),c.push({kind:"userInput",severity:"warning",code:"MISSING_RENDER_HIT_TEST",message:`Geom '${l.geom}' declares spatialKind 'renderHitTest' but its renderer provides no hit-test; the layer has no hover.`,context:{requested:l.geom,kind:"geom-renderer"},suggestion:`Add a \`hitTest\` factory (precomputed geometry) or a live render (\`{ fn, options: { live: true } }\`, live simulation) to the renderer for ('${l.geom}', '${r.type}').`}))}return c}function qe(e){const t=new Set,r=[];for(const n of e.layers){const o=n.identityKey;n.interactive!==!1&&(n.spatialKind!=="renderHitTest"||typeof o!="object"||t.has(n.geom)||n.data.hasVariable(o.variable)||(t.add(n.geom),r.push({kind:"userInput",severity:"warning",code:"RENDER_HIT_TEST_IDENTITY",message:`Geom '${n.geom}' keys its identity on '${o.variable}', a column its compile output does not emit; its hover lookup is empty.`,context:{requested:n.geom,kind:"geom-renderer"},suggestion:`Emit the '${o.variable}' column from the geom's \`compile()\`, or point \`identityKey\` at a column it does emit.`})))}return r}function He(e,t){const{coordSystem:r,layers:n}=e,o=new Set,c=[];for(const l of n){if(l.interactive===!1||l.spatialKind!=="renderHitTest"||o.has(l.geom))continue;const d=t(l.geom,r.type);d===null||!d.hitTest||!s.isLiveRender(d)||(o.add(l.geom),c.push({kind:"userInput",severity:"warning",code:"CONFLICTING_RENDER_HIT_TEST",message:`Geom '${l.geom}' declares both a \`hitTest\` factory and a live render; these are alternatives, so only the live render is used.`,context:{requested:l.geom,kind:"geom-renderer"},suggestion:"Keep one: a `hitTest` factory for precomputed geometry, OR a live render (`{ fn, options: { live: true } }`) for a live simulation."}))}return c}function Me(e,t){const r=new Set,n=[];for(const o of e.layers)o.interactive!==!1&&(o.spatialKind!=="renderHitTest"||r.has(o.geom)||t.hasCapability(o.geom)||(r.add(o.geom),n.push({kind:"userInput",severity:"warning",code:"MISSING_ANCHOR_CAPABILITY",message:`Geom '${o.geom}' declares no \`resolveAnchorPosition\`; its observations cannot be annotated, so the editor overlay paints no creation trigger on them.`,context:{requested:o.geom,kind:"geom-renderer"},suggestion:"Implement `resolveAnchorPosition(observation, context)` on the geom, returning the normalised panel position an annotation on that observation belongs at."})));return n}function Ae(e,t){const{coordSystem:r,layers:n}=e,o=new Set,c=[];for(const l of n){if(l.interactive===!1||l.spatialKind==="renderHitTest"||o.has(l.geom))continue;const d=t(l.geom,r.type);d===null||!s.isLiveRender(d)||(o.add(l.geom),c.push({kind:"userInput",severity:"warning",code:"LIVE_RENDER_REQUIRES_RENDER_HIT_TEST",message:`Geom '${l.geom}' declares a live render but its layer's spatialKind is '${l.spatialKind}', not 'renderHitTest'; its push-path hover resolves to nothing.`,context:{requested:l.geom,kind:"geom-renderer"},suggestion:"Have the geom's manifest yield spatialKind 'renderHitTest' so the scene layer carries the `byKey` index the live render's `pushHover` resolves against."}))}return c}function Oe(e,t){let r;return e.layers.flatMap((n,o)=>s.isLiveRender(t(n.geom,e.coordSystem.type))?$e(n)?(r??=(0,m.createStyleResolver)().readers(e),(r.geom(n).get("overpaint",void 0,"hovered")?.length??0)===0?[]:[{kind:"userInput",severity:"warning",code:"INVALID_STYLE_RULE",message:`Style 'overpaint' in state 'hovered' is not supported on live geom '${n.geom}' (layer '${n.id}'); it is ignored.`,context:{param:"overpaint",layerIndex:o,requested:n.geom},suggestion:"Remove the hovered overpaint, or paint the hover treatment in the geom's live render."}]):[]:[])}var $e=e=>[e.styles.defaults,e.styles.overrides].some(t=>t.some(r=>r.state==="hovered"&&(r.declarations.overpaint?.length??0)>0));function Be(e){const t=new Set,r=[];for(const n of e){const o=ue(n);o===null||t.has(o.type)||o.dataLabelCoordTypes.length===0||o.getDataLabelPlacements!==void 0||(t.add(o.type),r.push({kind:"userInput",severity:"warning",code:"MISSING_DATA_LABEL_PLACEMENT",message:`Geom '${o.type}' declares \`dataLabelCoordTypes\` but implements no \`getDataLabelPlacements\`; its layers paint no data labels.`,context:{requested:o.type,kind:"geom-renderer"},suggestion:"Implement `getDataLabelPlacements(context)` on the geom, or drop `dataLabelCoordTypes` so the compiler warns the author off the flag."}))}return r}var Fe=e=>(0,J.createStore)(t=>({scene:e,setScene:r=>t(n=>n.scene===r?n:{scene:r})})),Ke=({spec:e,data:t,colorScheme:r,plugins:n,theme:o,resolveRenderer:c,anchorResolver:l,onSpecChange:d,onError:h,onWarnings:f})=>{const y=s.useLatestRef(d),j=s.useLatestRef(h),P=s.useLatestRef(f),[{session:v,compileBus:p,findGeom:b}]=(0,u.useState)(()=>{const a=(0,m.createCompiler)({plugins:n,theme:o});return{session:new m.GraphCompilationSession(a),compileBus:Ne(a),findGeom:g=>a.findGeom(g)}}),[S]=(0,u.useState)(()=>{const a=re(n??[]),g=re(o?.plugins??[]);return{errors:[...g.errors,...a.errors],warnings:[...g.warnings,...a.warnings]}}),D=(0,u.useRef)(null),[E]=(0,u.useState)(ze),T=(0,u.useRef)(null),C=(0,u.useCallback)(a=>S.errors.length===0?a:[...S.errors,...a??[]],[S]),w=(0,u.useCallback)(a=>{if(!a.ok)return a.errors;if(T.current)T.current.getState().setScene(a.scene);else{const g=Fe(a.scene);g.subscribe(E.notify),T.current=g,E.notify()}return null},[E]),[R,q]=(0,u.useState)(()=>{const a=v.compile({spec:e,data:t,colorScheme:r});return D.current=a,C(w(a))}),I=(0,u.useCallback)(a=>a.ok?[...a.warnings,..._e(a.scene,c),...ke(a.scene,c),...qe(a.scene),...He(a.scene,c),...Ae(a.scene,c),...Oe(a.scene,c),...Me(a.scene,l)]:a.warnings,[c,l]),G=(0,u.useCallback)(a=>{a.length!==0&&(s.logDiagnostics(a),j.current?.(a))},[j]),N=(0,u.useCallback)(a=>{a.length!==0&&(s.logDiagnostics(a),P.current?.(a))},[P]);(0,u.useEffect)(()=>{const a=D.current;a&&(G([...S.errors,...a.ok?[]:a.errors]),N([...S.warnings,...I(a)]),a.ok&&p.emit({kind:"init"}))},[p,G,N,S,I]),(0,u.useEffect)(()=>{const a=v.update({spec:e,data:t,colorScheme:r});if(!a)return;a.committedSpec&&y.current?.(a.committedSpec);const g=w(a.result);q(C(g)),g&&G(g),N(I(a.result)),g||p.emit({kind:a.hasSpecChange?"spec":"data"})},[e,t,r,v,p,w,G,N,C,I,y]);const H=(0,u.useCallback)(a=>{q(g=>g===null?g:C(null)),N(I(a))},[C,N,I]),M=(0,u.useCallback)(a=>{a.scene&&T.current?.getState().setScene(a.scene),a.result&&H(a.result),a.command&&p.emit({kind:"command",command:a.command}),a.spec&&y.current?.(a.spec),a.errors&&G([...a.errors])},[H,p,y,G]),x=(0,u.useCallback)(a=>{for(const g of a)M(g);return a.some(g=>!!g.scene)},[M]),L=(0,u.useCallback)((a,g)=>{x(v.applyCommand(a,g))},[v,x]),B=(0,u.useCallback)(()=>{x(v.commit())},[v,x]),A=(0,u.useCallback)(()=>x(v.undo()),[v,x]),O=(0,u.useCallback)(()=>x(v.redo()),[v,x]),W=(0,u.useCallback)(a=>{const g=v.preview(a).find(z=>z.scene)?.scene;return g?(T.current?.getState().setScene(g),!0):!1},[v]),F=(0,u.useCallback)(()=>{const a=v.scene;a&&T.current?.getState().setScene(a)},[v]),_=(0,u.useMemo)(()=>({stack:v.history,undo:A,redo:O}),[v,A,O]),K=(0,u.useCallback)(()=>T.current?.getState().scene??null,[]);return{store:T.current,dispatch:L,commit:B,paintPreview:W,clearPreview:F,history:_,subscribe:E.subscribe,getScene:K,compileBus:p,compileErrors:R,findGeom:b}},ze=()=>{const e=new Set;return{subscribe:t=>(e.add(t),()=>{e.delete(t)}),notify:()=>e.forEach(t=>t())}},Ue=["cartesian","polar"],me=({data:e,spec:t,plugins:r=[],theme:n,glyphs:o,formattingLocale:c,handleRef:l,onSpecChange:d,onError:h,onWarnings:f,colorScheme:y="light",mode:j=s.GRAPH_MODES.readonly,children:P})=>{const v=s.resolveGraphMode(j),p=Ye(c,f),[b]=(0,u.useState)(()=>n),[S]=(0,u.useState)(()=>s.mergeGlyphs(n?.glyphs,o)),D=b?.colorScheme??y,[E]=(0,u.useState)(()=>s.createGeomRendererResolver([...b?.plugins??[],...r].filter(le)));We(E,S);const T=(0,u.useId)(),[C]=(0,u.useState)(()=>(0,m.createAnchorResolver)(r)),[w]=(0,u.useState)(()=>(0,m.createDataLabelPlacementResolver)(r)),[R]=(0,u.useState)(()=>Pe()),[q]=(0,u.useState)(()=>s.createTargetBoundaryStore()),I=(0,u.useMemo)(()=>(0,m.createStyleResolver)({colorScheme:D}),[D]),{store:G,dispatch:N,commit:H,paintPreview:M,clearPreview:x,history:L,subscribe:B,getScene:A,compileBus:O,compileErrors:W,findGeom:F}=Ke({spec:t,data:e,colorScheme:D,plugins:r,theme:b,resolveRenderer:E,anchorResolver:C,onSpecChange:d,onError:h,onWarnings:f});(0,u.useEffect)(()=>{if(G)return G.subscribe((a,g)=>{if(a.scene.spec===g.scene.spec)return;const{selection:z,setSelection:Se}=R.getState();z.length!==0&&Se(de(z,a.scene.spec))})},[G,R]);const _=(0,u.useMemo)(()=>({dispatch:N,commit:H,paintPreview:M,clearPreview:x}),[N,H,M,x]);(0,u.useImperativeHandle)(l,()=>({commands:_,undo:L.undo,redo:L.redo,subscribe:B,getScene:A,formattingLocale:p,getSelection:()=>R.getState().selection,setSelection:a=>R.getState().setSelection(a),subscribeSelection:R.subscribe,canPlaceDataLabels:w.hasCapability,canFormatDataLabelsAsPercentages:w.hasPercentageFormat,getGlyphs:()=>S,getPointSymbols:a=>E("point",a)?.symbols}),[_,L,B,A,p,R,w,S,E]);const K=(0,u.useMemo)(()=>G?{chartId:T,store:G,selectionStore:R,targetBoundaryStore:q,commands:_,history:L,formattingLocale:p,compileBus:O,colorScheme:D,mode:v,styleResolver:I,anchorResolver:C,findGeom:F}:null,[T,G,R,q,_,L,p,O,D,v,I,C,F]);return(0,i.jsx)(ce,{forcedErrors:W,onError:h,resetKeys:[t,e],children:K?(0,i.jsx)(s.GraphContext.Provider,{value:K,children:(0,i.jsx)(s.GeomRendererResolverProvider,{value:E,children:(0,i.jsx)(s.DataLabelPlacementResolverProvider,{value:w,children:(0,i.jsx)(s.GeomShapesProvider,{shapes:b?.shapes,children:(0,i.jsx)(s.GlyphRegistryProvider,{glyphs:S,children:P})})})})}):null})},Ve=(e,t)=>(e??[]).filter(r=>!(0,m.isGeometricSymbol)(r)&&!t.has(r)),We=(e,t)=>{(0,u.useEffect)(()=>{if(!s.IS_DEV)return;const r=new Set(t.map(({name:n})=>n));for(const n of Ue)for(const o of Ve(e("point",n)?.symbols,r))console.warn(`[graphy] The ${n} point renderer lists "${o}", but no glyph has that name. The shape menu offers it, and SymbolFigure draws the first listed symbol in its place.`)},[e,t])},Ye=(e,t)=>{const r=s.useLatestRef(t);return(0,u.useEffect)(()=>{if(e===void 0||(0,m.findIntlLocale)(e)!==void 0)return;const n=[{severity:"warning",kind:"userInput",code:"INVALID_FORMATTING_LOCALE",message:`formattingLocale '${e}' is not a tag Intl can format in, so the chart formats in ${m.DEFAULT_LOCALE}.`}];s.logDiagnostics(n),r.current?.(n)},[e,r]),e===void 0?void 0:(0,m.canonicalizeLocale)(e)};function Xe({theme:e,glyphs:t,...r}={}){const n=(0,m.createSpecBuilder)(r);return{...n,GraphProvider:c=>(0,i.jsx)(me,{...c,plugins:n.plugins,theme:e,glyphs:t})}}var k=(e,t)=>{if(typeof e=="number")return Number.isFinite(e)?e:null;if(!e.endsWith("%"))return null;const r=Number.parseFloat(e);return Number.isFinite(r)?r/100*t:null},Qe=({x:e,y:t,width:r,height:n},o)=>{const c=k(e,o.width),l=k(t,o.height),d=k(r,o.width),h=k(n,o.height);return c===null||l===null||d===null||h===null?null:{x:c,y:l,width:d,height:h}},he=({animateTransitions:e,cx:t,cy:r,r:n,effects:o,...c})=>{const l=s.toGeomEffectsStyle(o);return e?(0,i.jsx)(V.motion.circle,{initial:!1,animate:{cx:t,cy:r,r:n},transition:s.DEFAULT_SPRING_TRANSITION,style:l,...c}):(0,i.jsx)("circle",{cx:t,cy:r,r:n,style:l,...c})},ge=({animateTransitions:e,x1:t,y1:r,x2:n,y2:o,effects:c,...l})=>{const d=s.toGeomEffectsStyle(c);return e?(0,i.jsx)(V.motion.line,{initial:!1,animate:{x1:t,y1:r,x2:n,y2:o},transition:s.DEFAULT_SPRING_TRANSITION,style:d,...l}):(0,i.jsx)("line",{x1:t,y1:r,x2:n,y2:o,style:d,...l})},pe=({animateTransitions:e,x:t,y:r,width:n,height:o,rx:c,ry:l,effects:d,...h})=>{const f=s.toGeomEffectsStyle(d);return e?(0,i.jsx)(V.motion.rect,{initial:!1,animate:{attrX:t,attrY:r,width:n,height:o,...c!==void 0&&l!==void 0?{rx:c,ry:l}:{}},transition:s.DEFAULT_SPRING_TRANSITION,style:f,...h}):(0,i.jsx)("rect",{x:t,y:r,width:n,height:o,rx:c,ry:l,style:f,...h})},fe=({animateTransitions:e,d:t,source:r,effects:n,...o})=>{const c=s.toGeomEffectsStyle(n);return e?(0,i.jsx)(rt,{d:t,source:r,style:c,...o}):(0,i.jsx)("path",{d:t,style:c,...o})},Je=e=>{const{Circle:t}=s.useGeomShapes(),{animateTransitions:r}=s.useGraphAnimation(),{symbol:n,...o}=e,c={...o,animateTransitions:r};return n!==void 0&&n!=="circle"?(0,i.jsx)("g",{style:s.toGeomEffectsStyle(e.effects),"data-testid":e["data-testid"],children:(0,i.jsx)(s.PointSymbol,{symbol:n,cx:ne(e.cx),cy:ne(e.cy),size:e.r*2,fill:e.fill??"currentColor",fillOpacity:e.fillOpacity,opacity:e.opacity,stroke:e.stroke,strokeOpacity:e.strokeOpacity,strokeWidth:e.strokeWidth,motion:r?{transition:s.DEFAULT_SPRING_TRANSITION,intro:!1,fadesIn:!1}:null})}):t===void 0?he(c):(0,i.jsx)(s.GeomShapesProvider,{children:(0,i.jsx)(t,{...c})})},Ze=e=>{const{Line:t}=s.useGeomShapes(),{animateTransitions:r}=s.useGraphAnimation(),n={...e,animateTransitions:r};return t===void 0?ge(n):(0,i.jsx)(s.GeomShapesProvider,{children:(0,i.jsx)(t,{...n})})},et=({cornerRadius:e,...t})=>{const{Rect:r}=s.useGeomShapes(),n=s.useGeomViewport()?.size??null,o=s.useGeomPixelsPerUnit(),{animateTransitions:c}=s.useGraphAnimation(),l={...t,animateTransitions:c,...nt(e,t,n,o)};return r===void 0?pe(l):(0,i.jsx)(s.GeomShapesProvider,{children:(0,i.jsx)(r,{...l})})},tt=e=>{const{Path:t}=s.useGeomShapes(),{animateTransitions:r}=s.useGraphAnimation(),n={...e,animateTransitions:r};return t===void 0?fe(n):(0,i.jsx)(s.GeomShapesProvider,{children:(0,i.jsx)(t,{...n})})},ne=e=>typeof e=="number"?`${e}px`:e,rt=({d:e,source:t,...r})=>{const n=s.useSvgPathMorph(e,s.DEFAULT_SPRING_TRANSITION,t);return(0,i.jsx)(V.motion.path,{d:n,...r})},nt=(e,t,r,n)=>{if(e===void 0)return{};const o=(0,m.foldGeomCornerRadii)(e);if(o===void 0)return{};const c=st(t,r,n);if(c===null)return o==="full"?{}:oe((0,m.resolveGeomCornerRadiusPx)({cornerRadius:o}),n);const l=Math.min((0,m.resolveGeomCornerRadiusPx)({cornerRadius:o,box:c}),Math.min(c.width,c.height)/2);return oe(l,n)},st=(e,t,r)=>{const n=se(e.width,t?.width,r.x),o=se(e.height,t?.height,r.y);return n===null||o===null?null:{width:n,height:o}},se=(e,t,r)=>{if(typeof e=="number")return Number.isFinite(e)?Math.abs(e)*r:null;if(t===void 0)return null;const n=k(e,t);return n===null?null:Math.abs(n)},oe=(e,t)=>t.x<=0||t.y<=0?{rx:0,ry:0}:{rx:e/t.x,ry:e/t.y},ot=({symbol:e,size:t,fill:r,fillOpacity:n,stroke:o,strokeOpacity:c,strokeWidth:l})=>{const d=s.useGlyphRegistry(),h=s.useGeomRendererResolver(),f=s.useSceneSelector(P=>P.coordSystem.type),y=it(e,h("point",f)?.symbols??[],d),j={size:t,fill:r,fillOpacity:n,stroke:o,strokeOpacity:c,strokeWidth:l};return(0,m.isGeometricSymbol)(y)?(0,i.jsx)("path",{d:(0,m.buildPointSymbolPath)(y,t),fill:r,fillOpacity:n,stroke:o,strokeOpacity:c,strokeWidth:l,strokeLinejoin:"round"}):(0,i.jsx)(s.GlyphMark,{symbol:y,glyphs:d,...j})},it=(e,t,r)=>(0,m.isImageSymbol)(e)||t.includes(e)||!(0,m.isGeometricSymbol)(e)&&r.has(e)?e:t[0]??"circle",at=({children:e,...t})=>{const r=s.useGeomViewport()?.size??null;return(0,i.jsx)("svg",{viewBox:"0 0 1 1",preserveAspectRatio:"none",width:"100%",height:"100%",pointerEvents:"none",...t,children:(0,i.jsx)(s.GeomViewportProvider,{size:r,space:"unit",children:e})})},ct=({box:e,children:t})=>{const r=s.useGeomViewportSize(),n=r===null?null:r.width*(e.x1-e.x0),o=r===null?null:r.height*(e.y1-e.y0),c=(0,u.useMemo)(()=>n===null||o===null?null:{width:n,height:o},[n,o]);return(0,i.jsx)("svg",{x:(0,m.toPercent)(e.x0),y:(0,m.toPercent)(e.y0),width:(0,m.toPercent)(e.x1-e.x0),height:(0,m.toPercent)(e.y1-e.y0),overflow:"hidden",pointerEvents:"none",children:(0,i.jsx)(s.GeomViewportProvider,{size:c,children:t})})},lt="drqe3u0",ut="drqe3u1",dt="drqe3u2",mt="drqe3u3",$="drqe3u4",ht="drqe3u5",gt="drqe3u6",pt="drqe3u7",U="drqe3u8",ft="drqe3u9",vt="drqe3ua";var St="drqe3uc",yt="drqe3ud",Gt="drqe3ue",bt="drqe3uf";var Tt="drqe3uh",xt="drqe3ui",ie={enabled:"drqe3uk drqe3uj",disabled:"drqe3ul drqe3uj"},ae={ran:"drqe3un drqe3um",dim:"drqe3uo drqe3um"},ve={ran:"drqe3uq drqe3up",cached:"drqe3ur drqe3up",untouched:"drqe3us drqe3up"},Et=({width:e=440,style:t,className:r}={})=>{const{compileBus:n}=s.useGraphContext(),[o]=(0,u.useState)(()=>je()),[c,l]=(0,u.useState)(!1),[d,h]=(0,u.useState)(m.isCompilerCachingEnabled);(0,u.useEffect)(()=>{const{recordCompile:p}=o.getState(),b=n.getLastTrigger(),S=n.getLastCompile();return b&&S&&p(b,S),n.subscribe(p)},[o,n]);const f=(0,Y.useStore)(o,p=>p.lastCompile),y=(0,Y.useStore)(o,p=>p.history),j=n.getCacheStats(),P=f===null&&y.length===0,v=()=>{h(p=>{const b=!p;return(0,m.setCompilerCachingEnabled)(b),b})};return(0,i.jsxs)("div",{className:(0,X.default)(vt,r),style:{width:e,...t},children:[(0,i.jsxs)("div",{className:lt,children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{className:ut,children:"compile cache"}),(0,i.jsx)("div",{className:Gt,children:P?"production: stats disabled":f?`last: ${f.label} · ${Z(f.durationMs)}`:"awaiting first compile…"})]}),(0,i.jsx)("button",{type:"button",onClick:()=>l(p=>!p),className:bt,children:c?"▾":"▴"})]}),!c&&(0,i.jsxs)("div",{className:"drqe3ub",children:[(0,i.jsxs)("button",{type:"button",onClick:v,className:d?ie.enabled:ie.disabled,"aria-pressed":d,children:["cache ",d?"enabled":"disabled"]}),(0,i.jsx)("span",{className:"drqe3ug",children:"next compile reflects this toggle"})]}),!c&&!P&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(Rt,{delta:f?.stages,durations:f?.stageDurationsMs,cumulative:j}),(0,i.jsx)(Pt,{entries:y})]})]})},Rt=({delta:e,durations:t,cumulative:r})=>(0,i.jsxs)("table",{className:dt,children:[(0,i.jsx)("thead",{children:(0,i.jsxs)("tr",{className:Tt,children:[(0,i.jsx)("th",{className:mt,children:"stage"}),(0,i.jsx)("th",{className:$,children:"time"}),(0,i.jsx)("th",{className:$,children:"Δ miss"}),(0,i.jsx)("th",{className:$,children:"Δ hit"}),(0,i.jsx)("th",{className:$,children:"total miss"}),(0,i.jsx)("th",{className:$,children:"total hit"})]})}),(0,i.jsx)("tbody",{children:m.COMPILER_STAGE_KEYS.map(n=>{const o=e?.[n],c=Ct(o);return(0,i.jsxs)("tr",{className:St,children:[(0,i.jsxs)("td",{className:ht,children:[(0,i.jsx)("span",{className:ve[c],"aria-hidden":!0})," ",n]}),(0,i.jsx)("td",{className:U,children:t===void 0||c==="untouched"?"—":Z(t[n])}),(0,i.jsx)("td",{className:c==="ran"?ae.ran:ae.dim,children:o?.misses??0}),(0,i.jsx)("td",{className:U,children:o?.hits??0}),(0,i.jsx)("td",{className:U,children:r[n].misses}),(0,i.jsx)("td",{className:U,children:r[n].hits})]},n)})})]}),Pt=({entries:e})=>e.length===0?null:(0,i.jsxs)("div",{className:yt,children:[(0,i.jsx)("div",{className:xt,children:"recent compiles"}),e.map(t=>{const r=It(t.stages,c=>c.misses>0),n=m.COMPILER_STAGE_KEYS.length,o=r===0?"cached":"ran";return(0,i.jsxs)("div",{className:gt,children:[(0,i.jsx)("span",{className:ve[o],"aria-hidden":!0}),(0,i.jsx)("span",{className:pt,title:t.label,children:t.label}),(0,i.jsxs)("span",{className:ft,children:[r,"/",n," ran · ",Z(t.durationMs)]})]},t.id)})]}),Ct=e=>!e||e.hits===0&&e.misses===0?"untouched":e.misses>0?"ran":"cached",It=(e,t)=>{let r=0;for(const n of m.COMPILER_STAGE_KEYS)t(e[n])&&(r+=1);return r},Z=e=>e<.1?"<0.1ms":e>=10?`${e.toFixed(0)}ms`:`${e.toFixed(2)}ms`,Nt=()=>{const{history:e}=s.useGraphContext(),{stack:t,undo:r,redo:n}=e,o=(0,u.useCallback)(d=>t.subscribe(d),[t]),c=(0,u.useCallback)(()=>t.getSnapshot(),[t]),l=(0,u.useSyncExternalStore)(o,c,c);return(0,u.useMemo)(()=>({...l,undo:r,redo:n}),[l,r,n])},jt=new Set(["button","checkbox","color","file","hidden","image","radio","range","reset","submit"]),Dt=(e,t={})=>{const{target:r,enabled:n=!0}=t;(0,u.useEffect)(()=>{const o=wt(r);if(!n||!o)return;const c=l=>{if(!Lt(l)||l.defaultPrevented||_t(l.target))return;const d=s.resolveHistoryStep(l);if(!d)return;const h=e.current;h&&(d==="undo"?h.undo():h.redo())&&l.preventDefault()};return o.addEventListener("keydown",c),()=>o.removeEventListener("keydown",c)},[e,r,n])},wt=e=>e===void 0?window:e!==null&&"current"in e?e.current:e,Lt=e=>"key"in e,_t=e=>e instanceof HTMLInputElement?!jt.has(e.type):e instanceof HTMLElement?e.isContentEditable||e.tagName==="TEXTAREA":!1,kt=()=>{const{targetBoundaryStore:e}=s.useGraphContext();return(0,Y.useStore)(e,t=>t.boundary)};exports.CanvasTextMeasurer=s.CanvasTextMeasurer;exports.DefaultFooter=s.DefaultFooter;exports.DefaultGeomCircle=he;exports.DefaultGeomLine=ge;exports.DefaultGeomPath=fe;exports.DefaultGeomRect=pe;exports.DefaultGrid=s.DefaultGrid;exports.DefaultHeader=s.DefaultHeader;exports.DefaultSwatch=s.DefaultSwatch;exports.DefaultTooltip=s.DefaultTooltip;exports.DevToolsPanel=Et;exports.GRAPH_MODES=s.GRAPH_MODES;exports.GeomCircle=Je;exports.GeomLine=Ze;exports.GeomOverpaint=s.GeomOverpaint;exports.GeomPanelSizeProvider=s.GeomPanelSizeProvider;exports.GeomPath=tt;exports.GeomRect=et;exports.GraphErrorBoundary=ce;exports.GraphErrorPanel=Q;exports.GraphProvider=me;exports.GraphRenderer=s.GraphRenderer;exports.GraphyBadge=s.GraphyBadge;exports.HoverProvider=s.HoverProvider;exports.IntlProvider=s.ChartIntlProvider;exports.IntroFade=s.IntroFade;exports.IntroWipeClip=s.IntroWipeClip;exports.SymbolFigure=ot;exports.TextMeasurerProvider=s.TextMeasurerProvider;exports.ThemeProvider=s.ThemeProvider;exports.UnitBoxSvg=ct;exports.UnitSpaceSvg=at;exports.buildDotsEditOutlineShapes=s.buildDotsEditOutlineShapes;exports.createGraphyKit=Xe;exports.darkTheme=s.darkTheme;exports.defineGeomRenderer=s.defineGeomRenderer;exports.defineGlyph=s.defineGlyph;exports.getBuiltInEditOutlineShapes=s.getBuiltInEditOutlineShapes;exports.lightTheme=s.lightTheme;exports.lightenCss=s.lightenCss;exports.pruneSelection=de;exports.readPositionPixels=k;exports.readRectPixels=Qe;exports.resolveGraphyBadgeVariant=s.resolveGraphyBadgeVariant;exports.resolvePathStroke=s.resolvePathStroke;exports.scalePointToPanel=s.scalePointToPanel;exports.stampAxisEditTarget=s.stampAxisEditTarget;exports.stampGridEditTarget=s.stampGridEditTarget;exports.stampLegendEditTarget=s.stampLegendEditTarget;exports.useElementScreenRect=s.useElementScreenRect;exports.useFormattingLocale=s.useFormattingLocale;exports.useGeomHitTest=s.useGeomHitTest;exports.useGeomHover=s.useGeomHover;exports.useGeomPanelSize=s.useGeomPanelSize;exports.useGeomReaderTree=s.useGeomReaderTree;exports.useGeomStyleReader=s.useGeomStyleReader;exports.useGeomViewportSize=s.useGeomViewportSize;exports.useGraphAnimation=s.useGraphAnimation;exports.useGraphCommands=s.useGraphCommands;exports.useGraphHandle=s.useGraphHandle;exports.useGraphHistory=Nt;exports.useGraphHistoryShortcuts=Dt;exports.useGraphLocale=s.useGraphLocale;exports.useGraphSelection=s.useGraphSelection;exports.useGuidesTakePress=s.useGuidesTakePress;exports.useHandleScene=s.useHandleScene;exports.useHoverState=s.useHoverState;exports.usePaintDefs=s.usePaintDefs;exports.useResolvedStyle=s.useResolvedStyle;exports.useSceneSelector=s.useSceneSelector;exports.useStyleReaderTree=s.useStyleReaderTree;exports.useStyleResolver=s.useStyleResolver;exports.useTargetBoundary=kt;exports.useTextMeasurer=s.useTextMeasurer;exports.vars=s.vars;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./index.css');const s=require("./history-chords-CSLX6WQ7.cjs");let m=require("@graphysdk/viz-engine"),u=require("react"),i=require("react/jsx-runtime"),Y=require("zustand"),V=require("motion/react"),J=require("zustand/vanilla"),X=require("clsx");X=s.__toESM(X,1);var ye="_1a5iqpb0",Ge="_1a5iqpb1";var be="_1a5iqpb3",Te="_1a5iqpb4",xe="_1a5iqpb5";var Q=({errors:e})=>{const[t,...r]=e;return(0,i.jsxs)("div",{role:"alert",className:ye,children:[(0,i.jsx)("strong",{className:Ge,children:"This chart could not be rendered."}),t&&(0,i.jsx)(ee,{diagnostic:t}),r.length>0&&(0,i.jsx)("ul",{className:"_1a5iqpb2",children:r.map((n,o)=>(0,i.jsx)("li",{children:(0,i.jsx)(ee,{diagnostic:n})},`${n.code}-${o}`))})]})},ee=({diagnostic:e})=>(0,i.jsxs)("div",{className:be,children:[(0,i.jsx)("span",{className:Te,children:e.code}),(0,i.jsx)("p",{className:xe,children:e.message}),e.suggestion&&(0,i.jsx)("p",{className:"_1a5iqpb6",children:e.suggestion})]});function Ee(e=[],t=[]){return e.length===t.length&&e.every((r,n)=>Object.is(r,t[n]))}var ce=class extends u.Component{constructor(...e){super(...e),this.state={caughtDiagnostic:null}}static getDerivedStateFromError(e){return{caughtDiagnostic:(0,m.buildDiagnostic)(e)}}componentDidCatch(e,t){const r=(0,m.buildDiagnostic)(e);s.logDiagnostics([r]),this.props.onError?.([r]),console.error("Chart render component stack:",t.componentStack)}componentDidUpdate(e){this.state.caughtDiagnostic&&!Ee(e.resetKeys,this.props.resetKeys)&&this.setState({caughtDiagnostic:null})}render(){const{caughtDiagnostic:e}=this.state;if(e)return(0,i.jsx)(Q,{errors:[e]});const{forcedErrors:t,children:r}=this.props;return t&&t.length>0?(0,i.jsx)(Q,{errors:t}):r}},le=e=>typeof e=="object"&&"geom"in e&&"render"in e,ue=e=>{const t=(0,m.resolveDefinition)(e);return t instanceof m.Geom?t:null},de=(e,t)=>{const r=e.filter(n=>Re(n,t));return r.length===e.length?e:r},Re=(e,t)=>e.kind==="annotation"?(0,m.findAnnotation)(t.annotations,e.id)!==null:e.kind==="observations"||e.kind==="layer"&&e.layerId!==void 0?(0,m.findLayerById)(t.layers,e.layerId)!==void 0:!0,te=[],Pe=()=>(0,J.createStore)(e=>({selection:te,setSelection:t=>e(r=>Ce(r.selection,t)?r:{selection:t}),clearSelection:()=>e(t=>t.selection.length===0?t:{selection:te})})),Ce=(e,t)=>e===t?!0:e.length!==t.length?!1:e.every((r,n)=>{const o=t[n];return o!==void 0&&(0,m.areEditTargetsEqual)(r,o)}),Ie=5,Ne=e=>{if(!s.IS_DEV)return{emit:()=>{},subscribe:()=>De,getLastTrigger:()=>null,getLastCompile:()=>null,getCacheStats:()=>e.getCacheStats()};const t=new Set;let r=null;return{emit:n=>{const o=e.getLastCompile();if(o){r=n;for(const c of t)c(n,o)}},subscribe:n=>(t.add(n),()=>{t.delete(n)}),getLastTrigger:()=>r,getLastCompile:()=>e.getLastCompile(),getCacheStats:()=>e.getCacheStats()}},je=()=>(0,J.createStore)(e=>({lastCompile:null,history:[],nextId:1,lastSnapshot:null,recordCompile:(t,r)=>e(n=>{if(n.lastSnapshot===r)return n;const o={id:n.nextId,label:we(t),stages:r.stages,stageDurationsMs:r.stageDurationsMs,durationMs:r.durationMs};return{lastCompile:o,history:Le(n.history,o,Ie),nextId:n.nextId+1,lastSnapshot:r}})})),De=()=>{},we=e=>{switch(e.kind){case"init":return"init";case"spec":return"spec change";case"data":return"data change";case"command":return e.command.metadata.description}},Le=(e,t,r)=>{const n=e.length>=r?e.length-(r-1):0;return[...e.slice(n),t]};function re(e){const t=e.filter(le),r=new Set([...Object.keys(s.BUILT_IN_GEOM_RENDERERS),...t.map(d=>d.geom)]),n=[],o=new Set;for(const d of e){const h=ue(d);h===null||r.has(h.type)||o.has(h.type)||(o.add(h.type),n.push({kind:"userInput",severity:"error",code:"MISSING_GEOM_RENDERER",message:`Custom geom '${h.type}' is registered but has no renderer.`,context:{requested:h.type,kind:"geom-renderer"},suggestion:`Add a render half for it: \`defineGeomRenderer(${h.type}Geom, { coord, render })\`, then include it in \`plugins\`.`}))}const c=new Map;for(const d of t){if("definition"in d)continue;const h=`${d.geom}|${d.coord}`,f=c.get(h);f?f.count+=1:c.set(h,{geom:d.geom,coord:d.coord,count:1})}const l=[];for(const{geom:d,coord:h,count:f}of c.values())f<2||l.push({kind:"userInput",severity:"warning",code:"DUPLICATE_REGISTERED_TYPE",message:`Multiple render-only overrides register ('${d}', '${h}') (${f} entries); the last in the array wins.`,context:{requested:`${d}@${h}`,kind:"geom-renderer"},suggestion:`Keep a single render-only override for ('${d}', '${h}').`});return l.push(...Be(e)),{errors:n,warnings:l}}function _e(e,t){const{coordSystem:r,layers:n}=e,o=new Set,c=[];for(const l of n)t(l.geom,r.type)!==null||o.has(l.geom)||(o.add(l.geom),c.push({kind:"userInput",severity:"warning",code:"MISSING_GEOM_RENDERER",message:`No renderer for geom '${l.geom}' under ${r.type} coords; the layer is not painted.`,context:{requested:l.geom,kind:"geom-renderer"},suggestion:`Register a renderer for ('${l.geom}', '${r.type}') via \`defineGeomRenderer\`.`}));return c}function ke(e,t){const{coordSystem:r,layers:n}=e,o=new Set,c=[];for(const l of n){if(l.interactive===!1||l.spatialKind!=="renderHitTest"||o.has(l.geom))continue;const d=t(l.geom,r.type);d===null||d.hitTest||s.isLiveRender(d)||(o.add(l.geom),c.push({kind:"userInput",severity:"warning",code:"MISSING_RENDER_HIT_TEST",message:`Geom '${l.geom}' declares spatialKind 'renderHitTest' but its renderer provides no hit-test; the layer has no hover.`,context:{requested:l.geom,kind:"geom-renderer"},suggestion:`Add a \`hitTest\` factory (precomputed geometry) or a live render (\`{ fn, options: { live: true } }\`, live simulation) to the renderer for ('${l.geom}', '${r.type}').`}))}return c}function qe(e){const t=new Set,r=[];for(const n of e.layers){const o=n.identityKey;n.interactive!==!1&&(n.spatialKind!=="renderHitTest"||typeof o!="object"||t.has(n.geom)||n.data.hasVariable(o.variable)||(t.add(n.geom),r.push({kind:"userInput",severity:"warning",code:"RENDER_HIT_TEST_IDENTITY",message:`Geom '${n.geom}' keys its identity on '${o.variable}', a column its compile output does not emit; its hover lookup is empty.`,context:{requested:n.geom,kind:"geom-renderer"},suggestion:`Emit the '${o.variable}' column from the geom's \`compile()\`, or point \`identityKey\` at a column it does emit.`})))}return r}function He(e,t){const{coordSystem:r,layers:n}=e,o=new Set,c=[];for(const l of n){if(l.interactive===!1||l.spatialKind!=="renderHitTest"||o.has(l.geom))continue;const d=t(l.geom,r.type);d===null||!d.hitTest||!s.isLiveRender(d)||(o.add(l.geom),c.push({kind:"userInput",severity:"warning",code:"CONFLICTING_RENDER_HIT_TEST",message:`Geom '${l.geom}' declares both a \`hitTest\` factory and a live render; these are alternatives, so only the live render is used.`,context:{requested:l.geom,kind:"geom-renderer"},suggestion:"Keep one: a `hitTest` factory for precomputed geometry, OR a live render (`{ fn, options: { live: true } }`) for a live simulation."}))}return c}function Me(e,t){const r=new Set,n=[];for(const o of e.layers)o.interactive!==!1&&(o.spatialKind!=="renderHitTest"||r.has(o.geom)||t.hasCapability(o.geom)||(r.add(o.geom),n.push({kind:"userInput",severity:"warning",code:"MISSING_ANCHOR_CAPABILITY",message:`Geom '${o.geom}' declares no \`resolveAnchorPosition\`; its observations cannot be annotated, so the editor overlay paints no creation trigger on them.`,context:{requested:o.geom,kind:"geom-renderer"},suggestion:"Implement `resolveAnchorPosition(observation, context)` on the geom, returning the normalised panel position an annotation on that observation belongs at."})));return n}function Ae(e,t){const{coordSystem:r,layers:n}=e,o=new Set,c=[];for(const l of n){if(l.interactive===!1||l.spatialKind==="renderHitTest"||o.has(l.geom))continue;const d=t(l.geom,r.type);d===null||!s.isLiveRender(d)||(o.add(l.geom),c.push({kind:"userInput",severity:"warning",code:"LIVE_RENDER_REQUIRES_RENDER_HIT_TEST",message:`Geom '${l.geom}' declares a live render but its layer's spatialKind is '${l.spatialKind}', not 'renderHitTest'; its push-path hover resolves to nothing.`,context:{requested:l.geom,kind:"geom-renderer"},suggestion:"Have the geom's manifest yield spatialKind 'renderHitTest' so the scene layer carries the `byKey` index the live render's `pushHover` resolves against."}))}return c}function Oe(e,t){let r;return e.layers.flatMap((n,o)=>s.isLiveRender(t(n.geom,e.coordSystem.type))?$e(n)?(r??=(0,m.createStyleResolver)().readers(e),(r.geom(n).get("overpaint",void 0,"hovered")?.length??0)===0?[]:[{kind:"userInput",severity:"warning",code:"INVALID_STYLE_RULE",message:`Style 'overpaint' in state 'hovered' is not supported on live geom '${n.geom}' (layer '${n.id}'); it is ignored.`,context:{param:"overpaint",layerIndex:o,requested:n.geom},suggestion:"Remove the hovered overpaint, or paint the hover treatment in the geom's live render."}]):[]:[])}var $e=e=>[e.styles.defaults,e.styles.overrides].some(t=>t.some(r=>r.state==="hovered"&&(r.declarations.overpaint?.length??0)>0));function Be(e){const t=new Set,r=[];for(const n of e){const o=ue(n);o===null||t.has(o.type)||o.dataLabelCoordTypes.length===0||o.getDataLabelPlacements!==void 0||(t.add(o.type),r.push({kind:"userInput",severity:"warning",code:"MISSING_DATA_LABEL_PLACEMENT",message:`Geom '${o.type}' declares \`dataLabelCoordTypes\` but implements no \`getDataLabelPlacements\`; its layers paint no data labels.`,context:{requested:o.type,kind:"geom-renderer"},suggestion:"Implement `getDataLabelPlacements(context)` on the geom, or drop `dataLabelCoordTypes` so the compiler warns the author off the flag."}))}return r}var Fe=e=>(0,J.createStore)(t=>({scene:e,setScene:r=>t(n=>n.scene===r?n:{scene:r})})),Ke=({spec:e,data:t,colorScheme:r,plugins:n,theme:o,resolveRenderer:c,anchorResolver:l,onSpecChange:d,onError:h,onWarnings:f})=>{const y=s.useLatestRef(d),j=s.useLatestRef(h),P=s.useLatestRef(f),[{session:v,compileBus:p,findGeom:b}]=(0,u.useState)(()=>{const a=(0,m.createCompiler)({plugins:n,theme:o});return{session:new m.GraphCompilationSession(a),compileBus:Ne(a),findGeom:g=>a.findGeom(g)}}),[S]=(0,u.useState)(()=>{const a=re(n??[]),g=re(o?.plugins??[]);return{errors:[...g.errors,...a.errors],warnings:[...g.warnings,...a.warnings]}}),D=(0,u.useRef)(null),[E]=(0,u.useState)(ze),T=(0,u.useRef)(null),C=(0,u.useCallback)(a=>S.errors.length===0?a:[...S.errors,...a??[]],[S]),w=(0,u.useCallback)(a=>{if(!a.ok)return a.errors;if(T.current)T.current.getState().setScene(a.scene);else{const g=Fe(a.scene);g.subscribe(E.notify),T.current=g,E.notify()}return null},[E]),[R,q]=(0,u.useState)(()=>{const a=v.compile({spec:e,data:t,colorScheme:r});return D.current=a,C(w(a))}),I=(0,u.useCallback)(a=>a.ok?[...a.warnings,..._e(a.scene,c),...ke(a.scene,c),...qe(a.scene),...He(a.scene,c),...Ae(a.scene,c),...Oe(a.scene,c),...Me(a.scene,l)]:a.warnings,[c,l]),G=(0,u.useCallback)(a=>{a.length!==0&&(s.logDiagnostics(a),j.current?.(a))},[j]),N=(0,u.useCallback)(a=>{a.length!==0&&(s.logDiagnostics(a),P.current?.(a))},[P]);(0,u.useEffect)(()=>{const a=D.current;a&&(G([...S.errors,...a.ok?[]:a.errors]),N([...S.warnings,...I(a)]),a.ok&&p.emit({kind:"init"}))},[p,G,N,S,I]),(0,u.useEffect)(()=>{const a=v.update({spec:e,data:t,colorScheme:r});if(!a)return;a.committedSpec&&y.current?.(a.committedSpec);const g=w(a.result);q(C(g)),g&&G(g),N(I(a.result)),g||p.emit({kind:a.hasSpecChange?"spec":"data"})},[e,t,r,v,p,w,G,N,C,I,y]);const H=(0,u.useCallback)(a=>{q(g=>g===null?g:C(null)),N(I(a))},[C,N,I]),M=(0,u.useCallback)(a=>{a.scene&&T.current?.getState().setScene(a.scene),a.result&&H(a.result),a.command&&p.emit({kind:"command",command:a.command}),a.spec&&y.current?.(a.spec),a.errors&&G([...a.errors])},[H,p,y,G]),x=(0,u.useCallback)(a=>{for(const g of a)M(g);return a.some(g=>!!g.scene)},[M]),L=(0,u.useCallback)((a,g)=>{x(v.applyCommand(a,g))},[v,x]),B=(0,u.useCallback)(()=>{x(v.commit())},[v,x]),A=(0,u.useCallback)(()=>x(v.undo()),[v,x]),O=(0,u.useCallback)(()=>x(v.redo()),[v,x]),W=(0,u.useCallback)(a=>{const g=v.preview(a).find(z=>z.scene)?.scene;return g?(T.current?.getState().setScene(g),!0):!1},[v]),F=(0,u.useCallback)(()=>{const a=v.scene;a&&T.current?.getState().setScene(a)},[v]),_=(0,u.useMemo)(()=>({stack:v.history,undo:A,redo:O}),[v,A,O]),K=(0,u.useCallback)(()=>T.current?.getState().scene??null,[]);return{store:T.current,dispatch:L,commit:B,paintPreview:W,clearPreview:F,history:_,subscribe:E.subscribe,getScene:K,compileBus:p,compileErrors:R,findGeom:b}},ze=()=>{const e=new Set;return{subscribe:t=>(e.add(t),()=>{e.delete(t)}),notify:()=>e.forEach(t=>t())}},Ue=["cartesian","polar"],me=({data:e,spec:t,plugins:r=[],theme:n,glyphs:o,formattingLocale:c,handleRef:l,onSpecChange:d,onError:h,onWarnings:f,colorScheme:y="light",mode:j=s.GRAPH_MODES.readonly,children:P})=>{const v=s.resolveGraphMode(j),p=Ye(c,f),[b]=(0,u.useState)(()=>n),[S]=(0,u.useState)(()=>s.mergeGlyphs(n?.glyphs,o)),D=b?.colorScheme??y,[E]=(0,u.useState)(()=>s.createGeomRendererResolver([...b?.plugins??[],...r].filter(le)));We(E,S);const T=(0,u.useId)(),[C]=(0,u.useState)(()=>(0,m.createAnchorResolver)(r)),[w]=(0,u.useState)(()=>(0,m.createDataLabelPlacementResolver)(r)),[R]=(0,u.useState)(()=>Pe()),[q]=(0,u.useState)(()=>s.createTargetBoundaryStore()),I=(0,u.useMemo)(()=>(0,m.createStyleResolver)({colorScheme:D}),[D]),{store:G,dispatch:N,commit:H,paintPreview:M,clearPreview:x,history:L,subscribe:B,getScene:A,compileBus:O,compileErrors:W,findGeom:F}=Ke({spec:t,data:e,colorScheme:D,plugins:r,theme:b,resolveRenderer:E,anchorResolver:C,onSpecChange:d,onError:h,onWarnings:f});(0,u.useEffect)(()=>{if(G)return G.subscribe((a,g)=>{if(a.scene.spec===g.scene.spec)return;const{selection:z,setSelection:Se}=R.getState();z.length!==0&&Se(de(z,a.scene.spec))})},[G,R]);const _=(0,u.useMemo)(()=>({dispatch:N,commit:H,paintPreview:M,clearPreview:x}),[N,H,M,x]);(0,u.useImperativeHandle)(l,()=>({commands:_,undo:L.undo,redo:L.redo,subscribe:B,getScene:A,formattingLocale:p,getSelection:()=>R.getState().selection,setSelection:a=>R.getState().setSelection(a),subscribeSelection:R.subscribe,canPlaceDataLabels:w.hasCapability,canFormatDataLabelsAsPercentages:w.hasPercentageFormat,getGlyphs:()=>S,getPointSymbols:a=>E("point",a)?.symbols}),[_,L,B,A,p,R,w,S,E]);const K=(0,u.useMemo)(()=>G?{chartId:T,store:G,selectionStore:R,targetBoundaryStore:q,commands:_,history:L,formattingLocale:p,compileBus:O,colorScheme:D,mode:v,styleResolver:I,anchorResolver:C,findGeom:F}:null,[T,G,R,q,_,L,p,O,D,v,I,C,F]);return(0,i.jsx)(ce,{forcedErrors:W,onError:h,resetKeys:[t,e],children:K?(0,i.jsx)(s.GraphContext.Provider,{value:K,children:(0,i.jsx)(s.GeomRendererResolverProvider,{value:E,children:(0,i.jsx)(s.DataLabelPlacementResolverProvider,{value:w,children:(0,i.jsx)(s.GeomShapesProvider,{shapes:b?.shapes,children:(0,i.jsx)(s.GlyphRegistryProvider,{glyphs:S,children:P})})})})}):null})},Ve=(e,t)=>(e??[]).filter(r=>!(0,m.isGeometricSymbol)(r)&&!t.has(r)),We=(e,t)=>{(0,u.useEffect)(()=>{if(!s.IS_DEV)return;const r=new Set(t.map(({name:n})=>n));for(const n of Ue)for(const o of Ve(e("point",n)?.symbols,r))console.warn(`[graphy] The ${n} point renderer lists "${o}", but no glyph has that name. The shape menu offers it, and SymbolFigure draws the first listed symbol in its place.`)},[e,t])},Ye=(e,t)=>{const r=s.useLatestRef(t);return(0,u.useEffect)(()=>{if(e===void 0||(0,m.findIntlLocale)(e)!==void 0)return;const n=[{severity:"warning",kind:"userInput",code:"INVALID_FORMATTING_LOCALE",message:`formattingLocale '${e}' is not a tag Intl can format in, so the chart formats in ${m.DEFAULT_LOCALE}.`}];s.logDiagnostics(n),r.current?.(n)},[e,r]),e===void 0?void 0:(0,m.canonicalizeLocale)(e)};function Xe({theme:e,glyphs:t,...r}={}){const n=(0,m.createSpecBuilder)(r);return{...n,GraphProvider:c=>(0,i.jsx)(me,{...c,plugins:n.plugins,theme:e,glyphs:t})}}var k=(e,t)=>{if(typeof e=="number")return Number.isFinite(e)?e:null;if(!e.endsWith("%"))return null;const r=Number.parseFloat(e);return Number.isFinite(r)?r/100*t:null},Qe=({x:e,y:t,width:r,height:n},o)=>{const c=k(e,o.width),l=k(t,o.height),d=k(r,o.width),h=k(n,o.height);return c===null||l===null||d===null||h===null?null:{x:c,y:l,width:d,height:h}},he=({animateTransitions:e,cx:t,cy:r,r:n,effects:o,...c})=>{const l=s.toGeomEffectsStyle(o);return e?(0,i.jsx)(V.motion.circle,{initial:!1,animate:{cx:t,cy:r,r:n},transition:s.DEFAULT_SPRING_TRANSITION,style:l,...c}):(0,i.jsx)("circle",{cx:t,cy:r,r:n,style:l,...c})},ge=({animateTransitions:e,x1:t,y1:r,x2:n,y2:o,effects:c,...l})=>{const d=s.toGeomEffectsStyle(c);return e?(0,i.jsx)(V.motion.line,{initial:!1,animate:{x1:t,y1:r,x2:n,y2:o},transition:s.DEFAULT_SPRING_TRANSITION,style:d,...l}):(0,i.jsx)("line",{x1:t,y1:r,x2:n,y2:o,style:d,...l})},pe=({animateTransitions:e,x:t,y:r,width:n,height:o,rx:c,ry:l,effects:d,...h})=>{const f=s.toGeomEffectsStyle(d);return e?(0,i.jsx)(V.motion.rect,{initial:!1,animate:{attrX:t,attrY:r,width:n,height:o,...c!==void 0&&l!==void 0?{rx:c,ry:l}:{}},transition:s.DEFAULT_SPRING_TRANSITION,style:f,...h}):(0,i.jsx)("rect",{x:t,y:r,width:n,height:o,rx:c,ry:l,style:f,...h})},fe=({animateTransitions:e,d:t,source:r,effects:n,...o})=>{const c=s.toGeomEffectsStyle(n);return e?(0,i.jsx)(rt,{d:t,source:r,style:c,...o}):(0,i.jsx)("path",{d:t,style:c,...o})},Je=e=>{const{Circle:t}=s.useGeomShapes(),{animateTransitions:r}=s.useGraphAnimation(),{symbol:n,...o}=e,c={...o,animateTransitions:r};return n!==void 0&&n!=="circle"?(0,i.jsx)("g",{style:s.toGeomEffectsStyle(e.effects),"data-testid":e["data-testid"],children:(0,i.jsx)(s.PointSymbol,{symbol:n,cx:ne(e.cx),cy:ne(e.cy),size:e.r*2,fill:e.fill??"currentColor",fillOpacity:e.fillOpacity,opacity:e.opacity,stroke:e.stroke,strokeOpacity:e.strokeOpacity,strokeWidth:e.strokeWidth,motion:r?{transition:s.DEFAULT_SPRING_TRANSITION,intro:!1,fadesIn:!1}:null})}):t===void 0?he(c):(0,i.jsx)(s.GeomShapesProvider,{children:(0,i.jsx)(t,{...c})})},Ze=e=>{const{Line:t}=s.useGeomShapes(),{animateTransitions:r}=s.useGraphAnimation(),n={...e,animateTransitions:r};return t===void 0?ge(n):(0,i.jsx)(s.GeomShapesProvider,{children:(0,i.jsx)(t,{...n})})},et=({cornerRadius:e,...t})=>{const{Rect:r}=s.useGeomShapes(),n=s.useGeomViewport()?.size??null,o=s.useGeomPixelsPerUnit(),{animateTransitions:c}=s.useGraphAnimation(),l={...t,animateTransitions:c,...nt(e,t,n,o)};return r===void 0?pe(l):(0,i.jsx)(s.GeomShapesProvider,{children:(0,i.jsx)(r,{...l})})},tt=e=>{const{Path:t}=s.useGeomShapes(),{animateTransitions:r}=s.useGraphAnimation(),n={...e,animateTransitions:r};return t===void 0?fe(n):(0,i.jsx)(s.GeomShapesProvider,{children:(0,i.jsx)(t,{...n})})},ne=e=>typeof e=="number"?`${e}px`:e,rt=({d:e,source:t,...r})=>{const n=s.useSvgPathMorph(e,s.DEFAULT_SPRING_TRANSITION,t);return(0,i.jsx)(V.motion.path,{d:n,...r})},nt=(e,t,r,n)=>{if(e===void 0)return{};const o=(0,m.foldGeomCornerRadii)(e);if(o===void 0)return{};const c=st(t,r,n);if(c===null)return o==="full"?{}:oe((0,m.resolveGeomCornerRadiusPx)({cornerRadius:o}),n);const l=Math.min((0,m.resolveGeomCornerRadiusPx)({cornerRadius:o,box:c}),Math.min(c.width,c.height)/2);return oe(l,n)},st=(e,t,r)=>{const n=se(e.width,t?.width,r.x),o=se(e.height,t?.height,r.y);return n===null||o===null?null:{width:n,height:o}},se=(e,t,r)=>{if(typeof e=="number")return Number.isFinite(e)?Math.abs(e)*r:null;if(t===void 0)return null;const n=k(e,t);return n===null?null:Math.abs(n)},oe=(e,t)=>t.x<=0||t.y<=0?{rx:0,ry:0}:{rx:e/t.x,ry:e/t.y},ot=({symbol:e,size:t,fill:r,fillOpacity:n,stroke:o,strokeOpacity:c,strokeWidth:l})=>{const d=s.useGlyphRegistry(),h=s.useGeomRendererResolver(),f=s.useSceneSelector(P=>P.coordSystem.type),y=it(e,h("point",f)?.symbols??[],d),j={size:t,fill:r,fillOpacity:n,stroke:o,strokeOpacity:c,strokeWidth:l};return(0,m.isGeometricSymbol)(y)?(0,i.jsx)("path",{d:(0,m.buildPointSymbolPath)(y,t),fill:r,fillOpacity:n,stroke:o,strokeOpacity:c,strokeWidth:l,strokeLinejoin:"round"}):(0,i.jsx)(s.GlyphMark,{symbol:y,glyphs:d,...j})},it=(e,t,r)=>(0,m.isImageSymbol)(e)||t.includes(e)||!(0,m.isGeometricSymbol)(e)&&r.has(e)?e:t[0]??"circle",at=({children:e,...t})=>{const r=s.useGeomViewport()?.size??null;return(0,i.jsx)("svg",{viewBox:"0 0 1 1",preserveAspectRatio:"none",width:"100%",height:"100%",pointerEvents:"none",...t,children:(0,i.jsx)(s.GeomViewportProvider,{size:r,space:"unit",children:e})})},ct=({box:e,children:t})=>{const r=s.useGeomViewportSize(),n=r===null?null:r.width*(e.x1-e.x0),o=r===null?null:r.height*(e.y1-e.y0),c=(0,u.useMemo)(()=>n===null||o===null?null:{width:n,height:o},[n,o]);return(0,i.jsx)("svg",{x:(0,m.toPercent)(e.x0),y:(0,m.toPercent)(e.y0),width:(0,m.toPercent)(e.x1-e.x0),height:(0,m.toPercent)(e.y1-e.y0),overflow:"hidden",pointerEvents:"none",children:(0,i.jsx)(s.GeomViewportProvider,{size:c,children:t})})},lt="drqe3u0",ut="drqe3u1",dt="drqe3u2",mt="drqe3u3",$="drqe3u4",ht="drqe3u5",gt="drqe3u6",pt="drqe3u7",U="drqe3u8",ft="drqe3u9",vt="drqe3ua";var St="drqe3uc",yt="drqe3ud",Gt="drqe3ue",bt="drqe3uf";var Tt="drqe3uh",xt="drqe3ui",ie={enabled:"drqe3uk drqe3uj",disabled:"drqe3ul drqe3uj"},ae={ran:"drqe3un drqe3um",dim:"drqe3uo drqe3um"},ve={ran:"drqe3uq drqe3up",cached:"drqe3ur drqe3up",untouched:"drqe3us drqe3up"},Et=({width:e=440,style:t,className:r}={})=>{const{compileBus:n}=s.useGraphContext(),[o]=(0,u.useState)(()=>je()),[c,l]=(0,u.useState)(!1),[d,h]=(0,u.useState)(m.isCompilerCachingEnabled);(0,u.useEffect)(()=>{const{recordCompile:p}=o.getState(),b=n.getLastTrigger(),S=n.getLastCompile();return b&&S&&p(b,S),n.subscribe(p)},[o,n]);const f=(0,Y.useStore)(o,p=>p.lastCompile),y=(0,Y.useStore)(o,p=>p.history),j=n.getCacheStats(),P=f===null&&y.length===0,v=()=>{h(p=>{const b=!p;return(0,m.setCompilerCachingEnabled)(b),b})};return(0,i.jsxs)("div",{className:(0,X.default)(vt,r),style:{width:e,...t},children:[(0,i.jsxs)("div",{className:lt,children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{className:ut,children:"compile cache"}),(0,i.jsx)("div",{className:Gt,children:P?"production: stats disabled":f?`last: ${f.label} · ${Z(f.durationMs)}`:"awaiting first compile…"})]}),(0,i.jsx)("button",{type:"button",onClick:()=>l(p=>!p),className:bt,children:c?"▾":"▴"})]}),!c&&(0,i.jsxs)("div",{className:"drqe3ub",children:[(0,i.jsxs)("button",{type:"button",onClick:v,className:d?ie.enabled:ie.disabled,"aria-pressed":d,children:["cache ",d?"enabled":"disabled"]}),(0,i.jsx)("span",{className:"drqe3ug",children:"next compile reflects this toggle"})]}),!c&&!P&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(Rt,{delta:f?.stages,durations:f?.stageDurationsMs,cumulative:j}),(0,i.jsx)(Pt,{entries:y})]})]})},Rt=({delta:e,durations:t,cumulative:r})=>(0,i.jsxs)("table",{className:dt,children:[(0,i.jsx)("thead",{children:(0,i.jsxs)("tr",{className:Tt,children:[(0,i.jsx)("th",{className:mt,children:"stage"}),(0,i.jsx)("th",{className:$,children:"time"}),(0,i.jsx)("th",{className:$,children:"Δ miss"}),(0,i.jsx)("th",{className:$,children:"Δ hit"}),(0,i.jsx)("th",{className:$,children:"total miss"}),(0,i.jsx)("th",{className:$,children:"total hit"})]})}),(0,i.jsx)("tbody",{children:m.COMPILER_STAGE_KEYS.map(n=>{const o=e?.[n],c=Ct(o);return(0,i.jsxs)("tr",{className:St,children:[(0,i.jsxs)("td",{className:ht,children:[(0,i.jsx)("span",{className:ve[c],"aria-hidden":!0})," ",n]}),(0,i.jsx)("td",{className:U,children:t===void 0||c==="untouched"?"—":Z(t[n])}),(0,i.jsx)("td",{className:c==="ran"?ae.ran:ae.dim,children:o?.misses??0}),(0,i.jsx)("td",{className:U,children:o?.hits??0}),(0,i.jsx)("td",{className:U,children:r[n].misses}),(0,i.jsx)("td",{className:U,children:r[n].hits})]},n)})})]}),Pt=({entries:e})=>e.length===0?null:(0,i.jsxs)("div",{className:yt,children:[(0,i.jsx)("div",{className:xt,children:"recent compiles"}),e.map(t=>{const r=It(t.stages,c=>c.misses>0),n=m.COMPILER_STAGE_KEYS.length,o=r===0?"cached":"ran";return(0,i.jsxs)("div",{className:gt,children:[(0,i.jsx)("span",{className:ve[o],"aria-hidden":!0}),(0,i.jsx)("span",{className:pt,title:t.label,children:t.label}),(0,i.jsxs)("span",{className:ft,children:[r,"/",n," ran · ",Z(t.durationMs)]})]},t.id)})]}),Ct=e=>!e||e.hits===0&&e.misses===0?"untouched":e.misses>0?"ran":"cached",It=(e,t)=>{let r=0;for(const n of m.COMPILER_STAGE_KEYS)t(e[n])&&(r+=1);return r},Z=e=>e<.1?"<0.1ms":e>=10?`${e.toFixed(0)}ms`:`${e.toFixed(2)}ms`,Nt=()=>{const{history:e}=s.useGraphContext(),{stack:t,undo:r,redo:n}=e,o=(0,u.useCallback)(d=>t.subscribe(d),[t]),c=(0,u.useCallback)(()=>t.getSnapshot(),[t]),l=(0,u.useSyncExternalStore)(o,c,c);return(0,u.useMemo)(()=>({...l,undo:r,redo:n}),[l,r,n])},jt=new Set(["button","checkbox","color","file","hidden","image","radio","range","reset","submit"]),Dt=(e,t={})=>{const{target:r,enabled:n=!0}=t;(0,u.useEffect)(()=>{const o=wt(r);if(!n||!o)return;const c=l=>{if(!Lt(l)||l.defaultPrevented||_t(l.target))return;const d=s.resolveHistoryStep(l);if(!d)return;const h=e.current;h&&(d==="undo"?h.undo():h.redo())&&l.preventDefault()};return o.addEventListener("keydown",c),()=>o.removeEventListener("keydown",c)},[e,r,n])},wt=e=>e===void 0?window:e!==null&&"current"in e?e.current:e,Lt=e=>"key"in e,_t=e=>e instanceof HTMLInputElement?!jt.has(e.type):e instanceof HTMLElement?e.isContentEditable||e.tagName==="TEXTAREA":!1,kt=()=>{const{targetBoundaryStore:e}=s.useGraphContext();return(0,Y.useStore)(e,t=>t.boundary)};exports.CanvasTextMeasurer=s.CanvasTextMeasurer;exports.DefaultFooter=s.DefaultFooter;exports.DefaultGeomCircle=he;exports.DefaultGeomLine=ge;exports.DefaultGeomPath=fe;exports.DefaultGeomRect=pe;exports.DefaultGrid=s.DefaultGrid;exports.DefaultHeader=s.DefaultHeader;exports.DefaultSwatch=s.DefaultSwatch;exports.DefaultTooltip=s.DefaultTooltip;exports.DevToolsPanel=Et;exports.GRAPH_MODES=s.GRAPH_MODES;exports.GeomCircle=Je;exports.GeomLine=Ze;exports.GeomOverpaint=s.GeomOverpaint;exports.GeomPanelSizeProvider=s.GeomPanelSizeProvider;exports.GeomPath=tt;exports.GeomRect=et;exports.GraphErrorBoundary=ce;exports.GraphErrorPanel=Q;exports.GraphProvider=me;exports.GraphRenderer=s.GraphRenderer;exports.GraphyBadge=s.GraphyBadge;exports.HoverProvider=s.HoverProvider;exports.IntlProvider=s.ChartIntlProvider;exports.IntroFade=s.IntroFade;exports.IntroWipeClip=s.IntroWipeClip;exports.SymbolFigure=ot;exports.TextMeasurerProvider=s.TextMeasurerProvider;exports.ThemeProvider=s.ThemeProvider;exports.UnitBoxSvg=ct;exports.UnitSpaceSvg=at;exports.buildDotsEditOutlineShapes=s.buildDotsEditOutlineShapes;exports.createGraphyKit=Xe;exports.darkTheme=s.darkTheme;exports.defineGeomRenderer=s.defineGeomRenderer;exports.defineGlyph=s.defineGlyph;exports.getBuiltInEditOutlineShapes=s.getBuiltInEditOutlineShapes;exports.lightTheme=s.lightTheme;exports.lightenCss=s.lightenCss;exports.pruneSelection=de;exports.readPositionPixels=k;exports.readRectPixels=Qe;exports.resolveGraphyBadgeVariant=s.resolveGraphyBadgeVariant;exports.resolvePathStroke=s.resolvePathStroke;exports.scalePointToPanel=s.scalePointToPanel;exports.stampAxisEditTarget=s.stampAxisEditTarget;exports.stampGridEditTarget=s.stampGridEditTarget;exports.stampLegendEditTarget=s.stampLegendEditTarget;exports.useElementScreenRect=s.useElementScreenRect;exports.useFormattingLocale=s.useFormattingLocale;exports.useGeomHitTest=s.useGeomHitTest;exports.useGeomHover=s.useGeomHover;exports.useGeomPanelSize=s.useGeomPanelSize;exports.useGeomReaderTree=s.useGeomReaderTree;exports.useGeomStyleReader=s.useGeomStyleReader;exports.useGeomViewportSize=s.useGeomViewportSize;exports.useGraphAnimation=s.useGraphAnimation;exports.useGraphCommands=s.useGraphCommands;exports.useGraphHandle=s.useGraphHandle;exports.useGraphHistory=Nt;exports.useGraphHistoryShortcuts=Dt;exports.useGraphLocale=s.useGraphLocale;exports.useGraphSelection=s.useGraphSelection;exports.useGuidesTakePress=s.useGuidesTakePress;exports.useHandleScene=s.useHandleScene;exports.useHoverState=s.useHoverState;exports.usePaintDefs=s.usePaintDefs;exports.useResolvedStyle=s.useResolvedStyle;exports.useSceneSelector=s.useSceneSelector;exports.useStyleReaderTree=s.useStyleReaderTree;exports.useStyleResolver=s.useStyleResolver;exports.useTargetBoundary=kt;exports.useTextMeasurer=s.useTextMeasurer;exports.vars=s.vars;
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as _r, $n as kr, Bn as _e, C as $r, Cn as Hr, Ct as Mr, Et as xr, Fn as Ie, Ft as Ar, Gn as U, H as Or, Hn as ke, In as Br, It as Fr, Jn as Kr, Jt as Ur, Kn as zr, Ln as $e, Mn as Wr, Mt as Yr, N as Vr, Nn as jr, Pn as z, Qn as He, Qt as Z, Rn as te, Rt as Xr, Tt as Qr, U as Jr, Un as W, V as Zr, Vn as en, Wn as re, Wt as tn, Xn as Me, Xt as rn, Y as nn, Yn as sn, Yt as on, Zn as xe, _n as an, a as cn, an as Ae, ar as ln, cn as dn, cr as Oe, dn as un, er as Be, et as mn, fr as Fe, gn as hn, hn as Ke, i as gn, ir as pn, kn as fn, l as vn, ln as ne, lr as Ue, mn as ze, mr as ee, n as yn, nr as We, on as Ye, or as Sn, pn as bn, qt as Tn, r as En, rn as Ve, rr as Ne, sn as Gn, sr as Rn, t as je, tn as Xe, tt as In, un as Qe, ur as ae, vn as Nn, wt as wn, yn as Pn, zn as we } from "./history-chords-C2_stNnG.js";
1
+ import { $ as _r, $n as kr, Bn as _e, C as $r, Cn as Hr, Ct as Mr, Et as xr, Fn as Ie, Ft as Ar, Gn as U, H as Or, Hn as z, In as Br, It as Fr, Jn as Kr, Jt as Ur, Kn as zr, Ln as ke, Mn as Wr, Mt as Yr, N as Vr, Nn as jr, Pn as W, Qn as $e, Qt as Z, Rn as te, Rt as Xr, Tt as Qr, U as Jr, Un as re, V as Zr, Vn as He, Wn as en, Wt as tn, Xn as Me, Xt as rn, Y as nn, Yn as sn, Yt as on, Zn as xe, _n as an, a as cn, an as Ae, ar as ln, cn as dn, cr as Oe, dn as un, er as Be, et as mn, fr as Fe, gn as hn, hn as Ke, i as gn, ir as pn, kn as fn, l as vn, ln as ne, lr as Ue, mn as ze, mr as ee, n as yn, nr as We, on as Ye, or as Sn, pn as bn, qt as Tn, r as En, rn as Ve, rr as Ne, sn as Gn, sr as Rn, t as je, tn as Xe, tt as In, un as Qe, ur as ae, vn as Nn, wt as wn, yn as Pn, zn as we } from "./history-chords-DwwvPRAj.js";
2
2
  import { COMPILER_STAGE_KEYS as ce, DEFAULT_LOCALE as Je, Geom as Ze, GraphCompilationSession as et, areEditTargetsEqual as tt, buildDiagnostic as me, buildPointSymbolPath as rt, canonicalizeLocale as nt, createAnchorResolver as st, createCompiler as ot, createDataLabelPlacementResolver as it, createSpecBuilder as at, createStyleResolver as Pe, findAnnotation as ct, findIntlLocale as lt, findLayerById as he, foldGeomCornerRadii as dt, isCompilerCachingEnabled as ut, isGeometricSymbol as le, isImageSymbol as mt, resolveDefinition as ht, resolveGeomCornerRadiusPx as ge, setCompilerCachingEnabled as gt, toPercent as Q } from "@graphysdk/viz-engine";
3
3
  import { Component as pt, useCallback as p, useEffect as k, useId as ft, useImperativeHandle as vt, useMemo as H, useRef as pe, useState as y, useSyncExternalStore as yt } from "react";
4
4
  import { Fragment as St, jsx as c, jsxs as f } from "react/jsx-runtime";
@@ -564,9 +564,9 @@ var Yt = (e) => de((t) => ({
564
564
  value: R,
565
565
  children: /* @__PURE__ */ c(Fe, {
566
566
  value: q,
567
- children: /* @__PURE__ */ c(z, {
567
+ children: /* @__PURE__ */ c(W, {
568
568
  shapes: T?.shapes,
569
- children: /* @__PURE__ */ c(He, {
569
+ children: /* @__PURE__ */ c($e, {
570
570
  glyphs: v,
571
571
  children: N
572
572
  })
@@ -628,7 +628,7 @@ var K = (e, t) => {
628
628
  cy: r,
629
629
  r: n
630
630
  },
631
- transition: W,
631
+ transition: z,
632
632
  style: a,
633
633
  ...i
634
634
  }) : /* @__PURE__ */ c("circle", {
@@ -648,7 +648,7 @@ var K = (e, t) => {
648
648
  x2: n,
649
649
  y2: s
650
650
  },
651
- transition: W,
651
+ transition: z,
652
652
  style: l,
653
653
  ...a
654
654
  }) : /* @__PURE__ */ c("line", {
@@ -673,7 +673,7 @@ var K = (e, t) => {
673
673
  ry: a
674
674
  } : {}
675
675
  },
676
- transition: W,
676
+ transition: z,
677
677
  style: h,
678
678
  ...d
679
679
  }) : /* @__PURE__ */ c("rect", {
@@ -718,33 +718,33 @@ var K = (e, t) => {
718
718
  strokeOpacity: e.strokeOpacity,
719
719
  strokeWidth: e.strokeWidth,
720
720
  motion: r ? {
721
- transition: W,
721
+ transition: z,
722
722
  intro: !1,
723
723
  fadesIn: !1
724
724
  } : null
725
725
  })
726
- }) : t === void 0 ? tr(i) : /* @__PURE__ */ c(z, { children: /* @__PURE__ */ c(t, { ...i }) });
726
+ }) : t === void 0 ? tr(i) : /* @__PURE__ */ c(W, { children: /* @__PURE__ */ c(t, { ...i }) });
727
727
  }, An = (e) => {
728
728
  const { Line: t } = te(), { animateTransitions: r } = re(), n = {
729
729
  ...e,
730
730
  animateTransitions: r
731
731
  };
732
- return t === void 0 ? rr(n) : /* @__PURE__ */ c(z, { children: /* @__PURE__ */ c(t, { ...n }) });
732
+ return t === void 0 ? rr(n) : /* @__PURE__ */ c(W, { children: /* @__PURE__ */ c(t, { ...n }) });
733
733
  }, On = ({ cornerRadius: e, ...t }) => {
734
- const { Rect: r } = te(), n = we()?.size ?? null, s = $e(), { animateTransitions: i } = re(), a = {
734
+ const { Rect: r } = te(), n = we()?.size ?? null, s = ke(), { animateTransitions: i } = re(), a = {
735
735
  ...t,
736
736
  animateTransitions: i,
737
737
  ...ir(e, t, n, s)
738
738
  };
739
- return r === void 0 ? nr(a) : /* @__PURE__ */ c(z, { children: /* @__PURE__ */ c(r, { ...a }) });
739
+ return r === void 0 ? nr(a) : /* @__PURE__ */ c(W, { children: /* @__PURE__ */ c(r, { ...a }) });
740
740
  }, Bn = (e) => {
741
741
  const { Path: t } = te(), { animateTransitions: r } = re(), n = {
742
742
  ...e,
743
743
  animateTransitions: r
744
744
  };
745
- return t === void 0 ? sr(n) : /* @__PURE__ */ c(z, { children: /* @__PURE__ */ c(t, { ...n }) });
745
+ return t === void 0 ? sr(n) : /* @__PURE__ */ c(W, { children: /* @__PURE__ */ c(t, { ...n }) });
746
746
  }, be = (e) => typeof e == "number" ? `${e}px` : e, or = ({ d: e, source: t, ...r }) => {
747
- const n = ke(e, W, t);
747
+ const n = He(e, z, t);
748
748
  return /* @__PURE__ */ c(se.path, {
749
749
  d: n,
750
750
  ...r
@@ -1074,7 +1074,7 @@ export {
1074
1074
  rn as HoverProvider,
1075
1075
  Xr as IntlProvider,
1076
1076
  un as IntroFade,
1077
- en as IntroWipeClip,
1077
+ Wr as IntroWipeClip,
1078
1078
  Fn as SymbolFigure,
1079
1079
  hn as TextMeasurerProvider,
1080
1080
  Yr as ThemeProvider,
@@ -1115,7 +1115,7 @@ export {
1115
1115
  Vr as useGuidesTakePress,
1116
1116
  En as useHandleScene,
1117
1117
  xr as useHoverState,
1118
- Wr as usePaintDefs,
1118
+ en as usePaintDefs,
1119
1119
  Pn as useResolvedStyle,
1120
1120
  Oe as useSceneSelector,
1121
1121
  Sn as useStyleReaderTree,
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "visualization",
12
12
  "renderer"
13
13
  ],
14
- "version": "1.9.0-beta.1795452877881",
14
+ "version": "1.9.0-beta.1795453565720",
15
15
  "type": "module",
16
16
  "sideEffects": [
17
17
  "**/*.css.ts",
@@ -50,7 +50,7 @@
50
50
  "react-colorful": "^5.6.1",
51
51
  "react-intl": "^8.1.3",
52
52
  "zustand": "^5.0.12",
53
- "@graphysdk/viz-engine": "1.9.0-beta.1795452877881"
53
+ "@graphysdk/viz-engine": "1.9.0-beta.1795453565720"
54
54
  },
55
55
  "peerDependencies": {
56
56
  "@tiptap/core": "^3.0.0",
@@ -150,10 +150,10 @@
150
150
  "vite-plugin-dts": "^4.5.4",
151
151
  "vite-plugin-lib-inject-css": "^2.2.2",
152
152
  "vitest": "^4.1.11",
153
+ "@graphytools/eslint-config": "0.0.1",
153
154
  "@graphytools/eslint-plugin-graphy": "1.0.0",
154
155
  "@graphytools/typescript-config": "0.0.1",
155
- "@graphytools/vitest-config": "1.0.0",
156
- "@graphytools/eslint-config": "0.0.1"
156
+ "@graphytools/vitest-config": "1.0.0"
157
157
  },
158
158
  "publishConfig": {
159
159
  "access": "public"