ztd-charts-cli 0.11.3 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/api.js +1 -1
- package/dist/{chunk-VUZPZ5FT.js → chunk-LR5X5LI2.js} +53 -29
- package/dist/cli.js +6 -1
- package/dist/client/area.js +6 -6
- package/dist/client/bar.js +9 -9
- package/dist/client/barRace.js +6 -6
- package/dist/client/beeswarm.js +7 -7
- package/dist/client/box.js +9 -9
- package/dist/client/bubble.js +7 -7
- package/dist/client/bullet.js +6 -6
- package/dist/client/bump.js +6 -6
- package/dist/client/calendar.js +10 -10
- package/dist/client/candlestick.js +6 -6
- package/dist/client/chord.js +7 -7
- package/dist/client/choropleth.js +9 -9
- package/dist/client/cohort.js +28 -0
- package/dist/client/donut.js +6 -6
- package/dist/client/dumbbell.js +6 -6
- package/dist/client/flowMap.js +7 -7
- package/dist/client/funnel.js +9 -9
- package/dist/client/gauge.js +6 -6
- package/dist/client/heatmap.js +9 -9
- package/dist/client/histogram.js +6 -6
- package/dist/client/horizon.js +28 -0
- package/dist/client/line.js +6 -6
- package/dist/client/lollipop.js +6 -6
- package/dist/client/marimekko.js +6 -6
- package/dist/client/network.js +9 -9
- package/dist/client/parallel.js +6 -6
- package/dist/client/pareto.js +6 -6
- package/dist/client/pie.js +6 -6
- package/dist/client/radar.js +7 -7
- package/dist/client/radialBar.js +6 -6
- package/dist/client/ridgeline.js +6 -6
- package/dist/client/sankey.js +10 -10
- package/dist/client/scatter.js +10 -10
- package/dist/client/segmented.js +6 -6
- package/dist/client/skyline.js +7 -7
- package/dist/client/slope.js +6 -6
- package/dist/client/sparkTable.js +28 -0
- package/dist/client/sparkline.js +6 -6
- package/dist/client/stream.js +7 -7
- package/dist/client/sunburst.js +7 -7
- package/dist/client/symbolMap.js +7 -7
- package/dist/client/tileMap.js +6 -6
- package/dist/client/timeline.js +9 -9
- package/dist/client/tree.js +6 -6
- package/dist/client/treemap.js +7 -7
- package/dist/client/waffle.js +7 -7
- package/dist/client/waterfall.js +6 -6
- package/package.json +2 -2
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
(()=>{var hi=Object.create;var Xn=Object.defineProperty;var gi=Object.getOwnPropertyDescriptor;var pi=Object.getOwnPropertyNames;var bi=Object.getPrototypeOf,yi=Object.prototype.hasOwnProperty;var en=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var xi=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of pi(t))!yi.call(e,o)&&o!==n&&Xn(e,o,{get:()=>t[o],enumerable:!(r=gi(t,o))||r.enumerable});return e};var N=(e,t,n)=>(n=e!=null?hi(bi(e)):{},xi(t||!e||!e.__esModule?Xn(n,"default",{value:e,enumerable:!0}):n,e));var Y=en((Vs,Un)=>{Un.exports=globalThis.__ztdReact.react});var Jn=en((Ks,Yn)=>{Yn.exports=globalThis.__ztdReact["react-dom/client"]});var z=en((al,Mr)=>{Mr.exports=globalThis.__ztdReact["react/jsx-runtime"]});var Bn=N(Y(),1),ri=N(Jn(),1);var yt=N(Y(),1);var Pt=N(Y(),1);var qn=N(Y(),1),Ye=(0,qn.createContext)(void 0);var tr=N(Y(),1);var ki=["bg","panel","ink","muted","dim","accent","accentText","onAccent","accent2","accent3","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"],Zn='"Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, -apple-system, sans-serif',Qn='"Roboto Mono", "Share Tech Mono", ui-monospace, SFMono-Regular, Menlo, monospace',Ee={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:Zn,monoFamily:Qn,radius:18,radiusCode:14,radiusMark:4},tn={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:Zn,monoFamily:Qn,radius:18,radiusCode:14,radiusMark:4},nn={dark:Ee,light:tn};function vt(e){return`--ztd-${e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}function rn(e){let t={};for(let n of ki){let r=e[n];typeof r=="string"&&(t[vt(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 on(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 wi=`
|
|
2
|
+
.ztd-root{position:relative;-webkit-tap-highlight-color:transparent}
|
|
3
|
+
.ztd-root:focus{outline:none}
|
|
4
|
+
.ztd-root:focus-visible{outline:2px solid var(--ztd-accent,${Ee.accent});outline-offset:3px;border-radius:6px}
|
|
5
|
+
.ztd-svg{display:block;overflow:visible;user-select:none;-webkit-user-select:none}
|
|
6
|
+
.ztd-mark{transition:opacity .18s ease,fill .18s ease,stroke .18s ease,stroke-width .18s ease}
|
|
7
|
+
.ztd-tip{animation:ztd-fade .14s ease-out;transition:left .2s cubic-bezier(.22,1,.36,1),top .2s cubic-bezier(.22,1,.36,1)}
|
|
8
|
+
.ztd-guide{transition:transform .2s cubic-bezier(.22,1,.36,1)}
|
|
9
|
+
.ztd-still .ztd-tip,.ztd-still .ztd-guide{transition:none;animation:none}
|
|
10
|
+
.ztd-btn{appearance:none;font:inherit;cursor:pointer;transition:background .14s,color .14s,border-color .14s}
|
|
11
|
+
.ztd-btn:focus{outline:none}
|
|
12
|
+
.ztd-btn:focus-visible{outline:2px solid var(--ztd-accent,${Ee.accent});outline-offset:2px}
|
|
13
|
+
.ztd-card{transition:border-color .16s ease}
|
|
14
|
+
.ztd-card:hover{border-color:var(--ztd-dim,${Ee.dim})}
|
|
15
|
+
@media (prefers-reduced-motion: reduce){.ztd-mark,.ztd-tip,.ztd-guide,.ztd-btn,.ztd-card{transition:none;animation:none}}
|
|
16
|
+
@keyframes ztd-pop{from{opacity:0;transform:scale(.45)}to{opacity:1;transform:none}}
|
|
17
|
+
@keyframes ztd-fade{from{opacity:0}to{opacity:1}}
|
|
18
|
+
.ztd-pop{transform-box:fill-box;transform-origin:center}
|
|
19
|
+
@keyframes ztd-pulse{0%,100%{opacity:.55}50%{opacity:1}}
|
|
20
|
+
.ztd-skeleton{animation:ztd-pulse 1.4s ease-in-out infinite}
|
|
21
|
+
@media (prefers-reduced-motion: reduce){.ztd-skeleton{animation:none}}
|
|
22
|
+
`;function nr(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 rr(e,t){let[n]=(0,tr.useState)(!e.motion.enabled);return e.motion.enabled&&e.hydrated&&(!n||t.waiting||t.generation>0)}var er=!1;function at(){if(er||typeof document>"u"||(er=!0,document.getElementById("ztd-base")))return;let e=document.createElement("style");e.id="ztd-base",e.textContent=wi,document.head.appendChild(e)}var $t=N(Y(),1),be=typeof window<"u"&&typeof document<"u",Ce=be?$t.useLayoutEffect:$t.useEffect;function Mt(){return typeof performance<"u"?performance.now():Date.now()}function X(e){return e!==void 0&&/^ko([-_]|$)/i.test(e)?"ko":"en"}function Se(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}var or={chart:"chart",table:e=>`${e} data`,more:e=>`and ${e} more`,value:"Value",empty:"No data."},ir={chart:"차트",table:e=>`${e} 데이터`,more:e=>`외 ${e}개`,value:"값",empty:"데이터가 없어요."};var vi=[{id:"basic",en:"Basic",ko:"기본"},{id:"intermediate",en:"Intermediate",ko:"중급"},{id:"advanced",en:"Advanced",ko:"심화"}],$i={basic:{bg:"line2",fg:"ink"},intermediate:{bg:"tint",fg:"accentText"},advanced:{bg:"ink",fg:"onInk"}};function Mi(e,t){let n=t.trim().toLowerCase();return e.find(r=>r.id===n||r.en.toLowerCase()===n||r.ko===t.trim())}function Ti(e){return Mi(vi,e)}function ar(e,t){let n=Ti(e);return{text:n?n[t]:e,...$i[n?.id??"basic"]}}var sr={white:"#ffffff",black:"#000000",transparent:"#00000000"};function Je(e){if(!e)return null;let t=e.trim(),n=/^var\(\s*--[\w-]+\s*,\s*(.+)\)$/i.exec(t);if(n&&(t=n[1].trim()),sr[t.toLowerCase()]&&(t=sr[t.toLowerCase()]),t.startsWith("#")){let o=t.slice(1);if((o.length===3||o.length===4)&&(o=o.split("").map(a=>a+a).join("")),o.length!==6&&o.length!==8||/[^\da-f]/i.test(o))return null;let i=parseInt(o,16);return o.length===6?[i>>16&255,i>>8&255,i&255,1]:[parseInt(o.slice(0,2),16),parseInt(o.slice(2,4),16),parseInt(o.slice(4,6),16),parseInt(o.slice(6,8),16)/255]}let r=/^rgba?\(([^)]+)\)$/i.exec(t);if(r){let o=r[1].split(/[\s,/]+/).filter(Boolean);if(o.length<3)return null;let i=o.slice(0,3).map(s=>s.endsWith("%")?parseFloat(s)/100*255:parseFloat(s)),a=o[3]!==void 0?o[3].endsWith("%")?parseFloat(o[3])/100:parseFloat(o[3]):1;return i.some(s=>Number.isNaN(s))?null:[i[0],i[1],i[2],Number.isNaN(a)?1:a]}return null}function ur(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 sn(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 qe(e){let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function lr(e){return .2126*qe(e[0])+.7152*qe(e[1])+.0722*qe(e[2])}function st(e,t,n){let r=typeof e=="string"?Je(e):e,o=typeof t=="string"?Je(t):t;if(!r||!o)return 0;let i=n?typeof n=="string"?Je(n):n:null;o[3]<1&&i&&(o=sn(o,i));let a=r[3]<1?sn(r,o):r,s=lr(a),l=lr(o);return(Math.max(s,l)+.05)/(Math.min(s,l)+.05)}function Ci(e){return[qe(e[0]),qe(e[1]),qe(e[2])]}function an(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 cr(e){let[t,n,r]=Ci(e),o=Math.cbrt(.4122214708*t+.5363325363*n+.0514459929*r),i=Math.cbrt(.2119034982*t+.6806995451*n+.1073969566*r),a=Math.cbrt(.0883024619*t+.2817188376*n+.6299787005*r);return[.2104542553*o+.793617785*i-.0040720468*a,1.9779984951*o-2.428592205*i+.4505937099*a,.0259040371*o+.7827717662*i-.808675766*a]}function Si([e,t,n],r){let o=(e+.3963377774*t+.2158037573*n)**3,i=(e-.1055613458*t-.0638541728*n)**3,a=(e-.0894841775*t-1.291485548*n)**3;return[an(4.0767416621*o-3.3077115913*i+.2309699292*a),an(-1.2684380046*o+2.6097574011*i-.3413193965*a),an(-.0041960863*o-.7034186147*i+1.707614701*a),r]}function Oe(e,t,n){let r=Je(e),o=Je(t);if(!r||!o)return e;let i=cr(r),a=cr(o),s=Math.max(0,Math.min(1,n));return ur(Si([i[0]*s+a[0]*(1-s),i[1]*s+a[1]*(1-s),i[2]*s+a[2]*(1-s)],r[3]*s+o[3]*(1-s)))}function ln(e,t,n){let r=t[0],o=-1;for(let i of t){let a=st(i,e,n);a>o&&(o=a,r=i)}return r}function te(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 Ai(e,t){let n=ln(t,[e.theme.ink,e.theme.onAccent,e.theme.onNeutralStrong]);return st(n,t)>=4.5?n===e.theme.ink?e.paint("ink"):n===e.theme.onAccent?e.paint("onAccent"):e.paint("onNeutralStrong"):ln(t,["#FFFFFF","#000000"])}function Tt(e,t){let n=Oe(e.theme.neutralStrong,e.theme.neutral,t);return{role:"mix",fill:e.mix("neutralStrong","neutral",t),text:Ai(e,n),raw:n}}function ye(e,t,n){let r=new Array(t),o=[];for(let a=0;a<t;a++)n.has(a)?r[a]=te(e,"accent"):o.push(a);let i=o.length;return o.forEach((a,s)=>{if(i===1)r[a]=te(e,"neutral");else if(s===0)r[a]=te(e,"ink");else if(s===i-1)r[a]=te(e,"neutral");else if(i===3)r[a]=te(e,"strong");else{let l=(s-1)/Math.max(1,i-2);r[a]=l<=.001?te(e,"strong"):Tt(e,1-l)}}),r}var cn="mix:";function Ie(e){return e({theme:tn,cssVars:!1,paint:n=>n,color:n=>n??"neutral",raw:n=>n??"neutral",mix:(n,r,o)=>`${cn}${o}`}).map(n=>n.fill)}function mr(e,t){return t?.startsWith(cn)?e.mix("neutralStrong","neutral",Number(t.slice(cn.length))):e.color(t)}function lt(e,t,n){return ye(e,t+1,n).slice(0,t)}function dr(e,t,n,r="neutral"){let o=te(e,"accent"),i=te(e,r);return Array.from({length:t},(a,s)=>n.has(s)?o:i)}function fr(e,t,n){let r=new Array(t),o=[];for(let a=0;a<t;a++)n.has(a)?r[a]=te(e,"accent"):o.push(a);let i=o.length;return o.forEach((a,s)=>{i===1?r[a]=te(e,"neutral"):s===0?r[a]=te(e,"strong"):s===i-1?r[a]=te(e,"neutral"):r[a]=Tt(e,1-s/(i-1))}),r}var xe=N(Y(),1);var Ze=(e,t="")=>n=>Number.isFinite(n)?`${e(n)}${t}`:e(n),le="en-US",hr=new Map;function un(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=hr.get(r);return o||(o=new Intl.NumberFormat(e,n),hr.set(r,o)),o}function mn(e){return/^[-\u2212]/.test(e)&&!/[1-9]/.test(e)?e.slice(1):e}function Qe(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=le,...r}=t;return mn(un(n,r).format(e))}var dn=e=>e!==0&&Math.abs(e)<.05,fn=(e,t,n="")=>`${Qe(e,{locale:t,maximumSignificantDigits:2,maximumFractionDigits:20})}${n}`;function Ct(e,t={}){if(!Number.isFinite(e))return"-";if(dn(e)&&t.maximumFractionDigits===void 0)return fn(e,t.locale??le,"%");let n=Math.abs(e);return`${Qe(e,{maximumFractionDigits:n>0&&n<1?1:0,...t})}%`}function yr(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=le,...r}=t;if(X(n)==="ko"){let o=Math.abs(e),i=[[1e12,"조"],[1e8,"억"],[1e4,"만"],[1,""]],a=i.findIndex(([s])=>o>=s);for(a<0&&(a=i.length-1);;){let[s,l]=i[a],u=o/s,d=Math.max(r.minimumFractionDigits??0,r.maximumFractionDigits??(s===1||u<100?1:0)),c=Math.round(u*10**d)/10**d;if(a>0&&c>=i[a-1][0]/s){a--;continue}return(e<0&&c!==0?"-":"")+Qe(c,{locale:n,...r,maximumFractionDigits:d})+l}}return mn(un(n,{notation:"compact",...r}).format(e))}var Ni=(e,t=X(e)==="ko"?"KRW":"USD")=>({style:"currency",currency:t,maximumFractionDigits:t==="KRW"?0:2});function Fe(e,t=le,n){if(typeof e=="function")return e;let r=(o,i="",a="")=>{let s=un(t,o);return l=>Number.isFinite(l)?`${a}${mn(s.format(l))}${i}`:"-"};if(e&&typeof e=="object"){let{suffix:o="",prefix:i="",...a}=e;return r(a,o,i)}switch(e??n){case"integer":return r({maximumFractionDigits:0});case"decimal":return r({minimumFractionDigits:1,maximumFractionDigits:2});case"percent":return o=>Ct(o,{locale:t});case"ratio":return o=>Ct(o*100,{locale:t});case"compact":return o=>yr(o,{locale:t});case"currency":return r(Ni(t));default:{let o=r({maximumFractionDigits:1});return i=>dn(i)?fn(i,t):o(i)}}}function ct(e,t=le,n=0){return e!==void 0?Fe(e,t):n>=1e5?r=>dn(r)?fn(r,t):yr(r,{locale:t}):r=>Qe(r,{locale:t})}function Ri(e,t,n=1){let r=new Date(+e,+t-1,+n);return r.getMonth()===+t-1&&r.getDate()===+n?r:null}var hn=e=>Number.isInteger(e)&&e>=1e3&&e<=9999,Fi=/^\d{4}-\d{1,2}(-\d{1,2})?([T ][\d:.]+(Z|[+-]\d{2}:?\d{2})?)?$/,_i=["january","february","march","april","may","june","july","august","september","october","november","december"],gr=e=>{let t=e.toLowerCase();return t.length<3?0:_i.findIndex(n=>n.startsWith(t))+1},pr=e=>+e+(+e<30?2e3:1900);function xr(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}var Pi=[/^(\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})일)?$/],kr=/^(\d{1,2})([./-])(\d{1,2})\2(\d{4})$/,wr=/\{([^{}]+)\}/g;function St(e,t){let n;for(let r of Pi)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?[pr(n[3]),+n[2],+n[1],1]:[pr(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=kr.exec(e)){let r=+n[1],o=+n[3],i=r>12||o<=12&&t===!0;return[+n[4],i?o:r,i?r:o,1]}if(n=/^(\d{1,2})[\s-]+([a-z]{3,9})\.?[\s-]+(\d{4})$/i.exec(e)){let r=gr(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=gr(n[1]);return r?[+n[3],r,+(n[2]??1),n[2]?1:2]:null}return null}var vr=e=>Fi.test(e)||St(e)!==null;function $r(e){let t;for(let n of e){let r=typeof n=="string"?kr.exec(n.trim()):null;if(r){if(+r[1]>12)return!0;+r[3]>12&&(t=!1)}}return t}function At(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(hn(e))return new Date(e,0,1);if(e>=19000101&&e<=21001231)return At(`${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=St(n,t);if(r)return Ri(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 br=new Map;function ut(e,t={month:"short",day:"numeric"}){let n=At(e);if(!n)return"-";let{locale:r=le,...o}=t,i=r+JSON.stringify(o),a=br.get(i);return a||(a=new Intl.DateTimeFormat(r,o),br.set(i,a)),a.format(n)}var gn=N(z(),1),Nt=(0,xe.createContext)({theme:Ee,cssVars:!0});function Di(e,t=Ee){return e?typeof e=="string"?nn[e]??t:on(t,e):t}function Ft(e){let t=(0,xe.useContext)(Nt),n=e.base?nn[e.base]:t.theme,r=(0,xe.useMemo)(()=>Di(e.theme,n),[e.theme,n]),o=e.cssVars??t.cssVars,i=e.locale??t.locale,a=(0,xe.useMemo)(()=>({theme:r,cssVars:o,locale:i}),[r,o,i]),s=(0,xe.useMemo)(()=>rn(r),[r]),l=e.paint?{background:r.bg,color:r.ink,fontFamily:r.fontFamily,...s,...e.style}:{display:"contents",...s,...e.style};return(0,gn.jsx)(Nt.Provider,{value:a,children:(0,gn.jsx)("div",{className:e.className,"data-ztd-theme":r.name,lang:e.locale,style:l,children:e.children})})}var Li=new Set(["bg","panel","ink","muted","dim","accent","accentText","onAccent","accent2","accent3","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"]);function Rt(e){return Li.has(e)}function Ei(e,t){let n=r=>t?`var(${vt(r)}, ${e[r]})`:e[r];return{theme:e,cssVars:t,paint:n,color:(r,o="neutral")=>r?Rt(r)?n(r):r:n(o),raw:(r,o="neutral")=>r?Rt(r)?e[r]:r:e[o],mix:(r,o,i)=>{let a=Math.round(Math.max(0,Math.min(1,i))*1e3)/10;return t?`color-mix(in oklab, ${n(r)} ${a}%, ${n(o)})`:Oe(e[r],e[o],i)}}}function ke(e){let t=(0,xe.useContext)(Nt);return(0,xe.useMemo)(()=>{let n=on(t.theme,e);return Ei(n,t.cssVars)},[t.theme,t.cssVars,e])}function ie(e){let t=(0,xe.useContext)(Nt);return e??t.locale??le}function Tr(e){return e?rn(e):{}}var _t=N(Y(),1),pn=(0,_t.createContext)(void 0);function Cr(e){let t=(0,_t.useContext)(pn);return e!==void 0&&t!==void 0?`${e}:${t}`:e??t}var R=N(z(),1),Oi={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`},Ii={en:Oi,ko:{legend:"범례",replay:"애니메이션 다시 재생",replayTitle:"다시 재생",sample:"예시 데이터",loadError:"데이터를 불러오지 못했어요",retry:"다시 시도",loading:"불러오는 중",empty:"표시할 데이터가 없어요",source:"출처",shown:(e,t)=>`${t}개 중 ${e}개 보임`}};var zi={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},bn=e=>Ii[X(ie(e))];function yn(e){let t=ke(e.theme),n=bn(e.locale),[r,o]=(0,Pt.useState)(!1),i=e.size??11.5,a=e.onToggle,s=new Set(a?e.hidden:void 0),l=e.items.filter(d=>!s.has(d.label)).length,u=(0,R.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((d,c)=>{let m=!s.has(d.label),h=m&&l===1,f=(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Bi,{p:t,item:d,off:!m}),(0,R.jsx)("span",{style:m?void 0:{textDecoration:"line-through"},children:d.label})]});return(0,R.jsx)("li",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:i,color:t.paint("muted"),lineHeight:1.3},children:a?(0,R.jsx)("button",{type:"button",className:"ztd-btn","aria-pressed":m,"aria-disabled":h||void 0,onClick:()=>{h||(a(d.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:h?"default":void 0},children:f}):f},c)})});return a?(0,R.jsxs)(R.Fragment,{children:[u,(0,R.jsx)("span",{"aria-live":"polite","aria-atomic":"true",style:zi,children:r?n.shown(l,e.items.length):""})]}):u}function Bi({p:e,item:t,off:n}){let r=mr(e,t.color),o=t.shape??"square";return o==="line"||o==="dash"?(0,R.jsxs)("svg",{width:14,height:8,"aria-hidden":"true",style:{flex:"none",opacity:n?.35:void 0},children:[(0,R.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,R.jsx)("circle",{cx:7,cy:4,r:2.2,fill:r}):null]}):(0,R.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 Hi(e){let t=ke(e.theme),n=ar(e.level,X(ie(e.locale)));return(0,R.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 ji(e,t,n){if(typeof e!="string"||!t)return e;let r=e.indexOf(t);return r<0?e:(0,R.jsxs)(R.Fragment,{children:[e.slice(0,r),(0,R.jsx)("span",{style:{color:n},children:t}),e.slice(r+t.length)]})}function Sr(e){let t=ke(e.theme),n=bn(e.locale),[r,o]=(0,Pt.useState)(0);Ce(()=>at(),[]);let i=()=>{o(m=>m+1),e.onReplay?.()},a=Array.isArray(e.legend)?(0,R.jsx)(yn,{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,u=e.replay||e.onReplay,d=e.source!==void 0||e.note!==void 0?(0,R.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,c=e.takeaway!==void 0||e.level||e.sample?(0,R.jsxs)("footer",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,marginTop:2},children:[(0,R.jsx)("span",{style:{fontSize:17,fontWeight:800,color:t.paint("ink"),letterSpacing:-.3,lineHeight:1.3,minWidth:0},children:e.takeaway}),(0,R.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:8,flex:"none"},children:[e.sample?(0,R.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,R.jsx)(Hi,{level:e.level,theme:e.theme,locale:e.locale}):null]})]}):null;return(0,R.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,R.jsxs)("header",{style:{display:"flex",flexDirection:"column",gap:6,minWidth:0},children:[(0,R.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0},children:[l?(0,R.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,R.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:ji(e.title,e.accent,t.paint("accentText"))}),e.actions,u?(0,R.jsx)("button",{type:"button",className:"ztd-btn",onClick:i,"aria-label":e.replayLabel??n.replay,title:e.replayLabel??n.replayTitle,style:{background:"transparent",color:t.paint("muted"),border:`1px solid ${t.paint("line2")}`,borderRadius:14,width:28,height:28,display:"inline-grid",placeItems:"center",padding:0,flex:"none"},children:(0,R.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,R.jsx)("path",{d:"M3 12a9 9 0 1 0 3-6.7"}),(0,R.jsx)("path",{d:"M3 3v6h6"})]})}):null]}),e.subtitle!==void 0||a?(0,R.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"4px 12px",flexWrap:"wrap",minHeight:18},children:[e.subtitle!==void 0?(0,R.jsx)("span",{style:{fontSize:12.5,color:t.paint("muted"),lineHeight:1.4},children:e.subtitle}):(0,R.jsx)("span",{}),a]}):null]}),(0,R.jsx)("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",minHeight:0,minWidth:0},children:(0,R.jsx)(pn.Provider,{value:r,children:(0,R.jsx)(Ye.Provider,{value:typeof e.title=="string"||typeof e.title=="number"?String(e.title):void 0,children:e.children})})}),d?(0,R.jsxs)(R.Fragment,{children:[d,c]}):c]})}function xn(e){let t=ke(e.theme),n=bn(e.locale),r=e.height??220;if(Ce(()=>at(),[]),e.error){let o=typeof e.error=="string"?e.error:e.error.message;return(0,R.jsx)("div",{role:"alert",style:{height:r,display:"grid",placeItems:"center",textAlign:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,R.jsxs)("div",{style:{display:"grid",gap:8,justifyItems:"center",padding:16},children:[(0,R.jsx)("span",{style:{fontSize:14,fontWeight:700,color:t.paint("ink")},children:n.loadError}),(0,R.jsx)("span",{style:{fontSize:12,color:t.paint("muted"),maxWidth:280,wordBreak:"break-word"},children:o}),e.onRetry?(0,R.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,R.jsx)("div",{role:"status","aria-busy":"true","aria-label":n.loading,style:{height:r,display:"flex",alignItems:"flex-end",gap:8,padding:"12px 4px"},children:[.55,.8,.4,.95,.65,.75,.5].map((o,i)=>(0,R.jsx)("span",{className:"ztd-skeleton",style:{flex:1,height:`${o*100}%`,background:t.paint("lift"),borderRadius:6,animationDelay:`${i*90}ms`}},i))}):e.empty?(0,R.jsx)("div",{style:{height:r,display:"grid",placeItems:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,R.jsx)("span",{style:{fontSize:13,color:t.paint("muted")},children:e.emptyText??n.empty})}):(0,R.jsx)(R.Fragment,{children:e.children})}var nt=N(Y(),1);var de=N(Y(),1);var G=N(z(),1),Dt=60;var Lt={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,de.useId)().replace(/:/g,""),o=`${r}t`,i=`${r}d`;t.events.current=n,Ce(()=>{at()},[]);let a=n.length,s=!e.noNav&&a>0,l=(0,de.useContext)(Ye),u=e.ariaLabel??l??e.kind,d=(0,de.useMemo)(()=>s?`${n.length}${n.slice(0,Dt).map(x=>`${x.label}${x.series??""}${x.formatted??x.value??""}`).join("")}`:"",[n,s]),c=(0,de.useMemo)(()=>(0,G.jsx)(Gi,{label:u,events:n,t:t.t}),[u,d,t.t]),m=(0,de.useRef)(null);(0,de.useEffect)(()=>{let x=()=>{m.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,de.useEffect)(()=>{m.current=null},[t.width,t.height]);let h=x=>{if(x.target!==x.currentTarget)return;if(e.onKey?.(x)){x.preventDefault();return}let C=t.active,D;switch(x.key){case"ArrowRight":case"ArrowDown":D=C===null?0:(C+1)%a;break;case"ArrowLeft":case"ArrowUp":D=C===null?a-1:(C-1+a)%a;break;case"Home":D=0;break;case"End":D=a-1;break;case"Escape":if(C===null)return;D=null;break;case"Enter":case" ":C!==null&&(x.preventDefault(),t.click(C));return;default:return}x.preventDefault(),t.setActive(D,"keyboard")},{via:f,node:g,setActive:w}=t;(0,de.useEffect)(()=>{if(f!=="touch"||!g)return;let x=C=>{g.contains(C.target)||w(null)};return document.addEventListener("pointerdown",x),()=>document.removeEventListener("pointerdown",x)},[f,g,w]);let k=t.active!==null?n[t.active]:null,$=t.showTooltip&&e.renderTip!==!1&&!t.pending&&t.via!=="sync"?e.tip:null,y=$&&!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}/${a})`:""),F;if($){let x=$.x*y,C=t.width*y,D=`clamp(${(4-x).toFixed(1)}px, -50%, calc(${(C-x-4).toFixed(1)}px - 100%))`,L=$.y<64;F={position:"absolute",left:x,top:$.y*y,transform:`translate(${D}, ${L?"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*y-8)}}let O=x=>{m.current=null,x.pointerType!=="touch"&&t.via!=="keyboard"&&t.setActive(null)},I=x=>x?C=>{let D=m.current??(m.current=C.currentTarget.getBoundingClientRect());D.width&&x((C.clientX-D.left)/D.width*t.width,(C.clientY-D.top)/D.height*t.height,C)}:void 0,B=I(e.onPointerMove),P=I(e.onPointerDown),_=B||P?x=>{x.pointerType==="touch"&&B?.(x),P?.(x)}:void 0,T=I(e.onPointerUp),v=Tr(e.theme);return(0,G.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":u,"aria-describedby":i,tabIndex:s?0:void 0,onKeyDown:s?h:void 0,onBlur:x=>{t.via==="keyboard"&&!x.currentTarget.contains(x.relatedTarget)&&t.setActive(null)},onPointerLeave:O,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,G.jsxs)("svg",{className:"ztd-svg",role:"img","aria-labelledby":`${o} ${i}`,viewBox:`0 0 ${Math.max(1,Math.round(t.width*10)/10)} ${Math.max(1,Math.round(t.height*10)/10)}`,width:"100%",preserveAspectRatio:"xMidYMid meet",onPointerMove:B,onPointerDown:_,onPointerUp:T,onPointerCancel:T,style:{fontFamily:"inherit",touchAction:"pan-y",position:e.underlay?"relative":void 0},children:[(0,G.jsx)("title",{id:o,children:u}),(0,G.jsx)("desc",{id:i,children:a||t.description!==void 0?e.description:e.emptyText??t.t.empty}),e.defs&&!t.pending?(0,G.jsx)("defs",{children:e.defs}):null,t.pending?null:e.children]}),t.pending?null:e.overlay,$?(0,G.jsx)("div",{className:"ztd-tip","aria-hidden":"true",style:F,children:S??(0,G.jsxs)(G.Fragment,{children:[(0,G.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,C)=>(0,G.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:16,justifyContent:"space-between"},children:[(0,G.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:7,color:t.p.paint(x.strong?"ink":"muted")},children:[x.color?(0,G.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,G.jsx)("span",{style:{fontWeight:x.strong===!1?500:700},children:x.value})]},C))]})}):null,(0,G.jsx)("span",{className:"ztd-sr",style:Lt,"aria-live":"polite","aria-atomic":"true",children:b}),s&&!t.pending?c:null]})}function Gi({label:e,events:t,t:n}){return(0,G.jsx)("div",{className:"ztd-sr",style:Lt,children:(0,G.jsxs)("table",{children:[(0,G.jsx)("caption",{children:n.table(e)}),(0,G.jsxs)("tbody",{children:[t.slice(0,Dt).map((r,o)=>(0,G.jsxs)("tr",{children:[(0,G.jsx)("th",{scope:"row",children:r.series?`${r.label} · ${r.series}`:r.label}),(0,G.jsx)("td",{children:r.formatted??r.value??""})]},o)),t.length>Dt?(0,G.jsx)("tr",{children:(0,G.jsx)("td",{colSpan:2,children:n.more(t.length-Dt)})}):null]})]})})}function _e(e){let t=e.baseline??"central";return(0,G.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 p=(e,t,n,r,o={})=>({name:e,type:t,required:n,description:r,...o}),ge=p("label","string",!0,"Item name field"),re=p("value","number",!0,"Value field"),Wi=[ge,re],Vi=[ge,re],Ki=[p("label","string",!0,"Stage name"),p("value","number",!0,"Users at the stage")],Xi=[ge,re],Ui=[p("label","string",!0,"Leaf (lowest level) name"),re,p("group","string",!1,"Parent group field")],Yi=[p("label","string",!0,"Leaf name"),re,p("group","string",!1,"Parent group field")],Ji=[ge,p("value","number",!0,"Change (total rows may omit it)"),p("type","string",!1,'"total" makes a total bar')],qi=[ge,re],Zi=[p("x","string",!0,"Column field"),p("series","string",!0,"Stacked series field"),re],Qi=[p("x","string",!0,"Column field"),p("y","string",!0,"Row field"),re],ea=[p("axis","string",!0,"Metric (axis) field"),p("value","number",!0,"Value field",{multi:!0}),p("series","string",!1,"Series field")],ta=[p("x","number",!0,"x value"),p("y","number",!0,"y value"),p("size","number",!1,"Circle size"),p("label","string",!1,"Name")],Nr=p("upper","number",!1,"Upper bound of the range band. Same shape as lower",{multi:!0}),na=[p("x","any",!0,"x field (date, number or category)"),p("y","number",!0,"y field. An array for wide tables",{multi:!0}),p("series","string",!1,"Series field (long tables)"),p("lower","number",!1,"Lower bound of the range band. In wide tables an array in the order of y",{multi:!0}),Nr],ra=[p("x","any",!0,"x field"),p("y","number",!0,"y field. An array for wide tables",{multi:!0}),p("series","string",!1,"Series field"),p("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}),Nr],oa=[p("x","any",!0,"x field"),p("y","number",!0,"y field",{multi:!0}),p("series","string",!1,"Series field")],ia=[p("x","string",!0,"Category field"),p("y","number",!0,"Value field. An array for wide tables",{multi:!0}),p("series","string",!1,"Series field"),p("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})],aa=[ge,re],sa=[p("value","number",!0,"Value field",{prop:"valueKey"}),p("target","number",!1,"Target field",{prop:"targetKey"})],la=[ge,p("value","number",!0,"Actual value field"),p("target","number",!1,"Target field")],ca=[p("x","any",!1,"x field"),p("y","number",!0,"y field")],ua=[ge,p("x","string",!1,"Period field (long tables)"),p("value","number",!1,"Value field (long tables)")],ma=[ge,p("start","number",!0,"Before value"),p("end","number",!0,"After value")],da=[ge,re],fa=[p("value","number",!0,"Value field"),p("group","string",!1,"Group (row) field"),p("label","string",!1,"Dot name")],ha=[p("group","string",!0,"Group field"),p("value","number",!0,"Value field")],ga=[p("source","string",!1,"Source node"),p("target","string",!1,"Target node"),p("dimensions","string",!1,"Stage columns of a wide table, left to right (2 to 6). Each row is one path, so source and target are not used. Without value, each row counts 1",{multi:!0}),p("value","number",!1,"Value field")],pa=[p("source","string",!0,"Sending group"),p("target","string",!0,"Receiving group"),re],ba=[p("date","date",!0,"Date field"),re],ya=[p("x","any",!0,"Period field"),p("series","string",!0,"Item field"),p("rank","number",!1,"Rank field (1 is first)"),p("value","number",!1,"Value field (instead of rank, largest is first)")],xa=[p("group","string",!0,"Group field"),p("value","number",!0,"Value field")],ka=[p("label","string",!1,"Row name field")],wa=[p("x","date",!0,"Date (period) field"),p("open","number",!0,"Open price field"),p("high","number",!0,"High price field"),p("low","number",!0,"Low price field"),p("close","number",!0,"Close price field"),p("volume","number",!1,"Volume field")],va=[ge,re],$a=[p("x","any",!0,"Period field (date or category)"),p("y","number",!0,"Back row fields stacked into each block. An array for wide tables",{multi:!0}),p("series","string",!1,"Series field (long tables, back row only)"),p("front","number",!1,"Front row fields: a smaller outcome in the same unit as y (wide tables only)",{multi:!0})],Ma=[p("value","number",!1,"Sample value field (raw rows)"),p("group","string",!1,"Group field. Up to 2 groups overlap"),p("x0","number",!1,"Bin start (pre-binned rows)"),p("x1","number",!1,"Bin end (pre-binned rows)"),p("count","number",!1,"Samples in the bin (pre-binned rows)")],Ta=[p("region","string",!0,"Region name or code, matched to a tile of options.map"),re],Ca=[ge,re,p("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")],Sa=[p("source","string",!0,"Source node"),p("target","string",!0,"Target node"),p("value","number",!1,"Link weight. Without it every row counts 1")],Aa=[p("label","string",!0,"Row name. Items with the same name share a row"),p("start","any",!0,"Start: a number (minutes, seconds, any unit) or a date or date-time"),p("end","any",!0,"End, same kind as start. Equal to start draws a point event; empty means still open"),p("group","string",!1,"Group field (one color per group, and the legend)"),p("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")],Na=[p("label","string",!0,"Node name field"),p("value","number",!1,"Value field. Sizes the dots; values add up from the leaves"),p("group","string",!1,"Parent group field (flat rows, as in the treemap)"),p("id","string",!1,"Row id for id/parent rows. Defaults to the label"),p("parent","string",!1,"Parent id field. Each row is one node, and rows with an empty parent hang under the root")],Ra=[p("region","string",!0,"Region name or code, matched to a region of options.map"),re],Fa=[p("lon","number",!1,"Longitude (degrees)"),p("lat","number",!1,"Latitude (degrees)"),p("size","number",!1,"Value (circle area). Without it all circles match"),p("label","string",!1,"Place name"),p("region","string",!1,"Region of options.map, for rows without lon and lat"),p("group","string",!1,"Group field (one color per group)")],_a=[p("source","string",!0,"Start: a name in options.places or a region"),p("target","string",!0,"End"),p("value","number",!1,"Amount. Without it each row counts 1")],Pa=[p("cohort","any",!0,"Cohort: a name or a start date. Cohorts go in date order when all read as dates, otherwise in order of first appearance"),p("period","any",!0,"Periods since the cohort started: 0, 1, 2 ... In number order when all are numbers"),p("value","number",!0,"People still active, or the share still active (see options.valueType)"),p("size","number",!1,"Cohort size. The first value of each cohort counts")],Da=[p("x","any",!0,"x field (date, number or category)"),p("y","number",!0,"y field. An array for wide tables",{multi:!0}),p("series","string",!1,"Series field (long tables)")],La=[p("x","number",!0,"x value"),p("y","number",!0,"y value"),p("series","string",!1,"Series field (one color per series)"),p("label","string",!1,"Name")],Ea=[p("label","string",!0,"Row name field (one row per metric)"),p("x","any",!0,"Period field (date, number or category). Every row shares the same period axis"),re,p("target","number",!1,"Target field. Each row uses its last filled value")],Ar={pie:Wi,donut:Vi,funnel:Ki,waffle:Xi,treemap:Ui,sunburst:Yi,waterfall:Ji,pareto:qi,marimekko:Zi,heatmap:Qi,radar:ea,bubble:ta,line:na,area:ra,stream:oa,bar:ia,radialBar:aa,gauge:sa,bullet:la,sparkline:ca,slope:ua,dumbbell:ma,lollipop:da,beeswarm:fa,ridgeline:ha,sankey:ga,chord:pa,calendar:ba,bump:ya,box:xa,parallel:ka,candlestick:wa,segmented:va,skyline:$a,histogram:Ma,scatter:La,tileMap:Ta,barRace:Ca,network:Sa,timeline:Aa,tree:Na,choropleth:Ra,symbolMap:Fa,flowMap:_a,sparkTable:Ea,cohort:Pa,horizon:Da},et={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:"흐름 지도"},sparkTable:{component:"SparkTable",name:"KPI table",nameKo:"지표 표"},cohort:{component:"CohortChart",name:"Cohort chart",nameKo:"코호트 차트"},horizon:{component:"HorizonChart",name:"Horizon chart",nameKo:"호라이즌 차트"}};function Rr(e,t){return t==="ko"?e.nameKo:e.name}function Fr(e,t){let n=t??e.options?.locale;return typeof n=="string"&&n?n.replace(/_/g,"-"):void 0}var _r=["line","area","bar","scatter"],Pr=24,mt=60,wn=["line","area","bar","scatter","timeline"];function vn(e,t,n){return e==="bar"&&n.orientation!=="horizontal"&&n.layout!=="percent"&&n.layout!=="diverging"?[].concat(t.line??[]).map(String):[]}function Dr(e,t,n){return wn.includes(e)&&!vn(e,t,n).length&&!(e==="scatter"&&Et(n))}function Et(e){return!!e&&typeof e=="object"&&e.bin==="hex"}function Lr(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",butterfly:"bar",pyramid:"bar",populationPyramid:"bar",stacked:"area",streamgraph:"stream",radial:"radialBar",radialbar:"radialBar",progress:"gauge",progressRing:"gauge",kpi:"gauge",violin:"box",boxplot:"box",raincloud:"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",alluvial:"sankey",parallelSets:"sankey",kpiTable:"sparkTable",metricTable:"sparkTable",sparklineTable:"sparkTable",retention:"cohort",cohortTable:"cohort",retentionTable:"cohort",horizonChart:"horizon",horizonGraph:"horizon"};function Ot(e){let t=Ar[e]?e:Oa[e]??Object.keys(et).find(n=>n.toLowerCase()===e.toLowerCase()||et[n].component.toLowerCase()===e.toLowerCase());if(!(!t||!et[t]))return{type:t,component:et[t].component,name:et[t].name,nameKo:et[t].nameKo,encoding:Ar[t]}}function Er(e){let t=new Set,n=i=>{Array.isArray(i)?i.forEach(n):typeof i=="string"&&i&&t.add(i)},r=e.encoding??{};for(let i of Ot(e.type)?.encoding.map(a=>a.name)??Object.keys(r))n(r[i]);let o=e.options??{};for(let i of["dimensions","start","end","ranges"])n(o[i]);return[...t]}function Or(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(Or(n,t))return n[t];if(t.includes(".")){let r=n;for(let o of t.split(".")){if(r===null||typeof r!="object"||!Or(r,o))return;r=r[o]}return r}}function Ae(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 je(e,t){if(typeof e=="function")return e;let n=e??t;return r=>Ia(r,n)}function It(e,t){let n=je(e,t);return(r,o)=>Ae(n(r,o))}function Pe(e,t){let n=je(e,t);return(r,o)=>{let i=n(r,o);return i==null?"":i instanceof Date?new Date(i.getTime()-i.getTimezoneOffset()*6e4).toISOString().slice(0,10):String(i)}}function we(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 u=e[l];if(u==='"')n=!n;else if(!n&&(u===`
|
|
23
|
+
`||u==="\r"))break;t.push(n?"":u)}let r=t.join(""),o=l=>r.split(l).length-1,i=[","," ",";","|"],a=",",s=0;for(let l of i){let u=o(l);u>s&&(s=u,a=l)}return a}var Ba=/^[-+(]?[₩$€£¥]?\s?\d[\d,]*(\.\d+)?([eE][-+]?\d+)?\)?\s?(%|원|명|건|개|회)?$/;function Ir(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=Ae(t);if(Number.isFinite(n))return n}return t}function Ge(e,t={}){let{typed:n=!0,header:r=!0}=t,o=e.replace(/^\uFEFF/,"");if(!o.trim())return[];let i=t.delimiter??za(o),a=[],s=[],l="",u=!1;for(let f=0;f<o.length;f++){let g=o[f];u?g==='"'?o[f+1]==='"'?(l+='"',f++):u=!1:l+=g:g==='"'&&!l.trim()?(u=!0,l=""):g===i?(s.push(l),l=""):g===`
|
|
24
|
+
`||g==="\r"?(g==="\r"&&o[f+1]===`
|
|
25
|
+
`&&f++,s.push(l),a.push(s),s=[],l=""):l+=g}(l!==""||s.length)&&(s.push(l),a.push(s));let d=a.filter(f=>!(f.length===1&&f[0].trim()===""));if(!d.length)return[];let c=f=>n?Ir(f):f;if(!r)return d.map(f=>Object.fromEntries(f.map((g,w)=>[String(w),c(g)])));let m=[],h=new Set;return d[0].forEach((f,g)=>{let w=f.trim()||`col${g+1}`,k=w;for(let $=2;h.has(k);$++)k=`${w}_${$}`;h.add(k),m.push(k)}),d.slice(1).map(f=>Object.fromEntries(m.map((g,w)=>[g,c(f[w]??"")])))}function $n(e,t,n={}){if(!e.length)return[];let{typed:r=!0}=n,o=(t??e[0]).map((a,s)=>String(a??"").trim()||`col${s+1}`);return(t?e:e.slice(1)).map(a=>Object.fromEntries(o.map((s,l)=>[s,r&&typeof a[l]=="string"?Ir(a[l]):a[l]??null])))}function Ha(e,t={}){let{labelKey:n="label",valueKey:r="value"}=t,o=Object.values(e);if(o.length&&o.every(i=>Array.isArray(i))){let i=Object.keys(e),a=Math.max(...o.map(s=>s.length));return Array.from({length:a},(s,l)=>Object.fromEntries(i.map(u=>[u,e[u][l]??null])))}return Object.entries(e).map(([i,a])=>({[n]:i,[r]:a}))}function zr(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 ze(e){if(e==null)return[];if(typeof e=="string"){let t=e.trim();if(!t)return[];if(t.startsWith("[")||t.startsWith("{"))try{return ze(JSON.parse(t))}catch{}return Ge(t)}if(Array.isArray(e))return e.length?Array.isArray(e[0])?$n(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)?ze(t.data):Array.isArray(t.rows)&&Array.isArray(t.columns)?$n(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)?ze(t.rows):Array.isArray(t.values)?$n(t.values):Array.isArray(t.items)?ze(t.items):Array.isArray(t.results)?ze(t.results):Ha(t)}return[]}function zt(e){if(!Array.isArray(e))try{return JSON.stringify(e??null)??""}catch{return String(e)}let t=e.length,n=i=>{try{return JSON.stringify(i)}catch{return String(i)}};if(t<=300)return n(e);let r=Math.ceil(t/60),o=[];for(let i=0;i<t;i+=r)o.push(e[i]);return o.push(e[t-1]),`${t}:${n(o)}`}function Br(e,t){let n=e.length;if(t>=n||t<3)return e.slice();let r=[e[0]],o=(n-2)/(t-2),i=0;for(let a=0;a<t-2;a++){let s=Math.floor((a+1)*o)+1,l=Math.min(Math.floor((a+2)*o)+1,n),u=0,d=0;for(let w=s;w<l;w++)u+=e[w].x,d+=e[w].y;let c=Math.max(1,l-s);u/=c,d/=c;let m=Math.floor(a*o)+1,h=Math.floor((a+1)*o)+1,f=m,g=-1;for(let w=m;w<h;w++){let k=Math.abs((e[i].x-u)*(e[w].y-e[i].y)-(e[i].x-e[w].x)*(d-e[i].y));k>g&&(g=k,f=w)}r.push(e[f]),i=f}return r.push(e[n-1]),r}function Mn(e,t="zero"){let n=e.length,r=n?e[0].length:0,o=e.map(()=>new Array(r).fill(0)),i=e.map(()=>new Array(r).fill(0)),a=(l,u)=>{let d=e[l][u];return Number.isFinite(d)&&d>0?d:0},s=new Array(r).fill(0);if(t==="wiggle"&&n>0&&r>1){let l=0;for(let u=1;u<r;u++){let d=0,c=0;for(let m=0;m<n;m++){let h=a(m,u),f=h-a(m,u-1),g=0;for(let w=0;w<m;w++)g+=a(w,u)-a(w,u-1);d+=h,c+=(f/2+g)*h}d&&(l-=c/d),s[u]=l}}for(let l=0;l<r;l++){if(t==="zero"){let c=0,m=0;for(let h=0;h<n;h++){let f=e[h][l],g=Number.isFinite(f)?f:0;g>=0?(o[h][l]=c,c+=g,i[h][l]=c):(o[h][l]=m,m+=g,i[h][l]=m)}continue}let u=0;for(let c=0;c<n;c++)u+=a(c,l);let d=t==="silhouette"?-u/2:s[l];for(let c=0;c<n;c++){let m=a(c,l);t==="expand"&&(m=u?m/u*100:0),o[c][l]=d,d+=m,i[c][l]=d}}if(t==="wiggle"&&r){let l=1/0,u=-1/0;for(let c=0;c<r;c++)l=Math.min(l,o[0]?.[c]??0),u=Math.max(u,i[n-1]?.[c]??0);let d=0;for(let c=0;c<r;c++)d+=((o[0]?.[c]??0)+(i[n-1]?.[c]??0))/2;d/=r;for(let c=0;c<n;c++)for(let m=0;m<r;m++)o[c][m]-=d,i[c][m]-=d}return{y0:o,y1:i}}function Hr(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 jr(e){let t=e.length,n=e.map(u=>{let d=0,c=-1/0;return u.forEach((m,h)=>{m>c&&(c=m,d=h)}),d}),r=e.map(u=>u.reduce((d,c)=>d+(Number.isFinite(c)?c:0),0)),o=Array.from({length:t},(u,d)=>d).sort((u,d)=>n[u]-n[d]),i=[],a=[],s=0,l=0;for(let u of o)s<l?(i.push(u),s+=r[u]):(a.push(u),l+=r[u]);return[...a.reverse(),...i]}var ja=Math.PI*2;function We(e,t,n){return e<t?t:e>n?n:e}function Gr(e){let t=0;for(let n of e)Number.isFinite(n)&&(t+=n);return t}function Wr(e,t){let n=0,r=e.length-1;if(r<0)return-1;for(;r-n>1;){let o=n+r>>1;e[o]<t?n=o:r=o}return Math.abs(e[n]-t)<=Math.abs(e[r]-t)?n:r}function Vr(e){let t=-1,n=-1/0;return e.forEach((r,o)=>{r>n&&(n=r,t=o)}),t}function Xr(e){return e>=44032&&e<=55203||e>=4352&&e<=4607||e>=12592&&e<=12687||e>=19968&&e<=40959}function Kr(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 Bt=new Map;function ae(e,t,n=400){let r=String(e),o=`${r}|${n>=600?1:0}`,i=Bt.get(o);if(i===void 0){let a=0,s=0;for(let l=0;l<r.length;l++){let u=r.charCodeAt(l);Xr(u)?a+=Kr(u):s+=Kr(u)}i=a+s*(n>=600?1.07:1),Bt.size>5e3&&Bt.clear(),Bt.set(o,i)}return i*t}function Ht(e,t,n,r=400){if(e=e.trim(),ae(e,n,r)<=t)return e;let o="…",i=0,a=e.length;for(;i<a;){let l=i+a+1>>1;ae(e.slice(0,l)+o,n,r)<=t?i=l:a=l-1}i>0&&(e.charCodeAt(i-1)&64512)===55296&&i--;let s=e.slice(0,i).trimEnd();return s.length<(Xr(s.charCodeAt(0))?2:3)?"":s+o}var Yr=N(z(),1),Ga=e=>Array.isArray(e)&&e.length===2;function Ur(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 dt=N(z(),1),se=10.5;function Wa(e,t,n){let r=e.map(t);if(new Set(r).size===r.length)return r;let o=1/0;for(let a=1;a<e.length;a++)o=Math.min(o,Math.abs(e[a]-e[a-1]));let i=o>0&&Number.isFinite(o)?Math.min(20,Math.max(2,Math.ceil(-Math.log10(o)-1e-9))):2;return e.map(a=>Qe(a,{locale:n,maximumFractionDigits:i}))}function Tn(e,t,n){let r=18;for(let o of Wa(e,t,n))r=Math.max(r,ae(o,se));return Math.ceil(r+8)}function Cn(e,t,n){let r=[],o=-1/0;for(let i of e){let a=ae(i.label,se),s=Math.max(i.x-a/2,0);s<o+8||i.x-a/2<t||i.x+a/2>n||(r.push(i),o=s+a)}return r}function Sn(e,t,n=se,r=8,o=400,i){let a=t.length;if(a<=1)return t.map((c,m)=>m);let s=t.map(c=>ae(c,n,o)),l=(c,m)=>Math.abs(e[m]-e[c])<(s[c]+s[m])/2+r,u=[];for(let c of i??[])u.some(m=>l(m,c))||u.push(c);let d=c=>!u.some(m=>l(m,c));for(let c=1;c<=a;c++){let m=u.slice();for(let h=0;h<a;h+=c)d(h)&&m.push(h);if(c>1&&(a-1)%c>c/2&&d(a-1)&&m.push(a-1),m.sort((h,f)=>h-f),m.every((h,f)=>!f||!l(m[f-1],h)))return m}return[0,a-1]}var Jr=e=>Math.round(e*10)/10;function An(e){let{p:t}=e,n=Ht(e.label,160,se,700),r=ae(n,se,700)+14,o=Math.max(r/2+1,Math.min(e.width-r/2-1,e.x));return(0,dt.jsxs)("g",{className:"ztd-guide","aria-hidden":"true",pointerEvents:"none",style:{transform:`translate(${Jr(o)}px,${Jr(e.y)}px)`},children:[(0,dt.jsx)("rect",{x:-r/2,y:-9,width:r,height:18,rx:9,fill:t.paint("ink"),stroke:t.paint("panel"),strokeWidth:3,paintOrder:"stroke"}),(0,dt.jsx)(_e,{x:0,y:0,anchor:"middle",size:se,weight:700,fill:t.paint("onInk"),children:n})]})}function Nn(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 Ve(e,t,n=4,r={}){let o=e,i=t;if(!Number.isFinite(o)||!Number.isFinite(i))return[0,1];if(r.zero!==!1&&(o>0&&(o=0),i<0&&(i=0)),o===i)return o===0?[0,1]:o>0?[0,o*1.2]:[o*1.2,0];let a=i-o,s=r.pad??.07,l=Nn(a,n),u=[o,i];for(let d=0;d<4;d++){let c=Math.ceil(i/l-1e-9)*l,m=Math.floor(o/l+1e-9)*l;u=[o===0?0:o-m<=l*.3?m:o-a*s,i===0?0:c-i<=l*.3?c:i+a*s];let h=Nn(u[1]-u[0],n);if(h===l)break;l=h}return u}function qr(e,t,n=4){let r=Math.min(e,t),o=Math.max(e,t),i=Nn(o-r,n),a=[],s=Math.ceil(r/i-1e-9)*i;for(let l=s,u=0;l<=o+i*1e-9&&u<200;l+=i,u++)a.push(Number((Math.round(l/i)*i).toPrecision(12)));return a}function ve(e,t){let[n,r]=e,[o,i]=t,a=r===n?0:(i-o)/(r-n),s=(l=>o+(l-n)*a);return s.domain=e,s.range=t,s.invert=l=>a===0?n:n+(l-o)/a,s.ticks=(l=4)=>qr(n,r,l),s}function jt(e,t,n=4){if(!(e>0)||!(t>0)||!Number.isFinite(e)||!Number.isFinite(t))return[1,10];let r=Math.log10(e),o=Math.log10(t);if(r===o)return[10**(r-.5),10**(r+.5)];let[i,a]=Ve(r,o,Math.max(n,Math.ceil(o-r)),{zero:!1});return[10**i,10**a]}function Va(e,t,n){let r=Math.log10(e),o=Math.log10(t),i=n/Math.max(1e-9,o-r),a=(u,d=1)=>{let c=[];for(let m=Math.floor(r);m<=Math.ceil(o);m++)if(!(m%d))for(let h of u){let f=Number((h*10**m).toPrecision(12));f>=e*(1-1e-9)&&f<=t*(1+1e-9)&&c.push(f)}return c},s=i>=110?a([1,2,5]):a([1],Math.max(1,Math.ceil(24/i)));if(s.length>=2)return s;let l=a([1,2,3,4,5,6,7,8,9]);return l.length>=2?l:qr(e,t,3)}function Rn(e,t){let n=ve([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=()=>Va(e[0],e[1],Math.abs(t[1]-t[0])),r}function Be(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]}function Zr(e){let t=[];for(let n=0;n<e.length;n++)Number.isFinite(e[n])&&t.push(e[n]);return t.length?(t.sort((n,r)=>n-r),t.length<24?t[t.length-1]:t[Math.min(t.length-1,Math.floor(t.length*.95))]||t[t.length-1]):1}var Ka=864e5;function ft(e,t,n,r=le){let o=t-e;if(!(o>0))return[{t:e,label:ut(e,{locale:r,month:"short",day:"numeric"})}];let i=o/Ka,a=[],s=new Date(e),l=new Date(e).getFullYear()===new Date(t).getFullYear(),u=(d,c,m,h=!1)=>{let f=new Date(d),g=-1,w=0;for(;f.getTime()<=t&&w++<500;){if(f.getTime()>=e){let k=f.getFullYear(),$=h&&!l&&k!==g;a.push({t:f.getTime(),label:ut(f,{locale:r,...m,...$?{year:"numeric"}:{}})}),g=k}c(f)}};if(i<=1.5){let d=Math.max(1,Math.ceil(o/36e5/Math.max(1,n))),c=[1,2,3,4,6,12].find(h=>h>=d)??12,m=new Date(s);m.setMinutes(0,0,0),u(m,h=>h.setHours(h.getHours()+c),{hour:"numeric"})}else if(i<=n*1.2){let d=new Date(s.getFullYear(),s.getMonth(),s.getDate());u(d,c=>c.setDate(c.getDate()+1),{month:"numeric",day:"numeric"})}else if(i<=n*7*1.2){let d=new Date(s.getFullYear(),s.getMonth(),s.getDate());d.setDate(d.getDate()+(8-d.getDay())%7),u(d,c=>c.setDate(c.getDate()+7),{month:"numeric",day:"numeric"})}else{let d=i/30.44,c=Math.max(1,Math.ceil(d/Math.max(1,n))),m=[1,2,3,6,12,24,60].find(h=>h>=c)??120;if(m>=12){let h=new Date(s.getFullYear()+(s.getMonth()>0||s.getDate()>1?1:0),0,1);u(h,f=>f.setFullYear(f.getFullYear()+m/12),{year:"numeric"})}else{let h=new Date(s.getFullYear(),s.getMonth()+(s.getDate()>1?1:0),1),f=h.getMonth()%m;f&&h.setMonth(h.getMonth()+(m-f)),u(h,g=>g.setMonth(g.getMonth()+m),{month:"short"},!0)}}return a}function Qr(e,t){let n=new Array(e),r=new Uint8Array(e),o=i=>{if(typeof i!="string"||i.length===0||i.length>9)return-1;let a=Number(i);return Number.isInteger(a)&&a>=0&&a<e&&String(a)===i?a:-1};return new Proxy(n,{get(i,a,s){let l=o(a);return l>=0?(r[l]||(i[l]=t(l),r[l]=1),i[l]):Reflect.get(i,a,s)},has(i,a){return o(a)>=0||Reflect.has(i,a)}})}var Xa=(e,t,n)=>e==="date"?At(t,n)?.getTime()??NaN:Ae(t);function Ua(e){let t=e.filter(n=>n!=null&&n!=="");return t.length?t.every(n=>n instanceof Date)||t.every(n=>typeof n=="string"&&vr(n.trim()))?"date":t.every(n=>typeof n=="number"||typeof n=="string"&&/^-?\d+(\.\d+)?$/.test(n.trim()))?"number":"band":"band"}function Ke(e,t,n,r,o={}){let i=je(t,"x"),a=Array.isArray(n),s=a?n:null,l=a?null:je(n,"y"),u=!a&&r!==void 0?je(r,"series"):null,d=e.map((v,x)=>i(v,x)),c=o.xType??Ua(d),m=o.locale??le,h,f,g;if(c==="band"){let v=d.map(C=>String(C??""));h=we(v);let x=new Map(h.map((C,D)=>[C,D]));f=h.map((C,D)=>D),g=Int32Array.from(v,C=>x.get(C)??-1)}else{let v=c==="date"?o.dayFirst??$r(d):void 0,x=d.map(L=>Xa(c,L,v)),C=Array.from(new Set(x.filter(L=>Number.isFinite(L)))).sort((L,ee)=>L-ee),D=new Map(C.map((L,ee)=>[L,ee]));f=C,h=C.map(String),g=Int32Array.from(x,L=>D.get(L)??-1)}let w=o.dateFormat,k=v=>typeof v=="string"?St(v.trim())?.[3]:void 0,$=c==="date"&&d.length<5e3?k(d[0]):void 0,y=($===2||$===3)&&d.every(v=>k(v)===$),S=y&&$===3;if(c==="date"&&!w){let v=f.length>1?f[f.length-1]-f[0]:0;w=y&&$===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(c==="band")b=h;else if(S&&!o.dateFormat){let v=X(m)==="ko";b=f.map(x=>{let C=new Date(x),D=Math.floor(C.getMonth()/3)+1;return v?`${C.getFullYear()}년 ${D}분기`:`Q${D} ${C.getFullYear()}`})}else{let v=f.every(hn),x=c==="date"?new Intl.DateTimeFormat(m,w):new Intl.NumberFormat(m,v?{useGrouping:!1}:{maximumFractionDigits:6});b=f.length>1e3?Qr(f.length,C=>x.format(f[C])):f.map(C=>x.format(C))}let F=s?[...s]:u?we(e.map((v,x)=>String(u(v,x)??""))):[""],O=new Map(F.map((v,x)=>[v,x])),I=F.map(()=>new Array(h.length).fill(NaN)),B=F.map(()=>new Array(h.length).fill(null)),P=o.aggregate??"sum",_=P==="mean"?F.map(()=>new Uint32Array(h.length)):null,T=(v,x,C,D)=>{let L=I[v][x];P==="last"?I[v][x]=C:P==="count"?I[v][x]=(Number.isFinite(L)?L:0)+1:P==="mean"?Number.isFinite(C)&&(I[v][x]=(Number.isFinite(L)?L:0)+C,_[v][x]++):I[v][x]=Number.isFinite(L)?L+(Number.isFinite(C)?C:0):C,B[v][x]=D};for(let v=0;v<e.length;v++){let x=g[v];if(x<0)continue;let C=e[v];if(s)for(let D=0;D<s.length;D++)T(D,x,Ae(C[s[D]]),C);else{let D=u?O.get(String(u(C,v)??""))??0:0;T(D,x,Ae(l(C,v)),C)}}if(_)for(let v=0;v<I.length;v++)for(let x=0;x<h.length;x++)_[v][x]>1&&(I[v][x]/=_[v][x]);return{type:c,keys:h,xnum:f,labels:b,series:F,values:I,rows:B}}var Ya=140,gt=12,eo=14,Fn=20,to=12.5;function Ja(e,t,n=Pr){let r=Pe(t,t),o=new Map;e.forEach((a,s)=>{let l=r(a,s),u=o.get(l);u?u.push(a):o.set(l,[a])});let i=[...o.keys()].slice(0,n);return{values:i,groups:i.map(a=>o.get(a)),dropped:Math.max(0,o.size-n)}}function qa(e,t,n){if(t<1)return 1;let r=Math.max(1,Math.floor((e+gt)/(Ya+gt))),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)*gt)/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 ht=e=>e.filter(Number.isFinite);function Gt(e,t){let n=[];for(let r of Array.isArray(t)?t:t===void 0?[]:[t]){let o=It(r,String(r));e.forEach((i,a)=>n.push(o(i,a)))}return ht(n)}function no(e,t,n,r,o,i){return Ke(t,n.x,r,o,{xType:e==="bar"?"band":n.xType,aggregate:i,dayFirst:n.dayFirst})}function Qa(e,t,n,r,o,i){let a=Math.max(2,Math.round(i/70)),s=r.yScale==="log"&&(e==="line"||e==="scatter"),l=r.yDomain,u=l&&(!s||l[0]>0&&l[1]>0)?l:void 0;if(e==="scatter"){let b=t.flat(),F=r.refLines??{},[O,I]=Be([...Gt(b,r.x??"x"),...ht([Number(F.x)])]),[B,P]=Be([...Gt(b,r.y??"y"),...ht([Number(F.y)])].filter(T=>!s||T>0)),_=r.zero??!1;return{y:u??(s?jt(B,P,a):Ve(B,P,a,{zero:_,pad:.08})),x:r.xDomain??Ve(O,I,Math.max(2,Math.round(o/110)),{zero:_,pad:.06}),sameKeys:!0}}let d=e==="bar",c=d&&r.orientation==="horizontal",m=n[0]?.keys.join(""),h=n.every(b=>b.keys.join("")===m),f=n.length>0&&n.every(b=>b.type!=="band"&&b.type===n[0].type),g=r.xDomain??(!d&&f?Be(n.flatMap(b=>ht(b.xnum))):void 0),w=d?r.layout??"grouped":e==="area"?r.stack??"auto":"none";if(w==="percent")return{x:g,sameKeys:h};if(u)return{y:u,x:g,sameKeys:h};let k=[];t.forEach((b,F)=>{let O=n[F];if(w==="stacked"||w==="auto"&&O.series.length>1){let B=Mn(O.values,"zero");B.y0.forEach(P=>k.push(...P)),B.y1.forEach(P=>k.push(...P))}else O.values.forEach(B=>k.push(...B));d&&!c&&r.line!==void 0&&no(e,b,r,[].concat(r.line),void 0,r.series===void 0?r.aggregate:"mean").values.forEach(B=>k.push(...B)),d||k.push(...Gt(b,r.lower),...Gt(b,r.upper))}),d&&k.push(0),c||k.push(...Ur(r.annotations));for(let b of r.referenceLines??[])k.push(b.y);r.signColors&&k.push(Number(r.baseline??0));let[$,y]=Be(ht(k).filter(b=>!s||b>0));return{y:s?jt($,y,a):d?Ve($,y,c?Math.max(2,Math.round(o/120)):a):Ve($,y,a,{zero:r.zero??e==="area"}),x:g,sameKeys:h}}function es(e,t,n,r,o,i,a,s){if(e!=="line"&&e!=="area"||!o.x||!o.y)return;let l=Ke(t.flat(),r.x,r.y,void 0,{xType:r.xType,locale:s,dayFirst:r.dayFirst}),u=(r.yScale==="log"&&e==="line"?Rn:ve)(o.y,[a-22,10]).ticks(Math.max(2,Math.round(a/70))),d=Tn(u,ct(r.format,s,Math.max(Math.abs(o.y[0]),Math.abs(o.y[1]))),s),c=n.flatMap(b=>b.series),m=r.endLabels??n.some(b=>b.series.length>1),h=d+6,f=i-(m?Math.min(i*.28,Math.max(...c.map(b=>ae(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>ft(w,k,Math.max(2,Math.floor((f-h)/64)),s).length;if(l.type==="band"||!g||$)return;let y=b=>h+(l.xnum[b]-w)/(k-w)*(f-h),S=b=>ae(l.labels[b],se);for(let b=1;;b++){let F=Array.from({length:Math.ceil(g/b)},(O,I)=>I*b);if(b>=g||F.every((O,I)=>!I||y(O)-y(F[I-1])>=(S(O)+S(F[I-1]))/2+8))return F.map(O=>({value:l.xnum[O],label:l.labels[O]}))}}function ts(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 ns(e,t,n,r){let o=[n.x,n.y,n.series].map(i=>JSON.stringify(i??null)).join("|");return`ztd-facet-${ts(`${e}|${t}|${o}|${zt(r)}`)}`}function rs(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 os={en:{intro:(e,t)=>`${Se(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:"(빈 값)"}},_n=18;function ro(e){let{type:t,chartProps:n}=e,{values:r,groups:o,dropped:i}=Ja(e.data,e.by),a=r.length,s=typeof e.width=="number"&&Number.isFinite(e.width)&&e.width>0?e.width:480,l=qa(s,a,e.columns),{pw:u,ph:d}=Za(s,l,e.height),c=e.scale!=="free",m=t==="scatter"?[]:o.map(_=>no(t,_,n,n.y,n.series,n.aggregate)),h=c?Qa(t,o,m,n,u,d):{sameKeys:!1},f=c?es(t,o,m,n,h,u,d,e.locale):void 0,g=t==="bar"&&n.orientation==="horizontal",w=c&&(!g||h.sameKeys),k=c&&(g||h.x!==void 0||h.sameKeys),$=new Set(rs(e.highlight,r)?[e.highlight].flat():[]),y=$.size>0,S=t==="bar"&&!Array.isArray(n.y)&&n.series===void 0||t==="scatter"&&n.series===void 0,b=e.syncId??ns(t,e.by,n,e.data),F=Ze(Fe(n.format,e.locale),n.unit),O=os[e.lang],I=[],B=r.map(_=>_===""?O.blank:_);return{panels:r.map((_,T)=>{let v=o[T],x=B[T],C=T%l,D;if(t!=="scatter"){let ee=m[T],Re=K=>ee.values.reduce((ne,Xe)=>ne+(Number.isFinite(Xe[K])?Xe[K]:0),0),W=ee.keys.map((K,ne)=>ne).filter(K=>ee.values.some(ne=>Number.isFinite(ne[K]))),ce=W[W.length-1];I.push({first:W.length?Re(W[0]):NaN,last:W.length?Re(ce):NaN,total:W.reduce((K,ne)=>K+Re(ne),0)}),t!=="bar"&&ee.series.length===1&&ce!==void 0&&(D=F(ee.values[0][ce]))}else I.push({first:NaN,last:NaN,total:v.length});let L={data:v,width:u,height:d,ariaLabel:e.title?`${e.title}, ${x}`:x,syncId:b,highlight:y?$.has(_)?S?()=>!0:void 0:"none":e.highlight,showYAxis:!w||C===0,showXAxis:!k||T+l>=a};return h.y&&(L.yDomain=h.y),h.x&&(L.xDomain=h.x),f&&(L.xTicks=f),{value:_,label:x,props:L,last:D,isPicked:$.has(_)}}),cols:l,pw:u,ph:d,isPanelPick:y,description:is(t,e.by,B,I,i,F,O)}}function is(e,t,n,r,o,i,a){let s=a.intro(n.length,t),l=u=>Vr(r.map(d=>d[u]));if(e==="line"||e==="area"){let u=l("last");u>=0&&(s+=a.endHigh(n[u],i(r[u].last)));let d=n.filter((c,m)=>r[m].last<r[m].first);s+=d.length?a.falling(`${d.slice(0,5).join(", ")}${d.length>5?a.more:""}`):a.noneFalling}else{let u=l("total");u>=0&&(s+=e==="bar"?a.total(n[u],i(r[u].total)):a.points(n[u],r[u].total))}return o&&(s+=a.dropped(n.length,n.length+o)),s}var fe=N(Y(),1);function as(e){return[...new Set([0,.01,.02,.05,.1,.15,.2,e].filter(t=>t<=e))].sort((t,n)=>t-n)}function ss(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 Wt={threshold:.25,enoughPx:96,rootMargin:"0px"};function ao(e,t=!0){let[n,r]=(0,fe.useState)({visible:!t,near:!t});return(0,fe.useEffect)(()=>{if(!t){r({visible:!0,near:!0});return}if(!e)return;if(typeof IntersectionObserver>"u"){r({visible:!0,near:!0});return}let o=new IntersectionObserver(a=>{let s=ss(a[a.length-1],Wt.threshold,Wt.enoughPx);r(l=>l.visible===s?l:{...l,visible:s,near:l.near||s})},{threshold:as(Wt.threshold),rootMargin:Wt.rootMargin}),i=new IntersectionObserver(a=>{let s=a[a.length-1];r(l=>l.near===s.isIntersecting?l:{...l,near:s.isIntersecting})},{threshold:0,rootMargin:"240px 0px 240px 0px"});return o.observe(e),i.observe(e),()=>{o.disconnect(),i.disconnect()}},[e,t]),n}function oo(e){let t=e.getBoundingClientRect().width;return t>0?Math.round(t*10)/10:0}function Vt(e){let[t,n]=(0,fe.useState)(null),[r,o]=(0,fe.useState)(e??null),i=(0,fe.useCallback)(a=>{n(a),a&&e===void 0&&o(oo(a))},[e]);return Ce(()=>{if(e!==void 0){o(e);return}if(!t)return;let a=u=>o(d=>d!==null&&Math.abs(d-u)<.5?d:u),s=()=>a(oo(t));if(typeof ResizeObserver>"u")return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s);let l=new ResizeObserver(u=>{let d=u[u.length-1]?.contentRect;d?a(d.width>0?Math.round(d.width*10)/10:0):s()});return l.observe(t),()=>l.disconnect()},[t,e]),[t,i,r]}var ls=()=>()=>{};function tt(){return(0,fe.useSyncExternalStore)(ls,()=>!0,()=>!1)}var io="(prefers-reduced-motion: reduce)";function Kt(e="auto"){let[t,n]=(0,fe.useState)(()=>be&&typeof window.matchMedia=="function"?window.matchMedia(io).matches:!1);return(0,fe.useEffect)(()=>{if(e!=="auto"||!be||typeof window.matchMedia!="function")return;let r=window.matchMedia(io),o=()=>n(r.matches);return o(),r.addEventListener?.("change",o),()=>r.removeEventListener?.("change",o)},[e]),e===!0?!0:e===!1?!1:t}var $e=N(z(),1),cs=60,us=420;function so(e){let t=ke(),n=e.chartProps??{},[,r,o]=Vt(e.width),i=e.width??(o||480),a=ie(e.locale??n.locale),s=X(a),l=(0,nt.useContext)(Ye),u=e.title??l,d=e.chart.facetPlan,c=(0,nt.useMemo)(()=>{let k=ro({type:e.type,data:e.data,by:e.by,columns:e.columns,scale:e.scale,chartProps:n,highlight:e.highlight,syncId:e.syncId,width:i,height:e.height,title:u,locale:a,lang:s});return d?d(k,n,a):k},[e.type,e.data,e.by,e.columns,e.scale,JSON.stringify(n,(k,$)=>typeof $=="function"?String($):$),e.highlight,e.syncId,i,e.height,u,a,s,d]),m=`${(0,nt.useId)().replace(/:/g,"")}fd`,h=Kt(n.reducedMotion??"auto"),f=tt(),g=rr({motion:{enabled:n.animate!==!1&&!h&&be},hydrated:f},{waiting:!1,generation:0}),w=e.chart;return(0,$e.jsxs)("div",{ref:r,role:"group","aria-label":u,"aria-describedby":m,className:e.className,style:{position:"relative",width:"100%",...e.style},children:[(0,$e.jsx)("p",{id:m,style:Lt,children:e.description??c.description}),(0,$e.jsx)("div",{style:{display:"grid",gridTemplateColumns:`repeat(${c.cols}, minmax(0, 1fr))`,columnGap:gt,rowGap:eo,...c.legend?{marginTop:_n}:null},children:c.panels.map((k,$)=>{let y=t.paint(k.isPicked?"accentText":c.isPanelPick?"muted":"ink");return(0,$e.jsxs)("div",{"data-facet":k.value,style:{minWidth:0,...nr(g,!1,"fade",$*cs,us)},children:[(0,$e.jsxs)("div",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,height:Fn,fontSize:to,fontWeight:700,lineHeight:`${Fn}px`,color:y},children:[(0,$e.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:k.label}),k.last!==void 0?(0,$e.jsx)("span",{style:{flex:"none",fontVariantNumeric:"tabular-nums"},children:k.last}):null]}),(0,$e.jsx)(w,{...n,...k.props})]},k.value)})}),c.legend?(0,$e.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",top:0,right:0,height:_n},children:c.legend}):null]})}var lo=["max","min","first","last","none"];function Me(e,t,n,r,o="max"){let i=new Set,a=n.length,s=u=>{if(a&&u!=="none"){if(u==="first")i.add(0);else if(u==="last")i.add(a-1);else if(u==="max"||u==="min"){let d=-1,c=u==="max"?-1/0:1/0;r.forEach((m,h)=>{Number.isFinite(m)&&(u==="max"?m>c:m<c)&&(c=m,d=h)}),d>=0&&i.add(d)}}};if(e==null)return s(o),i;if(typeof e=="function")return t.forEach((u,d)=>{d<a&&u!==null&&u!==void 0&&e(u,d)&&i.add(d)}),i;let l=Array.isArray(e)?e:[e];for(let u of l)typeof u=="number"?u>=0&&u<a&&i.add(u):u==="max"||u==="min"||u==="first"||u==="last"||u==="none"?s(u):n.forEach((d,c)=>{d===u&&i.add(c)});return i}var pe=N(Y(),1);async function ms(e,t="auto",n="",r){let o=e.headers.get("content-type")??"",i=await e.text();if(t==="text")return i;if(o.includes("text/html")||/^\s*<(!doctype html|html[\s>])/i.test(i))throw new Error(X(r)==="ko"?`데이터 대신 HTML 페이지를 받았어요. 주소를 확인해 주세요${n?`: ${n}`:"."}`:`Got an HTML page instead of data${n?` (${n})`:""}. Check the URL.`);if(t==="csv")return Ge(i);if(t==="json"||o.includes("json"))return JSON.parse(i);if(o.includes("csv")||/[./]csv(\?|#|$)|output=csv|format=csv|tqx=out:csv/i.test(n))return Ge(i);let a=i.trim();return a.startsWith("{")||a.startsWith("[")?JSON.parse(a):Ge(i)}async function ds(e,t={}){let n=t.signal??new AbortController().signal,r;if(typeof e=="function")r=await e(n);else{let o=e instanceof Request?e.url:String(e),i=await fetch(e instanceof Request?e.clone():o,{...t.init,signal:n});if(!i.ok)throw new Error(`HTTP ${i.status}${i.statusText?` ${i.statusText}`:""}`);r=await ms(i,t.parse,o,t.locale)}return t.select&&(r=zr(r,t.select)),t.transform?t.transform(r):ze(r)}function co(e,t={}){let{refreshMs:n,enabled:r=!0,keepPrevious:o=!0}=t,[i,a]=(0,pe.useState)(()=>({data:[],status:e&&r?"loading":"idle",error:null,updatedAt:null})),[s,l]=(0,pe.useState)(0),u=ie(t.locale),d=(0,pe.useRef)(t);d.current={...t,locale:u};let c=(0,pe.useRef)(e);c.current=e;let m=typeof e=="function"?"fn":e instanceof Request?e.url:e?String(e):"",h=t.deps??[],f=JSON.stringify(h.map(k=>typeof k=="object"?JSON.stringify(k):String(k))),g=(0,pe.useRef)(!1);(0,pe.useEffect)(()=>{let k=c.current;if(!k||!r){a(S=>S.status==="loading"?{...S,status:"idle"}:S);return}let $=new AbortController,y=!0;return g.current=!0,a(S=>({...S,data:o?S.data:[],status:"loading",error:null})),ds(k,{...d.current,signal:$.signal}).then(S=>{y&&a({data:S,status:"success",error:null,updatedAt:Date.now()})}).catch(S=>{!y||$.signal.aborted||a(b=>({...b,status:"error",error:S instanceof Error?S:new Error(String(S))}))}).finally(()=>{y&&(g.current=!1)}),()=>{y=!1,g.current=!1,$.abort()}},[m,r,s,f,o]),(0,pe.useEffect)(()=>{if(!n||!r)return;let k=setInterval(()=>{g.current||l($=>$+1)},n);return()=>clearInterval(k)},[n,r]);let w=(0,pe.useCallback)(()=>l(k=>k+1),[]);return{data:i.data,status:i.status,loading:i.status==="loading",error:i.error,empty:i.status==="success"&&i.data.length===0,updatedAt:i.updatedAt,reload:w}}var Dn=N(z(),1),fs=["csv","svg","png"],hs=/^[=+\-@\t\r\n=+-@]/,gs=/var\(|color-mix\(/;function uo(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?xr(e.getTime()):String(e);return`"${(hs.test(t)&&!Number.isFinite(Ae(t))?`'${t}`:t).replace(/"/g,'""')}"`}function ps(e){return[...new Set(e.slice(0,200).flatMap(t=>t&&typeof t=="object"?Object.keys(t):[]))]}function bs(e,t){return`\uFEFF${[t.map(uo),...e.map(r=>t.map(o=>uo(r[o])))].map(r=>r.join(",")).join(`\r
|
|
26
|
+
`)}\r
|
|
27
|
+
`}function ys(e){return Array.from((e??"").replace(/[\\/:*?"<>|\r\n\t]+/g,"-").trim()).slice(0,80).join("")||"chart"}function Pn(e,t){let n=document.createElement("a");n.href=URL.createObjectURL(e),n.download=t,n.click(),setTimeout(()=>URL.revokeObjectURL(n.href),1e4)}var mo=2,He=16;function fo(e,t){if(!/^(ok)?l(ab|ch)\(|^color\(/.test(e))return e;let n=t.get(e);if(n)return n;let r=document.createElement("canvas").getContext("2d");if(!r)return e;r.fillStyle=e,r.fillRect(0,0,1,1);let[o,i,a,s]=r.getImageData(0,0,1,1).data;return n=s===255?`rgb(${o}, ${i}, ${a})`:`rgba(${o}, ${i}, ${a}, ${Math.round(s/255*1e3)/1e3})`,t.set(e,n),n}function ho(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 go(e,t,n){let r=e.closest(".ztd-card"),o=r?.querySelector("svg.ztd-svg");if(!r||!o)return null;let{width:i,height:a}=o.viewBox.baseVal,[s,l]=[i+He*2,a+He*2],u=o.cloneNode(!0),d=u.querySelectorAll("*"),c=new Map;o.querySelectorAll("*").forEach((f,g)=>{let w;for(let k of Array.from(f.attributes)){if(!gs.test(k.value))continue;let $=(w??(w=getComputedStyle(f))).getPropertyValue(k.name);$&&d[g].setAttribute(k.name,fo($,c))}}),u.removeAttribute("style");for(let[f,g]of Object.entries({viewBox:`${-He} ${-He} ${s} ${l}`,width:s*t,height:l*t,"font-family":getComputedStyle(o).fontFamily}))u.setAttribute(f,String(g));let m=fo(getComputedStyle(r).backgroundColor,c),h=o.parentElement?.querySelector("canvas")??null;if(n){let f=u.querySelector("desc")?.nextSibling??u.firstChild;u.insertBefore(ho("rect",{x:-He,y:-He,width:s,height:l,fill:m}),f),h&&u.insertBefore(ho("image",{href:h.toDataURL(),width:i,height:a}),f)}return{svg:new XMLSerializer().serializeToString(u),w:s,h:l,vw:i,vh:a,bg:m,canvas:h}}function xs(e,t){let n=go(e,mo,!1);if(!n)return;let r=mo,o=document.createElement("canvas");o.width=Math.ceil(n.w*r),o.height=Math.ceil(n.h*r);let i=o.getContext("2d");if(!i)return;i.fillStyle=n.bg,i.fillRect(0,0,o.width,o.height),n.canvas&&i.drawImage(n.canvas,He*r,He*r,n.vw*r,n.vh*r);let a=URL.createObjectURL(new Blob([n.svg],{type:"image/svg+xml"})),s=new Image;s.onload=()=>{i.drawImage(s,0,0,o.width,o.height),URL.revokeObjectURL(a),o.toBlob(l=>l&&Pn(l,`${t}.png`),"image/png")},s.onerror=()=>URL.revokeObjectURL(a),s.src=a}function po(e){let t=ke(e.theme),n=X(ie(e.locale))==="ko",r=ys(e.filename),o=(i,a)=>{if(i==="csv")return Pn(new Blob([bs(e.data,e.columns?.length?e.columns:ps(e.data))],{type:"text/csv;charset=utf-8"}),`${r}.csv`);if(i==="png")return xs(a,r);let s=go(a,1,!0);s&&Pn(new Blob([s.svg],{type:"image/svg+xml"}),`${r}.svg`)};return(0,Dn.jsx)("span",{style:{display:"inline-flex",gap:6,flex:"none"},children:fs.filter(i=>!e.formats||e.formats.includes(i)).map(i=>{let a=i.toUpperCase(),s=n?`${a} 내려받기`:`Download ${a}`;return(0,Dn.jsx)("button",{type:"button",className:"ztd-btn","aria-label":s,title:s,onClick:l=>o(i,l.currentTarget),style:{background:"transparent",color:t.paint("muted"),border:`1px solid ${t.paint("line2")}`,borderRadius:14,height:28,padding:"0 10px",fontSize:12,fontWeight:700,flex:"none"},children:a},i)})})}var yo=N(z(),1);function bo(e,t=le){let n=Fe(void 0,t),r=e.split(`
|
|
28
|
+
`),o=(i,a)=>{if(a==="label")return i.label;if(a==="value")return i.formatted??(i.value===null?null:n(i.value));if(a==="series")return i.series??null;let s=i.datum&&typeof i.datum=="object"?i.datum[a]:void 0;return s==null||s===""||typeof s=="number"&&!Number.isFinite(s)?null:typeof s=="number"?n(s):s instanceof Date?ut(s,{locale:t,year:"numeric",month:"short",day:"numeric"}):String(s)};return i=>{let a=[];for(let s of r){let l=!1,u=s.replace(wr,(d,c)=>o(i,c.trim())??(l=!0,""));l||a.push(u)}return a.length?a.map((s,l)=>(0,yo.jsx)("div",{children:s},l)):null}}var ks=[1,2,2.5,5,10];var xo=e=>Number(e.toPrecision(12));function ko(e,t=!1){let n=10**Math.floor(Math.log10(e)),r=ks.map(o=>xo(o*n));return t?r.find(o=>o>=e*(1-1e-9))??xo(10*n):r.reduce((o,i)=>Math.abs(Math.log(i/e))<Math.abs(Math.log(o/e))?i:o)}function wo(e,t,n=!1){let r=Pe(t,"group"),o=e.map((s,l)=>r(s,l)).filter(Boolean),i=we(o);if(!n)return i;let a=new Map;for(let s of o)a.set(s,(a.get(s)??0)+1);return i.map((s,l)=>[s,l]).sort((s,l)=>a.get(s[0])-a.get(l[0])||s[1]-l[1]).map(([s])=>s)}function vo(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 Ge(t.csv)}return null}var No=N(Y(),1);var Z=N(Y(),1);function $o(e,t){let n=ke(e.theme),[r,o,i]=Vt(e.width),a=tt(),s=e.width??(i||t.ssrWidth||480),l=typeof t.height=="function"?t.height(s):t.height,u=e.height??l,d=Kt(e.reducedMotion??"auto"),c=e.animate!==!1&&!d&&be,m=ao(r,e.animateOnView!==!1&&c),h=ie(e.locale),f=X(h),g=(0,Z.useMemo)(()=>Fe(e.format,h,t.format),[e.format,h,t.format]),w=(0,Z.useCallback)(W=>Ct(W,{locale:h}),[h]),k=(0,Z.useMemo)(()=>Ze(g,e.unit),[g,e.unit]),$=(0,Z.useMemo)(()=>zt(e.data),[e.data]),[y,S]=(0,Z.useState)(null),[b,F]=(0,Z.useState)(null),O=(0,Z.useRef)([]),I=(0,Z.useRef)(e.onHover);I.current=e.onHover;let B=(0,Z.useRef)(e.onClick);B.current=e.onClick;let P=(0,Z.useRef)(null),_=(0,Z.useRef)(null),T=(0,Z.useRef)(null),v=(0,Z.useCallback)((W,ce="pointer")=>{if(T.current!==W){T.current=W;let K=W===null?null:O.current[W]??null;queueMicrotask(()=>I.current?.(K)),_.current?.(W)}P.current=W===null?null:ce,S(W),F(P.current)},[]),x=(0,Z.useCallback)(W=>{P.current!=="keyboard"&&(P.current=W===null?null:"sync",S(W),F(P.current))},[]),C=(0,Z.useCallback)(W=>{let ce=O.current[W];ce&&B.current?.(ce)},[]),D=Cr(e.replayKey),L=e.width!==void 0||(i??0)>0,ee={enabled:c,active:m.visible&&L,near:m.near,replayKey:D,dataKey:$,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},Re=(0,Z.useCallback)((W,ce=1)=>y===null||y===W?ce:ce*.38,[y]);return{p:n,width:s,height:u,measured:L,responsive:e.width===void 0,pending:be&&a&&e.width===void 0&&i===null,node:r,hydrated:a,ref:o,motion:ee,fv:k,fmt:g,pct:w,locale:h,lang:f,t:f==="ko"?ir:or,active:y,via:b,setActive:v,click:C,events:O,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:Re,sig:$,description:e.description,reduced:d,publish:_,applySync:x}}var q=N(Y(),1);function ws(e){return 1-Math.pow(1-e,3)}function vs(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function $s(e){return e==="easeInOut"?vs:e==="linear"?t=>t:ws}function Ms(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 rt(e,t){if(e.length===t)return e.slice();if(!e.length)return new Array(t).fill(0);if(e.length===1||t===1)return new Array(t).fill(e[0]);let n=new Array(t);for(let r=0;r<t;r++){let o=r/(t-1)*(e.length-1),i=Math.floor(o),a=Math.min(e.length-1,i+1);n[r]=e[i]+(e[a]-e[i])*(o-i)}return n}function Xt(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 Mo(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 To(e,t,n,r){if(!t||!n||t.length!==n.length)return rt(e,r);let o=[],i=0;for(let a=0;a<n.length;a++){let s=e.slice(i,i+t[a]);i+=t[a];for(let l of rt(s,n[a]))o.push(l)}return o.length===r?o:rt(e,r)}var Ut=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||!Xt(o.to,r.to))return!1}return!0}refreshData(t){for(let n of t){let r=this.tracks.get(n.key);r&&(r.data=n.data)}}make(t,n,r,o){let i=t.from??t.to,a=t.enter??i;return{key:t.key,data:t.data,from:n.slice(),vel:new Array(t.to.length).fill(0),to:t.to.slice(),appear:i.slice(),enter:a.slice(),exit:(t.exit??a).slice(),delay:o,t0:r,cur:n.slice(),curVel:new Array(t.to.length).fill(0),done:!1,exiting:!1,order:this.seq++,progress:0,parts:t.parts}}snap(t){let n=new Map;for(let r of t){let o=this.tracks.get(r.key),i=this.make(r,r.to,0,0);o&&(i.order=o.order),i.done=!0,i.progress=1,n.set(r.key,i)}this.tracks=n,this.animating=!1,this.entranceStart=-1}hold(t){let n=new Map,r=0;for(let o of t){let i=this.tracks.get(o.key),a=this.make(o,o.from??o.to,1/0,o.delay??0);i&&(a.order=i.order),r=Math.max(r,o.delay??0),n.set(o.key,a)}this.maxDelay=r,this.tracks=n,this.animating=!1,this.entranceStart=-1}start(t){for(let n of this.tracks.values())n.t0=t+n.delay,n.from=n.appear.slice(),n.vel.fill(0),Mo(n.from,n.vel,n.to),n.cur=n.from.slice(),n.curVel=n.vel.slice(),n.done=Xt(n.from,n.to),n.done&&(n.progress=1);this.entranceStart=t,this.animating=!0}update(t,n,r=0){this.step(n);let o=new Set,i=0;for(let a of t){o.add(a.key);let s=this.tracks.get(a.key),l=r>0?Math.min(i*r,240):0;if(s){let u=a.to.length;s.from=To(s.cur,s.parts,a.parts,u),s.vel=To(s.curVel,s.parts,a.parts,u),s.parts=a.parts,s.to=a.to.slice(),Mo(s.from,s.vel,s.to),s.cur=s.from.slice(),s.curVel=s.vel.slice(),s.appear=(a.from??a.to).slice(),s.enter=(a.enter??s.appear).slice(),s.exit=(a.exit??s.enter).slice(),s.data=a.data,s.exiting=!1,s.t0=n+(s.t0>n?Math.max(0,s.t0-n):l),s.done=Xt(s.from,s.to)&&s.vel.every(d=>Math.abs(d)<1e-6),s.progress=s.done?1:0}else{let u=this.make(a,a.enter??a.from??a.to,n+l,0);u.done=Xt(u.from,u.to),this.tracks.set(a.key,u)}i++}for(let a of this.tracks.values())o.has(a.key)||a.exiting||(a.from=a.cur.slice(),a.vel=a.curVel.slice(),a.to=rt(a.exit,a.cur.length),a.t0=n,a.exiting=!0,a.done=!1,a.progress=0);this.animating=!0}step(t){if(!this.animating)return!1;let n=!1,r=$s(this.easing),o=this.duration/1e3,i=this.omega,a=[];for(let s of this.tracks.values()){if(s.done)continue;let l=(t-s.t0)/1e3,u=s.to.length;if(s.from.length!==u&&(s.from=rt(s.from,u)),s.vel.length!==u&&(s.vel=rt(s.vel,u)),s.cur.length!==u&&(s.cur=new Array(u).fill(0),s.curVel=new Array(u).fill(0)),!(l>0)){for(let c=0;c<u;c++)s.cur[c]=s.from[c],s.curVel[c]=0;s.progress=0,n=!0;continue}let d;if(this.easing==="spring"){let c=Math.exp(-i*l),m=i*l>=8&&i*l<20,h=0;for(let f=0;f<u;f++){let g=s.from[f]-s.to[f],w=s.vel[f]+i*g;s.cur[f]=s.to[f]+(g+w*l)*c,s.curVel[f]=(s.vel[f]-i*w*l)*c,m&&h<.15&&(h=Math.max(h,Math.abs(s.cur[f]-s.to[f]),Math.abs(s.curVel[f]/i)))}d=i*l>=20||m&&h<.15,s.progress=Math.min(1,1-(1+i*l)*c)}else{let c=Math.min(1,l/o),m=r(c),h=Ms(this.easing,c)/o;for(let f=0;f<u;f++)s.cur[f]=s.from[f]+(s.to[f]-s.from[f])*m,s.curVel[f]=(s.to[f]-s.from[f])*h;d=c>=1,s.progress=m}if(d){for(let c=0;c<u;c++)s.cur[c]=s.to[c],s.curVel[c]=0;s.done=!0,s.progress=1,s.exiting&&a.push(s.key)}else n=!0}for(let s of a)this.tracks.delete(s);return this.animating=n,n||(this.entranceStart=-1),n}elapsed(t){return this.entranceStart<0?1/0:t-this.entranceStart}get entranceLength(){return this.duration+this.maxDelay}get(t){return this.tracks.get(t)?.cur}items(){return[...this.tracks.values()].sort((t,n)=>t.order-n.order).map(t=>({key:t.key,v:t.cur,data:t.data,exiting:t.exiting,progress:t.progress}))}get size(){return this.tracks.size}},pt=new Set,Yt=0;function Co(e){Yt=0;let t=Array.from(pt);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||pt.delete(n)}pt.size&&typeof requestAnimationFrame<"u"&&(Yt=requestAnimationFrame(Co))}function So(e){return pt.add(e),!Yt&&typeof requestAnimationFrame<"u"&&(Yt=requestAnimationFrame(Co)),()=>{pt.delete(e)}}function Ts(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 Ao(e,t){let n=(0,q.useMemo)(()=>Ts(e),[e]),{enabled:r,active:o,near:i=!0,replayKey:a,dataKey:s,easing:l="spring",duration:u=900,stagger:d=0}=t,c=(0,q.useRef)(null),m=(0,q.useRef)("init"),h=(0,q.useRef)(null),f=(0,q.useRef)(s),g=(0,q.useRef)(a),w=(0,q.useRef)(!1),k=(0,q.useRef)(0),[,$]=(0,q.useState)(0),y=(0,q.useRef)(null),S=(0,q.useRef)(!0);c.current||(c.current=new Ut,c.current.configure(l,u),c.current.snap(n),h.current=n);let b=c.current;if(b.configure(l,u),h.current!==n){let _=m.current,T=!Object.is(f.current,s);b.sameTargets(n)?b.refreshData(n):!r||_==="init"?b.snap(n):_==="idle"?b.hold(n):_==="running"||T?b.update(n,Mt(),d):b.snap(n),h.current=n,f.current=s}let F=(0,q.useRef)(()=>!1);F.current=_=>{if(!S.current)return!1;let T=b.step(_);return!T&&m.current==="running"&&(m.current="done"),$(v=>(v+1)%1e9),T||(y.current=null),T};let O=(0,q.useCallback)(()=>{if(!be||y.current||!b.animating)return;let _=T=>F.current(T);y.current=So(_)},[b]);Ce(()=>{let _=!Object.is(g.current,a);if(g.current=a,!r){(m.current!=="done"||b.animating)&&(b.snap(h.current??n),m.current="done",$(T=>T+1));return}m.current==="init"||_&&i?(b.hold(h.current??n),m.current="idle",w.current=!1,$(T=>T+1)):_&&(w.current=!0)},[r,a]),Ce(()=>{!r||!i||!w.current||(w.current=!1,b.hold(h.current??n),m.current="idle",$(_=>_+1))},[i,r]),(0,q.useEffect)(()=>{r&&o&&m.current==="idle"&&(b.start(Mt()),k.current+=1,m.current="running",O(),$(_=>_+1))},[r,o,a,b,O]),(0,q.useEffect)(()=>{b.animating&&O()}),(0,q.useEffect)(()=>(S.current=!0,()=>{S.current=!1,y.current?.(),y.current=null}),[]);let I=Mt(),B=b.elapsed(I),P=r&&m.current==="idle";return{items:b.items(),get:_=>b.get(_),elapsed:P?0:B,fade:(_,T=320)=>P?0:Number.isFinite(B)?Math.max(0,Math.min(1,(B-_)/T)):1,waiting:P,animating:b.animating,generation:k.current}}var bt=N(z(),1);function Ro(e,t,n,r){let o=e.keys.length;if(e.type==="band"){let l=o>1?(n-t)/(o-1):0;return u=>o>1?t+u*l:(t+n)/2}let[i,a]=r??Be(e.xnum),s=ve([i,a===i?i+1:a],[t,n]);return Object.assign(l=>s(e.xnum[l]),{v:s})}function Fo(e){let{c:t,model:n,xs:r,x0:o,x1:i,y:a,domain:s}=e,l=t.p,u;if(s&&n.type!=="band"&&e.fixed){let c=ve(s[1]===s[0]?[s[0],s[0]+1]:[s[0],s[1]],[o,i]);u=e.fixed.map(m=>({x:c(m.value),label:m.label}))}else if(s&&n.type!=="band"){let[c,m]=s[1]===s[0]?[s[0],s[0]+1]:s,h=n.type==="date",f=Math.max(2,Math.floor((i-6)/(h?64:70))),g=c>=1e3&&m<=9999?String:ct(void 0,t.locale,Math.max(-c,m)),w=h?ft(c,m,f,t.locale).map(y=>({v:y.t,label:y.label})):ve([c,m],[0,1]).ticks(f).map(y=>({v:y,label:g(y)})),k=ve([c,m],[6,i]),$=ve([c,m],[o,i]);u=Cn(w.map(y=>({...y,x:k(y.v)})),-6,t.width+2).map(y=>({x:$(y.v),label:y.label}))}else if(n.type==="date"&&n.keys.length>1){let c=n.xnum[0],m=n.xnum[n.xnum.length-1],h=Math.max(2,Math.floor((i-o)/64)),f=ve([c,m],[o,i]),g=ft(c,m,h,t.locale);if(g.length>=2&&n.keys.length>g.length)u=g.map(w=>({x:f(w.t),label:w.label}));else{let w=n.keys.map((k,$)=>r($));u=Sn(w,n.labels).map(k=>({x:w[k],label:n.labels[k]}))}}else if(n.type==="number"&&n.keys.length>12){let[c,m]=Be(n.xnum),h=ve([c,m],[o,i]),f=c>=1e3&&m<=9999?String:ct(void 0,t.locale,Math.max(-c,m));u=h.ticks(Math.max(2,Math.floor((i-o)/70))).map(g=>({x:h(g),label:f(g)}))}else{let c=n.keys.map((m,h)=>r(h));u=Sn(c,n.labels).map(m=>({x:c[m],label:n.labels[m]}))}let d=s&&n.type!=="band"?u:Cn(u,-2,t.width+2);return(0,bt.jsx)("g",{"aria-hidden":"true",children:d.map((c,m)=>(0,bt.jsx)(_e,{x:c.x,y:a,anchor:"middle",size:se,fill:l.paint("muted"),children:c.label},m))})}function _o(e,t,n,r,o){if(r)return o==="categorical"?ye(e,t,n):fr(e,t,n);if(o==="categorical")return ye(e,t,n);let i=te(e,"strong"),a=te(e,"accent");return Array.from({length:t},(s,l)=>n.has(l)?a:i)}var Cs=N(Y(),1);var Ln=N(z(),1);var Po=e=>e?"neutralStrong":"accent";var En=N(z(),1);function Do(e,t,n,r){if(typeof e!="function")return Me(e,n,n,n.map(()=>0),"first");let o=new Map(n.map((a,s)=>[a,s])),i=new Set;return t.forEach((a,s)=>{let l=o.get(r(a,s));l!==void 0&&e(a,s)&&i.add(l)}),i}var Ss=N(Y(),1);var In=N(z(),1),As={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}, ${Se(n,"candle")}. First open ${r}, last close ${o}`,ma:e=>`MA${e}`,up:"Up",down:"Down",maLegend:e=>`${e}-day MA`},Lo={en:As,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}일 이동평균`}},On=["ink","muted","dim"];function Eo(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,On.length)}var U=N(Y(),1);var V=N(z(),1),Ns={kind:"Horizon chart",range:(e,t)=>`${e} to ${t}`,above:e=>`${e} and above`,below:e=>`below ${e}`,lower:"Lower",higher:"Higher",item:(e,t,n)=>`latest ${e}, min ${t}, max ${n}`,at:(e,t,n)=>`${e}, ${t}: ${n}`,desc:(e,t,n,r)=>`${Se(e,"series","series")}, ${Se(t,"point")} each, ${Se(n,"band")} ${r===null?"with each row on its own scale":`of ${r}`}.`,ends:(e,t,n,r)=>` Largest last value: ${e} ${t}. Smallest: ${n} ${r}.`},Rs={en:Ns,ko:{kind:"호라이즌 차트",range:(e,t)=>`${e}~${t}`,above:e=>`${e} 이상`,below:e=>`${e} 미만`,lower:"낮음",higher:"높음",item:(e,t,n)=>`최근 ${e}, 최저 ${t}, 최고 ${n}`,at:(e,t,n)=>`${e}, ${t}: ${n}`,desc:(e,t,n,r)=>`계열 ${e}개, 계열마다 ${t}개 지점, 층 ${n}개${r===null?"(줄마다 자기 눈금)":`(한 층 ${r})`}.`,ends:(e,t,n,r)=>` 마지막 값이 가장 큰 계열은 ${e} ${t}, 가장 작은 계열은 ${n} ${r}.`}},Ne=2,Oo=22,Io=18,Jt=16,Fs=[.3,.4,.5,.6,.7],_s=[1,.75,.5],Q=e=>Math.round(e*10)/10;function zo(e,t,n){let r=e.raw(t),{panel:o,ink:i}=e.theme,a=d=>st(d,o)>=3,s=(d,c)=>c>=1?e.color(t):Rt(t)?e.mix(t,d,c):Oe(r,e.theme[d],c),l=Fs.find(d=>a(Oe(r,o,d)));if(l!==void 0)return Array.from({length:n},(d,c)=>s("panel",n>1?l+(1-l)*c/(n-1):1));let u=_s.find(d=>a(Oe(r,i,d)))??.5;return(n>2?[1,.74,.49]:[1,.6]).slice(0,n).map(d=>s("ink",u*d))}function Bo(e,t,n){let r=Zr(Array.from(e,o=>Math.abs(o-t)))/n;return r>0?ko(r,!0):1}function Ho(e,t){let n=0,r=0;return{at:e.map(i=>{let a=i.pre?ae(i.pre,se)+4:0,s=a+i.bands.length*(Jt+2)+2+ae(i.text,se);n>0&&n+s>t&&(r++,n=0);let l={x:n,line:r,sx:n+a};return n+=s+12,l}),lines:e.length?r+1:0}}function zn(e){let t=ie(e.locale),n=Rs[X(t)],r=(0,U.useMemo)(()=>Ke(e.data,e.x,e.y,e.series,{xType:e.xType,locale:t,aggregate:e.aggregate,dayFirst:e.dayFirst}),[e.data,e.x,e.y,e.series,e.xType,t,e.aggregate,e.dayFirst]),o=(0,U.useMemo)(()=>r.series.length<=mt?r:{...r,series:r.series.slice(0,mt),values:r.values.slice(0,mt),rows:r.rows.slice(0,mt)},[r]),i=o.series.length,a=o.keys.length,s=We(Number.isFinite(e.rowHeight)?e.rowHeight:i<=24?18:14,12,48),l=Number.isFinite(e.bands)?We(Math.round(e.bands),1,3):s>=24?1:2,u=Number.isFinite(e.baseline)?e.baseline:0,d=e.scale==="free",c=(0,U.useMemo)(()=>d?o.values.map(M=>Bo(M,u,l)):[Bo(o.values.flat(),u,l)],[o,u,l,d]),m=(0,U.useMemo)(()=>o.values.map(M=>{let A=NaN,E=-1,j=1/0,J=-1/0;return M.forEach((H,he)=>{Number.isFinite(H)&&(A=H,E=he,j=Math.min(j,H),J=Math.max(J,H))}),{last:A,lastK:E,min:j,max:J}}),[o]),h=m.some(M=>M.min<u),f=(0,U.useMemo)(()=>Fe(e.format,t),[e.format,t]),g=(0,U.useMemo)(()=>Ze(f,e.unit),[f,e.unit]),w=e.legend!==!1&&i>0,k=(0,U.useMemo)(()=>{if(!w)return[];let M=Array.from({length:l},(H,he)=>he),A=h?[{tone:"d",bands:M,text:n.below(g(u))}]:[];if(d)return[{pre:n.lower,tone:"u",bands:M,text:n.higher},...A];let E=H=>u+H*c[0],j=l*c[0],J=m.some(H=>H.max-u>j||u-H.min>j);return[...M.map(H=>({tone:"u",bands:[H],text:J&&H&&H===l-1?n.above(g(E(H))):n.range(f(E(H)),g(E(H+1)))})),...A]},[w,l,h,d,n,f,g,u,c,m]),$=M=>w?M*Io+8:4,y=$o(e,{height:M=>$(Ho(k,M).lines)+Math.max(1,i)*(s+Ne)-Ne+Oo,duration:900,stagger:30}),{p:S,width:b,height:F}=y,O=(0,U.useId)().replace(/:/g,""),[I,B]=(0,U.useState)(null),P=y.active!==null&&I!==null&&I<a?I:null;(0,U.useEffect)(()=>{y.active===null&&B(null)},[y.active]);let _=Ho(k,b),T=$(_.lines),v=e.height===void 0||!i?s:Math.max(2,(F-T-Oo-(i-1)*Ne)/i),x=M=>T+M*(v+Ne),C=T+Math.max(1,i)*(v+Ne)-Ne,D=We(v-1,7,11),L=o.series,ee=M=>L[M]||y.t.value,Re=e.showValues!==!1,W=Math.min(b*.28,Math.max(0,...L.map((M,A)=>ae(ee(A),D,700)))+10),ce=(0,U.useMemo)(()=>Re?Math.max(0,...m.flatMap(M=>[M.last,M.min,M.max].filter(Number.isFinite).map(A=>ae(g(A),D,700))))+10:0,[Re,m,g,D]),K=W,ne=Math.max(K+1,b-ce),Xe=(0,U.useMemo)(()=>Ro(o,K,ne),[o,K,ne]),Te=(0,U.useMemo)(()=>o.keys.map((M,A)=>Xe(A)),[o,Xe]),Hn=(0,U.useMemo)(()=>{if(y.pending)return[];let M=Math.max(3,Math.round(ne-K));return o.values.map((A,E)=>{let j=c[d?E:0],J=T+E*(v+Ne)+v,H=[];for(let me=0;me<A.length;me++){if(!Number.isFinite(A[me]))continue;let oe=H[H.length-1];oe&&oe[oe.length-1]===me-1?oe.push(me):H.push([me])}let he=H.reduce((me,oe)=>me+oe.length,0);he>M&&(H=H.map(me=>Br(me.map(oe=>({x:Te[oe],y:A[oe],k:oe})),Math.max(3,Math.round(M*me.length/he))).map(oe=>oe.k)));let xt=me=>{let oe="",Vn=!1;for(let kt of H){let Le=[];kt.forEach((it,Ue)=>{let Zt=A[it]-u,Qt=Ue?A[kt[Ue-1]]-u:0;Qt*Zt<0&&Le.push([Te[kt[Ue-1]]+(Te[it]-Te[kt[Ue-1]])*Qt/(Qt-Zt),0]);let Kn=Math.min(l*v,Math.max(0,me*Zt)/j*v);Kn>0&&(Vn=!0),Le.push([Te[it],Kn])});let wt=Le.length>1?Le:[[Le[0][0]-1,Le[0][1]],[Le[0][0]+1,Le[0][1]]];oe+=`M${Q(wt[0][0])},${Q(J)}L${wt.map(([it,Ue])=>`${Q(it)},${Q(J-Ue)}`).join("L")}L${Q(wt[wt.length-1][0])},${Q(J)}Z`}return Vn?oe:null};return{u:xt(1),d:xt(-1)}})},[y.pending,o,c,d,l,u,v,T,K,ne,Te]),ot=(0,U.useMemo)(()=>({u:zo(S,"accent",l),d:zo(S,e.downColor||"neutralStrong",l)}),[S,e.downColor,l]),ii=(M,A)=>{let E=A-u;return ot[E>=0?"u":"d"][We(Math.ceil(Math.abs(E)/c[d?M:0])-1,0,l-1)]},ai=(0,U.useMemo)(()=>Hn.map((M,A)=>(0,V.jsxs)("g",{clipPath:`url(#${O}c${A})`,children:[(0,V.jsx)("rect",{x:Q(K),y:Q(T+A*(v+Ne)),width:Q(ne-K),height:Q(v),fill:S.paint("lift")}),["u","d"].map(E=>{let j=M[E],J=`${O}${E}${A}`;return j?(0,V.jsxs)("g",{children:[(0,V.jsx)("g",{fill:ot[E][0],children:(0,V.jsx)("path",{id:J,d:j})}),ot[E].slice(1).map((H,he)=>(0,V.jsx)("use",{href:`#${J}`,y:Q((he+1)*v),fill:H},he))]},E):null})]},A)),[Hn,O,K,ne,T,v,S,ot]),jn=(0,U.useMemo)(()=>Me(e.highlight,L,L,m.map(M=>M.last),"none"),[e.highlight,L,m]),Gn=Math.min(y.motion.stagger??30,600/Math.max(1,i)),si=(0,U.useMemo)(()=>L.map((M,A)=>({key:`r:${M}`,to:[1],from:[0],delay:A*Gn,data:A})),[L,Gn]),li=Ao(si,y.motion),ci=new Map(li.items.filter(M=>!M.exiting).map(M=>[M.data,M.v[0]])),ui=(0,U.useMemo)(()=>L.map((M,A)=>{let E=m[A],j=Number.isFinite(E.last);return{datum:E.lastK>=0?o.rows[A][E.lastK]:null,index:A,key:L[A],label:L[A]||y.t.value,value:j?E.last:null,formatted:j?n.item(g(E.last),g(E.min),g(E.max)):g(NaN)}}),[L,m,o,n,g,y.t.value]),ue=y.active!==null&&y.active<i&&P!==null?{s:y.active,k:P,v:o.values[y.active][P]}:null,mi=ue&&{x:Te[ue.k],y:x(ue.s),title:o.labels[ue.k],rows:[{label:ee(ue.s),value:g(ue.v),color:Number.isFinite(ue.v)?ii(ue.s,ue.v):void 0}]},di=y.via==="keyboard"&&ue?n.at(ee(ue.s),o.labels[ue.k],g(ue.v)):void 0,qt=m.map((M,A)=>({s:A,v:M.last})).filter(M=>Number.isFinite(M.v)),Wn=`${n.kind}. ${n.desc(i,a,l,d?null:g(c[0]))}`;if(qt.length>1){let M=qt.reduce((E,j)=>j.v>E.v?j:E),A=qt.reduce((E,j)=>j.v<E.v?j:E);Wn+=n.ends(ee(M.s),g(M.v),ee(A.s),g(A.v))}let fi=w?(0,V.jsx)("g",{"aria-hidden":"true",children:k.map((M,A)=>{let{x:E,line:j,sx:J}=_.at[A],H=j*Io+9;return(0,V.jsxs)("g",{children:[M.pre?(0,V.jsx)(_e,{x:E,y:H,size:se,fill:S.paint("muted"),children:M.pre}):null,M.bands.map((he,xt)=>(0,V.jsx)("rect",{x:J+xt*(Jt+2),y:H-6,width:Jt,height:12,rx:2,fill:ot[M.tone][he]},he)),(0,V.jsx)(_e,{x:J+M.bands.length*(Jt+2)+2,y:H,size:se,fill:S.paint("muted"),children:M.text})]},A)})}):null;return(0,V.jsxs)(kn,{c:y,kind:n.kind,ariaLabel:e.ariaLabel,description:e.description??Wn,events:ui,tip:mi,renderTip:e.tooltip,className:e.className,style:e.style,theme:e.theme,announce:di,onPointerMove:(M,A,E)=>{if(!i||!a)return;let j=We(Math.floor((A-T+Ne/2)/(v+Ne)),0,i-1),J=Wr(Te,M);J!==I&&B(J),j!==y.active&&y.setActive(j,E.pointerType==="touch"?"touch":"pointer")},onKey:M=>!i||!a?!1:M.key==="ArrowLeft"||M.key==="ArrowRight"?(B(We((P??a-1)+(M.key==="ArrowRight"?1:-1),0,a-1)),y.setActive(y.active??0,"keyboard"),!0):M.key==="Escape"&&P!==null?(B(null),y.setActive(null,"keyboard"),!0):!1,defs:i?L.map((M,A)=>(0,V.jsx)("clipPath",{id:`${O}c${A}`,children:(0,V.jsx)("rect",{x:Q(K),y:Q(x(A)),width:Q((ne-K)*(ci.get(A)??1)),height:Q(v)})},A)):void 0,children:[fi,ai,y.active!==null&&y.active<i?(0,V.jsx)("rect",{x:Q(K-1.5),y:Q(x(y.active)-1.5),width:Q(ne-K+3),height:Q(v+3),rx:3,fill:"none",stroke:S.paint("ink"),pointerEvents:"none"}):null,L.map((M,A)=>{let E=jn.has(A)||y.active===A,j=x(A)+v/2,J=E?700:500,H=S.paint(jn.size&&!E?"muted":"ink");return(0,V.jsxs)("g",{pointerEvents:"none",children:[(0,V.jsx)(_e,{x:0,y:j,size:D,weight:J,fill:H,children:Ht(ee(A),W-8,D,J)}),Re?(0,V.jsx)(_e,{x:b,y:j,anchor:"end",size:D,weight:E?700:600,fill:H,children:g(P!==null?o.values[A][P]:m[A].last)}):null]},A)}),P!==null?(0,V.jsx)("g",{className:"ztd-guide","aria-hidden":"true",pointerEvents:"none",style:{transform:`translate(${Q(Te[P])}px,0px)`},children:(0,V.jsx)("line",{x1:0,x2:0,y1:T-2,y2:C+2,stroke:S.paint("ink")})}):null,i?(0,V.jsx)(Fo,{c:y,model:o,xs:Xe,x0:K,x1:ne,y:C+13}):null,P!==null?(0,V.jsx)(An,{p:S,x:Te[P],y:C+13,label:o.labels[P],width:b}):null]})}var Ps=N(Y(),1);var Ko=N(z(),1),Ds={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${Se(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},Ls={en:Ds,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},jo=(e,t)=>Ls[e].other(t);function Go(e,t,n){if(typeof t!="number"||!(t>=1)||e.length<=t+1)return{kept:e,other:null};let r=new Set(e.map((i,a)=>({v:i.value,i:a})).sort((i,a)=>a.v-i.v).slice(0,Math.floor(t)).map(i=>i.i)),o=e.filter((i,a)=>!r.has(a));return{kept:e.filter((i,a)=>r.has(a)),other:n(o.length,Gr(o.map(i=>i.value)))}}var Wo=e=>Number.isFinite(e)&&e>0?e:0;function Vo(e,t,n,r){return r==="emphasis"?dr(e,t,n):ye(e,t,n)}var Es=N(Y(),1);var Jo=N(z(),1);function Xo(e,t){return t===!1?e.map((n,r)=>r):jr(e)}function Uo(e,t,n){let r=n.map(o=>o.reduce((i,a)=>i+(Number.isFinite(a)?a:0),0));return Me(e,t,t,r,"max")}function Yo(e,t,n){let r=new Array(t.length),o=t.filter(i=>!n.has(i));for(let i of t)n.has(i)&&(r[i]=te(e,"accent"));return o.forEach((i,a)=>r[i]=o.length===1?te(e,"neutral"):Tt(e,1-a/Math.max(1,o.length-1))),r}function qo(e){return!e||typeof e!="object"||Array.isArray(e)?[]:we(Object.values(e).filter(t=>typeof t=="string"&&t!==""))}function Zo(e,t){return lt(e,t+1,new Set)}var Os=N(Y(),1);var ei=N(z(),1);var Is=26;var Ou=Is*.62;function Qo(e,t){let n=typeof e=="string"?[e]:Array.isArray(e)?e:[],r=new Set;for(let o of n)typeof o=="string"&&!lo.includes(o)&&t.forEach((i,a)=>i===o&&r.add(a));return r}var De=N(z(),1);function ti(e,t,n){let r=Ot(e);return r?.type==="scatter"&&t?.size!==void 0&&!Et(n)?Ot("bubble"):r}function zs(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 Bs(e,t,n,r=!1){let o=ti(e.type,e.encoding,e.options);if(!o||!t.length)return[];let i=e.encoding??{},a=e.options??{},s=a.highlight,l=new Set(!r&&wn.includes(o.type)&&Array.isArray(a.hidden)?a.hidden.map(String):[]),u=c=>c.filter(m=>!l.has(m.label)),d=["pie","donut","waffle"];if(o.type==="donut"&&a.legend!=="none")return[];if(d.includes(o.type)){let c=Pe(i.label,"label"),m=It(i.value,"value"),h=o.type==="waffle",f=t.map((b,F)=>({r:b,label:c(b,F),value:h?m(b,F):Wo(m(b,F))})),{kept:g,other:w}=h?{kept:f,other:null}:Go(f,a.other,(b,F)=>({r:{},label:jo(X(n),b),value:F})),k=Me(s,g.map(b=>b.r),g.map(b=>b.label),g.map(b=>b.value),h?"first":"max"),$=w?[...g,w]:g,y=Ie(b=>h?ye(b,$.length,k):Vo(b,$.length,k,a.colorMode)),S=h&&a.shape==="arc";return $.map((b,F)=>({label:b.label,color:y[F],...S&&{shape:"circle"}}))}if(o.type==="candlestick"){let c=Eo(Array.isArray(a.ma)?a.ma:void 0,t.length),m=Lo[X(n)];return[{label:m.up,color:a.upColor??"accent"},{label:m.down,color:a.downColor??"neutralStrong"},...c.map((h,f)=>({label:m.maLegend(h),color:On[f],shape:"line"}))]}if(o.type==="network"){let c=qo(a.groups);if(c.length<2)return[];let m=Ie(h=>Zo(h,c.length));return c.map((h,f)=>({label:h,color:m[f],shape:"circle"}))}if(o.type==="symbolMap"){if(typeof i.group!="string")return[];let c=Pe(i.group,"group"),m=we(t.map((f,g)=>c(f,g)).filter(Boolean));if(m.length<2)return[];let h=Ie(f=>lt(f,m.length,new Set));return m.map((f,g)=>({label:f,color:h[g],shape:"circle"}))}if(o.type==="scatter"){if(typeof i.series!="string"||Et(a))return[];let c=Pe(i.series,"series"),m=we(t.map((g,w)=>c(g,w)));if(m.length<2)return[];let h=Do(s,t,m,c),f=Ie(g=>lt(g,m.length,h));return u(m.map((g,w)=>({label:g,color:f[w],shape:"circle"})))}if(o.type==="timeline"){let c=typeof i.group!="string",m=c?i.status:i.group;if(typeof m!="string")return[];let h=wo(t,m,c),f=Ie(g=>ye(g,h.length,Qo(s,h)));return u(h.map((g,w)=>({label:g,color:f[w],shape:"square"})))}if(["marimekko","area","bar","line","stream","radar"].includes(o.type)){let c=[];if(Array.isArray(i.y))c=i.y;else if(typeof i.series=="string"){let y=Pe(i.series,"series");c=we(t.map((S,b)=>y(S,b)))}let m=vn(o.type,i,a);if(m.length){let y=Me(s,c,c,c.map(()=>0),"none"),S=Ie(F=>ye(F,c.length,y)),b=c.length<2?[{label:String((Array.isArray(i.y)?i.y[0]:i.y)??"y"),color:"neutral"}]:c.map((F,O)=>({label:F,color:S[O]}));return[...u(b),...m.map((F,O)=>({label:F,color:Po(O),shape:"line"}))]}if(c.length<2)return[];let f=o.type==="bar"&&a.layout==="diverging"&&s===void 0?Hr(c.length,Array.isArray(a.negative)?a.negative.map(y=>c.indexOf(String(y))):[],typeof a.neutral=="string"?c.indexOf(a.neutral):-1):-1,g=f>=0?new Set([f]):Me(s,c,c,c.map(()=>0),"first");if(o.type==="radar")return u(c.map((y,S)=>({label:y,color:g.has(S)?"accent":"neutralStrong",shape:"square"})));let w=a.colorMode,k=y=>ye(y,c.length,g);if((o.type==="line"||o.type==="area")&&(k=y=>_o(y,c.length,g,o.type==="area",w)),o.type==="stream"){let y=Ke(t,i.x,i.y,i.series,{xType:a.xType,locale:n,aggregate:a.aggregate,dayFirst:a.dayFirst}),S=Xo(y.values,a.reorder),b=Uo(s,y.series,y.values);k=F=>Yo(F,S,b)}let $=Ie(k);return u(c.map((y,S)=>({label:y,color:$[S],...o.type==="line"&&{shape:"line"}})))}return[]}function Hs(e,t){let n=e.facet;return n&&typeof n=="object"&&typeof n.by=="string"&&_r.includes(t)&&!(t==="bar"&&e.options?.layout==="diverging")?n:void 0}function js(e,t,n){let{data:r,width:o,height:i,highlight:a,syncId:s,ariaLabel:l,description:u,...d}=n;return{type:e,data:r??[],by:t.by,columns:t.columns,scale:t.scale,chartProps:d,width:o,height:i,highlight:a,syncId:s,title:l,description:u}}function ni(e,t){let{spec:n}=e,r=ti(n.type,n.encoding,n.options),o=(0,yt.useMemo)(()=>vo(n.data),[n.data]),i=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,a=Fr(n,e.locale),s=ie(a),l=X(s),u=co(i?.url??null,{parse:i?.format??"auto",select:i?.select,init:e.fetchInit,locale:s}),d=Lr(n),c=(0,yt.useMemo)(()=>d?bo(d,s):void 0,[d,s]),m=n.options?.hidden,h=Array.isArray(m)?m.map(String):[],f=h.join(""),[g,w]=(0,yt.useState)(null);if(!r)return(0,De.jsx)(xn,{error:l==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:a});let k=o??u.data,$=t[r.type],y={...n.options??{}},S={...zs(r,n.encoding),...y,...c?{tooltip:c}:{},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:a},b=n.card?.legend==="toggle"&&Dr(r.type,n.encoding??{},y),F=g&&g.base===f?g.hidden:h;b&&(S.hidden=F);let O=T=>w(v=>{let x=v&&v.base===f?v.hidden:h;return{base:f,hidden:x.includes(T)?x.filter(C=>C!==T):[...x,T]}}),I=S.height??220,B=Hs(n,r.type),P=i&&!k.length&&(u.loading||u.error||u.empty)?(0,De.jsx)(xn,{loading:u.loading,error:u.error,empty:u.empty,onRetry:u.reload,height:I,locale:a}):B?(0,De.jsx)(so,{chart:$,...js(r.type,B,S)}):(0,De.jsx)($,{...S});if(n.card){let T=n.card,v=T.legend==="auto"||T.legend==="toggle"?Bs(n,k,s,b):T.legend,x=v?.length?b?(0,De.jsx)(yn,{items:v,hidden:F,onToggle:O,locale:a}):v:void 0,C=T.download?(0,De.jsx)(po,{data:k,columns:Er(n),filename:T.title??r.type,formats:Array.isArray(T.download)?T.download:void 0,locale:a}):void 0;P=(0,De.jsx)(Sr,{number:T.number,title:T.title??Rr(r,l),subtitle:T.subtitle,legend:x,actions:C,source:T.source||void 0,note:T.note||void 0,accent:T.accent,takeaway:T.takeaway,level:T.level,sample:T.sample,replay:T.replay!==!1,className:e.className,locale:a,children:P})}let _=e.theme??n.theme;return _&&(P=(0,De.jsx)(Ft,{theme:_,children:P})),P}function Gs({cfg:e,components:t}){let n=tt();return ni({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function oi(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,ri.hydrateRoot)(r,(0,Bn.createElement)(Ft,{theme:o.theme,cssVars:!0},(0,Bn.createElement)(Gs,{cfg:o,components:{[e]:t}})))}oi("horizon",zn);})();
|