ztd-charts-cli 0.9.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.js +1 -1
- package/dist/{chunk-GTATC42I.js → chunk-ZZGASY2Y.js} +1 -1
- package/dist/cli.js +1 -1
- package/dist/client/area.js +5 -5
- package/dist/client/bar.js +5 -5
- package/dist/client/barRace.js +3 -3
- package/dist/client/beeswarm.js +3 -3
- package/dist/client/box.js +6 -6
- package/dist/client/bubble.js +6 -6
- package/dist/client/bullet.js +5 -5
- package/dist/client/bump.js +6 -6
- package/dist/client/calendar.js +5 -5
- package/dist/client/candlestick.js +4 -4
- package/dist/client/chord.js +5 -5
- package/dist/client/choropleth.js +5 -5
- package/dist/client/donut.js +6 -6
- package/dist/client/dumbbell.js +3 -3
- package/dist/client/flowMap.js +4 -4
- package/dist/client/funnel.js +3 -3
- package/dist/client/gauge.js +3 -3
- package/dist/client/heatmap.js +5 -5
- package/dist/client/histogram.js +5 -5
- package/dist/client/line.js +5 -5
- package/dist/client/lollipop.js +6 -6
- package/dist/client/marimekko.js +6 -6
- package/dist/client/network.js +5 -5
- package/dist/client/parallel.js +6 -6
- package/dist/client/pareto.js +5 -5
- package/dist/client/pie.js +6 -6
- package/dist/client/radar.js +6 -6
- package/dist/client/radialBar.js +3 -3
- package/dist/client/ridgeline.js +4 -4
- package/dist/client/sankey.js +4 -4
- package/dist/client/scatter.js +6 -6
- package/dist/client/segmented.js +3 -3
- package/dist/client/skyline.js +9 -9
- package/dist/client/slope.js +5 -5
- package/dist/client/sparkline.js +6 -6
- package/dist/client/stream.js +6 -6
- package/dist/client/sunburst.js +6 -6
- package/dist/client/symbolMap.js +5 -5
- package/dist/client/tileMap.js +6 -6
- package/dist/client/timeline.js +10 -10
- package/dist/client/tree.js +5 -5
- package/dist/client/treemap.js +3 -3
- package/dist/client/waffle.js +5 -5
- package/dist/client/waterfall.js +5 -5
- package/package.json +2 -2
package/dist/client/chord.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(()=>{var bo=Object.create;var cn=Object.defineProperty;var yo=Object.getOwnPropertyDescriptor;var xo=Object.getOwnPropertyNames;var ko=Object.getPrototypeOf,wo=Object.prototype.hasOwnProperty;var xt=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var
|
|
1
|
+
(()=>{var bo=Object.create;var cn=Object.defineProperty;var yo=Object.getOwnPropertyDescriptor;var xo=Object.getOwnPropertyNames;var ko=Object.getPrototypeOf,wo=Object.prototype.hasOwnProperty;var xt=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var $o=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of xo(t))!wo.call(e,o)&&o!==n&&cn(e,o,{get:()=>t[o],enumerable:!(r=yo(t,o))||r.enumerable});return e};var A=(e,t,n)=>(n=e!=null?bo(ko(e)):{},$o(t||!e||!e.__esModule?cn(n,"default",{value:e,enumerable:!0}):n,e));var j=xt((ji,un)=>{un.exports=globalThis.__ztdReact.react});var dn=xt((Gi,mn)=>{mn.exports=globalThis.__ztdReact["react-dom/client"]});var L=xt((rs,Hn)=>{Hn.exports=globalThis.__ztdReact["react/jsx-runtime"]});var an=A(j(),1),go=A(dn(),1);var Ke=A(j(),1);var at=A(j(),1);var fn=A(j(),1),Ae=(0,fn.createContext)(void 0);var bn=A(j(),1);var vo=["bg","panel","ink","muted","dim","accent","accentText","onAccent","accent2","accent3","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"],hn='"Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, -apple-system, sans-serif',gn='"Roboto Mono", "Share Tech Mono", ui-monospace, SFMono-Regular, Menlo, monospace',be={name:"dark",bg:"#14171B",panel:"#14171B",ink:"#F1F3F5",muted:"#A3ABB5",dim:"#5B636D",accent:"#D6FD70",accentText:"#D6FD70",onAccent:"#14171B",accent2:"#FF8CC1",accent3:"#38C6F6",onInk:"#14171B",line:"#2A2F36",line2:"#22272D",neutral:"#3A414A",neutralStrong:"#5F6772",onNeutralStrong:"#F1F3F5",neutralSoft:"#262B31",lift:"#1D2126",tint:"rgba(214, 253, 112, 0.14)",fontFamily:hn,monoFamily:gn,radius:18,radiusCode:14,radiusMark:4},kt={name:"light",bg:"#FFFFFF",panel:"#FFFFFF",ink:"#14171B",muted:"#5D6570",dim:"#B3B9C2",accent:"#0B8FD8",accentText:"#006DA8",onAccent:"#14171B",accent2:"#D8488C",accent3:"#659815",onInk:"#FFFFFF",line:"#E6E9ED",line2:"#F0F2F5",neutral:"#D5DAE0",neutralStrong:"#9AA3AE",onNeutralStrong:"#14171B",neutralSoft:"#EEF1F4",lift:"#F4F6F8",tint:"rgba(11, 143, 216, 0.12)",fontFamily:hn,monoFamily:gn,radius:18,radiusCode:14,radiusMark:4},wt={dark:be,light:kt};function Ue(e){return`--ztd-${e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}function $t(e){let t={};for(let n of vo){let r=e[n];typeof r=="string"&&(t[Ue(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 vt(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 Mo=`
|
|
2
2
|
.ztd-root{position:relative;-webkit-tap-highlight-color:transparent}
|
|
3
3
|
.ztd-root:focus{outline:none}
|
|
4
4
|
.ztd-root:focus-visible{outline:2px solid var(--ztd-accent,${be.accent});outline-offset:3px;border-radius:6px}
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
@keyframes ztd-pulse{0%,100%{opacity:.55}50%{opacity:1}}
|
|
20
20
|
.ztd-skeleton{animation:ztd-pulse 1.4s ease-in-out infinite}
|
|
21
21
|
@media (prefers-reduced-motion: reduce){.ztd-skeleton{animation:none}}
|
|
22
|
-
`;function yn(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 xn(e,t){let[n]=(0,bn.useState)(!e.motion.enabled);return e.motion.enabled&&e.hydrated&&(!n||t.waiting||t.generation>0)}var pn=!1;function Ie(){if(pn||typeof document>"u"||(pn=!0,document.getElementById("ztd-base")))return;let e=document.createElement("style");e.id="ztd-base",e.textContent=Mo,document.head.appendChild(e)}var Xe=A(j(),1),se=typeof window<"u"&&typeof document<"u",he=se?Xe.useLayoutEffect:Xe.useEffect;function Ye(){return typeof performance<"u"?performance.now():Date.now()}function V(e){return e!==void 0&&/^ko([-_]|$)/i.test(e)?"ko":"en"}function ye(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}var kn={chart:"chart",table:e=>`${e} data`,more:e=>`and ${e} more`,value:"Value",empty:"No data."},wn={chart:"차트",table:e=>`${e} 데이터`,more:e=>`외 ${e}개`,value:"값",empty:"데이터가 없어요."};var To=[{id:"basic",en:"Basic",ko:"기본"},{id:"intermediate",en:"Intermediate",ko:"중급"},{id:"advanced",en:"Advanced",ko:"심화"}],Co={basic:{bg:"line2",fg:"ink"},intermediate:{bg:"tint",fg:"accentText"},advanced:{bg:"ink",fg:"onInk"}};function So(e,t){let n=t.trim().toLowerCase();return e.find(r=>r.id===n||r.en.toLowerCase()===n||r.ko===t.trim())}function Ao(e){return So(To,e)}function vn(e,t){let n=Ao(e);return{text:n?n[t]:e,...Co[n?.id??"basic"]}}var $n={white:"#ffffff",black:"#000000",transparent:"#00000000"};function Ne(e){if(!e)return null;let t=e.trim(),n=/^var\(\s*--[\w-]+\s*,\s*(.+)\)$/i.exec(t);if(n&&(t=n[1].trim()),$n[t.toLowerCase()]&&(t=$n[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 Cn(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 Tt(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 Re(e){let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Mn(e){return .2126*Re(e[0])+.7152*Re(e[1])+.0722*Re(e[2])}function Ct(e,t,n){let r=typeof e=="string"?Ne(e):e,o=typeof t=="string"?Ne(t):t;if(!r||!o)return 0;let a=n?typeof n=="string"?Ne(n):n:null;o[3]<1&&a&&(o=Tt(o,a));let i=r[3]<1?Tt(r,o):r,s=Mn(i),l=Mn(o);return(Math.max(s,l)+.05)/(Math.min(s,l)+.05)}function No(e){return[Re(e[0]),Re(e[1]),Re(e[2])]}function Mt(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 Tn(e){let[t,n,r]=No(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 Ro([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[Mt(4.0767416621*o-3.3077115913*a+.2309699292*i),Mt(-1.2684380046*o+2.6097574011*a-.3413193965*i),Mt(-.0041960863*o-.7034186147*a+1.707614701*i),r]}function qe(e,t,n){let r=Ne(e),o=Ne(t);if(!r||!o)return e;let a=Tn(r),i=Tn(o),s=Math.max(0,Math.min(1,n));return Cn(Ro([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 St(e,t,n){let r=t[0],o=-1;for(let a of t){let i=Ct(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 Fo(e,t){let n=St(t,[e.theme.ink,e.theme.onAccent,e.theme.onNeutralStrong]);return Ct(n,t)>=4.5?n===e.theme.ink?e.paint("ink"):n===e.theme.onAccent?e.paint("onAccent"):e.paint("onNeutralStrong"):St(t,["#FFFFFF","#000000"])}function Je(e,t){let n=qe(e.theme.neutralStrong,e.theme.neutral,t);return{role:"mix",fill:e.mix("neutralStrong","neutral",t),text:Fo(e,n),raw:n}}function le(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"):Je(e,1-l)}}),r}var At="mix:";function xe(e){return e({theme:kt,cssVars:!1,paint:n=>n,color:n=>n??"neutral",raw:n=>n??"neutral",mix:(n,r,o)=>`${At}${o}`}).map(n=>n.fill)}function Sn(e,t){return t?.startsWith(At)?e.mix("neutralStrong","neutral",Number(t.slice(At.length))):e.color(t)}function ze(e,t,n){return le(e,t+1,n).slice(0,t)}function An(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 Nn(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]=Je(e,1-s/(a-1))}),r}var ce=A(j(),1);var Qe=(e,t="")=>n=>Number.isFinite(n)?`${e(n)}${t}`:e(n),J="en-US",Rn=new Map;function Nt(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=Rn.get(r);return o||(o=new Intl.NumberFormat(e,n),Rn.set(r,o)),o}function Rt(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=J,...r}=t;return Rt(Nt(n,r).format(e))}var Ft=e=>e!==0&&Math.abs(e)<.05,_t=(e,t,n="")=>`${Fe(e,{locale:t,maximumSignificantDigits:2,maximumFractionDigits:20})}${n}`;function Ze(e,t={}){if(!Number.isFinite(e))return"-";if(Ft(e)&&t.maximumFractionDigits===void 0)return _t(e,t.locale??J,"%");let n=Math.abs(e);return`${Fe(e,{maximumFractionDigits:n>0&&n<1?1:0,...t})}%`}function Dn(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=J,...r}=t;if(V(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,f=Math.max(r.minimumFractionDigits??0,r.maximumFractionDigits??(s===1||c<100?1:0)),u=Math.round(c*10**f)/10**f;if(i>0&&u>=a[i-1][0]/s){i--;continue}return(e<0&&u!==0?"-":"")+Fe(u,{locale:n,...r,maximumFractionDigits:f})+l}}return Rt(Nt(n,{notation:"compact",...r}).format(e))}var _o=(e,t=V(e)==="ko"?"KRW":"USD")=>({style:"currency",currency:t,maximumFractionDigits:t==="KRW"?0:2});function Me(e,t=J,n){if(typeof e=="function")return e;let r=(o,a="",i="")=>{let s=Nt(t,o);return l=>Number.isFinite(l)?`${i}${Rt(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=>Dn(o,{locale:t});case"currency":return r(_o(t));default:{let o=r({maximumFractionDigits:1});return a=>Ft(a)?_t(a,t):o(a)}}}function Ln(e,t=J,n=0){return e!==void 0?Me(e,t):n>=1e5?r=>Ft(r)?_t(r,t):Dn(r,{locale:t}):r=>Fe(r,{locale:t})}function Po(e,t,n=1){let r=new Date(+e,+t-1,+n);return r.getMonth()===+t-1&&r.getDate()===+n?r:null}var Pt=e=>Number.isInteger(e)&&e>=1e3&&e<=9999,Do=/^\d{4}-\d{1,2}(-\d{1,2})?([T ][\d:.]+(Z|[+-]\d{2}:?\d{2})?)?$/,Lo=["january","february","march","april","may","june","july","august","september","october","november","december"],Fn=e=>{let t=e.toLowerCase();return t.length<3?0:Lo.findIndex(n=>n.startsWith(t))+1},_n=e=>+e+(+e<30?2e3:1900);function En(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}var Eo=[/^(\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})일)?$/],On=/^(\d{1,2})([./-])(\d{1,2})\2(\d{4})$/,In=/\{([^{}]+)\}/g;function et(e,t){let n;for(let r of Eo)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?[_n(n[3]),+n[2],+n[1],1]:[_n(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=On.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=Fn(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=Fn(n[1]);return r?[+n[3],r,+(n[2]??1),n[2]?1:2]:null}return null}var zn=e=>Do.test(e)||et(e)!==null;function Bn(e){let t;for(let n of e){let r=typeof n=="string"?On.exec(n.trim()):null;if(r){if(+r[1]>12)return!0;+r[3]>12&&(t=!1)}}return t}function tt(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(Pt(e))return new Date(e,0,1);if(e>=19000101&&e<=21001231)return tt(`${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=et(n,t);if(r)return Po(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 Pn=new Map;function Be(e,t={month:"short",day:"numeric"}){let n=tt(e);if(!n)return"-";let{locale:r=J,...o}=t,a=r+JSON.stringify(o),i=Pn.get(a);return i||(i=new Intl.DateTimeFormat(r,o),Pn.set(a,i)),i.format(n)}var Dt=A(L(),1),nt=(0,ce.createContext)({theme:be,cssVars:!0});function Oo(e,t=be){return e?typeof e=="string"?wt[e]??t:$t(t,e):t}function rt(e){let t=(0,ce.useContext)(nt),n=e.base?wt[e.base]:t.theme,r=(0,ce.useMemo)(()=>Oo(e.theme,n),[e.theme,n]),o=e.cssVars??t.cssVars,a=e.locale??t.locale,i=(0,ce.useMemo)(()=>({theme:r,cssVars:o,locale:a}),[r,o,a]),s=(0,ce.useMemo)(()=>vt(r),[r]),l=e.paint?{background:r.bg,color:r.ink,fontFamily:r.fontFamily,...s,...e.style}:{display:"contents",...s,...e.style};return(0,Dt.jsx)(nt.Provider,{value:i,children:(0,Dt.jsx)("div",{className:e.className,"data-ztd-theme":r.name,lang:e.locale,style:l,children:e.children})})}var Io=new Set(["bg","panel","ink","muted","dim","accent","accentText","onAccent","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"]);function jn(e){return Io.has(e)}function zo(e,t){let n=r=>t?`var(${Ue(r)}, ${e[r]})`:e[r];return{theme:e,cssVars:t,paint:n,color:(r,o="neutral")=>r?jn(r)?n(r):r:n(o),raw:(r,o="neutral")=>r?jn(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)})`:qe(e[r],e[o],a)}}}function ue(e){let t=(0,ce.useContext)(nt);return(0,ce.useMemo)(()=>{let n=$t(t.theme,e);return zo(n,t.cssVars)},[t.theme,t.cssVars,e])}function Z(e){let t=(0,ce.useContext)(nt);return e??t.locale??J}function Gn(e){return e?vt(e):{}}var ot=A(j(),1),Lt=(0,ot.createContext)(void 0);function Vn(e){let t=(0,ot.useContext)(Lt);return e!==void 0&&t!==void 0?`${e}:${t}`:e??t}var N=A(L(),1),Bo={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`},Ho={en:Bo,ko:{legend:"범례",replay:"애니메이션 다시 재생",replayTitle:"다시 재생",sample:"예시 데이터",loadError:"데이터를 불러오지 못했어요",retry:"다시 시도",loading:"불러오는 중",empty:"표시할 데이터가 없어요",source:"출처",shown:(e,t)=>`${t}개 중 ${e}개 보임`}};var jo={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},Et=e=>Ho[V(Z(e))];function Ot(e){let t=ue(e.theme),n=Et(e.locale),[r,o]=(0,at.useState)(!1),a=e.size??11.5,i=e.onToggle,s=new Set(i?e.hidden:void 0),l=e.items.filter(f=>!s.has(f.label)).length,c=(0,N.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((f,u)=>{let h=!s.has(f.label),d=h&&l===1,m=(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(Go,{p:t,item:f,off:!h}),(0,N.jsx)("span",{style:h?void 0:{textDecoration:"line-through"},children:f.label})]});return(0,N.jsx)("li",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:a,color:t.paint("muted"),lineHeight:1.3},children:i?(0,N.jsx)("button",{type:"button",className:"ztd-btn","aria-pressed":h,"aria-disabled":d||void 0,onClick:()=>{d||(i(f.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:m}):m},u)})});return i?(0,N.jsxs)(N.Fragment,{children:[c,(0,N.jsx)("span",{"aria-live":"polite","aria-atomic":"true",style:jo,children:r?n.shown(l,e.items.length):""})]}):c}function Go({p:e,item:t,off:n}){let r=Sn(e,t.color),o=t.shape??"square";return o==="line"||o==="dash"?(0,N.jsxs)("svg",{width:14,height:8,"aria-hidden":"true",style:{flex:"none",opacity:n?.35:void 0},children:[(0,N.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,N.jsx)("circle",{cx:7,cy:4,r:2.2,fill:r}):null]}):(0,N.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 Vo(e){let t=ue(e.theme),n=vn(e.level,V(Z(e.locale)));return(0,N.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 Wo(e,t,n){if(typeof e!="string"||!t)return e;let r=e.indexOf(t);return r<0?e:(0,N.jsxs)(N.Fragment,{children:[e.slice(0,r),(0,N.jsx)("span",{style:{color:n},children:t}),e.slice(r+t.length)]})}function Wn(e){let t=ue(e.theme),n=Et(e.locale),[r,o]=(0,at.useState)(0);he(()=>Ie(),[]);let a=()=>{o(h=>h+1),e.onReplay?.()},i=Array.isArray(e.legend)?(0,N.jsx)(Ot,{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,f=e.source!==void 0||e.note!==void 0?(0,N.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,N.jsxs)("footer",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,marginTop:2},children:[(0,N.jsx)("span",{style:{fontSize:17,fontWeight:800,color:t.paint("ink"),letterSpacing:-.3,lineHeight:1.3,minWidth:0},children:e.takeaway}),(0,N.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:8,flex:"none"},children:[e.sample?(0,N.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,N.jsx)(Vo,{level:e.level,theme:e.theme,locale:e.locale}):null]})]}):null;return(0,N.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,N.jsxs)("header",{style:{display:"flex",flexDirection:"column",gap:6,minWidth:0},children:[(0,N.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0},children:[l?(0,N.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,N.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:Wo(e.title,e.accent,t.paint("accentText"))}),e.actions,c?(0,N.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,N.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,N.jsx)("path",{d:"M3 12a9 9 0 1 0 3-6.7"}),(0,N.jsx)("path",{d:"M3 3v6h6"})]})}):null]}),e.subtitle!==void 0||i?(0,N.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"4px 12px",flexWrap:"wrap",minHeight:18},children:[e.subtitle!==void 0?(0,N.jsx)("span",{style:{fontSize:12.5,color:t.paint("muted"),lineHeight:1.4},children:e.subtitle}):(0,N.jsx)("span",{}),i]}):null]}),(0,N.jsx)("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",minHeight:0,minWidth:0},children:(0,N.jsx)(Lt.Provider,{value:r,children:(0,N.jsx)(Ae.Provider,{value:typeof e.title=="string"||typeof e.title=="number"?String(e.title):void 0,children:e.children})})}),f?(0,N.jsxs)(N.Fragment,{children:[f,u]}):u]})}function It(e){let t=ue(e.theme),n=Et(e.locale),r=e.height??220;if(he(()=>Ie(),[]),e.error){let o=typeof e.error=="string"?e.error:e.error.message;return(0,N.jsx)("div",{role:"alert",style:{height:r,display:"grid",placeItems:"center",textAlign:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,N.jsxs)("div",{style:{display:"grid",gap:8,justifyItems:"center",padding:16},children:[(0,N.jsx)("span",{style:{fontSize:14,fontWeight:700,color:t.paint("ink")},children:n.loadError}),(0,N.jsx)("span",{style:{fontSize:12,color:t.paint("muted"),maxWidth:280,wordBreak:"break-word"},children:o}),e.onRetry?(0,N.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,N.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,N.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,N.jsx)("div",{style:{height:r,display:"grid",placeItems:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,N.jsx)("span",{style:{fontSize:13,color:t.paint("muted")},children:e.emptyText??n.empty})}):(0,N.jsx)(N.Fragment,{children:e.children})}var Ee=A(j(),1);var Q=A(j(),1);var B=A(L(),1),it=60;var st={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};function Kn(e){let{c:t,events:n}=e,r=(0,Q.useId)().replace(/:/g,""),o=`${r}t`,a=`${r}d`;t.events.current=n,he(()=>{Ie()},[]);let i=n.length,s=!e.noNav&&i>0,l=(0,Q.useContext)(Ae),c=e.ariaLabel??l??e.kind,f=(0,Q.useMemo)(()=>s?`${n.length}${n.slice(0,it).map(x=>`${x.label}${x.series??""}${x.formatted??x.value??""}`).join("")}`:"",[n,s]),u=(0,Q.useMemo)(()=>(0,B.jsx)(Ko,{label:c,events:n,t:t.t}),[c,f,t.t]),h=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{let x=()=>{h.current=null};return window.addEventListener("scroll",x,{capture:!0,passive:!0}),window.addEventListener("resize",x,{passive:!0}),()=>{window.removeEventListener("scroll",x,{capture:!0}),window.removeEventListener("resize",x)}},[]),(0,Q.useEffect)(()=>{h.current=null},[t.width,t.height]);let d=x=>{if(x.target!==x.currentTarget)return;if(e.onKey?.(x)){x.preventDefault();return}let T=t.active,R;switch(x.key){case"ArrowRight":case"ArrowDown":R=T===null?0:(T+1)%i;break;case"ArrowLeft":case"ArrowUp":R=T===null?i-1:(T-1+i)%i;break;case"Home":R=0;break;case"End":R=i-1;break;case"Escape":if(T===null)return;R=null;break;case"Enter":case" ":T!==null&&(x.preventDefault(),t.click(T));return;default:return}x.preventDefault(),t.setActive(R,"keyboard")},{via:m,node:g,setActive:w}=t;(0,Q.useEffect)(()=>{if(m!=="touch"||!g)return;let x=T=>{g.contains(T.target)||w(null)};return document.addEventListener("pointerdown",x),()=>document.removeEventListener("pointerdown",x)},[m,g,w]);let k=t.active!==null?n[t.active]:null,$=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,S=typeof e.renderTip=="function"&&k?e.renderTip(k):null,b=e.announce??(t.via==="keyboard"&&k?`${k.label}${k.series?` ${k.series}`:""}: ${k.formatted??k.value??""} (${(t.active??0)+1}/${i})`:""),C;if($){let x=$.x*M,T=t.width*M,R=`clamp(${(4-x).toFixed(1)}px, -50%, calc(${(T-x-4).toFixed(1)}px - 100%))`,P=$.y<64;C={position:"absolute",left:x,top:$.y*M,transform:`translate(${R}, ${P?"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*M-8)}}let F=x=>{h.current=null,x.pointerType!=="touch"&&t.via!=="keyboard"&&t.setActive(null)},D=x=>x?T=>{let R=h.current??(h.current=T.currentTarget.getBoundingClientRect());R.width&&x((T.clientX-R.left)/R.width*t.width,(T.clientY-R.top)/R.height*t.height,T)}:void 0,E=D(e.onPointerMove),O=D(e.onPointerDown),_=E||O?x=>{x.pointerType==="touch"&&E?.(x),O?.(x)}:void 0,p=D(e.onPointerUp),v=Gn(e.theme);return(0,B.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?d:void 0,onBlur:x=>{t.via==="keyboard"&&!x.currentTarget.contains(x.relatedTarget)&&t.setActive(null)},onPointerLeave:F,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,B.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:_,onPointerUp:p,onPointerCancel:p,style:{fontFamily:"inherit",touchAction:"pan-y",position:e.underlay?"relative":void 0},children:[(0,B.jsx)("title",{id:o,children:c}),(0,B.jsx)("desc",{id:a,children:i||t.description!==void 0?e.description:e.emptyText??t.t.empty}),e.defs&&!t.pending?(0,B.jsx)("defs",{children:e.defs}):null,t.pending?null:e.children]}),t.pending?null:e.overlay,$?(0,B.jsx)("div",{className:"ztd-tip","aria-hidden":"true",style:C,children:S??(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("div",{style:{fontWeight:600,fontSize:11.5,color:t.p.paint("muted"),marginBottom:$.rows.length?4:0,overflow:"hidden",textOverflow:"ellipsis"},children:$.title}),$.rows.map((x,T)=>(0,B.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:16,justifyContent:"space-between"},children:[(0,B.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:7,color:t.p.paint(x.strong?"ink":"muted")},children:[x.color?(0,B.jsx)("span",{style:{width:8,height:8,borderRadius:999,background:x.color,display:"inline-block",boxShadow:"inset 0 0 0 1px rgba(127,127,127,0.3)"}}):null,x.label]}),(0,B.jsx)("span",{style:{fontWeight:x.strong===!1?500:700},children:x.value})]},T))]})}):null,(0,B.jsx)("span",{className:"ztd-sr",style:st,"aria-live":"polite","aria-atomic":"true",children:b}),s&&!t.pending?u:null]})}function Ko({label:e,events:t,t:n}){return(0,B.jsx)("div",{className:"ztd-sr",style:st,children:(0,B.jsxs)("table",{children:[(0,B.jsx)("caption",{children:n.table(e)}),(0,B.jsxs)("tbody",{children:[t.slice(0,it).map((r,o)=>(0,B.jsxs)("tr",{children:[(0,B.jsx)("th",{scope:"row",children:r.series?`${r.label} · ${r.series}`:r.label}),(0,B.jsx)("td",{children:r.formatted??r.value??""})]},o)),t.length>it?(0,B.jsx)("tr",{children:(0,B.jsx)("td",{colSpan:2,children:n.more(t.length-it)})}):null]})]})})}function Un(e){let t=e.baseline??"central";return(0,B.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}),re=y("label","string",!0,"Item name field"),Y=y("value","number",!0,"Value field"),Uo=[re,Y],Xo=[re,Y],Yo=[y("label","string",!0,"Stage name"),y("value","number",!0,"Users at the stage")],qo=[re,Y],Jo=[y("label","string",!0,"Leaf (lowest level) name"),Y,y("group","string",!1,"Parent group field")],Zo=[y("label","string",!0,"Leaf name"),Y,y("group","string",!1,"Parent group field")],Qo=[re,y("value","number",!0,"Change (total rows may omit it)"),y("type","string",!1,'"total" makes a total bar')],ea=[re,Y],ta=[y("x","string",!0,"Column field"),y("series","string",!0,"Stacked series field"),Y],na=[y("x","string",!0,"Column field"),y("y","string",!0,"Row field"),Y],ra=[y("axis","string",!0,"Metric (axis) field"),y("value","number",!0,"Value field",{multi:!0}),y("series","string",!1,"Series field")],oa=[y("x","number",!0,"x value"),y("y","number",!0,"y value"),y("size","number",!1,"Circle size"),y("label","string",!1,"Name")],Yn=y("upper","number",!1,"Upper bound of the range band. Same shape as lower",{multi:!0}),aa=[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}),Yn],ia=[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}),Yn],sa=[y("x","any",!0,"x field"),y("y","number",!0,"y field",{multi:!0}),y("series","string",!1,"Series field")],la=[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})],ca=[re,Y],ua=[y("value","number",!0,"Value field",{prop:"valueKey"}),y("target","number",!1,"Target field",{prop:"targetKey"})],ma=[re,y("value","number",!0,"Actual value field"),y("target","number",!1,"Target field")],da=[y("x","any",!1,"x field"),y("y","number",!0,"y field")],fa=[re,y("x","string",!1,"Period field (long tables)"),y("value","number",!1,"Value field (long tables)")],ha=[re,y("start","number",!0,"Before value"),y("end","number",!0,"After value")],ga=[re,Y],pa=[y("value","number",!0,"Value field"),y("group","string",!1,"Group (row) field"),y("label","string",!1,"Dot name")],ba=[y("group","string",!0,"Group field"),y("value","number",!0,"Value field")],ya=[y("source","string",!0,"Source node"),y("target","string",!0,"Target node"),Y],xa=[y("source","string",!0,"Sending group"),y("target","string",!0,"Receiving group"),Y],ka=[y("date","date",!0,"Date field"),Y],wa=[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)")],va=[y("group","string",!0,"Group field"),y("value","number",!0,"Value field")],$a=[y("label","string",!1,"Row name field")],Ma=[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")],Ta=[re,Y],Ca=[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})],Sa=[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)")],Aa=[y("region","string",!0,"Region name or code, matched to a tile of options.map"),Y],Na=[re,Y,y("frame","any",!0,"Time step field: a year, a date or any ordered key. Numbers and dates play in order, other text in the order it first appears. An item with no value in a step leaves the bars for that step")],Ra=[y("source","string",!0,"Source node"),y("target","string",!0,"Target node"),y("value","number",!1,"Link weight. Without it every row counts 1")],Fa=[y("label","string",!0,"Row name. Items with the same name share a row"),y("start","any",!0,"Start: a number (minutes, seconds, any unit) or a date or date-time"),y("end","any",!0,"End, same kind as start. Equal to start draws a point event; empty means still open"),y("group","string",!1,"Group field (one color per group, and the legend)"),y("status","string",!1,"State of the item, written inside the bar and in the tooltip. Without group it also colors the bars and makes the legend, so a row of consecutive states reads as a status strip")],_a=[y("label","string",!0,"Node name field"),y("value","number",!1,"Value field. Sizes the dots; values add up from the leaves"),y("group","string",!1,"Parent group field (flat rows, as in the treemap)"),y("id","string",!1,"Row id for id/parent rows. Defaults to the label"),y("parent","string",!1,"Parent id field. Each row is one node, and rows with an empty parent hang under the root")],Pa=[y("region","string",!0,"Region name or code, matched to a region of options.map"),Y],Da=[y("lon","number",!1,"Longitude (degrees)"),y("lat","number",!1,"Latitude (degrees)"),y("size","number",!1,"Value (circle area). Without it all circles match"),y("label","string",!1,"Place name"),y("region","string",!1,"Region of options.map, for rows without lon and lat"),y("group","string",!1,"Group field (one color per group)")],La=[y("source","string",!0,"Start: a name in options.places or a region"),y("target","string",!0,"End"),y("value","number",!1,"Amount. Without it each row counts 1")],Ea=[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")],Xn={pie:Uo,donut:Xo,funnel:Yo,waffle:qo,treemap:Jo,sunburst:Zo,waterfall:Qo,pareto:ea,marimekko:ta,heatmap:na,radar:ra,bubble:oa,line:aa,area:ia,stream:sa,bar:la,radialBar:ca,gauge:ua,bullet:ma,sparkline:da,slope:fa,dumbbell:ha,lollipop:ga,beeswarm:pa,ridgeline:ba,sankey:ya,chord:xa,calendar:ka,bump:wa,box:va,parallel:$a,candlestick:Ma,segmented:Ta,skyline:Ca,histogram:Sa,scatter:Ea,tileMap:Aa,barRace:Na,network:Ra,timeline:Fa,tree:_a,choropleth:Pa,symbolMap:Da,flowMap:La},_e={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:"타일 격자 지도"},barRace:{component:"BarRace",name:"Bar race",nameKo:"막대 레이스"},network:{component:"NetworkChart",name:"Network",nameKo:"네트워크"},timeline:{component:"Timeline",name:"Timeline",nameKo:"타임라인"},tree:{component:"Tree",name:"Tree",nameKo:"트리"},choropleth:{component:"Choropleth",name:"Choropleth map",nameKo:"단계구분도"},symbolMap:{component:"SymbolMap",name:"Symbol map",nameKo:"기호 지도"},flowMap:{component:"FlowMap",name:"Flow map",nameKo:"흐름 지도"}};function qn(e,t){return t==="ko"?e.nameKo:e.name}function Jn(e,t){let n=t??e.options?.locale;return typeof n=="string"&&n?n.replace(/_/g,"-"):void 0}var Zn=["line","area","bar","scatter"],Qn=24,zt=["line","area","bar","scatter","timeline"];function Bt(e,t,n){return e==="bar"&&n.orientation!=="horizontal"&&n.layout!=="percent"&&n.layout!=="diverging"?[].concat(t.line??[]).map(String):[]}function er(e,t,n){return zt.includes(e)&&!Bt(e,t,n).length&&!(e==="scatter"&<(n))}function lt(e){return!!e&&typeof e=="object"&&e.bin==="hex"}function tr(e){let t=e.options?.tooltip?.template;return typeof t=="string"&&t?t:void 0}var Oa={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",barChartRace:"barRace",racingBar:"barRace",racingBars:"barRace",raceBar:"barRace",arcDiagram:"network",graph:"network",nodeLink:"network",gantt:"timeline",ganttChart:"timeline",schedule:"timeline",dendrogram:"tree",orgChart:"tree",treeChart:"tree",choroplethMap:"choropleth",filledMap:"choropleth",map:"choropleth",bubbleMap:"symbolMap",proportionalSymbolMap:"symbolMap",pointMap:"symbolMap",originDestination:"flowMap",odMap:"flowMap"};function ct(e){let t=Xn[e]?e:Oa[e]??Object.keys(_e).find(n=>n.toLowerCase()===e.toLowerCase()||_e[n].component.toLowerCase()===e.toLowerCase());if(!(!t||!_e[t]))return{type:t,component:_e[t].component,name:_e[t].name,nameKo:_e[t].nameKo,encoding:Xn[t]}}function nr(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 ct(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 rr(e,t){return Object.hasOwn(e,t)||t in e&&!(t in{})}function Ia(e,t){if(e==null||typeof e!="object")return;let n=e;if(rr(n,t))return n[t];if(t.includes(".")){let r=n;for(let o of t.split(".")){if(r===null||typeof r!="object"||!rr(r,o))return;r=r[o]}return r}}function ge(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 Te(e,t){if(typeof e=="function")return e;let n=e??t;return r=>Ia(r,n)}function Pe(e,t){let n=Te(e,t);return(r,o)=>ge(n(r,o))}function oe(e,t){let n=Te(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 ee(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}function za(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===`
|
|
22
|
+
`;function yn(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 xn(e,t){let[n]=(0,bn.useState)(!e.motion.enabled);return e.motion.enabled&&e.hydrated&&(!n||t.waiting||t.generation>0)}var pn=!1;function Ie(){if(pn||typeof document>"u"||(pn=!0,document.getElementById("ztd-base")))return;let e=document.createElement("style");e.id="ztd-base",e.textContent=Mo,document.head.appendChild(e)}var Xe=A(j(),1),se=typeof window<"u"&&typeof document<"u",he=se?Xe.useLayoutEffect:Xe.useEffect;function Ye(){return typeof performance<"u"?performance.now():Date.now()}function V(e){return e!==void 0&&/^ko([-_]|$)/i.test(e)?"ko":"en"}function ye(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}var kn={chart:"chart",table:e=>`${e} data`,more:e=>`and ${e} more`,value:"Value",empty:"No data."},wn={chart:"차트",table:e=>`${e} 데이터`,more:e=>`외 ${e}개`,value:"값",empty:"데이터가 없어요."};var To=[{id:"basic",en:"Basic",ko:"기본"},{id:"intermediate",en:"Intermediate",ko:"중급"},{id:"advanced",en:"Advanced",ko:"심화"}],Co={basic:{bg:"line2",fg:"ink"},intermediate:{bg:"tint",fg:"accentText"},advanced:{bg:"ink",fg:"onInk"}};function So(e,t){let n=t.trim().toLowerCase();return e.find(r=>r.id===n||r.en.toLowerCase()===n||r.ko===t.trim())}function Ao(e){return So(To,e)}function $n(e,t){let n=Ao(e);return{text:n?n[t]:e,...Co[n?.id??"basic"]}}var vn={white:"#ffffff",black:"#000000",transparent:"#00000000"};function Ne(e){if(!e)return null;let t=e.trim(),n=/^var\(\s*--[\w-]+\s*,\s*(.+)\)$/i.exec(t);if(n&&(t=n[1].trim()),vn[t.toLowerCase()]&&(t=vn[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 Cn(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 Tt(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 Re(e){let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Mn(e){return .2126*Re(e[0])+.7152*Re(e[1])+.0722*Re(e[2])}function Ct(e,t,n){let r=typeof e=="string"?Ne(e):e,o=typeof t=="string"?Ne(t):t;if(!r||!o)return 0;let a=n?typeof n=="string"?Ne(n):n:null;o[3]<1&&a&&(o=Tt(o,a));let i=r[3]<1?Tt(r,o):r,s=Mn(i),l=Mn(o);return(Math.max(s,l)+.05)/(Math.min(s,l)+.05)}function No(e){return[Re(e[0]),Re(e[1]),Re(e[2])]}function Mt(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 Tn(e){let[t,n,r]=No(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 Ro([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[Mt(4.0767416621*o-3.3077115913*a+.2309699292*i),Mt(-1.2684380046*o+2.6097574011*a-.3413193965*i),Mt(-.0041960863*o-.7034186147*a+1.707614701*i),r]}function Je(e,t,n){let r=Ne(e),o=Ne(t);if(!r||!o)return e;let a=Tn(r),i=Tn(o),s=Math.max(0,Math.min(1,n));return Cn(Ro([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 St(e,t,n){let r=t[0],o=-1;for(let a of t){let i=Ct(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 Fo(e,t){let n=St(t,[e.theme.ink,e.theme.onAccent,e.theme.onNeutralStrong]);return Ct(n,t)>=4.5?n===e.theme.ink?e.paint("ink"):n===e.theme.onAccent?e.paint("onAccent"):e.paint("onNeutralStrong"):St(t,["#FFFFFF","#000000"])}function qe(e,t){let n=Je(e.theme.neutralStrong,e.theme.neutral,t);return{role:"mix",fill:e.mix("neutralStrong","neutral",t),text:Fo(e,n),raw:n}}function le(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 At="mix:";function xe(e){return e({theme:kt,cssVars:!1,paint:n=>n,color:n=>n??"neutral",raw:n=>n??"neutral",mix:(n,r,o)=>`${At}${o}`}).map(n=>n.fill)}function Sn(e,t){return t?.startsWith(At)?e.mix("neutralStrong","neutral",Number(t.slice(At.length))):e.color(t)}function ze(e,t,n){return le(e,t+1,n).slice(0,t)}function An(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 Nn(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 ce=A(j(),1);var Qe=(e,t="")=>n=>Number.isFinite(n)?`${e(n)}${t}`:e(n),q="en-US",Rn=new Map;function Nt(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=Rn.get(r);return o||(o=new Intl.NumberFormat(e,n),Rn.set(r,o)),o}function Rt(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=q,...r}=t;return Rt(Nt(n,r).format(e))}var Ft=e=>e!==0&&Math.abs(e)<.05,_t=(e,t,n="")=>`${Fe(e,{locale:t,maximumSignificantDigits:2,maximumFractionDigits:20})}${n}`;function Ze(e,t={}){if(!Number.isFinite(e))return"-";if(Ft(e)&&t.maximumFractionDigits===void 0)return _t(e,t.locale??q,"%");let n=Math.abs(e);return`${Fe(e,{maximumFractionDigits:n>0&&n<1?1:0,...t})}%`}function Dn(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=q,...r}=t;if(V(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,f=Math.max(r.minimumFractionDigits??0,r.maximumFractionDigits??(s===1||c<100?1:0)),u=Math.round(c*10**f)/10**f;if(i>0&&u>=a[i-1][0]/s){i--;continue}return(e<0&&u!==0?"-":"")+Fe(u,{locale:n,...r,maximumFractionDigits:f})+l}}return Rt(Nt(n,{notation:"compact",...r}).format(e))}var _o=(e,t=V(e)==="ko"?"KRW":"USD")=>({style:"currency",currency:t,maximumFractionDigits:t==="KRW"?0:2});function Me(e,t=q,n){if(typeof e=="function")return e;let r=(o,a="",i="")=>{let s=Nt(t,o);return l=>Number.isFinite(l)?`${i}${Rt(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=>Dn(o,{locale:t});case"currency":return r(_o(t));default:{let o=r({maximumFractionDigits:1});return a=>Ft(a)?_t(a,t):o(a)}}}function Ln(e,t=q,n=0){return e!==void 0?Me(e,t):n>=1e5?r=>Ft(r)?_t(r,t):Dn(r,{locale:t}):r=>Fe(r,{locale:t})}function Po(e,t,n=1){let r=new Date(+e,+t-1,+n);return r.getMonth()===+t-1&&r.getDate()===+n?r:null}var Pt=e=>Number.isInteger(e)&&e>=1e3&&e<=9999,Do=/^\d{4}-\d{1,2}(-\d{1,2})?([T ][\d:.]+(Z|[+-]\d{2}:?\d{2})?)?$/,Lo=["january","february","march","april","may","june","july","august","september","october","november","december"],Fn=e=>{let t=e.toLowerCase();return t.length<3?0:Lo.findIndex(n=>n.startsWith(t))+1},_n=e=>+e+(+e<30?2e3:1900);function En(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}var Eo=[/^(\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})일)?$/],On=/^(\d{1,2})([./-])(\d{1,2})\2(\d{4})$/,In=/\{([^{}]+)\}/g;function et(e,t){let n;for(let r of Eo)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?[_n(n[3]),+n[2],+n[1],1]:[_n(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=On.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=Fn(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=Fn(n[1]);return r?[+n[3],r,+(n[2]??1),n[2]?1:2]:null}return null}var zn=e=>Do.test(e)||et(e)!==null;function Bn(e){let t;for(let n of e){let r=typeof n=="string"?On.exec(n.trim()):null;if(r){if(+r[1]>12)return!0;+r[3]>12&&(t=!1)}}return t}function tt(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(Pt(e))return new Date(e,0,1);if(e>=19000101&&e<=21001231)return tt(`${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=et(n,t);if(r)return Po(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 Pn=new Map;function Be(e,t={month:"short",day:"numeric"}){let n=tt(e);if(!n)return"-";let{locale:r=q,...o}=t,a=r+JSON.stringify(o),i=Pn.get(a);return i||(i=new Intl.DateTimeFormat(r,o),Pn.set(a,i)),i.format(n)}var Dt=A(L(),1),nt=(0,ce.createContext)({theme:be,cssVars:!0});function Oo(e,t=be){return e?typeof e=="string"?wt[e]??t:vt(t,e):t}function rt(e){let t=(0,ce.useContext)(nt),n=e.base?wt[e.base]:t.theme,r=(0,ce.useMemo)(()=>Oo(e.theme,n),[e.theme,n]),o=e.cssVars??t.cssVars,a=e.locale??t.locale,i=(0,ce.useMemo)(()=>({theme:r,cssVars:o,locale:a}),[r,o,a]),s=(0,ce.useMemo)(()=>$t(r),[r]),l=e.paint?{background:r.bg,color:r.ink,fontFamily:r.fontFamily,...s,...e.style}:{display:"contents",...s,...e.style};return(0,Dt.jsx)(nt.Provider,{value:i,children:(0,Dt.jsx)("div",{className:e.className,"data-ztd-theme":r.name,lang:e.locale,style:l,children:e.children})})}var Io=new Set(["bg","panel","ink","muted","dim","accent","accentText","onAccent","accent2","accent3","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"]);function jn(e){return Io.has(e)}function zo(e,t){let n=r=>t?`var(${Ue(r)}, ${e[r]})`:e[r];return{theme:e,cssVars:t,paint:n,color:(r,o="neutral")=>r?jn(r)?n(r):r:n(o),raw:(r,o="neutral")=>r?jn(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)})`:Je(e[r],e[o],a)}}}function ue(e){let t=(0,ce.useContext)(nt);return(0,ce.useMemo)(()=>{let n=vt(t.theme,e);return zo(n,t.cssVars)},[t.theme,t.cssVars,e])}function Z(e){let t=(0,ce.useContext)(nt);return e??t.locale??q}function Gn(e){return e?$t(e):{}}var ot=A(j(),1),Lt=(0,ot.createContext)(void 0);function Vn(e){let t=(0,ot.useContext)(Lt);return e!==void 0&&t!==void 0?`${e}:${t}`:e??t}var N=A(L(),1),Bo={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`},Ho={en:Bo,ko:{legend:"범례",replay:"애니메이션 다시 재생",replayTitle:"다시 재생",sample:"예시 데이터",loadError:"데이터를 불러오지 못했어요",retry:"다시 시도",loading:"불러오는 중",empty:"표시할 데이터가 없어요",source:"출처",shown:(e,t)=>`${t}개 중 ${e}개 보임`}};var jo={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},Et=e=>Ho[V(Z(e))];function Ot(e){let t=ue(e.theme),n=Et(e.locale),[r,o]=(0,at.useState)(!1),a=e.size??11.5,i=e.onToggle,s=new Set(i?e.hidden:void 0),l=e.items.filter(f=>!s.has(f.label)).length,c=(0,N.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((f,u)=>{let h=!s.has(f.label),d=h&&l===1,m=(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(Go,{p:t,item:f,off:!h}),(0,N.jsx)("span",{style:h?void 0:{textDecoration:"line-through"},children:f.label})]});return(0,N.jsx)("li",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:a,color:t.paint("muted"),lineHeight:1.3},children:i?(0,N.jsx)("button",{type:"button",className:"ztd-btn","aria-pressed":h,"aria-disabled":d||void 0,onClick:()=>{d||(i(f.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:m}):m},u)})});return i?(0,N.jsxs)(N.Fragment,{children:[c,(0,N.jsx)("span",{"aria-live":"polite","aria-atomic":"true",style:jo,children:r?n.shown(l,e.items.length):""})]}):c}function Go({p:e,item:t,off:n}){let r=Sn(e,t.color),o=t.shape??"square";return o==="line"||o==="dash"?(0,N.jsxs)("svg",{width:14,height:8,"aria-hidden":"true",style:{flex:"none",opacity:n?.35:void 0},children:[(0,N.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,N.jsx)("circle",{cx:7,cy:4,r:2.2,fill:r}):null]}):(0,N.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 Vo(e){let t=ue(e.theme),n=$n(e.level,V(Z(e.locale)));return(0,N.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 Wo(e,t,n){if(typeof e!="string"||!t)return e;let r=e.indexOf(t);return r<0?e:(0,N.jsxs)(N.Fragment,{children:[e.slice(0,r),(0,N.jsx)("span",{style:{color:n},children:t}),e.slice(r+t.length)]})}function Wn(e){let t=ue(e.theme),n=Et(e.locale),[r,o]=(0,at.useState)(0);he(()=>Ie(),[]);let a=()=>{o(h=>h+1),e.onReplay?.()},i=Array.isArray(e.legend)?(0,N.jsx)(Ot,{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,f=e.source!==void 0||e.note!==void 0?(0,N.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,N.jsxs)("footer",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,marginTop:2},children:[(0,N.jsx)("span",{style:{fontSize:17,fontWeight:800,color:t.paint("ink"),letterSpacing:-.3,lineHeight:1.3,minWidth:0},children:e.takeaway}),(0,N.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:8,flex:"none"},children:[e.sample?(0,N.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,N.jsx)(Vo,{level:e.level,theme:e.theme,locale:e.locale}):null]})]}):null;return(0,N.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,N.jsxs)("header",{style:{display:"flex",flexDirection:"column",gap:6,minWidth:0},children:[(0,N.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0},children:[l?(0,N.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,N.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:Wo(e.title,e.accent,t.paint("accentText"))}),e.actions,c?(0,N.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,N.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,N.jsx)("path",{d:"M3 12a9 9 0 1 0 3-6.7"}),(0,N.jsx)("path",{d:"M3 3v6h6"})]})}):null]}),e.subtitle!==void 0||i?(0,N.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"4px 12px",flexWrap:"wrap",minHeight:18},children:[e.subtitle!==void 0?(0,N.jsx)("span",{style:{fontSize:12.5,color:t.paint("muted"),lineHeight:1.4},children:e.subtitle}):(0,N.jsx)("span",{}),i]}):null]}),(0,N.jsx)("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",minHeight:0,minWidth:0},children:(0,N.jsx)(Lt.Provider,{value:r,children:(0,N.jsx)(Ae.Provider,{value:typeof e.title=="string"||typeof e.title=="number"?String(e.title):void 0,children:e.children})})}),f?(0,N.jsxs)(N.Fragment,{children:[f,u]}):u]})}function It(e){let t=ue(e.theme),n=Et(e.locale),r=e.height??220;if(he(()=>Ie(),[]),e.error){let o=typeof e.error=="string"?e.error:e.error.message;return(0,N.jsx)("div",{role:"alert",style:{height:r,display:"grid",placeItems:"center",textAlign:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,N.jsxs)("div",{style:{display:"grid",gap:8,justifyItems:"center",padding:16},children:[(0,N.jsx)("span",{style:{fontSize:14,fontWeight:700,color:t.paint("ink")},children:n.loadError}),(0,N.jsx)("span",{style:{fontSize:12,color:t.paint("muted"),maxWidth:280,wordBreak:"break-word"},children:o}),e.onRetry?(0,N.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,N.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,N.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,N.jsx)("div",{style:{height:r,display:"grid",placeItems:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,N.jsx)("span",{style:{fontSize:13,color:t.paint("muted")},children:e.emptyText??n.empty})}):(0,N.jsx)(N.Fragment,{children:e.children})}var Ee=A(j(),1);var Q=A(j(),1);var B=A(L(),1),it=60;var st={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};function Kn(e){let{c:t,events:n}=e,r=(0,Q.useId)().replace(/:/g,""),o=`${r}t`,a=`${r}d`;t.events.current=n,he(()=>{Ie()},[]);let i=n.length,s=!e.noNav&&i>0,l=(0,Q.useContext)(Ae),c=e.ariaLabel??l??e.kind,f=(0,Q.useMemo)(()=>s?`${n.length}${n.slice(0,it).map(x=>`${x.label}${x.series??""}${x.formatted??x.value??""}`).join("")}`:"",[n,s]),u=(0,Q.useMemo)(()=>(0,B.jsx)(Ko,{label:c,events:n,t:t.t}),[c,f,t.t]),h=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{let x=()=>{h.current=null};return window.addEventListener("scroll",x,{capture:!0,passive:!0}),window.addEventListener("resize",x,{passive:!0}),()=>{window.removeEventListener("scroll",x,{capture:!0}),window.removeEventListener("resize",x)}},[]),(0,Q.useEffect)(()=>{h.current=null},[t.width,t.height]);let d=x=>{if(x.target!==x.currentTarget)return;if(e.onKey?.(x)){x.preventDefault();return}let T=t.active,R;switch(x.key){case"ArrowRight":case"ArrowDown":R=T===null?0:(T+1)%i;break;case"ArrowLeft":case"ArrowUp":R=T===null?i-1:(T-1+i)%i;break;case"Home":R=0;break;case"End":R=i-1;break;case"Escape":if(T===null)return;R=null;break;case"Enter":case" ":T!==null&&(x.preventDefault(),t.click(T));return;default:return}x.preventDefault(),t.setActive(R,"keyboard")},{via:m,node:g,setActive:w}=t;(0,Q.useEffect)(()=>{if(m!=="touch"||!g)return;let x=T=>{g.contains(T.target)||w(null)};return document.addEventListener("pointerdown",x),()=>document.removeEventListener("pointerdown",x)},[m,g,w]);let k=t.active!==null?n[t.active]:null,v=t.showTooltip&&e.renderTip!==!1&&!t.pending&&t.via!=="sync"?e.tip:null,M=v&&!t.responsive&&t.node&&t.width&&t.node.getBoundingClientRect().width/t.width||1,S=typeof e.renderTip=="function"&&k?e.renderTip(k):null,b=e.announce??(t.via==="keyboard"&&k?`${k.label}${k.series?` ${k.series}`:""}: ${k.formatted??k.value??""} (${(t.active??0)+1}/${i})`:""),C;if(v){let x=v.x*M,T=t.width*M,R=`clamp(${(4-x).toFixed(1)}px, -50%, calc(${(T-x-4).toFixed(1)}px - 100%))`,P=v.y<64;C={position:"absolute",left:x,top:v.y*M,transform:`translate(${R}, ${P?"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*M-8)}}let F=x=>{h.current=null,x.pointerType!=="touch"&&t.via!=="keyboard"&&t.setActive(null)},D=x=>x?T=>{let R=h.current??(h.current=T.currentTarget.getBoundingClientRect());R.width&&x((T.clientX-R.left)/R.width*t.width,(T.clientY-R.top)/R.height*t.height,T)}:void 0,E=D(e.onPointerMove),O=D(e.onPointerDown),_=E||O?x=>{x.pointerType==="touch"&&E?.(x),O?.(x)}:void 0,p=D(e.onPointerUp),$=Gn(e.theme);return(0,B.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?d:void 0,onBlur:x=>{t.via==="keyboard"&&!x.currentTarget.contains(x.relatedTarget)&&t.setActive(null)},onPointerLeave:F,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"),...$,...e.style},children:[t.pending?null:e.underlay,(0,B.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:_,onPointerUp:p,onPointerCancel:p,style:{fontFamily:"inherit",touchAction:"pan-y",position:e.underlay?"relative":void 0},children:[(0,B.jsx)("title",{id:o,children:c}),(0,B.jsx)("desc",{id:a,children:i||t.description!==void 0?e.description:e.emptyText??t.t.empty}),e.defs&&!t.pending?(0,B.jsx)("defs",{children:e.defs}):null,t.pending?null:e.children]}),t.pending?null:e.overlay,v?(0,B.jsx)("div",{className:"ztd-tip","aria-hidden":"true",style:C,children:S??(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("div",{style:{fontWeight:600,fontSize:11.5,color:t.p.paint("muted"),marginBottom:v.rows.length?4:0,overflow:"hidden",textOverflow:"ellipsis"},children:v.title}),v.rows.map((x,T)=>(0,B.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:16,justifyContent:"space-between"},children:[(0,B.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:7,color:t.p.paint(x.strong?"ink":"muted")},children:[x.color?(0,B.jsx)("span",{style:{width:8,height:8,borderRadius:999,background:x.color,display:"inline-block",boxShadow:"inset 0 0 0 1px rgba(127,127,127,0.3)"}}):null,x.label]}),(0,B.jsx)("span",{style:{fontWeight:x.strong===!1?500:700},children:x.value})]},T))]})}):null,(0,B.jsx)("span",{className:"ztd-sr",style:st,"aria-live":"polite","aria-atomic":"true",children:b}),s&&!t.pending?u:null]})}function Ko({label:e,events:t,t:n}){return(0,B.jsx)("div",{className:"ztd-sr",style:st,children:(0,B.jsxs)("table",{children:[(0,B.jsx)("caption",{children:n.table(e)}),(0,B.jsxs)("tbody",{children:[t.slice(0,it).map((r,o)=>(0,B.jsxs)("tr",{children:[(0,B.jsx)("th",{scope:"row",children:r.series?`${r.label} · ${r.series}`:r.label}),(0,B.jsx)("td",{children:r.formatted??r.value??""})]},o)),t.length>it?(0,B.jsx)("tr",{children:(0,B.jsx)("td",{colSpan:2,children:n.more(t.length-it)})}):null]})]})})}function Un(e){let t=e.baseline??"central";return(0,B.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}),re=y("label","string",!0,"Item name field"),Y=y("value","number",!0,"Value field"),Uo=[re,Y],Xo=[re,Y],Yo=[y("label","string",!0,"Stage name"),y("value","number",!0,"Users at the stage")],Jo=[re,Y],qo=[y("label","string",!0,"Leaf (lowest level) name"),Y,y("group","string",!1,"Parent group field")],Zo=[y("label","string",!0,"Leaf name"),Y,y("group","string",!1,"Parent group field")],Qo=[re,y("value","number",!0,"Change (total rows may omit it)"),y("type","string",!1,'"total" makes a total bar')],ea=[re,Y],ta=[y("x","string",!0,"Column field"),y("series","string",!0,"Stacked series field"),Y],na=[y("x","string",!0,"Column field"),y("y","string",!0,"Row field"),Y],ra=[y("axis","string",!0,"Metric (axis) field"),y("value","number",!0,"Value field",{multi:!0}),y("series","string",!1,"Series field")],oa=[y("x","number",!0,"x value"),y("y","number",!0,"y value"),y("size","number",!1,"Circle size"),y("label","string",!1,"Name")],Yn=y("upper","number",!1,"Upper bound of the range band. Same shape as lower",{multi:!0}),aa=[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}),Yn],ia=[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}),Yn],sa=[y("x","any",!0,"x field"),y("y","number",!0,"y field",{multi:!0}),y("series","string",!1,"Series field")],la=[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})],ca=[re,Y],ua=[y("value","number",!0,"Value field",{prop:"valueKey"}),y("target","number",!1,"Target field",{prop:"targetKey"})],ma=[re,y("value","number",!0,"Actual value field"),y("target","number",!1,"Target field")],da=[y("x","any",!1,"x field"),y("y","number",!0,"y field")],fa=[re,y("x","string",!1,"Period field (long tables)"),y("value","number",!1,"Value field (long tables)")],ha=[re,y("start","number",!0,"Before value"),y("end","number",!0,"After value")],ga=[re,Y],pa=[y("value","number",!0,"Value field"),y("group","string",!1,"Group (row) field"),y("label","string",!1,"Dot name")],ba=[y("group","string",!0,"Group field"),y("value","number",!0,"Value field")],ya=[y("source","string",!0,"Source node"),y("target","string",!0,"Target node"),Y],xa=[y("source","string",!0,"Sending group"),y("target","string",!0,"Receiving group"),Y],ka=[y("date","date",!0,"Date field"),Y],wa=[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)")],$a=[y("group","string",!0,"Group field"),y("value","number",!0,"Value field")],va=[y("label","string",!1,"Row name field")],Ma=[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")],Ta=[re,Y],Ca=[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})],Sa=[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)")],Aa=[y("region","string",!0,"Region name or code, matched to a tile of options.map"),Y],Na=[re,Y,y("frame","any",!0,"Time step field: a year, a date or any ordered key. Numbers and dates play in order, other text in the order it first appears. An item with no value in a step leaves the bars for that step")],Ra=[y("source","string",!0,"Source node"),y("target","string",!0,"Target node"),y("value","number",!1,"Link weight. Without it every row counts 1")],Fa=[y("label","string",!0,"Row name. Items with the same name share a row"),y("start","any",!0,"Start: a number (minutes, seconds, any unit) or a date or date-time"),y("end","any",!0,"End, same kind as start. Equal to start draws a point event; empty means still open"),y("group","string",!1,"Group field (one color per group, and the legend)"),y("status","string",!1,"State of the item, written inside the bar and in the tooltip. Without group it also colors the bars and makes the legend, so a row of consecutive states reads as a status strip")],_a=[y("label","string",!0,"Node name field"),y("value","number",!1,"Value field. Sizes the dots; values add up from the leaves"),y("group","string",!1,"Parent group field (flat rows, as in the treemap)"),y("id","string",!1,"Row id for id/parent rows. Defaults to the label"),y("parent","string",!1,"Parent id field. Each row is one node, and rows with an empty parent hang under the root")],Pa=[y("region","string",!0,"Region name or code, matched to a region of options.map"),Y],Da=[y("lon","number",!1,"Longitude (degrees)"),y("lat","number",!1,"Latitude (degrees)"),y("size","number",!1,"Value (circle area). Without it all circles match"),y("label","string",!1,"Place name"),y("region","string",!1,"Region of options.map, for rows without lon and lat"),y("group","string",!1,"Group field (one color per group)")],La=[y("source","string",!0,"Start: a name in options.places or a region"),y("target","string",!0,"End"),y("value","number",!1,"Amount. Without it each row counts 1")],Ea=[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")],Xn={pie:Uo,donut:Xo,funnel:Yo,waffle:Jo,treemap:qo,sunburst:Zo,waterfall:Qo,pareto:ea,marimekko:ta,heatmap:na,radar:ra,bubble:oa,line:aa,area:ia,stream:sa,bar:la,radialBar:ca,gauge:ua,bullet:ma,sparkline:da,slope:fa,dumbbell:ha,lollipop:ga,beeswarm:pa,ridgeline:ba,sankey:ya,chord:xa,calendar:ka,bump:wa,box:$a,parallel:va,candlestick:Ma,segmented:Ta,skyline:Ca,histogram:Sa,scatter:Ea,tileMap:Aa,barRace:Na,network:Ra,timeline:Fa,tree:_a,choropleth:Pa,symbolMap:Da,flowMap:La},_e={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:"타일 격자 지도"},barRace:{component:"BarRace",name:"Bar race",nameKo:"막대 레이스"},network:{component:"NetworkChart",name:"Network",nameKo:"네트워크"},timeline:{component:"Timeline",name:"Timeline",nameKo:"타임라인"},tree:{component:"Tree",name:"Tree",nameKo:"트리"},choropleth:{component:"Choropleth",name:"Choropleth map",nameKo:"단계구분도"},symbolMap:{component:"SymbolMap",name:"Symbol map",nameKo:"기호 지도"},flowMap:{component:"FlowMap",name:"Flow map",nameKo:"흐름 지도"}};function Jn(e,t){return t==="ko"?e.nameKo:e.name}function qn(e,t){let n=t??e.options?.locale;return typeof n=="string"&&n?n.replace(/_/g,"-"):void 0}var Zn=["line","area","bar","scatter"],Qn=24,zt=["line","area","bar","scatter","timeline"];function Bt(e,t,n){return e==="bar"&&n.orientation!=="horizontal"&&n.layout!=="percent"&&n.layout!=="diverging"?[].concat(t.line??[]).map(String):[]}function er(e,t,n){return zt.includes(e)&&!Bt(e,t,n).length&&!(e==="scatter"&<(n))}function lt(e){return!!e&&typeof e=="object"&&e.bin==="hex"}function tr(e){let t=e.options?.tooltip?.template;return typeof t=="string"&&t?t:void 0}var Oa={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",barChartRace:"barRace",racingBar:"barRace",racingBars:"barRace",raceBar:"barRace",arcDiagram:"network",graph:"network",nodeLink:"network",gantt:"timeline",ganttChart:"timeline",schedule:"timeline",dendrogram:"tree",orgChart:"tree",treeChart:"tree",choroplethMap:"choropleth",filledMap:"choropleth",map:"choropleth",bubbleMap:"symbolMap",proportionalSymbolMap:"symbolMap",pointMap:"symbolMap",originDestination:"flowMap",odMap:"flowMap"};function ct(e){let t=Xn[e]?e:Oa[e]??Object.keys(_e).find(n=>n.toLowerCase()===e.toLowerCase()||_e[n].component.toLowerCase()===e.toLowerCase());if(!(!t||!_e[t]))return{type:t,component:_e[t].component,name:_e[t].name,nameKo:_e[t].nameKo,encoding:Xn[t]}}function nr(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 ct(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 rr(e,t){return Object.hasOwn(e,t)||t in e&&!(t in{})}function Ia(e,t){if(e==null||typeof e!="object")return;let n=e;if(rr(n,t))return n[t];if(t.includes(".")){let r=n;for(let o of t.split(".")){if(r===null||typeof r!="object"||!rr(r,o))return;r=r[o]}return r}}function ge(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 Te(e,t){if(typeof e=="function")return e;let n=e??t;return r=>Ia(r,n)}function Pe(e,t){let n=Te(e,t);return(r,o)=>ge(n(r,o))}function oe(e,t){let n=Te(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 ee(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}function za(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
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 Ba=/^[-+(]?[₩$€£¥]?\s?\d[\d,]*(\.\d+)?([eE][-+]?\d+)?\)?\s?(%|원|명|건|개|회)?$/;function or(e){let t=e.trim();if(t==="")return null;if(/^-?0\d/.test(t))return t;if(Ba.test(t)||/^[-+]?\.\d+$/.test(t)){let n=ge(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??za(o),i=[],s=[],l="",c=!1;for(let m=0;m<o.length;m++){let g=o[m];c?g==='"'?o[m+1]==='"'?(l+='"',m++):c=!1:l+=g:g==='"'&&!l.trim()?(c=!0,l=""):g===a?(s.push(l),l=""):g===`
|
|
24
24
|
`||g==="\r"?(g==="\r"&&o[m+1]===`
|
|
25
|
-
`&&m++,s.push(l),i.push(s),s=[],l=""):l+=g}(l!==""||s.length)&&(s.push(l),i.push(s));let f=i.filter(m=>!(m.length===1&&m[0].trim()===""));if(!f.length)return[];let u=m=>n?or(m):m;if(!r)return f.map(m=>Object.fromEntries(m.map((g,w)=>[String(w),u(g)])));let h=[],d=new Set;return f[0].forEach((m,g)=>{let w=m.trim()||`col${g+1}`,k=w;for(let $=2;d.has(k);$++)k=`${w}_${$}`;d.add(k),h.push(k)}),f.slice(1).map(m=>Object.fromEntries(h.map((g,w)=>[g,u(m[w]??"")])))}function Ht(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"?or(i[l]):i[l]??null])))}function Ha(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 ar(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 ke(e){if(e==null)return[];if(typeof e=="string"){let t=e.trim();if(!t)return[];if(t.startsWith("[")||t.startsWith("{"))try{return ke(JSON.parse(t))}catch{}return Ce(t)}if(Array.isArray(e))return e.length?Array.isArray(e[0])?Ht(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)?ke(t.data):Array.isArray(t.rows)&&Array.isArray(t.columns)?Ht(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)?ke(t.rows):Array.isArray(t.values)?Ht(t.values):Array.isArray(t.items)?ke(t.items):Array.isArray(t.results)?ke(t.results):Ha(t)}return[]}function ut(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 jt(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 f=e[l][c];return Number.isFinite(f)&&f>0?f: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 f=0,u=0;for(let h=0;h<n;h++){let d=i(h,c),m=d-i(h,c-1),g=0;for(let w=0;w<h;w++)g+=i(w,c)-i(w,c-1);f+=d,u+=(m/2+g)*d}f&&(l-=u/f),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 m=e[d][l],g=Number.isFinite(m)?m:0;g>=0?(o[d][l]=u,u+=g,a[d][l]=u):(o[d][l]=h,h+=g,a[d][l]=h)}continue}let c=0;for(let u=0;u<n;u++)c+=i(u,l);let f=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]=f,f+=h,a[u][l]=f}}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 f=0;for(let u=0;u<r;u++)f+=((o[0]?.[u]??0)+(a[n-1]?.[u]??0))/2;f/=r;for(let u=0;u<n;u++)for(let h=0;h<r;h++)o[u][h]-=f,a[u][h]-=f}return{y0:o,y1:a}}function ir(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 sr(e){let t=e.length,n=e.map(c=>{let f=0,u=-1/0;return c.forEach((h,d)=>{h>u&&(u=h,f=d)}),f}),r=e.map(c=>c.reduce((f,u)=>f+(Number.isFinite(u)?u:0),0)),o=Array.from({length:t},(c,f)=>f).sort((c,f)=>n[c]-n[f]),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 we=Math.PI*2;function lr(e){let t=0;for(let n of e)Number.isFinite(n)&&(t+=n);return t}function I(e){return Math.round(e*100)/100}function te(e,t,n,r){return[e+n*Math.sin(r),t-n*Math.cos(r)]}function Gt(e,t,n,r,o,a){let i=a-o;if(!(Math.abs(i)>1e-4)||r<=0)return"";if(Math.abs(i)>=we-1e-4){let $=(M,S)=>{let[b,C]=te(e,t,M,o),[F,D]=te(e,t,M,o+Math.PI);return`M${I(b)},${I(C)}A${I(M)},${I(M)} 0 1 ${S} ${I(F)},${I(D)}A${I(M)},${I(M)} 0 1 ${S} ${I(b)},${I(C)}Z`};return n>0?`${$(r,1)}${$(n,0)}`:$(r,1)}let l=i>0?1:0,c=Math.abs(i)>Math.PI?1:0,[f,u]=te(e,t,r,o),[h,d]=te(e,t,r,a);if(n<=0)return`M${I(e)},${I(t)}L${I(f)},${I(u)}A${I(r)},${I(r)} 0 ${c} ${l} ${I(h)},${I(d)}Z`;let[m,g]=te(e,t,n,a),[w,k]=te(e,t,n,o);return`M${I(f)},${I(u)}A${I(r)},${I(r)} 0 ${c} ${l} ${I(h)},${I(d)}L${I(m)},${I(g)}A${I(n)},${I(n)} 0 ${c} ${1-l} ${I(w)},${I(k)}Z`}function cr(e){let t=-1,n=-1/0;return e.forEach((r,o)=>{r>n&&(n=r,t=o)}),t}function ja(e){return e>=44032&&e<=55203||e>=4352&&e<=4607||e>=12592&&e<=12687||e>=19968&&e<=40959}function ur(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 mt=new Map;function Se(e,t,n=400){let r=String(e),o=`${r}|${n>=600?1:0}`,a=mt.get(o);if(a===void 0){let i=0,s=0;for(let l=0;l<r.length;l++){let c=r.charCodeAt(l);ja(c)?i+=ur(c):s+=ur(c)}a=i+s*(n>=600?1.07:1),mt.size>5e3&&mt.clear(),mt.set(o,a)}return a*t}var dr=A(L(),1),Ga=e=>Array.isArray(e)&&e.length===2;function mr(e){let t=[];for(let n of e??[])n.type==="line"&&typeof n.y=="number"?t.push(n.y):n.type==="band"&&Ga(n.y)&&t.push(Number(n.y[0]),Number(n.y[1]));return t.filter(Number.isFinite)}var hr=A(L(),1),Vt=10.5;function Va(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 fr(e,t,n){let r=18;for(let o of Va(e,t,n))r=Math.max(r,Se(o,Vt));return Math.ceil(r+8)}function Wt(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=Wt(i,n),c=[o,a];for(let f=0;f<4;f++){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 d=Wt(c[1]-c[0],n);if(d===l)break;l=d}return c}function gr(e,t,n=4){let r=Math.min(e,t),o=Math.max(e,t),a=Wt(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 Kt(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)=>gr(n,r,l),s}function Ut(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 Wa(e,t,n){let r=Math.log10(e),o=Math.log10(t),a=n/Math.max(1e-9,o-r),i=(c,f=1)=>{let u=[];for(let h=Math.floor(r);h<=Math.ceil(o);h++)if(!(h%f))for(let d of c){let m=Number((d*10**h).toPrecision(12));m>=e*(1-1e-9)&&m<=t*(1+1e-9)&&u.push(m)}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:gr(e,t,3)}function pr(e,t){let n=Kt([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=()=>Wa(e[0],e[1],Math.abs(t[1]-t[0])),r}function He(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 Ka=864e5;function br(e,t,n,r=J){let o=t-e;if(!(o>0))return[{t:e,label:Be(e,{locale:r,month:"short",day:"numeric"})}];let a=o/Ka,i=[],s=new Date(e),l=new Date(e).getFullYear()===new Date(t).getFullYear(),c=(f,u,h,d=!1)=>{let m=new Date(f),g=-1,w=0;for(;m.getTime()<=t&&w++<500;){if(m.getTime()>=e){let k=m.getFullYear(),$=d&&!l&&k!==g;i.push({t:m.getTime(),label:Be(m,{locale:r,...h,...$?{year:"numeric"}:{}})}),g=k}u(m)}};if(a<=1.5){let f=Math.max(1,Math.ceil(o/36e5/Math.max(1,n))),u=[1,2,3,4,6,12].find(d=>d>=f)??12,h=new Date(s);h.setMinutes(0,0,0),c(h,d=>d.setHours(d.getHours()+u),{hour:"numeric"})}else if(a<=n*1.2){let f=new Date(s.getFullYear(),s.getMonth(),s.getDate());c(f,u=>u.setDate(u.getDate()+1),{month:"numeric",day:"numeric"})}else if(a<=n*7*1.2){let f=new Date(s.getFullYear(),s.getMonth(),s.getDate());f.setDate(f.getDate()+(8-f.getDay())%7),c(f,u=>u.setDate(u.getDate()+7),{month:"numeric",day:"numeric"})}else{let f=a/30.44,u=Math.max(1,Math.ceil(f/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,m=>m.setFullYear(m.getFullYear()+h/12),{year:"numeric"})}else{let d=new Date(s.getFullYear(),s.getMonth()+(s.getDate()>1?1:0),1),m=d.getMonth()%h;m&&d.setMonth(d.getMonth()+(h-m)),c(d,g=>g.setMonth(g.getMonth()+h),{month:"short"},!0)}}return i}function yr(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 Ua=(e,t,n)=>e==="date"?tt(t,n)?.getTime()??NaN:ge(t);function Xa(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 je(e,t,n,r,o={}){let a=Te(t,"x"),i=Array.isArray(n),s=i?n:null,l=i?null:Te(n,"y"),c=!i&&r!==void 0?Te(r,"series"):null,f=e.map((v,x)=>a(v,x)),u=o.xType??Xa(f),h=o.locale??J,d,m,g;if(u==="band"){let v=f.map(T=>String(T??""));d=ee(v);let x=new Map(d.map((T,R)=>[T,R]));m=d.map((T,R)=>R),g=Int32Array.from(v,T=>x.get(T)??-1)}else{let v=u==="date"?o.dayFirst??Bn(f):void 0,x=f.map(P=>Ua(u,P,v)),T=Array.from(new Set(x.filter(P=>Number.isFinite(P)))).sort((P,G)=>P-G),R=new Map(T.map((P,G)=>[P,G]));m=T,d=T.map(String),g=Int32Array.from(x,P=>R.get(P)??-1)}let w=o.dateFormat,k=v=>typeof v=="string"?et(v.trim())?.[3]:void 0,$=u==="date"&&f.length<5e3?k(f[0]):void 0,M=($===2||$===3)&&f.every(v=>k(v)===$),S=M&&$===3;if(u==="date"&&!w){let v=m.length>1?m[m.length-1]-m[0]:0;w=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&&(w={year:"numeric",month:"short"})}let b;if(u==="band")b=d;else if(S&&!o.dateFormat){let v=V(h)==="ko";b=m.map(x=>{let T=new Date(x),R=Math.floor(T.getMonth()/3)+1;return v?`${T.getFullYear()}년 ${R}분기`:`Q${R} ${T.getFullYear()}`})}else{let v=m.every(Pt),x=u==="date"?new Intl.DateTimeFormat(h,w):new Intl.NumberFormat(h,v?{useGrouping:!1}:{maximumFractionDigits:6});b=m.length>1e3?yr(m.length,T=>x.format(m[T])):m.map(T=>x.format(T))}let C=s?[...s]:c?ee(e.map((v,x)=>String(c(v,x)??""))):[""],F=new Map(C.map((v,x)=>[v,x])),D=C.map(()=>new Array(d.length).fill(NaN)),E=C.map(()=>new Array(d.length).fill(null)),O=o.aggregate??"sum",_=O==="mean"?C.map(()=>new Uint32Array(d.length)):null,p=(v,x,T,R)=>{let P=D[v][x];O==="last"?D[v][x]=T:O==="count"?D[v][x]=(Number.isFinite(P)?P:0)+1:O==="mean"?Number.isFinite(T)&&(D[v][x]=(Number.isFinite(P)?P:0)+T,_[v][x]++):D[v][x]=Number.isFinite(P)?P+(Number.isFinite(T)?T:0):T,E[v][x]=R};for(let v=0;v<e.length;v++){let x=g[v];if(x<0)continue;let T=e[v];if(s)for(let R=0;R<s.length;R++)p(R,x,ge(T[s[R]]),T);else{let R=c?F.get(String(c(T,v)??""))??0:0;p(R,x,ge(l(T,v)),T)}}if(_)for(let v=0;v<D.length;v++)for(let x=0;x<d.length;x++)_[v][x]>1&&(D[v][x]/=_[v][x]);return{type:u,keys:d,xnum:m,labels:b,series:C,values:D,rows:E}}var Ya=140,Ve=12,xr=14,Xt=20,kr=12.5;function qa(e,t,n=Qn){let r=oe(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 Ja(e,t,n){if(t<1)return 1;let r=Math.max(1,Math.floor((e+Ve)/(Ya+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 Za(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 Ge=e=>e.filter(Number.isFinite);function dt(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 Ge(n)}function wr(e,t,n,r,o,a){return je(t,n.x,r,o,{xType:e==="bar"?"band":n.xType,aggregate:a,dayFirst:n.dayFirst})}function Qa(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 b=t.flat(),C=r.refLines??{},[F,D]=He([...dt(b,r.x??"x"),...Ge([Number(C.x)])]),[E,O]=He([...dt(b,r.y??"y"),...Ge([Number(C.y)])].filter(p=>!s||p>0)),_=r.zero??!1;return{y:c??(s?Ut(E,O,i):De(E,O,i,{zero:_,pad:.08})),x:r.xDomain??De(F,D,Math.max(2,Math.round(o/110)),{zero:_,pad:.06}),sameKeys:!0}}let f=e==="bar",u=f&&r.orientation==="horizontal",h=n[0]?.keys.join(""),d=n.every(b=>b.keys.join("")===h),m=n.length>0&&n.every(b=>b.type!=="band"&&b.type===n[0].type),g=r.xDomain??(!f&&m?He(n.flatMap(b=>Ge(b.xnum))):void 0),w=f?r.layout??"grouped":e==="area"?r.stack??"auto":"none";if(w==="percent")return{x:g,sameKeys:d};if(c)return{y:c,x:g,sameKeys:d};let k=[];t.forEach((b,C)=>{let F=n[C];if(w==="stacked"||w==="auto"&&F.series.length>1){let E=jt(F.values,"zero");E.y0.forEach(O=>k.push(...O)),E.y1.forEach(O=>k.push(...O))}else F.values.forEach(E=>k.push(...E));f&&!u&&r.line!==void 0&&wr(e,b,r,[].concat(r.line),void 0,r.series===void 0?r.aggregate:"mean").values.forEach(E=>k.push(...E)),f||k.push(...dt(b,r.lower),...dt(b,r.upper))}),f&&k.push(0),u||k.push(...mr(r.annotations));for(let b of r.referenceLines??[])k.push(b.y);r.signColors&&k.push(Number(r.baseline??0));let[$,M]=He(Ge(k).filter(b=>!s||b>0));return{y:s?Ut($,M,i):f?De($,M,u?Math.max(2,Math.round(o/120)):i):De($,M,i,{zero:r.zero??e==="area"}),x:g,sameKeys:d}}function ei(e,t,n,r,o,a,i,s){if(e!=="line"&&e!=="area"||!o.x||!o.y)return;let l=je(t.flat(),r.x,r.y,void 0,{xType:r.xType,locale:s,dayFirst:r.dayFirst}),c=(r.yScale==="log"&&e==="line"?pr:Kt)(o.y,[i-22,10]).ticks(Math.max(2,Math.round(i/70))),f=fr(c,Ln(r.format,s,Math.max(Math.abs(o.y[0]),Math.abs(o.y[1]))),s),u=n.flatMap(b=>b.series),h=r.endLabels??n.some(b=>b.series.length>1),d=f+6,m=a-(h?Math.min(a*.28,Math.max(...u.map(b=>Se(b,11,700)),20)+14):10),g=l.keys.length,[w,k]=o.x[1]===o.x[0]?[o.x[0],o.x[0]+1]:o.x,$=l.type==="number"?g>12:g>br(w,k,Math.max(2,Math.floor((m-d)/64)),s).length;if(l.type==="band"||!g||$)return;let M=b=>d+(l.xnum[b]-w)/(k-w)*(m-d),S=b=>Se(l.labels[b],Vt);for(let b=1;;b++){let C=Array.from({length:Math.ceil(g/b)},(F,D)=>D*b);if(b>=g||C.every((F,D)=>!D||M(F)-M(C[D-1])>=(S(F)+S(C[D-1]))/2+8))return C.map(F=>({value:l.xnum[F],label:l.labels[F]}))}}function ti(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 ni(e,t,n,r){let o=[n.x,n.y,n.series].map(a=>JSON.stringify(a??null)).join("|");return`ztd-facet-${ti(`${e}|${t}|${o}|${ut(r)}`)}`}function ri(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 oi={en:{intro:(e,t)=>`${ye(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:"(빈 값)"}},Yt=18;function vr(e){let{type:t,chartProps:n}=e,{values:r,groups:o,dropped:a}=qa(e.data,e.by),i=r.length,s=typeof e.width=="number"&&Number.isFinite(e.width)&&e.width>0?e.width:480,l=Ja(s,i,e.columns),{pw:c,ph:f}=Za(s,l,e.height),u=e.scale!=="free",h=t==="scatter"?[]:o.map(_=>wr(t,_,n,n.y,n.series,n.aggregate)),d=u?Qa(t,o,h,n,c,f):{sameKeys:!1},m=u?ei(t,o,h,n,d,c,f,e.locale):void 0,g=t==="bar"&&n.orientation==="horizontal",w=u&&(!g||d.sameKeys),k=u&&(g||d.x!==void 0||d.sameKeys),$=new Set(ri(e.highlight,r)?[e.highlight].flat():[]),M=$.size>0,S=t==="bar"&&!Array.isArray(n.y)&&n.series===void 0||t==="scatter"&&n.series===void 0,b=e.syncId??ni(t,e.by,n,e.data),C=Qe(Me(n.format,e.locale),n.unit),F=oi[e.lang],D=[],E=r.map(_=>_===""?F.blank:_);return{panels:r.map((_,p)=>{let v=o[p],x=E[p],T=p%l,R;if(t!=="scatter"){let G=h[p],fe=ie=>G.values.reduce((H,X)=>H+(Number.isFinite(X[ie])?X[ie]:0),0),z=G.keys.map((ie,H)=>H).filter(ie=>G.values.some(H=>Number.isFinite(H[ie]))),q=z[z.length-1];D.push({first:z.length?fe(z[0]):NaN,last:z.length?fe(q):NaN,total:z.reduce((ie,H)=>ie+fe(H),0)}),t!=="bar"&&G.series.length===1&&q!==void 0&&(R=C(G.values[0][q]))}else D.push({first:NaN,last:NaN,total:v.length});let P={data:v,width:c,height:f,ariaLabel:e.title?`${e.title}, ${x}`:x,syncId:b,highlight:M?$.has(_)?S?()=>!0:void 0:"none":e.highlight,showYAxis:!w||T===0,showXAxis:!k||p+l>=i};return d.y&&(P.yDomain=d.y),d.x&&(P.xDomain=d.x),m&&(P.xTicks=m),{value:_,label:x,props:P,last:R,isPicked:$.has(_)}}),cols:l,pw:c,ph:f,isPanelPick:M,description:ai(t,e.by,E,D,a,C,F)}}function ai(e,t,n,r,o,a,i){let s=i.intro(n.length,t),l=c=>cr(r.map(f=>f[c]));if(e==="line"||e==="area"){let c=l("last");c>=0&&(s+=i.endHigh(n[c],a(r[c].last)));let f=n.filter((u,h)=>r[h].last<r[h].first);s+=f.length?i.falling(`${f.slice(0,5).join(", ")}${f.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 ne=A(j(),1);function ii(e){return[...new Set([0,.01,.02,.05,.1,.15,.2,e].filter(t=>t<=e))].sort((t,n)=>t-n)}function si(e,t,n=1/0){let r=e.rootBounds?.height??window.innerHeight;return e.isIntersecting&&(e.intersectionRatio>=t||e.intersectionRect.height>=Math.min(r*.5,n))}var ft={threshold:.25,enoughPx:96,rootMargin:"0px"};function Tr(e,t=!0){let[n,r]=(0,ne.useState)({visible:!t,near:!t});return(0,ne.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=si(i[i.length-1],ft.threshold,ft.enoughPx);r(l=>l.visible===s?l:{...l,visible:s,near:l.near||s})},{threshold:ii(ft.threshold),rootMargin:ft.rootMargin}),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 $r(e){let t=e.getBoundingClientRect().width;return t>0?Math.round(t*10)/10:0}function ht(e){let[t,n]=(0,ne.useState)(null),[r,o]=(0,ne.useState)(e??null),a=(0,ne.useCallback)(i=>{n(i),i&&e===void 0&&o($r(i))},[e]);return he(()=>{if(e!==void 0){o(e);return}if(!t)return;let i=c=>o(f=>f!==null&&Math.abs(f-c)<.5?f:c),s=()=>i($r(t));if(typeof ResizeObserver>"u")return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s);let l=new ResizeObserver(c=>{let f=c[c.length-1]?.contentRect;f?i(f.width>0?Math.round(f.width*10)/10:0):s()});return l.observe(t),()=>l.disconnect()},[t,e]),[t,a,r]}var li=()=>()=>{};function Le(){return(0,ne.useSyncExternalStore)(li,()=>!0,()=>!1)}var Mr="(prefers-reduced-motion: reduce)";function gt(e="auto"){let[t,n]=(0,ne.useState)(()=>se&&typeof window.matchMedia=="function"?window.matchMedia(Mr).matches:!1);return(0,ne.useEffect)(()=>{if(e!=="auto"||!se||typeof window.matchMedia!="function")return;let r=window.matchMedia(Mr),o=()=>n(r.matches);return o(),r.addEventListener?.("change",o),()=>r.removeEventListener?.("change",o)},[e]),e===!0?!0:e===!1?!1:t}var me=A(L(),1),ci=60,ui=420;function Cr(e){let t=ue(),n=e.chartProps??{},[,r,o]=ht(e.width),a=e.width??(o||480),i=Z(e.locale??n.locale),s=V(i),l=(0,Ee.useContext)(Ae),c=e.title??l,f=e.chart.facetPlan,u=(0,Ee.useMemo)(()=>{let k=vr({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});return f?f(k,n,i):k},[e.type,e.data,e.by,e.columns,e.scale,JSON.stringify(n,(k,$)=>typeof $=="function"?String($):$),e.highlight,e.syncId,a,e.height,c,i,s,f]),h=`${(0,Ee.useId)().replace(/:/g,"")}fd`,d=gt(n.reducedMotion??"auto"),m=Le(),g=xn({motion:{enabled:n.animate!==!1&&!d&&se},hydrated:m},{waiting:!1,generation:0}),w=e.chart;return(0,me.jsxs)("div",{ref:r,role:"group","aria-label":c,"aria-describedby":h,className:e.className,style:{position:"relative",width:"100%",...e.style},children:[(0,me.jsx)("p",{id:h,style:st,children:e.description??u.description}),(0,me.jsx)("div",{style:{display:"grid",gridTemplateColumns:`repeat(${u.cols}, minmax(0, 1fr))`,columnGap:Ve,rowGap:xr,...u.legend?{marginTop:Yt}:null},children:u.panels.map((k,$)=>{let M=t.paint(k.isPicked?"accentText":u.isPanelPick?"muted":"ink");return(0,me.jsxs)("div",{"data-facet":k.value,style:{minWidth:0,...yn(g,!1,"fade",$*ci,ui)},children:[(0,me.jsxs)("div",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,height:Xt,fontSize:kr,fontWeight:700,lineHeight:`${Xt}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)(w,{...n,...k.props})]},k.value)})}),u.legend?(0,me.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",top:0,right:0,height:Yt},children:u.legend}):null]})}var Sr=["max","min","first","last","none"];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 f=-1,u=c==="max"?-1/0:1/0;r.forEach((h,d)=>{Number.isFinite(h)&&(c==="max"?h>u:h<u)&&(u=h,f=d)}),f>=0&&a.add(f)}}};if(e==null)return s(o),a;if(typeof e=="function")return t.forEach((c,f)=>{f<i&&c!==null&&c!==void 0&&e(c,f)&&a.add(f)}),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((f,u)=>{f===c&&a.add(u)});return a}var ae=A(j(),1);async function mi(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(V(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 di(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 mi(a,t.parse,o,t.locale)}return t.select&&(r=ar(r,t.select)),t.transform?t.transform(r):ke(r)}function Ar(e,t={}){let{refreshMs:n,enabled:r=!0,keepPrevious:o=!0}=t,[a,i]=(0,ae.useState)(()=>({data:[],status:e&&r?"loading":"idle",error:null,updatedAt:null})),[s,l]=(0,ae.useState)(0),c=Z(t.locale),f=(0,ae.useRef)(t);f.current={...t,locale:c};let u=(0,ae.useRef)(e);u.current=e;let h=typeof e=="function"?"fn":e instanceof Request?e.url:e?String(e):"",d=t.deps??[],m=JSON.stringify(d.map(k=>typeof k=="object"?JSON.stringify(k):String(k))),g=(0,ae.useRef)(!1);(0,ae.useEffect)(()=>{let k=u.current;if(!k||!r){i(S=>S.status==="loading"?{...S,status:"idle"}:S);return}let $=new AbortController,M=!0;return g.current=!0,i(S=>({...S,data:o?S.data:[],status:"loading",error:null})),di(k,{...f.current,signal:$.signal}).then(S=>{M&&i({data:S,status:"success",error:null,updatedAt:Date.now()})}).catch(S=>{!M||$.signal.aborted||i(b=>({...b,status:"error",error:S instanceof Error?S:new Error(String(S))}))}).finally(()=>{M&&(g.current=!1)}),()=>{M=!1,g.current=!1,$.abort()}},[h,r,s,m,o]),(0,ae.useEffect)(()=>{if(!n||!r)return;let k=setInterval(()=>{g.current||l($=>$+1)},n);return()=>clearInterval(k)},[n,r]);let w=(0,ae.useCallback)(()=>l(k=>k+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:w}}var Jt=A(L(),1),fi=["csv","svg","png"],hi=/^[=+\-@\t\r\n=+-@]/,gi=/var\(|color-mix\(/;function Nr(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?En(e.getTime()):String(e);return`"${(hi.test(t)&&!Number.isFinite(ge(t))?`'${t}`:t).replace(/"/g,'""')}"`}function pi(e){return[...new Set(e.slice(0,200).flatMap(t=>t&&typeof t=="object"?Object.keys(t):[]))]}function bi(e,t){return`\uFEFF${[t.map(Nr),...e.map(r=>t.map(o=>Nr(r[o])))].map(r=>r.join(",")).join(`\r
|
|
25
|
+
`&&m++,s.push(l),i.push(s),s=[],l=""):l+=g}(l!==""||s.length)&&(s.push(l),i.push(s));let f=i.filter(m=>!(m.length===1&&m[0].trim()===""));if(!f.length)return[];let u=m=>n?or(m):m;if(!r)return f.map(m=>Object.fromEntries(m.map((g,w)=>[String(w),u(g)])));let h=[],d=new Set;return f[0].forEach((m,g)=>{let w=m.trim()||`col${g+1}`,k=w;for(let v=2;d.has(k);v++)k=`${w}_${v}`;d.add(k),h.push(k)}),f.slice(1).map(m=>Object.fromEntries(h.map((g,w)=>[g,u(m[w]??"")])))}function Ht(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"?or(i[l]):i[l]??null])))}function Ha(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 ar(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 ke(e){if(e==null)return[];if(typeof e=="string"){let t=e.trim();if(!t)return[];if(t.startsWith("[")||t.startsWith("{"))try{return ke(JSON.parse(t))}catch{}return Ce(t)}if(Array.isArray(e))return e.length?Array.isArray(e[0])?Ht(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)?ke(t.data):Array.isArray(t.rows)&&Array.isArray(t.columns)?Ht(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)?ke(t.rows):Array.isArray(t.values)?Ht(t.values):Array.isArray(t.items)?ke(t.items):Array.isArray(t.results)?ke(t.results):Ha(t)}return[]}function ut(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 jt(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 f=e[l][c];return Number.isFinite(f)&&f>0?f: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 f=0,u=0;for(let h=0;h<n;h++){let d=i(h,c),m=d-i(h,c-1),g=0;for(let w=0;w<h;w++)g+=i(w,c)-i(w,c-1);f+=d,u+=(m/2+g)*d}f&&(l-=u/f),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 m=e[d][l],g=Number.isFinite(m)?m:0;g>=0?(o[d][l]=u,u+=g,a[d][l]=u):(o[d][l]=h,h+=g,a[d][l]=h)}continue}let c=0;for(let u=0;u<n;u++)c+=i(u,l);let f=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]=f,f+=h,a[u][l]=f}}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 f=0;for(let u=0;u<r;u++)f+=((o[0]?.[u]??0)+(a[n-1]?.[u]??0))/2;f/=r;for(let u=0;u<n;u++)for(let h=0;h<r;h++)o[u][h]-=f,a[u][h]-=f}return{y0:o,y1:a}}function ir(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 sr(e){let t=e.length,n=e.map(c=>{let f=0,u=-1/0;return c.forEach((h,d)=>{h>u&&(u=h,f=d)}),f}),r=e.map(c=>c.reduce((f,u)=>f+(Number.isFinite(u)?u:0),0)),o=Array.from({length:t},(c,f)=>f).sort((c,f)=>n[c]-n[f]),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 we=Math.PI*2;function lr(e){let t=0;for(let n of e)Number.isFinite(n)&&(t+=n);return t}function I(e){return Math.round(e*100)/100}function te(e,t,n,r){return[e+n*Math.sin(r),t-n*Math.cos(r)]}function Gt(e,t,n,r,o,a){let i=a-o;if(!(Math.abs(i)>1e-4)||r<=0)return"";if(Math.abs(i)>=we-1e-4){let v=(M,S)=>{let[b,C]=te(e,t,M,o),[F,D]=te(e,t,M,o+Math.PI);return`M${I(b)},${I(C)}A${I(M)},${I(M)} 0 1 ${S} ${I(F)},${I(D)}A${I(M)},${I(M)} 0 1 ${S} ${I(b)},${I(C)}Z`};return n>0?`${v(r,1)}${v(n,0)}`:v(r,1)}let l=i>0?1:0,c=Math.abs(i)>Math.PI?1:0,[f,u]=te(e,t,r,o),[h,d]=te(e,t,r,a);if(n<=0)return`M${I(e)},${I(t)}L${I(f)},${I(u)}A${I(r)},${I(r)} 0 ${c} ${l} ${I(h)},${I(d)}Z`;let[m,g]=te(e,t,n,a),[w,k]=te(e,t,n,o);return`M${I(f)},${I(u)}A${I(r)},${I(r)} 0 ${c} ${l} ${I(h)},${I(d)}L${I(m)},${I(g)}A${I(n)},${I(n)} 0 ${c} ${1-l} ${I(w)},${I(k)}Z`}function cr(e){let t=-1,n=-1/0;return e.forEach((r,o)=>{r>n&&(n=r,t=o)}),t}function ja(e){return e>=44032&&e<=55203||e>=4352&&e<=4607||e>=12592&&e<=12687||e>=19968&&e<=40959}function ur(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 mt=new Map;function Se(e,t,n=400){let r=String(e),o=`${r}|${n>=600?1:0}`,a=mt.get(o);if(a===void 0){let i=0,s=0;for(let l=0;l<r.length;l++){let c=r.charCodeAt(l);ja(c)?i+=ur(c):s+=ur(c)}a=i+s*(n>=600?1.07:1),mt.size>5e3&&mt.clear(),mt.set(o,a)}return a*t}var dr=A(L(),1),Ga=e=>Array.isArray(e)&&e.length===2;function mr(e){let t=[];for(let n of e??[])n.type==="line"&&typeof n.y=="number"?t.push(n.y):n.type==="band"&&Ga(n.y)&&t.push(Number(n.y[0]),Number(n.y[1]));return t.filter(Number.isFinite)}var hr=A(L(),1),Vt=10.5;function Va(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 fr(e,t,n){let r=18;for(let o of Va(e,t,n))r=Math.max(r,Se(o,Vt));return Math.ceil(r+8)}function Wt(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=Wt(i,n),c=[o,a];for(let f=0;f<4;f++){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 d=Wt(c[1]-c[0],n);if(d===l)break;l=d}return c}function gr(e,t,n=4){let r=Math.min(e,t),o=Math.max(e,t),a=Wt(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 Kt(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)=>gr(n,r,l),s}function Ut(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 Wa(e,t,n){let r=Math.log10(e),o=Math.log10(t),a=n/Math.max(1e-9,o-r),i=(c,f=1)=>{let u=[];for(let h=Math.floor(r);h<=Math.ceil(o);h++)if(!(h%f))for(let d of c){let m=Number((d*10**h).toPrecision(12));m>=e*(1-1e-9)&&m<=t*(1+1e-9)&&u.push(m)}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:gr(e,t,3)}function pr(e,t){let n=Kt([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=()=>Wa(e[0],e[1],Math.abs(t[1]-t[0])),r}function He(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 Ka=864e5;function br(e,t,n,r=q){let o=t-e;if(!(o>0))return[{t:e,label:Be(e,{locale:r,month:"short",day:"numeric"})}];let a=o/Ka,i=[],s=new Date(e),l=new Date(e).getFullYear()===new Date(t).getFullYear(),c=(f,u,h,d=!1)=>{let m=new Date(f),g=-1,w=0;for(;m.getTime()<=t&&w++<500;){if(m.getTime()>=e){let k=m.getFullYear(),v=d&&!l&&k!==g;i.push({t:m.getTime(),label:Be(m,{locale:r,...h,...v?{year:"numeric"}:{}})}),g=k}u(m)}};if(a<=1.5){let f=Math.max(1,Math.ceil(o/36e5/Math.max(1,n))),u=[1,2,3,4,6,12].find(d=>d>=f)??12,h=new Date(s);h.setMinutes(0,0,0),c(h,d=>d.setHours(d.getHours()+u),{hour:"numeric"})}else if(a<=n*1.2){let f=new Date(s.getFullYear(),s.getMonth(),s.getDate());c(f,u=>u.setDate(u.getDate()+1),{month:"numeric",day:"numeric"})}else if(a<=n*7*1.2){let f=new Date(s.getFullYear(),s.getMonth(),s.getDate());f.setDate(f.getDate()+(8-f.getDay())%7),c(f,u=>u.setDate(u.getDate()+7),{month:"numeric",day:"numeric"})}else{let f=a/30.44,u=Math.max(1,Math.ceil(f/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,m=>m.setFullYear(m.getFullYear()+h/12),{year:"numeric"})}else{let d=new Date(s.getFullYear(),s.getMonth()+(s.getDate()>1?1:0),1),m=d.getMonth()%h;m&&d.setMonth(d.getMonth()+(h-m)),c(d,g=>g.setMonth(g.getMonth()+h),{month:"short"},!0)}}return i}function yr(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 Ua=(e,t,n)=>e==="date"?tt(t,n)?.getTime()??NaN:ge(t);function Xa(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 je(e,t,n,r,o={}){let a=Te(t,"x"),i=Array.isArray(n),s=i?n:null,l=i?null:Te(n,"y"),c=!i&&r!==void 0?Te(r,"series"):null,f=e.map(($,x)=>a($,x)),u=o.xType??Xa(f),h=o.locale??q,d,m,g;if(u==="band"){let $=f.map(T=>String(T??""));d=ee($);let x=new Map(d.map((T,R)=>[T,R]));m=d.map((T,R)=>R),g=Int32Array.from($,T=>x.get(T)??-1)}else{let $=u==="date"?o.dayFirst??Bn(f):void 0,x=f.map(P=>Ua(u,P,$)),T=Array.from(new Set(x.filter(P=>Number.isFinite(P)))).sort((P,G)=>P-G),R=new Map(T.map((P,G)=>[P,G]));m=T,d=T.map(String),g=Int32Array.from(x,P=>R.get(P)??-1)}let w=o.dateFormat,k=$=>typeof $=="string"?et($.trim())?.[3]:void 0,v=u==="date"&&f.length<5e3?k(f[0]):void 0,M=(v===2||v===3)&&f.every($=>k($)===v),S=M&&v===3;if(u==="date"&&!w){let $=m.length>1?m[m.length-1]-m[0]:0;w=M&&v===2||$>864e5*120?{month:"short"}:$<864e5*2?{month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit"}:{month:"numeric",day:"numeric"},$>864e5*800&&(w={year:"numeric",month:"short"})}let b;if(u==="band")b=d;else if(S&&!o.dateFormat){let $=V(h)==="ko";b=m.map(x=>{let T=new Date(x),R=Math.floor(T.getMonth()/3)+1;return $?`${T.getFullYear()}년 ${R}분기`:`Q${R} ${T.getFullYear()}`})}else{let $=m.every(Pt),x=u==="date"?new Intl.DateTimeFormat(h,w):new Intl.NumberFormat(h,$?{useGrouping:!1}:{maximumFractionDigits:6});b=m.length>1e3?yr(m.length,T=>x.format(m[T])):m.map(T=>x.format(T))}let C=s?[...s]:c?ee(e.map(($,x)=>String(c($,x)??""))):[""],F=new Map(C.map(($,x)=>[$,x])),D=C.map(()=>new Array(d.length).fill(NaN)),E=C.map(()=>new Array(d.length).fill(null)),O=o.aggregate??"sum",_=O==="mean"?C.map(()=>new Uint32Array(d.length)):null,p=($,x,T,R)=>{let P=D[$][x];O==="last"?D[$][x]=T:O==="count"?D[$][x]=(Number.isFinite(P)?P:0)+1:O==="mean"?Number.isFinite(T)&&(D[$][x]=(Number.isFinite(P)?P:0)+T,_[$][x]++):D[$][x]=Number.isFinite(P)?P+(Number.isFinite(T)?T:0):T,E[$][x]=R};for(let $=0;$<e.length;$++){let x=g[$];if(x<0)continue;let T=e[$];if(s)for(let R=0;R<s.length;R++)p(R,x,ge(T[s[R]]),T);else{let R=c?F.get(String(c(T,$)??""))??0:0;p(R,x,ge(l(T,$)),T)}}if(_)for(let $=0;$<D.length;$++)for(let x=0;x<d.length;x++)_[$][x]>1&&(D[$][x]/=_[$][x]);return{type:u,keys:d,xnum:m,labels:b,series:C,values:D,rows:E}}var Ya=140,Ve=12,xr=14,Xt=20,kr=12.5;function Ja(e,t,n=Qn){let r=oe(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 qa(e,t,n){if(t<1)return 1;let r=Math.max(1,Math.floor((e+Ve)/(Ya+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 Za(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 Ge=e=>e.filter(Number.isFinite);function dt(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 Ge(n)}function wr(e,t,n,r,o,a){return je(t,n.x,r,o,{xType:e==="bar"?"band":n.xType,aggregate:a,dayFirst:n.dayFirst})}function Qa(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 b=t.flat(),C=r.refLines??{},[F,D]=He([...dt(b,r.x??"x"),...Ge([Number(C.x)])]),[E,O]=He([...dt(b,r.y??"y"),...Ge([Number(C.y)])].filter(p=>!s||p>0)),_=r.zero??!1;return{y:c??(s?Ut(E,O,i):De(E,O,i,{zero:_,pad:.08})),x:r.xDomain??De(F,D,Math.max(2,Math.round(o/110)),{zero:_,pad:.06}),sameKeys:!0}}let f=e==="bar",u=f&&r.orientation==="horizontal",h=n[0]?.keys.join(""),d=n.every(b=>b.keys.join("")===h),m=n.length>0&&n.every(b=>b.type!=="band"&&b.type===n[0].type),g=r.xDomain??(!f&&m?He(n.flatMap(b=>Ge(b.xnum))):void 0),w=f?r.layout??"grouped":e==="area"?r.stack??"auto":"none";if(w==="percent")return{x:g,sameKeys:d};if(c)return{y:c,x:g,sameKeys:d};let k=[];t.forEach((b,C)=>{let F=n[C];if(w==="stacked"||w==="auto"&&F.series.length>1){let E=jt(F.values,"zero");E.y0.forEach(O=>k.push(...O)),E.y1.forEach(O=>k.push(...O))}else F.values.forEach(E=>k.push(...E));f&&!u&&r.line!==void 0&&wr(e,b,r,[].concat(r.line),void 0,r.series===void 0?r.aggregate:"mean").values.forEach(E=>k.push(...E)),f||k.push(...dt(b,r.lower),...dt(b,r.upper))}),f&&k.push(0),u||k.push(...mr(r.annotations));for(let b of r.referenceLines??[])k.push(b.y);r.signColors&&k.push(Number(r.baseline??0));let[v,M]=He(Ge(k).filter(b=>!s||b>0));return{y:s?Ut(v,M,i):f?De(v,M,u?Math.max(2,Math.round(o/120)):i):De(v,M,i,{zero:r.zero??e==="area"}),x:g,sameKeys:d}}function ei(e,t,n,r,o,a,i,s){if(e!=="line"&&e!=="area"||!o.x||!o.y)return;let l=je(t.flat(),r.x,r.y,void 0,{xType:r.xType,locale:s,dayFirst:r.dayFirst}),c=(r.yScale==="log"&&e==="line"?pr:Kt)(o.y,[i-22,10]).ticks(Math.max(2,Math.round(i/70))),f=fr(c,Ln(r.format,s,Math.max(Math.abs(o.y[0]),Math.abs(o.y[1]))),s),u=n.flatMap(b=>b.series),h=r.endLabels??n.some(b=>b.series.length>1),d=f+6,m=a-(h?Math.min(a*.28,Math.max(...u.map(b=>Se(b,11,700)),20)+14):10),g=l.keys.length,[w,k]=o.x[1]===o.x[0]?[o.x[0],o.x[0]+1]:o.x,v=l.type==="number"?g>12:g>br(w,k,Math.max(2,Math.floor((m-d)/64)),s).length;if(l.type==="band"||!g||v)return;let M=b=>d+(l.xnum[b]-w)/(k-w)*(m-d),S=b=>Se(l.labels[b],Vt);for(let b=1;;b++){let C=Array.from({length:Math.ceil(g/b)},(F,D)=>D*b);if(b>=g||C.every((F,D)=>!D||M(F)-M(C[D-1])>=(S(F)+S(C[D-1]))/2+8))return C.map(F=>({value:l.xnum[F],label:l.labels[F]}))}}function ti(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 ni(e,t,n,r){let o=[n.x,n.y,n.series].map(a=>JSON.stringify(a??null)).join("|");return`ztd-facet-${ti(`${e}|${t}|${o}|${ut(r)}`)}`}function ri(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 oi={en:{intro:(e,t)=>`${ye(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:"(빈 값)"}},Yt=18;function $r(e){let{type:t,chartProps:n}=e,{values:r,groups:o,dropped:a}=Ja(e.data,e.by),i=r.length,s=typeof e.width=="number"&&Number.isFinite(e.width)&&e.width>0?e.width:480,l=qa(s,i,e.columns),{pw:c,ph:f}=Za(s,l,e.height),u=e.scale!=="free",h=t==="scatter"?[]:o.map(_=>wr(t,_,n,n.y,n.series,n.aggregate)),d=u?Qa(t,o,h,n,c,f):{sameKeys:!1},m=u?ei(t,o,h,n,d,c,f,e.locale):void 0,g=t==="bar"&&n.orientation==="horizontal",w=u&&(!g||d.sameKeys),k=u&&(g||d.x!==void 0||d.sameKeys),v=new Set(ri(e.highlight,r)?[e.highlight].flat():[]),M=v.size>0,S=t==="bar"&&!Array.isArray(n.y)&&n.series===void 0||t==="scatter"&&n.series===void 0,b=e.syncId??ni(t,e.by,n,e.data),C=Qe(Me(n.format,e.locale),n.unit),F=oi[e.lang],D=[],E=r.map(_=>_===""?F.blank:_);return{panels:r.map((_,p)=>{let $=o[p],x=E[p],T=p%l,R;if(t!=="scatter"){let G=h[p],fe=ie=>G.values.reduce((H,X)=>H+(Number.isFinite(X[ie])?X[ie]:0),0),z=G.keys.map((ie,H)=>H).filter(ie=>G.values.some(H=>Number.isFinite(H[ie]))),J=z[z.length-1];D.push({first:z.length?fe(z[0]):NaN,last:z.length?fe(J):NaN,total:z.reduce((ie,H)=>ie+fe(H),0)}),t!=="bar"&&G.series.length===1&&J!==void 0&&(R=C(G.values[0][J]))}else D.push({first:NaN,last:NaN,total:$.length});let P={data:$,width:c,height:f,ariaLabel:e.title?`${e.title}, ${x}`:x,syncId:b,highlight:M?v.has(_)?S?()=>!0:void 0:"none":e.highlight,showYAxis:!w||T===0,showXAxis:!k||p+l>=i};return d.y&&(P.yDomain=d.y),d.x&&(P.xDomain=d.x),m&&(P.xTicks=m),{value:_,label:x,props:P,last:R,isPicked:v.has(_)}}),cols:l,pw:c,ph:f,isPanelPick:M,description:ai(t,e.by,E,D,a,C,F)}}function ai(e,t,n,r,o,a,i){let s=i.intro(n.length,t),l=c=>cr(r.map(f=>f[c]));if(e==="line"||e==="area"){let c=l("last");c>=0&&(s+=i.endHigh(n[c],a(r[c].last)));let f=n.filter((u,h)=>r[h].last<r[h].first);s+=f.length?i.falling(`${f.slice(0,5).join(", ")}${f.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 ne=A(j(),1);function ii(e){return[...new Set([0,.01,.02,.05,.1,.15,.2,e].filter(t=>t<=e))].sort((t,n)=>t-n)}function si(e,t,n=1/0){let r=e.rootBounds?.height??window.innerHeight;return e.isIntersecting&&(e.intersectionRatio>=t||e.intersectionRect.height>=Math.min(r*.5,n))}var ft={threshold:.25,enoughPx:96,rootMargin:"0px"};function Tr(e,t=!0){let[n,r]=(0,ne.useState)({visible:!t,near:!t});return(0,ne.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=si(i[i.length-1],ft.threshold,ft.enoughPx);r(l=>l.visible===s?l:{...l,visible:s,near:l.near||s})},{threshold:ii(ft.threshold),rootMargin:ft.rootMargin}),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 vr(e){let t=e.getBoundingClientRect().width;return t>0?Math.round(t*10)/10:0}function ht(e){let[t,n]=(0,ne.useState)(null),[r,o]=(0,ne.useState)(e??null),a=(0,ne.useCallback)(i=>{n(i),i&&e===void 0&&o(vr(i))},[e]);return he(()=>{if(e!==void 0){o(e);return}if(!t)return;let i=c=>o(f=>f!==null&&Math.abs(f-c)<.5?f:c),s=()=>i(vr(t));if(typeof ResizeObserver>"u")return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s);let l=new ResizeObserver(c=>{let f=c[c.length-1]?.contentRect;f?i(f.width>0?Math.round(f.width*10)/10:0):s()});return l.observe(t),()=>l.disconnect()},[t,e]),[t,a,r]}var li=()=>()=>{};function Le(){return(0,ne.useSyncExternalStore)(li,()=>!0,()=>!1)}var Mr="(prefers-reduced-motion: reduce)";function gt(e="auto"){let[t,n]=(0,ne.useState)(()=>se&&typeof window.matchMedia=="function"?window.matchMedia(Mr).matches:!1);return(0,ne.useEffect)(()=>{if(e!=="auto"||!se||typeof window.matchMedia!="function")return;let r=window.matchMedia(Mr),o=()=>n(r.matches);return o(),r.addEventListener?.("change",o),()=>r.removeEventListener?.("change",o)},[e]),e===!0?!0:e===!1?!1:t}var me=A(L(),1),ci=60,ui=420;function Cr(e){let t=ue(),n=e.chartProps??{},[,r,o]=ht(e.width),a=e.width??(o||480),i=Z(e.locale??n.locale),s=V(i),l=(0,Ee.useContext)(Ae),c=e.title??l,f=e.chart.facetPlan,u=(0,Ee.useMemo)(()=>{let k=$r({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});return f?f(k,n,i):k},[e.type,e.data,e.by,e.columns,e.scale,JSON.stringify(n,(k,v)=>typeof v=="function"?String(v):v),e.highlight,e.syncId,a,e.height,c,i,s,f]),h=`${(0,Ee.useId)().replace(/:/g,"")}fd`,d=gt(n.reducedMotion??"auto"),m=Le(),g=xn({motion:{enabled:n.animate!==!1&&!d&&se},hydrated:m},{waiting:!1,generation:0}),w=e.chart;return(0,me.jsxs)("div",{ref:r,role:"group","aria-label":c,"aria-describedby":h,className:e.className,style:{position:"relative",width:"100%",...e.style},children:[(0,me.jsx)("p",{id:h,style:st,children:e.description??u.description}),(0,me.jsx)("div",{style:{display:"grid",gridTemplateColumns:`repeat(${u.cols}, minmax(0, 1fr))`,columnGap:Ve,rowGap:xr,...u.legend?{marginTop:Yt}:null},children:u.panels.map((k,v)=>{let M=t.paint(k.isPicked?"accentText":u.isPanelPick?"muted":"ink");return(0,me.jsxs)("div",{"data-facet":k.value,style:{minWidth:0,...yn(g,!1,"fade",v*ci,ui)},children:[(0,me.jsxs)("div",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,height:Xt,fontSize:kr,fontWeight:700,lineHeight:`${Xt}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)(w,{...n,...k.props})]},k.value)})}),u.legend?(0,me.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",top:0,right:0,height:Yt},children:u.legend}):null]})}var Sr=["max","min","first","last","none"];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 f=-1,u=c==="max"?-1/0:1/0;r.forEach((h,d)=>{Number.isFinite(h)&&(c==="max"?h>u:h<u)&&(u=h,f=d)}),f>=0&&a.add(f)}}};if(e==null)return s(o),a;if(typeof e=="function")return t.forEach((c,f)=>{f<i&&c!==null&&c!==void 0&&e(c,f)&&a.add(f)}),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((f,u)=>{f===c&&a.add(u)});return a}var ae=A(j(),1);async function mi(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(V(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 di(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 mi(a,t.parse,o,t.locale)}return t.select&&(r=ar(r,t.select)),t.transform?t.transform(r):ke(r)}function Ar(e,t={}){let{refreshMs:n,enabled:r=!0,keepPrevious:o=!0}=t,[a,i]=(0,ae.useState)(()=>({data:[],status:e&&r?"loading":"idle",error:null,updatedAt:null})),[s,l]=(0,ae.useState)(0),c=Z(t.locale),f=(0,ae.useRef)(t);f.current={...t,locale:c};let u=(0,ae.useRef)(e);u.current=e;let h=typeof e=="function"?"fn":e instanceof Request?e.url:e?String(e):"",d=t.deps??[],m=JSON.stringify(d.map(k=>typeof k=="object"?JSON.stringify(k):String(k))),g=(0,ae.useRef)(!1);(0,ae.useEffect)(()=>{let k=u.current;if(!k||!r){i(S=>S.status==="loading"?{...S,status:"idle"}:S);return}let v=new AbortController,M=!0;return g.current=!0,i(S=>({...S,data:o?S.data:[],status:"loading",error:null})),di(k,{...f.current,signal:v.signal}).then(S=>{M&&i({data:S,status:"success",error:null,updatedAt:Date.now()})}).catch(S=>{!M||v.signal.aborted||i(b=>({...b,status:"error",error:S instanceof Error?S:new Error(String(S))}))}).finally(()=>{M&&(g.current=!1)}),()=>{M=!1,g.current=!1,v.abort()}},[h,r,s,m,o]),(0,ae.useEffect)(()=>{if(!n||!r)return;let k=setInterval(()=>{g.current||l(v=>v+1)},n);return()=>clearInterval(k)},[n,r]);let w=(0,ae.useCallback)(()=>l(k=>k+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:w}}var qt=A(L(),1),fi=["csv","svg","png"],hi=/^[=+\-@\t\r\n=+-@]/,gi=/var\(|color-mix\(/;function Nr(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?En(e.getTime()):String(e);return`"${(hi.test(t)&&!Number.isFinite(ge(t))?`'${t}`:t).replace(/"/g,'""')}"`}function pi(e){return[...new Set(e.slice(0,200).flatMap(t=>t&&typeof t=="object"?Object.keys(t):[]))]}function bi(e,t){return`\uFEFF${[t.map(Nr),...e.map(r=>t.map(o=>Nr(r[o])))].map(r=>r.join(",")).join(`\r
|
|
26
26
|
`)}\r
|
|
27
|
-
`}function yi(e){return Array.from((e??"").replace(/[\\/:*?"<>|\r\n\t]+/g,"-").trim()).slice(0,80).join("")||"chart"}function
|
|
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(In,(f,u)=>o(a,u.trim())??(l=!0,""));l||i.push(c)}return i.length?i.map((s,l)=>(0,Er.jsx)("div",{children:s},l)):null}}function Or(e,t,n=!1){let r=oe(t,"group"),o=e.map((s,l)=>r(s,l)).filter(Boolean),a=ee(o);if(!n)return a;let i=new Map;for(let s of o)i.set(s,(i.get(s)??0)+1);return a.map((s,l)=>[s,l]).sort((s,l)=>i.get(s[0])-i.get(l[0])||s[1]-l[1]).map(([s])=>s)}function Ir(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 Wr=A(j(),1);var U=A(j(),1);function zr(e,t){let n=ue(e.theme),[r,o,a]=ht(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,f=gt(e.reducedMotion??"auto"),u=e.animate!==!1&&!f&&se,h=Tr(r,e.animateOnView!==!1&&u),d=Z(e.locale),m=V(d),g=(0,U.useMemo)(()=>Me(e.format,d,t.format),[e.format,d,t.format]),w=(0,U.useCallback)(z=>Ze(z,{locale:d}),[d]),k=(0,U.useMemo)(()=>Qe(g,e.unit),[g,e.unit]),$=(0,U.useMemo)(()=>ut(e.data),[e.data]),[M,S]=(0,U.useState)(null),[b,C]=(0,U.useState)(null),F=(0,U.useRef)([]),D=(0,U.useRef)(e.onHover);D.current=e.onHover;let E=(0,U.useRef)(e.onClick);E.current=e.onClick;let O=(0,U.useRef)(null),_=(0,U.useRef)(null),p=(0,U.useRef)(null),v=(0,U.useCallback)((z,q="pointer")=>{if(p.current!==z){p.current=z;let ie=z===null?null:F.current[z]??null;queueMicrotask(()=>D.current?.(ie)),_.current?.(z)}O.current=z===null?null:q,S(z),C(O.current)},[]),x=(0,U.useCallback)(z=>{O.current!=="keyboard"&&(O.current=z===null?null:"sync",S(z),C(O.current))},[]),T=(0,U.useCallback)(z=>{let q=F.current[z];q&&E.current?.(q)},[]),R=Vn(e.replayKey),P=e.width!==void 0||(a??0)>0,G={enabled:u,active:h.visible&&P,near:h.near,replayKey:R,dataKey:$,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},fe=(0,U.useCallback)((z,q=1)=>M===null||M===z?q:q*.38,[M]);return{p:n,width:s,height:c,measured:P,responsive:e.width===void 0,pending:se&&i&&e.width===void 0&&a===null,node:r,hydrated:i,ref:o,motion:G,fv:k,fmt:g,pct:w,locale:d,lang:m,t:m==="ko"?wn:kn,active:M,via:b,setActive:v,click:T,events:F,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:fe,sig:$,description:e.description,reduced:f,publish:_,applySync:x}}var W=A(j(),1);function ki(e){return 1-Math.pow(1-e,3)}function wi(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function vi(e){return e==="easeInOut"?wi:e==="linear"?t=>t:ki}function $i(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 Oe(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 pt(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 Br(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 Hr(e,t,n,r){if(!t||!n||t.length!==n.length)return Oe(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 Oe(s,n[i]))o.push(l)}return o.length===r?o:Oe(e,r)}var bt=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||!pt(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),Br(n.from,n.vel,n.to),n.cur=n.from.slice(),n.curVel=n.vel.slice(),n.done=pt(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=Hr(s.cur,s.parts,i.parts,c),s.vel=Hr(s.curVel,s.parts,i.parts,c),s.parts=i.parts,s.to=i.to.slice(),Br(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=pt(s.from,s.to)&&s.vel.every(f=>Math.abs(f)<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=pt(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=Oe(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=vi(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=Oe(s.from,c)),s.vel.length!==c&&(s.vel=Oe(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 f;if(this.easing==="spring"){let u=Math.exp(-a*l),h=a*l>=8&&a*l<20,d=0;for(let m=0;m<c;m++){let g=s.from[m]-s.to[m],w=s.vel[m]+a*g;s.cur[m]=s.to[m]+(g+w*l)*u,s.curVel[m]=(s.vel[m]-a*w*l)*u,h&&d<.15&&(d=Math.max(d,Math.abs(s.cur[m]-s.to[m]),Math.abs(s.curVel[m]/a)))}f=a*l>=20||h&&d<.15,s.progress=Math.min(1,1-(1+a*l)*u)}else{let u=Math.min(1,l/o),h=r(u),d=$i(this.easing,u)/o;for(let m=0;m<c;m++)s.cur[m]=s.from[m]+(s.to[m]-s.from[m])*h,s.curVel[m]=(s.to[m]-s.from[m])*d;f=u>=1,s.progress=h}if(f){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,yt=0;function jr(e){yt=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"&&(yt=requestAnimationFrame(jr))}function Gr(e){return We.add(e),!yt&&typeof requestAnimationFrame<"u"&&(yt=requestAnimationFrame(jr)),()=>{We.delete(e)}}function Mi(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 Vr(e,t){let n=(0,W.useMemo)(()=>Mi(e),[e]),{enabled:r,active:o,near:a=!0,replayKey:i,dataKey:s,easing:l="spring",duration:c=900,stagger:f=0}=t,u=(0,W.useRef)(null),h=(0,W.useRef)("init"),d=(0,W.useRef)(null),m=(0,W.useRef)(s),g=(0,W.useRef)(i),w=(0,W.useRef)(!1),k=(0,W.useRef)(0),[,$]=(0,W.useState)(0),M=(0,W.useRef)(null),S=(0,W.useRef)(!0);u.current||(u.current=new bt,u.current.configure(l,c),u.current.snap(n),d.current=n);let b=u.current;if(b.configure(l,c),d.current!==n){let _=h.current,p=!Object.is(m.current,s);b.sameTargets(n)?b.refreshData(n):!r||_==="init"?b.snap(n):_==="idle"?b.hold(n):_==="running"||p?b.update(n,Ye(),f):b.snap(n),d.current=n,m.current=s}let C=(0,W.useRef)(()=>!1);C.current=_=>{if(!S.current)return!1;let p=b.step(_);return!p&&h.current==="running"&&(h.current="done"),$(v=>(v+1)%1e9),p||(M.current=null),p};let F=(0,W.useCallback)(()=>{if(!se||M.current||!b.animating)return;let _=p=>C.current(p);M.current=Gr(_)},[b]);he(()=>{let _=!Object.is(g.current,i);if(g.current=i,!r){(h.current!=="done"||b.animating)&&(b.snap(d.current??n),h.current="done",$(p=>p+1));return}h.current==="init"||_&&a?(b.hold(d.current??n),h.current="idle",w.current=!1,$(p=>p+1)):_&&(w.current=!0)},[r,i]),he(()=>{!r||!a||!w.current||(w.current=!1,b.hold(d.current??n),h.current="idle",$(_=>_+1))},[a,r]),(0,W.useEffect)(()=>{r&&o&&h.current==="idle"&&(b.start(Ye()),k.current+=1,h.current="running",F(),$(_=>_+1))},[r,o,i,b,F]),(0,W.useEffect)(()=>{b.animating&&F()}),(0,W.useEffect)(()=>(S.current=!0,()=>{S.current=!1,M.current?.(),M.current=null}),[]);let D=Ye(),E=b.elapsed(D),O=r&&h.current==="idle";return{items:b.items(),get:_=>b.get(_),elapsed:O?0:E,fade:(_,p=320)=>O?0:Number.isFinite(E)?Math.max(0,Math.min(1,(E-_)/p)):1,waiting:O,animating:b.animating,generation:k.current}}var Zt=A(L(),1);function Kr(e,t,n,r,o){if(r)return o==="categorical"?le(e,t,n):Nn(e,t,n);if(o==="categorical")return le(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 Ti=A(j(),1);var Qt=A(L(),1);var Ur=e=>e?"neutralStrong":"accent";var en=A(L(),1);function Xr(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 Ci=A(j(),1);var nn=A(L(),1),Si={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}, ${ye(n,"candle")}. First open ${r}, last close ${o}`,ma:e=>`MA${e}`,up:"Up",down:"Down",maLegend:e=>`${e}-day MA`},Yr={en:Si,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}일 이동평균`}},tn=["ink","muted","dim"];function qr(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,tn.length)}var rn=A(j(),1);function Jr(e,t=.04){let n=e.length,r=(d,m)=>Math.max(0,e[d]?.[m]||0),o=(d,m)=>r(d,m)+(d===m?0:r(m,d)),a=Array.from({length:n},(d,m)=>Array.from({length:n},(g,w)=>o(m,w)).reduce((g,w)=>g+w,0)),i=a.reduce((d,m)=>d+m,0),s=Math.min(t,n?we*.5/n:0),l=i>0?Math.max(0,we-s*n)/i:0,c=[],f=Array.from({length:n},()=>[]),u=0;for(let d=0;d<n;d++){let m=u;for(let g=0;g<n;g++){let w=u;u+=o(d,g)*l,f[d][g]={index:d,sub:g,a0:w,a1:u,value:r(d,g)}}c.push({index:d,a0:m,a1:u,value:a[d]}),u+=s}let h=[];for(let d=0;d<n;d++)for(let m=d;m<n;m++){let g=f[d][m],w=f[m][d];g.value<=0&&w.value<=0||h.push(g.value>=w.value?{source:g,target:w}:{source:w,target:g})}return{groups:c,chords:h}}function Zr(e,t,n,r,o,a,i){let s=b=>te(e,t,n,b),l=b=>Math.round(b*100)/100,[c,f]=s(r),[u,h]=s(o),[d,m]=s(a),[g,w]=s(i),k=o-r>Math.PI?1:0,$=i-a>Math.PI?1:0,M=r===a&&o===i,S=`M${l(c)},${l(f)}A${l(n)},${l(n)} 0 ${k} 1 ${l(u)},${l(h)}`;return M?(S+=`Q${l(e)},${l(t)} ${l(c)},${l(f)}Z`,S):(S+=`Q${l(e)},${l(t)} ${l(d)},${l(m)}A${l(n)},${l(n)} 0 ${$} 1 ${l(g)},${l(w)}Q${l(e)},${l(t)} ${l(c)},${l(f)}Z`,S)}var $e=A(L(),1),Ai={kind:"Chord diagram",sent:"Sent",received:"Received",groups:e=>ye(e,"group")},Ni={en:Ai,ko:{kind:"코드 다이어그램",sent:"보냄",received:"받음",groups:e=>`그룹 ${e}개`}};function on(e){let t=zr(e,{height:p=>Math.max(240,Math.min(340,p*.7)),duration:1e3}),{p:n,width:r,height:o}=t,a=(0,rn.useMemo)(()=>{let p=H=>e.data.some(X=>X&&typeof X=="object"&&H in X),v=oe(e.source??(p("source")?"source":"from"),"source"),x=oe(e.target??(p("target")?"target":"to"),"target"),T=Pe(e.value,"value"),R=ee(e.data.flatMap((H,X)=>[v(H,X),x(H,X)])),P=new Map(R.map((H,X)=>[H,X])),G=R.map(()=>R.map(()=>0));e.data.forEach((H,X)=>{let sn=P.get(v(H,X)),ln=P.get(x(H,X));sn===void 0||ln===void 0||(G[sn][ln]+=Math.max(0,T(H,X)||0))});let fe=Jr(G,e.padAngle??.05),z=fe.groups.map(H=>H.value),q=de(e.highlight,R,R,z,"max"),ie=z.reduce((H,X)=>H+X,0)||1;return{names:R,matrix:G,lay:fe,hi:q,grand:ie}},[e.data,e.source,e.target,e.value,e.padAngle,e.highlight]),i=Math.max(...a.names.map(p=>Se(p,11.5,700)),20)+14,s=Math.max(40,Math.min(o/2-16,r/2-i)),l=r/2,c=o/2,f=Math.max(8,Math.min(14,s*.09)),u=s-f-3,h=t.motion.duration??1e3,d=(0,rn.useMemo)(()=>[{key:"__sweep",to:[we],from:[0],data:null},{key:"__rib",to:[1],from:[0],delay:h*.45,data:null}],[h]),m=Vr(d,t.motion),g=m.get("__sweep")?.[0]??we,w=m.get("__rib")?.[0]??1,k=K(n,"accent"),$=Ni[t.lang],M=a.names.length,S=p=>a.hi.has(p.source.index)||a.hi.has(p.target.index),b=t.active,C=b!==null&&b<M?b:null,F=b!==null&&b>=M?a.lay.chords[b-M]:null,D=[...a.lay.groups.map(p=>({datum:null,index:p.index,key:a.names[p.index],label:a.names[p.index],value:p.value,formatted:`${t.fv(p.value)} (${t.pct(p.value/a.grand*100)})`})),...a.lay.chords.map((p,v)=>({datum:null,index:M+v,key:`${p.source.index}-${p.target.index}`,label:`${a.names[p.source.index]} ↔ ${a.names[p.target.index]}`,value:p.source.value+(p.source.index===p.target.index?0:p.target.value),formatted:`${a.names[p.source.index]}→${a.names[p.target.index]} ${t.fv(p.source.value)}, ${a.names[p.target.index]}→${a.names[p.source.index]} ${t.fv(p.target.value)}`}))],E=null;if(C!==null){let p=a.lay.groups[C],[v,x]=te(l,c,s,(p.a0+p.a1)/2),T=a.matrix[C].reduce((P,G)=>P+G,0),R=a.matrix.reduce((P,G)=>P+G[C],0);E={x:v,y:x,title:a.names[C],rows:[{label:$.sent,value:t.fv(T),color:a.hi.has(C)?k.fill:n.paint("neutralStrong")},{label:$.received,value:t.fv(R)}]}}else if(F){let p=(F.source.a0+F.source.a1)/2,[v,x]=te(l,c,u*.6,p);E={x:v,y:x,title:`${a.names[F.source.index]} ↔ ${a.names[F.target.index]}`,rows:[{label:`${a.names[F.source.index]} →`,value:t.fv(F.source.value)},{label:`${a.names[F.target.index]} →`,value:t.fv(F.target.value)}]}}let O=p=>C!==null?p.source.index===C||p.target.index===C?.82:.08:F?p===F?.88:.08:S(p)?.68:.4,_=e.description??`${$.kind}. ${$.groups(M)}: ${a.lay.groups.map(p=>`${a.names[p.index]} ${t.fv(p.value)}`).join(", ")}.`;return(0,$e.jsxs)(Kn,{c:t,kind:$.kind,ariaLabel:e.ariaLabel,description:_,events:D,tip:E,renderTip:e.tooltip,className:e.className,style:e.style,theme:e.theme,children:[(0,$e.jsx)("g",{opacity:Math.min(1,w*1.2),children:a.lay.chords.map((p,v)=>(0,$e.jsx)("path",{className:"ztd-mark",d:Zr(l,c,u,p.source.a0,p.source.a1,p.target.a0,p.target.a1),fill:S(p)?k.fill:n.paint("neutralStrong"),opacity:O(p),stroke:n.paint("panel"),strokeWidth:.6,onPointerEnter:x=>t.setActive(M+v,x.pointerType==="touch"?"touch":"pointer"),onClick:()=>t.click(M+v)},v))}),a.lay.groups.map(p=>{let v=Math.min(p.a0,g),x=Math.min(p.a1,g),T=a.hi.has(p.index),R=Gt(l,c,s-f,s,v,x),P=(p.a0+p.a1)/2,[G,fe]=te(l,c,s+10,P),z=Math.sin(P);return(0,$e.jsxs)("g",{onPointerEnter:q=>t.setActive(p.index,q.pointerType==="touch"?"touch":"pointer"),onClick:()=>t.click(p.index),children:[R?(0,$e.jsx)("path",{className:"ztd-mark",d:R,fill:T?k.fill:n.paint("ink"),opacity:C===null||C===p.index?1:.4,stroke:b===p.index&&t.via==="keyboard"?n.paint("accent"):"none",strokeWidth:2}):null,t.showLabels?(0,$e.jsx)(Un,{x:G,y:fe+(Math.cos(P)>.9?-3:Math.cos(P)<-.9?4:0),anchor:z>.12?"start":z<-.12?"end":"middle",size:11.5,weight:T||C===p.index?800:600,fill:n.paint(T?"ink":"muted"),opacity:m.fade(h*.4,300),children:a.names[p.index]}):null]},p.index)})]})}var Ri=A(j(),1);var ro=A(L(),1),Fi={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${ye(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},_i={en:Fi,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},Qr=(e,t)=>_i[e].other(t);function eo(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,lr(o.map(a=>a.value)))}}var to=e=>Number.isFinite(e)&&e>0?e:0;function no(e,t,n,r){return r==="emphasis"?An(e,t,n):le(e,t,n)}var Pi=A(j(),1);var so=A(L(),1);function oo(e,t){return t===!1?e.map((n,r)=>r):sr(e)}function ao(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 io(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"):Je(e,1-i/Math.max(1,o.length-1))),r}function lo(e){return!e||typeof e!="object"||Array.isArray(e)?[]:ee(Object.values(e).filter(t=>typeof t=="string"&&t!==""))}function co(e,t){return ze(e,t+1,new Set)}var Di=A(j(),1);var mo=A(L(),1);function uo(e,t){let n=typeof e=="string"?[e]:Array.isArray(e)?e:[],r=new Set;for(let o of n)typeof o=="string"&&!Sr.includes(o)&&t.forEach((a,i)=>a===o&&r.add(i));return r}var pe=A(L(),1);function fo(e,t,n){let r=ct(e);return r?.type==="scatter"&&t?.size!==void 0&&!lt(n)?ct("bubble"):r}function Li(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 Ei(e,t,n,r=!1){let o=fo(e.type,e.encoding,e.options);if(!o||!t.length)return[];let a=e.encoding??{},i=e.options??{},s=i.highlight,l=new Set(!r&&zt.includes(o.type)&&Array.isArray(i.hidden)?i.hidden.map(String):[]),c=u=>u.filter(h=>!l.has(h.label)),f=["pie","donut","waffle"];if(o.type==="donut"&&i.legend!=="none")return[];if(f.includes(o.type)){let u=oe(a.label,"label"),h=Pe(a.value,"value"),d=o.type==="waffle",m=t.map((b,C)=>({r:b,label:u(b,C),value:d?h(b,C):to(h(b,C))})),{kept:g,other:w}=d?{kept:m,other:null}:eo(m,i.other,(b,C)=>({r:{},label:Qr(V(n),b),value:C})),k=de(s,g.map(b=>b.r),g.map(b=>b.label),g.map(b=>b.value),d?"first":"max"),$=w?[...g,w]:g,M=xe(b=>d?le(b,$.length,k):no(b,$.length,k,i.colorMode)),S=d&&i.shape==="arc";return $.map((b,C)=>({label:b.label,color:M[C],...S&&{shape:"circle"}}))}if(o.type==="candlestick"){let u=qr(Array.isArray(i.ma)?i.ma:void 0,t.length),h=Yr[V(n)];return[{label:h.up,color:i.upColor??"accent"},{label:h.down,color:i.downColor??"neutralStrong"},...u.map((d,m)=>({label:h.maLegend(d),color:tn[m],shape:"line"}))]}if(o.type==="network"){let u=lo(i.groups);if(u.length<2)return[];let h=xe(d=>co(d,u.length));return u.map((d,m)=>({label:d,color:h[m],shape:"circle"}))}if(o.type==="symbolMap"){if(typeof a.group!="string")return[];let u=oe(a.group,"group"),h=ee(t.map((m,g)=>u(m,g)).filter(Boolean));if(h.length<2)return[];let d=xe(m=>ze(m,h.length,new Set));return h.map((m,g)=>({label:m,color:d[g],shape:"circle"}))}if(o.type==="scatter"){if(typeof a.series!="string"||lt(i))return[];let u=oe(a.series,"series"),h=ee(t.map((g,w)=>u(g,w)));if(h.length<2)return[];let d=Xr(s,t,h,u),m=xe(g=>ze(g,h.length,d));return c(h.map((g,w)=>({label:g,color:m[w],shape:"circle"})))}if(o.type==="timeline"){let u=typeof a.group!="string",h=u?a.status:a.group;if(typeof h!="string")return[];let d=Or(t,h,u),m=xe(g=>le(g,d.length,uo(s,d)));return c(d.map((g,w)=>({label:g,color:m[w],shape:"square"})))}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 M=oe(a.series,"series");u=ee(t.map((S,b)=>M(S,b)))}let h=Bt(o.type,a,i);if(h.length){let M=de(s,u,u,u.map(()=>0),"none"),S=xe(C=>le(C,u.length,M)),b=u.length<2?[{label:String((Array.isArray(a.y)?a.y[0]:a.y)??"y"),color:"neutral"}]:u.map((C,F)=>({label:C,color:S[F]}));return[...c(b),...h.map((C,F)=>({label:C,color:Ur(F),shape:"line"}))]}if(u.length<2)return[];let m=o.type==="bar"&&i.layout==="diverging"&&s===void 0?ir(u.length,Array.isArray(i.negative)?i.negative.map(M=>u.indexOf(String(M))):[],typeof i.neutral=="string"?u.indexOf(i.neutral):-1):-1,g=m>=0?new Set([m]):de(s,u,u,u.map(()=>0),"first");if(o.type==="radar")return c(u.map((M,S)=>({label:M,color:g.has(S)?"accent":"neutralStrong",shape:"square"})));let w=i.colorMode,k=M=>le(M,u.length,g);if((o.type==="line"||o.type==="area")&&(k=M=>Kr(M,u.length,g,o.type==="area",w)),o.type==="stream"){let M=je(t,a.x,a.y,a.series,{xType:i.xType,locale:n,aggregate:i.aggregate,dayFirst:i.dayFirst}),S=oo(M.values,i.reorder),b=ao(s,M.series,M.values);k=C=>io(C,S,b)}let $=xe(k);return c(u.map((M,S)=>({label:M,color:$[S],...o.type==="line"&&{shape:"line"}})))}return[]}function Oi(e,t){let n=e.facet;return n&&typeof n=="object"&&typeof n.by=="string"&&Zn.includes(t)&&!(t==="bar"&&e.options?.layout==="diverging")?n:void 0}function Ii(e,t,n){let{data:r,width:o,height:a,highlight:i,syncId:s,ariaLabel:l,description:c,...f}=n;return{type:e,data:r??[],by:t.by,columns:t.columns,scale:t.scale,chartProps:f,width:o,height:a,highlight:i,syncId:s,title:l,description:c}}function ho(e,t){let{spec:n}=e,r=fo(n.type,n.encoding,n.options),o=(0,Ke.useMemo)(()=>Ir(n.data),[n.data]),a=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,i=Jn(n,e.locale),s=Z(i),l=V(s),c=Ar(a?.url??null,{parse:a?.format??"auto",select:a?.select,init:e.fetchInit,locale:s}),f=tr(n),u=(0,Ke.useMemo)(()=>f?Lr(f,s):void 0,[f,s]),h=n.options?.hidden,d=Array.isArray(h)?h.map(String):[],m=d.join(""),[g,w]=(0,Ke.useState)(null);if(!r)return(0,pe.jsx)(It,{error:l==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:i});let k=o??c.data,$=t[r.type],M={...n.options??{}},S={...Li(r,n.encoding),...M,...u?{tooltip:u}:{},data:k,...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},b=n.card?.legend==="toggle"&&er(r.type,n.encoding??{},M),C=g&&g.base===m?g.hidden:d;b&&(S.hidden=C);let F=p=>w(v=>{let x=v&&v.base===m?v.hidden:d;return{base:m,hidden:x.includes(p)?x.filter(T=>T!==p):[...x,p]}}),D=S.height??220,E=Oi(n,r.type),O=a&&!k.length&&(c.loading||c.error||c.empty)?(0,pe.jsx)(It,{loading:c.loading,error:c.error,empty:c.empty,onRetry:c.reload,height:D,locale:i}):E?(0,pe.jsx)(Cr,{chart:$,...Ii(r.type,E,S)}):(0,pe.jsx)($,{...S});if(n.card){let p=n.card,v=p.legend==="auto"||p.legend==="toggle"?Ei(n,k,s,b):p.legend,x=v?.length?b?(0,pe.jsx)(Ot,{items:v,hidden:C,onToggle:F,locale:i}):v:void 0,T=p.download?(0,pe.jsx)(Dr,{data:k,columns:nr(n),filename:p.title??r.type,formats:Array.isArray(p.download)?p.download:void 0,locale:i}):void 0;O=(0,pe.jsx)(Wn,{number:p.number,title:p.title??qn(r,l),subtitle:p.subtitle,legend:x,actions:T,source:p.source||void 0,note:p.note||void 0,accent:p.accent,takeaway:p.takeaway,level:p.level,sample:p.sample,replay:p.replay!==!1,className:e.className,locale:i,children:O})}let _=e.theme??n.theme;return _&&(O=(0,pe.jsx)(rt,{theme:_,children:O})),O}function zi({cfg:e,components:t}){let n=Le();return ho({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function po(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,go.hydrateRoot)(r,(0,an.createElement)(rt,{theme:o.theme,cssVars:!0},(0,an.createElement)(zi,{cfg:o,components:{[e]:t}})))}po("chord",on);})();
|
|
27
|
+
`}function yi(e){return Array.from((e??"").replace(/[\\/:*?"<>|\r\n\t]+/g,"-").trim()).slice(0,80).join("")||"chart"}function Jt(e,t){let n=document.createElement("a");n.href=URL.createObjectURL(e),n.download=t,n.click(),setTimeout(()=>URL.revokeObjectURL(n.href),1e4)}var Rr=2,$e=16;function Fr(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 _r(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 Pr(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+$e*2,i+$e*2],c=o.cloneNode(!0),f=c.querySelectorAll("*"),u=new Map;o.querySelectorAll("*").forEach((m,g)=>{let w;for(let k of Array.from(m.attributes)){if(!gi.test(k.value))continue;let v=(w??(w=getComputedStyle(m))).getPropertyValue(k.name);v&&f[g].setAttribute(k.name,Fr(v,u))}}),c.removeAttribute("style");for(let[m,g]of Object.entries({viewBox:`${-$e} ${-$e} ${s} ${l}`,width:s*t,height:l*t,"font-family":getComputedStyle(o).fontFamily}))c.setAttribute(m,String(g));let h=Fr(getComputedStyle(r).backgroundColor,u),d=o.parentElement?.querySelector("canvas")??null;if(n){let m=c.querySelector("desc")?.nextSibling??c.firstChild;c.insertBefore(_r("rect",{x:-$e,y:-$e,width:s,height:l,fill:h}),m),d&&c.insertBefore(_r("image",{href:d.toDataURL(),width:a,height:i}),m)}return{svg:new XMLSerializer().serializeToString(c),w:s,h:l,vw:a,vh:i,bg:h,canvas:d}}function xi(e,t){let n=Pr(e,Rr,!1);if(!n)return;let r=Rr,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,$e*r,$e*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&&Jt(l,`${t}.png`),"image/png")},s.onerror=()=>URL.revokeObjectURL(i),s.src=i}function Dr(e){let t=ue(e.theme),n=V(Z(e.locale))==="ko",r=yi(e.filename),o=(a,i)=>{if(a==="csv")return Jt(new Blob([bi(e.data,e.columns?.length?e.columns:pi(e.data))],{type:"text/csv;charset=utf-8"}),`${r}.csv`);if(a==="png")return xi(i,r);let s=Pr(i,1,!0);s&&Jt(new Blob([s.svg],{type:"image/svg+xml"}),`${r}.svg`)};return(0,qt.jsx)("span",{style:{display:"inline-flex",gap:6,flex:"none"},children:fi.filter(a=>!e.formats||e.formats.includes(a)).map(a=>{let i=a.toUpperCase(),s=n?`${i} 내려받기`:`Download ${i}`;return(0,qt.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 Er=A(L(),1);function Lr(e,t=q){let n=Me(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(In,(f,u)=>o(a,u.trim())??(l=!0,""));l||i.push(c)}return i.length?i.map((s,l)=>(0,Er.jsx)("div",{children:s},l)):null}}function Or(e,t,n=!1){let r=oe(t,"group"),o=e.map((s,l)=>r(s,l)).filter(Boolean),a=ee(o);if(!n)return a;let i=new Map;for(let s of o)i.set(s,(i.get(s)??0)+1);return a.map((s,l)=>[s,l]).sort((s,l)=>i.get(s[0])-i.get(l[0])||s[1]-l[1]).map(([s])=>s)}function Ir(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 Wr=A(j(),1);var U=A(j(),1);function zr(e,t){let n=ue(e.theme),[r,o,a]=ht(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,f=gt(e.reducedMotion??"auto"),u=e.animate!==!1&&!f&&se,h=Tr(r,e.animateOnView!==!1&&u),d=Z(e.locale),m=V(d),g=(0,U.useMemo)(()=>Me(e.format,d,t.format),[e.format,d,t.format]),w=(0,U.useCallback)(z=>Ze(z,{locale:d}),[d]),k=(0,U.useMemo)(()=>Qe(g,e.unit),[g,e.unit]),v=(0,U.useMemo)(()=>ut(e.data),[e.data]),[M,S]=(0,U.useState)(null),[b,C]=(0,U.useState)(null),F=(0,U.useRef)([]),D=(0,U.useRef)(e.onHover);D.current=e.onHover;let E=(0,U.useRef)(e.onClick);E.current=e.onClick;let O=(0,U.useRef)(null),_=(0,U.useRef)(null),p=(0,U.useRef)(null),$=(0,U.useCallback)((z,J="pointer")=>{if(p.current!==z){p.current=z;let ie=z===null?null:F.current[z]??null;queueMicrotask(()=>D.current?.(ie)),_.current?.(z)}O.current=z===null?null:J,S(z),C(O.current)},[]),x=(0,U.useCallback)(z=>{O.current!=="keyboard"&&(O.current=z===null?null:"sync",S(z),C(O.current))},[]),T=(0,U.useCallback)(z=>{let J=F.current[z];J&&E.current?.(J)},[]),R=Vn(e.replayKey),P=e.width!==void 0||(a??0)>0,G={enabled:u,active:h.visible&&P,near:h.near,replayKey:R,dataKey:v,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},fe=(0,U.useCallback)((z,J=1)=>M===null||M===z?J:J*.38,[M]);return{p:n,width:s,height:c,measured:P,responsive:e.width===void 0,pending:se&&i&&e.width===void 0&&a===null,node:r,hydrated:i,ref:o,motion:G,fv:k,fmt:g,pct:w,locale:d,lang:m,t:m==="ko"?wn:kn,active:M,via:b,setActive:$,click:T,events:F,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:fe,sig:v,description:e.description,reduced:f,publish:_,applySync:x}}var W=A(j(),1);function ki(e){return 1-Math.pow(1-e,3)}function wi(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function $i(e){return e==="easeInOut"?wi:e==="linear"?t=>t:ki}function vi(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 Oe(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 pt(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 Br(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 Hr(e,t,n,r){if(!t||!n||t.length!==n.length)return Oe(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 Oe(s,n[i]))o.push(l)}return o.length===r?o:Oe(e,r)}var bt=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||!pt(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),Br(n.from,n.vel,n.to),n.cur=n.from.slice(),n.curVel=n.vel.slice(),n.done=pt(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=Hr(s.cur,s.parts,i.parts,c),s.vel=Hr(s.curVel,s.parts,i.parts,c),s.parts=i.parts,s.to=i.to.slice(),Br(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=pt(s.from,s.to)&&s.vel.every(f=>Math.abs(f)<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=pt(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=Oe(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=$i(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=Oe(s.from,c)),s.vel.length!==c&&(s.vel=Oe(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 f;if(this.easing==="spring"){let u=Math.exp(-a*l),h=a*l>=8&&a*l<20,d=0;for(let m=0;m<c;m++){let g=s.from[m]-s.to[m],w=s.vel[m]+a*g;s.cur[m]=s.to[m]+(g+w*l)*u,s.curVel[m]=(s.vel[m]-a*w*l)*u,h&&d<.15&&(d=Math.max(d,Math.abs(s.cur[m]-s.to[m]),Math.abs(s.curVel[m]/a)))}f=a*l>=20||h&&d<.15,s.progress=Math.min(1,1-(1+a*l)*u)}else{let u=Math.min(1,l/o),h=r(u),d=vi(this.easing,u)/o;for(let m=0;m<c;m++)s.cur[m]=s.from[m]+(s.to[m]-s.from[m])*h,s.curVel[m]=(s.to[m]-s.from[m])*d;f=u>=1,s.progress=h}if(f){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,yt=0;function jr(e){yt=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"&&(yt=requestAnimationFrame(jr))}function Gr(e){return We.add(e),!yt&&typeof requestAnimationFrame<"u"&&(yt=requestAnimationFrame(jr)),()=>{We.delete(e)}}function Mi(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 Vr(e,t){let n=(0,W.useMemo)(()=>Mi(e),[e]),{enabled:r,active:o,near:a=!0,replayKey:i,dataKey:s,easing:l="spring",duration:c=900,stagger:f=0}=t,u=(0,W.useRef)(null),h=(0,W.useRef)("init"),d=(0,W.useRef)(null),m=(0,W.useRef)(s),g=(0,W.useRef)(i),w=(0,W.useRef)(!1),k=(0,W.useRef)(0),[,v]=(0,W.useState)(0),M=(0,W.useRef)(null),S=(0,W.useRef)(!0);u.current||(u.current=new bt,u.current.configure(l,c),u.current.snap(n),d.current=n);let b=u.current;if(b.configure(l,c),d.current!==n){let _=h.current,p=!Object.is(m.current,s);b.sameTargets(n)?b.refreshData(n):!r||_==="init"?b.snap(n):_==="idle"?b.hold(n):_==="running"||p?b.update(n,Ye(),f):b.snap(n),d.current=n,m.current=s}let C=(0,W.useRef)(()=>!1);C.current=_=>{if(!S.current)return!1;let p=b.step(_);return!p&&h.current==="running"&&(h.current="done"),v($=>($+1)%1e9),p||(M.current=null),p};let F=(0,W.useCallback)(()=>{if(!se||M.current||!b.animating)return;let _=p=>C.current(p);M.current=Gr(_)},[b]);he(()=>{let _=!Object.is(g.current,i);if(g.current=i,!r){(h.current!=="done"||b.animating)&&(b.snap(d.current??n),h.current="done",v(p=>p+1));return}h.current==="init"||_&&a?(b.hold(d.current??n),h.current="idle",w.current=!1,v(p=>p+1)):_&&(w.current=!0)},[r,i]),he(()=>{!r||!a||!w.current||(w.current=!1,b.hold(d.current??n),h.current="idle",v(_=>_+1))},[a,r]),(0,W.useEffect)(()=>{r&&o&&h.current==="idle"&&(b.start(Ye()),k.current+=1,h.current="running",F(),v(_=>_+1))},[r,o,i,b,F]),(0,W.useEffect)(()=>{b.animating&&F()}),(0,W.useEffect)(()=>(S.current=!0,()=>{S.current=!1,M.current?.(),M.current=null}),[]);let D=Ye(),E=b.elapsed(D),O=r&&h.current==="idle";return{items:b.items(),get:_=>b.get(_),elapsed:O?0:E,fade:(_,p=320)=>O?0:Number.isFinite(E)?Math.max(0,Math.min(1,(E-_)/p)):1,waiting:O,animating:b.animating,generation:k.current}}var Zt=A(L(),1);function Kr(e,t,n,r,o){if(r)return o==="categorical"?le(e,t,n):Nn(e,t,n);if(o==="categorical")return le(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 Ti=A(j(),1);var Qt=A(L(),1);var Ur=e=>e?"neutralStrong":"accent";var en=A(L(),1);function Xr(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 Ci=A(j(),1);var nn=A(L(),1),Si={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}, ${ye(n,"candle")}. First open ${r}, last close ${o}`,ma:e=>`MA${e}`,up:"Up",down:"Down",maLegend:e=>`${e}-day MA`},Yr={en:Si,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}일 이동평균`}},tn=["ink","muted","dim"];function Jr(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,tn.length)}var rn=A(j(),1);function qr(e,t=.04){let n=e.length,r=(d,m)=>Math.max(0,e[d]?.[m]||0),o=(d,m)=>r(d,m)+(d===m?0:r(m,d)),a=Array.from({length:n},(d,m)=>Array.from({length:n},(g,w)=>o(m,w)).reduce((g,w)=>g+w,0)),i=a.reduce((d,m)=>d+m,0),s=Math.min(t,n?we*.5/n:0),l=i>0?Math.max(0,we-s*n)/i:0,c=[],f=Array.from({length:n},()=>[]),u=0;for(let d=0;d<n;d++){let m=u;for(let g=0;g<n;g++){let w=u;u+=o(d,g)*l,f[d][g]={index:d,sub:g,a0:w,a1:u,value:r(d,g)}}c.push({index:d,a0:m,a1:u,value:a[d]}),u+=s}let h=[];for(let d=0;d<n;d++)for(let m=d;m<n;m++){let g=f[d][m],w=f[m][d];g.value<=0&&w.value<=0||h.push(g.value>=w.value?{source:g,target:w}:{source:w,target:g})}return{groups:c,chords:h}}function Zr(e,t,n,r,o,a,i){let s=b=>te(e,t,n,b),l=b=>Math.round(b*100)/100,[c,f]=s(r),[u,h]=s(o),[d,m]=s(a),[g,w]=s(i),k=o-r>Math.PI?1:0,v=i-a>Math.PI?1:0,M=r===a&&o===i,S=`M${l(c)},${l(f)}A${l(n)},${l(n)} 0 ${k} 1 ${l(u)},${l(h)}`;return M?(S+=`Q${l(e)},${l(t)} ${l(c)},${l(f)}Z`,S):(S+=`Q${l(e)},${l(t)} ${l(d)},${l(m)}A${l(n)},${l(n)} 0 ${v} 1 ${l(g)},${l(w)}Q${l(e)},${l(t)} ${l(c)},${l(f)}Z`,S)}var ve=A(L(),1),Ai={kind:"Chord diagram",sent:"Sent",received:"Received",groups:e=>ye(e,"group")},Ni={en:Ai,ko:{kind:"코드 다이어그램",sent:"보냄",received:"받음",groups:e=>`그룹 ${e}개`}};function on(e){let t=zr(e,{height:p=>Math.max(240,Math.min(340,p*.7)),duration:1e3}),{p:n,width:r,height:o}=t,a=(0,rn.useMemo)(()=>{let p=H=>e.data.some(X=>X&&typeof X=="object"&&H in X),$=oe(e.source??(p("source")?"source":"from"),"source"),x=oe(e.target??(p("target")?"target":"to"),"target"),T=Pe(e.value,"value"),R=ee(e.data.flatMap((H,X)=>[$(H,X),x(H,X)])),P=new Map(R.map((H,X)=>[H,X])),G=R.map(()=>R.map(()=>0));e.data.forEach((H,X)=>{let sn=P.get($(H,X)),ln=P.get(x(H,X));sn===void 0||ln===void 0||(G[sn][ln]+=Math.max(0,T(H,X)||0))});let fe=qr(G,e.padAngle??.05),z=fe.groups.map(H=>H.value),J=de(e.highlight,R,R,z,"max"),ie=z.reduce((H,X)=>H+X,0)||1;return{names:R,matrix:G,lay:fe,hi:J,grand:ie}},[e.data,e.source,e.target,e.value,e.padAngle,e.highlight]),i=Math.max(...a.names.map(p=>Se(p,11.5,700)),20)+14,s=Math.max(40,Math.min(o/2-16,r/2-i)),l=r/2,c=o/2,f=Math.max(8,Math.min(14,s*.09)),u=s-f-3,h=t.motion.duration??1e3,d=(0,rn.useMemo)(()=>[{key:"__sweep",to:[we],from:[0],data:null},{key:"__rib",to:[1],from:[0],delay:h*.45,data:null}],[h]),m=Vr(d,t.motion),g=m.get("__sweep")?.[0]??we,w=m.get("__rib")?.[0]??1,k=K(n,"accent"),v=Ni[t.lang],M=a.names.length,S=p=>a.hi.has(p.source.index)||a.hi.has(p.target.index),b=t.active,C=b!==null&&b<M?b:null,F=b!==null&&b>=M?a.lay.chords[b-M]:null,D=[...a.lay.groups.map(p=>({datum:null,index:p.index,key:a.names[p.index],label:a.names[p.index],value:p.value,formatted:`${t.fv(p.value)} (${t.pct(p.value/a.grand*100)})`})),...a.lay.chords.map((p,$)=>({datum:null,index:M+$,key:`${p.source.index}-${p.target.index}`,label:`${a.names[p.source.index]} ↔ ${a.names[p.target.index]}`,value:p.source.value+(p.source.index===p.target.index?0:p.target.value),formatted:`${a.names[p.source.index]}→${a.names[p.target.index]} ${t.fv(p.source.value)}, ${a.names[p.target.index]}→${a.names[p.source.index]} ${t.fv(p.target.value)}`}))],E=null;if(C!==null){let p=a.lay.groups[C],[$,x]=te(l,c,s,(p.a0+p.a1)/2),T=a.matrix[C].reduce((P,G)=>P+G,0),R=a.matrix.reduce((P,G)=>P+G[C],0);E={x:$,y:x,title:a.names[C],rows:[{label:v.sent,value:t.fv(T),color:a.hi.has(C)?k.fill:n.paint("neutralStrong")},{label:v.received,value:t.fv(R)}]}}else if(F){let p=(F.source.a0+F.source.a1)/2,[$,x]=te(l,c,u*.6,p);E={x:$,y:x,title:`${a.names[F.source.index]} ↔ ${a.names[F.target.index]}`,rows:[{label:`${a.names[F.source.index]} →`,value:t.fv(F.source.value)},{label:`${a.names[F.target.index]} →`,value:t.fv(F.target.value)}]}}let O=p=>C!==null?p.source.index===C||p.target.index===C?.82:.08:F?p===F?.88:.08:S(p)?.68:.4,_=e.description??`${v.kind}. ${v.groups(M)}: ${a.lay.groups.map(p=>`${a.names[p.index]} ${t.fv(p.value)}`).join(", ")}.`;return(0,ve.jsxs)(Kn,{c:t,kind:v.kind,ariaLabel:e.ariaLabel,description:_,events:D,tip:E,renderTip:e.tooltip,className:e.className,style:e.style,theme:e.theme,children:[(0,ve.jsx)("g",{opacity:Math.min(1,w*1.2),children:a.lay.chords.map((p,$)=>(0,ve.jsx)("path",{className:"ztd-mark",d:Zr(l,c,u,p.source.a0,p.source.a1,p.target.a0,p.target.a1),fill:S(p)?k.fill:n.paint("neutralStrong"),opacity:O(p),stroke:n.paint("panel"),strokeWidth:.6,onPointerEnter:x=>t.setActive(M+$,x.pointerType==="touch"?"touch":"pointer"),onClick:()=>t.click(M+$)},$))}),a.lay.groups.map(p=>{let $=Math.min(p.a0,g),x=Math.min(p.a1,g),T=a.hi.has(p.index),R=Gt(l,c,s-f,s,$,x),P=(p.a0+p.a1)/2,[G,fe]=te(l,c,s+10,P),z=Math.sin(P);return(0,ve.jsxs)("g",{onPointerEnter:J=>t.setActive(p.index,J.pointerType==="touch"?"touch":"pointer"),onClick:()=>t.click(p.index),children:[R?(0,ve.jsx)("path",{className:"ztd-mark",d:R,fill:T?k.fill:n.paint("ink"),opacity:C===null||C===p.index?1:.4,stroke:b===p.index&&t.via==="keyboard"?n.paint("accent"):"none",strokeWidth:2}):null,t.showLabels?(0,ve.jsx)(Un,{x:G,y:fe+(Math.cos(P)>.9?-3:Math.cos(P)<-.9?4:0),anchor:z>.12?"start":z<-.12?"end":"middle",size:11.5,weight:T||C===p.index?800:600,fill:n.paint(T?"ink":"muted"),opacity:m.fade(h*.4,300),children:a.names[p.index]}):null]},p.index)})]})}var Ri=A(j(),1);var ro=A(L(),1),Fi={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${ye(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},_i={en:Fi,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},Qr=(e,t)=>_i[e].other(t);function eo(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,lr(o.map(a=>a.value)))}}var to=e=>Number.isFinite(e)&&e>0?e:0;function no(e,t,n,r){return r==="emphasis"?An(e,t,n):le(e,t,n)}var Pi=A(j(),1);var so=A(L(),1);function oo(e,t){return t===!1?e.map((n,r)=>r):sr(e)}function ao(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 io(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}function lo(e){return!e||typeof e!="object"||Array.isArray(e)?[]:ee(Object.values(e).filter(t=>typeof t=="string"&&t!==""))}function co(e,t){return ze(e,t+1,new Set)}var Di=A(j(),1);var mo=A(L(),1);var Li=26;var xc=Li*.62;function uo(e,t){let n=typeof e=="string"?[e]:Array.isArray(e)?e:[],r=new Set;for(let o of n)typeof o=="string"&&!Sr.includes(o)&&t.forEach((a,i)=>a===o&&r.add(i));return r}var pe=A(L(),1);function fo(e,t,n){let r=ct(e);return r?.type==="scatter"&&t?.size!==void 0&&!lt(n)?ct("bubble"):r}function Ei(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 Oi(e,t,n,r=!1){let o=fo(e.type,e.encoding,e.options);if(!o||!t.length)return[];let a=e.encoding??{},i=e.options??{},s=i.highlight,l=new Set(!r&&zt.includes(o.type)&&Array.isArray(i.hidden)?i.hidden.map(String):[]),c=u=>u.filter(h=>!l.has(h.label)),f=["pie","donut","waffle"];if(o.type==="donut"&&i.legend!=="none")return[];if(f.includes(o.type)){let u=oe(a.label,"label"),h=Pe(a.value,"value"),d=o.type==="waffle",m=t.map((b,C)=>({r:b,label:u(b,C),value:d?h(b,C):to(h(b,C))})),{kept:g,other:w}=d?{kept:m,other:null}:eo(m,i.other,(b,C)=>({r:{},label:Qr(V(n),b),value:C})),k=de(s,g.map(b=>b.r),g.map(b=>b.label),g.map(b=>b.value),d?"first":"max"),v=w?[...g,w]:g,M=xe(b=>d?le(b,v.length,k):no(b,v.length,k,i.colorMode)),S=d&&i.shape==="arc";return v.map((b,C)=>({label:b.label,color:M[C],...S&&{shape:"circle"}}))}if(o.type==="candlestick"){let u=Jr(Array.isArray(i.ma)?i.ma:void 0,t.length),h=Yr[V(n)];return[{label:h.up,color:i.upColor??"accent"},{label:h.down,color:i.downColor??"neutralStrong"},...u.map((d,m)=>({label:h.maLegend(d),color:tn[m],shape:"line"}))]}if(o.type==="network"){let u=lo(i.groups);if(u.length<2)return[];let h=xe(d=>co(d,u.length));return u.map((d,m)=>({label:d,color:h[m],shape:"circle"}))}if(o.type==="symbolMap"){if(typeof a.group!="string")return[];let u=oe(a.group,"group"),h=ee(t.map((m,g)=>u(m,g)).filter(Boolean));if(h.length<2)return[];let d=xe(m=>ze(m,h.length,new Set));return h.map((m,g)=>({label:m,color:d[g],shape:"circle"}))}if(o.type==="scatter"){if(typeof a.series!="string"||lt(i))return[];let u=oe(a.series,"series"),h=ee(t.map((g,w)=>u(g,w)));if(h.length<2)return[];let d=Xr(s,t,h,u),m=xe(g=>ze(g,h.length,d));return c(h.map((g,w)=>({label:g,color:m[w],shape:"circle"})))}if(o.type==="timeline"){let u=typeof a.group!="string",h=u?a.status:a.group;if(typeof h!="string")return[];let d=Or(t,h,u),m=xe(g=>le(g,d.length,uo(s,d)));return c(d.map((g,w)=>({label:g,color:m[w],shape:"square"})))}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 M=oe(a.series,"series");u=ee(t.map((S,b)=>M(S,b)))}let h=Bt(o.type,a,i);if(h.length){let M=de(s,u,u,u.map(()=>0),"none"),S=xe(C=>le(C,u.length,M)),b=u.length<2?[{label:String((Array.isArray(a.y)?a.y[0]:a.y)??"y"),color:"neutral"}]:u.map((C,F)=>({label:C,color:S[F]}));return[...c(b),...h.map((C,F)=>({label:C,color:Ur(F),shape:"line"}))]}if(u.length<2)return[];let m=o.type==="bar"&&i.layout==="diverging"&&s===void 0?ir(u.length,Array.isArray(i.negative)?i.negative.map(M=>u.indexOf(String(M))):[],typeof i.neutral=="string"?u.indexOf(i.neutral):-1):-1,g=m>=0?new Set([m]):de(s,u,u,u.map(()=>0),"first");if(o.type==="radar")return c(u.map((M,S)=>({label:M,color:g.has(S)?"accent":"neutralStrong",shape:"square"})));let w=i.colorMode,k=M=>le(M,u.length,g);if((o.type==="line"||o.type==="area")&&(k=M=>Kr(M,u.length,g,o.type==="area",w)),o.type==="stream"){let M=je(t,a.x,a.y,a.series,{xType:i.xType,locale:n,aggregate:i.aggregate,dayFirst:i.dayFirst}),S=oo(M.values,i.reorder),b=ao(s,M.series,M.values);k=C=>io(C,S,b)}let v=xe(k);return c(u.map((M,S)=>({label:M,color:v[S],...o.type==="line"&&{shape:"line"}})))}return[]}function Ii(e,t){let n=e.facet;return n&&typeof n=="object"&&typeof n.by=="string"&&Zn.includes(t)&&!(t==="bar"&&e.options?.layout==="diverging")?n:void 0}function zi(e,t,n){let{data:r,width:o,height:a,highlight:i,syncId:s,ariaLabel:l,description:c,...f}=n;return{type:e,data:r??[],by:t.by,columns:t.columns,scale:t.scale,chartProps:f,width:o,height:a,highlight:i,syncId:s,title:l,description:c}}function ho(e,t){let{spec:n}=e,r=fo(n.type,n.encoding,n.options),o=(0,Ke.useMemo)(()=>Ir(n.data),[n.data]),a=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,i=qn(n,e.locale),s=Z(i),l=V(s),c=Ar(a?.url??null,{parse:a?.format??"auto",select:a?.select,init:e.fetchInit,locale:s}),f=tr(n),u=(0,Ke.useMemo)(()=>f?Lr(f,s):void 0,[f,s]),h=n.options?.hidden,d=Array.isArray(h)?h.map(String):[],m=d.join(""),[g,w]=(0,Ke.useState)(null);if(!r)return(0,pe.jsx)(It,{error:l==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:i});let k=o??c.data,v=t[r.type],M={...n.options??{}},S={...Ei(r,n.encoding),...M,...u?{tooltip:u}:{},data:k,...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},b=n.card?.legend==="toggle"&&er(r.type,n.encoding??{},M),C=g&&g.base===m?g.hidden:d;b&&(S.hidden=C);let F=p=>w($=>{let x=$&&$.base===m?$.hidden:d;return{base:m,hidden:x.includes(p)?x.filter(T=>T!==p):[...x,p]}}),D=S.height??220,E=Ii(n,r.type),O=a&&!k.length&&(c.loading||c.error||c.empty)?(0,pe.jsx)(It,{loading:c.loading,error:c.error,empty:c.empty,onRetry:c.reload,height:D,locale:i}):E?(0,pe.jsx)(Cr,{chart:v,...zi(r.type,E,S)}):(0,pe.jsx)(v,{...S});if(n.card){let p=n.card,$=p.legend==="auto"||p.legend==="toggle"?Oi(n,k,s,b):p.legend,x=$?.length?b?(0,pe.jsx)(Ot,{items:$,hidden:C,onToggle:F,locale:i}):$:void 0,T=p.download?(0,pe.jsx)(Dr,{data:k,columns:nr(n),filename:p.title??r.type,formats:Array.isArray(p.download)?p.download:void 0,locale:i}):void 0;O=(0,pe.jsx)(Wn,{number:p.number,title:p.title??Jn(r,l),subtitle:p.subtitle,legend:x,actions:T,source:p.source||void 0,note:p.note||void 0,accent:p.accent,takeaway:p.takeaway,level:p.level,sample:p.sample,replay:p.replay!==!1,className:e.className,locale:i,children:O})}let _=e.theme??n.theme;return _&&(O=(0,pe.jsx)(rt,{theme:_,children:O})),O}function Bi({cfg:e,components:t}){let n=Le();return ho({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function po(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,go.hydrateRoot)(r,(0,an.createElement)(rt,{theme:o.theme,cssVars:!0},(0,an.createElement)(Bi,{cfg:o,components:{[e]:t}})))}po("chord",on);})();
|