semiotic 3.10.2 → 3.10.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -26
- package/ai/artifact-surface-inventory.json +1 -1
- package/ai/behaviorContracts.cjs +15 -5
- package/ai/behaviorContracts.d.cts +3 -0
- package/ai/cli.js +17 -166
- package/ai/componentMetadata.cjs +68 -15
- package/ai/componentMetadata.d.cts +3 -0
- package/ai/dist/diagnose-operation.js +3 -0
- package/ai/dist/mcp-server.js +59 -59
- package/ai/reference.md +6 -6
- package/ai/schema.json +1 -1
- package/ai/surface-manifest.json +1 -1
- package/ai/system-prompt.md +2 -2
- package/ai/task-packets/compare-category-totals.json +7 -7
- package/ai/task-packets/compare-category-totals.md +3 -3
- package/ai/task-packets/correct-published-chart.json +7 -7
- package/ai/task-packets/correct-published-chart.md +3 -3
- package/ai/task-packets/index.json +6 -6
- package/ai/task-packets/update-live-chart.json +7 -7
- package/ai/task-packets/update-live-chart.md +3 -3
- package/dist/c-2MHSD3TN.min.js +209 -0
- package/dist/{c-PZ3NEGNG.min.js → c-6XGGN5OS.min.js} +1 -1
- package/dist/{c-FDUQDCBC.min.js → c-CO4NDAD6.min.js} +23 -23
- package/dist/c-EK6XI2U7.min.js +26 -0
- package/dist/c-FMCUQ6JX.min.js +1 -0
- package/dist/{c-C4KIXUWU.min.js → c-GK263BF4.min.js} +1 -1
- package/dist/{c-TTKWXGAI.min.js → c-HNHKIMIV.min.js} +3 -3
- package/dist/c-IJCZGUG6.min.js +31 -0
- package/dist/{c-4XLHPQTP.min.js → c-JBWPJNTJ.min.js} +1 -1
- package/dist/{c-4MD53L2J.min.js → c-JC76YAHB.min.js} +28 -28
- package/dist/{c-VXIYF7V2.min.js → c-JOPGDP6N.min.js} +1 -1
- package/dist/c-KWP4QTCM.min.js +4 -0
- package/dist/c-LRV7PO45.min.js +393 -0
- package/dist/c-LVHJJUOF.min.js +1 -0
- package/dist/c-M43PK7K4.min.js +1 -0
- package/dist/c-NUBZ63VU.min.js +1 -0
- package/dist/{c-7ASK4WBF.min.js → c-PITYSOPK.min.js} +1 -1
- package/dist/{c-2TW5H5PD.min.js → c-QPO24R7Q.min.js} +1 -1
- package/dist/{c-SG2Y7EBY.min.js → c-RWHLEUX6.min.js} +1 -1
- package/dist/{c-4JKDJUYD.min.js → c-S746GRV4.min.js} +1 -1
- package/dist/{c-KGROWFT2.min.js → c-SAP5KY6R.min.js} +2 -2
- package/dist/c-UMGHCBH5.min.js +114 -0
- package/dist/c-UQBWSYKI.min.js +41 -0
- package/dist/{c-6ZU3QVLB.min.js → c-VEMCBQZZ.min.js} +33 -33
- package/dist/{c-IPYGNVN6.min.js → c-WD2RL76M.min.js} +45 -45
- package/dist/{c-PQOZPM4G.min.js → c-YL7HJL5J.min.js} +1 -1
- package/dist/c-Z6GRGS53.min.js +1 -0
- package/dist/components/CategoryColors.d.ts +7 -0
- package/dist/components/LinkedCharts.d.ts +2 -1
- package/dist/components/ai/chartClinic.d.ts +1 -1
- package/dist/components/ai/chartClinicMetadata.generated.d.ts +2 -2
- package/dist/components/charts/shared/{chartDefinitionPilot.d.ts → chartDefinition.d.ts} +30 -34
- package/dist/components/charts/shared/chartDefinitions.d.ts +10 -0
- package/dist/components/charts/shared/chartDefinitionsNetwork.d.ts +17 -0
- package/dist/components/charts/shared/chartDefinitionsOrdinal.d.ts +23 -0
- package/dist/components/charts/shared/chartDefinitionsPhysics.d.ts +17 -0
- package/dist/components/charts/shared/chartDefinitionsRealtime.d.ts +12 -0
- package/dist/components/charts/shared/chartDefinitionsXY.d.ts +26 -0
- package/dist/components/charts/shared/useChartSetup.d.ts +1 -1
- package/dist/components/charts/shared/useNetworkChartSetup.d.ts +1 -1
- package/dist/components/data/transforms.d.ts +1 -0
- package/dist/components/server/serverChartConfigs.d.ts +36 -36
- package/dist/components/server/serverChartConfigsNetwork.generated.d.ts +17 -0
- package/dist/components/server/serverChartConfigsOrdinal.generated.d.ts +23 -0
- package/dist/components/server/serverChartConfigsPhysics.generated.d.ts +17 -0
- package/dist/components/server/serverChartConfigsRealtime.generated.d.ts +13 -0
- package/dist/components/server/serverChartConfigsXY.generated.d.ts +22 -0
- package/dist/components/stream/physics/PhysicsOptionalEngineAdapters.d.ts +5 -0
- package/dist/geo.min.js +3 -3
- package/dist/geo.module.min.js +10 -10
- package/dist/network.module.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/physics-matter.min.js +4 -1
- package/dist/physics-matter.module.min.js +1 -1
- package/dist/physics-rapier.min.js +4 -1
- package/dist/physics-rapier.module.min.js +1 -1
- package/dist/physics.module.min.js +1 -1
- package/dist/physicsWorker.js +1 -1
- package/dist/semiotic-ai-core.min.js +3 -3
- package/dist/semiotic-ai-core.module.min.js +3 -3
- package/dist/semiotic-ai.module.min.js +7 -7
- package/dist/semiotic-artifact.min.js +1 -1
- package/dist/semiotic-artifact.module.min.js +1 -1
- package/dist/semiotic-atlas-selection.module.min.js +1 -1
- package/dist/semiotic-client-cjs-shared.min.js +903 -902
- package/dist/semiotic-data.min.js +1 -1
- package/dist/semiotic-data.module.min.js +1 -1
- package/dist/semiotic-experimental-auxiliary.module.min.js +3 -3
- package/dist/semiotic-experimental-node-auxiliary.module.min.js +3 -3
- package/dist/semiotic-experimental-vacp.module.min.js +1 -1
- package/dist/semiotic-line.module.min.js +1 -1
- package/dist/semiotic-realtime-core.module.min.js +1 -1
- package/dist/semiotic-recipes-core-cjs-base.min.js +1 -1
- package/dist/semiotic-recipes-core.module.min.js +13 -13
- package/dist/semiotic-server-edge-node.module.min.js +393 -391
- package/dist/semiotic-server-edge.min.js +393 -391
- package/dist/semiotic-server-edge.module.min.js +374 -372
- package/dist/semiotic-server-node.min.js +393 -391
- package/dist/semiotic-server-node.module.min.js +1 -1
- package/dist/semiotic-utils-core.min.js +1 -1
- package/dist/semiotic-utils-core.module.min.js +1 -1
- package/dist/semiotic.module.min.js +10 -10
- package/dist/server.min.js +393 -391
- package/dist/server.module.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +12 -8
- package/dist/c-3OFVBWQY.min.js +0 -1
- package/dist/c-6IVBV5NO.min.js +0 -1
- package/dist/c-72CBVNYX.min.js +0 -209
- package/dist/c-7LY46QUI.min.js +0 -41
- package/dist/c-AKLBQMQF.min.js +0 -391
- package/dist/c-F2GGJB2S.min.js +0 -31
- package/dist/c-G53AVC42.min.js +0 -113
- package/dist/c-HQ27AHMC.min.js +0 -1
- package/dist/c-IHWZ2C6D.min.js +0 -26
- package/dist/c-MOP2NGLH.min.js +0 -1
- package/dist/c-PKY4JFY5.min.js +0 -1
- package/dist/c-UBHICVSC.min.js +0 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
function e(e,t,i){if(i)return i;let n=e??"circle";if("chevron"===n)return s(t);let r=Object.prototype.hasOwnProperty.call(nn,n)?nn[n]:_i;return Ui(r,Math.max(1,t))()??""}function t(e){return Math.sqrt(Math.max(1,e)/Math.PI)}function i(i,n,s){if(!s&&"circle"===(i??"circle"))return t(n);let r=s?"p:"+s:`s:${i??"circle"}:${n}`,o=on.get(r);if(null!=o)return o;let a=e(i,n,s).match(/-?\d*\.?\d+(?:e-?\d+)?/gi),l=0;if(a)for(let e=0;a.length>e+1;e+=2){let t=+a[e],i=+a[e+1],n=Math.sqrt(t*t+i*i);n>l&&(l=n)}return l>0?(on.size>512&&on.clear(),on.set(r,l),l):t(n)}function n(e,t){let i=/* @__PURE__ */new Map,n=0;return s=>{let r=e(s)+"",o=t&&Object.prototype.hasOwnProperty.call(t,r)?t[r]:void 0;if(o&&sn.has(o))return o;let a=i.get(r);return a||(a=rn[n%rn.length],n++,i.set(r,a)),a}}function s(e){let i=1.5*t(e),n=.92*i;return`M0,${-i}L${n},${(.78*i).toFixed(3)}L0,${(.28*i).toFixed(3)}L${-n},${(.78*i).toFixed(3)}Z`}function r(e,t){let[i,n]=e.viewBox??an,[s,r]=e.anchor??ln,o=n>0?n:1,a=Math.max(0,t)/o,l=(i>0?i:o)*a,d=o*a;return{width:l,height:d,scale:a,offsetX:-s*l,offsetY:-r*d}}function o(e,t){let i=r(e,t),n=[[i.offsetX,i.offsetY],[i.offsetX+i.width,i.offsetY],[i.offsetX,i.offsetY+i.height],[i.offsetX+i.width,i.offsetY+i.height]],s=0;for(let[e,t]of n){let i=Math.sqrt(e*e+t*t);i>s&&(s=i)}return s}function a(e,t,i,n){if("none"!==e)return"color"===e||null==e?t??n:"accent"===e?i:e}function l(e,t,i=0,n="horizontal"){let[s,r]=e.viewBox??an,o=Math.min(1,Math.max(0,i)),a=Math.min(1,Math.max(0,t));return a>o?o>0||1>a?"vertical"===n?{x:0,y:r*(1-a),width:s,height:r*(a-o)}:{x:s*o,y:0,width:s*(a-o),height:r}:null:{x:0,y:0,width:0,height:0}}function d(e,t){let i=r(e,t);return{centerDx:i.offsetX+i.width/2,centerDy:i.offsetY+i.height/2,halfWidth:i.width/2,halfHeight:i.height/2,radius:Math.hypot(i.width,i.height)/2}}function h(e){let{desired:t,minGaps:i,weights:n}=e,s=t.length;if(0===s)return[];if(i.length!==Math.max(0,s-1))throw Error("placeWithMinGap: minGaps must have desired.length - 1 entries");let r=Array(s).fill(0);for(let e=1;s>e;e++)r[e]=r[e-1]+Math.max(0,Number.isFinite(i[e-1])?i[e-1]:0);let o=[];for(let e=0;s>e;e++){let i=Math.max(Number.EPSILON,Number.isFinite(n?.[e])?n[e]:1),s=(Number.isFinite(t[e])?t[e]:0)-r[e];for(o.push({start:e,end:e,weight:i,mean:s});o.length>1;){let e=o[o.length-1],t=o[o.length-2];if(e.mean>=t.mean)break;let i=t.weight+e.weight;o.splice(o.length-2,2,{start:t.start,end:e.end,weight:i,mean:(t.mean*t.weight+e.mean*e.weight)/i})}}let a=Number.isFinite(e.min)?e.min:-1/0,l=Number.isFinite(e.max)?e.max-r[s-1]:1/0,d=a>l?a:l,h=Array(s);for(let e of o){let t=Math.max(a,Math.min(d,e.mean));for(let i=e.start;e.end>=i;i++)h[i]=t+r[i]}return h}function u(e){return"string"==typeof e?.type?e.type:""}function c(e){return!!e&&"object"==typeof e&&dn.has(u(e))}function p(e){return c(e)}function f(e){return"primary"===e?.emphasis||!0===e?.defensive}function m(e,t,i){return Math.max(t,Math.min(i,e))}function y(e,t,i={}){return"number"==typeof i.maxAnnotations&&Number.isFinite(i.maxAnnotations)?Math.max(0,Math.floor(i.maxAnnotations)):e>0&&t>0?Math.max(1,Math.round(e*t/(i.areaPerAnnotation&&i.areaPerAnnotation>0?i.areaPerAnnotation:2e4))):1/0}function x(e){let t,i=e?.emphasis;t="primary"===i?100:"secondary"===i?10:50;let n=e?.provenance?.confidence;switch("number"==typeof n&&Number.isFinite(n)&&(t+=15*m(n,0,1)),e?.lifecycle?.freshness){case"fresh":t+=8;break;case"aging":t+=4;break;case"stale":t+=1;break;case"expired":t-=200}return t}function g(e){let{annotations:t,width:i,height:n}=e,s=Math.max(0,e.minVisible??1),r=y(i,n,e),o=t.map((e,t)=>({annotation:e,index:t,note:p(e)})),a=o.filter(e=>e.note);if(0===a.length||r>=a.length)return{visible:t.slice(),deferred:[],budget:r};let l=a.filter(e=>f(e.annotation)),d=a.filter(e=>!f(e.annotation)).sort((e,t)=>x(t.annotation)-x(e.annotation)||e.index-t.index),h=Math.min(d.length,Math.max(Math.max(0,r-l.length),Math.max(0,s-l.length))),u=/* @__PURE__ */new Set([...l.map(e=>e.index),...d.slice(0,h).map(e=>e.index)]),c=[],m=[];for(let{annotation:e,index:t,note:i}of o)!i||u.has(t)?c.push(e):m.push(e);return{visible:c,deferred:m,budget:r}}function b(e,t){let i=t.scales?.x??t.scales?.time;return i?null!=e.x?i(e.x):t.xAccessor&&null!=e[t.xAccessor]?i(e[t.xAccessor]):null:null}function v(e,t){let i=t.scales?.y??t.scales?.value;return i?null!=e.y?i(e.y):t.yAccessor&&null!=e[t.yAccessor]?i(e[t.yAccessor]):null:null}function w(e){let t=e.data;if(!t||0===t.length)return null;let i=t[t.length-1],n=e.scales?.x??e.scales?.time,s=e.scales?.y??e.scales?.value;if(!n||!s)return null;let r=i[e.xAccessor||"x"],o=i[e.yAccessor||"y"];return null==r||null==o?null:{x:n(r),y:s(o)}}function S(e){return null==e?null:e+""}function M(e){return S(e.provenance?.stableId??e.stableId)}function k(e){return S(e.stableId??e.id??e.provenance?.stableId)}function I(e,t,i){return t.stickyPositionCache?.set(e,i),i}function B(e,t,i){let n=M(e);if(!n)return null;let s=i.pointNodes?.find(e=>S(e.pointId)===n);if(s)return I(t,i,{x:s.x,y:s.y});let r=i.data?.find(e=>k(e)===n);if(!r)return null;let o=b(r,i),a=v(r,i);return null==o||null==a?null:I(t,i,{x:o,y:a})}function O(e,t,i){let n=e.anchor||e.lifecycle?.anchor||"fixed";if("latest"===n){if(null!=e.pointId&&i.pointNodes&&i.pointNodes.length>0)for(let n=i.pointNodes.length-1;n>=0;n--){let s=i.pointNodes[n];if(s.pointId===e.pointId)return I(t,i,{x:s.x,y:s.y})}let n=w(i);return n?I(t,i,n):null}if("semantic"===n){let n=B(e,t,i);if(n)return n}let s=null,r=null;if(null!=e.pointId&&i.pointNodes){let t=i.pointNodes.find(t=>t.pointId===e.pointId);t&&(s=t.x,r=t.y)}if((null==s||null==r)&&(s=b(e,i),r=v(e,i)),null!=s&&null!=r)return I(t,i,{x:s,y:r});if("sticky"===n){let e=i.stickyPositionCache?.get(t);if(e)return e}return null}function A(e,t,i,n=50){return!(-n>e||e>(i.width||0)+n||-n>t||t>(i.height||0)+n)}function C(e){return{label:e.label,title:e.title,wrap:e.wrap||120,noWrap:"function"==typeof e._noteLayout?e.noWrap:void 0,_noteLayout:e._noteLayout}}function $(e){return"function"==typeof e._noteLayout?e._noteLayout(e):void 0}function q(e,t,i){if(!e)return[];let n=Math.max(1,Math.floor(t/i)),s=[],r="";for(let t of e.split(/\s+/))t&&(r&&r.length+1+t.length>n?(s.push(r),r=t):r=r?`${r} ${t}`:t);return r&&s.push(r),s}function P(e){return"number"==typeof e.dx||"number"==typeof e.dy}function N(e){return"text"===e.type||"widget"===e.type?{dx:0,dy:0}:{dx:30,dy:-30}}function F(e){let t=e?.familiarity;if(!t)return 3;let i=Object.values(t).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0===i.length?3:i.reduce((e,t)=>e+t,0)/i.length}function D(e){if(!e)return 1;let t=F(e);return t>2?4>t?1:.6:1.5}function T(e){let t=e?.provenance;if(!t||"object"!=typeof t)return e;let i="string"==typeof t.source?Object.prototype.hasOwnProperty.call(yn,t.source)?yn[t.source]:t.source:null,n="number"==typeof t.confidence&&Number.isFinite(t.confidence)?Math.round(100*Math.max(0,Math.min(1,t.confidence)))+"%":null;if(!i&&!n||null!=e.label&&"string"!=typeof e.label)return e;let s=[i,n].filter(Boolean).join(" · "),r="string"==typeof e.label?e.label:"";return r.includes(`(${s})`)?e:{...e,label:r?`${r} (${s})`:`(${s})`}}function L(e,t){let i=!1,n=e.map(e=>R(e)&&"blended"!==e.cohesion&&"layer"!==e.cohesion?(i=!0,{...e,cohesion:t}):e);return i?n:e}function j(e){if(!R(e))return e;let t=("string"==typeof e.mobileText?e.mobileText:void 0)??("string"==typeof e.shortText?e.shortText:void 0);return!t||"string"!=typeof e.label&&null!=e.label?e:{...e,label:t}}function E(e){return"text"!==e.type||"string"!=typeof e.color||8>Math.hypot("number"==typeof e.dx?e.dx:0,"number"==typeof e.dy?e.dy:0)?e:{...e,_redundantConnector:!0}}function R(e){return c(e)}function Y(e){if("widget"===e.type)return{width:"number"==typeof e.width?e.width:32,height:"number"==typeof e.height?e.height:32};let t=$(e);if(t)return{width:Math.max(24,t.width+10),height:Math.max(18,t.height+6)};let i="number"==typeof e.wrap?e.wrap:120,n=[...q("string"==typeof e.title?e.title:void 0,i,7),...q("string"==typeof e.label?e.label:void 0,i,7)],s=n.reduce((e,t)=>Math.max(e,t.length),0);return{width:Math.max(24,Math.min(i,7*s)+10),height:Math.max(18,16*n.length+6)}}function W(e,t,i,n,s){let r=e+i,o=t+n;return Math.abs(i)>Math.abs(n)?{x:0>i?r-s.width-4:r+4,y:0>n?o-s.height:o,width:s.width,height:s.height}:{x:0>i?r-s.width:r,y:0>n?o-s.height-4:o+4,width:s.width,height:s.height}}function X(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function z(e,t){return Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x))*Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y))}function G(e,t,i,n){let s=Math.max(0,n-e.x),r=Math.max(0,n-e.y);return(s+Math.max(0,e.x+e.width-(t-n)))*e.height+(r+Math.max(0,e.y+e.height-(i-n)))*e.width}function H(e){let t=1.6*e;return[{dx:e,dy:-e},{dx:-e,dy:-e},{dx:e,dy:e},{dx:-e,dy:e},{dx:e,dy:0},{dx:-e,dy:0},{dx:0,dy:-e},{dx:0,dy:e},{dx:t,dy:-t},{dx:-t,dy:-t},{dx:t,dy:t},{dx:-t,dy:t}]}function K(e,t){return(e.pointNodes||[]).map(e=>{let i=Math.max(1,e.r||1)+t;return{x:e.x-i,y:e.y-i,width:2*i,height:2*i}})}function U(e,t,i,n,s,r,o,a){let l=X(e,o),d=.4*Math.hypot(t.dx,t.dy)+80*G(l,s,r,a);for(let e of i)d+=12*z(l,e);for(let e of n)d+=4*z(l,e);return d}function _(e,t,i){if("widget"===e.type&&"number"==typeof e.px&&"number"==typeof e.py)return{x:e.px,y:e.py};let n=e.pointId??e.nodeId;if(null!=n&&i.pointNodes){let e=i.pointNodes.find(e=>e.pointId===n);if(e)return{x:e.x,y:e.y}}let s=e.coordinates,r=i.scales?.geoProjection;if(Array.isArray(s)&&s.length>=2&&r){let e=s[0],t=s[1];if("number"==typeof e&&"number"==typeof t){let i=r([e,t]);if(i&&"number"==typeof i[0]&&"number"==typeof i[1])return{x:i[0],y:i[1]}}}return i.scales||"number"!=typeof e.x||"number"!=typeof e.y?O(e,t,i):{x:e.x,y:e.y}}function V(e){let{annotations:t,context:i,defaultOffset:n=un,notePadding:s=cn,markPadding:r=pn,edgePadding:o=fn,preserveManualOffsets:a=!0,routeLongConnectors:l=!0,connectorThreshold:d=mn,density:h,progressiveDisclosure:u=!1,redundantCues:c=!1,responsive:p,mobile:f,cohesion:m,audience:x}=e,b=i.width||0,v=i.height||0,w="object"==typeof f?f:{},S=w.breakpoint??480,M=!!f&&S>=b,k=M&&!1!==w.preferShortText?t.map(j):t,I=M&&!h?{maxAnnotations:w.maxAnnotations??("callout-list"===w.strategy?1:2),minVisible:w.minVisible??1}:h,B=u||M&&(!1!==w.progressiveDisclosure||"callout-list"===w.strategy),O=M&&!p?w.responsive??{minWidth:S}:p,A=M&&!m?w.cohesion:m;if(0===k.length||0>=b||0>=v)return k.slice();let C=[],$=K(i,r),q=!1,F=k.map((e,t)=>{if(!R(e))return e;let r=_(e,t,i);if(!r)return e;let h=Y(!0===e.defensive?T(e):e);if(a&&P(e)){let t=N(e);return C.push(X(W(r.x,r.y,"number"==typeof e.dx?e.dx:t.dx,"number"==typeof e.dy?e.dy:t.dy,h),s)),e}let u=null,c=1/0;for(let e of H(n)){let t=U(W(r.x,r.y,e.dx,e.dy,h),e,C,$,b,v,s,o);c>t&&(u=e,c=t)}if(!u)return e;let p=X(W(r.x,r.y,u.dx,u.dy,h),s);C.push(p);let f=Math.hypot(u.dx,u.dy),m=l&&f>=d&&"text"!==e.type&&"widget"!==e.type?{...e.connector||{end:"arrow"},type:"curve"}:e.connector;return q=!0,{...e,dx:u.dx,dy:u.dy,...m?{connector:m}:{}}}),z=q?F:k.slice(),G=z;if(c){let e=!1,t=z.map(t=>{let i=E(t);return i!==t&&(e=!0),i});G=e?t:z}{let e=!1,t=G.map(t=>{if(!0!==t?.defensive)return t;let i=T(t);return i!==t&&(e=!0),i});G=e?t:G}let V,Q=/* @__PURE__ */new Set;if(I){let e="object"==typeof I?I:{},t=D(x),i=1===t?e:{...e,maxAnnotations:Math.max(0,Math.round((e.maxAnnotations??y(b,v,e))*t))},{deferred:n}=g({annotations:G,width:b,height:v,...i});for(let e of n)Q.add(e)}if(O&&("object"==typeof O&&"number"==typeof O.minWidth?O.minWidth:480)>=b)for(let e of G)R(e)&&"secondary"===e.emphasis&&Q.add(e);if(Q.size>0)for(let e of G)!0===e?.defensive&&Q.delete(e);return V=0===Q.size?G:B?G.map(e=>Q.has(e)?{...e,_annotationDeferred:!0}:e):G.filter(e=>!Q.has(e)),A?L(V,A):V}function Q(e){return`${e.getUTCFullYear()}-${Z(e.getUTCMonth()+1)}-${Z(e.getUTCDate())}`}function Z(e){return 10>e?"0"+e:e+""}function J(e){return"function"==typeof e?e:t=>t[e]}function ee(e,t,i){let n=e?.data,s=n?n[t]:void 0;if(null!=s)return s;let r=e?.[t];return r??i}function te(e){return null==e?null:e.data??e.datum??e}function ie(e,t){let i=/* @__PURE__ */new Map;for(let n of e){let e=t(n),s=i.get(e);s?s.push(n):i.set(e,[n])}return i}function ne(e){let t=/* @__PURE__ */Object.create(null);return e((e,i)=>{t[e]=i}),t}function se(e,t){if(!t)return!0;let i=Array.isArray(t)?t:[t],n=e;for(let e of i)if(null!=e.value&&n[e.field]+""!=e.value+"")return!1;return!0}function re(e,t={}){let i=t.baseOpacity??1;return t.highlight||t.predicate?!se(e,t.highlight)||t.predicate&&!t.predicate(e)?t.dimOpacity??.16:Math.min(1,i+(t.brighten??0)):i}function oe(e){return e.join("|")}function ae(e,t=.72){let i=vn(e,"#ffffff"),n=vn(e,"#000000"),s=vn(e,e)(0);return e=>{let r=0>e?0:e>1?1:e;return.5===r?s:.5>r?i(2*(.5-r)*t):n(2*(r-.5)*t)}}function le(e,t,i=.72){return ae(e,i)(t)}function de(e){return ne(t=>{for(let[i,n]of Object.entries(e))t(i,n)})}function he(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"item"}function ue(e,t,i){return Math.max(t,Math.min(i,e))}function ce(e){let t=Number(e);return Number.isFinite(t)?Math.max(0,t):0}function pe(e){if(0===e.length)return 0;let t=0;for(let i of e)t+=i;return t/e.length}function fe(e,t){let i=ue(t,0,1),n=e.trim().replace(/^#/,""),s=3===n.length?n.split("").map(e=>e+e).join(""):n;return/^[0-9a-fA-F]{6}$/.test(s)?`rgba(${parseInt(s.slice(0,2),16)}, ${parseInt(s.slice(2,4),16)}, ${parseInt(s.slice(4,6),16)}, ${i})`:e}function me(e){/* @__PURE__ */
|
|
2
|
+
return Sn("rect",{className:e.className,x:e.x,y:e.y,width:Math.max(0,e.width),height:Math.max(0,e.height),rx:e.radius??10,ry:e.radius??10,fill:e.fill??"none",stroke:e.stroke,strokeWidth:e.strokeWidth??1.5,strokeDasharray:e.strokeDasharray,opacity:e.opacity??.6,style:{pointerEvents:"none"}},e.keyId)}function ye(e,t=0){let i=1/0,n=1/0,s=-1/0,r=-1/0;for(let t of e){let e=t.r??0;i>t.x-e&&(i=t.x-e),t.x+e>s&&(s=t.x+e),n>t.y-e&&(n=t.y-e),t.y+e>r&&(r=t.y+e)}return Number.isFinite(i)?{x:i-t,y:n-t,width:s-i+2*t,height:r-n+2*t}:null}function xe(e,t=0){if(!e.length)return null;let i="number"==typeof t?t:t.x??0,n="number"==typeof t?t:t.y??0,s=1/0,r=1/0,o=-1/0,a=-1/0;for(let t of e){if(!(Number.isFinite(t.x)&&Number.isFinite(t.y)&&Number.isFinite(t.width)&&Number.isFinite(t.height)))continue;let e=Math.max(0,t.width),i=Math.max(0,t.height);s>t.x&&(s=t.x),r>t.y&&(r=t.y),t.x+e>o&&(o=t.x+e),t.y+i>a&&(a=t.y+i)}return Number.isFinite(s)?{x:s-i,y:r-n,width:o-s+2*i,height:a-r+2*n}:null}function ge(e){let t=e.fontSize??12;return null!=e.maxWidth&&e.text.length*t*.56>e.maxWidth?null:/* @__PURE__ */Sn("text",{className:e.className,x:e.x,y:e.y,textAnchor:e.anchor??"middle",dominantBaseline:e.baseline??"middle",fontSize:t,fontWeight:e.fontWeight,fill:e.color,style:{pointerEvents:"none"},children:e.text},e.keyId)}function be(e){let t=e.spacing??8;return{def:/* @__PURE__ */Sn("pattern",{id:e.id,width:t,height:t,patternUnits:"userSpaceOnUse",patternTransform:`rotate(${e.angle??45})`,children:/* @__PURE__ */Sn("line",{x1:0,y1:0,x2:0,y2:t,stroke:e.color??"currentColor",strokeWidth:e.strokeWidth??1,opacity:e.opacity??.5})},e.id),fill:`url(#${e.id})`}}function ve(e){let t=e.orient??"bottom",i="bottom"===t||"top"===t,n=e.offset??0,s=e.tickLength??6,r=e.gridLength??0,o=e.labelGap??4,a=e.fontSize??11,l=e.color??"var(--semiotic-text-secondary, #888)",d=e.gridColor??l,h=e.format??(e=>e+""),u="top"===t||"left"===t?-1:1,c=e.ticks.length-1,p=e.ticks.map((p,f)=>{let m,y=e.scale(p),x=n+u*s,g=n-u*r,b=x+u*o;m=e.labelAnchor?e.labelAnchor:i?e.edgeAnchor&&0===f?"start":e.edgeAnchor&&f===c?"end":"middle":"left"===t?"end":"start";let v=i?"top"===t?"auto":"hanging":"middle",w=i?{x:y,y:b}:{x:b,y:y};/* @__PURE__ */
|
|
3
|
+
return Mn("g",{children:[(s>0||r>0)&&/* @__PURE__ */Sn("line",{...i?{x1:y,x2:y,y1:x,y2:g}:{x1:x,x2:g,y1:y,y2:y},stroke:r>0?d:l,strokeWidth:1,strokeDasharray:r>0?e.gridDasharray:void 0,opacity:r>0?.7:1}),
|
|
4
|
+
/* @__PURE__ */Sn("text",{x:w.x,y:w.y,textAnchor:m,dominantBaseline:v,fontSize:a,fontWeight:e.fontWeight,fill:l,children:h(p)})]},`tick-${p}-${f}`)});/* @__PURE__ */
|
|
5
|
+
return Sn("g",{className:e.className,style:{pointerEvents:"none"},children:p},e.keyId)}function we(e){let t,i=e.stroke??"var(--semiotic-text, #f4f4f8)",n=e.strokeWidth??1,s=e.markRadius??0,r=e.labelX-e.markX,o=e.labelY-e.markY,a=Math.hypot(r,o)||1,l=e.markX+r/a*s,d=e.markY+o/a*s;return t="elbow"===e.connector?`M${l},${d} L${l},${e.labelY} L${e.labelX},${e.labelY}`:"curve"===e.connector?`M${l},${d} Q${(l+e.labelX)/2},${d} ${e.labelX},${e.labelY}`:`M${l},${d} L${e.labelX},${e.labelY}`,/* @__PURE__ */Mn("g",{className:e.className,style:{pointerEvents:"none"},children:[s>0&&/* @__PURE__ */Sn("circle",{cx:e.markX,cy:e.markY,r:s,fill:"none",stroke:i,strokeWidth:n}),
|
|
6
|
+
/* @__PURE__ */Sn("path",{d:t,fill:"none",stroke:i,strokeWidth:n}),
|
|
7
|
+
/* @__PURE__ */Sn("text",{x:e.labelX,y:e.labelY,textAnchor:e.labelAnchor??"middle",dominantBaseline:e.labelBaseline??"hanging",fontSize:e.fontSize??11,fontWeight:e.fontWeight,fill:e.color??i,children:e.label})]},e.keyId)}function Se(e){let t=e>>>0;return function(){t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}function Me(e,t){return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0}function ke(e){if(!e||"object"!=typeof e)return!1;let t=e;return"string"==typeof t.id&&(null==t.label||"string"==typeof t.label)&&"number"==typeof t.count&&Number.isFinite(t.count)&&Array.isArray(t.bodyIds)&&t.bodyIds.every(e=>"string"==typeof e)}function Ie(e,t){if("region-enter"!==t.type)return e;let i=t.region.id,n=Me(e,i),s=ke(n)?n:{id:i,label:t.region.label??i,count:0,bodyIds:[]};if(s.bodyIds.includes(t.bodyId))return e;let r=[...s.bodyIds,t.bodyId];return{...e,[i]:{...s,count:r.length,bodyIds:r}}}function Be(e,t){return(t??Object.keys(e)).map(t=>Me(e,t)).filter(ke).map(e=>({label:e.label??e.id,value:e.count}))}function Oe(e,t){let i=t instanceof Set?t:new Set(t);return e.map(e=>{let t=e.bodyIds??[],n=t.filter(e=>!i.has(e)),s=t.length-n.length,r=e.completion?.mode??"allMembersAbsorbed",o=e.completion?.valueByBodyId,a=e=>{let t=o?Me(o,e):void 0;return"number"==typeof t&&Number.isFinite(t)&&t>=0?t:1},l=t.reduce((e,t)=>e+a(t),0),d=t.reduce((e,t)=>e+(i.has(t)?a(t):0),0),h=e.completion?.threshold,u="threshold"===r?Number.isFinite(h)&&Number(h)>=0?Number(h):l:void 0;return{id:e.id,label:e.label??e.id,mode:r,complete:t.length>0&&("anyAbsorbed"===r?s>0:"threshold"===r?d>=(u??l):0===n.length),absorbed:s,total:t.length,absorbedValue:d,totalValue:l,threshold:u,missing:n}})}function Ae(e,t,i){return Math.max(t,Math.min(i,e))}function Ce(e){let t=e.reduce((e,t)=>e+(t.share??1),0);return t>0?t:e.length}function $e(e,t,i,n,s,r={}){return{id:e,friction:r.friction,restitution:r.restitution,bodyFilter:r.bodyFilter,shape:{type:"segment",x1:t,y1:i,x2:n,y2:s,thickness:r.thickness??8}}}function qe(e,t,i,n){return{type:"aabb",x:e,y:t,width:i,height:n}}function Pe(e){let t=e.shape??"lane",i=Math.max(1,Math.round(e.width)),n=Math.max(1,Math.round(e.height)),s=e.padX??46,r=e.padY??72,o=s,a=i-s,l=r,d=n-Math.max(24,Math.round(.45*r)),h=(l+d)/2,u=Math.max(1,d-l),c=Ae(e.pinchRatio??.18,.06,.5),p=Number(e.pinchHeightOffset??0),f=Number.isFinite(p)?p:0,m=Ae(u*c+f,.06*u,.5*u),y=m/2,x=h-y,g=h+y,b=e.idPrefix??"process",v=e.friction??.58,w=e.restitution??.18,S=e.wallThickness??8,M=e.stages;if(!M.length)throw Error("processStageLayout requires at least one stage");let k=Ae(e.centerStageIndex??Math.floor(M.length/2),0,M.length-1),I=Ce(M),B=a-o,O=o,A=M.map((e,t)=>{let i=O,n=t===M.length-1?a:O+(e.share??1)/I*B;return O=n,{id:e.id,label:e.label,description:e.description,kind:e.kind??"stage",index:t,x0:i,x1:n,x:(i+n)/2,width:n-i,y:h,height:u}}),C=A[k],$=C.x0,q=C.x1,P=(e,i)=>{if("lane"===t)return"top"===i?l:d;if("funnel"===t){let t=Ae((e-o)/Math.max(1,a-o),0,1);return"top"===i?l+(x-l)*t:d+(g-d)*t}if($>=e){let t=Ae((e-o)/Math.max(1,$-o),0,1);return"top"===i?l+(x-l)*t:d+(g-d)*t}if(q>=e)return"top"===i?x:g;let n=Ae((e-q)/Math.max(1,a-q),0,1);return"top"===i?x+(l-x)*n:g+(d-g)*n},N=A.map(e=>{let t=Math.min(P(e.x0,"top"),P(e.x1,"top")),i=Math.max(P(e.x0,"bottom"),P(e.x1,"bottom"));return{...e,y:(t+i)/2,height:Math.max(1,i-t)}}),F={thickness:S,friction:v,restitution:w},D=[];"lane"===t?D.push($e(b+"-top",o,l,a,l,F),$e(b+"-bottom",o,d,a,d,F),$e(b+"-left",o,l,o,d,{...F,thickness:Math.max(6,S-2)}),$e(b+"-right",a,l,a,d,{...F,thickness:Math.max(6,S)})):"funnel"===t?D.push($e(b+"-top",o,l,a,x,F),$e(b+"-bottom",o,d,a,g,F),$e(b+"-left",o,l,o,d,{...F,thickness:Math.max(6,S-2)}),$e(b+"-right",a,x,a,g,{...F,thickness:Math.max(6,S)})):D.push($e(b+"-left-top",o,l,$,x,F),$e(b+"-left-bottom",o,d,$,g,F),$e(b+"-center-top",$,x,q,x,F),$e(b+"-center-bottom",$,g,q,g,F),$e(b+"-right-top",q,x,a,l,F),$e(b+"-right-bottom",q,g,a,d,F),$e(b+"-left",o,l,o,d,{...F,thickness:Math.max(6,S-2)}),$e(b+"-right",a,l,a,d,{...F,thickness:Math.max(6,S)}));let T=e.membraneDampingScale??.5,L=o,j=Math.max(1,("bowtie"===t?$:a)-L),E=(e.membranes??[]).map(e=>{let t=L+Ae(e.offset,0,1)*j,i=e.width??18+18*e.cost,n=u-16,s=h+.25*(e.wobble??0);return{...e,x:t,y:s,width:i,height:n}}),R=!1===e.includeMembraneRegions?[]:E.map(e=>De({id:e.id,label:e.label??e.id,description:e.description??(e.label??e.id)+" is a permeable region. It taxes energy and damps velocity while bodies overlap it.",x:e.x,y:e.y,width:e.width,height:e.height,cost:e.cost,dampingScale:e.dampingScale??T,bodyStyle:e.bodyStyle,metadata:e.metadata,semanticItem:e.semanticItem,color:e.color}));return{shape:t,width:i,height:n,padX:s,padY:r,left:o,right:a,topY:l,bottomY:d,midY:h,centerLeft:$,centerRight:q,pinchHeight:m,pinchTop:x,pinchBottom:g,stages:N,membranes:E,colliders:D,regionEffects:R,boundaryY:P}}function Ne(e){return{id:e.id,label:e.label,description:e.description,kind:e.kind,shape:qe(e.x,e.y,e.width,e.height),bodyFilter:e.bodyFilter,collider:e.collider,colliderThickness:e.colliderThickness,friction:e.friction,restitution:e.restitution,semanticItem:e.semanticItem,metadata:e.metadata,bodyStyle:e.bodyStyle,attributes:e.attributes,onEnter:e.onEnter,onExit:e.onExit}}function Fe(e,t={}){let i=t.idPrefix??"stage",n=Math.max(0,t.insetX??0),s=Math.max(0,t.insetY??1);return e.stages.map(e=>{let r="function"==typeof t.metadata?t.metadata(e):t.metadata??{};return{...Ne({id:i?`${i}:${e.id}`:e.id,label:e.label??e.id,description:e.description,kind:"region",x:e.x,y:e.y,width:Math.max(1,e.width-2*n),height:Math.max(1,e.height-2*s),bodyFilter:t.bodyFilter,semanticItem:t.semanticItem,attributes:{primitive:"processStage",stageId:e.id,stageIndex:e.index},metadata:{...r,primitive:"processStage",stageId:e.id,stageIndex:e.index}})}})}function De(e){let t=e.dampingScale??.5,i=e.energyScale??1,n=Ae(e.cost,0,2);return{...Ne({...e,kind:e.kind??"membrane",attributes:{primitive:"membrane",membraneCost:n,..."object"==typeof e.attributes&&e.attributes?e.attributes:{}}}),damping:n*t,energyDelta:-n*i}}function Te(e){return{...Ne({...e,kind:e.kind??"charge-gate",attributes:{primitive:"chargeGate",..."object"==typeof e.attributes&&e.attributes?e.attributes:{}}}),charge:e.charge??!0,energyDelta:e.energyDelta,impulseOnEnter:e.impulseOnEnter}}function Le(e){let t="number"==typeof e.force?{x:e.force,y:0}:e.force??{x:12,y:0};return{...Ne({...e,kind:e.kind??"force-field",attributes:{primitive:"routeSurface",..."object"==typeof e.attributes&&e.attributes?e.attributes:{}}}),force:t,damping:e.damping??.015}}function je(e){let t=e.pressure??e.occupancy??0,i=e.baseDamping??.08,n=e.dampingPerUnit??.12,s=e.energyPerUnit??0;return{...Ne({...e,kind:e.kind??"membrane",attributes:{primitive:"pressureField",pressure:t,..."object"==typeof e.attributes&&e.attributes?e.attributes:{}}}),damping:i+t*n,energyDelta:s?-t*s:void 0,force:e.force}}function Ee(e){let t="number"==typeof e.force?{x:e.force,y:0}:e.force;return{...Ne({...e,kind:e.kind??"force-field",attributes:{primitive:"capacitatedSensor",capacity:e.capacity,unitsPerSecond:e.unitsPerSecond??e.capacity,..."object"==typeof e.attributes&&e.attributes?e.attributes:{}}}),force:t,damping:e.damping,charge:e.charge??e.capacity}}function Re(e){return{...Ne({...e,kind:e.kind??"force-field",attributes:{primitive:"portal",targetStage:e.targetStage,..."object"==typeof e.attributes&&e.attributes?e.attributes:{}}}),force:e.force,impulseOnEnter:e.impulseOnEnter,damping:e.damping??.08}}function Ye(e){let t="number"==typeof e.force?{x:e.force,y:0}:e.force??{x:24,y:0};return{...Ne({...e,kind:e.kind??"sink",attributes:{primitive:"absorb",..."object"==typeof e.attributes&&e.attributes?e.attributes:{}}}),force:t,damping:e.damping??.02,charge:e.charge??"absorbed"}}function We(e){return{...Ne({...e,kind:e.kind??"force-field",attributes:{primitive:"forceField",..."object"==typeof e.attributes&&e.attributes?e.attributes:{}}}),force:e.force,damping:e.damping,energyDelta:e.energyDelta}}function Xe(e){let t=e.x??e.anchor?.x??0,i=e.y??e.anchor?.y??0;return{id:e.id,label:e.label,description:e.description,group:e.group,bodyIds:e.bodyIds,datum:e.datum,state:e.state,x:t,y:i,width:e.width,height:e.height,anchor:e.anchor??{x:t,y:i},completion:e.completion,tether:e.tether,semanticItem:e.semanticItem}}function ze(e){let t=e.idPrefix??"lane",i={thickness:e.thickness??8,friction:e.friction??.5,restitution:e.restitution??.16},n=[$e(t+"-top",e.left,e.top,e.right,e.top,i),$e(t+"-bottom",e.left,e.bottom,e.right,e.bottom,i)];return e.openEnds||n.push($e(t+"-left",e.left,e.top,e.left,e.bottom,i),$e(t+"-right",e.right,e.top,e.right,e.bottom,i)),n}function Ge(e,t,i){return Math.max(t,Math.min(i,e))}function He(e){return 6.2*e.length}function Ke(e,t){let i=e.trim();if(t>=i.length)return i;if(1>=t)return i.slice(0,1);let n=i.split(/\s+/).filter(Boolean).map(e=>e[0]).join("").toUpperCase();return n.length>1&&t>=n.length?n:t>3?i.slice(0,Math.max(1,t-2))+"..":i.slice(0,t).toUpperCase()}function Ue(e,t,i="auto"){let n=Math.max(1,Math.floor(t/6.2)),s="compact"===i||"full"!==i&&He(e)>t?Ke(e,n):e;return{text:s,textLength:He(s)>t?Math.max(4,t):void 0}}function _e(e){return e.absorb?"absorb":e.portalTarget?"portal":null!=e.capacity?"capacity":"flow"}function Ve(e){if(null!=e.capacity){let t=null!=e.queueDepth?" · q "+e.queueDepth:"";return e.capacityLabel?`${e.capacityLabel}${t}`:`cap ${Number.isInteger(e.capacity)?e.capacity+"":e.capacity.toFixed(1)}${t}`}return e.absorb?"absorb":e.portalTarget?"portal":"flow"}function Qe(e,t={}){let{showFlowSpine:i=!0,showStageCounts:n=!0,showCapacityBadges:s=!0,showGroupSockets:r=!0,stageLabelMode:o="auto",outlineStages:a=!1,testId:l="process-flow-chrome"}=t,{width:d,height:h,left:u,right:c,topY:p,bottomY:f,midY:m,stages:y,groups:x=[]}=e,g=f-p;/* @__PURE__ */
|
|
8
|
+
return Cn("svg",{"aria-hidden":"true","data-testid":l,"data-outline-stages":a?"true":void 0,width:d,height:h,viewBox:`0 0 ${d} ${h}`,style:{position:"absolute",inset:0,pointerEvents:"none"},className:["semiotic-process-chrome",a?"semiotic-process-chrome--outline-stages":null].filter(Boolean).join(" "),children:[
|
|
9
|
+
/* @__PURE__ */An("defs",{children:/* @__PURE__ */Cn("linearGradient",{id:"semiotic-process-floor",x1:"0",x2:"0",y1:"0",y2:"1",children:[
|
|
10
|
+
/* @__PURE__ */An("stop",{offset:"0%",stopColor:"var(--semiotic-process-floor, var(--semiotic-bg, #0f172a))",stopOpacity:"0.2"}),
|
|
11
|
+
/* @__PURE__ */An("stop",{offset:"100%",stopColor:"var(--semiotic-process-lane, var(--semiotic-surface, #1e293b))",stopOpacity:"0.55"})]})}),
|
|
12
|
+
/* @__PURE__ */An("rect",{x:0,y:0,width:d,height:h,fill:"url(#semiotic-process-floor)"}),
|
|
13
|
+
/* @__PURE__ */An("rect",{x:u-6,y:p-8,width:c-u+12,height:g+16,rx:14,fill:"var(--semiotic-process-lane, var(--semiotic-surface, #111827))",fillOpacity:.45,stroke:"var(--semiotic-process-border, var(--semiotic-border, #334155))",strokeOpacity:.95}),i?/* @__PURE__ */An("line",{x1:u+8,x2:c-8,y1:m,y2:m,stroke:"var(--semiotic-process-border, var(--semiotic-border, #475569))",strokeWidth:2,strokeDasharray:"6 8",opacity:.55}):null,y.map((e,t)=>{let i=_e(e),r=$n[i],l=Math.max(12,e.width-8),d=Ge(l-8,22,88),u=Ue(e.label,Math.max(8,d-10),o),c="none"!==o&&l-8>=22,x=Ve(e),b=Ue(x,Math.max(16,l-10),"auto"),v=s&&!1!==e.showBadge&&l>=32,w=null!=e.count?`n=${e.count}${null!=e.processed?" done "+e.processed:""}`:"",S=Ue(w,Math.max(16,l-8),"auto"),M=Math.max(30,p-15),k=M-13;/* @__PURE__ */
|
|
14
|
+
return Cn("g",{"data-stage":e.id,"data-role":i,children:[
|
|
15
|
+
/* @__PURE__ */An("rect",{className:"semiotic-process-chrome__stage-bay",x:e.x0+4,y:p+6,width:l,height:g-12,rx:10,fill:a?"none":r.fill,stroke:r.stroke,strokeWidth:a?1.85:"flow"===i?1:1.6}),y.length-1>t?/* @__PURE__ */An("polygon",{points:`${e.x1-2},${m-7} ${e.x1+8},${m} ${e.x1-2},${m+7}`,fill:r.accent,opacity:.85}):null,c?/* @__PURE__ */Cn(On,{children:[
|
|
16
|
+
/* @__PURE__ */An("rect",{className:"semiotic-process-chrome__stage-label-bg",x:e.x-d/2,y:k,width:d,height:18,rx:9,fill:"var(--semiotic-bg, #0f172a)",fillOpacity:.75,stroke:r.stroke}),
|
|
17
|
+
/* @__PURE__ */Cn("text",{x:e.x,y:M,textAnchor:"middle",fill:r.accent,fontSize:10,fontWeight:800,className:"semiotic-process-chrome__stage-label",textLength:u.textLength,lengthAdjust:u.textLength?"spacingAndGlyphs":void 0,children:[
|
|
18
|
+
/* @__PURE__ */An("title",{children:e.label}),u.text]})]}):null,v?/* @__PURE__ */Cn("text",{x:e.x,y:p+22,textAnchor:"middle",fill:"var(--semiotic-process-muted, var(--semiotic-text-secondary, #94a3b8))",fontSize:9,fontWeight:700,textLength:b.textLength,lengthAdjust:b.textLength?"spacingAndGlyphs":void 0,children:[
|
|
19
|
+
/* @__PURE__ */An("title",{children:x}),b.text]}):null,n&&null!=e.count?/* @__PURE__ */Cn("text",{x:e.x,y:Math.min(h-8,f+16),textAnchor:"middle",fill:"var(--semiotic-process-text, var(--semiotic-text, #e2e8f0))",fontSize:11,fontWeight:800,textLength:S.textLength,lengthAdjust:S.textLength?"spacingAndGlyphs":void 0,children:[
|
|
20
|
+
/* @__PURE__ */An("title",{children:w}),S.text]}):null]},e.id)}),r?x.map((e,t)=>{let i=e.total??0,n=e.absorbed??0,s=e.complete??(i>0&&n>=i),r=!s&&i>0&&n/i>=.75,o=s?"rgba(52, 211, 153, 0.35)":r?"rgba(251, 191, 36, 0.28)":"rgba(15, 23, 42, 0.75)",a=s?"#34d399":r?"#fbbf24":"var(--semiotic-border, #64748b)",l=i>0?`${n}/${i}${s?" shipped":r?" almost":""}`:"feature "+(t+1),d=Ge(Math.max(54,He(e.label)+18,He(l)+16),54,104),h=Ue(e.label,d-12,"auto"),u=Ue(l,d-12,"auto");/* @__PURE__ */
|
|
21
|
+
return Cn("g",{"data-group":e.id,children:[
|
|
22
|
+
/* @__PURE__ */An("rect",{x:e.x-d/2,y:e.y-22,width:d,height:44,rx:10,fill:o,stroke:a,strokeWidth:1.5}),
|
|
23
|
+
/* @__PURE__ */Cn("text",{x:e.x,y:e.y-4,textAnchor:"middle",fill:"var(--semiotic-process-text, var(--semiotic-text, #f8fafc))",fontSize:10,fontWeight:800,textLength:h.textLength,lengthAdjust:h.textLength?"spacingAndGlyphs":void 0,children:[
|
|
24
|
+
/* @__PURE__ */An("title",{children:e.label}),h.text]}),
|
|
25
|
+
/* @__PURE__ */Cn("text",{x:e.x,y:e.y+12,textAnchor:"middle",fill:a,fontSize:9,fontWeight:700,textLength:u.textLength,lengthAdjust:u.textLength?"spacingAndGlyphs":void 0,children:[
|
|
26
|
+
/* @__PURE__ */An("title",{children:l}),u.text]})]},e.id)}):null]})}function Ze(e,t){let i="function"==typeof t?t(e):e[t];return qn(i)?i:void 0}function Je(e){return[...e].sort((e,t)=>e.localeCompare(t))}function et(e,t){let i=new Map(e.map(e=>[e,/* @__PURE__ */new Set]));for(let e of t)!i.has(e.source)||!i.has(e.target)||(i.get(e.source)?.add(e.target),i.get(e.target)?.add(e.source));return i}function tt(e){let t=new Set(e.keys()),i=[];for(;t.size>0;){let n=Je(t)[0],s=[n],r=[];for(t.delete(n);s.length>0;){let i=s.shift();r.push(i);for(let n of Je(e.get(i)??[]))t.has(n)&&(t.delete(n),s.push(n))}i.push(r.sort((e,t)=>e.localeCompare(t)))}return i.sort((e,t)=>t.length-e.length||e[0].localeCompare(t[0]))}function it(e,t,i){let n=/* @__PURE__ */new Map([[e,0]]),s=[e];for(;s.length>0;){let e=s.shift(),r=n.get(e);for(let o of Je(i.get(e)??[]))!t.has(o)||n.has(o)||(n.set(o,r+1),s.push(o))}return n}function nt(e,t,i){return[...it(e,t,i).entries()].sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0]))[0][0]}function st(e,t,i){let n=new Set(e),s=e.filter(e=>1>=(t.get(e)?.size??0))[0]??e[0],r=it(i&&n.has(i)?i:nt(nt(s,n,t),n,t),n,t),o=Math.max(0,...r.values()),a=Array.from({length:o+1},()=>[]);for(let t of e)a[r.get(t)??0].push(t);a.forEach(e=>e.sort((e,t)=>e.localeCompare(t)));let l=(e,i)=>{let n=new Map(a[i].map((e,t)=>[e,t])),s=e=>{let i=[...t.get(e)??[]].map(e=>n.get(e)).filter(e=>null!=e);return 0===i.length?1/0:i.reduce((e,t)=>e+t,0)/i.length};a[e].sort((e,t)=>s(e)-s(t)||e.localeCompare(t))};for(let e=0;4>e;e+=1){for(let e=1;a.length>e;e+=1)l(e,e-1);for(let e=a.length-2;e>=0;e-=1)l(e,e+1)}return a}function rt(e,t,i,n,s,r){let o=et(e.map(e=>e.id),t),a=tt(o),l=new Map(e.map(e=>[e.id,e.data])),d=/* @__PURE__ */new Map,h=Math.max(0,i.width),u=Math.max(0,i.height),c=Math.min(n,h/2),p=Math.min(n,u/2),f=Math.max(0,u-2*p),m=a.length>1?Math.min(s,f/a.length):0,y=Math.max(0,f-m*Math.max(0,a.length-1)),x=a.reduce((e,t)=>e+Math.sqrt(t.length),0),g=p;for(let e of a){let t=y*(Math.sqrt(e.length)/x),i=st(e,o,r),n=Math.max(0,h-2*c);i.forEach((e,s)=>{let r=1===i.length?h/2:c+s/(i.length-1)*n;e.forEach((i,n)=>{d.set(i,{id:i,x:r,y:1===e.length?g+t/2:g+n/(e.length-1)*t,data:l.get(i)})})}),g+=t+m}return d}function ot(e,t,i,n={}){let s=Math.max(0,n.padding??36),r=Math.max(0,n.componentGap??26),o=n.xAccessor??"x",a=n.yAccessor??"y",l=e.map(e=>({...e,authoredX:Ze(e.data,o),authoredY:Ze(e.data,a)})),d=l.length>0&&l.every(e=>qn(e.authoredX)&&qn(e.authoredY)),h="authored"===n.layoutMode||"automatic"!==n.layoutMode&&d,u=[];if(h&&!d&&u.push("Authored transit layout requested, but at least one station has no finite x/y position; using automatic topology layout."),!h||!d){!d&&"automatic"!==n.layoutMode&&u.push("Complete station positions were not supplied; using the deterministic automatic topology layout.");let o=rt(e,t,i,s,r,n.rootId);if("right-to-left"===n.direction)for(let e of o.values())e.x=i.width-e.x;return{positions:o,mode:"automatic",warnings:u,projectAuthoredPoint:e=>e}}let c=l.map(e=>e.authoredX),p=l.map(e=>e.authoredY),f=Math.min(...c),m=Math.max(...c),y=Math.min(...p),x=Math.max(...p),g=Math.max(1,i.width-2*s),b=Math.max(1,i.height-2*s),v=e=>({x:m===f?i.width/2:s+(e.x-f)/(m-f)*g,y:x===y?i.height/2:s+(e.y-y)/(x-y)*b}),w=/* @__PURE__ */new Map;for(let e of l){let t=v({x:e.authoredX,y:e.authoredY});w.set(e.id,{id:e.id,...t,data:e.data})}return{positions:w,mode:"authored",warnings:u,projectAuthoredPoint:v}}function at(e,t){let i=t.x-e.x,n=t.y-e.y,s=Math.abs(i),r=Math.abs(n);if(.001>s||.001>r||.001>Math.abs(s-r))return[e,t];let o=Math.sign(i),a=Math.sign(n);if(s>r){let i=(s-r)/2;return[e,{x:e.x+o*i,y:e.y},{x:t.x-o*i,y:t.y},t]}let l=(r-s)/2;return[e,{x:e.x,y:e.y+a*l},{x:t.x,y:t.y-a*l},t]}function lt(e,t){if(0===t||2>e.length)return e.map(e=>({...e}));let i=(e,t)=>{let i=t.x-e.x,n=t.y-e.y,s=Math.hypot(i,n)||1;return{x:-n/s,y:i/s}};return e.map((n,s)=>{let r=s>0?i(e[s-1],n):null,o=e.length-1>s?i(n,e[s+1]):null;if(!r||!o){let e=o??r??{x:0,y:0};return{x:n.x+e.x*t,y:n.y+e.y*t}}let a=r.x+o.x,l=r.y+o.y,d=Math.hypot(a,l);if(.001>d)return{x:n.x+o.x*t,y:n.y+o.y*t};a/=d,l/=d;let h=a*o.x+l*o.y;if(.001>Math.abs(h))return{x:n.x+o.x*t,y:n.y+o.y*t};let u=4*Math.abs(t),c=Math.max(-u,Math.min(u,t/h));return{x:n.x+a*c,y:n.y+l*c}})}function dt(e,t){if(0===e.length)return"";if(1===e.length)return`M${e[0].x},${e[0].y}`;let i=Math.max(0,t),n=`M${e[0].x},${e[0].y}`;for(let t=1;e.length-1>t;t+=1){let s=e[t-1],r=e[t],o=e[t+1],a=Math.hypot(r.x-s.x,r.y-s.y),l=Math.hypot(o.x-r.x,o.y-r.y),d=Math.min(i,a/2,l/2);if(.001>=d){n+=` L${r.x},${r.y}`;continue}let h={x:r.x+(s.x-r.x)/a*d,y:r.y+(s.y-r.y)/a*d},u={x:r.x+(o.x-r.x)/l*d,y:r.y+(o.y-r.y)/l*d};n+=` L${h.x},${h.y} Q${r.x},${r.y} ${u.x},${u.y}`}let s=e[e.length-1];return`${n} L${s.x},${s.y}`}function ht(e){let t=[e[0]];for(let i=1;e.length-1>i;i++){let n=e[i-1],s=e[i],r=e[i+1],o=Nn(n,s),a=Nn(s,r),l=Math.min(8,o/2,a/2);if(0===l)continue;let d=Pn(s,n,l/o),h=Pn(s,r,l/a);t.push(d);for(let e=1;12>=e;e++){let i=e/12;t.push(Pn(Pn(d,s,i),Pn(s,h,i),i))}}return t.push(e[e.length-1]),t.filter((e,i)=>0===i||Nn(t[i-1],e)>1e-8)}function ut(e,t,i){if(2>e.length)return"";let n=ht(e);if(2>n.length)return"";let s=[0];for(let e=1;n.length>e;e++)s.push(s[e-1]+Nn(n[e-1],n[e]));let r=s[s.length-1],o=lt(n,1),a=[1,-1].map(e=>n.map((n,a)=>Pn(n,o[a],e*(t+(i-t)*s[a]/r)/2)));return[...a[0],...a[1].reverse()].map((e,t)=>`${0===t?"M":"L"}${e.x},${e.y}`).join(" ")+" Z"}function ct(e){let t=-(e.reduce((e,t)=>e+t,0)+3*(e.length-1))/2;return e.map(e=>{let i=t+e/2;return t+=e+3,i})}function pt(e){let t="";return e.split(">").map((e,i)=>t=i?`${t}>${e}`:e)}function ft(e){let t=/* @__PURE__ */new Map;for(let i of e){let e=pt(i.signature);i.nodePath.forEach((n,s)=>{let r=e[s],o=t.get(r);o||(o={id:r,state:n,depth:s+1,signatures:/* @__PURE__ */new Set},t.set(r,o)),o.signatures.add(i.signature)})}return[...t.values()]}function mt(e,t){let i=0,n=e.length-1,s=-1;for(;n>=i;){let r=i+n>>>1;e[r].at>t?n=r-1:(s=r,i=r+1)}return 0>s?{at:t,before:0,after:0}:e[s]}function yt(e,t=0){if(0===e.length)return{adjacentClearance:[],positions:[]};let i=[],n=[0];for(let s=0;e.length-1>s;s++){let r=e[s],o=e[s+1],a=[.../* @__PURE__ */new Set([...r.map(e=>e.at),...o.map(e=>e.at)])].sort((e,t)=>e-t),l=0;for(let e of a){let t=mt(r,e),i=mt(o,e);l=Math.max(l,t.after+i.before)}i.push(l),n.push(n[n.length-1]+l+t)}return{adjacentClearance:i,positions:n}}function xt(e,t,i,n={}){let s=[...e];if(1>=s.length)return s;let r=[...s],o=i(s),a=1,l=Math.max(0,n.passes??6),d=Math.max(1,n.maxEvaluations??1/0);for(let e=0;l>e&&d>a;e++){let e=new Map(s.map((e,t)=>[e,t])),l=/* @__PURE__ */new Map,d=/* @__PURE__ */new Map;for(let i of t){let t=e.get(i.source),n=e.get(i.target);if(null==t||null==n)continue;let s=Number.isFinite(i.weight)&&i.weight>0?i.weight:1;l.set(i.source,(l.get(i.source)??0)+n*s),d.set(i.source,(d.get(i.source)??0)+s),l.set(i.target,(l.get(i.target)??0)+t*s),d.set(i.target,(d.get(i.target)??0)+s)}s=s.map((e,t)=>({item:e,index:t,barycenter:(l.get(e)??t)/(d.get(e)??1)})).sort((e,t)=>e.barycenter-t.barycenter||(n.compare?.(e.item,t.item)??e.index-t.index)).map(e=>e.item);let h=i(s);if(a++,o>h)o=h,r=[...s];else if(h===o)break}return r}function gt(e,t,i={}){let n=[...e];if(1>=n.length)return n;let s=t(n),r=1,o=Math.max(0,i.passes??6),a=Math.max(1,i.maxEvaluations??1/0);for(let e=0;o>e&&a>r;e++){let e=!1;for(let i=0;n.length-1>i&&a>r;i++){[n[i],n[i+1]]=[n[i+1],n[i]];let o=t(n);r++,s>o?(s=o,e=!0):[n[i],n[i+1]]=[n[i+1],n[i]]}if(!e)break}return n}function bt(e,t,i={}){let n=[...e],s=n.length;if(1>=s||s>(i.maxItems??8))return n;let r=Math.max(1,i.maxEvaluations??1/0),o=0,a=[...n],l=1/0,d=()=>{if(o>=r)return;let e=t(n);o++,l>e&&(l=e,a=[...n])};d();let h=Array(s).fill(0),u=0;for(;s>u&&r>o;)if(u>h[u]){let e=u%2==0?0:h[u];[n[e],n[u]]=[n[u],n[e]],d(),h[u]++,u=0}else h[u]=0,u++;return a}function vt(e,t,i=()=>!0){let n=0;for(let s=0;e.length>s;s++){let[r,o]=t(e[s]);for(let a=s+1;e.length>a;a++){if(!i(e[s],e[a]))continue;let[l,d]=t(e[a]);0>(r-l)*(o-d)&&n++}}return n}function wt(){let e=(Rn??(Rn=jn.createContext(null)),Rn);return jn.useContext(e)??Yn}function St(e,t){let i=/* @__PURE__ */new Map;for(let t of e)i.set(t.id,/* @__PURE__ */new Set);for(let e of t)i.has(e.source)||i.set(e.source,/* @__PURE__ */new Set),i.has(e.target)||i.set(e.target,/* @__PURE__ */new Set),i.get(e.source).add(e.target);return i}function Mt(e,t,i={}){let n=/* @__PURE__ */new Set,s=[...e.get(t)??[]];for(let t=0;s.length>t;t++){let i=s[t];n.has(i)||(n.add(i),s.push(...e.get(i)??[]))}return i.includeStart&&n.add(t),n}function kt(e){let t=e.fixedPosition;Number.isFinite(t?.x)&&(e.x=e.prevX=t.x,e.vx=0),Number.isFinite(t?.y)&&(e.y=e.prevY=t.y,e.vy=0)}function It(e){if(!e)return;let t=Number.isFinite(e.x)?e.x:void 0,i=Number.isFinite(e.y)?e.y:void 0;return null==t&&null==i?void 0:{x:t,y:i}}function Bt(e,t,i){let n,s="x"===i?"y":"x",r=Math.abs(t[i]-e[i]),o=t[s]-e[s],a=(e,t)=>"circle"===e.shape.type?e.shape.radius:("x"===t?e.shape.width:e.shape.height)/2;if("circle"===e.shape.type&&"circle"===t.shape.type){let i=e.shape.radius+t.shape.radius;n=Math.sqrt(Math.max(0,i*i-r*r))}else if("aabb"===e.shape.type&&"aabb"===t.shape.type)n=a(e,s)+a(t,s);else{let o="aabb"===e.shape.type?e:t,l=a("circle"===e.shape.type?e:t,i),d=Math.max(0,r-a(o,i));n=a(o,s)+Math.sqrt(Math.max(0,l*l-d*d))}let l=0>o?-1:1;return{nx:"x"===s?l:0,ny:"y"===s?l:0,penetration:Math.max(0,n-Math.abs(o))}}function Ot(e){return"circle"===e.type?{type:"circle",radius:e.radius}:{type:"aabb",width:e.width,height:e.height}}function At(e){return"aabb"===e.type?{type:"aabb",x:e.x,y:e.y,width:e.width,height:e.height}:{type:"segment",x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,thickness:e.thickness}}function Ct(e){return{id:e.id,x:e.x,y:e.y,prevX:e.prevX,prevY:e.prevY,vx:e.vx,vy:e.vy,angle:e.angle,mass:e.mass,bodyCollisions:e.bodyCollisions,...e.fixedPosition?{fixedPosition:It(e.fixedPosition)}:{},shape:Ot(e.shape),sleeping:e.sleeping,datum:e.datum,index:e.index,sleepTime:e.sleepTime,restitution:e.restitution,friction:e.friction}}function $t(e){return e&&"function"!=typeof e?{property:e.property,equals:e.equals,notEquals:e.notEquals,oneOf:e.oneOf?.slice(),notOneOf:e.notOneOf?.slice()}:e}function qt(e){return{id:e.id,shape:At(e.shape),sensor:e.sensor,restitution:e.restitution,friction:e.friction,bodyFilter:$t(e.bodyFilter),index:e.index}}function Pt(e,t,i){return Math.max(t,Math.min(i,e))}function Nt(e,t,i){return Math.min(e??i,t??i)}function Ft(e,t,i){return Pt(Math.max(e??i,t??i),0,1)}function Dt(e){return 0>e?-1:1}function Tt(e){if("circle"===e.shape.type){let t=e.shape.radius;return{minX:e.x-t,minY:e.y-t,maxX:e.x+t,maxY:e.y+t}}let t=e.shape.width/2,i=e.shape.height/2;return{minX:e.x-t,minY:e.y-i,maxX:e.x+t,maxY:e.y+i}}function Lt(e){let t=e.shape;if("aabb"===t.type){let e=t.width/2,i=t.height/2;return{minX:t.x-e,minY:t.y-i,maxX:t.x+e,maxY:t.y+i}}let i=(t.thickness??0)/2;return{minX:Math.min(t.x1,t.x2)-i,minY:Math.min(t.y1,t.y2)-i,maxX:Math.max(t.x1,t.x2)+i,maxY:Math.max(t.y1,t.y2)+i}}function jt(e,t){return!(e.minX>t.maxX||t.minX>e.maxX||e.minY>t.maxY||t.minY>e.maxY)}function Et(e,t,i,n,s,r){let o=n-e,a=s-t,l=i+r,d=o*o+a*a;if(d>=l*l)return null;if(Xn>=d)return{nx:1,ny:0,penetration:l};let h=Math.sqrt(d);return{nx:o/h,ny:a/h,penetration:l-h}}function Rt(e,t,i,n,s,r,o,a){let l=s-e,d=(i+o)/2-Math.abs(l);if(0>=d)return null;let h=r-t,u=(n+a)/2-Math.abs(h);return u>0?u>d?{nx:Dt(l),ny:0,penetration:d}:{nx:0,ny:Dt(h),penetration:u}:null}function Yt(e,t,i,n,s,r,o){let a=r/2,l=o/2,d=e-Pt(e,n-a,n+a),h=t-Pt(t,s-l,s+l),u=d*d+h*h;if(u>i*i)return null;if(Xn>=u){let r=Math.abs(e-(n-a)),o=Math.abs(e-(n+a)),d=Math.abs(t-(s-l)),h=Math.abs(t-(s+l)),u=Math.min(r,o,d,h);return u===r?{nx:-1,ny:0,penetration:i+r}:u===o?{nx:1,ny:0,penetration:i+o}:u===d?{nx:0,ny:-1,penetration:i+d}:{nx:0,ny:1,penetration:i+h}}let c=Math.sqrt(u);return{nx:d/c,ny:h/c,penetration:i-c}}function Wt(e,t,i,n,s,r,o,a=0){let l=r-n,d=o-s,h=l*l+d*d,u=h>Xn?Pt(((e-n)*l+(t-s)*d)/h,0,1):0,c=i+a/2,p=e-(n+l*u),f=t-(s+d*u),m=p*p+f*f;if(m>=c*c)return null;if(Xn>=m){let e=Math.sqrt(h);return e>Xn?{nx:-d/e,ny:l/e,penetration:c}:{nx:1,ny:0,penetration:c}}let y=Math.sqrt(m);return{nx:p/y,ny:f/y,penetration:c-y}}function Xt(e,t){if("circle"===e.shape.type&&"circle"===t.shape.type)return Et(e.x,e.y,e.shape.radius,t.x,t.y,t.shape.radius);if("aabb"===e.shape.type&&"aabb"===t.shape.type)return Rt(e.x,e.y,e.shape.width,e.shape.height,t.x,t.y,t.shape.width,t.shape.height);if("circle"===e.shape.type&&"aabb"===t.shape.type){let i=Yt(e.x,e.y,e.shape.radius,t.x,t.y,t.shape.width,t.shape.height);return i?{nx:-i.nx,ny:-i.ny,penetration:i.penetration}:null}return"aabb"===e.shape.type&&"circle"===t.shape.type?Yt(t.x,t.y,t.shape.radius,e.x,e.y,e.shape.width,e.shape.height):null}function zt(e,t){let i=t.shape;return"aabb"===i.type?"circle"===e.shape.type?Yt(e.x,e.y,e.shape.radius,i.x,i.y,i.width,i.height):Rt(i.x,i.y,i.width,i.height,e.x,e.y,e.shape.width,e.shape.height):Wt(e.x,e.y,"circle"===e.shape.type?e.shape.radius:Math.sqrt(e.shape.width*e.shape.width+e.shape.height*e.shape.height)/2,i.x1,i.y1,i.x2,i.y2,i.thickness??0)}function Gt(e,t){return`${e}\0${t}`}function Ht(e){let t=e.indexOf("\0");return{sensorId:e.slice(0,t),bodyId:e.slice(t+1)}}function Kt(e,t){if(!t)return;let i=e;for(let e of t.split(".")){if(null==i||"object"!=typeof i||!Object.prototype.hasOwnProperty.call(i,e))return;i=i[e]}return i}function Ut(e,t){return!!t?.some(t=>Object.is(e,t))}function _t(e,t){if(!t)return!0;if("function"==typeof t)return t(e);let i=Kt(e,t.property);return!("equals"in t&&!Object.is(i,t.equals)||"notEquals"in t&&Object.is(i,t.notEquals)||t.oneOf&&!Ut(i,t.oneOf)||t.notOneOf&&Ut(i,t.notOneOf))}function Vt(e,t){return _t(t,e.bodyFilter)}function Qt(e,t){if(!Number.isFinite(t))return;e.count+=1,e.total+=t,e.min=Math.min(e.min,t),e.max=Math.max(e.max,t);let i=t-e.mean;e.mean+=i/e.count,e.m2+=i*(t-e.mean)}function Zt(e){return{count:e.count,total:e.total,mean:e.count>0?e.mean:0,min:e.count>0?e.min:0,max:e.count>0?e.max:0,variance:e.count>1?e.m2/(e.count-1):0}}function Jt(e){return{count:e.count,total:e.total,mean:e.mean,m2:e.variance*Math.max(0,e.count-1),min:e.count>0?e.min:1/0,max:e.count>0?e.max:-1/0}}function ei(e,t){if(null!=e[t])return e[t];let i=e.datum;return i&&"object"==typeof i?i[t]:void 0}function ti(e,t,i){return"function"==typeof e?e(t,i):"string"==typeof e?ei(t,e):void 0}function ii(e,t,i){if("number"==typeof e)return e;let n="function"==typeof e?e(t,i):"string"==typeof e?ei(t,e):1,s="number"==typeof n?n:Number(n);return Number.isFinite(s)?s:1}function ni(e){if(null==e)return;let t=e+"";return t.trim()?t:void 0}function si(e){for(let t of Hn){let i=ni(ei(e,t));if(i)return i}return"sediment"}function ri(e){let t=Zt(e.value);return{id:e.id,label:e.label,count:t.count,total:t.total,bodyIds:e.bodyIds.slice(),lastBodyId:e.lastBodyId,lastDatum:e.lastDatum,x:Zt(e.x),y:Zt(e.y),value:t}}function oi(e,t={}){let{baselineY:i=0,binWidth:n=24,gap:s=2,maxHeight:r=80,value:o="count",x:a}=t,l=e.reduce((e,t)=>Math.max(e,t[o]),1);return e.map((e,t)=>{let d=Math.max(0,e[o]/l*r),h=a?.(e,t)??t*(n+s);return{binId:e.id,label:e.label,index:t,count:e.count,total:e.total,x:h,y:i-d,width:n,height:d,meanX:e.x.mean,meanY:e.y.mean}})}function ai(e={},t=_n){return{chartId:e.chartId??t.chartId,chartType:e.chartType??t.chartType,sensors:e.sensors??t.sensors,onObservation:e.onObservation??t.onObservation,onSimulationStateChange:e.onSimulationStateChange??t.onSimulationStateChange}}function li(e){return{...e,shape:{...e.shape},...e.fixedPosition?{fixedPosition:{...e.fixedPosition}}:{},datum:e.datum,springs:e.springs?.map(e=>({...e,target:{...e.target}}))}}function di(e){if(e instanceof Date){let t=e.getTime();return Number.isFinite(t)?t:void 0}let t="number"==typeof e?e:"string"==typeof e&&e.trim()?Number(e):NaN;return Number.isFinite(t)?t:void 0}function hi(e,t){if(null!=e[t])return e[t];let i=e.datum;return i&&"object"==typeof i?i[t]:void 0}function ui(e,t,i){return"function"==typeof i?di(i(e,t)):"string"==typeof i?di(hi(e,i)):di(e.spawnAt)??di(hi(e,"arrivalTime"))??di(hi(e,"timestamp"))??di(hi(e,"time"))??di(hi(e,"eventTime"))}function ci(e,t={}){let i=di(t.startAt)??0,n=t.pacing??"immediate";if("arrival"===n){let n=1/0,s=e.map((e,i)=>{let s=ui(e,i,t.timeAccessor);return null!=s&&(n=Math.min(n,s)),s}),r=di(t.timeScale)??1,o=r>0?r:1;return e.map((e,t)=>{let r=s[t],a=null==r?0:Math.max(0,r-n);return{...li(e),spawnAt:i+a/o}})}if("object"==typeof n){let t=di(n.ratePerSec);if(t&&t>0)return e.map((e,n)=>({...li(e),spawnAt:i+n/t}))}return e.map(e=>({...li(e),spawnAt:i}))}function pi(e){return{...li(e),sequence:e.sequence,spawnAt:e.spawnAt}}function fi(e){return e.map(e=>({...e,shape:{...e.shape},bodyFilter:e.bodyFilter&&"function"!=typeof e.bodyFilter?{...e.bodyFilter,oneOf:e.bodyFilter.oneOf?.slice(),notOneOf:e.bodyFilter.notOneOf?.slice()}:e.bodyFilter}))}function mi(e){return!1!==e&&{...e}}function yi(e,t){return e.spawnAt===t.spawnAt?e.sequence-t.sequence:e.spawnAt-t.spawnAt}function xi(e){return{...e,gravity:{...e.gravity}}}function gi(e,t,i,n){if("circle"===e.shape.type){let s=e.x-t,r=e.y-i,o=e.shape.radius+n,a=s*s+r*r;return a>o*o?null:a}let s=Math.max(Math.abs(t-e.x)-e.shape.width/2,0),r=Math.max(Math.abs(i-e.y)-e.shape.height/2,0),o=s*s+r*r;return o>n*n?null:o}function bi(e,t){return`${e}\0${t}`}function vi(e){let t=e.indexOf("\0");return{sensorId:e.slice(0,t),bodyId:e.slice(t+1)}}function wi(e,t={}){let{idPrefix:i="plot",includeFloor:n=!0,includeCeiling:s=!1,includeLeftWall:r=!0,includeRightWall:o=!0,wallThickness:a=20,floorThickness:l=a}=t,d=[],h=e.x+e.width/2,u=e.y+e.height/2;return n&&d.push({id:i+"-floor",shape:{type:"aabb",x:h,y:e.y+e.height+l/2,width:e.width+2*a,height:l}}),s&&d.push({id:i+"-ceiling",shape:{type:"aabb",x:h,y:e.y-l/2,width:e.width+2*a,height:l}}),r&&d.push({id:i+"-left-wall",shape:{type:"aabb",x:e.x-a/2,y:u,width:a,height:e.height+2*l}}),o&&d.push({id:i+"-right-wall",shape:{type:"aabb",x:e.x+e.width+a/2,y:u,width:a,height:e.height+2*l}}),d}function Si(e){let{idPrefix:t="bin",count:i,domainStart:n,domainStep:s,xScale:r,yTop:o,yBottom:a,wallThickness:l=4,includeBoundaryWalls:d=!0,includeInteriorWalls:h=!0,closedBefore:u,lidY:c=o,lidThickness:p=Math.max(2,l)}=e,f=[],m=o+(a-o)/2,y=Math.abs(a-o),x=d?i:i-1;if(h||d)for(let e=d?0:1;x>=e;e+=1){if(!h&&e>0&&i>e)continue;let o=r(n+e*s);f.push({id:`${t}-wall-${e}`,shape:{type:"aabb",x:o,y:m,width:l,height:y}})}if(null!=u)for(let e=0;i>e;e+=1){let i=n+e*s,o=i+s;if(o>=u)continue;let a=r(i),d=r(o);f.push({id:`${t}-lid-${e}`,shape:{type:"segment",x1:Math.min(a,d)+l/2,y1:c,x2:Math.max(a,d)-l/2,y2:c,thickness:p}})}return f}function Mi(e={}){return new Vn(e)}function ki(e,t={}){return e?"function"==typeof e?e(t):(e.init(t),e):Mi(t)}function Ii(e){let t=Number(e);if(Number.isFinite(t)&&t>0)return Math.floor(t)}function Bi(e,t,i){if(!1===i)return;let n=Ii(i?.warnAt);return null!=n?n:null!=e?Math.max(1,Math.floor(.8*e)):null!=t?Math.max(1,Math.floor(.8*t)):void 0}function Oi(e){let t=Math.max(0,Math.floor(e.liveBodies)),i=Math.max(0,Math.floor(e.queuedBodies??0)),n=t+i,s=Ii(e.bodyLimit),r=Ii(e.engineMaxBodiesHint),o=Bi(s,r,e.options),a=null==s?0:Math.max(0,t-s),l=a>0?"overflow":null==o||o>n?"ok":"warning";return{action:"overflow"!==l?"continue":e.sedimentEnabled?"sediment":e.evictionEnabled?"evict":"retain",bodyLimit:s,engineMaxBodiesHint:r,liveBodies:t,overflow:a,projectedBodies:n,queuedBodies:i,state:l,warnAt:o}}function Ai(e,t){let i={...e};for(let e of t)i[Qn[e]]++;return i}function Ci(e,t,i){let n=new Set(t);return{changeSet:{...e,...e.keys?{keys:[...e.keys]}:{}},changed:n,revisions:Ai(i,n)}}function $i(e){let t="preserve",i=/* @__PURE__ */new Set;for(let n of e){let e=ls[n]??ds;"rebuild"===e.retainedData&&(t="rebuild");for(let t of e.invalidations)i.add(t)}return{retainedData:t,invalidations:i}}function qi(e,t){return e===t||!(!e||!t||e.gravity?.x!==t.gravity?.x||e.gravity?.y!==t.gravity?.y)&&hs.every(i=>e[i]===t[i])}function Pi(e,t){return Object.keys(e).filter(i=>"kernel"===i?!qi(e.kernel,t.kernel):e[i]!==t[i])}function Ni(e,t,i){if(0===t.length)return;let n=new Map(e.readState().map(e=>[e.id,e]));for(let e of t){if("sleep"!==e.type)continue;let t=n.get(e.bodyId);i.emit({type:"physics-settle",timestamp:i.elapsedSeconds,chartType:i.observation.chartType,chartId:i.observation.chartId,bodyId:e.bodyId,datum:t?.datum,x:t?.x,y:t?.y})}}function Fi(e,t,i){let n=new Set(e.activeSensorPairs().map(e=>bi(e.sensorId,e.bodyId)));if(0===n.size&&0===t.size)return n;let s=new Map(e.readState().map(e=>[e.id,e])),r=(e,t)=>{let{sensorId:n,bodyId:r}=vi(t),o=i.observation.sensors[n],a=s.get(r);i.emit({type:"enter"===e?o?.enterType??"physics-bin-enter":o?.exitType??"physics-bin-exit",timestamp:i.elapsedSeconds,chartType:i.observation.chartType,chartId:i.observation.chartId,bodyId:r,datum:a?.datum,x:a?.x,y:a?.y,sensorId:n,binId:o?.binId??n})};for(let e of Array.from(n).sort())t.has(e)||r("enter",e);for(let e of Array.from(t).sort())n.has(e)||r("exit",e);return n}function Di(e,t){for(let i of e)t.has(vi(i).bodyId)&&e.delete(i)}function Ti(e,t,i,n){return e||!t?"paused":i||!n?"running":"settled"}function Li(e,t,i){i.observation.onSimulationStateChange?.(t,e),("running"===t||"settled"===t)&&i.emit({type:"running"===t?"sim-active":"sim-idle",timestamp:i.elapsedSeconds,chartType:i.observation.chartType,chartId:i.observation.chartId,simulationState:t,previousSimulationState:e})}function ji(e,t){t.emit({type:"overflow"===e.state?"physics-budget-overflow":"physics-budget-warning",timestamp:t.elapsedSeconds,chartType:t.observation.chartType,chartId:t.observation.chartId,budgetAction:e.action,bodyLimit:e.bodyLimit,engineMaxBodiesHint:e.engineMaxBodiesHint,liveBodies:e.liveBodies,overflow:e.overflow,projectedBodies:e.projectedBodies,queuedBodies:e.queuedBodies,warnAt:e.warnAt})}function Ei(e,t,i){if("sleeping-first"!==t)return i.slice();let n=new Map(e.readState().map(e=>[e.id,e.sleeping])),s=[],r=[];for(let e of i)n.get(e)?s.push(e):r.push(e);return[...s,...r]}function Ri(e,t,i,n){let s=new Map(e.readState().map(e=>[e.id,e])),r=[];for(let e of i){let i=s.get(e);if(!i)continue;let o=t.add(i);o&&(r.push(e),n.emit({type:"physics-sediment",timestamp:n.elapsedSeconds,chartType:n.observation.chartType,chartId:n.observation.chartId,bodyId:e,datum:i.datum,x:i.x,y:i.y,binId:o.id,count:o.count,total:o.total}))}return r}function Yi(e,t,i,n,s,r){let o={evicted:[],sedimented:[],liveBodyOrder:s};if(!1===i)return o;let a=Math.max(0,Math.floor(n));if(!Number.isFinite(a))return o;let l=s.length-a;if(0>=l)return o;let d=Ei(e,i,s).slice(0,l);if(0===d.length)return o;let h=Ri(e,t,d,r);e.remove(d);let u=new Set(d);return{evicted:d,sedimented:h,liveBodyOrder:s.filter(e=>!u.has(e))}}function Wi(e){let t=e?.sleepSpeed;return"number"==typeof t&&Number.isFinite(t)&&t>0?t:8}function Xi(e,t){if(!e)return;let i=["spawned","evicted","sedimented","events","observations"],n={spawned:0,evicted:0,sedimented:0,events:0,observations:0},s=s=>{let r=t(s),o={...r,spawned:r.spawned.slice(n.spawned),evicted:r.evicted.slice(n.evicted),sedimented:r.sedimented.slice(n.sedimented),events:r.events.slice(n.events),observations:r.observations.slice(n.observations)};for(let e of i)n[e]=r[e].length;e.onStep(o)};return s(0),()=>s(1)}function zi(e,t,i,n={}){let s,r=0;for(;t>r&&!n.shouldStop?.()&&(!1===n.stopAtRest||e.queueSize()>0||!e.atRest()||n.continueWhile?.());){e.step(e.fixedDt),e.advanceTime(e.fixedDt);let t=e.drainEvents();i.events&&(i.events.push(...t),e.observeKernelEvents(t,i.observations),e.observeSensorTransitions(i.observations));let o=[];if(e.spawnDue(o,i.observations),o.length>0){i.spawned.push(...o),s=e.observeBodyBudget(i.observations);let t=e.evictOverflow(i.observations);i.evicted?.push(...t.evicted),i.sedimented?.push(...t.sedimented)}r+=1,e.refreshQuiescence(e.fixedDt,o.length),n.afterStep?.()}return{steps:r,budget:s}}function Gi(e,t,i){if(i.some(e=>null!=e.__forceRadius))return e=>e.__forceRadius??8;if(null==e)return()=>8;if("number"==typeof e)return()=>e;if("function"==typeof e)return t=>e(t)||8;let n=t||[5,20],s=[];for(let t of i){let i=t.data?.[e];"number"==typeof i&&s.push(i)}if(0===s.length)return()=>n[0];let[r,o]=Hi(s);if(r===o)return()=>(n[0]+n[1])/2;let a=ps().domain([r,o]).range(n).clamp(!0);return t=>{let i=t.data?.[e];return null==i||"number"!=typeof i?n[0]:a(i)}}import{a as Hi,c as Ki}from"./c-3PFVJFBK.min.js";import{symbol as Ui,symbolCircle as _i,symbolCross as Vi,symbolDiamond as Qi,symbolSquare as Zi,symbolStar as Ji,symbolTriangle as en,symbolWye as tn}from"d3-shape";var nn={circle:_i,square:Zi,triangle:en,diamond:Qi,star:Ji,cross:Vi,wye:tn},sn=/* @__PURE__ */new Set(["circle","square","triangle","diamond","star","cross","wye","chevron"]),rn=["circle","triangle","diamond","star","square","chevron","cross","wye"],on=/* @__PURE__ */new Map,an=[40,40],ln=[.5,.5],dn=new Set(["label","callout","callout-circle","callout-rect","text","widget"]),hn=(new Set(["label","callout","callout-circle","callout-rect"]),2e4),un=32,cn=6,pn=4,fn=8,mn=72,yn={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};import{interpolateRgb as xn}from"d3-interpolate";var gn=864e5,bn=e=>{let t=e.config,{plot:i}=e.dimensions;if(0>=i.width||0>=i.height)return{nodes:[]};let n=e=>{let i="function"==typeof t.dateAccessor?t.dateAccessor(e):e[t.dateAccessor];return i instanceof Date?i:new Date(i)},s=e=>{let i="function"==typeof t.valueAccessor?t.valueAccessor(e):e[t.valueAccessor];return Number(i)},r=/* @__PURE__ */new Map,o=null;for(let t of e.data){let e=n(t);if(!isFinite(e.getTime()))continue;null==o&&(o=e.getUTCFullYear());let i=Q(e),a=s(t);r.set(i,(r.get(i)??0)+(Number.isFinite(a)?a:0))}let a=t.year??o??/* @__PURE__ */(new Date).getUTCFullYear(),l=1/0,d=-1/0;for(let e of r.values())l>e&&(l=e),e>d&&(d=e);l===1/0&&(l=0,d=0);let[h,u]=t.colorRamp??[e.theme.semantic.surface??"#ebedf0",e.theme.semantic.primary??"#216e39"],c=e=>{if(d===l)return h;let t=(e-l)/(d-l);return xn(h,u)(t)},p=t.gutter??2,f=t.labelInset??0,m=Math.min((i.width-f-53*p)/54,(i.height-6*p)/7);if(0>=m)return{nodes:[]};let y=new Date(Date.UTC(a,0,1)),x=y.getUTCDay(),g=new Date(y.getTime()-x*gn),b=[];for(let e=0;54>e;e++)for(let t=0;7>t;t++){let n=new Date(g.getTime()+(7*e+t)*gn);if(n.getUTCFullYear()!==a)continue;let s=Q(n),o=r.get(s),l=null==o?h:c(o);b.push({type:"rect",x:i.x+f+e*(m+p),y:i.y+t*(m+p),w:m,h:m,style:{fill:l,stroke:"none"},datum:{date:n,value:o??0}})}return{nodes:b}};import{interpolateLab as vn}from"d3-interpolate";var wn=class{constructor(e=12){this.maxSize=e,this.store=/* @__PURE__ */new Map}get(e){return this.store.get(e)}set(e,t){this.store.size>=this.maxSize&&this.store.clear(),this.store.set(e,t)}getOrCompute(e,t){let i=this.store.get(e);if(void 0!==i)return i;let n=t();return this.set(e,n),n}clear(){this.store.clear()}get size(){return this.store.size}};import{jsx as Sn,jsxs as Mn}from"react/jsx-runtime";import*as kn from"react";import{scaleLinear as In}from"d3-scale";var Bn=e=>{let t=e.config,{plot:i}=e.dimensions,n=t.fields??[];if(2>n.length||0>=i.width||0>=i.height)return{nodes:[]};if(0===e.data.length)return{nodes:[]};let s=/* @__PURE__ */Object.create(null);for(let i of n){let n=t.domains&&Object.prototype.hasOwnProperty.call(t.domains,i)?t.domains[i]:void 0;if(Array.isArray(n)&&n.length>=2&&"number"==typeof n[0]&&Number.isFinite(n[0])&&"number"==typeof n[1]&&Number.isFinite(n[1])){s[i]=[n[0],n[1]];continue}let r=1/0,o=-1/0;for(let t of e.data){let e=Number(t[i]);Number.isFinite(e)&&(r>e&&(r=e),e>o&&(o=e))}if(Number.isFinite(r)&&Number.isFinite(o))if(r===o){let e=Math.max(.01*Math.abs(r),.5);s[i]=[r-e,o+e]}else s[i]=[r,o];else s[i]=[0,1]}let r=!1!==t.showAxes,o=r?t.axisLabelPadding??24:8,a=r?18:8,l=n.map(e=>In().domain(s[e]).range([i.y+i.height-a,i.y+o])),d=n.map((e,t)=>1===n.length?i.x+i.width/2:i.x+t/(n.length-1)*i.width),h=t.colorBy?"function"==typeof t.colorBy?t.colorBy:e=>(e[t.colorBy]??"")+"":null,u=t.opacity??.45,c=t.strokeWidth??1.25,p=e.theme.semantic.primary??"#3b6cb1",f=t.dimmedOpacity??.08,m=t.highlightFn,y=[],x=[];for(let i of e.data){let s=h?e.resolveColor(h(i)+""):p,r=!m||m(i),o=re(i,{predicate:m,baseOpacity:u,dimOpacity:f,brighten:.4}),a=r?x:y;for(let e=0;n.length-1>e;e++){let t=Number(i[n[e]]),h=Number(i[n[e+1]]);if(!Number.isFinite(t)||!Number.isFinite(h))continue;let u={type:"connector",x1:d[e],y1:l[e](t),x2:d[e+1],y2:l[e+1](h),style:{stroke:s,strokeWidth:m&&r?c+.75:c,opacity:o,fill:"none"},datum:i};a.push(u)}if(t.showPoints)for(let e=0;n.length>e;e++){let t=Number(i[n[e]]);if(!Number.isFinite(t))continue;let r={type:"point",x:d[e],y:l[e](t),r:2.5,style:{fill:s,stroke:"none",opacity:Math.min(1,o+.3)},datum:i};a.push(r)}}let g=null;if(r){let r=`var(--semiotic-border, ${e.theme.semantic.border??"#aaa"})`,h=`var(--semiotic-text, ${e.theme.semantic.text??"currentColor"})`,u=`var(--semiotic-text-secondary, ${e.theme.semantic.textSecondary??"#888"})`,c=i.y+o,p=i.y+i.height-a,f=[];for(let e=0;n.length>e;e++){let a=n[e],m=d[e],y=t.tickFormat&&Object.prototype.hasOwnProperty.call(t.tickFormat,a)?t.tickFormat[a]:void 0,x="function"==typeof y?y:e=>e.toLocaleString();f.push(kn.createElement("line",{key:"pc-axis-line-"+e,x1:m,x2:m,y1:c,y2:p,stroke:r,strokeWidth:1})),f.push(ge({keyId:"pc-axis-label-"+e,text:a,x:m,y:i.y+o-8,anchor:"middle",baseline:"auto",fontSize:12,fontWeight:600,color:h}));let[g,b]=s[a],v=5;for(let t=0;v>t;t++){let i=g+(b-g)*t/(v-1),n=l[e](i);f.push(kn.createElement("line",{key:`pc-tick-${e}-${t}`,x1:m-3,x2:m+3,y1:n,y2:n,stroke:r,strokeWidth:1}),ge({keyId:`pc-ticktext-${e}-${t}`,text:x(i),x:m+6,y:n+3,anchor:"start",baseline:"auto",fontSize:10,color:u}))}}g=kn.createElement(kn.Fragment,null,...f)}return{nodes:y.concat(x),overlays:g}};import{Fragment as On,jsx as An,jsxs as Cn}from"react/jsx-runtime";var $n={flow:{fill:"rgba(59, 130, 246, 0.14)",stroke:"rgba(96, 165, 250, 0.7)",accent:"#60a5fa"},capacity:{fill:"rgba(251, 146, 60, 0.18)",stroke:"rgba(251, 146, 60, 0.85)",accent:"#fb923c"},portal:{fill:"rgba(244, 114, 182, 0.14)",stroke:"rgba(244, 114, 182, 0.7)",accent:"#f472b6"},absorb:{fill:"rgba(52, 211, 153, 0.18)",stroke:"rgba(52, 211, 153, 0.8)",accent:"#34d399"}},qn=e=>"number"==typeof e&&Number.isFinite(e),Pn=(e,t,i)=>({x:e.x+(t.x-e.x)*i,y:e.y+(t.y-e.y)*i}),Nn=(e,t)=>Math.hypot(t.x-e.x,t.y-e.y),Fn={viewBox:[24,24],parts:[{d:"M5,0 H19 Q24,0 24,5 V19 Q24,24 19,24 H5 Q0,24 0,19 V5 Q0,0 5,0 Z",stroke:"accent"}]},Dn=(e,t)=>e.stepEntityCounts?.[t]??e.entityCount,Tn=({datum:e},t)=>({opacity:!t?.isActive||t.predicate(e)||null!=e?.fromNodeId&&t.predicate({...e,nodeId:e.fromNodeId})?1:.2}),Ln=e=>{let t=e.config.braid,i=e.dimensions.plot,n=t.atlas.spec.comparison?.partitions??[...new Set(t.groups.map(e=>e.partition))],s=t.groups.filter(e=>n.includes(e.partition)&&e.nodePath.length>0),r=[],o=[],a=[];if(0===s.length)return{sceneNodes:o,sceneEdges:r,labels:a};let l=new Set(s.map(e=>e.signature)),d=[...t.signatureOrder.filter(e=>l.delete(e)),...l],h=new Map(d.map((e,t)=>[e,t])),u=[...s].sort((e,t)=>h.get(e.signature)-h.get(t.signature)),c=n.map(e=>u.filter(t=>t.partition===e)),p=ft(u),f=Ki(p.map(e=>e.depth)),m=s.map(e=>Ki(e.stepEntityCounts??[e.entityCount])),y=Ki(m),x=e=>e>0?Math.max(1,10*e/y):0,g=new Map(s.map((e,t)=>[e.id,x(m[t])])),b=i.height/n.length,{semantic:v}=e.theme,w=(e,t,i,n={})=>a.push({x:e,y:t,text:i,fill:v.text??"#333",fontSize:10,anchor:"middle",...n}),S={sourceRevision:t.atlas.provenance.sourceRevision,analysisRevision:t.atlas.analysisRevision,relationScopeId:"directed-admitted"},M=new Map(p.map(e=>{let t=c.map(t=>t.reduce((t,i)=>t+(e.signatures.has(i.signature)?g.get(i.id)+3:0),5));return[e.id,Ki(t,24)]})),k=Ki([...M.values()],24),I=Math.min(i.width/4,k/2+16),B=(i.width-2*I)/Math.max(f-1,1),O=e=>i.x+I+(e-1)*B,A=48+k/2,C=22+k/2,$=(e,t)=>e+A+(h.get(t)+.5)*Math.max(0,b-A-C)/d.length,q=(t,i,n,s,o)=>{let a=Dn(i,s),l=Dn(i,o),d=x(a),h=x(l);if(0===d&&0===h)return;let u=d!==h,c=e.resolveColor(i.signature);r.push({type:"curved",id:n,pathD:u?ut(t,d,h):dt(t,8),style:{fill:u?c:"none",fillOpacity:1,stroke:u?"none":c,strokeWidth:u?0:d},datum:{...S,id:n,kind:"braid-track",nodeId:i.nodePath[o],fromNodeId:i.nodePath[s],groupId:i.id,signature:i.signature,partition:i.partition,entityCount:i.entityCount,fromStep:s,toStep:o,fromCount:a,toCount:l,falseRoot:!1},accessibleDatum:{journey:i.nodePath.join(" → "),partition:i.partition??"all",fromStep:s+1,toStep:o+1,fromCount:a,toCount:l}})};return n.forEach((e,t)=>{let n=i.y+t*b,s=c[t];if(e&&w(i.x+8,n+14,e,{fontSize:12,fontWeight:600,anchor:"start"}),0===s.length)return;for(let e=1;f>=e;e++)w(O(e),n+34,"Step "+e);let r=/* @__PURE__ */new Map;for(let t of p){let i=s.filter(e=>t.signatures.has(e.signature));if(0===i.length)continue;let a=O(t.depth),l=pe([...t.signatures].map(e=>$(n,e))),d=ct(i.map(e=>g.get(e.id)));r.set(t.id,new Map(i.map((e,t)=>[e.id,{x:a,y:l+d[t],offset:d[t]}])));let h=M.get(t.id),u={state:t.state,step:t.depth,partition:e??"all"},c=`vertex:${e??"all"}:${t.id}`;o.push({type:"glyph",id:c,cx:a,cy:l,size:h,depth:t.depth,label:`${t.state} (step ${t.depth})`,glyph:Fn,accent:v.border??"#888",style:{fill:v.surface??"#fff"},datum:{...S,id:c,nodeId:t.state,kind:"braid-step",prefixId:t.id,...u},accessibleDatum:u}),w(a,l+h/2+12,t.state)}for(let t of s){let i=pt(t.signature);for(let n=1;i.length>n;n++){let s=r.get(i[n-1]).get(t.id),o=r.get(i[n]).get(t.id),a=(s.x+o.x)/2-Math.sign(o.y-s.y)*o.offset;q(1e-8>Math.abs(s.y-o.y)?[s,o]:[s,{x:a,y:s.y},{x:a,y:o.y},o],t,`step:${e??"all"}:${i[n]}:${t.id}`,n-1,n)}}}),{sceneNodes:o,sceneEdges:r,labels:a,restyle:Tn,restyleEdge:Tn}};import*as jn from"react";import{jsx as En}from"react/jsx-runtime";var Rn,Yn={isActive:!1,predicate:()=>!0},Wn={seed:1,gravity:{x:0,y:980},fixedDt:1/120,cellSize:64,collisionIterations:6,velocityDamping:.995,sleepSpeed:8,sleepAfter:.35,restitution:.1,friction:.35,maxVelocity:1600,contactWakeSpeed:200},Xn=1e-9,zn=.005,Gn=class{constructor(e={}){this.capabilities={determinism:"strict",sensors:!0,joints:!1,ccd:!1,maxBodiesHint:5e3,worker:!1},this.bodies=/* @__PURE__ */new Map,this.colliders=/* @__PURE__ */new Map,this.springs=/* @__PURE__ */new Map,this.activeSensors=/* @__PURE__ */new Set,this.supportedThisStep=/* @__PURE__ */new Set,this.lastEvents=[],this.nextBodyIndex=0,this.nextColliderIndex=0,this.nextSpringIndex=0,this.options={...Wn,...e},this.random=Se(this.options.seed)}init(e={}){this.options={...Wn,...e},this.random=Se(this.options.seed),this.bodies.clear(),this.colliders.clear(),this.springs.clear(),this.activeSensors.clear(),this.lastEvents=[],this.nextBodyIndex=0,this.nextColliderIndex=0,this.nextSpringIndex=0}spawn(e){let t={id:e.id,x:e.x,y:e.y,prevX:e.x,prevY:e.y,vx:e.vx??0,vy:e.vy??0,angle:e.angle??0,mass:Math.max(Xn,e.mass??1),bodyCollisions:e.bodyCollisions??!0,...e.fixedPosition?{fixedPosition:It(e.fixedPosition)}:{},shape:Ot(e.shape),sleeping:!1,datum:e.datum,restitution:e.restitution,friction:e.friction,index:this.nextBodyIndex,sleepTime:0};kt(t),this.nextBodyIndex+=1,this.bodies.set(e.id,t)}remove(e){for(let t of e){this.bodies.delete(t);for(let e of Array.from(this.activeSensors))Ht(e).bodyId===t&&this.activeSensors.delete(e)}}setColliders(e){this.colliders.clear(),this.activeSensors.clear(),this.nextColliderIndex=0;for(let t of e)this.colliders.set(t.id,{...t,shape:At(t.shape),bodyFilter:$t(t.bodyFilter),index:this.nextColliderIndex}),this.nextColliderIndex+=1}setConstraint(e){let t=e.id??"spring-"+this.nextSpringIndex;return this.springs.set(t,{id:t,bodyId:e.bodyId,target:e.target,restLength:e.restLength??0,stiffness:e.stiffness??40,damping:e.damping??3}),this.nextSpringIndex+=1,t}removeConstraint(e){this.springs.delete(e)}applyImpulse(e,t,i){let n=this.bodies.get(e);n&&(n.vx+=t/n.mass,n.vy+=i/n.mass,kt(n),this.wake(n))}step(e=this.options.fixedDt){let t=Math.max(0,e);if(this.lastEvents=[],0===t)return;let i=this.sortedBodies();for(let e of i)e.prevX=e.x,e.prevY=e.y;this.applySprings(t);let n=this.options.maxVelocity;for(let e of i)if(!e.sleeping){if(e.vx+=this.options.gravity.x*t,e.vy+=this.options.gravity.y*t,e.vx*=this.options.velocityDamping,e.vy*=this.options.velocityDamping,kt(e),n>0){let t=Math.sqrt(e.vx*e.vx+e.vy*e.vy);if(t>n){let i=n/t;e.vx*=i,e.vy*=i}}e.x+=e.vx*t,e.y+=e.vy*t}this.supportedThisStep.clear();let s=this.bodyPairKeys(i),r=this.sortedColliders().filter(e=>!e.sensor);for(let e=0;this.options.collisionIterations>e;e+=1)this.resolveBodyPairs(i,s,0===e),this.resolveColliders(i,r,0===e);this.updateSensors(i),this.updateSleeping(i,t)}settle(e=1200,t=this.options.fixedDt){let i=0;for(;e>i&&!this.allSleeping();)this.step(t),i+=1;return i}readState(e=[]){e.length=0;for(let t of this.sortedBodies())e.push({id:t.id,x:t.x,y:t.y,prevX:t.prevX,prevY:t.prevY,vx:t.vx,vy:t.vy,angle:t.angle,mass:t.mass,...t.fixedPosition?{fixedPosition:It(t.fixedPosition)}:{},shape:Ot(t.shape),sleeping:t.sleeping,datum:t.datum});return e}events(){return this.lastEvents.slice()}activeSensorPairs(){return Array.from(this.activeSensors).sort().map(Ht)}allSleeping(){for(let e of this.bodies.values())if(!e.sleeping)return!1;return!0}snapshot(){return{options:{...this.options,gravity:{...this.options.gravity}},bodies:this.sortedBodies().map(Ct),colliders:this.sortedColliders().map(qt),springs:Array.from(this.springs.values()).map(e=>({...e,target:{...e.target}})),activeSensors:Array.from(this.activeSensors).sort()}}restore(e){this.options={...e.options,gravity:{...e.options.gravity}},this.random=Se(this.options.seed),this.bodies.clear(),this.colliders.clear(),this.springs.clear(),this.activeSensors=new Set(e.activeSensors),this.lastEvents=[],this.nextBodyIndex=0;for(let t of e.bodies){let e=Ct(t);kt(e),this.bodies.set(e.id,e),this.nextBodyIndex=Math.max(this.nextBodyIndex,e.index+1)}this.nextColliderIndex=0;for(let t of e.colliders){let e=qt(t);this.colliders.set(e.id,e),this.nextColliderIndex=Math.max(this.nextColliderIndex,e.index+1)}this.nextSpringIndex=0;for(let t of e.springs){this.springs.set(t.id,{...t,target:{...t.target}});let e=/^spring-(\d+)$/.exec(t.id);e&&(this.nextSpringIndex=Math.max(this.nextSpringIndex,Number(e[1])+1))}}dispose(){this.bodies.clear(),this.colliders.clear(),this.springs.clear(),this.activeSensors.clear(),this.lastEvents=[]}sortedBodies(){return Array.from(this.bodies.values()).sort((e,t)=>e.index-t.index)}sortedColliders(){return Array.from(this.colliders.values()).sort((e,t)=>e.index-t.index)}applySprings(e){for(let t of Array.from(this.springs.values()).sort((e,t)=>e.id.localeCompare(t.id))){let i=this.bodies.get(t.bodyId);if(!i||i.sleeping)continue;let n="point"===t.target.type?t.target:this.bodies.get(t.target.bodyId);if(!n)continue;let s=n.x-i.x,r=n.y-i.y,o=Math.sqrt(s*s+r*r);if(Xn>=o)continue;let a=s/o,l=r/o,d=(o-t.restLength)*t.stiffness+((("vx"in n?n.vx:0)-i.vx)*a+(("vy"in n?n.vy:0)-i.vy)*l)*t.damping;i.vx+=d*a*e/i.mass,i.vy+=d*l*e/i.mass}}resolveBodyPairs(e,t,i){for(let n of t){let[t,s]=n.split(":").map(Number),r=e[t],o=e[s];if(!r||!o)continue;let a=Xt(r,o);a&&(this.resolveDynamicCollision(r,o,a),i&&this.lastEvents.push({type:"contact",bodyId:r.id,otherId:o.id,sensor:!1}))}}bodyPairKeys(e){let t=Math.max(1,this.options.cellSize),i=/* @__PURE__ */new Map;for(let n=0;e.length>n;n+=1){if(!1===e[n].bodyCollisions)continue;let s=Tt(e[n]),r=Math.floor(s.minX/t),o=Math.floor(s.maxX/t),a=Math.floor(s.minY/t),l=Math.floor(s.maxY/t);for(let e=r;o>=e;e+=1)for(let t=a;l>=t;t+=1){let s=`${e}:${t}`,r=i.get(s);r?r.push(n):i.set(s,[n])}}let n=/* @__PURE__ */new Set;for(let t of Array.from(i.keys()).sort()){let s=i.get(t)??[];s.sort((e,t)=>e-t);for(let t=0;s.length>t;t+=1)for(let i=t+1;s.length>i;i+=1){let r=s[t],o=s[i];!1===e[r].bodyCollisions||!1===e[o].bodyCollisions||jt(Tt(e[r]),Tt(e[o]))&&n.add(`${r}:${o}`)}}return Array.from(n).sort((e,t)=>{let[i,n]=e.split(":").map(Number),[s,r]=t.split(":").map(Number);return i===s?n-r:i-s})}resolveDynamicCollision(e,t,i){(e.fixedPosition||t.fixedPosition)&&(!e.sleeping&&null==e.fixedPosition?.x||!t.sleeping&&null==t.fixedPosition?.x?(e.sleeping||null!=e.fixedPosition?.y)&&(t.sleeping||null!=t.fixedPosition?.y)&&(i=Bt(e,t,"y")):i=Bt(e,t,"x")),e.sleeping&&this.contactOpposesGravity(i.nx,i.ny)&&this.supportedThisStep.add(t.id),t.sleeping&&this.contactOpposesGravity(-i.nx,-i.ny)&&this.supportedThisStep.add(e.id);let n=e.sleeping?0:1/e.mass,s=t.sleeping?0:1/t.mass,r=null==e.fixedPosition?.x?n:0,o=null==e.fixedPosition?.y?n:0,a=null==t.fixedPosition?.x?s:0,l=null==t.fixedPosition?.y?s:0,d=e.fixedPosition||t.fixedPosition?i.nx**2*(r+a)+i.ny**2*(o+l):n+s;if(Xn>=d)return;let h=Math.max(0,i.penetration-zn)/d;e.x-=i.nx*h*r,e.y-=i.ny*h*o,t.x+=i.nx*h*a,t.y+=i.ny*h*l;let u=(t.vx-e.vx)*i.nx+(t.vy-e.vy)*i.ny;if(u>0)return;let c=Math.abs(u),p=-(1+Nt(e.restitution,t.restitution,this.options.restitution))*u/d,f=p*i.nx,m=p*i.ny;e.vx-=f*r,e.vy-=m*o,t.vx+=f*a,t.vy+=m*l,this.applyFriction(e,t,i,p,n,s),c>this.options.contactWakeSpeed&&(this.wake(e),this.wake(t))}applyFriction(e,t,i,n,s,r){let o=-i.ny,a=i.nx,l=(t.vx-e.vx)*o+(t.vy-e.vy)*a,d=null==e.fixedPosition?.x?s:0,h=null==e.fixedPosition?.y?s:0,u=null==t.fixedPosition?.x?r:0,c=null==t.fixedPosition?.y?r:0,p=e.fixedPosition||t.fixedPosition?o**2*(d+u)+a**2*(h+c):s+r;if(Xn>=Math.abs(l)||Xn>=p)return;let f=Ft(e.friction,t.friction,this.options.friction),m=Pt(-l/p,-n*f,n*f),y=m*o,x=m*a;e.vx-=y*d,e.vy-=x*h,t.vx+=y*u,t.vy+=x*c}resolveColliders(e,t,i){for(let n of e)for(let e of t){if(!Vt(e,n)||!jt(Tt(n),Lt(e)))continue;let t=zt(n,e);t&&(this.resolveStaticCollision(n,e,t),this.contactOpposesGravity(t.nx,t.ny)&&this.supportedThisStep.add(n.id),i&&this.lastEvents.push({type:"contact",bodyId:n.id,otherId:e.id,sensor:!1}))}}resolveStaticCollision(e,t,i){e.x+=i.nx*Math.max(0,i.penetration-zn),e.y+=i.ny*Math.max(0,i.penetration-zn);let n=e.vx*i.nx+e.vy*i.ny;if(0>n){let s=Nt(e.restitution,t.restitution,this.options.restitution);e.vx-=(1+s)*n*i.nx,e.vy-=(1+s)*n*i.ny;let r=-i.ny,o=i.nx,a=e.vx*r+e.vy*o,l=Ft(e.friction,t.friction,this.options.friction);e.vx-=a*r*l,e.vy-=a*o*l}kt(e)}updateSensors(e){let t=/* @__PURE__ */new Set,i=this.sortedColliders().filter(e=>e.sensor);for(let n of e){let e=Tt(n);for(let s of i){if(!Vt(s,n)||!jt(e,Lt(s))||!zt(n,s))continue;let i=Gt(s.id,n.id);t.add(i),this.activeSensors.has(i)||this.lastEvents.push({type:"sensor-enter",bodyId:n.id,sensorId:s.id})}}for(let e of Array.from(this.activeSensors).sort()){if(t.has(e))continue;let{sensorId:i,bodyId:n}=Ht(e);this.lastEvents.push({type:"sensor-exit",bodyId:n,sensorId:i})}this.activeSensors=t}updateSleeping(e,t){let i=Math.hypot(this.options.gravity.x,this.options.gravity.y)>1;for(let n of e)this.options.sleepSpeed>Math.sqrt(n.vx*n.vx+n.vy*n.vy)&&this.options.sleepSpeed*t>Math.sqrt((n.x-n.prevX)*(n.x-n.prevX)+(n.y-n.prevY)*(n.y-n.prevY))&&(!i||this.supportedThisStep.has(n.id))?(n.sleepTime+=t,!n.sleeping&&n.sleepTime>=this.options.sleepAfter&&(n.sleeping=!0,n.vx=0,n.vy=0,this.lastEvents.push({type:"sleep",bodyId:n.id}))):n.sleeping?this.wake(n):n.sleepTime=0}contactOpposesGravity(e,t){let{x:i,y:n}=this.options.gravity,s=Math.hypot(i,n);return 1e-9>=s||-.2>(e*i+t*n)/s}wake(e){e.sleeping&&this.lastEvents.push({type:"wake",bodyId:e.id}),e.sleeping=!1,e.sleepTime=0}nextRandom(){return this.random()}},Hn=["binId","targetBin","category","windowIndex","lane","group"],Kn=class{constructor(e=!1){this.bins=/* @__PURE__ */new Map,this.nextIndex=0,this.config=e}updateConfig(e){void 0!==e&&(this.config=e,!1===e&&this.clear())}isEnabled(){return!1!==this.config}add(e){if(!1===this.config)return null;let t=this.nextIndex;this.nextIndex+=1;let i=ni(ti(this.config.binAccessor,e,t))??si(e),n=ni(ti(this.config.labelAccessor,e,t))??i,s=ii(this.config.valueAccessor,e,t),r=Math.max(0,Math.floor(this.config.retainBodyIds??12)),o=this.bins.get(i);return o||(o={id:i,label:n,bodyIds:[],x:{count:0,total:0,mean:0,m2:0,min:1/0,max:-1/0},y:{count:0,total:0,mean:0,m2:0,min:1/0,max:-1/0},value:{count:0,total:0,mean:0,m2:0,min:1/0,max:-1/0}},this.bins.set(i,o)),o.label=n,o.lastBodyId=e.id,o.lastDatum=e.datum,Qt(o.x,e.x),Qt(o.y,e.y),Qt(o.value,s),r>0&&(o.bodyIds.push(e.id),o.bodyIds.length>r&&(o.bodyIds=o.bodyIds.slice(o.bodyIds.length-r))),ri(o)}clear(){this.bins.clear(),this.nextIndex=0}snapshot(){return Array.from(this.bins.values()).map(ri)}restore(e=[]){this.bins.clear();for(let t of e)this.bins.set(t.id,{id:t.id,label:t.label,bodyIds:t.bodyIds.slice(),lastBodyId:t.lastBodyId,lastDatum:t.lastDatum,x:Jt(t.x),y:Jt(t.y),value:Jt(t.value)});this.nextIndex=e.reduce((e,t)=>e+t.count,0)}totals(){let e=this.snapshot();return{bins:e.length,count:e.reduce((e,t)=>e+t.count,0),total:e.reduce((e,t)=>e+t.total,0)}}},Un={bodyLimit:1/0,eviction:"oldest",fixedDt:1/120,maxDeltaSeconds:.1,maxSubsteps:8,settleStepLimit:1200,timeScale:1},_n={chartId:"physics",chartType:"physics",sensors:{},onObservation:void 0,onSimulationStateChange:void 0},Vn=class{constructor(e={}){this.id="builtin",this.capabilities={...(new Gn).capabilities,engine:"builtin"},this.world=new Gn(e)}init(e={}){this.world.init(e)}spawn(e){this.world.spawn(e)}remove(e){this.world.remove(e)}setColliders(e){this.world.setColliders(e)}setConstraint(e){return this.world.setConstraint(e)}removeConstraint(e){this.world.removeConstraint(e)}applyImpulse(e,t,i){this.world.applyImpulse(e,t,i)}step(e){this.world.step(e)}settle(e,t){return this.world.settle(e,t)}readState(e){return this.world.readState(e)}events(){return this.world.events()}activeSensorPairs(){return this.world.activeSensorPairs()}allSleeping(){return this.world.allSleeping()}snapshot(){return this.world.snapshot()}restore(e){this.world.restore(e)}nextRandom(){return this.world.nextRandom()}dispose(){this.world.dispose()}},Qn={data:"data",domain:"domain",layout:"layout","scene-geometry":"sceneGeometry","scene-style":"sceneStyle","data-paint":"dataPaint","interaction-paint":"interactionPaint",overlay:"overlay",accessibility:"accessibility",evidence:"evidence"},Zn=class{constructor(){this.revisions={data:0,domain:0,layout:0,sceneGeometry:0,sceneStyle:0,dataPaint:0,interactionPaint:0,overlay:0,accessibility:0,evidence:0},this.latest=Ci({kind:"initialize"},[],this.revisions),this.listeners=/* @__PURE__ */new Set}get last(){return this.latest}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}record(e,t){let i=Ci(e,t,this.revisions);this.revisions=i.revisions,this.latest=i;for(let e of[...this.listeners])e();return i}};import{quadtree as Jn}from"d3-quadtree";var es=class{constructor(){this.maxSearchRadius=0,this.revision=-1,this.tree=null}hitTest(e,t,i,n,s,r=0,o){let a=this.ensure(e,t);if(!a)return null;let l=null,d=1/0,h=Math.max(0,o?.searchRadius??Math.max(0,r)+this.maxSearchRadius),u=n-h,c=n+h,p=s-h,f=s+h;return a.visit((e,t,a,h,m)=>{if(u>h||t>c||p>m||a>f)return!0;if(e.length)return!1;let y=e;for(;y;){let e=y.data;if(e&&(!o?.include||o.include(e))){let t=o?.distanceSquared?o.distanceSquared(e,n,s):gi(e,n,s,Math.max(0,r));null!=t&&(d>t||t===d&&i.indexOf(e.id)>i.indexOf(l?.id??""))&&(l=e,d=t)}y=y.next}return!1}),l}ensure(e,t){if(this.tree&&this.revision===t)return this.tree;let i=e.readState();return 0===i.length?(this.tree=null,this.maxSearchRadius=0,this.revision=t,null):(this.maxSearchRadius=i.reduce((e,t)=>{return Math.max(e,"circle"===(i=t).shape.type?i.shape.radius:Math.hypot(i.shape.width,i.shape.height)/2);var i},0),this.tree=Jn().x(e=>e.x).y(e=>e.y).addAll(i),this.revision=t,this.tree)}},ts=["data","scene-geometry","data-paint","accessibility","evidence"],is=["scene-geometry","data-paint","accessibility","evidence"],ns=["overlay","accessibility","evidence"],ss=(e,t)=>({retainedData:e,invalidations:t}),rs=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],os=["scene-geometry","data-paint","accessibility","evidence"],as=[],ls={engine:ss("rebuild",["scene-geometry","data-paint","accessibility","evidence"]),kernel:ss("preserve",os),colliders:ss("preserve",os),sediment:ss("preserve",os),bodyBudget:ss("preserve",rs),bodyLimit:ss("preserve",rs),eviction:ss("preserve",rs),fixedDt:ss("preserve",as),maxDeltaSeconds:ss("preserve",as),maxSubsteps:ss("preserve",as),settleStepLimit:ss("preserve",as),timeScale:ss("preserve",as),observation:ss("preserve",as)},ds=ss("preserve",rs),hs=["seed","fixedDt","cellSize","collisionIterations","velocityDamping","sleepSpeed","sleepAfter","restitution","friction","maxVelocity","contactWakeSpeed"],us=class{constructor(){this.seconds=0,this.speed=8,this.scratch=[]}setKernelOptions(e){this.speed=Wi(e)}reset(){this.seconds=0}isAtRest(){return this.seconds>=.6}refresh(e,t,i){if(i>0)return void(this.seconds=0);let n=e.readState(this.scratch),s=this.speed*this.speed,r=!0;for(let e of n)if(!e.sleeping&&e.vx*e.vx+e.vy*e.vy>=s){r=!1;break}this.seconds=r?this.seconds+Math.max(0,t):0}},cs=class{constructor(e={}){this.activeSensorPairs=/* @__PURE__ */new Set,this.accumulator=0,this.bodyBudgetObservationKey="ok",this.bodySpatialIndex=new es,this.elapsedSeconds=0,this.liveBodyOrder=[],this.nextSequence=0,this.paused=!1,this.queue=[],this.revision=0,this.updateResults=new Zn,this.simulationState="settled",this.visible=!0,this.quiescence=new us;let{bodyBudget:t,colliders:i,engine:n,kernel:s,observation:r,sediment:o,...a}=e;this.config={...Un,...a},this.configInput={...e},this.bodyBudget=t??{},this.engineInput=n,this.observation=ai(r),this.sediment=new Kn(o??!1),this.world=ki(n,{fixedDt:this.config.fixedDt,...s}),this.quiescence.setKernelOptions(s),i&&this.world.setColliders(fi(i))}updateConfig(e){let t=Pi(e,this.configInput),{colliders:i,bodyBudget:n,engine:s,kernel:r,observation:o,sediment:a,...l}=e;if(this.config={...this.config,...l},void 0!==n&&(this.bodyBudget=n,!1===n&&(this.bodyBudgetObservationKey="ok")),s&&s!==this.engineInput){let e=this.world.snapshot();this.world.dispose(),this.engineInput=s,this.world=ki(s,e.options),this.world.restore(e),this.revision+=1}if(r&&!qi(r,this.configInput.kernel)){let e=this.world.snapshot(),t={...e.options,...r,gravity:{...e.options.gravity,...r.gravity}};this.world.restore({...e,options:t}),this.quiescence.setKernelOptions(t),this.revision+=1}o&&(this.observation=ai(o,this.observation)),this.sediment.updateConfig(a),i&&(this.world.setColliders(fi(i)),this.revision+=1),this.configInput={...this.configInput,...e};let d=$i(t);this.updateResults.record({kind:"config",keys:t},d.invalidations)}updateConfigWithResult(e){return this.updateConfig(e),this.updateResults.last}setColliders(e){this.world.setColliders(fi(e)),this.revision+=1,this.updateResults.record({kind:"config",keys:["colliders"]},$i(["colliders"]).invalidations)}enqueue(e,t){let i=Array.isArray(e)?e:[e],n=t?ci(i,{...t,startAt:t.startAt??this.elapsedSeconds}):i;for(let e of n)this.queue.push({...li(e),sequence:this.nextSequence,spawnAt:e.spawnAt??this.elapsedSeconds}),this.nextSequence+=1;this.queue.sort(yi),n.length>0&&(this.revision+=1),this.updateResults.record({kind:"enqueue",count:n.length},n.length?ts:[])}enqueueWithResult(e,t){return this.enqueue(e,t),this.updateResults.last}spawnNow(e){this.spawnOne(li(e)),this.nextSequence+=1,this.observeBodyBudget(),this.evictOverflow(),this.revision+=1,this.updateResults.record({kind:"enqueue",count:1},ts)}materializeDueSpawns(){let e=this.revision,t=[],i=[];return this.spawnDue(t,i),0===t.length||(this.observeBodyBudget(i),this.evictOverflow(i),this.syncSimulationState(i),this.revision+=1,this.updateResults.record({kind:"enqueue",count:t.length},this.revision!==e?ts:[])),t}clear(){let e=this.world.snapshot().options;this.world.init({...e,fixedDt:this.config.fixedDt}),this.activeSensorPairs.clear(),this.liveBodyOrder=[],this.queue=[],this.accumulator=0,this.elapsedSeconds=0,this.nextSequence=0,this.quiescence.reset(),this.sediment.clear(),this.bodyBudgetObservationKey="ok",this.revision+=1,this.syncSimulationState(),this.updateResults.record({kind:"clear"},ts)}tick(e,t){let i=this.revision,n=[],s=[],r=[],o=[],a=[];if(this.paused||!this.visible){let e=this.result(0,n,s,r,o,a,!1);return this.updateResults.record({kind:"tick",count:0},[]),e}let l=Math.max(0,Math.min(Number.isFinite(e)?e:0,this.config.maxDeltaSeconds))*this.config.timeScale;this.spawnDue(n,a);let d=this.observeBodyBudget(a),h=this.evictOverflow(a);s.push(...h.evicted),r.push(...h.sedimented),this.syncSimulationState(a),n.length>0&&this.quiescence.reset(),this.accumulator+=l;let u=this.stepObserver(t,{spawned:n,evicted:s,sedimented:r,events:o,observations:a}),c=l>0?Math.floor((this.accumulator+1e-9*this.config.fixedDt)/this.config.fixedDt):0,{steps:p,budget:f}=zi(this.settleHost(),Math.min(c,this.config.maxSubsteps),{spawned:n,evicted:s,sedimented:r,events:o,observations:a},{stopAtRest:!1,shouldStop:()=>this.paused||!this.visible,afterStep:u});this.accumulator=Math.max(0,this.accumulator-p*this.config.fixedDt),p===this.config.maxSubsteps&&(this.accumulator=Math.min(this.accumulator,this.config.fixedDt)),(p>0||n.length>0||s.length>0||r.length>0||o.length>0)&&(this.revision+=1);let m=this.result(p,n,s,r,o,a,void 0,f??d);return this.updateResults.record({kind:"tick",count:p},this.revision!==i?n.length||s.length||r.length?ts:is:[]),m}settle(e=this.config.settleStepLimit){return this.runSettle(e,!1).steps}settleWithObservations(e=this.config.settleStepLimit,t){return this.runSettle(e,!0,t)}stepObserver(e,t){return Xi(e,e=>(e&&(this.revision+=1),this.result(e,t.spawned,t.evicted,t.sedimented,t.events,t.observations)))}settleHost(){return{fixedDt:this.config.fixedDt,queueSize:()=>this.queue.length,atRest:()=>this.atRest(),advanceTime:e=>{this.elapsedSeconds+=e},spawnDue:(e,t)=>this.spawnDue(e,t),observeBodyBudget:e=>this.observeBodyBudget(e),evictOverflow:e=>this.evictOverflow(e),step:e=>this.world.step(e),drainEvents:()=>this.world.events(),observeKernelEvents:(e,t)=>this.observeKernelEvents(e,t),observeSensorTransitions:e=>this.observeSensorTransitions(e),refreshQuiescence:(e,t)=>this.quiescence.refresh(this.world,e,t)}}runSettle(e,t,i){let n=this.revision,s=[],r=[],o=[],a=[],l=t?[]:void 0;if(t&&(this.paused||!this.visible)){let e=this.result(0,s,r,o,a,l??[],!1);return this.updateResults.record({kind:"settle",count:0},[]),e}this.spawnDue(s,l);let d=this.observeBodyBudget(l),h=this.evictOverflow(l);r.push(...h.evicted),o.push(...h.sedimented),this.syncSimulationState(l),s.length>0&&this.quiescence.reset();let u=t?{spawned:s,evicted:r,sedimented:o,events:a,observations:l}:{spawned:s},c=this.stepObserver(i,{spawned:s,evicted:r,sedimented:o,events:a,observations:l??[]}),{steps:p,budget:f}=zi(this.settleHost(),e,u,{afterStep:c,continueWhile:i?.continueWhile,shouldStop:t?()=>this.paused||!this.visible:void 0}),m=s.length+r.length+o.length>0;(p>0||m||a.length>0)&&(this.revision+=1);let y=this.result(p,s,r,o,a,l??[],void 0,f??d);return this.updateResults.record({kind:"settle",count:p},this.revision===n?[]:m?ts:is),y}readBodies(e=[]){return this.world.readState(e)}readSediment(){return this.sediment.snapshot()}bodyBudgetStatus(){return this.evaluateBodyBudget()}sedimentTotals(){return this.sediment.totals()}sedimentHeightfield(e={}){return oi(this.readSediment(),e)}hitTest(e,t,i=0,n){return this.bodySpatialIndex.hitTest(this.world,this.revision,this.liveBodyOrder,e,t,i,n)}events(){return this.world.events()}allSleeping(){return this.world.allSleeping()}atRest(){return this.world.allSleeping()||this.quiescence.isAtRest()}hasPendingWork(){return this.queue.length>0||!this.atRest()}queueSize(){return this.queue.length}liveBodyCount(){return this.liveBodyOrder.length}elapsed(){return this.elapsedSeconds}recordObservation(e){let{timestamp:t,chartType:i,chartId:n,...s}=e,r={...s,timestamp:t??this.elapsedSeconds,chartType:i??this.observation.chartType,chartId:n??this.observation.chartId};return this.emitObservation(r),this.updateResults.record({kind:"update",count:1},["evidence"]),r}getLastUpdateResult(){return this.updateResults.last}getUpdateSnapshot(){return this.updateResults.last}subscribeUpdateResult(e){return this.updateResults.subscribe(e)}version(){return this.revision}setPaused(e){let t=this.paused!==e;this.paused=e,this.syncSimulationState(),this.updateResults.record({kind:"pause"},t?ns:[])}setVisible(e){let t=this.visible!==e;this.visible=e,this.syncSimulationState(),this.updateResults.record({kind:"visibility"},t?ns:[])}remove(e){let t=new Set(e),i=new Set(this.liveBodyOrder),n=new Set(this.queue.map(e=>e.id));this.queue=this.queue.filter(e=>!t.has(e.id)),this.liveBodyOrder=this.liveBodyOrder.filter(e=>!t.has(e)),this.world.remove(e),this.removeActiveSensorPairsForBodies(t);let s=e.filter(e=>i.has(e)||n.has(e));return s.length>0&&(this.revision+=1,this.syncSimulationState()),this.updateResults.record({kind:"remove",keys:s,count:s.length},s.length?ts:[]),s}setConstraint(e){let t=this.world.setConstraint(e);return this.revision+=1,this.updateResults.record({kind:"constraint",keys:[t]},is),t}removeConstraint(e){this.world.removeConstraint(e),this.revision+=1,this.updateResults.record({kind:"constraint",keys:[e]},is)}applyImpulse(e,t,i){this.world.applyImpulse(e,t,i),this.revision+=1,this.updateResults.record({kind:"impulse",keys:[e]},is)}nextRandom(){return this.world.nextRandom()}controls(){return e=this,{applyImpulse:(t,i,n)=>e.applyImpulse(t,i,n),clear:()=>e.clear(),hitTest:(t,i,n)=>e.hitTest(t,i,n),pause:()=>e.setPaused(!0),push:(t,i)=>e.enqueue(t,i),pushMany:(t,i)=>e.enqueue(t,i),bodyBudgetStatus:()=>e.bodyBudgetStatus(),readBodies:t=>e.readBodies(t),readSediment:()=>e.readSediment(),recordObservation:t=>e.recordObservation(t),remove:t=>e.remove(t),restore:t=>e.restore(t),resume:()=>e.setPaused(!1),settle:t=>e.settle(t),settleWithObservations:t=>e.settleWithObservations(t),snapshot:()=>e.snapshot(),sedimentHeightfield:t=>e.sedimentHeightfield(t),sedimentTotals:()=>e.sedimentTotals(),step:t=>e.tick(t)};var e}snapshot(){let e=this.world.snapshot();return{accumulator:this.accumulator,activeSensorPairs:Array.from(this.activeSensorPairs).sort(),bodyBudget:mi(this.bodyBudget),config:{...this.config,kernel:xi(e.options)},elapsedSeconds:this.elapsedSeconds,paused:this.paused,queue:this.queue.map(pi),revision:this.revision,sediment:this.readSediment(),simulationState:this.simulationState,liveBodyOrder:this.liveBodyOrder.slice(),visible:this.visible,world:e}}restore(e){let t=this.simulationState;this.config={bodyLimit:e.config.bodyLimit,eviction:e.config.eviction,fixedDt:e.config.fixedDt,maxDeltaSeconds:e.config.maxDeltaSeconds,maxSubsteps:e.config.maxSubsteps,settleStepLimit:e.config.settleStepLimit,timeScale:e.config.timeScale},this.configInput={...e.config,bodyBudget:mi(e.bodyBudget??{}),kernel:xi(e.world.options)},this.bodyBudget=mi(e.bodyBudget??{}),this.bodyBudgetObservationKey="ok",this.quiescence.setKernelOptions(e.world.options),this.quiescence.reset(),this.activeSensorPairs=new Set(e.activeSensorPairs),this.accumulator=e.accumulator,this.elapsedSeconds=e.elapsedSeconds,this.paused=e.paused,this.queue=e.queue.map(pi).sort(yi),this.revision=e.revision,this.sediment.restore(e.sediment??[]),this.simulationState=e.simulationState??Ti(e.paused,e.visible,e.queue.length>0,e.world.bodies.every(e=>e.sleeping)),this.liveBodyOrder=e.liveBodyOrder.slice(),this.visible=e.visible,this.nextSequence=this.queue.reduce((e,t)=>Math.max(e,t.sequence),-1)+1,this.world.restore(e.world),this.updateResults.record({kind:"restore"},ts),this.simulationState!==t&&this.observation.onSimulationStateChange?.(this.simulationState,t)}spawnDue(e,t){for(;this.queue.length>0&&this.elapsedSeconds+1e-9*this.config.fixedDt>=this.queue[0].spawnAt;){let i=this.queue.shift();if(!i)return;this.spawnOne(i,t),e.push(i.id)}}spawnOne(e,t){this.liveBodyOrder=this.liveBodyOrder.filter(t=>t!==e.id),this.removeActiveSensorPairsForBodies(/* @__PURE__ */new Set([e.id])),this.world.spawn(e),this.liveBodyOrder.push(e.id);for(let t of e.springs??[])this.world.setConstraint({...t,bodyId:e.id});let i=this.world.readState().find(t=>t.id===e.id);this.emitObservation({type:"physics-spawn",timestamp:this.elapsedSeconds,chartType:this.observation.chartType,chartId:this.observation.chartId,bodyId:e.id,datum:i?.datum??e.datum,x:i?.x??e.x,y:i?.y??e.y},t)}result(e,t,i,n,s,r,o,a=this.evaluateBodyBudget()){this.syncSimulationState(r);let l=this.world.allSleeping();return{budget:a,elapsedSeconds:this.elapsedSeconds,evicted:i,events:s,observations:r,queueSize:this.queue.length,revision:this.revision,shouldContinue:o??(!this.paused&&this.visible&&(this.queue.length>0||!this.atRest())),sleeping:l,sedimented:n,spawned:t,steps:e}}observeKernelEvents(e,t){Ni(this.world,e,this.observationContext(t))}observeSensorTransitions(e){this.activeSensorPairs=Fi(this.world,this.activeSensorPairs,this.observationContext(e))}removeActiveSensorPairsForBodies(e){Di(this.activeSensorPairs,e)}observationContext(e){return{elapsedSeconds:this.elapsedSeconds,observation:this.observation,emit:t=>this.emitObservation(t,e)}}emitObservation(e,t){t?.push(e),this.observation.onObservation?.(e)}evaluateBodyBudget(){return Oi({bodyLimit:this.config.bodyLimit,engineMaxBodiesHint:this.world.capabilities.maxBodiesHint,evictionEnabled:!1!==this.config.eviction,liveBodies:this.liveBodyOrder.length,queuedBodies:this.queue.length,sedimentEnabled:this.sediment.isEnabled(),options:this.bodyBudget})}observeBodyBudget(e){let t=this.evaluateBodyBudget();if("ok"===t.state||!1===this.bodyBudget)return this.bodyBudgetObservationKey="ok",t;let i=`${t.state}:${t.action}`;return i===this.bodyBudgetObservationKey||(this.bodyBudgetObservationKey=i,ji(t,this.observationContext(e))),t}syncSimulationState(e){let t=Ti(this.paused,this.visible,this.queue.length>0,this.atRest());if(t===this.simulationState)return;let i=this.simulationState;this.simulationState=t,Li(i,t,this.observationContext(e))}evictOverflow(e){let{evicted:t,sedimented:i,liveBodyOrder:n}=Yi(this.world,this.sediment,this.config.eviction,this.config.bodyLimit,this.liveBodyOrder,this.observationContext(e));return t.length>0&&(this.liveBodyOrder=n,this.removeActiveSensorPairsForBodies(new Set(t))),{evicted:t,sedimented:i}}};import{scaleLinear as ps}from"d3-scale";export{wt as a,Zn as b,rn as c,e as d,t as e,i as f,n as g,an as h,ln as i,r as j,o as k,a as l,l as m,d as n,h as o,C as p,$ as q,q as r,b as s,v as t,O as u,A as v,c as w,hn as x,y,g as z,V as A,St as B,Mt as C,bn as D,J as E,ee as F,te as G,ie as H,ne as I,se as J,re as K,oe as L,wn as M,ae as N,le as O,de as P,he as Q,ue as R,ce as S,pe as T,fe as U,me as V,ye as W,xe as X,ge as Y,be as Z,ve as _,we as $,Bn as aa,Se as ba,Kt as ca,_t as da,oi as ea,wi as fa,Si as ga,cs as ha,Ie as ia,Be as ja,Oe as ka,Pe as la,Fe as ma,De as na,Te as oa,Le as pa,je as qa,Ee as ra,Re as sa,Ye as ta,We as ua,Xe as va,ze as wa,Qe as xa,ot as ya,at as za,lt as Aa,dt as Ba,Ln as Ca,yt as Da,xt as Ea,gt as Fa,bt as Ga,vt as Ha,Gi as Ia};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e){let t=L(e=>e.theme.colors.selectionOpacity);return C(()=>{if(void 0!==e||void 0!==t)return{name:e?.name??"",...e,unselectedOpacity:e?.unselectedOpacity??t}},[e,t])}function t(t){let{data:r,rawData:n,colorBy:L,colorScheme:C,legendInteraction:S,legendPosition:M,selection:F,linkedHover:B,fallbackFields:A,unwrapData:D=!1,onObservation:P,chartType:w,chartId:I,showLegend:R,legend:O,legendLayout:T,frameLegend:x,userMargin:j,marginDefaults:N,onClick:_,hoverHighlight:J,mobileInteraction:Y,mobileSemantics:G,loading:K,loadingContent:U,emptyContent:V,width:W,height:q,hasTitle:z,axisChrome:E}=t,Q=void 0===n,X=H(()=>g(r),[r]),[Z,$]=k([]),ee=b(e=>{$(t=>t.length===e.length&&t.every((t,r)=>t===e[r])?t:e)},[]),te="string"==typeof L?L:void 0,re=H(()=>m(Y,{width:W,mobileSemantics:G}),[Y,W,G]),{activeSelectionHook:ne,hoverSelectionHook:oe,customHoverBehavior:ae,customClickBehavior:le,crosshairSourceId:ie}=s({selection:F,linkedHover:B,fallbackFields:A,unwrapData:D,onObservation:P,chartType:w,chartId:I,onClick:_,hoverHighlight:J,colorByField:te,mobileInteraction:re}),ue=c(B,ie),se=u(X,L,C),ce=H(()=>o(X,L),[X,L]),ge=H(()=>Q&&Z.length>0?Z:ce,[Q,Z,ce]),de=l(S,L,ge),he=H(()=>oe||(de.legendSelectionHook?de.legendSelectionHook:ne),[oe,de.legendSelectionHook,ne]),ye=e(F),me=i(),pe=y(null!=C),fe=H(()=>{if(se&&(!Q||0===ge.length))return se;if(!L||0===ge.length)return;let e=Array.isArray(C)&&C.length>0||"string"==typeof C&&C.length>0?C:me&&me.length>0?me:p,t="__streamCat",r=ge.map(e=>({[t]:e})),n=v(r,t,e);return e=>(pe?f(pe,e):void 0)??(C&&"object"==typeof C&&!Array.isArray(C)?f(C,e):void 0)??n(e)??"#999"},[se,Q,L,ge,C,me,pe]),{legend:ve,margin:Le,legendPosition:Ce,legendLayout:be,legendMarginReserved:He}=a({data:X,colorBy:L,colorScale:fe,showLegend:R,legendPosition:M,userMargin:j,defaults:N,categories:ge,additionalLegend:O,chartWidth:W,chartHeight:q,legendLayout:T,frameLegend:x,hasTitle:z,axisChrome:E}),ke=H(()=>{let e={};return ve&&(e.legend=ve,e.legendPosition=Ce,He&&(e.__legendMarginReservedFor=ve),be&&(e.legendLayout=be)),S&&"none"!==S&&(e.legendHoverBehavior=de.onLegendHover,e.legendClickBehavior=de.onLegendClick,e.legendHighlightedCategory=de.highlightedCategory,e.legendIsolatedCategories=de.isolatedCategories),Q&&L&&(e.legendCategoryAccessor=L,e.onCategoriesChange=ee),e},[ve,Ce,be,He,S,de.onLegendHover,de.onLegendClick,de.highlightedCategory,de.isolatedCategories,Q,L,ee]),Se=Array.isArray(n)?g(n):n,Me=h(K,W,q,U),Fe=Me?null:d(Se,W,q,V);return{data:X,colorScale:fe,categoryColorScale:fe,allCategories:ge,legendState:de,effectiveSelectionHook:he,activeSelectionHook:ne,customHoverBehavior:ae,customClickBehavior:le,mobileInteraction:re,legend:ve,margin:Le,legendPosition:Ce,earlyReturn:Me||Fe||null,legendBehaviorProps:ke,crosshairProps:ue,resolvedSelection:ye}}function r(e,t){let{variant:r,frameRef:o,overrides:a}=t,l=M(a);l.current=a,S(e,()=>{let e=n(r,o);return new Proxy(e,{get(e,t,r){if("string"==typeof t){let e=l.current?.[t];if("function"==typeof e)return e}return Reflect.get(e,t,r)},has:(e,t)=>!("string"!=typeof t||!l.current||!(t in l.current))||Reflect.has(e,t)})},[])}function n(e,t){if("xy"===e){let e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>e.current?.remove(t)??[],update:(t,r)=>e.current?.update(t,r)??[],replace:t=>e.current?.replace?.(t),clear:()=>e.current?.clear(),getData:()=>e.current?.getData()??[],getScales:()=>e.current?.getScales()??null,getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}if("network"===e){let e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>{let r=Array.isArray(t)?t:[t],n=e.current?.getTopology()?.nodes??[],o=[];for(let t of r){let r=n.find(e=>e.id===t);r&&o.push({...r.data??{},id:t}),e.current?.removeNode(t)}return o},update:(t,r)=>(Array.isArray(t)?t:[t]).flatMap(t=>{let n=e.current?.updateNode(t,r);return n?[{...n,id:t}]:[]}),clear:()=>e.current?.clear(),getData:()=>e.current?.getTopology()?.nodes?.map(e=>e.data)??[],getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}if("geo-points"===e){let e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>e.current?.removePoint(t)??[],update:(t,r)=>{let n=e.current?.removePoint(t)??[];for(let t of n)e.current?.push(r(t));return n},clear:()=>e.current?.clear(),getData:()=>e.current?.getData()??[],getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}let r=t;return{push:e=>r.current?.pushLine(e),pushMany:e=>r.current?.pushManyLines(e),remove:e=>r.current?.removeLine(e)??[],update:(e,t)=>{let n=r.current?.removeLine(e)??[];for(let e of n)r.current?.pushLine(t(e));return n},clear:()=>r.current?.clear(),getData:()=>r.current?.getLines()??[],getCustomLayout:()=>r.current?.getCustomLayout?.()??null,getLayoutFailure:()=>r.current?.getLayoutFailure?.()??null}}import{Bb as o,Cb as a,Db as l,Fb as i,Jb as u,Lb as s,Mb as c,b as g,bb as d,cb as h,eb as y,sb as m}from"./c-UMGHCBH5.min.js";import{p,s as f,t as v}from"./c-Y342FJ6K.min.js";import{h as L}from"./c-5NYONM6V.min.js";import{useMemo as C}from"react";import{useCallback as b,useMemo as H,useState as k}from"react";import{useImperativeHandle as S,useRef as M}from"react";export{e as a,t as b,r as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e,r,u){let o=n(e),i=n(r),f=n(u);return e=>{let n="string"==typeof e.agg&&"number"==typeof e.count&&"number"==typeof e.xCenter&&"number"==typeof e.yCenter;return{value:n?t(e.value):f(e),x:n?t(e.xCenter):o(e),y:n?t(e.yCenter):i(e)}}}function t(e){return"number"==typeof e&&Number.isFinite(e)?e:void 0}import{
|
|
1
|
+
function e(e,r,u){let o=n(e),i=n(r),f=n(u);return e=>{let n="string"==typeof e.agg&&"number"==typeof e.count&&"number"==typeof e.xCenter&&"number"==typeof e.yCenter;return{value:n?t(e.value):f(e),x:n?t(e.xCenter):o(e),y:n?t(e.yCenter):i(e)}}}function t(e){return"number"==typeof e&&Number.isFinite(e)?e:void 0}import{Ob as n}from"./c-UMGHCBH5.min.js";export{e as a};
|
|
@@ -14,7 +14,7 @@ return Es("g",{className:"semiotic-axis semiotic-axis-right","data-orient":"righ
|
|
|
14
14
|
return Es("g",{transform:`translate(${t},${e.pixel})`,children:[
|
|
15
15
|
/* @__PURE__ */Ds("line",{x2:5,...c}),"string"==typeof e.label||"number"==typeof e.label?/* @__PURE__ */Ds("text",{x:8,textAnchor:"start",dominantBaseline:le(o,e.pixel===h.min,e.pixel===h.max),fontWeight:r?600:400,fill:A,fontSize:r?13:12,className:"semiotic-axis-tick",style:{userSelect:"none",...r?S:P},children:e.label}):/* @__PURE__ */Ds("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:/* @__PURE__ */Ds("div",{style:{textAlign:"left",userSelect:"none",...P},children:e.label})})]},"ytick-r-"+i)}),a&&/* @__PURE__ */Ds("text",{x:t+Z-15,y:i/2,textAnchor:"middle",fill:_,transform:`rotate(90, ${t+Z-15}, ${i/2})`,fontSize:12,className:"semiotic-axis-label",style:{userSelect:"none",...M},children:a})]})})()]})})(),Ce,ke.node,S&&n&&M&&R&&/* @__PURE__ */Es(Ls,{children:[S.top&&/* @__PURE__ */Ds("g",{transform:"translate(0, 0)",children:/* @__PURE__ */Ds(fe,{orient:"top",config:at(S.top),values:M,scale:n.x,size:a.top,length:t})}),S.bottom&&/* @__PURE__ */Ds("g",{transform:`translate(0, ${i})`,children:/* @__PURE__ */Ds(fe,{orient:"bottom",config:at(S.bottom),values:M,scale:n.x,size:a.bottom,length:t})}),S.left&&/* @__PURE__ */Ds("g",{transform:"translate(0, 0)",children:/* @__PURE__ */Ds(fe,{orient:"left",config:at(S.left),values:R,scale:n.y,size:a.left,length:i})}),S.right&&/* @__PURE__ */Ds("g",{transform:`translate(${t}, 0)`,children:/* @__PURE__ */Ds(fe,{orient:"right",config:at(S.right),values:R,scale:n.y,size:a.right,length:i})})]}),P,Pe&&Pe.sourceId!==V&&n?.x&&(()=>{let e=n.x(Pe.xValue);if(null==e||0>e||e>t)return null;let r=Pe.locked;/* @__PURE__ */
|
|
16
16
|
return Ds("line",{x1:e,y1:0,x2:e,y2:i,stroke:r?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:r?1.5:1,strokeDasharray:r?"6,3":"4,4",pointerEvents:"none"})})(),H]}),
|
|
17
|
-
/* @__PURE__ */Ds(Mi,{title:f,totalWidth:r,marginTop:a.top}),ui({legend:v,totalWidth:r,totalHeight:s,margin:a,legendPosition:_,title:f,legendLayout:C,axisChrome:U,legendHoverBehavior:b,legendClickBehavior:w,legendHighlightedCategory:k,legendIsolatedCategories:A})]}):null}function Se(e,t,i,r,s){let[a,n]=Is([]),[o,l]=Is([]),c=null!=t,h=c?[t.top,t.bottom,t.left,t.right].join("|"):"",u=Os((t=e.current?.getData()??[])=>{let i=ye(t,r,s);n(i.xValues),l(i.yValues)},[e,r,s]);return Bs(()=>{if(!c)return n([]),void l([]);u()},[i,c,h,u]),{marginalXValues:a,marginalYValues:o,refreshMarginalValues:u}}function Me(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}let t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}function Re(e,t){let i=e.fillGradient;if(!i||"object"!=typeof i)return null;let r=1/0;for(let[,t]of e.topPath)r=Math.min(r,t);let s=-1/0;for(let[,t]of e.bottomPath)s=Math.max(s,t);if(!Number.isFinite(r)||!Number.isFinite(s))return null;let a=Di(i.stops,Ri(e.style.fill));return a?/* @__PURE__ */$s("linearGradient",{id:t,gradientUnits:"userSpaceOnUse",x1:0,y1:r,x2:0,y2:s,children:a}):null}function Ye(e,t,i,r){if(!e||2>t.length)return null;let s=Di(e.stops,r);return s?/* @__PURE__ */$s("linearGradient",{id:i,gradientUnits:"userSpaceOnUse",x1:t[0][0],y1:0,x2:t[t.length-1][0],y2:0,children:s}):null}function Te(e,t,i,r=30){let s=Le(e,t,i,r);return"area"===e.type?s:
|
|
17
|
+
/* @__PURE__ */Ds(Mi,{title:f,totalWidth:r,marginTop:a.top}),ui({legend:v,totalWidth:r,totalHeight:s,margin:a,legendPosition:_,title:f,legendLayout:C,axisChrome:U,legendHoverBehavior:b,legendClickBehavior:w,legendHighlightedCategory:k,legendIsolatedCategories:A})]}):null}function Se(e,t,i,r,s){let[a,n]=Is([]),[o,l]=Is([]),c=null!=t,h=c?[t.top,t.bottom,t.left,t.right].join("|"):"",u=Os((t=e.current?.getData()??[])=>{let i=ye(t,r,s);n(i.xValues),l(i.yValues)},[e,r,s]);return Bs(()=>{if(!c)return n([]),void l([]);u()},[i,c,h,u]),{marginalXValues:a,marginalYValues:o,refreshMarginalValues:u}}function Me(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}let t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}function Re(e,t){let i=e.fillGradient;if(!i||"object"!=typeof i)return null;let r=1/0;for(let[,t]of e.topPath)r=Math.min(r,t);let s=-1/0;for(let[,t]of e.bottomPath)s=Math.max(s,t);if(!Number.isFinite(r)||!Number.isFinite(s))return null;let a=Di(i.stops,Ri(e.style.fill));return a?/* @__PURE__ */$s("linearGradient",{id:t,gradientUnits:"userSpaceOnUse",x1:0,y1:r,x2:0,y2:s,children:a}):null}function Ye(e,t,i,r){if(!e||2>t.length)return null;let s=Di(e.stops,r);return s?/* @__PURE__ */$s("linearGradient",{id:i,gradientUnits:"userSpaceOnUse",x1:t[0][0],y1:0,x2:t[t.length-1][0],y2:0,children:s}):null}function Te(e,t,i,r=30){let s=Le(e,t,i,r);return"area"===e.type?s:Hi(s,e,"xy-cursor-"+t)}function Le(e,t,i,r=30){switch(e.type){case"line":{let r=e;if(0===r.path.length)return null;let s=kr(r.curve),a=s?Fs().x(([e])=>e).y(([,e])=>e).curve(s)(r.path)??"":"M"+r.path.map(([e,t])=>`${e},${t}`).join("L"),n=Ti(`${i?i+"-":""}line-${t}-stroke-gradient`),o=Ye(r.strokeGradient,r.path,n,r.style.stroke||"#4e79a7");/* @__PURE__ */
|
|
18
18
|
return Ws(Ns.Fragment,{children:[o&&/* @__PURE__ */$s("defs",{children:o}),
|
|
19
19
|
/* @__PURE__ */$s("path",{d:a,fill:"none",stroke:o?`url(#${n})`:r.style.stroke||"#4e79a7",strokeWidth:r.style.strokeWidth??2,strokeDasharray:r.style.strokeDasharray,opacity:r.style.opacity})]},"line-"+t)}case"area":{let s=e;if(0===s.topPath.length)return null;let a=kr(s.curve),n=!a||2>s.topPath.length||2>s.bottomPath.length?`M${s.topPath.map(([e,t])=>`${e},${t}`).join("L")}L${[...s.bottomPath].reverse().map(([e,t])=>`${e},${t}`).join("L")}Z`:zs().x(([e])=>e).y0((e,t)=>s.bottomPath[t][1]).y1(([,e])=>e).curve(a)(s.topPath)??"",o=`${i?i+"-":""}area-${t}-hatch`,l=br(s.style.fill)?wr(s.style.fill,o):void 0,c=Ti(`${i?i+"-":""}area-${t}-gradient`),h=Re(s,c),u=h?`url(#${c})`:l?`url(#${o})`:Ri(s.style.fill),d=h?void 0:s.style.fillOpacity??s.style.opacity??.7,p=a?Fs().x(([e])=>e).y(([,e])=>e).curve(a)(s.topPath)??"":"M"+s.topPath.map(([e,t])=>`${e},${t}`).join("L"),g=Ni(s),y=g&&r>=0?/* @__PURE__ */$s("path",{d:p,fill:"none",stroke:"transparent",strokeWidth:Math.max(1,2*r),strokeLinecap:"round",pointerEvents:"stroke",style:{cursor:g},"data-semiotic-mark-cursor":g,"data-semiotic-cursor-hit-target":"area-top-path","aria-hidden":"true"},`area-${t}-cursor-target`):null,f=Ti(`${i?i+"-":""}area-${t}-stroke-gradient`),m=!(!s.colorThresholds?.length||!s.rawValues||s.rawValues.length!==s.topPath.length),x=!!s.strokeColorBands?.length,v=m||x?null:Ye(s.strokeGradient,s.topPath,f,s.style.stroke||"#4e79a7"),b=s.style.strokeWidth??2,w=1/0,k=-1/0;for(let[e]of s.topPath)w>e&&(w=e),e>k&&(k=e);let A=x?s.strokeColorBands.map((e,r)=>Ti(`${i?i+"-":""}area-${t}-stroke-band-${r}`)):[],_=x?s.strokeColorBands.map((e,t)=>/* @__PURE__ */$s("clipPath",{id:A[t],children:/* @__PURE__ */$s("rect",{x:w-b,y:e.y,width:k-w+2*b,height:e.height})},A[t])):null,C=s.style.stroke&&"none"!==s.style.stroke?x?s.strokeColorBands.map((e,i)=>/* @__PURE__ */$s("path",{d:p,fill:"none",stroke:e.color??Ri(s.style.stroke),strokeWidth:b,opacity:(s.style.opacity??1)*(e.opacity??1),clipPath:`url(#${A[i]})`},`area-${t}-stroke-band-${i}`)):m?tt(s.topPath,s.rawValues,s.colorThresholds,Ri(s.style.stroke)).map((e,i)=>/* @__PURE__ */$s("path",{d:"M"+e.path.map(([e,t])=>`${e},${t}`).join("L"),fill:"none",stroke:e.color,strokeWidth:b,opacity:s.style.opacity},`area-${t}-threshold-${i}`)):/* @__PURE__ */$s("path",{d:p,fill:"none",stroke:v?`url(#${f})`:Ri(s.style.stroke),strokeWidth:b,opacity:s.style.opacity}):null;if(s.clipRect){let e=`${i?i+"-":""}area-clip-${t}`;/* @__PURE__ */
|
|
20
20
|
return Ws("g",{children:[
|
|
@@ -41,7 +41,7 @@ return Hs("div",{className:"semiotic-tooltip",style:dr,children:[null!=e.title&&
|
|
|
41
41
|
/* @__PURE__ */Vs("span",{style:{fontWeight:600},children:Fe(e.value)})]},e.key))]})}/* @__PURE__ */
|
|
42
42
|
return Hs("div",{className:"semiotic-tooltip",style:dr,children:[
|
|
43
43
|
/* @__PURE__ */Vs("div",{style:{fontWeight:600,marginBottom:2},children:Fe(i)}),
|
|
44
|
-
/* @__PURE__ */Vs("div",{style:{opacity:.7,fontSize:11},children:Fe(r)})]})}function We(e,t){if(!t||0===e.length||!e.some(e=>null!=e&&"object"==typeof e&&Array.isArray(e[t])))return e;let i=[];for(let r of e){if(null==r||"object"!=typeof r)continue;let e=r[t];if(!Array.isArray(e))continue;let s=r.label??r.id??r.key;for(let t of e)null==t||"object"!=typeof t||i.push(null==s?t:{...t,_lineGroup:s})}return i}function Xe(e){let{canvas:t,pointer:i,store:r,margin:s,width:a,height:n}=e;ji(t,i,i=>{let o=t.getBoundingClientRect(),l=i.clientX-o.left-s.left,c=i.clientY-o.top-s.top;if(0>l||l>a||0>c||c>n)return;let h=X(r.scene,l,c,wi(e.hoverRadius,i.pointerType),e.geometryMoved?null:r.quadtree,r.maxPointRadius);return Ni(h?.node)})}function je(e){if(e)return"x"===e.dimension?"pan-y":"y"===e.dimension?"pan-x":"none"}function Ve({brush:e,onBrush:t,linkedBrush:i,xAccessor:r,yAccessor:s,defaultDimension:a="xy"}){let n=Hi(i),o=!!e||!!n||!!t,l=n?.xField||("string"==typeof r?r:void 0),c=n?.yField||("string"==typeof s?s:void 0),h="y"!==a||n?.xField?l:void 0,u="x"!==a||n?.yField?c:void 0,d=Ki({name:n?.name||"__unused_brush__",xField:h,yField:u}),p=n?"xyBrush"===d.brushInteraction.brush?"xy":"xBrush"===d.brushInteraction.brush?"x":"y":a,g=ea(d.brushInteraction);g.current=d.brushInteraction;let y=Qs(e=>{let i=g.current;if(!e)return n&&i.end(null),void t?.(null);n&&i.end("xyBrush"===i.brush?[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:"xBrush"===i.brush?e.x:e.y),t?.(e)},[n,t]);return o?{brushStreamProps:{brush:{dimension:p},onBrush:y}}:{brushStreamProps:{}}}import{a as He,b as Ge}from"./c-VN557BQE.min.js";import{a as Ue,b as qe,c as Ke,d as Je,e as Ze,g as Qe}from"./c-MTX2AO5S.min.js";import{a as et}from"./c-7FKPPCGN.min.js";import{a as tt}from"./c-STHZWF3D.min.js";import{a as it,b as rt}from"./c-TVKZC4BY.min.js";import{a as st}from"./c-GYLOSK7M.min.js";import{a as at}from"./c-UUDAON4Z.min.js";import{a as nt,b as ot,c as lt,d as ct,f as ht,g as ut,h as dt,i as pt}from"./c-2TW5H5PD.min.js";import{c as gt,d as yt,j as ft,k as mt}from"./c-HK4OSLZA.min.js";import{a as xt,c as vt,e as bt,f as wt,g as kt,h as At,i as _t,j as Ct,k as Pt,l as St}from"./c-VXIYF7V2.min.js";import{e as Mt}from"./c-NATWERHZ.min.js";import{b as Rt}from"./c-BYJJ7EMG.min.js";import{a as Yt}from"./c-QXLDCATV.min.js";import{a as Tt,b as Lt,d as Dt}from"./c-U5XVLSHN.min.js";import{A as Et,D as Ot,E as Bt,F as It,W as Nt,a as zt,b as Ft,c as $t,d as Wt,e as Xt,f as jt,g as Vt,h as Ht,i as Gt,j as Ut,k as qt,l as Kt,m as Jt,o as Zt,p as Qt,q as ei,r as ti,s as ii,t as ri,u as si,v as ai,x as ni,y as oi,z as li}from"./c-KGROWFT2.min.js";import{c as ci}from"./c-CLLCX3PT.min.js";import{Ca as hi,D as ui,Fa as di,Ga as pi,H as gi,Ha as yi,Ia as fi,J as mi,Ja as xi,Ka as vi,L as bi,La as wi,M as ki,Ma as Ai,Na as _i,R as Ci,S as Pi,T as Si,U as Mi,W as Ri,Wa as Yi,X as Ti,Y as Li,Z as Di,aa as Ei,b as Oi,ba as Bi,c as Ii,ca as Ni,d as zi,da as Fi,e as $i,ea as Wi,f as Xi,ga as ji,ha as Vi,hb as Hi,ia as Gi,ja as Ui,ka as qi,nb as Ki,o as Ji,oa as Zi,p as Qi,q as er,qa as tr,ra as ir,s as rr,t as sr,ta as ar,u as nr,va as or,wa as lr,x as cr,xa as hr,y as ur,ya as dr}from"./c-G53AVC42.min.js";import{o as pr,p as gr,s as yr}from"./c-Y342FJ6K.min.js";import{b as fr,i as mr,k as xr,o as vr,r as br,t as wr,w as kr}from"./c-3BYZXCX3.min.js";import{e as Ar,h as _r}from"./c-5NYONM6V.min.js";import{e as Cr}from"./c-U6NLVFN4.min.js";import*as Pr from"react";import{forwardRef as Sr,memo as Mr,useCallback as Rr,useEffect as Yr,useId as Tr,useMemo as Lr,useRef as Dr,useState as Er}from"react";import*as Or from"react";import{jsx as Br}from"react/jsx-runtime";var Ir=null,Nr=null,zr=/* @__PURE__ */new Set;import{scaleLinear as Fr,scaleLog as $r,scaleSymlog as Wr,scaleTime as Xr}from"d3-scale";var jr=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Vr=["scene-style","data-paint","accessibility","evidence"],Hr=(e,t)=>({retainedData:e,invalidations:t}),Gr=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Ur=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],qr=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Kr=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Jr=["scene-geometry","data-paint","accessibility","evidence"],Zr=["scene-style","data-paint","accessibility","evidence"],Qr=[],es={chartType:Hr("rebuild",Gr),runtimeMode:Hr("rebuild",Gr),xAccessor:Hr("rebuild",Gr),yAccessor:Hr("rebuild",Gr),timeAccessor:Hr("rebuild",Gr),valueAccessor:Hr("rebuild",Gr),y0Accessor:Hr("rebuild",Gr),boundsAccessor:Hr("rebuild",Gr),band:Hr("rebuild",Gr),openAccessor:Hr("rebuild",Gr),highAccessor:Hr("rebuild",Gr),lowAccessor:Hr("rebuild",Gr),closeAccessor:Hr("rebuild",Gr),candlestickRangeMode:Hr("rebuild",Gr),accessorRevision:Hr("rebuild",Gr),groupAccessor:Hr("rebuild",Ur),categoryAccessor:Hr("rebuild",Ur),lineDataAccessor:Hr("rebuild",Ur),colorAccessor:Hr("rebuild",Zr),sizeAccessor:Hr("rebuild",Jr),symbolAccessor:Hr("rebuild",Jr),pointIdAccessor:Hr("rebuild",Jr),xScaleType:Hr("preserve",qr),yScaleType:Hr("preserve",qr),xExtent:Hr("preserve",qr),invertY:Hr("preserve",qr),yExtent:Hr("preserve",qr),extentPadding:Hr("preserve",qr),scalePadding:Hr("preserve",qr),axisExtent:Hr("preserve",qr),yAxisExtent:Hr("preserve",qr),binSize:Hr("preserve",qr),normalize:Hr("preserve",qr),heatmapAggregation:Hr("preserve",qr),heatmapXBins:Hr("preserve",qr),heatmapYBins:Hr("preserve",qr),arrowOfTime:Hr("preserve",Kr),baseline:Hr("preserve",Kr),stackOrder:Hr("preserve",Kr),sizeRange:Hr("preserve",Kr),curve:Hr("preserve",Kr),areaGroups:Hr("preserve",Kr),customLayout:Hr("preserve",Kr),layoutConfig:Hr("preserve",Kr),layoutMargin:Hr("preserve",Kr),symbolMap:Hr("preserve",Jr),showValues:Hr("preserve",Jr),heatmapValueFormat:Hr("preserve",Jr),trackHoverRows:Hr("preserve",Jr),lineStyle:Hr("preserve",Zr),pointStyle:Hr("preserve",Zr),areaStyle:Hr("preserve",Zr),barStyle:Hr("preserve",Zr),swarmStyle:Hr("preserve",Zr),waterfallStyle:Hr("preserve",Zr),candlestickStyle:Hr("preserve",Zr),boundsStyle:Hr("preserve",Zr),gradientFill:Hr("preserve",Zr),lineGradient:Hr("preserve",Zr),semanticLineStops:Hr("preserve",Zr),colorScheme:Hr("preserve",Zr),themeCategorical:Hr("preserve",Zr),themeSemantic:Hr("preserve",Zr),themeSequential:Hr("preserve",Zr),themeDiverging:Hr("preserve",Zr),barColors:Hr("preserve",Zr),decay:Hr("preserve",Zr),pulse:Hr("preserve",Zr),staleness:Hr("preserve",Zr),layoutSelection:Hr("preserve",Zr),annotations:Hr("preserve",["overlay","accessibility","evidence"]),windowSize:Hr("preserve",Qr),windowMode:Hr("preserve",Qr),maxCapacity:Hr("preserve",Qr),clock:Hr("preserve",Qr),transition:Hr("preserve",Qr),introAnimation:Hr("preserve",Qr),onLayoutError:Hr("preserve",Qr)},ts=Hr("preserve",Kr),is=class{constructor(){this.tracker=new Qi}get last(){return this.tracker.last}subscribe(e){return this.tracker.subscribe(e)}recordData(e,t){return this.tracker.record({kind:e,...void 0===t?{}:{count:t}},jr)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},Vr):this.recordNoop("restyle")}recordConfig(e,t=!1){let i=z(e);return this.tracker.record({kind:"config",keys:e},t?/* @__PURE__ */new Set([...i.invalidations,...Jr]):i.invalidations)}};import{quadtree as rs}from"d3-quadtree";var ss=class{constructor(){this.maxRadius=0,this.tree=null}get quadtree(){return this.tree}get maxPointRadius(){return this.maxRadius}clear(){this.tree=null,this.maxRadius=0}rebuild(e,t){if("scatter"!==e&&"bubble"!==e&&"custom"!==e)return void this.clear();let i=0,r=0;for(let e of t)"point"===e.type&&!1!==e.interactive&&(i++,e.r>r&&(r=e.r));if(this.maxRadius=r,500>=i)return void(this.tree=null);let s=Array(i),a=0;for(let e of t)"point"===e.type&&!1!==e.interactive&&(s[a++]=e);this.tree=rs().x(e=>e.x).y(e=>e.y).addAll(s)}},as=class e{constructor(e){if(this.xExtent=new ot,this.yExtent=new ot,this.growingCapacityWarned=!1,this.windowSizeWarned=!1,this.resolvedRibbons=[],this.timestampBuffer=null,this.activeTransition=null,this._hasRenderedOnce=!1,this.prevPositionMap=/* @__PURE__ */new Map,this.prevPathMap=/* @__PURE__ */new Map,this.exitNodes=[],this.lastIngestTime=0,this._colorMapCache=null,this._groupDataCache=null,this._groupColorMap=/* @__PURE__ */new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this._ingestVersion=0,this._datumIndexCache=null,this._bufferArrayCache=null,this._bufferDirty=!0,this.needsFullRebuild=!0,this.lastLayout=null,this.updateResults=new is,this.scales=null,this.scene=[],this.version=0,this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customLayoutFailedThisBuild=!1,this._customLayoutDiagnosticsWarned=/* @__PURE__ */new Set,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=/* @__PURE__ */new WeakMap,this.xIsDate=!1,this.spatialIndex=new ss,this._lastBoundedInsertsRef=null,this.applyPulse=(e,t,i)=>!(!this.config.pulse||!this.timestampBuffer)&&vt(this.config.pulse,e,t,this.timestampBuffer,this.getDatumIndexMap(t),i),this.config=e,this.buffer=new xt(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=Lt(e.timeAccessor||e.xAccessor,"time"),this.getY=Lt(e.valueAccessor||e.yAccessor,"value")):(this.getX=Lt(e.xAccessor,"x"),this.getY=Lt(e.yAccessor,"y")),this.getGroup=Dt(e.groupAccessor),this.getCategory=Dt(e.categoryAccessor),this.getSize=e.sizeAccessor?Lt(e.sizeAccessor,"size"):void 0,this.getColor=Dt(e.colorAccessor),this.getSymbol=Dt(e.symbolAccessor),this.getY0=e.y0Accessor?Lt(e.y0Accessor,"y0"):void 0,this.resolvedRibbons=v(e),this.getPointId=Dt(e.pointIdAccessor),"candlestick"===e.chartType){let t=null!=e.openAccessor,i=null!=e.closeAccessor;this.getOpen=t?Lt(e.openAccessor,"open"):void 0,this.getHigh=Lt(e.highAccessor,"high"),this.getLow=Lt(e.lowAccessor,"low"),this.getClose=i?Lt(e.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!i}e.pulse&&(this.timestampBuffer=new xt(e.windowSize))}currentTime(){return this.config.clock?.()??Xi()}syncPulseTimestampBuffer(){this.config.pulse?null!=this.timestampBuffer&&this.timestampBuffer.capacity===this.buffer.capacity&&this.timestampBuffer.size===this.buffer.size||(this.timestampBuffer=kt(this.buffer,this.currentTime())):this.timestampBuffer=null}pushDatumYExtent(e){if("candlestick"===this.config.chartType&&this.getHigh&&this.getLow)return this.yExtent.push(this.getHigh(e)),void this.yExtent.push(this.getLow(e));this.yExtent.push(this.getY(e)),this.getY0&&this.yExtent.push(this.getY0(e));for(let t of this.resolvedRibbons){let i=t.getTop(e),r=t.getBottom(e);Number.isFinite(i)&&this.yExtent.push(i),Number.isFinite(r)&&this.yExtent.push(r)}}evictDatumYExtent(e){if("candlestick"===this.config.chartType&&this.getHigh&&this.getLow)return this.yExtent.evict(this.getHigh(e)),void this.yExtent.evict(this.getLow(e));this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e));for(let t of this.resolvedRibbons){let i=t.getTop(e),r=t.getBottom(e);Number.isFinite(i)&&this.yExtent.evict(i),Number.isFinite(r)&&this.yExtent.evict(r)}}rebuildYExtent(){this.yExtent.clear();for(let e of this.buffer)this.pushDatumYExtent(e)}rebuildExtents(){this.xExtent.clear(),this.yExtent.clear();for(let e of this.buffer)this.xExtent.push(this.getX(e)),this.pushDatumYExtent(e)}ingest(e){if(e.bounded&&this._lastBoundedInsertsRef===e.inserts)return this.updateResults.recordNoop("replace"),!1;let t=this.currentTime();if(this.lastIngestTime=t,this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,e.bounded){this._lastBoundedInsertsRef=e.inserts,this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this.timestampBuffer&&this.timestampBuffer.clear();let i=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode;if(this.getX=i?Lt(this.config.timeAccessor||this.config.xAccessor,"time"):Lt(this.config.xAccessor,"x"),this.xIsDate=!1,e.inserts.length>0){let t=e.inserts[0],i=this.config.xAccessor,r="function"==typeof i?i(t):t[i||"x"],s=r instanceof Date,a="string"==typeof r&&Number.isFinite(He(r));if(this.xIsDate=s||a,a){let e="string"==typeof i?i:void 0;this.getX=e?t=>Ge(t[e]):e=>Ge(i(e))}}wt(this.buffer,e.totalSize||e.inserts.length,this.timestampBuffer);for(let i of e.inserts)At(this.buffer,i,this.timestampBuffer,t),this.xExtent.push(this.getX(i)),this.pushDatumYExtent(i)}else for(let i of e.inserts){if("growing"===this.config.windowMode&&this.buffer.full){let e=this.config.maxCapacity??1e5;e>this.growingCap&&(this.growingCap=Math.min(2*this.growingCap,e),this.buffer.resize(this.growingCap),this.timestampBuffer&&this.timestampBuffer.resize(this.growingCap),"production"!==process.env.NODE_ENV&&!this.growingCapacityWarned&&this.growingCap>=5e4&&(this.growingCapacityWarned=!0,console.warn(`[Semiotic] Growing window buffer reached ${this.growingCap} points (cap ${e}). Large canvas scenes are expensive — prefer a sliding window, aggregation, or an explicit maxCapacity if this is intentional.`)))}let e=At(this.buffer,i,this.timestampBuffer,t);this.xExtent.push(this.getX(i)),this.pushDatumYExtent(i),null!=e&&(this.xExtent.evict(this.getX(e)),this.evictDatumYExtent(e))}return this.updateResults.recordData(e.bounded?"replace":"ingest",e.inserts.length),!0}ingestWithResult(e){return this.ingest(e),this.updateResults.last}computeScene(e){let{config:t,buffer:i}=this,r=this.scales,s=this.lastLayout;if(!this.needsFullRebuild&&!t.customLayout&&this.lastLayout&&this.scene.length>0&&this.scales&&0>=(this.config.scalePadding??0)&&(this.lastLayout.width!==e.width||this.lastLayout.height!==e.height))return void this.remapScene(e);this.xExtent.dirty&&this.xExtent.recalculate(i,this.getX),this.yExtent.dirty&&this.rebuildYExtent();let a=this.getBufferArray(),n=this.xExtent.extent,o=this.yExtent.extent,l="waterfall"===t.chartType&&i.size>0?C(a,this.getX,n,t.xExtent,t.xScaleType):w(n,t.xExtent),c=w(o,t.yExtent),h=!(!(d=t.yExtent)||null==d[0]||null==d[1]),u="exact"===(t.yAxisExtent??t.axisExtent);var d;if("stackedarea"===t.chartType&&!h&&i.size>0){let e=k({config:t,groups:this.groupData(a),getX:this.getX,getY:this.getY,bufferSize:i.size,ingestVersion:this._ingestVersion,stackExtentCache:this._stackExtentCache});c=e.yDomain,this._stackExtentCache=e.stackExtentCache}else"bar"===t.chartType&&t.binSize&&!h&&i.size>0?c=A(i,this.getX,this.getY,t.binSize,this.getCategory,t.extentPadding,u):"waterfall"===t.chartType&&!h&&i.size>0?c=_(i,this.getY,t.extentPadding,u):!h&&c[0]!==1/0&&(c=P(c,a,this.resolvedRibbons),c=S(c,{exactMode:u,extentPadding:t.extentPadding,userMin:t.yExtent?.[0],userMax:t.yExtent?.[1],yScaleType:t.yScaleType,dataYDomain:o}));c=M(c,t.yExtent,!!h),({xDomain:l,yDomain:c}=R(l,c,t.xScaleType)),this.scales=T({config:t,layout:e,xDomain:l,yDomain:c}),this._customLayoutFailedThisBuild=!1;let p=this.buildSceneNodes(e,a);if(this._customLayoutFailedThisBuild)return!0===this.lastCustomLayoutFailure?.preservedLastGoodScene?(this.scales=r,this.lastLayout=s):(this.scene=[],this.spatialIndex.rebuild(this.config.chartType,this.scene)),void(this.needsFullRebuild=!0);this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=p,this.config.decay&&this.applyDecay(this.scene,a),this.config.pulse&&this.applyPulse(this.scene,a,this.currentTime()),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&(this.prevPositionMap.size>0||this.prevPathMap.size>0)&&this.startTransition(),this.spatialIndex.rebuild(this.config.chartType,this.scene),this.needsFullRebuild=!1,this.lastLayout={width:e.width,height:e.height},this.version++}get quadtree(){return this.spatialIndex.quadtree}get maxPointRadius(){return this.spatialIndex.maxPointRadius}remapScene(e){let t=e.width/this.lastLayout.width,i=e.height/this.lastLayout.height;for(let e of this.scene)switch(e.type){case"line":for(let r of e.path)r[0]*=t,r[1]*=i;break;case"area":for(let r of e.topPath)r[0]*=t,r[1]*=i;for(let r of e.bottomPath)r[0]*=t,r[1]*=i;e.clipRect&&(e.clipRect={x:e.clipRect.x*t,y:e.clipRect.y*i,width:e.clipRect.width*t,height:e.clipRect.height*i}),e.strokeColorBands&&(e.strokeColorBands=e.strokeColorBands.map(e=>({...e,y:e.y*i,height:e.height*i})));break;case"point":case"glyph":e.x*=t,e.y*=i;break;case"rect":case"heatcell":e.x*=t,e.y*=i,e.w*=t,e.h*=i;break;case"candlestick":e.x*=t,e.openY*=i,e.closeY*=i,e.highY*=i,e.lowY*=i}let r=this.scales.x.domain(),s=this.scales.y.domain(),a=this.scales.x.range(),n=this.scales.y.range(),o=Y,l=Math.max(0,Math.min(this.config.scalePadding||0,Math.min(e.width,e.height)/2-1)),c=n[1]>n[0];this.scales={x:o(this.config.xScaleType,r,a[0]>a[1]?[e.width-l,l]:[l,e.width-l]),y:o(this.config.yScaleType,s,c?[l,e.height-l]:[e.height-l,l])},this.lastLayout={width:e.width,height:e.height},this.spatialIndex.rebuild(this.config.chartType,this.scene),this.version++}buildSceneNodes(e,t){let{config:i,scales:r}=this;if(!r)return[];if(i.customLayout){let s={data:t,scales:r,dimensions:{width:e.width,height:e.height,margin:i.layoutMargin??{top:0,right:0,bottom:0,left:0},plot:{x:0,y:0,width:e.width,height:e.height}},theme:{semantic:i.themeSemantic??{},categorical:i.themeCategorical??gr},resolveColor:(e,t)=>{let r=this.resolveGroupColor(e);if(r)return r;let s=this.resolveLineStyle(e,t);return s.stroke?s.stroke:"string"==typeof s.fill?s.fill:i.themeSemantic?.primary??"#4e79a7"},config:i.layoutConfig??{},selection:i.layoutSelection??null},a=Xt({family:"xy",logLabel:"customLayout",revision:this.version,hasPreviousResult:null!==this.lastCustomLayoutResult,onLayoutError:i.onLayoutError,run:()=>i.customLayout(s)});if("failure"===a.kind)return this.lastCustomLayoutFailure=a.diagnostic,this._customLayoutFailedThisBuild=!0,a.preservedLastGoodScene?this.scene:(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=/* @__PURE__ */new WeakMap,[]);let n=a.result;this.customLayoutOverlays=n.overlays??null,this.lastCustomLayoutResult=n,this.lastCustomLayoutFailure=null;let o=n.nodes??[];if(this._customRestyle=n.restyle,this.hasCustomRestyle=!!n.restyle,this.hasCustomRestyle){this._baseStyles=/* @__PURE__ */new WeakMap;for(let e of o)e.style&&this._baseStyles.set(e,e.style);this.applyCustomRestyle(o,i.layoutSelection??null)}return Wt({label:"customLayout",nodes:o,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),o}if(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,0===t.length)return[];let s={scales:r,config:i,getX:this.getX,getY:this.getY,getY0:this.getY0,getSize:this.getSize,getColor:this.getColor,getSymbol:this.getSymbol,getGroup:this.getGroup,getCategory:this.getCategory,getPointId:this.getPointId,ribbons:this.resolvedRibbons,getOpen:this.getOpen,getHigh:this.getHigh,getLow:this.getLow,getClose:this.getClose,resolveLineStyle:(e,t)=>this.resolveLineStyle(e,t),resolveAreaStyle:(e,t)=>this.resolveAreaStyle(e,t),resolveBoundsStyle:(e,t)=>this.resolveBoundsStyle(e,t),resolveColorMap:e=>this.resolveColorMap(e),resolveGroupColor:e=>this.resolveGroupColor(e),groupData:e=>this.groupData(e),barCategoryCache:this._barCategoryCache},a=Ke(i.chartType);if(!a)return qe(n=i.chartType)||Ji&&(zr.has(n)||(zr.add(n),console.warn(`[semiotic] StreamXYFrame: no XY plugin registered for "${n}" during SSR. Import a chart HOC, or call registerBuiltInXYPlugins() from "semiotic/xy" or "semiotic/realtime/core" before render.`))),[];var n;let o=Ze(a(s,t,e));return"bar"===i.chartType&&(this._barCategoryCache=s.barCategoryCache??null,this._binBoundaries=o.binBoundaries),o.nodes}resolveBoundsStyle(e,t){return N(this.config,e,t,(e,t)=>this.resolveLineStyle(e,t))}computeDecayOpacity(e,t){let i=this.config.decay;return i&&t>1?zt(i,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._ingestVersion)return this._datumIndexCache.map;let t=Ft(e);return this._datumIndexCache={version:this._ingestVersion,map:t},t}applyDecay(e,t){this.config.decay&&$t(this.config.decay,e,t,this.getDatumIndexMap(t))}refreshPulse(e){return!0!==this.lastCustomLayoutFailure?.preservedLastGoodScene&&this.applyPulse(this.scene,this.getBufferArray(),e)}hasActivePulsesAt(e){return!!this.config.pulse&&bt(this.config.pulse,this.timestampBuffer,e)}get hasActivePulses(){return this.hasActivePulsesAt(this.currentTime())}get transitionContext(){return{runtimeMode:this.config.runtimeMode,getX:this.getX,getY:this.getY,getCategory:this.getCategory,getPointId:this.getPointId}}snapshotPositions(){y(this.transitionContext,this.scene,this.prevPositionMap,this.prevPathMap)}synthesizeIntroPositions(){this.prevPositionMap.clear(),this.prevPathMap.clear();let e=this.scales?.y(0)??0;for(let t=0;this.scene.length>t;t++){let i=this.scene[t],r=p(this.transitionContext,i,t);r&&("point"===i.type?this.prevPositionMap.set(r,{x:i.x,y:i.y,r:0,opacity:0}):"rect"===i.type?this.prevPositionMap.set(r,{x:i.x,y:e,w:i.w,h:0,opacity:i.style.opacity??1}):"heatcell"===i.type?this.prevPositionMap.set(r,{x:i.x,y:i.y,w:i.w,h:i.h,opacity:0}):"line"===i.type?(i._introClipFraction=0,this.prevPathMap.set(r,{path:i.path.map(e=>[e[0],e[1]]),pathIds:i.pathIds?.slice(),opacity:i.style.opacity})):"area"===i.type&&(i._introClipFraction=0,this.prevPathMap.set(r,{topPath:i.topPath.map(e=>[e[0],e[1]]),bottomPath:i.bottomPath.map(e=>[e[0],e[1]]),pathIds:i.pathIds?.slice(),opacity:i.style.opacity})))}}startTransition(){if(!this.config.transition)return;let e=f(this.transitionContext,this.config.transition,{scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},this.prevPositionMap,this.prevPathMap,this.currentTime());this.scene=e.scene,this.exitNodes=e.exitNodes,this.activeTransition=e.activeTransition}advanceTransition(e){if(!this.activeTransition||!this.config.transition)return!1;let t={scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},i=m(e,this.config.transition,t,this.prevPositionMap);return this.scene=t.scene,this.exitNodes=t.exitNodes,this.activeTransition=t.activeTransition,i}cancelIntroAnimation(){this.prevPositionMap.clear(),this.prevPathMap.clear(),this.activeTransition=null,ct(this.scene),this.exitNodes=[]}groupData(e){let{result:t,cache:i}=D(e,this.getGroup,this._ingestVersion,this._groupDataCache);return this._groupDataCache=i,t}resolveColorMap(e){let{map:t,cache:i}=E(e,this.getColor,this.config,this._ingestVersion,this._colorMapCache);return this._colorMapCache=i,t}resolveLineStyle(e,t){return B(this.config,e,t,e=>this.resolveGroupColor(e))}resolveAreaStyle(e,t){return I(this.config,e,t,e=>this.resolveGroupColor(e))}resolveGroupColor(t){let{color:i,groupColorCounter:r}=O({group:t,colorMapCache:this._colorMapCache,groupColorMap:this._groupColorMap,groupColorCounter:this._groupColorCounter,groupColorMapCap:e.GROUP_COLOR_MAP_CAP,config:this.config});return this._groupColorCounter=r,i}getBufferArray(){return(this._bufferDirty||!this._bufferArrayCache)&&(this._bufferArrayCache=this.buffer.toArray(),this._bufferDirty=!1),this._bufferArrayCache}getData(){return this.getBufferArray()}remove(e){if(!this.getPointId)throw Error("remove() requires pointIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();let t=lt(e),i=this.getPointId,r=e=>t.has(i(e));_t(this.buffer,this.timestampBuffer,r);let s=this.buffer.remove(r);if(0===s.length)return this.updateResults.recordNoop("remove"),s;for(let e of s)this.xExtent.evict(this.getX(e)),this.evictDatumYExtent(e);return this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("remove",s.length),s}update(e,t){if(!this.getPointId)throw Error("update() requires pointIdAccessor to be configured");let i=lt(e),r=this.getPointId,s=/* @__PURE__ */new Set;this.buffer.forEach((e,t)=>{i.has(r(e))&&s.add(t)});let a=this.buffer.update(e=>i.has(r(e)),t);if(0===a.length)return this.updateResults.recordNoop("update"),a;for(let e of a)this.xExtent.evict(this.getX(e)),this.evictDatumYExtent(e);return this.buffer.forEach((e,t)=>{s.has(t)&&(this.xExtent.push(this.getX(e)),this.pushDatumYExtent(e))}),this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("update",a.length),a}getBinBoundaries(){return this._binBoundaries}getExtents(){return this.xExtent.min===1/0?null:{x:this.xExtent.extent,y:this.yExtent.extent}}clear(){this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.prevPathMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this._lastBoundedInsertsRef=null,this.needsFullRebuild=!0,this._bufferDirty=!0,this._bufferArrayCache=null,this._datumIndexCache=null,this.lastLayout=null,this.scales=null,this.scene=[],this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=/* @__PURE__ */new WeakMap,this.spatialIndex.clear(),this._colorMapCache=null,this._groupDataCache=null,this._groupColorMap=/* @__PURE__ */new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this.version++,this.updateResults.recordData("clear")}get size(){return this.buffer.size}getBuffer(){return this.buffer}getXAccessor(){return this.getX}getYAccessor(){return this.getY}getCategoryAccessor(){return this.getCategory}applyCustomRestyle(e,t){let i=this._customRestyle;if(i)for(let r of e){let e=this._baseStyles.get(r)??r.style??{},s=i(r,t);r.style=s?{...e,...s}:e}}restyleScene(e){this._customRestyle?(this.applyCustomRestyle(this.scene,e),this.markStylePaintPending(),this.updateResults.recordRestyle(!0)):this.updateResults.recordRestyle(!1)}updateConfig(e){let t={...this.config},i=Object.keys(e).filter(i=>e[i]!==t[i]);"production"!==process.env.NODE_ENV&&!this.windowSizeWarned&&"windowSize"in e&&e.windowSize!==t.windowSize&&(this.windowSizeWarned=!0,console.warn(`[Semiotic] windowSize changed after mount (${t.windowSize} → ${e.windowSize}) but it is a mount-only setting — the ring buffer keeps its original capacity. Remount the chart (e.g. via a React key) to apply a new windowSize.`)),("colorScheme"in e||"themeCategorical"in e||"colorAccessor"in e)&&(this._colorMapCache=null,this._groupColorMap=/* @__PURE__ */new Map,this._groupColorCounter=0),("barColors"in e||"colorScheme"in e)&&(this._barCategoryCache=null),("normalize"in e||"extentPadding"in e||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e||"boundsAccessor"in e||"band"in e||"y0Accessor"in e||"openAccessor"in e||"highAccessor"in e||"lowAccessor"in e||"closeAccessor"in e||"groupAccessor"in e||"categoryAccessor"in e||"chartType"in e||"runtimeMode"in e)&&(this._stackExtentCache=null);let r=!1,s=!1;Object.assign(this.config,e),"pulse"in e&&this.syncPulseTimestampBuffer();let a="chartType"in e&&e.chartType!==t.chartType||"runtimeMode"in e&&e.runtimeMode!==t.runtimeMode;if(a||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e){let e=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode,i=e&&this.config.valueAccessor||this.config.yAccessor,n=e&&t.valueAccessor||t.yAccessor,o=a||!Tt(e&&this.config.timeAccessor||this.config.xAccessor,e&&t.timeAccessor||t.xAccessor),l=a||!Tt(i,n);(o||l)&&(e?(this.getX=Lt(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=Lt(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=Lt(this.config.xAccessor,"x"),this.getY=Lt(this.config.yAccessor,"y")),l&&this.resolvedRibbons.some(e=>"bounds"===e.kind)&&(this.resolvedRibbons=v(this.config)),r=!0,s=!0)}if("groupAccessor"in e&&!Tt(e.groupAccessor,t.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?Dt(this.config.groupAccessor):void 0,r=!0),"categoryAccessor"in e&&!Tt(e.categoryAccessor,t.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?Dt(this.config.categoryAccessor):void 0,r=!0),"sizeAccessor"in e&&!Tt(e.sizeAccessor,t.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?Lt(this.config.sizeAccessor,"size"):void 0,r=!0),"symbolAccessor"in e&&!Tt(e.symbolAccessor,t.symbolAccessor)&&(this.getSymbol=null!=this.config.symbolAccessor?Dt(this.config.symbolAccessor):void 0,r=!0),"colorAccessor"in e&&!Tt(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?Dt(this.config.colorAccessor):void 0,r=!0),"y0Accessor"in e&&!Tt(e.y0Accessor,t.y0Accessor)&&(this.getY0=this.config.y0Accessor?Lt(this.config.y0Accessor,"y0"):void 0,r=!0,s=!0),("boundsAccessor"in e&&!Tt(e.boundsAccessor,t.boundsAccessor)||"band"in e&&e.band!==t.band||"boundsStyle"in e&&e.boundsStyle!==t.boundsStyle)&&(this.resolvedRibbons=v(this.config),r=!0,s=!0),"pointIdAccessor"in e&&!Tt(e.pointIdAccessor,t.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?Dt(this.config.pointIdAccessor):void 0,r=!0),"candlestick"===this.config.chartType&&(a||"openAccessor"in e&&!Tt(e.openAccessor,t.openAccessor)||"closeAccessor"in e&&!Tt(e.closeAccessor,t.closeAccessor)||"highAccessor"in e&&!Tt(e.highAccessor,t.highAccessor)||"lowAccessor"in e&&!Tt(e.lowAccessor,t.lowAccessor))){let e=null!=this.config.openAccessor,t=null!=this.config.closeAccessor;this.getOpen=e?Lt(this.config.openAccessor,"open"):void 0,this.getHigh=Lt(this.config.highAccessor,"high"),this.getLow=Lt(this.config.lowAccessor,"low"),this.getClose=t?Lt(this.config.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!e&&!t,r=!0,s=!0}if("accessorRevision"in e&&e.accessorRevision!==t.accessorRevision&&(r=!0,s=!0),!r){let i=Object.keys(e).filter(e=>!e.endsWith("Accessor")&&"timeAccessor"!==e&&"valueAccessor"!==e);for(let s of i)if(e[s]!==t[s]){r=!0;break}}r&&(s&&this.rebuildExtents(),this.needsFullRebuild=!0),this.updateResults.recordConfig(i,("bar"===this.config.chartType||"heatmap"===this.config.chartType)&&!this.config.trackHoverRows&&Cr(t.areaStyle)!==Cr(this.config.areaStyle))}updateConfigWithResult(e){return this.updateConfig(e),this.updateResults.last}};as.GROUP_COLOR_MAP_CAP=1e3;var ns=as;jt(ns);import{useCallback as os,useImperativeHandle as ls}from"react";import{line as cs}from"d3-shape";var hs=/* @__PURE__ */new WeakMap;import*as us from"react";import{jsx as ds,jsxs as ps}from"react/jsx-runtime";import{useEffect as gs,useRef as ys,useState as fs}from"react";import{useEffect as ms,useState as xs}from"react";import{jsx as vs}from"react/jsx-runtime";import{useMemo as bs,useRef as ws,useEffect as ks,useId as As}from"react";import*as _s from"react";import{jsx as Cs}from"react/jsx-runtime";var Ps=null,Ss=null,Ms=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];import{useMemo as Rs}from"react";import{jsx as Ys,jsxs as Ts}from"react/jsx-runtime";import{Fragment as Ls,jsx as Ds,jsxs as Es}from"react/jsx-runtime";import{useCallback as Os,useEffect as Bs,useState as Is}from"react";import*as Ns from"react";import{area as zs,line as Fs}from"d3-shape";import{jsx as $s,jsxs as Ws}from"react/jsx-runtime";var Xs={axisStroke:"#ccc",tickText:"#666",crosshair:"rgba(0, 0, 0, 0.25)",hoverFill:"rgba(255, 255, 255, 0.3)",hoverStroke:"rgba(0, 0, 0, 0.4)",pointRing:"white",primary:"#007bff",background:""};import{useEffect as js}from"react";import{jsx as Vs,jsxs as Hs}from"react/jsx-runtime";$e.ownsChrome=!0;import{jsx as Gs,jsxs as Us}from"react/jsx-runtime";var qs=Yt,Ks=Xs,Js=Mr(Sr(function(t,i){let{chartType:r,runtimeMode:s,data:a,chunkThreshold:n,chunkSize:o,xAccessor:l,yAccessor:c,accessorRevision:h,colorAccessor:u,sizeAccessor:d,symbolAccessor:p,symbolMap:g,groupAccessor:y,lineDataAccessor:f,curve:m,normalize:x,baseline:v,stackOrder:b,binSize:w,valueAccessor:k,arrowOfTime:A="right",windowMode:_,capacityMode:C,windowSize:P,capacity:S,timeAccessor:M,xExtent:R,yExtent:Y,invertY:T,extentPadding:L=.1,scalePadding:D,sizeRange:E,size:O=[500,300],responsiveWidth:B,responsiveHeight:I,margin:N,className:z,background:$,maxDevicePixelRatio:W,renderMode:j,lineStyle:H,pointStyle:G,areaStyle:U,barStyle:q,waterfallStyle:K,swarmStyle:J,barColors:Z,colorScheme:Q,boundsAccessor:ee,boundsStyle:te,y0Accessor:ie,band:re,gradientFill:se,lineGradient:ae,semanticLineStops:ne,areaGroups:oe,openAccessor:le,highAccessor:ce,lowAccessor:he,closeAccessor:ue,candlestickStyle:de,showAxes:pe=!0,axes:ge,xLabel:fe,yLabel:me,yLabelRight:xe,xFormat:ve,yFormat:be,axisExtent:ke,tickFormatTime:Ae,tickFormatValue:_e,hoverAnnotation:Me,tooltipContent:Re,customHoverBehavior:Ye,customClickBehavior:Le,onObservation:De,annotationObservationCallback:Ee,chartId:Fe,enableHover:Ve,hoverRadius:He=30,tooltipMode:Ge,annotations:Ue,onAnnotationActivate:qe,autoPlaceAnnotations:Ke,svgAnnotationRules:Ze,showGrid:Qe,legend:et,legendHoverBehavior:tt,legendClickBehavior:it,legendHighlightedCategory:rt,legendIsolatedCategories:st,legendPosition:at,legendLayout:ot,legendCategoryAccessor:lt,onCategoriesChange:ct,backgroundGraphics:ht,foregroundGraphics:gt,canvasPreRenderers:yt,svgPreRenderers:xt,title:vt,categoryAccessor:bt,brush:wt,onBrush:kt,decay:At,pulse:_t,transition:Yt,animate:Tt,staleness:Lt,frameScheduler:Dt,clock:zt,random:Ft,seed:$t,paused:Wt=!1,suspendWhenHidden:Xt=!0,heatmapAggregation:jt,heatmapXBins:Ut,heatmapYBins:qt,showValues:Kt,heatmapValueFormat:Jt,heatmapColorScale:Zt,onColorDomainChange:ii,marginalGraphics:ri,pointIdAccessor:si,xScaleType:ai,yScaleType:ui,accessibleTable:gi=!0,description:bi,summary:ki,linkedCrosshairName:_i,linkedCrosshairSourceId:Ci,customLayout:Pi,onLayoutError:Si,layoutConfig:Mi,layoutSelection:Ri}=t,Ti=_??C??"sliding",Li=P??S??200,{customHoverBehavior:Di,customClickBehavior:Ei,hasClickBehavior:Bi}=Pt({customHoverBehavior:Ye,customClickBehavior:Le,onObservation:De,chartId:Fe,chartType:"StreamXYFrame"}),Ii=Tr().replace(/:/g,""),zi=Dr(!1),$i=Dr({w:-1,h:-1}),Xi=Dr(!1),ji=di({sizeProp:O,responsiveWidth:B,responsiveHeight:I,userMargin:N,marginDefault:qs,title:vt,legend:et,legendPosition:at,...pt(t,et),animate:Tt,transitionProp:Yt,frameScheduler:Dt,clock:zt,random:Ft,seed:$t,paused:Wt,suspendWhenHidden:Xt,themeDirtyRef:zi}),Hi=Ui(),Gi=qi(),{reducedMotionRef:Ki,responsiveRef:Qi,size:sr,currentTheme:nr,transition:cr,introEnabled:ur,tableId:dr,rafRef:pr,renderFnRef:gr,scheduleRender:yr,frameRuntime:fr}=ji;Yr(()=>xr(()=>{zi.current=!0,yr()}),[yr]);let mr=ji.margin;if(ri){let e={...ji.margin};ri.top&&60>e.top&&(e.top=60),ri.bottom&&60>e.bottom&&(e.bottom=60),ri.left&&60>e.left&&(e.left=60),ri.right&&60>e.right&&(e.right=60),mr=e}let vr=sr[0]-mr.left-mr.right,br=sr[1]-mr.top-mr.bottom,wr=(ge?.find(e=>"left"===e.orient)??ge?.find(e=>"right"===e.orient))?.extent??ke,kr=Lr(()=>Oi(a),[a]),_r=Me??Ve,[Cr,Sr]=Er(0),Mr=Dr(0),[Or,Br]=Er(null),Ir=Et(gt,sr,mr,Or),Nr=Et(ht,sr,mr,Or),zr=Dr(null),Fr=Dr(!1),$r=Dr(null),Wr=Dr(void 0),[Xr,jr]=Er(null),Vr=Dr(Ks.primary),Hr=Dr(Oe()),Gr=Dr(!1),Ur=er("StreamXYFrame"),[qr,Kr]=Er(!1),Jr="streaming"===s||["bar","swarm","waterfall"].includes(r),Zr=!!Di,Qr=Lr(()=>({chartType:r,runtimeMode:Jr?"streaming":"bounded",windowSize:Li,windowMode:Ti,arrowOfTime:Jr?A:"right",extentPadding:L,scalePadding:D,axisExtent:ke,yAxisExtent:wr,xAccessor:l,yAccessor:c,accessorRevision:h,timeAccessor:Jr?M:void 0,valueAccessor:k,colorAccessor:u,sizeAccessor:d,symbolAccessor:p,symbolMap:g,groupAccessor:y||(f?"_lineGroup":void 0),categoryAccessor:bt,lineDataAccessor:f,xScaleType:ai,yScaleType:ui,xExtent:R,yExtent:Y,invertY:T,sizeRange:E,binSize:w,normalize:x,baseline:v,stackOrder:b,boundsAccessor:ee,boundsStyle:te,y0Accessor:ie,band:re,gradientFill:ft(se),areaGroups:oe?new Set(oe):void 0,lineGradient:mt(ae),semanticLineStops:ne,openAccessor:le,highAccessor:ce,lowAccessor:he,closeAccessor:ue,candlestickStyle:de,lineStyle:H,trackHoverRows:Zr,pointStyle:G,areaStyle:U,swarmStyle:J,waterfallStyle:K,colorScheme:Q,barColors:Z,barStyle:q,annotations:Ue,decay:At,pulse:_t,transition:cr,introAnimation:ur,staleness:Lt,clock:fr.now,heatmapAggregation:jt,heatmapXBins:Ut,heatmapYBins:qt,showValues:Kt,heatmapValueFormat:Jt,heatmapColorScale:Zt,pointIdAccessor:si,curve:m,themeCategorical:nr?.colors?.categorical,themeSemantic:Ar(nr),themeSequential:nr?.colors?.sequential,themeDiverging:nr?.colors?.diverging,customLayout:Pi,onLayoutError:Si,layoutConfig:Mi,layoutMargin:mr}),[r,Jr,Li,Ti,A,L,D,ke,wr,l,c,h,M,k,u,d,p,g,y,f,bt,ai,ui,R,Y,T,E,w,x,v,b,ee,te,ie,re,se,oe,ae,ne,le,ce,he,ue,de,H,Zr,G,U,J,K,Q,Z,q,Ue,At,_t,cr,ur,Lt,fr.now,jt,Ut,qt,Kt,Jt,Zt,si,m,nr,Pi,Si,Mi,mr]),es=ni(Qr),ts=Dr(null);ts.current||(ts.current=new ns(es));let is=Ot(ts,lt,ct,e=>e.getData()),rs=Dr({onColorDomainChange:ii,chartType:r}),ss=Dr(void 0);rs.current={onColorDomainChange:ii,chartType:r};let as=Rr(()=>{let{onColorDomainChange:e,chartType:t}=rs.current;if(!e||"heatmap"!==t)return;let i=1/0,r=-1/0;for(let e of ts.current?.scene??[]){if("heatcell"!==e.type)continue;let t=Number(e.value??e.datum?.value);Number.isFinite(t)&&(i>t&&(i=t),t>r&&(r=t))}let s=Number.isFinite(i)&&Number.isFinite(r)?[i,r]:null,a=ss.current;null===a&&null===s||a&&s&&a[0]===s[0]&&a[1]===s[1]||(ss.current=s,e(s))},[]);Ie(r,Pi,zi,yr,ts),Ht(ts,es,zi,yr),Gt(ts,Ri,zi,yr);let os=Dr(null);os.current||(os.current=new nt(e=>{let t=ts.current;t&&t.ingest(e)&&(zi.current=!0,yr())},{chunkThreshold:n,chunkSize:o})),Yr(()=>{os.current?.updateChunkOptions({chunkThreshold:n,chunkSize:o})},[n,o]),F(i,{storeRef:ts,adapterRef:os,dirtyRef:zi,scheduleRender:yr,hoverRef:zr,setHoverPoint:jr}),Yr(()=>{a&&os.current?.setBoundedData(We(kr,f))},[a,kr,f]);let{marginalXValues:ls,marginalYValues:cs,refreshMarginalValues:hs}=Se(ts,ri,kr,l,c),{canvasRef:us,interactionCanvasRef:ds,resolutionDirtyRef:ps}=xi(ji,{storeRef:ts,dirtyRef:zi,hydrated:Hi,wasHydratingFromSSR:Gi,cleanup:()=>os.current?.clear(),maxDevicePixelRatio:W,canvasPaintDependencies:[r,vr,br,pe,$,ht,H,j,yt,yr]}),{hoverHandlerRef:gs,hoverLeaveRef:ys,onPointerMove:fs,onPointerLeave:ms,pointerStateRef:xs}=ji;gs.current=e=>{let t=us.current;if(!t)return;let i=t.getBoundingClientRect(),s=e.clientX-i.left-mr.left,a=e.clientY-i.top-mr.top;if(0>s||s>vr||0>a||a>br){if(Wi(t),!_r)return;return void(zr.current&&(zr.current=null,$r.current=null,jr(null),Di?.(null),yr()))}let n=ts.current;if(!n||0===n.scene.length)return void Wi(t);let o=wi(He,e.pointerType),c=X(n.scene,s,a,o,n.quadtree,n.maxPointRadius);if(Wi(t,Ni(c?.node)),!_r)return;let h="multi"===Ge,u=()=>{zr.current&&(zr.current=null,$r.current=null,jr(null),Di&&Di(null),yr())};if(!c&&!h)return void u();let d=h||!c?s:c.x,p=h||!c?a:c.y,g=c?.datum?Mt(c.datum,n.resolvedRibbons):{},y=n.scales?.x?.invert,f="function"==typeof y?y(d):void 0,m=Ai(g,d,p,null!=f?{xValue:f,xPx:d}:void 0);if(h&&n.scene.length>0&&n.scales){let e=V(n.scene,d,Math.max(o,vr));if(e.length>0){let t=n.scales.y.invert,i=Vr.current,s=y?y(d):d;if(c)m.xValue=s,m.xPx=d;else{let e={xValue:s};"string"==typeof l&&(e[l]=s),m=Ai(e,d,p,{xValue:s,xPx:d})}m.allSeries=e.map(e=>{let s=t?t(e.y):e.y,a=null!=e.y0?t?t(e.y0):e.y0:void 0;return{group:e.group||"",value:"stackedarea"===r&&null!=a?s-a:s,valuePx:e.y,color:e.color||i,datum:Mt(e.datum,n.resolvedRibbons)}})}}c||m.allSeries?.length?(zr.current=m,$r.current=c?.node??null,jr(m),Di?.(m),yr()):u()},ys.current=()=>{Wi(us.current),zr.current&&(zr.current=null,$r.current=null,jr(null),Di?.(null),yr())},Vi(us);let vs=Dr(()=>{});vs.current=e=>{if(mi(e.target)||!Ei)return;let t=us.current;if(!t)return;let i=t.getBoundingClientRect(),r=e.clientX-i.left-mr.left,s=e.clientY-i.top-mr.top;if(0>r||r>vr||0>s||s>br)return void Ei(null);let a=ts.current;if(!a||0===a.scene.length)return void Ei(null);let n=wi(He,Wr.current),o=X(a.scene,r,s,n,a.quadtree,a.maxPointRadius);if(!o)return void Ei(null);let l=o.datum||{},c=a.scales?.x?.invert,h="function"==typeof c?c(o.x):void 0;Ei(Ai(l,o.x,o.y,null!=h?{xValue:h,xPx:o.x}:void 0),{type:"activate",inputType:Yi(Wr.current)})};let bs=Rr(e=>vs.current(e),[]),{kbFocusIndexRef:ws,focusedNavPointRef:ks,onKeyDown:As}=St({storeRef:ts,hoverRef:zr,hoveredNodeRef:$r,setHoverPoint:jr,customHoverBehavior:Di,customClickBehavior:Ei,scheduleRender:yr}),_s=Rr(e=>{Nt(xs,e,!!_r,Fr.current,us.current)&&(Wr.current=e.pointerType,ws.current=-1,ks.current=null,fs(e))},[us,_r,ks,ws,fs,xs]),Cs=Rr(e=>{Nt(xs,e,!!_r,Fr.current,us.current,"mouse")&&(Wr.current="mouse",ws.current=-1,ks.current=null,fs({clientX:e.clientX,clientY:e.clientY,pointerType:"mouse"}))},[us,_r,ks,ws,fs,xs]),Ps=Rr(e=>{Wr.current=e.pointerType},[]);gr.current=()=>{if(pr.current=null,!fr.isActive)return;let e=us.current,t=ds.current;if(!e||!t)return;let i=ts.current;if(!i)return;let s=fr.now(),a=null!=i.activeTransition,n=i.advanceTransition(Ki.current?s+1e6:s),o=!Ki.current&&n,l=$i.current.w!==vr||$i.current.h!==br,c=ps.current,h=zi.current||a||l,u=a&&!n,d=i.consumeStylePaintPending(),p=!1,g=i.getLastUpdateResult(),y=Ur.current.beforeCompute(g,o);(zi.current||l)&&(!o||l)&&(i.computeScene({width:vr,height:br}),$i.current={w:vr,h:br},p=!0,is(),as()),(p||d)&&(Fr.current=Fi(i.scene),Fr.current||Wi(e)),Fr.current&&(a||p||d)&&Xe({canvas:e,pointer:xs.current,store:i,margin:mr,width:vr,height:br,hoverRadius:He,geometryMoved:a||p}),Ur.current.afterCompute(y,p,l);let f=Ct(i,s,p,Xi),m=fi(W,sr);pi(e,sr,m),pi(t,sr,m);let x=Hr.current.resolve(e);Vr.current=x.primary;let v=Qt(Lt,i.lastIngestTime>0?s-i.lastIngestTime:0),b=Lt&&v.isStale;if(h||d||f.changed||c){let t=yi(e,sr,mr,m);if(t){if(t.clearRect(-mr.left,-mr.top,sr[0],sr[1]),Lt&&1>v.alpha&&(t.globalAlpha=v.alpha),li(t,{background:$,hasBackgroundGraphics:!!ht,themeBackground:x.background,x:-mr.left,y:-mr.top,width:sr[0],height:sr[1]}),t.save(),"function"==typeof t.rect&&(t.beginPath(),t.rect(0,0,vr,br),t.clip()),yt&&i.scales)for(let e of yt)t.save(),e(t,i.scene,i.scales,{width:vr,height:br}),t.restore();let e=Je(r,!!Pi);Bt({context:t,nodes:i.scene,renderMode:j,pixelRatio:m,paintBuiltIn:r=>{if(e&&i.scales)for(let s of e)s(t,r,i.scales,{width:vr,height:br})}}),t.restore(),Lt&&1>v.alpha&&(t.globalAlpha=1)}}let w=!!(_r&&zr.current&&i.scales),k=!!($r.current&&Array.isArray(Me)&&Me.some(e=>e&&"object"==typeof e&&"highlight"===e.type)),A=w||k;if(Rt(A,Gr.current)){let e=yi(t,sr,mr,m);if(e&&(e.clearRect(-mr.left,-mr.top,sr[0],sr[1]),w&&zr.current&&Ne(e,zr.current,vr,br,"object"==typeof _r?_r:{},$r.current,x),k&&$r.current&&Array.isArray(Me))){let t=Me.find(e=>e&&"object"==typeof e&&"highlight"===e.type);t&&ze(e,i.scene,$r.current,t,x)}Gr.current=A}h&&e&&e.setAttribute("aria-label",ir(i.scene,r+" chart"));let _=zi.current;if(zi.current=_&&o&&!p,ps.current=!1,_&&i.scales){let e=e=>"object"==typeof e&&null!==e&&"function"==typeof e.valueOf?e.valueOf():e;(!Or||e(Or.x.domain()[0])!==e(i.scales.x.domain()[0])||e(Or.x.domain()[1])!==e(i.scales.x.domain()[1])||e(Or.y.domain()[0])!==e(i.scales.y.domain()[0])||e(Or.y.domain()[1])!==e(i.scales.y.domain()[1])||Or.x.range()[0]!==i.scales.x.range()[0]||Or.x.range()[1]!==i.scales.x.range()[1]||Or.y.range()[0]!==i.scales.y.range()[0]||Or.y.range()[1]!==i.scales.y.range()[1])&&Br(i.scales),ri&&hs(i.getData())}(Ue&&Ue.length>0||Pi)&&(p||a)&&(p||u||s-Mr.current>=33)&&(Sr(e=>e+1),Mr.current=s),Lt?.showBadge&&Kr(!!b),(o||null!=i.activeTransition||f.pending)&&yr()},ei(Lt,ts,zi,yr,fr.now,qr,Kr);let Ss=Lr(()=>{if(!ve&&!Ae&&ts.current?.xIsDate&&Or)return we(Or.x.domain())},[ve,Ae,Or]),Ms=ve||Ae||Ss,Rs=_r&&Xr?Re?Re(Xr):/* @__PURE__ */Gs($e,{hover:Xr}):null,Ys=Rs?/* @__PURE__ */Gs(hi,{x:Xr.x,y:Xr.y,containerWidth:vr,containerHeight:br,margin:mr,className:"stream-frame-tooltip",children:Rs}):null,Ts=ks.current,Ls=/* @__PURE__ */Gs(hr,{active:ws.current>=0,hoverPoint:Xr,margin:mr,size:sr,shape:Ts?.shape,width:Ts?.w,height:Ts?.h}),Ds=ut(l,M,"__semiotic_resolvedX","__semiotic_resolvedTime"),Es=ut(c,k,"__semiotic_resolvedY","__semiotic_resolvedValue"),Os=Ds.key,Bs=Es.key,Is=dt(Ds,Es,Ue&&Ue.length>0||!1);if(Ji||!Hi&&Gi){let e=ts.current;e&&a&&(e.ingest({inserts:We(kr,f),bounded:!0}),e.computeScene({width:vr,height:br}));let t=e?.scene??[],i=e?.scales??null,r=Et(gt,sr,mr,i),s=Et(ht,sr,mr,i),n=Ms||(()=>{if(e?.xIsDate&&i)return we(i.x.domain())})(),o=bi||("string"==typeof vt?vt:"XY chart"),h=ri&&e?ye(e.getData(),l,c):{xValues:[],yValues:[]};/* @__PURE__ */
|
|
44
|
+
/* @__PURE__ */Vs("div",{style:{opacity:.7,fontSize:11},children:Fe(r)})]})}function We(e,t){if(!t||0===e.length||!e.some(e=>null!=e&&"object"==typeof e&&Array.isArray(e[t])))return e;let i=[];for(let r of e){if(null==r||"object"!=typeof r)continue;let e=r[t];if(!Array.isArray(e))continue;let s=r.label??r.id??r.key;for(let t of e)null==t||"object"!=typeof t||i.push(null==s?t:{...t,_lineGroup:s})}return i}function Xe(e){let{canvas:t,pointer:i,store:r,margin:s,width:a,height:n}=e;ji(t,i,i=>{let o=t.getBoundingClientRect(),l=i.clientX-o.left-s.left,c=i.clientY-o.top-s.top;if(0>l||l>a||0>c||c>n)return;let h=X(r.scene,l,c,wi(e.hoverRadius,i.pointerType),e.geometryMoved?null:r.quadtree,r.maxPointRadius);return Ni(h?.node)})}function je(e){if(e)return"x"===e.dimension?"pan-y":"y"===e.dimension?"pan-x":"none"}function Ve({brush:e,onBrush:t,linkedBrush:i,xAccessor:r,yAccessor:s,defaultDimension:a="xy"}){let n=Gi(i),o=!!e||!!n||!!t,l=n?.xField||("string"==typeof r?r:void 0),c=n?.yField||("string"==typeof s?s:void 0),h="y"!==a||n?.xField?l:void 0,u="x"!==a||n?.yField?c:void 0,d=Zi({name:n?.name||"__unused_brush__",xField:h,yField:u}),p=n?"xyBrush"===d.brushInteraction.brush?"xy":"xBrush"===d.brushInteraction.brush?"x":"y":a,g=ea(d.brushInteraction);g.current=d.brushInteraction;let y=Qs(e=>{let i=g.current;if(!e)return n&&i.end(null),void t?.(null);n&&i.end("xyBrush"===i.brush?[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:"xBrush"===i.brush?e.x:e.y),t?.(e)},[n,t]);return o?{brushStreamProps:{brush:{dimension:p},onBrush:y}}:{brushStreamProps:{}}}import{a as He,b as Ge}from"./c-VN557BQE.min.js";import{a as Ue,b as qe,c as Ke,d as Je,e as Ze,g as Qe}from"./c-MTX2AO5S.min.js";import{a as et}from"./c-7FKPPCGN.min.js";import{a as tt}from"./c-STHZWF3D.min.js";import{a as it,b as rt}from"./c-TVKZC4BY.min.js";import{a as st}from"./c-GYLOSK7M.min.js";import{a as at}from"./c-UUDAON4Z.min.js";import{a as nt,b as ot,c as lt,d as ct,f as ht,g as ut,h as dt,i as pt}from"./c-QPO24R7Q.min.js";import{c as gt,d as yt,j as ft,k as mt}from"./c-HK4OSLZA.min.js";import{a as xt,c as vt,e as bt,f as wt,g as kt,h as At,i as _t,j as Ct,k as Pt,l as St}from"./c-JOPGDP6N.min.js";import{e as Mt}from"./c-NATWERHZ.min.js";import{b as Rt}from"./c-BYJJ7EMG.min.js";import{a as Yt}from"./c-QXLDCATV.min.js";import{a as Tt,b as Lt,d as Dt}from"./c-U5XVLSHN.min.js";import{A as Et,D as Ot,E as Bt,F as It,W as Nt,a as zt,b as Ft,c as $t,d as Wt,e as Xt,f as jt,g as Vt,h as Ht,i as Gt,j as Ut,k as qt,l as Kt,m as Jt,o as Zt,p as Qt,q as ei,r as ti,s as ii,t as ri,u as si,v as ai,x as ni,y as oi,z as li}from"./c-SAP5KY6R.min.js";import{c as ci}from"./c-CLLCX3PT.min.js";import{Ca as hi,D as ui,Fa as di,Ga as pi,H as gi,Ha as yi,Ia as fi,J as mi,Ja as xi,Ka as vi,L as bi,La as wi,M as ki,Ma as Ai,Na as _i,R as Ci,S as Pi,T as Si,U as Mi,W as Ri,Wa as Yi,X as Ti,Y as Li,Z as Di,aa as Ei,b as Oi,ba as Bi,c as Ii,ca as Ni,d as zi,da as Fi,e as $i,ea as Wi,f as Xi,ga as ji,ha as Vi,ia as Hi,ib as Gi,ja as Ui,ka as qi,o as Ki,oa as Ji,ob as Zi,p as Qi,q as er,qa as tr,ra as ir,s as rr,t as sr,ta as ar,u as nr,va as or,wa as lr,x as cr,xa as hr,y as ur,ya as dr}from"./c-UMGHCBH5.min.js";import{o as pr,p as gr,s as yr}from"./c-Y342FJ6K.min.js";import{b as fr,i as mr,k as xr,o as vr,r as br,t as wr,w as kr}from"./c-3BYZXCX3.min.js";import{e as Ar,h as _r}from"./c-5NYONM6V.min.js";import{e as Cr}from"./c-U6NLVFN4.min.js";import*as Pr from"react";import{forwardRef as Sr,memo as Mr,useCallback as Rr,useEffect as Yr,useId as Tr,useMemo as Lr,useRef as Dr,useState as Er}from"react";import*as Or from"react";import{jsx as Br}from"react/jsx-runtime";var Ir=null,Nr=null,zr=/* @__PURE__ */new Set;import{scaleLinear as Fr,scaleLog as $r,scaleSymlog as Wr,scaleTime as Xr}from"d3-scale";var jr=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Vr=["scene-style","data-paint","accessibility","evidence"],Hr=(e,t)=>({retainedData:e,invalidations:t}),Gr=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Ur=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],qr=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Kr=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Jr=["scene-geometry","data-paint","accessibility","evidence"],Zr=["scene-style","data-paint","accessibility","evidence"],Qr=[],es={chartType:Hr("rebuild",Gr),runtimeMode:Hr("rebuild",Gr),xAccessor:Hr("rebuild",Gr),yAccessor:Hr("rebuild",Gr),timeAccessor:Hr("rebuild",Gr),valueAccessor:Hr("rebuild",Gr),y0Accessor:Hr("rebuild",Gr),boundsAccessor:Hr("rebuild",Gr),band:Hr("rebuild",Gr),openAccessor:Hr("rebuild",Gr),highAccessor:Hr("rebuild",Gr),lowAccessor:Hr("rebuild",Gr),closeAccessor:Hr("rebuild",Gr),candlestickRangeMode:Hr("rebuild",Gr),accessorRevision:Hr("rebuild",Gr),groupAccessor:Hr("rebuild",Ur),categoryAccessor:Hr("rebuild",Ur),lineDataAccessor:Hr("rebuild",Ur),colorAccessor:Hr("rebuild",Zr),sizeAccessor:Hr("rebuild",Jr),symbolAccessor:Hr("rebuild",Jr),pointIdAccessor:Hr("rebuild",Jr),xScaleType:Hr("preserve",qr),yScaleType:Hr("preserve",qr),xExtent:Hr("preserve",qr),invertY:Hr("preserve",qr),yExtent:Hr("preserve",qr),extentPadding:Hr("preserve",qr),scalePadding:Hr("preserve",qr),axisExtent:Hr("preserve",qr),yAxisExtent:Hr("preserve",qr),binSize:Hr("preserve",qr),normalize:Hr("preserve",qr),heatmapAggregation:Hr("preserve",qr),heatmapXBins:Hr("preserve",qr),heatmapYBins:Hr("preserve",qr),arrowOfTime:Hr("preserve",Kr),baseline:Hr("preserve",Kr),stackOrder:Hr("preserve",Kr),sizeRange:Hr("preserve",Kr),curve:Hr("preserve",Kr),areaGroups:Hr("preserve",Kr),customLayout:Hr("preserve",Kr),layoutConfig:Hr("preserve",Kr),layoutMargin:Hr("preserve",Kr),symbolMap:Hr("preserve",Jr),showValues:Hr("preserve",Jr),heatmapValueFormat:Hr("preserve",Jr),trackHoverRows:Hr("preserve",Jr),lineStyle:Hr("preserve",Zr),pointStyle:Hr("preserve",Zr),areaStyle:Hr("preserve",Zr),barStyle:Hr("preserve",Zr),swarmStyle:Hr("preserve",Zr),waterfallStyle:Hr("preserve",Zr),candlestickStyle:Hr("preserve",Zr),boundsStyle:Hr("preserve",Zr),gradientFill:Hr("preserve",Zr),lineGradient:Hr("preserve",Zr),semanticLineStops:Hr("preserve",Zr),colorScheme:Hr("preserve",Zr),themeCategorical:Hr("preserve",Zr),themeSemantic:Hr("preserve",Zr),themeSequential:Hr("preserve",Zr),themeDiverging:Hr("preserve",Zr),barColors:Hr("preserve",Zr),decay:Hr("preserve",Zr),pulse:Hr("preserve",Zr),staleness:Hr("preserve",Zr),layoutSelection:Hr("preserve",Zr),annotations:Hr("preserve",["overlay","accessibility","evidence"]),windowSize:Hr("preserve",Qr),windowMode:Hr("preserve",Qr),maxCapacity:Hr("preserve",Qr),clock:Hr("preserve",Qr),transition:Hr("preserve",Qr),introAnimation:Hr("preserve",Qr),onLayoutError:Hr("preserve",Qr)},ts=Hr("preserve",Kr),is=class{constructor(){this.tracker=new Qi}get last(){return this.tracker.last}subscribe(e){return this.tracker.subscribe(e)}recordData(e,t){return this.tracker.record({kind:e,...void 0===t?{}:{count:t}},jr)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},Vr):this.recordNoop("restyle")}recordConfig(e,t=!1){let i=z(e);return this.tracker.record({kind:"config",keys:e},t?/* @__PURE__ */new Set([...i.invalidations,...Jr]):i.invalidations)}};import{quadtree as rs}from"d3-quadtree";var ss=class{constructor(){this.maxRadius=0,this.tree=null}get quadtree(){return this.tree}get maxPointRadius(){return this.maxRadius}clear(){this.tree=null,this.maxRadius=0}rebuild(e,t){if("scatter"!==e&&"bubble"!==e&&"custom"!==e)return void this.clear();let i=0,r=0;for(let e of t)"point"===e.type&&!1!==e.interactive&&(i++,e.r>r&&(r=e.r));if(this.maxRadius=r,500>=i)return void(this.tree=null);let s=Array(i),a=0;for(let e of t)"point"===e.type&&!1!==e.interactive&&(s[a++]=e);this.tree=rs().x(e=>e.x).y(e=>e.y).addAll(s)}},as=class e{constructor(e){if(this.xExtent=new ot,this.yExtent=new ot,this.growingCapacityWarned=!1,this.windowSizeWarned=!1,this.resolvedRibbons=[],this.timestampBuffer=null,this.activeTransition=null,this._hasRenderedOnce=!1,this.prevPositionMap=/* @__PURE__ */new Map,this.prevPathMap=/* @__PURE__ */new Map,this.exitNodes=[],this.lastIngestTime=0,this._colorMapCache=null,this._groupDataCache=null,this._groupColorMap=/* @__PURE__ */new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this._ingestVersion=0,this._datumIndexCache=null,this._bufferArrayCache=null,this._bufferDirty=!0,this.needsFullRebuild=!0,this.lastLayout=null,this.updateResults=new is,this.scales=null,this.scene=[],this.version=0,this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customLayoutFailedThisBuild=!1,this._customLayoutDiagnosticsWarned=/* @__PURE__ */new Set,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=/* @__PURE__ */new WeakMap,this.xIsDate=!1,this.spatialIndex=new ss,this._lastBoundedInsertsRef=null,this.applyPulse=(e,t,i)=>!(!this.config.pulse||!this.timestampBuffer)&&vt(this.config.pulse,e,t,this.timestampBuffer,this.getDatumIndexMap(t),i),this.config=e,this.buffer=new xt(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=Lt(e.timeAccessor||e.xAccessor,"time"),this.getY=Lt(e.valueAccessor||e.yAccessor,"value")):(this.getX=Lt(e.xAccessor,"x"),this.getY=Lt(e.yAccessor,"y")),this.getGroup=Dt(e.groupAccessor),this.getCategory=Dt(e.categoryAccessor),this.getSize=e.sizeAccessor?Lt(e.sizeAccessor,"size"):void 0,this.getColor=Dt(e.colorAccessor),this.getSymbol=Dt(e.symbolAccessor),this.getY0=e.y0Accessor?Lt(e.y0Accessor,"y0"):void 0,this.resolvedRibbons=v(e),this.getPointId=Dt(e.pointIdAccessor),"candlestick"===e.chartType){let t=null!=e.openAccessor,i=null!=e.closeAccessor;this.getOpen=t?Lt(e.openAccessor,"open"):void 0,this.getHigh=Lt(e.highAccessor,"high"),this.getLow=Lt(e.lowAccessor,"low"),this.getClose=i?Lt(e.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!i}e.pulse&&(this.timestampBuffer=new xt(e.windowSize))}currentTime(){return this.config.clock?.()??Xi()}syncPulseTimestampBuffer(){this.config.pulse?null!=this.timestampBuffer&&this.timestampBuffer.capacity===this.buffer.capacity&&this.timestampBuffer.size===this.buffer.size||(this.timestampBuffer=kt(this.buffer,this.currentTime())):this.timestampBuffer=null}pushDatumYExtent(e){if("candlestick"===this.config.chartType&&this.getHigh&&this.getLow)return this.yExtent.push(this.getHigh(e)),void this.yExtent.push(this.getLow(e));this.yExtent.push(this.getY(e)),this.getY0&&this.yExtent.push(this.getY0(e));for(let t of this.resolvedRibbons){let i=t.getTop(e),r=t.getBottom(e);Number.isFinite(i)&&this.yExtent.push(i),Number.isFinite(r)&&this.yExtent.push(r)}}evictDatumYExtent(e){if("candlestick"===this.config.chartType&&this.getHigh&&this.getLow)return this.yExtent.evict(this.getHigh(e)),void this.yExtent.evict(this.getLow(e));this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e));for(let t of this.resolvedRibbons){let i=t.getTop(e),r=t.getBottom(e);Number.isFinite(i)&&this.yExtent.evict(i),Number.isFinite(r)&&this.yExtent.evict(r)}}rebuildYExtent(){this.yExtent.clear();for(let e of this.buffer)this.pushDatumYExtent(e)}rebuildExtents(){this.xExtent.clear(),this.yExtent.clear();for(let e of this.buffer)this.xExtent.push(this.getX(e)),this.pushDatumYExtent(e)}ingest(e){if(e.bounded&&this._lastBoundedInsertsRef===e.inserts)return this.updateResults.recordNoop("replace"),!1;let t=this.currentTime();if(this.lastIngestTime=t,this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,e.bounded){this._lastBoundedInsertsRef=e.inserts,this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this.timestampBuffer&&this.timestampBuffer.clear();let i=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode;if(this.getX=i?Lt(this.config.timeAccessor||this.config.xAccessor,"time"):Lt(this.config.xAccessor,"x"),this.xIsDate=!1,e.inserts.length>0){let t=e.inserts[0],i=this.config.xAccessor,r="function"==typeof i?i(t):t[i||"x"],s=r instanceof Date,a="string"==typeof r&&Number.isFinite(He(r));if(this.xIsDate=s||a,a){let e="string"==typeof i?i:void 0;this.getX=e?t=>Ge(t[e]):e=>Ge(i(e))}}wt(this.buffer,e.totalSize||e.inserts.length,this.timestampBuffer);for(let i of e.inserts)At(this.buffer,i,this.timestampBuffer,t),this.xExtent.push(this.getX(i)),this.pushDatumYExtent(i)}else for(let i of e.inserts){if("growing"===this.config.windowMode&&this.buffer.full){let e=this.config.maxCapacity??1e5;e>this.growingCap&&(this.growingCap=Math.min(2*this.growingCap,e),this.buffer.resize(this.growingCap),this.timestampBuffer&&this.timestampBuffer.resize(this.growingCap),"production"!==process.env.NODE_ENV&&!this.growingCapacityWarned&&this.growingCap>=5e4&&(this.growingCapacityWarned=!0,console.warn(`[Semiotic] Growing window buffer reached ${this.growingCap} points (cap ${e}). Large canvas scenes are expensive — prefer a sliding window, aggregation, or an explicit maxCapacity if this is intentional.`)))}let e=At(this.buffer,i,this.timestampBuffer,t);this.xExtent.push(this.getX(i)),this.pushDatumYExtent(i),null!=e&&(this.xExtent.evict(this.getX(e)),this.evictDatumYExtent(e))}return this.updateResults.recordData(e.bounded?"replace":"ingest",e.inserts.length),!0}ingestWithResult(e){return this.ingest(e),this.updateResults.last}computeScene(e){let{config:t,buffer:i}=this,r=this.scales,s=this.lastLayout;if(!this.needsFullRebuild&&!t.customLayout&&this.lastLayout&&this.scene.length>0&&this.scales&&0>=(this.config.scalePadding??0)&&(this.lastLayout.width!==e.width||this.lastLayout.height!==e.height))return void this.remapScene(e);this.xExtent.dirty&&this.xExtent.recalculate(i,this.getX),this.yExtent.dirty&&this.rebuildYExtent();let a=this.getBufferArray(),n=this.xExtent.extent,o=this.yExtent.extent,l="waterfall"===t.chartType&&i.size>0?C(a,this.getX,n,t.xExtent,t.xScaleType):w(n,t.xExtent),c=w(o,t.yExtent),h=!(!(d=t.yExtent)||null==d[0]||null==d[1]),u="exact"===(t.yAxisExtent??t.axisExtent);var d;if("stackedarea"===t.chartType&&!h&&i.size>0){let e=k({config:t,groups:this.groupData(a),getX:this.getX,getY:this.getY,bufferSize:i.size,ingestVersion:this._ingestVersion,stackExtentCache:this._stackExtentCache});c=e.yDomain,this._stackExtentCache=e.stackExtentCache}else"bar"===t.chartType&&t.binSize&&!h&&i.size>0?c=A(i,this.getX,this.getY,t.binSize,this.getCategory,t.extentPadding,u):"waterfall"===t.chartType&&!h&&i.size>0?c=_(i,this.getY,t.extentPadding,u):!h&&c[0]!==1/0&&(c=P(c,a,this.resolvedRibbons),c=S(c,{exactMode:u,extentPadding:t.extentPadding,userMin:t.yExtent?.[0],userMax:t.yExtent?.[1],yScaleType:t.yScaleType,dataYDomain:o}));c=M(c,t.yExtent,!!h),({xDomain:l,yDomain:c}=R(l,c,t.xScaleType)),this.scales=T({config:t,layout:e,xDomain:l,yDomain:c}),this._customLayoutFailedThisBuild=!1;let p=this.buildSceneNodes(e,a);if(this._customLayoutFailedThisBuild)return!0===this.lastCustomLayoutFailure?.preservedLastGoodScene?(this.scales=r,this.lastLayout=s):(this.scene=[],this.spatialIndex.rebuild(this.config.chartType,this.scene)),void(this.needsFullRebuild=!0);this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=p,this.config.decay&&this.applyDecay(this.scene,a),this.config.pulse&&this.applyPulse(this.scene,a,this.currentTime()),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&(this.prevPositionMap.size>0||this.prevPathMap.size>0)&&this.startTransition(),this.spatialIndex.rebuild(this.config.chartType,this.scene),this.needsFullRebuild=!1,this.lastLayout={width:e.width,height:e.height},this.version++}get quadtree(){return this.spatialIndex.quadtree}get maxPointRadius(){return this.spatialIndex.maxPointRadius}remapScene(e){let t=e.width/this.lastLayout.width,i=e.height/this.lastLayout.height;for(let e of this.scene)switch(e.type){case"line":for(let r of e.path)r[0]*=t,r[1]*=i;break;case"area":for(let r of e.topPath)r[0]*=t,r[1]*=i;for(let r of e.bottomPath)r[0]*=t,r[1]*=i;e.clipRect&&(e.clipRect={x:e.clipRect.x*t,y:e.clipRect.y*i,width:e.clipRect.width*t,height:e.clipRect.height*i}),e.strokeColorBands&&(e.strokeColorBands=e.strokeColorBands.map(e=>({...e,y:e.y*i,height:e.height*i})));break;case"point":case"glyph":e.x*=t,e.y*=i;break;case"rect":case"heatcell":e.x*=t,e.y*=i,e.w*=t,e.h*=i;break;case"candlestick":e.x*=t,e.openY*=i,e.closeY*=i,e.highY*=i,e.lowY*=i}let r=this.scales.x.domain(),s=this.scales.y.domain(),a=this.scales.x.range(),n=this.scales.y.range(),o=Y,l=Math.max(0,Math.min(this.config.scalePadding||0,Math.min(e.width,e.height)/2-1)),c=n[1]>n[0];this.scales={x:o(this.config.xScaleType,r,a[0]>a[1]?[e.width-l,l]:[l,e.width-l]),y:o(this.config.yScaleType,s,c?[l,e.height-l]:[e.height-l,l])},this.lastLayout={width:e.width,height:e.height},this.spatialIndex.rebuild(this.config.chartType,this.scene),this.version++}buildSceneNodes(e,t){let{config:i,scales:r}=this;if(!r)return[];if(i.customLayout){let s={data:t,scales:r,dimensions:{width:e.width,height:e.height,margin:i.layoutMargin??{top:0,right:0,bottom:0,left:0},plot:{x:0,y:0,width:e.width,height:e.height}},theme:{semantic:i.themeSemantic??{},categorical:i.themeCategorical??gr},resolveColor:(e,t)=>{let r=this.resolveGroupColor(e);if(r)return r;let s=this.resolveLineStyle(e,t);return s.stroke?s.stroke:"string"==typeof s.fill?s.fill:i.themeSemantic?.primary??"#4e79a7"},config:i.layoutConfig??{},selection:i.layoutSelection??null},a=Xt({family:"xy",logLabel:"customLayout",revision:this.version,hasPreviousResult:null!==this.lastCustomLayoutResult,onLayoutError:i.onLayoutError,run:()=>i.customLayout(s)});if("failure"===a.kind)return this.lastCustomLayoutFailure=a.diagnostic,this._customLayoutFailedThisBuild=!0,a.preservedLastGoodScene?this.scene:(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=/* @__PURE__ */new WeakMap,[]);let n=a.result;this.customLayoutOverlays=n.overlays??null,this.lastCustomLayoutResult=n,this.lastCustomLayoutFailure=null;let o=n.nodes??[];if(this._customRestyle=n.restyle,this.hasCustomRestyle=!!n.restyle,this.hasCustomRestyle){this._baseStyles=/* @__PURE__ */new WeakMap;for(let e of o)e.style&&this._baseStyles.set(e,e.style);this.applyCustomRestyle(o,i.layoutSelection??null)}return Wt({label:"customLayout",nodes:o,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),o}if(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,0===t.length)return[];let s={scales:r,config:i,getX:this.getX,getY:this.getY,getY0:this.getY0,getSize:this.getSize,getColor:this.getColor,getSymbol:this.getSymbol,getGroup:this.getGroup,getCategory:this.getCategory,getPointId:this.getPointId,ribbons:this.resolvedRibbons,getOpen:this.getOpen,getHigh:this.getHigh,getLow:this.getLow,getClose:this.getClose,resolveLineStyle:(e,t)=>this.resolveLineStyle(e,t),resolveAreaStyle:(e,t)=>this.resolveAreaStyle(e,t),resolveBoundsStyle:(e,t)=>this.resolveBoundsStyle(e,t),resolveColorMap:e=>this.resolveColorMap(e),resolveGroupColor:e=>this.resolveGroupColor(e),groupData:e=>this.groupData(e),barCategoryCache:this._barCategoryCache},a=Ke(i.chartType);if(!a)return qe(n=i.chartType)||Ki&&(zr.has(n)||(zr.add(n),console.warn(`[semiotic] StreamXYFrame: no XY plugin registered for "${n}" during SSR. Import a chart HOC, or call registerBuiltInXYPlugins() from "semiotic/xy" or "semiotic/realtime/core" before render.`))),[];var n;let o=Ze(a(s,t,e));return"bar"===i.chartType&&(this._barCategoryCache=s.barCategoryCache??null,this._binBoundaries=o.binBoundaries),o.nodes}resolveBoundsStyle(e,t){return N(this.config,e,t,(e,t)=>this.resolveLineStyle(e,t))}computeDecayOpacity(e,t){let i=this.config.decay;return i&&t>1?zt(i,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._ingestVersion)return this._datumIndexCache.map;let t=Ft(e);return this._datumIndexCache={version:this._ingestVersion,map:t},t}applyDecay(e,t){this.config.decay&&$t(this.config.decay,e,t,this.getDatumIndexMap(t))}refreshPulse(e){return!0!==this.lastCustomLayoutFailure?.preservedLastGoodScene&&this.applyPulse(this.scene,this.getBufferArray(),e)}hasActivePulsesAt(e){return!!this.config.pulse&&bt(this.config.pulse,this.timestampBuffer,e)}get hasActivePulses(){return this.hasActivePulsesAt(this.currentTime())}get transitionContext(){return{runtimeMode:this.config.runtimeMode,getX:this.getX,getY:this.getY,getCategory:this.getCategory,getPointId:this.getPointId}}snapshotPositions(){y(this.transitionContext,this.scene,this.prevPositionMap,this.prevPathMap)}synthesizeIntroPositions(){this.prevPositionMap.clear(),this.prevPathMap.clear();let e=this.scales?.y(0)??0;for(let t=0;this.scene.length>t;t++){let i=this.scene[t],r=p(this.transitionContext,i,t);r&&("point"===i.type?this.prevPositionMap.set(r,{x:i.x,y:i.y,r:0,opacity:0}):"rect"===i.type?this.prevPositionMap.set(r,{x:i.x,y:e,w:i.w,h:0,opacity:i.style.opacity??1}):"heatcell"===i.type?this.prevPositionMap.set(r,{x:i.x,y:i.y,w:i.w,h:i.h,opacity:0}):"line"===i.type?(i._introClipFraction=0,this.prevPathMap.set(r,{path:i.path.map(e=>[e[0],e[1]]),pathIds:i.pathIds?.slice(),opacity:i.style.opacity})):"area"===i.type&&(i._introClipFraction=0,this.prevPathMap.set(r,{topPath:i.topPath.map(e=>[e[0],e[1]]),bottomPath:i.bottomPath.map(e=>[e[0],e[1]]),pathIds:i.pathIds?.slice(),opacity:i.style.opacity})))}}startTransition(){if(!this.config.transition)return;let e=f(this.transitionContext,this.config.transition,{scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},this.prevPositionMap,this.prevPathMap,this.currentTime());this.scene=e.scene,this.exitNodes=e.exitNodes,this.activeTransition=e.activeTransition}advanceTransition(e){if(!this.activeTransition||!this.config.transition)return!1;let t={scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},i=m(e,this.config.transition,t,this.prevPositionMap);return this.scene=t.scene,this.exitNodes=t.exitNodes,this.activeTransition=t.activeTransition,i}cancelIntroAnimation(){this.prevPositionMap.clear(),this.prevPathMap.clear(),this.activeTransition=null,ct(this.scene),this.exitNodes=[]}groupData(e){let{result:t,cache:i}=D(e,this.getGroup,this._ingestVersion,this._groupDataCache);return this._groupDataCache=i,t}resolveColorMap(e){let{map:t,cache:i}=E(e,this.getColor,this.config,this._ingestVersion,this._colorMapCache);return this._colorMapCache=i,t}resolveLineStyle(e,t){return B(this.config,e,t,e=>this.resolveGroupColor(e))}resolveAreaStyle(e,t){return I(this.config,e,t,e=>this.resolveGroupColor(e))}resolveGroupColor(t){let{color:i,groupColorCounter:r}=O({group:t,colorMapCache:this._colorMapCache,groupColorMap:this._groupColorMap,groupColorCounter:this._groupColorCounter,groupColorMapCap:e.GROUP_COLOR_MAP_CAP,config:this.config});return this._groupColorCounter=r,i}getBufferArray(){return(this._bufferDirty||!this._bufferArrayCache)&&(this._bufferArrayCache=this.buffer.toArray(),this._bufferDirty=!1),this._bufferArrayCache}getData(){return this.getBufferArray()}remove(e){if(!this.getPointId)throw Error("remove() requires pointIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();let t=lt(e),i=this.getPointId,r=e=>t.has(i(e));_t(this.buffer,this.timestampBuffer,r);let s=this.buffer.remove(r);if(0===s.length)return this.updateResults.recordNoop("remove"),s;for(let e of s)this.xExtent.evict(this.getX(e)),this.evictDatumYExtent(e);return this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("remove",s.length),s}update(e,t){if(!this.getPointId)throw Error("update() requires pointIdAccessor to be configured");let i=lt(e),r=this.getPointId,s=/* @__PURE__ */new Set;this.buffer.forEach((e,t)=>{i.has(r(e))&&s.add(t)});let a=this.buffer.update(e=>i.has(r(e)),t);if(0===a.length)return this.updateResults.recordNoop("update"),a;for(let e of a)this.xExtent.evict(this.getX(e)),this.evictDatumYExtent(e);return this.buffer.forEach((e,t)=>{s.has(t)&&(this.xExtent.push(this.getX(e)),this.pushDatumYExtent(e))}),this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("update",a.length),a}getBinBoundaries(){return this._binBoundaries}getExtents(){return this.xExtent.min===1/0?null:{x:this.xExtent.extent,y:this.yExtent.extent}}clear(){this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.prevPathMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this._lastBoundedInsertsRef=null,this.needsFullRebuild=!0,this._bufferDirty=!0,this._bufferArrayCache=null,this._datumIndexCache=null,this.lastLayout=null,this.scales=null,this.scene=[],this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=/* @__PURE__ */new WeakMap,this.spatialIndex.clear(),this._colorMapCache=null,this._groupDataCache=null,this._groupColorMap=/* @__PURE__ */new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this.version++,this.updateResults.recordData("clear")}get size(){return this.buffer.size}getBuffer(){return this.buffer}getXAccessor(){return this.getX}getYAccessor(){return this.getY}getCategoryAccessor(){return this.getCategory}applyCustomRestyle(e,t){let i=this._customRestyle;if(i)for(let r of e){let e=this._baseStyles.get(r)??r.style??{},s=i(r,t);r.style=s?{...e,...s}:e}}restyleScene(e){this._customRestyle?(this.applyCustomRestyle(this.scene,e),this.markStylePaintPending(),this.updateResults.recordRestyle(!0)):this.updateResults.recordRestyle(!1)}updateConfig(e){let t={...this.config},i=Object.keys(e).filter(i=>e[i]!==t[i]);"production"!==process.env.NODE_ENV&&!this.windowSizeWarned&&"windowSize"in e&&e.windowSize!==t.windowSize&&(this.windowSizeWarned=!0,console.warn(`[Semiotic] windowSize changed after mount (${t.windowSize} → ${e.windowSize}) but it is a mount-only setting — the ring buffer keeps its original capacity. Remount the chart (e.g. via a React key) to apply a new windowSize.`)),("colorScheme"in e||"themeCategorical"in e||"colorAccessor"in e)&&(this._colorMapCache=null,this._groupColorMap=/* @__PURE__ */new Map,this._groupColorCounter=0),("barColors"in e||"colorScheme"in e)&&(this._barCategoryCache=null),("normalize"in e||"extentPadding"in e||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e||"boundsAccessor"in e||"band"in e||"y0Accessor"in e||"openAccessor"in e||"highAccessor"in e||"lowAccessor"in e||"closeAccessor"in e||"groupAccessor"in e||"categoryAccessor"in e||"chartType"in e||"runtimeMode"in e)&&(this._stackExtentCache=null);let r=!1,s=!1;Object.assign(this.config,e),"pulse"in e&&this.syncPulseTimestampBuffer();let a="chartType"in e&&e.chartType!==t.chartType||"runtimeMode"in e&&e.runtimeMode!==t.runtimeMode;if(a||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e){let e=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode,i=e&&this.config.valueAccessor||this.config.yAccessor,n=e&&t.valueAccessor||t.yAccessor,o=a||!Tt(e&&this.config.timeAccessor||this.config.xAccessor,e&&t.timeAccessor||t.xAccessor),l=a||!Tt(i,n);(o||l)&&(e?(this.getX=Lt(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=Lt(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=Lt(this.config.xAccessor,"x"),this.getY=Lt(this.config.yAccessor,"y")),l&&this.resolvedRibbons.some(e=>"bounds"===e.kind)&&(this.resolvedRibbons=v(this.config)),r=!0,s=!0)}if("groupAccessor"in e&&!Tt(e.groupAccessor,t.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?Dt(this.config.groupAccessor):void 0,r=!0),"categoryAccessor"in e&&!Tt(e.categoryAccessor,t.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?Dt(this.config.categoryAccessor):void 0,r=!0),"sizeAccessor"in e&&!Tt(e.sizeAccessor,t.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?Lt(this.config.sizeAccessor,"size"):void 0,r=!0),"symbolAccessor"in e&&!Tt(e.symbolAccessor,t.symbolAccessor)&&(this.getSymbol=null!=this.config.symbolAccessor?Dt(this.config.symbolAccessor):void 0,r=!0),"colorAccessor"in e&&!Tt(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?Dt(this.config.colorAccessor):void 0,r=!0),"y0Accessor"in e&&!Tt(e.y0Accessor,t.y0Accessor)&&(this.getY0=this.config.y0Accessor?Lt(this.config.y0Accessor,"y0"):void 0,r=!0,s=!0),("boundsAccessor"in e&&!Tt(e.boundsAccessor,t.boundsAccessor)||"band"in e&&e.band!==t.band||"boundsStyle"in e&&e.boundsStyle!==t.boundsStyle)&&(this.resolvedRibbons=v(this.config),r=!0,s=!0),"pointIdAccessor"in e&&!Tt(e.pointIdAccessor,t.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?Dt(this.config.pointIdAccessor):void 0,r=!0),"candlestick"===this.config.chartType&&(a||"openAccessor"in e&&!Tt(e.openAccessor,t.openAccessor)||"closeAccessor"in e&&!Tt(e.closeAccessor,t.closeAccessor)||"highAccessor"in e&&!Tt(e.highAccessor,t.highAccessor)||"lowAccessor"in e&&!Tt(e.lowAccessor,t.lowAccessor))){let e=null!=this.config.openAccessor,t=null!=this.config.closeAccessor;this.getOpen=e?Lt(this.config.openAccessor,"open"):void 0,this.getHigh=Lt(this.config.highAccessor,"high"),this.getLow=Lt(this.config.lowAccessor,"low"),this.getClose=t?Lt(this.config.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!e&&!t,r=!0,s=!0}if("accessorRevision"in e&&e.accessorRevision!==t.accessorRevision&&(r=!0,s=!0),!r){let i=Object.keys(e).filter(e=>!e.endsWith("Accessor")&&"timeAccessor"!==e&&"valueAccessor"!==e);for(let s of i)if(e[s]!==t[s]){r=!0;break}}r&&(s&&this.rebuildExtents(),this.needsFullRebuild=!0),this.updateResults.recordConfig(i,("bar"===this.config.chartType||"heatmap"===this.config.chartType)&&!this.config.trackHoverRows&&Cr(t.areaStyle)!==Cr(this.config.areaStyle))}updateConfigWithResult(e){return this.updateConfig(e),this.updateResults.last}};as.GROUP_COLOR_MAP_CAP=1e3;var ns=as;jt(ns);import{useCallback as os,useImperativeHandle as ls}from"react";import{line as cs}from"d3-shape";var hs=/* @__PURE__ */new WeakMap;import*as us from"react";import{jsx as ds,jsxs as ps}from"react/jsx-runtime";import{useEffect as gs,useRef as ys,useState as fs}from"react";import{useEffect as ms,useState as xs}from"react";import{jsx as vs}from"react/jsx-runtime";import{useMemo as bs,useRef as ws,useEffect as ks,useId as As}from"react";import*as _s from"react";import{jsx as Cs}from"react/jsx-runtime";var Ps=null,Ss=null,Ms=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];import{useMemo as Rs}from"react";import{jsx as Ys,jsxs as Ts}from"react/jsx-runtime";import{Fragment as Ls,jsx as Ds,jsxs as Es}from"react/jsx-runtime";import{useCallback as Os,useEffect as Bs,useState as Is}from"react";import*as Ns from"react";import{area as zs,line as Fs}from"d3-shape";import{jsx as $s,jsxs as Ws}from"react/jsx-runtime";var Xs={axisStroke:"#ccc",tickText:"#666",crosshair:"rgba(0, 0, 0, 0.25)",hoverFill:"rgba(255, 255, 255, 0.3)",hoverStroke:"rgba(0, 0, 0, 0.4)",pointRing:"white",primary:"#007bff",background:""};import{useEffect as js}from"react";import{jsx as Vs,jsxs as Hs}from"react/jsx-runtime";$e.ownsChrome=!0;import{jsx as Gs,jsxs as Us}from"react/jsx-runtime";var qs=Yt,Ks=Xs,Js=Mr(Sr(function(t,i){let{chartType:r,runtimeMode:s,data:a,chunkThreshold:n,chunkSize:o,xAccessor:l,yAccessor:c,accessorRevision:h,colorAccessor:u,sizeAccessor:d,symbolAccessor:p,symbolMap:g,groupAccessor:y,lineDataAccessor:f,curve:m,normalize:x,baseline:v,stackOrder:b,binSize:w,valueAccessor:k,arrowOfTime:A="right",windowMode:_,capacityMode:C,windowSize:P,capacity:S,timeAccessor:M,xExtent:R,yExtent:Y,invertY:T,extentPadding:L=.1,scalePadding:D,sizeRange:E,size:O=[500,300],responsiveWidth:B,responsiveHeight:I,margin:N,className:z,background:$,maxDevicePixelRatio:W,renderMode:j,lineStyle:H,pointStyle:G,areaStyle:U,barStyle:q,waterfallStyle:K,swarmStyle:J,barColors:Z,colorScheme:Q,boundsAccessor:ee,boundsStyle:te,y0Accessor:ie,band:re,gradientFill:se,lineGradient:ae,semanticLineStops:ne,areaGroups:oe,openAccessor:le,highAccessor:ce,lowAccessor:he,closeAccessor:ue,candlestickStyle:de,showAxes:pe=!0,axes:ge,xLabel:fe,yLabel:me,yLabelRight:xe,xFormat:ve,yFormat:be,axisExtent:ke,tickFormatTime:Ae,tickFormatValue:_e,hoverAnnotation:Me,tooltipContent:Re,customHoverBehavior:Ye,customClickBehavior:Le,onObservation:De,annotationObservationCallback:Ee,chartId:Fe,enableHover:Ve,hoverRadius:He=30,tooltipMode:Ge,annotations:Ue,onAnnotationActivate:qe,autoPlaceAnnotations:Ke,svgAnnotationRules:Ze,showGrid:Qe,legend:et,legendHoverBehavior:tt,legendClickBehavior:it,legendHighlightedCategory:rt,legendIsolatedCategories:st,legendPosition:at,legendLayout:ot,legendCategoryAccessor:lt,onCategoriesChange:ct,backgroundGraphics:ht,foregroundGraphics:gt,canvasPreRenderers:yt,svgPreRenderers:xt,title:vt,categoryAccessor:bt,brush:wt,onBrush:kt,decay:At,pulse:_t,transition:Yt,animate:Tt,staleness:Lt,frameScheduler:Dt,clock:zt,random:Ft,seed:$t,paused:Wt=!1,suspendWhenHidden:Xt=!0,heatmapAggregation:jt,heatmapXBins:Ut,heatmapYBins:qt,showValues:Kt,heatmapValueFormat:Jt,heatmapColorScale:Zt,onColorDomainChange:ii,marginalGraphics:ri,pointIdAccessor:si,xScaleType:ai,yScaleType:ui,accessibleTable:gi=!0,description:bi,summary:ki,linkedCrosshairName:_i,linkedCrosshairSourceId:Ci,customLayout:Pi,onLayoutError:Si,layoutConfig:Mi,layoutSelection:Ri}=t,Ti=_??C??"sliding",Li=P??S??200,{customHoverBehavior:Di,customClickBehavior:Ei,hasClickBehavior:Bi}=Pt({customHoverBehavior:Ye,customClickBehavior:Le,onObservation:De,chartId:Fe,chartType:"StreamXYFrame"}),Ii=Tr().replace(/:/g,""),zi=Dr(!1),$i=Dr({w:-1,h:-1}),Xi=Dr(!1),ji=di({sizeProp:O,responsiveWidth:B,responsiveHeight:I,userMargin:N,marginDefault:qs,title:vt,legend:et,legendPosition:at,...pt(t,et),animate:Tt,transitionProp:Yt,frameScheduler:Dt,clock:zt,random:Ft,seed:$t,paused:Wt,suspendWhenHidden:Xt,themeDirtyRef:zi}),Hi=Ui(),Gi=qi(),{reducedMotionRef:Zi,responsiveRef:Qi,size:sr,currentTheme:nr,transition:cr,introEnabled:ur,tableId:dr,rafRef:pr,renderFnRef:gr,scheduleRender:yr,frameRuntime:fr}=ji;Yr(()=>xr(()=>{zi.current=!0,yr()}),[yr]);let mr=ji.margin;if(ri){let e={...ji.margin};ri.top&&60>e.top&&(e.top=60),ri.bottom&&60>e.bottom&&(e.bottom=60),ri.left&&60>e.left&&(e.left=60),ri.right&&60>e.right&&(e.right=60),mr=e}let vr=sr[0]-mr.left-mr.right,br=sr[1]-mr.top-mr.bottom,wr=(ge?.find(e=>"left"===e.orient)??ge?.find(e=>"right"===e.orient))?.extent??ke,kr=Lr(()=>Oi(a),[a]),_r=Me??Ve,[Cr,Sr]=Er(0),Mr=Dr(0),[Or,Br]=Er(null),Ir=Et(gt,sr,mr,Or),Nr=Et(ht,sr,mr,Or),zr=Dr(null),Fr=Dr(!1),$r=Dr(null),Wr=Dr(void 0),[Xr,jr]=Er(null),Vr=Dr(Ks.primary),Hr=Dr(Oe()),Gr=Dr(!1),Ur=er("StreamXYFrame"),[qr,Kr]=Er(!1),Jr="streaming"===s||["bar","swarm","waterfall"].includes(r),Zr=!!Di,Qr=Lr(()=>({chartType:r,runtimeMode:Jr?"streaming":"bounded",windowSize:Li,windowMode:Ti,arrowOfTime:Jr?A:"right",extentPadding:L,scalePadding:D,axisExtent:ke,yAxisExtent:wr,xAccessor:l,yAccessor:c,accessorRevision:h,timeAccessor:Jr?M:void 0,valueAccessor:k,colorAccessor:u,sizeAccessor:d,symbolAccessor:p,symbolMap:g,groupAccessor:y||(f?"_lineGroup":void 0),categoryAccessor:bt,lineDataAccessor:f,xScaleType:ai,yScaleType:ui,xExtent:R,yExtent:Y,invertY:T,sizeRange:E,binSize:w,normalize:x,baseline:v,stackOrder:b,boundsAccessor:ee,boundsStyle:te,y0Accessor:ie,band:re,gradientFill:ft(se),areaGroups:oe?new Set(oe):void 0,lineGradient:mt(ae),semanticLineStops:ne,openAccessor:le,highAccessor:ce,lowAccessor:he,closeAccessor:ue,candlestickStyle:de,lineStyle:H,trackHoverRows:Zr,pointStyle:G,areaStyle:U,swarmStyle:J,waterfallStyle:K,colorScheme:Q,barColors:Z,barStyle:q,annotations:Ue,decay:At,pulse:_t,transition:cr,introAnimation:ur,staleness:Lt,clock:fr.now,heatmapAggregation:jt,heatmapXBins:Ut,heatmapYBins:qt,showValues:Kt,heatmapValueFormat:Jt,heatmapColorScale:Zt,pointIdAccessor:si,curve:m,themeCategorical:nr?.colors?.categorical,themeSemantic:Ar(nr),themeSequential:nr?.colors?.sequential,themeDiverging:nr?.colors?.diverging,customLayout:Pi,onLayoutError:Si,layoutConfig:Mi,layoutMargin:mr}),[r,Jr,Li,Ti,A,L,D,ke,wr,l,c,h,M,k,u,d,p,g,y,f,bt,ai,ui,R,Y,T,E,w,x,v,b,ee,te,ie,re,se,oe,ae,ne,le,ce,he,ue,de,H,Zr,G,U,J,K,Q,Z,q,Ue,At,_t,cr,ur,Lt,fr.now,jt,Ut,qt,Kt,Jt,Zt,si,m,nr,Pi,Si,Mi,mr]),es=ni(Qr),ts=Dr(null);ts.current||(ts.current=new ns(es));let is=Ot(ts,lt,ct,e=>e.getData()),rs=Dr({onColorDomainChange:ii,chartType:r}),ss=Dr(void 0);rs.current={onColorDomainChange:ii,chartType:r};let as=Rr(()=>{let{onColorDomainChange:e,chartType:t}=rs.current;if(!e||"heatmap"!==t)return;let i=1/0,r=-1/0;for(let e of ts.current?.scene??[]){if("heatcell"!==e.type)continue;let t=Number(e.value??e.datum?.value);Number.isFinite(t)&&(i>t&&(i=t),t>r&&(r=t))}let s=Number.isFinite(i)&&Number.isFinite(r)?[i,r]:null,a=ss.current;null===a&&null===s||a&&s&&a[0]===s[0]&&a[1]===s[1]||(ss.current=s,e(s))},[]);Ie(r,Pi,zi,yr,ts),Ht(ts,es,zi,yr),Gt(ts,Ri,zi,yr);let os=Dr(null);os.current||(os.current=new nt(e=>{let t=ts.current;t&&t.ingest(e)&&(zi.current=!0,yr())},{chunkThreshold:n,chunkSize:o})),Yr(()=>{os.current?.updateChunkOptions({chunkThreshold:n,chunkSize:o})},[n,o]),F(i,{storeRef:ts,adapterRef:os,dirtyRef:zi,scheduleRender:yr,hoverRef:zr,setHoverPoint:jr}),Yr(()=>{a&&os.current?.setBoundedData(We(kr,f))},[a,kr,f]);let{marginalXValues:ls,marginalYValues:cs,refreshMarginalValues:hs}=Se(ts,ri,kr,l,c),{canvasRef:us,interactionCanvasRef:ds,resolutionDirtyRef:ps}=xi(ji,{storeRef:ts,dirtyRef:zi,hydrated:Hi,wasHydratingFromSSR:Gi,cleanup:()=>os.current?.clear(),maxDevicePixelRatio:W,canvasPaintDependencies:[r,vr,br,pe,$,ht,H,j,yt,yr]}),{hoverHandlerRef:gs,hoverLeaveRef:ys,onPointerMove:fs,onPointerLeave:ms,pointerStateRef:xs}=ji;gs.current=e=>{let t=us.current;if(!t)return;let i=t.getBoundingClientRect(),s=e.clientX-i.left-mr.left,a=e.clientY-i.top-mr.top;if(0>s||s>vr||0>a||a>br){if(Wi(t),!_r)return;return void(zr.current&&(zr.current=null,$r.current=null,jr(null),Di?.(null),yr()))}let n=ts.current;if(!n||0===n.scene.length)return void Wi(t);let o=wi(He,e.pointerType),c=X(n.scene,s,a,o,n.quadtree,n.maxPointRadius);if(Wi(t,Ni(c?.node)),!_r)return;let h="multi"===Ge,u=()=>{zr.current&&(zr.current=null,$r.current=null,jr(null),Di&&Di(null),yr())};if(!c&&!h)return void u();let d=h||!c?s:c.x,p=h||!c?a:c.y,g=c?.datum?Mt(c.datum,n.resolvedRibbons):{},y=n.scales?.x?.invert,f="function"==typeof y?y(d):void 0,m=Ai(g,d,p,null!=f?{xValue:f,xPx:d}:void 0);if(h&&n.scene.length>0&&n.scales){let e=V(n.scene,d,Math.max(o,vr));if(e.length>0){let t=n.scales.y.invert,i=Vr.current,s=y?y(d):d;if(c)m.xValue=s,m.xPx=d;else{let e={xValue:s};"string"==typeof l&&(e[l]=s),m=Ai(e,d,p,{xValue:s,xPx:d})}m.allSeries=e.map(e=>{let s=t?t(e.y):e.y,a=null!=e.y0?t?t(e.y0):e.y0:void 0;return{group:e.group||"",value:"stackedarea"===r&&null!=a?s-a:s,valuePx:e.y,color:e.color||i,datum:Mt(e.datum,n.resolvedRibbons)}})}}c||m.allSeries?.length?(zr.current=m,$r.current=c?.node??null,jr(m),Di?.(m),yr()):u()},ys.current=()=>{Wi(us.current),zr.current&&(zr.current=null,$r.current=null,jr(null),Di?.(null),yr())},Vi(us);let vs=Dr(()=>{});vs.current=e=>{if(mi(e.target)||!Ei)return;let t=us.current;if(!t)return;let i=t.getBoundingClientRect(),r=e.clientX-i.left-mr.left,s=e.clientY-i.top-mr.top;if(0>r||r>vr||0>s||s>br)return void Ei(null);let a=ts.current;if(!a||0===a.scene.length)return void Ei(null);let n=wi(He,Wr.current),o=X(a.scene,r,s,n,a.quadtree,a.maxPointRadius);if(!o)return void Ei(null);let l=o.datum||{},c=a.scales?.x?.invert,h="function"==typeof c?c(o.x):void 0;Ei(Ai(l,o.x,o.y,null!=h?{xValue:h,xPx:o.x}:void 0),{type:"activate",inputType:Yi(Wr.current)})};let bs=Rr(e=>vs.current(e),[]),{kbFocusIndexRef:ws,focusedNavPointRef:ks,onKeyDown:As}=St({storeRef:ts,hoverRef:zr,hoveredNodeRef:$r,setHoverPoint:jr,customHoverBehavior:Di,customClickBehavior:Ei,scheduleRender:yr}),_s=Rr(e=>{Nt(xs,e,!!_r,Fr.current,us.current)&&(Wr.current=e.pointerType,ws.current=-1,ks.current=null,fs(e))},[us,_r,ks,ws,fs,xs]),Cs=Rr(e=>{Nt(xs,e,!!_r,Fr.current,us.current,"mouse")&&(Wr.current="mouse",ws.current=-1,ks.current=null,fs({clientX:e.clientX,clientY:e.clientY,pointerType:"mouse"}))},[us,_r,ks,ws,fs,xs]),Ps=Rr(e=>{Wr.current=e.pointerType},[]);gr.current=()=>{if(pr.current=null,!fr.isActive)return;let e=us.current,t=ds.current;if(!e||!t)return;let i=ts.current;if(!i)return;let s=fr.now(),a=null!=i.activeTransition,n=i.advanceTransition(Zi.current?s+1e6:s),o=!Zi.current&&n,l=$i.current.w!==vr||$i.current.h!==br,c=ps.current,h=zi.current||a||l,u=a&&!n,d=i.consumeStylePaintPending(),p=!1,g=i.getLastUpdateResult(),y=Ur.current.beforeCompute(g,o);(zi.current||l)&&(!o||l)&&(i.computeScene({width:vr,height:br}),$i.current={w:vr,h:br},p=!0,is(),as()),(p||d)&&(Fr.current=Fi(i.scene),Fr.current||Wi(e)),Fr.current&&(a||p||d)&&Xe({canvas:e,pointer:xs.current,store:i,margin:mr,width:vr,height:br,hoverRadius:He,geometryMoved:a||p}),Ur.current.afterCompute(y,p,l);let f=Ct(i,s,p,Xi),m=fi(W,sr);pi(e,sr,m),pi(t,sr,m);let x=Hr.current.resolve(e);Vr.current=x.primary;let v=Qt(Lt,i.lastIngestTime>0?s-i.lastIngestTime:0),b=Lt&&v.isStale;if(h||d||f.changed||c){let t=yi(e,sr,mr,m);if(t){if(t.clearRect(-mr.left,-mr.top,sr[0],sr[1]),Lt&&1>v.alpha&&(t.globalAlpha=v.alpha),li(t,{background:$,hasBackgroundGraphics:!!ht,themeBackground:x.background,x:-mr.left,y:-mr.top,width:sr[0],height:sr[1]}),t.save(),"function"==typeof t.rect&&(t.beginPath(),t.rect(0,0,vr,br),t.clip()),yt&&i.scales)for(let e of yt)t.save(),e(t,i.scene,i.scales,{width:vr,height:br}),t.restore();let e=Je(r,!!Pi);Bt({context:t,nodes:i.scene,renderMode:j,pixelRatio:m,paintBuiltIn:r=>{if(e&&i.scales)for(let s of e)s(t,r,i.scales,{width:vr,height:br})}}),t.restore(),Lt&&1>v.alpha&&(t.globalAlpha=1)}}let w=!!(_r&&zr.current&&i.scales),k=!!($r.current&&Array.isArray(Me)&&Me.some(e=>e&&"object"==typeof e&&"highlight"===e.type)),A=w||k;if(Rt(A,Gr.current)){let e=yi(t,sr,mr,m);if(e&&(e.clearRect(-mr.left,-mr.top,sr[0],sr[1]),w&&zr.current&&Ne(e,zr.current,vr,br,"object"==typeof _r?_r:{},$r.current,x),k&&$r.current&&Array.isArray(Me))){let t=Me.find(e=>e&&"object"==typeof e&&"highlight"===e.type);t&&ze(e,i.scene,$r.current,t,x)}Gr.current=A}h&&e&&e.setAttribute("aria-label",ir(i.scene,r+" chart"));let _=zi.current;if(zi.current=_&&o&&!p,ps.current=!1,_&&i.scales){let e=e=>"object"==typeof e&&null!==e&&"function"==typeof e.valueOf?e.valueOf():e;(!Or||e(Or.x.domain()[0])!==e(i.scales.x.domain()[0])||e(Or.x.domain()[1])!==e(i.scales.x.domain()[1])||e(Or.y.domain()[0])!==e(i.scales.y.domain()[0])||e(Or.y.domain()[1])!==e(i.scales.y.domain()[1])||Or.x.range()[0]!==i.scales.x.range()[0]||Or.x.range()[1]!==i.scales.x.range()[1]||Or.y.range()[0]!==i.scales.y.range()[0]||Or.y.range()[1]!==i.scales.y.range()[1])&&Br(i.scales),ri&&hs(i.getData())}(Ue&&Ue.length>0||Pi)&&(p||a)&&(p||u||s-Mr.current>=33)&&(Sr(e=>e+1),Mr.current=s),Lt?.showBadge&&Kr(!!b),(o||null!=i.activeTransition||f.pending)&&yr()},ei(Lt,ts,zi,yr,fr.now,qr,Kr);let Ss=Lr(()=>{if(!ve&&!Ae&&ts.current?.xIsDate&&Or)return we(Or.x.domain())},[ve,Ae,Or]),Ms=ve||Ae||Ss,Rs=_r&&Xr?Re?Re(Xr):/* @__PURE__ */Gs($e,{hover:Xr}):null,Ys=Rs?/* @__PURE__ */Gs(hi,{x:Xr.x,y:Xr.y,containerWidth:vr,containerHeight:br,margin:mr,className:"stream-frame-tooltip",children:Rs}):null,Ts=ks.current,Ls=/* @__PURE__ */Gs(hr,{active:ws.current>=0,hoverPoint:Xr,margin:mr,size:sr,shape:Ts?.shape,width:Ts?.w,height:Ts?.h}),Ds=ut(l,M,"__semiotic_resolvedX","__semiotic_resolvedTime"),Es=ut(c,k,"__semiotic_resolvedY","__semiotic_resolvedValue"),Os=Ds.key,Bs=Es.key,Is=dt(Ds,Es,Ue&&Ue.length>0||!1);if(Ki||!Hi&&Gi){let e=ts.current;e&&a&&(e.ingest({inserts:We(kr,f),bounded:!0}),e.computeScene({width:vr,height:br}));let t=e?.scene??[],i=e?.scales??null,r=Et(gt,sr,mr,i),s=Et(ht,sr,mr,i),n=Ms||(()=>{if(e?.xIsDate&&i)return we(i.x.domain())})(),o=bi||("string"==typeof vt?vt:"XY chart"),h=ri&&e?ye(e.getData(),l,c):{xValues:[],yValues:[]};/* @__PURE__ */
|
|
45
45
|
return Us("div",{ref:Qi,className:"stream-xy-frame"+(z?" "+z:""),role:"img","aria-label":o,style:{position:"relative",fontFamily:"var(--semiotic-font-family, sans-serif)",width:B?"100%":sr[0],height:I?"100%":sr[1]},children:[
|
|
46
46
|
/* @__PURE__ */Gs(or,{summary:ki}),
|
|
47
47
|
/* @__PURE__ */Us("svg",{xmlns:"http://www.w3.org/2000/svg",width:sr[0],height:sr[1],style:{position:"absolute",left:0,top:0},children:[
|
|
@@ -52,7 +52,7 @@ return Us("div",{ref:Qi,className:"stream-xy-frame"+(z?" "+z:""),role:"group","a
|
|
|
52
52
|
/* @__PURE__ */Gs(lr,{tableId:dr}),
|
|
53
53
|
/* @__PURE__ */Gs(ar,{scene:ts.current?.scene??[],chartType:r+" chart",tableId:dr,chartTitle:"string"==typeof vt?vt:void 0})]}),
|
|
54
54
|
/* @__PURE__ */Gs(or,{summary:ki}),
|
|
55
|
-
/* @__PURE__ */Gs(
|
|
55
|
+
/* @__PURE__ */Gs(Ji,{hoverPoint:Xr}),
|
|
56
56
|
/* @__PURE__ */Us("div",{role:"img","aria-label":bi||("string"==typeof vt?vt:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onPointerMove:_s,onMouseMove:Cs,onPointerLeave:ms,onMouseLeave:ms,onPointerDown:_r||Bi?Ps:void 0,onClick:Bi?bs:void 0,children:[
|
|
57
57
|
/* @__PURE__ */Gs(vi,{size:sr,margin:mr,backdropFill:ht?$:void 0,children:Nr}),
|
|
58
58
|
/* @__PURE__ */Gs(Ce,{width:vr,height:br,totalWidth:sr[0],totalHeight:sr[1],margin:mr,scales:Or,showAxes:pe,axes:ge,showGrid:Qe,xFormat:Ms,yFormat:be||_e,axisExtent:ke}),
|