semiotic 3.8.3 → 3.8.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.
Files changed (215) hide show
  1. package/CLAUDE.md +13 -10
  2. package/README.md +52 -45
  3. package/ai/componentMetadata.cjs +1 -1
  4. package/ai/dist/mcp-server.js +4 -2
  5. package/ai/examples.md +168 -1
  6. package/ai/schema.json +3756 -327
  7. package/ai/surface-manifest.json +6 -4
  8. package/ai/system-prompt.md +1 -1
  9. package/dist/chunk-chartContainerDataAudit-74TLKIP6.module.min.js +2 -0
  10. package/dist/chunk-chunk-2JGJ5GUG.module.min.js +0 -1
  11. package/dist/chunk-chunk-4AANPFOX.module.min.js +2 -0
  12. package/dist/{chunk-chunk-JNCHKRIR.module.min.js → chunk-chunk-5I3UZV4Q.module.min.js} +1 -1
  13. package/dist/chunk-chunk-74CCPVXB.module.min.js +1 -0
  14. package/dist/{chunk-chunk-VVCA3DB7.module.min.js → chunk-chunk-7ALTGHK6.module.min.js} +1 -1
  15. package/dist/chunk-chunk-ACLDBMRH.module.min.js +2 -0
  16. package/dist/chunk-chunk-AVBI6GDT.module.min.js +1 -0
  17. package/dist/{chunk-chunk-XQYVEKEJ.module.min.js → chunk-chunk-BANTPINB.module.min.js} +1 -1
  18. package/dist/chunk-chunk-C4YA6TDR.module.min.js +1 -0
  19. package/dist/chunk-chunk-C57LR3YG.module.min.js +1 -0
  20. package/dist/chunk-chunk-CKMD5NV3.module.min.js +2 -0
  21. package/dist/chunk-chunk-CO5KQMGH.module.min.js +1 -0
  22. package/dist/chunk-chunk-CWQ5YIHX.module.min.js +2 -0
  23. package/dist/chunk-chunk-E6TXX6MI.module.min.js +1 -0
  24. package/dist/{chunk-chunk-7FW6EGLP.module.min.js → chunk-chunk-I36PJ4OC.module.min.js} +1 -1
  25. package/dist/chunk-chunk-IY7RYD4S.module.min.js +1 -0
  26. package/dist/chunk-chunk-K3DMEW22.module.min.js +1 -0
  27. package/dist/chunk-chunk-KT2VAZMZ.module.min.js +1 -0
  28. package/dist/{chunk-chunk-AZJUDQRM.module.min.js → chunk-chunk-L6EA5V3G.module.min.js} +1 -1
  29. package/dist/{chunk-chunk-SANERMIZ.module.min.js → chunk-chunk-LJLS6DY7.module.min.js} +1 -1
  30. package/dist/chunk-chunk-LJPCLYSC.module.min.js +2 -0
  31. package/dist/chunk-chunk-LRIFN2HK.module.min.js +1 -0
  32. package/dist/chunk-chunk-N5DDKCCF.module.min.js +1 -0
  33. package/dist/chunk-chunk-NEVE562N.module.min.js +1 -0
  34. package/dist/chunk-chunk-NLO44TOS.module.min.js +2 -0
  35. package/dist/{chunk-chunk-FYY2ACNJ.module.min.js → chunk-chunk-PRDGLMJT.module.min.js} +1 -1
  36. package/dist/chunk-chunk-PZJ2SBLL.module.min.js +2 -0
  37. package/dist/chunk-chunk-QUJ6TTLY.module.min.js +1 -0
  38. package/dist/chunk-chunk-RBIDBUT4.module.min.js +2 -0
  39. package/dist/chunk-chunk-RFLAG356.module.min.js +1 -0
  40. package/dist/chunk-chunk-RPU4IZAV.module.min.js +2 -0
  41. package/dist/chunk-chunk-SKMBCFIL.module.min.js +2 -0
  42. package/dist/chunk-chunk-TAE7W424.module.min.js +2 -0
  43. package/dist/{chunk-chunk-OQTLSTGI.module.min.js → chunk-chunk-TMWIZL3K.module.min.js} +1 -1
  44. package/dist/chunk-chunk-TUBMTZMU.module.min.js +2 -0
  45. package/dist/chunk-chunk-UFFEXJQY.module.min.js +1 -0
  46. package/dist/chunk-chunk-XSCHTS4D.module.min.js +2 -0
  47. package/dist/chunk-chunk-XXWSHGPL.module.min.js +2 -0
  48. package/dist/chunk-chunk-ZOAQDIJO.module.min.js +1 -0
  49. package/dist/chunk-chunk-ZXIXAPRE.module.min.js +2 -0
  50. package/dist/chunk-minimapBrushOverlay-JU57U7NM.module.min.js +2 -0
  51. package/dist/chunk-scatterplotMatrixBrushOverlay-SDIZSN66.module.min.js +2 -0
  52. package/dist/chunk-statisticalOverlays-QGDLRUHX.module.min.js +1 -0
  53. package/dist/chunk-statisticalOverlays-T77OKLDY.module.min.js +1 -0
  54. package/dist/components/ChartContainer.d.ts +12 -2
  55. package/dist/components/ai/chartCapabilities.d.ts +2 -1
  56. package/dist/components/ai/chartCapabilityTypes.d.ts +19 -0
  57. package/dist/components/chartContainerDataAudit.d.ts +10 -0
  58. package/dist/components/charts/geo/ChoroplethMap.d.ts +2 -0
  59. package/dist/components/charts/geo/DistanceCartogram.d.ts +35 -5
  60. package/dist/components/charts/geo/FlowMap.d.ts +4 -0
  61. package/dist/components/charts/geo/ProportionalSymbolMap.d.ts +3 -1
  62. package/dist/components/charts/index.d.ts +1 -0
  63. package/dist/components/charts/network/ForceDirectedGraph.d.ts +36 -1
  64. package/dist/components/charts/physics/CollisionSwarmChart.d.ts +6 -1
  65. package/dist/components/charts/physics/CrucibleChart.capability.d.ts +8 -0
  66. package/dist/components/charts/physics/CrucibleChart.d.ts +63 -0
  67. package/dist/components/charts/physics/GaltonBoardChart.d.ts +6 -1
  68. package/dist/components/charts/physics/crucibleBodyRenderers.d.ts +27 -0
  69. package/dist/components/charts/physics/crucibleChartProps.d.ts +90 -0
  70. package/dist/components/charts/physics/crucibleChrome.d.ts +47 -0
  71. package/dist/components/charts/physics/crucibleController.d.ts +59 -0
  72. package/dist/components/charts/physics/crucibleEffects.d.ts +30 -0
  73. package/dist/components/charts/physics/cruciblePhysics.d.ts +54 -0
  74. package/dist/components/charts/physics/crucibleProgram.d.ts +38 -0
  75. package/dist/components/charts/physics/crucibleTypes.d.ts +415 -0
  76. package/dist/components/charts/physics/gauntletChartProps.d.ts +7 -1
  77. package/dist/components/charts/physics/gauntletChrome.d.ts +2 -1
  78. package/dist/components/charts/physics/gauntletPhysics.d.ts +19 -4
  79. package/dist/components/charts/physics/gauntletRuntime.d.ts +3 -0
  80. package/dist/components/charts/physics/physicsHocUtils.d.ts +12 -0
  81. package/dist/components/charts/shared/chartMode.d.ts +8 -0
  82. package/dist/components/charts/shared/chartSpecCore.d.ts +10 -2
  83. package/dist/components/charts/shared/crucibleWireSchema.d.ts +5 -0
  84. package/dist/components/charts/shared/diagnoseTypes.d.ts +10 -0
  85. package/dist/components/charts/shared/hatchPattern.d.ts +8 -3
  86. package/dist/components/charts/shared/knownChartComponents.d.ts +1 -1
  87. package/dist/components/charts/shared/lineSeriesSsr.d.ts +55 -0
  88. package/dist/components/charts/shared/types.d.ts +2 -2
  89. package/dist/components/charts/shared/validateProps.d.ts +1 -1
  90. package/dist/components/charts/xy/AreaChart.d.ts +10 -0
  91. package/dist/components/charts/xy/minimapBrushOverlay.d.ts +17 -0
  92. package/dist/components/charts/xy/minimapBrushOverlayLazy.d.ts +4 -0
  93. package/dist/components/charts/xy/scatterplotMatrixBrushOverlay.d.ts +8 -0
  94. package/dist/components/charts/xy/scatterplotMatrixBrushOverlayLazy.d.ts +3 -0
  95. package/dist/components/data/auditData.d.ts +51 -0
  96. package/dist/components/data/dataAuditPresentation.d.ts +18 -0
  97. package/dist/components/data/dataAuditSources.d.ts +9 -0
  98. package/dist/components/data/numericContracts.d.ts +59 -0
  99. package/dist/components/data/numericFieldProfiler.d.ts +23 -0
  100. package/dist/components/realtime/types.d.ts +5 -0
  101. package/dist/components/recipes/gridObservatory.d.ts +176 -0
  102. package/dist/components/recipes/netEnsembleLayout.d.ts +167 -0
  103. package/dist/components/recipes/netEnsembleOverlays.d.ts +20 -0
  104. package/dist/components/recipes/recipeChrome.d.ts +24 -0
  105. package/dist/components/recipes/sequenceLayout.d.ts +139 -0
  106. package/dist/components/recipes/wordTrails.d.ts +156 -0
  107. package/dist/components/recipes/wordTrailsProgressiveReveal.d.ts +42 -0
  108. package/dist/components/semiotic-ai-core.d.ts +3 -0
  109. package/dist/components/semiotic-ai-data-audit.d.ts +4 -0
  110. package/dist/components/semiotic-ai.d.ts +7 -5
  111. package/dist/components/semiotic-physics.d.ts +1 -0
  112. package/dist/components/semiotic-recipes-core.d.ts +10 -2
  113. package/dist/components/semiotic-utils-core.d.ts +3 -0
  114. package/dist/components/semiotic.d.ts +1 -1
  115. package/dist/components/server/renderEvidence.d.ts +27 -0
  116. package/dist/components/server/serverChartConfigs.d.ts +1 -0
  117. package/dist/components/server/serverChartConfigsPhysics.d.ts +9 -0
  118. package/dist/components/server/staticAnnotations.d.ts +15 -1
  119. package/dist/components/stream/GeoPipelineStore.d.ts +1 -0
  120. package/dist/components/stream/GeoSVGOverlay.d.ts +7 -0
  121. package/dist/components/stream/SceneToSVG.d.ts +6 -6
  122. package/dist/components/stream/SceneToSVGOrdinal.d.ts +12 -0
  123. package/dist/components/stream/geoCartogram.d.ts +7 -0
  124. package/dist/components/stream/geoTypes.d.ts +17 -2
  125. package/dist/components/stream/networkFrameHandleTypes.d.ts +4 -0
  126. package/dist/components/stream/networkFramePaint.d.ts +2 -0
  127. package/dist/components/stream/physics/PhysicsPipelineStore.d.ts +18 -2
  128. package/dist/components/stream/physics/PhysicsSettledSVG.d.ts +8 -0
  129. package/dist/components/stream/physics/physicsBodyCanvas.d.ts +7 -0
  130. package/dist/components/stream/physics/physicsPipelineEviction.d.ts +15 -0
  131. package/dist/components/stream/physics/physicsPipelineObservations.d.ts +1 -1
  132. package/dist/components/stream/physics/physicsPipelineQuiescence.d.ts +20 -0
  133. package/dist/components/stream/sceneToSVGShared.d.ts +30 -1
  134. package/dist/components/stream/types.d.ts +4 -0
  135. package/dist/components/stream/useHydration.d.ts +7 -1
  136. package/dist/components/stream/xySceneBuilders/candlestickScene.d.ts +1 -1
  137. package/dist/components/useChartContainerDataAudit.d.ts +7 -0
  138. package/dist/forceLayoutWorker.js +1 -1
  139. package/dist/geo.min.js +1 -1
  140. package/dist/geo.module.min.js +1 -1
  141. package/dist/network.min.js +1 -1
  142. package/dist/network.module.min.js +1 -1
  143. package/dist/ordinal.min.js +1 -1
  144. package/dist/ordinal.module.min.js +1 -1
  145. package/dist/physics.min.js +1 -1
  146. package/dist/physics.module.min.js +1 -1
  147. package/dist/physicsWorker.js +1 -1
  148. package/dist/realtime.min.js +1 -1
  149. package/dist/realtime.module.min.js +1 -1
  150. package/dist/rough.min.js +1 -1
  151. package/dist/rough.module.min.js +1 -1
  152. package/dist/semiotic-ai-core.d.ts +3 -0
  153. package/dist/semiotic-ai-core.min.js +1 -1
  154. package/dist/semiotic-ai-core.module.min.js +1 -1
  155. package/dist/semiotic-ai.d.ts +7 -5
  156. package/dist/semiotic-ai.min.js +1 -1
  157. package/dist/semiotic-ai.module.min.js +1 -1
  158. package/dist/semiotic-experimental.min.js +1 -1
  159. package/dist/semiotic-experimental.module.min.js +1 -1
  160. package/dist/semiotic-physics.d.ts +1 -0
  161. package/dist/semiotic-realtime-core.min.js +1 -1
  162. package/dist/semiotic-realtime-core.module.min.js +1 -1
  163. package/dist/semiotic-recipes-core.d.ts +10 -2
  164. package/dist/semiotic-recipes-core.min.js +1 -1
  165. package/dist/semiotic-recipes-core.module.min.js +1 -1
  166. package/dist/semiotic-recipes.min.js +1 -1
  167. package/dist/semiotic-recipes.module.min.js +1 -1
  168. package/dist/semiotic-server-edge.min.js +1 -1
  169. package/dist/semiotic-server-edge.module.min.js +1 -1
  170. package/dist/semiotic-server-node.min.js +1 -1
  171. package/dist/semiotic-server-node.module.min.js +1 -1
  172. package/dist/semiotic-utils-core.d.ts +3 -0
  173. package/dist/semiotic-utils-core.min.js +1 -1
  174. package/dist/semiotic-utils-core.module.min.js +1 -1
  175. package/dist/semiotic-utils.min.js +1 -1
  176. package/dist/semiotic-utils.module.min.js +1 -1
  177. package/dist/semiotic-value.module.min.js +1 -1
  178. package/dist/semiotic.d.ts +1 -1
  179. package/dist/semiotic.min.js +1 -1
  180. package/dist/semiotic.module.min.js +1 -1
  181. package/dist/server.min.js +1 -1
  182. package/dist/server.module.min.js +1 -1
  183. package/dist/xy.min.js +1 -1
  184. package/dist/xy.module.min.js +1 -1
  185. package/package.json +4 -3
  186. package/dist/chunk-chunk-255KDHW5.module.min.js +0 -1
  187. package/dist/chunk-chunk-2CCFBTQC.module.min.js +0 -2
  188. package/dist/chunk-chunk-2RXP3FS3.module.min.js +0 -1
  189. package/dist/chunk-chunk-2WVCH4PL.module.min.js +0 -1
  190. package/dist/chunk-chunk-4TMZXLCR.module.min.js +0 -1
  191. package/dist/chunk-chunk-5APBQXZA.module.min.js +0 -1
  192. package/dist/chunk-chunk-6HSGDMTA.module.min.js +0 -2
  193. package/dist/chunk-chunk-7OEOSCBP.module.min.js +0 -1
  194. package/dist/chunk-chunk-A63CTACR.module.min.js +0 -2
  195. package/dist/chunk-chunk-B6V35LMY.module.min.js +0 -2
  196. package/dist/chunk-chunk-BOSVL645.module.min.js +0 -2
  197. package/dist/chunk-chunk-CP3EN6KZ.module.min.js +0 -1
  198. package/dist/chunk-chunk-F25UA5HT.module.min.js +0 -1
  199. package/dist/chunk-chunk-FRIO6MCV.module.min.js +0 -1
  200. package/dist/chunk-chunk-GWSWSPXN.module.min.js +0 -1
  201. package/dist/chunk-chunk-I6C3KR5H.module.min.js +0 -2
  202. package/dist/chunk-chunk-IP2UE74X.module.min.js +0 -1
  203. package/dist/chunk-chunk-J3ELI22J.module.min.js +0 -1
  204. package/dist/chunk-chunk-J5RL6GXU.module.min.js +0 -2
  205. package/dist/chunk-chunk-L3H6DQCR.module.min.js +0 -2
  206. package/dist/chunk-chunk-M337NY6L.module.min.js +0 -1
  207. package/dist/chunk-chunk-M7VYYHCE.module.min.js +0 -2
  208. package/dist/chunk-chunk-MC35ILYP.module.min.js +0 -2
  209. package/dist/chunk-chunk-N72SWNBV.module.min.js +0 -1
  210. package/dist/chunk-chunk-OBQRFTIL.module.min.js +0 -2
  211. package/dist/chunk-chunk-QRIBHZYW.module.min.js +0 -1
  212. package/dist/chunk-chunk-SA3D43RA.module.min.js +0 -2
  213. package/dist/chunk-chunk-UHSZEB74.module.min.js +0 -1
  214. package/dist/chunk-chunk-Y6AXCRVO.module.min.js +0 -1
  215. package/dist/chunk-chunk-ZCNBUZPL.module.min.js +0 -2
