semiotic 3.8.5 → 3.8.6

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 (176) hide show
  1. package/CLAUDE.md +5 -4
  2. package/README.md +42 -42
  3. package/ai/behaviorContracts.cjs +2 -2
  4. package/ai/componentMetadata.cjs +1 -1
  5. package/ai/dist/mcp-server.js +2 -0
  6. package/ai/examples.md +44 -2
  7. package/ai/schema.json +385 -14
  8. package/ai/surface-manifest.json +6 -4
  9. package/ai/system-prompt.md +1 -1
  10. package/dist/{chunk-chartContainerDataAudit-74TLKIP6.module.min.js → chunk-chartContainerDataAudit-FEOD5GTQ.module.min.js} +1 -1
  11. package/dist/chunk-chunk-2CHN2TA3.module.min.js +1 -0
  12. package/dist/chunk-chunk-2JGJ5GUG.module.min.js +1 -0
  13. package/dist/chunk-chunk-3NGIKFD6.module.min.js +1 -0
  14. package/dist/chunk-chunk-3SHB24AG.module.min.js +1 -0
  15. package/dist/chunk-chunk-4MMOOYTX.module.min.js +2 -0
  16. package/dist/{chunk-chunk-KT2VAZMZ.module.min.js → chunk-chunk-75OTQSXS.module.min.js} +1 -1
  17. package/dist/chunk-chunk-A5GRQUOF.module.min.js +1 -0
  18. package/dist/chunk-chunk-AAF5LZAU.module.min.js +2 -0
  19. package/dist/{chunk-chunk-4AANPFOX.module.min.js → chunk-chunk-ARZGA4LJ.module.min.js} +1 -1
  20. package/dist/chunk-chunk-CAFLML4L.module.min.js +2 -0
  21. package/dist/chunk-chunk-FHBN7OEB.module.min.js +2 -0
  22. package/dist/{chunk-chunk-TMWIZL3K.module.min.js → chunk-chunk-GFTVACTO.module.min.js} +1 -1
  23. package/dist/chunk-chunk-IP2UE74X.module.min.js +1 -0
  24. package/dist/chunk-chunk-ITDWLZXV.module.min.js +2 -0
  25. package/dist/chunk-chunk-LPSPATPC.module.min.js +1 -0
  26. package/dist/chunk-chunk-OM6NWS4H.module.min.js +2 -0
  27. package/dist/chunk-chunk-PX5YQGDP.module.min.js +2 -0
  28. package/dist/chunk-chunk-Q2BS46W2.module.min.js +2 -0
  29. package/dist/{chunk-chunk-LJLS6DY7.module.min.js → chunk-chunk-RA7JCG7D.module.min.js} +1 -1
  30. package/dist/chunk-chunk-RNUHEXZA.module.min.js +2 -0
  31. package/dist/chunk-chunk-ROZWKEUG.module.min.js +1 -0
  32. package/dist/chunk-chunk-SMVD3EQJ.module.min.js +2 -0
  33. package/dist/chunk-chunk-T2FKJD4O.module.min.js +2 -0
  34. package/dist/{chunk-chunk-K3DMEW22.module.min.js → chunk-chunk-UDREYOLV.module.min.js} +1 -1
  35. package/dist/chunk-chunk-VOWE3SAP.module.min.js +2 -0
  36. package/dist/chunk-chunk-VQPNBUSW.module.min.js +2 -0
  37. package/dist/{chunk-chunk-N5DDKCCF.module.min.js → chunk-chunk-WAWCIHFJ.module.min.js} +1 -1
  38. package/dist/{chunk-chunk-XXWSHGPL.module.min.js → chunk-chunk-WYARAXHR.module.min.js} +1 -1
  39. package/dist/{chunk-chunk-I36PJ4OC.module.min.js → chunk-chunk-XP3OHHFX.module.min.js} +1 -1
  40. package/dist/chunk-chunk-XV3KGYTR.module.min.js +2 -0
  41. package/dist/chunk-chunk-YC2IVEPX.module.min.js +1 -0
  42. package/dist/components/ai/chartCapabilities.d.ts +2 -1
  43. package/dist/components/charts/custom/XYCustomChart.d.ts +3 -0
  44. package/dist/components/charts/geo/DistanceCartogram.d.ts +1 -1
  45. package/dist/components/charts/index.d.ts +3 -0
  46. package/dist/components/charts/ordinal/BarChart.d.ts +7 -14
  47. package/dist/components/charts/ordinal/GaugeChart.d.ts +3 -0
  48. package/dist/components/charts/ordinal/GroupedBarChart.d.ts +3 -0
  49. package/dist/components/charts/ordinal/StackedBarChart.d.ts +3 -0
  50. package/dist/components/charts/ordinal/SwimlaneChart.d.ts +4 -14
  51. package/dist/components/charts/shared/chartSpecCore.d.ts +2 -4
  52. package/dist/components/charts/shared/gaugeGradient.d.ts +4 -8
  53. package/dist/components/charts/shared/gradient.d.ts +35 -0
  54. package/dist/components/charts/shared/hatchFill.d.ts +3 -10
  55. package/dist/components/charts/shared/hooks.d.ts +2 -50
  56. package/dist/components/charts/shared/knownChartComponents.d.ts +1 -1
  57. package/dist/components/charts/shared/streamPropsHelpers.d.ts +1 -2
  58. package/dist/components/charts/shared/useChartLegend.d.ts +58 -0
  59. package/dist/components/charts/shared/useChartSetup.d.ts +5 -0
  60. package/dist/components/charts/shared/useCustomChartSetup.d.ts +6 -1
  61. package/dist/components/charts/shared/useNetworkChartSetup.d.ts +1 -0
  62. package/dist/components/charts/shared/useStreamingLegend.d.ts +1 -1
  63. package/dist/components/charts/xy/AreaChart.d.ts +25 -42
  64. package/dist/components/charts/xy/BumpChart.capability.d.ts +11 -0
  65. package/dist/components/charts/xy/BumpChart.d.ts +161 -0
  66. package/dist/components/charts/xy/DifferenceChart.d.ts +3 -10
  67. package/dist/components/charts/xy/Heatmap.d.ts +3 -0
  68. package/dist/components/charts/xy/LineChart.d.ts +6 -8
  69. package/dist/components/geometry/bumpRibbonGeometry.d.ts +36 -0
  70. package/dist/components/legendLayout.d.ts +19 -1
  71. package/dist/components/semiotic-ai.d.ts +2 -1
  72. package/dist/components/semiotic-geo.d.ts +1 -0
  73. package/dist/components/semiotic-network.d.ts +1 -0
  74. package/dist/components/semiotic-ordinal.d.ts +2 -0
  75. package/dist/components/semiotic-physics.d.ts +1 -0
  76. package/dist/components/semiotic-realtime-core.d.ts +1 -0
  77. package/dist/components/semiotic-server-edge.d.ts +1 -1
  78. package/dist/components/semiotic-server.d.ts +1 -1
  79. package/dist/components/semiotic-xy.d.ts +4 -0
  80. package/dist/components/semiotic.d.ts +4 -4
  81. package/dist/components/server/serverChartConfigs.d.ts +1 -0
  82. package/dist/components/server/serverChartConfigsXY.d.ts +1 -0
  83. package/dist/components/server/staticLegend.d.ts +4 -2
  84. package/dist/components/server/staticSVGChrome.d.ts +4 -4
  85. package/dist/components/stream/GeoSVGOverlay.d.ts +4 -10
  86. package/dist/components/stream/NetworkSVGOverlay.d.ts +2 -6
  87. package/dist/components/stream/OrdinalSVGOverlay.d.ts +2 -6
  88. package/dist/components/stream/SVGOverlay.d.ts +2 -6
  89. package/dist/components/stream/StalenessBadge.d.ts +2 -6
  90. package/dist/components/stream/geoTypes.d.ts +3 -6
  91. package/dist/components/stream/legendRenderer.d.ts +2 -6
  92. package/dist/components/stream/ordinalTypes.d.ts +7 -31
  93. package/dist/components/stream/physics/PhysicsKernel.d.ts +1 -0
  94. package/dist/components/stream/physics/PhysicsSVGOverlay.d.ts +2 -6
  95. package/dist/components/stream/physics/StreamPhysicsTypes.d.ts +2 -6
  96. package/dist/components/stream/pipelineConfig.d.ts +7 -15
  97. package/dist/components/stream/renderers/canvasRenderHelpers.d.ts +9 -69
  98. package/dist/components/stream/renderers/cornerRadii.d.ts +2 -9
  99. package/dist/components/stream/renderers/thresholdLineSegments.d.ts +12 -0
  100. package/dist/components/stream/sceneToSVGShared.d.ts +3 -5
  101. package/dist/components/stream/types.d.ts +32 -56
  102. package/dist/components/stream/xySceneBuilders/areaGradient.d.ts +4 -20
  103. package/dist/components/stream/xySceneBuilders/types.d.ts +6 -6
  104. package/dist/components/types/legendTypes.d.ts +15 -6
  105. package/dist/geo.min.js +1 -1
  106. package/dist/geo.module.min.js +1 -1
  107. package/dist/network.min.js +1 -1
  108. package/dist/network.module.min.js +1 -1
  109. package/dist/ordinal.min.js +1 -1
  110. package/dist/ordinal.module.min.js +1 -1
  111. package/dist/physics.min.js +1 -1
  112. package/dist/physics.module.min.js +1 -1
  113. package/dist/physicsWorker.js +1 -1
  114. package/dist/realtime.min.js +1 -1
  115. package/dist/realtime.module.min.js +1 -1
  116. package/dist/semiotic-ai-core.min.js +1 -1
  117. package/dist/semiotic-ai-core.module.min.js +1 -1
  118. package/dist/semiotic-ai.d.ts +2 -1
  119. package/dist/semiotic-ai.min.js +1 -1
  120. package/dist/semiotic-ai.module.min.js +1 -1
  121. package/dist/semiotic-experimental.min.js +1 -1
  122. package/dist/semiotic-experimental.module.min.js +1 -1
  123. package/dist/semiotic-geo.d.ts +1 -0
  124. package/dist/semiotic-network.d.ts +1 -0
  125. package/dist/semiotic-ordinal.d.ts +2 -0
  126. package/dist/semiotic-physics.d.ts +1 -0
  127. package/dist/semiotic-realtime-core.d.ts +1 -0
  128. package/dist/semiotic-realtime-core.min.js +1 -1
  129. package/dist/semiotic-realtime-core.module.min.js +1 -1
  130. package/dist/semiotic-recipes-core.module.min.js +1 -1
  131. package/dist/semiotic-recipes.module.min.js +1 -1
  132. package/dist/semiotic-server-edge.d.ts +1 -1
  133. package/dist/semiotic-server-edge.min.js +1 -1
  134. package/dist/semiotic-server-edge.module.min.js +1 -1
  135. package/dist/semiotic-server-node.min.js +1 -1
  136. package/dist/semiotic-server-node.module.min.js +1 -1
  137. package/dist/semiotic-server.d.ts +1 -1
  138. package/dist/semiotic-utils-core.min.js +1 -1
  139. package/dist/semiotic-utils-core.module.min.js +1 -1
  140. package/dist/semiotic-utils.min.js +1 -1
  141. package/dist/semiotic-utils.module.min.js +1 -1
  142. package/dist/semiotic-xy.d.ts +4 -0
  143. package/dist/semiotic.d.ts +4 -4
  144. package/dist/semiotic.min.js +1 -1
  145. package/dist/semiotic.module.min.js +1 -1
  146. package/dist/server.min.js +1 -1
  147. package/dist/server.module.min.js +1 -1
  148. package/dist/xy.min.js +1 -1
  149. package/dist/xy.module.min.js +1 -1
  150. package/package.json +1 -1
  151. package/dist/chunk-chunk-5I3UZV4Q.module.min.js +0 -2
  152. package/dist/chunk-chunk-74CCPVXB.module.min.js +0 -1
  153. package/dist/chunk-chunk-ANYDWOZF.module.min.js +0 -1
  154. package/dist/chunk-chunk-AVBI6GDT.module.min.js +0 -1
  155. package/dist/chunk-chunk-BANTPINB.module.min.js +0 -2
  156. package/dist/chunk-chunk-C57LR3YG.module.min.js +0 -1
  157. package/dist/chunk-chunk-CKMD5NV3.module.min.js +0 -2
  158. package/dist/chunk-chunk-CWQ5YIHX.module.min.js +0 -2
  159. package/dist/chunk-chunk-E6TXX6MI.module.min.js +0 -1
  160. package/dist/chunk-chunk-L6EA5V3G.module.min.js +0 -2
  161. package/dist/chunk-chunk-LJPCLYSC.module.min.js +0 -2
  162. package/dist/chunk-chunk-LRIFN2HK.module.min.js +0 -1
  163. package/dist/chunk-chunk-NEVE562N.module.min.js +0 -1
  164. package/dist/chunk-chunk-NLO44TOS.module.min.js +0 -2
  165. package/dist/chunk-chunk-PZJ2SBLL.module.min.js +0 -2
  166. package/dist/chunk-chunk-QUJ6TTLY.module.min.js +0 -1
  167. package/dist/chunk-chunk-RBIDBUT4.module.min.js +0 -2
  168. package/dist/chunk-chunk-RFLAG356.module.min.js +0 -1
  169. package/dist/chunk-chunk-RPU4IZAV.module.min.js +0 -2
  170. package/dist/chunk-chunk-SKMBCFIL.module.min.js +0 -2
  171. package/dist/chunk-chunk-TAE7W424.module.min.js +0 -2
  172. package/dist/chunk-chunk-TUBMTZMU.module.min.js +0 -2
  173. package/dist/chunk-chunk-UFFEXJQY.module.min.js +0 -1
  174. package/dist/chunk-chunk-XSCHTS4D.module.min.js +0 -2
  175. package/dist/chunk-statisticalOverlays-QGDLRUHX.module.min.js +0 -1
  176. package/dist/chunk-statisticalOverlays-T77OKLDY.module.min.js +0 -1
