@motionscript/charts 0.1.0-alpha.3 → 0.1.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +41 -0
- package/LICENSE +201 -201
- package/NOTICE +48 -0
- package/README.md +85 -0
- package/dist/bar-chart/bar-chart.d.ts +28 -13
- package/dist/bar-chart/bar-chart.d.ts.map +1 -1
- package/dist/bar-chart/bar-chart.js +60 -56
- package/dist/bar-chart/bar-chart.js.map +1 -1
- package/dist/bar-chart/category-axis.js.map +1 -1
- package/dist/bar-chart/chart-bars.js.map +1 -1
- package/dist/bar-chart/index.js.map +1 -1
- package/dist/bar-chart/shared.d.ts +3 -3
- package/dist/bar-chart/shared.js +3 -3
- package/dist/bar-chart/shared.js.map +1 -1
- package/dist/browser/chunks/chunk-5ZPBV6BU.js +2 -0
- package/dist/browser/chunks/chunk-5ZPBV6BU.js.map +7 -0
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +3 -3
- package/dist/browser/kit.js +1 -1
- package/dist/browser/manifest.json +3 -2
- package/dist/engine.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/kit/chart-border.js.map +1 -1
- package/dist/kit/chart-canvas.js.map +1 -1
- package/dist/kit/chart-legend.d.ts +4 -25
- package/dist/kit/chart-legend.d.ts.map +1 -1
- package/dist/kit/chart-legend.js +31 -55
- package/dist/kit/chart-legend.js.map +1 -1
- package/dist/kit/shared.d.ts +29 -6
- package/dist/kit/shared.d.ts.map +1 -1
- package/dist/kit/shared.js +64 -8
- package/dist/kit/shared.js.map +1 -1
- package/dist/kit/vertical-axis.js.map +1 -1
- package/dist/line-chart/chart-line.d.ts +2 -2
- package/dist/line-chart/chart-line.js.map +1 -1
- package/dist/line-chart/chart-region.js.map +1 -1
- package/dist/line-chart/horizontal-axis.js.map +1 -1
- package/dist/line-chart/index.js.map +1 -1
- package/dist/line-chart/line-chart.d.ts +9 -1
- package/dist/line-chart/line-chart.d.ts.map +1 -1
- package/dist/line-chart/line-chart.js +32 -8
- package/dist/line-chart/line-chart.js.map +1 -1
- package/dist/line-chart/shared.d.ts +3 -3
- package/dist/line-chart/shared.d.ts.map +1 -1
- package/dist/line-chart/shared.js +19 -4
- package/dist/line-chart/shared.js.map +1 -1
- package/dist/line-chart/x-scale.d.ts +1 -1
- package/dist/line-chart/x-scale.js +1 -1
- package/dist/line-chart/x-scale.js.map +1 -1
- package/dist/nodes.js.map +1 -1
- package/dist/pie-chart/index.js.map +1 -1
- package/dist/pie-chart/pie-chart.d.ts +2 -2
- package/dist/pie-chart/pie-chart.d.ts.map +1 -1
- package/dist/pie-chart/pie-chart.js +9 -7
- package/dist/pie-chart/pie-chart.js.map +1 -1
- package/dist/pie-chart/pie-legend.js +4 -4
- package/dist/pie-chart/pie-legend.js.map +1 -1
- package/dist/pie-chart/pie-ring.d.ts +13 -4
- package/dist/pie-chart/pie-ring.d.ts.map +1 -1
- package/dist/pie-chart/pie-ring.js +44 -14
- package/dist/pie-chart/pie-ring.js.map +1 -1
- package/dist/pie-chart/shared.d.ts +3 -3
- package/dist/pie-chart/shared.js +3 -3
- package/dist/pie-chart/shared.js.map +1 -1
- package/package.json +6 -5
- package/registry.json +23 -23
- package/src/bar-chart/bar-chart.ts +820 -814
- package/src/bar-chart/category-axis.ts +177 -177
- package/src/bar-chart/chart-bars.ts +310 -310
- package/src/bar-chart/index.ts +31 -31
- package/src/bar-chart/shared.ts +354 -354
- package/src/engine.ts +26 -26
- package/src/index.ts +5 -5
- package/src/kit/chart-border.ts +61 -61
- package/src/kit/chart-canvas.ts +157 -157
- package/src/kit/chart-legend.ts +245 -250
- package/src/kit/shared.ts +733 -675
- package/src/kit/vertical-axis.ts +224 -224
- package/src/line-chart/chart-line.ts +208 -208
- package/src/line-chart/chart-region.ts +135 -135
- package/src/line-chart/horizontal-axis.ts +202 -202
- package/src/line-chart/index.ts +39 -39
- package/src/line-chart/line-chart.ts +961 -929
- package/src/line-chart/shared.ts +473 -459
- package/src/line-chart/x-scale.ts +367 -367
- package/src/nodes.ts +20 -20
- package/src/pie-chart/index.ts +37 -37
- package/src/pie-chart/pie-chart.ts +383 -381
- package/src/pie-chart/pie-legend.ts +159 -159
- package/src/pie-chart/pie-ring.ts +935 -903
- package/src/pie-chart/shared.ts +490 -490
- package/dist/browser/chunks/chunk-RMHQ6GYU.js +0 -2
- package/dist/browser/chunks/chunk-RMHQ6GYU.js.map +0 -7
package/dist/browser/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{A as Ot,B as Ar,C as F,D as Oe,E as z,F as Pe,G as Fe,H as De,I as Ie,J as Be,K as le,a as te,b as q,c as O,d as br,e as P,f,g as E,h as ie,i as Sr,j as H,k as Te,l as Ee,m as X,n as Mt,o as _e,p as se,q as re,r as Me,s as Le,t as oe,u as ne,v as Lt,w as kt,x as ke,y as Ce,z as Ct}from"./chunks/chunk-RMHQ6GYU.js";import{command as Z,node as Ji,Node2D as Qi,Rect as be,easeOut as $,property as Y}from"@motionscript/sdk";import{Graphics2D as rt,Node2D as Gi,command as Ui,easeOut as It,strokeOps as Bt,property as ce}from"@motionscript/sdk";import{Fills as Oi,fillOps as Pt,lerpNumber as Pi,strokeOps as Ft}from"@motionscript/sdk";var ae={left:0,right:0,bottom:0,top:0,xBounded:!1,yBounded:!1};function he(o){return o.right>o.left&&o.top>o.bottom}function Je(o,e,t,i){if(!o||o.x===void 0&&o.y===void 0)return ae;let r=(c,[p,u],R,C)=>{if(c===void 0||u<=p)return[R,C,!1];let U=Math.min(c[0],c[1]),ki=Math.max(c[0],c[1]),_t=Ci=>R+(Ci-p)/(u-p)*(C-R);return[Math.max(R,Math.min(C,_t(U))),Math.max(R,Math.min(C,_t(ki))),!0]},[s,n,l]=r(o.x,t,e.left,e.right),[a,h,d]=r(o.y,i,e.bottom,e.top);return{left:s,right:n,bottom:a,top:h,xBounded:l,yBounded:d}}function Qe(o,e){if(o.length<2||!he(e))return[];let t=[],i=[];for(let r=1;r<o.length;r++){let s=Di(o[r-1],o[r],e);if(!s){i.length>=2&&t.push(i),i=[];continue}let[n,l]=s;i.length>0&&Fi(i[i.length-1],n)?i.push(l):(i.length>=2&&t.push(i),i=[n,l])}return i.length>=2&&t.push(i),t}function Fi(o,e){return Math.abs(o.x-e.x)<.5&&Math.abs(o.y-e.y)<.5}function Di(o,e,t){let i=e.x-o.x,r=e.y-o.y,s=0,n=1,l=[[-i,o.x-t.left],[i,t.right-o.x],[-r,o.y-t.bottom],[r,t.top-o.y]];for(let[a,h]of l){if(a===0){if(h<0)return null;continue}let d=h/a;if(a<0){if(d>n)return null;d>s&&(s=d)}else{if(d<s)return null;d<n&&(n=d)}}return[{x:o.x+s*i,y:o.y+s*r},{x:o.x+n*i,y:o.y+n*r}]}var Ii={...X,markerStyle:{...X.markerStyle,width:20,height:20,borderRadius:6}},Q={seriesStyles:Mt,xAxis:H,yAxis:Te,plotArea:Ee,legend:Ii,region:{stroke:{weight:3,fill:O.regionColor,dash:[14,12],cap:"butt"},fill:Oi.color(O.regionColor,{opacity:.08}),dimOpacity:P}};function Bi(o,e){return{stroke:Ft.resolve(o?.stroke??e.stroke),fill:Pt.resolve(o?.fill??e.fill),dimOpacity:o?.dimOpacity??e.dimOpacity}}function Ni(o,e,t){return{stroke:Ft.lerp(o.stroke,e.stroke,t),fill:Pt.lerp(o.fill,e.fill,t),dimOpacity:Pi(o.dimOpacity,e.dimOpacity,t)}}function et(o,e){let t=e??Q;return{seriesStyles:Lt(o?.seriesStyles,t.seriesStyles),xAxis:se(o?.xAxis,t.xAxis),yAxis:se(o?.yAxis,t.yAxis),plotArea:Me(o?.plotArea,t.plotArea),legend:oe(o?.legend,t.legend),region:Bi(o?.region,t.region)}}function tt(o,e,t){return{seriesStyles:kt(o.seriesStyles,e.seriesStyles,t),xAxis:re(o.xAxis,e.xAxis,t),yAxis:re(o.yAxis,e.yAxis,t),plotArea:Le(o.plotArea,e.plotArea,t),legend:ne(o.legend,e.legend,t),region:Ni(o.region,e.region,t)}}function it(o,e,t){return o.map((i,r)=>[e.at(r),E(i,t.field)]).sort((i,r)=>i[0]-r[0])}function Dt(o,e){let t=1/0,i=-1/0;for(let r of o)for(let s of e){let n=E(r,s.field);n<t&&(t=n),n>i&&(i=n)}return t<=i?[t,i]:[0,1]}function st(o,e,t,i){if(t)return t;let[r,s]=Dt(o,e),n=Math.max(1,Math.round(i)),l=Pe((s-r)/n||1);return[Math.floor(r/l)*l,Math.ceil(s/l)*l]}import{declarePaints as Hi}from"@motionscript/sdk/component";var ee=function(o,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var l=o.length-1;l>=0;l--)(n=o[l])&&(s=(r<3?n(s):r>3?n(e,t,s):n(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},_=class extends Gi{declareAssets(e){super.declareAssets(e),Hi(this,e)}renderSelf(e){if(!this.enabled)return;let t=this.points;if(t.length<2)return;let i=Math.max(0,Math.min(1,this.progress));if(i<=0)return;let r=this.tracePoints(t,i);if(r.length<2)return;let s=this.stroke,n=(s[0]?.weight??0)*2,l=this.spotlight;if(!he(l)){e.draw(new rt().line({points:r,radius:n}).stroke(s));return}e.draw(new rt().line({points:r,radius:n}).stroke(s).opacity(Math.max(0,Math.min(1,this.dimOpacity))));for(let a of Qe(r,l))e.draw(new rt().line({points:a,radius:n}).stroke(s))}tracePoints(e,t){if(t>=1||e.length<2)return e;if(t<=0)return[];let i=[],r=0;for(let l=1;l<e.length;l++){let a=Math.hypot(e[l].x-e[l-1].x,e[l].y-e[l-1].y);i.push(a),r+=a}if(r===0)return e;let s=r*t,n=[e[0]];for(let l=0;l<i.length;l++)if(s>=i[l])n.push(e[l+1]),s-=i[l];else{let a=i[l]===0?0:s/i[l];n.push({x:e[l].x+(e[l+1].x-e[l].x)*a,y:e[l].y+(e[l+1].y-e[l].y)*a});break}return n}enter(e){return this.enterFrom(0,e.duration,e.easing??It())}enterFrom(e,t,i=It(),r=1){return this.command(s=>{let n=e+(r-e)*s;return{progress:n,enabled:n>0}},t,i)}};ee([ce({default:()=>[]})],_.prototype,"points",void 0);ee([ce({default:[],mapper:Bt.resolve,tween:Bt.lerp})],_.prototype,"stroke",void 0);ee([ce({default:1})],_.prototype,"progress",void 0);ee([ce({default:!0})],_.prototype,"enabled",void 0);ee([ce({default:()=>ae})],_.prototype,"spotlight",void 0);ee([ce({default:P})],_.prototype,"dimOpacity",void 0);ee([Ui()],_.prototype,"enter",null);import{Graphics2D as Nt,Node2D as Xi,fillOps as Gt,strokeOps as Ut,property as Ge}from"@motionscript/sdk";import{declarePaints as zi}from"@motionscript/sdk/component";var Ne=function(o,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var l=o.length-1;l>=0;l--)(n=o[l])&&(s=(r<3?n(s):r>3?n(e,t,s):n(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},j=class extends Xi{declareAssets(e){super.declareAssets(e),zi(this,e)}renderSelf(e){let t=this.box;if(!he(t))return;let i=Math.max(0,Math.min(1,this.reveal));if(i<=0)return;let r=t.right-t.left,s=t.top-t.bottom,n=(t.left+t.right)/2,l=(t.bottom+t.top)/2;if(this.fill.length>0&&e.draw(new Nt().rect({x:n,y:l,width:r,height:s}).fill(this.fill).opacity(i)),this.stroke.length===0)return;let d=c=>e.draw(new Nt().line({points:c}).stroke(this.stroke).opacity(i));if(t.xBounded){let c=s/2*i;for(let p of[t.left,t.right])d([{x:p,y:l-c},{x:p,y:l+c}])}if(t.yBounded){let c=r/2*i;for(let p of[t.bottom,t.top])d([{x:n-c,y:p},{x:n+c,y:p}])}}};Ne([Ge({default:()=>ae})],j.prototype,"box",void 0);Ne([Ge({default:Q.region.stroke,mapper:Ut.resolve,tween:Ut.lerp})],j.prototype,"stroke",void 0);Ne([Ge({default:Q.region.fill,mapper:Gt.resolve,tween:Gt.lerp})],j.prototype,"fill",void 0);Ne([Ge({default:0})],j.prototype,"reveal",void 0);import{command as ji,Node2D as Yi,Rect as Ht,Text as Xt,easeOut as Wi,property as Ue,insetsOps as zt,textOps as jt}from"@motionscript/sdk";import{at as Yt,compose as Wt}from"@motionscript/sdk/component";var ve=function(o,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var l=o.length-1;l>=0;l--)(n=o[l])&&(s=(r<3?n(s):r>3?n(e,t,s):n(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Vt=24,D=class extends Yi{labelFor=F;markerNodes=[];labelNode=null;get sortedMarkers(){return[...this.markers].sort((e,t)=>e-t)}valueAt(e){return this.sortedMarkers[e]}fracAt(e){let t=this.valueAt(e);if(t===void 0)return 0;let[i,r]=this.range;return r<=i?0:(t-i)/(r-i)}constructor(e){super(e);let t=zt.resolve(this.axis.tickPadding).top,i=zt.resolve(this.axis.titlePadding).top;this.markerNodes=this.markers.map((s,n)=>{let l=new Xt({...jt.styleProps(this.axis.labelStyle),text:()=>{let a=this.valueAt(n);return a===void 0?"":this.labelFor(a)},x:()=>{let a=this.layoutBounds.width,h=(this.fracAt(n)-.5)*a,d=a/2-l.layoutBounds.width/2;return Math.min(h,d)}});return l});let r=[new Ht({width:"fill",height:"hug",padding:{top:t},children:this.markerNodes})];this.label!==""&&(this.labelNode=new Xt({...jt.styleProps(this.axis.titleStyle),text:this.label}),r.push(this.labelNode)),this.add(new Ht({flow:"vertical",gap:i,height:"hug",width:"fill",children:r}))}arm(e=Vt){for(let t of this.markerNodes)t.set({opacity:0,y:e});this.labelNode?.set({opacity:0,y:e})}enter(e){let{stagger:t,slide:i=Vt}=e.data??{},r=e.duration,s=e.easing??Wi(),n=this.markerNodes;if(n.length===0)return Wt([]);let{step:l,per:a,caption:h}=Fe(r,n.length,this.labelNode!==null,t);this.arm(i);let d=n.map((p,u)=>Yt(u*l,p.to({data:{opacity:1,y:0},duration:a,easing:s}))),c=n.length===0?0:(n.length-1)*l+a;return Wt([...d,...this.labelNode?[Yt(c,this.labelNode.to({data:{opacity:1,y:0},duration:h,easing:s}))]:[]])}};ve([Ue({default:()=>[0,1]})],D.prototype,"range",void 0);ve([Ue({default:()=>[]})],D.prototype,"markers",void 0);ve([Ue({default:H})],D.prototype,"axis",void 0);ve([Ue({default:""})],D.prototype,"label",void 0);ve([ji()],D.prototype,"enter",null);import{formatNumber as Vi}from"@motionscript/sdk/component";var He=864e5,Jt=["january","february","march","april","may","june","july","august","september","october","november","december"],Kt=2024;function qt(o){return o.length<3?-1:Jt.findIndex(e=>e.startsWith(o))}function Ki(o,e){let t=Date.UTC(o,0,4),i=(new Date(t).getUTCDay()+6)%7;return t-i*He+(e-1)*7*He}function Qt(o){if(typeof o!="string")return null;let e=o.trim().toLowerCase();if(e==="")return null;let t=/^(\d{4})[-/](\d{1,2})(?:[-/](\d{1,2}))?$/.exec(e);if(t){let n=Number(t[2]),l=t[3]===void 0?1:Number(t[3]);return n<1||n>12||l<1||l>31?null:Date.UTC(Number(t[1]),n-1,l)}let i=/^(?:(\d{4})[-\s]?)?w(?:ee)?k?[-\s]?(\d{1,2})$/.exec(e);if(i){let n=Number(i[2]);return n<1||n>53?null:Ki(i[1]===void 0?Kt:Number(i[1]),n)}let r=/^(?:(\d{4})[-\s]+)?([a-z]+)(?:[-\s]+(\d{4}))?$/.exec(e);if(r){let n=qt(r[2]);if(n>=0){let l=r[1]??r[3],a=l===void 0?Kt:Number(l);return Date.UTC(a,n,1)}}let s=/^(?:(\d{1,2})[-\s]+([a-z]+)|([a-z]+)[-\s]+(\d{1,2}),?)[-\s]+(\d{4})$/.exec(e);if(s){let n=qt(s[2]??s[3]),l=Number(s[1]??s[4]);if(n>=0&&l>=1&&l<=31)return Date.UTC(Number(s[5]),n,l)}return null}function ei(o,e){let t=new Date(o),i=t.getUTCFullYear(),r=Jt[t.getUTCMonth()].slice(0,3),s=r.charAt(0).toUpperCase()+r.slice(1);return e>4*365*He?String(i):e>60*He?`${s} ${i}`:`${s} ${t.getUTCDate()}`}function qi(o,e){let t=!1;for(let i of o){let r=i[e];if(!(r==null||r==="")){if(typeof r!="number")return!1;t=!0}}return t}function $i(o,e){let t=[],i=!1;for(let n of o){let l=n[e];if(l==null||l===""){t.push(null);continue}let a=Qt(l);if(a===null)return null;t.push(a),i=!0}if(!i)return null;let s=t.find(n=>n!==null);return t.map(n=>n===null?s:s=n)}function $t(o){let e=1/0,t=-1/0;for(let i of o)i<e&&(e=i),i>t&&(t=i);return e<=t?[e,t]:[0,1]}function Zt(o,[e,t],i){let r=o.filter(a=>a>=e&&a<=t),s=[...new Set(r)].sort((a,h)=>a-h);if(s.length===0)return z([e,t],i);let n=a=>s.reduce((h,d)=>Math.abs(d-a)<Math.abs(h-a)?d:h),l=[];for(let a of z([e,t],i)){let h=n(a);l[l.length-1]!==h&&l.push(h)}return l}function Zi(o,e,t,i){let r=o.indexOf(t);return r>=0?e[r]:i(t)}function ot(o,e,t){if(e!==""&&qi(o,e)){let n=o.map(l=>E(l,e));return{kind:"numeric",at:l=>n[l]??0,extent:$t(n),label:l=>t===void 0?F(l):Vi(l,t),ticks:z}}let i=o.map(n=>ie(n,e)),r=e===""?null:$i(o,e);if(r){let n=$t(r),l=n[1]-n[0];return{kind:"time",at:a=>r[a]??0,extent:n,label:a=>Zi(r,i,a,h=>ei(h,l)),ticks:(a,h)=>Zt(r,a,h)}}let s=o.map((n,l)=>l);return{kind:"ordinal",at:n=>n,extent:s.length>0?[0,s.length-1]:[0,1],label:n=>i[Math.round(n)]??"",ticks:(n,l)=>Zt(s,n,l)}}import{asCommand as de,formatNumber as es,hold as ti,sequence as ii,together as Se}from"@motionscript/sdk/component";var v=function(o,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var l=o.length-1;l>=0;l--)(n=o[l])&&(s=(r<3?n(s):r>3?n(e,t,s):n(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},I,ts=24,nt={key:"seriesIndex",kind:"series",default:0,min:0,step:1},is=20,si=.35,ss=.5,rs=.15,m=class extends Qi{static{I=this}vAxis;hAxis;plotRect;legend=null;lines=[];get resolvedTheme(){return this.theme}static DEFAULT_MARKERS=5;get xColumn(){return ot(this.data,this.xField,this.xAxis.format)}get xScale(){return this.xAxis.range??this.xColumn.extent}get yScale(){let e=(this.yAxis.ticks?.length??I.DEFAULT_MARKERS)-1;return st(this.data,this.series,this.yAxis.range,e)}get resolvedYMarkers(){return this.yAxis.ticks??z(this.yScale,I.DEFAULT_MARKERS-1)}get resolvedXMarkers(){return this.xAxis.ticks??this.xColumn.ticks(this.xScale,I.DEFAULT_MARKERS-1)}plotSize(){let{width:e,height:t}=this.plotRect.layoutBounds;return{width:e,height:t}}seriesPixels(e){let t=this.series[e];if(!t)return[];let i=it(this.data,this.xColumn,t);if(i.length===0)return[];let{width:r,height:s}=this.plotSize(),[n,l]=this.xScale,[a,h]=this.yScale,d=p=>l<=n?0:((p-n)/(l-n)-.5)*r,c=p=>h<=a?0:((p-a)/(h-a)-.5)*s;return i.map(([p,u])=>({x:d(p),y:c(u)}))}hasCallout(){let e=this.region;return e!=null&&(e.x!==void 0||e.y!==void 0)}regionBox(){let{width:e,height:t}=this.plotSize();return Je(this.region,{left:-e/2,right:e/2,bottom:-t/2,top:t/2},this.xScale,this.yScale)}constructor(e){super(e);let t=this.series.map(n=>n.enabled??!0),i=this.showLegend!==!1;this.vAxis=new le({range:()=>this.yScale,markers:()=>this.resolvedYMarkers,axis:()=>this.resolvedTheme.yAxis,label:this.yAxis.label??"",width:"hug",height:"fill"}),this.vAxis.labelFor=n=>this.yAxis.format===void 0?F(n):es(n,this.yAxis.format),this.hAxis=new D({range:()=>this.xScale,markers:()=>this.resolvedXMarkers,axis:()=>this.resolvedTheme.xAxis,label:this.xAxis.label??"",width:"fill",height:"hug"}),this.hAxis.labelFor=n=>this.xColumn.label(n),this.lines=this.series.map((n,l)=>new _({points:()=>this.seriesPixels(l),stroke:()=>Ct(this.resolvedTheme.seriesStyles,n,l),enabled:t[l],spotlight:()=>this.regionBox(),dimOpacity:()=>1-(1-this.resolvedTheme.region.dimOpacity)*this.regionReveal})),i&&(this.legend=new Be({series:this.series,swatches:()=>this.series.map((n,l)=>Ot(this.resolvedTheme.seriesStyles,n,l)),legend:()=>this.resolvedTheme.legend})),this.plotRect=new be({clip:!0,children:[new Ie({fill:()=>this.resolvedTheme.plotArea.fill,shadow:()=>this.resolvedTheme.plotArea.shadow,xGridStroke:()=>this.resolvedTheme.xAxis.lineStyle,yGridStroke:()=>this.resolvedTheme.yAxis.lineStyle,xMarkers:()=>this.resolvedXMarkers,yMarkers:()=>this.resolvedYMarkers,xExtent:()=>this.xScale,yExtent:()=>this.yScale}),new j({box:()=>this.regionBox(),stroke:()=>this.resolvedTheme.region.stroke,fill:()=>this.resolvedTheme.region.fill,reveal:()=>this.regionReveal}),...this.lines,new De({stroke:()=>this.resolvedTheme.plotArea.stroke})]});let r=new le({opacity:0,range:()=>this.yScale,markers:()=>this.resolvedYMarkers,axis:()=>this.resolvedTheme.yAxis,label:this.yAxis.label??"",width:"hug",height:0}),s=[this.hAxis];this.legend&&s.push(this.legend),this.add(new be({flow:"vertical",width:"fill",height:"fill",padding:{top:ts},children:[new be({flow:"horizontal",height:"fill",width:"fill",children:[this.vAxis,this.plotRect]}),new be({flow:"horizontal",width:"fill",children:[r,new be({flow:"vertical",width:"fill",gap:20,children:s})]})]}))}arm(){this.vAxis.arm(),this.hAxis.arm();for(let e of this.lines)e.set({progress:0});this.legend?.set({opacity:0,y:-is})}enter(e){let t=e.duration,i=e.easing??$();this.arm();let r=this.hasCallout()&&this.regionReveal===0,s=r?t*.75:t,n=Se(this.vAxis.enter({data:{slide:24},duration:s*si,easing:i}),this.hAxis.enter({data:{slide:24},duration:s*si,easing:i})),l=Se(...this.lines.map(d=>d.enter({duration:s*ss,easing:i}))),a=this.legend?[this.legend.to({data:{opacity:1,y:0},duration:s*rs,easing:i})]:[],h=ii(n,l,...a);return de(r?ii(h,this.command(d=>({regionReveal:d}),t*.25,i)):h,t)}spotlightRegion(e){let t=I.regionArg(e.data),i=e.duration??.5,r=e.easing??$(),s=this.regionReveal,n=this.region;return t.x===void 0&&t.y===void 0?this.clearRegion({duration:i,easing:r}):s<=0||!this.hasCallout()?this.command(l=>({region:t,regionReveal:s+(1-s)*l}),i,r):this.command(l=>l<.5?{region:n,regionReveal:s*(1-r(l*2))}:{region:t,regionReveal:r(l*2-1)},i)}clearRegion(e={}){let t=e.duration??.5,i=e.easing??$(),r=this.regionReveal;return r===0?this.command(()=>({region:null,regionReveal:0}),t):this.command(s=>s>=1?{region:null,regionReveal:0}:{regionReveal:r*(1-s)},t,i)}home=null;static regionArg(e){let t=e?.region;return t!=null&&typeof t=="object"?t:{}}static span([e,t]){return e<=t?[e,t]:[t,e]}static rescale(e,t){let i=I.span(e),r=Math.max(2,t.length);return{range:i,ticks:z(i,r-1)}}zoomTo(e){let t=I.regionArg(e.data),i=e.duration??.8,r=e.easing??$();if(!t.x&&!t.y)return this.command(()=>({}),i);let s=this._domains();return this.home??=s,this._tweenAxes(s,{...t.x&&{x:{...s.x,...I.rescale(t.x,s.x.ticks)}},...t.y&&{y:{...s.y,...I.rescale(t.y,s.y.ticks)}}},i,r)}resetZoom(e={}){let t=e.duration??.8,i=e.easing??$(),r=this.home;return r?(this.home=null,this._tweenAxes(this._domains(),r,t,i)):this.command(()=>({}),t)}showSeries(e){let t=e.data?.seriesIndex??0,i=e.duration??.35,r=e.easing??$(),s=this.lines[t];return s?de(Se(s.enterFrom(0,i,r),...this.legend?[this.legend.showSeries({data:{index:t},duration:i,easing:r})]:[]),i):de(ti(i))}hideSeries(e){let t=e.data?.seriesIndex??0,i=e.duration??.35,r=e.easing??$(),s=this.lines[t];return s?de(Se(s.enterFrom(1,i,r,0),...this.legend?[this.legend.hideSeries({data:{index:t},duration:i,easing:r})]:[]),i):de(ti(i))}spotlightSeries(e){let t=e.data?.seriesIndex??0,i=e.duration??.35,r=e.easing??$();return de(Se(...this.lines.map((s,n)=>s.to({data:{opacity:n===t?1:P},duration:i,easing:r})),...this.legend?[this.legend.spotlightSeries({data:{index:t},duration:i,easing:r})]:[]),i)}_domains(){return{x:{...this.xAxis,range:this.xScale,ticks:this.resolvedXMarkers},y:{...this.yAxis,range:this.yScale,ticks:this.resolvedYMarkers}}}_tweenAxes(e,t,i,r){return this.command(s=>({...t.x&&{xAxis:q(e.x,t.x,s)},...t.y&&{yAxis:q(e.y,t.y,s)}}),i,r)}};v([Y({default:()=>[],kind:"dataset"})],m.prototype,"data",void 0);v([Y({default:""})],m.prototype,"xField",void 0);v([Y({default:()=>[],kind:"series"})],m.prototype,"series",void 0);v([Y({default:{},mapper:te,tween:q})],m.prototype,"xAxis",void 0);v([Y({default:{},mapper:te,tween:q})],m.prototype,"yAxis",void 0);v([Y({default:Q,mapper:et,tween:tt})],m.prototype,"theme",void 0);v([Y({default:null})],m.prototype,"region",void 0);v([Y({default:0})],m.prototype,"regionReveal",void 0);v([Y({default:!0,animatable:!1})],m.prototype,"showLegend",void 0);v([Z()],m.prototype,"enter",null);v([Z({args:[{key:"region",kind:"region",properties:{x:{kind:"range",default:!0,defaultMin:0,defaultMax:100},y:{kind:"range",default:!1,defaultMin:0,defaultMax:100}}}]})],m.prototype,"spotlightRegion",null);v([Z()],m.prototype,"clearRegion",null);v([Z({args:[{key:"region",kind:"region",properties:{x:{kind:"range",default:!0,defaultMin:0,defaultMax:100},y:{kind:"range",default:!1,defaultMin:0,defaultMax:100}}}]})],m.prototype,"zoomTo",null);v([Z()],m.prototype,"resetZoom",null);v([Z({args:[nt]})],m.prototype,"showSeries",null);v([Z({args:[nt]})],m.prototype,"hideSeries",null);v([Z({args:[nt]})],m.prototype,"spotlightSeries",null);m=I=v([Ji({key:"lineChart",parentKey:"node",forkable:!0,layout:{children:"freeform",defaultWidthMode:"fixed",defaultHeightMode:"fixed",acceptsChildren:!0},seed:{width:760,height:460}})],m);import{command as ue,node as ws,Node2D as Rs,Rect as we,easeOut as pe,property as k}from"@motionscript/sdk";import{formatNumber as Ts}from"@motionscript/sdk/component";import{asCommand as We,drive as gi,hold as yi,sequence as Es,together as ut}from"@motionscript/sdk/component";import{command as os,Node2D as ns,Rect as lt,Text as ri,easeOut as ls,property as Xe,insetsOps as oi,textOps as ni}from"@motionscript/sdk";import{at as li,compose as as,hold as hs}from"@motionscript/sdk/component";var Ae=function(o,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var l=o.length-1;l>=0;l--)(n=o[l])&&(s=(r<3?n(s):r>3?n(e,t,s):n(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},ai=24,B=class extends ns{captionNodes=[];labelNode=null;slotCenter(e){let t=this.categories.length;if(t<=0)return 0;let i=this.layoutBounds.width;return-i/2+i/t*(e+.5)}constructor(e){super(e);let t=oi.resolve(this.axis.tickPadding).top,i=oi.resolve(this.axis.titlePadding).top,r=this.categories.map((n,l)=>{let a=new ri({...ni.styleProps(this.axis.labelStyle),text:n});return this.captionNodes.push(a),new lt({width:"hug",height:"hug",flow:"freeform",opacity:()=>f(this.dims[l]??1),x:()=>this.slotCenter(l),children:[a]})}),s=[new lt({width:"fill",height:"hug",padding:{top:t},children:r})];this.label!==""&&(this.labelNode=new ri({...ni.styleProps(this.axis.titleStyle),text:this.label}),s.push(this.labelNode)),this.add(new lt({flow:"vertical",gap:i,height:"hug",width:"fill",children:s}))}arm(e=ai){for(let t of this.captionNodes)t.set({opacity:0,y:e});this.labelNode?.set({opacity:0,y:e})}enter(e){let{stagger:t,slide:i=ai}=e.data??{},r=e.easing??ls(),s=this.captionNodes;if(s.length===0)return hs(e.duration);let{step:n,per:l,caption:a}=Fe(e.duration,s.length,this.labelNode!==null,t);this.arm(i);let h=(s.length-1)*n+l;return as([...s.map((d,c)=>li(c*n,d.to({data:{opacity:1,y:0},duration:l,easing:r}))),...this.labelNode?[li(h,this.labelNode.to({data:{opacity:1,y:0},duration:a,easing:r}))]:[]])}};Ae([Xe({default:()=>[]})],B.prototype,"categories",void 0);Ae([Xe({default:H})],B.prototype,"axis",void 0);Ae([Xe({default:""})],B.prototype,"label",void 0);Ae([Xe({default:()=>[]})],B.prototype,"dims",void 0);Ae([os()],B.prototype,"enter",null);import{command as us,Graphics2D as fs,Node2D as ms,Text as gs,easeOut as ys,fillOps as ui,shadowOps as fi,strokeOps as mi,property as L,textOps as xs}from"@motionscript/sdk";import{fillOps as cs,lerpNumber as ze,shadowOps as hi,strokeOps as ci,textOps as di}from"@motionscript/sdk";function je(o,e,t){let i=0;return e.map(r=>{let s=E(o,r.field);if(!t)return{from:0,to:s,value:s};let n=i;return i+=s,{from:n,to:i,value:s}})}function at(o,e){let t=-1;for(let i=0;i<e.length;i++)E(o,e[i].field)!==0&&(t=i);return t}function ht(o,e){return o.map(t=>ie(t,e))}function pi(o,e,t){let i=0,r=0;for(let s of o)for(let n of je(s,e,t))i=Math.min(i,n.from,n.to),r=Math.max(r,n.from,n.to);return i<r?[i,r]:[0,1]}function ct(o,e,t,i,r){if(i)return i;let[s,n]=pi(o,e,t),l=Math.max(1,Math.round(r)),a=Pe((n-s)/l||1);return[Math.floor(s/a)*a,Math.ceil(n/a)*a]}var W={seriesFills:_e,bar:{cornerRadius:6,slotFill:.72,groupGap:6,stroke:[],shadow:[]},xAxis:{...H,labelStyle:{...H.labelStyle,fontWeight:600},tickPadding:16},yAxis:Te,plotArea:Ee,legend:X,valueStyle:{fontSize:24,fontWeight:700,textAlign:"center",fill:O.markerColor},spotlight:{dimOpacity:P}};function ds(o,e){return{cornerRadius:o?.cornerRadius??e.cornerRadius,slotFill:o?.slotFill??e.slotFill,groupGap:o?.groupGap??e.groupGap,stroke:ci.resolve(o?.stroke??e.stroke),shadow:hi.resolve(o?.shadow??e.shadow)}}function ps(o,e,t){return{cornerRadius:ze(o.cornerRadius,e.cornerRadius,t),slotFill:ze(o.slotFill,e.slotFill,t),groupGap:ze(o.groupGap,e.groupGap,t),stroke:ci.lerp(o.stroke,e.stroke,t),shadow:hi.lerp(o.shadow,e.shadow,t)}}function dt(o,e){let t=e??W;return{seriesFills:ke(o?.seriesFills,t.seriesFills),bar:ds(o?.bar,t.bar),xAxis:se(o?.xAxis,t.xAxis),yAxis:se(o?.yAxis,t.yAxis),plotArea:Me(o?.plotArea,t.plotArea),legend:oe(o?.legend,t.legend),valueStyle:di.resolveStyle(o?.valueStyle,t.valueStyle),spotlight:{dimOpacity:o?.spotlight?.dimOpacity??t.spotlight.dimOpacity}}}function pt(o,e,t){return{seriesFills:Ce(o.seriesFills,e.seriesFills,t),bar:ps(o.bar,e.bar,t),xAxis:re(o.xAxis,e.xAxis,t),yAxis:re(o.yAxis,e.yAxis,t),plotArea:Le(o.plotArea,e.plotArea,t),legend:ne(o.legend,e.legend,t),valueStyle:di.lerpStyle(o.valueStyle,e.valueStyle,t),spotlight:{dimOpacity:ze(o.spotlight.dimOpacity,e.spotlight.dimOpacity,t)}}}function Ye(o,e,t){return e.fill!=null?cs.resolve(e.fill):o.length===0?"white":o[t%o.length]}import{declarePaints as vs}from"@motionscript/sdk/component";var M=function(o,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var l=o.length-1;l>=0;l--)(n=o[l])&&(s=(r<3?n(s):r>3?n(e,t,s):n(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},bs=10,Ss=1.6,As=24,S=class extends ms{labelFor=F;constructor(e){if(super(e),!!this.showValues)for(let t=0;t<this.bars.length;t++)this.add(new gs({...xs.styleProps(this.valueStyle),text:()=>this.captionAt(t),x:()=>this.bars[t]?.x??0,y:()=>this.captionY(t),opacity:()=>this.dimAt(t)}))}dimAt(e){return this.enabled?f(this.dims[e]??1):0}endsAt(e){let t=this.bars[e];if(!t)return null;let i=f(this.growth),r=this.baseline+(t.from-this.baseline)*i,s=this.baseline+(t.to-this.baseline)*i;return{base:r,end:s}}get valueSize(){let e=this.valueStyle.fontSize;return typeof e=="number"?e:As}captionAt(e){let t=this.bars[e];if(!t||t.value===0)return"";if(this.insideAt(e)){let i=this.endsAt(e);if(!i||Math.abs(i.end-i.base)<this.valueSize*Ss)return""}return this.labelFor(t.value)}insideAt(e){let t=this.bars[e];return t!==void 0&&Math.abs(t.from-this.baseline)>.5}captionY(e){let t=this.endsAt(e);if(!t)return 0;if(this.insideAt(e))return(t.base+t.end)/2;let i=t.end>=t.base?1:-1;return t.end+i*(bs+this.valueSize/2)}declareAssets(e){super.declareAssets(e),vs(this,e,{fills:this.barShadow.map(t=>t.fill),strokes:[this.barStroke]})}renderSelf(e){if(this.enabled)for(let t=0;t<this.bars.length;t++){let i=this.bars[t],r=this.endsAt(t);if(!r||i.width<=0)continue;let s=Math.abs(r.end-r.base);if(s<=0)continue;let n=i.round?Math.min(this.cornerRadius,s):0,l=new fs,a=l.rect({x:i.x,y:(r.base+r.end)/2,width:i.width,height:s,cornerRadius:n>0?r.end>=r.base?{bottomLeft:n,bottomRight:n,topLeft:0,topRight:0}:{topLeft:n,topRight:n,bottomLeft:0,bottomRight:0}:0});a.shadow(this.barShadow),a.fill(this.fill),a.stroke(this.barStroke),e.draw(l.opacity(this.dimAt(t)))}}enter(e){return this.command(t=>({growth:t}),e.duration,e.easing??ys())}};M([L({default:()=>[]})],S.prototype,"bars",void 0);M([L({default:0})],S.prototype,"baseline",void 0);M([L({default:[],mapper:ui.resolve,tween:ui.lerp})],S.prototype,"fill",void 0);M([L({default:W.bar.stroke,mapper:mi.resolve,tween:mi.lerp})],S.prototype,"barStroke",void 0);M([L({default:W.bar.shadow,mapper:fi.resolve,tween:fi.lerp})],S.prototype,"barShadow",void 0);M([L({default:W.bar.cornerRadius})],S.prototype,"cornerRadius",void 0);M([L({default:1})],S.prototype,"growth",void 0);M([L({default:()=>[]})],S.prototype,"dims",void 0);M([L({default:!1})],S.prototype,"showValues",void 0);M([L({default:W.valueStyle})],S.prototype,"valueStyle",void 0);M([L({default:!0})],S.prototype,"enabled",void 0);M([us()],S.prototype,"enter",null);var b=function(o,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var l=o.length-1;l>=0;l--)(n=o[l])&&(s=(r<3?n(s):r>3?n(e,t,s):n(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Ve,_s=64,Ms=40,Ls=56,ks=34,Cs=30,Os=24,Ps=20,Fs=20,xi=.35,Ds=.5,Is=.15,g=class extends Rs{static{Ve=this}vAxis;cAxis;legend=null;barSets=[];get resolvedTheme(){return this.theme}static DEFAULT_MARKERS=5;get valueScale(){let e=(this.valueAxis.ticks?.length??Ve.DEFAULT_MARKERS)-1;return ct(this.data,this.series,this.stacked,this.valueAxis.range,e)}valueLabel(e){let t=this.valueAxis.format;return t===void 0?F(e):Ts(e,t)}get resolvedMarkers(){return this.valueAxis.ticks??z(this.valueScale,Ve.DEFAULT_MARKERS-1)}get hasValueLabel(){return this.valueAxis.label!==""}get hasCategoryLabel(){return this.categoryAxis.label!==""}get leftInset(){return _s+(this.hasValueLabel?ks:0)}get bottomInset(){return Ms+(this.hasCategoryLabel?Cs:0)}plotBox(){let e=this.layoutBounds.width,t=this.layoutBounds.height,i=t/2,r=-t/2+(this.legend?Ls:0),s=-e/2+this.leftInset,n=e/2-Ps,l=i-Os,a=r+this.bottomInset;return{left:s,right:n,top:l,bottom:a}}plotSize(){let{left:e,right:t,top:i,bottom:r}=this.plotBox();return{w:t-e,h:i-r}}valueToY(e){let[t,i]=this.valueScale,{h:r}=this.plotSize();return i<=t?-r/2:((e-t)/(i-t)-.5)*r}get baselinePx(){let[e,t]=this.valueScale;return this.valueToY(Math.min(Math.max(0,e),t))}get slotWidth(){let e=this.data.length;return e>0?this.plotSize().w/e:0}slotCenter(e){return-this.plotSize().w/2+this.slotWidth*(e+.5)}get slotInner(){return this.slotWidth*f(this.resolvedTheme.bar.slotFill)}weightAt(e){return Math.max(0,this.weights[e]??1)}get totalWeight(){let e=0;for(let t=0;t<this.series.length;t++)e+=this.weightAt(t);return e>0?e:1}weightBefore(e){let t=0;for(let i=0;i<e;i++)t+=this.weightAt(i);return t}seriesBars(e){let t=this.series[e];if(!t)return[];let i=this.stacked,r=this.slotInner,s=this.resolvedTheme.bar.groupGap,n=r/this.totalWeight,l=this.weightAt(e);return this.data.map((a,h)=>{let c=je(i?this.weightedRow(a):a,this.series,i)[e]??{from:0,to:0,value:0},p=i?at(a,this.series):e,u=this.slotCenter(h)-r/2,R=i?this.slotCenter(h):u+n*this.weightBefore(e)+n*l/2,C=i?r:Math.max(0,n*l-(this.series.length>1?s:0));return{x:R,width:C,from:this.valueToY(c.from),to:this.valueToY(c.to),round:p===e,value:E(a,t.field)}})}weightedRow(e){let t={...e};return this.series.forEach((i,r)=>{let s=e[i.field];typeof s=="number"&&(t[i.field]=s*this.weightAt(r))}),t}categoryDims(){let e=f(this.spotlightReveal),t=this.resolvedTheme.spotlight.dimOpacity,i=this.spotlight;return this.data.map((r,s)=>e<=0||i===s?1:1-(1-t)*e)}constructor(e){super(e);let t=this.series.map(a=>a.enabled??!0);this.weights=t.map(a=>a?1:0);let i=e?.showLegend!==!1,r=e?.showValues===!0;this.vAxis=new le({range:()=>this.valueScale,markers:()=>this.resolvedMarkers,axis:()=>this.resolvedTheme.yAxis,label:this.valueAxis.label??"",width:"hug",height:"fill"}),this.vAxis.labelFor=a=>this.valueLabel(a),this.cAxis=new B({categories:ht(this.data,this.categoryField),axis:()=>this.resolvedTheme.xAxis,label:this.categoryAxis.label??"",dims:()=>this.categoryDims(),width:"fill",height:"hug"}),this.barSets=this.series.map((a,h)=>new S({bars:()=>this.seriesBars(h),baseline:()=>this.baselinePx,fill:()=>Ye(this.resolvedTheme.seriesFills,a,h),barStroke:()=>this.resolvedTheme.bar.stroke,barShadow:()=>this.resolvedTheme.bar.shadow,cornerRadius:()=>this.resolvedTheme.bar.cornerRadius,growth:()=>this.growth,dims:()=>this.categoryDims(),showValues:r,valueStyle:this.resolvedTheme.valueStyle,enabled:t[h]}));for(let a of this.barSets)a.labelFor=h=>this.valueLabel(h);i&&(this.legend=new Be({series:this.series,swatches:()=>this.series.map((a,h)=>Ye(this.resolvedTheme.seriesFills,a,h)),legend:()=>this.resolvedTheme.legend}));let s=new we({clip:!0,children:[new Ie({fill:()=>this.resolvedTheme.plotArea.fill,shadow:()=>this.resolvedTheme.plotArea.shadow,xGridStroke:()=>this.resolvedTheme.xAxis.lineStyle,yGridStroke:()=>this.resolvedTheme.yAxis.lineStyle,xMarkers:[],yMarkers:()=>this.resolvedMarkers,xExtent:()=>[0,1],yExtent:()=>this.valueScale}),...this.barSets,new De({stroke:()=>this.resolvedTheme.plotArea.stroke})]}),n=new le({opacity:0,range:()=>this.valueScale,markers:()=>this.resolvedMarkers,axis:()=>this.resolvedTheme.yAxis,label:this.valueAxis.label??"",width:"hug",height:0}),l=[this.cAxis];this.legend&&l.push(this.legend),this.add(new we({flow:"vertical",width:"fill",height:"fill",children:[new we({flow:"horizontal",height:"fill",width:"fill",children:[this.vAxis,s]}),new we({flow:"horizontal",width:"fill",children:[n,new we({flow:"vertical",width:"fill",gap:20,children:l})]})]}))}arm(){this.vAxis.arm(),this.cAxis.arm(),this.growth=0,this.legend?.set({opacity:0,y:-Fs})}enter(e){let{duration:t}=e,i=e.easing??pe();return this.arm(),We(Es(ut(this.vAxis.enter({data:{slide:24},duration:t*xi,easing:i}),this.cAxis.enter({data:{slide:24},duration:t*xi,easing:i})),this.riseBars(t*Ds,i),...this.legend?[this.legend.to({data:{opacity:1,y:0},duration:t*Is,easing:i})]:[]),t)}riseBars(e,t){return this.command(i=>({growth:i}),e,t)}showSeries(e){let{seriesIndex:t=0}=e.data??{};return this.toggleSeries(t,1,e.duration??.35,e.easing??pe())}hideSeries(e){let{seriesIndex:t=0}=e.data??{};return this.toggleSeries(t,0,e.duration??.35,e.easing??pe())}toggleSeries(e,t,i,r){let s=this.barSets[e];return s?We(ut(this.tweenWeight(e,t,i,r),gi(i,n=>{let l=n>=1?t:Math.max(t,1-n);s.set({enabled:t>0||l>0})}),...this.legend?[t>0?this.legend.showSeries({data:{index:e},duration:i,easing:r}):this.legend.hideSeries({data:{index:e},duration:i,easing:r})]:[]),i):We(yi(i))}spotlightSeries(e){let{seriesIndex:t=0}=e.data??{},i=e.duration??.35,r=e.easing??pe(),s=this.resolvedTheme.spotlight.dimOpacity;return We(ut(...this.barSets.map((n,l)=>n.to({data:{opacity:l===t?1:s},duration:i,easing:r})),...this.legend?[this.legend.spotlightSeries({data:{index:t},duration:i,easing:r})]:[]),i)}tweenWeight(e,t,i,r){let s=this.series.map((l,a)=>this.weightAt(a)),n=s[e]??1;return n===t?yi(i):gi(i,l=>{let a=[...s];a[e]=n+(t-n)*r(l),this.weights=a})}spotlightCategory(e){let{categoryIndex:t=0}=e.data??{},i=e.duration??.4,r=e.easing??pe();if(t<0||t>=this.data.length)return this.holdSpotlight(i);let s=this.spotlightReveal;return this.command(n=>({spotlight:t,spotlightReveal:s+(1-s)*n}),i,r)}clearCategory(e){let t=e.duration??.4,i=e.easing??pe(),r=this.spotlightReveal;return r===0?this.holdSpotlight(t):this.command(s=>s>=1?{spotlight:null,spotlightReveal:0}:{spotlightReveal:r*(1-s)},t,i)}holdSpotlight(e){return this.command(()=>({}),e)}};b([k({default:()=>[]})],g.prototype,"data",void 0);b([k({default:""})],g.prototype,"categoryField",void 0);b([k({default:()=>[]})],g.prototype,"series",void 0);b([k({default:!1})],g.prototype,"stacked",void 0);b([k({default:{},mapper:te,tween:q})],g.prototype,"valueAxis",void 0);b([k({default:{},mapper:te,tween:q})],g.prototype,"categoryAxis",void 0);b([k({default:W,mapper:dt,tween:pt})],g.prototype,"theme",void 0);b([k({default:1})],g.prototype,"growth",void 0);b([k({default:()=>[]})],g.prototype,"weights",void 0);b([k({default:null})],g.prototype,"spotlight",void 0);b([k({default:0})],g.prototype,"spotlightReveal",void 0);b([ue()],g.prototype,"enter",null);b([ue({args:[{key:"seriesIndex",kind:"series",default:0,min:0,step:1}]})],g.prototype,"showSeries",null);b([ue({args:[{key:"seriesIndex",kind:"series",default:0,min:0,step:1}]})],g.prototype,"hideSeries",null);b([ue({args:[{key:"seriesIndex",kind:"series",default:0,min:0,step:1}]})],g.prototype,"spotlightSeries",null);b([ue({args:[{key:"categoryIndex",kind:"number",default:0,min:0,step:1}]})],g.prototype,"spotlightCategory",null);b([ue()],g.prototype,"clearCategory",null);g=Ve=b([ws({key:"barChart",parentKey:"node",forkable:!0,layout:{children:"freeform",defaultWidthMode:"fixed",defaultHeightMode:"fixed",acceptsChildren:!0},seed:{width:760,height:460}})],g);import{Rect as dr,command as xe,node as pr,Node2D as ur,easeOut as ye,property as G}from"@motionscript/sdk";import{command as Bs,Rect as Ke,Text as Ns,easeOut as Gs,property as ft,textOps as Us}from"@motionscript/sdk";import{at as Hs,compose as Xs,hold as zs}from"@motionscript/sdk/component";var qe=function(o,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var l=o.length-1;l>=0;l--)(n=o[l])&&(s=(r<3?n(s):r>3?n(e,t,s):n(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},js=16,V=class extends Ke{items=[];constructor(e){super({...e,flow:"vertical",align:"centerLeft",width:"hug",height:"hug"}),this.set({gap:this.legend.itemGap/3,padding:this.legend.padding});for(let t=0;t<this.slices.length;t++){let i=this.buildItem(this.slices[t]);this.items.push(i),this.add(new Ke({width:"hug",height:"hug",flow:"freeform",opacity:()=>f(this.dims[t]??1),children:[i]}))}}buildItem(e){let t=this.legend.markerStyle;return new Ke({flow:"horizontal",gap:12,align:"center",width:"hug",height:"hug",children:[new Ke({width:t.height,height:t.height,cornerRadius:t.borderRadius,fill:e.fill,stroke:t.stroke,shadow:t.shadow}),new Ns({...Us.styleProps(this.legend.textStyle),text:e.category})]})}arm(e=js){for(let t of this.items)t.set({opacity:0,x:e})}enter(e){let t=e.duration,i=e.easing??Gs(),r=this.items;if(r.length===0)return zs(t);this.arm();let s=t/(1+Math.max(0,r.length-1)/5),n=s/5;return Xs(r.map((l,a)=>Hs(a*n,l.to({data:{opacity:1,x:0},duration:s,easing:i}))))}};qe([ft({default:()=>[]})],V.prototype,"slices",void 0);qe([ft({default:X})],V.prototype,"legend",void 0);qe([ft({default:()=>[]})],V.prototype,"dims",void 0);qe([Bs()],V.prototype,"enter",null);import{Rect as St,command as Tt,Graphics2D as Si,Node2D as Js,PathBuilder as Qs,Text as me,easeOut as At,fillOps as er,property as T,strokeOps as tr,textOps as ge}from"@motionscript/sdk";import{lerpNumber as Re,shadowOps as vi,strokeOps as $e,textOps as N}from"@motionscript/sdk";function gt(o,e,t,i){return o.map((r,s)=>({category:ie(r,e),value:E(r,t),fill:i.length>0?i[s%i.length]:"white"}))}var Ys=Math.PI/180;function yt(o){return o.value>0&&Number.isFinite(o.value)?o.value:0}function bi(o){let e=0;for(let t of o)e+=yt(t);return e}function fe(o,e){return{x:o*Math.sin(e),y:o*Math.cos(e)}}function xt(o,e){let t=bi(o);if(t<=0)return[];let i=[],r=e*Ys;return o.forEach((s,n)=>{let l=yt(s);if(l<=0)return;let a=l/t,h=r,d=h+a*Math.PI*2;r=d,i.push({index:n,a0:h,a1:d,mid:(h+d)/2,fraction:a})}),i}function Ze(o,e,t,i){o.sort((n,l)=>l.ideal-n.ideal);let r=t;for(let n of o)n.y=Math.min(n.ideal,r),r=n.y-e;let s=i;for(let n=o.length-1;n>=0;n--)o[n].y=Math.max(o[n].y,s),s=o[n].y+e;return o}var mt={fontSize:26,fontWeight:600,textAlign:"center",fill:O.markerColor},K={sliceFills:_e,ring:{gap:6,holeRadius:.6,startAngle:0,selectedGrow:1.08,stroke:[],shadow:[]},label:{textStyle:mt,percentStyle:{...mt,fontWeight:700},insideStyle:{...mt,fontWeight:800,fill:"#15130e"},leaderStroke:{weight:2,fill:O.markerColor}},center:{labelStyle:{fontSize:46,fontWeight:800,textAlign:"center",fill:O.markerColor},captionStyle:{fontSize:22,fontWeight:500,textAlign:"center",fill:O.markerColor}},legend:X,spotlight:{dimOpacity:P}};function Ws(o,e){return{gap:o?.gap??e.gap,holeRadius:o?.holeRadius??e.holeRadius,startAngle:o?.startAngle??e.startAngle,selectedGrow:o?.selectedGrow??e.selectedGrow,stroke:$e.resolve(o?.stroke??e.stroke),shadow:vi.resolve(o?.shadow??e.shadow)}}function Vs(o,e,t){return{gap:Re(o.gap,e.gap,t),holeRadius:Re(o.holeRadius,e.holeRadius,t),startAngle:Re(o.startAngle,e.startAngle,t),selectedGrow:Re(o.selectedGrow,e.selectedGrow,t),stroke:$e.lerp(o.stroke,e.stroke,t),shadow:vi.lerp(o.shadow,e.shadow,t)}}function Ks(o,e){return{textStyle:N.resolveStyle(o?.textStyle,e.textStyle),percentStyle:N.resolveStyle(o?.percentStyle,e.percentStyle),insideStyle:N.resolveStyle(o?.insideStyle,e.insideStyle),leaderStroke:$e.resolve(o?.leaderStroke??e.leaderStroke)}}function qs(o,e,t){return{textStyle:N.lerpStyle(o.textStyle,e.textStyle,t),percentStyle:N.lerpStyle(o.percentStyle,e.percentStyle,t),insideStyle:N.lerpStyle(o.insideStyle,e.insideStyle,t),leaderStroke:$e.lerp(o.leaderStroke,e.leaderStroke,t)}}function $s(o,e){return{labelStyle:N.resolveStyle(o?.labelStyle,e.labelStyle),captionStyle:N.resolveStyle(o?.captionStyle,e.captionStyle)}}function Zs(o,e,t){return{labelStyle:N.lerpStyle(o.labelStyle,e.labelStyle,t),captionStyle:N.lerpStyle(o.captionStyle,e.captionStyle,t)}}function vt(o,e){let t=e??K;return{sliceFills:ke(o?.sliceFills,t.sliceFills),ring:Ws(o?.ring,t.ring),label:Ks(o?.label,t.label),center:$s(o?.center,t.center),legend:oe(o?.legend,t.legend),spotlight:{dimOpacity:o?.spotlight?.dimOpacity??t.spotlight.dimOpacity}}}function bt(o,e,t){return{sliceFills:Ce(o.sliceFills,e.sliceFills,t),ring:Vs(o.ring,e.ring,t),label:qs(o.label,e.label,t),center:Zs(o.center,e.center,t),legend:ne(o.legend,e.legend,t),spotlight:{dimOpacity:Re(o.spotlight.dimOpacity,e.spotlight.dimOpacity,t)}}}import{declarePaints as ir}from"@motionscript/sdk/component";var w=function(o,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var l=o.length-1;l>=0;l--)(n=o[l])&&(s=(r<3?n(s):r>3?n(e,t,s):n(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Ai=12,sr=14,wt=.62,rr=6,wi=34,Ri=26,Ti=8,or=.18,nr=240,lr=8,Ei=2,_i=.44,Rt=.62,ar=.78,hr=.9,Mi=.001,Li=26;function J(o,e=Li){let t=o.fontSize;return typeof t=="number"?t:e}function cr(o,e,t,i,r,s){let n=new Qs,l=e-o,a=Math.max(2,Math.ceil(Math.abs(l)/(Math.PI*2)*nr)),h=c=>c<=0?0:Math.min(r/c,l/2.2),d=(c,p)=>{let u=h(c),R=o+u,C=e-u,U=fe(c,R+(C-R)*p/a);return{x:U.x+s,y:U.y}};if(t<=0){n.moveTo(s,0);for(let c=0;c<=a;c++){let p=d(i,c);n.lineTo(p.x,p.y)}return n.close(),n}for(let c=0;c<=a;c++){let p=d(i,c);c===0?n.moveTo(p.x,p.y):n.lineTo(p.x,p.y)}for(let c=a;c>=0;c--){let p=d(t,c);n.lineTo(p.x,p.y)}return n.close(),n}var y=class extends Js{fills=[];constructor(e){if(super(e),this.fills=this.slices.map(t=>er.resolve(t.fill)),this.labelPlacement!=="none"&&this.labelMode!=="none")for(let t of this.arcs)this.addLabel(t);this.hasCenterLabel&&this.addCenterLabel()}addLabel(e){let t=this.slices[e.index],i=()=>f(this.labelReveal)*this.sliceOpacity(e.index),r=this.labelMode==="both"||this.labelMode==="category",s=this.labelMode==="both"||this.labelMode==="percent";if(this.labelPlacement==="inside"){let h=[];s&&h.push(new me({...ge.styleProps(this.label.insideStyle),text:Oe(e.fraction),fontSize:()=>this.insideFont})),r&&h.push(new me({...ge.styleProps(this.label.insideStyle),text:t.category,fontSize:()=>this.labelMode==="category"?this.insideFont:this.insideFont*_i})),this.add(new St({flow:"vertical",width:"hug",height:"hug",gap:0,align:"center",opacity:i,center:()=>this.insideAnchor(e.index),children:h}));return}let n=this.sideOf(e.mid),l=()=>this.placementFor(e.index)?.text??{x:0,y:0},a=[];r&&a.push(new me({...ge.styleProps(this.label.textStyle),text:t.category,textAlign:n>0?"left":"right"})),s&&a.push(new me({...ge.styleProps(this.label.percentStyle),text:Oe(e.fraction),textAlign:n>0?"left":"right"})),this.add(new St({flow:"vertical",width:"hug",height:"hug",gap:2,align:n>0?"centerLeft":"centerRight",opacity:i,centerLeft:n>0?l:void 0,centerRight:n>0?void 0:l,children:a}))}addCenterLabel(){let e=[];this.centerLabel!==""&&e.push(new me({...ge.styleProps(this.centerStyle.labelStyle),text:this.centerLabel,fontSize:()=>this.centerFont})),this.centerCaption!==""&&e.push(new me({...ge.styleProps(this.centerStyle.captionStyle),text:this.centerCaption,fontSize:()=>this.centerFont*(J(this.centerStyle.captionStyle,22)/J(this.centerStyle.labelStyle,46))})),this.add(new St({flow:"vertical",width:"hug",height:"hug",gap:2,align:"center",opacity:()=>f(this.centerReveal),center:()=>({x:this.centerX,y:0}),children:e}))}get arcs(){return xt(this.slices,this.ring.startAngle)}sideOf(e){return Math.sin(e)>=0?1:-1}get hasLeaderLabels(){return this.labelPlacement==="leader"&&this.labelMode!=="none"&&this.arcs.length>0}insideRoom(e){let t=this.outerRadius,i=this.holeRadius,r=i>0?t-i:t*(1-Rt)*2,s=i>0?(i+t)/2:t*Rt,n=Math.abs(Math.sin(e.mid)),l=Math.abs(Math.cos(e.mid)),a=n>Mi?r/n:1/0,h=l>Mi?(e.a1-e.a0)*s/l:1/0;return Math.max(0,Math.min(a,h))}insideGlyphs(e){let t=this.slices[e.index]?.category.length??0,i=this.labelMode==="both"||this.labelMode==="percent"?Oe(e.fraction).length:0,r=this.labelMode==="category"?t:this.labelMode==="both"?t*_i:0;return Math.max(1,i,r)}get insideFont(){let e=J(this.label.insideStyle,Li*1.9);for(let t of this.arcs){let i=this.insideRoom(t)*hr/(this.insideGlyphs(t)*wt);e=Math.min(e,i)}return Math.max(1,e)}get hasCenterLabel(){return this.centerLabel!==""||this.centerCaption!==""}get centerFont(){let e=J(this.centerStyle.labelStyle,46),t=this.holeRadius;if(t<=0)return e;let i=J(this.centerStyle.captionStyle,22)/Math.max(1,e),r=Math.max(1,this.centerLabel.length,this.centerCaption.length*i);return Math.min(e,t*2*ar/(r*wt))}get growFactor(){return Math.max(1,Math.min(1.6,this.ring.selectedGrow))}get maxPop(){return this.outerRadius*(this.growFactor-1)}get labelRowHeight(){if(!this.hasLeaderLabels)return 0;let e=J(this.label.textStyle)*1.25,t=J(this.label.percentStyle)*1.25;return this.labelMode==="both"?e+t+2:this.labelMode==="category"?e:t}captionGlyphs(e){let t=this.labelMode==="percent"||this.labelMode==="both"?4:0,i=this.labelMode==="category"||this.labelMode==="both"?this.slices[e]?.category.length??0:0;return Math.max(t,i)}get labelGutters(){let e={left:Ei,right:Ei};if(!this.hasLeaderLabels)return e;let t=J(this.label.textStyle)*wt;for(let i of this.arcs){let r=wi+Ri+Ti+this.captionGlyphs(i.index)*t+sr,s=this.sideOf(i.mid)>0?"right":"left";e[s]=Math.max(e[s],r)}return e}get centerX(){let{left:e,right:t}=this.labelGutters;return(e-t)/2}get outerRadius(){let{left:e,right:t}=this.labelGutters,i=Math.min((this.layoutBounds.width-e-t)/2,this.layoutBounds.height/2-this.labelRowHeight-4);return Math.max(0,i/this.growFactor)}get holeRadius(){let e=this.ring.holeRadius;if(e<=0)return 0;let t=e<1?e*this.outerRadius:e;return Math.min(t,this.outerRadius*.95)}get elbowRadius(){return this.outerRadius+this.maxPop+wi}popOf(e){return f(this.pops[e]??0)}anchorRadius(e){return this.outerRadius+this.maxPop*this.popOf(e)}bandMidRadius(e){let t=this.anchorRadius(e),i=this.holeRadius;return i>0?(i+t)/2:t*Rt}insideAnchor(e){let t=this.arcs.find(r=>r.index===e);if(t===void 0)return{x:this.centerX,y:0};let i=fe(this.bandMidRadius(e),t.mid);return{x:i.x+this.centerX,y:i.y}}get selectionStrength(){let e=0;for(let t=0;t<this.slices.length;t++)e=Math.max(e,this.popOf(t));return e}sliceOpacity(e){let t=this.selectionStrength;return t<=0?1:1-(1-f(this.dimOpacity))*t*(1-this.popOf(e))}placements(){if(!this.hasLeaderLabels)return[];let e=this.arcs;if(e.length===0||this.outerRadius<=0)return[];let t=this.elbowRadius,i=this.labelRowHeight,r=this.layoutBounds.height/2-i/2,s=-r,n=this.centerX,l=[],a=[];for(let h of e){let d=this.sideOf(h.mid),c=fe(t,h.mid).y;(d>0?l:a).push({index:h.index,side:d,mid:h.mid,ideal:c,y:c})}return Ze(l,i+Ai,r,s),Ze(a,i+Ai,r,s),[...l,...a].map(h=>{let d=fe(this.anchorRadius(h.index)+rr,h.mid),c=Math.sqrt(Math.max(0,t*t-h.y*h.y)),p=n+h.side*Math.max(c,t*or),u=n+h.side*(t+Ri);return{index:h.index,side:h.side,leader:[{x:d.x+n,y:d.y},{x:p,y:h.y},{x:u,y:h.y}],text:{x:u+h.side*Ti,y:h.y}}})}placementFor(e){return this.placements().find(t=>t.index===e)}declareAssets(e){super.declareAssets(e),ir(this,e,{fills:this.fills,strokes:[tr.resolve(this.label.leaderStroke)]})}renderSelf(e){let t=this.outerRadius;if(t<=0)return;let i=this.arcs;if(i.length===0)return;let r=f(this.growth),s=this.ring.startAngle*(Math.PI/180)+Math.PI*2*r,n=this.holeRadius,l=Math.max(0,this.ring.gap)/2,a=this.centerX,h=t+this.maxPop+1+Math.abs(a),d=[-h,-h,h,h],c=h*2;for(let u of i){let R=Math.min(u.a1,s);if(R<=u.a0)continue;let C=cr(u.a0,R,n,this.anchorRadius(u.index),l,a),U=new Si().path(C.toPathState({centerBounds:d,width:c,height:c}));U.shadow(this.ring.shadow),U.fill(this.fills[u.index]??[]),U.stroke(this.ring.stroke),e.draw(U.opacity(this.sliceOpacity(u.index)))}let p=f(this.labelReveal);if(!(p<=.001))for(let u of this.placements())e.draw(new Si().line({points:u.leader,radius:lr}).stroke(this.label.leaderStroke).opacity(p*this.sliceOpacity(u.index)))}sweep(e){return this.command(t=>({growth:t}),e.duration,e.easing??At())}revealLabels(e){return this.command(t=>({labelReveal:t}),e.duration,e.easing??At())}revealCenter(e={}){let t=f(this.centerReveal);return this.command(i=>({centerReveal:t+(1-t)*i}),e.duration??.6,e.easing??At())}};w([T({default:()=>[]})],y.prototype,"slices",void 0);w([T({default:K.ring})],y.prototype,"ring",void 0);w([T({default:K.label})],y.prototype,"label",void 0);w([T({default:K.center})],y.prototype,"centerStyle",void 0);w([T({default:"percent"})],y.prototype,"labelMode",void 0);w([T({default:"leader"})],y.prototype,"labelPlacement",void 0);w([T({default:1})],y.prototype,"growth",void 0);w([T({default:1})],y.prototype,"labelReveal",void 0);w([T({default:()=>[]})],y.prototype,"pops",void 0);w([T({default:K.spotlight.dimOpacity})],y.prototype,"dimOpacity",void 0);w([T({default:""})],y.prototype,"centerLabel",void 0);w([T({default:""})],y.prototype,"centerCaption",void 0);w([T({default:1})],y.prototype,"centerReveal",void 0);w([Tt()],y.prototype,"sweep",null);w([Tt()],y.prototype,"revealLabels",null);w([Tt()],y.prototype,"revealCenter",null);import{asCommand as fr,hold as mr,sequence as gr,together as yr}from"@motionscript/sdk/component";var A=function(o,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var l=o.length-1;l>=0;l--)(n=o[l])&&(s=(r<3?n(s):r>3?n(e,t,s):n(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},xr=.65,Et=.35,x=class extends ur{ring;legend=null;get resolvedTheme(){return this.theme}get slices(){return gt(this.data,this.categoryField,this.valueField,this.resolvedTheme.sliceFills)}sliceDims(){let e=0;for(let i=0;i<this.data.length;i++)e=Math.max(e,this.popAt(i));let t=this.resolvedTheme.spotlight.dimOpacity;return e<=0?this.data.map(()=>1):this.data.map((i,r)=>1-(1-f(t))*e*(1-this.popAt(r)))}popAt(e){return f(this.pops[e]??0)}constructor(e){super(e);let t=this.slices,i=e?.showLegend!==!1;this.pops=t.map(()=>0),this.ring=new y({width:"fill",height:"fill",slices:t,ring:()=>this.resolvedTheme.ring,label:()=>this.resolvedTheme.label,centerStyle:()=>this.resolvedTheme.center,labelMode:this.labelMode,labelPlacement:this.labelPlacement,pops:()=>this.pops,dimOpacity:()=>this.resolvedTheme.spotlight.dimOpacity,centerLabel:this.centerLabel,centerCaption:this.centerCaption,centerReveal:e?.showCenter===!1?0:1});let r=[this.ring];i&&(this.legend=new V({slices:t,legend:()=>this.resolvedTheme.legend,dims:()=>this.sliceDims()}),r.push(this.legend)),this.add(new dr({flow:"horizontal",width:"fill",height:"fill",gap:this.gap,align:"center",children:r}))}arm(){this.ring.set({growth:0,labelReveal:0}),this.legend?.arm()}enter(e){let t=e.duration,i=e.easing??ye();return this.arm(),fr(gr(this.ring.sweep({duration:t*xr,easing:i}),yr(this.ring.revealLabels({duration:t*Et,easing:i}),this.legend?this.legend.enter({duration:t*Et,easing:i}):mr(t*Et))),t)}revealCenter(e={}){return this.ring.revealCenter({duration:e.duration??.6,easing:e.easing??ye()})}isSelected(e){return this.popAt(e)>.5}selectSlice(e){let{sliceIndex:t}=e.data,i=e.duration??.45,r=e.easing??ye();return this.tweenPops(s=>s===t?1:this.popAt(s),i,r)}deselectSlice(e){let{sliceIndex:t}=e.data,i=e.duration??.45,r=e.easing??ye();return this.tweenPops(s=>s===t?0:this.popAt(s),i,r)}selectOnlySlice(e){let{sliceIndex:t}=e.data,i=e.duration??.45,r=e.easing??ye();return this.tweenPops(s=>s===t?1:0,i,r)}clearSelection(e={}){let t=e.duration??.45,i=e.easing??ye();return this.tweenPops(()=>0,t,i)}tweenPops(e,t,i){let r=this.data.map((n,l)=>this.popAt(l)),s=this.data.map((n,l)=>f(e(l)));return r.every((n,l)=>n===s[l])?this.command(()=>({}),t):this.command(n=>({pops:r.map((l,a)=>l+(s[a]-l)*n)}),t,i)}};A([G({default:()=>[]})],x.prototype,"data",void 0);A([G({default:""})],x.prototype,"categoryField",void 0);A([G({default:""})],x.prototype,"valueField",void 0);A([G({default:K,mapper:vt,tween:bt})],x.prototype,"theme",void 0);A([G({default:"percent"})],x.prototype,"labelMode",void 0);A([G({default:"leader"})],x.prototype,"labelPlacement",void 0);A([G({default:40})],x.prototype,"gap",void 0);A([G({default:""})],x.prototype,"centerLabel",void 0);A([G({default:""})],x.prototype,"centerCaption",void 0);A([G({default:()=>[]})],x.prototype,"pops",void 0);A([xe()],x.prototype,"enter",null);A([xe()],x.prototype,"revealCenter",null);A([xe({args:[{key:"sliceIndex",kind:"number",default:0,min:0,step:1}]})],x.prototype,"selectSlice",null);A([xe({args:[{key:"sliceIndex",kind:"number",default:0,min:0,step:1}]})],x.prototype,"deselectSlice",null);A([xe({args:[{key:"sliceIndex",kind:"number",default:0,min:0,step:1}]})],x.prototype,"selectOnlySlice",null);A([xe()],x.prototype,"clearSelection",null);x=A([pr({key:"pieChart",parentKey:"node",forkable:!0,layout:{children:"freeform",defaultWidthMode:"fixed",defaultHeightMode:"fixed",acceptsChildren:!0},seed:{width:680,height:480}})],x);var vr=[m,g,x];export{g as BarChart,O as CHART_PALETTE,B as CategoryAxis,S as ChartBars,De as ChartBorder,Ie as ChartCanvas,Be as ChartLegend,_ as ChartLine,j as ChartRegion,W as DEFAULT_BAR_CHART_THEME,Q as DEFAULT_CHART_THEME,X as DEFAULT_LEGEND,K as DEFAULT_PIE_CHART_THEME,Ee as DEFAULT_PLOT_AREA,br as DEFAULT_SERIES_COLORS,_e as DEFAULT_SERIES_FILLS,Mt as DEFAULT_SERIES_STROKES,H as DEFAULT_X_AXIS,Te as DEFAULT_Y_AXIS,ae as EMPTY_REGION_BOX,D as HorizontalAxis,m as LineChart,vr as NODES,x as PieChart,V as PieLegend,y as PieRing,P as SPOTLIGHT_DIM,le as VerticalAxis,ht as barCategories,je as barSpans,pi as barValueExtent,f as clampUnit,Qe as clipPolylineToBox,Fe as enterBudget,ei as formatInstant,F as formatMarker,Oe as formatPercent,he as hasRegion,re as lerpAxisConfig,q as lerpAxisDomain,pt as lerpBarChartTheme,tt as lerpChartTheme,ne as lerpLegendConfig,bt as lerpPieChartTheme,Le as lerpPlotArea,Ce as lerpSeriesFills,kt as lerpSeriesStrokes,z as markerValues,Pe as niceStep,E as num,Sr as numericFields,Qt as parseInstant,xt as pieArcs,Ze as relaxLabels,se as resolveAxisConfig,te as resolveAxisDomain,dt as resolveBarChartTheme,Ye as resolveBarFill,ct as resolveBarScale,et as resolveChartTheme,oe as resolveLegendConfig,Ar as resolvePalettePaint,vt as resolvePieChartTheme,gt as resolvePieSlices,Me as resolvePlotArea,Je as resolveRegionBox,Ot as resolveSeriesFill,ke as resolveSeriesFills,Ct as resolveSeriesStroke,Lt as resolveSeriesStrokes,ot as resolveXScale,st as resolveYScale,fe as ringPoint,it as seriesPoints,bi as sliceTotal,yt as sliceValue,at as stackCapIndex,ie as text,Dt as yExtent};
|
|
1
|
+
import{A as It,B as Bt,C as br,D as F,E as Ie,F as it,G as z,H as Ae,I as Be,J as Ne,K as Ge,L as Ue,M as he,a as se,b as U,c as Se,d as O,e as xr,f as P,g as u,h as M,i as re,j as vr,k as H,l as ke,m as Ce,n as j,o as Pt,p as Le,q as oe,r as ne,s as Oe,t as Pe,u as le,v as ae,w as Ft,x as Dt,y as Fe,z as De}from"./chunks/chunk-5ZPBV6BU.js";import{command as $,node as os,Node2D as ns,Rect as Re,easeOut as Y,property as W}from"@motionscript/sdk";import{Graphics2D as ht,Node2D as Wi,command as Vi,easeOut as Ht,strokeOps as jt,property as pe}from"@motionscript/sdk";import{Fills as Ni,fillOps as Nt,lerpNumber as Gi,strokeOps as Gt}from"@motionscript/sdk";var ce={left:0,right:0,bottom:0,top:0,xBounded:!1,yBounded:!1};function de(o){return o.right>o.left&&o.top>o.bottom}function st(o,e,t,i){if(!o||o.x===void 0&&o.y===void 0)return ce;let r=(c,[p,S],x,k)=>{if(c===void 0||S<=p)return[x,k,!1];let te=Math.min(c[0],c[1]),ie=Math.max(c[0],c[1]),Ot=Bi=>x+(Bi-p)/(S-p)*(k-x);return[Math.max(x,Math.min(k,Ot(te))),Math.max(x,Math.min(k,Ot(ie))),!0]},[s,n,l]=r(o.x,t,e.left,e.right),[a,h,d]=r(o.y,i,e.bottom,e.top);return{left:s,right:n,bottom:a,top:h,xBounded:l,yBounded:d}}function rt(o,e){if(o.length<2||!de(e))return[];let t=[],i=[];for(let r=1;r<o.length;r++){let s=Hi(o[r-1],o[r],e);if(!s){i.length>=2&&t.push(i),i=[];continue}let[n,l]=s;i.length>0&&Ui(i[i.length-1],n)?i.push(l):(i.length>=2&&t.push(i),i=[n,l])}return i.length>=2&&t.push(i),t}function Ui(o,e){return Math.abs(o.x-e.x)<.5&&Math.abs(o.y-e.y)<.5}function Hi(o,e,t){let i=e.x-o.x,r=e.y-o.y,s=0,n=1,l=[[-i,o.x-t.left],[i,t.right-o.x],[-r,o.y-t.bottom],[r,t.top-o.y]];for(let[a,h]of l){if(a===0){if(h<0)return null;continue}let d=h/a;if(a<0){if(d>n)return null;d>s&&(s=d)}else{if(d<s)return null;d<n&&(n=d)}}return[{x:o.x+s*i,y:o.y+s*r},{x:o.x+n*i,y:o.y+n*r}]}var ji={...j,markerStyle:{...j.markerStyle,width:20,height:20,borderRadius:6}},J={seriesStyles:Pt,xAxis:H,yAxis:ke,plotArea:Ce,legend:ji,region:{stroke:{weight:3,fill:O.regionColor,dash:[14,12],cap:"butt"},fill:Ni.color(O.regionColor,{opacity:.08}),dimOpacity:P}};function zi(o,e){return{stroke:Gt.resolve(o?.stroke??e.stroke),fill:Nt.resolve(o?.fill??e.fill),dimOpacity:o?.dimOpacity??e.dimOpacity}}function Xi(o,e,t){return{stroke:Gt.lerp(o.stroke,e.stroke,t),fill:Nt.lerp(o.fill,e.fill,t),dimOpacity:Gi(o.dimOpacity,e.dimOpacity,t)}}function ot(o,e){let t=e??J;return{seriesStyles:Ft(o?.seriesStyles,t.seriesStyles),xAxis:oe(o?.xAxis,t.xAxis),yAxis:oe(o?.yAxis,t.yAxis),plotArea:Oe(o?.plotArea,t.plotArea),legend:le(o?.legend,t.legend),region:zi(o?.region,t.region)}}function nt(o,e,t){return{seriesStyles:Dt(o.seriesStyles,e.seriesStyles,t),xAxis:ne(o.xAxis,e.xAxis,t),yAxis:ne(o.yAxis,e.yAxis,t),plotArea:Pe(o.plotArea,e.plotArea,t),legend:ae(o.legend,e.legend,t),region:Xi(o.region,e.region,t)}}function lt(o,e,t){return o.map((i,r)=>[e.at(r),M(i,t.field)]).sort((i,r)=>i[0]-r[0])}function Ut(o,e){let t=1/0,i=-1/0;for(let r of o)for(let s of e){let n=M(r,s.field);n<t&&(t=n),n>i&&(i=n)}return t<=i?[t,i]:[0,1]}function at(o,e,t,i){if(t)return t;let[r,s]=Ut(o,e),n=Math.max(1,Math.round(i));if(s===r)return Yi(r,n);let l=Ae((s-r)/n);return[Math.floor(r/l)*l,Math.ceil(s/l)*l]}function Yi(o,e){if(o===0)return[0,1];let t=Ae(Math.abs(o)/e);return[o-t,o+t]}import{declarePaints as Ki}from"@motionscript/sdk/component";var Q=function(o,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var l=o.length-1;l>=0;l--)(n=o[l])&&(s=(r<3?n(s):r>3?n(e,t,s):n(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},_=class extends Wi{declareAssets(e){super.declareAssets(e),Ki(this,e)}renderSelf(e){if(!this.enabled)return;let t=this.points;if(t.length<2)return;let i=Math.max(0,Math.min(1,this.progress));if(i<=0)return;let r=this.tracePoints(t,i);if(r.length<2)return;let s=this.stroke,n=(s[0]?.weight??0)*2,l=this.spotlight;if(!de(l)){e.draw(new ht().line({points:r,radius:n}).stroke(s));return}e.draw(new ht().line({points:r,radius:n}).stroke(s).opacity(Math.max(0,Math.min(1,this.dimOpacity))));for(let a of rt(r,l))e.draw(new ht().line({points:a,radius:n}).stroke(s))}tracePoints(e,t){if(t>=1||e.length<2)return e;if(t<=0)return[];let i=[],r=0;for(let l=1;l<e.length;l++){let a=Math.hypot(e[l].x-e[l-1].x,e[l].y-e[l-1].y);i.push(a),r+=a}if(r===0)return e;let s=r*t,n=[e[0]];for(let l=0;l<i.length;l++)if(s>=i[l])n.push(e[l+1]),s-=i[l];else{let a=i[l]===0?0:s/i[l];n.push({x:e[l].x+(e[l+1].x-e[l].x)*a,y:e[l].y+(e[l+1].y-e[l].y)*a});break}return n}enter(e){return this.enterFrom(0,e.duration,e.easing??Ht())}enterFrom(e,t,i=Ht(),r=1){return this.command(s=>{let n=e+(r-e)*s;return{progress:n,enabled:n>0}},t,i)}};Q([pe({default:()=>[]})],_.prototype,"points",void 0);Q([pe({default:[],mapper:jt.resolve,tween:jt.lerp})],_.prototype,"stroke",void 0);Q([pe({default:1})],_.prototype,"progress",void 0);Q([pe({default:!0})],_.prototype,"enabled",void 0);Q([pe({default:()=>ce})],_.prototype,"spotlight",void 0);Q([pe({default:P})],_.prototype,"dimOpacity",void 0);Q([Vi()],_.prototype,"enter",null);import{Graphics2D as zt,Node2D as qi,fillOps as Xt,strokeOps as Yt,property as je}from"@motionscript/sdk";import{declarePaints as $i}from"@motionscript/sdk/component";var He=function(o,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var l=o.length-1;l>=0;l--)(n=o[l])&&(s=(r<3?n(s):r>3?n(e,t,s):n(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},X=class extends qi{declareAssets(e){super.declareAssets(e),$i(this,e)}renderSelf(e){let t=this.box;if(!de(t))return;let i=Math.max(0,Math.min(1,this.reveal));if(i<=0)return;let r=t.right-t.left,s=t.top-t.bottom,n=(t.left+t.right)/2,l=(t.bottom+t.top)/2;if(this.fill.length>0&&e.draw(new zt().rect({x:n,y:l,width:r,height:s}).fill(this.fill).opacity(i)),this.stroke.length===0)return;let d=c=>e.draw(new zt().line({points:c}).stroke(this.stroke).opacity(i));if(t.xBounded){let c=s/2*i;for(let p of[t.left,t.right])d([{x:p,y:l-c},{x:p,y:l+c}])}if(t.yBounded){let c=r/2*i;for(let p of[t.bottom,t.top])d([{x:n-c,y:p},{x:n+c,y:p}])}}};He([je({default:()=>ce})],X.prototype,"box",void 0);He([je({default:J.region.stroke,mapper:Yt.resolve,tween:Yt.lerp})],X.prototype,"stroke",void 0);He([je({default:J.region.fill,mapper:Xt.resolve,tween:Xt.lerp})],X.prototype,"fill",void 0);He([je({default:0})],X.prototype,"reveal",void 0);import{command as Zi,Node2D as Ji,Rect as Wt,Text as Vt,easeOut as Qi,property as ze,insetsOps as Kt,textOps as qt}from"@motionscript/sdk";import{at as $t,compose as Zt}from"@motionscript/sdk/component";var we=function(o,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var l=o.length-1;l>=0;l--)(n=o[l])&&(s=(r<3?n(s):r>3?n(e,t,s):n(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Jt=24,D=class extends Ji{labelFor=F;markerNodes=[];labelNode=null;get sortedMarkers(){return[...this.markers].sort((e,t)=>e-t)}valueAt(e){return this.sortedMarkers[e]}fracAt(e){let t=this.valueAt(e);if(t===void 0)return 0;let[i,r]=this.range;return r<=i?0:(t-i)/(r-i)}constructor(e){super(e);let t=Kt.resolve(this.axis.tickPadding).top,i=Kt.resolve(this.axis.titlePadding).top;this.markerNodes=this.markers.map((s,n)=>{let l=new Vt({...qt.styleProps(this.axis.labelStyle),text:()=>{let a=this.valueAt(n);return a===void 0?"":this.labelFor(a)},x:()=>{let a=this.layoutBounds.width,h=(this.fracAt(n)-.5)*a,d=a/2-l.layoutBounds.width/2;return Math.min(h,d)}});return l});let r=[new Wt({width:"fill",height:"hug",padding:{top:t},children:this.markerNodes})];this.label!==""&&(this.labelNode=new Vt({...qt.styleProps(this.axis.titleStyle),text:this.label}),r.push(this.labelNode)),this.add(new Wt({flow:"vertical",gap:i,height:"hug",width:"fill",children:r}))}arm(e=Jt){for(let t of this.markerNodes)t.set({opacity:0,y:e});this.labelNode?.set({opacity:0,y:e})}enter(e){let{stagger:t,slide:i=Jt}=e.data??{},r=e.duration,s=e.easing??Qi(),n=this.markerNodes;if(n.length===0)return Zt([]);let{step:l,per:a,caption:h}=Be(r,n.length,this.labelNode!==null,t);this.arm(i);let d=n.map((p,S)=>$t(S*l,p.to({data:{opacity:1,y:0},duration:a,easing:s}))),c=n.length===0?0:(n.length-1)*l+a;return Zt([...d,...this.labelNode?[$t(c,this.labelNode.to({data:{opacity:1,y:0},duration:h,easing:s}))]:[]])}};we([ze({default:()=>[0,1]})],D.prototype,"range",void 0);we([ze({default:()=>[]})],D.prototype,"markers",void 0);we([ze({default:H})],D.prototype,"axis",void 0);we([ze({default:""})],D.prototype,"label",void 0);we([Zi()],D.prototype,"enter",null);import{formatNumber as es}from"@motionscript/sdk/component";var Xe=864e5,si=["january","february","march","april","may","june","july","august","september","october","november","december"],Qt=2024;function ei(o){return o.length<3?-1:si.findIndex(e=>e.startsWith(o))}function ts(o,e){let t=Date.UTC(o,0,4),i=(new Date(t).getUTCDay()+6)%7;return t-i*Xe+(e-1)*7*Xe}function ri(o){if(typeof o!="string")return null;let e=o.trim().toLowerCase();if(e==="")return null;let t=/^(\d{4})[-/](\d{1,2})(?:[-/](\d{1,2}))?$/.exec(e);if(t){let n=Number(t[2]),l=t[3]===void 0?1:Number(t[3]);return n<1||n>12||l<1||l>31?null:Date.UTC(Number(t[1]),n-1,l)}let i=/^(?:(\d{4})[-\s]?)?w(?:ee)?k?[-\s]?(\d{1,2})$/.exec(e);if(i){let n=Number(i[2]);return n<1||n>53?null:ts(i[1]===void 0?Qt:Number(i[1]),n)}let r=/^(?:(\d{4})[-\s]+)?([a-z]+)(?:[-\s]+(\d{4}))?$/.exec(e);if(r){let n=ei(r[2]);if(n>=0){let l=r[1]??r[3],a=l===void 0?Qt:Number(l);return Date.UTC(a,n,1)}}let s=/^(?:(\d{1,2})[-\s]+([a-z]+)|([a-z]+)[-\s]+(\d{1,2}),?)[-\s]+(\d{4})$/.exec(e);if(s){let n=ei(s[2]??s[3]),l=Number(s[1]??s[4]);if(n>=0&&l>=1&&l<=31)return Date.UTC(Number(s[5]),n,l)}return null}function oi(o,e){let t=new Date(o),i=t.getUTCFullYear(),r=si[t.getUTCMonth()].slice(0,3),s=r.charAt(0).toUpperCase()+r.slice(1);return e>4*365*Xe?String(i):e>60*Xe?`${s} ${i}`:`${s} ${t.getUTCDate()}`}function is(o,e){let t=!1;for(let i of o){let r=i[e];if(!(r==null||r==="")){if(typeof r!="number")return!1;t=!0}}return t}function ss(o,e){let t=[],i=!1;for(let n of o){let l=n[e];if(l==null||l===""){t.push(null);continue}let a=ri(l);if(a===null)return null;t.push(a),i=!0}if(!i)return null;let s=t.find(n=>n!==null);return t.map(n=>n===null?s:s=n)}function ti(o){let e=1/0,t=-1/0;for(let i of o)i<e&&(e=i),i>t&&(t=i);return e<=t?[e,t]:[0,1]}function ii(o,[e,t],i){let r=o.filter(a=>a>=e&&a<=t),s=[...new Set(r)].sort((a,h)=>a-h);if(s.length===0)return z([e,t],i);let n=a=>s.reduce((h,d)=>Math.abs(d-a)<Math.abs(h-a)?d:h),l=[];for(let a of z([e,t],i)){let h=n(a);l[l.length-1]!==h&&l.push(h)}return l}function rs(o,e,t,i){let r=o.indexOf(t);return r>=0?e[r]:i(t)}function ct(o,e,t){if(e!==""&&is(o,e)){let n=o.map(l=>M(l,e));return{kind:"numeric",at:l=>n[l]??0,extent:ti(n),label:l=>t===void 0?F(l):es(l,t),ticks:z}}let i=o.map(n=>re(n,e)),r=e===""?null:ss(o,e);if(r){let n=ti(r),l=n[1]-n[0];return{kind:"time",at:a=>r[a]??0,extent:n,label:a=>rs(r,i,a,h=>oi(h,l)),ticks:(a,h)=>ii(r,a,h)}}let s=o.map((n,l)=>l);return{kind:"ordinal",at:n=>n,extent:s.length>0?[0,s.length-1]:[0,1],label:n=>i[Math.round(n)]??"",ticks:(n,l)=>ii(s,n,l)}}import{asCommand as ee,formatNumber as ls,hold as Ye,sequence as ni,together as ue}from"@motionscript/sdk/component";var v=function(o,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var l=o.length-1;l>=0;l--)(n=o[l])&&(s=(r<3?n(s):r>3?n(e,t,s):n(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},I,as=24,dt={key:"seriesIndex",kind:"series",default:0,min:0,step:1},hs=20,li=.35,ai=.5,hi=.15,f=class extends ns{static{I=this}vAxis;hAxis;plotRect;legend=null;lines=[];get resolvedTheme(){return this.theme}static DEFAULT_MARKERS=5;get xColumn(){return ct(this.data,this.xField,this.xAxis.format)}get xScale(){return this.xAxis.range??this.xColumn.extent}get yScale(){let e=(this.yAxis.ticks?.length??I.DEFAULT_MARKERS)-1;return at(this.data,this.series,this.yAxis.range,e)}get resolvedYMarkers(){return this.yAxis.ticks??z(this.yScale,I.DEFAULT_MARKERS-1)}get resolvedXMarkers(){return this.xAxis.ticks??this.xColumn.ticks(this.xScale,I.DEFAULT_MARKERS-1)}plotSize(){let{width:e,height:t}=this.plotRect.layoutBounds;return{width:e,height:t}}seriesPixels(e){let t=this.series[e];if(!t)return[];let i=lt(this.data,this.xColumn,t);if(i.length===0)return[];let{width:r,height:s}=this.plotSize(),[n,l]=this.xScale,[a,h]=this.yScale,d=p=>l<=n?0:((p-n)/(l-n)-.5)*r,c=p=>h<=a?0:((p-a)/(h-a)-.5)*s;return i.map(([p,S])=>({x:d(p),y:c(S)}))}hasCallout(){let e=this.region;return e!=null&&(e.x!==void 0||e.y!==void 0)}regionBox(){let{width:e,height:t}=this.plotSize();return st(this.region,{left:-e/2,right:e/2,bottom:-t/2,top:t/2},this.xScale,this.yScale)}constructor(e){super(e);let t=this.series.map(n=>n.enabled??!0),i=this.showLegend!==!1;this.vAxis=new he({range:()=>this.yScale,markers:()=>this.resolvedYMarkers,axis:()=>this.resolvedTheme.yAxis,label:this.yAxis.label??"",width:"hug",height:"fill"}),this.vAxis.labelFor=n=>this.yAxis.format===void 0?F(n,Ie(this.resolvedYMarkers)):ls(n,this.yAxis.format),this.hAxis=new D({range:()=>this.xScale,markers:()=>this.resolvedXMarkers,axis:()=>this.resolvedTheme.xAxis,label:this.xAxis.label??"",width:"fill",height:"hug"}),this.hAxis.labelFor=n=>this.xColumn.label(n),this.lines=this.series.map((n,l)=>new _({points:()=>this.seriesPixels(l),stroke:()=>It(this.resolvedTheme.seriesStyles,n,l),enabled:t[l],spotlight:()=>this.regionBox(),dimOpacity:()=>1-(1-this.resolvedTheme.region.dimOpacity)*this.regionReveal})),i&&(this.legend=new Ue({series:this.series,swatches:()=>this.series.map((n,l)=>Bt(this.resolvedTheme.seriesStyles,n,l)),legend:()=>this.resolvedTheme.legend})),this.plotRect=new Re({clip:!0,children:[new Ge({fill:()=>this.resolvedTheme.plotArea.fill,shadow:()=>this.resolvedTheme.plotArea.shadow,xGridStroke:()=>this.resolvedTheme.xAxis.lineStyle,yGridStroke:()=>this.resolvedTheme.yAxis.lineStyle,xMarkers:()=>this.resolvedXMarkers,yMarkers:()=>this.resolvedYMarkers,xExtent:()=>this.xScale,yExtent:()=>this.yScale}),new X({box:()=>this.regionBox(),stroke:()=>this.resolvedTheme.region.stroke,fill:()=>this.resolvedTheme.region.fill,reveal:()=>this.regionReveal}),...this.lines,new Ne({stroke:()=>this.resolvedTheme.plotArea.stroke})]});let r=new he({opacity:0,range:()=>this.yScale,markers:()=>this.resolvedYMarkers,axis:()=>this.resolvedTheme.yAxis,label:this.yAxis.label??"",width:"hug",height:0}),s=[this.hAxis];this.legend&&s.push(this.legend),this.add(new Re({flow:"vertical",width:"fill",height:"fill",padding:{top:as},children:[new Re({flow:"horizontal",height:"fill",width:"fill",children:[this.vAxis,this.plotRect]}),new Re({flow:"horizontal",width:"fill",children:[r,new Re({flow:"vertical",width:"fill",gap:20,children:s})]})]}))}arm(){this.vAxis.arm(),this.hAxis.arm();for(let e of this.lines)e.set({progress:0});this.legend?.set({opacity:0,y:-hs})}enter(e){let t=e.duration,i=e.easing??Y();this.arm();let r=this.hasCallout()&&this.regionReveal===0,s=r?t*.75:t,n=ue(this.vAxis.enter({data:{slide:24},duration:s*li,easing:i}),this.hAxis.enter({data:{slide:24},duration:s*li,easing:i})),l=ue(Ye(s*ai),...this.lines.map(d=>d.enter({duration:s*ai,easing:i}))),a=this.legend?this.legend.to({data:{opacity:1,y:0},duration:s*hi,easing:i}):Ye(s*hi),h=ni(n,l,a);return ee(r?ni(h,this.command(d=>({regionReveal:d}),t*.25,i)):h,t)}spotlightRegion(e){let t=I.regionArg(e.data),i=e.duration??.5,r=e.easing??Y(),s=this.regionReveal,n=this.region;return t.x===void 0&&t.y===void 0?this.clearRegion({duration:i,easing:r}):s<=0||!this.hasCallout()?this.command(l=>({region:t,regionReveal:s+(1-s)*l}),i,r):this.command(l=>l<.5?{region:n,regionReveal:s*(1-r(l*2))}:{region:t,regionReveal:r(l*2-1)},i)}clearRegion(e={}){let t=e.duration??.5,i=e.easing??Y(),r=this.regionReveal;return r===0?this.command(()=>({region:null,regionReveal:0}),t):this.command(s=>s>=1?{region:null,regionReveal:0}:{regionReveal:r*(1-s)},t,i)}home=null;static regionArg(e){let t=e?.region;return t!=null&&typeof t=="object"?t:{}}static span([e,t]){return e<=t?[e,t]:[t,e]}static rescale(e,t){let i=I.span(e),r=Math.max(2,t.length);return{range:i,ticks:z(i,r-1)}}zoomTo(e){let t=I.regionArg(e.data),i=e.duration??.8,r=e.easing??Y();if(!t.x&&!t.y)return this.command(()=>({}),i);let s=this._domains();return this.home??=s,this._tweenAxes(s,{...t.x&&{x:{...s.x,...I.rescale(t.x,s.x.ticks)}},...t.y&&{y:{...s.y,...I.rescale(t.y,s.y.ticks)}}},i,r)}resetZoom(e={}){let t=e.duration??.8,i=e.easing??Y(),r=this.home;return r?(this.home=null,this._tweenAxes(this._domains(),r,t,i)):this.command(()=>({}),t)}showSeries(e){let t=e.data?.seriesIndex??0,i=e.duration??.35,r=e.easing??Y(),s=this.lines[t];return s?ee(ue(s.enterFrom(0,i,r),...this.legend?[this.legend.showSeries({data:{index:t},duration:i,easing:r})]:[]),i):ee(Ye(i))}hideSeries(e){let t=e.data?.seriesIndex??0,i=e.duration??.35,r=e.easing??Y(),s=this.lines[t];return s?ee(ue(s.enterFrom(1,i,r,0),...this.legend?[this.legend.hideSeries({data:{index:t},duration:i,easing:r})]:[]),i):ee(Ye(i))}spotlightSeries(e){let t=e.data?.seriesIndex??0,i=e.duration??.35,r=e.easing??Y();return ee(ue(...this.lines.map((s,n)=>s.to({data:{opacity:n===t?1:P},duration:i,easing:r})),...this.legend?[this.legend.spotlightSeries({data:{index:t},duration:i,easing:r})]:[]),i)}to(e){let t=e.data??{},i=this._domains(),r=Se(i.x,t.xAxis),s=Se(i.y,t.yAxis);if(!r&&!s)return super.to(e);let{xAxis:n,yAxis:l,...a}=t,h=this._tweenAxes(i,{...r&&{x:r},...s&&{y:s}},e.duration,e.easing??Y()),d={...a,...!r&&n&&{xAxis:n},...!s&&l&&{yAxis:l}};return Object.keys(d).length===0?h:ee(ue(super.to({...e,data:d}),h),e.duration)}_domains(){return{x:{...this.xAxis,range:this.xScale,ticks:this.resolvedXMarkers},y:{...this.yAxis,range:this.yScale,ticks:this.resolvedYMarkers}}}_tweenAxes(e,t,i,r){return this.command(s=>({...t.x&&{xAxis:U(e.x,t.x,s)},...t.y&&{yAxis:U(e.y,t.y,s)}}),i,r)}};v([W({default:()=>[],kind:"dataset"})],f.prototype,"data",void 0);v([W({default:""})],f.prototype,"xField",void 0);v([W({default:()=>[],kind:"series"})],f.prototype,"series",void 0);v([W({default:{},mapper:se,tween:U})],f.prototype,"xAxis",void 0);v([W({default:{},mapper:se,tween:U})],f.prototype,"yAxis",void 0);v([W({default:J,mapper:ot,tween:nt})],f.prototype,"theme",void 0);v([W({default:null})],f.prototype,"region",void 0);v([W({default:0})],f.prototype,"regionReveal",void 0);v([W({default:!0,animatable:!1})],f.prototype,"showLegend",void 0);v([$()],f.prototype,"enter",null);v([$({args:[{key:"region",kind:"region",properties:{x:{kind:"range",default:!0,defaultMin:0,defaultMax:100},y:{kind:"range",default:!1,defaultMin:0,defaultMax:100}}}]})],f.prototype,"spotlightRegion",null);v([$()],f.prototype,"clearRegion",null);v([$({args:[{key:"region",kind:"region",properties:{x:{kind:"range",default:!0,defaultMin:0,defaultMax:100},y:{kind:"range",default:!1,defaultMin:0,defaultMax:100}}}]})],f.prototype,"zoomTo",null);v([$()],f.prototype,"resetZoom",null);v([$({args:[dt]})],f.prototype,"showSeries",null);v([$({args:[dt]})],f.prototype,"hideSeries",null);v([$({args:[dt]})],f.prototype,"spotlightSeries",null);f=I=v([os({key:"lineChart",parentKey:"node",forkable:!0,layout:{children:"freeform",defaultWidthMode:"fixed",defaultHeightMode:"fixed",acceptsChildren:!0},seed:{width:760,height:460}})],f);import{command as me,node as Es,Node2D as ks,Rect as Me,easeOut as fe,property as L}from"@motionscript/sdk";import{formatNumber as Cs}from"@motionscript/sdk/component";import{asCommand as _e,drive as Ai,hold as xt,sequence as Ls,together as $e}from"@motionscript/sdk/component";import{command as cs,Node2D as ds,Rect as pt,Text as ci,easeOut as ps,property as We,insetsOps as di,textOps as pi}from"@motionscript/sdk";import{at as ui,compose as us,hold as fs}from"@motionscript/sdk/component";var Te=function(o,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var l=o.length-1;l>=0;l--)(n=o[l])&&(s=(r<3?n(s):r>3?n(e,t,s):n(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},fi=24,B=class extends ds{captionNodes=[];labelNode=null;slotCenter(e){let t=this.categories.length;if(t<=0)return 0;let i=this.layoutBounds.width;return-i/2+i/t*(e+.5)}constructor(e){super(e);let t=di.resolve(this.axis.tickPadding).top,i=di.resolve(this.axis.titlePadding).top,r=this.categories.map((n,l)=>{let a=new ci({...pi.styleProps(this.axis.labelStyle),text:n});return this.captionNodes.push(a),new pt({width:"hug",height:"hug",flow:"freeform",opacity:()=>u(this.dims[l]??1),x:()=>this.slotCenter(l),children:[a]})}),s=[new pt({width:"fill",height:"hug",padding:{top:t},children:r})];this.label!==""&&(this.labelNode=new ci({...pi.styleProps(this.axis.titleStyle),text:this.label}),s.push(this.labelNode)),this.add(new pt({flow:"vertical",gap:i,height:"hug",width:"fill",children:s}))}arm(e=fi){for(let t of this.captionNodes)t.set({opacity:0,y:e});this.labelNode?.set({opacity:0,y:e})}enter(e){let{stagger:t,slide:i=fi}=e.data??{},r=e.easing??ps(),s=this.captionNodes;if(s.length===0)return fs(e.duration);let{step:n,per:l,caption:a}=Be(e.duration,s.length,this.labelNode!==null,t);this.arm(i);let h=(s.length-1)*n+l;return us([...s.map((d,c)=>ui(c*n,d.to({data:{opacity:1,y:0},duration:l,easing:r}))),...this.labelNode?[ui(h,this.labelNode.to({data:{opacity:1,y:0},duration:a,easing:r}))]:[]])}};Te([We({default:()=>[]})],B.prototype,"categories",void 0);Te([We({default:H})],B.prototype,"axis",void 0);Te([We({default:""})],B.prototype,"label",void 0);Te([We({default:()=>[]})],B.prototype,"dims",void 0);Te([cs()],B.prototype,"enter",null);import{command as xs,Graphics2D as vs,Node2D as bs,Text as Ss,easeOut as As,fillOps as vi,shadowOps as bi,strokeOps as Si,property as C,textOps as ws}from"@motionscript/sdk";import{fillOps as ms,lerpNumber as Ve,shadowOps as mi,strokeOps as gi,textOps as yi}from"@motionscript/sdk";function Ke(o,e,t){let i=0;return e.map(r=>{let s=M(o,r.field);if(!t)return{from:0,to:s,value:s};let n=i;return i+=s,{from:n,to:i,value:s}})}function ut(o,e){let t=-1;for(let i=0;i<e.length;i++)M(o,e[i].field)!==0&&(t=i);return t}function ft(o,e){return o.map(t=>re(t,e))}function xi(o,e,t){let i=0,r=0;for(let s of o)for(let n of Ke(s,e,t))i=Math.min(i,n.from,n.to),r=Math.max(r,n.from,n.to);return i<r?[i,r]:[0,1]}function mt(o,e,t,i,r){if(i)return i;let[s,n]=xi(o,e,t),l=Math.max(1,Math.round(r)),a=Ae((n-s)/l||1);return[Math.floor(s/a)*a,Math.ceil(n/a)*a]}var V={seriesFills:Le,bar:{cornerRadius:6,slotFill:.72,groupGap:6,stroke:[],shadow:[]},xAxis:{...H,labelStyle:{...H.labelStyle,fontWeight:600},tickPadding:16},yAxis:ke,plotArea:Ce,legend:j,valueStyle:{fontSize:24,fontWeight:700,textAlign:"center",fill:O.markerColor},spotlight:{dimOpacity:P}};function gs(o,e){return{cornerRadius:o?.cornerRadius??e.cornerRadius,slotFill:o?.slotFill??e.slotFill,groupGap:o?.groupGap??e.groupGap,stroke:gi.resolve(o?.stroke??e.stroke),shadow:mi.resolve(o?.shadow??e.shadow)}}function ys(o,e,t){return{cornerRadius:Ve(o.cornerRadius,e.cornerRadius,t),slotFill:Ve(o.slotFill,e.slotFill,t),groupGap:Ve(o.groupGap,e.groupGap,t),stroke:gi.lerp(o.stroke,e.stroke,t),shadow:mi.lerp(o.shadow,e.shadow,t)}}function gt(o,e){let t=e??V;return{seriesFills:Fe(o?.seriesFills,t.seriesFills),bar:gs(o?.bar,t.bar),xAxis:oe(o?.xAxis,t.xAxis),yAxis:oe(o?.yAxis,t.yAxis),plotArea:Oe(o?.plotArea,t.plotArea),legend:le(o?.legend,t.legend),valueStyle:yi.resolveStyle(o?.valueStyle,t.valueStyle),spotlight:{dimOpacity:o?.spotlight?.dimOpacity??t.spotlight.dimOpacity}}}function yt(o,e,t){return{seriesFills:De(o.seriesFills,e.seriesFills,t),bar:ys(o.bar,e.bar,t),xAxis:ne(o.xAxis,e.xAxis,t),yAxis:ne(o.yAxis,e.yAxis,t),plotArea:Pe(o.plotArea,e.plotArea,t),legend:ae(o.legend,e.legend,t),valueStyle:yi.lerpStyle(o.valueStyle,e.valueStyle,t),spotlight:{dimOpacity:Ve(o.spotlight.dimOpacity,e.spotlight.dimOpacity,t)}}}function qe(o,e,t){return e.fill!=null?ms.resolve(e.fill):o.length===0?"white":o[t%o.length]}import{declarePaints as Rs}from"@motionscript/sdk/component";var E=function(o,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var l=o.length-1;l>=0;l--)(n=o[l])&&(s=(r<3?n(s):r>3?n(e,t,s):n(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Ts=10,Ms=1.6,_s=24,A=class extends bs{labelFor=F;constructor(e){if(super(e),!!this.showValues)for(let t=0;t<this.bars.length;t++)this.add(new Ss({...ws.styleProps(this.valueStyle),text:()=>this.captionAt(t),x:()=>this.bars[t]?.x??0,y:()=>this.captionY(t),opacity:()=>this.dimAt(t)}))}dimAt(e){return this.enabled?u(this.dims[e]??1):0}endsAt(e){let t=this.bars[e];if(!t)return null;let i=u(this.growth),r=this.baseline+(t.from-this.baseline)*i,s=this.baseline+(t.to-this.baseline)*i;return{base:r,end:s}}get valueSize(){let e=this.valueStyle.fontSize;return typeof e=="number"?e:_s}captionAt(e){let t=this.bars[e];if(!t||t.value===0)return"";if(this.insideAt(e)){let i=this.endsAt(e);if(!i||Math.abs(i.end-i.base)<this.valueSize*Ms)return""}return this.labelFor(t.value)}insideAt(e){let t=this.bars[e];return t!==void 0&&Math.abs(t.from-this.baseline)>.5}captionY(e){let t=this.endsAt(e);if(!t)return 0;if(this.insideAt(e))return(t.base+t.end)/2;let i=t.end>=t.base?1:-1;return t.end+i*(Ts+this.valueSize/2)}declareAssets(e){super.declareAssets(e),Rs(this,e,{fills:this.barShadow.map(t=>t.fill),strokes:[this.barStroke]})}renderSelf(e){if(this.enabled)for(let t=0;t<this.bars.length;t++){let i=this.bars[t],r=this.endsAt(t);if(!r||i.width<=0)continue;let s=Math.abs(r.end-r.base);if(s<=0)continue;let n=i.round?Math.min(this.cornerRadius,s):0,l=new vs,a=l.rect({x:i.x,y:(r.base+r.end)/2,width:i.width,height:s,cornerRadius:n>0?r.end>=r.base?{bottomLeft:n,bottomRight:n,topLeft:0,topRight:0}:{topLeft:n,topRight:n,bottomLeft:0,bottomRight:0}:0});a.shadow(this.barShadow),a.fill(this.fill),a.stroke(this.barStroke),e.draw(l.opacity(this.dimAt(t)))}}enter(e){return this.command(t=>({growth:t}),e.duration,e.easing??As())}};E([C({default:()=>[]})],A.prototype,"bars",void 0);E([C({default:0})],A.prototype,"baseline",void 0);E([C({default:[],mapper:vi.resolve,tween:vi.lerp})],A.prototype,"fill",void 0);E([C({default:V.bar.stroke,mapper:Si.resolve,tween:Si.lerp})],A.prototype,"barStroke",void 0);E([C({default:V.bar.shadow,mapper:bi.resolve,tween:bi.lerp})],A.prototype,"barShadow",void 0);E([C({default:V.bar.cornerRadius})],A.prototype,"cornerRadius",void 0);E([C({default:1})],A.prototype,"growth",void 0);E([C({default:()=>[]})],A.prototype,"dims",void 0);E([C({default:!1})],A.prototype,"showValues",void 0);E([C({default:V.valueStyle})],A.prototype,"valueStyle",void 0);E([C({default:!0})],A.prototype,"enabled",void 0);E([xs()],A.prototype,"enter",null);var b=function(o,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var l=o.length-1;l>=0;l--)(n=o[l])&&(s=(r<3?n(s):r>3?n(e,t,s):n(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},Ze,Os=24,Ps=20,wi=.35,Fs=.5,Ri=.15,m=class extends ks{static{Ze=this}vAxis;cAxis;legend=null;barSets=[];plotRect;get resolvedTheme(){return this.theme}static DEFAULT_MARKERS=5;get valueScale(){let e=(this.valueAxis.ticks?.length??Ze.DEFAULT_MARKERS)-1;return mt(this.data,this.series,this.stacked,this.valueAxis.range,e)}valueLabel(e){let t=this.valueAxis.format;return t===void 0?F(e,Ie(this.resolvedMarkers)):Cs(e,t)}get resolvedMarkers(){return this.valueAxis.ticks??z(this.valueScale,Ze.DEFAULT_MARKERS-1)}plotSize(){let{width:e,height:t}=this.plotRect.layoutBounds;return{w:e,h:t}}valueToY(e){let[t,i]=this.valueScale,{h:r}=this.plotSize();return i<=t?-r/2:((e-t)/(i-t)-.5)*r}get baselinePx(){let[e,t]=this.valueScale;return this.valueToY(Math.min(Math.max(0,e),t))}get slotWidth(){let e=this.data.length;return e>0?this.plotSize().w/e:0}slotCenter(e){return-this.plotSize().w/2+this.slotWidth*(e+.5)}get slotInner(){return this.slotWidth*u(this.resolvedTheme.bar.slotFill)}weightAt(e){return Math.max(0,this.weights[e]??1)}get totalWeight(){let e=0;for(let t=0;t<this.series.length;t++)e+=this.weightAt(t);return e>0?e:1}weightBefore(e){let t=0;for(let i=0;i<e;i++)t+=this.weightAt(i);return t}seriesBars(e){let t=this.series[e];if(!t)return[];let i=this.stacked,r=this.slotInner,s=this.resolvedTheme.bar.groupGap,n=r/this.totalWeight,l=this.weightAt(e);return this.data.map((a,h)=>{let c=Ke(i?this.weightedRow(a):a,this.series,i)[e]??{from:0,to:0,value:0},p=i?ut(a,this.series):e,S=this.slotCenter(h)-r/2,x=i?this.slotCenter(h):S+n*this.weightBefore(e)+n*l/2,k=i?r:Math.max(0,n*l-(this.series.length>1?s:0));return{x,width:k,from:this.valueToY(c.from),to:this.valueToY(c.to),round:p===e,value:M(a,t.field)}})}weightedRow(e){let t={...e};return this.series.forEach((i,r)=>{let s=e[i.field];typeof s=="number"&&(t[i.field]=s*this.weightAt(r))}),t}categoryDims(){let e=u(this.spotlightReveal),t=this.resolvedTheme.spotlight.dimOpacity,i=this.spotlight;return this.data.map((r,s)=>e<=0||i===s?1:1-(1-t)*e)}constructor(e){super(e);let t=this.series.map(l=>l.enabled??!0);this.weights=t.map(l=>l?1:0);let i=e?.showLegend!==!1,r=e?.showValues===!0;this.vAxis=new he({range:()=>this.valueScale,markers:()=>this.resolvedMarkers,axis:()=>this.resolvedTheme.yAxis,label:this.valueAxis.label??"",width:"hug",height:"fill"}),this.vAxis.labelFor=l=>this.valueLabel(l),this.cAxis=new B({categories:ft(this.data,this.categoryField),axis:()=>this.resolvedTheme.xAxis,label:this.categoryAxis.label??"",dims:()=>this.categoryDims(),width:"fill",height:"hug"}),this.barSets=this.series.map((l,a)=>new A({bars:()=>this.seriesBars(a),baseline:()=>this.baselinePx,fill:()=>qe(this.resolvedTheme.seriesFills,l,a),barStroke:()=>this.resolvedTheme.bar.stroke,barShadow:()=>this.resolvedTheme.bar.shadow,cornerRadius:()=>this.resolvedTheme.bar.cornerRadius,growth:()=>this.growth,dims:()=>this.categoryDims(),showValues:r,valueStyle:this.resolvedTheme.valueStyle,enabled:t[a]}));for(let l of this.barSets)l.labelFor=a=>this.valueLabel(a);i&&(this.legend=new Ue({series:this.series,swatches:()=>this.series.map((l,a)=>qe(this.resolvedTheme.seriesFills,l,a)),legend:()=>this.resolvedTheme.legend})),this.plotRect=new Me({clip:!0,children:[new Ge({fill:()=>this.resolvedTheme.plotArea.fill,shadow:()=>this.resolvedTheme.plotArea.shadow,xGridStroke:()=>this.resolvedTheme.xAxis.lineStyle,yGridStroke:()=>this.resolvedTheme.yAxis.lineStyle,xMarkers:[],yMarkers:()=>this.resolvedMarkers,xExtent:()=>[0,1],yExtent:()=>this.valueScale}),...this.barSets,new Ne({stroke:()=>this.resolvedTheme.plotArea.stroke})]});let s=new he({opacity:0,range:()=>this.valueScale,markers:()=>this.resolvedMarkers,axis:()=>this.resolvedTheme.yAxis,label:this.valueAxis.label??"",width:"hug",height:0}),n=[this.cAxis];this.legend&&n.push(this.legend),this.add(new Me({flow:"vertical",width:"fill",height:"fill",padding:{top:Os},children:[new Me({flow:"horizontal",height:"fill",width:"fill",children:[this.vAxis,this.plotRect]}),new Me({flow:"horizontal",width:"fill",children:[s,new Me({flow:"vertical",width:"fill",gap:20,children:n})]})]}))}arm(){this.vAxis.arm(),this.cAxis.arm(),this.growth=0,this.legend?.set({opacity:0,y:-Ps})}enter(e){let{duration:t}=e,i=e.easing??fe();return this.arm(),_e(Ls($e(this.vAxis.enter({data:{slide:24},duration:t*wi,easing:i}),this.cAxis.enter({data:{slide:24},duration:t*wi,easing:i})),this.riseBars(t*Fs,i),this.legend?this.legend.to({data:{opacity:1,y:0},duration:t*Ri,easing:i}):xt(t*Ri)),t)}to(e){let t=e.data??{},i={...this.valueAxis,range:this.valueScale,ticks:this.resolvedMarkers},r=Se(i,t.valueAxis);if(!r)return super.to(e);let{valueAxis:s,...n}=t,l=this.command(a=>({valueAxis:U(i,r,a)}),e.duration,e.easing);return Object.keys(n).length===0?l:_e($e(super.to({...e,data:n}),l),e.duration)}riseBars(e,t){return this.command(i=>({growth:i}),e,t)}showSeries(e){let{seriesIndex:t=0}=e.data??{};return this.toggleSeries(t,1,e.duration??.35,e.easing??fe())}hideSeries(e){let{seriesIndex:t=0}=e.data??{};return this.toggleSeries(t,0,e.duration??.35,e.easing??fe())}toggleSeries(e,t,i,r){let s=this.barSets[e];return s?_e($e(this.tweenWeight(e,t,i,r),Ai(i,n=>{let l=n>=1?t:Math.max(t,1-n);s.set({enabled:t>0||l>0})}),...this.legend?[t>0?this.legend.showSeries({data:{index:e},duration:i,easing:r}):this.legend.hideSeries({data:{index:e},duration:i,easing:r})]:[]),i):_e(xt(i))}spotlightSeries(e){let{seriesIndex:t=0}=e.data??{},i=e.duration??.35,r=e.easing??fe(),s=this.resolvedTheme.spotlight.dimOpacity;return _e($e(...this.barSets.map((n,l)=>n.to({data:{opacity:l===t?1:s},duration:i,easing:r})),...this.legend?[this.legend.spotlightSeries({data:{index:t},duration:i,easing:r})]:[]),i)}tweenWeight(e,t,i,r){let s=this.series.map((l,a)=>this.weightAt(a)),n=s[e]??1;return n===t?xt(i):Ai(i,l=>{let a=[...s];a[e]=n+(t-n)*r(l),this.weights=a})}spotlightCategory(e){let{categoryIndex:t=0}=e.data??{},i=e.duration??.4,r=e.easing??fe();if(t<0||t>=this.data.length)return this.holdSpotlight(i);let s=this.spotlightReveal;return this.command(n=>({spotlight:t,spotlightReveal:s+(1-s)*n}),i,r)}clearCategory(e){let t=e.duration??.4,i=e.easing??fe(),r=this.spotlightReveal;return r===0?this.holdSpotlight(t):this.command(s=>s>=1?{spotlight:null,spotlightReveal:0}:{spotlightReveal:r*(1-s)},t,i)}holdSpotlight(e){return this.command(()=>({}),e)}};b([L({default:()=>[]})],m.prototype,"data",void 0);b([L({default:""})],m.prototype,"categoryField",void 0);b([L({default:()=>[]})],m.prototype,"series",void 0);b([L({default:!1})],m.prototype,"stacked",void 0);b([L({default:{},mapper:se,tween:U})],m.prototype,"valueAxis",void 0);b([L({default:{},mapper:se,tween:U})],m.prototype,"categoryAxis",void 0);b([L({default:V,mapper:gt,tween:yt})],m.prototype,"theme",void 0);b([L({default:1})],m.prototype,"growth",void 0);b([L({default:()=>[]})],m.prototype,"weights",void 0);b([L({default:null})],m.prototype,"spotlight",void 0);b([L({default:0})],m.prototype,"spotlightReveal",void 0);b([me()],m.prototype,"enter",null);b([me({args:[{key:"seriesIndex",kind:"series",default:0,min:0,step:1}]})],m.prototype,"showSeries",null);b([me({args:[{key:"seriesIndex",kind:"series",default:0,min:0,step:1}]})],m.prototype,"hideSeries",null);b([me({args:[{key:"seriesIndex",kind:"series",default:0,min:0,step:1}]})],m.prototype,"spotlightSeries",null);b([me({args:[{key:"categoryIndex",kind:"number",default:0,min:0,step:1}]})],m.prototype,"spotlightCategory",null);b([me()],m.prototype,"clearCategory",null);m=Ze=b([Es({key:"barChart",parentKey:"node",forkable:!0,layout:{children:"freeform",defaultWidthMode:"fixed",defaultHeightMode:"fixed",acceptsChildren:!0},seed:{width:760,height:460}})],m);import{Rect as hr,command as be,node as cr,Node2D as dr,easeOut as ve,property as G}from"@motionscript/sdk";import{command as Ds,Rect as Je,Text as Is,easeOut as Bs,property as vt,textOps as Ns}from"@motionscript/sdk";import{at as Gs,compose as Us,hold as Hs}from"@motionscript/sdk/component";var Qe=function(o,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var l=o.length-1;l>=0;l--)(n=o[l])&&(s=(r<3?n(s):r>3?n(e,t,s):n(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},js=16,K=class extends Je{items=[];constructor(e){super({...e,flow:"vertical",align:"centerLeft",width:"hug",height:"hug"}),this.set({gap:this.legend.itemGap/3,padding:this.legend.padding});for(let t=0;t<this.slices.length;t++){let i=this.buildItem(t);this.items.push(i),this.add(new Je({width:"hug",height:"hug",flow:"freeform",opacity:()=>u(this.dims[t]??1),children:[i]}))}}buildItem(e){let t=this.legend.markerStyle;return new Je({flow:"horizontal",gap:12,align:"center",width:"hug",height:"hug",children:[new Je({width:t.height,height:t.height,cornerRadius:t.borderRadius,fill:()=>this.slices[e]?.fill??"white",stroke:t.stroke,shadow:t.shadow}),new Is({...Ns.styleProps(this.legend.textStyle),text:()=>this.slices[e]?.category??""})]})}arm(e=js){for(let t of this.items)t.set({opacity:0,x:e})}enter(e){let t=e.duration,i=e.easing??Bs(),r=this.items;if(r.length===0)return Hs(t);this.arm();let s=t/(1+Math.max(0,r.length-1)/5),n=s/5;return Us(r.map((l,a)=>Gs(a*n,l.to({data:{opacity:1,x:0},duration:s,easing:i}))))}};Qe([vt({default:()=>[]})],K.prototype,"slices",void 0);Qe([vt({default:j})],K.prototype,"legend",void 0);Qe([vt({default:()=>[]})],K.prototype,"dims",void 0);Qe([Ds()],K.prototype,"enter",null);import{Rect as Mt,command as Ct,Graphics2D as _i,Node2D as $s,PathBuilder as Zs,Text as ye,easeOut as _t,fillOps as Js,property as T,shadowOps as Qs,strokeOps as Ei,textOps as xe}from"@motionscript/sdk";import{lerpNumber as Ee,shadowOps as Ti,strokeOps as et,textOps as N}from"@motionscript/sdk";function St(o,e,t,i){return o.map((r,s)=>({category:re(r,e),value:M(r,t),fill:i.length>0?i[s%i.length]:"white"}))}var zs=Math.PI/180;function At(o){return o.value>0&&Number.isFinite(o.value)?o.value:0}function Mi(o){let e=0;for(let t of o)e+=At(t);return e}function ge(o,e){return{x:o*Math.sin(e),y:o*Math.cos(e)}}function wt(o,e){let t=Mi(o);if(t<=0)return[];let i=[],r=e*zs;return o.forEach((s,n)=>{let l=At(s);if(l<=0)return;let a=l/t,h=r,d=h+a*Math.PI*2;r=d,i.push({index:n,a0:h,a1:d,mid:(h+d)/2,fraction:a})}),i}function tt(o,e,t,i){o.sort((n,l)=>l.ideal-n.ideal);let r=t;for(let n of o)n.y=Math.min(n.ideal,r),r=n.y-e;let s=i;for(let n=o.length-1;n>=0;n--)o[n].y=Math.max(o[n].y,s),s=o[n].y+e;return o}var bt={fontSize:26,fontWeight:600,textAlign:"center",fill:O.markerColor},q={sliceFills:Le,ring:{gap:6,holeRadius:.6,startAngle:0,selectedGrow:1.08,stroke:[],shadow:[]},label:{textStyle:bt,percentStyle:{...bt,fontWeight:700},insideStyle:{...bt,fontWeight:800,fill:"#15130e"},leaderStroke:{weight:2,fill:O.markerColor}},center:{labelStyle:{fontSize:46,fontWeight:800,textAlign:"center",fill:O.markerColor},captionStyle:{fontSize:22,fontWeight:500,textAlign:"center",fill:O.markerColor}},legend:j,spotlight:{dimOpacity:P}};function Xs(o,e){return{gap:o?.gap??e.gap,holeRadius:o?.holeRadius??e.holeRadius,startAngle:o?.startAngle??e.startAngle,selectedGrow:o?.selectedGrow??e.selectedGrow,stroke:et.resolve(o?.stroke??e.stroke),shadow:Ti.resolve(o?.shadow??e.shadow)}}function Ys(o,e,t){return{gap:Ee(o.gap,e.gap,t),holeRadius:Ee(o.holeRadius,e.holeRadius,t),startAngle:Ee(o.startAngle,e.startAngle,t),selectedGrow:Ee(o.selectedGrow,e.selectedGrow,t),stroke:et.lerp(o.stroke,e.stroke,t),shadow:Ti.lerp(o.shadow,e.shadow,t)}}function Ws(o,e){return{textStyle:N.resolveStyle(o?.textStyle,e.textStyle),percentStyle:N.resolveStyle(o?.percentStyle,e.percentStyle),insideStyle:N.resolveStyle(o?.insideStyle,e.insideStyle),leaderStroke:et.resolve(o?.leaderStroke??e.leaderStroke)}}function Vs(o,e,t){return{textStyle:N.lerpStyle(o.textStyle,e.textStyle,t),percentStyle:N.lerpStyle(o.percentStyle,e.percentStyle,t),insideStyle:N.lerpStyle(o.insideStyle,e.insideStyle,t),leaderStroke:et.lerp(o.leaderStroke,e.leaderStroke,t)}}function Ks(o,e){return{labelStyle:N.resolveStyle(o?.labelStyle,e.labelStyle),captionStyle:N.resolveStyle(o?.captionStyle,e.captionStyle)}}function qs(o,e,t){return{labelStyle:N.lerpStyle(o.labelStyle,e.labelStyle,t),captionStyle:N.lerpStyle(o.captionStyle,e.captionStyle,t)}}function Rt(o,e){let t=e??q;return{sliceFills:Fe(o?.sliceFills,t.sliceFills),ring:Xs(o?.ring,t.ring),label:Ws(o?.label,t.label),center:Ks(o?.center,t.center),legend:le(o?.legend,t.legend),spotlight:{dimOpacity:o?.spotlight?.dimOpacity??t.spotlight.dimOpacity}}}function Tt(o,e,t){return{sliceFills:De(o.sliceFills,e.sliceFills,t),ring:Ys(o.ring,e.ring,t),label:Vs(o.label,e.label,t),center:qs(o.center,e.center,t),legend:ae(o.legend,e.legend,t),spotlight:{dimOpacity:Ee(o.spotlight.dimOpacity,e.spotlight.dimOpacity,t)}}}import{declarePaints as er}from"@motionscript/sdk/component";var R=function(o,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var l=o.length-1;l>=0;l--)(n=o[l])&&(s=(r<3?n(s):r>3?n(e,t,s):n(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},ki=12,tr=14,Et=.62,ir=6,Ci=34,Li=26,Oi=8,sr=.18,rr=240,or=8,Pi=2,Fi=.44,kt=.62,nr=.78,lr=.9,Di=.001,Ii=26;function Z(o,e=Ii){let t=o.fontSize;return typeof t=="number"?t:e}function ar(o,e,t,i,r,s){let n=new Zs,l=e-o,a=Math.max(2,Math.ceil(Math.abs(l)/(Math.PI*2)*rr)),h=c=>c<=0?0:Math.min(r/c,l/2.2),d=(c,p)=>{let S=h(c),x=o+S,k=e-S,te=ge(c,x+(k-x)*p/a);return{x:te.x+s,y:te.y}};if(t<=0){n.moveTo(s,0);for(let c=0;c<=a;c++){let p=d(i,c);n.lineTo(p.x,p.y)}return n.close(),n}for(let c=0;c<=a;c++){let p=d(i,c);c===0?n.moveTo(p.x,p.y):n.lineTo(p.x,p.y)}for(let c=a;c>=0;c--){let p=d(t,c);n.lineTo(p.x,p.y)}return n.close(),n}var g=class extends $s{fillCache=[];get resolvedFills(){let e=this.slices;return this.fillCache.length=e.length,e.map((t,i)=>{let r=this.fillCache[i];if(r!==void 0&&r.source===t.fill)return r.resolved;let s=Js.resolve(t.fill);return this.fillCache[i]={source:t.fill,resolved:s},s})}constructor(e){if(super(e),this.labelPlacement!=="none"&&this.labelMode!=="none")for(let t of this.arcs)this.addLabel(t);this.hasCenterLabel&&this.addCenterLabel()}addLabel(e){let t=()=>u(this.labelReveal)*this.sliceOpacity(e.index),i=this.labelMode==="both"||this.labelMode==="category",r=this.labelMode==="both"||this.labelMode==="percent";if(this.labelPlacement==="inside"){let a=[];r&&a.push(new ye({...xe.styleProps(this.label.insideStyle),text:()=>this.percentText(e.index),fontSize:()=>this.insideFont})),i&&a.push(new ye({...xe.styleProps(this.label.insideStyle),text:()=>this.slices[e.index]?.category??"",fontSize:()=>this.labelMode==="category"?this.insideFont:this.insideFont*Fi})),this.add(new Mt({flow:"vertical",width:"hug",height:"hug",gap:0,align:"center",opacity:t,center:()=>this.insideAnchor(e.index),children:a}));return}let s=this.sideOf(e.mid),n=()=>this.placementFor(e.index)?.text??{x:0,y:0},l=[];i&&l.push(new ye({...xe.styleProps(this.label.textStyle),text:()=>this.slices[e.index]?.category??"",textAlign:s>0?"left":"right"})),r&&l.push(new ye({...xe.styleProps(this.label.percentStyle),text:()=>this.percentText(e.index),textAlign:s>0?"left":"right"})),this.add(new Mt({flow:"vertical",width:"hug",height:"hug",gap:2,align:s>0?"centerLeft":"centerRight",opacity:t,centerLeft:s>0?n:void 0,centerRight:s>0?void 0:n,children:l}))}percentText(e){let t=this.arcs.find(i=>i.index===e);return it(t?.fraction??0)}addCenterLabel(){let e=[];this.centerLabel!==""&&e.push(new ye({...xe.styleProps(this.centerStyle.labelStyle),text:this.centerLabel,fontSize:()=>this.centerFont})),this.centerCaption!==""&&e.push(new ye({...xe.styleProps(this.centerStyle.captionStyle),text:this.centerCaption,fontSize:()=>this.centerFont*(Z(this.centerStyle.captionStyle,22)/Z(this.centerStyle.labelStyle,46))})),this.add(new Mt({flow:"vertical",width:"hug",height:"hug",gap:2,align:"center",opacity:()=>u(this.centerReveal),center:()=>({x:this.centerX,y:0}),children:e}))}get arcs(){return wt(this.slices,this.ring.startAngle)}sideOf(e){return Math.sin(e)>=0?1:-1}get hasLeaderLabels(){return this.labelPlacement==="leader"&&this.labelMode!=="none"&&this.arcs.length>0}insideRoom(e){let t=this.outerRadius,i=this.holeRadius,r=i>0?t-i:t*(1-kt)*2,s=i>0?(i+t)/2:t*kt,n=Math.abs(Math.sin(e.mid)),l=Math.abs(Math.cos(e.mid)),a=n>Di?r/n:1/0,h=l>Di?(e.a1-e.a0)*s/l:1/0;return Math.max(0,Math.min(a,h))}insideGlyphs(e){let t=this.slices[e.index]?.category.length??0,i=this.labelMode==="both"||this.labelMode==="percent"?it(e.fraction).length:0,r=this.labelMode==="category"?t:this.labelMode==="both"?t*Fi:0;return Math.max(1,i,r)}get insideFont(){let e=Z(this.label.insideStyle,Ii*1.9);for(let t of this.arcs){let i=this.insideRoom(t)*lr/(this.insideGlyphs(t)*Et);e=Math.min(e,i)}return Math.max(1,e)}get hasCenterLabel(){return this.centerLabel!==""||this.centerCaption!==""}get centerFont(){let e=Z(this.centerStyle.labelStyle,46),t=this.holeRadius;if(t<=0)return e;let i=Z(this.centerStyle.captionStyle,22)/Math.max(1,e),r=Math.max(1,this.centerLabel.length,this.centerCaption.length*i);return Math.min(e,t*2*nr/(r*Et))}get growFactor(){return Math.max(1,Math.min(1.6,this.ring.selectedGrow))}get maxPop(){return this.outerRadius*(this.growFactor-1)}get labelRowHeight(){if(!this.hasLeaderLabels)return 0;let e=Z(this.label.textStyle)*1.25,t=Z(this.label.percentStyle)*1.25;return this.labelMode==="both"?e+t+2:this.labelMode==="category"?e:t}captionGlyphs(e){let t=this.labelMode==="percent"||this.labelMode==="both"?4:0,i=this.labelMode==="category"||this.labelMode==="both"?this.slices[e]?.category.length??0:0;return Math.max(t,i)}get labelGutters(){let e={left:Pi,right:Pi};if(!this.hasLeaderLabels)return e;let t=Z(this.label.textStyle)*Et;for(let i of this.arcs){let r=Ci+Li+Oi+this.captionGlyphs(i.index)*t+tr,s=this.sideOf(i.mid)>0?"right":"left";e[s]=Math.max(e[s],r)}return e}get centerX(){let{left:e,right:t}=this.labelGutters;return(e-t)/2}get outerRadius(){let{left:e,right:t}=this.labelGutters,i=Math.min((this.layoutBounds.width-e-t)/2,this.layoutBounds.height/2-this.labelRowHeight-4);return Math.max(0,i/this.growFactor)}get holeRadius(){let e=this.ring.holeRadius;if(e<=0)return 0;let t=e<1?e*this.outerRadius:e;return Math.min(t,this.outerRadius*.95)}get elbowRadius(){return this.outerRadius+this.maxPop+Ci}popOf(e){return u(this.pops[e]??0)}anchorRadius(e){return this.outerRadius+this.maxPop*this.popOf(e)}bandMidRadius(e){let t=this.anchorRadius(e),i=this.holeRadius;return i>0?(i+t)/2:t*kt}insideAnchor(e){let t=this.arcs.find(r=>r.index===e);if(t===void 0)return{x:this.centerX,y:0};let i=ge(this.bandMidRadius(e),t.mid);return{x:i.x+this.centerX,y:i.y}}get selectionStrength(){let e=0;for(let t=0;t<this.slices.length;t++)e=Math.max(e,this.popOf(t));return e}sliceOpacity(e){let t=this.selectionStrength;return t<=0?1:1-(1-u(this.dimOpacity))*t*(1-this.popOf(e))}placements(){if(!this.hasLeaderLabels)return[];let e=this.arcs;if(e.length===0||this.outerRadius<=0)return[];let t=this.elbowRadius,i=this.labelRowHeight,r=this.layoutBounds.height/2-i/2,s=-r,n=this.centerX,l=[],a=[];for(let h of e){let d=this.sideOf(h.mid),c=ge(t,h.mid).y;(d>0?l:a).push({index:h.index,side:d,mid:h.mid,ideal:c,y:c})}return tt(l,i+ki,r,s),tt(a,i+ki,r,s),[...l,...a].map(h=>{let d=ge(this.anchorRadius(h.index)+ir,h.mid),c=Math.sqrt(Math.max(0,t*t-h.y*h.y)),p=n+h.side*Math.max(c,t*sr),S=n+h.side*(t+Li);return{index:h.index,side:h.side,leader:[{x:d.x+n,y:d.y},{x:p,y:h.y},{x:S,y:h.y}],text:{x:S+h.side*Oi,y:h.y}}})}placementFor(e){return this.placements().find(t=>t.index===e)}declareAssets(e){super.declareAssets(e),er(this,e,{fills:[...this.resolvedFills,...Qs.resolve(this.ring.shadow).map(t=>t.fill)],strokes:[Ei.resolve(this.ring.stroke),Ei.resolve(this.label.leaderStroke)]})}renderSelf(e){let t=this.outerRadius;if(t<=0)return;let i=this.arcs;if(i.length===0)return;let r=u(this.growth),s=this.ring.startAngle*(Math.PI/180)+Math.PI*2*r,n=this.holeRadius,l=Math.max(0,this.ring.gap)/2,a=this.centerX,h=t+this.maxPop+1+Math.abs(a),d=[-h,-h,h,h],c=h*2,p=this.resolvedFills;for(let x of i){let k=Math.min(x.a1,s);if(k<=x.a0)continue;let te=ar(x.a0,k,n,this.anchorRadius(x.index),l,a),ie=new _i().path(te.toPathState({centerBounds:d,width:c,height:c}));ie.shadow(this.ring.shadow),ie.fill(p[x.index]??[]),ie.stroke(this.ring.stroke),e.draw(ie.opacity(this.sliceOpacity(x.index)))}let S=u(this.labelReveal);if(!(S<=.001))for(let x of this.placements())e.draw(new _i().line({points:x.leader,radius:or}).stroke(this.label.leaderStroke).opacity(S*this.sliceOpacity(x.index)))}sweep(e){return this.command(t=>({growth:t}),e.duration,e.easing??_t())}revealLabels(e){return this.command(t=>({labelReveal:t}),e.duration,e.easing??_t())}revealCenter(e={}){let t=u(this.centerReveal);return this.command(i=>({centerReveal:t+(1-t)*i}),e.duration??.6,e.easing??_t())}};R([T({default:()=>[]})],g.prototype,"slices",void 0);R([T({default:q.ring})],g.prototype,"ring",void 0);R([T({default:q.label})],g.prototype,"label",void 0);R([T({default:q.center})],g.prototype,"centerStyle",void 0);R([T({default:"percent"})],g.prototype,"labelMode",void 0);R([T({default:"leader"})],g.prototype,"labelPlacement",void 0);R([T({default:1})],g.prototype,"growth",void 0);R([T({default:1})],g.prototype,"labelReveal",void 0);R([T({default:()=>[]})],g.prototype,"pops",void 0);R([T({default:q.spotlight.dimOpacity})],g.prototype,"dimOpacity",void 0);R([T({default:""})],g.prototype,"centerLabel",void 0);R([T({default:""})],g.prototype,"centerCaption",void 0);R([T({default:1})],g.prototype,"centerReveal",void 0);R([Ct()],g.prototype,"sweep",null);R([Ct()],g.prototype,"revealLabels",null);R([Ct()],g.prototype,"revealCenter",null);import{asCommand as pr,hold as ur,sequence as fr,together as mr}from"@motionscript/sdk/component";var w=function(o,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var l=o.length-1;l>=0;l--)(n=o[l])&&(s=(r<3?n(s):r>3?n(e,t,s):n(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s},gr=.65,Lt=.35,y=class extends dr{ring;legend=null;get resolvedTheme(){return this.theme}get slices(){return St(this.data,this.categoryField,this.valueField,this.resolvedTheme.sliceFills)}sliceDims(){let e=0;for(let i=0;i<this.data.length;i++)e=Math.max(e,this.popAt(i));let t=this.resolvedTheme.spotlight.dimOpacity;return e<=0?this.data.map(()=>1):this.data.map((i,r)=>1-(1-u(t))*e*(1-this.popAt(r)))}popAt(e){return u(this.pops[e]??0)}constructor(e){super(e);let t=this.slices,i=e?.showLegend!==!1;this.pops=t.map(()=>0),this.ring=new g({width:"fill",height:"fill",slices:()=>this.slices,ring:()=>this.resolvedTheme.ring,label:()=>this.resolvedTheme.label,centerStyle:()=>this.resolvedTheme.center,labelMode:this.labelMode,labelPlacement:this.labelPlacement,pops:()=>this.pops,dimOpacity:()=>this.resolvedTheme.spotlight.dimOpacity,centerLabel:this.centerLabel,centerCaption:this.centerCaption,centerReveal:e?.showCenter===!1?0:1});let r=[this.ring];i&&(this.legend=new K({slices:()=>this.slices,legend:()=>this.resolvedTheme.legend,dims:()=>this.sliceDims()}),r.push(this.legend)),this.add(new hr({flow:"horizontal",width:"fill",height:"fill",gap:this.gap,align:"center",children:r}))}arm(){this.ring.set({growth:0,labelReveal:0}),this.legend?.arm()}enter(e){let t=e.duration,i=e.easing??ve();return this.arm(),pr(fr(this.ring.sweep({duration:t*gr,easing:i}),mr(this.ring.revealLabels({duration:t*Lt,easing:i}),this.legend?this.legend.enter({duration:t*Lt,easing:i}):ur(t*Lt))),t)}revealCenter(e={}){return this.ring.revealCenter({duration:e.duration??.6,easing:e.easing??ve()})}isSelected(e){return this.popAt(e)>.5}selectSlice(e){let{sliceIndex:t}=e.data,i=e.duration??.45,r=e.easing??ve();return this.tweenPops(s=>s===t?1:this.popAt(s),i,r)}deselectSlice(e){let{sliceIndex:t}=e.data,i=e.duration??.45,r=e.easing??ve();return this.tweenPops(s=>s===t?0:this.popAt(s),i,r)}selectOnlySlice(e){let{sliceIndex:t}=e.data,i=e.duration??.45,r=e.easing??ve();return this.tweenPops(s=>s===t?1:0,i,r)}clearSelection(e={}){let t=e.duration??.45,i=e.easing??ve();return this.tweenPops(()=>0,t,i)}tweenPops(e,t,i){let r=this.data.map((n,l)=>this.popAt(l)),s=this.data.map((n,l)=>u(e(l)));return r.every((n,l)=>n===s[l])?this.command(()=>({}),t):this.command(n=>({pops:r.map((l,a)=>l+(s[a]-l)*n)}),t,i)}};w([G({default:()=>[]})],y.prototype,"data",void 0);w([G({default:""})],y.prototype,"categoryField",void 0);w([G({default:""})],y.prototype,"valueField",void 0);w([G({default:q,mapper:Rt,tween:Tt})],y.prototype,"theme",void 0);w([G({default:"percent"})],y.prototype,"labelMode",void 0);w([G({default:"leader"})],y.prototype,"labelPlacement",void 0);w([G({default:40})],y.prototype,"gap",void 0);w([G({default:""})],y.prototype,"centerLabel",void 0);w([G({default:""})],y.prototype,"centerCaption",void 0);w([G({default:()=>[]})],y.prototype,"pops",void 0);w([be()],y.prototype,"enter",null);w([be()],y.prototype,"revealCenter",null);w([be({args:[{key:"sliceIndex",kind:"number",default:0,min:0,step:1}]})],y.prototype,"selectSlice",null);w([be({args:[{key:"sliceIndex",kind:"number",default:0,min:0,step:1}]})],y.prototype,"deselectSlice",null);w([be({args:[{key:"sliceIndex",kind:"number",default:0,min:0,step:1}]})],y.prototype,"selectOnlySlice",null);w([be()],y.prototype,"clearSelection",null);y=w([cr({key:"pieChart",parentKey:"node",forkable:!0,layout:{children:"freeform",defaultWidthMode:"fixed",defaultHeightMode:"fixed",acceptsChildren:!0},seed:{width:680,height:480}})],y);var yr=[f,m,y];export{m as BarChart,O as CHART_PALETTE,B as CategoryAxis,A as ChartBars,Ne as ChartBorder,Ge as ChartCanvas,Ue as ChartLegend,_ as ChartLine,X as ChartRegion,V as DEFAULT_BAR_CHART_THEME,J as DEFAULT_CHART_THEME,j as DEFAULT_LEGEND,q as DEFAULT_PIE_CHART_THEME,Ce as DEFAULT_PLOT_AREA,xr as DEFAULT_SERIES_COLORS,Le as DEFAULT_SERIES_FILLS,Pt as DEFAULT_SERIES_STROKES,H as DEFAULT_X_AXIS,ke as DEFAULT_Y_AXIS,ce as EMPTY_REGION_BOX,D as HorizontalAxis,f as LineChart,yr as NODES,y as PieChart,K as PieLegend,g as PieRing,P as SPOTLIGHT_DIM,he as VerticalAxis,Se as axisTweenTarget,ft as barCategories,Ke as barSpans,xi as barValueExtent,u as clampUnit,rt as clipPolylineToBox,Be as enterBudget,oi as formatInstant,F as formatMarker,it as formatPercent,de as hasRegion,ne as lerpAxisConfig,U as lerpAxisDomain,yt as lerpBarChartTheme,nt as lerpChartTheme,ae as lerpLegendConfig,Tt as lerpPieChartTheme,Pe as lerpPlotArea,De as lerpSeriesFills,Dt as lerpSeriesStrokes,Ie as markerStep,z as markerValues,Ae as niceStep,M as num,vr as numericFields,ri as parseInstant,wt as pieArcs,tt as relaxLabels,oe as resolveAxisConfig,se as resolveAxisDomain,gt as resolveBarChartTheme,qe as resolveBarFill,mt as resolveBarScale,ot as resolveChartTheme,le as resolveLegendConfig,br as resolvePalettePaint,Rt as resolvePieChartTheme,St as resolvePieSlices,Oe as resolvePlotArea,st as resolveRegionBox,Bt as resolveSeriesFill,Fe as resolveSeriesFills,It as resolveSeriesStroke,Ft as resolveSeriesStrokes,ct as resolveXScale,at as resolveYScale,ge as ringPoint,lt as seriesPoints,Mi as sliceTotal,At as sliceValue,ut as stackCapIndex,re as text,Ut as yExtent};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|