vue-data-ui 3.29.2 → 3.29.4

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.
Files changed (193) hide show
  1. package/dist/{Arrow-CITPKnWF.js → Arrow-DhkzHBsL.js} +1 -1
  2. package/dist/{BaseDraggableDialog-DVstuNhT.js → BaseDraggableDialog-MyWIeEtr.js} +1 -1
  3. package/dist/{BaseIcon-CoY0vuL3.js → BaseIcon-CQFjKDhE.js} +1 -1
  4. package/dist/{BaseLegendToggle-VzX69MCo.js → BaseLegendToggle-CnQ_U5rI.js} +1 -1
  5. package/dist/{BaseZoomControls-D4i_j6vc.js → BaseZoomControls-OZwEB4vm.js} +1 -1
  6. package/dist/{ColorPicker-DmVnJGVv.js → ColorPicker-dbxPO2fg.js} +1 -1
  7. package/dist/{DataTable-KeuZB1JM.js → DataTable-BHW5xD9B.js} +1 -1
  8. package/dist/{HillActions-D--h5brJ.js → HillActions-KXWY_FyA.js} +1 -1
  9. package/dist/{Legend-W9YVYVX-.js → Legend-D5I3jeGD.js} +1 -1
  10. package/dist/{NonSvgPenAndPaper-B2kuh5Yb.js → NonSvgPenAndPaper-RQzq8DqO.js} +1 -1
  11. package/dist/{PackageVersion-C1vtZkKc.js → PackageVersion-B-1JX0wI.js} +1 -1
  12. package/dist/{PenAndPaper-BV5ODysA.js → PenAndPaper-B2UOwiJM.js} +1 -1
  13. package/dist/{Shape-CRe8woTu.js → Shape-DgpYvQc4.js} +1 -1
  14. package/dist/{SlicerPreview-BVgz_p4G.js → SlicerPreview-QaJuNJhX.js} +1 -1
  15. package/dist/{SparkTooltip-Ch06CV71.js → SparkTooltip-dnNSazTu.js} +1 -1
  16. package/dist/{StackChartTable-rTC6w378.js → StackChartTable-mMKxPOnc.js} +1 -1
  17. package/dist/{Title-BliHuXfT.js → Title-DlhGIAWX.js} +1 -1
  18. package/dist/{Tooltip-B432XpvC.js → Tooltip-CL3U31cL.js} +1 -1
  19. package/dist/UserOptions-B97cPcKc.js +1 -0
  20. package/dist/{XyAnalysisOptions-CD0cCtt5.js → XyAnalysisOptions-DeJOjnC3.js} +1 -1
  21. package/dist/{chartImage-DPGnEuYM.js → chartImage-Dvrx_F7P.js} +1 -1
  22. package/dist/components/arrow.js +1 -1
  23. package/dist/components/vue-ui-3d-bar.js +1 -1
  24. package/dist/components/vue-ui-accordion.js +1 -1
  25. package/dist/components/vue-ui-age-pyramid.js +1 -1
  26. package/dist/components/vue-ui-annotator.js +1 -1
  27. package/dist/components/vue-ui-bullet.js +1 -1
  28. package/dist/components/vue-ui-bump.js +1 -1
  29. package/dist/components/vue-ui-candlestick.js +1 -1
  30. package/dist/components/vue-ui-carousel-table.js +1 -1
  31. package/dist/components/vue-ui-chestnut.js +1 -1
  32. package/dist/components/vue-ui-chord.js +1 -1
  33. package/dist/components/vue-ui-circle-pack.js +1 -1
  34. package/dist/components/vue-ui-cursor.js +1 -1
  35. package/dist/components/vue-ui-dag.js +1 -1
  36. package/dist/components/vue-ui-dashboard.js +1 -1
  37. package/dist/components/vue-ui-digits.js +1 -1
  38. package/dist/components/vue-ui-donut-evolution.js +1 -1
  39. package/dist/components/vue-ui-donut.js +1 -1
  40. package/dist/components/vue-ui-dumbbell.js +1 -1
  41. package/dist/components/vue-ui-flow.js +1 -1
  42. package/dist/components/vue-ui-funnel.js +1 -1
  43. package/dist/components/vue-ui-galaxy.js +1 -1
  44. package/dist/components/vue-ui-gauge.js +1 -1
  45. package/dist/components/vue-ui-geo.js +1 -1
  46. package/dist/components/vue-ui-gizmo.js +1 -1
  47. package/dist/components/vue-ui-graph.js +1 -1
  48. package/dist/components/vue-ui-heatmap.js +1 -1
  49. package/dist/components/vue-ui-hill.js +1 -1
  50. package/dist/components/vue-ui-history-plot.js +1 -1
  51. package/dist/components/vue-ui-horizontal-bar.js +1 -1
  52. package/dist/components/vue-ui-icon.js +1 -1
  53. package/dist/components/vue-ui-kpi.js +1 -1
  54. package/dist/components/vue-ui-label.js +1 -1
  55. package/dist/components/vue-ui-mini-loader.js +1 -1
  56. package/dist/components/vue-ui-molecule.js +1 -1
  57. package/dist/components/vue-ui-mood-radar.js +1 -1
  58. package/dist/components/vue-ui-nested-donuts.js +1 -1
  59. package/dist/components/vue-ui-onion.js +1 -1
  60. package/dist/components/vue-ui-parallel-coordinate-plot.js +1 -1
  61. package/dist/components/vue-ui-quadrant.js +1 -1
  62. package/dist/components/vue-ui-quick-chart.js +1 -1
  63. package/dist/components/vue-ui-radar.js +1 -1
  64. package/dist/components/vue-ui-rating.js +1 -1
  65. package/dist/components/vue-ui-relation-circle.js +1 -1
  66. package/dist/components/vue-ui-ridgeline.js +1 -1
  67. package/dist/components/vue-ui-rings.js +1 -1
  68. package/dist/components/vue-ui-scatter.js +1 -1
  69. package/dist/components/vue-ui-skeleton.js +1 -1
  70. package/dist/components/vue-ui-smiley.js +1 -1
  71. package/dist/components/vue-ui-spark-trend.js +1 -1
  72. package/dist/components/vue-ui-sparkbar.js +1 -1
  73. package/dist/components/vue-ui-sparkgauge.js +1 -1
  74. package/dist/components/vue-ui-sparkhistogram.js +1 -1
  75. package/dist/components/vue-ui-sparkline.js +1 -1
  76. package/dist/components/vue-ui-sparkstackbar.js +1 -1
  77. package/dist/components/vue-ui-stackbar.js +1 -1
  78. package/dist/components/vue-ui-stackline.js +1 -1
  79. package/dist/components/vue-ui-strip-plot.js +1 -1
  80. package/dist/components/vue-ui-table-heatmap.js +1 -1
  81. package/dist/components/vue-ui-table-sparkline.js +1 -1
  82. package/dist/components/vue-ui-table.js +1 -1
  83. package/dist/components/vue-ui-thermometer.js +1 -1
  84. package/dist/components/vue-ui-timer.js +1 -1
  85. package/dist/components/vue-ui-tiremarks.js +1 -1
  86. package/dist/components/vue-ui-treemap.js +1 -1
  87. package/dist/components/vue-ui-vertical-bar.js +1 -1
  88. package/dist/components/vue-ui-waffle.js +1 -1
  89. package/dist/components/vue-ui-wheel.js +1 -1
  90. package/dist/components/vue-ui-word-cloud.js +1 -1
  91. package/dist/components/vue-ui-world.js +1 -1
  92. package/dist/components/vue-ui-xy-canvas.js +1 -1
  93. package/dist/components/vue-ui-xy.js +1 -1
  94. package/dist/{dom-to-png-D56-Zgv4.js → dom-to-png-BciywWcQ.js} +1 -1
  95. package/dist/{exposedLib-BRtClmZy.js → exposedLib-BaycYTOv.js} +1 -1
  96. package/dist/{img-D4RQwASc.js → img-Dwb4XSud.js} +1 -1
  97. package/dist/{labelUtils-CdtU-yB_.js → labelUtils-D_AyGvLO.js} +1 -1
  98. package/dist/{lib-rPeBMZrn.js → lib-BaWaqwnJ.js} +7 -7
  99. package/dist/package-CfW2xYyy.js +1 -0
  100. package/dist/{pdf-CVdqBWVS.js → pdf-Bd6zav8D.js} +1 -1
  101. package/dist/{render-common-DNKT42_W.js → render-common-CxohOkPd.js} +1 -1
  102. package/dist/{resolveChartConfig-0IvbmIE_.js → resolveChartConfig-QgMumfgd.js} +1 -1
  103. package/dist/ssr/vue-ui-donut.js +1 -1
  104. package/dist/ssr/vue-ui-xy.js +1 -1
  105. package/dist/ssr.js +1 -1
  106. package/dist/style.css +1 -1
  107. package/dist/types/vue-data-ui.d.ts +29 -0
  108. package/dist/{useConfig-CXhXxWjB.js → useConfig-B-AzS3w-.js} +1 -1
  109. package/dist/{useNestedProp-DnGoh-XS.js → useNestedProp-ri-deXpG.js} +1 -1
  110. package/dist/{useObjectBindings-BCep9t8A.js → useObjectBindings-DsvXXciT.js} +1 -1
  111. package/dist/{usePrinter-DVf3YcG5.js → usePrinter-CUD8gosC.js} +1 -1
  112. package/dist/utils.js +1 -1
  113. package/dist/vue-data-ui-orKuQ-0A.js +1 -0
  114. package/dist/vue-data-ui.js +1 -1
  115. package/dist/{vue-ui-3d-bar-CNym5PLY.js → vue-ui-3d-bar-BxIOe5pW.js} +1 -1
  116. package/dist/{vue-ui-accordion-D3uT1Ynv.js → vue-ui-accordion-B8LYfVG9.js} +1 -1
  117. package/dist/{vue-ui-age-pyramid-zD6anIub.js → vue-ui-age-pyramid-CsQ6Zx79.js} +1 -1
  118. package/dist/{vue-ui-annotator-aP1DFNt9.js → vue-ui-annotator-xYv2xrXs.js} +1 -1
  119. package/dist/{vue-ui-bullet-CxhIb-XU.js → vue-ui-bullet-CsaTMHaa.js} +1 -1
  120. package/dist/{vue-ui-bump-B8WYM1RE.js → vue-ui-bump-BOVB5hWu.js} +1 -1
  121. package/dist/{vue-ui-candlestick-CwG1H80q.js → vue-ui-candlestick-C8W4sGST.js} +1 -1
  122. package/dist/{vue-ui-carousel-table-CdrxVrHZ.js → vue-ui-carousel-table-DAMT9bn5.js} +1 -1
  123. package/dist/{vue-ui-chestnut-CZG6Ep36.js → vue-ui-chestnut-XdPEyosT.js} +1 -1
  124. package/dist/{vue-ui-chord-DQS4tBWQ.js → vue-ui-chord-CeYpAizS.js} +1 -1
  125. package/dist/{vue-ui-circle-pack-BGbhvnE5.js → vue-ui-circle-pack-Brhoqu25.js} +1 -1
  126. package/dist/{vue-ui-cursor-DTRAPWBW.js → vue-ui-cursor-CieGBz32.js} +1 -1
  127. package/dist/{vue-ui-dag-BGNC8uRQ.js → vue-ui-dag-CC7fXGUn.js} +1 -1
  128. package/dist/{vue-ui-dashboard-DtPlz7y-.js → vue-ui-dashboard-C7oXScoZ.js} +1 -1
  129. package/dist/{vue-ui-digits-gtQiZcOT.js → vue-ui-digits-Cn_wqq4Y.js} +1 -1
  130. package/dist/{vue-ui-donut-COELw22T.js → vue-ui-donut-BHRes5Ak.js} +1 -1
  131. package/dist/{vue-ui-donut-_wqSXunY.js → vue-ui-donut-BXlWXh2v.js} +1 -1
  132. package/dist/{vue-ui-donut-evolution-CdztIQSl.js → vue-ui-donut-evolution-DHPd3KRv.js} +1 -1
  133. package/dist/{vue-ui-dumbbell-CpLMoEet.js → vue-ui-dumbbell-BmqFCL_t.js} +1 -1
  134. package/dist/{vue-ui-flow-DwG1MX2V.js → vue-ui-flow-CvRa8Ija.js} +1 -1
  135. package/dist/{vue-ui-funnel-CisiLlR9.js → vue-ui-funnel-Ds4JV24L.js} +1 -1
  136. package/dist/vue-ui-galaxy-DSHlkl9t.js +1 -0
  137. package/dist/{vue-ui-gauge-CVxKlU2U.js → vue-ui-gauge-2XPqwRR4.js} +1 -1
  138. package/dist/{vue-ui-geo-0PDP2JjE.js → vue-ui-geo-IDzNLYVX.js} +1 -1
  139. package/dist/{vue-ui-gizmo-mFeK8xP1.js → vue-ui-gizmo-BXEnFICN.js} +1 -1
  140. package/dist/{vue-ui-graph-Duw5qG0a.js → vue-ui-graph-DdY8jDH-.js} +2 -2
  141. package/dist/{vue-ui-heatmap-DZM9MvfE.js → vue-ui-heatmap-DmgXUHFz.js} +1 -1
  142. package/dist/{vue-ui-hill-BGQSrcHM.js → vue-ui-hill-CTuh5311.js} +1 -1
  143. package/dist/{vue-ui-history-plot-EGeDhkdS.js → vue-ui-history-plot-qpbsJ706.js} +1 -1
  144. package/dist/{vue-ui-horizontal-bar-CtONqcjG.js → vue-ui-horizontal-bar-BnIRG4Da.js} +1 -1
  145. package/dist/{vue-ui-kpi-BSRfwYk9.js → vue-ui-kpi-BvGMMvPY.js} +1 -1
  146. package/dist/{vue-ui-label-W0ITGnQa.js → vue-ui-label-CcVh3FeS.js} +1 -1
  147. package/dist/{vue-ui-mini-loader-BBsXG6nD.js → vue-ui-mini-loader-C7rLQ7JE.js} +1 -1
  148. package/dist/{vue-ui-molecule-DOQ8dsme.js → vue-ui-molecule-BLCwrefH.js} +1 -1
  149. package/dist/{vue-ui-mood-radar-BJeSC-Op.js → vue-ui-mood-radar-Bm12y-t8.js} +1 -1
  150. package/dist/{vue-ui-nested-donuts-DUUmc8K7.js → vue-ui-nested-donuts-BGz-1VHL.js} +1 -1
  151. package/dist/{vue-ui-onion-B8M1x8Jc.js → vue-ui-onion-C23btxVO.js} +1 -1
  152. package/dist/{vue-ui-parallel-coordinate-plot-Dv0eO4ZI.js → vue-ui-parallel-coordinate-plot-E17cuXGN.js} +1 -1
  153. package/dist/{vue-ui-quadrant-_QcgE234.js → vue-ui-quadrant-NJPbHq0p.js} +1 -1
  154. package/dist/{vue-ui-quick-chart-DzJx0LBu.js → vue-ui-quick-chart-CI1n75li.js} +1 -1
  155. package/dist/{vue-ui-radar-C-idGMCp.js → vue-ui-radar-CD1Ge3r9.js} +1 -1
  156. package/dist/{vue-ui-rating-CwD4CB9M.js → vue-ui-rating-mDoJ2Rkg.js} +1 -1
  157. package/dist/{vue-ui-relation-circle-Dl2XO5DU.js → vue-ui-relation-circle-CQPFqgsl.js} +1 -1
  158. package/dist/{vue-ui-ridgeline-SG44P21X.js → vue-ui-ridgeline-C0fxNnYy.js} +1 -1
  159. package/dist/{vue-ui-rings-b8Ms_mTp.js → vue-ui-rings-D2XUhWg-.js} +1 -1
  160. package/dist/{vue-ui-scatter-KPiaTVuv.js → vue-ui-scatter-DgfuFep8.js} +1 -1
  161. package/dist/{vue-ui-skeleton-Dg0tACvE.js → vue-ui-skeleton-BUMvfDJX.js} +1 -1
  162. package/dist/{vue-ui-smiley-B34VeonG.js → vue-ui-smiley-aTCVrK-n.js} +1 -1
  163. package/dist/{vue-ui-spark-trend-C3EXOm2F.js → vue-ui-spark-trend-B1S6SaGz.js} +1 -1
  164. package/dist/{vue-ui-sparkbar-CCjgG6pR.js → vue-ui-sparkbar-DtGqqvGS.js} +1 -1
  165. package/dist/{vue-ui-sparkgauge-DnxHmWiH.js → vue-ui-sparkgauge-yEOfuIEu.js} +1 -1
  166. package/dist/{vue-ui-sparkhistogram--QcZmUje.js → vue-ui-sparkhistogram-nM2G2AJx.js} +1 -1
  167. package/dist/{vue-ui-sparkline-D1BPdZdr.js → vue-ui-sparkline-B7ZZzccR.js} +1 -1
  168. package/dist/{vue-ui-sparkstackbar-CxF1OSDL.js → vue-ui-sparkstackbar-CTCvV0UA.js} +1 -1
  169. package/dist/{vue-ui-stackbar-yKTDxwXp.js → vue-ui-stackbar-DTlq5Fmr.js} +1 -1
  170. package/dist/{vue-ui-stackline-BPdR_8x0.js → vue-ui-stackline-DgV0GCOn.js} +1 -1
  171. package/dist/{vue-ui-strip-plot-CAmBydR2.js → vue-ui-strip-plot-DlIqyn9G.js} +1 -1
  172. package/dist/{vue-ui-table-BKfGLJgN.js → vue-ui-table-B1QawDAY.js} +1 -1
  173. package/dist/{vue-ui-table-heatmap-CpviNfWA.js → vue-ui-table-heatmap-DFjVopuI.js} +1 -1
  174. package/dist/{vue-ui-table-sparkline-CVomhgHC.js → vue-ui-table-sparkline-D15wq2iu.js} +1 -1
  175. package/dist/{vue-ui-thermometer-DNRR87NF.js → vue-ui-thermometer-gK8M0jyN.js} +1 -1
  176. package/dist/{vue-ui-timer-Bx5D4QsO.js → vue-ui-timer-Be4jnf30.js} +2 -2
  177. package/dist/{vue-ui-tiremarks-CnZqIcFq.js → vue-ui-tiremarks-B1PF45Fh.js} +1 -1
  178. package/dist/{vue-ui-treemap-D7k9vWC9.js → vue-ui-treemap-CProQJII.js} +1 -1
  179. package/dist/{vue-ui-waffle-BHcDq09N.js → vue-ui-waffle-C9QBRGRd.js} +1 -1
  180. package/dist/{vue-ui-wheel-Cd3P9Nq4.js → vue-ui-wheel-EBNVnATV.js} +1 -1
  181. package/dist/vue-ui-word-cloud-D_wT_OgE.js +4 -0
  182. package/dist/{vue-ui-world-bZ7gOrS1.js → vue-ui-world-CvjzqQPz.js} +1 -1
  183. package/dist/{vue-ui-xy-Y_MKCMGp.js → vue-ui-xy-B0z97XdU.js} +1 -1
  184. package/dist/{vue-ui-xy-BTGZ1NSt.js → vue-ui-xy-ZTbijg4Q.js} +3 -3
  185. package/dist/{vue-ui-xy-canvas-C8Xi5Bad.js → vue-ui-xy-canvas-QqaK6zlu.js} +1 -1
  186. package/dist/vue_ui_galaxy-fL8NyfDy.js +1 -0
  187. package/package.json +15 -15
  188. package/dist/UserOptions-K1N7zQRx.js +0 -1
  189. package/dist/package-BPQ4kSL9.js +0 -1
  190. package/dist/vue-data-ui-CeZQZazG.js +0 -1
  191. package/dist/vue-ui-galaxy-HndquOs-.js +0 -1
  192. package/dist/vue-ui-word-cloud-B7iGPkGe.js +0 -4
  193. package/dist/vue_ui_galaxy-iCWLHLBY.js +0 -1
@@ -1,4 +1,4 @@
1
- import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{n as t,r as n,t as r}from"./userOptionsSlots-CWtXN5Q6.js";import{n as i,r as a,t as o}from"./annotationSlots-OLiW25XN.js";import{n as s,t as c}from"./tableIntegration-CNoJ1CIY.js";import{t as l}from"./chartImage-DPGnEuYM.js";import{$ as u,Bt as ee,D as te,Dt as ne,Ht as d,It as re,Jt as ie,S as f,X as p,Y as ae,Yt as oe,Zt as se,at as ce,b as le,dt as ue,f as m,h as de,i as h,in as fe,it as pe,j as me,nn as he,nt as ge,p as g,s as _e,t as ve,ut as ye,w as be,yt as xe,zt as Se}from"./lib-rPeBMZrn.js";import{n as Ce,t as we}from"./labelUtils-CdtU-yB_.js";import{c as Te}from"./canvas-lib-22VpOI4_.js";import{n as Ee,t as De}from"./useHints-C-TwxM0Y.js";import{t as Oe}from"./useConfig-CXhXxWjB.js";import{t as ke}from"./usePrinter-DVf3YcG5.js";import{t as Ae}from"./useLoading-DoqqfnmS.js";import{t as je}from"./useResponsive-CENUxfEL.js";import{t as Me}from"./useNestedProp-DnGoh-XS.js";import{t as Ne}from"./useThemeCheck-BKNRbGeC.js";import{t as Pe}from"./useChartExport-BZts4KFb.js";import{t as Fe}from"./useUserOptionState-CXlFnwPv.js";import{t as Ie}from"./useChartAccessibility-DOMuYJfm.js";import{t as Le}from"./Shape-CRe8woTu.js";import{n as Re}from"./Title-BliHuXfT.js";import{t as ze}from"./vue_ui_donut-D72uP7v_.js";import{t as Be}from"./Legend-W9YVYVX-.js";import{t as Ve}from"./BaseScanner-m6QR9rwD.js";import{t as He}from"./A11yDataTable-DWNlWXzs.js";import{t as Ue}from"./BaseLegendToggle-VzX69MCo.js";import{t as We}from"./DefGrad-DKMq1REY.js";import{t as Ge}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{Fragment as _,Teleport as Ke,computed as v,createBlock as y,createCommentVNode as b,createElementBlock as x,createElementVNode as S,createSlots as qe,createTextVNode as Je,createVNode as Ye,defineAsyncComponent as Xe,guardReactiveProps as Ze,mergeProps as Qe,nextTick as $e,normalizeClass as et,normalizeProps as tt,normalizeStyle as C,onBeforeUnmount as nt,onMounted as rt,openBlock as w,ref as T,renderList as E,renderSlot as D,resolveDynamicComponent as it,shallowRef as at,toDisplayString as O,toRefs as ot,unref as k,useSlots as st,vShow as ct,watch as lt,withCtx as A,withDirectives as ut}from"vue";function dt(e){let{FINAL_CONFIG:t,noGhostDonut:n,svg:r,padding:i,labels_inline_fontSize:a,minSize:o,findArcMidpoint:s,calcMarkerOffsetX:c,calcMarkerOffsetY:l,animatingIndex:u,segregated:ee,isSmallArc:te}=e;return{smallArcLayoutsClassic:v(()=>{if(t.value.type!==`classic`)return{};let e={},ne=n.value||[];if(!ne.length)return e;let d=r.value.width/2,re=r.value.height/2,ie=i.value.top+16,f=r.value.height-i.value.bottom-16,p=a.value,ae=p/3,oe=p*1.5,se=d-(o.value+6),ce=d+(o.value+6),le=!!t.value.style.chart.layout.curvedMarkers;function ue({midX:e,midY:t,bandX:n,bandY:r}){if(!le)return`M ${e} ${t} L ${e} ${r} L ${n} ${r}`;let i=n<d?-1:1,a=n-e,o=r-t,s=Math.sqrt(a*a+o*o)||1,c=e-d,l=t-re,u=Math.sqrt(c*c+l*l)||1,ee=c/u,te=l/u,ne=u+9;function ie({x:e,y:t}){let n=e-d,r=t-re,i=Math.sqrt(n*n+r*r)||1;if(i>=ne)return{x:e,y:t};let a=ne/i;return{x:d+n*a,y:re+r*a}}if(s<56){let i=a/s,c=-(o/s),l=i,u=(e+n)*.5,ne=(t+r)*.5,f=u+c,p=ne+l,ae=(f-d)*(f-d)+(p-re)*(p-re),oe=u-c,se=ne-l;(oe-d)*(oe-d)+(se-re)*(se-re)>ae&&(c=-c,l=-l);let ce=.78,le=e+a*ce,ue=t+o*ce,m=Math.max(0,Math.min(1,(s-18)/44)),de=m*m*(3-2*m),h=2.5+de*4,fe=1+de*2.5;h*=.9;let pe=ie({x:le+c*h+ee*fe,y:ue+l*h+te*fe});return`M ${e} ${t} Q ${pe.x} ${pe.y} ${n} ${r}`}let f=s*.34;f<20&&(f=20),f>46&&(f=46);let p=s*.46;p<22&&(p=22),p>70&&(p=70);let ae={x:e+ee*f,y:t+te*f},oe=d+i*Math.max(Math.abs(n-d),ne),se={x:n-i*Math.min(p,Math.abs(oe-n)*.75),y:r},ce=ie(ae),ue=ie(se);return`M ${e} ${t} C ${ce.x} ${ce.y} ${ue.x} ${ue.y} ${n} ${r}`}function m(e){let t=String(e??``).split(/\n/g),n=Math.max(0,t.length-1)*(p*1.2);return oe+n}function de({arc:e,index:t}){let{x:n,y:r}=s(e.path);return{arc:e,index:t,midX:n,midY:r,inlineMarkerX:c(e).x,inlineMarkerY:l(e)-3.5,labelHeight:m(e.name)}}function h(e){let{arc:t}=e,n=t.seriesIndex??0;return u.value===n||ee.value.includes(n)?!1:te(t,n)}function fe(e){let t=e.inlineMarkerY<re,n=e.inlineMarkerX<d;return t&&n?`TL`:t&&!n?`TR`:!t&&n?`BL`:`BR`}function pe(e,t){t.startsWith(`T`)?e.sort((e,t)=>e.inlineMarkerY-t.inlineMarkerY||e.index-t.index):e.sort((e,t)=>t.inlineMarkerY-e.inlineMarkerY||e.index-t.index)}function me({side:e,markerX:t,markerY:n,labelY:r,connectorPath:i}){return{side:e,labelX:e===`left`?t-8:t+8,labelY:r+ae,textAnchor:e===`left`?`end`:`start`,markerX:t,markerY:n,connectorPath:i}}function he({candidateList:t,side:n,bandMarkerX:r,startY:i,direction:a}){let o=i;t.forEach(t=>{let{index:i,midX:s,midY:c,labelHeight:l}=t,u;a===`down`?(u=o,o+=l):(o-=l,u=o);let ee=u,te=ue({midX:s,midY:c,bandX:r,bandY:ee});e[i]=me({side:n,markerX:r,markerY:ee,labelY:u,connectorPath:te})})}let ge=ne.map((e,t)=>de({arc:e,index:t})).filter(h),g={TL:[],TR:[],BL:[],BR:[]};return ge.forEach(e=>{g[fe(e)].push(e)}),Object.keys(g).forEach(e=>{pe(g[e],e)}),he({candidateList:g.TL,side:`left`,bandMarkerX:se,startY:ie,direction:`down`}),he({candidateList:g.TR,side:`right`,bandMarkerX:ce,startY:ie,direction:`down`}),g.BL.length>1&&he({candidateList:g.BL,side:`left`,bandMarkerX:se,startY:f,direction:`up`}),g.BR.length>1&&he({candidateList:g.BR,side:`right`,bandMarkerX:ce,startY:f,direction:`up`}),e})}}var ft=/* @__PURE__ */ e({default:()=>Dn}),pt=[`id`],mt=[`id`],ht=[`id`],gt={style:{position:`relative`}},_t=[`xmlns`,`aria-describedby`,`viewBox`],vt=[`width`,`height`],yt={key:1},bt={key:2},xt=[`id`],St=[`id`],Ct=[`id`],wt=[`flood-color`],Tt=[`id`],Et=[`flood-color`],Dt=[`d`,`stroke`,`filter`],Ot=[`d`,`stroke`,`filter`],kt=[`cx`,`cy`,`r`,`fill`,`filter`],At={key:6},jt=[`stroke`,`d`],Mt=[`d`,`fill`,`stroke`,`stroke-width`,`filter`],Nt={key:0},Pt=[`d`,`fill`,`stroke`,`stroke-width`,`filter`],Ft={key:0},It=[`stroke`,`d`],Lt={key:0},Rt=[`d`,`stroke`,`stroke-width`,`filter`],zt={key:1},Bt=[`d`,`fill`,`stroke`,`stroke-width`,`filter`],Vt=[`d`,`fill`,`stroke`,`stroke-width`,`filter`],Ht={key:1},Ut=[`cx`,`cy`,`r`,`fill`,`stroke`,`stroke-width`],Wt=[`cx`,`cy`,`r`,`fill`,`stroke`,`stroke-width`],Gt={key:0},Kt=[`d`,`fill`,`stroke`,`stroke-width`],qt=[`cx`,`cy`,`r`,`stroke`],Jt=[`cx`,`cy`,`r`,`fill`],Yt=[`cx`,`cy`,`r`],Xt={key:0},Zt=[`d`,`stroke`,`fill`,`onMouseenter`,`onMouseleave`,`onClick`],Qt={key:1},$t=[`cx`,`cy`,`r`],en=[`x`,`y`,`fill`,`font-size`],tn=[`x`,`y`,`fill`,`font-size`],nn=[`x`,`y`,`fill`,`font-size`],rn=[`x`,`y`,`fill`,`font-size`],an=[`filter`,`opacity`],on={key:0},sn=[`x`,`y`],cn={key:1},ln=[`cx`,`cy`,`fill`,`stroke`,`filter`,`onClick`,`onMouseenter`,`onMouseleave`],un=[`text-anchor`,`x`,`y`,`onClick`,`onMouseenter`,`onMouseleave`,`innerHTML`],dn=[`text-anchor`,`x`,`y`,`fill`,`font-size`,`onClick`,`onMouseenter`,`onMouseleave`],fn=[`text-anchor`,`x`,`y`,`fill`,`font-size`,`onClick`,`onMouseenter`,`onMouseleave`,`innerHTML`],pn=[`cx`,`cy`,`fill`,`stroke`,`filter`,`onClick`,`onMouseenter`,`onMouseleave`],mn=[`text-anchor`,`x`,`y`,`onClick`,`onMouseenter`,`onMouseleave`,`innerHTML`],hn=[`text-anchor`,`x`,`y`,`fill`,`font-size`,`onClick`,`onMouseenter`,`onMouseleave`],gn=[`text-anchor`,`x`,`y`,`fill`,`font-size`,`onClick`,`onMouseenter`,`onMouseleave`,`innerHTML`],_n={key:2},vn=[`x`,`y`,`width`],yn=[`x`,`y`,`width`],bn={key:0,style:{position:`absolute`,top:`100%`,left:`0`,width:`100%`},"data-dom-to-png-ignore":``,"aria-hidden":`true`},xn={key:5,class:`vue-data-ui-watermark`},Sn=[`id`],Cn=[`onClick`],wn={key:8,class:`vue-ui-donut-hollow`},Tn={key:0},En={key:1},Dn=/*#__PURE__*/ Ge({__name:`vue-ui-donut`,props:{config:{type:Object,default(){return{}}},dataset:{type:Array,default(){return[]}}},emits:[`selectLegend`,`selectDatapoint`,`copyAlt`],setup(e,{expose:Ge,emit:ft}){let Dn=Xe(()=>import(`./Tooltip-B432XpvC.js`)),On=Xe(()=>import(`./BaseIcon-CoY0vuL3.js`).then(e=>e.n)),kn=Xe(()=>import(`./vue-ui-accordion-D3uT1Ynv.js`).then(e=>e.n)),An=Xe(()=>import(`./DataTable-KeuZB1JM.js`)),jn=Xe(()=>import(`./PenAndPaper-BV5ODysA.js`).then(e=>e.t)),Mn=Xe(()=>import(`./UserOptions-K1N7zQRx.js`).then(e=>e.n)),Nn=Xe(()=>import(`./PackageVersion-C1vtZkKc.js`).then(e=>e.t)),Pn=Xe(()=>import(`./BaseDraggableDialog-DVstuNhT.js`).then(e=>e.n)),{vue_ui_donut:Fn}=Oe(),{isThemeValid:In,warnInvalidTheme:Ln}=Ne(),Rn=st(),j=e,zn=v(()=>!!j.dataset?.length),Bn=at(null),Vn=T(null),Hn=T(null),Un=T(null),Wn=at(null),Gn=at(null),Kn=at(null),qn=at(null),Jn=at(null),Yn=at(null),Xn=T(0),Zn=T(0),Qn=T(0),$n=T(!1),er=T(null),tr=T(null),nr=T(null),rr=T({x:0,y:0}),ir=T(`pointer`),ar=T(!1),or=v(()=>P.value.style.chart.layout.labels.percentage.fontSize),sr=v(()=>P.value.style.chart.layout.labels.name.fontSize),cr=v(()=>P.value.style.chart.layout.labels.dataLabels.smallArcClusterFontSize),lr=null,ur=()=>{P.value.autoSize&&lr===null&&(lr=requestAnimationFrame(()=>{lr=null;let e=P.value,t=Vn.value,n=z.value;if(!e.autoSize||!t||!n)return;let[r,i,a,o]=n.getAttribute(`viewBox`).split(` `).map(Number),s={x:r,y:i,width:a,height:o};[{selector:`.vue-data-ui-datalabel-value`,baseSize:F.value.percentage.fontSize,minSize:F.value.percentage.minFontSize},{selector:`.vue-data-ui-datalabel-name`,baseSize:F.value.name.fontSize,minSize:F.value.name.minFontSize},{selector:`.vue-data-ui-datalabel-inline`,baseSize:F.value.dataLabels.smallArcClusterFontSize,minSize:F.value.name.minFontSize}].forEach(({selector:e,baseSize:n,minSize:r})=>{t.querySelectorAll(e).forEach(e=>{_e({el:e,bounds:s,currentFontSize:n,minFontSize:r,attempts:200,padding:1})})})}))};rt(async()=>{$n.value=!0,pr(),ur()});let dr;rt(()=>{Bn.value&&(dr=new ResizeObserver(e=>{for(let t of e){let{width:e,height:n}=t.contentRect;if(e>0&&n>0){ur();break}}}),dr.observe(Bn.value.parentElement))}),nt(()=>{dr?.disconnect(),cancelAnimationFrame(lr),cancelAnimationFrame(Dr),qr+=1,Kn.value&&(qn.value&&Kn.value.unobserve(qn.value),Kn.value.disconnect())});let fr=v(()=>P.value.debug);function pr(){if(Se(j.dataset)?(ce({componentName:`VueUiDonut`,type:`dataset`,debug:fr.value}),Cr.value=!0):(j.dataset.forEach((e,t)=>{xe({datasetObject:e,requiredAttributes:[`name`,`values`]}).forEach(e=>{ce({componentName:`VueUiDonut`,type:`datasetSerieAttribute`,property:e,index:t,debug:fr.value}),Cr.value=!0})}),fr.value&&j.dataset.forEach((e,t)=>{e.name&&e.name!==``||ce({componentName:`VueUiDonut`,type:`datasetAttributeEmpty`,property:`name`,index:t})})),Se(j.dataset)||(Cr.value=P.value.loading),P.value.responsive){let e=Te(()=>{let{width:e,height:t}=je({chart:Bn.value,title:P.value.style.chart.title.text?Wn.value:null,legend:P.value.style.chart.legend.show?Gn.value:null,source:Jn.value,noTitle:Yn.value,padding:P.value.autoSize?void 0:Fr.value});requestAnimationFrame(()=>{V.value.width=e,V.value.height=t,ur()})});Kn.value&&(qn.value&&Kn.value.unobserve(qn.value),Kn.value.disconnect()),Kn.value=new ResizeObserver(e),qn.value=Bn.value.parentNode,Kn.value.observe(qn.value)}}let M=T(p()),mr=T(!1),hr=T(``),N=T(null),gr=T(0);function _r(){let e=Me({userConfig:j.config,defaultConfig:Fn}),t={},n=e.theme;if(!n)t=e;else if(!In.value(e))Ln(e),t=e;else{let r=Me({userConfig:ze[n]||j.config,defaultConfig:e});t={...Me({userConfig:j.config,defaultConfig:r}),customPalette:e.customPalette.length?e.customPalette:he[n]||d}}return t}let P=T(_r()),F=v(()=>P.value.style.chart.layout.labels),I=v(()=>P.value.style.chart.layout.donut),vr=v(()=>P.value.style.chart.layout),L=v(()=>P.value.style.chart);Ee({config:()=>P.value,dataset:()=>j.dataset,component:`VueUiDonut`,rules:[De.singleSeries,De.emptyArray,{test:e=>e.length>6,message:[`👀 The number of series is > 6. Consider:`,``,`▶️ Grouping small values dynamically into a single "Other" series.`,``,`▶️ Using filters to let users choose a maximum number of series to display.`,``,`▶️ Using VueUiHorizontalBar instead to make the dataset breakdown easier to read.`]}]});let yr=v(()=>P.value.userOptions.useCursorPointer),br=v(()=>fe({defaultConfig:{useCssAnimation:!1,table:{show:!1},startAnimation:{show:!1},userOptions:{show:!1},style:{chart:{backgroundColor:`#99999930`,layout:{labels:{dataLabels:{show:!1},hollow:{average:{show:!1},total:{show:!1}},value:{show:!1}}},legend:{backgroundColor:`transparent`,showValue:!1,showPercentage:!1},title:{color:`#1A1A1A`,subtitle:{color:`#5A5A5A`}}}}},userConfig:P.value.skeletonConfig??{}})),{loading:xr,FINAL_DATASET:Sr,manualLoading:Cr,skeletonDataset:wr}=Ae({...ot(j),FINAL_CONFIG:P,prepareConfig:_r,skeletonDataset:j.config?.skeletonDataset??[{name:``,values:[3],color:`#BABABA`},{name:``,values:[2],color:`#AAAAAA`},{name:``,values:[1],color:`#CACACA`}],skeletonConfig:fe({defaultConfig:P.value,userConfig:br.value})}),R=T(!0),Tr=T(0),Er=T(!1),Dr=null;function Or(e=1e3){return new Promise(t=>{let n=performance.now();function r(i){let a=i-n,o=Math.min(a/e,1),s=pe(o);Tr.value=s,o<1?Dr=requestAnimationFrame(r):(Tr.value=1,Dr=null,t())}Dr!==null&&cancelAnimationFrame(Dr),Tr.value=0,Dr=requestAnimationFrame(r)})}lt(()=>xr.value,async e=>{if(e||Er.value)return;let t=Sr.value===wr,n=P.value.startAnimation?.show;!t&&n?(Er.value=!0,await Or(P.value.startAnimation.durationMs||1e3)):Tr.value=1,R.value=!1},{immediate:!0});let{userOptionsVisible:kr,setUserOptionsVisibility:Ar,keepUserOptionState:jr}=Fe({config:P.value}),{svgRef:z}=Ie({config:L.value.title});function Mr(){Ar(!0)}function Nr(){Ar(!1)}let Pr=se(j.config);lt(()=>j.config,(e,t)=>{let n=se(e),r=n!==Pr;Pr=n;let i=_r();r?(xr.value||(P.value=i),kr.value=!P.value.userOptions.showOnChartHover,pr(),Xn.value+=1,Zn.value+=1,Qn.value+=1,B.value.dataLabels.show=F.value.dataLabels.show,B.value.showTable=P.value.table.show,B.value.showTooltip=L.value.tooltip.show,V.value.height=L.value.height,V.value.width=L.value.width):(P.value.style.chart.tooltip=i.style.chart.tooltip,B.value.showTooltip=P.value.style.chart.tooltip.show)},{deep:!0});let Fr=v(()=>{let{top:e,right:t,bottom:n,left:r}=L.value.padding;return{css:`padding:${e}px ${t}px ${n}px ${r}px`,top:e,right:t,bottom:n,left:r}}),{isPrinting:Ir,isImaging:Lr,generatePdf:Rr,generateImage:zr}=ke({elementId:`donut__${M.value}`,fileName:L.value.title.text||`vue-ui-donut`,options:P.value.userOptions.print}),Br=v(()=>P.value.userOptions.show&&!L.value.title.text),Vr=v(()=>be(P.value.customPalette)),B=T({dataLabels:{show:F.value.dataLabels.show},showTable:P.value.table.show,showTooltip:L.value.tooltip.show});lt(P,()=>{B.value={dataLabels:{show:F.value.dataLabels.show},showTable:P.value.table.show,showTooltip:L.value.tooltip.show}},{immediate:!0});let V=T({height:L.value.height,width:L.value.width}),Hr=v(()=>{if(P.value.pie)return W.value;let e=I.value.strokeWidth/512,t=Math.min(V.value.width,V.value.height)*e,n=t>W.value?W.value:t;return Math.max(n,12*(1+e))}),Ur=ft,Wr=v(()=>Sr.value.map((e,t)=>({...e,sourceIndex:t,value:e.values.reduce((e,t)=>e+t,0)}))),H=v(()=>[...Wr.value].sort((e,t)=>P.value.sorted?e.ghost&&!t.ghost?1:t.ghost&&!e.ghost?-1:t.value-e.value:0).map((e,t)=>({name:e.name,sourceIndex:e.sourceIndex,color:f(e.color)||Vr.value[t]||d[t]||d[t%d.length],value:le(e.value),absoluteValues:e.values,comment:e.comment||``,patternIndex:t,seriesIndex:t,ghost:!1,pattern:`pattern_${M.value}_${t}`})));lt(()=>j.dataset,e=>{Array.isArray(e)&&e.length>0&&(Cr.value=!1)},{immediate:!0});let U=T([]),Gr=T(null),Kr=v(()=>Gr.value!==null),qr=0,Jr=null,Yr=at(H.value);lt(()=>H.value,(e,t)=>{let n=Jr!==null,r=new Set(U.value.map(e=>t[e]?.sourceIndex));Jr&&(Jr.hidden?r.add(Jr.sourceIndex):r.delete(Jr.sourceIndex)),qr+=1,Jr=null,Gr.value=null,U.value=e.flatMap((e,t)=>r.has(e.sourceIndex)?[t]:[]),Yr.value=e.map(e=>r.has(e.sourceIndex)?{...e,value:0}:e),n&&Zr(),ur()});function Xr(){return H.value.map(e=>({name:e.name,color:e.color,value:e.value}))}function Zr(){Ur(`selectLegend`,ai.value.map(e=>({name:e.name,color:e.color,value:e.value})))}function Qr({from:e,to:t,duration:n,onUpdate:r,onDone:i,easing:a=pe}){let o=performance.now(),s=qr;function c(l){if(s!==qr)return;let u=Math.min((l-o)/n,1),ee=a(u);r(e+(t-e)*ee,u),u<1?requestAnimationFrame(c):(r(t,1),i&&i())}requestAnimationFrame(c)}function $r(){U.value.length?U.value=[]:oi.value.forEach((e,t)=>{U.value.push(t)}),Zr()}function ei(e){let t=H.value[e],n=Yr.value[e],r=U.value.includes(e);if(!r&&U.value.length>=H.value.length-1)return;r&&(U.value=U.value.filter(t=>t!==e));let i=r?t.value:0;function a(t){Yr.value=Yr.value.map((n,r)=>e===r?{...n,value:t}:n)}function o(){r||U.value.push(e),a(i),Zr()}P.value.serieToggleAnimation.show&&P.value.type===`classic`?(Jr={sourceIndex:t.sourceIndex,hidden:!r},Gr.value=e,Qr({from:n.value,to:i,duration:P.value.serieToggleAnimation.durationMs,onUpdate:e=>{a(e),ur()},onDone:()=>{o(),Jr=null,r||ur(),Gr.value=null}})):(o(),r&&ur())}function ti(e){return H.value.length?H.value.find(t=>t.name===e)||(fr.value&&console.warn(`VueUiDonut - Series name not found "${e}"`),null):(fr.value&&console.warn(`VueUiDonut - There are no series to show.`),null)}function ni(e){let t=ti(e);t!==null&&U.value.includes(t.seriesIndex)&&ei(t.seriesIndex)}function ri(e){let t=ti(e);t!==null&&(U.value.includes(t.seriesIndex)||ei(t.seriesIndex))}let ii=v(()=>mi(Wr.value)),ai=v(()=>{if(R.value&&!xr.value){let e=Tr.value,t=H.value.map(t=>({...t,value:t.value*e,color:t.color,ghost:!1})),n=ii.value*(1-e);return n>0&&t.push({name:`__ghost__`,value:n,color:`transparent`,ghost:!0}),t}return Yr.value.map((e,t)=>({...e,seriesIndex:t})).filter((e,t)=>!U.value.includes(t))}),oi=v(()=>H.value.map(e=>{let t=e.value,n=t/ii.value;return{name:e.name,color:e.color,value:t,shape:`circle`,patternIndex:e.patternIndex,proportion:n}}).map((e,t)=>{let n=h(F.value.value.formatter,e.value,u({p:F.value.dataLabels.prefix,v:e.value,s:F.value.dataLabels.suffix,r:L.value.legend.roundingValue}),{datapoint:e,index:t}),r=h(F.value.percentage.formatter,_i(e),u({v:_i(e),s:`%`,r:L.value.legend.roundingPercentage})),i=Pi({val:n,percentage:U.value.includes(t)?`${Ni(e.proportion*100)}%`:r,showVal:L.value.legend.showValue,showPercentage:L.value.legend.showPercentage,config:L.value.legend});return{...e,opacity:U.value.includes(t)?.5:1,segregate:()=>!Kr.value&&ei(t),isSegregated:U.value.includes(t),display:`${e.name}${L.value.legend.showPercentage||L.value.legend.showValue?`: `:``}${i}`}})),si=v(()=>({cy:`donut-div-legend`,backgroundColor:L.value.legend.backgroundColor,color:L.value.legend.color,fontSize:L.value.legend.fontSize,paddingBottom:12,fontWeight:L.value.legend.bold?`bold`:``})),W=v(()=>{let e=I.value.radiusRatio,t=Math.max(.1,Math.min(.50001,e)),n=Math.min(V.value.width*t,V.value.height*t);return Math.max(12,n)}),G=v(()=>re({series:ai.value},V.value.width/2,V.value.height/2,W.value,W.value,1.99999,2,1,360,105.25,Hr.value)),ci=v(()=>Math.abs(Z.value)>0),li=v(()=>re({series:[{value:1,color:I.value.emptyFill,name:`_`,seriesIndex:0,patternIndex:-1,ghost:!1,absoluteValues:[1]}]},V.value.width/2,V.value.height/2,W.value,W.value,1.99999,2,1,360,105.25,Hr.value)),K=v(()=>G.value.filter(e=>!e.ghost)),q=v(()=>{let e=Math.max(...ai.value.map(e=>e.value)),t=ai.value.map(t=>t.value/e);return me({series:t,center:{x:V.value.width/2,y:V.value.height/2},maxRadius:Math.min(V.value.width,V.value.height)/3,hasGhost:R.value})});function ui(e){return e.x>V.value.width/2+6?`start`:e.x<V.value.width/2-6?`end`:`middle`}let J=v(()=>q.value.map(e=>{let t=t=>ee({initX:e.middlePoint.x,initY:e.middlePoint.y,offset:t,centerX:V.value.width/2,centerY:V.value.height/2});return{anchor:ui(e.middlePoint),marker:t(24),label:t(42)}}));function di(e){return e.middlePoint.y>V.value.height/2?ee({initX:e.middlePoint.x,initY:e.middlePoint.y,offset:100,centerX:V.value.width/2,centerY:V.value.height/2}).y:ee({initX:e.middlePoint.x,initY:e.middlePoint.y,offset:0,centerX:V.value.width/2,centerY:V.value.height/2}).y-100}function Y(e){return e.proportion*100>F.value.dataLabels.hideUnderValue}function fi(e,t){let n=F.value.dataLabels.hideUnderValue,r=F.value.dataLabels.smallArcClusterThreshold,i=(hi.value[t]??e.proportion??0)*100;return i>n&&i<=r}let{smallArcLayoutsClassic:X}=dt({FINAL_CONFIG:P,noGhostDonut:K,svg:V,padding:Fr,labels_inline_fontSize:cr,minSize:W,findArcMidpoint:ye,calcMarkerOffsetX:m,calcMarkerOffsetY:g,animatingIndex:Gr,segregated:U,isSmallArc:fi});function pi(e,t){let n=e.value/mi(t);return isNaN(n)?0:h(F.value.percentage.formatter,n*100,u({v:n*100,s:`%`,r:F.value.percentage.rounding}),{datapoint:e})}function mi(e){return e.reduce((e,t)=>e+t.value,0)}let Z=v(()=>mi(ai.value)),hi=v(()=>{let e=mi(H.value);return e<=0?[]:H.value.map(t=>t.value/e)}),gi=v(()=>Z.value/ai.value.length);function _i(e){return Kr.value?e.proportion*100:e.value/Z.value*100}let vi=T(null),yi=T(!1);function bi({datapoint:e,seriesIndex:t}){P.value.events.datapointLeave&&P.value.events.datapointLeave({datapoint:e,seriesIndex:t}),mr.value=!1,N.value=null,nr.value=null,ir.value=`pointer`}function Q({datapoint:e,relativeIndex:t,seriesIndex:n,show:r=!1,triggerMode:i=`pointer`}){P.value.events.datapointEnter&&P.value.events.datapointEnter({datapoint:e,seriesIndex:n}),ir.value=i,nr.value=t,vi.value={datapoint:e,seriesIndex:n,config:P.value,series:H.value},mr.value=r,N.value=t;let a=``,o=L.value.tooltip.customFormat;if(yi.value=!1,ne(o))try{let t=o({seriesIndex:n,datapoint:e,series:H.value,config:P.value});typeof t==`string`&&(hr.value=t,yi.value=!0)}catch{console.warn(`Custom format cannot be applied.`),yi.value=!1}yi.value||(a+=`<div style="width:100%;text-align:center;border-bottom:1px solid ${L.value.tooltip.borderColor};padding-bottom:6px;margin-bottom:3px;">${e.name}</div>`,a+=`<div style="display:flex;flex-direction:row;gap:6px;align-items:center;"><svg viewBox="0 0 60 60" height="14" width="14"><circle cx="30" cy="30" r="30" stroke="none" fill="${e.color}"/>${Rn.pattern?`<circle cx="30" cy="30" r="30" stroke="none" fill="url(#pattern_${M.value}_${n})"/>`:``}</svg>`,a+=`<b>${Pi({showVal:L.value.tooltip.showValue,showPercentage:L.value.tooltip.showPercentage,val:`<span>${h(F.value.value.formatter,e.value,u({p:F.value.dataLabels.prefix,v:e.value,s:F.value.dataLabels.suffix,r:L.value.tooltip.roundingValue}),{datapoint:e,relativeIndex:t,seriesIndex:n})}</span>`,percentage:h(F.value.percentage.formatter,e.proportion*100,u({v:e.proportion*100,s:`%`,r:L.value.tooltip.roundingPercentage}),{datapoint:e,relativeIndex:t,seriesIndex:n}),config:L.value.tooltip})}</b></div>`,L.value.comments.showInTooltip&&e.comment&&(a+=`<div class="vue-data-ui-tooltip-comment" style="background:${ie(e.color,12.5)}; padding: 6px; margin-bottom: 6px; margin-top:6px; border-left: 1px solid ${e.color}">${e.comment}</div>`),hr.value=`<div>${a}</div>`)}function xi(e,t){let n=X.value[t];if(n)return{textAnchor:n.textAnchor,x:n.labelX,y:n.labelY};let r=m(e,!0,12);return{textAnchor:r.anchor,x:r.x,y:g(e)}}function Si(e,{x:t,fontSize:n,className:r,normalWeight:i}){return String(e.name??``).split(/\n/g).map((e,a)=>`
1
+ import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{n as t,r as n,t as r}from"./userOptionsSlots-CWtXN5Q6.js";import{n as i,r as a,t as o}from"./annotationSlots-OLiW25XN.js";import{n as s,t as c}from"./tableIntegration-CNoJ1CIY.js";import{t as l}from"./chartImage-Dvrx_F7P.js";import{$ as u,Bt as ee,D as te,Dt as ne,Ht as d,It as re,Jt as ie,S as f,X as p,Y as ae,Yt as oe,Zt as se,at as ce,b as le,dt as ue,f as m,h as de,i as h,in as fe,it as pe,j as me,nn as he,nt as ge,p as g,s as _e,t as ve,ut as ye,w as be,yt as xe,zt as Se}from"./lib-BaWaqwnJ.js";import{n as Ce,t as we}from"./labelUtils-D_AyGvLO.js";import{c as Te}from"./canvas-lib-22VpOI4_.js";import{n as Ee,t as De}from"./useHints-C-TwxM0Y.js";import{t as Oe}from"./useConfig-B-AzS3w-.js";import{t as ke}from"./usePrinter-CUD8gosC.js";import{t as Ae}from"./useLoading-DoqqfnmS.js";import{t as je}from"./useResponsive-CENUxfEL.js";import{t as Me}from"./useNestedProp-ri-deXpG.js";import{t as Ne}from"./useThemeCheck-BKNRbGeC.js";import{t as Pe}from"./useChartExport-BZts4KFb.js";import{t as Fe}from"./useUserOptionState-CXlFnwPv.js";import{t as Ie}from"./useChartAccessibility-DOMuYJfm.js";import{t as Le}from"./Shape-DgpYvQc4.js";import{n as Re}from"./Title-DlhGIAWX.js";import{t as ze}from"./vue_ui_donut-D72uP7v_.js";import{t as Be}from"./Legend-D5I3jeGD.js";import{t as Ve}from"./BaseScanner-m6QR9rwD.js";import{t as He}from"./A11yDataTable-DWNlWXzs.js";import{t as Ue}from"./BaseLegendToggle-CnQ_U5rI.js";import{t as We}from"./DefGrad-DKMq1REY.js";import{t as Ge}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{Fragment as _,Teleport as Ke,computed as v,createBlock as y,createCommentVNode as b,createElementBlock as x,createElementVNode as S,createSlots as qe,createTextVNode as Je,createVNode as Ye,defineAsyncComponent as Xe,guardReactiveProps as Ze,mergeProps as Qe,nextTick as $e,normalizeClass as et,normalizeProps as tt,normalizeStyle as C,onBeforeUnmount as nt,onMounted as rt,openBlock as w,ref as T,renderList as E,renderSlot as D,resolveDynamicComponent as it,shallowRef as at,toDisplayString as O,toRefs as ot,unref as k,useSlots as st,vShow as ct,watch as lt,withCtx as A,withDirectives as ut}from"vue";function dt(e){let{FINAL_CONFIG:t,noGhostDonut:n,svg:r,padding:i,labels_inline_fontSize:a,minSize:o,findArcMidpoint:s,calcMarkerOffsetX:c,calcMarkerOffsetY:l,animatingIndex:u,segregated:ee,isSmallArc:te}=e;return{smallArcLayoutsClassic:v(()=>{if(t.value.type!==`classic`)return{};let e={},ne=n.value||[];if(!ne.length)return e;let d=r.value.width/2,re=r.value.height/2,ie=i.value.top+16,f=r.value.height-i.value.bottom-16,p=a.value,ae=p/3,oe=p*1.5,se=d-(o.value+6),ce=d+(o.value+6),le=!!t.value.style.chart.layout.curvedMarkers;function ue({midX:e,midY:t,bandX:n,bandY:r}){if(!le)return`M ${e} ${t} L ${e} ${r} L ${n} ${r}`;let i=n<d?-1:1,a=n-e,o=r-t,s=Math.sqrt(a*a+o*o)||1,c=e-d,l=t-re,u=Math.sqrt(c*c+l*l)||1,ee=c/u,te=l/u,ne=u+9;function ie({x:e,y:t}){let n=e-d,r=t-re,i=Math.sqrt(n*n+r*r)||1;if(i>=ne)return{x:e,y:t};let a=ne/i;return{x:d+n*a,y:re+r*a}}if(s<56){let i=a/s,c=-(o/s),l=i,u=(e+n)*.5,ne=(t+r)*.5,f=u+c,p=ne+l,ae=(f-d)*(f-d)+(p-re)*(p-re),oe=u-c,se=ne-l;(oe-d)*(oe-d)+(se-re)*(se-re)>ae&&(c=-c,l=-l);let ce=.78,le=e+a*ce,ue=t+o*ce,m=Math.max(0,Math.min(1,(s-18)/44)),de=m*m*(3-2*m),h=2.5+de*4,fe=1+de*2.5;h*=.9;let pe=ie({x:le+c*h+ee*fe,y:ue+l*h+te*fe});return`M ${e} ${t} Q ${pe.x} ${pe.y} ${n} ${r}`}let f=s*.34;f<20&&(f=20),f>46&&(f=46);let p=s*.46;p<22&&(p=22),p>70&&(p=70);let ae={x:e+ee*f,y:t+te*f},oe=d+i*Math.max(Math.abs(n-d),ne),se={x:n-i*Math.min(p,Math.abs(oe-n)*.75),y:r},ce=ie(ae),ue=ie(se);return`M ${e} ${t} C ${ce.x} ${ce.y} ${ue.x} ${ue.y} ${n} ${r}`}function m(e){let t=String(e??``).split(/\n/g),n=Math.max(0,t.length-1)*(p*1.2);return oe+n}function de({arc:e,index:t}){let{x:n,y:r}=s(e.path);return{arc:e,index:t,midX:n,midY:r,inlineMarkerX:c(e).x,inlineMarkerY:l(e)-3.5,labelHeight:m(e.name)}}function h(e){let{arc:t}=e,n=t.seriesIndex??0;return u.value===n||ee.value.includes(n)?!1:te(t,n)}function fe(e){let t=e.inlineMarkerY<re,n=e.inlineMarkerX<d;return t&&n?`TL`:t&&!n?`TR`:!t&&n?`BL`:`BR`}function pe(e,t){t.startsWith(`T`)?e.sort((e,t)=>e.inlineMarkerY-t.inlineMarkerY||e.index-t.index):e.sort((e,t)=>t.inlineMarkerY-e.inlineMarkerY||e.index-t.index)}function me({side:e,markerX:t,markerY:n,labelY:r,connectorPath:i}){return{side:e,labelX:e===`left`?t-8:t+8,labelY:r+ae,textAnchor:e===`left`?`end`:`start`,markerX:t,markerY:n,connectorPath:i}}function he({candidateList:t,side:n,bandMarkerX:r,startY:i,direction:a}){let o=i;t.forEach(t=>{let{index:i,midX:s,midY:c,labelHeight:l}=t,u;a===`down`?(u=o,o+=l):(o-=l,u=o);let ee=u,te=ue({midX:s,midY:c,bandX:r,bandY:ee});e[i]=me({side:n,markerX:r,markerY:ee,labelY:u,connectorPath:te})})}let ge=ne.map((e,t)=>de({arc:e,index:t})).filter(h),g={TL:[],TR:[],BL:[],BR:[]};return ge.forEach(e=>{g[fe(e)].push(e)}),Object.keys(g).forEach(e=>{pe(g[e],e)}),he({candidateList:g.TL,side:`left`,bandMarkerX:se,startY:ie,direction:`down`}),he({candidateList:g.TR,side:`right`,bandMarkerX:ce,startY:ie,direction:`down`}),g.BL.length>1&&he({candidateList:g.BL,side:`left`,bandMarkerX:se,startY:f,direction:`up`}),g.BR.length>1&&he({candidateList:g.BR,side:`right`,bandMarkerX:ce,startY:f,direction:`up`}),e})}}var ft=/* @__PURE__ */ e({default:()=>Dn}),pt=[`id`],mt=[`id`],ht=[`id`],gt={style:{position:`relative`}},_t=[`xmlns`,`aria-describedby`,`viewBox`],vt=[`width`,`height`],yt={key:1},bt={key:2},xt=[`id`],St=[`id`],Ct=[`id`],wt=[`flood-color`],Tt=[`id`],Et=[`flood-color`],Dt=[`d`,`stroke`,`filter`],Ot=[`d`,`stroke`,`filter`],kt=[`cx`,`cy`,`r`,`fill`,`filter`],At={key:6},jt=[`stroke`,`d`],Mt=[`d`,`fill`,`stroke`,`stroke-width`,`filter`],Nt={key:0},Pt=[`d`,`fill`,`stroke`,`stroke-width`,`filter`],Ft={key:0},It=[`stroke`,`d`],Lt={key:0},Rt=[`d`,`stroke`,`stroke-width`,`filter`],zt={key:1},Bt=[`d`,`fill`,`stroke`,`stroke-width`,`filter`],Vt=[`d`,`fill`,`stroke`,`stroke-width`,`filter`],Ht={key:1},Ut=[`cx`,`cy`,`r`,`fill`,`stroke`,`stroke-width`],Wt=[`cx`,`cy`,`r`,`fill`,`stroke`,`stroke-width`],Gt={key:0},Kt=[`d`,`fill`,`stroke`,`stroke-width`],qt=[`cx`,`cy`,`r`,`stroke`],Jt=[`cx`,`cy`,`r`,`fill`],Yt=[`cx`,`cy`,`r`],Xt={key:0},Zt=[`d`,`stroke`,`fill`,`onMouseenter`,`onMouseleave`,`onClick`],Qt={key:1},$t=[`cx`,`cy`,`r`],en=[`x`,`y`,`fill`,`font-size`],tn=[`x`,`y`,`fill`,`font-size`],nn=[`x`,`y`,`fill`,`font-size`],rn=[`x`,`y`,`fill`,`font-size`],an=[`filter`,`opacity`],on={key:0},sn=[`x`,`y`],cn={key:1},ln=[`cx`,`cy`,`fill`,`stroke`,`filter`,`onClick`,`onMouseenter`,`onMouseleave`],un=[`text-anchor`,`x`,`y`,`onClick`,`onMouseenter`,`onMouseleave`,`innerHTML`],dn=[`text-anchor`,`x`,`y`,`fill`,`font-size`,`onClick`,`onMouseenter`,`onMouseleave`],fn=[`text-anchor`,`x`,`y`,`fill`,`font-size`,`onClick`,`onMouseenter`,`onMouseleave`,`innerHTML`],pn=[`cx`,`cy`,`fill`,`stroke`,`filter`,`onClick`,`onMouseenter`,`onMouseleave`],mn=[`text-anchor`,`x`,`y`,`onClick`,`onMouseenter`,`onMouseleave`,`innerHTML`],hn=[`text-anchor`,`x`,`y`,`fill`,`font-size`,`onClick`,`onMouseenter`,`onMouseleave`],gn=[`text-anchor`,`x`,`y`,`fill`,`font-size`,`onClick`,`onMouseenter`,`onMouseleave`,`innerHTML`],_n={key:2},vn=[`x`,`y`,`width`],yn=[`x`,`y`,`width`],bn={key:0,style:{position:`absolute`,top:`100%`,left:`0`,width:`100%`},"data-dom-to-png-ignore":``,"aria-hidden":`true`},xn={key:5,class:`vue-data-ui-watermark`},Sn=[`id`],Cn=[`onClick`],wn={key:8,class:`vue-ui-donut-hollow`},Tn={key:0},En={key:1},Dn=/*#__PURE__*/ Ge({__name:`vue-ui-donut`,props:{config:{type:Object,default(){return{}}},dataset:{type:Array,default(){return[]}}},emits:[`selectLegend`,`selectDatapoint`,`copyAlt`],setup(e,{expose:Ge,emit:ft}){let Dn=Xe(()=>import(`./Tooltip-CL3U31cL.js`)),On=Xe(()=>import(`./BaseIcon-CQFjKDhE.js`).then(e=>e.n)),kn=Xe(()=>import(`./vue-ui-accordion-B8LYfVG9.js`).then(e=>e.n)),An=Xe(()=>import(`./DataTable-BHW5xD9B.js`)),jn=Xe(()=>import(`./PenAndPaper-B2UOwiJM.js`).then(e=>e.t)),Mn=Xe(()=>import(`./UserOptions-B97cPcKc.js`).then(e=>e.n)),Nn=Xe(()=>import(`./PackageVersion-B-1JX0wI.js`).then(e=>e.t)),Pn=Xe(()=>import(`./BaseDraggableDialog-MyWIeEtr.js`).then(e=>e.n)),{vue_ui_donut:Fn}=Oe(),{isThemeValid:In,warnInvalidTheme:Ln}=Ne(),Rn=st(),j=e,zn=v(()=>!!j.dataset?.length),Bn=at(null),Vn=T(null),Hn=T(null),Un=T(null),Wn=at(null),Gn=at(null),Kn=at(null),qn=at(null),Jn=at(null),Yn=at(null),Xn=T(0),Zn=T(0),Qn=T(0),$n=T(!1),er=T(null),tr=T(null),nr=T(null),rr=T({x:0,y:0}),ir=T(`pointer`),ar=T(!1),or=v(()=>P.value.style.chart.layout.labels.percentage.fontSize),sr=v(()=>P.value.style.chart.layout.labels.name.fontSize),cr=v(()=>P.value.style.chart.layout.labels.dataLabels.smallArcClusterFontSize),lr=null,ur=()=>{P.value.autoSize&&lr===null&&(lr=requestAnimationFrame(()=>{lr=null;let e=P.value,t=Vn.value,n=z.value;if(!e.autoSize||!t||!n)return;let[r,i,a,o]=n.getAttribute(`viewBox`).split(` `).map(Number),s={x:r,y:i,width:a,height:o};[{selector:`.vue-data-ui-datalabel-value`,baseSize:F.value.percentage.fontSize,minSize:F.value.percentage.minFontSize},{selector:`.vue-data-ui-datalabel-name`,baseSize:F.value.name.fontSize,minSize:F.value.name.minFontSize},{selector:`.vue-data-ui-datalabel-inline`,baseSize:F.value.dataLabels.smallArcClusterFontSize,minSize:F.value.name.minFontSize}].forEach(({selector:e,baseSize:n,minSize:r})=>{t.querySelectorAll(e).forEach(e=>{_e({el:e,bounds:s,currentFontSize:n,minFontSize:r,attempts:200,padding:1})})})}))};rt(async()=>{$n.value=!0,pr(),ur()});let dr;rt(()=>{Bn.value&&(dr=new ResizeObserver(e=>{for(let t of e){let{width:e,height:n}=t.contentRect;if(e>0&&n>0){ur();break}}}),dr.observe(Bn.value.parentElement))}),nt(()=>{dr?.disconnect(),cancelAnimationFrame(lr),cancelAnimationFrame(Dr),qr+=1,Kn.value&&(qn.value&&Kn.value.unobserve(qn.value),Kn.value.disconnect())});let fr=v(()=>P.value.debug);function pr(){if(Se(j.dataset)?(ce({componentName:`VueUiDonut`,type:`dataset`,debug:fr.value}),Cr.value=!0):(j.dataset.forEach((e,t)=>{xe({datasetObject:e,requiredAttributes:[`name`,`values`]}).forEach(e=>{ce({componentName:`VueUiDonut`,type:`datasetSerieAttribute`,property:e,index:t,debug:fr.value}),Cr.value=!0})}),fr.value&&j.dataset.forEach((e,t)=>{e.name&&e.name!==``||ce({componentName:`VueUiDonut`,type:`datasetAttributeEmpty`,property:`name`,index:t})})),Se(j.dataset)||(Cr.value=P.value.loading),P.value.responsive){let e=Te(()=>{let{width:e,height:t}=je({chart:Bn.value,title:P.value.style.chart.title.text?Wn.value:null,legend:P.value.style.chart.legend.show?Gn.value:null,source:Jn.value,noTitle:Yn.value,padding:P.value.autoSize?void 0:Fr.value});requestAnimationFrame(()=>{V.value.width=e,V.value.height=t,ur()})});Kn.value&&(qn.value&&Kn.value.unobserve(qn.value),Kn.value.disconnect()),Kn.value=new ResizeObserver(e),qn.value=Bn.value.parentNode,Kn.value.observe(qn.value)}}let M=T(p()),mr=T(!1),hr=T(``),N=T(null),gr=T(0);function _r(){let e=Me({userConfig:j.config,defaultConfig:Fn}),t={},n=e.theme;if(!n)t=e;else if(!In.value(e))Ln(e),t=e;else{let r=Me({userConfig:ze[n]||j.config,defaultConfig:e});t={...Me({userConfig:j.config,defaultConfig:r}),customPalette:e.customPalette.length?e.customPalette:he[n]||d}}return t}let P=T(_r()),F=v(()=>P.value.style.chart.layout.labels),I=v(()=>P.value.style.chart.layout.donut),vr=v(()=>P.value.style.chart.layout),L=v(()=>P.value.style.chart);Ee({config:()=>P.value,dataset:()=>j.dataset,component:`VueUiDonut`,rules:[De.singleSeries,De.emptyArray,{test:e=>e.length>6,message:[`👀 The number of series is > 6. Consider:`,``,`▶️ Grouping small values dynamically into a single "Other" series.`,``,`▶️ Using filters to let users choose a maximum number of series to display.`,``,`▶️ Using VueUiHorizontalBar instead to make the dataset breakdown easier to read.`]}]});let yr=v(()=>P.value.userOptions.useCursorPointer),br=v(()=>fe({defaultConfig:{useCssAnimation:!1,table:{show:!1},startAnimation:{show:!1},userOptions:{show:!1},style:{chart:{backgroundColor:`#99999930`,layout:{labels:{dataLabels:{show:!1},hollow:{average:{show:!1},total:{show:!1}},value:{show:!1}}},legend:{backgroundColor:`transparent`,showValue:!1,showPercentage:!1},title:{color:`#1A1A1A`,subtitle:{color:`#5A5A5A`}}}}},userConfig:P.value.skeletonConfig??{}})),{loading:xr,FINAL_DATASET:Sr,manualLoading:Cr,skeletonDataset:wr}=Ae({...ot(j),FINAL_CONFIG:P,prepareConfig:_r,skeletonDataset:j.config?.skeletonDataset??[{name:``,values:[3],color:`#BABABA`},{name:``,values:[2],color:`#AAAAAA`},{name:``,values:[1],color:`#CACACA`}],skeletonConfig:fe({defaultConfig:P.value,userConfig:br.value})}),R=T(!0),Tr=T(0),Er=T(!1),Dr=null;function Or(e=1e3){return new Promise(t=>{let n=performance.now();function r(i){let a=i-n,o=Math.min(a/e,1),s=pe(o);Tr.value=s,o<1?Dr=requestAnimationFrame(r):(Tr.value=1,Dr=null,t())}Dr!==null&&cancelAnimationFrame(Dr),Tr.value=0,Dr=requestAnimationFrame(r)})}lt(()=>xr.value,async e=>{if(e||Er.value)return;let t=Sr.value===wr,n=P.value.startAnimation?.show;!t&&n?(Er.value=!0,await Or(P.value.startAnimation.durationMs||1e3)):Tr.value=1,R.value=!1},{immediate:!0});let{userOptionsVisible:kr,setUserOptionsVisibility:Ar,keepUserOptionState:jr}=Fe({config:P.value}),{svgRef:z}=Ie({config:L.value.title});function Mr(){Ar(!0)}function Nr(){Ar(!1)}let Pr=se(j.config);lt(()=>j.config,(e,t)=>{let n=se(e),r=n!==Pr;Pr=n;let i=_r();r?(xr.value||(P.value=i),kr.value=!P.value.userOptions.showOnChartHover,pr(),Xn.value+=1,Zn.value+=1,Qn.value+=1,B.value.dataLabels.show=F.value.dataLabels.show,B.value.showTable=P.value.table.show,B.value.showTooltip=L.value.tooltip.show,V.value.height=L.value.height,V.value.width=L.value.width):(P.value.style.chart.tooltip=i.style.chart.tooltip,B.value.showTooltip=P.value.style.chart.tooltip.show)},{deep:!0});let Fr=v(()=>{let{top:e,right:t,bottom:n,left:r}=L.value.padding;return{css:`padding:${e}px ${t}px ${n}px ${r}px`,top:e,right:t,bottom:n,left:r}}),{isPrinting:Ir,isImaging:Lr,generatePdf:Rr,generateImage:zr}=ke({elementId:`donut__${M.value}`,fileName:L.value.title.text||`vue-ui-donut`,options:P.value.userOptions.print}),Br=v(()=>P.value.userOptions.show&&!L.value.title.text),Vr=v(()=>be(P.value.customPalette)),B=T({dataLabels:{show:F.value.dataLabels.show},showTable:P.value.table.show,showTooltip:L.value.tooltip.show});lt(P,()=>{B.value={dataLabels:{show:F.value.dataLabels.show},showTable:P.value.table.show,showTooltip:L.value.tooltip.show}},{immediate:!0});let V=T({height:L.value.height,width:L.value.width}),Hr=v(()=>{if(P.value.pie)return W.value;let e=I.value.strokeWidth/512,t=Math.min(V.value.width,V.value.height)*e,n=t>W.value?W.value:t;return Math.max(n,12*(1+e))}),Ur=ft,Wr=v(()=>Sr.value.map((e,t)=>({...e,sourceIndex:t,value:e.values.reduce((e,t)=>e+t,0)}))),H=v(()=>[...Wr.value].sort((e,t)=>P.value.sorted?e.ghost&&!t.ghost?1:t.ghost&&!e.ghost?-1:t.value-e.value:0).map((e,t)=>({name:e.name,sourceIndex:e.sourceIndex,color:f(e.color)||Vr.value[t]||d[t]||d[t%d.length],value:le(e.value),absoluteValues:e.values,comment:e.comment||``,patternIndex:t,seriesIndex:t,ghost:!1,pattern:`pattern_${M.value}_${t}`})));lt(()=>j.dataset,e=>{Array.isArray(e)&&e.length>0&&(Cr.value=!1)},{immediate:!0});let U=T([]),Gr=T(null),Kr=v(()=>Gr.value!==null),qr=0,Jr=null,Yr=at(H.value);lt(()=>H.value,(e,t)=>{let n=Jr!==null,r=new Set(U.value.map(e=>t[e]?.sourceIndex));Jr&&(Jr.hidden?r.add(Jr.sourceIndex):r.delete(Jr.sourceIndex)),qr+=1,Jr=null,Gr.value=null,U.value=e.flatMap((e,t)=>r.has(e.sourceIndex)?[t]:[]),Yr.value=e.map(e=>r.has(e.sourceIndex)?{...e,value:0}:e),n&&Zr(),ur()});function Xr(){return H.value.map(e=>({name:e.name,color:e.color,value:e.value}))}function Zr(){Ur(`selectLegend`,ai.value.map(e=>({name:e.name,color:e.color,value:e.value})))}function Qr({from:e,to:t,duration:n,onUpdate:r,onDone:i,easing:a=pe}){let o=performance.now(),s=qr;function c(l){if(s!==qr)return;let u=Math.min((l-o)/n,1),ee=a(u);r(e+(t-e)*ee,u),u<1?requestAnimationFrame(c):(r(t,1),i&&i())}requestAnimationFrame(c)}function $r(){U.value.length?U.value=[]:oi.value.forEach((e,t)=>{U.value.push(t)}),Zr()}function ei(e){let t=H.value[e],n=Yr.value[e],r=U.value.includes(e);if(!r&&U.value.length>=H.value.length-1)return;r&&(U.value=U.value.filter(t=>t!==e));let i=r?t.value:0;function a(t){Yr.value=Yr.value.map((n,r)=>e===r?{...n,value:t}:n)}function o(){r||U.value.push(e),a(i),Zr()}P.value.serieToggleAnimation.show&&P.value.type===`classic`?(Jr={sourceIndex:t.sourceIndex,hidden:!r},Gr.value=e,Qr({from:n.value,to:i,duration:P.value.serieToggleAnimation.durationMs,onUpdate:e=>{a(e),ur()},onDone:()=>{o(),Jr=null,r||ur(),Gr.value=null}})):(o(),r&&ur())}function ti(e){return H.value.length?H.value.find(t=>t.name===e)||(fr.value&&console.warn(`VueUiDonut - Series name not found "${e}"`),null):(fr.value&&console.warn(`VueUiDonut - There are no series to show.`),null)}function ni(e){let t=ti(e);t!==null&&U.value.includes(t.seriesIndex)&&ei(t.seriesIndex)}function ri(e){let t=ti(e);t!==null&&(U.value.includes(t.seriesIndex)||ei(t.seriesIndex))}let ii=v(()=>mi(Wr.value)),ai=v(()=>{if(R.value&&!xr.value){let e=Tr.value,t=H.value.map(t=>({...t,value:t.value*e,color:t.color,ghost:!1})),n=ii.value*(1-e);return n>0&&t.push({name:`__ghost__`,value:n,color:`transparent`,ghost:!0}),t}return Yr.value.map((e,t)=>({...e,seriesIndex:t})).filter((e,t)=>!U.value.includes(t))}),oi=v(()=>H.value.map(e=>{let t=e.value,n=t/ii.value;return{name:e.name,color:e.color,value:t,shape:`circle`,patternIndex:e.patternIndex,proportion:n}}).map((e,t)=>{let n=h(F.value.value.formatter,e.value,u({p:F.value.dataLabels.prefix,v:e.value,s:F.value.dataLabels.suffix,r:L.value.legend.roundingValue}),{datapoint:e,index:t}),r=h(F.value.percentage.formatter,_i(e),u({v:_i(e),s:`%`,r:L.value.legend.roundingPercentage})),i=Pi({val:n,percentage:U.value.includes(t)?`${Ni(e.proportion*100)}%`:r,showVal:L.value.legend.showValue,showPercentage:L.value.legend.showPercentage,config:L.value.legend});return{...e,opacity:U.value.includes(t)?.5:1,segregate:()=>!Kr.value&&ei(t),isSegregated:U.value.includes(t),display:`${e.name}${L.value.legend.showPercentage||L.value.legend.showValue?`: `:``}${i}`}})),si=v(()=>({cy:`donut-div-legend`,backgroundColor:L.value.legend.backgroundColor,color:L.value.legend.color,fontSize:L.value.legend.fontSize,paddingBottom:12,fontWeight:L.value.legend.bold?`bold`:``})),W=v(()=>{let e=I.value.radiusRatio,t=Math.max(.1,Math.min(.50001,e)),n=Math.min(V.value.width*t,V.value.height*t);return Math.max(12,n)}),G=v(()=>re({series:ai.value},V.value.width/2,V.value.height/2,W.value,W.value,1.99999,2,1,360,105.25,Hr.value)),ci=v(()=>Math.abs(Z.value)>0),li=v(()=>re({series:[{value:1,color:I.value.emptyFill,name:`_`,seriesIndex:0,patternIndex:-1,ghost:!1,absoluteValues:[1]}]},V.value.width/2,V.value.height/2,W.value,W.value,1.99999,2,1,360,105.25,Hr.value)),K=v(()=>G.value.filter(e=>!e.ghost)),q=v(()=>{let e=Math.max(...ai.value.map(e=>e.value)),t=ai.value.map(t=>t.value/e);return me({series:t,center:{x:V.value.width/2,y:V.value.height/2},maxRadius:Math.min(V.value.width,V.value.height)/3,hasGhost:R.value})});function ui(e){return e.x>V.value.width/2+6?`start`:e.x<V.value.width/2-6?`end`:`middle`}let J=v(()=>q.value.map(e=>{let t=t=>ee({initX:e.middlePoint.x,initY:e.middlePoint.y,offset:t,centerX:V.value.width/2,centerY:V.value.height/2});return{anchor:ui(e.middlePoint),marker:t(24),label:t(42)}}));function di(e){return e.middlePoint.y>V.value.height/2?ee({initX:e.middlePoint.x,initY:e.middlePoint.y,offset:100,centerX:V.value.width/2,centerY:V.value.height/2}).y:ee({initX:e.middlePoint.x,initY:e.middlePoint.y,offset:0,centerX:V.value.width/2,centerY:V.value.height/2}).y-100}function Y(e){return e.proportion*100>F.value.dataLabels.hideUnderValue}function fi(e,t){let n=F.value.dataLabels.hideUnderValue,r=F.value.dataLabels.smallArcClusterThreshold,i=(hi.value[t]??e.proportion??0)*100;return i>n&&i<=r}let{smallArcLayoutsClassic:X}=dt({FINAL_CONFIG:P,noGhostDonut:K,svg:V,padding:Fr,labels_inline_fontSize:cr,minSize:W,findArcMidpoint:ye,calcMarkerOffsetX:m,calcMarkerOffsetY:g,animatingIndex:Gr,segregated:U,isSmallArc:fi});function pi(e,t){let n=e.value/mi(t);return isNaN(n)?0:h(F.value.percentage.formatter,n*100,u({v:n*100,s:`%`,r:F.value.percentage.rounding}),{datapoint:e})}function mi(e){return e.reduce((e,t)=>e+t.value,0)}let Z=v(()=>mi(ai.value)),hi=v(()=>{let e=mi(H.value);return e<=0?[]:H.value.map(t=>t.value/e)}),gi=v(()=>Z.value/ai.value.length);function _i(e){return Kr.value?e.proportion*100:e.value/Z.value*100}let vi=T(null),yi=T(!1);function bi({datapoint:e,seriesIndex:t}){P.value.events.datapointLeave&&P.value.events.datapointLeave({datapoint:e,seriesIndex:t}),mr.value=!1,N.value=null,nr.value=null,ir.value=`pointer`}function Q({datapoint:e,relativeIndex:t,seriesIndex:n,show:r=!1,triggerMode:i=`pointer`}){P.value.events.datapointEnter&&P.value.events.datapointEnter({datapoint:e,seriesIndex:n}),ir.value=i,nr.value=t,vi.value={datapoint:e,seriesIndex:n,config:P.value,series:H.value},mr.value=r,N.value=t;let a=``,o=L.value.tooltip.customFormat;if(yi.value=!1,ne(o))try{let t=o({seriesIndex:n,datapoint:e,series:H.value,config:P.value});typeof t==`string`&&(hr.value=t,yi.value=!0)}catch{console.warn(`Custom format cannot be applied.`),yi.value=!1}yi.value||(a+=`<div style="width:100%;text-align:center;border-bottom:1px solid ${L.value.tooltip.borderColor};padding-bottom:6px;margin-bottom:3px;">${e.name}</div>`,a+=`<div style="display:flex;flex-direction:row;gap:6px;align-items:center;"><svg viewBox="0 0 60 60" height="14" width="14"><circle cx="30" cy="30" r="30" stroke="none" fill="${e.color}"/>${Rn.pattern?`<circle cx="30" cy="30" r="30" stroke="none" fill="url(#pattern_${M.value}_${n})"/>`:``}</svg>`,a+=`<b>${Pi({showVal:L.value.tooltip.showValue,showPercentage:L.value.tooltip.showPercentage,val:`<span>${h(F.value.value.formatter,e.value,u({p:F.value.dataLabels.prefix,v:e.value,s:F.value.dataLabels.suffix,r:L.value.tooltip.roundingValue}),{datapoint:e,relativeIndex:t,seriesIndex:n})}</span>`,percentage:h(F.value.percentage.formatter,e.proportion*100,u({v:e.proportion*100,s:`%`,r:L.value.tooltip.roundingPercentage}),{datapoint:e,relativeIndex:t,seriesIndex:n}),config:L.value.tooltip})}</b></div>`,L.value.comments.showInTooltip&&e.comment&&(a+=`<div class="vue-data-ui-tooltip-comment" style="background:${ie(e.color,12.5)}; padding: 6px; margin-bottom: 6px; margin-top:6px; border-left: 1px solid ${e.color}">${e.comment}</div>`),hr.value=`<div>${a}</div>`)}function xi(e,t){let n=X.value[t];if(n)return{textAnchor:n.textAnchor,x:n.labelX,y:n.labelY};let r=m(e,!0,12);return{textAnchor:r.anchor,x:r.x,y:g(e)}}function Si(e,{x:t,fontSize:n,className:r,normalWeight:i}){return String(e.name??``).split(/\n/g).map((e,a)=>`
2
2
  <tspan
3
3
  class="${r}"
4
4
  ${a?`x="${t}" dy="${n*1.2}"`:``}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{n as t,r as n,t as r}from"./userOptionsSlots-CWtXN5Q6.js";import{n as i,r as a,t as o}from"./annotationSlots-OLiW25XN.js";import{t as s}from"./annotationViewport-X8fvs7pz.js";import{n as ee,t as te}from"./tableIntegration-CNoJ1CIY.js";import{t as ne}from"./chartImage-DPGnEuYM.js";import{$ as re,$t as ie,At as ae,D as oe,Ht as se,It as ce,J as le,Jt as ue,Kt as de,S as fe,X as pe,_ as me,at as he,f as ge,h as _e,i as ve,in as ye,nn as be,nt as xe,p as Se,t as Ce,tt as we,w as Te,y as Ee,yt as De,zt as Oe}from"./lib-rPeBMZrn.js";import{n as ke,t as Ae}from"./useHints-C-TwxM0Y.js";import{t as je}from"./useConfig-CXhXxWjB.js";import{t as Me}from"./useSvgLabelLayout-42Kats14.js";import{t as Ne}from"./usePrinter-DVf3YcG5.js";import{t as Pe}from"./useLoading-DoqqfnmS.js";import{t as Fe}from"./useTimeLabels-Das5O74F.js";import{t as Ie}from"./useNestedProp-DnGoh-XS.js";import{t as Le}from"./useResponsive-CENUxfEL.js";import{t as Re}from"./useThemeCheck-BKNRbGeC.js";import{t as ze}from"./useChartExport-BZts4KFb.js";import{t as Be}from"./useTransitions-ChGGrtrv.js";import{t as Ve}from"./useStableElementSize-CegFbRlF.js";import{t as He}from"./useUserOptionState-CXlFnwPv.js";import{t as Ue}from"./useChartAccessibility-DOMuYJfm.js";import{t as We}from"./useTimeLabelCollider-BTybMUFi.js";import{n as Ge}from"./Title-BliHuXfT.js";import{t as Ke}from"./vue_ui_donut_evolution-DNbU1-O1.js";import{t as qe}from"./Legend-W9YVYVX-.js";import{t as Je}from"./SlicerPreview-BVgz_p4G.js";import{t as Ye}from"./BaseScanner-m6QR9rwD.js";import{t as Xe}from"./A11yDataTable-DWNlWXzs.js";import{t as Ze}from"./BaseLegendToggle-VzX69MCo.js";import{t as Qe}from"./DefGrad-DKMq1REY.js";import{t as $e}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{Fragment as c,Teleport as et,computed as l,createBlock as u,createCommentVNode as d,createElementBlock as f,createElementVNode as p,createSlots as tt,createTextVNode as nt,createVNode as rt,defineAsyncComponent as it,guardReactiveProps as at,mergeProps as ot,nextTick as st,normalizeClass as m,normalizeProps as ct,normalizeStyle as lt,onBeforeUnmount as ut,onMounted as dt,openBlock as h,ref as g,renderList as _,renderSlot as v,resolveDynamicComponent as ft,shallowRef as pt,toDisplayString as y,toRefs as mt,unref as b,watch as x,watchEffect as ht,withCtx as S}from"vue";var gt=/* @__PURE__ */ e({default:()=>sn}),_t=[`id`],vt=[`id`],yt={key:2,class:`vue-data-ui-no-title-space`,style:`height:36px; width: 100%;background:transparent`},bt=[`id`],xt={style:{position:`relative`}},St=[`xmlns`,`aria-describedby`,`viewBox`],Ct=[`x`,`y`,`width`,`height`],wt={key:1},Tt=[`x1`,`x2`,`y1`,`y2`,`stroke`,`stroke-width`],Et=[`x1`,`x2`,`y1`,`y2`,`stroke`,`stroke-width`],Dt={key:0},Ot=[`x1`,`x2`,`y1`,`y2`,`stroke`,`stroke-width`],kt=[`font-size`,`fill`,`transform`],At=[`x`,`y`,`font-size`,`fill`],jt=[`d`,`stroke`,`stroke-width`],Mt=[`transform`,`font-size`,`text-anchor`,`fill`,`font-weight`],Nt={key:0},Pt=[`text-anchor`,`font-size`,`fill`,`transform`],Ft=[`text-anchor`,`font-size`,`fill`,`transform`,`innerHTML`],It=[`x1`,`y1`,`x2`,`y2`,`stroke`,`stroke-width`],Lt={key:1},Rt=[`cx`,`cy`,`r`,`fill`],zt={key:0},Bt={key:0},Vt=[`d`,`stroke`],Ht=[`text-anchor`,`x`,`y`,`fill`],Ut=[`cx`,`cy`,`r`,`fill`],Wt={key:0},Gt=[`cx`,`cy`,`fill`],Kt={key:1},qt=[`d`,`fill`,`stroke`],Jt={key:2},Yt=[`d`,`fill`,`stroke`],Xt=[`x`,`y`,`font-size`,`fill`],Zt=[`x`,`y`,`width`,`height`,`fill`],Qt=[`x`,`y`,`width`,`height`,`onMouseenter`,`onMouseleave`,`onClick`],$t=[`x`,`y`,`width`,`height`,`fill`,`fill-opacity`,`stroke`,`stroke-opacity`,`stroke-width`,`stroke-dasharray`],en={key:0,style:{position:`absolute`,top:`100%`,left:`0`,width:`100%`},"data-dom-to-png-ignore":``,"aria-hidden":`true`},tn={key:5,class:`vue-data-ui-watermark`},nn=[`id`],rn=[`onClick`],an={key:0},on={key:1},sn=/*#__PURE__*/ $e({__name:`vue-ui-donut-evolution`,props:{config:{type:Object,default(){return{}}},dataset:{type:Array,default(){return[]}},zoomState:{type:Object,default:null}},emits:[`selectLegend`,`zoomStart`,`zoomEnd`,`zoomReset`,`update:zoomState`,`copyAlt`],setup(e,{expose:$e,emit:gt}){let sn=it(()=>import(`./vue-ui-accordion-D3uT1Ynv.js`).then(e=>e.n)),cn=it(()=>import(`./BaseIcon-CoY0vuL3.js`).then(e=>e.n)),ln=it(()=>import(`./DataTable-KeuZB1JM.js`)),un=it(()=>import(`./PackageVersion-C1vtZkKc.js`).then(e=>e.t)),dn=it(()=>import(`./PenAndPaper-BV5ODysA.js`).then(e=>e.t)),fn=it(()=>import(`./UserOptions-K1N7zQRx.js`).then(e=>e.n)),pn=it(()=>import(`./vue-ui-donut-_wqSXunY.js`).then(e=>e.n)),mn=it(()=>import(`./BaseDraggableDialog-DVstuNhT.js`).then(e=>e.n)),{vue_ui_donut_evolution:hn}=je(),{isThemeValid:gn,warnInvalidTheme:_n}=Re(),C=e,w=g(pe()),T=g([]),E=g(null),vn=g(null),yn=l(()=>vn.value==null?null:vn.value-R.value.start),bn=l(()=>$.value[yn.value]??null),xn=l(()=>!!bn.value),D=g(null),Sn=g(0),Cn=g(0),wn=g(0),Tn=g(0),En=g(null),Dn=g(null),On=g(null),kn=g(null),An=g(!1),jn=g(null),Mn=g(null),Nn=pt(null),Pn=g(0),Fn=g(0),In=g(!1);function Ln(){Nn.value=D.value?.parentNode??null}function Rn(){return new Promise(e=>{requestAnimationFrame(()=>{requestAnimationFrame(e)})})}async function zn(){let e=++Fn.value;await st(),await Rn(),await Rn(),k||e!==Fn.value||(Pn.value+=1)}function Bn(){k||In.value||(In.value=!0,st(()=>{In.value=!1,k||(Ln(),zn())}))}let Vn=Ve({elementRef:Nn,minimumWidth:2,minimumHeight:2,stableFramesRequired:2,once:!1,onSizeAccepted:()=>{zn()}}),Hn=g(null),Un=g(null),Wn=g(null),Gn=g(null),Kn=g(null),O=pt(null),qn=pt(null),k=!1,A=g(null),Jn=g(!1),j=gt,Yn=l(()=>!!C.dataset&&C.dataset.length),Xn=g(!1),Zn=0;dt(()=>{An.value=!0,Ln(),Vn.start(),$n(),zn()});let Qn=l(()=>M.value.debug);function $n(){Oe(C.dataset)?he({componentName:`VueUiDonutEvolution`,type:`dataset`,debug:Qn.value}):C.dataset.length&&C.dataset.forEach((e,t)=>{De({datasetObject:e,requiredAttributes:[`name`,`values`]}).forEach(e=>{he({componentName:`VueUiDonutEvolution`,type:`datasetSerieAttribute`,property:e,index:t,debug:Qn.value})})}),Sr(),er(),Bn()}function er(){if(cancelAnimationFrame(Zn),O.value?.disconnect(),O.value=null,!M.value.responsive){L.value={width:P.value.width,height:P.value.height};return}let e=D.value?.parentNode;if(!e)return;let t=()=>{cancelAnimationFrame(Zn),Zn=requestAnimationFrame(()=>{if(k)return;let{width:e,height:t}=Le({chart:D.value,title:F.value.title.text?Hn.value:null,legend:F.value.legend.show?Un.value:null,slicer:F.value.zoom.show&&or.value>1?Kn.value:null,source:Wn.value});L.value={width:e,height:t-12},Xn.value=!0,Bn()})};O.value=new ResizeObserver(t),qn.value=e,O.value.observe(e),t()}let M=g(Ar()),N=l(()=>P.value.grid),P=l(()=>M.value.style.chart.layout),tr=l(()=>M.value.style.chart.dialog),F=l(()=>M.value.style.chart);ke({config:()=>M.value,dataset:()=>C.dataset,component:`VueUiDonutEvolution`,rules:[Ae.emptyArray,{test:e=>e.length===1,message:[`👀 There is only a single series in your dataset. Consider:`,``,`▶️ Using VueUiXy instead, for a regular line chart.`]},{test:e=>e.length>6,message:[`👀 The number of series is > 6, which makes donuts hard to read. Consider:`,``,`▶️ Grouping small values dynamically into a single "Other" series.`,``,`▶️ Using filters to let users choose a maximum number of series to display.`,``,`▶️ Using VueUiHorizontalBar instead to make the dataset breakdown easier to read.`]},{test:e=>e.some(e=>e.values.length>24),message:[`👀 Some series have a number of data points > 24, which can make the chart and donuts hard to read. Consider:`,``,`▶️ Using larger time scales, or aggregated values.`,``,`▶️ Filtering the time range by adding date intputs in your UI.`,``,`▶️ Using VueUiXy to show longer series in a more comfortable display.`]}]});let{transitionEnabled:nr}=Be({config:()=>M.value.transitions,dataset:()=>C.dataset}),I=l(()=>M.value.userOptions.useCursorPointer),rr=l(()=>ye({defaultConfig:{useCssAnimation:!1,table:{show:!1},userOptions:{show:!1},style:{chart:{backgroundColor:`#99999930`,layout:{dataLabels:{show:!1},grid:{stroke:`#6A6A6A`,axis:{yLabel:``,xLabel:``},yAxis:{scaleMin:null,scaleMax:null,autoScale:!1,dataLabels:{show:!1}},xAxis:{dataLabels:{show:!1}}},line:{stroke:`#CACACA60`}},legend:{backgroundColor:`transparent`,showValue:!1,showPercentage:!1},zoom:{show:!1,startIndex:null,endIndex:null}}}},userConfig:M.value.skeletonConfig??{}})),{loading:ir,FINAL_DATASET:ar}=Pe({...mt(C),FINAL_CONFIG:M,prepareConfig:Ar,callback:()=>{Promise.resolve().then(async()=>{await Sr()})},skeletonDataset:C.config?.skeletonDataset??[{name:``,values:[1,2,3,5,8,13],color:`#AAAAAA`},{name:``,values:[1,2,3,5,8,13],color:`#BABABA`},{name:``,values:[1,2,3,5,8,13],color:`#CACACA`}],skeletonConfig:ye({defaultConfig:M.value,userConfig:rr.value})}),L=g({width:P.value.width,height:P.value.height}),or=l(()=>Math.max(0,...ar.value.map(e=>e.values.length))),R=g({start:0,end:or.value}),z=g(!1),sr=g(!1),B=g(null),V=g(null),H=g(null),cr=g(!1),lr=g({time:0,x:0,y:0,pointerType:null}),ur=l(()=>M.value.style.chart.zoom?.dragToZoom),U=l(()=>ur.value.show&&Yn.value&&fr.value&&Y.value>1&&!ir.value),dr=g(!1),fr=g(!1),pr=g(!1),mr=null,W={};function hr(e,t=R.value){if(!e||typeof e!=`object`)return null;let n=e.start!==void 0&&e.start!==null,r=e.end!==void 0&&e.end!==null;if(!n&&!r)return null;let i=Number(n?e.start:t.start),a=Number(r?e.end:t.end);return!Number.isFinite(i)||!Number.isFinite(a)?null:{start:i,end:a}}function gr(e){let t=hr(e);t&&j(`update:zoomState`,t)}function _r(){mr&&=(cancelAnimationFrame(mr),null),W={}}function vr(e,t=R.value.start){let n=Y.value,r=Number(t);return e>n?n:e<0||e<=r?Math.min(r+1,n):e}function yr(){let e=Y.value;if(!Number.isFinite(e)||e<=0){R.value={start:0,end:0};return}let t=Math.max(0,Math.min(Number(R.value.start)||0,e-1)),n=Math.max(t+1,Math.min(Number(R.value.end)||e,e));(!Number.isFinite(t)||!Number.isFinite(n)||n<=t)&&(t=0,n=e),R.value={start:t,end:n},Gn.value&&Gn.value.setRangeValues(t,n)}function br(e){let t=hr(e);if(!t)return null;let{start:n,end:r}=t;return(n!==Number(R.value.start)||r!==Number(R.value.end))&&(_r(),R.value={start:n,end:r},yr(),Bn()),{start:Number(R.value.start),end:Number(R.value.end)}}function xr(e){let t=br(e);return t?(gr(t),t):null}async function Sr(e=!0){if(!dr.value){dr.value=!0;try{if(await st(),await st(),k)return;let{startIndex:t,endIndex:n}=F.value.zoom,r=Y.value;if(!Number.isFinite(r)||r<=0){R.value={start:0,end:0},fr.value=!0;return}let i=t==null?0:Number(t),a=n==null?r:vr(Number(n)+1,i);pr.value=!0,R.value={start:i,end:a},yr(),fr.value=!0,e&&C.zoomState&&br(C.zoomState)}finally{queueMicrotask(()=>{pr.value=!1}),dr.value=!1,Bn()}}}async function Cr({force:e=!1,publish:t=!1}={}){await Sr(!e),t&&!k&&(gr({start:Number(R.value.start),end:Number(R.value.end)}),j(`zoomReset`))}x([()=>C.zoomState,fr],([e,t])=>{t&&e&&br(e)},{deep:!0,immediate:!0});function wr(e){W={...W,...e},mr&&cancelAnimationFrame(mr),mr=requestAnimationFrame(()=>{let e={...R.value,...W};W={},mr=null,R.value=e,yr(),Bn(),gr({start:Number(R.value.start),end:Number(R.value.end)})})}function Tr(e){if(dr.value||pr.value)return;let t=Number(e);Number.isFinite(t)&&(j(`zoomStart`,{index:t,isZoom:t!==0}),t!==R.value.start&&wr({start:t}))}function Er(e){if(dr.value||pr.value)return;let t=W.start===void 0?R.value.start:W.start,n=vr(Number(e),t);Number.isFinite(n)&&(j(`zoomEnd`,{index:n,isZoom:n!==Y.value}),(n!==R.value.end||W.start!==void 0)&&wr({end:n}))}let{userOptionsVisible:Dr,setUserOptionsVisibility:Or,keepUserOptionState:kr}=He({config:M.value}),{svgRef:G}=Ue({config:F.value.title});function Ar(){let e=Ie({userConfig:C.config,defaultConfig:hn}),t={},n=e.theme;if(n){if(!gn.value(e))_n(e),t=e;else{let r=Ie({userConfig:Ke[n]||C.config,defaultConfig:e});t={...Ie({userConfig:C.config,defaultConfig:r}),customPalette:e.customPalette?e.customPalette:be[n]||se}}}else t=e;return t}x(()=>C.config,e=>{ir.value||(M.value=Ar()),Dr.value=!M.value.userOptions.showOnChartHover,$n(),Cn.value+=1,wn.value+=1,Tn.value+=1,Lr.value.showTable=M.value.table.show},{deep:!0}),x(()=>C.dataset,e=>{Cr()},{deep:!0});let{isPrinting:jr,isImaging:Mr,generatePdf:Nr,generateImage:Pr}=Ne({elementId:w.value,fileName:F.value.title.text||`vue-ui-donut-evolution`,options:M.value.userOptions.print}),Fr=l(()=>M.value.userOptions.show&&!F.value.title.text),Ir=l(()=>Te(M.value.customPalette)),Lr=g({showTable:M.value.table.show});x(M,()=>{Lr.value={showTable:M.value.table.show}},{immediate:!0});let Rr=l(()=>({top:P.value.padding.top,right:P.value.padding.right,bottom:P.value.padding.bottom,left:P.value.padding.left})),K=l(()=>N.value.yAxis.position===`right`),{metrics:zr,ready:Br,settling:Vr,update:Hr}=Me({svgRef:G,canMeasure:()=>(!M.value.responsive||Xn.value)&&(!N.value.xAxis.dataLabels.show||qr.value),initialMetrics:{scaleLabelsWidth:0,yAxisLabelWidth:0,xAxisLabelHeight:0,timeLabelsHeight:0},measure:e=>({scaleLabelsWidth:e(En.value).textWidth,yAxisLabelWidth:e(kn.value).rotatedWidth,xAxisLabelHeight:e(On.value).height,timeLabelsHeight:e(Dn.value).height})});function Ur(){let e=zr.value.scaleLabelsWidth,t=kn.value?zr.value.yAxisLabelWidth+N.value.axis.yLabelOffsetX+N.value.axis.fontSize:0,n=e+t+5;return{left:K.value?0:n,right:K.value?n:0,scaleLabelsWidth:e,yAxisLabelWidth:t,crosshair:5}}ut(()=>{k=!0,Jr+=1,cancelAnimationFrame(Zn),Vn.stop(),_r(),bi(),si(),O.value&&(qn.value&&O.value.unobserve(qn.value),O.value.disconnect(),O.value=null,qn.value=null)});let Wr=l(()=>zr.value.xAxisLabelHeight+zr.value.timeLabelsHeight+N.value.axis.fontSize+N.value.xAxis.dataLabels.offsetY),q=l(()=>{let e=Ur(),t=P.value.dataLabels.fontSize*3,n=L.value.width,r=L.value.height,i=Rr.value.left+e.left,a=n-Rr.value.right-e.right,o=n-i-Rr.value.right-e.right,s=r-Rr.value.top-Rr.value.bottom-t-Wr.value,ee=Rr.value.top+t;return{top:ee,left:i,right:a,bottom:r-Rr.value.bottom-Wr.value,absoluteHeight:r,absoluteWidth:n,centerX:i+Math.max(10,o)/2,centerY:ee+Math.max(10,s)/2,width:Math.max(10,o),height:Math.max(10,s),scaleLabelsWidth:e.scaleLabelsWidth,yAxisLabelWidth:e.yAxisLabelWidth,crosshair:e.crosshair}}),J=l(()=>(Qn.value&&ar.value.forEach((e,t)=>{[null,void 0].includes(e.name)&&he({componentName:`VueUiDonutEvolution`,type:`datasetSerieAttribute`,property:`name`,index:t}),[null,void 0].includes(e.values)&&he({componentName:`VueUiDonutEvolution`,type:`datasetSerieAttribute`,property:`values`,index:t})}),ar.value.map((e,t)=>({...e,values:de(e.values),color:fe(e.color)||Ir.value[t]||se[t]||se[t%se.length],length:(e.values||[]).length,uid:`donut_evolution_${w.value}_${e.id??t}`})))),Gr=l(()=>J.value.filter(e=>!T.value.includes(e.uid)));x(J,e=>{let t=new Set(e.map(e=>e.uid));T.value=T.value.filter(e=>t.has(e))});let Kr=l(()=>Gr.value.map(e=>({...e,values:e.values.slice(R.value.start,R.value.end)}))),Y=l(()=>Math.max(0,...J.value.map(e=>e.length))),X=g([]),qr=g(!1),Jr=0;ht(()=>{let e=++Jr;(async()=>{let t=await Fe({values:N.value.xAxis.dataLabels.values,maxDatapoints:Y.value,formatter:N.value.xAxis.dataLabels.datetimeFormatter,start:R.value.start,end:R.value.end});e===Jr&&(X.value=t,qr.value=!0)})()});let Z=l(()=>q.value.width/(R.value.end-R.value.start)),Yr=l(()=>{let e=[];for(let t=0;t<R.value.end-R.value.start;t+=1){let n=Kr.value.map(e=>e.values[t]??null),r=n.filter(e=>[void 0,null].includes(e)).length===n.length,i=n.reduce((e,t)=>e+t,0),a=n.map(e=>e/i),o=q.value.left+Z.value*t+Z.value/2;e.push({index:t,percentages:a,subtotal:r||i<0?null:i,values:n,x:o})}return e}),Xr=l(()=>{let e=Yr.value.map(e=>e.subtotal).filter(ae),t=e.length?Math.max(...e):1,n=e.length?Math.min(...e):0,r=Math.max(N.value.yAxis.scaleMax??0,t),i;return i=N.value.yAxis.scaleMin==null?0:Math.min(n,N.value.yAxis.scaleMin),N.value.yAxis.autoScale&&(i=n,r=t),i===r&&(i=r/2,r*=1.5),{max:r,min:i}}),Q=l(()=>{let e=Yr.value.length===1?Xr.value.max*2:Xr.value.max;return me(Xr.value.min,e,N.value.yAxis.dataLabels.steps)});x(()=>Q.value.ticks.join(`|`),()=>{Bn()},{flush:`post`});function Zr(e){return(e-Q.value.min)/(Q.value.max-Q.value.min)}let Qr=l(()=>Q.value.ticks.map(e=>({y:q.value.bottom-q.value.height*Zr(e),value:e}))),$r=l(()=>{let e=Yr.value;return e.map((t,n)=>{let r=Math.min(q.value.width/24,Z.value/2*.7),i=r>q.value.width/16?q.value.width/16:r,a=e.length>4?r*2:r*2>Z.value/2*.7?Z.value/2*.7:r*2,o=q.value.bottom-q.value.height*Zr(t.subtotal),s=Kr.value.map(e=>({color:e.color,name:e.name,value:e.values[n]??0})).toSorted((e,t)=>t.value-e.value);return{...t,y:o,radius:i,hoverRadius:a,donut:ce({series:s},t.x,o,i,i,1.99999,2,1,360,105.25,i/2),donutHover:ce({series:s},t.x,o,a,a,1.99999,2,1,360,105.25,a/2),donutFocus:ce({series:s},q.value.centerX,q.value.centerY,q.value.height/3.6,q.value.height/3.6,1.99999,2,1,360,105.25,q.value.height/6)}})}),$=l(()=>$r.value.map(e=>({...e,activeRadius:E.value===e.index?q.value.width/16:e.radius})));function ei(e,t,n){return ve(P.value.dataLabels.formatter,e,re({p:P.value.dataLabels.prefix,v:e,s:P.value.dataLabels.suffix,r:P.value.dataLabels.rounding}),{datapoint:t,index:n})}function ti(e,t){return isNaN(e.value/ie(t,`value`))?0:(e.value/ie(t,`value`)*100).toFixed(0)+`%`}function ni(e){let t=G.value;if(!t)return null;if(t.createSVGPoint&&t.getScreenCTM){let n=t.createSVGPoint();n.x=e.clientX,n.y=e.clientY;let r=t.getScreenCTM();if(r){let e=n.matrixTransform(r.inverse());return{x:e.x,y:e.y}}}let n=t.getBoundingClientRect(),r=t.viewBox?.baseVal||{x:0,y:0,width:n.width,height:n.height},i=Math.min(n.width/r.width,n.height/r.height);if(!Number.isFinite(i)||i<=0)return null;let a=r.width*i,o=r.height*i,s=(n.width-a)/2,ee=(n.height-o)/2;return{x:(e.clientX-n.left-s)/i+r.x,y:(e.clientY-n.top-ee)/i+r.y}}let ri=l(()=>!z.value||B.value==null||V.value==null?null:{x:Math.min(B.value,V.value),y:q.value.top,width:Math.abs(V.value-B.value),height:q.value.height}),ii=l(()=>fr.value?Number(R.value.start)!==0||Number(R.value.end)!==Number(Y.value):!1);function ai(e){return Math.min(Math.max(e,q.value.left),q.value.right)}function oi(){E.value=null,A.value=null}function si(e){let t=e?.pointerId==null?H.value:e.pointerId;t!=null&&G.value?.hasPointerCapture?.(t)&&G.value.releasePointerCapture(t),z.value=!1,B.value=null,V.value=null,H.value=null}function ci(){cr.value=!0,setTimeout(()=>{cr.value=!1},0)}function li(e){cr.value&&(cr.value=!1,e.preventDefault(),e.stopPropagation())}function ui(e){if(!U.value||!ii.value||!e)return!1;let t=Date.now(),n=e.pointerType||`mouse`,r=lr.value,i=n===`touch`?450:350,a=n===`touch`?28:10,o=Math.hypot(e.clientX-r.x,e.clientY-r.y);return r.time>0&&r.pointerType===n&&t-r.time<=i&&o<=a?(lr.value={time:0,x:0,y:0,pointerType:null},ci(),bi(),si(e),Gi(),Cr({force:!0,publish:!0}),!0):(lr.value={time:t,x:e.clientX,y:e.clientY,pointerType:n},!1)}function di(e){let t=Number(R.value.end)-Number(R.value.start);if(t<=0||!Number.isFinite(Z.value)||Z.value<=0)return null;let n=Math.floor((ai(e)-q.value.left)/Z.value);return Math.max(0,Math.min(t-1,n))}function fi(e,t){let n=di(e),r=di(t);if(n==null||r==null)return null;let i=Math.min(n,r),a=Math.max(n,r);return a<=i?null:{start:Number(R.value.start)+i,end:Number(R.value.start)+a+1}}function pi(e){let t=xr(e);return t?(j(`zoomStart`,{index:t.start,isZoom:t.start!==0}),j(`zoomEnd`,{index:t.end,isZoom:t.end!==Y.value}),t):null}function mi(e){if(!U.value||zi.value||e.button!==void 0&&e.button!==0||H.value!=null&&e.pointerId!==H.value)return;let t=ni(e);if(!t||t.x<q.value.left||t.x>q.value.right||t.y<q.value.top||t.y>q.value.bottom||Number(R.value.end)-Number(R.value.start)<=1)return;sr.value=!0,G.value?.focus?.({preventScroll:!0}),bi(),oi();let n=ai(t.x);H.value=e.pointerId,z.value=!0,B.value=n,V.value=n}function hi(e){if(!U.value||!z.value||H.value!=null&&e.pointerId!==H.value)return;let t=ni(e);t&&(V.value=ai(t.x),oi(),B.value!=null&&Math.abs(V.value-B.value)>=2&&!G.value?.hasPointerCapture?.(e.pointerId)&&G.value?.setPointerCapture?.(e.pointerId))}function gi(e){if(!U.value||!z.value||H.value!=null&&e.pointerId!==H.value)return;let t=ni(e);t&&(V.value=ai(t.x));let n=B.value,r=V.value;if((n==null||r==null?0:Math.abs(r-n))<Math.max(4,q.value.width*.01)){if(ui(e))return;si(e);return}let i=fi(Math.min(n,r),Math.max(n,r));i?(si(e),pi(i)&&(lr.value={time:0,x:0,y:0,pointerType:null},oi(),ci())):si(e)}function _i(e){z.value||(E.value=null,A.value=null,M.value.events.datapointLeave&&M.value.events.datapointLeave({datapoint:e,seriesIndex:e.index+R.value.start}))}function vi(e){z.value||(M.value.events.datapointEnter&&M.value.events.datapointEnter({datapoint:e,seriesIndex:e.index+R.value.start}),E.value=e.index,A.value=e.index)}let yi=null;function bi(){yi&&=(clearTimeout(yi),null)}function xi(e,t){M.value.events.datapointClick&&M.value.events.datapointClick({datapoint:e,seriesIndex:e.index+R.value.start}),e.subtotal&&tr.value.show&&(E.value=null,vn.value=(t??e.index)+R.value.start,Wi.value?.open?.())}function Si(e,t){if(bi(),!U.value||!ii.value){xi(e,t);return}let n=lr.value.pointerType===`touch`?480:380;yi=setTimeout(()=>{yi=null,xi(e,t)},n)}let Ci=l(()=>J.value.map((e,t)=>({name:e.name,value:e.values.slice(R.value.start,R.value.end).reduce((e,t)=>e+t,0),shape:`circle`,uid:e.uid,color:e.color})).sort((e,t)=>t.value-e.value).map((e,t)=>({...e,opacity:T.value.includes(e.uid)?.5:1,segregate:()=>Di(e.uid),isSegregated:T.value.includes(e.uid),display:`${e.name}${F.value.legend.showPercentage||F.value.legend.showValue?`: `:``}${F.value.legend.showValue?ve(P.value.dataLabels.formatter,e.value,re({p:P.value.dataLabels.prefix,v:e.value,s:P.value.dataLabels.suffix,r:F.value.legend.roundingValue}),{datapoint:e,seriesIndex:t}):``}${F.value.legend.showPercentage?T.value.includes(e.uid)?`${F.value.legend.showValue?` (`:``}- %${F.value.legend.showValue?`)`:``}`:`${F.value.legend.showValue?` (`:``}${isNaN(e.value/wi.value)?`-`:re({v:e.value/wi.value*100,s:`%`,r:F.value.legend.roundingPercentage})}${F.value.legend.showValue?`)`:``}`:``}`}))),wi=l(()=>Yr.value.map(e=>e.subtotal).reduce((e,t)=>e+t,0)),Ti=l(()=>({cy:`donut-div-legend`,backgroundColor:F.value.legend.backgroundColor,color:F.value.legend.color,fontSize:F.value.legend.fontSize,paddingBottom:12,fontWeight:F.value.legend.bold?`bold`:``}));function Ei(){T.value.length?T.value=[]:Ci.value.forEach(e=>{T.value.push(e.uid)}),j(`selectLegend`,Kr.value)}function Di(e){if(T.value.includes(e))T.value=T.value.filter(t=>t!==e),j(`selectLegend`,Kr.value);else{if(T.value.length===J.value.length-1)return;T.value.push(e),j(`selectLegend`,Kr.value)}}function Oi(e){return J.value.length?J.value.find(t=>t.name===e)||(Qn.value&&console.warn(`VueUiDonutEvolution - Series name not found "${e}"`),null):(Qn.value&&console.warn(`VueUiDonutEvolution - There are no series to show.`),null)}function ki(e){let t=Oi(e);t!==null&&T.value.includes(t.uid)&&Di(t.uid)}function Ai(e){let t=Oi(e);t!==null&&(T.value.includes(t.uid)||Di(t.uid))}let ji=g([]),Mi=0;ht(()=>{let e=++Mi;Fe({values:N.value.xAxis.dataLabels.values,maxDatapoints:Y.value,formatter:N.value.xAxis.dataLabels.datetimeFormatter,start:0,end:Y.value}).then(t=>{!k&&e===Mi&&(ji.value=t)})});let Ni=l(()=>{let e=[``].concat(Gr.value.map(e=>({name:e.name,color:e.color})),[`Σ`]),t=[];for(let e=0;e<Y.value;e+=1){let n=Gr.value.map(t=>t.values[e]??0).reduce((e,t)=>e+t,0);t.push([ji.value[e]?.text??`-`].concat(Gr.value.map(t=>({value:t.values[e]??0,percentage:t.values[e]?t.values[e]/n*100:0})),[`${P.value.dataLabels.prefix}${Number(n.toFixed(M.value.table.td.roundingValue))}${P.value.dataLabels.suffix}`]))}return{head:e,body:t,bodyA11y:t.map(e=>e.map((t,n)=>n===0||n===e.length-1?t:`${ei(t.value??0,null,n)} (${t.percentage.toFixed(1)}%)`)),config:{th:{backgroundColor:M.value.table.th.backgroundColor,color:M.value.table.th.color,outline:M.value.table.th.outline},td:{backgroundColor:M.value.table.td.backgroundColor,color:M.value.table.td.color,outline:M.value.table.td.outline},breakpoint:M.value.table.responsiveBreakpoint},colNames:[M.value.table.columnNames.period].concat(Gr.value.map(e=>e.name),M.value.table.columnNames.total)}});function Pi(){return J.value}function Fi(e=null){st(()=>{let t=[[F.value.title.text],[F.value.title.subtitle.text],[``]],n=[...Ni.value.head.map(e=>e.name??e)],r=[...Ni.value.body.map(e=>e.map(e=>e.value??e))],i=t.concat([n]).concat(r),a=oe(i);e?e(a):xe({csvContent:a,title:F.value.title.text||`vue-ui-donut-evolution`})})}let Ii=g(!1);function Li(e){Ii.value=e,Sn.value+=1}function Ri(){Lr.value.showTable=!Lr.value.showTable}let zi=g(!1);function Bi(){zi.value=!zi.value}function Vi(e){return e.proportion*100>F.value.donuts.hover.hideLabelsUnderValue}let Hi=l(()=>(bn.value?.donut??[]).map(e=>({name:e.name,values:[e.value],color:e.color}))),Ui=l(()=>we({...tr.value.donutChart,responsive:!0,theme:M.value.theme}));x([$r,R],()=>{vn.value!=null&&!bn.value&&Gi()});let Wi=g(null);function Gi(){let e=vn.value!=null;vn.value=null,e&&Wi.value?.close?.(),E.value=null,A.value=null}let Ki=ne(D,()=>F.value.title.text),qi=l(()=>L.value.width),Ji=l(()=>L.value.height);We({timeLabelsEls:Dn,timeLabels:X,slicer:R,configRef:M,rotationPath:[`style`,`chart`,`layout`,`grid`,`xAxis`,`dataLabels`,`rotation`],autoRotatePath:[`style`,`chart`,`layout`,`grid`,`xAxis`,`dataLabels`,`autoRotate`,`enable`],isAutoSize:!1,width:qi,height:Ji,rotation:N.value.xAxis.dataLabels.autoRotate.angle});let Yi=l(()=>te({config:M,style:F,mutableConfig:Lr,dialog:mn,accordion:sn,isFullscreen:Ii,parent:D,maxWidth:800,isCursorPointer:I}));x(()=>Lr.value.showTable,e=>ee(e,M,jn));function Xi(){Lr.value.showTable=!1,Mn.value&&Mn.value.setTableIconState(!1)}let Zi=l(()=>Ci.value.map(e=>({...e,name:e.display}))),Qi=l(()=>F.value.backgroundColor),$i=l(()=>F.value.legend),ea=l(()=>F.value.title),{isCallbackImaging:ta,isCallbackSvg:na,generateSvg:ra,onGenerateImage:ia}=ze({svg:G,title:ea,legend:$i,legendItems:Zi,backgroundColor:Qi,getSvgCallback:()=>M.value.userOptions.callbacks.svg,generateImage:Pr});async function aa(){j(`copyAlt`,{config:M.value,dataset:$.value}),M.value.userOptions.callbacks.altCopy?await Promise.resolve(M.value.userOptions.callbacks.altCopy({config:M.value,dataset:$.value})):console.warn("Vue Data UI - A callback must be set for `altCopy` in userOptions.")}function oa(){A.value=null,Jn.value=!0}function sa(){sr.value=!1,A.value=null,E.value=null,Jn.value=!1}function ca(e){if(!G.value||zi.value||document.activeElement!==G.value||(sr.value=!1,!$.value.length))return;let t=e.key===`ArrowLeft`,n=e.key===`ArrowRight`,r=e.key===`Enter`||e.key===` `,i=e.key===`Escape`;if(!t&&!n&&!r&&!i)return;if(e.preventDefault(),e.stopPropagation(),i){if(U.value&&(ii.value||z.value)){bi(),si(),Gi(),Cr({force:!0,publish:!0});return}A.value=null,E.value=null;return}if(r){if(A.value===null)return;let e=$.value[A.value];if(!e)return;xi(e,A.value);return}let a=A.value,o=E.value,s=a!==null&&a>=0&&a<$.value.length,ee=o!==null&&o>=0&&o<$.value.length;s?n?(a+=1,a>=$.value.length&&(a=0)):t&&(--a,a<0&&(a=$.value.length-1)):ee?(a=n?o+1:o-1,a>=$.value.length&&(a=0),a<0&&(a=$.value.length-1)):a=n?0:$.value.length-1;let te=$.value[a];te&&vi(te)}let la=l(()=>({headers:Ni.value?.colNames??[],rows:Ni.value?.bodyA11y??[]}));$e({getData:Pi,getImage:Ki,generatePdf:Nr,generateCsv:Fi,generateImage:Pr,generateSvg:ra,hideSeries:Ai,showSeries:ki,toggleTable:Ri,toggleAnnotator:Bi,toggleFullscreen:Li,copyAlt:aa,resetZoom:()=>Cr({force:!0,publish:!0}),setZoomState:xr}),x(()=>[L.value.width,L.value.height,Pn.value,X.value,qr.value,R.value.start,R.value.end,N.value,P.value,M.value.style.fontFamily,C.dataset,Xn.value,En.value,Dn.value,On.value,kn.value],Hr,{flush:`post`,deep:!0});let ua=l(()=>s({enabled:M.value.userOptions?.annotator?.followZoom,area:q.value,range:R.value,ticks:Qr.value}));return(e,s)=>(h(),f(`div`,{ref_key:`donutEvolutionChart`,ref:D,class:m(`vue-data-ui-component vue-ui-donut-evolution ${Ii.value?`vue-data-ui-wrapper-fullscreen`:``} ${M.value.useCssAnimation?``:`vue-ui-dna`}`),style:lt(`font-family:${M.value.style.fontFamily};width:100%; text-align:center;background:${F.value.backgroundColor}`),id:w.value,onMouseenter:s[3]||=()=>b(Or)(!0),onMouseleave:s[4]||=()=>b(Or)(!1)},[p(`div`,{id:`chart-instructions-${w.value}`,class:`sr-only`},[p(`p`,null,y(M.value.a11y.translations.keyboardNavigation),1)],8,vt),M.value.a11y.includeTable&&la.value?.rows?.length?(h(),u(Xe,{key:0,uid:w.value,head:la.value.headers,body:la.value.rows,notice:M.value.a11y.translations.tableAvailable,caption:M.value.a11y.translations.tableCaption},null,8,[`uid`,`head`,`body`,`notice`,`caption`])):d(``,!0),M.value.userOptions.buttons.annotator?(h(),u(b(dn),ot({key:1},b(a)(M.value.userOptions.annotator),{svgRef:b(G),followZoom:M.value.userOptions?.annotator?.followZoom,annotationViewport:ua.value,backgroundColor:F.value.backgroundColor,color:F.value.color,active:zi.value,isCursorPointer:I.value,palette:M.value.userOptions.annotatorPalette,onClose:Bi}),tt({_:2},[_(b(o),t=>({name:t,fn:S(n=>[v(e.$slots,t,ct(at(b(i)(t,n))),void 0,!0)])}))]),1040,[`svgRef`,`followZoom`,`annotationViewport`,`backgroundColor`,`color`,`active`,`isCursorPointer`,`palette`])):d(``,!0),Fr.value?(h(),f(`div`,yt)):d(``,!0),F.value.title.text?(h(),f(`div`,{key:3,ref_key:`chartTitle`,ref:Hn,style:`width:100%;background:transparent;padding-bottom:24px`,onMouseleave:_i},[(h(),u(Ge,{key:`title_${Cn.value}`,config:{title:{cy:`donut-evolution-div-title`,...F.value.title},subtitle:{cy:`donut-evolution-div-subtitle`,...F.value.title.subtitle}}},null,8,[`config`]))],544)):d(``,!0),p(`div`,{id:`legend-top-${w.value}`},null,8,bt),M.value.userOptions.show&&Yn.value&&(b(kr)||b(Dr))?(h(),u(b(fn),ot({ref_key:`userOptionsRef`,ref:Mn,key:`user_options_${Sn.value}`,backgroundColor:F.value.backgroundColor,color:F.value.color,isPrinting:b(jr),isImaging:b(Mr),uid:w.value,isFullscreen:Ii.value,chartElement:D.value},b(n)(M.value.userOptions,`pdf csv img svg table fullscreen altCopy annotator`),{isAnnotation:zi.value,tableDialog:M.value.table.useDialog,isCursorPointer:I.value,onToggleFullscreen:Li,onGeneratePdf:b(Nr),onGenerateCsv:Fi,onGenerateImage:b(ia),onGenerateSvg:b(ra),onToggleTable:Ri,onToggleAnnotator:Bi,onCopyAlt:aa,style:{visibility:b(kr)?b(Dr)?`visible`:`hidden`:`visible`}}),tt({_:2},[_(b(t)(e.$slots,`menuIcon optionPdf optionCsv optionImg optionSvg optionTable optionFullscreen optionAnnotator optionAltCopy custom-menu-before custom-menu-after`),t=>({name:t,fn:S(n=>[v(e.$slots,t,ct(at(b(r)(t,n))),void 0,!0)])}))]),1040,[`backgroundColor`,`color`,`isPrinting`,`isImaging`,`uid`,`isFullscreen`,`chartElement`,`isAnnotation`,`tableDialog`,`isCursorPointer`,`onGeneratePdf`,`onGenerateImage`,`onGenerateSvg`,`style`])):d(``,!0),p(`div`,xt,[(h(),f(`svg`,{ref_key:`svgRef`,ref:G,xmlns:b(Ce),"aria-describedby":`chart-instructions-${w.value}`,class:m({"vue-data-ui-fullscreen--on":Ii.value,"vue-data-ui-fulscreen--off":!Ii.value,"vue-data-ui-no-transition":!b(nr)||b(Vr),"vue-ui-donut-evolution-chart-zoom-pointer-focus":U.value&&sr.value}),viewBox:`0 0 ${q.value.absoluteWidth} ${q.value.absoluteHeight}`,style:lt({maxWidth:`100%`,visibility:b(Br)?`visible`:`hidden`,overflow:`visible`,background:`transparent`,color:F.value.color,cursor:U.value?z.value?`col-resize`:`crosshair`:void 0,touchAction:U.value?`pan-y`:void 0,userSelect:U.value?`none`:void 0}),tabindex:`0`,onFocus:oa,onBlur:sa,onKeydown:ca,onPointerdown:mi,onPointermove:hi,onPointerup:gi,onPointercancel:si,onClickCapture:li},[rt(b(un)),v(e.$slots,`svg-underlayer`,{svg:{...q.value,isPrintingImg:b(jr)||b(Mr)||b(ta),isPrintingSvg:b(na)}},void 0,!0),e.$slots[`chart-background`]?(h(),f(`foreignObject`,{key:0,x:q.value.left,y:q.value.top,width:q.value.width,height:q.value.height,style:{pointerEvents:`none`}},[v(e.$slots,`chart-background`,{},void 0,!0)],8,Ct)):d(``,!0),p(`defs`,null,[rt(Qe,{t:`linear`,id:`hover_${w.value}`,x1:`0%`,y1:`0%`,x2:`0%`,y2:`100%`,stops:[[`0%`,b(ue)(F.value.backgroundColor,P.value.highlighter.opacity),1],[`100%`,b(ue)(P.value.highlighter.color,P.value.highlighter.opacity),1]]},null,8,[`id`,`stops`]),rt(Qe,{t:`radial`,id:`focus_${w.value}`,stops:[[`0%`,b(ue)(b(fe)(F.value.backgroundColor),0),1],[`77%`,b(ue)(`#FFFFFF`,30),1],[`100%`,b(ue)(b(fe)(F.value.backgroundColor),0),1]]},null,8,[`id`,`stops`])]),N.value.show?(h(),f(`g`,wt,[p(`line`,{x1:K.value?q.value.right:q.value.left,x2:K.value?q.value.right:q.value.left,y1:q.value.top,y2:q.value.top+q.value.height,stroke:N.value.stroke,"stroke-width":N.value.strokeWidth,"stroke-linecap":`round`},null,8,Tt),p(`line`,{x1:q.value.left,x2:q.value.right,y1:q.value.bottom,y2:q.value.bottom,stroke:N.value.stroke,"stroke-width":N.value.strokeWidth,"stroke-linecap":`round`},null,8,Et),N.value.showVerticalLines?(h(),f(`g`,Dt,[(h(!0),f(c,null,_(R.value.end-R.value.start,(e,t)=>(h(),f(`line`,{x1:q.value.left+(t+1)*Z.value,x2:q.value.left+(t+1)*Z.value,y1:q.value.top,y2:q.value.bottom,stroke:N.value.stroke,"stroke-width":N.value.strokeWidth,"stroke-linecap":`round`},null,8,Ot))),256))])):d(``,!0)])):d(``,!0),p(`g`,null,[N.value.axis.yLabel?(h(),f(`text`,{key:0,ref_key:`yAxisLabel`,ref:kn,"font-size":N.value.axis.fontSize,fill:N.value.axis.color,transform:`translate(${K.value?q.value.absoluteWidth-N.value.axis.fontSize/2-N.value.axis.yLabelOffsetX:N.value.axis.fontSize}, ${q.value.top+q.value.height/2}) rotate(-90)`,"text-anchor":`middle`,style:{transition:`none`}},y(N.value.axis.yLabel),9,kt)):d(``,!0),N.value.axis.xLabel?(h(),f(`text`,{key:1,ref_key:`xAxisLabel`,ref:On,"text-anchor":`middle`,x:q.value.absoluteWidth/2,y:q.value.absoluteHeight-3,"font-size":N.value.axis.fontSize,fill:N.value.axis.color},y(N.value.axis.xLabel),9,At)):d(``,!0)]),N.value.yAxis.dataLabels.show?(h(),f(`g`,{key:2,ref_key:`scaleLabels`,ref:En,class:m({"donut-opacity":!0,"donut-behind":E.value!==null})},[(h(!0),f(c,null,_(Qr.value,(e,t)=>(h(),f(`g`,{key:`sl_${t}`},[e.value>=Q.value.min&&e.value<=Q.value.max?(h(),f(`path`,{key:0,class:m({"vue-data-ui-transition":b(nr)&&!b(Vr)}),d:`M${K.value?q.value.right:q.value.left},${e.y} ${K.value?q.value.right+5:q.value.left-5},${e.y}`,stroke:N.value.stroke,"stroke-width":N.value.strokeWidth,"stroke-linecap":`round`},null,10,jt)):d(``,!0),e.value>=Q.value.min&&e.value<=Q.value.max?(h(),f(`text`,{key:1,class:m({"vue-data-ui-transition":b(nr)&&!b(Vr)}),transform:`translate(${K.value?q.value.right-N.value.yAxis.dataLabels.offsetX+7:q.value.left+N.value.yAxis.dataLabels.offsetX-7}, ${e.y+N.value.yAxis.dataLabels.fontSize/3})`,"font-size":N.value.yAxis.dataLabels.fontSize,"text-anchor":K.value?`start`:`end`,fill:N.value.yAxis.dataLabels.color,"font-weight":N.value.yAxis.dataLabels.bold?`bold`:`normal`},y(b(Ee)(e.value)?b(ve)(P.value.dataLabels.formatter,e.value,b(re)({p:P.value.dataLabels.prefix,v:e.value,s:P.value.dataLabels.suffix,r:P.value.grid.yAxis.dataLabels.roundingValue}),{datapoint:e,seriesIndex:t}):``),11,Mt)):d(``,!0)]))),128))],2)):d(``,!0),N.value.xAxis.dataLabels.show?(h(),f(`g`,{key:3,ref_key:`timeLabelsEls`,ref:Dn,class:m({"donut-opacity":!0})},[(h(!0),f(c,null,_(R.value.end-R.value.start,(e,t)=>(h(),f(`g`,null,[(N.value.xAxis.dataLabels.showOnlyFirstAndLast&&(t===0||t===R.value.end-R.value.start-1)||!N.value.xAxis.dataLabels.showOnlyFirstAndLast)&&X.value[t]&&X.value[t].text?(h(),f(`g`,Nt,[String(X.value[t].text).includes(`
1
+ import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{n as t,r as n,t as r}from"./userOptionsSlots-CWtXN5Q6.js";import{n as i,r as a,t as o}from"./annotationSlots-OLiW25XN.js";import{t as s}from"./annotationViewport-X8fvs7pz.js";import{n as ee,t as te}from"./tableIntegration-CNoJ1CIY.js";import{t as ne}from"./chartImage-Dvrx_F7P.js";import{$ as re,$t as ie,At as ae,D as oe,Ht as se,It as ce,J as le,Jt as ue,Kt as de,S as fe,X as pe,_ as me,at as he,f as ge,h as _e,i as ve,in as ye,nn as be,nt as xe,p as Se,t as Ce,tt as we,w as Te,y as Ee,yt as De,zt as Oe}from"./lib-BaWaqwnJ.js";import{n as ke,t as Ae}from"./useHints-C-TwxM0Y.js";import{t as je}from"./useConfig-B-AzS3w-.js";import{t as Me}from"./useSvgLabelLayout-42Kats14.js";import{t as Ne}from"./usePrinter-CUD8gosC.js";import{t as Pe}from"./useLoading-DoqqfnmS.js";import{t as Fe}from"./useTimeLabels-Das5O74F.js";import{t as Ie}from"./useNestedProp-ri-deXpG.js";import{t as Le}from"./useResponsive-CENUxfEL.js";import{t as Re}from"./useThemeCheck-BKNRbGeC.js";import{t as ze}from"./useChartExport-BZts4KFb.js";import{t as Be}from"./useTransitions-ChGGrtrv.js";import{t as Ve}from"./useStableElementSize-CegFbRlF.js";import{t as He}from"./useUserOptionState-CXlFnwPv.js";import{t as Ue}from"./useChartAccessibility-DOMuYJfm.js";import{t as We}from"./useTimeLabelCollider-BTybMUFi.js";import{n as Ge}from"./Title-DlhGIAWX.js";import{t as Ke}from"./vue_ui_donut_evolution-DNbU1-O1.js";import{t as qe}from"./Legend-D5I3jeGD.js";import{t as Je}from"./SlicerPreview-QaJuNJhX.js";import{t as Ye}from"./BaseScanner-m6QR9rwD.js";import{t as Xe}from"./A11yDataTable-DWNlWXzs.js";import{t as Ze}from"./BaseLegendToggle-CnQ_U5rI.js";import{t as Qe}from"./DefGrad-DKMq1REY.js";import{t as $e}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{Fragment as c,Teleport as et,computed as l,createBlock as u,createCommentVNode as d,createElementBlock as f,createElementVNode as p,createSlots as tt,createTextVNode as nt,createVNode as rt,defineAsyncComponent as it,guardReactiveProps as at,mergeProps as ot,nextTick as st,normalizeClass as m,normalizeProps as ct,normalizeStyle as lt,onBeforeUnmount as ut,onMounted as dt,openBlock as h,ref as g,renderList as _,renderSlot as v,resolveDynamicComponent as ft,shallowRef as pt,toDisplayString as y,toRefs as mt,unref as b,watch as x,watchEffect as ht,withCtx as S}from"vue";var gt=/* @__PURE__ */ e({default:()=>sn}),_t=[`id`],vt=[`id`],yt={key:2,class:`vue-data-ui-no-title-space`,style:`height:36px; width: 100%;background:transparent`},bt=[`id`],xt={style:{position:`relative`}},St=[`xmlns`,`aria-describedby`,`viewBox`],Ct=[`x`,`y`,`width`,`height`],wt={key:1},Tt=[`x1`,`x2`,`y1`,`y2`,`stroke`,`stroke-width`],Et=[`x1`,`x2`,`y1`,`y2`,`stroke`,`stroke-width`],Dt={key:0},Ot=[`x1`,`x2`,`y1`,`y2`,`stroke`,`stroke-width`],kt=[`font-size`,`fill`,`transform`],At=[`x`,`y`,`font-size`,`fill`],jt=[`d`,`stroke`,`stroke-width`],Mt=[`transform`,`font-size`,`text-anchor`,`fill`,`font-weight`],Nt={key:0},Pt=[`text-anchor`,`font-size`,`fill`,`transform`],Ft=[`text-anchor`,`font-size`,`fill`,`transform`,`innerHTML`],It=[`x1`,`y1`,`x2`,`y2`,`stroke`,`stroke-width`],Lt={key:1},Rt=[`cx`,`cy`,`r`,`fill`],zt={key:0},Bt={key:0},Vt=[`d`,`stroke`],Ht=[`text-anchor`,`x`,`y`,`fill`],Ut=[`cx`,`cy`,`r`,`fill`],Wt={key:0},Gt=[`cx`,`cy`,`fill`],Kt={key:1},qt=[`d`,`fill`,`stroke`],Jt={key:2},Yt=[`d`,`fill`,`stroke`],Xt=[`x`,`y`,`font-size`,`fill`],Zt=[`x`,`y`,`width`,`height`,`fill`],Qt=[`x`,`y`,`width`,`height`,`onMouseenter`,`onMouseleave`,`onClick`],$t=[`x`,`y`,`width`,`height`,`fill`,`fill-opacity`,`stroke`,`stroke-opacity`,`stroke-width`,`stroke-dasharray`],en={key:0,style:{position:`absolute`,top:`100%`,left:`0`,width:`100%`},"data-dom-to-png-ignore":``,"aria-hidden":`true`},tn={key:5,class:`vue-data-ui-watermark`},nn=[`id`],rn=[`onClick`],an={key:0},on={key:1},sn=/*#__PURE__*/ $e({__name:`vue-ui-donut-evolution`,props:{config:{type:Object,default(){return{}}},dataset:{type:Array,default(){return[]}},zoomState:{type:Object,default:null}},emits:[`selectLegend`,`zoomStart`,`zoomEnd`,`zoomReset`,`update:zoomState`,`copyAlt`],setup(e,{expose:$e,emit:gt}){let sn=it(()=>import(`./vue-ui-accordion-B8LYfVG9.js`).then(e=>e.n)),cn=it(()=>import(`./BaseIcon-CQFjKDhE.js`).then(e=>e.n)),ln=it(()=>import(`./DataTable-BHW5xD9B.js`)),un=it(()=>import(`./PackageVersion-B-1JX0wI.js`).then(e=>e.t)),dn=it(()=>import(`./PenAndPaper-B2UOwiJM.js`).then(e=>e.t)),fn=it(()=>import(`./UserOptions-B97cPcKc.js`).then(e=>e.n)),pn=it(()=>import(`./vue-ui-donut-BXlWXh2v.js`).then(e=>e.n)),mn=it(()=>import(`./BaseDraggableDialog-MyWIeEtr.js`).then(e=>e.n)),{vue_ui_donut_evolution:hn}=je(),{isThemeValid:gn,warnInvalidTheme:_n}=Re(),C=e,w=g(pe()),T=g([]),E=g(null),vn=g(null),yn=l(()=>vn.value==null?null:vn.value-R.value.start),bn=l(()=>$.value[yn.value]??null),xn=l(()=>!!bn.value),D=g(null),Sn=g(0),Cn=g(0),wn=g(0),Tn=g(0),En=g(null),Dn=g(null),On=g(null),kn=g(null),An=g(!1),jn=g(null),Mn=g(null),Nn=pt(null),Pn=g(0),Fn=g(0),In=g(!1);function Ln(){Nn.value=D.value?.parentNode??null}function Rn(){return new Promise(e=>{requestAnimationFrame(()=>{requestAnimationFrame(e)})})}async function zn(){let e=++Fn.value;await st(),await Rn(),await Rn(),k||e!==Fn.value||(Pn.value+=1)}function Bn(){k||In.value||(In.value=!0,st(()=>{In.value=!1,k||(Ln(),zn())}))}let Vn=Ve({elementRef:Nn,minimumWidth:2,minimumHeight:2,stableFramesRequired:2,once:!1,onSizeAccepted:()=>{zn()}}),Hn=g(null),Un=g(null),Wn=g(null),Gn=g(null),Kn=g(null),O=pt(null),qn=pt(null),k=!1,A=g(null),Jn=g(!1),j=gt,Yn=l(()=>!!C.dataset&&C.dataset.length),Xn=g(!1),Zn=0;dt(()=>{An.value=!0,Ln(),Vn.start(),$n(),zn()});let Qn=l(()=>M.value.debug);function $n(){Oe(C.dataset)?he({componentName:`VueUiDonutEvolution`,type:`dataset`,debug:Qn.value}):C.dataset.length&&C.dataset.forEach((e,t)=>{De({datasetObject:e,requiredAttributes:[`name`,`values`]}).forEach(e=>{he({componentName:`VueUiDonutEvolution`,type:`datasetSerieAttribute`,property:e,index:t,debug:Qn.value})})}),Sr(),er(),Bn()}function er(){if(cancelAnimationFrame(Zn),O.value?.disconnect(),O.value=null,!M.value.responsive){L.value={width:P.value.width,height:P.value.height};return}let e=D.value?.parentNode;if(!e)return;let t=()=>{cancelAnimationFrame(Zn),Zn=requestAnimationFrame(()=>{if(k)return;let{width:e,height:t}=Le({chart:D.value,title:F.value.title.text?Hn.value:null,legend:F.value.legend.show?Un.value:null,slicer:F.value.zoom.show&&or.value>1?Kn.value:null,source:Wn.value});L.value={width:e,height:t-12},Xn.value=!0,Bn()})};O.value=new ResizeObserver(t),qn.value=e,O.value.observe(e),t()}let M=g(Ar()),N=l(()=>P.value.grid),P=l(()=>M.value.style.chart.layout),tr=l(()=>M.value.style.chart.dialog),F=l(()=>M.value.style.chart);ke({config:()=>M.value,dataset:()=>C.dataset,component:`VueUiDonutEvolution`,rules:[Ae.emptyArray,{test:e=>e.length===1,message:[`👀 There is only a single series in your dataset. Consider:`,``,`▶️ Using VueUiXy instead, for a regular line chart.`]},{test:e=>e.length>6,message:[`👀 The number of series is > 6, which makes donuts hard to read. Consider:`,``,`▶️ Grouping small values dynamically into a single "Other" series.`,``,`▶️ Using filters to let users choose a maximum number of series to display.`,``,`▶️ Using VueUiHorizontalBar instead to make the dataset breakdown easier to read.`]},{test:e=>e.some(e=>e.values.length>24),message:[`👀 Some series have a number of data points > 24, which can make the chart and donuts hard to read. Consider:`,``,`▶️ Using larger time scales, or aggregated values.`,``,`▶️ Filtering the time range by adding date intputs in your UI.`,``,`▶️ Using VueUiXy to show longer series in a more comfortable display.`]}]});let{transitionEnabled:nr}=Be({config:()=>M.value.transitions,dataset:()=>C.dataset}),I=l(()=>M.value.userOptions.useCursorPointer),rr=l(()=>ye({defaultConfig:{useCssAnimation:!1,table:{show:!1},userOptions:{show:!1},style:{chart:{backgroundColor:`#99999930`,layout:{dataLabels:{show:!1},grid:{stroke:`#6A6A6A`,axis:{yLabel:``,xLabel:``},yAxis:{scaleMin:null,scaleMax:null,autoScale:!1,dataLabels:{show:!1}},xAxis:{dataLabels:{show:!1}}},line:{stroke:`#CACACA60`}},legend:{backgroundColor:`transparent`,showValue:!1,showPercentage:!1},zoom:{show:!1,startIndex:null,endIndex:null}}}},userConfig:M.value.skeletonConfig??{}})),{loading:ir,FINAL_DATASET:ar}=Pe({...mt(C),FINAL_CONFIG:M,prepareConfig:Ar,callback:()=>{Promise.resolve().then(async()=>{await Sr()})},skeletonDataset:C.config?.skeletonDataset??[{name:``,values:[1,2,3,5,8,13],color:`#AAAAAA`},{name:``,values:[1,2,3,5,8,13],color:`#BABABA`},{name:``,values:[1,2,3,5,8,13],color:`#CACACA`}],skeletonConfig:ye({defaultConfig:M.value,userConfig:rr.value})}),L=g({width:P.value.width,height:P.value.height}),or=l(()=>Math.max(0,...ar.value.map(e=>e.values.length))),R=g({start:0,end:or.value}),z=g(!1),sr=g(!1),B=g(null),V=g(null),H=g(null),cr=g(!1),lr=g({time:0,x:0,y:0,pointerType:null}),ur=l(()=>M.value.style.chart.zoom?.dragToZoom),U=l(()=>ur.value.show&&Yn.value&&fr.value&&Y.value>1&&!ir.value),dr=g(!1),fr=g(!1),pr=g(!1),mr=null,W={};function hr(e,t=R.value){if(!e||typeof e!=`object`)return null;let n=e.start!==void 0&&e.start!==null,r=e.end!==void 0&&e.end!==null;if(!n&&!r)return null;let i=Number(n?e.start:t.start),a=Number(r?e.end:t.end);return!Number.isFinite(i)||!Number.isFinite(a)?null:{start:i,end:a}}function gr(e){let t=hr(e);t&&j(`update:zoomState`,t)}function _r(){mr&&=(cancelAnimationFrame(mr),null),W={}}function vr(e,t=R.value.start){let n=Y.value,r=Number(t);return e>n?n:e<0||e<=r?Math.min(r+1,n):e}function yr(){let e=Y.value;if(!Number.isFinite(e)||e<=0){R.value={start:0,end:0};return}let t=Math.max(0,Math.min(Number(R.value.start)||0,e-1)),n=Math.max(t+1,Math.min(Number(R.value.end)||e,e));(!Number.isFinite(t)||!Number.isFinite(n)||n<=t)&&(t=0,n=e),R.value={start:t,end:n},Gn.value&&Gn.value.setRangeValues(t,n)}function br(e){let t=hr(e);if(!t)return null;let{start:n,end:r}=t;return(n!==Number(R.value.start)||r!==Number(R.value.end))&&(_r(),R.value={start:n,end:r},yr(),Bn()),{start:Number(R.value.start),end:Number(R.value.end)}}function xr(e){let t=br(e);return t?(gr(t),t):null}async function Sr(e=!0){if(!dr.value){dr.value=!0;try{if(await st(),await st(),k)return;let{startIndex:t,endIndex:n}=F.value.zoom,r=Y.value;if(!Number.isFinite(r)||r<=0){R.value={start:0,end:0},fr.value=!0;return}let i=t==null?0:Number(t),a=n==null?r:vr(Number(n)+1,i);pr.value=!0,R.value={start:i,end:a},yr(),fr.value=!0,e&&C.zoomState&&br(C.zoomState)}finally{queueMicrotask(()=>{pr.value=!1}),dr.value=!1,Bn()}}}async function Cr({force:e=!1,publish:t=!1}={}){await Sr(!e),t&&!k&&(gr({start:Number(R.value.start),end:Number(R.value.end)}),j(`zoomReset`))}x([()=>C.zoomState,fr],([e,t])=>{t&&e&&br(e)},{deep:!0,immediate:!0});function wr(e){W={...W,...e},mr&&cancelAnimationFrame(mr),mr=requestAnimationFrame(()=>{let e={...R.value,...W};W={},mr=null,R.value=e,yr(),Bn(),gr({start:Number(R.value.start),end:Number(R.value.end)})})}function Tr(e){if(dr.value||pr.value)return;let t=Number(e);Number.isFinite(t)&&(j(`zoomStart`,{index:t,isZoom:t!==0}),t!==R.value.start&&wr({start:t}))}function Er(e){if(dr.value||pr.value)return;let t=W.start===void 0?R.value.start:W.start,n=vr(Number(e),t);Number.isFinite(n)&&(j(`zoomEnd`,{index:n,isZoom:n!==Y.value}),(n!==R.value.end||W.start!==void 0)&&wr({end:n}))}let{userOptionsVisible:Dr,setUserOptionsVisibility:Or,keepUserOptionState:kr}=He({config:M.value}),{svgRef:G}=Ue({config:F.value.title});function Ar(){let e=Ie({userConfig:C.config,defaultConfig:hn}),t={},n=e.theme;if(n){if(!gn.value(e))_n(e),t=e;else{let r=Ie({userConfig:Ke[n]||C.config,defaultConfig:e});t={...Ie({userConfig:C.config,defaultConfig:r}),customPalette:e.customPalette?e.customPalette:be[n]||se}}}else t=e;return t}x(()=>C.config,e=>{ir.value||(M.value=Ar()),Dr.value=!M.value.userOptions.showOnChartHover,$n(),Cn.value+=1,wn.value+=1,Tn.value+=1,Lr.value.showTable=M.value.table.show},{deep:!0}),x(()=>C.dataset,e=>{Cr()},{deep:!0});let{isPrinting:jr,isImaging:Mr,generatePdf:Nr,generateImage:Pr}=Ne({elementId:w.value,fileName:F.value.title.text||`vue-ui-donut-evolution`,options:M.value.userOptions.print}),Fr=l(()=>M.value.userOptions.show&&!F.value.title.text),Ir=l(()=>Te(M.value.customPalette)),Lr=g({showTable:M.value.table.show});x(M,()=>{Lr.value={showTable:M.value.table.show}},{immediate:!0});let Rr=l(()=>({top:P.value.padding.top,right:P.value.padding.right,bottom:P.value.padding.bottom,left:P.value.padding.left})),K=l(()=>N.value.yAxis.position===`right`),{metrics:zr,ready:Br,settling:Vr,update:Hr}=Me({svgRef:G,canMeasure:()=>(!M.value.responsive||Xn.value)&&(!N.value.xAxis.dataLabels.show||qr.value),initialMetrics:{scaleLabelsWidth:0,yAxisLabelWidth:0,xAxisLabelHeight:0,timeLabelsHeight:0},measure:e=>({scaleLabelsWidth:e(En.value).textWidth,yAxisLabelWidth:e(kn.value).rotatedWidth,xAxisLabelHeight:e(On.value).height,timeLabelsHeight:e(Dn.value).height})});function Ur(){let e=zr.value.scaleLabelsWidth,t=kn.value?zr.value.yAxisLabelWidth+N.value.axis.yLabelOffsetX+N.value.axis.fontSize:0,n=e+t+5;return{left:K.value?0:n,right:K.value?n:0,scaleLabelsWidth:e,yAxisLabelWidth:t,crosshair:5}}ut(()=>{k=!0,Jr+=1,cancelAnimationFrame(Zn),Vn.stop(),_r(),bi(),si(),O.value&&(qn.value&&O.value.unobserve(qn.value),O.value.disconnect(),O.value=null,qn.value=null)});let Wr=l(()=>zr.value.xAxisLabelHeight+zr.value.timeLabelsHeight+N.value.axis.fontSize+N.value.xAxis.dataLabels.offsetY),q=l(()=>{let e=Ur(),t=P.value.dataLabels.fontSize*3,n=L.value.width,r=L.value.height,i=Rr.value.left+e.left,a=n-Rr.value.right-e.right,o=n-i-Rr.value.right-e.right,s=r-Rr.value.top-Rr.value.bottom-t-Wr.value,ee=Rr.value.top+t;return{top:ee,left:i,right:a,bottom:r-Rr.value.bottom-Wr.value,absoluteHeight:r,absoluteWidth:n,centerX:i+Math.max(10,o)/2,centerY:ee+Math.max(10,s)/2,width:Math.max(10,o),height:Math.max(10,s),scaleLabelsWidth:e.scaleLabelsWidth,yAxisLabelWidth:e.yAxisLabelWidth,crosshair:e.crosshair}}),J=l(()=>(Qn.value&&ar.value.forEach((e,t)=>{[null,void 0].includes(e.name)&&he({componentName:`VueUiDonutEvolution`,type:`datasetSerieAttribute`,property:`name`,index:t}),[null,void 0].includes(e.values)&&he({componentName:`VueUiDonutEvolution`,type:`datasetSerieAttribute`,property:`values`,index:t})}),ar.value.map((e,t)=>({...e,values:de(e.values),color:fe(e.color)||Ir.value[t]||se[t]||se[t%se.length],length:(e.values||[]).length,uid:`donut_evolution_${w.value}_${e.id??t}`})))),Gr=l(()=>J.value.filter(e=>!T.value.includes(e.uid)));x(J,e=>{let t=new Set(e.map(e=>e.uid));T.value=T.value.filter(e=>t.has(e))});let Kr=l(()=>Gr.value.map(e=>({...e,values:e.values.slice(R.value.start,R.value.end)}))),Y=l(()=>Math.max(0,...J.value.map(e=>e.length))),X=g([]),qr=g(!1),Jr=0;ht(()=>{let e=++Jr;(async()=>{let t=await Fe({values:N.value.xAxis.dataLabels.values,maxDatapoints:Y.value,formatter:N.value.xAxis.dataLabels.datetimeFormatter,start:R.value.start,end:R.value.end});e===Jr&&(X.value=t,qr.value=!0)})()});let Z=l(()=>q.value.width/(R.value.end-R.value.start)),Yr=l(()=>{let e=[];for(let t=0;t<R.value.end-R.value.start;t+=1){let n=Kr.value.map(e=>e.values[t]??null),r=n.filter(e=>[void 0,null].includes(e)).length===n.length,i=n.reduce((e,t)=>e+t,0),a=n.map(e=>e/i),o=q.value.left+Z.value*t+Z.value/2;e.push({index:t,percentages:a,subtotal:r||i<0?null:i,values:n,x:o})}return e}),Xr=l(()=>{let e=Yr.value.map(e=>e.subtotal).filter(ae),t=e.length?Math.max(...e):1,n=e.length?Math.min(...e):0,r=Math.max(N.value.yAxis.scaleMax??0,t),i;return i=N.value.yAxis.scaleMin==null?0:Math.min(n,N.value.yAxis.scaleMin),N.value.yAxis.autoScale&&(i=n,r=t),i===r&&(i=r/2,r*=1.5),{max:r,min:i}}),Q=l(()=>{let e=Yr.value.length===1?Xr.value.max*2:Xr.value.max;return me(Xr.value.min,e,N.value.yAxis.dataLabels.steps)});x(()=>Q.value.ticks.join(`|`),()=>{Bn()},{flush:`post`});function Zr(e){return(e-Q.value.min)/(Q.value.max-Q.value.min)}let Qr=l(()=>Q.value.ticks.map(e=>({y:q.value.bottom-q.value.height*Zr(e),value:e}))),$r=l(()=>{let e=Yr.value;return e.map((t,n)=>{let r=Math.min(q.value.width/24,Z.value/2*.7),i=r>q.value.width/16?q.value.width/16:r,a=e.length>4?r*2:r*2>Z.value/2*.7?Z.value/2*.7:r*2,o=q.value.bottom-q.value.height*Zr(t.subtotal),s=Kr.value.map(e=>({color:e.color,name:e.name,value:e.values[n]??0})).toSorted((e,t)=>t.value-e.value);return{...t,y:o,radius:i,hoverRadius:a,donut:ce({series:s},t.x,o,i,i,1.99999,2,1,360,105.25,i/2),donutHover:ce({series:s},t.x,o,a,a,1.99999,2,1,360,105.25,a/2),donutFocus:ce({series:s},q.value.centerX,q.value.centerY,q.value.height/3.6,q.value.height/3.6,1.99999,2,1,360,105.25,q.value.height/6)}})}),$=l(()=>$r.value.map(e=>({...e,activeRadius:E.value===e.index?q.value.width/16:e.radius})));function ei(e,t,n){return ve(P.value.dataLabels.formatter,e,re({p:P.value.dataLabels.prefix,v:e,s:P.value.dataLabels.suffix,r:P.value.dataLabels.rounding}),{datapoint:t,index:n})}function ti(e,t){return isNaN(e.value/ie(t,`value`))?0:(e.value/ie(t,`value`)*100).toFixed(0)+`%`}function ni(e){let t=G.value;if(!t)return null;if(t.createSVGPoint&&t.getScreenCTM){let n=t.createSVGPoint();n.x=e.clientX,n.y=e.clientY;let r=t.getScreenCTM();if(r){let e=n.matrixTransform(r.inverse());return{x:e.x,y:e.y}}}let n=t.getBoundingClientRect(),r=t.viewBox?.baseVal||{x:0,y:0,width:n.width,height:n.height},i=Math.min(n.width/r.width,n.height/r.height);if(!Number.isFinite(i)||i<=0)return null;let a=r.width*i,o=r.height*i,s=(n.width-a)/2,ee=(n.height-o)/2;return{x:(e.clientX-n.left-s)/i+r.x,y:(e.clientY-n.top-ee)/i+r.y}}let ri=l(()=>!z.value||B.value==null||V.value==null?null:{x:Math.min(B.value,V.value),y:q.value.top,width:Math.abs(V.value-B.value),height:q.value.height}),ii=l(()=>fr.value?Number(R.value.start)!==0||Number(R.value.end)!==Number(Y.value):!1);function ai(e){return Math.min(Math.max(e,q.value.left),q.value.right)}function oi(){E.value=null,A.value=null}function si(e){let t=e?.pointerId==null?H.value:e.pointerId;t!=null&&G.value?.hasPointerCapture?.(t)&&G.value.releasePointerCapture(t),z.value=!1,B.value=null,V.value=null,H.value=null}function ci(){cr.value=!0,setTimeout(()=>{cr.value=!1},0)}function li(e){cr.value&&(cr.value=!1,e.preventDefault(),e.stopPropagation())}function ui(e){if(!U.value||!ii.value||!e)return!1;let t=Date.now(),n=e.pointerType||`mouse`,r=lr.value,i=n===`touch`?450:350,a=n===`touch`?28:10,o=Math.hypot(e.clientX-r.x,e.clientY-r.y);return r.time>0&&r.pointerType===n&&t-r.time<=i&&o<=a?(lr.value={time:0,x:0,y:0,pointerType:null},ci(),bi(),si(e),Gi(),Cr({force:!0,publish:!0}),!0):(lr.value={time:t,x:e.clientX,y:e.clientY,pointerType:n},!1)}function di(e){let t=Number(R.value.end)-Number(R.value.start);if(t<=0||!Number.isFinite(Z.value)||Z.value<=0)return null;let n=Math.floor((ai(e)-q.value.left)/Z.value);return Math.max(0,Math.min(t-1,n))}function fi(e,t){let n=di(e),r=di(t);if(n==null||r==null)return null;let i=Math.min(n,r),a=Math.max(n,r);return a<=i?null:{start:Number(R.value.start)+i,end:Number(R.value.start)+a+1}}function pi(e){let t=xr(e);return t?(j(`zoomStart`,{index:t.start,isZoom:t.start!==0}),j(`zoomEnd`,{index:t.end,isZoom:t.end!==Y.value}),t):null}function mi(e){if(!U.value||zi.value||e.button!==void 0&&e.button!==0||H.value!=null&&e.pointerId!==H.value)return;let t=ni(e);if(!t||t.x<q.value.left||t.x>q.value.right||t.y<q.value.top||t.y>q.value.bottom||Number(R.value.end)-Number(R.value.start)<=1)return;sr.value=!0,G.value?.focus?.({preventScroll:!0}),bi(),oi();let n=ai(t.x);H.value=e.pointerId,z.value=!0,B.value=n,V.value=n}function hi(e){if(!U.value||!z.value||H.value!=null&&e.pointerId!==H.value)return;let t=ni(e);t&&(V.value=ai(t.x),oi(),B.value!=null&&Math.abs(V.value-B.value)>=2&&!G.value?.hasPointerCapture?.(e.pointerId)&&G.value?.setPointerCapture?.(e.pointerId))}function gi(e){if(!U.value||!z.value||H.value!=null&&e.pointerId!==H.value)return;let t=ni(e);t&&(V.value=ai(t.x));let n=B.value,r=V.value;if((n==null||r==null?0:Math.abs(r-n))<Math.max(4,q.value.width*.01)){if(ui(e))return;si(e);return}let i=fi(Math.min(n,r),Math.max(n,r));i?(si(e),pi(i)&&(lr.value={time:0,x:0,y:0,pointerType:null},oi(),ci())):si(e)}function _i(e){z.value||(E.value=null,A.value=null,M.value.events.datapointLeave&&M.value.events.datapointLeave({datapoint:e,seriesIndex:e.index+R.value.start}))}function vi(e){z.value||(M.value.events.datapointEnter&&M.value.events.datapointEnter({datapoint:e,seriesIndex:e.index+R.value.start}),E.value=e.index,A.value=e.index)}let yi=null;function bi(){yi&&=(clearTimeout(yi),null)}function xi(e,t){M.value.events.datapointClick&&M.value.events.datapointClick({datapoint:e,seriesIndex:e.index+R.value.start}),e.subtotal&&tr.value.show&&(E.value=null,vn.value=(t??e.index)+R.value.start,Wi.value?.open?.())}function Si(e,t){if(bi(),!U.value||!ii.value){xi(e,t);return}let n=lr.value.pointerType===`touch`?480:380;yi=setTimeout(()=>{yi=null,xi(e,t)},n)}let Ci=l(()=>J.value.map((e,t)=>({name:e.name,value:e.values.slice(R.value.start,R.value.end).reduce((e,t)=>e+t,0),shape:`circle`,uid:e.uid,color:e.color})).sort((e,t)=>t.value-e.value).map((e,t)=>({...e,opacity:T.value.includes(e.uid)?.5:1,segregate:()=>Di(e.uid),isSegregated:T.value.includes(e.uid),display:`${e.name}${F.value.legend.showPercentage||F.value.legend.showValue?`: `:``}${F.value.legend.showValue?ve(P.value.dataLabels.formatter,e.value,re({p:P.value.dataLabels.prefix,v:e.value,s:P.value.dataLabels.suffix,r:F.value.legend.roundingValue}),{datapoint:e,seriesIndex:t}):``}${F.value.legend.showPercentage?T.value.includes(e.uid)?`${F.value.legend.showValue?` (`:``}- %${F.value.legend.showValue?`)`:``}`:`${F.value.legend.showValue?` (`:``}${isNaN(e.value/wi.value)?`-`:re({v:e.value/wi.value*100,s:`%`,r:F.value.legend.roundingPercentage})}${F.value.legend.showValue?`)`:``}`:``}`}))),wi=l(()=>Yr.value.map(e=>e.subtotal).reduce((e,t)=>e+t,0)),Ti=l(()=>({cy:`donut-div-legend`,backgroundColor:F.value.legend.backgroundColor,color:F.value.legend.color,fontSize:F.value.legend.fontSize,paddingBottom:12,fontWeight:F.value.legend.bold?`bold`:``}));function Ei(){T.value.length?T.value=[]:Ci.value.forEach(e=>{T.value.push(e.uid)}),j(`selectLegend`,Kr.value)}function Di(e){if(T.value.includes(e))T.value=T.value.filter(t=>t!==e),j(`selectLegend`,Kr.value);else{if(T.value.length===J.value.length-1)return;T.value.push(e),j(`selectLegend`,Kr.value)}}function Oi(e){return J.value.length?J.value.find(t=>t.name===e)||(Qn.value&&console.warn(`VueUiDonutEvolution - Series name not found "${e}"`),null):(Qn.value&&console.warn(`VueUiDonutEvolution - There are no series to show.`),null)}function ki(e){let t=Oi(e);t!==null&&T.value.includes(t.uid)&&Di(t.uid)}function Ai(e){let t=Oi(e);t!==null&&(T.value.includes(t.uid)||Di(t.uid))}let ji=g([]),Mi=0;ht(()=>{let e=++Mi;Fe({values:N.value.xAxis.dataLabels.values,maxDatapoints:Y.value,formatter:N.value.xAxis.dataLabels.datetimeFormatter,start:0,end:Y.value}).then(t=>{!k&&e===Mi&&(ji.value=t)})});let Ni=l(()=>{let e=[``].concat(Gr.value.map(e=>({name:e.name,color:e.color})),[`Σ`]),t=[];for(let e=0;e<Y.value;e+=1){let n=Gr.value.map(t=>t.values[e]??0).reduce((e,t)=>e+t,0);t.push([ji.value[e]?.text??`-`].concat(Gr.value.map(t=>({value:t.values[e]??0,percentage:t.values[e]?t.values[e]/n*100:0})),[`${P.value.dataLabels.prefix}${Number(n.toFixed(M.value.table.td.roundingValue))}${P.value.dataLabels.suffix}`]))}return{head:e,body:t,bodyA11y:t.map(e=>e.map((t,n)=>n===0||n===e.length-1?t:`${ei(t.value??0,null,n)} (${t.percentage.toFixed(1)}%)`)),config:{th:{backgroundColor:M.value.table.th.backgroundColor,color:M.value.table.th.color,outline:M.value.table.th.outline},td:{backgroundColor:M.value.table.td.backgroundColor,color:M.value.table.td.color,outline:M.value.table.td.outline},breakpoint:M.value.table.responsiveBreakpoint},colNames:[M.value.table.columnNames.period].concat(Gr.value.map(e=>e.name),M.value.table.columnNames.total)}});function Pi(){return J.value}function Fi(e=null){st(()=>{let t=[[F.value.title.text],[F.value.title.subtitle.text],[``]],n=[...Ni.value.head.map(e=>e.name??e)],r=[...Ni.value.body.map(e=>e.map(e=>e.value??e))],i=t.concat([n]).concat(r),a=oe(i);e?e(a):xe({csvContent:a,title:F.value.title.text||`vue-ui-donut-evolution`})})}let Ii=g(!1);function Li(e){Ii.value=e,Sn.value+=1}function Ri(){Lr.value.showTable=!Lr.value.showTable}let zi=g(!1);function Bi(){zi.value=!zi.value}function Vi(e){return e.proportion*100>F.value.donuts.hover.hideLabelsUnderValue}let Hi=l(()=>(bn.value?.donut??[]).map(e=>({name:e.name,values:[e.value],color:e.color}))),Ui=l(()=>we({...tr.value.donutChart,responsive:!0,theme:M.value.theme}));x([$r,R],()=>{vn.value!=null&&!bn.value&&Gi()});let Wi=g(null);function Gi(){let e=vn.value!=null;vn.value=null,e&&Wi.value?.close?.(),E.value=null,A.value=null}let Ki=ne(D,()=>F.value.title.text),qi=l(()=>L.value.width),Ji=l(()=>L.value.height);We({timeLabelsEls:Dn,timeLabels:X,slicer:R,configRef:M,rotationPath:[`style`,`chart`,`layout`,`grid`,`xAxis`,`dataLabels`,`rotation`],autoRotatePath:[`style`,`chart`,`layout`,`grid`,`xAxis`,`dataLabels`,`autoRotate`,`enable`],isAutoSize:!1,width:qi,height:Ji,rotation:N.value.xAxis.dataLabels.autoRotate.angle});let Yi=l(()=>te({config:M,style:F,mutableConfig:Lr,dialog:mn,accordion:sn,isFullscreen:Ii,parent:D,maxWidth:800,isCursorPointer:I}));x(()=>Lr.value.showTable,e=>ee(e,M,jn));function Xi(){Lr.value.showTable=!1,Mn.value&&Mn.value.setTableIconState(!1)}let Zi=l(()=>Ci.value.map(e=>({...e,name:e.display}))),Qi=l(()=>F.value.backgroundColor),$i=l(()=>F.value.legend),ea=l(()=>F.value.title),{isCallbackImaging:ta,isCallbackSvg:na,generateSvg:ra,onGenerateImage:ia}=ze({svg:G,title:ea,legend:$i,legendItems:Zi,backgroundColor:Qi,getSvgCallback:()=>M.value.userOptions.callbacks.svg,generateImage:Pr});async function aa(){j(`copyAlt`,{config:M.value,dataset:$.value}),M.value.userOptions.callbacks.altCopy?await Promise.resolve(M.value.userOptions.callbacks.altCopy({config:M.value,dataset:$.value})):console.warn("Vue Data UI - A callback must be set for `altCopy` in userOptions.")}function oa(){A.value=null,Jn.value=!0}function sa(){sr.value=!1,A.value=null,E.value=null,Jn.value=!1}function ca(e){if(!G.value||zi.value||document.activeElement!==G.value||(sr.value=!1,!$.value.length))return;let t=e.key===`ArrowLeft`,n=e.key===`ArrowRight`,r=e.key===`Enter`||e.key===` `,i=e.key===`Escape`;if(!t&&!n&&!r&&!i)return;if(e.preventDefault(),e.stopPropagation(),i){if(U.value&&(ii.value||z.value)){bi(),si(),Gi(),Cr({force:!0,publish:!0});return}A.value=null,E.value=null;return}if(r){if(A.value===null)return;let e=$.value[A.value];if(!e)return;xi(e,A.value);return}let a=A.value,o=E.value,s=a!==null&&a>=0&&a<$.value.length,ee=o!==null&&o>=0&&o<$.value.length;s?n?(a+=1,a>=$.value.length&&(a=0)):t&&(--a,a<0&&(a=$.value.length-1)):ee?(a=n?o+1:o-1,a>=$.value.length&&(a=0),a<0&&(a=$.value.length-1)):a=n?0:$.value.length-1;let te=$.value[a];te&&vi(te)}let la=l(()=>({headers:Ni.value?.colNames??[],rows:Ni.value?.bodyA11y??[]}));$e({getData:Pi,getImage:Ki,generatePdf:Nr,generateCsv:Fi,generateImage:Pr,generateSvg:ra,hideSeries:Ai,showSeries:ki,toggleTable:Ri,toggleAnnotator:Bi,toggleFullscreen:Li,copyAlt:aa,resetZoom:()=>Cr({force:!0,publish:!0}),setZoomState:xr}),x(()=>[L.value.width,L.value.height,Pn.value,X.value,qr.value,R.value.start,R.value.end,N.value,P.value,M.value.style.fontFamily,C.dataset,Xn.value,En.value,Dn.value,On.value,kn.value],Hr,{flush:`post`,deep:!0});let ua=l(()=>s({enabled:M.value.userOptions?.annotator?.followZoom,area:q.value,range:R.value,ticks:Qr.value}));return(e,s)=>(h(),f(`div`,{ref_key:`donutEvolutionChart`,ref:D,class:m(`vue-data-ui-component vue-ui-donut-evolution ${Ii.value?`vue-data-ui-wrapper-fullscreen`:``} ${M.value.useCssAnimation?``:`vue-ui-dna`}`),style:lt(`font-family:${M.value.style.fontFamily};width:100%; text-align:center;background:${F.value.backgroundColor}`),id:w.value,onMouseenter:s[3]||=()=>b(Or)(!0),onMouseleave:s[4]||=()=>b(Or)(!1)},[p(`div`,{id:`chart-instructions-${w.value}`,class:`sr-only`},[p(`p`,null,y(M.value.a11y.translations.keyboardNavigation),1)],8,vt),M.value.a11y.includeTable&&la.value?.rows?.length?(h(),u(Xe,{key:0,uid:w.value,head:la.value.headers,body:la.value.rows,notice:M.value.a11y.translations.tableAvailable,caption:M.value.a11y.translations.tableCaption},null,8,[`uid`,`head`,`body`,`notice`,`caption`])):d(``,!0),M.value.userOptions.buttons.annotator?(h(),u(b(dn),ot({key:1},b(a)(M.value.userOptions.annotator),{svgRef:b(G),followZoom:M.value.userOptions?.annotator?.followZoom,annotationViewport:ua.value,backgroundColor:F.value.backgroundColor,color:F.value.color,active:zi.value,isCursorPointer:I.value,palette:M.value.userOptions.annotatorPalette,onClose:Bi}),tt({_:2},[_(b(o),t=>({name:t,fn:S(n=>[v(e.$slots,t,ct(at(b(i)(t,n))),void 0,!0)])}))]),1040,[`svgRef`,`followZoom`,`annotationViewport`,`backgroundColor`,`color`,`active`,`isCursorPointer`,`palette`])):d(``,!0),Fr.value?(h(),f(`div`,yt)):d(``,!0),F.value.title.text?(h(),f(`div`,{key:3,ref_key:`chartTitle`,ref:Hn,style:`width:100%;background:transparent;padding-bottom:24px`,onMouseleave:_i},[(h(),u(Ge,{key:`title_${Cn.value}`,config:{title:{cy:`donut-evolution-div-title`,...F.value.title},subtitle:{cy:`donut-evolution-div-subtitle`,...F.value.title.subtitle}}},null,8,[`config`]))],544)):d(``,!0),p(`div`,{id:`legend-top-${w.value}`},null,8,bt),M.value.userOptions.show&&Yn.value&&(b(kr)||b(Dr))?(h(),u(b(fn),ot({ref_key:`userOptionsRef`,ref:Mn,key:`user_options_${Sn.value}`,backgroundColor:F.value.backgroundColor,color:F.value.color,isPrinting:b(jr),isImaging:b(Mr),uid:w.value,isFullscreen:Ii.value,chartElement:D.value},b(n)(M.value.userOptions,`pdf csv img svg table fullscreen altCopy annotator`),{isAnnotation:zi.value,tableDialog:M.value.table.useDialog,isCursorPointer:I.value,onToggleFullscreen:Li,onGeneratePdf:b(Nr),onGenerateCsv:Fi,onGenerateImage:b(ia),onGenerateSvg:b(ra),onToggleTable:Ri,onToggleAnnotator:Bi,onCopyAlt:aa,style:{visibility:b(kr)?b(Dr)?`visible`:`hidden`:`visible`}}),tt({_:2},[_(b(t)(e.$slots,`menuIcon optionPdf optionCsv optionImg optionSvg optionTable optionFullscreen optionAnnotator optionAltCopy custom-menu-before custom-menu-after`),t=>({name:t,fn:S(n=>[v(e.$slots,t,ct(at(b(r)(t,n))),void 0,!0)])}))]),1040,[`backgroundColor`,`color`,`isPrinting`,`isImaging`,`uid`,`isFullscreen`,`chartElement`,`isAnnotation`,`tableDialog`,`isCursorPointer`,`onGeneratePdf`,`onGenerateImage`,`onGenerateSvg`,`style`])):d(``,!0),p(`div`,xt,[(h(),f(`svg`,{ref_key:`svgRef`,ref:G,xmlns:b(Ce),"aria-describedby":`chart-instructions-${w.value}`,class:m({"vue-data-ui-fullscreen--on":Ii.value,"vue-data-ui-fulscreen--off":!Ii.value,"vue-data-ui-no-transition":!b(nr)||b(Vr),"vue-ui-donut-evolution-chart-zoom-pointer-focus":U.value&&sr.value}),viewBox:`0 0 ${q.value.absoluteWidth} ${q.value.absoluteHeight}`,style:lt({maxWidth:`100%`,visibility:b(Br)?`visible`:`hidden`,overflow:`visible`,background:`transparent`,color:F.value.color,cursor:U.value?z.value?`col-resize`:`crosshair`:void 0,touchAction:U.value?`pan-y`:void 0,userSelect:U.value?`none`:void 0}),tabindex:`0`,onFocus:oa,onBlur:sa,onKeydown:ca,onPointerdown:mi,onPointermove:hi,onPointerup:gi,onPointercancel:si,onClickCapture:li},[rt(b(un)),v(e.$slots,`svg-underlayer`,{svg:{...q.value,isPrintingImg:b(jr)||b(Mr)||b(ta),isPrintingSvg:b(na)}},void 0,!0),e.$slots[`chart-background`]?(h(),f(`foreignObject`,{key:0,x:q.value.left,y:q.value.top,width:q.value.width,height:q.value.height,style:{pointerEvents:`none`}},[v(e.$slots,`chart-background`,{},void 0,!0)],8,Ct)):d(``,!0),p(`defs`,null,[rt(Qe,{t:`linear`,id:`hover_${w.value}`,x1:`0%`,y1:`0%`,x2:`0%`,y2:`100%`,stops:[[`0%`,b(ue)(F.value.backgroundColor,P.value.highlighter.opacity),1],[`100%`,b(ue)(P.value.highlighter.color,P.value.highlighter.opacity),1]]},null,8,[`id`,`stops`]),rt(Qe,{t:`radial`,id:`focus_${w.value}`,stops:[[`0%`,b(ue)(b(fe)(F.value.backgroundColor),0),1],[`77%`,b(ue)(`#FFFFFF`,30),1],[`100%`,b(ue)(b(fe)(F.value.backgroundColor),0),1]]},null,8,[`id`,`stops`])]),N.value.show?(h(),f(`g`,wt,[p(`line`,{x1:K.value?q.value.right:q.value.left,x2:K.value?q.value.right:q.value.left,y1:q.value.top,y2:q.value.top+q.value.height,stroke:N.value.stroke,"stroke-width":N.value.strokeWidth,"stroke-linecap":`round`},null,8,Tt),p(`line`,{x1:q.value.left,x2:q.value.right,y1:q.value.bottom,y2:q.value.bottom,stroke:N.value.stroke,"stroke-width":N.value.strokeWidth,"stroke-linecap":`round`},null,8,Et),N.value.showVerticalLines?(h(),f(`g`,Dt,[(h(!0),f(c,null,_(R.value.end-R.value.start,(e,t)=>(h(),f(`line`,{x1:q.value.left+(t+1)*Z.value,x2:q.value.left+(t+1)*Z.value,y1:q.value.top,y2:q.value.bottom,stroke:N.value.stroke,"stroke-width":N.value.strokeWidth,"stroke-linecap":`round`},null,8,Ot))),256))])):d(``,!0)])):d(``,!0),p(`g`,null,[N.value.axis.yLabel?(h(),f(`text`,{key:0,ref_key:`yAxisLabel`,ref:kn,"font-size":N.value.axis.fontSize,fill:N.value.axis.color,transform:`translate(${K.value?q.value.absoluteWidth-N.value.axis.fontSize/2-N.value.axis.yLabelOffsetX:N.value.axis.fontSize}, ${q.value.top+q.value.height/2}) rotate(-90)`,"text-anchor":`middle`,style:{transition:`none`}},y(N.value.axis.yLabel),9,kt)):d(``,!0),N.value.axis.xLabel?(h(),f(`text`,{key:1,ref_key:`xAxisLabel`,ref:On,"text-anchor":`middle`,x:q.value.absoluteWidth/2,y:q.value.absoluteHeight-3,"font-size":N.value.axis.fontSize,fill:N.value.axis.color},y(N.value.axis.xLabel),9,At)):d(``,!0)]),N.value.yAxis.dataLabels.show?(h(),f(`g`,{key:2,ref_key:`scaleLabels`,ref:En,class:m({"donut-opacity":!0,"donut-behind":E.value!==null})},[(h(!0),f(c,null,_(Qr.value,(e,t)=>(h(),f(`g`,{key:`sl_${t}`},[e.value>=Q.value.min&&e.value<=Q.value.max?(h(),f(`path`,{key:0,class:m({"vue-data-ui-transition":b(nr)&&!b(Vr)}),d:`M${K.value?q.value.right:q.value.left},${e.y} ${K.value?q.value.right+5:q.value.left-5},${e.y}`,stroke:N.value.stroke,"stroke-width":N.value.strokeWidth,"stroke-linecap":`round`},null,10,jt)):d(``,!0),e.value>=Q.value.min&&e.value<=Q.value.max?(h(),f(`text`,{key:1,class:m({"vue-data-ui-transition":b(nr)&&!b(Vr)}),transform:`translate(${K.value?q.value.right-N.value.yAxis.dataLabels.offsetX+7:q.value.left+N.value.yAxis.dataLabels.offsetX-7}, ${e.y+N.value.yAxis.dataLabels.fontSize/3})`,"font-size":N.value.yAxis.dataLabels.fontSize,"text-anchor":K.value?`start`:`end`,fill:N.value.yAxis.dataLabels.color,"font-weight":N.value.yAxis.dataLabels.bold?`bold`:`normal`},y(b(Ee)(e.value)?b(ve)(P.value.dataLabels.formatter,e.value,b(re)({p:P.value.dataLabels.prefix,v:e.value,s:P.value.dataLabels.suffix,r:P.value.grid.yAxis.dataLabels.roundingValue}),{datapoint:e,seriesIndex:t}):``),11,Mt)):d(``,!0)]))),128))],2)):d(``,!0),N.value.xAxis.dataLabels.show?(h(),f(`g`,{key:3,ref_key:`timeLabelsEls`,ref:Dn,class:m({"donut-opacity":!0})},[(h(!0),f(c,null,_(R.value.end-R.value.start,(e,t)=>(h(),f(`g`,null,[(N.value.xAxis.dataLabels.showOnlyFirstAndLast&&(t===0||t===R.value.end-R.value.start-1)||!N.value.xAxis.dataLabels.showOnlyFirstAndLast)&&X.value[t]&&X.value[t].text?(h(),f(`g`,Nt,[String(X.value[t].text).includes(`
2
2
  `)?(h(),f(`text`,{key:1,class:`vue-data-ui-time-label`,"text-anchor":N.value.xAxis.dataLabels.rotation>0?`start`:N.value.xAxis.dataLabels.rotation<0?`end`:`middle`,"font-size":N.value.xAxis.dataLabels.fontSize,fill:N.value.xAxis.dataLabels.color,transform:`translate(${q.value.left+Z.value*t+Z.value/2}, ${q.value.bottom+N.value.xAxis.dataLabels.fontSize+N.value.xAxis.dataLabels.offsetY}), rotate(${N.value.xAxis.dataLabels.rotation})`,innerHTML:b(le)({content:String(X.value[t].text),fontSize:N.value.xAxis.dataLabels.fontSize,fill:P.value.grid.xAxis.dataLabels.color,x:0,y:0})},null,8,Ft)):(h(),f(`text`,{key:0,class:`vue-data-ui-time-label`,"text-anchor":N.value.xAxis.dataLabels.rotation>0?`start`:N.value.xAxis.dataLabels.rotation<0?`end`:`middle`,"font-size":N.value.xAxis.dataLabels.fontSize,fill:N.value.xAxis.dataLabels.color,transform:`translate(${q.value.left+Z.value*t+Z.value/2}, ${q.value.bottom+N.value.xAxis.dataLabels.fontSize+N.value.xAxis.dataLabels.offsetY}), rotate(${N.value.xAxis.dataLabels.rotation})`},y(X.value[t].text||``),9,Pt))])):d(``,!0)]))),256))],512)):d(``,!0),(h(!0),f(c,null,_($.value,(e,t)=>(h(),f(`g`,null,[P.value.line.show&&t<$.value.length-1&&![e.subtotal,$.value[t+1].subtotal].includes(null)?(h(),f(`line`,{key:0,class:m({"donut-opacity":!0,"donut-behind":E.value!==null}),x1:e.x,y1:e.y,x2:$.value[t+1].x,y2:$.value[t+1].y,stroke:P.value.line.stroke,"stroke-width":P.value.line.strokeWidth,"stroke-linecap":`round`,"stroke-linejoin":`round`},null,10,It)):d(``,!0),e.subtotal===null?d(``,!0):(h(),f(`g`,Lt,[e.subtotal?(h(),f(`circle`,{key:0,cx:e.x,cy:e.y,r:e.activeRadius,fill:F.value.backgroundColor},null,8,Rt)):d(``,!0)]))]))),256)),(h(!0),f(c,null,_($.value,(e,t)=>(h(),f(`g`,{class:m({"donut-opacity":!0,"donut-behind":t!==E.value&&E.value!==null})},[e.subtotal?(h(),f(`g`,zt,[E.value!==null&&E.value===t?(h(),f(`g`,Bt,[(h(!0),f(c,null,_(e.donutHover,t=>(h(),f(`g`,null,[Vi(t)?(h(),f(`path`,{key:0,d:b(_e)(t,{x:t.center.endX,y:t.center.endY},12,12,{x:e.x,y:e.y},!1,20),stroke:t.color,"stroke-width":`1`,"stroke-linecap":`round`,"stroke-linejoin":`round`,fill:`none`},null,8,Vt)):d(``,!0)]))),256)),(h(!0),f(c,null,_(e.donutHover,(t,n)=>(h(),f(`g`,null,[Vi(t)?(h(),f(`text`,{key:0,"data-cy-hover-label":``,"text-anchor":b(ge)(t,!0,0).anchor,x:b(ge)(t,!0,9).x,y:b(Se)(t,14,10),fill:N.value.yAxis.dataLabels.color,"font-size":8,"font-weight":`bold`},y(t.name)+`: `+y(ti(t,e.donut))+` (`+y(t.value===null?`-`:ei(t.value,t,n))+`) `,9,Ht)):d(``,!0)]))),256)),p(`g`,null,[p(`circle`,{cx:e.x,cy:e.y,r:e.hoverRadius,fill:F.value.backgroundColor},null,8,Ut)])])):d(``,!0)])):d(``,!0)],2))),256)),(h(!0),f(c,null,_($.value,(e,t)=>(h(),f(`g`,{class:m({"donut-opacity":!0,"donut-behind":t!==E.value&&E.value!==null})},[e.subtotal===null?d(``,!0):(h(),f(`g`,Wt,[e.subtotal===0?(h(),f(`circle`,{key:0,cx:e.x,cy:e.y,r:3,fill:F.value.color},null,8,Gt)):E.value!==null&&E.value===t?(h(),f(`g`,Kt,[(h(!0),f(c,null,_(e.donutHover,(e,t)=>(h(),f(`path`,{d:e.arcSlice,fill:`${e.color}`,"stroke-width":1,stroke:F.value.backgroundColor},null,8,qt))),256))])):(h(),f(`g`,Jt,[(h(!0),f(c,null,_(e.donut,(e,t)=>(h(),f(`path`,{d:e.arcSlice,fill:`${e.color}`,"stroke-width":.5,stroke:F.value.backgroundColor},null,8,Yt))),256))]))]))],2))),256)),(h(!0),f(c,null,_($.value,(e,t)=>(h(),f(`g`,{class:m({"donut-opacity":!0,"donut-behind":t!==E.value&&E.value!==null||xn.value&&t!==bn.value.index})},[e.subtotal!==null&&P.value.dataLabels.show?(h(),f(`text`,{key:0,"text-anchor":`middle`,x:e.x,y:E.value===e.index&&e.subtotal?e.y+P.value.dataLabels.fontSize/3:e.y-e.radius-P.value.dataLabels.fontSize+P.value.dataLabels.offsetY,"font-size":P.value.dataLabels.fontSize,"font-weight":`bold`,fill:P.value.dataLabels.color},y(ei(e.subtotal,e,t)),9,Xt)):d(``,!0)],2))),256)),(h(!0),f(c,null,_($.value,(e,t)=>(h(),f(`rect`,{x:q.value.left+t*Z.value,y:q.value.top,width:Z.value,height:q.value.height,fill:[E.value,yn.value].includes(e.index)?`url(#hover_${w.value})`:`transparent`,class:m({"donut-hover":I.value&&e.subtotal&&[E.value,yn.value].includes(e.index)}),style:{pointerEvents:`none`}},null,10,Zt))),256)),(h(!0),f(c,null,_($.value,(e,t)=>(h(),f(`rect`,{"data-cy-trap":``,x:q.value.left+t*Z.value,y:q.value.top,width:Z.value,height:q.value.height,fill:`transparent`,onMouseenter:t=>vi(e),onMouseleave:t=>_i(e),onClick:n=>Si(e,t),style:lt({cursor:U.value?z.value?`col-resize`:`crosshair`:void 0}),class:m({"donut-hover":I.value&&E.value===e.index&&e.subtotal})},null,46,Qt))),256)),ri.value?(h(),f(`rect`,{key:4,x:ri.value.x,y:ri.value.y,width:ri.value.width,height:ri.value.height,fill:ur.value.selection.fill,"fill-opacity":ur.value.selection.fillOpacity,stroke:ur.value.selection.stroke,"stroke-opacity":ur.value.selection.strokeOpacity,"stroke-width":ur.value.selection.strokeWidth,"stroke-dasharray":ur.value.selection.strokeDasharray,"stroke-linecap":`round`,"stroke-linejoin":`round`,"pointer-events":`none`},null,8,$t)):d(``,!0),v(e.$slots,`svg`,{svg:{...q.value,isPrintingImg:b(jr)||b(Mr)||b(ta),isPrintingSvg:b(na)}},void 0,!0)],46,St)),e.$slots.hint?(h(),f(`div`,en,[v(e.$slots,`hint`,ct(at({hint:M.value.a11y.translations.keyboardNavigation,isVisible:Jn.value})),void 0,!0)])):d(``,!0)]),e.$slots.watermark?(h(),f(`div`,tn,[v(e.$slots,`watermark`,ct(at({isPrinting:b(jr)||b(Mr)||b(ta)||b(na)})),void 0,!0)])):d(``,!0),p(`div`,{ref_key:`chartSlicer`,ref:Kn,style:lt(`width:100%;background:${F.value.backgroundColor}`),"data-dom-to-png-ignore":``},[Y.value>1&&F.value.zoom.show?(h(),u(Je,{key:0,ref_key:`slicerComponent`,ref:Gn,background:F.value.zoom.color,borderColor:F.value.backgroundColor,fontSize:F.value.zoom.fontSize,useResetSlot:F.value.zoom.useResetSlot,timeLabels:X.value,textColor:F.value.color,inputColor:F.value.zoom.color,selectColor:F.value.zoom.highlightColor,max:Y.value,min:0,valueStart:R.value.start,valueEnd:R.value.end,refreshStartPoint:F.value.zoom.startIndex===null?0:F.value.zoom.startIndex,refreshEndPoint:F.value.zoom.endIndex===null?Y.value:F.value.zoom.endIndex+1,enableRangeHandles:F.value.zoom.enableRangeHandles,enableSelectionDrag:F.value.zoom.enableSelectionDrag,focusOnDrag:F.value.zoom.focusOnDrag,focusRangeRatio:F.value.zoom.focusRangeRatio,isCursorPointer:I.value,maxWidth:F.value.zoom.maxWidth,minimapLeftInsetRatio:q.value.absoluteWidth>0&&F.value.zoom.autoFit?q.value.left/q.value.absoluteWidth:null,minimapRightInsetRatio:q.value.absoluteWidth>0&&F.value.zoom.autoFit?(q.value.absoluteWidth-q.value.right)/q.value.absoluteWidth:null,"onUpdate:start":Tr,"onUpdate:end":Er,onReset:s[0]||=()=>Cr({force:!0,publish:!0})},{"reset-action":S(({reset:t})=>[v(e.$slots,`reset-action`,ct(at({reset:t})),void 0,!0)]),_:3},8,[`background`,`borderColor`,`fontSize`,`useResetSlot`,`timeLabels`,`textColor`,`inputColor`,`selectColor`,`max`,`valueStart`,`valueEnd`,`refreshStartPoint`,`refreshEndPoint`,`enableRangeHandles`,`enableSelectionDrag`,`focusOnDrag`,`focusRangeRatio`,`isCursorPointer`,`maxWidth`,`minimapLeftInsetRatio`,`minimapRightInsetRatio`])):d(``,!0)],4),p(`div`,{id:`legend-bottom-${w.value}`},null,8,nn),An.value&&(F.value.legend.show||e.$slots.legend)?(h(),u(et,{key:6,to:F.value.legend.position===`top`?`#legend-top-${w.value}`:`#legend-bottom-${w.value}`},[p(`div`,{ref_key:`chartLegend`,ref:Un},[v(e.$slots,`legend`,{legend:Ci.value},()=>[F.value.legend.show?(h(),u(qe,{key:`legend_${Tn.value}`,legendSet:Ci.value,config:Ti.value,onClickMarker:s[1]||=({legend:e})=>Di(e.uid)},{item:S(({legend:e,index:t})=>[p(`div`,{onClick:t=>Di(e.uid),style:lt(`opacity:${T.value.includes(e.uid)?.5:1}`)},y(e.display),13,rn)]),legendToggle:S(()=>[Ci.value.length>2&&F.value.legend.selectAllToggle.show&&!b(ir)?(h(),u(Ze,{key:0,backgroundColor:F.value.legend.selectAllToggle.backgroundColor,color:F.value.legend.selectAllToggle.color,fontSize:F.value.legend.fontSize,checked:T.value.length>0,onToggle:Ei},null,8,[`backgroundColor`,`color`,`fontSize`,`checked`])):d(``,!0)]),_:1},8,[`legendSet`,`config`])):d(``,!0)],!0)],512)],8,[`to`])):d(``,!0),e.$slots.source?(h(),f(`div`,{key:7,ref_key:`source`,ref:Wn,dir:`auto`},[v(e.$slots,`source`,{},void 0,!0)],512)):d(``,!0),Yn.value&&M.value.userOptions.buttons.table?(h(),u(ft(Yi.value.component),ot({key:8},Yi.value.props,{ref_key:`tableUnit`,ref:jn,onClose:Xi}),tt({content:S(()=>[(h(),u(b(ln),{key:`table_${wn.value}`,colNames:Ni.value.colNames,head:Ni.value.head,body:Ni.value.body,config:Ni.value.config,title:M.value.table.useDialog?``:Yi.value.title,withCloseButton:!M.value.table.useDialog,isCursorPointer:I.value,onClose:Xi},{th:S(({th:e})=>[nt(y(e.name??e),1)]),td:S(({td:e})=>[e.value===null?(h(),f(`span`,an,`-`)):(h(),f(`b`,on,y(isNaN(e.value)?``:P.value.dataLabels.prefix)+y(!isNaN(e.value)&&e.value!==null?Number(e.value.toFixed(M.value.table.td.roundingValue)).toLocaleString():e)+y(isNaN(e.value)?``:P.value.dataLabels.suffix),1)),p(`span`,null,y(e.percentage&&!isNaN(e.percentage)?`(${Number(e.percentage.toFixed(M.value.table.td.roundingPercentage)).toLocaleString()}%)`:``),1)]),_:1},8,[`colNames`,`head`,`body`,`config`,`title`,`withCloseButton`,`isCursorPointer`]))]),_:2},[M.value.table.useDialog?{name:`title`,fn:S(()=>[nt(y(Yi.value.title),1)]),key:`0`}:void 0,M.value.table.useDialog?{name:`actions`,fn:S(()=>[p(`button`,{tabindex:`0`,class:`vue-ui-user-options-button`,onClick:s[2]||=e=>Fi(M.value.userOptions.callbacks.csv),style:lt({cursor:I.value?`cursor`:`default`})},[rt(b(cn),{name:`fileCsv`,stroke:Yi.value.props.color},null,8,[`stroke`])],4)]),key:`1`}:void 0]),1040)):d(``,!0),tr.value.show?(h(),u(b(mn),{key:9,ref_key:`dialog`,ref:Wi,onClose:Gi,backgroundColor:tr.value.backgroundColor,color:tr.value.color,headerBg:tr.value.header.backgroundColor,headerColor:tr.value.header.color,isFullscreen:Ii.value,fullscreenParent:D.value},{title:S(()=>[nt(y(X.value[Number(bn.value?.index)]?X.value[Number(bn.value?.index)].text:``),1)]),content:S(()=>[bn.value?(h(),u(b(pn),{key:0,config:Ui.value,dataset:Hi.value},null,8,[`config`,`dataset`])):d(``,!0)]),_:1},8,[`backgroundColor`,`color`,`headerBg`,`headerColor`,`isFullscreen`,`fullscreenParent`])):d(``,!0),b(ir)?(h(),u(Ye,{key:10})):d(``,!0)],46,_t))}},[[`__scopeId`,`data-v-1dc3db1d`]]);export{gt as n,sn as t};
@@ -1,4 +1,4 @@
1
- import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{n as t,r as n,t as r}from"./userOptionsSlots-CWtXN5Q6.js";import{n as i,r as a,t as o}from"./annotationSlots-OLiW25XN.js";import{n as s,t as ee}from"./tableIntegration-CNoJ1CIY.js";import{t as te}from"./chartImage-DPGnEuYM.js";import{t as ne}from"./resolveChartConfig-0IvbmIE_.js";import{$ as c,D as re,Ft as ie,Jt as ae,Q as oe,X as se,_ as ce,at as le,b as ue,i as de,in as fe,nt as pe,t as me,yt as he,zt as ge}from"./lib-rPeBMZrn.js";import{n as _e,t as ve}from"./useHints-C-TwxM0Y.js";import{t as ye}from"./useConfig-CXhXxWjB.js";import{t as be}from"./useSvgLabelLayout-42Kats14.js";import{t as xe}from"./usePrinter-DVf3YcG5.js";import{t as Se}from"./useLoading-DoqqfnmS.js";import{t as Ce}from"./useResponsive-CENUxfEL.js";import{t as we}from"./useChartExport-BZts4KFb.js";import{t as Te}from"./useUserOptionState-CXlFnwPv.js";import{t as Ee}from"./useChartAccessibility-DOMuYJfm.js";import{t as De}from"./useTimeLabelCollider-BTybMUFi.js";import{t as Oe}from"./usePrefersMotion-XLHwega2.js";import{n as ke}from"./Title-BliHuXfT.js";import{t as Ae}from"./vue_ui_dumbbell-Do6-Spsn.js";import{t as je}from"./Legend-W9YVYVX-.js";import{t as Me}from"./BaseScanner-m6QR9rwD.js";import{t as Ne}from"./A11yDataTable-DWNlWXzs.js";import{t as Pe}from"./DefGrad-DKMq1REY.js";import{t as Fe}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{Fragment as l,Teleport as Ie,computed as u,createBlock as d,createCommentVNode as f,createElementBlock as p,createElementVNode as m,createSlots as Le,createTextVNode as Re,createVNode as ze,defineAsyncComponent as h,guardReactiveProps as Be,mergeProps as Ve,nextTick as He,normalizeClass as Ue,normalizeProps as We,normalizeStyle as g,onBeforeUnmount as Ge,onMounted as Ke,openBlock as _,ref as v,renderList as y,renderSlot as b,resolveDynamicComponent as qe,shallowRef as Je,toDisplayString as x,toRefs as Ye,unref as S,vShow as Xe,watch as C,withCtx as w,withDirectives as T}from"vue";var Ze=/* @__PURE__ */ e({default:()=>It}),Qe=[`id`],$e=[`id`],et=[`id`],tt={style:{position:`relative`}},nt=[`xmlns`,`viewBox`,`aria-describedby`],rt=[`x`,`y`,`width`,`height`],it={key:1},at=[`x1`,`x2`,`y1`,`y2`,`stroke`,`stroke-width`,`stroke-dasharray`],ot={key:2},st=[`x1`,`x2`,`y1`,`y2`,`stroke`,`stroke-width`,`stroke-dasharray`],ct=[`x1`,`x2`,`y1`,`y2`,`stroke`,`stroke-width`,`stroke-dasharray`],lt=[`transform`,`font-size`,`fill`],ut=[`x`,`y`,`font-size`,`fill`,`font-weight`,`onMouseenter`,`onMouseleave`,`onClick`],dt=[`x`,`y`,`font-size`,`fill`,`onMouseenter`,`onMouseleave`,`onClick`],ft=[`x`,`y`,`font-size`,`fill`],pt=[`transform`,`font-size`,`fill`,`font-weight`,`text-anchor`],mt=[`d`,`stroke`,`stroke-width`,`stroke-dasharray`],ht=[`d`,`stroke`,`stroke-width`,`stroke-dasharray`],gt=[`x`,`y`,`height`,`width`,`fill`],_t=[`transform`,`fill`,`font-size`],vt={key:0},yt={key:0},bt=[`d`,`fill`],xt={key:1},St=[`x`,`y`,`height`,`width`,`fill`],Ct=[`cx`,`cy`,`r`,`fill`,`stroke`,`stroke-width`],wt=[`cx`,`cy`,`r`,`fill`,`stroke`,`stroke-width`],Tt={key:7},Et=[`x`,`y`,`fill`,`font-size`],Dt={key:8},Ot=[`x`,`y`,`fill`,`font-size`],kt=[`x`,`y`,`width`,`height`,`fill`,`onMouseenter`,`onMouseleave`,`onClick`],At={key:0,style:{position:`absolute`,top:`100%`,left:`0`,width:`100%`},"data-dom-to-png-ignore":``,"aria-hidden":`true`},jt={key:5,class:`vue-data-ui-watermark`},Mt=[`id`],Nt=[`xmlns`,`height`,`width`],Pt=[`fill`],Ft={style:{display:`flex`,"align-items":`center`}},It=/*#__PURE__*/ Fe({__name:`vue-ui-dumbbell`,props:{config:{type:Object,default(){return{}}},dataset:{type:Array,default(){return[]}}},emits:[`selectDatapoint`,`copyAlt`],setup(e,{expose:Fe,emit:Ze}){let It=h(()=>import(`./BaseIcon-CoY0vuL3.js`).then(e=>e.n)),Lt=h(()=>import(`./vue-ui-accordion-D3uT1Ynv.js`).then(e=>e.n)),Rt=h(()=>import(`./DataTable-KeuZB1JM.js`)),zt=h(()=>import(`./PenAndPaper-BV5ODysA.js`).then(e=>e.t)),Bt=h(()=>import(`./UserOptions-K1N7zQRx.js`).then(e=>e.n)),Vt=h(()=>import(`./PackageVersion-C1vtZkKc.js`).then(e=>e.t)),Ht=h(()=>import(`./BaseDraggableDialog-DVstuNhT.js`).then(e=>e.n)),{vue_ui_dumbbell:Ut}=ye(),Wt=Oe(),E=e,Gt=Ze,Kt=u(()=>!!E.dataset?.length),D=v(se()),qt=v(0),O=v(null),Jt=v(null),Yt=v(null),Xt=v(null),Zt=v(null),Qt=v(0),$t=v(0),en=v(0),tn=v(!1),nn=v(null),rn=v(null),an=v(null),on=v(null),sn=v(null),cn=v(null),k=v(null),A=u(()=>{let e=X.value.findIndex(e=>e.id===k.value);return e<0?null:e}),j=u(()=>A.value==null?null:X.value[A.value]),M=v(null),ln=v(!1),un=u(()=>cr({rowHeight:q.value.rowHeight,fontSize:F.value.yAxisLabels.fontSize,showProgression:F.value.yAxisLabels.showProgression})),N=v(vn()),P=u(()=>N.value.style.chart.grid.horizontalGrid),dn=u(()=>N.value.style.chart.grid.verticalGrid),F=u(()=>N.value.style.chart.labels);u(()=>N.value.style.chart.grid);let I=u(()=>N.value.style.chart.plots),L=u(()=>N.value.style.chart.comparisonLines),R=u(()=>N.value.style.chart);_e({config:()=>N.value,dataset:()=>E.dataset,component:`VueUiDumbbell`,rules:[ve.emptyArray,{test:e=>e.length>31,message:[`👀 The number of series is > 31. Consider:`,``,`▶️ Using filters to let users choose a maximum number of series to display.`,``,`▶️ Using multiple instances of the component to display related series.`]}]});let z=u(()=>N.value.userOptions.useCursorPointer),fn=u(()=>fe({defaultConfig:{userOptions:{show:!1},table:{show:!1},useAnimation:!1,style:{chart:{backgroundColor:`#99999930`,padding:{top:12,right:12,bottom:12,left:12},grid:{horizontalGrid:{stroke:`#6A6A6A`},verticalGrid:{stroke:`#6A6A6A`}},labels:{axis:{yLabel:``,xLabel:``},xAxisLabels:{show:!1},yAxisLabels:{show:!1},endLabels:{show:!1},startLabels:{show:!1}},legend:{backgroundColor:`transparent`},plots:{endColor:`#969696`,startColor:`#DBDBDB`,stroke:`#6A6A6A`,evaluationColors:{enable:!1}}}}},userConfig:N.value.skeletonConfig??{}})),{loading:pn,FINAL_DATASET:mn}=Se({...Ye(E),FINAL_CONFIG:N,prepareConfig:vn,skeletonDataset:E.config?.skeletonDataset??[{name:`_`,start:21,end:34},{name:`_`,start:13,end:21},{name:`_`,start:8,end:13},{name:`_`,start:5,end:8},{name:`_`,start:3,end:5}],skeletonConfig:fe({defaultConfig:N.value,userConfig:fn.value})}),{userOptionsVisible:hn,setUserOptionsVisibility:gn,keepUserOptionState:_n}=Te({config:N.value}),{svgRef:B}=Ee({config:R.value.title});function vn(){return ne(E.config,Ut,Ae)}C(()=>E.config,e=>{pn.value||(N.value=vn()),hn.value=!N.value.userOptions.showOnChartHover,Tn(),Qt.value+=1,$t.value+=1,en.value+=1,V.value.showTable=N.value.table.show},{deep:!0});let yn=Je(null),bn=null,xn=!1,Sn=v(!1),Cn=0;Ke(()=>{tn.value=!0,Tn(),Dn()});let wn=u(()=>N.value.debug);function Tn(){ge(E.dataset)?le({componentName:`VueUiDumbbell`,type:`dataset`,debug:wn.value}):E.dataset.forEach((e,t)=>{he({datasetObject:e,requiredAttributes:[`name`,`start`,`end`]}).forEach(e=>{le({componentName:`VueUiDumbbell`,type:`datasetSerieAttribute`,property:e,index:t,debug:wn.value})})})}function En(){bn=null,cancelAnimationFrame(Cn),yn.value?.disconnect(),yn.value=null}function Dn(){if(En(),!N.value.responsive){G.value=R.value.width,W.value=R.value.rowHeight;return}let e=O.value?.parentNode;if(!e)return;let t=()=>{cancelAnimationFrame(Cn),Cn=requestAnimationFrame(()=>{if(xn)return;let{width:e,height:t}=Ce({chart:O.value,title:R.value.title.text?Jt.value:null,legend:R.value.legend.show?Yt.value:null,source:Xt.value,noTitle:Zt.value}),n=(R.value.title.text?24:0)+(R.value.legend.show?24:0);G.value=Math.max(.1,e),W.value=Math.max(.1,(Math.max(.1,t)-n)/Math.max(1,K.value)),Sn.value=!0})};bn=t,yn.value=new ResizeObserver(t),yn.value.observe(e),t()}Ge(()=>{xn=!0,En(),Gn()});let{isPrinting:On,isImaging:kn,generatePdf:An,generateImage:jn}=xe({elementId:`dumbbell_${D.value}`,fileName:R.value.title.text||`vue-ui-dumbbell`,options:N.value.userOptions.print}),Mn=u(()=>N.value.userOptions.show&&!R.value.title.text),V=v({showTable:N.value.table.show});C(N,()=>{V.value={showTable:N.value.table.show}},{immediate:!0});let H=u(()=>mn.value.map((e,t)=>({...e,start:ue(e.start),end:ue(e.end),id:e.id??`dumbbell_${D.value}_${t}`}))),Nn=u(()=>{let e=R.value.grid,t=H.value.flatMap(e=>[e.start,e.end]).map(e=>Number(e)).filter(e=>Number.isFinite(e)),n=t.length?Math.min(...t):0,r=t.length?Math.max(...t):0;return{min:e.scaleMin??Math.min(n,0),max:e.scaleMax??r}}),U=u(()=>ce(Nn.value.min,Nn.value.max,R.value.grid.scaleSteps)),W=v(R.value.rowHeight),G=v(R.value.width),{metrics:Pn,ready:Fn,settling:In,update:Ln}=be({svgRef:B,canMeasure:()=>!N.value.responsive||Sn.value,initialMetrics:{scaleLabelsWidth:0,yAxisLabelWidth:0,xAxisLabelHeight:0,timeLabelsHeight:0},measure:e=>({scaleLabelsWidth:e(on.value).textWidth,yAxisLabelWidth:e(an.value).rotatedWidth,xAxisLabelHeight:e(cn.value).height,timeLabelsHeight:e(sn.value).height})});function Rn(){let e=Pn.value.scaleLabelsWidth,t=Pn.value.yAxisLabelWidth;return e+t+(t?24+F.value.axis.yLabelOffsetX:0)}let zn=u(()=>Pn.value.xAxisLabelHeight+Pn.value.timeLabelsHeight),K=u(()=>H.value.length);function Bn(e,t,n){let r=Number(e),i=Number(t.min),a=Number(t.max),o=Number(n.width);if(!Number.isFinite(r)||!Number.isFinite(i)||!Number.isFinite(a)||!Number.isFinite(o))return n.left;let s=a-i;return s<=0?n.left:n.left+(r-i)/s*o}let q=u(()=>{let e=Rn(),t=R.value.padding,n=F.value.axis.xLabel?F.value.axis.xLabelOffsetY:0,r=W.value*K.value-zn.value-t.top-t.bottom-n,i=K.value?r/K.value:0,a=W.value*K.value,o=G.value-e-t.left-t.right,s=o;return{left:R.value.padding.left+e,right:G.value-R.value.padding.right,top:R.value.padding.top,bottom:a-R.value.padding.bottom-zn.value-n,width:o,height:r,rowHeight:i,absoluteHeight:a,widthPlotReference:s}}),J=u(()=>Math.min(W.value/2*.7,I.value.radius));function Vn(e){let t=Number(e.start);return Number.isFinite(t)?t:0}function Hn(e){let t=Number(e.end);return Number.isFinite(t)?t:Vn(e)}let Y=v([]),X=u(()=>{let e=q.value,t=U.value;return H.value.map((n,r)=>{let i=Bn(n.start,t,e),a=Bn(Y.value[r]??Hn(n),t,e),o=i+(a-i)/2,s=![null,void 0].includes(n.start)&&![null,void 0].includes(n.end)&&n.end>n.start,ee=![null,void 0].includes(n.start)&&![null,void 0].includes(n.end)&&n.end<n.start,te=![null,void 0].includes(n.start)&&![null,void 0].includes(n.end)&&n.end===n.start||[null,void 0].includes(n.start)||[null,void 0].includes(n.end),ne=s?I.value.evaluationColors.positive:ee?I.value.evaluationColors.negative:I.value.evaluationColors.neutral;return{...n,endVal:Y.value[r]??Hn(n),isPositive:s,isNegative:ee,isNeutral:te,evaluationColor:ne,evaluationGrad:`url(#${s?`positive`:ee?`negative`:`neutral`}_grad_${D.value})`,startX:i,endX:a,centerX:o,y:e.top+r*e.rowHeight+e.rowHeight/2}})}),Un=null,Wn=0;function Gn(){Wn++,Un!==null&&cancelAnimationFrame(Un),Un=null}function Kn(){Gn();let e=H.value,t=e.map(Hn);if(xn||!N.value.useAnimation||Wt.value){Y.value=t;return}Y.value=e.map(Vn);let n=Math.max(1,Math.min(100,Number(N.value.animationSpeed)||100))/100,r=t.map((e,t)=>e-Y.value[t]),i=Wn;function a(){if(xn||i!==Wn)return;let e=!0;Y.value=Y.value.map((i,a)=>{let o=i+r[a]*n,s=r[a]>=0?Math.min(o,t[a]):Math.max(o,t[a]);return s!==t[a]&&(e=!1),s}),Un=e?null:requestAnimationFrame(a)}e.length&&(Un=requestAnimationFrame(a))}let qn=u(()=>[{key:`start`,color:I.value.startColor,name:R.value.legend.labelStart},{key:`end`,color:I.value.endColor,name:R.value.legend.labelEnd},...[`negative`,`neutral`,`positive`].map(e=>({key:e,color:I.value.evaluationColors[e],name:R.value.legend[`label${e[0].toUpperCase()+e.slice(1)}`]}))]),Jn=u(()=>qn.value.filter(e=>I.value.evaluationColors.enable?![`start`,`end`].includes(e.key):[`start`,`end`].includes(e.key)).map(e=>({name:e.name,color:I.value.gradient.show?`url(#${e.key}_grad_${D.value})`:e.color}))),Yn=u(()=>({cy:`donut-div-legend`,backgroundColor:R.value.legend.backgroundColor,color:R.value.legend.color,fontSize:R.value.legend.fontSize,paddingBottom:12,paddingTop:12,fontWeight:R.value.legend.bold?`bold`:``}));function Xn(e){if(e.start==null||e.end==null||Number(e.start)===0)return null;let t=100*(Number(e.end)/Number(e.start)-1);return Number.isFinite(t)?t:null}function Zn(e){let t=Xn(e);return t==null?``:de(F.value.yAxisLabels.formatter,t,c({v:t,s:`%`,r:F.value.yAxisLabels.rounding}),{datapoint:e})}function Qn(e,t,n){return de(F.value.formatter,e,c({p:F.value.prefix,v:e,s:F.value.suffix,r:t}),n)}let Z=u(()=>({head:X.value.map(e=>({name:e.name})),body:X.value.map(e=>({start:e.start,end:e.end}))})),Q=u(()=>{let e=[N.value.table.columnNames.series,N.value.table.columnNames.start,N.value.table.columnNames.end,N.value.table.columnNames.progression];return{colNames:e,head:e,body:Z.value.head.map((e,t)=>{let n=c({p:F.value.prefix,v:Z.value.body[t].start,s:F.value.suffix,r:N.value.table.td.roundingValue}),r=c({p:F.value.prefix,v:Z.value.body[t].end,s:F.value.suffix,r:N.value.table.td.roundingValue}),i=Xn(Z.value.body[t]),a=i==null?`-`:c({v:i,s:`%`,r:N.value.table.td.roundingPercentage});return[{name:e.name},n,r,a]}),config:{th:{backgroundColor:N.value.table.th.backgroundColor,color:N.value.table.th.color,outline:N.value.table.th.outline},td:{backgroundColor:N.value.table.td.backgroundColor,color:N.value.table.td.color,outline:N.value.table.td.outline},breakpoint:N.value.table.responsiveBreakpoint}}});function $n(e=null){He(()=>{let t=Z.value.head.map((e,t)=>[[e.name],[Z.value.body[t].start],[Z.value.body[t].end]]),n=[[R.value.title.text],[R.value.title.subtitle.text],[[N.value.table.columnNames.series],[N.value.table.columnNames.start],[N.value.table.columnNames.end]]].concat(t),r=re(n);e?e(r):pe({csvContent:r,title:R.value.title.text||`vue-ui-dumbbell`})})}let $=v(!1);function er(e){$.value=e,qt.value+=1}function tr(){return H.value}function nr(){V.value.showTable=!V.value.showTable}let rr=v(!1);function ir(){rr.value=!rr.value}let ar=te(O,()=>R.value.title.text),or=u(()=>U.value.ticks),sr=u(()=>({start:0,end:or.value.length}));De({timeLabelsEls:sn,timeLabels:or,slicer:sr,configRef:N,rotationPath:[`style`,`chart`,`labels`,`xAxisLabels`,`rotation`],autoRotatePath:[`style`,`chart`,`labels`,`xAxisLabels`,`autoRotate`,`enable`],isAutoSize:!1,width:G,height:W,targetClass:`.vue-ui-dumbbell-scale-label`,rotation:F.value.xAxisLabels.autoRotate.angle});function cr({rowHeight:e,fontSize:t,showProgression:n}){if(!n)return!1;let r=e/3,i=e/1.3;return Math.abs(i-r)<t*1.2}function lr({datapoint:e,seriesIndex:t}){k.value=e.id,N.value.events.datapointEnter&&N.value.events.datapointEnter({datapoint:e,seriesIndex:t})}function ur({datapoint:e,seriesIndex:t}){k.value=null,N.value.events.datapointLeave&&N.value.events.datapointLeave({datapoint:e,seriesIndex:t})}function dr({datapoint:e,seriesIndex:t}){N.value.events.datapointClick&&N.value.events.datapointClick({datapoint:e,seriesIndex:t}),Gt(`selectDatapoint`,{...e,seriesIndex:t})}let fr=u(()=>{let e=j.value;if(!e)return 0;let t=[e.start==null?null:e.startX,e.end==null?null:e.endX].filter(e=>e!=null);return t.length?t.reduce((e,t)=>e+t,0)/t.length:null}),pr=u(()=>{let e=j.value;if(!e)return``;let t={datapoint:e,seriesIndex:A.value};return[`start`,`end`].filter(t=>e[t]!=null).map(n=>Qn(e[n],F.value[`${n}Labels`].rounding,t)).join(` → `)}),mr=u(()=>ee({config:N,style:R,mutableConfig:V,dialog:Ht,accordion:Lt,isFullscreen:$,parent:O,maxWidth:800,isCursorPointer:z}));C(()=>V.value.showTable,e=>s(e,N,nn));function hr(){V.value.showTable=!1,rn.value&&rn.value.setTableIconState(!1)}let gr=u(()=>Jn.value.map(e=>({...e,shape:`circle`}))),_r=u(()=>R.value.backgroundColor),vr=u(()=>R.value.legend),yr=u(()=>R.value.title),{isCallbackImaging:br,isCallbackSvg:xr,generateSvg:Sr,onGenerateImage:Cr}=we({svg:B,title:yr,legend:vr,legendItems:gr,backgroundColor:_r,getSvgCallback:()=>N.value.userOptions.callbacks.svg,generateImage:jn});async function wr(){Gt(`copyAlt`,{config:N.value,dataset:X.value}),N.value.userOptions.callbacks.altCopy?await Promise.resolve(N.value.userOptions.callbacks.altCopy({config:N.value,dataset:X.value})):console.warn("Vue Data UI - A callback must be set for `altCopy` in userOptions.")}function Tr(e){let t=X.value.length;return t?(e%t+t)%t:null}function Er(){if(M.value!==null){let e=X.value[M.value];e&&ur({datapoint:e,seriesIndex:M.value})}M.value=null,k.value=null}function Dr(){M.value=null,ln.value=!0}function Or(){Er(),ln.value=!1}function kr(e){if(!B.value||rr.value||document.activeElement!==B.value||!X.value.length)return;let t=[`ArrowUp`,`ArrowLeft`].includes(e.key),n=[`ArrowDown`,`ArrowRight`].includes(e.key),r=e.key===`Enter`||e.key===` `,i=e.key===`Escape`;if(!t&&!n&&!r&&!i)return;if(e.preventDefault(),e.stopPropagation(),i){Er();return}if(r){if(M.value===null)return;let e=X.value[M.value];if(!e)return;dr({datapoint:e,seriesIndex:M.value});return}let a=M.value;a=a===null?n?0:X.value.length-1:Tr(a+(n?1:-1));let o=X.value[a];o&&(M.value=a,lr({datapoint:o,seriesIndex:a}))}let Ar=u(()=>({head:Q.value.head,body:Q.value.body.map(e=>[e[0]?.name??``,e[1],e[2],e[3]]),caption:N.value.a11y.translations.tableCaption,notice:N.value.a11y.translations.tableAvailable}));return C([H,()=>N.value.useAnimation,()=>N.value.animationSpeed,Wt],Kn,{immediate:!0}),C(()=>E.dataset,Tn,{deep:!0}),C([()=>N.value.responsive,()=>R.value.width,()=>R.value.rowHeight],Dn,{flush:`post`}),C([R,K],()=>bn?.(),{flush:`post`}),C(X,e=>{k.value!=null&&!e.some(e=>e.id===k.value)?(k.value=null,M.value=null):M.value!=null&&(M.value=A.value)}),Fe({getData:tr,getImage:ar,generatePdf:An,generateCsv:$n,generateImage:jn,generateSvg:Sr,toggleTable:nr,toggleAnnotator:ir,toggleFullscreen:er,copyAlt:wr}),C(()=>[G.value,W.value,un.value,F.value,R.value,N.value.style.fontFamily,E.dataset,Sn.value,on.value,sn.value,cn.value,an.value],Ln,{flush:`post`,deep:!0}),(e,s)=>(_(),p(`div`,{ref_key:`dumbbellChart`,ref:O,class:Ue(`vue-data-ui-component vue-ui-dumbbell ${$.value?`vue-data-ui-wrapper-fullscreen`:``}`),style:g(`font-family:${N.value.style.fontFamily};width:100%; text-align:center;background:${R.value.backgroundColor};${N.value.responsive?`height:100%`:``}`),id:`dumbbell_${D.value}`,onMouseenter:s[1]||=()=>S(gn)(!0),onMouseleave:s[2]||=()=>S(gn)(!1)},[m(`div`,{id:`chart-instructions-${D.value}`,class:`sr-only`},[m(`p`,null,x(N.value.a11y.translations.keyboardNavigation),1)],8,$e),N.value.a11y.includeTable&&Ar.value.body.length?(_(),d(Ne,{key:0,uid:D.value,head:Ar.value.head,body:Ar.value.body,caption:Ar.value.caption,notice:Ar.value.notice},null,8,[`uid`,`head`,`body`,`caption`,`notice`])):f(``,!0),N.value.userOptions.buttons.annotator?(_(),d(S(zt),Ve({key:1},S(a)(N.value.userOptions.annotator),{svgRef:S(B),backgroundColor:R.value.backgroundColor,color:R.value.color,active:rr.value,isCursorPointer:z.value,palette:N.value.userOptions.annotatorPalette,onClose:ir}),Le({_:2},[y(S(o),t=>({name:t,fn:w(n=>[b(e.$slots,t,We(Be(S(i)(t,n))),void 0,!0)])}))]),1040,[`svgRef`,`backgroundColor`,`color`,`active`,`isCursorPointer`,`palette`])):f(``,!0),Mn.value?(_(),p(`div`,{key:2,ref_key:`noTitle`,ref:Zt,class:`vue-data-ui-no-title-space`,style:`height:36px; width: 100%;background:transparent`},null,512)):f(``,!0),R.value.title.text?(_(),p(`div`,{key:3,ref_key:`chartTitle`,ref:Jt,style:`width:100%;background:transparent;padding-bottom:24px`},[(_(),d(ke,{key:`title_${Qt.value}`,config:{title:{cy:`donut-div-title`,...R.value.title},subtitle:{cy:`donut-div-subtitle`,...R.value.title.subtitle}}},null,8,[`config`]))],512)):f(``,!0),m(`div`,{id:`legend-top-${D.value}`},null,8,et),N.value.userOptions.show&&Kt.value&&(S(_n)||S(hn))?(_(),d(S(Bt),Ve({ref_key:`userOptionsRef`,ref:rn,key:`user_option_${qt.value}`,backgroundColor:R.value.backgroundColor,color:R.value.color,isPrinting:S(On),isImaging:S(kn),uid:D.value,isFullscreen:$.value,chartElement:O.value},S(n)(N.value.userOptions,`pdf csv img svg table fullscreen altCopy annotator`),{isAnnotation:rr.value,tableDialog:N.value.table.useDialog,isCursorPointer:z.value,onToggleFullscreen:er,onGeneratePdf:S(An),onGenerateCsv:$n,onGenerateImage:S(Cr),onGenerateSvg:S(Sr),onToggleTable:nr,onToggleAnnotator:ir,onCopyAlt:wr,style:{visibility:S(_n)?S(hn)?`visible`:`hidden`:`visible`}}),Le({_:2},[y(S(t)(e.$slots,`menuIcon optionPdf optionCsv optionImg optionSvg optionTable optionFullscreen optionAnnotator optionAltCopy custom-menu-before custom-menu-after`),t=>({name:t,fn:w(n=>[b(e.$slots,t,We(Be(S(r)(t,n))),void 0,!0)])}))]),1040,[`backgroundColor`,`color`,`isPrinting`,`isImaging`,`uid`,`isFullscreen`,`chartElement`,`isAnnotation`,`tableDialog`,`isCursorPointer`,`onGeneratePdf`,`onGenerateImage`,`onGenerateSvg`,`style`])):f(``,!0),m(`div`,tt,[(_(),p(`svg`,{ref_key:`svgRef`,ref:B,xmlns:S(me),class:Ue({"vue-data-ui-fullscreen--on":$.value,"vue-data-ui-fulscreen--off":!$.value}),viewBox:`0 0 ${G.value} ${q.value.absoluteHeight<=0?10:q.value.absoluteHeight}`,style:g(`max-width:100%; overflow: visible; background:transparent;color:${R.value.color};visibility:${S(Fn)?`visible`:`hidden`}`),"aria-describedby":`chart-instructions-${D.value}`,tabindex:`0`,onFocus:Dr,onBlur:Or,onKeydown:kr},[ze(S(Vt)),b(e.$slots,`svg-underlayer`,{svg:{...q.value,isPrintingImg:S(On)||S(kn)||S(br),isPrintingSvg:S(xr)}},void 0,!0),e.$slots[`chart-background`]?(_(),p(`foreignObject`,{key:0,x:q.value.left,y:q.value.top,width:Math.max(.1,q.value.width),height:Math.max(.1,q.value.height),style:{pointerEvents:`none`}},[b(e.$slots,`chart-background`,{},void 0,!0)],8,rt)):f(``,!0),dn.value.show?(_(),p(`g`,it,[(_(!0),p(l,null,y(U.value.ticks,(e,t)=>(_(),p(`line`,{x1:q.value.left+t*q.value.width/(U.value.ticks.length-1),x2:q.value.left+t*q.value.width/(U.value.ticks.length-1),y1:q.value.top,y2:q.value.bottom,stroke:dn.value.stroke,"stroke-width":dn.value.strokeWidth,"stroke-dasharray":dn.value.strokeDasharray},null,8,at))),256))])):f(``,!0),P.value.show?(_(),p(`g`,ot,[(_(!0),p(l,null,y(H.value,(e,t)=>(_(),p(`line`,{x1:q.value.left,x2:q.value.right,y1:q.value.top+t*q.value.rowHeight,y2:q.value.top+t*q.value.rowHeight,stroke:P.value.stroke,"stroke-width":P.value.strokeWidth,"stroke-dasharray":P.value.strokeDasharray},null,8,st))),256)),m(`line`,{x1:q.value.left,x2:q.value.right,y1:q.value.bottom,y2:q.value.bottom,stroke:P.value.stroke,"stroke-width":P.value.strokeWidth,"stroke-dasharray":P.value.strokeDasharray},null,8,ct)])):f(``,!0),F.value.axis.yLabel?(_(),p(`text`,{key:3,ref_key:`yAxisLabel`,ref:an,transform:`translate(${F.value.axis.fontSize}, ${q.value.absoluteHeight/2}), rotate(-90)`,"font-size":F.value.axis.fontSize,fill:F.value.axis.color,"text-anchor":`middle`},x(F.value.axis.yLabel),9,lt)):f(``,!0),F.value.yAxisLabels.show?(_(),p(`g`,{key:4,ref_key:`serieLabels`,ref:on},[(_(!0),p(l,null,y(X.value,(e,t)=>(_(),p(`text`,{class:`vue-ui-dumbbell-serie-name`,key:`serieLabel_${e.id}_${t}`,x:q.value.left-6+F.value.yAxisLabels.offsetX,y:q.value.top+t*q.value.rowHeight+(!F.value.yAxisLabels.showProgression||un.value?q.value.rowHeight/2:q.value.rowHeight/3)+F.value.yAxisLabels.fontSize/3,"font-size":F.value.yAxisLabels.fontSize,fill:F.value.yAxisLabels.color,"font-weight":F.value.yAxisLabels.bold?`bold`:`normal`,"text-anchor":`end`,onMouseenter:n=>lr({datapoint:e,seriesIndex:t}),onMouseleave:n=>ur({datapoint:e,seriesIndex:t}),onClick:n=>dr({datapoint:e,seriesIndex:t})},x(e.name)+` `+x(un.value&&F.value.yAxisLabels.showProgression&&Xn(e)!=null?`(${Zn(e)})`:``),41,ut))),128)),F.value.yAxisLabels.showProgression&&!un.value?(_(!0),p(l,{key:0},y(X.value,(e,t)=>(_(),p(`text`,{class:`vue-ui-dumbbell-serie-value`,x:q.value.left-6+F.value.yAxisLabels.offsetX,y:q.value.top+t*q.value.rowHeight+q.value.rowHeight/1.3+F.value.yAxisLabels.fontSize/3,"font-size":F.value.yAxisLabels.fontSize,fill:F.value.yAxisLabels.color,"text-anchor":`end`,onMouseenter:n=>lr({datapoint:e,seriesIndex:t}),onMouseleave:n=>ur({datapoint:e,seriesIndex:t}),onClick:n=>dr({datapoint:e,seriesIndex:t})},x(Zn(e)),41,dt))),256)):f(``,!0)],512)):f(``,!0),F.value.axis.xLabel?(_(),p(`text`,{key:5,ref_key:`xAxisLabel`,ref:cn,x:q.value.left+q.value.width/2,y:q.value.absoluteHeight-F.value.axis.fontSize/3,"font-size":F.value.axis.fontSize,fill:F.value.axis.color,"text-anchor":`middle`},x(F.value.axis.xLabel),9,ft)):f(``,!0),F.value.xAxisLabels.show?(_(),p(`g`,{key:6,ref_key:`scaleLabels`,ref:sn},[(_(!0),p(l,null,y(U.value.ticks,(e,t)=>(_(),p(`text`,{class:`vue-ui-dumbbell-scale-label`,key:`tick_${t}`,transform:`translate(${q.value.left+t*(q.value.width/(U.value.ticks.length-1))}, ${q.value.bottom+F.value.xAxisLabels.fontSize+F.value.xAxisLabels.offsetY}), rotate(${F.value.xAxisLabels.rotation})`,"font-size":F.value.xAxisLabels.fontSize,fill:F.value.xAxisLabels.color,"font-weight":F.value.xAxisLabels.bold?`bold`:`normal`,"text-anchor":F.value.xAxisLabels.rotation>0?`start`:F.value.xAxisLabels.rotation<0?`end`:`middle`},x(S(de)(F.value.formatter,e,S(c)({p:F.value.prefix,v:e,s:F.value.suffix,r:F.value.xAxisLabels.rounding}),{datapoint:e,seriesIndex:t})),9,pt))),128))],512)):f(``,!0),T(m(`g`,null,[T(m(`path`,{d:`M ${j.value?j.value.startX:q.value.left},${q.value.top} ${j.value?j.value.startX:q.value.left},${q.value.bottom}`,stroke:j.value?I.value.evaluationColors.enable?j.value.evaluationColor:I.value.startColor:`transparent`,"stroke-width":L.value.strokeWidth,"stroke-dasharray":L.value.strokeDasharray,style:g({transition:S(In)?`none`:`all 0.3s ease-in-out`})},null,12,mt),[[Xe,j.value!==null&&![null,void 0].includes(j.value.start)]]),T(m(`path`,{d:`M ${j.value?j.value.endX:q.value.left},${q.value.top} ${j.value?j.value.endX:q.value.left},${q.value.bottom}`,stroke:j.value?I.value.evaluationColors.enable?j.value.evaluationColor:I.value.endColor:`transparent`,"stroke-width":L.value.strokeWidth,"stroke-dasharray":L.value.strokeDasharray,style:g({transition:S(In)?`none`:`all 0.3s ease-in-out`})},null,12,ht),[[Xe,j.value!==null&&![null,void 0].includes(j.value.end)]]),T(m(`rect`,{x:j.value?Math.min(j.value.startX,j.value.endX):q.value.left,y:q.value.top,height:Math.max(.1,q.value.height),width:j.value?Math.max(.1,Math.abs(j.value.endX-j.value.startX)):0,fill:j.value?S(ae)(L.value.rectColor,L.value.rectOpacity):`transparent`,style:g({transition:S(In)?`none`:`all 0.3s ease-in-out`})},null,12,gt),[[Xe,L.value.showRect&&j.value!==null&&![null,void 0].includes(j.value.start)&&![null,void 0].includes(j.value.end)]]),T(m(`text`,{transform:`translate(${fr.value==null?0:fr.value}, ${q.value.top-6})`,fill:L.value.labelColor,"font-size":L.value.labelFontSize,"text-anchor":`middle`,style:g({transition:S(In)?`none`:`all 0.3s ease-in-out`})},x(pr.value),13,_t),[[Xe,j.value!==null&&fr.value!==null&&L.value.showLabel]])],512),[[Xe,L.value.show&&A.value!==null]]),m(`defs`,null,[(_(!0),p(l,null,y(qn.value,e=>(_(),d(Pe,{key:e.key,t:`radial`,id:`${e.key}_grad_${D.value}`,fy:`30%`,stops:[[`10%`,S(ie)(e.color,I.value.gradient.intensity/100),1],[`90%`,S(oe)(e.color,.1),1],[`100%`,e.color,1]]},null,8,[`id`,`stops`]))),128)),(_(),p(l,null,y([`pos`,`neg`],e=>ze(Pe,{key:e,t:`linear`,id:`grad_${e}_${D.value}`,x1:`0%`,x2:`100%`,y1:`0%`,y2:`0%`,stops:[[`0%`,e===`pos`?I.value.startColor:I.value.endColor,1],[`100%`,e===`pos`?I.value.endColor:I.value.startColor,1]]},null,8,[`id`,`stops`])),64))]),(_(!0),p(l,null,y(X.value,(e,t)=>(_(),p(`g`,{key:`plot_${t}_${e.id}`},[![void 0,null].includes(e.end)&&![void 0,null].includes(e.start)?(_(),p(`g`,vt,[I.value.link.type===`curved`?(_(),p(`g`,yt,[m(`path`,{d:`M
1
+ import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{n as t,r as n,t as r}from"./userOptionsSlots-CWtXN5Q6.js";import{n as i,r as a,t as o}from"./annotationSlots-OLiW25XN.js";import{n as s,t as ee}from"./tableIntegration-CNoJ1CIY.js";import{t as te}from"./chartImage-Dvrx_F7P.js";import{t as ne}from"./resolveChartConfig-QgMumfgd.js";import{$ as c,D as re,Ft as ie,Jt as ae,Q as oe,X as se,_ as ce,at as le,b as ue,i as de,in as fe,nt as pe,t as me,yt as he,zt as ge}from"./lib-BaWaqwnJ.js";import{n as _e,t as ve}from"./useHints-C-TwxM0Y.js";import{t as ye}from"./useConfig-B-AzS3w-.js";import{t as be}from"./useSvgLabelLayout-42Kats14.js";import{t as xe}from"./usePrinter-CUD8gosC.js";import{t as Se}from"./useLoading-DoqqfnmS.js";import{t as Ce}from"./useResponsive-CENUxfEL.js";import{t as we}from"./useChartExport-BZts4KFb.js";import{t as Te}from"./useUserOptionState-CXlFnwPv.js";import{t as Ee}from"./useChartAccessibility-DOMuYJfm.js";import{t as De}from"./useTimeLabelCollider-BTybMUFi.js";import{t as Oe}from"./usePrefersMotion-XLHwega2.js";import{n as ke}from"./Title-DlhGIAWX.js";import{t as Ae}from"./vue_ui_dumbbell-Do6-Spsn.js";import{t as je}from"./Legend-D5I3jeGD.js";import{t as Me}from"./BaseScanner-m6QR9rwD.js";import{t as Ne}from"./A11yDataTable-DWNlWXzs.js";import{t as Pe}from"./DefGrad-DKMq1REY.js";import{t as Fe}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{Fragment as l,Teleport as Ie,computed as u,createBlock as d,createCommentVNode as f,createElementBlock as p,createElementVNode as m,createSlots as Le,createTextVNode as Re,createVNode as ze,defineAsyncComponent as h,guardReactiveProps as Be,mergeProps as Ve,nextTick as He,normalizeClass as Ue,normalizeProps as We,normalizeStyle as g,onBeforeUnmount as Ge,onMounted as Ke,openBlock as _,ref as v,renderList as y,renderSlot as b,resolveDynamicComponent as qe,shallowRef as Je,toDisplayString as x,toRefs as Ye,unref as S,vShow as Xe,watch as C,withCtx as w,withDirectives as T}from"vue";var Ze=/* @__PURE__ */ e({default:()=>It}),Qe=[`id`],$e=[`id`],et=[`id`],tt={style:{position:`relative`}},nt=[`xmlns`,`viewBox`,`aria-describedby`],rt=[`x`,`y`,`width`,`height`],it={key:1},at=[`x1`,`x2`,`y1`,`y2`,`stroke`,`stroke-width`,`stroke-dasharray`],ot={key:2},st=[`x1`,`x2`,`y1`,`y2`,`stroke`,`stroke-width`,`stroke-dasharray`],ct=[`x1`,`x2`,`y1`,`y2`,`stroke`,`stroke-width`,`stroke-dasharray`],lt=[`transform`,`font-size`,`fill`],ut=[`x`,`y`,`font-size`,`fill`,`font-weight`,`onMouseenter`,`onMouseleave`,`onClick`],dt=[`x`,`y`,`font-size`,`fill`,`onMouseenter`,`onMouseleave`,`onClick`],ft=[`x`,`y`,`font-size`,`fill`],pt=[`transform`,`font-size`,`fill`,`font-weight`,`text-anchor`],mt=[`d`,`stroke`,`stroke-width`,`stroke-dasharray`],ht=[`d`,`stroke`,`stroke-width`,`stroke-dasharray`],gt=[`x`,`y`,`height`,`width`,`fill`],_t=[`transform`,`fill`,`font-size`],vt={key:0},yt={key:0},bt=[`d`,`fill`],xt={key:1},St=[`x`,`y`,`height`,`width`,`fill`],Ct=[`cx`,`cy`,`r`,`fill`,`stroke`,`stroke-width`],wt=[`cx`,`cy`,`r`,`fill`,`stroke`,`stroke-width`],Tt={key:7},Et=[`x`,`y`,`fill`,`font-size`],Dt={key:8},Ot=[`x`,`y`,`fill`,`font-size`],kt=[`x`,`y`,`width`,`height`,`fill`,`onMouseenter`,`onMouseleave`,`onClick`],At={key:0,style:{position:`absolute`,top:`100%`,left:`0`,width:`100%`},"data-dom-to-png-ignore":``,"aria-hidden":`true`},jt={key:5,class:`vue-data-ui-watermark`},Mt=[`id`],Nt=[`xmlns`,`height`,`width`],Pt=[`fill`],Ft={style:{display:`flex`,"align-items":`center`}},It=/*#__PURE__*/ Fe({__name:`vue-ui-dumbbell`,props:{config:{type:Object,default(){return{}}},dataset:{type:Array,default(){return[]}}},emits:[`selectDatapoint`,`copyAlt`],setup(e,{expose:Fe,emit:Ze}){let It=h(()=>import(`./BaseIcon-CQFjKDhE.js`).then(e=>e.n)),Lt=h(()=>import(`./vue-ui-accordion-B8LYfVG9.js`).then(e=>e.n)),Rt=h(()=>import(`./DataTable-BHW5xD9B.js`)),zt=h(()=>import(`./PenAndPaper-B2UOwiJM.js`).then(e=>e.t)),Bt=h(()=>import(`./UserOptions-B97cPcKc.js`).then(e=>e.n)),Vt=h(()=>import(`./PackageVersion-B-1JX0wI.js`).then(e=>e.t)),Ht=h(()=>import(`./BaseDraggableDialog-MyWIeEtr.js`).then(e=>e.n)),{vue_ui_dumbbell:Ut}=ye(),Wt=Oe(),E=e,Gt=Ze,Kt=u(()=>!!E.dataset?.length),D=v(se()),qt=v(0),O=v(null),Jt=v(null),Yt=v(null),Xt=v(null),Zt=v(null),Qt=v(0),$t=v(0),en=v(0),tn=v(!1),nn=v(null),rn=v(null),an=v(null),on=v(null),sn=v(null),cn=v(null),k=v(null),A=u(()=>{let e=X.value.findIndex(e=>e.id===k.value);return e<0?null:e}),j=u(()=>A.value==null?null:X.value[A.value]),M=v(null),ln=v(!1),un=u(()=>cr({rowHeight:q.value.rowHeight,fontSize:F.value.yAxisLabels.fontSize,showProgression:F.value.yAxisLabels.showProgression})),N=v(vn()),P=u(()=>N.value.style.chart.grid.horizontalGrid),dn=u(()=>N.value.style.chart.grid.verticalGrid),F=u(()=>N.value.style.chart.labels);u(()=>N.value.style.chart.grid);let I=u(()=>N.value.style.chart.plots),L=u(()=>N.value.style.chart.comparisonLines),R=u(()=>N.value.style.chart);_e({config:()=>N.value,dataset:()=>E.dataset,component:`VueUiDumbbell`,rules:[ve.emptyArray,{test:e=>e.length>31,message:[`👀 The number of series is > 31. Consider:`,``,`▶️ Using filters to let users choose a maximum number of series to display.`,``,`▶️ Using multiple instances of the component to display related series.`]}]});let z=u(()=>N.value.userOptions.useCursorPointer),fn=u(()=>fe({defaultConfig:{userOptions:{show:!1},table:{show:!1},useAnimation:!1,style:{chart:{backgroundColor:`#99999930`,padding:{top:12,right:12,bottom:12,left:12},grid:{horizontalGrid:{stroke:`#6A6A6A`},verticalGrid:{stroke:`#6A6A6A`}},labels:{axis:{yLabel:``,xLabel:``},xAxisLabels:{show:!1},yAxisLabels:{show:!1},endLabels:{show:!1},startLabels:{show:!1}},legend:{backgroundColor:`transparent`},plots:{endColor:`#969696`,startColor:`#DBDBDB`,stroke:`#6A6A6A`,evaluationColors:{enable:!1}}}}},userConfig:N.value.skeletonConfig??{}})),{loading:pn,FINAL_DATASET:mn}=Se({...Ye(E),FINAL_CONFIG:N,prepareConfig:vn,skeletonDataset:E.config?.skeletonDataset??[{name:`_`,start:21,end:34},{name:`_`,start:13,end:21},{name:`_`,start:8,end:13},{name:`_`,start:5,end:8},{name:`_`,start:3,end:5}],skeletonConfig:fe({defaultConfig:N.value,userConfig:fn.value})}),{userOptionsVisible:hn,setUserOptionsVisibility:gn,keepUserOptionState:_n}=Te({config:N.value}),{svgRef:B}=Ee({config:R.value.title});function vn(){return ne(E.config,Ut,Ae)}C(()=>E.config,e=>{pn.value||(N.value=vn()),hn.value=!N.value.userOptions.showOnChartHover,Tn(),Qt.value+=1,$t.value+=1,en.value+=1,V.value.showTable=N.value.table.show},{deep:!0});let yn=Je(null),bn=null,xn=!1,Sn=v(!1),Cn=0;Ke(()=>{tn.value=!0,Tn(),Dn()});let wn=u(()=>N.value.debug);function Tn(){ge(E.dataset)?le({componentName:`VueUiDumbbell`,type:`dataset`,debug:wn.value}):E.dataset.forEach((e,t)=>{he({datasetObject:e,requiredAttributes:[`name`,`start`,`end`]}).forEach(e=>{le({componentName:`VueUiDumbbell`,type:`datasetSerieAttribute`,property:e,index:t,debug:wn.value})})})}function En(){bn=null,cancelAnimationFrame(Cn),yn.value?.disconnect(),yn.value=null}function Dn(){if(En(),!N.value.responsive){G.value=R.value.width,W.value=R.value.rowHeight;return}let e=O.value?.parentNode;if(!e)return;let t=()=>{cancelAnimationFrame(Cn),Cn=requestAnimationFrame(()=>{if(xn)return;let{width:e,height:t}=Ce({chart:O.value,title:R.value.title.text?Jt.value:null,legend:R.value.legend.show?Yt.value:null,source:Xt.value,noTitle:Zt.value}),n=(R.value.title.text?24:0)+(R.value.legend.show?24:0);G.value=Math.max(.1,e),W.value=Math.max(.1,(Math.max(.1,t)-n)/Math.max(1,K.value)),Sn.value=!0})};bn=t,yn.value=new ResizeObserver(t),yn.value.observe(e),t()}Ge(()=>{xn=!0,En(),Gn()});let{isPrinting:On,isImaging:kn,generatePdf:An,generateImage:jn}=xe({elementId:`dumbbell_${D.value}`,fileName:R.value.title.text||`vue-ui-dumbbell`,options:N.value.userOptions.print}),Mn=u(()=>N.value.userOptions.show&&!R.value.title.text),V=v({showTable:N.value.table.show});C(N,()=>{V.value={showTable:N.value.table.show}},{immediate:!0});let H=u(()=>mn.value.map((e,t)=>({...e,start:ue(e.start),end:ue(e.end),id:e.id??`dumbbell_${D.value}_${t}`}))),Nn=u(()=>{let e=R.value.grid,t=H.value.flatMap(e=>[e.start,e.end]).map(e=>Number(e)).filter(e=>Number.isFinite(e)),n=t.length?Math.min(...t):0,r=t.length?Math.max(...t):0;return{min:e.scaleMin??Math.min(n,0),max:e.scaleMax??r}}),U=u(()=>ce(Nn.value.min,Nn.value.max,R.value.grid.scaleSteps)),W=v(R.value.rowHeight),G=v(R.value.width),{metrics:Pn,ready:Fn,settling:In,update:Ln}=be({svgRef:B,canMeasure:()=>!N.value.responsive||Sn.value,initialMetrics:{scaleLabelsWidth:0,yAxisLabelWidth:0,xAxisLabelHeight:0,timeLabelsHeight:0},measure:e=>({scaleLabelsWidth:e(on.value).textWidth,yAxisLabelWidth:e(an.value).rotatedWidth,xAxisLabelHeight:e(cn.value).height,timeLabelsHeight:e(sn.value).height})});function Rn(){let e=Pn.value.scaleLabelsWidth,t=Pn.value.yAxisLabelWidth;return e+t+(t?24+F.value.axis.yLabelOffsetX:0)}let zn=u(()=>Pn.value.xAxisLabelHeight+Pn.value.timeLabelsHeight),K=u(()=>H.value.length);function Bn(e,t,n){let r=Number(e),i=Number(t.min),a=Number(t.max),o=Number(n.width);if(!Number.isFinite(r)||!Number.isFinite(i)||!Number.isFinite(a)||!Number.isFinite(o))return n.left;let s=a-i;return s<=0?n.left:n.left+(r-i)/s*o}let q=u(()=>{let e=Rn(),t=R.value.padding,n=F.value.axis.xLabel?F.value.axis.xLabelOffsetY:0,r=W.value*K.value-zn.value-t.top-t.bottom-n,i=K.value?r/K.value:0,a=W.value*K.value,o=G.value-e-t.left-t.right,s=o;return{left:R.value.padding.left+e,right:G.value-R.value.padding.right,top:R.value.padding.top,bottom:a-R.value.padding.bottom-zn.value-n,width:o,height:r,rowHeight:i,absoluteHeight:a,widthPlotReference:s}}),J=u(()=>Math.min(W.value/2*.7,I.value.radius));function Vn(e){let t=Number(e.start);return Number.isFinite(t)?t:0}function Hn(e){let t=Number(e.end);return Number.isFinite(t)?t:Vn(e)}let Y=v([]),X=u(()=>{let e=q.value,t=U.value;return H.value.map((n,r)=>{let i=Bn(n.start,t,e),a=Bn(Y.value[r]??Hn(n),t,e),o=i+(a-i)/2,s=![null,void 0].includes(n.start)&&![null,void 0].includes(n.end)&&n.end>n.start,ee=![null,void 0].includes(n.start)&&![null,void 0].includes(n.end)&&n.end<n.start,te=![null,void 0].includes(n.start)&&![null,void 0].includes(n.end)&&n.end===n.start||[null,void 0].includes(n.start)||[null,void 0].includes(n.end),ne=s?I.value.evaluationColors.positive:ee?I.value.evaluationColors.negative:I.value.evaluationColors.neutral;return{...n,endVal:Y.value[r]??Hn(n),isPositive:s,isNegative:ee,isNeutral:te,evaluationColor:ne,evaluationGrad:`url(#${s?`positive`:ee?`negative`:`neutral`}_grad_${D.value})`,startX:i,endX:a,centerX:o,y:e.top+r*e.rowHeight+e.rowHeight/2}})}),Un=null,Wn=0;function Gn(){Wn++,Un!==null&&cancelAnimationFrame(Un),Un=null}function Kn(){Gn();let e=H.value,t=e.map(Hn);if(xn||!N.value.useAnimation||Wt.value){Y.value=t;return}Y.value=e.map(Vn);let n=Math.max(1,Math.min(100,Number(N.value.animationSpeed)||100))/100,r=t.map((e,t)=>e-Y.value[t]),i=Wn;function a(){if(xn||i!==Wn)return;let e=!0;Y.value=Y.value.map((i,a)=>{let o=i+r[a]*n,s=r[a]>=0?Math.min(o,t[a]):Math.max(o,t[a]);return s!==t[a]&&(e=!1),s}),Un=e?null:requestAnimationFrame(a)}e.length&&(Un=requestAnimationFrame(a))}let qn=u(()=>[{key:`start`,color:I.value.startColor,name:R.value.legend.labelStart},{key:`end`,color:I.value.endColor,name:R.value.legend.labelEnd},...[`negative`,`neutral`,`positive`].map(e=>({key:e,color:I.value.evaluationColors[e],name:R.value.legend[`label${e[0].toUpperCase()+e.slice(1)}`]}))]),Jn=u(()=>qn.value.filter(e=>I.value.evaluationColors.enable?![`start`,`end`].includes(e.key):[`start`,`end`].includes(e.key)).map(e=>({name:e.name,color:I.value.gradient.show?`url(#${e.key}_grad_${D.value})`:e.color}))),Yn=u(()=>({cy:`donut-div-legend`,backgroundColor:R.value.legend.backgroundColor,color:R.value.legend.color,fontSize:R.value.legend.fontSize,paddingBottom:12,paddingTop:12,fontWeight:R.value.legend.bold?`bold`:``}));function Xn(e){if(e.start==null||e.end==null||Number(e.start)===0)return null;let t=100*(Number(e.end)/Number(e.start)-1);return Number.isFinite(t)?t:null}function Zn(e){let t=Xn(e);return t==null?``:de(F.value.yAxisLabels.formatter,t,c({v:t,s:`%`,r:F.value.yAxisLabels.rounding}),{datapoint:e})}function Qn(e,t,n){return de(F.value.formatter,e,c({p:F.value.prefix,v:e,s:F.value.suffix,r:t}),n)}let Z=u(()=>({head:X.value.map(e=>({name:e.name})),body:X.value.map(e=>({start:e.start,end:e.end}))})),Q=u(()=>{let e=[N.value.table.columnNames.series,N.value.table.columnNames.start,N.value.table.columnNames.end,N.value.table.columnNames.progression];return{colNames:e,head:e,body:Z.value.head.map((e,t)=>{let n=c({p:F.value.prefix,v:Z.value.body[t].start,s:F.value.suffix,r:N.value.table.td.roundingValue}),r=c({p:F.value.prefix,v:Z.value.body[t].end,s:F.value.suffix,r:N.value.table.td.roundingValue}),i=Xn(Z.value.body[t]),a=i==null?`-`:c({v:i,s:`%`,r:N.value.table.td.roundingPercentage});return[{name:e.name},n,r,a]}),config:{th:{backgroundColor:N.value.table.th.backgroundColor,color:N.value.table.th.color,outline:N.value.table.th.outline},td:{backgroundColor:N.value.table.td.backgroundColor,color:N.value.table.td.color,outline:N.value.table.td.outline},breakpoint:N.value.table.responsiveBreakpoint}}});function $n(e=null){He(()=>{let t=Z.value.head.map((e,t)=>[[e.name],[Z.value.body[t].start],[Z.value.body[t].end]]),n=[[R.value.title.text],[R.value.title.subtitle.text],[[N.value.table.columnNames.series],[N.value.table.columnNames.start],[N.value.table.columnNames.end]]].concat(t),r=re(n);e?e(r):pe({csvContent:r,title:R.value.title.text||`vue-ui-dumbbell`})})}let $=v(!1);function er(e){$.value=e,qt.value+=1}function tr(){return H.value}function nr(){V.value.showTable=!V.value.showTable}let rr=v(!1);function ir(){rr.value=!rr.value}let ar=te(O,()=>R.value.title.text),or=u(()=>U.value.ticks),sr=u(()=>({start:0,end:or.value.length}));De({timeLabelsEls:sn,timeLabels:or,slicer:sr,configRef:N,rotationPath:[`style`,`chart`,`labels`,`xAxisLabels`,`rotation`],autoRotatePath:[`style`,`chart`,`labels`,`xAxisLabels`,`autoRotate`,`enable`],isAutoSize:!1,width:G,height:W,targetClass:`.vue-ui-dumbbell-scale-label`,rotation:F.value.xAxisLabels.autoRotate.angle});function cr({rowHeight:e,fontSize:t,showProgression:n}){if(!n)return!1;let r=e/3,i=e/1.3;return Math.abs(i-r)<t*1.2}function lr({datapoint:e,seriesIndex:t}){k.value=e.id,N.value.events.datapointEnter&&N.value.events.datapointEnter({datapoint:e,seriesIndex:t})}function ur({datapoint:e,seriesIndex:t}){k.value=null,N.value.events.datapointLeave&&N.value.events.datapointLeave({datapoint:e,seriesIndex:t})}function dr({datapoint:e,seriesIndex:t}){N.value.events.datapointClick&&N.value.events.datapointClick({datapoint:e,seriesIndex:t}),Gt(`selectDatapoint`,{...e,seriesIndex:t})}let fr=u(()=>{let e=j.value;if(!e)return 0;let t=[e.start==null?null:e.startX,e.end==null?null:e.endX].filter(e=>e!=null);return t.length?t.reduce((e,t)=>e+t,0)/t.length:null}),pr=u(()=>{let e=j.value;if(!e)return``;let t={datapoint:e,seriesIndex:A.value};return[`start`,`end`].filter(t=>e[t]!=null).map(n=>Qn(e[n],F.value[`${n}Labels`].rounding,t)).join(` → `)}),mr=u(()=>ee({config:N,style:R,mutableConfig:V,dialog:Ht,accordion:Lt,isFullscreen:$,parent:O,maxWidth:800,isCursorPointer:z}));C(()=>V.value.showTable,e=>s(e,N,nn));function hr(){V.value.showTable=!1,rn.value&&rn.value.setTableIconState(!1)}let gr=u(()=>Jn.value.map(e=>({...e,shape:`circle`}))),_r=u(()=>R.value.backgroundColor),vr=u(()=>R.value.legend),yr=u(()=>R.value.title),{isCallbackImaging:br,isCallbackSvg:xr,generateSvg:Sr,onGenerateImage:Cr}=we({svg:B,title:yr,legend:vr,legendItems:gr,backgroundColor:_r,getSvgCallback:()=>N.value.userOptions.callbacks.svg,generateImage:jn});async function wr(){Gt(`copyAlt`,{config:N.value,dataset:X.value}),N.value.userOptions.callbacks.altCopy?await Promise.resolve(N.value.userOptions.callbacks.altCopy({config:N.value,dataset:X.value})):console.warn("Vue Data UI - A callback must be set for `altCopy` in userOptions.")}function Tr(e){let t=X.value.length;return t?(e%t+t)%t:null}function Er(){if(M.value!==null){let e=X.value[M.value];e&&ur({datapoint:e,seriesIndex:M.value})}M.value=null,k.value=null}function Dr(){M.value=null,ln.value=!0}function Or(){Er(),ln.value=!1}function kr(e){if(!B.value||rr.value||document.activeElement!==B.value||!X.value.length)return;let t=[`ArrowUp`,`ArrowLeft`].includes(e.key),n=[`ArrowDown`,`ArrowRight`].includes(e.key),r=e.key===`Enter`||e.key===` `,i=e.key===`Escape`;if(!t&&!n&&!r&&!i)return;if(e.preventDefault(),e.stopPropagation(),i){Er();return}if(r){if(M.value===null)return;let e=X.value[M.value];if(!e)return;dr({datapoint:e,seriesIndex:M.value});return}let a=M.value;a=a===null?n?0:X.value.length-1:Tr(a+(n?1:-1));let o=X.value[a];o&&(M.value=a,lr({datapoint:o,seriesIndex:a}))}let Ar=u(()=>({head:Q.value.head,body:Q.value.body.map(e=>[e[0]?.name??``,e[1],e[2],e[3]]),caption:N.value.a11y.translations.tableCaption,notice:N.value.a11y.translations.tableAvailable}));return C([H,()=>N.value.useAnimation,()=>N.value.animationSpeed,Wt],Kn,{immediate:!0}),C(()=>E.dataset,Tn,{deep:!0}),C([()=>N.value.responsive,()=>R.value.width,()=>R.value.rowHeight],Dn,{flush:`post`}),C([R,K],()=>bn?.(),{flush:`post`}),C(X,e=>{k.value!=null&&!e.some(e=>e.id===k.value)?(k.value=null,M.value=null):M.value!=null&&(M.value=A.value)}),Fe({getData:tr,getImage:ar,generatePdf:An,generateCsv:$n,generateImage:jn,generateSvg:Sr,toggleTable:nr,toggleAnnotator:ir,toggleFullscreen:er,copyAlt:wr}),C(()=>[G.value,W.value,un.value,F.value,R.value,N.value.style.fontFamily,E.dataset,Sn.value,on.value,sn.value,cn.value,an.value],Ln,{flush:`post`,deep:!0}),(e,s)=>(_(),p(`div`,{ref_key:`dumbbellChart`,ref:O,class:Ue(`vue-data-ui-component vue-ui-dumbbell ${$.value?`vue-data-ui-wrapper-fullscreen`:``}`),style:g(`font-family:${N.value.style.fontFamily};width:100%; text-align:center;background:${R.value.backgroundColor};${N.value.responsive?`height:100%`:``}`),id:`dumbbell_${D.value}`,onMouseenter:s[1]||=()=>S(gn)(!0),onMouseleave:s[2]||=()=>S(gn)(!1)},[m(`div`,{id:`chart-instructions-${D.value}`,class:`sr-only`},[m(`p`,null,x(N.value.a11y.translations.keyboardNavigation),1)],8,$e),N.value.a11y.includeTable&&Ar.value.body.length?(_(),d(Ne,{key:0,uid:D.value,head:Ar.value.head,body:Ar.value.body,caption:Ar.value.caption,notice:Ar.value.notice},null,8,[`uid`,`head`,`body`,`caption`,`notice`])):f(``,!0),N.value.userOptions.buttons.annotator?(_(),d(S(zt),Ve({key:1},S(a)(N.value.userOptions.annotator),{svgRef:S(B),backgroundColor:R.value.backgroundColor,color:R.value.color,active:rr.value,isCursorPointer:z.value,palette:N.value.userOptions.annotatorPalette,onClose:ir}),Le({_:2},[y(S(o),t=>({name:t,fn:w(n=>[b(e.$slots,t,We(Be(S(i)(t,n))),void 0,!0)])}))]),1040,[`svgRef`,`backgroundColor`,`color`,`active`,`isCursorPointer`,`palette`])):f(``,!0),Mn.value?(_(),p(`div`,{key:2,ref_key:`noTitle`,ref:Zt,class:`vue-data-ui-no-title-space`,style:`height:36px; width: 100%;background:transparent`},null,512)):f(``,!0),R.value.title.text?(_(),p(`div`,{key:3,ref_key:`chartTitle`,ref:Jt,style:`width:100%;background:transparent;padding-bottom:24px`},[(_(),d(ke,{key:`title_${Qt.value}`,config:{title:{cy:`donut-div-title`,...R.value.title},subtitle:{cy:`donut-div-subtitle`,...R.value.title.subtitle}}},null,8,[`config`]))],512)):f(``,!0),m(`div`,{id:`legend-top-${D.value}`},null,8,et),N.value.userOptions.show&&Kt.value&&(S(_n)||S(hn))?(_(),d(S(Bt),Ve({ref_key:`userOptionsRef`,ref:rn,key:`user_option_${qt.value}`,backgroundColor:R.value.backgroundColor,color:R.value.color,isPrinting:S(On),isImaging:S(kn),uid:D.value,isFullscreen:$.value,chartElement:O.value},S(n)(N.value.userOptions,`pdf csv img svg table fullscreen altCopy annotator`),{isAnnotation:rr.value,tableDialog:N.value.table.useDialog,isCursorPointer:z.value,onToggleFullscreen:er,onGeneratePdf:S(An),onGenerateCsv:$n,onGenerateImage:S(Cr),onGenerateSvg:S(Sr),onToggleTable:nr,onToggleAnnotator:ir,onCopyAlt:wr,style:{visibility:S(_n)?S(hn)?`visible`:`hidden`:`visible`}}),Le({_:2},[y(S(t)(e.$slots,`menuIcon optionPdf optionCsv optionImg optionSvg optionTable optionFullscreen optionAnnotator optionAltCopy custom-menu-before custom-menu-after`),t=>({name:t,fn:w(n=>[b(e.$slots,t,We(Be(S(r)(t,n))),void 0,!0)])}))]),1040,[`backgroundColor`,`color`,`isPrinting`,`isImaging`,`uid`,`isFullscreen`,`chartElement`,`isAnnotation`,`tableDialog`,`isCursorPointer`,`onGeneratePdf`,`onGenerateImage`,`onGenerateSvg`,`style`])):f(``,!0),m(`div`,tt,[(_(),p(`svg`,{ref_key:`svgRef`,ref:B,xmlns:S(me),class:Ue({"vue-data-ui-fullscreen--on":$.value,"vue-data-ui-fulscreen--off":!$.value}),viewBox:`0 0 ${G.value} ${q.value.absoluteHeight<=0?10:q.value.absoluteHeight}`,style:g(`max-width:100%; overflow: visible; background:transparent;color:${R.value.color};visibility:${S(Fn)?`visible`:`hidden`}`),"aria-describedby":`chart-instructions-${D.value}`,tabindex:`0`,onFocus:Dr,onBlur:Or,onKeydown:kr},[ze(S(Vt)),b(e.$slots,`svg-underlayer`,{svg:{...q.value,isPrintingImg:S(On)||S(kn)||S(br),isPrintingSvg:S(xr)}},void 0,!0),e.$slots[`chart-background`]?(_(),p(`foreignObject`,{key:0,x:q.value.left,y:q.value.top,width:Math.max(.1,q.value.width),height:Math.max(.1,q.value.height),style:{pointerEvents:`none`}},[b(e.$slots,`chart-background`,{},void 0,!0)],8,rt)):f(``,!0),dn.value.show?(_(),p(`g`,it,[(_(!0),p(l,null,y(U.value.ticks,(e,t)=>(_(),p(`line`,{x1:q.value.left+t*q.value.width/(U.value.ticks.length-1),x2:q.value.left+t*q.value.width/(U.value.ticks.length-1),y1:q.value.top,y2:q.value.bottom,stroke:dn.value.stroke,"stroke-width":dn.value.strokeWidth,"stroke-dasharray":dn.value.strokeDasharray},null,8,at))),256))])):f(``,!0),P.value.show?(_(),p(`g`,ot,[(_(!0),p(l,null,y(H.value,(e,t)=>(_(),p(`line`,{x1:q.value.left,x2:q.value.right,y1:q.value.top+t*q.value.rowHeight,y2:q.value.top+t*q.value.rowHeight,stroke:P.value.stroke,"stroke-width":P.value.strokeWidth,"stroke-dasharray":P.value.strokeDasharray},null,8,st))),256)),m(`line`,{x1:q.value.left,x2:q.value.right,y1:q.value.bottom,y2:q.value.bottom,stroke:P.value.stroke,"stroke-width":P.value.strokeWidth,"stroke-dasharray":P.value.strokeDasharray},null,8,ct)])):f(``,!0),F.value.axis.yLabel?(_(),p(`text`,{key:3,ref_key:`yAxisLabel`,ref:an,transform:`translate(${F.value.axis.fontSize}, ${q.value.absoluteHeight/2}), rotate(-90)`,"font-size":F.value.axis.fontSize,fill:F.value.axis.color,"text-anchor":`middle`},x(F.value.axis.yLabel),9,lt)):f(``,!0),F.value.yAxisLabels.show?(_(),p(`g`,{key:4,ref_key:`serieLabels`,ref:on},[(_(!0),p(l,null,y(X.value,(e,t)=>(_(),p(`text`,{class:`vue-ui-dumbbell-serie-name`,key:`serieLabel_${e.id}_${t}`,x:q.value.left-6+F.value.yAxisLabels.offsetX,y:q.value.top+t*q.value.rowHeight+(!F.value.yAxisLabels.showProgression||un.value?q.value.rowHeight/2:q.value.rowHeight/3)+F.value.yAxisLabels.fontSize/3,"font-size":F.value.yAxisLabels.fontSize,fill:F.value.yAxisLabels.color,"font-weight":F.value.yAxisLabels.bold?`bold`:`normal`,"text-anchor":`end`,onMouseenter:n=>lr({datapoint:e,seriesIndex:t}),onMouseleave:n=>ur({datapoint:e,seriesIndex:t}),onClick:n=>dr({datapoint:e,seriesIndex:t})},x(e.name)+` `+x(un.value&&F.value.yAxisLabels.showProgression&&Xn(e)!=null?`(${Zn(e)})`:``),41,ut))),128)),F.value.yAxisLabels.showProgression&&!un.value?(_(!0),p(l,{key:0},y(X.value,(e,t)=>(_(),p(`text`,{class:`vue-ui-dumbbell-serie-value`,x:q.value.left-6+F.value.yAxisLabels.offsetX,y:q.value.top+t*q.value.rowHeight+q.value.rowHeight/1.3+F.value.yAxisLabels.fontSize/3,"font-size":F.value.yAxisLabels.fontSize,fill:F.value.yAxisLabels.color,"text-anchor":`end`,onMouseenter:n=>lr({datapoint:e,seriesIndex:t}),onMouseleave:n=>ur({datapoint:e,seriesIndex:t}),onClick:n=>dr({datapoint:e,seriesIndex:t})},x(Zn(e)),41,dt))),256)):f(``,!0)],512)):f(``,!0),F.value.axis.xLabel?(_(),p(`text`,{key:5,ref_key:`xAxisLabel`,ref:cn,x:q.value.left+q.value.width/2,y:q.value.absoluteHeight-F.value.axis.fontSize/3,"font-size":F.value.axis.fontSize,fill:F.value.axis.color,"text-anchor":`middle`},x(F.value.axis.xLabel),9,ft)):f(``,!0),F.value.xAxisLabels.show?(_(),p(`g`,{key:6,ref_key:`scaleLabels`,ref:sn},[(_(!0),p(l,null,y(U.value.ticks,(e,t)=>(_(),p(`text`,{class:`vue-ui-dumbbell-scale-label`,key:`tick_${t}`,transform:`translate(${q.value.left+t*(q.value.width/(U.value.ticks.length-1))}, ${q.value.bottom+F.value.xAxisLabels.fontSize+F.value.xAxisLabels.offsetY}), rotate(${F.value.xAxisLabels.rotation})`,"font-size":F.value.xAxisLabels.fontSize,fill:F.value.xAxisLabels.color,"font-weight":F.value.xAxisLabels.bold?`bold`:`normal`,"text-anchor":F.value.xAxisLabels.rotation>0?`start`:F.value.xAxisLabels.rotation<0?`end`:`middle`},x(S(de)(F.value.formatter,e,S(c)({p:F.value.prefix,v:e,s:F.value.suffix,r:F.value.xAxisLabels.rounding}),{datapoint:e,seriesIndex:t})),9,pt))),128))],512)):f(``,!0),T(m(`g`,null,[T(m(`path`,{d:`M ${j.value?j.value.startX:q.value.left},${q.value.top} ${j.value?j.value.startX:q.value.left},${q.value.bottom}`,stroke:j.value?I.value.evaluationColors.enable?j.value.evaluationColor:I.value.startColor:`transparent`,"stroke-width":L.value.strokeWidth,"stroke-dasharray":L.value.strokeDasharray,style:g({transition:S(In)?`none`:`all 0.3s ease-in-out`})},null,12,mt),[[Xe,j.value!==null&&![null,void 0].includes(j.value.start)]]),T(m(`path`,{d:`M ${j.value?j.value.endX:q.value.left},${q.value.top} ${j.value?j.value.endX:q.value.left},${q.value.bottom}`,stroke:j.value?I.value.evaluationColors.enable?j.value.evaluationColor:I.value.endColor:`transparent`,"stroke-width":L.value.strokeWidth,"stroke-dasharray":L.value.strokeDasharray,style:g({transition:S(In)?`none`:`all 0.3s ease-in-out`})},null,12,ht),[[Xe,j.value!==null&&![null,void 0].includes(j.value.end)]]),T(m(`rect`,{x:j.value?Math.min(j.value.startX,j.value.endX):q.value.left,y:q.value.top,height:Math.max(.1,q.value.height),width:j.value?Math.max(.1,Math.abs(j.value.endX-j.value.startX)):0,fill:j.value?S(ae)(L.value.rectColor,L.value.rectOpacity):`transparent`,style:g({transition:S(In)?`none`:`all 0.3s ease-in-out`})},null,12,gt),[[Xe,L.value.showRect&&j.value!==null&&![null,void 0].includes(j.value.start)&&![null,void 0].includes(j.value.end)]]),T(m(`text`,{transform:`translate(${fr.value==null?0:fr.value}, ${q.value.top-6})`,fill:L.value.labelColor,"font-size":L.value.labelFontSize,"text-anchor":`middle`,style:g({transition:S(In)?`none`:`all 0.3s ease-in-out`})},x(pr.value),13,_t),[[Xe,j.value!==null&&fr.value!==null&&L.value.showLabel]])],512),[[Xe,L.value.show&&A.value!==null]]),m(`defs`,null,[(_(!0),p(l,null,y(qn.value,e=>(_(),d(Pe,{key:e.key,t:`radial`,id:`${e.key}_grad_${D.value}`,fy:`30%`,stops:[[`10%`,S(ie)(e.color,I.value.gradient.intensity/100),1],[`90%`,S(oe)(e.color,.1),1],[`100%`,e.color,1]]},null,8,[`id`,`stops`]))),128)),(_(),p(l,null,y([`pos`,`neg`],e=>ze(Pe,{key:e,t:`linear`,id:`grad_${e}_${D.value}`,x1:`0%`,x2:`100%`,y1:`0%`,y2:`0%`,stops:[[`0%`,e===`pos`?I.value.startColor:I.value.endColor,1],[`100%`,e===`pos`?I.value.endColor:I.value.startColor,1]]},null,8,[`id`,`stops`])),64))]),(_(!0),p(l,null,y(X.value,(e,t)=>(_(),p(`g`,{key:`plot_${t}_${e.id}`},[![void 0,null].includes(e.end)&&![void 0,null].includes(e.start)?(_(),p(`g`,vt,[I.value.link.type===`curved`?(_(),p(`g`,yt,[m(`path`,{d:`M
2
2
  ${e.startX},${e.y+J.value/2}
3
3
  C ${e.centerX},${e.y} ${e.centerX},${e.y}
4
4
  ${e.endX},${e.y+J.value/2}
@@ -1,3 +1,3 @@
1
- import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{n as t,r as n,t as r}from"./userOptionsSlots-CWtXN5Q6.js";import{n as i,r as a,t as o}from"./annotationSlots-OLiW25XN.js";import{n as s,t as c}from"./tableIntegration-CNoJ1CIY.js";import{t as l}from"./chartImage-DPGnEuYM.js";import{$ as u,D as d,Dt as f,Ht as p,S as m,X as ee,Zt as h,b as g,i as te,in as ne,n as re,nt as ie,r as ae,t as oe,w as se}from"./lib-rPeBMZrn.js";import{n as ce,t as le}from"./useHints-C-TwxM0Y.js";import{t as ue}from"./useConfig-CXhXxWjB.js";import{t as de}from"./usePrinter-DVf3YcG5.js";import{t as _}from"./useLoading-DoqqfnmS.js";import{t as v}from"./useChartExport-BZts4KFb.js";import{n as fe}from"./resolveChartConfig-0IvbmIE_.js";import{t as pe}from"./useResponsive-CENUxfEL.js";import{t as me}from"./useUserOptionState-CXlFnwPv.js";import{t as he}from"./useChartAccessibility-DOMuYJfm.js";import{n as ge}from"./Title-BliHuXfT.js";import{t as _e}from"./vue_ui_flow-N2kD68UX.js";import{t as ve}from"./Legend-W9YVYVX-.js";import{t as ye}from"./BaseScanner-m6QR9rwD.js";import{t as be}from"./A11yDataTable-DWNlWXzs.js";import{t as xe}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{Fragment as Se,Teleport as Ce,computed as y,createBlock as b,createCommentVNode as x,createElementBlock as S,createElementVNode as C,createSlots as we,createTextVNode as Te,createVNode as Ee,defineAsyncComponent as w,guardReactiveProps as T,mergeProps as De,nextTick as Oe,normalizeClass as ke,normalizeProps as E,normalizeStyle as D,onBeforeUnmount as Ae,onMounted as je,openBlock as O,ref as k,renderList as A,renderSlot as j,resolveDynamicComponent as Me,shallowRef as Ne,toDisplayString as M,toRefs as Pe,unref as N,watch as P,withCtx as F}from"vue";var Fe=/* @__PURE__ */ e({default:()=>nt}),Ie=[`id`],Le=[`id`],Re={key:2,ref:`noTitle`,class:`vue-data-ui-no-title-space`,style:`height:36px; width: 100%;background:transparent`},ze=[`id`],Be={style:{position:`relative`}},Ve=[`xmlns`,`aria-describedby`,`viewBox`],He=[`width`,`height`],Ue=[`id`],We=[`stop-color`],Ge=[`stop-color`],Ke=[`d`,`fill`,`stroke`,`stroke-width`],qe=[`data-a11y-node-id`,`x`,`y`,`height`,`width`,`fill`,`stroke`,`stroke-width`,`rx`,`aria-label`,`onMouseenter`,`onMouseleave`,`onClick`],Je={key:1},Ye=[`x`,`y`,`font-size`,`fill`],Xe=[`x`,`y`,`font-size`,`fill`],Ze={key:0,style:{position:`absolute`,top:`100%`,left:`0`,width:`100%`},"data-dom-to-png-ignore":``,"aria-hidden":`true`},Qe={key:5,class:`vue-data-ui-watermark`},$e=[`id`],et=[`onClick`],tt={style:{display:`flex`,"align-items":`center`}},nt=/*#__PURE__*/ xe({__name:`vue-ui-flow`,props:{config:{type:Object,default(){return{}}},dataset:{type:Array,default(){return[]}}},emits:[`copyAlt`],setup(e,{expose:xe,emit:Fe}){let nt=w(()=>import(`./Tooltip-B432XpvC.js`)),rt=w(()=>import(`./BaseIcon-CoY0vuL3.js`).then(e=>e.n)),it=w(()=>import(`./vue-ui-accordion-D3uT1Ynv.js`).then(e=>e.n)),at=w(()=>import(`./DataTable-KeuZB1JM.js`)),ot=w(()=>import(`./PenAndPaper-BV5ODysA.js`).then(e=>e.t)),st=w(()=>import(`./UserOptions-K1N7zQRx.js`).then(e=>e.n)),ct=w(()=>import(`./PackageVersion-C1vtZkKc.js`).then(e=>e.t)),lt=w(()=>import(`./BaseDraggableDialog-DVstuNhT.js`).then(e=>e.n)),{vue_ui_flow:ut}=ue(),I=e,dt=Fe,L=k(ee()),R=k(null),ft=k(0),pt=k(0),mt=k(!1),ht=k(``),gt=k(null),_t=k(null),vt=k(null),yt=Ne(null),z=null,bt=null,xt=!1,St=k(!1),Ct=k(null),wt=k(null),Tt=y(()=>Z.value==null?null:Sn.value.get(Z.value)??null),Et=y(()=>Z.value),Dt=k({x:0,y:0}),Ot=k(`pointer`),kt=k(!1),At=y(()=>!!I.dataset&&I.dataset.length);je(()=>{St.value=!0,Lt()});let B=k(!1);function jt(e){B.value=e,ft.value+=1}let V=k(Vt()),H=y(()=>V.value.style.chart.nodes.labels),U=y(()=>V.value.style.chart.nodes),Mt=y(()=>V.value.style.chart.links),W=y(()=>V.value.style.chart);ce({config:()=>V.value,dataset:()=>I.dataset,component:`VueUiFlow`,rules:[le.emptyArray,le.noHint]});let G=y(()=>V.value.userOptions.useCursorPointer),Nt=y(()=>ne({defaultConfig:{userOptions:{show:!1},nodeCategories:{B:`A`,C:`B`},nodeCategoryColors:{A:`#CACACA`,B:`#AAAAAA`},table:{show:!1},style:{chart:{backgroundColor:`#99999930`,legend:{backgroundColor:`transparent`},nodes:{labels:{show:!1},stroke:`#666666`},links:{stroke:`#666666`}}}},userConfig:V.value.skeletonConfig??{}})),{loading:Pt,FINAL_DATASET:Ft}=_({...Pe(I),FINAL_CONFIG:V,prepareConfig:Vt,skeletonDataset:I.config?.skeletonDataset??[[`A`,`B`,2,`#CACACA`],[`B`,`C`,1,`#CACACA`],[`C`,`D`,.5,`#CACACA`],[`E`,`F`,1,`#AAAAAA`],[`F`,`G`,.5,`#AAAAAA`],[`G`,`H`,.25,`#AAAAAA`]],skeletonConfig:ne({defaultConfig:V.value,userConfig:Nt.value})});function It(){bt=null,yt.value?.disconnect(),yt.value=null,z!==null&&cancelAnimationFrame(z),z=null}function Lt(){if(It(),!V.value.responsive){Ht.value=W.value.width,Ut.value=W.value.height;return}let e=R.value?.parentNode;if(!e)return;let t=()=>{z!==null&&cancelAnimationFrame(z),z=requestAnimationFrame(()=>{if(z=null,xt)return;let{width:e,height:t}=pe({chart:R.value,title:W.value.title.text?_t.value:null,legend:W.value.legend.show?gt.value:null,source:vt.value});Ht.value=e,Ut.value=t})};bt=t,yt.value=new ResizeObserver(t),yt.value.observe(e),t()}Ae(()=>{xt=!0,It()});let{userOptionsVisible:Rt,setUserOptionsVisibility:zt,keepUserOptionState:Bt}=me({config:V.value}),{svgRef:K}=he({config:W.value.title});function Vt(){return{...fe(I.config,ut,_e),nodeCategories:I.config.nodeCategories||{},nodeCategoryColors:I.config.nodeCategoryColors||{}}}let Ht=k(W.value.width),Ut=k(W.value.height),Wt=h(I.config);P(()=>I.config,(e,t)=>{let n=h(e),r=n!==Wt;Wt=n;let i=Vt();r?(Pt.value||(V.value=i),Rt.value=!V.value.userOptions.showOnChartHover,pt.value+=1,q.value.showTable=V.value.table.show):(V.value.style.chart.tooltip=i.style.chart.tooltip,q.value.showTooltip=V.value.style.chart.tooltip.show)},{deep:!0});let{isPrinting:Gt,isImaging:Kt,generatePdf:qt,generateImage:Jt}=de({elementId:`flow_${L.value}`,fileName:W.value.title.text||`vue-ui-flow`,options:V.value.userOptions.print}),Yt=y(()=>V.value.userOptions.show&&!W.value.title.text),Xt=y(()=>se(V.value.customPalette));function Zt(e,t){return te(H.value.formatter,e,u({p:H.value.prefix,v:e,s:H.value.suffix,r:H.value.rounding}),t)}let Qt=y(()=>U.value.width),q=k({showTable:V.value.table.show,showTooltip:W.value.tooltip.show});P(V,()=>{q.value={showTable:V.value.table.show,showTooltip:W.value.tooltip.show}},{immediate:!0});function $t(e){let t=V.value.nodeCategories;return Object.hasOwn(t,e)?t[e]:void 0}function en(e){let t=V.value.nodeCategoryColors;return Object.hasOwn(t,e)?t[e]:void 0}let tn=y(()=>(Ft.value||[]).map(([e,t,n,r])=>[e,t,typeof n==`number`&&Number.isFinite(n)?Math.max(0,n):0,r?m(r):null]));function nn(e){return Array.from(String(e),e=>e.codePointAt(0).toString(16)).join(`_`)}let rn=y(()=>{let e=/* @__PURE__ */ new Map,t=/* @__PURE__ */ new Map;function n(t){return e.has(t)||e.set(t,{name:t,level:0,inflow:0,outflow:0,children:[],parents:[],color:null}),e.get(t)}let r=/* @__PURE__ */ new Map;tn.value.forEach(([e,i,a,o])=>{let s=n(e),c=n(i),l=JSON.stringify([e,i]),u=r.get(l)||0;r.set(l,u+1),s.children.push({target:i,value:a,id:`flow_link_${L.value}_${nn(l)}_${u}`}),c.parents.push({source:e,value:a}),s.outflow+=a,c.inflow+=a,o&&(t.set(e,o),t.set(i,o))});let i=[...e.values()].filter(e=>!e.parents.length),a=new Map([...e].map(([e,t])=>[e,t.parents.length])),o=i.map(e=>e.name);for(let t=0;t<o.length;t++){let n=e.get(o[t]);for(let{target:t}of n.children){let r=e.get(t);r.level=Math.max(r.level,n.level+1),a.set(t,a.get(t)-1),a.get(t)||o.push(t)}}for(let[t,n]of a)n>0&&(e.get(t).level=0);let s=new Map(i.map((e,t)=>[e.name,Xt.value[t]||p[t%p.length]])),c=Object.create(null),l=0;for(let[n,r]of e){let e=$t(n);r.color=t.get(n)||(e?en(e):null)||s.get(n)||p[l%p.length],l++,r.value=Math.max(r.inflow,r.outflow),(c[r.level]||=[]).push(n)}return{nodes:e,levels:c,totalRootFlow:i.reduce((e,t)=>e+t.outflow,0)}});function an(){let{nodes:e,levels:t}=rn.value,n=on.value,r=sn.value.width,i=sn.value.height,a=Object.keys(t).map(Number).sort((e,t)=>e-t),o=a.length||1,s=o>1?r/(o-1):0,c=Number(Qt.value),l=Number(U.value.gapPx??U.value.gap??8),u=Number(U.value.minHeight||0);function d(n){let r=t[n],a=r.length;if(!a)return 1/0;let o=Math.max(0,(a-1)*l),s=Math.max(0,i-o),c=Math.min(u,a?s/a:0),d=0,f=r.map(t=>e.get(t).value||0),p=f.reduce((e,t)=>e+t,0);for(let e=0;e<12;e+=1){let e=p>0?(s-d)/p:0,t=[];for(let n=0;n<f.length;n+=1){let r=f[n];r<0||r*e<c&&t.push(n)}if(!t.length)return Math.max(0,e);for(let e of t)d+=c,p-=f[e],f[e]=-1;if(p<=0)return 0}return p>0?Math.max(0,(s-d)/p):0}let f=a.map(d),p=f.length?Math.min(...f):0,m=Object.create(null);a.forEach(r=>{let a=t[r],o=a.length,c=Math.max(0,(o-1)*l),d=Math.max(0,i-c),f=Math.min(u,o?d/o:0),ee=a.map(t=>Math.max(f,(e.get(t).value||0)*p)),h=ee.reduce((e,t)=>e+t,0)+c,g=Math.max(0,(i-h)/2);a.forEach((t,i)=>{let a=ee[i],c=n.left+r*s,u=g;m[t]={x:c,y:u,absoluteY:u,height:a,i,color:e.get(t).color,value:e.get(t).value,id:`flow_node_${L.value}_${nn(t)}`},g+=a,i<o-1&&(g+=l)})});let ee=[],h=n.top,te=Object.create(null),ne=Object.create(null);[...e.keys()].forEach(e=>{te[e]=m[e]?.y??0,ne[e]=0});let re=!!Mt.value.smooth,ie=.5;return a.forEach(n=>{t[n].forEach(t=>{let n=e.get(t),r=m[t];if(!n.children||!n.children.length)return;let i=r.y;n.children.forEach(({target:a,value:o,id:s})=>{let l=m[a],u=e.get(a),d=n.outflow>0?o/n.outflow:0,f=u.inflow>0?o/u.inflow:0,p=g(i+h),ae=g(i+d*r.height+h),oe=te[a],se=oe+f*l.height;ne[a]+=o;let ce=u.inflow>0&&ne[a]>=u.inflow-1e-6,le=l.y+l.height;(ce||se>le-.25)&&(se=le);let ue=g(oe+h),de=g(se+h),_=g(r.x+c),v=g(l.x),fe;if(!re||v<=_)fe=`M ${_} ${p} L ${_} ${ae} L ${v} ${de} L ${v} ${ue} Z`;else{let e=v-_,t=g(_+e*ie),n=g(v-e*ie),r=p,i=ue,a=ae,o=de;fe=`M ${_} ${r} C ${t} ${r}, ${n} ${i}, ${v} ${i} L ${v} ${o} C ${n} ${o}, ${t} ${a}, ${_} ${a} Z`}ee.push({id:s,source:t,target:a,path:fe,value:o,sourceColor:n.color,targetColor:e.get(a).color}),i=ae-h,te[a]=se})})}),{nodeCoordinates:m,links:ee}}let J=y(()=>{let e=an();return{nodes:Object.keys(e.nodeCoordinates).map((t,n)=>({...e.nodeCoordinates[t],name:t})),links:e.links}}),on=y(()=>W.value.padding),sn=y(()=>({width:Math.max(0,Ht.value-40-on.value.right-on.value.left),height:Math.max(0,Ut.value-on.value.top-on.value.bottom)})),cn=y(()=>({width:Ht.value,height:Ut.value}));function ln(e){let t=rn.value.nodes.get(e);return t?[.../* @__PURE__ */ new Set([...t.children.map(e=>e.target),...t.parents.map(e=>e.source),e])]:[]}let un=y(()=>{let e=new Map([...rn.value.nodes].map(([e,t])=>[e,t.color]));return new Map([...rn.value.nodes].map(([t,n])=>[t,{name:t,inflow:n.inflow,outflow:n.outflow,from:n.parents.map(t=>({...t,color:e.get(t.source)})),to:n.children.map(({target:t,value:n})=>({target:t,value:n,color:e.get(t)})),percentOfTotal:rn.value.totalRootFlow>0?n.value/rn.value.totalRootFlow*100:0,color:e.get(t)||`#000000`}]))}),Y=k(null),X=y(()=>{if(Y.value!=null)return J.value.nodes.filter(e=>$t(e.name)===Y.value).map(e=>e.name);let e=J.value.nodes.find(e=>e.id===Z.value);return e?ln(e.name):null}),dn=k(null),fn=k(!1),Z=k(null);function Q(){Z.value=null,Y.value=null,mt.value=!1,Ot.value=`pointer`}function pn(e){if(!K.value||!e)return;let t=K.value.querySelector(`[data-a11y-node-id="${e}"]`);if(!t)return;let n=t.getBoundingClientRect();Dt.value={x:n.left+n.width/2,y:n.top+n.height/2}}function mn(e,t,n=`pointer`,r=null,i=!0){if(!e)return;Y.value=null,Z.value=e.id,Ot.value=n;let a=un.value.get(e.name);if(!a)return;i&&V.value.events.datapointEnter&&V.value.events.datapointEnter({datapoint:a,seriesIndex:t}),dn.value={datapoint:a,config:V.value,seriesIndex:t,series:J.value},mt.value=!0;let o=``,s=W.value.tooltip.customFormat;if(fn.value=!1,f(s))try{let e=s({datapoint:a,series:J.value,config:V.value});typeof e==`string`&&(ht.value=e,fn.value=!0)}catch{console.warn(`Custom format cannot be applied.`)}if(!fn.value){let e=W.value.tooltip.showPercentage?`<div>${u({p:W.value.tooltip.translations.percentOfTotal,v:a.percentOfTotal,s:`%`,r:W.value.tooltip.roundingPercentage})}</div>`:``;o+=`<div style="width:100%;text-align:center;border-bottom:1px solid ${W.value.tooltip.borderColor};padding-bottom:6px;margin-bottom:3px;"><span style="margin-right:4px; color:${a.color}">⏹</span>${a.name}${e}</div>`,a.from.length&&(o+=`<div>${W.value.tooltip.translations.from}</div>`,a.from.forEach(e=>{o+=`<div><span style="color:${e.color}">⏹←</span> ${e.source}: ${Zt(e.value)}</div>`})),a.to.length&&(o+=`<div style="margin-top:6px;">${W.value.tooltip.translations.to}</div>`,a.to.forEach(e=>{o+=`<div><span style="color:${e.color}">⏹→</span> ${e.target}: ${Zt(e.value)}</div>`})),ht.value=o}n===`keyboard`&&Oe(()=>{pn(e.id)})}function hn(e){let t=dn.value;V.value.events.datapointLeave&&V.value.events.datapointLeave({datapoint:t,seriesIndex:e}),Ot.value===`keyboard`&&Et.value||Q()}function gn(e){let t=dn.value;V.value.events.datapointClick&&V.value.events.datapointClick({datapoint:t,seriesIndex:e})}let _n=y(()=>J.value.links.map(({source:e,target:t,sourceColor:n,targetColor:r,value:i})=>({source:e,target:t,sourceColor:n,targetColor:r,value:i})));function vn(e=null){Oe(()=>{let t=_n.value.map((e,t)=>[[e.source],[e.target],[e.value]]),n=[[W.value.title.text],[W.value.title.subtitle.text],[[V.value.table.columnNames.source],[V.value.table.columnNames.target],[V.value.table.columnNames.value]]].concat(t),r=d(n);e?e(r):ie({csvContent:r,title:W.value.title.text||`vue-ui-flow`})})}let yn=y(()=>{let e=[V.value.table.columnNames.source,V.value.table.columnNames.target,V.value.table.columnNames.value];return{colNames:e,head:e,body:_n.value.map((e,t)=>[{color:e.sourceColor,name:e.source,shape:`square`},{color:e.targetColor,name:e.target,shape:`square`},u({p:H.value.prefix,v:e.value,s:H.value.suffix,r:H.value.rounding})]),config:{th:{backgroundColor:V.value.table.th.backgroundColor,color:V.value.table.th.color,outline:V.value.table.th.outline},td:{backgroundColor:V.value.table.td.backgroundColor,color:V.value.table.td.color,outline:V.value.table.td.outline},breakpoint:V.value.table.responsiveBreakpoint}}}),bn=y(()=>({headers:yn.value?.colNames??[],rows:yn.value?.body.map(e=>[e[0].name,e[1].name,e[2]])??[]})),xn=y(()=>[...J.value.nodes].map((e,t)=>({...e,index:t,centerX:e.x+Qt.value/2,centerY:g(e.absoluteY)+W.value.padding.top+e.height/2})).sort((e,t)=>e.x===t.x?e.absoluteY-t.absoluteY:e.x-t.x)),$=y(()=>{let e=[];return xn.value.forEach(t=>{let n=e.find(e=>Math.abs(e.x-t.x)<=1);n?n.nodes.push(t):e.push({x:t.x,nodes:[t]})}),e.forEach(e=>{e.nodes.sort((e,t)=>e.absoluteY-t.absoluteY)}),e.sort((e,t)=>e.x-t.x)}),Sn=y(()=>{let e=/* @__PURE__ */ new Map;return xn.value.forEach((t,n)=>{e.set(t.id,n)}),e});function Cn(){return J.value}function wn(){q.value.showTable=!q.value.showTable}let Tn=k(!1);function En(){Tn.value=!Tn.value}function Dn(){q.value.showTooltip=!q.value.showTooltip}let On=y(()=>{let e=/* @__PURE__ */ new Map;for(let t of J.value.nodes){let n=$t(t.name)||`__uncategorized__`;e.set(n,(e.get(n)||0)+1)}return[...e].map(([e,t])=>({name:e,count:t,color:en(e)||p[0],shape:`square`})).map((e,t)=>{let n=Y.value===e.name;return{...e,segregate:()=>An({legend:e,i:t}),isSegregated:n,opacity:Y.value==null||n?1:.5,display:`${e.name} (${e.count})`}})}),kn=y(()=>On.value.filter(e=>e.name!==`__uncategorized__`));function An({legend:e}){let t=e.name,n=Y.value===t;Q(),Y.value=n?null:t}let jn=y(()=>({cy:`flow-legend`,backgroundColor:W.value.legend.backgroundColor,color:W.value.legend.color,fontSize:W.value.legend.fontSize,paddingBottom:W.value.legend.paddingBottom,fontWeight:W.value.legend.bold?`bold`:`normal`})),Mn=l(R,()=>W.value.title.text),Nn=y(()=>c({config:V,style:W,mutableConfig:q,dialog:lt,accordion:it,isFullscreen:B,parent:R,maxWidth:800,isCursorPointer:G}));P(()=>q.value.showTable,e=>s(e,V,Ct));function Pn(){q.value.showTable=!1,wt.value&&wt.value.setTableIconState(!1)}let Fn=y(()=>kn.value.map(e=>({...e,name:e.display}))),In=y(()=>W.value.backgroundColor),Ln=y(()=>W.value.legend),Rn=y(()=>W.value.title),{isCallbackImaging:zn,isCallbackSvg:Bn,generateSvg:Vn,onGenerateImage:Hn}=v({svg:K,title:Rn,legend:Ln,legendItems:Fn,backgroundColor:In,getSvgCallback:()=>V.value.userOptions.callbacks.svg,generateImage:Jt});async function Un(){dt(`copyAlt`,{config:V.value,dataset:J.value}),V.value.userOptions.callbacks.altCopy?await Promise.resolve(V.value.userOptions.callbacks.altCopy({config:V.value,dataset:J.value})):console.warn("Vue Data UI - A callback must be set for `altCopy` in userOptions.")}function Wn(e){return $.value.findIndex(t=>t.nodes.some(t=>t.id===e))}function Gn(e,t){let n=$.value[e];return n?n.nodes.findIndex(e=>e.id===t):-1}function Kn(e,t){let n=$.value[e];if(!n||!n.nodes.length)return null;let r=n.nodes[0],i=Math.abs(r.centerY-t);for(let e=1;e<n.nodes.length;e+=1){let a=n.nodes[e],o=Math.abs(a.centerY-t);o<i&&(r=a,i=o)}return r}function qn(){Q(),kt.value=!0}function Jn(){Q(),kt.value=!1}function Yn(e){if(!K.value||Tn.value||document.activeElement!==K.value||!xn.value.length)return;let t=e.key===`ArrowLeft`,n=e.key===`ArrowRight`,r=e.key===`ArrowUp`,i=e.key===`ArrowDown`,a=e.key===`Enter`||e.key===` `,o=e.key===`Escape`;if(!t&&!n&&!r&&!i&&!a&&!o)return;if(e.preventDefault(),e.stopPropagation(),o){Q();return}if(a){if(Tt.value===null)return;gn(Tt.value);return}if(Et.value===null){let e=$.value[0]?.nodes?.[0];if(!e)return;let t=Sn.value.get(e.id)??0;mn(e,t,`keyboard`,t);return}let s=Sn.value.get(Et.value);if(s===void 0)return;let c=xn.value[s];if(!c)return;let l=Wn(c.id);if(l<0)return;let u=null;if(r||i){let e=Gn(l,c.id);if(e<0)return;let t=$.value[l];if(!t?.nodes?.length)return;let n=e+(i?1:-1);n<0&&(n=t.nodes.length-1),n>=t.nodes.length&&(n=0),u=t.nodes[n]}if(t||n){let e=l+(n?1:-1);e<0&&(e=$.value.length-1),e>=$.value.length&&(e=0),u=Kn(e,c.centerY)}if(!u)return;let d=Sn.value.get(u.id);d!==void 0&&mn(u,d,`keyboard`,d)}return P([()=>V.value.responsive,()=>W.value.width,()=>W.value.height],Lt,{flush:`post`}),P(W,()=>bt?.(),{flush:`post`}),P(J,({nodes:e})=>{if(Y.value!=null){X.value.length||Q();return}if(Z.value==null)return;let t=e.findIndex(e=>e.id===Z.value);if(t<0){Q();return}let n=Sn.value.get(e[t].id);mn(e[t],t,Ot.value,n,!1)}),xe({getData:Cn,getImage:Mn,generateCsv:vn,generateImage:Jt,generateSvg:Vn,generatePdf:qt,toggleTable:wn,toggleAnnotator:En,toggleTooltip:Dn,drillCategory:An,unselectNode:hn,toggleFullscreen:jt,copyAlt:Un}),(e,s)=>(O(),S(`div`,{ref_key:`flowChart`,ref:R,class:ke(`vue-data-ui-component vue-ui-flow ${B.value?`vue-data-ui-wrapper-fullscreen`:``}`),style:D(`font-family:${V.value.style.fontFamily};width:100%; text-align:center;background:${W.value.backgroundColor}`),id:`flow_${L.value}`,onMouseenter:s[2]||=()=>N(zt)(!0),onMouseleave:s[3]||=()=>{N(zt)(!1),kt.value||Q()}},[C(`div`,{id:`chart-instructions-${L.value}`,class:`sr-only`},[C(`p`,null,M(V.value.a11y.translations.keyboardNavigation),1)],8,Le),V.value.a11y.includeTable&&bn.value?.rows?.length?(O(),b(be,{key:0,uid:L.value,head:bn.value.headers,body:bn.value.rows,notice:V.value.a11y.translations.tableAvailable,caption:V.value.a11y.translations.tableCaption},null,8,[`uid`,`head`,`body`,`notice`,`caption`])):x(``,!0),V.value.userOptions.buttons.annotator?(O(),b(N(ot),De({key:1},N(a)(V.value.userOptions.annotator),{svgRef:N(K),backgroundColor:W.value.backgroundColor,color:W.value.color,active:Tn.value,palette:V.value.userOptions.annotatorPalette,isCursorPointer:G.value,onClose:En}),we({_:2},[A(N(o),t=>({name:t,fn:F(n=>[j(e.$slots,t,E(T(N(i)(t,n))),void 0,!0)])}))]),1040,[`svgRef`,`backgroundColor`,`color`,`active`,`palette`,`isCursorPointer`])):x(``,!0),Yt.value?(O(),S(`div`,Re,null,512)):x(``,!0),W.value.title.text?(O(),S(`div`,{key:3,ref_key:`chartTitle`,ref:_t,style:`width:100%;background:transparent;padding-bottom:24px`},[(O(),b(ge,{key:`title_${pt.value}`,config:{title:{cy:`flow-title`,...W.value.title},subtitle:{cy:`flow-subtitle`,...W.value.title.subtitle}}},null,8,[`config`]))],512)):x(``,!0),C(`div`,{id:`legend-top-${L.value}`},null,8,ze),V.value.userOptions.show&&At.value&&(N(Bt)||N(Rt))?(O(),b(N(st),De({ref_key:`userOptionsRef`,ref:wt,key:`user_option_${ft.value}`,backgroundColor:W.value.backgroundColor,color:W.value.color,isPrinting:N(Gt),isImaging:N(Kt),uid:L.value,isFullscreen:B.value,chartElement:R.value},N(n)(V.value.userOptions,`pdf csv img svg table fullscreen altCopy annotator`),{isAnnotation:Tn.value,hasTooltip:W.value.tooltip.show&&V.value.userOptions.buttons.tooltip,isTooltip:q.value.showTooltip,tableDialog:V.value.table.useDialog,isCursorPointer:G.value,onToggleTooltip:Dn,onToggleFullscreen:jt,onGeneratePdf:N(qt),onGenerateCsv:vn,onGenerateImage:N(Hn),onGenerateSvg:N(Vn),onToggleTable:wn,onToggleAnnotator:En,onCopyAlt:Un,style:{visibility:N(Bt)?N(Rt)?`visible`:`hidden`:`visible`}}),we({_:2},[A(N(t)(e.$slots,`menuIcon optionTooltip optionPdf optionCsv optionImg optionSvg optionTable optionFullscreen optionAnnotator optionAltCopy custom-menu-before custom-menu-after`),t=>({name:t,fn:F(n=>[j(e.$slots,t,E(T(N(r)(t,n))),void 0,!0)])}))]),1040,[`backgroundColor`,`color`,`isPrinting`,`isImaging`,`uid`,`isFullscreen`,`chartElement`,`isAnnotation`,`hasTooltip`,`isTooltip`,`tableDialog`,`isCursorPointer`,`onGeneratePdf`,`onGenerateImage`,`onGenerateSvg`,`style`])):x(``,!0),C(`div`,Be,[(O(),S(`svg`,{ref_key:`svgRef`,ref:K,xmlns:N(oe),"aria-describedby":`chart-instructions-${L.value}`,viewBox:`0 0 ${cn.value.width} ${cn.value.height}`,class:ke({"vue-data-ui-fullscreen--on":B.value,"vue-data-ui-fulscreen--off":!B.value}),style:D({maxWidth:`100%`,overflow:`visible`,background:`transparent`,color:W.value.color}),tabindex:`0`,onFocus:qn,onBlur:Jn,onKeydown:Yn},[Ee(N(ct)),j(e.$slots,`svg-underlayer`,{svg:{...cn.value,isPrintingImg:N(Gt)||N(Kt)||N(zn),isPrintingSvg:N(Bn)}},void 0,!0),e.$slots[`chart-background`]?(O(),S(`foreignObject`,{key:0,x:0,y:0,width:cn.value.width,height:cn.value.height,style:{pointerEvents:`none`}},[j(e.$slots,`chart-background`,{},void 0,!0)],8,He)):x(``,!0),C(`defs`,null,[(O(!0),S(Se,null,A(J.value.links,(e,t)=>(O(),S(`linearGradient`,{id:e.id,x1:`0%`,y1:`0%`,x2:`100%`,y2:`0%`},[C(`stop`,{offset:`0%`,"stop-color":e.sourceColor},null,8,We),C(`stop`,{offset:`100%`,"stop-color":e.targetColor},null,8,Ge)],8,Ue))),256))]),(O(!0),S(Se,null,A(J.value.links,e=>(O(),S(`path`,{class:`vue-ui-flow-link`,d:e.path,"stroke-linejoin":`round`,"stroke-miterlimit":`1`,fill:`url(#${e.id})`,stroke:Mt.value.stroke,"stroke-width":Mt.value.strokeWidth,style:D(`
1
+ import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{n as t,r as n,t as r}from"./userOptionsSlots-CWtXN5Q6.js";import{n as i,r as a,t as o}from"./annotationSlots-OLiW25XN.js";import{n as s,t as c}from"./tableIntegration-CNoJ1CIY.js";import{t as l}from"./chartImage-Dvrx_F7P.js";import{$ as u,D as d,Dt as f,Ht as p,S as m,X as ee,Zt as h,b as g,i as te,in as ne,n as re,nt as ie,r as ae,t as oe,w as se}from"./lib-BaWaqwnJ.js";import{n as ce,t as le}from"./useHints-C-TwxM0Y.js";import{t as ue}from"./useConfig-B-AzS3w-.js";import{t as de}from"./usePrinter-CUD8gosC.js";import{t as _}from"./useLoading-DoqqfnmS.js";import{t as v}from"./useChartExport-BZts4KFb.js";import{n as fe}from"./resolveChartConfig-QgMumfgd.js";import{t as pe}from"./useResponsive-CENUxfEL.js";import{t as me}from"./useUserOptionState-CXlFnwPv.js";import{t as he}from"./useChartAccessibility-DOMuYJfm.js";import{n as ge}from"./Title-DlhGIAWX.js";import{t as _e}from"./vue_ui_flow-N2kD68UX.js";import{t as ve}from"./Legend-D5I3jeGD.js";import{t as ye}from"./BaseScanner-m6QR9rwD.js";import{t as be}from"./A11yDataTable-DWNlWXzs.js";import{t as xe}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{Fragment as Se,Teleport as Ce,computed as y,createBlock as b,createCommentVNode as x,createElementBlock as S,createElementVNode as C,createSlots as we,createTextVNode as Te,createVNode as Ee,defineAsyncComponent as w,guardReactiveProps as T,mergeProps as De,nextTick as Oe,normalizeClass as ke,normalizeProps as E,normalizeStyle as D,onBeforeUnmount as Ae,onMounted as je,openBlock as O,ref as k,renderList as A,renderSlot as j,resolveDynamicComponent as Me,shallowRef as Ne,toDisplayString as M,toRefs as Pe,unref as N,watch as P,withCtx as F}from"vue";var Fe=/* @__PURE__ */ e({default:()=>nt}),Ie=[`id`],Le=[`id`],Re={key:2,ref:`noTitle`,class:`vue-data-ui-no-title-space`,style:`height:36px; width: 100%;background:transparent`},ze=[`id`],Be={style:{position:`relative`}},Ve=[`xmlns`,`aria-describedby`,`viewBox`],He=[`width`,`height`],Ue=[`id`],We=[`stop-color`],Ge=[`stop-color`],Ke=[`d`,`fill`,`stroke`,`stroke-width`],qe=[`data-a11y-node-id`,`x`,`y`,`height`,`width`,`fill`,`stroke`,`stroke-width`,`rx`,`aria-label`,`onMouseenter`,`onMouseleave`,`onClick`],Je={key:1},Ye=[`x`,`y`,`font-size`,`fill`],Xe=[`x`,`y`,`font-size`,`fill`],Ze={key:0,style:{position:`absolute`,top:`100%`,left:`0`,width:`100%`},"data-dom-to-png-ignore":``,"aria-hidden":`true`},Qe={key:5,class:`vue-data-ui-watermark`},$e=[`id`],et=[`onClick`],tt={style:{display:`flex`,"align-items":`center`}},nt=/*#__PURE__*/ xe({__name:`vue-ui-flow`,props:{config:{type:Object,default(){return{}}},dataset:{type:Array,default(){return[]}}},emits:[`copyAlt`],setup(e,{expose:xe,emit:Fe}){let nt=w(()=>import(`./Tooltip-CL3U31cL.js`)),rt=w(()=>import(`./BaseIcon-CQFjKDhE.js`).then(e=>e.n)),it=w(()=>import(`./vue-ui-accordion-B8LYfVG9.js`).then(e=>e.n)),at=w(()=>import(`./DataTable-BHW5xD9B.js`)),ot=w(()=>import(`./PenAndPaper-B2UOwiJM.js`).then(e=>e.t)),st=w(()=>import(`./UserOptions-B97cPcKc.js`).then(e=>e.n)),ct=w(()=>import(`./PackageVersion-B-1JX0wI.js`).then(e=>e.t)),lt=w(()=>import(`./BaseDraggableDialog-MyWIeEtr.js`).then(e=>e.n)),{vue_ui_flow:ut}=ue(),I=e,dt=Fe,L=k(ee()),R=k(null),ft=k(0),pt=k(0),mt=k(!1),ht=k(``),gt=k(null),_t=k(null),vt=k(null),yt=Ne(null),z=null,bt=null,xt=!1,St=k(!1),Ct=k(null),wt=k(null),Tt=y(()=>Z.value==null?null:Sn.value.get(Z.value)??null),Et=y(()=>Z.value),Dt=k({x:0,y:0}),Ot=k(`pointer`),kt=k(!1),At=y(()=>!!I.dataset&&I.dataset.length);je(()=>{St.value=!0,Lt()});let B=k(!1);function jt(e){B.value=e,ft.value+=1}let V=k(Vt()),H=y(()=>V.value.style.chart.nodes.labels),U=y(()=>V.value.style.chart.nodes),Mt=y(()=>V.value.style.chart.links),W=y(()=>V.value.style.chart);ce({config:()=>V.value,dataset:()=>I.dataset,component:`VueUiFlow`,rules:[le.emptyArray,le.noHint]});let G=y(()=>V.value.userOptions.useCursorPointer),Nt=y(()=>ne({defaultConfig:{userOptions:{show:!1},nodeCategories:{B:`A`,C:`B`},nodeCategoryColors:{A:`#CACACA`,B:`#AAAAAA`},table:{show:!1},style:{chart:{backgroundColor:`#99999930`,legend:{backgroundColor:`transparent`},nodes:{labels:{show:!1},stroke:`#666666`},links:{stroke:`#666666`}}}},userConfig:V.value.skeletonConfig??{}})),{loading:Pt,FINAL_DATASET:Ft}=_({...Pe(I),FINAL_CONFIG:V,prepareConfig:Vt,skeletonDataset:I.config?.skeletonDataset??[[`A`,`B`,2,`#CACACA`],[`B`,`C`,1,`#CACACA`],[`C`,`D`,.5,`#CACACA`],[`E`,`F`,1,`#AAAAAA`],[`F`,`G`,.5,`#AAAAAA`],[`G`,`H`,.25,`#AAAAAA`]],skeletonConfig:ne({defaultConfig:V.value,userConfig:Nt.value})});function It(){bt=null,yt.value?.disconnect(),yt.value=null,z!==null&&cancelAnimationFrame(z),z=null}function Lt(){if(It(),!V.value.responsive){Ht.value=W.value.width,Ut.value=W.value.height;return}let e=R.value?.parentNode;if(!e)return;let t=()=>{z!==null&&cancelAnimationFrame(z),z=requestAnimationFrame(()=>{if(z=null,xt)return;let{width:e,height:t}=pe({chart:R.value,title:W.value.title.text?_t.value:null,legend:W.value.legend.show?gt.value:null,source:vt.value});Ht.value=e,Ut.value=t})};bt=t,yt.value=new ResizeObserver(t),yt.value.observe(e),t()}Ae(()=>{xt=!0,It()});let{userOptionsVisible:Rt,setUserOptionsVisibility:zt,keepUserOptionState:Bt}=me({config:V.value}),{svgRef:K}=he({config:W.value.title});function Vt(){return{...fe(I.config,ut,_e),nodeCategories:I.config.nodeCategories||{},nodeCategoryColors:I.config.nodeCategoryColors||{}}}let Ht=k(W.value.width),Ut=k(W.value.height),Wt=h(I.config);P(()=>I.config,(e,t)=>{let n=h(e),r=n!==Wt;Wt=n;let i=Vt();r?(Pt.value||(V.value=i),Rt.value=!V.value.userOptions.showOnChartHover,pt.value+=1,q.value.showTable=V.value.table.show):(V.value.style.chart.tooltip=i.style.chart.tooltip,q.value.showTooltip=V.value.style.chart.tooltip.show)},{deep:!0});let{isPrinting:Gt,isImaging:Kt,generatePdf:qt,generateImage:Jt}=de({elementId:`flow_${L.value}`,fileName:W.value.title.text||`vue-ui-flow`,options:V.value.userOptions.print}),Yt=y(()=>V.value.userOptions.show&&!W.value.title.text),Xt=y(()=>se(V.value.customPalette));function Zt(e,t){return te(H.value.formatter,e,u({p:H.value.prefix,v:e,s:H.value.suffix,r:H.value.rounding}),t)}let Qt=y(()=>U.value.width),q=k({showTable:V.value.table.show,showTooltip:W.value.tooltip.show});P(V,()=>{q.value={showTable:V.value.table.show,showTooltip:W.value.tooltip.show}},{immediate:!0});function $t(e){let t=V.value.nodeCategories;return Object.hasOwn(t,e)?t[e]:void 0}function en(e){let t=V.value.nodeCategoryColors;return Object.hasOwn(t,e)?t[e]:void 0}let tn=y(()=>(Ft.value||[]).map(([e,t,n,r])=>[e,t,typeof n==`number`&&Number.isFinite(n)?Math.max(0,n):0,r?m(r):null]));function nn(e){return Array.from(String(e),e=>e.codePointAt(0).toString(16)).join(`_`)}let rn=y(()=>{let e=/* @__PURE__ */ new Map,t=/* @__PURE__ */ new Map;function n(t){return e.has(t)||e.set(t,{name:t,level:0,inflow:0,outflow:0,children:[],parents:[],color:null}),e.get(t)}let r=/* @__PURE__ */ new Map;tn.value.forEach(([e,i,a,o])=>{let s=n(e),c=n(i),l=JSON.stringify([e,i]),u=r.get(l)||0;r.set(l,u+1),s.children.push({target:i,value:a,id:`flow_link_${L.value}_${nn(l)}_${u}`}),c.parents.push({source:e,value:a}),s.outflow+=a,c.inflow+=a,o&&(t.set(e,o),t.set(i,o))});let i=[...e.values()].filter(e=>!e.parents.length),a=new Map([...e].map(([e,t])=>[e,t.parents.length])),o=i.map(e=>e.name);for(let t=0;t<o.length;t++){let n=e.get(o[t]);for(let{target:t}of n.children){let r=e.get(t);r.level=Math.max(r.level,n.level+1),a.set(t,a.get(t)-1),a.get(t)||o.push(t)}}for(let[t,n]of a)n>0&&(e.get(t).level=0);let s=new Map(i.map((e,t)=>[e.name,Xt.value[t]||p[t%p.length]])),c=Object.create(null),l=0;for(let[n,r]of e){let e=$t(n);r.color=t.get(n)||(e?en(e):null)||s.get(n)||p[l%p.length],l++,r.value=Math.max(r.inflow,r.outflow),(c[r.level]||=[]).push(n)}return{nodes:e,levels:c,totalRootFlow:i.reduce((e,t)=>e+t.outflow,0)}});function an(){let{nodes:e,levels:t}=rn.value,n=on.value,r=sn.value.width,i=sn.value.height,a=Object.keys(t).map(Number).sort((e,t)=>e-t),o=a.length||1,s=o>1?r/(o-1):0,c=Number(Qt.value),l=Number(U.value.gapPx??U.value.gap??8),u=Number(U.value.minHeight||0);function d(n){let r=t[n],a=r.length;if(!a)return 1/0;let o=Math.max(0,(a-1)*l),s=Math.max(0,i-o),c=Math.min(u,a?s/a:0),d=0,f=r.map(t=>e.get(t).value||0),p=f.reduce((e,t)=>e+t,0);for(let e=0;e<12;e+=1){let e=p>0?(s-d)/p:0,t=[];for(let n=0;n<f.length;n+=1){let r=f[n];r<0||r*e<c&&t.push(n)}if(!t.length)return Math.max(0,e);for(let e of t)d+=c,p-=f[e],f[e]=-1;if(p<=0)return 0}return p>0?Math.max(0,(s-d)/p):0}let f=a.map(d),p=f.length?Math.min(...f):0,m=Object.create(null);a.forEach(r=>{let a=t[r],o=a.length,c=Math.max(0,(o-1)*l),d=Math.max(0,i-c),f=Math.min(u,o?d/o:0),ee=a.map(t=>Math.max(f,(e.get(t).value||0)*p)),h=ee.reduce((e,t)=>e+t,0)+c,g=Math.max(0,(i-h)/2);a.forEach((t,i)=>{let a=ee[i],c=n.left+r*s,u=g;m[t]={x:c,y:u,absoluteY:u,height:a,i,color:e.get(t).color,value:e.get(t).value,id:`flow_node_${L.value}_${nn(t)}`},g+=a,i<o-1&&(g+=l)})});let ee=[],h=n.top,te=Object.create(null),ne=Object.create(null);[...e.keys()].forEach(e=>{te[e]=m[e]?.y??0,ne[e]=0});let re=!!Mt.value.smooth,ie=.5;return a.forEach(n=>{t[n].forEach(t=>{let n=e.get(t),r=m[t];if(!n.children||!n.children.length)return;let i=r.y;n.children.forEach(({target:a,value:o,id:s})=>{let l=m[a],u=e.get(a),d=n.outflow>0?o/n.outflow:0,f=u.inflow>0?o/u.inflow:0,p=g(i+h),ae=g(i+d*r.height+h),oe=te[a],se=oe+f*l.height;ne[a]+=o;let ce=u.inflow>0&&ne[a]>=u.inflow-1e-6,le=l.y+l.height;(ce||se>le-.25)&&(se=le);let ue=g(oe+h),de=g(se+h),_=g(r.x+c),v=g(l.x),fe;if(!re||v<=_)fe=`M ${_} ${p} L ${_} ${ae} L ${v} ${de} L ${v} ${ue} Z`;else{let e=v-_,t=g(_+e*ie),n=g(v-e*ie),r=p,i=ue,a=ae,o=de;fe=`M ${_} ${r} C ${t} ${r}, ${n} ${i}, ${v} ${i} L ${v} ${o} C ${n} ${o}, ${t} ${a}, ${_} ${a} Z`}ee.push({id:s,source:t,target:a,path:fe,value:o,sourceColor:n.color,targetColor:e.get(a).color}),i=ae-h,te[a]=se})})}),{nodeCoordinates:m,links:ee}}let J=y(()=>{let e=an();return{nodes:Object.keys(e.nodeCoordinates).map((t,n)=>({...e.nodeCoordinates[t],name:t})),links:e.links}}),on=y(()=>W.value.padding),sn=y(()=>({width:Math.max(0,Ht.value-40-on.value.right-on.value.left),height:Math.max(0,Ut.value-on.value.top-on.value.bottom)})),cn=y(()=>({width:Ht.value,height:Ut.value}));function ln(e){let t=rn.value.nodes.get(e);return t?[.../* @__PURE__ */ new Set([...t.children.map(e=>e.target),...t.parents.map(e=>e.source),e])]:[]}let un=y(()=>{let e=new Map([...rn.value.nodes].map(([e,t])=>[e,t.color]));return new Map([...rn.value.nodes].map(([t,n])=>[t,{name:t,inflow:n.inflow,outflow:n.outflow,from:n.parents.map(t=>({...t,color:e.get(t.source)})),to:n.children.map(({target:t,value:n})=>({target:t,value:n,color:e.get(t)})),percentOfTotal:rn.value.totalRootFlow>0?n.value/rn.value.totalRootFlow*100:0,color:e.get(t)||`#000000`}]))}),Y=k(null),X=y(()=>{if(Y.value!=null)return J.value.nodes.filter(e=>$t(e.name)===Y.value).map(e=>e.name);let e=J.value.nodes.find(e=>e.id===Z.value);return e?ln(e.name):null}),dn=k(null),fn=k(!1),Z=k(null);function Q(){Z.value=null,Y.value=null,mt.value=!1,Ot.value=`pointer`}function pn(e){if(!K.value||!e)return;let t=K.value.querySelector(`[data-a11y-node-id="${e}"]`);if(!t)return;let n=t.getBoundingClientRect();Dt.value={x:n.left+n.width/2,y:n.top+n.height/2}}function mn(e,t,n=`pointer`,r=null,i=!0){if(!e)return;Y.value=null,Z.value=e.id,Ot.value=n;let a=un.value.get(e.name);if(!a)return;i&&V.value.events.datapointEnter&&V.value.events.datapointEnter({datapoint:a,seriesIndex:t}),dn.value={datapoint:a,config:V.value,seriesIndex:t,series:J.value},mt.value=!0;let o=``,s=W.value.tooltip.customFormat;if(fn.value=!1,f(s))try{let e=s({datapoint:a,series:J.value,config:V.value});typeof e==`string`&&(ht.value=e,fn.value=!0)}catch{console.warn(`Custom format cannot be applied.`)}if(!fn.value){let e=W.value.tooltip.showPercentage?`<div>${u({p:W.value.tooltip.translations.percentOfTotal,v:a.percentOfTotal,s:`%`,r:W.value.tooltip.roundingPercentage})}</div>`:``;o+=`<div style="width:100%;text-align:center;border-bottom:1px solid ${W.value.tooltip.borderColor};padding-bottom:6px;margin-bottom:3px;"><span style="margin-right:4px; color:${a.color}">⏹</span>${a.name}${e}</div>`,a.from.length&&(o+=`<div>${W.value.tooltip.translations.from}</div>`,a.from.forEach(e=>{o+=`<div><span style="color:${e.color}">⏹←</span> ${e.source}: ${Zt(e.value)}</div>`})),a.to.length&&(o+=`<div style="margin-top:6px;">${W.value.tooltip.translations.to}</div>`,a.to.forEach(e=>{o+=`<div><span style="color:${e.color}">⏹→</span> ${e.target}: ${Zt(e.value)}</div>`})),ht.value=o}n===`keyboard`&&Oe(()=>{pn(e.id)})}function hn(e){let t=dn.value;V.value.events.datapointLeave&&V.value.events.datapointLeave({datapoint:t,seriesIndex:e}),Ot.value===`keyboard`&&Et.value||Q()}function gn(e){let t=dn.value;V.value.events.datapointClick&&V.value.events.datapointClick({datapoint:t,seriesIndex:e})}let _n=y(()=>J.value.links.map(({source:e,target:t,sourceColor:n,targetColor:r,value:i})=>({source:e,target:t,sourceColor:n,targetColor:r,value:i})));function vn(e=null){Oe(()=>{let t=_n.value.map((e,t)=>[[e.source],[e.target],[e.value]]),n=[[W.value.title.text],[W.value.title.subtitle.text],[[V.value.table.columnNames.source],[V.value.table.columnNames.target],[V.value.table.columnNames.value]]].concat(t),r=d(n);e?e(r):ie({csvContent:r,title:W.value.title.text||`vue-ui-flow`})})}let yn=y(()=>{let e=[V.value.table.columnNames.source,V.value.table.columnNames.target,V.value.table.columnNames.value];return{colNames:e,head:e,body:_n.value.map((e,t)=>[{color:e.sourceColor,name:e.source,shape:`square`},{color:e.targetColor,name:e.target,shape:`square`},u({p:H.value.prefix,v:e.value,s:H.value.suffix,r:H.value.rounding})]),config:{th:{backgroundColor:V.value.table.th.backgroundColor,color:V.value.table.th.color,outline:V.value.table.th.outline},td:{backgroundColor:V.value.table.td.backgroundColor,color:V.value.table.td.color,outline:V.value.table.td.outline},breakpoint:V.value.table.responsiveBreakpoint}}}),bn=y(()=>({headers:yn.value?.colNames??[],rows:yn.value?.body.map(e=>[e[0].name,e[1].name,e[2]])??[]})),xn=y(()=>[...J.value.nodes].map((e,t)=>({...e,index:t,centerX:e.x+Qt.value/2,centerY:g(e.absoluteY)+W.value.padding.top+e.height/2})).sort((e,t)=>e.x===t.x?e.absoluteY-t.absoluteY:e.x-t.x)),$=y(()=>{let e=[];return xn.value.forEach(t=>{let n=e.find(e=>Math.abs(e.x-t.x)<=1);n?n.nodes.push(t):e.push({x:t.x,nodes:[t]})}),e.forEach(e=>{e.nodes.sort((e,t)=>e.absoluteY-t.absoluteY)}),e.sort((e,t)=>e.x-t.x)}),Sn=y(()=>{let e=/* @__PURE__ */ new Map;return xn.value.forEach((t,n)=>{e.set(t.id,n)}),e});function Cn(){return J.value}function wn(){q.value.showTable=!q.value.showTable}let Tn=k(!1);function En(){Tn.value=!Tn.value}function Dn(){q.value.showTooltip=!q.value.showTooltip}let On=y(()=>{let e=/* @__PURE__ */ new Map;for(let t of J.value.nodes){let n=$t(t.name)||`__uncategorized__`;e.set(n,(e.get(n)||0)+1)}return[...e].map(([e,t])=>({name:e,count:t,color:en(e)||p[0],shape:`square`})).map((e,t)=>{let n=Y.value===e.name;return{...e,segregate:()=>An({legend:e,i:t}),isSegregated:n,opacity:Y.value==null||n?1:.5,display:`${e.name} (${e.count})`}})}),kn=y(()=>On.value.filter(e=>e.name!==`__uncategorized__`));function An({legend:e}){let t=e.name,n=Y.value===t;Q(),Y.value=n?null:t}let jn=y(()=>({cy:`flow-legend`,backgroundColor:W.value.legend.backgroundColor,color:W.value.legend.color,fontSize:W.value.legend.fontSize,paddingBottom:W.value.legend.paddingBottom,fontWeight:W.value.legend.bold?`bold`:`normal`})),Mn=l(R,()=>W.value.title.text),Nn=y(()=>c({config:V,style:W,mutableConfig:q,dialog:lt,accordion:it,isFullscreen:B,parent:R,maxWidth:800,isCursorPointer:G}));P(()=>q.value.showTable,e=>s(e,V,Ct));function Pn(){q.value.showTable=!1,wt.value&&wt.value.setTableIconState(!1)}let Fn=y(()=>kn.value.map(e=>({...e,name:e.display}))),In=y(()=>W.value.backgroundColor),Ln=y(()=>W.value.legend),Rn=y(()=>W.value.title),{isCallbackImaging:zn,isCallbackSvg:Bn,generateSvg:Vn,onGenerateImage:Hn}=v({svg:K,title:Rn,legend:Ln,legendItems:Fn,backgroundColor:In,getSvgCallback:()=>V.value.userOptions.callbacks.svg,generateImage:Jt});async function Un(){dt(`copyAlt`,{config:V.value,dataset:J.value}),V.value.userOptions.callbacks.altCopy?await Promise.resolve(V.value.userOptions.callbacks.altCopy({config:V.value,dataset:J.value})):console.warn("Vue Data UI - A callback must be set for `altCopy` in userOptions.")}function Wn(e){return $.value.findIndex(t=>t.nodes.some(t=>t.id===e))}function Gn(e,t){let n=$.value[e];return n?n.nodes.findIndex(e=>e.id===t):-1}function Kn(e,t){let n=$.value[e];if(!n||!n.nodes.length)return null;let r=n.nodes[0],i=Math.abs(r.centerY-t);for(let e=1;e<n.nodes.length;e+=1){let a=n.nodes[e],o=Math.abs(a.centerY-t);o<i&&(r=a,i=o)}return r}function qn(){Q(),kt.value=!0}function Jn(){Q(),kt.value=!1}function Yn(e){if(!K.value||Tn.value||document.activeElement!==K.value||!xn.value.length)return;let t=e.key===`ArrowLeft`,n=e.key===`ArrowRight`,r=e.key===`ArrowUp`,i=e.key===`ArrowDown`,a=e.key===`Enter`||e.key===` `,o=e.key===`Escape`;if(!t&&!n&&!r&&!i&&!a&&!o)return;if(e.preventDefault(),e.stopPropagation(),o){Q();return}if(a){if(Tt.value===null)return;gn(Tt.value);return}if(Et.value===null){let e=$.value[0]?.nodes?.[0];if(!e)return;let t=Sn.value.get(e.id)??0;mn(e,t,`keyboard`,t);return}let s=Sn.value.get(Et.value);if(s===void 0)return;let c=xn.value[s];if(!c)return;let l=Wn(c.id);if(l<0)return;let u=null;if(r||i){let e=Gn(l,c.id);if(e<0)return;let t=$.value[l];if(!t?.nodes?.length)return;let n=e+(i?1:-1);n<0&&(n=t.nodes.length-1),n>=t.nodes.length&&(n=0),u=t.nodes[n]}if(t||n){let e=l+(n?1:-1);e<0&&(e=$.value.length-1),e>=$.value.length&&(e=0),u=Kn(e,c.centerY)}if(!u)return;let d=Sn.value.get(u.id);d!==void 0&&mn(u,d,`keyboard`,d)}return P([()=>V.value.responsive,()=>W.value.width,()=>W.value.height],Lt,{flush:`post`}),P(W,()=>bt?.(),{flush:`post`}),P(J,({nodes:e})=>{if(Y.value!=null){X.value.length||Q();return}if(Z.value==null)return;let t=e.findIndex(e=>e.id===Z.value);if(t<0){Q();return}let n=Sn.value.get(e[t].id);mn(e[t],t,Ot.value,n,!1)}),xe({getData:Cn,getImage:Mn,generateCsv:vn,generateImage:Jt,generateSvg:Vn,generatePdf:qt,toggleTable:wn,toggleAnnotator:En,toggleTooltip:Dn,drillCategory:An,unselectNode:hn,toggleFullscreen:jt,copyAlt:Un}),(e,s)=>(O(),S(`div`,{ref_key:`flowChart`,ref:R,class:ke(`vue-data-ui-component vue-ui-flow ${B.value?`vue-data-ui-wrapper-fullscreen`:``}`),style:D(`font-family:${V.value.style.fontFamily};width:100%; text-align:center;background:${W.value.backgroundColor}`),id:`flow_${L.value}`,onMouseenter:s[2]||=()=>N(zt)(!0),onMouseleave:s[3]||=()=>{N(zt)(!1),kt.value||Q()}},[C(`div`,{id:`chart-instructions-${L.value}`,class:`sr-only`},[C(`p`,null,M(V.value.a11y.translations.keyboardNavigation),1)],8,Le),V.value.a11y.includeTable&&bn.value?.rows?.length?(O(),b(be,{key:0,uid:L.value,head:bn.value.headers,body:bn.value.rows,notice:V.value.a11y.translations.tableAvailable,caption:V.value.a11y.translations.tableCaption},null,8,[`uid`,`head`,`body`,`notice`,`caption`])):x(``,!0),V.value.userOptions.buttons.annotator?(O(),b(N(ot),De({key:1},N(a)(V.value.userOptions.annotator),{svgRef:N(K),backgroundColor:W.value.backgroundColor,color:W.value.color,active:Tn.value,palette:V.value.userOptions.annotatorPalette,isCursorPointer:G.value,onClose:En}),we({_:2},[A(N(o),t=>({name:t,fn:F(n=>[j(e.$slots,t,E(T(N(i)(t,n))),void 0,!0)])}))]),1040,[`svgRef`,`backgroundColor`,`color`,`active`,`palette`,`isCursorPointer`])):x(``,!0),Yt.value?(O(),S(`div`,Re,null,512)):x(``,!0),W.value.title.text?(O(),S(`div`,{key:3,ref_key:`chartTitle`,ref:_t,style:`width:100%;background:transparent;padding-bottom:24px`},[(O(),b(ge,{key:`title_${pt.value}`,config:{title:{cy:`flow-title`,...W.value.title},subtitle:{cy:`flow-subtitle`,...W.value.title.subtitle}}},null,8,[`config`]))],512)):x(``,!0),C(`div`,{id:`legend-top-${L.value}`},null,8,ze),V.value.userOptions.show&&At.value&&(N(Bt)||N(Rt))?(O(),b(N(st),De({ref_key:`userOptionsRef`,ref:wt,key:`user_option_${ft.value}`,backgroundColor:W.value.backgroundColor,color:W.value.color,isPrinting:N(Gt),isImaging:N(Kt),uid:L.value,isFullscreen:B.value,chartElement:R.value},N(n)(V.value.userOptions,`pdf csv img svg table fullscreen altCopy annotator`),{isAnnotation:Tn.value,hasTooltip:W.value.tooltip.show&&V.value.userOptions.buttons.tooltip,isTooltip:q.value.showTooltip,tableDialog:V.value.table.useDialog,isCursorPointer:G.value,onToggleTooltip:Dn,onToggleFullscreen:jt,onGeneratePdf:N(qt),onGenerateCsv:vn,onGenerateImage:N(Hn),onGenerateSvg:N(Vn),onToggleTable:wn,onToggleAnnotator:En,onCopyAlt:Un,style:{visibility:N(Bt)?N(Rt)?`visible`:`hidden`:`visible`}}),we({_:2},[A(N(t)(e.$slots,`menuIcon optionTooltip optionPdf optionCsv optionImg optionSvg optionTable optionFullscreen optionAnnotator optionAltCopy custom-menu-before custom-menu-after`),t=>({name:t,fn:F(n=>[j(e.$slots,t,E(T(N(r)(t,n))),void 0,!0)])}))]),1040,[`backgroundColor`,`color`,`isPrinting`,`isImaging`,`uid`,`isFullscreen`,`chartElement`,`isAnnotation`,`hasTooltip`,`isTooltip`,`tableDialog`,`isCursorPointer`,`onGeneratePdf`,`onGenerateImage`,`onGenerateSvg`,`style`])):x(``,!0),C(`div`,Be,[(O(),S(`svg`,{ref_key:`svgRef`,ref:K,xmlns:N(oe),"aria-describedby":`chart-instructions-${L.value}`,viewBox:`0 0 ${cn.value.width} ${cn.value.height}`,class:ke({"vue-data-ui-fullscreen--on":B.value,"vue-data-ui-fulscreen--off":!B.value}),style:D({maxWidth:`100%`,overflow:`visible`,background:`transparent`,color:W.value.color}),tabindex:`0`,onFocus:qn,onBlur:Jn,onKeydown:Yn},[Ee(N(ct)),j(e.$slots,`svg-underlayer`,{svg:{...cn.value,isPrintingImg:N(Gt)||N(Kt)||N(zn),isPrintingSvg:N(Bn)}},void 0,!0),e.$slots[`chart-background`]?(O(),S(`foreignObject`,{key:0,x:0,y:0,width:cn.value.width,height:cn.value.height,style:{pointerEvents:`none`}},[j(e.$slots,`chart-background`,{},void 0,!0)],8,He)):x(``,!0),C(`defs`,null,[(O(!0),S(Se,null,A(J.value.links,(e,t)=>(O(),S(`linearGradient`,{id:e.id,x1:`0%`,y1:`0%`,x2:`100%`,y2:`0%`},[C(`stop`,{offset:`0%`,"stop-color":e.sourceColor},null,8,We),C(`stop`,{offset:`100%`,"stop-color":e.targetColor},null,8,Ge)],8,Ue))),256))]),(O(!0),S(Se,null,A(J.value.links,e=>(O(),S(`path`,{class:`vue-ui-flow-link`,d:e.path,"stroke-linejoin":`round`,"stroke-miterlimit":`1`,fill:`url(#${e.id})`,stroke:Mt.value.stroke,"stroke-width":Mt.value.strokeWidth,style:D(`
2
2
  opacity:${X.value?X.value.includes(e.source)&&X.value.includes(e.target)?1:.3:Mt.value.opacity}
3
3
  `)},null,12,Ke))),256)),(O(!0),S(Se,null,A(J.value.nodes,(e,t)=>(O(),S(`rect`,{"data-a11y-node-id":e.id,class:`vue-ui-flow-node`,x:e.x,y:N(g)(e.absoluteY)+W.value.padding.top,height:N(g)(e.height),width:Qt.value,fill:e.color,stroke:U.value.stroke,"stroke-width":U.value.strokeWidth,rx:U.value.borderRadius,style:D({opacity:X.value?X.value.includes(e.name)?1:.3:1,outline:Z.value!==null&&Z.value===e.id?`2px solid currentColor`:void 0}),"aria-label":`${e.name}: ${Zt(e.value)}`,onMouseenter:n=>mn(e,t,`pointer`,Sn.value.get(e.id)),onMouseleave:e=>hn(t),onClick:e=>gn(t)},null,44,qe))),256)),H.value.show?(O(),S(`g`,Je,[(O(!0),S(Se,null,A(J.value.nodes,(e,t)=>(O(),S(`text`,{x:e.x+Qt.value/2,y:(H.value.showValue?N(g)(e.absoluteY+e.height/2-H.value.fontSize/4):e.absoluteY+e.height/2+H.value.fontSize/3)+W.value.padding.top,"font-size":H.value.fontSize,fill:N(ae)(e.color),"text-anchor":`middle`,style:D(`pointer-events: none; opacity:${X.value?+!!X.value.includes(e.name):1}`)},M(H.value.abbreviation.use?N(re)({source:e.name,length:U.value.labels.abbreviation.length}):e.name),13,Ye))),256)),H.value.showValue?(O(!0),S(Se,{key:0},A(J.value.nodes,(e,t)=>(O(),S(`text`,{x:e.x+Qt.value/2,y:N(g)(e.absoluteY+e.height/2+H.value.fontSize/1.3)+W.value.padding.top,"font-size":H.value.fontSize,fill:N(ae)(e.color),"text-anchor":`middle`,style:D(`pointer-events: none; opacity:${X.value?+!!X.value.includes(e.name):1}`)},M(Zt(e.value,{datapoint:e,seriesIndex:t})),13,Xe))),256)):x(``,!0)])):x(``,!0),j(e.$slots,`svg`,{svg:{...cn.value,isPrintingImg:N(Gt)||N(Kt)||N(zn),isPrintingSvg:N(Bn)}},void 0,!0)],46,Ve)),e.$slots.hint?(O(),S(`div`,Ze,[j(e.$slots,`hint`,E(T({hint:V.value.a11y.translations.keyboardNavigation,isVisible:kt.value})),void 0,!0)])):x(``,!0)]),e.$slots.watermark?(O(),S(`div`,Qe,[j(e.$slots,`watermark`,E(T({isPrinting:N(Gt)||N(Kt)||N(zn)||N(Bn)})),void 0,!0)])):x(``,!0),C(`div`,{id:`legend-bottom-${L.value}`},null,8,$e),St.value&&(W.value.legend.show||e.$slots.legend)?(O(),b(Ce,{key:6,to:W.value.legend.position===`top`?`#legend-top-${L.value}`:`#legend-bottom-${L.value}`},[C(`div`,{ref_key:`chartLegend`,ref:gt},[j(e.$slots,`legend`,{legend:On.value},()=>[W.value.legend.show&&kn.value.length?(O(),b(ve,{key:0,legendSet:kn.value,config:jn.value,isCursorPointer:G.value,onClickMarker:s[0]||=e=>An(e)},{item:F(({legend:e,index:t})=>[N(Pt)?x(``,!0):(O(),S(`div`,{key:0,onClick:t=>e.segregate(),style:D({opacity:e.opacity})},M(e.display),13,et))]),_:1},8,[`legendSet`,`config`,`isCursorPointer`])):x(``,!0)],!0)],512)],8,[`to`])):x(``,!0),e.$slots.source?(O(),S(`div`,{key:7,ref_key:`source`,ref:vt,dir:`auto`},[j(e.$slots,`source`,{},void 0,!0)],512)):x(``,!0),Ee(N(nt),{teleportTo:W.value.tooltip.teleportTo,show:q.value.showTooltip&&mt.value,backgroundColor:W.value.tooltip.backgroundColor,color:W.value.tooltip.color,fontSize:W.value.tooltip.fontSize,borderRadius:W.value.tooltip.borderRadius,borderColor:W.value.tooltip.borderColor,borderWidth:W.value.tooltip.borderWidth,backgroundOpacity:W.value.tooltip.backgroundOpacity,position:W.value.tooltip.position,offsetX:W.value.tooltip.offsetX,offsetY:W.value.tooltip.offsetY,parent:R.value,content:ht.value,isCustom:fn.value,isFullscreen:B.value,smooth:W.value.tooltip.smooth,backdropFilter:W.value.tooltip.backdropFilter,smoothForce:W.value.tooltip.smoothForce,smoothSnapThreshold:W.value.tooltip.smoothSnapThreshold,isA11yMode:Ot.value===`keyboard`,a11yPosition:Dt.value},{"tooltip-before":F(()=>[j(e.$slots,`tooltip-before`,E(T({...dn.value})),void 0,!0)]),tooltip:F(()=>[j(e.$slots,`tooltip`,E(T({...dn.value})),void 0,!0)]),"tooltip-after":F(()=>[j(e.$slots,`tooltip-after`,E(T({...dn.value})),void 0,!0)]),_:3},8,[`teleportTo`,`show`,`backgroundColor`,`color`,`fontSize`,`borderRadius`,`borderColor`,`borderWidth`,`backgroundOpacity`,`position`,`offsetX`,`offsetY`,`parent`,`content`,`isCustom`,`isFullscreen`,`smooth`,`backdropFilter`,`smoothForce`,`smoothSnapThreshold`,`isA11yMode`,`a11yPosition`]),At.value&&V.value.userOptions.buttons.table?(O(),b(Me(Nn.value.component),De({key:8},Nn.value.props,{ref_key:`tableUnit`,ref:Ct,onClose:Pn}),we({content:F(()=>[Ee(N(at),{colNames:yn.value.colNames,head:yn.value.head,body:yn.value.body,config:yn.value.config,title:V.value.table.useDialog?``:Nn.value.title,withCloseButton:!V.value.table.useDialog,isCursorPointer:G.value,onClose:Pn},{th:F(({th:e})=>[C(`div`,tt,M(e),1)]),td:F(({td:e})=>[Te(M(e.name||e),1)]),_:1},8,[`colNames`,`head`,`body`,`config`,`title`,`withCloseButton`,`isCursorPointer`])]),_:2},[V.value.table.useDialog?{name:`title`,fn:F(()=>[Te(M(Nn.value.title),1)]),key:`0`}:void 0,V.value.table.useDialog?{name:`actions`,fn:F(()=>[C(`button`,{tabindex:`0`,class:`vue-ui-user-options-button`,onClick:s[1]||=e=>vn(V.value.userOptions.callbacks.csv),style:D({cursor:G.value?`pointer`:`default`})},[Ee(N(rt),{name:`fileCsv`,stroke:Nn.value.props.color},null,8,[`stroke`])],4)]),key:`1`}:void 0]),1040)):x(``,!0),j(e.$slots,`skeleton`,{},()=>[N(Pt)?(O(),b(ye,{key:0})):x(``,!0)],!0)],46,Ie))}},[[`__scopeId`,`data-v-579c8625`]]);export{Fe as n,nt as t};