semiotic 3.7.3 → 3.7.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.
@@ -13,6 +13,8 @@ export { flextreeLayout } from "./components/recipes/flextree";
13
13
  export type { FlextreeConfig } from "./components/recipes/flextree";
14
14
  export { dagreLayout } from "./components/recipes/dagre";
15
15
  export type { DagreConfig } from "./components/recipes/dagre";
16
+ export { lineageDagLayout } from "./components/recipes/lineageDag";
17
+ export type { LineageDagConfig, LineageLod, LineageStoreSlot } from "./components/recipes/lineageDag";
16
18
  export { marimekkoLayout } from "./components/recipes/marimekko";
17
19
  export type { MarimekkoConfig } from "./components/recipes/marimekko";
18
20
  export { bulletLayout } from "./components/recipes/bullet";
@@ -1 +1 @@
1
- "use strict";const e=require("d3-interpolate"),t=require("react"),n=require("d3-scale");function o(e){if(e&&e.__esModule)return e;const t=Object.create(null);if(e)for(const n in e)if("default"!==n){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}return t.default=e,Object.freeze(t)}const r=o(t);function i(e){return"function"==typeof e?e:t=>t[e]}function l(e){const t=Object.create(null);return e((e,n)=>{t[e]=n}),t}const s=864e5;function a(e){return`${e.getUTCFullYear()}-${c(e.getUTCMonth()+1)}-${c(e.getUTCDate())}`}function c(e){return 10>e?"0"+e:e+""}function u(e,t,n){const o=new Set,r=[];for(const t of e)n(t)&&!o.has(t)&&(o.add(t),r.push(t));for(const e of t)o.has(e)||r.push(e);return r}function d(e,t){var n,o,r;const i=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.x)&&void 0!==o?o:null===(r=t.scales)||void 0===r?void 0:r.time;return i?null!=e.x?i(e.x):t.xAccessor&&null!=e[t.xAccessor]?i(e[t.xAccessor]):null:null}function f(e,t){var n,o,r;const i=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(r=t.scales)||void 0===r?void 0:r.value;return i?null!=e.y?i(e.y):t.yAccessor&&null!=e[t.yAccessor]?i(e[t.yAccessor]):null:null}function h(e){return null==e?null:e+""}function y(e,t,n){var o;return null===(o=t.stickyPositionCache)||void 0===o||o.set(e,n),n}const m=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function g(e){return!!e&&"object"==typeof e&&m.has(function(e){return"string"==typeof(null==e?void 0:e.type)?e.type:""}(e))}function p(e){return"primary"===(null==e?void 0:e.emphasis)||!0===(null==e?void 0:e.defensive)}function v(e,t,n={}){return"number"==typeof n.maxAnnotations&&Number.isFinite(n.maxAnnotations)?Math.max(0,Math.floor(n.maxAnnotations)):e>0&&t>0?Math.max(1,Math.round(e*t/(n.areaPerAnnotation&&n.areaPerAnnotation>0?n.areaPerAnnotation:2e4))):1/0}function x(e){var t,n;let o;const r=null==e?void 0:e.emphasis;o="primary"===r?100:"secondary"===r?10:50;const i=null===(t=null==e?void 0:e.provenance)||void 0===t?void 0:t.confidence;switch("number"==typeof i&&Number.isFinite(i)&&(o+=15*Math.max(0,Math.min(1,i))),null===(n=null==e?void 0:e.lifecycle)||void 0===n?void 0:n.freshness){case"fresh":o+=8;break;case"aging":o+=4;break;case"stale":o+=1;break;case"expired":o-=200}return o}function b(e){var t;const{annotations:n,width:o,height:r}=e,i=Math.max(0,null!==(t=e.minVisible)&&void 0!==t?t:1),l=v(o,r,e),s=n.map((e,t)=>{return{annotation:e,index:t,note:(n=e,g(n))};var n}),a=s.filter(e=>e.note);if(0===a.length||l>=a.length)return{visible:n.slice(),deferred:[],budget:l};const c=a.filter(e=>p(e.annotation)),u=a.filter(e=>!p(e.annotation)).sort((e,t)=>x(t.annotation)-x(e.annotation)||e.index-t.index),d=Math.min(u.length,Math.max(Math.max(0,l-c.length),Math.max(0,i-c.length))),f=new Set([...c.map(e=>e.index),...u.slice(0,d).map(e=>e.index)]),h=[],y=[];for(const{annotation:e,index:t,note:n}of s)!n||f.has(t)?h.push(e):y.push(e);return{visible:h,deferred:y,budget:l}}new Set(["label","callout","callout-circle","callout-rect"]);const w=32,A=6,k=4,M=8,$=72;const N={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function O(e){return g(e)}function j(e,t){if(!e)return[];const n=Math.max(1,Math.floor(t/7)),o=e.split(/\s+/).filter(Boolean),r=[];let i="";for(const e of o)i&&i.length+e.length+1>n?(r.push(i),i=e):i=i?`${i} ${e}`:e;return i&&r.push(i),r}function C(e,t,n,o,r){const i=e+n,l=t+o;return Math.abs(n)>Math.abs(o)?{x:0>n?i-r.width-4:i+4,y:0>o?l-r.height:l,width:r.width,height:r.height}:{x:0>n?i-r.width:i,y:0>o?l-r.height-4:l+4,width:r.width,height:r.height}}function F(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function S(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 T(e,t,n,o,r,i,l,s){const a=F(e,l);let c=.4*Math.hypot(t.dx,t.dy)+80*function(e,t,n,o){const r=Math.max(0,o-e.x),i=Math.max(0,o-e.y);return(r+Math.max(0,e.x+e.width-(t-o)))*e.height+(i+Math.max(0,e.y+e.height-(n-o)))*e.width}(a,r,i,s);for(const e of n)c+=12*S(a,e);for(const e of o)c+=4*S(a,e);return c}function L(e,t,n){var o,r;if("widget"===e.type&&"number"==typeof e.px&&"number"==typeof e.py)return{x:e.px,y:e.py};const i=null!==(o=e.pointId)&&void 0!==o?o:e.nodeId;if(null!=i&&n.pointNodes){const e=n.pointNodes.find(e=>e.pointId===i);if(e)return{x:e.x,y:e.y}}const l=e.coordinates,s=null===(r=n.scales)||void 0===r?void 0:r.geoProjection;if(Array.isArray(l)&&l.length>=2&&s){const e=l[0],t=l[1];if("number"==typeof e&&"number"==typeof t){const n=s([e,t]);if(n&&"number"==typeof n[0]&&"number"==typeof n[1])return{x:n[0],y:n[1]}}}return n.scales||"number"!=typeof e.x||"number"!=typeof e.y?function(e,t,n){var o,r;const i=e.anchor||(null===(o=e.lifecycle)||void 0===o?void 0:o.anchor)||"fixed";if("latest"===i){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let o=n.pointNodes.length-1;o>=0;o--){const r=n.pointNodes[o];if(r.pointId===e.pointId)return y(t,n,{x:r.x,y:r.y})}const o=function(e){var t,n,o,r,i,l;const s=e.data;if(!s||0===s.length)return null;const a=s[s.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,u=null!==(i=null===(r=e.scales)||void 0===r?void 0:r.y)&&void 0!==i?i:null===(l=e.scales)||void 0===l?void 0:l.value;if(!c||!u)return null;const d=a[e.xAccessor||"x"],f=a[e.yAccessor||"y"];return null==d||null==f?null:{x:c(d),y:u(f)}}(n);return o?y(t,n,o):null}if("semantic"===i){const o=function(e,t,n){var o,r;const i=function(e){var t,n;return h(null!==(n=null===(t=e.provenance)||void 0===t?void 0:t.stableId)&&void 0!==n?n:e.stableId)}(e);if(!i)return null;const l=null===(o=n.pointNodes)||void 0===o?void 0:o.find(e=>h(e.pointId)===i);if(l)return y(t,n,{x:l.x,y:l.y});const s=null===(r=n.data)||void 0===r?void 0:r.find(e=>function(e){var t,n,o;return h(null!==(n=null!==(t=e.stableId)&&void 0!==t?t:e.id)&&void 0!==n?n:null===(o=e.provenance)||void 0===o?void 0:o.stableId)}(e)===i);if(!s)return null;const a=d(s,n),c=f(s,n);return null==a||null==c?null:y(t,n,{x:a,y:c})}(e,t,n);if(o)return o}let l=null,s=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(l=t.x,s=t.y)}if(null!=l&&null!=s||(l=d(e,n),s=f(e,n)),null!=l&&null!=s)return y(t,n,{x:l,y:s});if("sticky"===i){const e=null===(r=n.stickyPositionCache)||void 0===r?void 0:r.get(t);if(e)return e}return null}(e,t,n):{x:e.x,y:e.y}}exports.DEFAULT_AREA_PER_ANNOTATION=2e4,exports.annotationBudget=v,exports.annotationDensity=b,exports.annotationLayout=function(e){var t;const{annotations:n,context:o,defaultOffset:r=w,notePadding:i=A,markPadding:l=k,edgePadding:s=M,preserveManualOffsets:a=!0,routeLongConnectors:c=!0,connectorThreshold:u=$,density:d,progressiveDisclosure:f=!1,redundantCues:h=!1,responsive:y,cohesion:m,audience:g}=e,p=o.width||0,x=o.height||0;if(0===n.length||0>=p||0>=x)return n.slice();const S=[],W=function(e,t){return(e.pointNodes||[]).map(e=>{const n=Math.max(1,e.r||1)+t;return{x:e.x-n,y:e.y-n,width:2*n,height:2*n}})}(o,l);let I=!1;const D=n.map((e,t)=>{if(!O(e))return e;const n=L(e,t,o);if(!n)return e;const l=function(e){if("widget"===e.type)return{width:"number"==typeof e.width?e.width:32,height:"number"==typeof e.height?e.height:32};const t="number"==typeof e.wrap?e.wrap:120,n=[...j("string"==typeof e.title?e.title:void 0,t),...j("string"==typeof e.label?e.label:void 0,t)],o=n.reduce((e,t)=>Math.max(e,t.length),0);return{width:Math.max(24,Math.min(t,7*o)+10),height:Math.max(18,16*n.length+6)}}(e);if(a&&("number"==typeof(d=e).dx||"number"==typeof d.dy)){const t=function(e){return"text"===e.type||"widget"===e.type?{dx:0,dy:0}:{dx:30,dy:-30}}(e);return S.push(F(C(n.x,n.y,"number"==typeof e.dx?e.dx:t.dx,"number"==typeof e.dy?e.dy:t.dy,l),i)),e}var d;let f=null,h=1/0;for(const e of function(e){const 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}]}(r)){const t=T(C(n.x,n.y,e.dx,e.dy,l),e,S,W,p,x,i,s);h>t&&(f=e,h=t)}if(!f)return e;const y=F(C(n.x,n.y,f.dx,f.dy,l),i);S.push(y);const m=Math.hypot(f.dx,f.dy),g=c&&m>=u&&"text"!==e.type&&"widget"!==e.type?Object.assign(Object.assign({},e.connector||{end:"arrow"}),{type:"curve"}):e.connector;return I=!0,Object.assign(Object.assign(Object.assign({},e),{dx:f.dx,dy:f.dy}),g?{connector:g}:{})}),E=I?D:n.slice();let P=E;if(h){let e=!1;const t=E.map(t=>{const n=function(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:Object.assign(Object.assign({},e),{_redundantConnector:!0})}(t);return n!==t&&(e=!0),n});P=e?t:E}{let e=!1;const t=P.map(t=>{if(!0!==(null==t?void 0:t.defensive))return t;const n=function(e){var t;const n=null==e?void 0:e.provenance;if(!n||"object"!=typeof n)return e;const o="string"==typeof n.source?null!==(t=N[n.source])&&void 0!==t?t:n.source:null,r="number"==typeof n.confidence&&Number.isFinite(n.confidence)?Math.round(100*Math.max(0,Math.min(1,n.confidence)))+"%":null;if(!o&&!r)return e;if(null!=e.label&&"string"!=typeof e.label)return e;const i=[o,r].filter(Boolean).join(" · "),l="string"==typeof e.label?e.label:"";return l.includes(`(${i})`)?e:Object.assign(Object.assign({},e),{label:l?`${l} (${i})`:`(${i})`})}(t);return n!==t&&(e=!0),n});P=e?t:P}const B=new Set;if(d){const e="object"==typeof d?d:{},n=function(e){if(!e)return 1;const t=function(e){const t=null==e?void 0:e.familiarity;if(!t)return 3;const n=Object.values(t).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0===n.length?3:n.reduce((e,t)=>e+t,0)/n.length}(e);return t>2?4>t?1:.6:1.5}(g),o=1===n?e:Object.assign(Object.assign({},e),{maxAnnotations:Math.max(0,Math.round((null!==(t=e.maxAnnotations)&&void 0!==t?t:v(p,x,e))*n))}),{deferred:r}=b(Object.assign({annotations:P,width:p,height:x},o));for(const e of r)B.add(e)}if(y&&("object"==typeof y&&"number"==typeof y.minWidth?y.minWidth:480)>=p)for(const e of P)O(e)&&"secondary"===e.emphasis&&B.add(e);if(B.size>0)for(const e of P)!0===(null==e?void 0:e.defensive)&&B.delete(e);let z;return z=0===B.size?P:f?P.map(e=>B.has(e)?Object.assign(Object.assign({},e),{_annotationDeferred:!0}):e):P.filter(e=>!B.has(e)),m?function(e,t){let n=!1;const o=e.map(e=>O(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(n=!0,Object.assign(Object.assign({},e),{cohesion:t})):e);return n?o:e}(z,m):z},exports.bulletLayout=e=>{var t,n,o,s,a,c,u,d,f,h,y,m;const g=e.config,{plot:p}=e.dimensions;if(0>=p.width||0>=p.height||0===e.data.length)return{nodes:[]};const v=null!==(t=g.rowHeight)&&void 0!==t?t:28,x=null!==(n=g.rowGap)&&void 0!==n?n:12,b=!1!==g.showLabels,w=b?null!==(o=g.labelWidth)&&void 0!==o?o:120:0,A=!1!==g.showTicks,k=A?14:0,M=null!==(s=g.tickFormat)&&void 0!==s?s:e=>e.toLocaleString(),$=p.x+w,N=Math.max(0,p.width-w);if(0>=N)return{nodes:[]};const O=i(g.categoryAccessor),j=e=>{const t=Number(e);return Number.isFinite(t)&&t>0?t:0},C=e=>j("function"==typeof g.valueAccessor?g.valueAccessor(e):e[g.valueAccessor]),F=e=>j("function"==typeof g.targetAccessor?g.targetAccessor(e):e[g.targetAccessor]),S=e=>{const t="function"==typeof g.rangesAccessor?g.rangesAccessor(e):e[g.rangesAccessor];return Array.isArray(t)?t.map(j).sort((e,t)=>e-t):[]},T="string"==typeof g.categoryAccessor?g.categoryAccessor:"metric",L="string"==typeof g.valueAccessor?g.valueAccessor:"value",W="string"==typeof g.targetAccessor?g.targetAccessor:"target",I=null!==(c=null!==(a=g.actualColor)&&void 0!==a?a:e.theme.semantic.primary)&&void 0!==c?c:"#3b6cb1",D=null!==(u=e.theme.semantic.text)&&void 0!==u?u:"currentColor",E=null!==(d=e.theme.semantic.textSecondary)&&void 0!==d?d:"#888",P=null!==(f=e.theme.semantic.surface)&&void 0!==f?f:"#e8eaed",B=null!==(h=e.theme.semantic.grid)&&void 0!==h?h:"#cdd1d6",z=null!==(y=e.theme.semantic.border)&&void 0!==y?y:"#a3a8af",_=null!==(m=g.targetColor)&&void 0!==m?m:`var(--semiotic-text, ${D})`,U=[`var(--semiotic-surface, ${P})`,`var(--semiotic-grid, ${B})`,`var(--semiotic-border, ${z})`],V=`var(--semiotic-text, ${D})`,R=`var(--semiotic-text-secondary, ${E})`,Y=[],q=[];for(let t=0;e.data.length>t;t++){const n=e.data[t],o=S(n),r=C(n),i=F(n),s=Math.max(r,i,...o.length?o:[0]);if(0>=s)continue;const a=p.y+t*(v+x+k);if(a+v+k>p.y+p.height)break;q.push({yTop:a,label:O(n),actual:r,target:i,maxVal:s});const c=e=>$+e/s*N,u=O(n),d=e=>l(t=>{t("metric",u),"metric"!==T&&t(T,u),e(t)});let f=$;for(let e=0;o.length>e;e++){const t=c(o[e]),n=t-f;n>0&&Y.push({type:"rect",x:f,y:a,w:n,h:v,style:{fill:U[Math.min(e,U.length-1)],stroke:"none"},datum:d(t=>{t("range",e),t("rangeValue",o[e]),t("kind","range")}),group:"range-"+e}),f=t}const h=Math.max(6,Math.floor(.45*v));Y.push({type:"rect",x:$,y:a+(v-h)/2,w:c(r)-$,h:h,style:{fill:I,stroke:"none"},datum:d(e=>{e("value",r),e("kind","actual"),"value"!==L&&e(L,r)}),group:"actual"});const y=3,m=Math.floor(.8*v);Y.push({type:"rect",x:c(i)-y/2,y:a+(v-m)/2,w:y,h:m,style:{fill:_,stroke:"none"},datum:d(e=>{e("target",i),e("kind","target"),"target"!==W&&e(W,i)}),group:"target"})}const H=[];for(let e=0;q.length>e;e++){const t=q[e];if(b&&H.push(r.createElement("text",{key:"bullet-label-"+e,x:p.x+w-8,y:t.yTop+v/2,textAnchor:"end",dominantBaseline:"middle",fontSize:13,fontWeight:500,fill:V},t.label)),A){const n=5,o=t.yTop+v+2;for(let i=0;n>i;i++){const l=t.maxVal*i/(n-1),s=$+l/t.maxVal*N;H.push(r.createElement("line",{key:`bullet-tick-${e}-${i}`,x1:s,x2:s,y1:o,y2:o+3,stroke:R,strokeWidth:1}),r.createElement("text",{key:`bullet-ticktext-${e}-${i}`,x:s,y:o+12,textAnchor:0===i?"start":i===n-1?"end":"middle",fontSize:10,fill:R},M(l)))}}}return{nodes:Y,overlays:H.length>0?r.createElement(r.Fragment,null,...H):null}},exports.calendarLayout=t=>{var n,o,r,i,l,c,u,d;const f=t.config,{plot:h}=t.dimensions;if(0>=h.width||0>=h.height)return{nodes:[]};const y=e=>{const t="function"==typeof f.dateAccessor?f.dateAccessor(e):e[f.dateAccessor];return t instanceof Date?t:new Date(t)},m=e=>{const t="function"==typeof f.valueAccessor?f.valueAccessor(e):e[f.valueAccessor];return Number(t)},g=new Map;let p=null;for(const e of t.data){const t=y(e);if(!isFinite(t.getTime()))continue;null==p&&(p=t.getUTCFullYear());const o=a(t),r=m(e);g.set(o,(null!==(n=g.get(o))&&void 0!==n?n:0)+(Number.isFinite(r)?r:0))}const v=null!==(r=null!==(o=f.year)&&void 0!==o?o:p)&&void 0!==r?r:(new Date).getUTCFullYear();let x=1/0,b=-1/0;for(const e of g.values())x>e&&(x=e),e>b&&(b=e);x===1/0&&(x=0,b=0);const[w,A]=null!==(i=f.colorRamp)&&void 0!==i?i:[null!==(l=t.theme.semantic.surface)&&void 0!==l?l:"#ebedf0",null!==(c=t.theme.semantic.primary)&&void 0!==c?c:"#216e39"],k=t=>{if(b===x)return w;const n=(t-x)/(b-x);return e.interpolateRgb(w,A)(n)},M=null!==(u=f.gutter)&&void 0!==u?u:2,$=null!==(d=f.labelInset)&&void 0!==d?d:0,N=Math.min((h.width-$-53*M)/54,(h.height-6*M)/7);if(0>=N)return{nodes:[]};const O=new Date(Date.UTC(v,0,1)),j=O.getUTCDay(),C=new Date(O.getTime()-j*s),F=[];for(let e=0;54>e;e++)for(let t=0;7>t;t++){const n=new Date(C.getTime()+(7*e+t)*s);if(n.getUTCFullYear()!==v)continue;const o=a(n),r=g.get(o),i=null==r?w:k(r);F.push({type:"rect",x:h.x+$+e*(N+M),y:h.y+t*(N+M),w:N,h:N,style:{fill:i,stroke:"none"},datum:{date:n,value:null!=r?r:0}})}return{nodes:F}},exports.dagreLayout=e=>{var t,n,o,r,i,l,s,a,c;const u=e.config,d=null!==(t=u.nodeWidth)&&void 0!==t?t:100,f=null!==(n=u.nodeHeight)&&void 0!==n?n:36,h=null!==(o=u.edgeStyle)&&void 0!==o?o:"polyline",y=!1!==u.showLabels,m=null!==(r=u.labelAccessor)&&void 0!==r?r:"label",g="function"==typeof m?m:e=>{var t,n;const o=e.data,r=o?o[m]:void 0;return(null!==(n=null!==(t=null!=r?r:e[m])&&void 0!==t?t:e.id)&&void 0!==n?n:"")+""},p=new Map,v=[],x=[],b=e=>{var t,n,o;const r=null!==(t=e.data)&&void 0!==t?t:{};return{x:"number"==typeof r.x?r.x:e.x,y:"number"==typeof r.y?r.y:e.y,w:null!==(n="number"==typeof r.width?r.width:e.width)&&void 0!==n?n:d,h:null!==(o="number"==typeof r.height?r.height:e.height)&&void 0!==o?o:f}};for(const t of e.nodes){const{x:n,y:o,w:r,h:s}=b(t);null!=n&&null!=o&&(p.set(t.id,{x:n,y:o,w:r,h:s}),v.push({type:"rect",x:n-r/2,y:o-s/2,w:r,h:s,style:{fill:null!==(i=u.nodeFill)&&void 0!==i?i:e.resolveColor(t.id),stroke:`var(--semiotic-border, ${null!==(l=e.theme.semantic.border)&&void 0!==l?l:"#888"})`,strokeWidth:1.5},datum:t,id:t.id,label:g(t)+""}),y&&x.push({x:n,y:o,text:g(t)+"",anchor:"middle",baseline:"middle",fontSize:11}))}const w=null!==(s=u.edgeStroke)&&void 0!==s?s:`var(--semiotic-border, ${null!==(a=e.theme.semantic.border)&&void 0!==a?a:"#666"})`,A=[];for(const t of e.edges){const e="string"==typeof t.target?t.target:t.target.id,n=p.get("string"==typeof t.source?t.source:t.source.id),o=p.get(e);if(!n||!o)continue;const r=null!==(c=t.data)&&void 0!==c?c:{},i=Array.isArray(r.points)?r.points:t.points;if(i&&i.length>=2)if("smooth"!==h||3>i.length){const e="M"+i.map(e=>`${e.x},${e.y}`).join(" L ");A.push({type:"curved",pathD:e,style:{stroke:w,strokeWidth:1,fill:"none"},datum:t})}else{let e=`M${i[0].x},${i[0].y}`;for(let t=1;i.length-1>t;t++)e+=` Q${i[t].x},${i[t].y} ${(i[t].x+i[t+1].x)/2},${(i[t].y+i[t+1].y)/2}`;const n=i[i.length-1];e+=` T${n.x},${n.y}`,A.push({type:"curved",pathD:e,style:{stroke:w,strokeWidth:1,fill:"none"},datum:t})}else A.push({type:"line",x1:n.x,y1:n.y,x2:o.x,y2:o.y,style:{stroke:w,strokeWidth:1},datum:t})}return{sceneNodes:v,sceneEdges:A,labels:x}},exports.flextreeLayout=e=>{var t,n,o,r,i,l,s,a,c;const u=e.config,d=null!==(t=u.nodeWidth)&&void 0!==t?t:80,f=null!==(n=u.nodeHeight)&&void 0!==n?n:30,h=null!==(o=u.orientation)&&void 0!==o?o:"vertical",y=null!==(r=u.edgeCurve)&&void 0!==r?r:"curved",m=!1!==u.showLabels,g=null!==(i=u.labelAccessor)&&void 0!==i?i:"id",p="function"==typeof g?g:e=>{var t,n;const o=e.data,r=o?o[g]:void 0;return(null!==(n=null!==(t=null!=r?r:e[g])&&void 0!==t?t:e.id)&&void 0!==n?n:"")+""},v=new Map,x=[],b=[],w=e=>{var t,n,o;const r=null!==(t=e.data)&&void 0!==t?t:{};return{x:"number"==typeof r.x?r.x:e.x,y:"number"==typeof r.y?r.y:e.y,w:null!==(n="number"==typeof r.width?r.width:e.width)&&void 0!==n?n:d,h:null!==(o="number"==typeof r.height?r.height:e.height)&&void 0!==o?o:f}};for(const t of e.nodes){const{x:n,y:o,w:r,h:i}=w(t);null!=n&&null!=o&&(v.set(t.id,{x:n,y:o,w:r,h:i}),x.push({type:"rect",x:n-r/2,y:o-i/2,w:r,h:i,style:{fill:null!==(l=u.nodeFill)&&void 0!==l?l:e.resolveColor(t.id),stroke:`var(--semiotic-surface, ${null!==(s=e.theme.semantic.surface)&&void 0!==s?s:"#fff"})`,strokeWidth:1.5},datum:t,id:t.id,label:p(t)+""}),m&&b.push({x:n,y:o,text:p(t)+"",anchor:"middle",baseline:"middle",fontSize:11}))}const A=[];for(const t of e.edges){const n="string"==typeof t.target?t.target:t.target.id,o=v.get("string"==typeof t.source?t.source:t.source.id),r=v.get(n);if(!o||!r)continue;const i="vertical"===h?{x:o.x,y:o.y+o.h/2}:{x:o.x+o.w/2,y:o.y},l="vertical"===h?{x:r.x,y:r.y-r.h/2}:{x:r.x-r.w/2,y:r.y};if("line"===y)A.push({type:"line",x1:i.x,y1:i.y,x2:l.x,y2:l.y,style:{stroke:`var(--semiotic-border, ${null!==(a=e.theme.semantic.border)&&void 0!==a?a:"#999"})`,strokeWidth:1},datum:t});else{const n=(i.y+l.y)/2,o=(i.x+l.x)/2;A.push({type:"curved",pathD:"vertical"===h?`M${i.x},${i.y} C${i.x},${n} ${l.x},${n} ${l.x},${l.y}`:`M${i.x},${i.y} C${o},${i.y} ${o},${l.y} ${l.x},${l.y}`,style:{stroke:`var(--semiotic-border, ${null!==(c=e.theme.semantic.border)&&void 0!==c?c:"#999"})`,strokeWidth:1,fill:"none"},datum:t})}}return{sceneNodes:x,sceneEdges:A,labels:b}},exports.marimekkoLayout=e=>{var t,n,o,s,a,c,d;const f=e.config,{plot:h}=e.dimensions;if(0>=h.width||0>=h.height)return{nodes:[]};const y=i(f.categoryAccessor),m=i(f.stackBy),g=e=>{const t="function"==typeof f.valueAccessor?f.valueAccessor(e):e[f.valueAccessor],n=Number(t);return Number.isFinite(n)&&n>0?n:0},p=null!==(t=f.gutter)&&void 0!==t?t:2,v="string"==typeof f.categoryAccessor?f.categoryAccessor:"category",x="string"==typeof f.stackBy?f.stackBy:"stack",b="string"==typeof f.valueAccessor?f.valueAccessor:"value",w=(e,t,n)=>l(o=>{o("category",e),o("stack",t),o("value",n),"category"!==v&&o(v,e),"stack"!==x&&o(x,t),"value"!==b&&o(b,n)}),A=!1!==f.showCategoryLabels,k=null!==(n=f.labelPadding)&&void 0!==n?n:A?22:0,M=Math.max(0,h.height-k),$=[],N=new Map,O=[],j=new Set,C=new Map;for(const t of e.data){const e=y(t)+"",n=m(t)+"",r=g(t);N.has(e)||($.push(e),N.set(e,0),C.set(e,new Map)),j.has(n)||(j.add(n),O.push(n)),N.set(e,(null!==(o=N.get(e))&&void 0!==o?o:0)+r);const i=C.get(e);i.set(n,(null!==(s=i.get(n))&&void 0!==s?s:0)+r)}const F=f.categoryOrder?u(f.categoryOrder,$,e=>N.has(e)):$,S=f.stackOrder?u(f.stackOrder,O,()=>!0):O,T=F.reduce((e,t)=>{var n;return e+(null!==(n=N.get(t))&&void 0!==n?n:0)},0);if(0>=T)return{nodes:[]};const L=Math.max(0,h.width-p*Math.max(0,F.length-1)),W=[],I=[];let D=h.x;for(const t of F){const n=null!==(a=N.get(t))&&void 0!==a?a:0,o=n/T*L;if(0>=o)continue;I.push({cat:t,x:D,w:o});const r=C.get(t);let i=h.y;for(const l of S){const s=null!==(c=r.get(l))&&void 0!==c?c:0;if(0>=s)continue;const a=s/n*M;W.push({type:"rect",x:D,y:i,w:o,h:a,style:{fill:e.resolveColor(l),stroke:"none"},datum:w(t,l,s),group:l}),i+=a}D+=o+p}return{nodes:W,overlays:A&&I.length>0?function(e,t,n){const o=e.map((e,o)=>6.5*e.cat.length>e.w-4?null:r.createElement("text",{key:"marimekko-label-"+o,x:e.x+e.w/2,y:t+12,textAnchor:"middle",fontSize:12,fill:n},e.cat));return r.createElement(r.Fragment,null,...o)}(I,h.y+M+4,`var(--semiotic-text, ${null!==(d=e.theme.semantic.text)&&void 0!==d?d:"currentColor"})`):null}},exports.parallelCoordinatesLayout=e=>{var t,o,i,l,s,a,c,u,d,f,h,y;const m=e.config,{plot:g}=e.dimensions,p=null!==(t=m.fields)&&void 0!==t?t:[];if(2>p.length||0>=g.width||0>=g.height)return{nodes:[]};if(0===e.data.length)return{nodes:[]};const v={};for(const t of p){if(null===(o=m.domains)||void 0===o?void 0:o[t]){v[t]=m.domains[t];continue}let n=1/0,r=-1/0;for(const o of e.data){const e=Number(o[t]);Number.isFinite(e)&&(n>e&&(n=e),e>r&&(r=e))}v[t]=Number.isFinite(n)&&Number.isFinite(r)&&n!==r?[n,r]:[0,1]}const x=!1!==m.showAxes,b=x?null!==(i=m.axisLabelPadding)&&void 0!==i?i:24:8,w=x?18:8,A=p.map(e=>n.scaleLinear().domain(v[e]).range([g.y+g.height-w,g.y+b])),k=p.map((e,t)=>1===p.length?g.x+g.width/2:g.x+t/(p.length-1)*g.width),M=m.colorBy?"function"==typeof m.colorBy?m.colorBy:e=>{var t;return(null!==(t=e[m.colorBy])&&void 0!==t?t:"")+""}:null,$=null!==(l=m.opacity)&&void 0!==l?l:.45,N=null!==(s=m.strokeWidth)&&void 0!==s?s:1.25,O=null!==(a=e.theme.semantic.primary)&&void 0!==a?a:"#3b6cb1",j=null!==(c=m.dimmedOpacity)&&void 0!==c?c:.08,C=m.highlightFn,F=[],S=[];for(const t of e.data){const n=M?e.resolveColor(M(t)+""):O,o=!C||C(t),r=C?o?Math.min(1,$+.4):j:$,i=o?S:F;for(let e=0;p.length-1>e;e++){const l=Number(t[p[e]]),s=Number(t[p[e+1]]);if(!Number.isFinite(l)||!Number.isFinite(s))continue;const a={type:"connector",x1:k[e],y1:A[e](l),x2:k[e+1],y2:A[e+1](s),style:{stroke:n,strokeWidth:C&&o?N+.75:N,opacity:r,fill:"none"},datum:t};i.push(a)}if(m.showPoints)for(let e=0;p.length>e;e++){const o=Number(t[p[e]]);if(!Number.isFinite(o))continue;const l={type:"point",x:k[e],y:A[e](o),r:2.5,style:{fill:n,stroke:"none",opacity:Math.min(1,r+.3)},datum:t};i.push(l)}}let T=null;if(x){const t=`var(--semiotic-border, ${null!==(u=e.theme.semantic.border)&&void 0!==u?u:"#aaa"})`,n=`var(--semiotic-text, ${null!==(d=e.theme.semantic.text)&&void 0!==d?d:"currentColor"})`,o=`var(--semiotic-text-secondary, ${null!==(f=e.theme.semantic.textSecondary)&&void 0!==f?f:"#888"})`,i=g.y+b,l=g.y+g.height-w,s=[];for(let e=0;p.length>e;e++){const a=p[e],c=k[e],u=null!==(y=null===(h=m.tickFormat)||void 0===h?void 0:h[a])&&void 0!==y?y:e=>e.toLocaleString();s.push(r.createElement("line",{key:"pc-axis-line-"+e,x1:c,x2:c,y1:i,y2:l,stroke:t,strokeWidth:1})),s.push(r.createElement("text",{key:"pc-axis-label-"+e,x:c,y:g.y+b-8,textAnchor:"middle",fontSize:12,fontWeight:600,fill:n},a));const[d,f]=v[a],x=5;for(let n=0;x>n;n++){const i=d+(f-d)*n/(x-1),l=A[e](i);s.push(r.createElement("line",{key:`pc-tick-${e}-${n}`,x1:c-3,x2:c+3,y1:l,y2:l,stroke:t,strokeWidth:1}),r.createElement("text",{key:`pc-ticktext-${e}-${n}`,x:c+6,y:l+3,fontSize:10,fill:o},u(i)))}}T=r.createElement(r.Fragment,null,...s)}return{nodes:F.concat(S),overlays:T}},exports.waffleLayout=e=>{var t,n,o,r,i,s;const a=e.config,c=null!==(t=a.rows)&&void 0!==t?t:10,u=null!==(n=a.columns)&&void 0!==n?n:10,d=null!==(o=a.gutter)&&void 0!==o?o:2,f=c*u;if(0>=c||0>=u||0>=f)return{nodes:[]};const{plot:h}=e.dimensions;if(0>=h.width||0>=h.height)return{nodes:[]};const y=(h.width-d*(u-1))/u,m=(h.height-d*(c-1))/c;if(0>=y||0>=m)return{nodes:[]};const g=null!==(r=null==(p=a.categoryAccessor)?null:"function"==typeof p?p:e=>e[p])&&void 0!==r?r:()=>"_default";var p;const v=null!==(i=function(e){return null==e?null:"function"==typeof e?e:t=>Number(t[e])}(a.valueAccessor))&&void 0!==i?i:()=>1,x=new Map,b=[];for(const t of e.data){const e=g(t)+"",n=Number(v(t)),o=Number.isFinite(n)?Math.max(0,n):0;x.has(e)||b.push(e),x.set(e,(null!==(s=x.get(e))&&void 0!==s?s:0)+o)}const w=Array.from(x.values()).reduce((e,t)=>e+t,0);if(0>=w)return{nodes:[]};let A;if(a.categoryOrder&&a.categoryOrder.length>0){const e=new Set,t=[];for(const n of a.categoryOrder)x.has(n)&&!e.has(n)&&(e.add(n),t.push(n));A=[...t,...b.filter(t=>!e.has(t))]}else A=b;if(0===A.length)return{nodes:[]};const k=A.map(e=>{var t;return{cat:e,exact:(null!==(t=x.get(e))&&void 0!==t?t:0)/w*f}}),M=k.map(e=>Object.assign(Object.assign({},e),{count:Math.floor(e.exact)})),$=M.reduce((e,t)=>e+t.count,0),N=M.map((e,t)=>({i:t,rem:e.exact-e.count})).sort((e,t)=>t.rem-e.rem);for(let e=0;f-$>e;e++)M[N[e%N.length].i].count+=1;const O="string"==typeof a.categoryAccessor?a.categoryAccessor:"category",j="string"==typeof a.valueAccessor?a.valueAccessor:"value",C=(e,t,n)=>l(o=>{var r,i;o("category",e),o("value",null!==(r=x.get(e))&&void 0!==r?r:0),"category"!==O&&o(O,e),"value"!==j&&o(j,null!==(i=x.get(e))&&void 0!==i?i:0),o("cells",n),o("_waffleCategory",e),o("_waffleIndex",t)}),F=[];let S=0;for(const t of M){const n=e.resolveColor(t.cat);for(let e=0;t.count>e;e++)F.push({type:"rect",x:h.x+S%u*(y+d),y:h.y+(c-1-Math.floor(S/u))*(m+d),w:y,h:m,style:{fill:n,stroke:"none"},datum:C(t.cat,S,t.count),group:t.cat}),S++}return{nodes:F}};
1
+ "use strict";const e=require("d3-interpolate"),t=require("react/jsx-runtime"),n=require("react"),o=require("d3-scale");function i(e){if(e&&e.__esModule)return e;const t=Object.create(null);if(e)for(const n in e)if("default"!==n){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}return t.default=e,Object.freeze(t)}const r=i(n);function l(e){return"function"==typeof e?e:t=>t[e]}function s(e){const t=Object.create(null);return e((e,n)=>{t[e]=n}),t}const a=864e5;function c(e){return`${e.getUTCFullYear()}-${u(e.getUTCMonth()+1)}-${u(e.getUTCDate())}`}function u(e){return 10>e?"0"+e:e+""}const d={"topic-source":"#1f7a8c","topic-sink":"#b4451f","topic-bridge":"#4b5a82",processor:"#34344a",unknown:"#5a5a6a"},h={internal:"var(--semiotic-border, #6b6b7d)","cross-subtopology":"var(--semiotic-info, #6a8caf)","topic-bridge":"var(--semiotic-secondary, #8b78c4)",back:"var(--semiotic-danger, #e0556b)"};function f(e,t,n){const o=e.data,i=o?o[t]:void 0;if(null!=i)return i;const r=e[t];return null==r?n:r}function y(e){return Array.isArray(e)?e.map((e,t)=>{var n,o;return"string"==typeof e?{storeName:e,slotIndex:t}:{storeName:(null!==(n=e.storeName)&&void 0!==n?n:"")+"",slotIndex:null!==(o=e.slotIndex)&&void 0!==o?o:t}}):[]}function m(e,t,n){const o=new Set,i=[];for(const t of e)n(t)&&!o.has(t)&&(o.add(t),i.push(t));for(const e of t)o.has(e)||i.push(e);return i}function p(e,t){var n,o,i;const r=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.x)&&void 0!==o?o:null===(i=t.scales)||void 0===i?void 0:i.time;return r?null!=e.x?r(e.x):t.xAccessor&&null!=e[t.xAccessor]?r(e[t.xAccessor]):null:null}function g(e,t){var n,o,i;const r=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(i=t.scales)||void 0===i?void 0:i.value;return r?null!=e.y?r(e.y):t.yAccessor&&null!=e[t.yAccessor]?r(e[t.yAccessor]):null:null}function v(e){return null==e?null:e+""}function x(e,t,n){var o;return null===(o=t.stickyPositionCache)||void 0===o||o.set(e,n),n}const b=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function w(e){return!!e&&"object"==typeof e&&b.has(function(e){return"string"==typeof(null==e?void 0:e.type)?e.type:""}(e))}function M(e){return"primary"===(null==e?void 0:e.emphasis)||!0===(null==e?void 0:e.defensive)}function k(e,t,n={}){return"number"==typeof n.maxAnnotations&&Number.isFinite(n.maxAnnotations)?Math.max(0,Math.floor(n.maxAnnotations)):e>0&&t>0?Math.max(1,Math.round(e*t/(n.areaPerAnnotation&&n.areaPerAnnotation>0?n.areaPerAnnotation:2e4))):1/0}function A(e){var t,n;let o;const i=null==e?void 0:e.emphasis;o="primary"===i?100:"secondary"===i?10:50;const r=null===(t=null==e?void 0:e.provenance)||void 0===t?void 0:t.confidence;switch("number"==typeof r&&Number.isFinite(r)&&(o+=15*Math.max(0,Math.min(1,r))),null===(n=null==e?void 0:e.lifecycle)||void 0===n?void 0:n.freshness){case"fresh":o+=8;break;case"aging":o+=4;break;case"stale":o+=1;break;case"expired":o-=200}return o}function $(e){var t;const{annotations:n,width:o,height:i}=e,r=Math.max(0,null!==(t=e.minVisible)&&void 0!==t?t:1),l=k(o,i,e),s=n.map((e,t)=>{return{annotation:e,index:t,note:(n=e,w(n))};var n}),a=s.filter(e=>e.note);if(0===a.length||l>=a.length)return{visible:n.slice(),deferred:[],budget:l};const c=a.filter(e=>M(e.annotation)),u=a.filter(e=>!M(e.annotation)).sort((e,t)=>A(t.annotation)-A(e.annotation)||e.index-t.index),d=Math.min(u.length,Math.max(Math.max(0,l-c.length),Math.max(0,r-c.length))),h=new Set([...c.map(e=>e.index),...u.slice(0,d).map(e=>e.index)]),f=[],y=[];for(const{annotation:e,index:t,note:n}of s)!n||h.has(t)?f.push(e):y.push(e);return{visible:f,deferred:y,budget:l}}new Set(["label","callout","callout-circle","callout-rect"]);const j=32,N=6,C=4,O=8,S=72;const W={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function F(e){return w(e)}function I(e,t){if(!e)return[];const n=Math.max(1,Math.floor(t/7)),o=e.split(/\s+/).filter(Boolean),i=[];let r="";for(const e of o)r&&r.length+e.length+1>n?(i.push(r),r=e):r=r?`${r} ${e}`:e;return r&&i.push(r),i}function L(e,t,n,o,i){const r=e+n,l=t+o;return Math.abs(n)>Math.abs(o)?{x:0>n?r-i.width-4:r+4,y:0>o?l-i.height:l,width:i.width,height:i.height}:{x:0>n?r-i.width:r,y:0>o?l-i.height-4:l+4,width:i.width,height:i.height}}function T(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function E(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 D(e,t,n,o,i,r,l,s){const a=T(e,l);let c=.4*Math.hypot(t.dx,t.dy)+80*function(e,t,n,o){const i=Math.max(0,o-e.x),r=Math.max(0,o-e.y);return(i+Math.max(0,e.x+e.width-(t-o)))*e.height+(r+Math.max(0,e.y+e.height-(n-o)))*e.width}(a,i,r,s);for(const e of n)c+=12*E(a,e);for(const e of o)c+=4*E(a,e);return c}function P(e,t,n){var o,i;if("widget"===e.type&&"number"==typeof e.px&&"number"==typeof e.py)return{x:e.px,y:e.py};const r=null!==(o=e.pointId)&&void 0!==o?o:e.nodeId;if(null!=r&&n.pointNodes){const e=n.pointNodes.find(e=>e.pointId===r);if(e)return{x:e.x,y:e.y}}const l=e.coordinates,s=null===(i=n.scales)||void 0===i?void 0:i.geoProjection;if(Array.isArray(l)&&l.length>=2&&s){const e=l[0],t=l[1];if("number"==typeof e&&"number"==typeof t){const n=s([e,t]);if(n&&"number"==typeof n[0]&&"number"==typeof n[1])return{x:n[0],y:n[1]}}}return n.scales||"number"!=typeof e.x||"number"!=typeof e.y?function(e,t,n){var o,i;const r=e.anchor||(null===(o=e.lifecycle)||void 0===o?void 0:o.anchor)||"fixed";if("latest"===r){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let o=n.pointNodes.length-1;o>=0;o--){const i=n.pointNodes[o];if(i.pointId===e.pointId)return x(t,n,{x:i.x,y:i.y})}const o=function(e){var t,n,o,i,r,l;const s=e.data;if(!s||0===s.length)return null;const a=s[s.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,u=null!==(r=null===(i=e.scales)||void 0===i?void 0:i.y)&&void 0!==r?r:null===(l=e.scales)||void 0===l?void 0:l.value;if(!c||!u)return null;const d=a[e.xAccessor||"x"],h=a[e.yAccessor||"y"];return null==d||null==h?null:{x:c(d),y:u(h)}}(n);return o?x(t,n,o):null}if("semantic"===r){const o=function(e,t,n){var o,i;const r=function(e){var t,n;return v(null!==(n=null===(t=e.provenance)||void 0===t?void 0:t.stableId)&&void 0!==n?n:e.stableId)}(e);if(!r)return null;const l=null===(o=n.pointNodes)||void 0===o?void 0:o.find(e=>v(e.pointId)===r);if(l)return x(t,n,{x:l.x,y:l.y});const s=null===(i=n.data)||void 0===i?void 0:i.find(e=>function(e){var t,n,o;return v(null!==(n=null!==(t=e.stableId)&&void 0!==t?t:e.id)&&void 0!==n?n:null===(o=e.provenance)||void 0===o?void 0:o.stableId)}(e)===r);if(!s)return null;const a=p(s,n),c=g(s,n);return null==a||null==c?null:x(t,n,{x:a,y:c})}(e,t,n);if(o)return o}let l=null,s=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(l=t.x,s=t.y)}if(null!=l&&null!=s||(l=p(e,n),s=g(e,n)),null!=l&&null!=s)return x(t,n,{x:l,y:s});if("sticky"===r){const e=null===(i=n.stickyPositionCache)||void 0===i?void 0:i.get(t);if(e)return e}return null}(e,t,n):{x:e.x,y:e.y}}exports.DEFAULT_AREA_PER_ANNOTATION=2e4,exports.annotationBudget=k,exports.annotationDensity=$,exports.annotationLayout=function(e){var t;const{annotations:n,context:o,defaultOffset:i=j,notePadding:r=N,markPadding:l=C,edgePadding:s=O,preserveManualOffsets:a=!0,routeLongConnectors:c=!0,connectorThreshold:u=S,density:d,progressiveDisclosure:h=!1,redundantCues:f=!1,responsive:y,cohesion:m,audience:p}=e,g=o.width||0,v=o.height||0;if(0===n.length||0>=g||0>=v)return n.slice();const x=[],b=function(e,t){return(e.pointNodes||[]).map(e=>{const n=Math.max(1,e.r||1)+t;return{x:e.x-n,y:e.y-n,width:2*n,height:2*n}})}(o,l);let w=!1;const M=n.map((e,t)=>{if(!F(e))return e;const n=P(e,t,o);if(!n)return e;const l=function(e){if("widget"===e.type)return{width:"number"==typeof e.width?e.width:32,height:"number"==typeof e.height?e.height:32};const t="number"==typeof e.wrap?e.wrap:120,n=[...I("string"==typeof e.title?e.title:void 0,t),...I("string"==typeof e.label?e.label:void 0,t)],o=n.reduce((e,t)=>Math.max(e,t.length),0);return{width:Math.max(24,Math.min(t,7*o)+10),height:Math.max(18,16*n.length+6)}}(e);if(a&&("number"==typeof(d=e).dx||"number"==typeof d.dy)){const t=function(e){return"text"===e.type||"widget"===e.type?{dx:0,dy:0}:{dx:30,dy:-30}}(e);return x.push(T(L(n.x,n.y,"number"==typeof e.dx?e.dx:t.dx,"number"==typeof e.dy?e.dy:t.dy,l),r)),e}var d;let h=null,f=1/0;for(const e of function(e){const 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}]}(i)){const t=D(L(n.x,n.y,e.dx,e.dy,l),e,x,b,g,v,r,s);f>t&&(h=e,f=t)}if(!h)return e;const y=T(L(n.x,n.y,h.dx,h.dy,l),r);x.push(y);const m=Math.hypot(h.dx,h.dy),p=c&&m>=u&&"text"!==e.type&&"widget"!==e.type?Object.assign(Object.assign({},e.connector||{end:"arrow"}),{type:"curve"}):e.connector;return w=!0,Object.assign(Object.assign(Object.assign({},e),{dx:h.dx,dy:h.dy}),p?{connector:p}:{})}),A=w?M:n.slice();let E=A;if(f){let e=!1;const t=A.map(t=>{const n=function(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:Object.assign(Object.assign({},e),{_redundantConnector:!0})}(t);return n!==t&&(e=!0),n});E=e?t:A}{let e=!1;const t=E.map(t=>{if(!0!==(null==t?void 0:t.defensive))return t;const n=function(e){var t;const n=null==e?void 0:e.provenance;if(!n||"object"!=typeof n)return e;const o="string"==typeof n.source?null!==(t=W[n.source])&&void 0!==t?t:n.source:null,i="number"==typeof n.confidence&&Number.isFinite(n.confidence)?Math.round(100*Math.max(0,Math.min(1,n.confidence)))+"%":null;if(!o&&!i)return e;if(null!=e.label&&"string"!=typeof e.label)return e;const r=[o,i].filter(Boolean).join(" · "),l="string"==typeof e.label?e.label:"";return l.includes(`(${r})`)?e:Object.assign(Object.assign({},e),{label:l?`${l} (${r})`:`(${r})`})}(t);return n!==t&&(e=!0),n});E=e?t:E}const z=new Set;if(d){const e="object"==typeof d?d:{},n=function(e){if(!e)return 1;const t=function(e){const t=null==e?void 0:e.familiarity;if(!t)return 3;const n=Object.values(t).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0===n.length?3:n.reduce((e,t)=>e+t,0)/n.length}(e);return t>2?4>t?1:.6:1.5}(p),o=1===n?e:Object.assign(Object.assign({},e),{maxAnnotations:Math.max(0,Math.round((null!==(t=e.maxAnnotations)&&void 0!==t?t:k(g,v,e))*n))}),{deferred:i}=$(Object.assign({annotations:E,width:g,height:v},o));for(const e of i)z.add(e)}if(y&&("object"==typeof y&&"number"==typeof y.minWidth?y.minWidth:480)>=g)for(const e of E)F(e)&&"secondary"===e.emphasis&&z.add(e);if(z.size>0)for(const e of E)!0===(null==e?void 0:e.defensive)&&z.delete(e);let B;return B=0===z.size?E:h?E.map(e=>z.has(e)?Object.assign(Object.assign({},e),{_annotationDeferred:!0}):e):E.filter(e=>!z.has(e)),m?function(e,t){let n=!1;const o=e.map(e=>F(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(n=!0,Object.assign(Object.assign({},e),{cohesion:t})):e);return n?o:e}(B,m):B},exports.bulletLayout=e=>{var t,n,o,i,a,c,u,d,h,f,y,m;const p=e.config,{plot:g}=e.dimensions;if(0>=g.width||0>=g.height||0===e.data.length)return{nodes:[]};const v=null!==(t=p.rowHeight)&&void 0!==t?t:28,x=null!==(n=p.rowGap)&&void 0!==n?n:12,b=!1!==p.showLabels,w=b?null!==(o=p.labelWidth)&&void 0!==o?o:120:0,M=!1!==p.showTicks,k=M?14:0,A=null!==(i=p.tickFormat)&&void 0!==i?i:e=>e.toLocaleString(),$=g.x+w,j=Math.max(0,g.width-w);if(0>=j)return{nodes:[]};const N=l(p.categoryAccessor),C=e=>{const t=Number(e);return Number.isFinite(t)&&t>0?t:0},O=e=>C("function"==typeof p.valueAccessor?p.valueAccessor(e):e[p.valueAccessor]),S=e=>C("function"==typeof p.targetAccessor?p.targetAccessor(e):e[p.targetAccessor]),W=e=>{const t="function"==typeof p.rangesAccessor?p.rangesAccessor(e):e[p.rangesAccessor];return Array.isArray(t)?t.map(C).sort((e,t)=>e-t):[]},F="string"==typeof p.categoryAccessor?p.categoryAccessor:"metric",I="string"==typeof p.valueAccessor?p.valueAccessor:"value",L="string"==typeof p.targetAccessor?p.targetAccessor:"target",T=null!==(c=null!==(a=p.actualColor)&&void 0!==a?a:e.theme.semantic.primary)&&void 0!==c?c:"#3b6cb1",E=null!==(u=e.theme.semantic.text)&&void 0!==u?u:"currentColor",D=null!==(d=e.theme.semantic.textSecondary)&&void 0!==d?d:"#888",P=null!==(h=e.theme.semantic.surface)&&void 0!==h?h:"#e8eaed",z=null!==(f=e.theme.semantic.grid)&&void 0!==f?f:"#cdd1d6",B=null!==(y=e.theme.semantic.border)&&void 0!==y?y:"#a3a8af",_=null!==(m=p.targetColor)&&void 0!==m?m:`var(--semiotic-text, ${E})`,U=[`var(--semiotic-surface, ${P})`,`var(--semiotic-grid, ${z})`,`var(--semiotic-border, ${B})`],R=`var(--semiotic-text, ${E})`,G=`var(--semiotic-text-secondary, ${D})`,H=[],V=[];for(let t=0;e.data.length>t;t++){const n=e.data[t],o=W(n),i=O(n),r=S(n),l=Math.max(i,r,...o.length?o:[0]);if(0>=l)continue;const a=g.y+t*(v+x+k);if(a+v+k>g.y+g.height)break;V.push({yTop:a,label:N(n),actual:i,target:r,maxVal:l});const c=e=>$+e/l*j,u=N(n),d=e=>s(t=>{t("metric",u),"metric"!==F&&t(F,u),e(t)});let h=$;for(let e=0;o.length>e;e++){const t=c(o[e]),n=t-h;n>0&&H.push({type:"rect",x:h,y:a,w:n,h:v,style:{fill:U[Math.min(e,U.length-1)],stroke:"none"},datum:d(t=>{t("range",e),t("rangeValue",o[e]),t("kind","range")}),group:"range-"+e}),h=t}const f=Math.max(6,Math.floor(.45*v));H.push({type:"rect",x:$,y:a+(v-f)/2,w:c(i)-$,h:f,style:{fill:T,stroke:"none"},datum:d(e=>{e("value",i),e("kind","actual"),"value"!==I&&e(I,i)}),group:"actual"});const y=3,m=Math.floor(.8*v);H.push({type:"rect",x:c(r)-y/2,y:a+(v-m)/2,w:y,h:m,style:{fill:_,stroke:"none"},datum:d(e=>{e("target",r),e("kind","target"),"target"!==L&&e(L,r)}),group:"target"})}const Y=[];for(let e=0;V.length>e;e++){const t=V[e];if(b&&Y.push(r.createElement("text",{key:"bullet-label-"+e,x:g.x+w-8,y:t.yTop+v/2,textAnchor:"end",dominantBaseline:"middle",fontSize:13,fontWeight:500,fill:R},t.label)),M){const n=5,o=t.yTop+v+2;for(let i=0;n>i;i++){const l=t.maxVal*i/(n-1),s=$+l/t.maxVal*j;Y.push(r.createElement("line",{key:`bullet-tick-${e}-${i}`,x1:s,x2:s,y1:o,y2:o+3,stroke:G,strokeWidth:1}),r.createElement("text",{key:`bullet-ticktext-${e}-${i}`,x:s,y:o+12,textAnchor:0===i?"start":i===n-1?"end":"middle",fontSize:10,fill:G},A(l)))}}}return{nodes:H,overlays:Y.length>0?r.createElement(r.Fragment,null,...Y):null}},exports.calendarLayout=t=>{var n,o,i,r,l,s,u,d;const h=t.config,{plot:f}=t.dimensions;if(0>=f.width||0>=f.height)return{nodes:[]};const y=e=>{const t="function"==typeof h.dateAccessor?h.dateAccessor(e):e[h.dateAccessor];return t instanceof Date?t:new Date(t)},m=e=>{const t="function"==typeof h.valueAccessor?h.valueAccessor(e):e[h.valueAccessor];return Number(t)},p=new Map;let g=null;for(const e of t.data){const t=y(e);if(!isFinite(t.getTime()))continue;null==g&&(g=t.getUTCFullYear());const o=c(t),i=m(e);p.set(o,(null!==(n=p.get(o))&&void 0!==n?n:0)+(Number.isFinite(i)?i:0))}const v=null!==(i=null!==(o=h.year)&&void 0!==o?o:g)&&void 0!==i?i:(new Date).getUTCFullYear();let x=1/0,b=-1/0;for(const e of p.values())x>e&&(x=e),e>b&&(b=e);x===1/0&&(x=0,b=0);const[w,M]=null!==(r=h.colorRamp)&&void 0!==r?r:[null!==(l=t.theme.semantic.surface)&&void 0!==l?l:"#ebedf0",null!==(s=t.theme.semantic.primary)&&void 0!==s?s:"#216e39"],k=t=>{if(b===x)return w;const n=(t-x)/(b-x);return e.interpolateRgb(w,M)(n)},A=null!==(u=h.gutter)&&void 0!==u?u:2,$=null!==(d=h.labelInset)&&void 0!==d?d:0,j=Math.min((f.width-$-53*A)/54,(f.height-6*A)/7);if(0>=j)return{nodes:[]};const N=new Date(Date.UTC(v,0,1)),C=N.getUTCDay(),O=new Date(N.getTime()-C*a),S=[];for(let e=0;54>e;e++)for(let t=0;7>t;t++){const n=new Date(O.getTime()+(7*e+t)*a);if(n.getUTCFullYear()!==v)continue;const o=c(n),i=p.get(o),r=null==i?w:k(i);S.push({type:"rect",x:f.x+$+e*(j+A),y:f.y+t*(j+A),w:j,h:j,style:{fill:r,stroke:"none"},datum:{date:n,value:null!=i?i:0}})}return{nodes:S}},exports.dagreLayout=e=>{var t,n,o,i,r,l,s,a,c;const u=e.config,d=null!==(t=u.nodeWidth)&&void 0!==t?t:100,h=null!==(n=u.nodeHeight)&&void 0!==n?n:36,f=null!==(o=u.edgeStyle)&&void 0!==o?o:"polyline",y=!1!==u.showLabels,m=null!==(i=u.labelAccessor)&&void 0!==i?i:"label",p="function"==typeof m?m:e=>{var t,n;const o=e.data,i=o?o[m]:void 0;return(null!==(n=null!==(t=null!=i?i:e[m])&&void 0!==t?t:e.id)&&void 0!==n?n:"")+""},g=new Map,v=[],x=[],b=e=>{var t,n,o;const i=null!==(t=e.data)&&void 0!==t?t:{};return{x:"number"==typeof i.x?i.x:e.x,y:"number"==typeof i.y?i.y:e.y,w:null!==(n="number"==typeof i.width?i.width:e.width)&&void 0!==n?n:d,h:null!==(o="number"==typeof i.height?i.height:e.height)&&void 0!==o?o:h}};for(const t of e.nodes){const{x:n,y:o,w:i,h:s}=b(t);null!=n&&null!=o&&(g.set(t.id,{x:n,y:o,w:i,h:s}),v.push({type:"rect",x:n-i/2,y:o-s/2,w:i,h:s,style:{fill:null!==(r=u.nodeFill)&&void 0!==r?r:e.resolveColor(t.id),stroke:`var(--semiotic-border, ${null!==(l=e.theme.semantic.border)&&void 0!==l?l:"#888"})`,strokeWidth:1.5},datum:t,id:t.id,label:p(t)+""}),y&&x.push({x:n,y:o,text:p(t)+"",anchor:"middle",baseline:"middle",fontSize:11}))}const w=null!==(s=u.edgeStroke)&&void 0!==s?s:`var(--semiotic-border, ${null!==(a=e.theme.semantic.border)&&void 0!==a?a:"#666"})`,M=[];for(const t of e.edges){const e="string"==typeof t.target?t.target:t.target.id,n=g.get("string"==typeof t.source?t.source:t.source.id),o=g.get(e);if(!n||!o)continue;const i=null!==(c=t.data)&&void 0!==c?c:{},r=Array.isArray(i.points)?i.points:t.points;if(r&&r.length>=2)if("smooth"!==f||3>r.length){const e="M"+r.map(e=>`${e.x},${e.y}`).join(" L ");M.push({type:"curved",pathD:e,style:{stroke:w,strokeWidth:1,fill:"none"},datum:t})}else{let e=`M${r[0].x},${r[0].y}`;for(let t=1;r.length-1>t;t++)e+=` Q${r[t].x},${r[t].y} ${(r[t].x+r[t+1].x)/2},${(r[t].y+r[t+1].y)/2}`;const n=r[r.length-1];e+=` T${n.x},${n.y}`,M.push({type:"curved",pathD:e,style:{stroke:w,strokeWidth:1,fill:"none"},datum:t})}else M.push({type:"line",x1:n.x,y1:n.y,x2:o.x,y2:o.y,style:{stroke:w,strokeWidth:1},datum:t})}return{sceneNodes:v,sceneEdges:M,labels:x}},exports.flextreeLayout=e=>{var t,n,o,i,r,l,s,a,c;const u=e.config,d=null!==(t=u.nodeWidth)&&void 0!==t?t:80,h=null!==(n=u.nodeHeight)&&void 0!==n?n:30,f=null!==(o=u.orientation)&&void 0!==o?o:"vertical",y=null!==(i=u.edgeCurve)&&void 0!==i?i:"curved",m=!1!==u.showLabels,p=null!==(r=u.labelAccessor)&&void 0!==r?r:"id",g="function"==typeof p?p:e=>{var t,n;const o=e.data,i=o?o[p]:void 0;return(null!==(n=null!==(t=null!=i?i:e[p])&&void 0!==t?t:e.id)&&void 0!==n?n:"")+""},v=new Map,x=[],b=[],w=e=>{var t,n,o;const i=null!==(t=e.data)&&void 0!==t?t:{};return{x:"number"==typeof i.x?i.x:e.x,y:"number"==typeof i.y?i.y:e.y,w:null!==(n="number"==typeof i.width?i.width:e.width)&&void 0!==n?n:d,h:null!==(o="number"==typeof i.height?i.height:e.height)&&void 0!==o?o:h}};for(const t of e.nodes){const{x:n,y:o,w:i,h:r}=w(t);null!=n&&null!=o&&(v.set(t.id,{x:n,y:o,w:i,h:r}),x.push({type:"rect",x:n-i/2,y:o-r/2,w:i,h:r,style:{fill:null!==(l=u.nodeFill)&&void 0!==l?l:e.resolveColor(t.id),stroke:`var(--semiotic-surface, ${null!==(s=e.theme.semantic.surface)&&void 0!==s?s:"#fff"})`,strokeWidth:1.5},datum:t,id:t.id,label:g(t)+""}),m&&b.push({x:n,y:o,text:g(t)+"",anchor:"middle",baseline:"middle",fontSize:11}))}const M=[];for(const t of e.edges){const n="string"==typeof t.target?t.target:t.target.id,o=v.get("string"==typeof t.source?t.source:t.source.id),i=v.get(n);if(!o||!i)continue;const r="vertical"===f?{x:o.x,y:o.y+o.h/2}:{x:o.x+o.w/2,y:o.y},l="vertical"===f?{x:i.x,y:i.y-i.h/2}:{x:i.x-i.w/2,y:i.y};if("line"===y)M.push({type:"line",x1:r.x,y1:r.y,x2:l.x,y2:l.y,style:{stroke:`var(--semiotic-border, ${null!==(a=e.theme.semantic.border)&&void 0!==a?a:"#999"})`,strokeWidth:1},datum:t});else{const n=(r.y+l.y)/2,o=(r.x+l.x)/2;M.push({type:"curved",pathD:"vertical"===f?`M${r.x},${r.y} C${r.x},${n} ${l.x},${n} ${l.x},${l.y}`:`M${r.x},${r.y} C${o},${r.y} ${o},${l.y} ${l.x},${l.y}`,style:{stroke:`var(--semiotic-border, ${null!==(c=e.theme.semantic.border)&&void 0!==c?c:"#999"})`,strokeWidth:1,fill:"none"},datum:t})}}return{sceneNodes:x,sceneEdges:M,labels:b}},exports.lineageDagLayout=e=>{var n,o,i,r,l,s,a,c,u,m,p,g,v,x,b,w,M,k,A,$,j,N,C,O,S;const W=e.config||{},F=e.dimensions.plot,I=null!==(n=W.layerAccessor)&&void 0!==n?n:"x",L=null!==(o=W.rowAccessor)&&void 0!==o?o:"y",T=null!==(i=W.partitionAccessor)&&void 0!==i?i:"partition",E=null!==(r=W.semanticAccessor)&&void 0!==r?r:"semantic",D=null!==(l=W.labelAccessor)&&void 0!==l?l:"label",P=null!==(s=W.storesAccessor)&&void 0!==s?s:"stores",z=null!==(a=W.backEdgeAccessor)&&void 0!==a?a:"isBackEdge",B=null!==(c=W.edgeTypeAccessor)&&void 0!==c?c:"edgeType",_=Object.assign(Object.assign({},d),W.partitionColors),U=Object.assign(Object.assign({},h),W.edgeColors),R=null!==(u=W.accentColor)&&void 0!==u?u:"var(--semiotic-focus, #ffcc33)",G=null!==(m=W.borderColor)&&void 0!==m?m:"var(--semiotic-border, #555)",H=null!==(p=W.dimOpacity)&&void 0!==p?p:.14,V=null!==(g=W.edgeOpacity)&&void 0!==g?g:.5,Y=null!==(v=W.edgeWidth)&&void 0!==v?v:1.25,q=null!==(b=null!==(x=W.backEdgeWidth)&&void 0!==x?x:W.edgeWidth)&&void 0!==b?b:1.5,J=!1!==W.showStoreChips,K=null!==(w=W.storeChipColor)&&void 0!==w?w:"var(--semiotic-info, #6a8caf)";let Q=W.layerCount,X=W.maxLayerSize;if(null==Q||null==X){let t=0;const n=new Map;for(const o of e.nodes){const e=Math.round(Number(f(o,I,0)));t=Math.max(t,e),n.set(e,(null!==(M=n.get(e))&&void 0!==M?M:0)+1)}Q=null!=Q?Q:t+1,X=null!=X?X:Math.max(1,...n.values())}const Z=F.width/Math.max(1,Q),ee=F.height/Math.max(1,X);let te=Math.min(null!==(k=W.nodeWidth)&&void 0!==k?k:172,Math.max(8,Z-(null!==(A=W.minGapX)&&void 0!==A?A:26))),ne=Math.min(null!==($=W.nodeHeight)&&void 0!==$?$:54,Math.max(8,ee-(null!==(j=W.minGapY)&&void 0!==j?j:18)));const oe=W.lod&&"auto"!==W.lod?W.lod:16>te?"dot":48>te?"icon":108>te?"compact":"full";if("dot"===oe){const e=Math.min(te,ne,11);te=e,ne=e}const ie=Math.max(1,F.width-te),re=Math.max(1,F.height-ne),le=Math.max(1,X-1),se=e=>F.x+te/2+(Q>1?e/(Q-1):.5)*ie,ae=e=>F.y+ne/2+(e+le/2)/le*re,ce=W.reachableIds?new Set(W.reachableIds):null,ue=null!==(N=W.selectedId)&&void 0!==N?N:null,de=e.selection,he=new Map,fe=new Map,ye=[],me=[];for(const t of e.nodes){const e=t.id,n=Number(f(t,I,0)),o=Number(f(t,L,0)),i=f(t,T,"processor")+"",r=f(t,E,"processor")+"",l=f(t,D,e)+"",s=y(f(t,P,[])),a=null!==(C=t.data)&&void 0!==C?C:t,c=se(n),u=ae(o);he.set(e,{cx:c,cy:u});const d=ce?ce.has(e):null,h=(null==de?void 0:de.isActive)?de.predicate(a):null,m=null!==d?!d:null!==h&&!h;fe.set(e,m);const p=null!=ue&&e===ue,g=m&&!p?H:1,v=null!==(O=_[i])&&void 0!==O?O:_.unknown;"dot"===oe?ye.push({type:"circle",cx:c,cy:u,r:te/2,style:{fill:v,opacity:g,stroke:p?R:"transparent",strokeWidth:p?2:0},datum:t,id:e,label:l}):(ye.push({type:"rect",x:c-te/2,y:u-ne/2,w:te,h:ne,style:{fill:v,opacity:g,stroke:p?R:G,strokeWidth:p?3:1},datum:t,id:e,label:l}),me.push({id:e,cx:c,cy:u,partition:i,semantic:r,label:l,stores:s,opacity:g,selected:p,node:a}))}const pe=[];for(const t of e.edges){const e="string"==typeof t.source?t.source:t.source.id,n="string"==typeof t.target?t.target:t.target.id,o=he.get(e),i=he.get(n);if(!o||!i)continue;const r=!!f(t,z,!1),l=f(t,B,"internal")+"",s=fe.get(e)||fe.get(n)?Math.min(V,1.4*H):V,a=r?U.back:null!==(S=U[l])&&void 0!==S?S:U.internal;let c;if(r){const e=o.cx,t=o.cy+ne/2,n=i.cx,r=i.cy+ne/2,l=Math.max(48,.28*Math.abs(e-n))+ne;c=`M${e},${t} C${e},${t+l} ${n},${r+l} ${n},${r}`}else{const e=o.cx+te/2,t=o.cy,n=i.cx-te/2,r=i.cy,l=(e+n)/2;c=`M${e},${t} C${l},${t} ${l},${r} ${n},${r}`}const u={type:"curved",pathD:c,style:Object.assign({stroke:a,strokeWidth:r?q:Y,fill:"none",opacity:s},r?{strokeDasharray:"5 4",strokeLinecap:"round"}:{}),datum:t};pe.push(u)}const ge=0===me.length?null:t.jsx("g",{className:"lineage-dag-glyphs",children:me.map(e=>function(e,n){var o,i;const{w:r,h:l,lod:s}=n,a="icon"===s?Math.min(r,l):Math.min(l-14,26),c=null!==(i=null!==(o=n.partColors[e.partition])&&void 0!==o?o:n.partColors.unknown)&&void 0!==i?i:"#5a5a6a",u="icon"===s?0:8+a+8,d=null!=n.renderIcon?n.renderIcon({semantic:e.semantic,partition:e.partition,size:a,color:c,node:e.node}):function(e,n,o){var i;const r=n.startsWith("topic")?"T":null!==(i={source:"SR",sink:"SK",filter:"FL",map:"MP",aggregate:"AG",reduce:"RD","join-this":"JN","join-other":"JN",merge:"MG",suppress:"SP",select:"SE",tostream:"TS"}[e])&&void 0!==i?i:"PR";return t.jsxs("g",{children:[t.jsx("rect",{width:o,height:o,rx:4,fill:"rgba(255,255,255,0.08)",stroke:"rgba(255,255,255,0.18)"}),t.jsx("text",{x:o/2,y:o/2+.5,textAnchor:"middle",dominantBaseline:"middle",fontSize:.42*o,fontWeight:700,fill:"var(--semiotic-text, #fff)",children:r})]})}(e.semantic,e.partition,a),h="full"===s,f="icon"!==s,y="full"===s&&n.showChips&&e.stores.length>0;return t.jsxs("g",{transform:`translate(${e.cx-r/2}, ${e.cy-l/2})`,opacity:e.opacity,style:{pointerEvents:"none"},children:[t.jsx("g",{transform:`translate(${"icon"===s?(r-a)/2:8}, ${(l-a)/2})`,children:d}),f&&t.jsx("foreignObject",{x:u,y:h?l/2-12:l/2-9,width:Math.max(8,r-u-8),height:18,style:{pointerEvents:"none"},children:t.jsx("div",{title:e.label,style:{pointerEvents:"none",fontFamily:"var(--semiotic-font-family, inherit)",fontSize:"full"===s?12.5:11.5,fontWeight:600,color:"var(--semiotic-text, #f4f4f8)",lineHeight:"18px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e.label})}),h&&t.jsx("text",{x:u,y:l/2-16,dominantBaseline:"middle",fontSize:9.5,fontWeight:500,fill:"var(--semiotic-text-secondary, #b9b9c8)",style:{textTransform:"uppercase",letterSpacing:"0.04em"},children:n.typeLabel?n.typeLabel({semantic:e.semantic,partition:e.partition,node:e.node}):e.partition.startsWith("topic")?"topic":e.semantic}),y&&e.stores.map((e,o)=>t.jsx("rect",{x:u+15*o,y:l-10,width:12,height:5,rx:1.5,fill:n.chipColor,children:t.jsx("title",{children:e.storeName})},e.storeName+o))]},e.id)}(e,{w:te,h:ne,lod:oe,partColors:_,chipColor:K,showChips:J,renderIcon:W.renderIcon,typeLabel:W.typeLabel}))});return{sceneNodes:ye,sceneEdges:pe,overlays:ge}},exports.marimekkoLayout=e=>{var t,n,o,i,a,c,u;const d=e.config,{plot:h}=e.dimensions;if(0>=h.width||0>=h.height)return{nodes:[]};const f=l(d.categoryAccessor),y=l(d.stackBy),p=e=>{const t="function"==typeof d.valueAccessor?d.valueAccessor(e):e[d.valueAccessor],n=Number(t);return Number.isFinite(n)&&n>0?n:0},g=null!==(t=d.gutter)&&void 0!==t?t:2,v="string"==typeof d.categoryAccessor?d.categoryAccessor:"category",x="string"==typeof d.stackBy?d.stackBy:"stack",b="string"==typeof d.valueAccessor?d.valueAccessor:"value",w=(e,t,n)=>s(o=>{o("category",e),o("stack",t),o("value",n),"category"!==v&&o(v,e),"stack"!==x&&o(x,t),"value"!==b&&o(b,n)}),M=!1!==d.showCategoryLabels,k=null!==(n=d.labelPadding)&&void 0!==n?n:M?22:0,A=Math.max(0,h.height-k),$=[],j=new Map,N=[],C=new Set,O=new Map;for(const t of e.data){const e=f(t)+"",n=y(t)+"",r=p(t);j.has(e)||($.push(e),j.set(e,0),O.set(e,new Map)),C.has(n)||(C.add(n),N.push(n)),j.set(e,(null!==(o=j.get(e))&&void 0!==o?o:0)+r);const l=O.get(e);l.set(n,(null!==(i=l.get(n))&&void 0!==i?i:0)+r)}const S=d.categoryOrder?m(d.categoryOrder,$,e=>j.has(e)):$,W=d.stackOrder?m(d.stackOrder,N,()=>!0):N,F=S.reduce((e,t)=>{var n;return e+(null!==(n=j.get(t))&&void 0!==n?n:0)},0);if(0>=F)return{nodes:[]};const I=Math.max(0,h.width-g*Math.max(0,S.length-1)),L=[],T=[];let E=h.x;for(const t of S){const n=null!==(a=j.get(t))&&void 0!==a?a:0,o=n/F*I;if(0>=o)continue;T.push({cat:t,x:E,w:o});const i=O.get(t);let r=h.y;for(const l of W){const s=null!==(c=i.get(l))&&void 0!==c?c:0;if(0>=s)continue;const a=s/n*A;L.push({type:"rect",x:E,y:r,w:o,h:a,style:{fill:e.resolveColor(l),stroke:"none"},datum:w(t,l,s),group:l}),r+=a}E+=o+g}return{nodes:L,overlays:M&&T.length>0?function(e,t,n){const o=e.map((e,o)=>6.5*e.cat.length>e.w-4?null:r.createElement("text",{key:"marimekko-label-"+o,x:e.x+e.w/2,y:t+12,textAnchor:"middle",fontSize:12,fill:n},e.cat));return r.createElement(r.Fragment,null,...o)}(T,h.y+A+4,`var(--semiotic-text, ${null!==(u=e.theme.semantic.text)&&void 0!==u?u:"currentColor"})`):null}},exports.parallelCoordinatesLayout=e=>{var t,n,i,l,s,a,c,u,d,h,f,y;const m=e.config,{plot:p}=e.dimensions,g=null!==(t=m.fields)&&void 0!==t?t:[];if(2>g.length||0>=p.width||0>=p.height)return{nodes:[]};if(0===e.data.length)return{nodes:[]};const v={};for(const t of g){if(null===(n=m.domains)||void 0===n?void 0:n[t]){v[t]=m.domains[t];continue}let o=1/0,i=-1/0;for(const n of e.data){const e=Number(n[t]);Number.isFinite(e)&&(o>e&&(o=e),e>i&&(i=e))}v[t]=Number.isFinite(o)&&Number.isFinite(i)&&o!==i?[o,i]:[0,1]}const x=!1!==m.showAxes,b=x?null!==(i=m.axisLabelPadding)&&void 0!==i?i:24:8,w=x?18:8,M=g.map(e=>o.scaleLinear().domain(v[e]).range([p.y+p.height-w,p.y+b])),k=g.map((e,t)=>1===g.length?p.x+p.width/2:p.x+t/(g.length-1)*p.width),A=m.colorBy?"function"==typeof m.colorBy?m.colorBy:e=>{var t;return(null!==(t=e[m.colorBy])&&void 0!==t?t:"")+""}:null,$=null!==(l=m.opacity)&&void 0!==l?l:.45,j=null!==(s=m.strokeWidth)&&void 0!==s?s:1.25,N=null!==(a=e.theme.semantic.primary)&&void 0!==a?a:"#3b6cb1",C=null!==(c=m.dimmedOpacity)&&void 0!==c?c:.08,O=m.highlightFn,S=[],W=[];for(const t of e.data){const n=A?e.resolveColor(A(t)+""):N,o=!O||O(t),i=O?o?Math.min(1,$+.4):C:$,r=o?W:S;for(let e=0;g.length-1>e;e++){const l=Number(t[g[e]]),s=Number(t[g[e+1]]);if(!Number.isFinite(l)||!Number.isFinite(s))continue;const a={type:"connector",x1:k[e],y1:M[e](l),x2:k[e+1],y2:M[e+1](s),style:{stroke:n,strokeWidth:O&&o?j+.75:j,opacity:i,fill:"none"},datum:t};r.push(a)}if(m.showPoints)for(let e=0;g.length>e;e++){const o=Number(t[g[e]]);if(!Number.isFinite(o))continue;const l={type:"point",x:k[e],y:M[e](o),r:2.5,style:{fill:n,stroke:"none",opacity:Math.min(1,i+.3)},datum:t};r.push(l)}}let F=null;if(x){const t=`var(--semiotic-border, ${null!==(u=e.theme.semantic.border)&&void 0!==u?u:"#aaa"})`,n=`var(--semiotic-text, ${null!==(d=e.theme.semantic.text)&&void 0!==d?d:"currentColor"})`,o=`var(--semiotic-text-secondary, ${null!==(h=e.theme.semantic.textSecondary)&&void 0!==h?h:"#888"})`,i=p.y+b,l=p.y+p.height-w,s=[];for(let e=0;g.length>e;e++){const a=g[e],c=k[e],u=null!==(y=null===(f=m.tickFormat)||void 0===f?void 0:f[a])&&void 0!==y?y:e=>e.toLocaleString();s.push(r.createElement("line",{key:"pc-axis-line-"+e,x1:c,x2:c,y1:i,y2:l,stroke:t,strokeWidth:1})),s.push(r.createElement("text",{key:"pc-axis-label-"+e,x:c,y:p.y+b-8,textAnchor:"middle",fontSize:12,fontWeight:600,fill:n},a));const[d,h]=v[a],x=5;for(let n=0;x>n;n++){const i=d+(h-d)*n/(x-1),l=M[e](i);s.push(r.createElement("line",{key:`pc-tick-${e}-${n}`,x1:c-3,x2:c+3,y1:l,y2:l,stroke:t,strokeWidth:1}),r.createElement("text",{key:`pc-ticktext-${e}-${n}`,x:c+6,y:l+3,fontSize:10,fill:o},u(i)))}}F=r.createElement(r.Fragment,null,...s)}return{nodes:S.concat(W),overlays:F}},exports.waffleLayout=e=>{var t,n,o,i,r,l;const a=e.config,c=null!==(t=a.rows)&&void 0!==t?t:10,u=null!==(n=a.columns)&&void 0!==n?n:10,d=null!==(o=a.gutter)&&void 0!==o?o:2,h=c*u;if(0>=c||0>=u||0>=h)return{nodes:[]};const{plot:f}=e.dimensions;if(0>=f.width||0>=f.height)return{nodes:[]};const y=(f.width-d*(u-1))/u,m=(f.height-d*(c-1))/c;if(0>=y||0>=m)return{nodes:[]};const p=null!==(i=null==(g=a.categoryAccessor)?null:"function"==typeof g?g:e=>e[g])&&void 0!==i?i:()=>"_default";var g;const v=null!==(r=function(e){return null==e?null:"function"==typeof e?e:t=>Number(t[e])}(a.valueAccessor))&&void 0!==r?r:()=>1,x=new Map,b=[];for(const t of e.data){const e=p(t)+"",n=Number(v(t)),o=Number.isFinite(n)?Math.max(0,n):0;x.has(e)||b.push(e),x.set(e,(null!==(l=x.get(e))&&void 0!==l?l:0)+o)}const w=Array.from(x.values()).reduce((e,t)=>e+t,0);if(0>=w)return{nodes:[]};let M;if(a.categoryOrder&&a.categoryOrder.length>0){const e=new Set,t=[];for(const n of a.categoryOrder)x.has(n)&&!e.has(n)&&(e.add(n),t.push(n));M=[...t,...b.filter(t=>!e.has(t))]}else M=b;if(0===M.length)return{nodes:[]};const k=M.map(e=>{var t;return{cat:e,exact:(null!==(t=x.get(e))&&void 0!==t?t:0)/w*h}}),A=k.map(e=>Object.assign(Object.assign({},e),{count:Math.floor(e.exact)})),$=A.reduce((e,t)=>e+t.count,0),j=A.map((e,t)=>({i:t,rem:e.exact-e.count})).sort((e,t)=>t.rem-e.rem);for(let e=0;h-$>e;e++)A[j[e%j.length].i].count+=1;const N="string"==typeof a.categoryAccessor?a.categoryAccessor:"category",C="string"==typeof a.valueAccessor?a.valueAccessor:"value",O=(e,t,n)=>s(o=>{var i,r;o("category",e),o("value",null!==(i=x.get(e))&&void 0!==i?i:0),"category"!==N&&o(N,e),"value"!==C&&o(C,null!==(r=x.get(e))&&void 0!==r?r:0),o("cells",n),o("_waffleCategory",e),o("_waffleIndex",t)}),S=[];let W=0;for(const t of A){const n=e.resolveColor(t.cat);for(let e=0;t.count>e;e++)S.push({type:"rect",x:f.x+W%u*(y+d),y:f.y+(c-1-Math.floor(W/u))*(m+d),w:y,h:m,style:{fill:n,stroke:"none"},datum:O(t.cat,W,t.count),group:t.cat}),W++}return{nodes:S}};
@@ -1 +1 @@
1
- import{interpolateRgb as t}from"d3-interpolate";import*as e from"react";import{scaleLinear as n}from"d3-scale";function o(t){return"function"==typeof t?t:e=>e[t]}function i(t){const e=Object.create(null);return t((t,n)=>{e[t]=n}),e}const r=t=>{var e,n,o,r,l,s;const c=t.config,a=null!==(e=c.rows)&&void 0!==e?e:10,u=null!==(n=c.columns)&&void 0!==n?n:10,d=null!==(o=c.gutter)&&void 0!==o?o:2,h=a*u;if(0>=a||0>=u||0>=h)return{nodes:[]};const{plot:f}=t.dimensions;if(0>=f.width||0>=f.height)return{nodes:[]};const y=(f.width-d*(u-1))/u,m=(f.height-d*(a-1))/a;if(0>=y||0>=m)return{nodes:[]};const g=null!==(r=null==(v=c.categoryAccessor)?null:"function"==typeof v?v:t=>t[v])&&void 0!==r?r:()=>"_default";var v;const p=null!==(l=function(t){return null==t?null:"function"==typeof t?t:e=>Number(e[t])}(c.valueAccessor))&&void 0!==l?l:()=>1,x=new Map,b=[];for(const e of t.data){const t=g(e)+"",n=Number(p(e)),o=Number.isFinite(n)?Math.max(0,n):0;x.has(t)||b.push(t),x.set(t,(null!==(s=x.get(t))&&void 0!==s?s:0)+o)}const w=Array.from(x.values()).reduce((t,e)=>t+e,0);if(0>=w)return{nodes:[]};let k;if(c.categoryOrder&&c.categoryOrder.length>0){const t=new Set,e=[];for(const n of c.categoryOrder)x.has(n)&&!t.has(n)&&(t.add(n),e.push(n));k=[...e,...b.filter(e=>!t.has(e))]}else k=b;if(0===k.length)return{nodes:[]};const A=k.map(t=>{var e;return{cat:t,exact:(null!==(e=x.get(t))&&void 0!==e?e:0)/w*h}}),M=A.map(t=>Object.assign(Object.assign({},t),{count:Math.floor(t.exact)})),$=M.reduce((t,e)=>t+e.count,0),N=M.map((t,e)=>({i:e,rem:t.exact-t.count})).sort((t,e)=>e.rem-t.rem);for(let t=0;h-$>t;t++)M[N[t%N.length].i].count+=1;const O="string"==typeof c.categoryAccessor?c.categoryAccessor:"category",C="string"==typeof c.valueAccessor?c.valueAccessor:"value",j=(t,e,n)=>i(o=>{var i,r;o("category",t),o("value",null!==(i=x.get(t))&&void 0!==i?i:0),"category"!==O&&o(O,t),"value"!==C&&o(C,null!==(r=x.get(t))&&void 0!==r?r:0),o("cells",n),o("_waffleCategory",t),o("_waffleIndex",e)}),F=[];let S=0;for(const e of M){const n=t.resolveColor(e.cat);for(let t=0;e.count>t;t++)F.push({type:"rect",x:f.x+S%u*(y+d),y:f.y+(a-1-Math.floor(S/u))*(m+d),w:y,h:m,style:{fill:n,stroke:"none"},datum:j(e.cat,S,e.count),group:e.cat}),S++}return{nodes:F}},l=864e5,s=e=>{var n,o,i,r,s,a,u,d;const h=e.config,{plot:f}=e.dimensions;if(0>=f.width||0>=f.height)return{nodes:[]};const y=t=>{const e="function"==typeof h.dateAccessor?h.dateAccessor(t):t[h.dateAccessor];return e instanceof Date?e:new Date(e)},m=t=>{const e="function"==typeof h.valueAccessor?h.valueAccessor(t):t[h.valueAccessor];return Number(e)},g=new Map;let v=null;for(const t of e.data){const e=y(t);if(!isFinite(e.getTime()))continue;null==v&&(v=e.getUTCFullYear());const o=c(e),i=m(t);g.set(o,(null!==(n=g.get(o))&&void 0!==n?n:0)+(Number.isFinite(i)?i:0))}const p=null!==(i=null!==(o=h.year)&&void 0!==o?o:v)&&void 0!==i?i:(new Date).getUTCFullYear();let x=1/0,b=-1/0;for(const t of g.values())x>t&&(x=t),t>b&&(b=t);x===1/0&&(x=0,b=0);const[w,k]=null!==(r=h.colorRamp)&&void 0!==r?r:[null!==(s=e.theme.semantic.surface)&&void 0!==s?s:"#ebedf0",null!==(a=e.theme.semantic.primary)&&void 0!==a?a:"#216e39"],A=e=>{if(b===x)return w;const n=(e-x)/(b-x);return t(w,k)(n)},M=null!==(u=h.gutter)&&void 0!==u?u:2,$=null!==(d=h.labelInset)&&void 0!==d?d:0,N=Math.min((f.width-$-53*M)/54,(f.height-6*M)/7);if(0>=N)return{nodes:[]};const O=new Date(Date.UTC(p,0,1)),C=O.getUTCDay(),j=new Date(O.getTime()-C*l),F=[];for(let t=0;54>t;t++)for(let e=0;7>e;e++){const n=new Date(j.getTime()+(7*t+e)*l);if(n.getUTCFullYear()!==p)continue;const o=c(n),i=g.get(o),r=null==i?w:A(i);F.push({type:"rect",x:f.x+$+t*(N+M),y:f.y+e*(N+M),w:N,h:N,style:{fill:r,stroke:"none"},datum:{date:n,value:null!=i?i:0}})}return{nodes:F}};function c(t){return`${t.getUTCFullYear()}-${a(t.getUTCMonth()+1)}-${a(t.getUTCDate())}`}function a(t){return 10>t?"0"+t:t+""}const u=t=>{var e,n,o,i,r,l,s,c,a;const u=t.config,d=null!==(e=u.nodeWidth)&&void 0!==e?e:80,h=null!==(n=u.nodeHeight)&&void 0!==n?n:30,f=null!==(o=u.orientation)&&void 0!==o?o:"vertical",y=null!==(i=u.edgeCurve)&&void 0!==i?i:"curved",m=!1!==u.showLabels,g=null!==(r=u.labelAccessor)&&void 0!==r?r:"id",v="function"==typeof g?g:t=>{var e,n;const o=t.data,i=o?o[g]:void 0;return(null!==(n=null!==(e=null!=i?i:t[g])&&void 0!==e?e:t.id)&&void 0!==n?n:"")+""},p=new Map,x=[],b=[],w=t=>{var e,n,o;const i=null!==(e=t.data)&&void 0!==e?e:{};return{x:"number"==typeof i.x?i.x:t.x,y:"number"==typeof i.y?i.y:t.y,w:null!==(n="number"==typeof i.width?i.width:t.width)&&void 0!==n?n:d,h:null!==(o="number"==typeof i.height?i.height:t.height)&&void 0!==o?o:h}};for(const e of t.nodes){const{x:n,y:o,w:i,h:r}=w(e);null!=n&&null!=o&&(p.set(e.id,{x:n,y:o,w:i,h:r}),x.push({type:"rect",x:n-i/2,y:o-r/2,w:i,h:r,style:{fill:null!==(l=u.nodeFill)&&void 0!==l?l:t.resolveColor(e.id),stroke:`var(--semiotic-surface, ${null!==(s=t.theme.semantic.surface)&&void 0!==s?s:"#fff"})`,strokeWidth:1.5},datum:e,id:e.id,label:v(e)+""}),m&&b.push({x:n,y:o,text:v(e)+"",anchor:"middle",baseline:"middle",fontSize:11}))}const k=[];for(const e of t.edges){const n="string"==typeof e.target?e.target:e.target.id,o=p.get("string"==typeof e.source?e.source:e.source.id),i=p.get(n);if(!o||!i)continue;const r="vertical"===f?{x:o.x,y:o.y+o.h/2}:{x:o.x+o.w/2,y:o.y},l="vertical"===f?{x:i.x,y:i.y-i.h/2}:{x:i.x-i.w/2,y:i.y};if("line"===y)k.push({type:"line",x1:r.x,y1:r.y,x2:l.x,y2:l.y,style:{stroke:`var(--semiotic-border, ${null!==(c=t.theme.semantic.border)&&void 0!==c?c:"#999"})`,strokeWidth:1},datum:e});else{const n=(r.y+l.y)/2,o=(r.x+l.x)/2;k.push({type:"curved",pathD:"vertical"===f?`M${r.x},${r.y} C${r.x},${n} ${l.x},${n} ${l.x},${l.y}`:`M${r.x},${r.y} C${o},${r.y} ${o},${l.y} ${l.x},${l.y}`,style:{stroke:`var(--semiotic-border, ${null!==(a=t.theme.semantic.border)&&void 0!==a?a:"#999"})`,strokeWidth:1,fill:"none"},datum:e})}}return{sceneNodes:x,sceneEdges:k,labels:b}},d=t=>{var e,n,o,i,r,l,s,c,a;const u=t.config,d=null!==(e=u.nodeWidth)&&void 0!==e?e:100,h=null!==(n=u.nodeHeight)&&void 0!==n?n:36,f=null!==(o=u.edgeStyle)&&void 0!==o?o:"polyline",y=!1!==u.showLabels,m=null!==(i=u.labelAccessor)&&void 0!==i?i:"label",g="function"==typeof m?m:t=>{var e,n;const o=t.data,i=o?o[m]:void 0;return(null!==(n=null!==(e=null!=i?i:t[m])&&void 0!==e?e:t.id)&&void 0!==n?n:"")+""},v=new Map,p=[],x=[],b=t=>{var e,n,o;const i=null!==(e=t.data)&&void 0!==e?e:{};return{x:"number"==typeof i.x?i.x:t.x,y:"number"==typeof i.y?i.y:t.y,w:null!==(n="number"==typeof i.width?i.width:t.width)&&void 0!==n?n:d,h:null!==(o="number"==typeof i.height?i.height:t.height)&&void 0!==o?o:h}};for(const e of t.nodes){const{x:n,y:o,w:i,h:s}=b(e);null!=n&&null!=o&&(v.set(e.id,{x:n,y:o,w:i,h:s}),p.push({type:"rect",x:n-i/2,y:o-s/2,w:i,h:s,style:{fill:null!==(r=u.nodeFill)&&void 0!==r?r:t.resolveColor(e.id),stroke:`var(--semiotic-border, ${null!==(l=t.theme.semantic.border)&&void 0!==l?l:"#888"})`,strokeWidth:1.5},datum:e,id:e.id,label:g(e)+""}),y&&x.push({x:n,y:o,text:g(e)+"",anchor:"middle",baseline:"middle",fontSize:11}))}const w=null!==(s=u.edgeStroke)&&void 0!==s?s:`var(--semiotic-border, ${null!==(c=t.theme.semantic.border)&&void 0!==c?c:"#666"})`,k=[];for(const e of t.edges){const t="string"==typeof e.target?e.target:e.target.id,n=v.get("string"==typeof e.source?e.source:e.source.id),o=v.get(t);if(!n||!o)continue;const i=null!==(a=e.data)&&void 0!==a?a:{},r=Array.isArray(i.points)?i.points:e.points;if(r&&r.length>=2)if("smooth"!==f||3>r.length){const t="M"+r.map(t=>`${t.x},${t.y}`).join(" L ");k.push({type:"curved",pathD:t,style:{stroke:w,strokeWidth:1,fill:"none"},datum:e})}else{let t=`M${r[0].x},${r[0].y}`;for(let e=1;r.length-1>e;e++)t+=` Q${r[e].x},${r[e].y} ${(r[e].x+r[e+1].x)/2},${(r[e].y+r[e+1].y)/2}`;const n=r[r.length-1];t+=` T${n.x},${n.y}`,k.push({type:"curved",pathD:t,style:{stroke:w,strokeWidth:1,fill:"none"},datum:e})}else k.push({type:"line",x1:n.x,y1:n.y,x2:o.x,y2:o.y,style:{stroke:w,strokeWidth:1},datum:e})}return{sceneNodes:p,sceneEdges:k,labels:x}},h=t=>{var n,r,l,s,c,a,u;const d=t.config,{plot:h}=t.dimensions;if(0>=h.width||0>=h.height)return{nodes:[]};const y=o(d.categoryAccessor),m=o(d.stackBy),g=t=>{const e="function"==typeof d.valueAccessor?d.valueAccessor(t):t[d.valueAccessor],n=Number(e);return Number.isFinite(n)&&n>0?n:0},v=null!==(n=d.gutter)&&void 0!==n?n:2,p="string"==typeof d.categoryAccessor?d.categoryAccessor:"category",x="string"==typeof d.stackBy?d.stackBy:"stack",b="string"==typeof d.valueAccessor?d.valueAccessor:"value",w=(t,e,n)=>i(o=>{o("category",t),o("stack",e),o("value",n),"category"!==p&&o(p,t),"stack"!==x&&o(x,e),"value"!==b&&o(b,n)}),k=!1!==d.showCategoryLabels,A=null!==(r=d.labelPadding)&&void 0!==r?r:k?22:0,M=Math.max(0,h.height-A),$=[],N=new Map,O=[],C=new Set,j=new Map;for(const e of t.data){const t=y(e)+"",n=m(e)+"",o=g(e);N.has(t)||($.push(t),N.set(t,0),j.set(t,new Map)),C.has(n)||(C.add(n),O.push(n)),N.set(t,(null!==(l=N.get(t))&&void 0!==l?l:0)+o);const i=j.get(t);i.set(n,(null!==(s=i.get(n))&&void 0!==s?s:0)+o)}const F=d.categoryOrder?f(d.categoryOrder,$,t=>N.has(t)):$,S=d.stackOrder?f(d.stackOrder,O,()=>!0):O,W=F.reduce((t,e)=>{var n;return t+(null!==(n=N.get(e))&&void 0!==n?n:0)},0);if(0>=W)return{nodes:[]};const I=Math.max(0,h.width-v*Math.max(0,F.length-1)),T=[],D=[];let E=h.x;for(const e of F){const n=null!==(c=N.get(e))&&void 0!==c?c:0,o=n/W*I;if(0>=o)continue;D.push({cat:e,x:E,w:o});const i=j.get(e);let r=h.y;for(const l of S){const s=null!==(a=i.get(l))&&void 0!==a?a:0;if(0>=s)continue;const c=s/n*M;T.push({type:"rect",x:E,y:r,w:o,h:c,style:{fill:t.resolveColor(l),stroke:"none"},datum:w(e,l,s),group:l}),r+=c}E+=o+v}return{nodes:T,overlays:k&&D.length>0?function(t,n,o){const i=t.map((t,i)=>6.5*t.cat.length>t.w-4?null:e.createElement("text",{key:"marimekko-label-"+i,x:t.x+t.w/2,y:n+12,textAnchor:"middle",fontSize:12,fill:o},t.cat));return e.createElement(e.Fragment,null,...i)}(D,h.y+M+4,`var(--semiotic-text, ${null!==(u=t.theme.semantic.text)&&void 0!==u?u:"currentColor"})`):null}};function f(t,e,n){const o=new Set,i=[];for(const e of t)n(e)&&!o.has(e)&&(o.add(e),i.push(e));for(const t of e)o.has(t)||i.push(t);return i}const y=t=>{var n,r,l,s,c,a,u,d,h,f,y,m;const g=t.config,{plot:v}=t.dimensions;if(0>=v.width||0>=v.height||0===t.data.length)return{nodes:[]};const p=null!==(n=g.rowHeight)&&void 0!==n?n:28,x=null!==(r=g.rowGap)&&void 0!==r?r:12,b=!1!==g.showLabels,w=b?null!==(l=g.labelWidth)&&void 0!==l?l:120:0,k=!1!==g.showTicks,A=k?14:0,M=null!==(s=g.tickFormat)&&void 0!==s?s:t=>t.toLocaleString(),$=v.x+w,N=Math.max(0,v.width-w);if(0>=N)return{nodes:[]};const O=o(g.categoryAccessor),C=t=>{const e=Number(t);return Number.isFinite(e)&&e>0?e:0},j=t=>C("function"==typeof g.valueAccessor?g.valueAccessor(t):t[g.valueAccessor]),F=t=>C("function"==typeof g.targetAccessor?g.targetAccessor(t):t[g.targetAccessor]),S=t=>{const e="function"==typeof g.rangesAccessor?g.rangesAccessor(t):t[g.rangesAccessor];return Array.isArray(e)?e.map(C).sort((t,e)=>t-e):[]},W="string"==typeof g.categoryAccessor?g.categoryAccessor:"metric",I="string"==typeof g.valueAccessor?g.valueAccessor:"value",T="string"==typeof g.targetAccessor?g.targetAccessor:"target",D=null!==(a=null!==(c=g.actualColor)&&void 0!==c?c:t.theme.semantic.primary)&&void 0!==a?a:"#3b6cb1",E=null!==(u=t.theme.semantic.text)&&void 0!==u?u:"currentColor",P=null!==(d=t.theme.semantic.textSecondary)&&void 0!==d?d:"#888",B=null!==(h=t.theme.semantic.surface)&&void 0!==h?h:"#e8eaed",z=null!==(f=t.theme.semantic.grid)&&void 0!==f?f:"#cdd1d6",L=null!==(y=t.theme.semantic.border)&&void 0!==y?y:"#a3a8af",U=null!==(m=g.targetColor)&&void 0!==m?m:`var(--semiotic-text, ${E})`,V=[`var(--semiotic-surface, ${B})`,`var(--semiotic-grid, ${z})`,`var(--semiotic-border, ${L})`],_=`var(--semiotic-text, ${E})`,Y=`var(--semiotic-text-secondary, ${P})`,H=[],G=[];for(let e=0;t.data.length>e;e++){const n=t.data[e],o=S(n),r=j(n),l=F(n),s=Math.max(r,l,...o.length?o:[0]);if(0>=s)continue;const c=v.y+e*(p+x+A);if(c+p+A>v.y+v.height)break;G.push({yTop:c,label:O(n),actual:r,target:l,maxVal:s});const a=t=>$+t/s*N,u=O(n),d=t=>i(e=>{e("metric",u),"metric"!==W&&e(W,u),t(e)});let h=$;for(let t=0;o.length>t;t++){const e=a(o[t]),n=e-h;n>0&&H.push({type:"rect",x:h,y:c,w:n,h:p,style:{fill:V[Math.min(t,V.length-1)],stroke:"none"},datum:d(e=>{e("range",t),e("rangeValue",o[t]),e("kind","range")}),group:"range-"+t}),h=e}const f=Math.max(6,Math.floor(.45*p));H.push({type:"rect",x:$,y:c+(p-f)/2,w:a(r)-$,h:f,style:{fill:D,stroke:"none"},datum:d(t=>{t("value",r),t("kind","actual"),"value"!==I&&t(I,r)}),group:"actual"});const y=3,m=Math.floor(.8*p);H.push({type:"rect",x:a(l)-y/2,y:c+(p-m)/2,w:y,h:m,style:{fill:U,stroke:"none"},datum:d(t=>{t("target",l),t("kind","target"),"target"!==T&&t(T,l)}),group:"target"})}const Q=[];for(let t=0;G.length>t;t++){const n=G[t];if(b&&Q.push(e.createElement("text",{key:"bullet-label-"+t,x:v.x+w-8,y:n.yTop+p/2,textAnchor:"end",dominantBaseline:"middle",fontSize:13,fontWeight:500,fill:_},n.label)),k){const o=5,i=n.yTop+p+2;for(let r=0;o>r;r++){const l=n.maxVal*r/(o-1),s=$+l/n.maxVal*N;Q.push(e.createElement("line",{key:`bullet-tick-${t}-${r}`,x1:s,x2:s,y1:i,y2:i+3,stroke:Y,strokeWidth:1}),e.createElement("text",{key:`bullet-ticktext-${t}-${r}`,x:s,y:i+12,textAnchor:0===r?"start":r===o-1?"end":"middle",fontSize:10,fill:Y},M(l)))}}}return{nodes:H,overlays:Q.length>0?e.createElement(e.Fragment,null,...Q):null}},m=t=>{var o,i,r,l,s,c,a,u,d,h,f,y;const m=t.config,{plot:g}=t.dimensions,v=null!==(o=m.fields)&&void 0!==o?o:[];if(2>v.length||0>=g.width||0>=g.height)return{nodes:[]};if(0===t.data.length)return{nodes:[]};const p={};for(const e of v){if(null===(i=m.domains)||void 0===i?void 0:i[e]){p[e]=m.domains[e];continue}let n=1/0,o=-1/0;for(const i of t.data){const t=Number(i[e]);Number.isFinite(t)&&(n>t&&(n=t),t>o&&(o=t))}p[e]=Number.isFinite(n)&&Number.isFinite(o)&&n!==o?[n,o]:[0,1]}const x=!1!==m.showAxes,b=x?null!==(r=m.axisLabelPadding)&&void 0!==r?r:24:8,w=x?18:8,k=v.map(t=>n().domain(p[t]).range([g.y+g.height-w,g.y+b])),A=v.map((t,e)=>1===v.length?g.x+g.width/2:g.x+e/(v.length-1)*g.width),M=m.colorBy?"function"==typeof m.colorBy?m.colorBy:t=>{var e;return(null!==(e=t[m.colorBy])&&void 0!==e?e:"")+""}:null,$=null!==(l=m.opacity)&&void 0!==l?l:.45,N=null!==(s=m.strokeWidth)&&void 0!==s?s:1.25,O=null!==(c=t.theme.semantic.primary)&&void 0!==c?c:"#3b6cb1",C=null!==(a=m.dimmedOpacity)&&void 0!==a?a:.08,j=m.highlightFn,F=[],S=[];for(const e of t.data){const n=M?t.resolveColor(M(e)+""):O,o=!j||j(e),i=j?o?Math.min(1,$+.4):C:$,r=o?S:F;for(let t=0;v.length-1>t;t++){const l=Number(e[v[t]]),s=Number(e[v[t+1]]);if(!Number.isFinite(l)||!Number.isFinite(s))continue;const c={type:"connector",x1:A[t],y1:k[t](l),x2:A[t+1],y2:k[t+1](s),style:{stroke:n,strokeWidth:j&&o?N+.75:N,opacity:i,fill:"none"},datum:e};r.push(c)}if(m.showPoints)for(let t=0;v.length>t;t++){const o=Number(e[v[t]]);if(!Number.isFinite(o))continue;const l={type:"point",x:A[t],y:k[t](o),r:2.5,style:{fill:n,stroke:"none",opacity:Math.min(1,i+.3)},datum:e};r.push(l)}}let W=null;if(x){const n=`var(--semiotic-border, ${null!==(u=t.theme.semantic.border)&&void 0!==u?u:"#aaa"})`,o=`var(--semiotic-text, ${null!==(d=t.theme.semantic.text)&&void 0!==d?d:"currentColor"})`,i=`var(--semiotic-text-secondary, ${null!==(h=t.theme.semantic.textSecondary)&&void 0!==h?h:"#888"})`,r=g.y+b,l=g.y+g.height-w,s=[];for(let t=0;v.length>t;t++){const c=v[t],a=A[t],u=null!==(y=null===(f=m.tickFormat)||void 0===f?void 0:f[c])&&void 0!==y?y:t=>t.toLocaleString();s.push(e.createElement("line",{key:"pc-axis-line-"+t,x1:a,x2:a,y1:r,y2:l,stroke:n,strokeWidth:1})),s.push(e.createElement("text",{key:"pc-axis-label-"+t,x:a,y:g.y+b-8,textAnchor:"middle",fontSize:12,fontWeight:600,fill:o},c));const[d,h]=p[c],x=5;for(let o=0;x>o;o++){const r=d+(h-d)*o/(x-1),l=k[t](r);s.push(e.createElement("line",{key:`pc-tick-${t}-${o}`,x1:a-3,x2:a+3,y1:l,y2:l,stroke:n,strokeWidth:1}),e.createElement("text",{key:`pc-ticktext-${t}-${o}`,x:a+6,y:l+3,fontSize:10,fill:i},u(r)))}}W=e.createElement(e.Fragment,null,...s)}return{nodes:F.concat(S),overlays:W}};function g(t,e){var n,o,i;const r=null!==(o=null===(n=e.scales)||void 0===n?void 0:n.x)&&void 0!==o?o:null===(i=e.scales)||void 0===i?void 0:i.time;return r?null!=t.x?r(t.x):e.xAccessor&&null!=t[e.xAccessor]?r(t[e.xAccessor]):null:null}function v(t,e){var n,o,i;const r=null!==(o=null===(n=e.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(i=e.scales)||void 0===i?void 0:i.value;return r?null!=t.y?r(t.y):e.yAccessor&&null!=t[e.yAccessor]?r(t[e.yAccessor]):null:null}function p(t){return null==t?null:t+""}function x(t,e,n){var o;return null===(o=e.stickyPositionCache)||void 0===o||o.set(t,n),n}const b=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function w(t){return!!t&&"object"==typeof t&&b.has(function(t){return"string"==typeof(null==t?void 0:t.type)?t.type:""}(t))}new Set(["label","callout","callout-circle","callout-rect"]);const k=2e4;function A(t){return"primary"===(null==t?void 0:t.emphasis)||!0===(null==t?void 0:t.defensive)}function M(t,e,n={}){return"number"==typeof n.maxAnnotations&&Number.isFinite(n.maxAnnotations)?Math.max(0,Math.floor(n.maxAnnotations)):t>0&&e>0?Math.max(1,Math.round(t*e/(n.areaPerAnnotation&&n.areaPerAnnotation>0?n.areaPerAnnotation:2e4))):1/0}function $(t){var e,n;let o;const i=null==t?void 0:t.emphasis;o="primary"===i?100:"secondary"===i?10:50;const r=null===(e=null==t?void 0:t.provenance)||void 0===e?void 0:e.confidence;switch("number"==typeof r&&Number.isFinite(r)&&(o+=15*Math.max(0,Math.min(1,r))),null===(n=null==t?void 0:t.lifecycle)||void 0===n?void 0:n.freshness){case"fresh":o+=8;break;case"aging":o+=4;break;case"stale":o+=1;break;case"expired":o-=200}return o}function N(t){var e;const{annotations:n,width:o,height:i}=t,r=Math.max(0,null!==(e=t.minVisible)&&void 0!==e?e:1),l=M(o,i,t),s=n.map((t,e)=>{return{annotation:t,index:e,note:(n=t,w(n))};var n}),c=s.filter(t=>t.note);if(0===c.length||l>=c.length)return{visible:n.slice(),deferred:[],budget:l};const a=c.filter(t=>A(t.annotation)),u=c.filter(t=>!A(t.annotation)).sort((t,e)=>$(e.annotation)-$(t.annotation)||t.index-e.index),d=Math.min(u.length,Math.max(Math.max(0,l-a.length),Math.max(0,r-a.length))),h=new Set([...a.map(t=>t.index),...u.slice(0,d).map(t=>t.index)]),f=[],y=[];for(const{annotation:t,index:e,note:n}of s)!n||h.has(e)?f.push(t):y.push(t);return{visible:f,deferred:y,budget:l}}const O=32,C=6,j=4,F=8,S=72;const W={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function I(t){return w(t)}function T(t,e){if(!t)return[];const n=Math.max(1,Math.floor(e/7)),o=t.split(/\s+/).filter(Boolean),i=[];let r="";for(const t of o)r&&r.length+t.length+1>n?(i.push(r),r=t):r=r?`${r} ${t}`:t;return r&&i.push(r),i}function D(t,e,n,o,i){const r=t+n,l=e+o;return Math.abs(n)>Math.abs(o)?{x:0>n?r-i.width-4:r+4,y:0>o?l-i.height:l,width:i.width,height:i.height}:{x:0>n?r-i.width:r,y:0>o?l-i.height-4:l+4,width:i.width,height:i.height}}function E(t,e){return{x:t.x-e,y:t.y-e,width:t.width+2*e,height:t.height+2*e}}function P(t,e){return Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x))*Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y))}function B(t,e,n,o,i,r,l,s){const c=E(t,l);let a=.4*Math.hypot(e.dx,e.dy)+80*function(t,e,n,o){const i=Math.max(0,o-t.x),r=Math.max(0,o-t.y);return(i+Math.max(0,t.x+t.width-(e-o)))*t.height+(r+Math.max(0,t.y+t.height-(n-o)))*t.width}(c,i,r,s);for(const t of n)a+=12*P(c,t);for(const t of o)a+=4*P(c,t);return a}function z(t,e,n){var o,i;if("widget"===t.type&&"number"==typeof t.px&&"number"==typeof t.py)return{x:t.px,y:t.py};const r=null!==(o=t.pointId)&&void 0!==o?o:t.nodeId;if(null!=r&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===r);if(t)return{x:t.x,y:t.y}}const l=t.coordinates,s=null===(i=n.scales)||void 0===i?void 0:i.geoProjection;if(Array.isArray(l)&&l.length>=2&&s){const t=l[0],e=l[1];if("number"==typeof t&&"number"==typeof e){const n=s([t,e]);if(n&&"number"==typeof n[0]&&"number"==typeof n[1])return{x:n[0],y:n[1]}}}return n.scales||"number"!=typeof t.x||"number"!=typeof t.y?function(t,e,n){var o,i;const r=t.anchor||(null===(o=t.lifecycle)||void 0===o?void 0:o.anchor)||"fixed";if("latest"===r){if(null!=t.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let o=n.pointNodes.length-1;o>=0;o--){const i=n.pointNodes[o];if(i.pointId===t.pointId)return x(e,n,{x:i.x,y:i.y})}const o=function(t){var e,n,o,i,r,l;const s=t.data;if(!s||0===s.length)return null;const c=s[s.length-1],a=null!==(n=null===(e=t.scales)||void 0===e?void 0:e.x)&&void 0!==n?n:null===(o=t.scales)||void 0===o?void 0:o.time,u=null!==(r=null===(i=t.scales)||void 0===i?void 0:i.y)&&void 0!==r?r:null===(l=t.scales)||void 0===l?void 0:l.value;if(!a||!u)return null;const d=c[t.xAccessor||"x"],h=c[t.yAccessor||"y"];return null==d||null==h?null:{x:a(d),y:u(h)}}(n);return o?x(e,n,o):null}if("semantic"===r){const o=function(t,e,n){var o,i;const r=function(t){var e,n;return p(null!==(n=null===(e=t.provenance)||void 0===e?void 0:e.stableId)&&void 0!==n?n:t.stableId)}(t);if(!r)return null;const l=null===(o=n.pointNodes)||void 0===o?void 0:o.find(t=>p(t.pointId)===r);if(l)return x(e,n,{x:l.x,y:l.y});const s=null===(i=n.data)||void 0===i?void 0:i.find(t=>function(t){var e,n,o;return p(null!==(n=null!==(e=t.stableId)&&void 0!==e?e:t.id)&&void 0!==n?n:null===(o=t.provenance)||void 0===o?void 0:o.stableId)}(t)===r);if(!s)return null;const c=g(s,n),a=v(s,n);return null==c||null==a?null:x(e,n,{x:c,y:a})}(t,e,n);if(o)return o}let l=null,s=null;if(null!=t.pointId&&n.pointNodes){const e=n.pointNodes.find(e=>e.pointId===t.pointId);e&&(l=e.x,s=e.y)}if(null!=l&&null!=s||(l=g(t,n),s=v(t,n)),null!=l&&null!=s)return x(e,n,{x:l,y:s});if("sticky"===r){const t=null===(i=n.stickyPositionCache)||void 0===i?void 0:i.get(e);if(t)return t}return null}(t,e,n):{x:t.x,y:t.y}}function L(t){var e;const{annotations:n,context:o,defaultOffset:i=O,notePadding:r=C,markPadding:l=j,edgePadding:s=F,preserveManualOffsets:c=!0,routeLongConnectors:a=!0,connectorThreshold:u=S,density:d,progressiveDisclosure:h=!1,redundantCues:f=!1,responsive:y,cohesion:m,audience:g}=t,v=o.width||0,p=o.height||0;if(0===n.length||0>=v||0>=p)return n.slice();const x=[],b=function(t,e){return(t.pointNodes||[]).map(t=>{const n=Math.max(1,t.r||1)+e;return{x:t.x-n,y:t.y-n,width:2*n,height:2*n}})}(o,l);let w=!1;const k=n.map((t,e)=>{if(!I(t))return t;const n=z(t,e,o);if(!n)return t;const l=function(t){if("widget"===t.type)return{width:"number"==typeof t.width?t.width:32,height:"number"==typeof t.height?t.height:32};const e="number"==typeof t.wrap?t.wrap:120,n=[...T("string"==typeof t.title?t.title:void 0,e),...T("string"==typeof t.label?t.label:void 0,e)],o=n.reduce((t,e)=>Math.max(t,e.length),0);return{width:Math.max(24,Math.min(e,7*o)+10),height:Math.max(18,16*n.length+6)}}(t);if(c&&("number"==typeof(d=t).dx||"number"==typeof d.dy)){const e=function(t){return"text"===t.type||"widget"===t.type?{dx:0,dy:0}:{dx:30,dy:-30}}(t);return x.push(E(D(n.x,n.y,"number"==typeof t.dx?t.dx:e.dx,"number"==typeof t.dy?t.dy:e.dy,l),r)),t}var d;let h=null,f=1/0;for(const t of function(t){const e=1.6*t;return[{dx:t,dy:-t},{dx:-t,dy:-t},{dx:t,dy:t},{dx:-t,dy:t},{dx:t,dy:0},{dx:-t,dy:0},{dx:0,dy:-t},{dx:0,dy:t},{dx:e,dy:-e},{dx:-e,dy:-e},{dx:e,dy:e},{dx:-e,dy:e}]}(i)){const e=B(D(n.x,n.y,t.dx,t.dy,l),t,x,b,v,p,r,s);f>e&&(h=t,f=e)}if(!h)return t;const y=E(D(n.x,n.y,h.dx,h.dy,l),r);x.push(y);const m=Math.hypot(h.dx,h.dy),g=a&&m>=u&&"text"!==t.type&&"widget"!==t.type?Object.assign(Object.assign({},t.connector||{end:"arrow"}),{type:"curve"}):t.connector;return w=!0,Object.assign(Object.assign(Object.assign({},t),{dx:h.dx,dy:h.dy}),g?{connector:g}:{})}),A=w?k:n.slice();let $=A;if(f){let t=!1;const e=A.map(e=>{const n=function(t){return"text"!==t.type||"string"!=typeof t.color||8>Math.hypot("number"==typeof t.dx?t.dx:0,"number"==typeof t.dy?t.dy:0)?t:Object.assign(Object.assign({},t),{_redundantConnector:!0})}(e);return n!==e&&(t=!0),n});$=t?e:A}{let t=!1;const e=$.map(e=>{if(!0!==(null==e?void 0:e.defensive))return e;const n=function(t){var e;const n=null==t?void 0:t.provenance;if(!n||"object"!=typeof n)return t;const o="string"==typeof n.source?null!==(e=W[n.source])&&void 0!==e?e:n.source:null,i="number"==typeof n.confidence&&Number.isFinite(n.confidence)?Math.round(100*Math.max(0,Math.min(1,n.confidence)))+"%":null;if(!o&&!i)return t;if(null!=t.label&&"string"!=typeof t.label)return t;const r=[o,i].filter(Boolean).join(" · "),l="string"==typeof t.label?t.label:"";return l.includes(`(${r})`)?t:Object.assign(Object.assign({},t),{label:l?`${l} (${r})`:`(${r})`})}(e);return n!==e&&(t=!0),n});$=t?e:$}const P=new Set;if(d){const t="object"==typeof d?d:{},n=function(t){if(!t)return 1;const e=function(t){const e=null==t?void 0:t.familiarity;if(!e)return 3;const n=Object.values(e).filter(t=>"number"==typeof t&&Number.isFinite(t));return 0===n.length?3:n.reduce((t,e)=>t+e,0)/n.length}(t);return e>2?4>e?1:.6:1.5}(g),o=1===n?t:Object.assign(Object.assign({},t),{maxAnnotations:Math.max(0,Math.round((null!==(e=t.maxAnnotations)&&void 0!==e?e:M(v,p,t))*n))}),{deferred:i}=N(Object.assign({annotations:$,width:v,height:p},o));for(const t of i)P.add(t)}if(y&&("object"==typeof y&&"number"==typeof y.minWidth?y.minWidth:480)>=v)for(const t of $)I(t)&&"secondary"===t.emphasis&&P.add(t);if(P.size>0)for(const t of $)!0===(null==t?void 0:t.defensive)&&P.delete(t);let L;return L=0===P.size?$:h?$.map(t=>P.has(t)?Object.assign(Object.assign({},t),{_annotationDeferred:!0}):t):$.filter(t=>!P.has(t)),m?function(t,e){let n=!1;const o=t.map(t=>I(t)?"blended"===t.cohesion||"layer"===t.cohesion?t:(n=!0,Object.assign(Object.assign({},t),{cohesion:e})):t);return n?o:t}(L,m):L}export{k as DEFAULT_AREA_PER_ANNOTATION,M as annotationBudget,N as annotationDensity,L as annotationLayout,y as bulletLayout,s as calendarLayout,d as dagreLayout,u as flextreeLayout,h as marimekkoLayout,m as parallelCoordinatesLayout,r as waffleLayout};
1
+ import{interpolateRgb as t}from"d3-interpolate";import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as o from"react";import{scaleLinear as i}from"d3-scale";function r(t){return"function"==typeof t?t:e=>e[t]}function l(t){const e=Object.create(null);return t((t,n)=>{e[t]=n}),e}const s=t=>{var e,n,o,i,r,s;const a=t.config,c=null!==(e=a.rows)&&void 0!==e?e:10,u=null!==(n=a.columns)&&void 0!==n?n:10,d=null!==(o=a.gutter)&&void 0!==o?o:2,h=c*u;if(0>=c||0>=u||0>=h)return{nodes:[]};const{plot:f}=t.dimensions;if(0>=f.width||0>=f.height)return{nodes:[]};const y=(f.width-d*(u-1))/u,m=(f.height-d*(c-1))/c;if(0>=y||0>=m)return{nodes:[]};const p=null!==(i=null==(g=a.categoryAccessor)?null:"function"==typeof g?g:t=>t[g])&&void 0!==i?i:()=>"_default";var g;const v=null!==(r=function(t){return null==t?null:"function"==typeof t?t:e=>Number(e[t])}(a.valueAccessor))&&void 0!==r?r:()=>1,x=new Map,b=[];for(const e of t.data){const t=p(e)+"",n=Number(v(e)),o=Number.isFinite(n)?Math.max(0,n):0;x.has(t)||b.push(t),x.set(t,(null!==(s=x.get(t))&&void 0!==s?s:0)+o)}const w=Array.from(x.values()).reduce((t,e)=>t+e,0);if(0>=w)return{nodes:[]};let M;if(a.categoryOrder&&a.categoryOrder.length>0){const t=new Set,e=[];for(const n of a.categoryOrder)x.has(n)&&!t.has(n)&&(t.add(n),e.push(n));M=[...e,...b.filter(e=>!t.has(e))]}else M=b;if(0===M.length)return{nodes:[]};const k=M.map(t=>{var e;return{cat:t,exact:(null!==(e=x.get(t))&&void 0!==e?e:0)/w*h}}),A=k.map(t=>Object.assign(Object.assign({},t),{count:Math.floor(t.exact)})),$=A.reduce((t,e)=>t+e.count,0),N=A.map((t,e)=>({i:e,rem:t.exact-t.count})).sort((t,e)=>e.rem-t.rem);for(let t=0;h-$>t;t++)A[N[t%N.length].i].count+=1;const C="string"==typeof a.categoryAccessor?a.categoryAccessor:"category",O="string"==typeof a.valueAccessor?a.valueAccessor:"value",j=(t,e,n)=>l(o=>{var i,r;o("category",t),o("value",null!==(i=x.get(t))&&void 0!==i?i:0),"category"!==C&&o(C,t),"value"!==O&&o(O,null!==(r=x.get(t))&&void 0!==r?r:0),o("cells",n),o("_waffleCategory",t),o("_waffleIndex",e)}),S=[];let W=0;for(const e of A){const n=t.resolveColor(e.cat);for(let t=0;e.count>t;t++)S.push({type:"rect",x:f.x+W%u*(y+d),y:f.y+(c-1-Math.floor(W/u))*(m+d),w:y,h:m,style:{fill:n,stroke:"none"},datum:j(e.cat,W,e.count),group:e.cat}),W++}return{nodes:S}},a=864e5,c=e=>{var n,o,i,r,l,s,c,d;const h=e.config,{plot:f}=e.dimensions;if(0>=f.width||0>=f.height)return{nodes:[]};const y=t=>{const e="function"==typeof h.dateAccessor?h.dateAccessor(t):t[h.dateAccessor];return e instanceof Date?e:new Date(e)},m=t=>{const e="function"==typeof h.valueAccessor?h.valueAccessor(t):t[h.valueAccessor];return Number(e)},p=new Map;let g=null;for(const t of e.data){const e=y(t);if(!isFinite(e.getTime()))continue;null==g&&(g=e.getUTCFullYear());const o=u(e),i=m(t);p.set(o,(null!==(n=p.get(o))&&void 0!==n?n:0)+(Number.isFinite(i)?i:0))}const v=null!==(i=null!==(o=h.year)&&void 0!==o?o:g)&&void 0!==i?i:(new Date).getUTCFullYear();let x=1/0,b=-1/0;for(const t of p.values())x>t&&(x=t),t>b&&(b=t);x===1/0&&(x=0,b=0);const[w,M]=null!==(r=h.colorRamp)&&void 0!==r?r:[null!==(l=e.theme.semantic.surface)&&void 0!==l?l:"#ebedf0",null!==(s=e.theme.semantic.primary)&&void 0!==s?s:"#216e39"],k=e=>{if(b===x)return w;const n=(e-x)/(b-x);return t(w,M)(n)},A=null!==(c=h.gutter)&&void 0!==c?c:2,$=null!==(d=h.labelInset)&&void 0!==d?d:0,N=Math.min((f.width-$-53*A)/54,(f.height-6*A)/7);if(0>=N)return{nodes:[]};const C=new Date(Date.UTC(v,0,1)),O=C.getUTCDay(),j=new Date(C.getTime()-O*a),S=[];for(let t=0;54>t;t++)for(let e=0;7>e;e++){const n=new Date(j.getTime()+(7*t+e)*a);if(n.getUTCFullYear()!==v)continue;const o=u(n),i=p.get(o),r=null==i?w:k(i);S.push({type:"rect",x:f.x+$+t*(N+A),y:f.y+e*(N+A),w:N,h:N,style:{fill:r,stroke:"none"},datum:{date:n,value:null!=i?i:0}})}return{nodes:S}};function u(t){return`${t.getUTCFullYear()}-${d(t.getUTCMonth()+1)}-${d(t.getUTCDate())}`}function d(t){return 10>t?"0"+t:t+""}const h=t=>{var e,n,o,i,r,l,s,a,c;const u=t.config,d=null!==(e=u.nodeWidth)&&void 0!==e?e:80,h=null!==(n=u.nodeHeight)&&void 0!==n?n:30,f=null!==(o=u.orientation)&&void 0!==o?o:"vertical",y=null!==(i=u.edgeCurve)&&void 0!==i?i:"curved",m=!1!==u.showLabels,p=null!==(r=u.labelAccessor)&&void 0!==r?r:"id",g="function"==typeof p?p:t=>{var e,n;const o=t.data,i=o?o[p]:void 0;return(null!==(n=null!==(e=null!=i?i:t[p])&&void 0!==e?e:t.id)&&void 0!==n?n:"")+""},v=new Map,x=[],b=[],w=t=>{var e,n,o;const i=null!==(e=t.data)&&void 0!==e?e:{};return{x:"number"==typeof i.x?i.x:t.x,y:"number"==typeof i.y?i.y:t.y,w:null!==(n="number"==typeof i.width?i.width:t.width)&&void 0!==n?n:d,h:null!==(o="number"==typeof i.height?i.height:t.height)&&void 0!==o?o:h}};for(const e of t.nodes){const{x:n,y:o,w:i,h:r}=w(e);null!=n&&null!=o&&(v.set(e.id,{x:n,y:o,w:i,h:r}),x.push({type:"rect",x:n-i/2,y:o-r/2,w:i,h:r,style:{fill:null!==(l=u.nodeFill)&&void 0!==l?l:t.resolveColor(e.id),stroke:`var(--semiotic-surface, ${null!==(s=t.theme.semantic.surface)&&void 0!==s?s:"#fff"})`,strokeWidth:1.5},datum:e,id:e.id,label:g(e)+""}),m&&b.push({x:n,y:o,text:g(e)+"",anchor:"middle",baseline:"middle",fontSize:11}))}const M=[];for(const e of t.edges){const n="string"==typeof e.target?e.target:e.target.id,o=v.get("string"==typeof e.source?e.source:e.source.id),i=v.get(n);if(!o||!i)continue;const r="vertical"===f?{x:o.x,y:o.y+o.h/2}:{x:o.x+o.w/2,y:o.y},l="vertical"===f?{x:i.x,y:i.y-i.h/2}:{x:i.x-i.w/2,y:i.y};if("line"===y)M.push({type:"line",x1:r.x,y1:r.y,x2:l.x,y2:l.y,style:{stroke:`var(--semiotic-border, ${null!==(a=t.theme.semantic.border)&&void 0!==a?a:"#999"})`,strokeWidth:1},datum:e});else{const n=(r.y+l.y)/2,o=(r.x+l.x)/2;M.push({type:"curved",pathD:"vertical"===f?`M${r.x},${r.y} C${r.x},${n} ${l.x},${n} ${l.x},${l.y}`:`M${r.x},${r.y} C${o},${r.y} ${o},${l.y} ${l.x},${l.y}`,style:{stroke:`var(--semiotic-border, ${null!==(c=t.theme.semantic.border)&&void 0!==c?c:"#999"})`,strokeWidth:1,fill:"none"},datum:e})}}return{sceneNodes:x,sceneEdges:M,labels:b}},f=t=>{var e,n,o,i,r,l,s,a,c;const u=t.config,d=null!==(e=u.nodeWidth)&&void 0!==e?e:100,h=null!==(n=u.nodeHeight)&&void 0!==n?n:36,f=null!==(o=u.edgeStyle)&&void 0!==o?o:"polyline",y=!1!==u.showLabels,m=null!==(i=u.labelAccessor)&&void 0!==i?i:"label",p="function"==typeof m?m:t=>{var e,n;const o=t.data,i=o?o[m]:void 0;return(null!==(n=null!==(e=null!=i?i:t[m])&&void 0!==e?e:t.id)&&void 0!==n?n:"")+""},g=new Map,v=[],x=[],b=t=>{var e,n,o;const i=null!==(e=t.data)&&void 0!==e?e:{};return{x:"number"==typeof i.x?i.x:t.x,y:"number"==typeof i.y?i.y:t.y,w:null!==(n="number"==typeof i.width?i.width:t.width)&&void 0!==n?n:d,h:null!==(o="number"==typeof i.height?i.height:t.height)&&void 0!==o?o:h}};for(const e of t.nodes){const{x:n,y:o,w:i,h:s}=b(e);null!=n&&null!=o&&(g.set(e.id,{x:n,y:o,w:i,h:s}),v.push({type:"rect",x:n-i/2,y:o-s/2,w:i,h:s,style:{fill:null!==(r=u.nodeFill)&&void 0!==r?r:t.resolveColor(e.id),stroke:`var(--semiotic-border, ${null!==(l=t.theme.semantic.border)&&void 0!==l?l:"#888"})`,strokeWidth:1.5},datum:e,id:e.id,label:p(e)+""}),y&&x.push({x:n,y:o,text:p(e)+"",anchor:"middle",baseline:"middle",fontSize:11}))}const w=null!==(s=u.edgeStroke)&&void 0!==s?s:`var(--semiotic-border, ${null!==(a=t.theme.semantic.border)&&void 0!==a?a:"#666"})`,M=[];for(const e of t.edges){const t="string"==typeof e.target?e.target:e.target.id,n=g.get("string"==typeof e.source?e.source:e.source.id),o=g.get(t);if(!n||!o)continue;const i=null!==(c=e.data)&&void 0!==c?c:{},r=Array.isArray(i.points)?i.points:e.points;if(r&&r.length>=2)if("smooth"!==f||3>r.length){const t="M"+r.map(t=>`${t.x},${t.y}`).join(" L ");M.push({type:"curved",pathD:t,style:{stroke:w,strokeWidth:1,fill:"none"},datum:e})}else{let t=`M${r[0].x},${r[0].y}`;for(let e=1;r.length-1>e;e++)t+=` Q${r[e].x},${r[e].y} ${(r[e].x+r[e+1].x)/2},${(r[e].y+r[e+1].y)/2}`;const n=r[r.length-1];t+=` T${n.x},${n.y}`,M.push({type:"curved",pathD:t,style:{stroke:w,strokeWidth:1,fill:"none"},datum:e})}else M.push({type:"line",x1:n.x,y1:n.y,x2:o.x,y2:o.y,style:{stroke:w,strokeWidth:1},datum:e})}return{sceneNodes:v,sceneEdges:M,labels:x}},y={"topic-source":"#1f7a8c","topic-sink":"#b4451f","topic-bridge":"#4b5a82",processor:"#34344a",unknown:"#5a5a6a"},m={internal:"var(--semiotic-border, #6b6b7d)","cross-subtopology":"var(--semiotic-info, #6a8caf)","topic-bridge":"var(--semiotic-secondary, #8b78c4)",back:"var(--semiotic-danger, #e0556b)"};function p(t,e,n){const o=t.data,i=o?o[e]:void 0;if(null!=i)return i;const r=t[e];return null==r?n:r}function g(t){return Array.isArray(t)?t.map((t,e)=>{var n,o;return"string"==typeof t?{storeName:t,slotIndex:e}:{storeName:(null!==(n=t.storeName)&&void 0!==n?n:"")+"",slotIndex:null!==(o=t.slotIndex)&&void 0!==o?o:e}}):[]}const v=t=>{var o,i,r,l,s,a,c,u,d,h,f,v,x,b,w,M,k,A,$,N,C,O,j,S,W;const F=t.config||{},I=t.dimensions.plot,T=null!==(o=F.layerAccessor)&&void 0!==o?o:"x",E=null!==(i=F.rowAccessor)&&void 0!==i?i:"y",D=null!==(r=F.partitionAccessor)&&void 0!==r?r:"partition",L=null!==(l=F.semanticAccessor)&&void 0!==l?l:"semantic",P=null!==(s=F.labelAccessor)&&void 0!==s?s:"label",z=null!==(a=F.storesAccessor)&&void 0!==a?a:"stores",B=null!==(c=F.backEdgeAccessor)&&void 0!==c?c:"isBackEdge",U=null!==(u=F.edgeTypeAccessor)&&void 0!==u?u:"edgeType",G=Object.assign(Object.assign({},y),F.partitionColors),H=Object.assign(Object.assign({},m),F.edgeColors),V=null!==(d=F.accentColor)&&void 0!==d?d:"var(--semiotic-focus, #ffcc33)",Y=null!==(h=F.borderColor)&&void 0!==h?h:"var(--semiotic-border, #555)",_=null!==(f=F.dimOpacity)&&void 0!==f?f:.14,R=null!==(v=F.edgeOpacity)&&void 0!==v?v:.5,J=null!==(x=F.edgeWidth)&&void 0!==x?x:1.25,K=null!==(w=null!==(b=F.backEdgeWidth)&&void 0!==b?b:F.edgeWidth)&&void 0!==w?w:1.5,Q=!1!==F.showStoreChips,X=null!==(M=F.storeChipColor)&&void 0!==M?M:"var(--semiotic-info, #6a8caf)";let q=F.layerCount,Z=F.maxLayerSize;if(null==q||null==Z){let e=0;const n=new Map;for(const o of t.nodes){const t=Math.round(Number(p(o,T,0)));e=Math.max(e,t),n.set(t,(null!==(k=n.get(t))&&void 0!==k?k:0)+1)}q=null!=q?q:e+1,Z=null!=Z?Z:Math.max(1,...n.values())}const tt=I.width/Math.max(1,q),et=I.height/Math.max(1,Z);let nt=Math.min(null!==(A=F.nodeWidth)&&void 0!==A?A:172,Math.max(8,tt-(null!==($=F.minGapX)&&void 0!==$?$:26))),ot=Math.min(null!==(N=F.nodeHeight)&&void 0!==N?N:54,Math.max(8,et-(null!==(C=F.minGapY)&&void 0!==C?C:18)));const it=F.lod&&"auto"!==F.lod?F.lod:16>nt?"dot":48>nt?"icon":108>nt?"compact":"full";if("dot"===it){const t=Math.min(nt,ot,11);nt=t,ot=t}const rt=Math.max(1,I.width-nt),lt=Math.max(1,I.height-ot),st=Math.max(1,Z-1),at=t=>I.x+nt/2+(q>1?t/(q-1):.5)*rt,ct=t=>I.y+ot/2+(t+st/2)/st*lt,ut=F.reachableIds?new Set(F.reachableIds):null,dt=null!==(O=F.selectedId)&&void 0!==O?O:null,ht=t.selection,ft=new Map,yt=new Map,mt=[],pt=[];for(const e of t.nodes){const t=e.id,n=Number(p(e,T,0)),o=Number(p(e,E,0)),i=p(e,D,"processor")+"",r=p(e,L,"processor")+"",l=p(e,P,t)+"",s=g(p(e,z,[])),a=null!==(j=e.data)&&void 0!==j?j:e,c=at(n),u=ct(o);ft.set(t,{cx:c,cy:u});const d=ut?ut.has(t):null,h=(null==ht?void 0:ht.isActive)?ht.predicate(a):null,f=null!==d?!d:null!==h&&!h;yt.set(t,f);const y=null!=dt&&t===dt,m=f&&!y?_:1,v=null!==(S=G[i])&&void 0!==S?S:G.unknown;"dot"===it?mt.push({type:"circle",cx:c,cy:u,r:nt/2,style:{fill:v,opacity:m,stroke:y?V:"transparent",strokeWidth:y?2:0},datum:e,id:t,label:l}):(mt.push({type:"rect",x:c-nt/2,y:u-ot/2,w:nt,h:ot,style:{fill:v,opacity:m,stroke:y?V:Y,strokeWidth:y?3:1},datum:e,id:t,label:l}),pt.push({id:t,cx:c,cy:u,partition:i,semantic:r,label:l,stores:s,opacity:m,selected:y,node:a}))}const gt=[];for(const e of t.edges){const t="string"==typeof e.source?e.source:e.source.id,n="string"==typeof e.target?e.target:e.target.id,o=ft.get(t),i=ft.get(n);if(!o||!i)continue;const r=!!p(e,B,!1),l=p(e,U,"internal")+"",s=yt.get(t)||yt.get(n)?Math.min(R,1.4*_):R,a=r?H.back:null!==(W=H[l])&&void 0!==W?W:H.internal;let c;if(r){const t=o.cx,e=o.cy+ot/2,n=i.cx,r=i.cy+ot/2,l=Math.max(48,.28*Math.abs(t-n))+ot;c=`M${t},${e} C${t},${e+l} ${n},${r+l} ${n},${r}`}else{const t=o.cx+nt/2,e=o.cy,n=i.cx-nt/2,r=i.cy,l=(t+n)/2;c=`M${t},${e} C${l},${e} ${l},${r} ${n},${r}`}const u={type:"curved",pathD:c,style:Object.assign({stroke:a,strokeWidth:r?K:J,fill:"none",opacity:s},r?{strokeDasharray:"5 4",strokeLinecap:"round"}:{}),datum:e};gt.push(u)}const vt=0===pt.length?null:e("g",{className:"lineage-dag-glyphs",children:pt.map(t=>function(t,o){var i,r;const{w:l,h:s,lod:a}=o,c="icon"===a?Math.min(l,s):Math.min(s-14,26),u=null!==(r=null!==(i=o.partColors[t.partition])&&void 0!==i?i:o.partColors.unknown)&&void 0!==r?r:"#5a5a6a",d="icon"===a?0:8+c+8,h=null!=o.renderIcon?o.renderIcon({semantic:t.semantic,partition:t.partition,size:c,color:u,node:t.node}):function(t,o,i){var r;const l=o.startsWith("topic")?"T":null!==(r={source:"SR",sink:"SK",filter:"FL",map:"MP",aggregate:"AG",reduce:"RD","join-this":"JN","join-other":"JN",merge:"MG",suppress:"SP",select:"SE",tostream:"TS"}[t])&&void 0!==r?r:"PR";return n("g",{children:[e("rect",{width:i,height:i,rx:4,fill:"rgba(255,255,255,0.08)",stroke:"rgba(255,255,255,0.18)"}),e("text",{x:i/2,y:i/2+.5,textAnchor:"middle",dominantBaseline:"middle",fontSize:.42*i,fontWeight:700,fill:"var(--semiotic-text, #fff)",children:l})]})}(t.semantic,t.partition,c),f="full"===a,y="icon"!==a,m="full"===a&&o.showChips&&t.stores.length>0;return n("g",{transform:`translate(${t.cx-l/2}, ${t.cy-s/2})`,opacity:t.opacity,style:{pointerEvents:"none"},children:[e("g",{transform:`translate(${"icon"===a?(l-c)/2:8}, ${(s-c)/2})`,children:h}),y&&e("foreignObject",{x:d,y:f?s/2-12:s/2-9,width:Math.max(8,l-d-8),height:18,style:{pointerEvents:"none"},children:e("div",{title:t.label,style:{pointerEvents:"none",fontFamily:"var(--semiotic-font-family, inherit)",fontSize:"full"===a?12.5:11.5,fontWeight:600,color:"var(--semiotic-text, #f4f4f8)",lineHeight:"18px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t.label})}),f&&e("text",{x:d,y:s/2-16,dominantBaseline:"middle",fontSize:9.5,fontWeight:500,fill:"var(--semiotic-text-secondary, #b9b9c8)",style:{textTransform:"uppercase",letterSpacing:"0.04em"},children:o.typeLabel?o.typeLabel({semantic:t.semantic,partition:t.partition,node:t.node}):t.partition.startsWith("topic")?"topic":t.semantic}),m&&t.stores.map((t,n)=>e("rect",{x:d+15*n,y:s-10,width:12,height:5,rx:1.5,fill:o.chipColor,children:e("title",{children:t.storeName})},t.storeName+n))]},t.id)}(t,{w:nt,h:ot,lod:it,partColors:G,chipColor:X,showChips:Q,renderIcon:F.renderIcon,typeLabel:F.typeLabel}))});return{sceneNodes:mt,sceneEdges:gt,overlays:vt}},x=t=>{var e,n,i,s,a,c,u;const d=t.config,{plot:h}=t.dimensions;if(0>=h.width||0>=h.height)return{nodes:[]};const f=r(d.categoryAccessor),y=r(d.stackBy),m=t=>{const e="function"==typeof d.valueAccessor?d.valueAccessor(t):t[d.valueAccessor],n=Number(e);return Number.isFinite(n)&&n>0?n:0},p=null!==(e=d.gutter)&&void 0!==e?e:2,g="string"==typeof d.categoryAccessor?d.categoryAccessor:"category",v="string"==typeof d.stackBy?d.stackBy:"stack",x="string"==typeof d.valueAccessor?d.valueAccessor:"value",w=(t,e,n)=>l(o=>{o("category",t),o("stack",e),o("value",n),"category"!==g&&o(g,t),"stack"!==v&&o(v,e),"value"!==x&&o(x,n)}),M=!1!==d.showCategoryLabels,k=null!==(n=d.labelPadding)&&void 0!==n?n:M?22:0,A=Math.max(0,h.height-k),$=[],N=new Map,C=[],O=new Set,j=new Map;for(const e of t.data){const t=f(e)+"",n=y(e)+"",o=m(e);N.has(t)||($.push(t),N.set(t,0),j.set(t,new Map)),O.has(n)||(O.add(n),C.push(n)),N.set(t,(null!==(i=N.get(t))&&void 0!==i?i:0)+o);const r=j.get(t);r.set(n,(null!==(s=r.get(n))&&void 0!==s?s:0)+o)}const S=d.categoryOrder?b(d.categoryOrder,$,t=>N.has(t)):$,W=d.stackOrder?b(d.stackOrder,C,()=>!0):C,F=S.reduce((t,e)=>{var n;return t+(null!==(n=N.get(e))&&void 0!==n?n:0)},0);if(0>=F)return{nodes:[]};const I=Math.max(0,h.width-p*Math.max(0,S.length-1)),T=[],E=[];let D=h.x;for(const e of S){const n=null!==(a=N.get(e))&&void 0!==a?a:0,o=n/F*I;if(0>=o)continue;E.push({cat:e,x:D,w:o});const i=j.get(e);let r=h.y;for(const l of W){const s=null!==(c=i.get(l))&&void 0!==c?c:0;if(0>=s)continue;const a=s/n*A;T.push({type:"rect",x:D,y:r,w:o,h:a,style:{fill:t.resolveColor(l),stroke:"none"},datum:w(e,l,s),group:l}),r+=a}D+=o+p}return{nodes:T,overlays:M&&E.length>0?function(t,e,n){const i=t.map((t,i)=>6.5*t.cat.length>t.w-4?null:o.createElement("text",{key:"marimekko-label-"+i,x:t.x+t.w/2,y:e+12,textAnchor:"middle",fontSize:12,fill:n},t.cat));return o.createElement(o.Fragment,null,...i)}(E,h.y+A+4,`var(--semiotic-text, ${null!==(u=t.theme.semantic.text)&&void 0!==u?u:"currentColor"})`):null}};function b(t,e,n){const o=new Set,i=[];for(const e of t)n(e)&&!o.has(e)&&(o.add(e),i.push(e));for(const t of e)o.has(t)||i.push(t);return i}const w=t=>{var e,n,i,s,a,c,u,d,h,f,y,m;const p=t.config,{plot:g}=t.dimensions;if(0>=g.width||0>=g.height||0===t.data.length)return{nodes:[]};const v=null!==(e=p.rowHeight)&&void 0!==e?e:28,x=null!==(n=p.rowGap)&&void 0!==n?n:12,b=!1!==p.showLabels,w=b?null!==(i=p.labelWidth)&&void 0!==i?i:120:0,M=!1!==p.showTicks,k=M?14:0,A=null!==(s=p.tickFormat)&&void 0!==s?s:t=>t.toLocaleString(),$=g.x+w,N=Math.max(0,g.width-w);if(0>=N)return{nodes:[]};const C=r(p.categoryAccessor),O=t=>{const e=Number(t);return Number.isFinite(e)&&e>0?e:0},j=t=>O("function"==typeof p.valueAccessor?p.valueAccessor(t):t[p.valueAccessor]),S=t=>O("function"==typeof p.targetAccessor?p.targetAccessor(t):t[p.targetAccessor]),W=t=>{const e="function"==typeof p.rangesAccessor?p.rangesAccessor(t):t[p.rangesAccessor];return Array.isArray(e)?e.map(O).sort((t,e)=>t-e):[]},F="string"==typeof p.categoryAccessor?p.categoryAccessor:"metric",I="string"==typeof p.valueAccessor?p.valueAccessor:"value",T="string"==typeof p.targetAccessor?p.targetAccessor:"target",E=null!==(c=null!==(a=p.actualColor)&&void 0!==a?a:t.theme.semantic.primary)&&void 0!==c?c:"#3b6cb1",D=null!==(u=t.theme.semantic.text)&&void 0!==u?u:"currentColor",L=null!==(d=t.theme.semantic.textSecondary)&&void 0!==d?d:"#888",P=null!==(h=t.theme.semantic.surface)&&void 0!==h?h:"#e8eaed",z=null!==(f=t.theme.semantic.grid)&&void 0!==f?f:"#cdd1d6",B=null!==(y=t.theme.semantic.border)&&void 0!==y?y:"#a3a8af",U=null!==(m=p.targetColor)&&void 0!==m?m:`var(--semiotic-text, ${D})`,G=[`var(--semiotic-surface, ${P})`,`var(--semiotic-grid, ${z})`,`var(--semiotic-border, ${B})`],H=`var(--semiotic-text, ${D})`,V=`var(--semiotic-text-secondary, ${L})`,Y=[],_=[];for(let e=0;t.data.length>e;e++){const n=t.data[e],o=W(n),i=j(n),r=S(n),s=Math.max(i,r,...o.length?o:[0]);if(0>=s)continue;const a=g.y+e*(v+x+k);if(a+v+k>g.y+g.height)break;_.push({yTop:a,label:C(n),actual:i,target:r,maxVal:s});const c=t=>$+t/s*N,u=C(n),d=t=>l(e=>{e("metric",u),"metric"!==F&&e(F,u),t(e)});let h=$;for(let t=0;o.length>t;t++){const e=c(o[t]),n=e-h;n>0&&Y.push({type:"rect",x:h,y:a,w:n,h:v,style:{fill:G[Math.min(t,G.length-1)],stroke:"none"},datum:d(e=>{e("range",t),e("rangeValue",o[t]),e("kind","range")}),group:"range-"+t}),h=e}const f=Math.max(6,Math.floor(.45*v));Y.push({type:"rect",x:$,y:a+(v-f)/2,w:c(i)-$,h:f,style:{fill:E,stroke:"none"},datum:d(t=>{t("value",i),t("kind","actual"),"value"!==I&&t(I,i)}),group:"actual"});const y=3,m=Math.floor(.8*v);Y.push({type:"rect",x:c(r)-y/2,y:a+(v-m)/2,w:y,h:m,style:{fill:U,stroke:"none"},datum:d(t=>{t("target",r),t("kind","target"),"target"!==T&&t(T,r)}),group:"target"})}const R=[];for(let t=0;_.length>t;t++){const e=_[t];if(b&&R.push(o.createElement("text",{key:"bullet-label-"+t,x:g.x+w-8,y:e.yTop+v/2,textAnchor:"end",dominantBaseline:"middle",fontSize:13,fontWeight:500,fill:H},e.label)),M){const n=5,i=e.yTop+v+2;for(let r=0;n>r;r++){const l=e.maxVal*r/(n-1),s=$+l/e.maxVal*N;R.push(o.createElement("line",{key:`bullet-tick-${t}-${r}`,x1:s,x2:s,y1:i,y2:i+3,stroke:V,strokeWidth:1}),o.createElement("text",{key:`bullet-ticktext-${t}-${r}`,x:s,y:i+12,textAnchor:0===r?"start":r===n-1?"end":"middle",fontSize:10,fill:V},A(l)))}}}return{nodes:Y,overlays:R.length>0?o.createElement(o.Fragment,null,...R):null}},M=t=>{var e,n,r,l,s,a,c,u,d,h,f,y;const m=t.config,{plot:p}=t.dimensions,g=null!==(e=m.fields)&&void 0!==e?e:[];if(2>g.length||0>=p.width||0>=p.height)return{nodes:[]};if(0===t.data.length)return{nodes:[]};const v={};for(const e of g){if(null===(n=m.domains)||void 0===n?void 0:n[e]){v[e]=m.domains[e];continue}let o=1/0,i=-1/0;for(const n of t.data){const t=Number(n[e]);Number.isFinite(t)&&(o>t&&(o=t),t>i&&(i=t))}v[e]=Number.isFinite(o)&&Number.isFinite(i)&&o!==i?[o,i]:[0,1]}const x=!1!==m.showAxes,b=x?null!==(r=m.axisLabelPadding)&&void 0!==r?r:24:8,w=x?18:8,M=g.map(t=>i().domain(v[t]).range([p.y+p.height-w,p.y+b])),k=g.map((t,e)=>1===g.length?p.x+p.width/2:p.x+e/(g.length-1)*p.width),A=m.colorBy?"function"==typeof m.colorBy?m.colorBy:t=>{var e;return(null!==(e=t[m.colorBy])&&void 0!==e?e:"")+""}:null,$=null!==(l=m.opacity)&&void 0!==l?l:.45,N=null!==(s=m.strokeWidth)&&void 0!==s?s:1.25,C=null!==(a=t.theme.semantic.primary)&&void 0!==a?a:"#3b6cb1",O=null!==(c=m.dimmedOpacity)&&void 0!==c?c:.08,j=m.highlightFn,S=[],W=[];for(const e of t.data){const n=A?t.resolveColor(A(e)+""):C,o=!j||j(e),i=j?o?Math.min(1,$+.4):O:$,r=o?W:S;for(let t=0;g.length-1>t;t++){const l=Number(e[g[t]]),s=Number(e[g[t+1]]);if(!Number.isFinite(l)||!Number.isFinite(s))continue;const a={type:"connector",x1:k[t],y1:M[t](l),x2:k[t+1],y2:M[t+1](s),style:{stroke:n,strokeWidth:j&&o?N+.75:N,opacity:i,fill:"none"},datum:e};r.push(a)}if(m.showPoints)for(let t=0;g.length>t;t++){const o=Number(e[g[t]]);if(!Number.isFinite(o))continue;const l={type:"point",x:k[t],y:M[t](o),r:2.5,style:{fill:n,stroke:"none",opacity:Math.min(1,i+.3)},datum:e};r.push(l)}}let F=null;if(x){const e=`var(--semiotic-border, ${null!==(u=t.theme.semantic.border)&&void 0!==u?u:"#aaa"})`,n=`var(--semiotic-text, ${null!==(d=t.theme.semantic.text)&&void 0!==d?d:"currentColor"})`,i=`var(--semiotic-text-secondary, ${null!==(h=t.theme.semantic.textSecondary)&&void 0!==h?h:"#888"})`,r=p.y+b,l=p.y+p.height-w,s=[];for(let t=0;g.length>t;t++){const a=g[t],c=k[t],u=null!==(y=null===(f=m.tickFormat)||void 0===f?void 0:f[a])&&void 0!==y?y:t=>t.toLocaleString();s.push(o.createElement("line",{key:"pc-axis-line-"+t,x1:c,x2:c,y1:r,y2:l,stroke:e,strokeWidth:1})),s.push(o.createElement("text",{key:"pc-axis-label-"+t,x:c,y:p.y+b-8,textAnchor:"middle",fontSize:12,fontWeight:600,fill:n},a));const[d,h]=v[a],x=5;for(let n=0;x>n;n++){const r=d+(h-d)*n/(x-1),l=M[t](r);s.push(o.createElement("line",{key:`pc-tick-${t}-${n}`,x1:c-3,x2:c+3,y1:l,y2:l,stroke:e,strokeWidth:1}),o.createElement("text",{key:`pc-ticktext-${t}-${n}`,x:c+6,y:l+3,fontSize:10,fill:i},u(r)))}}F=o.createElement(o.Fragment,null,...s)}return{nodes:S.concat(W),overlays:F}};function k(t,e){var n,o,i;const r=null!==(o=null===(n=e.scales)||void 0===n?void 0:n.x)&&void 0!==o?o:null===(i=e.scales)||void 0===i?void 0:i.time;return r?null!=t.x?r(t.x):e.xAccessor&&null!=t[e.xAccessor]?r(t[e.xAccessor]):null:null}function A(t,e){var n,o,i;const r=null!==(o=null===(n=e.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(i=e.scales)||void 0===i?void 0:i.value;return r?null!=t.y?r(t.y):e.yAccessor&&null!=t[e.yAccessor]?r(t[e.yAccessor]):null:null}function $(t){return null==t?null:t+""}function N(t,e,n){var o;return null===(o=e.stickyPositionCache)||void 0===o||o.set(t,n),n}const C=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function O(t){return!!t&&"object"==typeof t&&C.has(function(t){return"string"==typeof(null==t?void 0:t.type)?t.type:""}(t))}new Set(["label","callout","callout-circle","callout-rect"]);const j=2e4;function S(t){return"primary"===(null==t?void 0:t.emphasis)||!0===(null==t?void 0:t.defensive)}function W(t,e,n={}){return"number"==typeof n.maxAnnotations&&Number.isFinite(n.maxAnnotations)?Math.max(0,Math.floor(n.maxAnnotations)):t>0&&e>0?Math.max(1,Math.round(t*e/(n.areaPerAnnotation&&n.areaPerAnnotation>0?n.areaPerAnnotation:2e4))):1/0}function F(t){var e,n;let o;const i=null==t?void 0:t.emphasis;o="primary"===i?100:"secondary"===i?10:50;const r=null===(e=null==t?void 0:t.provenance)||void 0===e?void 0:e.confidence;switch("number"==typeof r&&Number.isFinite(r)&&(o+=15*Math.max(0,Math.min(1,r))),null===(n=null==t?void 0:t.lifecycle)||void 0===n?void 0:n.freshness){case"fresh":o+=8;break;case"aging":o+=4;break;case"stale":o+=1;break;case"expired":o-=200}return o}function I(t){var e;const{annotations:n,width:o,height:i}=t,r=Math.max(0,null!==(e=t.minVisible)&&void 0!==e?e:1),l=W(o,i,t),s=n.map((t,e)=>{return{annotation:t,index:e,note:(n=t,O(n))};var n}),a=s.filter(t=>t.note);if(0===a.length||l>=a.length)return{visible:n.slice(),deferred:[],budget:l};const c=a.filter(t=>S(t.annotation)),u=a.filter(t=>!S(t.annotation)).sort((t,e)=>F(e.annotation)-F(t.annotation)||t.index-e.index),d=Math.min(u.length,Math.max(Math.max(0,l-c.length),Math.max(0,r-c.length))),h=new Set([...c.map(t=>t.index),...u.slice(0,d).map(t=>t.index)]),f=[],y=[];for(const{annotation:t,index:e,note:n}of s)!n||h.has(e)?f.push(t):y.push(t);return{visible:f,deferred:y,budget:l}}const T=32,E=6,D=4,L=8,P=72;const z={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function B(t){return O(t)}function U(t,e){if(!t)return[];const n=Math.max(1,Math.floor(e/7)),o=t.split(/\s+/).filter(Boolean),i=[];let r="";for(const t of o)r&&r.length+t.length+1>n?(i.push(r),r=t):r=r?`${r} ${t}`:t;return r&&i.push(r),i}function G(t,e,n,o,i){const r=t+n,l=e+o;return Math.abs(n)>Math.abs(o)?{x:0>n?r-i.width-4:r+4,y:0>o?l-i.height:l,width:i.width,height:i.height}:{x:0>n?r-i.width:r,y:0>o?l-i.height-4:l+4,width:i.width,height:i.height}}function H(t,e){return{x:t.x-e,y:t.y-e,width:t.width+2*e,height:t.height+2*e}}function V(t,e){return Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x))*Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y))}function Y(t,e,n,o,i,r,l,s){const a=H(t,l);let c=.4*Math.hypot(e.dx,e.dy)+80*function(t,e,n,o){const i=Math.max(0,o-t.x),r=Math.max(0,o-t.y);return(i+Math.max(0,t.x+t.width-(e-o)))*t.height+(r+Math.max(0,t.y+t.height-(n-o)))*t.width}(a,i,r,s);for(const t of n)c+=12*V(a,t);for(const t of o)c+=4*V(a,t);return c}function _(t,e,n){var o,i;if("widget"===t.type&&"number"==typeof t.px&&"number"==typeof t.py)return{x:t.px,y:t.py};const r=null!==(o=t.pointId)&&void 0!==o?o:t.nodeId;if(null!=r&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===r);if(t)return{x:t.x,y:t.y}}const l=t.coordinates,s=null===(i=n.scales)||void 0===i?void 0:i.geoProjection;if(Array.isArray(l)&&l.length>=2&&s){const t=l[0],e=l[1];if("number"==typeof t&&"number"==typeof e){const n=s([t,e]);if(n&&"number"==typeof n[0]&&"number"==typeof n[1])return{x:n[0],y:n[1]}}}return n.scales||"number"!=typeof t.x||"number"!=typeof t.y?function(t,e,n){var o,i;const r=t.anchor||(null===(o=t.lifecycle)||void 0===o?void 0:o.anchor)||"fixed";if("latest"===r){if(null!=t.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let o=n.pointNodes.length-1;o>=0;o--){const i=n.pointNodes[o];if(i.pointId===t.pointId)return N(e,n,{x:i.x,y:i.y})}const o=function(t){var e,n,o,i,r,l;const s=t.data;if(!s||0===s.length)return null;const a=s[s.length-1],c=null!==(n=null===(e=t.scales)||void 0===e?void 0:e.x)&&void 0!==n?n:null===(o=t.scales)||void 0===o?void 0:o.time,u=null!==(r=null===(i=t.scales)||void 0===i?void 0:i.y)&&void 0!==r?r:null===(l=t.scales)||void 0===l?void 0:l.value;if(!c||!u)return null;const d=a[t.xAccessor||"x"],h=a[t.yAccessor||"y"];return null==d||null==h?null:{x:c(d),y:u(h)}}(n);return o?N(e,n,o):null}if("semantic"===r){const o=function(t,e,n){var o,i;const r=function(t){var e,n;return $(null!==(n=null===(e=t.provenance)||void 0===e?void 0:e.stableId)&&void 0!==n?n:t.stableId)}(t);if(!r)return null;const l=null===(o=n.pointNodes)||void 0===o?void 0:o.find(t=>$(t.pointId)===r);if(l)return N(e,n,{x:l.x,y:l.y});const s=null===(i=n.data)||void 0===i?void 0:i.find(t=>function(t){var e,n,o;return $(null!==(n=null!==(e=t.stableId)&&void 0!==e?e:t.id)&&void 0!==n?n:null===(o=t.provenance)||void 0===o?void 0:o.stableId)}(t)===r);if(!s)return null;const a=k(s,n),c=A(s,n);return null==a||null==c?null:N(e,n,{x:a,y:c})}(t,e,n);if(o)return o}let l=null,s=null;if(null!=t.pointId&&n.pointNodes){const e=n.pointNodes.find(e=>e.pointId===t.pointId);e&&(l=e.x,s=e.y)}if(null!=l&&null!=s||(l=k(t,n),s=A(t,n)),null!=l&&null!=s)return N(e,n,{x:l,y:s});if("sticky"===r){const t=null===(i=n.stickyPositionCache)||void 0===i?void 0:i.get(e);if(t)return t}return null}(t,e,n):{x:t.x,y:t.y}}function R(t){var e;const{annotations:n,context:o,defaultOffset:i=T,notePadding:r=E,markPadding:l=D,edgePadding:s=L,preserveManualOffsets:a=!0,routeLongConnectors:c=!0,connectorThreshold:u=P,density:d,progressiveDisclosure:h=!1,redundantCues:f=!1,responsive:y,cohesion:m,audience:p}=t,g=o.width||0,v=o.height||0;if(0===n.length||0>=g||0>=v)return n.slice();const x=[],b=function(t,e){return(t.pointNodes||[]).map(t=>{const n=Math.max(1,t.r||1)+e;return{x:t.x-n,y:t.y-n,width:2*n,height:2*n}})}(o,l);let w=!1;const M=n.map((t,e)=>{if(!B(t))return t;const n=_(t,e,o);if(!n)return t;const l=function(t){if("widget"===t.type)return{width:"number"==typeof t.width?t.width:32,height:"number"==typeof t.height?t.height:32};const e="number"==typeof t.wrap?t.wrap:120,n=[...U("string"==typeof t.title?t.title:void 0,e),...U("string"==typeof t.label?t.label:void 0,e)],o=n.reduce((t,e)=>Math.max(t,e.length),0);return{width:Math.max(24,Math.min(e,7*o)+10),height:Math.max(18,16*n.length+6)}}(t);if(a&&("number"==typeof(d=t).dx||"number"==typeof d.dy)){const e=function(t){return"text"===t.type||"widget"===t.type?{dx:0,dy:0}:{dx:30,dy:-30}}(t);return x.push(H(G(n.x,n.y,"number"==typeof t.dx?t.dx:e.dx,"number"==typeof t.dy?t.dy:e.dy,l),r)),t}var d;let h=null,f=1/0;for(const t of function(t){const e=1.6*t;return[{dx:t,dy:-t},{dx:-t,dy:-t},{dx:t,dy:t},{dx:-t,dy:t},{dx:t,dy:0},{dx:-t,dy:0},{dx:0,dy:-t},{dx:0,dy:t},{dx:e,dy:-e},{dx:-e,dy:-e},{dx:e,dy:e},{dx:-e,dy:e}]}(i)){const e=Y(G(n.x,n.y,t.dx,t.dy,l),t,x,b,g,v,r,s);f>e&&(h=t,f=e)}if(!h)return t;const y=H(G(n.x,n.y,h.dx,h.dy,l),r);x.push(y);const m=Math.hypot(h.dx,h.dy),p=c&&m>=u&&"text"!==t.type&&"widget"!==t.type?Object.assign(Object.assign({},t.connector||{end:"arrow"}),{type:"curve"}):t.connector;return w=!0,Object.assign(Object.assign(Object.assign({},t),{dx:h.dx,dy:h.dy}),p?{connector:p}:{})}),k=w?M:n.slice();let A=k;if(f){let t=!1;const e=k.map(e=>{const n=function(t){return"text"!==t.type||"string"!=typeof t.color||8>Math.hypot("number"==typeof t.dx?t.dx:0,"number"==typeof t.dy?t.dy:0)?t:Object.assign(Object.assign({},t),{_redundantConnector:!0})}(e);return n!==e&&(t=!0),n});A=t?e:k}{let t=!1;const e=A.map(e=>{if(!0!==(null==e?void 0:e.defensive))return e;const n=function(t){var e;const n=null==t?void 0:t.provenance;if(!n||"object"!=typeof n)return t;const o="string"==typeof n.source?null!==(e=z[n.source])&&void 0!==e?e:n.source:null,i="number"==typeof n.confidence&&Number.isFinite(n.confidence)?Math.round(100*Math.max(0,Math.min(1,n.confidence)))+"%":null;if(!o&&!i)return t;if(null!=t.label&&"string"!=typeof t.label)return t;const r=[o,i].filter(Boolean).join(" · "),l="string"==typeof t.label?t.label:"";return l.includes(`(${r})`)?t:Object.assign(Object.assign({},t),{label:l?`${l} (${r})`:`(${r})`})}(e);return n!==e&&(t=!0),n});A=t?e:A}const $=new Set;if(d){const t="object"==typeof d?d:{},n=function(t){if(!t)return 1;const e=function(t){const e=null==t?void 0:t.familiarity;if(!e)return 3;const n=Object.values(e).filter(t=>"number"==typeof t&&Number.isFinite(t));return 0===n.length?3:n.reduce((t,e)=>t+e,0)/n.length}(t);return e>2?4>e?1:.6:1.5}(p),o=1===n?t:Object.assign(Object.assign({},t),{maxAnnotations:Math.max(0,Math.round((null!==(e=t.maxAnnotations)&&void 0!==e?e:W(g,v,t))*n))}),{deferred:i}=I(Object.assign({annotations:A,width:g,height:v},o));for(const t of i)$.add(t)}if(y&&("object"==typeof y&&"number"==typeof y.minWidth?y.minWidth:480)>=g)for(const t of A)B(t)&&"secondary"===t.emphasis&&$.add(t);if($.size>0)for(const t of A)!0===(null==t?void 0:t.defensive)&&$.delete(t);let N;return N=0===$.size?A:h?A.map(t=>$.has(t)?Object.assign(Object.assign({},t),{_annotationDeferred:!0}):t):A.filter(t=>!$.has(t)),m?function(t,e){let n=!1;const o=t.map(t=>B(t)?"blended"===t.cohesion||"layer"===t.cohesion?t:(n=!0,Object.assign(Object.assign({},t),{cohesion:e})):t);return n?o:t}(N,m):N}export{j as DEFAULT_AREA_PER_ANNOTATION,W as annotationBudget,I as annotationDensity,R as annotationLayout,w as bulletLayout,c as calendarLayout,f as dagreLayout,h as flextreeLayout,v as lineageDagLayout,x as marimekkoLayout,M as parallelCoordinatesLayout,s as waffleLayout};
@@ -32,8 +32,8 @@ export type { StreamOrdinalFrameProps, StreamOrdinalFrameHandle, OrdinalChartTyp
32
32
  export type { StreamNetworkFrameProps, StreamNetworkFrameHandle, NetworkChartType, NetworkSceneNode, NetworkSceneEdge, NetworkLabel, ThresholdAlertConfig } from "./components/stream/networkTypes";
33
33
  export type { SelectionConfig, LinkedHoverProp, LinkedBrushProp } from "./components/charts/shared/types";
34
34
  export type { LinkedChartsProps } from "./components/LinkedCharts";
35
- export { useSelection, useLinkedHover, useBrushSelection, useFilteredData } from "./components/LinkedCharts";
36
- export type { UseSelectionOptions, UseSelectionResult, UseLinkedHoverOptions, UseLinkedHoverResult, UseBrushSelectionOptions, UseBrushSelectionResult } from "./components/LinkedCharts";
35
+ export { useSelection, useSelectionActions, useLinkedHover, useBrushSelection, useFilteredData } from "./components/LinkedCharts";
36
+ export type { UseSelectionOptions, UseSelectionResult, UseSelectionActionsResult, UseLinkedHoverOptions, UseLinkedHoverResult, UseBrushSelectionOptions, UseBrushSelectionResult } from "./components/LinkedCharts";
37
37
  export { useChartObserver } from "./components/LinkedCharts";
38
38
  export type { UseChartObserverOptions, UseChartObserverResult } from "./components/LinkedCharts";
39
39
  export type { ChartObservation, OnObservationCallback } from "./components/store/ObservationStore";