ztd-charts-cli 0.5.1 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/api.js +1 -1
- package/dist/{chunk-QVXYPBAX.js → chunk-4WXNLD5P.js} +54 -19
- package/dist/cli.js +1 -1
- package/dist/client/area.js +28 -0
- package/dist/client/bar.js +28 -0
- package/dist/client/beeswarm.js +28 -0
- package/dist/client/box.js +28 -0
- package/dist/client/bubble.js +28 -0
- package/dist/client/bullet.js +28 -0
- package/dist/client/bump.js +28 -0
- package/dist/client/calendar.js +28 -0
- package/dist/client/candlestick.js +28 -0
- package/dist/client/chord.js +28 -0
- package/dist/client/donut.js +28 -0
- package/dist/client/dumbbell.js +28 -0
- package/dist/client/funnel.js +28 -0
- package/dist/client/gauge.js +28 -0
- package/dist/client/heatmap.js +28 -0
- package/dist/client/histogram.js +28 -0
- package/dist/client/line.js +28 -0
- package/dist/client/lollipop.js +28 -0
- package/dist/client/marimekko.js +28 -0
- package/dist/client/parallel.js +28 -0
- package/dist/client/pareto.js +28 -0
- package/dist/client/pie.js +28 -0
- package/dist/client/radar.js +28 -0
- package/dist/client/radialBar.js +28 -0
- package/dist/client/react.js +66 -0
- package/dist/client/ridgeline.js +28 -0
- package/dist/client/sankey.js +28 -0
- package/dist/client/scatter.js +28 -0
- package/dist/client/segmented.js +28 -0
- package/dist/client/skyline.js +28 -0
- package/dist/client/slope.js +28 -0
- package/dist/client/sparkline.js +28 -0
- package/dist/client/stream.js +28 -0
- package/dist/client/sunburst.js +28 -0
- package/dist/client/tileMap.js +28 -0
- package/dist/client/treemap.js +28 -0
- package/dist/client/waffle.js +28 -0
- package/dist/client/waterfall.js +28 -0
- package/package.json +3 -3
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
(()=>{var so=Object.create;var on=Object.defineProperty;var lo=Object.getOwnPropertyDescriptor;var co=Object.getOwnPropertyNames;var uo=Object.getPrototypeOf,mo=Object.prototype.hasOwnProperty;var pt=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var fo=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of co(t))!mo.call(e,o)&&o!==n&&on(e,o,{get:()=>t[o],enumerable:!(r=lo(t,o))||r.enumerable});return e};var F=(e,t,n)=>(n=e!=null?so(uo(e)):{},fo(t||!e||!e.__esModule?on(n,"default",{value:e,enumerable:!0}):n,e));var V=pt((Ci,an)=>{an.exports=globalThis.__ztdReact.react});var ln=pt((Mi,sn)=>{sn.exports=globalThis.__ztdReact["react-dom/client"]});var I=pt((Bi,On)=>{On.exports=globalThis.__ztdReact["react/jsx-runtime"]});var tn=F(V(),1),ao=F(ln(),1);var Ge=F(V(),1);var ot=F(V(),1);var cn=F(V(),1),Te=(0,cn.createContext)(void 0);var fn=F(V(),1);var ho=["bg","panel","ink","muted","dim","accent","accentText","onAccent","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"],un='"Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, -apple-system, sans-serif',mn='"Roboto Mono", "Share Tech Mono", ui-monospace, SFMono-Regular, Menlo, monospace',pe={name:"dark",bg:"#14171B",panel:"#14171B",ink:"#F1F3F5",muted:"#A3ABB5",dim:"#5B636D",accent:"#D6FD70",accentText:"#D6FD70",onAccent:"#14171B",onInk:"#14171B",line:"#2A2F36",line2:"#22272D",neutral:"#3A414A",neutralStrong:"#5F6772",onNeutralStrong:"#F1F3F5",neutralSoft:"#262B31",lift:"#1D2126",tint:"rgba(214, 253, 112, 0.14)",fontFamily:un,monoFamily:mn,radius:18,radiusCode:14,radiusMark:4},bt={name:"light",bg:"#FFFFFF",panel:"#FFFFFF",ink:"#14171B",muted:"#5D6570",dim:"#B3B9C2",accent:"#0B8FD8",accentText:"#006DA8",onAccent:"#14171B",onInk:"#FFFFFF",line:"#E6E9ED",line2:"#F0F2F5",neutral:"#D5DAE0",neutralStrong:"#9AA3AE",onNeutralStrong:"#14171B",neutralSoft:"#EEF1F4",lift:"#F4F6F8",tint:"rgba(11, 143, 216, 0.12)",fontFamily:un,monoFamily:mn,radius:18,radiusCode:14,radiusMark:4},yt={dark:pe,light:bt};function Ke(e){return`--ztd-${e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}function xt(e){let t={};for(let n of ho){let r=e[n];typeof r=="string"&&(t[Ke(n)]=r)}return e.fontFamily&&(t["--ztd-font"]=e.fontFamily),e.monoFamily&&(t["--ztd-mono"]=e.monoFamily),e.radius!==void 0&&(t["--ztd-radius"]=`${e.radius}px`),e.radiusCode!==void 0&&(t["--ztd-radius-code"]=`${e.radiusCode}px`),e.radiusMark!==void 0&&(t["--ztd-radius-mark"]=`${e.radiusMark}px`),t}function kt(e,t){if(!t)return e;let n={...e};for(let r of Object.keys(t)){let o=t[r];o!==void 0&&(n[r]=o)}return n}var go=`
|
|
2
|
+
.ztd-root{position:relative;-webkit-tap-highlight-color:transparent}
|
|
3
|
+
.ztd-root:focus{outline:none}
|
|
4
|
+
.ztd-root:focus-visible{outline:2px solid var(--ztd-accent,${pe.accent});outline-offset:3px;border-radius:6px}
|
|
5
|
+
.ztd-svg{display:block;overflow:visible;user-select:none;-webkit-user-select:none}
|
|
6
|
+
.ztd-mark{transition:opacity .18s ease,fill .18s ease,stroke .18s ease,stroke-width .18s ease}
|
|
7
|
+
.ztd-tip{animation:ztd-fade .14s ease-out;transition:left .2s cubic-bezier(.22,1,.36,1),top .2s cubic-bezier(.22,1,.36,1)}
|
|
8
|
+
.ztd-guide{transition:transform .2s cubic-bezier(.22,1,.36,1)}
|
|
9
|
+
.ztd-still .ztd-tip,.ztd-still .ztd-guide{transition:none;animation:none}
|
|
10
|
+
.ztd-btn{appearance:none;font:inherit;cursor:pointer;transition:background .14s,color .14s,border-color .14s}
|
|
11
|
+
.ztd-btn:focus{outline:none}
|
|
12
|
+
.ztd-btn:focus-visible{outline:2px solid var(--ztd-accent,${pe.accent});outline-offset:2px}
|
|
13
|
+
.ztd-card{transition:border-color .16s ease}
|
|
14
|
+
.ztd-card:hover{border-color:var(--ztd-dim,${pe.dim})}
|
|
15
|
+
@media (prefers-reduced-motion: reduce){.ztd-mark,.ztd-tip,.ztd-guide,.ztd-btn,.ztd-card{transition:none;animation:none}}
|
|
16
|
+
@keyframes ztd-pop{from{opacity:0;transform:scale(.45)}to{opacity:1;transform:none}}
|
|
17
|
+
@keyframes ztd-fade{from{opacity:0}to{opacity:1}}
|
|
18
|
+
.ztd-pop{transform-box:fill-box;transform-origin:center}
|
|
19
|
+
@keyframes ztd-pulse{0%,100%{opacity:.55}50%{opacity:1}}
|
|
20
|
+
.ztd-skeleton{animation:ztd-pulse 1.4s ease-in-out infinite}
|
|
21
|
+
@media (prefers-reduced-motion: reduce){.ztd-skeleton{animation:none}}
|
|
22
|
+
`;function hn(e,t,n,r,o){if(e)return t?{opacity:0}:{animation:`ztd-${n} ${Math.round(o)}ms cubic-bezier(.22,.9,.3,1) ${Math.round(r)}ms backwards`}}function gn(e,t){let[n]=(0,fn.useState)(!e.motion.enabled);return e.motion.enabled&&e.hydrated&&(!n||t.waiting||t.generation>0)}var dn=!1;function Ie(){if(dn||typeof document>"u"||(dn=!0,document.getElementById("ztd-base")))return;let e=document.createElement("style");e.id="ztd-base",e.textContent=go,document.head.appendChild(e)}var Ue=F(V(),1),oe=typeof window<"u"&&typeof document<"u",ce=oe?Ue.useLayoutEffect:Ue.useEffect;function Xe(){return typeof performance<"u"?performance.now():Date.now()}function W(e){return e!==void 0&&/^ko([-_]|$)/i.test(e)?"ko":"en"}function be(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}var pn={chart:"chart",table:e=>`${e} data`,more:e=>`and ${e} more`,value:"Value",empty:"No data."},bn={chart:"차트",table:e=>`${e} 데이터`,more:e=>`외 ${e}개`,value:"값",empty:"데이터가 없어요."};var po=[{id:"basic",en:"Basic",ko:"기본"},{id:"intermediate",en:"Intermediate",ko:"중급"},{id:"advanced",en:"Advanced",ko:"심화"}],bo={basic:{bg:"line2",fg:"ink"},intermediate:{bg:"tint",fg:"accentText"},advanced:{bg:"ink",fg:"onInk"}};function yo(e,t){let n=t.trim().toLowerCase();return e.find(r=>r.id===n||r.en.toLowerCase()===n||r.ko===t.trim())}function xo(e){return yo(po,e)}function yn(e,t){let n=xo(e);return{text:n?n[t]:e,...bo[n?.id??"basic"]}}var xn={white:"#ffffff",black:"#000000",transparent:"#00000000"};function Se(e){if(!e)return null;let t=e.trim(),n=/^var\(\s*--[\w-]+\s*,\s*(.+)\)$/i.exec(t);if(n&&(t=n[1].trim()),xn[t.toLowerCase()]&&(t=xn[t.toLowerCase()]),t.startsWith("#")){let o=t.slice(1);if((o.length===3||o.length===4)&&(o=o.split("").map(i=>i+i).join("")),o.length!==6&&o.length!==8||/[^\da-f]/i.test(o))return null;let a=parseInt(o,16);return o.length===6?[a>>16&255,a>>8&255,a&255,1]:[parseInt(o.slice(0,2),16),parseInt(o.slice(2,4),16),parseInt(o.slice(4,6),16),parseInt(o.slice(6,8),16)/255]}let r=/^rgba?\(([^)]+)\)$/i.exec(t);if(r){let o=r[1].split(/[\s,/]+/).filter(Boolean);if(o.length<3)return null;let a=o.slice(0,3).map(s=>s.endsWith("%")?parseFloat(s)/100*255:parseFloat(s)),i=o[3]!==void 0?o[3].endsWith("%")?parseFloat(o[3])/100:parseFloat(o[3]):1;return a.some(s=>Number.isNaN(s))?null:[a[0],a[1],a[2],Number.isNaN(i)?1:i]}return null}function vn(e){let t=n=>Math.round(Math.max(0,Math.min(255,n))).toString(16).padStart(2,"0");return`#${t(e[0])}${t(e[1])}${t(e[2])}${e[3]<1?t(e[3]*255):""}`.toUpperCase()}function vt(e,t){let n=e[3];return[e[0]*n+t[0]*(1-n),e[1]*n+t[1]*(1-n),e[2]*n+t[2]*(1-n),1]}function Ae(e){let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function kn(e){return .2126*Ae(e[0])+.7152*Ae(e[1])+.0722*Ae(e[2])}function $t(e,t,n){let r=typeof e=="string"?Se(e):e,o=typeof t=="string"?Se(t):t;if(!r||!o)return 0;let a=n?typeof n=="string"?Se(n):n:null;o[3]<1&&a&&(o=vt(o,a));let i=r[3]<1?vt(r,o):r,s=kn(i),l=kn(o);return(Math.max(s,l)+.05)/(Math.min(s,l)+.05)}function ko(e){return[Ae(e[0]),Ae(e[1]),Ae(e[2])]}function wt(e){let t=e<=.0031308?12.92*e:1.055*Math.pow(e,.4166666666666667)-.055;return Math.max(0,Math.min(255,t*255))}function wn(e){let[t,n,r]=ko(e),o=Math.cbrt(.4122214708*t+.5363325363*n+.0514459929*r),a=Math.cbrt(.2119034982*t+.6806995451*n+.1073969566*r),i=Math.cbrt(.0883024619*t+.2817188376*n+.6299787005*r);return[.2104542553*o+.793617785*a-.0040720468*i,1.9779984951*o-2.428592205*a+.4505937099*i,.0259040371*o+.7827717662*a-.808675766*i]}function wo([e,t,n],r){let o=(e+.3963377774*t+.2158037573*n)**3,a=(e-.1055613458*t-.0638541728*n)**3,i=(e-.0894841775*t-1.291485548*n)**3;return[wt(4.0767416621*o-3.3077115913*a+.2309699292*i),wt(-1.2684380046*o+2.6097574011*a-.3413193965*i),wt(-.0041960863*o-.7034186147*a+1.707614701*i),r]}function Ye(e,t,n){let r=Se(e),o=Se(t);if(!r||!o)return e;let a=wn(r),i=wn(o),s=Math.max(0,Math.min(1,n));return vn(wo([a[0]*s+i[0]*(1-s),a[1]*s+i[1]*(1-s),a[2]*s+i[2]*(1-s)],r[3]*s+o[3]*(1-s)))}function Ct(e,t,n){let r=t[0],o=-1;for(let a of t){let i=$t(a,e,n);i>o&&(o=i,r=a)}return r}function K(e,t){let n=e.theme;switch(t){case"accent":return{role:t,fill:e.paint("accent"),text:e.paint("onAccent"),raw:n.accent};case"ink":return{role:t,fill:e.paint("ink"),text:e.paint("onInk"),raw:n.ink};case"strong":return{role:t,fill:e.paint("neutralStrong"),text:e.paint("onNeutralStrong"),raw:n.neutralStrong};case"soft":return{role:t,fill:e.paint("neutralSoft"),text:e.paint("ink"),raw:n.neutralSoft};default:return{role:"neutral",fill:e.paint("neutral"),text:e.paint("ink"),raw:n.neutral}}}function vo(e,t){let n=Ct(t,[e.theme.ink,e.theme.onAccent,e.theme.onNeutralStrong]);return $t(n,t)>=4.5?n===e.theme.ink?e.paint("ink"):n===e.theme.onAccent?e.paint("onAccent"):e.paint("onNeutralStrong"):Ct(t,["#FFFFFF","#000000"])}function qe(e,t){let n=Ye(e.theme.neutralStrong,e.theme.neutral,t);return{role:"mix",fill:e.mix("neutralStrong","neutral",t),text:vo(e,n),raw:n}}function ue(e,t,n){let r=new Array(t),o=[];for(let i=0;i<t;i++)n.has(i)?r[i]=K(e,"accent"):o.push(i);let a=o.length;return o.forEach((i,s)=>{if(a===1)r[i]=K(e,"neutral");else if(s===0)r[i]=K(e,"ink");else if(s===a-1)r[i]=K(e,"neutral");else if(a===3)r[i]=K(e,"strong");else{let l=(s-1)/Math.max(1,a-2);r[i]=l<=.001?K(e,"strong"):qe(e,1-l)}}),r}var Mt="mix:";function Oe(e){return e({theme:bt,cssVars:!1,paint:n=>n,color:n=>n??"neutral",raw:n=>n??"neutral",mix:(n,r,o)=>`${Mt}${o}`}).map(n=>n.fill)}function $n(e,t){return t?.startsWith(Mt)?e.mix("neutralStrong","neutral",Number(t.slice(Mt.length))):e.color(t)}function Cn(e,t,n){return ue(e,t+1,n).slice(0,t)}function Mn(e,t,n,r="neutral"){let o=K(e,"accent"),a=K(e,r);return Array.from({length:t},(i,s)=>n.has(s)?o:a)}function Tn(e,t,n){let r=new Array(t),o=[];for(let i=0;i<t;i++)n.has(i)?r[i]=K(e,"accent"):o.push(i);let a=o.length;return o.forEach((i,s)=>{a===1?r[i]=K(e,"neutral"):s===0?r[i]=K(e,"strong"):s===a-1?r[i]=K(e,"neutral"):r[i]=qe(e,1-s/(a-1))}),r}var ae=F(V(),1);var Je=(e,t="")=>n=>Number.isFinite(n)?`${e(n)}${t}`:e(n),Z="en-US",Sn=new Map;function Tt(e,t){let n=t.maximumFractionDigits!==void 0||t.style==="currency"?t:{...t,maximumFractionDigits:Math.max(1,t.minimumFractionDigits??0)},r=e+JSON.stringify(n),o=Sn.get(r);return o||(o=new Intl.NumberFormat(e,n),Sn.set(r,o)),o}function St(e){return/^[-\u2212]/.test(e)&&!/[1-9]/.test(e)?e.slice(1):e}function Fe(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=Z,...r}=t;return St(Tt(n,r).format(e))}var At=e=>e!==0&&Math.abs(e)<.05,Ft=(e,t,n="")=>`${Fe(e,{locale:t,maximumSignificantDigits:2,maximumFractionDigits:20})}${n}`;function Ze(e,t={}){if(!Number.isFinite(e))return"-";if(At(e)&&t.maximumFractionDigits===void 0)return Ft(e,t.locale??Z,"%");let n=Math.abs(e);return`${Fe(e,{maximumFractionDigits:n>0&&n<1?1:0,...t})}%`}function Rn(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=Z,...r}=t;if(W(n)==="ko"){let o=Math.abs(e),a=[[1e12,"조"],[1e8,"억"],[1e4,"만"],[1,""]],i=a.findIndex(([s])=>o>=s);for(i<0&&(i=a.length-1);;){let[s,l]=a[i],c=o/s,m=Math.max(r.minimumFractionDigits??0,r.maximumFractionDigits??(s===1||c<100?1:0)),u=Math.round(c*10**m)/10**m;if(i>0&&u>=a[i-1][0]/s){i--;continue}return(e<0&&u!==0?"-":"")+Fe(u,{locale:n,...r,maximumFractionDigits:m})+l}}return St(Tt(n,{notation:"compact",...r}).format(e))}var $o=(e,t=W(e)==="ko"?"KRW":"USD")=>({style:"currency",currency:t,maximumFractionDigits:t==="KRW"?0:2});function $e(e,t=Z,n){if(typeof e=="function")return e;let r=(o,a="",i="")=>{let s=Tt(t,o);return l=>Number.isFinite(l)?`${i}${St(s.format(l))}${a}`:"-"};if(e&&typeof e=="object"){let{suffix:o="",prefix:a="",...i}=e;return r(i,o,a)}switch(e??n){case"integer":return r({maximumFractionDigits:0});case"decimal":return r({minimumFractionDigits:1,maximumFractionDigits:2});case"percent":return o=>Ze(o,{locale:t});case"ratio":return o=>Ze(o*100,{locale:t});case"compact":return o=>Rn(o,{locale:t});case"currency":return r($o(t));default:{let o=r({maximumFractionDigits:1});return a=>At(a)?Ft(a,t):o(a)}}}function Pn(e,t=Z,n=0){return e!==void 0?$e(e,t):n>=1e5?r=>At(r)?Ft(r,t):Rn(r,{locale:t}):r=>Fe(r,{locale:t})}function Co(e,t,n=1){let r=new Date(+e,+t-1,+n);return r.getMonth()===+t-1&&r.getDate()===+n?r:null}var Nt=e=>Number.isInteger(e)&&e>=1e3&&e<=9999,Mo=/^\d{4}-\d{1,2}(-\d{1,2})?([T ][\d:.]+(Z|[+-]\d{2}:?\d{2})?)?$/,To=["january","february","march","april","may","june","july","august","september","october","november","december"],An=e=>{let t=e.toLowerCase();return t.length<3?0:To.findIndex(n=>n.startsWith(t))+1},Fn=e=>+e+(+e<30?2e3:1900);function Dn(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}var So=[/^(\d{4})-(\d{1,2})(?:-(\d{1,2}))?$/,/^(\d{4})[./]\s*(\d{1,2})[./]\s*(\d{1,2})\.?$/,/^(19\d\d|20\d\d|2100)(\d\d)(\d\d)$/,/^(\d{4})년\s*(\d{1,2})월(?:\s*(\d{1,2})일)?$/],Ln=/^(\d{1,2})([./-])(\d{1,2})\2(\d{4})$/,En=/\{([^{}]+)\}/g;function Qe(e,t){let n;for(let r of So)if(n=r.exec(e))return[+n[1],+n[2],+(n[3]??1),n[3]?1:2];if(/^\d{4}-\d/.test(e))return null;if(n=/^(\d{2})\.\s*(\d{1,2})\.\s*(\d{1,2})\.?$/.exec(e))return t?[Fn(n[3]),+n[2],+n[1],1]:[Fn(n[1]),+n[2],+n[3],1];if(n=/^(?:(\d{4})\s*-?\s*Q([1-4])|Q([1-4])\s*-?\s*(\d{4})|(\d{4})년\s*([1-4])분기)$/i.exec(e))return[+(n[1]??n[4]??n[5]),+(n[2]??n[3]??n[6])*3-2,1,3];if(n=Ln.exec(e)){let r=+n[1],o=+n[3],a=r>12||o<=12&&t===!0;return[+n[4],a?o:r,a?r:o,1]}if(n=/^(\d{1,2})[\s-]+([a-z]{3,9})\.?[\s-]+(\d{4})$/i.exec(e)){let r=An(n[2]);return r?[+n[3],r,+n[1],1]:null}if(n=/^([a-z]{3,9})\.?\s+(?:(\d{1,2}),?\s+)?(\d{4})$/i.exec(e)){let r=An(n[1]);return r?[+n[3],r,+(n[2]??1),n[2]?1:2]:null}return null}var _n=e=>Mo.test(e)||Qe(e)!==null;function In(e){let t;for(let n of e){let r=typeof n=="string"?Ln.exec(n.trim()):null;if(r){if(+r[1]>12)return!0;+r[3]>12&&(t=!1)}}return t}function et(e,t){if(e instanceof Date)return Number.isNaN(e.getTime())?null:e;if(typeof e=="number"){if(!Number.isFinite(e))return null;if(Number.isInteger(e)){if(Nt(e))return new Date(e,0,1);if(e>=19000101&&e<=21001231)return et(`${e}`)}return new Date(Math.abs(e)>=1e9&&Math.abs(e)<1e10?e*1e3:e)}if(typeof e=="string"&&e.trim()){let n=e.trim(),r=Qe(n,t);if(r)return Co(r[0],r[1],r[2]);if(/^\d{4}$/.test(n))return new Date(Number(n),0,1);if(!/\d{4}/.test(n))return null;let o=new Date(n);return Number.isNaN(o.getTime())?null:o}return null}var Nn=new Map;function Be(e,t={month:"short",day:"numeric"}){let n=et(e);if(!n)return"-";let{locale:r=Z,...o}=t,a=r+JSON.stringify(o),i=Nn.get(a);return i||(i=new Intl.DateTimeFormat(r,o),Nn.set(a,i)),i.format(n)}var Rt=F(I(),1),tt=(0,ae.createContext)({theme:pe,cssVars:!0});function Ao(e,t=pe){return e?typeof e=="string"?yt[e]??t:kt(t,e):t}function nt(e){let t=(0,ae.useContext)(tt),n=e.base?yt[e.base]:t.theme,r=(0,ae.useMemo)(()=>Ao(e.theme,n),[e.theme,n]),o=e.cssVars??t.cssVars,a=e.locale??t.locale,i=(0,ae.useMemo)(()=>({theme:r,cssVars:o,locale:a}),[r,o,a]),s=(0,ae.useMemo)(()=>xt(r),[r]),l=e.paint?{background:r.bg,color:r.ink,fontFamily:r.fontFamily,...s,...e.style}:{display:"contents",...s,...e.style};return(0,Rt.jsx)(tt.Provider,{value:i,children:(0,Rt.jsx)("div",{className:e.className,"data-ztd-theme":r.name,lang:e.locale,style:l,children:e.children})})}var Fo=new Set(["bg","panel","ink","muted","dim","accent","accentText","onAccent","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"]);function Bn(e){return Fo.has(e)}function No(e,t){let n=r=>t?`var(${Ke(r)}, ${e[r]})`:e[r];return{theme:e,cssVars:t,paint:n,color:(r,o="neutral")=>r?Bn(r)?n(r):r:n(o),raw:(r,o="neutral")=>r?Bn(r)?e[r]:r:e[o],mix:(r,o,a)=>{let i=Math.round(Math.max(0,Math.min(1,a))*1e3)/10;return t?`color-mix(in oklab, ${n(r)} ${i}%, ${n(o)})`:Ye(e[r],e[o],a)}}}function ie(e){let t=(0,ae.useContext)(tt);return(0,ae.useMemo)(()=>{let n=kt(t.theme,e);return No(n,t.cssVars)},[t.theme,t.cssVars,e])}function J(e){let t=(0,ae.useContext)(tt);return e??t.locale??Z}function zn(e){return e?xt(e):{}}var rt=F(V(),1),Pt=(0,rt.createContext)(void 0);function Hn(e){let t=(0,rt.useContext)(Pt);return e!==void 0&&t!==void 0?`${e}:${t}`:e??t}var S=F(I(),1),Ro={legend:"Legend",replay:"Replay animation",replayTitle:"Replay",sample:"Sample data",loadError:"Couldn't load data",retry:"Try again",loading:"Loading",empty:"No data to show",source:"Source",shown:(e,t)=>`${e} of ${t} series shown`},Po={en:Ro,ko:{legend:"범례",replay:"애니메이션 다시 재생",replayTitle:"다시 재생",sample:"예시 데이터",loadError:"데이터를 불러오지 못했어요",retry:"다시 시도",loading:"불러오는 중",empty:"표시할 데이터가 없어요",source:"출처",shown:(e,t)=>`${t}개 중 ${e}개 보임`}};var Do={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},Dt=e=>Po[W(J(e))];function Lt(e){let t=ie(e.theme),n=Dt(e.locale),[r,o]=(0,ot.useState)(!1),a=e.size??11.5,i=e.onToggle,s=new Set(i?e.hidden:void 0),l=e.items.filter(m=>!s.has(m.label)).length,c=(0,S.jsx)("ul",{"aria-label":n.legend,style:{display:"flex",flexWrap:"wrap",justifyContent:e.align==="start"?"flex-start":"flex-end",gap:"4px 12px",margin:0,padding:0,listStyle:"none"},children:e.items.map((m,u)=>{let h=!s.has(m.label),f=h&&l===1,d=(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(Lo,{p:t,item:m,off:!h}),(0,S.jsx)("span",{style:h?void 0:{textDecoration:"line-through"},children:m.label})]});return(0,S.jsx)("li",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:a,color:t.paint("muted"),lineHeight:1.3},children:i?(0,S.jsx)("button",{type:"button",className:"ztd-btn","aria-pressed":h,"aria-disabled":f||void 0,onClick:()=>{f||(i(m.label),o(!0))},style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:24,minWidth:24,padding:"0 2px",margin:0,border:0,borderRadius:4,background:"transparent",color:"inherit",fontSize:"inherit",lineHeight:"inherit",cursor:f?"default":void 0},children:d}):d},u)})});return i?(0,S.jsxs)(S.Fragment,{children:[c,(0,S.jsx)("span",{"aria-live":"polite","aria-atomic":"true",style:Do,children:r?n.shown(l,e.items.length):""})]}):c}function Lo({p:e,item:t,off:n}){let r=$n(e,t.color),o=t.shape??"square";return o==="line"||o==="dash"?(0,S.jsxs)("svg",{width:14,height:8,"aria-hidden":"true",style:{flex:"none",opacity:n?.35:void 0},children:[(0,S.jsx)("line",{x1:1,x2:13,y1:4,y2:4,stroke:r,strokeWidth:2,strokeDasharray:o==="dash"?"3 2":void 0,strokeLinecap:"round"}),o==="line"?(0,S.jsx)("circle",{cx:7,cy:4,r:2.2,fill:r}):null]}):(0,S.jsx)("span",{"aria-hidden":"true",style:{width:9,height:9,flex:"none",borderRadius:o==="circle"?9:2.5,background:r,boxShadow:t.color==="neutral"||t.color==="neutralSoft"||!t.color?`inset 0 0 0 1px ${e.paint("line2")}`:void 0,opacity:n?.35:void 0}})}function Eo(e){let t=ie(e.theme),n=yn(e.level,W(J(e.locale)));return(0,S.jsx)("span",{style:{background:t.paint(n.bg),color:t.paint(n.fg),borderRadius:8,padding:"3px 9px",fontSize:12.5,fontWeight:700,lineHeight:"18px",whiteSpace:"nowrap",flex:"none"},children:n.text})}function _o(e,t,n){if(typeof e!="string"||!t)return e;let r=e.indexOf(t);return r<0?e:(0,S.jsxs)(S.Fragment,{children:[e.slice(0,r),(0,S.jsx)("span",{style:{color:n},children:t}),e.slice(r+t.length)]})}function jn(e){let t=ie(e.theme),n=Dt(e.locale),[r,o]=(0,ot.useState)(0);ce(()=>Ie(),[]);let a=()=>{o(h=>h+1),e.onReplay?.()},i=Array.isArray(e.legend)?(0,S.jsx)(Lt,{items:e.legend,theme:e.theme,locale:e.locale}):e.legend,s=e.as??"h3",l=e.number===void 0?null:typeof e.number=="number"?String(e.number).padStart(2,"0"):e.number,c=e.replay||e.onReplay,m=e.source!==void 0||e.note!==void 0?(0,S.jsxs)("p",{style:{margin:0,fontSize:12,color:t.paint("muted"),lineHeight:1.4},children:[e.source!==void 0?`${n.source}: `:null,e.source,e.source!==void 0&&e.note!==void 0?" · ":null,e.note]}):null,u=e.takeaway!==void 0||e.level||e.sample?(0,S.jsxs)("footer",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,marginTop:2},children:[(0,S.jsx)("span",{style:{fontSize:17,fontWeight:800,color:t.paint("ink"),letterSpacing:-.3,lineHeight:1.3,minWidth:0},children:e.takeaway}),(0,S.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:8,flex:"none"},children:[e.sample?(0,S.jsx)("span",{style:{fontSize:11.5,color:t.paint("muted"),whiteSpace:"nowrap"},children:typeof e.sample=="string"?e.sample:n.sample}):null,e.level?(0,S.jsx)(Eo,{level:e.level,theme:e.theme,locale:e.locale}):null]})]}):null;return(0,S.jsxs)("section",{id:e.id,className:`ztd-card${e.className?` ${e.className}`:""}`,style:{background:t.paint("panel"),color:t.paint("ink"),border:`1px solid ${t.paint("line")}`,borderRadius:`var(--ztd-radius, ${t.theme.radius}px)`,padding:"20px 20px 16px",display:"flex",flexDirection:"column",gap:12,minWidth:0,boxSizing:"border-box",fontFamily:t.cssVars?`var(--ztd-font, ${t.theme.fontFamily})`:t.theme.fontFamily,wordBreak:"keep-all",textWrap:"balance",...e.style},children:[(0,S.jsxs)("header",{style:{display:"flex",flexDirection:"column",gap:6,minWidth:0},children:[(0,S.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0},children:[l?(0,S.jsx)("span",{style:{fontFamily:t.cssVars?`var(--ztd-mono, ${t.theme.monoFamily})`:t.theme.monoFamily,fontSize:17,fontWeight:700,color:t.paint("accentText"),letterSpacing:-.2,flex:"none"},children:l}):null,(0,S.jsx)(s,{style:{margin:0,fontSize:22,fontWeight:800,color:t.paint("ink"),letterSpacing:-.5,lineHeight:1.25,minWidth:0,flex:1,overflow:"hidden",textOverflow:"ellipsis"},children:_o(e.title,e.accent,t.paint("accentText"))}),e.actions,c?(0,S.jsx)("button",{type:"button",className:"ztd-btn",onClick:a,"aria-label":e.replayLabel??n.replay,title:e.replayLabel??n.replayTitle,style:{background:"transparent",color:t.paint("muted"),border:`1px solid ${t.paint("line2")}`,borderRadius:14,width:28,height:28,display:"inline-grid",placeItems:"center",padding:0,flex:"none"},children:(0,S.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,S.jsx)("path",{d:"M3 12a9 9 0 1 0 3-6.7"}),(0,S.jsx)("path",{d:"M3 3v6h6"})]})}):null]}),e.subtitle!==void 0||i?(0,S.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"4px 12px",flexWrap:"wrap",minHeight:18},children:[e.subtitle!==void 0?(0,S.jsx)("span",{style:{fontSize:12.5,color:t.paint("muted"),lineHeight:1.4},children:e.subtitle}):(0,S.jsx)("span",{}),i]}):null]}),(0,S.jsx)("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",minHeight:0,minWidth:0},children:(0,S.jsx)(Pt.Provider,{value:r,children:(0,S.jsx)(Te.Provider,{value:typeof e.title=="string"||typeof e.title=="number"?String(e.title):void 0,children:e.children})})}),m?(0,S.jsxs)(S.Fragment,{children:[m,u]}):u]})}function Et(e){let t=ie(e.theme),n=Dt(e.locale),r=e.height??220;if(ce(()=>Ie(),[]),e.error){let o=typeof e.error=="string"?e.error:e.error.message;return(0,S.jsx)("div",{role:"alert",style:{height:r,display:"grid",placeItems:"center",textAlign:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,S.jsxs)("div",{style:{display:"grid",gap:8,justifyItems:"center",padding:16},children:[(0,S.jsx)("span",{style:{fontSize:14,fontWeight:700,color:t.paint("ink")},children:n.loadError}),(0,S.jsx)("span",{style:{fontSize:12,color:t.paint("muted"),maxWidth:280,wordBreak:"break-word"},children:o}),e.onRetry?(0,S.jsx)("button",{type:"button",className:"ztd-btn",onClick:e.onRetry,style:{marginTop:4,background:t.paint("ink"),color:t.paint("onInk"),border:"none",borderRadius:14,padding:"5px 14px",fontSize:12.5,fontWeight:700},children:n.retry}):null]})})}return e.loading?(0,S.jsx)("div",{role:"status","aria-busy":"true","aria-label":n.loading,style:{height:r,display:"flex",alignItems:"flex-end",gap:8,padding:"12px 4px"},children:[.55,.8,.4,.95,.65,.75,.5].map((o,a)=>(0,S.jsx)("span",{className:"ztd-skeleton",style:{flex:1,height:`${o*100}%`,background:t.paint("lift"),borderRadius:6,animationDelay:`${a*90}ms`}},a))}):e.empty?(0,S.jsx)("div",{style:{height:r,display:"grid",placeItems:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,S.jsx)("span",{style:{fontSize:13,color:t.paint("muted")},children:e.emptyText??n.empty})}):(0,S.jsx)(S.Fragment,{children:e.children})}var Ee=F(V(),1);var Q=F(V(),1);var z=F(I(),1),at=60;var it={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};function Vn(e){let{c:t,events:n}=e,r=(0,Q.useId)().replace(/:/g,""),o=`${r}t`,a=`${r}d`;t.events.current=n,ce(()=>{Ie()},[]);let i=n.length,s=!e.noNav&&i>0,l=(0,Q.useContext)(Te),c=e.ariaLabel??l??e.kind,m=(0,Q.useMemo)(()=>s?`${n.length}${n.slice(0,at).map(b=>`${b.label}${b.series??""}${b.formatted??b.value??""}`).join("")}`:"",[n,s]),u=(0,Q.useMemo)(()=>(0,z.jsx)(Io,{label:c,events:n,t:t.t}),[c,m,t.t]),h=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{let b=()=>{h.current=null};return window.addEventListener("scroll",b,{capture:!0,passive:!0}),window.addEventListener("resize",b,{passive:!0}),()=>{window.removeEventListener("scroll",b,{capture:!0}),window.removeEventListener("resize",b)}},[]),(0,Q.useEffect)(()=>{h.current=null},[t.width,t.height]);let f=b=>{if(b.target!==b.currentTarget)return;if(e.onKey?.(b)){b.preventDefault();return}let T=t.active,N;switch(b.key){case"ArrowRight":case"ArrowDown":N=T===null?0:(T+1)%i;break;case"ArrowLeft":case"ArrowUp":N=T===null?i-1:(T-1+i)%i;break;case"Home":N=0;break;case"End":N=i-1;break;case"Escape":if(T===null)return;N=null;break;case"Enter":case" ":T!==null&&(b.preventDefault(),t.click(T));return;default:return}b.preventDefault(),t.setActive(N,"keyboard")},{via:d,node:p,setActive:k}=t;(0,Q.useEffect)(()=>{if(d!=="touch"||!p)return;let b=T=>{p.contains(T.target)||k(null)};return document.addEventListener("pointerdown",b),()=>document.removeEventListener("pointerdown",b)},[d,p,k]);let w=t.active!==null?n[t.active]:null,M=t.showTooltip&&e.renderTip!==!1&&!t.pending&&t.via!=="sync"?e.tip:null,$=M&&!t.responsive&&t.node&&t.width&&t.node.getBoundingClientRect().width/t.width||1,C=typeof e.renderTip=="function"&&w?e.renderTip(w):null,y=e.announce??(t.via==="keyboard"&&w?`${w.label}${w.series?` ${w.series}`:""}: ${w.formatted??w.value??""} (${(t.active??0)+1}/${i})`:""),A;if(M){let b=M.x*$,T=t.width*$,N=`clamp(${(4-b).toFixed(1)}px, -50%, calc(${(T-b-4).toFixed(1)}px - 100%))`,D=M.y<64;A={position:"absolute",left:b,top:M.y*$,transform:`translate(${N}, ${D?"16px":"calc(-100% - 14px)"})`,background:t.p.paint("panel"),color:t.p.paint("ink"),border:`1px solid ${t.p.paint("line")}`,borderRadius:12,padding:"8px 11px",pointerEvents:"none",whiteSpace:"nowrap",fontSize:12,lineHeight:"18px",zIndex:5,boxShadow:"0 10px 28px -8px rgba(0,0,0,0.28), 0 2px 6px rgba(0,0,0,0.08)",fontVariantNumeric:"tabular-nums",minWidth:112,maxWidth:Math.max(160,t.width*$-8)}}let R=b=>{h.current=null,b.pointerType!=="touch"&&t.via!=="keyboard"&&t.setActive(null)},L=b=>b?T=>{let N=h.current??(h.current=T.currentTarget.getBoundingClientRect());N.width&&b((T.clientX-N.left)/N.width*t.width,(T.clientY-N.top)/N.height*t.height,T)}:void 0,E=L(e.onPointerMove),_=L(e.onPointerDown),P=E||_?b=>{b.pointerType==="touch"&&E?.(b),_?.(b)}:void 0,g=L(e.onPointerUp),v=zn(e.theme);return(0,z.jsxs)("div",{ref:t.ref,className:`ztd-root${t.reduced?" ztd-still":""}${e.className?` ${e.className}`:""}`,role:"group","aria-roledescription":t.t.chart,"aria-label":c,"aria-describedby":a,tabIndex:s?0:void 0,onKeyDown:s?f:void 0,onBlur:b=>{t.via==="keyboard"&&!b.currentTarget.contains(b.relatedTarget)&&t.setActive(null)},onPointerLeave:R,style:{width:"100%",maxWidth:t.measured?void 0:"100%",fontFamily:t.p.cssVars?`var(--ztd-font, ${t.p.theme.fontFamily})`:t.p.theme.fontFamily,color:t.p.paint("ink"),...v,...e.style},children:[t.pending?null:e.underlay,(0,z.jsxs)("svg",{className:"ztd-svg",role:"img","aria-labelledby":`${o} ${a}`,viewBox:`0 0 ${Math.max(1,Math.round(t.width*10)/10)} ${Math.max(1,Math.round(t.height*10)/10)}`,width:"100%",preserveAspectRatio:"xMidYMid meet",onPointerMove:E,onPointerDown:P,onPointerUp:g,onPointerCancel:g,style:{fontFamily:"inherit",touchAction:"pan-y",position:e.underlay?"relative":void 0},children:[(0,z.jsx)("title",{id:o,children:c}),(0,z.jsx)("desc",{id:a,children:i||t.description!==void 0?e.description:e.emptyText??t.t.empty}),e.defs&&!t.pending?(0,z.jsx)("defs",{children:e.defs}):null,t.pending?null:e.children]}),t.pending?null:e.overlay,M?(0,z.jsx)("div",{className:"ztd-tip","aria-hidden":"true",style:A,children:C??(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)("div",{style:{fontWeight:600,fontSize:11.5,color:t.p.paint("muted"),marginBottom:M.rows.length?4:0,overflow:"hidden",textOverflow:"ellipsis"},children:M.title}),M.rows.map((b,T)=>(0,z.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:16,justifyContent:"space-between"},children:[(0,z.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:7,color:t.p.paint(b.strong?"ink":"muted")},children:[b.color?(0,z.jsx)("span",{style:{width:8,height:8,borderRadius:999,background:b.color,display:"inline-block",boxShadow:"inset 0 0 0 1px rgba(127,127,127,0.3)"}}):null,b.label]}),(0,z.jsx)("span",{style:{fontWeight:b.strong===!1?500:700},children:b.value})]},T))]})}):null,(0,z.jsx)("span",{className:"ztd-sr",style:it,"aria-live":"polite","aria-atomic":"true",children:y}),s&&!t.pending?u:null]})}function Io({label:e,events:t,t:n}){return(0,z.jsx)("div",{className:"ztd-sr",style:it,children:(0,z.jsxs)("table",{children:[(0,z.jsx)("caption",{children:n.table(e)}),(0,z.jsxs)("tbody",{children:[t.slice(0,at).map((r,o)=>(0,z.jsxs)("tr",{children:[(0,z.jsx)("th",{scope:"row",children:r.series?`${r.label} · ${r.series}`:r.label}),(0,z.jsx)("td",{children:r.formatted??r.value??""})]},o)),t.length>at?(0,z.jsx)("tr",{children:(0,z.jsx)("td",{colSpan:2,children:n.more(t.length-at)})}):null]})]})})}function Wn(e){let t=e.baseline??"central";return(0,z.jsx)("text",{x:Math.round(e.x*10)/10,y:Math.round(e.y*10)/10,dy:t==="central"?"0.35em":t==="hanging"?"0.75em":void 0,fontSize:e.size??11,fill:e.fill??"currentColor",textAnchor:e.anchor??"start",fontWeight:e.weight??400,opacity:e.opacity===void 0||e.opacity>=1?void 0:Math.max(0,e.opacity),className:e.className,letterSpacing:e.letterSpacing,style:{pointerEvents:"none",fontVariantNumeric:"tabular-nums"},children:e.children})}var x=(e,t,n,r,o={})=>({name:e,type:t,required:n,description:r,...o}),se=x("label","string",!0,"Item name field"),q=x("value","number",!0,"Value field"),Oo=[se,q],Bo=[se,q],zo=[x("label","string",!0,"Stage name"),x("value","number",!0,"Users at the stage")],Ho=[se,q],jo=[x("label","string",!0,"Leaf (lowest level) name"),q,x("group","string",!1,"Parent group field")],Vo=[x("label","string",!0,"Leaf name"),q,x("group","string",!1,"Parent group field")],Wo=[se,x("value","number",!0,"Change (total rows may omit it)"),x("type","string",!1,'"total" makes a total bar')],Go=[se,q],Ko=[x("x","string",!0,"Column field"),x("series","string",!0,"Stacked series field"),q],Uo=[x("x","string",!0,"Column field"),x("y","string",!0,"Row field"),q],Xo=[x("axis","string",!0,"Metric (axis) field"),x("value","number",!0,"Value field",{multi:!0}),x("series","string",!1,"Series field")],Yo=[x("x","number",!0,"x value"),x("y","number",!0,"y value"),x("size","number",!1,"Circle size"),x("label","string",!1,"Name")],Kn=x("upper","number",!1,"Upper bound of the range band. Same shape as lower",{multi:!0}),qo=[x("x","any",!0,"x field (date, number or category)"),x("y","number",!0,"y field. An array for wide tables",{multi:!0}),x("series","string",!1,"Series field (long tables)"),x("lower","number",!1,"Lower bound of the range band. In wide tables an array in the order of y",{multi:!0}),Kn],Zo=[x("x","any",!0,"x field"),x("y","number",!0,"y field. An array for wide tables",{multi:!0}),x("series","string",!1,"Series field"),x("lower","number",!1,'Lower bound of the range band, with stack "none" only. In wide tables an array in the order of y',{multi:!0}),Kn],Jo=[x("x","any",!0,"x field"),x("y","number",!0,"y field",{multi:!0}),x("series","string",!1,"Series field")],Qo=[x("x","string",!0,"Category field"),x("y","number",!0,"Value field. An array for wide tables",{multi:!0}),x("series","string",!1,"Series field"),x("line","number",!1,"Lines over vertical bars on the same axis, such as a target or last year. An array for several. Bars stay gray unless highlight is set, and with series the line averages rows of the same x",{multi:!0})],ea=[se,q],ta=[x("value","number",!0,"Value field",{prop:"valueKey"}),x("target","number",!1,"Target field",{prop:"targetKey"})],na=[se,x("value","number",!0,"Actual value field"),x("target","number",!1,"Target field")],ra=[x("x","any",!1,"x field"),x("y","number",!0,"y field")],oa=[se,x("x","string",!1,"Period field (long tables)"),x("value","number",!1,"Value field (long tables)")],aa=[se,x("start","number",!0,"Before value"),x("end","number",!0,"After value")],ia=[se,q],sa=[x("value","number",!0,"Value field"),x("group","string",!1,"Group (row) field"),x("label","string",!1,"Dot name")],la=[x("group","string",!0,"Group field"),x("value","number",!0,"Value field")],ca=[x("source","string",!0,"Source node"),x("target","string",!0,"Target node"),q],ua=[x("source","string",!0,"Sending group"),x("target","string",!0,"Receiving group"),q],ma=[x("date","date",!0,"Date field"),q],da=[x("x","any",!0,"Period field"),x("series","string",!0,"Item field"),x("rank","number",!1,"Rank field (1 is first)"),x("value","number",!1,"Value field (instead of rank, largest is first)")],fa=[x("group","string",!0,"Group field"),x("value","number",!0,"Value field")],ha=[x("label","string",!1,"Row name field")],ga=[x("x","date",!0,"Date (period) field"),x("open","number",!0,"Open price field"),x("high","number",!0,"High price field"),x("low","number",!0,"Low price field"),x("close","number",!0,"Close price field"),x("volume","number",!1,"Volume field")],pa=[se,q],ba=[x("x","any",!0,"Period field (date or category)"),x("y","number",!0,"Back row fields stacked into each block. An array for wide tables",{multi:!0}),x("series","string",!1,"Series field (long tables, back row only)"),x("front","number",!1,"Front row fields: a smaller outcome in the same unit as y (wide tables only)",{multi:!0})],ya=[x("value","number",!1,"Sample value field (raw rows)"),x("group","string",!1,"Group field. Up to 2 groups overlap"),x("x0","number",!1,"Bin start (pre-binned rows)"),x("x1","number",!1,"Bin end (pre-binned rows)"),x("count","number",!1,"Samples in the bin (pre-binned rows)")],xa=[x("region","string",!0,"Region name or code, matched to a tile of options.map"),q],ka=[x("x","number",!0,"x value"),x("y","number",!0,"y value"),x("series","string",!1,"Series field (one color per series)"),x("label","string",!1,"Name")],Gn={pie:Oo,donut:Bo,funnel:zo,waffle:Ho,treemap:jo,sunburst:Vo,waterfall:Wo,pareto:Go,marimekko:Ko,heatmap:Uo,radar:Xo,bubble:Yo,line:qo,area:Zo,stream:Jo,bar:Qo,radialBar:ea,gauge:ta,bullet:na,sparkline:ra,slope:oa,dumbbell:aa,lollipop:ia,beeswarm:sa,ridgeline:la,sankey:ca,chord:ua,calendar:ma,bump:da,box:fa,parallel:ha,candlestick:ga,segmented:pa,skyline:ba,histogram:ya,scatter:ka,tileMap:xa},Ne={pie:{component:"PieChart",name:"Pie chart",nameKo:"파이 차트"},donut:{component:"DonutChart",name:"Donut chart",nameKo:"도넛 차트"},funnel:{component:"FunnelChart",name:"Funnel chart",nameKo:"퍼널 차트"},waffle:{component:"WaffleChart",name:"Waffle chart",nameKo:"와플 차트"},treemap:{component:"Treemap",name:"Treemap",nameKo:"트리맵"},sunburst:{component:"SunburstChart",name:"Sunburst",nameKo:"선버스트"},waterfall:{component:"WaterfallChart",name:"Waterfall chart",nameKo:"폭포 차트"},pareto:{component:"ParetoChart",name:"Pareto chart",nameKo:"파레토 차트"},marimekko:{component:"MarimekkoChart",name:"Marimekko chart",nameKo:"마리메코 차트"},heatmap:{component:"Heatmap",name:"Heatmap",nameKo:"히트맵"},radar:{component:"RadarChart",name:"Radar chart",nameKo:"레이더 차트"},bubble:{component:"BubbleChart",name:"Bubble chart",nameKo:"버블 차트"},line:{component:"LineChart",name:"Line chart",nameKo:"라인 차트"},area:{component:"AreaChart",name:"Area chart",nameKo:"영역 차트"},stream:{component:"StreamGraph",name:"Streamgraph",nameKo:"스트림그래프"},bar:{component:"BarChart",name:"Bar chart",nameKo:"막대 차트"},radialBar:{component:"RadialBarChart",name:"Radial bar chart",nameKo:"방사형 막대"},gauge:{component:"GaugeChart",name:"Gauge",nameKo:"게이지"},bullet:{component:"BulletChart",name:"Bullet chart",nameKo:"불릿 차트"},sparkline:{component:"Sparkline",name:"Sparkline",nameKo:"스파크라인"},slope:{component:"SlopeChart",name:"Slope chart",nameKo:"슬로프 차트"},dumbbell:{component:"DumbbellChart",name:"Dumbbell chart",nameKo:"덤벨 차트"},lollipop:{component:"LollipopChart",name:"Lollipop chart",nameKo:"롤리팝 차트"},beeswarm:{component:"BeeswarmChart",name:"Beeswarm",nameKo:"비스웜"},ridgeline:{component:"RidgelineChart",name:"Ridgeline",nameKo:"릿지라인"},sankey:{component:"SankeyChart",name:"Sankey diagram",nameKo:"생키 다이어그램"},chord:{component:"ChordChart",name:"Chord diagram",nameKo:"코드 다이어그램"},calendar:{component:"CalendarHeatmap",name:"Calendar heatmap",nameKo:"캘린더 히트맵"},bump:{component:"BumpChart",name:"Bump chart",nameKo:"범프 차트"},box:{component:"BoxPlot",name:"Box / violin plot",nameKo:"박스 플롯"},parallel:{component:"ParallelCoordinates",name:"Parallel coordinates",nameKo:"평행 좌표"},candlestick:{component:"CandlestickChart",name:"Candlestick chart",nameKo:"캔들스틱"},segmented:{component:"SegmentedBar",name:"Segmented bar",nameKo:"비율 막대"},skyline:{component:"SkylineChart",name:"Skyline",nameKo:"스카이라인"},histogram:{component:"HistogramChart",name:"Histogram",nameKo:"히스토그램"},scatter:{component:"ScatterChart",name:"Scatter plot",nameKo:"산점도"},tileMap:{component:"TileMap",name:"Tile grid map",nameKo:"타일 격자 지도"}};function Un(e,t){return t==="ko"?e.nameKo:e.name}function Xn(e,t){let n=t??e.options?.locale;return typeof n=="string"&&n?n.replace(/_/g,"-"):void 0}var Yn=["line","area","bar","scatter"],qn=24,_t=["line","area","bar","scatter"];function It(e,t,n){return e==="bar"&&n.orientation!=="horizontal"&&n.layout!=="percent"&&n.layout!=="diverging"?[].concat(t.line??[]).map(String):[]}function Zn(e,t,n){return _t.includes(e)&&!It(e,t,n).length}function Jn(e){let t=e.options?.tooltip?.template;return typeof t=="string"&&t?t:void 0}var wa={doughnut:"donut",column:"bar",stackedBar:"bar",groupedBar:"bar",stacked:"area",streamgraph:"stream",radial:"radialBar",radialbar:"radialBar",progress:"gauge",progressRing:"gauge",kpi:"gauge",violin:"box",boxplot:"box",calendarHeatmap:"calendar","parallel-coordinates":"parallel",parallelCoordinates:"parallel",mekko:"marimekko",spider:"radar",ohlc:"candlestick",candle:"candlestick",stock:"candlestick",segment:"segmented",segmentedBar:"segmented",proportionBar:"segmented",stackedBar100:"segmented",hist:"histogram",tilemap:"tileMap",tileGrid:"tileMap",cartogram:"tileMap"};function st(e){let t=Gn[e]?e:wa[e]??Object.keys(Ne).find(n=>n.toLowerCase()===e.toLowerCase()||Ne[n].component.toLowerCase()===e.toLowerCase());if(!(!t||!Ne[t]))return{type:t,component:Ne[t].component,name:Ne[t].name,nameKo:Ne[t].nameKo,encoding:Gn[t]}}function Qn(e){let t=new Set,n=a=>{Array.isArray(a)?a.forEach(n):typeof a=="string"&&a&&t.add(a)},r=e.encoding??{};for(let a of st(e.type)?.encoding.map(i=>i.name)??Object.keys(r))n(r[a]);let o=e.options??{};for(let a of["dimensions","start","end","ranges"])n(o[a]);return[...t]}function er(e,t){return Object.hasOwn(e,t)||t in e&&!(t in{})}function va(e,t){if(e==null||typeof e!="object")return;let n=e;if(er(n,t))return n[t];if(t.includes(".")){let r=n;for(let o of t.split(".")){if(r===null||typeof r!="object"||!er(r,o))return;r=r[o]}return r}}function fe(e){if(typeof e=="number")return Number.isFinite(e)?e:NaN;if(typeof e=="bigint")return Number(e);if(typeof e=="string"){let t=e.trim(),n=/^\(.*\)$/.test(t),r=t.replace(/[()\s%₩$€£¥원명건개회]/g,"").replace(/^\+/,"");if(!r||r.includes(",")&&!/^-?\d{1,3}(,\d{3})*(\.\d+)?$/.test(r))return NaN;let o=Number(r.replace(/,/g,""));return Number.isFinite(o)?n?-o:o:NaN}return e instanceof Date?e.getTime():typeof e=="boolean"?e?1:0:NaN}function Re(e,t){if(typeof e=="function")return e;let n=e??t;return r=>va(r,n)}function Pe(e,t){let n=Re(e,t);return(r,o)=>fe(n(r,o))}function he(e,t){let n=Re(e,t);return(r,o)=>{let a=n(r,o);return a==null?"":a instanceof Date?new Date(a.getTime()-a.getTimezoneOffset()*6e4).toISOString().slice(0,10):String(a)}}function ye(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}function $a(e){let t=[],n=!1;for(let l=0;l<e.length&&l<4e3;l++){let c=e[l];if(c==='"')n=!n;else if(!n&&(c===`
|
|
23
|
+
`||c==="\r"))break;t.push(n?"":c)}let r=t.join(""),o=l=>r.split(l).length-1,a=[","," ",";","|"],i=",",s=0;for(let l of a){let c=o(l);c>s&&(s=c,i=l)}return i}var Ca=/^[-+(]?[₩$€£¥]?\s?\d[\d,]*(\.\d+)?([eE][-+]?\d+)?\)?\s?(%|원|명|건|개|회)?$/;function tr(e){let t=e.trim();if(t==="")return null;if(/^-?0\d/.test(t))return t;if(Ca.test(t)||/^[-+]?\.\d+$/.test(t)){let n=fe(t);if(Number.isFinite(n))return n}return t}function Ce(e,t={}){let{typed:n=!0,header:r=!0}=t,o=e.replace(/^\uFEFF/,"");if(!o.trim())return[];let a=t.delimiter??$a(o),i=[],s=[],l="",c=!1;for(let d=0;d<o.length;d++){let p=o[d];c?p==='"'?o[d+1]==='"'?(l+='"',d++):c=!1:l+=p:p==='"'&&!l.trim()?(c=!0,l=""):p===a?(s.push(l),l=""):p===`
|
|
24
|
+
`||p==="\r"?(p==="\r"&&o[d+1]===`
|
|
25
|
+
`&&d++,s.push(l),i.push(s),s=[],l=""):l+=p}(l!==""||s.length)&&(s.push(l),i.push(s));let m=i.filter(d=>!(d.length===1&&d[0].trim()===""));if(!m.length)return[];let u=d=>n?tr(d):d;if(!r)return m.map(d=>Object.fromEntries(d.map((p,k)=>[String(k),u(p)])));let h=[],f=new Set;return m[0].forEach((d,p)=>{let k=d.trim()||`col${p+1}`,w=k;for(let M=2;f.has(w);M++)w=`${k}_${M}`;f.add(w),h.push(w)}),m.slice(1).map(d=>Object.fromEntries(h.map((p,k)=>[p,u(d[k]??"")])))}function Ot(e,t,n={}){if(!e.length)return[];let{typed:r=!0}=n,o=(t??e[0]).map((i,s)=>String(i??"").trim()||`col${s+1}`);return(t?e:e.slice(1)).map(i=>Object.fromEntries(o.map((s,l)=>[s,r&&typeof i[l]=="string"?tr(i[l]):i[l]??null])))}function Ma(e,t={}){let{labelKey:n="label",valueKey:r="value"}=t,o=Object.values(e);if(o.length&&o.every(a=>Array.isArray(a))){let a=Object.keys(e),i=Math.max(...o.map(s=>s.length));return Array.from({length:i},(s,l)=>Object.fromEntries(a.map(c=>[c,e[c][l]??null])))}return Object.entries(e).map(([a,i])=>({[n]:a,[r]:i}))}function nr(e,t){let n=e;for(let r of t.split(".").filter(Boolean)){if(n===null||typeof n!="object")return;n=n[r]}return n}function xe(e){if(e==null)return[];if(typeof e=="string"){let t=e.trim();if(!t)return[];if(t.startsWith("[")||t.startsWith("{"))try{return xe(JSON.parse(t))}catch{}return Ce(t)}if(Array.isArray(e))return e.length?Array.isArray(e[0])?Ot(e):typeof e[0]=="number"?e.map((t,n)=>({label:String(n+1),value:t})):e.filter(t=>t&&typeof t=="object"):[];if(typeof e=="object"){let t=e;return Array.isArray(t.data)?xe(t.data):Array.isArray(t.rows)&&Array.isArray(t.columns)?Ot(t.rows,t.columns.map(n=>typeof n=="object"&&n&&"name"in n?String(n.name):String(n))):Array.isArray(t.rows)&&Array.isArray(t.fields)||Array.isArray(t.rows)?xe(t.rows):Array.isArray(t.values)?Ot(t.values):Array.isArray(t.items)?xe(t.items):Array.isArray(t.results)?xe(t.results):Ma(t)}return[]}function lt(e){if(!Array.isArray(e))try{return JSON.stringify(e??null)??""}catch{return String(e)}let t=e.length,n=a=>{try{return JSON.stringify(a)}catch{return String(a)}};if(t<=300)return n(e);let r=Math.ceil(t/60),o=[];for(let a=0;a<t;a+=r)o.push(e[a]);return o.push(e[t-1]),`${t}:${n(o)}`}function Bt(e,t="zero"){let n=e.length,r=n?e[0].length:0,o=e.map(()=>new Array(r).fill(0)),a=e.map(()=>new Array(r).fill(0)),i=(l,c)=>{let m=e[l][c];return Number.isFinite(m)&&m>0?m:0},s=new Array(r).fill(0);if(t==="wiggle"&&n>0&&r>1){let l=0;for(let c=1;c<r;c++){let m=0,u=0;for(let h=0;h<n;h++){let f=i(h,c),d=f-i(h,c-1),p=0;for(let k=0;k<h;k++)p+=i(k,c)-i(k,c-1);m+=f,u+=(d/2+p)*f}m&&(l-=u/m),s[c]=l}}for(let l=0;l<r;l++){if(t==="zero"){let u=0,h=0;for(let f=0;f<n;f++){let d=e[f][l],p=Number.isFinite(d)?d:0;p>=0?(o[f][l]=u,u+=p,a[f][l]=u):(o[f][l]=h,h+=p,a[f][l]=h)}continue}let c=0;for(let u=0;u<n;u++)c+=i(u,l);let m=t==="silhouette"?-c/2:s[l];for(let u=0;u<n;u++){let h=i(u,l);t==="expand"&&(h=c?h/c*100:0),o[u][l]=m,m+=h,a[u][l]=m}}if(t==="wiggle"&&r){let l=1/0,c=-1/0;for(let u=0;u<r;u++)l=Math.min(l,o[0]?.[u]??0),c=Math.max(c,a[n-1]?.[u]??0);let m=0;for(let u=0;u<r;u++)m+=((o[0]?.[u]??0)+(a[n-1]?.[u]??0))/2;m/=r;for(let u=0;u<n;u++)for(let h=0;h<r;h++)o[u][h]-=m,a[u][h]-=m}return{y0:o,y1:a}}function rr(e,t,n=-1){if(!t.some(r=>r>=0))return-1;for(let r=e-1;r>=0;r--)if(r!==n&&!t.includes(r))return r;return-1}function or(e){let t=e.length,n=e.map(c=>{let m=0,u=-1/0;return c.forEach((h,f)=>{h>u&&(u=h,m=f)}),m}),r=e.map(c=>c.reduce((m,u)=>m+(Number.isFinite(u)?u:0),0)),o=Array.from({length:t},(c,m)=>m).sort((c,m)=>n[c]-n[m]),a=[],i=[],s=0,l=0;for(let c of o)s<l?(a.push(c),s+=r[c]):(i.push(c),l+=r[c]);return[...i.reverse(),...a]}var ke=Math.PI*2;function ar(e){let t=0;for(let n of e)Number.isFinite(n)&&(t+=n);return t}function O(e){return Math.round(e*100)/100}function ee(e,t,n,r){return[e+n*Math.sin(r),t-n*Math.cos(r)]}function zt(e,t,n,r,o,a){let i=a-o;if(!(Math.abs(i)>1e-4)||r<=0)return"";if(Math.abs(i)>=ke-1e-4){let M=($,C)=>{let[y,A]=ee(e,t,$,o),[R,L]=ee(e,t,$,o+Math.PI);return`M${O(y)},${O(A)}A${O($)},${O($)} 0 1 ${C} ${O(R)},${O(L)}A${O($)},${O($)} 0 1 ${C} ${O(y)},${O(A)}Z`};return n>0?`${M(r,1)}${M(n,0)}`:M(r,1)}let l=i>0?1:0,c=Math.abs(i)>Math.PI?1:0,[m,u]=ee(e,t,r,o),[h,f]=ee(e,t,r,a);if(n<=0)return`M${O(e)},${O(t)}L${O(m)},${O(u)}A${O(r)},${O(r)} 0 ${c} ${l} ${O(h)},${O(f)}Z`;let[d,p]=ee(e,t,n,a),[k,w]=ee(e,t,n,o);return`M${O(m)},${O(u)}A${O(r)},${O(r)} 0 ${c} ${l} ${O(h)},${O(f)}L${O(d)},${O(p)}A${O(n)},${O(n)} 0 ${c} ${1-l} ${O(k)},${O(w)}Z`}function ir(e){let t=-1,n=-1/0;return e.forEach((r,o)=>{r>n&&(n=r,t=o)}),t}function Ta(e){return e>=44032&&e<=55203||e>=4352&&e<=4607||e>=12592&&e<=12687||e>=19968&&e<=40959}function sr(e){return e>=44032&&e<=55203?.87:e>=4352&&e<=4607||e>=12592&&e<=12687?.8:e>=19968&&e<=40959?.94:e>=48&&e<=57?.585:e===32||e===44||e===46||e===58||e===59||e===39?.26:e===37?.84:e===8722?.73:e===45?.42:e===43||e===61?.6:e===40||e===41||e===91||e===93?.34:e===47?.38:e===8361||e===36?.62:e===8230?.82:e>=65&&e<=90?e===73?.28:e===77||e===87?.86:.66:e>=97&&e<=122?e===105||e===108||e===106?.24:e===109||e===119?.84:e===102||e===116||e===114?.36:.55:.6}var ct=new Map;function Me(e,t,n=400){let r=String(e),o=`${r}|${n>=600?1:0}`,a=ct.get(o);if(a===void 0){let i=0,s=0;for(let l=0;l<r.length;l++){let c=r.charCodeAt(l);Ta(c)?i+=sr(c):s+=sr(c)}a=i+s*(n>=600?1.07:1),ct.size>5e3&&ct.clear(),ct.set(o,a)}return a*t}var cr=F(I(),1),Sa=e=>Array.isArray(e)&&e.length===2;function lr(e){let t=[];for(let n of e??[])n.type==="line"&&typeof n.y=="number"?t.push(n.y):n.type==="band"&&Sa(n.y)&&t.push(Number(n.y[0]),Number(n.y[1]));return t.filter(Number.isFinite)}var mr=F(I(),1),Ht=10.5;function Aa(e,t,n){let r=e.map(t);if(new Set(r).size===r.length)return r;let o=1/0;for(let i=1;i<e.length;i++)o=Math.min(o,Math.abs(e[i]-e[i-1]));let a=o>0&&Number.isFinite(o)?Math.min(20,Math.max(2,Math.ceil(-Math.log10(o)-1e-9))):2;return e.map(i=>Fe(i,{locale:n,maximumFractionDigits:a}))}function ur(e,t,n){let r=18;for(let o of Aa(e,t,n))r=Math.max(r,Me(o,Ht));return Math.ceil(r+8)}function jt(e,t){if(!(e>0)||!Number.isFinite(e))return 1;let n=e/Math.max(1,t),r=Math.pow(10,Math.floor(Math.log10(n))),o=n/r;return(o>=7.071?10:o>=3.162?5:o>=1.414?2:1)*r}function De(e,t,n=4,r={}){let o=e,a=t;if(!Number.isFinite(o)||!Number.isFinite(a))return[0,1];if(r.zero!==!1&&(o>0&&(o=0),a<0&&(a=0)),o===a)return o===0?[0,1]:o>0?[0,o*1.2]:[o*1.2,0];let i=a-o,s=r.pad??.07,l=jt(i,n),c=[o,a];for(let m=0;m<4;m++){let u=Math.ceil(a/l-1e-9)*l,h=Math.floor(o/l+1e-9)*l;c=[o===0?0:o-h<=l*.3?h:o-i*s,a===0?0:u-a<=l*.3?u:a+i*s];let f=jt(c[1]-c[0],n);if(f===l)break;l=f}return c}function dr(e,t,n=4){let r=Math.min(e,t),o=Math.max(e,t),a=jt(o-r,n),i=[],s=Math.ceil(r/a-1e-9)*a;for(let l=s,c=0;l<=o+a*1e-9&&c<200;l+=a,c++)i.push(Number((Math.round(l/a)*a).toPrecision(12)));return i}function Vt(e,t){let[n,r]=e,[o,a]=t,i=r===n?0:(a-o)/(r-n),s=(l=>o+(l-n)*i);return s.domain=e,s.range=t,s.invert=l=>i===0?n:n+(l-o)/i,s.ticks=(l=4)=>dr(n,r,l),s}function Wt(e,t,n=4){if(!(e>0)||!(t>0)||!Number.isFinite(e)||!Number.isFinite(t))return[1,10];let r=Math.log10(e),o=Math.log10(t);if(r===o)return[10**(r-.5),10**(r+.5)];let[a,i]=De(r,o,Math.max(n,Math.ceil(o-r)),{zero:!1});return[10**a,10**i]}function Fa(e,t,n){let r=Math.log10(e),o=Math.log10(t),a=n/Math.max(1e-9,o-r),i=(c,m=1)=>{let u=[];for(let h=Math.floor(r);h<=Math.ceil(o);h++)if(!(h%m))for(let f of c){let d=Number((f*10**h).toPrecision(12));d>=e*(1-1e-9)&&d<=t*(1+1e-9)&&u.push(d)}return u},s=a>=110?i([1,2,5]):i([1],Math.max(1,Math.ceil(24/a)));if(s.length>=2)return s;let l=i([1,2,3,4,5,6,7,8,9]);return l.length>=2?l:dr(e,t,3)}function fr(e,t){let n=Vt([Math.log10(e[0]),Math.log10(e[1])],t),r=(o=>o>0?n(Math.log10(o)):Number.NaN);return r.domain=e,r.range=t,r.invert=o=>10**n.invert(o),r.ticks=()=>Fa(e[0],e[1],Math.abs(t[1]-t[0])),r}function ze(e){let t=1/0,n=-1/0;for(let r of e)Number.isFinite(r)&&(r<t&&(t=r),r>n&&(n=r));return t===1/0?[0,1]:[t,n]}var Na=864e5;function hr(e,t,n,r=Z){let o=t-e;if(!(o>0))return[{t:e,label:Be(e,{locale:r,month:"short",day:"numeric"})}];let a=o/Na,i=[],s=new Date(e),l=new Date(e).getFullYear()===new Date(t).getFullYear(),c=(m,u,h,f=!1)=>{let d=new Date(m),p=-1,k=0;for(;d.getTime()<=t&&k++<500;){if(d.getTime()>=e){let w=d.getFullYear(),M=f&&!l&&w!==p;i.push({t:d.getTime(),label:Be(d,{locale:r,...h,...M?{year:"numeric"}:{}})}),p=w}u(d)}};if(a<=1.5){let m=Math.max(1,Math.ceil(o/36e5/Math.max(1,n))),u=[1,2,3,4,6,12].find(f=>f>=m)??12,h=new Date(s);h.setMinutes(0,0,0),c(h,f=>f.setHours(f.getHours()+u),{hour:"numeric"})}else if(a<=n*1.2){let m=new Date(s.getFullYear(),s.getMonth(),s.getDate());c(m,u=>u.setDate(u.getDate()+1),{month:"numeric",day:"numeric"})}else if(a<=n*7*1.2){let m=new Date(s.getFullYear(),s.getMonth(),s.getDate());m.setDate(m.getDate()+(8-m.getDay())%7),c(m,u=>u.setDate(u.getDate()+7),{month:"numeric",day:"numeric"})}else{let m=a/30.44,u=Math.max(1,Math.ceil(m/Math.max(1,n))),h=[1,2,3,6,12,24,60].find(f=>f>=u)??120;if(h>=12){let f=new Date(s.getFullYear()+(s.getMonth()>0||s.getDate()>1?1:0),0,1);c(f,d=>d.setFullYear(d.getFullYear()+h/12),{year:"numeric"})}else{let f=new Date(s.getFullYear(),s.getMonth()+(s.getDate()>1?1:0),1),d=f.getMonth()%h;d&&f.setMonth(f.getMonth()+(h-d)),c(f,p=>p.setMonth(p.getMonth()+h),{month:"short"},!0)}}return i}function gr(e,t){let n=new Array(e),r=new Uint8Array(e),o=a=>{if(typeof a!="string"||a.length===0||a.length>9)return-1;let i=Number(a);return Number.isInteger(i)&&i>=0&&i<e&&String(i)===a?i:-1};return new Proxy(n,{get(a,i,s){let l=o(i);return l>=0?(r[l]||(a[l]=t(l),r[l]=1),a[l]):Reflect.get(a,i,s)},has(a,i){return o(i)>=0||Reflect.has(a,i)}})}var Ra=(e,t,n)=>e==="date"?et(t,n)?.getTime()??NaN:fe(t);function Pa(e){let t=e.filter(n=>n!=null&&n!=="");return t.length?t.every(n=>n instanceof Date)||t.every(n=>typeof n=="string"&&_n(n.trim()))?"date":t.every(n=>typeof n=="number"||typeof n=="string"&&/^-?\d+(\.\d+)?$/.test(n.trim()))?"number":"band":"band"}function He(e,t,n,r,o={}){let a=Re(t,"x"),i=Array.isArray(n),s=i?n:null,l=i?null:Re(n,"y"),c=!i&&r!==void 0?Re(r,"series"):null,m=e.map((v,b)=>a(v,b)),u=o.xType??Pa(m),h=o.locale??Z,f,d,p;if(u==="band"){let v=m.map(T=>String(T??""));f=ye(v);let b=new Map(f.map((T,N)=>[T,N]));d=f.map((T,N)=>N),p=Int32Array.from(v,T=>b.get(T)??-1)}else{let v=u==="date"?o.dayFirst??In(m):void 0,b=m.map(D=>Ra(u,D,v)),T=Array.from(new Set(b.filter(D=>Number.isFinite(D)))).sort((D,j)=>D-j),N=new Map(T.map((D,j)=>[D,j]));d=T,f=T.map(String),p=Int32Array.from(b,D=>N.get(D)??-1)}let k=o.dateFormat,w=v=>typeof v=="string"?Qe(v.trim())?.[3]:void 0,M=u==="date"&&m.length<5e3?w(m[0]):void 0,$=(M===2||M===3)&&m.every(v=>w(v)===M),C=$&&M===3;if(u==="date"&&!k){let v=d.length>1?d[d.length-1]-d[0]:0;k=$&&M===2||v>864e5*120?{month:"short"}:v<864e5*2?{month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit"}:{month:"numeric",day:"numeric"},v>864e5*800&&(k={year:"numeric",month:"short"})}let y;if(u==="band")y=f;else if(C&&!o.dateFormat){let v=W(h)==="ko";y=d.map(b=>{let T=new Date(b),N=Math.floor(T.getMonth()/3)+1;return v?`${T.getFullYear()}년 ${N}분기`:`Q${N} ${T.getFullYear()}`})}else{let v=d.every(Nt),b=u==="date"?new Intl.DateTimeFormat(h,k):new Intl.NumberFormat(h,v?{useGrouping:!1}:{maximumFractionDigits:6});y=d.length>1e3?gr(d.length,T=>b.format(d[T])):d.map(T=>b.format(T))}let A=s?[...s]:c?ye(e.map((v,b)=>String(c(v,b)??""))):[""],R=new Map(A.map((v,b)=>[v,b])),L=A.map(()=>new Array(f.length).fill(NaN)),E=A.map(()=>new Array(f.length).fill(null)),_=o.aggregate??"sum",P=_==="mean"?A.map(()=>new Uint32Array(f.length)):null,g=(v,b,T,N)=>{let D=L[v][b];_==="last"?L[v][b]=T:_==="count"?L[v][b]=(Number.isFinite(D)?D:0)+1:_==="mean"?Number.isFinite(T)&&(L[v][b]=(Number.isFinite(D)?D:0)+T,P[v][b]++):L[v][b]=Number.isFinite(D)?D+(Number.isFinite(T)?T:0):T,E[v][b]=N};for(let v=0;v<e.length;v++){let b=p[v];if(b<0)continue;let T=e[v];if(s)for(let N=0;N<s.length;N++)g(N,b,fe(T[s[N]]),T);else{let N=c?R.get(String(c(T,v)??""))??0:0;g(N,b,fe(l(T,v)),T)}}if(P)for(let v=0;v<L.length;v++)for(let b=0;b<f.length;b++)P[v][b]>1&&(L[v][b]/=P[v][b]);return{type:u,keys:f,xnum:d,labels:y,series:A,values:L,rows:E}}var Da=140,Ve=12,pr=14,Gt=20,br=12.5;function La(e,t,n=qn){let r=he(t,t),o=new Map;e.forEach((i,s)=>{let l=r(i,s),c=o.get(l);c?c.push(i):o.set(l,[i])});let a=[...o.keys()].slice(0,n);return{values:a,groups:a.map(i=>o.get(i)),dropped:Math.max(0,o.size-n)}}function Ea(e,t,n){if(t<1)return 1;let r=Math.max(1,Math.floor((e+Ve)/(Da+Ve))),o=Math.max(1,Math.min(r,Number.isInteger(n)&&n>=1?n:r,t));return Math.ceil(t/Math.ceil(t/o))}function _a(e,t,n){let r=Math.max(40,Math.floor((e-(t-1)*Ve)/t));return{pw:r,ph:typeof n=="number"&&Number.isFinite(n)&&n>0?n:Math.max(120,Math.min(180,Math.round(r*.62)))}}var je=e=>e.filter(Number.isFinite);function ut(e,t){let n=[];for(let r of Array.isArray(t)?t:t===void 0?[]:[t]){let o=Pe(r,String(r));e.forEach((a,i)=>n.push(o(a,i)))}return je(n)}function yr(e,t,n,r,o,a){return He(t,n.x,r,o,{xType:e==="bar"?"band":n.xType,aggregate:a,dayFirst:n.dayFirst})}function Ia(e,t,n,r,o,a){let i=Math.max(2,Math.round(a/70)),s=r.yScale==="log"&&(e==="line"||e==="scatter"),l=r.yDomain,c=l&&(!s||l[0]>0&&l[1]>0)?l:void 0;if(e==="scatter"){let y=t.flat(),A=r.refLines??{},[R,L]=ze([...ut(y,r.x??"x"),...je([Number(A.x)])]),[E,_]=ze([...ut(y,r.y??"y"),...je([Number(A.y)])].filter(g=>!s||g>0)),P=r.zero??!1;return{y:c??(s?Wt(E,_,i):De(E,_,i,{zero:P,pad:.08})),x:r.xDomain??De(R,L,Math.max(2,Math.round(o/110)),{zero:P,pad:.06}),sameKeys:!0}}let m=e==="bar",u=m&&r.orientation==="horizontal",h=n[0]?.keys.join(""),f=n.every(y=>y.keys.join("")===h),d=n.length>0&&n.every(y=>y.type!=="band"&&y.type===n[0].type),p=r.xDomain??(!m&&d?ze(n.flatMap(y=>je(y.xnum))):void 0),k=m?r.layout??"grouped":e==="area"?r.stack??"auto":"none";if(k==="percent")return{x:p,sameKeys:f};if(c)return{y:c,x:p,sameKeys:f};let w=[];t.forEach((y,A)=>{let R=n[A];if(k==="stacked"||k==="auto"&&R.series.length>1){let E=Bt(R.values,"zero");E.y0.forEach(_=>w.push(..._)),E.y1.forEach(_=>w.push(..._))}else R.values.forEach(E=>w.push(...E));m&&!u&&r.line!==void 0&&yr(e,y,r,[].concat(r.line),void 0,r.series===void 0?r.aggregate:"mean").values.forEach(E=>w.push(...E)),m||w.push(...ut(y,r.lower),...ut(y,r.upper))}),m&&w.push(0),u||w.push(...lr(r.annotations));for(let y of r.referenceLines??[])w.push(y.y);r.signColors&&w.push(Number(r.baseline??0));let[M,$]=ze(je(w).filter(y=>!s||y>0));return{y:s?Wt(M,$,i):m?De(M,$,u?Math.max(2,Math.round(o/120)):i):De(M,$,i,{zero:r.zero??e==="area"}),x:p,sameKeys:f}}function Oa(e,t,n,r,o,a,i,s){if(e!=="line"&&e!=="area"||!o.x||!o.y)return;let l=He(t.flat(),r.x,r.y,void 0,{xType:r.xType,locale:s,dayFirst:r.dayFirst}),c=(r.yScale==="log"&&e==="line"?fr:Vt)(o.y,[i-22,10]).ticks(Math.max(2,Math.round(i/70))),m=ur(c,Pn(r.format,s,Math.max(Math.abs(o.y[0]),Math.abs(o.y[1]))),s),u=n.flatMap(y=>y.series),h=r.endLabels??n.some(y=>y.series.length>1),f=m+6,d=a-(h?Math.min(a*.28,Math.max(...u.map(y=>Me(y,11,700)),20)+14):10),p=l.keys.length,[k,w]=o.x[1]===o.x[0]?[o.x[0],o.x[0]+1]:o.x,M=l.type==="number"?p>12:p>hr(k,w,Math.max(2,Math.floor((d-f)/64)),s).length;if(l.type==="band"||!p||M)return;let $=y=>f+(l.xnum[y]-k)/(w-k)*(d-f),C=y=>Me(l.labels[y],Ht);for(let y=1;;y++){let A=Array.from({length:Math.ceil(p/y)},(R,L)=>L*y);if(y>=p||A.every((R,L)=>!L||$(R)-$(A[L-1])>=(C(R)+C(A[L-1]))/2+8))return A.map(R=>({value:l.xnum[R],label:l.labels[R]}))}}function Ba(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(16).padStart(8,"0")}function za(e,t,n,r){let o=[n.x,n.y,n.series].map(a=>JSON.stringify(a??null)).join("|");return`ztd-facet-${Ba(`${e}|${t}|${o}|${lt(r)}`)}`}function Ha(e,t){return typeof e=="string"?t.includes(e):Array.isArray(e)&&e.length>0&&e.every(n=>typeof n=="string"&&t.includes(n))}var ja={en:{intro:(e,t)=>`${be(e,"panel")} by ${t}.`,endHigh:(e,t)=>` ${e} ends highest at ${t}.`,falling:e=>` Lower at the end than at the start: ${e}.`,noneFalling:" None is lower at the end than at the start.",total:(e,t)=>` ${e} has the largest total at ${t}.`,points:(e,t)=>` ${e} has the most points (${t}).`,dropped:(e,t)=>` Only the first ${e} of ${t} values are shown.`,more:", …",blank:"(blank)"},ko:{intro:(e,t)=>`${t}별 패널 ${e}개.`,endHigh:(e,t)=>` 마지막 값이 가장 큰 곳: ${e}(${t}).`,falling:e=>` 처음보다 끝이 낮은 곳: ${e}.`,noneFalling:" 처음보다 끝이 낮은 곳은 없어요.",total:(e,t)=>` 합계가 가장 큰 곳: ${e}(${t}).`,points:(e,t)=>` 점이 가장 많은 곳: ${e}(${t}개).`,dropped:(e,t)=>` ${t}개 중 앞의 ${e}개만 보여요.`,more:" 등",blank:"(빈 값)"}};function xr(e){let{type:t,chartProps:n}=e,{values:r,groups:o,dropped:a}=La(e.data,e.by),i=r.length,s=typeof e.width=="number"&&Number.isFinite(e.width)&&e.width>0?e.width:480,l=Ea(s,i,e.columns),{pw:c,ph:m}=_a(s,l,e.height),u=e.scale!=="free",h=t==="scatter"?[]:o.map(P=>yr(t,P,n,n.y,n.series,n.aggregate)),f=u?Ia(t,o,h,n,c,m):{sameKeys:!1},d=u?Oa(t,o,h,n,f,c,m,e.locale):void 0,p=t==="bar"&&n.orientation==="horizontal",k=u&&(!p||f.sameKeys),w=u&&(p||f.x!==void 0||f.sameKeys),M=new Set(Ha(e.highlight,r)?[e.highlight].flat():[]),$=M.size>0,C=t==="bar"&&!Array.isArray(n.y)&&n.series===void 0||t==="scatter"&&n.series===void 0,y=e.syncId??za(t,e.by,n,e.data),A=Je($e(n.format,e.locale),n.unit),R=ja[e.lang],L=[],E=r.map(P=>P===""?R.blank:P);return{panels:r.map((P,g)=>{let v=o[g],b=E[g],T=g%l,N;if(t!=="scatter"){let j=h[g],le=re=>j.values.reduce((H,X)=>H+(Number.isFinite(X[re])?X[re]:0),0),B=j.keys.map((re,H)=>H).filter(re=>j.values.some(H=>Number.isFinite(H[re]))),Y=B[B.length-1];L.push({first:B.length?le(B[0]):NaN,last:B.length?le(Y):NaN,total:B.reduce((re,H)=>re+le(H),0)}),t!=="bar"&&j.series.length===1&&Y!==void 0&&(N=A(j.values[0][Y]))}else L.push({first:NaN,last:NaN,total:v.length});let D={data:v,width:c,height:m,ariaLabel:e.title?`${e.title}, ${b}`:b,syncId:y,highlight:$?M.has(P)?C?()=>!0:void 0:"none":e.highlight,showYAxis:!k||T===0,showXAxis:!w||g+l>=i};return f.y&&(D.yDomain=f.y),f.x&&(D.xDomain=f.x),d&&(D.xTicks=d),{value:P,label:b,props:D,last:N,isPicked:M.has(P)}}),cols:l,pw:c,ph:m,isPanelPick:$,description:Va(t,e.by,E,L,a,A,R)}}function Va(e,t,n,r,o,a,i){let s=i.intro(n.length,t),l=c=>ir(r.map(m=>m[c]));if(e==="line"||e==="area"){let c=l("last");c>=0&&(s+=i.endHigh(n[c],a(r[c].last)));let m=n.filter((u,h)=>r[h].last<r[h].first);s+=m.length?i.falling(`${m.slice(0,5).join(", ")}${m.length>5?i.more:""}`):i.noneFalling}else{let c=l("total");c>=0&&(s+=e==="bar"?i.total(n[c],a(r[c].total)):i.points(n[c],r[c].total))}return o&&(s+=i.dropped(n.length,n.length+o)),s}var te=F(V(),1);function Wa(e){return[...new Set([0,.01,.02,.05,.1,.15,.2,e].filter(t=>t<=e))].sort((t,n)=>t-n)}function Ga(e,t){let n=e.rootBounds?.height??window.innerHeight;return e.isIntersecting&&(e.intersectionRatio>=t||e.intersectionRect.height>=n*.5)}function vr(e,t=!0){let[n,r]=(0,te.useState)({visible:!t,near:!t});return(0,te.useEffect)(()=>{if(!t){r({visible:!0,near:!0});return}if(!e)return;if(typeof IntersectionObserver>"u"){r({visible:!0,near:!0});return}let o=new IntersectionObserver(i=>{let s=Ga(i[i.length-1],.25);r(l=>l.visible===s?l:{...l,visible:s,near:l.near||s})},{threshold:Wa(.25),rootMargin:"0px 0px -8% 0px"}),a=new IntersectionObserver(i=>{let s=i[i.length-1];r(l=>l.near===s.isIntersecting?l:{...l,near:s.isIntersecting})},{threshold:0,rootMargin:"240px 0px 240px 0px"});return o.observe(e),a.observe(e),()=>{o.disconnect(),a.disconnect()}},[e,t]),n}function kr(e){let t=e.getBoundingClientRect().width;return t>0?Math.round(t*10)/10:0}function mt(e){let[t,n]=(0,te.useState)(null),[r,o]=(0,te.useState)(e??null),a=(0,te.useCallback)(i=>{n(i),i&&e===void 0&&o(kr(i))},[e]);return ce(()=>{if(e!==void 0){o(e);return}if(!t)return;let i=c=>o(m=>m!==null&&Math.abs(m-c)<.5?m:c),s=()=>i(kr(t));if(typeof ResizeObserver>"u")return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s);let l=new ResizeObserver(c=>{let m=c[c.length-1]?.contentRect;m?i(m.width>0?Math.round(m.width*10)/10:0):s()});return l.observe(t),()=>l.disconnect()},[t,e]),[t,a,r]}var Ka=()=>()=>{};function Le(){return(0,te.useSyncExternalStore)(Ka,()=>!0,()=>!1)}var wr="(prefers-reduced-motion: reduce)";function dt(e="auto"){let[t,n]=(0,te.useState)(()=>oe&&typeof window.matchMedia=="function"?window.matchMedia(wr).matches:!1);return(0,te.useEffect)(()=>{if(e!=="auto"||!oe||typeof window.matchMedia!="function")return;let r=window.matchMedia(wr),o=()=>n(r.matches);return o(),r.addEventListener?.("change",o),()=>r.removeEventListener?.("change",o)},[e]),e===!0?!0:e===!1?!1:t}var me=F(I(),1),Ua=60,Xa=420;function $r(e){let t=ie(),n=e.chartProps??{},[,r,o]=mt(e.width),a=e.width??(o||480),i=J(e.locale??n.locale),s=W(i),l=(0,Ee.useContext)(Te),c=e.title??l,m=(0,Ee.useMemo)(()=>xr({type:e.type,data:e.data,by:e.by,columns:e.columns,scale:e.scale,chartProps:n,highlight:e.highlight,syncId:e.syncId,width:a,height:e.height,title:c,locale:i,lang:s}),[e.type,e.data,e.by,e.columns,e.scale,JSON.stringify(n,(k,w)=>typeof w=="function"?String(w):w),e.highlight,e.syncId,a,e.height,c,i,s]),u=`${(0,Ee.useId)().replace(/:/g,"")}fd`,h=dt(n.reducedMotion??"auto"),f=Le(),d=gn({motion:{enabled:n.animate!==!1&&!h&&oe},hydrated:f},{waiting:!1,generation:0}),p=e.chart;return(0,me.jsxs)("div",{ref:r,role:"group","aria-label":c,"aria-describedby":u,className:e.className,style:{position:"relative",width:"100%",...e.style},children:[(0,me.jsx)("p",{id:u,style:it,children:e.description??m.description}),(0,me.jsx)("div",{style:{display:"grid",gridTemplateColumns:`repeat(${m.cols}, minmax(0, 1fr))`,columnGap:Ve,rowGap:pr},children:m.panels.map((k,w)=>{let M=t.paint(k.isPicked?"accentText":m.isPanelPick?"muted":"ink");return(0,me.jsxs)("div",{"data-facet":k.value,style:{minWidth:0,...hn(d,!1,"fade",w*Ua,Xa)},children:[(0,me.jsxs)("div",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,height:Gt,fontSize:br,fontWeight:700,lineHeight:`${Gt}px`,color:M},children:[(0,me.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:k.label}),k.last!==void 0?(0,me.jsx)("span",{style:{flex:"none",fontVariantNumeric:"tabular-nums"},children:k.last}):null]}),(0,me.jsx)(p,{...n,...k.props})]},k.value)})})]})}function de(e,t,n,r,o="max"){let a=new Set,i=n.length,s=c=>{if(i&&c!=="none"){if(c==="first")a.add(0);else if(c==="last")a.add(i-1);else if(c==="max"||c==="min"){let m=-1,u=c==="max"?-1/0:1/0;r.forEach((h,f)=>{Number.isFinite(h)&&(c==="max"?h>u:h<u)&&(u=h,m=f)}),m>=0&&a.add(m)}}};if(e==null)return s(o),a;if(typeof e=="function")return t.forEach((c,m)=>{m<i&&c!==null&&c!==void 0&&e(c,m)&&a.add(m)}),a;let l=Array.isArray(e)?e:[e];for(let c of l)typeof c=="number"?c>=0&&c<i&&a.add(c):c==="max"||c==="min"||c==="first"||c==="last"||c==="none"?s(c):n.forEach((m,u)=>{m===c&&a.add(u)});return a}var ne=F(V(),1);async function Ya(e,t="auto",n="",r){let o=e.headers.get("content-type")??"",a=await e.text();if(t==="text")return a;if(o.includes("text/html")||/^\s*<(!doctype html|html[\s>])/i.test(a))throw new Error(W(r)==="ko"?`데이터 대신 HTML 페이지를 받았어요. 주소를 확인해 주세요${n?`: ${n}`:"."}`:`Got an HTML page instead of data${n?` (${n})`:""}. Check the URL.`);if(t==="csv")return Ce(a);if(t==="json"||o.includes("json"))return JSON.parse(a);if(o.includes("csv")||/[./]csv(\?|#|$)|output=csv|format=csv|tqx=out:csv/i.test(n))return Ce(a);let i=a.trim();return i.startsWith("{")||i.startsWith("[")?JSON.parse(i):Ce(a)}async function qa(e,t={}){let n=t.signal??new AbortController().signal,r;if(typeof e=="function")r=await e(n);else{let o=e instanceof Request?e.url:String(e),a=await fetch(e instanceof Request?e.clone():o,{...t.init,signal:n});if(!a.ok)throw new Error(`HTTP ${a.status}${a.statusText?` ${a.statusText}`:""}`);r=await Ya(a,t.parse,o,t.locale)}return t.select&&(r=nr(r,t.select)),t.transform?t.transform(r):xe(r)}function Cr(e,t={}){let{refreshMs:n,enabled:r=!0,keepPrevious:o=!0}=t,[a,i]=(0,ne.useState)(()=>({data:[],status:e&&r?"loading":"idle",error:null,updatedAt:null})),[s,l]=(0,ne.useState)(0),c=J(t.locale),m=(0,ne.useRef)(t);m.current={...t,locale:c};let u=(0,ne.useRef)(e);u.current=e;let h=typeof e=="function"?"fn":e instanceof Request?e.url:e?String(e):"",f=t.deps??[],d=JSON.stringify(f.map(w=>typeof w=="object"?JSON.stringify(w):String(w))),p=(0,ne.useRef)(!1);(0,ne.useEffect)(()=>{let w=u.current;if(!w||!r){i(C=>C.status==="loading"?{...C,status:"idle"}:C);return}let M=new AbortController,$=!0;return p.current=!0,i(C=>({...C,data:o?C.data:[],status:"loading",error:null})),qa(w,{...m.current,signal:M.signal}).then(C=>{$&&i({data:C,status:"success",error:null,updatedAt:Date.now()})}).catch(C=>{!$||M.signal.aborted||i(y=>({...y,status:"error",error:C instanceof Error?C:new Error(String(C))}))}).finally(()=>{$&&(p.current=!1)}),()=>{$=!1,p.current=!1,M.abort()}},[h,r,s,d,o]),(0,ne.useEffect)(()=>{if(!n||!r)return;let w=setInterval(()=>{p.current||l(M=>M+1)},n);return()=>clearInterval(w)},[n,r]);let k=(0,ne.useCallback)(()=>l(w=>w+1),[]);return{data:a.data,status:a.status,loading:a.status==="loading",error:a.error,empty:a.status==="success"&&a.data.length===0,updatedAt:a.updatedAt,reload:k}}var Ut=F(I(),1),Za=["csv","svg","png"],Ja=/^[=+\-@\t\r\n=+-@]/,Qa=/var\(|color-mix\(/;function Mr(e){if(typeof e=="number")return Number.isFinite(e)?String(e):"";if(e==null||e instanceof Date&&Number.isNaN(e.getTime()))return"";let t=e instanceof Date?Dn(e.getTime()):String(e);return`"${(Ja.test(t)&&!Number.isFinite(fe(t))?`'${t}`:t).replace(/"/g,'""')}"`}function ei(e){return[...new Set(e.slice(0,200).flatMap(t=>t&&typeof t=="object"?Object.keys(t):[]))]}function ti(e,t){return`\uFEFF${[t.map(Mr),...e.map(r=>t.map(o=>Mr(r[o])))].map(r=>r.join(",")).join(`\r
|
|
26
|
+
`)}\r
|
|
27
|
+
`}function ni(e){return Array.from((e??"").replace(/[\\/:*?"<>|\r\n\t]+/g,"-").trim()).slice(0,80).join("")||"chart"}function Kt(e,t){let n=document.createElement("a");n.href=URL.createObjectURL(e),n.download=t,n.click(),setTimeout(()=>URL.revokeObjectURL(n.href),1e4)}var Tr=2,we=16;function Sr(e,t){if(!/^(ok)?l(ab|ch)\(|^color\(/.test(e))return e;let n=t.get(e);if(n)return n;let r=document.createElement("canvas").getContext("2d");if(!r)return e;r.fillStyle=e,r.fillRect(0,0,1,1);let[o,a,i,s]=r.getImageData(0,0,1,1).data;return n=s===255?`rgb(${o}, ${a}, ${i})`:`rgba(${o}, ${a}, ${i}, ${Math.round(s/255*1e3)/1e3})`,t.set(e,n),n}function Ar(e,t){let n=document.createElementNS("http://www.w3.org/2000/svg",e);for(let[r,o]of Object.entries(t))n.setAttribute(r,String(o));return n}function Fr(e,t,n){let r=e.closest(".ztd-card"),o=r?.querySelector("svg.ztd-svg");if(!r||!o)return null;let{width:a,height:i}=o.viewBox.baseVal,[s,l]=[a+we*2,i+we*2],c=o.cloneNode(!0),m=c.querySelectorAll("*"),u=new Map;o.querySelectorAll("*").forEach((d,p)=>{let k;for(let w of Array.from(d.attributes)){if(!Qa.test(w.value))continue;let M=(k??(k=getComputedStyle(d))).getPropertyValue(w.name);M&&m[p].setAttribute(w.name,Sr(M,u))}}),c.removeAttribute("style");for(let[d,p]of Object.entries({viewBox:`${-we} ${-we} ${s} ${l}`,width:s*t,height:l*t,"font-family":getComputedStyle(o).fontFamily}))c.setAttribute(d,String(p));let h=Sr(getComputedStyle(r).backgroundColor,u),f=o.parentElement?.querySelector("canvas")??null;if(n){let d=c.querySelector("desc")?.nextSibling??c.firstChild;c.insertBefore(Ar("rect",{x:-we,y:-we,width:s,height:l,fill:h}),d),f&&c.insertBefore(Ar("image",{href:f.toDataURL(),width:a,height:i}),d)}return{svg:new XMLSerializer().serializeToString(c),w:s,h:l,vw:a,vh:i,bg:h,canvas:f}}function ri(e,t){let n=Fr(e,Tr,!1);if(!n)return;let r=Tr,o=document.createElement("canvas");o.width=Math.ceil(n.w*r),o.height=Math.ceil(n.h*r);let a=o.getContext("2d");if(!a)return;a.fillStyle=n.bg,a.fillRect(0,0,o.width,o.height),n.canvas&&a.drawImage(n.canvas,we*r,we*r,n.vw*r,n.vh*r);let i=URL.createObjectURL(new Blob([n.svg],{type:"image/svg+xml"})),s=new Image;s.onload=()=>{a.drawImage(s,0,0,o.width,o.height),URL.revokeObjectURL(i),o.toBlob(l=>l&&Kt(l,`${t}.png`),"image/png")},s.onerror=()=>URL.revokeObjectURL(i),s.src=i}function Nr(e){let t=ie(e.theme),n=W(J(e.locale))==="ko",r=ni(e.filename),o=(a,i)=>{if(a==="csv")return Kt(new Blob([ti(e.data,e.columns?.length?e.columns:ei(e.data))],{type:"text/csv;charset=utf-8"}),`${r}.csv`);if(a==="png")return ri(i,r);let s=Fr(i,1,!0);s&&Kt(new Blob([s.svg],{type:"image/svg+xml"}),`${r}.svg`)};return(0,Ut.jsx)("span",{style:{display:"inline-flex",gap:6,flex:"none"},children:Za.filter(a=>!e.formats||e.formats.includes(a)).map(a=>{let i=a.toUpperCase(),s=n?`${i} 내려받기`:`Download ${i}`;return(0,Ut.jsx)("button",{type:"button",className:"ztd-btn","aria-label":s,title:s,onClick:l=>o(a,l.currentTarget),style:{background:"transparent",color:t.paint("muted"),border:`1px solid ${t.paint("line2")}`,borderRadius:14,height:28,padding:"0 10px",fontSize:12,fontWeight:700,flex:"none"},children:i},a)})})}var Pr=F(I(),1);function Rr(e,t=Z){let n=$e(void 0,t),r=e.split(`
|
|
28
|
+
`),o=(a,i)=>{if(i==="label")return a.label;if(i==="value")return a.formatted??(a.value===null?null:n(a.value));if(i==="series")return a.series??null;let s=a.datum&&typeof a.datum=="object"?a.datum[i]:void 0;return s==null||s===""||typeof s=="number"&&!Number.isFinite(s)?null:typeof s=="number"?n(s):s instanceof Date?Be(s,{locale:t,year:"numeric",month:"short",day:"numeric"}):String(s)};return a=>{let i=[];for(let s of r){let l=!1,c=s.replace(En,(m,u)=>o(a,u.trim())??(l=!0,""));l||i.push(c)}return i.length?i.map((s,l)=>(0,Pr.jsx)("div",{children:s},l)):null}}function Dr(e){if(Array.isArray(e))return e;if(e&&typeof e=="object"){let t=e;if(Array.isArray(t.values))return t.values;if(typeof t.csv=="string")return Ce(t.csv)}return null}var zr=F(V(),1);var U=F(V(),1);function Lr(e,t){let n=ie(e.theme),[r,o,a]=mt(e.width),i=Le(),s=e.width??(a||t.ssrWidth||480),l=typeof t.height=="function"?t.height(s):t.height,c=e.height??l,m=dt(e.reducedMotion??"auto"),u=e.animate!==!1&&!m&&oe,h=vr(r,e.animateOnView!==!1&&u),f=J(e.locale),d=W(f),p=(0,U.useMemo)(()=>$e(e.format,f,t.format),[e.format,f,t.format]),k=(0,U.useCallback)(B=>Ze(B,{locale:f}),[f]),w=(0,U.useMemo)(()=>Je(p,e.unit),[p,e.unit]),M=(0,U.useMemo)(()=>lt(e.data),[e.data]),[$,C]=(0,U.useState)(null),[y,A]=(0,U.useState)(null),R=(0,U.useRef)([]),L=(0,U.useRef)(e.onHover);L.current=e.onHover;let E=(0,U.useRef)(e.onClick);E.current=e.onClick;let _=(0,U.useRef)(null),P=(0,U.useRef)(null),g=(0,U.useRef)(null),v=(0,U.useCallback)((B,Y="pointer")=>{if(g.current!==B){g.current=B;let re=B===null?null:R.current[B]??null;queueMicrotask(()=>L.current?.(re)),P.current?.(B)}_.current=B===null?null:Y,C(B),A(_.current)},[]),b=(0,U.useCallback)(B=>{_.current!=="keyboard"&&(_.current=B===null?null:"sync",C(B),A(_.current))},[]),T=(0,U.useCallback)(B=>{let Y=R.current[B];Y&&E.current?.(Y)},[]),N=Hn(e.replayKey),D=e.width!==void 0||(a??0)>0,j={enabled:u,active:h.visible&&D,near:h.near,replayKey:N,dataKey:M,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},le=(0,U.useCallback)((B,Y=1)=>$===null||$===B?Y:Y*.38,[$]);return{p:n,width:s,height:c,measured:D,responsive:e.width===void 0,pending:oe&&i&&e.width===void 0&&a===null,node:r,hydrated:i,ref:o,motion:j,fv:w,fmt:p,pct:k,locale:f,lang:d,t:d==="ko"?bn:pn,active:$,via:y,setActive:v,click:T,events:R,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:le,sig:M,description:e.description,reduced:m,publish:P,applySync:b}}var G=F(V(),1);function oi(e){return 1-Math.pow(1-e,3)}function ai(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function ii(e){return e==="easeInOut"?ai:e==="linear"?t=>t:oi}function si(e,t){return e==="linear"?1:e==="easeInOut"?t<.5?12*t*t:3*Math.pow(-2*t+2,2):3*Math.pow(1-t,2)}function _e(e,t){if(e.length===t)return e.slice();if(!e.length)return new Array(t).fill(0);if(e.length===1||t===1)return new Array(t).fill(e[0]);let n=new Array(t);for(let r=0;r<t;r++){let o=r/(t-1)*(e.length-1),a=Math.floor(o),i=Math.min(e.length-1,a+1);n[r]=e[a]+(e[i]-e[a])*(o-a)}return n}function ft(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],o=t[n];if(Number.isNaN(r)!==Number.isNaN(o)||Math.abs(r-o)>1e-6)return!1}return!0}function Er(e,t,n){for(let r=0;r<n.length;r++)(!Number.isFinite(e[r])||!Number.isFinite(n[r]))&&(e[r]=n[r],t[r]=0)}function _r(e,t,n,r){if(!t||!n||t.length!==n.length)return _e(e,r);let o=[],a=0;for(let i=0;i<n.length;i++){let s=e.slice(a,a+t[i]);a+=t[i];for(let l of _e(s,n[i]))o.push(l)}return o.length===r?o:_e(e,r)}var ht=class{constructor(){this.tracks=new Map;this.seq=0;this.easing="spring";this.duration=900;this.omega=8.2;this.animating=!1;this.entranceStart=-1;this.maxDelay=0}configure(t,n){this.easing=t,this.duration=Math.max(1,n),this.omega=7.4/(this.duration/1e3)}sameTargets(t){let n=0;for(let r of this.tracks.values())r.exiting||n++;if(n!==t.length)return!1;for(let r of t){let o=this.tracks.get(r.key);if(!o||o.exiting||!ft(o.to,r.to))return!1}return!0}refreshData(t){for(let n of t){let r=this.tracks.get(n.key);r&&(r.data=n.data)}}make(t,n,r,o){let a=t.from??t.to,i=t.enter??a;return{key:t.key,data:t.data,from:n.slice(),vel:new Array(t.to.length).fill(0),to:t.to.slice(),appear:a.slice(),enter:i.slice(),exit:(t.exit??i).slice(),delay:o,t0:r,cur:n.slice(),curVel:new Array(t.to.length).fill(0),done:!1,exiting:!1,order:this.seq++,progress:0,parts:t.parts}}snap(t){let n=new Map;for(let r of t){let o=this.tracks.get(r.key),a=this.make(r,r.to,0,0);o&&(a.order=o.order),a.done=!0,a.progress=1,n.set(r.key,a)}this.tracks=n,this.animating=!1,this.entranceStart=-1}hold(t){let n=new Map,r=0;for(let o of t){let a=this.tracks.get(o.key),i=this.make(o,o.from??o.to,1/0,o.delay??0);a&&(i.order=a.order),r=Math.max(r,o.delay??0),n.set(o.key,i)}this.maxDelay=r,this.tracks=n,this.animating=!1,this.entranceStart=-1}start(t){for(let n of this.tracks.values())n.t0=t+n.delay,n.from=n.appear.slice(),n.vel.fill(0),Er(n.from,n.vel,n.to),n.cur=n.from.slice(),n.curVel=n.vel.slice(),n.done=ft(n.from,n.to),n.done&&(n.progress=1);this.entranceStart=t,this.animating=!0}update(t,n,r=0){this.step(n);let o=new Set,a=0;for(let i of t){o.add(i.key);let s=this.tracks.get(i.key),l=r>0?Math.min(a*r,240):0;if(s){let c=i.to.length;s.from=_r(s.cur,s.parts,i.parts,c),s.vel=_r(s.curVel,s.parts,i.parts,c),s.parts=i.parts,s.to=i.to.slice(),Er(s.from,s.vel,s.to),s.cur=s.from.slice(),s.curVel=s.vel.slice(),s.appear=(i.from??i.to).slice(),s.enter=(i.enter??s.appear).slice(),s.exit=(i.exit??s.enter).slice(),s.data=i.data,s.exiting=!1,s.t0=n+(s.t0>n?Math.max(0,s.t0-n):l),s.done=ft(s.from,s.to)&&s.vel.every(m=>Math.abs(m)<1e-6),s.progress=s.done?1:0}else{let c=this.make(i,i.enter??i.from??i.to,n+l,0);c.done=ft(c.from,c.to),this.tracks.set(i.key,c)}a++}for(let i of this.tracks.values())o.has(i.key)||i.exiting||(i.from=i.cur.slice(),i.vel=i.curVel.slice(),i.to=_e(i.exit,i.cur.length),i.t0=n,i.exiting=!0,i.done=!1,i.progress=0);this.animating=!0}step(t){if(!this.animating)return!1;let n=!1,r=ii(this.easing),o=this.duration/1e3,a=this.omega,i=[];for(let s of this.tracks.values()){if(s.done)continue;let l=(t-s.t0)/1e3,c=s.to.length;if(s.from.length!==c&&(s.from=_e(s.from,c)),s.vel.length!==c&&(s.vel=_e(s.vel,c)),s.cur.length!==c&&(s.cur=new Array(c).fill(0),s.curVel=new Array(c).fill(0)),!(l>0)){for(let u=0;u<c;u++)s.cur[u]=s.from[u],s.curVel[u]=0;s.progress=0,n=!0;continue}let m;if(this.easing==="spring"){let u=Math.exp(-a*l),h=a*l>=8&&a*l<20,f=0;for(let d=0;d<c;d++){let p=s.from[d]-s.to[d],k=s.vel[d]+a*p;s.cur[d]=s.to[d]+(p+k*l)*u,s.curVel[d]=(s.vel[d]-a*k*l)*u,h&&f<.15&&(f=Math.max(f,Math.abs(s.cur[d]-s.to[d]),Math.abs(s.curVel[d]/a)))}m=a*l>=20||h&&f<.15,s.progress=Math.min(1,1-(1+a*l)*u)}else{let u=Math.min(1,l/o),h=r(u),f=si(this.easing,u)/o;for(let d=0;d<c;d++)s.cur[d]=s.from[d]+(s.to[d]-s.from[d])*h,s.curVel[d]=(s.to[d]-s.from[d])*f;m=u>=1,s.progress=h}if(m){for(let u=0;u<c;u++)s.cur[u]=s.to[u],s.curVel[u]=0;s.done=!0,s.progress=1,s.exiting&&i.push(s.key)}else n=!0}for(let s of i)this.tracks.delete(s);return this.animating=n,n||(this.entranceStart=-1),n}elapsed(t){return this.entranceStart<0?1/0:t-this.entranceStart}get entranceLength(){return this.duration+this.maxDelay}get(t){return this.tracks.get(t)?.cur}items(){return[...this.tracks.values()].sort((t,n)=>t.order-n.order).map(t=>({key:t.key,v:t.cur,data:t.data,exiting:t.exiting,progress:t.progress}))}get size(){return this.tracks.size}},We=new Set,gt=0;function Ir(e){gt=0;let t=Array.from(We);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||We.delete(n)}We.size&&typeof requestAnimationFrame<"u"&&(gt=requestAnimationFrame(Ir))}function Or(e){return We.add(e),!gt&&typeof requestAnimationFrame<"u"&&(gt=requestAnimationFrame(Ir)),()=>{We.delete(e)}}function li(e){let t=new Map,n=!1;for(let r of e){let o=(t.get(r.key)??0)+1;t.set(r.key,o),o>1&&(n=!0)}return n?(t.clear(),e.map(r=>{let o=(t.get(r.key)??0)+1;return t.set(r.key,o),o>1?{...r,key:`${r.key}#${o}`}:r})):e}function Br(e,t){let n=(0,G.useMemo)(()=>li(e),[e]),{enabled:r,active:o,near:a=!0,replayKey:i,dataKey:s,easing:l="spring",duration:c=900,stagger:m=0}=t,u=(0,G.useRef)(null),h=(0,G.useRef)("init"),f=(0,G.useRef)(null),d=(0,G.useRef)(s),p=(0,G.useRef)(i),k=(0,G.useRef)(!1),w=(0,G.useRef)(0),[,M]=(0,G.useState)(0),$=(0,G.useRef)(null),C=(0,G.useRef)(!0);u.current||(u.current=new ht,u.current.configure(l,c),u.current.snap(n),f.current=n);let y=u.current;if(y.configure(l,c),f.current!==n){let P=h.current,g=!Object.is(d.current,s);y.sameTargets(n)?y.refreshData(n):!r||P==="init"?y.snap(n):P==="idle"?y.hold(n):P==="running"||g?y.update(n,Xe(),m):y.snap(n),f.current=n,d.current=s}let A=(0,G.useRef)(()=>!1);A.current=P=>{if(!C.current)return!1;let g=y.step(P);return!g&&h.current==="running"&&(h.current="done"),M(v=>(v+1)%1e9),g||($.current=null),g};let R=(0,G.useCallback)(()=>{if(!oe||$.current||!y.animating)return;let P=g=>A.current(g);$.current=Or(P)},[y]);ce(()=>{let P=!Object.is(p.current,i);if(p.current=i,!r){(h.current!=="done"||y.animating)&&(y.snap(f.current??n),h.current="done",M(g=>g+1));return}h.current==="init"||P&&a?(y.hold(f.current??n),h.current="idle",k.current=!1,M(g=>g+1)):P&&(k.current=!0)},[r,i]),ce(()=>{!r||!a||!k.current||(k.current=!1,y.hold(f.current??n),h.current="idle",M(P=>P+1))},[a,r]),(0,G.useEffect)(()=>{r&&o&&h.current==="idle"&&(y.start(Xe()),w.current+=1,h.current="running",R(),M(P=>P+1))},[r,o,i,y,R]),(0,G.useEffect)(()=>{y.animating&&R()}),(0,G.useEffect)(()=>(C.current=!0,()=>{C.current=!1,$.current?.(),$.current=null}),[]);let L=Xe(),E=y.elapsed(L),_=r&&h.current==="idle";return{items:y.items(),get:P=>y.get(P),elapsed:_?0:E,fade:(P,g=320)=>_?0:Number.isFinite(E)?Math.max(0,Math.min(1,(E-P)/g)):1,waiting:_,animating:y.animating,generation:w.current}}var Xt=F(I(),1);function Hr(e,t,n,r,o){if(r)return o==="categorical"?ue(e,t,n):Tn(e,t,n);if(o==="categorical")return ue(e,t,n);let a=K(e,"strong"),i=K(e,"accent");return Array.from({length:t},(s,l)=>n.has(l)?i:a)}var ci=F(V(),1);var Yt=F(I(),1);var jr=e=>e?"neutralStrong":"accent";var qt=F(I(),1);function Vr(e,t,n,r){if(typeof e!="function")return de(e,n,n,n.map(()=>0),"first");let o=new Map(n.map((i,s)=>[i,s])),a=new Set;return t.forEach((i,s)=>{let l=o.get(r(i,s));l!==void 0&&e(i,s)&&a.add(l)}),a}var ui=F(V(),1);var Jt=F(I(),1),mi={name:"Candlestick chart",open:"Open",high:"High",low:"Low",close:"Close",change:"Change",volume:"Volume",empty:"No data.",ohlc:(e,t,n,r)=>`open ${e}, high ${t}, low ${n}, close ${r}`,span:(e,t,n)=>`${e} to ${t}: ${n}`,desc:(e,t,n,r,o)=>`${e} to ${t}, ${be(n,"candle")}. First open ${r}, last close ${o}`,ma:e=>`MA${e}`,up:"Up",down:"Down",maLegend:e=>`${e}-day MA`},Wr={en:mi,ko:{name:"캔들스틱",open:"시가",high:"고가",low:"저가",close:"종가",change:"등락률",volume:"거래량",empty:"데이터가 없어요.",ohlc:(e,t,n,r)=>`시가 ${e}, 고가 ${t}, 저가 ${n}, 종가 ${r}`,span:(e,t,n)=>`${e}부터 ${t}까지 ${n}`,desc:(e,t,n,r,o)=>`${e}부터 ${t}까지 ${n}개 봉. 첫 시가 ${r}, 마지막 종가 ${o}`,ma:e=>`${e}일선`,up:"상승",down:"하락",maLegend:e=>`${e}일 이동평균`}},Zt=["ink","muted","dim"];function Gr(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,Zt.length)}var Qt=F(V(),1);function Kr(e,t=.04){let n=e.length,r=(f,d)=>Math.max(0,e[f]?.[d]||0),o=(f,d)=>r(f,d)+(f===d?0:r(d,f)),a=Array.from({length:n},(f,d)=>Array.from({length:n},(p,k)=>o(d,k)).reduce((p,k)=>p+k,0)),i=a.reduce((f,d)=>f+d,0),s=Math.min(t,n?ke*.5/n:0),l=i>0?Math.max(0,ke-s*n)/i:0,c=[],m=Array.from({length:n},()=>[]),u=0;for(let f=0;f<n;f++){let d=u;for(let p=0;p<n;p++){let k=u;u+=o(f,p)*l,m[f][p]={index:f,sub:p,a0:k,a1:u,value:r(f,p)}}c.push({index:f,a0:d,a1:u,value:a[f]}),u+=s}let h=[];for(let f=0;f<n;f++)for(let d=f;d<n;d++){let p=m[f][d],k=m[d][f];p.value<=0&&k.value<=0||h.push(p.value>=k.value?{source:p,target:k}:{source:k,target:p})}return{groups:c,chords:h}}function Ur(e,t,n,r,o,a,i){let s=y=>ee(e,t,n,y),l=y=>Math.round(y*100)/100,[c,m]=s(r),[u,h]=s(o),[f,d]=s(a),[p,k]=s(i),w=o-r>Math.PI?1:0,M=i-a>Math.PI?1:0,$=r===a&&o===i,C=`M${l(c)},${l(m)}A${l(n)},${l(n)} 0 ${w} 1 ${l(u)},${l(h)}`;return $?(C+=`Q${l(e)},${l(t)} ${l(c)},${l(m)}Z`,C):(C+=`Q${l(e)},${l(t)} ${l(f)},${l(d)}A${l(n)},${l(n)} 0 ${M} 1 ${l(p)},${l(k)}Q${l(e)},${l(t)} ${l(c)},${l(m)}Z`,C)}var ve=F(I(),1),di={kind:"Chord diagram",sent:"Sent",received:"Received",groups:e=>be(e,"group")},fi={en:di,ko:{kind:"코드 다이어그램",sent:"보냄",received:"받음",groups:e=>`그룹 ${e}개`}};function en(e){let t=Lr(e,{height:g=>Math.max(240,Math.min(340,g*.7)),duration:1e3}),{p:n,width:r,height:o}=t,a=(0,Qt.useMemo)(()=>{let g=H=>e.data.some(X=>X&&typeof X=="object"&&H in X),v=he(e.source??(g("source")?"source":"from"),"source"),b=he(e.target??(g("target")?"target":"to"),"target"),T=Pe(e.value,"value"),N=ye(e.data.flatMap((H,X)=>[v(H,X),b(H,X)])),D=new Map(N.map((H,X)=>[H,X])),j=N.map(()=>N.map(()=>0));e.data.forEach((H,X)=>{let nn=D.get(v(H,X)),rn=D.get(b(H,X));nn===void 0||rn===void 0||(j[nn][rn]+=Math.max(0,T(H,X)||0))});let le=Kr(j,e.padAngle??.05),B=le.groups.map(H=>H.value),Y=de(e.highlight,N,N,B,"max"),re=B.reduce((H,X)=>H+X,0)||1;return{names:N,matrix:j,lay:le,hi:Y,grand:re}},[e.data,e.source,e.target,e.value,e.padAngle,e.highlight]),i=Math.max(...a.names.map(g=>Me(g,11.5,700)),20)+14,s=Math.max(40,Math.min(o/2-16,r/2-i)),l=r/2,c=o/2,m=Math.max(8,Math.min(14,s*.09)),u=s-m-3,h=t.motion.duration??1e3,f=(0,Qt.useMemo)(()=>[{key:"__sweep",to:[ke],from:[0],data:null},{key:"__rib",to:[1],from:[0],delay:h*.45,data:null}],[h]),d=Br(f,t.motion),p=d.get("__sweep")?.[0]??ke,k=d.get("__rib")?.[0]??1,w=K(n,"accent"),M=fi[t.lang],$=a.names.length,C=g=>a.hi.has(g.source.index)||a.hi.has(g.target.index),y=t.active,A=y!==null&&y<$?y:null,R=y!==null&&y>=$?a.lay.chords[y-$]:null,L=[...a.lay.groups.map(g=>({datum:null,index:g.index,key:a.names[g.index],label:a.names[g.index],value:g.value,formatted:`${t.fv(g.value)} (${t.pct(g.value/a.grand*100)})`})),...a.lay.chords.map((g,v)=>({datum:null,index:$+v,key:`${g.source.index}-${g.target.index}`,label:`${a.names[g.source.index]} ↔ ${a.names[g.target.index]}`,value:g.source.value+(g.source.index===g.target.index?0:g.target.value),formatted:`${a.names[g.source.index]}→${a.names[g.target.index]} ${t.fv(g.source.value)}, ${a.names[g.target.index]}→${a.names[g.source.index]} ${t.fv(g.target.value)}`}))],E=null;if(A!==null){let g=a.lay.groups[A],[v,b]=ee(l,c,s,(g.a0+g.a1)/2),T=a.matrix[A].reduce((D,j)=>D+j,0),N=a.matrix.reduce((D,j)=>D+j[A],0);E={x:v,y:b,title:a.names[A],rows:[{label:M.sent,value:t.fv(T),color:a.hi.has(A)?w.fill:n.paint("neutralStrong")},{label:M.received,value:t.fv(N)}]}}else if(R){let g=(R.source.a0+R.source.a1)/2,[v,b]=ee(l,c,u*.6,g);E={x:v,y:b,title:`${a.names[R.source.index]} ↔ ${a.names[R.target.index]}`,rows:[{label:`${a.names[R.source.index]} →`,value:t.fv(R.source.value)},{label:`${a.names[R.target.index]} →`,value:t.fv(R.target.value)}]}}let _=g=>A!==null?g.source.index===A||g.target.index===A?.82:.08:R?g===R?.88:.08:C(g)?.68:.4,P=e.description??`${M.kind}. ${M.groups($)}: ${a.lay.groups.map(g=>`${a.names[g.index]} ${t.fv(g.value)}`).join(", ")}.`;return(0,ve.jsxs)(Vn,{c:t,kind:M.kind,ariaLabel:e.ariaLabel,description:P,events:L,tip:E,renderTip:e.tooltip,className:e.className,style:e.style,theme:e.theme,children:[(0,ve.jsx)("g",{opacity:Math.min(1,k*1.2),children:a.lay.chords.map((g,v)=>(0,ve.jsx)("path",{className:"ztd-mark",d:Ur(l,c,u,g.source.a0,g.source.a1,g.target.a0,g.target.a1),fill:C(g)?w.fill:n.paint("neutralStrong"),opacity:_(g),stroke:n.paint("panel"),strokeWidth:.6,onPointerEnter:b=>t.setActive($+v,b.pointerType==="touch"?"touch":"pointer"),onClick:()=>t.click($+v)},v))}),a.lay.groups.map(g=>{let v=Math.min(g.a0,p),b=Math.min(g.a1,p),T=a.hi.has(g.index),N=zt(l,c,s-m,s,v,b),D=(g.a0+g.a1)/2,[j,le]=ee(l,c,s+10,D),B=Math.sin(D);return(0,ve.jsxs)("g",{onPointerEnter:Y=>t.setActive(g.index,Y.pointerType==="touch"?"touch":"pointer"),onClick:()=>t.click(g.index),children:[N?(0,ve.jsx)("path",{className:"ztd-mark",d:N,fill:T?w.fill:n.paint("ink"),opacity:A===null||A===g.index?1:.4,stroke:y===g.index&&t.via==="keyboard"?n.paint("accent"):"none",strokeWidth:2}):null,t.showLabels?(0,ve.jsx)(Wn,{x:j,y:le+(Math.cos(D)>.9?-3:Math.cos(D)<-.9?4:0),anchor:B>.12?"start":B<-.12?"end":"middle",size:11.5,weight:T||A===g.index?800:600,fill:n.paint(T?"ink":"muted"),opacity:d.fade(h*.4,300),children:a.names[g.index]}):null]},g.index)})]})}var hi=F(V(),1);var Jr=F(I(),1),gi={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${be(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},pi={en:gi,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},Xr=(e,t)=>pi[e].other(t);function Yr(e,t,n){if(typeof t!="number"||!(t>=1)||e.length<=t+1)return{kept:e,other:null};let r=new Set(e.map((a,i)=>({v:a.value,i})).sort((a,i)=>i.v-a.v).slice(0,Math.floor(t)).map(a=>a.i)),o=e.filter((a,i)=>!r.has(i));return{kept:e.filter((a,i)=>r.has(i)),other:n(o.length,ar(o.map(a=>a.value)))}}var qr=e=>Number.isFinite(e)&&e>0?e:0;function Zr(e,t,n,r){return r==="emphasis"?Mn(e,t,n):ue(e,t,n)}var bi=F(V(),1);var no=F(I(),1);function Qr(e,t){return t===!1?e.map((n,r)=>r):or(e)}function eo(e,t,n){let r=n.map(o=>o.reduce((a,i)=>a+(Number.isFinite(i)?i:0),0));return de(e,t,t,r,"max")}function to(e,t,n){let r=new Array(t.length),o=t.filter(a=>!n.has(a));for(let a of t)n.has(a)&&(r[a]=K(e,"accent"));return o.forEach((a,i)=>r[a]=o.length===1?K(e,"neutral"):qe(e,1-i/Math.max(1,o.length-1))),r}var ge=F(I(),1);function ro(e,t){let n=st(e);return n?.type==="scatter"&&t?.size!==void 0?st("bubble"):n}function yi(e,t={}){let n={};for(let r of e.encoding){let o=t[r.name];o!==void 0&&(n[r.prop??r.name]=o)}return n}function xi(e,t,n,r=!1){let o=ro(e.type,e.encoding);if(!o||!t.length)return[];let a=e.encoding??{},i=e.options??{},s=i.highlight,l=new Set(!r&&_t.includes(o.type)&&Array.isArray(i.hidden)?i.hidden.map(String):[]),c=u=>u.filter(h=>!l.has(h.label)),m=["pie","donut","waffle"];if(o.type==="donut"&&i.legend!=="none")return[];if(m.includes(o.type)){let u=he(a.label,"label"),h=Pe(a.value,"value"),f=o.type==="waffle",d=t.map((C,y)=>({r:C,label:u(C,y),value:f?h(C,y):qr(h(C,y))})),{kept:p,other:k}=f?{kept:d,other:null}:Yr(d,i.other,(C,y)=>({r:{},label:Xr(W(n),C),value:y})),w=de(s,p.map(C=>C.r),p.map(C=>C.label),p.map(C=>C.value),f?"first":"max"),M=k?[...p,k]:p,$=Oe(C=>f?ue(C,M.length,w):Zr(C,M.length,w,i.colorMode));return M.map((C,y)=>({label:C.label,color:$[y]}))}if(o.type==="candlestick"){let u=Gr(Array.isArray(i.ma)?i.ma:void 0,t.length),h=Wr[W(n)];return[{label:h.up,color:i.upColor??"accent"},{label:h.down,color:i.downColor??"neutralStrong"},...u.map((f,d)=>({label:h.maLegend(f),color:Zt[d],shape:"line"}))]}if(o.type==="scatter"){if(typeof a.series!="string")return[];let u=he(a.series,"series"),h=ye(t.map((p,k)=>u(p,k)));if(h.length<2)return[];let f=Vr(s,t,h,u),d=Oe(p=>Cn(p,h.length,f));return c(h.map((p,k)=>({label:p,color:d[k],shape:"circle"})))}if(["marimekko","area","bar","line","stream","radar"].includes(o.type)){let u=[];if(Array.isArray(a.y))u=a.y;else if(typeof a.series=="string"){let $=he(a.series,"series");u=ye(t.map((C,y)=>$(C,y)))}let h=It(o.type,a,i);if(h.length){let $=de(s,u,u,u.map(()=>0),"none"),C=Oe(A=>ue(A,u.length,$)),y=u.length<2?[{label:String((Array.isArray(a.y)?a.y[0]:a.y)??"y"),color:"neutral"}]:u.map((A,R)=>({label:A,color:C[R]}));return[...c(y),...h.map((A,R)=>({label:A,color:jr(R),shape:"line"}))]}if(u.length<2)return[];let d=o.type==="bar"&&i.layout==="diverging"&&s===void 0?rr(u.length,Array.isArray(i.negative)?i.negative.map($=>u.indexOf(String($))):[],typeof i.neutral=="string"?u.indexOf(i.neutral):-1):-1,p=d>=0?new Set([d]):de(s,u,u,u.map(()=>0),"first");if(o.type==="radar")return c(u.map(($,C)=>({label:$,color:p.has(C)?"accent":"neutralStrong",shape:"square"})));let k=i.colorMode,w=$=>ue($,u.length,p);if((o.type==="line"||o.type==="area")&&(w=$=>Hr($,u.length,p,o.type==="area",k)),o.type==="stream"){let $=He(t,a.x,a.y,a.series,{xType:i.xType,locale:n,aggregate:i.aggregate,dayFirst:i.dayFirst}),C=Qr($.values,i.reorder),y=eo(s,$.series,$.values);w=A=>to(A,C,y)}let M=Oe(w);return c(u.map(($,C)=>({label:$,color:M[C],...o.type==="line"&&{shape:"line"}})))}return[]}function ki(e,t){let n=e.facet;return n&&typeof n=="object"&&typeof n.by=="string"&&Yn.includes(t)&&!(t==="bar"&&e.options?.layout==="diverging")?n:void 0}function wi(e,t,n){let{data:r,width:o,height:a,highlight:i,syncId:s,ariaLabel:l,description:c,...m}=n;return{type:e,data:r??[],by:t.by,columns:t.columns,scale:t.scale,chartProps:m,width:o,height:a,highlight:i,syncId:s,title:l,description:c}}function oo(e,t){let{spec:n}=e,r=ro(n.type,n.encoding),o=(0,Ge.useMemo)(()=>Dr(n.data),[n.data]),a=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,i=Xn(n,e.locale),s=J(i),l=W(s),c=Cr(a?.url??null,{parse:a?.format??"auto",select:a?.select,init:e.fetchInit,locale:s}),m=Jn(n),u=(0,Ge.useMemo)(()=>m?Rr(m,s):void 0,[m,s]),h=n.options?.hidden,f=Array.isArray(h)?h.map(String):[],d=f.join(""),[p,k]=(0,Ge.useState)(null);if(!r)return(0,ge.jsx)(Et,{error:l==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:i});let w=o??c.data,M=t[r.type],$={...n.options??{}},C={...yi(r,n.encoding),...$,...u?{tooltip:u}:{},data:w,...e.width!==void 0?{width:e.width}:{},...e.height!==void 0?{height:e.height}:{},...e.animate!==void 0?{animate:e.animate}:{},...e.replayKey!==void 0?{replayKey:e.replayKey}:{},...e.onHover?{onHover:e.onHover}:{},...e.onClick?{onClick:e.onClick}:{},locale:i},y=n.card?.legend==="toggle"&&Zn(r.type,n.encoding??{},$),A=p&&p.base===d?p.hidden:f;y&&(C.hidden=A);let R=g=>k(v=>{let b=v&&v.base===d?v.hidden:f;return{base:d,hidden:b.includes(g)?b.filter(T=>T!==g):[...b,g]}}),L=C.height??220,E=ki(n,r.type),_=a&&!w.length&&(c.loading||c.error||c.empty)?(0,ge.jsx)(Et,{loading:c.loading,error:c.error,empty:c.empty,onRetry:c.reload,height:L,locale:i}):E?(0,ge.jsx)($r,{chart:M,...wi(r.type,E,C)}):(0,ge.jsx)(M,{...C});if(n.card){let g=n.card,v=g.legend==="auto"||g.legend==="toggle"?xi(n,w,s,y):g.legend,b=v?.length?y?(0,ge.jsx)(Lt,{items:v,hidden:A,onToggle:R,locale:i}):v:void 0,T=g.download?(0,ge.jsx)(Nr,{data:w,columns:Qn(n),filename:g.title??r.type,formats:Array.isArray(g.download)?g.download:void 0,locale:i}):void 0;_=(0,ge.jsx)(jn,{number:g.number,title:g.title??Un(r,l),subtitle:g.subtitle,legend:b,actions:T,source:g.source||void 0,note:g.note||void 0,accent:g.accent,takeaway:g.takeaway,level:g.level,sample:g.sample,replay:g.replay!==!1,className:e.className,locale:i,children:_})}let P=e.theme??n.theme;return P&&(_=(0,ge.jsx)(nt,{theme:P,children:_})),_}function vi({cfg:e,components:t}){let n=Le();return oo({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function io(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,ao.hydrateRoot)(r,(0,tn.createElement)(nt,{theme:o.theme,cssVars:!0},(0,tn.createElement)(vi,{cfg:o,components:{[e]:t}})))}io("chord",en);})();
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
(()=>{var ko=Object.create;var wn=Object.defineProperty;var wo=Object.getOwnPropertyDescriptor;var vo=Object.getOwnPropertyNames;var $o=Object.getPrototypeOf,Co=Object.prototype.hasOwnProperty;var Rt=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var Mo=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of vo(t))!Co.call(e,o)&&o!==n&&wn(e,o,{get:()=>t[o],enumerable:!(r=wo(t,o))||r.enumerable});return e};var P=(e,t,n)=>(n=e!=null?ko($o(e)):{},Mo(t||!e||!e.__esModule?wn(n,"default",{value:e,enumerable:!0}):n,e));var X=Rt((Ei,vn)=>{vn.exports=globalThis.__ztdReact.react});var Cn=Rt((_i,$n)=>{$n.exports=globalThis.__ztdReact["react-dom/client"]});var O=Rt((qi,er)=>{er.exports=globalThis.__ztdReact["react/jsx-runtime"]});var kn=P(X(),1),bo=P(Cn(),1);var ot=P(X(),1);var yt=P(X(),1);var Mn=P(X(),1),Le=(0,Mn.createContext)(void 0);var Fn=P(X(),1);var To=["bg","panel","ink","muted","dim","accent","accentText","onAccent","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"],Tn='"Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, -apple-system, sans-serif',Sn='"Roboto Mono", "Share Tech Mono", ui-monospace, SFMono-Regular, Menlo, monospace',Te={name:"dark",bg:"#14171B",panel:"#14171B",ink:"#F1F3F5",muted:"#A3ABB5",dim:"#5B636D",accent:"#D6FD70",accentText:"#D6FD70",onAccent:"#14171B",onInk:"#14171B",line:"#2A2F36",line2:"#22272D",neutral:"#3A414A",neutralStrong:"#5F6772",onNeutralStrong:"#F1F3F5",neutralSoft:"#262B31",lift:"#1D2126",tint:"rgba(214, 253, 112, 0.14)",fontFamily:Tn,monoFamily:Sn,radius:18,radiusCode:14,radiusMark:4},Pt={name:"light",bg:"#FFFFFF",panel:"#FFFFFF",ink:"#14171B",muted:"#5D6570",dim:"#B3B9C2",accent:"#0B8FD8",accentText:"#006DA8",onAccent:"#14171B",onInk:"#FFFFFF",line:"#E6E9ED",line2:"#F0F2F5",neutral:"#D5DAE0",neutralStrong:"#9AA3AE",onNeutralStrong:"#14171B",neutralSoft:"#EEF1F4",lift:"#F4F6F8",tint:"rgba(11, 143, 216, 0.12)",fontFamily:Tn,monoFamily:Sn,radius:18,radiusCode:14,radiusMark:4},Dt={dark:Te,light:Pt};function it(e){return`--ztd-${e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}function Lt(e){let t={};for(let n of To){let r=e[n];typeof r=="string"&&(t[it(n)]=r)}return e.fontFamily&&(t["--ztd-font"]=e.fontFamily),e.monoFamily&&(t["--ztd-mono"]=e.monoFamily),e.radius!==void 0&&(t["--ztd-radius"]=`${e.radius}px`),e.radiusCode!==void 0&&(t["--ztd-radius-code"]=`${e.radiusCode}px`),e.radiusMark!==void 0&&(t["--ztd-radius-mark"]=`${e.radiusMark}px`),t}function Et(e,t){if(!t)return e;let n={...e};for(let r of Object.keys(t)){let o=t[r];o!==void 0&&(n[r]=o)}return n}var So=`
|
|
2
|
+
.ztd-root{position:relative;-webkit-tap-highlight-color:transparent}
|
|
3
|
+
.ztd-root:focus{outline:none}
|
|
4
|
+
.ztd-root:focus-visible{outline:2px solid var(--ztd-accent,${Te.accent});outline-offset:3px;border-radius:6px}
|
|
5
|
+
.ztd-svg{display:block;overflow:visible;user-select:none;-webkit-user-select:none}
|
|
6
|
+
.ztd-mark{transition:opacity .18s ease,fill .18s ease,stroke .18s ease,stroke-width .18s ease}
|
|
7
|
+
.ztd-tip{animation:ztd-fade .14s ease-out;transition:left .2s cubic-bezier(.22,1,.36,1),top .2s cubic-bezier(.22,1,.36,1)}
|
|
8
|
+
.ztd-guide{transition:transform .2s cubic-bezier(.22,1,.36,1)}
|
|
9
|
+
.ztd-still .ztd-tip,.ztd-still .ztd-guide{transition:none;animation:none}
|
|
10
|
+
.ztd-btn{appearance:none;font:inherit;cursor:pointer;transition:background .14s,color .14s,border-color .14s}
|
|
11
|
+
.ztd-btn:focus{outline:none}
|
|
12
|
+
.ztd-btn:focus-visible{outline:2px solid var(--ztd-accent,${Te.accent});outline-offset:2px}
|
|
13
|
+
.ztd-card{transition:border-color .16s ease}
|
|
14
|
+
.ztd-card:hover{border-color:var(--ztd-dim,${Te.dim})}
|
|
15
|
+
@media (prefers-reduced-motion: reduce){.ztd-mark,.ztd-tip,.ztd-guide,.ztd-btn,.ztd-card{transition:none;animation:none}}
|
|
16
|
+
@keyframes ztd-pop{from{opacity:0;transform:scale(.45)}to{opacity:1;transform:none}}
|
|
17
|
+
@keyframes ztd-fade{from{opacity:0}to{opacity:1}}
|
|
18
|
+
.ztd-pop{transform-box:fill-box;transform-origin:center}
|
|
19
|
+
@keyframes ztd-pulse{0%,100%{opacity:.55}50%{opacity:1}}
|
|
20
|
+
.ztd-skeleton{animation:ztd-pulse 1.4s ease-in-out infinite}
|
|
21
|
+
@media (prefers-reduced-motion: reduce){.ztd-skeleton{animation:none}}
|
|
22
|
+
`;function Nn(e,t,n,r,o){if(e)return t?{opacity:0}:{animation:`ztd-${n} ${Math.round(o)}ms cubic-bezier(.22,.9,.3,1) ${Math.round(r)}ms backwards`}}function Rn(e,t){let[n]=(0,Fn.useState)(!e.motion.enabled);return e.motion.enabled&&e.hydrated&&(!n||t.waiting||t.generation>0)}var An=!1;function Xe(){if(An||typeof document>"u"||(An=!0,document.getElementById("ztd-base")))return;let e=document.createElement("style");e.id="ztd-base",e.textContent=So,document.head.appendChild(e)}var st=P(X(),1),me=typeof window<"u"&&typeof document<"u",ye=me?st.useLayoutEffect:st.useEffect;function lt(){return typeof performance<"u"?performance.now():Date.now()}function W(e){return e!==void 0&&/^ko([-_]|$)/i.test(e)?"ko":"en"}function Ee(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}var Pn={chart:"chart",table:e=>`${e} data`,more:e=>`and ${e} more`,value:"Value",empty:"No data."},Dn={chart:"차트",table:e=>`${e} 데이터`,more:e=>`외 ${e}개`,value:"값",empty:"데이터가 없어요."};var Ao=[{id:"basic",en:"Basic",ko:"기본"},{id:"intermediate",en:"Intermediate",ko:"중급"},{id:"advanced",en:"Advanced",ko:"심화"}],Fo={basic:{bg:"line2",fg:"ink"},intermediate:{bg:"tint",fg:"accentText"},advanced:{bg:"ink",fg:"onInk"}};function No(e,t){let n=t.trim().toLowerCase();return e.find(r=>r.id===n||r.en.toLowerCase()===n||r.ko===t.trim())}function Ro(e){return No(Ao,e)}function Ln(e,t){let n=Ro(e);return{text:n?n[t]:e,...Fo[n?.id??"basic"]}}var En={white:"#ffffff",black:"#000000",transparent:"#00000000"};function _e(e){if(!e)return null;let t=e.trim(),n=/^var\(\s*--[\w-]+\s*,\s*(.+)\)$/i.exec(t);if(n&&(t=n[1].trim()),En[t.toLowerCase()]&&(t=En[t.toLowerCase()]),t.startsWith("#")){let o=t.slice(1);if((o.length===3||o.length===4)&&(o=o.split("").map(a=>a+a).join("")),o.length!==6&&o.length!==8||/[^\da-f]/i.test(o))return null;let i=parseInt(o,16);return o.length===6?[i>>16&255,i>>8&255,i&255,1]:[parseInt(o.slice(0,2),16),parseInt(o.slice(2,4),16),parseInt(o.slice(4,6),16),parseInt(o.slice(6,8),16)/255]}let r=/^rgba?\(([^)]+)\)$/i.exec(t);if(r){let o=r[1].split(/[\s,/]+/).filter(Boolean);if(o.length<3)return null;let i=o.slice(0,3).map(s=>s.endsWith("%")?parseFloat(s)/100*255:parseFloat(s)),a=o[3]!==void 0?o[3].endsWith("%")?parseFloat(o[3])/100:parseFloat(o[3]):1;return i.some(s=>Number.isNaN(s))?null:[i[0],i[1],i[2],Number.isNaN(a)?1:a]}return null}function On(e){let t=n=>Math.round(Math.max(0,Math.min(255,n))).toString(16).padStart(2,"0");return`#${t(e[0])}${t(e[1])}${t(e[2])}${e[3]<1?t(e[3]*255):""}`.toUpperCase()}function It(e,t){let n=e[3];return[e[0]*n+t[0]*(1-n),e[1]*n+t[1]*(1-n),e[2]*n+t[2]*(1-n),1]}function Ie(e){let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function _n(e){return .2126*Ie(e[0])+.7152*Ie(e[1])+.0722*Ie(e[2])}function Ot(e,t,n){let r=typeof e=="string"?_e(e):e,o=typeof t=="string"?_e(t):t;if(!r||!o)return 0;let i=n?typeof n=="string"?_e(n):n:null;o[3]<1&&i&&(o=It(o,i));let a=r[3]<1?It(r,o):r,s=_n(a),l=_n(o);return(Math.max(s,l)+.05)/(Math.min(s,l)+.05)}function Po(e){return[Ie(e[0]),Ie(e[1]),Ie(e[2])]}function _t(e){let t=e<=.0031308?12.92*e:1.055*Math.pow(e,.4166666666666667)-.055;return Math.max(0,Math.min(255,t*255))}function In(e){let[t,n,r]=Po(e),o=Math.cbrt(.4122214708*t+.5363325363*n+.0514459929*r),i=Math.cbrt(.2119034982*t+.6806995451*n+.1073969566*r),a=Math.cbrt(.0883024619*t+.2817188376*n+.6299787005*r);return[.2104542553*o+.793617785*i-.0040720468*a,1.9779984951*o-2.428592205*i+.4505937099*a,.0259040371*o+.7827717662*i-.808675766*a]}function Do([e,t,n],r){let o=(e+.3963377774*t+.2158037573*n)**3,i=(e-.1055613458*t-.0638541728*n)**3,a=(e-.0894841775*t-1.291485548*n)**3;return[_t(4.0767416621*o-3.3077115913*i+.2309699292*a),_t(-1.2684380046*o+2.6097574011*i-.3413193965*a),_t(-.0041960863*o-.7034186147*i+1.707614701*a),r]}function ct(e,t,n){let r=_e(e),o=_e(t);if(!r||!o)return e;let i=In(r),a=In(o),s=Math.max(0,Math.min(1,n));return On(Do([i[0]*s+a[0]*(1-s),i[1]*s+a[1]*(1-s),i[2]*s+a[2]*(1-s)],r[3]*s+o[3]*(1-s)))}function Bt(e,t,n){let r=t[0],o=-1;for(let i of t){let a=Ot(i,e,n);a>o&&(o=a,r=i)}return r}function q(e,t){let n=e.theme;switch(t){case"accent":return{role:t,fill:e.paint("accent"),text:e.paint("onAccent"),raw:n.accent};case"ink":return{role:t,fill:e.paint("ink"),text:e.paint("onInk"),raw:n.ink};case"strong":return{role:t,fill:e.paint("neutralStrong"),text:e.paint("onNeutralStrong"),raw:n.neutralStrong};case"soft":return{role:t,fill:e.paint("neutralSoft"),text:e.paint("ink"),raw:n.neutralSoft};default:return{role:"neutral",fill:e.paint("neutral"),text:e.paint("ink"),raw:n.neutral}}}function Lo(e,t){let n=Bt(t,[e.theme.ink,e.theme.onAccent,e.theme.onNeutralStrong]);return Ot(n,t)>=4.5?n===e.theme.ink?e.paint("ink"):n===e.theme.onAccent?e.paint("onAccent"):e.paint("onNeutralStrong"):Bt(t,["#FFFFFF","#000000"])}function ut(e,t){let n=ct(e.theme.neutralStrong,e.theme.neutral,t);return{role:"mix",fill:e.mix("neutralStrong","neutral",t),text:Lo(e,n),raw:n}}function xe(e,t,n){let r=new Array(t),o=[];for(let a=0;a<t;a++)n.has(a)?r[a]=q(e,"accent"):o.push(a);let i=o.length;return o.forEach((a,s)=>{if(i===1)r[a]=q(e,"neutral");else if(s===0)r[a]=q(e,"ink");else if(s===i-1)r[a]=q(e,"neutral");else if(i===3)r[a]=q(e,"strong");else{let l=(s-1)/Math.max(1,i-2);r[a]=l<=.001?q(e,"strong"):ut(e,1-l)}}),r}var zt="mix:";function Ye(e){return e({theme:Pt,cssVars:!1,paint:n=>n,color:n=>n??"neutral",raw:n=>n??"neutral",mix:(n,r,o)=>`${zt}${o}`}).map(n=>n.fill)}function Bn(e,t){return t?.startsWith(zt)?e.mix("neutralStrong","neutral",Number(t.slice(zt.length))):e.color(t)}function zn(e,t,n){return xe(e,t+1,n).slice(0,t)}function Hn(e,t,n,r="neutral"){let o=q(e,"accent"),i=q(e,r);return Array.from({length:t},(a,s)=>n.has(s)?o:i)}function jn(e,t,n){let r=new Array(t),o=[];for(let a=0;a<t;a++)n.has(a)?r[a]=q(e,"accent"):o.push(a);let i=o.length;return o.forEach((a,s)=>{i===1?r[a]=q(e,"neutral"):s===0?r[a]=q(e,"strong"):s===i-1?r[a]=q(e,"neutral"):r[a]=ut(e,1-s/(i-1))}),r}var de=P(X(),1);var dt=(e,t="")=>n=>Number.isFinite(n)?`${e(n)}${t}`:e(n),oe="en-US",Vn=new Map;function Ht(e,t){let n=t.maximumFractionDigits!==void 0||t.style==="currency"?t:{...t,maximumFractionDigits:Math.max(1,t.minimumFractionDigits??0)},r=e+JSON.stringify(n),o=Vn.get(r);return o||(o=new Intl.NumberFormat(e,n),Vn.set(r,o)),o}function jt(e){return/^[-\u2212]/.test(e)&&!/[1-9]/.test(e)?e.slice(1):e}function Oe(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=oe,...r}=t;return jt(Ht(n,r).format(e))}var Vt=e=>e!==0&&Math.abs(e)<.05,Wt=(e,t,n="")=>`${Oe(e,{locale:t,maximumSignificantDigits:2,maximumFractionDigits:20})}${n}`;function mt(e,t={}){if(!Number.isFinite(e))return"-";if(Vt(e)&&t.maximumFractionDigits===void 0)return Wt(e,t.locale??oe,"%");let n=Math.abs(e);return`${Oe(e,{maximumFractionDigits:n>0&&n<1?1:0,...t})}%`}function Un(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=oe,...r}=t;if(W(n)==="ko"){let o=Math.abs(e),i=[[1e12,"조"],[1e8,"억"],[1e4,"만"],[1,""]],a=i.findIndex(([s])=>o>=s);for(a<0&&(a=i.length-1);;){let[s,l]=i[a],c=o/s,m=Math.max(r.minimumFractionDigits??0,r.maximumFractionDigits??(s===1||c<100?1:0)),u=Math.round(c*10**m)/10**m;if(a>0&&u>=i[a-1][0]/s){a--;continue}return(e<0&&u!==0?"-":"")+Oe(u,{locale:n,...r,maximumFractionDigits:m})+l}}return jt(Ht(n,{notation:"compact",...r}).format(e))}var Eo=(e,t=W(e)==="ko"?"KRW":"USD")=>({style:"currency",currency:t,maximumFractionDigits:t==="KRW"?0:2});function Re(e,t=oe,n){if(typeof e=="function")return e;let r=(o,i="",a="")=>{let s=Ht(t,o);return l=>Number.isFinite(l)?`${a}${jt(s.format(l))}${i}`:"-"};if(e&&typeof e=="object"){let{suffix:o="",prefix:i="",...a}=e;return r(a,o,i)}switch(e??n){case"integer":return r({maximumFractionDigits:0});case"decimal":return r({minimumFractionDigits:1,maximumFractionDigits:2});case"percent":return o=>mt(o,{locale:t});case"ratio":return o=>mt(o*100,{locale:t});case"compact":return o=>Un(o,{locale:t});case"currency":return r(Eo(t));default:{let o=r({maximumFractionDigits:1});return i=>Vt(i)?Wt(i,t):o(i)}}}function Xn(e,t=oe,n=0){return e!==void 0?Re(e,t):n>=1e5?r=>Vt(r)?Wt(r,t):Un(r,{locale:t}):r=>Oe(r,{locale:t})}function _o(e,t,n=1){let r=new Date(+e,+t-1,+n);return r.getMonth()===+t-1&&r.getDate()===+n?r:null}var Gt=e=>Number.isInteger(e)&&e>=1e3&&e<=9999,Io=/^\d{4}-\d{1,2}(-\d{1,2})?([T ][\d:.]+(Z|[+-]\d{2}:?\d{2})?)?$/,Oo=["january","february","march","april","may","june","july","august","september","october","november","december"],Wn=e=>{let t=e.toLowerCase();return t.length<3?0:Oo.findIndex(n=>n.startsWith(t))+1},Gn=e=>+e+(+e<30?2e3:1900);function Yn(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}var Bo=[/^(\d{4})-(\d{1,2})(?:-(\d{1,2}))?$/,/^(\d{4})[./]\s*(\d{1,2})[./]\s*(\d{1,2})\.?$/,/^(19\d\d|20\d\d|2100)(\d\d)(\d\d)$/,/^(\d{4})년\s*(\d{1,2})월(?:\s*(\d{1,2})일)?$/],qn=/^(\d{1,2})([./-])(\d{1,2})\2(\d{4})$/,Jn=/\{([^{}]+)\}/g;function ft(e,t){let n;for(let r of Bo)if(n=r.exec(e))return[+n[1],+n[2],+(n[3]??1),n[3]?1:2];if(/^\d{4}-\d/.test(e))return null;if(n=/^(\d{2})\.\s*(\d{1,2})\.\s*(\d{1,2})\.?$/.exec(e))return t?[Gn(n[3]),+n[2],+n[1],1]:[Gn(n[1]),+n[2],+n[3],1];if(n=/^(?:(\d{4})\s*-?\s*Q([1-4])|Q([1-4])\s*-?\s*(\d{4})|(\d{4})년\s*([1-4])분기)$/i.exec(e))return[+(n[1]??n[4]??n[5]),+(n[2]??n[3]??n[6])*3-2,1,3];if(n=qn.exec(e)){let r=+n[1],o=+n[3],i=r>12||o<=12&&t===!0;return[+n[4],i?o:r,i?r:o,1]}if(n=/^(\d{1,2})[\s-]+([a-z]{3,9})\.?[\s-]+(\d{4})$/i.exec(e)){let r=Wn(n[2]);return r?[+n[3],r,+n[1],1]:null}if(n=/^([a-z]{3,9})\.?\s+(?:(\d{1,2}),?\s+)?(\d{4})$/i.exec(e)){let r=Wn(n[1]);return r?[+n[3],r,+(n[2]??1),n[2]?1:2]:null}return null}var Zn=e=>Io.test(e)||ft(e)!==null;function Qn(e){let t;for(let n of e){let r=typeof n=="string"?qn.exec(n.trim()):null;if(r){if(+r[1]>12)return!0;+r[3]>12&&(t=!1)}}return t}function ht(e,t){if(e instanceof Date)return Number.isNaN(e.getTime())?null:e;if(typeof e=="number"){if(!Number.isFinite(e))return null;if(Number.isInteger(e)){if(Gt(e))return new Date(e,0,1);if(e>=19000101&&e<=21001231)return ht(`${e}`)}return new Date(Math.abs(e)>=1e9&&Math.abs(e)<1e10?e*1e3:e)}if(typeof e=="string"&&e.trim()){let n=e.trim(),r=ft(n,t);if(r)return _o(r[0],r[1],r[2]);if(/^\d{4}$/.test(n))return new Date(Number(n),0,1);if(!/\d{4}/.test(n))return null;let o=new Date(n);return Number.isNaN(o.getTime())?null:o}return null}var Kn=new Map;function qe(e,t={month:"short",day:"numeric"}){let n=ht(e);if(!n)return"-";let{locale:r=oe,...o}=t,i=r+JSON.stringify(o),a=Kn.get(i);return a||(a=new Intl.DateTimeFormat(r,o),Kn.set(i,a)),a.format(n)}var Kt=P(O(),1),gt=(0,de.createContext)({theme:Te,cssVars:!0});function zo(e,t=Te){return e?typeof e=="string"?Dt[e]??t:Et(t,e):t}function pt(e){let t=(0,de.useContext)(gt),n=e.base?Dt[e.base]:t.theme,r=(0,de.useMemo)(()=>zo(e.theme,n),[e.theme,n]),o=e.cssVars??t.cssVars,i=e.locale??t.locale,a=(0,de.useMemo)(()=>({theme:r,cssVars:o,locale:i}),[r,o,i]),s=(0,de.useMemo)(()=>Lt(r),[r]),l=e.paint?{background:r.bg,color:r.ink,fontFamily:r.fontFamily,...s,...e.style}:{display:"contents",...s,...e.style};return(0,Kt.jsx)(gt.Provider,{value:a,children:(0,Kt.jsx)("div",{className:e.className,"data-ztd-theme":r.name,lang:e.locale,style:l,children:e.children})})}var Ho=new Set(["bg","panel","ink","muted","dim","accent","accentText","onAccent","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"]);function tr(e){return Ho.has(e)}function jo(e,t){let n=r=>t?`var(${it(r)}, ${e[r]})`:e[r];return{theme:e,cssVars:t,paint:n,color:(r,o="neutral")=>r?tr(r)?n(r):r:n(o),raw:(r,o="neutral")=>r?tr(r)?e[r]:r:e[o],mix:(r,o,i)=>{let a=Math.round(Math.max(0,Math.min(1,i))*1e3)/10;return t?`color-mix(in oklab, ${n(r)} ${a}%, ${n(o)})`:ct(e[r],e[o],i)}}}function fe(e){let t=(0,de.useContext)(gt);return(0,de.useMemo)(()=>{let n=Et(t.theme,e);return jo(n,t.cssVars)},[t.theme,t.cssVars,e])}function ne(e){let t=(0,de.useContext)(gt);return e??t.locale??oe}function nr(e){return e?Lt(e):{}}var bt=P(X(),1),Ut=(0,bt.createContext)(void 0);function rr(e){let t=(0,bt.useContext)(Ut);return e!==void 0&&t!==void 0?`${e}:${t}`:e??t}var S=P(O(),1),Vo={legend:"Legend",replay:"Replay animation",replayTitle:"Replay",sample:"Sample data",loadError:"Couldn't load data",retry:"Try again",loading:"Loading",empty:"No data to show",source:"Source",shown:(e,t)=>`${e} of ${t} series shown`},Wo={en:Vo,ko:{legend:"범례",replay:"애니메이션 다시 재생",replayTitle:"다시 재생",sample:"예시 데이터",loadError:"데이터를 불러오지 못했어요",retry:"다시 시도",loading:"불러오는 중",empty:"표시할 데이터가 없어요",source:"출처",shown:(e,t)=>`${t}개 중 ${e}개 보임`}};var Go={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},Xt=e=>Wo[W(ne(e))];function Yt(e){let t=fe(e.theme),n=Xt(e.locale),[r,o]=(0,yt.useState)(!1),i=e.size??11.5,a=e.onToggle,s=new Set(a?e.hidden:void 0),l=e.items.filter(m=>!s.has(m.label)).length,c=(0,S.jsx)("ul",{"aria-label":n.legend,style:{display:"flex",flexWrap:"wrap",justifyContent:e.align==="start"?"flex-start":"flex-end",gap:"4px 12px",margin:0,padding:0,listStyle:"none"},children:e.items.map((m,u)=>{let h=!s.has(m.label),d=h&&l===1,f=(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(Ko,{p:t,item:m,off:!h}),(0,S.jsx)("span",{style:h?void 0:{textDecoration:"line-through"},children:m.label})]});return(0,S.jsx)("li",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:i,color:t.paint("muted"),lineHeight:1.3},children:a?(0,S.jsx)("button",{type:"button",className:"ztd-btn","aria-pressed":h,"aria-disabled":d||void 0,onClick:()=>{d||(a(m.label),o(!0))},style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:24,minWidth:24,padding:"0 2px",margin:0,border:0,borderRadius:4,background:"transparent",color:"inherit",fontSize:"inherit",lineHeight:"inherit",cursor:d?"default":void 0},children:f}):f},u)})});return a?(0,S.jsxs)(S.Fragment,{children:[c,(0,S.jsx)("span",{"aria-live":"polite","aria-atomic":"true",style:Go,children:r?n.shown(l,e.items.length):""})]}):c}function Ko({p:e,item:t,off:n}){let r=Bn(e,t.color),o=t.shape??"square";return o==="line"||o==="dash"?(0,S.jsxs)("svg",{width:14,height:8,"aria-hidden":"true",style:{flex:"none",opacity:n?.35:void 0},children:[(0,S.jsx)("line",{x1:1,x2:13,y1:4,y2:4,stroke:r,strokeWidth:2,strokeDasharray:o==="dash"?"3 2":void 0,strokeLinecap:"round"}),o==="line"?(0,S.jsx)("circle",{cx:7,cy:4,r:2.2,fill:r}):null]}):(0,S.jsx)("span",{"aria-hidden":"true",style:{width:9,height:9,flex:"none",borderRadius:o==="circle"?9:2.5,background:r,boxShadow:t.color==="neutral"||t.color==="neutralSoft"||!t.color?`inset 0 0 0 1px ${e.paint("line2")}`:void 0,opacity:n?.35:void 0}})}function Uo(e){let t=fe(e.theme),n=Ln(e.level,W(ne(e.locale)));return(0,S.jsx)("span",{style:{background:t.paint(n.bg),color:t.paint(n.fg),borderRadius:8,padding:"3px 9px",fontSize:12.5,fontWeight:700,lineHeight:"18px",whiteSpace:"nowrap",flex:"none"},children:n.text})}function Xo(e,t,n){if(typeof e!="string"||!t)return e;let r=e.indexOf(t);return r<0?e:(0,S.jsxs)(S.Fragment,{children:[e.slice(0,r),(0,S.jsx)("span",{style:{color:n},children:t}),e.slice(r+t.length)]})}function or(e){let t=fe(e.theme),n=Xt(e.locale),[r,o]=(0,yt.useState)(0);ye(()=>Xe(),[]);let i=()=>{o(h=>h+1),e.onReplay?.()},a=Array.isArray(e.legend)?(0,S.jsx)(Yt,{items:e.legend,theme:e.theme,locale:e.locale}):e.legend,s=e.as??"h3",l=e.number===void 0?null:typeof e.number=="number"?String(e.number).padStart(2,"0"):e.number,c=e.replay||e.onReplay,m=e.source!==void 0||e.note!==void 0?(0,S.jsxs)("p",{style:{margin:0,fontSize:12,color:t.paint("muted"),lineHeight:1.4},children:[e.source!==void 0?`${n.source}: `:null,e.source,e.source!==void 0&&e.note!==void 0?" · ":null,e.note]}):null,u=e.takeaway!==void 0||e.level||e.sample?(0,S.jsxs)("footer",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,marginTop:2},children:[(0,S.jsx)("span",{style:{fontSize:17,fontWeight:800,color:t.paint("ink"),letterSpacing:-.3,lineHeight:1.3,minWidth:0},children:e.takeaway}),(0,S.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:8,flex:"none"},children:[e.sample?(0,S.jsx)("span",{style:{fontSize:11.5,color:t.paint("muted"),whiteSpace:"nowrap"},children:typeof e.sample=="string"?e.sample:n.sample}):null,e.level?(0,S.jsx)(Uo,{level:e.level,theme:e.theme,locale:e.locale}):null]})]}):null;return(0,S.jsxs)("section",{id:e.id,className:`ztd-card${e.className?` ${e.className}`:""}`,style:{background:t.paint("panel"),color:t.paint("ink"),border:`1px solid ${t.paint("line")}`,borderRadius:`var(--ztd-radius, ${t.theme.radius}px)`,padding:"20px 20px 16px",display:"flex",flexDirection:"column",gap:12,minWidth:0,boxSizing:"border-box",fontFamily:t.cssVars?`var(--ztd-font, ${t.theme.fontFamily})`:t.theme.fontFamily,wordBreak:"keep-all",textWrap:"balance",...e.style},children:[(0,S.jsxs)("header",{style:{display:"flex",flexDirection:"column",gap:6,minWidth:0},children:[(0,S.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0},children:[l?(0,S.jsx)("span",{style:{fontFamily:t.cssVars?`var(--ztd-mono, ${t.theme.monoFamily})`:t.theme.monoFamily,fontSize:17,fontWeight:700,color:t.paint("accentText"),letterSpacing:-.2,flex:"none"},children:l}):null,(0,S.jsx)(s,{style:{margin:0,fontSize:22,fontWeight:800,color:t.paint("ink"),letterSpacing:-.5,lineHeight:1.25,minWidth:0,flex:1,overflow:"hidden",textOverflow:"ellipsis"},children:Xo(e.title,e.accent,t.paint("accentText"))}),e.actions,c?(0,S.jsx)("button",{type:"button",className:"ztd-btn",onClick:i,"aria-label":e.replayLabel??n.replay,title:e.replayLabel??n.replayTitle,style:{background:"transparent",color:t.paint("muted"),border:`1px solid ${t.paint("line2")}`,borderRadius:14,width:28,height:28,display:"inline-grid",placeItems:"center",padding:0,flex:"none"},children:(0,S.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,S.jsx)("path",{d:"M3 12a9 9 0 1 0 3-6.7"}),(0,S.jsx)("path",{d:"M3 3v6h6"})]})}):null]}),e.subtitle!==void 0||a?(0,S.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"4px 12px",flexWrap:"wrap",minHeight:18},children:[e.subtitle!==void 0?(0,S.jsx)("span",{style:{fontSize:12.5,color:t.paint("muted"),lineHeight:1.4},children:e.subtitle}):(0,S.jsx)("span",{}),a]}):null]}),(0,S.jsx)("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",minHeight:0,minWidth:0},children:(0,S.jsx)(Ut.Provider,{value:r,children:(0,S.jsx)(Le.Provider,{value:typeof e.title=="string"||typeof e.title=="number"?String(e.title):void 0,children:e.children})})}),m?(0,S.jsxs)(S.Fragment,{children:[m,u]}):u]})}function qt(e){let t=fe(e.theme),n=Xt(e.locale),r=e.height??220;if(ye(()=>Xe(),[]),e.error){let o=typeof e.error=="string"?e.error:e.error.message;return(0,S.jsx)("div",{role:"alert",style:{height:r,display:"grid",placeItems:"center",textAlign:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,S.jsxs)("div",{style:{display:"grid",gap:8,justifyItems:"center",padding:16},children:[(0,S.jsx)("span",{style:{fontSize:14,fontWeight:700,color:t.paint("ink")},children:n.loadError}),(0,S.jsx)("span",{style:{fontSize:12,color:t.paint("muted"),maxWidth:280,wordBreak:"break-word"},children:o}),e.onRetry?(0,S.jsx)("button",{type:"button",className:"ztd-btn",onClick:e.onRetry,style:{marginTop:4,background:t.paint("ink"),color:t.paint("onInk"),border:"none",borderRadius:14,padding:"5px 14px",fontSize:12.5,fontWeight:700},children:n.retry}):null]})})}return e.loading?(0,S.jsx)("div",{role:"status","aria-busy":"true","aria-label":n.loading,style:{height:r,display:"flex",alignItems:"flex-end",gap:8,padding:"12px 4px"},children:[.55,.8,.4,.95,.65,.75,.5].map((o,i)=>(0,S.jsx)("span",{className:"ztd-skeleton",style:{flex:1,height:`${o*100}%`,background:t.paint("lift"),borderRadius:6,animationDelay:`${i*90}ms`}},i))}):e.empty?(0,S.jsx)("div",{style:{height:r,display:"grid",placeItems:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,S.jsx)("span",{style:{fontSize:13,color:t.paint("muted")},children:e.emptyText??n.empty})}):(0,S.jsx)(S.Fragment,{children:e.children})}var Ke=P(X(),1);var se=P(X(),1);var H=P(O(),1),xt=60;var kt={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};function ar(e){let{c:t,events:n}=e,r=(0,se.useId)().replace(/:/g,""),o=`${r}t`,i=`${r}d`;t.events.current=n,ye(()=>{Xe()},[]);let a=n.length,s=!e.noNav&&a>0,l=(0,se.useContext)(Le),c=e.ariaLabel??l??e.kind,m=(0,se.useMemo)(()=>s?`${n.length}${n.slice(0,xt).map(b=>`${b.label}${b.series??""}${b.formatted??b.value??""}`).join("")}`:"",[n,s]),u=(0,se.useMemo)(()=>(0,H.jsx)(Yo,{label:c,events:n,t:t.t}),[c,m,t.t]),h=(0,se.useRef)(null);(0,se.useEffect)(()=>{let b=()=>{h.current=null};return window.addEventListener("scroll",b,{capture:!0,passive:!0}),window.addEventListener("resize",b,{passive:!0}),()=>{window.removeEventListener("scroll",b,{capture:!0}),window.removeEventListener("resize",b)}},[]),(0,se.useEffect)(()=>{h.current=null},[t.width,t.height]);let d=b=>{if(b.target!==b.currentTarget)return;if(e.onKey?.(b)){b.preventDefault();return}let T=t.active,L;switch(b.key){case"ArrowRight":case"ArrowDown":L=T===null?0:(T+1)%a;break;case"ArrowLeft":case"ArrowUp":L=T===null?a-1:(T-1+a)%a;break;case"Home":L=0;break;case"End":L=a-1;break;case"Escape":if(T===null)return;L=null;break;case"Enter":case" ":T!==null&&(b.preventDefault(),t.click(T));return;default:return}b.preventDefault(),t.setActive(L,"keyboard")},{via:f,node:p,setActive:w}=t;(0,se.useEffect)(()=>{if(f!=="touch"||!p)return;let b=T=>{p.contains(T.target)||w(null)};return document.addEventListener("pointerdown",b),()=>document.removeEventListener("pointerdown",b)},[f,p,w]);let x=t.active!==null?n[t.active]:null,k=t.showTooltip&&e.renderTip!==!1&&!t.pending&&t.via!=="sync"?e.tip:null,v=k&&!t.responsive&&t.node&&t.width&&t.node.getBoundingClientRect().width/t.width||1,C=typeof e.renderTip=="function"&&x?e.renderTip(x):null,g=e.announce??(t.via==="keyboard"&&x?`${x.label}${x.series?` ${x.series}`:""}: ${x.formatted??x.value??""} (${(t.active??0)+1}/${a})`:""),N;if(k){let b=k.x*v,T=t.width*v,L=`clamp(${(4-b).toFixed(1)}px, -50%, calc(${(T-b-4).toFixed(1)}px - 100%))`,B=k.y<64;N={position:"absolute",left:b,top:k.y*v,transform:`translate(${L}, ${B?"16px":"calc(-100% - 14px)"})`,background:t.p.paint("panel"),color:t.p.paint("ink"),border:`1px solid ${t.p.paint("line")}`,borderRadius:12,padding:"8px 11px",pointerEvents:"none",whiteSpace:"nowrap",fontSize:12,lineHeight:"18px",zIndex:5,boxShadow:"0 10px 28px -8px rgba(0,0,0,0.28), 0 2px 6px rgba(0,0,0,0.08)",fontVariantNumeric:"tabular-nums",minWidth:112,maxWidth:Math.max(160,t.width*v-8)}}let D=b=>{h.current=null,b.pointerType!=="touch"&&t.via!=="keyboard"&&t.setActive(null)},F=b=>b?T=>{let L=h.current??(h.current=T.currentTarget.getBoundingClientRect());L.width&&b((T.clientX-L.left)/L.width*t.width,(T.clientY-L.top)/L.height*t.height,T)}:void 0,I=F(e.onPointerMove),E=F(e.onPointerDown),R=I||E?b=>{b.pointerType==="touch"&&I?.(b),E?.(b)}:void 0,A=F(e.onPointerUp),M=nr(e.theme);return(0,H.jsxs)("div",{ref:t.ref,className:`ztd-root${t.reduced?" ztd-still":""}${e.className?` ${e.className}`:""}`,role:"group","aria-roledescription":t.t.chart,"aria-label":c,"aria-describedby":i,tabIndex:s?0:void 0,onKeyDown:s?d:void 0,onBlur:b=>{t.via==="keyboard"&&!b.currentTarget.contains(b.relatedTarget)&&t.setActive(null)},onPointerLeave:D,style:{width:"100%",maxWidth:t.measured?void 0:"100%",fontFamily:t.p.cssVars?`var(--ztd-font, ${t.p.theme.fontFamily})`:t.p.theme.fontFamily,color:t.p.paint("ink"),...M,...e.style},children:[t.pending?null:e.underlay,(0,H.jsxs)("svg",{className:"ztd-svg",role:"img","aria-labelledby":`${o} ${i}`,viewBox:`0 0 ${Math.max(1,Math.round(t.width*10)/10)} ${Math.max(1,Math.round(t.height*10)/10)}`,width:"100%",preserveAspectRatio:"xMidYMid meet",onPointerMove:I,onPointerDown:R,onPointerUp:A,onPointerCancel:A,style:{fontFamily:"inherit",touchAction:"pan-y",position:e.underlay?"relative":void 0},children:[(0,H.jsx)("title",{id:o,children:c}),(0,H.jsx)("desc",{id:i,children:a||t.description!==void 0?e.description:e.emptyText??t.t.empty}),e.defs&&!t.pending?(0,H.jsx)("defs",{children:e.defs}):null,t.pending?null:e.children]}),t.pending?null:e.overlay,k?(0,H.jsx)("div",{className:"ztd-tip","aria-hidden":"true",style:N,children:C??(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)("div",{style:{fontWeight:600,fontSize:11.5,color:t.p.paint("muted"),marginBottom:k.rows.length?4:0,overflow:"hidden",textOverflow:"ellipsis"},children:k.title}),k.rows.map((b,T)=>(0,H.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:16,justifyContent:"space-between"},children:[(0,H.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:7,color:t.p.paint(b.strong?"ink":"muted")},children:[b.color?(0,H.jsx)("span",{style:{width:8,height:8,borderRadius:999,background:b.color,display:"inline-block",boxShadow:"inset 0 0 0 1px rgba(127,127,127,0.3)"}}):null,b.label]}),(0,H.jsx)("span",{style:{fontWeight:b.strong===!1?500:700},children:b.value})]},T))]})}):null,(0,H.jsx)("span",{className:"ztd-sr",style:kt,"aria-live":"polite","aria-atomic":"true",children:g}),s&&!t.pending?u:null]})}function Yo({label:e,events:t,t:n}){return(0,H.jsx)("div",{className:"ztd-sr",style:kt,children:(0,H.jsxs)("table",{children:[(0,H.jsx)("caption",{children:n.table(e)}),(0,H.jsxs)("tbody",{children:[t.slice(0,xt).map((r,o)=>(0,H.jsxs)("tr",{children:[(0,H.jsx)("th",{scope:"row",children:r.series?`${r.label} · ${r.series}`:r.label}),(0,H.jsx)("td",{children:r.formatted??r.value??""})]},o)),t.length>xt?(0,H.jsx)("tr",{children:(0,H.jsx)("td",{colSpan:2,children:n.more(t.length-xt)})}):null]})]})})}function Pe(e){let t=e.baseline??"central";return(0,H.jsx)("text",{x:Math.round(e.x*10)/10,y:Math.round(e.y*10)/10,dy:t==="central"?"0.35em":t==="hanging"?"0.75em":void 0,fontSize:e.size??11,fill:e.fill??"currentColor",textAnchor:e.anchor??"start",fontWeight:e.weight??400,opacity:e.opacity===void 0||e.opacity>=1?void 0:Math.max(0,e.opacity),className:e.className,letterSpacing:e.letterSpacing,style:{pointerEvents:"none",fontVariantNumeric:"tabular-nums"},children:e.children})}var y=(e,t,n,r,o={})=>({name:e,type:t,required:n,description:r,...o}),he=y("label","string",!0,"Item name field"),re=y("value","number",!0,"Value field"),qo=[he,re],Jo=[he,re],Zo=[y("label","string",!0,"Stage name"),y("value","number",!0,"Users at the stage")],Qo=[he,re],ea=[y("label","string",!0,"Leaf (lowest level) name"),re,y("group","string",!1,"Parent group field")],ta=[y("label","string",!0,"Leaf name"),re,y("group","string",!1,"Parent group field")],na=[he,y("value","number",!0,"Change (total rows may omit it)"),y("type","string",!1,'"total" makes a total bar')],ra=[he,re],oa=[y("x","string",!0,"Column field"),y("series","string",!0,"Stacked series field"),re],aa=[y("x","string",!0,"Column field"),y("y","string",!0,"Row field"),re],ia=[y("axis","string",!0,"Metric (axis) field"),y("value","number",!0,"Value field",{multi:!0}),y("series","string",!1,"Series field")],sa=[y("x","number",!0,"x value"),y("y","number",!0,"y value"),y("size","number",!1,"Circle size"),y("label","string",!1,"Name")],sr=y("upper","number",!1,"Upper bound of the range band. Same shape as lower",{multi:!0}),la=[y("x","any",!0,"x field (date, number or category)"),y("y","number",!0,"y field. An array for wide tables",{multi:!0}),y("series","string",!1,"Series field (long tables)"),y("lower","number",!1,"Lower bound of the range band. In wide tables an array in the order of y",{multi:!0}),sr],ca=[y("x","any",!0,"x field"),y("y","number",!0,"y field. An array for wide tables",{multi:!0}),y("series","string",!1,"Series field"),y("lower","number",!1,'Lower bound of the range band, with stack "none" only. In wide tables an array in the order of y',{multi:!0}),sr],ua=[y("x","any",!0,"x field"),y("y","number",!0,"y field",{multi:!0}),y("series","string",!1,"Series field")],ma=[y("x","string",!0,"Category field"),y("y","number",!0,"Value field. An array for wide tables",{multi:!0}),y("series","string",!1,"Series field"),y("line","number",!1,"Lines over vertical bars on the same axis, such as a target or last year. An array for several. Bars stay gray unless highlight is set, and with series the line averages rows of the same x",{multi:!0})],da=[he,re],fa=[y("value","number",!0,"Value field",{prop:"valueKey"}),y("target","number",!1,"Target field",{prop:"targetKey"})],ha=[he,y("value","number",!0,"Actual value field"),y("target","number",!1,"Target field")],ga=[y("x","any",!1,"x field"),y("y","number",!0,"y field")],pa=[he,y("x","string",!1,"Period field (long tables)"),y("value","number",!1,"Value field (long tables)")],ba=[he,y("start","number",!0,"Before value"),y("end","number",!0,"After value")],ya=[he,re],xa=[y("value","number",!0,"Value field"),y("group","string",!1,"Group (row) field"),y("label","string",!1,"Dot name")],ka=[y("group","string",!0,"Group field"),y("value","number",!0,"Value field")],wa=[y("source","string",!0,"Source node"),y("target","string",!0,"Target node"),re],va=[y("source","string",!0,"Sending group"),y("target","string",!0,"Receiving group"),re],$a=[y("date","date",!0,"Date field"),re],Ca=[y("x","any",!0,"Period field"),y("series","string",!0,"Item field"),y("rank","number",!1,"Rank field (1 is first)"),y("value","number",!1,"Value field (instead of rank, largest is first)")],Ma=[y("group","string",!0,"Group field"),y("value","number",!0,"Value field")],Ta=[y("label","string",!1,"Row name field")],Sa=[y("x","date",!0,"Date (period) field"),y("open","number",!0,"Open price field"),y("high","number",!0,"High price field"),y("low","number",!0,"Low price field"),y("close","number",!0,"Close price field"),y("volume","number",!1,"Volume field")],Aa=[he,re],Fa=[y("x","any",!0,"Period field (date or category)"),y("y","number",!0,"Back row fields stacked into each block. An array for wide tables",{multi:!0}),y("series","string",!1,"Series field (long tables, back row only)"),y("front","number",!1,"Front row fields: a smaller outcome in the same unit as y (wide tables only)",{multi:!0})],Na=[y("value","number",!1,"Sample value field (raw rows)"),y("group","string",!1,"Group field. Up to 2 groups overlap"),y("x0","number",!1,"Bin start (pre-binned rows)"),y("x1","number",!1,"Bin end (pre-binned rows)"),y("count","number",!1,"Samples in the bin (pre-binned rows)")],Ra=[y("region","string",!0,"Region name or code, matched to a tile of options.map"),re],Pa=[y("x","number",!0,"x value"),y("y","number",!0,"y value"),y("series","string",!1,"Series field (one color per series)"),y("label","string",!1,"Name")],ir={pie:qo,donut:Jo,funnel:Zo,waffle:Qo,treemap:ea,sunburst:ta,waterfall:na,pareto:ra,marimekko:oa,heatmap:aa,radar:ia,bubble:sa,line:la,area:ca,stream:ua,bar:ma,radialBar:da,gauge:fa,bullet:ha,sparkline:ga,slope:pa,dumbbell:ba,lollipop:ya,beeswarm:xa,ridgeline:ka,sankey:wa,chord:va,calendar:$a,bump:Ca,box:Ma,parallel:Ta,candlestick:Sa,segmented:Aa,skyline:Fa,histogram:Na,scatter:Pa,tileMap:Ra},Be={pie:{component:"PieChart",name:"Pie chart",nameKo:"파이 차트"},donut:{component:"DonutChart",name:"Donut chart",nameKo:"도넛 차트"},funnel:{component:"FunnelChart",name:"Funnel chart",nameKo:"퍼널 차트"},waffle:{component:"WaffleChart",name:"Waffle chart",nameKo:"와플 차트"},treemap:{component:"Treemap",name:"Treemap",nameKo:"트리맵"},sunburst:{component:"SunburstChart",name:"Sunburst",nameKo:"선버스트"},waterfall:{component:"WaterfallChart",name:"Waterfall chart",nameKo:"폭포 차트"},pareto:{component:"ParetoChart",name:"Pareto chart",nameKo:"파레토 차트"},marimekko:{component:"MarimekkoChart",name:"Marimekko chart",nameKo:"마리메코 차트"},heatmap:{component:"Heatmap",name:"Heatmap",nameKo:"히트맵"},radar:{component:"RadarChart",name:"Radar chart",nameKo:"레이더 차트"},bubble:{component:"BubbleChart",name:"Bubble chart",nameKo:"버블 차트"},line:{component:"LineChart",name:"Line chart",nameKo:"라인 차트"},area:{component:"AreaChart",name:"Area chart",nameKo:"영역 차트"},stream:{component:"StreamGraph",name:"Streamgraph",nameKo:"스트림그래프"},bar:{component:"BarChart",name:"Bar chart",nameKo:"막대 차트"},radialBar:{component:"RadialBarChart",name:"Radial bar chart",nameKo:"방사형 막대"},gauge:{component:"GaugeChart",name:"Gauge",nameKo:"게이지"},bullet:{component:"BulletChart",name:"Bullet chart",nameKo:"불릿 차트"},sparkline:{component:"Sparkline",name:"Sparkline",nameKo:"스파크라인"},slope:{component:"SlopeChart",name:"Slope chart",nameKo:"슬로프 차트"},dumbbell:{component:"DumbbellChart",name:"Dumbbell chart",nameKo:"덤벨 차트"},lollipop:{component:"LollipopChart",name:"Lollipop chart",nameKo:"롤리팝 차트"},beeswarm:{component:"BeeswarmChart",name:"Beeswarm",nameKo:"비스웜"},ridgeline:{component:"RidgelineChart",name:"Ridgeline",nameKo:"릿지라인"},sankey:{component:"SankeyChart",name:"Sankey diagram",nameKo:"생키 다이어그램"},chord:{component:"ChordChart",name:"Chord diagram",nameKo:"코드 다이어그램"},calendar:{component:"CalendarHeatmap",name:"Calendar heatmap",nameKo:"캘린더 히트맵"},bump:{component:"BumpChart",name:"Bump chart",nameKo:"범프 차트"},box:{component:"BoxPlot",name:"Box / violin plot",nameKo:"박스 플롯"},parallel:{component:"ParallelCoordinates",name:"Parallel coordinates",nameKo:"평행 좌표"},candlestick:{component:"CandlestickChart",name:"Candlestick chart",nameKo:"캔들스틱"},segmented:{component:"SegmentedBar",name:"Segmented bar",nameKo:"비율 막대"},skyline:{component:"SkylineChart",name:"Skyline",nameKo:"스카이라인"},histogram:{component:"HistogramChart",name:"Histogram",nameKo:"히스토그램"},scatter:{component:"ScatterChart",name:"Scatter plot",nameKo:"산점도"},tileMap:{component:"TileMap",name:"Tile grid map",nameKo:"타일 격자 지도"}};function lr(e,t){return t==="ko"?e.nameKo:e.name}function cr(e,t){let n=t??e.options?.locale;return typeof n=="string"&&n?n.replace(/_/g,"-"):void 0}var ur=["line","area","bar","scatter"],mr=24,Jt=["line","area","bar","scatter"];function Zt(e,t,n){return e==="bar"&&n.orientation!=="horizontal"&&n.layout!=="percent"&&n.layout!=="diverging"?[].concat(t.line??[]).map(String):[]}function dr(e,t,n){return Jt.includes(e)&&!Zt(e,t,n).length}function fr(e){let t=e.options?.tooltip?.template;return typeof t=="string"&&t?t:void 0}var Da={doughnut:"donut",column:"bar",stackedBar:"bar",groupedBar:"bar",stacked:"area",streamgraph:"stream",radial:"radialBar",radialbar:"radialBar",progress:"gauge",progressRing:"gauge",kpi:"gauge",violin:"box",boxplot:"box",calendarHeatmap:"calendar","parallel-coordinates":"parallel",parallelCoordinates:"parallel",mekko:"marimekko",spider:"radar",ohlc:"candlestick",candle:"candlestick",stock:"candlestick",segment:"segmented",segmentedBar:"segmented",proportionBar:"segmented",stackedBar100:"segmented",hist:"histogram",tilemap:"tileMap",tileGrid:"tileMap",cartogram:"tileMap"};function wt(e){let t=ir[e]?e:Da[e]??Object.keys(Be).find(n=>n.toLowerCase()===e.toLowerCase()||Be[n].component.toLowerCase()===e.toLowerCase());if(!(!t||!Be[t]))return{type:t,component:Be[t].component,name:Be[t].name,nameKo:Be[t].nameKo,encoding:ir[t]}}function hr(e){let t=new Set,n=i=>{Array.isArray(i)?i.forEach(n):typeof i=="string"&&i&&t.add(i)},r=e.encoding??{};for(let i of wt(e.type)?.encoding.map(a=>a.name)??Object.keys(r))n(r[i]);let o=e.options??{};for(let i of["dimensions","start","end","ranges"])n(o[i]);return[...t]}function gr(e,t){return Object.hasOwn(e,t)||t in e&&!(t in{})}function La(e,t){if(e==null||typeof e!="object")return;let n=e;if(gr(n,t))return n[t];if(t.includes(".")){let r=n;for(let o of t.split(".")){if(r===null||typeof r!="object"||!gr(r,o))return;r=r[o]}return r}}function Ce(e){if(typeof e=="number")return Number.isFinite(e)?e:NaN;if(typeof e=="bigint")return Number(e);if(typeof e=="string"){let t=e.trim(),n=/^\(.*\)$/.test(t),r=t.replace(/[()\s%₩$€£¥원명건개회]/g,"").replace(/^\+/,"");if(!r||r.includes(",")&&!/^-?\d{1,3}(,\d{3})*(\.\d+)?$/.test(r))return NaN;let o=Number(r.replace(/,/g,""));return Number.isFinite(o)?n?-o:o:NaN}return e instanceof Date?e.getTime():typeof e=="boolean"?e?1:0:NaN}function ze(e,t){if(typeof e=="function")return e;let n=e??t;return r=>La(r,n)}function He(e,t){let n=ze(e,t);return(r,o)=>Ce(n(r,o))}function Se(e,t){let n=ze(e,t);return(r,o)=>{let i=n(r,o);return i==null?"":i instanceof Date?new Date(i.getTime()-i.getTimezoneOffset()*6e4).toISOString().slice(0,10):String(i)}}function je(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}function Ea(e){let t=[],n=!1;for(let l=0;l<e.length&&l<4e3;l++){let c=e[l];if(c==='"')n=!n;else if(!n&&(c===`
|
|
23
|
+
`||c==="\r"))break;t.push(n?"":c)}let r=t.join(""),o=l=>r.split(l).length-1,i=[","," ",";","|"],a=",",s=0;for(let l of i){let c=o(l);c>s&&(s=c,a=l)}return a}var _a=/^[-+(]?[₩$€£¥]?\s?\d[\d,]*(\.\d+)?([eE][-+]?\d+)?\)?\s?(%|원|명|건|개|회)?$/;function pr(e){let t=e.trim();if(t==="")return null;if(/^-?0\d/.test(t))return t;if(_a.test(t)||/^[-+]?\.\d+$/.test(t)){let n=Ce(t);if(Number.isFinite(n))return n}return t}function De(e,t={}){let{typed:n=!0,header:r=!0}=t,o=e.replace(/^\uFEFF/,"");if(!o.trim())return[];let i=t.delimiter??Ea(o),a=[],s=[],l="",c=!1;for(let f=0;f<o.length;f++){let p=o[f];c?p==='"'?o[f+1]==='"'?(l+='"',f++):c=!1:l+=p:p==='"'&&!l.trim()?(c=!0,l=""):p===i?(s.push(l),l=""):p===`
|
|
24
|
+
`||p==="\r"?(p==="\r"&&o[f+1]===`
|
|
25
|
+
`&&f++,s.push(l),a.push(s),s=[],l=""):l+=p}(l!==""||s.length)&&(s.push(l),a.push(s));let m=a.filter(f=>!(f.length===1&&f[0].trim()===""));if(!m.length)return[];let u=f=>n?pr(f):f;if(!r)return m.map(f=>Object.fromEntries(f.map((p,w)=>[String(w),u(p)])));let h=[],d=new Set;return m[0].forEach((f,p)=>{let w=f.trim()||`col${p+1}`,x=w;for(let k=2;d.has(x);k++)x=`${w}_${k}`;d.add(x),h.push(x)}),m.slice(1).map(f=>Object.fromEntries(h.map((p,w)=>[p,u(f[w]??"")])))}function Qt(e,t,n={}){if(!e.length)return[];let{typed:r=!0}=n,o=(t??e[0]).map((a,s)=>String(a??"").trim()||`col${s+1}`);return(t?e:e.slice(1)).map(a=>Object.fromEntries(o.map((s,l)=>[s,r&&typeof a[l]=="string"?pr(a[l]):a[l]??null])))}function Ia(e,t={}){let{labelKey:n="label",valueKey:r="value"}=t,o=Object.values(e);if(o.length&&o.every(i=>Array.isArray(i))){let i=Object.keys(e),a=Math.max(...o.map(s=>s.length));return Array.from({length:a},(s,l)=>Object.fromEntries(i.map(c=>[c,e[c][l]??null])))}return Object.entries(e).map(([i,a])=>({[n]:i,[r]:a}))}function br(e,t){let n=e;for(let r of t.split(".").filter(Boolean)){if(n===null||typeof n!="object")return;n=n[r]}return n}function Ae(e){if(e==null)return[];if(typeof e=="string"){let t=e.trim();if(!t)return[];if(t.startsWith("[")||t.startsWith("{"))try{return Ae(JSON.parse(t))}catch{}return De(t)}if(Array.isArray(e))return e.length?Array.isArray(e[0])?Qt(e):typeof e[0]=="number"?e.map((t,n)=>({label:String(n+1),value:t})):e.filter(t=>t&&typeof t=="object"):[];if(typeof e=="object"){let t=e;return Array.isArray(t.data)?Ae(t.data):Array.isArray(t.rows)&&Array.isArray(t.columns)?Qt(t.rows,t.columns.map(n=>typeof n=="object"&&n&&"name"in n?String(n.name):String(n))):Array.isArray(t.rows)&&Array.isArray(t.fields)||Array.isArray(t.rows)?Ae(t.rows):Array.isArray(t.values)?Qt(t.values):Array.isArray(t.items)?Ae(t.items):Array.isArray(t.results)?Ae(t.results):Ia(t)}return[]}function vt(e){if(!Array.isArray(e))try{return JSON.stringify(e??null)??""}catch{return String(e)}let t=e.length,n=i=>{try{return JSON.stringify(i)}catch{return String(i)}};if(t<=300)return n(e);let r=Math.ceil(t/60),o=[];for(let i=0;i<t;i+=r)o.push(e[i]);return o.push(e[t-1]),`${t}:${n(o)}`}function en(e,t="zero"){let n=e.length,r=n?e[0].length:0,o=e.map(()=>new Array(r).fill(0)),i=e.map(()=>new Array(r).fill(0)),a=(l,c)=>{let m=e[l][c];return Number.isFinite(m)&&m>0?m:0},s=new Array(r).fill(0);if(t==="wiggle"&&n>0&&r>1){let l=0;for(let c=1;c<r;c++){let m=0,u=0;for(let h=0;h<n;h++){let d=a(h,c),f=d-a(h,c-1),p=0;for(let w=0;w<h;w++)p+=a(w,c)-a(w,c-1);m+=d,u+=(f/2+p)*d}m&&(l-=u/m),s[c]=l}}for(let l=0;l<r;l++){if(t==="zero"){let u=0,h=0;for(let d=0;d<n;d++){let f=e[d][l],p=Number.isFinite(f)?f:0;p>=0?(o[d][l]=u,u+=p,i[d][l]=u):(o[d][l]=h,h+=p,i[d][l]=h)}continue}let c=0;for(let u=0;u<n;u++)c+=a(u,l);let m=t==="silhouette"?-c/2:s[l];for(let u=0;u<n;u++){let h=a(u,l);t==="expand"&&(h=c?h/c*100:0),o[u][l]=m,m+=h,i[u][l]=m}}if(t==="wiggle"&&r){let l=1/0,c=-1/0;for(let u=0;u<r;u++)l=Math.min(l,o[0]?.[u]??0),c=Math.max(c,i[n-1]?.[u]??0);let m=0;for(let u=0;u<r;u++)m+=((o[0]?.[u]??0)+(i[n-1]?.[u]??0))/2;m/=r;for(let u=0;u<n;u++)for(let h=0;h<r;h++)o[u][h]-=m,i[u][h]-=m}return{y0:o,y1:i}}function yr(e,t,n=-1){if(!t.some(r=>r>=0))return-1;for(let r=e-1;r>=0;r--)if(r!==n&&!t.includes(r))return r;return-1}function xr(e){let t=e.length,n=e.map(c=>{let m=0,u=-1/0;return c.forEach((h,d)=>{h>u&&(u=h,m=d)}),m}),r=e.map(c=>c.reduce((m,u)=>m+(Number.isFinite(u)?u:0),0)),o=Array.from({length:t},(c,m)=>m).sort((c,m)=>n[c]-n[m]),i=[],a=[],s=0,l=0;for(let c of o)s<l?(i.push(c),s+=r[c]):(a.push(c),l+=r[c]);return[...a.reverse(),...i]}var Ve=Math.PI*2;function tn(e){let t=0;for(let n of e)Number.isFinite(n)&&(t+=n);return t}function z(e){return Math.round(e*100)/100}function ke(e,t,n,r){return[e+n*Math.sin(r),t-n*Math.cos(r)]}function nn(e,t,n,r,o,i){let a=i-o;if(!(Math.abs(a)>1e-4)||r<=0)return"";if(Math.abs(a)>=Ve-1e-4){let k=(v,C)=>{let[g,N]=ke(e,t,v,o),[D,F]=ke(e,t,v,o+Math.PI);return`M${z(g)},${z(N)}A${z(v)},${z(v)} 0 1 ${C} ${z(D)},${z(F)}A${z(v)},${z(v)} 0 1 ${C} ${z(g)},${z(N)}Z`};return n>0?`${k(r,1)}${k(n,0)}`:k(r,1)}let l=a>0?1:0,c=Math.abs(a)>Math.PI?1:0,[m,u]=ke(e,t,r,o),[h,d]=ke(e,t,r,i);if(n<=0)return`M${z(e)},${z(t)}L${z(m)},${z(u)}A${z(r)},${z(r)} 0 ${c} ${l} ${z(h)},${z(d)}Z`;let[f,p]=ke(e,t,n,i),[w,x]=ke(e,t,n,o);return`M${z(m)},${z(u)}A${z(r)},${z(r)} 0 ${c} ${l} ${z(h)},${z(d)}L${z(f)},${z(p)}A${z(n)},${z(n)} 0 ${c} ${1-l} ${z(w)},${z(x)}Z`}function kr(e){let t=-1,n=-1/0;return e.forEach((r,o)=>{r>n&&(n=r,t=o)}),t}function vr(e){return e>=44032&&e<=55203||e>=4352&&e<=4607||e>=12592&&e<=12687||e>=19968&&e<=40959}function wr(e){return e>=44032&&e<=55203?.87:e>=4352&&e<=4607||e>=12592&&e<=12687?.8:e>=19968&&e<=40959?.94:e>=48&&e<=57?.585:e===32||e===44||e===46||e===58||e===59||e===39?.26:e===37?.84:e===8722?.73:e===45?.42:e===43||e===61?.6:e===40||e===41||e===91||e===93?.34:e===47?.38:e===8361||e===36?.62:e===8230?.82:e>=65&&e<=90?e===73?.28:e===77||e===87?.86:.66:e>=97&&e<=122?e===105||e===108||e===106?.24:e===109||e===119?.84:e===102||e===116||e===114?.36:.55:.6}var $t=new Map;function ge(e,t,n=400){let r=String(e),o=`${r}|${n>=600?1:0}`,i=$t.get(o);if(i===void 0){let a=0,s=0;for(let l=0;l<r.length;l++){let c=r.charCodeAt(l);vr(c)?a+=wr(c):s+=wr(c)}i=a+s*(n>=600?1.07:1),$t.size>5e3&&$t.clear(),$t.set(o,i)}return i*t}function Je(e,t,n,r=400){if(e=e.trim(),ge(e,n,r)<=t)return e;let o="…",i=0,a=e.length;for(;i<a;){let l=i+a+1>>1;ge(e.slice(0,l)+o,n,r)<=t?i=l:a=l-1}i>0&&(e.charCodeAt(i-1)&64512)===55296&&i--;let s=e.slice(0,i).trimEnd();return s.length<(vr(s.charCodeAt(0))?2:3)?"":s+o}function $r(e,t,n=-1/0,r=1/0){let o=e.map((s,l)=>({y:s,i:l})).sort((s,l)=>s.y-l.y),i=new Array(e.length),a=o.map(s=>Math.max(n,Math.min(r,s.y)));for(let s=0;s<30;s++){let l=!1;for(let c=1;c<a.length;c++){let m=a[c]-a[c-1];if(m<t){let u=(t-m)/2;a[c-1]-=u,a[c]+=u,l=!0}}for(let c=0;c<a.length;c++)a[c]=Math.max(n,Math.min(r,a[c]));if(!l)break}for(let s=1;s<a.length;s++)a[s]-a[s-1]<t&&(a[s]=a[s-1]+t);if(a.length&&a[a.length-1]>r){let s=a[a.length-1]-r;for(let l=0;l<a.length;l++)a[l]-=s}return o.forEach((s,l)=>{i[s.i]=a[l]}),i}var Mr=P(O(),1),Oa=e=>Array.isArray(e)&&e.length===2;function Cr(e){let t=[];for(let n of e??[])n.type==="line"&&typeof n.y=="number"?t.push(n.y):n.type==="band"&&Oa(n.y)&&t.push(Number(n.y[0]),Number(n.y[1]));return t.filter(Number.isFinite)}var Sr=P(O(),1),rn=10.5;function Ba(e,t,n){let r=e.map(t);if(new Set(r).size===r.length)return r;let o=1/0;for(let a=1;a<e.length;a++)o=Math.min(o,Math.abs(e[a]-e[a-1]));let i=o>0&&Number.isFinite(o)?Math.min(20,Math.max(2,Math.ceil(-Math.log10(o)-1e-9))):2;return e.map(a=>Oe(a,{locale:n,maximumFractionDigits:i}))}function Tr(e,t,n){let r=18;for(let o of Ba(e,t,n))r=Math.max(r,ge(o,rn));return Math.ceil(r+8)}function on(e,t){if(!(e>0)||!Number.isFinite(e))return 1;let n=e/Math.max(1,t),r=Math.pow(10,Math.floor(Math.log10(n))),o=n/r;return(o>=7.071?10:o>=3.162?5:o>=1.414?2:1)*r}function We(e,t,n=4,r={}){let o=e,i=t;if(!Number.isFinite(o)||!Number.isFinite(i))return[0,1];if(r.zero!==!1&&(o>0&&(o=0),i<0&&(i=0)),o===i)return o===0?[0,1]:o>0?[0,o*1.2]:[o*1.2,0];let a=i-o,s=r.pad??.07,l=on(a,n),c=[o,i];for(let m=0;m<4;m++){let u=Math.ceil(i/l-1e-9)*l,h=Math.floor(o/l+1e-9)*l;c=[o===0?0:o-h<=l*.3?h:o-a*s,i===0?0:u-i<=l*.3?u:i+a*s];let d=on(c[1]-c[0],n);if(d===l)break;l=d}return c}function Ar(e,t,n=4){let r=Math.min(e,t),o=Math.max(e,t),i=on(o-r,n),a=[],s=Math.ceil(r/i-1e-9)*i;for(let l=s,c=0;l<=o+i*1e-9&&c<200;l+=i,c++)a.push(Number((Math.round(l/i)*i).toPrecision(12)));return a}function an(e,t){let[n,r]=e,[o,i]=t,a=r===n?0:(i-o)/(r-n),s=(l=>o+(l-n)*a);return s.domain=e,s.range=t,s.invert=l=>a===0?n:n+(l-o)/a,s.ticks=(l=4)=>Ar(n,r,l),s}function sn(e,t,n=4){if(!(e>0)||!(t>0)||!Number.isFinite(e)||!Number.isFinite(t))return[1,10];let r=Math.log10(e),o=Math.log10(t);if(r===o)return[10**(r-.5),10**(r+.5)];let[i,a]=We(r,o,Math.max(n,Math.ceil(o-r)),{zero:!1});return[10**i,10**a]}function za(e,t,n){let r=Math.log10(e),o=Math.log10(t),i=n/Math.max(1e-9,o-r),a=(c,m=1)=>{let u=[];for(let h=Math.floor(r);h<=Math.ceil(o);h++)if(!(h%m))for(let d of c){let f=Number((d*10**h).toPrecision(12));f>=e*(1-1e-9)&&f<=t*(1+1e-9)&&u.push(f)}return u},s=i>=110?a([1,2,5]):a([1],Math.max(1,Math.ceil(24/i)));if(s.length>=2)return s;let l=a([1,2,3,4,5,6,7,8,9]);return l.length>=2?l:Ar(e,t,3)}function Fr(e,t){let n=an([Math.log10(e[0]),Math.log10(e[1])],t),r=(o=>o>0?n(Math.log10(o)):Number.NaN);return r.domain=e,r.range=t,r.invert=o=>10**n.invert(o),r.ticks=()=>za(e[0],e[1],Math.abs(t[1]-t[0])),r}function Ze(e){let t=1/0,n=-1/0;for(let r of e)Number.isFinite(r)&&(r<t&&(t=r),r>n&&(n=r));return t===1/0?[0,1]:[t,n]}var Ha=864e5;function Nr(e,t,n,r=oe){let o=t-e;if(!(o>0))return[{t:e,label:qe(e,{locale:r,month:"short",day:"numeric"})}];let i=o/Ha,a=[],s=new Date(e),l=new Date(e).getFullYear()===new Date(t).getFullYear(),c=(m,u,h,d=!1)=>{let f=new Date(m),p=-1,w=0;for(;f.getTime()<=t&&w++<500;){if(f.getTime()>=e){let x=f.getFullYear(),k=d&&!l&&x!==p;a.push({t:f.getTime(),label:qe(f,{locale:r,...h,...k?{year:"numeric"}:{}})}),p=x}u(f)}};if(i<=1.5){let m=Math.max(1,Math.ceil(o/36e5/Math.max(1,n))),u=[1,2,3,4,6,12].find(d=>d>=m)??12,h=new Date(s);h.setMinutes(0,0,0),c(h,d=>d.setHours(d.getHours()+u),{hour:"numeric"})}else if(i<=n*1.2){let m=new Date(s.getFullYear(),s.getMonth(),s.getDate());c(m,u=>u.setDate(u.getDate()+1),{month:"numeric",day:"numeric"})}else if(i<=n*7*1.2){let m=new Date(s.getFullYear(),s.getMonth(),s.getDate());m.setDate(m.getDate()+(8-m.getDay())%7),c(m,u=>u.setDate(u.getDate()+7),{month:"numeric",day:"numeric"})}else{let m=i/30.44,u=Math.max(1,Math.ceil(m/Math.max(1,n))),h=[1,2,3,6,12,24,60].find(d=>d>=u)??120;if(h>=12){let d=new Date(s.getFullYear()+(s.getMonth()>0||s.getDate()>1?1:0),0,1);c(d,f=>f.setFullYear(f.getFullYear()+h/12),{year:"numeric"})}else{let d=new Date(s.getFullYear(),s.getMonth()+(s.getDate()>1?1:0),1),f=d.getMonth()%h;f&&d.setMonth(d.getMonth()+(h-f)),c(d,p=>p.setMonth(p.getMonth()+h),{month:"short"},!0)}}return a}function Rr(e,t){let n=new Array(e),r=new Uint8Array(e),o=i=>{if(typeof i!="string"||i.length===0||i.length>9)return-1;let a=Number(i);return Number.isInteger(a)&&a>=0&&a<e&&String(a)===i?a:-1};return new Proxy(n,{get(i,a,s){let l=o(a);return l>=0?(r[l]||(i[l]=t(l),r[l]=1),i[l]):Reflect.get(i,a,s)},has(i,a){return o(a)>=0||Reflect.has(i,a)}})}var ja=(e,t,n)=>e==="date"?ht(t,n)?.getTime()??NaN:Ce(t);function Va(e){let t=e.filter(n=>n!=null&&n!=="");return t.length?t.every(n=>n instanceof Date)||t.every(n=>typeof n=="string"&&Zn(n.trim()))?"date":t.every(n=>typeof n=="number"||typeof n=="string"&&/^-?\d+(\.\d+)?$/.test(n.trim()))?"number":"band":"band"}function Qe(e,t,n,r,o={}){let i=ze(t,"x"),a=Array.isArray(n),s=a?n:null,l=a?null:ze(n,"y"),c=!a&&r!==void 0?ze(r,"series"):null,m=e.map((M,b)=>i(M,b)),u=o.xType??Va(m),h=o.locale??oe,d,f,p;if(u==="band"){let M=m.map(T=>String(T??""));d=je(M);let b=new Map(d.map((T,L)=>[T,L]));f=d.map((T,L)=>L),p=Int32Array.from(M,T=>b.get(T)??-1)}else{let M=u==="date"?o.dayFirst??Qn(m):void 0,b=m.map(B=>ja(u,B,M)),T=Array.from(new Set(b.filter(B=>Number.isFinite(B)))).sort((B,ae)=>B-ae),L=new Map(T.map((B,ae)=>[B,ae]));f=T,d=T.map(String),p=Int32Array.from(b,B=>L.get(B)??-1)}let w=o.dateFormat,x=M=>typeof M=="string"?ft(M.trim())?.[3]:void 0,k=u==="date"&&m.length<5e3?x(m[0]):void 0,v=(k===2||k===3)&&m.every(M=>x(M)===k),C=v&&k===3;if(u==="date"&&!w){let M=f.length>1?f[f.length-1]-f[0]:0;w=v&&k===2||M>864e5*120?{month:"short"}:M<864e5*2?{month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit"}:{month:"numeric",day:"numeric"},M>864e5*800&&(w={year:"numeric",month:"short"})}let g;if(u==="band")g=d;else if(C&&!o.dateFormat){let M=W(h)==="ko";g=f.map(b=>{let T=new Date(b),L=Math.floor(T.getMonth()/3)+1;return M?`${T.getFullYear()}년 ${L}분기`:`Q${L} ${T.getFullYear()}`})}else{let M=f.every(Gt),b=u==="date"?new Intl.DateTimeFormat(h,w):new Intl.NumberFormat(h,M?{useGrouping:!1}:{maximumFractionDigits:6});g=f.length>1e3?Rr(f.length,T=>b.format(f[T])):f.map(T=>b.format(T))}let N=s?[...s]:c?je(e.map((M,b)=>String(c(M,b)??""))):[""],D=new Map(N.map((M,b)=>[M,b])),F=N.map(()=>new Array(d.length).fill(NaN)),I=N.map(()=>new Array(d.length).fill(null)),E=o.aggregate??"sum",R=E==="mean"?N.map(()=>new Uint32Array(d.length)):null,A=(M,b,T,L)=>{let B=F[M][b];E==="last"?F[M][b]=T:E==="count"?F[M][b]=(Number.isFinite(B)?B:0)+1:E==="mean"?Number.isFinite(T)&&(F[M][b]=(Number.isFinite(B)?B:0)+T,R[M][b]++):F[M][b]=Number.isFinite(B)?B+(Number.isFinite(T)?T:0):T,I[M][b]=L};for(let M=0;M<e.length;M++){let b=p[M];if(b<0)continue;let T=e[M];if(s)for(let L=0;L<s.length;L++)A(L,b,Ce(T[s[L]]),T);else{let L=c?D.get(String(c(T,M)??""))??0:0;A(L,b,Ce(l(T,M)),T)}}if(R)for(let M=0;M<F.length;M++)for(let b=0;b<d.length;b++)R[M][b]>1&&(F[M][b]/=R[M][b]);return{type:u,keys:d,xnum:f,labels:g,series:N,values:F,rows:I}}var Wa=140,tt=12,Pr=14,ln=20,Dr=12.5;function Ga(e,t,n=mr){let r=Se(t,t),o=new Map;e.forEach((a,s)=>{let l=r(a,s),c=o.get(l);c?c.push(a):o.set(l,[a])});let i=[...o.keys()].slice(0,n);return{values:i,groups:i.map(a=>o.get(a)),dropped:Math.max(0,o.size-n)}}function Ka(e,t,n){if(t<1)return 1;let r=Math.max(1,Math.floor((e+tt)/(Wa+tt))),o=Math.max(1,Math.min(r,Number.isInteger(n)&&n>=1?n:r,t));return Math.ceil(t/Math.ceil(t/o))}function Ua(e,t,n){let r=Math.max(40,Math.floor((e-(t-1)*tt)/t));return{pw:r,ph:typeof n=="number"&&Number.isFinite(n)&&n>0?n:Math.max(120,Math.min(180,Math.round(r*.62)))}}var et=e=>e.filter(Number.isFinite);function Ct(e,t){let n=[];for(let r of Array.isArray(t)?t:t===void 0?[]:[t]){let o=He(r,String(r));e.forEach((i,a)=>n.push(o(i,a)))}return et(n)}function Lr(e,t,n,r,o,i){return Qe(t,n.x,r,o,{xType:e==="bar"?"band":n.xType,aggregate:i,dayFirst:n.dayFirst})}function Xa(e,t,n,r,o,i){let a=Math.max(2,Math.round(i/70)),s=r.yScale==="log"&&(e==="line"||e==="scatter"),l=r.yDomain,c=l&&(!s||l[0]>0&&l[1]>0)?l:void 0;if(e==="scatter"){let g=t.flat(),N=r.refLines??{},[D,F]=Ze([...Ct(g,r.x??"x"),...et([Number(N.x)])]),[I,E]=Ze([...Ct(g,r.y??"y"),...et([Number(N.y)])].filter(A=>!s||A>0)),R=r.zero??!1;return{y:c??(s?sn(I,E,a):We(I,E,a,{zero:R,pad:.08})),x:r.xDomain??We(D,F,Math.max(2,Math.round(o/110)),{zero:R,pad:.06}),sameKeys:!0}}let m=e==="bar",u=m&&r.orientation==="horizontal",h=n[0]?.keys.join(""),d=n.every(g=>g.keys.join("")===h),f=n.length>0&&n.every(g=>g.type!=="band"&&g.type===n[0].type),p=r.xDomain??(!m&&f?Ze(n.flatMap(g=>et(g.xnum))):void 0),w=m?r.layout??"grouped":e==="area"?r.stack??"auto":"none";if(w==="percent")return{x:p,sameKeys:d};if(c)return{y:c,x:p,sameKeys:d};let x=[];t.forEach((g,N)=>{let D=n[N];if(w==="stacked"||w==="auto"&&D.series.length>1){let I=en(D.values,"zero");I.y0.forEach(E=>x.push(...E)),I.y1.forEach(E=>x.push(...E))}else D.values.forEach(I=>x.push(...I));m&&!u&&r.line!==void 0&&Lr(e,g,r,[].concat(r.line),void 0,r.series===void 0?r.aggregate:"mean").values.forEach(I=>x.push(...I)),m||x.push(...Ct(g,r.lower),...Ct(g,r.upper))}),m&&x.push(0),u||x.push(...Cr(r.annotations));for(let g of r.referenceLines??[])x.push(g.y);r.signColors&&x.push(Number(r.baseline??0));let[k,v]=Ze(et(x).filter(g=>!s||g>0));return{y:s?sn(k,v,a):m?We(k,v,u?Math.max(2,Math.round(o/120)):a):We(k,v,a,{zero:r.zero??e==="area"}),x:p,sameKeys:d}}function Ya(e,t,n,r,o,i,a,s){if(e!=="line"&&e!=="area"||!o.x||!o.y)return;let l=Qe(t.flat(),r.x,r.y,void 0,{xType:r.xType,locale:s,dayFirst:r.dayFirst}),c=(r.yScale==="log"&&e==="line"?Fr:an)(o.y,[a-22,10]).ticks(Math.max(2,Math.round(a/70))),m=Tr(c,Xn(r.format,s,Math.max(Math.abs(o.y[0]),Math.abs(o.y[1]))),s),u=n.flatMap(g=>g.series),h=r.endLabels??n.some(g=>g.series.length>1),d=m+6,f=i-(h?Math.min(i*.28,Math.max(...u.map(g=>ge(g,11,700)),20)+14):10),p=l.keys.length,[w,x]=o.x[1]===o.x[0]?[o.x[0],o.x[0]+1]:o.x,k=l.type==="number"?p>12:p>Nr(w,x,Math.max(2,Math.floor((f-d)/64)),s).length;if(l.type==="band"||!p||k)return;let v=g=>d+(l.xnum[g]-w)/(x-w)*(f-d),C=g=>ge(l.labels[g],rn);for(let g=1;;g++){let N=Array.from({length:Math.ceil(p/g)},(D,F)=>F*g);if(g>=p||N.every((D,F)=>!F||v(D)-v(N[F-1])>=(C(D)+C(N[F-1]))/2+8))return N.map(D=>({value:l.xnum[D],label:l.labels[D]}))}}function qa(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(16).padStart(8,"0")}function Ja(e,t,n,r){let o=[n.x,n.y,n.series].map(i=>JSON.stringify(i??null)).join("|");return`ztd-facet-${qa(`${e}|${t}|${o}|${vt(r)}`)}`}function Za(e,t){return typeof e=="string"?t.includes(e):Array.isArray(e)&&e.length>0&&e.every(n=>typeof n=="string"&&t.includes(n))}var Qa={en:{intro:(e,t)=>`${Ee(e,"panel")} by ${t}.`,endHigh:(e,t)=>` ${e} ends highest at ${t}.`,falling:e=>` Lower at the end than at the start: ${e}.`,noneFalling:" None is lower at the end than at the start.",total:(e,t)=>` ${e} has the largest total at ${t}.`,points:(e,t)=>` ${e} has the most points (${t}).`,dropped:(e,t)=>` Only the first ${e} of ${t} values are shown.`,more:", …",blank:"(blank)"},ko:{intro:(e,t)=>`${t}별 패널 ${e}개.`,endHigh:(e,t)=>` 마지막 값이 가장 큰 곳: ${e}(${t}).`,falling:e=>` 처음보다 끝이 낮은 곳: ${e}.`,noneFalling:" 처음보다 끝이 낮은 곳은 없어요.",total:(e,t)=>` 합계가 가장 큰 곳: ${e}(${t}).`,points:(e,t)=>` 점이 가장 많은 곳: ${e}(${t}개).`,dropped:(e,t)=>` ${t}개 중 앞의 ${e}개만 보여요.`,more:" 등",blank:"(빈 값)"}};function Er(e){let{type:t,chartProps:n}=e,{values:r,groups:o,dropped:i}=Ga(e.data,e.by),a=r.length,s=typeof e.width=="number"&&Number.isFinite(e.width)&&e.width>0?e.width:480,l=Ka(s,a,e.columns),{pw:c,ph:m}=Ua(s,l,e.height),u=e.scale!=="free",h=t==="scatter"?[]:o.map(R=>Lr(t,R,n,n.y,n.series,n.aggregate)),d=u?Xa(t,o,h,n,c,m):{sameKeys:!1},f=u?Ya(t,o,h,n,d,c,m,e.locale):void 0,p=t==="bar"&&n.orientation==="horizontal",w=u&&(!p||d.sameKeys),x=u&&(p||d.x!==void 0||d.sameKeys),k=new Set(Za(e.highlight,r)?[e.highlight].flat():[]),v=k.size>0,C=t==="bar"&&!Array.isArray(n.y)&&n.series===void 0||t==="scatter"&&n.series===void 0,g=e.syncId??Ja(t,e.by,n,e.data),N=dt(Re(n.format,e.locale),n.unit),D=Qa[e.lang],F=[],I=r.map(R=>R===""?D.blank:R);return{panels:r.map((R,A)=>{let M=o[A],b=I[A],T=A%l,L;if(t!=="scatter"){let ae=h[A],pe=ue=>ae.values.reduce((be,at)=>be+(Number.isFinite(at[ue])?at[ue]:0),0),j=ae.keys.map((ue,be)=>be).filter(ue=>ae.values.some(be=>Number.isFinite(be[ue]))),ie=j[j.length-1];F.push({first:j.length?pe(j[0]):NaN,last:j.length?pe(ie):NaN,total:j.reduce((ue,be)=>ue+pe(be),0)}),t!=="bar"&&ae.series.length===1&&ie!==void 0&&(L=N(ae.values[0][ie]))}else F.push({first:NaN,last:NaN,total:M.length});let B={data:M,width:c,height:m,ariaLabel:e.title?`${e.title}, ${b}`:b,syncId:g,highlight:v?k.has(R)?C?()=>!0:void 0:"none":e.highlight,showYAxis:!w||T===0,showXAxis:!x||A+l>=a};return d.y&&(B.yDomain=d.y),d.x&&(B.xDomain=d.x),f&&(B.xTicks=f),{value:R,label:b,props:B,last:L,isPicked:k.has(R)}}),cols:l,pw:c,ph:m,isPanelPick:v,description:ei(t,e.by,I,F,i,N,D)}}function ei(e,t,n,r,o,i,a){let s=a.intro(n.length,t),l=c=>kr(r.map(m=>m[c]));if(e==="line"||e==="area"){let c=l("last");c>=0&&(s+=a.endHigh(n[c],i(r[c].last)));let m=n.filter((u,h)=>r[h].last<r[h].first);s+=m.length?a.falling(`${m.slice(0,5).join(", ")}${m.length>5?a.more:""}`):a.noneFalling}else{let c=l("total");c>=0&&(s+=e==="bar"?a.total(n[c],i(r[c].total)):a.points(n[c],r[c].total))}return o&&(s+=a.dropped(n.length,n.length+o)),s}var le=P(X(),1);function ti(e){return[...new Set([0,.01,.02,.05,.1,.15,.2,e].filter(t=>t<=e))].sort((t,n)=>t-n)}function ni(e,t){let n=e.rootBounds?.height??window.innerHeight;return e.isIntersecting&&(e.intersectionRatio>=t||e.intersectionRect.height>=n*.5)}function Or(e,t=!0){let[n,r]=(0,le.useState)({visible:!t,near:!t});return(0,le.useEffect)(()=>{if(!t){r({visible:!0,near:!0});return}if(!e)return;if(typeof IntersectionObserver>"u"){r({visible:!0,near:!0});return}let o=new IntersectionObserver(a=>{let s=ni(a[a.length-1],.25);r(l=>l.visible===s?l:{...l,visible:s,near:l.near||s})},{threshold:ti(.25),rootMargin:"0px 0px -8% 0px"}),i=new IntersectionObserver(a=>{let s=a[a.length-1];r(l=>l.near===s.isIntersecting?l:{...l,near:s.isIntersecting})},{threshold:0,rootMargin:"240px 0px 240px 0px"});return o.observe(e),i.observe(e),()=>{o.disconnect(),i.disconnect()}},[e,t]),n}function _r(e){let t=e.getBoundingClientRect().width;return t>0?Math.round(t*10)/10:0}function Mt(e){let[t,n]=(0,le.useState)(null),[r,o]=(0,le.useState)(e??null),i=(0,le.useCallback)(a=>{n(a),a&&e===void 0&&o(_r(a))},[e]);return ye(()=>{if(e!==void 0){o(e);return}if(!t)return;let a=c=>o(m=>m!==null&&Math.abs(m-c)<.5?m:c),s=()=>a(_r(t));if(typeof ResizeObserver>"u")return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s);let l=new ResizeObserver(c=>{let m=c[c.length-1]?.contentRect;m?a(m.width>0?Math.round(m.width*10)/10:0):s()});return l.observe(t),()=>l.disconnect()},[t,e]),[t,i,r]}var ri=()=>()=>{};function Ge(){return(0,le.useSyncExternalStore)(ri,()=>!0,()=>!1)}var Ir="(prefers-reduced-motion: reduce)";function Tt(e="auto"){let[t,n]=(0,le.useState)(()=>me&&typeof window.matchMedia=="function"?window.matchMedia(Ir).matches:!1);return(0,le.useEffect)(()=>{if(e!=="auto"||!me||typeof window.matchMedia!="function")return;let r=window.matchMedia(Ir),o=()=>n(r.matches);return o(),r.addEventListener?.("change",o),()=>r.removeEventListener?.("change",o)},[e]),e===!0?!0:e===!1?!1:t}var we=P(O(),1),oi=60,ai=420;function Br(e){let t=fe(),n=e.chartProps??{},[,r,o]=Mt(e.width),i=e.width??(o||480),a=ne(e.locale??n.locale),s=W(a),l=(0,Ke.useContext)(Le),c=e.title??l,m=(0,Ke.useMemo)(()=>Er({type:e.type,data:e.data,by:e.by,columns:e.columns,scale:e.scale,chartProps:n,highlight:e.highlight,syncId:e.syncId,width:i,height:e.height,title:c,locale:a,lang:s}),[e.type,e.data,e.by,e.columns,e.scale,JSON.stringify(n,(w,x)=>typeof x=="function"?String(x):x),e.highlight,e.syncId,i,e.height,c,a,s]),u=`${(0,Ke.useId)().replace(/:/g,"")}fd`,h=Tt(n.reducedMotion??"auto"),d=Ge(),f=Rn({motion:{enabled:n.animate!==!1&&!h&&me},hydrated:d},{waiting:!1,generation:0}),p=e.chart;return(0,we.jsxs)("div",{ref:r,role:"group","aria-label":c,"aria-describedby":u,className:e.className,style:{position:"relative",width:"100%",...e.style},children:[(0,we.jsx)("p",{id:u,style:kt,children:e.description??m.description}),(0,we.jsx)("div",{style:{display:"grid",gridTemplateColumns:`repeat(${m.cols}, minmax(0, 1fr))`,columnGap:tt,rowGap:Pr},children:m.panels.map((w,x)=>{let k=t.paint(w.isPicked?"accentText":m.isPanelPick?"muted":"ink");return(0,we.jsxs)("div",{"data-facet":w.value,style:{minWidth:0,...Nn(f,!1,"fade",x*oi,ai)},children:[(0,we.jsxs)("div",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,height:ln,fontSize:Dr,fontWeight:700,lineHeight:`${ln}px`,color:k},children:[(0,we.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:w.label}),w.last!==void 0?(0,we.jsx)("span",{style:{flex:"none",fontVariantNumeric:"tabular-nums"},children:w.last}):null]}),(0,we.jsx)(p,{...n,...w.props})]},w.value)})})]})}function ve(e,t,n,r,o="max"){let i=new Set,a=n.length,s=c=>{if(a&&c!=="none"){if(c==="first")i.add(0);else if(c==="last")i.add(a-1);else if(c==="max"||c==="min"){let m=-1,u=c==="max"?-1/0:1/0;r.forEach((h,d)=>{Number.isFinite(h)&&(c==="max"?h>u:h<u)&&(u=h,m=d)}),m>=0&&i.add(m)}}};if(e==null)return s(o),i;if(typeof e=="function")return t.forEach((c,m)=>{m<a&&c!==null&&c!==void 0&&e(c,m)&&i.add(m)}),i;let l=Array.isArray(e)?e:[e];for(let c of l)typeof c=="number"?c>=0&&c<a&&i.add(c):c==="max"||c==="min"||c==="first"||c==="last"||c==="none"?s(c):n.forEach((m,u)=>{m===c&&i.add(u)});return i}var ce=P(X(),1);async function ii(e,t="auto",n="",r){let o=e.headers.get("content-type")??"",i=await e.text();if(t==="text")return i;if(o.includes("text/html")||/^\s*<(!doctype html|html[\s>])/i.test(i))throw new Error(W(r)==="ko"?`데이터 대신 HTML 페이지를 받았어요. 주소를 확인해 주세요${n?`: ${n}`:"."}`:`Got an HTML page instead of data${n?` (${n})`:""}. Check the URL.`);if(t==="csv")return De(i);if(t==="json"||o.includes("json"))return JSON.parse(i);if(o.includes("csv")||/[./]csv(\?|#|$)|output=csv|format=csv|tqx=out:csv/i.test(n))return De(i);let a=i.trim();return a.startsWith("{")||a.startsWith("[")?JSON.parse(a):De(i)}async function si(e,t={}){let n=t.signal??new AbortController().signal,r;if(typeof e=="function")r=await e(n);else{let o=e instanceof Request?e.url:String(e),i=await fetch(e instanceof Request?e.clone():o,{...t.init,signal:n});if(!i.ok)throw new Error(`HTTP ${i.status}${i.statusText?` ${i.statusText}`:""}`);r=await ii(i,t.parse,o,t.locale)}return t.select&&(r=br(r,t.select)),t.transform?t.transform(r):Ae(r)}function zr(e,t={}){let{refreshMs:n,enabled:r=!0,keepPrevious:o=!0}=t,[i,a]=(0,ce.useState)(()=>({data:[],status:e&&r?"loading":"idle",error:null,updatedAt:null})),[s,l]=(0,ce.useState)(0),c=ne(t.locale),m=(0,ce.useRef)(t);m.current={...t,locale:c};let u=(0,ce.useRef)(e);u.current=e;let h=typeof e=="function"?"fn":e instanceof Request?e.url:e?String(e):"",d=t.deps??[],f=JSON.stringify(d.map(x=>typeof x=="object"?JSON.stringify(x):String(x))),p=(0,ce.useRef)(!1);(0,ce.useEffect)(()=>{let x=u.current;if(!x||!r){a(C=>C.status==="loading"?{...C,status:"idle"}:C);return}let k=new AbortController,v=!0;return p.current=!0,a(C=>({...C,data:o?C.data:[],status:"loading",error:null})),si(x,{...m.current,signal:k.signal}).then(C=>{v&&a({data:C,status:"success",error:null,updatedAt:Date.now()})}).catch(C=>{!v||k.signal.aborted||a(g=>({...g,status:"error",error:C instanceof Error?C:new Error(String(C))}))}).finally(()=>{v&&(p.current=!1)}),()=>{v=!1,p.current=!1,k.abort()}},[h,r,s,f,o]),(0,ce.useEffect)(()=>{if(!n||!r)return;let x=setInterval(()=>{p.current||l(k=>k+1)},n);return()=>clearInterval(x)},[n,r]);let w=(0,ce.useCallback)(()=>l(x=>x+1),[]);return{data:i.data,status:i.status,loading:i.status==="loading",error:i.error,empty:i.status==="success"&&i.data.length===0,updatedAt:i.updatedAt,reload:w}}var un=P(O(),1),li=["csv","svg","png"],ci=/^[=+\-@\t\r\n=+-@]/,ui=/var\(|color-mix\(/;function Hr(e){if(typeof e=="number")return Number.isFinite(e)?String(e):"";if(e==null||e instanceof Date&&Number.isNaN(e.getTime()))return"";let t=e instanceof Date?Yn(e.getTime()):String(e);return`"${(ci.test(t)&&!Number.isFinite(Ce(t))?`'${t}`:t).replace(/"/g,'""')}"`}function mi(e){return[...new Set(e.slice(0,200).flatMap(t=>t&&typeof t=="object"?Object.keys(t):[]))]}function di(e,t){return`\uFEFF${[t.map(Hr),...e.map(r=>t.map(o=>Hr(r[o])))].map(r=>r.join(",")).join(`\r
|
|
26
|
+
`)}\r
|
|
27
|
+
`}function fi(e){return Array.from((e??"").replace(/[\\/:*?"<>|\r\n\t]+/g,"-").trim()).slice(0,80).join("")||"chart"}function cn(e,t){let n=document.createElement("a");n.href=URL.createObjectURL(e),n.download=t,n.click(),setTimeout(()=>URL.revokeObjectURL(n.href),1e4)}var jr=2,Fe=16;function Vr(e,t){if(!/^(ok)?l(ab|ch)\(|^color\(/.test(e))return e;let n=t.get(e);if(n)return n;let r=document.createElement("canvas").getContext("2d");if(!r)return e;r.fillStyle=e,r.fillRect(0,0,1,1);let[o,i,a,s]=r.getImageData(0,0,1,1).data;return n=s===255?`rgb(${o}, ${i}, ${a})`:`rgba(${o}, ${i}, ${a}, ${Math.round(s/255*1e3)/1e3})`,t.set(e,n),n}function Wr(e,t){let n=document.createElementNS("http://www.w3.org/2000/svg",e);for(let[r,o]of Object.entries(t))n.setAttribute(r,String(o));return n}function Gr(e,t,n){let r=e.closest(".ztd-card"),o=r?.querySelector("svg.ztd-svg");if(!r||!o)return null;let{width:i,height:a}=o.viewBox.baseVal,[s,l]=[i+Fe*2,a+Fe*2],c=o.cloneNode(!0),m=c.querySelectorAll("*"),u=new Map;o.querySelectorAll("*").forEach((f,p)=>{let w;for(let x of Array.from(f.attributes)){if(!ui.test(x.value))continue;let k=(w??(w=getComputedStyle(f))).getPropertyValue(x.name);k&&m[p].setAttribute(x.name,Vr(k,u))}}),c.removeAttribute("style");for(let[f,p]of Object.entries({viewBox:`${-Fe} ${-Fe} ${s} ${l}`,width:s*t,height:l*t,"font-family":getComputedStyle(o).fontFamily}))c.setAttribute(f,String(p));let h=Vr(getComputedStyle(r).backgroundColor,u),d=o.parentElement?.querySelector("canvas")??null;if(n){let f=c.querySelector("desc")?.nextSibling??c.firstChild;c.insertBefore(Wr("rect",{x:-Fe,y:-Fe,width:s,height:l,fill:h}),f),d&&c.insertBefore(Wr("image",{href:d.toDataURL(),width:i,height:a}),f)}return{svg:new XMLSerializer().serializeToString(c),w:s,h:l,vw:i,vh:a,bg:h,canvas:d}}function hi(e,t){let n=Gr(e,jr,!1);if(!n)return;let r=jr,o=document.createElement("canvas");o.width=Math.ceil(n.w*r),o.height=Math.ceil(n.h*r);let i=o.getContext("2d");if(!i)return;i.fillStyle=n.bg,i.fillRect(0,0,o.width,o.height),n.canvas&&i.drawImage(n.canvas,Fe*r,Fe*r,n.vw*r,n.vh*r);let a=URL.createObjectURL(new Blob([n.svg],{type:"image/svg+xml"})),s=new Image;s.onload=()=>{i.drawImage(s,0,0,o.width,o.height),URL.revokeObjectURL(a),o.toBlob(l=>l&&cn(l,`${t}.png`),"image/png")},s.onerror=()=>URL.revokeObjectURL(a),s.src=a}function Kr(e){let t=fe(e.theme),n=W(ne(e.locale))==="ko",r=fi(e.filename),o=(i,a)=>{if(i==="csv")return cn(new Blob([di(e.data,e.columns?.length?e.columns:mi(e.data))],{type:"text/csv;charset=utf-8"}),`${r}.csv`);if(i==="png")return hi(a,r);let s=Gr(a,1,!0);s&&cn(new Blob([s.svg],{type:"image/svg+xml"}),`${r}.svg`)};return(0,un.jsx)("span",{style:{display:"inline-flex",gap:6,flex:"none"},children:li.filter(i=>!e.formats||e.formats.includes(i)).map(i=>{let a=i.toUpperCase(),s=n?`${a} 내려받기`:`Download ${a}`;return(0,un.jsx)("button",{type:"button",className:"ztd-btn","aria-label":s,title:s,onClick:l=>o(i,l.currentTarget),style:{background:"transparent",color:t.paint("muted"),border:`1px solid ${t.paint("line2")}`,borderRadius:14,height:28,padding:"0 10px",fontSize:12,fontWeight:700,flex:"none"},children:a},i)})})}var Xr=P(O(),1);function Ur(e,t=oe){let n=Re(void 0,t),r=e.split(`
|
|
28
|
+
`),o=(i,a)=>{if(a==="label")return i.label;if(a==="value")return i.formatted??(i.value===null?null:n(i.value));if(a==="series")return i.series??null;let s=i.datum&&typeof i.datum=="object"?i.datum[a]:void 0;return s==null||s===""||typeof s=="number"&&!Number.isFinite(s)?null:typeof s=="number"?n(s):s instanceof Date?qe(s,{locale:t,year:"numeric",month:"short",day:"numeric"}):String(s)};return i=>{let a=[];for(let s of r){let l=!1,c=s.replace(Jn,(m,u)=>o(i,u.trim())??(l=!0,""));l||a.push(c)}return a.length?a.map((s,l)=>(0,Xr.jsx)("div",{children:s},l)):null}}function Yr(e){if(Array.isArray(e))return e;if(e&&typeof e=="object"){let t=e;if(Array.isArray(t.values))return t.values;if(typeof t.csv=="string")return De(t.csv)}return null}var no=P(X(),1);var Y=P(X(),1);function qr(e,t){let n=fe(e.theme),[r,o,i]=Mt(e.width),a=Ge(),s=e.width??(i||t.ssrWidth||480),l=typeof t.height=="function"?t.height(s):t.height,c=e.height??l,m=Tt(e.reducedMotion??"auto"),u=e.animate!==!1&&!m&&me,h=Or(r,e.animateOnView!==!1&&u),d=ne(e.locale),f=W(d),p=(0,Y.useMemo)(()=>Re(e.format,d,t.format),[e.format,d,t.format]),w=(0,Y.useCallback)(j=>mt(j,{locale:d}),[d]),x=(0,Y.useMemo)(()=>dt(p,e.unit),[p,e.unit]),k=(0,Y.useMemo)(()=>vt(e.data),[e.data]),[v,C]=(0,Y.useState)(null),[g,N]=(0,Y.useState)(null),D=(0,Y.useRef)([]),F=(0,Y.useRef)(e.onHover);F.current=e.onHover;let I=(0,Y.useRef)(e.onClick);I.current=e.onClick;let E=(0,Y.useRef)(null),R=(0,Y.useRef)(null),A=(0,Y.useRef)(null),M=(0,Y.useCallback)((j,ie="pointer")=>{if(A.current!==j){A.current=j;let ue=j===null?null:D.current[j]??null;queueMicrotask(()=>F.current?.(ue)),R.current?.(j)}E.current=j===null?null:ie,C(j),N(E.current)},[]),b=(0,Y.useCallback)(j=>{E.current!=="keyboard"&&(E.current=j===null?null:"sync",C(j),N(E.current))},[]),T=(0,Y.useCallback)(j=>{let ie=D.current[j];ie&&I.current?.(ie)},[]),L=rr(e.replayKey),B=e.width!==void 0||(i??0)>0,ae={enabled:u,active:h.visible&&B,near:h.near,replayKey:L,dataKey:k,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},pe=(0,Y.useCallback)((j,ie=1)=>v===null||v===j?ie:ie*.38,[v]);return{p:n,width:s,height:c,measured:B,responsive:e.width===void 0,pending:me&&a&&e.width===void 0&&i===null,node:r,hydrated:a,ref:o,motion:ae,fv:x,fmt:p,pct:w,locale:d,lang:f,t:f==="ko"?Dn:Pn,active:v,via:g,setActive:M,click:T,events:D,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:pe,sig:k,description:e.description,reduced:m,publish:R,applySync:b}}var U=P(X(),1);function gi(e){return 1-Math.pow(1-e,3)}function pi(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function bi(e){return e==="easeInOut"?pi:e==="linear"?t=>t:gi}function yi(e,t){return e==="linear"?1:e==="easeInOut"?t<.5?12*t*t:3*Math.pow(-2*t+2,2):3*Math.pow(1-t,2)}function Ue(e,t){if(e.length===t)return e.slice();if(!e.length)return new Array(t).fill(0);if(e.length===1||t===1)return new Array(t).fill(e[0]);let n=new Array(t);for(let r=0;r<t;r++){let o=r/(t-1)*(e.length-1),i=Math.floor(o),a=Math.min(e.length-1,i+1);n[r]=e[i]+(e[a]-e[i])*(o-i)}return n}function St(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],o=t[n];if(Number.isNaN(r)!==Number.isNaN(o)||Math.abs(r-o)>1e-6)return!1}return!0}function Jr(e,t,n){for(let r=0;r<n.length;r++)(!Number.isFinite(e[r])||!Number.isFinite(n[r]))&&(e[r]=n[r],t[r]=0)}function Zr(e,t,n,r){if(!t||!n||t.length!==n.length)return Ue(e,r);let o=[],i=0;for(let a=0;a<n.length;a++){let s=e.slice(i,i+t[a]);i+=t[a];for(let l of Ue(s,n[a]))o.push(l)}return o.length===r?o:Ue(e,r)}var At=class{constructor(){this.tracks=new Map;this.seq=0;this.easing="spring";this.duration=900;this.omega=8.2;this.animating=!1;this.entranceStart=-1;this.maxDelay=0}configure(t,n){this.easing=t,this.duration=Math.max(1,n),this.omega=7.4/(this.duration/1e3)}sameTargets(t){let n=0;for(let r of this.tracks.values())r.exiting||n++;if(n!==t.length)return!1;for(let r of t){let o=this.tracks.get(r.key);if(!o||o.exiting||!St(o.to,r.to))return!1}return!0}refreshData(t){for(let n of t){let r=this.tracks.get(n.key);r&&(r.data=n.data)}}make(t,n,r,o){let i=t.from??t.to,a=t.enter??i;return{key:t.key,data:t.data,from:n.slice(),vel:new Array(t.to.length).fill(0),to:t.to.slice(),appear:i.slice(),enter:a.slice(),exit:(t.exit??a).slice(),delay:o,t0:r,cur:n.slice(),curVel:new Array(t.to.length).fill(0),done:!1,exiting:!1,order:this.seq++,progress:0,parts:t.parts}}snap(t){let n=new Map;for(let r of t){let o=this.tracks.get(r.key),i=this.make(r,r.to,0,0);o&&(i.order=o.order),i.done=!0,i.progress=1,n.set(r.key,i)}this.tracks=n,this.animating=!1,this.entranceStart=-1}hold(t){let n=new Map,r=0;for(let o of t){let i=this.tracks.get(o.key),a=this.make(o,o.from??o.to,1/0,o.delay??0);i&&(a.order=i.order),r=Math.max(r,o.delay??0),n.set(o.key,a)}this.maxDelay=r,this.tracks=n,this.animating=!1,this.entranceStart=-1}start(t){for(let n of this.tracks.values())n.t0=t+n.delay,n.from=n.appear.slice(),n.vel.fill(0),Jr(n.from,n.vel,n.to),n.cur=n.from.slice(),n.curVel=n.vel.slice(),n.done=St(n.from,n.to),n.done&&(n.progress=1);this.entranceStart=t,this.animating=!0}update(t,n,r=0){this.step(n);let o=new Set,i=0;for(let a of t){o.add(a.key);let s=this.tracks.get(a.key),l=r>0?Math.min(i*r,240):0;if(s){let c=a.to.length;s.from=Zr(s.cur,s.parts,a.parts,c),s.vel=Zr(s.curVel,s.parts,a.parts,c),s.parts=a.parts,s.to=a.to.slice(),Jr(s.from,s.vel,s.to),s.cur=s.from.slice(),s.curVel=s.vel.slice(),s.appear=(a.from??a.to).slice(),s.enter=(a.enter??s.appear).slice(),s.exit=(a.exit??s.enter).slice(),s.data=a.data,s.exiting=!1,s.t0=n+(s.t0>n?Math.max(0,s.t0-n):l),s.done=St(s.from,s.to)&&s.vel.every(m=>Math.abs(m)<1e-6),s.progress=s.done?1:0}else{let c=this.make(a,a.enter??a.from??a.to,n+l,0);c.done=St(c.from,c.to),this.tracks.set(a.key,c)}i++}for(let a of this.tracks.values())o.has(a.key)||a.exiting||(a.from=a.cur.slice(),a.vel=a.curVel.slice(),a.to=Ue(a.exit,a.cur.length),a.t0=n,a.exiting=!0,a.done=!1,a.progress=0);this.animating=!0}step(t){if(!this.animating)return!1;let n=!1,r=bi(this.easing),o=this.duration/1e3,i=this.omega,a=[];for(let s of this.tracks.values()){if(s.done)continue;let l=(t-s.t0)/1e3,c=s.to.length;if(s.from.length!==c&&(s.from=Ue(s.from,c)),s.vel.length!==c&&(s.vel=Ue(s.vel,c)),s.cur.length!==c&&(s.cur=new Array(c).fill(0),s.curVel=new Array(c).fill(0)),!(l>0)){for(let u=0;u<c;u++)s.cur[u]=s.from[u],s.curVel[u]=0;s.progress=0,n=!0;continue}let m;if(this.easing==="spring"){let u=Math.exp(-i*l),h=i*l>=8&&i*l<20,d=0;for(let f=0;f<c;f++){let p=s.from[f]-s.to[f],w=s.vel[f]+i*p;s.cur[f]=s.to[f]+(p+w*l)*u,s.curVel[f]=(s.vel[f]-i*w*l)*u,h&&d<.15&&(d=Math.max(d,Math.abs(s.cur[f]-s.to[f]),Math.abs(s.curVel[f]/i)))}m=i*l>=20||h&&d<.15,s.progress=Math.min(1,1-(1+i*l)*u)}else{let u=Math.min(1,l/o),h=r(u),d=yi(this.easing,u)/o;for(let f=0;f<c;f++)s.cur[f]=s.from[f]+(s.to[f]-s.from[f])*h,s.curVel[f]=(s.to[f]-s.from[f])*d;m=u>=1,s.progress=h}if(m){for(let u=0;u<c;u++)s.cur[u]=s.to[u],s.curVel[u]=0;s.done=!0,s.progress=1,s.exiting&&a.push(s.key)}else n=!0}for(let s of a)this.tracks.delete(s);return this.animating=n,n||(this.entranceStart=-1),n}elapsed(t){return this.entranceStart<0?1/0:t-this.entranceStart}get entranceLength(){return this.duration+this.maxDelay}get(t){return this.tracks.get(t)?.cur}items(){return[...this.tracks.values()].sort((t,n)=>t.order-n.order).map(t=>({key:t.key,v:t.cur,data:t.data,exiting:t.exiting,progress:t.progress}))}get size(){return this.tracks.size}},nt=new Set,Ft=0;function Qr(e){Ft=0;let t=Array.from(nt);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||nt.delete(n)}nt.size&&typeof requestAnimationFrame<"u"&&(Ft=requestAnimationFrame(Qr))}function eo(e){return nt.add(e),!Ft&&typeof requestAnimationFrame<"u"&&(Ft=requestAnimationFrame(Qr)),()=>{nt.delete(e)}}function xi(e){let t=new Map,n=!1;for(let r of e){let o=(t.get(r.key)??0)+1;t.set(r.key,o),o>1&&(n=!0)}return n?(t.clear(),e.map(r=>{let o=(t.get(r.key)??0)+1;return t.set(r.key,o),o>1?{...r,key:`${r.key}#${o}`}:r})):e}function to(e,t){let n=(0,U.useMemo)(()=>xi(e),[e]),{enabled:r,active:o,near:i=!0,replayKey:a,dataKey:s,easing:l="spring",duration:c=900,stagger:m=0}=t,u=(0,U.useRef)(null),h=(0,U.useRef)("init"),d=(0,U.useRef)(null),f=(0,U.useRef)(s),p=(0,U.useRef)(a),w=(0,U.useRef)(!1),x=(0,U.useRef)(0),[,k]=(0,U.useState)(0),v=(0,U.useRef)(null),C=(0,U.useRef)(!0);u.current||(u.current=new At,u.current.configure(l,c),u.current.snap(n),d.current=n);let g=u.current;if(g.configure(l,c),d.current!==n){let R=h.current,A=!Object.is(f.current,s);g.sameTargets(n)?g.refreshData(n):!r||R==="init"?g.snap(n):R==="idle"?g.hold(n):R==="running"||A?g.update(n,lt(),m):g.snap(n),d.current=n,f.current=s}let N=(0,U.useRef)(()=>!1);N.current=R=>{if(!C.current)return!1;let A=g.step(R);return!A&&h.current==="running"&&(h.current="done"),k(M=>(M+1)%1e9),A||(v.current=null),A};let D=(0,U.useCallback)(()=>{if(!me||v.current||!g.animating)return;let R=A=>N.current(A);v.current=eo(R)},[g]);ye(()=>{let R=!Object.is(p.current,a);if(p.current=a,!r){(h.current!=="done"||g.animating)&&(g.snap(d.current??n),h.current="done",k(A=>A+1));return}h.current==="init"||R&&i?(g.hold(d.current??n),h.current="idle",w.current=!1,k(A=>A+1)):R&&(w.current=!0)},[r,a]),ye(()=>{!r||!i||!w.current||(w.current=!1,g.hold(d.current??n),h.current="idle",k(R=>R+1))},[i,r]),(0,U.useEffect)(()=>{r&&o&&h.current==="idle"&&(g.start(lt()),x.current+=1,h.current="running",D(),k(R=>R+1))},[r,o,a,g,D]),(0,U.useEffect)(()=>{g.animating&&D()}),(0,U.useEffect)(()=>(C.current=!0,()=>{C.current=!1,v.current?.(),v.current=null}),[]);let F=lt(),I=g.elapsed(F),E=r&&h.current==="idle";return{items:g.items(),get:R=>g.get(R),elapsed:E?0:I,fade:(R,A=320)=>E?0:Number.isFinite(I)?Math.max(0,Math.min(1,(I-R)/A)):1,waiting:E,animating:g.animating,generation:x.current}}var mn=P(O(),1);function ro(e,t,n,r,o){if(r)return o==="categorical"?xe(e,t,n):jn(e,t,n);if(o==="categorical")return xe(e,t,n);let i=q(e,"strong"),a=q(e,"accent");return Array.from({length:t},(s,l)=>n.has(l)?a:i)}var ki=P(X(),1);var dn=P(O(),1);var oo=e=>e?"neutralStrong":"accent";var fn=P(O(),1);function ao(e,t,n,r){if(typeof e!="function")return ve(e,n,n,n.map(()=>0),"first");let o=new Map(n.map((a,s)=>[a,s])),i=new Set;return t.forEach((a,s)=>{let l=o.get(r(a,s));l!==void 0&&e(a,s)&&i.add(l)}),i}var wi=P(X(),1);var gn=P(O(),1),vi={name:"Candlestick chart",open:"Open",high:"High",low:"Low",close:"Close",change:"Change",volume:"Volume",empty:"No data.",ohlc:(e,t,n,r)=>`open ${e}, high ${t}, low ${n}, close ${r}`,span:(e,t,n)=>`${e} to ${t}: ${n}`,desc:(e,t,n,r,o)=>`${e} to ${t}, ${Ee(n,"candle")}. First open ${r}, last close ${o}`,ma:e=>`MA${e}`,up:"Up",down:"Down",maLegend:e=>`${e}-day MA`},io={en:vi,ko:{name:"캔들스틱",open:"시가",high:"고가",low:"저가",close:"종가",change:"등락률",volume:"거래량",empty:"데이터가 없어요.",ohlc:(e,t,n,r)=>`시가 ${e}, 고가 ${t}, 저가 ${n}, 종가 ${r}`,span:(e,t,n)=>`${e}부터 ${t}까지 ${n}`,desc:(e,t,n,r,o)=>`${e}부터 ${t}까지 ${n}개 봉. 첫 시가 ${r}, 마지막 종가 ${o}`,ma:e=>`${e}일선`,up:"상승",down:"하락",maLegend:e=>`${e}일 이동평균`}},hn=["ink","muted","dim"];function so(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,hn.length)}var rt=P(X(),1);var J=P(O(),1),$i={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${Ee(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},co={en:$i,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},pn=(e,t)=>co[e].other(t);function bn(e,t,n){if(typeof t!="number"||!(t>=1)||e.length<=t+1)return{kept:e,other:null};let r=new Set(e.map((i,a)=>({v:i.value,i:a})).sort((i,a)=>a.v-i.v).slice(0,Math.floor(t)).map(i=>i.i)),o=e.filter((i,a)=>!r.has(a));return{kept:e.filter((i,a)=>r.has(a)),other:n(o.length,tn(o.map(i=>i.value)))}}var yn=e=>Number.isFinite(e)&&e>0?e:0;function xn(e,t,n,r){return r==="emphasis"?Hn(e,t,n):xe(e,t,n)}function Ci(e){let{data:t}=e,n=W(ne(e.locale));return(0,rt.useMemo)(()=>{let r=Se(e.label,"label"),o=He(e.value,"value"),i=t.map((d,f)=>({d,i:f,label:r(d,f),value:yn(o(d,f))}));e.sort&&(i=[...i].sort((d,f)=>f.value-d.value));let a=typeof e.label=="string"?e.label:"label",s=typeof e.value=="string"?e.value:"value",{kept:l,other:c}=bn(i,e.other,(d,f)=>{let p=pn(n,d);return{d:{[a]:p,[s]:f},i:-1,label:p,value:f}}),m=c?[...l,c]:l,u=tn(m.map(d=>d.value)),h=ve(e.highlight,l.map(d=>d.d),l.map(d=>d.label),l.map(d=>d.value),"max");return{rows:m,total:u,hi:h}},[t,e.label,e.value,e.sort,e.highlight,e.other,n])}function Mi(e){let t=e.inner>0,{rows:n,total:r,hi:o}=Ci(e),i=$=>t?e.legend===void 0||e.legend==="auto"?$>=300?"right":"bottom":e.legend:"none",a=Math.ceil(n.length/2)*20+8,s=qr(e,{height:$=>t?Math.max(170,Math.min(240,$*.5))+(i($)==="bottom"?a:0):Math.max(180,Math.min(260,$*.62)),duration:1e3}),{p:l,width:c,height:m}=s,u=i(c),d=m-(u==="bottom"?a:0),f=Math.min(26,(d-8)/Math.max(1,n.length)),p=u==="right"?Math.min(220,Math.max(140,c*.44)):0,w=c-p,x=t?4:20,k=Math.max(10,Math.min(w,d)/2-x),v=k*e.inner,C=e.centerLabel?Math.max(9.5,Math.min(11,11*v*1.6/ge(e.centerLabel,11))):11,g=u==="right"?Math.max(k+x,w/2+6):c/2,N=d/2,D=(e.startAngle??0)*Math.PI/180,F=(0,rt.useMemo)(()=>{let $=xn(l,n.length,o,e.colorMode),_=0;return n.map((V,Z)=>{let G=r>0?V.value/r*Ve:0,K={i:Z,label:V.label,value:V.value,pct:r>0?V.value/r*100:0,a0:_,a1:_+G,sw:$[Z],hi:o.has(Z),datum:V.d};return _+=G,K})},[n,r,o,l,e.colorMode]),I=t?Ti(e,F,r):0,E=(0,rt.useMemo)(()=>{let $=F.map(_=>{let V=(_.a0+_.a1)/2;return{key:`s:${_.label}`,to:[_.a0,_.a1],enter:[_.a0,_.a0],exit:[V,V],data:_}});return $.push({key:"__sweep",to:[Ve],from:[0],data:null}),t&&$.push({key:"__center",to:[I],from:[0],data:null}),$},[F,t,I]),R=to(E,{...s.motion,stagger:0}),A=R.get("__sweep")?.[0]??Ve,M=s.motion.duration??1e3,b=R.items.filter($=>$.data),T=F.map($=>({datum:$.datum,index:$.i,key:$.label,label:$.label,value:$.value,formatted:`${s.pct($.pct)} · ${s.fv($.value)}`})),L=e.labelMode??(t?"none":"percent"),B=t?(v+k)/2:k*.62,ae=(0,rt.useMemo)(()=>{let $=new Map;if(L==="none"||!s.showLabels)return $;let _=[];F.forEach(K=>{let Q=lo(K,L,s.fv,s.pct),$e=K.a1-K.a0;if(!($e*B>=ge(Q,12.5,700)+10&&$e>.32)&&K.value>0){let ee=D+(K.a0+K.a1)/2,[Ne,xo]=ke(g,N,k+12,ee);_.push({i:K.i,x:Ne,y:xo,side:Math.sin(ee)>=0?1:-1})}});let V=15,Z=8,G=Math.max(0,Math.floor((d-2*Z)/V)+1);for(let K of[1,-1]){let Q=_.filter(te=>te.side===K);if(Q.length>G){let te=new Set([...Q].sort((ee,Ne)=>F[Ne.i].value-F[ee.i].value).slice(0,G).map(ee=>ee.i));for(let ee of Q)te.has(ee.i)||$.set(ee.i,null);Q=Q.filter(ee=>te.has(ee.i))}let $e=$r(Q.map(te=>te.y),V,Z,d-Z);Q.forEach((te,ee)=>{let Ne=Math.abs(te.x-g)<14;$.set(te.i,{x:te.x,y:$e[ee],anchor:Ne?"middle":K>0?"start":"end"})})}return $},[F,L,s.showLabels,B,D,g,N,k,d,s.fv,s.pct]),pe=co[s.lang],j=null;if(s.active!==null&&F[s.active]){let $=F[s.active],[_,V]=ke(g,N,k*.9,D+($.a0+$.a1)/2);j={x:_,y:V,title:$.label,rows:[{label:s.t.value,value:s.fv($.value),color:$.sw.fill},{label:pe.share,value:s.pct($.pct)}]}}let ie=R.get("__center")?.[0]??0,ue=[...F].sort(($,_)=>_.value-$.value),be=t?pe.donut:pe.pie,at=e.description??`${be}. ${pe.desc(F.length,s.fv(r),ue.slice(0,4).map($=>`${$.label} ${s.pct($.pct)}`).join(", "))}`;return(0,J.jsxs)(ar,{c:s,kind:be,ariaLabel:e.ariaLabel,description:at,events:T,tip:j,renderTip:e.tooltip,className:e.className,style:e.style,theme:e.theme,children:[(0,J.jsxs)("g",{children:[b.map($=>{let _=$.data,V=D+Math.min($.v[0],A),Z=D+Math.min($.v[1],A),G=s.active===_.i,K=(V+Z)/2,Q=G?5:0,$e=Math.sin(K)*Q,te=-Math.cos(K)*Q,ee=nn(g,N,v,k,V,Z);return ee?(0,J.jsx)("path",{className:"ztd-mark",d:ee,fill:_.sw.fill,stroke:l.paint("panel"),strokeWidth:F.length>1?2:0,strokeLinejoin:"round",opacity:$.exiting?.6:s.dim(_.i),style:{transform:`translate(${$e}px, ${te}px)`,transition:"transform .2s ease, opacity .18s ease",cursor:e.onClick?"pointer":void 0},onPointerEnter:Ne=>s.setActive(_.i,Ne.pointerType==="touch"?"touch":"pointer"),onClick:()=>s.click(_.i)},$.key):null}),s.active!==null&&s.via==="keyboard"&&F[s.active]?(0,J.jsx)("path",{d:nn(g,N,Math.max(0,v-2),k+3,D+F[s.active].a0,D+F[s.active].a1),fill:"none",stroke:l.paint("ink"),strokeWidth:2,pointerEvents:"none"}):null]}),L!=="none"&&s.showLabels?(0,J.jsx)("g",{children:F.map($=>{if($.value<=0)return null;let _=lo($,L,s.fv,s.pct),V=D+($.a0+$.a1)/2,Z=R.fade(M*.35+$.a0/Ve*M*.5,260)*s.dim($.i),G=ae.get($.i);if(G===null)return null;if(G)return(0,J.jsx)(Pe,{x:G.x,y:G.y,anchor:G.anchor,size:12,weight:700,fill:l.paint("ink"),opacity:Z,children:Je(_,G.anchor==="start"?c-G.x-4:G.anchor==="end"?G.x-4:c,12,700)},$.i);let[K,Q]=ke(g,N,B,V);return(0,J.jsx)(Pe,{x:K,y:Q,anchor:"middle",size:13,weight:700,fill:$.sw.text,opacity:Z,children:_},$.i)})}):null,t&&e.centerValue!==null?(0,J.jsxs)("g",{opacity:R.fade(0,200),children:[(0,J.jsx)(Pe,{x:g,y:N-(e.centerLabel?7:0),anchor:"middle",size:Math.max(15,Math.min(26,v*.42)),weight:800,fill:l.paint("ink"),letterSpacing:-.4,children:s.fmt(Math.round(ie))}),e.centerLabel?(0,J.jsx)(Pe,{x:g,y:N+Math.max(11,Math.min(17,v*.3)),anchor:"middle",size:C,fill:l.paint("muted"),children:Je(e.centerLabel,v*1.6,C)}):null]}):null,u==="right"||u==="bottom"?(0,J.jsx)("g",{children:F.map(($,_)=>{let V=u==="right",Z=V?p-12:(c-36)/2,G=V?w+8:8+_%2*(Z+20),K=V?N-(F.length-1)*f/2+_*f:d+12+Math.floor(_/2)*20,Q=R.fade(M*.25+_*90,260)*s.dim($.i),$e=s.pct($.pct),te=Z-14-ge($e,12,700)-10;return(0,J.jsxs)("g",{opacity:Q,onPointerEnter:()=>s.setActive($.i),style:{cursor:"default"},children:[(0,J.jsx)("rect",{x:G,y:K-5,width:10,height:10,rx:2.5,fill:$.sw.fill,stroke:$.sw.role==="soft"||$.sw.role==="neutral"?l.paint("line2"):"none"}),(0,J.jsx)(Pe,{x:G+16,y:K,size:12,weight:$.hi?700:500,fill:l.paint($.hi?"ink":"muted"),children:Je($.label,te,12,$.hi?700:500)}),(0,J.jsx)(Pe,{x:G+Z,y:K,anchor:"end",size:12,weight:$.hi?800:500,fill:l.paint($.hi?"ink":"muted"),children:$e})]},$.i)})}):null]})}function Ti(e,t,n){let r=e.centerValue;return typeof r=="number"?r:r==="highlight"?t.find(o=>o.hi)?.value??n:n}function lo(e,t,n,r){return t==="value"?n(e.value):t==="label"?e.label:r(e.pct)}function Nt(e){let t=Math.max(.2,Math.min(.9,e.innerRadius??.62));return(0,J.jsx)(Mi,{...e,inner:t})}var Si=P(X(),1);var ho=P(O(),1);function uo(e,t){return t===!1?e.map((n,r)=>r):xr(e)}function mo(e,t,n){let r=n.map(o=>o.reduce((i,a)=>i+(Number.isFinite(a)?a:0),0));return ve(e,t,t,r,"max")}function fo(e,t,n){let r=new Array(t.length),o=t.filter(i=>!n.has(i));for(let i of t)n.has(i)&&(r[i]=q(e,"accent"));return o.forEach((i,a)=>r[i]=o.length===1?q(e,"neutral"):ut(e,1-a/Math.max(1,o.length-1))),r}var Me=P(O(),1);function go(e,t){let n=wt(e);return n?.type==="scatter"&&t?.size!==void 0?wt("bubble"):n}function Fi(e,t={}){let n={};for(let r of e.encoding){let o=t[r.name];o!==void 0&&(n[r.prop??r.name]=o)}return n}function Ni(e,t,n,r=!1){let o=go(e.type,e.encoding);if(!o||!t.length)return[];let i=e.encoding??{},a=e.options??{},s=a.highlight,l=new Set(!r&&Jt.includes(o.type)&&Array.isArray(a.hidden)?a.hidden.map(String):[]),c=u=>u.filter(h=>!l.has(h.label)),m=["pie","donut","waffle"];if(o.type==="donut"&&a.legend!=="none")return[];if(m.includes(o.type)){let u=Se(i.label,"label"),h=He(i.value,"value"),d=o.type==="waffle",f=t.map((C,g)=>({r:C,label:u(C,g),value:d?h(C,g):yn(h(C,g))})),{kept:p,other:w}=d?{kept:f,other:null}:bn(f,a.other,(C,g)=>({r:{},label:pn(W(n),C),value:g})),x=ve(s,p.map(C=>C.r),p.map(C=>C.label),p.map(C=>C.value),d?"first":"max"),k=w?[...p,w]:p,v=Ye(C=>d?xe(C,k.length,x):xn(C,k.length,x,a.colorMode));return k.map((C,g)=>({label:C.label,color:v[g]}))}if(o.type==="candlestick"){let u=so(Array.isArray(a.ma)?a.ma:void 0,t.length),h=io[W(n)];return[{label:h.up,color:a.upColor??"accent"},{label:h.down,color:a.downColor??"neutralStrong"},...u.map((d,f)=>({label:h.maLegend(d),color:hn[f],shape:"line"}))]}if(o.type==="scatter"){if(typeof i.series!="string")return[];let u=Se(i.series,"series"),h=je(t.map((p,w)=>u(p,w)));if(h.length<2)return[];let d=ao(s,t,h,u),f=Ye(p=>zn(p,h.length,d));return c(h.map((p,w)=>({label:p,color:f[w],shape:"circle"})))}if(["marimekko","area","bar","line","stream","radar"].includes(o.type)){let u=[];if(Array.isArray(i.y))u=i.y;else if(typeof i.series=="string"){let v=Se(i.series,"series");u=je(t.map((C,g)=>v(C,g)))}let h=Zt(o.type,i,a);if(h.length){let v=ve(s,u,u,u.map(()=>0),"none"),C=Ye(N=>xe(N,u.length,v)),g=u.length<2?[{label:String((Array.isArray(i.y)?i.y[0]:i.y)??"y"),color:"neutral"}]:u.map((N,D)=>({label:N,color:C[D]}));return[...c(g),...h.map((N,D)=>({label:N,color:oo(D),shape:"line"}))]}if(u.length<2)return[];let f=o.type==="bar"&&a.layout==="diverging"&&s===void 0?yr(u.length,Array.isArray(a.negative)?a.negative.map(v=>u.indexOf(String(v))):[],typeof a.neutral=="string"?u.indexOf(a.neutral):-1):-1,p=f>=0?new Set([f]):ve(s,u,u,u.map(()=>0),"first");if(o.type==="radar")return c(u.map((v,C)=>({label:v,color:p.has(C)?"accent":"neutralStrong",shape:"square"})));let w=a.colorMode,x=v=>xe(v,u.length,p);if((o.type==="line"||o.type==="area")&&(x=v=>ro(v,u.length,p,o.type==="area",w)),o.type==="stream"){let v=Qe(t,i.x,i.y,i.series,{xType:a.xType,locale:n,aggregate:a.aggregate,dayFirst:a.dayFirst}),C=uo(v.values,a.reorder),g=mo(s,v.series,v.values);x=N=>fo(N,C,g)}let k=Ye(x);return c(u.map((v,C)=>({label:v,color:k[C],...o.type==="line"&&{shape:"line"}})))}return[]}function Ri(e,t){let n=e.facet;return n&&typeof n=="object"&&typeof n.by=="string"&&ur.includes(t)&&!(t==="bar"&&e.options?.layout==="diverging")?n:void 0}function Pi(e,t,n){let{data:r,width:o,height:i,highlight:a,syncId:s,ariaLabel:l,description:c,...m}=n;return{type:e,data:r??[],by:t.by,columns:t.columns,scale:t.scale,chartProps:m,width:o,height:i,highlight:a,syncId:s,title:l,description:c}}function po(e,t){let{spec:n}=e,r=go(n.type,n.encoding),o=(0,ot.useMemo)(()=>Yr(n.data),[n.data]),i=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,a=cr(n,e.locale),s=ne(a),l=W(s),c=zr(i?.url??null,{parse:i?.format??"auto",select:i?.select,init:e.fetchInit,locale:s}),m=fr(n),u=(0,ot.useMemo)(()=>m?Ur(m,s):void 0,[m,s]),h=n.options?.hidden,d=Array.isArray(h)?h.map(String):[],f=d.join(""),[p,w]=(0,ot.useState)(null);if(!r)return(0,Me.jsx)(qt,{error:l==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:a});let x=o??c.data,k=t[r.type],v={...n.options??{}},C={...Fi(r,n.encoding),...v,...u?{tooltip:u}:{},data:x,...e.width!==void 0?{width:e.width}:{},...e.height!==void 0?{height:e.height}:{},...e.animate!==void 0?{animate:e.animate}:{},...e.replayKey!==void 0?{replayKey:e.replayKey}:{},...e.onHover?{onHover:e.onHover}:{},...e.onClick?{onClick:e.onClick}:{},locale:a},g=n.card?.legend==="toggle"&&dr(r.type,n.encoding??{},v),N=p&&p.base===f?p.hidden:d;g&&(C.hidden=N);let D=A=>w(M=>{let b=M&&M.base===f?M.hidden:d;return{base:f,hidden:b.includes(A)?b.filter(T=>T!==A):[...b,A]}}),F=C.height??220,I=Ri(n,r.type),E=i&&!x.length&&(c.loading||c.error||c.empty)?(0,Me.jsx)(qt,{loading:c.loading,error:c.error,empty:c.empty,onRetry:c.reload,height:F,locale:a}):I?(0,Me.jsx)(Br,{chart:k,...Pi(r.type,I,C)}):(0,Me.jsx)(k,{...C});if(n.card){let A=n.card,M=A.legend==="auto"||A.legend==="toggle"?Ni(n,x,s,g):A.legend,b=M?.length?g?(0,Me.jsx)(Yt,{items:M,hidden:N,onToggle:D,locale:a}):M:void 0,T=A.download?(0,Me.jsx)(Kr,{data:x,columns:hr(n),filename:A.title??r.type,formats:Array.isArray(A.download)?A.download:void 0,locale:a}):void 0;E=(0,Me.jsx)(or,{number:A.number,title:A.title??lr(r,l),subtitle:A.subtitle,legend:b,actions:T,source:A.source||void 0,note:A.note||void 0,accent:A.accent,takeaway:A.takeaway,level:A.level,sample:A.sample,replay:A.replay!==!1,className:e.className,locale:a,children:E})}let R=e.theme??n.theme;return R&&(E=(0,Me.jsx)(pt,{theme:R,children:E})),E}function Di({cfg:e,components:t}){let n=Ge();return po({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function yo(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,bo.hydrateRoot)(r,(0,kn.createElement)(pt,{theme:o.theme,cssVars:!0},(0,kn.createElement)(Di,{cfg:o,components:{[e]:t}})))}yo("donut",Nt);})();
|