ztd-charts-cli 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.js +1 -1
- package/dist/{chunk-QVGOP3IE.js → chunk-ZZGASY2Y.js} +1 -1
- package/dist/cli.js +1 -1
- package/dist/client/area.js +6 -6
- package/dist/client/bar.js +5 -5
- package/dist/client/barRace.js +2 -2
- package/dist/client/beeswarm.js +2 -2
- package/dist/client/box.js +6 -6
- package/dist/client/bubble.js +6 -6
- package/dist/client/bullet.js +5 -5
- package/dist/client/bump.js +6 -6
- package/dist/client/calendar.js +5 -5
- package/dist/client/candlestick.js +4 -4
- package/dist/client/chord.js +5 -5
- package/dist/client/choropleth.js +5 -5
- package/dist/client/donut.js +6 -6
- package/dist/client/dumbbell.js +2 -2
- package/dist/client/flowMap.js +4 -4
- package/dist/client/funnel.js +2 -2
- package/dist/client/gauge.js +2 -2
- package/dist/client/heatmap.js +5 -5
- package/dist/client/histogram.js +5 -5
- package/dist/client/line.js +6 -6
- package/dist/client/lollipop.js +5 -5
- package/dist/client/marimekko.js +6 -6
- package/dist/client/network.js +5 -5
- package/dist/client/parallel.js +6 -6
- package/dist/client/pareto.js +5 -5
- package/dist/client/pie.js +6 -6
- package/dist/client/radar.js +6 -6
- package/dist/client/radialBar.js +2 -2
- package/dist/client/ridgeline.js +4 -4
- package/dist/client/sankey.js +4 -4
- package/dist/client/scatter.js +6 -6
- package/dist/client/segmented.js +2 -2
- package/dist/client/skyline.js +2 -2
- package/dist/client/slope.js +5 -5
- package/dist/client/sparkline.js +6 -6
- package/dist/client/stream.js +6 -6
- package/dist/client/sunburst.js +2 -2
- package/dist/client/symbolMap.js +5 -5
- package/dist/client/tileMap.js +6 -6
- package/dist/client/timeline.js +10 -10
- package/dist/client/tree.js +5 -5
- package/dist/client/treemap.js +2 -2
- package/dist/client/waffle.js +5 -5
- package/dist/client/waterfall.js +5 -5
- package/package.json +2 -2
package/dist/client/tree.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(()=>{var Fi=Object.create;var or=Object.defineProperty;var _i=Object.getOwnPropertyDescriptor;var Pi=Object.getOwnPropertyNames;var Li=Object.getPrototypeOf,Di=Object.prototype.hasOwnProperty;var on=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var Ei=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Pi(t))!Di.call(e,o)&&o!==n&&or(e,o,{get:()=>t[o],enumerable:!(r=_i(t,o))||r.enumerable});return e};var F=(e,t,n)=>(n=e!=null?Fi(Li(e)):{},Ei(t||!e||!e.__esModule?or(n,"default",{value:e,enumerable:!0}):n,e));var re=on((
|
|
1
|
+
(()=>{var Fi=Object.create;var or=Object.defineProperty;var _i=Object.getOwnPropertyDescriptor;var Pi=Object.getOwnPropertyNames;var Li=Object.getPrototypeOf,Di=Object.prototype.hasOwnProperty;var on=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var Ei=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Pi(t))!Di.call(e,o)&&o!==n&&or(e,o,{get:()=>t[o],enumerable:!(r=_i(t,o))||r.enumerable});return e};var F=(e,t,n)=>(n=e!=null?Fi(Li(e)):{},Ei(t||!e||!e.__esModule?or(n,"default",{value:e,enumerable:!0}):n,e));var re=on((al,ir)=>{ir.exports=globalThis.__ztdReact.react});var sr=on((sl,ar)=>{ar.exports=globalThis.__ztdReact["react-dom/client"]});var Y=on((wl,Er)=>{Er.exports=globalThis.__ztdReact["react/jsx-runtime"]});var Un=F(re(),1),xi=F(sr(),1);var vt=F(re(),1);var zt=F(re(),1);var lr=F(re(),1),tt=(0,lr.createContext)(void 0);var dr=F(re(),1);var Oi=["bg","panel","ink","muted","dim","accent","accentText","onAccent","accent2","accent3","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"],cr='"Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, -apple-system, sans-serif',ur='"Roboto Mono", "Share Tech Mono", ui-monospace, SFMono-Regular, Menlo, monospace',Ge={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:cr,monoFamily:ur,radius:18,radiusCode:14,radiusMark:4},an={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:cr,monoFamily:ur,radius:18,radiusCode:14,radiusMark:4},sn={dark:Ge,light:an};function Ct(e){return`--ztd-${e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}function ln(e){let t={};for(let n of Oi){let r=e[n];typeof r=="string"&&(t[Ct(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 cn(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 Ii=`
|
|
2
2
|
.ztd-root{position:relative;-webkit-tap-highlight-color:transparent}
|
|
3
3
|
.ztd-root:focus{outline:none}
|
|
4
4
|
.ztd-root:focus-visible{outline:2px solid var(--ztd-accent,${Ge.accent});outline-offset:3px;border-radius:6px}
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
@keyframes ztd-pulse{0%,100%{opacity:.55}50%{opacity:1}}
|
|
20
20
|
.ztd-skeleton{animation:ztd-pulse 1.4s ease-in-out infinite}
|
|
21
21
|
@media (prefers-reduced-motion: reduce){.ztd-skeleton{animation:none}}
|
|
22
|
-
`;function fr(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 hr(e,t){let[n]=(0,dr.useState)(!e.motion.enabled);return e.motion.enabled&&e.hydrated&&(!n||t.waiting||t.generation>0)}var mr=!1;function dt(){if(mr||typeof document>"u"||(mr=!0,document.getElementById("ztd-base")))return;let e=document.createElement("style");e.id="ztd-base",e.textContent=Ii,document.head.appendChild(e)}var At=F(re(),1),Ae=typeof window<"u"&&typeof document<"u",Ee=Ae?At.useLayoutEffect:At.useEffect;function Nt(){return typeof performance<"u"?performance.now():Date.now()}function ie(e){return e!==void 0&&/^ko([-_]|$)/i.test(e)?"ko":"en"}function Ne(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}var gr={chart:"chart",table:e=>`${e} data`,more:e=>`and ${e} more`,value:"Value",empty:"No data."},pr={chart:"차트",table:e=>`${e} 데이터`,more:e=>`외 ${e}개`,value:"값",empty:"데이터가 없어요."};var zi=[{id:"basic",en:"Basic",ko:"기본"},{id:"intermediate",en:"Intermediate",ko:"중급"},{id:"advanced",en:"Advanced",ko:"심화"}],Bi={basic:{bg:"line2",fg:"ink"},intermediate:{bg:"tint",fg:"accentText"},advanced:{bg:"ink",fg:"onInk"}};function Hi(e,t){let n=t.trim().toLowerCase();return e.find(r=>r.id===n||r.en.toLowerCase()===n||r.ko===t.trim())}function ji(e){return Hi(zi,e)}function br(e,t){let n=ji(e);return{text:n?n[t]:e,...Bi[n?.id??"basic"]}}var yr={white:"#ffffff",black:"#000000",transparent:"#00000000"};function nt(e){if(!e)return null;let t=e.trim(),n=/^var\(\s*--[\w-]+\s*,\s*(.+)\)$/i.exec(t);if(n&&(t=n[1].trim()),yr[t.toLowerCase()]&&(t=yr[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 wr(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 mn(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 rt(e){let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function xr(e){return .2126*rt(e[0])+.7152*rt(e[1])+.0722*rt(e[2])}function dn(e,t,n){let r=typeof e=="string"?nt(e):e,o=typeof t=="string"?nt(t):t;if(!r||!o)return 0;let i=n?typeof n=="string"?nt(n):n:null;o[3]<1&&i&&(o=mn(o,i));let a=r[3]<1?mn(r,o):r,s=xr(a),l=xr(o);return(Math.max(s,l)+.05)/(Math.min(s,l)+.05)}function Gi(e){return[rt(e[0]),rt(e[1]),rt(e[2])]}function un(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 kr(e){let[t,n,r]=Gi(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 Wi([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[un(4.0767416621*o-3.3077115913*i+.2309699292*a),un(-1.2684380046*o+2.6097574011*i-.3413193965*a),un(-.0041960863*o-.7034186147*i+1.707614701*a),r]}function Rt(e,t,n){let r=nt(e),o=nt(t);if(!r||!o)return e;let i=kr(r),a=kr(o),s=Math.max(0,Math.min(1,n));return wr(Wi([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 fn(e,t,n){let r=t[0],o=-1;for(let i of t){let a=dn(i,e,n);a>o&&(o=a,r=i)}return r}function me(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 Ki(e,t){let n=fn(t,[e.theme.ink,e.theme.onAccent,e.theme.onNeutralStrong]);return dn(n,t)>=4.5?n===e.theme.ink?e.paint("ink"):n===e.theme.onAccent?e.paint("onAccent"):e.paint("onNeutralStrong"):fn(t,["#FFFFFF","#000000"])}function Ft(e,t){let n=Rt(e.theme.neutralStrong,e.theme.neutral,t);return{role:"mix",fill:e.mix("neutralStrong","neutral",t),text:Ki(e,n),raw:n}}function Re(e,t,n){let r=new Array(t),o=[];for(let a=0;a<t;a++)n.has(a)?r[a]=me(e,"accent"):o.push(a);let i=o.length;return o.forEach((a,s)=>{if(i===1)r[a]=me(e,"neutral");else if(s===0)r[a]=me(e,"ink");else if(s===i-1)r[a]=me(e,"neutral");else if(i===3)r[a]=me(e,"strong");else{let l=(s-1)/Math.max(1,i-2);r[a]=l<=.001?me(e,"strong"):Ft(e,1-l)}}),r}var hn="mix:";function We(e){return e({theme:an,cssVars:!1,paint:n=>n,color:n=>n??"neutral",raw:n=>n??"neutral",mix:(n,r,o)=>`${hn}${o}`}).map(n=>n.fill)}function vr(e,t){return t?.startsWith(hn)?e.mix("neutralStrong","neutral",Number(t.slice(hn.length))):e.color(t)}function ft(e,t,n){return Re(e,t+1,n).slice(0,t)}function $r(e,t,n,r="neutral"){let o=me(e,"accent"),i=me(e,r);return Array.from({length:t},(a,s)=>n.has(s)?o:i)}function Tr(e,t,n){let r=new Array(t),o=[];for(let a=0;a<t;a++)n.has(a)?r[a]=me(e,"accent"):o.push(a);let i=o.length;return o.forEach((a,s)=>{i===1?r[a]=me(e,"neutral"):s===0?r[a]=me(e,"strong"):s===i-1?r[a]=me(e,"neutral"):r[a]=Ft(e,1-s/(i-1))}),r}var Fe=F(re(),1);var Pt=(e,t="")=>n=>Number.isFinite(n)?`${e(n)}${t}`:e(n),ye="en-US",Mr=new Map;function gn(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=Mr.get(r);return o||(o=new Intl.NumberFormat(e,n),Mr.set(r,o)),o}function pn(e){return/^[-\u2212]/.test(e)&&!/[1-9]/.test(e)?e.slice(1):e}function ot(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=ye,...r}=t;return pn(gn(n,r).format(e))}var bn=e=>e!==0&&Math.abs(e)<.05,yn=(e,t,n="")=>`${ot(e,{locale:t,maximumSignificantDigits:2,maximumFractionDigits:20})}${n}`;function _t(e,t={}){if(!Number.isFinite(e))return"-";if(bn(e)&&t.maximumFractionDigits===void 0)return yn(e,t.locale??ye,"%");let n=Math.abs(e);return`${ot(e,{maximumFractionDigits:n>0&&n<1?1:0,...t})}%`}function Nr(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=ye,...r}=t;if(ie(n)==="ko"){let o=Math.abs(e),i=[[1e12,"조"],[1e8,"억"],[1e4,"만"],[1,""]],a=i.findIndex(([s])=>o>=s);for(a<0&&(a=i.length-1);;){let[s,l]=i[a],c=o/s,m=Math.max(r.minimumFractionDigits??0,r.maximumFractionDigits??(s===1||c<100?1:0)),u=Math.round(c*10**m)/10**m;if(a>0&&u>=i[a-1][0]/s){a--;continue}return(e<0&&u!==0?"-":"")+ot(u,{locale:n,...r,maximumFractionDigits:m})+l}}return pn(gn(n,{notation:"compact",...r}).format(e))}var Vi=(e,t=ie(e)==="ko"?"KRW":"USD")=>({style:"currency",currency:t,maximumFractionDigits:t==="KRW"?0:2});function Je(e,t=ye,n){if(typeof e=="function")return e;let r=(o,i="",a="")=>{let s=gn(t,o);return l=>Number.isFinite(l)?`${a}${pn(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=>_t(o,{locale:t});case"ratio":return o=>_t(o*100,{locale:t});case"compact":return o=>Nr(o,{locale:t});case"currency":return r(Vi(t));default:{let o=r({maximumFractionDigits:1});return i=>bn(i)?yn(i,t):o(i)}}}function Rr(e,t=ye,n=0){return e!==void 0?Je(e,t):n>=1e5?r=>bn(r)?yn(r,t):Nr(r,{locale:t}):r=>ot(r,{locale:t})}function Ui(e,t,n=1){let r=new Date(+e,+t-1,+n);return r.getMonth()===+t-1&&r.getDate()===+n?r:null}var xn=e=>Number.isInteger(e)&&e>=1e3&&e<=9999,Xi=/^\d{4}-\d{1,2}(-\d{1,2})?([T ][\d:.]+(Z|[+-]\d{2}:?\d{2})?)?$/,Yi=["january","february","march","april","may","june","july","august","september","october","november","december"],Cr=e=>{let t=e.toLowerCase();return t.length<3?0:Yi.findIndex(n=>n.startsWith(t))+1},Sr=e=>+e+(+e<30?2e3:1900);function Fr(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}var Ji=[/^(\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})일)?$/],_r=/^(\d{1,2})([./-])(\d{1,2})\2(\d{4})$/,Pr=/\{([^{}]+)\}/g;function Lt(e,t){let n;for(let r of Ji)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?[Sr(n[3]),+n[2],+n[1],1]:[Sr(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=_r.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=Cr(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=Cr(n[1]);return r?[+n[3],r,+(n[2]??1),n[2]?1:2]:null}return null}var Lr=e=>Xi.test(e)||Lt(e)!==null;function Dr(e){let t;for(let n of e){let r=typeof n=="string"?_r.exec(n.trim()):null;if(r){if(+r[1]>12)return!0;+r[3]>12&&(t=!1)}}return t}function Dt(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(xn(e))return new Date(e,0,1);if(e>=19000101&&e<=21001231)return Dt(`${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=Lt(n,t);if(r)return Ui(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 Ar=new Map;function ht(e,t={month:"short",day:"numeric"}){let n=Dt(e);if(!n)return"-";let{locale:r=ye,...o}=t,i=r+JSON.stringify(o),a=Ar.get(i);return a||(a=new Intl.DateTimeFormat(r,o),Ar.set(i,a)),a.format(n)}var kn=F(Y(),1),Et=(0,Fe.createContext)({theme:Ge,cssVars:!0});function Zi(e,t=Ge){return e?typeof e=="string"?sn[e]??t:cn(t,e):t}function Ot(e){let t=(0,Fe.useContext)(Et),n=e.base?sn[e.base]:t.theme,r=(0,Fe.useMemo)(()=>Zi(e.theme,n),[e.theme,n]),o=e.cssVars??t.cssVars,i=e.locale??t.locale,a=(0,Fe.useMemo)(()=>({theme:r,cssVars:o,locale:i}),[r,o,i]),s=(0,Fe.useMemo)(()=>ln(r),[r]),l=e.paint?{background:r.bg,color:r.ink,fontFamily:r.fontFamily,...s,...e.style}:{display:"contents",...s,...e.style};return(0,kn.jsx)(Et.Provider,{value:a,children:(0,kn.jsx)("div",{className:e.className,"data-ztd-theme":r.name,lang:e.locale,style:l,children:e.children})})}var Qi=new Set(["bg","panel","ink","muted","dim","accent","accentText","onAccent","accent2","accent3","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"]);function Or(e){return Qi.has(e)}function qi(e,t){let n=r=>t?`var(${St(r)}, ${e[r]})`:e[r];return{theme:e,cssVars:t,paint:n,color:(r,o="neutral")=>r?Or(r)?n(r):r:n(o),raw:(r,o="neutral")=>r?Or(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)})`:Rt(e[r],e[o],i)}}}function _e(e){let t=(0,Fe.useContext)(Et);return(0,Fe.useMemo)(()=>{let n=cn(t.theme,e);return qi(n,t.cssVars)},[t.theme,t.cssVars,e])}function we(e){let t=(0,Fe.useContext)(Et);return e??t.locale??ye}function Ir(e){return e?ln(e):{}}var It=F(re(),1),wn=(0,It.createContext)(void 0);function zr(e){let t=(0,It.useContext)(wn);return e!==void 0&&t!==void 0?`${e}:${t}`:e??t}var _=F(Y(),1),ea={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`},ta={en:ea,ko:{legend:"범례",replay:"애니메이션 다시 재생",replayTitle:"다시 재생",sample:"예시 데이터",loadError:"데이터를 불러오지 못했어요",retry:"다시 시도",loading:"불러오는 중",empty:"표시할 데이터가 없어요",source:"출처",shown:(e,t)=>`${t}개 중 ${e}개 보임`}};var na={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},vn=e=>ta[ie(we(e))];function $n(e){let t=_e(e.theme),n=vn(e.locale),[r,o]=(0,zt.useState)(!1),i=e.size??11.5,a=e.onToggle,s=new Set(a?e.hidden:void 0),l=e.items.filter(m=>!s.has(m.label)).length,c=(0,_.jsx)("ul",{"aria-label":n.legend,style:{display:"flex",flexWrap:"wrap",justifyContent:e.align==="start"?"flex-start":"flex-end",gap:"4px 12px",margin:0,padding:0,listStyle:"none"},children:e.items.map((m,u)=>{let g=!s.has(m.label),f=g&&l===1,h=(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(ra,{p:t,item:m,off:!g}),(0,_.jsx)("span",{style:g?void 0:{textDecoration:"line-through"},children:m.label})]});return(0,_.jsx)("li",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:i,color:t.paint("muted"),lineHeight:1.3},children:a?(0,_.jsx)("button",{type:"button",className:"ztd-btn","aria-pressed":g,"aria-disabled":f||void 0,onClick:()=>{f||(a(m.label),o(!0))},style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:24,minWidth:24,padding:"0 2px",margin:0,border:0,borderRadius:4,background:"transparent",color:"inherit",fontSize:"inherit",lineHeight:"inherit",cursor:f?"default":void 0},children:h}):h},u)})});return a?(0,_.jsxs)(_.Fragment,{children:[c,(0,_.jsx)("span",{"aria-live":"polite","aria-atomic":"true",style:na,children:r?n.shown(l,e.items.length):""})]}):c}function ra({p:e,item:t,off:n}){let r=vr(e,t.color),o=t.shape??"square";return o==="line"||o==="dash"?(0,_.jsxs)("svg",{width:14,height:8,"aria-hidden":"true",style:{flex:"none",opacity:n?.35:void 0},children:[(0,_.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,_.jsx)("circle",{cx:7,cy:4,r:2.2,fill:r}):null]}):(0,_.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 oa(e){let t=_e(e.theme),n=br(e.level,ie(we(e.locale)));return(0,_.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 ia(e,t,n){if(typeof e!="string"||!t)return e;let r=e.indexOf(t);return r<0?e:(0,_.jsxs)(_.Fragment,{children:[e.slice(0,r),(0,_.jsx)("span",{style:{color:n},children:t}),e.slice(r+t.length)]})}function Br(e){let t=_e(e.theme),n=vn(e.locale),[r,o]=(0,zt.useState)(0);Ee(()=>dt(),[]);let i=()=>{o(g=>g+1),e.onReplay?.()},a=Array.isArray(e.legend)?(0,_.jsx)($n,{items:e.legend,theme:e.theme,locale:e.locale}):e.legend,s=e.as??"h3",l=e.number===void 0?null:typeof e.number=="number"?String(e.number).padStart(2,"0"):e.number,c=e.replay||e.onReplay,m=e.source!==void 0||e.note!==void 0?(0,_.jsxs)("p",{style:{margin:0,fontSize:12,color:t.paint("muted"),lineHeight:1.4},children:[e.source!==void 0?`${n.source}: `:null,e.source,e.source!==void 0&&e.note!==void 0?" · ":null,e.note]}):null,u=e.takeaway!==void 0||e.level||e.sample?(0,_.jsxs)("footer",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,marginTop:2},children:[(0,_.jsx)("span",{style:{fontSize:17,fontWeight:800,color:t.paint("ink"),letterSpacing:-.3,lineHeight:1.3,minWidth:0},children:e.takeaway}),(0,_.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:8,flex:"none"},children:[e.sample?(0,_.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,_.jsx)(oa,{level:e.level,theme:e.theme,locale:e.locale}):null]})]}):null;return(0,_.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,_.jsxs)("header",{style:{display:"flex",flexDirection:"column",gap:6,minWidth:0},children:[(0,_.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0},children:[l?(0,_.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,_.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:ia(e.title,e.accent,t.paint("accentText"))}),e.actions,c?(0,_.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,_.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,_.jsx)("path",{d:"M3 12a9 9 0 1 0 3-6.7"}),(0,_.jsx)("path",{d:"M3 3v6h6"})]})}):null]}),e.subtitle!==void 0||a?(0,_.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"4px 12px",flexWrap:"wrap",minHeight:18},children:[e.subtitle!==void 0?(0,_.jsx)("span",{style:{fontSize:12.5,color:t.paint("muted"),lineHeight:1.4},children:e.subtitle}):(0,_.jsx)("span",{}),a]}):null]}),(0,_.jsx)("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",minHeight:0,minWidth:0},children:(0,_.jsx)(wn.Provider,{value:r,children:(0,_.jsx)(tt.Provider,{value:typeof e.title=="string"||typeof e.title=="number"?String(e.title):void 0,children:e.children})})}),m?(0,_.jsxs)(_.Fragment,{children:[m,u]}):u]})}function Tn(e){let t=_e(e.theme),n=vn(e.locale),r=e.height??220;if(Ee(()=>dt(),[]),e.error){let o=typeof e.error=="string"?e.error:e.error.message;return(0,_.jsx)("div",{role:"alert",style:{height:r,display:"grid",placeItems:"center",textAlign:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,_.jsxs)("div",{style:{display:"grid",gap:8,justifyItems:"center",padding:16},children:[(0,_.jsx)("span",{style:{fontSize:14,fontWeight:700,color:t.paint("ink")},children:n.loadError}),(0,_.jsx)("span",{style:{fontSize:12,color:t.paint("muted"),maxWidth:280,wordBreak:"break-word"},children:o}),e.onRetry?(0,_.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,_.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,_.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,_.jsx)("div",{style:{height:r,display:"grid",placeItems:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,_.jsx)("span",{style:{fontSize:13,color:t.paint("muted")},children:e.emptyText??n.empty})}):(0,_.jsx)(_.Fragment,{children:e.children})}var lt=F(re(),1);var ve=F(re(),1);var q=F(Y(),1),Bt=60;var Ht={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};function Hr(e){let{c:t,events:n}=e,r=(0,ve.useId)().replace(/:/g,""),o=`${r}t`,i=`${r}d`;t.events.current=n,Ee(()=>{dt()},[]);let a=n.length,s=!e.noNav&&a>0,l=(0,ve.useContext)(tt),c=e.ariaLabel??l??e.kind,m=(0,ve.useMemo)(()=>s?`${n.length}${n.slice(0,Bt).map(v=>`${v.label}${v.series??""}${v.formatted??v.value??""}`).join("")}`:"",[n,s]),u=(0,ve.useMemo)(()=>(0,q.jsx)(aa,{label:c,events:n,t:t.t}),[c,m,t.t]),g=(0,ve.useRef)(null);(0,ve.useEffect)(()=>{let v=()=>{g.current=null};return window.addEventListener("scroll",v,{capture:!0,passive:!0}),window.addEventListener("resize",v,{passive:!0}),()=>{window.removeEventListener("scroll",v,{capture:!0}),window.removeEventListener("resize",v)}},[]),(0,ve.useEffect)(()=>{g.current=null},[t.width,t.height]);let f=v=>{if(v.target!==v.currentTarget)return;if(e.onKey?.(v)){v.preventDefault();return}let N=t.active,G;switch(v.key){case"ArrowRight":case"ArrowDown":G=N===null?0:(N+1)%a;break;case"ArrowLeft":case"ArrowUp":G=N===null?a-1:(N-1+a)%a;break;case"Home":G=0;break;case"End":G=a-1;break;case"Escape":if(N===null)return;G=null;break;case"Enter":case" ":N!==null&&(v.preventDefault(),t.click(N));return;default:return}v.preventDefault(),t.setActive(G,"keyboard")},{via:h,node:p,setActive:C}=t;(0,ve.useEffect)(()=>{if(h!=="touch"||!p)return;let v=N=>{p.contains(N.target)||C(null)};return document.addEventListener("pointerdown",v),()=>document.removeEventListener("pointerdown",v)},[h,p,C]);let x=t.active!==null?n[t.active]:null,k=t.showTooltip&&e.renderTip!==!1&&!t.pending&&t.via!=="sync"?e.tip:null,w=k&&!t.responsive&&t.node&&t.width&&t.node.getBoundingClientRect().width/t.width||1,M=typeof e.renderTip=="function"&&x?e.renderTip(x):null,b=e.announce??(t.via==="keyboard"&&x?`${x.label}${x.series?` ${x.series}`:""}: ${x.formatted??x.value??""} (${(t.active??0)+1}/${a})`:""),P;if(k){let v=k.x*w,N=t.width*w,G=`clamp(${(4-v).toFixed(1)}px, -50%, calc(${(N-v-4).toFixed(1)}px - 100%))`,X=k.y<64;P={position:"absolute",left:v,top:k.y*w,transform:`translate(${G}, ${X?"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*w-8)}}let U=v=>{g.current=null,v.pointerType!=="touch"&&t.via!=="keyboard"&&t.setActive(null)},j=v=>v?N=>{let G=g.current??(g.current=N.currentTarget.getBoundingClientRect());G.width&&v((N.clientX-G.left)/G.width*t.width,(N.clientY-G.top)/G.height*t.height,N)}:void 0,R=j(e.onPointerMove),J=j(e.onPointerDown),O=R||J?v=>{v.pointerType==="touch"&&R?.(v),J?.(v)}:void 0,L=j(e.onPointerUp),A=Ir(e.theme);return(0,q.jsxs)("div",{ref:t.ref,className:`ztd-root${t.reduced?" ztd-still":""}${e.className?` ${e.className}`:""}`,role:"group","aria-roledescription":t.t.chart,"aria-label":c,"aria-describedby":i,tabIndex:s?0:void 0,onKeyDown:s?f:void 0,onBlur:v=>{t.via==="keyboard"&&!v.currentTarget.contains(v.relatedTarget)&&t.setActive(null)},onPointerLeave:U,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"),...A,...e.style},children:[t.pending?null:e.underlay,(0,q.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:R,onPointerDown:O,onPointerUp:L,onPointerCancel:L,style:{fontFamily:"inherit",touchAction:"pan-y",position:e.underlay?"relative":void 0},children:[(0,q.jsx)("title",{id:o,children:c}),(0,q.jsx)("desc",{id:i,children:a||t.description!==void 0?e.description:e.emptyText??t.t.empty}),e.defs&&!t.pending?(0,q.jsx)("defs",{children:e.defs}):null,t.pending?null:e.children]}),t.pending?null:e.overlay,k?(0,q.jsx)("div",{className:"ztd-tip","aria-hidden":"true",style:P,children:M??(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)("div",{style:{fontWeight:600,fontSize:11.5,color:t.p.paint("muted"),marginBottom:k.rows.length?4:0,overflow:"hidden",textOverflow:"ellipsis"},children:k.title}),k.rows.map((v,N)=>(0,q.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:16,justifyContent:"space-between"},children:[(0,q.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:7,color:t.p.paint(v.strong?"ink":"muted")},children:[v.color?(0,q.jsx)("span",{style:{width:8,height:8,borderRadius:999,background:v.color,display:"inline-block",boxShadow:"inset 0 0 0 1px rgba(127,127,127,0.3)"}}):null,v.label]}),(0,q.jsx)("span",{style:{fontWeight:v.strong===!1?500:700},children:v.value})]},N))]})}):null,(0,q.jsx)("span",{className:"ztd-sr",style:Ht,"aria-live":"polite","aria-atomic":"true",children:b}),s&&!t.pending?u:null]})}function aa({label:e,events:t,t:n}){return(0,q.jsx)("div",{className:"ztd-sr",style:Ht,children:(0,q.jsxs)("table",{children:[(0,q.jsx)("caption",{children:n.table(e)}),(0,q.jsxs)("tbody",{children:[t.slice(0,Bt).map((r,o)=>(0,q.jsxs)("tr",{children:[(0,q.jsx)("th",{scope:"row",children:r.series?`${r.label} · ${r.series}`:r.label}),(0,q.jsx)("td",{children:r.formatted??r.value??""})]},o)),t.length>Bt?(0,q.jsx)("tr",{children:(0,q.jsx)("td",{colSpan:2,children:n.more(t.length-Bt)})}):null]})]})})}var y=(e,t,n,r,o={})=>({name:e,type:t,required:n,description:r,...o}),Ce=y("label","string",!0,"Item name field"),fe=y("value","number",!0,"Value field"),sa=[Ce,fe],la=[Ce,fe],ca=[y("label","string",!0,"Stage name"),y("value","number",!0,"Users at the stage")],ua=[Ce,fe],ma=[y("label","string",!0,"Leaf (lowest level) name"),fe,y("group","string",!1,"Parent group field")],da=[y("label","string",!0,"Leaf name"),fe,y("group","string",!1,"Parent group field")],fa=[Ce,y("value","number",!0,"Change (total rows may omit it)"),y("type","string",!1,'"total" makes a total bar')],ha=[Ce,fe],ga=[y("x","string",!0,"Column field"),y("series","string",!0,"Stacked series field"),fe],pa=[y("x","string",!0,"Column field"),y("y","string",!0,"Row field"),fe],ba=[y("axis","string",!0,"Metric (axis) field"),y("value","number",!0,"Value field",{multi:!0}),y("series","string",!1,"Series field")],ya=[y("x","number",!0,"x value"),y("y","number",!0,"y value"),y("size","number",!1,"Circle size"),y("label","string",!1,"Name")],Gr=y("upper","number",!1,"Upper bound of the range band. Same shape as lower",{multi:!0}),xa=[y("x","any",!0,"x field (date, number or category)"),y("y","number",!0,"y field. An array for wide tables",{multi:!0}),y("series","string",!1,"Series field (long tables)"),y("lower","number",!1,"Lower bound of the range band. In wide tables an array in the order of y",{multi:!0}),Gr],ka=[y("x","any",!0,"x field"),y("y","number",!0,"y field. An array for wide tables",{multi:!0}),y("series","string",!1,"Series field"),y("lower","number",!1,'Lower bound of the range band, with stack "none" only. In wide tables an array in the order of y',{multi:!0}),Gr],wa=[y("x","any",!0,"x field"),y("y","number",!0,"y field",{multi:!0}),y("series","string",!1,"Series field")],va=[y("x","string",!0,"Category field"),y("y","number",!0,"Value field. An array for wide tables",{multi:!0}),y("series","string",!1,"Series field"),y("line","number",!1,"Lines over vertical bars on the same axis, such as a target or last year. An array for several. Bars stay gray unless highlight is set, and with series the line averages rows of the same x",{multi:!0})],$a=[Ce,fe],Ta=[y("value","number",!0,"Value field",{prop:"valueKey"}),y("target","number",!1,"Target field",{prop:"targetKey"})],Ma=[Ce,y("value","number",!0,"Actual value field"),y("target","number",!1,"Target field")],Ca=[y("x","any",!1,"x field"),y("y","number",!0,"y field")],Sa=[Ce,y("x","string",!1,"Period field (long tables)"),y("value","number",!1,"Value field (long tables)")],Aa=[Ce,y("start","number",!0,"Before value"),y("end","number",!0,"After value")],Na=[Ce,fe],Ra=[y("value","number",!0,"Value field"),y("group","string",!1,"Group (row) field"),y("label","string",!1,"Dot name")],Fa=[y("group","string",!0,"Group field"),y("value","number",!0,"Value field")],_a=[y("source","string",!0,"Source node"),y("target","string",!0,"Target node"),fe],Pa=[y("source","string",!0,"Sending group"),y("target","string",!0,"Receiving group"),fe],La=[y("date","date",!0,"Date field"),fe],Da=[y("x","any",!0,"Period field"),y("series","string",!0,"Item field"),y("rank","number",!1,"Rank field (1 is first)"),y("value","number",!1,"Value field (instead of rank, largest is first)")],Ea=[y("group","string",!0,"Group field"),y("value","number",!0,"Value field")],Oa=[y("label","string",!1,"Row name field")],Ia=[y("x","date",!0,"Date (period) field"),y("open","number",!0,"Open price field"),y("high","number",!0,"High price field"),y("low","number",!0,"Low price field"),y("close","number",!0,"Close price field"),y("volume","number",!1,"Volume field")],za=[Ce,fe],Ba=[y("x","any",!0,"Period field (date or category)"),y("y","number",!0,"Back row fields stacked into each block. An array for wide tables",{multi:!0}),y("series","string",!1,"Series field (long tables, back row only)"),y("front","number",!1,"Front row fields: a smaller outcome in the same unit as y (wide tables only)",{multi:!0})],Ha=[y("value","number",!1,"Sample value field (raw rows)"),y("group","string",!1,"Group field. Up to 2 groups overlap"),y("x0","number",!1,"Bin start (pre-binned rows)"),y("x1","number",!1,"Bin end (pre-binned rows)"),y("count","number",!1,"Samples in the bin (pre-binned rows)")],ja=[y("region","string",!0,"Region name or code, matched to a tile of options.map"),fe],Ga=[Ce,fe,y("frame","any",!0,"Time step field: a year, a date or any ordered key. Numbers and dates play in order, other text in the order it first appears. An item with no value in a step leaves the bars for that step")],Wa=[y("source","string",!0,"Source node"),y("target","string",!0,"Target node"),y("value","number",!1,"Link weight. Without it every row counts 1")],Ka=[y("label","string",!0,"Row name. Items with the same name share a row"),y("start","any",!0,"Start: a number (minutes, seconds, any unit) or a date or date-time"),y("end","any",!0,"End, same kind as start. Equal to start draws a point event; empty means still open"),y("group","string",!1,"Group field (one color per group, and the legend)"),y("status","string",!1,"State of the item, written inside the bar and in the tooltip. Without group it also colors the bars and makes the legend, so a row of consecutive states reads as a status strip")],Va=[y("label","string",!0,"Node name field"),y("value","number",!1,"Value field. Sizes the dots; values add up from the leaves"),y("group","string",!1,"Parent group field (flat rows, as in the treemap)"),y("id","string",!1,"Row id for id/parent rows. Defaults to the label"),y("parent","string",!1,"Parent id field. Each row is one node, and rows with an empty parent hang under the root")],Ua=[y("region","string",!0,"Region name or code, matched to a region of options.map"),fe],Xa=[y("lon","number",!1,"Longitude (degrees)"),y("lat","number",!1,"Latitude (degrees)"),y("size","number",!1,"Value (circle area). Without it all circles match"),y("label","string",!1,"Place name"),y("region","string",!1,"Region of options.map, for rows without lon and lat"),y("group","string",!1,"Group field (one color per group)")],Ya=[y("source","string",!0,"Start: a name in options.places or a region"),y("target","string",!0,"End"),y("value","number",!1,"Amount. Without it each row counts 1")],Ja=[y("x","number",!0,"x value"),y("y","number",!0,"y value"),y("series","string",!1,"Series field (one color per series)"),y("label","string",!1,"Name")],jr={pie:sa,donut:la,funnel:ca,waffle:ua,treemap:ma,sunburst:da,waterfall:fa,pareto:ha,marimekko:ga,heatmap:pa,radar:ba,bubble:ya,line:xa,area:ka,stream:wa,bar:va,radialBar:$a,gauge:Ta,bullet:Ma,sparkline:Ca,slope:Sa,dumbbell:Aa,lollipop:Na,beeswarm:Ra,ridgeline:Fa,sankey:_a,chord:Pa,calendar:La,bump:Da,box:Ea,parallel:Oa,candlestick:Ia,segmented:za,skyline:Ba,histogram:Ha,scatter:Ja,tileMap:ja,barRace:Ga,network:Wa,timeline:Ka,tree:Va,choropleth:Ua,symbolMap:Xa,flowMap:Ya},it={pie:{component:"PieChart",name:"Pie chart",nameKo:"파이 차트"},donut:{component:"DonutChart",name:"Donut chart",nameKo:"도넛 차트"},funnel:{component:"FunnelChart",name:"Funnel chart",nameKo:"퍼널 차트"},waffle:{component:"WaffleChart",name:"Waffle chart",nameKo:"와플 차트"},treemap:{component:"Treemap",name:"Treemap",nameKo:"트리맵"},sunburst:{component:"SunburstChart",name:"Sunburst",nameKo:"선버스트"},waterfall:{component:"WaterfallChart",name:"Waterfall chart",nameKo:"폭포 차트"},pareto:{component:"ParetoChart",name:"Pareto chart",nameKo:"파레토 차트"},marimekko:{component:"MarimekkoChart",name:"Marimekko chart",nameKo:"마리메코 차트"},heatmap:{component:"Heatmap",name:"Heatmap",nameKo:"히트맵"},radar:{component:"RadarChart",name:"Radar chart",nameKo:"레이더 차트"},bubble:{component:"BubbleChart",name:"Bubble chart",nameKo:"버블 차트"},line:{component:"LineChart",name:"Line chart",nameKo:"라인 차트"},area:{component:"AreaChart",name:"Area chart",nameKo:"영역 차트"},stream:{component:"StreamGraph",name:"Streamgraph",nameKo:"스트림그래프"},bar:{component:"BarChart",name:"Bar chart",nameKo:"막대 차트"},radialBar:{component:"RadialBarChart",name:"Radial bar chart",nameKo:"방사형 막대"},gauge:{component:"GaugeChart",name:"Gauge",nameKo:"게이지"},bullet:{component:"BulletChart",name:"Bullet chart",nameKo:"불릿 차트"},sparkline:{component:"Sparkline",name:"Sparkline",nameKo:"스파크라인"},slope:{component:"SlopeChart",name:"Slope chart",nameKo:"슬로프 차트"},dumbbell:{component:"DumbbellChart",name:"Dumbbell chart",nameKo:"덤벨 차트"},lollipop:{component:"LollipopChart",name:"Lollipop chart",nameKo:"롤리팝 차트"},beeswarm:{component:"BeeswarmChart",name:"Beeswarm",nameKo:"비스웜"},ridgeline:{component:"RidgelineChart",name:"Ridgeline",nameKo:"릿지라인"},sankey:{component:"SankeyChart",name:"Sankey diagram",nameKo:"생키 다이어그램"},chord:{component:"ChordChart",name:"Chord diagram",nameKo:"코드 다이어그램"},calendar:{component:"CalendarHeatmap",name:"Calendar heatmap",nameKo:"캘린더 히트맵"},bump:{component:"BumpChart",name:"Bump chart",nameKo:"범프 차트"},box:{component:"BoxPlot",name:"Box / violin plot",nameKo:"박스 플롯"},parallel:{component:"ParallelCoordinates",name:"Parallel coordinates",nameKo:"평행 좌표"},candlestick:{component:"CandlestickChart",name:"Candlestick chart",nameKo:"캔들스틱"},segmented:{component:"SegmentedBar",name:"Segmented bar",nameKo:"비율 막대"},skyline:{component:"SkylineChart",name:"Skyline",nameKo:"스카이라인"},histogram:{component:"HistogramChart",name:"Histogram",nameKo:"히스토그램"},scatter:{component:"ScatterChart",name:"Scatter plot",nameKo:"산점도"},tileMap:{component:"TileMap",name:"Tile grid map",nameKo:"타일 격자 지도"},barRace:{component:"BarRace",name:"Bar race",nameKo:"막대 레이스"},network:{component:"NetworkChart",name:"Network",nameKo:"네트워크"},timeline:{component:"Timeline",name:"Timeline",nameKo:"타임라인"},tree:{component:"Tree",name:"Tree",nameKo:"트리"},choropleth:{component:"Choropleth",name:"Choropleth map",nameKo:"단계구분도"},symbolMap:{component:"SymbolMap",name:"Symbol map",nameKo:"기호 지도"},flowMap:{component:"FlowMap",name:"Flow map",nameKo:"흐름 지도"}};function Wr(e,t){return t==="ko"?e.nameKo:e.name}function Kr(e,t){let n=t??e.options?.locale;return typeof n=="string"&&n?n.replace(/_/g,"-"):void 0}var Vr=["line","area","bar","scatter"],Ur=24,Mn=["line","area","bar","scatter","timeline"];function Cn(e,t,n){return e==="bar"&&n.orientation!=="horizontal"&&n.layout!=="percent"&&n.layout!=="diverging"?[].concat(t.line??[]).map(String):[]}function Xr(e,t,n){return Mn.includes(e)&&!Cn(e,t,n).length&&!(e==="scatter"&&jt(n))}function jt(e){return!!e&&typeof e=="object"&&e.bin==="hex"}function Yr(e){let t=e.options?.tooltip?.template;return typeof t=="string"&&t?t:void 0}var Za={doughnut:"donut",column:"bar",stackedBar:"bar",groupedBar:"bar",stacked:"area",streamgraph:"stream",radial:"radialBar",radialbar:"radialBar",progress:"gauge",progressRing:"gauge",kpi:"gauge",violin:"box",boxplot:"box",calendarHeatmap:"calendar","parallel-coordinates":"parallel",parallelCoordinates:"parallel",mekko:"marimekko",spider:"radar",ohlc:"candlestick",candle:"candlestick",stock:"candlestick",segment:"segmented",segmentedBar:"segmented",proportionBar:"segmented",stackedBar100:"segmented",hist:"histogram",tilemap:"tileMap",tileGrid:"tileMap",cartogram:"tileMap",barChartRace:"barRace",racingBar:"barRace",racingBars:"barRace",raceBar:"barRace",arcDiagram:"network",graph:"network",nodeLink:"network",gantt:"timeline",ganttChart:"timeline",schedule:"timeline",dendrogram:"tree",orgChart:"tree",treeChart:"tree",choroplethMap:"choropleth",filledMap:"choropleth",map:"choropleth",bubbleMap:"symbolMap",proportionalSymbolMap:"symbolMap",pointMap:"symbolMap",originDestination:"flowMap",odMap:"flowMap"};function Gt(e){let t=jr[e]?e:Za[e]??Object.keys(it).find(n=>n.toLowerCase()===e.toLowerCase()||it[n].component.toLowerCase()===e.toLowerCase());if(!(!t||!it[t]))return{type:t,component:it[t].component,name:it[t].name,nameKo:it[t].nameKo,encoding:jr[t]}}function Jr(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 Gt(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 Zr(e,t){return Object.hasOwn(e,t)||t in e&&!(t in{})}function Qa(e,t){if(e==null||typeof e!="object")return;let n=e;if(Zr(n,t))return n[t];if(t.includes(".")){let r=n;for(let o of t.split(".")){if(r===null||typeof r!="object"||!Zr(r,o))return;r=r[o]}return r}}function Oe(e){if(typeof e=="number")return Number.isFinite(e)?e:NaN;if(typeof e=="bigint")return Number(e);if(typeof e=="string"){let t=e.trim(),n=/^\(.*\)$/.test(t),r=t.replace(/[()\s%₩$€£¥원명건개회]/g,"").replace(/^\+/,"");if(!r||r.includes(",")&&!/^-?\d{1,3}(,\d{3})*(\.\d+)?$/.test(r))return NaN;let o=Number(r.replace(/,/g,""));return Number.isFinite(o)?n?-o:o:NaN}return e instanceof Date?e.getTime():typeof e=="boolean"?e?1:0:NaN}function Ze(e,t){if(typeof e=="function")return e;let n=e??t;return r=>Qa(r,n)}function Ke(e,t){let n=Ze(e,t);return(r,o)=>Oe(n(r,o))}function be(e,t){let n=Ze(e,t);return(r,o)=>{let i=n(r,o);return i==null?"":i instanceof Date?new Date(i.getTime()-i.getTimezoneOffset()*6e4).toISOString().slice(0,10):String(i)}}function Pe(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}function qa(e){let t=[],n=!1;for(let l=0;l<e.length&&l<4e3;l++){let c=e[l];if(c==='"')n=!n;else if(!n&&(c===`
|
|
22
|
+
`;function fr(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 hr(e,t){let[n]=(0,dr.useState)(!e.motion.enabled);return e.motion.enabled&&e.hydrated&&(!n||t.waiting||t.generation>0)}var mr=!1;function dt(){if(mr||typeof document>"u"||(mr=!0,document.getElementById("ztd-base")))return;let e=document.createElement("style");e.id="ztd-base",e.textContent=Ii,document.head.appendChild(e)}var At=F(re(),1),Ae=typeof window<"u"&&typeof document<"u",Ee=Ae?At.useLayoutEffect:At.useEffect;function Nt(){return typeof performance<"u"?performance.now():Date.now()}function ie(e){return e!==void 0&&/^ko([-_]|$)/i.test(e)?"ko":"en"}function Ne(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}var gr={chart:"chart",table:e=>`${e} data`,more:e=>`and ${e} more`,value:"Value",empty:"No data."},pr={chart:"차트",table:e=>`${e} 데이터`,more:e=>`외 ${e}개`,value:"값",empty:"데이터가 없어요."};var zi=[{id:"basic",en:"Basic",ko:"기본"},{id:"intermediate",en:"Intermediate",ko:"중급"},{id:"advanced",en:"Advanced",ko:"심화"}],Bi={basic:{bg:"line2",fg:"ink"},intermediate:{bg:"tint",fg:"accentText"},advanced:{bg:"ink",fg:"onInk"}};function Hi(e,t){let n=t.trim().toLowerCase();return e.find(r=>r.id===n||r.en.toLowerCase()===n||r.ko===t.trim())}function ji(e){return Hi(zi,e)}function br(e,t){let n=ji(e);return{text:n?n[t]:e,...Bi[n?.id??"basic"]}}var yr={white:"#ffffff",black:"#000000",transparent:"#00000000"};function nt(e){if(!e)return null;let t=e.trim(),n=/^var\(\s*--[\w-]+\s*,\s*(.+)\)$/i.exec(t);if(n&&(t=n[1].trim()),yr[t.toLowerCase()]&&(t=yr[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 wr(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 mn(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 rt(e){let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function xr(e){return .2126*rt(e[0])+.7152*rt(e[1])+.0722*rt(e[2])}function dn(e,t,n){let r=typeof e=="string"?nt(e):e,o=typeof t=="string"?nt(t):t;if(!r||!o)return 0;let i=n?typeof n=="string"?nt(n):n:null;o[3]<1&&i&&(o=mn(o,i));let a=r[3]<1?mn(r,o):r,s=xr(a),l=xr(o);return(Math.max(s,l)+.05)/(Math.min(s,l)+.05)}function Gi(e){return[rt(e[0]),rt(e[1]),rt(e[2])]}function un(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 kr(e){let[t,n,r]=Gi(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 Wi([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[un(4.0767416621*o-3.3077115913*i+.2309699292*a),un(-1.2684380046*o+2.6097574011*i-.3413193965*a),un(-.0041960863*o-.7034186147*i+1.707614701*a),r]}function Rt(e,t,n){let r=nt(e),o=nt(t);if(!r||!o)return e;let i=kr(r),a=kr(o),s=Math.max(0,Math.min(1,n));return wr(Wi([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 fn(e,t,n){let r=t[0],o=-1;for(let i of t){let a=dn(i,e,n);a>o&&(o=a,r=i)}return r}function me(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 Ki(e,t){let n=fn(t,[e.theme.ink,e.theme.onAccent,e.theme.onNeutralStrong]);return dn(n,t)>=4.5?n===e.theme.ink?e.paint("ink"):n===e.theme.onAccent?e.paint("onAccent"):e.paint("onNeutralStrong"):fn(t,["#FFFFFF","#000000"])}function Ft(e,t){let n=Rt(e.theme.neutralStrong,e.theme.neutral,t);return{role:"mix",fill:e.mix("neutralStrong","neutral",t),text:Ki(e,n),raw:n}}function Re(e,t,n){let r=new Array(t),o=[];for(let a=0;a<t;a++)n.has(a)?r[a]=me(e,"accent"):o.push(a);let i=o.length;return o.forEach((a,s)=>{if(i===1)r[a]=me(e,"neutral");else if(s===0)r[a]=me(e,"ink");else if(s===i-1)r[a]=me(e,"neutral");else if(i===3)r[a]=me(e,"strong");else{let l=(s-1)/Math.max(1,i-2);r[a]=l<=.001?me(e,"strong"):Ft(e,1-l)}}),r}var hn="mix:";function We(e){return e({theme:an,cssVars:!1,paint:n=>n,color:n=>n??"neutral",raw:n=>n??"neutral",mix:(n,r,o)=>`${hn}${o}`}).map(n=>n.fill)}function vr(e,t){return t?.startsWith(hn)?e.mix("neutralStrong","neutral",Number(t.slice(hn.length))):e.color(t)}function ft(e,t,n){return Re(e,t+1,n).slice(0,t)}function $r(e,t,n,r="neutral"){let o=me(e,"accent"),i=me(e,r);return Array.from({length:t},(a,s)=>n.has(s)?o:i)}function Tr(e,t,n){let r=new Array(t),o=[];for(let a=0;a<t;a++)n.has(a)?r[a]=me(e,"accent"):o.push(a);let i=o.length;return o.forEach((a,s)=>{i===1?r[a]=me(e,"neutral"):s===0?r[a]=me(e,"strong"):s===i-1?r[a]=me(e,"neutral"):r[a]=Ft(e,1-s/(i-1))}),r}var Fe=F(re(),1);var Pt=(e,t="")=>n=>Number.isFinite(n)?`${e(n)}${t}`:e(n),ye="en-US",Mr=new Map;function gn(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=Mr.get(r);return o||(o=new Intl.NumberFormat(e,n),Mr.set(r,o)),o}function pn(e){return/^[-\u2212]/.test(e)&&!/[1-9]/.test(e)?e.slice(1):e}function ot(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=ye,...r}=t;return pn(gn(n,r).format(e))}var bn=e=>e!==0&&Math.abs(e)<.05,yn=(e,t,n="")=>`${ot(e,{locale:t,maximumSignificantDigits:2,maximumFractionDigits:20})}${n}`;function _t(e,t={}){if(!Number.isFinite(e))return"-";if(bn(e)&&t.maximumFractionDigits===void 0)return yn(e,t.locale??ye,"%");let n=Math.abs(e);return`${ot(e,{maximumFractionDigits:n>0&&n<1?1:0,...t})}%`}function Nr(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=ye,...r}=t;if(ie(n)==="ko"){let o=Math.abs(e),i=[[1e12,"조"],[1e8,"억"],[1e4,"만"],[1,""]],a=i.findIndex(([s])=>o>=s);for(a<0&&(a=i.length-1);;){let[s,l]=i[a],c=o/s,m=Math.max(r.minimumFractionDigits??0,r.maximumFractionDigits??(s===1||c<100?1:0)),u=Math.round(c*10**m)/10**m;if(a>0&&u>=i[a-1][0]/s){a--;continue}return(e<0&&u!==0?"-":"")+ot(u,{locale:n,...r,maximumFractionDigits:m})+l}}return pn(gn(n,{notation:"compact",...r}).format(e))}var Vi=(e,t=ie(e)==="ko"?"KRW":"USD")=>({style:"currency",currency:t,maximumFractionDigits:t==="KRW"?0:2});function Je(e,t=ye,n){if(typeof e=="function")return e;let r=(o,i="",a="")=>{let s=gn(t,o);return l=>Number.isFinite(l)?`${a}${pn(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=>_t(o,{locale:t});case"ratio":return o=>_t(o*100,{locale:t});case"compact":return o=>Nr(o,{locale:t});case"currency":return r(Vi(t));default:{let o=r({maximumFractionDigits:1});return i=>bn(i)?yn(i,t):o(i)}}}function Rr(e,t=ye,n=0){return e!==void 0?Je(e,t):n>=1e5?r=>bn(r)?yn(r,t):Nr(r,{locale:t}):r=>ot(r,{locale:t})}function Ui(e,t,n=1){let r=new Date(+e,+t-1,+n);return r.getMonth()===+t-1&&r.getDate()===+n?r:null}var xn=e=>Number.isInteger(e)&&e>=1e3&&e<=9999,Xi=/^\d{4}-\d{1,2}(-\d{1,2})?([T ][\d:.]+(Z|[+-]\d{2}:?\d{2})?)?$/,Yi=["january","february","march","april","may","june","july","august","september","october","november","december"],Sr=e=>{let t=e.toLowerCase();return t.length<3?0:Yi.findIndex(n=>n.startsWith(t))+1},Cr=e=>+e+(+e<30?2e3:1900);function Fr(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}var Ji=[/^(\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})일)?$/],_r=/^(\d{1,2})([./-])(\d{1,2})\2(\d{4})$/,Pr=/\{([^{}]+)\}/g;function Lt(e,t){let n;for(let r of Ji)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?[Cr(n[3]),+n[2],+n[1],1]:[Cr(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=_r.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=Sr(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=Sr(n[1]);return r?[+n[3],r,+(n[2]??1),n[2]?1:2]:null}return null}var Lr=e=>Xi.test(e)||Lt(e)!==null;function Dr(e){let t;for(let n of e){let r=typeof n=="string"?_r.exec(n.trim()):null;if(r){if(+r[1]>12)return!0;+r[3]>12&&(t=!1)}}return t}function Dt(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(xn(e))return new Date(e,0,1);if(e>=19000101&&e<=21001231)return Dt(`${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=Lt(n,t);if(r)return Ui(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 Ar=new Map;function ht(e,t={month:"short",day:"numeric"}){let n=Dt(e);if(!n)return"-";let{locale:r=ye,...o}=t,i=r+JSON.stringify(o),a=Ar.get(i);return a||(a=new Intl.DateTimeFormat(r,o),Ar.set(i,a)),a.format(n)}var kn=F(Y(),1),Et=(0,Fe.createContext)({theme:Ge,cssVars:!0});function Zi(e,t=Ge){return e?typeof e=="string"?sn[e]??t:cn(t,e):t}function Ot(e){let t=(0,Fe.useContext)(Et),n=e.base?sn[e.base]:t.theme,r=(0,Fe.useMemo)(()=>Zi(e.theme,n),[e.theme,n]),o=e.cssVars??t.cssVars,i=e.locale??t.locale,a=(0,Fe.useMemo)(()=>({theme:r,cssVars:o,locale:i}),[r,o,i]),s=(0,Fe.useMemo)(()=>ln(r),[r]),l=e.paint?{background:r.bg,color:r.ink,fontFamily:r.fontFamily,...s,...e.style}:{display:"contents",...s,...e.style};return(0,kn.jsx)(Et.Provider,{value:a,children:(0,kn.jsx)("div",{className:e.className,"data-ztd-theme":r.name,lang:e.locale,style:l,children:e.children})})}var Qi=new Set(["bg","panel","ink","muted","dim","accent","accentText","onAccent","accent2","accent3","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"]);function Or(e){return Qi.has(e)}function qi(e,t){let n=r=>t?`var(${Ct(r)}, ${e[r]})`:e[r];return{theme:e,cssVars:t,paint:n,color:(r,o="neutral")=>r?Or(r)?n(r):r:n(o),raw:(r,o="neutral")=>r?Or(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)})`:Rt(e[r],e[o],i)}}}function _e(e){let t=(0,Fe.useContext)(Et);return(0,Fe.useMemo)(()=>{let n=cn(t.theme,e);return qi(n,t.cssVars)},[t.theme,t.cssVars,e])}function we(e){let t=(0,Fe.useContext)(Et);return e??t.locale??ye}function Ir(e){return e?ln(e):{}}var It=F(re(),1),wn=(0,It.createContext)(void 0);function zr(e){let t=(0,It.useContext)(wn);return e!==void 0&&t!==void 0?`${e}:${t}`:e??t}var _=F(Y(),1),ea={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`},ta={en:ea,ko:{legend:"범례",replay:"애니메이션 다시 재생",replayTitle:"다시 재생",sample:"예시 데이터",loadError:"데이터를 불러오지 못했어요",retry:"다시 시도",loading:"불러오는 중",empty:"표시할 데이터가 없어요",source:"출처",shown:(e,t)=>`${t}개 중 ${e}개 보임`}};var na={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},vn=e=>ta[ie(we(e))];function $n(e){let t=_e(e.theme),n=vn(e.locale),[r,o]=(0,zt.useState)(!1),i=e.size??11.5,a=e.onToggle,s=new Set(a?e.hidden:void 0),l=e.items.filter(m=>!s.has(m.label)).length,c=(0,_.jsx)("ul",{"aria-label":n.legend,style:{display:"flex",flexWrap:"wrap",justifyContent:e.align==="start"?"flex-start":"flex-end",gap:"4px 12px",margin:0,padding:0,listStyle:"none"},children:e.items.map((m,u)=>{let g=!s.has(m.label),f=g&&l===1,h=(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(ra,{p:t,item:m,off:!g}),(0,_.jsx)("span",{style:g?void 0:{textDecoration:"line-through"},children:m.label})]});return(0,_.jsx)("li",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:i,color:t.paint("muted"),lineHeight:1.3},children:a?(0,_.jsx)("button",{type:"button",className:"ztd-btn","aria-pressed":g,"aria-disabled":f||void 0,onClick:()=>{f||(a(m.label),o(!0))},style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:24,minWidth:24,padding:"0 2px",margin:0,border:0,borderRadius:4,background:"transparent",color:"inherit",fontSize:"inherit",lineHeight:"inherit",cursor:f?"default":void 0},children:h}):h},u)})});return a?(0,_.jsxs)(_.Fragment,{children:[c,(0,_.jsx)("span",{"aria-live":"polite","aria-atomic":"true",style:na,children:r?n.shown(l,e.items.length):""})]}):c}function ra({p:e,item:t,off:n}){let r=vr(e,t.color),o=t.shape??"square";return o==="line"||o==="dash"?(0,_.jsxs)("svg",{width:14,height:8,"aria-hidden":"true",style:{flex:"none",opacity:n?.35:void 0},children:[(0,_.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,_.jsx)("circle",{cx:7,cy:4,r:2.2,fill:r}):null]}):(0,_.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 oa(e){let t=_e(e.theme),n=br(e.level,ie(we(e.locale)));return(0,_.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 ia(e,t,n){if(typeof e!="string"||!t)return e;let r=e.indexOf(t);return r<0?e:(0,_.jsxs)(_.Fragment,{children:[e.slice(0,r),(0,_.jsx)("span",{style:{color:n},children:t}),e.slice(r+t.length)]})}function Br(e){let t=_e(e.theme),n=vn(e.locale),[r,o]=(0,zt.useState)(0);Ee(()=>dt(),[]);let i=()=>{o(g=>g+1),e.onReplay?.()},a=Array.isArray(e.legend)?(0,_.jsx)($n,{items:e.legend,theme:e.theme,locale:e.locale}):e.legend,s=e.as??"h3",l=e.number===void 0?null:typeof e.number=="number"?String(e.number).padStart(2,"0"):e.number,c=e.replay||e.onReplay,m=e.source!==void 0||e.note!==void 0?(0,_.jsxs)("p",{style:{margin:0,fontSize:12,color:t.paint("muted"),lineHeight:1.4},children:[e.source!==void 0?`${n.source}: `:null,e.source,e.source!==void 0&&e.note!==void 0?" · ":null,e.note]}):null,u=e.takeaway!==void 0||e.level||e.sample?(0,_.jsxs)("footer",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,marginTop:2},children:[(0,_.jsx)("span",{style:{fontSize:17,fontWeight:800,color:t.paint("ink"),letterSpacing:-.3,lineHeight:1.3,minWidth:0},children:e.takeaway}),(0,_.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:8,flex:"none"},children:[e.sample?(0,_.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,_.jsx)(oa,{level:e.level,theme:e.theme,locale:e.locale}):null]})]}):null;return(0,_.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,_.jsxs)("header",{style:{display:"flex",flexDirection:"column",gap:6,minWidth:0},children:[(0,_.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0},children:[l?(0,_.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,_.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:ia(e.title,e.accent,t.paint("accentText"))}),e.actions,c?(0,_.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,_.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,_.jsx)("path",{d:"M3 12a9 9 0 1 0 3-6.7"}),(0,_.jsx)("path",{d:"M3 3v6h6"})]})}):null]}),e.subtitle!==void 0||a?(0,_.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"4px 12px",flexWrap:"wrap",minHeight:18},children:[e.subtitle!==void 0?(0,_.jsx)("span",{style:{fontSize:12.5,color:t.paint("muted"),lineHeight:1.4},children:e.subtitle}):(0,_.jsx)("span",{}),a]}):null]}),(0,_.jsx)("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",minHeight:0,minWidth:0},children:(0,_.jsx)(wn.Provider,{value:r,children:(0,_.jsx)(tt.Provider,{value:typeof e.title=="string"||typeof e.title=="number"?String(e.title):void 0,children:e.children})})}),m?(0,_.jsxs)(_.Fragment,{children:[m,u]}):u]})}function Tn(e){let t=_e(e.theme),n=vn(e.locale),r=e.height??220;if(Ee(()=>dt(),[]),e.error){let o=typeof e.error=="string"?e.error:e.error.message;return(0,_.jsx)("div",{role:"alert",style:{height:r,display:"grid",placeItems:"center",textAlign:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,_.jsxs)("div",{style:{display:"grid",gap:8,justifyItems:"center",padding:16},children:[(0,_.jsx)("span",{style:{fontSize:14,fontWeight:700,color:t.paint("ink")},children:n.loadError}),(0,_.jsx)("span",{style:{fontSize:12,color:t.paint("muted"),maxWidth:280,wordBreak:"break-word"},children:o}),e.onRetry?(0,_.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,_.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,_.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,_.jsx)("div",{style:{height:r,display:"grid",placeItems:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,_.jsx)("span",{style:{fontSize:13,color:t.paint("muted")},children:e.emptyText??n.empty})}):(0,_.jsx)(_.Fragment,{children:e.children})}var lt=F(re(),1);var ve=F(re(),1);var q=F(Y(),1),Bt=60;var Ht={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};function Hr(e){let{c:t,events:n}=e,r=(0,ve.useId)().replace(/:/g,""),o=`${r}t`,i=`${r}d`;t.events.current=n,Ee(()=>{dt()},[]);let a=n.length,s=!e.noNav&&a>0,l=(0,ve.useContext)(tt),c=e.ariaLabel??l??e.kind,m=(0,ve.useMemo)(()=>s?`${n.length}${n.slice(0,Bt).map(v=>`${v.label}${v.series??""}${v.formatted??v.value??""}`).join("")}`:"",[n,s]),u=(0,ve.useMemo)(()=>(0,q.jsx)(aa,{label:c,events:n,t:t.t}),[c,m,t.t]),g=(0,ve.useRef)(null);(0,ve.useEffect)(()=>{let v=()=>{g.current=null};return window.addEventListener("scroll",v,{capture:!0,passive:!0}),window.addEventListener("resize",v,{passive:!0}),()=>{window.removeEventListener("scroll",v,{capture:!0}),window.removeEventListener("resize",v)}},[]),(0,ve.useEffect)(()=>{g.current=null},[t.width,t.height]);let f=v=>{if(v.target!==v.currentTarget)return;if(e.onKey?.(v)){v.preventDefault();return}let N=t.active,G;switch(v.key){case"ArrowRight":case"ArrowDown":G=N===null?0:(N+1)%a;break;case"ArrowLeft":case"ArrowUp":G=N===null?a-1:(N-1+a)%a;break;case"Home":G=0;break;case"End":G=a-1;break;case"Escape":if(N===null)return;G=null;break;case"Enter":case" ":N!==null&&(v.preventDefault(),t.click(N));return;default:return}v.preventDefault(),t.setActive(G,"keyboard")},{via:h,node:p,setActive:S}=t;(0,ve.useEffect)(()=>{if(h!=="touch"||!p)return;let v=N=>{p.contains(N.target)||S(null)};return document.addEventListener("pointerdown",v),()=>document.removeEventListener("pointerdown",v)},[h,p,S]);let x=t.active!==null?n[t.active]:null,k=t.showTooltip&&e.renderTip!==!1&&!t.pending&&t.via!=="sync"?e.tip:null,w=k&&!t.responsive&&t.node&&t.width&&t.node.getBoundingClientRect().width/t.width||1,M=typeof e.renderTip=="function"&&x?e.renderTip(x):null,b=e.announce??(t.via==="keyboard"&&x?`${x.label}${x.series?` ${x.series}`:""}: ${x.formatted??x.value??""} (${(t.active??0)+1}/${a})`:""),P;if(k){let v=k.x*w,N=t.width*w,G=`clamp(${(4-v).toFixed(1)}px, -50%, calc(${(N-v-4).toFixed(1)}px - 100%))`,X=k.y<64;P={position:"absolute",left:v,top:k.y*w,transform:`translate(${G}, ${X?"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*w-8)}}let U=v=>{g.current=null,v.pointerType!=="touch"&&t.via!=="keyboard"&&t.setActive(null)},j=v=>v?N=>{let G=g.current??(g.current=N.currentTarget.getBoundingClientRect());G.width&&v((N.clientX-G.left)/G.width*t.width,(N.clientY-G.top)/G.height*t.height,N)}:void 0,R=j(e.onPointerMove),J=j(e.onPointerDown),O=R||J?v=>{v.pointerType==="touch"&&R?.(v),J?.(v)}:void 0,L=j(e.onPointerUp),A=Ir(e.theme);return(0,q.jsxs)("div",{ref:t.ref,className:`ztd-root${t.reduced?" ztd-still":""}${e.className?` ${e.className}`:""}`,role:"group","aria-roledescription":t.t.chart,"aria-label":c,"aria-describedby":i,tabIndex:s?0:void 0,onKeyDown:s?f:void 0,onBlur:v=>{t.via==="keyboard"&&!v.currentTarget.contains(v.relatedTarget)&&t.setActive(null)},onPointerLeave:U,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"),...A,...e.style},children:[t.pending?null:e.underlay,(0,q.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:R,onPointerDown:O,onPointerUp:L,onPointerCancel:L,style:{fontFamily:"inherit",touchAction:"pan-y",position:e.underlay?"relative":void 0},children:[(0,q.jsx)("title",{id:o,children:c}),(0,q.jsx)("desc",{id:i,children:a||t.description!==void 0?e.description:e.emptyText??t.t.empty}),e.defs&&!t.pending?(0,q.jsx)("defs",{children:e.defs}):null,t.pending?null:e.children]}),t.pending?null:e.overlay,k?(0,q.jsx)("div",{className:"ztd-tip","aria-hidden":"true",style:P,children:M??(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)("div",{style:{fontWeight:600,fontSize:11.5,color:t.p.paint("muted"),marginBottom:k.rows.length?4:0,overflow:"hidden",textOverflow:"ellipsis"},children:k.title}),k.rows.map((v,N)=>(0,q.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:16,justifyContent:"space-between"},children:[(0,q.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:7,color:t.p.paint(v.strong?"ink":"muted")},children:[v.color?(0,q.jsx)("span",{style:{width:8,height:8,borderRadius:999,background:v.color,display:"inline-block",boxShadow:"inset 0 0 0 1px rgba(127,127,127,0.3)"}}):null,v.label]}),(0,q.jsx)("span",{style:{fontWeight:v.strong===!1?500:700},children:v.value})]},N))]})}):null,(0,q.jsx)("span",{className:"ztd-sr",style:Ht,"aria-live":"polite","aria-atomic":"true",children:b}),s&&!t.pending?u:null]})}function aa({label:e,events:t,t:n}){return(0,q.jsx)("div",{className:"ztd-sr",style:Ht,children:(0,q.jsxs)("table",{children:[(0,q.jsx)("caption",{children:n.table(e)}),(0,q.jsxs)("tbody",{children:[t.slice(0,Bt).map((r,o)=>(0,q.jsxs)("tr",{children:[(0,q.jsx)("th",{scope:"row",children:r.series?`${r.label} · ${r.series}`:r.label}),(0,q.jsx)("td",{children:r.formatted??r.value??""})]},o)),t.length>Bt?(0,q.jsx)("tr",{children:(0,q.jsx)("td",{colSpan:2,children:n.more(t.length-Bt)})}):null]})]})})}var y=(e,t,n,r,o={})=>({name:e,type:t,required:n,description:r,...o}),Se=y("label","string",!0,"Item name field"),fe=y("value","number",!0,"Value field"),sa=[Se,fe],la=[Se,fe],ca=[y("label","string",!0,"Stage name"),y("value","number",!0,"Users at the stage")],ua=[Se,fe],ma=[y("label","string",!0,"Leaf (lowest level) name"),fe,y("group","string",!1,"Parent group field")],da=[y("label","string",!0,"Leaf name"),fe,y("group","string",!1,"Parent group field")],fa=[Se,y("value","number",!0,"Change (total rows may omit it)"),y("type","string",!1,'"total" makes a total bar')],ha=[Se,fe],ga=[y("x","string",!0,"Column field"),y("series","string",!0,"Stacked series field"),fe],pa=[y("x","string",!0,"Column field"),y("y","string",!0,"Row field"),fe],ba=[y("axis","string",!0,"Metric (axis) field"),y("value","number",!0,"Value field",{multi:!0}),y("series","string",!1,"Series field")],ya=[y("x","number",!0,"x value"),y("y","number",!0,"y value"),y("size","number",!1,"Circle size"),y("label","string",!1,"Name")],Gr=y("upper","number",!1,"Upper bound of the range band. Same shape as lower",{multi:!0}),xa=[y("x","any",!0,"x field (date, number or category)"),y("y","number",!0,"y field. An array for wide tables",{multi:!0}),y("series","string",!1,"Series field (long tables)"),y("lower","number",!1,"Lower bound of the range band. In wide tables an array in the order of y",{multi:!0}),Gr],ka=[y("x","any",!0,"x field"),y("y","number",!0,"y field. An array for wide tables",{multi:!0}),y("series","string",!1,"Series field"),y("lower","number",!1,'Lower bound of the range band, with stack "none" only. In wide tables an array in the order of y',{multi:!0}),Gr],wa=[y("x","any",!0,"x field"),y("y","number",!0,"y field",{multi:!0}),y("series","string",!1,"Series field")],va=[y("x","string",!0,"Category field"),y("y","number",!0,"Value field. An array for wide tables",{multi:!0}),y("series","string",!1,"Series field"),y("line","number",!1,"Lines over vertical bars on the same axis, such as a target or last year. An array for several. Bars stay gray unless highlight is set, and with series the line averages rows of the same x",{multi:!0})],$a=[Se,fe],Ta=[y("value","number",!0,"Value field",{prop:"valueKey"}),y("target","number",!1,"Target field",{prop:"targetKey"})],Ma=[Se,y("value","number",!0,"Actual value field"),y("target","number",!1,"Target field")],Sa=[y("x","any",!1,"x field"),y("y","number",!0,"y field")],Ca=[Se,y("x","string",!1,"Period field (long tables)"),y("value","number",!1,"Value field (long tables)")],Aa=[Se,y("start","number",!0,"Before value"),y("end","number",!0,"After value")],Na=[Se,fe],Ra=[y("value","number",!0,"Value field"),y("group","string",!1,"Group (row) field"),y("label","string",!1,"Dot name")],Fa=[y("group","string",!0,"Group field"),y("value","number",!0,"Value field")],_a=[y("source","string",!0,"Source node"),y("target","string",!0,"Target node"),fe],Pa=[y("source","string",!0,"Sending group"),y("target","string",!0,"Receiving group"),fe],La=[y("date","date",!0,"Date field"),fe],Da=[y("x","any",!0,"Period field"),y("series","string",!0,"Item field"),y("rank","number",!1,"Rank field (1 is first)"),y("value","number",!1,"Value field (instead of rank, largest is first)")],Ea=[y("group","string",!0,"Group field"),y("value","number",!0,"Value field")],Oa=[y("label","string",!1,"Row name field")],Ia=[y("x","date",!0,"Date (period) field"),y("open","number",!0,"Open price field"),y("high","number",!0,"High price field"),y("low","number",!0,"Low price field"),y("close","number",!0,"Close price field"),y("volume","number",!1,"Volume field")],za=[Se,fe],Ba=[y("x","any",!0,"Period field (date or category)"),y("y","number",!0,"Back row fields stacked into each block. An array for wide tables",{multi:!0}),y("series","string",!1,"Series field (long tables, back row only)"),y("front","number",!1,"Front row fields: a smaller outcome in the same unit as y (wide tables only)",{multi:!0})],Ha=[y("value","number",!1,"Sample value field (raw rows)"),y("group","string",!1,"Group field. Up to 2 groups overlap"),y("x0","number",!1,"Bin start (pre-binned rows)"),y("x1","number",!1,"Bin end (pre-binned rows)"),y("count","number",!1,"Samples in the bin (pre-binned rows)")],ja=[y("region","string",!0,"Region name or code, matched to a tile of options.map"),fe],Ga=[Se,fe,y("frame","any",!0,"Time step field: a year, a date or any ordered key. Numbers and dates play in order, other text in the order it first appears. An item with no value in a step leaves the bars for that step")],Wa=[y("source","string",!0,"Source node"),y("target","string",!0,"Target node"),y("value","number",!1,"Link weight. Without it every row counts 1")],Ka=[y("label","string",!0,"Row name. Items with the same name share a row"),y("start","any",!0,"Start: a number (minutes, seconds, any unit) or a date or date-time"),y("end","any",!0,"End, same kind as start. Equal to start draws a point event; empty means still open"),y("group","string",!1,"Group field (one color per group, and the legend)"),y("status","string",!1,"State of the item, written inside the bar and in the tooltip. Without group it also colors the bars and makes the legend, so a row of consecutive states reads as a status strip")],Va=[y("label","string",!0,"Node name field"),y("value","number",!1,"Value field. Sizes the dots; values add up from the leaves"),y("group","string",!1,"Parent group field (flat rows, as in the treemap)"),y("id","string",!1,"Row id for id/parent rows. Defaults to the label"),y("parent","string",!1,"Parent id field. Each row is one node, and rows with an empty parent hang under the root")],Ua=[y("region","string",!0,"Region name or code, matched to a region of options.map"),fe],Xa=[y("lon","number",!1,"Longitude (degrees)"),y("lat","number",!1,"Latitude (degrees)"),y("size","number",!1,"Value (circle area). Without it all circles match"),y("label","string",!1,"Place name"),y("region","string",!1,"Region of options.map, for rows without lon and lat"),y("group","string",!1,"Group field (one color per group)")],Ya=[y("source","string",!0,"Start: a name in options.places or a region"),y("target","string",!0,"End"),y("value","number",!1,"Amount. Without it each row counts 1")],Ja=[y("x","number",!0,"x value"),y("y","number",!0,"y value"),y("series","string",!1,"Series field (one color per series)"),y("label","string",!1,"Name")],jr={pie:sa,donut:la,funnel:ca,waffle:ua,treemap:ma,sunburst:da,waterfall:fa,pareto:ha,marimekko:ga,heatmap:pa,radar:ba,bubble:ya,line:xa,area:ka,stream:wa,bar:va,radialBar:$a,gauge:Ta,bullet:Ma,sparkline:Sa,slope:Ca,dumbbell:Aa,lollipop:Na,beeswarm:Ra,ridgeline:Fa,sankey:_a,chord:Pa,calendar:La,bump:Da,box:Ea,parallel:Oa,candlestick:Ia,segmented:za,skyline:Ba,histogram:Ha,scatter:Ja,tileMap:ja,barRace:Ga,network:Wa,timeline:Ka,tree:Va,choropleth:Ua,symbolMap:Xa,flowMap:Ya},it={pie:{component:"PieChart",name:"Pie chart",nameKo:"파이 차트"},donut:{component:"DonutChart",name:"Donut chart",nameKo:"도넛 차트"},funnel:{component:"FunnelChart",name:"Funnel chart",nameKo:"퍼널 차트"},waffle:{component:"WaffleChart",name:"Waffle chart",nameKo:"와플 차트"},treemap:{component:"Treemap",name:"Treemap",nameKo:"트리맵"},sunburst:{component:"SunburstChart",name:"Sunburst",nameKo:"선버스트"},waterfall:{component:"WaterfallChart",name:"Waterfall chart",nameKo:"폭포 차트"},pareto:{component:"ParetoChart",name:"Pareto chart",nameKo:"파레토 차트"},marimekko:{component:"MarimekkoChart",name:"Marimekko chart",nameKo:"마리메코 차트"},heatmap:{component:"Heatmap",name:"Heatmap",nameKo:"히트맵"},radar:{component:"RadarChart",name:"Radar chart",nameKo:"레이더 차트"},bubble:{component:"BubbleChart",name:"Bubble chart",nameKo:"버블 차트"},line:{component:"LineChart",name:"Line chart",nameKo:"라인 차트"},area:{component:"AreaChart",name:"Area chart",nameKo:"영역 차트"},stream:{component:"StreamGraph",name:"Streamgraph",nameKo:"스트림그래프"},bar:{component:"BarChart",name:"Bar chart",nameKo:"막대 차트"},radialBar:{component:"RadialBarChart",name:"Radial bar chart",nameKo:"방사형 막대"},gauge:{component:"GaugeChart",name:"Gauge",nameKo:"게이지"},bullet:{component:"BulletChart",name:"Bullet chart",nameKo:"불릿 차트"},sparkline:{component:"Sparkline",name:"Sparkline",nameKo:"스파크라인"},slope:{component:"SlopeChart",name:"Slope chart",nameKo:"슬로프 차트"},dumbbell:{component:"DumbbellChart",name:"Dumbbell chart",nameKo:"덤벨 차트"},lollipop:{component:"LollipopChart",name:"Lollipop chart",nameKo:"롤리팝 차트"},beeswarm:{component:"BeeswarmChart",name:"Beeswarm",nameKo:"비스웜"},ridgeline:{component:"RidgelineChart",name:"Ridgeline",nameKo:"릿지라인"},sankey:{component:"SankeyChart",name:"Sankey diagram",nameKo:"생키 다이어그램"},chord:{component:"ChordChart",name:"Chord diagram",nameKo:"코드 다이어그램"},calendar:{component:"CalendarHeatmap",name:"Calendar heatmap",nameKo:"캘린더 히트맵"},bump:{component:"BumpChart",name:"Bump chart",nameKo:"범프 차트"},box:{component:"BoxPlot",name:"Box / violin plot",nameKo:"박스 플롯"},parallel:{component:"ParallelCoordinates",name:"Parallel coordinates",nameKo:"평행 좌표"},candlestick:{component:"CandlestickChart",name:"Candlestick chart",nameKo:"캔들스틱"},segmented:{component:"SegmentedBar",name:"Segmented bar",nameKo:"비율 막대"},skyline:{component:"SkylineChart",name:"Skyline",nameKo:"스카이라인"},histogram:{component:"HistogramChart",name:"Histogram",nameKo:"히스토그램"},scatter:{component:"ScatterChart",name:"Scatter plot",nameKo:"산점도"},tileMap:{component:"TileMap",name:"Tile grid map",nameKo:"타일 격자 지도"},barRace:{component:"BarRace",name:"Bar race",nameKo:"막대 레이스"},network:{component:"NetworkChart",name:"Network",nameKo:"네트워크"},timeline:{component:"Timeline",name:"Timeline",nameKo:"타임라인"},tree:{component:"Tree",name:"Tree",nameKo:"트리"},choropleth:{component:"Choropleth",name:"Choropleth map",nameKo:"단계구분도"},symbolMap:{component:"SymbolMap",name:"Symbol map",nameKo:"기호 지도"},flowMap:{component:"FlowMap",name:"Flow map",nameKo:"흐름 지도"}};function Wr(e,t){return t==="ko"?e.nameKo:e.name}function Kr(e,t){let n=t??e.options?.locale;return typeof n=="string"&&n?n.replace(/_/g,"-"):void 0}var Vr=["line","area","bar","scatter"],Ur=24,Mn=["line","area","bar","scatter","timeline"];function Sn(e,t,n){return e==="bar"&&n.orientation!=="horizontal"&&n.layout!=="percent"&&n.layout!=="diverging"?[].concat(t.line??[]).map(String):[]}function Xr(e,t,n){return Mn.includes(e)&&!Sn(e,t,n).length&&!(e==="scatter"&&jt(n))}function jt(e){return!!e&&typeof e=="object"&&e.bin==="hex"}function Yr(e){let t=e.options?.tooltip?.template;return typeof t=="string"&&t?t:void 0}var Za={doughnut:"donut",column:"bar",stackedBar:"bar",groupedBar:"bar",stacked:"area",streamgraph:"stream",radial:"radialBar",radialbar:"radialBar",progress:"gauge",progressRing:"gauge",kpi:"gauge",violin:"box",boxplot:"box",calendarHeatmap:"calendar","parallel-coordinates":"parallel",parallelCoordinates:"parallel",mekko:"marimekko",spider:"radar",ohlc:"candlestick",candle:"candlestick",stock:"candlestick",segment:"segmented",segmentedBar:"segmented",proportionBar:"segmented",stackedBar100:"segmented",hist:"histogram",tilemap:"tileMap",tileGrid:"tileMap",cartogram:"tileMap",barChartRace:"barRace",racingBar:"barRace",racingBars:"barRace",raceBar:"barRace",arcDiagram:"network",graph:"network",nodeLink:"network",gantt:"timeline",ganttChart:"timeline",schedule:"timeline",dendrogram:"tree",orgChart:"tree",treeChart:"tree",choroplethMap:"choropleth",filledMap:"choropleth",map:"choropleth",bubbleMap:"symbolMap",proportionalSymbolMap:"symbolMap",pointMap:"symbolMap",originDestination:"flowMap",odMap:"flowMap"};function Gt(e){let t=jr[e]?e:Za[e]??Object.keys(it).find(n=>n.toLowerCase()===e.toLowerCase()||it[n].component.toLowerCase()===e.toLowerCase());if(!(!t||!it[t]))return{type:t,component:it[t].component,name:it[t].name,nameKo:it[t].nameKo,encoding:jr[t]}}function Jr(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 Gt(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 Zr(e,t){return Object.hasOwn(e,t)||t in e&&!(t in{})}function Qa(e,t){if(e==null||typeof e!="object")return;let n=e;if(Zr(n,t))return n[t];if(t.includes(".")){let r=n;for(let o of t.split(".")){if(r===null||typeof r!="object"||!Zr(r,o))return;r=r[o]}return r}}function Oe(e){if(typeof e=="number")return Number.isFinite(e)?e:NaN;if(typeof e=="bigint")return Number(e);if(typeof e=="string"){let t=e.trim(),n=/^\(.*\)$/.test(t),r=t.replace(/[()\s%₩$€£¥원명건개회]/g,"").replace(/^\+/,"");if(!r||r.includes(",")&&!/^-?\d{1,3}(,\d{3})*(\.\d+)?$/.test(r))return NaN;let o=Number(r.replace(/,/g,""));return Number.isFinite(o)?n?-o:o:NaN}return e instanceof Date?e.getTime():typeof e=="boolean"?e?1:0:NaN}function Ze(e,t){if(typeof e=="function")return e;let n=e??t;return r=>Qa(r,n)}function Ke(e,t){let n=Ze(e,t);return(r,o)=>Oe(n(r,o))}function be(e,t){let n=Ze(e,t);return(r,o)=>{let i=n(r,o);return i==null?"":i instanceof Date?new Date(i.getTime()-i.getTimezoneOffset()*6e4).toISOString().slice(0,10):String(i)}}function Pe(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}function qa(e){let t=[],n=!1;for(let l=0;l<e.length&&l<4e3;l++){let c=e[l];if(c==='"')n=!n;else if(!n&&(c===`
|
|
23
23
|
`||c==="\r"))break;t.push(n?"":c)}let r=t.join(""),o=l=>r.split(l).length-1,i=[","," ",";","|"],a=",",s=0;for(let l of i){let c=o(l);c>s&&(s=c,a=l)}return a}var es=/^[-+(]?[₩$€£¥]?\s?\d[\d,]*(\.\d+)?([eE][-+]?\d+)?\)?\s?(%|원|명|건|개|회)?$/;function Qr(e){let t=e.trim();if(t==="")return null;if(/^-?0\d/.test(t))return t;if(es.test(t)||/^[-+]?\.\d+$/.test(t)){let n=Oe(t);if(Number.isFinite(n))return n}return t}function Qe(e,t={}){let{typed:n=!0,header:r=!0}=t,o=e.replace(/^\uFEFF/,"");if(!o.trim())return[];let i=t.delimiter??qa(o),a=[],s=[],l="",c=!1;for(let h=0;h<o.length;h++){let p=o[h];c?p==='"'?o[h+1]==='"'?(l+='"',h++):c=!1:l+=p:p==='"'&&!l.trim()?(c=!0,l=""):p===i?(s.push(l),l=""):p===`
|
|
24
24
|
`||p==="\r"?(p==="\r"&&o[h+1]===`
|
|
25
|
-
`&&h++,s.push(l),a.push(s),s=[],l=""):l+=p}(l!==""||s.length)&&(s.push(l),a.push(s));let m=a.filter(h=>!(h.length===1&&h[0].trim()===""));if(!m.length)return[];let u=h=>n?Qr(h):h;if(!r)return m.map(h=>Object.fromEntries(h.map((p,C)=>[String(C),u(p)])));let g=[],f=new Set;return m[0].forEach((h,p)=>{let C=h.trim()||`col${p+1}`,x=C;for(let k=2;f.has(x);k++)x=`${C}_${k}`;f.add(x),g.push(x)}),m.slice(1).map(h=>Object.fromEntries(g.map((p,C)=>[p,u(h[C]??"")])))}function Sn(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"?Qr(a[l]):a[l]??null])))}function ts(e,t={}){let{labelKey:n="label",valueKey:r="value"}=t,o=Object.values(e);if(o.length&&o.every(i=>Array.isArray(i))){let i=Object.keys(e),a=Math.max(...o.map(s=>s.length));return Array.from({length:a},(s,l)=>Object.fromEntries(i.map(c=>[c,e[c][l]??null])))}return Object.entries(e).map(([i,a])=>({[n]:i,[r]:a}))}function qr(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 Ve(e){if(e==null)return[];if(typeof e=="string"){let t=e.trim();if(!t)return[];if(t.startsWith("[")||t.startsWith("{"))try{return Ve(JSON.parse(t))}catch{}return Qe(t)}if(Array.isArray(e))return e.length?Array.isArray(e[0])?Sn(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)?Ve(t.data):Array.isArray(t.rows)&&Array.isArray(t.columns)?Sn(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)?Ve(t.rows):Array.isArray(t.values)?Sn(t.values):Array.isArray(t.items)?Ve(t.items):Array.isArray(t.results)?Ve(t.results):ts(t)}return[]}function Wt(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 An(e,t="zero"){let n=e.length,r=n?e[0].length:0,o=e.map(()=>new Array(r).fill(0)),i=e.map(()=>new Array(r).fill(0)),a=(l,c)=>{let m=e[l][c];return Number.isFinite(m)&&m>0?m:0},s=new Array(r).fill(0);if(t==="wiggle"&&n>0&&r>1){let l=0;for(let c=1;c<r;c++){let m=0,u=0;for(let g=0;g<n;g++){let f=a(g,c),h=f-a(g,c-1),p=0;for(let C=0;C<g;C++)p+=a(C,c)-a(C,c-1);m+=f,u+=(h/2+p)*f}m&&(l-=u/m),s[c]=l}}for(let l=0;l<r;l++){if(t==="zero"){let u=0,g=0;for(let f=0;f<n;f++){let h=e[f][l],p=Number.isFinite(h)?h:0;p>=0?(o[f][l]=u,u+=p,i[f][l]=u):(o[f][l]=g,g+=p,i[f][l]=g)}continue}let c=0;for(let u=0;u<n;u++)c+=a(u,l);let m=t==="silhouette"?-c/2:s[l];for(let u=0;u<n;u++){let g=a(u,l);t==="expand"&&(g=c?g/c*100:0),o[u][l]=m,m+=g,i[u][l]=m}}if(t==="wiggle"&&r){let l=1/0,c=-1/0;for(let u=0;u<r;u++)l=Math.min(l,o[0]?.[u]??0),c=Math.max(c,i[n-1]?.[u]??0);let m=0;for(let u=0;u<r;u++)m+=((o[0]?.[u]??0)+(i[n-1]?.[u]??0))/2;m/=r;for(let u=0;u<n;u++)for(let g=0;g<r;g++)o[u][g]-=m,i[u][g]-=m}return{y0:o,y1:i}}function eo(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 to(e){let t=e.length,n=e.map(c=>{let m=0,u=-1/0;return c.forEach((g,f)=>{g>u&&(u=g,m=f)}),m}),r=e.map(c=>c.reduce((m,u)=>m+(Number.isFinite(u)?u:0),0)),o=Array.from({length:t},(c,m)=>m).sort((c,m)=>n[c]-n[m]),i=[],a=[],s=0,l=0;for(let c of o)s<l?(i.push(c),s+=r[c]):(a.push(c),l+=r[c]);return[...a.reverse(),...i]}var qe=Math.PI*2;function ze(e,t,n){return e<t?t:e>n?n:e}function Kt(e){let t=0;for(let n of e)Number.isFinite(n)&&(t+=n);return t}function et(e,t,n,r){return[e+n*Math.sin(r),t-n*Math.cos(r)]}function no(e){let t=-1,n=-1/0;return e.forEach((r,o)=>{r>n&&(n=r,t=o)}),t}function oo(e){return e>=44032&&e<=55203||e>=4352&&e<=4607||e>=12592&&e<=12687||e>=19968&&e<=40959}function ro(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 Vt=new Map;function xe(e,t,n=400){let r=String(e),o=`${r}|${n>=600?1:0}`,i=Vt.get(o);if(i===void 0){let a=0,s=0;for(let l=0;l<r.length;l++){let c=r.charCodeAt(l);oo(c)?a+=ro(c):s+=ro(c)}i=a+s*(n>=600?1.07:1),Vt.size>5e3&&Vt.clear(),Vt.set(o,i)}return i*t}function Ut(e,t,n,r=400){if(e=e.trim(),xe(e,n,r)<=t)return e;let o="…",i=0,a=e.length;for(;i<a;){let l=i+a+1>>1;xe(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<(oo(s.charCodeAt(0))?2:3)?"":s+o}var ao=F(Y(),1),ns=e=>Array.isArray(e)&&e.length===2;function io(e){let t=[];for(let n of e??[])n.type==="line"&&typeof n.y=="number"?t.push(n.y):n.type==="band"&&ns(n.y)&&t.push(Number(n.y[0]),Number(n.y[1]));return t.filter(Number.isFinite)}var lo=F(Y(),1),Nn=10.5;function rs(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=>ot(a,{locale:n,maximumFractionDigits:i}))}function so(e,t,n){let r=18;for(let o of rs(e,t,n))r=Math.max(r,xe(o,Nn));return Math.ceil(r+8)}function Rn(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 at(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=Rn(a,n),c=[o,i];for(let m=0;m<4;m++){let u=Math.ceil(i/l-1e-9)*l,g=Math.floor(o/l+1e-9)*l;c=[o===0?0:o-g<=l*.3?g:o-a*s,i===0?0:u-i<=l*.3?u:i+a*s];let f=Rn(c[1]-c[0],n);if(f===l)break;l=f}return c}function co(e,t,n=4){let r=Math.min(e,t),o=Math.max(e,t),i=Rn(o-r,n),a=[],s=Math.ceil(r/i-1e-9)*i;for(let l=s,c=0;l<=o+i*1e-9&&c<200;l+=i,c++)a.push(Number((Math.round(l/i)*i).toPrecision(12)));return a}function Fn(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)=>co(n,r,l),s}function _n(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]=at(r,o,Math.max(n,Math.ceil(o-r)),{zero:!1});return[10**i,10**a]}function os(e,t,n){let r=Math.log10(e),o=Math.log10(t),i=n/Math.max(1e-9,o-r),a=(c,m=1)=>{let u=[];for(let g=Math.floor(r);g<=Math.ceil(o);g++)if(!(g%m))for(let f of c){let h=Number((f*10**g).toPrecision(12));h>=e*(1-1e-9)&&h<=t*(1+1e-9)&&u.push(h)}return u},s=i>=110?a([1,2,5]):a([1],Math.max(1,Math.ceil(24/i)));if(s.length>=2)return s;let l=a([1,2,3,4,5,6,7,8,9]);return l.length>=2?l:co(e,t,3)}function uo(e,t){let n=Fn([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=()=>os(e[0],e[1],Math.abs(t[1]-t[0])),r}function gt(e){let t=1/0,n=-1/0;for(let r of e)Number.isFinite(r)&&(r<t&&(t=r),r>n&&(n=r));return t===1/0?[0,1]:[t,n]}var is=864e5;function mo(e,t,n,r=ye){let o=t-e;if(!(o>0))return[{t:e,label:ht(e,{locale:r,month:"short",day:"numeric"})}];let i=o/is,a=[],s=new Date(e),l=new Date(e).getFullYear()===new Date(t).getFullYear(),c=(m,u,g,f=!1)=>{let h=new Date(m),p=-1,C=0;for(;h.getTime()<=t&&C++<500;){if(h.getTime()>=e){let x=h.getFullYear(),k=f&&!l&&x!==p;a.push({t:h.getTime(),label:ht(h,{locale:r,...g,...k?{year:"numeric"}:{}})}),p=x}u(h)}};if(i<=1.5){let m=Math.max(1,Math.ceil(o/36e5/Math.max(1,n))),u=[1,2,3,4,6,12].find(f=>f>=m)??12,g=new Date(s);g.setMinutes(0,0,0),c(g,f=>f.setHours(f.getHours()+u),{hour:"numeric"})}else if(i<=n*1.2){let m=new Date(s.getFullYear(),s.getMonth(),s.getDate());c(m,u=>u.setDate(u.getDate()+1),{month:"numeric",day:"numeric"})}else if(i<=n*7*1.2){let m=new Date(s.getFullYear(),s.getMonth(),s.getDate());m.setDate(m.getDate()+(8-m.getDay())%7),c(m,u=>u.setDate(u.getDate()+7),{month:"numeric",day:"numeric"})}else{let m=i/30.44,u=Math.max(1,Math.ceil(m/Math.max(1,n))),g=[1,2,3,6,12,24,60].find(f=>f>=u)??120;if(g>=12){let f=new Date(s.getFullYear()+(s.getMonth()>0||s.getDate()>1?1:0),0,1);c(f,h=>h.setFullYear(h.getFullYear()+g/12),{year:"numeric"})}else{let f=new Date(s.getFullYear(),s.getMonth()+(s.getDate()>1?1:0),1),h=f.getMonth()%g;h&&f.setMonth(f.getMonth()+(g-h)),c(f,p=>p.setMonth(p.getMonth()+g),{month:"short"},!0)}}return a}function fo(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 as=(e,t,n)=>e==="date"?Dt(t,n)?.getTime()??NaN:Oe(t);function ss(e){let t=e.filter(n=>n!=null&&n!=="");return t.length?t.every(n=>n instanceof Date)||t.every(n=>typeof n=="string"&&Lr(n.trim()))?"date":t.every(n=>typeof n=="number"||typeof n=="string"&&/^-?\d+(\.\d+)?$/.test(n.trim()))?"number":"band":"band"}function pt(e,t,n,r,o={}){let i=Ze(t,"x"),a=Array.isArray(n),s=a?n:null,l=a?null:Ze(n,"y"),c=!a&&r!==void 0?Ze(r,"series"):null,m=e.map((A,v)=>i(A,v)),u=o.xType??ss(m),g=o.locale??ye,f,h,p;if(u==="band"){let A=m.map(N=>String(N??""));f=Pe(A);let v=new Map(f.map((N,G)=>[N,G]));h=f.map((N,G)=>G),p=Int32Array.from(A,N=>v.get(N)??-1)}else{let A=u==="date"?o.dayFirst??Dr(m):void 0,v=m.map(X=>as(u,X,A)),N=Array.from(new Set(v.filter(X=>Number.isFinite(X)))).sort((X,Te)=>X-Te),G=new Map(N.map((X,Te)=>[X,Te]));h=N,f=N.map(String),p=Int32Array.from(v,X=>G.get(X)??-1)}let C=o.dateFormat,x=A=>typeof A=="string"?Lt(A.trim())?.[3]:void 0,k=u==="date"&&m.length<5e3?x(m[0]):void 0,w=(k===2||k===3)&&m.every(A=>x(A)===k),M=w&&k===3;if(u==="date"&&!C){let A=h.length>1?h[h.length-1]-h[0]:0;C=w&&k===2||A>864e5*120?{month:"short"}:A<864e5*2?{month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit"}:{month:"numeric",day:"numeric"},A>864e5*800&&(C={year:"numeric",month:"short"})}let b;if(u==="band")b=f;else if(M&&!o.dateFormat){let A=ie(g)==="ko";b=h.map(v=>{let N=new Date(v),G=Math.floor(N.getMonth()/3)+1;return A?`${N.getFullYear()}년 ${G}분기`:`Q${G} ${N.getFullYear()}`})}else{let A=h.every(xn),v=u==="date"?new Intl.DateTimeFormat(g,C):new Intl.NumberFormat(g,A?{useGrouping:!1}:{maximumFractionDigits:6});b=h.length>1e3?fo(h.length,N=>v.format(h[N])):h.map(N=>v.format(N))}let P=s?[...s]:c?Pe(e.map((A,v)=>String(c(A,v)??""))):[""],U=new Map(P.map((A,v)=>[A,v])),j=P.map(()=>new Array(f.length).fill(NaN)),R=P.map(()=>new Array(f.length).fill(null)),J=o.aggregate??"sum",O=J==="mean"?P.map(()=>new Uint32Array(f.length)):null,L=(A,v,N,G)=>{let X=j[A][v];J==="last"?j[A][v]=N:J==="count"?j[A][v]=(Number.isFinite(X)?X:0)+1:J==="mean"?Number.isFinite(N)&&(j[A][v]=(Number.isFinite(X)?X:0)+N,O[A][v]++):j[A][v]=Number.isFinite(X)?X+(Number.isFinite(N)?N:0):N,R[A][v]=G};for(let A=0;A<e.length;A++){let v=p[A];if(v<0)continue;let N=e[A];if(s)for(let G=0;G<s.length;G++)L(G,v,Oe(N[s[G]]),N);else{let G=c?U.get(String(c(N,A)??""))??0:0;L(G,v,Oe(l(N,A)),N)}}if(O)for(let A=0;A<j.length;A++)for(let v=0;v<f.length;v++)O[A][v]>1&&(j[A][v]/=O[A][v]);return{type:u,keys:f,xnum:h,labels:b,series:P,values:j,rows:R}}var ls=140,yt=12,ho=14,Pn=20,go=12.5;function cs(e,t,n=Ur){let r=be(t,t),o=new Map;e.forEach((a,s)=>{let l=r(a,s),c=o.get(l);c?c.push(a):o.set(l,[a])});let i=[...o.keys()].slice(0,n);return{values:i,groups:i.map(a=>o.get(a)),dropped:Math.max(0,o.size-n)}}function us(e,t,n){if(t<1)return 1;let r=Math.max(1,Math.floor((e+yt)/(ls+yt))),o=Math.max(1,Math.min(r,Number.isInteger(n)&&n>=1?n:r,t));return Math.ceil(t/Math.ceil(t/o))}function ms(e,t,n){let r=Math.max(40,Math.floor((e-(t-1)*yt)/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 bt=e=>e.filter(Number.isFinite);function Xt(e,t){let n=[];for(let r of Array.isArray(t)?t:t===void 0?[]:[t]){let o=Ke(r,String(r));e.forEach((i,a)=>n.push(o(i,a)))}return bt(n)}function po(e,t,n,r,o,i){return pt(t,n.x,r,o,{xType:e==="bar"?"band":n.xType,aggregate:i,dayFirst:n.dayFirst})}function ds(e,t,n,r,o,i){let a=Math.max(2,Math.round(i/70)),s=r.yScale==="log"&&(e==="line"||e==="scatter"),l=r.yDomain,c=l&&(!s||l[0]>0&&l[1]>0)?l:void 0;if(e==="scatter"){let b=t.flat(),P=r.refLines??{},[U,j]=gt([...Xt(b,r.x??"x"),...bt([Number(P.x)])]),[R,J]=gt([...Xt(b,r.y??"y"),...bt([Number(P.y)])].filter(L=>!s||L>0)),O=r.zero??!1;return{y:c??(s?_n(R,J,a):at(R,J,a,{zero:O,pad:.08})),x:r.xDomain??at(U,j,Math.max(2,Math.round(o/110)),{zero:O,pad:.06}),sameKeys:!0}}let m=e==="bar",u=m&&r.orientation==="horizontal",g=n[0]?.keys.join(""),f=n.every(b=>b.keys.join("")===g),h=n.length>0&&n.every(b=>b.type!=="band"&&b.type===n[0].type),p=r.xDomain??(!m&&h?gt(n.flatMap(b=>bt(b.xnum))):void 0),C=m?r.layout??"grouped":e==="area"?r.stack??"auto":"none";if(C==="percent")return{x:p,sameKeys:f};if(c)return{y:c,x:p,sameKeys:f};let x=[];t.forEach((b,P)=>{let U=n[P];if(C==="stacked"||C==="auto"&&U.series.length>1){let R=An(U.values,"zero");R.y0.forEach(J=>x.push(...J)),R.y1.forEach(J=>x.push(...J))}else U.values.forEach(R=>x.push(...R));m&&!u&&r.line!==void 0&&po(e,b,r,[].concat(r.line),void 0,r.series===void 0?r.aggregate:"mean").values.forEach(R=>x.push(...R)),m||x.push(...Xt(b,r.lower),...Xt(b,r.upper))}),m&&x.push(0),u||x.push(...io(r.annotations));for(let b of r.referenceLines??[])x.push(b.y);r.signColors&&x.push(Number(r.baseline??0));let[k,w]=gt(bt(x).filter(b=>!s||b>0));return{y:s?_n(k,w,a):m?at(k,w,u?Math.max(2,Math.round(o/120)):a):at(k,w,a,{zero:r.zero??e==="area"}),x:p,sameKeys:f}}function fs(e,t,n,r,o,i,a,s){if(e!=="line"&&e!=="area"||!o.x||!o.y)return;let l=pt(t.flat(),r.x,r.y,void 0,{xType:r.xType,locale:s,dayFirst:r.dayFirst}),c=(r.yScale==="log"&&e==="line"?uo:Fn)(o.y,[a-22,10]).ticks(Math.max(2,Math.round(a/70))),m=so(c,Rr(r.format,s,Math.max(Math.abs(o.y[0]),Math.abs(o.y[1]))),s),u=n.flatMap(b=>b.series),g=r.endLabels??n.some(b=>b.series.length>1),f=m+6,h=i-(g?Math.min(i*.28,Math.max(...u.map(b=>xe(b,11,700)),20)+14):10),p=l.keys.length,[C,x]=o.x[1]===o.x[0]?[o.x[0],o.x[0]+1]:o.x,k=l.type==="number"?p>12:p>mo(C,x,Math.max(2,Math.floor((h-f)/64)),s).length;if(l.type==="band"||!p||k)return;let w=b=>f+(l.xnum[b]-C)/(x-C)*(h-f),M=b=>xe(l.labels[b],Nn);for(let b=1;;b++){let P=Array.from({length:Math.ceil(p/b)},(U,j)=>j*b);if(b>=p||P.every((U,j)=>!j||w(U)-w(P[j-1])>=(M(U)+M(P[j-1]))/2+8))return P.map(U=>({value:l.xnum[U],label:l.labels[U]}))}}function hs(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 gs(e,t,n,r){let o=[n.x,n.y,n.series].map(i=>JSON.stringify(i??null)).join("|");return`ztd-facet-${hs(`${e}|${t}|${o}|${Wt(r)}`)}`}function ps(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 bs={en:{intro:(e,t)=>`${Ne(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:"(빈 값)"}},Ln=18;function bo(e){let{type:t,chartProps:n}=e,{values:r,groups:o,dropped:i}=cs(e.data,e.by),a=r.length,s=typeof e.width=="number"&&Number.isFinite(e.width)&&e.width>0?e.width:480,l=us(s,a,e.columns),{pw:c,ph:m}=ms(s,l,e.height),u=e.scale!=="free",g=t==="scatter"?[]:o.map(O=>po(t,O,n,n.y,n.series,n.aggregate)),f=u?ds(t,o,g,n,c,m):{sameKeys:!1},h=u?fs(t,o,g,n,f,c,m,e.locale):void 0,p=t==="bar"&&n.orientation==="horizontal",C=u&&(!p||f.sameKeys),x=u&&(p||f.x!==void 0||f.sameKeys),k=new Set(ps(e.highlight,r)?[e.highlight].flat():[]),w=k.size>0,M=t==="bar"&&!Array.isArray(n.y)&&n.series===void 0||t==="scatter"&&n.series===void 0,b=e.syncId??gs(t,e.by,n,e.data),P=Pt(Je(n.format,e.locale),n.unit),U=bs[e.lang],j=[],R=r.map(O=>O===""?U.blank:O);return{panels:r.map((O,L)=>{let A=o[L],v=R[L],N=L%l,G;if(t!=="scatter"){let Te=g[L],He=Me=>Te.values.reduce((de,ut)=>de+(Number.isFinite(ut[Me])?ut[Me]:0),0),Z=Te.keys.map((Me,de)=>de).filter(Me=>Te.values.some(de=>Number.isFinite(de[Me]))),ke=Z[Z.length-1];j.push({first:Z.length?He(Z[0]):NaN,last:Z.length?He(ke):NaN,total:Z.reduce((Me,de)=>Me+He(de),0)}),t!=="bar"&&Te.series.length===1&&ke!==void 0&&(G=P(Te.values[0][ke]))}else j.push({first:NaN,last:NaN,total:A.length});let X={data:A,width:c,height:m,ariaLabel:e.title?`${e.title}, ${v}`:v,syncId:b,highlight:w?k.has(O)?M?()=>!0:void 0:"none":e.highlight,showYAxis:!C||N===0,showXAxis:!x||L+l>=a};return f.y&&(X.yDomain=f.y),f.x&&(X.xDomain=f.x),h&&(X.xTicks=h),{value:O,label:v,props:X,last:G,isPicked:k.has(O)}}),cols:l,pw:c,ph:m,isPanelPick:w,description:ys(t,e.by,R,j,i,P,U)}}function ys(e,t,n,r,o,i,a){let s=a.intro(n.length,t),l=c=>no(r.map(m=>m[c]));if(e==="line"||e==="area"){let c=l("last");c>=0&&(s+=a.endHigh(n[c],i(r[c].last)));let m=n.filter((u,g)=>r[g].last<r[g].first);s+=m.length?a.falling(`${m.slice(0,5).join(", ")}${m.length>5?a.more:""}`):a.noneFalling}else{let c=l("total");c>=0&&(s+=e==="bar"?a.total(n[c],i(r[c].total)):a.points(n[c],r[c].total))}return o&&(s+=a.dropped(n.length,n.length+o)),s}var $e=F(re(),1);function xs(e){return[...new Set([0,.01,.02,.05,.1,.15,.2,e].filter(t=>t<=e))].sort((t,n)=>t-n)}function ks(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 Yt={threshold:.25,enoughPx:96,rootMargin:"0px"};function ko(e,t=!0){let[n,r]=(0,$e.useState)({visible:!t,near:!t});return(0,$e.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=ks(a[a.length-1],Yt.threshold,Yt.enoughPx);r(l=>l.visible===s?l:{...l,visible:s,near:l.near||s})},{threshold:xs(Yt.threshold),rootMargin:Yt.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 yo(e){let t=e.getBoundingClientRect().width;return t>0?Math.round(t*10)/10:0}function Jt(e){let[t,n]=(0,$e.useState)(null),[r,o]=(0,$e.useState)(e??null),i=(0,$e.useCallback)(a=>{n(a),a&&e===void 0&&o(yo(a))},[e]);return Ee(()=>{if(e!==void 0){o(e);return}if(!t)return;let a=c=>o(m=>m!==null&&Math.abs(m-c)<.5?m:c),s=()=>a(yo(t));if(typeof ResizeObserver>"u")return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s);let l=new ResizeObserver(c=>{let m=c[c.length-1]?.contentRect;m?a(m.width>0?Math.round(m.width*10)/10:0):s()});return l.observe(t),()=>l.disconnect()},[t,e]),[t,i,r]}var ws=()=>()=>{};function st(){return(0,$e.useSyncExternalStore)(ws,()=>!0,()=>!1)}var xo="(prefers-reduced-motion: reduce)";function Zt(e="auto"){let[t,n]=(0,$e.useState)(()=>Ae&&typeof window.matchMedia=="function"?window.matchMedia(xo).matches:!1);return(0,$e.useEffect)(()=>{if(e!=="auto"||!Ae||typeof window.matchMedia!="function")return;let r=window.matchMedia(xo),o=()=>n(r.matches);return o(),r.addEventListener?.("change",o),()=>r.removeEventListener?.("change",o)},[e]),e===!0?!0:e===!1?!1:t}var Le=F(Y(),1),vs=60,$s=420;function wo(e){let t=_e(),n=e.chartProps??{},[,r,o]=Jt(e.width),i=e.width??(o||480),a=we(e.locale??n.locale),s=ie(a),l=(0,lt.useContext)(tt),c=e.title??l,m=e.chart.facetPlan,u=(0,lt.useMemo)(()=>{let x=bo({type:e.type,data:e.data,by:e.by,columns:e.columns,scale:e.scale,chartProps:n,highlight:e.highlight,syncId:e.syncId,width:i,height:e.height,title:c,locale:a,lang:s});return m?m(x,n,a):x},[e.type,e.data,e.by,e.columns,e.scale,JSON.stringify(n,(x,k)=>typeof k=="function"?String(k):k),e.highlight,e.syncId,i,e.height,c,a,s,m]),g=`${(0,lt.useId)().replace(/:/g,"")}fd`,f=Zt(n.reducedMotion??"auto"),h=st(),p=hr({motion:{enabled:n.animate!==!1&&!f&&Ae},hydrated:h},{waiting:!1,generation:0}),C=e.chart;return(0,Le.jsxs)("div",{ref:r,role:"group","aria-label":c,"aria-describedby":g,className:e.className,style:{position:"relative",width:"100%",...e.style},children:[(0,Le.jsx)("p",{id:g,style:Ht,children:e.description??u.description}),(0,Le.jsx)("div",{style:{display:"grid",gridTemplateColumns:`repeat(${u.cols}, minmax(0, 1fr))`,columnGap:yt,rowGap:ho,...u.legend?{marginTop:Ln}:null},children:u.panels.map((x,k)=>{let w=t.paint(x.isPicked?"accentText":u.isPanelPick?"muted":"ink");return(0,Le.jsxs)("div",{"data-facet":x.value,style:{minWidth:0,...fr(p,!1,"fade",k*vs,$s)},children:[(0,Le.jsxs)("div",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,height:Pn,fontSize:go,fontWeight:700,lineHeight:`${Pn}px`,color:w},children:[(0,Le.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x.label}),x.last!==void 0?(0,Le.jsx)("span",{style:{flex:"none",fontVariantNumeric:"tabular-nums"},children:x.last}):null]}),(0,Le.jsx)(C,{...n,...x.props})]},x.value)})}),u.legend?(0,Le.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",top:0,right:0,height:Ln},children:u.legend}):null]})}var Qt=["max","min","first","last","none"];function De(e,t,n,r,o="max"){let i=new Set,a=n.length,s=c=>{if(a&&c!=="none"){if(c==="first")i.add(0);else if(c==="last")i.add(a-1);else if(c==="max"||c==="min"){let m=-1,u=c==="max"?-1/0:1/0;r.forEach((g,f)=>{Number.isFinite(g)&&(c==="max"?g>u:g<u)&&(u=g,m=f)}),m>=0&&i.add(m)}}};if(e==null)return s(o),i;if(typeof e=="function")return t.forEach((c,m)=>{m<a&&c!==null&&c!==void 0&&e(c,m)&&i.add(m)}),i;let l=Array.isArray(e)?e:[e];for(let c of l)typeof c=="number"?c>=0&&c<a&&i.add(c):c==="max"||c==="min"||c==="first"||c==="last"||c==="none"?s(c):n.forEach((m,u)=>{m===c&&i.add(u)});return i}var Se=F(re(),1);async function Ts(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(ie(r)==="ko"?`데이터 대신 HTML 페이지를 받았어요. 주소를 확인해 주세요${n?`: ${n}`:"."}`:`Got an HTML page instead of data${n?` (${n})`:""}. Check the URL.`);if(t==="csv")return Qe(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 Qe(i);let a=i.trim();return a.startsWith("{")||a.startsWith("[")?JSON.parse(a):Qe(i)}async function Ms(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 Ts(i,t.parse,o,t.locale)}return t.select&&(r=qr(r,t.select)),t.transform?t.transform(r):Ve(r)}function vo(e,t={}){let{refreshMs:n,enabled:r=!0,keepPrevious:o=!0}=t,[i,a]=(0,Se.useState)(()=>({data:[],status:e&&r?"loading":"idle",error:null,updatedAt:null})),[s,l]=(0,Se.useState)(0),c=we(t.locale),m=(0,Se.useRef)(t);m.current={...t,locale:c};let u=(0,Se.useRef)(e);u.current=e;let g=typeof e=="function"?"fn":e instanceof Request?e.url:e?String(e):"",f=t.deps??[],h=JSON.stringify(f.map(x=>typeof x=="object"?JSON.stringify(x):String(x))),p=(0,Se.useRef)(!1);(0,Se.useEffect)(()=>{let x=u.current;if(!x||!r){a(M=>M.status==="loading"?{...M,status:"idle"}:M);return}let k=new AbortController,w=!0;return p.current=!0,a(M=>({...M,data:o?M.data:[],status:"loading",error:null})),Ms(x,{...m.current,signal:k.signal}).then(M=>{w&&a({data:M,status:"success",error:null,updatedAt:Date.now()})}).catch(M=>{!w||k.signal.aborted||a(b=>({...b,status:"error",error:M instanceof Error?M:new Error(String(M))}))}).finally(()=>{w&&(p.current=!1)}),()=>{w=!1,p.current=!1,k.abort()}},[g,r,s,h,o]),(0,Se.useEffect)(()=>{if(!n||!r)return;let x=setInterval(()=>{p.current||l(k=>k+1)},n);return()=>clearInterval(x)},[n,r]);let C=(0,Se.useCallback)(()=>l(x=>x+1),[]);return{data:i.data,status:i.status,loading:i.status==="loading",error:i.error,empty:i.status==="success"&&i.data.length===0,updatedAt:i.updatedAt,reload:C}}var En=F(Y(),1),Cs=["csv","svg","png"],Ss=/^[=+\-@\t\r\n=+-@]/,As=/var\(|color-mix\(/;function $o(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?Fr(e.getTime()):String(e);return`"${(Ss.test(t)&&!Number.isFinite(Oe(t))?`'${t}`:t).replace(/"/g,'""')}"`}function Ns(e){return[...new Set(e.slice(0,200).flatMap(t=>t&&typeof t=="object"?Object.keys(t):[]))]}function Rs(e,t){return`\uFEFF${[t.map($o),...e.map(r=>t.map(o=>$o(r[o])))].map(r=>r.join(",")).join(`\r
|
|
25
|
+
`&&h++,s.push(l),a.push(s),s=[],l=""):l+=p}(l!==""||s.length)&&(s.push(l),a.push(s));let m=a.filter(h=>!(h.length===1&&h[0].trim()===""));if(!m.length)return[];let u=h=>n?Qr(h):h;if(!r)return m.map(h=>Object.fromEntries(h.map((p,S)=>[String(S),u(p)])));let g=[],f=new Set;return m[0].forEach((h,p)=>{let S=h.trim()||`col${p+1}`,x=S;for(let k=2;f.has(x);k++)x=`${S}_${k}`;f.add(x),g.push(x)}),m.slice(1).map(h=>Object.fromEntries(g.map((p,S)=>[p,u(h[S]??"")])))}function Cn(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"?Qr(a[l]):a[l]??null])))}function ts(e,t={}){let{labelKey:n="label",valueKey:r="value"}=t,o=Object.values(e);if(o.length&&o.every(i=>Array.isArray(i))){let i=Object.keys(e),a=Math.max(...o.map(s=>s.length));return Array.from({length:a},(s,l)=>Object.fromEntries(i.map(c=>[c,e[c][l]??null])))}return Object.entries(e).map(([i,a])=>({[n]:i,[r]:a}))}function qr(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 Ve(e){if(e==null)return[];if(typeof e=="string"){let t=e.trim();if(!t)return[];if(t.startsWith("[")||t.startsWith("{"))try{return Ve(JSON.parse(t))}catch{}return Qe(t)}if(Array.isArray(e))return e.length?Array.isArray(e[0])?Cn(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)?Ve(t.data):Array.isArray(t.rows)&&Array.isArray(t.columns)?Cn(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)?Ve(t.rows):Array.isArray(t.values)?Cn(t.values):Array.isArray(t.items)?Ve(t.items):Array.isArray(t.results)?Ve(t.results):ts(t)}return[]}function Wt(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 An(e,t="zero"){let n=e.length,r=n?e[0].length:0,o=e.map(()=>new Array(r).fill(0)),i=e.map(()=>new Array(r).fill(0)),a=(l,c)=>{let m=e[l][c];return Number.isFinite(m)&&m>0?m:0},s=new Array(r).fill(0);if(t==="wiggle"&&n>0&&r>1){let l=0;for(let c=1;c<r;c++){let m=0,u=0;for(let g=0;g<n;g++){let f=a(g,c),h=f-a(g,c-1),p=0;for(let S=0;S<g;S++)p+=a(S,c)-a(S,c-1);m+=f,u+=(h/2+p)*f}m&&(l-=u/m),s[c]=l}}for(let l=0;l<r;l++){if(t==="zero"){let u=0,g=0;for(let f=0;f<n;f++){let h=e[f][l],p=Number.isFinite(h)?h:0;p>=0?(o[f][l]=u,u+=p,i[f][l]=u):(o[f][l]=g,g+=p,i[f][l]=g)}continue}let c=0;for(let u=0;u<n;u++)c+=a(u,l);let m=t==="silhouette"?-c/2:s[l];for(let u=0;u<n;u++){let g=a(u,l);t==="expand"&&(g=c?g/c*100:0),o[u][l]=m,m+=g,i[u][l]=m}}if(t==="wiggle"&&r){let l=1/0,c=-1/0;for(let u=0;u<r;u++)l=Math.min(l,o[0]?.[u]??0),c=Math.max(c,i[n-1]?.[u]??0);let m=0;for(let u=0;u<r;u++)m+=((o[0]?.[u]??0)+(i[n-1]?.[u]??0))/2;m/=r;for(let u=0;u<n;u++)for(let g=0;g<r;g++)o[u][g]-=m,i[u][g]-=m}return{y0:o,y1:i}}function eo(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 to(e){let t=e.length,n=e.map(c=>{let m=0,u=-1/0;return c.forEach((g,f)=>{g>u&&(u=g,m=f)}),m}),r=e.map(c=>c.reduce((m,u)=>m+(Number.isFinite(u)?u:0),0)),o=Array.from({length:t},(c,m)=>m).sort((c,m)=>n[c]-n[m]),i=[],a=[],s=0,l=0;for(let c of o)s<l?(i.push(c),s+=r[c]):(a.push(c),l+=r[c]);return[...a.reverse(),...i]}var qe=Math.PI*2;function ze(e,t,n){return e<t?t:e>n?n:e}function Kt(e){let t=0;for(let n of e)Number.isFinite(n)&&(t+=n);return t}function et(e,t,n,r){return[e+n*Math.sin(r),t-n*Math.cos(r)]}function no(e){let t=-1,n=-1/0;return e.forEach((r,o)=>{r>n&&(n=r,t=o)}),t}function oo(e){return e>=44032&&e<=55203||e>=4352&&e<=4607||e>=12592&&e<=12687||e>=19968&&e<=40959}function ro(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 Vt=new Map;function xe(e,t,n=400){let r=String(e),o=`${r}|${n>=600?1:0}`,i=Vt.get(o);if(i===void 0){let a=0,s=0;for(let l=0;l<r.length;l++){let c=r.charCodeAt(l);oo(c)?a+=ro(c):s+=ro(c)}i=a+s*(n>=600?1.07:1),Vt.size>5e3&&Vt.clear(),Vt.set(o,i)}return i*t}function Ut(e,t,n,r=400){if(e=e.trim(),xe(e,n,r)<=t)return e;let o="…",i=0,a=e.length;for(;i<a;){let l=i+a+1>>1;xe(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<(oo(s.charCodeAt(0))?2:3)?"":s+o}var ao=F(Y(),1),ns=e=>Array.isArray(e)&&e.length===2;function io(e){let t=[];for(let n of e??[])n.type==="line"&&typeof n.y=="number"?t.push(n.y):n.type==="band"&&ns(n.y)&&t.push(Number(n.y[0]),Number(n.y[1]));return t.filter(Number.isFinite)}var lo=F(Y(),1),Nn=10.5;function rs(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=>ot(a,{locale:n,maximumFractionDigits:i}))}function so(e,t,n){let r=18;for(let o of rs(e,t,n))r=Math.max(r,xe(o,Nn));return Math.ceil(r+8)}function Rn(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 at(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=Rn(a,n),c=[o,i];for(let m=0;m<4;m++){let u=Math.ceil(i/l-1e-9)*l,g=Math.floor(o/l+1e-9)*l;c=[o===0?0:o-g<=l*.3?g:o-a*s,i===0?0:u-i<=l*.3?u:i+a*s];let f=Rn(c[1]-c[0],n);if(f===l)break;l=f}return c}function co(e,t,n=4){let r=Math.min(e,t),o=Math.max(e,t),i=Rn(o-r,n),a=[],s=Math.ceil(r/i-1e-9)*i;for(let l=s,c=0;l<=o+i*1e-9&&c<200;l+=i,c++)a.push(Number((Math.round(l/i)*i).toPrecision(12)));return a}function Fn(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)=>co(n,r,l),s}function _n(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]=at(r,o,Math.max(n,Math.ceil(o-r)),{zero:!1});return[10**i,10**a]}function os(e,t,n){let r=Math.log10(e),o=Math.log10(t),i=n/Math.max(1e-9,o-r),a=(c,m=1)=>{let u=[];for(let g=Math.floor(r);g<=Math.ceil(o);g++)if(!(g%m))for(let f of c){let h=Number((f*10**g).toPrecision(12));h>=e*(1-1e-9)&&h<=t*(1+1e-9)&&u.push(h)}return u},s=i>=110?a([1,2,5]):a([1],Math.max(1,Math.ceil(24/i)));if(s.length>=2)return s;let l=a([1,2,3,4,5,6,7,8,9]);return l.length>=2?l:co(e,t,3)}function uo(e,t){let n=Fn([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=()=>os(e[0],e[1],Math.abs(t[1]-t[0])),r}function gt(e){let t=1/0,n=-1/0;for(let r of e)Number.isFinite(r)&&(r<t&&(t=r),r>n&&(n=r));return t===1/0?[0,1]:[t,n]}var is=864e5;function mo(e,t,n,r=ye){let o=t-e;if(!(o>0))return[{t:e,label:ht(e,{locale:r,month:"short",day:"numeric"})}];let i=o/is,a=[],s=new Date(e),l=new Date(e).getFullYear()===new Date(t).getFullYear(),c=(m,u,g,f=!1)=>{let h=new Date(m),p=-1,S=0;for(;h.getTime()<=t&&S++<500;){if(h.getTime()>=e){let x=h.getFullYear(),k=f&&!l&&x!==p;a.push({t:h.getTime(),label:ht(h,{locale:r,...g,...k?{year:"numeric"}:{}})}),p=x}u(h)}};if(i<=1.5){let m=Math.max(1,Math.ceil(o/36e5/Math.max(1,n))),u=[1,2,3,4,6,12].find(f=>f>=m)??12,g=new Date(s);g.setMinutes(0,0,0),c(g,f=>f.setHours(f.getHours()+u),{hour:"numeric"})}else if(i<=n*1.2){let m=new Date(s.getFullYear(),s.getMonth(),s.getDate());c(m,u=>u.setDate(u.getDate()+1),{month:"numeric",day:"numeric"})}else if(i<=n*7*1.2){let m=new Date(s.getFullYear(),s.getMonth(),s.getDate());m.setDate(m.getDate()+(8-m.getDay())%7),c(m,u=>u.setDate(u.getDate()+7),{month:"numeric",day:"numeric"})}else{let m=i/30.44,u=Math.max(1,Math.ceil(m/Math.max(1,n))),g=[1,2,3,6,12,24,60].find(f=>f>=u)??120;if(g>=12){let f=new Date(s.getFullYear()+(s.getMonth()>0||s.getDate()>1?1:0),0,1);c(f,h=>h.setFullYear(h.getFullYear()+g/12),{year:"numeric"})}else{let f=new Date(s.getFullYear(),s.getMonth()+(s.getDate()>1?1:0),1),h=f.getMonth()%g;h&&f.setMonth(f.getMonth()+(g-h)),c(f,p=>p.setMonth(p.getMonth()+g),{month:"short"},!0)}}return a}function fo(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 as=(e,t,n)=>e==="date"?Dt(t,n)?.getTime()??NaN:Oe(t);function ss(e){let t=e.filter(n=>n!=null&&n!=="");return t.length?t.every(n=>n instanceof Date)||t.every(n=>typeof n=="string"&&Lr(n.trim()))?"date":t.every(n=>typeof n=="number"||typeof n=="string"&&/^-?\d+(\.\d+)?$/.test(n.trim()))?"number":"band":"band"}function pt(e,t,n,r,o={}){let i=Ze(t,"x"),a=Array.isArray(n),s=a?n:null,l=a?null:Ze(n,"y"),c=!a&&r!==void 0?Ze(r,"series"):null,m=e.map((A,v)=>i(A,v)),u=o.xType??ss(m),g=o.locale??ye,f,h,p;if(u==="band"){let A=m.map(N=>String(N??""));f=Pe(A);let v=new Map(f.map((N,G)=>[N,G]));h=f.map((N,G)=>G),p=Int32Array.from(A,N=>v.get(N)??-1)}else{let A=u==="date"?o.dayFirst??Dr(m):void 0,v=m.map(X=>as(u,X,A)),N=Array.from(new Set(v.filter(X=>Number.isFinite(X)))).sort((X,Te)=>X-Te),G=new Map(N.map((X,Te)=>[X,Te]));h=N,f=N.map(String),p=Int32Array.from(v,X=>G.get(X)??-1)}let S=o.dateFormat,x=A=>typeof A=="string"?Lt(A.trim())?.[3]:void 0,k=u==="date"&&m.length<5e3?x(m[0]):void 0,w=(k===2||k===3)&&m.every(A=>x(A)===k),M=w&&k===3;if(u==="date"&&!S){let A=h.length>1?h[h.length-1]-h[0]:0;S=w&&k===2||A>864e5*120?{month:"short"}:A<864e5*2?{month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit"}:{month:"numeric",day:"numeric"},A>864e5*800&&(S={year:"numeric",month:"short"})}let b;if(u==="band")b=f;else if(M&&!o.dateFormat){let A=ie(g)==="ko";b=h.map(v=>{let N=new Date(v),G=Math.floor(N.getMonth()/3)+1;return A?`${N.getFullYear()}년 ${G}분기`:`Q${G} ${N.getFullYear()}`})}else{let A=h.every(xn),v=u==="date"?new Intl.DateTimeFormat(g,S):new Intl.NumberFormat(g,A?{useGrouping:!1}:{maximumFractionDigits:6});b=h.length>1e3?fo(h.length,N=>v.format(h[N])):h.map(N=>v.format(N))}let P=s?[...s]:c?Pe(e.map((A,v)=>String(c(A,v)??""))):[""],U=new Map(P.map((A,v)=>[A,v])),j=P.map(()=>new Array(f.length).fill(NaN)),R=P.map(()=>new Array(f.length).fill(null)),J=o.aggregate??"sum",O=J==="mean"?P.map(()=>new Uint32Array(f.length)):null,L=(A,v,N,G)=>{let X=j[A][v];J==="last"?j[A][v]=N:J==="count"?j[A][v]=(Number.isFinite(X)?X:0)+1:J==="mean"?Number.isFinite(N)&&(j[A][v]=(Number.isFinite(X)?X:0)+N,O[A][v]++):j[A][v]=Number.isFinite(X)?X+(Number.isFinite(N)?N:0):N,R[A][v]=G};for(let A=0;A<e.length;A++){let v=p[A];if(v<0)continue;let N=e[A];if(s)for(let G=0;G<s.length;G++)L(G,v,Oe(N[s[G]]),N);else{let G=c?U.get(String(c(N,A)??""))??0:0;L(G,v,Oe(l(N,A)),N)}}if(O)for(let A=0;A<j.length;A++)for(let v=0;v<f.length;v++)O[A][v]>1&&(j[A][v]/=O[A][v]);return{type:u,keys:f,xnum:h,labels:b,series:P,values:j,rows:R}}var ls=140,yt=12,ho=14,Pn=20,go=12.5;function cs(e,t,n=Ur){let r=be(t,t),o=new Map;e.forEach((a,s)=>{let l=r(a,s),c=o.get(l);c?c.push(a):o.set(l,[a])});let i=[...o.keys()].slice(0,n);return{values:i,groups:i.map(a=>o.get(a)),dropped:Math.max(0,o.size-n)}}function us(e,t,n){if(t<1)return 1;let r=Math.max(1,Math.floor((e+yt)/(ls+yt))),o=Math.max(1,Math.min(r,Number.isInteger(n)&&n>=1?n:r,t));return Math.ceil(t/Math.ceil(t/o))}function ms(e,t,n){let r=Math.max(40,Math.floor((e-(t-1)*yt)/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 bt=e=>e.filter(Number.isFinite);function Xt(e,t){let n=[];for(let r of Array.isArray(t)?t:t===void 0?[]:[t]){let o=Ke(r,String(r));e.forEach((i,a)=>n.push(o(i,a)))}return bt(n)}function po(e,t,n,r,o,i){return pt(t,n.x,r,o,{xType:e==="bar"?"band":n.xType,aggregate:i,dayFirst:n.dayFirst})}function ds(e,t,n,r,o,i){let a=Math.max(2,Math.round(i/70)),s=r.yScale==="log"&&(e==="line"||e==="scatter"),l=r.yDomain,c=l&&(!s||l[0]>0&&l[1]>0)?l:void 0;if(e==="scatter"){let b=t.flat(),P=r.refLines??{},[U,j]=gt([...Xt(b,r.x??"x"),...bt([Number(P.x)])]),[R,J]=gt([...Xt(b,r.y??"y"),...bt([Number(P.y)])].filter(L=>!s||L>0)),O=r.zero??!1;return{y:c??(s?_n(R,J,a):at(R,J,a,{zero:O,pad:.08})),x:r.xDomain??at(U,j,Math.max(2,Math.round(o/110)),{zero:O,pad:.06}),sameKeys:!0}}let m=e==="bar",u=m&&r.orientation==="horizontal",g=n[0]?.keys.join(""),f=n.every(b=>b.keys.join("")===g),h=n.length>0&&n.every(b=>b.type!=="band"&&b.type===n[0].type),p=r.xDomain??(!m&&h?gt(n.flatMap(b=>bt(b.xnum))):void 0),S=m?r.layout??"grouped":e==="area"?r.stack??"auto":"none";if(S==="percent")return{x:p,sameKeys:f};if(c)return{y:c,x:p,sameKeys:f};let x=[];t.forEach((b,P)=>{let U=n[P];if(S==="stacked"||S==="auto"&&U.series.length>1){let R=An(U.values,"zero");R.y0.forEach(J=>x.push(...J)),R.y1.forEach(J=>x.push(...J))}else U.values.forEach(R=>x.push(...R));m&&!u&&r.line!==void 0&&po(e,b,r,[].concat(r.line),void 0,r.series===void 0?r.aggregate:"mean").values.forEach(R=>x.push(...R)),m||x.push(...Xt(b,r.lower),...Xt(b,r.upper))}),m&&x.push(0),u||x.push(...io(r.annotations));for(let b of r.referenceLines??[])x.push(b.y);r.signColors&&x.push(Number(r.baseline??0));let[k,w]=gt(bt(x).filter(b=>!s||b>0));return{y:s?_n(k,w,a):m?at(k,w,u?Math.max(2,Math.round(o/120)):a):at(k,w,a,{zero:r.zero??e==="area"}),x:p,sameKeys:f}}function fs(e,t,n,r,o,i,a,s){if(e!=="line"&&e!=="area"||!o.x||!o.y)return;let l=pt(t.flat(),r.x,r.y,void 0,{xType:r.xType,locale:s,dayFirst:r.dayFirst}),c=(r.yScale==="log"&&e==="line"?uo:Fn)(o.y,[a-22,10]).ticks(Math.max(2,Math.round(a/70))),m=so(c,Rr(r.format,s,Math.max(Math.abs(o.y[0]),Math.abs(o.y[1]))),s),u=n.flatMap(b=>b.series),g=r.endLabels??n.some(b=>b.series.length>1),f=m+6,h=i-(g?Math.min(i*.28,Math.max(...u.map(b=>xe(b,11,700)),20)+14):10),p=l.keys.length,[S,x]=o.x[1]===o.x[0]?[o.x[0],o.x[0]+1]:o.x,k=l.type==="number"?p>12:p>mo(S,x,Math.max(2,Math.floor((h-f)/64)),s).length;if(l.type==="band"||!p||k)return;let w=b=>f+(l.xnum[b]-S)/(x-S)*(h-f),M=b=>xe(l.labels[b],Nn);for(let b=1;;b++){let P=Array.from({length:Math.ceil(p/b)},(U,j)=>j*b);if(b>=p||P.every((U,j)=>!j||w(U)-w(P[j-1])>=(M(U)+M(P[j-1]))/2+8))return P.map(U=>({value:l.xnum[U],label:l.labels[U]}))}}function hs(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 gs(e,t,n,r){let o=[n.x,n.y,n.series].map(i=>JSON.stringify(i??null)).join("|");return`ztd-facet-${hs(`${e}|${t}|${o}|${Wt(r)}`)}`}function ps(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 bs={en:{intro:(e,t)=>`${Ne(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:"(빈 값)"}},Ln=18;function bo(e){let{type:t,chartProps:n}=e,{values:r,groups:o,dropped:i}=cs(e.data,e.by),a=r.length,s=typeof e.width=="number"&&Number.isFinite(e.width)&&e.width>0?e.width:480,l=us(s,a,e.columns),{pw:c,ph:m}=ms(s,l,e.height),u=e.scale!=="free",g=t==="scatter"?[]:o.map(O=>po(t,O,n,n.y,n.series,n.aggregate)),f=u?ds(t,o,g,n,c,m):{sameKeys:!1},h=u?fs(t,o,g,n,f,c,m,e.locale):void 0,p=t==="bar"&&n.orientation==="horizontal",S=u&&(!p||f.sameKeys),x=u&&(p||f.x!==void 0||f.sameKeys),k=new Set(ps(e.highlight,r)?[e.highlight].flat():[]),w=k.size>0,M=t==="bar"&&!Array.isArray(n.y)&&n.series===void 0||t==="scatter"&&n.series===void 0,b=e.syncId??gs(t,e.by,n,e.data),P=Pt(Je(n.format,e.locale),n.unit),U=bs[e.lang],j=[],R=r.map(O=>O===""?U.blank:O);return{panels:r.map((O,L)=>{let A=o[L],v=R[L],N=L%l,G;if(t!=="scatter"){let Te=g[L],He=Me=>Te.values.reduce((de,ut)=>de+(Number.isFinite(ut[Me])?ut[Me]:0),0),Z=Te.keys.map((Me,de)=>de).filter(Me=>Te.values.some(de=>Number.isFinite(de[Me]))),ke=Z[Z.length-1];j.push({first:Z.length?He(Z[0]):NaN,last:Z.length?He(ke):NaN,total:Z.reduce((Me,de)=>Me+He(de),0)}),t!=="bar"&&Te.series.length===1&&ke!==void 0&&(G=P(Te.values[0][ke]))}else j.push({first:NaN,last:NaN,total:A.length});let X={data:A,width:c,height:m,ariaLabel:e.title?`${e.title}, ${v}`:v,syncId:b,highlight:w?k.has(O)?M?()=>!0:void 0:"none":e.highlight,showYAxis:!S||N===0,showXAxis:!x||L+l>=a};return f.y&&(X.yDomain=f.y),f.x&&(X.xDomain=f.x),h&&(X.xTicks=h),{value:O,label:v,props:X,last:G,isPicked:k.has(O)}}),cols:l,pw:c,ph:m,isPanelPick:w,description:ys(t,e.by,R,j,i,P,U)}}function ys(e,t,n,r,o,i,a){let s=a.intro(n.length,t),l=c=>no(r.map(m=>m[c]));if(e==="line"||e==="area"){let c=l("last");c>=0&&(s+=a.endHigh(n[c],i(r[c].last)));let m=n.filter((u,g)=>r[g].last<r[g].first);s+=m.length?a.falling(`${m.slice(0,5).join(", ")}${m.length>5?a.more:""}`):a.noneFalling}else{let c=l("total");c>=0&&(s+=e==="bar"?a.total(n[c],i(r[c].total)):a.points(n[c],r[c].total))}return o&&(s+=a.dropped(n.length,n.length+o)),s}var $e=F(re(),1);function xs(e){return[...new Set([0,.01,.02,.05,.1,.15,.2,e].filter(t=>t<=e))].sort((t,n)=>t-n)}function ks(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 Yt={threshold:.25,enoughPx:96,rootMargin:"0px"};function ko(e,t=!0){let[n,r]=(0,$e.useState)({visible:!t,near:!t});return(0,$e.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=ks(a[a.length-1],Yt.threshold,Yt.enoughPx);r(l=>l.visible===s?l:{...l,visible:s,near:l.near||s})},{threshold:xs(Yt.threshold),rootMargin:Yt.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 yo(e){let t=e.getBoundingClientRect().width;return t>0?Math.round(t*10)/10:0}function Jt(e){let[t,n]=(0,$e.useState)(null),[r,o]=(0,$e.useState)(e??null),i=(0,$e.useCallback)(a=>{n(a),a&&e===void 0&&o(yo(a))},[e]);return Ee(()=>{if(e!==void 0){o(e);return}if(!t)return;let a=c=>o(m=>m!==null&&Math.abs(m-c)<.5?m:c),s=()=>a(yo(t));if(typeof ResizeObserver>"u")return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s);let l=new ResizeObserver(c=>{let m=c[c.length-1]?.contentRect;m?a(m.width>0?Math.round(m.width*10)/10:0):s()});return l.observe(t),()=>l.disconnect()},[t,e]),[t,i,r]}var ws=()=>()=>{};function st(){return(0,$e.useSyncExternalStore)(ws,()=>!0,()=>!1)}var xo="(prefers-reduced-motion: reduce)";function Zt(e="auto"){let[t,n]=(0,$e.useState)(()=>Ae&&typeof window.matchMedia=="function"?window.matchMedia(xo).matches:!1);return(0,$e.useEffect)(()=>{if(e!=="auto"||!Ae||typeof window.matchMedia!="function")return;let r=window.matchMedia(xo),o=()=>n(r.matches);return o(),r.addEventListener?.("change",o),()=>r.removeEventListener?.("change",o)},[e]),e===!0?!0:e===!1?!1:t}var Le=F(Y(),1),vs=60,$s=420;function wo(e){let t=_e(),n=e.chartProps??{},[,r,o]=Jt(e.width),i=e.width??(o||480),a=we(e.locale??n.locale),s=ie(a),l=(0,lt.useContext)(tt),c=e.title??l,m=e.chart.facetPlan,u=(0,lt.useMemo)(()=>{let x=bo({type:e.type,data:e.data,by:e.by,columns:e.columns,scale:e.scale,chartProps:n,highlight:e.highlight,syncId:e.syncId,width:i,height:e.height,title:c,locale:a,lang:s});return m?m(x,n,a):x},[e.type,e.data,e.by,e.columns,e.scale,JSON.stringify(n,(x,k)=>typeof k=="function"?String(k):k),e.highlight,e.syncId,i,e.height,c,a,s,m]),g=`${(0,lt.useId)().replace(/:/g,"")}fd`,f=Zt(n.reducedMotion??"auto"),h=st(),p=hr({motion:{enabled:n.animate!==!1&&!f&&Ae},hydrated:h},{waiting:!1,generation:0}),S=e.chart;return(0,Le.jsxs)("div",{ref:r,role:"group","aria-label":c,"aria-describedby":g,className:e.className,style:{position:"relative",width:"100%",...e.style},children:[(0,Le.jsx)("p",{id:g,style:Ht,children:e.description??u.description}),(0,Le.jsx)("div",{style:{display:"grid",gridTemplateColumns:`repeat(${u.cols}, minmax(0, 1fr))`,columnGap:yt,rowGap:ho,...u.legend?{marginTop:Ln}:null},children:u.panels.map((x,k)=>{let w=t.paint(x.isPicked?"accentText":u.isPanelPick?"muted":"ink");return(0,Le.jsxs)("div",{"data-facet":x.value,style:{minWidth:0,...fr(p,!1,"fade",k*vs,$s)},children:[(0,Le.jsxs)("div",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,height:Pn,fontSize:go,fontWeight:700,lineHeight:`${Pn}px`,color:w},children:[(0,Le.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x.label}),x.last!==void 0?(0,Le.jsx)("span",{style:{flex:"none",fontVariantNumeric:"tabular-nums"},children:x.last}):null]}),(0,Le.jsx)(S,{...n,...x.props})]},x.value)})}),u.legend?(0,Le.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",top:0,right:0,height:Ln},children:u.legend}):null]})}var Qt=["max","min","first","last","none"];function De(e,t,n,r,o="max"){let i=new Set,a=n.length,s=c=>{if(a&&c!=="none"){if(c==="first")i.add(0);else if(c==="last")i.add(a-1);else if(c==="max"||c==="min"){let m=-1,u=c==="max"?-1/0:1/0;r.forEach((g,f)=>{Number.isFinite(g)&&(c==="max"?g>u:g<u)&&(u=g,m=f)}),m>=0&&i.add(m)}}};if(e==null)return s(o),i;if(typeof e=="function")return t.forEach((c,m)=>{m<a&&c!==null&&c!==void 0&&e(c,m)&&i.add(m)}),i;let l=Array.isArray(e)?e:[e];for(let c of l)typeof c=="number"?c>=0&&c<a&&i.add(c):c==="max"||c==="min"||c==="first"||c==="last"||c==="none"?s(c):n.forEach((m,u)=>{m===c&&i.add(u)});return i}var Ce=F(re(),1);async function Ts(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(ie(r)==="ko"?`데이터 대신 HTML 페이지를 받았어요. 주소를 확인해 주세요${n?`: ${n}`:"."}`:`Got an HTML page instead of data${n?` (${n})`:""}. Check the URL.`);if(t==="csv")return Qe(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 Qe(i);let a=i.trim();return a.startsWith("{")||a.startsWith("[")?JSON.parse(a):Qe(i)}async function Ms(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 Ts(i,t.parse,o,t.locale)}return t.select&&(r=qr(r,t.select)),t.transform?t.transform(r):Ve(r)}function vo(e,t={}){let{refreshMs:n,enabled:r=!0,keepPrevious:o=!0}=t,[i,a]=(0,Ce.useState)(()=>({data:[],status:e&&r?"loading":"idle",error:null,updatedAt:null})),[s,l]=(0,Ce.useState)(0),c=we(t.locale),m=(0,Ce.useRef)(t);m.current={...t,locale:c};let u=(0,Ce.useRef)(e);u.current=e;let g=typeof e=="function"?"fn":e instanceof Request?e.url:e?String(e):"",f=t.deps??[],h=JSON.stringify(f.map(x=>typeof x=="object"?JSON.stringify(x):String(x))),p=(0,Ce.useRef)(!1);(0,Ce.useEffect)(()=>{let x=u.current;if(!x||!r){a(M=>M.status==="loading"?{...M,status:"idle"}:M);return}let k=new AbortController,w=!0;return p.current=!0,a(M=>({...M,data:o?M.data:[],status:"loading",error:null})),Ms(x,{...m.current,signal:k.signal}).then(M=>{w&&a({data:M,status:"success",error:null,updatedAt:Date.now()})}).catch(M=>{!w||k.signal.aborted||a(b=>({...b,status:"error",error:M instanceof Error?M:new Error(String(M))}))}).finally(()=>{w&&(p.current=!1)}),()=>{w=!1,p.current=!1,k.abort()}},[g,r,s,h,o]),(0,Ce.useEffect)(()=>{if(!n||!r)return;let x=setInterval(()=>{p.current||l(k=>k+1)},n);return()=>clearInterval(x)},[n,r]);let S=(0,Ce.useCallback)(()=>l(x=>x+1),[]);return{data:i.data,status:i.status,loading:i.status==="loading",error:i.error,empty:i.status==="success"&&i.data.length===0,updatedAt:i.updatedAt,reload:S}}var En=F(Y(),1),Ss=["csv","svg","png"],Cs=/^[=+\-@\t\r\n=+-@]/,As=/var\(|color-mix\(/;function $o(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?Fr(e.getTime()):String(e);return`"${(Cs.test(t)&&!Number.isFinite(Oe(t))?`'${t}`:t).replace(/"/g,'""')}"`}function Ns(e){return[...new Set(e.slice(0,200).flatMap(t=>t&&typeof t=="object"?Object.keys(t):[]))]}function Rs(e,t){return`\uFEFF${[t.map($o),...e.map(r=>t.map(o=>$o(r[o])))].map(r=>r.join(",")).join(`\r
|
|
26
26
|
`)}\r
|
|
27
|
-
`}function Fs(e){return Array.from((e??"").replace(/[\\/:*?"<>|\r\n\t]+/g,"-").trim()).slice(0,80).join("")||"chart"}function Dn(e,t){let n=document.createElement("a");n.href=URL.createObjectURL(e),n.download=t,n.click(),setTimeout(()=>URL.revokeObjectURL(n.href),1e4)}var To=2,Ue=16;function Mo(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
|
|
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?ht(s,{locale:t,year:"numeric",month:"short",day:"numeric"}):String(s)};return i=>{let a=[];for(let s of r){let l=!1,c=s.replace(Pr,(m,u)=>o(i,u.trim())??(l=!0,""));l||a.push(c)}return a.length?a.map((s,l)=>(0,Ro.jsx)("div",{children:s},l)):null}}function Fo(e,t,n=!1){let r=be(t,"group"),o=e.map((s,l)=>r(s,l)).filter(Boolean),i=Pe(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 _o(e,t,n="All",r){let o=k=>(w,M)=>k(w,M).trim()?k(w,M):"",i=o(be(t.label,"label")),a=o(be(t.id,"id")),s=o(be(t.parent,"parent")),l=Ke(t.value,"value"),c=e.length,m=e.map((k,w)=>a(k,w)||i(k,w)||`#${w+1}`),u=new Map;m.forEach((k,w)=>{u.has(k)?r?.({code:"duplicate_id",index:w,id:k}):u.set(k,w)});let g=e.map((k,w)=>{let M=s(k,w);if(!M)return-1;let b=u.get(M);return b===void 0?r?.({code:"missing_parent",index:w,id:m[w]}):b===w&&r?.({code:"cycle",index:w,id:m[w]}),b===void 0||b===w?-1:b}),f=Array.from({length:c},()=>[]);g.forEach((k,w)=>k>=0&&f[k].push(w));let h={id:"",label:n,value:0,depth:0,parent:null,children:[],datum:null,index:0},p=new Array(c).fill(null),C=k=>{let w=[[k,h]];for(;w.length;){let[M,b]=w.pop();if(p[M])continue;let P=i(e[M],M)||m[M],U=Math.max(0,l(e[M],M)||0),j={id:b.id?`${b.id}/${P}`:P,label:P,value:U,depth:b.depth+1,parent:b,children:[],datum:e[M],index:b.children.length};b.children.push(j),p[M]=j;for(let R=f[M].length-1;R>=0;R--)w.push([f[M][R],j])}};for(let k=0;k<c;k++)g[k]<0&&C(k);for(let k=0;k<c;k++){if(p[k])continue;let w=new Set,M=k;for(;!w.has(M)&&!p[M];)w.add(M),M=g[M];p[M]||(r?.({code:"cycle",index:M,id:m[M]}),C(M))}let x=xt(h);for(let k=x.length-1;k>=0;k--){let w=x[k];w.children.length&&(w.value=w.children.reduce((M,b)=>M+b.value,0))}return h}function Po(e,t){let n=xt(e);if(n.some(r=>r!==e&&!r.label.trim())){for(let r of n)if(!(r===e||r.label.trim()))if(r.datum===null&&r.parent){let o=r.parent.children.indexOf(r);r.parent.children.splice(o,1,...r.children);for(let i of r.children)i.parent=r.parent}else{let o=t.indexOf(r.datum);r.label=`#${(o>=0?o:r.index)+1}`}for(let r of xt(e))r.children.forEach((o,i)=>Object.assign(o,{id:r.id?`${r.id}/${o.label}`:o.label,depth:r.depth+1,index:i}))}}function xt(e){let t=[],n=[e];for(;n.length;){let r=n.pop();t.push(r);for(let o=r.children.length-1;o>=0;o--)n.push(r.children[o])}return t}function Lo(e){return e.children.length===1?e.children[0]:e}function On(e,t){let n=[];if(!t)return n;let r=`/${t}`;return e.forEach((o,i)=>{(o.label===t||o.id===t||o.id.endsWith(r))&&n.push(i)}),n}function In(e,t){let n=[],r=new Map,o=[[e,0]];for(;o.length;){let[l,c]=o.pop();if(n.push(l),r.set(l,{slot:0,depth:c}),!t(l))for(let m=l.children.length-1;m>=0;m--)o.push([l.children[m],c+1])}let i=0,a,s=0;for(let l of n){let c=r.get(l);s=Math.max(s,c.depth),(t(l)||!l.children.length)&&(a!==void 0&&l.parent!==a&&(i+=.5),c.slot=i++,a=l.parent)}for(let l=n.length-1;l>=0;l--){let c=n[l];t(c)||!c.children.length||(r.get(c).slot=(r.get(c.children[0]).slot+r.get(c.children[c.children.length-1]).slot)/2)}return{nodes:n,slots:r,span:Math.max(1,i),levels:s}}function Do(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 Qe(t.csv)}return null}var jo=F(re(),1);var ce=F(re(),1);function Eo(e,t){let n=_e(e.theme),[r,o,i]=Jt(e.width),a=st(),s=e.width??(i||t.ssrWidth||480),l=typeof t.height=="function"?t.height(s):t.height,c=e.height??l,m=Zt(e.reducedMotion??"auto"),u=e.animate!==!1&&!m&&Ae,g=ko(r,e.animateOnView!==!1&&u),f=we(e.locale),h=ie(f),p=(0,ce.useMemo)(()=>Je(e.format,f,t.format),[e.format,f,t.format]),C=(0,ce.useCallback)(Z=>_t(Z,{locale:f}),[f]),x=(0,ce.useMemo)(()=>Pt(p,e.unit),[p,e.unit]),k=(0,ce.useMemo)(()=>Wt(e.data),[e.data]),[w,M]=(0,ce.useState)(null),[b,P]=(0,ce.useState)(null),U=(0,ce.useRef)([]),j=(0,ce.useRef)(e.onHover);j.current=e.onHover;let R=(0,ce.useRef)(e.onClick);R.current=e.onClick;let J=(0,ce.useRef)(null),O=(0,ce.useRef)(null),L=(0,ce.useRef)(null),A=(0,ce.useCallback)((Z,ke="pointer")=>{if(L.current!==Z){L.current=Z;let Me=Z===null?null:U.current[Z]??null;queueMicrotask(()=>j.current?.(Me)),O.current?.(Z)}J.current=Z===null?null:ke,M(Z),P(J.current)},[]),v=(0,ce.useCallback)(Z=>{J.current!=="keyboard"&&(J.current=Z===null?null:"sync",M(Z),P(J.current))},[]),N=(0,ce.useCallback)(Z=>{let ke=U.current[Z];ke&&R.current?.(ke)},[]),G=zr(e.replayKey),X=e.width!==void 0||(i??0)>0,Te={enabled:u,active:g.visible&&X,near:g.near,replayKey:G,dataKey:k,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},He=(0,ce.useCallback)((Z,ke=1)=>w===null||w===Z?ke:ke*.38,[w]);return{p:n,width:s,height:c,measured:X,responsive:e.width===void 0,pending:Ae&&a&&e.width===void 0&&i===null,node:r,hydrated:a,ref:o,motion:Te,fv:x,fmt:p,pct:C,locale:f,lang:h,t:h==="ko"?pr:gr,active:w,via:b,setActive:A,click:N,events:U,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:He,sig:k,description:e.description,reduced:m,publish:O,applySync:v}}var ae=F(re(),1);function Ps(e){return 1-Math.pow(1-e,3)}function Ls(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function Ds(e){return e==="easeInOut"?Ls:e==="linear"?t=>t:Ps}function Es(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 ct(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 qt(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 Oo(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 Io(e,t,n,r){if(!t||!n||t.length!==n.length)return ct(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 ct(s,n[a]))o.push(l)}return o.length===r?o:ct(e,r)}var en=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||!qt(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),Oo(n.from,n.vel,n.to),n.cur=n.from.slice(),n.curVel=n.vel.slice(),n.done=qt(n.from,n.to),n.done&&(n.progress=1);this.entranceStart=t,this.animating=!0}update(t,n,r=0){this.step(n);let o=new Set,i=0;for(let a of t){o.add(a.key);let s=this.tracks.get(a.key),l=r>0?Math.min(i*r,240):0;if(s){let c=a.to.length;s.from=Io(s.cur,s.parts,a.parts,c),s.vel=Io(s.curVel,s.parts,a.parts,c),s.parts=a.parts,s.to=a.to.slice(),Oo(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=qt(s.from,s.to)&&s.vel.every(m=>Math.abs(m)<1e-6),s.progress=s.done?1:0}else{let c=this.make(a,a.enter??a.from??a.to,n+l,0);c.done=qt(c.from,c.to),this.tracks.set(a.key,c)}i++}for(let a of this.tracks.values())o.has(a.key)||a.exiting||(a.from=a.cur.slice(),a.vel=a.curVel.slice(),a.to=ct(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=Ds(this.easing),o=this.duration/1e3,i=this.omega,a=[];for(let s of this.tracks.values()){if(s.done)continue;let l=(t-s.t0)/1e3,c=s.to.length;if(s.from.length!==c&&(s.from=ct(s.from,c)),s.vel.length!==c&&(s.vel=ct(s.vel,c)),s.cur.length!==c&&(s.cur=new Array(c).fill(0),s.curVel=new Array(c).fill(0)),!(l>0)){for(let u=0;u<c;u++)s.cur[u]=s.from[u],s.curVel[u]=0;s.progress=0,n=!0;continue}let m;if(this.easing==="spring"){let u=Math.exp(-i*l),g=i*l>=8&&i*l<20,f=0;for(let h=0;h<c;h++){let p=s.from[h]-s.to[h],C=s.vel[h]+i*p;s.cur[h]=s.to[h]+(p+C*l)*u,s.curVel[h]=(s.vel[h]-i*C*l)*u,g&&f<.15&&(f=Math.max(f,Math.abs(s.cur[h]-s.to[h]),Math.abs(s.curVel[h]/i)))}m=i*l>=20||g&&f<.15,s.progress=Math.min(1,1-(1+i*l)*u)}else{let u=Math.min(1,l/o),g=r(u),f=Es(this.easing,u)/o;for(let h=0;h<c;h++)s.cur[h]=s.from[h]+(s.to[h]-s.from[h])*g,s.curVel[h]=(s.to[h]-s.from[h])*f;m=u>=1,s.progress=g}if(m){for(let u=0;u<c;u++)s.cur[u]=s.to[u],s.curVel[u]=0;s.done=!0,s.progress=1,s.exiting&&a.push(s.key)}else n=!0}for(let s of a)this.tracks.delete(s);return this.animating=n,n||(this.entranceStart=-1),n}elapsed(t){return this.entranceStart<0?1/0:t-this.entranceStart}get entranceLength(){return this.duration+this.maxDelay}get(t){return this.tracks.get(t)?.cur}items(){return[...this.tracks.values()].sort((t,n)=>t.order-n.order).map(t=>({key:t.key,v:t.cur,data:t.data,exiting:t.exiting,progress:t.progress}))}get size(){return this.tracks.size}},kt=new Set,tn=0;function zo(e){tn=0;let t=Array.from(kt);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||kt.delete(n)}kt.size&&typeof requestAnimationFrame<"u"&&(tn=requestAnimationFrame(zo))}function Bo(e){return kt.add(e),!tn&&typeof requestAnimationFrame<"u"&&(tn=requestAnimationFrame(zo)),()=>{kt.delete(e)}}function Os(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 Ho(e,t){let n=(0,ae.useMemo)(()=>Os(e),[e]),{enabled:r,active:o,near:i=!0,replayKey:a,dataKey:s,easing:l="spring",duration:c=900,stagger:m=0}=t,u=(0,ae.useRef)(null),g=(0,ae.useRef)("init"),f=(0,ae.useRef)(null),h=(0,ae.useRef)(s),p=(0,ae.useRef)(a),C=(0,ae.useRef)(!1),x=(0,ae.useRef)(0),[,k]=(0,ae.useState)(0),w=(0,ae.useRef)(null),M=(0,ae.useRef)(!0);u.current||(u.current=new en,u.current.configure(l,c),u.current.snap(n),f.current=n);let b=u.current;if(b.configure(l,c),f.current!==n){let O=g.current,L=!Object.is(h.current,s);b.sameTargets(n)?b.refreshData(n):!r||O==="init"?b.snap(n):O==="idle"?b.hold(n):O==="running"||L?b.update(n,Nt(),m):b.snap(n),f.current=n,h.current=s}let P=(0,ae.useRef)(()=>!1);P.current=O=>{if(!M.current)return!1;let L=b.step(O);return!L&&g.current==="running"&&(g.current="done"),k(A=>(A+1)%1e9),L||(w.current=null),L};let U=(0,ae.useCallback)(()=>{if(!Ae||w.current||!b.animating)return;let O=L=>P.current(L);w.current=Bo(O)},[b]);Ee(()=>{let O=!Object.is(p.current,a);if(p.current=a,!r){(g.current!=="done"||b.animating)&&(b.snap(f.current??n),g.current="done",k(L=>L+1));return}g.current==="init"||O&&i?(b.hold(f.current??n),g.current="idle",C.current=!1,k(L=>L+1)):O&&(C.current=!0)},[r,a]),Ee(()=>{!r||!i||!C.current||(C.current=!1,b.hold(f.current??n),g.current="idle",k(O=>O+1))},[i,r]),(0,ae.useEffect)(()=>{r&&o&&g.current==="idle"&&(b.start(Nt()),x.current+=1,g.current="running",U(),k(O=>O+1))},[r,o,a,b,U]),(0,ae.useEffect)(()=>{b.animating&&U()}),(0,ae.useEffect)(()=>(M.current=!0,()=>{M.current=!1,w.current?.(),w.current=null}),[]);let j=Nt(),R=b.elapsed(j),J=r&&g.current==="idle";return{items:b.items(),get:O=>b.get(O),elapsed:J?0:R,fade:(O,L=320)=>J?0:Number.isFinite(R)?Math.max(0,Math.min(1,(R-O)/L)):1,waiting:J,animating:b.animating,generation:x.current}}var zn=F(Y(),1);function Go(e,t,n,r,o){if(r)return o==="categorical"?Re(e,t,n):Tr(e,t,n);if(o==="categorical")return Re(e,t,n);let i=me(e,"strong"),a=me(e,"accent");return Array.from({length:t},(s,l)=>n.has(l)?a:i)}var Is=F(re(),1);var Bn=F(Y(),1);var Wo=e=>e?"neutralStrong":"accent";var Hn=F(Y(),1);function Ko(e,t,n,r){if(typeof e!="function")return De(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 zs=F(re(),1);var Gn=F(Y(),1),Bs={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}, ${Ne(n,"candle")}. First open ${r}, last close ${o}`,ma:e=>`MA${e}`,up:"Up",down:"Down",maLegend:e=>`${e}-day MA`},Vo={en:Bs,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}일 이동평균`}},jn=["ink","muted","dim"];function Uo(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,jn.length)}var Hs=F(re(),1);var Qo=F(Y(),1),js={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${Ne(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},Gs={en:js,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},Xo=(e,t)=>Gs[e].other(t);function Yo(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,Kt(o.map(i=>i.value)))}}var Jo=e=>Number.isFinite(e)&&e>0?e:0;function Zo(e,t,n,r){return r==="emphasis"?$r(e,t,n):Re(e,t,n)}var Ws=F(re(),1);var ni=F(Y(),1);function qo(e,t){return t===!1?e.map((n,r)=>r):to(e)}function ei(e,t,n){let r=n.map(o=>o.reduce((i,a)=>i+(Number.isFinite(a)?a:0),0));return De(e,t,t,r,"max")}function ti(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]=me(e,"accent"));return o.forEach((i,a)=>r[i]=o.length===1?me(e,"neutral"):Ft(e,1-a/Math.max(1,o.length-1))),r}function ri(e,t,n="All"){let r=be(t.label,"label"),o=Ke(t.value,"value"),i={id:"",label:n,value:0,depth:0,parent:null,children:[],datum:null,index:0},a=t.children??"children",s=e.some(m=>m&&typeof m=="object"&&Array.isArray(m[a])),l=(m,u,g)=>{let f=m.children.find(h=>h.label===u);return f||(f={id:m.id?`${m.id}/${u}`:u,label:u,value:0,depth:m.depth+1,parent:m,children:[],datum:g,index:m.children.length},m.children.push(f)),f};if(s){let m=(u,g)=>{g.forEach((f,h)=>{let p=f,C=l(u,r(p,h)||`#${h+1}`,p),x=f[a];Array.isArray(x)&&x.length?m(C,x):C.value+=Math.max(0,o(p,h)||0)})};m(i,e)}else{let m=t.group?be(t.group,"group"):null;e.forEach((u,g)=>{let f=i;if(t.path?.length)for(let p of t.path){let C=u[p];C==null||C===""||(f=l(f,String(C),null))}else if(m){let p=m(u,g);p&&(f=l(f,p,null))}let h=l(f,r(u,g)||`#${g+1}`,u);h.datum=u,h.value+=Math.max(0,o(u,g)||0)})}let c=m=>(m.children.length&&(m.value=Kt(m.children.map(c))),m.value);return c(i),i}function Wn(e){e.children.sort((t,n)=>n.value-t.value),e.children.forEach((t,n)=>{t.index=n,Wn(t)})}function oi(e){return!e||typeof e!="object"||Array.isArray(e)?[]:Pe(Object.values(e).filter(t=>typeof t=="string"&&t!==""))}function ii(e,t){return ft(e,t+1,new Set)}var Ks=F(re(),1);var si=F(Y(),1);function ai(e,t){let n=typeof e=="string"?[e]:Array.isArray(e)?e:[],r=new Set;for(let o of n)typeof o=="string"&&!Qt.includes(o)&&t.forEach((i,a)=>i===o&&r.add(a));return r}var ue=F(re(),1);var te=F(Y(),1),Vs={kind:"Tree",all:"All",root:"root",under:e=>`under ${e}`,below:e=>`${Ne(e,"level")} below the root`,kids:e=>Ne(e,"child","children"),collapsed:"collapsed",tipUnder:"Under",tipLevel:"Level",tipKids:"Children",desc:(e,t,n)=>`${Ne(e,"node")} in ${Ne(t,"level")} below ${n}`,hi:"Highlighted:"},Us={en:Vs,ko:{kind:"트리",all:"전체",root:"뿌리",under:e=>`${e} 아래`,below:e=>`뿌리에서 ${e}단계`,kids:e=>`자식 ${e}개`,collapsed:"접힘",tipUnder:"부모",tipLevel:"단계",tipKids:"자식",desc:(e,t,n)=>`${n} 아래 ${t}단계, 노드 ${e}개`,hi:"강조:"}},li=60,Xs=e=>e>560?Math.min(100,li+(e-560)/2.5):li,pi=18;function Ys(e,t){let n={top:12,bottom:12,left:12,right:12};for(let{a:r,w:o}of e){let i=Math.min(o+22,t),a=Math.sin(r),s=-Math.cos(r),l=Math.abs(a)*i+Math.abs(s)*7,c=Math.abs(s)*i+Math.abs(a)*7;a>=0&&(n.right=Math.max(n.right,l)),a<=0&&(n.left=Math.max(n.left,l)),s<=0&&(n.top=Math.max(n.top,c)),s>=0&&(n.bottom=Math.max(n.bottom,c))}return n}var Js=48,Kn=[.2,.24,.28,.34,.4];function ci(e,t,n,r,o,i){let a=Ys(e,r*o),s=i??ze(2*ze(Math.max(t*Xs(r),n*pi/qe),24,(r-a.left-a.right)/2-4)+a.top+a.bottom+8,160,680),l=Math.max(16,Math.min(r-a.left-a.right,s-a.top-a.bottom)/2-4);return{e:a,R:l,cx:(a.left+r-a.right)/2,cy:(a.top+s-a.bottom)/2,h:s}}function ui(e,t,n){let r=wt*.5+2,o=0;for(let{a:i,w:a}of e){let s=Math.sin(i),l=-Math.cos(i),c=t.cx+s*(t.R+8),m=t.cy+l*(t.R+8);Math.min(s>1e-6?(n-r-c)/s:s<-1e-6?(r-c)/s:1/0,l>1e-6?(t.h-r-m)/l:l<-1e-6?(r-m)/l:1/0)<a&&o++}return o}function mi(e,t,n,r,o){let i=Math.max(t*Js,n*pi/qe),a=ci(e,t,n,r,Kn[0],o),s=ui(e,a,r);for(let l=1;l<Kn.length&&s>0;l++){let c=ci(e,t,n,r,Kn[l],o);if(c.R<i)break;let m=ui(e,c,r);m<s&&([a,s]=[c,m])}return a}function di(e,t,n){return e.nodes.filter(r=>r!==t&&(!r.children.length||n(r))).map(r=>({a:(e.slots.get(r).slot+.5)/e.span*qe,w:xe(r.label,wt,600)}))}var Zs=1500,wt=11,Qs=15,fi=12;function hi(e,t){let n=t.cx-e.cx,r=t.cy-e.cy;for(let[o,i]of[[e.ux,e.uy],[-e.uy,e.ux],[t.ux,t.uy],[-t.uy,t.ux]]){let a=e.hw*Math.abs(e.ux*o+e.uy*i)+e.hh*Math.abs(-e.uy*o+e.ux*i),s=t.hw*Math.abs(t.ux*o+t.uy*i)+t.hh*Math.abs(-t.uy*o+t.ux*i);if(Math.abs(n*o+r*i)>a+s)return!1}return!0}function gi(e,t,n){let r=e.rot*Math.PI/180,o=Math.cos(r),i=Math.sin(r),a=e.anchor==="start"?t/2:e.anchor==="end"?-t/2:0;return{cx:e.x+o*a,cy:e.y+i*a,ux:o,uy:i,hw:t/2+1.5,hh:n*.5+.5}}var V=e=>Math.round(e*10)/10;function Vn(e){let t=e.layout==="radial",n=(0,ue.useMemo)(()=>{let d={label:e.label,value:e.value,group:e.group,path:e.path,children:e.children,id:e.id,parent:e.parent},T=e.parent!==void 0?_o(e.data,d,""):ri(e.data,d,"");return e.parent===void 0&&Po(T,e.data),e.sort&&Wn(T),T},[e.data,e.label,e.value,e.group,e.path,e.children,e.id,e.parent,e.sort]),r=Lo(n),o=!r.children.length&&r===n,i=(0,ue.useMemo)(()=>o?[]:xt(r),[r,o]),a=(0,ue.useMemo)(()=>{let d=new Map,T=new Map;for(let S of i){let D=(d.get(S.id)??0)+1;d.set(S.id,D),T.set(S,D>1?`${S.id}#${D}`:S.id)}return T},[i]),s=(e.collapsed??[]).join(""),l=(0,ue.useMemo)(()=>new Set((Array.isArray(e.collapsed)?e.collapsed:[]).flatMap(d=>On(i,String(d)).map(T=>i[T]))),[i,s]),[c,m]=(0,ue.useState)(()=>new Set),u=d=>d.children.length>0&&l.has(d)!==c.has(a.get(d)??""),g=(0,ue.useMemo)(()=>{let d=In(r,T=>l.has(T));return{span:d.span,levels:d.levels,leaves:t?di(d,r,T=>l.has(T)):[]}},[r,l,t]),f=Eo(e,{height:d=>t?mi(g.leaves,g.levels,g.span,d).h:ze(g.span*Qs+24,120,Math.max(320,Math.min(900,d*1.25))),duration:900}),{p:h,width:p,height:C}=f,x=Us[f.lang],k=r===n?e.rootLabel||x.all:r.label,w=d=>d===n?k:d.label,M=e.value!==void 0,b=(0,ue.useMemo)(()=>o?{nodes:[],slots:new Map,span:1,levels:0}:In(r,u),[r,o,l,c,a]),P=r.depth,U=(0,ue.useMemo)(()=>i.reduce((d,T)=>Math.max(d,T.depth-P),0),[i,P]),j=(0,ue.useMemo)(()=>{let d=e.highlight,T=new Set;if(d!=null&&i.length){let D=typeof d=="function"?null:Array.isArray(d)?d:[d],W=E=>typeof E=="string"&&!Qt.includes(E);if(D){for(let E of D)if(W(E))for(let K of[...r===n&&E===k?[0]:[],...On(i,E)])T.add(i[K])}let z=D?.filter(E=>!W(E));if(!z||z.length)for(let E of De(z??d,i.map(K=>K.datum),i.map(K=>K.label),i.map(K=>K.children.length?NaN:K.value),"none"))T.add(i[E])}let S=new Set;for(let D of T)for(let W=D;W&&!S.has(W);W=W===r?null:W.parent)S.add(W);return{hit:T,path:S}},[e.highlight,i,r,n,k]),R=(0,ue.useMemo)(()=>{let{nodes:d,slots:T,span:S,levels:D}=b,W=B=>!B.children.length||u(B),z=0;for(let B of d)W(B)&&B!==r&&(z=Math.max(z,xe(B.label,wt,600)));let E=xe(k,fi,700),K=p/2,$=C/2,H=0,I=0,Q=0,oe=0,ne;if(t){let B=mi(di(b,r,u),D,S,p,C),le=B.R;K=B.cx,$=B.cy,oe=le/Math.max(1,D),ne=Math.min(oe,le*qe/S)}else{H=D?ze(E+16,24,p*.28):10;let B=ze(z+22,24,p*.4);I=Math.max(8,(p-H-B)/Math.max(1,D)),Q=(C-8)/S,ne=Math.min(Q,I)}let Ie=ze(ne*.42,1.2,9),ge=Math.min(2.5,Ie),pe=Math.max(ge,Math.min(9,ne*.48)),ee=0;if(M)for(let B of d)B!==r&&(ee=Math.max(ee,B.value));let se=new Map;for(let B of d){let le=T.get(B),je=(le.slot+.5)/S*qe,Ye=le.depth*oe,[Tt,Mt]=t?et(K,$,Ye,je):[H+le.depth*I,4+(le.slot+.5)*Q],mt=B===r,Ct=M?mt?pe:ee<=0?ge:ge+(pe-ge)*Math.sqrt(ze(B.value/ee,0,1)):Math.min(mt?5.5:B.children.length?4:3,Ie);se.set(B,{nd:B,key:a.get(B)??B.id,parentKey:mt||!B.parent?null:a.get(B.parent)??null,depth:le.depth,x:Tt,y:Mt,a:je,r:Ye,dot:Ct,open:!u(B)&&B.children.length>0,path:j.path.has(B)})}return{info:se,cx:K,cy:$,ring:oe,colW:I,levels:D}},[b,p,C,t,k,M,a,j,r]),J=(d,T,S,D,W)=>{let z=d.nd===r,E=(pe,ee,se=0,B=1/0)=>({pose:{x:T+se,y:S+pe,rot:0,anchor:ee},room:Math.min(B,ee==="middle"?2*Math.min(T,p-T)-4:ee==="start"?p-T-se-2:T+se-2)}),K=-d.dot-9;if(!t)return d.open?z?[E(0,"end",-d.dot-5),E(K,"start",-d.dot)]:[E(0,"end",-d.dot-5,R.colW-d.dot-13),E(K,"middle",0,R.colW*2)]:[E(0,"start",d.dot+(d.nd.children.length?8:5))];let $=Math.sin(D)>=0?1:-1,H=pe=>[E(d.dot+10,"middle",0,pe),E(K,"middle",0,pe),E(0,$>0?"start":"end",$*(d.dot+6),pe),E(0,$>0?"end":"start",-$*(d.dot+6),pe)];if(z)return H(180);let I=D<Math.PI,Q=D*180/Math.PI,oe=I?Q-90:Q+90;if(!d.open){let[pe,ee]=et(R.cx,R.cy,W+d.dot+(d.nd.children.length?8:5),D),se=Math.sin(D),B=-Math.cos(D),le=wt*.5+2,je=Math.min(se>1e-6?(p-le-pe)/se:se<-1e-6?(le-pe)/se:1/0,B>1e-6?(C-le-ee)/B:B<-1e-6?(le-ee)/B:1/0);return[{pose:{x:pe,y:ee,rot:oe,anchor:I?"start":"end"},room:je}]}let[ne,Ie]=et(R.cx,R.cy,W-d.dot-5,D),ge=d.depth===1?(R.info.get(r)?.dot??5)+8:8;return[...H(Math.min(R.ring*1.6,160)),{pose:{x:ne,y:Ie,rot:oe,anchor:I?"end":"start"},room:R.ring-d.dot-5-ge}]},O=(0,ue.useMemo)(()=>{let d=new Map;if(!f.showLabels)return d;let T=[...R.info.values()],S=$=>$.path?0:$.nd===r?1:2;T.sort(($,H)=>S($)-S(H)||$.depth-H.depth);let D=40,W=new Map,z=($,H)=>{let I=Math.abs($.ux)*$.hw+Math.abs($.uy)*$.hh,Q=Math.abs($.uy)*$.hw+Math.abs($.ux)*$.hh;for(let oe=Math.floor(($.cx-I)/D);oe<=Math.floor(($.cx+I)/D);oe++)for(let ne=Math.floor(($.cy-Q)/D);ne<=Math.floor(($.cy+Q)/D);ne++)if(H(oe*100003+ne))return!0;return!1},E=$=>z($,H=>W.get(H)?.some(I=>hi(I,$))),K=$=>{let H=Math.abs($.ux)*$.hw+Math.abs($.uy)*$.hh,I=Math.abs($.uy)*$.hw+Math.abs($.ux)*$.hh;return $.cx-H<-1||$.cx+H>p+1||$.cy-I<-1||$.cy+I>C+1};for(let $ of T){let H=$.dot+($.nd.children.length&&!$.open?3:0)+1,I={cx:$.x,cy:$.y,ux:1,uy:0,hw:H,hh:H};z(I,Q=>{(W.get(Q)??W.set(Q,[]).get(Q)).push(I)})}for(let $ of T){let H=$.nd===r,I=H?fi:wt,Q=$.path||H?700:$.nd.children.length?600:500,oe=J($,$.x,$.y,$.a,$.r),ne=w($.nd),Ie=xe(ne,I,Q),ge=null;for(let ee=0;ee<2&&!ge;ee++)for(let se=0;se<oe.length&&!ge;se++){let B=ee===0?Ie<=oe[se].room?ne.trim():"":Ut(ne,oe[se].room,I,Q);if(!B||B!==ne.trim()&&B.length<5)continue;let le=gi(oe[se].pose,xe(B,I,Q),I);!K(le)&&!E(le)&&(ge={k:se,text:B,box:le})}if(!ge&&$.path){let ee=1/0;oe.forEach((se,B)=>{for(let le of[1,.75,.55,.4]){let je=le===1?ne.trim():Ut(ne,Math.max(Ie*le,30),I,Q)||ne.trim(),Ye=gi(se.pose,xe(je,I,Q),I),Tt=new Set;z(Ye,mt=>{W.get(mt)?.forEach(Ct=>hi(Ct,Ye)&&Tt.add(Ct))});let Mt=Tt.size*1e3+(K(Ye)?2e3:0)-je.length;Mt<ee&&([ee,ge]=[Mt,{k:B,text:je,box:Ye}])}})}if(!ge)continue;let pe=ge.box;z(pe,ee=>{(W.get(ee)??W.set(ee,[]).get(ee)).push(pe)}),d.set($.nd,{text:ge.text,size:I,weight:Q,k:ge.k})}return d},[R,f.showLabels,p,C,t]),L=f.motion.duration??900,A=b.nodes.length>Zs,v=Math.min(220,1200/Math.max(1,R.levels)),N=t?"r:":"h:",G=(0,ue.useMemo)(()=>{let d=[];for(let T of R.info.values()){let S=T.nd===r||!T.nd.parent?null:R.info.get(T.nd.parent);if(!S){d.push({key:N+T.key,to:t?[0,0]:[T.x,T.y],data:T});continue}let D=t&&S.nd===r,W=t?[T.a-(D?0:S.a),T.r-S.r]:[T.x-S.x,T.y-S.y],z=D?[T.a,0]:[0,0];d.push({key:N+T.key,to:W,from:A?void 0:z,enter:z,exit:z,delay:A?0:(T.depth-1)*v,data:T})}return A&&d.push({key:"__fade",to:[1],from:[0],data:null}),d},[R,r,t,N,A,v]),X=Ho(G,{...f.motion,dataKey:`${f.sig}|${s}|${[...c].join("")}`}),He=(X.animating||X.waiting)&&(!A||X.items.some(d=>d.data&&d.progress<1)),Z=(0,ue.useMemo)(()=>{let d=new Map;for(let E of X.items)E.data&&E.key.startsWith(N)&&d.set(E.key.slice(N.length),{v:E.v,n:E.data,exiting:E.exiting,grow:E.progress});let T=t?[0,0]:[R.info.get(r)?.x??0,R.info.get(r)?.y??0],S=new Map,D=E=>{let K=S.get(E);if(K)return K;let $=d.get(E);if(!$)return T;let H=$.n.parentKey,I=H===null?null:D(H),Q=I?[I[0]+$.v[0],I[1]+$.v[1]]:[$.v[0],$.v[1]];return S.set(E,Q),Q},W=[],z=E=>t?et(R.cx,R.cy,E[1],E[0]):E;for(let[E,K]of d){let $=D(E),H=K.n.parentKey!==null&&d.has(K.n.parentKey),I=H?D(K.n.parentKey):$,[Q,oe]=z($),[ne,Ie]=z(I);W.push({key:E,n:K.n,x:Q,y:oe,a:$[0],r:$[1],px:ne,py:Ie,pa:I[0],pr:I[1],hasParent:H,exiting:K.exiting,grow:K.grow})}return W},[He?X.items:G,R,t,r,N]),ke=(0,ue.useMemo)(()=>new Map(Z.map(d=>[d.key,d])),[Z]),Me=d=>{if(!t){let $=(d.px+d.x)/2;return`M${V(d.px)},${V(d.py)}C${V($)},${V(d.py)} ${V($)},${V(d.y)} ${V(d.x)},${V(d.y)}`}let T=d.pr<.5?d.a:d.pa,S=d.a-T,D=d.r-d.pr,W=$=>{let H=T+S*(3*$*$-2*$*$*$),I=d.pr+D*$,Q=S*(6*$-6*$*$),[oe,ne]=et(R.cx,R.cy,I,H);return[oe,ne,D*Math.sin(H)+I*Math.cos(H)*Q,-D*Math.cos(H)+I*Math.sin(H)*Q]},z=ze(Math.ceil(Math.abs(S)*(d.pr+d.r)/60),1,4),E=`M${V(d.px)},${V(d.py)}`,K=W(0);for(let $=1;$<=z;$++){let H=W($/z),I=1/z/3;E+=`C${V(K[0]+K[2]*I)},${V(K[1]+K[3]*I)} ${V(H[0]-H[2]*I)},${V(H[1]-H[3]*I)} ${V(H[0])},${V(H[1])}`,K=H}return E},de=b.nodes,ut=(0,ue.useMemo)(()=>new Map(de.map((d,T)=>[d,T])),[de]),wi=(0,ue.useMemo)(()=>{let d=new Map;for(let T of de){let S=d.get(T.depth);S?S.push(T):d.set(T.depth,[T])}return d},[de]),Xn=d=>{let T=d.depth-P,S=T===0?[x.root]:[x.under(w(d.parent)),x.below(T)];return S.push(x.kids(d.children.length)),M&&S.push(`${f.t.value} ${f.fv(d.value)}`),u(d)&&S.push(x.collapsed),S.join(", ")},vi=(0,ue.useMemo)(()=>de.map((d,T)=>({datum:d.datum,index:T,key:a.get(d)??d.id,label:w(d),value:M?d.value:null,formatted:Xn(d)})),[de,a,M,x,f.fv,f.t,k,l,c]),$i=d=>{if(!d.children.length)return;let T=a.get(d)??d.id;m(S=>{let D=new Set(S);return D.delete(T)||D.add(T),D})},nn=h.paint("accent"),$t=h.paint("ink"),Yn=h.paint("panel"),Ti=h.paint("muted"),Mi=h.paint("neutral"),Ci=h.paint("neutralStrong"),rn=d=>d.path?nn:d.nd===r||d.nd.children.length?$t:Ci,he=f.active!==null?de[f.active]:void 0,Jn=()=>f.active===null||!he?!1:($i(he),f.click(f.active),!0),Xe=he?R.info.get(he):void 0,Zn=null;if(he&&Xe){let d=he.depth-P;Zn={x:Xe.x,y:Xe.y-Xe.dot,title:w(he),rows:[...d>0?[{label:x.tipUnder,value:w(he.parent),strong:!1}]:[],{label:x.tipLevel,value:d===0?x.root:String(d),strong:!1},{label:x.tipKids,value:String(he.children.length),strong:!1},...M?[{label:f.t.value,value:f.fv(he.value),color:rn(Xe)}]:[]]}}let Qn=r.children.slice(0,6).map(d=>`${d.label} (${d.children.length})`),qn=[...j.hit].slice(0,5).map(w),Si=e.description??(i.length?`${x.kind}. ${x.desc(i.length,U,k)}${Qn.length?`: ${Qn.join(", ")}${r.children.length>6?", …":""}`:""}.${qn.length?` ${x.hi} ${qn.join(", ")}${j.hit.size>5?", …":""}.`:""}`:""),Ai=f.via==="keyboard"&&he?`${w(he)}, ${Xn(he)}`:"",er=A?X.get("__fade")?.[0]??1:1,Ni=d=>A?1:X.fade(Math.max(0,d.depth-1)*v+L*.5,280),tr=(d,T,S,D)=>{let W=O.get(d.nd);if(!W)return null;let z=J(d,T.x,T.y,T.a,T.r)[W.k].pose;return(0,te.jsx)("text",{x:V(z.x),y:V(z.y),dy:"0.35em",transform:z.rot?`rotate(${V(z.rot)} ${V(z.x)} ${V(z.y)})`:void 0,textAnchor:z.anchor,fontSize:W.size,fontWeight:W.weight,fill:d.path||d.nd.children.length?$t:Ti,opacity:S<1?V(S*100)/100:void 0,children:W.text},D)},Ri=(0,ue.useMemo)(()=>(0,te.jsxs)(te.Fragment,{children:[(0,te.jsx)("g",{fill:"none",strokeLinecap:"round",children:Z.map(d=>d.hasParent?(0,te.jsx)("path",{d:Me(d),stroke:d.n.path?nn:Mi,strokeWidth:d.n.path?2:1.3,opacity:d.exiting?.5:void 0},d.key):null)}),(0,te.jsx)("g",{children:Z.map(d=>{let T=d.n.dot*(d.hasParent?Math.min(1,d.grow*1.6):1);if(!(T>.05))return null;let S=rn(d.n),D=d.exiting?.5:void 0;return d.n.nd.children.length&&!d.n.open?(0,te.jsxs)("g",{opacity:D,children:[(0,te.jsx)("circle",{cx:V(d.x),cy:V(d.y),r:V(T),fill:S}),(0,te.jsx)("circle",{cx:V(d.x),cy:V(d.y),r:V(T+3),fill:"none",stroke:S,strokeWidth:1.4})]},d.key):(0,te.jsx)("circle",{cx:V(d.x),cy:V(d.y),r:V(T),fill:S,opacity:D},d.key)})}),(0,te.jsx)("g",{stroke:Yn,strokeWidth:3,strokeLinejoin:"round",paintOrder:"stroke",style:{pointerEvents:"none"},children:Z.map(d=>d.exiting?null:tr(d.n,d,Ni(d.n),d.key))})]}),[Z,O,h,He?X.elapsed:1/0]),nr=null;if(Xe){let d=[],T=ke;for(let S=T.get(Xe.key);S;S=S.hasParent?T.get(S.n.parentKey):void 0)d.push(S);nr=(0,te.jsxs)("g",{pointerEvents:"none",children:[d.map(S=>S.hasParent?(0,te.jsx)("path",{d:Me(S),fill:"none",stroke:S.n.path?nn:$t,strokeWidth:2.2,strokeLinecap:"round"},`l${S.key}`):null),d.map(S=>(0,te.jsx)("circle",{cx:V(S.x),cy:V(S.y),r:V(S.n.dot),fill:rn(S.n)},`d${S.key}`)),f.via==="keyboard"&&d[0]?(0,te.jsx)("circle",{cx:V(d[0].x),cy:V(d[0].y),r:V(d[0].n.dot+4),fill:"none",stroke:$t,strokeWidth:2}):null,(0,te.jsx)("g",{stroke:Yn,strokeWidth:3,strokeLinejoin:"round",paintOrder:"stroke",children:d.map(S=>tr(S.n,S,1,`t${S.key}`))})]})}let rr=Math.max(10,Math.min(24,R.colW||R.ring||24));return(0,te.jsxs)(Hr,{c:f,kind:x.kind,ariaLabel:e.ariaLabel,description:Si,events:vi,tip:Zn,renderTip:e.tooltip,announce:Ai,className:e.className,style:e.style,theme:e.theme,onPointerMove:(d,T,S)=>{let D=-1,W=rr*rr;for(let E=0;E<de.length;E++){let K=R.info.get(de[E]),$=(K.x-d)**2+(K.y-T)**2;$<W&&(W=$,D=E)}let z=D<0?null:D;z!==f.active&&f.setActive(z,S.pointerType==="touch"?"touch":"pointer")},onKey:d=>{let T=he;if(d.key==="Enter"||d.key===" ")return Jn();if(!d.key.startsWith("Arrow"))return!1;if(!T)return f.setActive(0,"keyboard"),!0;let S=t?"ArrowUp":"ArrowLeft",D=t?"ArrowDown":"ArrowRight",W=t?"ArrowRight":"ArrowDown",z;if(d.key===S)z=T===r?void 0:T.parent??void 0;else if(d.key===D)z=u(T)?void 0:T.children[0];else{let E=wi.get(T.depth)??[];z=E[E.indexOf(T)+(d.key===W?1:-1)]}return z&&ut.has(z)&&f.setActive(ut.get(z),"keyboard"),!0},children:[(0,te.jsxs)("g",{onClick:Jn,style:{cursor:he&&(he.children.length||e.onClick)?"pointer":void 0},children:[(0,te.jsx)("rect",{width:p,height:C,fill:"transparent"}),(0,te.jsx)("g",{opacity:f.active!==null?.4:er<1?V(er*100)/100:void 0,className:"ztd-mark",children:Ri})]}),nr]})}var Be=F(Y(),1);function bi(e,t,n){let r=Gt(e);return r?.type==="scatter"&&t?.size!==void 0&&!jt(n)?Gt("bubble"):r}function qs(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 el(e,t,n,r=!1){let o=bi(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&&Mn.includes(o.type)&&Array.isArray(a.hidden)?a.hidden.map(String):[]),c=u=>u.filter(g=>!l.has(g.label)),m=["pie","donut","waffle"];if(o.type==="donut"&&a.legend!=="none")return[];if(m.includes(o.type)){let u=be(i.label,"label"),g=Ke(i.value,"value"),f=o.type==="waffle",h=t.map((b,P)=>({r:b,label:u(b,P),value:f?g(b,P):Jo(g(b,P))})),{kept:p,other:C}=f?{kept:h,other:null}:Yo(h,a.other,(b,P)=>({r:{},label:Xo(ie(n),b),value:P})),x=De(s,p.map(b=>b.r),p.map(b=>b.label),p.map(b=>b.value),f?"first":"max"),k=C?[...p,C]:p,w=We(b=>f?Re(b,k.length,x):Zo(b,k.length,x,a.colorMode)),M=f&&a.shape==="arc";return k.map((b,P)=>({label:b.label,color:w[P],...M&&{shape:"circle"}}))}if(o.type==="candlestick"){let u=Uo(Array.isArray(a.ma)?a.ma:void 0,t.length),g=Vo[ie(n)];return[{label:g.up,color:a.upColor??"accent"},{label:g.down,color:a.downColor??"neutralStrong"},...u.map((f,h)=>({label:g.maLegend(f),color:jn[h],shape:"line"}))]}if(o.type==="network"){let u=oi(a.groups);if(u.length<2)return[];let g=We(f=>ii(f,u.length));return u.map((f,h)=>({label:f,color:g[h],shape:"circle"}))}if(o.type==="symbolMap"){if(typeof i.group!="string")return[];let u=be(i.group,"group"),g=Pe(t.map((h,p)=>u(h,p)).filter(Boolean));if(g.length<2)return[];let f=We(h=>ft(h,g.length,new Set));return g.map((h,p)=>({label:h,color:f[p],shape:"circle"}))}if(o.type==="scatter"){if(typeof i.series!="string"||jt(a))return[];let u=be(i.series,"series"),g=Pe(t.map((p,C)=>u(p,C)));if(g.length<2)return[];let f=Ko(s,t,g,u),h=We(p=>ft(p,g.length,f));return c(g.map((p,C)=>({label:p,color:h[C],shape:"circle"})))}if(o.type==="timeline"){let u=typeof i.group!="string",g=u?i.status:i.group;if(typeof g!="string")return[];let f=Fo(t,g,u),h=We(p=>Re(p,f.length,ai(s,f)));return c(f.map((p,C)=>({label:p,color:h[C],shape:"square"})))}if(["marimekko","area","bar","line","stream","radar"].includes(o.type)){let u=[];if(Array.isArray(i.y))u=i.y;else if(typeof i.series=="string"){let w=be(i.series,"series");u=Pe(t.map((M,b)=>w(M,b)))}let g=Cn(o.type,i,a);if(g.length){let w=De(s,u,u,u.map(()=>0),"none"),M=We(P=>Re(P,u.length,w)),b=u.length<2?[{label:String((Array.isArray(i.y)?i.y[0]:i.y)??"y"),color:"neutral"}]:u.map((P,U)=>({label:P,color:M[U]}));return[...c(b),...g.map((P,U)=>({label:P,color:Wo(U),shape:"line"}))]}if(u.length<2)return[];let h=o.type==="bar"&&a.layout==="diverging"&&s===void 0?eo(u.length,Array.isArray(a.negative)?a.negative.map(w=>u.indexOf(String(w))):[],typeof a.neutral=="string"?u.indexOf(a.neutral):-1):-1,p=h>=0?new Set([h]):De(s,u,u,u.map(()=>0),"first");if(o.type==="radar")return c(u.map((w,M)=>({label:w,color:p.has(M)?"accent":"neutralStrong",shape:"square"})));let C=a.colorMode,x=w=>Re(w,u.length,p);if((o.type==="line"||o.type==="area")&&(x=w=>Go(w,u.length,p,o.type==="area",C)),o.type==="stream"){let w=pt(t,i.x,i.y,i.series,{xType:a.xType,locale:n,aggregate:a.aggregate,dayFirst:a.dayFirst}),M=qo(w.values,a.reorder),b=ei(s,w.series,w.values);x=P=>ti(P,M,b)}let k=We(x);return c(u.map((w,M)=>({label:w,color:k[M],...o.type==="line"&&{shape:"line"}})))}return[]}function tl(e,t){let n=e.facet;return n&&typeof n=="object"&&typeof n.by=="string"&&Vr.includes(t)&&!(t==="bar"&&e.options?.layout==="diverging")?n:void 0}function nl(e,t,n){let{data:r,width:o,height:i,highlight:a,syncId:s,ariaLabel:l,description:c,...m}=n;return{type:e,data:r??[],by:t.by,columns:t.columns,scale:t.scale,chartProps:m,width:o,height:i,highlight:a,syncId:s,title:l,description:c}}function yi(e,t){let{spec:n}=e,r=bi(n.type,n.encoding,n.options),o=(0,vt.useMemo)(()=>Do(n.data),[n.data]),i=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,a=Kr(n,e.locale),s=we(a),l=ie(s),c=vo(i?.url??null,{parse:i?.format??"auto",select:i?.select,init:e.fetchInit,locale:s}),m=Yr(n),u=(0,vt.useMemo)(()=>m?No(m,s):void 0,[m,s]),g=n.options?.hidden,f=Array.isArray(g)?g.map(String):[],h=f.join(""),[p,C]=(0,vt.useState)(null);if(!r)return(0,Be.jsx)(Tn,{error:l==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:a});let x=o??c.data,k=t[r.type],w={...n.options??{}},M={...qs(r,n.encoding),...w,...u?{tooltip:u}:{},data:x,...e.width!==void 0?{width:e.width}:{},...e.height!==void 0?{height:e.height}:{},...e.animate!==void 0?{animate:e.animate}:{},...e.replayKey!==void 0?{replayKey:e.replayKey}:{},...e.onHover?{onHover:e.onHover}:{},...e.onClick?{onClick:e.onClick}:{},locale:a},b=n.card?.legend==="toggle"&&Xr(r.type,n.encoding??{},w),P=p&&p.base===h?p.hidden:f;b&&(M.hidden=P);let U=L=>C(A=>{let v=A&&A.base===h?A.hidden:f;return{base:h,hidden:v.includes(L)?v.filter(N=>N!==L):[...v,L]}}),j=M.height??220,R=tl(n,r.type),J=i&&!x.length&&(c.loading||c.error||c.empty)?(0,Be.jsx)(Tn,{loading:c.loading,error:c.error,empty:c.empty,onRetry:c.reload,height:j,locale:a}):R?(0,Be.jsx)(wo,{chart:k,...nl(r.type,R,M)}):(0,Be.jsx)(k,{...M});if(n.card){let L=n.card,A=L.legend==="auto"||L.legend==="toggle"?el(n,x,s,b):L.legend,v=A?.length?b?(0,Be.jsx)($n,{items:A,hidden:P,onToggle:U,locale:a}):A:void 0,N=L.download?(0,Be.jsx)(Ao,{data:x,columns:Jr(n),filename:L.title??r.type,formats:Array.isArray(L.download)?L.download:void 0,locale:a}):void 0;J=(0,Be.jsx)(Br,{number:L.number,title:L.title??Wr(r,l),subtitle:L.subtitle,legend:v,actions:N,source:L.source||void 0,note:L.note||void 0,accent:L.accent,takeaway:L.takeaway,level:L.level,sample:L.sample,replay:L.replay!==!1,className:e.className,locale:a,children:J})}let O=e.theme??n.theme;return O&&(J=(0,Be.jsx)(Ot,{theme:O,children:J})),J}function rl({cfg:e,components:t}){let n=st();return yi({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function ki(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,xi.hydrateRoot)(r,(0,Un.createElement)(Ot,{theme:o.theme,cssVars:!0},(0,Un.createElement)(rl,{cfg:o,components:{[e]:t}})))}ki("tree",Vn);})();
|
|
27
|
+
`}function Fs(e){return Array.from((e??"").replace(/[\\/:*?"<>|\r\n\t]+/g,"-").trim()).slice(0,80).join("")||"chart"}function Dn(e,t){let n=document.createElement("a");n.href=URL.createObjectURL(e),n.download=t,n.click(),setTimeout(()=>URL.revokeObjectURL(n.href),1e4)}var To=2,Ue=16;function Mo(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 So(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 Co(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+Ue*2,a+Ue*2],c=o.cloneNode(!0),m=c.querySelectorAll("*"),u=new Map;o.querySelectorAll("*").forEach((h,p)=>{let S;for(let x of Array.from(h.attributes)){if(!As.test(x.value))continue;let k=(S??(S=getComputedStyle(h))).getPropertyValue(x.name);k&&m[p].setAttribute(x.name,Mo(k,u))}}),c.removeAttribute("style");for(let[h,p]of Object.entries({viewBox:`${-Ue} ${-Ue} ${s} ${l}`,width:s*t,height:l*t,"font-family":getComputedStyle(o).fontFamily}))c.setAttribute(h,String(p));let g=Mo(getComputedStyle(r).backgroundColor,u),f=o.parentElement?.querySelector("canvas")??null;if(n){let h=c.querySelector("desc")?.nextSibling??c.firstChild;c.insertBefore(So("rect",{x:-Ue,y:-Ue,width:s,height:l,fill:g}),h),f&&c.insertBefore(So("image",{href:f.toDataURL(),width:i,height:a}),h)}return{svg:new XMLSerializer().serializeToString(c),w:s,h:l,vw:i,vh:a,bg:g,canvas:f}}function _s(e,t){let n=Co(e,To,!1);if(!n)return;let r=To,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,Ue*r,Ue*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&&Dn(l,`${t}.png`),"image/png")},s.onerror=()=>URL.revokeObjectURL(a),s.src=a}function Ao(e){let t=_e(e.theme),n=ie(we(e.locale))==="ko",r=Fs(e.filename),o=(i,a)=>{if(i==="csv")return Dn(new Blob([Rs(e.data,e.columns?.length?e.columns:Ns(e.data))],{type:"text/csv;charset=utf-8"}),`${r}.csv`);if(i==="png")return _s(a,r);let s=Co(a,1,!0);s&&Dn(new Blob([s.svg],{type:"image/svg+xml"}),`${r}.svg`)};return(0,En.jsx)("span",{style:{display:"inline-flex",gap:6,flex:"none"},children:Ss.filter(i=>!e.formats||e.formats.includes(i)).map(i=>{let a=i.toUpperCase(),s=n?`${a} 내려받기`:`Download ${a}`;return(0,En.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 Ro=F(Y(),1);function No(e,t=ye){let n=Je(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?ht(s,{locale:t,year:"numeric",month:"short",day:"numeric"}):String(s)};return i=>{let a=[];for(let s of r){let l=!1,c=s.replace(Pr,(m,u)=>o(i,u.trim())??(l=!0,""));l||a.push(c)}return a.length?a.map((s,l)=>(0,Ro.jsx)("div",{children:s},l)):null}}function Fo(e,t,n=!1){let r=be(t,"group"),o=e.map((s,l)=>r(s,l)).filter(Boolean),i=Pe(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 _o(e,t,n="All",r){let o=k=>(w,M)=>k(w,M).trim()?k(w,M):"",i=o(be(t.label,"label")),a=o(be(t.id,"id")),s=o(be(t.parent,"parent")),l=Ke(t.value,"value"),c=e.length,m=e.map((k,w)=>a(k,w)||i(k,w)||`#${w+1}`),u=new Map;m.forEach((k,w)=>{u.has(k)?r?.({code:"duplicate_id",index:w,id:k}):u.set(k,w)});let g=e.map((k,w)=>{let M=s(k,w);if(!M)return-1;let b=u.get(M);return b===void 0?r?.({code:"missing_parent",index:w,id:m[w]}):b===w&&r?.({code:"cycle",index:w,id:m[w]}),b===void 0||b===w?-1:b}),f=Array.from({length:c},()=>[]);g.forEach((k,w)=>k>=0&&f[k].push(w));let h={id:"",label:n,value:0,depth:0,parent:null,children:[],datum:null,index:0},p=new Array(c).fill(null),S=k=>{let w=[[k,h]];for(;w.length;){let[M,b]=w.pop();if(p[M])continue;let P=i(e[M],M)||m[M],U=Math.max(0,l(e[M],M)||0),j={id:b.id?`${b.id}/${P}`:P,label:P,value:U,depth:b.depth+1,parent:b,children:[],datum:e[M],index:b.children.length};b.children.push(j),p[M]=j;for(let R=f[M].length-1;R>=0;R--)w.push([f[M][R],j])}};for(let k=0;k<c;k++)g[k]<0&&S(k);for(let k=0;k<c;k++){if(p[k])continue;let w=new Set,M=k;for(;!w.has(M)&&!p[M];)w.add(M),M=g[M];p[M]||(r?.({code:"cycle",index:M,id:m[M]}),S(M))}let x=xt(h);for(let k=x.length-1;k>=0;k--){let w=x[k];w.children.length&&(w.value=w.children.reduce((M,b)=>M+b.value,0))}return h}function Po(e,t){let n=xt(e);if(n.some(r=>r!==e&&!r.label.trim())){for(let r of n)if(!(r===e||r.label.trim()))if(r.datum===null&&r.parent){let o=r.parent.children.indexOf(r);r.parent.children.splice(o,1,...r.children);for(let i of r.children)i.parent=r.parent}else{let o=t.indexOf(r.datum);r.label=`#${(o>=0?o:r.index)+1}`}for(let r of xt(e))r.children.forEach((o,i)=>Object.assign(o,{id:r.id?`${r.id}/${o.label}`:o.label,depth:r.depth+1,index:i}))}}function xt(e){let t=[],n=[e];for(;n.length;){let r=n.pop();t.push(r);for(let o=r.children.length-1;o>=0;o--)n.push(r.children[o])}return t}function Lo(e){return e.children.length===1?e.children[0]:e}function On(e,t){let n=[];if(!t)return n;let r=`/${t}`;return e.forEach((o,i)=>{(o.label===t||o.id===t||o.id.endsWith(r))&&n.push(i)}),n}function In(e,t){let n=[],r=new Map,o=[[e,0]];for(;o.length;){let[l,c]=o.pop();if(n.push(l),r.set(l,{slot:0,depth:c}),!t(l))for(let m=l.children.length-1;m>=0;m--)o.push([l.children[m],c+1])}let i=0,a,s=0;for(let l of n){let c=r.get(l);s=Math.max(s,c.depth),(t(l)||!l.children.length)&&(a!==void 0&&l.parent!==a&&(i+=.5),c.slot=i++,a=l.parent)}for(let l=n.length-1;l>=0;l--){let c=n[l];t(c)||!c.children.length||(r.get(c).slot=(r.get(c.children[0]).slot+r.get(c.children[c.children.length-1]).slot)/2)}return{nodes:n,slots:r,span:Math.max(1,i),levels:s}}function Do(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 Qe(t.csv)}return null}var jo=F(re(),1);var ce=F(re(),1);function Eo(e,t){let n=_e(e.theme),[r,o,i]=Jt(e.width),a=st(),s=e.width??(i||t.ssrWidth||480),l=typeof t.height=="function"?t.height(s):t.height,c=e.height??l,m=Zt(e.reducedMotion??"auto"),u=e.animate!==!1&&!m&&Ae,g=ko(r,e.animateOnView!==!1&&u),f=we(e.locale),h=ie(f),p=(0,ce.useMemo)(()=>Je(e.format,f,t.format),[e.format,f,t.format]),S=(0,ce.useCallback)(Z=>_t(Z,{locale:f}),[f]),x=(0,ce.useMemo)(()=>Pt(p,e.unit),[p,e.unit]),k=(0,ce.useMemo)(()=>Wt(e.data),[e.data]),[w,M]=(0,ce.useState)(null),[b,P]=(0,ce.useState)(null),U=(0,ce.useRef)([]),j=(0,ce.useRef)(e.onHover);j.current=e.onHover;let R=(0,ce.useRef)(e.onClick);R.current=e.onClick;let J=(0,ce.useRef)(null),O=(0,ce.useRef)(null),L=(0,ce.useRef)(null),A=(0,ce.useCallback)((Z,ke="pointer")=>{if(L.current!==Z){L.current=Z;let Me=Z===null?null:U.current[Z]??null;queueMicrotask(()=>j.current?.(Me)),O.current?.(Z)}J.current=Z===null?null:ke,M(Z),P(J.current)},[]),v=(0,ce.useCallback)(Z=>{J.current!=="keyboard"&&(J.current=Z===null?null:"sync",M(Z),P(J.current))},[]),N=(0,ce.useCallback)(Z=>{let ke=U.current[Z];ke&&R.current?.(ke)},[]),G=zr(e.replayKey),X=e.width!==void 0||(i??0)>0,Te={enabled:u,active:g.visible&&X,near:g.near,replayKey:G,dataKey:k,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},He=(0,ce.useCallback)((Z,ke=1)=>w===null||w===Z?ke:ke*.38,[w]);return{p:n,width:s,height:c,measured:X,responsive:e.width===void 0,pending:Ae&&a&&e.width===void 0&&i===null,node:r,hydrated:a,ref:o,motion:Te,fv:x,fmt:p,pct:S,locale:f,lang:h,t:h==="ko"?pr:gr,active:w,via:b,setActive:A,click:N,events:U,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:He,sig:k,description:e.description,reduced:m,publish:O,applySync:v}}var ae=F(re(),1);function Ps(e){return 1-Math.pow(1-e,3)}function Ls(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function Ds(e){return e==="easeInOut"?Ls:e==="linear"?t=>t:Ps}function Es(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 ct(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 qt(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 Oo(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 Io(e,t,n,r){if(!t||!n||t.length!==n.length)return ct(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 ct(s,n[a]))o.push(l)}return o.length===r?o:ct(e,r)}var en=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||!qt(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),Oo(n.from,n.vel,n.to),n.cur=n.from.slice(),n.curVel=n.vel.slice(),n.done=qt(n.from,n.to),n.done&&(n.progress=1);this.entranceStart=t,this.animating=!0}update(t,n,r=0){this.step(n);let o=new Set,i=0;for(let a of t){o.add(a.key);let s=this.tracks.get(a.key),l=r>0?Math.min(i*r,240):0;if(s){let c=a.to.length;s.from=Io(s.cur,s.parts,a.parts,c),s.vel=Io(s.curVel,s.parts,a.parts,c),s.parts=a.parts,s.to=a.to.slice(),Oo(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=qt(s.from,s.to)&&s.vel.every(m=>Math.abs(m)<1e-6),s.progress=s.done?1:0}else{let c=this.make(a,a.enter??a.from??a.to,n+l,0);c.done=qt(c.from,c.to),this.tracks.set(a.key,c)}i++}for(let a of this.tracks.values())o.has(a.key)||a.exiting||(a.from=a.cur.slice(),a.vel=a.curVel.slice(),a.to=ct(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=Ds(this.easing),o=this.duration/1e3,i=this.omega,a=[];for(let s of this.tracks.values()){if(s.done)continue;let l=(t-s.t0)/1e3,c=s.to.length;if(s.from.length!==c&&(s.from=ct(s.from,c)),s.vel.length!==c&&(s.vel=ct(s.vel,c)),s.cur.length!==c&&(s.cur=new Array(c).fill(0),s.curVel=new Array(c).fill(0)),!(l>0)){for(let u=0;u<c;u++)s.cur[u]=s.from[u],s.curVel[u]=0;s.progress=0,n=!0;continue}let m;if(this.easing==="spring"){let u=Math.exp(-i*l),g=i*l>=8&&i*l<20,f=0;for(let h=0;h<c;h++){let p=s.from[h]-s.to[h],S=s.vel[h]+i*p;s.cur[h]=s.to[h]+(p+S*l)*u,s.curVel[h]=(s.vel[h]-i*S*l)*u,g&&f<.15&&(f=Math.max(f,Math.abs(s.cur[h]-s.to[h]),Math.abs(s.curVel[h]/i)))}m=i*l>=20||g&&f<.15,s.progress=Math.min(1,1-(1+i*l)*u)}else{let u=Math.min(1,l/o),g=r(u),f=Es(this.easing,u)/o;for(let h=0;h<c;h++)s.cur[h]=s.from[h]+(s.to[h]-s.from[h])*g,s.curVel[h]=(s.to[h]-s.from[h])*f;m=u>=1,s.progress=g}if(m){for(let u=0;u<c;u++)s.cur[u]=s.to[u],s.curVel[u]=0;s.done=!0,s.progress=1,s.exiting&&a.push(s.key)}else n=!0}for(let s of a)this.tracks.delete(s);return this.animating=n,n||(this.entranceStart=-1),n}elapsed(t){return this.entranceStart<0?1/0:t-this.entranceStart}get entranceLength(){return this.duration+this.maxDelay}get(t){return this.tracks.get(t)?.cur}items(){return[...this.tracks.values()].sort((t,n)=>t.order-n.order).map(t=>({key:t.key,v:t.cur,data:t.data,exiting:t.exiting,progress:t.progress}))}get size(){return this.tracks.size}},kt=new Set,tn=0;function zo(e){tn=0;let t=Array.from(kt);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||kt.delete(n)}kt.size&&typeof requestAnimationFrame<"u"&&(tn=requestAnimationFrame(zo))}function Bo(e){return kt.add(e),!tn&&typeof requestAnimationFrame<"u"&&(tn=requestAnimationFrame(zo)),()=>{kt.delete(e)}}function Os(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 Ho(e,t){let n=(0,ae.useMemo)(()=>Os(e),[e]),{enabled:r,active:o,near:i=!0,replayKey:a,dataKey:s,easing:l="spring",duration:c=900,stagger:m=0}=t,u=(0,ae.useRef)(null),g=(0,ae.useRef)("init"),f=(0,ae.useRef)(null),h=(0,ae.useRef)(s),p=(0,ae.useRef)(a),S=(0,ae.useRef)(!1),x=(0,ae.useRef)(0),[,k]=(0,ae.useState)(0),w=(0,ae.useRef)(null),M=(0,ae.useRef)(!0);u.current||(u.current=new en,u.current.configure(l,c),u.current.snap(n),f.current=n);let b=u.current;if(b.configure(l,c),f.current!==n){let O=g.current,L=!Object.is(h.current,s);b.sameTargets(n)?b.refreshData(n):!r||O==="init"?b.snap(n):O==="idle"?b.hold(n):O==="running"||L?b.update(n,Nt(),m):b.snap(n),f.current=n,h.current=s}let P=(0,ae.useRef)(()=>!1);P.current=O=>{if(!M.current)return!1;let L=b.step(O);return!L&&g.current==="running"&&(g.current="done"),k(A=>(A+1)%1e9),L||(w.current=null),L};let U=(0,ae.useCallback)(()=>{if(!Ae||w.current||!b.animating)return;let O=L=>P.current(L);w.current=Bo(O)},[b]);Ee(()=>{let O=!Object.is(p.current,a);if(p.current=a,!r){(g.current!=="done"||b.animating)&&(b.snap(f.current??n),g.current="done",k(L=>L+1));return}g.current==="init"||O&&i?(b.hold(f.current??n),g.current="idle",S.current=!1,k(L=>L+1)):O&&(S.current=!0)},[r,a]),Ee(()=>{!r||!i||!S.current||(S.current=!1,b.hold(f.current??n),g.current="idle",k(O=>O+1))},[i,r]),(0,ae.useEffect)(()=>{r&&o&&g.current==="idle"&&(b.start(Nt()),x.current+=1,g.current="running",U(),k(O=>O+1))},[r,o,a,b,U]),(0,ae.useEffect)(()=>{b.animating&&U()}),(0,ae.useEffect)(()=>(M.current=!0,()=>{M.current=!1,w.current?.(),w.current=null}),[]);let j=Nt(),R=b.elapsed(j),J=r&&g.current==="idle";return{items:b.items(),get:O=>b.get(O),elapsed:J?0:R,fade:(O,L=320)=>J?0:Number.isFinite(R)?Math.max(0,Math.min(1,(R-O)/L)):1,waiting:J,animating:b.animating,generation:x.current}}var zn=F(Y(),1);function Go(e,t,n,r,o){if(r)return o==="categorical"?Re(e,t,n):Tr(e,t,n);if(o==="categorical")return Re(e,t,n);let i=me(e,"strong"),a=me(e,"accent");return Array.from({length:t},(s,l)=>n.has(l)?a:i)}var Is=F(re(),1);var Bn=F(Y(),1);var Wo=e=>e?"neutralStrong":"accent";var Hn=F(Y(),1);function Ko(e,t,n,r){if(typeof e!="function")return De(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 zs=F(re(),1);var Gn=F(Y(),1),Bs={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}, ${Ne(n,"candle")}. First open ${r}, last close ${o}`,ma:e=>`MA${e}`,up:"Up",down:"Down",maLegend:e=>`${e}-day MA`},Vo={en:Bs,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}일 이동평균`}},jn=["ink","muted","dim"];function Uo(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,jn.length)}var Hs=F(re(),1);var Qo=F(Y(),1),js={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${Ne(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},Gs={en:js,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},Xo=(e,t)=>Gs[e].other(t);function Yo(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,Kt(o.map(i=>i.value)))}}var Jo=e=>Number.isFinite(e)&&e>0?e:0;function Zo(e,t,n,r){return r==="emphasis"?$r(e,t,n):Re(e,t,n)}var Ws=F(re(),1);var ni=F(Y(),1);function qo(e,t){return t===!1?e.map((n,r)=>r):to(e)}function ei(e,t,n){let r=n.map(o=>o.reduce((i,a)=>i+(Number.isFinite(a)?a:0),0));return De(e,t,t,r,"max")}function ti(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]=me(e,"accent"));return o.forEach((i,a)=>r[i]=o.length===1?me(e,"neutral"):Ft(e,1-a/Math.max(1,o.length-1))),r}function ri(e,t,n="All"){let r=be(t.label,"label"),o=Ke(t.value,"value"),i={id:"",label:n,value:0,depth:0,parent:null,children:[],datum:null,index:0},a=t.children??"children",s=e.some(m=>m&&typeof m=="object"&&Array.isArray(m[a])),l=(m,u,g)=>{let f=m.children.find(h=>h.label===u);return f||(f={id:m.id?`${m.id}/${u}`:u,label:u,value:0,depth:m.depth+1,parent:m,children:[],datum:g,index:m.children.length},m.children.push(f)),f};if(s){let m=(u,g)=>{g.forEach((f,h)=>{let p=f,S=l(u,r(p,h)||`#${h+1}`,p),x=f[a];Array.isArray(x)&&x.length?m(S,x):S.value+=Math.max(0,o(p,h)||0)})};m(i,e)}else{let m=t.group?be(t.group,"group"):null;e.forEach((u,g)=>{let f=i;if(t.path?.length)for(let p of t.path){let S=u[p];S==null||S===""||(f=l(f,String(S),null))}else if(m){let p=m(u,g);p&&(f=l(f,p,null))}let h=l(f,r(u,g)||`#${g+1}`,u);h.datum=u,h.value+=Math.max(0,o(u,g)||0)})}let c=m=>(m.children.length&&(m.value=Kt(m.children.map(c))),m.value);return c(i),i}function Wn(e){e.children.sort((t,n)=>n.value-t.value),e.children.forEach((t,n)=>{t.index=n,Wn(t)})}function oi(e){return!e||typeof e!="object"||Array.isArray(e)?[]:Pe(Object.values(e).filter(t=>typeof t=="string"&&t!==""))}function ii(e,t){return ft(e,t+1,new Set)}var Ks=F(re(),1);var si=F(Y(),1);var Vs=26;var Nu=Vs*.62;function ai(e,t){let n=typeof e=="string"?[e]:Array.isArray(e)?e:[],r=new Set;for(let o of n)typeof o=="string"&&!Qt.includes(o)&&t.forEach((i,a)=>i===o&&r.add(a));return r}var ue=F(re(),1);var te=F(Y(),1),Us={kind:"Tree",all:"All",root:"root",under:e=>`under ${e}`,below:e=>`${Ne(e,"level")} below the root`,kids:e=>Ne(e,"child","children"),collapsed:"collapsed",tipUnder:"Under",tipLevel:"Level",tipKids:"Children",desc:(e,t,n)=>`${Ne(e,"node")} in ${Ne(t,"level")} below ${n}`,hi:"Highlighted:"},Xs={en:Us,ko:{kind:"트리",all:"전체",root:"뿌리",under:e=>`${e} 아래`,below:e=>`뿌리에서 ${e}단계`,kids:e=>`자식 ${e}개`,collapsed:"접힘",tipUnder:"부모",tipLevel:"단계",tipKids:"자식",desc:(e,t,n)=>`${n} 아래 ${t}단계, 노드 ${e}개`,hi:"강조:"}},li=60,Ys=e=>e>560?Math.min(100,li+(e-560)/2.5):li,pi=18;function Js(e,t){let n={top:12,bottom:12,left:12,right:12};for(let{a:r,w:o}of e){let i=Math.min(o+22,t),a=Math.sin(r),s=-Math.cos(r),l=Math.abs(a)*i+Math.abs(s)*7,c=Math.abs(s)*i+Math.abs(a)*7;a>=0&&(n.right=Math.max(n.right,l)),a<=0&&(n.left=Math.max(n.left,l)),s<=0&&(n.top=Math.max(n.top,c)),s>=0&&(n.bottom=Math.max(n.bottom,c))}return n}var Zs=48,Kn=[.2,.24,.28,.34,.4];function ci(e,t,n,r,o,i){let a=Js(e,r*o),s=i??ze(2*ze(Math.max(t*Ys(r),n*pi/qe),24,(r-a.left-a.right)/2-4)+a.top+a.bottom+8,160,680),l=Math.max(16,Math.min(r-a.left-a.right,s-a.top-a.bottom)/2-4);return{e:a,R:l,cx:(a.left+r-a.right)/2,cy:(a.top+s-a.bottom)/2,h:s}}function ui(e,t,n){let r=wt*.5+2,o=0;for(let{a:i,w:a}of e){let s=Math.sin(i),l=-Math.cos(i),c=t.cx+s*(t.R+8),m=t.cy+l*(t.R+8);Math.min(s>1e-6?(n-r-c)/s:s<-1e-6?(r-c)/s:1/0,l>1e-6?(t.h-r-m)/l:l<-1e-6?(r-m)/l:1/0)<a&&o++}return o}function mi(e,t,n,r,o){let i=Math.max(t*Zs,n*pi/qe),a=ci(e,t,n,r,Kn[0],o),s=ui(e,a,r);for(let l=1;l<Kn.length&&s>0;l++){let c=ci(e,t,n,r,Kn[l],o);if(c.R<i)break;let m=ui(e,c,r);m<s&&([a,s]=[c,m])}return a}function di(e,t,n){return e.nodes.filter(r=>r!==t&&(!r.children.length||n(r))).map(r=>({a:(e.slots.get(r).slot+.5)/e.span*qe,w:xe(r.label,wt,600)}))}var Qs=1500,wt=11,qs=15,fi=12;function hi(e,t){let n=t.cx-e.cx,r=t.cy-e.cy;for(let[o,i]of[[e.ux,e.uy],[-e.uy,e.ux],[t.ux,t.uy],[-t.uy,t.ux]]){let a=e.hw*Math.abs(e.ux*o+e.uy*i)+e.hh*Math.abs(-e.uy*o+e.ux*i),s=t.hw*Math.abs(t.ux*o+t.uy*i)+t.hh*Math.abs(-t.uy*o+t.ux*i);if(Math.abs(n*o+r*i)>a+s)return!1}return!0}function gi(e,t,n){let r=e.rot*Math.PI/180,o=Math.cos(r),i=Math.sin(r),a=e.anchor==="start"?t/2:e.anchor==="end"?-t/2:0;return{cx:e.x+o*a,cy:e.y+i*a,ux:o,uy:i,hw:t/2+1.5,hh:n*.5+.5}}var V=e=>Math.round(e*10)/10;function Vn(e){let t=e.layout==="radial",n=(0,ue.useMemo)(()=>{let d={label:e.label,value:e.value,group:e.group,path:e.path,children:e.children,id:e.id,parent:e.parent},T=e.parent!==void 0?_o(e.data,d,""):ri(e.data,d,"");return e.parent===void 0&&Po(T,e.data),e.sort&&Wn(T),T},[e.data,e.label,e.value,e.group,e.path,e.children,e.id,e.parent,e.sort]),r=Lo(n),o=!r.children.length&&r===n,i=(0,ue.useMemo)(()=>o?[]:xt(r),[r,o]),a=(0,ue.useMemo)(()=>{let d=new Map,T=new Map;for(let C of i){let D=(d.get(C.id)??0)+1;d.set(C.id,D),T.set(C,D>1?`${C.id}#${D}`:C.id)}return T},[i]),s=(e.collapsed??[]).join(""),l=(0,ue.useMemo)(()=>new Set((Array.isArray(e.collapsed)?e.collapsed:[]).flatMap(d=>On(i,String(d)).map(T=>i[T]))),[i,s]),[c,m]=(0,ue.useState)(()=>new Set),u=d=>d.children.length>0&&l.has(d)!==c.has(a.get(d)??""),g=(0,ue.useMemo)(()=>{let d=In(r,T=>l.has(T));return{span:d.span,levels:d.levels,leaves:t?di(d,r,T=>l.has(T)):[]}},[r,l,t]),f=Eo(e,{height:d=>t?mi(g.leaves,g.levels,g.span,d).h:ze(g.span*qs+24,120,Math.max(320,Math.min(900,d*1.25))),duration:900}),{p:h,width:p,height:S}=f,x=Xs[f.lang],k=r===n?e.rootLabel||x.all:r.label,w=d=>d===n?k:d.label,M=e.value!==void 0,b=(0,ue.useMemo)(()=>o?{nodes:[],slots:new Map,span:1,levels:0}:In(r,u),[r,o,l,c,a]),P=r.depth,U=(0,ue.useMemo)(()=>i.reduce((d,T)=>Math.max(d,T.depth-P),0),[i,P]),j=(0,ue.useMemo)(()=>{let d=e.highlight,T=new Set;if(d!=null&&i.length){let D=typeof d=="function"?null:Array.isArray(d)?d:[d],W=E=>typeof E=="string"&&!Qt.includes(E);if(D){for(let E of D)if(W(E))for(let K of[...r===n&&E===k?[0]:[],...On(i,E)])T.add(i[K])}let z=D?.filter(E=>!W(E));if(!z||z.length)for(let E of De(z??d,i.map(K=>K.datum),i.map(K=>K.label),i.map(K=>K.children.length?NaN:K.value),"none"))T.add(i[E])}let C=new Set;for(let D of T)for(let W=D;W&&!C.has(W);W=W===r?null:W.parent)C.add(W);return{hit:T,path:C}},[e.highlight,i,r,n,k]),R=(0,ue.useMemo)(()=>{let{nodes:d,slots:T,span:C,levels:D}=b,W=B=>!B.children.length||u(B),z=0;for(let B of d)W(B)&&B!==r&&(z=Math.max(z,xe(B.label,wt,600)));let E=xe(k,fi,700),K=p/2,$=S/2,H=0,I=0,Q=0,oe=0,ne;if(t){let B=mi(di(b,r,u),D,C,p,S),le=B.R;K=B.cx,$=B.cy,oe=le/Math.max(1,D),ne=Math.min(oe,le*qe/C)}else{H=D?ze(E+16,24,p*.28):10;let B=ze(z+22,24,p*.4);I=Math.max(8,(p-H-B)/Math.max(1,D)),Q=(S-8)/C,ne=Math.min(Q,I)}let Ie=ze(ne*.42,1.2,9),ge=Math.min(2.5,Ie),pe=Math.max(ge,Math.min(9,ne*.48)),ee=0;if(M)for(let B of d)B!==r&&(ee=Math.max(ee,B.value));let se=new Map;for(let B of d){let le=T.get(B),je=(le.slot+.5)/C*qe,Ye=le.depth*oe,[Tt,Mt]=t?et(K,$,Ye,je):[H+le.depth*I,4+(le.slot+.5)*Q],mt=B===r,St=M?mt?pe:ee<=0?ge:ge+(pe-ge)*Math.sqrt(ze(B.value/ee,0,1)):Math.min(mt?5.5:B.children.length?4:3,Ie);se.set(B,{nd:B,key:a.get(B)??B.id,parentKey:mt||!B.parent?null:a.get(B.parent)??null,depth:le.depth,x:Tt,y:Mt,a:je,r:Ye,dot:St,open:!u(B)&&B.children.length>0,path:j.path.has(B)})}return{info:se,cx:K,cy:$,ring:oe,colW:I,levels:D}},[b,p,S,t,k,M,a,j,r]),J=(d,T,C,D,W)=>{let z=d.nd===r,E=(pe,ee,se=0,B=1/0)=>({pose:{x:T+se,y:C+pe,rot:0,anchor:ee},room:Math.min(B,ee==="middle"?2*Math.min(T,p-T)-4:ee==="start"?p-T-se-2:T+se-2)}),K=-d.dot-9;if(!t)return d.open?z?[E(0,"end",-d.dot-5),E(K,"start",-d.dot)]:[E(0,"end",-d.dot-5,R.colW-d.dot-13),E(K,"middle",0,R.colW*2)]:[E(0,"start",d.dot+(d.nd.children.length?8:5))];let $=Math.sin(D)>=0?1:-1,H=pe=>[E(d.dot+10,"middle",0,pe),E(K,"middle",0,pe),E(0,$>0?"start":"end",$*(d.dot+6),pe),E(0,$>0?"end":"start",-$*(d.dot+6),pe)];if(z)return H(180);let I=D<Math.PI,Q=D*180/Math.PI,oe=I?Q-90:Q+90;if(!d.open){let[pe,ee]=et(R.cx,R.cy,W+d.dot+(d.nd.children.length?8:5),D),se=Math.sin(D),B=-Math.cos(D),le=wt*.5+2,je=Math.min(se>1e-6?(p-le-pe)/se:se<-1e-6?(le-pe)/se:1/0,B>1e-6?(S-le-ee)/B:B<-1e-6?(le-ee)/B:1/0);return[{pose:{x:pe,y:ee,rot:oe,anchor:I?"start":"end"},room:je}]}let[ne,Ie]=et(R.cx,R.cy,W-d.dot-5,D),ge=d.depth===1?(R.info.get(r)?.dot??5)+8:8;return[...H(Math.min(R.ring*1.6,160)),{pose:{x:ne,y:Ie,rot:oe,anchor:I?"end":"start"},room:R.ring-d.dot-5-ge}]},O=(0,ue.useMemo)(()=>{let d=new Map;if(!f.showLabels)return d;let T=[...R.info.values()],C=$=>$.path?0:$.nd===r?1:2;T.sort(($,H)=>C($)-C(H)||$.depth-H.depth);let D=40,W=new Map,z=($,H)=>{let I=Math.abs($.ux)*$.hw+Math.abs($.uy)*$.hh,Q=Math.abs($.uy)*$.hw+Math.abs($.ux)*$.hh;for(let oe=Math.floor(($.cx-I)/D);oe<=Math.floor(($.cx+I)/D);oe++)for(let ne=Math.floor(($.cy-Q)/D);ne<=Math.floor(($.cy+Q)/D);ne++)if(H(oe*100003+ne))return!0;return!1},E=$=>z($,H=>W.get(H)?.some(I=>hi(I,$))),K=$=>{let H=Math.abs($.ux)*$.hw+Math.abs($.uy)*$.hh,I=Math.abs($.uy)*$.hw+Math.abs($.ux)*$.hh;return $.cx-H<-1||$.cx+H>p+1||$.cy-I<-1||$.cy+I>S+1};for(let $ of T){let H=$.dot+($.nd.children.length&&!$.open?3:0)+1,I={cx:$.x,cy:$.y,ux:1,uy:0,hw:H,hh:H};z(I,Q=>{(W.get(Q)??W.set(Q,[]).get(Q)).push(I)})}for(let $ of T){let H=$.nd===r,I=H?fi:wt,Q=$.path||H?700:$.nd.children.length?600:500,oe=J($,$.x,$.y,$.a,$.r),ne=w($.nd),Ie=xe(ne,I,Q),ge=null;for(let ee=0;ee<2&&!ge;ee++)for(let se=0;se<oe.length&&!ge;se++){let B=ee===0?Ie<=oe[se].room?ne.trim():"":Ut(ne,oe[se].room,I,Q);if(!B||B!==ne.trim()&&B.length<5)continue;let le=gi(oe[se].pose,xe(B,I,Q),I);!K(le)&&!E(le)&&(ge={k:se,text:B,box:le})}if(!ge&&$.path){let ee=1/0;oe.forEach((se,B)=>{for(let le of[1,.75,.55,.4]){let je=le===1?ne.trim():Ut(ne,Math.max(Ie*le,30),I,Q)||ne.trim(),Ye=gi(se.pose,xe(je,I,Q),I),Tt=new Set;z(Ye,mt=>{W.get(mt)?.forEach(St=>hi(St,Ye)&&Tt.add(St))});let Mt=Tt.size*1e3+(K(Ye)?2e3:0)-je.length;Mt<ee&&([ee,ge]=[Mt,{k:B,text:je,box:Ye}])}})}if(!ge)continue;let pe=ge.box;z(pe,ee=>{(W.get(ee)??W.set(ee,[]).get(ee)).push(pe)}),d.set($.nd,{text:ge.text,size:I,weight:Q,k:ge.k})}return d},[R,f.showLabels,p,S,t]),L=f.motion.duration??900,A=b.nodes.length>Qs,v=Math.min(220,1200/Math.max(1,R.levels)),N=t?"r:":"h:",G=(0,ue.useMemo)(()=>{let d=[];for(let T of R.info.values()){let C=T.nd===r||!T.nd.parent?null:R.info.get(T.nd.parent);if(!C){d.push({key:N+T.key,to:t?[0,0]:[T.x,T.y],data:T});continue}let D=t&&C.nd===r,W=t?[T.a-(D?0:C.a),T.r-C.r]:[T.x-C.x,T.y-C.y],z=D?[T.a,0]:[0,0];d.push({key:N+T.key,to:W,from:A?void 0:z,enter:z,exit:z,delay:A?0:(T.depth-1)*v,data:T})}return A&&d.push({key:"__fade",to:[1],from:[0],data:null}),d},[R,r,t,N,A,v]),X=Ho(G,{...f.motion,dataKey:`${f.sig}|${s}|${[...c].join("")}`}),He=(X.animating||X.waiting)&&(!A||X.items.some(d=>d.data&&d.progress<1)),Z=(0,ue.useMemo)(()=>{let d=new Map;for(let E of X.items)E.data&&E.key.startsWith(N)&&d.set(E.key.slice(N.length),{v:E.v,n:E.data,exiting:E.exiting,grow:E.progress});let T=t?[0,0]:[R.info.get(r)?.x??0,R.info.get(r)?.y??0],C=new Map,D=E=>{let K=C.get(E);if(K)return K;let $=d.get(E);if(!$)return T;let H=$.n.parentKey,I=H===null?null:D(H),Q=I?[I[0]+$.v[0],I[1]+$.v[1]]:[$.v[0],$.v[1]];return C.set(E,Q),Q},W=[],z=E=>t?et(R.cx,R.cy,E[1],E[0]):E;for(let[E,K]of d){let $=D(E),H=K.n.parentKey!==null&&d.has(K.n.parentKey),I=H?D(K.n.parentKey):$,[Q,oe]=z($),[ne,Ie]=z(I);W.push({key:E,n:K.n,x:Q,y:oe,a:$[0],r:$[1],px:ne,py:Ie,pa:I[0],pr:I[1],hasParent:H,exiting:K.exiting,grow:K.grow})}return W},[He?X.items:G,R,t,r,N]),ke=(0,ue.useMemo)(()=>new Map(Z.map(d=>[d.key,d])),[Z]),Me=d=>{if(!t){let $=(d.px+d.x)/2;return`M${V(d.px)},${V(d.py)}C${V($)},${V(d.py)} ${V($)},${V(d.y)} ${V(d.x)},${V(d.y)}`}let T=d.pr<.5?d.a:d.pa,C=d.a-T,D=d.r-d.pr,W=$=>{let H=T+C*(3*$*$-2*$*$*$),I=d.pr+D*$,Q=C*(6*$-6*$*$),[oe,ne]=et(R.cx,R.cy,I,H);return[oe,ne,D*Math.sin(H)+I*Math.cos(H)*Q,-D*Math.cos(H)+I*Math.sin(H)*Q]},z=ze(Math.ceil(Math.abs(C)*(d.pr+d.r)/60),1,4),E=`M${V(d.px)},${V(d.py)}`,K=W(0);for(let $=1;$<=z;$++){let H=W($/z),I=1/z/3;E+=`C${V(K[0]+K[2]*I)},${V(K[1]+K[3]*I)} ${V(H[0]-H[2]*I)},${V(H[1]-H[3]*I)} ${V(H[0])},${V(H[1])}`,K=H}return E},de=b.nodes,ut=(0,ue.useMemo)(()=>new Map(de.map((d,T)=>[d,T])),[de]),wi=(0,ue.useMemo)(()=>{let d=new Map;for(let T of de){let C=d.get(T.depth);C?C.push(T):d.set(T.depth,[T])}return d},[de]),Xn=d=>{let T=d.depth-P,C=T===0?[x.root]:[x.under(w(d.parent)),x.below(T)];return C.push(x.kids(d.children.length)),M&&C.push(`${f.t.value} ${f.fv(d.value)}`),u(d)&&C.push(x.collapsed),C.join(", ")},vi=(0,ue.useMemo)(()=>de.map((d,T)=>({datum:d.datum,index:T,key:a.get(d)??d.id,label:w(d),value:M?d.value:null,formatted:Xn(d)})),[de,a,M,x,f.fv,f.t,k,l,c]),$i=d=>{if(!d.children.length)return;let T=a.get(d)??d.id;m(C=>{let D=new Set(C);return D.delete(T)||D.add(T),D})},nn=h.paint("accent"),$t=h.paint("ink"),Yn=h.paint("panel"),Ti=h.paint("muted"),Mi=h.paint("neutral"),Si=h.paint("neutralStrong"),rn=d=>d.path?nn:d.nd===r||d.nd.children.length?$t:Si,he=f.active!==null?de[f.active]:void 0,Jn=()=>f.active===null||!he?!1:($i(he),f.click(f.active),!0),Xe=he?R.info.get(he):void 0,Zn=null;if(he&&Xe){let d=he.depth-P;Zn={x:Xe.x,y:Xe.y-Xe.dot,title:w(he),rows:[...d>0?[{label:x.tipUnder,value:w(he.parent),strong:!1}]:[],{label:x.tipLevel,value:d===0?x.root:String(d),strong:!1},{label:x.tipKids,value:String(he.children.length),strong:!1},...M?[{label:f.t.value,value:f.fv(he.value),color:rn(Xe)}]:[]]}}let Qn=r.children.slice(0,6).map(d=>`${d.label} (${d.children.length})`),qn=[...j.hit].slice(0,5).map(w),Ci=e.description??(i.length?`${x.kind}. ${x.desc(i.length,U,k)}${Qn.length?`: ${Qn.join(", ")}${r.children.length>6?", …":""}`:""}.${qn.length?` ${x.hi} ${qn.join(", ")}${j.hit.size>5?", …":""}.`:""}`:""),Ai=f.via==="keyboard"&&he?`${w(he)}, ${Xn(he)}`:"",er=A?X.get("__fade")?.[0]??1:1,Ni=d=>A?1:X.fade(Math.max(0,d.depth-1)*v+L*.5,280),tr=(d,T,C,D)=>{let W=O.get(d.nd);if(!W)return null;let z=J(d,T.x,T.y,T.a,T.r)[W.k].pose;return(0,te.jsx)("text",{x:V(z.x),y:V(z.y),dy:"0.35em",transform:z.rot?`rotate(${V(z.rot)} ${V(z.x)} ${V(z.y)})`:void 0,textAnchor:z.anchor,fontSize:W.size,fontWeight:W.weight,fill:d.path||d.nd.children.length?$t:Ti,opacity:C<1?V(C*100)/100:void 0,children:W.text},D)},Ri=(0,ue.useMemo)(()=>(0,te.jsxs)(te.Fragment,{children:[(0,te.jsx)("g",{fill:"none",strokeLinecap:"round",children:Z.map(d=>d.hasParent?(0,te.jsx)("path",{d:Me(d),stroke:d.n.path?nn:Mi,strokeWidth:d.n.path?2:1.3,opacity:d.exiting?.5:void 0},d.key):null)}),(0,te.jsx)("g",{children:Z.map(d=>{let T=d.n.dot*(d.hasParent?Math.min(1,d.grow*1.6):1);if(!(T>.05))return null;let C=rn(d.n),D=d.exiting?.5:void 0;return d.n.nd.children.length&&!d.n.open?(0,te.jsxs)("g",{opacity:D,children:[(0,te.jsx)("circle",{cx:V(d.x),cy:V(d.y),r:V(T),fill:C}),(0,te.jsx)("circle",{cx:V(d.x),cy:V(d.y),r:V(T+3),fill:"none",stroke:C,strokeWidth:1.4})]},d.key):(0,te.jsx)("circle",{cx:V(d.x),cy:V(d.y),r:V(T),fill:C,opacity:D},d.key)})}),(0,te.jsx)("g",{stroke:Yn,strokeWidth:3,strokeLinejoin:"round",paintOrder:"stroke",style:{pointerEvents:"none"},children:Z.map(d=>d.exiting?null:tr(d.n,d,Ni(d.n),d.key))})]}),[Z,O,h,He?X.elapsed:1/0]),nr=null;if(Xe){let d=[],T=ke;for(let C=T.get(Xe.key);C;C=C.hasParent?T.get(C.n.parentKey):void 0)d.push(C);nr=(0,te.jsxs)("g",{pointerEvents:"none",children:[d.map(C=>C.hasParent?(0,te.jsx)("path",{d:Me(C),fill:"none",stroke:C.n.path?nn:$t,strokeWidth:2.2,strokeLinecap:"round"},`l${C.key}`):null),d.map(C=>(0,te.jsx)("circle",{cx:V(C.x),cy:V(C.y),r:V(C.n.dot),fill:rn(C.n)},`d${C.key}`)),f.via==="keyboard"&&d[0]?(0,te.jsx)("circle",{cx:V(d[0].x),cy:V(d[0].y),r:V(d[0].n.dot+4),fill:"none",stroke:$t,strokeWidth:2}):null,(0,te.jsx)("g",{stroke:Yn,strokeWidth:3,strokeLinejoin:"round",paintOrder:"stroke",children:d.map(C=>tr(C.n,C,1,`t${C.key}`))})]})}let rr=Math.max(10,Math.min(24,R.colW||R.ring||24));return(0,te.jsxs)(Hr,{c:f,kind:x.kind,ariaLabel:e.ariaLabel,description:Ci,events:vi,tip:Zn,renderTip:e.tooltip,announce:Ai,className:e.className,style:e.style,theme:e.theme,onPointerMove:(d,T,C)=>{let D=-1,W=rr*rr;for(let E=0;E<de.length;E++){let K=R.info.get(de[E]),$=(K.x-d)**2+(K.y-T)**2;$<W&&(W=$,D=E)}let z=D<0?null:D;z!==f.active&&f.setActive(z,C.pointerType==="touch"?"touch":"pointer")},onKey:d=>{let T=he;if(d.key==="Enter"||d.key===" ")return Jn();if(!d.key.startsWith("Arrow"))return!1;if(!T)return f.setActive(0,"keyboard"),!0;let C=t?"ArrowUp":"ArrowLeft",D=t?"ArrowDown":"ArrowRight",W=t?"ArrowRight":"ArrowDown",z;if(d.key===C)z=T===r?void 0:T.parent??void 0;else if(d.key===D)z=u(T)?void 0:T.children[0];else{let E=wi.get(T.depth)??[];z=E[E.indexOf(T)+(d.key===W?1:-1)]}return z&&ut.has(z)&&f.setActive(ut.get(z),"keyboard"),!0},children:[(0,te.jsxs)("g",{onClick:Jn,style:{cursor:he&&(he.children.length||e.onClick)?"pointer":void 0},children:[(0,te.jsx)("rect",{width:p,height:S,fill:"transparent"}),(0,te.jsx)("g",{opacity:f.active!==null?.4:er<1?V(er*100)/100:void 0,className:"ztd-mark",children:Ri})]}),nr]})}var Be=F(Y(),1);function bi(e,t,n){let r=Gt(e);return r?.type==="scatter"&&t?.size!==void 0&&!jt(n)?Gt("bubble"):r}function el(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 tl(e,t,n,r=!1){let o=bi(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&&Mn.includes(o.type)&&Array.isArray(a.hidden)?a.hidden.map(String):[]),c=u=>u.filter(g=>!l.has(g.label)),m=["pie","donut","waffle"];if(o.type==="donut"&&a.legend!=="none")return[];if(m.includes(o.type)){let u=be(i.label,"label"),g=Ke(i.value,"value"),f=o.type==="waffle",h=t.map((b,P)=>({r:b,label:u(b,P),value:f?g(b,P):Jo(g(b,P))})),{kept:p,other:S}=f?{kept:h,other:null}:Yo(h,a.other,(b,P)=>({r:{},label:Xo(ie(n),b),value:P})),x=De(s,p.map(b=>b.r),p.map(b=>b.label),p.map(b=>b.value),f?"first":"max"),k=S?[...p,S]:p,w=We(b=>f?Re(b,k.length,x):Zo(b,k.length,x,a.colorMode)),M=f&&a.shape==="arc";return k.map((b,P)=>({label:b.label,color:w[P],...M&&{shape:"circle"}}))}if(o.type==="candlestick"){let u=Uo(Array.isArray(a.ma)?a.ma:void 0,t.length),g=Vo[ie(n)];return[{label:g.up,color:a.upColor??"accent"},{label:g.down,color:a.downColor??"neutralStrong"},...u.map((f,h)=>({label:g.maLegend(f),color:jn[h],shape:"line"}))]}if(o.type==="network"){let u=oi(a.groups);if(u.length<2)return[];let g=We(f=>ii(f,u.length));return u.map((f,h)=>({label:f,color:g[h],shape:"circle"}))}if(o.type==="symbolMap"){if(typeof i.group!="string")return[];let u=be(i.group,"group"),g=Pe(t.map((h,p)=>u(h,p)).filter(Boolean));if(g.length<2)return[];let f=We(h=>ft(h,g.length,new Set));return g.map((h,p)=>({label:h,color:f[p],shape:"circle"}))}if(o.type==="scatter"){if(typeof i.series!="string"||jt(a))return[];let u=be(i.series,"series"),g=Pe(t.map((p,S)=>u(p,S)));if(g.length<2)return[];let f=Ko(s,t,g,u),h=We(p=>ft(p,g.length,f));return c(g.map((p,S)=>({label:p,color:h[S],shape:"circle"})))}if(o.type==="timeline"){let u=typeof i.group!="string",g=u?i.status:i.group;if(typeof g!="string")return[];let f=Fo(t,g,u),h=We(p=>Re(p,f.length,ai(s,f)));return c(f.map((p,S)=>({label:p,color:h[S],shape:"square"})))}if(["marimekko","area","bar","line","stream","radar"].includes(o.type)){let u=[];if(Array.isArray(i.y))u=i.y;else if(typeof i.series=="string"){let w=be(i.series,"series");u=Pe(t.map((M,b)=>w(M,b)))}let g=Sn(o.type,i,a);if(g.length){let w=De(s,u,u,u.map(()=>0),"none"),M=We(P=>Re(P,u.length,w)),b=u.length<2?[{label:String((Array.isArray(i.y)?i.y[0]:i.y)??"y"),color:"neutral"}]:u.map((P,U)=>({label:P,color:M[U]}));return[...c(b),...g.map((P,U)=>({label:P,color:Wo(U),shape:"line"}))]}if(u.length<2)return[];let h=o.type==="bar"&&a.layout==="diverging"&&s===void 0?eo(u.length,Array.isArray(a.negative)?a.negative.map(w=>u.indexOf(String(w))):[],typeof a.neutral=="string"?u.indexOf(a.neutral):-1):-1,p=h>=0?new Set([h]):De(s,u,u,u.map(()=>0),"first");if(o.type==="radar")return c(u.map((w,M)=>({label:w,color:p.has(M)?"accent":"neutralStrong",shape:"square"})));let S=a.colorMode,x=w=>Re(w,u.length,p);if((o.type==="line"||o.type==="area")&&(x=w=>Go(w,u.length,p,o.type==="area",S)),o.type==="stream"){let w=pt(t,i.x,i.y,i.series,{xType:a.xType,locale:n,aggregate:a.aggregate,dayFirst:a.dayFirst}),M=qo(w.values,a.reorder),b=ei(s,w.series,w.values);x=P=>ti(P,M,b)}let k=We(x);return c(u.map((w,M)=>({label:w,color:k[M],...o.type==="line"&&{shape:"line"}})))}return[]}function nl(e,t){let n=e.facet;return n&&typeof n=="object"&&typeof n.by=="string"&&Vr.includes(t)&&!(t==="bar"&&e.options?.layout==="diverging")?n:void 0}function rl(e,t,n){let{data:r,width:o,height:i,highlight:a,syncId:s,ariaLabel:l,description:c,...m}=n;return{type:e,data:r??[],by:t.by,columns:t.columns,scale:t.scale,chartProps:m,width:o,height:i,highlight:a,syncId:s,title:l,description:c}}function yi(e,t){let{spec:n}=e,r=bi(n.type,n.encoding,n.options),o=(0,vt.useMemo)(()=>Do(n.data),[n.data]),i=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,a=Kr(n,e.locale),s=we(a),l=ie(s),c=vo(i?.url??null,{parse:i?.format??"auto",select:i?.select,init:e.fetchInit,locale:s}),m=Yr(n),u=(0,vt.useMemo)(()=>m?No(m,s):void 0,[m,s]),g=n.options?.hidden,f=Array.isArray(g)?g.map(String):[],h=f.join(""),[p,S]=(0,vt.useState)(null);if(!r)return(0,Be.jsx)(Tn,{error:l==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:a});let x=o??c.data,k=t[r.type],w={...n.options??{}},M={...el(r,n.encoding),...w,...u?{tooltip:u}:{},data:x,...e.width!==void 0?{width:e.width}:{},...e.height!==void 0?{height:e.height}:{},...e.animate!==void 0?{animate:e.animate}:{},...e.replayKey!==void 0?{replayKey:e.replayKey}:{},...e.onHover?{onHover:e.onHover}:{},...e.onClick?{onClick:e.onClick}:{},locale:a},b=n.card?.legend==="toggle"&&Xr(r.type,n.encoding??{},w),P=p&&p.base===h?p.hidden:f;b&&(M.hidden=P);let U=L=>S(A=>{let v=A&&A.base===h?A.hidden:f;return{base:h,hidden:v.includes(L)?v.filter(N=>N!==L):[...v,L]}}),j=M.height??220,R=nl(n,r.type),J=i&&!x.length&&(c.loading||c.error||c.empty)?(0,Be.jsx)(Tn,{loading:c.loading,error:c.error,empty:c.empty,onRetry:c.reload,height:j,locale:a}):R?(0,Be.jsx)(wo,{chart:k,...rl(r.type,R,M)}):(0,Be.jsx)(k,{...M});if(n.card){let L=n.card,A=L.legend==="auto"||L.legend==="toggle"?tl(n,x,s,b):L.legend,v=A?.length?b?(0,Be.jsx)($n,{items:A,hidden:P,onToggle:U,locale:a}):A:void 0,N=L.download?(0,Be.jsx)(Ao,{data:x,columns:Jr(n),filename:L.title??r.type,formats:Array.isArray(L.download)?L.download:void 0,locale:a}):void 0;J=(0,Be.jsx)(Br,{number:L.number,title:L.title??Wr(r,l),subtitle:L.subtitle,legend:v,actions:N,source:L.source||void 0,note:L.note||void 0,accent:L.accent,takeaway:L.takeaway,level:L.level,sample:L.sample,replay:L.replay!==!1,className:e.className,locale:a,children:J})}let O=e.theme??n.theme;return O&&(J=(0,Be.jsx)(Ot,{theme:O,children:J})),J}function ol({cfg:e,components:t}){let n=st();return yi({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function ki(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,xi.hydrateRoot)(r,(0,Un.createElement)(Ot,{theme:o.theme,cssVars:!0},(0,Un.createElement)(ol,{cfg:o,components:{[e]:t}})))}ki("tree",Vn);})();
|