@skdx/web-components-charts 0.38.0 → 0.39.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/area.cjs +31 -31
- package/dist/area.js +11 -11
- package/dist/bar.cjs +31 -31
- package/dist/bar.js +11 -11
- package/dist/boxplot.cjs +8 -8
- package/dist/boxplot.js +9 -9
- package/dist/bubble.cjs +9 -9
- package/dist/bubble.js +10 -10
- package/dist/bullet.cjs +12 -12
- package/dist/bullet.js +13 -13
- package/dist/bump.cjs +7 -7
- package/dist/bump.js +8 -8
- package/dist/candlestick.cjs +34 -34
- package/dist/candlestick.js +34 -34
- package/dist/chord.cjs +35 -35
- package/dist/chord.js +21 -21
- package/dist/circle-packing.cjs +16 -16
- package/dist/circle-packing.js +30 -30
- package/dist/combo.cjs +31 -31
- package/dist/combo.js +11 -11
- package/dist/dumbbell.cjs +21 -21
- package/dist/dumbbell.js +24 -24
- package/dist/funnel.cjs +7 -7
- package/dist/funnel.js +7 -7
- package/dist/gantt.cjs +7 -7
- package/dist/gantt.js +8 -8
- package/dist/gauge.cjs +6 -6
- package/dist/gauge.js +6 -6
- package/dist/heatmap.cjs +9 -9
- package/dist/heatmap.js +10 -10
- package/dist/histogram.cjs +30 -30
- package/dist/histogram.js +11 -11
- package/dist/icicle.cjs +16 -16
- package/dist/icicle.js +16 -16
- package/dist/index.cjs +33 -33
- package/dist/index.js +17 -17
- package/dist/line.cjs +31 -31
- package/dist/line.js +11 -11
- package/dist/linear-gauge.cjs +12 -12
- package/dist/linear-gauge.js +13 -13
- package/dist/map.cjs +6 -6
- package/dist/map.js +6 -6
- package/dist/marimekko.cjs +17 -17
- package/dist/marimekko.js +20 -20
- package/dist/network.cjs +14 -14
- package/dist/network.js +13 -13
- package/dist/organization.cjs +10 -10
- package/dist/organization.js +14 -14
- package/dist/parallel.cjs +6 -6
- package/dist/parallel.js +6 -6
- package/dist/pareto.cjs +30 -30
- package/dist/pareto.js +12 -12
- package/dist/pie.cjs +6 -6
- package/dist/pie.js +6 -6
- package/dist/polar-area.cjs +7 -7
- package/dist/polar-area.js +7 -7
- package/dist/radar.cjs +7 -7
- package/dist/radar.js +6 -6
- package/dist/radial.cjs +6 -6
- package/dist/radial.js +6 -6
- package/dist/range.cjs +31 -31
- package/dist/range.js +15 -15
- package/dist/sankey.cjs +10 -10
- package/dist/sankey.js +15 -15
- package/dist/scatter.cjs +31 -31
- package/dist/scatter.js +12 -12
- package/dist/sunburst.cjs +28 -28
- package/dist/sunburst.js +8 -8
- package/dist/swarm.cjs +16 -16
- package/dist/swarm.js +17 -17
- package/dist/timeline.cjs +6 -6
- package/dist/timeline.js +6 -6
- package/dist/tree.cjs +10 -10
- package/dist/tree.js +13 -13
- package/dist/treemap.cjs +7 -7
- package/dist/treemap.js +7 -7
- package/dist/waffle.cjs +31 -31
- package/dist/waffle.js +31 -31
- package/dist/waterfall.cjs +14 -14
- package/dist/waterfall.js +18 -18
- package/package.json +3 -3
package/dist/candlestick.cjs
CHANGED
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
"use strict";var ve=Object.defineProperty;var zt=Object.getOwnPropertyDescriptor;var yn=Object.getOwnPropertyNames;var vn=Object.prototype.hasOwnProperty;var wn=(e,n)=>{for(var t in n)ve(e,t,{get:n[t],enumerable:!0})},kn=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of yn(n))!vn.call(e,i)&&i!==t&&ve(e,i,{get:()=>n[i],enumerable:!(r=zt(n,i))||r.enumerable});return e};var Mn=e=>kn(ve({},"__esModule",{value:!0}),e),x=(e,n,t,r)=>{for(var i=r>1?void 0:r?zt(n,t):n,o=e.length-1,a;o>=0;o--)(a=e[o])&&(i=(r?a(n,t,i):a(i))||i);return r&&i&&ve(n,t,i),i};var Zn={};wn(Zn,{SkdxCandlestickChart:()=>F});module.exports=Mn(Zn);var _=require("lit/decorators.js");var Ot=e=>Number(e.toPrecision(12)),$n,At=e=>($n??($n=new Intl.NumberFormat)).format(Ot(e)),Sn=e=>{let n=Math.round(Math.abs(e)),t=e<0?"-":"",r=Math.floor(n/3600),i=Math.floor(n%3600/60),o=a=>String(a).padStart(2,"0");return r>0?`${t}${r}h ${o(i)}m`:i>0?`${t}${i}m ${o(n%60)}s`:`${t}${n}s`};function ne(e){if(e===void 0)return At;if(typeof e=="function")return e;let{style:n,locale:t,digits:r,unit:i="",timeZone:o}=e,a=d=>i?h=>d(h)+i:d,s=d=>r===void 0?d===void 0?{}:{maximumFractionDigits:d}:{minimumFractionDigits:r,maximumFractionDigits:r},l=d=>{let h=new Intl.NumberFormat(t,d);return a(m=>h.format(Ot(m)))},c=d=>{let h=new Intl.DateTimeFormat(t,o?{...d,timeZone:o}:d);return m=>h.format(m)};switch(n){case"integer":return l({maximumFractionDigits:0});case"decimal":return l(s(2));case"percent":return l({style:"percent",...s(0)});case"currency":return l({style:"currency",currency:e.currency??"USD",...s()});case"compact":return l({notation:"compact",...s(1)});case"scientific":return l({notation:"scientific",...s(2)});case"date":return c({dateStyle:"medium"});case"time":return c({timeStyle:"short"});case"datetime":return c({dateStyle:"medium",timeStyle:"short"});case"duration":return a(Sn)}}function Pe(e,n){if(typeof e=="string")return e;let t=e instanceof Date?e.getTime():e;return n?ne(n)(t):e instanceof Date?new Intl.DateTimeFormat().format(e):At(t)}var we=e=>{if(e instanceof Date)return e.getTime();if(typeof e=="number")return e;let n=Number(e);return Number.isFinite(n)&&e.trim()!==""?n:Date.parse(e)};function re([e,n],[t,r]){let i=n-e;return o=>i===0?t:t+(o-e)/i*(r-t)}function ke(e,n,t=5){if(e===n)return[e];let r=(n-e)/Math.max(1,t),i=10**Math.floor(Math.log10(r)),o=r/i,a=(o<1.5?1:o<3.5?2:o<7.5?5:10)*i,s=Math.floor(e/a)*a,l=Math.ceil(n/a)*a,c=[];for(let d=s;d<=l+a/2;d+=a)c.push(Bt(d));return c}function Lt(e,[n,t],r=.2){let i=e===0?0:(t-n)/e,o=i*(1-Math.max(0,Math.min(.9,r)));return{step:i,bandwidth:o,start:a=>n+a*i+(i-o)/2,center:a=>n+(a+.5)*i}}var Bt=e=>Number(e.toPrecision(12)),p=e=>Number(e.toFixed(2)),G=e=>typeof e=="number"&&Number.isFinite(e);function ie(e){let n=1/0,t=-1/0;for(let r of e)G(r)&&(r<n&&(n=r),r>t&&(t=r));return n===1/0?[0,0]:[n,t]}function Ve(e,n="linear"){if(e.length===0)return"";let t=e[0];if(n==="step"||n==="stepBefore"||n==="stepAfter"){let c=`M${t.x} ${t.y}`;for(let d=1;d<e.length;d++){let h=e[d-1],m=e[d];n==="stepAfter"?c+=`H${m.x}V${m.y}`:n==="stepBefore"?c+=`V${m.y}H${m.x}`:c+=`H${p((h.x+m.x)/2)}V${m.y}H${m.x}`}return c}if(n==="linear"||e.length<3)return`M${e.map(c=>`${c.x} ${c.y}`).join("L")}`;let r=e.length,i=e.slice(1).map((c,d)=>c.x-e[d].x),o=e.slice(1).map((c,d)=>c.y-e[d].y),a=i.map((c,d)=>c===0?0:o[d]/c),s=[a[0]];for(let c=1;c<r-1;c++){let d=a[c-1],h=a[c];s.push(d*h<=0?0:(d+h)/2)}s.push(a[r-2]);for(let c=0;c<r-1;c++){let d=a[c];if(d===0){s[c]=0,s[c+1]=0;continue}let h=s[c]/d,m=s[c+1]/d,w=Math.hypot(h,m);w>3&&(s[c]=3*h*d/w,s[c+1]=3*m*d/w)}let l=`M${t.x} ${t.y}`;for(let c=0;c<r-1;c++){let d=e[c],h=e[c+1],m=i[c]/3;l+=`C${p(d.x+m)} ${p(d.y+m*s[c])} ${p(h.x-m)} ${p(h.y-m*s[c+1])} ${h.x} ${h.y}`}return l}var ue=1e3,de=60*ue,he=60*de,pe=24*he,Cn=[ue,5*ue,15*ue,30*ue,de,5*de,15*de,30*de,he,3*he,6*he,12*he,pe,2*pe,7*pe,14*pe];function Rt(e,n,t=6){if(!(n>e))return[e];let r=n-e,i=Cn.find(h=>r/h<=t),o=[];if(i!==void 0){for(let h=Math.ceil(e/i)*i;h<=n;h+=i)o.push(h);return o.length?o:[e,n]}let a=r/(30*pe),s=[1,2,3,6,12,24,60,120].find(h=>a/h<=t)??240,l=new Date(e),c=l.getUTCFullYear(),d=Math.ceil((l.getUTCMonth()+(l.getUTCDate()>1?1:0))/s)*s;for(let h=Date.UTC(c,d,1);h<=n;)o.push(h),d+=s,d>=12&&(c+=Math.floor(d/12),d%=12),h=Date.UTC(c,d,1);return o.length?o:[e,n]}function Pt(e,n){let t=Math.floor(Math.log10(e)),r=Math.ceil(Math.log10(n)),i=r-t<=1?[1,2,5]:[1],o=[];for(let a=t;a<=r;a++)for(let s of i)o.push(Bt(s*10**a));return o.filter(a=>a>=e/1.0001&&a<=n*1.0001)}var In=/-?\d*\.?\d+(?:e[-+]?\d+)?/gi,Tn=/([MLTHVCSQAZmlthvcsqaz])([^MLTHVCSQAZmlthvcsqaz]*)/g,zn={M:2,L:2,T:2,C:6,S:4,Q:4,A:7,H:-1,V:-2};function On(e,n,t){return e.replace(Tn,(r,i,o)=>{let a=zn[i];if(a===void 0)return i+o;let l=(o.match(In)??[]).map((c,d)=>{let h=Number(c);if(a===-1)return String(h+n);if(a===-2)return String(h+t);let m=d%a;return a===7?m===5?String(h+n):m===6?String(h+t):c:String(m%2===0?h+n:h+t)});return i+l.join(" ")})}var Vt=(e,n,t)=>e.map(r=>{switch(r.kind){case"rect":return{...r,x:r.x+n,y:r.y+t};case"circle":return{...r,cx:r.cx+n,cy:r.cy+t};case"line":return{...r,x1:r.x1+n,x2:r.x2+n,y1:r.y1+t,y2:r.y2+t};case"text":return{...r,x:r.x+n,y:r.y+t};case"path":return{...r,d:On(r.d,n,t)}}});var Ne=["primary","success","warning","danger","neutral"].flatMap(e=>[500,700].map(n=>`var(--skdx-color-${e}-${n})`)).sort((e,n)=>Number(e.endsWith("700)"))-Number(n.endsWith("700)"))),$={axis:"var(--skdx-color-border-strong)",grid:"var(--skdx-color-border-subtle)",label:"var(--skdx-color-text-muted)",focus:"var(--skdx-color-focus-ring)",positive:"var(--skdx-color-success-500)",negative:"var(--skdx-color-danger-500)",fontFamily:"var(--skdx-font-family)",fontSize:"var(--skdx-font-size-xs)"},oe=(e="neutral")=>e==="neutral"?$.axis:`var(--skdx-color-${e}-500)`,De=(e="neutral")=>e==="neutral"?$.label:e==="primary"?"var(--skdx-color-text-accent)":`var(--skdx-color-text-${e})`,Nt=(e,n)=>n??Ne[e%Ne.length];var fe={top:16,right:16,bottom:32,left:48};function Dt(e,n,t=fe){return{x:t.left,y:t.top,width:Math.max(0,e-t.left-t.right),height:Math.max(0,n-t.top-t.bottom)}}function me(e){let n=e.legend;if(n)return n===!0?{}:n.enabled===!1?void 0:n}function Fe(e){let n=e.tooltip;return n===void 0||n===!0?{enabled:!0}:n===!1?{enabled:!1}:{...n,enabled:n.enabled??!0}}var Gt=e=>e.crosshair===!0||Fe(e).trigger==="axis",Me=20,An=120,Ft=e=>{let n=me(e);return n&&(n.position==="left"||n.position==="right")?n.width??An:0},He=(e,n=600,t=300)=>({width:(e.width??n)-Ft(e),height:(e.height??t)-(me(e)?.position==="bottom"?Me:0)}),Ht=e=>{let n=me(e);return n&&(n.position===void 0||n.position==="top")?Me:0},ae=6.5,jt=(e,n,t)=>t??(e.palette&&e.palette.length>0?e.palette[n%e.palette.length]:Nt(n)),_t=(e,n)=>e.hiddenSeries?.includes(n)??!1;function Ge(e,n,t=[],r={},i=10,o=8,a=!1){let s=[],l=r.maxItems,c=l!==void 0&&l>=0&&e.length>l?e.slice(0,l):e,d=e.length-c.length,h=r.interactive??!0,m=o,w=i,y=(f,v,b,I)=>{let C=(v?18:4)+f.length*ae;m>o&&(a||m+C>n-8)&&(m=o,w+=Me),v&&s.push({kind:"rect",part:"legend-swatch",x:m,y:w-5,width:10,height:10,fill:v,opacity:I?.3:void 0,item:b}),s.push({kind:"text",part:"legend-label",x:m+(v?14:0),y:w,text:f,baseline:"middle",fill:I?$.grid:$.label,item:b}),m+=C+12};for(let f of c){let v=t.includes(f.name),b=h?{label:f.name,series:f.name,legend:!0}:void 0;y(r.formatter?.(f.name)??f.name,f.color,b,v)}return d>0&&y(`+${d} more`,void 0,void 0,!1),r.align==="end"?Ln(s,n):s}function Ln(e,n){let t=new Map;for(let i of e){let o=i.kind==="rect"?i.y+5:i.y;t.set(o,[...t.get(o)??[],i])}let r=[];for(let i of t.values()){let o=Math.max(...i.map(s=>s.kind==="rect"?s.x+s.width:s.x+s.text.length*ae)),a=n-8-o;for(let s of i)r.push({...s,x:s.x+a})}return r}var Bn=(e,n,t={})=>new Set(Ge(e,n,[],t).flatMap(r=>r.kind==="text"?[r.y]:[])).size;function je(e,n,t,r=[]){let i=me(e),o=i&&e.direction==="rtl"&&i.align===void 0?{...i,align:"end"}:i,a=Fe(e),s=o?.position==="bottom",l=Ft(e),c=e.hiddenSeries??[],d=o?l?Ge(r,1/0,c,o,10,(o.position==="right"?n:0)+8,!0):Ge(r,n,c,o,s?t+10:10):[],h=s?Bn(r,n,o):0;return{width:n+l,height:s?t+Math.max(1,h)*Me:t,legendOffset:o?.position==="left"?l:void 0,tooltip:a.enabled,tooltipFormatter:a.formatter,axisTooltipFormatter:a.axisFormatter,tooltipPortal:a.portal,tooltipPlacement:a.placement,tooltipAnchored:a.followPointer===!1?!0:void 0,description:e.description,decorative:e.decorative,animate:e.animate===!0?300:e.animate||void 0,responsive:!!e.responsive,shapes:d}}function _e(e){let n=e.legendOffset;if(!n)return e;let t=[...Vt(e.shapes.filter(l=>!l.part.startsWith("legend-")),n,0),...e.shapes.filter(l=>l.part.startsWith("legend-"))],r=l=>({...l,x:l.x+n}),i=e.hit?{...e.hit,plot:r(e.hit.plot),xs:e.hit.xs.map(l=>l+n),brush:e.hit.brush?{box:r(e.hit.brush.box),window:r(e.hit.brush.window)}:void 0}:void 0,o=e.edit,a=o?{...o,scale:l=>o.scale(l)+n,invert:l=>o.invert(l-n),bars:o.bars.map(l=>({...l,x0:l.x0+n,x1:l.x1+n}))}:void 0,s=e.map?{...e.map,plot:r(e.map.plot)}:void 0;return{...e,shapes:t,hit:i,edit:a,map:s,legendOffset:void 0}}function $e(e,n,t,r,i,o="auto"){let a=Array.isArray(t)?t:[t],s=Math.max(...a.map(m=>m.length))*ae+12,l=6+a.length*16,c=o==="top"?{x:e-s/2,y:n-l-8}:o==="bottom"?{x:e-s/2,y:n+8}:o==="left"?{x:e-s-8,y:n-l/2}:o==="right"?{x:e+8,y:n-l/2}:{x:e+12,y:n-l-6},d=Math.max(0,Math.min(r-s,c.x)),h=Math.max(0,Math.min(i-l,c.y));return[{kind:"rect",part:"tooltip",x:p(d),y:p(h),width:p(s),height:l,fill:"var(--skdx-color-surface-raised)",stroke:$.axis,rx:3},...a.map((m,w)=>({kind:"text",part:"tooltip-label",x:p(d+6),y:p(h+11+w*16),text:m,baseline:"middle",fill:"var(--skdx-color-text-default)",weight:a.length>1&&w===0?"bold":void 0}))]}function Et(e,n){let[t,r]=ie(e);return n?[Math.min(0,t),Math.max(0,r)]:[t,r]}function Zt([e,n],t,r=!1,i){let o=typeof r=="boolean"?{scale:r?"log":"linear"}:r,a=ne(o.format??i),s=o.min??e,l=o.max??n;o.reversed&&(t=[t[1],t[0]]);let c={id:o.id,position:o.position,options:o};if(o.scale==="sqrt"){let f=N=>Math.sign(N)*Math.sqrt(Math.abs(N)),v=o.nice===!1?[s,l]:ke(s,l,o.ticks),b=o.min??v[0],I=o.max??v[v.length-1],C=re([f(b),f(I)],t),H=N=>C(f(N)),Z=ke(b,I,o.ticks).filter(N=>N>=b-1e-9&&N<=I+1e-9);return{...c,scale:H,domain:[b,I],format:a,ticks:(Z.length>=2?Z:[b,I]).map(N=>({pos:p(H(N)),label:a(N)})),zero:p(H(Math.min(Math.max(0,b),I)))}}if(o.scale==="log"){let f=Math.max(s,Number.EPSILON),v=Math.max(l,f),b=Pt(f,v),I=[Math.log10(f),Math.log10(v)],C=re(I,t),H=Z=>C(Math.log10(Math.max(Z,Number.EPSILON)));return{...c,scale:H,domain:I,format:a,ticks:b.map(Z=>({pos:p(H(Z)),label:a(Z)})),zero:p(t[0])}}let d=ke(s,l,o.ticks),h=[o.min??(o.nice===!1?s:d[0]),o.max??(o.nice===!1?l:d[d.length-1])],m=re(h,t),w=d.filter(f=>f>=h[0]-1e-9&&f<=h[1]+1e-9),y=(w.length>=2?w:[h[0],h[1]]).map(f=>({pos:p(m(f)),label:a(f)}));return{...c,scale:m,domain:h,format:a,ticks:y,zero:p(m(Math.min(Math.max(0,h[0]),h[1])))}}function Wt(e,n){if(e.length<2)return e;let t=e.reduce((i,o)=>Math.max(i,o.label.length),0)*ae+8,r=Math.max(1,Math.ceil(e.length*t/Math.max(1,n)));return r===1?e:e.filter((i,o)=>o%r===0)}function Ut(e,n,t,r){let i=e.error!==void 0?"error":e.loading?"loading":n?"empty":null;if(!i)return null;let{width:o,height:a}=He(e,t,r),s=i==="error"?e.error:i==="loading"?"Loading\u2026":e.emptyMessage??"No data available",l=[];return i==="loading"&&l.push({kind:"rect",part:"skeleton",x:0,y:0,width:o,height:a,fill:"var(--skdx-color-surface-sunken)",rx:4}),l.push({kind:"text",part:`state-${i}`,x:p(o/2),y:p(a/2),text:s,anchor:"middle",baseline:"middle",fill:i==="error"?"var(--skdx-color-text-danger)":$.label}),{...je(e,o,a),shapes:l,tooltip:!1}}function Kt(e,n={}){let{plot:t,xTicks:r,yTicks:i,baseline:o}=e,a=t.x+t.width,s=t.y+t.height,l=[],c=n.grid??!0,d=(y,f)=>f?{kind:"line",part:"grid",x1:y.pos,x2:y.pos,y1:t.y,y2:s,stroke:$.grid}:{kind:"line",part:"grid",x1:t.x,x2:a,y1:y.pos,y2:y.pos,stroke:$.grid},h=n.x?.tickRotation??0,m=(y,f,v,b)=>h?R(y,f,v,{part:b,anchor:h<0?"end":"start",baseline:"middle",rotate:h}):R(y,f,v,{part:b,anchor:"middle"}),w=(y,f,v,b,I)=>{for(let C of y)l.push(f==="x"?{kind:"line",part:"tick",x1:C.pos,x2:C.pos,y1:v,y2:p(v+b*I),stroke:$.axis}:{kind:"line",part:"tick",x1:v,x2:p(v+b*I),y1:C.pos,y2:C.pos,stroke:$.axis})};if(n.categoryGrid)for(let y of r)l.push(d(y,!n.horizontal));if(n.horizontal){let y=n.axes??[{ticks:i,position:"bottom",offset:0,label:n.yLabel,...n.y}];if(c)for(let f of i)l.push(d(f,!0));y[0]?.showLine!==!1&&l.push({kind:"line",part:"axis",x1:o,x2:o,y1:t.y,y2:s,stroke:$.axis});for(let f of y){let v=f.position==="top"||f.position==="right",b=p(v?t.y-f.offset:s+f.offset),I=v||f.offset>0;f.showLine&&I&&l.push({kind:"line",part:"axis",x1:t.x,x2:a,y1:b,y2:b,stroke:$.axis}),f.showTicks&&w(f.ticks,"x",b,v?-1:1,f.tickSize??4);let C=p(v?b-8:b+20);for(let H of f.ticks)l.push(v?R(H.pos,C,H.label,{part:"x-label-top",anchor:"middle"}):m(H.pos,C,H.label,"x-label"));f.label&&l.push(I?R(4,C,f.label,{part:"axis-title",anchor:"start",baseline:v?void 0:"middle"}):R(4,t.y-6,f.label,{part:"axis-title",anchor:"start"}))}n.x?.showLine&&l.push({kind:"line",part:"axis",x1:n.rtl?a:t.x,x2:n.rtl?a:t.x,y1:t.y,y2:s,stroke:$.axis}),n.x?.showTicks&&w(r,"y",n.rtl?a:t.x,n.rtl?1:-1,n.x.tickSize??4);for(let f of r)l.push(n.rtl?R(a+8,f.pos,f.label,{part:"y-label",anchor:"start",baseline:"middle"}):R(t.x-8,f.pos,f.label,{part:"y-label",anchor:"end",baseline:"middle"}))}else{if(c)for(let f of i)l.push(d(f,!1));n.y?.showLine!==!1&&l.push({kind:"line",part:"axis",x1:t.x,x2:a,y1:o,y2:o,stroke:$.axis});let y=n.axes??[{ticks:i,position:"left",offset:0,label:n.yLabel,...n.y},...n.rightTicks?[{ticks:n.rightTicks,position:"right",offset:0,label:n.rightLabel}]:[]];for(let f of y){let v=f.position==="left",b=v?t.x-f.offset:a+f.offset,I=v?"y-label":"y-label-right";f.showLine&&l.push({kind:"line",part:"axis",x1:p(b),x2:p(b),y1:t.y,y2:s,stroke:$.axis}),f.showTicks&&w(f.ticks,"y",p(b),v?-1:1,f.tickSize??4);for(let C of f.ticks)l.push(R(p(v?b-8:b+8),C.pos,C.label,{part:I,anchor:v?"end":"start",baseline:"middle"}));f.label&&l.push(R(p(v?f.offset===0?4:Math.max(4,b-40):f.offset===0?e.width-4:Math.min(e.width-4,b+40)),t.y-6,f.label,{part:"axis-title",anchor:v?"start":"end"}))}n.x?.showTicks&&w(r,"x",s,1,n.x.tickSize??4);for(let f of r)l.push(m(f.pos,s+(h?12:20),f.label,"x-label"))}return n.xLabel&&l.push(R(p(t.x+t.width/2),e.height-4,n.xLabel,{part:"axis-title",anchor:"middle"})),n.horizontal&&n.rightLabel&&l.push(R(e.width-4,t.y-6,n.rightLabel,{part:"axis-title",anchor:"end"})),l}var R=(e,n,t,r={})=>({kind:"text",part:"label",x:e,y:n,text:t,fill:$.label,...r});function Ee(e,n){let t=[],{plot:r}=n,i=r.x+r.width,o=r.y+r.height,a=l=>Math.max(r.x,Math.min(i,l)),s=l=>Math.max(r.y,Math.min(o,l));for(let l of e??[]){let c=l.color??oe(l.variant),d=l.color??De(l.variant),h={part:"reference-label",fill:d},m=n.horizontal===!0;if("y"in l){let w=p(n.y(l.y,l.axis??"left"));if(m){let y=a(w);t.push(...qt(y,r.y,o,c,l.label,h))}else{let y=s(w);t.push(...Yt(r.x,i,y,c,l.label,h))}}else if("x"in l){let w=n.x(l.x);if(w===void 0)continue;m?t.push(...Yt(r.x,i,s(p(w)),c,l.label,h)):t.push(...qt(a(p(w)),r.y,o,c,l.label,h))}else if("y1"in l){let w=p(n.y(l.y1,l.axis??"left")),y=p(n.y(l.y2,l.axis??"left"));m?t.push(...Qt(a(Math.min(w,y)),a(Math.max(w,y)),r,c,l.label,d)):t.push(...Xt(s(Math.min(w,y)),s(Math.max(w,y)),r,c,l.label,d))}else{let w=n.x(l.x1),y=n.x(l.x2);if(w===void 0||y===void 0)continue;let f=p(Math.min(w,y)),v=p(Math.max(w,y));m?t.push(...Xt(s(f),s(v),r,c,l.label,d)):t.push(...Qt(a(f),a(v),r,c,l.label,d))}}return t}function Yt(e,n,t,r,i,o){let a={kind:"line",part:"reference",x1:e,x2:n,y1:t,y2:t,stroke:r,dash:"6 4",strokeWidth:1.5,title:i};return i?[a,R(n-4,t-5,i,{...o,anchor:"end"})]:[a]}function qt(e,n,t,r,i,o){let a={kind:"line",part:"reference",x1:e,x2:e,y1:n,y2:t,stroke:r,dash:"6 4",strokeWidth:1.5,title:i};return i?[a,R(e+4,n+10,i,{...o,anchor:"start"})]:[a]}function Xt(e,n,t,r,i,o){let a={kind:"rect",part:"reference-area",x:t.x,y:e,width:t.width,height:p(Math.max(0,n-e)),fill:r,opacity:.12,title:i};return i?[a,R(t.x+t.width-4,e+12,i,{part:"reference-label",fill:o,anchor:"end"})]:[a]}function Qt(e,n,t,r,i,o){let a={kind:"rect",part:"reference-area",x:e,y:t.y,width:p(Math.max(0,n-e)),height:t.height,fill:r,opacity:.12,title:i};return i?[a,R(e+4,t.y+12,i,{part:"reference-label",fill:o,anchor:"start"})]:[a]}function Jt(e,n){let t=[],{plot:r}=n,i=r.x+r.width,o=r.y+r.height;for(let a of e??[]){let s=a.color??oe(a.variant),l=a.color??De(a.variant),c=(y,f,v)=>{let b=n.x(y);if(b===void 0)return;let I=n.y(f,v??"left");return n.horizontal?{x:p(I),y:p(b)}:{x:p(b),y:p(I)}},d=a.id??a.label,h=y=>({label:y,id:d,name:a.label});if(a.type==="line"||a.type==="band"){let{type:y,id:f,...v}=a;t.push(...Ee([v],n));continue}if(a.type==="rect"){let y=c(a.x1,a.y1,a.axis),f=c(a.x2,a.y2,a.axis);if(!y||!f)continue;let v=Math.max(r.x,Math.min(y.x,f.x)),b=Math.max(r.y,Math.min(y.y,f.y)),I=a.label??"";t.push({kind:"rect",part:"annotation-rect",x:p(v),y:p(b),width:p(Math.max(0,Math.min(i,Math.max(y.x,f.x))-v)),height:p(Math.max(0,Math.min(o,Math.max(y.y,f.y))-b)),fill:s,opacity:.12,stroke:s,title:I||void 0,item:I?h(I):void 0}),a.label&&t.push(R(p(v+4),p(b+12),a.label,{part:"annotation-label",fill:l}));continue}let m=c(a.x,a.y,a.axis);if(!m)continue;if(a.type==="text"){t.push(R(m.x,m.y,a.text,{part:"annotation-text",fill:l,anchor:"middle",baseline:"middle",title:a.label}));continue}let w=a.label??`${String(a.x)}, ${a.y}`;if(t.push({kind:"circle",part:"annotation-point",cx:m.x,cy:m.y,r:5,fill:s,stroke:"var(--skdx-color-surface-default)",title:w,item:h(w)}),a.type==="callout"&&a.label){let[y,f]=a.offset??[16,-16],v=p(Math.max(r.x,Math.min(i,m.x+y))),b=p(Math.max(r.y,Math.min(o,m.y+f)));t.push({kind:"line",part:"annotation-leader",x1:m.x,y1:m.y,x2:v,y2:b,stroke:s},R(v,b,a.label,{part:"annotation-label",fill:l,anchor:y>=0?"start":"end",baseline:"middle"}))}}return t}function en(e,n){let t=Math.max(1,Math.floor(n));return e.map((r,i)=>{if(i<t-1)return null;let o=0;for(let a=i-t+1;a<=i;a++){let s=e[a];if(!G(s))return null;o+=s}return o/t})}function tn(e,n){let t=Math.max(1,Math.floor(n)),r=2/(t+1),i,o=0,a=0;return e.map(s=>G(s)?i===void 0?(o+=s,a++,a<t?null:(i=o/t,i)):(i=r*s+(1-r)*i,i):i??null)}function Se(e){return e==null?[]:(Array.isArray(e)?e:[e]).map(t=>typeof t=="object"?t:{id:t})}var Ze=e=>e.id??e.name??e.series,nn=e=>e.seriesId??e.series;function K(e,n){let t=!1;return n.id!==void 0&&(t=!0,Ze(e)!==n.id&&e.id!==n.id&&e.name!==n.id)||n.series!==void 0&&(t=!0,nn(e)!==n.series&&e.series!==n.series)||n.index!==void 0&&(t=!0,e.index!==n.index)||n.category!==void 0&&(t=!0,e.category!==n.category)?!1:t}function X(e){let n={},t=Ze(e);t!==void 0&&(n.id=t);let r=nn(e);return r!==void 0&&e.series!==void 0&&(n.series=r),e.index!==void 0&&(n.index=e.index),n}var We=(e,n)=>e.id===n.id&&e.series===n.series&&e.index===n.index&&e.category===n.category;function Ue(e,n,t){let r=Se(e),i=X(n),o=r.some(a=>K(n,a));return t==="single"?o?[]:[i]:o?r.filter(a=>!K(n,a)):[...r,i]}var Rn=.2;function Pn(e){let n=$.focus;switch(e.kind){case"rect":return{kind:"rect",part:"selected",x:e.x-1.5,y:e.y-1.5,width:e.width+3,height:e.height+3,fill:"none",stroke:n,rx:e.rx};case"circle":return{kind:"circle",part:"selected",cx:e.cx,cy:e.cy,r:e.r+2.5,fill:"none",stroke:n};case"path":return{kind:"path",part:"selected",d:e.d,fill:"none",stroke:n,strokeWidth:2.5};case"line":return{...e,part:"selected",stroke:n,strokeWidth:(e.strokeWidth??1)+3,title:void 0,item:void 0};case"text":return}}var Vn=(e,n)=>e.kind==="text"?{...e,fill:$.grid}:{...e,opacity:(e.opacity??1)*n};function Ke(e,n){let t=Se(n.selected),r=n.highlighted===void 0||n.highlighted===null?[]:Se(n.highlighted),i=r[0];if(t.length===0&&!i)return e;let o={highlighted:n.highlightScope?.highlighted??"item",faded:n.highlightScope?.faded??"global"},a=[],s=d=>!i||r.some(h=>K(d,h))?!0:o.highlighted==="series"?r.some(h=>h.series!==void 0&&K(d,{series:h.series})):!1,l=d=>{if(!i||o.faded==="none"||s(d))return!1;if(o.faded==="series"){let h=i.series;return h!==void 0&&K(d,{series:h})}return!0},c=e.shapes.map(d=>{let h=d.item;if(!h||h.legend)return d;if(t.some(m=>K(h,m))){let m=Pn(d);m&&a.push(m)}return l(h)?Vn(d,Rn):d});return a.length?{...e,shapes:[...c,...a]}:{...e,shapes:c}}function ce(e,n,t,r,i){let o=e.getBoundingClientRect();return{x:o.width?(n-o.left)*r/o.width:n,y:o.height?(t-o.top)*i/o.height:t}}var Ye=(e,n,t)=>n>=e.x&&n<=e.x+e.width&&t>=e.y&&t<=e.y+e.height;function rn(e,n){let t=0,r=1/0;return e.xs.forEach((i,o)=>{let a=Math.abs(i-n);a<r&&(r=a,t=o)}),t}function xe(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=rn(t,n),i=t.rows[r]??[];return{index:r,rows:e.axisTooltipFormatter?.(i,r)??i}}function qe(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=t.xs[rn(t,n)];return{kind:"line",part:"crosshair",x1:r,x2:r,y1:t.plot.y,y2:t.plot.y+t.plot.height,stroke:$.axis,dash:"3 3"}}function Xe(e,n,t){let r=e.hit;if(!r||!r.crosshair||r.xs.length===0||!Ye(r.plot,n,t))return[];let i=qe(e,n),{rows:o}=xe(e,n),a=e.tooltipAnchored?r.plot.y+8:t;return[i,...$e(i.x1,a,o,e.width,e.height,e.tooltipPlacement)]}function Qe(e,n){let t=e.hit;if(!t||t.xs.length===0)return[];let r=t.rows.findIndex(o=>o[0]===n);if(r<0)return[];let i=t.xs[r];return Xe(e,i,t.plot.y+8)}function Je(e,n,t,r,i){if(!e.tooltip)return{lines:[],shapes:[]};if(e.hit?.crosshair){let{x:l,y:c}=ce(t,r,i,e.width,e.height);if(Ye(e.hit.plot,l,c)){let d=xe(e,l),h=qe(e,l);if(d&&h)return{lines:d.rows,shapes:[h]}}}let o=n?.closest?.("[data-skdx-part]"),a=e.tooltipFormatter?Q(e,n)?.item:void 0,s=a&&e.tooltipFormatter?.(a)||o&&Array.from(o.children).find(l=>l.tagName.toLowerCase()==="title")?.textContent;return s?{lines:Array.isArray(s)?s:[s],shapes:[]}:{lines:[],shapes:[]}}function on(e,n,t,r,i,o,a){let s=e?.closest?.("[data-skdx-part]"),l=a&&a.tooltipFormatter?Q(a,e)?.item:void 0,c=l&&a?.tooltipFormatter?.(l)||s&&Array.from(s.children).find(y=>y.tagName.toLowerCase()==="title")?.textContent;if(!c)return[];let d=a?.tooltipAnchored?Q(a,e):void 0,h=d?a?.shapes[d.index]:void 0,{x:m,y:w}=h?be(h):ce(n,t,r,i,o);return $e(m,w,c,i,o,a?.tooltipPlacement)}function et(e,n,t,r,i){if(!e.tooltip)return[];if(e.hit?.crosshair){let{x:o,y:a}=ce(t,r,i,e.width,e.height),s=Xe(e,o,a);if(s.length>0)return s}return on(n,t,r,i,e.width,e.height,e)}function tt(e,n){let t=Q(e,n);return t&&!t.item.legend?X(t.item):null}var Nn=(e,n)=>{let{x:t,y:r}=be(e),i=e.kind==="circle"?e.cy:e.kind==="rect"?e.y+e.height/2:r;return t>=n.x&&t<=n.x+n.width&&i>=n.y&&i<=n.y+n.height};function nt(e,n){let t=new Set,r=[];for(let i of e.shapes){if(!i.item||i.item.legend||i.part==="anchor"||!Nn(i,n))continue;let o=X(i.item),a=JSON.stringify(o);t.has(a)||(t.add(a),r.push(o))}return r}var rt=e=>({kind:"rect",part:"selection-box",x:p(e.x),y:p(e.y),width:p(e.width),height:p(e.height),fill:$.focus,opacity:.12,stroke:$.focus}),Ie=(e,n,t,r)=>({x:Math.min(e,t),y:Math.min(n,r),width:Math.abs(t-e),height:Math.abs(r-n)});function an(e,n,t){let r=!1;for(let i=0,o=e.length-1;i<e.length;o=i++){let a=e[i],s=e[o];a.y>t!=s.y>t&&n<(s.x-a.x)*(t-a.y)/(s.y-a.y)+a.x&&(r=!r)}return r}function it(e,n){if(n.length<3)return[];let t=new Set,r=[];for(let i of e.shapes){if(!i.item||i.item.legend||i.part==="anchor")continue;let{x:o,y:a}=be(i),s=i.kind==="circle"?i.cy:i.kind==="rect"?i.y+i.height/2:a;if(!an(n,o,s))continue;let l=X(i.item),c=JSON.stringify(l);t.has(c)||(t.add(c),r.push(l))}return r}var ot=e=>({kind:"path",part:"selection-lasso",d:e.length?`M${e.map(n=>`${p(n.x)} ${p(n.y)}`).join("L")}`:"",fill:$.focus,fillOpacity:.12,stroke:$.focus,dash:"4 3"}),Ce=6;function at(e,n,t){let r=e.edit;if(r){for(let i of r.bars)if(!(t<i.y||t>i.y+i.height||n<i.x0-Ce||n>i.x1+Ce))return Math.abs(n-i.x0)<=Ce?{bar:i,mode:"start"}:Math.abs(n-i.x1)<=Ce?{bar:i,mode:"end"}:{bar:i,mode:"move"}}}function st(e,n,t){let r=e.edit;return sn(r,n,r.invert(n.bar.x0+t)-r.invert(n.bar.x0))}function lt(e,n,t){let r=e.edit,i=t.key==="ArrowRight"?1:t.key==="ArrowLeft"?-1:0;if(!r||n===null||!i||!(t.shiftKey||t.altKey))return;let o=r.bars.find(l=>l.index===n);if(!o)return;let a=t.altKey?t.shiftKey?"start":"end":"move",s=r.snap??r.invert(o.x0+10)-r.invert(o.x0);return sn(r,{bar:o,mode:a},i*s)}function sn(e,{bar:n,mode:t},r){let i=s=>e.snap?Math.round(s/e.snap)*e.snap:s,o=n.start,a=n.end;return t==="move"?(o=i(n.start+r),a=o+(n.end-n.start)):t==="start"?o=Math.min(i(n.start+r),n.end):a=Math.max(i(n.end+r),n.start),{id:n.id,name:n.name,start:o,end:a}}function ct(e,n,t){let r=e.edit,i=r.scale(t.start),o=r.scale(t.end);return{kind:"rect",part:"edit-ghost",x:p(Math.min(i,o)),y:p(n.bar.y),width:p(Math.max(1,Math.abs(o-i))),height:p(n.bar.height),fill:$.focus,opacity:.25,stroke:$.focus,rx:2}}var Dn=64,Gn=e=>Math.max(1,Math.min(Dn,e));function ut(e,n,t,r){let i=n>0?.8:1.25,o=Gn(e.view.zoom*i);if(o===e.view.zoom)return e.view;let{plot:a,scale:s}=e,[l,c]=e.view.center,d=(t-(a.x+a.width/2))/s,h=(r-(a.y+a.height/2))/s,m=e.view.zoom/o;return{center:[l+d*(1-m),e.fromY(e.toY(c)-h*(1-m))],zoom:o}}function dt(e,n,t,r){let{scale:i}=e;return{center:[n.center[0]-t/i,e.fromY(e.toY(n.center[1])+r/i)],zoom:n.zoom}}function Q(e,n){let t=n?.closest?.("[data-skdx-i]"),r=Number(t?.getAttribute("data-skdx-i")),i=Number.isInteger(r)?e.shapes[r]?.item:void 0;return i?{index:r,item:i}:void 0}var Te=e=>e.shapes.flatMap((n,t)=>n.item&&!n.item.legend?[t]:[]);function be(e){switch(e.kind){case"rect":return{x:e.x+e.width/2,y:e.y};case"circle":return{x:e.cx,y:e.cy-e.r};case"line":return{x:(e.x1+e.x2)/2,y:Math.min(e.y1,e.y2)};case"text":return{x:e.x,y:e.y};case"path":{let n=/M\s*(-?[\d.]+)[ ,](-?[\d.]+)/.exec(e.d);return n?{x:Number(n[1]),y:Number(n[2])}:{x:0,y:0}}}}function ht(e,n){let t=n===null?void 0:e.shapes[n];if(!t)return[];let r=$.focus,i;switch(t.kind){case"rect":i={kind:"rect",part:"focus",x:t.x-2,y:t.y-2,width:t.width+4,height:t.height+4,fill:"none",stroke:r,rx:2};break;case"circle":i={kind:"circle",part:"focus",cx:t.cx,cy:t.cy,r:t.r+3,fill:"none",stroke:r};break;case"line":i={kind:"line",part:"focus",x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:r,strokeWidth:4};break;case"text":i={kind:"rect",part:"focus",x:t.x-2,y:t.y-8,width:t.text.length*ae+4,height:16,fill:"none",stroke:r,rx:2};break;case"path":i={kind:"path",part:"focus",d:t.d,stroke:r,strokeWidth:2,fill:"none"};break}let{x:o,y:a}=be(t),s=t.item&&e.tooltipFormatter?.(t.item)||(t.item?.label??t.title??"");return[i,...s?$e(p(o),p(a),s,e.width,e.height):[]]}function pt(e,n,t){let r=Te(e);if(r.length===0)return;let i=n===null?-1:r.indexOf(n);switch(t){case"ArrowRight":case"ArrowDown":return r[Math.min(r.length-1,i+1)];case"ArrowLeft":case"ArrowUp":return r[Math.max(0,i<=0?0:i-1)];case"Home":return r[0];case"End":return r[r.length-1];case"Escape":return null;default:return}}var se=2,le=(e,n,t)=>{let r=Math.max(se,Math.min(t,Math.round(n))),i=Math.max(0,Math.min(t-r,Math.round(e)));return{start:i,end:i+r}},ln=(e,n)=>!e||e.start<=0&&e.end>=n;function ft(e,n,t){if(e.count<=se||!e.plot.width)return;let{start:r,end:i}=e.zoom,o=i-r,a=n>0?1.25:.8,s=Math.max(se,Math.min(e.count,Math.round(o*a)));if(s===o)return n>0&&!ln(e.zoom,e.count)?le(r,s,e.count):void 0;let l=Math.max(0,Math.min(1,(t-e.plot.x)/e.plot.width)),c=r+l*o;return le(c-l*s,s,e.count)}function mt(e,n,t,r){let i=n.end-n.start,o=Math.max(se,Math.min(e.count,Math.round(i/Math.max(.05,t)))),a=Math.max(0,Math.min(1,(r-e.plot.x)/Math.max(1,e.plot.width)));return le(n.start+a*i-a*o,o,e.count)}function xt(e,n,t){let r=n.end-n.start,i=e.plot.width/Math.max(1,r);return le(n.start-t/i,r,e.count)}function bt(e,n,t){let r=e.brush;if(!r||!Ye(r.box,n,t))return;let i=r.window;if(Math.abs(n-i.x)<=6)return{grab:"left",zoom:e.zoom};if(Math.abs(n-(i.x+i.width))<=6)return{grab:"right",zoom:e.zoom};if(n>i.x&&n<i.x+i.width)return{grab:"move",zoom:e.zoom};let o=e.zoom.end-e.zoom.start,a=(n-r.box.x)/Math.max(1,r.box.width)*e.count;return{grab:"move",zoom:le(a-o/2,o,e.count)}}function gt(e,n,t,r){let i=e.brush;if(!i)return t;let o=r/Math.max(1,i.box.width)*e.count;if(n==="move")return le(t.start+o,t.end-t.start,e.count);if(n==="left")return{start:Math.max(0,Math.min(t.end-se,Math.round(t.start+o))),end:t.end};let a=Math.min(e.count,Math.max(t.start+se,Math.round(t.end+o)));return{start:t.start,end:a}}function vt(e,n){switch(n.type){case"svg":return Promise.resolve(yt(e,n.label,n.resolve));case"csv":return Promise.resolve(hn(n.rows));case"png":{if(typeof document>"u"||typeof Image>"u")return Promise.reject(new Error("PNG export needs a browser"));let t=yt(e,n.label,n.resolve);return dn(t,e.width,e.height,n.scale,n.background)}}}var Y=e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/"/g,"""),ge=e=>e.filter(([,n])=>n!==void 0&&n!=="").map(([n,t])=>` ${n}="${Y(String(t))}"`).join("");function cn(e){let n=e.title?`<title>${Y(e.title)}</title>`:"",t=["data-skdx-part",e.part];switch(e.kind){case"path":return`<path${ge([t,["d",e.d],["fill",e.fill??"none"],["stroke",e.stroke],["stroke-width",e.strokeWidth],["stroke-linecap",e.strokeLinecap],["stroke-linejoin",e.strokeLinejoin],["stroke-dasharray",e.dash],["opacity",e.opacity],["fill-opacity",e.fillOpacity]])}>${n}</path>`;case"rect":return`<rect${ge([t,["x",e.x],["y",e.y],["width",e.width],["height",e.height],["rx",e.rx],["fill",e.fill],["stroke",e.stroke],["fill-opacity",e.opacity]])}>${n}</rect>`;case"line":return`<line${ge([t,["x1",e.x1],["y1",e.y1],["x2",e.x2],["y2",e.y2],["stroke",e.stroke],["stroke-width",e.strokeWidth],["stroke-dasharray",e.dash],["opacity",e.opacity]])}>${n}</line>`;case"circle":return`<circle${ge([t,["cx",e.cx],["cy",e.cy],["r",e.r],["fill",e.fill],["stroke",e.stroke]])}>${n}</circle>`;case"text":return`<text${ge([t,["x",e.x],["y",e.y],["text-anchor",e.anchor],["dominant-baseline",e.baseline],["fill",e.fill],["font-weight",e.weight],["transform",e.rotate?`rotate(${e.rotate} ${e.x} ${e.y})`:void 0]])}>${Y(e.text)}</text>`}}function un(e){let n=e.defs??[];return n.length===0?"":`<defs>${n.map(t=>`<linearGradient id="${Y(t.id)}" x1="0" y1="0" x2="${t.vertical===!1?1:0}" y2="${t.vertical===!1?0:1}">${t.stops.map(r=>`<stop offset="${r.offset}" stop-color="${Y(r.color)}"${r.opacity===void 0?"":` stop-opacity="${r.opacity}"`}/>`).join("")}</linearGradient>`).join("")}</defs>`}function yt(e,n,t){let r=un(e)+e.shapes.map(cn).join("");return t&&(r=r.replace(/var\((--[\w-]+)\)/g,(i,o)=>t(o).trim()||i)),`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${e.width} ${e.height}" width="${e.width}" height="${e.height}" role="img" aria-label="${Y(n)}" font-family="${Y($.fontFamily)}" font-size="${Y($.fontSize)}"><title>${Y(n)}</title>${r}</svg>`}function dn(e,n,t,r=2,i){return new Promise((o,a)=>{let s=URL.createObjectURL(new Blob([e],{type:"image/svg+xml;charset=utf-8"})),l=new Image;l.onload=()=>{URL.revokeObjectURL(s);let c=document.createElement("canvas");c.width=Math.round(n*r),c.height=Math.round(t*r);let d=c.getContext("2d");if(!d)return a(new Error("canvas 2d context unavailable"));i&&(d.fillStyle=i,d.fillRect(0,0,c.width,c.height)),d.drawImage(l,0,0,c.width,c.height),c.toBlob(h=>h?o(h):a(new Error("toBlob failed")),"image/png")},l.onerror=()=>{URL.revokeObjectURL(s),a(new Error("svg could not be decoded"))},l.src=s})}function hn(e){let n=t=>{let r=t==null?"":String(t);return/[",\n\r]/.test(r)?`"${r.replace(/"/g,'""')}"`:r};return e.map(t=>t.map(n).join(",")).join(`\r
|
|
2
|
-
`)}function wt(e,n){if(!n)return;let t=typeof n=="object"?n.maxRows??500:500,r=e.hit;if(r&&r.rows.length>0){let s=r.rows[0];if(r.rows.length>t)return;let l=["",...s.slice(1).map(d=>d.replace(/:\s[^:]*$/,""))],c=r.rows.map(d=>[d[0],...d.slice(1).map(h=>h.slice(h.lastIndexOf(": ")+2))]);return[l,...c]}let i=e.shapes.flatMap(s=>s.item&&!s.item.legend&&!(s.part==="anchor"&&!s.title)?[s.item]:[]);if(i.length===0||i.length>t)return;let o=["series","name","category","value"].filter(s=>i.some(l=>l[s]!==void 0)),a=(s,l)=>s[l]===void 0?"":String(s[l]);return[o.map(s=>s[0]?.toUpperCase()+s.slice(1)),...i.map(s=>o.map(l=>a(s,l)))]}var kt=new Map;function ze(e){let n=kt.get(e);if(n)return n.group;let t=new Set,r={},i={current:r,subscribe(o){return t.add(o),()=>{t.delete(o),t.size===0&&kt.delete(e)}},publish(o,a){Object.assign(r,o);for(let s of t)s(o,a)}};return kt.set(e,{group:i,listeners:t}),i}var pn='[data-skdx-part]:not([data-skdx-part^="tooltip"]):not([data-skdx-part="focus"]):not([data-skdx-part="crosshair"])',Mt=`@keyframes skdx-in{from{opacity:0}to{opacity:1}}${pn}{animation:skdx-in var(--skdx-chart-duration,0ms) ease-out;transition:${["x","y","width","height","cx","cy","r","opacity","fill-opacity","d"].map(e=>`${e} var(--skdx-chart-duration,0ms) ease-out`).join(",")}}@media (prefers-reduced-motion:reduce){${pn}{animation:none;transition:none}}`;function $t(e){let n=e.animate;return n&&e.shapes.length<=1500?`${n}ms`:void 0}var Fn=.22,Hn=20,fn=32,mn=28,jn=e=>G(e.open)&&G(e.high)&&G(e.low)&&G(e.close);function St(e){let n=[],t=e.data.filter(u=>jn(u)?!0:(n.push({code:"invalid-value",severity:"warning",message:`Candle "${String(u.label)}" has a non-finite open/high/low/close and was dropped.`,itemId:u.id}),!1)),r=Ut(e,t.length===0);if(r)return{...r,issues:n};let i=e.upColor??$.positive,o=e.downColor??$.negative,a=ne(e.format),s=t.length,l=Math.max(0,Math.min(s-2,Math.floor(e.zoom?.start??0))),c=e.zoom?Math.max(l+2,Math.min(s,Math.ceil(e.zoom.end))):s,d={start:l,end:c},h=t.slice(l,c),m=t.some(u=>G(u.volume)),{width:w,height:y}=He(e),f=e.brush?fn+mn:0,v=e.rangeSelector??[],b=Dt(w,y,{...fe,top:fe.top+Ht(e)+(v.length?Hn:0),bottom:fe.bottom+f}),I=e.compare?h[0].close:void 0,C=u=>I!==void 0&&I!==0?u/I-1:u,H=I!==void 0?{style:"percent",digits:1}:void 0,Z=ne({style:"percent",digits:1}),N=m?b.height*Fn:0,P={...b,height:Math.max(0,b.height-N-(m?8:0))},ye=t.map(u=>u.close),te=(e.overlays??[]).map((u,k)=>{let T=u.name??`${u.type.toUpperCase()} ${u.period}`,A=u.type==="ema"?tn(ye,u.period):en(ye,u.period);return{name:T,color:u.color??jt(e,k+2),values:A.slice(l,c),hidden:_t(e,T)}}),D=Zt(Et([...h.flatMap(u=>[C(u.low),C(u.high)]),...te.filter(u=>!u.hidden).flatMap(u=>u.values.map(k=>G(k)?C(k):k))],!1),[P.y+P.height,P.y],{scale:e.scale==="log"?"log":"linear",format:H},e.format),J=h.map(u=>we(u.label)),Ae=e.xAxis?.type==="time"&&J.every(u=>Number.isFinite(u)),E=Lt(h.length,[P.x,P.x+P.width]),Ct;if(Ae){let u=[...J].sort((B,Re)=>B-Re),k=1/0;for(let B=1;B<u.length;B++)k=Math.min(k,u[B]-u[B-1]);let[T,A]=ie(J),L=k===1/0?Math.max(1,Math.abs(A)*.05||1):k/2,V=re([T-L,A+L],[P.x,P.x+P.width]),j=Math.abs(V(T+(k===1/0?L:k))-V(T))*.8;E={step:j,bandwidth:j,start:B=>V(J[B])-j/2,center:B=>V(J[B])};let U=e.xAxis?.format??{style:"date"};Ct=Rt(T-L,A+L).filter(B=>B>=T-L&&B<=A+L).map(B=>({pos:p(V(B)),label:Pe(B,U)}))}let ee=h.map(u=>Pe(u.label,e.xAxis?.format)),xn=[{name:"Up",color:i},{name:"Down",color:o},...te.map(u=>({name:u.name,color:u.color}))],Le=je(e,w,y,xn),bn={...Le,plot:P,xTicks:Wt(Ct??h.map((u,k)=>({pos:p(E.center(k)),label:ee[k]})),P.width),yTicks:D.ticks,baseline:P.y+P.height},W=Kt(bn),Be={plot:P,x:u=>{let k=typeof u=="string"?u:we(u),T=h.findIndex((A,L)=>typeof k=="string"?ee[L]===k||A.label===k:we(A.label)===k);return T<0?void 0:E.center(T)},y:u=>D.scale(C(u))};W.push(...Ee(e.references,Be)),v.forEach((u,k)=>{let T=u.candles>0?{start:Math.max(0,s-u.candles),end:s}:{start:0,end:s},A=T.start===l&&T.end===c;W.push(R(p(P.x+k*40),p(b.y-8),u.label,{part:"range-button",baseline:"middle",fill:A?"var(--skdx-color-text-default)":$.label,weight:A?"bold":void 0,title:`${u.label}: last ${u.candles>0?Math.min(u.candles,s):s} candles`,item:{label:u.label,name:u.label,range:T}}))});let gn=e.variant==="ohlc",It=[];if(h.forEach((u,k)=>{let A=u.close>=u.open?i:o,L=p(E.center(k)),V=I!==void 0?` (${Z(C(u.close))})`:"",j=`${ee[k]}: O ${a(u.open)} H ${a(u.high)} L ${a(u.low)} C ${a(u.close)}${V}${G(u.volume)?` V ${a(u.volume)}`:""}`,U={label:j,id:u.id,category:ee[k],index:l+k,value:u.close};It.push([ee[k],`Open: ${a(u.open)}`,`High: ${a(u.high)}`,`Low: ${a(u.low)}`,`Close: ${a(u.close)}${V}`,...G(u.volume)?[`Volume: ${a(u.volume)}`]:[],...te.filter(q=>!q.hidden).map(q=>`${q.name}: ${G(q.values[k])?a(q.values[k]):"\u2014"}`)]);let B=D.scale(C(Math.max(u.open,u.close))),Re=D.scale(C(Math.min(u.open,u.close)));if(gn){let q=E.bandwidth/2;W.push({kind:"line",part:"wick",x1:L,x2:L,y1:p(D.scale(C(u.high))),y2:p(D.scale(C(u.low))),stroke:A,strokeWidth:1.5,title:j,item:U},{kind:"line",part:"open",x1:p(L-q),x2:L,y1:p(D.scale(C(u.open))),y2:p(D.scale(C(u.open))),stroke:A,strokeWidth:1.5},{kind:"line",part:"close",x1:L,x2:p(L+q),y1:p(D.scale(C(u.close))),y2:p(D.scale(C(u.close))),stroke:A,strokeWidth:1.5})}else W.push({kind:"line",part:"wick",x1:L,x2:L,y1:p(D.scale(C(u.high))),y2:p(D.scale(C(u.low))),stroke:A,title:j},{kind:"rect",part:"candle",x:p(E.start(k)),y:p(B),width:p(E.bandwidth),height:p(Math.max(1,Re-B)),fill:A,title:j,item:U})}),m){let u=P.y+P.height+8,[,k]=ie(h.map(T=>T.volume));h.forEach((T,A)=>{if(!G(T.volume))return;let L=k>0?T.volume/k*N:0;W.push({kind:"rect",part:"volume",x:p(E.start(A)),y:p(u+N-L),width:p(E.bandwidth),height:p(Math.max(L,0)),fill:T.close>=T.open?i:o,opacity:.4,title:`${ee[A]}: volume ${a(T.volume)}`})})}for(let u of te){if(u.hidden)continue;let k=u.values.flatMap((T,A)=>G(T)?[{x:p(E.center(A)),y:p(D.scale(C(T)))}]:[]);k.length<2||W.push({kind:"path",part:"overlay",d:Ve(k),stroke:u.color,strokeWidth:1.5,strokeLinejoin:"round",title:u.name,item:{label:u.name,series:u.name}})}for(let u of e.flags??[]){let k=Be.x(u.label);if(k===void 0)continue;let T=h.findIndex((j,U)=>E.center(U)===k),A=h[T],L=D.scale(C(A.high))-6,V=oe(u.variant??"primary");W.push({kind:"path",part:"flag",d:`M${p(k)} ${p(L)}V${p(L-10)}H${p(k+8)}L${p(k+5)} ${p(L-7)}L${p(k+8)} ${p(L-4)}H${p(k)}Z`,fill:V,stroke:V,title:u.text,item:{label:u.text,name:u.text,category:ee[T],index:l+T}})}W.push(...Jt(e.annotations,Be));let Tt={plot:b,xs:h.map((u,k)=>p(E.center(k))),rows:It,count:s,zoom:d,crosshair:Gt(e)};if(e.brush){let u={x:b.x,y:b.y+b.height+mn,width:b.width,height:fn},k=t.map(U=>U.close),[T,A]=ie(k),L=s>1?u.width/(s-1):0,V=k.map((U,B)=>({x:p(u.x+B*L),y:p(u.y+u.height-(A===T?.5:(U-T)/(A-T))*(u.height-4)-2)})),j={x:p(u.x+l/s*u.width),y:u.y,width:p((c-l)/s*u.width),height:u.height};W.push({kind:"rect",part:"brush",...u,fill:"var(--skdx-color-surface-sunken)",stroke:$.grid},{kind:"path",part:"brush-series",d:V.length>1?`${Ve(V)}L${V[V.length-1]?.x} ${u.y+u.height}L${V[0]?.x} ${u.y+u.height}Z`:"",fill:"var(--skdx-color-primary-500)",fillOpacity:.3},{kind:"rect",part:"brush-window",...j,fill:"var(--skdx-color-primary-500)",opacity:.15,stroke:$.axis},{kind:"rect",part:"brush-handle",x:p(j.x-3),y:u.y+8,width:6,height:u.height-16,fill:$.axis,rx:2},{kind:"rect",part:"brush-handle",x:p(j.x+j.width-3),y:u.y+8,width:6,height:u.height-16,fill:$.axis,rx:2}),Tt.brush={box:u,window:j}}return{...Le,shapes:[...W,...Le.shapes],hit:Tt,issues:n}}var M=require("lit"),g=require("lit/decorators.js"),z=require("lit/directives/if-defined.js");var _n={fromAttribute:()=>!1},S=class extends M.LitElement{constructor(){super(...arguments);this.legend=!1;this.tooltip=!0;this.selectionMode="none";this.loading=!1;this.decorative=!1;this.accessibleTable=!1;this.zoomable=!1;this.editable=!1;this.crossFilter=!1;this.animated=!1;this.responsive=!1;this.tip=[];this.overlay=[];this.portal=null;this.highlightState=null;this.crossState=null;this.lastCross=null;this.pointers=new Map;this.hover=null;this.token={};this.focused=null;this.hiddenState=[];this.drag=null;this.onPointerMove=t=>{let r=this.layout;if(!r)return;this.pointers.has(t.pointerId)&&this.pointers.set(t.pointerId,this.viewBox(t,r).x);let i=this.drag;if(i?.grab==="select"){let{x:o,y:a}=this.viewBox(t,r);this.overlay=[rt(Ie(i.x,i.y,o,a))];return}if(i?.grab==="lasso"){let{x:o,y:a}=this.viewBox(t,r);i.points=[...i.points??[],{x:o,y:a}],this.overlay=[ot(i.points)];return}if(i?.grab==="edit"){if(!i.gantt)return;let{x:o}=this.viewBox(t,r);i.change=st(r,i.gantt,o-i.x),this.overlay=[ct(r,i.gantt,i.change)];return}if(i?.grab==="map"){if(!r.map||!i.view)return;let{x:o,y:a}=this.viewBox(t,r);this.setView(dt(r.map,i.view,o-i.x,a-i.y));return}if(i&&r.hit){if(i.grab==="pinch"){let[a,s]=[...this.pointers.values()];if(a===void 0||s===void 0||!i.distance)return;this.setZoom(mt(r.hit,i.zoom,Math.abs(a-s)/i.distance,(a+s)/2));return}let{x:o}=this.viewBox(t,r);this.setZoom(i.grab==="pan"?xt(r.hit,i.zoom,o-i.x):gt(r.hit,i.grab,i.zoom,o-i.x));return}if(r.tooltipPortal){let{lines:o,shapes:a}=Je(r,t.target,t.currentTarget,t.clientX,t.clientY);this.tip=a,this.portal=o.length?{x:t.clientX,y:t.clientY,lines:o}:null}else{let o=et(r,t.target,t.currentTarget,t.clientX,t.clientY);(o.length>0||this.tip.length>0)&&(this.tip=o)}if(this.highlight(tt(r,t.target)),this.syncId&&r.hit?.crosshair){let o=xe(r,this.viewBox(t,r).x);this.shareCrosshair(o?r.hit.rows[o.index]?.[0]??null:null)}};this.onPointerDown=t=>{let r=this.layout;if(!r||t.button!==0)return;let{x:i,y:o}=this.viewBox(t,r),a=Q(r,t.target)?.item.legend,s=this.canEdit(r)?at(r,i,o):void 0;if(s){this.drag={x:i,y:o,zoom:{start:0,end:0},grab:"edit",gantt:s},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}if(this.brushing()&&!a){this.drag={x:i,y:o,zoom:{start:0,end:0},grab:this.selectionMode==="lasso"?"lasso":"select",points:[{x:i,y:o}]},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}if(this.canPan(r)&&r.map){let c=r.map.plot;if(i<c.x||i>c.x+c.width||o<c.y||o>c.y+c.height)return;this.drag={x:i,y:o,zoom:{start:0,end:0},grab:"map",view:r.map.view},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}let l=r.hit;if(!(!l||!this.canZoom(r))){if(this.pointers.set(t.pointerId,i),this.pointers.size===2){let[c,d]=[...this.pointers.values()];this.drag={x:(c+d)/2,y:o,zoom:l.zoom,grab:"pinch",distance:Math.abs(c-d)||1}}else{let c=bt(l,i,o);if(c)this.drag={x:i,y:o,zoom:c.zoom,grab:c.grab},c.zoom!==l.zoom&&this.setZoom(c.zoom);else if(this.zoomable&&i>=l.plot.x&&i<=l.plot.x+l.plot.width&&o>=l.plot.y&&o<=l.plot.y+l.plot.height)this.drag={x:i,y:o,zoom:l.zoom,grab:"pan"};else{this.pointers.delete(t.pointerId);return}}t.currentTarget.setPointerCapture(t.pointerId),this.clearTip()}};this.onPointerUp=t=>{this.pointers.delete(t.pointerId);let r=t.currentTarget;r.hasPointerCapture(t.pointerId)&&r.releasePointerCapture(t.pointerId);let i=this.drag,o=this.layout;if(o&&(i?.grab==="select"||i?.grab==="lasso"||i?.grab==="edit"||i?.grab==="map")){this.overlay=[];let{x:a,y:s}=this.viewBox(t,o);if(Math.abs(a-i.x)>2||Math.abs(s-i.y)>2){i.grab==="select"?this.setSelected(nt(o,Ie(i.x,i.y,a,s))):i.grab==="lasso"?this.setSelected(it(o,i.points??[])):i.grab==="edit"&&i.change&&this.emit("skdx-task-change",i.change),this.drag={...i,distance:-1};return}this.drag=null;return}(this.pointers.size===0||this.drag?.grab==="pinch")&&(this.drag=null)};this.onWheel=t=>{let r=this.layout;if(!r)return;let{x:i,y:o}=this.viewBox(t,r);if(r.map&&this.canPan(r)){let l=r.map.plot;if(i<l.x||i>l.x+l.width||o<l.y||o>l.y+l.height)return;t.preventDefault(),this.setView(ut(r.map,t.deltaY,i,o));return}let a=r.hit;if(!a||!this.canZoom(r)||o<a.plot.y||o>a.plot.y+a.plot.height)return;let s=ft(a,t.deltaY,i);s&&(t.preventDefault(),this.setZoom(s))};this.onClick=t=>{if(!this.layout)return;if(this.drag?.distance===-1){this.drag=null;return}let r=Q(this.layout,t.target);r&&(r.item.range?this.setZoom(r.item.range):r.item.legend&&r.item.series!==void 0?this.toggle(r.item.series):(this.select(r.item),this.emit("skdx-item-click",r.item)))};this.onKeyDown=t=>{let r=this.layout;if(!r)return;if((t.key==="Enter"||t.key===" ")&&this.focused!==null){let s=r.shapes[this.focused]?.item;s&&(t.preventDefault(),this.select(s),this.emit("skdx-item-click",s));return}let i=this.canEdit(r)?lt(r,this.focused,t):void 0;if(i){t.preventDefault(),this.emit("skdx-task-change",i);return}let o=pt(r,this.focused,t.key);if(o===void 0)return;t.preventDefault(),this.focused=o;let a=o===null?void 0:r.shapes[o]?.item;this.highlight(a?X(a):null)}}connectedCallback(){super.connectedCallback(),!(typeof ResizeObserver>"u")&&(this.observer=new ResizeObserver(([t])=>{let r=Math.floor(t?.contentRect.width??0);r>0&&(this.measured=r)}),this.observer.observe(this))}disconnectedCallback(){this.observer?.disconnect(),this.leave?.(),this.leave=void 0,this.joined=void 0,super.disconnectedCallback()}sized(){let{width:t,height:r,legend:i,tooltip:o,format:a,palette:s,loading:l,error:c,emptyMessage:d,description:h,decorative:m,animated:w,responsive:y,highlighted:f,highlightScope:v,accessibleTable:b}=this;return{...typeof y=="object"&&this.measured!==void 0&&this.measured<(y.breakpoint??480)?y.compact:void 0,width:y&&this.measured?this.measured:t,height:r,animate:w,responsive:y,legend:i,tooltip:o,format:a,palette:s,loading:l,error:c,emptyMessage:d,description:h,decorative:m,highlighted:f===void 0?this.highlightState:f,highlightScope:v,accessibleTable:b,hiddenSeries:this.hiddenSeries??this.hiddenState,zoom:this.zoom??this.zoomState,selected:this.selected??this.selectedState,view:this.view??this.viewState}}emit(t,r){this.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!0,composed:!0}))}publish(t){this.syncId&&ze(this.syncId).publish(t,this.token)}join(){if(this.joined===this.syncId||(this.leave?.(),this.leave=void 0,this.joined=this.syncId,!this.syncId))return;let t=ze(this.syncId),r=i=>{"highlighted"in i&&(this.highlightState=i.highlighted??null),i.selected&&(this.selectedState=i.selected,this.crossFilter&&(this.highlightState=i.selected.length?i.selected:null)),"zoom"in i&&(this.zoomState=i.zoom),i.hiddenSeries&&(this.hiddenState=i.hiddenSeries),"crosshair"in i&&(this.crossState=i.crosshair??null)};r(t.current),this.leave=t.subscribe((i,o)=>{o!==this.token&&r(i)})}setZoom(t){this.zoomState=t,this.emit("skdx-zoom-change",t),this.publish({zoom:t})}setView(t){this.viewState=t,this.emit("skdx-view-change",t)}setSelected(t){this.selectedState=t,this.emit("skdx-selected-change",t),this.publish({selected:t})}toggle(t){let r=this.hiddenSeries??this.hiddenState,i=r.includes(t)?r.filter(o=>o!==t):[...r,t];this.hiddenState=i,this.emit("skdx-hidden-series-change",i),this.publish({hiddenSeries:i})}highlight(t){let r=this.hover;r===t||r&&t&&We(r,t)||(this.hover=t,this.emit("skdx-highlighted-change",t),this.syncId&&(this.highlightState=t,this.publish({highlighted:t})))}select(t){let r=this.selectionMode;r!=="none"&&this.setSelected(Ue(this.selected??this.selectedState,t,r==="single"?"single":"multiple"))}shareCrosshair(t){!this.syncId||this.lastCross===t||(this.lastCross=t,this.publish({crosshair:t}))}clearTip(){this.tip=[],this.portal=null,this.shareCrosshair(null)}canZoom(t){return!!(t.hit&&(this.zoomable||t.hit.brush))}canPan(t){return!!(t.map&&this.zoomable)}canEdit(t){return!!(this.editable&&t.edit)}brushing(){return this.selectionMode==="brush"||this.selectionMode==="lasso"}viewBox(t,r){return ce(t.currentTarget,t.clientX,t.clientY,r.width,r.height)}getSvgElement(){return this.renderRoot.querySelector("svg")}getLayout(){return this.layout}resetZoom(){this.setZoom(void 0)}zoomTo(t){this.setZoom(t)}focusItem(t){let r=this.layout;if(!r)return!1;let i=r.shapes.findIndex(o=>o.item&&!o.item.legend&&K(o.item,t));return i<0?!1:(this.getSvgElement()?.focus(),this.focused=i,!0)}export(t){let r=this.layout;return r?vt(r,{...t,label:t.label??this.label??this.localName}):Promise.reject(new Error("not rendered yet"))}root(t,r,i){this.join();let o=Ke(_e(t),this.sized());if(this.layout=o,o.issues!==this.reported){this.reported=o.issues;for(let b of o.issues??[])this.emit("skdx-data-issue",b)}let a=this.canZoom(o),s=this.canPan(o),l=this.canEdit(o),c=this.brushing(),d=a||s||l||c,h=!o.decorative&&Te(o).length>0,m=o.description?`${r}-desc`:void 0,w=$t(o),y=wt(o,this.accessibleTable),f=typeof this.accessibleTable=="object"&&this.accessibleTable.caption||i,v=this.portal;return M.html`<svg
|
|
1
|
+
"use strict";var ke=Object.defineProperty;var At=Object.getOwnPropertyDescriptor;var Mn=Object.getOwnPropertyNames;var $n=Object.prototype.hasOwnProperty;var Sn=(e,n)=>{for(var t in n)ke(e,t,{get:n[t],enumerable:!0})},Cn=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of Mn(n))!$n.call(e,i)&&i!==t&&ke(e,i,{get:()=>n[i],enumerable:!(r=At(n,i))||r.enumerable});return e};var In=e=>Cn(ke({},"__esModule",{value:!0}),e),x=(e,n,t,r)=>{for(var i=r>1?void 0:r?At(n,t):n,o=e.length-1,a;o>=0;o--)(a=e[o])&&(i=(r?a(n,t,i):a(i))||i);return r&&i&&ke(n,t,i),i};var Kn={};Sn(Kn,{SkdxCandlestickChart:()=>H});module.exports=In(Kn);var _=require("lit/decorators.js");var zt=e=>Number(e.toPrecision(12)),Tn,Ot=e=>(Tn??(Tn=new Intl.NumberFormat)).format(zt(e)),An=e=>{let n=Math.round(Math.abs(e)),t=e<0?"-":"",r=Math.floor(n/3600),i=Math.floor(n%3600/60),o=a=>String(a).padStart(2,"0");return r>0?`${t}${r}h ${o(i)}m`:i>0?`${t}${i}m ${o(n%60)}s`:`${t}${n}s`};function re(e){if(e===void 0)return Ot;if(typeof e=="function")return e;let{style:n,locale:t,digits:r,unit:i="",timeZone:o}=e,a=d=>i?h=>d(h)+i:d,s=d=>r===void 0?d===void 0?{}:{maximumFractionDigits:d}:{minimumFractionDigits:r,maximumFractionDigits:r},l=d=>{let h=new Intl.NumberFormat(t,d);return a(m=>h.format(zt(m)))},c=d=>{let h=new Intl.DateTimeFormat(t,o?{...d,timeZone:o}:d);return m=>h.format(m)};switch(n){case"integer":return l({maximumFractionDigits:0});case"decimal":return l(s(2));case"percent":return l({style:"percent",...s(0)});case"currency":return l({style:"currency",currency:e.currency??"USD",...s()});case"compact":return l({notation:"compact",...s(1)});case"scientific":return l({notation:"scientific",...s(2)});case"date":return c({dateStyle:"medium"});case"time":return c({timeStyle:"short"});case"datetime":return c({dateStyle:"medium",timeStyle:"short"});case"duration":return a(An)}}function Ve(e,n){if(typeof e=="string")return e;let t=e instanceof Date?e.getTime():e;return n?re(n)(t):e instanceof Date?new Intl.DateTimeFormat().format(e):Ot(t)}var Me=e=>{if(e instanceof Date)return e.getTime();if(typeof e=="number")return e;let n=Number(e);return Number.isFinite(n)&&e.trim()!==""?n:Date.parse(e)};function oe([e,n],[t,r]){let i=n-e;return o=>i===0?t:t+(o-e)/i*(r-t)}function xe(e,n,t=5){if(e===n)return[e];let r=(n-e)/Math.max(1,t),i=10**Math.floor(Math.log10(r)),o=r/i,a=(o<1.5?1:o<3.5?2:o<7.5?5:10)*i,s=Math.floor(e/a)*a,l=Math.ceil(n/a)*a,c=[];for(let d=s;d<=l+a/2;d+=a)c.push(Rt(d));return c}function Lt(e,[n,t],r=.2){let i=e===0?0:(t-n)/e,o=i*(1-Math.max(0,Math.min(.9,r)));return{step:i,bandwidth:o,start:a=>n+a*i+(i-o)/2,center:a=>n+(a+.5)*i}}var Rt=e=>Number(e.toPrecision(12)),p=e=>Number(e.toFixed(2)),F=e=>typeof e=="number"&&Number.isFinite(e);function ae(e){let n=1/0,t=-1/0;for(let r of e)F(r)&&(r<n&&(n=r),r>t&&(t=r));return n===1/0?[0,0]:[n,t]}function Ne(e,n="linear"){if(e.length===0)return"";let t=e[0];if(n==="step"||n==="stepBefore"||n==="stepAfter"){let c=`M${t.x} ${t.y}`;for(let d=1;d<e.length;d++){let h=e[d-1],m=e[d];n==="stepAfter"?c+=`H${m.x}V${m.y}`:n==="stepBefore"?c+=`V${m.y}H${m.x}`:c+=`H${p((h.x+m.x)/2)}V${m.y}H${m.x}`}return c}if(n==="linear"||e.length<3)return`M${e.map(c=>`${c.x} ${c.y}`).join("L")}`;let r=e.length,i=e.slice(1).map((c,d)=>c.x-e[d].x),o=e.slice(1).map((c,d)=>c.y-e[d].y),a=i.map((c,d)=>c===0?0:o[d]/c),s=[a[0]];for(let c=1;c<r-1;c++){let d=a[c-1],h=a[c];s.push(d*h<=0?0:(d+h)/2)}s.push(a[r-2]);for(let c=0;c<r-1;c++){let d=a[c];if(d===0){s[c]=0,s[c+1]=0;continue}let h=s[c]/d,m=s[c+1]/d,k=Math.hypot(h,m);k>3&&(s[c]=3*h*d/k,s[c+1]=3*m*d/k)}let l=`M${t.x} ${t.y}`;for(let c=0;c<r-1;c++){let d=e[c],h=e[c+1],m=i[c]/3;l+=`C${p(d.x+m)} ${p(d.y+m*s[c])} ${p(h.x-m)} ${p(h.y-m*s[c+1])} ${h.x} ${h.y}`}return l}var he=1e3,pe=60*he,fe=60*pe,me=24*fe,zn=[he,5*he,15*he,30*he,pe,5*pe,15*pe,30*pe,fe,3*fe,6*fe,12*fe,me,2*me,7*me,14*me];function Bt(e,n,t=6){if(!(n>e))return[e];let r=n-e,i=zn.find(h=>r/h<=t),o=[];if(i!==void 0){for(let h=Math.ceil(e/i)*i;h<=n;h+=i)o.push(h);return o.length?o:[e,n]}let a=r/(30*me),s=[1,2,3,6,12,24,60,120].find(h=>a/h<=t)??240,l=new Date(e),c=l.getUTCFullYear(),d=Math.ceil((l.getUTCMonth()+(l.getUTCDate()>1?1:0))/s)*s;for(let h=Date.UTC(c,d,1);h<=n;)o.push(h),d+=s,d>=12&&(c+=Math.floor(d/12),d%=12),h=Date.UTC(c,d,1);return o.length?o:[e,n]}function Pt(e,n){let t=Math.floor(Math.log10(e)),r=Math.ceil(Math.log10(n)),i=r-t<=1?[1,2,5]:[1],o=[];for(let a=t;a<=r;a++)for(let s of i)o.push(Rt(s*10**a));return o.filter(a=>a>=e/1.0001&&a<=n*1.0001)}var On=/-?\d*\.?\d+(?:e[-+]?\d+)?/gi,Ln=/([MLTHVCSQAZmlthvcsqaz])([^MLTHVCSQAZmlthvcsqaz]*)/g,Rn={M:2,L:2,T:2,C:6,S:4,Q:4,A:7,H:-1,V:-2};function Bn(e,n,t){return e.replace(Ln,(r,i,o)=>{let a=Rn[i];if(a===void 0)return i+o;let l=(o.match(On)??[]).map((c,d)=>{let h=Number(c);if(a===-1)return String(h+n);if(a===-2)return String(h+t);let m=d%a;return a===7?m===5?String(h+n):m===6?String(h+t):c:String(m%2===0?h+n:h+t)});return i+l.join(" ")})}var Vt=(e,n,t)=>e.map(r=>{switch(r.kind){case"rect":return{...r,x:r.x+n,y:r.y+t};case"circle":return{...r,cx:r.cx+n,cy:r.cy+t};case"line":return{...r,x1:r.x1+n,x2:r.x2+n,y1:r.y1+t,y2:r.y2+t};case"text":return{...r,x:r.x+n,y:r.y+t};case"path":return{...r,d:Bn(r.d,n,t)}}});var De=["primary","success","warning","danger","neutral"].flatMap(e=>[500,700].map(n=>`var(--skdx-color-${e}-${n})`)).sort((e,n)=>Number(e.endsWith("700)"))-Number(n.endsWith("700)"))),S={axis:"var(--skdx-color-border-strong)",grid:"var(--skdx-color-border-subtle)",label:"var(--skdx-color-text-muted)",focus:"var(--skdx-color-focus-ring)",positive:"var(--skdx-color-success-500)",negative:"var(--skdx-color-danger-500)",fontFamily:"var(--skdx-font-family)",fontSize:"var(--skdx-font-size-xs)"},se=(e="neutral")=>e==="neutral"?S.axis:`var(--skdx-color-${e}-500)`,Ge=(e="neutral")=>e==="neutral"?S.label:e==="primary"?"var(--skdx-color-text-accent)":`var(--skdx-color-text-${e})`,Nt=(e,n)=>n??De[e%De.length];var ie={top:16,right:16,bottom:32,left:48};function Dt(e,n,t=ie){return{x:t.left,y:t.top,width:Math.max(0,e-t.left-t.right),height:Math.max(0,n-t.top-t.bottom)}}function be(e){let n=e.legend;if(n)return n===!0?{}:n.enabled===!1?void 0:n}function He(e){let n=e.tooltip;return n===void 0||n===!0?{enabled:!0}:n===!1?{enabled:!1}:{...n,enabled:n.enabled??!0}}var Gt=e=>e.crosshair===!0||He(e).trigger==="axis",$e=20,Pn=120,Ft=e=>{let n=be(e);return n&&(n.position==="left"||n.position==="right")?n.width??Pn:0},Se=(e,n=600,t=300)=>({width:(e.width??n)-Ft(e),height:(e.height??t)-(be(e)?.position==="bottom"?$e:0)}),Ht=(e,n,t)=>{let r=be(e);return!r||!(r.position===void 0||r.position==="top")?0:(n?Math.max(1,Et(n,t??Se(e).width,r)):1)*$e},Y=6.5,jt=(e,n,t)=>t??(e.palette&&e.palette.length>0?e.palette[n%e.palette.length]:Nt(n)),_t=(e,n)=>e.hiddenSeries?.includes(n)??!1;function Fe(e,n,t=[],r={},i=10,o=8,a=!1){let s=[],l=r.maxItems,c=l!==void 0&&l>=0&&e.length>l?e.slice(0,l):e,d=e.length-c.length,h=r.interactive??!0,m=o,k=i,b=(f,y,v,w)=>{let L=(y?18:4)+f.length*Y;m>o&&(a||m+L>n-8)&&(m=o,k+=$e),y&&s.push({kind:"rect",part:"legend-swatch",x:m,y:k-5,width:10,height:10,fill:y,opacity:w?.3:void 0,item:v}),s.push({kind:"text",part:"legend-label",x:m+(y?14:0),y:k,text:f,baseline:"middle",fill:w?S.grid:S.label,item:v}),m+=L+12};for(let f of c){let y=t.includes(f.name),v=h?{label:f.name,series:f.name,legend:!0}:void 0;b(r.formatter?.(f.name)??f.name,f.color,v,y)}return d>0&&b(`+${d} more`,void 0,void 0,!1),r.align==="end"?Vn(s,n):s}function Vn(e,n){let t=new Map;for(let i of e){let o=i.kind==="rect"?i.y+5:i.y;t.set(o,[...t.get(o)??[],i])}let r=[];for(let i of t.values()){let o=Math.max(...i.map(s=>s.kind==="rect"?s.x+s.width:s.x+s.text.length*Y)),a=n-8-o;for(let s of i)r.push({...s,x:s.x+a})}return r}var Et=(e,n,t={})=>new Set(Fe(e,n,[],t).flatMap(r=>r.kind==="text"?[r.y]:[])).size;function je(e,n,t,r=[]){let i=be(e),o=i&&e.direction==="rtl"&&i.align===void 0?{...i,align:"end"}:i,a=He(e),s=o?.position==="bottom",l=Ft(e),c=e.hiddenSeries??[],d=o?l?Fe(r,1/0,c,o,10,(o.position==="right"?n:0)+8,!0):Fe(r,n,c,o,s?t+10:10):[],h=s?Et(r,n,o):0;return{width:n+l,height:s?t+Math.max(1,h)*$e:t,legendOffset:o?.position==="left"?l:void 0,tooltip:a.enabled,tooltipFormatter:a.formatter,axisTooltipFormatter:a.axisFormatter,tooltipPortal:a.portal,tooltipPlacement:a.placement,tooltipAnchored:a.followPointer===!1?!0:void 0,description:e.description,decorative:e.decorative,animate:e.animate===!0?300:e.animate||void 0,responsive:!!e.responsive,shapes:d}}function _e(e){let n=e.legendOffset;if(!n)return e;let t=[...Vt(e.shapes.filter(l=>!l.part.startsWith("legend-")),n,0),...e.shapes.filter(l=>l.part.startsWith("legend-"))],r=l=>({...l,x:l.x+n}),i=e.hit?{...e.hit,plot:r(e.hit.plot),xs:e.hit.xs.map(l=>l+n),brush:e.hit.brush?{box:r(e.hit.brush.box),window:r(e.hit.brush.window)}:void 0}:void 0,o=e.edit,a=o?{...o,scale:l=>o.scale(l)+n,invert:l=>o.invert(l-n),bars:o.bars.map(l=>({...l,x0:l.x0+n,x1:l.x1+n}))}:void 0,s=e.map?{...e.map,plot:r(e.map.plot)}:void 0;return{...e,shapes:t,hit:i,edit:a,map:s,legendOffset:void 0}}function Ce(e,n,t,r,i,o="auto"){let a=Array.isArray(t)?t:[t],s=Math.max(...a.map(m=>m.length))*Y+12,l=6+a.length*16,c=o==="top"?{x:e-s/2,y:n-l-8}:o==="bottom"?{x:e-s/2,y:n+8}:o==="left"?{x:e-s-8,y:n-l/2}:o==="right"?{x:e+8,y:n-l/2}:{x:e+12,y:n-l-6},d=Math.max(0,Math.min(r-s,c.x)),h=Math.max(0,Math.min(i-l,c.y));return[{kind:"rect",part:"tooltip",x:p(d),y:p(h),width:p(s),height:l,fill:"var(--skdx-color-surface-raised)",stroke:S.axis,rx:3},...a.map((m,k)=>({kind:"text",part:"tooltip-label",x:p(d+6),y:p(h+11+k*16),text:m,baseline:"middle",fill:"var(--skdx-color-text-default)",weight:a.length>1&&k===0?"bold":void 0}))]}function Zt(e,n){let[t,r]=ae(e);return n?[Math.min(0,t),Math.max(0,r)]:[t,r]}function Wt([e,n],t,r=!1,i){let o=typeof r=="boolean"?{scale:r?"log":"linear"}:r,a=re(o.format??i),s=o.min??e,l=o.max??n;o.reversed&&(t=[t[1],t[0]]);let c={id:o.id,position:o.position,options:o};if(o.scale==="sqrt"){let f=N=>Math.sign(N)*Math.sqrt(Math.abs(N)),y=o.nice===!1?[s,l]:xe(s,l,o.ticks),v=o.min??y[0],w=o.max??y[y.length-1],L=oe([f(v),f(w)],t),V=N=>L(f(N)),E=xe(v,w,o.ticks).filter(N=>N>=v-1e-9&&N<=w+1e-9);return{...c,scale:V,domain:[v,w],format:a,ticks:(E.length>=2?E:[v,w]).map(N=>({pos:p(V(N)),label:a(N)})),zero:p(V(Math.min(Math.max(0,v),w)))}}if(o.scale==="log"){let f=Math.max(s,Number.EPSILON),y=Math.max(l,f),v=Pt(f,y),w=[Math.log10(f),Math.log10(y)],L=oe(w,t),V=E=>L(Math.log10(Math.max(E,Number.EPSILON)));return{...c,scale:V,domain:w,format:a,ticks:v.map(E=>({pos:p(V(E)),label:a(E)})),zero:p(t[0])}}let d=xe(s,l,o.ticks),h=[o.min??(o.nice===!1?s:d[0]),o.max??(o.nice===!1?l:d[d.length-1])],m=oe(h,t),k=d.filter(f=>f>=h[0]-1e-9&&f<=h[1]+1e-9),b=(k.length>=2?k:[h[0],h[1]]).map(f=>({pos:p(m(f)),label:a(f)}));return{...c,scale:m,domain:h,format:a,ticks:b,zero:p(m(Math.min(Math.max(0,h[0]),h[1])))}}var Ut=([e,n],t)=>Math.max(ie.left,xe(e,n).reduce((r,i)=>Math.max(r,t(i).length),0)*Y+14);function Kt(e,n){if(e.length<2)return e;let t=e.reduce((i,o)=>Math.max(i,o.label.length),0)*Y+8,r=Math.max(1,Math.ceil(e.length*t/Math.max(1,n)));return r===1?e:e.filter((i,o)=>o%r===0)}function Yt(e,n,t,r){let i=e.error!==void 0?"error":e.loading?"loading":n?"empty":null;if(!i)return null;let{width:o,height:a}=Se(e,t,r),s=i==="error"?e.error:i==="loading"?"Loading\u2026":e.emptyMessage??"No data available",l=[];return i==="loading"&&l.push({kind:"rect",part:"skeleton",x:0,y:0,width:o,height:a,fill:"var(--skdx-color-surface-sunken)",rx:4}),l.push({kind:"text",part:`state-${i}`,x:p(o/2),y:p(a/2),text:s,anchor:"middle",baseline:"middle",fill:i==="error"?"var(--skdx-color-text-danger)":S.label}),{...je(e,o,a),shapes:l,tooltip:!1}}var qt=(e,n,t)=>{let r=n.length*Y/2;return e+r>t?"end":e-r<0?"start":"middle"};function Xt(e,n={}){let{plot:t,xTicks:r,yTicks:i,baseline:o}=e,a=t.x+t.width,s=t.y+t.height,l=[],c=n.grid??!0,d=(b,f)=>f?{kind:"line",part:"grid",x1:b.pos,x2:b.pos,y1:t.y,y2:s,stroke:S.grid}:{kind:"line",part:"grid",x1:t.x,x2:a,y1:b.pos,y2:b.pos,stroke:S.grid},h=n.x?.tickRotation??0,m=(b,f,y,v)=>h?B(b,f,y,{part:v,anchor:h<0?"end":"start",baseline:"middle",rotate:h}):B(b,f,y,{part:v,anchor:qt(b,y,e.width)}),k=(b,f,y,v,w)=>{for(let L of b)l.push(f==="x"?{kind:"line",part:"tick",x1:L.pos,x2:L.pos,y1:y,y2:p(y+v*w),stroke:S.axis}:{kind:"line",part:"tick",x1:y,x2:p(y+v*w),y1:L.pos,y2:L.pos,stroke:S.axis})};if(n.categoryGrid)for(let b of r)l.push(d(b,!n.horizontal));if(n.horizontal){let b=n.axes??[{ticks:i,position:"bottom",offset:0,label:n.yLabel,...n.y}];if(c)for(let f of i)l.push(d(f,!0));b[0]?.showLine!==!1&&l.push({kind:"line",part:"axis",x1:o,x2:o,y1:t.y,y2:s,stroke:S.axis});for(let f of b){let y=f.position==="top"||f.position==="right",v=p(y?t.y-f.offset:s+f.offset),w=y||f.offset>0;f.showLine&&w&&l.push({kind:"line",part:"axis",x1:t.x,x2:a,y1:v,y2:v,stroke:S.axis}),f.showTicks&&k(f.ticks,"x",v,y?-1:1,f.tickSize??4);let L=p(y?v-8:v+20);for(let V of f.ticks)l.push(y?B(V.pos,L,V.label,{part:"x-label-top",anchor:qt(V.pos,V.label,e.width)}):m(V.pos,L,V.label,"x-label"));f.label&&l.push(w?B(4,L,f.label,{part:"axis-title",anchor:"start",baseline:y?void 0:"middle"}):B(4,t.y-6,f.label,{part:"axis-title",anchor:"start"}))}n.x?.showLine&&l.push({kind:"line",part:"axis",x1:n.rtl?a:t.x,x2:n.rtl?a:t.x,y1:t.y,y2:s,stroke:S.axis}),n.x?.showTicks&&k(r,"y",n.rtl?a:t.x,n.rtl?1:-1,n.x.tickSize??4);for(let f of r)l.push(n.rtl?B(a+8,f.pos,f.label,{part:"y-label",anchor:"start",baseline:"middle"}):B(t.x-8,f.pos,f.label,{part:"y-label",anchor:"end",baseline:"middle"}))}else{if(c)for(let f of i)l.push(d(f,!1));n.y?.showLine!==!1&&l.push({kind:"line",part:"axis",x1:t.x,x2:a,y1:o,y2:o,stroke:S.axis});let b=n.axes??[{ticks:i,position:"left",offset:0,label:n.yLabel,...n.y},...n.rightTicks?[{ticks:n.rightTicks,position:"right",offset:0,label:n.rightLabel}]:[]];for(let f of b){let y=f.position==="left",v=y?t.x-f.offset:a+f.offset,w=y?"y-label":"y-label-right";f.showLine&&l.push({kind:"line",part:"axis",x1:p(v),x2:p(v),y1:t.y,y2:s,stroke:S.axis}),f.showTicks&&k(f.ticks,"y",p(v),y?-1:1,f.tickSize??4);for(let L of f.ticks)l.push(B(p(y?v-8:v+8),L.pos,L.label,{part:w,anchor:y?"end":"start",baseline:"middle"}));f.label&&l.push(B(p(y?f.offset===0?4:Math.max(4,v-40):f.offset===0?e.width-4:Math.min(e.width-4,v+40)),t.y-6,f.label,{part:"axis-title",anchor:y?"start":"end"}))}n.x?.showTicks&&k(r,"x",s,1,n.x.tickSize??4);for(let f of r)l.push(m(f.pos,s+(h?12:20),f.label,"x-label"))}return n.xLabel&&l.push(B(p(t.x+t.width/2),e.height-4,n.xLabel,{part:"axis-title",anchor:"middle"})),n.horizontal&&n.rightLabel&&l.push(B(e.width-4,t.y-6,n.rightLabel,{part:"axis-title",anchor:"end"})),l}var B=(e,n,t,r={})=>({kind:"text",part:"label",x:e,y:n,text:t,fill:S.label,...r});function Ee(e,n){let t=[],{plot:r}=n,i=r.x+r.width,o=r.y+r.height,a=l=>Math.max(r.x,Math.min(i,l)),s=l=>Math.max(r.y,Math.min(o,l));for(let l of e??[]){let c=l.color??se(l.variant),d=l.color??Ge(l.variant),h={part:"reference-label",fill:d},m=n.horizontal===!0;if("y"in l){let k=p(n.y(l.y,l.axis??"left"));if(m){let b=a(k);t.push(...Jt(b,r.y,o,c,l.label,h))}else{let b=s(k);t.push(...Qt(r.x,i,b,c,l.label,h))}}else if("x"in l){let k=n.x(l.x);if(k===void 0)continue;m?t.push(...Qt(r.x,i,s(p(k)),c,l.label,h)):t.push(...Jt(a(p(k)),r.y,o,c,l.label,h))}else if("y1"in l){let k=p(n.y(l.y1,l.axis??"left")),b=p(n.y(l.y2,l.axis??"left"));m?t.push(...tn(a(Math.min(k,b)),a(Math.max(k,b)),r,c,l.label,d)):t.push(...en(s(Math.min(k,b)),s(Math.max(k,b)),r,c,l.label,d))}else{let k=n.x(l.x1),b=n.x(l.x2);if(k===void 0||b===void 0)continue;let f=p(Math.min(k,b)),y=p(Math.max(k,b));m?t.push(...en(s(f),s(y),r,c,l.label,d)):t.push(...tn(a(f),a(y),r,c,l.label,d))}}return t}function Qt(e,n,t,r,i,o){let a={kind:"line",part:"reference",x1:e,x2:n,y1:t,y2:t,stroke:r,dash:"6 4",strokeWidth:1.5,title:i};return i?[a,B(n-4,t-5,i,{...o,anchor:"end"})]:[a]}function Jt(e,n,t,r,i,o){let a={kind:"line",part:"reference",x1:e,x2:e,y1:n,y2:t,stroke:r,dash:"6 4",strokeWidth:1.5,title:i};return i?[a,B(e+4,n+10,i,{...o,anchor:"start"})]:[a]}function en(e,n,t,r,i,o){let a={kind:"rect",part:"reference-area",x:t.x,y:e,width:t.width,height:p(Math.max(0,n-e)),fill:r,opacity:.12,title:i};return i?[a,B(t.x+t.width-4,e+12,i,{part:"reference-label",fill:o,anchor:"end"})]:[a]}function tn(e,n,t,r,i,o){let a={kind:"rect",part:"reference-area",x:e,y:t.y,width:p(Math.max(0,n-e)),height:t.height,fill:r,opacity:.12,title:i};return i?[a,B(e+4,t.y+12,i,{part:"reference-label",fill:o,anchor:"start"})]:[a]}function nn(e,n){let t=[],{plot:r}=n,i=r.x+r.width,o=r.y+r.height;for(let a of e??[]){let s=a.color??se(a.variant),l=a.color??Ge(a.variant),c=(b,f,y)=>{let v=n.x(b);if(v===void 0)return;let w=n.y(f,y??"left");return n.horizontal?{x:p(w),y:p(v)}:{x:p(v),y:p(w)}},d=a.id??a.label,h=b=>({label:b,id:d,name:a.label});if(a.type==="line"||a.type==="band"){let{type:b,id:f,...y}=a;t.push(...Ee([y],n));continue}if(a.type==="rect"){let b=c(a.x1,a.y1,a.axis),f=c(a.x2,a.y2,a.axis);if(!b||!f)continue;let y=Math.max(r.x,Math.min(b.x,f.x)),v=Math.max(r.y,Math.min(b.y,f.y)),w=a.label??"";t.push({kind:"rect",part:"annotation-rect",x:p(y),y:p(v),width:p(Math.max(0,Math.min(i,Math.max(b.x,f.x))-y)),height:p(Math.max(0,Math.min(o,Math.max(b.y,f.y))-v)),fill:s,opacity:.12,stroke:s,title:w||void 0,item:w?h(w):void 0}),a.label&&t.push(B(p(y+4),p(v+12),a.label,{part:"annotation-label",fill:l}));continue}let m=c(a.x,a.y,a.axis);if(!m)continue;if(a.type==="text"){t.push(B(m.x,m.y,a.text,{part:"annotation-text",fill:l,anchor:"middle",baseline:"middle",title:a.label}));continue}let k=a.label??`${String(a.x)}, ${a.y}`;if(t.push({kind:"circle",part:"annotation-point",cx:m.x,cy:m.y,r:5,fill:s,stroke:"var(--skdx-color-surface-default)",title:k,item:h(k)}),a.type==="callout"&&a.label){let[b,f]=a.offset??[16,-16],y=p(Math.max(r.x,Math.min(i,m.x+b))),v=p(Math.max(r.y,Math.min(o,m.y+f)));t.push({kind:"line",part:"annotation-leader",x1:m.x,y1:m.y,x2:y,y2:v,stroke:s},B(y,v,a.label,{part:"annotation-label",fill:l,anchor:b>=0?"start":"end",baseline:"middle"}))}}return t}function rn(e,n){let t=Math.max(1,Math.floor(n));return e.map((r,i)=>{if(i<t-1)return null;let o=0;for(let a=i-t+1;a<=i;a++){let s=e[a];if(!F(s))return null;o+=s}return o/t})}function on(e,n){let t=Math.max(1,Math.floor(n)),r=2/(t+1),i,o=0,a=0;return e.map(s=>F(s)?i===void 0?(o+=s,a++,a<t?null:(i=o/t,i)):(i=r*s+(1-r)*i,i):i??null)}function Ie(e){return e==null?[]:(Array.isArray(e)?e:[e]).map(t=>typeof t=="object"?t:{id:t})}var Ze=e=>e.id??e.name??e.series,an=e=>e.seriesId??e.series;function q(e,n){let t=!1;return n.id!==void 0&&(t=!0,Ze(e)!==n.id&&e.id!==n.id&&e.name!==n.id)||n.series!==void 0&&(t=!0,an(e)!==n.series&&e.series!==n.series)||n.index!==void 0&&(t=!0,e.index!==n.index)||n.category!==void 0&&(t=!0,e.category!==n.category)?!1:t}function J(e){let n={},t=Ze(e);t!==void 0&&(n.id=t);let r=an(e);return r!==void 0&&e.series!==void 0&&(n.series=r),e.index!==void 0&&(n.index=e.index),n}var We=(e,n)=>e.id===n.id&&e.series===n.series&&e.index===n.index&&e.category===n.category;function Ue(e,n,t){let r=Ie(e),i=J(n),o=r.some(a=>q(n,a));return t==="single"?o?[]:[i]:o?r.filter(a=>!q(n,a)):[...r,i]}var Nn=.2;function Dn(e){let n=S.focus;switch(e.kind){case"rect":return{kind:"rect",part:"selected",x:e.x-1.5,y:e.y-1.5,width:e.width+3,height:e.height+3,fill:"none",stroke:n,rx:e.rx};case"circle":return{kind:"circle",part:"selected",cx:e.cx,cy:e.cy,r:e.r+2.5,fill:"none",stroke:n};case"path":return{kind:"path",part:"selected",d:e.d,fill:"none",stroke:n,strokeWidth:2.5};case"line":return{...e,part:"selected",stroke:n,strokeWidth:(e.strokeWidth??1)+3,title:void 0,item:void 0};case"text":return}}var Gn=(e,n)=>e.kind==="text"?{...e,fill:S.grid}:{...e,opacity:(e.opacity??1)*n};function Ke(e,n){let t=Ie(n.selected),r=n.highlighted===void 0||n.highlighted===null?[]:Ie(n.highlighted),i=r[0];if(t.length===0&&!i)return e;let o={highlighted:n.highlightScope?.highlighted??"item",faded:n.highlightScope?.faded??"global"},a=[],s=d=>!i||r.some(h=>q(d,h))?!0:o.highlighted==="series"?r.some(h=>h.series!==void 0&&q(d,{series:h.series})):!1,l=d=>{if(!i||o.faded==="none"||s(d))return!1;if(o.faded==="series"){let h=i.series;return h!==void 0&&q(d,{series:h})}return!0},c=e.shapes.map(d=>{let h=d.item;if(!h||h.legend)return d;if(t.some(m=>q(h,m))){let m=Dn(d);m&&a.push(m)}return l(h)?Gn(d,Nn):d});return a.length?{...e,shapes:[...c,...a]}:{...e,shapes:c}}function ue(e,n,t,r,i){let o=e.getBoundingClientRect();return{x:o.width?(n-o.left)*r/o.width:n,y:o.height?(t-o.top)*i/o.height:t}}var Ye=(e,n,t)=>n>=e.x&&n<=e.x+e.width&&t>=e.y&&t<=e.y+e.height;function sn(e,n){let t=0,r=1/0;return e.xs.forEach((i,o)=>{let a=Math.abs(i-n);a<r&&(r=a,t=o)}),t}function ge(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=sn(t,n),i=t.rows[r]??[];return{index:r,rows:e.axisTooltipFormatter?.(i,r)??i}}function qe(e,n){let t=e.hit;if(!t||t.xs.length===0)return;let r=t.xs[sn(t,n)];return{kind:"line",part:"crosshair",x1:r,x2:r,y1:t.plot.y,y2:t.plot.y+t.plot.height,stroke:S.axis,dash:"3 3"}}function Xe(e,n,t){let r=e.hit;if(!r||!r.crosshair||r.xs.length===0||!Ye(r.plot,n,t))return[];let i=qe(e,n),{rows:o}=ge(e,n),a=e.tooltipAnchored?r.plot.y+8:t;return[i,...Ce(i.x1,a,o,e.width,e.height,e.tooltipPlacement)]}function Qe(e,n){let t=e.hit;if(!t||t.xs.length===0)return[];let r=t.rows.findIndex(o=>o[0]===n);if(r<0)return[];let i=t.xs[r];return Xe(e,i,t.plot.y+8)}function Je(e,n,t,r,i){if(!e.tooltip)return{lines:[],shapes:[]};if(e.hit?.crosshair){let{x:l,y:c}=ue(t,r,i,e.width,e.height);if(Ye(e.hit.plot,l,c)){let d=ge(e,l),h=qe(e,l);if(d&&h)return{lines:d.rows,shapes:[h]}}}let o=n?.closest?.("[data-skdx-part]"),a=e.tooltipFormatter?ee(e,n)?.item:void 0,s=a&&e.tooltipFormatter?.(a)||o&&Array.from(o.children).find(l=>l.tagName.toLowerCase()==="title")?.textContent;return s?{lines:Array.isArray(s)?s:[s],shapes:[]}:{lines:[],shapes:[]}}function ln(e,n,t,r,i,o,a){let s=e?.closest?.("[data-skdx-part]"),l=a&&a.tooltipFormatter?ee(a,e)?.item:void 0,c=l&&a?.tooltipFormatter?.(l)||s&&Array.from(s.children).find(b=>b.tagName.toLowerCase()==="title")?.textContent;if(!c)return[];let d=a?.tooltipAnchored?ee(a,e):void 0,h=d?a?.shapes[d.index]:void 0,{x:m,y:k}=h?ye(h):ue(n,t,r,i,o);return Ce(m,k,c,i,o,a?.tooltipPlacement)}function et(e,n,t,r,i){if(!e.tooltip)return[];if(e.hit?.crosshair){let{x:o,y:a}=ue(t,r,i,e.width,e.height),s=Xe(e,o,a);if(s.length>0)return s}return ln(n,t,r,i,e.width,e.height,e)}function tt(e,n){let t=ee(e,n);return t&&!t.item.legend?J(t.item):null}var Fn=(e,n)=>{let{x:t,y:r}=ye(e),i=e.kind==="circle"?e.cy:e.kind==="rect"?e.y+e.height/2:r;return t>=n.x&&t<=n.x+n.width&&i>=n.y&&i<=n.y+n.height};function nt(e,n){let t=new Set,r=[];for(let i of e.shapes){if(!i.item||i.item.legend||i.part==="anchor"||!Fn(i,n))continue;let o=J(i.item),a=JSON.stringify(o);t.has(a)||(t.add(a),r.push(o))}return r}var rt=e=>({kind:"rect",part:"selection-box",x:p(e.x),y:p(e.y),width:p(e.width),height:p(e.height),fill:S.focus,opacity:.12,stroke:S.focus}),Ae=(e,n,t,r)=>({x:Math.min(e,t),y:Math.min(n,r),width:Math.abs(t-e),height:Math.abs(r-n)});function cn(e,n,t){let r=!1;for(let i=0,o=e.length-1;i<e.length;o=i++){let a=e[i],s=e[o];a.y>t!=s.y>t&&n<(s.x-a.x)*(t-a.y)/(s.y-a.y)+a.x&&(r=!r)}return r}function it(e,n){if(n.length<3)return[];let t=new Set,r=[];for(let i of e.shapes){if(!i.item||i.item.legend||i.part==="anchor")continue;let{x:o,y:a}=ye(i),s=i.kind==="circle"?i.cy:i.kind==="rect"?i.y+i.height/2:a;if(!cn(n,o,s))continue;let l=J(i.item),c=JSON.stringify(l);t.has(c)||(t.add(c),r.push(l))}return r}var ot=e=>({kind:"path",part:"selection-lasso",d:e.length?`M${e.map(n=>`${p(n.x)} ${p(n.y)}`).join("L")}`:"",fill:S.focus,fillOpacity:.12,stroke:S.focus,dash:"4 3"}),Te=6;function at(e,n,t){let r=e.edit;if(r){for(let i of r.bars)if(!(t<i.y||t>i.y+i.height||n<i.x0-Te||n>i.x1+Te))return Math.abs(n-i.x0)<=Te?{bar:i,mode:"start"}:Math.abs(n-i.x1)<=Te?{bar:i,mode:"end"}:{bar:i,mode:"move"}}}function st(e,n,t){let r=e.edit;return un(r,n,r.invert(n.bar.x0+t)-r.invert(n.bar.x0))}function lt(e,n,t){let r=e.edit,i=t.key==="ArrowRight"?1:t.key==="ArrowLeft"?-1:0;if(!r||n===null||!i||!(t.shiftKey||t.altKey))return;let o=r.bars.find(l=>l.index===n);if(!o)return;let a=t.altKey?t.shiftKey?"start":"end":"move",s=r.snap??r.invert(o.x0+10)-r.invert(o.x0);return un(r,{bar:o,mode:a},i*s)}function un(e,{bar:n,mode:t},r){let i=s=>e.snap?Math.round(s/e.snap)*e.snap:s,o=n.start,a=n.end;return t==="move"?(o=i(n.start+r),a=o+(n.end-n.start)):t==="start"?o=Math.min(i(n.start+r),n.end):a=Math.max(i(n.end+r),n.start),{id:n.id,name:n.name,start:o,end:a}}function ct(e,n,t){let r=e.edit,i=r.scale(t.start),o=r.scale(t.end);return{kind:"rect",part:"edit-ghost",x:p(Math.min(i,o)),y:p(n.bar.y),width:p(Math.max(1,Math.abs(o-i))),height:p(n.bar.height),fill:S.focus,opacity:.25,stroke:S.focus,rx:2}}var Hn=64,jn=e=>Math.max(1,Math.min(Hn,e));function ut(e,n,t,r){let i=n>0?.8:1.25,o=jn(e.view.zoom*i);if(o===e.view.zoom)return e.view;let{plot:a,scale:s}=e,[l,c]=e.view.center,d=(t-(a.x+a.width/2))/s,h=(r-(a.y+a.height/2))/s,m=e.view.zoom/o;return{center:[l+d*(1-m),e.fromY(e.toY(c)-h*(1-m))],zoom:o}}function dt(e,n,t,r){let{scale:i}=e;return{center:[n.center[0]-t/i,e.fromY(e.toY(n.center[1])+r/i)],zoom:n.zoom}}function ee(e,n){let t=n?.closest?.("[data-skdx-i]"),r=Number(t?.getAttribute("data-skdx-i")),i=Number.isInteger(r)?e.shapes[r]?.item:void 0;return i?{index:r,item:i}:void 0}var ze=e=>e.shapes.flatMap((n,t)=>n.item&&!n.item.legend?[t]:[]);function ye(e){switch(e.kind){case"rect":return{x:e.x+e.width/2,y:e.y};case"circle":return{x:e.cx,y:e.cy-e.r};case"line":return{x:(e.x1+e.x2)/2,y:Math.min(e.y1,e.y2)};case"text":return{x:e.x,y:e.y};case"path":{let n=/M\s*(-?[\d.]+)[ ,](-?[\d.]+)/.exec(e.d);return n?{x:Number(n[1]),y:Number(n[2])}:{x:0,y:0}}}}function ht(e,n){let t=n===null?void 0:e.shapes[n];if(!t)return[];let r=S.focus,i;switch(t.kind){case"rect":i={kind:"rect",part:"focus",x:t.x-2,y:t.y-2,width:t.width+4,height:t.height+4,fill:"none",stroke:r,rx:2};break;case"circle":i={kind:"circle",part:"focus",cx:t.cx,cy:t.cy,r:t.r+3,fill:"none",stroke:r};break;case"line":i={kind:"line",part:"focus",x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:r,strokeWidth:4};break;case"text":i={kind:"rect",part:"focus",x:t.x-2,y:t.y-8,width:t.text.length*Y+4,height:16,fill:"none",stroke:r,rx:2};break;case"path":i={kind:"path",part:"focus",d:t.d,stroke:r,strokeWidth:2,fill:"none"};break}let{x:o,y:a}=ye(t),s=t.item&&e.tooltipFormatter?.(t.item)||(t.item?.label??t.title??"");return[i,...s?Ce(p(o),p(a),s,e.width,e.height):[]]}function pt(e,n,t){let r=ze(e);if(r.length===0)return;let i=n===null?-1:r.indexOf(n);switch(t){case"ArrowRight":case"ArrowDown":return r[Math.min(r.length-1,i+1)];case"ArrowLeft":case"ArrowUp":return r[Math.max(0,i<=0?0:i-1)];case"Home":return r[0];case"End":return r[r.length-1];case"Escape":return null;default:return}}var le=2,ce=(e,n,t)=>{let r=Math.max(le,Math.min(t,Math.round(n))),i=Math.max(0,Math.min(t-r,Math.round(e)));return{start:i,end:i+r}},dn=(e,n)=>!e||e.start<=0&&e.end>=n;function ft(e,n,t){if(e.count<=le||!e.plot.width)return;let{start:r,end:i}=e.zoom,o=i-r,a=n>0?1.25:.8,s=Math.max(le,Math.min(e.count,Math.round(o*a)));if(s===o)return n>0&&!dn(e.zoom,e.count)?ce(r,s,e.count):void 0;let l=Math.max(0,Math.min(1,(t-e.plot.x)/e.plot.width)),c=r+l*o;return ce(c-l*s,s,e.count)}function mt(e,n,t,r){let i=n.end-n.start,o=Math.max(le,Math.min(e.count,Math.round(i/Math.max(.05,t)))),a=Math.max(0,Math.min(1,(r-e.plot.x)/Math.max(1,e.plot.width)));return ce(n.start+a*i-a*o,o,e.count)}function xt(e,n,t){let r=n.end-n.start,i=e.plot.width/Math.max(1,r);return ce(n.start-t/i,r,e.count)}function bt(e,n,t){let r=e.brush;if(!r||!Ye(r.box,n,t))return;let i=r.window;if(Math.abs(n-i.x)<=6)return{grab:"left",zoom:e.zoom};if(Math.abs(n-(i.x+i.width))<=6)return{grab:"right",zoom:e.zoom};if(n>i.x&&n<i.x+i.width)return{grab:"move",zoom:e.zoom};let o=e.zoom.end-e.zoom.start,a=(n-r.box.x)/Math.max(1,r.box.width)*e.count;return{grab:"move",zoom:ce(a-o/2,o,e.count)}}function gt(e,n,t,r){let i=e.brush;if(!i)return t;let o=r/Math.max(1,i.box.width)*e.count;if(n==="move")return ce(t.start+o,t.end-t.start,e.count);if(n==="left")return{start:Math.max(0,Math.min(t.end-le,Math.round(t.start+o))),end:t.end};let a=Math.min(e.count,Math.max(t.start+le,Math.round(t.end+o)));return{start:t.start,end:a}}function vt(e,n){switch(n.type){case"svg":return Promise.resolve(yt(e,n.label,n.resolve));case"csv":return Promise.resolve(mn(n.rows));case"png":{if(typeof document>"u"||typeof Image>"u")return Promise.reject(new Error("PNG export needs a browser"));let t=yt(e,n.label,n.resolve);return fn(t,e.width,e.height,n.scale,n.background)}}}var X=e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/"/g,"""),ve=e=>e.filter(([,n])=>n!==void 0&&n!=="").map(([n,t])=>` ${n}="${X(String(t))}"`).join("");function hn(e){let n=e.title?`<title>${X(e.title)}</title>`:"",t=["data-skdx-part",e.part];switch(e.kind){case"path":return`<path${ve([t,["d",e.d],["fill",e.fill??"none"],["stroke",e.stroke],["stroke-width",e.strokeWidth],["stroke-linecap",e.strokeLinecap],["stroke-linejoin",e.strokeLinejoin],["stroke-dasharray",e.dash],["opacity",e.opacity],["fill-opacity",e.fillOpacity]])}>${n}</path>`;case"rect":return`<rect${ve([t,["x",e.x],["y",e.y],["width",e.width],["height",e.height],["rx",e.rx],["fill",e.fill],["stroke",e.stroke],["fill-opacity",e.opacity]])}>${n}</rect>`;case"line":return`<line${ve([t,["x1",e.x1],["y1",e.y1],["x2",e.x2],["y2",e.y2],["stroke",e.stroke],["stroke-width",e.strokeWidth],["stroke-dasharray",e.dash],["opacity",e.opacity]])}>${n}</line>`;case"circle":return`<circle${ve([t,["cx",e.cx],["cy",e.cy],["r",e.r],["fill",e.fill],["stroke",e.stroke]])}>${n}</circle>`;case"text":return`<text${ve([t,["x",e.x],["y",e.y],["text-anchor",e.anchor],["dominant-baseline",e.baseline],["fill",e.fill],["font-weight",e.weight],["transform",e.rotate?`rotate(${e.rotate} ${e.x} ${e.y})`:void 0]])}>${X(e.text)}</text>`}}function pn(e){let n=e.defs??[];return n.length===0?"":`<defs>${n.map(t=>`<linearGradient id="${X(t.id)}" x1="0" y1="0" x2="${t.vertical===!1?1:0}" y2="${t.vertical===!1?0:1}">${t.stops.map(r=>`<stop offset="${r.offset}" stop-color="${X(r.color)}"${r.opacity===void 0?"":` stop-opacity="${r.opacity}"`}/>`).join("")}</linearGradient>`).join("")}</defs>`}function yt(e,n,t){let r=pn(e)+e.shapes.map(hn).join("");return t&&(r=r.replace(/var\((--[\w-]+)\)/g,(i,o)=>t(o).trim()||i)),`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${e.width} ${e.height}" width="${e.width}" height="${e.height}" role="img" aria-label="${X(n)}" font-family="${X(S.fontFamily)}" font-size="${X(S.fontSize)}"><title>${X(n)}</title>${r}</svg>`}function fn(e,n,t,r=2,i){return new Promise((o,a)=>{let s=URL.createObjectURL(new Blob([e],{type:"image/svg+xml;charset=utf-8"})),l=new Image;l.onload=()=>{URL.revokeObjectURL(s);let c=document.createElement("canvas");c.width=Math.round(n*r),c.height=Math.round(t*r);let d=c.getContext("2d");if(!d)return a(new Error("canvas 2d context unavailable"));i&&(d.fillStyle=i,d.fillRect(0,0,c.width,c.height)),d.drawImage(l,0,0,c.width,c.height),c.toBlob(h=>h?o(h):a(new Error("toBlob failed")),"image/png")},l.onerror=()=>{URL.revokeObjectURL(s),a(new Error("svg could not be decoded"))},l.src=s})}function mn(e){let n=t=>{let r=t==null?"":String(t);return/[",\n\r]/.test(r)?`"${r.replace(/"/g,'""')}"`:r};return e.map(t=>t.map(n).join(",")).join(`\r
|
|
2
|
+
`)}function wt(e,n){if(!n)return;let t=typeof n=="object"?n.maxRows??500:500,r=e.hit;if(r&&r.rows.length>0){let s=r.rows[0];if(r.rows.length>t)return;let l=["",...s.slice(1).map(d=>d.replace(/:\s[^:]*$/,""))],c=r.rows.map(d=>[d[0],...d.slice(1).map(h=>h.slice(h.lastIndexOf(": ")+2))]);return[l,...c]}let i=e.shapes.flatMap(s=>s.item&&!s.item.legend&&!(s.part==="anchor"&&!s.title)?[s.item]:[]);if(i.length===0||i.length>t)return;let o=["series","name","category","value"].filter(s=>i.some(l=>l[s]!==void 0)),a=(s,l)=>s[l]===void 0?"":String(s[l]);return[o.map(s=>s[0]?.toUpperCase()+s.slice(1)),...i.map(s=>o.map(l=>a(s,l)))]}var kt=new Map;function Oe(e){let n=kt.get(e);if(n)return n.group;let t=new Set,r={},i={current:r,subscribe(o){return t.add(o),()=>{t.delete(o),t.size===0&&kt.delete(e)}},publish(o,a){Object.assign(r,o);for(let s of t)s(o,a)}};return kt.set(e,{group:i,listeners:t}),i}var xn='[data-skdx-part]:not([data-skdx-part^="tooltip"]):not([data-skdx-part="focus"]):not([data-skdx-part="crosshair"])',Mt=`@keyframes skdx-in{from{opacity:0}to{opacity:1}}${xn}{animation:skdx-in var(--skdx-chart-duration,0ms) ease-out;transition:${["x","y","width","height","cx","cy","r","opacity","fill-opacity","d"].map(e=>`${e} var(--skdx-chart-duration,0ms) ease-out`).join(",")}}@media (prefers-reduced-motion:reduce){${xn}{animation:none;transition:none}}`;function $t(e){let n=e.animate;return n&&e.shapes.length<=1500?`${n}ms`:void 0}var _n=.22,En=20,bn=32,gn=28,Zn=e=>F(e.open)&&F(e.high)&&F(e.low)&&F(e.close);function St(e){let n=[],t=e.data.filter(u=>Zn(u)?!0:(n.push({code:"invalid-value",severity:"warning",message:`Candle "${String(u.label)}" has a non-finite open/high/low/close and was dropped.`,itemId:u.id}),!1)),r=Yt(e,t.length===0);if(r)return{...r,issues:n};let i=e.upColor??S.positive,o=e.downColor??S.negative,a=re(e.format),s=t.length,l=Math.max(0,Math.min(s-2,Math.floor(e.zoom?.start??0))),c=e.zoom?Math.max(l+2,Math.min(s,Math.ceil(e.zoom.end))):s,d={start:l,end:c},h=t.slice(l,c),m=t.some(u=>F(u.volume)),{width:k,height:b}=Se(e),f=e.brush?bn+gn:0,y=e.rangeSelector??[],v=e.compare?h[0].close:void 0,w=u=>v!==void 0&&v!==0?u/v-1:u,L=v!==void 0?{style:"percent",digits:1}:void 0,V=re({style:"percent",digits:1}),E=t.map(u=>u.close),N=(e.overlays??[]).map((u,M)=>{let I=u.name??`${u.type.toUpperCase()} ${u.period}`,z=u.type==="ema"?on(E,u.period):rn(E,u.period);return{name:I,color:u.color??jt(e,M+2),values:z.slice(l,c),hidden:_t(e,I)}}),we=Zt([...h.flatMap(u=>[w(u.low),w(u.high)]),...N.filter(u=>!u.hidden).flatMap(u=>u.values.map(M=>F(M)?w(M):M))],!1),W=Dt(k,b,{...ie,top:ie.top+Ht(e)+(y.length?En:0),bottom:ie.bottom+f,left:e.scale==="log"?ie.left:Ut(we,re(L??e.format))}),de=m?W.height*_n:0,P={...W,height:Math.max(0,W.height-de-(m?8:0))},G=Wt(we,[P.y+P.height,P.y],{scale:e.scale==="log"?"log":"linear",format:L},e.format),te=h.map(u=>Me(u.label)),yn=e.xAxis?.type==="time"&&te.every(u=>Number.isFinite(u)),Z=Lt(h.length,[P.x,P.x+P.width]),Ct;if(yn){let u=[...te].sort((R,Pe)=>R-Pe),M=1/0;for(let R=1;R<u.length;R++)M=Math.min(M,u[R]-u[R-1]);let[I,z]=ae(te),O=M===1/0?Math.max(1,Math.abs(z)*.05||1):M/2,D=oe([I-O,z+O],[P.x,P.x+P.width]),j=Math.abs(D(I+(M===1/0?O:M))-D(I))*.8;Z={step:j,bandwidth:j,start:R=>D(te[R])-j/2,center:R=>D(te[R])};let K=e.xAxis?.format??{style:"date"};Ct=Bt(I-O,z+O).filter(R=>R>=I-O&&R<=z+O).map(R=>({pos:p(D(R)),label:Ve(R,K)}))}let ne=h.map(u=>Ve(u.label,e.xAxis?.format)),vn=[{name:"Up",color:i},{name:"Down",color:o},...N.map(u=>({name:u.name,color:u.color}))],Re=je(e,k,b,vn),wn={...Re,plot:P,xTicks:Kt(Ct??h.map((u,M)=>({pos:p(Z.center(M)),label:ne[M]})),P.width),yTicks:G.ticks,baseline:P.y+P.height},U=Xt(wn),Be={plot:P,x:u=>{let M=typeof u=="string"?u:Me(u),I=h.findIndex((z,O)=>typeof M=="string"?ne[O]===M||z.label===M:Me(z.label)===M);return I<0?void 0:Z.center(I)},y:u=>G.scale(w(u))};U.push(...Ee(e.references,Be)),y.forEach((u,M)=>{let I=u.candles>0?{start:Math.max(0,s-u.candles),end:s}:{start:0,end:s},z=I.start===l&&I.end===c;U.push(B(p(P.x+M*40),p(W.y-8),u.label,{part:"range-button",baseline:"middle",fill:z?"var(--skdx-color-text-default)":S.label,weight:z?"bold":void 0,title:`${u.label}: last ${u.candles>0?Math.min(u.candles,s):s} candles`,item:{label:u.label,name:u.label,range:I}}))});let kn=e.variant==="ohlc",It=[];if(h.forEach((u,M)=>{let z=u.close>=u.open?i:o,O=p(Z.center(M)),D=v!==void 0?` (${V(w(u.close))})`:"",j=`${ne[M]}: O ${a(u.open)} H ${a(u.high)} L ${a(u.low)} C ${a(u.close)}${D}${F(u.volume)?` V ${a(u.volume)}`:""}`,K={label:j,id:u.id,category:ne[M],index:l+M,value:u.close};It.push([ne[M],`Open: ${a(u.open)}`,`High: ${a(u.high)}`,`Low: ${a(u.low)}`,`Close: ${a(u.close)}${D}`,...F(u.volume)?[`Volume: ${a(u.volume)}`]:[],...N.filter(Q=>!Q.hidden).map(Q=>`${Q.name}: ${F(Q.values[M])?a(Q.values[M]):"\u2014"}`)]);let R=G.scale(w(Math.max(u.open,u.close))),Pe=G.scale(w(Math.min(u.open,u.close)));if(kn){let Q=Z.bandwidth/2;U.push({kind:"line",part:"wick",x1:O,x2:O,y1:p(G.scale(w(u.high))),y2:p(G.scale(w(u.low))),stroke:z,strokeWidth:1.5,title:j,item:K},{kind:"line",part:"open",x1:p(O-Q),x2:O,y1:p(G.scale(w(u.open))),y2:p(G.scale(w(u.open))),stroke:z,strokeWidth:1.5},{kind:"line",part:"close",x1:O,x2:p(O+Q),y1:p(G.scale(w(u.close))),y2:p(G.scale(w(u.close))),stroke:z,strokeWidth:1.5})}else U.push({kind:"line",part:"wick",x1:O,x2:O,y1:p(G.scale(w(u.high))),y2:p(G.scale(w(u.low))),stroke:z,title:j},{kind:"rect",part:"candle",x:p(Z.start(M)),y:p(R),width:p(Z.bandwidth),height:p(Math.max(1,Pe-R)),fill:z,title:j,item:K})}),m){let u=P.y+P.height+8,[,M]=ae(h.map(I=>I.volume));h.forEach((I,z)=>{if(!F(I.volume))return;let O=M>0?I.volume/M*de:0;U.push({kind:"rect",part:"volume",x:p(Z.start(z)),y:p(u+de-O),width:p(Z.bandwidth),height:p(Math.max(O,0)),fill:I.close>=I.open?i:o,opacity:.4,title:`${ne[z]}: volume ${a(I.volume)}`})})}for(let u of N){if(u.hidden)continue;let M=u.values.flatMap((I,z)=>F(I)?[{x:p(Z.center(z)),y:p(G.scale(w(I)))}]:[]);M.length<2||U.push({kind:"path",part:"overlay",d:Ne(M),stroke:u.color,strokeWidth:1.5,strokeLinejoin:"round",title:u.name,item:{label:u.name,series:u.name}})}for(let u of e.flags??[]){let M=Be.x(u.label);if(M===void 0)continue;let I=h.findIndex((j,K)=>Z.center(K)===M),z=h[I],O=G.scale(w(z.high))-6,D=se(u.variant??"primary");U.push({kind:"path",part:"flag",d:`M${p(M)} ${p(O)}V${p(O-10)}H${p(M+8)}L${p(M+5)} ${p(O-7)}L${p(M+8)} ${p(O-4)}H${p(M)}Z`,fill:D,stroke:D,title:u.text,item:{label:u.text,name:u.text,category:ne[I],index:l+I}})}U.push(...nn(e.annotations,Be));let Tt={plot:W,xs:h.map((u,M)=>p(Z.center(M))),rows:It,count:s,zoom:d,crosshair:Gt(e)};if(e.brush){let u={x:W.x,y:W.y+W.height+gn,width:W.width,height:bn},M=t.map(K=>K.close),[I,z]=ae(M),O=s>1?u.width/(s-1):0,D=M.map((K,R)=>({x:p(u.x+R*O),y:p(u.y+u.height-(z===I?.5:(K-I)/(z-I))*(u.height-4)-2)})),j={x:p(u.x+l/s*u.width),y:u.y,width:p((c-l)/s*u.width),height:u.height};U.push({kind:"rect",part:"brush",...u,fill:"var(--skdx-color-surface-sunken)",stroke:S.grid},{kind:"path",part:"brush-series",d:D.length>1?`${Ne(D)}L${D[D.length-1]?.x} ${u.y+u.height}L${D[0]?.x} ${u.y+u.height}Z`:"",fill:"var(--skdx-color-primary-500)",fillOpacity:.3},{kind:"rect",part:"brush-window",...j,fill:"var(--skdx-color-primary-500)",opacity:.15,stroke:S.axis},{kind:"rect",part:"brush-handle",x:p(j.x-3),y:u.y+8,width:6,height:u.height-16,fill:S.axis,rx:2},{kind:"rect",part:"brush-handle",x:p(j.x+j.width-3),y:u.y+8,width:6,height:u.height-16,fill:S.axis,rx:2}),Tt.brush={box:u,window:j}}return{...Re,shapes:[...U,...Re.shapes],hit:Tt,issues:n}}var $=require("lit"),g=require("lit/decorators.js"),T=require("lit/directives/if-defined.js");var Wn={fromAttribute:()=>!1},C=class extends $.LitElement{constructor(){super(...arguments);this.legend=!1;this.tooltip=!0;this.selectionMode="none";this.loading=!1;this.decorative=!1;this.accessibleTable=!1;this.zoomable=!1;this.editable=!1;this.crossFilter=!1;this.animated=!1;this.responsive=!1;this.tip=[];this.overlay=[];this.portal=null;this.highlightState=null;this.crossState=null;this.lastCross=null;this.pointers=new Map;this.hover=null;this.token={};this.focused=null;this.hiddenState=[];this.drag=null;this.onPointerMove=t=>{let r=this.layout;if(!r)return;this.pointers.has(t.pointerId)&&this.pointers.set(t.pointerId,this.viewBox(t,r).x);let i=this.drag;if(i?.grab==="select"){let{x:o,y:a}=this.viewBox(t,r);this.overlay=[rt(Ae(i.x,i.y,o,a))];return}if(i?.grab==="lasso"){let{x:o,y:a}=this.viewBox(t,r);i.points=[...i.points??[],{x:o,y:a}],this.overlay=[ot(i.points)];return}if(i?.grab==="edit"){if(!i.gantt)return;let{x:o}=this.viewBox(t,r);i.change=st(r,i.gantt,o-i.x),this.overlay=[ct(r,i.gantt,i.change)];return}if(i?.grab==="map"){if(!r.map||!i.view)return;let{x:o,y:a}=this.viewBox(t,r);this.setView(dt(r.map,i.view,o-i.x,a-i.y));return}if(i&&r.hit){if(i.grab==="pinch"){let[a,s]=[...this.pointers.values()];if(a===void 0||s===void 0||!i.distance)return;this.setZoom(mt(r.hit,i.zoom,Math.abs(a-s)/i.distance,(a+s)/2));return}let{x:o}=this.viewBox(t,r);this.setZoom(i.grab==="pan"?xt(r.hit,i.zoom,o-i.x):gt(r.hit,i.grab,i.zoom,o-i.x));return}if(r.tooltipPortal){let{lines:o,shapes:a}=Je(r,t.target,t.currentTarget,t.clientX,t.clientY);this.tip=a,this.portal=o.length?{x:t.clientX,y:t.clientY,lines:o}:null}else{let o=et(r,t.target,t.currentTarget,t.clientX,t.clientY);(o.length>0||this.tip.length>0)&&(this.tip=o)}if(this.highlight(tt(r,t.target)),this.syncId&&r.hit?.crosshair){let o=ge(r,this.viewBox(t,r).x);this.shareCrosshair(o?r.hit.rows[o.index]?.[0]??null:null)}};this.onPointerDown=t=>{let r=this.layout;if(!r||t.button!==0)return;let{x:i,y:o}=this.viewBox(t,r),a=ee(r,t.target)?.item.legend,s=this.canEdit(r)?at(r,i,o):void 0;if(s){this.drag={x:i,y:o,zoom:{start:0,end:0},grab:"edit",gantt:s},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}if(this.brushing()&&!a){this.drag={x:i,y:o,zoom:{start:0,end:0},grab:this.selectionMode==="lasso"?"lasso":"select",points:[{x:i,y:o}]},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}if(this.canPan(r)&&r.map){let c=r.map.plot;if(i<c.x||i>c.x+c.width||o<c.y||o>c.y+c.height)return;this.drag={x:i,y:o,zoom:{start:0,end:0},grab:"map",view:r.map.view},t.currentTarget.setPointerCapture(t.pointerId),this.clearTip();return}let l=r.hit;if(!(!l||!this.canZoom(r))){if(this.pointers.set(t.pointerId,i),this.pointers.size===2){let[c,d]=[...this.pointers.values()];this.drag={x:(c+d)/2,y:o,zoom:l.zoom,grab:"pinch",distance:Math.abs(c-d)||1}}else{let c=bt(l,i,o);if(c)this.drag={x:i,y:o,zoom:c.zoom,grab:c.grab},c.zoom!==l.zoom&&this.setZoom(c.zoom);else if(this.zoomable&&i>=l.plot.x&&i<=l.plot.x+l.plot.width&&o>=l.plot.y&&o<=l.plot.y+l.plot.height)this.drag={x:i,y:o,zoom:l.zoom,grab:"pan"};else{this.pointers.delete(t.pointerId);return}}t.currentTarget.setPointerCapture(t.pointerId),this.clearTip()}};this.onPointerUp=t=>{this.pointers.delete(t.pointerId);let r=t.currentTarget;r.hasPointerCapture(t.pointerId)&&r.releasePointerCapture(t.pointerId);let i=this.drag,o=this.layout;if(o&&(i?.grab==="select"||i?.grab==="lasso"||i?.grab==="edit"||i?.grab==="map")){this.overlay=[];let{x:a,y:s}=this.viewBox(t,o);if(Math.abs(a-i.x)>2||Math.abs(s-i.y)>2){i.grab==="select"?this.setSelected(nt(o,Ae(i.x,i.y,a,s))):i.grab==="lasso"?this.setSelected(it(o,i.points??[])):i.grab==="edit"&&i.change&&this.emit("skdx-task-change",i.change),this.drag={...i,distance:-1};return}this.drag=null;return}(this.pointers.size===0||this.drag?.grab==="pinch")&&(this.drag=null)};this.onWheel=t=>{let r=this.layout;if(!r)return;let{x:i,y:o}=this.viewBox(t,r);if(r.map&&this.canPan(r)){let l=r.map.plot;if(i<l.x||i>l.x+l.width||o<l.y||o>l.y+l.height)return;t.preventDefault(),this.setView(ut(r.map,t.deltaY,i,o));return}let a=r.hit;if(!a||!this.canZoom(r)||o<a.plot.y||o>a.plot.y+a.plot.height)return;let s=ft(a,t.deltaY,i);s&&(t.preventDefault(),this.setZoom(s))};this.onClick=t=>{if(!this.layout)return;if(this.drag?.distance===-1){this.drag=null;return}let r=ee(this.layout,t.target);r&&(r.item.range?this.setZoom(r.item.range):r.item.legend&&r.item.series!==void 0?this.toggle(r.item.series):(this.select(r.item),this.emit("skdx-item-click",r.item)))};this.onKeyDown=t=>{let r=this.layout;if(!r)return;if((t.key==="Enter"||t.key===" ")&&this.focused!==null){let s=r.shapes[this.focused]?.item;s&&(t.preventDefault(),this.select(s),this.emit("skdx-item-click",s));return}let i=this.canEdit(r)?lt(r,this.focused,t):void 0;if(i){t.preventDefault(),this.emit("skdx-task-change",i);return}let o=pt(r,this.focused,t.key);if(o===void 0)return;t.preventDefault(),this.focused=o;let a=o===null?void 0:r.shapes[o]?.item;this.highlight(a?J(a):null)}}connectedCallback(){super.connectedCallback(),!(typeof ResizeObserver>"u")&&(this.observer=new ResizeObserver(([t])=>{let r=Math.floor(t?.contentRect.width??0);r>0&&(this.measured=r)}),this.observer.observe(this))}disconnectedCallback(){this.observer?.disconnect(),this.leave?.(),this.leave=void 0,this.joined=void 0,super.disconnectedCallback()}sized(){let{width:t,height:r,legend:i,tooltip:o,format:a,palette:s,loading:l,error:c,emptyMessage:d,description:h,decorative:m,animated:k,responsive:b,highlighted:f,highlightScope:y,accessibleTable:v}=this;return{...typeof b=="object"&&this.measured!==void 0&&this.measured<(b.breakpoint??480)?b.compact:void 0,width:b&&this.measured?this.measured:t,height:r,animate:k,responsive:b,legend:i,tooltip:o,format:a,palette:s,loading:l,error:c,emptyMessage:d,description:h,decorative:m,highlighted:f===void 0?this.highlightState:f,highlightScope:y,accessibleTable:v,hiddenSeries:this.hiddenSeries??this.hiddenState,zoom:this.zoom??this.zoomState,selected:this.selected??this.selectedState,view:this.view??this.viewState}}emit(t,r){this.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!0,composed:!0}))}publish(t){this.syncId&&Oe(this.syncId).publish(t,this.token)}join(){if(this.joined===this.syncId||(this.leave?.(),this.leave=void 0,this.joined=this.syncId,!this.syncId))return;let t=Oe(this.syncId),r=i=>{"highlighted"in i&&(this.highlightState=i.highlighted??null),i.selected&&(this.selectedState=i.selected,this.crossFilter&&(this.highlightState=i.selected.length?i.selected:null)),"zoom"in i&&(this.zoomState=i.zoom),i.hiddenSeries&&(this.hiddenState=i.hiddenSeries),"crosshair"in i&&(this.crossState=i.crosshair??null)};r(t.current),this.leave=t.subscribe((i,o)=>{o!==this.token&&r(i)})}setZoom(t){this.zoomState=t,this.emit("skdx-zoom-change",t),this.publish({zoom:t})}setView(t){this.viewState=t,this.emit("skdx-view-change",t)}setSelected(t){this.selectedState=t,this.emit("skdx-selected-change",t),this.publish({selected:t})}toggle(t){let r=this.hiddenSeries??this.hiddenState,i=r.includes(t)?r.filter(o=>o!==t):[...r,t];this.hiddenState=i,this.emit("skdx-hidden-series-change",i),this.publish({hiddenSeries:i})}highlight(t){let r=this.hover;r===t||r&&t&&We(r,t)||(this.hover=t,this.emit("skdx-highlighted-change",t),this.syncId&&(this.highlightState=t,this.publish({highlighted:t})))}select(t){let r=this.selectionMode;r!=="none"&&this.setSelected(Ue(this.selected??this.selectedState,t,r==="single"?"single":"multiple"))}shareCrosshair(t){!this.syncId||this.lastCross===t||(this.lastCross=t,this.publish({crosshair:t}))}clearTip(){this.tip=[],this.portal=null,this.shareCrosshair(null)}canZoom(t){return!!(t.hit&&(this.zoomable||t.hit.brush))}canPan(t){return!!(t.map&&this.zoomable)}canEdit(t){return!!(this.editable&&t.edit)}brushing(){return this.selectionMode==="brush"||this.selectionMode==="lasso"}viewBox(t,r){return ue(t.currentTarget,t.clientX,t.clientY,r.width,r.height)}getSvgElement(){return this.renderRoot.querySelector("svg")}getLayout(){return this.layout}resetZoom(){this.setZoom(void 0)}zoomTo(t){this.setZoom(t)}focusItem(t){let r=this.layout;if(!r)return!1;let i=r.shapes.findIndex(o=>o.item&&!o.item.legend&&q(o.item,t));return i<0?!1:(this.getSvgElement()?.focus(),this.focused=i,!0)}export(t){let r=this.layout;return r?vt(r,{...t,label:t.label??this.label??this.localName}):Promise.reject(new Error("not rendered yet"))}root(t,r,i){this.join();let o=Ke(_e(t),this.sized());if(this.layout=o,o.issues!==this.reported){this.reported=o.issues;for(let v of o.issues??[])this.emit("skdx-data-issue",v)}let a=this.canZoom(o),s=this.canPan(o),l=this.canEdit(o),c=this.brushing(),d=a||s||l||c,h=!o.decorative&&ze(o).length>0,m=o.description?`${r}-desc`:void 0,k=$t(o),b=wt(o,this.accessibleTable),f=typeof this.accessibleTable=="object"&&this.accessibleTable.caption||i,y=this.portal;return $.html`<svg
|
|
3
3
|
xmlns="http://www.w3.org/2000/svg"
|
|
4
4
|
viewBox="0 0 ${o.width} ${o.height}"
|
|
5
5
|
width=${o.width}
|
|
6
6
|
height=${o.height}
|
|
7
7
|
role=${o.decorative?"presentation":"img"}
|
|
8
|
-
aria-hidden=${o.decorative?"true"
|
|
9
|
-
aria-label=${o.decorative
|
|
10
|
-
aria-describedby=${(0,
|
|
11
|
-
tabindex=${h?0
|
|
8
|
+
aria-hidden=${o.decorative?"true":$.nothing}
|
|
9
|
+
aria-label=${o.decorative?$.nothing:i}
|
|
10
|
+
aria-describedby=${(0,T.ifDefined)(m)}
|
|
11
|
+
tabindex=${h?0:$.nothing}
|
|
12
12
|
data-skdx-chart=${r}
|
|
13
|
-
data-zoomable=${a||s?""
|
|
14
|
-
data-brushing=${c&&!(a||s)?""
|
|
15
|
-
data-editable=${l?""
|
|
16
|
-
style=${
|
|
17
|
-
font-family=${
|
|
18
|
-
font-size=${
|
|
19
|
-
@pointermove=${o.tooltip||d?this.onPointerMove
|
|
13
|
+
data-zoomable=${a||s?"":$.nothing}
|
|
14
|
+
data-brushing=${c&&!(a||s)?"":$.nothing}
|
|
15
|
+
data-editable=${l?"":$.nothing}
|
|
16
|
+
style=${k?`--skdx-chart-duration:${k}`:$.nothing}
|
|
17
|
+
font-family=${S.fontFamily}
|
|
18
|
+
font-size=${S.fontSize}
|
|
19
|
+
@pointermove=${o.tooltip||d?this.onPointerMove:$.nothing}
|
|
20
20
|
@pointerleave=${()=>{this.clearTip(),this.highlight(null)}}
|
|
21
|
-
@pointerdown=${d?this.onPointerDown
|
|
22
|
-
@pointerup=${d?this.onPointerUp
|
|
23
|
-
@pointercancel=${d?this.onPointerUp
|
|
24
|
-
@wheel=${a||s?this.onWheel
|
|
25
|
-
@dblclick=${a||s?()=>s?this.setView(void 0):this.setZoom(void 0)
|
|
21
|
+
@pointerdown=${d?this.onPointerDown:$.nothing}
|
|
22
|
+
@pointerup=${d?this.onPointerUp:$.nothing}
|
|
23
|
+
@pointercancel=${d?this.onPointerUp:$.nothing}
|
|
24
|
+
@wheel=${a||s?this.onWheel:$.nothing}
|
|
25
|
+
@dblclick=${a||s?()=>s?this.setView(void 0):this.setZoom(void 0):$.nothing}
|
|
26
26
|
@click=${this.onClick}
|
|
27
|
-
@keydown=${h?this.onKeyDown
|
|
27
|
+
@keydown=${h?this.onKeyDown:$.nothing}
|
|
28
28
|
@blur=${()=>{this.focused=null,this.highlight(null)}}
|
|
29
29
|
>
|
|
30
30
|
<title>${i}</title>
|
|
31
|
-
${o.description
|
|
32
|
-
${
|
|
33
|
-
${
|
|
34
|
-
${
|
|
35
|
-
${
|
|
31
|
+
${o.description?$.svg`<desc id=${(0,T.ifDefined)(m)}>${o.description}</desc>`:$.nothing}
|
|
32
|
+
${k?$.svg`<style>${Mt}</style>`:$.nothing} ${Un(o)}
|
|
33
|
+
${Le(o.shapes)}
|
|
34
|
+
${Le(this.tip.length||!this.crossState?this.tip:Qe(o,this.crossState))}
|
|
35
|
+
${Le(ht(o,this.focused))} ${Le(this.overlay)}
|
|
36
36
|
</svg>
|
|
37
|
-
${
|
|
37
|
+
${y?$.html`<div
|
|
38
38
|
role="tooltip"
|
|
39
39
|
data-skdx-tooltip=${r}
|
|
40
|
-
style="left:${
|
|
40
|
+
style="left:${y.x+12}px;top:${y.y+12}px"
|
|
41
41
|
>
|
|
42
|
-
${
|
|
43
|
-
</div
|
|
44
|
-
${
|
|
42
|
+
${y.lines.map(v=>$.html`<div>${v}</div>`)}
|
|
43
|
+
</div>`:$.nothing}
|
|
44
|
+
${b?$.html`<table data-skdx-table=${r}>
|
|
45
45
|
<caption>
|
|
46
46
|
${f}
|
|
47
47
|
</caption>
|
|
48
48
|
<thead>
|
|
49
49
|
<tr>
|
|
50
|
-
${(
|
|
50
|
+
${(b[0]??[]).map(v=>$.html`<th scope="col">${v}</th>`)}
|
|
51
51
|
</tr>
|
|
52
52
|
</thead>
|
|
53
53
|
<tbody>
|
|
54
|
-
${
|
|
55
|
-
${
|
|
54
|
+
${b.slice(1).map(v=>$.html`<tr>
|
|
55
|
+
${v.map((w,L)=>L===0?$.html`<th scope="row">${w}</th>`:$.html`<td>${w}</td>`)}
|
|
56
56
|
</tr>`)}
|
|
57
57
|
</tbody>
|
|
58
|
-
</table
|
|
58
|
+
</table>`:$.nothing}`}};C.styles=$.css`
|
|
59
59
|
:host {
|
|
60
60
|
display: inline-block;
|
|
61
61
|
}
|
|
@@ -106,4 +106,4 @@
|
|
|
106
106
|
[role='tooltip'] > :first-child:not(:only-child) {
|
|
107
107
|
font-weight: bold;
|
|
108
108
|
}
|
|
109
|
-
`,x([(0,g.property)({type:Number})],
|
|
109
|
+
`,x([(0,g.property)({type:Number})],C.prototype,"width",2),x([(0,g.property)({type:Number})],C.prototype,"height",2),x([(0,g.property)()],C.prototype,"label",2),x([(0,g.property)({type:Boolean,reflect:!0})],C.prototype,"legend",2),x([(0,g.property)({type:Boolean,attribute:"no-tooltip",converter:Wn})],C.prototype,"tooltip",2),x([(0,g.property)({attribute:!1})],C.prototype,"format",2),x([(0,g.property)({attribute:!1})],C.prototype,"palette",2),x([(0,g.property)({attribute:!1})],C.prototype,"hiddenSeries",2),x([(0,g.property)({attribute:!1})],C.prototype,"selected",2),x([(0,g.property)({attribute:"selection-mode"})],C.prototype,"selectionMode",2),x([(0,g.property)({attribute:!1})],C.prototype,"highlighted",2),x([(0,g.property)({attribute:!1})],C.prototype,"highlightScope",2),x([(0,g.property)({type:Boolean,reflect:!0})],C.prototype,"loading",2),x([(0,g.property)()],C.prototype,"error",2),x([(0,g.property)({attribute:"empty-message"})],C.prototype,"emptyMessage",2),x([(0,g.property)()],C.prototype,"description",2),x([(0,g.property)({type:Boolean,reflect:!0})],C.prototype,"decorative",2),x([(0,g.property)({type:Boolean,attribute:"accessible-table"})],C.prototype,"accessibleTable",2),x([(0,g.property)({attribute:!1})],C.prototype,"zoom",2),x([(0,g.property)({attribute:!1})],C.prototype,"view",2),x([(0,g.property)({type:Boolean,reflect:!0})],C.prototype,"zoomable",2),x([(0,g.property)({type:Boolean,reflect:!0})],C.prototype,"editable",2),x([(0,g.property)({attribute:"sync-id"})],C.prototype,"syncId",2),x([(0,g.property)({type:Boolean,attribute:"cross-filter"})],C.prototype,"crossFilter",2),x([(0,g.property)({converter:{fromAttribute:t=>t===null?!1:t===""?!0:Number(t)}})],C.prototype,"animated",2),x([(0,g.property)({type:Boolean,reflect:!0})],C.prototype,"responsive",2),x([(0,g.state)()],C.prototype,"tip",2),x([(0,g.state)()],C.prototype,"overlay",2),x([(0,g.state)()],C.prototype,"portal",2),x([(0,g.state)()],C.prototype,"measured",2),x([(0,g.state)()],C.prototype,"viewState",2),x([(0,g.state)()],C.prototype,"highlightState",2),x([(0,g.state)()],C.prototype,"crossState",2),x([(0,g.state)()],C.prototype,"focused",2),x([(0,g.state)()],C.prototype,"hiddenState",2),x([(0,g.state)()],C.prototype,"zoomState",2),x([(0,g.state)()],C.prototype,"selectedState",2);var A=class extends C{constructor(){super(...arguments);this.series=[];this.labels=!1;this.connectNulls=!1;this.stacked=!1;this.brush=!1;this.crosshair=!1}input(){let{series:t,categories:r,xAxis:i,yAxis:o,rightAxis:a,references:s,annotations:l,labels:c,curve:d,connectNulls:h,nulls:m,stacked:k,stackOffset:b,orientation:f,radius:y,barGap:v,barWidth:w,sort:L,transform:V,transforms:E,bins:N,binWidth:we,binDomain:W,binMode:de,sampling:P,brush:G,crosshair:te}=this;return{...this.sized(),series:t,categories:r,xAxis:i,yAxis:o,rightAxis:a,references:s,annotations:l,labels:c,curve:d,connectNulls:h,nulls:m,stacked:k,stackOffset:b,orientation:f,radius:y,barGap:v,barWidth:w,sort:L,transform:V,transforms:E,bins:N,binWidth:we,binDomain:W,binMode:de,sampling:P,brush:G,crosshair:te}}};x([(0,g.property)({attribute:!1})],A.prototype,"series",2),x([(0,g.property)({attribute:!1})],A.prototype,"categories",2),x([(0,g.property)({attribute:!1})],A.prototype,"xAxis",2),x([(0,g.property)({attribute:!1})],A.prototype,"yAxis",2),x([(0,g.property)({attribute:!1})],A.prototype,"rightAxis",2),x([(0,g.property)({attribute:!1})],A.prototype,"references",2),x([(0,g.property)({attribute:!1})],A.prototype,"annotations",2),x([(0,g.property)({type:Boolean,reflect:!0})],A.prototype,"labels",2),x([(0,g.property)()],A.prototype,"curve",2),x([(0,g.property)({type:Boolean,attribute:"connect-nulls"})],A.prototype,"connectNulls",2),x([(0,g.property)()],A.prototype,"nulls",2),x([(0,g.property)({reflect:!0,converter:{fromAttribute:t=>t==="percent"?"percent":t!==null}})],A.prototype,"stacked",2),x([(0,g.property)({attribute:"stack-offset"})],A.prototype,"stackOffset",2),x([(0,g.property)()],A.prototype,"orientation",2),x([(0,g.property)({type:Number})],A.prototype,"radius",2),x([(0,g.property)({type:Number,attribute:"bar-gap"})],A.prototype,"barGap",2),x([(0,g.property)({type:Number,attribute:"bar-width"})],A.prototype,"barWidth",2),x([(0,g.property)()],A.prototype,"sort",2),x([(0,g.property)()],A.prototype,"transform",2),x([(0,g.property)({attribute:!1})],A.prototype,"transforms",2),x([(0,g.property)({type:Number})],A.prototype,"bins",2),x([(0,g.property)({type:Number,attribute:"bin-width"})],A.prototype,"binWidth",2),x([(0,g.property)({attribute:!1})],A.prototype,"binDomain",2),x([(0,g.property)({attribute:"bin-mode"})],A.prototype,"binMode",2),x([(0,g.property)({attribute:!1})],A.prototype,"sampling",2),x([(0,g.property)({type:Boolean,reflect:!0})],A.prototype,"brush",2),x([(0,g.property)({type:Boolean,reflect:!0})],A.prototype,"crosshair",2);var Un=e=>e.defs&&e.defs.length?$.svg`<defs>${e.defs.map(n=>$.svg`<linearGradient id=${n.id} x1="0" y1="0" x2=${n.vertical===!1?1:0} y2=${n.vertical===!1?0:1}>${n.stops.map(t=>$.svg`<stop offset=${t.offset} stop-color=${t.color} stop-opacity=${(0,T.ifDefined)(t.opacity)}></stop>`)}</linearGradient>`)}</defs>`:$.nothing,Le=e=>$.svg`${e.map((n,t)=>{let r=n.title?$.svg`<title>${n.title}</title>`:$.nothing,i=n.item?t:void 0;switch(n.kind){case"path":return $.svg`<path data-skdx-part=${n.part} data-skdx-i=${(0,T.ifDefined)(i)} d=${n.d} fill=${n.fill??"none"} stroke=${(0,T.ifDefined)(n.stroke)} stroke-width=${(0,T.ifDefined)(n.strokeWidth)} stroke-linecap=${(0,T.ifDefined)(n.strokeLinecap)} stroke-linejoin=${(0,T.ifDefined)(n.strokeLinejoin)} stroke-dasharray=${(0,T.ifDefined)(n.dash)} opacity=${(0,T.ifDefined)(n.opacity)} fill-opacity=${(0,T.ifDefined)(n.fillOpacity)}>${r}</path>`;case"rect":return $.svg`<rect data-skdx-part=${n.part} data-skdx-i=${(0,T.ifDefined)(i)} x=${n.x} y=${n.y} width=${n.width} height=${n.height} rx=${(0,T.ifDefined)(n.rx)} fill=${n.fill} stroke=${(0,T.ifDefined)(n.stroke)} fill-opacity=${(0,T.ifDefined)(n.opacity)}>${r}</rect>`;case"line":return $.svg`<line data-skdx-part=${n.part} data-skdx-i=${(0,T.ifDefined)(i)} x1=${n.x1} y1=${n.y1} x2=${n.x2} y2=${n.y2} stroke=${n.stroke} stroke-width=${(0,T.ifDefined)(n.strokeWidth)} stroke-dasharray=${(0,T.ifDefined)(n.dash)} opacity=${(0,T.ifDefined)(n.opacity)}>${r}</line>`;case"circle":return $.svg`<circle data-skdx-part=${n.part} data-skdx-i=${(0,T.ifDefined)(i)} cx=${n.cx} cy=${n.cy} r=${n.r} fill=${n.fill} stroke=${(0,T.ifDefined)(n.stroke)} opacity=${(0,T.ifDefined)(n.opacity)}>${r}</circle>`;case"text":return $.svg`<text data-skdx-part=${n.part} data-skdx-i=${(0,T.ifDefined)(i)} x=${n.x} y=${n.y} text-anchor=${(0,T.ifDefined)(n.anchor)} dominant-baseline=${(0,T.ifDefined)(n.baseline)} fill=${(0,T.ifDefined)(n.fill)} font-weight=${(0,T.ifDefined)(n.weight)} pointer-events=${(0,T.ifDefined)(i===void 0?"none":void 0)} transform=${(0,T.ifDefined)(n.rotate?`rotate(${n.rotate} ${n.x} ${n.y})`:void 0)}>${n.text}</text>`}})}`;var H=class extends C{constructor(){super(...arguments);this.data=[];this.brush=!1;this.crosshair=!1}render(){let{data:t,scale:r,variant:i,xAxis:o,references:a,annotations:s,overlays:l,upColor:c,downColor:d,brush:h,crosshair:m}=this;return this.root(St({...this.sized(),data:t,scale:r,variant:i,xAxis:o,references:a,annotations:s,overlays:l,upColor:c,downColor:d,brush:h,crosshair:m}),"candlestick",this.label??"Candlestick chart")}};x([(0,_.property)({attribute:!1})],H.prototype,"data",2),x([(0,_.property)()],H.prototype,"scale",2),x([(0,_.property)()],H.prototype,"variant",2),x([(0,_.property)({attribute:!1})],H.prototype,"xAxis",2),x([(0,_.property)({attribute:!1})],H.prototype,"references",2),x([(0,_.property)({attribute:!1})],H.prototype,"annotations",2),x([(0,_.property)({attribute:!1})],H.prototype,"overlays",2),x([(0,_.property)({attribute:"up-color"})],H.prototype,"upColor",2),x([(0,_.property)({attribute:"down-color"})],H.prototype,"downColor",2),x([(0,_.property)({type:Boolean,reflect:!0})],H.prototype,"brush",2),x([(0,_.property)({type:Boolean,reflect:!0})],H.prototype,"crosshair",2),H=x([(0,_.customElement)("skdx-candlestick-chart")],H);0&&(module.exports={SkdxCandlestickChart});
|