@@ -1 +1 @@
1
- import{contrastRatio as e,fieldForRole as t,recipeConfig as i,recipeIntentId as a}from"./chunk-chunk-UFFEXJQY.module.min.js";import{extractAllRows as n,resolveResponsiveRules as r}from"./chunk-chunk-CO5KQMGH.module.min.js";import*as s from"react";function o(e){if(null==e)return"";if("number"!=typeof e)return e+"";if(!isFinite(e))return e+"";if(0===e)return"0";const t=parseFloat(e.toPrecision(12)),i=Math.abs(t);return 1e9>i?1e6>i?1e4>i?Number.isInteger(t)?t+"":parseFloat(t.toPrecision(6))+"":parseFloat((t/1e3).toPrecision(3))+"K":parseFloat((t/1e6).toPrecision(3))+"M":parseFloat((t/1e9).toPrecision(3))+"B"}var l=864e5;function c(e){return 10>e?"0"+e:e+""}var u=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function d(e){let t,i=e;return(a,n,r)=>{const s=a instanceof Date?a:new Date(a);e||!r||2>r.length||r===t||(t=r,i=function(e){if(2>e.length)return"days";const t=[];for(let i=1;e.length>i;i++)t.push(e[i]-e[i-1]);t.sort((e,t)=>e-t);const i=t[Math.floor(t.length/2)];return 12e4>i?"seconds":72e5>i?"minutes":2*l>i?"hours":60*l>i?"days":400*l>i?"months":"years"}(r));const o=i||"days";return null!=n&&0!==n&&r&&0!==r.length?function(e,t,i){const a=e.getUTCFullYear()!==t.getUTCFullYear(),n=a||e.getUTCMonth()!==t.getUTCMonth(),r=n||e.getUTCDate()!==t.getUTCDate(),s=r||e.getUTCHours()!==t.getUTCHours(),o=s||e.getUTCMinutes()!==t.getUTCMinutes(),l=u[e.getUTCMonth()],d=e.getUTCDate(),m=e.getUTCFullYear(),h=c(e.getUTCHours()),p=c(e.getUTCMinutes()),g=c(e.getUTCSeconds());switch(i){case"seconds":return a?`${l} ${d}, ${m} ${h}:${p}:${g}`:r?`${l} ${d} ${h}:${p}:${g}`:s?`${h}:${p}:${g}`:o?`${p}:${g}`:":"+g;case"minutes":return a?`${l} ${d}, ${m} ${h}:${p}`:r?`${l} ${d} ${h}:${p}`:s?`${h}:${p}`:":"+p;case"hours":return a?`${l} ${d}, ${m} ${h}:00`:n?`${l} ${d} ${h}:${p}`:r?`${l} ${d} ${h}:00`:h+":00";case"days":return a?`${l} ${d}, ${m}`:n?`${l} ${d}`:""+d;case"months":return a?`${l} ${m}`:""+l;case"years":return""+m}}(s,new Date(r[n-1]),o):function(e,t){const i=u[e.getUTCMonth()],a=e.getUTCDate(),n=e.getUTCFullYear(),r=c(e.getUTCHours()),s=c(e.getUTCMinutes()),o=c(e.getUTCSeconds());switch(t){case"seconds":return`${i} ${a}, ${n} ${r}:${s}:${o}`;case"minutes":case"hours":return`${i} ${a}, ${n} ${r}:${s}`;case"days":return`${i} ${a}, ${n}`;case"months":return`${i} ${n}`;case"years":return""+n}}(s,o)}}var m=new Set(["LineChart","AreaChart","DifferenceChart","StackedAreaChart","Scatterplot","ConnectedScatterplot","BubbleChart","QuadrantChart","MultiAxisLineChart","CandlestickChart","Heatmap","MinimapChart","RealtimeLineChart","RealtimeHeatmap"]),h=new Set(["BarChart","StackedBarChart","GroupedBarChart","SwarmPlot","BoxPlot","Histogram","ViolinPlot","DotPlot","RidgelinePlot","FunnelChart","LikertChart","SwimlaneChart"]),p={Scatterplot:["pointRadius","hoverRadius"],BubbleChart:["pointRadius","hoverRadius"],ConnectedScatterplot:["pointRadius","hoverRadius"],QuadrantChart:["pointRadius","hoverRadius"],SwarmPlot:["pointRadius","hoverRadius"],DotPlot:["dotRadius","hoverRadius"]};function g(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function y(e){return"string"==typeof e&&e.trim().length>0}function b(e){const t=g(e.capability)?e.capability:null,i=g(e.recipe)?e.recipe:null,a=[e.mobileSemantics,e.mobileVisualization,e.mobile,t?.mobile,i?.mobile];for(const e of a)if(g(e))return e;return null}function f(e){return Array.isArray(e)&&e.length>=2&&"number"==typeof e[0]&&"number"==typeof e[1]&&Number.isFinite(e[0])&&Number.isFinite(e[1])?[e[0],e[1]]:null}function v(e){return f(e.size)||f(g(e.frameProps)?e.frameProps.size:void 0)||("number"==typeof e.width&&"number"==typeof e.height?[e.width,e.height]:null)}function x(e,t){e.push({...t,status:"pass"})}function w(e,t){e.push({...t,status:"warn"})}function k(e,t){e.push({...t,status:"manual"})}function $(e,t={},i={}){const a=i.viewportWidth??390,n=i.targetSize??44,s=v(t),o=r(t,{width:a,height:s?.[1]}),l=[],c=v(t=o.props),u=b(t),d=function(e,t){return e.includes("CustomChart")||e.includes("Custom")||null!=t.recipeId||null!=t.mobileSemantics}(e,t),f=function(e){const t=b(e);return!0===e.responsive||!0===e.mobile||!0===t?.responsive||!0===t?.supportsResponsiveLayout||Array.isArray(t?.breakpoints)||"number"==typeof t?.minViewportWidth||"responsive"===t?.strategy||"small-multiples"===t?.strategy||"summary-cards"===t?.strategy||null!=e.mobileLayout||null!=e.responsiveRules||"mobile-readable"===e.density}(t),$=!0===i.inChartContainer,C=y(t.title)||y(t.summary)||y(t.description)||!0===u?.summary||y(u?.summary);if(o.matches.length>0&&x(l,{id:"layout.responsive-rule-applied",category:"layout",impact:"medium",message:`${o.matches.length} responsive rule(s) applied for the ${a}px mobile audit.`}),c){const[t,i]=c;t>a&&!f?w(l,{id:"layout.fixed-desktop-size",category:"layout",impact:"high",message:`Chart size is ${t}px wide against a ${a}px mobile viewport with no responsive/mobile transform hint.`,fix:"Use responsive sizing, responsiveRules/mobileLayout, or an explicit mobile variant that preserves the task instead of clipping the desktop chart."}):x(l,{id:"layout.fixed-desktop-size",category:"layout",impact:"high",message:"No fixed desktop-width overflow risk is visible from the config."}),"number"==typeof u?.minViewportWidth&&u.minViewportWidth>a&&w(l,{id:"layout.mobile-min-width",category:"layout",impact:"high",message:`The declared mobile contract supports ${u.minViewportWidth}px minimum, wider than the audited ${a}px viewport.`,fix:"Add a narrower breakpoint, summary-card fallback, or explicit horizontal-scroll affordance with a non-visual equivalent."});const n=t/Math.max(1,i);430>=a&&n>2.4&&"BigNumber"!==e&&w(l,{id:"layout.wide-aspect-ratio",category:"layout",impact:"medium",message:`Chart aspect ratio is ${n.toFixed(1)}:1, which tends to compress phone charts vertically.`,fix:"Prefer stacked sections, small multiples, cards plus a sparkline, or a taller mobile-specific chart ratio."}),160>i&&"BigNumber"!==e&&w(l,{id:"layout.too-short-for-reading",category:"layout",impact:"medium",message:`Chart height is ${i}px; most phone charts need enough vertical room for marks plus readable labels.`,fix:"Reserve more vertical space, remove nonessential axes, or switch to a card/sparkline pattern with external labels."})}else k(l,{id:"layout.unknown-size",category:"layout",impact:"medium",message:"No explicit size is available to audit. This may be responsive, but static mobile overflow cannot be checked.",fix:"Audit rendered widths at 320, 360, 390, and 430px, or pass size/responsiveRules metadata into the config."});const A=function(e){const t=[e.data,e.points,e.lines,e.nodes,e.edges,e.areas,g(e.frameProps)?e.frameProps.data:void 0];let i=0;for(const e of t)Array.isArray(e)&&(i+=e.length);return i}(t);A>0&&(A>("number"==typeof u?.maxMarks?u.maxMarks:m.has(e)?1.25*a:h.has(e)?Math.max(8,Math.floor(a/34)):a)?w(l,{id:"density.mark-budget",category:"density",impact:m.has(e)?"medium":"high",message:`${A} data item(s) exceed the rough mobile density budget for ${e} at ${a}px.`,fix:"Aggregate, filter, facet into small multiples, switch to a summary-card plus detail view, or use progressive disclosure."}):x(l,{id:"density.mark-budget",category:"density",impact:"medium",message:A+" data item(s) are within the rough mobile density budget for this component."}));const T=function(e){const t=[e.tickValues,e.xTickValues,e.yTickValues,e.rTickValues,e.oTickValues];let i=0;for(const e of t)Array.isArray(e)&&(i+=e.length);return i>0?i:null}(t),S=!1!==t.showAxes&&!1!==t.axis;if(S&&null!=T){const e=Math.max(3,Math.floor(a/58));T>e&&w(l,{id:"density.explicit-tick-count",category:"density",impact:"medium",message:`${T} explicit tick(s) exceed a phone-friendly budget of about ${e} at ${a}px.`,fix:"Use adaptive ticks, fewer tickValues, direct labels, or move exact values into a tap-accessible detail panel."})}else S&&(m.has(e)||h.has(e))&&k(l,{id:"density.axis-label-collision",category:"density",impact:"medium",message:"Axes are enabled, but label collision depends on rendered tick text and cannot be checked statically.",fix:"Verify tick labels at phone widths or provide explicit mobile tick density."});!function(e){const t=g(e.frameProps)?e.frameProps:{};return(!0===e.enableHover||null!=e.tooltipContent||null!=e.tooltip||null!=t.tooltipContent||!0===t.enableHover)&&!function(e){const t=b(e),i=g(e.mobileInteraction)?e.mobileInteraction:null;return null!=e.controls||null!=e.mobileControls||!0===e.alternativeControls||null!=e.selection||null!=e.onClick||null!=e.onSelect||!0===e.mobileInteraction||!0===i?.tapToSelect||!0===i?.tapToLockTooltip||Array.isArray(t?.interaction?.alternatives)&&t.interaction.alternatives.length>0||"tap"===t?.interaction?.primary||"button"===t?.interaction?.primary||y(t?.interaction?.hoverFallback)}(e)}(t)?x(l,{id:"interaction.hover-only-detail",category:"interaction",impact:"high",message:"No hover-only detail path is visible from the config."}):w(l,{id:"interaction.hover-only-detail",category:"interaction",impact:"high",message:"The chart exposes tooltip/hover detail without an obvious tap, selection, or control alternative.",fix:"Enable tap-to-select, a persistent details panel, visible segment buttons, or another non-hover path for the same information."});const R=function(e,t){const i=p[e];if(!i)return null;let a=i.includes("hoverRadius")?30:null;for(const e of i){const i=t[e];"number"==typeof i&&Number.isFinite(i)&&i>0&&(a=null==a?i:Math.max(a,i))}return null==a?null:2*a}(e,t),M=g(t.mobileInteraction)?t.mobileInteraction:null,z=R??("number"==typeof M?.targetSize?M.targetSize:!0===t.mobileInteraction?44:"number"==typeof u?.minimumHitTarget?u.minimumHitTarget:"number"==typeof u?.interaction?.targetSize?u.interaction.targetSize:null);null!=z&&(24>z?w(l,{id:"interaction.target-size-minimum",category:"interaction",impact:"high",message:`Small interactive marks expose an estimated ${z}px pointer target, below WCAG's 24px minimum.`,fix:"Increase mark radius/hoverRadius, add tap snapping to nearest datum, or provide larger external controls."}):n>z?w(l,{id:"interaction.target-size-comfort",category:"interaction",impact:"medium",message:`Pointer target is about ${z}px, above 24px but below the ${n}px comfortable phone target.`,fix:"Use hoverRadius/tapRadius near 44px while keeping the visible mark small if needed."}):x(l,{id:"interaction.target-size-comfort",category:"interaction",impact:"medium",message:`Pointer target is about ${z}px, meeting the configured ${n}px target.`}));const U=[];null==t.brush&&null==t.onBrush||U.push("brush"),!0===t.zoomable&&U.push("pan/zoom"),"isolate"!==t.legendInteraction&&"highlight"!==t.legendInteraction||U.push("legend filtering"),U.length>0&&!function(e,t){const i=b(e),a=g(e.mobileInteraction)?e.mobileInteraction:null,n=a?.standardControls;return!!(null!=e.controls||null!=e.mobileControls||!0===e.alternativeControls||Array.isArray(i?.interaction?.alternatives)&&i.interaction.alternatives.length>0)||!0===n||"all"===n||t.every(e=>"brush"===e?Array.isArray(n)?n.includes("brush"):"brush"===n:"pan/zoom"===e?Array.isArray(n)?n.includes("zoom"):"zoom"===n:"legend filtering"===e&&(Array.isArray(n)?n.includes("legend"):"legend"===n))}(t,U)&&w(l,{id:"interaction.complex-gesture-alternative",category:"interaction",impact:"high",message:`Mobile-hostile complex interaction detected: ${U.join(", ")} without standard control alternatives.`,fix:"Pair gestures with buttons, range inputs, chips, or a details panel that works with touch and keyboard."}),!1===t.showLegend||!1===t.legend||!0!==t.showLegend&&!0!==t.legend&&null==t.colorBy&&null==t.groupBy&&null==t.lineBy&&null==t.areaBy&&null==t.stackBy||!0===t.directLabel||!0===t.showLabels||"direct"===t.labelStrategy||"direct-end"===t.labelStrategy||"direct"===u?.labels?.strategy||"inline"===u?.labels?.strategy||"external"===u?.labels?.strategy||a>430||w(l,{id:"semantics.legend-over-direct-labels",category:"semantics",impact:"medium",message:"The chart appears to rely on a legend instead of direct labels at phone width.",fix:"Prefer direct end labels, inline labels, or a compact chip selector so readers do not bounce between plot and legend."});const P=Array.isArray(t.annotations)?t.annotations.filter(e=>g(e)):[];if(P.length>("number"==typeof u?.maxAnnotations?u.maxAnnotations:3)&&430>=a&&w(l,{id:"annotation.mobile-density",category:"annotation",impact:"medium",message:P.length+" annotation(s) compete for phone plot space.",fix:"Assign annotation priority, collapse secondary notes into a callout list, or provide shorter mobileText."}),P.length>0){const e=P.filter(e=>!y(e.mobileText)&&!y(e.shortText)&&!y(e.label));e.length>0&&k(l,{id:"annotation.mobile-copy",category:"annotation",impact:"low",message:e.length+" annotation(s) lack explicit short/mobile copy.",fix:"Add mobileText or shortText for notes that need to survive narrow layouts."})}f||"BigNumber"===e||k(l,{id:"layout.no-responsive-transform",category:"layout",impact:"low",message:"No explicit responsive transformation hint is present.",fix:"Declare responsiveRules/mobileLayout or a density/label strategy so the mobile version is a designed transformation, not an accidental resize."}),d&&(u?(x(l,{id:"semantics.custom-mobile-contract",category:"semantics",impact:"medium",message:"Custom chart/recipe provides a mobileSemantics/mobile contract, so the audit can inspect its authored phone behavior."}),!1===u.custom?.dataBearingSceneNodes?w(l,{id:"semantics.custom-data-bearing-scene",category:"semantics",impact:"medium",message:"Custom mobile contract says emitted scene nodes are not data-bearing.",fix:"Preserve datum references, semantic roles, or accessible-table fields so intelligence, navigation, and tap details can recover the chart's meaning."}):!0!==u.custom?.dataBearingSceneNodes&&k(l,{id:"semantics.custom-data-bearing-scene",category:"semantics",impact:"low",message:"Custom chart mobile contract does not state whether scene nodes are data-bearing.",fix:"Set mobile.custom.dataBearingSceneNodes and mobile.custom.navigationGranularity for custom layouts and interoperability adapters."})):k(l,{id:"semantics.custom-mobile-contract",category:"semantics",impact:"medium",message:"Custom chart layout is opaque to static mobile analysis because no mobileSemantics/mobile contract is present.",fix:"Declare mobileSemantics with strategy, breakpoints, mark budgets, touch target size, interaction alternatives, and custom scene semantics."})),C||$||w(l,{id:"semantics.no-mobile-summary",category:"semantics",impact:"medium",message:"No title, summary, description, or ChartContainer context is visible from the config.",fix:"Add title/summary text or wrap in ChartContainer so the small-screen reader gets the task before the chart."});const I=l.filter(e=>"warn"===e.status),F={highRisk:I.filter(e=>"high"===e.impact).length,warnings:I.length,manual:l.filter(e=>"manual"===e.status).length,passes:l.filter(e=>"pass"===e.status).length};return{component:e,viewportWidth:a,ok:0===F.highRisk,summary:F,findings:l,reference:"Mobile visualization audit: informed by MobileVisFixer, mobile exploratory interaction research, small-multiple mobile studies, responsive visualization grammars, constraint-based breakpoints, and WCAG 2.2 input modalities."}}var C={pass:"PASS",warn:"WARN",manual:"MANUAL","not-applicable":"N/A"},A=["layout","density","interaction","annotation","semantics"];function T(e){const t=[],i=e.summary,a=e.ok?`no high-risk mobile blockers at ${e.viewportWidth}px`:`${i.highRisk} high-risk mobile issue(s) at ${e.viewportWidth}px`;t.push(`${e.ok?"PASS":"WARN"} ${e.component}: mobile visualization audit`),t.push(` ${a} - ${i.warnings} warning(s) - ${i.manual} manual check(s)`);for(const i of A){const a=e.findings.filter(e=>e.category===i&&"not-applicable"!==e.status);if(0!==a.length){t.push(""),t.push(" "+i.toUpperCase());for(const e of a)t.push(` ${C[e.status]} [${e.impact}] ${e.id}: ${e.message}`),!e.fix||"warn"!==e.status&&"manual"!==e.status||t.push(" -> "+e.fix)}}return t.push(""),t.push(" Ref: "+e.reference),t.join("\n")}function S(){return["Static audit only: rendered label collision, CSS-resolved type size, and actual touch behavior still require viewport testing.","Use multiple widths, usually 320, 360, 390, 430, and 768 CSS pixels.","A mobile pass means no high-risk static warnings, not that the chart is perceptually or ergonomically optimal."]}function R(e){const t={};for(const[i,a]of e){const e=[];for(const[,t]of a.clauses){const i={};for(const[e,a]of Object.entries(t.fields))i[e]="point"===a.type?{type:"point",values:Array.from(a.values)}:{type:"interval",range:a.range};e.push({clientId:t.clientId,type:t.type,fields:i})}t[i]={name:a.name,resolution:a.resolution,clauses:e}}return t}function M(e){const t=new Map;for(const[i,a]of Object.entries(e)){const e=new Map;for(const t of a.clauses){const i={};for(const[e,a]of Object.entries(t.fields))i[e]="point"===a.type?{type:"point",values:new Set(a.values)}:{type:"interval",range:a.range};e.set(t.clientId,{clientId:t.clientId,type:t.type,fields:i})}t.set(i,{name:a.name,resolution:a.resolution,clauses:e})}return t}async function z(e,t){const{format:i="png",filename:a="chart",scale:n=2,background:r="white"}=t||{},s=e.querySelector("svg");if(!s)throw Error("No SVG element found in the container");const o=s.cloneNode(!0),l=s.getBoundingClientRect();if(o.getAttribute("width")||o.setAttribute("width",l.width+""),o.getAttribute("height")||o.setAttribute("height",l.height+""),o.getAttribute("xmlns")||o.setAttribute("xmlns","http://www.w3.org/2000/svg"),U(s,o),"svg"===i){const e=(new XMLSerializer).serializeToString(o);P(new Blob([e],{type:"image/svg+xml;charset=utf-8"}),a+".svg")}else{const t=l.width*n,i=l.height*n,s=document.createElement("canvas");s.width=t,s.height=i;const c=s.getContext("2d");c.fillStyle=r,c.fillRect(0,0,t,i),c.scale(n,n);const u=e.querySelector("canvas");u&&c.drawImage(u,0,0,l.width,l.height);const d=(new XMLSerializer).serializeToString(o),m=new Blob([d],{type:"image/svg+xml;charset=utf-8"}),h=URL.createObjectURL(m),p=new Image;p.width=l.width,p.height=l.height,await new Promise((e,t)=>{p.onload=()=>{c.drawImage(p,0,0),s.toBlob(i=>{i?(P(i,a+".png"),e()):t(Error("Failed to create PNG blob"))},"image/png"),URL.revokeObjectURL(h)},p.onerror=()=>{URL.revokeObjectURL(h),t(Error("Failed to load SVG image"))},p.src=h})}}function U(e,t){const i=e.children,a=t.children,n=window.getComputedStyle(e),r=["fill","stroke","stroke-width","stroke-dasharray","opacity","fill-opacity","stroke-opacity","font-family","font-size","font-weight","text-anchor","dominant-baseline"];for(const e of r){const i=n.getPropertyValue(e);i&&"none"!==i&&""!==i&&t.style?.setProperty(e,i)}for(let e=0;Math.min(i.length,a.length)>e;e++)U(i[e],a[e])}function P(e,t){const i=URL.createObjectURL(e),a=document.createElement("a");a.href=i,a.download=t,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i)}function I(e){const t=e.pointId??e.id??e._transitionKey;return null==t||""===t?void 0:t+""}function F(e){return e.accessibility?.tableFields??e.accessibleDatum??e.datum??null}function N(e){return"number"==typeof e&&Number.isFinite(e)}function L(e){if(N(e.x)&&N(e.y)&&N(e.w)&&N(e.h))return{x0:e.x,y0:e.y,x1:e.x+e.w,y1:e.y+e.h};if(N(e.x)&&N(e.y)&&N(e.r))return{x0:e.x-e.r,y0:e.y-e.r,x1:e.x+e.r,y1:e.y+e.r};if(N(e.cx)&&N(e.cy)&&N(e.r))return{x0:e.cx-e.r,y0:e.cy-e.r,x1:e.cx+e.r,y1:e.cy+e.r};if(N(e.cx)&&N(e.cy)&&N(e.outerR))return{x0:e.cx-e.outerR,y0:e.cy-e.outerR,x1:e.cx+e.outerR,y1:e.cy+e.outerR};const t=[e.path,e.topPath,e.bottomPath].filter(Array.isArray).flat().filter(e=>Array.isArray(e)&&N(e[0])&&N(e[1]));return t.length>0?{x0:Math.min(...t.map(e=>e[0])),y0:Math.min(...t.map(e=>e[1])),x1:Math.max(...t.map(e=>e[0])),y1:Math.max(...t.map(e=>e[1]))}:null}function B(e,t){const i=Math.max(0,Math.min(e.x1,t.x1)-Math.max(e.x0,t.x0))*Math.max(0,Math.min(e.y1,t.y1)-Math.max(e.y0,t.y0)),a=Math.min(Math.max(0,e.x1-e.x0)*Math.max(0,e.y1-e.y0),Math.max(0,t.x1-t.x0)*Math.max(0,t.y1-t.y0));return a>0?i/a:0}function D(e,i,a,n,r){if(e===i)return!0;const s=a.dataRoles.map(e=>t(e,n,r)).filter(e=>!!e).filter(t=>null!=e[t]&&null!=i[t]);return s.length>0&&s.every(t=>e[t]+""==i[t]+"")}function j(e,t,i,a,n,r="warn",s){return{id:e,category:t,status:i?"pass":r,message:i?a:n,...s?{evidence:s}:{}}}function q(r){const{recipe:s}=r,o=function(e){return Array.isArray(e)?e:e&&"object"==typeof e?[...e.nodes??e.sceneNodes??[],...e.sceneEdges??[]]:[]}(r.scene),l=r.layoutConfig??i({layoutConfig:r.layoutConfig}),c=r.dimensions.plot??{x:0,y:0,width:r.dimensions.width,height:r.dimensions.height},u=c.x??0,d=c.y??0,m=[],h=o.filter(e=>null!=F(e)),p=o.filter(e=>!("string"!=typeof e.pathD||!/NaN|Infinity|undefined/.test(e.pathD))||function(e){return[...[e.x,e.y,e.w,e.h,e.r,e.cx,e.cy,e.innerR,e.outerR,e.x1,e.x2,e.y1,e.y2,e.openY,e.closeY,e.highY,e.lowY,e.bodyWidth].filter(e=>void 0!==e),...[e.path,e.topPath,e.bottomPath].filter(Array.isArray).flat(2)]}(e).some(e=>"number"!=typeof e||!Number.isFinite(e)));m.push(j("geometry.finite","geometry",0===p.length,"All emitted geometry is finite.",p.length+" marks contain non-finite geometry.","fail",{count:p.length}));const g=o.map(L),y=g.filter(e=>e&&(e.x0>=e.x1||e.y0>=e.y1)).length;m.push(j("geometry.nonzero-area","geometry",0===y,"All bounded marks have positive area.",y+" marks have zero or negative area.","warn",{count:y}));const b=g.filter(e=>e&&(u>e.x0||d>e.y0||e.x1>u+c.width||e.y1>d+c.height)).length;m.push(j("geometry.bounds","geometry",0===b,"All bounded marks stay inside the plot.",b+" marks extend outside the plot bounds.","warn",{count:b}));const f=s.audit?.minimumHitTargetSize??s.accessibility.minimumHitTarget??24,v=g.filter(e=>!!e&&(f>e.x1-e.x0||f>e.y1-e.y0)).length;m.push(j("interaction.target-size","interaction",0===v,`All bounded targets meet the declared ${f}px minimum.`,`${v} targets are smaller than ${f}px in at least one dimension.`,"warn",{count:v,minimumTarget:f}));const x=h.map(I),w=x.filter(e=>!e).length,k=new Set,$=x.filter(e=>!(!e||!k.has(e)&&(k.add(e),1)));m.push(j("identity.stable-ids","identity",0===w,"Every data-bearing mark exposes a stable id.",w+" data-bearing marks have no pointId, id, or transition key.",s.audit?.requireStableIds?"fail":"warn",{missing:w})),m.push(j("identity.unique-ids","identity",0===$.length,"Stable mark ids are unique.",$.length+" duplicate stable ids were observed.","fail",{duplicates:[...new Set($)].slice(0,10)}));const C=x.filter(e=>e&&/^(datum|mark|node|point|rect)-?\d+$/.test(e)).length;C>0&&m.push({id:"identity.index-pattern",category:"identity",status:"warn",message:C+" ids look index-derived and may change when data is reordered.",remediation:"Derive ids from a declared identifier role or stable domain key."});const A=new Set;let T=0;const S=r.inputData;for(const e of h){const t=F(e),i=Array.isArray(t)?t:[t];let a=!1;for(const e of i)if(e&&"object"==typeof e)for(let t=0;S.length>t;t+=1)D(e,S[t],s,l,S)&&(A.add(t),a=!0);a||(T+=1)}const R=Math.max(0,S.length-A.size);m.push(j("coverage.input-data","coverage",0===R,"Every input datum is represented by the observed scene.",R+" input data items have no matching scene mark.",s.audit?.requireDatumCoverage?"fail":"warn",{represented:A.size,input:S.length})),m.push(j("coverage.scene-data","coverage",0===T,"Every data-bearing scene mark maps back to input data.",T+" scene marks do not map back to an input datum.","warn",{count:T}));const M=s.encodings?.some(e=>"count"===e.channel);!M&&h.length>A.size&&A.size>0&&m.push({id:"coverage.duplicate-references",category:"coverage",status:"warn",message:"Input data is referenced by multiple marks, but multiplicity is not declared as an encoding.",remediation:"Declare count/repetition semantics or preserve a one-to-one datum-to-mark mapping."});const z=h.filter(e=>!1===e.interactive).length;m.push(j("interaction.hit-targets","interaction",0===z&&h.length>0,"Every observed data-bearing scene node participates in hit testing.",0===h.length?"No data-bearing scene nodes were emitted for interaction.":z+" data-bearing marks explicitly disable interaction.","fail"));const U=(r.annotations??[]).map(e=>e.pointId).filter(e=>null!=e).map(String),P=U.filter(e=>!k.has(e));m.push(j("coverage.annotation-anchors","coverage",0===P.length,U.length?"All pointId annotation anchors resolve to observed scene nodes.":"No pointId annotations require scene resolution.",P.length+" annotations point to missing scene ids.","fail",{unresolved:P}));const N=(r.chart?.selectedIds??[]).filter(e=>!k.has(e));r.chart?.selectedIds&&m.push(j("interaction.selection-reachability","interaction",0===N.length,"Selected/highlighted states resolve to observed marks.",N.length+" selected ids are not reachable in the scene.","fail",{missing:N}));const q=n(o),V=(s.accessibility.tableFields??s.accessibility.tableRoles?.map(e=>({role:e,label:e}))??[]).map(e=>{if(e.field)return e.field;const i=e.role?s.dataRoles.find(t=>t.role===e.role):void 0;return i?t(i,l,S):void 0}).filter(e=>!!e),E=new Set(q.flatMap(e=>Object.keys(e.values))),W=V.filter(e=>!E.has(e));m.push(j("accessibility.table-fields","accessibility",0===W.length,V.length?"The accessible table preserves all recipe-declared fields.":"The recipe declares no explicit accessible table field projection.",`The accessible table loses declared fields: ${W.join(", ")}.`,"fail",{expectedFields:V,observedFields:[...E]})),new Set(S.flatMap(e=>Object.entries(e).filter(([,e])=>["string","number","boolean"].includes(typeof e)).map(([e])=>e))).size>2&&2>=E.size&&[...E].every(e=>"category"===e||"value"===e)&&m.push({id:"accessibility.generic-table-loss",category:"accessibility",status:"warn",message:"The table exposes only generic category/value fields although richer input data exists.",remediation:"Emit accessibleDatum or accessibility.tableFields on scene nodes."});const H=(s.encodings?.filter(e=>"color"===e.channel)??[]).filter(e=>!e.redundantWith||0===e.redundantWith.length);m.push(j("accessibility.color-only","accessibility",0===H.length,"Every declared color encoding names a redundant cue.",H.length+" color encodings have no declared redundant cue.","warn"));const O=r.chart;if(O){for(const[e,t]of[["title",s.accessibility.requiresTitle],["summary",s.accessibility.requiresSummary],["description","required"===s.accessibility.description]])t&&m.push(j("accessibility."+e,"accessibility","string"==typeof O[e]&&O[e].trim().length>0,`A chart ${e} is present.`,`The recipe requires a chart ${e}, but none was supplied.`,"fail"));(s.accessibility.requiresAccessibleTable||"required"===s.accessibility.accessibleTable||s.accessibility.fallbackTable)&&m.push(j("accessibility.fallback-table","accessibility",!1!==O.accessibleTable,"The accessible fallback table is enabled.","The recipe requires a fallback table, but accessibleTable is disabled.","fail")),O.navigationTree&&m.push(j("accessibility.navigation-depth","accessibility",(O.navigationTree.children?.length??0)>0,"The navigation tree exposes structure below the root.","The navigation tree is root-only.","fail"))}const Y=r.theme?.background??"#ffffff",G=o.filter(t=>{const i=t.style?.fill??t.fill;if("string"!=typeof i||!i.startsWith("#")||!Y.startsWith("#"))return!1;const a=e(i,Y);return null!=a&&3>a}).length;m.push(j("visual.contrast","visual",0===G,"All statically checkable mark fills meet 3:1 contrast.",G+" marks have fill contrast below 3:1.","warn",{background:Y}));let J=0;const Q=g.filter(e=>!!e).slice(0,500);for(let e=0;Q.length>e;e+=1)for(let t=e+1;Q.length>t;t+=1).8>B(Q[e],Q[t])||(J+=1);J>Q.length&&m.push({id:"visual.overlap-density",category:"visual",status:"warn",message:J+" near-total mark overlaps suggest occlusion or excessive density.",remediation:"Aggregate, jitter, layer explicitly, or declare overlap as intentional."});const K=[["manual-at.screen-reader","Verify real screen-reader behavior with the target browser/AT combinations."],["manual-at.cognitive-load","Assess cognitive load and whether the custom metaphor is understood."],["manual-at.keyboard-order","Verify that keyboard order is meaningful, not merely mechanically available."],["manual-at.animation","Verify that animation is not distracting and reduced-motion behavior is sufficient."],["manual-at.reception","Test whether the memorable form is received as intended by the target audience."],["manual-at.overlay-occlusion","Inspect labels, overlays, annotations, and important marks for clipping or occlusion."],["manual-at.observation","Exercise hover, focus, selection, and observation emission in the rendered chart."]].map(([e,t])=>({id:e,category:"manual-at",status:"manual",message:t})),X={dataRoles:s.dataRoles.map(e=>e.role),intents:s.intents.map(a).filter(e=>!!e),accessibilityExpectations:[...s.accessibility.requirements??[],...s.accessibility.tableFields?.map(e=>"table field: "+e.label)??[]],fallbackDeclared:!0===s.accessibility.fallbackTable||"required"===s.accessibility.accessibleTable||!0===s.accessibility.requiresAccessibleTable,designContractDeclared:!!s.designContract?.whyCustom},_=[...m,...K],Z=m.filter(e=>"fail"===e.status).length;return{recipeId:s.id,ok:0===Z,summary:{marks:o.length,passes:_.filter(e=>"pass"===e.status).length,warnings:_.filter(e=>"warn"===e.status).length,failures:Z,manual:_.filter(e=>"manual"===e.status).length},declaredSemantics:X,observedSceneEvidence:m,manualATChecks:K}}export{o as smartTickFormat,d as adaptiveTimeTicks,$ as auditMobileVisualization,T as formatMobileVisualizationAudit,S as mobileVisualizationCaveats,R as serializeSelections,M as deserializeSelections,z as exportChart,q as auditObservedScene};
1
+ import{contrastRatio as e,fieldForRole as t,recipeConfig as i,recipeIntentId as a}from"./chunk-chunk-YC2IVEPX.module.min.js";import{extractAllRows as n,resolveResponsiveRules as r}from"./chunk-chunk-CO5KQMGH.module.min.js";import*as s from"react";function o(e){if(null==e)return"";if("number"!=typeof e)return e+"";if(!isFinite(e))return e+"";if(0===e)return"0";const t=parseFloat(e.toPrecision(12)),i=Math.abs(t);return 1e9>i?1e6>i?1e4>i?Number.isInteger(t)?t+"":parseFloat(t.toPrecision(6))+"":parseFloat((t/1e3).toPrecision(3))+"K":parseFloat((t/1e6).toPrecision(3))+"M":parseFloat((t/1e9).toPrecision(3))+"B"}var l=864e5;function c(e){return 10>e?"0"+e:e+""}var u=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function d(e){let t,i=e;return(a,n,r)=>{const s=a instanceof Date?a:new Date(a);e||!r||2>r.length||r===t||(t=r,i=function(e){if(2>e.length)return"days";const t=[];for(let i=1;e.length>i;i++)t.push(e[i]-e[i-1]);t.sort((e,t)=>e-t);const i=t[Math.floor(t.length/2)];return 12e4>i?"seconds":72e5>i?"minutes":2*l>i?"hours":60*l>i?"days":400*l>i?"months":"years"}(r));const o=i||"days";return null!=n&&0!==n&&r&&0!==r.length?function(e,t,i){const a=e.getUTCFullYear()!==t.getUTCFullYear(),n=a||e.getUTCMonth()!==t.getUTCMonth(),r=n||e.getUTCDate()!==t.getUTCDate(),s=r||e.getUTCHours()!==t.getUTCHours(),o=s||e.getUTCMinutes()!==t.getUTCMinutes(),l=u[e.getUTCMonth()],d=e.getUTCDate(),m=e.getUTCFullYear(),h=c(e.getUTCHours()),p=c(e.getUTCMinutes()),g=c(e.getUTCSeconds());switch(i){case"seconds":return a?`${l} ${d}, ${m} ${h}:${p}:${g}`:r?`${l} ${d} ${h}:${p}:${g}`:s?`${h}:${p}:${g}`:o?`${p}:${g}`:":"+g;case"minutes":return a?`${l} ${d}, ${m} ${h}:${p}`:r?`${l} ${d} ${h}:${p}`:s?`${h}:${p}`:":"+p;case"hours":return a?`${l} ${d}, ${m} ${h}:00`:n?`${l} ${d} ${h}:${p}`:r?`${l} ${d} ${h}:00`:h+":00";case"days":return a?`${l} ${d}, ${m}`:n?`${l} ${d}`:""+d;case"months":return a?`${l} ${m}`:""+l;case"years":return""+m}}(s,new Date(r[n-1]),o):function(e,t){const i=u[e.getUTCMonth()],a=e.getUTCDate(),n=e.getUTCFullYear(),r=c(e.getUTCHours()),s=c(e.getUTCMinutes()),o=c(e.getUTCSeconds());switch(t){case"seconds":return`${i} ${a}, ${n} ${r}:${s}:${o}`;case"minutes":case"hours":return`${i} ${a}, ${n} ${r}:${s}`;case"days":return`${i} ${a}, ${n}`;case"months":return`${i} ${n}`;case"years":return""+n}}(s,o)}}var m=new Set(["LineChart","AreaChart","DifferenceChart","StackedAreaChart","Scatterplot","ConnectedScatterplot","BubbleChart","QuadrantChart","MultiAxisLineChart","CandlestickChart","Heatmap","MinimapChart","RealtimeLineChart","RealtimeHeatmap"]),h=new Set(["BarChart","StackedBarChart","GroupedBarChart","SwarmPlot","BoxPlot","Histogram","ViolinPlot","DotPlot","RidgelinePlot","FunnelChart","LikertChart","SwimlaneChart"]),p={Scatterplot:["pointRadius","hoverRadius"],BubbleChart:["pointRadius","hoverRadius"],ConnectedScatterplot:["pointRadius","hoverRadius"],QuadrantChart:["pointRadius","hoverRadius"],SwarmPlot:["pointRadius","hoverRadius"],DotPlot:["dotRadius","hoverRadius"]};function g(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function y(e){return"string"==typeof e&&e.trim().length>0}function b(e){const t=g(e.capability)?e.capability:null,i=g(e.recipe)?e.recipe:null,a=[e.mobileSemantics,e.mobileVisualization,e.mobile,t?.mobile,i?.mobile];for(const e of a)if(g(e))return e;return null}function f(e){return Array.isArray(e)&&e.length>=2&&"number"==typeof e[0]&&"number"==typeof e[1]&&Number.isFinite(e[0])&&Number.isFinite(e[1])?[e[0],e[1]]:null}function v(e){return f(e.size)||f(g(e.frameProps)?e.frameProps.size:void 0)||("number"==typeof e.width&&"number"==typeof e.height?[e.width,e.height]:null)}function x(e,t){e.push({...t,status:"pass"})}function w(e,t){e.push({...t,status:"warn"})}function k(e,t){e.push({...t,status:"manual"})}function $(e,t={},i={}){const a=i.viewportWidth??390,n=i.targetSize??44,s=v(t),o=r(t,{width:a,height:s?.[1]}),l=[],c=v(t=o.props),u=b(t),d=function(e,t){return e.includes("CustomChart")||e.includes("Custom")||null!=t.recipeId||null!=t.mobileSemantics}(e,t),f=function(e){const t=b(e);return!0===e.responsive||!0===e.mobile||!0===t?.responsive||!0===t?.supportsResponsiveLayout||Array.isArray(t?.breakpoints)||"number"==typeof t?.minViewportWidth||"responsive"===t?.strategy||"small-multiples"===t?.strategy||"summary-cards"===t?.strategy||null!=e.mobileLayout||null!=e.responsiveRules||"mobile-readable"===e.density}(t),$=!0===i.inChartContainer,C=y(t.title)||y(t.summary)||y(t.description)||!0===u?.summary||y(u?.summary);if(o.matches.length>0&&x(l,{id:"layout.responsive-rule-applied",category:"layout",impact:"medium",message:`${o.matches.length} responsive rule(s) applied for the ${a}px mobile audit.`}),c){const[t,i]=c;t>a&&!f?w(l,{id:"layout.fixed-desktop-size",category:"layout",impact:"high",message:`Chart size is ${t}px wide against a ${a}px mobile viewport with no responsive/mobile transform hint.`,fix:"Use responsive sizing, responsiveRules/mobileLayout, or an explicit mobile variant that preserves the task instead of clipping the desktop chart."}):x(l,{id:"layout.fixed-desktop-size",category:"layout",impact:"high",message:"No fixed desktop-width overflow risk is visible from the config."}),"number"==typeof u?.minViewportWidth&&u.minViewportWidth>a&&w(l,{id:"layout.mobile-min-width",category:"layout",impact:"high",message:`The declared mobile contract supports ${u.minViewportWidth}px minimum, wider than the audited ${a}px viewport.`,fix:"Add a narrower breakpoint, summary-card fallback, or explicit horizontal-scroll affordance with a non-visual equivalent."});const n=t/Math.max(1,i);430>=a&&n>2.4&&"BigNumber"!==e&&w(l,{id:"layout.wide-aspect-ratio",category:"layout",impact:"medium",message:`Chart aspect ratio is ${n.toFixed(1)}:1, which tends to compress phone charts vertically.`,fix:"Prefer stacked sections, small multiples, cards plus a sparkline, or a taller mobile-specific chart ratio."}),160>i&&"BigNumber"!==e&&w(l,{id:"layout.too-short-for-reading",category:"layout",impact:"medium",message:`Chart height is ${i}px; most phone charts need enough vertical room for marks plus readable labels.`,fix:"Reserve more vertical space, remove nonessential axes, or switch to a card/sparkline pattern with external labels."})}else k(l,{id:"layout.unknown-size",category:"layout",impact:"medium",message:"No explicit size is available to audit. This may be responsive, but static mobile overflow cannot be checked.",fix:"Audit rendered widths at 320, 360, 390, and 430px, or pass size/responsiveRules metadata into the config."});const A=function(e){const t=[e.data,e.points,e.lines,e.nodes,e.edges,e.areas,g(e.frameProps)?e.frameProps.data:void 0];let i=0;for(const e of t)Array.isArray(e)&&(i+=e.length);return i}(t);A>0&&(A>("number"==typeof u?.maxMarks?u.maxMarks:m.has(e)?1.25*a:h.has(e)?Math.max(8,Math.floor(a/34)):a)?w(l,{id:"density.mark-budget",category:"density",impact:m.has(e)?"medium":"high",message:`${A} data item(s) exceed the rough mobile density budget for ${e} at ${a}px.`,fix:"Aggregate, filter, facet into small multiples, switch to a summary-card plus detail view, or use progressive disclosure."}):x(l,{id:"density.mark-budget",category:"density",impact:"medium",message:A+" data item(s) are within the rough mobile density budget for this component."}));const T=function(e){const t=[e.tickValues,e.xTickValues,e.yTickValues,e.rTickValues,e.oTickValues];let i=0;for(const e of t)Array.isArray(e)&&(i+=e.length);return i>0?i:null}(t),S=!1!==t.showAxes&&!1!==t.axis;if(S&&null!=T){const e=Math.max(3,Math.floor(a/58));T>e&&w(l,{id:"density.explicit-tick-count",category:"density",impact:"medium",message:`${T} explicit tick(s) exceed a phone-friendly budget of about ${e} at ${a}px.`,fix:"Use adaptive ticks, fewer tickValues, direct labels, or move exact values into a tap-accessible detail panel."})}else S&&(m.has(e)||h.has(e))&&k(l,{id:"density.axis-label-collision",category:"density",impact:"medium",message:"Axes are enabled, but label collision depends on rendered tick text and cannot be checked statically.",fix:"Verify tick labels at phone widths or provide explicit mobile tick density."});!function(e){const t=g(e.frameProps)?e.frameProps:{};return(!0===e.enableHover||null!=e.tooltipContent||null!=e.tooltip||null!=t.tooltipContent||!0===t.enableHover)&&!function(e){const t=b(e),i=g(e.mobileInteraction)?e.mobileInteraction:null;return null!=e.controls||null!=e.mobileControls||!0===e.alternativeControls||null!=e.selection||null!=e.onClick||null!=e.onSelect||!0===e.mobileInteraction||!0===i?.tapToSelect||!0===i?.tapToLockTooltip||Array.isArray(t?.interaction?.alternatives)&&t.interaction.alternatives.length>0||"tap"===t?.interaction?.primary||"button"===t?.interaction?.primary||y(t?.interaction?.hoverFallback)}(e)}(t)?x(l,{id:"interaction.hover-only-detail",category:"interaction",impact:"high",message:"No hover-only detail path is visible from the config."}):w(l,{id:"interaction.hover-only-detail",category:"interaction",impact:"high",message:"The chart exposes tooltip/hover detail without an obvious tap, selection, or control alternative.",fix:"Enable tap-to-select, a persistent details panel, visible segment buttons, or another non-hover path for the same information."});const R=function(e,t){const i=p[e];if(!i)return null;let a=i.includes("hoverRadius")?30:null;for(const e of i){const i=t[e];"number"==typeof i&&Number.isFinite(i)&&i>0&&(a=null==a?i:Math.max(a,i))}return null==a?null:2*a}(e,t),M=g(t.mobileInteraction)?t.mobileInteraction:null,z=R??("number"==typeof M?.targetSize?M.targetSize:!0===t.mobileInteraction?44:"number"==typeof u?.minimumHitTarget?u.minimumHitTarget:"number"==typeof u?.interaction?.targetSize?u.interaction.targetSize:null);null!=z&&(24>z?w(l,{id:"interaction.target-size-minimum",category:"interaction",impact:"high",message:`Small interactive marks expose an estimated ${z}px pointer target, below WCAG's 24px minimum.`,fix:"Increase mark radius/hoverRadius, add tap snapping to nearest datum, or provide larger external controls."}):n>z?w(l,{id:"interaction.target-size-comfort",category:"interaction",impact:"medium",message:`Pointer target is about ${z}px, above 24px but below the ${n}px comfortable phone target.`,fix:"Use hoverRadius/tapRadius near 44px while keeping the visible mark small if needed."}):x(l,{id:"interaction.target-size-comfort",category:"interaction",impact:"medium",message:`Pointer target is about ${z}px, meeting the configured ${n}px target.`}));const U=[];null==t.brush&&null==t.onBrush||U.push("brush"),!0===t.zoomable&&U.push("pan/zoom"),"isolate"!==t.legendInteraction&&"highlight"!==t.legendInteraction||U.push("legend filtering"),U.length>0&&!function(e,t){const i=b(e),a=g(e.mobileInteraction)?e.mobileInteraction:null,n=a?.standardControls;return!!(null!=e.controls||null!=e.mobileControls||!0===e.alternativeControls||Array.isArray(i?.interaction?.alternatives)&&i.interaction.alternatives.length>0)||!0===n||"all"===n||t.every(e=>"brush"===e?Array.isArray(n)?n.includes("brush"):"brush"===n:"pan/zoom"===e?Array.isArray(n)?n.includes("zoom"):"zoom"===n:"legend filtering"===e&&(Array.isArray(n)?n.includes("legend"):"legend"===n))}(t,U)&&w(l,{id:"interaction.complex-gesture-alternative",category:"interaction",impact:"high",message:`Mobile-hostile complex interaction detected: ${U.join(", ")} without standard control alternatives.`,fix:"Pair gestures with buttons, range inputs, chips, or a details panel that works with touch and keyboard."}),!1===t.showLegend||!1===t.legend||!0!==t.showLegend&&!0!==t.legend&&null==t.colorBy&&null==t.groupBy&&null==t.lineBy&&null==t.areaBy&&null==t.stackBy||!0===t.directLabel||!0===t.showLabels||"direct"===t.labelStrategy||"direct-end"===t.labelStrategy||"direct"===u?.labels?.strategy||"inline"===u?.labels?.strategy||"external"===u?.labels?.strategy||a>430||w(l,{id:"semantics.legend-over-direct-labels",category:"semantics",impact:"medium",message:"The chart appears to rely on a legend instead of direct labels at phone width.",fix:"Prefer direct end labels, inline labels, or a compact chip selector so readers do not bounce between plot and legend."});const P=Array.isArray(t.annotations)?t.annotations.filter(e=>g(e)):[];if(P.length>("number"==typeof u?.maxAnnotations?u.maxAnnotations:3)&&430>=a&&w(l,{id:"annotation.mobile-density",category:"annotation",impact:"medium",message:P.length+" annotation(s) compete for phone plot space.",fix:"Assign annotation priority, collapse secondary notes into a callout list, or provide shorter mobileText."}),P.length>0){const e=P.filter(e=>!y(e.mobileText)&&!y(e.shortText)&&!y(e.label));e.length>0&&k(l,{id:"annotation.mobile-copy",category:"annotation",impact:"low",message:e.length+" annotation(s) lack explicit short/mobile copy.",fix:"Add mobileText or shortText for notes that need to survive narrow layouts."})}f||"BigNumber"===e||k(l,{id:"layout.no-responsive-transform",category:"layout",impact:"low",message:"No explicit responsive transformation hint is present.",fix:"Declare responsiveRules/mobileLayout or a density/label strategy so the mobile version is a designed transformation, not an accidental resize."}),d&&(u?(x(l,{id:"semantics.custom-mobile-contract",category:"semantics",impact:"medium",message:"Custom chart/recipe provides a mobileSemantics/mobile contract, so the audit can inspect its authored phone behavior."}),!1===u.custom?.dataBearingSceneNodes?w(l,{id:"semantics.custom-data-bearing-scene",category:"semantics",impact:"medium",message:"Custom mobile contract says emitted scene nodes are not data-bearing.",fix:"Preserve datum references, semantic roles, or accessible-table fields so intelligence, navigation, and tap details can recover the chart's meaning."}):!0!==u.custom?.dataBearingSceneNodes&&k(l,{id:"semantics.custom-data-bearing-scene",category:"semantics",impact:"low",message:"Custom chart mobile contract does not state whether scene nodes are data-bearing.",fix:"Set mobile.custom.dataBearingSceneNodes and mobile.custom.navigationGranularity for custom layouts and interoperability adapters."})):k(l,{id:"semantics.custom-mobile-contract",category:"semantics",impact:"medium",message:"Custom chart layout is opaque to static mobile analysis because no mobileSemantics/mobile contract is present.",fix:"Declare mobileSemantics with strategy, breakpoints, mark budgets, touch target size, interaction alternatives, and custom scene semantics."})),C||$||w(l,{id:"semantics.no-mobile-summary",category:"semantics",impact:"medium",message:"No title, summary, description, or ChartContainer context is visible from the config.",fix:"Add title/summary text or wrap in ChartContainer so the small-screen reader gets the task before the chart."});const I=l.filter(e=>"warn"===e.status),N={highRisk:I.filter(e=>"high"===e.impact).length,warnings:I.length,manual:l.filter(e=>"manual"===e.status).length,passes:l.filter(e=>"pass"===e.status).length};return{component:e,viewportWidth:a,ok:0===N.highRisk,summary:N,findings:l,reference:"Mobile visualization audit: informed by MobileVisFixer, mobile exploratory interaction research, small-multiple mobile studies, responsive visualization grammars, constraint-based breakpoints, and WCAG 2.2 input modalities."}}var C={pass:"PASS",warn:"WARN",manual:"MANUAL","not-applicable":"N/A"},A=["layout","density","interaction","annotation","semantics"];function T(e){const t=[],i=e.summary,a=e.ok?`no high-risk mobile blockers at ${e.viewportWidth}px`:`${i.highRisk} high-risk mobile issue(s) at ${e.viewportWidth}px`;t.push(`${e.ok?"PASS":"WARN"} ${e.component}: mobile visualization audit`),t.push(` ${a} - ${i.warnings} warning(s) - ${i.manual} manual check(s)`);for(const i of A){const a=e.findings.filter(e=>e.category===i&&"not-applicable"!==e.status);if(0!==a.length){t.push(""),t.push(" "+i.toUpperCase());for(const e of a)t.push(` ${C[e.status]} [${e.impact}] ${e.id}: ${e.message}`),!e.fix||"warn"!==e.status&&"manual"!==e.status||t.push(" -> "+e.fix)}}return t.push(""),t.push(" Ref: "+e.reference),t.join("\n")}function S(){return["Static audit only: rendered label collision, CSS-resolved type size, and actual touch behavior still require viewport testing.","Use multiple widths, usually 320, 360, 390, 430, and 768 CSS pixels.","A mobile pass means no high-risk static warnings, not that the chart is perceptually or ergonomically optimal."]}function R(e){const t={};for(const[i,a]of e){const e=[];for(const[,t]of a.clauses){const i={};for(const[e,a]of Object.entries(t.fields))i[e]="point"===a.type?{type:"point",values:Array.from(a.values)}:{type:"interval",range:a.range};e.push({clientId:t.clientId,type:t.type,fields:i})}t[i]={name:a.name,resolution:a.resolution,clauses:e}}return t}function M(e){const t=new Map;for(const[i,a]of Object.entries(e)){const e=new Map;for(const t of a.clauses){const i={};for(const[e,a]of Object.entries(t.fields))i[e]="point"===a.type?{type:"point",values:new Set(a.values)}:{type:"interval",range:a.range};e.set(t.clientId,{clientId:t.clientId,type:t.type,fields:i})}t.set(i,{name:a.name,resolution:a.resolution,clauses:e})}return t}async function z(e,t){const{format:i="png",filename:a="chart",scale:n=2,background:r="white"}=t||{},s=e.querySelector("svg");if(!s)throw Error("No SVG element found in the container");const o=s.cloneNode(!0),l=s.getBoundingClientRect();if(o.getAttribute("width")||o.setAttribute("width",l.width+""),o.getAttribute("height")||o.setAttribute("height",l.height+""),o.getAttribute("xmlns")||o.setAttribute("xmlns","http://www.w3.org/2000/svg"),U(s,o),"svg"===i){const e=(new XMLSerializer).serializeToString(o);P(new Blob([e],{type:"image/svg+xml;charset=utf-8"}),a+".svg")}else{const t=l.width*n,i=l.height*n,s=document.createElement("canvas");s.width=t,s.height=i;const c=s.getContext("2d");c.fillStyle=r,c.fillRect(0,0,t,i),c.scale(n,n);const u=e.querySelector("canvas");u&&c.drawImage(u,0,0,l.width,l.height);const d=(new XMLSerializer).serializeToString(o),m=new Blob([d],{type:"image/svg+xml;charset=utf-8"}),h=URL.createObjectURL(m),p=new Image;p.width=l.width,p.height=l.height,await new Promise((e,t)=>{p.onload=()=>{c.drawImage(p,0,0),s.toBlob(i=>{i?(P(i,a+".png"),e()):t(Error("Failed to create PNG blob"))},"image/png"),URL.revokeObjectURL(h)},p.onerror=()=>{URL.revokeObjectURL(h),t(Error("Failed to load SVG image"))},p.src=h})}}function U(e,t){const i=e.children,a=t.children,n=window.getComputedStyle(e),r=["fill","stroke","stroke-width","stroke-dasharray","opacity","fill-opacity","stroke-opacity","font-family","font-size","font-weight","text-anchor","dominant-baseline"];for(const e of r){const i=n.getPropertyValue(e);i&&"none"!==i&&""!==i&&t.style?.setProperty(e,i)}for(let e=0;Math.min(i.length,a.length)>e;e++)U(i[e],a[e])}function P(e,t){const i=URL.createObjectURL(e),a=document.createElement("a");a.href=i,a.download=t,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i)}function I(e){const t=e.pointId??e.id??e._transitionKey;return null==t||""===t?void 0:t+""}function N(e){return e.accessibility?.tableFields??e.accessibleDatum??e.datum??null}function F(e){return"number"==typeof e&&Number.isFinite(e)}function L(e){if(F(e.x)&&F(e.y)&&F(e.w)&&F(e.h))return{x0:e.x,y0:e.y,x1:e.x+e.w,y1:e.y+e.h};if(F(e.x)&&F(e.y)&&F(e.r))return{x0:e.x-e.r,y0:e.y-e.r,x1:e.x+e.r,y1:e.y+e.r};if(F(e.cx)&&F(e.cy)&&F(e.r))return{x0:e.cx-e.r,y0:e.cy-e.r,x1:e.cx+e.r,y1:e.cy+e.r};if(F(e.cx)&&F(e.cy)&&F(e.outerR))return{x0:e.cx-e.outerR,y0:e.cy-e.outerR,x1:e.cx+e.outerR,y1:e.cy+e.outerR};const t=[e.path,e.topPath,e.bottomPath].filter(Array.isArray).flat().filter(e=>Array.isArray(e)&&F(e[0])&&F(e[1]));return t.length>0?{x0:Math.min(...t.map(e=>e[0])),y0:Math.min(...t.map(e=>e[1])),x1:Math.max(...t.map(e=>e[0])),y1:Math.max(...t.map(e=>e[1]))}:null}function B(e,t){const i=Math.max(0,Math.min(e.x1,t.x1)-Math.max(e.x0,t.x0))*Math.max(0,Math.min(e.y1,t.y1)-Math.max(e.y0,t.y0)),a=Math.min(Math.max(0,e.x1-e.x0)*Math.max(0,e.y1-e.y0),Math.max(0,t.x1-t.x0)*Math.max(0,t.y1-t.y0));return a>0?i/a:0}function D(e,i,a,n,r){if(e===i)return!0;const s=a.dataRoles.map(e=>t(e,n,r)).filter(e=>!!e).filter(t=>null!=e[t]&&null!=i[t]);return s.length>0&&s.every(t=>e[t]+""==i[t]+"")}function V(e,t,i,a,n,r="warn",s){return{id:e,category:t,status:i?"pass":r,message:i?a:n,...s?{evidence:s}:{}}}function j(r){const{recipe:s}=r,o=function(e){return Array.isArray(e)?e:e&&"object"==typeof e?[...e.nodes??e.sceneNodes??[],...e.sceneEdges??[]]:[]}(r.scene),l=r.layoutConfig??i({layoutConfig:r.layoutConfig}),c=r.dimensions.plot??{x:0,y:0,width:r.dimensions.width,height:r.dimensions.height},u=c.x??0,d=c.y??0,m=[],h=o.filter(e=>null!=N(e)),p=o.filter(e=>!("string"!=typeof e.pathD||!/NaN|Infinity|undefined/.test(e.pathD))||function(e){return[...[e.x,e.y,e.w,e.h,e.r,e.cx,e.cy,e.innerR,e.outerR,e.x1,e.x2,e.y1,e.y2,e.openY,e.closeY,e.highY,e.lowY,e.bodyWidth].filter(e=>void 0!==e),...[e.path,e.topPath,e.bottomPath].filter(Array.isArray).flat(2)]}(e).some(e=>"number"!=typeof e||!Number.isFinite(e)));m.push(V("geometry.finite","geometry",0===p.length,"All emitted geometry is finite.",p.length+" marks contain non-finite geometry.","fail",{count:p.length}));const g=o.map(L),y=g.filter(e=>e&&(e.x0>=e.x1||e.y0>=e.y1)).length;m.push(V("geometry.nonzero-area","geometry",0===y,"All bounded marks have positive area.",y+" marks have zero or negative area.","warn",{count:y}));const b=g.filter(e=>e&&(u>e.x0||d>e.y0||e.x1>u+c.width||e.y1>d+c.height)).length;m.push(V("geometry.bounds","geometry",0===b,"All bounded marks stay inside the plot.",b+" marks extend outside the plot bounds.","warn",{count:b}));const f=s.audit?.minimumHitTargetSize??s.accessibility.minimumHitTarget??24,v=g.filter(e=>!!e&&(f>e.x1-e.x0||f>e.y1-e.y0)).length;m.push(V("interaction.target-size","interaction",0===v,`All bounded targets meet the declared ${f}px minimum.`,`${v} targets are smaller than ${f}px in at least one dimension.`,"warn",{count:v,minimumTarget:f}));const x=h.map(I),w=x.filter(e=>!e).length,k=new Set,$=x.filter(e=>!(!e||!k.has(e)&&(k.add(e),1)));m.push(V("identity.stable-ids","identity",0===w,"Every data-bearing mark exposes a stable id.",w+" data-bearing marks have no pointId, id, or transition key.",s.audit?.requireStableIds?"fail":"warn",{missing:w})),m.push(V("identity.unique-ids","identity",0===$.length,"Stable mark ids are unique.",$.length+" duplicate stable ids were observed.","fail",{duplicates:[...new Set($)].slice(0,10)}));const C=x.filter(e=>e&&/^(datum|mark|node|point|rect)-?\d+$/.test(e)).length;C>0&&m.push({id:"identity.index-pattern",category:"identity",status:"warn",message:C+" ids look index-derived and may change when data is reordered.",remediation:"Derive ids from a declared identifier role or stable domain key."});const A=new Set;let T=0;const S=r.inputData;for(const e of h){const t=N(e),i=Array.isArray(t)?t:[t];let a=!1;for(const e of i)if(e&&"object"==typeof e)for(let t=0;S.length>t;t+=1)D(e,S[t],s,l,S)&&(A.add(t),a=!0);a||(T+=1)}const R=Math.max(0,S.length-A.size);m.push(V("coverage.input-data","coverage",0===R,"Every input datum is represented by the observed scene.",R+" input data items have no matching scene mark.",s.audit?.requireDatumCoverage?"fail":"warn",{represented:A.size,input:S.length})),m.push(V("coverage.scene-data","coverage",0===T,"Every data-bearing scene mark maps back to input data.",T+" scene marks do not map back to an input datum.","warn",{count:T}));const M=s.encodings?.some(e=>"count"===e.channel);!M&&h.length>A.size&&A.size>0&&m.push({id:"coverage.duplicate-references",category:"coverage",status:"warn",message:"Input data is referenced by multiple marks, but multiplicity is not declared as an encoding.",remediation:"Declare count/repetition semantics or preserve a one-to-one datum-to-mark mapping."});const z=h.filter(e=>!1===e.interactive).length;m.push(V("interaction.hit-targets","interaction",0===z&&h.length>0,"Every observed data-bearing scene node participates in hit testing.",0===h.length?"No data-bearing scene nodes were emitted for interaction.":z+" data-bearing marks explicitly disable interaction.","fail"));const U=(r.annotations??[]).map(e=>e.pointId).filter(e=>null!=e).map(String),P=U.filter(e=>!k.has(e));m.push(V("coverage.annotation-anchors","coverage",0===P.length,U.length?"All pointId annotation anchors resolve to observed scene nodes.":"No pointId annotations require scene resolution.",P.length+" annotations point to missing scene ids.","fail",{unresolved:P}));const F=(r.chart?.selectedIds??[]).filter(e=>!k.has(e));r.chart?.selectedIds&&m.push(V("interaction.selection-reachability","interaction",0===F.length,"Selected/highlighted states resolve to observed marks.",F.length+" selected ids are not reachable in the scene.","fail",{missing:F}));const j=n(o),q=(s.accessibility.tableFields??s.accessibility.tableRoles?.map(e=>({role:e,label:e}))??[]).map(e=>{if(e.field)return e.field;const i=e.role?s.dataRoles.find(t=>t.role===e.role):void 0;return i?t(i,l,S):void 0}).filter(e=>!!e),E=new Set(j.flatMap(e=>Object.keys(e.values))),W=q.filter(e=>!E.has(e));m.push(V("accessibility.table-fields","accessibility",0===W.length,q.length?"The accessible table preserves all recipe-declared fields.":"The recipe declares no explicit accessible table field projection.",`The accessible table loses declared fields: ${W.join(", ")}.`,"fail",{expectedFields:q,observedFields:[...E]})),new Set(S.flatMap(e=>Object.entries(e).filter(([,e])=>["string","number","boolean"].includes(typeof e)).map(([e])=>e))).size>2&&2>=E.size&&[...E].every(e=>"category"===e||"value"===e)&&m.push({id:"accessibility.generic-table-loss",category:"accessibility",status:"warn",message:"The table exposes only generic category/value fields although richer input data exists.",remediation:"Emit accessibleDatum or accessibility.tableFields on scene nodes."});const H=(s.encodings?.filter(e=>"color"===e.channel)??[]).filter(e=>!e.redundantWith||0===e.redundantWith.length);m.push(V("accessibility.color-only","accessibility",0===H.length,"Every declared color encoding names a redundant cue.",H.length+" color encodings have no declared redundant cue.","warn"));const O=r.chart;if(O){for(const[e,t]of[["title",s.accessibility.requiresTitle],["summary",s.accessibility.requiresSummary],["description","required"===s.accessibility.description]])t&&m.push(V("accessibility."+e,"accessibility","string"==typeof O[e]&&O[e].trim().length>0,`A chart ${e} is present.`,`The recipe requires a chart ${e}, but none was supplied.`,"fail"));(s.accessibility.requiresAccessibleTable||"required"===s.accessibility.accessibleTable||s.accessibility.fallbackTable)&&m.push(V("accessibility.fallback-table","accessibility",!1!==O.accessibleTable,"The accessible fallback table is enabled.","The recipe requires a fallback table, but accessibleTable is disabled.","fail")),O.navigationTree&&m.push(V("accessibility.navigation-depth","accessibility",(O.navigationTree.children?.length??0)>0,"The navigation tree exposes structure below the root.","The navigation tree is root-only.","fail"))}const Y=r.theme?.background??"#ffffff",G=o.filter(t=>{const i=t.style?.fill??t.fill;if("string"!=typeof i||!i.startsWith("#")||!Y.startsWith("#"))return!1;const a=e(i,Y);return null!=a&&3>a}).length;m.push(V("visual.contrast","visual",0===G,"All statically checkable mark fills meet 3:1 contrast.",G+" marks have fill contrast below 3:1.","warn",{background:Y}));let J=0;const K=g.filter(e=>!!e).slice(0,500);for(let e=0;K.length>e;e+=1)for(let t=e+1;K.length>t;t+=1).8>B(K[e],K[t])||(J+=1);J>K.length&&m.push({id:"visual.overlap-density",category:"visual",status:"warn",message:J+" near-total mark overlaps suggest occlusion or excessive density.",remediation:"Aggregate, jitter, layer explicitly, or declare overlap as intentional."});const Q=[["manual-at.screen-reader","Verify real screen-reader behavior with the target browser/AT combinations."],["manual-at.cognitive-load","Assess cognitive load and whether the custom metaphor is understood."],["manual-at.keyboard-order","Verify that keyboard order is meaningful, not merely mechanically available."],["manual-at.animation","Verify that animation is not distracting and reduced-motion behavior is sufficient."],["manual-at.reception","Test whether the memorable form is received as intended by the target audience."],["manual-at.overlay-occlusion","Inspect labels, overlays, annotations, and important marks for clipping or occlusion."],["manual-at.observation","Exercise hover, focus, selection, and observation emission in the rendered chart."]].map(([e,t])=>({id:e,category:"manual-at",status:"manual",message:t})),X={dataRoles:s.dataRoles.map(e=>e.role),intents:s.intents.map(a).filter(e=>!!e),accessibilityExpectations:[...s.accessibility.requirements??[],...s.accessibility.tableFields?.map(e=>"table field: "+e.label)??[]],fallbackDeclared:!0===s.accessibility.fallbackTable||"required"===s.accessibility.accessibleTable||!0===s.accessibility.requiresAccessibleTable,designContractDeclared:!!s.designContract?.whyCustom},_=[...m,...Q],Z=m.filter(e=>"fail"===e.status).length;return{recipeId:s.id,ok:0===Z,summary:{marks:o.length,passes:_.filter(e=>"pass"===e.status).length,warnings:_.filter(e=>"warn"===e.status).length,failures:Z,manual:_.filter(e=>"manual"===e.status).length},declaredSemantics:X,observedSceneEvidence:m,manualATChecks:Q}}export{o as smartTickFormat,d as adaptiveTimeTicks,$ as auditMobileVisualization,T as formatMobileVisualizationAudit,S as mobileVisualizationCaveats,R as serializeSelections,M as deserializeSelections,z as exportChart,j as auditObservedScene};
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{bandFromAge as t,defaultTooltipStyle as e,normalizeTooltip as n,opacityFromAge as r,resolveCanvasFill as o}from"./chunk-chunk-CWQ5YIHX.module.min.js";import{drawGlyphParts as a,glyphFractionClipRect as s,glyphHitGeometry as l,glyphPlacement as c}from"./chunk-chunk-KTWEBFMX.module.min.js";function i(t,e){const n={...t};return e.provenance&&(n.provenance=e.provenance),e.lifecycle&&(n.lifecycle=e.lifecycle),n}function u(){return(new Date).toISOString()}function f(t,e={}){const n=t.provenance;return{...t,provenance:{...n,...e,createdAt:e.createdAt??n?.createdAt??u()}}}function d(t){if(null==t)return null;if("number"==typeof t)return t;if(t instanceof Date)return t.getTime();const e=Date.parse(t);return Number.isFinite(e)?e:null}function p(t){const e=d(t?.now);if(null!=e)return e;const n=t?.dataExtent;if(n)if(Array.isArray(n)){const t=d(n[n.length-1]);if(null!=t)return t}else if("max"in n){const t=d(n.max);if(null!=t)return t}return Date.now()}function h(e,n,r={}){const o=e?.lifecycle?.freshness,a=d(e?.provenance?.createdAt),s=function(t){if(null==t)return null;if("number"==typeof t)return t;const e=function(t){const e=/^P(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/.exec(t);return e?1e3*(3600*(24*parseInt(e[1]||"0",10)+parseInt(e[2]||"0",10))+60*parseInt(e[3]||"0",10)+parseInt(e[4]||"0",10)):0}(t);return e>0?e:null}(e?.lifecycle?.ttlHint);return null==a||null==s?o??"fresh":t(n-a,s,r)}function y(t,e={}){const n=p(e);return t.map(t=>{const r=h(t,n,e.thresholds);return{...t,lifecycle:{...t.lifecycle,freshness:r}}})}var g={fresh:null,aging:.55,stale:.35,expired:.2},m={fresh:null,aging:null,stale:"4 4",expired:"2 4"};function x(t,e,n){return t&&n in t?t[n]:e[n]}function b(t,e={}){const n=p(e),r=!0===e.showExpiredAnnotations,o=[];for(const a of t){const t=h(a,n,e.thresholds);if("expired"===t&&!r)continue;const s=x(e.opacity,g,t),l=x(e.strokeDasharray,m,t),c=e.labelSuffix?.[t],i={...a,lifecycle:{...a.lifecycle,freshness:t}};null!=s&&null==i.opacity&&(i.opacity=s),null!=l&&null==i.strokeDasharray&&(i.strokeDasharray=l),c&&"string"==typeof i.label&&(i.label=i.label+c);const u=a.lifecycle?.anchor;u&&null==i.anchor&&(i.anchor=u),o.push(i)}return o}var v={proposed:.7,accepted:null,disputed:.7,retracted:.25},w={proposed:"3 3",accepted:null,disputed:"2 3",retracted:"2 4"},A={proposed:" (proposed)",accepted:"",disputed:" (?)",retracted:""};function I(t,e,n){return t&&n in t?t[n]:e[n]}function k(t,e={}){const n=!0===e.showRetractedAnnotations,r=!0===e.showSupersededAnnotations,o=new Set;for(const e of t){const t=e?.lifecycle?.supersedes;t&&"retracted"!==e?.lifecycle?.status&&o.add(t)}return t.filter(t=>{if("retracted"===t?.lifecycle?.status&&!n)return!1;const e=t?.provenance?.stableId;return!(e&&o.has(e)&&!r)})}function _(t,e={}){const n=[];for(const r of k(t,e)){const t=r?.lifecycle?.status;if(!t){n.push(r);continue}const o=I(e.opacity,v,t),a=I(e.strokeDasharray,w,t),s=e.labelSuffix?.[t]??A[t],l={...r};null!=o&&(l.opacity=("number"==typeof l.opacity?l.opacity:1)*o),null!=a&&null==l.strokeDasharray&&(l.strokeDasharray=a),s&&"string"==typeof l.label&&(l.label=l.label+s),n.push(l)}return n}import{jsx as M,jsxs as S}from"react/jsx-runtime";function D(t){return"string"==typeof t?t:"value"}function O(t){return null==t?"–":"number"==typeof t?Math.abs(t)>9999?t.toLocaleString():t+"":t instanceof Date?t.toLocaleDateString():t+""}function E(t,e){if(!e)return O(t);try{const n=e(t);return null==n?O(t):n}catch{return O(t)}}function R(t,e){return"function"==typeof e?e(t):t[e]}function P(t,e){if(!t)return[];const n=[];return(Array.isArray(t)?t:[t]).forEach((t,r)=>{const o="string"==typeof t?.y0Accessor?t.y0Accessor:"low",a="string"==typeof t?.y1Accessor?t.y1Accessor:"high";n.push({label:o,accessor:t=>t.bands?.[r]?.y0??(0===r?t.band?.y0:void 0),format:e}),n.push({label:a,accessor:t=>t.bands?.[r]?.y1??(0===r?t.band?.y1:void 0),format:e})}),n}function j(t){const n=t.find(t=>"title"===t.role),r=t.filter(t=>"title"!==t.role);return t=>{const o=t.data;if(!o)return null;const a=n?E(R(o,n.accessor),n.format):null;return S("div",{className:"semiotic-tooltip",style:e,children:[null!=a&&M("div",{style:{fontWeight:"bold",marginBottom:r.length>0?4:0},children:a}),r.map((t,e)=>{const n=E(R(o,t.accessor),t.format);return S("div",{style:e>0?{marginTop:2}:void 0,children:[S("span",{style:{opacity:.7},children:[t.label,": "]}),M("span",{children:n})]},e)})]})}}function C({categoryAccessor:t,valueAccessor:n,groupAccessor:r,groupLabel:o,pieData:a=!1,valueFormat:s}){return l=>{const c=a?l.data?.[0]||l.data||l:l.data||l,i=R(c,t),u=R(c,n),f=r?R(c,r):void 0;return S("div",{className:"semiotic-tooltip",style:e,children:[M("div",{style:{fontWeight:"bold"},children:O(i)}),M("div",{style:{marginTop:4},children:E(u,s)}),null!=f&&S("div",{style:{marginTop:2,opacity:.8},children:[o||D(r),": ",O(f)]})]})}}import*as T from"react";function L(...t){const e=t.filter(t=>null!=t);return 0===e.length?null:1===e.length?e[0]:T.createElement(T.Fragment,null,...e)}import{useEffect as z,useRef as H}from"react";function $(t,e,n,r){z(()=>{t.current?.updateConfig(e),n.current=!0,r()},[e,r,t,n])}function N(t,e,n,r){const o=H(null);z(()=>{const a=t.current;if(!a)return;const s=e??null;o.current!==s&&(o.current=s,a.setLayoutSelection(s),a.hasCustomRestyle?a.restyleScene(s):n.current=!0,r())},[e,r,t,n])}var W={fresh:1,aging:.7,stale:.45,expired:.25},G={alpha:1,band:"fresh",isStale:!1};function U(e,n){if(!e||0>=n)return G;const r=null!=e.threshold&&e.threshold>0?e.threshold:5e3,o=e.graded;if(o){const e="object"==typeof o?o:{},a=t(n,r,e.thresholds);return{alpha:{...W,...e.opacities??{}}[a],band:a,isStale:"fresh"!==a}}return n>r?{alpha:e.dimOpacity??.5,band:"stale",isStale:!0}:G}import{useEffect as B,useRef as F}from"react";function V(t,e,n,r,o,a){const s=F("fresh");B(()=>{if(!t)return;const l=setInterval(()=>{const l=e.current;if(!l||0===l.lastIngestTime)return;const c="undefined"!=typeof performance?performance.now():Date.now(),i=U(t,c-l.lastIngestTime);i.band===s.current&&i.isStale===o||(s.current=i.band,i.isStale!==o&&a(i.isStale),n.current=!0,r())},1e3);return()=>clearInterval(l)},[t,o,r,e,a,n])}import{jsx as Y}from"react/jsx-runtime";function X({isStale:t,position:e}){return Y("div",{className:"stream-staleness-badge",style:{position:"absolute",..."top-left"===e?{top:4,left:4}:"bottom-left"===e?{bottom:4,left:4}:"bottom-right"===e?{bottom:4,right:4}:{top:4,right:4},padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",zIndex:3,background:t?"#dc3545":"#28a745",color:"white"},children:t?"STALE":"LIVE"})}import{useRef as K}from"react";function q(t){const e=K(t);return function(t,e){if(Object.is(t,e))return!0;if(Array.isArray(t)&&Array.isArray(e))return J(t,e);if(!Z(t)||!Z(e))return!1;const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(const r of n){if(!Object.prototype.hasOwnProperty.call(e,r))return!1;const n=t[r],o=e[r];if(!Object.is(n,o))if(Array.isArray(n)&&Array.isArray(o)){if(!J(n,o))return!1}else{if(!Z(n)||!Z(o))return!1;if(!Q(n,o))return!1}}return!0}(e.current,t)||(e.current=t),e.current}function Q(t,e){const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(const r of n){if(!Object.prototype.hasOwnProperty.call(e,r))return!1;if(!Object.is(t[r],e[r]))return!1}return!0}function J(t,e){if(t.length!==e.length)return!1;for(let n=0;t.length>n;n++)if(!Object.is(t[n],e[n]))return!1;return!0}function Z(t){if(null===t||"object"!=typeof t)return!1;if(Array.isArray(t))return!1;const e=Object.getPrototypeOf(t);return e===Object.prototype||null===e}function tt(t,e,n,r,l){if(0>=e.size)return;const i=e.glyph;if(!i||!i.parts?.length)return;const u=c(i,e.size);if(0>=u.scale)return;const f=(e.style.opacity??1)*(e._decayOpacity??1);if(0>=f)return;const d=e=>{const n=o(t,e,e);return"string"==typeof n?n:e},p=e.color??("string"==typeof e.style.fill?e.style.fill:void 0);t.save(),t.translate(n,r),e.rotation&&t.rotate(e.rotation),t.translate(u.offsetX,u.offsetY),t.scale(u.scale,u.scale),t.globalAlpha=l*f*(e.style.fillOpacity??1);const h=s(i,e.fraction??1,e.fractionStart??0,e.fractionDirection??"horizontal");h&&e.ghostColor&&a(t,i,p,e.accent,e.ghostColor,d),h&&(t.beginPath(),t.rect(h.x,h.y,h.width,h.height),t.clip()),a(t,i,p,e.accent,void 0,d),t.restore()}var et=(t,e)=>{const n=t.globalAlpha;for(const r of e)"glyph"===r.type&&tt(t,r,r.x,r.y,n);t.globalAlpha=n};function nt(t,e){const n=t.globalAlpha;for(const r of e)"glyph"===r.type&&tt(t,r,r.cx,r.cy,n);t.globalAlpha=n}var rt=new Set;function ot(t,e){const n="function"==typeof t?t(e.datum??null,e):t;return(r=n)&&"object"==typeof r&&"string"==typeof r.id&&"function"==typeof r.cacheKey&&"function"==typeof r.drawCanvas&&"function"==typeof r.renderStaticSVG?n:void 0;var r}function at(t,e){if("undefined"!=typeof process&&"production"===process.env?.NODE_ENV)return;const n=`${t}:${e}`;rt.has(n)||(rt.add(n),console.warn(`[Semiotic] Render backend "${t}" does not support scene node "${e}"; using the built-in renderer.`))}function st(t){const{context:e,nodes:n,renderMode:r,pixelRatio:o,paintBuiltIn:a}=t;if(!r||"sketchy"===r)return void a(n);let s=[];const l=()=>{s.length&&(a(s),s=[])};for(const t of n){const n=ot(r,t);if(!n){s.push(t);continue}let c;l(),e.save();try{c=n.drawCanvas({context:e,node:t,style:t.style??{},pixelRatio:o})}finally{e.restore()}c||(at(n.id,t.type??"unknown"),a([t]))}l()}function lt(t){const{node:e,index:n,renderMode:r,fallback:o}=t,a=ot(r,e);if(!a)return o();const s=a.renderStaticSVG({node:e,style:e.style??{},key:`${a.id}-${n}`});return null!=s?s:(at(a.id,e.type??"unknown"),o())}function ct(t){const e=new Map;for(const n of t){const t=n.group??"_default";let r=e.get(t);r||(r=[],e.set(t,r)),r.push(n)}for(const t of e.values()){t.sort((t,e)=>t.x-e.x||t.y-e.y);for(let e=0;t.length>e;e++)t[e]._groupIndex=e}const n=Array.from(e.keys()).sort((t,n)=>{const r=e.get(t),o=e.get(n);return(r.length>0?r[0].y:0)-(o.length>0?o[0].y:0)}),r=Array.from(e.values()).flat();r.sort((t,e)=>t.x-e.x||t.y-e.y);const o=new Map;for(let t=0;r.length>t;t++){r[t]._flatIndex=t;const e=r[t].datum?.id;null!=e&&o.set(e+"",t)}return{flat:r,groups:n,byGroup:e,idToIdx:o}}function it(t,e){if(0===t.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const n=Math.max(0,Math.min(e,t.flat.length-1)),r=t.flat[n];return{flatIndex:n,group:r.group??"_default",indexInGroup:r._groupIndex??0}}function ut(t,e,n){const{group:r,indexInGroup:o}=e,a=n.byGroup.get(r);switch(t){case"ArrowRight":return a.length-1>o?a[o+1]._flatIndex:e.flatIndex;case"ArrowLeft":return o>0?a[o-1]._flatIndex:e.flatIndex;case"ArrowDown":{const t=n.groups.indexOf(r);return n.groups.length-1>t?ft(n,n.groups[t+1],a[o]):e.flatIndex}case"ArrowUp":{const t=n.groups.indexOf(r);return t>0?ft(n,n.groups[t-1],a[o]):e.flatIndex}case"PageDown":return Math.min(e.flatIndex+Math.max(1,Math.floor(.1*n.flat.length)),n.flat.length-1);case"PageUp":return Math.max(e.flatIndex-Math.max(1,Math.floor(.1*n.flat.length)),0);case"Home":return 0;case"End":return n.flat.length-1;case"Escape":return-1;default:return null}}function ft(t,e,n){const r=t.byGroup.get(e);let o=0,a=Math.abs(r[0].x-n.x);for(let t=1;r.length>t;t++){const e=Math.abs(r[t].x-n.x);a>e&&(a=e,o=t)}return r[o]._flatIndex}function dt(t){const e=[];for(const n of t)switch(n.type){case"point":e.push({x:n.x,y:n.y,datum:n.datum,shape:"circle",group:"_default"});break;case"symbol":if(0>=n.size)break;e.push({x:n.x,y:n.y,datum:n.datum,shape:"circle",group:"_default"});break;case"glyph":{if(0>=n.size||null==n.datum)break;const t=l(n.glyph,n.size);e.push({x:n.x+t.centerDx,y:n.y+t.centerDy,datum:n.datum,shape:"rect",w:2*t.halfWidth,h:2*t.halfHeight,group:"_default"});break}case"line":{const t=n,r=Array.isArray(t.datum)?t.datum:[],o=t.group??"_default";for(let n=0;t.path.length>n&&r.length>n;n++)e.push({x:t.path[n][0],y:t.path[n][1],datum:r[n],shape:"circle",group:o});break}case"area":{const t=n,r=Array.isArray(t.datum)?t.datum:[],o=t.group??"_default";for(let n=0;t.topPath.length>n&&r.length>n;n++)e.push({x:t.topPath[n][0],y:t.topPath[n][1],datum:r[n],shape:"circle",group:o});break}case"rect":e.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum,shape:"rect",w:n.w,h:n.h,group:n.group??"_default"});break;case"heatcell":e.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum,shape:"rect",w:n.w,h:n.h,group:"_default"})}return e.sort((t,e)=>t.x-e.x||t.y-e.y),e}function pt(t){const e=[];for(const n of t)if("rect"===n.type&&null!=n.x){if(null==n.datum)continue;e.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum,shape:"rect",w:n.w,h:n.h,group:n.group??n.datum?.category??""})}else if("point"===n.type)e.push({x:n.x,y:n.y,datum:n.datum,shape:"circle",group:"_default"});else if("symbol"===n.type){if(0>=n.size)continue;e.push({x:n.x,y:n.y,datum:n.datum,shape:"circle",group:"_default"})}else if("glyph"===n.type){if(0>=n.size||null==n.datum)continue;const t=l(n.glyph,n.size);e.push({x:n.x+t.centerDx,y:n.y+t.centerDy,datum:n.datum,shape:"rect",w:2*t.halfWidth,h:2*t.halfHeight,group:"_default"})}else if("wedge"===n.type&&null!=n.cx){if(null===n.datum)continue;const t=((n.startAngle||0)+(n.endAngle||0))/2,r=((n.innerRadius||0)+(n.outerRadius||50))/2;e.push({x:n.cx+Math.cos(t)*r,y:n.cy+Math.sin(t)*r,datum:n.datum,shape:"wedge",group:"_default"})}return e.sort((t,e)=>t.x-e.x||t.y-e.y),e}function ht(t){const e=[];for(const n of t)if("circle"===n.type&&null!=n.cx){if(0>=n.r)continue;e.push({x:n.cx,y:n.cy,datum:n.datum,shape:"circle",group:n.datum?.id??"_default"})}else if("rect"===n.type&&null!=n.x){if(0>=n.w||0>=n.h)continue;e.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum,shape:"rect",w:n.w,h:n.h,group:n.datum?.id??"_default"})}else if("arc"===n.type&&null!=n.cx)e.push({x:n.cx,y:n.cy,datum:n.datum,shape:"circle",group:n.datum?.id??"_default"});else if("symbol"===n.type&&null!=n.cx){if(0>=n.size)continue;e.push({x:n.cx,y:n.cy,datum:n.datum,shape:"circle",group:n.datum?.id??"_default"})}else if("glyph"===n.type&&null!=n.cx){if(0>=n.size||null==n.datum)continue;const t=l(n.glyph,n.size);e.push({x:n.cx+t.centerDx,y:n.cy+t.centerDy,datum:n.datum,shape:"rect",w:2*t.halfWidth,h:2*t.halfHeight,group:n.datum?.id??"_default"})}return e.sort((t,e)=>t.x-e.x||t.y-e.y),e}function yt(t,e,n,r,o){const a=n.flat[e.flatIndex];if(!a)return ut(t,e,n);const s=a.datum?.id;switch(t){case"ArrowRight":case"ArrowLeft":case"ArrowDown":case"ArrowUp":{const r=function(t,e,n){let r=null,o=1/0;for(let a=0;t.flat.length>a;a++){const s=t.flat[a];if(s===e)continue;const l=s.x-e.x,c=s.y-e.y;let i=!1;switch(n){case"right":i=l>0&&Math.abs(l)>=Math.abs(c);break;case"left":i=0>l&&Math.abs(l)>=Math.abs(c);break;case"down":i=c>0&&Math.abs(c)>=Math.abs(l);break;case"up":i=0>c&&Math.abs(c)>=Math.abs(l)}if(!i)continue;const u=l*l+c*c;o>u&&(o=u,r=a)}return r}(n,a,"ArrowRight"===t?"right":"ArrowLeft"===t?"left":"ArrowDown"===t?"down":"up")??e.flatIndex;return r!==e.flatIndex&&(o.current=-1),r}case"Enter":{if(null==s)return e.flatIndex;const t=function(t,e){const n=t+"",r=[];for(const t of e){const e=t.datum??t,o=gt(e.source),a=gt(e.target),s=null!=o,l=null!=a;s&&o+""===n&&l?r.push(a+""):l&&a+""===n&&s&&r.push(o+"")}return r}(s,r);if(0===t.length)return e.flatIndex;const a=n.idToIdx.get(t[(o.current+1)%t.length])??-1;return 0>a?e.flatIndex:(o.current=-1,a)}default:{const r=ut(t,e,n);return null!==r&&r!==e.flatIndex&&(o.current=-1),r}}}function gt(t){return"object"==typeof t&&null!==t&&"id"in t?t.id:t}function mt(t){const e=[];for(const n of t)if("point"===n.type&&null!=n.x)e.push({x:n.x,y:n.y,datum:n.datum,shape:"circle"});else if("glyph"===n.type){if(0>=n.size||null==n.datum)continue;const t=l(n.glyph,n.size);e.push({x:n.x+t.centerDx,y:n.y+t.centerDy,datum:n.datum,shape:"rect",w:2*t.halfWidth,h:2*t.halfHeight})}else"geoarea"===n.type&&n.centroid&&!1!==n.interactive&&e.push({x:n.centroid[0],y:n.centroid[1],datum:n.datum,shape:"geoarea",pathData:n.pathData});return e.sort((t,e)=>t.x-e.x||t.y-e.y),e}function xt(t,e,n){switch(t){case"ArrowRight":case"ArrowDown":return n-1>e?e+1:e;case"ArrowLeft":case"ArrowUp":return e>0?e-1:e;case"PageDown":return Math.min(e+Math.max(1,Math.floor(.1*n)),n-1);case"PageUp":return Math.max(e-Math.max(1,Math.floor(.1*n)),0);case"Home":return 0;case"End":return n-1;case"Escape":return-1;default:return null}}function bt(t){return{data:t.datum||{},x:t.x,y:t.y,__semioticHoverData:!0}}function vt(t){const{title:e,description:n,summary:r,accessibleTable:o,className:a,animate:s,axisExtent:l,autoPlaceAnnotations:c}=t,i={};return e&&(i.title=e),n&&(i.description=n),r&&(i.summary=r),void 0!==o&&(i.accessibleTable=o),a&&(i.className=a),null!=s&&(i.animate=s),void 0!==l&&(i.axisExtent=l),void 0!==c&&(i.autoPlaceAnnotations=c),i}function wt(t){const{linkedHover:e,selection:n,onObservation:r,onClick:o,hoverRadius:a,hoverHighlight:s,forceHoverBehavior:l,forceClickBehavior:c,mobileInteraction:i,customHoverBehavior:u,customClickBehavior:f,linkedHoverInClickPredicate:d=!0}=t,p={};r&&(p.annotationObservationCallback=r);const h=i?.enabled?Math.max(a??30,Math.ceil((i.targetSize||44)/2),24):a;return(l||e||r||o||s)&&(p.customHoverBehavior=u),f&&(c||(d?r||o||e:r||o)||i?.enabled&&(i.tapToSelect||i.tapToLockTooltip)&&(e||s||n))&&(p.customClickBehavior=f),null!=h&&(p.hoverRadius=h),p}function At(t){const{tooltip:e,defaultTooltipContent:r}=t;return{tooltipContent:!1===e?()=>null:n(e)||r}}function It(t,e,n){if(1>=n)return 1;const o=n-1;return r({age:o-e,extent:o,type:t.type,halfLife:t.halfLife??n/2,threshold:t.stepThreshold??.5*n,minOpacity:t.minOpacity??.1})}function kt(t){const e=new Map;for(let n=0;t.length>n;n++)e.set(t[n],n);return e}function _t(t,e,n,r=kt(n)){const o=n.length;if(o>1)for(const n of e){if("line"===n.type){const e=Array.isArray(n.datum)?n.datum:[];if(2>e.length)continue;const a=Array(e.length);let s=!1;for(let n=0;e.length>n;n++){const l=r.get(e[n]);null!=l?(a[n]=It(t,l,o),1>a[n]&&(s=!0)):a[n]=1}s&&(n._decayOpacities=a);continue}if("area"===n.type){const e=Array.isArray(n.datum)?n.datum:[],a=n.topPath?n.topPath.length:e.length;if(2>a)continue;if(e.length===a){const s=Array(a);let l=!1;for(let n=0;e.length>n;n++){const a=r.get(e[n]);null!=a?(s[n]=It(t,a,o),1>s[n]&&(l=!0)):s[n]=1}l&&(n._decayOpacities=s)}else{let s=1;for(const n of e){const e=r.get(n);if(null!=e){const n=It(t,e,o);s>n&&(s=n)}}if(1>s){const t=Array(a);t.fill(s),n._decayOpacities=t}}continue}const e=r.get(n.datum);if(null==e)continue;const a=It(t,e,o);"heatcell"===n.type?n.style={opacity:a}:"candlestick"===n.type?n._decayOpacity=a:n.style={...n.style,opacity:(n.style?.opacity??1)*a}}}function Mt(t){if("production"===process.env.NODE_ENV)return;const{label:e,nodes:n,overlays:r,warned:o}=t;St(r)&&0===n.length&&Dt(o,"overlay-only",`[semiotic] ${e} returned overlays but no data-bearing scene nodes. Overlays do not participate in hover, selection, transitions, SSR evidence, or accessibility tables. Emit at least one scene node with a datum, or mark the overlay-only chart as intentionally decorative.`),n.length>0&&n.every(t=>null==t.datum)&&Dt(o,"null-datums",`[semiotic] ${e} returned scene nodes, but every scene-node datum is null. Hover, callbacks, selection, and tooltip helpers need data-bearing nodes. Attach a user-facing datum to each interactive node, or set interactive overlays outside the chart.`)}function St(t){return null!=t&&!1!==t&&""!==t&&(!Array.isArray(t)||t.some(St))}function Dt(t,e,n){t.has(e)||(t.add(e),console.warn(n))}function Ot(t,e,n,r){const o=function(t){if(t instanceof Error)return{name:t.name||"Error",message:t.message||"Custom layout threw."};if("string"==typeof t)return{name:"Error",message:t};if(null==t)return{name:"Error",message:"Custom layout threw a nullish value."};try{return{name:"Error",message:t+""}}catch{return{name:"Error",message:"Custom layout threw a non-stringifiable value."}}}(e),a="network"===t?"customNetworkLayout":"customLayout";return{code:"CUSTOM_LAYOUT_ERROR",severity:"error",phase:"layout",component:t,source:a,message:`Semiotic ${t} ${a} failed: ${o.message}`,error:o,recovery:n?"preserved-last-good-scene":"empty-scene",preservedLastGoodScene:n,affectedRevision:r}}var Et=new WeakMap;function Rt(){return this.updateResults.last}function Pt(){return this.updateResults.last}function jt(t){return this.updateResults.subscribe(t)}function Ct(t){this.config.layoutSelection=t}function Tt(){Et.set(this,!0)}function Lt(){const t=!0===Et.get(this);return Et.delete(this),t}function zt(t){Object.assign(t.prototype,{getLastUpdateResult:Rt,getUpdateSnapshot:Pt,subscribeUpdateResult:jt,setLayoutSelection:Ct,markStylePaintPending:Tt,consumeStylePaintPending:Lt})}function Ht(t,e,n){return n.x>t||t>n.x+n.w||n.y>e||e>n.y+n.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:n.x+n.w/2,cy:n.y+n.h/2}}function $t(t,e=30){return Math.max((t??4)+5,12,e)}function Nt(t){return t instanceof Date?t:"number"==typeof t&&t>1e9?new Date(t):null}function Wt(t,e){const n=Nt(t);if(!n)return!1;const r=Nt(e);return!r||n.getFullYear()!==r.getFullYear()||n.getMonth()!==r.getMonth()}function Gt(t){let e=t%(2*Math.PI);return 0>e&&(e+=2*Math.PI),e}function Ut(t,e,n,r,o,a=t=>t.x,s=t=>t.y,l=t=>t.r){const c=Math.max(r,o+5,12),i=e-c,u=e+c,f=n-c,d=n+c;let p=null,h=1/0;return t.visit((t,o,c,y,g)=>{if(o>u||i>y||c>d||f>g)return!0;if(!t.length){let o=t;do{const t=o.data,c=a(t)-e,i=s(t)-n,u=Math.sqrt(c*c+i*i);$t(l(t),r)>=u&&h>u&&(p=t,h=u),o=o.next}while(o)}return!1}),p?{node:p,distance:h}:null}function Bt(t){return!(!t._pulseIntensity||0>=t._pulseIntensity)}function Ft(t,e,n=.3){Bt(e)&&(t.globalAlpha=e._pulseIntensity*n,t.fillStyle=e._pulseColor||"rgba(255,255,255,0.6)",t.fillRect(e.x,e.y,e.w,e.h))}function Vt(t,e,n=.6){if(!Bt(e))return;const r=e.r+(e._pulseGlowRadius??4)*e._pulseIntensity,o=e.cx??e.x??0,a=e.cy??e.y??0;t.beginPath(),t.arc(o,a,r,0,2*Math.PI),t.strokeStyle=e._pulseColor||"rgba(255,255,255,0.6)",t.lineWidth=2*e._pulseIntensity,t.globalAlpha=e._pulseIntensity*n,t.stroke()}function Yt(t,e,n,r=.35){Bt(e)&&(t.globalAlpha=e._pulseIntensity*r,t.fillStyle=e._pulseColor||"rgba(255,255,255,0.6)",n?t.fill(n):t.fill())}export{It as computeDecayOpacity,kt as buildDatumIndexMap,_t as applyDecay,Mt as warnCustomLayoutDiagnostics,Ot as createCustomLayoutFailureDiagnostic,zt as attachUpdateResultStore,L as composeOverlays,$ as useConfigSync,N as useLayoutSelectionSync,Ht as hitTestRect,$t as getHitRadius,Wt as isTimeLandmark,Gt as normalizeAngle,Ut as findHitPointInQuadtree,U as resolveStaleness,V as useStalenessCheck,X as StalenessBadge,i as withProvenance,u as currentTimestamp,f as withCurrentProvenance,h as annotationFreshnessFor,y as computeAnnotationFreshness,b as applyAnnotationLifecycle,k as filterAnnotationsByStatus,_ as applyAnnotationStatus,q as useStableShallow,Ft as renderRectPulse,Vt as renderCirclePulse,Yt as renderPathPulse,et as glyphCanvasRenderer,nt as networkGlyphRenderer,st as paintSceneWithBackend,lt as renderSceneWithBackend,D as accessorName,O as formatVal,P as bandTooltipFields,j as buildDefaultTooltip,C as buildOrdinalTooltip,ct as buildNavGraph,it as resolvePosition,ut as nextGraphIndex,dt as extractXYNavPoints,pt as extractOrdinalNavPoints,ht as extractNetworkNavPoints,yt as nextNetworkIndex,mt as extractGeoNavPoints,xt as nextIndex,bt as navPointToHover,vt as buildBaseMetadataProps,wt as buildCustomBehaviorProps,At as buildTooltipProps};
2
+ import{bandFromAge as t,defaultTooltipStyle as e,normalizeTooltip as n,opacityFromAge as r,resolveCanvasFill as o}from"./chunk-chunk-PX5YQGDP.module.min.js";import{drawGlyphParts as a,glyphFractionClipRect as s,glyphHitGeometry as l,glyphPlacement as c}from"./chunk-chunk-KTWEBFMX.module.min.js";function i(t,e){const n={...t};return e.provenance&&(n.provenance=e.provenance),e.lifecycle&&(n.lifecycle=e.lifecycle),n}function u(){return(new Date).toISOString()}function f(t,e={}){const n=t.provenance;return{...t,provenance:{...n,...e,createdAt:e.createdAt??n?.createdAt??u()}}}function d(t){if(null==t)return null;if("number"==typeof t)return t;if(t instanceof Date)return t.getTime();const e=Date.parse(t);return Number.isFinite(e)?e:null}function p(t){const e=d(t?.now);if(null!=e)return e;const n=t?.dataExtent;if(n)if(Array.isArray(n)){const t=d(n[n.length-1]);if(null!=t)return t}else if("max"in n){const t=d(n.max);if(null!=t)return t}return Date.now()}function h(e,n,r={}){const o=e?.lifecycle?.freshness,a=d(e?.provenance?.createdAt),s=function(t){if(null==t)return null;if("number"==typeof t)return t;const e=function(t){const e=/^P(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/.exec(t);return e?1e3*(3600*(24*parseInt(e[1]||"0",10)+parseInt(e[2]||"0",10))+60*parseInt(e[3]||"0",10)+parseInt(e[4]||"0",10)):0}(t);return e>0?e:null}(e?.lifecycle?.ttlHint);return null==a||null==s?o??"fresh":t(n-a,s,r)}function y(t,e={}){const n=p(e);return t.map(t=>{const r=h(t,n,e.thresholds);return{...t,lifecycle:{...t.lifecycle,freshness:r}}})}var g={fresh:null,aging:.55,stale:.35,expired:.2},m={fresh:null,aging:null,stale:"4 4",expired:"2 4"};function x(t,e,n){return t&&n in t?t[n]:e[n]}function b(t,e={}){const n=p(e),r=!0===e.showExpiredAnnotations,o=[];for(const a of t){const t=h(a,n,e.thresholds);if("expired"===t&&!r)continue;const s=x(e.opacity,g,t),l=x(e.strokeDasharray,m,t),c=e.labelSuffix?.[t],i={...a,lifecycle:{...a.lifecycle,freshness:t}};null!=s&&null==i.opacity&&(i.opacity=s),null!=l&&null==i.strokeDasharray&&(i.strokeDasharray=l),c&&"string"==typeof i.label&&(i.label=i.label+c);const u=a.lifecycle?.anchor;u&&null==i.anchor&&(i.anchor=u),o.push(i)}return o}var v={proposed:.7,accepted:null,disputed:.7,retracted:.25},w={proposed:"3 3",accepted:null,disputed:"2 3",retracted:"2 4"},A={proposed:" (proposed)",accepted:"",disputed:" (?)",retracted:""};function k(t,e,n){return t&&n in t?t[n]:e[n]}function I(t,e={}){const n=!0===e.showRetractedAnnotations,r=!0===e.showSupersededAnnotations,o=new Set;for(const e of t){const t=e?.lifecycle?.supersedes;t&&"retracted"!==e?.lifecycle?.status&&o.add(t)}return t.filter(t=>{if("retracted"===t?.lifecycle?.status&&!n)return!1;const e=t?.provenance?.stableId;return!(e&&o.has(e)&&!r)})}function _(t,e={}){const n=[];for(const r of I(t,e)){const t=r?.lifecycle?.status;if(!t){n.push(r);continue}const o=k(e.opacity,v,t),a=k(e.strokeDasharray,w,t),s=e.labelSuffix?.[t]??A[t],l={...r};null!=o&&(l.opacity=("number"==typeof l.opacity?l.opacity:1)*o),null!=a&&null==l.strokeDasharray&&(l.strokeDasharray=a),s&&"string"==typeof l.label&&(l.label=l.label+s),n.push(l)}return n}import{jsx as M,jsxs as S}from"react/jsx-runtime";function D(t){return"string"==typeof t?t:"value"}function O(t){return null==t?"–":"number"==typeof t?Math.abs(t)>9999?t.toLocaleString():t+"":t instanceof Date?t.toLocaleDateString():t+""}function E(t,e){if(!e)return O(t);try{const n=e(t);return null==n?O(t):n}catch{return O(t)}}function R(t,e){return"function"==typeof e?e(t):t[e]}function P(t,e){if(!t)return[];const n=[];return(Array.isArray(t)?t:[t]).forEach((t,r)=>{const o="string"==typeof t?.y0Accessor?t.y0Accessor:"low",a="string"==typeof t?.y1Accessor?t.y1Accessor:"high";n.push({label:o,accessor:t=>t.bands?.[r]?.y0??(0===r?t.band?.y0:void 0),format:e}),n.push({label:a,accessor:t=>t.bands?.[r]?.y1??(0===r?t.band?.y1:void 0),format:e})}),n}function j(t){const n=t.find(t=>"title"===t.role),r=t.filter(t=>"title"!==t.role);return t=>{const o=t.data;if(!o)return null;const a=n?E(R(o,n.accessor),n.format):null;return S("div",{className:"semiotic-tooltip",style:e,children:[null!=a&&M("div",{style:{fontWeight:"bold",marginBottom:r.length>0?4:0},children:a}),r.map((t,e)=>{const n=E(R(o,t.accessor),t.format);return S("div",{style:e>0?{marginTop:2}:void 0,children:[S("span",{style:{opacity:.7},children:[t.label,": "]}),M("span",{children:n})]},e)})]})}}function C({categoryAccessor:t,valueAccessor:n,groupAccessor:r,groupLabel:o,pieData:a=!1,valueFormat:s}){return l=>{const c=a?l.data?.[0]||l.data||l:l.data||l,i=R(c,t),u=R(c,n),f=r?R(c,r):void 0;return S("div",{className:"semiotic-tooltip",style:e,children:[M("div",{style:{fontWeight:"bold"},children:O(i)}),M("div",{style:{marginTop:4},children:E(u,s)}),null!=f&&S("div",{style:{marginTop:2,opacity:.8},children:[o||D(r),": ",O(f)]})]})}}import*as T from"react";function L(...t){const e=t.filter(t=>null!=t);return 0===e.length?null:1===e.length?e[0]:T.createElement(T.Fragment,null,...e)}import{useEffect as z,useRef as H}from"react";function $(t,e,n,r){z(()=>{t.current?.updateConfig(e),n.current=!0,r()},[e,r,t,n])}function G(t,e,n,r){const o=H(null);z(()=>{const a=t.current;if(!a)return;const s=e??null;o.current!==s&&(o.current=s,a.setLayoutSelection(s),a.hasCustomRestyle?a.restyleScene(s):n.current=!0,r())},[e,r,t,n])}var N={fresh:1,aging:.7,stale:.45,expired:.25},U={alpha:1,band:"fresh",isStale:!1};function W(e,n){if(!e||0>=n)return U;const r=null!=e.threshold&&e.threshold>0?e.threshold:5e3,o=e.graded;if(o){const e="object"==typeof o?o:{},a=t(n,r,e.thresholds);return{alpha:{...N,...e.opacities??{}}[a],band:a,isStale:"fresh"!==a}}return n>r?{alpha:e.dimOpacity??.5,band:"stale",isStale:!0}:U}import{useEffect as B,useRef as F}from"react";function V(t,e,n,r,o,a){const s=F("fresh");B(()=>{if(!t)return;const l=setInterval(()=>{const l=e.current;if(!l||0===l.lastIngestTime)return;const c="undefined"!=typeof performance?performance.now():Date.now(),i=W(t,c-l.lastIngestTime);i.band===s.current&&i.isStale===o||(s.current=i.band,i.isStale!==o&&a(i.isStale),n.current=!0,r())},1e3);return()=>clearInterval(l)},[t,o,r,e,a,n])}import{jsx as Y}from"react/jsx-runtime";function X({isStale:t,position:e}){return Y("div",{className:"stream-staleness-badge",style:{position:"absolute",..."top-left"===e?{top:4,left:4}:"bottom-left"===e?{bottom:4,left:4}:"bottom-right"===e?{bottom:4,right:4}:{top:4,right:4},padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",zIndex:3,background:t?"#dc3545":"#28a745",color:"white"},children:t?"STALE":"LIVE"})}import{useRef as K}from"react";function q(t){const e=K(t);return function(t,e){if(Object.is(t,e))return!0;if(Array.isArray(t)&&Array.isArray(e))return J(t,e);if(!Z(t)||!Z(e))return!1;const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(const r of n){if(!Object.prototype.hasOwnProperty.call(e,r))return!1;const n=t[r],o=e[r];if(!Object.is(n,o))if(Array.isArray(n)&&Array.isArray(o)){if(!J(n,o))return!1}else{if(!Z(n)||!Z(o))return!1;if(!Q(n,o))return!1}}return!0}(e.current,t)||(e.current=t),e.current}function Q(t,e){const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(const r of n){if(!Object.prototype.hasOwnProperty.call(e,r))return!1;if(!Object.is(t[r],e[r]))return!1}return!0}function J(t,e){if(t.length!==e.length)return!1;for(let n=0;t.length>n;n++)if(!Object.is(t[n],e[n]))return!1;return!0}function Z(t){if(null===t||"object"!=typeof t)return!1;if(Array.isArray(t))return!1;const e=Object.getPrototypeOf(t);return e===Object.prototype||null===e}function tt(t,e,n,r,l){if(0>=e.size)return;const i=e.glyph;if(!i||!i.parts?.length)return;const u=c(i,e.size);if(0>=u.scale)return;const f=(e.style.opacity??1)*(e._decayOpacity??1);if(0>=f)return;const d=e=>{const n=o(t,e,e);return"string"==typeof n?n:e},p=e.color??("string"==typeof e.style.fill?e.style.fill:void 0);t.save(),t.translate(n,r),e.rotation&&t.rotate(e.rotation),t.translate(u.offsetX,u.offsetY),t.scale(u.scale,u.scale),t.globalAlpha=l*f*(e.style.fillOpacity??1);const h=s(i,e.fraction??1,e.fractionStart??0,e.fractionDirection??"horizontal");h&&e.ghostColor&&a(t,i,p,e.accent,e.ghostColor,d),h&&(t.beginPath(),t.rect(h.x,h.y,h.width,h.height),t.clip()),a(t,i,p,e.accent,void 0,d),t.restore()}var et=(t,e)=>{const n=t.globalAlpha;for(const r of e)"glyph"===r.type&&tt(t,r,r.x,r.y,n);t.globalAlpha=n};function nt(t,e){const n=t.globalAlpha;for(const r of e)"glyph"===r.type&&tt(t,r,r.cx,r.cy,n);t.globalAlpha=n}var rt=new Set;function ot(t,e){const n="function"==typeof t?t(e.datum??null,e):t;return(r=n)&&"object"==typeof r&&"string"==typeof r.id&&"function"==typeof r.cacheKey&&"function"==typeof r.drawCanvas&&"function"==typeof r.renderStaticSVG?n:void 0;var r}function at(t,e){if("undefined"!=typeof process&&"production"===process.env?.NODE_ENV)return;const n=`${t}:${e}`;rt.has(n)||(rt.add(n),console.warn(`[Semiotic] Render backend "${t}" does not support scene node "${e}"; using the built-in renderer.`))}function st(t){const{context:e,nodes:n,renderMode:r,pixelRatio:o,paintBuiltIn:a}=t;if(!r||"sketchy"===r)return void a(n);let s=[];const l=()=>{s.length&&(a(s),s=[])};for(const t of n){const n=ot(r,t);if(!n){s.push(t);continue}let c;l(),e.save();try{c=n.drawCanvas({context:e,node:t,style:t.style??{},pixelRatio:o})}finally{e.restore()}c||(at(n.id,t.type??"unknown"),a([t]))}l()}function lt(t){const{node:e,index:n,renderMode:r,fallback:o}=t,a=ot(r,e);if(!a)return o();const s=a.renderStaticSVG({node:e,style:e.style??{},key:`${a.id}-${n}`});return null!=s?s:(at(a.id,e.type??"unknown"),o())}function ct(t){const e=new Map;for(const n of t){const t=n.group??"_default";let r=e.get(t);r||(r=[],e.set(t,r)),r.push(n)}for(const t of e.values()){t.sort((t,e)=>t.x-e.x||t.y-e.y);for(let e=0;t.length>e;e++)t[e]._groupIndex=e}const n=Array.from(e.keys()).sort((t,n)=>{const r=e.get(t),o=e.get(n);return(r.length>0?r[0].y:0)-(o.length>0?o[0].y:0)}),r=Array.from(e.values()).flat();r.sort((t,e)=>t.x-e.x||t.y-e.y);const o=new Map;for(let t=0;r.length>t;t++){r[t]._flatIndex=t;const e=r[t].datum?.id;null!=e&&o.set(e+"",t)}return{flat:r,groups:n,byGroup:e,idToIdx:o}}function it(t,e){if(0===t.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const n=Math.max(0,Math.min(e,t.flat.length-1)),r=t.flat[n];return{flatIndex:n,group:r.group??"_default",indexInGroup:r._groupIndex??0}}function ut(t,e,n){const{group:r,indexInGroup:o}=e,a=n.byGroup.get(r);switch(t){case"ArrowRight":return a.length-1>o?a[o+1]._flatIndex:e.flatIndex;case"ArrowLeft":return o>0?a[o-1]._flatIndex:e.flatIndex;case"ArrowDown":{const t=n.groups.indexOf(r);return n.groups.length-1>t?ft(n,n.groups[t+1],a[o]):e.flatIndex}case"ArrowUp":{const t=n.groups.indexOf(r);return t>0?ft(n,n.groups[t-1],a[o]):e.flatIndex}case"PageDown":return Math.min(e.flatIndex+Math.max(1,Math.floor(.1*n.flat.length)),n.flat.length-1);case"PageUp":return Math.max(e.flatIndex-Math.max(1,Math.floor(.1*n.flat.length)),0);case"Home":return 0;case"End":return n.flat.length-1;case"Escape":return-1;default:return null}}function ft(t,e,n){const r=t.byGroup.get(e);let o=0,a=Math.abs(r[0].x-n.x);for(let t=1;r.length>t;t++){const e=Math.abs(r[t].x-n.x);a>e&&(a=e,o=t)}return r[o]._flatIndex}function dt(t){const e=[];for(const n of t)switch(n.type){case"point":e.push({x:n.x,y:n.y,datum:n.datum,shape:"circle",group:"_default"});break;case"symbol":if(0>=n.size)break;e.push({x:n.x,y:n.y,datum:n.datum,shape:"circle",group:"_default"});break;case"glyph":{if(0>=n.size||null==n.datum)break;const t=l(n.glyph,n.size);e.push({x:n.x+t.centerDx,y:n.y+t.centerDy,datum:n.datum,shape:"rect",w:2*t.halfWidth,h:2*t.halfHeight,group:"_default"});break}case"line":{const t=n,r=Array.isArray(t.datum)?t.datum:[],o=t.group??"_default";for(let n=0;t.path.length>n&&r.length>n;n++)e.push({x:t.path[n][0],y:t.path[n][1],datum:r[n],shape:"circle",group:o});break}case"area":{const t=n,r=Array.isArray(t.datum)?t.datum:[],o=t.group??"_default";for(let n=0;t.topPath.length>n&&r.length>n;n++)e.push({x:t.topPath[n][0],y:t.topPath[n][1],datum:r[n],shape:"circle",group:o});break}case"rect":e.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum,shape:"rect",w:n.w,h:n.h,group:n.group??"_default"});break;case"heatcell":e.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum,shape:"rect",w:n.w,h:n.h,group:"_default"})}return e.sort((t,e)=>t.x-e.x||t.y-e.y),e}function pt(t){const e=[];for(const n of t)if("rect"===n.type&&null!=n.x){if(null==n.datum)continue;e.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum,shape:"rect",w:n.w,h:n.h,group:n.group??n.datum?.category??""})}else if("point"===n.type)e.push({x:n.x,y:n.y,datum:n.datum,shape:"circle",group:"_default"});else if("symbol"===n.type){if(0>=n.size)continue;e.push({x:n.x,y:n.y,datum:n.datum,shape:"circle",group:"_default"})}else if("glyph"===n.type){if(0>=n.size||null==n.datum)continue;const t=l(n.glyph,n.size);e.push({x:n.x+t.centerDx,y:n.y+t.centerDy,datum:n.datum,shape:"rect",w:2*t.halfWidth,h:2*t.halfHeight,group:"_default"})}else if("wedge"===n.type&&null!=n.cx){if(null===n.datum)continue;const t=((n.startAngle||0)+(n.endAngle||0))/2,r=((n.innerRadius||0)+(n.outerRadius||50))/2;e.push({x:n.cx+Math.cos(t)*r,y:n.cy+Math.sin(t)*r,datum:n.datum,shape:"wedge",group:"_default"})}return e.sort((t,e)=>t.x-e.x||t.y-e.y),e}function ht(t){const e=[];for(const n of t)if("circle"===n.type&&null!=n.cx){if(0>=n.r)continue;e.push({x:n.cx,y:n.cy,datum:n.datum,shape:"circle",group:n.datum?.id??"_default"})}else if("rect"===n.type&&null!=n.x){if(0>=n.w||0>=n.h)continue;e.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum,shape:"rect",w:n.w,h:n.h,group:n.datum?.id??"_default"})}else if("arc"===n.type&&null!=n.cx)e.push({x:n.cx,y:n.cy,datum:n.datum,shape:"circle",group:n.datum?.id??"_default"});else if("symbol"===n.type&&null!=n.cx){if(0>=n.size)continue;e.push({x:n.cx,y:n.cy,datum:n.datum,shape:"circle",group:n.datum?.id??"_default"})}else if("glyph"===n.type&&null!=n.cx){if(0>=n.size||null==n.datum)continue;const t=l(n.glyph,n.size);e.push({x:n.cx+t.centerDx,y:n.cy+t.centerDy,datum:n.datum,shape:"rect",w:2*t.halfWidth,h:2*t.halfHeight,group:n.datum?.id??"_default"})}return e.sort((t,e)=>t.x-e.x||t.y-e.y),e}function yt(t,e,n,r,o){const a=n.flat[e.flatIndex];if(!a)return ut(t,e,n);const s=a.datum?.id;switch(t){case"ArrowRight":case"ArrowLeft":case"ArrowDown":case"ArrowUp":{const r=function(t,e,n){let r=null,o=1/0;for(let a=0;t.flat.length>a;a++){const s=t.flat[a];if(s===e)continue;const l=s.x-e.x,c=s.y-e.y;let i=!1;switch(n){case"right":i=l>0&&Math.abs(l)>=Math.abs(c);break;case"left":i=0>l&&Math.abs(l)>=Math.abs(c);break;case"down":i=c>0&&Math.abs(c)>=Math.abs(l);break;case"up":i=0>c&&Math.abs(c)>=Math.abs(l)}if(!i)continue;const u=l*l+c*c;o>u&&(o=u,r=a)}return r}(n,a,"ArrowRight"===t?"right":"ArrowLeft"===t?"left":"ArrowDown"===t?"down":"up")??e.flatIndex;return r!==e.flatIndex&&(o.current=-1),r}case"Enter":{if(null==s)return e.flatIndex;const t=function(t,e){const n=t+"",r=[];for(const t of e){const e=t.datum??t,o=gt(e.source),a=gt(e.target),s=null!=o,l=null!=a;s&&o+""===n&&l?r.push(a+""):l&&a+""===n&&s&&r.push(o+"")}return r}(s,r);if(0===t.length)return e.flatIndex;const a=n.idToIdx.get(t[(o.current+1)%t.length])??-1;return 0>a?e.flatIndex:(o.current=-1,a)}default:{const r=ut(t,e,n);return null!==r&&r!==e.flatIndex&&(o.current=-1),r}}}function gt(t){return"object"==typeof t&&null!==t&&"id"in t?t.id:t}function mt(t){const e=[];for(const n of t)if("point"===n.type&&null!=n.x)e.push({x:n.x,y:n.y,datum:n.datum,shape:"circle"});else if("glyph"===n.type){if(0>=n.size||null==n.datum)continue;const t=l(n.glyph,n.size);e.push({x:n.x+t.centerDx,y:n.y+t.centerDy,datum:n.datum,shape:"rect",w:2*t.halfWidth,h:2*t.halfHeight})}else"geoarea"===n.type&&n.centroid&&!1!==n.interactive&&e.push({x:n.centroid[0],y:n.centroid[1],datum:n.datum,shape:"geoarea",pathData:n.pathData});return e.sort((t,e)=>t.x-e.x||t.y-e.y),e}function xt(t,e,n){switch(t){case"ArrowRight":case"ArrowDown":return n-1>e?e+1:e;case"ArrowLeft":case"ArrowUp":return e>0?e-1:e;case"PageDown":return Math.min(e+Math.max(1,Math.floor(.1*n)),n-1);case"PageUp":return Math.max(e-Math.max(1,Math.floor(.1*n)),0);case"Home":return 0;case"End":return n-1;case"Escape":return-1;default:return null}}function bt(t){return{data:t.datum||{},x:t.x,y:t.y,__semioticHoverData:!0}}function vt(t){const{title:e,description:n,summary:r,accessibleTable:o,className:a,animate:s,axisExtent:l,autoPlaceAnnotations:c}=t,i={};return e&&(i.title=e),n&&(i.description=n),r&&(i.summary=r),void 0!==o&&(i.accessibleTable=o),a&&(i.className=a),null!=s&&(i.animate=s),void 0!==l&&(i.axisExtent=l),void 0!==c&&(i.autoPlaceAnnotations=c),i}function wt(t){const{linkedHover:e,selection:n,onObservation:r,onClick:o,hoverRadius:a,hoverHighlight:s,forceHoverBehavior:l,forceClickBehavior:c,mobileInteraction:i,customHoverBehavior:u,customClickBehavior:f,linkedHoverInClickPredicate:d=!0}=t,p={};r&&(p.annotationObservationCallback=r);const h=i?.enabled?Math.max(a??30,Math.ceil((i.targetSize||44)/2),24):a;return(l||e||r||o||s)&&(p.customHoverBehavior=u),f&&(c||(d?r||o||e:r||o)||i?.enabled&&(i.tapToSelect||i.tapToLockTooltip)&&(e||s||n))&&(p.customClickBehavior=f),null!=h&&(p.hoverRadius=h),p}function At(t){const{tooltip:e,defaultTooltipContent:r}=t;return{tooltipContent:!1===e?()=>null:n(e)||r}}function kt(t,e,n){if(1>=n)return 1;const o=n-1;return r({age:o-e,extent:o,type:t.type,halfLife:t.halfLife??n/2,threshold:t.stepThreshold??.5*n,minOpacity:t.minOpacity??.1})}function It(t){const e=new Map;for(let n=0;t.length>n;n++)e.set(t[n],n);return e}function _t(t,e,n,r=It(n)){const o=n.length;if(o>1)for(const n of e){if("line"===n.type){const e=Array.isArray(n.datum)?n.datum:[];if(2>e.length)continue;const a=Array(e.length);let s=!1;for(let n=0;e.length>n;n++){const l=r.get(e[n]);null!=l?(a[n]=kt(t,l,o),1>a[n]&&(s=!0)):a[n]=1}s&&(n._decayOpacities=a);continue}if("area"===n.type){const e=Array.isArray(n.datum)?n.datum:[],a=n.topPath?n.topPath.length:e.length;if(2>a)continue;if(e.length===a){const s=Array(a);let l=!1;for(let n=0;e.length>n;n++){const a=r.get(e[n]);null!=a?(s[n]=kt(t,a,o),1>s[n]&&(l=!0)):s[n]=1}l&&(n._decayOpacities=s)}else{let s=1;for(const n of e){const e=r.get(n);if(null!=e){const n=kt(t,e,o);s>n&&(s=n)}}if(1>s){const t=Array(a);t.fill(s),n._decayOpacities=t}}continue}const e=r.get(n.datum);if(null==e)continue;const a=kt(t,e,o);"heatcell"===n.type?n.style={opacity:a}:"candlestick"===n.type?n._decayOpacity=a:n.style={...n.style,opacity:(n.style?.opacity??1)*a}}}function Mt(t){if("production"===process.env.NODE_ENV)return;const{label:e,nodes:n,overlays:r,warned:o}=t;St(r)&&0===n.length&&Dt(o,"overlay-only",`[semiotic] ${e} returned overlays but no data-bearing scene nodes. Overlays do not participate in hover, selection, transitions, SSR evidence, or accessibility tables. Emit at least one scene node with a datum, or mark the overlay-only chart as intentionally decorative.`),n.length>0&&n.every(t=>null==t.datum)&&Dt(o,"null-datums",`[semiotic] ${e} returned scene nodes, but every scene-node datum is null. Hover, callbacks, selection, and tooltip helpers need data-bearing nodes. Attach a user-facing datum to each interactive node, or set interactive overlays outside the chart.`)}function St(t){return null!=t&&!1!==t&&""!==t&&(!Array.isArray(t)||t.some(St))}function Dt(t,e,n){t.has(e)||(t.add(e),console.warn(n))}function Ot(t,e,n,r){const o=function(t){if(t instanceof Error)return{name:t.name||"Error",message:t.message||"Custom layout threw."};if("string"==typeof t)return{name:"Error",message:t};if(null==t)return{name:"Error",message:"Custom layout threw a nullish value."};try{return{name:"Error",message:t+""}}catch{return{name:"Error",message:"Custom layout threw a non-stringifiable value."}}}(e),a="network"===t?"customNetworkLayout":"customLayout";return{code:"CUSTOM_LAYOUT_ERROR",severity:"error",phase:"layout",component:t,source:a,message:`Semiotic ${t} ${a} failed: ${o.message}`,error:o,recovery:n?"preserved-last-good-scene":"empty-scene",preservedLastGoodScene:n,affectedRevision:r}}var Et=new WeakMap;function Rt(){return this.updateResults.last}function Pt(){return this.updateResults.last}function jt(t){return this.updateResults.subscribe(t)}function Ct(t){this.config.layoutSelection=t}function Tt(){Et.set(this,!0)}function Lt(){const t=!0===Et.get(this);return Et.delete(this),t}function zt(t){Object.assign(t.prototype,{getLastUpdateResult:Rt,getUpdateSnapshot:Pt,subscribeUpdateResult:jt,setLayoutSelection:Ct,markStylePaintPending:Tt,consumeStylePaintPending:Lt})}function Ht(t,e,n){return n.x>t||t>n.x+n.w||n.y>e||e>n.y+n.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:n.x+n.w/2,cy:n.y+n.h/2}}function $t(t,e=30){return Math.max((t??4)+5,12,e)}function Gt(t){return t instanceof Date?t:"number"==typeof t&&t>1e9?new Date(t):null}function Nt(t,e){const n=Gt(t);if(!n)return!1;const r=Gt(e);return!r||n.getFullYear()!==r.getFullYear()||n.getMonth()!==r.getMonth()}function Ut(t){let e=t%(2*Math.PI);return 0>e&&(e+=2*Math.PI),e}function Wt(t,e,n,r,o,a=t=>t.x,s=t=>t.y,l=t=>t.r){const c=Math.max(r,o+5,12),i=e-c,u=e+c,f=n-c,d=n+c;let p=null,h=1/0;return t.visit((t,o,c,y,g)=>{if(o>u||i>y||c>d||f>g)return!0;if(!t.length){let o=t;do{const t=o.data,c=a(t)-e,i=s(t)-n,u=Math.sqrt(c*c+i*i);$t(l(t),r)>=u&&h>u&&(p=t,h=u),o=o.next}while(o)}return!1}),p?{node:p,distance:h}:null}function Bt(t){return!(!t._pulseIntensity||0>=t._pulseIntensity)}function Ft(t,e,n=.3){Bt(e)&&(t.globalAlpha=e._pulseIntensity*n,t.fillStyle=e._pulseColor||"rgba(255,255,255,0.6)",t.fillRect(e.x,e.y,e.w,e.h))}function Vt(t,e,n=.6){if(!Bt(e))return;const r=e.r+(e._pulseGlowRadius??4)*e._pulseIntensity,o=e.cx??e.x??0,a=e.cy??e.y??0;t.beginPath(),t.arc(o,a,r,0,2*Math.PI),t.strokeStyle=e._pulseColor||"rgba(255,255,255,0.6)",t.lineWidth=2*e._pulseIntensity,t.globalAlpha=e._pulseIntensity*n,t.stroke()}function Yt(t,e,n,r=.35){Bt(e)&&(t.globalAlpha=e._pulseIntensity*r,t.fillStyle=e._pulseColor||"rgba(255,255,255,0.6)",n?t.fill(n):t.fill())}export{kt as computeDecayOpacity,It as buildDatumIndexMap,_t as applyDecay,Mt as warnCustomLayoutDiagnostics,Ot as createCustomLayoutFailureDiagnostic,zt as attachUpdateResultStore,L as composeOverlays,$ as useConfigSync,G as useLayoutSelectionSync,Ht as hitTestRect,$t as getHitRadius,Nt as isTimeLandmark,Ut as normalizeAngle,Wt as findHitPointInQuadtree,W as resolveStaleness,V as useStalenessCheck,X as StalenessBadge,i as withProvenance,u as currentTimestamp,f as withCurrentProvenance,h as annotationFreshnessFor,y as computeAnnotationFreshness,b as applyAnnotationLifecycle,I as filterAnnotationsByStatus,_ as applyAnnotationStatus,q as useStableShallow,Ft as renderRectPulse,Vt as renderCirclePulse,Yt as renderPathPulse,et as glyphCanvasRenderer,nt as networkGlyphRenderer,st as paintSceneWithBackend,lt as renderSceneWithBackend,D as accessorName,O as formatVal,P as bandTooltipFields,j as buildDefaultTooltip,C as buildOrdinalTooltip,ct as buildNavGraph,it as resolvePosition,ut as nextGraphIndex,dt as extractXYNavPoints,pt as extractOrdinalNavPoints,ht as extractNetworkNavPoints,yt as nextNetworkIndex,mt as extractGeoNavPoints,xt as nextIndex,bt as navPointToHover,vt as buildBaseMetadataProps,wt as buildCustomBehaviorProps,At as buildTooltipProps};
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{forceLayout as n}from"./chunk-chunk-TUBMTZMU.module.min.js";import{canUseForceWorker as t,runForceLayoutWorker as e,shouldUseForceWorker as o}from"./chunk-chunk-4AANPFOX.module.min.js";import{useWasHydratingFromSSR as r}from"./chunk-chunk-ACLDBMRH.module.min.js";import{useEffect as i,useMemo as s,useRef as u,useState as a}from"react";var d=new WeakMap;function l(n){const t=[];for(const e of Object.keys(n).sort()){const o=n[e];if(void 0!==o){if("function"==typeof o)return null;t.push(`${e}:${o+""}`)}}return t.join("|")}function c(n,t,e){return null==e?null:d.get(n)?.get(t)?.get(e)??null}function p(n,t,e,o){if(null==e)return;let r=d.get(n);r||(r=new WeakMap,d.set(n,r));let i=r.get(t);if(i||(i=new Map,r.set(t,i)),!i.has(e)&&i.size>=16){const n=i.keys().next().value;void 0!==n&&i.delete(n)}i.set(e,o)}function f(d,f,m={}){const h=r(),{seed:g,iterations:k,repulsion:y,linkDistance:w,linkStrength:b,centerStrength:j,damping:v,nodeRadius:R,nodePadding:A,inset:M,execution:x,workerThreshold:T}=m,E=s(()=>({seed:g,iterations:k,repulsion:y,linkDistance:w,linkStrength:b,centerStrength:j,damping:v,nodeRadius:R,nodePadding:A,inset:M,execution:x,workerThreshold:T}),[g,k,y,w,b,j,v,R,A,M,x,T]),O=u(h),[S,D]=a(()=>{if("undefined"==typeof window||h){const t=n(d,f,E);return p(d,f,l(E),t),{positions:t,status:"ready",error:null}}const t=c(d,f,l(E));return t?{positions:t,status:"ready",error:null}:{positions:null,status:"pending",error:null}});return i(()=>{if(O.current)return void(O.current=!1);const r=l(E),i=c(d,f,r);if(i)return void D(n=>"ready"===n.status&&n.positions===i?n:{positions:i,status:"ready",error:null});const s=new AbortController;return D(n=>({positions:n.positions,status:"pending",error:null})),async function(r,i,s={}){const{execution:u="auto",signal:a,workerThreshold:d,nodeRadius:l,...c}=s,p=c.iterations??260;if(!t()||!o(u,r.length,i.length,p,d))return n(r,i,{...c,nodeRadius:l});const f={kind:"normalized",nodes:r.map(n=>({...n})),edges:i.map(n=>({...n})),options:c,nodeRadii:"function"==typeof l?Object.fromEntries(r.map(n=>[n.id,l(n)])):null==l?void 0:Object.fromEntries(r.map(n=>[n.id,l]))};try{return(await e(f,a)).positions}catch(t){if("AbortError"===t?.name)throw t;return n(r,i,{...c,nodeRadius:l})}}(d,f,{...E,signal:s.signal}).then(n=>{p(d,f,r,n),D({positions:n,status:"ready",error:null})}).catch(n=>{"AbortError"!==n.name&&D(t=>({positions:t.positions,status:"error",error:n}))}),()=>s.abort()},[d,f,E]),S}export{f as useForceLayout};
2
+ import{forceLayout as n}from"./chunk-chunk-T2FKJD4O.module.min.js";import{canUseForceWorker as t,runForceLayoutWorker as e,shouldUseForceWorker as o}from"./chunk-chunk-ARZGA4LJ.module.min.js";import{useWasHydratingFromSSR as r}from"./chunk-chunk-ACLDBMRH.module.min.js";import{useEffect as i,useMemo as s,useRef as u,useState as a}from"react";var d=new WeakMap;function l(n){const t=[];for(const e of Object.keys(n).sort()){const o=n[e];if(void 0!==o){if("function"==typeof o)return null;t.push(`${e}:${o+""}`)}}return t.join("|")}function c(n,t,e){return null==e?null:d.get(n)?.get(t)?.get(e)??null}function p(n,t,e,o){if(null==e)return;let r=d.get(n);r||(r=new WeakMap,d.set(n,r));let i=r.get(t);if(i||(i=new Map,r.set(t,i)),!i.has(e)&&i.size>=16){const n=i.keys().next().value;void 0!==n&&i.delete(n)}i.set(e,o)}function f(d,f,m={}){const h=r(),{seed:g,iterations:k,repulsion:y,linkDistance:w,linkStrength:R,centerStrength:b,damping:j,nodeRadius:v,nodePadding:A,inset:x,execution:D,workerThreshold:E}=m,M=s(()=>({seed:g,iterations:k,repulsion:y,linkDistance:w,linkStrength:R,centerStrength:b,damping:j,nodeRadius:v,nodePadding:A,inset:x,execution:D,workerThreshold:E}),[g,k,y,w,R,b,j,v,A,x,D,E]),O=u(h),[S,T]=a(()=>{if("undefined"==typeof window||h){const t=n(d,f,M);return p(d,f,l(M),t),{positions:t,status:"ready",error:null}}const t=c(d,f,l(M));return t?{positions:t,status:"ready",error:null}:{positions:null,status:"pending",error:null}});return i(()=>{if(O.current)return void(O.current=!1);const r=l(M),i=c(d,f,r);if(i)return void T(n=>"ready"===n.status&&n.positions===i?n:{positions:i,status:"ready",error:null});const s=new AbortController;return T(n=>({positions:n.positions,status:"pending",error:null})),async function(r,i,s={}){const{execution:u="auto",signal:a,workerThreshold:d,nodeRadius:l,...c}=s,p=c.iterations??260;if(!t()||!o(u,r.length,i.length,p,d))return n(r,i,{...c,nodeRadius:l});const f={kind:"normalized",nodes:r.map(n=>({...n})),edges:i.map(n=>({...n})),options:c,nodeRadii:"function"==typeof l?Object.fromEntries(r.map(n=>[n.id,l(n)])):null==l?void 0:Object.fromEntries(r.map(n=>[n.id,l]))};try{return(await e(f,a)).positions}catch(t){if("AbortError"===t?.name)throw t;return n(r,i,{...c,nodeRadius:l})}}(d,f,{...M,signal:s.signal}).then(n=>{p(d,f,r,n),T({positions:n,status:"ready",error:null})}).catch(n=>{"AbortError"!==n.name&&T(t=>({positions:t.positions,status:"error",error:n}))}),()=>s.abort()},[d,f,M]),S}export{f as useForceLayout};
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import{renderRectPulse as t}from"./chunk-chunk-WYARAXHR.module.min.js";import{buildLinearFillGradient as e,clampCornerRadii as n,filterSparseArray as s,hasAnyCornerRadius as o,resolveCSSColor as i,resolveCanvasFill as r,symbolPathString as l}from"./chunk-chunk-PX5YQGDP.module.min.js";var c=class{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(t){Number.isFinite(t)&&(this._min>t&&(this._min=t),t>this._max&&(this._max=t))}evict(t){t!==this._min&&t!==this._max||(this._dirty=!0)}recalculate(t,e){this._min=1/0,this._max=-1/0;for(const n of t){const t=e?e(n):n;Number.isFinite(t)&&(this._min>t&&(this._min=t),t>this._max&&(this._max=t))}this._dirty=!1}clear(){this._min=1/0,this._max=-1/0,this._dirty=!1}get extent(){return[this._min,this._max]}get min(){return this._min}get max(){return this._max}get dirty(){return this._dirty}},a=class{constructor(t,e){this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=t,this.chunkThreshold=e?.chunkThreshold??5e3,this.chunkSize=e?.chunkSize??5e3}updateChunkOptions(t){null!=t.chunkThreshold&&(this.chunkThreshold=t.chunkThreshold),null!=t.chunkSize&&(this.chunkSize=t.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(t){if(t=s(t),this.lastBoundedData===t)return;if(this.lastBoundedData=t,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=t.length)return void this.callback({inserts:t,bounded:!0});this.callback({inserts:t.slice(0,this.chunkSize),bounded:!0,totalSize:t.length});let e=this.chunkSize;const n=()=>{if(e>=t.length)return void(this.chunkTimer=0);if(t!==this.lastBoundedData)return void(this.chunkTimer=0);const s=Math.min(e+this.chunkSize,t.length);this.callback({inserts:t.slice(e,s),bounded:!1}),e=s,this.chunkTimer=t.length>e?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}setReplacementData(t){if(t=s(t),this.lastBoundedData=t,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=t.length)return void this.callback({inserts:t,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:t.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:t.length});let e=this.chunkSize;const n=()=>{if(e>=t.length)return void(this.chunkTimer=0);if(t!==this.lastBoundedData)return void(this.chunkTimer=0);const s=Math.min(e+this.chunkSize,t.length);this.callback({inserts:t.slice(e,s),bounded:!1}),e=s,this.chunkTimer=t.length>e?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const t=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:t,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(t){null!=t&&"object"==typeof t&&(this.pushBuffer.push(t),this.scheduleFlush())}pushMany(t){if(0===t.length)return;let e=0;for(let n=0;t.length>n;n++){const s=t[n];null!=s&&"object"==typeof s&&(this.pushBuffer.push(s),e++)}0!==e&&this.scheduleFlush()}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}};function u(t,e){return t===e}function h(t,e){if("function"==typeof t)return e=>+t(e);const n=t||e;return t=>+t[n]}function f(t,e){if("function"==typeof t)return t;const n=t||e;return t=>t[n]}function y(t,e){return"function"==typeof t?t:t?e=>e[t]+"":e?t=>t[e]+"":void 0}var d={stops:[{offset:0,opacity:.8},{offset:1,opacity:.05}]};function p(t,e=d){if(t)return!0===t?e:"stops"in t?Array.isArray(t.stops)?t:void 0:"colorStops"in t?Array.isArray(t.colorStops)?{stops:t.colorStops.map(({offset:t,color:e})=>({offset:t,color:e}))}:void 0:{stops:[{offset:0,opacity:t.topOpacity??e.stops[0]?.opacity??.8},{offset:1,opacity:t.bottomOpacity??e.stops.at(-1)?.opacity??.05}]}}function m(t){return t?p(t):void 0}function k(t){if(t)return Array.isArray(t)?{stops:t.map(({at:t,color:e,opacity:n})=>({offset:t/100,color:e,...null!=n&&{opacity:n}}))}:Array.isArray(t.stops)?t:void 0}function g(t){return{stops:t.stops.map(t=>({...t,offset:1-t.offset})).sort((t,e)=>t.offset-e.offset)}}function T(t,e,n,s){return"function"==typeof t?t({size:e,margin:n,scales:s}):t}function x(t,e,n,s){return"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:n,fn:t}:"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:s,fn:e}:{key:void 0,fn:null}}function b(t,e,n){return s=>{if(!s||!n||!t.fn&&!e.fn)return s;let o=!1;const i=s.map(n=>{const s=t.fn&&t.key&&!(t.key in n),i=e.fn&&e.key&&!(e.key in n);if(!s&&!i)return n;o=!0;const r={...n};return s&&(r[t.key]=t.fn(n)),i&&(r[e.key]=e.fn(n)),r});return o?i:s}}function w(t){return new Set(Array.isArray(t)?t:[t])}function v(t,e,n){return"exact"===n?function(t,e){const n=t.domain(),s=n[0],o=n[n.length-1],i=s instanceof Date,r=s instanceof Date?s.getTime():s,l=o instanceof Date?o.getTime():o;if(2>e||r===l)return i?[new Date(r),new Date(l)]:[r,l];const c=(l-r)/(e-1),a=Array(e);for(let t=0;e>t;t++){const n=t===e-1?l:r+t*c;a[t]=i?new Date(n):n}return a}(t,e):t.ticks(e)}var A=new Map;function S(t){try{if(t.path)return new Path2D(t.path);const e=`${t.symbolType??"circle"}:${Math.round(t.size)}`;let n=A.get(e);return n||(n=new Path2D(l(t.symbolType,t.size)),A.size>256&&A.clear(),A.set(e,n)),n}catch{return null}}var F=(t,e)=>{const n=t.globalAlpha;for(const s of e){if("symbol"!==s.type)continue;const e=s;if(0>=e.size)continue;const o=S(e);if(!o)continue;t.save(),t.translate(e.x,e.y),e.rotation&&t.rotate(e.rotation);const i=(e.style.opacity??1)*(e._decayOpacity??1);e.style.fill&&(t.globalAlpha=n*i*(e.style.fillOpacity??1),t.fillStyle=r(t,e.style.fill,"#4e79a7"),t.fill(o)),e.style.stroke&&"none"!==e.style.stroke&&(t.globalAlpha=n*i,t.strokeStyle=r(t,e.style.stroke,e.style.stroke),t.lineWidth=e.style.strokeWidth??1,t.stroke(o)),t.restore()}t.globalAlpha=n};function _(t,e){const{x:s,y:o,w:i,h:r}=e,{tl:l,tr:c,br:a,bl:u}=n(e);t.beginPath(),t.moveTo(s+l,o),t.lineTo(s+i-c,o),c>0&&t.arcTo(s+i,o,s+i,o+c,c),t.lineTo(s+i,o+r-a),a>0&&t.arcTo(s+i,o+r,s+i-a,o+r,a),t.lineTo(s+u,o+r),u>0&&t.arcTo(s,o+r,s,o+r-u,u),t.lineTo(s,o+l),l>0&&t.arcTo(s,o,s+l,o,l),t.closePath()}function B(t){switch(t.roundedEdge){case"bottom":return{x0:t.x,y0:t.y+t.h,x1:t.x,y1:t.y};case"right":return{x0:t.x+t.w,y0:t.y,x1:t.x,y1:t.y};case"left":return{x0:t.x,y0:t.y,x1:t.x+t.w,y1:t.y};default:return{x0:t.x,y0:t.y,x1:t.x,y1:t.y+t.h}}}var z=(n,s,l,c)=>{const a=s.filter(t=>"rect"===t.type);for(const s of a){if(null!=s.style.opacity&&(n.globalAlpha=s.style.opacity),s.style.icon)D(n,s);else if(s.cornerRadii&&o(s.cornerRadii)){const t=r(n,s.style.fill,i(n,"var(--semiotic-primary, #007bff)")),o=B(s),l=s.fillGradient&&"string"==typeof t?e(n,s.fillGradient,t,o.x0,o.y0,o.x1,o.y1):null;n.fillStyle=l||t,_(n,s),n.fill(),s.style.stroke&&"none"!==s.style.stroke&&(n.strokeStyle=i(n,s.style.stroke)||s.style.stroke,n.lineWidth=s.style.strokeWidth||1,n.stroke())}else if(s.roundedTop&&s.roundedTop>0){const t=r(n,s.style.fill,i(n,"var(--semiotic-primary, #007bff)")),o=B(s),l=s.fillGradient&&"string"==typeof t?e(n,s.fillGradient,t,o.x0,o.y0,o.x1,o.y1):null;n.fillStyle=l||t;const c=Math.min(s.roundedTop,s.w/2,s.h/2);n.beginPath();const{x:a,y:u,w:h,h:f}=s;switch(s.roundedEdge){case"right":n.moveTo(a,u),n.lineTo(a+h-c,u),n.arcTo(a+h,u,a+h,u+c,c),n.lineTo(a+h,u+f-c),n.arcTo(a+h,u+f,a+h-c,u+f,c),n.lineTo(a,u+f);break;case"left":n.moveTo(a+h,u),n.lineTo(a+c,u),n.arcTo(a,u,a,u+c,c),n.lineTo(a,u+f-c),n.arcTo(a,u+f,a+c,u+f,c),n.lineTo(a+h,u+f);break;case"bottom":n.moveTo(a,u),n.lineTo(a+h,u),n.lineTo(a+h,u+f-c),n.arcTo(a+h,u+f,a+h-c,u+f,c),n.lineTo(a+c,u+f),n.arcTo(a,u+f,a,u+f-c,c);break;default:n.moveTo(a,u+f),n.lineTo(a,u+c),n.arcTo(a,u,a+c,u,c),n.lineTo(a+h-c,u),n.arcTo(a+h,u,a+h,u+c,c),n.lineTo(a+h,u+f)}n.closePath(),n.fill(),s.style.stroke&&"none"!==s.style.stroke&&(n.strokeStyle=i(n,s.style.stroke)||s.style.stroke,n.lineWidth=s.style.strokeWidth||1,n.stroke())}else{const t=r(n,s.style.fill,i(n,"var(--semiotic-primary, #007bff)")),o=B(s),l=s.fillGradient&&"string"==typeof t?e(n,s.fillGradient,t,o.x0,o.y0,o.x1,o.y1):null;n.fillStyle=l||t,n.fillRect(s.x,s.y,s.w,s.h),s.style.stroke&&"none"!==s.style.stroke&&(n.strokeStyle=i(n,s.style.stroke)||s.style.stroke,n.lineWidth=s.style.strokeWidth||1,n.strokeRect(s.x,s.y,s.w,s.h))}t(n,s),n.globalAlpha=1}};function D(t,e){const n=e.style.icon,s=e.style.iconPadding||2,o=Math.min(e.w,e.h)-s;if(0>=o)return;const i=e.h>e.w;if(t.save(),t.beginPath(),t.rect(e.x,e.y,e.w,e.h),t.clip(),i){const i=o+s,r=e.x+(e.w-o)/2;for(let s=e.y+e.h-o;s>=e.y-o;s-=i)t.drawImage(n,r,s,o,o)}else{const i=o+s,r=e.y+(e.h-o)/2;for(let s=e.x;e.x+e.w>s;s+=i)t.drawImage(n,s,r,o,o)}t.restore()}function M(t,e,n,s,o,i){const r=[];for(const o of t){const t=n(o),i=s(o);Number.isFinite(t)&&Number.isFinite(i)&&r.push({px:e.x(t),py:e.y(i),rawY:i,d:o})}r.sort((t,e)=>t.px-e.px);const l=Array(r.length),c=Array(r.length),a=Array(r.length);for(let t=0;r.length>t;t++){const e=r[t];l[t]=[e.px,e.py],c[t]=e.rawY,a[t]=e.d}return{type:"line",path:l,rawValues:c,style:o,datum:a,group:i}}function P(t,e,n,s,o,i,r,l){const c=[];for(const i of t){const t=n(i),r=s(i);if(!Number.isFinite(t)||!Number.isFinite(r))continue;const a=e.x(t),u=l?l(i):o;c.push({px:a,topY:e.y(r),botY:e.y(u),rawY:r})}c.sort((t,e)=>t.px-e.px);const a=Array(c.length),u=Array(c.length),h=Array(c.length);for(let t=0;c.length>t;t++){const e=c[t];a[t]=[e.px,e.topY],u[t]=[e.px,e.botY],h[t]=e.rawY}return{type:"area",topPath:a,bottomPath:u,rawValues:h,style:i,datum:t,group:r}}function N(t,e,n,s){const o=new Map;if("silhouette"===s)for(const s of t){let t=0;for(const o of e)t+=n(o,s)||0;o.set(s,-t/2)}else if("wiggle"===s){t.length>0&&o.set(t[0],0);for(let s=1;t.length>s;s++){const i=t[s-1],r=t[s];let l=0,c=0,a=0;for(const t of e){const e=n(t,r)||0;l+=(2*a+e)*(e-(n(t,i)||0)),c+=e,a+=e}const u=o.get(i)??0;o.set(r,u-(c>0?l/(2*c):0))}if(t.length>0){let s=0;for(const i of t){let t=0;for(const s of e)t+=n(s,i)||0;s+=(o.get(i)??0)+t/2}const i=s/t.length;for(const e of t)o.set(e,(o.get(e)??0)-i)}}else for(const e of t)o.set(e,0);return o}function Y(t,e,n){let s=0,o=0;for(const i of t){let t=0,r=0;for(const s of e){const e=n(s,i)||0;0>e?r+=e:t+=e}s>r&&(s=r),t>o&&(o=t)}return[s,o]}function W(t,e,n,s,o,i,r,l="zero"){const c=new Set;for(const e of t)for(const t of e.data){const e=n(t);Number.isFinite(e)&&c.add(e)}const a=Array.from(c).sort((t,e)=>t-e),u=new Map;for(const e of t){const t=new Map;for(const o of e.data){const e=n(o),i=s(o);Number.isFinite(e)&&Number.isFinite(i)&&t.set(e,(t.get(e)||0)+i)}u.set(e.key,t)}let h;if(i){h=new Map;for(const e of a){let n=0;for(const s of t)n+=u.get(s.key)?.get(e)||0;h.set(e,n||1)}}const f=N(a,t.map(t=>t.key),(t,e)=>u.get(t)?.get(e)||0,l),y="diverging"===l&&!i,d=[],p=new Map,m=new Map,k=new Map,g=new Map;for(const t of a)m.set(t,f.get(t)??0),k.set(t,0),g.set(t,0);for(const n of t){const t=u.get(n.key),s=new Map;let l=[],c=[];const f=()=>{if(l.length>=2){const t={type:"area",topPath:l,bottomPath:c,style:o(n.key,n.data[0]),datum:n.data,group:n.key};r&&(t.curve=r),d.push(t)}l=[],c=[]};for(const n of a){const o=t.has(n);let r,a,u=o?t.get(n):0;if(i&&o&&(u/=h.get(n)),!o||!Number.isFinite(u)||0===u){f();continue}y?u>0?(r=k.get(n),a=r+u,k.set(n,a)):(r=g.get(n),a=r+u,g.set(n,a)):(r=m.get(n),a=r+u,m.set(n,a));const d=e.x(n);c.push([d,e.y(r)]),l.push([d,e.y(a)]),s.set(n,a)}f(),p.set(n.key,s)}return{nodes:d,stackedTops:p}}function G(t,e,n,s,o,i,r){const l=n(t),c=s(t);if(!Number.isFinite(l)||!Number.isFinite(c))return null;const a={type:"point",x:e.x(l),y:e.y(c),r:o,style:i,datum:t};return void 0!==r&&(a.pointId=r),a}function O(t,e,n,s,o,i,r,l){const c=n(t),a=s(t);if(!Number.isFinite(c)||!Number.isFinite(a))return null;const u={type:"symbol",x:e.x(c),y:e.y(a),size:o,symbolType:i,style:r,datum:t};return void 0!==l&&(u.pointId=l),u}function R(t,e,n,s,o,i,r){return{type:"rect",x:t,y:e,w:n,h:s,style:o,datum:i,group:r}}function q(t,e,n,s,o,i,r){const l={type:"heatcell",x:t,y:e,w:n,h:s,fill:o,datum:i};return r?.showValues&&(l.showValues=!0,l.value=r.value,r.valueFormat&&(l.valueFormat=r.valueFormat)),l}export{a as DataSourceAdapter,c as IncrementalExtent,u as accessorsEquivalent,h as resolveAccessor,f as resolveRawAccessor,y as resolveStringAccessor,w as toIdSet,M as buildLineNode,P as buildAreaNode,N as computeStackOffsets,Y as computeDivergingStackExtent,W as buildStackedAreaNodes,G as buildPointNode,O as buildSymbolNode,R as buildRectNode,q as buildHeatcellNode,p as normalizeGradient,m as normalizeColorGradient,k as normalizeSemanticGradient,g as reverseGradient,v as ticksForMode,T as resolveFrameGraphics,x as resolveAnnotationAccessor,b as buildEnrichAnnotationData,F as symbolCanvasRenderer,z as barCanvasRenderer};