semiotic 3.7.3 → 3.7.5
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/CLAUDE.md +13 -7
- package/README.md +36 -20
- package/ai/schema.json +221 -1
- package/ai/system-prompt.md +2 -1
- package/dist/components/Annotation.d.ts +4 -0
- package/dist/components/DataSummaryContext.d.ts +1 -0
- package/dist/components/LinkedCharts.d.ts +2 -2
- package/dist/components/ai/chartCapabilityTypes.d.ts +16 -0
- package/dist/components/ai/dataPitfallsBridge.d.ts +101 -0
- package/dist/components/ai/dataQualityBridge.d.ts +201 -0
- package/dist/components/ai/describeChart.d.ts +2 -0
- package/dist/components/ai/generativeChart.d.ts +145 -0
- package/dist/components/charts/custom/NetworkCustomChart.d.ts +15 -2
- package/dist/components/charts/ordinal/SwarmPlot.d.ts +7 -0
- package/dist/components/charts/realtime/RealtimeLineChart.d.ts +21 -0
- package/dist/components/charts/realtime/aggregate.d.ts +51 -0
- package/dist/components/charts/realtime/eventTime.d.ts +26 -0
- package/dist/components/charts/shared/colorPalettes.d.ts +2 -0
- package/dist/components/charts/shared/colorUtils.d.ts +1 -12
- package/dist/components/charts/shared/minMax.d.ts +3 -0
- package/dist/components/charts/shared/radialGeometry.d.ts +0 -18
- package/dist/components/charts/shared/smartTooltip.d.ts +27 -0
- package/dist/components/charts/shared/statisticalOverlays.d.ts +35 -0
- package/dist/components/charts/shared/tooltipUtils.d.ts +2 -0
- package/dist/components/charts/shared/useChartSetup.d.ts +1 -1
- package/dist/components/charts/shared/useCustomChartSetup.d.ts +1 -1
- package/dist/components/charts/shared/validateChartData.d.ts +1 -1
- package/dist/components/charts/xy/Scatterplot.d.ts +9 -0
- package/dist/components/data/fromArrow.d.ts +54 -0
- package/dist/components/data/fromMermaid.d.ts +47 -0
- package/dist/components/data/fromObservablePlot.d.ts +69 -0
- package/dist/components/data/portability/index.d.ts +14 -0
- package/dist/components/data/portability/spec.d.ts +129 -0
- package/dist/components/data/portability/vegaLite.d.ts +62 -0
- package/dist/components/realtime/ReorderBuffer.d.ts +54 -0
- package/dist/components/realtime/RunningStats.d.ts +66 -0
- package/dist/components/realtime/WindowAccumulator.d.ts +105 -0
- package/dist/components/realtime/parseWindowDuration.d.ts +12 -0
- package/dist/components/recipes/customTooltip.d.ts +31 -0
- package/dist/components/recipes/gofish.d.ts +207 -0
- package/dist/components/recipes/gofishBoba.d.ts +23 -0
- package/dist/components/recipes/gofishIR.d.ts +169 -0
- package/dist/components/recipes/gofishIRExamples.d.ts +89 -0
- package/dist/components/recipes/gofishInterpreter.d.ts +52 -0
- package/dist/components/recipes/gofishLambdas.d.ts +145 -0
- package/dist/components/recipes/lineageDag.d.ts +129 -0
- package/dist/components/recipes/mermaidDag.d.ts +44 -0
- package/dist/components/recipes/packedClusterMatrix.d.ts +166 -0
- package/dist/components/recipes/recipeChrome.d.ts +100 -0
- package/dist/components/recipes/recipeLegend.d.ts +57 -0
- package/dist/components/recipes/recipeUtils.d.ts +105 -0
- package/dist/components/semiotic-ai.d.ts +6 -0
- package/dist/components/semiotic-data.d.ts +2 -0
- package/dist/components/semiotic-experimental.d.ts +20 -0
- package/dist/components/semiotic-network.d.ts +3 -1
- package/dist/components/semiotic-ordinal.d.ts +2 -0
- package/dist/components/semiotic-realtime.d.ts +9 -1
- package/dist/components/semiotic-recipes.d.ts +20 -1
- package/dist/components/semiotic-themes.d.ts +2 -0
- package/dist/components/semiotic-xy.d.ts +2 -0
- package/dist/components/semiotic.d.ts +6 -2
- package/dist/components/store/ObservationStore.d.ts +21 -2
- package/dist/components/store/SelectionStore.d.ts +1 -1
- package/dist/components/store/ThemeStore.d.ts +1 -1
- package/dist/components/store/TooltipStore.d.ts +1 -1
- package/dist/components/store/createStore.d.ts +1 -1
- package/dist/components/store/designTokens.d.ts +15 -0
- package/dist/components/store/useSelection.d.ts +22 -0
- package/dist/components/stream/NetworkHtmlMarksLayer.d.ts +44 -0
- package/dist/components/stream/NetworkPipelineStore.d.ts +32 -0
- package/dist/components/stream/NetworkSVGOverlay.d.ts +12 -0
- package/dist/components/stream/OrdinalPipelineStore.d.ts +18 -0
- package/dist/components/stream/PipelineStore.d.ts +27 -0
- package/dist/components/stream/SceneGraph.d.ts +5 -1
- package/dist/components/stream/customLayout.d.ts +20 -0
- package/dist/components/stream/customLayoutDiagnostics.d.ts +11 -0
- package/dist/components/stream/customLayoutSelection.d.ts +52 -0
- package/dist/components/stream/networkCustomLayout.d.ts +101 -1
- package/dist/components/stream/networkTypes.d.ts +38 -1
- package/dist/components/stream/ordinalCustomLayout.d.ts +17 -1
- package/dist/components/stream/ordinalSceneBuilders/types.d.ts +2 -0
- package/dist/components/stream/ordinalTypes.d.ts +19 -3
- package/dist/components/stream/renderers/networkSymbolRenderer.d.ts +2 -0
- package/dist/components/stream/renderers/symbolCanvasRenderer.d.ts +2 -0
- package/dist/components/stream/stalenessBands.d.ts +28 -0
- package/dist/components/stream/symbolPath.d.ts +24 -0
- package/dist/components/stream/types.d.ts +72 -3
- package/dist/components/stream/useStalenessCheck.d.ts +6 -1
- package/dist/components/stream/xySceneBuilders/pointScene.d.ts +2 -2
- package/dist/components/stream/xySceneBuilders/types.d.ts +5 -0
- package/dist/geo.min.js +1 -1
- package/dist/geo.module.min.js +1 -1
- package/dist/network.min.js +1 -1
- package/dist/network.module.min.js +1 -1
- package/dist/ordinal.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/realtime.min.js +1 -1
- package/dist/realtime.module.min.js +1 -1
- package/dist/semiotic-ai-semiotic-ai-u954ylUn.js +2 -0
- package/dist/semiotic-ai-statisticalOverlays-CU7jW05Q.js +1 -0
- package/dist/semiotic-ai.d.ts +6 -0
- package/dist/semiotic-ai.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-data.d.ts +2 -0
- package/dist/semiotic-data.min.js +1 -1
- package/dist/semiotic-data.module.min.js +1 -1
- package/dist/semiotic-experimental.d.ts +20 -0
- package/dist/semiotic-experimental.min.js +1 -0
- package/dist/semiotic-experimental.module.min.js +1 -0
- package/dist/semiotic-network.d.ts +3 -1
- package/dist/semiotic-ordinal.d.ts +2 -0
- package/dist/semiotic-realtime.d.ts +9 -1
- package/dist/semiotic-recipes.d.ts +20 -1
- package/dist/semiotic-recipes.min.js +1 -1
- package/dist/semiotic-recipes.module.min.js +1 -1
- package/dist/semiotic-semiotic-BmrYbi99.js +2 -0
- package/dist/semiotic-statisticalOverlays-IjZw8Lsu.js +1 -0
- package/dist/semiotic-themes.d.ts +2 -0
- package/dist/semiotic-themes.min.js +1 -1
- package/dist/semiotic-themes.module.min.js +1 -1
- package/dist/semiotic-utils.min.js +1 -1
- package/dist/semiotic-utils.module.min.js +1 -1
- package/dist/semiotic-value.min.js +1 -1
- package/dist/semiotic-value.module.min.js +1 -1
- package/dist/semiotic-xy.d.ts +2 -0
- package/dist/semiotic.d.ts +6 -2
- package/dist/semiotic.min.js +1 -1
- package/dist/semiotic.module.min.js +1 -1
- package/dist/server.min.js +1 -1
- package/dist/server.module.min.js +1 -1
- package/dist/xy-semiotic-xy-Dufu3D0-.js +2 -0
- package/dist/xy-statisticalOverlays-3Ni9bRph.js +1 -0
- package/dist/xy.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +11 -3
- package/dist/semiotic-ai-statisticalOverlays-C2PPlmXv.js +0 -1
- package/dist/semiotic-statisticalOverlays-C3DsOgr_.js +0 -1
- package/dist/xy-statisticalOverlays-C2PPlmXv.js +0 -1
package/dist/semiotic-data.d.ts
CHANGED
|
@@ -5,4 +5,6 @@
|
|
|
5
5
|
export { bin, rollup, groupBy, pivot } from "./components/data/transforms";
|
|
6
6
|
export { fromVegaLite } from "./components/data/fromVegaLite";
|
|
7
7
|
export type { VegaLiteSpec, VegaLiteEncoding } from "./components/data/fromVegaLite";
|
|
8
|
+
export { fromArrow } from "./components/data/fromArrow";
|
|
9
|
+
export type { ArrowTableLike, ArrowColumnLike, ArrowFieldLike, ArrowSchemaLike, FromArrowOptions, } from "./components/data/fromArrow";
|
|
8
10
|
export { mergeData } from "./components/geo/mergeData";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function e(e,t){const{groupBy:l,value:o,agg:a="sum"}=t,i=new Map;for(const t of e){const e=t[l]+"";i.has(e)||i.set(e,[]),i.get(e).push(Number(t[o]))}const n=[];for(const[e,t]of i){let o;switch(a){case"count":o=t.length;break;case"mean":o=t.reduce((e,t)=>e+t,0)/t.length;break;case"min":o=Math.min(...t);break;case"max":o=Math.max(...t);break;default:o=t.reduce((e,t)=>e+t,0)}n.push({[l]:e,value:o})}return n}function t(e){return Math.round(1e3*e)/1e3+""}function l(e){return"nominal"===e||"ordinal"===e}function o(e){return"quantitative"===e||"temporal"===e}"function"==typeof SuppressedError&&SuppressedError;const a={category10:"category10",category20:"category20",category20b:"category20",category20c:"category20",accent:"accent",dark2:"dark2",paired:"paired",pastel1:"pastel1",pastel2:"pastel2",set1:"set1",set2:"set2",set3:"set3",tableau10:"category10",tableau20:"category20"},i={linear:"linear","monotone-x":"monotoneX","monotone-y":"monotoneY",monotone:"monotoneX",step:"step","step-after":"stepAfter","step-before":"stepBefore",basis:"basis",cardinal:"cardinal","catmull-rom":"catmullRom"},n={sum:"sum",mean:"mean",average:"mean",count:"count",min:"min",max:"max",median:"mean"};function r(e,t,l,o,a){var i,n;(null==e?void 0:e.field)&&(l.xAccessor=o?"value":e.field),(null==t?void 0:t.field)&&(l.yAccessor=a?"value":t.field),(null===(i=null==e?void 0:e.axis)||void 0===i?void 0:i.title)&&(l.xLabel=e.axis.title),(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.title)&&(l.yLabel=t.axis.title)}function s(e,t,l){const o={component:e,props:t,version:"1",createdAt:(new Date).toISOString()};if(l.length>0){o.warnings=l;for(const e of l)console.warn("[semiotic/fromVegaLite] "+e)}return o}exports.bin=function(e,l){const{field:o,bins:a=10}=l,i=e.map(e=>Number(e[o])).filter(e=>!isNaN(e));if(0===i.length)return[];const n=l.domain?l.domain[0]:Math.min(...i),r=l.domain?l.domain[1]:Math.max(...i);if(n===r)return[{category:`${n}-${r}`,value:i.length}];const s=(r-n)/a,c=Array(a).fill(0);for(const e of i){let t=Math.floor((e-n)/s);t===a&&(t=a-1),t>=0&&a>t&&c[t]++}return c.map((e,l)=>{const o=n+l*s,a=o+s;return{category:`${t(o)}-${t(a)}`,value:e}})},exports.fromVegaLite=function(t){var c,d,u,v,f,p,y,g,m,b,h,x;const k=[],{type:A,markProps:L}=function(e){if("string"==typeof e)return{type:e,markProps:{}};const{type:t}=e;return{type:t,markProps:function(e,t){var l={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(l[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(o=Object.getOwnPropertySymbols(e);o.length>a;a++)0>t.indexOf(o[a])&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(l[o[a]]=e[o[a]])}return l}(e,["type"])}}(t.mark),w=t.encoding||{},O=w.x,S=w.y,j=w.color,B=w.size,C=w.theta,P=w.opacity;let M;(null===(c=t.data)||void 0===c?void 0:c.values)?M=t.data.values:(null===(d=t.data)||void 0===d?void 0:d.url)&&k.push("data.url is not supported — only inline data.values can be translated. Provide data manually."),t.transform&&t.transform.length>0&&k.push("Vega-Lite transforms are not supported. Pre-transform your data before passing to fromVegaLite()."),t.layer&&k.push('Layered specs ("layer") are not supported. Only single-mark specs can be translated.'),(t.hconcat||t.vconcat||t.concat)&&k.push('Concatenated views ("hconcat"/"vconcat"/"concat") are not supported. Translate each sub-spec individually.'),(t.facet||w.facet||w.row||w.column)&&k.push("Faceted views are not supported. Use Semiotic's LinkedCharts or render multiple charts manually."),t.repeat&&k.push('Repeated views ("repeat") are not supported. Translate each field combination individually.'),(t.params||t.selection)&&k.push("Selections/params are not supported. Use Semiotic's LinkedCharts and selection props for interactivity.");const R={};t.width&&(R.width=t.width),t.height&&(R.height=t.height);const z=function(e){if(e)return"string"==typeof e?e:e.text}(t.title);if(z&&(R.title=z),(null==j?void 0:j.field)&&(R.colorBy=j.field,null===(u=j.scale)||void 0===u?void 0:u.scheme)){const e=a[j.scale.scheme];e&&(R.colorScheme=e)}void 0!==(null==P?void 0:P.value)&&(R.pointOpacity=P.value);const D=null==O?void 0:O.aggregate,$=null==S?void 0:S.aggregate;if(M&&(D||$)){const t=$?S:O,l=$?O:S,o=n[t.aggregate];if(o&&(null==l?void 0:l.field)&&t.field)M=e(M,{groupBy:l.field,value:t.field,agg:o});else if(("count"===o||"count"===t.aggregate)&&(null==l?void 0:l.field)&&M){const e=new Map;for(const t of M){const o=t[l.field]+"";e.set(o,(e.get(o)||0)+1)}M=Array.from(e,([e,t])=>({[l.field]:e,value:t}))}}if((null==O?void 0:O.bin)||(null==S?void 0:S.bin)){const e="Histogram";M&&(R.data=M),(null==O?void 0:O.bin)?(R.valueAccessor=O.field,(null==S?void 0:S.field)&&(R.categoryAccessor=S.field),(null===(v=O.axis)||void 0===v?void 0:v.title)&&(R.valueLabel=O.axis.title)):(null==S?void 0:S.bin)&&(R.valueAccessor=S.field,(null==O?void 0:O.field)&&(R.categoryAccessor=O.field),(null===(f=S.axis)||void 0===f?void 0:f.title)&&(R.valueLabel=S.axis.title));const t=(null==O?void 0:O.bin)||(null==S?void 0:S.bin),l="object"==typeof t?t.maxbins:void 0;return l&&(R.bins=l),s(e,R,k)}let N;switch(A){case"bar":N=function(e,t,a,i,n,r,s){var c,d,u,v,f,p;let y;return(null==a?void 0:a.field)&&!1!==(null==e?void 0:e.stack)&&!1!==(null==t?void 0:t.stack)&&null!==(null==e?void 0:e.stack)&&null!==(null==t?void 0:t.stack)?(y="StackedBarChart",i.stackBy=a.field):y="BarChart",l(null==e?void 0:e.type)&&o(null==t?void 0:t.type)?(i.categoryAccessor=e.field,i.valueAccessor=s?"value":t.field,(null===(c=null==e?void 0:e.axis)||void 0===c?void 0:c.title)&&(i.categoryLabel=e.axis.title),(null===(d=null==t?void 0:t.axis)||void 0===d?void 0:d.title)&&(i.valueLabel=t.axis.title)):o(null==e?void 0:e.type)&&l(null==t?void 0:t.type)?(i.categoryAccessor=t.field,i.valueAccessor=r?"value":e.field,i.orientation="horizontal",(null===(u=null==t?void 0:t.axis)||void 0===u?void 0:u.title)&&(i.categoryLabel=t.axis.title),(null===(v=null==e?void 0:e.axis)||void 0===v?void 0:v.title)&&(i.valueLabel=e.axis.title)):((null==e?void 0:e.field)&&(i.categoryAccessor=e.field),(null==t?void 0:t.field)&&(i.valueAccessor=s?"value":t.field),(null===(f=null==e?void 0:e.axis)||void 0===f?void 0:f.title)&&(i.categoryLabel=e.axis.title),(null===(p=null==t?void 0:t.axis)||void 0===p?void 0:p.title)&&(i.valueLabel=t.axis.title)),n&&(i.data=n),y}(O,S,j,R,M,D,$);break;case"line":if(N="LineChart",r(O,S,R,D,$),(null==j?void 0:j.field)&&(R.lineBy=j.field),L.interpolate){const e=i[L.interpolate];e&&(R.curve=e)}!0===L.point&&(R.showPoints=!0),M&&(R.data=M);break;case"area":if((null==j?void 0:j.field)?(N="StackedAreaChart",R.areaBy=j.field):N="AreaChart",r(O,S,R,D,$),L.interpolate){const e=i[L.interpolate];e&&(R.curve=e)}void 0!==L.opacity&&(R.areaOpacity=L.opacity),M&&(R.data=M);break;case"point":case"circle":case"square":(null==B?void 0:B.field)?(N="BubbleChart",R.sizeBy=B.field,(null===(p=B.scale)||void 0===p?void 0:p.range)&&(R.sizeRange=B.scale.range)):N="Scatterplot",r(O,S,R,D,$),M&&(R.data=M);break;case"rect":N="Heatmap",(null==O?void 0:O.field)&&(R.xAccessor=O.field),(null==S?void 0:S.field)&&(R.yAccessor=S.field),(null==j?void 0:j.field)&&(R.valueAccessor=j.field,delete R.colorBy),(null===(y=null==O?void 0:O.axis)||void 0===y?void 0:y.title)&&(R.xLabel=O.axis.title),(null===(g=null==S?void 0:S.axis)||void 0===g?void 0:g.title)&&(R.yLabel=S.axis.title),M&&(R.data=M);break;case"arc":L.innerRadius&&L.innerRadius>0?(N="DonutChart",R.innerRadius=L.innerRadius):N="PieChart",(null==C?void 0:C.field)?R.valueAccessor=C.field:(null==S?void 0:S.field)&&(R.valueAccessor=$?"value":S.field),(null==j?void 0:j.field)&&(R.categoryAccessor=j.field),(null==O?void 0:O.field)&&!(null==C?void 0:C.field)&&(R.categoryAccessor=O.field),M&&(R.data=M);break;case"tick":N="DotPlot",l(null==O?void 0:O.type)?(R.categoryAccessor=O.field,(null==S?void 0:S.field)&&(R.valueAccessor=$?"value":S.field),(null===(m=null==O?void 0:O.axis)||void 0===m?void 0:m.title)&&(R.categoryLabel=O.axis.title),(null===(b=null==S?void 0:S.axis)||void 0===b?void 0:b.title)&&(R.valueLabel=S.axis.title)):l(null==S?void 0:S.type)?(R.categoryAccessor=S.field,(null==O?void 0:O.field)&&(R.valueAccessor=D?"value":O.field),R.orientation="horizontal",(null===(h=null==S?void 0:S.axis)||void 0===h?void 0:h.title)&&(R.categoryLabel=S.axis.title),(null===(x=null==O?void 0:O.axis)||void 0===x?void 0:x.title)&&(R.valueLabel=O.axis.title)):((null==O?void 0:O.field)&&(R.categoryAccessor=O.field),(null==S?void 0:S.field)&&(R.valueAccessor=$?"value":S.field)),M&&(R.data=M);break;default:k.push(`Unsupported mark type "${A}". Defaulting to Scatterplot.`),N="Scatterplot",r(O,S,R,D,$),M&&(R.data=M)}return s(N,R,k)},exports.groupBy=function(e,t){const{key:l,fields:o}=t,a=new Map;for(const t of e){const e=t[l]+"";if(a.has(e)||a.set(e,[]),o){const l={};for(const e of o)e in t&&(l[e]=t[e]);a.get(e).push(l)}else a.get(e).push(Object.assign({},t))}const i=[];for(const[e,t]of a)i.push({id:e,coordinates:t});return i},exports.mergeData=function(e,t,l){const{featureKey:o,dataKey:a}=l,i=new Map;for(const e of t)i.set(e[a]+"",e);return e.map(e=>{const t=(e=>{const t=o.split(".");let l=e;for(const e of t)l=null==l?void 0:l[e];return(null!=l?l:"")+""})(e),l=i.get(t);return l?Object.assign(Object.assign({},e),{properties:Object.assign(Object.assign({},e.properties),l)}):e})},exports.pivot=function(e,t){const{columns:l,nameField:o="name",valueField:a="value"}=t,i=new Set(l),n=[];for(const t of e){const e={};for(const l of Object.keys(t))i.has(l)||(e[l]=t[l]);for(const i of l)n.push(Object.assign(Object.assign({},e),{[o]:i,[a]:t[i]}))}return n},exports.rollup=e;
|
|
1
|
+
"use strict";function e(e){let t=1/0,o=-1/0;for(const l of e)t>l&&(t=l),l>o&&(o=l);return[t,o]}function t(t,o){const{groupBy:l,value:i,agg:a="sum"}=o,n=new Map;for(const e of t){const t=e[l]+"";n.has(t)||n.set(t,[]),n.get(t).push(Number(e[i]))}const r=[];for(const[t,o]of n){let i;switch(a){case"count":i=o.length;break;case"mean":i=o.reduce((e,t)=>e+t,0)/o.length;break;case"min":i=e(o)[0];break;case"max":i=e(o)[1];break;default:i=o.reduce((e,t)=>e+t,0)}r.push({[l]:t,value:i})}return r}function o(e){return Math.round(1e3*e)/1e3+""}function l(e){return"nominal"===e||"ordinal"===e}function i(e){return"quantitative"===e||"temporal"===e}"function"==typeof SuppressedError&&SuppressedError;const a={category10:"category10",category20:"category20",category20b:"category20",category20c:"category20",accent:"accent",dark2:"dark2",paired:"paired",pastel1:"pastel1",pastel2:"pastel2",set1:"set1",set2:"set2",set3:"set3",tableau10:"category10",tableau20:"category20"},n={linear:"linear","monotone-x":"monotoneX","monotone-y":"monotoneY",monotone:"monotoneX",step:"step","step-after":"stepAfter","step-before":"stepBefore",basis:"basis",cardinal:"cardinal","catmull-rom":"catmullRom"},r={sum:"sum",mean:"mean",average:"mean",count:"count",min:"min",max:"max",median:"mean"};function s(e,t,o,l,i){var a,n;(null==e?void 0:e.field)&&(o.xAccessor=l?"value":e.field),(null==t?void 0:t.field)&&(o.yAccessor=i?"value":t.field),(null===(a=null==e?void 0:e.axis)||void 0===a?void 0:a.title)&&(o.xLabel=e.axis.title),(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.title)&&(o.yLabel=t.axis.title)}function c(e,t,o){const l={component:e,props:t,version:"1",createdAt:(new Date).toISOString()};if(o.length>0){l.warnings=o;for(const e of o)console.warn("[semiotic/fromVegaLite] "+e)}return l}exports.bin=function(t,l){const{field:i,bins:a=10}=l,n=t.map(e=>Number(e[i])).filter(e=>!isNaN(e));if(0===n.length)return[];const[r,s]=e(n),c=l.domain?l.domain[0]:r,u=l.domain?l.domain[1]:s;if(c===u)return[{category:`${c}-${u}`,value:n.length}];const d=(u-c)/a,f=Array(a).fill(0);for(const e of n){let t=Math.floor((e-c)/d);t===a&&(t=a-1),t>=0&&a>t&&f[t]++}return f.map((e,t)=>{const l=c+t*d,i=l+d;return{category:`${o(l)}-${o(i)}`,value:e}})},exports.fromArrow=function(e,t={}){var o;if(!e||"number"!=typeof e.numRows||!e.schema)return console.warn("[semiotic/fromArrow] Expected an Arrow table with `numRows` and `schema`. Returning []."),[];const l=!1!==t.coerceBigInt,i=e.schema.fields.map(e=>e.name),a=null!==(o=t.fields)&&void 0!==o?o:i,n=[];for(const t of a){const o=e.getChild(t);o?n.push({name:t,column:o}):console.warn(`[semiotic/fromArrow] Column "${t}" is not in the table schema; skipping it.`)}let r=!1;const s=Array(e.numRows);for(let t=0;e.numRows>t;t++){const e={};for(const{name:o,column:i}of n){let a=i.get(t);l&&"bigint"==typeof a&&(a<BigInt(Number.MIN_SAFE_INTEGER)||a>BigInt(Number.MAX_SAFE_INTEGER)?r||(r=!0,console.warn("[semiotic/fromArrow] A 64-bit integer exceeds Number.MAX_SAFE_INTEGER; left as bigint to avoid precision loss.")):a=Number(a)),e[o]=a}s[t]=e}return s},exports.fromVegaLite=function(e){var o,u,d,f,v,p,m,g,y,b,h,x;const A=[],{type:w,markProps:k}=function(e){if("string"==typeof e)return{type:e,markProps:{}};const{type:t}=e;return{type:t,markProps:function(e,t){var o={};for(var l in e)Object.prototype.hasOwnProperty.call(e,l)&&0>t.indexOf(l)&&(o[l]=e[l]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(l=Object.getOwnPropertySymbols(e);l.length>i;i++)0>t.indexOf(l[i])&&Object.prototype.propertyIsEnumerable.call(e,l[i])&&(o[l[i]]=e[l[i]])}return o}(e,["type"])}}(e.mark),L=e.encoding||{},O=L.x,S=L.y,B=L.color,R=L.size,j=L.theta,C=L.opacity;let E;(null===(o=e.data)||void 0===o?void 0:o.values)?E=e.data.values:(null===(u=e.data)||void 0===u?void 0:u.url)&&A.push("data.url is not supported — only inline data.values can be translated. Provide data manually."),e.transform&&e.transform.length>0&&A.push("Vega-Lite transforms are not supported. Pre-transform your data before passing to fromVegaLite()."),e.layer&&A.push('Layered specs ("layer") are not supported. Only single-mark specs can be translated.'),(e.hconcat||e.vconcat||e.concat)&&A.push('Concatenated views ("hconcat"/"vconcat"/"concat") are not supported. Translate each sub-spec individually.'),(e.facet||L.facet||L.row||L.column)&&A.push("Faceted views are not supported. Use Semiotic's LinkedCharts or render multiple charts manually."),e.repeat&&A.push('Repeated views ("repeat") are not supported. Translate each field combination individually.'),(e.params||e.selection)&&A.push("Selections/params are not supported. Use Semiotic's LinkedCharts and selection props for interactivity.");const N={};e.width&&(N.width=e.width),e.height&&(N.height=e.height);const P=function(e){if(e)return"string"==typeof e?e:e.text}(e.title);if(P&&(N.title=P),(null==B?void 0:B.field)&&(N.colorBy=B.field,null===(d=B.scale)||void 0===d?void 0:d.scheme)){const e=a[B.scale.scheme];e&&(N.colorScheme=e)}void 0!==(null==C?void 0:C.value)&&(N.pointOpacity=C.value);const I=null==O?void 0:O.aggregate,M=null==S?void 0:S.aggregate;if(E&&(I||M)){const e=M?S:O,o=M?O:S,l=r[e.aggregate];if(l&&(null==o?void 0:o.field)&&e.field)E=t(E,{groupBy:o.field,value:e.field,agg:l});else if(("count"===l||"count"===e.aggregate)&&(null==o?void 0:o.field)&&E){const e=new Map;for(const t of E){const l=t[o.field]+"";e.set(l,(e.get(l)||0)+1)}E=Array.from(e,([e,t])=>({[o.field]:e,value:t}))}}if((null==O?void 0:O.bin)||(null==S?void 0:S.bin)){const e="Histogram";E&&(N.data=E),(null==O?void 0:O.bin)?(N.valueAccessor=O.field,(null==S?void 0:S.field)&&(N.categoryAccessor=S.field),(null===(f=O.axis)||void 0===f?void 0:f.title)&&(N.valueLabel=O.axis.title)):(null==S?void 0:S.bin)&&(N.valueAccessor=S.field,(null==O?void 0:O.field)&&(N.categoryAccessor=O.field),(null===(v=S.axis)||void 0===v?void 0:v.title)&&(N.valueLabel=S.axis.title));const t=(null==O?void 0:O.bin)||(null==S?void 0:S.bin),o="object"==typeof t?t.maxbins:void 0;return o&&(N.bins=o),c(e,N,A)}let F;switch(w){case"bar":F=function(e,t,o,a,n,r,s){var c,u,d,f,v,p;let m;return(null==o?void 0:o.field)&&!1!==(null==e?void 0:e.stack)&&!1!==(null==t?void 0:t.stack)&&null!==(null==e?void 0:e.stack)&&null!==(null==t?void 0:t.stack)?(m="StackedBarChart",a.stackBy=o.field):m="BarChart",l(null==e?void 0:e.type)&&i(null==t?void 0:t.type)?(a.categoryAccessor=e.field,a.valueAccessor=s?"value":t.field,(null===(c=null==e?void 0:e.axis)||void 0===c?void 0:c.title)&&(a.categoryLabel=e.axis.title),(null===(u=null==t?void 0:t.axis)||void 0===u?void 0:u.title)&&(a.valueLabel=t.axis.title)):i(null==e?void 0:e.type)&&l(null==t?void 0:t.type)?(a.categoryAccessor=t.field,a.valueAccessor=r?"value":e.field,a.orientation="horizontal",(null===(d=null==t?void 0:t.axis)||void 0===d?void 0:d.title)&&(a.categoryLabel=t.axis.title),(null===(f=null==e?void 0:e.axis)||void 0===f?void 0:f.title)&&(a.valueLabel=e.axis.title)):((null==e?void 0:e.field)&&(a.categoryAccessor=e.field),(null==t?void 0:t.field)&&(a.valueAccessor=s?"value":t.field),(null===(v=null==e?void 0:e.axis)||void 0===v?void 0:v.title)&&(a.categoryLabel=e.axis.title),(null===(p=null==t?void 0:t.axis)||void 0===p?void 0:p.title)&&(a.valueLabel=t.axis.title)),n&&(a.data=n),m}(O,S,B,N,E,I,M);break;case"line":if(F="LineChart",s(O,S,N,I,M),(null==B?void 0:B.field)&&(N.lineBy=B.field),k.interpolate){const e=n[k.interpolate];e&&(N.curve=e)}!0===k.point&&(N.showPoints=!0),E&&(N.data=E);break;case"area":if((null==B?void 0:B.field)?(F="StackedAreaChart",N.areaBy=B.field):F="AreaChart",s(O,S,N,I,M),k.interpolate){const e=n[k.interpolate];e&&(N.curve=e)}void 0!==k.opacity&&(N.areaOpacity=k.opacity),E&&(N.data=E);break;case"point":case"circle":case"square":(null==R?void 0:R.field)?(F="BubbleChart",N.sizeBy=R.field,(null===(p=R.scale)||void 0===p?void 0:p.range)&&(N.sizeRange=R.scale.range)):F="Scatterplot",s(O,S,N,I,M),E&&(N.data=E);break;case"rect":F="Heatmap",(null==O?void 0:O.field)&&(N.xAccessor=O.field),(null==S?void 0:S.field)&&(N.yAccessor=S.field),(null==B?void 0:B.field)&&(N.valueAccessor=B.field,delete N.colorBy),(null===(m=null==O?void 0:O.axis)||void 0===m?void 0:m.title)&&(N.xLabel=O.axis.title),(null===(g=null==S?void 0:S.axis)||void 0===g?void 0:g.title)&&(N.yLabel=S.axis.title),E&&(N.data=E);break;case"arc":k.innerRadius&&k.innerRadius>0?(F="DonutChart",N.innerRadius=k.innerRadius):F="PieChart",(null==j?void 0:j.field)?N.valueAccessor=j.field:(null==S?void 0:S.field)&&(N.valueAccessor=M?"value":S.field),(null==B?void 0:B.field)&&(N.categoryAccessor=B.field),(null==O?void 0:O.field)&&!(null==j?void 0:j.field)&&(N.categoryAccessor=O.field),E&&(N.data=E);break;case"tick":F="DotPlot",l(null==O?void 0:O.type)?(N.categoryAccessor=O.field,(null==S?void 0:S.field)&&(N.valueAccessor=M?"value":S.field),(null===(y=null==O?void 0:O.axis)||void 0===y?void 0:y.title)&&(N.categoryLabel=O.axis.title),(null===(b=null==S?void 0:S.axis)||void 0===b?void 0:b.title)&&(N.valueLabel=S.axis.title)):l(null==S?void 0:S.type)?(N.categoryAccessor=S.field,(null==O?void 0:O.field)&&(N.valueAccessor=I?"value":O.field),N.orientation="horizontal",(null===(h=null==S?void 0:S.axis)||void 0===h?void 0:h.title)&&(N.categoryLabel=S.axis.title),(null===(x=null==O?void 0:O.axis)||void 0===x?void 0:x.title)&&(N.valueLabel=O.axis.title)):((null==O?void 0:O.field)&&(N.categoryAccessor=O.field),(null==S?void 0:S.field)&&(N.valueAccessor=M?"value":S.field)),E&&(N.data=E);break;default:A.push(`Unsupported mark type "${w}". Defaulting to Scatterplot.`),F="Scatterplot",s(O,S,N,I,M),E&&(N.data=E)}return c(F,N,A)},exports.groupBy=function(e,t){const{key:o,fields:l}=t,i=new Map;for(const t of e){const e=t[o]+"";if(i.has(e)||i.set(e,[]),l){const o={};for(const e of l)e in t&&(o[e]=t[e]);i.get(e).push(o)}else i.get(e).push(Object.assign({},t))}const a=[];for(const[e,t]of i)a.push({id:e,coordinates:t});return a},exports.mergeData=function(e,t,o){const{featureKey:l,dataKey:i}=o,a=new Map;for(const e of t)a.set(e[i]+"",e);return e.map(e=>{const t=(e=>{const t=l.split(".");let o=e;for(const e of t)o=null==o?void 0:o[e];return(null!=o?o:"")+""})(e),o=a.get(t);return o?Object.assign(Object.assign({},e),{properties:Object.assign(Object.assign({},e.properties),o)}):e})},exports.pivot=function(e,t){const{columns:o,nameField:l="name",valueField:i="value"}=t,a=new Set(o),n=[];for(const t of e){const e={};for(const o of Object.keys(t))a.has(o)||(e[o]=t[o]);for(const a of o)n.push(Object.assign(Object.assign({},e),{[l]:a,[i]:t[a]}))}return n},exports.rollup=t;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e,t){const{field:l,bins:a=10}=t,o=e.map(e=>Number(e[l])).filter(e=>!isNaN(e));if(0===o.length)return[];const n=t.domain?t.domain[0]:Math.min(...o),r=t.domain?t.domain[1]:Math.max(...o);if(n===r)return[{category:`${n}-${r}`,value:o.length}];const s=(r-n)/a,c=Array(a).fill(0);for(const e of o){let t=Math.floor((e-n)/s);t===a&&(t=a-1),t>=0&&a>t&&c[t]++}return c.map((e,t)=>{const l=n+t*s,a=l+s;return{category:`${i(l)}-${i(a)}`,value:e}})}function t(e,t){const{groupBy:l,value:a,agg:i="sum"}=t,o=new Map;for(const t of e){const e=t[l]+"";o.has(e)||o.set(e,[]),o.get(e).push(Number(t[a]))}const n=[];for(const[e,t]of o){let a;switch(i){case"count":a=t.length;break;case"mean":a=t.reduce((e,t)=>e+t,0)/t.length;break;case"min":a=Math.min(...t);break;case"max":a=Math.max(...t);break;default:a=t.reduce((e,t)=>e+t,0)}n.push({[l]:e,value:a})}return n}function l(e,t){const{key:l,fields:a}=t,i=new Map;for(const t of e){const e=t[l]+"";if(i.has(e)||i.set(e,[]),a){const l={};for(const e of a)e in t&&(l[e]=t[e]);i.get(e).push(l)}else i.get(e).push(Object.assign({},t))}const o=[];for(const[e,t]of i)o.push({id:e,coordinates:t});return o}function a(e,t){const{columns:l,nameField:a="name",valueField:i="value"}=t,o=new Set(l),n=[];for(const t of e){const e={};for(const l of Object.keys(t))o.has(l)||(e[l]=t[l]);for(const o of l)n.push(Object.assign(Object.assign({},e),{[a]:o,[i]:t[o]}))}return n}function i(e){return Math.round(1e3*e)/1e3+""}function o(e){return"nominal"===e||"ordinal"===e}function n(e){return"quantitative"===e||"temporal"===e}"function"==typeof SuppressedError&&SuppressedError;const r={category10:"category10",category20:"category20",category20b:"category20",category20c:"category20",accent:"accent",dark2:"dark2",paired:"paired",pastel1:"pastel1",pastel2:"pastel2",set1:"set1",set2:"set2",set3:"set3",tableau10:"category10",tableau20:"category20"},s={linear:"linear","monotone-x":"monotoneX","monotone-y":"monotoneY",monotone:"monotoneX",step:"step","step-after":"stepAfter","step-before":"stepBefore",basis:"basis",cardinal:"cardinal","catmull-rom":"catmullRom"},c={sum:"sum",mean:"mean",average:"mean",count:"count",min:"min",max:"max",median:"mean"};function d(e){var l,a,i,d,f,p,y,g,m,b,h,x;const k=[],{type:A,markProps:L}=function(e){if("string"==typeof e)return{type:e,markProps:{}};const{type:t}=e;return{type:t,markProps:function(e,t){var l={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&0>t.indexOf(a)&&(l[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(a=Object.getOwnPropertySymbols(e);a.length>i;i++)0>t.indexOf(a[i])&&Object.prototype.propertyIsEnumerable.call(e,a[i])&&(l[a[i]]=e[a[i]])}return l}(e,["type"])}}(e.mark),w=e.encoding||{},O=w.x,S=w.y,j=w.color,B=w.size,C=w.theta,P=w.opacity;let M;(null===(l=e.data)||void 0===l?void 0:l.values)?M=e.data.values:(null===(a=e.data)||void 0===a?void 0:a.url)&&k.push("data.url is not supported — only inline data.values can be translated. Provide data manually."),e.transform&&e.transform.length>0&&k.push("Vega-Lite transforms are not supported. Pre-transform your data before passing to fromVegaLite()."),e.layer&&k.push('Layered specs ("layer") are not supported. Only single-mark specs can be translated.'),(e.hconcat||e.vconcat||e.concat)&&k.push('Concatenated views ("hconcat"/"vconcat"/"concat") are not supported. Translate each sub-spec individually.'),(e.facet||w.facet||w.row||w.column)&&k.push("Faceted views are not supported. Use Semiotic's LinkedCharts or render multiple charts manually."),e.repeat&&k.push('Repeated views ("repeat") are not supported. Translate each field combination individually.'),(e.params||e.selection)&&k.push("Selections/params are not supported. Use Semiotic's LinkedCharts and selection props for interactivity.");const R={};e.width&&(R.width=e.width),e.height&&(R.height=e.height);const z=function(e){if(e)return"string"==typeof e?e:e.text}(e.title);if(z&&(R.title=z),(null==j?void 0:j.field)&&(R.colorBy=j.field,null===(i=j.scale)||void 0===i?void 0:i.scheme)){const e=r[j.scale.scheme];e&&(R.colorScheme=e)}void 0!==(null==P?void 0:P.value)&&(R.pointOpacity=P.value);const $=null==O?void 0:O.aggregate,D=null==S?void 0:S.aggregate;if(M&&($||D)){const e=D?S:O,l=D?O:S,a=c[e.aggregate];if(a&&(null==l?void 0:l.field)&&e.field)M=t(M,{groupBy:l.field,value:e.field,agg:a});else if(("count"===a||"count"===e.aggregate)&&(null==l?void 0:l.field)&&M){const e=new Map;for(const t of M){const a=t[l.field]+"";e.set(a,(e.get(a)||0)+1)}M=Array.from(e,([e,t])=>({[l.field]:e,value:t}))}}if((null==O?void 0:O.bin)||(null==S?void 0:S.bin)){const e="Histogram";M&&(R.data=M),(null==O?void 0:O.bin)?(R.valueAccessor=O.field,(null==S?void 0:S.field)&&(R.categoryAccessor=S.field),(null===(d=O.axis)||void 0===d?void 0:d.title)&&(R.valueLabel=O.axis.title)):(null==S?void 0:S.bin)&&(R.valueAccessor=S.field,(null==O?void 0:O.field)&&(R.categoryAccessor=O.field),(null===(f=S.axis)||void 0===f?void 0:f.title)&&(R.valueLabel=S.axis.title));const t=(null==O?void 0:O.bin)||(null==S?void 0:S.bin),l="object"==typeof t?t.maxbins:void 0;return l&&(R.bins=l),v(e,R,k)}let N;switch(A){case"bar":N=function(e,t,l,a,i,r,s){var c,d,u,v,f,p;let y;return(null==l?void 0:l.field)&&!1!==(null==e?void 0:e.stack)&&!1!==(null==t?void 0:t.stack)&&null!==(null==e?void 0:e.stack)&&null!==(null==t?void 0:t.stack)?(y="StackedBarChart",a.stackBy=l.field):y="BarChart",o(null==e?void 0:e.type)&&n(null==t?void 0:t.type)?(a.categoryAccessor=e.field,a.valueAccessor=s?"value":t.field,(null===(c=null==e?void 0:e.axis)||void 0===c?void 0:c.title)&&(a.categoryLabel=e.axis.title),(null===(d=null==t?void 0:t.axis)||void 0===d?void 0:d.title)&&(a.valueLabel=t.axis.title)):n(null==e?void 0:e.type)&&o(null==t?void 0:t.type)?(a.categoryAccessor=t.field,a.valueAccessor=r?"value":e.field,a.orientation="horizontal",(null===(u=null==t?void 0:t.axis)||void 0===u?void 0:u.title)&&(a.categoryLabel=t.axis.title),(null===(v=null==e?void 0:e.axis)||void 0===v?void 0:v.title)&&(a.valueLabel=e.axis.title)):((null==e?void 0:e.field)&&(a.categoryAccessor=e.field),(null==t?void 0:t.field)&&(a.valueAccessor=s?"value":t.field),(null===(f=null==e?void 0:e.axis)||void 0===f?void 0:f.title)&&(a.categoryLabel=e.axis.title),(null===(p=null==t?void 0:t.axis)||void 0===p?void 0:p.title)&&(a.valueLabel=t.axis.title)),i&&(a.data=i),y}(O,S,j,R,M,$,D);break;case"line":if(N="LineChart",u(O,S,R,$,D),(null==j?void 0:j.field)&&(R.lineBy=j.field),L.interpolate){const e=s[L.interpolate];e&&(R.curve=e)}!0===L.point&&(R.showPoints=!0),M&&(R.data=M);break;case"area":if((null==j?void 0:j.field)?(N="StackedAreaChart",R.areaBy=j.field):N="AreaChart",u(O,S,R,$,D),L.interpolate){const e=s[L.interpolate];e&&(R.curve=e)}void 0!==L.opacity&&(R.areaOpacity=L.opacity),M&&(R.data=M);break;case"point":case"circle":case"square":(null==B?void 0:B.field)?(N="BubbleChart",R.sizeBy=B.field,(null===(p=B.scale)||void 0===p?void 0:p.range)&&(R.sizeRange=B.scale.range)):N="Scatterplot",u(O,S,R,$,D),M&&(R.data=M);break;case"rect":N="Heatmap",(null==O?void 0:O.field)&&(R.xAccessor=O.field),(null==S?void 0:S.field)&&(R.yAccessor=S.field),(null==j?void 0:j.field)&&(R.valueAccessor=j.field,delete R.colorBy),(null===(y=null==O?void 0:O.axis)||void 0===y?void 0:y.title)&&(R.xLabel=O.axis.title),(null===(g=null==S?void 0:S.axis)||void 0===g?void 0:g.title)&&(R.yLabel=S.axis.title),M&&(R.data=M);break;case"arc":L.innerRadius&&L.innerRadius>0?(N="DonutChart",R.innerRadius=L.innerRadius):N="PieChart",(null==C?void 0:C.field)?R.valueAccessor=C.field:(null==S?void 0:S.field)&&(R.valueAccessor=D?"value":S.field),(null==j?void 0:j.field)&&(R.categoryAccessor=j.field),(null==O?void 0:O.field)&&!(null==C?void 0:C.field)&&(R.categoryAccessor=O.field),M&&(R.data=M);break;case"tick":N="DotPlot",o(null==O?void 0:O.type)?(R.categoryAccessor=O.field,(null==S?void 0:S.field)&&(R.valueAccessor=D?"value":S.field),(null===(m=null==O?void 0:O.axis)||void 0===m?void 0:m.title)&&(R.categoryLabel=O.axis.title),(null===(b=null==S?void 0:S.axis)||void 0===b?void 0:b.title)&&(R.valueLabel=S.axis.title)):o(null==S?void 0:S.type)?(R.categoryAccessor=S.field,(null==O?void 0:O.field)&&(R.valueAccessor=$?"value":O.field),R.orientation="horizontal",(null===(h=null==S?void 0:S.axis)||void 0===h?void 0:h.title)&&(R.categoryLabel=S.axis.title),(null===(x=null==O?void 0:O.axis)||void 0===x?void 0:x.title)&&(R.valueLabel=O.axis.title)):((null==O?void 0:O.field)&&(R.categoryAccessor=O.field),(null==S?void 0:S.field)&&(R.valueAccessor=D?"value":S.field)),M&&(R.data=M);break;default:k.push(`Unsupported mark type "${A}". Defaulting to Scatterplot.`),N="Scatterplot",u(O,S,R,$,D),M&&(R.data=M)}return v(N,R,k)}function u(e,t,l,a,i){var o,n;(null==e?void 0:e.field)&&(l.xAccessor=a?"value":e.field),(null==t?void 0:t.field)&&(l.yAccessor=i?"value":t.field),(null===(o=null==e?void 0:e.axis)||void 0===o?void 0:o.title)&&(l.xLabel=e.axis.title),(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.title)&&(l.yLabel=t.axis.title)}function v(e,t,l){const a={component:e,props:t,version:"1",createdAt:(new Date).toISOString()};if(l.length>0){a.warnings=l;for(const e of l)console.warn("[semiotic/fromVegaLite] "+e)}return a}function f(e,t,l){const{featureKey:a,dataKey:i}=l,o=new Map;for(const e of t)o.set(e[i]+"",e);return e.map(e=>{const t=(e=>{const t=a.split(".");let l=e;for(const e of t)l=null==l?void 0:l[e];return(null!=l?l:"")+""})(e),l=o.get(t);return l?Object.assign(Object.assign({},e),{properties:Object.assign(Object.assign({},e.properties),l)}):e})}export{e as bin,d as fromVegaLite,l as groupBy,f as mergeData,a as pivot,t as rollup};
|
|
1
|
+
function e(e){let t=1/0,o=-1/0;for(const l of e)t>l&&(t=l),l>o&&(o=l);return[t,o]}function t(t,o){const{field:l,bins:i=10}=o,n=t.map(e=>Number(e[l])).filter(e=>!isNaN(e));if(0===n.length)return[];const[r,s]=e(n),c=o.domain?o.domain[0]:r,d=o.domain?o.domain[1]:s;if(c===d)return[{category:`${c}-${d}`,value:n.length}];const u=(d-c)/i,f=Array(i).fill(0);for(const e of n){let t=Math.floor((e-c)/u);t===i&&(t=i-1),t>=0&&i>t&&f[t]++}return f.map((e,t)=>{const o=c+t*u,l=o+u;return{category:`${a(o)}-${a(l)}`,value:e}})}function o(t,o){const{groupBy:l,value:i,agg:a="sum"}=o,n=new Map;for(const e of t){const t=e[l]+"";n.has(t)||n.set(t,[]),n.get(t).push(Number(e[i]))}const r=[];for(const[t,o]of n){let i;switch(a){case"count":i=o.length;break;case"mean":i=o.reduce((e,t)=>e+t,0)/o.length;break;case"min":i=e(o)[0];break;case"max":i=e(o)[1];break;default:i=o.reduce((e,t)=>e+t,0)}r.push({[l]:t,value:i})}return r}function l(e,t){const{key:o,fields:l}=t,i=new Map;for(const t of e){const e=t[o]+"";if(i.has(e)||i.set(e,[]),l){const o={};for(const e of l)e in t&&(o[e]=t[e]);i.get(e).push(o)}else i.get(e).push(Object.assign({},t))}const a=[];for(const[e,t]of i)a.push({id:e,coordinates:t});return a}function i(e,t){const{columns:o,nameField:l="name",valueField:i="value"}=t,a=new Set(o),n=[];for(const t of e){const e={};for(const o of Object.keys(t))a.has(o)||(e[o]=t[o]);for(const a of o)n.push(Object.assign(Object.assign({},e),{[l]:a,[i]:t[a]}))}return n}function a(e){return Math.round(1e3*e)/1e3+""}function n(e){return"nominal"===e||"ordinal"===e}function r(e){return"quantitative"===e||"temporal"===e}"function"==typeof SuppressedError&&SuppressedError;const s={category10:"category10",category20:"category20",category20b:"category20",category20c:"category20",accent:"accent",dark2:"dark2",paired:"paired",pastel1:"pastel1",pastel2:"pastel2",set1:"set1",set2:"set2",set3:"set3",tableau10:"category10",tableau20:"category20"},c={linear:"linear","monotone-x":"monotoneX","monotone-y":"monotoneY",monotone:"monotoneX",step:"step","step-after":"stepAfter","step-before":"stepBefore",basis:"basis",cardinal:"cardinal","catmull-rom":"catmullRom"},d={sum:"sum",mean:"mean",average:"mean",count:"count",min:"min",max:"max",median:"mean"};function u(e){var t,l,i,a,u,p,m,g,y,b,h,x;const A=[],{type:w,markProps:k}=function(e){if("string"==typeof e)return{type:e,markProps:{}};const{type:t}=e;return{type:t,markProps:function(e,t){var o={};for(var l in e)Object.prototype.hasOwnProperty.call(e,l)&&0>t.indexOf(l)&&(o[l]=e[l]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(l=Object.getOwnPropertySymbols(e);l.length>i;i++)0>t.indexOf(l[i])&&Object.prototype.propertyIsEnumerable.call(e,l[i])&&(o[l[i]]=e[l[i]])}return o}(e,["type"])}}(e.mark),L=e.encoding||{},O=L.x,S=L.y,B=L.color,R=L.size,j=L.theta,C=L.opacity;let E;(null===(t=e.data)||void 0===t?void 0:t.values)?E=e.data.values:(null===(l=e.data)||void 0===l?void 0:l.url)&&A.push("data.url is not supported — only inline data.values can be translated. Provide data manually."),e.transform&&e.transform.length>0&&A.push("Vega-Lite transforms are not supported. Pre-transform your data before passing to fromVegaLite()."),e.layer&&A.push('Layered specs ("layer") are not supported. Only single-mark specs can be translated.'),(e.hconcat||e.vconcat||e.concat)&&A.push('Concatenated views ("hconcat"/"vconcat"/"concat") are not supported. Translate each sub-spec individually.'),(e.facet||L.facet||L.row||L.column)&&A.push("Faceted views are not supported. Use Semiotic's LinkedCharts or render multiple charts manually."),e.repeat&&A.push('Repeated views ("repeat") are not supported. Translate each field combination individually.'),(e.params||e.selection)&&A.push("Selections/params are not supported. Use Semiotic's LinkedCharts and selection props for interactivity.");const N={};e.width&&(N.width=e.width),e.height&&(N.height=e.height);const P=function(e){if(e)return"string"==typeof e?e:e.text}(e.title);if(P&&(N.title=P),(null==B?void 0:B.field)&&(N.colorBy=B.field,null===(i=B.scale)||void 0===i?void 0:i.scheme)){const e=s[B.scale.scheme];e&&(N.colorScheme=e)}void 0!==(null==C?void 0:C.value)&&(N.pointOpacity=C.value);const I=null==O?void 0:O.aggregate,M=null==S?void 0:S.aggregate;if(E&&(I||M)){const e=M?S:O,t=M?O:S,l=d[e.aggregate];if(l&&(null==t?void 0:t.field)&&e.field)E=o(E,{groupBy:t.field,value:e.field,agg:l});else if(("count"===l||"count"===e.aggregate)&&(null==t?void 0:t.field)&&E){const e=new Map;for(const o of E){const l=o[t.field]+"";e.set(l,(e.get(l)||0)+1)}E=Array.from(e,([e,o])=>({[t.field]:e,value:o}))}}if((null==O?void 0:O.bin)||(null==S?void 0:S.bin)){const e="Histogram";E&&(N.data=E),(null==O?void 0:O.bin)?(N.valueAccessor=O.field,(null==S?void 0:S.field)&&(N.categoryAccessor=S.field),(null===(a=O.axis)||void 0===a?void 0:a.title)&&(N.valueLabel=O.axis.title)):(null==S?void 0:S.bin)&&(N.valueAccessor=S.field,(null==O?void 0:O.field)&&(N.categoryAccessor=O.field),(null===(u=S.axis)||void 0===u?void 0:u.title)&&(N.valueLabel=S.axis.title));const t=(null==O?void 0:O.bin)||(null==S?void 0:S.bin),o="object"==typeof t?t.maxbins:void 0;return o&&(N.bins=o),v(e,N,A)}let F;switch(w){case"bar":F=function(e,t,o,l,i,a,s){var c,d,u,f,v,p;let m;return(null==o?void 0:o.field)&&!1!==(null==e?void 0:e.stack)&&!1!==(null==t?void 0:t.stack)&&null!==(null==e?void 0:e.stack)&&null!==(null==t?void 0:t.stack)?(m="StackedBarChart",l.stackBy=o.field):m="BarChart",n(null==e?void 0:e.type)&&r(null==t?void 0:t.type)?(l.categoryAccessor=e.field,l.valueAccessor=s?"value":t.field,(null===(c=null==e?void 0:e.axis)||void 0===c?void 0:c.title)&&(l.categoryLabel=e.axis.title),(null===(d=null==t?void 0:t.axis)||void 0===d?void 0:d.title)&&(l.valueLabel=t.axis.title)):r(null==e?void 0:e.type)&&n(null==t?void 0:t.type)?(l.categoryAccessor=t.field,l.valueAccessor=a?"value":e.field,l.orientation="horizontal",(null===(u=null==t?void 0:t.axis)||void 0===u?void 0:u.title)&&(l.categoryLabel=t.axis.title),(null===(f=null==e?void 0:e.axis)||void 0===f?void 0:f.title)&&(l.valueLabel=e.axis.title)):((null==e?void 0:e.field)&&(l.categoryAccessor=e.field),(null==t?void 0:t.field)&&(l.valueAccessor=s?"value":t.field),(null===(v=null==e?void 0:e.axis)||void 0===v?void 0:v.title)&&(l.categoryLabel=e.axis.title),(null===(p=null==t?void 0:t.axis)||void 0===p?void 0:p.title)&&(l.valueLabel=t.axis.title)),i&&(l.data=i),m}(O,S,B,N,E,I,M);break;case"line":if(F="LineChart",f(O,S,N,I,M),(null==B?void 0:B.field)&&(N.lineBy=B.field),k.interpolate){const e=c[k.interpolate];e&&(N.curve=e)}!0===k.point&&(N.showPoints=!0),E&&(N.data=E);break;case"area":if((null==B?void 0:B.field)?(F="StackedAreaChart",N.areaBy=B.field):F="AreaChart",f(O,S,N,I,M),k.interpolate){const e=c[k.interpolate];e&&(N.curve=e)}void 0!==k.opacity&&(N.areaOpacity=k.opacity),E&&(N.data=E);break;case"point":case"circle":case"square":(null==R?void 0:R.field)?(F="BubbleChart",N.sizeBy=R.field,(null===(p=R.scale)||void 0===p?void 0:p.range)&&(N.sizeRange=R.scale.range)):F="Scatterplot",f(O,S,N,I,M),E&&(N.data=E);break;case"rect":F="Heatmap",(null==O?void 0:O.field)&&(N.xAccessor=O.field),(null==S?void 0:S.field)&&(N.yAccessor=S.field),(null==B?void 0:B.field)&&(N.valueAccessor=B.field,delete N.colorBy),(null===(m=null==O?void 0:O.axis)||void 0===m?void 0:m.title)&&(N.xLabel=O.axis.title),(null===(g=null==S?void 0:S.axis)||void 0===g?void 0:g.title)&&(N.yLabel=S.axis.title),E&&(N.data=E);break;case"arc":k.innerRadius&&k.innerRadius>0?(F="DonutChart",N.innerRadius=k.innerRadius):F="PieChart",(null==j?void 0:j.field)?N.valueAccessor=j.field:(null==S?void 0:S.field)&&(N.valueAccessor=M?"value":S.field),(null==B?void 0:B.field)&&(N.categoryAccessor=B.field),(null==O?void 0:O.field)&&!(null==j?void 0:j.field)&&(N.categoryAccessor=O.field),E&&(N.data=E);break;case"tick":F="DotPlot",n(null==O?void 0:O.type)?(N.categoryAccessor=O.field,(null==S?void 0:S.field)&&(N.valueAccessor=M?"value":S.field),(null===(y=null==O?void 0:O.axis)||void 0===y?void 0:y.title)&&(N.categoryLabel=O.axis.title),(null===(b=null==S?void 0:S.axis)||void 0===b?void 0:b.title)&&(N.valueLabel=S.axis.title)):n(null==S?void 0:S.type)?(N.categoryAccessor=S.field,(null==O?void 0:O.field)&&(N.valueAccessor=I?"value":O.field),N.orientation="horizontal",(null===(h=null==S?void 0:S.axis)||void 0===h?void 0:h.title)&&(N.categoryLabel=S.axis.title),(null===(x=null==O?void 0:O.axis)||void 0===x?void 0:x.title)&&(N.valueLabel=O.axis.title)):((null==O?void 0:O.field)&&(N.categoryAccessor=O.field),(null==S?void 0:S.field)&&(N.valueAccessor=M?"value":S.field)),E&&(N.data=E);break;default:A.push(`Unsupported mark type "${w}". Defaulting to Scatterplot.`),F="Scatterplot",f(O,S,N,I,M),E&&(N.data=E)}return v(F,N,A)}function f(e,t,o,l,i){var a,n;(null==e?void 0:e.field)&&(o.xAccessor=l?"value":e.field),(null==t?void 0:t.field)&&(o.yAccessor=i?"value":t.field),(null===(a=null==e?void 0:e.axis)||void 0===a?void 0:a.title)&&(o.xLabel=e.axis.title),(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.title)&&(o.yLabel=t.axis.title)}function v(e,t,o){const l={component:e,props:t,version:"1",createdAt:(new Date).toISOString()};if(o.length>0){l.warnings=o;for(const e of o)console.warn("[semiotic/fromVegaLite] "+e)}return l}function p(e,t={}){var o;if(!e||"number"!=typeof e.numRows||!e.schema)return console.warn("[semiotic/fromArrow] Expected an Arrow table with `numRows` and `schema`. Returning []."),[];const l=!1!==t.coerceBigInt,i=e.schema.fields.map(e=>e.name),a=null!==(o=t.fields)&&void 0!==o?o:i,n=[];for(const t of a){const o=e.getChild(t);o?n.push({name:t,column:o}):console.warn(`[semiotic/fromArrow] Column "${t}" is not in the table schema; skipping it.`)}let r=!1;const s=Array(e.numRows);for(let t=0;e.numRows>t;t++){const e={};for(const{name:o,column:i}of n){let a=i.get(t);l&&"bigint"==typeof a&&(a<BigInt(Number.MIN_SAFE_INTEGER)||a>BigInt(Number.MAX_SAFE_INTEGER)?r||(r=!0,console.warn("[semiotic/fromArrow] A 64-bit integer exceeds Number.MAX_SAFE_INTEGER; left as bigint to avoid precision loss.")):a=Number(a)),e[o]=a}s[t]=e}return s}function m(e,t,o){const{featureKey:l,dataKey:i}=o,a=new Map;for(const e of t)a.set(e[i]+"",e);return e.map(e=>{const t=(e=>{const t=l.split(".");let o=e;for(const e of t)o=null==o?void 0:o[e];return(null!=o?o:"")+""})(e),o=a.get(t);return o?Object.assign(Object.assign({},e),{properties:Object.assign(Object.assign({},e.properties),o)}):e})}export{t as bin,p as fromArrow,u as fromVegaLite,l as groupBy,m as mergeData,i as pivot,o as rollup};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Experimental entry point for temporary adapters and unstable previews.
|
|
3
|
+
*
|
|
4
|
+
* Anything imported from "semiotic/experimental" is intentionally outside
|
|
5
|
+
* Semiotic's stable public API. Exports may be renamed, moved, or removed
|
|
6
|
+
* without a deprecation window and are excluded from stable API-surface and
|
|
7
|
+
* bundle-size gates.
|
|
8
|
+
*/
|
|
9
|
+
export { EXPERIMENTAL_GOFISH_ADAPTER_NAME, unstable_fromGofishIR, } from "./components/recipes/gofishIR";
|
|
10
|
+
export type { GofishIRDocument as UnstableGofishIRDocument, GofishChartConfig as UnstableGofishChartConfig, GofishChartFamily as UnstableGofishChartFamily, FromGofishIROptions as UnstableFromGofishIROptions, } from "./components/recipes/gofishIR";
|
|
11
|
+
export { registerGofishLambda as unstable_registerGofishLambda, unregisterGofishLambda as unstable_unregisterGofishLambda, } from "./components/recipes/gofishLambdas";
|
|
12
|
+
export type { GofishLambda as UnstableGofishLambda, } from "./components/recipes/gofishLambdas";
|
|
13
|
+
export { gofishIRExamples as unstable_gofishIRExamples, flowerIR as unstable_gofishFlowerIR, bottleIR as unstable_gofishBottleIR, polarRibbonIR as unstable_gofishPolarRibbonIR, titanicCircleTreemapIR as unstable_gofishTitanicCircleTreemapIR, pythonMemoryIR as unstable_gofishPythonMemoryIR, bobaIR as unstable_gofishBobaIR, } from "./components/recipes/gofishIRExamples";
|
|
14
|
+
export type { GofishIRExample as UnstableGofishIRExample } from "./components/recipes/gofishIRExamples";
|
|
15
|
+
export { IDID_SPEC_VERSION, BUILTIN_INTENT_IDS as unstable_BUILTIN_INTENT_IDS, validatePortableCapability as unstable_validatePortableCapability, validatePortableAudienceProfile as unstable_validatePortableAudienceProfile, validatePortableAnnotation as unstable_validatePortableAnnotation, toVegaLite as unstable_toVegaLite, attachIDID as unstable_attachIDID, readIDID as unstable_readIDID, attachIDIDAnnotations as unstable_attachIDIDAnnotations, readIDIDAnnotations as unstable_readIDIDAnnotations, } from "./components/data/portability";
|
|
16
|
+
export { fromObservablePlot as unstable_fromObservablePlot } from "./components/data/fromObservablePlot";
|
|
17
|
+
export { fromMermaid as unstable_fromMermaid } from "./components/data/fromMermaid";
|
|
18
|
+
export type { MermaidResult as UnstableMermaidResult, MermaidNode as UnstableMermaidNode, MermaidEdge as UnstableMermaidEdge, MermaidDirection as UnstableMermaidDirection, MermaidNodeShape as UnstableMermaidNodeShape, } from "./components/data/fromMermaid";
|
|
19
|
+
export type { ObservablePlotSpec as UnstableObservablePlotSpec, ObservablePlotMark as UnstableObservablePlotMark, ObservablePlotMarkOptions as UnstableObservablePlotMarkOptions, ObservablePlotScale as UnstableObservablePlotScale, ObservablePlotChannel as UnstableObservablePlotChannel, } from "./components/data/fromObservablePlot";
|
|
20
|
+
export type { BuiltInIntentId as UnstableBuiltInIntentId, PortableIntentId as UnstablePortableIntentId, PortableChartRubric as UnstablePortableChartRubric, PortableChartVariant as UnstablePortableChartVariant, PortableChartCapability as UnstablePortableChartCapability, PortableReceptionModality as UnstablePortableReceptionModality, PortableAudienceTarget as UnstablePortableAudienceTarget, PortableAudienceProfile as UnstablePortableAudienceProfile, PortableAnnotationProvenance as UnstablePortableAnnotationProvenance, PortableAnnotationLifecycle as UnstablePortableAnnotationLifecycle, PortableAnnotated as UnstablePortableAnnotated, ValidationResult as UnstablePortabilityValidationResult, IDIDVegaLiteMeta as UnstableIDIDVegaLiteMeta, } from "./components/data/portability";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),t=require("d3-hierarchy");function n(e,t=-1/0){let n=t;for(const t of e)t>n&&(n=t);return n}function o(t,n="semiotic-gofish-glyph-layer"){return e.jsx("g",{className:n,style:{pointerEvents:"none"},children:t})}function r(t){return n=>{var r,i,a,s,l,c,u,p,h;const y=t(n),f=[],m=[];for(const e of y.marks){if("rect"===e.kind&&!1!==e.interactive){const t={type:"rect",x:e.x,y:e.y,w:e.width,h:e.height,cornerRadii:e.rx?{tl:e.rx,tr:e.rx,br:e.rx,bl:e.rx}:void 0,style:null!==(r=e.style)&&void 0!==r?r:{fill:null!==(i=n.theme.semantic.primary)&&void 0!==i?i:"#4e79a7",stroke:"none"},datum:null!==(a=e.datum)&&void 0!==a?a:null,group:e.group,_transitionKey:e.id};f.push(t)}else if("circle"===e.kind&&!1!==e.interactive){const t={type:"point",x:e.cx,y:e.cy,r:e.r,style:null!==(s=e.style)&&void 0!==s?s:{fill:null!==(l=n.theme.semantic.primary)&&void 0!==l?l:"#4e79a7",stroke:"none"},datum:null!==(c=e.datum)&&void 0!==c?c:null,pointId:e.id,_transitionKey:e.id};f.push(t)}else if("area"===e.kind){const t={type:"area",topPath:e.topPath,bottomPath:e.bottomPath,style:null!==(u=e.style)&&void 0!==u?u:{fill:null!==(p=n.theme.semantic.primary)&&void 0!==p?p:"#4e79a7",stroke:"none"},datum:null!==(h=e.datum)&&void 0!==h?h:null,group:e.group,_transitionKey:e.id};f.push(t)}"area"!==e.kind&&m.push(d(e))}return{nodes:f,overlays:m.some(Boolean)||null!=y.overlays?o(e.jsxs(e.Fragment,{children:[m,y.overlays]})):null}}}const i=t=>{var n,o,r,i,u,d,h,y,m,g,v;const b=t.config.diagram;if(!b)return{sceneNodes:[],sceneEdges:[],labels:[]};const k=t.dimensions.plot,w=Math.max(.68,Math.min(1,k.width/1120)),M=null!==(n=t.config.cellWidth)&&void 0!==n?n:Math.round(58*w),j=null!==(o=t.config.cellHeight)&&void 0!==o?o:Math.round(52*w),A=null!==(r=t.config.heapGap)&&void 0!==r?r:18,$=Math.round(198*w),S=Math.round(42*w),_=Math.round(42*w),O=S+b.stack.length*_+Math.round(18*w),R=k.x+16,B=k.y+28,L=[],I=[],C=new Map,P=new Map,z=function(e,t,n,o,r,i,a){const s=new Map,l=t=>{var n,o;return Math.max(r,(null!==(o=null===(n=e.heap[t])||void 0===n?void 0:n.values.length)&&void 0!==o?o:1)*r)},c=n+o+Math.max(54,.07*t.width),u=Math.max(0,a),d=t.y+Math.max(42,.18*t.height),p=Math.min(t.y+t.height-i-20,d+Math.max(96,2.8*i)+1.15*u);if(e.heapArrangement.forEach((e,t)=>{e.forEach((e,n)=>{null!=e&&s.set(e,{x:c+n*(2.55*r+a),y:0===t?d:p})})}),e.heap.length>=5){const e=t.x+t.width-16,i=e-l(4),a=Math.max(24,.55*r+.75*u),h=Math.max(54,1.15*r+1.35*u),y=Math.max(120,2.55*r+2.1*u),f=Math.min(i-l(2)-h,c+l(0)+a),m=Math.min(e-l(3)-y,c+l(0)+h),g=Math.min(Math.max(c+3.1*r+u,n+o+Math.max(150,.19*t.width)+u),f-l(1)-a);s.set(0,{x:c,y:d}),s.set(1,{x:g,y:p}),s.set(2,{x:f,y:p}),s.set(3,{x:m,y:d}),s.set(4,{x:i,y:p})}return s}(b,k,R,$,M,j,A),V="#1A5683",W="#222",N="#777";L.push({type:"rect",id:"python-global-frame",x:R,y:B,w:$,h:O,style:{fill:"#dce7f4",stroke:"none"},datum:f({kind:"global frame"}),label:"Global frame"}),I.push(e.jsxs("g",{children:[e.jsx("text",{x:R+12*w,y:B+25*w,fontSize:24*w,fontFamily:"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",fill:W,children:"Global Frame"}),e.jsx("line",{x1:R,y1:B,x2:R,y2:B+O,stroke:"#9caebf",strokeWidth:4*w})]},"python-global-overlay"));for(const n of t.nodes){const t=a(n),o=(null!==(i=t.id)&&void 0!==i?i:n.id)+"";if("binding"===t.kind){const n=B+S+p(t.index)*_,r=(null!==(u=t.value)&&void 0!==u?u:"")+"",i=p(t.pointer),a=Number.isFinite(i)&&r.startsWith("->"),s=n+_/2+6*w,l=R+$-40*w,c=R+$-34*w,y=n+_/2;L.push({type:"rect",id:o,x:R,y:n,w:$,h:_,style:{fill:"rgba(0,0,0,0)",stroke:"none"},datum:t,label:(null!==(d=t.name)&&void 0!==d?d:o)+""}),I.push(e.jsxs("g",{children:[e.jsx("text",{x:R+124*w,y:s,fontSize:25*w,fill:W,children:(null!==(h=t.name)&&void 0!==h?h:o)+""}),e.jsxs(e.Fragment,a?{children:[e.jsx("path",{d:`M${l-12*w},${y-18*w} L${l-12*w},${y+18*w} L${l+28*w},${y+18*w}`,fill:"none",stroke:"#8d9aa0",strokeWidth:1.2}),e.jsx("circle",{cx:c,cy:y,r:3.6*w,fill:V})]}:{children:[e.jsx("text",{x:l,y:s,fontSize:25*w,fill:W,children:r}),e.jsx("line",{x1:l-3*w,y1:y+18*w,x2:l+27*w,y2:y+18*w,stroke:"#8d9aa0",strokeWidth:1.2})]})]},"python-binding-label-"+o)),a&&C.set(o,[c,y])}else if("heap cell"===t.kind){const e=p(t.address),n=p(t.cellIndex),r=z.get(e);if(!r)continue;const i={x:r.x+n*M,y:r.y},a=((null!==(y=t.value)&&void 0!==y?y:"")+"").startsWith("->");L.push({type:"rect",id:o,x:i.x,y:i.y,w:M,h:j,style:{fill:"#fffcc5",stroke:"#a8a8a8",strokeWidth:1},datum:t,label:(null!==(m=t.value)&&void 0!==m?m:"")+""}),a&&C.set(o,[i.x+M/2,i.y+j/2])}}z.forEach((t,n)=>{const o=b.heap[n];o&&(P.set("tuple-"+n,[t.x-8*w,t.y+j/2]),I.push(e.jsxs("g",{children:[e.jsx("text",{x:t.x,y:t.y-14*w,fontSize:16*w,fill:N,children:"tuple"}),o.values.map((o,r)=>{const i=t.x+r*M,a=x(o);return e.jsxs("g",{children:[e.jsx("text",{x:i+2*w,y:t.y+16*w,fontSize:15*w,fill:N,children:r}),a?e.jsx("circle",{cx:i+M/2,cy:t.y+j/2,r:3.6*w,fill:V}):e.jsx("text",{x:i+M/2,y:t.y+j/2+9*w,textAnchor:"middle",fontSize:25*w,fill:W,children:o+""})]},`python-tuple-cell-label-${n}-${r}`)})]},"python-tuple-"+n)))});const E=[],F=[];for(const n of t.edges){const t=s(n.source),o=s(n.target),r=C.get(t),i=null!==(g=P.get(l(o)))&&void 0!==g?g:C.get(o);if(!r||!i)continue;const a=c(r,i);n.bezier={circular:!1,points:a.points,halfWidth:2},E.push({type:"curved",pathD:a.d,style:{stroke:"rgba(26, 86, 131, 0.001)",strokeWidth:1,fill:"none"},datum:null!==(v=n.data)&&void 0!==v?v:n}),F.push(e.jsx("path",{d:a.d,fill:"none",stroke:V,strokeWidth:2.4*w,markerEnd:"url(#semiotic-gofish-memory-arrow)"},`python-pointer-${t}-${o}`))}return{sceneNodes:L,sceneEdges:E,labels:[],overlays:e.jsxs("g",{className:"semiotic-gofish-python-memory",style:{pointerEvents:"none"},children:[e.jsx("defs",{children:e.jsx("marker",{id:"semiotic-gofish-memory-arrow",markerWidth:"9",markerHeight:"9",refX:"8",refY:"4.5",orient:"auto",children:e.jsx("path",{d:"M0,0 L9,4.5 L0,9 Z",fill:V})})}),F,I]})}};function a(e){var t;return null!==(t=e.data)&&void 0!==t?t:e}function s(e){return"string"==typeof e?e:e.id}function l(e){const t=/^cell-(\d+)-0$/.exec(e);return t?"tuple-"+t[1]:e}function c(e,t){const n=t[0]-e[0],o=t[1]-e[1],r=Math.max(34,Math.min(160,.42*Math.abs(n))),i={x:e[0]+r,y:e[1]},a={x:t[0]-r,y:t[1]};80>Math.abs(n)&&Math.abs(o)>20&&(i.x=e[0],i.y=e[1]+.55*o,a.x=t[0],a.y=t[1]-.55*o);const s={x:e[0],y:e[1]},l={x:t[0],y:t[1]};return{d:`M${s.x},${s.y} C${i.x},${i.y} ${a.x},${a.y} ${l.x},${l.y}`,points:[s,i,a,l]}}function u(t,n,o){if(!n)return o;const r=t+"-clip";return e.jsxs("g",{children:[e.jsx("defs",{children:e.jsx("clipPath",{id:r,children:e.jsx("path",{d:n})})}),e.jsx("g",{clipPath:`url(#${r})`,children:o})]},t+"-clipwrap")}function d(t){var n;const o=function(e){if(!e)return{};return{fill:"string"==typeof e.fill?e.fill:void 0,fillOpacity:e.fillOpacity,stroke:e.stroke,strokeWidth:e.strokeWidth,strokeDasharray:e.strokeDasharray,strokeLinecap:e.strokeLinecap,opacity:e.opacity}}("style"in t?t.style:void 0);return"rect"===t.kind&&!1===t.interactive?u(t.id,t.clipPath,e.jsx("rect",{"data-gofish-id":t.id,x:t.x,y:t.y,width:t.width,height:t.height,rx:t.rx,style:o},t.id)):"circle"===t.kind&&!1===t.interactive?e.jsx("circle",{"data-gofish-id":t.id,cx:t.cx,cy:t.cy,r:t.r,style:o},t.id):"image"===t.kind?u(t.id,t.clipPath,e.jsx("image",{"data-gofish-id":t.id,href:t.href,x:t.x,y:t.y,width:t.width,height:t.height,preserveAspectRatio:null!==(n=t.preserveAspectRatio)&&void 0!==n?n:"none",opacity:t.opacity},t.id)):"path"===t.kind?u(t.id,t.clipPath,e.jsx("path",{"data-gofish-id":t.id,d:t.d,style:o},t.id)):"line"===t.kind?e.jsx("line",{"data-gofish-id":t.id,x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,style:o},t.id):"text"===t.kind?e.jsx("text",{"data-gofish-id":t.id,x:t.x,y:t.y,fontSize:t.fontSize,fontWeight:t.fontWeight,textAnchor:t.textAnchor,dominantBaseline:t.dominantBaseline,transform:t.transform,style:o,children:t.text},t.id):null}function p(e){const t=Number(e);return Number.isFinite(t)?t:0}function h(e){return function(){const t=Object.create(null);return(t=>{for(const[n,o]of Object.entries(e))t(n,o)})((e,n)=>{t[e]=n}),t}()}function y(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"item"}const f=h;function m(e,t,n,o){return[e+Math.cos(o)*n,t+Math.sin(o)*n]}function g(e){if(0===e.length)return"";if(1===e.length)return`M${e[0][0]},${e[0][1]}Z`;let t=`M${e[0][0]},${e[0][1]}`;for(let n=1;e.length>n;n++){const o=e[n-1],r=e[n];t+=` Q${(o[0]+r[0])/2},${o[1]} ${r[0]},${r[1]}`}return t+="Z",t}function x(e){return"object"==typeof e&&null!=e&&"pointer"in e}function v(e){return x(e)?"-> "+e.pointer:e+""}const b=new Map;function k(e,t){return b.set(e,t),()=>{b.get(e)===t&&b.delete(e)}}function w(e,t){var n;return null!==(n=null==t?void 0:t[e])&&void 0!==n?n:b.get(e)}const M=1.75,j="#222222";function A(e,t){return e.topRadius+(t-e.height)/e.height*(e.topRadius-e.bottomRadius)}function $(e,t){return function(e,t,n){return Math.PI*n/3*(e*e+e*t+t*t)}(A(e,t),e.bottomRadius,t)}function S(e,t){const n=43758.5453*Math.sin(12.9898*e+78.233);return 2*(n-Math.floor(n)-.5)*t}function _(e,t){if(t>e||2*t>e)return[{x:0,y:0}];const n=[],o=e=>{let r=Math.floor(2*Math.PI*e/(2*t));1>r&&(r=1);const i=Math.hypot(e-e*Math.cos(2*Math.PI/r),-e*Math.sin(2*Math.PI/r));2*t>i&&r>1&&r--;for(let t=0;r>t;t++)n.push({x:e*Math.cos(2*t*Math.PI/r),y:e*Math.sin(2*t*Math.PI/r)});const a=e-2*t;t>a?e>2*t&&n.push({x:0,y:0}):o(a)};return o(e-t),n}function O(e,t){const n=Number(e);return Number.isFinite(n)?n:t}function R(e){const t={height:O(e.cupHeight,15.5),topRadius:O(e.cupTopRadius,4.75),bottomRadius:O(e.cupBottomRadius,3.75)},n=O(e.bobaRadius,.6),o=Math.max(0,O(e.teaVolume,450)),r=Math.max(0,O(e.bobaVolume,110)),i=Math.max(0,O(e.iceVolume,135)),a=Math.PI*n*n,s=Math.floor(r/a),l=s*a,c=Math.floor(i/5.359375),u=c*M*M*M,d=o+l+u,p=Math.min(t.height,Math.max(0,function(e,t){const n=(e.topRadius+e.bottomRadius)/2,o=Math.PI*n*n;let r=t/o,i=t-$(e,r),a=0;for(;100>a&&Math.abs(i)>1e-4;)r+=i/o,i=t-$(e,r),a++;return r}(t,d))),h=A(t,p),y=[];let f=s,m=0;for(;f>0&&60>m;){const e=n*(1+2*m),o=_(A(t,e),n),r=o.length-f,i=r>1?o.slice(Math.floor(r/2),Math.floor(r/2)+f):o,a=t.height-e;if(i.forEach((e,t)=>y.push({x:e.x+S(97*m+t,.15),z:a+S(31*m+t,.05),r:n})),f-=i.length,m++,0===i.length)break}const g=m*n*2,x=[];if(c>0){let e=0,n=c;for(;n>0&&60>e;)n-=Math.max(1,Math.floor(2*A(t,g+.875*(1+2*e))/M)),e++;const o=Math.max(g,p-e*M)+.875;let r=0;for(let n=0;e>n&&c>r;n++){const e=o+M*n,i=A(t,e),a=Math.max(1,Math.floor(2*i/M)),s=(2*i-a*M)/(a+1),l=-i+s,u=t.height-e-.875-.1;for(let e=0;a>e&&c>r;e++)x.push({cx:l+(s+M)*e+.875,cy:u+.875,w:.95*M,rot:S(53*n+e,10)}),r++}}const v=t.height,b=t.height-20.32,k=v-p;return{cupHeight:v,halfWidth:t.topRadius+.9,cup:[[-t.topRadius,0],[-t.bottomRadius,v],[t.bottomRadius,v],[t.topRadius,0]],tea:o>0?[[-h,k],[-t.bottomRadius,v],[t.bottomRadius,v],[h,k]]:null,straw:[[-.635,b],[-.635,v-.4],[.635,v-1.27-.4],[.635,b]],lid:{x1:-(t.topRadius+.9),x2:t.topRadius+.9,y:0},pearls:y,ice:x,numBobas:s,numIce:c,teaVolume:Math.round(o),bobaVolume:Math.round(l),iceVolume:Math.round(u),totalVolume:Math.round(d)}}function B(e,t){const{ref:n,halfWidth:o,topExtent:r}=t,i=2*o/n,a=r/n,s=e=>(e+o)/n,l=t=>a-(e.cupHeight-t)/n,c=e=>e/n,u=e=>[s(e[0]),l(e[1])];return{cup:e.cup.map(u),tea:e.tea?e.tea.map(u):null,straw:e.straw?e.straw.map(u):null,lid:{x1:s(e.lid.x1),x2:s(e.lid.x2),y:l(e.lid.y)},pearls:e.pearls.map(e=>({x:s(e.x),y:l(e.z),r:c(e.r),fill:"#222222"})),ice:e.ice.map(e=>({x:s(e.cx),y:l(e.cy),w:c(e.w),rot:e.rot,fill:"#a5f2f3"})),box:[i,a],numBobas:e.numBobas,numIce:e.numIce,teaVolume:e.teaVolume,bobaVolume:e.bobaVolume,iceVolume:e.iceVolume,totalVolume:e.totalVolume,cupStroke:j}}k("bobaGeometry",{kind:"derive",fn:e=>{const t=e.map(R),o=function(e){const t=n(e.map(e=>e.halfWidth),1),o=n(e.map(e=>Math.max(e.cupHeight,20.32)),1);return{halfWidth:t,topExtent:o,ref:Math.max(2*t,o)}}(t);return e.map((e,n)=>Object.assign(Object.assign({},e),{_g:B(t[n],o),teaFill:"#D2B799",strawFill:"#4F91CB",cupStroke:j,lidFill:j}))}});const L=[[.43,.04],[.57,.04],[.57,.2],[.8,.34],[.8,.82],[.72,.9],[.28,.9],[.2,.82],[.2,.34],[.43,.2]];function I(){const e="M"+L.map(e=>`${(100*e[0]).toFixed(1)},${(100*e[1]).toFixed(1)}`).join(" L")+" Z";return"data:image/svg+xml,"+encodeURIComponent(`<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'><path d='${e}' fill='rgba(150,180,195,0.30)' stroke='#6b7e88' stroke-width='2.4' stroke-linejoin='round'/></svg>`)}function C(e){var t;const n=Math.max(0,Math.min(100,O(e.amount,50))),o=.9-n/100*.8;return{silhouette:L,imageHref:I(),fill:{x:0,y:o,w:1,h:1-o},fillLine:{x1:.12,x2:.96,y:o},pct:{x:.84,y:o,text:Math.round(n)+"%"},label:{x:.5,y:.975,text:(null!==(t=e.category)&&void 0!==t?t:"")+""},fillFill:"#20bf55"}}function P(e,t){if(e)return t.includes(".")?t.split(".").reduce((e,t)=>null==e?void 0:e[t],e):e[t]}function z(e,t){if(null!=e){if("object"==typeof e){const n=e;return"field"===n.type&&"string"==typeof n.name?P(t,n.name):"datum"===n.type?n.datum:void 0}if("string"==typeof e){const n=P(t,e);return void 0!==n?n:e}return e}}function V(e,t){const n=z(e,t),o=Number(n);return Number.isFinite(o)?o:void 0}function W(e,t){let n=0;for(const o of t){const t=V(e,o);null!=t&&(n+=t)}return n}function N(e){return null==e?null:"object"==typeof e&&"field"===e.type&&"string"==typeof e.name?e.name:null}function E(e,t,n,o){var r,i;const a=N(e);if(a){const s=null!==(i=null!==(r=o.sizeOverride.get(a))&&void 0!==r?r:o.domains.get(a))&&void 0!==i?i:0;return s>0?Math.max(0,Math.min(1,W(e,t)/s))*n:n}return"number"==typeof e?Math.min(e,n):n}function F(e,t){var n;if(U(e)){for(const o of null!==(n=e.children)&&void 0!==n?n:[]){const e=F(o,t);if(e)return e}return null}return N("y"===t?e.h:e.w)}function D(e,t,o,r){var i,a;const s=(null!==(i=e.children)&&void 0!==i?i:[])[0];if(!s||0===t.length)return()=>{};const l=F(s,o);if(!l)return()=>{};const c={type:"field",name:l},u=n(t.map(e=>W(c,e.rows)),0);if(u<=(null!==(a=r.domains.get(l))&&void 0!==a?a:0))return()=>{};const d=r.sizeOverride.get(l);return r.sizeOverride.set(l,u),()=>{void 0===d?r.sizeOverride.delete(l):r.sizeOverride.set(l,d)}}k("bottleGeometry",{kind:"derive",fn:e=>e.map(e=>Object.assign(Object.assign({},e),{_b:C(e)}))});const T=new Set(["spread","stack","scatter","treemap","group"]),H=new Set(["derive","log"]);function q(e,t){let n=t;for(let t=e.length-1;t>=0;t--){const o=e[t];n={type:o.type,__combinator:!0,options:Object.assign({},o),children:[n]}}return n}function G(e,t){const n=[],o=new Map,r=t.startsWith("datum.")?t.slice(6):t;for(const t of e){const e=P(t,r)+"";o.has(e)||(o.set(e,[]),n.push(e)),o.get(e).push(t)}return n.map(e=>({key:e,rows:o.get(e)}))}function Z(e,t,n){var o,r,i;if(U(e)){const a=null!==(r=null===(o=e.options)||void 0===o?void 0:o.dir)&&void 0!==r?r:"y",s=null!==(i=e.children)&&void 0!==i?i:[];if("stack"===e.type){const e=s.map(e=>Z(e,t,n));return a===n?e.reduce((e,t)=>e+t,0):Math.max(0,...e)}return Math.max(0,...s.map(e=>Z(e,t,n)),1)}const a=W("y"===n?e.h:e.w,t);return a>0?a:t.length||1}function U(e){return!0===e.__combinator&&Array.isArray(e.children)}function Y(e,t){return e.ids.n+=1,`${t}-${e.ids.n}`}function X(e,t,n,o,r,i){const a=[];for(let s=0;i>=s;s++)a.push(m(e,t,n,o+s/i*(r-o)));return a}function K(e,n,o,r,i,a,s=!1){var l,c;const u=null===(l=e.options)||void 0===l?void 0:l.coord,d=null==u?void 0:u.type;if("polar"===d&&"polar"!==r){const t=(n.x0+n.x1)/2,r=(n.y0+n.y1)/2,i=Math.min(Math.abs(n.x1-n.x0),Math.abs(n.y1-n.y0))/2,s={cx:t,cy:r};return void function(e,t,n,o,r,i){var a;for(const o of null!==(a=e.children)&&void 0!==a?a:[])K(o,t,n,"polar",r,i)}(e,{x0:0,y0:"number"==typeof(null==u?void 0:u.innerRadius)?Math.max(0,Math.min(.95,u.innerRadius))*i:0,x1:2*Math.PI,y1:i},o,0,s,a)}if("unit"===d&&"unit"!==r){const t=Q(n,u,o[0]);for(const r of null!==(c=e.children)&&void 0!==c?c:[])ne(r,n,o,a,t);return}U(e)?function(e,n,o,r,i,a,s){var l,c,u,d,p;const h=null!==(l=e.options)&&void 0!==l?l:{},y=e.type;if("derive"===y||"log"===y){const t=h.lambdaId;let l=o;if("derive"===y){const e=t?w(t,a.options.lambdas):void 0;e&&"derive"===e.kind?l=e.fn(o):t&&a.warnings.push(`derive lambda "${t}" is not registered; passing data through.`)}for(const t of null!==(c=e.children)&&void 0!==c?c:[])K(t,n,l,r,i,a,s);return}if("layer"===y){const t=null!==(u=e.children)&&void 0!==u?u:[],l=e=>{var t;return!U(e)&&("rect"===e.type||"area"===e.type)&&null!=N(null!==(t=e.h)&&void 0!==t?t:e.w)},c=e=>{var t,n;return"polar"===(null===(n=null===(t=e.options)||void 0===t?void 0:t.coord)||void 0===n?void 0:n.type)},p=t.filter(l);let h=null,y=null;for(const e of p)if(K(e,n,o,r,i,a,s),"none"===r){const t=E(e.h,o,n.y1-n.y0,a);h=n.y1-t,y=(n.x0+n.x1)/2}for(const e of t)if(!l(e))if(null!=h&&null!=y&&c(e)){const t="number"==typeof(null===(d=e.options)||void 0===d?void 0:d.radiusFactor)?e.options.radiusFactor:.2,l=Math.min(Math.abs(n.x1-n.x0),Math.abs(n.y1-n.y0))*t;K(e,{x0:y-l,y0:h-l,x1:y+l,y1:h+l},o,r,i,a,s)}else K(e,n,o,r,i,a,s);return}const f=h.by;if("group"===y){const t=f?G(o,f):[{key:"",rows:o}],l=(null!==(p=e.children)&&void 0!==p?p:[])[0];if(!l)return;for(const e of t)K(l,n,e.rows,r,i,a,s);return}"spread"!==y?"stack"!==y?"scatter"!==y?"treemap"!==y?"connect"!==y&&"arrow"!==y?a.warnings.push(`Unsupported combinator "${y}" — children skipped.`):function(e,t,n){var o,r;const i=null!==(o=e.options)&&void 0!==o?o:{},a=[];for(const t of null!==(r=e.children)&&void 0!==r?r:[])if("ref"===t.type){const e=t.selection;Array.isArray(e)?a.push(e.map(String).join("-")):null!=e&&a.push(e+"")}n.relations.push({kind:"arrow"===e.type?"arrow":"connect",refs:a,fill:"string"==typeof i.fill?i.fill:void 0,stroke:"string"==typeof i.stroke?i.stroke:void 0,opacity:"number"==typeof i.opacity?i.opacity:void 0,interpolation:"bezier"===i.interpolation?"bezier":"linear"})}(e,0,a):function(e,n,o,r,i,a){var s,l;const c=null!==(s=e.options)&&void 0!==s?s:{},u=c.by,d=c.valueField,p=(null!==(l=e.children)&&void 0!==l?l:[])[0];if(!p)return;const h=u?G(o,u):o.map((e,t)=>({key:t+"",rows:[e]})),y=h.map(e=>{return{value:(t=e.rows,d?Math.max(0,W({type:"field",name:d},t)):t.length),item:{rows:e.rows,key:e.key}};var t}).filter(e=>{var t;return(null!==(t=e.value)&&void 0!==t?t:0)>0});if(0===y.length)return;const f=Math.max(1,n.x1-n.x0),m=Math.max(1,n.y1-n.y0),g=Number(c.paddingInner)||1,x=t.treemap().tile(t.treemapSquarify).size([f,m]).paddingInner(g).round(!0)(t.hierarchy({children:y}).sum(e=>{var t;return null!==(t=e.value)&&void 0!==t?t:0}));for(const e of x.leaves()){const t=e.data.item;t&&K(p,{x0:n.x0+e.x0,y0:n.y0+e.y0,x1:n.x0+e.x1,y1:n.y0+e.y1},t.rows,r,i,a,!0)}}(e,n,o,r,i,a):function(e,t,n,o,r,i){var a,s;const l=null!==(a=e.options)&&void 0!==a?a:{},c=(null!==(s=e.children)&&void 0!==s?s:[])[0];if(!c)return;const u=l.by,d=u?G(n,u).map(e=>({rows:e.rows,anchor:e.rows[0]})):n.map(e=>({rows:[e],anchor:e})),p=d.map(e=>e.anchor),h=p.map(e=>V(l.x,e)).filter(e=>null!=e),y=p.map(e=>V(l.y,e)).filter(e=>null!=e),f=Math.abs(t.x1-t.x0),m=Math.abs(t.y1-t.y0),g=Math.min(.5*f,f/Math.max(1,d.length)*.5),x=.12*m,v=.06*m,b=te(h,t.x0+g,t.x1-g),k=te(y,t.y1-v,t.y0+x),w=D(e,d,"y",i);for(const e of d){const n=V(l.x,e.anchor),a=V(l.y,e.anchor),s=null!=n?b(n):(t.x0+t.x1)/2,u=.4*Math.min(f/Math.max(1,d.length),m);K(c,null!=a&&null!=l.y?{x0:s-u,y0:k(a)-u,x1:s+u,y1:k(a)+u}:{x0:s-u,y0:t.y0+x,x1:s+u,y1:t.y1-v},e.rows,o,r,i)}w()}(e,n,o,r,i,a):J(e,n,o,r,i,a,!0):J(e,n,o,r,i,a,!1)}(e,n,o,r,i,a,s):function(e,t,n,o,r,i,a){var s;if("mark-fn"===e.type)return void function(e,t,n,o){const r=e.lambdaId,i=r?w(r,o.options.lambdas):void 0,a=Math.min(t.x0,t.x1),s=Math.min(t.y0,t.y1),l=Math.abs(t.x1-t.x0),c=Math.abs(t.y1-t.y0);if(!i||"mark-fn"!==i.kind)return r&&o.warnings.push(`mark-fn lambda "${r}" is not registered; drawing a placeholder.`),void o.marks.push({kind:"rect",id:Y(o,"markfn"),x:a,y:s,width:l,height:c,style:{fill:"rgba(0,0,0,0.04)",stroke:"var(--semiotic-border,#bbb)"},datum:null!=n?n:void 0});const u=i.fn(null!=n?n:{},{x:a,y:s,w:l,h:c});for(const e of u)re(e,a,s,l,c,o)}(e,t,null!==(s=n[0])&&void 0!==s?s:null,i);const l=e.repeat;if(l){const o=P(n[0],l);if(Array.isArray(o)){const r=Q(t,void 0,n[0]),a=Object.assign(Object.assign({},e),{repeat:void 0});for(const e of o)ne(a,t,[e],i,r)}return}"polar"===o&&r?function(e,t,n,o,r){var i,a,s,l,c,u,d,p;const h=null!==(i=n[0])&&void 0!==i?i:null,y=null!==(l=null!==(s=null===(a=e.origin)||void 0===a?void 0:a.name)&&void 0!==s?s:e.name)&&void 0!==l?l:e.type,f=t.x0,g=t.x1,x=t.y0,v=t.y1,b=ie(e,h,r);if("petal"===e.type){const t=null!==(u=null!==(c=e.h)&&void 0!==c?c:e.size)&&void 0!==u?u:e.r,i=N(t);let a=v;if(i){const e=null!==(p=null!==(d=r.sizeOverride.get(i))&&void 0!==d?d:r.domains.get(i))&&void 0!==p?p:0;e>0&&(a=x+(v-x)*(.35+.65*Math.max(0,Math.min(1,W(t,n)/e))))}const s=function(e,t,n,o,r,i){const a=(r+i)/2,s=m(e,t,n,r),l=m(e,t,o,a),c=m(e,t,n,i);return`M${s[0]},${s[1]} Q${l[0]},${l[1]} ${c[0]},${c[1]} Q${e},${t} ${s[0]},${s[1]} Z`}(o.cx,o.cy,Math.max(1,.16*a),a,f,g);return r.marks.push({kind:"path",id:Y(r,y),d:s,style:b,datum:se(0,n),group:ae(e,h)}),void function(e,t,n,o){var r,i;const a=null!==(r=e.name)&&void 0!==r?r:null===(i=e.origin)||void 0===i?void 0:i.name;a&&o.frames.set(a,{name:a,cx:t[0],cy:t[1],bbox:{x:t[0],y:t[1],w:0,h:0}})}(e,m(o.cx,o.cy,(x+a)/2,(f+g)/2),0,r)}if("rect"===e.type||"area"===e.type){const t=ae(e,h),i=V(e.w,h),a=(f+g)/2,s=null!=i?a-i/2:f,l=null!=i?a+i/2:g,c=Math.max(2,Math.ceil(Math.abs(l-s)/.12)),u=X(o.cx,o.cy,v,s,l,c),d=X(o.cx,o.cy,x,s,l,c);return r.marks.push({kind:"area",id:Y(r,y),topPath:u,bottomPath:d,style:b,datum:n.length?n:void 0,group:t}),void r.polarSegments.push({group:t,cx:o.cx,cy:o.cy,innerR:x,outerR:v,theta0:s,theta1:l})}if("circle"===e.type){const[t,n]=m(o.cx,o.cy,(x+v)/2,(f+g)/2);return void r.marks.push({kind:"circle",id:Y(r,y),cx:t,cy:n,r:3,style:b,datum:null!=h?h:void 0,interactive:e.interactive})}const[k,w]=m(o.cx,o.cy,(x+v)/2,(f+g)/2);oe(e,k,w,h,r)}(e,t,n,r,i):function(e,t,n,o,r){var i,a,s,l;const c=null!==(i=n[0])&&void 0!==i?i:null,u=null!==(l=null!==(s=null===(a=e.origin)||void 0===a?void 0:a.name)&&void 0!==s?s:e.name)&&void 0!==l?l:e.type,d=Math.min(t.x0,t.x1),p=Math.max(t.x0,t.x1),h=Math.min(t.y0,t.y1),y=Math.max(t.y0,t.y1),f=(e,t)=>"number"==typeof e?Math.min(e,t):t;if("rect"===e.type||"image"===e.type){const t=p-d,i=y-h,a=r?f(e.w,t):E(e.w,n,t,o),s=r?f(e.h,i):E(e.h,n,i,o);return o.marks.push({kind:"rect",id:Y(o,u),x:d+(t-a)/2,y:y-s,width:Math.max(0,a),height:Math.max(0,s),style:ie(e,c,o),datum:se(0,n),group:ae(e,c),interactive:e.interactive}),void("image"===e.type&&o.warnings.push(`image mark "${u}" rendered as a placeholder rect (href not loaded).`))}if("circle"===e.type){const t=(d+p)/2,r=(h+y)/2,i=Math.min(p-d,y-h)/2;return void o.marks.push({kind:"circle",id:Y(o,u),cx:t,cy:r,r:Math.max(0,i),style:ie(e,c,o),datum:se(0,n),group:ae(e,c),interactive:e.interactive})}"line"!==e.type?oe(e,(d+p)/2,(h+y)/2,c,o):o.marks.push({kind:"line",id:Y(o,u),x1:d,y1:y,x2:p,y2:h,style:ie(e,c,o)})}(e,t,n,i,a)}(e,n,o,r,i,a,s)}function Q(e,t,n){const o=Math.min(e.x0,e.x1),r=Math.min(e.y0,e.y1),i=Math.abs(e.x1-e.x0),a=Math.abs(e.y1-e.y0);if("uniform"!==(null==t?void 0:t.fit))return{ux:e=>o+e*i,uy:e=>r+e*a,us:e=>e*Math.min(i,a)};let s=1,l=1;const c=t.boxField?P(n,t.boxField):void 0;Array.isArray(c)&&2===c.length&&(s=Number(c[0])>0?Number(c[0]):1,l=Number(c[1])>0?Number(c[1]):1);const u=Math.min(i/s,a/l),d=i-u*s,p=a-u*l,h="start"===t.anchorX?0:"end"===t.anchorX?d:d/2,y="start"===t.anchorY?0:"end"===t.anchorY?p:p/2;return{ux:e=>o+h+e*u,uy:e=>r+y+e*u,us:e=>e*u}}function J(e,t,o,r,i,a,s){var l,c,u,d,p;const h="y"===(null!==(c=null===(l=e.options)||void 0===l?void 0:l.dir)&&void 0!==c?c:"x")?"y":"x",y=Number(null===(u=e.options)||void 0===u?void 0:u.spacing)||0,f=function(e,t){var n,o;const r=null===(n=e.options)||void 0===n?void 0:n.by,i=null!==(o=e.children)&&void 0!==o?o:[];if(r){const e=i[0];return G(t,r).map(t=>({node:e,rows:t.rows,key:t.key}))}if(i.length>1)return i.map((e,n)=>({node:e,rows:t,key:n+""}));const a=i[0];return a&&!U(a)&&t.length>1?t.map((e,t)=>({node:a,rows:[e],key:t+""})):a?[{node:a,rows:t,key:"0"}]:[]}(e,o);if(0===f.length)return;const m=null===(d=e.options)||void 0===d?void 0:d.sort;"asc"!==m&&"desc"!==m||f.sort((e,t)=>{const n=Z(e.node,e.rows,h),o=Z(t.node,t.rows,h);return"asc"===m?n-o:o-n});const g="x"===h?t.x0:t.y0,x=("x"===h?t.x1:t.y1)-g;if(!s){const o="x"===h?"y":"x",s=D(e,f,o,a),l=null===(p=e.options)||void 0===p?void 0:p.sizeBy,c=l?f.map(e=>W({type:"field",name:l},e.rows)):[],u=l?n(c,0):0,d=(x-y*(f.length-1))/f.length;return f.forEach((e,n)=>{const s=g+n*(d+y);let p=ee(t,h,s,s+d);l&&u>0&&(p=function(e,t,n){if("y"===t){const t=(e.y1-e.y0)*n;return Object.assign(Object.assign({},e),{y0:e.y1-t})}const o=(e.x1-e.x0)*n;return Object.assign(Object.assign({},e),{x1:e.x0+o})}(p,o,Math.max(.02,c[n]/u))),K(e.node,p,e.rows,r,i,a,!1)}),void s()}const v=f.map(e=>Z(e.node,e.rows,h)),b=v.reduce((e,t)=>e+t,0)||1,k=x-y*(f.length-1),w=f[0]?F(f[0].node,h):null,M=w?a.sizeOverride.get(w):void 0,j=M&&M>0?k/M:k/b;let A=g;f.forEach((e,n)=>{const o=v[n]*j,s=ee(t,h,A,A+o);K(e.node,s,e.rows,r,i,a,!0),A+=o+y})}function ee(e,t,n,o){return"x"===t?{x0:n,y0:e.y0,x1:o,y1:e.y1}:{x0:e.x0,y0:n,x1:e.x1,y1:o}}function te(e,t,n){if(0===e.length)return()=>(t+n)/2;let[o,r]=function(e){let t=1/0,n=-1/0;for(const o of e)t>o&&(t=o),o>n&&(n=o);return[t,n]}(e);return o===r&&(o-=.5,r+=.5),e=>t+(e-o)/(r-o)*(n-t)}function ne(e,t,n,o,r){var i,a,s,l,c,u,d,p,h,y,f,m,g,x,v,b,k,w,M,j,A,$,S,_,O,R,B;const L=e.repeat;if(L){const i=P(n[0],L);if(Array.isArray(i)){const n=Object.assign(Object.assign({},e),{repeat:void 0});for(const e of i)ne(n,t,[e],o,r)}return}const{ux:I,uy:C,us:W}=r,N=null!==(i=n[0])&&void 0!==i?i:null,E=null!==(l=null!==(s=null===(a=e.origin)||void 0===a?void 0:a.name)&&void 0!==s?s:e.name)&&void 0!==l?l:Y(o,e.type),F=z(e.clip,N),D=Array.isArray(F)&&F.length?`M${F.map(e=>`${I(e[0])},${C(e[1])}`).join(" L")} Z`:void 0;if("polygon"===e.type){const t=z(e.points,N);if(!Array.isArray(t)||0===t.length)return;const n=`M${t.map(e=>`${I(e[0])},${C(e[1])}`).join(" L")} Z`;return void o.marks.push({kind:"path",id:Y(o,E),d:n,style:ie(e,N,o),clipPath:D})}if("image"===e.type){const t=z(e.href,N);if("string"!=typeof t||!t)return;const n=null!==(c=V(e.x,N))&&void 0!==c?c:0,r=null!==(u=V(e.y,N))&&void 0!==u?u:0,i=null!==(d=V(e.w,N))&&void 0!==d?d:1,a=null!==(p=V(e.h,N))&&void 0!==p?p:1;return void o.marks.push({kind:"image",id:Y(o,E),href:t,x:I(n),y:C(r),width:I(n+i)-I(n),height:C(r+a)-C(r),opacity:V(e.opacity,N),clipPath:D})}if("circle"===e.type){const t=null!==(y=null!==(h=V(e.cx,N))&&void 0!==h?h:V(e.x,N))&&void 0!==y?y:.5,n=null!==(m=null!==(f=V(e.cy,N))&&void 0!==f?f:V(e.y,N))&&void 0!==m?m:.5,r=null!==(g=V(e.r,N))&&void 0!==g?g:.02;return void o.marks.push({kind:"circle",id:Y(o,E),cx:I(t),cy:C(n),r:W(r),style:ie(e,N,o),datum:null!=N?N:void 0,interactive:e.interactive})}if("rect"===e.type){const t=V(e.rotate,N);if(null!=t){const n=I(null!==(x=V(e.x,N))&&void 0!==x?x:.5),r=C(null!==(v=V(e.y,N))&&void 0!==v?v:.5),i=W(null!==(b=V(e.w,N))&&void 0!==b?b:.05),a=function(e,t,n,o,r,i,a){const s=r*Math.PI/180,l=Math.cos(s),c=Math.sin(s),u=(e,t)=>{const n=e-i,o=t-a;return`${i+n*l-o*c},${a+n*c+o*l}`};return`M${u(e,t)} L${u(e+n,t)} L${u(e+n,t+o)} L${u(e,t+o)} Z`}(n-i/2,r-i/2,i,i,t,n,r);return void o.marks.push({kind:"path",id:Y(o,E),d:a,style:ie(e,N,o)})}const n=null!==(k=V(e.x,N))&&void 0!==k?k:0,r=null!==(w=V(e.y,N))&&void 0!==w?w:0,i=null!==(M=V(e.w,N))&&void 0!==M?M:1,a=null!==(j=V(e.h,N))&&void 0!==j?j:1;return void o.marks.push({kind:"rect",id:Y(o,E),x:I(n),y:C(r),width:I(n+i)-I(n),height:C(r+a)-C(r),style:ie(e,N,o),datum:null!=N?N:void 0,group:ae(e,N),interactive:e.interactive,clipPath:D})}if("line"!==e.type){if("text"===e.type){const t=z(e.text,N);return void o.marks.push({kind:"text",id:Y(o,E),x:I(null!==(O=V(e.x,N))&&void 0!==O?O:.5),y:C(null!==(R=V(e.y,N))&&void 0!==R?R:.95),text:null==t?"":t+"",fontSize:Number(e.fontSize)||11,textAnchor:null!==(B=e.textAnchor)&&void 0!==B?B:"middle",style:{fill:"var(--semiotic-text-secondary, #667)"}})}oe(e,I(.5),C(.95),N,o)}else o.marks.push({kind:"line",id:Y(o,E),x1:I(null!==(A=V(e.x1,N))&&void 0!==A?A:0),y1:C(null!==($=V(e.y1,N))&&void 0!==$?$:0),x2:I(null!==(S=V(e.x2,N))&&void 0!==S?S:1),y2:C(null!==(_=V(e.y2,N))&&void 0!==_?_:0),style:ie(e,N,o)})}function oe(e,t,n,o,r){var i,a;if("text"===e.type){const s=z(e.text,null!=o?o:void 0);return void r.marks.push({kind:"text",id:Y(r,null!==(a=null===(i=e.origin)||void 0===i?void 0:i.name)&&void 0!==a?a:"text"),x:t,y:n,text:null==s?"":s+"",fontSize:Number(e.fontSize)||11,textAnchor:"middle",style:{fill:"var(--semiotic-text-secondary, #667)"}})}r.warnings.push(`Unsupported leaf mark "${e.type}".`)}function re(e,t,n,o,r,i){var a;const s=e=>t+e*o,l=e=>n+e*r,c=e=>e*Math.min(o,r);if("polygon"===e.kind){const t=`M${e.points.map(e=>`${s(e[0])},${l(e[1])}`).join(" L")} Z`;i.marks.push({kind:"path",id:Y(i,"mf-poly"),d:t,style:{fill:e.fill,stroke:e.stroke,strokeWidth:e.strokeWidth,opacity:e.opacity}})}else"circle"===e.kind?i.marks.push({kind:"circle",id:Y(i,"mf-c"),cx:s(e.x),cy:l(e.y),r:c(e.r),style:{fill:e.fill,stroke:e.stroke,opacity:e.opacity},interactive:!1}):"rect"===e.kind?i.marks.push({kind:"rect",id:Y(i,"mf-r"),x:s(e.x),y:l(e.y),width:c(e.w),height:c(e.h),style:{fill:e.fill,stroke:e.stroke,opacity:e.opacity},interactive:!1}):"text"===e.kind&&i.marks.push({kind:"text",id:Y(i,"mf-t"),x:s(e.x),y:l(e.y),text:e.text,fontSize:null!==(a=e.fontSize)&&void 0!==a?a:11,textAnchor:"middle",style:{fill:e.fill}})}function ie(e,t,n,o){var r;const i=e.fill,a=e.stroke;let s;if(null!=i){const e=z(i,t);"string"==typeof e&&function(e){if(e.startsWith("#")||e.startsWith("var(")||e.startsWith("rgb")||e.startsWith("hsl"))return!0;const t=e.toLowerCase();return"none"===t||"transparent"===t||"currentcolor"===t}(e)?s=e:null!=e&&(s=n.resolveColor(e+"",t))}const l="string"==typeof z(a,t)?z(a,t):void 0;return{fill:null!=s?s:"rect"===e.type||"circle"===e.type||"area"===e.type||"petal"===e.type?n.resolveColor(null!==(r=ae(e,t))&&void 0!==r?r:"0",t):void 0,stroke:l,strokeWidth:"number"==typeof e.strokeWidth?e.strokeWidth:void 0,fillOpacity:"number"==typeof e.opacity?e.opacity:void 0}}function ae(e,t){const n=e.fill;if(n&&"object"==typeof n&&"field"===n.type){const e=P(t,n.name);if(null!=e)return e+""}}function se(e,t){if(0!==t.length)return 1===t.length?t[0]:h(Object.assign(Object.assign({},t[0]),{_groupSize:t.length}))}function le(e){if(2>e.length)return"";let t=`M${e[0][0]},${e[0][1]}`;for(let n=1;e.length>n;n++){const o=e[n-1],r=e[n];t+=` Q${(o[0]+r[0])/2},${o[1]} ${r[0]},${r[1]}`}return t}function ce(e){return 2>e.length?"":`M${e.map(e=>`${e[0]},${e[1]}`).join(" L")} Z`}function ue(e,t,n,o){var r,i,a,s,l;const c={marks:[],frames:new Map,relations:[],resolveColor:n,options:o,warnings:null!==(r=o.warnings)&&void 0!==r?r:[],ids:{n:0},domains:new Map,sizeOverride:new Map,polarSegments:[]},u={x0:t.x,y0:t.y,x1:t.x+t.width,y1:t.y+t.height},d="chart"===e.type?[e]:"layer"===e.type?e.charts:[];for(const e of d)if("inline"===(null===(i=e.data)||void 0===i?void 0:i.type))for(const t of e.data.rows)for(const[e,n]of Object.entries(t)){const t=Number(n);Number.isFinite(t)&&c.domains.set(e,Math.max(null!==(a=c.domains.get(e))&&void 0!==a?a:0,Math.abs(t)))}"raw-mark"===e.type&&K(e.mark,u,[],"none",null,c);for(const e of d){const t="inline"===(null===(s=e.data)||void 0===s?void 0:s.type)?e.data.rows:[];K(q(null!==(l=e.operators)&&void 0!==l?l:[],e.mark),u,t,"none",null,c),e.connect&&K(e.connect,u,t,"none",null,c)}return function(e){var t,n,o,r,i,a,s;const l=e.relations.find(e=>"connect"===e.kind);if(l&&e.polarSegments.length>=2){const r=new Map;for(const o of e.polarSegments){const e=null!==(t=o.group)&&void 0!==t?t:"",i=null!==(n=r.get(e))&&void 0!==n?n:[];i.push(o),r.set(e,i)}for(const[t,n]of r){if(2>n.length)continue;const r=[...n].sort((e,t)=>(e.theta0+e.theta1)/2-(t.theta0+t.theta1)/2),i=[],a=[];for(const e of r)i.push(m(e.cx,e.cy,e.outerR,e.theta0),m(e.cx,e.cy,e.outerR,e.theta1)),a.push(m(e.cx,e.cy,e.innerR,e.theta0),m(e.cx,e.cy,e.innerR,e.theta1));const s=[...i,...a.reverse()],c="bezier"===l.interpolation?g(s):ce(s),u=e.resolveColor(t);e.marks.push({kind:"path",id:Y(e,"ribbon"),d:c,style:{fill:u,fillOpacity:null!==(o=l.opacity)&&void 0!==o?o:.26,stroke:u,strokeWidth:1,opacity:.9}})}}for(const t of e.relations){const n=t.refs.map(t=>e.frames.get(t)).filter(e=>!!e).map(e=>[e.cx,e.cy]);if(2>n.length)continue;const o="bezier"===t.interpolation||"connect"===t.kind?le(n):"M"+n.map(e=>`${e[0]},${e[1]}`).join(" L");e.marks.push({kind:"path",id:Y(e,t.kind),d:o,style:{fill:null!==(r=t.fill)&&void 0!==r?r:"none",stroke:null!==(a=null!==(i=t.stroke)&&void 0!==i?i:t.fill)&&void 0!==a?a:"var(--semiotic-border,#888)",opacity:null!==(s=t.opacity)&&void 0!==s?s:.8,strokeWidth:t.fill&&"none"!==t.fill?0:1.5}})}}(c),c}function de(e,t={}){return n=>{var o;const i=ue(function(e,t){var n;const o=t;return"chart"===e.type?"inline"!==(null===(n=e.data)||void 0===n?void 0:n.type)?e:Object.assign(Object.assign({},e),{data:Object.assign(Object.assign({},e.data),{rows:o})}):"layer"===e.type?Object.assign(Object.assign({},e),{charts:e.charts.map(e=>{var t;return"inline"===(null===(t=e.data)||void 0===t?void 0:t.type)?Object.assign(Object.assign({},e),{data:Object.assign(Object.assign({},e.data),{rows:o})}):e})}):e}(e,n.data),n.dimensions.plot,n.resolveColor,Object.assign(Object.assign({},t),{warnings:null!==(o=t.warnings)&&void 0!==o?o:[]}));return r(()=>({marks:i.marks}))(n)}}function pe(e,t,n={}){return o=>{var i,a,s,l,c,u,d,p,h,f;const{plot:m}=o.dimensions,g=o.scales.o,x=g.bandwidth(),v=Math.max(1,m.height-26-8),b=null!==(i=o.config)&&void 0!==i?i:{},k=x*Math.max(.2,Math.min(1,null!==(s=null!==(a=b.glyphWidthRatio)&&void 0!==a?a:b.cupWidthRatio)&&void 0!==s?s:.9)),M=[],j=[],A=null!==(l=n.warnings)&&void 0!==l?l:[],$="chart"===e.type?e:"layer"===e.type?e.charts[0]:void 0;if(!$)return{nodes:[]};const S=function(e,t,n,o){let r=e;for(const e of t)if("derive"===e.type){const t=e.lambdaId,i=t?w(t,n.lambdas):void 0;i&&"derive"===i.kind?r=i.fn(r):t&&o.push(`derive lambda "${t}" is not registered; passing data through.`)}return r}("inline"===(null===(c=$.data)||void 0===c?void 0:c.type)?o.data:[],null!==(u=$.operators)&&void 0!==u?u:[],n,A),_=q((null!==(d=$.operators)&&void 0!==d?d:[]).filter(e=>!H.has(e.type)&&!T.has(e.type)),$.mark),O=(null!==(p=$.operators)&&void 0!==p?p:[]).find(e=>"spread"===e.type||"group"===e.type),R=G(S,(null!==(h=null==O?void 0:O.by)&&void 0!==h?h:t).replace(/^datum\./,""));for(const e of R){const t=g(e.key);if(null==t)continue;const r=ue({type:"chart",data:{type:"inline",rows:e.rows},mark:_},{x:t+(x-k)/2,y:m.y+8,width:k,height:v},o.resolveColor,Object.assign(Object.assign({},n),{warnings:A})),i=y(e.key);for(const e of r.marks)e.id=`${i}-${e.id}`;j.push(...r.marks),M.push({type:"rect",x:t,y:m.y+8,w:x,h:v,style:{fill:"rgba(0,0,0,0)",stroke:"none"},datum:null!==(f=e.rows[0])&&void 0!==f?f:null,group:e.key,_transitionKey:"cat-"+y(e.key)}),j.push({kind:"text",id:"lbl-"+y(e.key),x:t+x/2,y:m.y+m.height-8,text:e.key,fontSize:12,textAnchor:"middle",style:{fill:"var(--semiotic-text,#333)"}})}const B=r(()=>({marks:j}))({data:o.data,scales:{x:o.scales.r,y:o.scales.r},dimensions:o.dimensions,theme:o.theme,resolveColor:o.resolveColor,config:{}});return{nodes:[...M,...B.nodes],overlays:B.overlays}}}function he(e){return"chart"===e.type?[e]:"layer"===e.type?e.charts:[]}function ye(e){const t=[];return function(e){const n=e=>{if(e){if(t.push(e),e.children)for(const t of e.children)n(t);e.source&&n(e.source)}};if("raw-mark"!==e.type)for(const t of he(e))n(t.mark),n(t.connect);else n(e.mark)}(e),t}const fe=[{lake:"Erie",species:"Walleye",count:48,x:0},{lake:"Erie",species:"Perch",count:31,x:0},{lake:"Erie",species:"Trout",count:16,x:0},{lake:"Huron",species:"Walleye",count:26,x:1},{lake:"Huron",species:"Perch",count:18,x:1},{lake:"Huron",species:"Trout",count:35,x:1},{lake:"Michigan",species:"Walleye",count:18,x:2},{lake:"Michigan",species:"Perch",count:42,x:2},{lake:"Michigan",species:"Trout",count:27,x:2},{lake:"Ontario",species:"Walleye",count:22,x:3},{lake:"Ontario",species:"Perch",count:21,x:3},{lake:"Ontario",species:"Trout",count:43,x:3},{lake:"Superior",species:"Walleye",count:14,x:4},{lake:"Superior",species:"Perch",count:24,x:4},{lake:"Superior",species:"Trout",count:57,x:4}],me=e=>({type:"field",name:e}),ge={irVersion:0,ir:"gofish-frontend",root:{type:"chart",data:{type:"inline",rows:fe},operators:[{type:"scatter",by:"lake",x:me("x")}],mark:{type:"layer",__combinator:!0,children:[{type:"rect",origin:{name:"stem"},w:5,h:me("count"),fill:"#2f8f46"},{type:"layer",__combinator:!0,options:{coord:{type:"polar"}},children:[{type:"stack",__combinator:!0,options:{dir:"x",by:"species",spacing:0},children:[{type:"petal",h:me("count"),fill:me("species")}]}]}]}}},xe={irVersion:0,ir:"gofish-frontend",root:{type:"chart",data:{type:"inline",rows:[{id:"planning",category:"Planning",amount:64},{id:"design",category:"Design",amount:82},{id:"build",category:"Build",amount:46},{id:"review",category:"Review",amount:71},{id:"ship",category:"Ship",amount:55}]},options:{axes:!1},operators:[{type:"spread",by:"category",dir:"x",spacing:20},{type:"derive",lambdaId:"bottleGeometry"}],mark:{type:"layer",__combinator:!0,options:{coord:{type:"unit"}},children:[{type:"image",origin:{name:"bottle"},href:me("_b.imageHref"),x:0,y:0,w:1,h:1},{type:"rect",origin:{name:"fill"},x:me("_b.fill.x"),y:me("_b.fill.y"),w:me("_b.fill.w"),h:me("_b.fill.h"),fill:me("_b.fillFill"),opacity:.82,clip:me("_b.silhouette"),interactive:!1},{type:"line",origin:{name:"fillLine"},x1:me("_b.fillLine.x1"),x2:me("_b.fillLine.x2"),y1:me("_b.fillLine.y"),y2:me("_b.fillLine.y"),stroke:"#6b7e88",strokeWidth:1},{type:"text",origin:{name:"pct"},text:me("_b.pct.text"),x:me("_b.pct.x"),y:me("_b.pct.y"),textAnchor:"start",fontSize:11},{type:"text",origin:{name:"label"},text:me("_b.label.text"),x:me("_b.label.x"),y:me("_b.label.y"),textAnchor:"middle",fontSize:11},{type:"rect",origin:{name:"hit"},x:0,y:0,w:1,h:1,fill:"rgba(0,0,0,0)"}]}}},ve={irVersion:0,ir:"gofish-frontend",root:{type:"chart",data:{type:"inline",rows:fe},mark:{type:"layer",__combinator:!0,options:{coord:{type:"polar",innerRadius:.22}},children:[{type:"spread",__combinator:!0,options:{dir:"x",by:"lake"},children:[{type:"stack",__combinator:!0,options:{dir:"y",by:"species",sort:"asc"},children:[{type:"rect",w:.34,h:me("count"),fill:me("species")}]}]},{type:"connect",__combinator:!0,options:{by:"species",opacity:.28},children:[{type:"ref",selection:"species"}]}]}}},be={irVersion:0,ir:"gofish-frontend",root:{type:"chart",data:{type:"inline",rows:function(){const e=[],t=[{pclass:1,count:90,fareBase:24,fareSpread:126,survivalRate:.64},{pclass:2,count:60,fareBase:10,fareSpread:56,survivalRate:.46},{pclass:3,count:150,fareBase:4,fareSpread:26,survivalRate:.25}];for(const n of t)for(let t=0;n.count>t;t++){const o=.5*Math.sin(1.7*t+n.pclass)+.5;e.push({name:`class-${n.pclass}-${t}`,pclass:n.pclass,survived:n.survivalRate>(73*t+29*n.pclass)%100/100,fare:Math.round(10*(n.fareBase+Math.pow(1-t/n.count,2.15)*n.fareSpread+o*n.fareSpread*.08+37*t%23/23*n.fareSpread*.05))/10})}return e}()},mark:{type:"spread",__combinator:!0,options:{by:"pclass",dir:"x",sizeBy:"fare",spacing:18},children:[{type:"treemap",__combinator:!0,options:{valueField:"fare",paddingInner:1.5},children:[{type:"circle",fill:me("survived")}]}]}}},ke={irVersion:0,ir:"gofish-frontend",root:{type:"chart",data:{type:"inline",rows:[{kind:"memory-snapshot",stack:[{name:"c",value:{pointer:0}},{name:"d",value:{pointer:1}},{name:"x",value:"5"}],heap:[{values:["12",{pointer:1},"1","0",{pointer:2},{pointer:3}]},{values:["1","4"]},{values:["3","10","7","8",{pointer:4}]},{values:["2",{pointer:4}]},{values:["3"]}],heapArrangement:[[0,null,3,null],[null,1,2,4]]}]},mark:{type:"layer",__combinator:!0,children:[{type:"spread",__combinator:!0,options:{dir:"x",alignment:"start",spacing:100},children:[{type:"rect",origin:{name:"globalFrame"}},{type:"rect",origin:{name:"heap"}}]},{type:"arrow",__combinator:!0,options:{stroke:"#1A5683"},children:[{type:"ref",selection:"globalFrame"},{type:"ref",selection:"heap"}]}]}}},we={irVersion:0,ir:"gofish-frontend",root:{type:"chart",data:{type:"inline",rows:[{name:"Classic",teaVolume:470,bobaVolume:95,iceVolume:60,cupHeight:15.5,cupTopRadius:4.75,cupBottomRadius:3.75,bobaRadius:.6},{name:"Extra Boba",teaVolume:360,bobaVolume:240,iceVolume:45,cupHeight:15.5,cupTopRadius:4.75,cupBottomRadius:3.75,bobaRadius:.6},{name:"Light Ice",teaVolume:500,bobaVolume:95,iceVolume:12,cupHeight:15.5,cupTopRadius:4.75,cupBottomRadius:3.75,bobaRadius:.6},{name:"Mega",teaVolume:660,bobaVolume:150,iceVolume:120,cupHeight:18,cupTopRadius:5.6,cupBottomRadius:4.4,bobaRadius:.6}]},operators:[{type:"spread",by:"name",dir:"x",spacing:24},{type:"derive",lambdaId:"bobaGeometry"}],mark:{type:"layer",__combinator:!0,options:{coord:{type:"unit",fit:"uniform",boxField:"_g.box",anchorY:"end"}},children:[{type:"polygon",origin:{name:"tea"},points:me("_g.tea"),fill:me("teaFill")},{type:"circle",origin:{name:"pearl"},repeat:"_g.pearls",cx:me("x"),cy:me("y"),r:me("r"),fill:me("fill"),opacity:.85,interactive:!1},{type:"rect",origin:{name:"ice"},repeat:"_g.ice",x:me("x"),y:me("y"),w:me("w"),h:me("w"),rotate:me("rot"),fill:me("fill"),opacity:.85,interactive:!1},{type:"polygon",origin:{name:"cup"},points:me("_g.cup"),fill:"none",stroke:me("cupStroke"),strokeWidth:2.5},{type:"line",origin:{name:"lid"},x1:me("_g.lid.x1"),x2:me("_g.lid.x2"),y1:me("_g.lid.y"),y2:me("_g.lid.y"),stroke:me("lidFill"),strokeWidth:4},{type:"polygon",origin:{name:"straw"},points:me("_g.straw"),fill:me("strawFill"),stroke:me("cupStroke"),strokeWidth:1,opacity:.85}]}}},Me=[{key:"flower",label:"Flower chart",doc:ge,source:"https://gofish.graphics/js/examples/flower-chart.html"},{key:"bottle",label:"Bottle fill",doc:xe,source:"https://gofish.graphics/js/examples/bottle-fill-chart.html"},{key:"polar",label:"Polar ribbon",doc:ve,source:"https://gofish.graphics/js/examples/polar-ribbon-chart.html"},{key:"titanic",label:"Fare circle treemap",doc:be,source:"https://gofish.graphics/js/examples/titanic-fare-circle-treemap.html"},{key:"python",label:"Python memory",doc:ke,source:"https://gofish.graphics/js/examples/python-tutor-memory-diagram.html"},{key:"boba",label:"Boba cups",doc:we,source:"https://observablehq.com/@kristw/boba-science"}],je="0.1",Ae=new Set(["fresh","aging","stale","expired"]),$e=new Set(["proposed","accepted","disputed","retracted"]),Se=new Set(["fixed","latest","sticky","semantic"]),_e=new Set(["visual","screen-reader","sonified","agent"]);function Oe(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function Re(e,t,n){("number"!=typeof n||!Number.isFinite(n)||1>n||n>5)&&e.push(t+" must be a number in [1, 5]")}"function"==typeof SuppressedError&&SuppressedError;const Be={linear:"linear",monotoneX:"monotone-x",monotoneY:"monotone-y",step:"step",stepAfter:"step-after",stepBefore:"step-before",basis:"basis",cardinal:"cardinal",catmullRom:"catmull-rom"};function Le(e){return{field:e,type:"quantitative"}}function Ie(e){return{field:e,type:"nominal"}}function Ce(e){return"time"===e.xScaleType?"temporal":"quantitative"}function Pe(e,t){return"string"==typeof t&&(e.axis={title:t}),e}function ze(e){const t=e.usermeta;return null==t?void 0:t.idid}function Ve(e){const{mark:t,encoding:n,data:o,transform:r}=e,i={};return t&&(i.mark=t),n&&(i.encoding=n),o&&(i.data=o),r&&(i.transform=r),i}function We(e){const t=e;switch(t.type){case"y-threshold":return{mark:"rule",encoding:{y:{datum:t.value}}};case"x-threshold":return{mark:"rule",encoding:{x:{datum:t.value}}};case"callout":case"label":case"text":return"string"==typeof t.label?{mark:{type:"text",text:t.label}}:null;default:return null}}const Ne={category10:"category10",tableau10:"category10",observable10:"category10",accent:"accent",dark2:"dark2",paired:"paired",pastel1:"pastel1",pastel2:"pastel2",set1:"set1",set2:"set2",set3:"set3"},Ee={linear:"linear","monotone-x":"monotoneX","monotone-y":"monotoneY",step:"step","step-after":"stepAfter","step-before":"stepBefore",basis:"basis",cardinal:"cardinal","catmull-rom":"catmullRom",natural:"natural"},Fe=new Set(["frame","gridx","gridy","gridfx","gridfy","axisx","axisy","axisfx","axisfy","rulex","ruley","tip","crosshair","pointer","hexgrid","text"]);function De(e){return"string"==typeof e?e:void 0}function Te(e,t){if(!Array.isArray(e)||!t)return!1;for(const n of e){const e=null==n?void 0:n[t];if(null!=e)return!("number"==typeof e||e instanceof Date)&&"string"==typeof e&&Number.isNaN(Date.parse(e))}return!1}function He(e,t,n){(function(e){return"function"==typeof e})(t)&&e.push(`The "${n}" channel is a function accessor, which can't be serialized to a config. Pass a field name (string) instead, or pre-derive the field on your data.`)}const qe=new Set(["LineChart","AreaChart","StackedAreaChart","Scatterplot","BubbleChart"]);function Ge(e){return"time"===e||"utc"===e?"time":"log"===e?"log":void 0}function Ze(e,t){e.curve&&Ee[e.curve]&&(t.curve=Ee[e.curve])}function Ue(e,t,n={}){Array.isArray(t)&&(e.data=t),n.colorBy&&(e.colorBy=n.colorBy),n.colorScheme&&(e.colorScheme=n.colorScheme)}function Ye(e,t,n){const o={component:e,props:t,version:"1",createdAt:(new Date).toISOString()};if(n.length>0){o.warnings=n;for(const e of n)console.warn("[semiotic/fromObservablePlot] "+e)}return o}const Xe=new Set(["sequencediagram","classdiagram","statediagram","statediagram-v2","erdiagram","gantt","pie","journey","gitgraph","mindmap","timeline","quadrantchart","requirementdiagram","c4context","sankey-beta","block-beta","xychart-beta"]),Ke=new Set(["TD","TB","BT","LR","RL"]),Qe=/(<-->|-\.->|-\.-|-->|--x|--o|---|==>|===)/,Je=[["((","))","circle"],["([","])","stadium"],["[[","]]","subroutine"],["[(",")]","cylinder"],["{{","}}","hexagon"],["[","]","rect"],["(",")","round"],["{","}","diamond"],[">","]","flag"]];function et(e){const t=e.trim();return t.length>=2&&('"'===t[0]&&t.endsWith('"')||"'"===t[0]&&t.endsWith("'"))?t.slice(1,-1):t}function tt(e){const t=e.trim();if(!t)return null;const n=t.match(/^([A-Za-z0-9_][\w-]*)/);if(!n)return null;const o=n[1],r=t.slice(o.length).trim();if(!r)return{id:o};for(const[e,t,n]of Je)if(r.startsWith(e)&&r.endsWith(t)&&r.length>=e.length+t.length)return{id:o,label:et(r.slice(e.length,r.length-t.length)),shape:n};return{id:o}}exports.EXPERIMENTAL_GOFISH_ADAPTER_NAME="unstable-gofish-ir-adapter",exports.IDID_SPEC_VERSION=je,exports.unstable_BUILTIN_INTENT_IDS=["trend","compare-series","compare-categories","rank","part-to-whole","distribution","correlation","flow","hierarchy","geo","outlier-detection","composition-over-time","change-detection"],exports.unstable_attachIDID=function(e,t){const n={specVersion:je};return t.capability&&(n.capability=t.capability),t.audience&&(n.audience=t.audience),Object.assign(Object.assign({},e),{usermeta:Object.assign(Object.assign({},e.usermeta),{idid:n})})},exports.unstable_attachIDIDAnnotations=function(e,t){const n=ze(e),o=Object.assign(Object.assign({specVersion:je},n),{annotations:[...t]}),r=t.map(We).filter(e=>null!==e).map(e=>Object.assign(Object.assign({},e),{usermeta:{idid:{role:"annotation-layer"}}}));if(0===r.length)return Object.assign(Object.assign({},e),{usermeta:Object.assign(Object.assign({},e.usermeta),{idid:o})});const i=Array.isArray(e.layer)?e.layer:[Ve(e)],a=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);o.length>r;r++)0>t.indexOf(o[r])&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n}(e,["mark","encoding","data","transform","usermeta"]);return Object.assign(Object.assign({},a),{usermeta:Object.assign(Object.assign({},e.usermeta),{idid:o}),layer:[...i,...r]})},exports.unstable_fromGofishIR=function(e,t={}){var n;const o=[];e&&"gofish-frontend"===e.ir||o.push(`Expected a "gofish-frontend" IR document but got ir="${null==e?void 0:e.ir}". Attempting best-effort translation.`),0!==(null==e?void 0:e.irVersion)&&o.push(`This adapter targets GoFish Frontend IR v0; document declares irVersion=${null==e?void 0:e.irVersion}. Newer fields are ignored.`);const r=e.root,a=ye(r),s=function(e){return he(e).flatMap(e=>{var t;return null!==(t=e.operators)&&void 0!==t?t:[]})}(r),l=function(e){var t;for(const n of he(e))if("inline"===(null===(t=n.data)||void 0===t?void 0:t.type))return n.data.rows;return[]}(r),c=function(e){const t=new Set;for(const n of e.slice(0,8))for(const e of Object.keys(n))t.add(e);return t}(l),u=new Set(a.map(e=>e.type)),d=null!==(n=t.family)&&void 0!==n?n:function(e,t,n){return e.has("arrow")?"network":n.some(e=>{var t;return"derive"===e.type&&((null!==(t=e.lambdaId)&&void 0!==t?t:"")+"").toLowerCase().includes("boba")})||t.has("teaVolume")&&t.has("bobaVolume")?"ordinal":"xy"}(u,c,s),p=t.lambdas;if("network"===d)return function(e,t,n){const o=function(e){var t;for(const n of he(e))if("inline"===(null===(t=n.data)||void 0===t?void 0:t.type))for(const e of n.data.rows){const t=e;if(e&&Array.isArray(t.stack)&&Array.isArray(t.heap))return t}}(e);o||n.push("Memory-diagram IR carried no inline {stack, heap, heapArrangement} row; rendering an empty graph.");const r=o?function(e){const t=[],n=[];return e.stack.forEach((e,o)=>{t.push({id:"binding-"+e.name,kind:"binding",index:o,name:e.name,value:v(e.value),pointer:x(e.value)?e.value.pointer:void 0}),x(e.value)&&n.push({source:"binding-"+e.name,target:`cell-${e.value.pointer}-0`,value:1,kind:"stack pointer",pointer:e.value.pointer})}),e.heap.forEach((e,o)=>{e.values.forEach((e,r)=>{t.push({id:`cell-${o}-${r}`,kind:"heap cell",address:o,cellIndex:r,value:v(e),pointer:x(e)?e.pointer:void 0}),x(e)&&n.push({source:`cell-${o}-${r}`,target:`cell-${e.pointer}-0`,value:1,kind:"heap pointer",pointer:e.pointer})})}),{nodes:t,edges:n}}(o):{nodes:[],edges:[]};return{family:"network",recipe:"gofishPythonTutorNetworkLayout",layout:null,networkLayout:i,ordinalLayout:null,layoutConfig:o?{diagram:o}:{},data:[],graph:r,irVersion:t,warnings:n.length?n:void 0}}(r,e.irVersion,o);if("ordinal"===d){const t=function(e){return e.find(e=>"spread"===e.type)}(s),n=(null==t?void 0:t.by)&&((h=t.by).startsWith("datum.")?h.slice(6):h)||"name";return{family:"ordinal",recipe:"gofishInterpreter",layout:null,networkLayout:null,ordinalLayout:pe(r,n,{lambdas:p,warnings:o}),layoutConfig:{},categoryAccessor:n,valueAccessor:c.has("teaVolume")?"teaVolume":void 0,data:l,graph:null,irVersion:e.irVersion,warnings:o.length?o:void 0}}var h;return{family:"xy",recipe:"gofishInterpreter",layout:de(r,{lambdas:p,warnings:o}),networkLayout:null,ordinalLayout:null,layoutConfig:{},data:l,graph:null,irVersion:e.irVersion,warnings:o.length?o:void 0}},exports.unstable_fromMermaid=function(e){var t;const n=[],o=()=>Object.assign({kind:"flowchart",direction:"TD",nodes:[],edges:[]},n.length?{warnings:n}:{});if("string"!=typeof e||!e.trim())return n.push("Empty Mermaid input."),o();const r=e.split("\n").map(e=>e.replace(/%%.*$/,"").trim()).filter(e=>e.length>0);if(0===r.length)return n.push("No content after stripping comments."),o();const i=r[0],a=i.split(/\s+/)[0].toLowerCase();if("graph"!==a&&"flowchart"!==a&&(Xe.has(a)?n.push(`Mermaid "${i.split(/\s+/)[0]}" diagrams aren't supported — only graph/flowchart compile to a Semiotic graph. Other diagram types are declined rather than mistranslated.`):n.push(`Expected a "graph" or "flowchart" header; got "${i}". Treating remaining lines as flowchart edges.`),Xe.has(a)))return o();let s="TD";const l=null===(t=i.split(/\s+/)[1])||void 0===t?void 0:t.toUpperCase();l&&Ke.has(l)&&(s=l);const c="graph"===a||"flowchart"===a?1:0,u=new Map,d=[];let p=0;const h=e=>{var t,n;const o=u.get(e.id);o?e.label&&o.label===o.id&&(o.label=e.label,e.shape&&(o.shape=e.shape)):u.set(e.id,{id:e.id,label:null!==(t=e.label)&&void 0!==t?t:e.id,shape:null!==(n=e.shape)&&void 0!==n?n:"rect",layer:0,row:p++})},y=e=>e.replace(/--\s+([^->|]+?)\s+-->/g,"--\x3e|$1|").replace(/-\.\s+([^->|]+?)\s+\.->/g,"-.->|$1|").replace(/==\s+([^=>|]+?)\s+==>/g,"==>|$1|");for(let e=c;r.length>e;e++){const t=y(r[e]);if(/^(subgraph|end|classDef|class|style|click|linkStyle|direction)\b/.test(t)){/^subgraph\b/.test(t)&&n.push("`subgraph` grouping is flattened; nodes are kept, the grouping is dropped.");continue}if(!Qe.test(t)){const e=tt(t);e&&h(e);continue}const o=t.split(Qe);let i=null;for(let e=0;o.length>e;e+=2){let t,r=o[e].trim();const a=r.match(/^\|([^|]*)\|\s*(.*)$/);a&&(t=et(a[1]),r=a[2].trim()),r.includes("&")&&(n.push('Multiple nodes joined with "&" — only the first is linked in this alpha.'),r=r.split("&")[0].trim());const s=tt(r);s?(h(s),i&&d.push(Object.assign({source:i.id,target:s.id},t?{label:t}:{})),i=s):i=null}}return 0===u.size?(n.push("No nodes found."),o()):(function(e,t,n){const o=new Map,r=new Map;for(const t of e.keys())o.set(t,[]),r.set(t,0);for(const n of t)n.source!==n.target&&e.has(n.source)&&e.has(n.target)&&(o.get(n.source).push(n.target),r.set(n.target,(r.get(n.target)||0)+1));const i=[];for(const[e,t]of r)0===t&&i.push(e);let a=0;for(;i.length>0;){const t=i.shift();a++;const n=e.get(t).layer;for(const a of o.get(t)){const t=e.get(a);n+1>t.layer&&(t.layer=n+1);const o=(r.get(a)||0)-1;r.set(a,o),0===o&&i.push(a)}}e.size>a&&n.push("Graph contains a cycle; layering is best-effort (not a strict DAG).");const s=new Map;for(const t of e.values()){const e=s.get(t.layer)||[];e.push(t),s.set(t.layer,e)}for(const e of s.values())e.sort((e,t)=>e.row-t.row),e.forEach((e,t)=>{e.row=t})}(u,d,n),Object.assign({kind:"flowchart",direction:s,nodes:[...u.values()],edges:d},n.length?{warnings:n}:{}))},exports.unstable_fromObservablePlot=function(e){var t,n,o,r,i;const a=[];(e.facet||e.fx||e.fy)&&a.push('Faceted plots ("facet"/"fx"/"fy") are not supported. Use Semiotic\'s LinkedCharts or render multiple charts.');const s=(Array.isArray(e.marks)?e.marks:[]).filter(e=>e&&!Fe.has(e.type.toLowerCase()));if(0===s.length)return a.push("No translatable data mark found in the Plot spec. Defaulting to an empty Scatterplot."),Ye("Scatterplot",{},a);s.length>1&&a.push(`Multiple data marks (${s.map(e=>e.type).join(", ")}); only the first is translated. Layered multi-mark plots aren't supported.`);const l=s[0],c=l.options||{},u=l.data||e.data,d={};"number"==typeof e.width&&(d.width=e.width),"number"==typeof e.height&&(d.height=e.height),"string"==typeof e.title&&(d.title=e.title),(null===(t=e.x)||void 0===t?void 0:t.label)&&(d.xLabel=e.x.label),(null===(n=e.y)||void 0===n?void 0:n.label)&&(d.yLabel=e.y.label);const p=(null===(o=e.color)||void 0===o?void 0:o.scheme)?Ne[e.color.scheme]:void 0;He(a,c.x,"x"),He(a,c.y,"y"),He(a,c.fill,"fill"),He(a,c.stroke,"stroke"),He(a,c.r,"r");const h=De(c.x),y=De(c.y),f=De(c.fill),m=De(c.stroke),g=f||m,x=l.type.toLowerCase();let v;switch(x){case"line":case"liney":case"linex":{v="LineChart",h&&(d.xAccessor=h),y?d.yAccessor=y:a.push(l.type+" has no explicit y field; provide options.y."),Te(u,h)&&a.push(`The x field "${h}" looks categorical; LineChart uses a continuous x scale, so a categorical x won't position (the line won't draw). Use a numeric/time x, or a bar chart for categories.`),"liney"!==x||h||a.push("lineY without an explicit x plots against the row index, which Semiotic doesn't infer. Provide options.x.");const e=m||f;e&&(d.lineBy=e),Ze(c,d),Ue(d,u,{colorScheme:p});break}case"bary":case"bar":v=g?"StackedBarChart":"BarChart",h&&(d.categoryAccessor=h),y&&(d.valueAccessor=y),g&&(d.stackBy=g),Ue(d,u,{colorScheme:p});break;case"barx":v=g?"StackedBarChart":"BarChart",d.orientation="horizontal",y&&(d.categoryAccessor=y),h&&(d.valueAccessor=h),g&&(d.stackBy=g),Ue(d,u,{colorScheme:p});break;case"dot":case"doty":case"dotx":case"circle":{const e=c.r;"string"==typeof e?(v="BubbleChart",d.sizeBy=e):(v="Scatterplot","number"==typeof e&&(d.pointRadius=e)),h&&(d.xAccessor=h),y&&(d.yAccessor=y),Ue(d,u,{colorBy:g,colorScheme:p});break}case"area":case"areay":case"areax":v=f&&f!==y?"StackedAreaChart":"AreaChart",h&&(d.xAccessor=h),y&&(d.yAccessor=y),Te(u,h)&&a.push(`The x field "${h}" looks categorical; ${v} uses a continuous x scale, so a categorical x won't position. Use a numeric/time x.`),"StackedAreaChart"===v&&f&&(d.areaBy=f),Ze(c,d),Ue(d,u,{colorBy:"StackedAreaChart"===v?void 0:g,colorScheme:p});break;case"recty":case"rectx":case"rect":{v="Histogram";const e="rectx"===x?h:y||h;e&&(d.valueAccessor=e),g&&(d.categoryAccessor=g),Ue(d,u,{colorScheme:p});break}case"cell":case"celly":case"cellx":v="Heatmap",h&&(d.xAccessor=h),y&&(d.yAccessor=y),g&&(d.valueAccessor=g),Ue(d,u);break;case"tick":case"tickx":case"ticky":v="DotPlot","tickx"===x?(y&&(d.categoryAccessor=y),h&&(d.valueAccessor=h),d.orientation="horizontal"):(h&&(d.categoryAccessor=h),y&&(d.valueAccessor=y)),Ue(d,u,{colorBy:g,colorScheme:p});break;default:a.push(`Plot mark "${l.type}" has no faithful Semiotic equivalent in this adapter. Defaulting to a Scatterplot of x/y; verify the result or file for support.`),v="Scatterplot",h&&(d.xAccessor=h),y&&(d.yAccessor=y),Ue(d,u,{colorBy:g,colorScheme:p})}if(qe.has(v)){const t=Ge(null===(r=e.x)||void 0===r?void 0:r.type),n=Ge(null===(i=e.y)||void 0===i?void 0:i.type);t&&(d.xScaleType=t),n&&(d.yScaleType=n)}return Ye(v,d,a)},exports.unstable_gofishBobaIR=we,exports.unstable_gofishBottleIR=xe,exports.unstable_gofishFlowerIR=ge,exports.unstable_gofishIRExamples=Me,exports.unstable_gofishPolarRibbonIR=ve,exports.unstable_gofishPythonMemoryIR=ke,exports.unstable_gofishTitanicCircleTreemapIR=be,exports.unstable_readIDID=ze,exports.unstable_readIDIDAnnotations=function(e){var t;const n=null===(t=ze(e))||void 0===t?void 0:t.annotations;return Array.isArray(n)?n:[]},exports.unstable_registerGofishLambda=k,exports.unstable_toVegaLite=function(e){var t;const n=[],o=e.props||{},r={};let i;const a=e.component;switch(a){case"BarChart":case"StackedBarChart":case"GroupedBarChart":{i="bar";const e="horizontal"===o.orientation,t=Pe(Ie(o.categoryAccessor),o.categoryLabel),s=Pe(Le(o.valueAccessor),o.valueLabel);e?(r.y=t,r.x=s):(r.x=t,r.y=s),"StackedBarChart"===a&&o.stackBy?r.color=Ie(o.stackBy):"GroupedBarChart"===a&&o.groupBy&&(r.color=Ie(o.groupBy),n.push('GroupedBarChart maps groupBy to color; Vega-Lite expresses grouping via "xOffset". Adjust if exact grouped layout is required.'));break}case"LineChart":i=o.curve||o.showPoints?{type:"line"}:"line","object"==typeof i&&(o.curve&&Be[o.curve]&&(i.interpolate=Be[o.curve]),o.showPoints&&(i.point=!0)),r.x=Pe({field:o.xAccessor,type:Ce(o)},o.xLabel),r.y=Pe(Le(o.yAccessor),o.yLabel),o.lineBy?r.color=Ie(o.lineBy):o.colorBy&&(r.color=Ie(o.colorBy));break;case"AreaChart":case"StackedAreaChart":i=o.curve?{type:"area"}:"area","object"==typeof i&&o.curve&&Be[o.curve]&&(i.interpolate=Be[o.curve]),"object"==typeof i&&void 0!==o.areaOpacity&&(i.opacity=o.areaOpacity),r.x=Pe({field:o.xAccessor,type:Ce(o)},o.xLabel),r.y=Pe(Le(o.yAccessor),o.yLabel),"StackedAreaChart"===a&&o.areaBy&&(r.color=Ie(o.areaBy));break;case"Scatterplot":case"BubbleChart":i="point",r.x=Pe(Le(o.xAccessor),o.xLabel),r.y=Pe(Le(o.yAccessor),o.yLabel),o.colorBy&&(r.color=Ie(o.colorBy)),"BubbleChart"===a&&o.sizeBy&&(r.size=Le(o.sizeBy),Array.isArray(o.sizeRange)&&(r.size.scale={range:o.sizeRange}));break;case"Heatmap":i="rect",r.x=Pe(Ie(o.xAccessor),o.xLabel),r.y=Pe(Ie(o.yAccessor),o.yLabel),o.valueAccessor&&(r.color=Le(o.valueAccessor));break;case"PieChart":case"DonutChart":i="DonutChart"===a?{type:"arc",innerRadius:null!==(t=o.innerRadius)&&void 0!==t?t:60}:"arc",o.valueAccessor&&(r.theta=Le(o.valueAccessor)),o.categoryAccessor&&(r.color=Ie(o.categoryAccessor));break;case"DotPlot":{i="tick";const e="horizontal"===o.orientation,t=Pe(Ie(o.categoryAccessor),o.categoryLabel),n=Pe(Le(o.valueAccessor),o.valueLabel);e?(r.y=t,r.x=n):(r.x=t,r.y=n);break}case"Histogram":i="bar",o.valueAccessor&&(r.x=Pe(Le(o.valueAccessor),o.valueLabel),r.x.bin=!o.bins||{maxbins:o.bins},r.y={aggregate:"count",type:"quantitative"}),o.categoryAccessor&&(r.color=Ie(o.categoryAccessor));break;default:n.push(`Component "${a}" has no Vega-Lite single-view equivalent. Emitting a point mark as a placeholder; the data and any IDID metadata are preserved.`),i="point",o.xAccessor&&(r.x=Le(o.xAccessor)),o.yAccessor&&(r.y=Le(o.yAccessor))}o.colorScheme&&r.color&&(r.color.scale=Object.assign(Object.assign({},r.color.scale||{}),{scheme:o.colorScheme}));const s={mark:i};return Array.isArray(o.data)&&(s.data={values:o.data}),Object.keys(r).length>0&&(s.encoding=r),"string"==typeof o.title&&(s.title=o.title),"number"==typeof o.width&&(s.width=o.width),"number"==typeof o.height&&(s.height=o.height),n.length>0&&(s.warnings=n),s},exports.unstable_unregisterGofishLambda=function(e){b.delete(e)},exports.unstable_validatePortableAnnotation=function(e){const t=[];if(!Oe(e))return{valid:!1,errors:["annotation must be an object"]};const n=e.provenance;void 0!==n&&(Oe(n)?(void 0!==n.confidence&&("number"!=typeof n.confidence||0>n.confidence||n.confidence>1)&&t.push("provenance.confidence must be a number in [0, 1]"),void 0===n.createdAt||"string"==typeof n.createdAt&&!Number.isNaN(Date.parse(n.createdAt))||t.push("provenance.createdAt must be an ISO 8601 date-time string")):t.push("provenance must be an object"));const o=e.lifecycle;return void 0!==o&&(Oe(o)?(void 0===o.freshness||Ae.has(o.freshness)||t.push("lifecycle.freshness must be one of "+[...Ae].join(", ")),void 0===o.status||$e.has(o.status)||t.push("lifecycle.status must be one of "+[...$e].join(", ")),void 0===o.anchor||Se.has(o.anchor)||t.push("lifecycle.anchor must be one of "+[...Se].join(", ")),void 0!==o.ttlHint&&"string"!=typeof o.ttlHint&&"number"!=typeof o.ttlHint&&t.push("lifecycle.ttlHint must be an ISO 8601 duration string or a number of milliseconds")):t.push("lifecycle must be an object")),{valid:0===t.length,errors:t}},exports.unstable_validatePortableAudienceProfile=function(e){const t=[];if(!Oe(e))return{valid:!1,errors:["audience profile must be an object"]};if(void 0!==e.familiarity)if(Oe(e.familiarity))for(const[n,o]of Object.entries(e.familiarity))("number"!=typeof o||1>o||o>5)&&t.push(`familiarity.${n} must be a number in [1, 5]`);else t.push("familiarity must be an object");if(void 0!==e.targets)if(Oe(e.targets))for(const[n,o]of Object.entries(e.targets))!Oe(o)||"increase"!==o.direction&&"decrease"!==o.direction?t.push(`targets.${n}.direction must be "increase" or "decrease"`):void 0!==o.weight&&("number"!=typeof o.weight||1>o.weight||o.weight>3)&&t.push(`targets.${n}.weight must be a number in [1, 3]`);else t.push("targets must be an object");return void 0===e.exposureLevel||[0,1,2].includes(e.exposureLevel)||t.push("exposureLevel must be 0, 1, or 2"),void 0===e.receptionModality||_e.has(e.receptionModality)||t.push("receptionModality must be one of "+[..._e].join(", ")),{valid:0===t.length,errors:t}},exports.unstable_validatePortableCapability=function(e){const t=[];if(!Oe(e))return{valid:!1,errors:["capability must be an object"]};"string"==typeof e.component&&0!==e.component.length||t.push("component is required and must be a non-empty string");const n=e.rubric;if(Oe(n)?(Re(t,"rubric.familiarity",n.familiarity),Re(t,"rubric.accuracy",n.accuracy),Re(t,"rubric.precision",n.precision)):t.push("rubric is required and must be an object"),void 0!==e.intentScores)if(Oe(e.intentScores))for(const[n,o]of Object.entries(e.intentScores))("number"!=typeof o||0>o||o>5)&&t.push(`intentScores.${n} must be a number in [0, 5]`);else t.push("intentScores must be an object");return void 0!==e.variants&&(Array.isArray(e.variants)?e.variants.forEach((e,n)=>{Oe(e)?("string"!=typeof e.key&&t.push(`variants[${n}].key is required`),"string"!=typeof e.label&&t.push(`variants[${n}].label is required`)):t.push(`variants[${n}] must be an object`)}):t.push("variants must be an array")),{valid:0===t.length,errors:t}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{treemap as o,treemapSquarify as r,hierarchy as i}from"d3-hierarchy";function a(e,t=-1/0){let n=t;for(const t of e)t>n&&(n=t);return n}function s(e,n="semiotic-gofish-glyph-layer"){return t("g",{className:n,style:{pointerEvents:"none"},children:e})}function l(t){return o=>{var r,i,a,l,c,u,d,p,h;const y=t(o),m=[],g=[];for(const e of y.marks){if("rect"===e.kind&&!1!==e.interactive){const t={type:"rect",x:e.x,y:e.y,w:e.width,h:e.height,cornerRadii:e.rx?{tl:e.rx,tr:e.rx,br:e.rx,bl:e.rx}:void 0,style:null!==(r=e.style)&&void 0!==r?r:{fill:null!==(i=o.theme.semantic.primary)&&void 0!==i?i:"#4e79a7",stroke:"none"},datum:null!==(a=e.datum)&&void 0!==a?a:null,group:e.group,_transitionKey:e.id};m.push(t)}else if("circle"===e.kind&&!1!==e.interactive){const t={type:"point",x:e.cx,y:e.cy,r:e.r,style:null!==(l=e.style)&&void 0!==l?l:{fill:null!==(c=o.theme.semantic.primary)&&void 0!==c?c:"#4e79a7",stroke:"none"},datum:null!==(u=e.datum)&&void 0!==u?u:null,pointId:e.id,_transitionKey:e.id};m.push(t)}else if("area"===e.kind){const t={type:"area",topPath:e.topPath,bottomPath:e.bottomPath,style:null!==(d=e.style)&&void 0!==d?d:{fill:null!==(p=o.theme.semantic.primary)&&void 0!==p?p:"#4e79a7",stroke:"none"},datum:null!==(h=e.datum)&&void 0!==h?h:null,group:e.group,_transitionKey:e.id};m.push(t)}"area"!==e.kind&&g.push(f(e))}return{nodes:m,overlays:g.some(Boolean)||null!=y.overlays?s(e(n,{children:[g,y.overlays]})):null}}}const c=o=>{var r,i,a,s,l,c,y,f,g,v,x;const k=o.config.diagram;if(!k)return{sceneNodes:[],sceneEdges:[],labels:[]};const M=o.dimensions.plot,A=Math.max(.68,Math.min(1,M.width/1120)),$=null!==(r=o.config.cellWidth)&&void 0!==r?r:Math.round(58*A),j=null!==(i=o.config.cellHeight)&&void 0!==i?i:Math.round(52*A),S=null!==(a=o.config.heapGap)&&void 0!==a?a:18,O=Math.round(198*A),_=Math.round(42*A),R=Math.round(42*A),B=_+k.stack.length*R+Math.round(18*A),L=M.x+16,C=M.y+28,I=[],z=[],P=new Map,V=new Map,W=function(e,t,n,o,r,i,a){const s=new Map,l=t=>{var n,o;return Math.max(r,(null!==(o=null===(n=e.heap[t])||void 0===n?void 0:n.values.length)&&void 0!==o?o:1)*r)},c=n+o+Math.max(54,.07*t.width),u=Math.max(0,a),d=t.y+Math.max(42,.18*t.height),p=Math.min(t.y+t.height-i-20,d+Math.max(96,2.8*i)+1.15*u);if(e.heapArrangement.forEach((e,t)=>{e.forEach((e,n)=>{null!=e&&s.set(e,{x:c+n*(2.55*r+a),y:0===t?d:p})})}),e.heap.length>=5){const e=t.x+t.width-16,i=e-l(4),a=Math.max(24,.55*r+.75*u),h=Math.max(54,1.15*r+1.35*u),y=Math.max(120,2.55*r+2.1*u),f=Math.min(i-l(2)-h,c+l(0)+a),m=Math.min(e-l(3)-y,c+l(0)+h),g=Math.min(Math.max(c+3.1*r+u,n+o+Math.max(150,.19*t.width)+u),f-l(1)-a);s.set(0,{x:c,y:d}),s.set(1,{x:g,y:p}),s.set(2,{x:f,y:p}),s.set(3,{x:m,y:d}),s.set(4,{x:i,y:p})}return s}(k,M,L,O,$,j,S),N="#1A5683",F="#222",D="#777";I.push({type:"rect",id:"python-global-frame",x:L,y:C,w:O,h:B,style:{fill:"#dce7f4",stroke:"none"},datum:b({kind:"global frame"}),label:"Global frame"}),z.push(e("g",{children:[t("text",{x:L+12*A,y:C+25*A,fontSize:24*A,fontFamily:"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",fill:F,children:"Global Frame"}),t("line",{x1:L,y1:C,x2:L,y2:C+B,stroke:"#9caebf",strokeWidth:4*A})]},"python-global-overlay"));for(const r of o.nodes){const o=u(r),i=(null!==(s=o.id)&&void 0!==s?s:r.id)+"";if("binding"===o.kind){const r=C+_+m(o.index)*R,a=(null!==(l=o.value)&&void 0!==l?l:"")+"",s=m(o.pointer),u=Number.isFinite(s)&&a.startsWith("->"),d=r+R/2+6*A,p=L+O-40*A,h=L+O-34*A,f=r+R/2;I.push({type:"rect",id:i,x:L,y:r,w:O,h:R,style:{fill:"rgba(0,0,0,0)",stroke:"none"},datum:o,label:(null!==(c=o.name)&&void 0!==c?c:i)+""}),z.push(e("g",{children:[t("text",{x:L+124*A,y:d,fontSize:25*A,fill:F,children:(null!==(y=o.name)&&void 0!==y?y:i)+""}),e(n,u?{children:[t("path",{d:`M${p-12*A},${f-18*A} L${p-12*A},${f+18*A} L${p+28*A},${f+18*A}`,fill:"none",stroke:"#8d9aa0",strokeWidth:1.2}),t("circle",{cx:h,cy:f,r:3.6*A,fill:N})]}:{children:[t("text",{x:p,y:d,fontSize:25*A,fill:F,children:a}),t("line",{x1:p-3*A,y1:f+18*A,x2:p+27*A,y2:f+18*A,stroke:"#8d9aa0",strokeWidth:1.2})]})]},"python-binding-label-"+i)),u&&P.set(i,[h,f])}else if("heap cell"===o.kind){const e=m(o.address),t=m(o.cellIndex),n=W.get(e);if(!n)continue;const r={x:n.x+t*$,y:n.y},a=((null!==(f=o.value)&&void 0!==f?f:"")+"").startsWith("->");I.push({type:"rect",id:i,x:r.x,y:r.y,w:$,h:j,style:{fill:"#fffcc5",stroke:"#a8a8a8",strokeWidth:1},datum:o,label:(null!==(g=o.value)&&void 0!==g?g:"")+""}),a&&P.set(i,[r.x+$/2,r.y+j/2])}}W.forEach((n,o)=>{const r=k.heap[o];r&&(V.set("tuple-"+o,[n.x-8*A,n.y+j/2]),z.push(e("g",{children:[t("text",{x:n.x,y:n.y-14*A,fontSize:16*A,fill:D,children:"tuple"}),r.values.map((r,i)=>{const a=n.x+i*$,s=w(r);return e("g",{children:[t("text",{x:a+2*A,y:n.y+16*A,fontSize:15*A,fill:D,children:i}),s?t("circle",{cx:a+$/2,cy:n.y+j/2,r:3.6*A,fill:N}):t("text",{x:a+$/2,y:n.y+j/2+9*A,textAnchor:"middle",fontSize:25*A,fill:F,children:r+""})]},`python-tuple-cell-label-${o}-${i}`)})]},"python-tuple-"+o)))});const E=[],T=[];for(const e of o.edges){const n=d(e.source),o=d(e.target),r=P.get(n),i=null!==(v=V.get(p(o)))&&void 0!==v?v:P.get(o);if(!r||!i)continue;const a=h(r,i);e.bezier={circular:!1,points:a.points,halfWidth:2},E.push({type:"curved",pathD:a.d,style:{stroke:"rgba(26, 86, 131, 0.001)",strokeWidth:1,fill:"none"},datum:null!==(x=e.data)&&void 0!==x?x:e}),T.push(t("path",{d:a.d,fill:"none",stroke:N,strokeWidth:2.4*A,markerEnd:"url(#semiotic-gofish-memory-arrow)"},`python-pointer-${n}-${o}`))}return{sceneNodes:I,sceneEdges:E,labels:[],overlays:e("g",{className:"semiotic-gofish-python-memory",style:{pointerEvents:"none"},children:[t("defs",{children:t("marker",{id:"semiotic-gofish-memory-arrow",markerWidth:"9",markerHeight:"9",refX:"8",refY:"4.5",orient:"auto",children:t("path",{d:"M0,0 L9,4.5 L0,9 Z",fill:N})})}),T,z]})}};function u(e){var t;return null!==(t=e.data)&&void 0!==t?t:e}function d(e){return"string"==typeof e?e:e.id}function p(e){const t=/^cell-(\d+)-0$/.exec(e);return t?"tuple-"+t[1]:e}function h(e,t){const n=t[0]-e[0],o=t[1]-e[1],r=Math.max(34,Math.min(160,.42*Math.abs(n))),i={x:e[0]+r,y:e[1]},a={x:t[0]-r,y:t[1]};80>Math.abs(n)&&Math.abs(o)>20&&(i.x=e[0],i.y=e[1]+.55*o,a.x=t[0],a.y=t[1]-.55*o);const s={x:e[0],y:e[1]},l={x:t[0],y:t[1]};return{d:`M${s.x},${s.y} C${i.x},${i.y} ${a.x},${a.y} ${l.x},${l.y}`,points:[s,i,a,l]}}function y(n,o,r){if(!o)return r;const i=n+"-clip";return e("g",{children:[t("defs",{children:t("clipPath",{id:i,children:t("path",{d:o})})}),t("g",{clipPath:`url(#${i})`,children:r})]},n+"-clipwrap")}function f(e){var n;const o=function(e){if(!e)return{};return{fill:"string"==typeof e.fill?e.fill:void 0,fillOpacity:e.fillOpacity,stroke:e.stroke,strokeWidth:e.strokeWidth,strokeDasharray:e.strokeDasharray,strokeLinecap:e.strokeLinecap,opacity:e.opacity}}("style"in e?e.style:void 0);return"rect"===e.kind&&!1===e.interactive?y(e.id,e.clipPath,t("rect",{"data-gofish-id":e.id,x:e.x,y:e.y,width:e.width,height:e.height,rx:e.rx,style:o},e.id)):"circle"===e.kind&&!1===e.interactive?t("circle",{"data-gofish-id":e.id,cx:e.cx,cy:e.cy,r:e.r,style:o},e.id):"image"===e.kind?y(e.id,e.clipPath,t("image",{"data-gofish-id":e.id,href:e.href,x:e.x,y:e.y,width:e.width,height:e.height,preserveAspectRatio:null!==(n=e.preserveAspectRatio)&&void 0!==n?n:"none",opacity:e.opacity},e.id)):"path"===e.kind?y(e.id,e.clipPath,t("path",{"data-gofish-id":e.id,d:e.d,style:o},e.id)):"line"===e.kind?t("line",{"data-gofish-id":e.id,x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,style:o},e.id):"text"===e.kind?t("text",{"data-gofish-id":e.id,x:e.x,y:e.y,fontSize:e.fontSize,fontWeight:e.fontWeight,textAnchor:e.textAnchor,dominantBaseline:e.dominantBaseline,transform:e.transform,style:o,children:e.text},e.id):null}function m(e){const t=Number(e);return Number.isFinite(t)?t:0}function g(e){return function(){const t=Object.create(null);return(t=>{for(const[n,o]of Object.entries(e))t(n,o)})((e,n)=>{t[e]=n}),t}()}function v(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"item"}const b=g;function x(e,t,n,o){return[e+Math.cos(o)*n,t+Math.sin(o)*n]}function k(e){if(0===e.length)return"";if(1===e.length)return`M${e[0][0]},${e[0][1]}Z`;let t=`M${e[0][0]},${e[0][1]}`;for(let n=1;e.length>n;n++){const o=e[n-1],r=e[n];t+=` Q${(o[0]+r[0])/2},${o[1]} ${r[0]},${r[1]}`}return t+="Z",t}function w(e){return"object"==typeof e&&null!=e&&"pointer"in e}function M(e){return w(e)?"-> "+e.pointer:e+""}const A=new Map;function $(e,t){return A.set(e,t),()=>{A.get(e)===t&&A.delete(e)}}function j(e){A.delete(e)}function S(e,t){var n;return null!==(n=null==t?void 0:t[e])&&void 0!==n?n:A.get(e)}const O=1.75,_="#222222";function R(e,t){return e.topRadius+(t-e.height)/e.height*(e.topRadius-e.bottomRadius)}function B(e,t){return function(e,t,n){return Math.PI*n/3*(e*e+e*t+t*t)}(R(e,t),e.bottomRadius,t)}function L(e,t){const n=43758.5453*Math.sin(12.9898*e+78.233);return 2*(n-Math.floor(n)-.5)*t}function C(e,t){if(t>e||2*t>e)return[{x:0,y:0}];const n=[],o=e=>{let r=Math.floor(2*Math.PI*e/(2*t));1>r&&(r=1);const i=Math.hypot(e-e*Math.cos(2*Math.PI/r),-e*Math.sin(2*Math.PI/r));2*t>i&&r>1&&r--;for(let t=0;r>t;t++)n.push({x:e*Math.cos(2*t*Math.PI/r),y:e*Math.sin(2*t*Math.PI/r)});const a=e-2*t;t>a?e>2*t&&n.push({x:0,y:0}):o(a)};return o(e-t),n}function I(e,t){const n=Number(e);return Number.isFinite(n)?n:t}function z(e){const t={height:I(e.cupHeight,15.5),topRadius:I(e.cupTopRadius,4.75),bottomRadius:I(e.cupBottomRadius,3.75)},n=I(e.bobaRadius,.6),o=Math.max(0,I(e.teaVolume,450)),r=Math.max(0,I(e.bobaVolume,110)),i=Math.max(0,I(e.iceVolume,135)),a=Math.PI*n*n,s=Math.floor(r/a),l=s*a,c=Math.floor(i/5.359375),u=c*O*O*O,d=o+l+u,p=Math.min(t.height,Math.max(0,function(e,t){const n=(e.topRadius+e.bottomRadius)/2,o=Math.PI*n*n;let r=t/o,i=t-B(e,r),a=0;for(;100>a&&Math.abs(i)>1e-4;)r+=i/o,i=t-B(e,r),a++;return r}(t,d))),h=R(t,p),y=[];let f=s,m=0;for(;f>0&&60>m;){const e=n*(1+2*m),o=C(R(t,e),n),r=o.length-f,i=r>1?o.slice(Math.floor(r/2),Math.floor(r/2)+f):o,a=t.height-e;if(i.forEach((e,t)=>y.push({x:e.x+L(97*m+t,.15),z:a+L(31*m+t,.05),r:n})),f-=i.length,m++,0===i.length)break}const g=m*n*2,v=[];if(c>0){let e=0,n=c;for(;n>0&&60>e;)n-=Math.max(1,Math.floor(2*R(t,g+.875*(1+2*e))/O)),e++;const o=Math.max(g,p-e*O)+.875;let r=0;for(let n=0;e>n&&c>r;n++){const e=o+O*n,i=R(t,e),a=Math.max(1,Math.floor(2*i/O)),s=(2*i-a*O)/(a+1),l=-i+s,u=t.height-e-.875-.1;for(let e=0;a>e&&c>r;e++)v.push({cx:l+(s+O)*e+.875,cy:u+.875,w:.95*O,rot:L(53*n+e,10)}),r++}}const b=t.height,x=t.height-20.32,k=b-p;return{cupHeight:b,halfWidth:t.topRadius+.9,cup:[[-t.topRadius,0],[-t.bottomRadius,b],[t.bottomRadius,b],[t.topRadius,0]],tea:o>0?[[-h,k],[-t.bottomRadius,b],[t.bottomRadius,b],[h,k]]:null,straw:[[-.635,x],[-.635,b-.4],[.635,b-1.27-.4],[.635,x]],lid:{x1:-(t.topRadius+.9),x2:t.topRadius+.9,y:0},pearls:y,ice:v,numBobas:s,numIce:c,teaVolume:Math.round(o),bobaVolume:Math.round(l),iceVolume:Math.round(u),totalVolume:Math.round(d)}}function P(e,t){const{ref:n,halfWidth:o,topExtent:r}=t,i=2*o/n,a=r/n,s=e=>(e+o)/n,l=t=>a-(e.cupHeight-t)/n,c=e=>e/n,u=e=>[s(e[0]),l(e[1])];return{cup:e.cup.map(u),tea:e.tea?e.tea.map(u):null,straw:e.straw?e.straw.map(u):null,lid:{x1:s(e.lid.x1),x2:s(e.lid.x2),y:l(e.lid.y)},pearls:e.pearls.map(e=>({x:s(e.x),y:l(e.z),r:c(e.r),fill:"#222222"})),ice:e.ice.map(e=>({x:s(e.cx),y:l(e.cy),w:c(e.w),rot:e.rot,fill:"#a5f2f3"})),box:[i,a],numBobas:e.numBobas,numIce:e.numIce,teaVolume:e.teaVolume,bobaVolume:e.bobaVolume,iceVolume:e.iceVolume,totalVolume:e.totalVolume,cupStroke:_}}$("bobaGeometry",{kind:"derive",fn:e=>{const t=e.map(z),n=function(e){const t=a(e.map(e=>e.halfWidth),1),n=a(e.map(e=>Math.max(e.cupHeight,20.32)),1);return{halfWidth:t,topExtent:n,ref:Math.max(2*t,n)}}(t);return e.map((e,o)=>Object.assign(Object.assign({},e),{_g:P(t[o],n),teaFill:"#D2B799",strawFill:"#4F91CB",cupStroke:_,lidFill:_}))}});const V=[[.43,.04],[.57,.04],[.57,.2],[.8,.34],[.8,.82],[.72,.9],[.28,.9],[.2,.82],[.2,.34],[.43,.2]];function W(){const e="M"+V.map(e=>`${(100*e[0]).toFixed(1)},${(100*e[1]).toFixed(1)}`).join(" L")+" Z";return"data:image/svg+xml,"+encodeURIComponent(`<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'><path d='${e}' fill='rgba(150,180,195,0.30)' stroke='#6b7e88' stroke-width='2.4' stroke-linejoin='round'/></svg>`)}function N(e){var t;const n=Math.max(0,Math.min(100,I(e.amount,50))),o=.9-n/100*.8;return{silhouette:V,imageHref:W(),fill:{x:0,y:o,w:1,h:1-o},fillLine:{x1:.12,x2:.96,y:o},pct:{x:.84,y:o,text:Math.round(n)+"%"},label:{x:.5,y:.975,text:(null!==(t=e.category)&&void 0!==t?t:"")+""},fillFill:"#20bf55"}}function F(e,t){if(e)return t.includes(".")?t.split(".").reduce((e,t)=>null==e?void 0:e[t],e):e[t]}function D(e,t){if(null!=e){if("object"==typeof e){const n=e;return"field"===n.type&&"string"==typeof n.name?F(t,n.name):"datum"===n.type?n.datum:void 0}if("string"==typeof e){const n=F(t,e);return void 0!==n?n:e}return e}}function E(e,t){const n=D(e,t),o=Number(n);return Number.isFinite(o)?o:void 0}function T(e,t){let n=0;for(const o of t){const t=E(e,o);null!=t&&(n+=t)}return n}function H(e){return null==e?null:"object"==typeof e&&"field"===e.type&&"string"==typeof e.name?e.name:null}function G(e,t,n,o){var r,i;const a=H(e);if(a){const s=null!==(i=null!==(r=o.sizeOverride.get(a))&&void 0!==r?r:o.domains.get(a))&&void 0!==i?i:0;return s>0?Math.max(0,Math.min(1,T(e,t)/s))*n:n}return"number"==typeof e?Math.min(e,n):n}function q(e,t){var n;if(J(e)){for(const o of null!==(n=e.children)&&void 0!==n?n:[]){const e=q(o,t);if(e)return e}return null}return H("y"===t?e.h:e.w)}function Z(e,t,n,o){var r,i;const s=(null!==(r=e.children)&&void 0!==r?r:[])[0];if(!s||0===t.length)return()=>{};const l=q(s,n);if(!l)return()=>{};const c={type:"field",name:l},u=a(t.map(e=>T(c,e.rows)),0);if(u<=(null!==(i=o.domains.get(l))&&void 0!==i?i:0))return()=>{};const d=o.sizeOverride.get(l);return o.sizeOverride.set(l,u),()=>{void 0===d?o.sizeOverride.delete(l):o.sizeOverride.set(l,d)}}$("bottleGeometry",{kind:"derive",fn:e=>e.map(e=>Object.assign(Object.assign({},e),{_b:N(e)}))});const U=new Set(["spread","stack","scatter","treemap","group"]),Y=new Set(["derive","log"]);function X(e,t){let n=t;for(let t=e.length-1;t>=0;t--){const o=e[t];n={type:o.type,__combinator:!0,options:Object.assign({},o),children:[n]}}return n}function K(e,t){const n=[],o=new Map,r=t.startsWith("datum.")?t.slice(6):t;for(const t of e){const e=F(t,r)+"";o.has(e)||(o.set(e,[]),n.push(e)),o.get(e).push(t)}return n.map(e=>({key:e,rows:o.get(e)}))}function Q(e,t,n){var o,r,i;if(J(e)){const a=null!==(r=null===(o=e.options)||void 0===o?void 0:o.dir)&&void 0!==r?r:"y",s=null!==(i=e.children)&&void 0!==i?i:[];if("stack"===e.type){const e=s.map(e=>Q(e,t,n));return a===n?e.reduce((e,t)=>e+t,0):Math.max(0,...e)}return Math.max(0,...s.map(e=>Q(e,t,n)),1)}const a=T("y"===n?e.h:e.w,t);return a>0?a:t.length||1}function J(e){return!0===e.__combinator&&Array.isArray(e.children)}function ee(e,t){return e.ids.n+=1,`${t}-${e.ids.n}`}function te(e,t,n,o,r,i){const a=[];for(let s=0;i>=s;s++)a.push(x(e,t,n,o+s/i*(r-o)));return a}function ne(e,t,n,a,s,l,c=!1){var u,d;const p=null===(u=e.options)||void 0===u?void 0:u.coord,h=null==p?void 0:p.type;if("polar"===h&&"polar"!==a){const o=(t.x0+t.x1)/2,r=(t.y0+t.y1)/2,i=Math.min(Math.abs(t.x1-t.x0),Math.abs(t.y1-t.y0))/2,a={cx:o,cy:r};return void function(e,t,n,o,r,i){var a;for(const o of null!==(a=e.children)&&void 0!==a?a:[])ne(o,t,n,"polar",r,i)}(e,{x0:0,y0:"number"==typeof(null==p?void 0:p.innerRadius)?Math.max(0,Math.min(.95,p.innerRadius))*i:0,x1:2*Math.PI,y1:i},n,0,a,l)}if("unit"===h&&"unit"!==a){const o=oe(t,p,n[0]);for(const r of null!==(d=e.children)&&void 0!==d?d:[])se(r,t,n,l,o);return}J(e)?function(e,t,n,a,s,l,c){var u,d,p,h,y;const f=null!==(u=e.options)&&void 0!==u?u:{},m=e.type;if("derive"===m||"log"===m){const o=f.lambdaId;let r=n;if("derive"===m){const e=o?S(o,l.options.lambdas):void 0;e&&"derive"===e.kind?r=e.fn(n):o&&l.warnings.push(`derive lambda "${o}" is not registered; passing data through.`)}for(const n of null!==(d=e.children)&&void 0!==d?d:[])ne(n,t,r,a,s,l,c);return}if("layer"===m){const o=null!==(p=e.children)&&void 0!==p?p:[],r=e=>{var t;return!J(e)&&("rect"===e.type||"area"===e.type)&&null!=H(null!==(t=e.h)&&void 0!==t?t:e.w)},i=e=>{var t,n;return"polar"===(null===(n=null===(t=e.options)||void 0===t?void 0:t.coord)||void 0===n?void 0:n.type)},u=o.filter(r);let d=null,y=null;for(const e of u)if(ne(e,t,n,a,s,l,c),"none"===a){const o=G(e.h,n,t.y1-t.y0,l);d=t.y1-o,y=(t.x0+t.x1)/2}for(const e of o)if(!r(e))if(null!=d&&null!=y&&i(e)){const o="number"==typeof(null===(h=e.options)||void 0===h?void 0:h.radiusFactor)?e.options.radiusFactor:.2,r=Math.min(Math.abs(t.x1-t.x0),Math.abs(t.y1-t.y0))*o;ne(e,{x0:y-r,y0:d-r,x1:y+r,y1:d+r},n,a,s,l,c)}else ne(e,t,n,a,s,l,c);return}const g=f.by;if("group"===m){const o=g?K(n,g):[{key:"",rows:n}],r=(null!==(y=e.children)&&void 0!==y?y:[])[0];if(!r)return;for(const e of o)ne(r,t,e.rows,a,s,l,c);return}"spread"!==m?"stack"!==m?"scatter"!==m?"treemap"!==m?"connect"!==m&&"arrow"!==m?l.warnings.push(`Unsupported combinator "${m}" — children skipped.`):function(e,t,n){var o,r;const i=null!==(o=e.options)&&void 0!==o?o:{},a=[];for(const t of null!==(r=e.children)&&void 0!==r?r:[])if("ref"===t.type){const e=t.selection;Array.isArray(e)?a.push(e.map(String).join("-")):null!=e&&a.push(e+"")}n.relations.push({kind:"arrow"===e.type?"arrow":"connect",refs:a,fill:"string"==typeof i.fill?i.fill:void 0,stroke:"string"==typeof i.stroke?i.stroke:void 0,opacity:"number"==typeof i.opacity?i.opacity:void 0,interpolation:"bezier"===i.interpolation?"bezier":"linear"})}(e,0,l):function(e,t,n,a,s,l){var c,u;const d=null!==(c=e.options)&&void 0!==c?c:{},p=d.by,h=d.valueField,y=(null!==(u=e.children)&&void 0!==u?u:[])[0];if(!y)return;const f=p?K(n,p):n.map((e,t)=>({key:t+"",rows:[e]})),m=f.map(e=>{return{value:(t=e.rows,h?Math.max(0,T({type:"field",name:h},t)):t.length),item:{rows:e.rows,key:e.key}};var t}).filter(e=>{var t;return(null!==(t=e.value)&&void 0!==t?t:0)>0});if(0===m.length)return;const g=Math.max(1,t.x1-t.x0),v=Math.max(1,t.y1-t.y0),b=Number(d.paddingInner)||1,x=o().tile(r).size([g,v]).paddingInner(b).round(!0)(i({children:m}).sum(e=>{var t;return null!==(t=e.value)&&void 0!==t?t:0}));for(const e of x.leaves()){const n=e.data.item;n&&ne(y,{x0:t.x0+e.x0,y0:t.y0+e.y0,x1:t.x0+e.x1,y1:t.y0+e.y1},n.rows,a,s,l,!0)}}(e,t,n,a,s,l):function(e,t,n,o,r,i){var a,s;const l=null!==(a=e.options)&&void 0!==a?a:{},c=(null!==(s=e.children)&&void 0!==s?s:[])[0];if(!c)return;const u=l.by,d=u?K(n,u).map(e=>({rows:e.rows,anchor:e.rows[0]})):n.map(e=>({rows:[e],anchor:e})),p=d.map(e=>e.anchor),h=p.map(e=>E(l.x,e)).filter(e=>null!=e),y=p.map(e=>E(l.y,e)).filter(e=>null!=e),f=Math.abs(t.x1-t.x0),m=Math.abs(t.y1-t.y0),g=Math.min(.5*f,f/Math.max(1,d.length)*.5),v=.12*m,b=.06*m,x=ae(h,t.x0+g,t.x1-g),k=ae(y,t.y1-b,t.y0+v),w=Z(e,d,"y",i);for(const e of d){const n=E(l.x,e.anchor),a=E(l.y,e.anchor),s=null!=n?x(n):(t.x0+t.x1)/2,u=.4*Math.min(f/Math.max(1,d.length),m);ne(c,null!=a&&null!=l.y?{x0:s-u,y0:k(a)-u,x1:s+u,y1:k(a)+u}:{x0:s-u,y0:t.y0+v,x1:s+u,y1:t.y1-b},e.rows,o,r,i)}w()}(e,t,n,a,s,l):re(e,t,n,a,s,l,!0):re(e,t,n,a,s,l,!1)}(e,t,n,a,s,l,c):function(e,t,n,o,r,i,a){var s;if("mark-fn"===e.type)return void function(e,t,n,o){const r=e.lambdaId,i=r?S(r,o.options.lambdas):void 0,a=Math.min(t.x0,t.x1),s=Math.min(t.y0,t.y1),l=Math.abs(t.x1-t.x0),c=Math.abs(t.y1-t.y0);if(!i||"mark-fn"!==i.kind)return r&&o.warnings.push(`mark-fn lambda "${r}" is not registered; drawing a placeholder.`),void o.marks.push({kind:"rect",id:ee(o,"markfn"),x:a,y:s,width:l,height:c,style:{fill:"rgba(0,0,0,0.04)",stroke:"var(--semiotic-border,#bbb)"},datum:null!=n?n:void 0});const u=i.fn(null!=n?n:{},{x:a,y:s,w:l,h:c});for(const e of u)ce(e,a,s,l,c,o)}(e,t,null!==(s=n[0])&&void 0!==s?s:null,i);const l=e.repeat;if(l){const o=F(n[0],l);if(Array.isArray(o)){const r=oe(t,void 0,n[0]),a=Object.assign(Object.assign({},e),{repeat:void 0});for(const e of o)se(a,t,[e],i,r)}return}"polar"===o&&r?function(e,t,n,o,r){var i,a,s,l,c,u,d,p;const h=null!==(i=n[0])&&void 0!==i?i:null,y=null!==(l=null!==(s=null===(a=e.origin)||void 0===a?void 0:a.name)&&void 0!==s?s:e.name)&&void 0!==l?l:e.type,f=t.x0,m=t.x1,g=t.y0,v=t.y1,b=ue(e,h,r);if("petal"===e.type){const t=null!==(u=null!==(c=e.h)&&void 0!==c?c:e.size)&&void 0!==u?u:e.r,i=H(t);let a=v;if(i){const e=null!==(p=null!==(d=r.sizeOverride.get(i))&&void 0!==d?d:r.domains.get(i))&&void 0!==p?p:0;e>0&&(a=g+(v-g)*(.35+.65*Math.max(0,Math.min(1,T(t,n)/e))))}const s=function(e,t,n,o,r,i){const a=(r+i)/2,s=x(e,t,n,r),l=x(e,t,o,a),c=x(e,t,n,i);return`M${s[0]},${s[1]} Q${l[0]},${l[1]} ${c[0]},${c[1]} Q${e},${t} ${s[0]},${s[1]} Z`}(o.cx,o.cy,Math.max(1,.16*a),a,f,m);return r.marks.push({kind:"path",id:ee(r,y),d:s,style:b,datum:pe(0,n),group:de(e,h)}),void function(e,t,n,o){var r,i;const a=null!==(r=e.name)&&void 0!==r?r:null===(i=e.origin)||void 0===i?void 0:i.name;a&&o.frames.set(a,{name:a,cx:t[0],cy:t[1],bbox:{x:t[0],y:t[1],w:0,h:0}})}(e,x(o.cx,o.cy,(g+a)/2,(f+m)/2),0,r)}if("rect"===e.type||"area"===e.type){const t=de(e,h),i=E(e.w,h),a=(f+m)/2,s=null!=i?a-i/2:f,l=null!=i?a+i/2:m,c=Math.max(2,Math.ceil(Math.abs(l-s)/.12)),u=te(o.cx,o.cy,v,s,l,c),d=te(o.cx,o.cy,g,s,l,c);return r.marks.push({kind:"area",id:ee(r,y),topPath:u,bottomPath:d,style:b,datum:n.length?n:void 0,group:t}),void r.polarSegments.push({group:t,cx:o.cx,cy:o.cy,innerR:g,outerR:v,theta0:s,theta1:l})}if("circle"===e.type){const[t,n]=x(o.cx,o.cy,(g+v)/2,(f+m)/2);return void r.marks.push({kind:"circle",id:ee(r,y),cx:t,cy:n,r:3,style:b,datum:null!=h?h:void 0,interactive:e.interactive})}const[k,w]=x(o.cx,o.cy,(g+v)/2,(f+m)/2);le(e,k,w,h,r)}(e,t,n,r,i):function(e,t,n,o,r){var i,a,s,l;const c=null!==(i=n[0])&&void 0!==i?i:null,u=null!==(l=null!==(s=null===(a=e.origin)||void 0===a?void 0:a.name)&&void 0!==s?s:e.name)&&void 0!==l?l:e.type,d=Math.min(t.x0,t.x1),p=Math.max(t.x0,t.x1),h=Math.min(t.y0,t.y1),y=Math.max(t.y0,t.y1),f=(e,t)=>"number"==typeof e?Math.min(e,t):t;if("rect"===e.type||"image"===e.type){const t=p-d,i=y-h,a=r?f(e.w,t):G(e.w,n,t,o),s=r?f(e.h,i):G(e.h,n,i,o);return o.marks.push({kind:"rect",id:ee(o,u),x:d+(t-a)/2,y:y-s,width:Math.max(0,a),height:Math.max(0,s),style:ue(e,c,o),datum:pe(0,n),group:de(e,c),interactive:e.interactive}),void("image"===e.type&&o.warnings.push(`image mark "${u}" rendered as a placeholder rect (href not loaded).`))}if("circle"===e.type){const t=(d+p)/2,r=(h+y)/2,i=Math.min(p-d,y-h)/2;return void o.marks.push({kind:"circle",id:ee(o,u),cx:t,cy:r,r:Math.max(0,i),style:ue(e,c,o),datum:pe(0,n),group:de(e,c),interactive:e.interactive})}"line"!==e.type?le(e,(d+p)/2,(h+y)/2,c,o):o.marks.push({kind:"line",id:ee(o,u),x1:d,y1:y,x2:p,y2:h,style:ue(e,c,o)})}(e,t,n,i,a)}(e,t,n,a,s,l,c)}function oe(e,t,n){const o=Math.min(e.x0,e.x1),r=Math.min(e.y0,e.y1),i=Math.abs(e.x1-e.x0),a=Math.abs(e.y1-e.y0);if("uniform"!==(null==t?void 0:t.fit))return{ux:e=>o+e*i,uy:e=>r+e*a,us:e=>e*Math.min(i,a)};let s=1,l=1;const c=t.boxField?F(n,t.boxField):void 0;Array.isArray(c)&&2===c.length&&(s=Number(c[0])>0?Number(c[0]):1,l=Number(c[1])>0?Number(c[1]):1);const u=Math.min(i/s,a/l),d=i-u*s,p=a-u*l,h="start"===t.anchorX?0:"end"===t.anchorX?d:d/2,y="start"===t.anchorY?0:"end"===t.anchorY?p:p/2;return{ux:e=>o+h+e*u,uy:e=>r+y+e*u,us:e=>e*u}}function re(e,t,n,o,r,i,s){var l,c,u,d,p;const h="y"===(null!==(c=null===(l=e.options)||void 0===l?void 0:l.dir)&&void 0!==c?c:"x")?"y":"x",y=Number(null===(u=e.options)||void 0===u?void 0:u.spacing)||0,f=function(e,t){var n,o;const r=null===(n=e.options)||void 0===n?void 0:n.by,i=null!==(o=e.children)&&void 0!==o?o:[];if(r){const e=i[0];return K(t,r).map(t=>({node:e,rows:t.rows,key:t.key}))}if(i.length>1)return i.map((e,n)=>({node:e,rows:t,key:n+""}));const a=i[0];return a&&!J(a)&&t.length>1?t.map((e,t)=>({node:a,rows:[e],key:t+""})):a?[{node:a,rows:t,key:"0"}]:[]}(e,n);if(0===f.length)return;const m=null===(d=e.options)||void 0===d?void 0:d.sort;"asc"!==m&&"desc"!==m||f.sort((e,t)=>{const n=Q(e.node,e.rows,h),o=Q(t.node,t.rows,h);return"asc"===m?n-o:o-n});const g="x"===h?t.x0:t.y0,v=("x"===h?t.x1:t.y1)-g;if(!s){const n="x"===h?"y":"x",s=Z(e,f,n,i),l=null===(p=e.options)||void 0===p?void 0:p.sizeBy,c=l?f.map(e=>T({type:"field",name:l},e.rows)):[],u=l?a(c,0):0,d=(v-y*(f.length-1))/f.length;return f.forEach((e,a)=>{const s=g+a*(d+y);let p=ie(t,h,s,s+d);l&&u>0&&(p=function(e,t,n){if("y"===t){const t=(e.y1-e.y0)*n;return Object.assign(Object.assign({},e),{y0:e.y1-t})}const o=(e.x1-e.x0)*n;return Object.assign(Object.assign({},e),{x1:e.x0+o})}(p,n,Math.max(.02,c[a]/u))),ne(e.node,p,e.rows,o,r,i,!1)}),void s()}const b=f.map(e=>Q(e.node,e.rows,h)),x=b.reduce((e,t)=>e+t,0)||1,k=v-y*(f.length-1),w=f[0]?q(f[0].node,h):null,M=w?i.sizeOverride.get(w):void 0,A=M&&M>0?k/M:k/x;let $=g;f.forEach((e,n)=>{const a=b[n]*A,s=ie(t,h,$,$+a);ne(e.node,s,e.rows,o,r,i,!0),$+=a+y})}function ie(e,t,n,o){return"x"===t?{x0:n,y0:e.y0,x1:o,y1:e.y1}:{x0:e.x0,y0:n,x1:e.x1,y1:o}}function ae(e,t,n){if(0===e.length)return()=>(t+n)/2;let[o,r]=function(e){let t=1/0,n=-1/0;for(const o of e)t>o&&(t=o),o>n&&(n=o);return[t,n]}(e);return o===r&&(o-=.5,r+=.5),e=>t+(e-o)/(r-o)*(n-t)}function se(e,t,n,o,r){var i,a,s,l,c,u,d,p,h,y,f,m,g,v,b,x,k,w,M,A,$,j,S,O,_,R,B;const L=e.repeat;if(L){const i=F(n[0],L);if(Array.isArray(i)){const n=Object.assign(Object.assign({},e),{repeat:void 0});for(const e of i)se(n,t,[e],o,r)}return}const{ux:C,uy:I,us:z}=r,P=null!==(i=n[0])&&void 0!==i?i:null,V=null!==(l=null!==(s=null===(a=e.origin)||void 0===a?void 0:a.name)&&void 0!==s?s:e.name)&&void 0!==l?l:ee(o,e.type),W=D(e.clip,P),N=Array.isArray(W)&&W.length?`M${W.map(e=>`${C(e[0])},${I(e[1])}`).join(" L")} Z`:void 0;if("polygon"===e.type){const t=D(e.points,P);if(!Array.isArray(t)||0===t.length)return;const n=`M${t.map(e=>`${C(e[0])},${I(e[1])}`).join(" L")} Z`;return void o.marks.push({kind:"path",id:ee(o,V),d:n,style:ue(e,P,o),clipPath:N})}if("image"===e.type){const t=D(e.href,P);if("string"!=typeof t||!t)return;const n=null!==(c=E(e.x,P))&&void 0!==c?c:0,r=null!==(u=E(e.y,P))&&void 0!==u?u:0,i=null!==(d=E(e.w,P))&&void 0!==d?d:1,a=null!==(p=E(e.h,P))&&void 0!==p?p:1;return void o.marks.push({kind:"image",id:ee(o,V),href:t,x:C(n),y:I(r),width:C(n+i)-C(n),height:I(r+a)-I(r),opacity:E(e.opacity,P),clipPath:N})}if("circle"===e.type){const t=null!==(y=null!==(h=E(e.cx,P))&&void 0!==h?h:E(e.x,P))&&void 0!==y?y:.5,n=null!==(m=null!==(f=E(e.cy,P))&&void 0!==f?f:E(e.y,P))&&void 0!==m?m:.5,r=null!==(g=E(e.r,P))&&void 0!==g?g:.02;return void o.marks.push({kind:"circle",id:ee(o,V),cx:C(t),cy:I(n),r:z(r),style:ue(e,P,o),datum:null!=P?P:void 0,interactive:e.interactive})}if("rect"===e.type){const t=E(e.rotate,P);if(null!=t){const n=C(null!==(v=E(e.x,P))&&void 0!==v?v:.5),r=I(null!==(b=E(e.y,P))&&void 0!==b?b:.5),i=z(null!==(x=E(e.w,P))&&void 0!==x?x:.05),a=function(e,t,n,o,r,i,a){const s=r*Math.PI/180,l=Math.cos(s),c=Math.sin(s),u=(e,t)=>{const n=e-i,o=t-a;return`${i+n*l-o*c},${a+n*c+o*l}`};return`M${u(e,t)} L${u(e+n,t)} L${u(e+n,t+o)} L${u(e,t+o)} Z`}(n-i/2,r-i/2,i,i,t,n,r);return void o.marks.push({kind:"path",id:ee(o,V),d:a,style:ue(e,P,o)})}const n=null!==(k=E(e.x,P))&&void 0!==k?k:0,r=null!==(w=E(e.y,P))&&void 0!==w?w:0,i=null!==(M=E(e.w,P))&&void 0!==M?M:1,a=null!==(A=E(e.h,P))&&void 0!==A?A:1;return void o.marks.push({kind:"rect",id:ee(o,V),x:C(n),y:I(r),width:C(n+i)-C(n),height:I(r+a)-I(r),style:ue(e,P,o),datum:null!=P?P:void 0,group:de(e,P),interactive:e.interactive,clipPath:N})}if("line"!==e.type){if("text"===e.type){const t=D(e.text,P);return void o.marks.push({kind:"text",id:ee(o,V),x:C(null!==(_=E(e.x,P))&&void 0!==_?_:.5),y:I(null!==(R=E(e.y,P))&&void 0!==R?R:.95),text:null==t?"":t+"",fontSize:Number(e.fontSize)||11,textAnchor:null!==(B=e.textAnchor)&&void 0!==B?B:"middle",style:{fill:"var(--semiotic-text-secondary, #667)"}})}le(e,C(.5),I(.95),P,o)}else o.marks.push({kind:"line",id:ee(o,V),x1:C(null!==($=E(e.x1,P))&&void 0!==$?$:0),y1:I(null!==(j=E(e.y1,P))&&void 0!==j?j:0),x2:C(null!==(S=E(e.x2,P))&&void 0!==S?S:1),y2:I(null!==(O=E(e.y2,P))&&void 0!==O?O:0),style:ue(e,P,o)})}function le(e,t,n,o,r){var i,a;if("text"===e.type){const s=D(e.text,null!=o?o:void 0);return void r.marks.push({kind:"text",id:ee(r,null!==(a=null===(i=e.origin)||void 0===i?void 0:i.name)&&void 0!==a?a:"text"),x:t,y:n,text:null==s?"":s+"",fontSize:Number(e.fontSize)||11,textAnchor:"middle",style:{fill:"var(--semiotic-text-secondary, #667)"}})}r.warnings.push(`Unsupported leaf mark "${e.type}".`)}function ce(e,t,n,o,r,i){var a;const s=e=>t+e*o,l=e=>n+e*r,c=e=>e*Math.min(o,r);if("polygon"===e.kind){const t=`M${e.points.map(e=>`${s(e[0])},${l(e[1])}`).join(" L")} Z`;i.marks.push({kind:"path",id:ee(i,"mf-poly"),d:t,style:{fill:e.fill,stroke:e.stroke,strokeWidth:e.strokeWidth,opacity:e.opacity}})}else"circle"===e.kind?i.marks.push({kind:"circle",id:ee(i,"mf-c"),cx:s(e.x),cy:l(e.y),r:c(e.r),style:{fill:e.fill,stroke:e.stroke,opacity:e.opacity},interactive:!1}):"rect"===e.kind?i.marks.push({kind:"rect",id:ee(i,"mf-r"),x:s(e.x),y:l(e.y),width:c(e.w),height:c(e.h),style:{fill:e.fill,stroke:e.stroke,opacity:e.opacity},interactive:!1}):"text"===e.kind&&i.marks.push({kind:"text",id:ee(i,"mf-t"),x:s(e.x),y:l(e.y),text:e.text,fontSize:null!==(a=e.fontSize)&&void 0!==a?a:11,textAnchor:"middle",style:{fill:e.fill}})}function ue(e,t,n,o){var r;const i=e.fill,a=e.stroke;let s;if(null!=i){const e=D(i,t);"string"==typeof e&&function(e){if(e.startsWith("#")||e.startsWith("var(")||e.startsWith("rgb")||e.startsWith("hsl"))return!0;const t=e.toLowerCase();return"none"===t||"transparent"===t||"currentcolor"===t}(e)?s=e:null!=e&&(s=n.resolveColor(e+"",t))}const l="string"==typeof D(a,t)?D(a,t):void 0;return{fill:null!=s?s:"rect"===e.type||"circle"===e.type||"area"===e.type||"petal"===e.type?n.resolveColor(null!==(r=de(e,t))&&void 0!==r?r:"0",t):void 0,stroke:l,strokeWidth:"number"==typeof e.strokeWidth?e.strokeWidth:void 0,fillOpacity:"number"==typeof e.opacity?e.opacity:void 0}}function de(e,t){const n=e.fill;if(n&&"object"==typeof n&&"field"===n.type){const e=F(t,n.name);if(null!=e)return e+""}}function pe(e,t){if(0!==t.length)return 1===t.length?t[0]:g(Object.assign(Object.assign({},t[0]),{_groupSize:t.length}))}function he(e){if(2>e.length)return"";let t=`M${e[0][0]},${e[0][1]}`;for(let n=1;e.length>n;n++){const o=e[n-1],r=e[n];t+=` Q${(o[0]+r[0])/2},${o[1]} ${r[0]},${r[1]}`}return t}function ye(e){return 2>e.length?"":`M${e.map(e=>`${e[0]},${e[1]}`).join(" L")} Z`}function fe(e,t,n,o){var r,i,a,s,l;const c={marks:[],frames:new Map,relations:[],resolveColor:n,options:o,warnings:null!==(r=o.warnings)&&void 0!==r?r:[],ids:{n:0},domains:new Map,sizeOverride:new Map,polarSegments:[]},u={x0:t.x,y0:t.y,x1:t.x+t.width,y1:t.y+t.height},d="chart"===e.type?[e]:"layer"===e.type?e.charts:[];for(const e of d)if("inline"===(null===(i=e.data)||void 0===i?void 0:i.type))for(const t of e.data.rows)for(const[e,n]of Object.entries(t)){const t=Number(n);Number.isFinite(t)&&c.domains.set(e,Math.max(null!==(a=c.domains.get(e))&&void 0!==a?a:0,Math.abs(t)))}"raw-mark"===e.type&&ne(e.mark,u,[],"none",null,c);for(const e of d){const t="inline"===(null===(s=e.data)||void 0===s?void 0:s.type)?e.data.rows:[];ne(X(null!==(l=e.operators)&&void 0!==l?l:[],e.mark),u,t,"none",null,c),e.connect&&ne(e.connect,u,t,"none",null,c)}return function(e){var t,n,o,r,i,a,s;const l=e.relations.find(e=>"connect"===e.kind);if(l&&e.polarSegments.length>=2){const r=new Map;for(const o of e.polarSegments){const e=null!==(t=o.group)&&void 0!==t?t:"",i=null!==(n=r.get(e))&&void 0!==n?n:[];i.push(o),r.set(e,i)}for(const[t,n]of r){if(2>n.length)continue;const r=[...n].sort((e,t)=>(e.theta0+e.theta1)/2-(t.theta0+t.theta1)/2),i=[],a=[];for(const e of r)i.push(x(e.cx,e.cy,e.outerR,e.theta0),x(e.cx,e.cy,e.outerR,e.theta1)),a.push(x(e.cx,e.cy,e.innerR,e.theta0),x(e.cx,e.cy,e.innerR,e.theta1));const s=[...i,...a.reverse()],c="bezier"===l.interpolation?k(s):ye(s),u=e.resolveColor(t);e.marks.push({kind:"path",id:ee(e,"ribbon"),d:c,style:{fill:u,fillOpacity:null!==(o=l.opacity)&&void 0!==o?o:.26,stroke:u,strokeWidth:1,opacity:.9}})}}for(const t of e.relations){const n=t.refs.map(t=>e.frames.get(t)).filter(e=>!!e).map(e=>[e.cx,e.cy]);if(2>n.length)continue;const o="bezier"===t.interpolation||"connect"===t.kind?he(n):"M"+n.map(e=>`${e[0]},${e[1]}`).join(" L");e.marks.push({kind:"path",id:ee(e,t.kind),d:o,style:{fill:null!==(r=t.fill)&&void 0!==r?r:"none",stroke:null!==(a=null!==(i=t.stroke)&&void 0!==i?i:t.fill)&&void 0!==a?a:"var(--semiotic-border,#888)",opacity:null!==(s=t.opacity)&&void 0!==s?s:.8,strokeWidth:t.fill&&"none"!==t.fill?0:1.5}})}}(c),c}function me(e,t={}){return n=>{var o;const r=fe(function(e,t){var n;const o=t;return"chart"===e.type?"inline"!==(null===(n=e.data)||void 0===n?void 0:n.type)?e:Object.assign(Object.assign({},e),{data:Object.assign(Object.assign({},e.data),{rows:o})}):"layer"===e.type?Object.assign(Object.assign({},e),{charts:e.charts.map(e=>{var t;return"inline"===(null===(t=e.data)||void 0===t?void 0:t.type)?Object.assign(Object.assign({},e),{data:Object.assign(Object.assign({},e.data),{rows:o})}):e})}):e}(e,n.data),n.dimensions.plot,n.resolveColor,Object.assign(Object.assign({},t),{warnings:null!==(o=t.warnings)&&void 0!==o?o:[]}));return l(()=>({marks:r.marks}))(n)}}function ge(e,t,n={}){return o=>{var r,i,a,s,c,u,d,p,h,y;const{plot:f}=o.dimensions,m=o.scales.o,g=m.bandwidth(),b=Math.max(1,f.height-26-8),x=null!==(r=o.config)&&void 0!==r?r:{},k=g*Math.max(.2,Math.min(1,null!==(a=null!==(i=x.glyphWidthRatio)&&void 0!==i?i:x.cupWidthRatio)&&void 0!==a?a:.9)),w=[],M=[],A=null!==(s=n.warnings)&&void 0!==s?s:[],$="chart"===e.type?e:"layer"===e.type?e.charts[0]:void 0;if(!$)return{nodes:[]};const j=function(e,t,n,o){let r=e;for(const e of t)if("derive"===e.type){const t=e.lambdaId,i=t?S(t,n.lambdas):void 0;i&&"derive"===i.kind?r=i.fn(r):t&&o.push(`derive lambda "${t}" is not registered; passing data through.`)}return r}("inline"===(null===(c=$.data)||void 0===c?void 0:c.type)?o.data:[],null!==(u=$.operators)&&void 0!==u?u:[],n,A),O=X((null!==(d=$.operators)&&void 0!==d?d:[]).filter(e=>!Y.has(e.type)&&!U.has(e.type)),$.mark),_=(null!==(p=$.operators)&&void 0!==p?p:[]).find(e=>"spread"===e.type||"group"===e.type),R=K(j,(null!==(h=null==_?void 0:_.by)&&void 0!==h?h:t).replace(/^datum\./,""));for(const e of R){const t=m(e.key);if(null==t)continue;const r=fe({type:"chart",data:{type:"inline",rows:e.rows},mark:O},{x:t+(g-k)/2,y:f.y+8,width:k,height:b},o.resolveColor,Object.assign(Object.assign({},n),{warnings:A})),i=v(e.key);for(const e of r.marks)e.id=`${i}-${e.id}`;M.push(...r.marks),w.push({type:"rect",x:t,y:f.y+8,w:g,h:b,style:{fill:"rgba(0,0,0,0)",stroke:"none"},datum:null!==(y=e.rows[0])&&void 0!==y?y:null,group:e.key,_transitionKey:"cat-"+v(e.key)}),M.push({kind:"text",id:"lbl-"+v(e.key),x:t+g/2,y:f.y+f.height-8,text:e.key,fontSize:12,textAnchor:"middle",style:{fill:"var(--semiotic-text,#333)"}})}const B=l(()=>({marks:M}))({data:o.data,scales:{x:o.scales.r,y:o.scales.r},dimensions:o.dimensions,theme:o.theme,resolveColor:o.resolveColor,config:{}});return{nodes:[...w,...B.nodes],overlays:B.overlays}}}const ve="unstable-gofish-ir-adapter";function be(e){return"chart"===e.type?[e]:"layer"===e.type?e.charts:[]}function xe(e){const t=[];return function(e){const n=e=>{if(e){if(t.push(e),e.children)for(const t of e.children)n(t);e.source&&n(e.source)}};if("raw-mark"!==e.type)for(const t of be(e))n(t.mark),n(t.connect);else n(e.mark)}(e),t}function ke(e,t={}){var n;const o=[];e&&"gofish-frontend"===e.ir||o.push(`Expected a "gofish-frontend" IR document but got ir="${null==e?void 0:e.ir}". Attempting best-effort translation.`),0!==(null==e?void 0:e.irVersion)&&o.push(`This adapter targets GoFish Frontend IR v0; document declares irVersion=${null==e?void 0:e.irVersion}. Newer fields are ignored.`);const r=e.root,i=xe(r),a=function(e){return be(e).flatMap(e=>{var t;return null!==(t=e.operators)&&void 0!==t?t:[]})}(r),s=function(e){var t;for(const n of be(e))if("inline"===(null===(t=n.data)||void 0===t?void 0:t.type))return n.data.rows;return[]}(r),l=function(e){const t=new Set;for(const n of e.slice(0,8))for(const e of Object.keys(n))t.add(e);return t}(s),u=new Set(i.map(e=>e.type)),d=null!==(n=t.family)&&void 0!==n?n:function(e,t,n){return e.has("arrow")?"network":n.some(e=>{var t;return"derive"===e.type&&((null!==(t=e.lambdaId)&&void 0!==t?t:"")+"").toLowerCase().includes("boba")})||t.has("teaVolume")&&t.has("bobaVolume")?"ordinal":"xy"}(u,l,a),p=t.lambdas;if("network"===d)return function(e,t,n){const o=function(e){var t;for(const n of be(e))if("inline"===(null===(t=n.data)||void 0===t?void 0:t.type))for(const e of n.data.rows){const t=e;if(e&&Array.isArray(t.stack)&&Array.isArray(t.heap))return t}}(e);o||n.push("Memory-diagram IR carried no inline {stack, heap, heapArrangement} row; rendering an empty graph.");const r=o?function(e){const t=[],n=[];return e.stack.forEach((e,o)=>{t.push({id:"binding-"+e.name,kind:"binding",index:o,name:e.name,value:M(e.value),pointer:w(e.value)?e.value.pointer:void 0}),w(e.value)&&n.push({source:"binding-"+e.name,target:`cell-${e.value.pointer}-0`,value:1,kind:"stack pointer",pointer:e.value.pointer})}),e.heap.forEach((e,o)=>{e.values.forEach((e,r)=>{t.push({id:`cell-${o}-${r}`,kind:"heap cell",address:o,cellIndex:r,value:M(e),pointer:w(e)?e.pointer:void 0}),w(e)&&n.push({source:`cell-${o}-${r}`,target:`cell-${e.pointer}-0`,value:1,kind:"heap pointer",pointer:e.pointer})})}),{nodes:t,edges:n}}(o):{nodes:[],edges:[]};return{family:"network",recipe:"gofishPythonTutorNetworkLayout",layout:null,networkLayout:c,ordinalLayout:null,layoutConfig:o?{diagram:o}:{},data:[],graph:r,irVersion:t,warnings:n.length?n:void 0}}(r,e.irVersion,o);if("ordinal"===d){const t=function(e){return e.find(e=>"spread"===e.type)}(a),n=(null==t?void 0:t.by)&&((h=t.by).startsWith("datum.")?h.slice(6):h)||"name";return{family:"ordinal",recipe:"gofishInterpreter",layout:null,networkLayout:null,ordinalLayout:ge(r,n,{lambdas:p,warnings:o}),layoutConfig:{},categoryAccessor:n,valueAccessor:l.has("teaVolume")?"teaVolume":void 0,data:s,graph:null,irVersion:e.irVersion,warnings:o.length?o:void 0}}var h;return{family:"xy",recipe:"gofishInterpreter",layout:me(r,{lambdas:p,warnings:o}),networkLayout:null,ordinalLayout:null,layoutConfig:{},data:s,graph:null,irVersion:e.irVersion,warnings:o.length?o:void 0}}const we=[{lake:"Erie",species:"Walleye",count:48,x:0},{lake:"Erie",species:"Perch",count:31,x:0},{lake:"Erie",species:"Trout",count:16,x:0},{lake:"Huron",species:"Walleye",count:26,x:1},{lake:"Huron",species:"Perch",count:18,x:1},{lake:"Huron",species:"Trout",count:35,x:1},{lake:"Michigan",species:"Walleye",count:18,x:2},{lake:"Michigan",species:"Perch",count:42,x:2},{lake:"Michigan",species:"Trout",count:27,x:2},{lake:"Ontario",species:"Walleye",count:22,x:3},{lake:"Ontario",species:"Perch",count:21,x:3},{lake:"Ontario",species:"Trout",count:43,x:3},{lake:"Superior",species:"Walleye",count:14,x:4},{lake:"Superior",species:"Perch",count:24,x:4},{lake:"Superior",species:"Trout",count:57,x:4}],Me=e=>({type:"field",name:e}),Ae={irVersion:0,ir:"gofish-frontend",root:{type:"chart",data:{type:"inline",rows:we},operators:[{type:"scatter",by:"lake",x:Me("x")}],mark:{type:"layer",__combinator:!0,children:[{type:"rect",origin:{name:"stem"},w:5,h:Me("count"),fill:"#2f8f46"},{type:"layer",__combinator:!0,options:{coord:{type:"polar"}},children:[{type:"stack",__combinator:!0,options:{dir:"x",by:"species",spacing:0},children:[{type:"petal",h:Me("count"),fill:Me("species")}]}]}]}}},$e={irVersion:0,ir:"gofish-frontend",root:{type:"chart",data:{type:"inline",rows:[{id:"planning",category:"Planning",amount:64},{id:"design",category:"Design",amount:82},{id:"build",category:"Build",amount:46},{id:"review",category:"Review",amount:71},{id:"ship",category:"Ship",amount:55}]},options:{axes:!1},operators:[{type:"spread",by:"category",dir:"x",spacing:20},{type:"derive",lambdaId:"bottleGeometry"}],mark:{type:"layer",__combinator:!0,options:{coord:{type:"unit"}},children:[{type:"image",origin:{name:"bottle"},href:Me("_b.imageHref"),x:0,y:0,w:1,h:1},{type:"rect",origin:{name:"fill"},x:Me("_b.fill.x"),y:Me("_b.fill.y"),w:Me("_b.fill.w"),h:Me("_b.fill.h"),fill:Me("_b.fillFill"),opacity:.82,clip:Me("_b.silhouette"),interactive:!1},{type:"line",origin:{name:"fillLine"},x1:Me("_b.fillLine.x1"),x2:Me("_b.fillLine.x2"),y1:Me("_b.fillLine.y"),y2:Me("_b.fillLine.y"),stroke:"#6b7e88",strokeWidth:1},{type:"text",origin:{name:"pct"},text:Me("_b.pct.text"),x:Me("_b.pct.x"),y:Me("_b.pct.y"),textAnchor:"start",fontSize:11},{type:"text",origin:{name:"label"},text:Me("_b.label.text"),x:Me("_b.label.x"),y:Me("_b.label.y"),textAnchor:"middle",fontSize:11},{type:"rect",origin:{name:"hit"},x:0,y:0,w:1,h:1,fill:"rgba(0,0,0,0)"}]}}},je={irVersion:0,ir:"gofish-frontend",root:{type:"chart",data:{type:"inline",rows:we},mark:{type:"layer",__combinator:!0,options:{coord:{type:"polar",innerRadius:.22}},children:[{type:"spread",__combinator:!0,options:{dir:"x",by:"lake"},children:[{type:"stack",__combinator:!0,options:{dir:"y",by:"species",sort:"asc"},children:[{type:"rect",w:.34,h:Me("count"),fill:Me("species")}]}]},{type:"connect",__combinator:!0,options:{by:"species",opacity:.28},children:[{type:"ref",selection:"species"}]}]}}},Se={irVersion:0,ir:"gofish-frontend",root:{type:"chart",data:{type:"inline",rows:function(){const e=[],t=[{pclass:1,count:90,fareBase:24,fareSpread:126,survivalRate:.64},{pclass:2,count:60,fareBase:10,fareSpread:56,survivalRate:.46},{pclass:3,count:150,fareBase:4,fareSpread:26,survivalRate:.25}];for(const n of t)for(let t=0;n.count>t;t++){const o=.5*Math.sin(1.7*t+n.pclass)+.5;e.push({name:`class-${n.pclass}-${t}`,pclass:n.pclass,survived:n.survivalRate>(73*t+29*n.pclass)%100/100,fare:Math.round(10*(n.fareBase+Math.pow(1-t/n.count,2.15)*n.fareSpread+o*n.fareSpread*.08+37*t%23/23*n.fareSpread*.05))/10})}return e}()},mark:{type:"spread",__combinator:!0,options:{by:"pclass",dir:"x",sizeBy:"fare",spacing:18},children:[{type:"treemap",__combinator:!0,options:{valueField:"fare",paddingInner:1.5},children:[{type:"circle",fill:Me("survived")}]}]}}},Oe={irVersion:0,ir:"gofish-frontend",root:{type:"chart",data:{type:"inline",rows:[{kind:"memory-snapshot",stack:[{name:"c",value:{pointer:0}},{name:"d",value:{pointer:1}},{name:"x",value:"5"}],heap:[{values:["12",{pointer:1},"1","0",{pointer:2},{pointer:3}]},{values:["1","4"]},{values:["3","10","7","8",{pointer:4}]},{values:["2",{pointer:4}]},{values:["3"]}],heapArrangement:[[0,null,3,null],[null,1,2,4]]}]},mark:{type:"layer",__combinator:!0,children:[{type:"spread",__combinator:!0,options:{dir:"x",alignment:"start",spacing:100},children:[{type:"rect",origin:{name:"globalFrame"}},{type:"rect",origin:{name:"heap"}}]},{type:"arrow",__combinator:!0,options:{stroke:"#1A5683"},children:[{type:"ref",selection:"globalFrame"},{type:"ref",selection:"heap"}]}]}}},_e={irVersion:0,ir:"gofish-frontend",root:{type:"chart",data:{type:"inline",rows:[{name:"Classic",teaVolume:470,bobaVolume:95,iceVolume:60,cupHeight:15.5,cupTopRadius:4.75,cupBottomRadius:3.75,bobaRadius:.6},{name:"Extra Boba",teaVolume:360,bobaVolume:240,iceVolume:45,cupHeight:15.5,cupTopRadius:4.75,cupBottomRadius:3.75,bobaRadius:.6},{name:"Light Ice",teaVolume:500,bobaVolume:95,iceVolume:12,cupHeight:15.5,cupTopRadius:4.75,cupBottomRadius:3.75,bobaRadius:.6},{name:"Mega",teaVolume:660,bobaVolume:150,iceVolume:120,cupHeight:18,cupTopRadius:5.6,cupBottomRadius:4.4,bobaRadius:.6}]},operators:[{type:"spread",by:"name",dir:"x",spacing:24},{type:"derive",lambdaId:"bobaGeometry"}],mark:{type:"layer",__combinator:!0,options:{coord:{type:"unit",fit:"uniform",boxField:"_g.box",anchorY:"end"}},children:[{type:"polygon",origin:{name:"tea"},points:Me("_g.tea"),fill:Me("teaFill")},{type:"circle",origin:{name:"pearl"},repeat:"_g.pearls",cx:Me("x"),cy:Me("y"),r:Me("r"),fill:Me("fill"),opacity:.85,interactive:!1},{type:"rect",origin:{name:"ice"},repeat:"_g.ice",x:Me("x"),y:Me("y"),w:Me("w"),h:Me("w"),rotate:Me("rot"),fill:Me("fill"),opacity:.85,interactive:!1},{type:"polygon",origin:{name:"cup"},points:Me("_g.cup"),fill:"none",stroke:Me("cupStroke"),strokeWidth:2.5},{type:"line",origin:{name:"lid"},x1:Me("_g.lid.x1"),x2:Me("_g.lid.x2"),y1:Me("_g.lid.y"),y2:Me("_g.lid.y"),stroke:Me("lidFill"),strokeWidth:4},{type:"polygon",origin:{name:"straw"},points:Me("_g.straw"),fill:Me("strawFill"),stroke:Me("cupStroke"),strokeWidth:1,opacity:.85}]}}},Re=[{key:"flower",label:"Flower chart",doc:Ae,source:"https://gofish.graphics/js/examples/flower-chart.html"},{key:"bottle",label:"Bottle fill",doc:$e,source:"https://gofish.graphics/js/examples/bottle-fill-chart.html"},{key:"polar",label:"Polar ribbon",doc:je,source:"https://gofish.graphics/js/examples/polar-ribbon-chart.html"},{key:"titanic",label:"Fare circle treemap",doc:Se,source:"https://gofish.graphics/js/examples/titanic-fare-circle-treemap.html"},{key:"python",label:"Python memory",doc:Oe,source:"https://gofish.graphics/js/examples/python-tutor-memory-diagram.html"},{key:"boba",label:"Boba cups",doc:_e,source:"https://observablehq.com/@kristw/boba-science"}],Be="0.1",Le=["trend","compare-series","compare-categories","rank","part-to-whole","distribution","correlation","flow","hierarchy","geo","outlier-detection","composition-over-time","change-detection"],Ce=new Set(["fresh","aging","stale","expired"]),Ie=new Set(["proposed","accepted","disputed","retracted"]),ze=new Set(["fixed","latest","sticky","semantic"]),Pe=new Set(["visual","screen-reader","sonified","agent"]);function Ve(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function We(e,t,n){("number"!=typeof n||!Number.isFinite(n)||1>n||n>5)&&e.push(t+" must be a number in [1, 5]")}function Ne(e){const t=[];if(!Ve(e))return{valid:!1,errors:["capability must be an object"]};"string"==typeof e.component&&0!==e.component.length||t.push("component is required and must be a non-empty string");const n=e.rubric;if(Ve(n)?(We(t,"rubric.familiarity",n.familiarity),We(t,"rubric.accuracy",n.accuracy),We(t,"rubric.precision",n.precision)):t.push("rubric is required and must be an object"),void 0!==e.intentScores)if(Ve(e.intentScores))for(const[n,o]of Object.entries(e.intentScores))("number"!=typeof o||0>o||o>5)&&t.push(`intentScores.${n} must be a number in [0, 5]`);else t.push("intentScores must be an object");return void 0!==e.variants&&(Array.isArray(e.variants)?e.variants.forEach((e,n)=>{Ve(e)?("string"!=typeof e.key&&t.push(`variants[${n}].key is required`),"string"!=typeof e.label&&t.push(`variants[${n}].label is required`)):t.push(`variants[${n}] must be an object`)}):t.push("variants must be an array")),{valid:0===t.length,errors:t}}function Fe(e){const t=[];if(!Ve(e))return{valid:!1,errors:["audience profile must be an object"]};if(void 0!==e.familiarity)if(Ve(e.familiarity))for(const[n,o]of Object.entries(e.familiarity))("number"!=typeof o||1>o||o>5)&&t.push(`familiarity.${n} must be a number in [1, 5]`);else t.push("familiarity must be an object");if(void 0!==e.targets)if(Ve(e.targets))for(const[n,o]of Object.entries(e.targets))!Ve(o)||"increase"!==o.direction&&"decrease"!==o.direction?t.push(`targets.${n}.direction must be "increase" or "decrease"`):void 0!==o.weight&&("number"!=typeof o.weight||1>o.weight||o.weight>3)&&t.push(`targets.${n}.weight must be a number in [1, 3]`);else t.push("targets must be an object");return void 0===e.exposureLevel||[0,1,2].includes(e.exposureLevel)||t.push("exposureLevel must be 0, 1, or 2"),void 0===e.receptionModality||Pe.has(e.receptionModality)||t.push("receptionModality must be one of "+[...Pe].join(", ")),{valid:0===t.length,errors:t}}function De(e){const t=[];if(!Ve(e))return{valid:!1,errors:["annotation must be an object"]};const n=e.provenance;void 0!==n&&(Ve(n)?(void 0!==n.confidence&&("number"!=typeof n.confidence||0>n.confidence||n.confidence>1)&&t.push("provenance.confidence must be a number in [0, 1]"),void 0===n.createdAt||"string"==typeof n.createdAt&&!Number.isNaN(Date.parse(n.createdAt))||t.push("provenance.createdAt must be an ISO 8601 date-time string")):t.push("provenance must be an object"));const o=e.lifecycle;return void 0!==o&&(Ve(o)?(void 0===o.freshness||Ce.has(o.freshness)||t.push("lifecycle.freshness must be one of "+[...Ce].join(", ")),void 0===o.status||Ie.has(o.status)||t.push("lifecycle.status must be one of "+[...Ie].join(", ")),void 0===o.anchor||ze.has(o.anchor)||t.push("lifecycle.anchor must be one of "+[...ze].join(", ")),void 0!==o.ttlHint&&"string"!=typeof o.ttlHint&&"number"!=typeof o.ttlHint&&t.push("lifecycle.ttlHint must be an ISO 8601 duration string or a number of milliseconds")):t.push("lifecycle must be an object")),{valid:0===t.length,errors:t}}"function"==typeof SuppressedError&&SuppressedError;const Ee={linear:"linear",monotoneX:"monotone-x",monotoneY:"monotone-y",step:"step",stepAfter:"step-after",stepBefore:"step-before",basis:"basis",cardinal:"cardinal",catmullRom:"catmull-rom"};function Te(e){return{field:e,type:"quantitative"}}function He(e){return{field:e,type:"nominal"}}function Ge(e){return"time"===e.xScaleType?"temporal":"quantitative"}function qe(e,t){return"string"==typeof t&&(e.axis={title:t}),e}function Ze(e){var t;const n=[],o=e.props||{},r={};let i;const a=e.component;switch(a){case"BarChart":case"StackedBarChart":case"GroupedBarChart":{i="bar";const e="horizontal"===o.orientation,t=qe(He(o.categoryAccessor),o.categoryLabel),s=qe(Te(o.valueAccessor),o.valueLabel);e?(r.y=t,r.x=s):(r.x=t,r.y=s),"StackedBarChart"===a&&o.stackBy?r.color=He(o.stackBy):"GroupedBarChart"===a&&o.groupBy&&(r.color=He(o.groupBy),n.push('GroupedBarChart maps groupBy to color; Vega-Lite expresses grouping via "xOffset". Adjust if exact grouped layout is required.'));break}case"LineChart":i=o.curve||o.showPoints?{type:"line"}:"line","object"==typeof i&&(o.curve&&Ee[o.curve]&&(i.interpolate=Ee[o.curve]),o.showPoints&&(i.point=!0)),r.x=qe({field:o.xAccessor,type:Ge(o)},o.xLabel),r.y=qe(Te(o.yAccessor),o.yLabel),o.lineBy?r.color=He(o.lineBy):o.colorBy&&(r.color=He(o.colorBy));break;case"AreaChart":case"StackedAreaChart":i=o.curve?{type:"area"}:"area","object"==typeof i&&o.curve&&Ee[o.curve]&&(i.interpolate=Ee[o.curve]),"object"==typeof i&&void 0!==o.areaOpacity&&(i.opacity=o.areaOpacity),r.x=qe({field:o.xAccessor,type:Ge(o)},o.xLabel),r.y=qe(Te(o.yAccessor),o.yLabel),"StackedAreaChart"===a&&o.areaBy&&(r.color=He(o.areaBy));break;case"Scatterplot":case"BubbleChart":i="point",r.x=qe(Te(o.xAccessor),o.xLabel),r.y=qe(Te(o.yAccessor),o.yLabel),o.colorBy&&(r.color=He(o.colorBy)),"BubbleChart"===a&&o.sizeBy&&(r.size=Te(o.sizeBy),Array.isArray(o.sizeRange)&&(r.size.scale={range:o.sizeRange}));break;case"Heatmap":i="rect",r.x=qe(He(o.xAccessor),o.xLabel),r.y=qe(He(o.yAccessor),o.yLabel),o.valueAccessor&&(r.color=Te(o.valueAccessor));break;case"PieChart":case"DonutChart":i="DonutChart"===a?{type:"arc",innerRadius:null!==(t=o.innerRadius)&&void 0!==t?t:60}:"arc",o.valueAccessor&&(r.theta=Te(o.valueAccessor)),o.categoryAccessor&&(r.color=He(o.categoryAccessor));break;case"DotPlot":{i="tick";const e="horizontal"===o.orientation,t=qe(He(o.categoryAccessor),o.categoryLabel),n=qe(Te(o.valueAccessor),o.valueLabel);e?(r.y=t,r.x=n):(r.x=t,r.y=n);break}case"Histogram":i="bar",o.valueAccessor&&(r.x=qe(Te(o.valueAccessor),o.valueLabel),r.x.bin=!o.bins||{maxbins:o.bins},r.y={aggregate:"count",type:"quantitative"}),o.categoryAccessor&&(r.color=He(o.categoryAccessor));break;default:n.push(`Component "${a}" has no Vega-Lite single-view equivalent. Emitting a point mark as a placeholder; the data and any IDID metadata are preserved.`),i="point",o.xAccessor&&(r.x=Te(o.xAccessor)),o.yAccessor&&(r.y=Te(o.yAccessor))}o.colorScheme&&r.color&&(r.color.scale=Object.assign(Object.assign({},r.color.scale||{}),{scheme:o.colorScheme}));const s={mark:i};return Array.isArray(o.data)&&(s.data={values:o.data}),Object.keys(r).length>0&&(s.encoding=r),"string"==typeof o.title&&(s.title=o.title),"number"==typeof o.width&&(s.width=o.width),"number"==typeof o.height&&(s.height=o.height),n.length>0&&(s.warnings=n),s}function Ue(e,t){const n={specVersion:Be};return t.capability&&(n.capability=t.capability),t.audience&&(n.audience=t.audience),Object.assign(Object.assign({},e),{usermeta:Object.assign(Object.assign({},e.usermeta),{idid:n})})}function Ye(e){const t=e.usermeta;return null==t?void 0:t.idid}function Xe(e,t){const n=Ye(e),o=Object.assign(Object.assign({specVersion:Be},n),{annotations:[...t]}),r=t.map(Je).filter(e=>null!==e).map(e=>Object.assign(Object.assign({},e),{usermeta:{idid:{role:"annotation-layer"}}}));if(0===r.length)return Object.assign(Object.assign({},e),{usermeta:Object.assign(Object.assign({},e.usermeta),{idid:o})});const i=Array.isArray(e.layer)?e.layer:[Qe(e)],a=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&0>t.indexOf(o)&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);o.length>r;r++)0>t.indexOf(o[r])&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n}(e,["mark","encoding","data","transform","usermeta"]);return Object.assign(Object.assign({},a),{usermeta:Object.assign(Object.assign({},e.usermeta),{idid:o}),layer:[...i,...r]})}function Ke(e){var t;const n=null===(t=Ye(e))||void 0===t?void 0:t.annotations;return Array.isArray(n)?n:[]}function Qe(e){const{mark:t,encoding:n,data:o,transform:r}=e,i={};return t&&(i.mark=t),n&&(i.encoding=n),o&&(i.data=o),r&&(i.transform=r),i}function Je(e){const t=e;switch(t.type){case"y-threshold":return{mark:"rule",encoding:{y:{datum:t.value}}};case"x-threshold":return{mark:"rule",encoding:{x:{datum:t.value}}};case"callout":case"label":case"text":return"string"==typeof t.label?{mark:{type:"text",text:t.label}}:null;default:return null}}const et={category10:"category10",tableau10:"category10",observable10:"category10",accent:"accent",dark2:"dark2",paired:"paired",pastel1:"pastel1",pastel2:"pastel2",set1:"set1",set2:"set2",set3:"set3"},tt={linear:"linear","monotone-x":"monotoneX","monotone-y":"monotoneY",step:"step","step-after":"stepAfter","step-before":"stepBefore",basis:"basis",cardinal:"cardinal","catmull-rom":"catmullRom",natural:"natural"},nt=new Set(["frame","gridx","gridy","gridfx","gridfy","axisx","axisy","axisfx","axisfy","rulex","ruley","tip","crosshair","pointer","hexgrid","text"]);function ot(e){return"string"==typeof e?e:void 0}function rt(e,t){if(!Array.isArray(e)||!t)return!1;for(const n of e){const e=null==n?void 0:n[t];if(null!=e)return!("number"==typeof e||e instanceof Date)&&"string"==typeof e&&Number.isNaN(Date.parse(e))}return!1}function it(e,t,n){(function(e){return"function"==typeof e})(t)&&e.push(`The "${n}" channel is a function accessor, which can't be serialized to a config. Pass a field name (string) instead, or pre-derive the field on your data.`)}function at(e){var t,n,o,r,i;const a=[];(e.facet||e.fx||e.fy)&&a.push('Faceted plots ("facet"/"fx"/"fy") are not supported. Use Semiotic\'s LinkedCharts or render multiple charts.');const s=(Array.isArray(e.marks)?e.marks:[]).filter(e=>e&&!nt.has(e.type.toLowerCase()));if(0===s.length)return a.push("No translatable data mark found in the Plot spec. Defaulting to an empty Scatterplot."),dt("Scatterplot",{},a);s.length>1&&a.push(`Multiple data marks (${s.map(e=>e.type).join(", ")}); only the first is translated. Layered multi-mark plots aren't supported.`);const l=s[0],c=l.options||{},u=l.data||e.data,d={};"number"==typeof e.width&&(d.width=e.width),"number"==typeof e.height&&(d.height=e.height),"string"==typeof e.title&&(d.title=e.title),(null===(t=e.x)||void 0===t?void 0:t.label)&&(d.xLabel=e.x.label),(null===(n=e.y)||void 0===n?void 0:n.label)&&(d.yLabel=e.y.label);const p=(null===(o=e.color)||void 0===o?void 0:o.scheme)?et[e.color.scheme]:void 0;it(a,c.x,"x"),it(a,c.y,"y"),it(a,c.fill,"fill"),it(a,c.stroke,"stroke"),it(a,c.r,"r");const h=ot(c.x),y=ot(c.y),f=ot(c.fill),m=ot(c.stroke),g=f||m,v=l.type.toLowerCase();let b;switch(v){case"line":case"liney":case"linex":{b="LineChart",h&&(d.xAccessor=h),y?d.yAccessor=y:a.push(l.type+" has no explicit y field; provide options.y."),rt(u,h)&&a.push(`The x field "${h}" looks categorical; LineChart uses a continuous x scale, so a categorical x won't position (the line won't draw). Use a numeric/time x, or a bar chart for categories.`),"liney"!==v||h||a.push("lineY without an explicit x plots against the row index, which Semiotic doesn't infer. Provide options.x.");const e=m||f;e&&(d.lineBy=e),ct(c,d),ut(d,u,{colorScheme:p});break}case"bary":case"bar":b=g?"StackedBarChart":"BarChart",h&&(d.categoryAccessor=h),y&&(d.valueAccessor=y),g&&(d.stackBy=g),ut(d,u,{colorScheme:p});break;case"barx":b=g?"StackedBarChart":"BarChart",d.orientation="horizontal",y&&(d.categoryAccessor=y),h&&(d.valueAccessor=h),g&&(d.stackBy=g),ut(d,u,{colorScheme:p});break;case"dot":case"doty":case"dotx":case"circle":{const e=c.r;"string"==typeof e?(b="BubbleChart",d.sizeBy=e):(b="Scatterplot","number"==typeof e&&(d.pointRadius=e)),h&&(d.xAccessor=h),y&&(d.yAccessor=y),ut(d,u,{colorBy:g,colorScheme:p});break}case"area":case"areay":case"areax":b=f&&f!==y?"StackedAreaChart":"AreaChart",h&&(d.xAccessor=h),y&&(d.yAccessor=y),rt(u,h)&&a.push(`The x field "${h}" looks categorical; ${b} uses a continuous x scale, so a categorical x won't position. Use a numeric/time x.`),"StackedAreaChart"===b&&f&&(d.areaBy=f),ct(c,d),ut(d,u,{colorBy:"StackedAreaChart"===b?void 0:g,colorScheme:p});break;case"recty":case"rectx":case"rect":{b="Histogram";const e="rectx"===v?h:y||h;e&&(d.valueAccessor=e),g&&(d.categoryAccessor=g),ut(d,u,{colorScheme:p});break}case"cell":case"celly":case"cellx":b="Heatmap",h&&(d.xAccessor=h),y&&(d.yAccessor=y),g&&(d.valueAccessor=g),ut(d,u);break;case"tick":case"tickx":case"ticky":b="DotPlot","tickx"===v?(y&&(d.categoryAccessor=y),h&&(d.valueAccessor=h),d.orientation="horizontal"):(h&&(d.categoryAccessor=h),y&&(d.valueAccessor=y)),ut(d,u,{colorBy:g,colorScheme:p});break;default:a.push(`Plot mark "${l.type}" has no faithful Semiotic equivalent in this adapter. Defaulting to a Scatterplot of x/y; verify the result or file for support.`),b="Scatterplot",h&&(d.xAccessor=h),y&&(d.yAccessor=y),ut(d,u,{colorBy:g,colorScheme:p})}if(st.has(b)){const t=lt(null===(r=e.x)||void 0===r?void 0:r.type),n=lt(null===(i=e.y)||void 0===i?void 0:i.type);t&&(d.xScaleType=t),n&&(d.yScaleType=n)}return dt(b,d,a)}const st=new Set(["LineChart","AreaChart","StackedAreaChart","Scatterplot","BubbleChart"]);function lt(e){return"time"===e||"utc"===e?"time":"log"===e?"log":void 0}function ct(e,t){e.curve&&tt[e.curve]&&(t.curve=tt[e.curve])}function ut(e,t,n={}){Array.isArray(t)&&(e.data=t),n.colorBy&&(e.colorBy=n.colorBy),n.colorScheme&&(e.colorScheme=n.colorScheme)}function dt(e,t,n){const o={component:e,props:t,version:"1",createdAt:(new Date).toISOString()};if(n.length>0){o.warnings=n;for(const e of n)console.warn("[semiotic/fromObservablePlot] "+e)}return o}const pt=new Set(["sequencediagram","classdiagram","statediagram","statediagram-v2","erdiagram","gantt","pie","journey","gitgraph","mindmap","timeline","quadrantchart","requirementdiagram","c4context","sankey-beta","block-beta","xychart-beta"]),ht=new Set(["TD","TB","BT","LR","RL"]),yt=/(<-->|-\.->|-\.-|-->|--x|--o|---|==>|===)/,ft=[["((","))","circle"],["([","])","stadium"],["[[","]]","subroutine"],["[(",")]","cylinder"],["{{","}}","hexagon"],["[","]","rect"],["(",")","round"],["{","}","diamond"],[">","]","flag"]];function mt(e){const t=e.trim();return t.length>=2&&('"'===t[0]&&t.endsWith('"')||"'"===t[0]&&t.endsWith("'"))?t.slice(1,-1):t}function gt(e){const t=e.trim();if(!t)return null;const n=t.match(/^([A-Za-z0-9_][\w-]*)/);if(!n)return null;const o=n[1],r=t.slice(o.length).trim();if(!r)return{id:o};for(const[e,t,n]of ft)if(r.startsWith(e)&&r.endsWith(t)&&r.length>=e.length+t.length)return{id:o,label:mt(r.slice(e.length,r.length-t.length)),shape:n};return{id:o}}function vt(e){var t;const n=[],o=()=>Object.assign({kind:"flowchart",direction:"TD",nodes:[],edges:[]},n.length?{warnings:n}:{});if("string"!=typeof e||!e.trim())return n.push("Empty Mermaid input."),o();const r=e.split("\n").map(e=>e.replace(/%%.*$/,"").trim()).filter(e=>e.length>0);if(0===r.length)return n.push("No content after stripping comments."),o();const i=r[0],a=i.split(/\s+/)[0].toLowerCase();if("graph"!==a&&"flowchart"!==a&&(pt.has(a)?n.push(`Mermaid "${i.split(/\s+/)[0]}" diagrams aren't supported — only graph/flowchart compile to a Semiotic graph. Other diagram types are declined rather than mistranslated.`):n.push(`Expected a "graph" or "flowchart" header; got "${i}". Treating remaining lines as flowchart edges.`),pt.has(a)))return o();let s="TD";const l=null===(t=i.split(/\s+/)[1])||void 0===t?void 0:t.toUpperCase();l&&ht.has(l)&&(s=l);const c="graph"===a||"flowchart"===a?1:0,u=new Map,d=[];let p=0;const h=e=>{var t,n;const o=u.get(e.id);o?e.label&&o.label===o.id&&(o.label=e.label,e.shape&&(o.shape=e.shape)):u.set(e.id,{id:e.id,label:null!==(t=e.label)&&void 0!==t?t:e.id,shape:null!==(n=e.shape)&&void 0!==n?n:"rect",layer:0,row:p++})},y=e=>e.replace(/--\s+([^->|]+?)\s+-->/g,"--\x3e|$1|").replace(/-\.\s+([^->|]+?)\s+\.->/g,"-.->|$1|").replace(/==\s+([^=>|]+?)\s+==>/g,"==>|$1|");for(let e=c;r.length>e;e++){const t=y(r[e]);if(/^(subgraph|end|classDef|class|style|click|linkStyle|direction)\b/.test(t)){/^subgraph\b/.test(t)&&n.push("`subgraph` grouping is flattened; nodes are kept, the grouping is dropped.");continue}if(!yt.test(t)){const e=gt(t);e&&h(e);continue}const o=t.split(yt);let i=null;for(let e=0;o.length>e;e+=2){let t,r=o[e].trim();const a=r.match(/^\|([^|]*)\|\s*(.*)$/);a&&(t=mt(a[1]),r=a[2].trim()),r.includes("&")&&(n.push('Multiple nodes joined with "&" — only the first is linked in this alpha.'),r=r.split("&")[0].trim());const s=gt(r);s?(h(s),i&&d.push(Object.assign({source:i.id,target:s.id},t?{label:t}:{})),i=s):i=null}}return 0===u.size?(n.push("No nodes found."),o()):(function(e,t,n){const o=new Map,r=new Map;for(const t of e.keys())o.set(t,[]),r.set(t,0);for(const n of t)n.source!==n.target&&e.has(n.source)&&e.has(n.target)&&(o.get(n.source).push(n.target),r.set(n.target,(r.get(n.target)||0)+1));const i=[];for(const[e,t]of r)0===t&&i.push(e);let a=0;for(;i.length>0;){const t=i.shift();a++;const n=e.get(t).layer;for(const a of o.get(t)){const t=e.get(a);n+1>t.layer&&(t.layer=n+1);const o=(r.get(a)||0)-1;r.set(a,o),0===o&&i.push(a)}}e.size>a&&n.push("Graph contains a cycle; layering is best-effort (not a strict DAG).");const s=new Map;for(const t of e.values()){const e=s.get(t.layer)||[];e.push(t),s.set(t.layer,e)}for(const e of s.values())e.sort((e,t)=>e.row-t.row),e.forEach((e,t)=>{e.row=t})}(u,d,n),Object.assign({kind:"flowchart",direction:s,nodes:[...u.values()],edges:d},n.length?{warnings:n}:{}))}export{ve as EXPERIMENTAL_GOFISH_ADAPTER_NAME,Be as IDID_SPEC_VERSION,Le as unstable_BUILTIN_INTENT_IDS,Ue as unstable_attachIDID,Xe as unstable_attachIDIDAnnotations,ke as unstable_fromGofishIR,vt as unstable_fromMermaid,at as unstable_fromObservablePlot,_e as unstable_gofishBobaIR,$e as unstable_gofishBottleIR,Ae as unstable_gofishFlowerIR,Re as unstable_gofishIRExamples,je as unstable_gofishPolarRibbonIR,Oe as unstable_gofishPythonMemoryIR,Se as unstable_gofishTitanicCircleTreemapIR,Ye as unstable_readIDID,Ke as unstable_readIDIDAnnotations,$ as unstable_registerGofishLambda,Ze as unstable_toVegaLite,j as unstable_unregisterGofishLambda,De as unstable_validatePortableAnnotation,Fe as unstable_validatePortableAudienceProfile,Ne as unstable_validatePortableCapability};
|
|
@@ -13,6 +13,8 @@ export { CirclePack } from "./components/charts/network/CirclePack";
|
|
|
13
13
|
export { OrbitDiagram } from "./components/charts/network/OrbitDiagram";
|
|
14
14
|
export { ProcessSankey } from "./components/charts/network/ProcessSankey";
|
|
15
15
|
export { NetworkCustomChart } from "./components/charts/custom/NetworkCustomChart";
|
|
16
|
+
export { useCustomLayoutSelection } from "./components/stream/customLayoutSelection";
|
|
17
|
+
export type { CustomLayoutSelection } from "./components/stream/customLayoutSelection";
|
|
16
18
|
export type { StreamNetworkFrameProps, StreamNetworkFrameHandle, NetworkChartType, NetworkSceneNode, NetworkSceneEdge, NetworkLabel, ThresholdAlertConfig } from "./components/stream/networkTypes";
|
|
17
19
|
export type { ForceDirectedGraphProps } from "./components/charts/network/ForceDirectedGraph";
|
|
18
20
|
export type { SankeyDiagramProps } from "./components/charts/network/SankeyDiagram";
|
|
@@ -23,6 +25,6 @@ export type { TreemapProps } from "./components/charts/network/Treemap";
|
|
|
23
25
|
export type { CirclePackProps } from "./components/charts/network/CirclePack";
|
|
24
26
|
export type { OrbitDiagramProps } from "./components/charts/network/OrbitDiagram";
|
|
25
27
|
export type { NetworkCustomChartProps } from "./components/charts/custom/NetworkCustomChart";
|
|
26
|
-
export type { NetworkCustomLayout, NetworkLayoutContext, NetworkLayoutResult, } from "./components/stream/networkCustomLayout";
|
|
28
|
+
export type { NetworkCustomLayout, NetworkLayoutContext, NetworkLayoutResult, NetworkHtmlMark, } from "./components/stream/networkCustomLayout";
|
|
27
29
|
export { validateProcessSankey, formatProcessSankeyIssue, } from "./components/charts/network/processSankey/algorithm";
|
|
28
30
|
export type { ProcessSankeyNode as ProcessSankeyValidatorNode, ProcessSankeyEdge as ProcessSankeyValidatorEdge, ProcessSankeyIssue, } from "./components/charts/network/processSankey/algorithm";
|
|
@@ -21,6 +21,8 @@ export { RidgelinePlot } from "./components/charts/ordinal/RidgelinePlot";
|
|
|
21
21
|
export { FunnelChart } from "./components/charts/ordinal/FunnelChart";
|
|
22
22
|
export { LikertChart } from "./components/charts/ordinal/LikertChart";
|
|
23
23
|
export { OrdinalCustomChart } from "./components/charts/custom/OrdinalCustomChart";
|
|
24
|
+
export { useCustomLayoutSelection } from "./components/stream/customLayoutSelection";
|
|
25
|
+
export type { CustomLayoutSelection } from "./components/stream/customLayoutSelection";
|
|
24
26
|
export { createHatchPattern } from "./components/charts/shared/hatchPattern";
|
|
25
27
|
export type { HatchPatternOptions } from "./components/charts/shared/hatchPattern";
|
|
26
28
|
export type { StreamOrdinalFrameProps, StreamOrdinalFrameHandle, OrdinalChartType, OrdinalScales, OrdinalSceneNode } from "./components/stream/ordinalTypes";
|
|
@@ -6,12 +6,20 @@ import StreamXYFrame from "./components/stream/StreamXYFrame";
|
|
|
6
6
|
import StreamNetworkFrame from "./components/stream/StreamNetworkFrame";
|
|
7
7
|
import { RingBuffer } from "./components/realtime/RingBuffer";
|
|
8
8
|
import { IncrementalExtent } from "./components/realtime/IncrementalExtent";
|
|
9
|
+
import { RunningStats } from "./components/realtime/RunningStats";
|
|
10
|
+
import { WindowAccumulator, statValue, bandBounds } from "./components/realtime/WindowAccumulator";
|
|
11
|
+
import { parseWindowDuration } from "./components/realtime/parseWindowDuration";
|
|
12
|
+
import { ReorderBuffer } from "./components/realtime/ReorderBuffer";
|
|
9
13
|
import { RealtimeLineChart } from "./components/charts/realtime/RealtimeLineChart";
|
|
10
14
|
import { RealtimeHistogram, TemporalHistogram } from "./components/charts/realtime/RealtimeHistogram";
|
|
11
15
|
import { RealtimeSwarmChart } from "./components/charts/realtime/RealtimeSwarmChart";
|
|
12
16
|
import { RealtimeWaterfallChart } from "./components/charts/realtime/RealtimeWaterfallChart";
|
|
13
17
|
import { RealtimeHeatmap } from "./components/charts/realtime/RealtimeHeatmap";
|
|
14
|
-
export { StreamXYFrame, StreamNetworkFrame, RingBuffer, IncrementalExtent, RealtimeLineChart, RealtimeHistogram, TemporalHistogram, RealtimeSwarmChart, RealtimeWaterfallChart, RealtimeHeatmap };
|
|
18
|
+
export { StreamXYFrame, StreamNetworkFrame, RingBuffer, IncrementalExtent, RunningStats, WindowAccumulator, statValue, bandBounds, parseWindowDuration, ReorderBuffer, RealtimeLineChart, RealtimeHistogram, TemporalHistogram, RealtimeSwarmChart, RealtimeWaterfallChart, RealtimeHeatmap };
|
|
19
|
+
export type { WindowType, AggregateStat, AggregateBand, WindowAccumulatorConfig, AggregatedWindow, } from "./components/realtime/WindowAccumulator";
|
|
20
|
+
export type { AggregateConfig } from "./components/charts/realtime/aggregate";
|
|
21
|
+
export type { LatePolicy, ReorderBufferConfig, ReorderResult, } from "./components/realtime/ReorderBuffer";
|
|
22
|
+
export type { EventTimeConfig } from "./components/charts/realtime/eventTime";
|
|
15
23
|
export type { RealtimeLineChartProps } from "./components/charts/realtime/RealtimeLineChart";
|
|
16
24
|
export type { RealtimeHistogramProps, TemporalHistogramProps } from "./components/charts/realtime/RealtimeHistogram";
|
|
17
25
|
export type { RealtimeSwarmChartProps } from "./components/charts/realtime/RealtimeSwarmChart";
|