@@ -1 +0,0 @@
1
- import{LayoutCache as t,createSafeDatum as e,datumFromFields as n,dimFor as o,forceLayout as r,generateTokens as i,groupBy as a,layoutTokenGrid as s,makeShade as c,normalizeTokenEncoding as l,readField as u,resolveAccessor as d,signatureKey as h,stableGlyphId as f,unwrapDatum as m}from"./chunk-chunk-2CXCXRB4.module.min.js";import{canUseForceWorker as p,runForceLayoutWorker as y,shouldUseForceWorker as g,useCustomLayoutSelection as x}from"./chunk-chunk-7OEOSCBP.module.min.js";import{collidersFromPlotBounds as b,collidersFromXScaleBins as w,sedimentHeightfield as M}from"./chunk-chunk-UHSZEB74.module.min.js";import{mulberry32 as v}from"./chunk-chunk-SIRIJ3DY.module.min.js";import{SYMBOL_SEQUENCE as k,symbolExtent as $,symbolPathString as A}from"./chunk-chunk-5RKXZQ2P.module.min.js";import{isNoteAnnotation as S}from"./chunk-chunk-U66USBWU.module.min.js";var z=t=>{const n=t.config,o=n.rows??10,r=n.columns??10,i=n.gutter??2,a=o*r;if(0>=o||0>=r||0>=a)return{nodes:[]};const{plot:s}=t.dimensions;if(0>=s.width||0>=s.height)return{nodes:[]};const c=(s.width-i*(r-1))/r,l=(s.height-i*(o-1))/o;if(0>=c||0>=l)return{nodes:[]};const u=(null==(d=n.categoryAccessor)?null:"function"==typeof d?d:t=>t[d])??(()=>"_default");var d;const h=function(t){return null==t?null:"function"==typeof t?t:e=>Number(e[t])}(n.valueAccessor)??(()=>1),f=new Map,m=[];for(const e of t.data){const t=u(e)+"",n=Number(h(e)),o=Number.isFinite(n)?Math.max(0,n):0;f.has(t)||m.push(t),f.set(t,(f.get(t)??0)+o)}const p=Array.from(f.values()).reduce((t,e)=>t+e,0);if(0>=p)return{nodes:[]};let y;if(n.categoryOrder&&n.categoryOrder.length>0){const t=new Set,e=[];for(const o of n.categoryOrder)f.has(o)&&!t.has(o)&&(t.add(o),e.push(o));y=[...e,...m.filter(e=>!t.has(e))]}else y=m;if(0===y.length)return{nodes:[]};const g=y.map(t=>({cat:t,exact:(f.get(t)??0)/p*a})).map(t=>({...t,count:Math.floor(t.exact)})),x=g.reduce((t,e)=>t+e.count,0),b=g.map((t,e)=>({i:e,rem:t.exact-t.count})).sort((t,e)=>e.rem-t.rem);for(let t=0;a-x>t;t++)g[b[t%b.length].i].count+=1;const w="string"==typeof n.categoryAccessor?n.categoryAccessor:"category",M="string"==typeof n.valueAccessor?n.valueAccessor:"value",v=(t,n,o)=>e(e=>{e("category",t),e("value",f.get(t)??0),e("share",(f.get(t)??0)/p),"category"!==w&&e(w,t),"value"!==M&&e(M,f.get(t)??0),e("cells",o),e("_waffleCategory",t),e("_waffleIndex",n)}),k=[];let $=0;for(const e of g){const n=t.resolveColor(e.cat);for(let t=0;e.count>t;t++)k.push({type:"rect",x:s.x+$%r*(c+i),y:s.y+(o-1-Math.floor($/r))*(l+i),w:c,h:l,style:{fill:n,stroke:"none"},datum:v(e.cat,$,e.count),group:e.cat,_transitionKey:`waffle-${e.cat}-${t}`}),$++}return{nodes:k}};function C(t,e,n){const o=Math.max(0,Math.floor(n?.minPerCategory??0)),r=t.reduce((t,e)=>t+Math.max(0,e.weight),0);if(0>=e||0>=r)return t.map(t=>({...t,exact:0,cells:0,remainder:0}));const i=t.map(t=>{const n=Math.max(0,t.weight)/r*e;return{...t,exact:n,cells:Math.max(o,Math.floor(n)),remainder:n-Math.floor(n)}});let a=i.reduce((t,e)=>t+e.cells,0);for(;a>e;){const t=i.filter(t=>t.cells>o).sort((t,e)=>e.cells-t.cells||t.remainder-e.remainder||t.key.localeCompare(e.key))[0];if(!t)break;t.cells--,a--}const s=[...i].sort((t,e)=>e.remainder-t.remainder||e.weight-t.weight||t.key.localeCompare(e.key));for(let t=0;e>a;t++)s[t%s.length].cells++,a++;return i}var I="#334155",L="#f8fafc",N="#cbd5e1",W={viewBox:[40,40],anchor:[.5,1],parts:[{d:"M8 3h24v34H8z",fill:"color"},{d:"M12 9h16v5H12zM12 18h16v5H12zM12 27h16v5H12z",fill:"accent"},{d:"M23.8 11.5a1.2 1.2 0 1 0 2.4 0a1.2 1.2 0 1 0-2.4 0M23.8 20.5a1.2 1.2 0 1 0 2.4 0a1.2 1.2 0 1 0-2.4 0M23.8 29.5a1.2 1.2 0 1 0 2.4 0a1.2 1.2 0 1 0-2.4 0",fill:"color"}]},E={viewBox:[40,40],anchor:[.5,.5],parts:[{d:"M10 8h20a2 2 0 0 1 2 2v20a2 2 0 0 1-2 2H10a2 2 0 0 1-2-2V10a2 2 0 0 1 2-2z",fill:"color"},{d:"M15 15h10v10H15z",fill:"accent"},{d:"M7 2v6M14 2v6M21 2v6M28 2v6M7 32v6M14 32v6M21 32v6M28 32v6M2 7h6M2 14h6M2 21h6M2 28h6M32 7h6M32 14h6M32 21h6M32 28h6",fill:"none",stroke:"color",strokeWidth:3}]},T={viewBox:[40,40],anchor:[.5,.5],parts:[{d:"M23 1L7 23h10l-3 16 19-25H22z",fill:"color"}]},R={viewBox:[48,40],anchor:[.5,.78],parts:[{d:"M7 12c0-4 3-7 7-7h20c4 0 7 3 7 7v15H7z",fill:"color"},{d:"M11 15h26v8H11z",fill:"accent",opacity:.9},{d:"M12 27h7v4h-7zM29 27h7v4h-7z",fill:"accent",opacity:.95},{d:"M12 31a4 4 0 1 0 8 0a4 4 0 1 0-8 0M28 31a4 4 0 1 0 8 0a4 4 0 1 0-8 0",fill:"color",stroke:"accent",strokeWidth:1.8},{d:"M5 13h4v8H5zM39 13h4v8h-4z",fill:"color"}]},P="M 9.12,3.34 C 8.28,3.29 7.44,3.40 6.64,3.69 4.17,3.63 1.97,5.37 0.91,7.51 -1.32,11.80 2.55,17.76 8.19,16.55 11.62,16.13 15.55,14.04 16.17,10.33 16.38,6.53 12.77,3.52 9.12,3.34 Z M 9.35,19.86 C 8.89,19.84 8.41,19.92 7.92,20.11 5.12,21.55 3.72,24.68 2.79,27.54 2.32,29.86 0.87,32.04 1.36,34.49 1.63,37.60 8.04,38.95 8.04,38.95 8.04,38.95 14.67,39.65 16.50,36.33 17.16,31.95 16.34,27.23 14.01,23.42 13.07,21.69 11.36,19.92 9.35,19.86 Z",F={viewBox:[18,40],anchor:[.5,1],parts:[{d:P,fill:"color",stroke:"color",strokeWidth:1.4}]},j={server:W,chip:E,bolt:T,bus:R,person:F},D="var(--semiotic-primary, #4e79a7)",O="var(--semiotic-border, #d1d5db)";function B(t){return"object"==typeof t&&null!==t&&"tokens"in t&&"encoding"in t}function H(t,e,n){return"function"==typeof t?t(e)??n:t??n}function Y(t,e){return"function"==typeof t?t(e):t}function V(t){return t.sample??t.value??t.index}var X=new Set(k);function q(t,e){return void 0!==e.datum?H(e.datum,t,null):t.datum??null}function G(t,e){return{fill:!1!==t.highlighted?"scenario"===t.range?H(e.rangeColor,t,"var(--semiotic-secondary, #9ca3af)"):H(e.color,t,D):H(e.inactiveColor,t,O),stroke:"none",...Y(e.style,t)??{}}}function K(t,e){const n=Y(e.pointId,t)??(e.idPrefix?`${e.idPrefix}-${"scenario"===t.range?"range-":""}${t.index}`:void 0);return{datum:q(t,e),accessibleDatum:Y(e.accessibleDatum,t),accessibility:Y(e.accessibility,t),pointId:n,_transitionKey:n}}function U({input:t,encoding:e,options:n={}}){if(!B(t)&&!e)throw Error("tokenLayer requires an encoding when input is not a TokenSet.");const o=B(t)?{...t,encoding:l(t.encoding)}:i(t,e),r=function(t,e){const n=e.includeRange&&t.rangeTokens?[...t.tokens,...t.rangeTokens]:t.tokens;if(e.positionToken)return function(t,e){const n=e.positionToken;return n?t.map((e,o)=>{const r=n(e,o,t);return{...e,x:r.x,y:r.y,row:r.row??o,column:r.column??0}}):[]}(n,e);const o=e.layout??t.encoding.layout??"grid";if("quantile-strip"===o)return function(t,e){if(0===t.length)return[];const n=e.x??0,o=e.y??0,r=e.cellHeight??("number"==typeof e.tokenSize?e.tokenSize:12),i=e.gutter??2,a=Math.max(1,Math.floor(e.rows??1)),s=t.map(V),c=Math.min(...s),l=Math.max(...s)-c||1;return t.map((s,u)=>{const d=V(s),h=u%a,f=e.valueToX?e.valueToX(d,s):n+(d-c)/l*(e.width??12*Math.max(1,t.length-1)),m=e.valueToY?e.valueToY(d,s):o+h*(r+i);return{...s,x:f,y:m,row:h,column:u}})}(n,e);if("dotplot"===o)return function(t,e){if(0===t.length)return[];const n=e.x??0,o=e.y??0,r="number"==typeof e.tokenSize?e.tokenSize:12,i=e.gutter??2,a=e.cellWidth??r+i,s=e.cellHeight??r+i,c=t.map(V),l=Math.min(...c),u=Math.max(...c)-l||1,d=new Map;return t.map(r=>{const i=V(r),c=e.valueToX?e.valueToX(i,r):n+(i-l)/u*(e.width??Math.max(1,t.length-1)*a),h=Math.round((c-n)/Math.max(1,a)),f=d.get(h)??0;d.set(h,f+1);const m=e.valueToY?e.valueToY(i,r):o+f*s;return{...r,x:n+h*a,y:m,row:f,column:h}})}(n,e);if("bar-segment"===o){if(!e.valueToX)throw Error('tokenLayer layout "bar-segment" requires valueToX and optionally valueToY.');return function(t,e){if(!e.valueToX)return[];const n=e.y??0,o=e.cellHeight??("number"==typeof e.tokenSize?e.tokenSize:12),r=e.anchor??[.5,.5];return t.map((t,i)=>{const a=Number.isFinite(t.start)?t.start:V(t),s=(a+(Number.isFinite(t.end)?t.end:a+t.value))/2,c=e.valueToY?e.valueToY(s,t):n+r[1]*o;return{...t,x:e.valueToX(s,t),y:c,row:0,column:i}})}(n,e)}if("beeswarm"===o||"small-multiple"===o)throw Error(`tokenLayer layout "${o}" is not implemented yet; use row, column, stack, grid, waffle, dotplot, quantile-strip, bar-segment with valueToX, or positionToken.`);const r="number"==typeof e.tokenSize?e.tokenSize:void 0,i=e.cellWidth??r??12,a=e.cellHeight??r??i,c="row"===o?Math.max(1,n.length):"column"===o||"stack"===o?1:"waffle"===o&&"fixed-denominator"===t.encoding.countStrategy&&100===t.denominator?10:function(t,e,n){if(e.columns)return e.columns;if(e.width&&n>0){const t=e.gutter??2;return Math.max(1,Math.floor((e.width+t)/(n+t)))}return t.length>0?Math.ceil(Math.sqrt(t.length)):1}(n,e,i);return s(n,{...e,columns:c,cellWidth:i,cellHeight:a})}(o,n).filter(t=>!n.include||n.include(t));return{tokenSet:o,positionedTokens:r,nodes:r.map(t=>function(t,e,n){if("dot"===n.tokenType)return function(t,e){const n=H(e.tokenSize,t,12);return{type:"point",x:t.x,y:t.y,r:H(e.radius,t,n/2),style:G(t,e),...K(t,e)}}(t,e);const o=Y(e.glyph,t)??function(t){if(t)return j[t]}(n.icon);if(o)return function(t,e,n){const o=G(t,n),r=H(n.tokenSize,t,12);return{type:"glyph",x:t.x,y:t.y,size:r,glyph:e,color:(o.fill??D)+"",accent:H(n.accent,t,"var(--semiotic-bg, #ffffff)"),fraction:1>t.fraction?t.fraction:void 0,fractionStart:t.startFraction>0?t.startFraction:void 0,fractionDirection:H(n.fractionDirection,t,"horizontal"),ghostColor:1>t.fraction?Y(n.ghostColor,t)??O:void 0,rotation:Y(n.rotation,t),style:o,...K(t,n)}}(t,o,e);const r=(i=n.icon)&&X.has(i)?i:void 0;var i;return function(t,e){const n=H(e.tokenSize,t,12);return{type:"symbol",x:t.x,y:t.y,size:Math.PI*Math.max(1,n/2)**2,symbolType:H(e.symbolType,t,"circle"),path:Y(e.symbolPath,t),rotation:Y(e.rotation,t),style:G(t,e),...K(t,e)}}(t,r&&null==e.symbolType?{...e,symbolType:r}:e)}(t,n,o.encoding))}}import{interpolateRgb as _}from"d3-interpolate";var Z=864e5,Q=t=>{const e=t.config,{plot:n}=t.dimensions;if(0>=n.width||0>=n.height)return{nodes:[]};const o=t=>{const n="function"==typeof e.dateAccessor?e.dateAccessor(t):t[e.dateAccessor];return n instanceof Date?n:new Date(n)},r=t=>{const n="function"==typeof e.valueAccessor?e.valueAccessor(t):t[e.valueAccessor];return Number(n)},i=new Map;let a=null;for(const e of t.data){const t=o(e);if(!isFinite(t.getTime()))continue;null==a&&(a=t.getUTCFullYear());const n=J(t),s=r(e);i.set(n,(i.get(n)??0)+(Number.isFinite(s)?s:0))}const s=e.year??a??(new Date).getUTCFullYear();let c=1/0,l=-1/0;for(const t of i.values())c>t&&(c=t),t>l&&(l=t);c===1/0&&(c=0,l=0);const[u,d]=e.colorRamp??[t.theme.semantic.surface??"#ebedf0",t.theme.semantic.primary??"#216e39"],h=t=>{if(l===c)return u;const e=(t-c)/(l-c);return _(u,d)(e)},f=e.gutter??2,m=e.labelInset??0,p=Math.min((n.width-m-53*f)/54,(n.height-6*f)/7);if(0>=p)return{nodes:[]};const y=new Date(Date.UTC(s,0,1)),g=y.getUTCDay(),x=new Date(y.getTime()-g*Z),b=[];for(let t=0;54>t;t++)for(let e=0;7>e;e++){const o=new Date(x.getTime()+(7*t+e)*Z);if(o.getUTCFullYear()!==s)continue;const r=J(o),a=i.get(r),c=null==a?u:h(a);b.push({type:"rect",x:n.x+m+t*(p+f),y:n.y+e*(p+f),w:p,h:p,style:{fill:c,stroke:"none"},datum:{date:o,value:a??0}})}return{nodes:b}};function J(t){return`${t.getUTCFullYear()}-${tt(t.getUTCMonth()+1)}-${tt(t.getUTCDate())}`}function tt(t){return 10>t?"0"+t:t+""}import{jsx as et,jsxs as nt}from"react/jsx-runtime";var ot={resource:32,city:64},rt=["#739b58","#83a964","#668d52","#8baa68"],it={land:"#78985c",ocean:"#4d8192",forest:"#4f7c4b",grassland:"#8eaa68",cropland:"#a6a568",wetland:"#668f79",urban:"#8d8a72",scrub:"#9b9665",bare:"#aa906a",snow:"#d8ddcf"},at={land:"Open land",ocean:"Open ocean",forest:"Forest",grassland:"Grassland",cropland:"Cropland",wetland:"Wetland",urban:"Urban district",scrub:"Scrubland",bare:"Bare ground",snow:"Snow cover"},st=new Set(["city","culture","monument","faith","nature","knowledge","defense","arena","transport"]);function ct(t,e){if("function"==typeof t)return t;const n=t??e;return t=>t[n]}function lt(t,e,n){return[111.32*(t-n.lon)*Math.cos((e+n.lat)/2*(Math.PI/180)),110.574*(e-n.lat)]}function ut(t){const e=Math.max(3,Math.round(t??5));return e%2==0?e+1:e}function dt(t){return st.has(t)?t:"monument"}function ht(t,e){const n=ut(e.gridSize),o=Math.max(1,e.gridRadiusKm??75),r=2*o/n,i=Math.floor(n/2),a=ct(e.idAccessor,"id"),s=ct(e.nameAccessor,"name"),c=ct(e.longitudeAccessor,"lon"),l=ct(e.latitudeAccessor,"lat"),u=ct(e.kindAccessor,"kind"),d=e.candidatePriorityAccessor?ct(e.candidatePriorityAccessor,"priority"):()=>0,h=new Map;let f=null;for(const m of t){const t=Number(c(m)),p=Number(l(m));if(!Number.isFinite(t)||!Number.isFinite(p))continue;const y=(a(m)??`${t},${p}`)+"",g=(s(m)??y)+"",x=dt(u(m)),[b,w]=lt(t,p,e.center);if(Math.abs(b)>o||Math.abs(w)>o)continue;const M=Math.min(n-1,Math.max(0,Math.floor((b+o)/r))),v=Math.min(n-1,Math.max(0,Math.floor((o-w)/r))),k=(M+.5)*r-o,$=o-(v+.5)*r,A={...m,id:y,name:g,kind:x,lon:t,lat:p,distanceKm:Math.sqrt(b*b+w*w),row:v,column:M,cellDistanceSq:(b-k)**2+(w-$)**2,candidatePriority:Number(d(m))||0};(null!=e.centerId&&y===e.centerId||!f&&"city"===x||!f&&v===i&&M===i)&&(f=A);const S=`${v}:${M}`,z=h.get(S)??[];z.push(A),h.set(S,z)}const m=new Map;f&&m.set("city",1);const p=[];for(let t=0;n>t;t++)for(let e=0;n>e;e++){const n=`tile-${t}-${e}`,a=(e+.5)*r-o,s=o-(t+.5)*r;let c,l;if(t===i&&e===i&&f){c=f;const n=(h.get(`${t}:${e}`)??[]).filter(t=>t.id!==f?.id).sort((t,e)=>t.candidatePriority-e.candidatePriority||t.cellDistanceSq-e.cellDistanceSq||t.name.localeCompare(e.name));l=[f,...n]}else{const n=(h.get(`${t}:${e}`)??[]).filter(t=>t.id!==f?.id);n.sort((t,e)=>{const n=t.candidatePriority-e.candidatePriority;if(0!==n)return n;const o=m.get(t.kind)??0,i=m.get(e.kind)??0,a=r*r*.35;return t.cellDistanceSq+o*a-(e.cellDistanceSq+i*a)||t.name.localeCompare(e.name)}),c=n[0]??null,l=n}c&&m.set(c.kind,(m.get(c.kind)??0)+1),p.push({id:n,row:t,column:e,centerXKm:a,centerYKm:s,terrainIndex:Math.abs((17*t+31*e)%rt.length),landmark:c,landmarks:l})}return p}var ft=t=>{const e=ut(t.config.gridSize),n=Math.max(20,t.config.tileWidth??80),o=Math.max(10,t.config.tileHeight??40),r=t.config.terrainColors?.length?t.config.terrainColors:rt,i=t.dimensions.width/2,a=(t.dimensions.height-e*o)/2+o/2,s=ht(t.points,t.config).map(t=>({...t,x:i+n/2*(t.column-t.row),y:a+(t.column+t.row)*(o/2)}));return{nodes:s.map(e=>{const i=t.config.terrainByCell?.[e.id],a="string"==typeof i?{kind:i}:i,s="city"===e.landmark?.kind?"urban":a?.kind??"land",c=a?.fill??t.config.terrainPalette?.[s]??it[s],l=e.landmark?{...e.landmark,gridRow:e.row,gridColumn:e.column,cellId:e.id,terrainKind:s,terrainCoverage:a?.coverage,features:e.landmarks,featureCount:e.landmarks.length}:{id:e.id,name:at[s],kind:"terrain",terrainKind:s,terrainCoverage:a?.coverage,gridRow:e.row,gridColumn:e.column,cellId:e.id,features:[],featureCount:0};return{type:"geoarea",pathData:(u=e.x,d=e.y,h=n,f=o,`M${u},${d-f/2}L${u+h/2},${d}L${u},${d+f/2}L${u-h/2},${d}Z`),centroid:[e.x,e.y],bounds:[[e.x-n/2,e.y-o/2],[e.x+n/2,e.y+o/2]],screenArea:n*o/2,style:{fill:a||"urban"===s?c:r[e.terrainIndex%r.length],stroke:"ocean"===s?"#315d6c":t.config.tileStroke??"#314934",strokeWidth:1},datum:l,group:e.landmark?.kind??s,interactive:!0};var u,d,h,f}),overlays:et(mt,{tiles:s,tileWidth:n,tileHeight:o,sprites:t.config.sprites,resourceSize:t.config.resourceSpriteSize??32,citySize:t.config.citySpriteSize??64,showCityLabel:!1!==t.config.showCityLabel}),restyle:(t,e)=>e?.isActive&&t.datum&&"terrain"!==t.datum.kind?{fillOpacity:e.predicate(t.datum)?1:.28}:{fillOpacity:1}}};function mt({tiles:t,tileWidth:e,tileHeight:n,sprites:o,resourceSize:r,citySize:i,showCityLabel:a}){const s=x(),c=t.filter(t=>t.landmark).sort((t,e)=>t.y-e.y||t.x-e.x);return nt("g",{"aria-hidden":"true",pointerEvents:"none",children:[c.map(t=>{const a=t.landmark,c="city"===a.kind?i:r,l=t.y+n/2,u=s.isActive&&!s.predicate(a)?.28:1;return nt("g",{opacity:u,children:[et("ellipse",{cx:t.x,cy:t.y+.15*n,rx:.28*c,ry:.1*c,fill:"#17251d",opacity:.32}),et(xt,{kind:a.kind,href:o?.[a.kind],x:t.x-c/2,y:l-c,size:c}),t.landmarks.length>1&&et(pt,{x:t.x+.3*e,y:t.y-.19*n,count:t.landmarks.length-1,tileHeight:n})]},a.id)}),a&&c.filter(t=>"city"===t.landmark?.kind).map(t=>{const e=t.landmark.name.toUpperCase(),o=Math.max(56,6.4*e.length+14);return nt("g",{transform:`translate(${t.x},${t.y+.72*n})`,children:[et("rect",{x:-o/2,y:-7,width:o,height:14,rx:1,fill:"#17251d",opacity:.92}),et("text",{textAnchor:"middle",dominantBaseline:"central",fill:"#f5edcf",fontFamily:"monospace",fontSize:9,fontWeight:700,letterSpacing:.8,children:e})]},t.landmark.id+"-label")})]})}function pt({x:t,y:e,count:n,tileHeight:o}){const r=Math.max(10,Math.min(15,.34*o)),i="+"+n,a=Math.max(r,i.length*r*.58);return nt("g",{transform:`translate(${t},${e})`,children:[et("rect",{x:-a/2,y:-r/2,width:a,height:r,rx:1,fill:"#17251d",stroke:"#f0d36d",strokeWidth:1}),et("text",{textAnchor:"middle",dominantBaseline:"central",fill:"#f5edcf",fontFamily:"monospace",fontSize:Math.max(7,.62*r),fontWeight:700,children:i})]})}var yt={city:["..1111..","..1221..",".111111.",".133331.","11111111","13311331","14411441","11111111"],culture:["..1111..",".122221.","11111111",".133331.",".133331.",".133331.","11111111",".444444."],monument:["...11...","..1221..","..1221..","..1331..",".113311.",".133331.","11111111",".444444."],faith:["...11...","...11...","..1111..","...11...","..1221..",".133331.","11111111",".444444."],nature:["...11...","..1221..",".122221.","12222221",".133331.","...11...","..1441..",".144441."],knowledge:[".111111.","12211221","12211221","13311331","13311331","13311331","11111111",".444444."],defense:["11.11.11","11111111","12222221","12211221","13311331","13333331","11111111",".444444."],arena:["..1111..",".122221.","12333321","12344321","12344321","12333321",".122221.","..1111.."],transport:["...11...","..1221..",".122221.","11111111","..1331..","..1331..",".114411.","11444411"]},gt={city:{1:"#29364a",2:"#d8b45b",3:"#b7693c",4:"#6d9fc5"},culture:{1:"#29364a",2:"#d5c9a3",3:"#9c6fb2",4:"#ece3c4"},monument:{1:"#29364a",2:"#d8cba8",3:"#9c8f79",4:"#ece3c4"},faith:{1:"#29364a",2:"#d9c36d",3:"#a877a5",4:"#ece3c4"},nature:{1:"#29364a",2:"#4f8a4e",3:"#79aa56",4:"#79583a"},knowledge:{1:"#29364a",2:"#d5c9a3",3:"#4f7da0",4:"#ece3c4"},defense:{1:"#29364a",2:"#a6a298",3:"#777b7f",4:"#d5c9a3"},arena:{1:"#29364a",2:"#cb8056",3:"#d8cba8",4:"#6d9fc5"},transport:{1:"#29364a",2:"#d8b45b",3:"#6d9fc5",4:"#ece3c4"}};function xt({kind:t,href:e,x:n,y:o,size:r}){if(e)return et("image",{href:e,x:n,y:o,width:r,height:r,preserveAspectRatio:"xMidYMax meet",style:{imageRendering:"pixelated"}});const i=gt[t];return et("svg",{x:n,y:o,width:r,height:r,viewBox:"0 0 8 8",shapeRendering:"crispEdges",children:yt[t].flatMap((t,e)=>[...t].map((t,n)=>"."===t?null:et("rect",{x:n,y:e,width:1,height:1,fill:i[t]},`${e}-${n}`)))})}var bt=t=>{const e=t.config,n=e.nodeWidth??80,o=e.nodeHeight??30,r=e.orientation??"vertical",i=e.edgeCurve??"curved",a=!1!==e.showLabels,s=e.labelAccessor??"id",c="function"==typeof s?s:t=>u(t,s,t.id??"")+"",l=new Map,d=[],h=[],f=t=>{const e=t.data??{};return{x:"number"==typeof e.x?e.x:t.x,y:"number"==typeof e.y?e.y:t.y,w:("number"==typeof e.width?e.width:t.width)??n,h:("number"==typeof e.height?e.height:t.height)??o}};for(const n of t.nodes){const{x:o,y:r,w:i,h:s}=f(n);null!=o&&null!=r&&(l.set(n.id,{x:o,y:r,w:i,h:s}),d.push({type:"rect",x:o-i/2,y:r-s/2,w:i,h:s,style:{fill:e.nodeFill??t.resolveColor(n.id),stroke:`var(--semiotic-surface, ${t.theme.semantic.surface??"#fff"})`,strokeWidth:1.5},datum:n,id:n.id,label:c(n)+""}),a&&h.push({x:o,y:r,text:c(n)+"",anchor:"middle",baseline:"middle",fontSize:11}))}const m=[];for(const e of t.edges){const n="string"==typeof e.target?e.target:e.target.id,o=l.get("string"==typeof e.source?e.source:e.source.id),a=l.get(n);if(!o||!a)continue;const s="vertical"===r?{x:o.x,y:o.y+o.h/2}:{x:o.x+o.w/2,y:o.y},c="vertical"===r?{x:a.x,y:a.y-a.h/2}:{x:a.x-a.w/2,y:a.y};if("line"===i)m.push({type:"line",x1:s.x,y1:s.y,x2:c.x,y2:c.y,style:{stroke:`var(--semiotic-border, ${t.theme.semantic.border??"#999"})`,strokeWidth:1},datum:e});else{const n=(s.y+c.y)/2,o=(s.x+c.x)/2;m.push({type:"curved",pathD:"vertical"===r?`M${s.x},${s.y} C${s.x},${n} ${c.x},${n} ${c.x},${c.y}`:`M${s.x},${s.y} C${o},${s.y} ${o},${c.y} ${c.x},${c.y}`,style:{stroke:`var(--semiotic-border, ${t.theme.semantic.border??"#999"})`,strokeWidth:1,fill:"none"},datum:e})}}return{sceneNodes:d,sceneEdges:m,labels:h}},wt=t=>{const e=t.config,n=e.nodeWidth??100,o=e.nodeHeight??36,r=e.edgeStyle??"polyline",i=!1!==e.showLabels,a=e.labelAccessor??"label",s="function"==typeof a?a:t=>u(t,a,t.id??"")+"",c=new Map,l=[],d=[],h=t=>{const e=t.data??{};return{x:"number"==typeof e.x?e.x:t.x,y:"number"==typeof e.y?e.y:t.y,w:("number"==typeof e.width?e.width:t.width)??n,h:("number"==typeof e.height?e.height:t.height)??o}};for(const n of t.nodes){const{x:o,y:r,w:a,h:u}=h(n);null!=o&&null!=r&&(c.set(n.id,{x:o,y:r,w:a,h:u}),l.push({type:"rect",x:o-a/2,y:r-u/2,w:a,h:u,style:{fill:e.nodeFill??t.resolveColor(n.id),stroke:`var(--semiotic-border, ${t.theme.semantic.border??"#888"})`,strokeWidth:1.5},datum:n,id:n.id,label:s(n)+""}),i&&d.push({x:o,y:r,text:s(n)+"",anchor:"middle",baseline:"middle",fontSize:11}))}const f=e.edgeStroke??`var(--semiotic-border, ${t.theme.semantic.border??"#666"})`,m=[];for(const e of t.edges){const t="string"==typeof e.target?e.target:e.target.id,n=c.get("string"==typeof e.source?e.source:e.source.id),o=c.get(t);if(!n||!o)continue;const i=e.data??{},a=Array.isArray(i.points)?i.points:e.points;if(a&&a.length>=2)if("smooth"!==r||3>a.length){const t="M"+a.map(t=>`${t.x},${t.y}`).join(" L ");m.push({type:"curved",pathD:t,style:{stroke:f,strokeWidth:1,fill:"none"},datum:e})}else{let t=`M${a[0].x},${a[0].y}`;for(let e=1;a.length-1>e;e++)t+=` Q${a[e].x},${a[e].y} ${(a[e].x+a[e+1].x)/2},${(a[e].y+a[e+1].y)/2}`;const n=a[a.length-1];t+=` T${n.x},${n.y}`,m.push({type:"curved",pathD:t,style:{stroke:f,strokeWidth:1,fill:"none"},datum:e})}else m.push({type:"line",x1:n.x,y1:n.y,x2:o.x,y2:o.y,style:{stroke:f,strokeWidth:1},datum:e})}return{sceneNodes:l,sceneEdges:m,labels:d}};import{jsx as Mt,jsxs as vt}from"react/jsx-runtime";var kt={"topic-source":"#1f7a8c","topic-sink":"#b4451f","topic-bridge":"#4b5a82",processor:"#34344a",unknown:"#5a5a6a"},$t={internal:"var(--semiotic-border, #6b6b7d)","cross-subtopology":"var(--semiotic-info, #6a8caf)","topic-bridge":"var(--semiotic-secondary, #8b78c4)",back:"var(--semiotic-danger, #e0556b)"};function At(t){return Array.isArray(t)?t.map((t,e)=>"string"==typeof t?{storeName:t,slotIndex:e}:{storeName:(t.storeName??"")+"",slotIndex:t.slotIndex??e}):[]}var St=t=>{const e=t.config||{},n=t.dimensions.plot,o=e.layerAccessor??"x",r=e.rowAccessor??"y",i=e.partitionAccessor??"partition",a=e.semanticAccessor??"semantic",s=e.labelAccessor??"label",c=e.storesAccessor??"stores",l=e.backEdgeAccessor??"isBackEdge",d=e.edgeTypeAccessor??"edgeType",h={...kt,...e.partitionColors},f={...$t,...e.edgeColors},m=e.accentColor??"var(--semiotic-focus, #ffcc33)",p=e.borderColor??"var(--semiotic-border, #555)",y=e.dimOpacity??.14,g=e.edgeOpacity??.5,x=e.edgeWidth??1.25,b=e.backEdgeWidth??e.edgeWidth??1.5,w=!1!==e.showStoreChips,M=e.storeChipColor??"var(--semiotic-info, #6a8caf)";let v=e.layerCount,k=e.maxLayerSize;if(null==v||null==k){let e=0;const n=new Map;for(const r of t.nodes){const t=Math.round(Number(u(r,o,0)));e=Math.max(e,t),n.set(t,(n.get(t)??0)+1)}v=v??e+1,k=k??Math.max(1,...n.values())}const $=n.width/Math.max(1,v),A=n.height/Math.max(1,k);let S=Math.min(e.nodeWidth??172,Math.max(8,$-(e.minGapX??26))),z=Math.min(e.nodeHeight??54,Math.max(8,A-(e.minGapY??18)));const C=e.lod&&"auto"!==e.lod?e.lod:16>S?"dot":48>S?"icon":108>S?"compact":"full";if("dot"===C){const t=Math.min(S,z,11);S=t,z=t}const I=Math.max(1,n.width-S),L=Math.max(1,n.height-z),N=Math.max(1,k-1),W=t=>n.x+S/2+(v>1?t/(v-1):.5)*I,E=t=>n.y+z/2+(t+N/2)/N*L,T=e.reachableIds?new Set(e.reachableIds):null,R=e.selectedId??null,P=t.selection,F=new Map,j=new Map,D=[],O=[];for(const e of t.nodes){const t=e.id,n=Number(u(e,o,0)),l=Number(u(e,r,0)),d=u(e,i,"processor")+"",f=u(e,a,"processor")+"",g=u(e,s,t)+"",x=At(u(e,c,[])),b=e.data??e,w=W(n),M=E(l);F.set(t,{cx:w,cy:M});const v=T?T.has(t):null,k=P?.isActive?P.predicate(b):null,$=null!==v?!v:null!==k&&!k;j.set(t,$);const A=null!=R&&t===R,I=$&&!A?y:1,L=h[d]??h.unknown;"dot"===C?D.push({type:"circle",cx:w,cy:M,r:S/2,style:{fill:L,opacity:I,stroke:A?m:"transparent",strokeWidth:A?2:0},datum:e,id:t,label:g}):(D.push({type:"rect",x:w-S/2,y:M-z/2,w:S,h:z,style:{fill:L,opacity:I,stroke:A?m:p,strokeWidth:A?3:1},datum:e,id:t,label:g}),O.push({id:t,cx:w,cy:M,partition:d,semantic:f,label:g,stores:x,opacity:I,selected:A,node:b}))}const B=[];for(const e of t.edges){const t="string"==typeof e.source?e.source:e.source.id,n="string"==typeof e.target?e.target:e.target.id,o=F.get(t),r=F.get(n);if(!o||!r)continue;const i=!!u(e,l,!1),a=u(e,d,"internal")+"",s=j.get(t)||j.get(n)?Math.min(g,1.4*y):g,c=i?f.back:f[a]??f.internal;let h;if(i){const t=o.cx,e=o.cy+z/2,n=r.cx,i=r.cy+z/2,a=Math.max(48,.28*Math.abs(t-n))+z;h=`M${t},${e} C${t},${e+a} ${n},${i+a} ${n},${i}`}else{const t=o.cx+S/2,e=o.cy,n=r.cx-S/2,i=r.cy,a=(t+n)/2;h=`M${t},${e} C${a},${e} ${a},${i} ${n},${i}`}const m={type:"curved",pathD:h,style:{stroke:c,strokeWidth:i?b:x,fill:"none",opacity:s,...i?{strokeDasharray:"5 4",strokeLinecap:"round"}:{}},datum:e};B.push(m)}const H=0===O.length?null:Mt("g",{className:"lineage-dag-glyphs",children:O.map(t=>function(t,e){const{w:n,h:o,lod:r}=e,i="icon"===r?Math.min(n,o):Math.min(o-14,26),a="icon"===r?0:8+i+8,s=null!=e.renderIcon?e.renderIcon({semantic:t.semantic,partition:t.partition,size:i,color:e.partColors[t.partition]??e.partColors.unknown??"#5a5a6a",node:t.node}):function(t,e,n){const o=e.startsWith("topic")?"T":{source:"SR",sink:"SK",filter:"FL",map:"MP",aggregate:"AG",reduce:"RD","join-this":"JN","join-other":"JN",merge:"MG",suppress:"SP",select:"SE",tostream:"TS"}[t]??"PR";return vt("g",{children:[Mt("rect",{width:n,height:n,rx:4,fill:"rgba(255,255,255,0.08)",stroke:"rgba(255,255,255,0.18)"}),Mt("text",{x:n/2,y:n/2+.5,textAnchor:"middle",dominantBaseline:"middle",fontSize:.42*n,fontWeight:700,fill:"var(--semiotic-text, #fff)",children:o})]})}(t.semantic,t.partition,i),c="full"===r,l="icon"!==r,u="full"===r&&e.showChips&&t.stores.length>0;return vt("g",{transform:`translate(${t.cx-n/2}, ${t.cy-o/2})`,opacity:t.opacity,style:{pointerEvents:"none"},children:[Mt("g",{transform:`translate(${"icon"===r?(n-i)/2:8}, ${(o-i)/2})`,children:s}),l&&Mt("foreignObject",{x:a,y:c?o/2-12:o/2-9,width:Math.max(8,n-a-8),height:18,style:{pointerEvents:"none"},children:Mt("div",{title:t.label,style:{pointerEvents:"none",fontFamily:"var(--semiotic-font-family, inherit)",fontSize:"full"===r?12.5:11.5,fontWeight:600,color:"var(--semiotic-text, #f4f4f8)",lineHeight:"18px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t.label})}),c&&Mt("text",{x:a,y:o/2-16,dominantBaseline:"middle",fontSize:9.5,fontWeight:500,fill:"var(--semiotic-text-secondary, #b9b9c8)",style:{textTransform:"uppercase",letterSpacing:"0.04em"},children:e.typeLabel?e.typeLabel({semantic:t.semantic,partition:t.partition,node:t.node}):t.partition.startsWith("topic")?"topic":t.semantic}),u&&t.stores.map((t,n)=>Mt("rect",{x:a+15*n,y:o-10,width:12,height:5,rx:1.5,fill:e.chipColor,children:Mt("title",{children:t.storeName})},t.storeName+n))]},t.id)}(t,{w:S,h:z,lod:C,partColors:h,chipColor:M,showChips:w,renderIcon:e.renderIcon,typeLabel:e.typeLabel}))});return{sceneNodes:D,sceneEdges:B,overlays:H}};import{jsx as zt,jsxs as Ct}from"react/jsx-runtime";function It(t,e){return t.length>e?t.slice(0,Math.max(1,e-1))+"…":t}var Lt={rect:"process",round:"process",stadium:"terminal",subroutine:"subprocess",cylinder:"database",circle:"connector",diamond:"decision",hexagon:"preparation",flag:"process"};function Nt(t,e,n,o,r,i,a,s){const c=e-o/2,l=n-r/2,u={fill:i,stroke:a,strokeWidth:s};switch(t){case"diamond":return zt("polygon",{points:`${e},${l} ${e+o/2},${n} ${e},${n+r/2} ${c},${n}`,...u});case"circle":return zt("circle",{cx:e,cy:n,r:Math.min(o,r)/2,...u});case"stadium":case"round":return zt("rect",{x:c,y:l,width:o,height:r,rx:"stadium"===t?r/2:8,ry:"stadium"===t?r/2:8,...u});case"hexagon":{const t=Math.min(.18*o,16);return zt("polygon",{points:`${c+t},${l} ${e+o/2-t},${l} ${e+o/2},${n} ${e+o/2-t},${n+r/2} ${c+t},${n+r/2} ${c},${n}`,...u})}case"cylinder":{const t=Math.min(.16*r,8),e=`M${c},${l+t} a${o/2},${t} 0 0 1 ${o},0`;return Ct("g",{children:[zt("path",{d:`M${c},${l+t} a${o/2},${t} 0 0 0 ${o},0 v${r-2*t} a${o/2},${t} 0 0 1 ${-o},0 z`,...u}),zt("path",{d:e,fill:"none",stroke:a,strokeWidth:s})]})}case"subroutine":{const t=Math.min(8,.08*o);return Ct("g",{children:[zt("rect",{x:c,y:l,width:o,height:r,rx:3,...u}),zt("line",{x1:c+t,y1:l,x2:c+t,y2:l+r,stroke:a,strokeWidth:s}),zt("line",{x1:c+o-t,y1:l,x2:c+o-t,y2:l+r,stroke:a,strokeWidth:s})]})}default:return zt("rect",{x:c,y:l,width:o,height:r,rx:4,...u})}}var Wt=t=>{const e=t.config||{},n=t.dimensions.plot,o=e.direction??"TD",r="LR"===o||"RL"===o,i="BT"===o||"RL"===o,a=e.layerAccessor??"layer",s=e.rowAccessor??"row",c=e.labelAccessor??"label",l=e.shapeAccessor??"shape",d=e.edgeLabelAccessor??"label",h=e.nodeFill??"var(--semiotic-surface, #20242d)",f=e.nodeStroke??"var(--semiotic-border, #5a6573)",m=e.textColor??"var(--semiotic-text, #e6e6e6)",p=e.edgeColor??"var(--semiotic-text-secondary, #9aa0a6)",y=e.accentColor??"var(--semiotic-warning, #d49a00)";if(0===t.nodes.length)return{sceneNodes:[],overlays:null};const g=new Map;let x=0;for(const e of t.nodes){const t=Math.round(Number(u(e,a,0)));x=Math.max(x,t);const n=g.get(t)||[];n.push(e),g.set(t,n)}const b=x+1;let w=1;for(const t of g.values())t.sort((t,e)=>Number(u(t,s,0))-Number(u(e,s,0))),w=Math.max(w,t.length);const M=r?n.width:n.height,v=r?n.height:n.width,k=M/b,$=v/(w+1),A=Math.max(44,Math.min(e.nodeWidth??150,r?k-36:.92*$)),S=Math.max(26,Math.min(e.nodeHeight??46,r?.7*$:.5*k)),z=(r?A:S)/2+6,C=Math.max(1,M-2*z),I=t=>(r?n.x:n.y)+z+(b>1?(i?b-1-t:t)/(b-1)*C:C/2),L=new Map,N=[],W=[];for(const[t,e]of g)e.forEach((o,i)=>{const a=I(t),s=(r?n.y:n.x)+(i+1)/(e.length+1)*v,d=r?a:s,p=r?s:a,g=u(o,l,"rect")+"",x=u(o,c,o.id)+"";L.set(o.id,{cx:d,cy:p,shape:g}),N.push({type:"rect",x:d-A/2,y:p-S/2,w:A,h:S,style:{fill:"transparent",stroke:"transparent"},datum:{id:o.id,name:x,type:Lt[g]??"process",shape:g},id:o.id,label:x}),W.push(Ct("g",{children:[Nt(g,d,p,A,S,h,"diamond"===g?y:f,1.5),zt("text",{x:d,y:p,textAnchor:"middle",dominantBaseline:"central",fontSize:13,fill:m,style:{pointerEvents:"none"},children:It(x,Math.max(4,Math.floor((A-12)/7)))})]},"n-"+o.id))});const E=[];return t.edges.forEach((t,e)=>{const n="string"==typeof t.target?t.target:t.target.id,o=L.get("string"==typeof t.source?t.source:t.source.id),i=L.get(n);if(!o||!i)return;const a=r?o.cx+A/2:o.cx,s=r?o.cy:o.cy+S/2,c=r?i.cx-A/2:i.cx,l=r?i.cy:i.cy-S/2,h=r?`M${a},${s} C${(a+c)/2},${s} ${(a+c)/2},${l} ${c},${l}`:`M${a},${s} C${a},${(s+l)/2} ${c},${(s+l)/2} ${c},${l}`,y=Math.atan2(l-s,c-a),g=c-9*Math.cos(y),x=l-9*Math.sin(y),b=4.5*-Math.sin(y),w=4.5*Math.cos(y),M=`${c},${l} ${g+b},${x+w} ${g-b},${x-w}`,v=u(t,d,void 0),k=(a+c)/2,$=(s+l)/2;E.push(Ct("g",{children:[zt("path",{d:h,fill:"none",stroke:p,strokeWidth:1.4}),zt("polygon",{points:M,fill:p}),"string"==typeof v&&v.length>0&&Ct("g",{children:[zt("rect",{x:k-6.5*v.length/2-4,y:$-9,width:6.5*v.length+8,height:18,rx:3,fill:"var(--semiotic-bg, #11151c)",stroke:f,strokeWidth:.75}),zt("text",{x:k,y:$,textAnchor:"middle",dominantBaseline:"central",fontSize:11,fill:m,style:{pointerEvents:"none"},children:v})]})]},"e-"+e))}),{sceneNodes:N,overlays:Ct("g",{className:"mermaid-dag",children:[E,W]})}};import{jsx as Et,jsxs as Tt}from"react/jsx-runtime";function Rt(t){return Et("rect",{className:t.className,x:t.x,y:t.y,width:Math.max(0,t.width),height:Math.max(0,t.height),rx:t.radius??10,ry:t.radius??10,fill:t.fill??"none",stroke:t.stroke,strokeWidth:t.strokeWidth??1.5,strokeDasharray:t.strokeDasharray,opacity:t.opacity??.6,style:{pointerEvents:"none"}},t.keyId)}function Pt(t,e=0){let n=1/0,o=1/0,r=-1/0,i=-1/0;for(const e of t){const t=e.r??0;n>e.x-t&&(n=e.x-t),e.x+t>r&&(r=e.x+t),o>e.y-t&&(o=e.y-t),e.y+t>i&&(i=e.y+t)}return Number.isFinite(n)?{x:n-e,y:o-e,width:r-n+2*e,height:i-o+2*e}:null}function Ft(t){const e=t.fontSize??12;return null!=t.maxWidth&&t.text.length*e*.56>t.maxWidth?null:Et("text",{className:t.className,x:t.x,y:t.y,textAnchor:t.anchor??"middle",dominantBaseline:t.baseline??"middle",fontSize:e,fontWeight:t.fontWeight,fill:t.color,style:{pointerEvents:"none"},children:t.text},t.keyId)}function jt(t){const e=t.spacing??8;return{def:Et("pattern",{id:t.id,width:e,height:e,patternUnits:"userSpaceOnUse",patternTransform:`rotate(${t.angle??45})`,children:Et("line",{x1:0,y1:0,x2:0,y2:e,stroke:t.color??"currentColor",strokeWidth:t.strokeWidth??1,opacity:t.opacity??.5})},t.id),fill:`url(#${t.id})`}}function Dt(t){const e=t.orient??"bottom",n="bottom"===e||"top"===e,o=t.offset??0,r=t.tickLength??6,i=t.gridLength??0,a=t.labelGap??4,s=t.fontSize??11,c=t.color??"var(--semiotic-text-secondary, #888)",l=t.gridColor??c,u=t.format??(t=>t+""),d="top"===e||"left"===e?-1:1,h=t.ticks.length-1,f=t.ticks.map((f,m)=>{const p=t.scale(f),y=o+d*r,g=o-d*i,x=y+d*a;let b;b=t.labelAnchor?t.labelAnchor:n?t.edgeAnchor&&0===m?"start":t.edgeAnchor&&m===h?"end":"middle":"left"===e?"end":"start";const w=n?"top"===e?"auto":"hanging":"middle",M=n?{x:p,y:x}:{x:x,y:p};return Tt("g",{children:[(r>0||i>0)&&Et("line",{...n?{x1:p,x2:p,y1:y,y2:g}:{x1:y,x2:g,y1:p,y2:p},stroke:i>0?l:c,strokeWidth:1,strokeDasharray:i>0?t.gridDasharray:void 0,opacity:i>0?.7:1}),Et("text",{x:M.x,y:M.y,textAnchor:b,dominantBaseline:w,fontSize:s,fontWeight:t.fontWeight,fill:c,children:u(f)})]},`tick-${f}-${m}`)});return Et("g",{className:t.className,style:{pointerEvents:"none"},children:f},t.keyId)}function Ot(t){const e=t.stroke??"var(--semiotic-text, #f4f4f8)",n=t.strokeWidth??1,o=t.markRadius??0,r=t.labelX-t.markX,i=t.labelY-t.markY,a=Math.hypot(r,i)||1,s=t.markX+r/a*o,c=t.markY+i/a*o;let l;return l="elbow"===t.connector?`M${s},${c} L${s},${t.labelY} L${t.labelX},${t.labelY}`:"curve"===t.connector?`M${s},${c} Q${(s+t.labelX)/2},${c} ${t.labelX},${t.labelY}`:`M${s},${c} L${t.labelX},${t.labelY}`,Tt("g",{className:t.className,style:{pointerEvents:"none"},children:[o>0&&Et("circle",{cx:t.markX,cy:t.markY,r:o,fill:"none",stroke:e,strokeWidth:n}),Et("path",{d:l,fill:"none",stroke:e,strokeWidth:n}),Et("text",{x:t.labelX,y:t.labelY,textAnchor:t.labelAnchor??"middle",dominantBaseline:t.labelBaseline??"hanging",fontSize:t.fontSize??11,fontWeight:t.fontWeight,fill:t.color??e,children:t.label})]},t.keyId)}import{jsx as Bt,jsxs as Ht}from"react/jsx-runtime";var Yt=new t(12);function Vt(t){if(null==t)return NaN;if("number"==typeof t)return t;if(t instanceof Date)return t.getTime();const e=t+"",n=Number(e);if(!Number.isNaN(n)&&""!==e.trim())return n;const o=Date.parse(e);return Number.isNaN(o)?NaN:o}function Xt(t,e,n){return e>t?e:t>n?n:t}var qt=t=>{const e=t.config||{},n=t.dimensions.plot,r=e.columnAccessor??"column",i=e.rowAccessor??"row",s=e.sizeAccessor,l=e.colorAccessor,d=e.symbolAccessor,f=e.shadeAccessor,m=e.markerAccessor,p=e.iconAccessor,y=e.defaultSymbol??"circle",[g,x]=e.sizeRange??[2,8],b=e.shadeStrength??.72,w=e.shadeReverse??!1,M=e.rowMode??"banded",v=e.cellSizing??"proportional",S=e.proportionExponent??1,z=e.columnGap??16,C=e.rowGap??12,I=e.packPadding??1,L=e.iterations??12,N=!1!==e.showEnclosures,W=!1!==e.showColumnHeaders,E=!1!==e.showRowLabels,T=W?e.headerHeight??26:0,R=E?e.labelWidth??66:0,P=e.callouts&&e.callouts.length>0?e.footerHeight??30:0,F=n.x+R,j=n.y+T,D=Math.max(1,n.width-R),O=Math.max(1,n.height-T-P),B=[];for(const e of t.nodes){const t=e.data??e;B.push({id:e.id,col:u(e,r,"—")+"",row:u(e,i,"—")+"",sizeVal:s?Number(u(e,s,1)):1,colorKey:l?u(e,l,"")+"":"",symVal:d?u(e,d,"")+"":"",shadeVal:f?Vt(u(e,f,null)):NaN,marker:!!m&&!!u(e,m,!1),iconVal:p?u(e,p,"")+"":"",datum:t,size:0,packR:0,baseShape:"circle",iconShape:null})}if(0===B.length)return{sceneNodes:[]};let H=1/0,Y=-1/0;if(s)for(const t of B)Number.isFinite(t.sizeVal)&&(H>t.sizeVal&&(H=t.sizeVal),t.sizeVal>Y&&(Y=t.sizeVal));e.sizeDomain&&([H,Y]=e.sizeDomain),Number.isFinite(H)&&Number.isFinite(Y)||(H=0,Y=1);const V=t=>{if(H>=Y)return(g+x)/2;const e=Math.sqrt(Xt((t-H)/(Y-H),0,1));return g+e*(x-g)};let X=1/0,q=-1/0;if(f)for(const t of B)Number.isFinite(t.shadeVal)&&(X>t.shadeVal&&(X=t.shadeVal),t.shadeVal>q&&(q=t.shadeVal));e.shadeDomain&&([X,q]=e.shadeDomain);const G=t=>{if(!f||!Number.isFinite(t)||X>=q)return.5;const e=Xt((t-X)/(q-X),0,1);return w?1-e:e},K=e.colorMap,U=new Map,_=(e,n)=>{let o=U.get(e);if(!o){const n=K&&K[e]||t.resolveColor(e);o=c(n,b),U.set(e,o)}return o(n)},Z=new Map;if(e.symbolMap)for(const[t,n]of Object.entries(e.symbolMap))Z.set(t,n);let Q=0;const J=e.iconMap,tt=t=>p&&J&&J[t]?J[t]:null,et=t=>p?"circle":(t=>{if(!d)return y;let e=Z.get(t);return e||(e=k[Q%k.length],Q++,Z.set(t,e)),e})(t.symVal),nt=e.maxAreaFraction??.4;let ot=0;const rt=Array(B.length),it=Array(B.length);for(let t=0;B.length>t;t++){const e=B[t],n=V(e.sizeVal);rt[t]=n,e.baseShape=et(e),e.iconShape=tt(e.iconVal);const o=$(e.baseShape,Math.PI*n*n);it[t]=o,ot+=Math.PI*o*o}const at=nt*D*O,st=ot>at?Math.sqrt(at/ot):1;for(let t=0;B.length>t;t++){const e=B[t],n=rt[t]*st;e.size=Math.PI*n*n,e.packR=it[t]*st}const ct=new Map,lt=new Map;for(const t of B)ct.set(t.col,(ct.get(t.col)??0)+1),lt.set(t.row,(lt.get(t.row)??0)+1);const ut=e.columnOrder?.filter(t=>ct.has(t))??[...ct.keys()].sort((t,e)=>(ct.get(e)??0)-(ct.get(t)??0)),dt=e.rowOrder?.filter(t=>lt.has(t))??[...lt.keys()].sort((t,e)=>(lt.get(e)??0)-(lt.get(t)??0)),ht=h([Math.round(n.x),Math.round(n.y),Math.round(n.width),Math.round(n.height),T,R,P,M,v,S,z,C,I,L,g,x,H,Y,nt,ut.join(","),dt.join(","),B.length,Kt(B)]),ft=Yt.getOrCompute(ht,()=>function(t,e){const n=new Map;for(const e of t){let t=n.get(e.col);t||(t=[],n.set(e.col,t)),t.push(e)}const o=e.columnOrder.filter(t=>n.has(t)),r=Math.max(1,e.innerW-e.columnGap*Math.max(0,o.length-1)),i=e.proportionExponent,s=o.map(t=>Math.pow(n.get(t).length,i)),c=s.reduce((t,e)=>t+e,0)||1,l=t=>"uniform"===e.cellSizing?r/o.length:s[t]/c*r,u=new Map,d=[];let h=e.innerX;for(let t=0;o.length>t;t++)d.push({col:o[t],x:h,w:l(t)}),h+=l(t)+e.columnGap;let f=1;const m=new Map,p=[],y=(t,e,n,o)=>{let r=m.get(t);r||(r={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},m.set(t,r)),r.minX>e-o&&(r.minX=e-o),e+o>r.maxX&&(r.maxX=e+o),r.minY>n-o&&(r.minY=n-o),n+o>r.maxY&&(r.maxY=n+o)},g=(t,n,o,r,i,a)=>{const s=t.map(t=>({id:t.id,r:t.packR})),c=function(t,e,n,o,r,i,a,s){const c=e+o/2,l=n+r/2,u=new Map,d=t.length;if(0===d)return u;if(1===d)return u.set(t[0].id,{px:c,py:l}),u;const h=function(t){let e=t>>>0||1;return()=>(e=Math.imul(e,1664525)+1013904223>>>0,e/4294967296)}(s),f=new Float64Array(d);let m=0;for(let e=0;d>e;e++)f[e]=t[e].r+i,f[e]>m&&(m=f[e]);const p=Math.max(1,Math.round(Math.sqrt(d*o/Math.max(1,r)))),y=new Float64Array(d),g=new Float64Array(d),x=o/p,b=r/Math.ceil(d/p);for(let t=0;d>t;t++){const o=t%p,r=Math.floor(t/p);y[t]=e+(o+.3+.4*h())*x,g[t]=n+(r+.3+.4*h())*b}const w=Math.max(0,Math.min(a,14)),M=Math.max(1,2*m),v=new Map,k=Math.max(1,Math.ceil(o/M)+3),$=(t,e)=>(e+1)*k+(t+1);for(let t=0;w>t;t++){v.clear();for(let t=0;d>t;t++){const o=$(Math.floor((y[t]-e)/M),Math.floor((g[t]-n)/M)),r=v.get(o);r?r.push(t):v.set(o,[t])}for(let t=0;d>t;t++){const o=Math.floor((y[t]-e)/M),r=Math.floor((g[t]-n)/M);for(let e=-1;1>=e;e++)for(let n=-1;1>=n;n++){const i=v.get($(o+e,r+n));if(i)for(let e=0;i.length>e;e++){const n=i[e];if(t>=n)continue;let o=y[n]-y[t],r=g[n]-g[t];const a=f[t]+f[n],s=o*o+r*r;if(a*a>s)if(s>1e-9){const e=Math.sqrt(s),i=(a-e)/2;o/=e,r/=e,y[t]-=o*i,g[t]-=r*i,y[n]+=o*i,g[n]+=r*i}else{const e=2.39996323*t;y[t]+=Math.cos(e)*f[t],g[t]+=Math.sin(e)*f[t]}}}}for(let t=0;d>t;t++){const i=f[t],a=e+i,s=e+o-i,u=n+i,d=n+r-i;y[t]=s>a?Xt(y[t],a,s):c,g[t]=d>u?Xt(g[t],u,d):l}}for(let e=0;d>e;e++)u.set(t[e].id,{px:y[e],py:g[e]});return u}(s,n,o,r,i,e.packPadding,e.iterations,f++);let l=1/0,d=1/0,h=-1/0,m=-1/0;for(const t of s){const e=c.get(t.id);u.set(t.id,{px:e.px,py:e.py}),y(a,e.px,e.py,t.r),l>e.px-t.r&&(l=e.px-t.r),e.px+t.r>h&&(h=e.px+t.r),d>e.py-t.r&&(d=e.py-t.r),e.py+t.r>m&&(m=e.py+t.r)}return Number.isFinite(l)?{x:l-Gt,y:d-Gt,w:h-l+2*Gt,h:m-d+2*Gt}:null};if("banded"===e.rowMode){const r=new Map;for(const e of t)r.set(e.row,(r.get(e.row)??0)+1);const s=e.rowOrder.filter(t=>r.has(t)),c=Math.max(1,e.innerH-e.rowGap*Math.max(0,s.length-1)),l=s.map(t=>Math.pow(r.get(t),i)),h=l.reduce((t,e)=>t+e,0)||1,f=new Map;let p=e.innerY+e.innerH;for(let t=0;s.length>t;t++){const n="uniform"===e.cellSizing?c/s.length:l[t]/h*c,o=p-n;f.set(s[t],{y:o,h:n}),p=o-e.rowGap}o.forEach((t,e)=>{const o=a(n.get(t),t=>t.row);for(const t of s){const n=o.get(t),r=f.get(t);n&&r&&g(n,d[e].x,r.y,d[e].w,r.h,t)}});const y=[],x=new Map;for(const t of s){const e=f.get(t);x.set(t,e.y+e.h/2);const n=m.get(t);n&&Number.isFinite(n.minX)&&y.push({x:n.minX-Gt,y:n.minY-Gt,w:n.maxX-n.minX+2*Gt,h:n.maxY-n.minY+2*Gt})}return{positions:u,enclosures:y,colBands:d,rowLabelY:x}}const x=new Map;o.forEach((t,o)=>{const r=a(n.get(t),t=>t.row),s=e.rowOrder.filter(t=>r.has(t)),c=Math.max(1,e.innerH-e.rowGap*Math.max(0,s.length-1)),l=s.map(t=>Math.pow(r.get(t).length,i)),u=l.reduce((t,e)=>t+e,0)||1;let h=e.innerY+e.innerH;s.forEach((t,n)=>{const i="uniform"===e.cellSizing?c/s.length:l[n]/u*c,a=h-i,f=g(r.get(t),d[o].x,a,d[o].w,i,t);if(f){p.push(f);const e=x.get(t)??{sum:0,n:0};e.sum+=f.y+f.h/2,e.n+=1,x.set(t,e)}h=a-e.rowGap})});const b=new Map;for(const[t,e]of x)b.set(t,e.sum/e.n);return{positions:u,enclosures:p,colBands:d,rowLabelY:b}}(B,{columnOrder:ut,rowOrder:dt,innerX:F,innerY:j,innerW:D,innerH:O,rowMode:M,cellSizing:v,proportionExponent:S,columnGap:z,rowGap:C,packPadding:I,iterations:L})),mt=t.selection,pt=mt?.isActive?mt.predicate:null,yt=e.highlight??null,gt=e.dimOpacity??.16,xt=e.markStroke,bt=e.markStrokeWidth??0,wt=e.markerColor??"#ffffff",Mt=e.iconColor??"rgba(255,255,255,0.92)",vt=e.iconStrokeWidth??1,kt=e.iconScale??.72,$t=[],At=[],St=[];for(const t of B){const e=ft.positions.get(t.id);if(!e)continue;const n=o(t.datum,{highlight:yt,predicate:pt,dimOpacity:gt}),r={type:"symbol",cx:e.px,cy:e.py,size:t.size,symbolType:t.baseShape,style:{fill:_(t.colorKey,G(t.shadeVal)),opacity:n,...xt?{stroke:xt,strokeWidth:bt}:{}},datum:t.datum,id:t.id,label:t.id+""};if($t.push(r),t.iconShape){const o=Math.sqrt(t.size/Math.PI)*kt,r=$(t.iconShape,100);St.push({x:e.px,y:e.py,size:r>0?o/r*100*(o/r):Math.PI*o*o,shape:t.iconShape,opacity:n})}t.marker&&n>gt+.001&&At.push({x:e.px,y:e.py,r:Math.max(1,.4*Math.sqrt(t.size/Math.PI))})}const zt=[];if(e.callouts&&e.callouts.length>0){const t=e.calloutColor??"var(--semiotic-text, #f4f4f8)",o=n.y+n.height-(P>0?.45*P:9),r=[];for(let t=0;e.callouts.length>t;t++){const n=e.callouts[t],o=B.find(t=>t.datum[n.field]+""==n.value+"");if(!o)continue;const i=ft.positions.get(o.id);i&&r.push({c:n,ci:t,px:i.px,py:i.py,markR:Math.sqrt(o.size/Math.PI)})}const i=r.filter(t=>null==t.c.at).sort((t,e)=>t.px-e.px),a=new Map;i.forEach((t,e)=>{a.set(t.ci,F+(e+.5)/i.length*D)});for(const e of r){const r=e.c;let i=a.get(e.ci)??e.px,s=o;const c=r.connector??(a.has(e.ci)?"elbow":"straight");"object"==typeof r.at&&r.at?(i=r.at.x,s=r.at.y):"number"==typeof r.at&&(s=n.y+r.at*n.height),zt.push({keyId:"callout-"+e.ci,markX:e.px,markY:e.py,labelX:i,labelY:s,label:r.label,connector:c,markRadius:Math.max(e.markR+3,7),stroke:t,color:t,fontSize:11,labelAnchor:"middle",labelBaseline:"auto"})}}const Ct=function(t,e){const n=e.columnLabel??(t=>t),o=e.rowLabel??(t=>t);return Ht("g",{className:"packed-cluster-matrix-chrome",style:{pointerEvents:"none"},children:[e.showEnclosures&&t.enclosures.map((t,n)=>Rt({keyId:"enc-"+n,x:t.x,y:t.y,width:t.w,height:t.h,radius:e.enclosureRadius,stroke:e.enclosureColor,strokeWidth:e.enclosureWidth,opacity:e.enclosureOpacity})),e.iconMarks.length>0&&Bt("g",{className:"packed-cluster-matrix-icons",children:e.iconMarks.map((t,n)=>Bt("path",{d:A(t.shape,t.size),transform:`translate(${t.x},${t.y})`,fill:"none",stroke:e.iconColor,strokeWidth:e.iconStrokeWidth,opacity:t.opacity},"ic-"+n))}),e.markerDots.length>0&&Bt("g",{className:"packed-cluster-matrix-markers",children:e.markerDots.map((t,n)=>Bt("circle",{cx:t.x,cy:t.y,r:t.r,fill:e.markerColor},"mk-"+n))}),e.showColumnHeaders&&t.colBands.map((t,o)=>Ft({keyId:"col-"+o,text:n(t.col),x:t.x+t.w/2,y:e.headerY,anchor:"middle",fontSize:e.headerFontSize,fontWeight:700,color:e.headerColor})),e.showRowLabels&&[...t.rowLabelY].map(([t,n])=>Ft({keyId:"row-"+t,text:o(t),x:e.labelX,y:n,anchor:"end",fontSize:e.labelFontSize,fontWeight:600,color:e.labelColor})),e.callouts.map(t=>Ot(t))]})}(ft,{markerDots:At,markerColor:wt,iconMarks:St,iconColor:Mt,iconStrokeWidth:vt,callouts:zt,plot:n,showEnclosures:N,showColumnHeaders:W,showRowLabels:E,enclosureColor:e.enclosureColor??"var(--semiotic-text, #f4f4f8)",enclosureRadius:e.enclosureRadius??9,enclosureOpacity:e.enclosureOpacity??.5,enclosureWidth:e.enclosureWidth??1.5,headerColor:e.headerColor??"var(--semiotic-text, #f4f4f8)",labelColor:e.labelColor??"var(--semiotic-text-secondary, #b9b9c8)",headerFontSize:e.headerFontSize??13,labelFontSize:e.labelFontSize??11,headerY:n.y+.62*T,labelX:n.x+R-10,columnLabel:e.columnLabel,rowLabel:e.rowLabel});return{sceneNodes:$t,overlays:Ct}},Gt=4;function Kt(t){let e=2166136261;const n=t=>{for(let n=0;t.length>n;n++)e^=t.charCodeAt(n),e=Math.imul(e,16777619)};for(const o of t)n(o.id),n(o.col),n(o.row),e^=Math.round(8*o.packR),e=Math.imul(e,16777619);return(e>>>0).toString(36)}import*as Ut from"react";var _t=t=>{const n=t.config,{plot:o}=t.dimensions;if(0>=o.width||0>=o.height)return{nodes:[]};const r=d(n.categoryAccessor),i=d(n.stackBy),a=t=>{const e="function"==typeof n.valueAccessor?n.valueAccessor(t):t[n.valueAccessor],o=Number(e);return Number.isFinite(o)&&o>0?o:0},s=n.gutter??2,c="string"==typeof n.categoryAccessor?n.categoryAccessor:"category",l="string"==typeof n.stackBy?n.stackBy:"stack",u="string"==typeof n.valueAccessor?n.valueAccessor:"value",h=(t,n,o)=>e(e=>{e("category",t),e("stack",n),e("value",o),"category"!==c&&e(c,t),"stack"!==l&&e(l,n),"value"!==u&&e(u,o)}),f=!1!==n.showCategoryLabels,m=Math.max(0,o.height-(n.labelPadding??(f?22:0))),p=[],y=new Map,g=[],x=new Set,b=new Map;for(const e of t.data){const t=r(e)+"",n=i(e)+"",o=a(e);y.has(t)||(p.push(t),y.set(t,0),b.set(t,new Map)),x.has(n)||(x.add(n),g.push(n)),y.set(t,(y.get(t)??0)+o);const s=b.get(t);s.set(n,(s.get(n)??0)+o)}const w=n.categoryOrder?Zt(n.categoryOrder,p,t=>y.has(t)):p,M=n.stackOrder?Zt(n.stackOrder,g,()=>!0):g,v=w.reduce((t,e)=>t+(y.get(e)??0),0);if(0>=v)return{nodes:[]};const k=Math.max(0,o.width-s*Math.max(0,w.length-1)),$=[],A=[];let S=o.x;for(const e of w){const n=y.get(e)??0,r=n/v*k;if(0>=r)continue;A.push({cat:e,x:S,w:r});const i=b.get(e);let a=o.y;for(const o of M){const s=i.get(o)??0;if(0>=s)continue;const c=s/n*m;$.push({type:"rect",x:S,y:a,w:r,h:c,style:{fill:t.resolveColor(o),stroke:"none"},datum:h(e,o,s),group:o}),a+=c}S+=r+s}return{nodes:$,overlays:f&&A.length>0?function(t,e,n){const o=t.map((t,o)=>Ft({keyId:"marimekko-label-"+o,text:t.cat,x:t.x+t.w/2,y:e+12,anchor:"middle",baseline:"auto",maxWidth:t.w-4,fontSize:12,color:n}));return Ut.createElement(Ut.Fragment,null,...o)}(A,o.y+m+4,`var(--semiotic-text, ${t.theme.semantic.text??"currentColor"})`):null}};function Zt(t,e,n){const o=new Set,r=[];for(const e of t)n(e)&&!o.has(e)&&(o.add(e),r.push(e));for(const t of e)o.has(t)||r.push(t);return r}import*as Qt from"react";var Jt=t=>{const n=t.config,{plot:o}=t.dimensions;if(0>=o.width||0>=o.height||0===t.data.length)return{nodes:[]};const r=n.rowHeight??28,i=n.rowGap??12,a=!1!==n.showLabels,s=a?n.labelWidth??120:0,c=!1!==n.showTicks,l=c?14:0,u=n.tickFormat??(t=>t.toLocaleString()),h=o.x+s,f=Math.max(0,o.width-s);if(0>=f)return{nodes:[]};const m=d(n.categoryAccessor),p=t=>{const e=Number(t);return Number.isFinite(e)&&e>0?e:0},y=t=>p("function"==typeof n.valueAccessor?n.valueAccessor(t):t[n.valueAccessor]),g=t=>p("function"==typeof n.targetAccessor?n.targetAccessor(t):t[n.targetAccessor]),x=t=>{const e="function"==typeof n.rangesAccessor?n.rangesAccessor(t):t[n.rangesAccessor];return Array.isArray(e)?e.map(p).sort((t,e)=>t-e):[]},b="string"==typeof n.categoryAccessor?n.categoryAccessor:"metric",w="string"==typeof n.valueAccessor?n.valueAccessor:"value",M="string"==typeof n.targetAccessor?n.targetAccessor:"target",v=n.actualColor??t.theme.semantic.primary??"#3b6cb1",k=t.theme.semantic.text??"currentColor",$=n.targetColor??`var(--semiotic-text, ${k})`,A=[`var(--semiotic-surface, ${t.theme.semantic.surface??"#e8eaed"})`,`var(--semiotic-grid, ${t.theme.semantic.grid??"#cdd1d6"})`,`var(--semiotic-border, ${t.theme.semantic.border??"#a3a8af"})`],S=`var(--semiotic-text, ${k})`,z=`var(--semiotic-text-secondary, ${t.theme.semantic.textSecondary??"#888"})`,C=[],I=[];for(let n=0;t.data.length>n;n++){const a=t.data[n],s=x(a),c=y(a),u=g(a),d=Math.max(c,u,...s.length?s:[0]);if(0>=d)continue;const p=o.y+n*(r+i+l);if(p+r+l>o.y+o.height)break;I.push({yTop:p,label:m(a),actual:c,target:u,maxVal:d});const k=t=>h+t/d*f,S=m(a),z=t=>e(e=>{e("metric",S),"metric"!==b&&e(b,S),t(e)});let L=h;for(let t=0;s.length>t;t++){const e=k(s[t]),n=e-L;n>0&&C.push({type:"rect",x:L,y:p,w:n,h:r,style:{fill:A[Math.min(t,A.length-1)],stroke:"none"},datum:z(e=>{e("range",t),e("rangeValue",s[t]),e("kind","range")}),group:"range-"+t}),L=e}const N=Math.max(6,Math.floor(.45*r));C.push({type:"rect",x:h,y:p+(r-N)/2,w:k(c)-h,h:N,style:{fill:v,stroke:"none"},datum:z(t=>{t("value",c),t("kind","actual"),"value"!==w&&t(w,c)}),group:"actual"});const W=3,E=Math.floor(.8*r);C.push({type:"rect",x:k(u)-W/2,y:p+(r-E)/2,w:W,h:E,style:{fill:$,stroke:"none"},datum:z(t=>{t("target",u),t("kind","target"),"target"!==M&&t(M,u)}),group:"target"})}const L=[];for(let t=0;I.length>t;t++){const e=I[t];if(a&&L.push(Ft({keyId:"bullet-label-"+t,text:e.label,x:o.x+s-8,y:e.yTop+r/2,anchor:"end",baseline:"middle",fontSize:13,fontWeight:500,color:S})),c){const n=5,o=e.yTop+r+2;for(let r=0;n>r;r++){const i=e.maxVal*r/(n-1),a=h+i/e.maxVal*f;L.push(Qt.createElement("line",{key:`bullet-tick-${t}-${r}`,x1:a,x2:a,y1:o,y2:o+3,stroke:z,strokeWidth:1}),Ft({keyId:`bullet-ticktext-${t}-${r}`,text:u(i),x:a,y:o+12,anchor:0===r?"start":r===n-1?"end":"middle",baseline:"auto",fontSize:10,color:z}))}}}return{nodes:C,overlays:L.length>0?Qt.createElement(Qt.Fragment,null,...L):null}};import*as te from"react";import{scaleLinear as ee}from"d3-scale";var ne=t=>{const e=t.config,{plot:n}=t.dimensions,r=e.fields??[];if(2>r.length||0>=n.width||0>=n.height)return{nodes:[]};if(0===t.data.length)return{nodes:[]};const i={};for(const n of r){if(e.domains?.[n]){i[n]=e.domains[n];continue}let o=1/0,r=-1/0;for(const e of t.data){const t=Number(e[n]);Number.isFinite(t)&&(o>t&&(o=t),t>r&&(r=t))}i[n]=Number.isFinite(o)&&Number.isFinite(r)&&o!==r?[o,r]:[0,1]}const a=!1!==e.showAxes,s=a?e.axisLabelPadding??24:8,c=a?18:8,l=r.map(t=>ee().domain(i[t]).range([n.y+n.height-c,n.y+s])),u=r.map((t,e)=>1===r.length?n.x+n.width/2:n.x+e/(r.length-1)*n.width),d=e.colorBy?"function"==typeof e.colorBy?e.colorBy:t=>(t[e.colorBy]??"")+"":null,h=e.opacity??.45,f=e.strokeWidth??1.25,m=t.theme.semantic.primary??"#3b6cb1",p=e.dimmedOpacity??.08,y=e.highlightFn,g=[],x=[];for(const n of t.data){const i=d?t.resolveColor(d(n)+""):m,a=!y||y(n),s=o(n,{predicate:y,baseOpacity:h,dimOpacity:p,brighten:.4}),c=a?x:g;for(let t=0;r.length-1>t;t++){const e=Number(n[r[t]]),o=Number(n[r[t+1]]);if(!Number.isFinite(e)||!Number.isFinite(o))continue;const d={type:"connector",x1:u[t],y1:l[t](e),x2:u[t+1],y2:l[t+1](o),style:{stroke:i,strokeWidth:y&&a?f+.75:f,opacity:s,fill:"none"},datum:n};c.push(d)}if(e.showPoints)for(let t=0;r.length>t;t++){const e=Number(n[r[t]]);if(!Number.isFinite(e))continue;const o={type:"point",x:u[t],y:l[t](e),r:2.5,style:{fill:i,stroke:"none",opacity:Math.min(1,s+.3)},datum:n};c.push(o)}}let b=null;if(a){const o=`var(--semiotic-border, ${t.theme.semantic.border??"#aaa"})`,a=`var(--semiotic-text, ${t.theme.semantic.text??"currentColor"})`,d=`var(--semiotic-text-secondary, ${t.theme.semantic.textSecondary??"#888"})`,h=n.y+s,f=n.y+n.height-c,m=[];for(let t=0;r.length>t;t++){const c=r[t],p=u[t],y=e.tickFormat?.[c]??(t=>t.toLocaleString());m.push(te.createElement("line",{key:"pc-axis-line-"+t,x1:p,x2:p,y1:h,y2:f,stroke:o,strokeWidth:1})),m.push(Ft({keyId:"pc-axis-label-"+t,text:c,x:p,y:n.y+s-8,anchor:"middle",baseline:"auto",fontSize:12,fontWeight:600,color:a}));const[g,x]=i[c],b=5;for(let e=0;b>e;e++){const n=g+(x-g)*e/(b-1),r=l[t](n);m.push(te.createElement("line",{key:`pc-tick-${t}-${e}`,x1:p-3,x2:p+3,y1:r,y2:r,stroke:o,strokeWidth:1}),Ft({keyId:`pc-ticktext-${t}-${e}`,text:y(n),x:p+6,y:r+3,anchor:"start",baseline:"auto",fontSize:10,color:d}))}}b=te.createElement(te.Fragment,null,...m)}return{nodes:g.concat(x),overlays:b}};import{jsx as oe,jsxs as re}from"react/jsx-runtime";var ie=1.75,ae="#222222";function se(t,e){return t.topRadius+(e-t.height)/t.height*(t.topRadius-t.bottomRadius)}function ce(t,e){return function(t,e,n){return Math.PI*n/3*(t*t+t*e+e*e)}(se(t,e),t.bottomRadius,e)}function le(t,e){const n=(t.topRadius+t.bottomRadius)/2,o=Math.PI*n*n;let r=e/o,i=e-ce(t,r),a=0;for(;100>a&&Math.abs(i)>1e-4;)r+=i/o,i=e-ce(t,r),a++;return r}function ue(t,e){const n=43758.5453*Math.sin(12.9898*t+78.233);return 2*(n-Math.floor(n)-.5)*e}function de(t,e){if(e>t||2*e>t)return[{x:0,y:0}];const n=[],o=t=>{let r=Math.floor(2*Math.PI*t/(2*e));1>r&&(r=1);const i=0*t,a=Math.hypot(1*t-t*Math.cos(2*Math.PI/r),i-t*Math.sin(2*Math.PI/r));2*e>a&&r>1&&r--;for(let e=0;r>e;e++)n.push({x:t*Math.cos(2*e*Math.PI/r),y:t*Math.sin(2*e*Math.PI/r)});const s=t-2*e;e>s?t>2*e&&n.push({x:0,y:0}):o(s)};return o(t-e),n}function he(t,e,n){const o=[];let r=n,i=0;for(;r>0&&60>i;){const n=e*(1+2*i),a=de(se(t,n),e),s=a.length-r,c=s>1?a.slice(Math.floor(s/2),Math.floor(s/2)+r):a,l=t.height-n;if(c.forEach((t,e)=>{o.push({x:t.x+ue(97*i+e,.15),z:l+ue(31*i+e,.05)})}),r-=c.length,i++,0===c.length)break}return{pearls:o,layers:i}}function fe(t,e,n,o){if(0>=o)return[];const r=function(t,e,n){let o=n,r=0;for(;o>0&&60>r;){const n=se(t,e+.875*(1+2*r));o-=Math.max(1,Math.floor(2*n/ie)),r++}return r}(t,e,o),i=Math.max(e,n-r*ie)+.875,a=[];let s=0;for(let e=0;r>e&&o>s;e++){const n=i+ie*e,r=se(t,n),c=Math.max(1,Math.floor(2*r/ie)),l=(2*r-c*ie)/(c+1),u=-r+l,d=t.height-n-.875-.1;for(let t=0;c>t&&o>s;t++)a.push({cx:u+(l+ie)*t+.875,cy:d+.875,rotation:ue(53*e+t,10)}),s++}return a}function me(t,e){const n=Number(t);return Number.isFinite(n)?n:e}var pe=t=>{const e=t.config,{plot:o}=t.dimensions;if(0>=o.width||0>=o.height)return{nodes:[]};const r=d(e.categoryAccessor??"name"),i=d(e.teaVolumeAccessor??"teaVolume"),a=d(e.bobaVolumeAccessor??"bobaVolume"),s=d(e.iceVolumeAccessor??"iceVolume"),c=d(e.cupHeightAccessor??"cupHeight"),l=d(e.cupTopRadiusAccessor??"cupTopRadius"),u=d(e.cupBottomRadiusAccessor??"cupBottomRadius"),h=d(e.bobaRadiusAccessor??"bobaRadius"),m=e.cupWidthRatio??.82,p=t.scales.o,y=p.bandwidth(),g=Math.max(1,o.height-26-8),x=o.y+8,b=[],w=[];for(const e of t.data){const o=r(e)+"",d=p(o);if(null==d)continue;const M={height:me(c(e),15.5),topRadius:me(l(e),4.75),bottomRadius:me(u(e),3.75)},v=me(h(e),.6),k=Math.max(0,me(i(e),450)),$=Math.max(0,me(a(e),110)),A=Math.max(0,me(s(e),135)),S=Math.PI*v*v,z=Math.floor($/S),C=z*S,I=Math.floor(A/5.359375),L=I*ie*ie*ie,N=k+C+L,W=le(M,N),E=Math.min(M.height,Math.max(0,W)),T=se(M,E),{pearls:R,layers:P}=he(M,v,z),F=E,j=fe(M,P*v*2,F,I),D=M.height-20.32,O=Math.min(0,D),B=Math.min(y*m/(2*(M.topRadius+1)),g/(M.height-O)),H=d+y/2,Y=t=>H+t*B,V=t=>x+(t-O)*B,X=Y(-(M.topRadius+1)),q=Y(M.topRadius+1),G=V(O),K=V(M.height),U=n({name:o,teaVolume:k,bobaVolume:Math.round(C),iceVolume:Math.round(L),totalVolume:Math.round(N),numBobas:z,numIce:I,kind:"boba cup"});b.push({type:"rect",x:X,y:G,w:Math.max(1,q-X),h:Math.max(1,K-G),style:{fill:"rgba(0,0,0,0)",stroke:"none"},datum:U,group:o,_transitionKey:"boba-"+f(o)});const _=M.height-F,Z=f(o),Q=t.resolveColor(o);w.push(re("g",{children:[k>0?oe("path",{d:`M${Y(-T)},${V(_)} L${Y(-M.bottomRadius)},${V(M.height)} L${Y(M.bottomRadius)},${V(M.height)} L${Y(T)},${V(_)} z`,fill:"#D2B799"}):null,R.map((t,e)=>oe("circle",{cx:Y(t.x),cy:V(t.z),r:v*B,fill:"#222222",opacity:.5},"p-"+e)),j.map((t,e)=>oe("rect",{x:Y(t.cx)-.95*ie*B/2,y:V(t.cy)-.95*ie*B/2,width:.95*ie*B,height:.95*ie*B,rx:2,fill:"#a5f2f3",opacity:.85,transform:`rotate(${t.rotation} ${Y(t.cx)} ${V(t.cy)})`},"i-"+e)),oe("path",{d:`M${Y(-M.topRadius)},${V(0)} L${Y(-M.bottomRadius)},${V(M.height)} L${Y(M.bottomRadius)},${V(M.height)} L${Y(M.topRadius)},${V(0)}`,fill:"none",stroke:ae,strokeWidth:2.5}),oe("line",{x1:Y(-(M.topRadius+1)),y1:V(0),x2:Y(M.topRadius+1),y2:V(0),stroke:ae,strokeWidth:3,strokeLinecap:"round"}),k>0?oe("path",{d:`M${Y(-.635)},${V(D)} L${Y(-.635)},${V(M.height-.4)} L${Y(.635)},${V(M.height-1.27-.4)} L${Y(.635)},${V(D)} z`,fill:"#4F91CB",stroke:ae,strokeWidth:1,opacity:.78}):null,oe("text",{x:H,y:K+16,textAnchor:"middle",fontSize:12,fontWeight:600,fill:"var(--semiotic-text, #333)",children:o}),oe("text",{x:H,y:K+30,textAnchor:"middle",fontSize:10,fill:Q,children:`${z} pearls · ${Math.round(N)} cm³`})]},"boba-"+Z))}return{nodes:b,overlays:oe("g",{className:"semiotic-boba",style:{pointerEvents:"none"},children:w})}};import*as ye from"react";function ge(t,e){if("function"==typeof t)return t;const n=t??e;return t=>Number(t[n])}function xe(t,e={}){const n=ge(e.start,"start"),o=ge(e.end,"end"),r=!1===e.sort?t.slice():t.slice().sort((t,e)=>n(t)-n(e)||o(e)-o(t)),i=[];return{packed:r.map(t=>{const e=n(t);let r=i.findIndex(t=>e>=t);return-1===r&&(r=i.length),i[r]=o(t),{item:t,track:r}}),trackCount:Math.max(1,i.length)}}function be(t,e){const n=ge(e.start,"start"),o=ge(e.end,"end"),[r,i]=e.domain,a=e.step??1,s="half-open"===e.bounds,c=[];for(let e=r;i>=e;e+=a){let r=0;for(const i of t){const t=n(i),a=o(i);t>e||(s?e>=a:e>a)||r++}c.push({value:e,count:r})}return c}function we(t){return"function"==typeof t?t:e=>e[t]}var Me=t=>{const e=t.config,{plot:n}=t.dimensions;if(0>=n.width||0>=n.height||0===t.data.length||!e?.domain)return{nodes:[]};const o=we(e.laneAccessor),r=we(e.startAccessor),i=we(e.endAccessor),a=e.idAccessor?we(e.idAccessor):null,s=e.unit??0,c=e.barGap??1.5,l=Math.max(0,e.minBarWidth??2),u=e.minBarHeight??3.5,d=e.maxBarHeight??10,h=e.lanePadding??7,f=e.cornerRadius??2,m=e.bottomInset??0,p=e.color??((e,n)=>t.resolveColor(n)),[y,g]=e.domain,x=g-y||1,b=t=>n.x+(t-y)/x*n.width,w=t.scales?.o?.domain?.()??[],M=e.lanes??(w.length>0?w:[...new Set(t.data.map(o))]),v=Math.max(0,n.height-m)/Math.max(1,M.length),k=t=>b(r(t)),$=t=>Math.max(k(t)+l,b(i(t)+s)),A=[];M.forEach((e,r)=>{const i=n.y+r*v,s=t.data.filter(t=>o(t)===e);if(0===s.length)return;const{packed:l,trackCount:m}=xe(s,{start:k,end:$}),y=new Map,g=new Map;for(const{item:t,track:e}of l){const n=g.get(e);n?n.push(t):g.set(e,[t])}for(const t of g.values()){t.sort((t,e)=>k(t)-k(e));for(let e=0;t.length-1>e;e++)y.set(t[e],k(t[e+1]))}const x=(v-2*h)/m,b=Math.min(d,Math.max(Math.min(u,x),x-c));for(const{item:t,track:n}of l){const o=k(t),r=y.get(t),s=$(t)-o;A.push({type:"rect",x:o,y:i+h+n*x,w:void 0!==r&&o+s>r-1?Math.max(1,r-1-o):s,h:b,cornerRadii:f>0?{tl:f,tr:f,br:f,bl:f}:void 0,style:{fill:p(t,e),stroke:"none"},datum:t,group:e,_transitionKey:a?a(t)+"":void 0})}});const S=`var(--semiotic-text, ${t.theme.semantic.text??"#1a1a1a"})`,z=`var(--semiotic-text-secondary, ${t.theme.semantic.textSecondary??"#888"})`,C=`var(--semiotic-border, ${t.theme.semantic.border??"#94a3b8"})`,I=[];(e.periods??[]).forEach((t,e)=>{const o=b(t.start),r=Math.max(1,b(t.end+s)-o);I.push(ye.createElement("rect",{key:"period-"+e,x:o,y:n.y,width:r,height:n.height,fill:C,opacity:e%2==0?.06:.025,pointerEvents:"none"})),t.name&&I.push(Ft({keyId:"period-label-"+e,text:t.name,x:o+4,y:n.y+12,anchor:"start",baseline:"hanging",fontSize:13,fontWeight:700,color:z}))});const L=!1!==e.showLaneLabels,N=e.laneLabelGap??12;if(M.forEach((t,e)=>{const o=n.y+e*v;I.push(ye.createElement("line",{key:"lane-sep-"+e,x1:n.x,x2:n.x+n.width,y1:o,y2:o,stroke:C,opacity:.45})),L&&I.push(Ft({keyId:"lane-label-"+e,text:t,x:n.x-N,y:o+v/2,anchor:"end",baseline:"middle",fontSize:12,fontWeight:600,color:S}))}),!1!==e.showAxis){const t=e.axisTicks??Array.from({length:8},(t,e)=>Math.round(y+e/7*x));I.push(Dt({keyId:"interval-axis",scale:b,ticks:t,orient:"top",offset:n.y,tickLength:0,gridLength:n.height,gridDasharray:"3 5",edgeAnchor:!0,format:e.tickFormat,color:z}))}return{nodes:A,overlays:ye.createElement(ye.Fragment,null,...I)}};function ve(t,e,n){const o=n?.orientation??"vertical",r=n?.bend??0,i=n?.minAlong??18,a=(t,e)=>(t+e)/2;if("vertical"===o){if(i>Math.abs(e.y-t.y)){const n=t.x>e.x?-1:1,o=a(t.x,e.x)+n*(22+Math.abs(r));return`M${t.x},${t.y} Q${o},${a(t.y,e.y)} ${e.x},${e.y}`}const n=a(t.y,e.y)+r;return`M${t.x},${t.y} C${t.x},${n} ${e.x},${n} ${e.x},${e.y}`}if(i>Math.abs(e.x-t.x)){const n=t.y>e.y?-1:1,o=a(t.y,e.y)+n*(22+Math.abs(r));return`M${t.x},${t.y} Q${a(t.x,e.x)},${o} ${e.x},${e.y}`}const s=a(t.x,e.x)+r;return`M${t.x},${t.y} C${s},${t.y} ${s},${e.y} ${e.x},${e.y}`}function ke(t,e,n){if("vertical"===(n?.orientation??"vertical")){const n=(t.y+e.y)/2;return`M${t.x},${t.y} L${t.x},${n} L${e.x},${n} L${e.x},${e.y}`}const o=(t.x+e.x)/2;return`M${t.x},${t.y} L${o},${t.y} L${o},${e.y} L${e.x},${e.y}`}function $e(t,e,n){if("vertical"===(n?.orientation??"vertical")){const n=e.cy>=t.cy;return{from:{x:t.cx,y:t.cy+(n?t.height/2:-t.height/2)},to:{x:e.cx,y:e.cy+(n?-e.height/2:e.height/2)}}}const o=e.cx>=t.cx;return{from:{x:t.cx+(o?t.width/2:-t.width/2),y:t.cy},to:{x:e.cx+(o?-e.width/2:e.width/2),y:e.cy}}}function Ae(t,e){const n=e?.spread??5;return e?.modulo&&e.modulo>0?(t%e.modulo-(e.modulo-1)/2)*n:(t-((e?.count??1)-1)/2)*n}function Se(t,e){const n=1-e,o=n*n*n,r=3*n*n*e,i=3*n*e*e,a=e*e*e;return{x:o*t.p0.x+r*t.p1.x+i*t.p2.x+a*t.p3.x,y:o*t.p0.y+r*t.p1.y+i*t.p2.y+a*t.p3.y}}function ze(t,e){const n=1-e,o=3*n*n,r=6*n*e,i=3*e*e;return{x:o*(t.p1.x-t.p0.x)+r*(t.p2.x-t.p1.x)+i*(t.p3.x-t.p2.x),y:o*(t.p1.y-t.p0.y)+r*(t.p2.y-t.p1.y)+i*(t.p3.y-t.p2.y)}}function Ce(t){return`M${t.p0.x},${t.p0.y} C${t.p1.x},${t.p1.y} ${t.p2.x},${t.p2.y} ${t.p3.x},${t.p3.y}`}function Ie(t,e){const n=e?.axis??"x",o=e?.padding??0,r=e?.strength??.5,i="x"===n?"y":"x",a="x"===n?"width":"height",s="x"===n?"height":"width",c=new Map;for(const e of t)c.set(e.id,0);for(let e=0;t.length>e;e++)for(let l=e+1;t.length>l;l++){const u=t[e],d=t[l];if(Math.abs(u[i]-d[i])>(u[s]+d[s])/2+o)continue;const h=d[n]-u[n]||(d.id>u.id?-.5:.5),f=(u[a]+d[a])/2+o-Math.abs(h);if(0>=f)continue;const m=f*r*Math.sign(h);c.set(u.id,(c.get(u.id)??0)-m),c.set(d.id,(c.get(d.id)??0)+m)}return c}var Le={width:60,height:34};function Ne(t,e){if("function"==typeof t)return t;const n=t??e;return t=>u(t,n,void 0)}function We(t,e,n,o){const r=o.fixedAxis??"y",i=t=>Ne(o.sourceAccessor,"source")(t)+"",a=t=>Ne(o.targetAccessor,"target")(t)+"",s=o.size??(()=>Le),c=o.iterations??180,l=o.attraction??.012,u=o.anchorStrength??.003,d=o.collisionStrength??.12,h=o.collisionPadding??15,f=o.edgePadding??42,p=o.fixedPadding??16,y=o.damping??.72,g=o.spread??1,[x,b]=o.fixedDomain,w=b-x||1,M=("y"===r?n.y:n.x)+p,v=("y"===r?n.y+n.height:n.x+n.width)-p,k=("y"===r?n.x:n.y)+f,$=("y"===r?n.x+n.width:n.y+n.height)-f,A=Math.max(1,$-k),S=t.map(t=>{const e=m(t)??t,n=(r=t,Ne(o.idAccessor,"id")(r)+"");var r;const{width:i,height:a}=s(e),c=(t=>Number(Ne(o.fixedAccessor,"fixed")(t)))(t),l=k+function(t){let e=2166136261;for(let n=0;t.length>n;n++)e^=t.charCodeAt(n),e=Math.imul(e,16777619);return(e>>>0)/4294967295}(n)*A;return{data:e,id:n,width:i,height:a,fixedValue:c,fixed:(u=c,M+(u-x)/w*(v-M)),free:l,anchor:l};var u}),z=new Map(S.map(t=>[t.id,t])),C=t=>"y"===r?t.width:t.height;for(let t=0;c>t;t++){const t=new Map;for(const e of S)t.set(e.id,0);for(const n of e){const e=z.get(i(n)),o=z.get(a(n));if(!e||!o)continue;const r=(o.free-e.free)*l;t.set(e.id,(t.get(e.id)??0)+r),t.set(o.id,(t.get(o.id)??0)-r)}for(const e of S)t.set(e.id,(t.get(e.id)??0)+(e.anchor-e.free)*u);const n=Ie(S.map(t=>({id:t.id,x:"y"===r?t.free:t.fixed,y:"y"===r?t.fixed:t.free,width:t.width,height:t.height})),{axis:"y"===r?"x":"y",padding:h,strength:d});for(const e of S)t.set(e.id,(t.get(e.id)??0)+(n.get(e.id)??0));for(const e of S){e.free+=(t.get(e.id)??0)*y;const n=C(e)/2;e.free=Math.max(k+n,Math.min($-n,e.free))}}if(1!==g){const t=(k+$)/2;for(const e of S){const n=C(e)/2;e.free=Math.max(k+n,Math.min($-n,t+(e.free-t)*g))}}const I=S.map(t=>({data:t.data,id:t.id,x:"y"===r?t.free:t.fixed,y:"y"===r?t.fixed:t.free,width:t.width,height:t.height,fixedValue:t.fixedValue}));return{positioned:I,byId:new Map(I.map(t=>[t.id,t]))}}var Ee=t=>{const{plot:e}=t.dimensions;if(0>=e.width||0>=e.height||0===t.nodes.length||!t.config?.fixedDomain)return{sceneNodes:[]};const n=t.config.fixedAxis??"y",{positioned:o,byId:r}=We(t.nodes,t.edges,e,t.config),i=o.map(e=>({type:"rect",x:e.x-e.width/2,y:e.y-e.height/2,w:e.width,h:e.height,style:{fill:t.resolveColor(e.id),stroke:"none"},datum:e.data,id:e.id,label:e.id})),a=[];t.edges.forEach((e,o)=>{const i=r.get((s=e,("function"==typeof t.config.sourceAccessor?t.config.sourceAccessor(s):u(s,t.config.sourceAccessor??"source",void 0))+""));var s;const c=r.get((e=>("function"==typeof t.config.targetAccessor?t.config.targetAccessor(e):u(e,t.config.targetAccessor??"target",void 0))+"")(e));if(!i||!c)return;const{from:l,to:d}=$e({cx:i.x,cy:i.y,width:i.width,height:i.height},{cx:c.x,cy:c.y,width:c.width,height:c.height},{orientation:"y"===n?"vertical":"horizontal"});a.push({type:"curved",pathD:ve(l,d,{orientation:"y"===n?"vertical":"horizontal",bend:Ae(o,{modulo:5,spread:5})}),style:{stroke:"var(--semiotic-border, #888)",fill:"none",strokeWidth:1.4},datum:m(e)??e})});const s=o.map(t=>({x:t.x,y:t.y,text:t.id}));return{sceneNodes:i,sceneEdges:a,labels:s}},Te={fill:"rgba(0,0,0,0)",stroke:"rgba(0,0,0,0)",opacity:0},Re=8;function Pe(t){return null==t?void 0:t+""}function Fe(t){const e=Pe(t.id);return{type:"point",x:t.x,y:t.y,r:t.r??8,style:{...Te},datum:t.datum,pointId:e,_transitionKey:e}}function je(t){return Fe(t)}function De(t){const[[e,n],[o,r]]=t.bounds;return{type:"geoarea",pathData:t.pathData,centroid:t.centroid,bounds:t.bounds,screenArea:t.screenArea??Math.abs((o-e)*(r-n)),style:{...Te},datum:t.datum,group:t.group,interactive:!0}}function Oe(t){return{type:"rect",x:t.x,y:t.y,w:t.width,h:t.height,style:{...Te},datum:t.datum,group:t.group,_transitionKey:Pe(t.id)}}function Be(t){const e=Pe(t.id);return"width"in t&&"height"in t?{type:"rect",x:t.x,y:t.y,w:t.width,h:t.height,style:{...Te},datum:t.datum,id:e,label:t.label}:{type:"circle",cx:t.x,cy:t.y,r:t.r??8,style:{...Te},datum:t.datum,id:e,label:t.label}}function He(t,e,n={}){const{coord:o,step:r=1,equals:i=Object.is,truthyOnly:a=!1}=n,s=[],c=e=>o?o(t[e],e):e,l=(t,e,n)=>{t.endIndex=e,t.count=e-t.startIndex+1,t.end=o?null==n||c(n)-c(e)>r?c(e)+r:c(n):e+1,s.push(t)};let u=null;for(let n=0;t.length>n;n++){const s=e(t[n],n);if(a&&!s){u&&(l(u,u.endIndex,n),u=null);continue}const d=!o||0>=n||c(n)-c(n-1)<=r;u&&d&&i(u.value,s)?u.endIndex=n:(u&&l(u,u.endIndex,n),u={value:s,start:c(n),end:c(n),count:1,startIndex:n,endIndex:n})}return u&&l(u,u.endIndex,null),s}var Ye=He;function Ve(t,e,n=0){return e>0?((t-n)%e+e)%e+n:t}function Xe(t,e,n){if(0>=n)return e-t;let o=(e-t)%n;return o>n/2?o-=n:-n/2>o&&(o+=n),o}function qe(t,e,n){return e>n?t>=e||n>=t:t>=e&&n>=t}function Ge(t,e,n,o){return n>o?[...t.filter(t=>e(t)>=n),...t.filter(t=>e(t)<=o)]:t.filter(t=>qe(e(t),n,o))}var Ke=2*Math.PI;function Ue(t,e,n){const o=n?.center?.x??0,r=n?.center?.y??0;return{x:o+Math.sin(t)*e,y:r-Math.cos(t)*e}}function _e(t,e,n){return(Math.atan2(t-(n?.center?.x??0),-(e-(n?.center?.y??0)))+Ke)%Ke}function Ze(t,e){const[n,o]=t,r=o-n||1,i=e?.startAngle??0,a=e?.endAngle??Ke;return t=>i+(t-n)/r*(a-i)}function Qe(t,e){const[n,o]=t,[r,i]=e,a=o-n||1;return t=>r+(t-n)/a*(i-r)}function Je(t,e,n,o,r){const i=r?.center,a=(t,e)=>{const{x:n,y:o}=Ue(t,e,{center:i});return`${tn(n)},${tn(o)}`},s=Math.max(0,n),c=Math.max(s,o),l=Math.abs(e-t),u=t>e?0:1;if(l>=Ke-1e-6){const t=i?.x??0,e=i?.y??0,n=`${tn(t)},${tn(e-c)}`,o=`${tn(t)},${tn(e+c)}`;let r=`M${n} A${tn(c)},${tn(c)} 0 1 1 ${o} A${tn(c)},${tn(c)} 0 1 1 ${n} Z`;if(s>0){const n=`${tn(t)},${tn(e-s)}`,o=`${tn(t)},${tn(e+s)}`;r+=` M${n} A${tn(s)},${tn(s)} 0 1 0 ${o} A${tn(s)},${tn(s)} 0 1 0 ${n} Z`}return r}const d=l>Math.PI?1:0,h=a(t,c),f=a(e,c);if(0>=s){const t=i?.x??0,e=i?.y??0;return`M${tn(t)},${tn(e)} L${h} A${tn(c)},${tn(c)} 0 ${d} ${u} ${f} Z`}const m=a(e,s),p=a(t,s);return`M${h} A${tn(c)},${tn(c)} 0 ${d} ${u} ${f} L${m} A${tn(s)},${tn(s)} 0 ${d} ${1===u?0:1} ${p} Z`}function tn(t){return Math.round(1e3*t)/1e3}function en(t,e){return{x:t.x+e.x,y:t.y+e.y}}function nn(t,e){return{x:t.x-e.x,y:t.y-e.y}}function on(t,e){return{x:t.x*e,y:t.y*e}}function rn(t){return Math.hypot(t.x,t.y)}function an(t){const e=rn(t)||1;return{x:t.x/e,y:t.y/e}}import{jsx as sn,jsxs as cn}from"react/jsx-runtime";var ln="var(--semiotic-text, currentColor)";function un(t,e){const n=$(t,100);return n>0?e/n*100*(e/n):Math.PI*e*e}function dn(t){const e=[],n=t.colorMap?Object.entries(t.colorMap):t.keys?t.keys.map(e=>[e,t.color?t.color(e):void 0]):[];if(n.length>0){const o=t.colorType??"fill",r=n.map(([t,e])=>({label:t,color:e}));e.push({type:o,label:t.colorLabel??"",items:r,styleFn:"line"===o?t=>({stroke:t.color??ln,strokeWidth:2,fill:"none"}):t=>({fill:t.color??ln,stroke:t.color??ln})})}if(t.symbolMap&&Object.keys(t.symbolMap).length>0){const n=t.symbolColor??ln,o=Object.entries(t.symbolMap).map(([t,e])=>({label:t,shape:e,color:n}));e.push({label:t.symbolLabel??"",items:o,styleFn:()=>({}),type:t=>{const e=t.shape;return sn("path",{d:A(e,un(e,7)),transform:"translate(8,8)",fill:t.color??n})}})}if(t.sizeStops&&t.sizeStops.length>0&&t.sizeRadius){const n=t.sizeRadius,o=t.sizeFormat??(t=>t+""),r=t.sizeColor??ln,i=t.sizeStops.map(t=>({label:o(t),r:Math.max(.5,n(t)),color:r}));e.push({label:t.sizeLabel??"",items:i,styleFn:()=>({}),type:t=>sn("circle",{cx:8,cy:8,r:t.r,fill:t.color??r})})}return e}function hn(t){const e=t.orientation??"vertical",n=t.swatchSize??14,o=t.gap??8,r=t.labelGap??6,i=t.fontSize??12,a=t.color??"var(--semiotic-text-secondary, #888)",s=n+o;let c=0;const l=[];return t.entries.forEach((t,u)=>{l.push(cn("g",{transform:`translate(${"vertical"===e?0:c},${"vertical"===e?c:0})`,children:[fn(t,n,t.color??t.line??a,a),sn("text",{x:n+r,y:n/2,dominantBaseline:"middle",fontSize:i,fill:a,children:t.label})]},"legend-"+u)),c+="vertical"===e?s:n+r+t.label.length*i*.58+o+8}),sn("g",{className:t.className,transform:`translate(${t.x},${t.y})`,style:{pointerEvents:"none"},children:l},t.keyId)}function fn(t,e,n,o){if(t.shape){const o=un(t.shape,e/2-1);return sn("path",{d:A(t.shape,o),transform:`translate(${e/2},${e/2})`,fill:n})}if(t.hatch){const n=t.color??o;return cn("g",{children:[sn("svg",{width:e,height:e,style:{overflow:"hidden"},children:[-e,-e/2,0,e/2].map((t,o)=>sn("line",{x1:t,y1:e,x2:t+e,y2:0,stroke:n,strokeWidth:1,opacity:.7},o))}),sn("rect",{width:e,height:e,fill:"none",stroke:n,strokeWidth:1,opacity:.5,rx:2})]})}return sn("rect",t.line?{y:e/2-1.5,width:e,height:3,rx:1.5,fill:t.line}:{width:e,height:e,rx:2,fill:n})}var mn=new Set(["rows"]);function pn(t){const e=t,n=[bn(e,["datum","data"]),bn(e,["datum"]),bn(e,["data","data"]),bn(e,["data"]),bn(e,["node","datum","data"]),bn(e,["node","datum"]),t];for(const t of n){if(!wn(t))continue;const e={};for(const[n,o]of Object.entries(t))n.startsWith("_")||"function"==typeof o||(e[n]=o);if(Object.keys(e).length>0)return e}return null}function yn(t,e={}){const n=pn(t);if(!n)return[];const o=new Set(mn);if(e.excludeKeys)for(const t of e.excludeKeys)o.add(t);const r=[];for(const[t,i]of Object.entries(n))if((e.includeInternal||!t.startsWith("_"))&&!o.has(t)&&(e.includeEmpty||null!=i&&""!==i)&&"function"!=typeof i&&(r.push({key:t,label:xn(t,e.labels),value:i,formatted:e.valueFormat?e.valueFormat(i,t,n):gn(i)}),r.length>=(e.maxEntries??8)))break;return r}function gn(t){if(null==t)return"";if(t instanceof Date)return t.toISOString();if("number"==typeof t)return Number.isInteger(t)?t+"":t.toLocaleString(void 0,{maximumFractionDigits:2});if("boolean"==typeof t)return t?"true":"false";if(Array.isArray(t))return t.length+" items";if("object"==typeof t)try{return JSON.stringify(t)}catch{return t+""}return t+""}function xn(t,e){return"function"==typeof e?e(t):e&&e[t]?e[t]:t}function bn(t,e){let n=t;for(const t of e){if(!wn(n))return;n=n[t]}return n}function wn(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function Mn(t,e){const n=new Map;for(const e of t)n.set(e.id,new Set);for(const t of e)n.has(t.source)||n.set(t.source,new Set),n.has(t.target)||n.set(t.target,new Set),n.get(t.source).add(t.target),n.get(t.target).add(t.source);return n}function vn(t,e){const n={};for(const e of t)n[e.id]=0;for(const t of e)n[t.source]=(n[t.source]||0)+1,n[t.target]=(n[t.target]||0)+1;return n}function kn(t,e){const n={[e]:0},o=[e];let r=0;for(;o.length>r;){const e=o[r];r+=1;for(const r of t.get(e)||[])void 0===n[r]&&(n[r]=n[e]+1,o.push(r))}return n}function $n(t,e,n,o){if(n===o)return n?[n]:[];const r=Mn(t,e),i={[n]:null},a=[n];let s=0;for(;a.length>s;){const t=a[s];if(s+=1,t===o)break;for(const e of r.get(t)||[])void 0===i[e]&&(i[e]=t,a.push(e))}if(void 0===i[o])return[];const c=[];let l=o;for(;null!=l;)c.unshift(l),l=i[l];return c}function An(t,e,n,o=1){const r=Mn(t,e);if(!r.has(n))return new Set;const i=kn(r,n),a=new Set;for(const t in i)i[t]>o||a.add(t);return a}function Sn(t,e){const n=Mn(t,e),o={};for(const e of t)o[e.id]=0;for(const e of t.map(t=>t.id)){const r=[],i={},a={},s={};for(const e of t)i[e.id]=[],a[e.id]=0,s[e.id]=-1;a[e]=1,s[e]=0;const c=[e];let l=0;for(;c.length>l;){const t=c[l];l+=1,r.push(t);for(const e of n.get(t)||[])0>s[e]&&(s[e]=s[t]+1,c.push(e)),s[e]===s[t]+1&&(a[e]+=a[t],i[e].push(t))}const u={};for(const e of t)u[e.id]=0;for(;r.length;){const t=r.pop();for(const e of i[t])u[e]+=a[e]/a[t]*(1+u[t]);t!==e&&(o[t]+=u[t])}}for(const t in o)o[t]/=2;return o}function zn(t,e){const n=Mn(t,e),o={};for(const e of t){const t=kn(n,e.id);let r=0,i=0;for(const e in t)r+=t[e],i+=1;o[e.id]=r>0?(i-1)/r:0}return o}function Cn(t,e){const n=Mn(t,e),o={};for(const e of t){const t=[...n.get(e.id)||[]],r=t.length;if(2>r){o[e.id]=0;continue}let i=0;for(let e=0;t.length>e;e+=1)for(let o=e+1;t.length>o;o+=1)n.get(t[e])?.has(t[o])&&(i+=1);o[e.id]=2*i/(r*(r-1))}return o}function In(t){let e=0;for(const n in t)t[n]>e&&(e=t[n]);const n={};for(const o in t)n[o]=e>0?t[o]/e:0;return n}function Ln(t,e,n,o={}){const r=Mn(t,e),i={};for(const e of t)i[e.id]=kn(r,e.id);let a=o.minHops??4,s=o.startThreshold??.08;const c=o.maxThreshold??.2,l=new Set;let u=0;for(;0===l.size&&40>u;){for(let e=0;t.length>e;e+=1)for(let o=e+1;t.length>o;o+=1){const r=t[e].id,c=t[o].id,u=n[r],d=n[c];if(!u||!d)continue;const h=u.x-d.x,f=u.y-d.y;(void 0===i[r][c]?1/0:i[r][c])>=a&&s>Math.sqrt(h*h+f*f)&&(l.add(r),l.add(c))}0===l.size&&(s+=.02,s>c&&(s=o.startThreshold??.08,a=Math.max(2,a-1))),u+=1}return{problemIds:l,threshold:s,minHops:a}}async function Nn(t,e,n={}){const{execution:o="auto",signal:i,workerThreshold:a,nodeRadius:s,...c}=n,l=c.iterations??260;if(!p()||!g(o,t.length,e.length,l,a))return r(t,e,{...c,nodeRadius:s});const u={kind:"normalized",nodes:t.map(t=>({...t})),edges:e.map(t=>({...t})),options:c,nodeRadii:"function"==typeof s?Object.fromEntries(t.map(t=>[t.id,s(t)])):null==s?void 0:Object.fromEntries(t.map(t=>[t.id,s]))};try{return(await y(u,i)).positions}catch(n){if("AbortError"===n?.name)throw n;return r(t,e,{...c,nodeRadius:s})}}var Wn=[.1,.5,.9],En=1e6;function Tn(t){const e="number"==typeof t?t:"string"==typeof t&&t.trim()?Number(t):NaN;return Number.isFinite(e)?e:null}function Rn(t,e,n,o,r){return"function"==typeof o?o(t,e,n):function(t,e){let n=t;for(const t of e.split(".")){if(null==n||"object"!=typeof n)return;n=n[t]}return n}(t,o??r)}function Pn(t){const e=Number(t.toFixed(12));return Object.is(e,-0)?0:e}function Fn(t,e,n,o){const r=t.flatMap((t,r)=>{const i=Tn(Rn(t,r,e,n,"time")),a=Tn(Rn(t,r,e,o,"value"));return null==i||null==a?[]:[{time:Pn(i),value:a,index:r}]});r.sort((t,e)=>t.time-e.time||t.index-e.index);const i=[];for(const t of r){const e=i[i.length-1];e?.time===t.time?e.value=t.value:i.push({time:t.time,value:t.value})}return i}function jn(t,e,n,o){if(!t.length)return null;const r=t[0],i=t[t.length-1];if(r.time>e)return"clamp"===o?r.value:null;if(e>i.time)return"clamp"===o?i.value:null;const a=function(t,e){let n=0,o=t.length;for(;o>n;){const r=n+o>>>1;e>t[r].time?n=r+1:o=r}return n}(t,e),s=t[a];if(s?.time===e)return s.value;const c=t[Math.max(0,a-1)];return"step"!==n&&s&&s.time!==c.time?c.value+(e-c.time)/(s.time-c.time)*(s.value-c.value):c.value}function Dn(t,e){if(1===t.length)return t[0];const n=(t.length-1)*e,o=Math.floor(n),r=Math.ceil(n);return o===r?t[o]:t[o]+(t[r]-t[o])*(n-o)}function On(t){const e=t.interpolation??"step",n=t.outsideDomain??"omit",o=function(t){const e=(t??Wn).map(t=>{const e=Tn(t);if(null==e||0>e||e>1)throw new RangeError("physicsReferenceEnvelope quantiles must be finite values from 0 to 1; received "+t);return Pn(e)});return Array.from(new Set(e)).sort((t,e)=>t-e)}(t.quantiles),r=function(t){if(Array.isArray(t)){if(t.length>En)throw new RangeError("physicsReferenceEnvelope sampleAt exceeds 1000000 points");return Array.from(new Set(t.map(Tn).filter(t=>null!=t).map(Pn))).sort((t,e)=>t-e)}const e=t,n=Tn(e.start),o=Tn(e.end),r=Tn(e.step);if(null==n||null==o||null==r||0>=r||n>o)throw new RangeError("physicsReferenceEnvelope sampleAt requires finite start/end values with end >= start and step > 0");const i=Math.floor((o-n)/r)+1;if(i>En)throw new RangeError("physicsReferenceEnvelope sampleAt exceeds 1000000 points");const a=[],s=1e-10*Math.max(1,Math.abs(o),Math.abs(n));for(let t=0;i>t;t+=1){const e=n+t*r;if(e>o+s)break;a.push(Pn(Math.min(e,o)))}if(a.length&&s>=Math.abs(a[a.length-1]-o)||a.push(Pn(o)),a.length>En)throw new RangeError("physicsReferenceEnvelope sampleAt exceeds 1000000 points");return Array.from(new Set(a)).sort((t,e)=>t-e)}(t.sampleAt),i=t.runs.map(e=>Fn(e.samples,e.id,t.timeAccessor,t.valueAccessor));return{points:r.map(t=>{const r=i.map(o=>jn(o,t,e,n)).filter(t=>null!=t).sort((t,e)=>t-e),a={};for(const t of o)a[t]=r.length?Dn(r,t):null;return{time:t,count:r.length,min:r.length?r[0]:null,max:r.length?r[r.length-1]:null,median:r.length?Dn(r,.5):null,quantiles:a}}),quantiles:o,interpolation:e,outsideDomain:n,runCount:t.runs.length}}function Bn(t,e){return t.quantiles.length?"lower"===e?t.quantiles[0]:t.quantiles[t.quantiles.length-1]:"lower"===e?"min":"max"}function Hn(t,e){if("min"===e||"median"===e||"max"===e)return t[e];const n=Tn(e);if(null==n||0>n||n>1)throw new RangeError("comparePhysicsTrace quantile selectors must be from 0 to 1; received "+e);const o=Pn(n);if(!Object.prototype.hasOwnProperty.call(t.quantiles,o))throw Error(`comparePhysicsTrace could not find quantile ${o} in the reference envelope`);return t.quantiles[o]??null}function Yn(t,e,n){return e>t?"below":t>n?"above":"inside"}function Vn(t,e){const n=Math.max(0,e.time-t.time);if(0>=n||null==t.value||null==t.lower||null==t.upper||null==e.value||null==e.lower||null==e.upper)return{below:0,inside:0,above:0,observed:0};const o=t.value-t.lower,r=e.value-e.lower,i=t.value-t.upper,a=e.value-e.upper,s=[0,1];for(const[t,e]of[[o,r],[i,a]])(0>t&&e>0||t>0&&0>e)&&s.push(-t/(e-t));s.sort((t,e)=>t-e);let c=0,l=0,u=0;for(let o=0;s.length-1>o;o+=1){const r=s[o],i=s[o+1];if(r>=i)continue;const a=(r+i)/2,d=(i-r)*n,h=Yn(t.value+(e.value-t.value)*a,t.lower+(e.lower-t.lower)*a,t.upper+(e.upper-t.upper)*a);"below"===h?c+=d:"above"===h?u+=d:l+=d}return{below:c,inside:l,above:u,observed:n}}function Xn(t,e,n={}){const o=n.interpolation??e.interpolation,r=n.outsideDomain??e.outsideDomain,i=Fn(t,n.traceId??"trace",n.timeAccessor,n.valueAccessor),a=n.lower??Bn(e,"lower"),s=n.upper??Bn(e,"upper"),c=e.points.map(t=>{const e=jn(i,t.time,o,r),n=Hn(t,a),c=Hn(t,s);if(null!=n&&null!=c&&n>c)throw new RangeError("comparePhysicsTrace lower band exceeds upper band at time "+t.time);return{time:t.time,value:e,lower:n,upper:c,status:null==e||null==n||null==c?"unobserved":Yn(e,n,c)}});let l=0,u=0,d=0,h=0,f=null,m=0,p=null;for(const t of c){if("below"===t.status?l+=1:"inside"===t.status?u+=1:"above"===t.status&&(d+=1),null==t.value||null==t.lower||null==t.upper)continue;const e=Math.max(0,t.value-t.upper),n=Math.max(0,t.lower-t.value);e>h&&(h=e,f=t.time),n>m&&(m=n,p=t.time)}let y=0,g=0,x=0,b=0;for(let t=0;c.length-1>t;t+=1){const e=c[t],n=c[t+1],r=Math.max(0,n.time-e.time);if(r>0){if("linear"===o){const t=Vn(e,n);y+=t.below,g+=t.inside,x+=t.above,b+=t.observed;continue}"unobserved"!==e.status&&(b+=r,"below"===e.status?y+=r:"above"===e.status?x+=r:g+=r)}}const w=c[0]?.time,M=c[c.length-1]?.time,v=null==w||null==M?0:Math.max(0,M-w);return{points:c,sampleCount:c.length,observedSamples:l+u+d,belowSamples:l,insideSamples:u,aboveSamples:d,totalDuration:v,observedDuration:b,unobservedDuration:Math.max(0,v-b),belowDuration:y,insideDuration:g,aboveDuration:x,peakExcess:h,peakExcessAt:f,peakDeficit:m,peakDeficitAt:p}}function qn(t){return{id:t,furthestStageIndex:-1,visitedStageIds:[],visitsByStage:{},firstEnteredAt:{},lastEnteredAt:{},regressionCount:0}}function Gn(t){const e=Array.from(new Set(t.bodyIds??[]));return{stages:t.stages.map(t=>({...t})),bodyIds:e,entities:Object.fromEntries(e.map(t=>[t,qn(t)]))}}function Kn(t,e,n={}){if("region-enter"!==e.type)return t;const o=function(t,e){const n=e.stageId?.(t);if(n)return n;const o=t.region.metadata;if(o&&"object"==typeof o){const t=o.stageId;if("string"==typeof t)return t}return t.region.id}(e,n),r=t.stages.findIndex(t=>t.id===o);if(0>r)return t;const i=n.entityId?.(e)??e.bodyId;if(!i)return t;const a=t.entities[i]??qn(i),s=a.currentStageId?t.stages.findIndex(t=>t.id===a.currentStageId):-1,c=!a.visitedStageIds.includes(o),l=Number(e.observation.timestamp),u=Number.isFinite(l)?l:0,d={...a,currentStageId:o,furthestStageId:r>a.furthestStageIndex?o:a.furthestStageId,furthestStageIndex:Math.max(a.furthestStageIndex,r),visitedStageIds:c?[...a.visitedStageIds,o]:a.visitedStageIds,visitsByStage:{...a.visitsByStage,[o]:(a.visitsByStage[o]??0)+1},firstEnteredAt:c?{...a.firstEnteredAt,[o]:u}:a.firstEnteredAt,lastEnteredAt:{...a.lastEnteredAt,[o]:u},regressionCount:s>=0&&s>r?a.regressionCount+1:a.regressionCount};return{...t,bodyIds:t.bodyIds.includes(i)?t.bodyIds:[...t.bodyIds,i],entities:{...t.entities,[i]:d}}}function Un(t){const e=t.bodyIds.map(e=>t.entities[e]??qn(e)),n=e.length;let o=n;return t.stages.map((t,r)=>{const i=e.filter(t=>t.furthestStageIndex>=r).length,a=e.filter(e=>e.visitedStageIds.includes(t.id)).length,s=e.reduce((e,n)=>e+(n.visitsByStage[t.id]??0),0),c={id:t.id,label:t.label??t.id,reached:i,entered:a,total:n,conversion:n>0?i/n:0,fromPrevious:o>0?i/o:0,dropoff:Math.max(0,o-i),visits:s,repeatVisits:Math.max(0,s-a)};return o=i,c})}import{Fragment as _n,jsx as Zn,jsxs as Qn}from"react/jsx-runtime";var Jn={flow:{fill:"rgba(59, 130, 246, 0.14)",stroke:"rgba(96, 165, 250, 0.7)",accent:"#60a5fa"},capacity:{fill:"rgba(251, 146, 60, 0.18)",stroke:"rgba(251, 146, 60, 0.85)",accent:"#fb923c"},portal:{fill:"rgba(244, 114, 182, 0.14)",stroke:"rgba(244, 114, 182, 0.7)",accent:"#f472b6"},absorb:{fill:"rgba(52, 211, 153, 0.18)",stroke:"rgba(52, 211, 153, 0.8)",accent:"#34d399"}};function to(t,e,n){return Math.max(e,Math.min(n,t))}function eo(t){return 6.2*t.length}function no(t,e){const n=t.trim();if(e>=n.length)return n;if(1>=e)return n.slice(0,1);const o=n.split(/\s+/).filter(Boolean).map(t=>t[0]).join("").toUpperCase();return o.length>1&&e>=o.length?o:e>3?n.slice(0,Math.max(1,e-2))+"..":n.slice(0,e).toUpperCase()}function oo(t,e,n="auto"){const o=Math.max(1,Math.floor(e/6.2)),r="compact"===n?no(t,o):"full"===n?t:eo(t)>e?no(t,o):t;return{text:r,textLength:eo(r)>e?Math.max(4,e):void 0}}function ro(t,e={}){const{showFlowSpine:n=!0,showStageCounts:o=!0,showCapacityBadges:r=!0,showGroupSockets:i=!0,stageLabelMode:a="auto",outlineStages:s=!1,testId:c="process-flow-chrome"}=e,{width:l,height:u,left:d,right:h,topY:f,bottomY:m,midY:p,stages:y,groups:g=[]}=t,x=m-f;return Qn("svg",{"aria-hidden":"true","data-testid":c,"data-outline-stages":s?"true":void 0,width:l,height:u,viewBox:`0 0 ${l} ${u}`,style:{position:"absolute",inset:0,pointerEvents:"none"},className:["semiotic-process-chrome",s?"semiotic-process-chrome--outline-stages":null].filter(Boolean).join(" "),children:[Zn("defs",{children:Qn("linearGradient",{id:"semiotic-process-floor",x1:"0",x2:"0",y1:"0",y2:"1",children:[Zn("stop",{offset:"0%",stopColor:"var(--semiotic-process-floor, var(--semiotic-bg, #0f172a))",stopOpacity:"0.2"}),Zn("stop",{offset:"100%",stopColor:"var(--semiotic-process-lane, var(--semiotic-surface, #1e293b))",stopOpacity:"0.55"})]})}),Zn("rect",{x:0,y:0,width:l,height:u,fill:"url(#semiotic-process-floor)"}),Zn("rect",{x:d-6,y:f-8,width:h-d+12,height:x+16,rx:14,fill:"var(--semiotic-process-lane, var(--semiotic-surface, #111827))",fillOpacity:.45,stroke:"var(--semiotic-process-border, var(--semiotic-border, #334155))",strokeOpacity:.95}),n?Zn("line",{x1:d+8,x2:h-8,y1:p,y2:p,stroke:"var(--semiotic-process-border, var(--semiotic-border, #475569))",strokeWidth:2,strokeDasharray:"6 8",opacity:.55}):null,y.map((t,e)=>{const n=function(t){return t.absorb?"absorb":t.portalTarget?"portal":null!=t.capacity?"capacity":"flow"}(t),i=Jn[n],c=Math.max(12,t.width-8),l=to(c-8,22,88),d=oo(t.label,Math.max(8,l-10),a),h="none"!==a&&c-8>=22,g=function(t){if(null!=t.capacity){const e=null!=t.queueDepth?" · q "+t.queueDepth:"";return t.capacityLabel?`${t.capacityLabel}${e}`:`cap ${Number.isInteger(t.capacity)?t.capacity+"":t.capacity.toFixed(1)}${e}`}return t.absorb?"absorb":t.portalTarget?"portal":"flow"}(t),b=oo(g,Math.max(16,c-10),"auto"),w=r&&!1!==t.showBadge&&c>=32,M=null!=t.count?`n=${t.count}${null!=t.processed?" done "+t.processed:""}`:"",v=oo(M,Math.max(16,c-8),"auto"),k=Math.max(30,f-15),$=k-13;return Qn("g",{"data-stage":t.id,"data-role":n,children:[Zn("rect",{className:"semiotic-process-chrome__stage-bay",x:t.x0+4,y:f+6,width:c,height:x-12,rx:10,fill:s?"none":i.fill,stroke:i.stroke,strokeWidth:s?1.85:"flow"===n?1:1.6}),y.length-1>e?Zn("polygon",{points:`${t.x1-2},${p-7} ${t.x1+8},${p} ${t.x1-2},${p+7}`,fill:i.accent,opacity:.85}):null,h?Qn(_n,{children:[Zn("rect",{className:"semiotic-process-chrome__stage-label-bg",x:t.x-l/2,y:$,width:l,height:18,rx:9,fill:"var(--semiotic-bg, #0f172a)",fillOpacity:.75,stroke:i.stroke}),Qn("text",{x:t.x,y:k,textAnchor:"middle",fill:i.accent,fontSize:10,fontWeight:800,className:"semiotic-process-chrome__stage-label",textLength:d.textLength,lengthAdjust:d.textLength?"spacingAndGlyphs":void 0,children:[Zn("title",{children:t.label}),d.text]})]}):null,w?Qn("text",{x:t.x,y:f+22,textAnchor:"middle",fill:"var(--semiotic-process-muted, var(--semiotic-text-secondary, #94a3b8))",fontSize:9,fontWeight:700,textLength:b.textLength,lengthAdjust:b.textLength?"spacingAndGlyphs":void 0,children:[Zn("title",{children:g}),b.text]}):null,o&&null!=t.count?Qn("text",{x:t.x,y:Math.min(u-8,m+16),textAnchor:"middle",fill:"var(--semiotic-process-text, var(--semiotic-text, #e2e8f0))",fontSize:11,fontWeight:800,textLength:v.textLength,lengthAdjust:v.textLength?"spacingAndGlyphs":void 0,children:[Zn("title",{children:M}),v.text]}):null]},t.id)}),i?g.map((t,e)=>{const n=t.total??0,o=t.absorbed??0,r=t.complete??(n>0&&o>=n),i=!r&&n>0&&o/n>=.75,a=r?"rgba(52, 211, 153, 0.35)":i?"rgba(251, 191, 36, 0.28)":"rgba(15, 23, 42, 0.75)",s=r?"#34d399":i?"#fbbf24":"var(--semiotic-border, #64748b)",c=n>0?`${o}/${n}${r?" shipped":i?" almost":""}`:"feature "+(e+1),l=to(Math.max(54,eo(t.label)+18,eo(c)+16),54,104),u=oo(t.label,l-12,"auto"),d=oo(c,l-12,"auto");return Qn("g",{"data-group":t.id,children:[Zn("rect",{x:t.x-l/2,y:t.y-22,width:l,height:44,rx:10,fill:a,stroke:s,strokeWidth:1.5}),Qn("text",{x:t.x,y:t.y-4,textAnchor:"middle",fill:"var(--semiotic-process-text, var(--semiotic-text, #f8fafc))",fontSize:10,fontWeight:800,textLength:u.textLength,lengthAdjust:u.textLength?"spacingAndGlyphs":void 0,children:[Zn("title",{children:t.label}),u.text]}),Qn("text",{x:t.x,y:t.y+12,textAnchor:"middle",fill:s,fontSize:9,fontWeight:700,textLength:d.textLength,lengthAdjust:d.textLength?"spacingAndGlyphs":void 0,children:[Zn("title",{children:c}),d.text]})]},t.id)}):null]})}function io(t){const e="number"==typeof t?t:"string"==typeof t&&t.trim()?Number(t):NaN;return Number.isFinite(e)?e:null}function ao(t,e,n,o){const r="function"==typeof t?t(e,n):t;return Number.isFinite(r)?Number(r):o}function so(t,e,n){return io(t[e])??n}function co(t,e){return"number"==typeof t?t:t?.[e]??0}function lo(t){const{band:e,idPrefix:n,plot:o,projection:r}=t,{includeBoundaryWalls:i=!0,includeInteriorWalls:a=!0,wallThickness:s=4}=e,c=function(t){const e=t.bandwidth??t.scale.bandwidth?.()??0,n=new Set;for(const o of t.values){const r=t.scale(o);Number.isFinite(r)&&(n.add(Number(r)),n.add(Number(r)+e))}return Array.from(n).sort((t,e)=>t-e)}(e);if(2>c.length)return[];const l=i?c.length-1:c.length-2,u=[];for(let t=i?0:1;l>=t;t+=1){if(!a&&t>0&&c.length-1>t)continue;const e=c[t];u.push({id:`${n}-wall-${t}`,shape:"x"===r?{type:"aabb",x:e,y:o.y+o.height/2,width:s,height:o.height}:{type:"aabb",x:o.x+o.width/2,y:e,width:o.width,height:s}})}return u}function uo(t){const{plot:e,idPrefix:n="physics-scale",bounds:o={},xBins:r,xBands:i,yBands:a}=t,s=[];if(!1!==o&&s.push(...b(e,{idPrefix:n,...o})),r){const{idPrefix:t,yTop:o,yBottom:i,...a}=r;s.push(...w({...a,idPrefix:t??n+"-xbin",yTop:o??e.y,yBottom:i??e.y+e.height}))}return i&&s.push(...lo({band:i,idPrefix:i.idPrefix??n+"-xband",plot:e,projection:"x"})),a&&s.push(...lo({band:a,idPrefix:a.idPrefix??n+"-yband",plot:e,projection:"y"})),s}function ho(t){const{plot:e,rows:n,columns:o=n+1,pegRadius:r=3,idPrefix:i="galton-peg",yStart:a=e.y+.18*e.height,yEnd:s=e.y+.58*e.height,stagger:c=!0,restitution:l=.2,friction:u=.04}=t,d=Math.max(0,Math.floor(n)),h=Math.max(1,Math.floor(o));if(0===d)return[];const f=d>1?(s-a)/(d-1):0,m=e.width/h,p=[];for(let t=0;d>t;t+=1){const n=c&&t%2==1?m/2:0;for(let o=0;h>o;o+=1){const s=e.x+m*(o+.5)+n;e.x+r>s||s>e.x+e.width-r||p.push({id:`${i}-${t}-${o}`,shape:{type:"aabb",x:s,y:a+t*f,width:2*r,height:2*r},restitution:l,friction:u})}}return p}function fo(t,e={}){const{idPrefix:n="physics-token",radius:o=5,shape:r,mass:i,vx:a,vy:s,spawnAt:c,seed:l=1,jitter:u,datum:d}=e,h=v(l),f=co(u,"x"),m=co(u,"y");return t.map((t,l)=>{const u=ao(e.x,t,l,so(t,"x",0)),p=ao(e.y,t,l,so(t,"y",0)),y=ao(o,t,l,5),g="function"==typeof r?r(t,l):r??{type:"circle",radius:y};return{id:`${n}-${t.index??l}`,x:u+(h()-.5)*f,y:p+(h()-.5)*m,vx:ao(a,t,l,0),vy:ao(s,t,l,0),mass:ao(i,t,l,1),spawnAt:ao(c,t,l,void 0),shape:g,datum:d?d(t,l):t.datum??t}}).map(t=>{if(Number.isFinite(t.spawnAt))return t;const{spawnAt:e,...n}=t;return n})}function mo(t,e={}){const{idPrefix:n="sediment",collider:o=!0,colliderThickness:r=1,restitution:i=.05,friction:a=.2,...s}=e,c=M(t,s),l=o?c.filter(t=>t.height>0).map(t=>({id:`${n}-${t.binId}`,shape:{type:"aabb",x:t.x+t.width/2,y:t.y+r/2,width:t.width,height:r},restitution:i,friction:a})):[];return{columns:c,colliders:l}}function po(t,e={}){const{timeAccessor:n="arrivalTime",timeScale:o=1,startAt:r=0,rebase:i=!0,sort:a=!0}=e,s=t.map((t,e)=>({spawn:t,time:function(t,e,n){return io("function"==typeof n?n(t,e):t[n]??t.datum?.[n])}(t,e,n)??t.spawnAt??e})),c=s.length?Math.min(...s.map(t=>t.time)):0;return{initialSpawns:s.map(({spawn:t,time:e})=>({...t,spawnAt:r+(i?e-c:e)})).sort((t,e)=>a?(t.spawnAt??0)-(e.spawnAt??0):0),initialSpawnPacing:{pacing:"arrival",startAt:r,timeAccessor:"spawnAt",timeScale:o}}}function yo(t,e,n="group"){const o=vn(t,e),r=t=>"function"==typeof n?n(t):t[n]??0;return t.slice().sort((t,e)=>{const n=r(t),i=r(e);return i>n?-1:n>i?1:(o[e.id]||0)-(o[t.id]||0)}).map(t=>t.id)}function go(t,e={}){const n=e.baseline??.62,o=e.inset??.06,r={},i=t.length;return t.forEach((t,e)=>{r[t]={x:i>1?o+e/(i-1)*(1-2*o):.5,y:n}}),r}function xo(t,e,n=.55){return`M${t.x},${t.y} Q${(t.x+e.x)/2},${t.y-Math.abs(e.x-t.x)*n} ${e.x},${e.y}`}function bo(t,e={}){const n=e.radius??.42,o=e.center?.x??.5,r=e.center?.y??.5,i=e.startAngle??0,a={},s=t.length;return t.forEach((t,e)=>{const c=i+e/s*Math.PI*2-Math.PI/2;a[t]={x:o+Math.cos(c)*n,y:r+Math.sin(c)*n}}),a}function wo(t,e,n={}){const o=(n.order??yo(t,e,n.groupAccessor??"group")).slice(),r=new Map(o.map((t,e)=>[t,e])),i=new Map;for(const t of e){if(!r.has(t.source)||!r.has(t.target)||t.source===t.target)continue;const e=t.target>t.source?`${t.source}\0${t.target}`:`${t.target}\0${t.source}`;i.set(e,(i.get(e)||0)+(t.value??1))}const a=[];let s=0;for(const[t,e]of i){const[n,o]=t.split("\0"),i=r.get(n),c=r.get(o);e>s&&(s=e),a.push({row:i,col:c,source:n,target:o,value:e}),a.push({row:c,col:i,source:o,target:n,value:e})}return{order:o,cells:a,size:o.length,maxValue:s}}function Mo(t){return!!t&&"object"==typeof t&&!Array.isArray(t)}function vo(t){if("string"!=typeof t)return;const e=t.trim();return e.length?e:void 0}function ko(t,e){const n=Mo(t.note)?t.note:void 0;return e?vo(t.mobileText)||vo(t.shortText)||vo(t.label)||vo(n?.mobileText)||vo(n?.shortText)||vo(n?.label)||vo(n?.title):vo(t.label)||vo(t.mobileText)||vo(t.shortText)||vo(n?.label)||vo(n?.title)}function $o(t,e,n){const o=function(t,e,n){if(!n)return;const o="function"==typeof n?n(t,e):t[n];return"number"==typeof o&&Number.isFinite(o)?o:void 0}(t,e,n.priorityAccessor);if(void 0!==o)return o;let r=1e3-e;const i=((t.emphasis??"")+"").toLowerCase();"primary"!==i&&"critical"!==i||(r+=1e4),"secondary"===i&&(r-=1e3),"high"===t.priority&&(r+=5e3),"low"===t.priority&&(r-=1500),"number"==typeof t.priority&&(r+=100*t.priority);const a=Mo(t.provenance)?t.provenance:void 0;"number"==typeof a?.confidence&&(r+=100*a.confidence);const s=Mo(t.lifecycle)?t.lifecycle:void 0,c=((s?.freshness??"")+"").toLowerCase();return"expired"!==c&&"stale"!==c||(r-=3e3),r}function Ao(t,e){if(!e)return t;const n=ko(t,!0);return n&&"string"==typeof t.label?{...t,label:n}:t}function So(t,e={}){const n=Array.isArray(t)?t.filter(Mo):[],o=e.active??(null==e.width||(e.breakpoint??480)>=e.width),r=e.strategy??"hybrid",i=!1!==e.preferShortText,a=!1!==e.preservePrimary,s=Math.max(0,e.maxPlotAnnotations??e.maxAnnotations??("callout-list"===r?1:2)),c=Math.max(0,e.minPlotAnnotations??e.minVisible??1);if(!o||"plot"===r)return{active:o,strategy:r,budget:n.length,visible:i?n.map(t=>Ao(t,i)):n,deferred:[],calloutList:[],hidden:[]};const l=[],u=n.map((t,n)=>({annotation:t,index:n,priority:$o(t,n,e)})).filter(t=>!!S(t.annotation)||(l.push(t.annotation),!1)).sort((t,e)=>e.priority-t.priority),d=a?u.filter(t=>"primary"===((t.annotation.emphasis??"")+"").toLowerCase()):[],h=new Set(d.map(t=>t.index)),f=u.filter(t=>!h.has(t.index)),m=[...d,...f].slice(0,Math.max(s,c)),p=new Set(m.map(t=>t.index)),y=u.filter(t=>!p.has(t.index)),g=[...l,...m.sort((t,e)=>t.index-e.index).map(t=>Ao(t.annotation,i))],x=y.sort((t,e)=>t.index-e.index).map(t=>t.annotation),b=Math.max(0,e.maxCalloutItems??6),w=y.filter(t=>!e.calloutFilter||e.calloutFilter(t.annotation,t.index)).map(t=>function(t,e,n,o){const r=ko(t,o);if(!r)return null;const i=vo(t.id)||vo(t.key)||vo(t.pointId)||"annotation-"+(e+1),a=Mo(t.provenance)?vo(t.provenance.source)||vo(t.provenance.authorKind):void 0;return{id:i,label:r,shortLabel:vo(t.shortText),pointId:t.pointId,emphasis:"string"==typeof t.emphasis?t.emphasis:void 0,source:a,priority:n,annotation:t}}(t.annotation,t.index,t.priority,i)).filter(t=>!!t).slice(0,b),M=new Set(w.map(t=>t.annotation)),v=x.filter(t=>!M.has(t));return{active:o,strategy:r,budget:s,visible:g,deferred:x,calloutList:w,hidden:v}}function zo(t){return"dense"===t.density?.75:"compact"===t.density?.9:1}function Co(t,e){const n=!1!==e.keepAxes,o=!1===e.directLabel?12:28;return"ordinal"===t?{top:12,right:o,bottom:n?44:12,left:n?48:12}:"geo"===t||"network"===t?{top:12,right:12,bottom:12,left:12}:{top:12,right:o,bottom:n?42:14,left:n?44:14}}function Io(t,e,n,o={}){const r={...n},i={mode:!1===e.mode?void 0:"mobile",...r,margin:Co(t,e),...o},a=Object.fromEntries(Object.entries(r).filter(([,t])=>void 0!==t)),s=Object.fromEntries(Object.entries(i).filter(([,t])=>void 0!==t)),c=function(t,e){const n=e.targetSize??44,o=[],r=e.standardControls,i=t=>!0===r||"all"===r||r===t||Array.isArray(r)&&r.includes(t);return i("brush")&&o.push("range-inputs","clear-brush"),i("zoom")&&o.push("zoom-buttons","reset-view"),i("legend")&&o.push("legend-chips","show-all-series"),{strategy:`${t}-${e.transformProfile??"overview"}-mobile-recipe`,supportsResponsiveLayout:!0,breakpoints:[320,360,390,430,e.breakpoint??480,768],maxAnnotations:e.maxAnnotations??2,minimumHitTarget:n,summary:e.summary??!0,interaction:{primary:"tap",hoverFallback:"tap-to-lock",targetSize:n,...o.length>0&&{alternatives:o}},labels:{strategy:!1===e.directLabel?"compact":"direct",minFontSize:12}}}(t,e),l=function(t){return{tapToSelect:!0,tapToLockTooltip:!0,clearSelection:"backgroundTap",targetSize:t.targetSize??44,snap:t.snap??"nearestDatum",brushHandleSize:t.targetSize??44,standardControls:t.standardControls??!1}}(e);return{family:t,props:a,responsiveRules:[{id:t+"-mobile",description:`Apply Semiotic's mobile ${t} recipe at phone width.`,when:{maxWidth:e.breakpoint??480},transform:{...s,mobileInteraction:l,mobileSemantics:c}}],mobileInteraction:l,mobileSemantics:c}}function Lo(t={}){const e=zo(t);return Io("line",t,{showLegend:t.showLegend??!1,directLabel:t.directLabel??!0,lineWidth:"inspect"===t.transformProfile?3:Math.max(1.5,2.5*e),showPoints:"inspect"===t.transformProfile,autoPlaceAnnotations:{mobile:{strategy:"callout-list",maxAnnotations:t.maxAnnotations??2,maxCalloutItems:t.maxCalloutItems??4,progressiveDisclosure:!0,preferShortText:!0}}},{showAxes:t.keepAxes??!0,axisExtent:"exact"})}function No(t={}){const e=zo(t);return Io("area",t,{showLegend:t.showLegend??!1,showPoints:!1,areaOpacity:"compare"===t.transformProfile?.55:.42,lineWidth:Math.max(1.25,2*e),autoPlaceAnnotations:{mobile:{strategy:"callout-list",maxAnnotations:t.maxAnnotations??2,maxCalloutItems:t.maxCalloutItems??4,progressiveDisclosure:!0,preferShortText:!0}}},{showAxes:t.keepAxes??!0,axisExtent:"exact"})}function Wo(t={}){return Io("ordinal",t,{showLegend:t.showLegend??!1,showCategoryTicks:t.keepAxes??!0,sort:"compare"===t.transformProfile?"desc":void 0},{showAxes:t.keepAxes??!0,axisExtent:"exact"})}function Eo(t={}){const e=zo(t);return Io("scatter",t,{showLegend:t.showLegend??!1,pointRadius:Math.max(4,Math.round((t.targetSize??44)/8*e)),hoverRadius:Math.ceil((t.targetSize??44)/2),pointOpacity:"dense"===t.density?.42:.68,autoPlaceAnnotations:{mobile:{strategy:"callout-list",maxAnnotations:t.maxAnnotations??1,maxCalloutItems:t.maxCalloutItems??4,progressiveDisclosure:!0,preferShortText:!0}}},{showAxes:t.keepAxes??!0,axisExtent:"exact"})}function To(t={}){const e=zo(t);return Io("network",t,{showLegend:t.showLegend??!1,nodeSizeRange:[Math.max(4,Math.round(6*e)),Math.max(12,Math.round((t.targetSize??44)/2*e))],showLabels:"inspect"===t.transformProfile,edgeOpacity:"dense"===t.density?.28:.44})}function Ro(t={}){return Io("geo",t,{showLegend:t.showLegend??!1})}function Po(t={}){return Io("small-multiple",t,{mobileColumns:t.mobileColumns??1,tabletColumns:t.tabletColumns??2,chartHeight:t.chartHeight??180,sharedExtent:!0})}function Fo(t,e={}){switch(t){case"line":return Lo(e);case"area":return No(e);case"ordinal":return Wo(e);case"scatter":return Eo(e);case"network":return To(e);case"geo":return Ro(e);case"small-multiple":return Po(e)}}function jo(t={}){const e=t.controls??["range-inputs","chip-filter","clear"];return{mobileInteraction:{enabled:!0,targetSize:t.targetSize??44,tapToSelect:!0,tapToLockTooltip:!0,standardControls:"brush"},mobileSemantics:{interaction:{primary:"filter",alternatives:e,summary:t.summary??"Expose brushable ranges through touch-sized controls in addition to drag gestures."}},controls:e}}export{z as waffleLayout,C as allocateCells,I as isotypeInk,L as isotypePaper,N as isotypeGhost,W as isotypeServerGlyph,E as isotypeChipGlyph,T as isotypeBoltGlyph,R as isotypeBusGlyph,P as isotypePersonPath,F as isotypePersonGlyph,j as isotypeNetworkGlyphs,U as tokenLayer,Q as calendarLayout,ot as DEFAULT_ISOMETRIC_SPRITE_SIZES,ht as selectIsometricLandmarks,ft as isometricLandmarkLayout,bt as flextreeLayout,wt as dagreLayout,St as lineageDagLayout,Wt as mermaidDagLayout,Rt as roundedEnclosure,Pt as boundsOf,Ft as bandLabel,jt as hatchFill,Dt as linearAxis,Ot as markCallout,qt as packedClusterMatrix,_t as marimekkoLayout,Jt as bulletLayout,ne as parallelCoordinatesLayout,pe as bobaLayout,xe as packIntervals,be as activeCountOverDomain,Me as intervalLanesLayout,ve as curvedEdgePath,ke as orthogonalEdgePath,$e as boxEdgeAnchors,Ae as fanOutBend,Se as cubicPoint,ze as cubicTangent,Ce as cubicPath,Ie as rectCollide,We as axisFixedForcePositions,Ee as axisFixedForceLayout,Re as DEFAULT_HIT_RADIUS,Fe as hitTargetPoint,je as geoHitTarget,De as geoAreaHitTarget,Oe as hitTargetRect,Be as networkHitTarget,He as runs,Ye as runLengthEncode,Ve as wrapValue,Xe as shortestArcDelta,qe as cyclicRangeContains,Ge as selectCyclicRange,Ke as TAU,Ue as polarToXY,_e as xyToAngle,Ze as angleScale,Qe as radiusScale,Je as ringArcPath,en as addPoints,nn as subtractPoints,on as scalePoint,rn as pointMagnitude,an as normalizePoint,dn as legendGroupsFrom,hn as legendSwatches,pn as extractTooltipDatum,yn as buildTooltipEntries,gn as formatTooltipValue,Mn as buildAdjacency,vn as degree,kn as bfsDistances,$n as shortestPath,An as egoNetwork,Sn as betweenness,zn as closeness,Cn as clustering,In as normalizeScores,Ln as proximityProblem,Nn as forceLayoutAsync,On as physicsReferenceEnvelope,Xn as comparePhysicsTrace,Gn as createProcessJourneyLedger,Kn as updateProcessJourney,Un as processJourneyRows,ro as processChrome,uo as collidersFromScales,ho as galtonPegs,fo as spawnFromTokens,mo as sedimentBake,po as arrivalReplay,yo as orderByGroupDegree,go as arcLayout,xo as arcPath,bo as circularLayout,wo as adjacencyMatrix,So as mobileAnnotationStrategy,Lo as mobileLineChartRecipe,No as mobileAreaChartRecipe,Wo as mobileOrdinalChartRecipe,Eo as mobileScatterplotRecipe,To as mobileNetworkChartRecipe,Ro as mobileGeoChartRecipe,Po as mobileSmallMultipleRecipe,Fo as mobileChartFamilyRecipe,jo as mobileBrushAlternatives};
@@ -1,2 +0,0 @@
1
- "use client";
2
- import*as e from"react";import{jsx as r,jsxs as t}from"react/jsx-runtime";function n({componentName:e,message:n,diagnosticHint:i,width:o,height:a}){return r("div",{role:"alert",style:{width:o,height:Math.max(a,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:t("div",{style:{textAlign:"center",maxWidth:400},children:[r("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:e}),r("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:n}),i&&r("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:i})]})})}import{jsx as i}from"react/jsx-runtime";var o=class extends e.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,r){this.props.onError?.(e,r)}render(){if(this.state.error){const{fallback:e}=this.props,r=this.state.error;return"function"==typeof e?e(r):void 0!==e?e:i(n,{componentName:"ChartErrorBoundary",message:r.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}};import{useEffect as a,useLayoutEffect as s,useRef as d,useState as c,useSyncExternalStore as l}from"react";var h="undefined"!=typeof window?s:a;function u(){const[e,r]=c(!1);return h(()=>{r(!0)},[]),e}var f=()=>()=>{},m=()=>!1,g=()=>!0;function p(){const e=l(f,m,g);return d(e).current}function b(e){const{hydrated:r,wasHydratingFromSSR:t,storeRef:n,dirtyRef:i,renderFnRef:o,cancelRender:s,cleanup:c}=e;h(()=>{r&&t&&n.current?.cancelIntroAnimation?.(),i.current=!0,s?.(),o.current()},[r,t]);const l=d(c);l.current=c,a(()=>()=>l.current?.(),[])}import{jsx as y}from"react/jsx-runtime";var x="undefined"!=typeof process&&"production"!==process.env?.NODE_ENV;function v({componentName:e,width:r,height:t,children:i}){return y(o,{fallback:i=>y(n,{componentName:e,message:i.message,width:r,height:t}),children:i})}var w={display:"flex",alignItems:"center",justifyContent:"center",color:"var(--semiotic-text-secondary, #666)",fontSize:13,fontFamily:"inherit",border:"1px dashed var(--semiotic-border, #ddd)",borderRadius:4,boxSizing:"border-box"},S={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function j(e,r,t,n){return!1===n||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?y("div",{style:{...w,width:r,height:t},children:n||"No data available"}):null}function A(e,r,t,n){if(!e)return null;if(!1===n)return null;if(null!=n)return y("div",{style:{width:r,height:t,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:n});const i=Math.min(5,Math.floor(t/40)),o=Math.max(8,Math.floor(t/(3*i))),a=Math.max(6,Math.floor(t/(2.5*i))),s=Math.floor((t-(i*(o+a)-a))/2);return y("div",{style:{width:r,height:t,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:i},(e,t)=>y("div",{className:"semiotic-loading-bar",style:{...S,position:"absolute",top:s+t*(o+a),left:Math.floor(.1*r),width:30+(37*t+13)%50+"%",height:o,opacity:.5+t%2*.2}},t))})}function R(e,r,t,n){if(!x)return;if(!r||0===r.length)return;if("string"!=typeof n)return;const i=r[0];if(!i||"object"!=typeof i)return;if(n in i)return;const o=Object.keys(i).join(", ");console.warn(`[semiotic] ${e}: ${t} "${n}" not found in data. Available keys: ${o}`)}export{u as useHydration,p as useWasHydratingFromSSR,b as useHydrationLifecycle,n as ChartError,o as ChartErrorBoundary,v as SafeRender,j as renderEmptyState,A as renderLoadingState,R as warnMissingField};